qbs-src-3.2.0/0000755000175100017510000000000015154533055012502 5ustar runnerrunnerqbs-src-3.2.0/LGPL_EXCEPTION.txt0000644000175100017510000000225015154533055015416 0ustar runnerrunnerThe Qt Company LGPL Exception version 1.1 As an additional permission to the GNU Lesser General Public License version 2.1, the object code form of a "work that uses the Library" may incorporate material from a header file that is part of the Library. You may distribute such object code under terms of your choice, provided that: (i) the header files of the Library have not been modified; and (ii) the incorporated material is limited to numerical parameters, data structure layouts, accessors, macros, inline functions and templates; and (iii) you comply with the terms of Section 6 of the GNU Lesser General Public License version 2.1. Moreover, you may apply this exception to a modified version of the Library, provided that such modification does not involve copying material from the Library into the modified Library's header files unless such material is limited to (i) numerical parameters; (ii) data structure layouts; (iii) accessors; and (iv) small macros, templates and inline functions of five lines or less in length. Furthermore, you are not required to apply this additional permission to a modified version of the Library. qbs-src-3.2.0/.clang-format0000644000175100017510000000636115154533055015063 0ustar runnerrunner# .clang-format for Qbs # based on https://github.com/qt-creator/qt-creator/blob/v12.0.1/.clang-format # # This is for clang-format >= 5.0. # # Use ../../tests/clang-format-test/clang-format-test.cpp for documenting problems # or testing changes. # --- Language: Cpp AccessModifierOffset: -4 AlignAfterOpenBracket: AlwaysBreak AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false AlignEscapedNewlines: DontAlign AlignOperands: true AlignTrailingComments: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: Inline AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: Yes BinPackArguments: false BinPackParameters: false BraceWrapping: AfterClass: true AfterControlStatement: Never AfterEnum: false AfterFunction: true AfterNamespace: false AfterObjCDeclaration: false AfterStruct: true AfterUnion: false BeforeCatch: false BeforeElse: false IndentBraces: false SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false BreakBeforeBinaryOperators: All BreakBeforeBraces: Custom BreakBeforeInheritanceComma: false BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeComma BreakAfterJavaFieldAnnotations: false BreakStringLiterals: true ColumnLimit: 100 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: false DisableFormat: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: - forever # avoids { wrapped to next line - foreach - Q_FOREACH - BOOST_FOREACH IncludeCategories: - Regex: '^ Everyone is permitted to copy and distribute verbatim copies of this licensedocument, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License. “The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”. The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. qbs-src-3.2.0/VERSION0000644000175100017510000000000615154533055013546 0ustar runnerrunner3.2.0 qbs-src-3.2.0/README.md0000644000175100017510000000222315154533055013760 0ustar runnerrunner# Qbs Qbs is a build automation tool designed to conveniently manage the build process of software projects across multiple platforms. Qbs can be used for any software project, regardless of programming language, toolkit, or libraries used. ## Documentation Qbs product documentation is available at [doc.qt.io/qbs](http://doc.qt.io/qbs/index.html) The project's homepage is [wiki.qt.io/qbs](http://wiki.qt.io/qbs) ## Supported platforms Qbs binaries are available for Windows, macOS, Linux, and FreeBSD. For more information about how to install Qbs on your platform, see the [Installing](https://doc.qt.io/qbs/installing.html) page in the documentation. Qbs allows to build applications for different platforms, for the list of supported platforms and the details about each platform, see the [Target Platforms](https://doc.qt.io/qbs/platforms.html) page. ## Building Qbs For information about building Qbs from sources, see ["Appendix A: Building Qbs"](http://doc.qt.io/qbs/building-qbs.html). ## Reporting Bugs Please report any bugs in our [bug tracker](https://bugreports.qt.io/browse/QBS). ## Contributing See [Contributing to Qbs](CONTRIBUTING.md) qbs-src-3.2.0/release/0000755000175100017510000000000015154533055014122 5ustar runnerrunnerqbs-src-3.2.0/docker-compose.yml0000644000175100017510000000644215154533055016145 0ustar runnerrunnerversion: "3.7" x-default-service: &linux working_dir: /qbs environment: - BUILD_OPTIONS - QTEST_FUNCTION_TIMEOUT - QBS_AUTOTEST_PROFILE - QBS_TEST_SOURCE_ROOT - WITH_ARCHIVE - WITH_TESTS volumes: - .:/qbs - ~/.ccache:/home/devel/.ccache - /cores:/cores network_mode: bridge cap_add: - SYS_PTRACE ulimits: core: soft: -1 hard: -1 services: noble-qt6: &noble-qt6 << : *linux hostname: noble-qt6 image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-qt6-6.8.3_2.5.1-1 build: dockerfile: docker/noble/Dockerfile context: . args: QT_VERSION: 6.8.3 QBS_VERSION: 2.5.1 noble: << : *noble-qt6 noble-qt5: << : *linux hostname: noble-qt5 image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-5.15.2_2.5.1-2 build: dockerfile: docker/noble/Dockerfile context: . args: QT_VERSION: 5.15.2 QBS_VERSION: 2.5.1 noble-android-65: << : *linux hostname: noble-android image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-android-6.5.0-0 build: dockerfile: docker/noble/test-android.Dockerfile context: . args: QT_VERSION: 6.5.0 ANDROID_NDK_VERSION: 25.1.8937393 noble-android-515: << : *linux hostname: noble-android image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-android-5.15.2-0 build: dockerfile: docker/noble/test-android.Dockerfile context: . args: QT_VERSION: 5.15.2 ANDROID_NDK_VERSION: 23.0.7599858 noble-android-ndk-r25: << : *linux hostname: noble-android image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-android-ndk-r25-0 build: dockerfile: docker/noble/test-android-no-qt.Dockerfile context: . args: ANDROID_NDK_VERSION: 25.1.8937393 noble-baremetal: << : *linux hostname: noble-baremetal image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-baremetal-0 build: dockerfile: docker/noble/test-baremetal.Dockerfile context: . noble-qt6-static: << : *linux hostname: noble-qt6-static image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-qt6-static-6.5.3_2.3.2-0 build: dockerfile: docker/noble/test-qt6-static.Dockerfile context: . args: QT_VERSION: 6.5.3 QTCREATOR_VERSION: 13.0.2 noble-qt6-wasm: << : *linux hostname: noble-qt6-wasm image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-qt6-wasm-6.7.3-0 build: dockerfile: docker/noble/test-qt6-wasm.Dockerfile context: . args: QT_VERSION: 6.7.3 EMSCRIPTEN_VERSION: 3.1.50 leap: << : *linux hostname: leap image: ${DOCKER_USER:-qbsbuild}/qbsdev:leap-5.15.2_1.20.1-1 build: dockerfile: docker/leap/Dockerfile context: . args: QT_VERSION: 5.15.2 QTCREATOR_VERSION: 5.0.3 windows: image: ${DOCKER_USER:-qbsbuild}/qbsdev:windowsservercore-6.8.3_3.0.1-1 build: dockerfile: docker/windowsservercore/Dockerfile context: . args: QT_VERSION: 6.8.3 QBS_VERSION: 3.0.1 working_dir: 'C:/qbs' environment: - BUILD_OPTIONS - WITH_DOCS volumes: - type: bind source: . target: C:\qbs - type: bind source: ~/.ccache target: C:\.ccache network_mode: nat qbs-src-3.2.0/tests/0000755000175100017510000000000015154533055013644 5ustar runnerrunnerqbs-src-3.2.0/tests/lspclient/0000755000175100017510000000000015154533055015641 5ustar runnerrunnerqbs-src-3.2.0/tests/lspclient/lspclient.cpp0000644000175100017510000003557715154533055020363 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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 #include #include #include #include #include #include #include #include #include #include #include enum class Command { GotoDefinition, Completion, }; class LspClient : public QObject { public: LspClient(Command command, const QString &socketPath, const QString &codeToInsert, int insertLine, int insertColumn, const QString &filePath, int line, int column); void start(); private: void finishWithError(const QString &msg); void exit(int code); void initiateProtocol(); void handleIncomingData(); void sendMessage(const lsp::JsonObject &msg); void sendMessage(const lsp::JsonRpcMessage &msg); void handleCurrentMessage(); void handleInitializeReply(); void openDocument(); void insertCode(); void sendRequest(); void handleResponse(); void sendGotoDefinitionRequest(); void handleGotoDefinitionResponse(); void sendCompletionRequest(); void handleCompletionResponse(); lsp::DocumentUri uri() const; lsp::DocumentUri::PathMapper mapper() const; const Command m_command; const QString m_socketPath; const QString m_codeToInsert; const int m_insertLine; const int m_insertColumn; const QString m_filePath; int m_line; int m_column; QLocalSocket m_socket; QBuffer m_incomingData; lsp::BaseMessage m_currentMessage; QJsonObject m_messageObject; enum class State { Inactive, Connecting, Initializing, RunningCommand } m_state = State::Inactive; }; int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); const QCommandLineOption socketOption({"socket", "s"}, "The server socket to connect to.", "socket"); const QCommandLineOption gotoDefinitionOption( {"goto-def", "g"}, "Go to definition from the specified location."); const QCommandLineOption completionOption( {"completion", "c"}, "Request completion at the specified location."); const QCommandLineOption insertCodeOption("insert-code", "A piece of code to insert before doing the actual " "operation.", "code"); const QCommandLineOption insertLocationOption("insert-location", "The location at which to insert the code.", ":"); QCommandLineParser parser; parser.addOptions( {socketOption, insertCodeOption, insertLocationOption, gotoDefinitionOption, completionOption}); parser.addHelpOption(); parser.addPositionalArgument("location", "The location at which to operate.", "::"); parser.process(app); const auto complainAndExit = [&](const char *text) { std::cerr << text << std::endl; parser.showHelp(EXIT_FAILURE); }; if (!parser.isSet(socketOption)) complainAndExit("Socket must be specified."); // Initialized to suppress warning. TODO: In C++23, mark lambdas as noreturn instead. Command command = Command::GotoDefinition; if (parser.isSet(gotoDefinitionOption)) command = Command::GotoDefinition; else if (parser.isSet(completionOption)) command = Command::Completion; else complainAndExit("Don't know what to do."); if (parser.positionalArguments().size() != 1) complainAndExit("Need location."); const auto complainAboutLocationString = [&] { complainAndExit("Invalid location."); }; const QString loc = parser.positionalArguments().first(); int sep1 = loc.indexOf(':'); if (sep1 <= 0) complainAboutLocationString(); if (qbs::Internal::HostOsInfo::isWindowsHost()) { sep1 = loc.indexOf(':', sep1 + 1); if (sep1 < 0) complainAboutLocationString(); } const int sep2 = loc.indexOf(':', sep1 + 1); if (sep2 == -1 || sep2 == loc.size() - 1) complainAboutLocationString(); const auto extractNumber = [&](const QString &s) { bool ok; const int n = s.toInt(&ok); if (!ok || n <= 0) complainAboutLocationString(); return n; }; const int line = extractNumber(loc.mid(sep1 + 1, sep2 - sep1 - 1)); const int column = extractNumber(loc.mid(sep2 + 1)); const QString insertLoc = parser.value(insertLocationOption); int insertLine = -1; int insertColumn = -1; if (insertLoc.isEmpty()) { insertLine = line; insertColumn = column; } else { const int sep = insertLoc.indexOf(':'); if (sep <= 0) complainAboutLocationString(); insertLine = extractNumber(insertLoc.left(sep)); insertColumn = extractNumber(insertLoc.mid(sep + 1)); } LspClient client(command, parser.value(socketOption), parser.value(insertCodeOption), insertLine, insertColumn, QDir::fromNativeSeparators(loc.left(sep1)), line, column); QMetaObject::invokeMethod(&client, &LspClient::start, Qt::QueuedConnection); return app.exec(); } LspClient::LspClient(Command command, const QString &socketPath, const QString &codeToInsert, int insertLine, int insertColumn, const QString &filePath, int line, int column) : m_command(command), m_socketPath(socketPath), m_codeToInsert(codeToInsert), m_insertLine(insertLine), m_insertColumn(insertColumn), m_filePath(filePath), m_line(line), m_column(column) { connect(&m_socket, &QLocalSocket::disconnected, this, [this] { finishWithError("Server disconnected unexpectedly."); }); connect(&m_socket, &QLocalSocket::errorOccurred, this, [this] { finishWithError(QString::fromLatin1("Socket error: %1").arg(m_socket.errorString())); }); connect(&m_socket, &QLocalSocket::connected, this, &LspClient::initiateProtocol); connect(&m_socket, &QLocalSocket::readyRead, this, &LspClient::handleIncomingData); } void LspClient::start() { m_state = State::Connecting; m_incomingData.open(QIODevice::ReadWrite | QIODevice::Append); m_socket.connectToServer(m_socketPath); } void LspClient::finishWithError(const QString &msg) { std::cerr << qPrintable(msg) << std::endl; m_socket.disconnectFromServer(); exit(EXIT_FAILURE); } void LspClient::exit(int code) { m_socket.disconnect(this); qApp->exit(code); } void LspClient::initiateProtocol() { if (m_state != State::Connecting) { finishWithError(QString::fromLatin1("State should be %1, was %2.") .arg(int(State::Connecting), int(m_state))); return; } m_state = State::Initializing; lsp::DynamicRegistrationCapabilities definitionCaps; definitionCaps.setDynamicRegistration(false); lsp::TextDocumentClientCapabilities docCaps; docCaps.setDefinition(definitionCaps); lsp::ClientCapabilities clientCaps; clientCaps.setTextDocument(docCaps); lsp::InitializeParams initParams; initParams.setCapabilities(clientCaps); sendMessage(lsp::InitializeRequest(initParams)); } void LspClient::handleIncomingData() { const int pos = m_incomingData.pos(); m_incomingData.write(m_socket.readAll()); m_incomingData.seek(pos); QString parseError; lsp::BaseMessage::parse(&m_incomingData, parseError, m_currentMessage); if (!parseError.isEmpty()) { return finishWithError(QString::fromLatin1("Error parsing server message: %1.") .arg(parseError)); } if (m_currentMessage.isComplete()) { m_incomingData.buffer().remove(0, m_incomingData.pos()); m_incomingData.seek(0); handleCurrentMessage(); m_currentMessage = {}; m_messageObject = {}; if (m_socket.state() == QLocalSocket::ConnectedState) handleIncomingData(); } } void LspClient::sendMessage(const lsp::JsonObject &msg) { sendMessage(lsp::JsonRpcMessage(msg)); } void LspClient::sendMessage(const lsp::JsonRpcMessage &msg) { lsp::BaseMessage baseMsg = msg.toBaseMessage(); m_socket.write(baseMsg.header()); m_socket.write(baseMsg.content); } void LspClient::handleCurrentMessage() { m_messageObject = lsp::JsonRpcMessage(m_currentMessage).toJsonObject(); switch (m_state) { case State::Inactive: case State::Connecting: finishWithError("Received message in non-connected state."); break; case State::Initializing: handleInitializeReply(); openDocument(); insertCode(); sendRequest(); break; case State::RunningCommand: handleResponse(); break; } } void LspClient::handleInitializeReply() { lsp::ServerCapabilities serverCaps = lsp::InitializeRequest::Response( m_messageObject).result().value_or(lsp::InitializeResult()).capabilities(); const auto defProvider = serverCaps.definitionProvider(); if (!defProvider) return finishWithError("Expected definition provider."); const bool * const defProviderValue = std::get_if(&(*defProvider)); if (!defProviderValue || !*defProviderValue) return finishWithError("Expected definition provider."); sendMessage(lsp::InitializeNotification(lsp::InitializedParams())); } void LspClient::openDocument() { QFile file(m_filePath); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { return finishWithError(QString::fromLatin1("Could not open '%1': %2") .arg(m_filePath, file.errorString())); } lsp::TextDocumentItem item; item.setUri(uri()); item.setVersion(0); item.setText(QString::fromUtf8(file.readAll())); item.setLanguageId("application/x-qt.qbs+qml"); sendMessage(lsp::DidOpenTextDocumentNotification(lsp::DidOpenTextDocumentParams(item))); } void LspClient::insertCode() { if (m_codeToInsert.isEmpty()) return; lsp::VersionedTextDocumentIdentifier docId; docId.setUri(uri()); docId.setVersion(1); lsp::DidChangeTextDocumentParams params(docId); lsp::DidChangeTextDocumentParams::TextDocumentContentChangeEvent change; const lsp::Position insertPos(m_insertLine - 1, m_insertColumn- 1); change.setRange({insertPos, insertPos}); change.setText(m_codeToInsert); params.setContentChanges({change}); sendMessage(lsp::DidChangeTextDocumentNotification(params)); if (m_insertLine > m_line || (m_insertLine == m_line && m_insertColumn > m_column)) return; const int newlineCount = m_codeToInsert.count('\n'); m_line += newlineCount; m_column += m_codeToInsert.size() - (newlineCount == 0 ? 0 : m_codeToInsert.lastIndexOf('\n')); } void LspClient::sendRequest() { m_state = State::RunningCommand; switch (m_command) { case Command::GotoDefinition: return sendGotoDefinitionRequest(); case Command::Completion: return sendCompletionRequest(); } } void LspClient::handleResponse() { const QString error = m_messageObject.value(lsp::errorKey).toObject() .value("message").toString(); if (!error.isEmpty()) return finishWithError(error); switch (m_command) { case Command::GotoDefinition: return handleGotoDefinitionResponse(); case Command::Completion: return handleCompletionResponse(); } } void LspClient::sendGotoDefinitionRequest() { const lsp::TextDocumentIdentifier doc(uri()); const lsp::Position pos(m_line - 1, m_column - 1); sendMessage(lsp::GotoDefinitionRequest({doc, pos})); } void LspClient::handleGotoDefinitionResponse() { const lsp::GotoResult result(lsp::GotoDefinitionRequest::Response(m_messageObject) .result().value_or(lsp::GotoResult())); QList links; const auto loc2Link = [this](const lsp::Location &loc) { return loc.toLink(mapper()); }; if (const auto loc = std::get_if(&result)) { links << loc2Link(*loc); } else if (const auto locs = std::get_if>(&result)) { links = lsp::Utils::transform(*locs, loc2Link); } for (const lsp::Utils::Link &link : std::as_const(links)) { std::cout << qPrintable(link.targetFilePath) << ':' << link.targetLine << ':' << (link.targetColumn + 1) << std::endl; } exit(EXIT_SUCCESS); } void LspClient::sendCompletionRequest() { const lsp::TextDocumentIdentifier doc(uri()); const lsp::Position pos(m_line - 1, m_column - 1); sendMessage(lsp::CompletionRequest({doc, pos})); } void LspClient::handleCompletionResponse() { const lsp::CompletionResult result(lsp::CompletionRequest::Response(m_messageObject) .result() .value_or(lsp::CompletionResult())); if (const auto items = std::get_if>(&result)) { for (const lsp::CompletionItem &item : *items) { std::cout << qPrintable(item.label()); if (item.detail()) std::cout << ' ' << qPrintable(*item.detail()); std::cout << std::endl; } } exit(EXIT_SUCCESS); } lsp::DocumentUri LspClient::uri() const { return lsp::DocumentUri::fromFilePath(lsp::Utils::FilePath::fromUserInput(m_filePath), mapper()); } lsp::DocumentUri::PathMapper LspClient::mapper() const { return [](const lsp::Utils::FilePath &fp) { return fp; }; } qbs-src-3.2.0/tests/lspclient/CMakeLists.txt0000644000175100017510000000025015154533055020376 0ustar runnerrunneradd_qbs_app(qbs_lspclient DEPENDS Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network qbscore qtclsp SOURCES lspclient.cpp ) qbs-src-3.2.0/tests/lspclient/lspclient.qbs0000644000175100017510000000033115154533055020342 0ustar runnerrunnerQbsApp { name: "qbs_lspclient" Depends { name: "qtclsp" } Depends { name: "Qt.network" } cpp.defines: base.filter(function(d) { return d !== "QT_NO_CAST_FROM_ASCII"; }) files: "lspclient.cpp" } qbs-src-3.2.0/tests/clang-format-test/0000755000175100017510000000000015154533055017173 5ustar runnerrunnerqbs-src-3.2.0/tests/clang-format-test/clang-format-test.qbs0000644000175100017510000000026515154533055023234 0ustar runnerrunnerQtApplication { Depends { name: "Qt.core" } files: "clang-format.cpp" cpp.cxxLanguageVersion: "c++20" cpp.minimumMacosVersion: "11.0" cpp.warningLevel: "none" } qbs-src-3.2.0/tests/clang-format-test/CMakeLists.txt0000644000175100017510000000014515154533055021733 0ustar runnerrunneradd_qbs_app(clang-format-test DEPENDS Qt${QT_VERSION_MAJOR}::Core SOURCES clang-format.cpp ) qbs-src-3.2.0/tests/clang-format-test/clang-format.cpp0000644000175100017510000004574715154533055022272 0ustar runnerrunner// Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // // KEEP THIS FILE COMPILABLE TO ENSURE THAT WE TEST AGAINST VALID CODE. // // NOTE: Nice, includes are sorted #include #include #include #include #include #include #include #include static int aGlobalInt = 3; // ------------------------------------------------------------------------------------------------- // Preprocessor // ------------------------------------------------------------------------------------------------- // NOTE: Ops, preprocessor branches are not indented ("#define" vs "# define") #if defined(TEXTEDITOR_LIBRARY) #define TEXTEDITOR_EXPORT Q_DECL_EXPORT #else #define TEXTEDITOR_EXPORT Q_DECL_IMPORT #endif // ------------------------------------------------------------------------------------------------- // Macros // ------------------------------------------------------------------------------------------------- #define QTCREATOR_UTILS_EXPORT // qtcassert.h: namespace Utils { void writeAssertLocation(const char *msg) { std::printf("%s", msg); } } // namespace Utils #define QTC_ASSERT_STRINGIFY_HELPER(x) #x #define QTC_ASSERT_STRINGIFY(x) QTC_ASSERT_STRINGIFY_HELPER(x) #define QTC_ASSERT_STRING(cond) \ ::Utils::writeAssertLocation("\"" cond "\" in file " __FILE__ \ ", line " QTC_ASSERT_STRINGIFY(__LINE__)) // NOTE: Ops, macro definitions: are more verbose #define QTC_ASSERT(cond, action) \ if (cond) { \ } else { \ QTC_ASSERT_STRING(#cond); \ action; \ } \ do { \ } while (0) #define QTC_CHECK(cond) \ if (cond) { \ } else { \ QTC_ASSERT_STRING(#cond); \ } \ do { \ } while (0) #define QTC_GUARD(cond) ((cond) ? true : (QTC_ASSERT_STRING(#cond), false)) void lala(int foo) { Q_UNUSED(foo) Q_UNUSED(foo); QTC_ASSERT(true, return); // NOTE: Ops, extra space with QTC_ASSERT macro and return keyword QTC_ASSERT(true, return;); while (true) QTC_ASSERT(true, break); // ...but this is fine } // ------------------------------------------------------------------------------------------------- // Namespaces // ------------------------------------------------------------------------------------------------- namespace N { namespace C { struct Foo {}; struct Bar {}; namespace { class ClassInUnnamedNamespace {}; } // namespace // NOTE: Nice, namespace end comments are added/updated automatically } // namespace C struct Baz {}; } // namespace N namespace N2 {} // ------------------------------------------------------------------------------------------------- // Forward declarations // ------------------------------------------------------------------------------------------------- // NOTE: Ops, no one-liner anymore: forward declarations within namespace namespace N { struct Baz; } class SourceLocation; class SourceRange; class ClangString; QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE QT_FORWARD_DECLARE_CLASS(QTextDocument) QT_FORWARD_DECLARE_CLASS(QTextBlock); // ------------------------------------------------------------------------------------------------- // Using declarations, using directives, using alias, typedefs // ------------------------------------------------------------------------------------------------- // NOTE: OK, using directives are not sorted using namespace std; using namespace N2; using namespace N; // NOTE: Nice, using declarations are sorted using N::C::Bar; using N::C::Foo; // NOTE: OK, typedefs are not sorted typedef N::C::Foo TypedefedFoor; typedef N::C::Bar TypedefedBar; // NOTE: OK, using aliases are not sorted using AliasedFoor = N::C::Foo; using AliasedBar = N::C::Bar; // ------------------------------------------------------------------------------------------------- // Comments // ------------------------------------------------------------------------------------------------- // NOTE: OK, reflowing/wrapping of comments is turned off for now. // This is a fancy comment that might be reflowed or not or not or not or not or not or not or not or not or not. // NOTE: Nice, comments after declarations are aligned int foo; // fancy comment describing foo int superDuperFoo; // fancy comment describing superDuperFoo int lalaFoo; // fancy comment describing lalaFoo // ------------------------------------------------------------------------------------------------- // Function declarations // ------------------------------------------------------------------------------------------------- void f(); void f2() {} void f3(int parameter1, int parameter2, int parameter3); // NOTE: Ops, awkward placement of parameter list, there is no equivalent of // PenaltyBreakBeforeFirstCallParameter for parameter list void f3( int parameter1, int parameter2, int parameter3, int parameter4, int parameter5, int parameter6); void f3( int parameter1, int parameter2, int parameter3, int parameter4, int parameter5, int parameter6, int parrameter7, int p = aGlobalInt); bool operator==(N::Baz, N::Baz); template void fancyTemplateFunction(); template void variadicTemplateFunction(Type *...arg); // ------------------------------------------------------------------------------------------------- // Inside functions // ------------------------------------------------------------------------------------------------- int myfunction(int parameter1, int parameter2) { // Function calls myfunction(parameter1, parameter2); // Casts int value = 3; int z = (int) value; int a = static_cast(value + z); // Pointer/references alignment int *p = nullptr; int &r = *p; // Operators int result = parameter1 + parameter1 + parameter1 + parameter1 + parameter1 + parameter1 + parameter1 + parameter1; // Long expressions int someVeryLooooooooooooooooooooooooooooooooooooooooooooooooooongInt = -1; bool condition1 = false; bool condition2 = false; // NOTE: Ops, alignment of readable, boolean and complex expressions will be reverted if (condition1 || condition2 || someVeryLooooooooooooooooooooooooooooooooooooooooooooooooooongInt) { return value; } // Initializer lists vector x{1, 2, 3, 4}; vector y{{}, {}, {}, {}}; new int[3]{1, 2, 3}; // Streams // NOTE: OK, there is a heuristic (endl, '\n') to wrap statements with stream operators. cout << "Hello" << parameter1 << endl << parameter2 << endl << result << endl << condition1 << someVeryLooooooooooooooooooooooooooooooooooooooooooooooooooongInt; cout << "Hello" << parameter1 << '\n' << parameter2 << '\n' << a << '\n' << condition1 << someVeryLooooooooooooooooooooooooooooooooooooooooooooooooooongInt; // ...but here not: cout << "Hello" << parameter1 << '\t' << parameter2 << '\t' << z << '\t' << condition1 << someVeryLooooooooooooooooooooooooooooooooooooooooooooooooooongInt << r; return 1; } // ------------------------------------------------------------------------------------------------- // Ternary Operator // ------------------------------------------------------------------------------------------------- bool ternary() { bool someWhatLongerName; bool someWhatLongerName2; bool isThatReallyReallyReallyReallyReallyReallyReallyReallyTrue = false; bool isThatReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyTrue = false; bool yesno = true ? true : false; bool sino = isThatReallyReallyReallyReallyReallyReallyReallyReallyTrue ? someWhatLongerName : someWhatLongerName2; bool danet = isThatReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyTrue ? someWhatLongerName : someWhatLongerName2; return yesno && sino && danet; } // ------------------------------------------------------------------------------------------------- // Penalty Test // ------------------------------------------------------------------------------------------------- int functionToCall(int parameter1) { return 1; } int functionToCall(int paramter1, int parameter2) { return 1; } int functionToCall(int paramter1, int parameter2, int parameter3) { return 1; } int functionToCall(int paramter1, int parameter2, int parameter3, int parameter4, int parameter5) { return 1; } int functionToCall( int paramter1, int parameter2, int parameter3, int parameter4, int parameter5, int paramete6) { return 1; } int functionToCall( int paramter1, int parameter2, int parameter3, int parameter4, int parameter5, int paramete6, int parameter6) { return 1; } bool functionToCallSt(const QString ¶mter1, const QStringList &list) { return 1; } void emitAddOutput(const QString &text, int priority) {} void emitAddOutput(const QString &text, int priority, int category) {} void penaltyTests(bool isThatTrue) { int valueX = 3; int valueY = 1; int valueZ = 1; int valueXTimesY = valueX * valueY; int unbelievableBigValue = 1000000; int unlimitedValueunbelievableBigValue = 1000000; QString arguments; QString argumentsVeryLong; const QFile::OpenMode openMode = isThatTrue ? QIODevice::ReadOnly : (QIODevice::ReadOnly | QIODevice::Text); const auto someValue10 = functionToCall(valueX, valueY, valueXTimesY); const auto someValue11 = functionToCall( valueX, valueY, valueXTimesY, unbelievableBigValue, unbelievableBigValue); const auto someValue12 = functionToCall( valueX, valueY, valueXTimesY, unbelievableBigValue, unbelievableBigValue * unbelievableBigValue, unbelievableBigValue); const auto someValue13 = functionToCall( valueX, valueY, valueXTimesY, unbelievableBigValue, functionToCall(functionToCall(valueX), functionToCall(valueY)), unbelievableBigValue); const auto someValue14WithAnOutstandingLongName = functionToCall( valueX, valueY, valueXTimesY, unbelievableBigValue, functionToCall(functionToCall(valueX), functionToCall(valueY)), unbelievableBigValue); const bool someValue20 = functionToCall(valueX, valueY, valueXTimesY) || functionToCall(3); const bool someValue21 = functionToCall(valueX, valueY, valueXTimesY) || functionToCall(valueX, valueY); emitAddOutput( QCoreApplication::tr("Starting: \"%1\" %2") .arg("/some/very/very/very/very/long/path/to/an/executable", arguments), functionToCall(3), functionToCall(3) | valueX); emitAddOutput( QCoreApplication::tr("Starting: \"%1\" %2") .arg("/some/very/very/very/very/long/path/to/an/executable", argumentsVeryLong), functionToCall(3), functionToCall(3) | unlimitedValueunbelievableBigValue | unlimitedValueunbelievableBigValue); const QString path; const bool someLongerNameNNNNNNNNNN = functionToCallSt( path, QStringList(QLatin1String("-print-env"))); } // ------------------------------------------------------------------------------------------------- // Classes and member functions // ------------------------------------------------------------------------------------------------- class Base1 {}; class Base2 {}; class MyClass : public QObject, public Base1, public Base2 { Q_OBJECT public: friend class FriendX; // for X::foo() friend class OtherFriendY; // for Y::bar() MyClass() {} MyClass(int d1) : data1(d1) {} MyClass(int d1, int d2) : data1(d1) , data2(d2) , data3(d2) {} MyClass( int initialData1, int initialData2, int initialData3, int initialData4, int initialData5, int initialData6) : data1(initialData1) , data2(initialData2) , data3(initialData3) , data4(initialData4) , data5(initialData5) , data6(initialData6) { // NOTE: Ops, manual alignment of QObject::connect() arguments is reverted // (we tend to write emitter/receiver on separate lines) connect(this, &MyClass::inlineZeroStatements, this, &MyClass::nonInlineSingleStatement); } void inlineZeroStatements() {} void inlineSingleStatement() { aGlobalInt = 2; } void inlineMultipleStatements() { aGlobalInt = 2; aGlobalInt = 3; } void nonInlineZeroStatements(); void nonInlineSingleStatement(); void nonInlineMultipleStatements(); virtual void shortVirtual(int parameter1, int parameter2, int parameter3) = 0; // NOTE: Ops, awkward placement of "= 0;" virtual void longerVirtual( int parameter1, int parameter2, int parameter3, int parameter4, int parameter5) = 0; int someGetter() const; private: int data1 = 0; int data2 = 0; int data3 = 0; int data4 = 0; int data5 = 0; int data6 = 0; }; void MyClass::nonInlineZeroStatements() {} void MyClass::nonInlineSingleStatement() { aGlobalInt = 2; } void MyClass::nonInlineMultipleStatements() { aGlobalInt = 2; aGlobalInt = 2; } template class TemplateClass {}; // ------------------------------------------------------------------------------------------------- // Enums // ------------------------------------------------------------------------------------------------- // NOTE: OK, enums: one-liner are possible enum MyEnum { SourceFiles = 0x1, GeneratedFiles = 0x2, AllFiles = SourceFiles | GeneratedFiles }; // NOTE: OK, enums: a comment breaks one-liners enum MyEnumX { OSourceFiles = 0x1 // fancy }; // NOTE: OK, enums: longer ones are wrapped enum MyOtherEnum { XSourceFiles = 0x1, XGeneratedFiles = 0x2, XAllFiles = XSourceFiles | XGeneratedFiles }; enum { Match_None, Match_TooManyArgs, Match_TooFewArgs, Match_Ok } matchType = Match_None; // NOTE: Ops, awkward placement of "= value;" at enum definition+use // ------------------------------------------------------------------------------------------------- // Lambdas // ------------------------------------------------------------------------------------------------- void takeLambda(std::function) {} void takeLambdaWithSomeLongerNameHa(std::function) {} bool UtilsFiltered(QVector, std::function) { return true; } void lambda() { auto shortLambda = []() { return 1; }; auto longLambda = []() { aGlobalInt = 3; return; }; takeLambda([]() { return true; }); takeLambda([]() { aGlobalInt = 3; return aGlobalInt; }); // NOTE: Ops, lambda: capture and parameter list should be on separate line int thisCouldBeSomeLongerFunctionCallExpressionOrSoSoSo; takeLambdaWithSomeLongerNameHa( [&]() { return thisCouldBeSomeLongerFunctionCallExpressionOrSoSoSo; }); QVector myClasses; UtilsFiltered(myClasses, [](const N::Baz &) { return 1; }); // NOTE: Ops, lambda: lambda not started on new line in if-condition if (UtilsFiltered(myClasses, [](const N::Baz &) { return 1; })) { ++aGlobalInt; } } // ------------------------------------------------------------------------------------------------- // Control flow // ------------------------------------------------------------------------------------------------- int fn(int, int, int) { return 1; } void controlFlow(int x) { int y = -1; // if if (true) fn(1, 2, 3); int value = 3; if (value) { value += value + 1; --value; } if (x == y) fn(1, 2, 3); else if (x > y) fn(1, 2, 3); else fn(1, 2, 3); if (x == y) { fn(1, 2, 3); return; } else if (x > y) { fn(1, 2, 3); } else { fn(1, 2, 3); } // switch switch (x) { case 0: ++aGlobalInt; return; case 1: fn(1, 2, 3); ++aGlobalInt; break; case 2: fn(1, 2, 3); break; default: break; } // do-while do { value += value + 1; ++value; } while (true); // for QVector myVector; for (int i = 0; i < myVector.size(); ++i) ++aGlobalInt; for (QVector::const_iterator i = myVector.begin(); i != myVector.end(); ++i) ++aGlobalInt; QVector myVectorWithLongName; for (QVector::const_iterator i = myVectorWithLongName.begin(), ei = myVectorWithLongName.end(); i != ei; ++i) { } forever { ++aGlobalInt; --aGlobalInt; } } // ------------------------------------------------------------------------------------------------- // Function declarations and calls - extreme cases // ------------------------------------------------------------------------------------------------- void extremeFunction(const char[]) {} void extremeFunction( int uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuunbelievableLongParameter) { extremeFunction( uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuunbelievableLongParameter); int uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuunbelievableLongValue = 3; ++uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuunbelievableLongValue; extremeFunction( "some super duper super duper super duper super duper super duper super duper long"); // BreakStringLiterals splits the string. extremeFunction("some super duper super duper super duper super duper super duper super duper " "super duper long"); } void extremeFunction2( int parameter1, int parameter2, int parameter3WithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVerVeryVeryLong) { extremeFunction2( parameter1, parameter2, parameter3WithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVerVeryVeryLong); } void extremeFunction3( int parameter1, int parameter2, int parameter3WithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVerVeryVeryLongNameX) { extremeFunction3( parameter1, parameter2, parameter3WithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVerVeryVeryLongNameX); } // ------------------------------------------------------------------------------------------------- // Misc // ------------------------------------------------------------------------------------------------- static Q_LOGGING_CATEGORY(log, "qtc.cpptools.builtineditordocumentprocessor", QtWarningMsg) int hello; // NOTE: Ops, awkward placement of next token after Q_LOGGING_CATEGORY (semicolon helps) // ------------------------------------------------------------------------------------------------- int main() {} #include "clang-format.moc" qbs-src-3.2.0/tests/CMakeLists.txt0000644000175100017510000000022215154533055016400 0ustar runnerrunneradd_subdirectory(auto) add_subdirectory(benchmarker) add_subdirectory(clang-format-test) add_subdirectory(fuzzy-test) add_subdirectory(lspclient) qbs-src-3.2.0/tests/auto/0000755000175100017510000000000015154533055014614 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/dllexport.h0000644000175100017510000000304715154533055017006 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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 DLLEXPORT_H #define DLLEXPORT_H #if defined(_WIN32) || defined(WIN32) # define DLL_EXPORT __declspec(dllexport) # define DLL_IMPORT __declspec(dllimport) #else # define DLL_EXPORT __attribute__((visibility("default"))) # define DLL_IMPORT __attribute__((visibility("default"))) # endif #endif // include guard qbs-src-3.2.0/tests/auto/buildgraph/0000755000175100017510000000000015154533055016735 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/buildgraph/buildgraph.qbs0000644000175100017510000000031615154533055021565 0ustar runnerrunnerQbsUnittest { Depends { name: "qbsconsolelogger" } testName: "buildgraph" condition: qbsbuildconfig.enableUnitTests files: [ "tst_buildgraph.cpp", "tst_buildgraph.h" ] } qbs-src-3.2.0/tests/auto/buildgraph/tst_buildgraph.h0000644000175100017510000000514515154533055022126 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 TST_BUILDGRAPH_H #define TST_BUILDGRAPH_H #include #include #include #include #include class TestBuildGraph : public QObject { Q_OBJECT public: TestBuildGraph(qbs::ILogSink *logSink); private slots: void initTestCase(); void cleanupTestCase(); void testCycle(); private: qbs::Internal::ResolvedProductConstPtr productWithDirectCycle(); qbs::Internal::ResolvedProductConstPtr productWithLessDirectCycle(); qbs::Internal::ResolvedProductConstPtr productWithNoCycle(); bool cycleDetected(const qbs::Internal::ResolvedProductConstPtr &product); qbs::ILogSink * const m_logSink; }; #endif // TST_BUILDGRAPH_H qbs-src-3.2.0/tests/auto/buildgraph/tst_buildgraph.cpp0000644000175100017510000001215615154533055022461 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "tst_buildgraph.h" #include #include #include #include #include #include #include #include #include #include #include using namespace qbs; using namespace qbs::Internal; const TopLevelProjectPtr project = TopLevelProject::create(); TestBuildGraph::TestBuildGraph(ILogSink *logSink) : m_logSink(logSink) { project->buildData = std::make_unique(); } void TestBuildGraph::initTestCase() { } void TestBuildGraph::cleanupTestCase() { } bool TestBuildGraph::cycleDetected(const ResolvedProductConstPtr &product) { try { CycleDetector(Logger(m_logSink)).visitProduct(product); return false; } catch (const ErrorInfo &) { return true; } } ResolvedProductConstPtr TestBuildGraph::productWithDirectCycle() { const ResolvedProductPtr product = ResolvedProduct::create(); product->project = project; product->buildData = std::make_unique(); const auto root = new Artifact; root->product = product; const auto child = new Artifact; child->product = product; product->buildData->addRootNode(root); product->buildData->addNode(root); product->buildData->addNode(child); qbs::Internal::connect(root, child); qbs::Internal::connect(child, root); return product; } ResolvedProductConstPtr TestBuildGraph::productWithLessDirectCycle() { const ResolvedProductPtr product = ResolvedProduct::create(); product->project = project; product->buildData = std::make_unique(); const auto root = new Artifact; const auto child = new Artifact; const auto grandchild = new Artifact; root->product = product; child->product = product; grandchild->product = product; product->buildData->addRootNode(root); product->buildData->addNode(root); product->buildData->addNode(child); product->buildData->addNode(grandchild); qbs::Internal::connect(root, child); qbs::Internal::connect(child, grandchild); qbs::Internal::connect(grandchild, root); return product; } // root appears as a child, but in a different tree ResolvedProductConstPtr TestBuildGraph::productWithNoCycle() { const ResolvedProductPtr product = ResolvedProduct::create(); product->project = project; product->buildData = std::make_unique(); const auto root = new Artifact; const auto root2 = new Artifact; root->product = product; root2->product = product; product->buildData->addRootNode(root); product->buildData->addRootNode(root2); product->buildData->addNode(root); product->buildData->addNode(root2); qbs::Internal::connect(root2, root); return product; } void TestBuildGraph::testCycle() { QVERIFY(cycleDetected(productWithDirectCycle())); QVERIFY(cycleDetected(productWithLessDirectCycle())); QVERIFY(!cycleDetected(productWithNoCycle())); } int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); TestBuildGraph tbg(ConsoleLogger::instance().logSink()); return QTest::qExec(&tbg, argc, argv); } qbs-src-3.2.0/tests/auto/buildgraph/CMakeLists.txt0000644000175100017510000000020415154533055021471 0ustar runnerrunneradd_qbs_test(buildgraph SOURCES tst_buildgraph.cpp tst_buildgraph.h DEPENDS qbsquickjsheaders ) qbs-src-3.2.0/tests/auto/pkgconfig/0000755000175100017510000000000015154533055016563 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/pkgconfig/pkgconfig.qbs0000644000175100017510000000065615154533055021250 0ustar runnerrunnerimport qbs import qbs.Utilities QbsUnittest { Depends { name: "qbspkgconfig" } condition: qbsbuildconfig.enableUnitTests testName: "pkgconfig" files: ["../shared.h", "tst_pkgconfig.h", "tst_pkgconfig.cpp"] cpp.defines: base.concat([ "SRCDIR=" + Utilities.cStringQuote(path), ]) Group { name: "testdata" prefix: "testdata/" files: ["**/*"] fileTags: [] } } qbs-src-3.2.0/tests/auto/pkgconfig/CMakeLists.txt0000644000175100017510000000022615154533055021323 0ustar runnerrunneradd_qbs_test(pkgconfig SOURCES tst_pkgconfig.cpp tst_pkgconfig.h DEPENDS qbspkgconfig qbsquickjsheaders ) qbs-src-3.2.0/tests/auto/pkgconfig/testdata/0000755000175100017510000000000015154533055020374 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/pkgconfig/testdata/variables.json0000644000175100017510000000102515154533055023235 0ustar runnerrunner{ "Name": "Complex variables", "Description": "Test complex variable output", "Version": "1.0", "Vars": { "prefix": "/local", "exec_prefix": "/local", "libdir": "/local/lib", "includedir": "\"/local/include\"", "cppflags": "-I\"/local/include\"/foo -DFOO=\\\"/bar\\\"" }, "Cflags": [ {"Type": "IncludePath", "Value": "/local/include"}, {"Type": "IncludePath", "Value": "/local/include/foo"}, {"Type": "Define", "Value": "FOO=\"/bar\""} ] } qbs-src-3.2.0/tests/auto/pkgconfig/testdata/non-l-required.pc0000644000175100017510000000027615154533055023566 0ustar runnerrunnerName: Non-l flags required test package Description: Test package for checking order of non-L Libs & Cflags Version: 1.0.0 Libs: /non-l-required.a -pthread Cflags: -I/non-l-required/include qbs-src-3.2.0/tests/auto/pkgconfig/testdata/private-dep.pc0000644000175100017510000000030215154533055023133 0ustar runnerrunnerName: Requires test package Description: Dummy pkgconfig test package for testing Requires/Requires.private Version: 1.0.0 Libs: -L/private-dep/lib -lprivate-dep Cflags: -I/private-dep/include qbs-src-3.2.0/tests/auto/pkgconfig/testdata/lib/0000755000175100017510000000000015154533055021142 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/pkgconfig/testdata/lib/pkgconfig/0000755000175100017510000000000015154533055023111 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/pkgconfig/testdata/lib/pkgconfig/prefix.pc0000644000175100017510000000036615154533055024737 0ustar runnerrunnerprefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=/usr/include usrdir=/usrdir Name: Prefix test Description: This tests prefix auto detection Version: 1.0.0 Requires: Libs: -lprefix Libs.private: -lm Cflags: -I${includedir} qbs-src-3.2.0/tests/auto/pkgconfig/testdata/whitespace.pc0000644000175100017510000000056115154533055023056 0ustar runnerrunnerprefix=/usr exec_prefix=${prefix} libdir="${exec_prefix}/white space/lib" includedir="${prefix}/white space/include" Name: Whitespace test Description: Dummy pkgconfig test package for testing pkgconfig Version: 1.0.0 Requires: Libs: -L${libdir} -lfoo\ bar "-lbar baz" -r:foo Cflags: -I${includedir} -I$(top_builddir) -Iinclude\ dir "-Iother include dir" -Dlala=misc qbs-src-3.2.0/tests/auto/pkgconfig/testdata/requires-test.pc0000644000175100017510000000040515154533055023533 0ustar runnerrunnerName: Requires test package Description: Dummy pkgconfig test package for testing Requires/Requires.private Version: 1.0.0 Requires: public-dep >= 1 Requires.private: private-dep >= 1 Libs: -L/requires-test/lib -lrequires-test Cflags: -I/requires-test/include qbs-src-3.2.0/tests/auto/pkgconfig/testdata/sysroot.pc0000644000175100017510000000050115154533055022436 0ustar runnerrunnerprefix=/opt exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include sysroot=${pc_sysrootdir} Name: Test for sysroot Description: Test package for testing sysroot Version: 1.0.0 Requires: Libs: -L${libdir} -lsystem Cflags: -I${includedir} -idirafter ${includedir}/after -isystem ${includedir}/system qbs-src-3.2.0/tests/auto/pkgconfig/testdata/non-l-required.json0000644000175100017510000000060215154533055024126 0ustar runnerrunner{ "Name": "Non-l flags required test package", "Description": "Test package for checking order of non-L Libs & Cflags", "Version": "1.0.0", "Libs": [ {"Type": "StaticLibraryName", "Value": "/non-l-required.a"}, {"Type": "LinkerFlag", "Value": "-pthread"} ], "Cflags": [ {"Type": "IncludePath", "Value": "/non-l-required/include"} ] } qbs-src-3.2.0/tests/auto/pkgconfig/testdata/requires-test.json0000644000175100017510000000113615154533055024104 0ustar runnerrunner{ "Name": "Requires test package", "Description": "Dummy pkgconfig test package for testing Requires/Requires.private", "Version": "1.0.0", "Libs": [ {"Type": "LibraryPath", "Value": "/requires-test/lib"}, {"Type": "LibraryName", "Value": "requires-test"} ], "Cflags": [ {"Type": "IncludePath", "Value": "/requires-test/include"} ], "Requires": [ {"Comparison": "GreaterThanEqual", "Name": "public-dep", "Version": "1"} ], "RequiresPrivate": [ {"Comparison": "GreaterThanEqual", "Name": "private-dep", "Version": "1"} ] } qbs-src-3.2.0/tests/auto/pkgconfig/testdata/simple.json0000644000175100017510000000076215154533055022565 0ustar runnerrunner{ "Name": "Simple test", "Description": "Dummy pkgconfig test package for testing pkgconfig", "Version": "1.0.0", "Vars": { "prefix": "/usr", "exec_prefix": "/usr", "libdir": "/usr/lib", "includedir": "/usr/include" }, "Libs": [ {"Type": "LibraryName", "Value": "simple"} ], "LibsPrivate": [ {"Type": "LibraryName", "Value": "m"} ], "Cflags": [ {"Type": "IncludePath", "Value": "/usr/include"} ] } qbs-src-3.2.0/tests/auto/pkgconfig/testdata/tilde.pc0000644000175100017510000000011615154533055022017 0ustar runnerrunnerName: tilde Description: tilde test module Version: 1.0 Libs: -L~ Cflags: -I~ qbs-src-3.2.0/tests/auto/pkgconfig/testdata/special-flags.json0000644000175100017510000000214115154533055023777 0ustar runnerrunner{ "Name": "Special flags test", "Description": "Dummy pkgconfig test package for testing pkgconfig", "Version": "1.0.0", "Vars": { "prefix": "/usr", "exec_prefix": "/usr", "libdir": "/usr/lib", "includedir": "/usr/include" }, "Libs": [ {"Type": "LibraryPath", "Value": "/foo"}, {"Type": "Framework", "Value": "Foo"}, {"Type": "LibraryName", "Value": "simple"}, {"Type": "LibraryPath", "Value": "/bar"}, {"Type": "Framework", "Value": "Bar"}, {"Type": "LinkerFlag", "Value": "-Wl,-framework"}, {"Type": "LinkerFlag", "Value": "-Wl,Baz"} ], "Cflags": [ {"Type": "IncludePath", "Value": "/foo"}, {"Type": "CompilerFlag", "Value": "-g"}, {"Type": "SystemIncludePath", "Value": "/system1"}, {"Type": "DirAfterIncludePath", "Value": "/after1"}, {"Type": "CompilerFlag", "Value": "-ffoo"}, {"Type": "IncludePath", "Value": "/bar"}, {"Type": "DirAfterIncludePath", "Value": "/after2"}, {"Type": "SystemIncludePath", "Value": "/system2"} ] } qbs-src-3.2.0/tests/auto/pkgconfig/testdata/special-flags.pc0000644000175100017510000000060715154533055023435 0ustar runnerrunnerprefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: Special flags test Description: Dummy pkgconfig test package for testing pkgconfig Version: 1.0.0 Requires: Libs: -L/foo -framework Foo -lsimple -L/bar -framework Bar -Wl,-framework -Wl,Baz Cflags: -I/foo -g -isystem /system1 -idirafter /after1 -ffoo -I/bar -idirafter /after2 -isystem /system2 qbs-src-3.2.0/tests/auto/pkgconfig/testdata/empty-variable.json0000644000175100017510000000102615154533055024207 0ustar runnerrunner{ "Name": "Empty Variable test", "Description": "Checks that empty variables are handled correcty", "Version": "1.0.0", "Vars": { "rootprefix": "", "prefix": "/usr", "exec_prefix": "//usr", "libdir": "//usr/lib", "includedir": "//usr/include" }, "Libs": [ {"Type": "LibraryName", "Value": "simple"} ], "LibsPrivate": [ {"Type": "LibraryName", "Value": "m"} ], "Cflags": [ {"Type": "IncludePath", "Value": "//usr/include"} ] } qbs-src-3.2.0/tests/auto/pkgconfig/testdata/empty-variable.pc0000644000175100017510000000045415154533055023644 0ustar runnerrunnerrootprefix= prefix=/usr exec_prefix=${rootprefix}/${prefix} libdir=${exec_prefix}/lib includedir=${rootprefix}/${prefix}/include Name: Empty Variable test Description: Checks that empty variables are handled correcty Version: 1.0.0 Requires: Libs: -lsimple Libs.private: -lm Cflags: -I${includedir} qbs-src-3.2.0/tests/auto/pkgconfig/testdata/variables.pc0000644000175100017510000000040015154533055022662 0ustar runnerrunnerprefix=/local exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir="${prefix}/include" cppflags=-I${includedir}/foo \ -DFOO=\"/bar\" Name: Complex variables Description: Test complex variable output Version: 1.0 Cflags: -I${includedir} ${cppflags} qbs-src-3.2.0/tests/auto/pkgconfig/testdata/public-dep.pc0000644000175100017510000000032015154533055022737 0ustar runnerrunnerName: Requires test package Description: Dummy pkgconfig test package for testing Requires/Requires.private Version: 1.0.0 Requires.private: Libs: -L/public-dep/lib -lpublic-dep Cflags: -I/public-dep/include qbs-src-3.2.0/tests/auto/pkgconfig/testdata/simple.pc0000644000175100017510000000037615154533055022217 0ustar runnerrunnerprefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: Simple test Description: Dummy pkgconfig test package for testing pkgconfig Version: 1.0.0 Requires: Libs: -lsimple Libs.private: -lm Cflags: -I${includedir} qbs-src-3.2.0/tests/auto/pkgconfig/testdata/system.pc0000644000175100017510000000031315154533055022241 0ustar runnerrunnerprefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: System library Description: Test package Version: 1.0.0 Libs: -L${libdir} -lsystem Cflags: -I${includedir} qbs-src-3.2.0/tests/auto/pkgconfig/testdata/base.name.json0000644000175100017510000000074415154533055023125 0ustar runnerrunner{ "Name": "Base Name test", "Description": "Checks correct baseName detection", "Version": "1.0.0", "Vars": { "prefix": "/usr", "exec_prefix": "/usr", "libdir": "/usr/lib", "includedir": "/usr/include" }, "Libs": [ {"Type": "LibraryName", "Value": "simple"} ], "LibsPrivate": [ {"Type": "LibraryName", "Value": "m"} ], "Cflags": [ {"Type": "IncludePath", "Value": "/usr/include"} ] } qbs-src-3.2.0/tests/auto/pkgconfig/testdata/system.json0000644000175100017510000000060515154533055022614 0ustar runnerrunner{ "Name": "System library", "Description": "Test package", "Version": "1.0.0", "Vars": { "prefix": "/usr", "exec_prefix": "/usr", "libdir": "/usr/lib", "includedir": "/usr/include" }, "Libs": [ {"Type": "LibraryName", "Value": "system"} ], "Cflags": [ {"Type": "IncludePath", "Value": "/usr/include"} ] } qbs-src-3.2.0/tests/auto/pkgconfig/testdata/sysroot.json0000644000175100017510000000123715154533055023014 0ustar runnerrunner{ "Name": "Test for sysroot", "Description": "Test package for testing sysroot", "Version": "1.0.0", "Vars": { "prefix": "/opt", "exec_prefix": "/opt", "libdir": "/opt/lib", "includedir": "/opt/include", "sysroot": "/newroot" }, "Libs": [ {"Type": "LibraryPath", "Value": "/newroot/opt/lib"}, {"Type": "LibraryName", "Value": "system"} ], "Cflags": [ {"Type": "IncludePath", "Value": "/newroot/opt/include"}, {"Type": "DirAfterIncludePath", "Value": "/newroot/opt/include/after"}, {"Type": "SystemIncludePath", "Value": "/newroot/opt/include/system"} ] } qbs-src-3.2.0/tests/auto/pkgconfig/testdata/whitespace.json0000644000175100017510000000155215154533055023426 0ustar runnerrunner{ "Name": "Whitespace test", "Description": "Dummy pkgconfig test package for testing pkgconfig", "Version": "1.0.0", "Vars": { "prefix": "/usr", "exec_prefix": "/usr", "libdir": "\"/usr/white space/lib\"", "includedir": "\"/usr/white space/include\"" }, "Libs": [ {"Type": "LibraryPath", "Value": "/usr/white space/lib"}, {"Type": "LibraryName", "Value": "foo bar"}, {"Type": "LibraryName", "Value": "bar baz"}, {"Type": "LinkerFlag", "Value": "-r:foo"} ], "Cflags": [ {"Type": "IncludePath", "Value": "/usr/white space/include"}, {"Type": "IncludePath", "Value": "$(top_builddir)"}, {"Type": "IncludePath", "Value": "include dir"}, {"Type": "IncludePath", "Value": "other include dir"}, {"Type": "Define", "Value": "lala=misc"} ] } qbs-src-3.2.0/tests/auto/pkgconfig/testdata/tilde.json0000644000175100017510000000033615154533055022372 0ustar runnerrunner{ "Name": "tilde", "Description": "tilde test module", "Version": "1.0", "Libs": [ {"Type": "LibraryPath", "Value": "~"} ], "Cflags": [ {"Type": "IncludePath", "Value": "~"} ] } qbs-src-3.2.0/tests/auto/pkgconfig/testdata/base.name.pc0000644000175100017510000000036015154533055022550 0ustar runnerrunnerprefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: Base Name test Description: Checks correct baseName detection Version: 1.0.0 Requires: Libs: -lsimple Libs.private: -lm Cflags: -I${includedir} qbs-src-3.2.0/tests/auto/pkgconfig/tst_pkgconfig.h0000644000175100017510000000334015154533055021575 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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 QBS_TST_API_H #define QBS_TST_API_H #include #include class TestPkgConfig : public QObject { Q_OBJECT public: TestPkgConfig(); private slots: void initTestCase(); void fileName(); void completeBaseName(); void parentPath(); void pkgConfig(); void pkgConfig_data(); void benchSystem(); void prefix(); private: const QString m_sourceDataDir; const QString m_workingDataDir; }; #endif // Include guard. qbs-src-3.2.0/tests/auto/pkgconfig/tst_pkgconfig.cpp0000644000175100017510000002606615154533055022142 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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 "tst_pkgconfig.h" #include "../shared.h" #include #include #include #include #include #include #include using HostOsInfo = qbs::Internal::HostOsInfo; using PcPackage = qbs::PcPackage; using PkgConfig = qbs::PkgConfig; using Options = qbs::PkgConfig::Options; TestPkgConfig::TestPkgConfig() : m_sourceDataDir(testDataSourceDir(SRCDIR "/testdata")) , m_workingDataDir(testWorkDir(QStringLiteral("pkgconfig"))) { } void TestPkgConfig::initTestCase() { QString errorMessage; qbs::Internal::removeDirectoryWithContents(m_workingDataDir, &errorMessage); QVERIFY2(qbs::Internal::copyFileRecursion(m_sourceDataDir, m_workingDataDir, false, true, &errorMessage), qPrintable(errorMessage)); } void TestPkgConfig::fileName() { QCOMPARE(qbs::Internal::fileName(""), ""); QCOMPARE(qbs::Internal::fileName("file.txt"), "file.txt"); QCOMPARE(qbs::Internal::fileName("/home/user/file.txt"), "file.txt"); QCOMPARE(qbs::Internal::fileName("/"), ""); #if defined(Q_OS_WIN) QCOMPARE(qbs::Internal::fileName("c:file.txt"), "file.txt"); QCOMPARE(qbs::Internal::fileName("c:"), ""); #endif } void TestPkgConfig::completeBaseName() { QCOMPARE(qbs::Internal::completeBaseName(""), ""); QCOMPARE(qbs::Internal::completeBaseName("file.txt"), "file"); QCOMPARE(qbs::Internal::completeBaseName("archive.tar.gz"), "archive.tar"); QCOMPARE(qbs::Internal::completeBaseName("/home/user/file.txt"), "file"); #if defined(Q_OS_WIN) QCOMPARE(qbs::Internal::completeBaseName("c:file.txt"), "file"); QCOMPARE(qbs::Internal::completeBaseName("c:archive.tar.gz"), "archive.tar"); QCOMPARE(qbs::Internal::completeBaseName("c:"), ""); #endif } void TestPkgConfig::parentPath() { QCOMPARE(qbs::Internal::parentPath(""), ""); QCOMPARE(qbs::Internal::parentPath("file.txt"), "."); QCOMPARE(qbs::Internal::parentPath("/home/user/file.txt"), "/home/user"); QCOMPARE(qbs::Internal::parentPath("/home/user/"), "/home/user"); QCOMPARE(qbs::Internal::parentPath("/home"), "/"); QCOMPARE(qbs::Internal::parentPath("/"), "/"); #if defined(Q_OS_WIN) QCOMPARE(qbs::Internal::parentPath("c:/folder/file.txt"), "c:/folder"); QCOMPARE(qbs::Internal::parentPath("c:/folder/"), "c:/folder"); QCOMPARE(qbs::Internal::parentPath("c:/folder"), "c:/"); QCOMPARE(qbs::Internal::parentPath("c:/"), "c:/"); QCOMPARE(qbs::Internal::parentPath("c:"), "c:"); #endif } void TestPkgConfig::pkgConfig() { QFETCH(QString, pcFileName); QFETCH(QString, jsonFileName); QFETCH(QVariantMap, optionsMap); if (jsonFileName.isEmpty()) jsonFileName = pcFileName; Options options = qbs::Internal::PkgConfigJs::convertOptions( QProcessEnvironment::systemEnvironment(), optionsMap); options.libDirs.push_back(m_workingDataDir.toStdString()); PkgConfig pkgConfig(std::move(options)); QFile jsonFile(m_workingDataDir + "/" + jsonFileName + ".json"); QVERIFY(jsonFile.open(QIODevice::ReadOnly)); QJsonParseError error{}; const auto json = QJsonDocument::fromJson(jsonFile.readAll(), &error).toVariant().toMap(); QCOMPARE(error.error, QJsonParseError::NoError); const auto &packageOr = pkgConfig.getPackage(pcFileName.toStdString()); QVERIFY(packageOr.isValid()); const auto &package = packageOr.asPackage(); QCOMPARE(QString::fromStdString(package.baseFileName), pcFileName); QCOMPARE(QString::fromStdString(package.name), json.value("Name").toString()); QCOMPARE(QString::fromStdString(package.description), json.value("Description").toString()); QCOMPARE(QString::fromStdString(package.version), json.value("Version").toString()); auto variables = json["Vars"].toMap(); variables["pcfiledir"] = QFileInfo(m_workingDataDir).absoluteFilePath(); QCOMPARE(size_t(variables.size()), package.variables.size()); for (const auto &[key, value]: package.variables) { QCOMPARE(QString::fromStdString(value), variables.value(QString::fromStdString(key)).toString()); } const auto jsonLibs = json.value("Libs").toJsonArray().toVariantList(); QCOMPARE(package.libs.size(), size_t(jsonLibs.size())); for (size_t i = 0; i < package.libs.size(); ++i) { const auto &item = package.libs[i]; const auto jsonItem = jsonLibs.at(i).toMap(); QCOMPARE(item.type, *PcPackage::Flag::typeFromString(jsonItem.value("Type").toString().toStdString())); QCOMPARE(QString::fromStdString(item.value), jsonItem.value("Value").toString()); } const auto jsonLibsPrivate = json.value("LibsPrivate").toJsonArray().toVariantList(); QCOMPARE(package.libsPrivate.size(), size_t(jsonLibsPrivate.size())); for (size_t i = 0; i < package.libsPrivate.size(); ++i) { const auto &item = package.libsPrivate[i]; const auto jsonItem = jsonLibsPrivate.at(i).toMap(); QCOMPARE(item.type, *PcPackage::Flag::typeFromString(jsonItem.value("Type").toString().toStdString())); QCOMPARE(QString::fromStdString(item.value), jsonItem.value("Value").toString()); } const auto jsonCFlags = json.value("Cflags").toJsonArray().toVariantList(); QCOMPARE(package.cflags.size(), size_t(jsonCFlags.size())); for (size_t i = 0; i < package.cflags.size(); ++i) { const auto &item = package.cflags[i]; const auto jsonItem = jsonCFlags.at(i).toMap(); QCOMPARE(item.type, *PcPackage::Flag::typeFromString(jsonItem.value("Type").toString().toStdString())); QCOMPARE(QString::fromStdString(item.value), jsonItem.value("Value").toString()); } for (const auto &item: package.requiresPublic) qInfo() << "requires" << item.name.c_str() << item.version.c_str(); const auto jsonRequires = json.value("Requires").toJsonArray().toVariantList(); QCOMPARE(package.requiresPublic.size(), size_t(jsonRequires.size())); for (size_t i = 0; i < package.requiresPublic.size(); ++i) { const auto &item = package.requiresPublic[i]; const auto jsonItem = jsonRequires.at(i).toMap(); QCOMPARE(item.comparison, *PcPackage::RequiredVersion::comparisonFromString( jsonItem.value("Comparison").toString().toStdString())); QCOMPARE(QString::fromStdString(item.name), jsonItem.value("Name").toString()); QCOMPARE(QString::fromStdString(item.version), jsonItem.value("Version").toString()); } const auto jsonRequiresPrivate = json.value("RequiresPrivate").toJsonArray().toVariantList(); QCOMPARE(package.requiresPrivate.size(), size_t(jsonRequiresPrivate.size())); for (size_t i = 0; i < package.requiresPrivate.size(); ++i) { const auto &item = package.requiresPrivate[i]; const auto jsonItem = jsonRequiresPrivate.at(i).toMap(); QCOMPARE(item.comparison, *PcPackage::RequiredVersion::comparisonFromString( jsonItem.value("Comparison").toString().toStdString())); QCOMPARE(QString::fromStdString(item.name), jsonItem.value("Name").toString()); QCOMPARE(QString::fromStdString(item.version), jsonItem.value("Version").toString()); } } void TestPkgConfig::pkgConfig_data() { QTest::addColumn("pcFileName"); QTest::addColumn("jsonFileName"); QTest::addColumn("optionsMap"); QTest::newRow("empty-variable") << QStringLiteral("empty-variable") << QString() << QVariantMap(); QTest::newRow("non-l-required") << QStringLiteral("non-l-required") << QString() << QVariantMap(); QTest::newRow("simple") << QStringLiteral("simple") << QString() << QVariantMap(); QTest::newRow("requires-test") << QStringLiteral("requires-test") << QString() << QVariantMap(); QTest::newRow("special-flags") << QStringLiteral("special-flags") << QString() << QVariantMap(); QTest::newRow("system") << QStringLiteral("system") << QString() << QVariantMap(); QTest::newRow("sysroot") << QStringLiteral("sysroot") << QString() << QVariantMap({{"sysroot", "/newroot"}}); QTest::newRow("tilde") << QStringLiteral("tilde") << QString() << QVariantMap(); QTest::newRow("variables") << QStringLiteral("variables") << QString() << QVariantMap(); QTest::newRow("whitespace") << QStringLiteral("whitespace") << QString() << QVariantMap(); QTest::newRow("base.name") << QStringLiteral("base.name") << QString() << QVariantMap(); } void TestPkgConfig::benchSystem() { if (HostOsInfo::hostOs() == HostOsInfo::HostOsWindows) QSKIP("Not available on Windows"); QBENCHMARK { PkgConfig pkgConfig; QVERIFY(!pkgConfig.packages().empty()); } } void TestPkgConfig::prefix() { const auto prefixDir = m_workingDataDir; const auto libDir = m_workingDataDir + "/lib"; const auto includeDir = m_workingDataDir + "/include"; const auto pkgconfigDir = libDir + "/pkgconfig"; Options options = qbs::Internal::PkgConfigJs::convertOptions( QProcessEnvironment::systemEnvironment(), {}); options.definePrefix = true; options.libDirs.push_back(pkgconfigDir.toStdString()); PkgConfig pkgConfig(std::move(options)); const auto &packageOr = pkgConfig.getPackage("prefix"); QVERIFY(packageOr.isValid()); const auto &package = packageOr.asPackage(); QCOMPARE(package.variables.at("prefix"), prefixDir.toStdString()); QCOMPARE(package.variables.at("exec_prefix"), prefixDir.toStdString()); QCOMPARE(package.variables.at("libdir"), libDir.toStdString()); QCOMPARE(package.variables.at("includedir"), includeDir.toStdString()); QCOMPARE(package.variables.at("usrdir"), "/usrdir"); } QTEST_MAIN(TestPkgConfig) qbs-src-3.2.0/tests/auto/auto.qbs0000644000175100017510000000134215154533055016273 0ustar runnerrunnerProject { name: "Autotests" references: [ "api/api.qbs", "blackbox/blackbox-android.qbs", "blackbox/blackbox-apple.qbs", "blackbox/blackbox-baremetal.qbs", "blackbox/blackbox-clangdb.qbs", "blackbox/blackbox-examples.qbs", "blackbox/blackbox-java.qbs", "blackbox/blackbox-joblimits.qbs", "blackbox/blackbox-providers.qbs", "blackbox/blackbox-qt.qbs", "blackbox/blackbox-tutorial.qbs", "blackbox/blackbox-windows.qbs", "blackbox/blackbox.qbs", "buildgraph/buildgraph.qbs", "cmdlineparser/cmdlineparser.qbs", "language/language.qbs", "pkgconfig/pkgconfig.qbs", "tools/tools.qbs", ] } qbs-src-3.2.0/tests/auto/CMakeLists.txt0000644000175100017510000000035215154533055017354 0ustar runnerrunneradd_subdirectory(api) add_subdirectory(cmdlineparser) add_subdirectory(blackbox) if(WITH_UNIT_TESTS) add_subdirectory(buildgraph) add_subdirectory(language) add_subdirectory(pkgconfig) add_subdirectory(tools) endif() qbs-src-3.2.0/tests/auto/blackbox/0000755000175100017510000000000015154533055016401 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/tst_blackboxbaremetal.cpp0000644000175100017510000002730315154533055023446 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Denis Shienkov ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "tst_blackboxbaremetal.h" #include "../shared.h" #include #include static bool extractToolset(const QByteArray &output, QByteArray &toolchain, QByteArray &architecture) { const QRegularExpression re("%%([\\w\\-]+)%%, %%(\\w+)%%"); QRegularExpressionMatchIterator it = re.globalMatch(output); if (!it.hasNext()) return false; const QRegularExpressionMatch match = it.next(); toolchain = match.captured(1).toLocal8Bit(); architecture = match.captured(2).toLocal8Bit(); return true; } static bool extractCompilerIncludePaths(const QByteArray &output, QStringList &compilerIncludePaths) { const QRegularExpression re("%%([^%%]+)%%"); QRegularExpressionMatchIterator it = re.globalMatch(output); if (!it.hasNext()) return false; const QRegularExpressionMatch match = it.next(); compilerIncludePaths = match.captured(1).split(","); return true; } static bool extractQuitedValue(const QByteArray &output, QString &pattern) { const QRegularExpression re("%%(.+)%%"); const QRegularExpressionMatch match = re.match(output); if (!match.hasMatch()) return false; pattern = match.captured(1); return true; } static QByteArray unsupportedToolsetMessage(const QByteArray &output) { QByteArray toolchain; QByteArray architecture; extractToolset(output, toolchain, architecture); return "Unsupported toolchain '" + toolchain + "' for architecture '" + architecture + "'"; } static QByteArray brokenProbeMessage(const QByteArray &output) { QByteArray toolchain; QByteArray architecture; extractToolset(output, toolchain, architecture); return "Broken probe for toolchain '" + toolchain + "' for architecture '" + architecture + "'"; } TestBlackboxBareMetal::TestBlackboxBareMetal() : TestBlackboxBase (SRCDIR "/testdata-baremetal", "blackbox-baremetal") { } void TestBlackboxBareMetal::targetPlatform() { QDir::setCurrent(testDataDir + "/target-platform"); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); if (m_qbsStdout.contains("unsupported toolset:")) QSKIP(unsupportedToolsetMessage(m_qbsStdout)); const bool hasNoPlatform = m_qbsStdout.contains("has no platform: true"); QCOMPARE(hasNoPlatform, true); const bool hasNoOS = m_qbsStdout.contains("has no os: true"); QCOMPARE(hasNoOS, true); } void TestBlackboxBareMetal::application_data() { QTest::addColumn("testPath"); QTest::newRow("one-object-application") << "/one-object-application"; QTest::newRow("two-object-application") << "/two-object-application"; QTest::newRow("one-object-asm-application") << "/one-object-asm-application"; } void TestBlackboxBareMetal::application() { QFETCH(QString, testPath); QDir::setCurrent(testDataDir + testPath); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); if (m_qbsStdout.contains("unsupported toolset:")) QSKIP(unsupportedToolsetMessage(m_qbsStdout)); QCOMPARE(runQbs(QbsRunParameters("build")), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QbsRunParameters("run")), 0); } void TestBlackboxBareMetal::staticLibraryDependencies() { QDir::setCurrent(testDataDir + "/static-library-dependencies"); QCOMPARE(runQbs(QStringList{"-p", "lib-a,lib-b,lib-c,lib-d,lib-e"}), 0); QCOMPARE(runQbs(QStringList{"--command-echo-mode", "command-line"}), 0); const QByteArray output = m_qbsStdout + '\n' + m_qbsStderr; QVERIFY(output.contains("lib-a")); QVERIFY(output.contains("lib-b")); QVERIFY(output.contains("lib-c")); QVERIFY(output.contains("lib-d")); QVERIFY(output.contains("lib-e")); } void TestBlackboxBareMetal::externalStaticLibraries() { QDir::setCurrent(testDataDir + "/external-static-libraries"); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); if (m_qbsStdout.contains("unsupported toolset:")) QSKIP(unsupportedToolsetMessage(m_qbsStdout)); QCOMPARE(runQbs(), 0); } void TestBlackboxBareMetal::sharedLibraries() { QDir::setCurrent(testDataDir + "/shared-libraries"); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); if (m_qbsStdout.contains("unsupported toolset:")) QSKIP(unsupportedToolsetMessage(m_qbsStdout)); QCOMPARE(runQbs(QbsRunParameters("build")), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(m_qbsStdout.contains("Hello from app"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("Hello from lib"), m_qbsStdout.constData()); } void TestBlackboxBareMetal::userIncludePaths() { QDir::setCurrent(testDataDir + "/user-include-paths"); QCOMPARE(runQbs(), 0); } void TestBlackboxBareMetal::systemIncludePaths() { QDir::setCurrent(testDataDir + "/system-include-paths"); QCOMPARE(runQbs(), 0); } void TestBlackboxBareMetal::distributionIncludePaths() { QDir::setCurrent(testDataDir + "/distribution-include-paths"); QCOMPARE(runQbs(), 0); } void TestBlackboxBareMetal::compilerIncludePaths() { QDir::setCurrent(testDataDir + "/compiler-include-paths"); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); if (!m_qbsStdout.contains("compilerIncludePaths:")) QFAIL("No compiler include paths exists"); QStringList includePaths; QVERIFY(extractCompilerIncludePaths(m_qbsStdout, includePaths)); QVERIFY(includePaths.count() > 0); for (const auto &includePath : includePaths) { const QDir dir(includePath); QVERIFY(dir.exists()); } } void TestBlackboxBareMetal::preincludeHeaders() { QDir::setCurrent(testDataDir + "/preinclude-headers"); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); if (m_qbsStdout.contains("unsupported toolset:")) QSKIP(unsupportedToolsetMessage(m_qbsStdout)); QCOMPARE(runQbs(), 0); } void TestBlackboxBareMetal::defines() { QDir::setCurrent(testDataDir + "/defines"); QCOMPARE(runQbs(), 0); } void TestBlackboxBareMetal::compilerListingFiles_data() { QTest::addColumn("generateListing"); QTest::addColumn("customListingSuffix"); QTest::newRow("do-not-generate-compiler-listing") << false << ""; QTest::newRow("generate-default-compiler-listing") << true << ""; QTest::newRow("generate-custom-compiler-listing") << true << ".lll"; } void TestBlackboxBareMetal::compilerListingFiles() { QFETCH(bool, generateListing); QFETCH(QString, customListingSuffix); QDir::setCurrent(testDataDir + "/compiler-listing"); rmDirR(relativeBuildDir()); QStringList args = {QStringLiteral("modules.cpp.generateCompilerListingFiles:%1") .arg(generateListing ? "true" : "false")}; if (!customListingSuffix.isEmpty()) args << QStringLiteral("modules.cpp.compilerListingSuffix:%1").arg(customListingSuffix); QCOMPARE(runQbs(QbsRunParameters("resolve", args)), 0); if (m_qbsStdout.contains("unsupported toolset:")) QSKIP(unsupportedToolsetMessage(m_qbsStdout)); if (!m_qbsStdout.contains("compiler listing suffix:")) QFAIL("No current compiler listing suffix pattern exists"); QString compilerListingSuffix; if (!extractQuitedValue(m_qbsStdout, compilerListingSuffix)) QFAIL("Unable to extract current compiler listing suffix"); if (!customListingSuffix.isEmpty()) QCOMPARE(compilerListingSuffix, customListingSuffix); QCOMPARE(runQbs(QbsRunParameters(args)), 0); const QString productBuildDir = relativeProductBuildDir("compiler-listing"); const QString hash = inputDirHash("."); const QString mainListing = productBuildDir + "/" + hash + "/main.c" + compilerListingSuffix; QCOMPARE(regularFileExists(mainListing), generateListing); const QString funListing = productBuildDir + "/" + hash + "/fun.c" + compilerListingSuffix; QCOMPARE(regularFileExists(funListing), generateListing); } void TestBlackboxBareMetal::linkerMapFile_data() { QTest::addColumn("generateMap"); QTest::addColumn("customMapSuffix"); QTest::newRow("do-not-generate-linker-map") << false << ""; QTest::newRow("generate-default-linker-map") << true << ""; QTest::newRow("generate-custom-linker-map") << true << ".mmm"; } void TestBlackboxBareMetal::linkerMapFile() { QFETCH(bool, generateMap); QFETCH(QString, customMapSuffix); QDir::setCurrent(testDataDir + "/linker-map"); rmDirR(relativeBuildDir()); QStringList args = {QStringLiteral("modules.cpp.generateLinkerMapFile:%1") .arg(generateMap ? "true" : "false")}; if (!customMapSuffix.isEmpty()) args << QStringLiteral("modules.cpp.linkerMapSuffix:%1").arg(customMapSuffix); QCOMPARE(runQbs(QbsRunParameters("resolve", args)), 0); if (!m_qbsStdout.contains("linker map suffix:")) QFAIL("No current linker map suffix pattern exists"); QString linkerMapSuffix; if (!extractQuitedValue(m_qbsStdout, linkerMapSuffix)) QFAIL("Unable to extract current linker map suffix"); if (!customMapSuffix.isEmpty()) QCOMPARE(linkerMapSuffix, customMapSuffix); QCOMPARE(runQbs(QbsRunParameters(args)), 0); const QString productBuildDir = relativeProductBuildDir("linker-map"); const QString linkerMap = productBuildDir + "/linker-map" + linkerMapSuffix; QCOMPARE(regularFileExists(linkerMap), generateMap); } void TestBlackboxBareMetal::compilerDefinesByLanguage() { QDir::setCurrent(testDataDir + "/compiler-defines-by-language"); QbsRunParameters params(QStringList{ "-f", "compiler-defines-by-language.qbs" }); QCOMPARE(runQbs(params), 0); } void TestBlackboxBareMetal::toolchainProbe() { QDir::setCurrent(testDataDir + "/toolchain-probe"); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); if (m_qbsStdout.contains("broken probe:")) QFAIL(brokenProbeMessage(m_qbsStdout)); } QTEST_MAIN(TestBlackboxBareMetal) qbs-src-3.2.0/tests/auto/blackbox/blackbox-android.qbs0000644000175100017510000000100515154533055022307 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "blackbox-android" Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { name: "testdata" prefix: "testdata-android/" files: ["**/*"] fileTags: [] } files: [ "../shared.h", "tst_blackboxbase.cpp", "tst_blackboxbase.h", "tst_blackboxandroid.cpp", "tst_blackboxandroid.h", ] cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)]) } qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxtutorial.cpp0000644000175100017510000000511515154533055023352 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "tst_blackboxtutorial.h" #include #include static QStringList collectProjects(const QString &dirPath) { QStringList result; QDir dir(dirPath); const auto subDirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); for (const auto &subDir : subDirs) { const auto path = dir.filePath(subDir); if (!QFileInfo::exists(path + "/myproject.qbs")) continue; result.append(dir.relativeFilePath(path)); } return result; } TestBlackboxTutorial::TestBlackboxTutorial() : TestBlackboxBase(SRCDIR "/../../../tutorial/", "blackbox-tutorial") {} void TestBlackboxTutorial::tutorial_data() { QTest::addColumn("project"); const auto projects = collectProjects(testDataDir); for (const auto &project : projects) { QTest::newRow(project.toUtf8().data()) << project; } } void TestBlackboxTutorial::tutorial() { QFETCH(QString, project); QVERIFY(QDir::setCurrent(testDataDir + "/" + project)); QCOMPARE(runQbs(), 0); } QTEST_MAIN(TestBlackboxTutorial) qbs-src-3.2.0/tests/auto/blackbox/testdata-android/0000755000175100017510000000000015154533055021630 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/qt-app/0000755000175100017510000000000015154533055023032 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/qt-app/MainWindow.cpp0000644000175100017510000000017715154533055025617 0ustar runnerrunner#include "MainWindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { } MainWindow::~MainWindow() { } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/qt-app/main.cpp0000644000175100017510000000025415154533055024463 0ustar runnerrunner#include "MainWindow.h" #include int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/qt-app/test.keystore0000644000175100017510000000240415154533055025600 0ustar runnerrunnerqbstestwg00 +*ոR9C!Y5!CJ<"_'ҲS__^eszIegƒgL*<z6N wBav Y&vgêe,˷u`?-2Z 5 ]J3y:LJ!Eh@w׶7,DL,mf &ݙ، ojX+N_s6Ȍ\ΆQZC0*=цkip<؛XLe_@ ^N7(Sě"+*^kdp58U{sx5`+yzi:'"$uB0y~Mҝۈ"{ 'D%3;ӱWc7[Bd$ȴRIB,yuUl0I6X.50900gw20  *H  021 0 UUS10U Android10Uqbs test0 210118213023Z 480605213023Z021 0 UUS10U Android10Uqbs test00  *H 0>_\e_r'1[ޤ%RP cK vи..UPmNL#@-w:!ƙ U;)VCF/ׂ@ՋVmc6+&G@$7!00U>r!i&y~`(Z 0  *H  wGg5Vk0O)S>hE5ȕ+5$~T]IyTr.B,4R$Y:rjV}S-e.?ead1z/bJguW)0Uؼ@;柋k>iT:%QevRqbs-src-3.2.0/tests/auto/blackbox/testdata-android/qt-app/TestQt6.java0000644000175100017510000000260415154533055025211 0ustar runnerrunnerpackage org.qbs.example; import org.qtproject.qt.android.bindings.QtActivity; import android.os.*; import android.content.*; import android.app.*; import android.util.Log; import java.lang.String; import android.content.Intent; import org.qbs.example.*; public class TestQt6 extends QtActivity { public static native void testFunc(String test); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("qbs", "onCreate Test"); Intent theIntent = getIntent(); if (theIntent != null) { String theAction = theIntent.getAction(); if (theAction != null) { Log.d("qbs onCreate ", theAction); } } } @Override public void onDestroy() { Log.d("qbs", "onDestroy"); System.exit(0); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d("qbs onActivityResult", "requestCode: "+requestCode); if (resultCode == RESULT_OK) { Log.d("qbs onActivityResult - resultCode: ", "SUCCESS"); } else { Log.d("qbs onActivityResult - resultCode: ", "CANCEL"); } } @Override public void onNewIntent(Intent intent) { Log.d("qbs", "onNewIntent"); super.onNewIntent(intent); setIntent(intent); } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/qt-app/MainWindow.h0000644000175100017510000000033215154533055025255 0ustar runnerrunner#ifndef MAINWINDOW_H #define MAINWINDOW_H #include class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); }; #endif // MAINWINDOW_H qbs-src-3.2.0/tests/auto/blackbox/testdata-android/qt-app/qt-app.qbs0000644000175100017510000000122015154533055024736 0ustar runnerrunnerProject { QtGuiApplication { Depends { name: "Lib" } files: ["main.cpp", "MainWindow.cpp", "MainWindow.h" ] Group { condition: Qt.core.versionMajor == 5 files: ["Test.java"] } Group { condition: Qt.core.versionMajor == 6 files: ["TestQt6.java"] } Android.sdk.packageName: "my.qtapp" Android.sdk.apkBaseName: name Depends { name: "Qt"; submodules: ["core", "widgets"] } } StaticLibrary { name: "Lib" Export { Depends { name: "Qt.android_support"; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/qt-app/Test.java0000644000175100017510000000260215154533055024614 0ustar runnerrunnerpackage org.qbs.example; import org.qtproject.qt5.android.bindings.QtActivity; import android.os.*; import android.content.*; import android.app.*; import android.util.Log; import java.lang.String; import android.content.Intent; import org.qbs.example.*; public class Test extends QtActivity { public static native void testFunc(String test); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("qbs", "onCreate Test"); Intent theIntent = getIntent(); if (theIntent != null) { String theAction = theIntent.getAction(); if (theAction != null) { Log.d("qbs onCreate ", theAction); } } } @Override public void onDestroy() { Log.d("qbs", "onDestroy"); System.exit(0); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d("qbs onActivityResult", "requestCode: "+requestCode); if (resultCode == RESULT_OK) { Log.d("qbs onActivityResult - resultCode: ", "SUCCESS"); } else { Log.d("qbs onActivityResult - resultCode: ", "CANCEL"); } } @Override public void onNewIntent(Intent intent) { Log.d("qbs", "onNewIntent"); super.onNewIntent(intent); setIntent(intent); } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/0000755000175100017510000000000015154533055025747 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/multiple-libs-per-apk.qbs0000644000175100017510000000463515154533055032605 0ustar runnerrunnerProject { DynamicLibrary { Depends { name: "Android.ndk" } Depends { name: "cpp" } name: "lib1" files: ["src/main/jni/lib1.cpp"] qbs.targetPlatform: "android" Properties { condition: qbs.toolchain.includes("clang"); Android.ndk.appStl: "c++_shared" } Android.ndk.appStl: "stlport_shared" cpp.useRPaths: false } DynamicLibrary { Depends { name: "Android.ndk" } Depends { name: "cpp" } name: "lib2" files: ["src/main/jni/lib2.cpp"] qbs.targetPlatform: "android" Properties { condition: qbs.toolchain.includes("clang"); Android.ndk.appStl: "c++_shared" } Android.ndk.appStl: "stlport_shared" cpp.useRPaths: false } JavaJarFile { Depends { name: "Android.sdk" } Android.sdk.packageName: undefined Android.sdk.automaticSources: false Depends { name: "lib6" } Depends { name: "lib8" } name: "lib3" files: ["io/qbs/lib3/lib3.java"] } JavaJarFile { Depends { name: "Android.sdk" } Android.sdk.packageName: undefined Android.sdk.automaticSources: false name: "lib4" files: ["lib4.java"] } JavaJarFile { Depends { name: "Android.sdk" } Android.sdk.packageName: undefined Android.sdk.automaticSources: false name: "lib5" files: ["lib5.java"] } JavaJarFile { Depends { name: "Android.sdk" } Android.sdk.packageName: undefined Android.sdk.automaticSources: false name: "lib6" files: ["lib6.java"] } JavaJarFile { Depends { name: "Android.sdk" } Android.sdk.packageName: undefined Android.sdk.automaticSources: false name: "lib7" files: ["lib7.java"] } JavaJarFile { Depends { name: "Android.sdk" } Android.sdk.packageName: undefined Android.sdk.automaticSources: false Depends { name: "lib7"; Android.sdk.embedJar: false } name: "lib8" files: ["lib8.java"] } Application { name: "twolibs" Android.sdk.apkBaseName: name Android.sdk.packageName: "io.qt.dummy" Depends { productTypes: ["android.nativelibrary"] } Depends { name: "lib3"; Android.sdk.embedJar: true } Depends { name: "lib4"; Android.sdk.embedJar: false } Depends { name: "lib5" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/lib5.java0000644000175100017510000000002615154533055027443 0ustar runnerrunnerpublic class lib5 { } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/lib7.java0000644000175100017510000000002615154533055027445 0ustar runnerrunnerpublic class lib7 { } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/lib6.java0000644000175100017510000000002615154533055027444 0ustar runnerrunnerpublic class lib6 { } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/io/0000755000175100017510000000000015154533055026356 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/io/qbs/0000755000175100017510000000000015154533055027143 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/io/qbs/lib3/0000755000175100017510000000000015154533055027774 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/io/qbs/lib3/lib3.java0000644000175100017510000000012115154533055031462 0ustar runnerrunnerpackage io.qbs.lib3; public class lib3 { public static void foo() { } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/0000755000175100017510000000000015154533055026536 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/0000755000175100017510000000000015154533055027462 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/java/0000755000175100017510000000000015154533055030403 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/java/io/0000755000175100017510000000000015154533055031012 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/java/io/qt/0000755000175100017510000000000015154533055031436 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/java/io/qt/dummy/0000755000175100017510000000000015154533055032571 5ustar runnerrunner././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/java/io/qt/dummy/Dummy.javaqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/java/io/qt/dummy/D0000644000175100017510000000065015154533055032700 0ustar runnerrunnerpackage io.qt.dummy; import android.app.Activity; import android.os.Build; import io.qbs.lib3.lib3; import java.util.Arrays; import java.util.List; public class Dummy extends Activity { static { List abis = Arrays.asList(Build.SUPPORTED_ABIS); if (abis.contains("armeabi")) { System.loadLibrary("lib1"); System.loadLibrary("lib2"); } lib3.foo(); } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/jni/0000755000175100017510000000000015154533055030242 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/jni/lib2.cpp0000644000175100017510000000234715154533055031604 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void g() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/jni/lib1.cpp0000644000175100017510000000234715154533055031603 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void f() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/res/0000755000175100017510000000000015154533055030253 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/res/values/0000755000175100017510000000000015154533055031552 5ustar runnerrunner././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/res/values/strings.xmlqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/res/values/strings0000644000175100017510000000010415154533055033161 0ustar runnerrunner dummy ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/AndroidManifest.xmlqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/AndroidManifest.xm0000644000175100017510000000145015154533055033077 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/lib8.java0000644000175100017510000000002615154533055027446 0ustar runnerrunnerpublic class lib8 { } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/lib4.java0000644000175100017510000000002615154533055027442 0ustar runnerrunnerpublic class lib4 { } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/aidl/0000755000175100017510000000000015154533055022541 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/aidl/aidl.qbs0000644000175100017510000000024115154533055024156 0ustar runnerrunnerApplication { name: "io.qbs.aidltest" Android.sdk.aidlSearchPaths: path files: [ "AndroidManifest.xml", "io/qbs/aidltest/*", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/aidl/io/0000755000175100017510000000000015154533055023150 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/aidl/io/qbs/0000755000175100017510000000000015154533055023735 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/aidl/io/qbs/aidltest/0000755000175100017510000000000015154533055025546 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/aidl/io/qbs/aidltest/Interface2.aidl0000644000175100017510000000013015154533055030355 0ustar runnerrunnerpackage io.qbs.aidltest; interface Interface2 { void someFunc(in Bundle params); } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/aidl/io/qbs/aidltest/Interface1.aidl0000644000175100017510000000022515154533055030361 0ustar runnerrunnerpackage io.qbs.aidltest; import io.qbs.aidltest.Interface2; interface Interface1 { void doSomething(in Interface2 param1, in Bundle param2); } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/aidl/io/qbs/aidltest/MainActivity.java0000644000175100017510000000061415154533055031013 0ustar runnerrunnerpackage io.qbs.aidltest; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView label = new TextView(this); label.setText("Hello world!"); setContentView(label); } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/aidl/AndroidManifest.xml0000644000175100017510000000103115154533055026325 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-android/no-native/0000755000175100017510000000000015154533055023530 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/no-native/no-native.qbs0000644000175100017510000000044015154533055026135 0ustar runnerrunnerApplication { qbs.targetPlatform: "android" name: "com.example.android.basicmediadecoder" Android.sdk.sourceSetDir: Android.sdk.sdkDir + "/samples/android-BasicMediaDecoder/Application/src/main" Android.sdk.versionCode: 5 Android.sdk.versionName: "5.0" } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/0000755000175100017510000000000015154533055024542 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/libdependency.so0000644000175100017510000000000015154533055027700 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/src/0000755000175100017510000000000015154533055025331 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/src/main/0000755000175100017510000000000015154533055026255 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/src/main/java/0000755000175100017510000000000015154533055027176 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/src/main/java/my/0000755000175100017510000000000015154533055027623 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/src/main/java/my/minimal/0000755000175100017510000000000015154533055031251 5ustar runnerrunner././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/src/main/java/my/minimal/MinimalNative.javaqbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/src/main/java/my/minimal/MinimalNa0000644000175100017510000000070615154533055033044 0ustar runnerrunnerpackage minimalnative; import android.app.Activity; import android.widget.TextView; import android.os.Bundle; public class MinimalNative extends Activity { @Override public void onCreate(Bundle savedInstanceState) { TextView tv = new TextView(this); tv.setText(stringFromNative()); setContentView(tv); } public native String stringFromNative(); static { System.loadLibrary("minimal"); } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/src/main/native/0000755000175100017510000000000015154533055027543 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/src/main/native/native.c0000644000175100017510000000033515154533055031176 0ustar runnerrunner#include #include jstring Java_minimalnative_MinimalNative_stringFromNative(JNIEnv* env, jobject thiz) { (void)thiz; return (*env)->NewStringUTF(env, "This message comes from native code."); } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/src/main/AndroidManifest.xml0000644000175100017510000000103215154533055032042 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-android/minimal-native/minimal-native.qbs0000644000175100017510000000065415154533055030170 0ustar runnerrunnerCppApplication { name: "minimalnative" qbs.buildVariant: "release" Properties { condition: qbs.toolchain.includes("clang"); Android.ndk.appStl: "c++_shared" } Android.sdk.packageName: "my.minimalnative" Android.sdk.apkBaseName: name Android.ndk.appStl: "stlport_shared" files: "src/main/native/native.c" Group { files: "libdependency.so" fileTags: "android.nativelibrary" } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/qml-app/0000755000175100017510000000000015154533055023177 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/qml-app/main.cpp0000644000175100017510000000111015154533055024620 0ustar runnerrunner#include #include int main(int argc, char *argv[]) { if (qEnvironmentVariableIsEmpty("QTGLESSTREAM_DISPLAY")) { qputenv("QT_QPA_EGLFS_PHYSICAL_WIDTH", QByteArray("213")); qputenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT", QByteArray("120")); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); } QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/qml-app/qml.qrc0000644000175100017510000000012715154533055024477 0ustar runnerrunner main.qml qbs-src-3.2.0/tests/auto/blackbox/testdata-android/qml-app/src/0000755000175100017510000000000015154533055023766 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/qml-app/src/main/0000755000175100017510000000000015154533055024712 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/qml-app/src/main/assets/0000755000175100017510000000000015154533055026214 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/qml-app/src/main/assets/dummyasset.txt0000644000175100017510000000000015154533055031136 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/qml-app/src/main/AndroidManifest.xml0000644000175100017510000001167715154533055030517 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-android/qml-app/main.qml0000644000175100017510000000021115154533055024630 0ustar runnerrunnerimport QtQuick 2.6 import QtQuick.Window 2.2 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/qml-app/qml-app.qbs0000644000175100017510000000063615154533055025262 0ustar runnerrunnerQtApplication { name: "qmlapp" Depends { name: "Qt.quick" } Depends { name: "Qt.android_support" } Properties { condition: qbs.targetOS.includes("android") Qt.android_support.extraPrefixDirs: path } Android.sdk.packageName: "my.qmlapp" Android.sdk.apkBaseName: name Qt.android_support.qmlImportPaths: path files: [ "main.cpp", "qml.qrc", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/0000755000175100017510000000000015154533055026647 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/0000755000175100017510000000000015154533055030410 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/product1.qbs0000644000175100017510000000222015154533055032654 0ustar runnerrunnerProject { DynamicLibrary { Depends { name: "Android.ndk" } Depends { name: "cpp" } name: "p1lib1" files: ["src/main/jni/lib1.cpp"] qbs.targetPlatform: "android" Properties { condition: qbs.toolchain.includes("clang"); Android.ndk.appStl: "c++_shared" } Android.ndk.appStl: "stlport_shared" Properties { qbs.architectures: !qbs.architecture ? ["armv7a", "x86"] : undefined overrideListProperties: true } cpp.useRPaths: false } DynamicLibrary { Depends { name: "Android.ndk" } Depends { name: "cpp" } name: "p1lib2" files: ["src/main/jni/lib2.cpp"] qbs.targetPlatform: "android" Properties { condition: qbs.toolchain.includes("clang"); Android.ndk.appStl: "c++_shared" } Android.ndk.appStl: "stlport_shared" cpp.useRPaths: false } Application { name: "twolibs1" Android.sdk.apkBaseName: name Android.sdk.packageName: "io.qt.dummy1" Depends { productTypes: ["android.nativelibrary"] limitToSubProject: true } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/0000755000175100017510000000000015154533055031177 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/0000755000175100017510000000000015154533055032123 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/java/0000755000175100017510000000000015154533055033044 5ustar runnerrunner././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/java/io/qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/java/0000755000175100017510000000000015154533055033044 5ustar runnerrunner././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/java/io/qt/qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/java/0000755000175100017510000000000015154533055033044 5ustar runnerrunner././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/java/io/qt/dummy1/qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/java/0000755000175100017510000000000015154533055033044 5ustar runnerrunner././@LongLink0000644000000000000000000000017400000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/java/io/qt/dummy1/Dummy.javaqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/java/0000644000175100017510000000070715154533055033052 0ustar runnerrunnerpackage io.qt.dummy1; import android.app.Activity; import android.os.Build; import java.util.Arrays; import java.util.List; public class Dummy extends Activity { static { List abis = Arrays.asList(Build.SUPPORTED_ABIS); if (abis.contains("x86") || abis.contains("mips")) { System.loadLibrary("p1lib1"); } if (abis.contains("armeabi")) { System.loadLibrary("p1lib2"); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/jni/0000755000175100017510000000000015154533055032703 5ustar runnerrunner././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/jni/lib2.cppqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/jni/l0000644000175100017510000000234715154533055033067 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void g() {} ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/jni/lib1.cppqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/jni/l0000644000175100017510000000234715154533055033067 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void f() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/res/0000755000175100017510000000000015154533055032714 5ustar runnerrunner././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/res/values/qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/res/v0000755000175100017510000000000015154533055033102 5ustar runnerrunner././@LongLink0000644000000000000000000000016600000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/res/values/strings.xmlqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/res/v0000644000175100017510000000010515154533055033100 0ustar runnerrunner dummy1 ././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/AndroidManifest.xmlqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/Andro0000644000175100017510000000145115154533055033112 0ustar runnerrunner ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/multiple-apks-per-project.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/multiple-apks-per-proje0000644000175100017510000000011415154533055033256 0ustar runnerrunnerProject { references: [ "product1", "product2", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/0000755000175100017510000000000015154533055030411 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/0000755000175100017510000000000015154533055031200 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/0000755000175100017510000000000015154533055032124 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/java/0000755000175100017510000000000015154533055033045 5ustar runnerrunner././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/java/io/qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/java/0000755000175100017510000000000015154533055033045 5ustar runnerrunner././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/java/io/qt/qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/java/0000755000175100017510000000000015154533055033045 5ustar runnerrunner././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/java/io/qt/dummy2/qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/java/0000755000175100017510000000000015154533055033045 5ustar runnerrunner././@LongLink0000644000000000000000000000017400000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/java/io/qt/dummy2/Dummy.javaqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/java/0000644000175100017510000000060015154533055033043 0ustar runnerrunnerpackage io.qt.dummy2; import android.app.Activity; import android.os.Build; import java.util.Arrays; import java.util.List; public class Dummy extends Activity { static { List abis = Arrays.asList(Build.SUPPORTED_ABIS); if (abis.contains("armeabi")) { System.loadLibrary("p2lib1"); System.loadLibrary("p2lib2"); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/jni/0000755000175100017510000000000015154533055032704 5ustar runnerrunner././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/jni/lib2.cppqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/jni/l0000644000175100017510000000234715154533055033070 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void g() {} ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/jni/lib1.cppqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/jni/l0000644000175100017510000000234715154533055033070 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void f() {} ././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/AndroidManifest.xmlqbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/Andro0000644000175100017510000000145115154533055033113 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/product2.qbs0000644000175100017510000000144115154533055032662 0ustar runnerrunnerProject { DynamicLibrary { Depends { name: "cpp" } name: "p2lib1" files: ["src/main/jni/lib1.cpp"] qbs.targetPlatform: "android" cpp.useRPaths: false } DynamicLibrary { Depends { name: "Android.ndk" } Depends { name: "cpp" } name: "p2lib2" files: ["src/main/jni/lib2.cpp"] qbs.targetPlatform: "android" Properties { condition: qbs.toolchain.includes("clang"); Android.ndk.appStl: "c++_shared" } Android.ndk.appStl: "stlport_shared" } Application { name: "twolibs2" Android.sdk.apkBaseName: name Android.sdk.packageName: "io.qt.dummy2" Depends { productTypes: ["android.nativelibrary"] limitToSubProject: true } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-android/teapot/0000755000175100017510000000000015154533055023124 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-android/teapot/teapot.qbs0000644000175100017510000001145515154533055025135 0ustar runnerrunnerimport qbs.File Project { minimumQbsVersion: qbs.version StaticLibrary { name: "native-glue" qbs.targetPlatform: "android" cpp.warningLevel: "none" Depends { name: "cpp" } Group { id: glue_sources prefix: Android.ndk.ndkDir + "/sources/android/native_app_glue/" files: ["*.c", "*.h"] } Export { Depends { name: "cpp" } cpp.includePaths: [glue_sources.prefix] cpp.dynamicLibraries: ["log"] } } StaticLibrary { name: "ndk-helper" qbs.targetPlatform: "android" cpp.warningLevel: "none" Depends { name: "Android.ndk" } Depends { name: "cpp" } Depends { name: "native-glue" } Probe { id: ndkHelperProbe property string ndkDir: Android.ndk.ndkDir property string samplesDir: Android.ndk.ndkSamplesDir property string dir configure: { var paths = [samplesDir + "/teapots/common/ndk_helper/", ndkDir + "/sources/android/ndk_helper/"]; for (var i = 0; i < paths.length; ++i) { if (File.exists(paths[i])) { dir = paths[i]; break; } } } } property string ndkDir: ndkHelperProbe.dir Group { id: ndkhelper_sources prefix: ndkHelperProbe.dir files: ["*.cpp", "*.h"].concat( !File.exists(ndkHelperProbe.dir + "/gl3stub.cpp") ? ["gl3stub.c"] : []) } Properties { condition: qbs.toolchain.includes("clang"); Android.ndk.appStl: "c++_shared" } Android.ndk.appStl: "gnustl_shared" cpp.cxxLanguageVersion: "c++11" Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.ndkDir] cpp.dynamicLibraries: ["log", "android", "EGL", "GLESv2"] } } StaticLibrary { name: "android_cpufeatures" qbs.targetPlatform: "android" Depends { name: "cpp" } Group { id: cpufeatures_sources prefix: Android.ndk.ndkDir + "/sources/android/cpufeatures/" files: ["*.c", "*.h"] } Export { Depends { name: "cpp" } cpp.includePaths: [cpufeatures_sources.prefix] cpp.dynamicLibraries: ["dl"] } } CppApplication { name: "TeapotNativeActivity" qbs.targetPlatform: "android" Depends { name: "Android.ndk" } Depends { name: "cpp" } Depends { name: "android_cpufeatures" } Depends { name: "native-glue" } Depends { name: "ndk-helper" } Probe { id: teapotProbe property string samplesDir: Android.sdk.ndkSamplesDir property string dir configure: { var paths = ["/teapots/classic-teapot/src/main", "/Teapot/app/src/main", "/Teapot"]; for (var i = 0; i < paths.length; ++i) { if (File.exists(samplesDir + paths[i])) { dir = samplesDir + paths[i]; break; } } } } Probe { id: teapotProbeJni property string samplesDir: Android.ndk.ndkSamplesDir property string jniDir configure: { var paths = ["/teapots/classic-teapot/src/main/cpp/", "/Teapot/app/src/main/jni/", "/Teapot/jni/"]; for (var i = 0; i < paths.length; ++i) { if (File.exists(samplesDir + paths[i])) { jniDir = samplesDir + paths[i]; break; } } } } Group { name: "C++ sources" prefix: teapotProbeJni.jniDir files: [ "TeapotNativeActivity.cpp", "TeapotRenderer.cpp", "TeapotRenderer.h", "teapot.inl", ] } FileTagger { patterns: ["*.inl"]; fileTags: ["hpp"] } version: "2.0" Android.sdk.apkBaseName: name Android.sdk.packageName: "com.sample.teapot" Android.sdk.sourceSetDir: teapotProbe.dir Properties { condition: qbs.toolchain.includes("clang"); Android.ndk.appStl: "c++_shared" } Android.ndk.appStl: "gnustl_shared" cpp.cxxLanguageVersion: "c++11" cpp.dynamicLibraries: ["log", "android", "EGL", "GLESv2"] cpp.useRPaths: false // Export ANativeActivity_onCreate(), // Refer to: https://github.com/android-ndk/ndk/issues/381 cpp.linkerFlags: ["-u", "ANativeActivity_onCreate"] } } qbs-src-3.2.0/tests/auto/blackbox/tst_clangdb.h0000644000175100017510000000411615154533055021040 0ustar runnerrunner/**************************************************************************** ** ** 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 QBS_TST_CLANGDB_H #define QBS_TST_CLANGDB_H #include "tst_blackbox.h" #include class TestClangDb : public TestBlackboxBase { Q_OBJECT public: TestClangDb(); private slots: void initTestCase() override; void ensureBuildTreeCreated(); void checkCanGenerateDb(); void checkDbIsValidJson(); void checkDbIsConsistentWithProject(); void checkClangDetectsSourceCodeProblems(); private: int runProcess(const QString &exec, const QStringList &args, QByteArray &stdErr, QByteArray &stdOut); qbs::Version clangVersion(); const QString projectDir; const QString projectFileName; const QString buildDir; const QString sourceFilePath; const QString dbFilePath; bool isMsvc = false; bool isMingw = false; QProcessEnvironment processEnvironment; }; #endif // Include guard. qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxwindows.cpp0000644000175100017510000002720615154533055023206 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "tst_blackboxwindows.h" #include "../shared.h" #include #include #include #include #include using qbs::Internal::HostOsInfo; using qbs::Profile; struct SigntoolInfo { enum class CodeSignResult { Failed = 0, Signed, Unsigned }; CodeSignResult result = CodeSignResult::Failed; bool timestamped = false; QString hashAlgorithm; QString subjectName; }; Q_DECLARE_METATYPE(SigntoolInfo::CodeSignResult) static SigntoolInfo extractSigntoolInfo(const QString &signtoolPath, const QString &appPath) { QProcess signtool; signtool.start(signtoolPath, { QStringLiteral("verify"), QStringLiteral("/v"), appPath }); if (!signtool.waitForStarted() || !signtool.waitForFinished()) return {}; const auto output = signtool.readAllStandardError(); SigntoolInfo signtoolInfo; if (output.contains("No signature found")) { signtoolInfo.result = SigntoolInfo::CodeSignResult::Unsigned; } else { signtoolInfo.result = SigntoolInfo::CodeSignResult::Signed; const auto output = signtool.readAllStandardOutput(); const auto lines = output.split('\n'); for (const auto &line: lines) { { const QRegularExpression re("^Hash of file \\((.+)\\):.+$"); const QRegularExpressionMatch match = re.match(line); if (match.hasMatch()) { signtoolInfo.hashAlgorithm = match.captured(1).toLocal8Bit(); continue; } } { const QRegularExpression re("Issued to: (.+)"); const QRegularExpressionMatch match = re.match(line); if (match.hasMatch()) { signtoolInfo.subjectName = match.captured(1).toLocal8Bit().trimmed(); continue; } } if (line.startsWith("The signature is timestamped:")) { signtoolInfo.timestamped = true; break; } else if (line.startsWith("File is not timestamped.")) { break; } } } return signtoolInfo; } static QString extractSigntoolPath(const QByteArray &output) { const QRegularExpression re("%%(.+)%%"); QRegularExpressionMatchIterator it = re.globalMatch(output); if (!it.hasNext()) return {}; const QRegularExpressionMatch match = it.next(); return match.captured(1).toUtf8(); } TestBlackboxWindows::TestBlackboxWindows() : TestBlackboxBase (SRCDIR "/testdata-windows", "blackbox-windows") { } void TestBlackboxWindows::initTestCase() { if (!HostOsInfo::isWindowsHost()) { QSKIP("only applies on Windows"); return; } TestBlackboxBase::initTestCase(); } void TestBlackboxWindows::innoSetup() { const SettingsPtr s = settings(); Profile profile(profileName(), s.get()); QDir::setCurrent(testDataDir + "/innosetup"); QCOMPARE(runQbs({"resolve"}), 0); const bool withInnosetup = m_qbsStdout.contains("has innosetup: true"); const bool withoutInnosetup = m_qbsStdout.contains("has innosetup: false"); QVERIFY2(withInnosetup || withoutInnosetup, m_qbsStdout.constData()); if (withoutInnosetup) QSKIP("innosetup module not present"); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("compiling test.iss")); QVERIFY(m_qbsStdout.contains("compiling Example1.iss")); QVERIFY(regularFileExists(relativeProductBuildDir("QbsSetup") + "/qbs.setup.test.exe")); QVERIFY(regularFileExists(relativeProductBuildDir("Example1") + "/Example1.exe")); } void TestBlackboxWindows::innoSetupDependencies() { const SettingsPtr s = settings(); Profile profile(profileName(), s.get()); QDir::setCurrent(testDataDir + "/innosetupDependencies"); QCOMPARE(runQbs({"resolve"}), 0); const bool withInnosetup = m_qbsStdout.contains("has innosetup: true"); const bool withoutInnosetup = m_qbsStdout.contains("has innosetup: false"); QVERIFY2(withInnosetup || withoutInnosetup, m_qbsStdout.constData()); if (withoutInnosetup) QSKIP("innosetup module not present"); QbsRunParameters params; QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("compiling test.iss")); QVERIFY(regularFileExists(relativeBuildDir() + "/qbs.setup.test.exe")); } void TestBlackboxWindows::standaloneCodesign() { QFETCH(SigntoolInfo::CodeSignResult, result); QFETCH(QString, hashAlgorithm); QFETCH(QString, subjectName); QFETCH(QString, signingTimestamp); QDir::setCurrent(testDataDir + "/codesign"); QbsRunParameters params(QStringList{"qbs.installPrefix:''"}); params.arguments << QStringLiteral("project.enableSigning:%1").arg( (result == SigntoolInfo::CodeSignResult::Signed) ? "true" : "false") << QStringLiteral("project.hashAlgorithm:%1").arg(hashAlgorithm) << QStringLiteral("project.subjectName:%1").arg(subjectName) << QStringLiteral("project.signingTimestamp:%1").arg(signingTimestamp); rmDirR(relativeBuildDir()); QCOMPARE(runQbs(params), 0); if (!m_qbsStdout.contains("signtool path:")) QSKIP("No current signtool path pattern exists"); const auto signtoolPath = extractSigntoolPath(m_qbsStdout); QVERIFY(QFileInfo(signtoolPath).exists()); const QStringList outputBinaries = {"A.exe", "B.dll"}; for (const auto &outputBinary : outputBinaries) { const auto outputBinaryPath = defaultInstallRoot + "/" + outputBinary; QVERIFY(QFileInfo(outputBinaryPath).exists()); const SigntoolInfo signtoolInfo = extractSigntoolInfo(signtoolPath, outputBinaryPath); QVERIFY(signtoolInfo.result != SigntoolInfo::CodeSignResult::Failed); QCOMPARE(signtoolInfo.result, result); QCOMPARE(signtoolInfo.hashAlgorithm, hashAlgorithm); QCOMPARE(signtoolInfo.subjectName, subjectName); QCOMPARE(signtoolInfo.timestamped, !signingTimestamp.isEmpty()); } } void TestBlackboxWindows::standaloneCodesign_data() { QTest::addColumn("result"); QTest::addColumn("hashAlgorithm"); QTest::addColumn("subjectName"); QTest::addColumn("signingTimestamp"); QTest::newRow("standalone, unsigned") << SigntoolInfo::CodeSignResult::Unsigned << "" << "" << ""; QTest::newRow("standalone, signed, sha1, qbs@community.test, no timestamp") << SigntoolInfo::CodeSignResult::Signed << "sha1" << "qbs@community.test" << ""; QTest::newRow("standalone, signed, sha256, qbs@community.test, RFC3061 timestamp") << SigntoolInfo::CodeSignResult::Signed << "sha256" << "qbs@community.test" << "http://timestamp.digicert.com"; } static bool haveWiX(const Profile &profile) { if (profile.value("wix.toolchainInstallPath").isValid() && profile.value("wix.toolchainInstallRoot").isValid()) { return true; } QStringList regKeys; regKeys << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Installer XML\\") << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Installer XML\\"); QStringList paths = QProcessEnvironment::systemEnvironment().value("PATH") .split(HostOsInfo::pathListSeparator(), Qt::SkipEmptyParts); for (const QString &key : std::as_const(regKeys)) { const QStringList versions = QSettings(key, QSettings::NativeFormat).childGroups(); for (const QString &version : versions) { QSettings settings(key + version, QSettings::NativeFormat); QString str = settings.value(QStringLiteral("InstallRoot")).toString(); if (!str.isEmpty()) paths.prepend(str); } } for (const QString &path : std::as_const(paths)) { if (regularFileExists(QDir::fromNativeSeparators(path) + HostOsInfo::appendExecutableSuffix(QStringLiteral("/candle"))) && regularFileExists(QDir::fromNativeSeparators(path) + HostOsInfo::appendExecutableSuffix(QStringLiteral("/light")))) { return true; } } return false; } void TestBlackboxWindows::wix() { const SettingsPtr s = settings(); Profile profile(profileName(), s.get()); if (!haveWiX(profile)) { QSKIP("WiX is not installed"); return; } QByteArray arch = profile.value("qbs.architecture").toString().toLatin1(); if (arch.isEmpty()) arch = QByteArrayLiteral("x86"); if (arch.contains("arm")) QSKIP("ARM is not supported for the WiX test"); QDir::setCurrent(testDataDir + "/wix"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling QbsSetup.wxs"), m_qbsStdout); QVERIFY2(m_qbsStdout.contains("linking qbs.msi"), m_qbsStdout); QVERIFY(regularFileExists(relativeProductBuildDir("QbsSetup") + "/qbs.msi")); if (HostOsInfo::isWindowsHost()) { QVERIFY2(m_qbsStdout.contains("compiling QbsBootstrapper.wxs"), m_qbsStdout); QVERIFY2(m_qbsStdout.contains("linking qbs-setup-" + arch + ".exe"), m_qbsStdout); QVERIFY(regularFileExists(relativeProductBuildDir("QbsBootstrapper") + "/qbs-setup-" + arch + ".exe")); } } void TestBlackboxWindows::wixDependencies() { const SettingsPtr s = settings(); Profile profile(profileName(), s.get()); if (!haveWiX(profile)) { QSKIP("WiX is not installed"); return; } QByteArray arch = profile.value("qbs.architecture").toString().toLatin1(); if (arch.isEmpty()) arch = QByteArrayLiteral("x86"); if (arch.contains("arm")) QSKIP("ARM is not supported for the WiX test"); QDir::setCurrent(testDataDir + "/wixDependencies"); QbsRunParameters params; if (!HostOsInfo::isWindowsHost()) params.arguments << "qbs.targetOS:windows"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("compiling QbsSetup.wxs"), m_qbsStdout); QVERIFY2(m_qbsStdout.contains("linking qbs.msi"), m_qbsStdout); QVERIFY(regularFileExists(relativeBuildDir() + "/qbs.msi")); } QTEST_MAIN(TestBlackboxWindows) qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxjava.cpp0000644000175100017510000002450515154533055022434 0ustar runnerrunner/**************************************************************************** ** ** 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 "tst_blackboxjava.h" #include "../shared.h" #include #include #include #include #include using qbs::Internal::HostOsInfo; using qbs::Profile; TestBlackboxJava::TestBlackboxJava() : TestBlackboxBase (SRCDIR "/testdata-java", "blackbox-java"), m_blacklistedJdks(qgetenv("QBS_AUTOTEST_JDK_BLACKLIST")) { } static QProcessEnvironment processEnvironmentWithCurrentDirectoryInLibraryPath() { QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(HostOsInfo::libraryPathEnvironmentVariable(), (QStringList() << env.value(HostOsInfo::libraryPathEnvironmentVariable()) << ".") .join(HostOsInfo::pathListSeparator())); return env; } void TestBlackboxJava::java() { #if defined(Q_OS_WIN32) && !defined(Q_OS_WIN64) QSKIP("QTBUG-3845"); #endif const SettingsPtr s = settings(); Profile p(profileName(), s.get()); int status; const auto jdkTools = findJdkTools(&status); QCOMPARE(status, 0); QDir::setCurrent(testDataDir + "/java"); status = runQbs(); if (p.value("java.jdkPath").toString().isEmpty() && status != 0 && m_qbsStderr.contains("jdkPath")) { QSKIP("java.jdkPath not set and automatic detection failed"); } if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Skip test in cross-compiled build"); QCOMPARE(status, 0); const QStringList classFiles = QStringList() << "Jet" << "Ship" << "Vehicles"; QStringList classFiles1 = QStringList(classFiles) << "io/qt/qbs/HelloWorld" << "NoPackage"; for (QString &classFile : classFiles1) { classFile = relativeProductBuildDir("cc") + "/classes/" + classFile + ".class"; QVERIFY2(regularFileExists(classFile), qPrintable(classFile)); } for (const QString &classFile : classFiles) { const QString filePath = relativeProductBuildDir("jar_file") + "/classes/" + classFile + ".class"; QVERIFY2(regularFileExists(filePath), qPrintable(filePath)); } const QString jarFilePath = relativeProductBuildDir("jar_file") + '/' + "jar_file.jar"; QVERIFY2(regularFileExists(jarFilePath), qPrintable(jarFilePath)); // Now check whether we correctly predicted the class file output paths. QCOMPARE(runQbs(QbsRunParameters("clean")), 0); for (const QString &classFile : std::as_const(classFiles1)) { QVERIFY2(!regularFileExists(classFile), qPrintable(classFile)); } // This tests various things: java.manifestClassPath, JNI, etc. QDir::setCurrent(relativeBuildDir() + "/install-root"); QProcess process; process.setProcessEnvironment(processEnvironmentWithCurrentDirectoryInLibraryPath()); process.start(HostOsInfo::appendExecutableSuffix(jdkTools["java"]), QStringList() << "-jar" << "jar_file.jar"); if (process.waitForStarted()) { QVERIFY2(process.waitForFinished(), qPrintable(process.errorString())); QVERIFY2(process.exitCode() == 0, process.readAllStandardError().constData()); const QByteArray stdOut = process.readAllStandardOutput(); QVERIFY2(stdOut.contains("Driving!"), stdOut.constData()); QVERIFY2(stdOut.contains("Flying!"), stdOut.constData()); QVERIFY2(stdOut.contains("Flying (this is a space ship)!"), stdOut.constData()); QVERIFY2(stdOut.contains("Sailing!"), stdOut.constData()); QVERIFY2(stdOut.contains("Native code performing complex internal combustion process ("), stdOut.constData()); } process.start("unzip", QStringList() << "-p" << "jar_file.jar"); if (process.waitForStarted()) { QVERIFY2(process.waitForFinished(), qPrintable(process.errorString())); const QByteArray stdOut = process.readAllStandardOutput(); QVERIFY2(stdOut.contains("Class-Path: random_stuff.jar car_jar.jar"), stdOut.constData()); QVERIFY2(stdOut.contains("Main-Class: Vehicles"), stdOut.constData()); QVERIFY2(stdOut.contains("Some-Property: Some-Value"), stdOut.constData()); QVERIFY2(stdOut.contains("Additional-Property: Additional-Value"), stdOut.constData()); QVERIFY2(stdOut.contains("Extra-Property: Crazy-Value"), stdOut.constData()); } } static QString dpkgArch(const QString &prefix = QString()) { QProcess dpkg; dpkg.start("/usr/bin/dpkg", QStringList() << "--print-architecture"); dpkg.waitForFinished(); if (dpkg.exitStatus() == QProcess::NormalExit && dpkg.exitCode() == 0) return prefix + QString::fromLocal8Bit(dpkg.readAllStandardOutput().trimmed()); return {}; } void TestBlackboxJava::javaDependencyTracking() { QFETCH(QString, jdkPath); QFETCH(QString, javaVersion); QDir::setCurrent(testDataDir + "/java"); QbsRunParameters rp; rp.arguments.push_back("--check-outputs"); if (!jdkPath.isEmpty()) { if (m_blacklistedJdks.contains(jdkPath)) QSKIP("skipping blacklisted JDK"); rp.arguments << ("modules.java.jdkPath:" + jdkPath); } if (!javaVersion.isEmpty()) rp.arguments << ("modules.java.languageVersion:'" + javaVersion + "'"); rmDirR(relativeBuildDir()); const bool defaultJdkPossiblyTooOld = jdkPath.isEmpty() && !javaVersion.isEmpty(); rp.expectFailure = defaultJdkPossiblyTooOld; QVERIFY(runQbs(rp) == 0 || (defaultJdkPossiblyTooOld && m_qbsStderr.contains("invalid source release"))); } void TestBlackboxJava::javaDependencyTracking_data() { QTest::addColumn("jdkPath"); QTest::addColumn("javaVersion"); const SettingsPtr s = settings(); Profile p(profileName(), s.get()); auto getSpecificJdkVersion = [](const QString &jdkVersion) -> QString { if (HostOsInfo::isMacosHost()) { QProcess java_home; java_home.start("/usr/libexec/java_home", {"--version", jdkVersion, "--failfast"}); java_home.waitForFinished(); if (java_home.exitStatus() == QProcess::NormalExit && java_home.exitCode() == 0) return QString::fromLocal8Bit(java_home.readAllStandardOutput().trimmed()); } else if (HostOsInfo::isWindowsHost()) { QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\" + jdkVersion, QSettings::NativeFormat); return settings.value("JavaHome").toString(); } else { QString minorVersion = jdkVersion; if (minorVersion.startsWith("1.")) minorVersion.remove(0, 2); const QStringList searchPaths = { "/usr/lib/jvm/java-" + minorVersion + "-openjdk" + dpkgArch("-"), // Debian "/usr/lib/jvm/java-" + minorVersion + "-openjdk", // Arch "/usr/lib/jvm/jre-1." + minorVersion + ".0-openjdk", // Fedora "/usr/lib64/jvm/java-1." + minorVersion + ".0-openjdk", // OpenSuSE }; for (const QString &searchPath : searchPaths) { if (QFile::exists(searchPath + "/bin/javac")) return searchPath; } } return {}; }; static const auto knownJdkVersions = QStringList() << "1.7" << "1.8" << "1.9" << QString(); // default JDK; QStringList seenJdkVersions; for (const auto &jdkVersion : knownJdkVersions) { QString specificJdkPath = getSpecificJdkVersion(jdkVersion); if (jdkVersion.isEmpty() || !specificJdkPath.isEmpty()) { const auto jdkPath = jdkVersion.isEmpty() ? jdkVersion : specificJdkPath; if (!jdkVersion.isEmpty()) seenJdkVersions << jdkVersion; if (!seenJdkVersions.empty()) { const auto javaVersions = QStringList() << knownJdkVersions.mid(0, knownJdkVersions.indexOf(seenJdkVersions.last()) + 1) << QString(); // also test with no explicitly specified source version for (const auto ¤tJavaVersion : javaVersions) { const QString rowName = (!jdkPath.isEmpty() ? jdkPath : "default JDK") + QStringLiteral(", ") + (!currentJavaVersion.isEmpty() ? ("Java " + currentJavaVersion) : "default Java version"); QTest::newRow(rowName.toLatin1().constData()) << jdkPath << currentJavaVersion; } } } } if (seenJdkVersions.empty()) QSKIP("No JDKs installed"); } void TestBlackboxJava::javaDependencyTrackingInnerClass() { const SettingsPtr s = settings(); Profile p(profileName(), s.get()); QDir::setCurrent(testDataDir + "/java/inner-class"); QbsRunParameters params; int status = runQbs(params); if (p.value("java.jdkPath").toString().isEmpty() && status != 0 && m_qbsStderr.contains("jdkPath")) { QSKIP("java.jdkPath not set and automatic detection failed"); } QCOMPARE(status, 0); } QTEST_MAIN(TestBlackboxJava) qbs-src-3.2.0/tests/auto/blackbox/blackbox-windows.qbs0000644000175100017510000000100515154533055022361 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "blackbox-windows" Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { name: "testdata" prefix: "testdata-windows/" files: ["**/*"] fileTags: [] } files: [ "../shared.h", "tst_blackboxbase.cpp", "tst_blackboxbase.h", "tst_blackboxwindows.cpp", "tst_blackboxwindows.h", ] cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)]) } qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxandroid.h0000644000175100017510000000310115154533055022565 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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 TST_BLACKBOX_H #define TST_BLACKBOX_H #include "tst_blackboxbase.h" class TestBlackboxAndroid : public TestBlackboxBase { Q_OBJECT public: TestBlackboxAndroid(); private slots: void android(); void android_data(); private: QMap findAndroid(int *status, const QString &profile); }; #endif // TST_BLACKBOX_H qbs-src-3.2.0/tests/auto/blackbox/find/0000755000175100017510000000000015154533055017321 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/find/find-nodejs.qbs0000644000175100017510000000167515154533055022241 0ustar runnerrunnerimport qbs.TextFile Product { Depends { name: "nodejs"; required: false } type: ["json"] Rule { multiplex: true Artifact { filePath: ["nodejs.json"] fileTags: ["json"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = output.filePath; cmd.sourceCode = function() { var tools = {}; if (product.moduleProperty("nodejs", "present")) { tools["node"] = product.moduleProperty("nodejs", "interpreterFilePath"); } var tf; try { tf = new TextFile(output.filePath, TextFile.WriteOnly); tf.writeLine(JSON.stringify(tools, undefined, 4)); } finally { if (tf) tf.close(); } }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/find/find-jdk.qbs0000644000175100017510000000213715154533055021521 0ustar runnerrunnerimport qbs.TextFile Product { Depends { name: "java"; required: false } type: ["json"] Rule { multiplex: true Artifact { filePath: ["jdk.json"] fileTags: ["json"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = output.filePath; cmd.sourceCode = function() { var tools = {}; if (product.moduleProperty("java", "present")) { tools["javac"] = product.moduleProperty("java", "compilerFilePath"); tools["java"] = product.moduleProperty("java", "interpreterFilePath"); tools["jar"] = product.moduleProperty("java", "jarFilePath"); } var tf; try { tf = new TextFile(output.filePath, TextFile.WriteOnly); tf.writeLine(JSON.stringify(tools, undefined, 4)); } finally { if (tf) tf.close(); } }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/find/find-typescript.qbs0000644000175100017510000000176515154533055023165 0ustar runnerrunnerimport qbs.TextFile Product { Depends { name: "nodejs"; required: false } Depends { name: "typescript"; required: false } type: ["json"] Rule { multiplex: true Artifact { filePath: ["typescript.json"] fileTags: ["json"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = output.filePath; cmd.sourceCode = function() { var tools = {}; if (product.moduleProperty("typescript", "present")) { tools["tsc"] = product.moduleProperty("typescript", "compilerPath"); } var tf; try { tf = new TextFile(output.filePath, TextFile.WriteOnly); tf.writeLine(JSON.stringify(tools, undefined, 4)); } finally { if (tf) tf.close(); } }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/find/find-xcode.qbs0000644000175100017510000000315215154533055022051 0ustar runnerrunnerimport qbs.Host import qbs.TextFile Product { property bool isSignedByDefault: { // on Apple silicon, apps are signed by default return Host.architecture() === "arm64" && (qbs.targetOS.includes("macos") || qbs.targetOS.includes("ios-simulator") && qbs.targetArchitecture === "arm64") } Depends { name: "xcode"; required: false } type: ["json"] Rule { multiplex: true Artifact { filePath: ["xcode.json"] fileTags: ["json"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = output.filePath; cmd.sourceCode = function() { var tools = {}; var present = product.moduleProperty("xcode", "present"); tools["present"] = !!present; if (present) { var keys = [ "developerPath", "version" ]; for (var i = 0; i < keys.length; ++i) { var key = keys[i]; tools[key] = product.xcode[key]; } } tools["isSignedByDefault"] = product.isSignedByDefault; var tf; try { tf = new TextFile(output.filePath, TextFile.WriteOnly); tf.writeLine(JSON.stringify(tools, undefined, 4)); } finally { if (tf) tf.close(); } }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/find/find-android.qbs0000644000175100017510000000572215154533055022374 0ustar runnerrunnerimport qbs.TextFile Product { property string packageName: "" qbs.targetPlatform: "android" multiplexByQbsProperties: ["architectures"] Properties { condition: qbs.architectures && qbs.architectures.length > 1 aggregate: true multiplexedType: "json_arch" } Depends { name: "Android.sdk"; required: false } Depends { name: "Android.ndk"; required: false } type: ["json"] Rule { multiplex: true property stringList inputTags: "json_arch" inputsFromDependencies: inputTags inputs: product.aggregate ? [] : inputTags Artifact { filePath: ["android.json"] fileTags: ["json"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = output.filePath; cmd.sourceCode = function() { var tools = {}; for (var i in inputs["json_arch"]) { var tf = new TextFile(inputs["json_arch"][i].filePath, TextFile.ReadOnly); var json = JSON.parse(tf.readAll()); tools["ndk"] = json["ndk"]; tools["ndk-samples"] = json["ndk-samples"]; tf.close(); } if (product.moduleProperty("Android.sdk", "present")) { tools["sdk"] = product.moduleProperty("Android.sdk", "sdkDir"); tools["sdk-build-tools-dx"] = product.Android.sdk.dxFilePath; tools["sdk-build-tools-d8"] = product.Android.sdk.d8FilePath; } if (product.java && product.java.present) tools["jar"] = product.java.jarFilePath; var tf; try { tf = new TextFile(output.filePath, TextFile.WriteOnly); tf.writeLine(JSON.stringify(tools, undefined, 4)); } finally { if (tf) tf.close(); } }; return cmd; } } Rule { multiplex: true Artifact { filePath: ["android_arch.json"] fileTags: ["json_arch"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = output.filePath; cmd.sourceCode = function() { var tools = {}; if (product.moduleProperty("Android.ndk", "present")) { tools["ndk"] = product.moduleProperty("Android.ndk", "ndkDir"); tools["ndk-samples"] = product.Android.ndk.ndkSamplesDir; } var tf; try { tf = new TextFile(output.filePath, TextFile.WriteOnly); tf.writeLine(JSON.stringify(tools, undefined, 4)); } finally { if (tf) tf.close(); } }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/blackbox.qbs0000644000175100017510000000136115154533055020676 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "blackbox" Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { name: "find" prefix: "find/" files: ["**/*"] fileTags: [] } Group { name: "testdata" prefix: "testdata/" files: ["**/*"] fileTags: [] } files: [ "../shared.h", "tst_blackboxbase.cpp", "tst_blackboxbase.h", "tst_blackbox.cpp", "tst_blackbox.h", ] cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)]) .concat(qbsbuildconfig.enableUnitTests ? ["QBS_ENABLE_UNIT_TESTS"] : []) .concat("QBS_VERSION=" + Utilities.cStringQuote(qbsversion.version)) } qbs-src-3.2.0/tests/auto/blackbox/blackbox-joblimits.qbs0000644000175100017510000000075215154533055022673 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "blackbox-joblimits" Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { name: "testdata" prefix: "testdata-joblimits/" files: ["**/*"] fileTags: [] } files: [ "../shared.h", "tst_blackboxbase.cpp", "tst_blackboxbase.h", "tst_blackboxjoblimits.cpp", ] cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)]) } qbs-src-3.2.0/tests/auto/blackbox/blackbox-baremetal.qbs0000644000175100017510000000101515154533055022624 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "blackbox-baremetal" Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { name: "testdata" prefix: "testdata-baremetal/" files: ["**/*"] fileTags: [] } files: [ "../shared.h", "tst_blackboxbase.cpp", "tst_blackboxbase.h", "tst_blackboxbaremetal.cpp", "tst_blackboxbaremetal.h", ] cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)]) } qbs-src-3.2.0/tests/auto/blackbox/testdata-joblimits/0000755000175100017510000000000015154533055022204 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-joblimits/job-limits-init/0000755000175100017510000000000015154533055025216 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-joblimits/job-limits-init/job-limits-init.qbs0000644000175100017510000000045415154533055030742 0ustar runnerrunnerimport qbs.Host Product { property bool _testPlatform: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-joblimits/job-limits/0000755000175100017510000000000015154533055024255 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-joblimits/job-limits/job-limits.qbs0000644000175100017510000000610715154533055027041 0ustar runnerrunnerimport qbs.TextFile Project { property int projectJobCount property int productJobCount property int moduleJobCount JobLimit { condition: projectJobCount !== -1 jobPool: "singleton" jobCount: projectJobCount } JobLimit { condition: projectJobCount !== -1 jobPool: "singleton" jobCount: 100 } CppApplication { name: "tool" consoleApplication: true cpp.cxxLanguageVersion: "c++14" Properties { condition: qbs.targetOS.includes("macos") cpp.minimumMacosVersion: "10.9" } files: "main.cpp" Group { fileTagsFilter: "application" fileTags: "tool_tag" } Export { Rule { alwaysRun: true inputs: "tool_in" explicitlyDependsOnFromDependencies: "tool_tag" Artifact { filePath: input.completeBaseName + ".out"; fileTags: "tool_out" } prepare: { var cmd = new Command(explicitlyDependsOn.tool_tag[0].filePath, [output.filePath]); cmd.workingDirectory = product.buildDirectory; cmd.description = "running tool"; cmd.jobPool = "singleton"; return cmd; } } JobLimit { condition: project.moduleJobCount !== -1 jobPool: "singleton" jobCount: project.moduleJobCount } JobLimit { condition: project.moduleJobCount !== -1 jobPool: "singleton" jobCount: 200 } } } Product { name: "p" type: "tool_out" Depends { name: "tool" } Rule { multiplex: true outputFileTags: "tool_in" outputArtifacts: { var artifacts = []; for (var i = 0; i < 5; ++i) artifacts.push({filePath: "file" + i + ".in", fileTags: "tool_in"}); return artifacts; } prepare: { var commands = []; for (var i = 0; i < outputs.tool_in.length; ++i) { var cmd = new JavaScriptCommand(); var output = outputs.tool_in[i]; cmd.output = output.filePath; cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output, TextFile.WriteOnly); f.close(); } commands.push(cmd); }; return commands; } } JobLimit { condition: project.productJobCount !== -1 jobPool: "singleton" jobCount: project.productJobCount } JobLimit { condition: project.productJobCount !== -1 jobPool: "singleton" jobCount: 300 } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-joblimits/job-limits/main.cpp0000644000175100017510000000533115154533055025707 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 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 #include #include #include #include #include #include #if defined(_WIN32) || defined(WIN32) #include #include #else #include #endif static bool tryLock(FILE *f) { const int exitCode = #if defined(_WIN32) || defined(WIN32) _locking(_fileno(f), _LK_NBLCK, 10); #else lockf(fileno(f), F_TLOCK, 10); #endif return exitCode == 0; } int main(int argc, char *argv[]) { if (argc != 2) { std::cerr << "tool needs exactly one argument" << std::endl; return 1; } const std::string lockFilePath = std::string(argv[0]) + ".lock"; std::FILE * const lockFile = std::fopen(lockFilePath.c_str(), "w"); if (!lockFile) { std::cerr << "cannot open lock file: " << std::strerror(errno) << std::endl; return 2; } if (!tryLock(lockFile)) { if (errno == EACCES || errno == EAGAIN) { std::cerr << "tool is exclusive" << std::endl; return 3; } else { std::cerr << "unexpected lock failure: " << std::strerror(errno) << std::endl; std::fclose(lockFile); return 4; } } std::this_thread::sleep_for(std::chrono::milliseconds(50)); std::fclose(lockFile); std::FILE * const output = std::fopen(argv[1], "w"); if (!output) { std::cerr << "cannot create output file: " << std::strerror(errno) << std::endl; return 5; } std::fclose(output); } qbs-src-3.2.0/tests/auto/blackbox/CMakeLists.txt0000644000175100017510000000376015154533055021147 0ustar runnerrunneradd_qbs_test(blackbox DEFINES ${QBS_UNIT_TESTS_DEFINES} "QBS_VERSION=\"${QBS_VERSION}\"" SOURCES ../shared.h tst_blackboxbase.cpp tst_blackboxbase.h tst_blackbox.cpp tst_blackbox.h ) add_qbs_test(blackbox-android SOURCES ../shared.h tst_blackboxbase.cpp tst_blackboxbase.h tst_blackboxandroid.cpp tst_blackboxandroid.h ) add_qbs_test(blackbox-apple SOURCES ../shared.h tst_blackboxbase.cpp tst_blackboxbase.h tst_blackboxapple.cpp tst_blackboxapple.h ) add_qbs_test(blackbox-baremetal SOURCES ../shared.h tst_blackboxbase.cpp tst_blackboxbase.h tst_blackboxbaremetal.cpp tst_blackboxbaremetal.h ) add_qbs_test(blackbox-clangdb SOURCES ../shared.h tst_blackboxbase.cpp tst_blackboxbase.h tst_clangdb.cpp tst_clangdb.h ) add_qbs_test(blackbox-java SOURCES ../shared.h tst_blackboxbase.cpp tst_blackboxbase.h tst_blackboxjava.cpp tst_blackboxjava.h ) add_qbs_test(blackbox-joblimits SOURCES ../shared.h tst_blackboxbase.cpp tst_blackboxbase.h tst_blackboxjoblimits.cpp ) add_qbs_test(blackbox-providers SOURCES ../shared.h tst_blackboxbase.cpp tst_blackboxbase.h tst_blackboxproviders.cpp ) add_qbs_test(blackbox-qt SOURCES ../shared.h tst_blackboxbase.cpp tst_blackboxbase.h tst_blackboxqt.cpp tst_blackboxqt.h ) add_qbs_test(blackbox-tutorial SOURCES ../shared.h tst_blackboxbase.cpp tst_blackboxbase.h tst_blackboxtutorial.h tst_blackboxtutorial.cpp ) add_qbs_test(blackbox-windows SOURCES ../shared.h tst_blackboxbase.cpp tst_blackboxbase.h tst_blackboxwindows.cpp tst_blackboxwindows.h ) qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxjava.h0000644000175100017510000000316315154533055022076 0ustar runnerrunner/**************************************************************************** ** ** 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 TST_BLACKBOX_H #define TST_BLACKBOX_H #include "tst_blackboxbase.h" class TestBlackboxJava : public TestBlackboxBase { Q_OBJECT public: TestBlackboxJava(); private slots: void java(); void javaDependencyTracking(); void javaDependencyTracking_data(); void javaDependencyTrackingInnerClass(); private: const QStringList m_blacklistedJdks; }; #endif // TST_BLACKBOX_H qbs-src-3.2.0/tests/auto/blackbox/testdata-clangdb/0000755000175100017510000000000015154533055021602 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-clangdb/project1/0000755000175100017510000000000015154533055023331 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-clangdb/project1/project.qbs0000644000175100017510000000212715154533055025510 0ustar runnerrunner// $ g++ 'i like spaces.cpp' '-DSPACES="!have \\fun\x5c!\n"' '-DSPICES=%T% # && $$ 1>&2 '\''\n'\''\n' '-DSLICES=(42>24)' && ./a.out // SPACES=!have \fun\! // SPICES=%T% # && $$ 1>&2 '\n' // SLICES=1 Project { Application { Probe { id: dummy property bool isMingw: qbs.toolchain.includes("mingw") property bool isMsvc: qbs.toolchain.includes("msvc") property var buildEnv: cpp.buildEnv configure: { if (!buildEnv) return; if (isMsvc) { console.info("is msvc"); console.info("INCLUDE=" + buildEnv["INCLUDE"]); console.info("LIB=" + buildEnv["LIB"]); } else if (isMingw) { console.info("is mingw"); console.info("PATH=" + buildEnv["PATH"]); } } } targetName: "i like spaces" Depends { name: "cpp" } cpp.defines: base.concat([ "SPACES=\"!have \\\\fun\\x5c!\\n\"", "SPICES=%T% # && $$ 1>&2 '\\n'\\n", "SLICES=(42>24)" ]); files: ["i like spaces.cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-clangdb/project1/i like spaces.cpp0000644000175100017510000000274715154533055026443 0ustar runnerrunner/**************************************************************************** ** ** 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 using namespace std; #define _STR(x) #x #define STR(x) _STR(x) int main(int argc, char **argv) { int garbage; int unused = garbage; cout << "SPACES=" << SPACES << "SPICES=" STR(SPICES) << "SLICES=" << SLICES << endl; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/0000755000175100017510000000000015154533055021131 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/0000755000175100017510000000000015154533055022052 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/HelloWorld.java0000644000175100017510000000043715154533055024774 0ustar runnerrunnerpackage io.qt.qbs; public class HelloWorld { public static void main(String[] args) { System.out.println("Tach."); } public class Internal { public native void something(); } public class Other { public final int countOfThings = 0; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/vehicles.qbs0000644000175100017510000000602715154533055024370 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host import qbs.Utilities Project { DynamicLibrary { Depends { name: "cpp" } Depends { name: "car_jar" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } property bool _testPlatform: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "native" files: ["engine.c"] qbs.installPrefix: "" install: true installDir: "" } JavaClassCollection { Depends { name: "random_stuff" } name: "cc" java.additionalCompilerFlags: ["-Xlint:all"] files: [ "Car.java", "HelloWorld.java", "Jet.java", "NoPackage.java", "Ship.java", "Vehicle.java", "Vehicles.java" ] Group { condition: Utilities.versionCompare(java.version, "1.8") >= 0 files: ["Car8.java", "HelloWorld8.java"] } Export { Depends { name: "java" } java.manifestClassPath: [exportingProduct.targetName + ".jar"] } } JavaJarFile { name: "random_stuff" files: ["RandomStuff.java"] qbs.installPrefix: "" Group { fileTagsFilter: ["java.jar"] qbs.install: true } Export { Depends { name: "java" } java.manifestClassPath: [exportingProduct.targetName + ".jar"] } } JavaJarFile { name: "car_jar" files: ["Car.java", "Vehicle.java"] Group { condition: Utilities.versionCompare(java.version, "1.8") >= 0 files: ["Car8.java"] } Export { Depends { name: "cpp" } cpp.systemIncludePaths: { var paths = importingProduct.java.jdkIncludePaths; if (Utilities.versionCompare(importingProduct.java.version, "1.8") >= 0) { paths.push(exportingProduct.buildDirectory); // generated JNI headers } return paths; } Depends { name: "java" } java.manifestClassPath: [exportingProduct.targetName + ".jar"] } qbs.installPrefix: "" Group { fileTagsFilter: ["java.jar"] qbs.install: true } } JavaJarFile { Depends { name: "random_stuff" } Depends { name: "car_jar" } Depends { name: "native" } name: "jar_file" entryPoint: "Vehicles" files: ["Jet.java", "Ship.java", "Vehicles.java", "Manifest.mf", "Manifest2.mf"] java.manifest: { var mf = original; mf["Extra-Property"] = "Crazy-Value"; return mf; } qbs.installPrefix: "" Group { fileTagsFilter: ["java.jar"] qbs.install: true } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/Car8.java0000644000175100017510000000107215154533055023512 0ustar runnerrunnerclass Car8 implements Vehicle { private InternalCombustionEngine engine; public Car8() { engine = new InternalCombustionEngine(); } public void go() { System.out.println("Driving!"); engine.run(); } public class InternalCombustionEngine { public native void run(); public class ChemicalReaction { public native void occur(); public class Atoms { @java.lang.annotation.Native public int hydrogenAtomCount; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/Vehicles.java0000644000175100017510000000142315154533055024457 0ustar runnerrunnerimport java.util.ArrayList; import glob.RandomStuff; class Vehicles { public static void main(String[] args) { System.loadLibrary("native"); RandomStuff.bar(); ArrayList vehicles = new ArrayList(); for (int i = 0; i < 3; i++) { vehicles.add(new Car()); } for (int i = 0; i < 3; i++) { vehicles.add(new Jet()); } for (int i = 0; i < 4; i++) { Ship ship = new Ship(); ship.isInSpace = i % 2 == 0; vehicles.add(ship); } for (int i = 0; i < vehicles.size(); i++) { vehicles.get(i).go(); } // doesn't compile, must be a bug // delete vehicles; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/inner-class/0000755000175100017510000000000015154533055024270 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/inner-class/inner-class.qbs0000644000175100017510000000005115154533055027211 0ustar runnerrunnerJavaJarFile { files: ["**/*.java"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/inner-class/InnerClass.java0000644000175100017510000000021015154533055027165 0ustar runnerrunnerpublic class InnerClass { private final InnerInnerClass clazz = new InnerInnerClass(); private class InnerInnerClass { } } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/Manifest.mf0000644000175100017510000000003215154533055024137 0ustar runnerrunnerSome-Property: Some-Value qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/Car.java0000644000175100017510000000065515154533055023430 0ustar runnerrunnerclass Car implements Vehicle { private InternalCombustionEngine engine; public Car() { engine = new InternalCombustionEngine(); } public void go() { System.out.println("Driving!"); engine.run(); } public class InternalCombustionEngine { public native void run(); public class ChemicalReaction { public native void occur(); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/Ship.java0000644000175100017510000000036415154533055023623 0ustar runnerrunnerclass Ship implements Vehicle { public boolean isInSpace; public void go() { if (isInSpace) System.out.println("Flying (this is a space ship)!"); else System.out.println("Sailing!"); } } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/engine.c0000644000175100017510000000305215154533055023463 0ustar runnerrunner/**************************************************************************** ** ** 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 // javac 1.8 is required to generate native headers #ifdef JNI_VERSION_1_8 #include "Car_InternalCombustionEngine.h" #endif JNIEXPORT void JNICALL Java_Car_00024InternalCombustionEngine_run(JNIEnv *env, jobject obj) { printf("Native code performing complex internal combustion process (%p, %p)!\n", env, obj); } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/Manifest2.mf0000644000175100017510000000010015154533055024215 0ustar runnerrunnerSome-Property: Some-Value Additional-Property: Additional-Value qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/RandomStuff.java0000644000175100017510000000012115154533055025137 0ustar runnerrunnerpackage glob; public class RandomStuff { public static void bar() { } } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/HelloWorld8.java0000644000175100017510000000024115154533055025055 0ustar runnerrunnerpackage io.qt.qbs; public class HelloWorld8 { public class Other { @java.lang.annotation.Native public final int countOfThings = 0; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/Jet.java0000644000175100017510000000015115154533055023434 0ustar runnerrunnerclass Jet implements Vehicle { public void go() { System.out.println("Flying!"); } } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/NoPackage.java0000644000175100017510000000014615154533055024546 0ustar runnerrunner// package this.should.not.be.parsed; public class NoPackage { public static void doSomething() {} } qbs-src-3.2.0/tests/auto/blackbox/testdata-java/java/Vehicle.java0000644000175100017510000000005415154533055024273 0ustar runnerrunnerinterface Vehicle { public void go(); } qbs-src-3.2.0/tests/auto/blackbox/blackbox-tutorial.qbs0000644000175100017510000000101115154533055022527 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "blackbox-tutorial" Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { name: "testdata" prefix: "../../../tutorial/" files: ["**/*"] fileTags: [] } files: [ "../shared.h", "tst_blackboxtutorial.cpp", "tst_blackboxtutorial.h", "tst_blackboxbase.cpp", "tst_blackboxbase.h", ] cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)]) } qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxbase.h0000644000175100017510000000706415154533055022073 0ustar runnerrunner/**************************************************************************** ** ** 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 TST_BLACKBOXBASE_H #define TST_BLACKBOXBASE_H #include "../shared.h" #include #include #include class QbsRunParameters { public: QbsRunParameters() { init(); } QbsRunParameters(QString cmd, QStringList args = QStringList()) : command(std::move(cmd)), arguments(std::move(args)) { init(); } QbsRunParameters(QStringList args) : arguments(std::move(args)) { init(); } void init() { expectFailure = false; expectCrash = false; profile = profileName(); settingsDir = settings()->baseDirectory(); environment = defaultEnvironment(); } static QProcessEnvironment defaultEnvironment() { auto result = QProcessEnvironment::systemEnvironment(); result.insert(QStringLiteral("QBS_AUTOTEST_CODE_SIGNING_REQUIRED"), QStringLiteral("0")); return result; } QString command; QStringList arguments; QString buildDirectory; QProcessEnvironment environment; QString profile; QString settingsDir; QString workingDir; bool expectFailure = false; bool expectCrash = false; }; class TestBlackboxBase : public QObject { Q_OBJECT public: TestBlackboxBase(const QString &testDataSrcDir, const QString &testName); public slots: virtual void initTestCase(); static QString findExecutable(const QStringList &fileNames); protected: virtual void validateTestProfile(); void setNeedsQt() { m_needsQt = true; } int runQbs(const QbsRunParameters ¶ms = QbsRunParameters()); void rmDirR(const QString &dir); static QByteArray unifiedLineEndings(const QByteArray &ba); static void sanitizeOutput(QByteArray *ba); static void ccp(const QString &sourceDirPath, const QString &targetDirPath); QMap findJdkTools(int *status); static qbs::Version qmakeVersion(const QString &qmakeFilePath); static qbs::Version conanVersion(const QString &conanFilePath); const QString testDataDir; const QString testSourceDir; const QString qbsExecutableFilePath; const QString defaultInstallRoot; QByteArray m_qbsStderr; QByteArray m_qbsStdout; int m_needsQt = false; }; bool waitForProcessSuccess(QProcess &p, int msecs = 30000); #endif // TST_BLACKBOXBASE_H qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxqt.h0000644000175100017510000000557715154533055021614 0ustar runnerrunner/**************************************************************************** ** ** 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 TST_BLACKBOXQT_H #define TST_BLACKBOXQT_H #include "tst_blackboxbase.h" #include class TestBlackboxQt : public TestBlackboxBase { Q_OBJECT public: TestBlackboxQt(); private: std::optional findShaderTools(bool *hasViewCount = nullptr); private slots: void addQObjectMacroToGeneratedCppFile(); void autoQrc(); void cachedQml(); void combinedMoc(); void createProject(); void dbusAdaptors(); void dbusInterfaces(); void emscriptenHtml(); void forcedMoc(); void includedMocCpp(); void linkerVariant(); void lrelease(); void lupdate(); void metaTypes_data(); void metaTypes(); void mixedBuildVariants(); void mocAndCppCombining(); void mocChangeTracking(); void mocFlags(); void mocCompilerDefines(); void mocSameFileName(); void noMocRunAfterTouchingOtherCppFile(); void noRelinkOnQDebug(); void noRelinkOnQDebug_data(); void pkgconfig(); void pkgconfigQt(); void pkgconfigQt_data(); void pkgconfigNoQt(); void pluginMetaData(); void pluginSupport_data(); void pluginSupport(); void qdoc(); void qmlDebugging(); void qobjectInObjectiveCpp(); void qmlTypeRegistrar_data(); void qmlTypeRegistrar(); void qtKeywords(); void quickCompiler(); void qtScxml(); void qtXml(); void removeMocHeaderFromFileList(); void shadertools(); void shadertools_data(); void shadertoolsLinking(); void shadertoolsLinking_data(); void staticQtPluginLinking(); void trackAddMocInclude(); void track_qobject_change(); void track_qrc(); void unmocable(); }; #endif // TST_BLACKBOXQT_H qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxapple.cpp0000644000175100017510000017051415154533055022616 0ustar runnerrunner/**************************************************************************** ** ** 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 "tst_blackboxapple.h" #include "../shared.h" #include #include #include #include #include #include #include #include #include #include #define WAIT_FOR_NEW_TIMESTAMP() waitForNewTimestamp(testDataDir) using qbs::Internal::HostOsInfo; using qbs::Profile; class QFileInfo2 : public QFileInfo { public: QFileInfo2(const QString &path) : QFileInfo(path) { } bool isRegularFile() const { return isFile() && !isSymLink(); } bool isRegularDir() const { return isDir() && !isSymLink(); } bool isFileSymLink() const { return isFile() && isSymLink(); } bool isDirSymLink() const { return isDir() && isSymLink(); } }; static QString getEmbeddedBinaryPlist(const QString &file) { QProcess p; p.start("otool", QStringList() << "-v" << "-X" << "-s" << "__TEXT" << "__info_plist" << file); p.waitForFinished(); return QString::fromUtf8(p.readAllStandardOutput()).trimmed(); } static QVariantMap readInfoPlistFile(const QString &infoPlistPath) { if (!QFile::exists(infoPlistPath)) { qWarning() << infoPlistPath << "doesn't exist"; return {}; } QProcess plutil; plutil.start("plutil", { QStringLiteral("-convert"), QStringLiteral("json"), infoPlistPath }); if (!plutil.waitForStarted()) { qWarning() << plutil.errorString(); return {}; } if (!plutil.waitForFinished()) { qWarning() << plutil.errorString(); return {}; } if (plutil.exitCode() != 0) { qWarning() << plutil.readAllStandardError().constData(); return {}; } QFile infoPlist(infoPlistPath); if (!infoPlist.open(QIODevice::ReadOnly)) { qWarning() << infoPlist.errorString(); return {}; } QJsonParseError error; const auto json = QJsonDocument::fromJson(infoPlist.readAll(), &error); if (error.error != QJsonParseError::NoError) { qWarning() << error.errorString(); return {}; } return json.object().toVariantMap(); } static QString getInfoPlistPath(const QString &bundlePath) { QFileInfo contents(bundlePath + "/Contents"); if (contents.exists() && contents.isDir()) return contents.filePath() + "/Info.plist"; // macOS bundle return bundlePath + "/Info.plist"; } static QString getPrivacyManifestPath(const QString &bundlePath) { QFileInfo resources(bundlePath + "/Resources"); if (resources.exists()) return resources.filePath() + "/PrivacyInfo.xcprivacy"; // macOS bundle return bundlePath + "/PrivacyInfo.xcprivacy"; } static bool testVariantListType(const QVariant &variant, QMetaType::Type type) { if (variant.userType() != QMetaType::QVariantList) return false; for (const auto &value : variant.toList()) { if (value.userType() != type) return false; } return true; } static QString findFatLibrary(const QString &dir, const QString &libraryName) { QDirIterator it(dir, {}, QDir::AllEntries, QDirIterator::Subdirectories); while (it.hasNext()) { it.next(); if (it.fileInfo().fileName() == libraryName) { QProcess lipo; lipo.start("lipo", { QStringLiteral("-info"), it.filePath() }); if (!lipo.waitForStarted() || !lipo.waitForFinished() || lipo.exitCode() != 0) return {}; auto output = lipo.readAllStandardOutput(); if (output.contains(QByteArrayLiteral("Architectures in the fat file"))) return QDir::cleanPath(it.filePath()); } } return {}; } enum class CodeSignResult { Failed = 0, Signed, Unsigned }; using CodeSignData = QMap; static std::pair parseCodeSignOutput(const QByteArray &output) { CodeSignData data; if (output.contains("code object is not signed at all")) return {CodeSignResult::Unsigned, data}; const auto lines = output.split('\n'); for (const auto &line: lines) { if (line.isEmpty() || line.startsWith("CodeDirectory") || line.startsWith("Sealed Resources") || line.startsWith("Internal requirements")) { continue; } const int index = line.indexOf('='); if (index == -1) return {CodeSignResult::Failed, {}}; data[line.mid(0, index)] = line.mid(index + 1); } return {CodeSignResult::Signed, data}; } static std::pair getCodeSignInfo(const QString &path) { QProcess codesign; codesign.start("codesign", { QStringLiteral("-dv"), path }); if (!codesign.waitForStarted() || !codesign.waitForFinished()) return {CodeSignResult::Failed, {}}; const auto output = codesign.readAllStandardError(); return parseCodeSignOutput(output); } TestBlackboxApple::TestBlackboxApple() : TestBlackboxBase (SRCDIR "/testdata-apple", "blackbox-apple") { } void TestBlackboxApple::initTestCase() { if (!HostOsInfo::isMacosHost()) { QSKIP("only applies on macOS"); return; } TestBlackboxBase::initTestCase(); } void TestBlackboxApple::appleMultiConfig() { const auto xcodeVersion = findXcodeVersion(); if (!xcodeVersion) QSKIP("requires Xcode profile"); QDir::setCurrent(testDataDir + "/apple-multiconfig"); QCOMPARE(runQbs(QbsRunParameters(QStringList{ "qbs.installPrefix:''", QStringLiteral("project.xcodeVersion:") + xcodeVersion->toString()})), 0); if (m_qbsStdout.contains("isShallow: false")) { QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/MacOS/singleapp").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/Info.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Contents/PkgInfo").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/MacOS/singleapp_agg").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/Info.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Contents/PkgInfo").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/singlelib").isFileSymLink()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Resources").isDirSymLink()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions").isRegularDir()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A").isRegularDir()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/singlelib").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/Resources").isRegularDir()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/A/Resources/Info.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Versions/Current").isDirSymLink()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/MacOS/multiapp").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/Info.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Contents/PkgInfo").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/MacOS/fatmultiapp").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/Info.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Contents/PkgInfo").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/MacOS/" "fatmultiappmultivariant").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/MacOS/" "fatmultiappmultivariant_debug").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/MacOS/" "fatmultiappmultivariant_profiling").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/Info.plist") .isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Contents/PkgInfo") .isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/multilib").isFileSymLink()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Resources").isDirSymLink()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions").isRegularDir()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A").isRegularDir()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib_debug").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/multilib_profiling").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/Resources").isRegularDir()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/A/Resources/Info.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Versions/Current").isDirSymLink()); for (const QString variant : { "release", "debug", "profiling" }) { const QString arch = HostOsInfo::hostOSArchitecture() == "arm64" ? "arm64" : "x86_64"; for (const QString &arch : {arch}) { QProcess process; process.setProgram("/usr/bin/arch"); process.setArguments({ "-arch", arch, "-e", "DYLD_IMAGE_SUFFIX=_" + variant, defaultInstallRoot + "/multiapp.app/Contents/MacOS/multiapp" }); process.start(); process.waitForFinished(); QCOMPARE(process.exitCode(), 0); const auto processStdout = process.readAllStandardOutput(); QVERIFY2(processStdout.contains("Hello from " + variant.toUtf8() + " " + arch.toUtf8()), processStdout.constData()); } } } else if (m_qbsStdout.contains("isShallow: true")) { QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/singleapp").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/Info.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp.app/PkgInfo").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/singleapp_agg").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/Info.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singleapp_agg.app/PkgInfo").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/singlelib").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/singlelib.framework/Info.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/multiapp").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/Info.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multiapp.app/PkgInfo").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/fatmultiapp").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/Info.plist").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiapp.app/PkgInfo").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/" "fatmultiappmultivariant").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/" "fatmultiappmultivariant_debug").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/" "fatmultiappmultivariant_profiling").isExecutable()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/Info.plist") .isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/fatmultiappmultivariant.app/PkgInfo") .isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/multilib").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/multilib_debug").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/multilib_profiling").isRegularFile()); QVERIFY(QFileInfo2(defaultInstallRoot + "/multilib.framework/Info.plist").isRegularFile()); } else { QVERIFY2(false, qPrintable(m_qbsStdout)); } } void TestBlackboxApple::aggregateDependencyLinking() { const auto xcodeVersion = findXcodeVersion(); if (!xcodeVersion) QSKIP("requires Xcode profile"); // XCode 11 produces warning about deprecation of 32-bit apps, but still works const bool hasX86Mac = xcodeVersion < qbs::Version(12); const bool hasArmMac = xcodeVersion >= qbs::Version(12, 2); QDir::setCurrent(testDataDir + "/aggregateDependencyLinking"); QbsRunParameters params{QStringList{"-p", "multi_arch_lib"}}; params.arguments << QStringLiteral("products.multi_arch_lib.hasX86Mac:%1").arg(hasX86Mac); params.arguments << QStringLiteral("products.multi_arch_lib.hasArmMac:%1").arg(hasArmMac); QCOMPARE(runQbs(params), 0); if (m_qbsStdout.contains("Cannot build fat binaries")) QSKIP("Building fat binaries is not supported for this profile"); QCOMPARE(runQbs(QStringList{"-p", "just_app", "--command-echo-mode", "command-line"}), 0); int linkedInLibrariesCount = QString::fromUtf8(m_qbsStdout).count(QStringLiteral("libmulti_arch_lib.a")); QCOMPARE(linkedInLibrariesCount, 1); const auto fatLibPath = findFatLibrary(testDataDir, QStringLiteral("libmulti_arch_lib.a")); QVERIFY(!fatLibPath.isEmpty()); QVERIFY2(QString::fromUtf8(m_qbsStdout).contains(fatLibPath), m_qbsStdout); } void TestBlackboxApple::appiconset() { QDir::setCurrent(testDataDir + QLatin1String("/ib/appiconset")); QbsRunParameters params; params.arguments = QStringList() << "-f" << "appiconset.qbs"; QCOMPARE(runQbs(params), 0); const auto infoPlistPath = getInfoPlistPath( relativeProductBuildDir("appiconset") + "/appiconset.app"); QVERIFY(QFile::exists(infoPlistPath)); const auto content = readInfoPlistFile(infoPlistPath); QVERIFY(!content.isEmpty()); if (m_qbsStdout.contains("bundle.isShallow: false")) { QCOMPARE(content.value(QStringLiteral("CFBundleIconFile")), QStringLiteral("AppIcon")); QCOMPARE(content.value(QStringLiteral("CFBundleIconName")), QStringLiteral("AppIcon")); QVERIFY(regularFileExists(relativeProductBuildDir("appiconset") + "/appiconset.app/Contents/Resources/AppIcon.icns")); } else if (m_qbsStdout.contains("bundle.isShallow: true")) { const auto icons = content.value(QStringLiteral("CFBundleIcons")).toMap(); QVERIFY2(!icons.isEmpty(), "Info.plist doesn't contain CFBundleIcons key"); const auto primaryIcon = icons.value(QStringLiteral("CFBundlePrimaryIcon")).toMap(); QVERIFY2(!primaryIcon.isEmpty(), "Info.plist doesn't contain CFBundlePrimaryIcon key"); QCOMPARE(primaryIcon.value(QStringLiteral("CFBundleIconName")), QStringLiteral("AppIcon")); } else { QVERIFY2(false, "Cannot determine bundle type"); } } void TestBlackboxApple::iconcomposer() { const auto xcodeVersion = findXcodeVersion(); if (!xcodeVersion || *xcodeVersion < qbs::Version(26)) QSKIP("Icon Composer .icon format requires Xcode 26 or newer"); QDir::setCurrent(testDataDir + QLatin1String("/ib/iconcomposer")); const QString iconPath = QDir::currentPath() + "/AppIcon.icon"; QDir iconDir(iconPath); if (!iconDir.exists() || iconDir.entryList(QDir::Files | QDir::NoDotAndDotDot).isEmpty() || (iconDir.entryList(QDir::Files | QDir::NoDotAndDotDot).size() == 1 && iconDir.exists("README.txt"))) { QSKIP("This test requires a valid AppIcon.icon file created with Icon Composer. " "Replace the placeholder with a real .icon bundle to run this test."); } QbsRunParameters params; params.arguments = QStringList() << "-f" << "iconcomposer.qbs"; QCOMPARE(runQbs(params), 0); const auto infoPlistPath = getInfoPlistPath( relativeProductBuildDir("iconcomposer") + "/iconcomposer.app"); QVERIFY(QFile::exists(infoPlistPath)); const auto content = readInfoPlistFile(infoPlistPath); QVERIFY(!content.isEmpty()); const bool isShallow = m_qbsStdout.contains("bundle.isShallow: true"); const bool isDeep = m_qbsStdout.contains("bundle.isShallow: false"); QVERIFY2(isShallow || isDeep, "Cannot determine bundle type"); if (isDeep) { QCOMPARE(content.value(QStringLiteral("CFBundleIconFile")), QStringLiteral("AppIcon")); QCOMPARE(content.value(QStringLiteral("CFBundleIconName")), QStringLiteral("AppIcon")); } else if (isShallow) { const auto icons = content.value(QStringLiteral("CFBundleIcons")).toMap(); QVERIFY2(!icons.isEmpty(), "Info.plist doesn't contain CFBundleIcons key"); const auto primaryIcon = icons.value(QStringLiteral("CFBundlePrimaryIcon")).toMap(); QVERIFY2(!primaryIcon.isEmpty(), "Info.plist doesn't contain CFBundlePrimaryIcon key"); QCOMPARE(primaryIcon.value(QStringLiteral("CFBundleIconName")), QStringLiteral("AppIcon")); } } void TestBlackboxApple::assetCatalog() { QFETCH(bool, flatten); QDir::setCurrent(testDataDir + QLatin1String("/ib/assetcatalog")); rmDirR(relativeBuildDir()); if (!findXcode()) QSKIP("requires Xcode profile"); QbsRunParameters params; const QString flattens = "modules.ib.flatten:" + QString(flatten ? "true" : "false"); const QString macosTarget = "modules.cpp.minimumMacosVersion:'10.15'"; // Make sure a dry run does not write anything params.arguments = QStringList() << "-f" << "assetcatalogempty.qbs" << "--dry-run" << flattens << macosTarget; QCOMPARE(runQbs(params), 0); QVERIFY(!directoryExists(relativeBuildDir())); if (m_qbsStdout.contains("Skip this test")) QSKIP("Skip this test"); params.arguments = QStringList() << "-f" << "assetcatalogempty.qbs" << flattens << macosTarget; QCOMPARE(runQbs(params), 0); // empty asset catalogs must still produce output QVERIFY((bool)m_qbsStdout.contains("compiling empty.xcassets")); // empty asset catalogs must still produce output QVERIFY((bool)m_qbsStdout.contains("compiling empty.xcassets")); QVERIFY(regularFileExists(relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/Assets.car")); // this asset catalog happens to have an embedded icon set, // but this should NOT be built since it is not in the files list QVERIFY(!(bool)m_qbsStdout.contains(".iconset")); // now we'll add the iconset rmDirR(relativeBuildDir()); params.arguments.push_back("project.includeIconset:true"); QCOMPARE(runQbs(params), 0); QVERIFY(!(bool)m_qbsStdout.contains("compiling empty.xcassets")); QVERIFY((bool)m_qbsStdout.contains("compiling empty.iconset")); // make sure the nibs/storyboards are in there QString nib = relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/MainMenu.nib"; QStringList nibFiles; if (flatten) { QVERIFY(regularFileExists(nib)); } else { QVERIFY(directoryExists(nib)); nibFiles = QStringList() << "designable.nib" << "keyedobjects.nib"; } QString storyboardc = relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/Storyboard.storyboardc"; QStringList storyboardcFiles; if (HostOsInfo::hostOsVersion() >= qbs::Version(10, 10)) { QVERIFY(directoryExists(storyboardc)); storyboardcFiles = QStringList() << "1os-k8-h10-view-qKA-a5-eUe.nib" << "Info.plist" << "Iqk-Fi-Vhk-view-HRv-3O-Qxh.nib" << "Main.nib" << "NSViewController-Iqk-Fi-Vhk.nib" << "NSViewController-Yem-rc-72E.nib" << "Yem-rc-72E-view-ODp-aO-Dmf.nib"; if (!flatten) { storyboardcFiles << "designable.storyboard"; storyboardcFiles.sort(); } } QCOMPARE(QDir(nib).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), nibFiles); QCOMPARE(QDir(storyboardc).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), storyboardcFiles); QCOMPARE(runQbs(QbsRunParameters("clean")), 0); QCOMPARE(QDir(nib).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), QStringList()); QCOMPARE(QDir(storyboardc).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), QStringList()); } void TestBlackboxApple::assetCatalog_data() { QTest::addColumn("flatten"); QTest::newRow("flattened") << true; QTest::newRow("unflattened") << false; } void TestBlackboxApple::assetCatalogsEmpty() { if (findXcodeVersion() < qbs::Version(5)) QSKIP("requires Xcode 5 or above"); QDir::setCurrent(testDataDir + QLatin1String("/ib/empty-asset-catalogs")); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("compiling assetcatalog1.xcassets"), m_qbsStdout); QVERIFY2(!m_qbsStdout.contains("compiling assetcatalog2.xcassets"), m_qbsStdout); } void TestBlackboxApple::assetCatalogsMultiple() { if (findXcodeVersion() < qbs::Version(5)) QSKIP("requires Xcode 5 or above"); QDir::setCurrent(testDataDir + QLatin1String("/ib/multiple-asset-catalogs")); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling assetcatalog1.xcassets"), m_qbsStdout); QVERIFY2(m_qbsStdout.contains("compiling assetcatalog2.xcassets"), m_qbsStdout); } void TestBlackboxApple::bundleStructure() { QFETCH(QString, productName); QFETCH(QString, productTypeIdentifier); QDir::setCurrent(testDataDir + "/bundle-structure"); QbsRunParameters params(QStringList{"qbs.installPrefix:''"}); params.arguments << "project.buildableProducts:" + productName; if (productName == "ABadApple" || productName == "ABadThirdParty") params.expectFailure = true; rmDirR(relativeBuildDir()); const int status = runQbs(params); if (status != 0) { QVERIFY2( m_qbsStderr.contains( "Bundle product type " + productTypeIdentifier.toLatin1() + " is not supported."), m_qbsStderr.constData()); return; } QCOMPARE(status, 0); const bool enableCodeSigning = m_qbsStdout.contains("enableCodeSigning: true"); const bool isShallow = m_qbsStdout.contains("bundle.isShallow: true"); QString expectedStructureFile; if (!isShallow) { QVERIFY2(enableCodeSigning, m_qbsStdout); expectedStructureFile = "deep.json"; } else { expectedStructureFile = enableCodeSigning ? "shallow-signed.json" : "shallow-unsigned.json"; } const QString expectedStructurePath = testDataDir + "/bundle-structure/" + expectedStructureFile; QFile structureFile(expectedStructurePath); QVERIFY2( structureFile.open(QIODevice::ReadOnly), qPrintable(QString("Could not open %1").arg(expectedStructurePath))); QJsonParseError parseError; const auto expectedStructure = QJsonDocument::fromJson(structureFile.readAll(), &parseError); QVERIFY2(parseError.error == QJsonParseError::NoError, qPrintable(parseError.errorString())); const auto allProducts = expectedStructure.object(); QVERIFY2( allProducts.contains(productName), qPrintable(QString("Product %1 not found in %2").arg(productName, expectedStructureFile))); const auto productStructure = allProducts.value(productName).toObject(); const QString bundleExtension = productStructure.value("extension").toString(); const QString bundlePath = defaultInstallRoot + "/" + productName + bundleExtension; std::unordered_set expectedPaths; // Check directories const auto directories = productStructure.value("directories").toArray(); for (const auto &dir : directories) { const QString dirPath = bundlePath + "/" + dir.toString(); expectedPaths.insert(dirPath); QVERIFY2( QFileInfo2(dirPath).isRegularDir(), qPrintable(QString("Directory does not exist: %1").arg(dirPath))); } // Check files const auto files = productStructure.value("files").toArray(); for (const auto &file : files) { const QString filePath = bundlePath + "/" + file.toString(); expectedPaths.insert(filePath); QVERIFY2( QFileInfo2(filePath).isRegularFile(), qPrintable(QString("File does not exist: %1").arg(filePath))); } // Check symlinks const auto symlinks = productStructure.value("symlinks").toArray(); for (const auto &symlink : symlinks) { const QString symlinkPath = bundlePath + "/" + symlink.toString(); expectedPaths.insert(symlinkPath); QVERIFY2( QFileInfo2(symlinkPath).isSymLink(), qPrintable(QString("Symlink does not exist: %1").arg(symlinkPath))); } // Check that there are no extra entries beyond what's expected QDirIterator it( bundlePath, QDir::AllEntries | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); while (it.hasNext()) { const QString absolutePath = it.next(); const QString relativePath = QDir(bundlePath).relativeFilePath(absolutePath); QVERIFY2( expectedPaths.count(absolutePath) != 0, qPrintable(QString("Unexpected file/directory found in bundle: %1").arg(relativePath))); } } void TestBlackboxApple::bundleStructure_data() { QTest::addColumn("productName"); QTest::addColumn("productTypeIdentifier"); QTest::newRow("A") << "A" << "com.apple.product-type.application"; QTest::newRow("ABadApple") << "ABadApple" << "com.apple.product-type.will.never.exist.ever.guaranteed"; QTest::newRow("ABadThirdParty") << "ABadThirdParty" << "org.special.third.party.non.existent.product.type"; QTest::newRow("B") << "B" << "com.apple.product-type.framework"; QTest::newRow("C") << "C" << "com.apple.product-type.framework.static"; QTest::newRow("D") << "D" << "com.apple.product-type.bundle"; QTest::newRow("E") << "E" << "com.apple.product-type.app-extension"; QTest::newRow("F") << "F" << "com.apple.product-type.xpc-service"; QTest::newRow("G") << "G" << "com.apple.product-type.in-app-purchase-content"; } void TestBlackboxApple::mainBundle() { QFETCH(bool, multiplexArchitectures); QFETCH(bool, multiplexBuildVariants); QDir::setCurrent(testDataDir + "/main-bundle"); QbsRunParameters params(QStringList{"qbs.installPrefix:''"}); const auto xcodeVersion = findXcodeVersion(); if (!xcodeVersion) QSKIP("requires Xcode profile"); params.arguments << "project.xcodeVersion:" + xcodeVersion->toString(); if (multiplexArchitectures) params.arguments << "project.multiplexArchitectures:true"; if (multiplexBuildVariants) params.arguments << "project.multiplexBuildVariants:true"; rmDirR(relativeBuildDir()); const int status = runQbs(params); QCOMPARE(status, 0); const bool enableCodeSigning = m_qbsStdout.contains("enableCodeSigning: true"); const bool isShallow = m_qbsStdout.contains("bundle.isShallow: true"); QString expectedStructureFile; if (!isShallow) { QVERIFY2(enableCodeSigning, m_qbsStdout); expectedStructureFile = "deep.json"; } else { expectedStructureFile = enableCodeSigning ? "shallow-signed.json" : "shallow-unsigned.json"; } const QString expectedStructurePath = testDataDir + "/main-bundle/" + expectedStructureFile; QFile structureFile(expectedStructurePath); QVERIFY2( structureFile.open(QIODevice::ReadOnly), qPrintable(QString("Could not open %1").arg(expectedStructurePath))); QJsonParseError parseError; const auto expectedStructure = QJsonDocument::fromJson(structureFile.readAll(), &parseError); QVERIFY2(parseError.error == QJsonParseError::NoError, qPrintable(parseError.errorString())); const auto structure = expectedStructure.object(); const QString appPath = defaultInstallRoot + "/MainApp.app"; std::unordered_set expectedPaths; // Check directories const auto directories = structure.value("directories").toArray(); for (const auto &dir : directories) { const QString dirPath = appPath + "/" + dir.toString(); expectedPaths.insert(dirPath); QVERIFY2( QFileInfo2(dirPath).isRegularDir(), qPrintable(QString("Directory does not exist: %1").arg(dirPath))); } // Check files const auto files = structure.value("files").toArray(); for (const auto &file : files) { const QString filePath = appPath + "/" + file.toString(); expectedPaths.insert(filePath); QVERIFY2( QFileInfo2(filePath).isRegularFile(), qPrintable(QString("File does not exist: %1").arg(filePath))); } // Check symlinks const auto symlinks = structure.value("symlinks").toArray(); for (const auto &symlink : symlinks) { const QString symlinkPath = appPath + "/" + symlink.toString(); expectedPaths.insert(symlinkPath); QVERIFY2( QFileInfo2(symlinkPath).isSymLink(), qPrintable(QString("Symlink does not exist: %1").arg(symlinkPath))); } // Check that there are no extra entries beyond what's expected QDirIterator it(appPath, QDir::AllEntries | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); while (it.hasNext()) { const QString absolutePath = it.next(); const QString relativePath = QDir(appPath).relativeFilePath(absolutePath); // skip debug build variants manually if (multiplexBuildVariants && QFileInfo(absolutePath).baseName().endsWith("_debug")) continue; QVERIFY2( expectedPaths.count(absolutePath) != 0, qPrintable(QString("Unexpected file/directory found in bundle: %1").arg(relativePath))); } } void TestBlackboxApple::mainBundle_data() { QTest::addColumn("multiplexArchitectures"); QTest::addColumn("multiplexBuildVariants"); QTest::newRow("no multiplexing") << false << false; QTest::newRow("multiplex architectures") << true << false; QTest::newRow("multiplex build variants") << false << true; QTest::newRow("multiplex architectures and build variants") << true << true; } void TestBlackboxApple::byteArrayInfoPlist() { QDir::setCurrent(testDataDir + "/byteArrayInfoPlist"); QCOMPARE(runQbs(), 0); const auto infoPlistPath = getInfoPlistPath( relativeProductBuildDir("byteArrayInfoPlist") + "/byteArrayInfoPlist.app"); QVERIFY(QFile::exists(infoPlistPath)); const auto outFilePath = relativeProductBuildDir("byteArrayInfoPlist") + "/bytearrayInfoPlist-Info.plist.out"; QFile file(outFilePath); QVERIFY(file.exists()); QVERIFY(file.open(QIODevice::ReadOnly)); QCOMPARE(file.readAll(), "The data value"); } void TestBlackboxApple::codesign() { QFETCH(int, expectedCount); QFETCH(bool, isBundle); QFETCH(bool, enableSigning); QFETCH(bool, multiArch); QFETCH(bool, multiVariant); const auto xcode = findXcode(); if (!xcode) QSKIP("requires Xcode profile"); const auto xcodeVersion = qbs::Version::fromString(xcode->value("version").toString()); const bool isSigned = xcode->value("isSignedByDefault").toBool() || enableSigning; QDir::setCurrent(testDataDir + "/codesign"); QbsRunParameters params(QStringList{"qbs.installPrefix:''"}); // the test can't use xcode module to determine version itself params.arguments << QStringLiteral("project.xcodeVersion:") + xcodeVersion.toString(); params.arguments << QStringLiteral("project.isBundle:%1").arg(isBundle ? "true" : "false"); params.arguments << QStringLiteral("project.enableSigning:%1") .arg(enableSigning ? "true" : "false"); params.arguments << QStringLiteral("project.multiArch:%1").arg(multiArch ? "true" : "false"); params.arguments << QStringLiteral("project.multiVariant:%1") .arg(multiVariant ? "true" : "false"); rmDirR(relativeBuildDir()); QCOMPARE(runQbs(params), 0); const int codeSignCount = QString::fromUtf8(m_qbsStdout).count(QStringLiteral("codesign ")); QCOMPARE(codeSignCount, expectedCount); const auto appName = isBundle ? QStringLiteral("A.app") : QStringLiteral("A"); const auto appPath = defaultInstallRoot + "/" + appName; QVERIFY(QFileInfo(appPath).exists()); auto codeSignInfo = getCodeSignInfo(appPath); QVERIFY(codeSignInfo.first != CodeSignResult::Failed); QCOMPARE(codeSignInfo.first == CodeSignResult::Signed, isSigned); QCOMPARE(codeSignInfo.second.isEmpty(), !isSigned); if (!codeSignInfo.second.isEmpty()) { QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Executable"))); QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Identifier"))); QCOMPARE(codeSignInfo.second.value(QByteArrayLiteral("Signature")), "adhoc"); } 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); QVERIFY(codeSignInfo.first != CodeSignResult::Failed); QCOMPARE(codeSignInfo.first == CodeSignResult::Signed, isSigned); QCOMPARE(codeSignInfo.second.isEmpty(), !isSigned); if (!codeSignInfo.second.isEmpty()) { QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Executable"))); QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Identifier"))); QCOMPARE(codeSignInfo.second.value(QByteArrayLiteral("Signature")), "adhoc"); } const auto pluginPath = defaultInstallRoot + "/" + QStringLiteral("C.bundle"); QVERIFY(QFileInfo(pluginPath).exists()); QVERIFY(QFileInfo(pluginPath).isDir() == isBundle); codeSignInfo = getCodeSignInfo(pluginPath); QVERIFY(codeSignInfo.first != CodeSignResult::Failed); QCOMPARE(codeSignInfo.first == CodeSignResult::Signed, isSigned); QCOMPARE(codeSignInfo.second.isEmpty(), !isSigned); if (!codeSignInfo.second.isEmpty()) { QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Executable"))); QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Identifier"))); QCOMPARE(codeSignInfo.second.value(QByteArrayLiteral("Signature")), "adhoc"); } const auto staticLibName = isBundle ? QStringLiteral("D.framework") : QStringLiteral("libD.a"); const auto staticLibPath = defaultInstallRoot + "/" + staticLibName; QVERIFY(QFileInfo(staticLibPath).exists()); codeSignInfo = getCodeSignInfo(staticLibPath); QVERIFY(codeSignInfo.first != CodeSignResult::Failed); // static libraries are not signed by default so we check for enableSigning instead of isSigned QCOMPARE(codeSignInfo.first == CodeSignResult::Signed, enableSigning); QCOMPARE(codeSignInfo.second.isEmpty(), !enableSigning); if (!codeSignInfo.second.isEmpty()) { QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Executable"))); QVERIFY(codeSignInfo.second.contains(QByteArrayLiteral("Identifier"))); QCOMPARE(codeSignInfo.second.value(QByteArrayLiteral("Signature")), "adhoc"); } } void TestBlackboxApple::codesign_data() { QTest::addColumn("expectedCount"); QTest::addColumn("isBundle"); QTest::addColumn("enableSigning"); QTest::addColumn("multiArch"); QTest::addColumn("multiVariant"); QTest::newRow("standalone, unsigned") << 0 << false << false << false << false; QTest::newRow("bundle, unsigned") << 0 << true << false << false << false; QTest::newRow("standalone, signed") << 4 << false << true << false << false; QTest::newRow("bundle, signed") << 4 << true << true << false << false; // here we only sign the resulting lipo artifact QTest::newRow("standalone, signed, multiarch") << 4 << false << true << true << false; QTest::newRow("bundle, signed, multiarch") << 4 << true << true << true << false; // here we sign all artifacts QTest::newRow("standalone, signed, multivariant") << 8 << false << true << false << true; QTest::newRow("bundle, signed, multivariant") << 8 << true << true << false << true; QTest::newRow("standalone, signed, multiarch, multivariant") << 8 << false << true << true << true; QTest::newRow("bundle, signed, multiarch, multivariant") << 8 << true << true << true << true; } void TestBlackboxApple::codesignDestinationDirectory() { // checks that codesign does not break when destinationDirectory is set QDir::setCurrent(testDataDir + "/codesign-destination-directory"); QCOMPARE(runQbs(), 0); } void TestBlackboxApple::deploymentTarget() { QFETCH(QString, sdk); QFETCH(QString, os); QFETCH(QString, arch); QFETCH(QString, cflags); QFETCH(QString, lflags); QDir::setCurrent(testDataDir + "/deploymentTarget"); if (!findXcode()) QSKIP("requires Xcode profile"); QbsRunParameters params; params.arguments = QStringList() << "--command-echo-mode" << "command-line" << "modules.qbs.targetPlatform:" + os << "qbs.architectures:" + arch; rmDirR(relativeBuildDir()); int status = runQbs(params); const QStringList skippableMessages = QStringList() << "There is no matching SDK available for " + sdk + "." << "x86_64h will be mis-detected as x86_64 with Apple Clang < 6.0" << "clang: error: unknown argument: '-mtvos-version-min" << "clang: error: unknown argument: '-mtvos-simulator-version-min" << "clang: error: unknown argument: '-mwatchos-version-min" << "clang: error: unknown argument: '-mwatchos-simulator-version-min"; if (status != 0) { for (const auto &message : skippableMessages) { if (m_qbsStderr.contains(message.toUtf8())) QSKIP(message.toUtf8()); } } QCOMPARE(status, 0); QVERIFY2(m_qbsStderr.contains(cflags.toLatin1()), m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.contains(lflags.toLatin1()), m_qbsStderr.constData()); } void TestBlackboxApple::deploymentTarget_data() { static const QString macos = QStringLiteral("macos"); static const QString ios = QStringLiteral("ios"); static const QString ios_sim = QStringLiteral("ios-simulator"); static const QString tvos = QStringLiteral("tvos"); static const QString tvos_sim = QStringLiteral("tvos-simulator"); static const QString watchos = QStringLiteral("watchos"); static const QString watchos_sim = QStringLiteral("watchos-simulator"); QTest::addColumn("sdk"); QTest::addColumn("os"); QTest::addColumn("arch"); QTest::addColumn("cflags"); QTest::addColumn("lflags"); const auto xcodeVersion = findXcodeVersion(); QTest::newRow("macos arm64") << "macosx" << macos << "arm64" << "-triple arm64-apple-macosx11.0" << "-platform_version macos 11.0.0"; if (xcodeVersion < qbs::Version(10)) { QTest::newRow("macos x86") << "macosx" << macos << "x86" << "-triple i386-apple-macosx10.6" << "-macosx_version_min 10.6"; } QTest::newRow("macos x86_64") << "macosx" << macos << "x86_64" << "-triple x86_64-apple-macosx10.6" << "10.6"; if (xcodeVersion >= qbs::Version(6)) QTest::newRow("macos x86_64h") << "macosx" << macos << "x86_64h" << "-triple x86_64h-apple-macosx10.12" << "10.12"; if (xcodeVersion < qbs::Version(16)) { QTest::newRow("ios armv7a") << "iphoneos" << ios << "armv7a" << "-triple thumbv7-apple-ios6.0" << "6.0"; QTest::newRow("ios armv7s") << "iphoneos" << ios << "armv7s" << "-triple thumbv7s-apple-ios7.0" << "7.0"; } if (xcodeVersion >= qbs::Version(5)) QTest::newRow("ios arm64") << "iphoneos" << ios << "arm64" << "-triple arm64-apple-ios7.0" << "7.0"; if (xcodeVersion < qbs::Version(16)) { QTest::newRow("ios-simulator x86") << "iphonesimulator" << ios_sim << "x86" << "-triple i386-apple-ios6.0" << "6.0"; if (xcodeVersion >= qbs::Version(5)) QTest::newRow("ios-simulator x86_64") << "iphonesimulator" << ios_sim << "x86_64" << "-triple x86_64-apple-ios7.0" << "7.0"; } if (xcodeVersion >= qbs::Version(5)) QTest::newRow("ios-simulator arm64") << "iphonesimulator" << ios_sim << "arm64" << "-triple arm64-apple-ios7.0" << "7.0"; if (xcodeVersion >= qbs::Version(7)) { if (xcodeVersion >= qbs::Version(7, 1)) { QTest::newRow("tvos arm64") << "appletvos" << tvos << "arm64" << "-triple arm64-apple-tvos9.0" << "9.0"; QTest::newRow("tvos-simulator x86_64") << "appletvsimulator" << tvos_sim << "x86_64" << "-triple x86_64-apple-tvos9.0" << "9.0"; } QTest::newRow("watchos armv7k") << "watchos" << watchos << "armv7k" << "-triple thumbv7k-apple-watchos2.0" << "2.0"; QTest::newRow("watchos-simulator x86") << "watchsimulator" << watchos_sim << "x86" << "-triple i386-apple-watchos2.0" << "2.0"; } } void TestBlackboxApple::dmg() { if (qEnvironmentVariableIsSet("GITHUB_ACTIONS")) QSKIP("Skip this test when running on GitHub"); QDir::setCurrent(testDataDir + "/apple-dmg"); QCOMPARE(runQbs(), 0); } void TestBlackboxApple::embedInfoPlist() { QDir::setCurrent(testDataDir + QLatin1String("/embedInfoPlist")); QbsRunParameters params(QStringList{"qbs.installPrefix:''"}); QCOMPARE(runQbs(params), 0); QVERIFY(!getEmbeddedBinaryPlist(defaultInstallRoot + "/app").isEmpty()); QVERIFY(!getEmbeddedBinaryPlist(defaultInstallRoot + "/liblib.dylib").isEmpty()); QVERIFY(!getEmbeddedBinaryPlist(defaultInstallRoot + "/mod.bundle").isEmpty()); params.arguments = QStringList(QLatin1String("modules.bundle.embedInfoPlist:false")); params.expectFailure = true; rmDirR(relativeBuildDir()); QCOMPARE(runQbs(params), 0); QVERIFY(getEmbeddedBinaryPlist(defaultInstallRoot + "/app").isEmpty()); QVERIFY(getEmbeddedBinaryPlist(defaultInstallRoot + "/liblib.dylib").isEmpty()); QVERIFY(getEmbeddedBinaryPlist(defaultInstallRoot + "/mod.bundle").isEmpty()); } void TestBlackboxApple::frameworkStructure() { QDir::setCurrent(testDataDir + QLatin1String("/frameworkStructure")); QbsRunParameters params; QCOMPARE(runQbs(params), 0); if (m_qbsStdout.contains("isShallow: false")) { QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Widget")); QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Headers/Widget.h")); QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/PrivateHeaders/WidgetPrivate.h")); QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Resources/BaseResource")); QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/A/Resources/en.lproj/EnglishResource")); QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Versions/Current")); QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Widget")); QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Headers")); QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders")); QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Resources")); } else if (m_qbsStdout.contains("isShallow: true")) { QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Headers")); QVERIFY(directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders")); QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Widget")); QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Headers/Widget.h")); QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders/WidgetPrivate.h")); QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/BaseResource")); QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/en.lproj/EnglishResource")); QVERIFY(regularFileExists(relativeProductBuildDir("Widget") + "/Widget.framework/Widget")); } else { QVERIFY2(false, qPrintable(m_qbsStdout)); } params.command = "resolve"; params.arguments = QStringList() << "project.includeHeaders:false"; QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY(!directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/Headers")); QVERIFY(!directoryExists(relativeProductBuildDir("Widget") + "/Widget.framework/PrivateHeaders")); } void TestBlackboxApple::iconset() { QDir::setCurrent(testDataDir + QLatin1String("/ib/iconset")); QbsRunParameters params; params.arguments = QStringList() << "-f" << "iconset.qbs"; QCOMPARE(runQbs(params), 0); QVERIFY(regularFileExists(relativeProductBuildDir("iconset") + "/white.icns")); } void TestBlackboxApple::iconsetApp() { QDir::setCurrent(testDataDir + QLatin1String("/ib/iconsetapp")); QbsRunParameters params; params.arguments = QStringList() << "-f" << "iconsetapp.qbs"; QCOMPARE(runQbs(params), 0); if (m_qbsStdout.contains("isShallow: false")) { QVERIFY(regularFileExists(relativeProductBuildDir("iconsetapp") + "/iconsetapp.app/Contents/Resources/white.icns")); } else if (m_qbsStdout.contains("isShallow: true")) { QVERIFY(regularFileExists(relativeProductBuildDir("iconsetapp") + "/iconsetapp.app/white.icns")); } else { QVERIFY2(false, qPrintable(m_qbsStdout)); } } void TestBlackboxApple::privacymanifest() { QDir::setCurrent(testDataDir + "/privacymanifest"); QbsRunParameters params; params.arguments = QStringList() << "-f" << "privacymanifest.qbs"; QCOMPARE(runQbs(params), 0); const auto privacymanifestPath = getPrivacyManifestPath( relativeProductBuildDir("Lib") + "/Lib.framework"); QVERIFY(QFile::exists(privacymanifestPath)); const auto content = readInfoPlistFile(privacymanifestPath); QVERIFY(!content.isEmpty()); QCOMPARE(content.value(QStringLiteral("NSPrivacyTracking")), false); QCOMPARE(content.value(QStringLiteral("NSPrivacyTrackingDomains")), QVariantList()); QCOMPARE(content.value(QStringLiteral("NSPrivacyAccessedAPITypes")), QVariantList()); QCOMPARE(content.value(QStringLiteral("NSPrivacyCollectedDataTypes")), QVariantList()); } void TestBlackboxApple::infoPlist() { QDir::setCurrent(testDataDir + "/infoplist"); QbsRunParameters params; params.arguments = QStringList() << "-f" << "infoplist.qbs"; QCOMPARE(runQbs(params), 0); const auto infoPlistPath = getInfoPlistPath( relativeProductBuildDir("infoplist") + "/infoplist.app"); QVERIFY(QFile::exists(infoPlistPath)); const auto content = readInfoPlistFile(infoPlistPath); QVERIFY(!content.isEmpty()); // common values QCOMPARE(content.value(QStringLiteral("CFBundleIdentifier")), QStringLiteral("org.example.infoplist")); QCOMPARE(content.value(QStringLiteral("CFBundleName")), QStringLiteral("infoplist")); QCOMPARE(content.value(QStringLiteral("CFBundleExecutable")), QStringLiteral("infoplist")); if (!content.contains(QStringLiteral("SDKROOT"))) { // macOS-specific values QCOMPARE(content.value("LSMinimumSystemVersion"), QStringLiteral("10.7")); QCOMPARE(content.value("NSPrincipalClass"), QStringLiteral("NSApplication")); QCOMPARE(content.value(QStringLiteral("NSSupportsAutomaticGraphicsSwitching")), true); } else { // QBS-1447: UIDeviceFamily was set to a string instead of an array const auto family = content.value(QStringLiteral("UIDeviceFamily")); if (family.isValid()) { // Prior to Qt 5.15, int gets converted to a double when exporting plist as JSON QVERIFY(testVariantListType(family, QMetaType::LongLong) || testVariantListType(family, QMetaType::Double)); } const auto caps = content.value(QStringLiteral("UIRequiredDeviceCapabilities")); if (caps.isValid()) QVERIFY(testVariantListType(caps, QMetaType::QString)); const auto orientations = content.value(QStringLiteral("UIRequiredDeviceCapabilities")); if (orientations.isValid()) QVERIFY(testVariantListType(orientations, QMetaType::QString)); } } void TestBlackboxApple::infoPlistVariables() { QDir::setCurrent(testDataDir + "/infoPlistVariables"); QbsRunParameters params; params.arguments = QStringList() << "-f" << "infoPlistVariables.qbs"; QCOMPARE(runQbs(params), 0); const auto infoPlistPath = getInfoPlistPath( relativeProductBuildDir("infoPlistVariables") + "/infoPlistVariables.app"); QVERIFY(QFile::exists(infoPlistPath)); const auto content = readInfoPlistFile(infoPlistPath); QVERIFY(!content.isEmpty()); QCOMPARE(content.value(QStringLiteral("Curly")), QStringLiteral("infoPlistVariables")); QCOMPARE(content.value(QStringLiteral("Braces")), QStringLiteral("infoPlistVariables")); QCOMPARE(content.value(QStringLiteral("At")), QStringLiteral("infoPlistVariables")); QCOMPARE(content.value(QStringLiteral("CurlyMult")), QStringLiteral("infoPlistVariables_infoPlistVariables")); QCOMPARE(content.value(QStringLiteral("BracesMult")), QStringLiteral("infoPlistVariables_infoPlistVariables")); QCOMPARE(content.value(QStringLiteral("AtMult")), QStringLiteral("infoPlistVariables_infoPlistVariables")); QCOMPARE(content.value(QStringLiteral("CurlyNested")), QStringLiteral("infoPlistVariables")); QCOMPARE(content.value(QStringLiteral("BracesNested")), QStringLiteral("infoPlistVariables")); QCOMPARE(content.value(QStringLiteral("WithDefault")), QStringLiteral("DEFAULT")); } void TestBlackboxApple::lipoSymlinks() { QFETCH(bool, multiArch); QFETCH(bool, multiVariant); const auto xcodeVersion = findXcodeVersion(); if (!xcodeVersion) QSKIP("requires Xcode profile"); QDir::setCurrent(testDataDir + "/lipo-symlinks"); QbsRunParameters params(QStringList{"qbs.installPrefix:''"}); // the test can't use xcode module to determine version itself params.arguments << QStringLiteral("project.xcodeVersion:") + xcodeVersion->toString(); params.arguments << QStringLiteral("project.multiArch:%1").arg(multiArch ? "true" : "false"); params.arguments << QStringLiteral("project.multiVariant:%1") .arg(multiVariant ? "true" : "false"); rmDirR(relativeBuildDir()); QCOMPARE(runQbs(params), 0); const auto libraryDirPath = QStringList{{relativeBuildDir(), "install-root"}}.join("/"); const auto checkSymLink = [](const auto &path, const auto &targetPath) { QFileInfo fi(path); return fi.exists() && fi.isSymbolicLink() && fi.symLinkTarget() == targetPath; }; const auto libraryPath = QFileInfo(QStringList{{libraryDirPath, "libA.1.2.3.dylib"}}.join("/")).absoluteFilePath(); QVERIFY(QFileInfo(libraryPath).exists() && !QFileInfo(libraryPath).isSymbolicLink()); QVERIFY(checkSymLink(QStringList{{libraryDirPath, "libA.1.2.dylib"}}.join("/"), libraryPath)); QVERIFY(checkSymLink(QStringList{{libraryDirPath, "libA.1.dylib"}}.join("/"), libraryPath)); QVERIFY(checkSymLink(QStringList{{libraryDirPath, "libA.dylib"}}.join("/"), libraryPath)); if (multiArch && multiVariant) { // in this case there are 2 libs and 2 sets of symlinks const auto debugLibraryPath = QFileInfo(QStringList{{libraryDirPath, "libA_debug.1.2.3.dylib"}}.join("/")) .absoluteFilePath(); QVERIFY( QFileInfo(debugLibraryPath).exists() && !QFileInfo(debugLibraryPath).isSymbolicLink()); QVERIFY(checkSymLink( QStringList{{libraryDirPath, "libA_debug.1.2.dylib"}}.join("/"), debugLibraryPath)); QVERIFY(checkSymLink( QStringList{{libraryDirPath, "libA_debug.1.dylib"}}.join("/"), debugLibraryPath)); QVERIFY(checkSymLink( QStringList{{libraryDirPath, "libA_debug.dylib"}}.join("/"), debugLibraryPath)); } } void TestBlackboxApple::lipoSymlinks_data() { QTest::addColumn("multiArch"); QTest::addColumn("multiVariant"); QTest::newRow("standalone") << false << false; QTest::newRow("multiArch") << true << false; QTest::newRow("multiVariant") << false << true; QTest::newRow("multiArch, multiVariant") << true << true; } void TestBlackboxApple::objcArc() { QDir::setCurrent(testDataDir + QLatin1String("/objc-arc")); QCOMPARE(runQbs(), 0); } void TestBlackboxApple::overrideInfoPlist() { QDir::setCurrent(testDataDir + "/overrideInfoPlist"); QCOMPARE(runQbs(), 0); const auto infoPlistPath = getInfoPlistPath( relativeProductBuildDir("overrideInfoPlist") + "/overrideInfoPlist.app"); QVERIFY(QFile::exists(infoPlistPath)); const auto content = readInfoPlistFile(infoPlistPath); QVERIFY(!content.isEmpty()); // test we do not override custom values by default QCOMPARE(content.value(QStringLiteral("DefaultValue")), QStringLiteral("The default value")); // test we can override custom values QCOMPARE(content.value(QStringLiteral("OverriddenValue")), QStringLiteral("The overridden value")); // test we do not override special values set by Qbs by default QCOMPARE(content.value(QStringLiteral("CFBundleExecutable")), QStringLiteral("overrideInfoPlist")); // test we can override special values set by Qbs QCOMPARE(content.value(QStringLiteral("CFBundleName")), QStringLiteral("My Bundle")); } void TestBlackboxApple::xcode() { if (!findXcode()) QSKIP("requires Xcode profile"); QProcess xcodeSelect; xcodeSelect.start("xcode-select", QStringList() << "--print-path"); QVERIFY2(xcodeSelect.waitForStarted(), qPrintable(xcodeSelect.errorString())); QVERIFY2(xcodeSelect.waitForFinished(), qPrintable(xcodeSelect.errorString())); QVERIFY2(xcodeSelect.exitCode() == 0, qPrintable(xcodeSelect.readAllStandardError().constData())); const QString developerPath(QString::fromLocal8Bit(xcodeSelect.readAllStandardOutput().trimmed())); std::multimap sdks; QProcess xcodebuildShowSdks; xcodebuildShowSdks.start("xcrun", QStringList() << "xcodebuild" << "-showsdks"); QVERIFY2(xcodebuildShowSdks.waitForStarted(), qPrintable(xcodebuildShowSdks.errorString())); QVERIFY2(xcodebuildShowSdks.waitForFinished(), qPrintable(xcodebuildShowSdks.errorString())); QVERIFY2(xcodebuildShowSdks.exitCode() == 0, qPrintable(xcodebuildShowSdks.readAllStandardError().constData())); const auto lines = QString::fromLocal8Bit(xcodebuildShowSdks.readAllStandardOutput().trimmed()) .split('\n', Qt::SkipEmptyParts); for (const QString &line : lines) { static const std::regex regexp("^.+\\s+\\-sdk\\s+([a-z]+)([0-9]+\\.[0-9]+)$"); const auto ln = line.toStdString(); std::smatch match; if (std::regex_match(ln, match, regexp)) sdks.insert({ match[1], match[2] }); } const auto getSdksByType = [&sdks]() { QStringList result; std::string sdkType; QStringList sdkValues; for (const auto &sdk: sdks) { if (!sdkType.empty() && sdkType != sdk.first) { result.append(QStringLiteral("%1:['%2']") .arg(QString::fromStdString(sdkType), sdkValues.join("','"))); sdkValues.clear(); } sdkType = sdk.first; sdkValues.append(QString::fromStdString(sdk.second)); } return result; }; QDir::setCurrent(testDataDir + "/xcode"); QbsRunParameters params; params.arguments = (QStringList() << (QStringLiteral("modules.xcode.developerPath:") + developerPath) << (QStringLiteral("project.sdks:{") + getSdksByType().join(",") + "}")); QCOMPARE(runQbs(params), 0); } QTEST_MAIN(TestBlackboxApple) std::optional TestBlackboxApple::findXcode(int *status) { QTemporaryDir temp; QbsRunParameters params = QStringList({"-f", testDataDir + "/find/find-xcode.qbs"}); params.buildDirectory = temp.path(); const int res = runQbs(params); if (status) *status = res; QFile file(temp.path() + "/" + relativeProductBuildDir("find-xcode") + "/xcode.json"); if (!file.open(QIODevice::ReadOnly)) return {}; auto result = QJsonDocument::fromJson(file.readAll()).toVariant().toMap(); if (!result["present"].toBool()) return {}; return result; } std::optional TestBlackboxApple::findXcodeVersion() { const auto xcode = findXcode(); if (!xcode) return {}; return qbs::Version::fromString(xcode->value("version").toString()); } qbs-src-3.2.0/tests/auto/blackbox/blackbox-qt.qbs0000644000175100017510000000076115154533055021323 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "blackbox-qt" Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { name: "testdata" prefix: "testdata-qt/" files: ["**/*"] fileTags: [] } files: [ "../shared.h", "tst_blackboxbase.cpp", "tst_blackboxbase.h", "tst_blackboxqt.cpp", "tst_blackboxqt.h", ] cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)]) } qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxapple.h0000644000175100017510000000502315154533055022253 0ustar runnerrunner/**************************************************************************** ** ** 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 TST_BLACKBOXAPPLE_H #define TST_BLACKBOXAPPLE_H #include "tst_blackboxbase.h" #include namespace qbs { class Version; } // namespace qbs class TestBlackboxApple : public TestBlackboxBase { Q_OBJECT public: TestBlackboxApple(); public slots: void initTestCase() override; private slots: void appleMultiConfig(); void aggregateDependencyLinking(); void appiconset(); void assetCatalog(); void assetCatalog_data(); void assetCatalogsEmpty(); void assetCatalogsMultiple(); void bundleStructure(); void bundleStructure_data(); void byteArrayInfoPlist(); void codesign(); void codesign_data(); void codesignDestinationDirectory(); void deploymentTarget(); void deploymentTarget_data(); void dmg(); void embedInfoPlist(); void frameworkStructure(); void iconcomposer(); void iconset(); void iconsetApp(); void infoPlist(); void mainBundle(); void mainBundle_data(); void privacymanifest(); void infoPlistVariables(); void lipoSymlinks(); void lipoSymlinks_data(); void objcArc(); void overrideInfoPlist(); void xcode(); private: std::optional findXcode(int *status = nullptr); std::optional findXcodeVersion(); }; #endif // TST_BLACKBOXAPPLE_H qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxwindows.h0000644000175100017510000000371615154533055022653 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef TST_BLACKBOXWINDOWS_H #define TST_BLACKBOXWINDOWS_H #include "tst_blackboxbase.h" class TestBlackboxWindows : public TestBlackboxBase { Q_OBJECT public: TestBlackboxWindows(); public slots: void initTestCase() override; private slots: void innoSetup(); void innoSetupDependencies(); void standaloneCodesign(); void standaloneCodesign_data(); void wix(); void wixDependencies(); }; #endif // TST_BLACKBOXWINDOWS_H qbs-src-3.2.0/tests/auto/blackbox/testdata/0000755000175100017510000000000015154533055020212 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/build-graph-versions/0000755000175100017510000000000015154533055024256 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/build-graph-versions/main.cpp0000644000175100017510000000001715154533055025704 0ustar runnerrunnerint main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/build-graph-versions/build-graph-versions.qbs0000644000175100017510000000005315154533055031027 0ustar runnerrunnerCppApplication { files: ["main.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/combined-sources/0000755000175100017510000000000015154533055023453 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/combined-sources/main.cpp0000644000175100017510000000001715154533055025101 0ustar runnerrunnerint main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/combined-sources/uncombinable.cpp0000644000175100017510000000002215154533055026607 0ustar runnerrunnerstatic int i = 2; qbs-src-3.2.0/tests/auto/blackbox/testdata/combined-sources/combinable.cpp0000644000175100017510000000002215154533055026244 0ustar runnerrunnerstatic int i = 1; qbs-src-3.2.0/tests/auto/blackbox/testdata/combined-sources/combined-sources.qbs0000644000175100017510000000026715154533055027430 0ustar runnerrunnerCppApplication { name: "theapp" files: [ "combinable.cpp", "main.cpp", ] Group { files: ["uncombinable.cpp"] fileTags: ["cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/plugin-dependency/0000755000175100017510000000000015154533055023624 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/plugin-dependency/main.cpp0000644000175100017510000000033315154533055025253 0ustar runnerrunner#include "../dllexport.h" DLL_IMPORT void plugin3_hello(); DLL_IMPORT void plugin4_hello(); DLL_IMPORT void helper1_hello(); int main() { plugin3_hello(); plugin4_hello(); helper1_hello(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/plugin-dependency/plugin4.cpp0000644000175100017510000000016715154533055025716 0ustar runnerrunner#include "../dllexport.h" #include DLL_EXPORT void plugin4_hello() { std::puts("plugin4 says hello!"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/plugin-dependency/helper2.cpp0000644000175100017510000000016715154533055025675 0ustar runnerrunner#include "../dllexport.h" #include DLL_EXPORT void helper2_hello() { std::puts("Hello from helper2!"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/plugin-dependency/plugin1.cpp0000644000175100017510000000016715154533055025713 0ustar runnerrunner#include "../dllexport.h" #include DLL_EXPORT void plugin1_hello() { std::puts("plugin1 says hello!"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/plugin-dependency/plugin2.cpp0000644000175100017510000000016715154533055025714 0ustar runnerrunner#include "../dllexport.h" #include DLL_EXPORT void plugin2_hello() { std::puts("plugin2 says hello!"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/plugin-dependency/plugin-dependency.qbs0000644000175100017510000000425515154533055027753 0ustar runnerrunnerimport qbs.Host Project { CppApplication { name: "myapp" files: ["main.cpp"] Depends { name: "plugin1" // not to be linked cpp.link: Host.os() === undefined } Depends { name: "plugin2" } // not to be linked Depends { name: "plugin3" // supposed to be linked property bool theCondition: true cpp.link: theCondition && product.name === "myapp" } Depends { name: "plugin4" } // supposed to be linked Depends { name: "helper1" } // supposed to be linked } DynamicLibrary { name: "plugin1" install: false files: ["plugin1.cpp"] Depends { name: "cpp" } } DynamicLibrary { name: "plugin2" install: false files: ["plugin2.cpp"] Depends { name: "cpp" } Export { Parameters { cpp.link: false // marker 1 } } } DynamicLibrary { name: "plugin3" install: false files: ["plugin3.cpp"] Depends { name: "cpp" } Export { Parameters { cpp.link: false } } } DynamicLibrary { name: "plugin4" install: false files: ["plugin4.cpp"] Depends { name: "cpp" } Export { Parameters { // property bool theCondition: true cpp.link: true // theCondition TODO: Make this work } } } DynamicLibrary { name: "helper1" install: false files: ["helper1.cpp"] Depends { name: "cpp" } Depends { name: "helper2"; cpp.link: false /* marker 2 */ } Export { Depends { name: "cpp" } Depends { name: "helper2"; cpp.link: false } } } DynamicLibrary { name: "helper2" install: false files: ["helper2.cpp"] Depends { name: "cpp" } Export { Depends { name: "cpp" } cpp.defines: ["USING_HELPER2"] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/plugin-dependency/plugin3.cpp0000644000175100017510000000016715154533055025715 0ustar runnerrunner#include "../dllexport.h" #include DLL_EXPORT void plugin3_hello() { std::puts("plugin3 says hello!"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/plugin-dependency/helper1.cpp0000644000175100017510000000041115154533055025664 0ustar runnerrunner#include #if defined(_WIN32) || defined(WIN32) # define EXPORT __declspec(dllexport) #else # define EXPORT #endif #ifndef USING_HELPER2 #error define USING_HELPER2 missing #endif EXPORT void helper1_hello() { std::puts("helper1 says hello!"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/0000755000175100017510000000000015154533055023011 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/main.cpp0000644000175100017510000000255315154533055024446 0ustar runnerrunner/**************************************************************************** ** ** 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 "file1.h" #include "file2.h" #include "file3.h" #include "other.h" int main() { file1(); file2(); file3(); other(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/nested-groups.qbs0000644000175100017510000000222215154533055026315 0ustar runnerrunnerCppApplication { consoleApplication: true Depends { name: "themodule" } cpp.includePaths: ["subdir"] property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } files: ["main.cpp"] Group { prefix: "subdir/" cpp.defines: ["REQUIRED_FOR_FILE1", "BREAKS_FILE2"] fileTags: ["cpp"] // This group has no files, and that's okay. Group { files: ["other.cpp", "other.h"] Group { cpp.defines: outer.concat(["ALSO_REQUIRED_FOR_FILE1"]) files: ["file1.cpp", "file1.h"] } Group { cpp.defines: ["REQUIRED_FOR_FILE2"] files: ["file2.cpp", "file2.h"] } Group { name: "disabled" condition: false Group { name: "indirectly disabled" condition: true files: ["main2.cpp"] } } Group { name: "no tags" fileTags: [] files: ["main3.cpp"] } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/file3.cpp0000644000175100017510000000244615154533055024525 0ustar runnerrunner/**************************************************************************** ** ** 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 REQUIRED_FOR_FILE3 #error "missing define" #endif void file3() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/subdir/0000755000175100017510000000000015154533055024301 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/subdir/file1.cpp0000644000175100017510000000254615154533055026014 0ustar runnerrunner/**************************************************************************** ** ** 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 REQUIRED_FOR_FILE1 #error "missing define" #endif #ifndef ALSO_REQUIRED_FOR_FILE1 #error "missing define" #endif void file1() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/subdir/file2.h0000644000175100017510000000235115154533055025454 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void file2(); qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/subdir/other.cpp0000644000175100017510000000253415154533055026132 0ustar runnerrunner/**************************************************************************** ** ** 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 REQUIRED_FOR_FILE1 #error "missing define" #endif #ifndef BREAKS_FILE2 #error "missing define" #endif void other() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/subdir/file2.cpp0000644000175100017510000000253515154533055026013 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #ifdef BREAKS_FILE2 #error "unexpected define" #endif #ifndef REQUIRED_FOR_FILE2 #error "missing define" #endif void file2() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/subdir/file1.h0000644000175100017510000000235115154533055025453 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void file1(); qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/subdir/main3.cpp0000644000175100017510000000235215154533055026016 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/subdir/main2.cpp0000644000175100017510000000235215154533055026015 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/subdir/other.h0000644000175100017510000000235115154533055025574 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void other(); qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/file3.h0000644000175100017510000000235115154533055024165 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void file3(); qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/modules/0000755000175100017510000000000015154533055024461 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/modules/themodule/0000755000175100017510000000000015154533055026447 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nested-groups/modules/themodule/themodule.qbs0000644000175100017510000000030115154533055031136 0ustar runnerrunnerModule { Group { cpp.defines: ["REQUIRED_FOR_FILE3"] Group { prefix: product.sourceDirectory + '/' files: ["file3.cpp", "file3.h"] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/0000755000175100017510000000000015154533055021635 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat_c.qbs0000644000175100017510000000116315154533055023575 0ustar runnerrunnerimport qbs.Host CppApplication { Depends { name: "flatbuffers.c"; required: false } consoleApplication: true condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasFlatbuffers; } property bool hasFlatbuffers: { console.info("has flatbuffers: " + flatbuffers.c.present); return flatbuffers.c.present; } files: [ "flat.c", "foo.fbs", ] qbsModuleProviders: "conan" } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat.c0000644000175100017510000000152315154533055022730 0ustar runnerrunner#include "foo_builder.h" #include #undef ns #define ns(x) FLATBUFFERS_WRAP_NAMESPACE(QbsTest, x) // Specified in the schema. #define test_assert(x) do { if (!(x)) { assert(0); return -1; }} while (0) int main() { void *buffer = NULL; size_t size = 0; flatcc_builder_t builder; flatcc_builder_init(&builder); flatbuffers_string_ref_t name = flatbuffers_string_create_str(&builder, "John Doe"); ns(Foo_create_as_root(&builder, name, 42)); buffer = flatcc_builder_finalize_aligned_buffer(&builder, &size); ns(Foo_table_t) foo = ns(Foo_as_root(buffer)); test_assert(strcmp(ns(Foo_name(foo)), "John Doe") == 0); test_assert(ns(Foo_count(foo)) == 42); free(buffer); flatcc_builder_clear(&builder); printf("The FlatBuffer was successfully created and accessed!\n"); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/conanfile.txt0000644000175100017510000000013015154533055024326 0ustar runnerrunner[requires] flatbuffers/24.3.25 [tool_requires] flatbuffers/24.3.25 [generators] QbsDeps qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat_relative_import.cpp0000644000175100017510000000107615154533055026560 0ustar runnerrunner#include "bar_generated.h" #include using namespace QbsTest; int main() { flatbuffers::FlatBufferBuilder builder; auto name = builder.CreateString("John Doe"); auto newFoo = QbsTest::CreateFoo(builder, name, 42); auto newBar = QbsTest::CreateBar(builder, newFoo); builder.Finish(newBar); auto bar = GetBar(builder.GetBufferPointer()); assert(bar->foo()->name()->str() == "John Doe"); assert(bar->foo()->count() == 42); std::cout << "The FlatBuffer was successfully created and accessed!" << std::endl; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat_filename_extension.cpp0000644000175100017510000000077115154533055027230 0ustar runnerrunner#include "foo_generated.hpp" #include using namespace QbsTest; int main() { flatbuffers::FlatBufferBuilder builder; auto name = builder.CreateString("John Doe"); auto newFoo = QbsTest::CreateFoo(builder, name, 42); builder.Finish(newFoo); auto foo = GetFoo(builder.GetBufferPointer()); assert(foo->name()->str() == "John Doe"); assert(foo->count() == 42); std::cout << "The FlatBuffer was successfully created and accessed!" << std::endl; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/baz.fbs0000644000175100017510000000014715154533055023107 0ustar runnerrunnerinclude "imported_foo/imported_foo.fbs"; namespace QbsTest; table Baz { foo:Foo; } root_type Baz; qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat_absolute_import.qbs0000644000175100017510000000133215154533055026561 0ustar runnerrunnerimport qbs.Host CppApplication { Depends { name: "flatbuf.cpp"; required: false } consoleApplication: true condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasFlatbuffers; } property bool hasFlatbuffers: { console.info("has flatbuffers: " + flatbuf.cpp.present); return flatbuf.cpp.present; } flatbuf.cpp.importPaths: "imports/" files: [ "flat_absolute_import.cpp", "baz.fbs", "imports/imported_foo/imported_foo.fbs", ] qbsModuleProviders: "conan" } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat_keep_prefix.qbs0000644000175100017510000000136615154533055025661 0ustar runnerrunnerimport qbs.Host CppApplication { Depends { name: "flatbuf.cpp"; required: false } consoleApplication: true condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasFlatbuffers; } property bool hasFlatbuffers: { console.info("has flatbuffers: " + flatbuf.cpp.present); return flatbuf.cpp.present; } flatbuf.cpp.importPaths: "imports/" flatbuf.cpp.keepPrefix: true files: [ "flat_keep_prefix.cpp", "baz.fbs", "imports/imported_foo/imported_foo.fbs", ] qbsModuleProviders: "conan" } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat_cpp.qbs0000644000175100017510000000116015154533055024132 0ustar runnerrunnerimport qbs.Host CppApplication { Depends { name: "flatbuf.cpp"; required: false } consoleApplication: true condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasFlatbuffers; } property bool hasFlatbuffers: { console.info("has flatbuffers: " + flatbuf.cpp.present); return flatbuf.cpp.present; } files: [ "flat.cpp", "foo.fbs", ] qbsModuleProviders: "conan" } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat_filename_suffix.cpp0000644000175100017510000000076115154533055026517 0ustar runnerrunner#include "foo.fbs.h" #include using namespace QbsTest; int main() { flatbuffers::FlatBufferBuilder builder; auto name = builder.CreateString("John Doe"); auto newFoo = QbsTest::CreateFoo(builder, name, 42); builder.Finish(newFoo); auto foo = GetFoo(builder.GetBufferPointer()); assert(foo->name()->str() == "John Doe"); assert(foo->count() == 42); std::cout << "The FlatBuffer was successfully created and accessed!" << std::endl; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/imports/0000755000175100017510000000000015154533055023332 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/imports/imported_foo/0000755000175100017510000000000015154533055026020 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/imports/imported_foo/imported_foo.fbs0000644000175100017510000000011615154533055031200 0ustar runnerrunnernamespace QbsTest; table Foo { name:string; count:int; } root_type Foo; qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/bar.fbs0000644000175100017510000000012115154533055023067 0ustar runnerrunnerinclude "foo.fbs"; namespace QbsTest; table Bar { foo:Foo; } root_type Bar; qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat_filename_extension.qbs0000644000175100017510000000125415154533055027230 0ustar runnerrunnerimport qbs.Host CppApplication { Depends { name: "flatbuf.cpp"; required: false } consoleApplication: true condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasFlatbuffers; } property bool hasFlatbuffers: { console.info("has flatbuffers: " + flatbuf.cpp.present); return flatbuf.cpp.present; } flatbuf.cpp.filenameExtension: "hpp" files: [ "flat_filename_extension.cpp", "foo.fbs", ] qbsModuleProviders: "conan" } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat_filename_suffix.qbs0000644000175100017510000000124715154533055026522 0ustar runnerrunnerimport qbs.Host CppApplication { Depends { name: "flatbuf.cpp"; required: false } consoleApplication: true condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasFlatbuffers; } property bool hasFlatbuffers: { console.info("has flatbuffers: " + flatbuf.cpp.present); return flatbuf.cpp.present; } flatbuf.cpp.filenameSuffix: ".fbs" files: [ "flat_filename_suffix.cpp", "foo.fbs", ] qbsModuleProviders: "conan" } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat_keep_prefix.cpp0000644000175100017510000000115715154533055025654 0ustar runnerrunner#include "baz_generated.h" #include "imported_foo/imported_foo_generated.h" #include using namespace QbsTest; int main() { flatbuffers::FlatBufferBuilder builder; auto name = builder.CreateString("John Doe"); auto newFoo = QbsTest::CreateFoo(builder, name, 42); auto newBaz = QbsTest::CreateBaz(builder, newFoo); builder.Finish(newBaz); auto baz = GetBaz(builder.GetBufferPointer()); assert(baz->foo()->name()->str() == "John Doe"); assert(baz->foo()->count() == 42); std::cout << "The FlatBuffer was successfully created and accessed!" << std::endl; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat_absolute_import.cpp0000644000175100017510000000107615154533055026563 0ustar runnerrunner#include "baz_generated.h" #include using namespace QbsTest; int main() { flatbuffers::FlatBufferBuilder builder; auto name = builder.CreateString("John Doe"); auto newFoo = QbsTest::CreateFoo(builder, name, 42); auto newBaz = QbsTest::CreateBaz(builder, newFoo); builder.Finish(newBaz); auto baz = GetBaz(builder.GetBufferPointer()); assert(baz->foo()->name()->str() == "John Doe"); assert(baz->foo()->count() == 42); std::cout << "The FlatBuffer was successfully created and accessed!" << std::endl; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat.cpp0000644000175100017510000000076715154533055023301 0ustar runnerrunner#include "foo_generated.h" #include using namespace QbsTest; int main() { flatbuffers::FlatBufferBuilder builder; auto name = builder.CreateString("John Doe"); auto newFoo = QbsTest::CreateFoo(builder, name, 42); builder.Finish(newFoo); auto foo = GetFoo(builder.GetBufferPointer()); assert(foo->name()->str() == "John Doe"); assert(foo->count() == 42); std::cout << "The FlatBuffer was successfully created and accessed!" << std::endl; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/foo.fbs0000644000175100017510000000011615154533055023112 0ustar runnerrunnernamespace QbsTest; table Foo { name:string; count:int; } root_type Foo; qbs-src-3.2.0/tests/auto/blackbox/testdata/flatbuf/flat_relative_import.qbs0000644000175100017510000000122315154533055026555 0ustar runnerrunnerimport qbs.Host CppApplication { Depends { name: "flatbuf.cpp"; required: false } consoleApplication: true condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasFlatbuffers; } property bool hasFlatbuffers: { console.info("has flatbuffers: " + flatbuf.cpp.present); return flatbuf.cpp.present; } files: [ "flat_relative_import.cpp", "bar.fbs", "foo.fbs", ] qbsModuleProviders: "conan" } qbs-src-3.2.0/tests/auto/blackbox/testdata/variant-suffix/0000755000175100017510000000000015154533055023160 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/variant-suffix/variant-suffix.qbs0000644000175100017510000000174715154533055026646 0ustar runnerrunnerStaticLibrary { name: "l" Group { condition: qbs.targetOS.includes("darwin") Depends { name: "bundle" } Properties { bundle.isBundle: false } } aggregate: false property string variantSuffix property bool multiplex: false Properties { condition: multiplex qbs.buildVariants: ["debug", "release"] multiplexByQbsProperties: ["buildVariants"] } Properties { condition: variantSuffix !== undefined cpp.variantSuffix: variantSuffix } cpp.staticLibraryPrefix: "lib" cpp.staticLibrarySuffix: ".ext" qbs.installPrefix: "" config.install.staticLibraries: true Depends { name: "cpp" } files: ["lib.cpp"] Probe { id: targetOSProbe property stringList targetOS: qbs.targetOS configure: { console.info("is Windows: " + targetOS.includes("windows")); console.info("is Apple: " + targetOS.includes("darwin")); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/variant-suffix/lib.cpp0000644000175100017510000000001415154533055024425 0ustar runnerrunnervoid f() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/path-list-in-probe/0000755000175100017510000000000015154533055023630 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/path-list-in-probe/main.cpp0000644000175100017510000000003415154533055025255 0ustar runnerrunnerint main() { return 0; }qbs-src-3.2.0/tests/auto/blackbox/testdata/path-list-in-probe/path-list-in-probe.qbs0000644000175100017510000000050215154533055027752 0ustar runnerrunnerProject { CppApplication { Probe { id: theProbe property pathList result configure: { result = ["main.cpp"] found = true } } property pathList res: theProbe.found ? theProbe.result : [] Group { name: "files" files: res } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/fileDependencies/0000755000175100017510000000000015154533055023440 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/fileDependencies/awesomelib/0000755000175100017510000000000015154533055025567 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/fileDependencies/awesomelib/magnificent.h0000644000175100017510000000252115154533055030224 0ustar runnerrunner/**************************************************************************** ** ** 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 MAGNIFICENT_H #define MAGNIFICENT_H const char magnificentMessage[] = "Just. Wow."; #endif // MAGNIFICENT_H qbs-src-3.2.0/tests/auto/blackbox/testdata/fileDependencies/awesomelib/awesome.h0000644000175100017510000000250715154533055027404 0ustar runnerrunner/**************************************************************************** ** ** 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 #include "magnificent.h" void doAwesomeStuff() { std::printf(magnificentMessage); } qbs-src-3.2.0/tests/auto/blackbox/testdata/fileDependencies/fileDependencies.qbs0000644000175100017510000000071115154533055027374 0ustar runnerrunnerProject { Product { type: "application" consoleApplication: true name: "myapp" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: "cpp" } cpp.includePaths: ["awesomelib"] files: ["src/narf.h", "src/narf.cpp", "src/zort.cpp"] // Group { // fileTagsFilter: product.type // qbs.install: true // } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/fileDependencies/src/0000755000175100017510000000000015154533055024227 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/fileDependencies/src/narf.cpp0000644000175100017510000000243315154533055025663 0ustar runnerrunner/**************************************************************************** ** ** 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 void doStuff() { doAwesomeStuff(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/fileDependencies/src/zort.cpp0000644000175100017510000000243315154533055025733 0ustar runnerrunner/**************************************************************************** ** ** 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 "narf.h" int main() { doStuff(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/fileDependencies/src/narf.h0000644000175100017510000000235415154533055025332 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void doStuff(); qbs-src-3.2.0/tests/auto/blackbox/testdata/probes-in-nested-modules/0000755000175100017510000000000015154533055025036 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probes-in-nested-modules/probes-in-nested-modules.qbs0000644000175100017510000000176715154533055032404 0ustar runnerrunnerProject { Product { name: "a" Depends { name: "outer" } inner.alt: true property bool dummy: { console.info("product " + name + ", inner.something = " + inner.something); console.info("product " + name + ", outer.something = " + outer.something); console.info("product " + name + ", outer.somethingElse = " + outer.somethingElse); return true; } type: ["foo"] } Product { name: "b" Depends { name: "inner" } inner.alt: true property bool dummy: { console.info("product " + name + ", inner.something = " + inner.something); return true; } type: ["foo"] } Product { name: "c" Depends { name: "inner" } inner.alt: false property bool dummy: { console.info("product " + name + ", inner.something = " + inner.something); return true; } type: ["foo"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/probes-in-nested-modules/modules/0000755000175100017510000000000015154533055026506 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probes-in-nested-modules/modules/inner/0000755000175100017510000000000015154533055027621 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probes-in-nested-modules/modules/inner/inner.qbs0000644000175100017510000000061415154533055031444 0ustar runnerrunnerimport qbs.Probes Module { property bool alt: false Probe { id: foo property string baz property bool useAlt: alt property string named: product.name configure: { console.info("running probe " + named); baz = useAlt ? "hahaha" : "hello"; found = true; } } property string something: foo.baz } qbs-src-3.2.0/tests/auto/blackbox/testdata/probes-in-nested-modules/modules/outer/0000755000175100017510000000000015154533055027644 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probes-in-nested-modules/modules/outer/outer.qbs0000644000175100017510000000060515154533055031512 0ustar runnerrunnerModule { Depends { name: "inner" } Probe { id: foo2 property string barz property string named: product.name configure: { console.info("running second probe " + named); barz = "goodbye"; found = true; } } property string something: inner.something property string somethingElse: foo2.barz } qbs-src-3.2.0/tests/auto/blackbox/testdata/archiver-flags/0000755000175100017510000000000015154533055023107 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/archiver-flags/archiver-flags.qbs0000644000175100017510000000056115154533055026515 0ustar runnerrunnerStaticLibrary { Depends { name: "cpp" } files: "lib.cpp" Properties { condition: toolchainProbe.found cpp.archiverFlags: ["/WX:NO"] } Probe { id: toolchainProbe condition: qbs.toolchain.includes("msvc") configure: { console.info("toolchain is MSVC"); found = true; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/archiver-flags/lib.cpp0000644000175100017510000000001715154533055024357 0ustar runnerrunnervoid func() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/recursive_renaming/0000755000175100017510000000000015154533055024101 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/recursive_renaming/recursive_renaming.qbs0000644000175100017510000000021715154533055030477 0ustar runnerrunnerProduct { qbs.installPrefix: "" Group { qbs.install: true qbs.installSourceBase: "." files: ["dir/**"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/recursive_renaming/dir/0000755000175100017510000000000015154533055024657 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/recursive_renaming/dir/subdir/0000755000175100017510000000000015154533055026147 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/recursive_renaming/dir/subdir/blubb.txt0000644000175100017510000000000015154533055027764 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/recursive_renaming/dir/wasser.txt0000644000175100017510000000000015154533055026712 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pch-change-tracking/0000755000175100017510000000000015154533055024007 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pch-change-tracking/header1.h0000644000175100017510000000250415154533055025472 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #pragma once #include inline void printGreeting() { std::cout << "Tach." << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/pch-change-tracking/main.cpp0000644000175100017510000000250315154533055025437 0ustar runnerrunner/**************************************************************************** ** ** 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 "header2.h" #include "pch.h" int main() { printGreeting(); printPersonalGreeting(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/pch-change-tracking/header2.h0000644000175100017510000000240615154533055025474 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #pragma once void printPersonalGreeting(); qbs-src-3.2.0/tests/auto/blackbox/testdata/pch-change-tracking/pch-change-tracking.qbs0000644000175100017510000000031015154533055030305 0ustar runnerrunnerCppApplication { files: [ "header1.h", "header2.cpp", "header2.h", "main.cpp", ] Group { files: ["pch.h"] fileTags: ["cpp_pch_src"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/pch-change-tracking/header2.cpp0000644000175100017510000000025715154533055026031 0ustar runnerrunner#include "header2.h" // header1 is forced-included via pch. void printPersonalGreeting() { printGreeting(); std::cout << "Was geht, Rumpelstilzchen?" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/pch-change-tracking/pch.h0000644000175100017510000000236015154533055024733 0ustar runnerrunner/**************************************************************************** ** ** 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 "header1.h" qbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe/0000755000175100017510000000000015154533055023343 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe/dummy2/0000755000175100017510000000000015154533055024560 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe/dummy2/dummy2.pc0000644000175100017510000000014615154533055026322 0ustar runnerrunnerName: dummy2 Description: dummy2 package Version: 0.0.2 Requires: Libs: -Ldummydir2 -ldummy2 Cflags: qbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe/pkg-config.qbs0000644000175100017510000000074415154533055026103 0ustar runnerrunnerProject { property string packageBaseName Product { name: "theProduct1" type: ["theType"] Depends { name: "themodule" } themodule.packageName: project.packageBaseName + "1" themodule.libDir: path + "/dummy1" } Product { name: "theProduct2" type: ["theType"] Depends { name: "themodule" } themodule.packageName: project.packageBaseName + "2" themodule.libDir: path + "/dummy2" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe/dummy1/0000755000175100017510000000000015154533055024557 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe/dummy1/dummy1.pc0000644000175100017510000000014615154533055026320 0ustar runnerrunnerName: dummy1 Description: dummy1 package Version: 0.0.1 Requires: Libs: -Ldummydir1 -ldummy1 Cflags: qbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe/modules/0000755000175100017510000000000015154533055025013 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe/modules/themodule/0000755000175100017510000000000015154533055027001 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe/modules/themodule/themodule.qbs0000644000175100017510000000202115154533055031471 0ustar runnerrunnerimport qbs.Probes Module { property string packageName property string libDir Probes.PkgConfigProbe { id: theProbe name: packageName libDirs: [libDir] } property bool probeSuccess: theProbe.found property stringList libs: theProbe.libs property stringList cFlags: theProbe.cflags property string packageVersion: theProbe.modversion Rule { multiplex: true outputFileTags: "theType" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.info(product.name + " found: " + product.themodule.probeSuccess); console.info(product.name + " libs: " + JSON.stringify(product.themodule.libs)); console.info(product.name + " cflags: " + JSON.stringify(product.themodule.cFlags)); console.info(product.name + " version: " + product.themodule.packageVersion); } return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/aux-inputs-from-deps/0000755000175100017510000000000015154533055024221 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/aux-inputs-from-deps/main.cpp0000644000175100017510000000004315154533055025646 0ustar runnerrunner#include int main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/aux-inputs-from-deps/aux-inputs-from-deps.qbs0000644000175100017510000000424615154533055030745 0ustar runnerrunnerimport qbs.File import qbs.TextFile import "util.js" as Utils Project { CppApplication { name: "app" files: ["main.cpp"] Depends { name: "dep" } } Product { name: "p" type: ["p.out"] Depends { name: "dep" } Rule { multiplex: true explicitlyDependsOnFromDependencies: ["hpp"] Artifact { filePath: "dummy.out" fileTags: ["p.out"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating dummy.out"; cmd.sourceCode = function() { File.copy(project.buildDirectory + "/dummy.h", output.filePath); }; return [cmd]; } } } Product { name: "dep" type: ["hpp"] property bool sleep: true Rule { inputs: ["blubb.in"] Artifact { filePath: project.buildDirectory + "/dummy.h" fileTags: ["hpp"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating header"; cmd.sourceCode = function() { if (product.sleep) Utils.sleep(1000); File.copy(input.filePath, output.filePath); } return [cmd]; } } Rule { multiplex: true Artifact { filePath: "dummy.blubb" fileTags: ["blubb.in"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating blubb.in"; cmd.sourceCode = function() { if (product.sleep) Utils.sleep(1000); var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); } return [cmd]; } } Export { Depends { name: "cpp" } cpp.includePaths: [project.buildDirectory] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/aux-inputs-from-deps/util.js0000644000175100017510000000025115154533055025532 0ustar runnerrunnerfunction sleep(timeInMs) { var referenceTime = new Date(); var time = null; do { time = new Date(); } while (time - referenceTime < timeInMs); } qbs-src-3.2.0/tests/auto/blackbox/testdata/installpackage/0000755000175100017510000000000015154533055023174 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/installpackage/main.cpp0000644000175100017510000000240515154533055024625 0ustar runnerrunner/**************************************************************************** ** ** 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 "lib.h" int main() { f(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/installpackage/installpackage.qbs0000644000175100017510000000206215154533055026665 0ustar runnerrunnerProject { CppApplication { name: "public_tool" Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } Depends { name: "mylib" } files: ["main.cpp"] installDir: "bin" installDebugInformation: false } CppApplication { name: "internal_tool" Depends { name: "mylib" } files: ["main.cpp"] } DynamicLibrary { Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } Depends { name: "cpp" } name: "mylib" files: ["lib.cpp"] Group { name: "public headers" files: ["lib.h"] qbs.install: true qbs.installDir: "include" } installDir: "lib" installDebugInformation: false } InstallPackage { archiver.type: "tar" builtByDefault: true name: "tar-package" Depends { name: "public_tool" } Depends { name: "mylib" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/installpackage/lib.h0000644000175100017510000000256015154533055024116 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" #ifdef MYLIB # define MYLIB_EXPORT DLL_EXPORT #else # define MYLIB_EXPORT DLL_IMPORT #endif MYLIB_EXPORT void f(); qbs-src-3.2.0/tests/auto/blackbox/testdata/installpackage/lib.cpp0000644000175100017510000000237115154533055024451 0ustar runnerrunner/**************************************************************************** ** ** 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 "lib.h" void f() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-variant/0000755000175100017510000000000015154533055023140 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/linker-variant/main.cpp0000644000175100017510000000001615154533055024565 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-variant/linker-variant.qbs0000644000175100017510000000064115154533055026576 0ustar runnerrunnerCppApplication { name: "p" property string linkerVariant Probe { id: gccProbe property bool isGcc: qbs.toolchain.includes("gcc") configure: { console.info("is GCC: " + isGcc); if (isGcc) found = true; } } Properties { condition: gccProbe.found cpp.linkerVariant: linkerVariant } files: "main.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/0000755000175100017510000000000015154533055021010 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/toplevel.txt0000644000175100017510000000000015154533055023371 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/MyProduct.qbs0000644000175100017510000000016615154533055023450 0ustar runnerrunner// This is a simple forwarder ... /* ... that we are indenting to test non-zero line and column numbers */ Product {} qbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/subdir/0000755000175100017510000000000015154533055022300 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/subdir/file1.txt0000644000175100017510000000000015154533055024027 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/subdir/file2.txt0000644000175100017510000000000015154533055024030 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/lsp.qbs0000644000175100017510000000101715154533055022314 0ustar runnerrunnerProject { Product { name: "dep" Depends { name: "m" } Depends { name: "Prefix"; submodules: ["m1", "m2", "m3"] } m.prop: true } Product { Depends { name: "dep" } files: "toplevel.txt" Group { prefix: "subdir/" Group { files: ["file1.txt", "file2.txt"] } } } references: "other.qbs" MyProduct { name: "dummy" } Product { name: "p" Depends { name: "Prefix.m1" } Prefix.m1.p1: true } } qbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/other.qbs0000644000175100017510000000001315154533055022632 0ustar runnerrunnerProduct {} qbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/modules/0000755000175100017510000000000015154533055022460 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/modules/Prefix/0000755000175100017510000000000015154533055023715 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/modules/Prefix/m2/0000755000175100017510000000000015154533055024233 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/modules/Prefix/m2/m2.qbs0000644000175100017510000000001315154533055025252 0ustar runnerrunnerModule { } qbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/modules/Prefix/m3/0000755000175100017510000000000015154533055024234 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/modules/Prefix/m3/m3.qbs0000644000175100017510000000001315154533055025254 0ustar runnerrunnerModule { } qbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/modules/Prefix/m1/0000755000175100017510000000000015154533055024232 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/modules/Prefix/m1/m1.qbs0000644000175100017510000000011315154533055025251 0ustar runnerrunnerModule { property bool p1 property string p2 property bool x } qbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/modules/m/0000755000175100017510000000000015154533055022714 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lsp/modules/m/m.qbs0000644000175100017510000000005115154533055023653 0ustar runnerrunnerModule { property bool prop: false } qbs-src-3.2.0/tests/auto/blackbox/testdata/object-lib-deps/0000755000175100017510000000000015154533055023155 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/object-lib-deps/e.cpp0000644000175100017510000000004615154533055024105 0ustar runnerrunnerint d(); int e() { return d(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/object-lib-deps/main.cpp0000644000175100017510000000011215154533055024577 0ustar runnerrunnerint e(); void consumer(); int main() { consumer(); return e(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/object-lib-deps/object-lib-deps.qbs0000644000175100017510000000636315154533055026637 0ustar runnerrunnerProject { property bool useExport: true ObjectLibrary { name: "consumed" Depends { name: "cpp" } files: "consumed.cpp" } StaticLibrary { name: "consumer" Depends { name: "cpp" } Depends { name: "consumed" } files: "consumer.cpp" } ObjectLibrary { name: "a" Depends { name: "cpp" } files: ["a1.cpp", "a2.cpp"] } ObjectLibrary { name: "b" Depends { name: "cpp" } Depends { name: "a" } files: "b.cpp" } ObjectLibrary { name: "c" Depends { name: "cpp" } Depends { name: "a" } files: "c.cpp" } ObjectLibrary { name: "r" Depends { name: "cpp" } Depends { name: "b" } Depends { name: "c" } files: "d.cpp" Group { condition: qbs.targetOS.includes("darwin") files: ["d.mm"] } Properties { condition: qbs.targetOS.includes("windows") cpp.defines: ["WITH_SETUPAPI"] cpp.staticLibraries: !project.useExport ? ["setupapi"] : [] } Properties { condition: qbs.targetOS.includes("darwin") cpp.defines: ["WITH_ZLIB"] cpp.staticLibraries: !project.useExport ? ["z"] : [] cpp.frameworks: !project.useExport ? ["Foundation"] : [] } Properties { condition: { console.info(qbs.targetOS); return qbs.targetOS.includes("linux") || qbs.targetOS.includes("hurd") } cpp.defines: ["WITH_PTHREAD", "WITH_ZLIB"] cpp.staticLibraries: !project.useExport ? ["pthread", "z"] : [] } Properties { condition: qbs.toolchain.contains("emscripten") cpp.defines: ["WITH_WEBSOCK"] cpp.staticLibraries: !project.useExport ? ["websocket.js"] : [] } Export { condition : project.useExport Depends { name: "cpp" } Properties { condition: qbs.targetOS.contains("linux") || qbs.targetOS.includes("hurd") cpp.staticLibraries: ["pthread", "z"] } Properties { condition: qbs.targetOS.contains("darwin") cpp.staticLibraries: ["z"] cpp.frameworks: ["Foundation"] } Properties { condition: qbs.targetOS.contains("windows") cpp.staticLibraries: ["setupapi"] } Properties { condition: qbs.toolchain.contains("emscripten") cpp.staticLibraries: ["websocket.js"] } } } ObjectLibrary { name: "e" Depends { name: "cpp" } Depends { name: "r" } files: "e.cpp" Export { Depends { name: "r" } } } CppApplication { name: "objectLibDeps" type: "application" consoleApplication: true Depends { name: "e" } Depends { name: "consumer" } Properties { condition: qbs.targetOS.includes("linux") || qbs.targetOS.includes("hurd") cpp.driverFlags: ["-static"] } files: "main.cpp" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/object-lib-deps/consumer.cpp0000644000175100017510000000016515154533055025516 0ustar runnerrunner#include void consumed(); void consumer() { consumed(); std::cout << "consumer" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/object-lib-deps/c.cpp0000644000175100017510000000004315154533055024100 0ustar runnerrunnervoid a2(); void c() { a2(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/object-lib-deps/b.cpp0000644000175100017510000000004315154533055024077 0ustar runnerrunnervoid a1(); void b() { a1(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/object-lib-deps/a1.cpp0000644000175100017510000000010715154533055024160 0ustar runnerrunner#include void a1() { std::cout << "a1" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/object-lib-deps/d.mm0000644000175100017510000000027515154533055023737 0ustar runnerrunner#import void printGreeting() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog (@"Hello darkness, my old friend!"); [pool drain]; } qbs-src-3.2.0/tests/auto/blackbox/testdata/object-lib-deps/a2.cpp0000644000175100017510000000010715154533055024161 0ustar runnerrunner#include void a2() { std::cout << "a2" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/object-lib-deps/d.cpp0000644000175100017510000000155615154533055024113 0ustar runnerrunner#if defined(WITH_ZLIB) #include #endif #if defined(WITH_WEBSOCK) #include #endif #ifdef WITH_PTHREAD #include #elif defined(WITH_SETUPAPI) #include #include #endif void b(); void c(); int d() { b(); c(); int result = 0; #if defined(WITH_ZLIB) const char source[] = "Hello, world"; uLongf buffer_size = compressBound(sizeof(source)); result += static_cast(buffer_size); #endif #if defined(WITH_WEBSOCK) const bool supported = emscripten_websocket_is_supported(); (void) supported; #endif #ifdef WITH_PTHREAD pthread_t self = pthread_self(); result += static_cast(self); #elif defined(WITH_SETUPAPI) CABINET_INFO ci; ci.SetId = 0; SetupIterateCabinet(L"invalid-file-path", 0, NULL, NULL); result += ci.SetId; #endif return result; } qbs-src-3.2.0/tests/auto/blackbox/testdata/object-lib-deps/consumed.cpp0000644000175100017510000000012315154533055025472 0ustar runnerrunner#include void consumed() { std::cout << "consumed" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/rad-after-incomplete-build/0000755000175100017510000000000015154533055025311 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/rad-after-incomplete-build/project_with_rule.qbs0000644000175100017510000000106115154533055031546 0ustar runnerrunnerimport qbs.TextFile Product { type: "custom" Group { files: "dummy.txt" fileTags: "input" } Rule { inputs: "input" Artifact { fileTags: "custom" filePath: "oldfile" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating file"; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); } return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/rad-after-incomplete-build/dummy.txt0000644000175100017510000000000015154533055027173 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/setup-build-environment/0000755000175100017510000000000015154533055025011 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/setup-build-environment/setup-build-environment.qbs0000644000175100017510000000032215154533055032314 0ustar runnerrunnerProject { Product { name: "first_product" Depends { name: "buildenv" } Depends { name: "m" } } Product { name: "second_product" Depends { name: "m" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/setup-build-environment/modules/0000755000175100017510000000000015154533055026461 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/setup-build-environment/modules/m/0000755000175100017510000000000015154533055026715 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/setup-build-environment/modules/m/m.qbs0000644000175100017510000000130015154533055027652 0ustar runnerrunnerimport qbs.Environment import qbs.TextFile Module { additionalProductTypes: ["m.target"] Rule { multiplex: true Artifact { filePath: "m.output" fileTags: "m.target" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); var env = Environment.getEnv("BUILD_ENV_" + product.name.toUpperCase()); if (env) f.writeLine(env); f.close(); }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/setup-build-environment/modules/buildenv/0000755000175100017510000000000015154533055030271 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/setup-build-environment/modules/buildenv/buildenv.qbs0000644000175100017510000000031415154533055032606 0ustar runnerrunnerimport qbs.Environment Module { property string varPrefix: "BUILD_ENV_" setupBuildEnvironment: { Environment.putEnv(product.buildenv.varPrefix + product.name.toUpperCase(), "1"); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/group-condition-change/0000755000175100017510000000000015154533055024555 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/group-condition-change/group-condition-change.qbs0000644000175100017510000000113115154533055031623 0ustar runnerrunnerProject { property bool kaputt: true Product { type: ["kaputt"] Group { name: "kaputt" condition: project.kaputt files: "input_kaputt.txt" fileTags: "input.kaputt" } Rule { inputs: "input.kaputt" Artifact { filePath: "output.kaputt" fileTags: "kaputt" } prepare: { var cmd = new Command("jibbetnich", [output.filePath]); cmd.silent = true; return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/group-condition-change/input_kaputt.txt0000644000175100017510000000000015154533055030033 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/autotests/0000755000175100017510000000000015154533055022245 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/autotests/test1/0000755000175100017510000000000015154533055023305 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/autotests/test1/test1.qbs0000644000175100017510000000024315154533055025053 0ustar runnerrunnerCppApplication { name: "test1" type: base.concat("autotest") Depends { name: "autotest" } autotest.arguments: "--dummy" files: "test1.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/autotests/test1/test1.cpp0000644000175100017510000000043315154533055025051 0ustar runnerrunner#include #include int main(int argc, char *[]) { if (argc != 2) { std::cerr << "This test needs exactly one argument" << std::endl; std::cerr << "FAIL" << std::endl; return EXIT_FAILURE; } std::cout << "PASS" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/autotests/test2/0000755000175100017510000000000015154533055023306 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/autotests/test2/test2.cpp0000644000175100017510000000041615154533055025054 0ustar runnerrunner#include #include #include int main() { std::ifstream input("test2-resource.txt"); if (!input.is_open()) { std::cerr << "Test resource not found"; return EXIT_FAILURE; } std::cout << "PASS" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/autotests/test2/test2.qbs0000644000175100017510000000025215154533055025055 0ustar runnerrunnerCppApplication { name: "test2" type: base.concat("autotest") Depends { name: "autotest" } autotest.workingDir: sourceDirectory files: "test2.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/autotests/test2/test2-resource.txt0000644000175100017510000000000015154533055026723 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/autotests/test3/0000755000175100017510000000000015154533055023307 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/autotests/test3/test3.qbs0000644000175100017510000000024115154533055025055 0ustar runnerrunnerCppApplication { name: "test3" type: base.concat("autotest") Depends { name: "autotest" } autotest.allowFailure: true files: "test3.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/autotests/test3/test3.cpp0000644000175100017510000000023515154533055025055 0ustar runnerrunner#include #include int main() { std::cerr << "I am an awful test"; std::cerr << "FAIL" << std::endl; return EXIT_FAILURE; } qbs-src-3.2.0/tests/auto/blackbox/testdata/autotests/autotests.qbs0000644000175100017510000000106615154533055025012 0ustar runnerrunnerimport qbs.Host Project { references: ["test1", "test2", "test3"] AutotestRunner { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } Depends { name: "cpp" // Make sure build environment is set up properly. condition: Host.os().includes("windows") && qbs.toolchain.includes("gcc") } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/changed-files/0000755000175100017510000000000015154533055022703 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/changed-files/main.cpp0000644000175100017510000000235115154533055024334 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/changed-files/file1.cpp0000644000175100017510000000235015154533055024407 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void f1() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/changed-files/file2.cpp0000644000175100017510000000235015154533055024410 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void f2() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/changed-files/changed-files.qbs0000644000175100017510000000137115154533055026105 0ustar runnerrunnerimport qbs.TextFile CppApplication { type: ["application", "stuff"] consoleApplication: true files: ["file1.cpp", "file2.cpp", "main.cpp"] Rule { inputs: ["cpp"] outputFileTags: ["stuff"] outputArtifacts: { return [{ filePath: input.completeBaseName + ".stuff", fileTags: ["stuff"] }]; } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.write("crazy stuff"); f.close(); } return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/vcs/0000755000175100017510000000000015154533055021005 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/vcs/main.cpp0000644000175100017510000000053415154533055022437 0ustar runnerrunner#include #include int main() { std::cout << "==" << "repoState=" << VCS_REPO_STATE << ";" << "latestTag=" << VCS_REPO_LATEST_TAG << ";" << "commitsSinceTag=" << VCS_REPO_COMMITS_SINCE_TAG << ";" << "commitSha=" << VCS_REPO_COMMIT_SHA << "==" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/vcs/vcstest.qbs0000644000175100017510000000057715154533055023220 0ustar runnerrunnerimport qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } Depends { name: "vcs" } vcs.headerFileName: "my-repo-state.h" files: ["main.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/renameDependency/0000755000175100017510000000000015154533055023460 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/renameDependency/after/0000755000175100017510000000000015154533055024561 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/renameDependency/after/lib2.h0000644000175100017510000000241015154533055025557 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void print_two_numbers(int a, int b, int c); qbs-src-3.2.0/tests/auto/blackbox/testdata/renameDependency/after/lib2.cpp0000644000175100017510000000257115154533055026122 0ustar runnerrunner/**************************************************************************** ** ** 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 "lib2.h" #include void print_two_numbers(int a, int b, int c) { std::cout << "a=" << a << ", b=" << b << ", c=" << c << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/renameDependency/before/0000755000175100017510000000000015154533055024722 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/renameDependency/before/main.cpp0000644000175100017510000000247315154533055026360 0ustar runnerrunner/**************************************************************************** ** ** 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 #include "lib.h" int main() { print_two_numbers(2, 3); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/renameDependency/before/renameDependency.qbs0000644000175100017510000000005715154533055030701 0ustar runnerrunnerCppApplication { files: ["*.cpp", "*.h"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/renameDependency/before/lib.h0000644000175100017510000000241415154533055025642 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void print_two_numbers(int a, int b/*, int c*/); qbs-src-3.2.0/tests/auto/blackbox/testdata/renameDependency/before/lib.cpp0000644000175100017510000000260115154533055026173 0ustar runnerrunner/**************************************************************************** ** ** 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 "lib.h" #include void print_two_numbers(int a, int b/*, int c*/) { std::cout << "a=" << a << ", b=" << b /*<< ", c=" << c */ << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-config-import-export/0000755000175100017510000000000015154533055025071 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-config-import-export/config.txt0000644000175100017510000000013115154533055027072 0ustar runnerrunnergroup.key1: "value1" group.key2: "value2" key: "value" listKey: ["valueOne", "valueTwo"] qbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-config-import-export/config.json0000644000175100017510000000023715154533055027233 0ustar runnerrunner{ "group": { "key1": "value1", "key2": "value2" }, "key": "value", "listKey": [ "valueOne", "valueTwo" ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/assembly/0000755000175100017510000000000015154533055022031 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/assembly/testb.S0000644000175100017510000000004115154533055023271 0ustar runnerrunner#define bla nop symbolb: bla qbs-src-3.2.0/tests/auto/blackbox/testdata/assembly/testc.sx0000644000175100017510000000004115154533055023522 0ustar runnerrunner#define bla nop symbolb: bla qbs-src-3.2.0/tests/auto/blackbox/testdata/assembly/assembly.qbs0000644000175100017510000000465615154533055024372 0ustar runnerrunnerimport qbs.TextFile Project { Product { name: "properties" type: ["properties"] Depends { name: "cpp" } Rule { multiplex: true Artifact { filePath: "properties.json" fileTags: ["properties"] } prepare: { var cmd = new JavaScriptCommand(); cmd.outputFilePath = outputs.properties[0].filePath; cmd.toolchain = product.qbs.toolchain; cmd.architecture = product.qbs.architecture; cmd.silent = true; cmd.sourceCode = function () { var tf = new TextFile(outputFilePath, TextFile.WriteOnly); try { const data = { "qbs.toolchain": toolchain, "qbs.architecture": architecture, }; tf.writeLine(JSON.stringify(data, undefined, 4)); } finally { tf.close(); } }; return [cmd]; } } } StaticLibrary { name : "testa" files : [ "testa.s" ] Depends { name: "cpp" } condition: qbs.toolchain.includes("gcc") Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } StaticLibrary { name : "testb" files : [ "testb.S" ] Depends { name: "cpp" } condition: qbs.toolchain.includes("gcc") Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } StaticLibrary { name : "testc" files : [ "testc.sx" ] Depends { name: "cpp" } condition: qbs.toolchain.includes("gcc") Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } StaticLibrary { name: "testd" Group { condition: product.condition files: ["testd_" + qbs.architecture + ".asm"] } Depends { name: "cpp" } condition: qbs.toolchain.includes("msvc") && (qbs.architecture === "x86" || qbs.architecture === "x86_64") Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/assembly/testa.s0000644000175100017510000000004015154533055023327 0ustar runnerrunner.globl symbola symbola: nop qbs-src-3.2.0/tests/auto/blackbox/testdata/assembly/testd_x86_64.asm0000644000175100017510000000005615154533055024675 0ustar runnerrunner.code foo PROC nop RET foo ENDP END qbs-src-3.2.0/tests/auto/blackbox/testdata/assembly/testd_x86.asm0000644000175100017510000000011115154533055024354 0ustar runnerrunner.386 .model flat, stdcall .code foo PROC nop RET foo ENDP END qbs-src-3.2.0/tests/auto/blackbox/testdata/conditional-filetagger/0000755000175100017510000000000015154533055024624 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/conditional-filetagger/main.custom0000644000175100017510000000001715154533055027002 0ustar runnerrunnerint main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/conditional-filetagger/conditional-filetagger.qbs0000644000175100017510000000032015154533055031740 0ustar runnerrunnerCppApplication { name: "theApp" property bool enableTagger files: ["main.custom"] FileTagger { condition: enableTagger patterns: ["*.custom"] fileTags: ["cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackExternalProductChanges/0000755000175100017510000000000015154533055025653 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/trackExternalProductChanges/main.cpp0000644000175100017510000000235215154533055027305 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/trackExternalProductChanges/trackExternalProductChanges.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/trackExternalProductChanges/trackExternalProductChanges.q0000644000175100017510000000125315154533055033477 0ustar runnerrunnerimport qbs.Environment import "fileList.js" as FileList CppApplication { property stringList filesFromEnv: Environment.getEnv("QBS_TEST_PULL_IN_FILE_VIA_ENV") ? ["environmentChange.cpp"] : [] files: ["main.cpp"].concat(FileList.fileList()).concat(filesFromEnv).concat(FileList.filesFromFs(path)) Group { condition: Environment.getEnv("INCLUDE_PATH_TEST") name: "file that needs help from the environment to find a header" files: "including.cpp" } Probe { id: checker property bool isGcc: qbs.toolchain.contains("gcc") configure: { console.info("is gcc: " + isGcc); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackExternalProductChanges/environmentChange.cpp0000644000175100017510000000237015154533055032033 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void environmentChange() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackExternalProductChanges/fileList.js0000644000175100017510000000025515154533055027766 0ustar runnerrunnervar File = require("qbs.File"); function fileList() { return []; } function filesFromFs(path) { return File.exists(path + "/fileExists.cpp") ? ["fileExists.cpp"] : []; } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackExternalProductChanges/including.cpp0000644000175100017510000000240515154533055030334 0ustar runnerrunner/**************************************************************************** ** ** 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 void f() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/trackExternalProductChanges/jsFileChange.cpp0000644000175100017510000000236315154533055030705 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void jsFileChange() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackExternalProductChanges/hidden/0000755000175100017510000000000015154533055027106 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/trackExternalProductChanges/hidden/hiddenheaderqbs.h0000644000175100017510000000233215154533055032371 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ qbs-src-3.2.0/tests/auto/blackbox/testdata/rule-with-non-required-inputs/0000755000175100017510000000000015154533055026060 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/rule-with-non-required-inputs/b.inp0000644000175100017510000000000015154533055026777 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/rule-with-non-required-inputs/c.inp0000644000175100017510000000000015154533055027000 0ustar runnerrunner././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/rule-with-non-required-inputs/rule-with-non-required-inputs.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/rule-with-non-required-inputs/rule-with-non-required-inpu0000644000175100017510000000200415154533055033276 0ustar runnerrunnerimport qbs.TextFile Product { name: "p" type: ["p.out"] property bool enableTagger FileTagger { condition: enableTagger patterns: ["*.inp"] fileTags: ["p.in"] } Rule { multiplex: true requiresInputs: false inputs: ["p.in"] Artifact { filePath: "output.txt" fileTags: ["p.out"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.write('('); var inputsList = inputs["p.in"]; if (inputsList) { for (var i = 0; i < inputsList.length; ++i) f.write(inputsList[i].fileName + ','); } f.write(')'); }; return [cmd]; } } files: ["a.inp", "b.inp", "c.inp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/rule-with-non-required-inputs/a.inp0000644000175100017510000000000015154533055026776 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-dependency-in-disabled-product/0000755000175100017510000000000015154533055030007 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-dependency-in-disabled-product/main.cpp0000644000175100017510000000001615154533055031434 0ustar runnerrunnerint main() {} ././@LongLink0000644000000000000000000000017700000000000011610 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-dependency-in-disabled-product/exported-dependency-in-disabled-product.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-dependency-in-disabled-product/exported-dependen0000644000175100017510000000065115154533055033346 0ustar runnerrunnerProject { Application { name: "app" Depends { name: "dep"; required: false } files: "main.cpp" } Product { name: "dep" condition: eval(conditionString) property string conditionString Depends { name: "nosuchmodule"; required: false } Depends { name: "broken"; required: false } Export { Depends { name: "cpp" } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/exported-dependency-in-disabled-product/modules/0000755000175100017510000000000015154533055031457 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-dependency-in-disabled-product/modules/broken/0000755000175100017510000000000015154533055032737 5ustar runnerrunner././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-dependency-in-disabled-product/modules/broken/broken.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-dependency-in-disabled-product/modules/broken/br0000644000175100017510000000005615154533055033266 0ustar runnerrunnerModule { validate: { throw "broken!"; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/check-timestamps/0000755000175100017510000000000015154533055023453 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/check-timestamps/main.cpp0000644000175100017510000000001615154533055025100 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/check-timestamps/file.h0000644000175100017510000000001215154533055024534 0ustar runnerrunnervoid f(); qbs-src-3.2.0/tests/auto/blackbox/testdata/check-timestamps/file.cpp0000644000175100017510000000004015154533055025070 0ustar runnerrunner#include "file.h" void f() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/check-timestamps/check-timestamps.qbs0000644000175100017510000000016015154533055027420 0ustar runnerrunnerCppApplication { name: "app" files: [ "file.cpp", "file.h", "main.cpp", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-other-product/0000755000175100017510000000000015154533055025653 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-other-product/lib/0000755000175100017510000000000015154533055026421 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-other-product/lib/lib.qbs0000644000175100017510000000021515154533055027674 0ustar runnerrunnerProduct { files: "lib.h" Export { Depends { name: "cpp" } cpp.includePaths: exportingProduct.sourceDirectory } } qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-other-product/lib/lib.h0000644000175100017510000000003615154533055027337 0ustar runnerrunner#pragma once void lib1_foo();qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-other-product/app/0000755000175100017510000000000015154533055026433 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-other-product/app/main.cpp0000644000175100017510000000004115154533055030056 0ustar runnerrunner#include "app.h" int main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-other-product/app/app.h0000644000175100017510000000002115154533055027355 0ustar runnerrunner#include "lib.h" qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-other-product/app/app.qbs0000644000175100017510000000010515154533055027716 0ustar runnerrunnerCppApplication { Depends { name: "lib" } files: "main.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-other-product/other/0000755000175100017510000000000015154533055026774 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-other-product/other/other.qbs0000644000175100017510000000107715154533055030631 0ustar runnerrunnerimport qbs.TextFile Product { type: "testproduct" files: "../lib/lib.h" Rule { multiplex: true Artifact { fileTags: ["testproduct"] filePath: "fubar" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating text file"; cmd.sourceCode = function() { var tf = new TextFile(output.filePath, TextFile.WriteOnly); tf.writeLine("blubb"); tf.close(); } return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-other-product/p.qbs0000644000175100017510000000015515154533055026622 0ustar runnerrunnerProject { references: [ "app/app.qbs", "lib/lib.qbs", "other/other.qbs", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-locations/0000755000175100017510000000000015154533055023651 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-locations/main.cpp0000644000175100017510000000001615154533055025276 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/install-locations/data/0000755000175100017510000000000015154533055024562 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-locations/data/mingw.json0000644000175100017510000000246215154533055026602 0ustar runnerrunner{ "app": { "fileName": "theapp.exe", "defaultInstallDir": "/bin", "customInstallDir": "bindir", "subDir": "" }, "appDsym": { "fileName": "theapp.exe.debug", "defaultInstallDir": "/bin", "customInstallDir": "dsymDir", "subDir": "" }, "dll": { "fileName": "thelib.dll", "defaultInstallDir": "/bin", "customInstallDir": "bindir", "subDir": "" }, "dllDsym": { "fileName": "thelib.dll.debug", "defaultInstallDir": "/bin", "customInstallDir": "dsymDir", "subDir": "" }, "lib": { "fileName": "thelib.lib", "defaultInstallDir": "/lib", "customInstallDir": "libdir", "subDir": "" }, "plugin": { "fileName": "theplugin.dll", "defaultInstallDir": "/lib/install-locations/plugins/", "customInstallDir": "pluginDir", "subDir": "" }, "pluginDsym": { "fileName": "theplugin.dll.debug", "defaultInstallDir": "/lib/install-locations/plugins/", "customInstallDir": "dsymDir", "subDir": "" }, "loadableModule": { "fileName": "theloadablemodule.dll", "defaultInstallDir": "/bin", "customInstallDir": "bindir", "subDir": "" }, "loadableModuleDsym": { "fileName": "theloadablemodule.dll.debug", "defaultInstallDir": "/bin", "customInstallDir": "dsymDir", "subDir": "" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-locations/data/emscripten.json0000644000175100017510000000133515154533055027630 0ustar runnerrunner{ "app": { "fileName": "theapp.js", "defaultInstallDir": "/bin", "customInstallDir": "bindir", "subDir": "" }, "appDsym": { "fileName": "theapp.wasm.debug.wasm", "defaultInstallDir": "/bin", "customInstallDir": "dsymDir", "subDir": "" }, "dll": { "fileName": "libthelib.so", "defaultInstallDir": "/lib", "customInstallDir": "libdir", "subDir": "" }, "plugin": { "fileName": "libtheplugin.so", "defaultInstallDir": "/lib/install-locations/plugins/", "customInstallDir": "pluginDir", "subDir": "" }, "loadableModule": { "fileName": "libtheloadablemodule.so", "defaultInstallDir": "/lib", "customInstallDir": "libdir", "subDir": "" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-locations/data/darwin.json0000644000175100017510000000247615154533055026752 0ustar runnerrunner{ "app": { "fileName": "theapp", "defaultInstallDir": "/Applications", "customInstallDir": "bindir", "subDir": "theapp.app" }, "appDsym": { "fileName": "theapp.app.dSYM", "defaultInstallDir": "/Applications", "customInstallDir": "dsymDir", "subDir": "" }, "dll": { "fileName": "thelib", "defaultInstallDir": "/Library/Frameworks", "customInstallDir": "libdir", "subDir": "thelib.framework" }, "dllDsym": { "fileName": "thelib.framework.dSYM", "defaultInstallDir": "/Library/Frameworks", "customInstallDir": "dsymDir", "subDir": "" }, "plugin": { "fileName": "theplugin", "defaultInstallDir": "/Library/Install-Locations/PlugIns", "customInstallDir": "pluginDir", "subDir": "theplugin.bundle" }, "pluginDsym": { "fileName": "theplugin.bundle.dSYM", "defaultInstallDir": "/Library/Install-Locations/PlugIns", "customInstallDir": "dsymDir", "subDir": "" }, "loadableModule": { "fileName": "theloadablemodule", "defaultInstallDir": "/Library/Frameworks", "customInstallDir": "libdir", "subDir": "theloadablemodule.bundle" }, "loadableModuleDsym": { "fileName": "theloadablemodule.bundle.dSYM", "defaultInstallDir": "/Library/Frameworks", "customInstallDir": "dsymDir", "subDir": "" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-locations/data/msvc.json0000644000175100017510000000243215154533055026426 0ustar runnerrunner{ "app": { "fileName": "theapp.exe", "defaultInstallDir": "/bin", "customInstallDir": "bindir", "subDir": "" }, "appDsym": { "fileName": "theapp.pdb", "defaultInstallDir": "/bin", "customInstallDir": "dsymDir", "subDir": "" }, "dll": { "fileName": "thelib.dll", "defaultInstallDir": "/bin", "customInstallDir": "bindir", "subDir": "" }, "dllDsym": { "fileName": "thelib.pdb", "defaultInstallDir": "/bin", "customInstallDir": "dsymDir", "subDir": "" }, "lib": { "fileName": "thelib.lib", "defaultInstallDir": "/lib", "customInstallDir": "libdir", "subDir": "" }, "plugin": { "fileName": "theplugin.dll", "defaultInstallDir": "/lib/install-locations/plugins/", "customInstallDir": "pluginDir", "subDir": "" }, "pluginDsym": { "fileName": "theplugin.pdb", "defaultInstallDir": "/lib/install-locations/plugins/", "customInstallDir": "dsymDir", "subDir": "" }, "loadableModule": { "fileName": "theloadablemodule.dll", "defaultInstallDir": "/bin", "customInstallDir": "bindir", "subDir": "" }, "loadableModuleDsym": { "fileName": "theloadablemodule.pdb", "defaultInstallDir": "/bin", "customInstallDir": "dsymDir", "subDir": "" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-locations/data/unix.json0000644000175100017510000000226415154533055026444 0ustar runnerrunner{ "app": { "fileName": "theapp", "defaultInstallDir": "/bin", "customInstallDir": "bindir", "subDir": "" }, "appDsym": { "fileName": "theapp.debug", "defaultInstallDir": "/bin", "customInstallDir": "dsymDir", "subDir": "" }, "dll": { "fileName": "libthelib.so", "defaultInstallDir": "/lib", "customInstallDir": "libdir", "subDir": "" }, "dllDsym": { "fileName": "libthelib.so.debug", "defaultInstallDir": "/lib", "customInstallDir": "dsymDir", "subDir": "" }, "plugin": { "fileName": "libtheplugin.so", "defaultInstallDir": "/lib/install-locations/plugins/", "customInstallDir": "pluginDir", "subDir": "" }, "pluginDsym": { "fileName": "libtheplugin.so.debug", "defaultInstallDir": "/lib/install-locations/plugins/", "customInstallDir": "dsymDir", "subDir": "" }, "loadableModule": { "fileName": "libtheloadablemodule.so", "defaultInstallDir": "/lib", "customInstallDir": "libdir", "subDir": "" }, "loadableModuleDsym": { "fileName": "libtheloadablemodule.so.debug", "defaultInstallDir": "/lib", "customInstallDir": "dsymDir", "subDir": "" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-locations/data/macos.json0000644000175100017510000000255315154533055026564 0ustar runnerrunner{ "app": { "fileName": "theapp", "defaultInstallDir": "/Applications", "customInstallDir": "bindir", "subDir": "theapp.app/Contents/MacOS" }, "appDsym": { "fileName": "theapp.app.dSYM", "defaultInstallDir": "/Applications", "customInstallDir": "dsymDir", "subDir": "" }, "dll": { "fileName": "thelib", "defaultInstallDir": "/Library/Frameworks", "customInstallDir": "libdir", "subDir": "thelib.framework" }, "dllDsym": { "fileName": "thelib.framework.dSYM", "defaultInstallDir": "/Library/Frameworks", "customInstallDir": "dsymDir", "subDir": "" }, "plugin": { "fileName": "theplugin", "defaultInstallDir": "/Library/Install-Locations/PlugIns", "customInstallDir": "pluginDir", "subDir": "theplugin.bundle/Contents/MacOS" }, "pluginDsym": { "fileName": "theplugin.bundle.dSYM", "defaultInstallDir": "/Library/Install-Locations/PlugIns", "customInstallDir": "dsymDir", "subDir": "" }, "loadableModule": { "fileName": "theloadablemodule", "defaultInstallDir": "/Library/Frameworks", "customInstallDir": "libdir", "subDir": "theloadablemodule.bundle/Contents/MacOS" }, "loadableModuleDsym": { "fileName": "theloadablemodule.bundle.dSYM", "defaultInstallDir": "/Library/Frameworks", "customInstallDir": "dsymDir", "subDir": "" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-locations/thelib.cpp0000644000175100017510000000007015154533055025621 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void libFunc() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/install-locations/install-locations.qbs0000644000175100017510000000273315154533055030024 0ustar runnerrunnerProject { name: "Install-Locations" property bool dummy: { var toolchain = "unknown"; if (qbs.toolchain.includes("emscripten")) { toolchain = "emscripten"; } else if (qbs.targetOS.includes("darwin")) { if (qbs.targetOS.includes("macos")) toolchain = "macos"; else toolchain = "darwin"; } else if (qbs.targetOS.includes("windows")) { if (qbs.toolchain.includes("mingw")) toolchain = "mingw"; else toolchain = "msvc"; } else { toolchain = "unix"; } console.info("===toolchain:" + toolchain + "==="); } CppApplication { name: "theapp" files: "main.cpp" cpp.separateDebugInformation: true Group { fileTagsFilter: "application" fileTags: "some-tag" } } DynamicLibrary { name: "thelib" installImportLib: true Depends { name: "cpp" } cpp.separateDebugInformation: true files: "thelib.cpp" } LoadableModule { name: "theloadablemodule" Depends { name: "cpp" } cpp.separateDebugInformation: true files: "theplugin.cpp" } Project { name: "subproject" Plugin { name: "theplugin" Depends { name: "cpp" } cpp.separateDebugInformation: true files: "theplugin.cpp" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-locations/theplugin.cpp0000644000175100017510000000007315154533055026354 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void pluginFunc() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/soversion/0000755000175100017510000000000015154533055022241 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/soversion/soversion.qbs0000644000175100017510000000041015154533055024772 0ustar runnerrunnerDynamicLibrary { name: "mylib" property bool useVersion property bool dummy: { console.info("is emscripten: " + qbs.toolchain.includes("emscripten")); } version: useVersion ? "1.2.3" : undefined Depends { name: "cpp" } files: ["lib.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/soversion/lib.cpp0000644000175100017510000000001515154533055023507 0ustar runnerrunnervoid f() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/0000755000175100017510000000000015154533055026445 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/main.cpp0000644000175100017510000000237415154533055030103 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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 "pch.h" int main() { } ././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/precompiled-headers-and-redefine.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/precompiled-headers-and-0000644000175100017510000000057615154533055033131 0ustar runnerrunnerCppApplication { name: "MyApp" consoleApplication: true Group { files: ["pch.h"] fileTags: ["cpp_pch_src"] } Group { files: ["file.cpp"] cpp.defines: ["MYDEF=1"] cpp.cxxFlags: base.concat(qbs.toolchain.includes("clang-cl") ? ["-Wno-clang-cl-pch"] : []) } cpp.treatWarningsAsErrors: true files: ["main.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/file.cpp0000644000175100017510000000002115154533055030061 0ustar runnerrunner#include "pch.h" qbs-src-3.2.0/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/pch.h0000644000175100017510000000240215154533055027366 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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 #include qbs-src-3.2.0/tests/auto/blackbox/testdata/dependenciesProperty/0000755000175100017510000000000015154533055024405 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dependenciesProperty/product2.cpp0000644000175100017510000000236415154533055026660 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/dependenciesProperty/dependenciesProperty.qbs0000644000175100017510000000240315154533055031306 0ustar runnerrunnerimport qbs.TextFile import qbs.FileInfo Project { Product { name: "newDependency" } Product { type: "deps" name: "product1" Depends { name: "product2" } // Depends { name: 'product2' } // Depends { name: 'newDependency' } Rule { multiplex: true inputsFromDependencies: "application" Artifact { fileTags: ["deps"] filePath: product.name + '.deps' } prepare: { var cmd = new JavaScriptCommand(); cmd.description = 'generating ' + FileInfo.fileName(output.filePath); cmd.highlight = 'codegen'; cmd.sourceCode = function() { file = new TextFile(output.filePath, TextFile.WriteOnly); file.truncate(); file.write(JSON.stringify(product.dependencies, undefined, 2)); file.close(); } return cmd; } } } Product { type: "application" consoleApplication: true name: "product2" property string narf: "zort" Depends { name: "cpp" } cpp.defines: ["SMURF"] files: ["product2.cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/list-products/0000755000175100017510000000000015154533055023026 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-products/list-products.qbs0000644000175100017510000000043615154533055026354 0ustar runnerrunnerProject { Product { name: "a" } Product { name: "b" multiplexByQbsProperties: ["architectures", "buildVariants"] qbs.architectures: ["mips", "vax"] qbs.buildVariants: ["debug", "release"] } Product { name: "c" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/enableExceptions/0000755000175100017510000000000015154533055023502 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/enableExceptions/main.cpp0000644000175100017510000000300315154533055025126 0ustar runnerrunner/**************************************************************************** ** ** 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 #if defined(__GNUC__) && !(defined(__cpp_exceptions) || defined(__EXCEPTIONS)) #error Exceptions are disabled! #endif int main() { #ifdef FORCE_FAIL_VS #error "Microsoft Visual C++ cannot disable exceptions at compile-time" #endif throw std::runtime_error("failed"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/enableExceptions/empty.m0000644000175100017510000000003215154533055025011 0ustar runnerrunnerint main2() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/enableExceptions/empty.mm0000644000175100017510000000003215154533055025166 0ustar runnerrunnerint main3() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/enableExceptions/exceptions-objc.qbs0000644000175100017510000000011415154533055027301 0ustar runnerrunnerCppApplication { files: ["main.m"] cpp.frameworks: ["Foundation"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/enableExceptions/emptymain.cpp0000644000175100017510000000236415154533055026216 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/enableExceptions/exceptions.qbs0000644000175100017510000000026115154533055026371 0ustar runnerrunnerCppApplication { files: ["main.cpp"] cpp.treatWarningsAsErrors: true cpp.defines: qbs.toolchain.includes("msvc") && !cpp.enableExceptions ? ["FORCE_FAIL_VS"] : [] } qbs-src-3.2.0/tests/auto/blackbox/testdata/enableExceptions/none.qbs0000644000175100017510000000023515154533055025150 0ustar runnerrunnerCppApplication { files: ["emptymain.cpp"] Group { condition: qbs.targetOS.includes("darwin") files: ["empty.m", "empty.mm"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/enableExceptions/main.m0000644000175100017510000000011415154533055024600 0ustar runnerrunner#import int main() { @throw [NSError new]; } qbs-src-3.2.0/tests/auto/blackbox/testdata/enableExceptions/exceptions-objcpp-cpp.qbs0000644000175100017510000000013615154533055030425 0ustar runnerrunnerCppApplication { Group { files: ["main.cpp"] fileTags: ["objcpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/enableExceptions/exceptions-objcpp.qbs0000644000175100017510000000017715154533055027652 0ustar runnerrunnerCppApplication { Group { files: ["main.m"] fileTags: ["objcpp"] } cpp.frameworks: ["Foundation"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/no-profile/0000755000175100017510000000000015154533055022264 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/no-profile/no-profile.qbs0000644000175100017510000000012615154533055025044 0ustar runnerrunnerProduct { property bool dummy: { console.info("profile: " + project.profile); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/product-dependencies-by-type/0000755000175100017510000000000015154533055025705 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/product-dependencies-by-type/main.cpp0000644000175100017510000000235115154533055027336 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/product-dependencies-by-type/product-dependencies-by-type.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/product-dependencies-by-type/product-dependencies-by-type0000644000175100017510000001042615154533055033326 0ustar runnerrunnerimport qbs.TextFile Project { CppApplication { consoleApplication: true name: "no-match" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } files: "main.cpp" } Project { CppApplication { consoleApplication: true name: "app1" files: "main.cpp" } CppApplication { consoleApplication: true name: "app2" files: "main.cpp" } CppApplication { consoleApplication: true name: "app3" files: "main.cpp" } Product { type: myconfig.typeDecider ? ["application"] : [] Depends { name: "cpp" } Depends { name: "myconfig" } consoleApplication: true name: "app4" files: "main.cpp" } Product { name: "other-product" type: "other" Rule { multiplex: true Artifact { filePath: "output.txt" fileTags: "other" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.filePath; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); } return cmd; } } Export { Depends { productTypes: "other2" } } } Product { name: "yet-another-product" type: "other2" Rule { multiplex: true Artifact { filePath: "output.txt" fileTags: "other2" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.filePath; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); } return cmd; } } } Product { name: "helper" Export { Depends { productTypes: "other" } } } CppApplication { condition: false consoleApplication: true name: "disabled-app" files: "main.cpp" } DynamicLibrary { Depends { name: "cpp" } name: "lib-product" files: "main.cpp" Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } CppApplication { type: base.concat(["app-list"]) consoleApplication: true name: "app list" Depends { productTypes: ["application"] limitToSubProject: true } Depends { name: "helper" } files: ["main.cpp"] Rule { multiplex: true inputsFromDependencies: ["application", "other", "other2"] Artifact { filePath: "app-list.txt" fileTags: "app-list" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "collecting apps"; cmd.sourceCode = function() { var file = new TextFile(output.filePath, TextFile.WriteOnly); for (var i = 0; i < inputs["application"].length; ++i) file.writeLine(inputs["application"][i].filePath); for (i = 0; i < inputs["other"].length; ++i) file.writeLine(inputs["other"][i].filePath); for (i = 0; i < inputs["other2"].length; ++i) file.writeLine(inputs["other2"][i].filePath); file.close(); }; return cmd; } } } Product { name: "dummy" Depends { productTypes: [] } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/product-dependencies-by-type/modules/0000755000175100017510000000000015154533055027355 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/product-dependencies-by-type/modules/myconfig/0000755000175100017510000000000015154533055031170 5ustar runnerrunner././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/product-dependencies-by-type/modules/myconfig/myconfig.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/product-dependencies-by-type/modules/myconfig/myconfig.qb0000644000175100017510000000005715154533055033331 0ustar runnerrunnerModule { property bool typeDecider: true } qbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/0000755000175100017510000000000015154533055025063 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/pkg-config.qbs0000644000175100017510000000077615154533055027630 0ustar runnerrunnerProject { property string packageBaseName Product { name: "theProduct1" type: ["theType"] Depends { name: "themodule" } qbs.sysroot: path + "/sysroot1" } Product { name: "theProduct2" type: ["theType"] Depends { name: "themodule" } qbs.sysroot: path + "/sysroot2" } Product { name: "theProduct3" type: ["theType"] Depends { name: "themodule" } qbs.sysroot: path + "/sysroot1" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/sysroot1/0000755000175100017510000000000015154533055026666 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/sysroot1/usr/0000755000175100017510000000000015154533055027477 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/sysroot1/usr/share/0000755000175100017510000000000015154533055030601 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/sysroot1/usr/share/pkgconfig/0000755000175100017510000000000015154533055032550 5ustar runnerrunner././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/sysroot1/usr/share/pkgconfig/dummy.pcqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/sysroot1/usr/share/pkgconfig/dum0000644000175100017510000000014715154533055033262 0ustar runnerrunnerName: dummy1 Description: dummy1 package Version: 0.0.1 Requires: Libs: -L/usr/dummy -ldummy1 Cflags: qbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/sysroot2/0000755000175100017510000000000015154533055026667 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/sysroot2/usr/0000755000175100017510000000000015154533055027500 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/sysroot2/usr/share/0000755000175100017510000000000015154533055030602 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/sysroot2/usr/share/pkgconfig/0000755000175100017510000000000015154533055032551 5ustar runnerrunner././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/sysroot2/usr/share/pkgconfig/dummy.pcqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/sysroot2/usr/share/pkgconfig/dum0000644000175100017510000000014715154533055033263 0ustar runnerrunnerName: dummy1 Description: dummy1 package Version: 0.0.1 Requires: Libs: -L/usr/dummy -ldummy1 Cflags: qbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/modules/0000755000175100017510000000000015154533055026533 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/modules/themodule/0000755000175100017510000000000015154533055030521 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pkg-config-probe-sysroot/modules/themodule/themodule.qbs0000644000175100017510000000100215154533055033207 0ustar runnerrunnerimport qbs.Probes Module { Probes.PkgConfigProbe { id: theProbe name: "dummy" } property stringList libs: theProbe.libs Rule { multiplex: true outputFileTags: "theType" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.info(product.name + " libs: " + JSON.stringify(product.themodule.libs)); } return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/rpathlink-deduplication/0000755000175100017510000000000015154533055025030 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/rpathlink-deduplication/rpathlink-deduplication-lib.cpp0000644000175100017510000000004315154533055033113 0ustar runnerrunnerint dynamicFunc() { return 1; }qbs-src-3.2.0/tests/auto/blackbox/testdata/rpathlink-deduplication/rpathlink-deduplication-main.cpp0000644000175100017510000000010315154533055033266 0ustar runnerrunnerextern int dynamicFunc(); int main() { return dynamicFunc(); }qbs-src-3.2.0/tests/auto/blackbox/testdata/rpathlink-deduplication/rpathlink-deduplication.qbs0000644000175100017510000000241615154533055032360 0ustar runnerrunnerProject { DynamicLibrary { Depends { name: "bundle" } Depends { name: "cpp" } bundle.isBundle: false name: "DynamicLibraryA" files: ["rpathlink-deduplication-lib.cpp"] } DynamicLibrary { Depends { name: "bundle" } Depends { name: "cpp" } Depends { name: "DynamicLibraryA" } bundle.isBundle: false name: "DynamicLibraryB" files: ["rpathlink-deduplication-lib.cpp"] } DynamicLibrary { Depends { name: "bundle" } Depends { name: "cpp" } Depends { name: "DynamicLibraryA" } bundle.isBundle: false name: "DynamicLibraryC" files: ["rpathlink-deduplication-lib.cpp"] } CppApplication { Depends { name: "bundle" } Depends { name: "DynamicLibraryB" } Depends { name: "DynamicLibraryC" } consoleApplication: true bundle.isBundle: false cpp.removeDuplicateLibraries: false files: "rpathlink-deduplication-main.cpp" property bool test: { if (cpp.useRPathLink) console.info("useRPathLink: true"); else console.info("useRPathLink: false"); console.info("===" + cpp.rpathLinkFlag + "==="); } } }qbs-src-3.2.0/tests/auto/blackbox/testdata/exported-property-in-disabled-product/0000755000175100017510000000000015154533055027555 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-property-in-disabled-product/main.cpp0000644000175100017510000000001615154533055031202 0ustar runnerrunnerint main() {} ././@LongLink0000644000000000000000000000017300000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-property-in-disabled-product/exported-property-in-disabled-product.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-property-in-disabled-product/exported-property-i0000644000175100017510000000073415154533055033446 0ustar runnerrunnerProject { CppApplication { name: "app" Depends { name: "dep"; required: false } files: "main.cpp" } Product { name: "dep" condition: eval(conditionString) property string conditionString Depends { name: "nosuchmodule"; required: false } Depends { name: "broken"; required: false } Export { Depends { name: "cpp" } cpp.dynamicLibraries: ["nosuchlib"] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/exported-property-in-disabled-product/modules/0000755000175100017510000000000015154533055031225 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-property-in-disabled-product/modules/broken/0000755000175100017510000000000015154533055032505 5ustar runnerrunner././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-property-in-disabled-product/modules/broken/broken.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/exported-property-in-disabled-product/modules/broken/brok0000644000175100017510000000005615154533055033366 0ustar runnerrunnerModule { validate: { throw "broken!"; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cli/0000755000175100017510000000000015154533055020761 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cli/Libby2.cs0000755000175100017510000000020315154533055022431 0ustar runnerrunnernamespace Fake { public class Libby2 { public static int Cool() { return 22; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cli/dotnettest.qbs0000644000175100017510000000213515154533055023666 0ustar runnerrunnerProject { Application { Depends { name: "cli" } Depends { name: "HelloWorldModule"; condition: !qbs.toolchain.includes("mono") } Depends { name: "NetLib" } type: "application" name: "Hello" files: ["HelloWorld.cs"] Group { fileTagsFilter: product.type qbs.install: true } } // Mono's VB compiler doesn't support modules yet, and if we try with C#, it crashes anyways NetModule { condition: !qbs.toolchain.includes("mono") Depends { name: "cli" } name: "HelloWorldModule" files: ["Module.vb"] Group { fileTagsFilter: product.type qbs.install: true } } DynamicLibrary { Depends { name: "cli" } name: "NetLib" files: ["Libby.cs", "Libby2.cs"] // fill-in for missing NetModule Group { condition: qbs.toolchain.includes("mono") files: ["Module.cs"] } Group { fileTagsFilter: product.type qbs.install: true } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cli/Libby.cs0000755000175100017510000000020215154533055022346 0ustar runnerrunnernamespace Fake { public class Libby { public static int Cool() { return 45; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cli/HelloWorld.cs0000755000175100017510000000042415154533055023366 0ustar runnerrunnerusing Fake; public class HelloWorld { public static void Main() { System.Console.WriteLine("Hello world!"); System.Console.WriteLine(Mod.Cool()); System.Console.WriteLine(Libby.Cool()); System.Console.WriteLine(Libby2.Cool()); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cli/Module.vb0000755000175100017510000000023715154533055022544 0ustar runnerrunnerNamespace Fake Public Class [Mod] Public Shared Function Cool() As Integer Return 420 End Function End Class End Namespace qbs-src-3.2.0/tests/auto/blackbox/testdata/cli/Module.cs0000644000175100017510000000020115154533055022526 0ustar runnerrunnernamespace Fake { public class Mod { public static int Cool() { return 420; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cli/fshello.qbs0000644000175100017510000000016015154533055023121 0ustar runnerrunnerApplication { Depends { name: "cli" } type: "application" name: "fshello" files: "fshello.fs" } qbs-src-3.2.0/tests/auto/blackbox/testdata/cli/fshello.fs0000644000175100017510000000003715154533055022747 0ustar runnerrunnerprintfn "Hello World from F#!" qbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-invalidation/0000755000175100017510000000000015154533055025424 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-invalidation/artifacts-map-invalidation.qbs0000644000175100017510000000420215154533055033343 0ustar runnerrunnerimport qbs.File Project { Product { name: "dep" type: "dep.out" Group { files: "file.in" fileTags: "dep.in" } Rule { inputs: "dep.in" outputFileTags: "dep.out" outputArtifacts: { if (!product.artifacts["dep.in"] || product.artifacts["dep.in"].length !== 1) throw "source file not in artifacts map!" if (product.artifacts["dep.out"] && product.artifacts["dep.out"].length !== 0) throw "generated artifact already in map!"; return [{filePath: "file.out", fileTags: "dep.out"}]; } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return cmd; } } } Product { name: "p" type: "p.out" Depends { name: "dep" } Rule { inputsFromDependencies: "dep.out" Artifact { filePath: "myfile.out"; fileTags: "p.out" } prepare: { var dep; for (var i = 0; i < product.dependencies.length; ++i) { if (product.dependencies[i].name === "dep") { dep = product.dependencies[i]; break; } } if (!dep) throw "dependency not found"; if (!dep.artifacts["dep.in"] || dep.artifacts["dep.in"].length !== 1) throw "source file not in dependency's artifacts map!" if (!dep.artifacts["dep.out"] || dep.artifacts["dep.out"].length !== 1) throw "generated artifact not in dependency's artifacts map!"; var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-invalidation/file.in0000644000175100017510000000000015154533055026661 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-file/0000755000175100017510000000000015154533055023663 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-file/file.qbs0000644000175100017510000000506515154533055025317 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.TextFile Product { type: ["dummy"] Rule { multiplex: true outputFileTags: "dummy" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var origPath = FileInfo.joinPaths(product.sourceDirectory, "original.txt"); var copyPath = FileInfo.joinPaths(product.sourceDirectory, "copy.txt"); console.info("copy path: "+copyPath); var original = new TextFile(origPath, TextFile.WriteOnly); original.close(); File.copy(origPath, copyPath); var origTimestamp = File.lastModified(origPath); var copyTimestamp = File.lastModified(copyPath); if (origTimestamp > copyTimestamp) throw new Error("Older file has newer timestamp."); File.remove(origPath); var copy = new TextFile(copyPath, TextFile.WriteOnly); copy.writeLine(File.exists(origPath)); copy.writeLine(File.exists(copyPath)); copy.close(); var zePath = FileInfo.joinPaths(product.sourceDirectory, "zePath"); if (File.exists(zePath)) throw new Error(zePath + " already exists."); var created = File.makePath(zePath); if (!created || !File.exists(zePath)) throw new Error("zePath was not created."); var entries = File.directoryEntries(product.sourceDirectory, File.AllEntries | File.NoDotAndDotDot); if (entries.length < 3 || !entries.includes("file.qbs")) throw new Error("Directory did not contain file.qbs"); entries = File.directoryEntries(product.sourceDirectory, File.Dirs | File.NoDotAndDotDot); if (entries.length < 1 || !entries.includes("zePath")) throw new Error("Directory did not contain only zePath"); var moveSource = FileInfo.joinPaths(product.sourceDirectory, "tomove.txt"); var moveTarget = FileInfo.joinPaths(product.sourceDirectory, "moved.txt"); File.move(moveSource, moveTarget); if (File.exists(moveSource)) throw new Error("Moved file still exists under old name"); if (!File.exists(moveTarget)) throw new Error("Moved file does not exist under new name"); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/recursive_wildcards/0000755000175100017510000000000015154533055024255 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/recursive_wildcards/recursive_wildcards.qbs0000644000175100017510000000226515154533055031034 0ustar runnerrunnerimport qbs.TextFile Product { type: ["txt.out"] qbs.installPrefix: "" Group { files: "dir/**" qbs.install: true qbs.installDir: "dir" } FileTagger { patterns: ["*.txt"] fileTags: ["txt.in"] } Rule { multiplex: true requiresInputs: false explicitlyDependsOn: ["txt.in"] Artifact { filePath: "output.txt" fileTags: product.type qbs.install: true } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { var inputList = explicitlyDependsOn["txt.in"]; var fileNameList = []; for (var i = 0; i < inputList.length; ++i) fileNameList.push(inputList[i].fileName); fileNameList.sort(); var f = new TextFile(output.filePath, TextFile.WriteOnly); try { f.write(fileNameList.join('')); } finally { f.close(); } }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/recursive_wildcards/dir/0000755000175100017510000000000015154533055025033 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/recursive_wildcards/dir/file1.txt0000644000175100017510000000000015154533055026562 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/recursive_wildcards/dir/subdir/0000755000175100017510000000000015154533055026323 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/recursive_wildcards/dir/subdir/file2.txt0000644000175100017510000000000015154533055030053 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/referenceErrorInExport/0000755000175100017510000000000015154533055024653 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/referenceErrorInExport/referenceErrorInExport.qbs0000644000175100017510000000054715154533055032031 0ustar runnerrunnerProject { CppApplication { Depends { name: "other" } files: ["main.c"] cpp.includePaths: ["."] } DynamicLibrary { name: "other" files: ["main.c"] property stringList includePaths: [] Export { Depends { name: "cpp" } cpp.includePaths: includePaths } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/referenceErrorInExport/main.c0000644000175100017510000000236415154533055025750 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/buildenv-change/0000755000175100017510000000000015154533055023245 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/buildenv-change/main.cpp0000644000175100017510000000004615154533055024675 0ustar runnerrunner#include int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/buildenv-change/file.c0000644000175100017510000000002415154533055024324 0ustar runnerrunnervoid func(void) { } qbs-src-3.2.0/tests/auto/blackbox/testdata/buildenv-change/buildenv-change.qbs0000644000175100017510000000052315154533055027007 0ustar runnerrunnerCppApplication { Probe { id: dummy property stringList toolchain: qbs.toolchain configure: { if (toolchain.includes("msvc")) console.info("msvc"); } } files: [ "file.c", "main.cpp", "subdir/theheader.h", "subdir2/theheader.h", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/buildenv-change/subdir/0000755000175100017510000000000015154533055024535 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/buildenv-change/subdir/theheader.h0000644000175100017510000000000015154533055026625 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/buildenv-change/subdir2/0000755000175100017510000000000015154533055024617 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/buildenv-change/subdir2/theheader.h0000644000175100017510000000000015154533055026707 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nested-properties/0000755000175100017510000000000015154533055023666 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nested-properties/product.qbs0000644000175100017510000000067415154533055026064 0ustar runnerrunnerProject { Product { name: "dep" Export { Depends { name: "lowerlevel" } lowerlevel.someOtherProp: "blubb" } } Product { type: "mytype" name: "toplevel" Depends { name: "higherlevel" } Depends { name: "lowerlevel" } Depends { name: "dep" } Group { files: ["dummy.txt"] fileTags: ["dummy-input"] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-properties/dummy.txt0000644000175100017510000000000015154533055025550 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nested-properties/modules/0000755000175100017510000000000015154533055025336 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nested-properties/modules/higherlevel/0000755000175100017510000000000015154533055027634 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nested-properties/modules/higherlevel/higher-level.qbs0000644000175100017510000000014415154533055032715 0ustar runnerrunnerModule { Depends { name: "lowerlevel" } lowerlevel.propDependency: "value in higherlevel" } qbs-src-3.2.0/tests/auto/blackbox/testdata/nested-properties/modules/lowerlevel/0000755000175100017510000000000015154533055027516 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nested-properties/modules/lowerlevel/lower-level.qbs0000644000175100017510000000076015154533055032465 0ustar runnerrunnerModule { property string propDependency: "value in lowerlevel module" property string prop: propDependency property string someOtherProp Rule { inputs: ["dummy-input"] outputFileTags: "mytype" prepare: { var cmd = new JavaScriptCommand(); cmd.sourceCode = function() { }; var prop = product.lowerlevel.prop; cmd.description = "lowerlevel.prop is '" + prop + "'"; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/property-assignment-in-failed-module/0000755000175100017510000000000015154533055027355 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/property-assignment-in-failed-module/main.cpp0000644000175100017510000000001615154533055031002 0ustar runnerrunnerint main() {} ././@LongLink0000644000000000000000000000017100000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/property-assignment-in-failed-module/property-assignment-in-failed-module.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/property-assignment-in-failed-module/property-assignment-0000644000175100017510000000014415154533055033406 0ustar runnerrunnerCppApplication { name: "app" Depends { name: "m"; required: false } files: "main.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/property-assignment-in-failed-module/modules/0000755000175100017510000000000015154533055031025 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/property-assignment-in-failed-module/modules/m/0000755000175100017510000000000015154533055031261 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/property-assignment-in-failed-module/modules/m/m.qbs0000644000175100017510000000026015154533055032222 0ustar runnerrunnerModule { property bool doFail Depends { name: "cpp" } cpp.dynamicLibraries: ["nosuchlib"] validate: { if (doFail) throw "Failure!"; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/configure/0000755000175100017510000000000015154533055022173 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/configure/main.cpp0000644000175100017510000000245515154533055023631 0ustar runnerrunner/**************************************************************************** ** ** 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 int main() { std::printf("%s..\n", TEXT); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/configure/configure.qbs0000644000175100017510000000110515154533055024660 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host Project { property bool enabled: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } property string name: 'configure' qbsSearchPaths: '.' Product { type: 'application' consoleApplication: true name: project.name files: 'main.cpp' Depends { name: 'cpp' } Depends { name: 'definition' } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/configure/modules/0000755000175100017510000000000015154533055023643 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/configure/modules/definition/0000755000175100017510000000000015154533055025773 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/configure/modules/definition/module.qbs0000644000175100017510000000166415154533055027776 0ustar runnerrunnerimport qbs.Process Module { name: 'definition' Depends { name: 'cpp' } Probe { id: node property stringList targetOS: qbs.targetOS property stringList windowsShellPath: qbs.windowsShellPath property string result configure: { var cmd; var args; var p = path; if (targetOS.includes("windows")) { cmd = windowsShellPath; args = ["/c", "date", "/t"]; } else { cmd = 'date'; args = []; } var p = new Process(); if (0 === p.exec(cmd, args)) { found = true; result = p.readLine(); } else { found = false; result = undefined; } p.close(); } } cpp.defines: node.found ? 'TEXT="Configured at ' + node.result + '"' : undefined } qbs-src-3.2.0/tests/auto/blackbox/testdata/installable-as-auxiliary-input/0000755000175100017510000000000015154533055026247 5ustar runnerrunner././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/installable-as-auxiliary-input/installable-as-auxiliary-input.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/installable-as-auxiliary-input/installable-as-auxiliary-i0000644000175100017510000000551415154533055033325 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.Host import qbs.TextFile Project { name: "p" CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "app" Depends { name: "installed-header" } Rule { multiplex: true auxiliaryInputsFromDependencies: ["installable"] Artifact { filePath: "main.cpp"; fileTags: "cpp" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.writeLine("#include "); f.writeLine("int main() {"); f.writeLine(" f();"); f.writeLine("}"); f.close(); }; return cmd; } } } Product { name: "installed-header" type: ["header"] property string installDir: "include" qbs.installPrefix: "" Group { fileTagsFilter: "header" qbs.install: true qbs.installDir: installDir } Export { Depends { name: "cpp" } cpp.includePaths: FileInfo.joinPaths(qbs.installRoot, exportingProduct.installDir); } Rule { multiplex: true Artifact { filePath: "theheader.h.in"; fileTags: "header.in" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { for (var i = 0; i < 1000; ++i) { // Artificial delay. var file = new TextFile(output.filePath, TextFile.WriteOnly); file.writeLine("#include "); file.writeLine("inline void f() {"); file.writeLine(' std::cout << "f-impl" << std::endl;'); file.writeLine("}"); file.close(); } }; return [cmd]; } } Rule { inputs: "header.in" Artifact { filePath: "theheader.h"; fileTags: "header" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return [cmd]; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/input-tags-change-tracking/0000755000175100017510000000000015154533055025330 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/input-tags-change-tracking/input-tags-change-tracking.qbs0000644000175100017510000000354715154533055033166 0ustar runnerrunnerimport qbs.TextFile Product { name: "p" type: "p_tag" property string generateInput Group { condition: generateInput == "no" files: "input.txt" fileTags: ["txt", "empty"] } Rule { condition: generateInput == "static" multiplex: true Artifact { filePath: "input.txt"; fileTags: ["txt", "empty"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var out = new TextFile(output.filePath, TextFile.WriteOnly); out.close(); }; return cmd; } } Rule { condition: generateInput == "dynamic" multiplex: true outputFileTags: ["txt", "empty"] outputArtifacts: [{filePath: "input.txt", fileTags: ["txt", "empty"]}] prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var out = new TextFile(output.filePath, TextFile.WriteOnly); out.close(); }; return cmd; } } Rule { inputs: "txt" outputFileTags: "p_tag" outputArtifacts: { if (input.fileTags.includes("empty")) return []; return [{ filePath: input.fileTags.includes("y") ? "y.out" : "x.out", fileTags: "p_tag" }] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var out = new TextFile(output.filePath, TextFile.WriteOnly); out.close(); }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/input-tags-change-tracking/input.txt0000644000175100017510000000000615154533055027224 0ustar runnerrunnerempty qbs-src-3.2.0/tests/auto/blackbox/testdata/date-property/0000755000175100017510000000000015154533055023011 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/date-property/date-property.qbs0000644000175100017510000000105015154533055026313 0ustar runnerrunnerProduct { type: "date" property var theDate: new Date(1999, 11, 31); Rule { multiplex: true Artifact { filePath: "dummy"; fileTags: "date" } prepare: { var cmd = new JavaScriptCommand; cmd.silent = true; cmd.sourceCode = function() { var d = product.theDate; console.info("The stored date was " + d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()); }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/enableRtti/0000755000175100017510000000000015154533055022303 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/enableRtti/main.cpp0000644000175100017510000000330515154533055023734 0ustar runnerrunner/**************************************************************************** ** ** 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 #if defined(__GNUC__) && !(defined(__cpp_rtti) || defined(__GXX_RTTI)) #error RTTI is disabled! #endif #if defined(_MSC_VER) && !defined (_CPPRTTI) #error RTTI is disabled! #endif class I { public: virtual ~I() { } virtual void x() { } }; class A : public I { void x() override { } }; class B : public I { void x() override { } }; int main() { const auto a = new A(); B *b = dynamic_cast(a); (void)b; delete a; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/enableRtti/rtti.qbs0000644000175100017510000000043115154533055023772 0ustar runnerrunnerProject { property bool treatAsObjcpp: false CppApplication { cpp.cxxLanguageVersion: "c++11" cpp.treatWarningsAsErrors: true Group { files: ["main.cpp"] fileTags: [project.treatAsObjcpp ? "objcpp" : "cpp"] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/escaped-linker-flags/0000755000175100017510000000000015154533055024172 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/escaped-linker-flags/main.cpp0000644000175100017510000000001715154533055025620 0ustar runnerrunnerint main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/escaped-linker-flags/escaped-linker-flags.qbs0000644000175100017510000000074115154533055030663 0ustar runnerrunnerCppApplication { name: "app" property bool escapeLinkerFlags Properties { condition: escapeLinkerFlags cpp.linkerFlags: ["-Wl,-s"] } Properties { condition: !escapeLinkerFlags cpp.linkerFlags: ["-s"] } files: ["main.cpp"] Probe { id: checker property bool isUnixGcc: qbs.toolchain.contains("gcc") && !qbs.targetOS.contains("macos") configure: { console.info("is gcc: " + isUnixGcc); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/archiver/0000755000175100017510000000000015154533055022015 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/archiver/test.txt0000644000175100017510000000000015154533055023523 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/archiver/list.txt0000644000175100017510000000003015154533055023522 0ustar runnerrunnertest.txt archivable.qbs qbs-src-3.2.0/tests/auto/blackbox/testdata/archiver/archivable.qbs0000644000175100017510000000036515154533055024630 0ustar runnerrunnerProduct { name: "archivable" type: "archiver.archive" Depends { name: "archiver" } archiver.workingDirectory: path Group { files: ["list.txt"] fileTags: ["archiver.input-list"] } files: ["test.txt"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/prevent-floating-point-values/0000755000175100017510000000000015154533055026122 5ustar runnerrunner././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/prevent-floating-point-values/prevent-floating-point-values.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/prevent-floating-point-values/prevent-floating-point-valu0000644000175100017510000000013415154533055033423 0ustar runnerrunnerProduct { name: "p" property bool dummy: { console.info("version: " + version); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/0000755000175100017510000000000015154533055023603 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/someotherfile.txt0000644000175100017510000000000015154533055027177 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/someotherfile2.txt0000644000175100017510000000000015154533055027261 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/imports/0000755000175100017510000000000015154533055025300 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/imports/Helper7Base.qbs0000644000175100017510000000022015154533055030102 0ustar runnerrunnerModule { property string directory property string fileName Group { prefix: directory + "/" files: fileName } } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/rock.coal0000644000175100017510000000000515154533055025374 0ustar runnerrunnercoal qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/groups-in-modules.qbs0000644000175100017510000000140715154533055027705 0ustar runnerrunnerimport qbs.Host Project { Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } Depends { name: "dep" } Depends { name: "helper" } Depends { name: "helper3" required: false } Depends { name: "helper7" } helper7.fileName: "helper7.c" Depends { name: "helper8" } type: ["diamond"] files: [ "rock.coal" ] } Product { name: "dep" Export { Depends { name: "helper4" } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/0000755000175100017510000000000015154533055025253 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper/0000755000175100017510000000000015154533055026532 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper/diamondc.c0000644000175100017510000000327115154533055030457 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** 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 int main(int argc, char *argv[]) { if (argc < 3) { fprintf(stderr, "usage: diamondc input.coal output.diamond"); return 1; } FILE *in = fopen(argv[1], "r"); if (in) { fclose(in); } else { return 1; } FILE *out = fopen(argv[2], "w"); if (out) { fprintf(out, "diamond\n"); fclose(out); } else { return 1; } return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper/helper.qbs0000644000175100017510000000206715154533055030525 0ustar runnerrunnerimport qbs.FileInfo Module { Depends { name: "cpp" } Depends { name: "helper2" } additionalProductTypes: ["diamond"] Group { name: "Helper Sources" files: ["diamondc.c"] } Group { name: "Additional Chunk" prefix: path + "/" files: ["chunk.coal"] } Group { name: "some other file from helper" prefix: project.sourceDirectory + '/' files: ["someotherfile2.txt"] } FileTagger { patterns: ["*.coal"] fileTags: ["coal"] } Rule { inputs: ["coal"] explicitlyDependsOn: ["application"] Artifact { filePath: FileInfo.joinPaths(product.destinationDirectory, input.baseName + ".diamond") fileTags: ["diamond"] } prepare: { var cmd = new Command(FileInfo.joinPaths(product.buildDirectory, product.targetName), [input.filePath, output.filePath]); cmd.description = "compiling " + input.fileName + " to " + output.fileName; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper/chunk.coal0000644000175100017510000000000615154533055030476 0ustar runnerrunnerchunk qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper3/0000755000175100017510000000000015154533055026615 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper3/helper3.c0000644000175100017510000000235515154533055030330 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void helper3() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper3/helper3.qbs0000644000175100017510000000023115154533055030662 0ustar runnerrunnerModule { Depends { name: "cpp" } Group { name: "Helper3 Sources" files: ["helper3.c"] } validate: { throw "Nope."; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper6/0000755000175100017510000000000015154533055026620 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper6/helper6.qbs0000644000175100017510000000023415154533055030673 0ustar runnerrunnerModule { Depends { name: "cpp" } Group { name: "Helper6 Sources" files: ["helper6.c"] } validate: { throw "Go away."; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper6/helper6.c0000644000175100017510000000235515154533055030336 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void helper6() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper5/0000755000175100017510000000000015154533055026617 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper5/helper5.qbs0000644000175100017510000000034015154533055030667 0ustar runnerrunnerModule { Depends { name: "cpp" } Depends { name: "helper6" required: false } Group { name: "Helper5 Sources" files: ["helper5.c"] cpp.defines: ["COMPILE_FIX"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper5/helper5.c0000644000175100017510000000243415154533055030332 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void helper5() { #ifndef COMPILE_FIX nothatcantwork #endif } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper4/0000755000175100017510000000000015154533055026616 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper4/helper4.qbs0000644000175100017510000000022715154533055030671 0ustar runnerrunnerModule { Depends { name: "cpp" } Depends { name: "helper5" } Group { name: "Helper4 Sources" files: ["helper4.c"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper4/helper4.c0000644000175100017510000000235515154533055030332 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void helper4() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper7/0000755000175100017510000000000015154533055026621 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper7/helper7.c0000644000175100017510000000002615154533055030331 0ustar runnerrunnervoid helper7(void) {} qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper7/helper7.qbs0000644000175100017510000000004415154533055030674 0ustar runnerrunnerHelper7Base { directory: path } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper2/0000755000175100017510000000000015154533055026614 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper2/helper2.qbs0000644000175100017510000000041215154533055030661 0ustar runnerrunnerModule { Depends { name: "cpp" } Group { name: "Helper2 Sources" files: ["helper2.c"] } Group { name: "some other file from helper2" prefix: product.sourceDirectory + '/' files: ["someotherfile.txt"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper2/helper2.c0000644000175100017510000000235515154533055030326 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void helper2() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper8/0000755000175100017510000000000015154533055026622 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper8/helper8.qbs0000644000175100017510000000050215154533055030675 0ustar runnerrunnerModule { version: "8" Probe { id: baseNameProbe property string baseName configure: { baseName = "helper" } } property string fileName: baseNameProbe.baseName + version + ".c" Group { condition: version === "8" prefix: path + "/" files: fileName } } qbs-src-3.2.0/tests/auto/blackbox/testdata/groups-in-modules/modules/helper8/helper8.c0000644000175100017510000000002615154533055030333 0ustar runnerrunnervoid helper8(void) {} qbs-src-3.2.0/tests/auto/blackbox/testdata/installed_artifact/0000755000175100017510000000000015154533055024046 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/installed_artifact/main.cpp0000644000175100017510000000235115154533055025477 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/installed_artifact/installed_artifact.qbs0000644000175100017510000000070515154533055030413 0ustar runnerrunnerApplication { name: "installedApp" type: "application" consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: "cpp" } Group { files: "main.cpp" qbs.install: true qbs.installDir: "src" } qbs.installPrefix: "/usr" Group { fileTagsFilter: "application" qbs.install: true qbs.installDir: "bin" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/reproducible-build/0000755000175100017510000000000015154533055023766 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/reproducible-build/main.cpp0000644000175100017510000000242515154533055025421 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void f1(); void f2(); int main() { f1(); f2(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/reproducible-build/file1.cpp0000644000175100017510000000240315154533055025471 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ static void f() { } void f1() { f(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/reproducible-build/file2.cpp0000644000175100017510000000240315154533055025472 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ static void f() { } void f2() { f(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/reproducible-build/reproducible-build.qbs0000644000175100017510000000067615154533055030262 0ustar runnerrunnerCppApplication { name: "the product" files: ["file1.cpp", "file2.cpp", "main.cpp"] cpp.cxxFlags: ["-flto"] Probe { id: checker property bool isGcc: qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("clang") property string objectSuffix: cpp.objectSuffix configure: { console.info("is gcc: " + isGcc); console.info("object suffix: " + objectSuffix); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-root-from-project-file/0000755000175100017510000000000015154533055026163 5ustar runnerrunner././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/install-root-from-project-file/install-root-from-project-file.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/install-root-from-project-file/install-root-from-project-0000644000175100017510000000036715154533055033225 0ustar runnerrunnerProduct { name: "p" property string installRoot qbs.installRoot: installRoot Group { qbs.install: true qbs.installPrefix: "/install-prefix" qbs.installDir: "/install-dir" files: ["file.txt"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-root-from-project-file/file.txt0000644000175100017510000000000015154533055027631 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/linker-library-duplicates/0000755000175100017510000000000015154533055025273 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/linker-library-duplicates/main.cpp0000644000175100017510000000027515154533055026727 0ustar runnerrunner#include "../dllexport.h" DLL_IMPORT void lib1Func(); DLL_IMPORT void lib2Func(); DLL_IMPORT void lib3Func(); int main() { lib1Func(); lib2Func(); lib3Func(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-library-duplicates/lib3.cpp0000644000175100017510000000007215154533055026627 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void lib3Func() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-library-duplicates/lib2.cpp0000644000175100017510000000007215154533055026626 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void lib2Func() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-library-duplicates/setup-run-environment.qbs0000644000175100017510000000232515154533055032310 0ustar runnerrunnerProject { DynamicLibrary { id: idLib1 name: "lib1" Depends { name: "cpp" } files: ["lib1.cpp"] Depends { name: "bundle" } bundle.isBundle: false Probe { id: checker property bool isGcc: qbs.toolchain.contains("gcc") configure: { console.info("is gcc: " + isGcc); } } } DynamicLibrary { id: idLib2 name: "lib2" Depends { name: "cpp" } files: ["lib2.cpp"] Depends { name: "bundle" } bundle.isBundle: false } DynamicLibrary { id: idLib3 name: "lib3" Depends { name: "cpp" } files: ["lib3.cpp"] Depends { name: "bundle" } bundle.isBundle: false } CppApplication { name: "main" files: "main.cpp" Depends { name: "lib1"; cpp.link: false } Depends { name: "lib2"; cpp.link: false } Depends { name: "lib3"; cpp.link: false } cpp.libraryPaths: [ idLib1.buildDirectory, idLib2.buildDirectory, idLib3.buildDirectory ] cpp.dynamicLibraries: [ "lib1", "lib2", "lib1", "lib3", "lib2", "lib1" ] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-library-duplicates/lib1.cpp0000644000175100017510000000007215154533055026625 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void lib1Func() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/export-rule/0000755000175100017510000000000015154533055022500 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/export-rule/main.cpp0000644000175100017510000000016615154533055024133 0ustar runnerrunnerextern void justSomeFunction(); extern void hook(); int main() { justSomeFunction(); hook(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/export-rule/export-rule.qbs0000644000175100017510000000217115154533055025476 0ustar runnerrunnerimport qbs.File Project { Application { name: "MyApp" files: ["main.cpp", "myapp.blubb"] Depends { name: "blubber" } } StaticLibrary { name: "blubber" files: ["blubber.cpp"] Depends { name: "cpp" } Export { Depends { name: "cpp" } property bool enableTagger property string description: "creating C++ source file."; FileTagger { condition: enableTagger patterns: ["*.blubb"] fileTags: ["blubb"] } Rule { inputs: ["blubb"] Artifact { filePath: input.completeBaseName + ".cpp" fileTags: ["cpp"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = product.blubber.description; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return [cmd]; } } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/export-rule/blubber.cpp0000644000175100017510000000235215154533055024623 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void hook() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/export-rule/myapp.blubb0000644000175100017510000000003315154533055024632 0ustar runnerrunnervoid justSomeFunction() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/find/0000755000175100017510000000000015154533055021132 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/find/find-cli.qbs0000644000175100017510000000177115154533055023334 0ustar runnerrunnerimport qbs.TextFile Product { Depends { name: "cli"; required: false } type: ["json"] Rule { multiplex: true Artifact { filePath: ["cli.json"] fileTags: ["json"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = output.filePath; cmd.sourceCode = function() { var tools = {}; if (product.moduleProperty("cli", "present")) tools["toolchainInstallPath"] = product.moduleProperty("cli", "toolchainInstallPath"); var tf; try { tf = new TextFile(output.filePath, TextFile.WriteOnly); tf.writeLine(JSON.stringify(tools, undefined, 4)); } finally { if (tf) tf.close(); } }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamicMultiplexRule/0000755000175100017510000000000015154533055024372 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamicMultiplexRule/three.txt0000644000175100017510000000000015154533055026230 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamicMultiplexRule/dynamicMultiplexRule.qbs0000644000175100017510000000155715154533055031271 0ustar runnerrunnerimport qbs.TextFile Project { Product { type: ["stuff"] Group { files: ["one.txt", "two.txt", "three.txt"] fileTags: ["text"] } Rule { multiplex: true inputs: "text" outputFileTags: ["stuff"] outputArtifacts: { return [{ filePath: "stuff-from-" + inputs.text.length + "-inputs", fileTags: ["stuff"] }]; } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.write("narf!"); f.close(); } return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamicMultiplexRule/two.txt0000644000175100017510000000000015154533055025732 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamicMultiplexRule/one.txt0000644000175100017510000000000015154533055025702 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probe-change-tracking/0000755000175100017510000000000015154533055024344 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probe-change-tracking/probe-change-tracking.qbs0000644000175100017510000000177015154533055031212 0ustar runnerrunnerProject { Probe { id: tlpProbe property int confValue configure: { console.info("running tlpProbe"); confValue = 5; } } property int tlpCount: tlpProbe.confValue Project { Probe { id: subProbe property int confValue configure: { console.info("running subProbe"); confValue = 7; } } property int subCount: subProbe.confValue Product { name: "theProduct" property bool runProbe property int v1: project.tlpCount property int v2: project.subCount Probe { id: productProbe condition: product.runProbe property int v1: product.v1 property int v2: product.v2 configure: { console.info("running productProbe: " + (v1 + v2)); } } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-without-sources/0000755000175100017510000000000015154533055025427 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-without-sources/static-lib-without-sources.qbs0000644000175100017510000000037615154533055033361 0ustar runnerrunnerProject { StaticLibrary { name: "a" Depends { name: "cpp" } files: ["lib.cpp"] } Product { type: qbs.targetOS.includes("darwin") ? undefined : ["staticlibrary"] name: "b" Depends { name: "cpp" } Depends { name: "a" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-without-sources/lib.cpp0000644000175100017510000000001515154533055026675 0ustar runnerrunnervoid f() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/compilerDefinesByLanguage/0000755000175100017510000000000015154533055025261 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/compilerDefinesByLanguage/app.c0000644000175100017510000000003515154533055026203 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/compilerDefinesByLanguage/test.m0000644000175100017510000000000015154533055026404 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/compilerDefinesByLanguage/compilerDefinesByLanguage.qbs0000644000175100017510000001757015154533055033051 0ustar runnerrunnerProject { CppDefinesApp { name: "A" // eqiuvalent to ["c"] since we always need some compiler defines // for the architecture detection, etc. cpp.enableCompilerDefinesByLanguage: [] property var foo: { if (!cpp.compilerDefinesByLanguage) throw "ASSERT cpp.compilerDefinesByLanguage: " + cpp.compilerDefinesByLanguage; if (!cpp.compilerDefinesByLanguage["c"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"c\"]: " + cpp.compilerDefinesByLanguage["c"]; if (cpp.compilerDefinesByLanguage["cpp"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"cpp\"]: " + cpp.compilerDefinesByLanguage["cpp"]; if (cpp.compilerDefinesByLanguage["objc"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"objc\"]: " + cpp.compilerDefinesByLanguage["objc"]; if (cpp.compilerDefinesByLanguage["objcpp"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"objcpp\"]: " + cpp.compilerDefinesByLanguage["objcpp"]; } } CppDefinesApp { name: "B" cpp.enableCompilerDefinesByLanguage: ["cpp"] property var foo: { if (!cpp.compilerDefinesByLanguage) throw "ASSERT cpp.compilerDefinesByLanguage: " + cpp.compilerDefinesByLanguage; if (cpp.compilerDefinesByLanguage["c"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"c\"]: " + cpp.compilerDefinesByLanguage["c"]; if (!cpp.compilerDefinesByLanguage["cpp"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"cpp\"]: " + cpp.compilerDefinesByLanguage["cpp"]; if (cpp.compilerDefinesByLanguage["objc"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"objc\"]: " + cpp.compilerDefinesByLanguage["objc"]; if (cpp.compilerDefinesByLanguage["objcpp"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"objcpp\"]: " + cpp.compilerDefinesByLanguage["objcpp"]; } } CppDefinesApp { name: "C" condition: enableObjectiveC cpp.enableCompilerDefinesByLanguage: ["objc"] property var foo: { if (!enableObjectiveC) return; if (!cpp.compilerDefinesByLanguage) throw "ASSERT cpp.compilerDefinesByLanguage: " + cpp.compilerDefinesByLanguage; if (cpp.compilerDefinesByLanguage["c"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"c\"]: " + cpp.compilerDefinesByLanguage["c"]; if (cpp.compilerDefinesByLanguage["cpp"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"cpp\"]: " + cpp.compilerDefinesByLanguage["cpp"]; if (!cpp.compilerDefinesByLanguage["objc"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"objc\"]: " + cpp.compilerDefinesByLanguage["objc"]; if (cpp.compilerDefinesByLanguage["objcpp"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"objcpp\"]: " + cpp.compilerDefinesByLanguage["objcpp"]; } } CppDefinesApp { name: "D" condition: enableObjectiveC cpp.enableCompilerDefinesByLanguage: ["objcpp"] property var foo: { if (!enableObjectiveC) return; if (!cpp.compilerDefinesByLanguage) throw "ASSERT cpp.compilerDefinesByLanguage: " + cpp.compilerDefinesByLanguage; if (cpp.compilerDefinesByLanguage["c"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"c\"]: " + cpp.compilerDefinesByLanguage["c"]; if (cpp.compilerDefinesByLanguage["cpp"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"cpp\"]: " + cpp.compilerDefinesByLanguage["cpp"]; if (cpp.compilerDefinesByLanguage["objc"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"objc\"]: " + cpp.compilerDefinesByLanguage["objc"]; if (!cpp.compilerDefinesByLanguage["objcpp"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"objcpp\"]: " + cpp.compilerDefinesByLanguage["objcpp"]; } } CppDefinesApp { name: "E" condition: enableObjectiveC cpp.enableCompilerDefinesByLanguage: ["cpp", "objcpp"] property var foo: { if (!enableObjectiveC) return; if (!cpp.compilerDefinesByLanguage) throw "ASSERT cpp.compilerDefinesByLanguage: " + cpp.compilerDefinesByLanguage; if (cpp.compilerDefinesByLanguage["c"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"c\"]: " + cpp.compilerDefinesByLanguage["c"]; if (!cpp.compilerDefinesByLanguage["cpp"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"cpp\"]: " + cpp.compilerDefinesByLanguage["cpp"]; if (cpp.compilerDefinesByLanguage["objc"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"objc\"]: " + cpp.compilerDefinesByLanguage["objc"]; if (!cpp.compilerDefinesByLanguage["objcpp"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"objcpp\"]: " + cpp.compilerDefinesByLanguage["objcpp"]; } } CppDefinesApp { name: "F" cpp.enableCompilerDefinesByLanguage: ["c", "cpp"] property var foo: { if (!cpp.compilerDefinesByLanguage) throw "ASSERT cpp.compilerDefinesByLanguage: " + cpp.compilerDefinesByLanguage; if (!cpp.compilerDefinesByLanguage["c"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"c\"]: " + cpp.compilerDefinesByLanguage["c"]; if (!cpp.compilerDefinesByLanguage["cpp"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"cpp\"]: " + cpp.compilerDefinesByLanguage["cpp"]; if (cpp.compilerDefinesByLanguage["objc"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"objc\"]: " + cpp.compilerDefinesByLanguage["objc"]; if (cpp.compilerDefinesByLanguage["objcpp"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"objcpp\"]: " + cpp.compilerDefinesByLanguage["objcpp"]; } } CppDefinesApp { name: "G" condition: enableObjectiveC cpp.enableCompilerDefinesByLanguage: ["objc", "objcpp"] property var foo: { if (!enableObjectiveC) return; if (!cpp.compilerDefinesByLanguage) throw "ASSERT cpp.compilerDefinesByLanguage: " + cpp.compilerDefinesByLanguage; if (cpp.compilerDefinesByLanguage["c"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"c\"]: " + cpp.compilerDefinesByLanguage["c"]; if (cpp.compilerDefinesByLanguage["cpp"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"cpp\"]: " + cpp.compilerDefinesByLanguage["cpp"]; if (!cpp.compilerDefinesByLanguage["objc"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"objc\"]: " + cpp.compilerDefinesByLanguage["objc"]; if (!cpp.compilerDefinesByLanguage["objcpp"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"objcpp\"]: " + cpp.compilerDefinesByLanguage["objcpp"]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/compilerDefinesByLanguage/CppDefinesApp.qbs0000644000175100017510000000057215154533055030455 0ustar runnerrunnerCppApplication { files: ["app.c"] property bool enableObjectiveC: qbs.targetOS.includes("darwin") Group { name: "C/C++" files: [ "test.c", "test.cpp", ] } Group { name: "Objective-C" condition: enableObjectiveC files: [ "test.m", "test.mm", ] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/compilerDefinesByLanguage/test.cpp0000644000175100017510000000000015154533055026732 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/compilerDefinesByLanguage/test.mm0000644000175100017510000000000015154533055026561 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/compilerDefinesByLanguage/test.c0000644000175100017510000000000015154533055026372 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/symbolLinkMode/0000755000175100017510000000000015154533055023142 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/symbolLinkMode/main.cpp0000644000175100017510000000055315154533055024575 0ustar runnerrunnerextern WEAK_IMPORT int somefunction(); extern void indirect(); #include int main() { std::printf("meow\n"); if (&somefunction != nullptr) std::printf("somefunction existed and it returned %d\n", somefunction()); else std::printf("somefunction did not exist\n"); #if SHOULD_INSTALL_LIB indirect(); #endif return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/symbolLinkMode/indirect.cpp0000644000175100017510000000002415154533055025443 0ustar runnerrunnervoid indirect() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/symbolLinkMode/symbolLinkMode.qbs0000644000175100017510000000653015154533055026605 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host Project { property bool shouldInstallLibrary: true property bool lazy: false Application { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } Depends { name: "cpp" } Depends { name: "functions"; cpp.symbolLinkMode: product.symbolLinkMode cpp.link: !(product.qbs.targetOS.includes("linux") && product.symbolLinkMode === "weak") } property string symbolLinkMode: project.lazy ? "lazy" : "weak" name: "driver" files: ["main.cpp"] consoleApplication: true installDir: "bin" property string installLib: "SHOULD_INSTALL_LIB=" + project.shouldInstallLibrary cpp.defines: { if (symbolLinkMode === "weak") { return qbs.targetOS.includes("darwin") ? ["WEAK_IMPORT=__attribute__((weak_import))", installLib] : ["WEAK_IMPORT=__attribute__((weak))", installLib]; } return ["WEAK_IMPORT=", installLib]; } cpp.cxxLanguageVersion: "c++11" cpp.minimumMacosVersion: "10.7" cpp.rpaths: [cpp.rpathOrigin + "/../lib"] } DynamicLibrary { Depends { name: "cpp" } Depends { name: "indirect"; cpp.symbolLinkMode: "reexport" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } name: "functions" files: ["lib.cpp"] install: project.shouldInstallLibrary installDir: "lib" cpp.cxxLanguageVersion: "c++11" cpp.minimumMacosVersion: "10.7" cpp.rpaths: [cpp.rpathOrigin] Properties { condition: qbs.targetOS.includes("darwin") cpp.sonamePrefix: "@rpath" } Export { // let the autotest pass on Linux where reexport is not supported Depends { name: "indirect"; condition: !qbs.targetOS.includes("darwin") } // on Linux, there is no LC_WEAK_LOAD_DYLIB equivalent (the library is simply omitted // from the list of load commands entirely), so use LD_PRELOAD to emulate qbs.commonRunEnvironment: { var env = original || {}; if (project.shouldInstallLibrary) { env["LD_PRELOAD"] = FileInfo.joinPaths(qbs.installRoot, "lib", "libfunctions.so"); } return env; } } } DynamicLibrary { Depends { name: "cpp" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } name: "indirect" installDir: "lib" files: ["indirect.cpp"] cpp.cxxLanguageVersion: "c++11" cpp.minimumMacosVersion: "10.7" Properties { condition: qbs.targetOS.includes("darwin") // reexport is incompatible with rpath, // "ERROR: ld: file not found: @rpath/libindirect.dylib for architecture x86_64" cpp.sonamePrefix: qbs.installRoot + "/lib" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/symbolLinkMode/lib.cpp0000644000175100017510000000022315154533055024411 0ustar runnerrunnerint somefunction() { return 42; } #include static const auto func = []() { std::printf("Lib was loaded!\n"); return 0; }(); qbs-src-3.2.0/tests/auto/blackbox/testdata/change-tracking-and-multiplexing/0000755000175100017510000000000015154533055026516 5ustar runnerrunner././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/change-tracking-and-multiplexing/change-tracking-and-multiplexing.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/change-tracking-and-multiplexing/change-tracking-and-mult0000644000175100017510000000054515154533055033211 0ustar runnerrunnerStaticLibrary { name: "l" Depends { condition: qbs.targetOS.includes("darwin"); name: "bundle" } Properties { condition: qbs.targetOS.includes("darwin"); bundle.isBundle: false } multiplexByQbsProperties: ["buildVariants"] qbs.buildVariants: ["debug", "release"] Depends { name: "cpp" } files: ["lib.cpp"] install: false } qbs-src-3.2.0/tests/auto/blackbox/testdata/change-tracking-and-multiplexing/lib.cpp0000644000175100017510000000001415154533055027763 0ustar runnerrunnervoid l() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/last-module-candidate-broken/0000755000175100017510000000000015154533055025630 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/last-module-candidate-broken/main.cpp0000644000175100017510000000003115154533055027252 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/last-module-candidate-broken/qbs/0000755000175100017510000000000015154533055026415 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/last-module-candidate-broken/qbs/modules/0000755000175100017510000000000015154533055030065 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/last-module-candidate-broken/qbs/modules/Foo/0000755000175100017510000000000015154533055030610 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/last-module-candidate-broken/qbs/modules/Foo/Foo1.qbs0000644000175100017510000000004015154533055032115 0ustar runnerrunnerModule { condition: false } qbs-src-3.2.0/tests/auto/blackbox/testdata/last-module-candidate-broken/qbs/modules/Foo/Foo2.qbs0000644000175100017510000000001215154533055032115 0ustar runnerrunnerGroup { } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/last-module-candidate-broken/last-module-candidate-broken.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/last-module-candidate-broken/last-module-candidate-broken0000644000175100017510000000013715154533055033172 0ustar runnerrunnerCppApplication { qbsSearchPaths: "qbs" Depends { name: "Foo" } files: "main.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/proper quoting/0000755000175100017510000000000015154533055023170 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/proper quoting/main.cpp0000644000175100017510000000265515154533055024630 0ustar runnerrunner/**************************************************************************** ** ** 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 int bla(); int main() { std::printf(DEFINE"\n"); std::printf(DEFINEWITHSPACE"\n"); std::printf(DEFINEWITHTAB"\n"); std::printf(DEFINEWITHBACKSLASH"\n"); return bla(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/proper quoting/my static lib.cpp0000644000175100017510000000257515154533055026331 0ustar runnerrunner/**************************************************************************** ** ** 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 #include int bla() { int n = getSomeNumber(); std::printf("Hello World! The magic number is %d.", n); return n; } qbs-src-3.2.0/tests/auto/blackbox/testdata/proper quoting/some helper/0000755000175100017510000000000015154533055025373 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/proper quoting/some helper/some helper.h0000644000175100017510000000244315154533055027752 0ustar runnerrunner/**************************************************************************** ** ** 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 HELPER_H #define HELPER_H extern int getSomeNumber(); #endif qbs-src-3.2.0/tests/auto/blackbox/testdata/proper quoting/some helper/some helper.cpp0000644000175100017510000000243615154533055030307 0ustar runnerrunner/**************************************************************************** ** ** 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 "some helper.h" int getSomeNumber() { return 156; } qbs-src-3.2.0/tests/auto/blackbox/testdata/proper quoting/my static lib helper.cpp0000644000175100017510000000240615154533055027562 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int helper_function() { return 156; } qbs-src-3.2.0/tests/auto/blackbox/testdata/proper quoting/proper quoting.qbs0000644000175100017510000000242015154533055026653 0ustar runnerrunnerimport qbs.Host Project { Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } type: "application" consoleApplication: true name: "Hello World" files : [ "main.cpp" ] Depends { name: "cpp" } Depends { name: "my static lib" } cpp.defines: [ 'DEFINE="whitespaceless"', 'DEFINEWITHSPACE="contains space"', 'DEFINEWITHTAB="contains\ttab"', 'DEFINEWITHBACKSLASH="backslash\\\\"', ] } Product { type: "staticlibrary" name : "my static lib" files : [ "my static lib.cpp" ] Depends { name: "cpp" } Depends { name: "helper lib" } } Product { type: "staticlibrary" name : "helper lib" files : [ "some helper/some helper.h", "some helper/some helper.cpp" ] Depends { name: "cpp" } Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory + '/some helper'] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-change-tracking/0000755000175100017510000000000015154533055025770 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-change-tracking/test.txt0000644000175100017510000000000015154533055027476 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-change-tracking/main.cpp0000644000175100017510000000003715154533055027420 0ustar runnerrunnervoid f(); int main() { f(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-change-tracking/dummy.in0000644000175100017510000000000015154533055027441 0ustar runnerrunner././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-change-tracking/artifacts-map-change-tracking.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-change-tracking/artifacts-map-change-tracki0000644000175100017510000000525215154533055033150 0ustar runnerrunnerimport qbs.File Project { CppApplication { name: "TheApp" targetName: "TheBinary" Rule { inputs: "cpp.in" Artifact { filePath: "test.cpp"; fileTags: 'cpp' } prepare: { console.info("running rule for " + output.fileName); var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return cmd; } } files: ["main.cpp", /* 'test.txt' */] Group { files: "test.cpp.in" fileTags: "cpp.in" } } Product { name: "meta" type: "custom" Depends { name: "TheApp" } Group { files: "dummy.in" fileTags: "dummy.in" } Rule { inputs: ["dummy.in"] Artifact { filePath: "dummy"; fileTags: 'custom' } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "printing artifacts"; cmd.sourceCode = function() { var dep; for (var i = 0; i < product.dependencies.length; ++i) { var d = product.dependencies[i]; if (d.name === "TheApp") { dep = d; break; } } for (var p in dep.artifacts) { var list = dep.artifacts[p]; for (var i = 0; i < list.length; ++i) console.info(list[i].fileName); } File.copy(input.filePath, output.filePath); }; return cmd; } } } Product { name: "p" type: "p_type" Rule { multiplex: true Artifact { filePath: "dummy1"; fileTags: "d_type" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var blubb = product.artifacts.qbs; }; return cmd; } } Rule { inputs: "d_type" Artifact { filePath: "dummy2"; fileTags: "p_type" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { }; return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-change-tracking/test.cpp.in0000644000175100017510000000001515154533055030054 0ustar runnerrunnervoid f() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/inputs-from-dependencies/0000755000175100017510000000000015154533055025121 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/inputs-from-dependencies/file3.txt0000644000175100017510000000000015154533055026652 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/inputs-from-dependencies/inputs-from-dependencies.qbs0000644000175100017510000000233315154533055032540 0ustar runnerrunnerProject { Product { name: "TextFileContainer1" type: "txt_container" Group { files: ["file1.txt", "file2.txt"] fileTags: "txt" } } Product { name: "TextFileContainer2" Group { files: ["file3.txt"] fileTags: "txt" } } Product { name: "TextFileContainer3" Group { files: ["file4.txt"] fileTags: "txt" } } Product { name: "TextFileGatherer" type: "printed_txt" Depends { name: "TextFileContainer1" } Depends { name: "TextFileContainer2" } Rule { inputsFromDependencies: "txt" multiplex: true Artifact { filePath: "blubb" fileTags: "printed_txt" alwaysUpdated: false } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "gathering text files"; cmd.sourceCode = function() { for (i in inputs.txt) console.info(inputs.txt[i].filePath); }; return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/inputs-from-dependencies/file1.txt0000644000175100017510000000000015154533055026650 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/inputs-from-dependencies/file4.txt0000644000175100017510000000000015154533055026653 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/inputs-from-dependencies/file2.txt0000644000175100017510000000000015154533055026651 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/versionscript/0000755000175100017510000000000015154533055023124 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/versionscript/versionscript0000644000175100017510000000005515154533055025761 0ustar runnerrunner{ global: dummyGlobal; local: dummyLocal; }; qbs-src-3.2.0/tests/auto/blackbox/testdata/versionscript/versionscript.qbs0000644000175100017510000000152715154533055026552 0ustar runnerrunnerDynamicLibrary { type: base.concat("custom") Depends { name: "cpp" } files: ["testlib.c"] Group { name: "version script" files: ["versionscript"] fileTags: ["versionscript"] } Rule { multiplex: true outputFileTags: "custom" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.warn("---" + product.cpp.nmPath + "---"); } return [cmd]; } } Probe { id: checker property bool isLinux: qbs.targetOS.includes("linux") property bool isGcc: qbs.toolchain.contains("gcc") configure: { console.info("is gcc for Linux: " + (isLinux && isGcc)); } } qbs.installPrefix: "" install: true installDir: "" } qbs-src-3.2.0/tests/auto/blackbox/testdata/versionscript/testlib.c0000644000175100017510000000240615154533055024740 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void dummyLocal() {} void dummyGlobal() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/wildcard_renaming/0000755000175100017510000000000015154533055023663 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcard_renaming/pioniere.txt0000644000175100017510000000000015154533055026224 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcard_renaming/wildcard_renaming.qbs0000644000175100017510000000014515154533055030043 0ustar runnerrunnerProduct { qbs.installPrefix: "" Group { qbs.install: true files: "*" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/scanner-item/0000755000175100017510000000000015154533055022577 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scanner-item/TheScanner.qbs0000644000175100017510000000017115154533055025337 0ustar runnerrunnerimport qbs.FileInfo Scanner { inputs: "i" searchPaths: [FileInfo.path(input.filePath)] scan: ["file.inc"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/scanner-item/scanner-item.qbs0000644000175100017510000000133715154533055025677 0ustar runnerrunnerimport qbs.File import qbs.FileInfo Product { type: "t" Depends { name: "m" } property bool productScanner property bool moduleScanner property bool enableGroup Group { files: ["subdir1/file1.in", "subdir2/file2.in"] fileTags: "i" } TheScanner { condition: productScanner } Rule { inputs: "i" Artifact { filePath: FileInfo.baseName(input.fileName) + ".out" fileTags: "t" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "handling " + input.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/scanner-item/subdir1/0000755000175100017510000000000015154533055024150 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scanner-item/subdir1/file1.in0000644000175100017510000000000015154533055025466 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scanner-item/subdir1/file.inc0000644000175100017510000000000015154533055025550 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scanner-item/subdir2/0000755000175100017510000000000015154533055024151 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scanner-item/subdir2/file.inc0000644000175100017510000000000015154533055025551 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scanner-item/subdir2/file2.in0000644000175100017510000000000015154533055025470 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scanner-item/modules/0000755000175100017510000000000015154533055024247 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scanner-item/modules/m/0000755000175100017510000000000015154533055024503 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scanner-item/modules/m/m.qbs0000644000175100017510000000025115154533055025444 0ustar runnerrunnerimport "../../TheScanner.qbs" as TheScanner Module { Group { condition: product.enableGroup TheScanner { condition: product.moduleScanner } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-process/0000755000175100017510000000000015154533055024422 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-process/main.cpp0000644000175100017510000000104115154533055026046 0ustar runnerrunner#include #include #include int main(int argc, char *argv[]) { if (argc != 2 || std::strcmp(argv[1], "help") != 0) { std::fprintf(stderr, "First argument to this program must be 'help'.\n"); return 1; } const char *env = std::getenv("SOME_ENV"); if (!env || std::strcmp(env, "why, hello!") != 0) { std::fprintf(stderr, "The SOME_ENV environment variable must be 'why, hello!'.\n"); return 1; } std::printf("qbs jsextensions-process test\n"); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-process/process.qbs0000644000175100017510000001126715154533055026616 0ustar runnerrunnerimport qbs.Environment import qbs.FileInfo import qbs.Host import qbs.Process import qbs.TextFile Project { Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } Depends { name: "cpp" } type: ["dummy"] name: "dummy" files: ["main.cpp"] Rule { multiplex: true inputs: ["application"] outputFileTags: "dummy" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var exeFilePath = FileInfo.joinPaths(product.buildDirectory, product.cpp.executablePrefix + "dummy" + product.cpp.executableSuffix); // Synchronous run, successful. var process = new Process(); var pathVal = "why, hello!"; process.setEnv("SOME_ENV", pathVal); process.exec(exeFilePath, ["help"], true); var output = new TextFile("output.txt", TextFile.WriteOnly); output.writeLine(process.exitCode()); output.writeLine(process.readLine()); process.close(); // Asynchronous run, successful. process = new Process(); process.setEnv("SOME_ENV", pathVal); output.writeLine(process.start(exeFilePath, ["help"])); output.writeLine(process.waitForFinished()); output.writeLine(process.exitCode()); output.writeLine(process.readLine()); process.close(); // Asynchronous run, unsuccessful. process = new Process(); output.writeLine(process.errorString()); output.writeLine(process.start("blubb", [])); output.writeLine(process.errorString()); process.close(); // Synchronous run, unsuccessful. process = new Process(); output.writeLine(process.errorString()); output.writeLine(process.exec("blubb", [])); output.writeLine(process.errorString()); process.close(); // Synchronous run, unsuccessful (throw). process = new Process(); try { process.exec("blubb", [], true); } catch (e) { output.writeLine(e); } finally { process.close(); } // closeWriteChannel test process = new Process(); if (Host.os().includes("windows")) process.start(product.qbs.windowsShellPath, ["/C", product.qbs.windowsSystemRoot + "\\system32\\sort.exe"]); else process.start("cat", []); process.writeLine("should be"); process.closeWriteChannel(); process.writeLine("should not be"); if (!process.waitForFinished()) process.kill(); output.write(process.readStdOut()); process.close(); // readLine and atEnd var testReadlineFile = new TextFile("123.txt", TextFile.WriteOnly); testReadlineFile.writeLine("1"); testReadlineFile.writeLine("2"); testReadlineFile.writeLine("3"); testReadlineFile.close(); process = new Process(); if (Host.os().includes("windows")) process.exec(product.qbs.windowsShellPath, ["/C", "type", "123.txt"], true); else process.exec("cat", ["123.txt"], true); while(!process.atEnd()) output.write(process.readLine()); // TODO: Test all the other Process methods as well. output.close(); }; return [cmd]; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/build-variant-defaults/0000755000175100017510000000000015154533055024560 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/build-variant-defaults/main.cpp0000644000175100017510000000003115154533055026202 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/build-variant-defaults/build-variant-defaults.qbs0000644000175100017510000000114715154533055031640 0ustar runnerrunnerCppApplication { property bool validate: { var valid = true; if (qbs.buildVariant === "release") { valid = !qbs.enableDebugCode && !qbs.debugInformation && qbs.optimization === "fast"; } else if (qbs.buildVariant === "debug") { valid = qbs.enableDebugCode && qbs.debugInformation && qbs.optimization === "none"; } else if (qbs.buildVariant === "profiling") { valid = !qbs.enableDebugCode && qbs.debugInformation && qbs.optimization === "fast"; } if (!valid) throw "Invalid defaults"; return valid; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates-no-error/0000755000175100017510000000000015154533055025554 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates-no-error/file3.txt0000644000175100017510000000000015154533055027305 0ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates-no-error/install-duplicates-no-error.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates-no-error/install-duplicates-no-error.q0000644000175100017510000000135415154533055033303 0ustar runnerrunnerProject { Product { name: "p1" Group { files: ["file1.txt"] qbs.install: true } } Product { name: "p2" Group { files: ["file1.txt"] qbs.install: true } } Product { name: "p3" Group { files: ["file2.txt"] qbs.install: true } multiplexByQbsProperties: ["buildVariants"] qbs.buildVariants: ["debug", "release"] } Product { name: "p4" Group { files: ["file2.txt"] qbs.install: true } aggregate: true multiplexByQbsProperties: ["buildVariants"] qbs.buildVariants: ["debug", "release"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates-no-error/file1.txt0000644000175100017510000000000015154533055027303 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates-no-error/file2.txt0000644000175100017510000000000015154533055027304 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probes-and-shadow-products/0000755000175100017510000000000015154533055025370 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probes-and-shadow-products/probes-and-shadow-products.qbs0000644000175100017510000000034015154533055033252 0ustar runnerrunnerProduct { name: "p" multiplexByQbsProperties: "buildVariants" qbs.buildVariants: ["debug", "release"] Export { Probe { id: dummy configure: { found = true; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/emscripten-artifacts/0000755000175100017510000000000015154533055024341 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/emscripten-artifacts/main.cpp0000644000175100017510000000235115154533055025772 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/emscripten-artifacts/emscripten-artifacts.qbs0000644000175100017510000000023615154533055031200 0ustar runnerrunnerCppApplication { name: "app" property bool dummy: { console.info("is emscripten: " + qbs.toolchain.includes("emscripten")); } files: "main.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/rule-connection-with-excluded-inputs/0000755000175100017510000000000015154533055027402 5ustar runnerrunner././@LongLink0000644000000000000000000000017100000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/rule-connection-with-excluded-inputs/rule-connection-with-excluded-inputs.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/rule-connection-with-excluded-inputs/rule-connection-with0000644000175100017510000000222415154533055033402 0ustar runnerrunnerProduct { name: "p" type: "p_type" Rule { multiplex: true Artifact { filePath: "x.txt"; fileTags: "x" } Artifact { filePath: "y.txt"; fileTags: "y" } Artifact { filePath: "p.txt"; fileTags: "p_type" } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() {}; return cmd; } } Rule { multiplex: true Artifact { filePath: "x2.txt"; fileTags: "x" } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() {}; return cmd; } } Rule { multiplex: true inputs: "x" excludedInputs: "y" Artifact { filePath: "dummy"; fileTags: "p_type" } prepare: { console.info("inputs.x: " + (inputs.x ? inputs.x.length : 0)); console.info("inputs.y: " + (inputs.y ? inputs.y.length : 0)); var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() {}; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/system-run-paths/0000755000175100017510000000000015154533055023455 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/system-run-paths/main.cpp0000644000175100017510000000240415154533055025105 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void func(); int main() { func(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/system-run-paths/system-run-paths.qbs0000644000175100017510000000147215154533055027433 0ustar runnerrunnerProject { property bool setRunPaths Product { name: "theLib" type: ["dynamiclibrary"] Depends { name: "cpp" } qbs.installPrefix: "" Group { fileTagsFilter: product.type qbs.install: true qbs.installDir: "lib" } files: ["lib.cpp"] } CppApplication { name: "app" Depends { name: "theLib" } files: ["main.cpp"] property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } cpp.rpaths: qbs.installRoot + "/lib" cpp.systemRunPaths: project.setRunPaths ? [qbs.installRoot + "/lib"] : [] } Probe { id: checker property bool isUnix: qbs.targetOS.contains("unix") configure: { console.info("is unix: " + isUnix); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/system-run-paths/lib.cpp0000644000175100017510000000235315154533055024732 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void func() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/0000755000175100017510000000000015154533055025751 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/nonrecursive/0000755000175100017510000000000015154533055030473 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/nonrecursive/subdir1/0000755000175100017510000000000015154533055032044 5ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/nonrecursive/subdir1/file.txtqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/nonrecursive/subdir1/file.t0000644000175100017510000000000015154533055033136 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/nonrecursive/subdir2/0000755000175100017510000000000015154533055032045 5ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/nonrecursive/subdir2/file.txtqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/nonrecursive/subdir2/file.t0000644000175100017510000000000015154533055033137 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/recursive1/0000755000175100017510000000000015154533055030041 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/recursive1/recursive.txt0000644000175100017510000000000015154533055032577 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/recursive2/0000755000175100017510000000000015154533055030042 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/recursive2/recursive.txt0000644000175100017510000000000015154533055032600 0ustar runnerrunner././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/wildcards-and-change-tracking.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-change-tracking/wildcards-and-change-tracki0000644000175100017510000000045415154533055033111 0ustar runnerrunnerProduct { Group { name: "recursive" files: "**/file.txt" } Group { name: "directories" prefix: "nonrecursive/" files: "subdi?/file.txt" } Group { prefix: "nonrecursive/empty/" name: "no files" files: "*.txt" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/probes-and-array-properties/0000755000175100017510000000000015154533055025552 5ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/probes-and-array-properties/probes-and-array-properties.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/probes-and-array-properties/probes-and-array-properties.q0000644000175100017510000000017615154533055033300 0ustar runnerrunnerProduct { name: "theProduct" type: ["the-output"] Depends { name: "mymodule" } // mymodule.prop: ["product"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/probes-and-array-properties/modules/0000755000175100017510000000000015154533055027222 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probes-and-array-properties/modules/mymodule/0000755000175100017510000000000015154533055031055 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probes-and-array-properties/modules/mymodule/mymodule.qbs0000644000175100017510000000115215154533055033416 0ustar runnerrunnerModule { Probe { id: propProbe property stringList prop: [] configure: { prop = ["probe"]; found = true; } } property stringList prop: propProbe.found ? propProbe.prop : ["other"] Rule { multiplex: true outputFileTags: "the-output" prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating dummy"; cmd.sourceCode = function() { console.info("prop: " + JSON.stringify(product.mymodule.prop)); } return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackFileTags/0000755000175100017510000000000015154533055022735 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/trackFileTags/after/0000755000175100017510000000000015154533055024036 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/trackFileTags/after/trackFileTags.qbs0000644000175100017510000000354415154533055027276 0ustar runnerrunnerimport qbs.TextFile import qbs.Host Project { Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: 'someapp' type: 'application' consoleApplication: true property bool dummy: { console.info("object suffix: " + cpp.objectSuffix); } Depends { name: 'cpp' } Group { files: [ "main.cpp" ] fileTags: [ "foosource", "cpp" ] } } Rule { inputs: ["foosource"] Artifact { filePath: input.baseName + ".foo" fileTags: ["foo"] } prepare: { var cmd = new JavaScriptCommand(); cmd.sourceCode = "var file = new TextFile(output.filePath, TextFile.WriteOnly);"; cmd.sourceCode += "file.truncate();" cmd.sourceCode += "file.write(\"There's nothing to see here!\");" cmd.sourceCode += "file.close();" cmd.description = "generating something"; return cmd; } } Rule { inputs: ["foo"] Artifact { filePath: input.baseName + "_foo.cpp" fileTags: ["cpp"] } prepare: { var cmd = new JavaScriptCommand(); cmd.sourceCode = "var file = new TextFile(output.filePath, TextFile.WriteOnly);"; cmd.sourceCode += "file.truncate();"; cmd.sourceCode += "file.write(\"// There's nothing to see here!\\n\");"; cmd.sourceCode += "file.write(\"int foo() { return 15; }\\n\");"; cmd.sourceCode += "file.close();"; cmd.description = "generating something"; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackFileTags/after/main.cpp0000644000175100017510000000253515154533055025473 0ustar runnerrunner/**************************************************************************** ** ** 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 int foo(); int main(int argc, char **argv) { std::printf("there's %d foo here\n", foo()); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackFileTags/before/0000755000175100017510000000000015154533055024177 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/trackFileTags/before/trackFileTags.qbs0000644000175100017510000000352715154533055027440 0ustar runnerrunnerimport qbs.TextFile import qbs.Host Project { Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: 'someapp' type: 'application' consoleApplication: true property bool dummy: { console.info("object suffix: " + cpp.objectSuffix); } Depends { name: 'cpp' } Group { files: [ "main.cpp" ] fileTags: [ "cpp" ] } } Rule { inputs: ["foosource"] Artifact { filePath: input.baseName + ".foo" fileTags: ["foo"] } prepare: { var cmd = new JavaScriptCommand(); cmd.sourceCode = "var file = new TextFile(output.filePath, TextFile.WriteOnly);"; cmd.sourceCode += "file.truncate();" cmd.sourceCode += "file.write(\"There's nothing to see here!\");" cmd.sourceCode += "file.close();" cmd.description = "generating something"; return cmd; } } Rule { inputs: ["foo"] Artifact { filePath: input.baseName + "_foo.cpp" fileTags: ["cpp"] } prepare: { var cmd = new JavaScriptCommand(); cmd.sourceCode = "var file = new TextFile(output.filePath, TextFile.WriteOnly);"; cmd.sourceCode += "file.truncate();"; cmd.sourceCode += "file.write(\"// There's nothing to see here!\\n\");"; cmd.sourceCode += "file.write(\"int foo() { return 15; }\\n\");"; cmd.sourceCode += "file.close();"; cmd.description = "generating something"; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackFileTags/before/main.cpp0000644000175100017510000000251215154533055025627 0ustar runnerrunner/**************************************************************************** ** ** 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 int main(int argc, char **argv) { std::printf("there's no foo here\n"); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/not-always-updated/0000755000175100017510000000000015154533055023734 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/not-always-updated/not-always-updated.qbs0000644000175100017510000000137115154533055030167 0ustar runnerrunnerimport qbs.TextFile Product { type: "p" Rule { multiplex: true Artifact { filePath: "dummy.txt"; fileTags: "t1"; alwaysUpdated: false } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating dummy"; cmd.sourceCode = function() {}; return cmd; } } Rule { inputs: "t1" Artifact { filePath: "o.txt"; fileTags: "p" } prepare: { var cmd = new JavaScriptCommand; cmd.description = "creating final"; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/symlink-removal/0000755000175100017510000000000015154533055023343 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/symlink-removal/symlink-removal.qbs0000644000175100017510000000057215154533055027207 0ustar runnerrunnerimport qbs.File Product { type: "removal" Rule { multiplex: true outputFileTags: "removal" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { File.remove(product.sourceDirectory + "/dir1"); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/localDeployment/0000755000175100017510000000000015154533055023345 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/localDeployment/main.cpp0000644000175100017510000000357415154533055025006 0ustar runnerrunner/**************************************************************************** ** ** 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 #include #include int main(int argc, char *argv[]) { if (argc != 1) return 1; std::string s = argv[0]; for (auto &c : s) { if (c == '\\') c = '/'; } const std::string mainFilePath = std::string(s.substr(0, s.find_last_of("/")) + "/../share/main.cpp"); std::ifstream in(mainFilePath.c_str()); if (!in.is_open()) { std::cerr << "Failed to open file: " << mainFilePath; return 1; } std::string str((std::istreambuf_iterator(in)), std::istreambuf_iterator()); std::cout << str << std::endl; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/localDeployment/localDeployment.qbs0000644000175100017510000000141715154533055027212 0ustar runnerrunnerimport qbs.Host Project { Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } type: ["application"] consoleApplication: true name: "HelloWorld" destinationDirectory: "bin" Depends { name: "cpp" } cpp.cxxLanguageVersion: "c++11" Group { fileTagsFilter: product.type qbs.install: true qbs.installDir: "bin" } Group { qbs.install: true qbs.installDir: "share" files: ['main.cpp'] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/rpath-link/0000755000175100017510000000000015154533055022263 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/rpath-link/main.cpp0000644000175100017510000000006215154533055023711 0ustar runnerrunner#include int main() { Direct d; } qbs-src-3.2.0/tests/auto/blackbox/testdata/rpath-link/indirect.cpp0000644000175100017510000000005715154533055024572 0ustar runnerrunner#include "indirect.h" Indirect::Indirect() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/rpath-link/direct.h0000644000175100017510000000021115154533055023700 0ustar runnerrunner#ifndef DIRECT_H #define DIRECT_H #include "direct_global.h" class DIRECT_EXPORT Direct { public: Direct(); }; #endif // DIRECT_H qbs-src-3.2.0/tests/auto/blackbox/testdata/rpath-link/indirect.h0000644000175100017510000000015015154533055024231 0ustar runnerrunner#pragma once #include "indirect_global.h" class INDIRECT_EXPORT Indirect { public: Indirect(); }; qbs-src-3.2.0/tests/auto/blackbox/testdata/rpath-link/direct_global.h0000644000175100017510000000035715154533055025233 0ustar runnerrunner#ifndef DIRECT_GLOBAL_H #define DIRECT_GLOBAL_H #if defined(DIRECT_LIBRARY) #define DIRECT_EXPORT __attribute__((visibility("default"))) #else #define DIRECT_EXPORT __attribute__((visibility("default"))) #endif #endif // DIRECT_GLOBAL_H qbs-src-3.2.0/tests/auto/blackbox/testdata/rpath-link/indirect_global.h0000644000175100017510000000026715154533055025562 0ustar runnerrunner#pragma once #if defined(INDIRECT_LIBRARY) #define INDIRECT_EXPORT __attribute__((visibility("default"))) #else #define INDIRECT_EXPORT __attribute__((visibility("default"))) #endif qbs-src-3.2.0/tests/auto/blackbox/testdata/rpath-link/direct.cpp0000644000175100017510000000012315154533055024235 0ustar runnerrunner#include "direct.h" #include "indirect.h" Direct::Direct() { Indirect ind; } qbs-src-3.2.0/tests/auto/blackbox/testdata/rpath-link/rpath-link.qbs0000644000175100017510000000361615154533055025051 0ustar runnerrunnerimport qbs.FileInfo Project { property bool enableConsumer: false property bool enableRPathLink: false DynamicLibrary { name: "indirect" Probe { id: targetInfo property bool isUnixGcc: qbs.targetOS.includes("unix") && !qbs.targetOS.contains("darwin") && qbs.toolchain.includes("gcc") configure: { console.info("is gcc on unix: " + isUnixGcc) } } Depends { name: "cpp" } cpp.defines: "INDIRECT_LIBRARY" files: [ "indirect.cpp", "indirect.h", "indirect_global.h", ] qbs.installPrefix: "" installDir: "/lib" } DynamicLibrary { name: "direct" Depends { name: "cpp" } Depends { name: "indirect" } Depends { name: "Exporter.qbs" } cpp.defines: "DIRECT_LIBRARY" Group { name: "public headers" files: [ "direct.h", "direct_global.h", ] qbs.install: true qbs.installDir: headersInstallDir } files: "direct.cpp" Group { fileTagsFilter: ["Exporter.qbs.module"] qbs.installDir: "/qbs/modules/direct-installed" } qbs.installPrefix: "" installDir: "/lib" property string headersInstallDir: "/include" Export { Depends { name: "cpp" } cpp.includePaths: qbs.installRoot + '/' + exportingProduct.headersInstallDir } } CppApplication { name: "consumer" condition: enableConsumer qbsSearchPaths: qbs.installRoot + "/qbs" Depends { name: "direct-installed" } Properties { condition: project.enableRPathLink cpp.rpathLinkDirs: qbs.installRoot + "/lib" } files: "main.cpp" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/0000755000175100017510000000000015154533055024557 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/gerbil.txt.in0000644000175100017510000000021715154533055027171 0ustar runnerrunnerI once had a gerbil named Bobby, Who had an unusual hobby. He ${DID} on a ${THING}, and now -- oh my ${IDOL}, now all that's left is a blobby. qbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/other-searchpath/0000755000175100017510000000000015154533055030020 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/other-searchpath/modules/0000755000175100017510000000000015154533055031470 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/other-searchpath/modules/limerick/0000755000175100017510000000000015154533055033267 5ustar runnerrunner././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/other-searchpath/modules/limerick/generic.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/other-searchpath/modules/limerick/0000644000175100017510000000007415154533055033272 0ustar runnerrunnerModule { condition: !qbs.targetOS.includes("Beatles") } qbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/choose-module-instance.qbs0000644000175100017510000000062415154533055031635 0ustar runnerrunnerimport qbs.FileInfo Project { qbsSearchPaths: [ ".", path, "modules/..", FileInfo.path(FileInfo.joinPaths(path, "modules")), "other-searchpath" ] Product { Depends { name: "limerick"; versionAtLeast: "2" } type: ["text"] files: ["gerbil.txt.in"] Group { fileTagsFilter: product.type qbs.install: true } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/modules/0000755000175100017510000000000015154533055026227 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/modules/limerick/0000755000175100017510000000000015154533055030026 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/modules/limerick/ritchie.qbs0000644000175100017510000000052415154533055032165 0ustar runnerrunnerModule { condition: qbs.targetOS.containsAny(["Deep Purple", "Rainbow"]) priority: 1 // Overrides the more general "lord.qbs" instance, // which also matches on "Deep Purple". version: "2" Depends { name: "texttemplate" } texttemplate.dict: ({DID: "slipped", THING: "litchi", IDOL: "ritchie"}) } qbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/modules/limerick/lord.qbs0000644000175100017510000000031615154533055031475 0ustar runnerrunnerModule { condition: qbs.targetOS.containsAny(["Deep Purple", "Whitesnake"]) version: "3" Depends { name: "texttemplate" } texttemplate.dict: ({DID: "chewed", THING: "cord", IDOL: "lord"}) } qbs-src-3.2.0/tests/auto/blackbox/testdata/choose-module-instance/modules/limerick/outdated.qbs0000644000175100017510000000005615154533055032347 0ustar runnerrunnerModule { priority: 100 version: "1" } qbs-src-3.2.0/tests/auto/blackbox/testdata/property-evaluation-context/0000755000175100017510000000000015154533055025725 5ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/property-evaluation-context/property-evaluation-context.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/property-evaluation-context/property-evaluation-context.q0000644000175100017510000000206515154533055033625 0ustar runnerrunnerProject { qbsSearchPaths: [ path ] Product { name: "mylib" Export { Depends { name: "top" } top.productInExport: exportingProduct.name } } Product { type: "rule-output" name: "myapp" Depends { name: "mylib" } Rule { alwaysRun: true multiplex: true requiresInputs: false outputFileTags: "rule-output" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.info("base.productInBase evaluated in: " + product.base.productInBase); console.info("base.productInTop evaluated in: " + product.base.productInTop); console.info("top.productInExport evaluated in: " + product.top.productInExport); console.info("top.productInTop evaluated in: " + product.top.productInTop); } return [cmd]; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/property-evaluation-context/modules/0000755000175100017510000000000015154533055027375 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/property-evaluation-context/modules/base/0000755000175100017510000000000015154533055030307 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/property-evaluation-context/modules/base/base.qbs0000644000175100017510000000014015154533055031723 0ustar runnerrunnerModule { property string productInBase: product.name property string productInTop: "" } qbs-src-3.2.0/tests/auto/blackbox/testdata/property-evaluation-context/modules/top/0000755000175100017510000000000015154533055030177 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/property-evaluation-context/modules/top/top.qbs0000644000175100017510000000024315154533055031507 0ustar runnerrunnerModule { Depends { name: "base" } base.productInTop: product.name property string productInTop: product.name property string productInExport: "" } qbs-src-3.2.0/tests/auto/blackbox/testdata/build-directories/0000755000175100017510000000000015154533055023623 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/build-directories/build-directories.qbs0000644000175100017510000000200315154533055027736 0ustar runnerrunnerProject { Product { name: "p1" type: "blubb1" Rule { multiplex: true outputFileTags: "blubb1" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.info(product.buildDirectory); } return cmd; } } } Product { name: "p2" type: "blubb2" Depends { name: "p1" } Rule { inputsFromDependencies: "blubb1" outputFileTags: "blubb2" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.info(product.buildDirectory); console.info(project.buildDirectory); console.info(project.sourceDirectory); } return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/nodejs/0000755000175100017510000000000015154533055021474 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nodejs/hello.qbs0000644000175100017510000000053515154533055023311 0ustar runnerrunnerimport qbs.Host NodeJSApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } nodejs.applicationFile: "hello.js" name: "hello" } qbs-src-3.2.0/tests/auto/blackbox/testdata/nodejs/hello.js0000644000175100017510000000006115154533055023132 0ustar runnerrunnerif (console) { console.log("hello world"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf-library-install/0000755000175100017510000000000015154533055025160 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf-library-install/hello/0000755000175100017510000000000015154533055026263 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf-library-install/hello/world.proto0000644000175100017510000000013415154533055030475 0ustar runnerrunnersyntax = "proto3"; package protobuf.library.hello; message World { int32 value = 1; }; qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf-library-install/protobuf-library.qbs0000644000175100017510000000160115154533055031167 0ustar runnerrunnerimport qbs.Host StaticLibrary { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasProtobuf; } Depends { name: "cpp" } cpp.cxxLanguageVersion: "c++11" cpp.minimumMacosVersion: "10.8" protobuf.cpp.importPaths: product.sourceDirectory Depends { name: "protobuf.cpp"; required: false } property bool hasProtobuf: { console.info("has protobuf: " + protobuf.cpp.present); return protobuf.cpp.present; } Group { fileTagsFilter: "protobuf.hpp" qbs.installDir: "include" qbs.installSourceBase: protobuf.cpp.outputDir qbs.install: true } files: [ "hello.proto", "hello/world.proto", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf-library-install/hello.proto0000644000175100017510000000017115154533055027347 0ustar runnerrunnersyntax = "proto3"; package protobuf.library; import "hello/world.proto"; message Hello { hello.World world = 1; }; qbs-src-3.2.0/tests/auto/blackbox/testdata/successive-changes/0000755000175100017510000000000015154533055023774 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/successive-changes/successive-changes.qbs0000644000175100017510000000136415154533055030271 0ustar runnerrunnerimport qbs.TextFile Project { property string version: "1" Product { name: "theProduct" type: ["output"] Group { files: ["input.in"] fileTags: ["input"] } Rule { inputs: ["input"] Artifact { filePath: "output.out" fileTags: ["output"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating output"; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.write(project.version); } return [cmd]; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/successive-changes/input.in0000644000175100017510000000000015154533055025451 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-rules/0000755000175100017510000000000015154533055024056 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-rules/wildcards-and-rules.qbs0000644000175100017510000000166315154533055030437 0ustar runnerrunnerimport qbs.TextFile Product { name: "wildcards-and-rules" type: "mytype" files: ["*.inp", "*.dep"] FileTagger { patterns: "*.inp" fileTags: ["inp"] } FileTagger { patterns: "*.dep" fileTags: ["dep"] } Rule { multiplex: true inputs: ["inp"] explicitlyDependsOn: ["dep"] Artifact { filePath: "test.mytype" fileTags: product.type } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating output artifact"; cmd.highlight = "codegen"; cmd.sourceCode = function() { var file = new TextFile(output.filePath, TextFile.WriteOnly); for (var i = 0; i < inputs.inp.length; ++i) file.writeLine(inputs.inp[i].fileName); file.close(); } return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/wildcards-and-rules/input1.inp0000644000175100017510000000000015154533055025774 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/empty-profile/0000755000175100017510000000000015154533055023006 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/empty-profile/main.cpp0000644000175100017510000000003115154533055024430 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/empty-profile/empty-profile.qbs0000644000175100017510000000005315154533055026307 0ustar runnerrunnerCppApplication { files: ["main.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/export-to-outside-searchpath/0000755000175100017510000000000015154533055025745 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/export-to-outside-searchpath/qbs-resources/0000755000175100017510000000000015154533055030542 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/export-to-outside-searchpath/qbs-resources/modules/0000755000175100017510000000000015154533055032212 5ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/export-to-outside-searchpath/qbs-resources/modules/aModule/qbs-src-3.2.0/tests/auto/blackbox/testdata/export-to-outside-searchpath/qbs-resources/modules/aModul0000755000175100017510000000000015154533055033354 5ustar runnerrunner././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/export-to-outside-searchpath/qbs-resources/modules/aModule/aModule.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/export-to-outside-searchpath/qbs-resources/modules/aModul0000644000175100017510000000001315154533055033350 0ustar runnerrunnerModule { } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/export-to-outside-searchpath/export-to-outside-searchpath.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/export-to-outside-searchpath/export-to-outside-searchpath0000644000175100017510000000057615154533055033433 0ustar runnerrunnerProject { Project { qbsSearchPaths: ["qbs-resources"] Product { name: "otherProduct" Depends { name: "dep" } } Product { name: "dep" Export { Depends { name: "aModule" } } } } Project { Product { name: "theProduct" Depends { name: "dep" } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/list-properties-with-outer/0000755000175100017510000000000015154533055025464 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-properties-with-outer/list-properties-with-outer.qbs0000644000175100017510000000033515154533055033446 0ustar runnerrunnerProduct { type: ["outtype"] Depends { name: "higher" } lower.listProp: ["product"] Group { files: ["dummy.txt"] fileTags: ["intype"] lower.listProp: outer.concat(["group"]) } } qbs-src-3.2.0/tests/auto/blackbox/testdata/list-properties-with-outer/dummy.txt0000644000175100017510000000000015154533055027346 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-properties-with-outer/modules/0000755000175100017510000000000015154533055027134 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-properties-with-outer/modules/higher/0000755000175100017510000000000015154533055030402 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-properties-with-outer/modules/higher/higher.qbs0000644000175100017510000000011015154533055032347 0ustar runnerrunnerModule { Depends { name: "lower" } lower.listProp: ["higher"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/list-properties-with-outer/modules/lower/0000755000175100017510000000000015154533055030264 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-properties-with-outer/modules/lower/lower.qbs0000644000175100017510000000061315154533055032123 0ustar runnerrunnerModule { property stringList listProp Rule { inputs: ["intype"] outputFileTags: "outtype" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.info("listProp: " + JSON.stringify(input.lower.listProp)); } return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/makefile-generator/0000755000175100017510000000000015154533055023753 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/makefile-generator/main.cpp0000644000175100017510000000012315154533055025377 0ustar runnerrunner#include int main() { std::cout << "Hello, World!" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/makefile-generator/app.qbs0000644000175100017510000000130615154533055025242 0ustar runnerrunnerimport qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); console.info("executable suffix: " + cpp.executableSuffix); return result; } name: "the app" consoleApplication: true cpp.cxxLanguageVersion: "c++11" cpp.separateDebugInformation: false Properties { condition: qbs.targetOS.includes("macos") bundle.embedInfoPlist: false cpp.minimumMacosVersion: "10.7" } files: "main.cpp" qbs.installPrefix: "/usr/local" install: true } qbs-src-3.2.0/tests/auto/blackbox/testdata/host-os-properties/0000755000175100017510000000000015154533055024000 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/host-os-properties/main.cpp0000644000175100017510000000025015154533055025425 0ustar runnerrunner#include int main() { std::printf("HOST_ARCHITECTURE = %s\n", HOST_ARCHITECTURE); std::printf("HOST_PLATFORM = %s\n", HOST_PLATFORM); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/host-os-properties/host-os-properties.qbs0000644000175100017510000000073215154533055030277 0ustar runnerrunnerimport qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } consoleApplication: true cpp.defines: [ 'HOST_ARCHITECTURE="' + Host.architecture() + '"', 'HOST_PLATFORM="' + Host.platform() + '"' ] files: "main.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-extension-instantiation/0000755000175100017510000000000015154533055026534 5ustar runnerrunner././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-extension-instantiation/invalid-extension-instantiation.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-extension-instantiation/invalid-extension-instant0000644000175100017510000000104715154533055033577 0ustar runnerrunnerimport qbs.Environment import qbs.File import qbs.FileInfo import qbs.Utilities Product { name: "theProduct" type: ["mytype"] property string extension Rule { multiplex: true Artifact { filePath: "dummy" fileTags: product.type } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var f = eval("new " + product.extension); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/error-info/0000755000175100017510000000000015154533055022274 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/error-info/error-info.qbs0000644000175100017510000000346415154533055025074 0ustar runnerrunnerimport "helper.js" as Helper Project { property bool fail1: false property bool fail2: false property bool fail3: false property bool fail4: false property bool fail5: false property bool fail6: false property bool fail7: false Product { name: "myproduct" type: ["foo", "bar"] Rule { multiplex: true Artifact { fileTags: ["foo"] filePath: { var path = "foo"; if (project.fail1) throw "fail1"; return path; } } prepare: { var cmd = new JavaScriptCommand(); cmd.sourceCode = function () { }; cmd.silent = true; if (project.fail2) generate.an.error; if (project.fail6) Helper.doSomethingEvil(); return cmd; } } Rule { multiplex: true outputFileTags: ["bar"] outputArtifacts: { var list = []; list.push({ fileTags: ["bar"], filePath: "bar" }); if (project.fail3) throw "fail3"; if (project.fail5) Helper.doSomethingBad(); return list; } prepare: { var cmd = new JavaScriptCommand(); cmd.fail7 = project.fail7; cmd.sourceCode = function () { if (fail7) will.fail; }; cmd.silent = true; if (project.fail4) generate.an.error; return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/error-info/helper.js0000644000175100017510000000016015154533055024106 0ustar runnerrunnervar x; function doSomethingBad() { nothinghere.works; } function doSomethingEvil() { throw "OUCH!"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackAddFile/0000755000175100017510000000000015154533055022527 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/trackAddFile/after/0000755000175100017510000000000015154533055023630 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/trackAddFile/after/main.cpp0000644000175100017510000000265115154533055025264 0ustar runnerrunner/**************************************************************************** ** ** 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 "narf.h" #include "zort.h" #include int main(int argc, char **argv) { std::printf("Hello World!\n"); Narf narf; narf.shout(); Zort zort; zort.shout(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackAddFile/after/zort.cpp0000644000175100017510000000246315154533055025337 0ustar runnerrunner/**************************************************************************** ** ** 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 "zort.h" #include void Zort::shout() { std::printf("ZORT!\n"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackAddFile/after/trackAddFile.qbs0000644000175100017510000000106515154533055026656 0ustar runnerrunnerimport qbs.Host Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: 'someapp' type: 'application' consoleApplication: true property bool dummy: { console.info("object suffix: " + cpp.objectSuffix); } Depends { name: 'cpp' } files: [ "main.cpp", "narf.h", "narf.cpp", "zort.h", "zort.cpp" ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackAddFile/after/zort.h0000644000175100017510000000245415154533055025004 0ustar runnerrunner/**************************************************************************** ** ** 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 ZORT_H #define ZORT_H class Zort { public: void shout(); }; #endif qbs-src-3.2.0/tests/auto/blackbox/testdata/trackAddFile/before/0000755000175100017510000000000015154533055023771 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/trackAddFile/before/main.cpp0000644000175100017510000000256615154533055025432 0ustar runnerrunner/**************************************************************************** ** ** 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 "narf.h" #include int main(int argc, char **argv) { std::printf("Hello World!\n"); Narf narf; narf.shout(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackAddFile/before/narf.cpp0000644000175100017510000000246315154533055025430 0ustar runnerrunner/**************************************************************************** ** ** 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 "narf.h" #include void Narf::shout() { std::printf("NARF!\n"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackAddFile/before/trackAddFile.qbs0000644000175100017510000000100315154533055027007 0ustar runnerrunnerimport qbs.Host Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: 'someapp' type: 'application' consoleApplication: true property bool dummy: { console.info("object suffix: " + cpp.objectSuffix); } Depends { name: 'cpp' } files: [ "main.cpp", "narf.h", "narf.cpp" ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackAddFile/before/narf.h0000644000175100017510000000245415154533055025075 0ustar runnerrunner/**************************************************************************** ** ** 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 NARF_H #define NARF_H class Narf { public: void shout(); }; #endif qbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-temporarydir/0000755000175100017510000000000015154533055025465 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-temporarydir/jsextensions-temporarydir.qbs0000644000175100017510000000113415154533055033446 0ustar runnerrunnerimport qbs.File import qbs.TemporaryDir Product { targetName: { var dir; var dirPath; try { dir = new TemporaryDir(); dirPath = dir.path(); if (!dirPath) throw "path is empty"; if (!dir.isValid()) throw "dir is not valid"; if (!File.exists(dirPath)) throw "dir does not exist"; } finally { if (!dir.remove()) throw "could not remove"; } if (File.exists(dirPath)) throw "dir was not removed"; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-command-property/0000755000175100017510000000000015154533055025136 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-command-property/input.txt0000644000175100017510000000000015154533055027024 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-command-property/invalid-command-property.qbs0000644000175100017510000000161315154533055032572 0ustar runnerrunnerimport qbs.TextFile Product { name: "p" property string errorType type: ["output"] Group { files: ["input.txt"] fileTags: ["input"] } Rule { inputs: ["input"] Artifact { filePath: "dummy" fileTags: ["output"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating output"; if (product.errorType === "qobject") cmd.dummy = new TextFile(input.filePath, TextFile.ReadOnly); else if (product.errorType === "input") cmd.dummy = input; else if (product.errorType === "artifact") cmd.dummy = product.artifacts.qbs[0]; else throw "invalid error type " + product.errorType; cmd.sourceCode = function() { } return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-tree/0000755000175100017510000000000015154533055022615 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-tree/install-tree.qbs0000644000175100017510000000033215154533055025725 0ustar runnerrunnerCppApplication { files: ["main.cpp"] qbs.installPrefix: "" Group { files: ["data/**/*.txt"] qbs.install: true qbs.installDir: "content" qbs.installSourceBase: "data" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-tree/main.cpp0000644000175100017510000000236415154533055024252 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-tree/data/0000755000175100017510000000000015154533055023526 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-tree/data/subdir1/0000755000175100017510000000000015154533055025077 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-tree/data/subdir1/bar.txt0000644000175100017510000000000015154533055026372 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-tree/data/subdir2/0000755000175100017510000000000015154533055025100 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-tree/data/subdir2/baz.txt0000644000175100017510000000000015154533055026403 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-tree/data/foo.txt0000644000175100017510000000000015154533055025040 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/linker-type-recursive/0000755000175100017510000000000015154533055024462 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/linker-type-recursive/static.c0000644000175100017510000000002015154533055026105 0ustar runnerrunnervoid funcC() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-type-recursive/static.cpp0000644000175100017510000000013415154533055026453 0ustar runnerrunner#include extern "C" { void funcCxx() { std::cout << "Hi!" << std::endl; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-type-recursive/linker-type-recursive.qbs0000644000175100017510000000076315154533055031447 0ustar runnerrunnerimport qbs.Host Project { StaticLibrary { name: "StaticCxx" files: "static.cpp" } StaticLibrary { name: "StaticC" Depends { name: "StaticCxx" } files: "static.c" } CppApplication { Depends { name: "StaticC" } property bool dummy: { if (qbs.targetPlatform !== Host.platform() || qbs.architecture !== Host.architecture()) console.info("no host target"); } files: "main.c" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-type-recursive/main.c0000644000175100017510000000006315154533055025551 0ustar runnerrunnervoid funcCxx(); int main(void) { funcCxx(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/ruleCycle/0000755000175100017510000000000015154533055022141 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/ruleCycle/happy.grass0000644000175100017510000000003015154533055024314 0ustar runnerrunnerhappy! happy! joy! joy! qbs-src-3.2.0/tests/auto/blackbox/testdata/ruleCycle/ruleCycle.qbs0000644000175100017510000000247415154533055024606 0ustar runnerrunnerProject { Product { name: "the cycle of life" type: "cow" Group { files: ["happy.grass"] fileTags: ["grass"] } Rule { inputs: ["grass"] outputFileTags: ["cow"] outputArtifacts: [{ filePath: input.completeBaseName + ".cow", fileTags: ["cow"] }] prepare: { console.info("The cow feeds on grass."); } } Rule { inputs: ["cow"] Artifact { filePath: input.completeBaseName + ".cow_pat" fileTags: ["cow_pat"] } prepare: { console.info("The cow pat falls out of the cow."); } } Rule { inputs: ["cow_pat"] Artifact { filePath: input.completeBaseName + ".fertilizer" fileTags: ["fertilizer"] } prepare: { console.info("The cow pat is used as fertilizer."); } } Rule { inputs: ["fertilizer"] outputFileTags: ["grass"] outputArtifacts: [{ filePath: input.completeBaseName + ".grass", fileTags: ["grass"] }] prepare: { console.info("The fertilizer lets the grass grow."); } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/badInterpreter/0000755000175100017510000000000015154533055023164 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/badInterpreter/qbs/0000755000175100017510000000000015154533055023751 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/badInterpreter/qbs/modules/0000755000175100017510000000000015154533055025421 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/badInterpreter/qbs/modules/script-test/0000755000175100017510000000000015154533055027702 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/badInterpreter/qbs/modules/script-test/script-test.qbs0000644000175100017510000000206115154533055032671 0ustar runnerrunnerimport qbs.FileInfo import qbs.TextFile Module { name: "script-test" Rule { inputs: ["script"] Artifact { filePath: FileInfo.joinPaths(project.buildDirectory, input.fileName) fileTags: ["application"] } prepare: { var cmds = []; var cmd = new JavaScriptCommand(); cmd.description = "copying " + input.fileName; cmd.sourceCode = function() { var tf = new TextFile(input.filePath, TextFile.ReadOnly); var s = tf.readAll().replace("$PWD", project.buildDirectory); tf.close(); var tf2 = new TextFile(output.filePath, TextFile.ReadWrite); tf2.write(s); tf2.close(); }; cmds.push(cmd); if (output.fileName !== "script-noexec") { var cmd2 = new Command("chmod", ["+x", output.filePath]); cmd2.silent = true; cmds.push(cmd2); } return cmds; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/badInterpreter/script-ok0000755000175100017510000000001215154533055025016 0ustar runnerrunner#!/bin/sh qbs-src-3.2.0/tests/auto/blackbox/testdata/badInterpreter/script-noexec0000644000175100017510000000000015154533055025660 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/badInterpreter/script-interp-missing0000755000175100017510000000002215154533055027356 0ustar runnerrunner#!/does/not/exist qbs-src-3.2.0/tests/auto/blackbox/testdata/badInterpreter/script-interp-noexec0000755000175100017510000000002515154533055027171 0ustar runnerrunner#!$PWD/script-noexec qbs-src-3.2.0/tests/auto/blackbox/testdata/badInterpreter/badInterpreter.qbs0000644000175100017510000000226515154533055026652 0ustar runnerrunnerimport qbs.Host Project { property bool dummy: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } qbsSearchPaths: base.concat(["qbs"]) Product { Depends { name: "script-test" } name: "script-ok" type: ["application"] Group { files: [product.name] fileTags: ["script"] } } Product { Depends { name: "script-test" } name: "script-noexec" type: ["application"] Group { files: [product.name] fileTags: ["script"] } } Product { Depends { name: "script-test" } name: "script-interp-missing" type: ["application"] Group { files: [product.name] fileTags: ["script"] } } Product { Depends { name: "script-test" } name: "script-interp-noexec" type: ["application"] Group { files: [product.name] fileTags: ["script"] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/conflicting-artifacts/0000755000175100017510000000000015154533055024467 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/conflicting-artifacts/main.cpp0000644000175100017510000000235115154533055026120 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/conflicting-artifacts/conflicting-artifacts.qbs0000644000175100017510000000050415154533055031452 0ustar runnerrunnerProject { CppApplication { name: "a" targetName: "theName" destinationDirectory: project.buildDirectory files: ["main.cpp"] } CppApplication { name: "b" targetName: "theName" destinationDirectory: project.buildDirectory files: ["main.cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/suspicious-calls/0000755000175100017510000000000015154533055023514 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/suspicious-calls/direntries-prepare.qbs0000644000175100017510000000070215154533055030026 0ustar runnerrunnerimport qbs.File Product { type: ["out"] Group { files: ["test.txt"] fileTags: ["in"] } Rule { inputs: ["in"] outputFileTags: "out" prepare: { var dummy = File.directoryEntries(product.sourceDirectory, File.Files); var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/suspicious-calls/test.txt0000644000175100017510000000000015154533055025222 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/suspicious-calls/direntries-eval.qbs0000644000175100017510000000013515154533055027317 0ustar runnerrunnerimport qbs.File Product { name: File.directoryEntries(sourceDirectory, File.Files)[0] } qbs-src-3.2.0/tests/auto/blackbox/testdata/suspicious-calls/copy-eval.qbs0000644000175100017510000000026415154533055026124 0ustar runnerrunnerimport qbs.File Product { name: { File.copy(sourceDirectory + "/copy-eval.qbs", sourceDirectory + "/copy-eval2.qbs"); return "blubb" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/suspicious-calls/copy-command.qbs0000644000175100017510000000063215154533055026612 0ustar runnerrunnerimport qbs.File Product { type: ["out"] Group { files: ["test.txt"] fileTags: ["in"] } Rule { inputs: ["in"] outputFileTags: "out" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/suspicious-calls/direntries-probe.qbs0000644000175100017510000000043715154533055027504 0ustar runnerrunnerimport qbs.File Product { Probe { id: theProbe property string baseDir: project.sourceDirectory property stringList subDirs configure: { subDirs = File.directoryEntries(baseDir, File.AllDirs); found = true; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/suspicious-calls/copy-probe.qbs0000644000175100017510000000040515154533055026301 0ustar runnerrunnerimport qbs.File Product { Probe { id: theProbe property string baseDir: project.sourceDirectory configure: { File.copy(baseDir + "/copy-probe.qbs", baseDir + "/copy-probe2.qbs"); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/suspicious-calls/direntries-command.qbs0000644000175100017510000000072215154533055030010 0ustar runnerrunnerimport qbs.File Product { type: ["out"] Group { files: ["test.txt"] fileTags: ["in"] } Rule { inputs: ["in"] outputFileTags: "out" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var dummy = File.directoryEntries(product.sourceDirectory, File.Files); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/suspicious-calls/copy-prepare.qbs0000644000175100017510000000065615154533055026640 0ustar runnerrunnerimport qbs.File Product { type: ["out"] Group { files: ["test.txt"] fileTags: ["in"] } Rule { inputs: ["in"] outputFileTags: "out" prepare: { File.copy(input.filePath, output.filePath); var cmd = new JavaScriptCommand(); cmd.description = "no-op"; cmd.sourceCode = function() { }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/module-conditions/0000755000175100017510000000000015154533055023646 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/module-conditions/module-conditions.qbs0000644000175100017510000000061515154533055030013 0ustar runnerrunnerProject { Product { name: "p1" qbs.architecture: "a" Depends { name: "m" } } Product { name: "p2" qbs.architecture: "b" Depends { name: "m" } } Product { name: "p3" multiplexByQbsProperties: "architectures" aggregate: false qbs.architectures: ["b", "c", "d"] Depends { name: "m" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/module-conditions/modules/0000755000175100017510000000000015154533055025316 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/module-conditions/modules/m/0000755000175100017510000000000015154533055025552 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/module-conditions/modules/m/m3.qbs0000644000175100017510000000015415154533055026600 0ustar runnerrunnerModule { condition: qbs.architecture === "c" validate: { console.info("loaded m3"); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/module-conditions/modules/m/m1.qbs0000644000175100017510000000015415154533055026576 0ustar runnerrunnerModule { condition: qbs.architecture === "a" validate: { console.info("loaded m1"); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/module-conditions/modules/m/m2.qbs0000644000175100017510000000015415154533055026577 0ustar runnerrunnerModule { condition: qbs.architecture === "b" validate: { console.info("loaded m2"); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/module-conditions/modules/m/m4.qbs0000644000175100017510000000015415154533055026601 0ustar runnerrunnerModule { condition: qbs.architecture === "d" validate: { console.info("loaded m4"); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerscripts/0000755000175100017510000000000015154533055023106 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/linkerscripts/linkerscripts.qbs0000644000175100017510000000374615154533055026523 0ustar runnerrunnerimport qbs.TextFile DynamicLibrary { type: base.concat("custom") Depends { name: "cpp" } files: ["testlib.c"] Group { name: "linker scripts" files: [ "linkerscript1", "linkerscript2", ] fileTags: ["linkerscript"] } cpp.libraryPaths: [ product.sourceDirectory, // location of linkerscripts that are included ] Rule { multiplex: true outputFileTags: "custom" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.warn("---" + product.cpp.nmPath + "---"); } return [cmd]; } } Rule { multiplex: true requiresInputs: false Artifact { filePath: product.buildDirectory + "/linkerscript_with_includes" fileTags: ["linkerscript"] } prepare: { var cmd = new JavaScriptCommand(); cmd.sourcePath = product.sourceDirectory; cmd.buildPath = product.buildDirectory; cmd.sourceCode = function() { var file = new TextFile(buildPath + "/linkerscript_with_includes", TextFile.WriteOnly); file.write("SEARCH_DIR(\"" + sourcePath + "/scripts\")\n" + "INCLUDE linkerscript_to_include\n" + "INCLUDE linkerscript_in_directory\n"); file.close(); } cmd.highlight = "codegen"; cmd.description = "generating linkerscript with SEARCH_DIR and INCLUDE"; return [cmd]; } } Probe { id: checker property bool isGcc: qbs.toolchain.contains("gcc") property bool isLinux: qbs.targetOS.contains("linux") configure: { console.info("is Linux gcc: " + (isGcc && isLinux)) } } qbs.installPrefix: "" install: true installDir: "" } qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerscripts/linkerscript_to_include0000644000175100017510000000007515154533055027751 0ustar runnerrunnerTEST_SYMBOL_FROM_INCLUDE = 1; INCLUDE linkerscript_recursive qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerscripts/testlib.c0000644000175100017510000000235315154533055024723 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void dummy() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerscripts/linkerscript10000644000175100017510000000002215154533055025615 0ustar runnerrunnerTEST_SYMBOL1 = 0; qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerscripts/linkerscript20000644000175100017510000000002215154533055025616 0ustar runnerrunnerTEST_SYMBOL2 = 1; qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerscripts/scripts/0000755000175100017510000000000015154533055024575 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/linkerscripts/scripts/linkerscript_in_directory0000644000175100017510000000004015154533055031775 0ustar runnerrunnerTEST_SYMBOL_FROM_DIRECTORY = 1; qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerscripts/linkerscript_recursive0000644000175100017510000000004015154533055027623 0ustar runnerrunnerTEST_SYMBOL_FROM_RECURSIVE = 1; qbs-src-3.2.0/tests/auto/blackbox/testdata/import-in-properties-condition/0000755000175100017510000000000015154533055026306 5ustar runnerrunner././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/import-in-properties-condition/import-in-properties-condition.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/import-in-properties-condition/import-in-properties-condi0000644000175100017510000000005415154533055033432 0ustar runnerrunnerProduct { Depends { name: "amodule" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-in-properties-condition/modules/0000755000175100017510000000000015154533055027756 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-in-properties-condition/modules/depmodule/0000755000175100017510000000000015154533055031734 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-in-properties-condition/modules/depmodule/m.qbs0000644000175100017510000000004415154533055032675 0ustar runnerrunnerModule { property string prop } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-in-properties-condition/modules/amodule/0000755000175100017510000000000015154533055031404 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-in-properties-condition/modules/amodule/m.qbs0000644000175100017510000000023515154533055032347 0ustar runnerrunnerimport qbs.File Module { Depends { name: "depmodule" } Properties { condition: File.exists("blubb") depmodule.prop: "blubb" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/installed-source-files/0000755000175100017510000000000015154533055024567 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/installed-source-files/main.cpp0000644000175100017510000000236415154533055026224 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/installed-source-files/readme.txt0000644000175100017510000000002615154533055026563 0ustar runnerrunnerimportant information qbs-src-3.2.0/tests/auto/blackbox/testdata/installed-source-files/installed-source-files.qbs0000644000175100017510000000062715154533055031660 0ustar runnerrunnerCppApplication { consoleApplication: true files: ["main.cpp"] qbs.installPrefix: "" Group { fileTagsFilter: ["cpp"] qbs.install: true } Group { // this overwrites the properties of the group below fileTagsFilter: ["text"] qbs.install: true } Group { files: ["readme.txt"] fileTags: ["text"] qbs.install: false } } qbs-src-3.2.0/tests/auto/blackbox/testdata/ruleConditions/0000755000175100017510000000000015154533055023213 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/ruleConditions/main.cpp0000644000175100017510000000236415154533055024650 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/ruleConditions/ruleConditions.qbs0000644000175100017510000000043315154533055026723 0ustar runnerrunnerProduct { type: ["application", "zort"] consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: "cpp" } Depends { name: "narfzort" } files: [ "main.cpp", "foo.narf" ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/ruleConditions/foo.narf0000644000175100017510000000000015154533055024634 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/ruleConditions/modules/0000755000175100017510000000000015154533055024663 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/ruleConditions/modules/narfzort/0000755000175100017510000000000015154533055026530 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/ruleConditions/modules/narfzort/narfzort.qbs0000644000175100017510000000203515154533055031104 0ustar runnerrunnerimport qbs.FileInfo import qbs.TextFile Module { property bool enableGroup property bool enableRule property bool enableTagger Group { condition: enableGroup FileTagger { condition: module.enableTagger patterns: "*.narf" fileTags: ["narf"] } Rule { condition: module.enableRule inputs: ["narf"] outputFileTags: ["zort"] outputArtifacts: [{ filePath: product.name + "." + input.fileName + ".zort", fileTags: ["zort"] }] prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + FileInfo.fileName(output.filePath); cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.write("NARF! ZORT!"); f.close(); } return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/propertyChanges/0000755000175100017510000000000015154533055023367 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/propertyChanges/source2.cpp0000644000175100017510000000235215154533055025457 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/propertyChanges/ruletest.qbs0000644000175100017510000000027515154533055025751 0ustar runnerrunnerProduct { name: "ruletest" type: "test-output" Depends { name: "TestModule" } Group { files: "test.in" TestModule.testProperty: project.testProperty } } qbs-src-3.2.0/tests/auto/blackbox/testdata/propertyChanges/source3.cpp0000644000175100017510000000235215154533055025460 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/propertyChanges/propertyChanges.qbs0000644000175100017510000000535315154533055027261 0ustar runnerrunnerimport qbs.Environment import qbs.File import qbs.TextFile Project { property var projectDefines: ["blubb2"] property string fileContentSuffix: "suffix 1" property string testProperty: "default value" CppApplication { name: qbs.enableDebugCode ? "product 1.debug" : "product 1.release" cpp.defines: ["blubb1"] files: "source1.cpp" } CppApplication { Depends { name: 'library' } name: "product 2" cpp.defines: project.projectDefines files: "source2.cpp" } CppApplication { name: "product 3" cpp.defines: Environment.getEnv("QBS_BLACKBOX_DEFINE") files: "source3.cpp" } DynamicLibrary { Depends { name: "cpp" } name: "library" files: "lib.cpp" Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } Product { name: "generated text file" type: ["my_output"] property string fileContentPrefix: "prefix 1" Rule { multiplex: true Artifact { filePath: "nothing"; fileTags: ["my_output"] } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.info(product.fileContentPrefix); } return cmd; } } Rule { multiplex: true Artifact { filePath: "generated.txt"; fileTags: ["my_output"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.filePath; cmd.highlight = "codegen"; cmd.sourceCode = function() { file = new TextFile(output.filePath, TextFile.WriteOnly); file.truncate(); file.write(product.fileContentPrefix + "contents 1" + project.fileContentSuffix); file.close(); } return cmd; } } } Product { Depends { name: "ruletest" } type: ["test-output2"] Rule { inputsFromDependencies: ['test-output'] Artifact { fileTags: "test-output2" filePath: input.fileName + ".out2" } prepare: { var cmd = new JavaScriptCommand(); cmd.highlight = "codegen"; cmd.description = "making output from other output"; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return cmd; } } } references: "ruletest.qbs" qbsSearchPaths: "." } qbs-src-3.2.0/tests/auto/blackbox/testdata/propertyChanges/test.in0000644000175100017510000000000615154533055024672 0ustar runnerrunnerblubb qbs-src-3.2.0/tests/auto/blackbox/testdata/propertyChanges/lib.cpp0000644000175100017510000000241515154533055024643 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" DLL_EXPORT void f() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/propertyChanges/modules/0000755000175100017510000000000015154533055025037 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/propertyChanges/modules/TestModule/0000755000175100017510000000000015154533055027124 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/propertyChanges/modules/TestModule/module.qbs0000644000175100017510000000156515154533055031127 0ustar runnerrunnerimport qbs.File Module { FileTagger { patterns: ["*.in"] fileTags: "test-input" } property string testProperty Rule { inputs: ['test-input'] Artifact { fileTags: "test-output" filePath: input.fileName + ".out" } prepare: { var cmd = new JavaScriptCommand(); cmd.highlight = "codegen"; cmd.description = "making output from input"; cmd.sourceCode = function() { // console.info('Change in source code'); console.info(input.TestModule.testProperty); File.copy(input.filePath, output.filePath); } var dummyCmd = new JavaScriptCommand(); dummyCmd.silent = true; dummyCmd.sourceCode = function() {}; return [cmd, dummyCmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/propertyChanges/source1.cpp0000644000175100017510000000235115154533055025455 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/installable/0000755000175100017510000000000015154533055022504 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/installable/main.cpp0000644000175100017510000000235115154533055024135 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/installable/installable.qbs0000644000175100017510000000221615154533055025506 0ustar runnerrunnerimport qbs.TextFile Project { CppApplication { type: ["application"] name: "app" consoleApplication: true Group { files: ["main.cpp"] qbs.install: true } install: true installDebugInformation: false installDir: "" } Product { name: "install-list" type: ["install-list"] Depends { name: "app" } Rule { multiplex: true inputsFromDependencies: ["installable"] Artifact { filePath: "installed-files.txt" fileTags: product.type } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { var file = new TextFile(output.filePath, TextFile.WriteOnly); for (var i = 0; i < inputs.installable.length; ++i) file.writeLine(inputs.installable[i].filePath); file.close(); }; return [cmd]; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/system-include-paths/0000755000175100017510000000000015154533055024274 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/system-include-paths/main.cpp0000644000175100017510000000013015154533055025716 0ustar runnerrunner#include #include int main() { printStuff(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/system-include-paths/system-include-paths.qbs0000644000175100017510000000012215154533055031060 0ustar runnerrunnerCppApplication { files: ["main.cpp"] cpp.systemIncludePaths: ["subdir"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/system-include-paths/subdir/0000755000175100017510000000000015154533055025564 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/system-include-paths/subdir/gagagugu.h0000644000175100017510000000010115154533055027514 0ustar runnerrunnervoid printStuff() { puts("alalalalonglonglilonglonglong"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/0000755000175100017510000000000015154533055021642 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/lex_outfile/0000755000175100017510000000000015154533055024161 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/lex_outfile/lexer.l0000644000175100017510000000045415154533055025460 0ustar runnerrunner%option outfile="quark.cpp" %{ #include void yyerror(const char *e) { std::cerr << e; } extern "C" int yywrap() { return 1; } extern YYSTYPE yylval; %} ID [a-z]+ AND "&&" OR "||" NOT "!" %% [[:space:]]+ {ID} yylval.s = yytext; return 1; {AND} return 2; {OR} return 3; {NOT} return 4; %% qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/lex_outfile/lex_outfile.qbs0000644000175100017510000000060215154533055027205 0ustar runnerrunnerCppApplication { qbsSearchPaths: ".." Depends { name: "bisonhelper" } Depends { name: "lex_yacc" } lex_yacc.outputTag: "cpp" lex_yacc.yaccFlags: ["-l"] cpp.includePaths: [".", ".."] cpp.cxxLanguageVersion: "c++11" cpp.minimumMacosVersion: "10.7" consoleApplication: true files: [ "lexer.l", "parser.y", "types.h", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/lex_outfile/types.h0000644000175100017510000000325415154533055025502 0ustar runnerrunner/**************************************************************************** ** ** 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 #include #include #include struct Tree; using TreePtr = std::shared_ptr; struct Tree { std::string val; std::vector children; void print() const { std::cout << val << ' '; for (const TreePtr &t : children) t->print(); } }; struct YaccType { TreePtr t; std::string s; }; #define YYSTYPE YaccType extern TreePtr root; int yylex(); void yyerror(const char *); qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/lex_outfile/parser.y0000644000175100017510000000117315154533055025651 0ustar runnerrunner%{ #include %} %type expr %left OR %left AND %nonassoc NOT %token ID %% start: expr { root = $1; } expr: expr AND expr { auto t = std::make_shared(); t->val = "AND"; t->children = { $1, $3 }; $$ = t; } | expr OR expr { auto t = std::make_shared(); t->val = "OR"; t->children = { $1, $3 }; $$ = t; } | NOT expr { auto t = std::make_shared(); t->val = "NOT"; t->children = { $2 }; $$ = t; } | ID { auto t = std::make_shared(); t->val = $1; $$ = t; } %% TreePtr root; int main() { yyparse(); if (!root) return 1; root->print(); std::cout << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/unistd.h0000644000175100017510000000022015154533055023313 0ustar runnerrunner#ifndef MY_UNISTD_H #define MY_UNISTD_H #ifdef _MSC_BUILD #include #define isatty _isatty #else #include_next #endif #endif qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/two-grammars/0000755000175100017510000000000015154533055024262 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/two-grammars/g1.l0000644000175100017510000000024015154533055024742 0ustar runnerrunner%option noyywrap %{ #include #ifdef _MSC_BUILD #pragma message("whatever") #else #pragma whatever #endif void g1error(const char *e) { } %} %% %% qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/two-grammars/g1.y0000644000175100017510000000007715154533055024767 0ustar runnerrunner%{ int g1lex(); void g1error(const char *s); %} %% expr: '1' qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/two-grammars/two-grammars.qbs0000644000175100017510000000034215154533055027410 0ustar runnerrunnerimport qbs.Host CppApplication { Depends { name: "lex_yacc" } consoleApplication: true cpp.includePaths: ".." files: [ "g1.l", "g1.y", "g2.l", "g2.y", "main.c", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/two-grammars/g2.l0000644000175100017510000000012415154533055024744 0ustar runnerrunner%option noyywrap %{ #include void g2error(const char *e) { } %} %% %% qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/two-grammars/g2.y0000644000175100017510000000007715154533055024770 0ustar runnerrunner%{ int g2lex(); void g2error(const char *s); %} %% expr: '1' qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/two-grammars/main.c0000644000175100017510000000246515154533055025361 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int g1parse(); int g2parse(); int main() { g1parse(); g2parse(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/lex_prefix/0000755000175100017510000000000015154533055024007 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/lex_prefix/lexer.l0000644000175100017510000000045315154533055025305 0ustar runnerrunner%option prefix="bla" %{ #include void blaerror(const char *e) { std::cerr << e; } extern "C" int blawrap() { return 1; } extern BLASTYPE blalval; %} ID [a-z]+ AND "&&" OR "||" NOT "!" %% [[:space:]]+ {ID} blalval.s = blatext; return 1; {AND} return 2; {OR} return 3; {NOT} return 4; %% qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/lex_prefix/types.h0000644000175100017510000000325715154533055025333 0ustar runnerrunner/**************************************************************************** ** ** 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 #include #include #include struct Tree; using TreePtr = std::shared_ptr; struct Tree { std::string val; std::vector children; void print() const { std::cout << val << ' '; for (const TreePtr &t : children) t->print(); } }; struct YaccType { TreePtr t; std::string s; }; #define BLASTYPE YaccType extern TreePtr root; int blalex(); void blaerror(const char *); qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/lex_prefix/lex_prefix.qbs0000644000175100017510000000060215154533055026661 0ustar runnerrunnerCppApplication { qbsSearchPaths: ".." Depends { name: "bisonhelper" } Depends { name: "lex_yacc" } lex_yacc.outputTag: "cpp" lex_yacc.yaccFlags: ["-l"] cpp.includePaths: [".", ".."] cpp.cxxLanguageVersion: "c++11" cpp.minimumMacosVersion: "10.7" consoleApplication: true files: [ "lexer.l", "parser.y", "types.h", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/lex_prefix/parser.y0000644000175100017510000000122515154533055025475 0ustar runnerrunner%{ #include %} %define api.prefix {bla} %type expr %left OR %left AND %nonassoc NOT %token ID %% start: expr { root = $1; } expr: expr AND expr { auto t = std::make_shared(); t->val = "AND"; t->children = { $1, $3 }; $$ = t; } | expr OR expr { auto t = std::make_shared(); t->val = "OR"; t->children = { $1, $3 }; $$ = t; } | NOT expr { auto t = std::make_shared(); t->val = "NOT"; t->children = { $2 }; $$ = t; } | ID { auto t = std::make_shared(); t->val = $1; $$ = t; } %% TreePtr root; int main() { blaparse(); if (!root) return 1; root->print(); std::cout << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/yacc_output/0000755000175100017510000000000015154533055024201 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/yacc_output/lexer.l0000644000175100017510000000045415154533055025500 0ustar runnerrunner%{ #include #include void yyerror(const char *e) { std::cerr << e; } extern "C" int yywrap() { return 1; } extern YYSTYPE yylval; %} ID [a-z]+ AND "&&" OR "||" NOT "!" %% [[:space:]]+ {ID} yylval.s = yytext; return ID; {AND} return AND; {OR} return OR; {NOT} return NOT; %% qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/yacc_output/yacc_output.qbs0000644000175100017510000000050515154533055027247 0ustar runnerrunnerCppApplication { Depends { name: "lex_yacc" } lex_yacc.outputTag: "cpp" lex_yacc.yaccFlags: ["-l"] cpp.includePaths: [".", ".."] cpp.cxxLanguageVersion: "c++11" cpp.minimumMacosVersion: "10.7" consoleApplication: true files: [ "lexer.l", "parser.y", "types.h", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/yacc_output/types.h0000644000175100017510000000325415154533055025522 0ustar runnerrunner/**************************************************************************** ** ** 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 #include #include #include struct Tree; using TreePtr = std::shared_ptr; struct Tree { std::string val; std::vector children; void print() const { std::cout << val << ' '; for (const TreePtr &t : children) t->print(); } }; struct YaccType { TreePtr t; std::string s; }; #define YYSTYPE YaccType extern TreePtr root; int yylex(); void yyerror(const char *); qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/yacc_output/parser.y0000644000175100017510000000122015154533055025662 0ustar runnerrunner%{ #include %} %output "parser.cxx" %type expr %left OR %left AND %nonassoc NOT %token ID %% start: expr { root = $1; } expr: expr AND expr { auto t = std::make_shared(); t->val = "AND"; t->children = { $1, $3 }; $$ = t; } | expr OR expr { auto t = std::make_shared(); t->val = "OR"; t->children = { $1, $3 }; $$ = t; } | NOT expr { auto t = std::make_shared(); t->val = "NOT"; t->children = { $2 }; $$ = t; } | ID { auto t = std::make_shared(); t->val = $1; $$ = t; } %% TreePtr root; int main() { yyparse(); if (!root) return 1; root->print(); std::cout << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/one-grammar/0000755000175100017510000000000015154533055024047 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/one-grammar/lexer.l0000644000175100017510000000045115154533055025343 0ustar runnerrunner%{ #include #include void yyerror(const char *e) { std::cerr << e; } extern "C" int yywrap() { return 1; } extern YYSTYPE yylval; %} ID [a-z]+ AND "&&" OR "||" NOT "!" %% [[:space:]]+ {ID} yylval.s = yytext; return ID; {AND} return AND; {OR} return OR; {NOT} return NOT; %% qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/one-grammar/types.h0000644000175100017510000000325415154533055025370 0ustar runnerrunner/**************************************************************************** ** ** 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 #include #include #include struct Tree; using TreePtr = std::shared_ptr; struct Tree { std::string val; std::vector children; void print() const { std::cout << val << ' '; for (const TreePtr &t : children) t->print(); } }; struct YaccType { TreePtr t; std::string s; }; #define YYSTYPE YaccType extern TreePtr root; int yylex(); void yyerror(const char *); qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/one-grammar/parser.y0000644000175100017510000000117315154533055025537 0ustar runnerrunner%{ #include %} %type expr %left OR %left AND %nonassoc NOT %token ID %% start: expr { root = $1; } expr: expr AND expr { auto t = std::make_shared(); t->val = "AND"; t->children = { $1, $3 }; $$ = t; } | expr OR expr { auto t = std::make_shared(); t->val = "OR"; t->children = { $1, $3 }; $$ = t; } | NOT expr { auto t = std::make_shared(); t->val = "NOT"; t->children = { $2 }; $$ = t; } | ID { auto t = std::make_shared(); t->val = $1; $$ = t; } %% TreePtr root; int main() { yyparse(); if (!root) return 1; root->print(); std::cout << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/one-grammar/one-grammar.qbs0000644000175100017510000000232315154533055026763 0ustar runnerrunnerimport qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); console.info("executable suffix: " + cpp.executableSuffix); return result; } qbsSearchPaths: ".." Depends { name: "bisonhelper" } Depends { name: "lex_yacc" } lex_yacc.outputTag: "cpp" lex_yacc.yaccFlags: ["-l"] cpp.includePaths: [".", ".."] cpp.cxxLanguageVersion: "c++11" cpp.minimumMacosVersion: "10.7" consoleApplication: true Probe { id: pathCheck property string theDir: { if (qbs.targetOS.includes("windows")) { if (qbs.toolchain.includes("mingw")) return cpp.toolchainInstallPath; if (qbs.toolchain.includes("clang") && qbs.sysroot) return qbs.sysroot + "/bin"; } } configure: { if (theDir) console.info("add to PATH: " + theDir); found = true; } } files: [ "lexer.l", "parser.y", "types.h", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/modules/0000755000175100017510000000000015154533055023312 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/modules/bisonhelper/0000755000175100017510000000000015154533055025624 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/lexyacc/modules/bisonhelper/bisonhelper.qbs0000644000175100017510000000065315154533055030651 0ustar runnerrunnerimport qbs.Process Module { Depends { name: "lex_yacc" } Probe { id: bisonProbe property string yaccBinary: lex_yacc.yaccBinary configure: { var p = Process(); found = p.exec(yaccBinary, ["-V"]) == 0 && p.readStdOut().includes("bison"); p.close(); } } Properties { condition: bisonProbe.found lex_yacc.yaccFlags: "-y" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-optional-dependencies/0000755000175100017510000000000015154533055026651 5ustar runnerrunner././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-optional-dependencies/transitive-optional-dependencies.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-optional-dependencies/transitive-optional-depe0000644000175100017510000000004615154533055033522 0ustar runnerrunnerProduct { Depends { name: "a" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-optional-dependencies/modules/0000755000175100017510000000000015154533055030321 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-optional-dependencies/modules/b/0000755000175100017510000000000015154533055030542 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-optional-dependencies/modules/b/b.qbs0000644000175100017510000000004015154533055031464 0ustar runnerrunnerModule { condition: false } qbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-optional-dependencies/modules/a/0000755000175100017510000000000015154533055030541 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-optional-dependencies/modules/a/a.qbs0000644000175100017510000000006615154533055031472 0ustar runnerrunnerModule { Depends { name: "b"; required: false } } qbs-src-3.2.0/tests/auto/blackbox/testdata/smart-relinking/0000755000175100017510000000000015154533055023320 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/smart-relinking/staticlib.cpp0000644000175100017510000000003015154533055025773 0ustar runnerrunnerstatic void myFunc() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/smart-relinking/main.cpp0000644000175100017510000000006515154533055024751 0ustar runnerrunnervoid publicFunc(); int main() { publicFunc(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/smart-relinking/smart-relinking.qbs0000644000175100017510000000164215154533055027140 0ustar runnerrunnerProject { minimumQbsVersion: "1.6" Probe { id: tcProbe property stringList toolchain: qbs.toolchain property stringList targetOS: qbs.targetOS configure: { found = toolchain.includes("gcc") && targetOS.includes("unix"); if (!found) console.info("project disabled"); } } DynamicLibrary { condition: tcProbe.found name: "lib" property stringList defines: [] cpp.defines: defines Depends { name: "cpp" } files: ["lib.cpp"] } CppApplication { condition: tcProbe.found name:"app" Depends { name: "lib" } Depends { name: "staticlib" } files: ["main.cpp"] } StaticLibrary { condition: tcProbe.found name: "staticlib" Depends { name: "lib" } Depends { name: "cpp" } files: "staticlib.cpp" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/smart-relinking/lib.cpp0000644000175100017510000000055315154533055024575 0ustar runnerrunner#include __attribute__ ((visibility ("default"))) void publicFunc() { #ifdef PRINTF std::printf("Tach\n"); #endif } __attribute__ ((visibility ("hidden"))) void privateFunc() { } #ifdef PRIV2 __attribute__ ((visibility ("hidden"))) void privateFunc2() { } #endif #ifdef PUB2 __attribute__ ((visibility ("default"))) void publicFunc2() { } #endif qbs-src-3.2.0/tests/auto/blackbox/testdata/dependency-scanning-loop/0000755000175100017510000000000015154533055025075 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dependency-scanning-loop/main.cpp0000644000175100017510000000002215154533055026517 0ustar runnerrunner#include qbs-src-3.2.0/tests/auto/blackbox/testdata/dependency-scanning-loop/dependency-scanning-loop.qbs0000644000175100017510000000170015154533055032465 0ustar runnerrunnerimport qbs.FileInfo import qbs.TextFile CppApplication { name: "app" cpp.includePaths: buildDirectory Group { files: "main.cpp" fileTags: ["cpp", "custom.in"] } Rule { inputs: "custom.in" Artifact { filePath: FileInfo.completeBaseName(input.filePath) + ".h" fileTags: "hpp" } Artifact { filePath: "custom.txt" fileTags: "whatever" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + outputs.hpp[0].fileName; cmd.sourceCode = function() { var f = new TextFile(outputs.hpp[0].filePath, TextFile.WriteOnly); f.writeLine("int main() {}"); f.close(); f = new TextFile(outputs.whatever[0].filePath, TextFile.WriteOnly); f.close(); } return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/importing-product/0000755000175100017510000000000015154533055023700 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/importing-product/main.cpp0000644000175100017510000000235715154533055025337 0ustar runnerrunner/**************************************************************************** ** ** 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 qbs-src-3.2.0/tests/auto/blackbox/testdata/importing-product/header.h.in0000644000175100017510000000001615154533055025703 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/importing-product/importing-product.qbs0000644000175100017510000000207515154533055030101 0ustar runnerrunnerimport qbs.File Project { Product { name: "dep" Export { Depends { name: "cpp" } cpp.includePaths: [importingProduct.buildDirectory + "/random_dir"] Rule { inputs: ["hpp_in"] Artifact { filePath: product.buildDirectory + "/random_dir/" + input.completeBaseName fileTags: ["hpp"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "copying file"; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return [cmd]; } } } } CppApplication { name: "theProduct" Depends { name: "dep" } Group { files: ["header.h.in"] fileTags: ["hpp_in"] } files: ["main.cpp"] } CppApplication { name: "theProduct2" Depends { name: "dep" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/autotest-timeout/0000755000175100017510000000000015154533055023546 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/autotest-timeout/autotests-timeout.qbs0000644000175100017510000000160515154533055027776 0ustar runnerrunnerimport qbs.Host Project { CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "testApp" type: ["application", "autotest"] Depends { name: "autotest" } cpp.cxxLanguageVersion: "c++11" cpp.minimumOsxVersion: "10.8" // For Properties { condition: qbs.toolchain.includes("gcc") cpp.driverFlags: "-pthread" } files: "test-main.cpp" } AutotestRunner { Depends { name: "cpp" // Make sure build environment is set up properly. condition: Host.os().includes("windows") && qbs.toolchain.includes("gcc") } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/autotest-timeout/test-main.cpp0000644000175100017510000000255515154533055026162 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Jochen Ulrich ** 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 #include int main() { std::this_thread::sleep_for(std::chrono::seconds(5)); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-deps/0000755000175100017510000000000015154533055023176 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-deps/e.cpp0000644000175100017510000000240215154533055024124 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int d(); int e() { return d(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-deps/main.cpp0000644000175100017510000000240515154533055024627 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int e(); int main() { return e(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-deps/static-lib-deps.qbs0000644000175100017510000000620715154533055026676 0ustar runnerrunnerProject { property bool useExport: true StaticLibrary { name: "a" Depends { name: "cpp" } files: [ "a1.cpp", "a2.cpp", ] } StaticLibrary { name: "b" Depends { name: "cpp" } Depends { name: "a" } files: [ "b.cpp", ] } StaticLibrary { name: "c" Depends { name: "cpp" } Depends { name: "a" } files: [ "c.cpp", ] } StaticLibrary { name: "d" Depends { name: "cpp" } Depends { name: "b" } Depends { name: "c" } files: [ "d.cpp", ] Group { condition: qbs.targetOS.includes("darwin") files: ["d.mm"] } Properties { condition: qbs.targetOS.includes("windows") cpp.defines: ["WITH_SETUPAPI"] cpp.staticLibraries: !project.useExport ? ["setupapi"] : [] } Properties { condition: qbs.targetOS.includes("darwin") cpp.defines: ["WITH_ZLIB"] cpp.staticLibraries: !project.useExport ? ["z"] : [] cpp.frameworks: !project.useExport ? ["Foundation"] : [] } Properties { condition: { console.info(qbs.targetOS); return qbs.targetOS.includes("linux") || qbs.targetOS.includes("hurd") } cpp.defines: ["WITH_PTHREAD", "WITH_ZLIB"] cpp.staticLibraries: !project.useExport ? ["pthread", "z"] : [] } Properties { condition: qbs.toolchain.contains("emscripten") cpp.defines: ["WITH_WEBSOCK"] cpp.staticLibraries: !project.useExport ? ["websocket.js"] : [] } Export { condition : project.useExport Depends { name: "cpp" } Properties { condition: qbs.targetOS.contains("linux") || qbs.targetOS.includes("hurd") cpp.staticLibraries: ["pthread", "z"] } Properties { condition: qbs.targetOS.contains("darwin") cpp.staticLibraries: ["z"] cpp.frameworks: ["Foundation"] } Properties { condition: qbs.targetOS.contains("windows") cpp.staticLibraries: ["setupapi"] } Properties { condition: qbs.toolchain.contains("emscripten") cpp.staticLibraries: ["websocket.js"] } } } StaticLibrary { name: "e" Depends { name: "cpp" } Depends { name: "d" } files: [ "e.cpp", ] Export { Depends { name: "d" } } } CppApplication { name: "staticLibDeps" type: "application" consoleApplication: true Depends { name: "e" } Properties { condition: qbs.targetOS.includes("linux") || qbs.targetOS.includes("hurd") cpp.driverFlags: ["-static"] } files: [ "main.cpp", ] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-deps/c.cpp0000644000175100017510000000237715154533055024135 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void a2(); void c() { a2(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-deps/b.cpp0000644000175100017510000000237715154533055024134 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void a1(); void b() { a1(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-deps/a1.cpp0000644000175100017510000000244315154533055024206 0ustar runnerrunner/**************************************************************************** ** ** 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 void a1() { std::cout << "a1" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-deps/d.mm0000644000175100017510000000027515154533055023760 0ustar runnerrunner#import void printGreeting() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog (@"Hello darkness, my old friend!"); [pool drain]; } qbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-deps/a2.cpp0000644000175100017510000000244315154533055024207 0ustar runnerrunner/**************************************************************************** ** ** 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 void a2() { std::cout << "a2" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/static-lib-deps/d.cpp0000644000175100017510000000411115154533055024122 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #if defined(WITH_ZLIB) #include #endif #if defined(WITH_WEBSOCK) #include #endif #ifdef WITH_PTHREAD #include #elif defined(WITH_SETUPAPI) #include #include #endif void b(); void c(); int d() { b(); c(); int result = 0; #if defined(WITH_ZLIB) const char source[] = "Hello, world"; uLongf buffer_size = compressBound(sizeof(source)); result += static_cast(buffer_size); #endif #if defined(WITH_WEBSOCK) const bool supported = emscripten_websocket_is_supported(); (void) supported; #endif #ifdef WITH_PTHREAD pthread_t self = pthread_self(); result += static_cast(self); #elif defined(WITH_SETUPAPI) CABINET_INFO ci; ci.SetId = 0; SetupIterateCabinet(L"invalid-file-path", 0, NULL, NULL); result += ci.SetId; #endif return result; } qbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-fileinfo/0000755000175100017510000000000015154533055024537 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-fileinfo/fileinfo.qbs0000644000175100017510000000531315154533055027043 0ustar runnerrunnerimport qbs.FileInfo import qbs.TextFile Product { type: ["dummy"] property string messyPath: path + "/../" + FileInfo.fileName(path) Rule { multiplex: true outputFileTags: "dummy" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var output = new TextFile(FileInfo.joinPaths(product.sourceDirectory, "output.txt"), TextFile.WriteOnly); output.writeLine(FileInfo.baseName("/tmp/blubb.tar.gz")); output.writeLine(FileInfo.canonicalPath(product.messyPath)); output.writeLine(FileInfo.cleanPath("/usr/local//../bin/")); output.writeLine(FileInfo.completeBaseName("/tmp/blubb.tar.gz")); output.writeLine(FileInfo.fileName("/tmp/blubb.tar.gz")); output.writeLine(FileInfo.fromWindowsSeparators("/tmp/blubb.tar.gz")); output.writeLine(FileInfo.fromWindowsSeparators("c:\\tmp\\blubb.tar.gz")); output.writeLine(FileInfo.isAbsolutePath("/tmp/blubb.tar.gz")); output.writeLine(FileInfo.isAbsolutePath("c:\\tmp\\blubb.tar.gz")); output.writeLine(FileInfo.isAbsolutePath("c:\\tmp\\blubb.tar.gz", ["unix"])); output.writeLine(FileInfo.isAbsolutePath("c:\\tmp\\blubb.tar.gz", ["windows"])); output.writeLine(FileInfo.isAbsolutePath("blubb.tar.gz")); output.writeLine(FileInfo.isAbsolutePath("../blubb.tar.gz")); output.writeLine(FileInfo.joinPaths("/", "tmp", "blubb.tar.gz")); output.writeLine(FileInfo.joinPaths("//", "/tmp/", "/blubb.tar.gz")); output.writeLine(FileInfo.path("/tmp/blubb.tar.gz")); output.writeLine(FileInfo.path("/tmp/")); output.writeLine(FileInfo.path("/")); output.writeLine(FileInfo.path("d:/")); output.writeLine(FileInfo.path("d:/", ["unix"])); output.writeLine(FileInfo.path("d:/", ["windows"])); output.writeLine(FileInfo.relativePath("/tmp", "/tmp/blubb.tar.gz")); output.writeLine(FileInfo.relativePath("/", "/tmp/blubb.tar.gz")); output.writeLine(FileInfo.relativePath("/tmp", "/blubb.tar.gz")); output.writeLine(FileInfo.toWindowsSeparators("/tmp/blubb.tar.gz")); output.writeLine(FileInfo.toWindowsSeparators("c:\\tmp\\blubb.tar.gz")); output.writeLine(FileInfo.pathListSeparator()); output.writeLine(FileInfo.pathSeparator()); output.close(); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/0000755000175100017510000000000015154533055022253 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/BaseApp.qbs0000644000175100017510000001255215154533055024302 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com). ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.FileInfo import qbs.Probes Product { property varList inputSelectors property varList inputNames property varList inputNameSuffixes property pathList inputSearchPaths property var inputNameFilter property var inputCandidateFilter property stringList inputEnvironmentPaths property stringList outputFilePaths property var outputCandidatePaths Probes.PathProbe { id: probe selectors: inputSelectors names: inputNames nameSuffixes: inputNameSuffixes nameFilter: inputNameFilter candidateFilter: inputCandidateFilter searchPaths: inputSearchPaths platformSearchPaths: [] environmentPaths: inputEnvironmentPaths } property bool validate: { var compareArrays = function(lhs, rhs) { if (lhs.length !== rhs.length) return false; for (var i = 0; i < lhs.length; ++i) { if ((lhs[i] instanceof Array) && (rhs[i] instanceof Array)) { if (!compareArrays(lhs[i], rhs[i])) return false; } else if (FileInfo.resolvePath(path, lhs[i]) !== FileInfo.resolvePath(path, rhs[i])) { return false; } } return true; }; if (outputCandidatePaths) { var actual = probe.allResults.map(function(file) { return file.candidatePaths; }); if (!compareArrays(actual, outputCandidatePaths)) { throw "Invalid canndidatePaths: actual = " + JSON.stringify(actual) + ", expected = " + JSON.stringify(outputCandidatePaths); } } if (!probe.found) { if (probe.filePath) { throw "Invalid filePath: actual = " + JSON.stringify(probe.filePath) + ", expected = 'undefined'"; } if (probe.fileName) { throw "Invalid fileName: actual = " + JSON.stringify(probe.fileName) + ", expected = 'undefined'"; } if (probe.path) { throw "Invalid path: actual = " + JSON.stringify(probe.path) + ", expected = 'undefined'"; } throw "Probe failed to find files"; } if (outputFilePaths) { var actual = probe.allResults.map(function(file) { return file.filePath; }); if (!compareArrays(actual, outputFilePaths)) { throw "Invalid filePaths: actual = " + JSON.stringify(actual) + ", expected = " + JSON.stringify(outputFilePaths); } } if (probe.allResults.length !== 1) return; // check that single-file interface matches the first value in allResults var expectedFilePath = probe.allResults[0].filePath; if (probe.filePath !== expectedFilePath) { throw "Invalid filePath: actual = " + probe.filePath + ", expected = " + expectedFilePath; } var expectedFileName = probe.allResults[0].fileName; if (probe.fileName !== expectedFileName) { throw "Invalid fileName: actual = " + probe.fileName + ", expected = " + expectedFileName; } var expectedPath = probe.allResults[0].path; if (FileInfo.resolvePath(path, probe.path) !== FileInfo.resolvePath(path, expectedPath)) { throw "Invalid path: actual = " + probe.path + ", expected = " + expectedPath; } var expectedCandidatePaths = probe.allResults[0].candidatePaths; if (!compareArrays(probe.candidatePaths, expectedCandidatePaths)) { throw "Invalid candidatePaths: actual = " + JSON.stringify(probe.candidatePaths) + ", expected = " + JSON.stringify(expectedCandidatePaths); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/mult-files.qbs0000644000175100017510000000051415154533055025043 0ustar runnerrunnerBaseApp { inputSelectors: [ "tool.1", ["tool.2"], {names : "tool.3"}, {names : ["tool.4"]} ] inputSearchPaths: "bin" outputFilePaths: ["bin/tool.1", "bin/tool.2", "bin/tool.3", "bin/tool.4"] outputCandidatePaths: [["bin/tool.1"], ["bin/tool.2"], ["bin/tool.3"], ["bin/tool.4"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/single-file-mult-variants.qbs0000644000175100017510000000023415154533055027763 0ustar runnerrunnerBaseApp { inputNames: ["tool.1", "tool.2"] inputSearchPaths: "bin" outputFilePaths: ["bin/tool.1"] outputCandidatePaths: [["bin/tool.1"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/candidate-filter.qbs0000644000175100017510000000052215154533055026160 0ustar runnerrunnerimport qbs.FileInfo BaseApp { inputNames: ["tool.1", "tool.2"] inputSearchPaths: "bin" inputCandidateFilter: { var fi = FileInfo; return function(f) { return fi.fileName(f) == "tool.2"; } } outputFilePaths: ["bin/tool.2"] outputCandidatePaths: [["bin/tool.1", "bin/tool.2"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/single-file-suffixes.qbs0000644000175100017510000000030615154533055027011 0ustar runnerrunnerBaseApp { inputNames: "tool" inputSearchPaths: "bin" inputNameSuffixes: [".0", ".1", ".2"] outputFilePaths: ["bin/tool.1"] outputCandidatePaths: [["bin/tool.0", "bin/tool.1"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/environment-paths.qbs0000644000175100017510000000037215154533055026445 0ustar runnerrunnerimport qbs.FileInfo BaseApp { inputNames: "tool" inputSearchPaths: ["bin", "usr/bin"] // env takes precedence inputEnvironmentPaths: "SEARCH_PATH" outputFilePaths: ["usr/bin/tool"] outputCandidatePaths: [["usr/bin/tool"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/non-existent.qbs0000644000175100017510000000016615154533055025420 0ustar runnerrunnerBaseApp { inputNames: "nonexistent" inputSearchPaths: "bin" outputCandidatePaths: [["bin/nonexistent"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/usr/0000755000175100017510000000000015154533055023064 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/usr/bin/0000755000175100017510000000000015154533055023634 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/usr/bin/tool0000644000175100017510000000000015154533055024522 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/mult-files-suffixes.qbs0000644000175100017510000000043715154533055026701 0ustar runnerrunnerBaseApp { inputSelectors: [ {names : "tool", nameSuffixes: ".2"}, {names : "super-tool", nameSuffixes: ".1"}, ] inputSearchPaths: "bin" outputFilePaths: ["bin/tool.2", "bin/super-tool.1"] outputCandidatePaths: [["bin/tool.2"], ["bin/super-tool.1"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/name-filter.qbs0000644000175100017510000000035715154533055025172 0ustar runnerrunnerBaseApp { inputNames: "tool" inputSearchPaths: "bin" inputNameFilter: { return function(n) { return n + ".2" }; } outputFilePaths: ["bin/tool.2"] outputCandidatePaths: [["bin/tool.2"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/non-existent-selector.qbs0000644000175100017510000000031715154533055027234 0ustar runnerrunnerBaseApp { inputSelectors: [ "tool.1", "nonexistent", "tool.2", ] inputSearchPaths: "bin" outputCandidatePaths: [["bin/tool.1"], ["bin/nonexistent"], ["bin/tool.2"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/single-file.qbs0000644000175100017510000000021215154533055025153 0ustar runnerrunnerBaseApp { inputNames: "tool" inputSearchPaths: "bin" outputFilePaths: ["bin/tool"] outputCandidatePaths: [["bin/tool"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/single-file-selector-array.qbs0000644000175100017510000000022015154533055030104 0ustar runnerrunnerBaseApp { inputSelectors: ["tool"] inputSearchPaths: "bin" outputFilePaths: ["bin/tool"] outputCandidatePaths: [["bin/tool"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/bin/0000755000175100017510000000000015154533055023023 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/bin/tool.10000644000175100017510000000000015154533055024050 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/bin/tool.40000644000175100017510000000000015154533055024053 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/bin/tool0000644000175100017510000000000015154533055023711 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/bin/super-tool.10000644000175100017510000000000015154533055025204 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/bin/tool.30000644000175100017510000000000015154533055024052 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/bin/tool.20000644000175100017510000000000015154533055024051 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/mult-files-mult-suffixes.qbs0000644000175100017510000000047515154533055027662 0ustar runnerrunnerBaseApp { inputSelectors: [ {names : "tool", nameSuffixes: [".0", ".1", ".2"]}, {names : "super-tool", nameSuffixes: [".1"]}, ] inputSearchPaths: "bin" outputFilePaths: ["bin/tool.1", "bin/super-tool.1"] outputCandidatePaths: [["bin/tool.0", "bin/tool.1"], ["bin/super-tool.1"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/single-file-selector.qbs0000644000175100017510000000021615154533055026775 0ustar runnerrunnerBaseApp { inputSelectors: "tool" inputSearchPaths: "bin" outputFilePaths: ["bin/tool"] outputCandidatePaths: [["bin/tool"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/mult-files-mult-variants.qbs0000644000175100017510000000047115154533055027651 0ustar runnerrunnerBaseApp { inputSelectors: [ "tool", ["tool.0", "tool.1", "tool.2"], {names : ["tool.3", "tool.4"]}, ] inputSearchPaths: "bin" outputFilePaths: ["bin/tool", "bin/tool.1", "bin/tool.3"] outputCandidatePaths: [["bin/tool"], ["bin/tool.0", "bin/tool.1"], ["bin/tool.3"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/path-probe/mult-files-common-suffixes.qbs0000644000175100017510000000042315154533055030162 0ustar runnerrunnerBaseApp { inputSelectors: [ {names : "tool"}, {names : "super-tool"}, ] inputNameSuffixes: ".1" inputSearchPaths: "bin" outputFilePaths: ["bin/tool.1", "bin/super-tool.1"] outputCandidatePaths: [["bin/tool.1"], ["bin/super-tool.1"]] } qbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-propertylist/0000755000175100017510000000000015154533055025524 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-propertylist/propertylist.qbs0000644000175100017510000001114215154533055031012 0ustar runnerrunnerimport qbs.Process import qbs.PropertyList import qbs.TextFile Product { type: ["Pineapple Steve"] property bool dummy: { var plistobj = new PropertyList(); if (!plistobj.isEmpty()) { throw "newly created PropertyList was not empty!"; } if (plistobj.format() !== undefined) { throw "newly created PropertyList did not have an undefined format"; } plistobj.clear(); if (!plistobj.isEmpty() || plistobj.format() !== undefined) { throw "clear() somehow had an effect on an empty PropertyList"; } plistobj.readFromString('{"key":["value"]}'); if (plistobj.isEmpty() || plistobj.format() !== "json") { throw "readFromString did not set format to JSON or object thinks it is empty"; } plistobj.clear(); if (!plistobj.isEmpty() || plistobj.format() !== undefined) { throw "clear() had no effect on a non-empty PropertyList"; } var obj = { "Array": ["ListItem1", "ListItem2", "ListItem3"], "Integer": 1, "Boolean": true, "String": "otherString" }; var infoplist = new TextFile("test.xml", TextFile.WriteOnly); infoplist.write(JSON.stringify(obj)); infoplist.close(); var process = new Process(); process.exec("plutil", ["-convert", "xml1", "test.xml"]); process.close(); var xmlfile = new TextFile("test.xml", TextFile.ReadOnly); var propertyList = new PropertyList(); propertyList.readFromString(xmlfile.readAll()); xmlfile.close(); var jsontextfile = new TextFile("test.json", TextFile.WriteOnly); jsontextfile.write(propertyList.toJSON()); jsontextfile.close(); propertyList.writeToFile("test2.json", "json-compact"); propertyList.writeToFile("test3.json", "json-pretty"); process = new Process(); process.exec("plutil", ["-convert", "json", "test.xml"]); process.close(); propertyList = new PropertyList(); propertyList.readFromFile("test.xml"); if (propertyList.format() !== "json") { // yes, JSON -- ignore the file extension throw "expected property list format json but got " + propertyList.format(); } if (propertyList.isEmpty()) { throw "PropertyList was 'empty' after being loaded with data"; } var opensteptextfile = new TextFile("test.openstep.plist", TextFile.WriteOnly); opensteptextfile.write('{ rootObject = ( "val1", "val3", "val5", /* comment */ "val7", "val9", ); }'); opensteptextfile.close(); propertyList = new PropertyList(); propertyList.readFromFile("test.openstep.plist"); if (propertyList.format() !== "openstep") { throw "expected property list format openstep but got " + propertyList.format(); } var jsonObj = JSON.parse(propertyList.toJSON()); if (jsonObj["rootObject"].length != 5) { throw "going from OpenStep to a JSON string to a JSON object somehow broke"; } propertyList.clear(); propertyList.readFromString('foobarz'); jsonObj = JSON.parse(propertyList.toJSON()); if (jsonObj["foo"] !== "barz") { throw "the XML plist did not get parsed properly"; } propertyList.writeToFile("woof.xml", "xml1"); propertyList.readFromFile("woof.xml"); if (propertyList.format() !== "xml1") { throw "round trip writing and reading XML failed"; } propertyList.writeToFile("woof.plist", "binary1"); propertyList.readFromFile("woof.plist"); if (propertyList.format() !== "binary1") { throw "round trip writing and reading binary failed"; } if (jsonObj["foo"] !== "barz") { throw "the binary plist did not get parsed properly"; } if (propertyList.toString("json") !== propertyList.toString("json-compact") || propertyList.toJSON() !== propertyList.toJSON("compact")) { throw "json and json-compact formats were not equivalent"; } if (propertyList.toString("json") === propertyList.toString("json-pretty") || propertyList.toJSON() === propertyList.toJSON("pretty")) { throw "json and json-pretty formats were not different"; } if (propertyList.toString("xml1") !== propertyList.toXMLString()) { throw 'toString("xml1") and toXMLString() were not equivalent'; } return true; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-searchpath/0000755000175100017510000000000015154533055023644 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-searchpath/import-searchpath.qbs0000644000175100017510000000030215154533055030000 0ustar runnerrunnerProject { Project { qbsSearchPaths: ["qbs"] references: ["src/import-searchpath-app1.qbs"] } Project { references: ["src/import-searchpath-app2.qbs"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-searchpath/qbs/0000755000175100017510000000000015154533055024431 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-searchpath/qbs/imports/0000755000175100017510000000000015154533055026126 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-searchpath/qbs/imports/CppApplication.qbs0000644000175100017510000000001415154533055031536 0ustar runnerrunnerProduct { } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-searchpath/src/0000755000175100017510000000000015154533055024433 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-searchpath/src/main.cpp0000644000175100017510000000001715154533055026061 0ustar runnerrunnerint main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-searchpath/src/somefile.cpp0000644000175100017510000000000015154533055026730 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-searchpath/src/import-searchpath-app2.qbs0000644000175100017510000000005315154533055031432 0ustar runnerrunnerCppApplication { files: ["main.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-searchpath/src/import-searchpath-app1.qbs0000644000175100017510000000005715154533055031435 0ustar runnerrunnerCppApplication { files: ["somefile.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/setup-run-environment/0000755000175100017510000000000015154533055024516 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/setup-run-environment/main.cpp0000644000175100017510000000035115154533055026145 0ustar runnerrunner#include "../dllexport.h" DLL_IMPORT void lib1Func(); DLL_IMPORT void lib2Func(); DLL_IMPORT void lib3Func(); DLL_IMPORT void lib4Func(); int main() { lib1Func(); lib2Func(); lib3Func(); lib4Func(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/setup-run-environment/lib3.cpp0000644000175100017510000000007215154533055026052 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void lib3Func() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/setup-run-environment/lib5.cpp0000644000175100017510000000007215154533055026054 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void lib5Func() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/setup-run-environment/lib2.cpp0000644000175100017510000000014615154533055026053 0ustar runnerrunner#include "../dllexport.h" DLL_IMPORT void lib5Func(); DLL_EXPORT void lib2Func() { lib5Func(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/setup-run-environment/lib4.cpp0000644000175100017510000000007215154533055026053 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void lib4Func() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/setup-run-environment/setup-run-environment.qbs0000644000175100017510000000716015154533055031535 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host Project { DynamicLibrary { // Product dependency, installed name: "lib1" Depends { name: "cpp" } property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } files: ["lib1.cpp"] install: !qbs.targetOS.includes("darwin") installImportLib: true installDir: "lib1" importLibInstallDir: installDir Group { condition: qbs.targetOS.includes("darwin") fileTagsFilter: ["bundle.content"] qbs.install: true qbs.installSourceBase: destinationDirectory } } DynamicLibrary { // Product dependency, non-installed name: "lib2" Depends { name: "cpp" } Depends { name: "lib5" } install: false Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } files: ["lib2.cpp"] } DynamicLibrary { // Non-dependency, referred to by full path name: "lib3" Depends { name: "cpp" } files: ["lib3.cpp"] Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } installImportLib: true installDir: "lib3" importLibInstallDir: installDir } DynamicLibrary { // Non-dependency, referred to by name name: "lib4" Depends { name: "cpp" } files: ["lib4.cpp"] Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } // Testing shows that clang (8.0) does not find dynamic libraries via // the -L and -l mechanism unless the name is "lib.a". Properties { condition: Host.os().includes("windows") && qbs.toolchain.includes("clang") cpp.dynamicLibraryPrefix: "lib" cpp.dynamicLibraryImportSuffix: ".a" } installImportLib: true installDir: "lib4" importLibInstallDir: installDir } DynamicLibrary { // Recursive product dependency name: "lib5" Depends { name: "cpp" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } files: ["lib5.cpp"] } CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "app" consoleApplication: true files: "main.cpp" install: false Depends { name: "lib1" } Depends { name: "lib2" } Depends { name: "lib3"; cpp.link: false } Depends { name: "lib4"; cpp.link: false } property string fullInstallPrefix: FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix) property string lib3FilePath: FileInfo.joinPaths(fullInstallPrefix, "lib3", cpp.dynamicLibraryPrefix + "lib3" + (qbs.targetOS.includes("windows") ? cpp.dynamicLibraryImportSuffix : cpp.dynamicLibrarySuffix)) cpp.dynamicLibraries: [lib3FilePath, "lib4"] cpp.libraryPaths: FileInfo.joinPaths(fullInstallPrefix, "lib4") } Probe { id: osPrinter property bool isWindows: qbs.targetOS.includes("windows") configure: { console.info("is windows"); found = true; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/setup-run-environment/lib1.cpp0000644000175100017510000000007215154533055026050 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void lib1Func() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/nsis/0000755000175100017510000000000015154533055021166 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nsis/hello.qbs0000644000175100017510000000054615154533055023005 0ustar runnerrunnerNSISSetup { name: "Qbs Hello" targetName: "qbs-hello-" + qbs.architecture property bool dummy: { console.info("is Windows: " + qbs.targetOS.includes("windows")); } Properties { condition: nsis.present nsis.defines: ["batchFile=hello.bat"] nsis.compressor: "lzma-solid" } files: ["hello.nsi", "hello.bat"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/nsis/hello.bat0000644000175100017510000000002215154533055022753 0ustar runnerrunnerecho Hello world! qbs-src-3.2.0/tests/auto/blackbox/testdata/nsis/hello.nsi0000644000175100017510000000056115154533055023006 0ustar runnerrunnerSetCompressor zlib !ifdef Win64 Name "Qbs Hello - ${qbs.architecture} (64-bit)" !else Name "Qbs Hello - ${qbs.architecture} (32-bit)" !endif OutFile "you-should-not-see-a-file-with-this-name.exe" InstallDir "$DESKTOP\Qbs Hello" RequestExecutionLevel user Page directory Page instfiles Section "" SetOutPath "$INSTDIR" File "${batchFile}" SectionEnd qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerMode/0000755000175100017510000000000015154533055022303 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/linkerMode/main.s0000644000175100017510000000004715154533055023414 0ustar runnerrunner.globl _main .globl main _main: main: qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerMode/staticlib.cpp0000644000175100017510000000252015154533055024764 0ustar runnerrunner/**************************************************************************** ** ** 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 extern "C" int cpp(); int cpp() { std::cout << "Hello world" << std::endl; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerMode/main.cpp0000644000175100017510000000247315154533055023741 0ustar runnerrunner/**************************************************************************** ** ** 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 int main() { std::string s = "Hello World"; (void)s; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerMode/main.mm0000644000175100017510000000022415154533055023560 0ustar runnerrunner#include #include int main() { std::string s = "Hello World"; (void)s; sel_registerName("qbs"); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerMode/linkerMode.qbs0000644000175100017510000000274615154533055025114 0ustar runnerrunnerProject { CppApplication { consoleApplication: true name: "LinkedProduct-Assembly" property bool dummy: { console.info("is emscripten: " + qbs.toolchain.includes("emscripten")); } files: qbs.targetOS.includes("darwin") ? "darwin.s" : "main.s" installDir: "" cpp.linkerPath: cpp.compilerPathByLanguage["c"] } CppApplication { consoleApplication: true name: "LinkedProduct-C" files: ["main.c"] installDir: "" } CppApplication { condition: qbs.targetOS.includes("darwin") consoleApplication: true name: "LinkedProduct-Objective-C" files: ["main.m"] installDir: "" cpp.dynamicLibraries: ["ObjC"] } CppApplication { consoleApplication: true name: "LinkedProduct-C++" files: ["main.cpp"] installDir: "" } CppApplication { condition: qbs.targetOS.includes("darwin") consoleApplication: true name: "LinkedProduct-Objective-C++" files: ["main.mm"] installDir: "" cpp.dynamicLibraries: ["ObjC"] } CppApplication { Depends { name: "LinkedProduct-C++StaticLibrary" } name: "LinkedProduct-BlankApp" files: ["staticmain.c"] installDir: "" } StaticLibrary { Depends { name: "cpp" } name: "LinkedProduct-C++StaticLibrary" files: ["staticlib.cpp"] installDir: "" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerMode/staticmain.c0000644000175100017510000000241715154533055024607 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ extern int cpp(); int main() { return cpp(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerMode/darwin.s0000644000175100017510000000005715154533055023755 0ustar runnerrunner.globl _main .globl main _main: main: ret qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerMode/main.m0000644000175100017510000000012215154533055023400 0ustar runnerrunner#include int main() { sel_registerName("qbs"); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/linkerMode/main.c0000644000175100017510000000247515154533055023403 0ustar runnerrunner/**************************************************************************** ** ** 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 int main() { void *memory = malloc(8); free(memory); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/project_filepath_check/0000755000175100017510000000000015154533055024671 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/project_filepath_check/main.cpp0000644000175100017510000000235115154533055026322 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/project_filepath_check/project1.qbs0000644000175100017510000000005115154533055027123 0ustar runnerrunnerCppApplication { files: "main.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/project_filepath_check/main2.cpp0000644000175100017510000000001615154533055026400 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/project_filepath_check/project2.qbs0000644000175100017510000000005215154533055027125 0ustar runnerrunnerCppApplication { files: "main2.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/changed-inputs-from-dependencies/0000755000175100017510000000000015154533055026510 5ustar runnerrunner././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/changed-inputs-from-dependencies/changed-inputs-from-dependencies.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/changed-inputs-from-dependencies/changed-inputs-from-depe0000644000175100017510000000341615154533055033224 0ustar runnerrunnerimport qbs.File import qbs.TextFile Project { Product { name: "dep" type: "dep_tag" files: "input.txt" FileTagger { patterns: "*.txt"; fileTags: "inp_tag" } Rule { inputs: "inp_tag" Artifact { filePath: input.baseName + ".intermediate"; fileTags: "int_tag" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return cmd; } } Rule { inputs: "int_tag" Artifact { filePath: input.baseName + ".dep"; fileTags: "dep_tag" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return cmd; } } } Product { name: "p" type: "p_tag" Depends { name: "dep" } Rule { inputsFromDependencies: "dep_tag" outputFileTags: "p_tag" outputArtifacts: { var dummy = new TextFile(input.filePath, TextFile.ReadOnly); dummy.close(); return [{ filePath: input.baseName + ".p", fileTags: "p_tag" }] } prepare: { console.info("running final prepare script"); var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/changed-inputs-from-dependencies/input.txt0000644000175100017510000000000015154533055030376 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/includeLookup/0000755000175100017510000000000015154533055023027 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/includeLookup/main.cpp0000644000175100017510000000245515154533055024465 0ustar runnerrunner/**************************************************************************** ** ** 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 int main() { std::printf("%s..\n", TEXT); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/includeLookup/includeLookup.qbs0000644000175100017510000000112515154533055026352 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host Project { property string name: 'includeLookup' qbsSearchPaths: '.' Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } type: 'application' consoleApplication: true name: project.name files: 'main.cpp' Depends { name: 'cpp' } Depends { name: 'definition' } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/includeLookup/modules/0000755000175100017510000000000015154533055024477 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/includeLookup/modules/definition/0000755000175100017510000000000015154533055026627 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/includeLookup/modules/definition/fakeopenssl/0000755000175100017510000000000015154533055031141 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/includeLookup/modules/definition/fakeopenssl/sha.h0000644000175100017510000000000015154533055032053 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/includeLookup/modules/definition/module.qbs0000644000175100017510000000051615154533055030625 0ustar runnerrunnerimport qbs.Probes Module { name: 'definition' Depends { name: 'cpp' } property string modulePath: path Probes.IncludeProbe { id: includeNode names: "fakeopenssl/sha.h" platformSearchPaths: [modulePath] } cpp.defines: includeNode.found ? 'TEXT="' + includeNode.path + '"' : undefined } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-cmake/0000755000175100017510000000000015154533055022774 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exports-cmake/find-cmake.qbs0000644000175100017510000000254215154533055025504 0ustar runnerrunnerimport qbs.Probes Product { Depends { name: "cpp" } Probes.BinaryProbe { id: cmakeProbe names: "cmake" } Probes.BinaryProbe { id: ninjaProbe names: ["ninja"] } property bool test: { var data = { cmakeFound: cmakeProbe.found, cmakeFilePath: cmakeProbe.filePath, crossCompiling: qbs.targetPlatform !== qbs.hostPlatform, installPrefix: qbs.installPrefix }; data.buildEnv = {} Object.assign(data.buildEnv, cpp.buildEnv); // deep copy buildEnv from a probe if (qbs.toolchain.includes("gcc")) { data.buildEnv["CC"] = cpp.cCompilerName; data.buildEnv["CXX"] = cpp.cxxCompilerName; } else { data.buildEnv["CC"] = cpp.compilerName; data.buildEnv["CXX"] = cpp.compilerName; } if (ninjaProbe.found) { data.generator = "Ninja"; } else { if (qbs.toolchain.includes("msvc")) { data.generator = "NMake Makefiles" } else if (qbs.toolchain.includes("mingw")) { data.generator = "MinGW Makefiles"; } else if (qbs.toolchain.includes("gcc")) { data.generator = "Unix Makefiles"; } } console.info("---" + JSON.stringify(data) + "---"); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-cmake/exports-cmake.qbs0000644000175100017510000000422615154533055026271 0ustar runnerrunnerimport qbs.FileInfo Project { property bool isStatic: false property bool isBundle: false property string headersInstallDir: "include" Product { name: "DllExport" Depends { name: "Exporter.cmake" } Group { name: "API headers" files: ["../dllexport.h"] qbs.install: true qbs.installDir: project.headersInstallDir } Group { fileTagsFilter: ["Exporter.cmake.package"] qbs.install: true qbs.installDir: "/lib/cmake/DllExport" } Export { Depends { name: "cpp" } cpp.includePaths: FileInfo.joinPaths( exportingProduct.qbs.installRoot, exportingProduct.qbs.installPrefix, project.headersInstallDir) } } Library { type: project.isStatic ? "staticlibrary" : "dynamiclibrary" Depends { name: "cpp" } Depends { name: "DllExport" } Depends { name: "Exporter.cmake" } Exporter.cmake.packageName: "Bar" name: "Foo" files: ["Foo.cpp"] version: "1.2.3" cpp.includePaths: "." cpp.defines: "FOO_LIB" Group { name: "API headers" files: ["Foo.h"] qbs.install: true qbs.installDir: project.headersInstallDir } install: true installImportLib: true Group { fileTagsFilter: ["Exporter.cmake.package"] qbs.install: true qbs.installDir: "/lib/cmake/Bar" } Export { Depends { name: "cpp" } cpp.includePaths: FileInfo.joinPaths( exportingProduct.qbs.installRoot, exportingProduct.qbs.installPrefix, project.headersInstallDir) cpp.defines: ["FOO=1"].concat(project.isStatic ? ["FOO_LIB_STATIC"] : []) cpp.commonCompilerFlags: "-DOTHER_DEF=1" cpp.linkerFlags: exportingProduct.qbs.toolchain.contains("gcc") ? ["-s"] : [] } Depends { name: 'bundle' } bundle.isBundle: qbs.targetOS.includes("darwin") && project.isBundle } } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-cmake/Foo.h0000644000175100017510000000040115154533055023663 0ustar runnerrunner#ifndef FOO_H #define FOO_H #include #ifdef FOO_LIB_STATIC #define FOO_LIB_EXPORT #else #ifdef FOO_LIB #define FOO_LIB_EXPORT DLL_EXPORT #else #define FOO_LIB_EXPORT DLL_IMPORT #endif #endif FOO_LIB_EXPORT int someFooWork(); #endif // FOO_H qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-cmake/Foo.cpp0000644000175100017510000000006615154533055024225 0ustar runnerrunner#include "Foo.h" int someFooWork() { return 42; } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-cmake/cmake/0000755000175100017510000000000015154533055024054 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exports-cmake/cmake/main.cpp0000644000175100017510000000007315154533055025504 0ustar runnerrunner#include int main() { return someFooWork(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-cmake/cmake/CMakeLists.txt0000644000175100017510000000024215154533055026612 0ustar runnerrunnercmake_minimum_required(VERSION 3.10) project(qbs_import) find_package(Bar PATHS REQUIRED) add_executable(Consumer main.cpp) target_link_libraries(Consumer Bar) qbs-src-3.2.0/tests/auto/blackbox/testdata/minimumSystemVersion/0000755000175100017510000000000015154533055024440 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/minimumSystemVersion/main.cpp0000644000175100017510000000711615154533055026075 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #ifdef _WIN32 #include #include #include #include #include #include #include #endif int main(int argc, char *argv[]) { if (argc != 1) return 1; #ifdef _WIN32 #if defined(__clang__) std::cout << "Unsupported compiler" << std::endl; return 0; #endif #if defined(WINVER) && defined(QBS_WINVER) std::cout << "WINVER=" << WINVER << std::endl; std::string command = TOOLCHAIN_INSTALL_PATH; std::replace(command.begin(), command.end(), '/', '\\'); command = "\"\"" + command; #ifdef __GNUC__ command += "\\objdump.exe\" -p \""; #else command += "\\dumpbin.exe\" /HEADERS \""; #endif command += argv[0]; command += "\" > qbs-test-dumpbin.txt\""; int status = ::system(command.c_str()); if (status != 0) return status; std::ifstream in("qbs-test-dumpbin.txt"); std::string s; while (std::getline(in, s)) { #ifdef __GNUC__ static const char *majorOSystemVersion = "MajorOSystemVersion\t"; if (s.find(majorOSystemVersion) != std::string::npos) std::cout << s.substr(std::strlen(majorOSystemVersion)); static const char *minorOSystemVersion = "MinorOSystemVersion\t"; if (s.find(minorOSystemVersion) != std::string::npos) std::cout << ".0" << s.substr(std::strlen(minorOSystemVersion)) << " operating system version" << std::endl; static const char *majorSubsystemVersion = "MajorSubsystemVersion\t"; if (s.find(majorSubsystemVersion) != std::string::npos) std::cout << s.substr(std::strlen(majorSubsystemVersion)); static const char *minorSubsystemVersion = "MinorSubsystemVersion\t"; if (s.find(minorSubsystemVersion) != std::string::npos) std::cout << ".0" << s.substr(std::strlen(minorSubsystemVersion)) << " subsystem version" << std::endl; #else if (s.find("operating system version") != std::string::npos || s.find("subsystem version") != std::string::npos) { s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun(std::isspace)))); std::cout << s << std::endl; } #endif } unlink("qbs-test-dumpbin.txt"); #else std::cout << "WINVER is not defined" << std::endl; #endif #endif return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/minimumSystemVersion/main.mm0000644000175100017510000000575215154533055025730 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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 #import int main() { // This gets set by -mmacosx-version-min. If left undefined, defaults to the current OS version. std::cout << "__MAC_OS_X_VERSION_MIN_REQUIRED=" << __MAC_OS_X_VERSION_MIN_REQUIRED << std::endl; bool print = false; NSTask *task = [[NSTask alloc] init]; [task setLaunchPath:@"/usr/bin/otool"]; [task setArguments:[NSArray arrayWithObjects:@"-l", [[[NSProcessInfo processInfo] arguments] firstObject], nil]]; NSPipe *pipe = [NSPipe pipe]; [task setStandardOutput:pipe]; [task launch]; NSData *data = [[pipe fileHandleForReading] readDataToEndOfFile]; [task waitUntilExit]; NSString *result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSString *line; NSEnumerator *enumerator = [[result componentsSeparatedByString:@"\n"] objectEnumerator]; while ((line = [enumerator nextObject]) != nil) { if ([line rangeOfString:@"LC_VERSION_MIN_MACOSX"].location != NSNotFound) print = true; if (print && [line rangeOfString:@"version"].location != NSNotFound) { std::cout << [[line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] UTF8String] << std::endl; print = false; continue; } #ifdef __clang__ #if __clang_major__ >= 10 && __clang_minor__ >= 0 if ([line rangeOfString:@"LC_BUILD_VERSION"].location != NSNotFound) print = true; if (print && [line rangeOfString:@"minos"].location != NSNotFound) { std::cout << [[line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] UTF8String] << std::endl; print = false; } #endif #endif // __clang__ } } qbs-src-3.2.0/tests/auto/blackbox/testdata/minimumSystemVersion/specific.qbs0000644000175100017510000000211015154533055026726 0ustar runnerrunnerimport qbs.Utilities // a specific version of the operating systems is specified // when the application is run its output should confirm // that the given values took effect import qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && qbs.targetOS.includes("windows") || qbs.targetOS.includes("macos"); } files: [qbs.targetOS.includes("darwin") ? "main.mm" : "main.cpp"] consoleApplication: true Properties { condition: qbs.targetOS.includes("windows") cpp.minimumWindowsVersion: "6.2" cpp.defines: [ "QBS_WINVER=0x602", "TOOLCHAIN_INSTALL_PATH=" + Utilities.cStringQuote(cpp.toolchainInstallPath) ] } Properties { condition: qbs.targetOS.includes("macos") cpp.frameworks: "Foundation" cpp.minimumMacosVersion: qbs.architecture === "arm64" ? "11.0" : "10.7" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/minimumSystemVersion/unspecified-forced.qbs0000644000175100017510000000170015154533055030703 0ustar runnerrunnerimport qbs.Utilities // no minimum versions are specified, and explicitly set to undefined in // case the profile has set it import qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } files: [qbs.targetOS.includes("darwin") ? "main.mm" : "main.cpp"] consoleApplication: true cpp.minimumWindowsVersion: undefined cpp.minimumMacosVersion: undefined cpp.minimumIosVersion: undefined cpp.minimumAndroidVersion: undefined Properties { condition: qbs.targetOS.includes("windows") cpp.defines: ["TOOLCHAIN_INSTALL_PATH=" + Utilities.cStringQuote(cpp.toolchainInstallPath)] } Properties { condition: qbs.targetOS.includes("darwin") cpp.frameworks: "Foundation" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/minimumSystemVersion/fakewindows.qbs0000644000175100017510000000132615154533055027472 0ustar runnerrunnerimport qbs.Host import qbs.Utilities // non-existent versions of Windows should print a QBS warning // (but will still compile and link since we avoid passing a // bad value to the linker) CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && qbs.targetOS.includes("windows"); } files: ["main.cpp"] consoleApplication: true cpp.minimumWindowsVersion: "5.3" cpp.defines: [ "QBS_WINVER=0x503", "TOOLCHAIN_INSTALL_PATH=" + Utilities.cStringQuote(cpp.toolchainInstallPath) ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/minimumSystemVersion/unspecified.qbs0000644000175100017510000000140415154533055027444 0ustar runnerrunnerimport qbs.Utilities // no minimum versions are specified so the profile defaults will be used import qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } files: [qbs.targetOS.includes("darwin") ? "main.mm" : "main.cpp"] consoleApplication: true Properties { condition: qbs.targetOS.includes("windows") cpp.defines: ["TOOLCHAIN_INSTALL_PATH=" + Utilities.cStringQuote(cpp.toolchainInstallPath)] } Properties { condition: qbs.targetOS.includes("darwin") cpp.frameworks: "Foundation" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/minimumSystemVersion/macappstore.qbs0000644000175100017510000000126115154533055027465 0ustar runnerrunner// just to make sure three-digit minimum versions work on macOS // this only affects the value of __MAC_OS_X_VERSION_MIN_REQUIRED, // not the actual LC_VERSION_MIN_MACOSX command which is limited to two import qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && qbs.targetOS.includes("macos"); } files: ["main.mm"] consoleApplication: true cpp.frameworks: "Foundation" cpp.minimumMacosVersion: qbs.architecture === "arm64" ? "11.0" : "10.7.1" } qbs-src-3.2.0/tests/auto/blackbox/testdata/typescript/0000755000175100017510000000000015154533055022420 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/typescript/typescript.qbs0000644000175100017510000000200515154533055025332 0ustar runnerrunnerProject { NodeJSApplication { Depends { name: "typescript" } Depends { name: "lib" } typescript.warningLevel: "pedantic" typescript.generateDeclarations: true typescript.moduleLoader: "commonjs" nodejs.applicationFile: "main.ts" name: "animals" files: [ "animals.ts", "extra.js", "woosh/extra.ts" ] } Product { Depends { name: "typescript" } typescript.generateDeclarations: true typescript.moduleLoader: "commonjs" name: "lib" files: [ "foo.ts" ] } Product { Depends { name: "typescript" } typescript.generateDeclarations: true name: "lib2" files: [ "foo2.ts" ] } NodeJSApplication { Depends { name: "typescript" } Depends { name: "lib2" } typescript.singleFile: true nodejs.applicationFile: "hello.ts" name: "single" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/typescript/foo.ts0000644000175100017510000000013715154533055023554 0ustar runnerrunnerexport class Greeter { public getGreeting(): string { return "guten Tag!"; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/typescript/animals.ts0000644000175100017510000000055015154533055024414 0ustar runnerrunnerexport interface Mammal { speak(): string; } export class Cat implements Mammal { public speak() { return "Meow"; // a cat says meow } } export class Dog implements Mammal { public speak() { return "Woof"; // a dog says woof } } export class Human implements Mammal { public speak() { return "Hello"; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/typescript/foo2.ts0000644000175100017510000000000115154533055023624 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata/typescript/extra.js0000644000175100017510000000010615154533055024076 0ustar runnerrunnerif (console) { console.log("This doesn't do anything useful!"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/typescript/hello.ts0000644000175100017510000000003515154533055024071 0ustar runnerrunnerconsole.log("Hello world!"); qbs-src-3.2.0/tests/auto/blackbox/testdata/typescript/woosh/0000755000175100017510000000000015154533055023557 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/typescript/woosh/extra.ts0000644000175100017510000000002615154533055025250 0ustar runnerrunnerexport class Boom { } qbs-src-3.2.0/tests/auto/blackbox/testdata/typescript/main.ts0000644000175100017510000000102315154533055023710 0ustar runnerrunnerimport Animals = require("./animals"); import Foo = require("./foo"); import Extra = require("./woosh/extra"); function main() { var mammals: Animals.Mammal[] = []; mammals.push(new Animals.Human()); mammals.push(new Animals.Dog()); mammals.push(new Animals.Cat()); // Make everyone speak for (var i = 0; i < mammals.length; ++i) { console.log(mammals[i].speak()); } (new Extra.Boom()); var greeting: string = (new Foo.Greeter()).getGreeting(); console.log(greeting); } main(); qbs-src-3.2.0/tests/auto/blackbox/testdata/separate-debug-info/0000755000175100017510000000000015154533055024033 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/separate-debug-info/main.cpp0000644000175100017510000000236415154533055025470 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/separate-debug-info/separate-debug-info.qbs0000644000175100017510000001075615154533055030374 0ustar runnerrunnerProject { CppApplication { name: "app1" type: ["application"] files: ["main.cpp"] cpp.separateDebugInformation: true Probe { id: osProbe property stringList targetOS: qbs.targetOS property stringList toolchain: qbs.toolchain configure: { console.info("is windows: " + (targetOS.includes("windows") ? "yes" : "no")); console.info("is macos: " + (targetOS.includes("macos") ? "yes" : "no")); console.info("is darwin: " + (targetOS.includes("darwin") ? "yes" : "no")); console.info("is gcc: " + (toolchain.includes("gcc") ? "yes" : "no")); console.info("is msvc: " + (toolchain.includes("msvc") ? "yes" : "no")); console.info("is emscripten: " + (toolchain.includes("emscripten") ? "yes" : "no")); } } } DynamicLibrary { Depends { name: "cpp" } name: "foo1" type: ["dynamiclibrary"] files: ["foo.cpp"] cpp.separateDebugInformation: true } LoadableModule { Depends { name: "cpp" } name: "bar1" files: ["foo.cpp"] cpp.separateDebugInformation: true } CppApplication { name: "app2" type: ["application"] files: ["main.cpp"] cpp.separateDebugInformation: false } DynamicLibrary { Depends { name: "cpp" } name: "foo2" type: ["dynamiclibrary"] files: ["foo.cpp"] cpp.separateDebugInformation: false } LoadableModule { Depends { name: "cpp" } name: "bar2" files: ["foo.cpp"] cpp.separateDebugInformation: false } CppApplication { name: "app3" type: ["application"] files: ["main.cpp"] cpp.separateDebugInformation: true Properties { condition: qbs.targetOS.includes("darwin") cpp.dsymutilFlags: ["--flat"] } } DynamicLibrary { Depends { name: "cpp" } name: "foo3" type: ["dynamiclibrary"] files: ["foo.cpp"] cpp.separateDebugInformation: true Properties { condition: qbs.targetOS.includes("darwin") cpp.dsymutilFlags: ["--flat"] } } LoadableModule { Depends { name: "cpp" } name: "bar3" files: ["foo.cpp"] cpp.separateDebugInformation: true Properties { condition: qbs.targetOS.includes("darwin") cpp.dsymutilFlags: ["--flat"] } } CppApplication { name: "app4" type: ["application"] files: ["main.cpp"] consoleApplication: true cpp.separateDebugInformation: true } DynamicLibrary { Depends { name: "cpp" } name: "foo4" type: ["dynamiclibrary"] files: ["foo.cpp"] Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } cpp.separateDebugInformation: true } LoadableModule { Depends { name: "cpp" } name: "bar4" files: ["foo.cpp"] Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } cpp.separateDebugInformation: true } CppApplication { name: "app5" type: ["application"] files: ["main.cpp"] Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } cpp.separateDebugInformation: true Properties { condition: qbs.targetOS.includes("darwin") cpp.dsymutilFlags: ["--flat"] } } DynamicLibrary { Depends { name: "cpp" } name: "foo5" type: ["dynamiclibrary"] files: ["foo.cpp"] Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } cpp.separateDebugInformation: true Properties { condition: qbs.targetOS.includes("darwin") cpp.dsymutilFlags: ["--flat"] } } LoadableModule { Depends { name: "cpp" } name: "bar5" files: ["foo.cpp"] Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } cpp.separateDebugInformation: true Properties { condition: qbs.targetOS.includes("darwin") cpp.dsymutilFlags: ["--flat"] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/separate-debug-info/foo.cpp0000644000175100017510000000244015154533055025322 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" DLL_EXPORT int getAnswer() { return 42; } qbs-src-3.2.0/tests/auto/blackbox/testdata/generate-linker-map-file/0000755000175100017510000000000015154533055024756 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/generate-linker-map-file/main.cpp0000644000175100017510000000241215154533055026405 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/generate-linker-map-file/generate-linker-map-file.qbs0000644000175100017510000000153615154533055032236 0ustar runnerrunnerProject { CppApplication { name: "app-map" files: ["main.cpp"] // lld-link has different flag for map files, test it by switching to "lld" linkerVariant Properties { condition: qbs.toolchain.includes("clang-cl"); cpp.linkerVariant: "lld" } cpp.generateLinkerMapFile: true } CppApplication { name: "app-nomap" files: ["main.cpp"] Properties { condition: qbs.toolchain.includes("clang-cl"); cpp.linkerVariant: "lld" } cpp.generateLinkerMapFile: false } CppApplication { name: "app-nomap-default" files: ["main.cpp"] } Probe { id: toolchainProbe property bool isUsed: qbs.toolchain.includes("msvc") || qbs.toolchain.includes("gcc") configure: { console.info("use test: " + isUsed); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/autotest-with-dependencies/0000755000175100017510000000000015154533055025457 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/autotest-with-dependencies/helper-main.cpp0000644000175100017510000000014315154533055030362 0ustar runnerrunner#include int main() { std::cout << "i am the helper" << std::endl; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/autotest-with-dependencies/autotest-with-dependencies.qbs0000644000175100017510000000220115154533055033426 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host Project { CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "helper-app" type: ["application", "test-helper"] consoleApplication: true install: true files: "helper-main.cpp" cpp.executableSuffix: ".exe" Group { fileTagsFilter: "application" fileTags: "test-helper" } } CppApplication { name: "test-app" type: ["application", "autotest"] Depends { name: "autotest" } files: "test-main.cpp" } AutotestRunner { Depends { name: "cpp" // Make sure build environment is set up properly. condition: Host.os().includes("windows") && qbs.toolchain.includes("gcc") } arguments: FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, "bin") auxiliaryInputs: "test-helper" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/autotest-with-dependencies/test-main.cpp0000644000175100017510000000046415154533055030070 0ustar runnerrunner#include #include #include int main(int argc, char *argv[]) { std::cout << "i am the test app" << std::endl; const std::string fullHelperExe = std::string(argv[1]) + "/helper-app.exe"; return std::system(fullHelperExe.c_str()) == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } qbs-src-3.2.0/tests/auto/blackbox/testdata/remove-duplicate-libs/0000755000175100017510000000000015154533055024406 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/remove-duplicate-libs/requestor2.c0000644000175100017510000000006615154533055026667 0ustar runnerrunnervoid provider2(); void requestor2() { provider2(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/remove-duplicate-libs/remove-duplicate-libs.qbs0000644000175100017510000000204315154533055031310 0ustar runnerrunnerimport "MyStaticLib.qbs" as MyStaticLib import qbs.Host Project { property bool removeDuplicates property string libDir: buildDirectory + "/lib" property bool dummy: { // most BSD systems (including macOS) use LLVM linker now console.info("is bfd linker: " + ((qbs.toolchain.includes("gcc") && !qbs.toolchain.includes("emscripten")) && !Host.os().includes("bsd"))) } qbsSearchPaths: "." MyStaticLib { name: "requestor1" } MyStaticLib { name: "requestor2" } MyStaticLib { name: "provider"; Group { files: "provider2.c" } } CppApplication { consoleApplication: true Depends { name: "requestor1"; cpp.link: false } Depends { name: "requestor2"; cpp.link: false } Depends { name: "provider"; cpp.link: false } cpp.libraryPaths: project.libDir cpp.removeDuplicateLibraries: project.removeDuplicates cpp.staticLibraries: ["requestor1", "requestor2", "provider", "requestor2"] files: "main.c" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/remove-duplicate-libs/provider2.c0000644000175100017510000000002415154533055026462 0ustar runnerrunnervoid provider2() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/remove-duplicate-libs/provider.c0000644000175100017510000000002415154533055026400 0ustar runnerrunnervoid provider1() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/remove-duplicate-libs/MyStaticLib.qbs0000644000175100017510000000030415154533055027276 0ustar runnerrunnerStaticLibrary { Properties { condition: isForDarwin bundle.isBundle: false } Depends { name: "cpp" } files: name + ".c" destinationDirectory: project.libDir } qbs-src-3.2.0/tests/auto/blackbox/testdata/remove-duplicate-libs/main.c0000644000175100017510000000015415154533055025476 0ustar runnerrunnervoid requestor1(); void requestor2(); int main(void) { requestor1(); requestor2(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/remove-duplicate-libs/requestor1.c0000644000175100017510000000006615154533055026666 0ustar runnerrunnervoid provider1(); void requestor1() { provider1(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/no-exported-symbols/0000755000175100017510000000000015154533055024144 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/no-exported-symbols/main.cpp0000644000175100017510000000006715154533055025577 0ustar runnerrunner#include int main() { return success(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/no-exported-symbols/no-exported-symbols.qbs0000644000175100017510000000137115154533055030607 0ustar runnerrunnerProject { DynamicLibrary { name: "the_lib" Depends { name: "cpp" } files: ["lib.cpp", "lib.h"] Export { Depends { name: "cpp" } cpp.includePaths: path } Probe { id: toolchainProbe property stringList toolchain: qbs.toolchain configure: { if (toolchain.includes("msvc") && !toolchain.includes("clang-cl")) console.info("compiler is MSVC") else console.info("compiler is not MSVC") } } } CppApplication { name: "the_app" property bool link Depends { name: "the_lib"; cpp.link: product.link } files: "main.cpp" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/no-exported-symbols/lib.h0000644000175100017510000000011615154533055025061 0ustar runnerrunner#ifndef TEST_LIB #define TEST_LIB inline int success() { return 0; } #endif qbs-src-3.2.0/tests/auto/blackbox/testdata/no-exported-symbols/lib.cpp0000644000175100017510000000003215154533055025411 0ustar runnerrunnerstatic void someFunc() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/non-default-product/0000755000175100017510000000000015154533055024104 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/non-default-product/main.cpp0000644000175100017510000000235115154533055025535 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/non-default-product/non-default-product.qbs0000644000175100017510000000063015154533055030504 0ustar runnerrunnerProject { CppApplication { name: "default app" consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } files: "main.cpp" } CppApplication { name: "non-default app" Depends { name: "default app" } consoleApplication: true builtByDefault: false files: "main.cpp" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-language-version/0000755000175100017510000000000015154533055024260 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-language-version/main.cpp0000644000175100017510000000001615154533055025705 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-language-version/cxx-language-version.qbs0000644000175100017510000000210615154533055031034 0ustar runnerrunnerCppApplication { name: "app" files: ["main.cpp"] Probe { id: compilerProbe property stringList toolchain: qbs.toolchain property string compilerVersion: cpp.compilerVersion configure: { var isNewerMsvc; var isEvenNewerMsvc; var isOlderMsvc; var isGcc; if (toolchain.includes("clang-cl")) { isEvenNewerMsvc = true; isNewerMsvc = true; } else if (toolchain.includes("msvc")) { if (compilerVersion >= "19.12.25831") isEvenNewerMsvc = true; if (compilerVersion >= "18.00.30723") isNewerMsvc = true; else isOlderMsvc = true; } else { isGcc = true; } console.info("is newer MSVC: " + isNewerMsvc); console.info("is even newer MSVC: " + isEvenNewerMsvc); console.info("is older MSVC: " + isOlderMsvc); console.info("is GCC: " + isGcc); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/clean/0000755000175100017510000000000015154533055021274 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/clean/main.cpp0000644000175100017510000000235215154533055022726 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/clean/dep.cpp0000644000175100017510000000241515154533055022552 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" DLL_EXPORT void f() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/clean/clean.qbs0000644000175100017510000000123015154533055023061 0ustar runnerrunnerProject { DynamicLibrary { Depends { name: "cpp" } version: "1.1.0" name: "dep" files: "dep.cpp" Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } CppApplication { consoleApplication: true name: "app" property bool dummy: { console.info("object suffix: " + cpp.objectSuffix); console.info("executable suffix: " + cpp.executableSuffix); console.info("is emscripten: " + qbs.toolchain.includes("emscripten")); } Depends { name: "dep" } files: "main.cpp" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/rule-with-no-inputs/0000755000175100017510000000000015154533055024064 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/rule-with-no-inputs/rule-with-no-inputs.qbs0000644000175100017510000000127615154533055030453 0ustar runnerrunnerimport qbs.TextFile Product { name: "theProduct" type: ["output"] version: "1" property bool dummy: false Rule { inputs: [] multiplex: true Artifact { filePath: "output.out" fileTags: ["output"] } prepare: { console.info("running the rule: " + product.dummy); var cmd = new JavaScriptCommand(); cmd.description = "creating output"; cmd.sourceCode = function() { console.info(product.version); var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); } return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/moved-file-dependency/0000755000175100017510000000000015154533055024355 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/moved-file-dependency/main.cpp0000644000175100017510000000004715154533055026006 0ustar runnerrunner#include int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/moved-file-dependency/subdir1/0000755000175100017510000000000015154533055025726 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/moved-file-dependency/subdir1/theheader.h0000644000175100017510000000000015154533055030016 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/moved-file-dependency/moved-file-dependency.qbs0000644000175100017510000000013015154533055031221 0ustar runnerrunnerCppApplication { cpp.includePaths: ["subdir1", "subdir2"] files: ["main.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/pseudo-multiplexing/0000755000175100017510000000000015154533055024230 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/pseudo-multiplexing/pseudo-multiplexing.qbs0000644000175100017510000000036115154533055030755 0ustar runnerrunnerProject { Product { name: "a" multiplexByQbsProperties: ["architectures"] Depends { name: "cpp" } } Product { name: "b" multiplexByQbsProperties: [] Depends { name: "cpp" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/qbsVersion/0000755000175100017510000000000015154533055022345 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/qbsVersion/qbs-version.qbs0000644000175100017510000000130315154533055025321 0ustar runnerrunnerProject { property string qbsVersion property int qbsVersionMajor property int qbsVersionMinor property int qbsVersionPatch Product { property bool dummy: { if (qbsVersion !== qbs.version || qbsVersionMajor !== qbs.versionMajor || qbsVersionMinor !== qbs.versionMinor || qbsVersionPatch !== qbs.versionPatch) throw("expected " + [qbsVersion, qbsVersionMajor, qbsVersionMinor, qbsVersionPatch].join(", ") + ", got " + [qbs.version, qbs.versionMajor, qbs.versionMinor, qbs.versionPatch].join(", ")); return false; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-project/0000755000175100017510000000000015154533055023302 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-project/dynamic-project.qbs0000644000175100017510000000246715154533055027112 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.TextFile Project { Probe { id: projectBuilder property stringList refs: [] property string sourceDir: sourceDirectory configure: { var tempDir = FileInfo.joinPaths(sourceDir, "temp"); File.makePath(tempDir); var srcDir = FileInfo.joinPaths(sourceDir, "src"); var projectDirs = File.directoryEntries(srcDir, File.Dirs | File.NoDotAndDotDot); var list = []; for (var it = 0; it < projectDirs.length; ++it) { var name = projectDirs[it]; var productSrcDir = FileInfo.joinPaths(srcDir, name); var productFilePath = FileInfo.joinPaths(tempDir, name + ".qbs"); var file = new TextFile(productFilePath, TextFile.WriteOnly); try { file.writeLine("CppApplication"); file.writeLine("{"); file.writeLine("\tfiles: [ \"" + productSrcDir + "/*.cpp\" ]"); file.writeLine("}"); } finally { file.close(); } list.push(productFilePath); } found = true; refs = list; } } references: projectBuilder.refs } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-project/src/0000755000175100017510000000000015154533055024071 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-project/src/app2/0000755000175100017510000000000015154533055024733 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-project/src/app2/main.cpp0000644000175100017510000000003115154533055026355 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-project/src/app/0000755000175100017510000000000015154533055024651 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-project/src/app/main.cpp0000644000175100017510000000003115154533055026273 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/productproperties/0000755000175100017510000000000015154533055024007 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/productproperties/main.cpp0000644000175100017510000000245515154533055025445 0ustar runnerrunner/**************************************************************************** ** ** 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 "blubb_header.h" int main() { #if BLUBB_PROP != 5 blubb(); #endif } qbs-src-3.2.0/tests/auto/blackbox/testdata/productproperties/productproperties.qbs0000644000175100017510000000013115154533055030306 0ustar runnerrunnerProject { property string blubbProp: "5" references: ["header.qbs", "app.qbs"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/productproperties/blubb_header.h.in0000644000175100017510000000000015154533055027151 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/productproperties/app.qbs0000644000175100017510000000041315154533055025274 0ustar runnerrunnerProduct { consoleApplication: true type: "application" name: "blubb_user" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } files: "main.cpp" Depends { name: "blubb_header" } Depends { name: "cpp" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/productproperties/header.qbs0000644000175100017510000000160715154533055025752 0ustar runnerrunnerimport qbs.TextFile Product { name: "blubb_header" type: "hpp" files: "blubb_header.h.in" property string blubbProp: project.blubbProp Rule { multiplex: true Artifact { filePath: "blubb_header.h" fileTags: "hpp" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating blubb_header.h"; cmd.highlight = "codegen"; cmd.blubbProp = product.blubbProp; cmd.sourceCode = function() { file = new TextFile(output.filePath, TextFile.WriteOnly); file.truncate(); file.write("#define BLUBB_PROP " + blubbProp); file.close(); } return cmd; } } Export { Depends { name: "cpp" } cpp.includePaths: exportingProduct.buildDirectory } } qbs-src-3.2.0/tests/auto/blackbox/testdata/build-data-of-disabled-product/0000755000175100017510000000000015154533055026045 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/build-data-of-disabled-product/main.cpp0000644000175100017510000000004315154533055027472 0ustar runnerrunnervoid f(); int main() { f(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/build-data-of-disabled-product/test.cpp0000644000175100017510000000001415154533055027523 0ustar runnerrunnervoid f() {} ././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/build-data-of-disabled-product/build-data-of-disabled-product.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/build-data-of-disabled-product/build-data-of-disabled-pro0000644000175100017510000000010715154533055032741 0ustar runnerrunnerCppApplication { name: "app" files: ["main.cpp", "test.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-binaryfile/0000755000175100017510000000000015154533055025070 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-binaryfile/binaryfile.qbs0000644000175100017510000000360115154533055027723 0ustar runnerrunnerimport qbs.BinaryFile Product { type: ["dummy"] Rule { multiplex: true outputFileTags: "dummy" prepare: { var commands = []; var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var source = new BinaryFile("source.dat", BinaryFile.WriteOnly); source.write([ 0x01, 0x02 ]); // First data. // Do not close the file to test the auto close functionality. }; commands.push(cmd); cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { source = new BinaryFile("source.dat", BinaryFile.ReadWrite); source.seek(source.size()); source.write([ 0x03, 0x04 ]); // Second data. source.close(); source = new BinaryFile("source.dat", BinaryFile.ReadWrite); var destination = new BinaryFile("destination.dat", BinaryFile.WriteOnly); destination.write(source.atEof() ? [ 0xFF ] : [ 0x00 ]); while (true) { var data = source.read(1); if (!data || data.length == 0) break; destination.write(data); } source.resize(0); // truncate destination.write([ 0x05, 0x06 ]); // Third data. destination.write(source.atEof() ? [ 0xFF ] : [ 0x00 ]); source.close(); destination.close(); source = new BinaryFile("destination.dat", BinaryFile.ReadOnly); destination = new BinaryFile("destination2.dat", BinaryFile.WriteOnly); destination.write(source.read(8)); }; commands.push(cmd); return commands; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/driver-linker-flags/0000755000175100017510000000000015154533055024061 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/driver-linker-flags/main.cpp0000644000175100017510000000001615154533055025506 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/driver-linker-flags/driver-linker-flags.qbs0000644000175100017510000000054515154533055030443 0ustar runnerrunnerCppApplication { files: "main.cpp" Properties { condition: toolchainProbe.found cpp.driverLinkerFlags: ["-nostartfiles"] } Probe { id: toolchainProbe condition: qbs.toolchain.includes("gcc") configure: { console.info("toolchain is GCC-like"); found = true; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/command-file/0000755000175100017510000000000015154533055022545 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/command-file/main.cpp0000644000175100017510000000004315154533055024172 0ustar runnerrunnervoid f(); int main() { f(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/command-file/list.gcc0000644000175100017510000000001115154533055024166 0ustar runnerrunner-ltheLib qbs-src-3.2.0/tests/auto/blackbox/testdata/command-file/list.msvc0000644000175100017510000000001315154533055024404 0ustar runnerrunnertheLib.lib qbs-src-3.2.0/tests/auto/blackbox/testdata/command-file/lib.cpp0000644000175100017510000000001515154533055024013 0ustar runnerrunnervoid f() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/command-file/command-file.qbs0000644000175100017510000000105615154533055025611 0ustar runnerrunnerProject { StaticLibrary { name: "theLib" destinationDirectory: project.buildDirectory Depends { name: "cpp" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } files: ["lib.cpp"] } CppApplication { name: "theApp" cpp.libraryPaths: project.buildDirectory files: ["main.cpp"] cpp.staticLibraries: ['@' + sourceDirectory + '/' + (qbs.toolchain.includes("msvc") ? "list.msvc" : "list.gcc")] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/precompiled-and-prefix-headers/0000755000175100017510000000000015154533055026161 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/precompiled-and-prefix-headers/main.cpp0000644000175100017510000000235215154533055027613 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ int main() { } ././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/precompiled-and-prefix-headers/precompiled-and-prefix-headers.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/precompiled-and-prefix-headers/precompiled-and-prefix-hea0000644000175100017510000000037415154533055033201 0ustar runnerrunnerCppApplication { name: "MyApp" consoleApplication: true cpp.includePaths: [product.buildDirectory] cpp.prefixHeaders: [ "prefix.h" ] Group { files: ["pch.h"] fileTags: ["cpp_pch_src"] } files: ["main.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/precompiled-and-prefix-headers/prefix.h0000644000175100017510000000233315154533055027630 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ qbs-src-3.2.0/tests/auto/blackbox/testdata/precompiled-and-prefix-headers/pch.h0000644000175100017510000000233315154533055027105 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ qbs-src-3.2.0/tests/auto/blackbox/testdata/out-of-date-marking/0000755000175100017510000000000015154533055023764 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/out-of-date-marking/out-of-date-marking.qbs0000644000175100017510000000106115154533055030243 0ustar runnerrunnerimport qbs.TextFile CppApplication { name: "app" files: "main.c" cpp.includePaths: buildDirectory Rule { multiplex: true alwaysRun: true Artifact { filePath: "myheader.h"; fileTags: "hpp" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/out-of-date-marking/main.c0000644000175100017510000000006015154533055025050 0ustar runnerrunner#include int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/partially-built-dependency/0000755000175100017510000000000015154533055025444 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/partially-built-dependency/partially-built-dependency.qbs0000644000175100017510000000257715154533055033420 0ustar runnerrunnerimport qbs.File import qbs.TextFile Project { property bool minimalDependency Product { name: "p" type: "obj" Depends { name: "cpp" } Depends { condition: project.minimalDependency === undefined; name: "dep" } Depends { condition: project.minimalDependency !== undefined name: "dep" minimal: project.minimalDependency } Rule { inputsFromDependencies: "cpp" Artifact { filePath: input.fileName fileTags: "cpp" } prepare: { var cmd = new JavaScriptCommand(); cmd.description ="copying " + input.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return cmd; } } } CppApplication { name: "dep" Rule { multiplex: true Artifact { filePath: "main.cpp"; fileTags: "cpp" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.writeLine("int main() {}"); } return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/0000755000175100017510000000000015154533055023663 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/exports-pkgconfig.qbs0000644000175100017510000000754715154533055030060 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host Project { Product { name: "dummy" Export { Depends { name: "TheFirstLib" } } } Product { name: "SomeHelper" Depends { name: "Exporter.pkgconfig" } Exporter.pkgconfig.versionEntry: "1.0" } StaticLibrary { Depends { name: "cpp" } Depends { name: "bundle" } bundle.isBundle: false name: "BoringStaticLib" files: ["boringstaticlib.cpp"] Export { Depends { name: "cpp" } cpp.defines: ["HAVE_INDUSTRIAL_STRENGTH_HAIR_DRYER"] } } DynamicLibrary { name: "TheFirstLib" version: "1.0" Depends { name: "SomeHelper" } Depends { name: "Exporter.pkgconfig" } Exporter.pkgconfig.excludedDependencies: ["Qt.core", "helper3"] Exporter.pkgconfig.requiresEntry: "Qt5Core" Exporter.pkgconfig.urlEntry: "http://www.example.com/thefirstlib" Depends { name: "cpp" } cpp.defines: ["FIRSTLIB"] Depends { name: "bundle" } bundle.isBundle: false qbs.installPrefix: "/opt/the firstlib" installDir: "lib" installImportLib: true Export { prefixMapping: [{prefix: "/somedir", replacement: "/otherdir"}] Depends { name: "BoringStaticLib" } Depends { name: "cpp" } Depends { name: "Qt.core"; required: false } Depends { name: "helper1" } Depends { name: "helper3" } property bool someCondition: Host.os().includes("windows") // hostOS for easier testing property bool someOtherCondition: someCondition Properties { condition: !someOtherCondition cpp.driverFlags: ["-pthread"] } cpp.defines: exportingProduct.name cpp.includePaths: [FileInfo.joinPaths(exportingProduct.qbs.installPrefix, "include")] Qt.core.mocName: "muck" } Group { name: "api_headers" files: ["firstlib.h"] qbs.install: true qbs.installDir: "include" } files: ["firstlib.cpp"] } DynamicLibrary { name: "TheSecondLib" version: "2.0" Depends { name: "Exporter.pkgconfig" } Exporter.pkgconfig.descriptionEntry: "The second lib" Exporter.pkgconfig.transformFunction: (function(product, moduleName, propertyName, value) { if (moduleName === "cpp" && propertyName === "includePaths") return value.filter(function(p) { return p !== product.sourceDirectory; }); return value; }) Exporter.pkgconfig.customVariables: ({config1: "a b", config2: "c"}) Depends { name: "cpp" } cpp.defines: ["SECONDLIB"] Depends { name: "bundle" } bundle.isBundle: false installDir: "/opt/thesecondlib/lib" installImportLib: true qbs.installPrefix: "" Depends { name: "TheFirstLib" } Export { Depends { name: "TheFirstLib" } Depends { name: "dummy" } Depends { name: "cpp" } cpp.includePaths: [ "/opt/thesecondlib/include", exportingProduct.sourceDirectory, importingProduct.buildDirectory ] property string hurz: importingProduct.name cpp.defines: hurz.toUpperCase() Rule { property int n: 5 Artifact { filePath: "dummy" fileTags: ["d1", "d2"] cpp.warningsAreErrors: true } } } Group { name: "api_headers" files: ["secondlib.h"] qbs.install: true qbs.installDir: "/opt/thesecondlib/include" } files: ["secondlib.cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/TheFirstLib_windows.pc0000644000175100017510000000051315154533055030137 0ustar runnerrunnerprefix=/opt/the firstlib Name: TheFirstLib Description: TheFirstLib Version: 1.0 URL: http://www.example.com/thefirstlib Cflags: -DTheFirstLib -I"${prefix}/include" -DHAVE_INDUSTRIAL_STRENGTH_HAIR_DRYER -I/otherdir/include1 -I/otherdir/include2 Libs: -L"${prefix}/lib" -lTheFirstLib Requires: Qt5Core Requires.private: SomeHelper qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/firstlib.cpp0000644000175100017510000000005315154533055026203 0ustar runnerrunner#include "firstlib.h" void firstLib() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/TheFirstLib.pc0000644000175100017510000000053515154533055026371 0ustar runnerrunnerprefix=/opt/the firstlib Name: TheFirstLib Description: TheFirstLib Version: 1.0 URL: http://www.example.com/thefirstlib Cflags: -DTheFirstLib -I"${prefix}/include" -pthread -DHAVE_INDUSTRIAL_STRENGTH_HAIR_DRYER -I/otherdir/include1 -I/otherdir/include2 Libs: -L"${prefix}/lib" -lTheFirstLib -pthread Requires: Qt5Core Requires.private: SomeHelper qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/firstlib.h0000644000175100017510000000024615154533055025654 0ustar runnerrunner#include "../dllexport.h" #ifdef FIRSTLIB # define FIRSTLIB_EXPORT DLL_EXPORT #else # define FIRSTLIB_EXPORT DLL_IMPORT #endif FIRSTLIB_EXPORT void firstLib(); qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/boringstaticlib.cpp0000644000175100017510000000005715154533055027550 0ustar runnerrunnerint calculateLuckyNumber() { return 12 * 13; } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/secondlib.h0000644000175100017510000000025315154533055025776 0ustar runnerrunner#include "../dllexport.h" #ifdef SECONDLIB # define SECONDLIB_EXPORT DLL_EXPORT #else # define SECONDLIB_EXPORT DLL_IMPORT #endif SECONDLIB_EXPORT void secondLib(); qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/TheSecondLib.pc0000644000175100017510000000027215154533055026513 0ustar runnerrunnerconfig1=a b config2=c Name: TheSecondLib Description: The second lib Version: 2.0 Cflags: -I/opt/thesecondlib/include Libs: -L/opt/thesecondlib/lib -lTheSecondLib Requires: TheFirstLib qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/modules/0000755000175100017510000000000015154533055025333 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/modules/helper1/0000755000175100017510000000000015154533055026673 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/modules/helper1/helper1.qbs0000644000175100017510000000016115154533055030740 0ustar runnerrunnerModule { Depends { name: "cpp" } Depends { name: "helper2" } cpp.includePaths: "/somedir/include1" } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/modules/helper3/0000755000175100017510000000000015154533055026675 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/modules/helper3/helper3.qbs0000644000175100017510000000012115154533055030740 0ustar runnerrunnerModule { Depends { name: "cpp" } cpp.includePaths: "/somedir/include3" } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/modules/helper2/0000755000175100017510000000000015154533055026674 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/modules/helper2/helper2.qbs0000644000175100017510000000012115154533055030736 0ustar runnerrunnerModule { Depends { name: "cpp" } cpp.includePaths: "/somedir/include2" } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-pkgconfig/secondlib.cpp0000644000175100017510000000020315154533055026324 0ustar runnerrunner#include "secondlib.h" #ifndef HAVE_INDUSTRIAL_STRENGTH_HAIR_DRYER # error I CANT LIVE WITHOUT IT! #endif void secondLib() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/0000755000175100017510000000000015154533055022052 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/main.cpp0000644000175100017510000000423415154533055023505 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include #include #include "addressbook.pb.h" using google::protobuf::util::TimeUtil; int main(int /*argc*/, char* /*argv*/[]) { GOOGLE_PROTOBUF_VERIFY_VERSION; tutorial::AddressBook addressBook; auto person = addressBook.add_people(); person->set_name("name"); person->set_id(1); person->set_email("email"); auto phone_number = person->add_phones(); phone_number->set_number("number"); phone_number->set_type(tutorial::Person::MOBILE); *person->mutable_last_updated() = TimeUtil::SecondsToTimestamp(time(nullptr)); google::protobuf::ShutdownProtobufLibrary(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/needs-import-dir-main.cpp0000644000175100017510000000315315154533055026664 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include int main() { MyMessage message; message.set_msg("msg"); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/import-main.cpp0000644000175100017510000000314115154533055025011 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include int main() { MyMessage message; message.set_msg("msg"); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/conanfile.txt0000644000175100017510000000012215154533055024544 0ustar runnerrunner[requires] protobuf/3.21.12 [tool_requires] protobuf/3.21.12 [generators] QbsDeps qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/addressbook_objc.qbs0000644000175100017510000000127215154533055026060 0ustar runnerrunnerimport qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasProtobuf; } name: "addressbook_objc" consoleApplication: true Depends { name: "cpp" } Depends { name: "protobuf.objc"; required: false } property bool hasProtobuf: { console.info("has protobuf: " + protobuf.objc.present); console.info("has modules: false"); return protobuf.objc.present; } files: [ "addressbook.proto", "main.m", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs0000644000175100017510000000135715154533055025731 0ustar runnerrunnerimport qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasProtobuf; } name: "addressbook_cpp" consoleApplication: true Depends { name: "cpp" } cpp.minimumMacosVersion: "10.15" Depends { name: "protobuf.cpp"; required: false } property bool hasProtobuf: { console.info("has protobuf: " + protobuf.cpp.present); console.info("has modules: " + protobuflib.present); return protobuf.cpp.present; } files: [ "addressbook.proto", "main.cpp", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/import.qbs0000644000175100017510000000143015154533055024071 0ustar runnerrunnerimport qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasProtobuf; } name: "app" consoleApplication: true protobuf.cpp.importPaths: [sourceDirectory] cpp.minimumMacosVersion: "10.8" Depends { name: "protobuf.cpp"; required: false } property bool hasProtobuf: { console.info("has protobuf: " + protobuf.cpp.present); console.info("has modules: " + protobuflib.present); return protobuf.cpp.present; } files: [ "import.proto", "import-main.cpp", "subdir/myenum.proto", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/main_nanopb.cpp0000644000175100017510000000477515154533055025054 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Kai Dohmen (psykai1993@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include #include #include #include "addressbook_nanopb.pb.h" static_assert(std::is_array().name)>::value, ""); static_assert(std::is_array().email)>::value, ""); static_assert(std::is_array().phones)>::value, ""); bool writeString(pb_ostream_t *stream, const pb_field_t *field, void *const *) { constexpr auto str = "0123456789"; if (!pb_encode_tag_for_field(stream, field)) return false; return pb_encode_string(stream, reinterpret_cast(str), strlen(str)); } int main() { std::array buffer = {}; tutorial_Person_PhoneNumber phoneNumber; phoneNumber.number.funcs.encode = writeString; phoneNumber.type = tutorial_Person_PhoneType_WORK; auto ostream = pb_ostream_from_buffer(buffer.data(), buffer.size()); assert(pb_encode(&ostream, tutorial_Person_PhoneNumber_fields, &phoneNumber)); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/addressbook_nanopb.qbs0000644000175100017510000000152615154533055026422 0ustar runnerrunnerimport qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasProtobuf; } name: "addressbook_nanopb" consoleApplication: true Depends { name: "cpp" } cpp.minimumMacosVersion: "10.8" Depends { name: "protobuf.nanopb"; required: false } property bool hasProtobuf: { console.info("has protobuf: " + protobuf.nanopb.present); console.info("has modules: false"); return protobuf.nanopb.present; } protobuf.nanopb.importPaths: product.sourceDirectory files: [ "addressbook_nanopb.proto", "addressbook_nanopb.options", "main_nanopb.cpp", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/addressbook.proto0000644000175100017510000000232215154533055025436 0ustar runnerrunner// See README.txt for information and build instructions. // // Note: START and END tags are used in comments to define sections used in // tutorials. They are not part of the syntax for Protocol Buffers. // // To get an in-depth walkthrough of this file and the related examples, see: // https://developers.google.com/protocol-buffers/docs/tutorials // [START declaration] syntax = "proto3"; package tutorial; import "google/protobuf/timestamp.proto"; // [END declaration] // [START java_declaration] option java_package = "com.example.tutorial"; option java_outer_classname = "AddressBookProtos"; // [END java_declaration] // [START csharp_declaration] option csharp_namespace = "Google.Protobuf.Examples.AddressBook"; // [END csharp_declaration] // [START messages] message Person { string name = 1; int32 id = 2; // Unique ID number for this person. string email = 3; enum PhoneType { MOBILE = 0; HOME = 1; WORK = 2; } message PhoneNumber { string number = 1; PhoneType type = 2; } repeated PhoneNumber phones = 4; google.protobuf.Timestamp last_updated = 5; } // Our address book file is just one of these. message AddressBook { repeated Person people = 1; } // [END messages] qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/create-proto-library.qbs0000644000175100017510000000263615154533055026636 0ustar runnerrunnerimport qbs.Host Project { StaticLibrary { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasProtobuf; } name: "proto_lib" Depends { name: "cpp" } cpp.minimumMacosVersion: "10.8" protobuf.cpp.importPaths: product.sourceDirectory Depends { name: "protobuf.cpp"; required: false } property bool hasProtobuf: { console.info("has protobuf: " + protobuf.cpp.present); console.info("has modules: " + protobuflib.present); return protobuf.cpp.present; } files: [ "import.proto", "subdir/myenum.proto", ] Export { Depends { name: "cpp" } Depends { name: "protobuf.cpp"; required: false } cpp.cxxLanguageVersion: "c++11" cpp.minimumMacosVersion: "10.8" cpp.includePaths: exportingProduct.protobuf.cpp.outputDir } } CppApplication { condition: proto_lib.present name: "consumes_proto_lib" consoleApplication: true files: [ "import-main.cpp", ] Depends { name: "proto_lib" required: false } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/addressbook_nanopb.options0000644000175100017510000000015115154533055027321 0ustar runnerrunnertutorial.Person.name max_size:128 tutorial.Person.email max_size:256 tutorial.Person.phones max_count:16 qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/subdir/0000755000175100017510000000000015154533055023342 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/subdir/myenum.proto0000644000175100017510000000007415154533055025742 0ustar runnerrunnersyntax = "proto2"; enum MyEnum { VAL1 = 0; VAL2 = 1; } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/import.proto0000644000175100017510000000014315154533055024447 0ustar runnerrunnersyntax = "proto2"; import "subdir/myenum.proto"; message MyMessage { required string msg = 1; } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/main.m0000644000175100017510000000373615154533055023165 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #import "Addressbook.pbobjc.h" int main(int argc, char* argv[]) { AddressBook *addressBook = [[AddressBook alloc] init]; Person *person = [[Person alloc] init]; person.name = @"name"; person.id_p = 1; person.email = @"email"; Person_PhoneNumber *number = [[Person_PhoneNumber alloc] init]; number.number = @"number"; number.type = Person_PhoneType_Mobile; [addressBook.peopleArray addObject:person]; [addressBook release]; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/addressbook_nanopb.proto0000644000175100017510000000154315154533055026777 0ustar runnerrunner// See README.txt for information and build instructions. // // Note: START and END tags are used in comments to define sections used in // tutorials. They are not part of the syntax for Protocol Buffers. // // To get an in-depth walkthrough of this file and the related examples, see: // https://developers.google.com/protocol-buffers/docs/tutorials // [START declaration] syntax = "proto3"; package tutorial; // [END declaration] // [START messages] message Person { string name = 1; int32 id = 2; // Unique ID number for this person. string email = 3; enum PhoneType { MOBILE = 0; HOME = 1; WORK = 2; } message PhoneNumber { string number = 1; PhoneType type = 2; } repeated PhoneNumber phones = 4; } // Our address book file is just one of these. message AddressBook { repeated Person people = 1; } // [END messages] qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/needs-import-dir.qbs0000644000175100017510000000157015154533055025746 0ustar runnerrunnerimport qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasProtobuf; } name: "app" consoleApplication: true property path theImportDir protobuf.cpp.importPaths: (theImportDir ? [theImportDir] : []).concat([sourceDirectory]) cpp.minimumMacosVersion: "10.8" Depends { name: "protobuf.cpp"; required: false } property bool hasProtobuf: { console.info("has protobuf: " + protobuf.cpp.present); console.info("has modules: " + protobuflib.present); return protobuf.cpp.present; } files: [ "needs-import-dir.proto", "needs-import-dir-main.cpp", "subdir/myenum.proto", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/protobuf/needs-import-dir.proto0000644000175100017510000000013415154533055026317 0ustar runnerrunnersyntax = "proto2"; import "myenum.proto"; message MyMessage { required string msg = 1; } qbs-src-3.2.0/tests/auto/blackbox/testdata/dot-dot-pc-file/0000755000175100017510000000000015154533055023101 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dot-dot-pc-file/main.cpp0000644000175100017510000000012115154533055024523 0ustar runnerrunner#ifndef THE_MAGIC_DEFINE #error "missing the magic define" #endif int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/dot-dot-pc-file/dot-dot-pc-file.qbs0000644000175100017510000000027615154533055026504 0ustar runnerrunnerCppApplication { name: "p" Depends { name: "qbs-metatest-module"; } files: "main.cpp" moduleProviders.qbspkgconfig.libDirs: "libdir" qbsModuleProviders: "qbspkgconfig" } qbs-src-3.2.0/tests/auto/blackbox/testdata/dot-dot-pc-file/libdir/0000755000175100017510000000000015154533055024346 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dot-dot-pc-file/libdir/qbs.metatest.module.pc0000644000175100017510000000013615154533055030570 0ustar runnerrunnerName: qbs.metatest.module Description: just a test Version: 0.0.1 Cflags: -DTHE_MAGIC_DEFINE qbs-src-3.2.0/tests/auto/blackbox/testdata/usings-as-sole-inputs-non-multiplexed/0000755000175100017510000000000015154533055027525 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/usings-as-sole-inputs-non-multiplexed/custom2.in0000644000175100017510000000000015154533055031437 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/usings-as-sole-inputs-non-multiplexed/custom1.in0000644000175100017510000000000015154533055031436 0ustar runnerrunner././@LongLink0000644000000000000000000000017300000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/usings-as-sole-inputs-non-multiplexed/usings-as-sole-inputs-non-multiplexed.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/usings-as-sole-inputs-non-multiplexed/usings-as-sole-inpu0000644000175100017510000000302115154533055033266 0ustar runnerrunnerimport qbs.FileInfo import qbs.TextFile Project { Product { name: "p1" type: "custom" Group { files: "custom1.in" fileTags: "custom.in" } } Product { name: "p2" type: "custom" Group { files: "custom2.in" fileTags: "custom.in" } } Rule { inputs: "custom.in" Artifact { filePath: FileInfo.baseName(input.filePath) + ".out" fileTags: "custom" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); } return cmd; } } Product { name: "p3" type: "custom-plus" Depends { name: "p1" } Depends { name: "p2" } Rule { inputsFromDependencies: "custom" Artifact { filePath: FileInfo.fileName(input.filePath) + ".plus" fileTags: "custom-plus" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); } return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/0000755000175100017510000000000015154533055025733 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/main.cpp0000644000175100017510000000001615154533055027360 0ustar runnerrunnerint main() {} ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/maximum-cxx-language-version.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/maximum-cxx-language-version0000644000175100017510000000036015154533055033376 0ustar runnerrunnerCppApplication { name: "app" property bool enableNewestModule: true Depends { name: "oldmodule" } Depends { name: "newermodule" } Depends { name: "newestmodule"; condition: enableNewestModule } files: "main.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/modules/0000755000175100017510000000000015154533055027403 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/modules/newermodule/0000755000175100017510000000000015154533055031731 5ustar runnerrunner././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/modules/newermodule/newermodule.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/modules/newermodule/newermod0000644000175100017510000000011315154533055033467 0ustar runnerrunnerModule { Depends { name: "cpp" } cpp.cxxLanguageVersion: "c++14" } qbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/modules/oldmodule/0000755000175100017510000000000015154533055031367 5ustar runnerrunner././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/modules/oldmodule/oldmodule.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/modules/oldmodule/oldmodule.0000644000175100017510000000011315154533055033347 0ustar runnerrunnerModule { Depends { name: "cpp" } cpp.cxxLanguageVersion: "c++11" } qbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/modules/newestmodule/0000755000175100017510000000000015154533055032116 5ustar runnerrunner././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/modules/newestmodule/newestmodule.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-cxx-language-version/modules/newestmodule/newestm0000644000175100017510000000011315154533055033516 0ustar runnerrunnerModule { Depends { name: "cpp" } cpp.cxxLanguageVersion: "c++26" } qbs-src-3.2.0/tests/auto/blackbox/testdata/toplevel-searchpath/0000755000175100017510000000000015154533055024164 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/toplevel-searchpath/qbs-resources/0000755000175100017510000000000015154533055026761 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/toplevel-searchpath/qbs-resources/imports/0000755000175100017510000000000015154533055030456 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/toplevel-searchpath/qbs-resources/imports/MyProduct.qbs0000644000175100017510000000001415154533055033106 0ustar runnerrunnerProduct { } qbs-src-3.2.0/tests/auto/blackbox/testdata/toplevel-searchpath/toplevel-searchpath.qbs0000644000175100017510000000001615154533055030642 0ustar runnerrunnerMyProduct { } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-assignment/0000755000175100017510000000000015154533055023672 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-assignment/imports/0000755000175100017510000000000015154533055025367 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-assignment/imports/MyImport/0000755000175100017510000000000015154533055027147 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-assignment/imports/MyImport/myimport.js0000644000175100017510000000005215154533055031362 0ustar runnerrunnervar key1 = "value1"; var key2 = "value2"; qbs-src-3.2.0/tests/auto/blackbox/testdata/import-assignment/import-assignment.qbs0000644000175100017510000000104015154533055030054 0ustar runnerrunnerimport MyImport Product { type: "outtype" property var importValue: MyImport Rule { multiplex: true Artifact { fileTags: "outtype" filePath: "dummy" } prepare: { var cmd = new JavaScriptCommand; cmd.silent = true; cmd.sourceCode = function() { console.info("key 1 = " + product.importValue.key1); console.info("key 2 = " + product.importValue.key2); }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/overrideProjectProperties/0000755000175100017510000000000015154533055025435 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/overrideProjectProperties/main.cpp0000644000175100017510000000237015154533055027067 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/overrideProjectProperties/helper_lib.qbs0000644000175100017510000000031115154533055030244 0ustar runnerrunnerDynamicLibrary { name: "helperLib" files: "helperlib.cpp" Depends { name: "cpp" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } qbs-src-3.2.0/tests/auto/blackbox/testdata/overrideProjectProperties/overrideProjectProperties.qbs0000644000175100017510000000245715154533055033377 0ustar runnerrunnerProject { property string nameSuffix: "" property bool someBool property int someInt property stringList someStringList Product { consoleApplication: true type: "application" property string mainFile: "" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } name: "MyApp" + nameSuffix Depends { name: "cpp" } files: { // Check types of the project's custom properties here. // Provoke a build error if the expected types do not match. var wrongFile = "doesnotexist.cpp"; if (typeof project.someBool != "boolean") { console.info("someBool has a wrong type: " + typeof project.someBool); return wrongFile; } if (typeof project.someInt != "number") { console.info("someInt has a wrong type: " + typeof project.someInt); return wrongFile; } if (typeof project.someStringList != "object") { console.info("someStringList has a wrong type: " + typeof project.someStringList); return wrongFile; } // Return the mainFile property that is set on the command line. return [mainFile]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/overrideProjectProperties/helperlib.cpp0000644000175100017510000000242715154533055030114 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" void DLL_EXPORT helperFunc() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/overrideProjectProperties/main2.cpp0000644000175100017510000000250515154533055027151 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" void DLL_IMPORT helperFunc(); int main() { helperFunc(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/overrideProjectProperties/project_using_helper_lib.qbs0000644000175100017510000000046215154533055033206 0ustar runnerrunnerProject { property bool linkSuccessfully: false references: linkSuccessfully ? ["helper_lib.qbs"] : [] CppApplication { consoleApplication: true Depends { condition: project.linkSuccessfully name: "helperLib" } files: "main2.cpp" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/installed-transformer-output/0000755000175100017510000000000015154533055026067 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/installed-transformer-output/qbs668.qbs0000644000175100017510000000141215154533055027625 0ustar runnerrunnerimport qbs.TextFile Product { name: "install-test" type: ["text"] qbs.installPrefix: "" Group { qbs.install: true qbs.installDir: "textfiles" fileTagsFilter: "text" } Rule { multiplex: true Artifact { filePath: "HelloWorld.txt" fileTags: ["text"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating file:'" + output.fileName + "'"; cmd.highlight = "codegen"; cmd.sourceCode = function() { var file = new TextFile(output.filePath, TextFile.WriteOnly); file.writeLine("Hello World!") file.close(); } return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/run-multiplexed/0000755000175100017510000000000015154533055023350 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/run-multiplexed/main.cpp0000644000175100017510000000001615154533055024775 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/run-multiplexed/run-multiplexed.qbs0000644000175100017510000000115715154533055027221 0ustar runnerrunnerimport qbs.Host CppApplication { aggregate: false consoleApplication: true name: "app" multiplexByQbsProperties: "buildVariants" qbs.buildVariants: ["debug", "release"] files: "main.cpp" Probe { id: checker property string targetPlatform: qbs.targetPlatform property string targetArchitecture: qbs.architecture configure: { var result = targetPlatform === Host.platform() && targetArchitecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-session/0000755000175100017510000000000015154533055022460 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-session/main.cpp0000644000175100017510000000013115154533055024103 0ustar runnerrunnerint main() { int i; // Should trigger a warning and thus a process-exited message. } qbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-session/file1.cpp0000644000175100017510000000001515154533055024160 0ustar runnerrunnervoid f1() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-session/file2.cpp0000644000175100017510000000001515154533055024161 0ustar runnerrunnervoid f2() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-session/qbs-session.qbs0000644000175100017510000000076515154533055025445 0ustar runnerrunnerProject { StaticLibrary { name: "theLib" Depends { name: "cpp" } cpp.cxxLanguageVersion: "c++11" Group { name: "sources" files: "lib.cpp" } Group { name: "headers" files: "lib.h" } } CppApplication { name: "theApp" consoleApplication: true cpp.cxxLanguageVersion: "c++14" cpp.warningLevel: "all" files: "main.cpp" install: true } } qbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-session/lib.h0000644000175100017510000000001215154533055023370 0ustar runnerrunnervoid f(); qbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-session/lib.cpp0000644000175100017510000000001515154533055023726 0ustar runnerrunnervoid f() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-session/modules/0000755000175100017510000000000015154533055024130 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-session/modules/mymodule/0000755000175100017510000000000015154533055025763 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/qbs-session/modules/mymodule/mymodule.qbs0000644000175100017510000000014415154533055030324 0ustar runnerrunnerimport qbs.Environment Module { setupRunEnvironment: { Environment.putEnv("MY_MODULE", 1); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/discard-unused-data/0000755000175100017510000000000015154533055024033 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/discard-unused-data/main.cpp0000644000175100017510000000004415154533055025461 0ustar runnerrunnervoid unusedFunc() {} int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/discard-unused-data/discard-unused-data.qbs0000644000175100017510000000141315154533055030362 0ustar runnerrunnerCppApplication { name: "app" type: base.concat("custom") property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } files: "main.cpp" Depends { name: "bundle"; condition: qbs.targetOS.includes("darwin") } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } Rule { multiplex: true outputFileTags: "custom" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.info("is Darwin: " + product.qbs.targetOS.includes("darwin")); console.info("---" + product.cpp.nmPath + "---"); } return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/probeProperties/0000755000175100017510000000000015154533055023376 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs0000644000175100017510000000213515154533055027272 0ustar runnerrunnerimport qbs.Probes Project { CppApplication { Probes.PathProbe { id: probe1 names: ["bin/tool"] platformSearchPaths: [product.sourceDirectory] } Probes.PathProbe { id: probe2 names: ["tool"] platformSearchPaths: [product.sourceDirectory + "/bin"] } targetName: { console.info("probe1.fileName=" + probe1.fileName); console.info("probe1.path=" + probe1.path); console.info("probe1.filePath=" + probe1.filePath); console.info("probe2.fileName=" + probe2.fileName); console.info("probe2.path=" + probe2.path); console.info("probe2.filePath=" + probe2.filePath); console.info("probe3.fileName=" + probe3.fileName); console.info("probe3.path=" + probe3.path); console.info("probe3.filePath=" + probe3.filePath); return name; } } Probes.PathProbe { id: probe3 names: ["tool"] platformSearchPaths: [project.sourceDirectory + "/bin"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/probeProperties/bin/0000755000175100017510000000000015154533055024146 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probeProperties/bin/tool0000644000175100017510000000000015154533055025034 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probeProperties/main.c0000644000175100017510000000236415154533055024473 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/always-run/0000755000175100017510000000000015154533055022314 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/always-run/transformer.qbs0000644000175100017510000000102215154533055025360 0ustar runnerrunnerimport qbs.TextFile Product { type: ["blubb"] Transformer { alwaysRun: false Artifact { filePath: "blubb.txt" fileTags: product.type } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "yo"; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.write("blubb"); f.close(); } return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/always-run/rule.qbs0000644000175100017510000000116115154533055023771 0ustar runnerrunnerimport qbs.TextFile Product { type: ["blubb"] Group { files: ["dummy.txt"] fileTags: ["dummy"] } Rule { alwaysRun: false inputs: ["dummy"] Artifact { filePath: "blubb.txt" fileTags: product.type } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "yo"; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.write("blubb"); f.close(); } return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/always-run/dummy.txt0000644000175100017510000000000015154533055024176 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/distribution-include-paths/0000755000175100017510000000000015154533055025467 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/distribution-include-paths/main.cpp0000644000175100017510000000013015154533055027111 0ustar runnerrunner#include #include int main() { printStuff(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/distribution-include-paths/subdir/0000755000175100017510000000000015154533055026757 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/distribution-include-paths/subdir/gagagugu.h0000644000175100017510000000010115154533055030707 0ustar runnerrunnervoid printStuff() { puts("alalalalonglonglilonglonglong"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/distribution-include-paths/distribution-include-paths.qbs0000644000175100017510000000013015154533055033445 0ustar runnerrunnerCppApplication { files: ["main.cpp"] cpp.distributionIncludePaths: ["subdir"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/cpp-library/0000755000175100017510000000000015154533055022436 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cpp-library/main.cpp0000644000175100017510000000244015154533055024066 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 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 "TestLib.h" int main() { return testFunction() - 42; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cpp-library/TestLibPrivate.h0000644000175100017510000000250215154533055025507 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 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 TESTLIBPRIVATE_H #define TESTLIBPRIVATE_H void privateFunction(); #endif // TESTLIBPRIVATE_H qbs-src-3.2.0/tests/auto/blackbox/testdata/cpp-library/cpp-library.qbs0000644000175100017510000000134315154533055025372 0ustar runnerrunnerProject { property bool dummy: { if (qbs.toolchain.includes("emscripten")) { console.info("is emscripten"); } else if (qbs.targetOS.includes("windows")) { console.info("is windows"); } else if (qbs.targetOS.includes("darwin")) { console.info("is darwin"); } else if (qbs.targetOS.includes("unix")){ console.info("is unix"); } } CppLibrary { name: "testlib" publicHeaders: ["TestLib.h"] privateHeaders: ["TestLibPrivate.h"] files: ["TestLib.cpp"] qbs.installPrefix: "" Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cpp-library/TestLib.cpp0000644000175100017510000000260415154533055024512 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 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 "TestLib.h" #include "TestLibPrivate.h" int testFunction() { privateFunction(); return 42; } void privateFunction() { // Private implementation } qbs-src-3.2.0/tests/auto/blackbox/testdata/cpp-library/TestLib.h0000644000175100017510000000245115154533055024157 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 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 TESTLIB_H #define TESTLIB_H int testFunction(); #endif // TESTLIB_H qbs-src-3.2.0/tests/auto/blackbox/testdata/multiple-changes/0000755000175100017510000000000015154533055023453 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/multiple-changes/multiple-changes.qbs0000644000175100017510000000140115154533055027417 0ustar runnerrunnerProject { property bool prop: false Product { name: "test" type: ["out-type"] Group { name: "Rule input" files: ["dummy.txt"] fileTags: ["in-type"] } Group { name: "irrelevant" files: ["*.blubb"] } Rule { inputs: ["in-type"] Artifact { filePath: "dummy.out" fileTags: product.type } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.info("prop: " + project.prop); } return [cmd]; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/multiple-changes/dummy.txt0000644000175100017510000000000015154533055025335 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/no-such-profile/0000755000175100017510000000000015154533055023224 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/no-such-profile/no-such-profile.qbs0000644000175100017510000000006615154533055026747 0ustar runnerrunnerProduct { name: "theProduct" property int p } qbs-src-3.2.0/tests/auto/blackbox/testdata/missing-dependency/0000755000175100017510000000000015154533055023777 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/missing-dependency/main.cpp0000644000175100017510000000240215154533055025425 0ustar runnerrunner/**************************************************************************** ** ** 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 int main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/missing-dependency/missing-dependency.qbs0000644000175100017510000000146615154533055030302 0ustar runnerrunnerimport qbs.TextFile Project { Product { name: "theDep" type: ["genheader"] Rule { multiplex: true Artifact { filePath: project.buildDirectory + "/theHeader.h" fileTags: product.type } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); } return [cmd]; } } } CppApplication { name: "theApp" cpp.includePaths: [project.buildDirectory] files: ["main.cpp"] Depends { name: "bundle" } bundle.isBundle: false } } qbs-src-3.2.0/tests/auto/blackbox/testdata/grpc/0000755000175100017510000000000015154533055021145 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/grpc/conanfile.txt0000644000175100017510000000013115154533055023637 0ustar runnerrunner[requires] grpc/1.54.3 [tool_requires] protobuf/3.21.12 grpc/1.54.3 [generators] QbsDeps qbs-src-3.2.0/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs0000644000175100017510000000173115154533055023453 0ustar runnerrunnerimport qbs.Host CppApplication { name: "grpc_cpp" consoleApplication: true condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result && hasDependencies; } Depends { name: "cpp" } cpp.cxxLanguageVersion: "c++17" cpp.minimumMacosVersion: "10.15" cpp.warningLevel: "none" qbs.buildVariant: "release" Depends { name: "protobuf.cpp"; required: false } Depends { name: "grpc++"; id: grpcpp; required: false } protobuf.cpp.useGrpc: true property bool hasDependencies: { console.info("has grpc: " + protobuf.cpp.present); console.info("has modules: " + grpcpp.present); return protobuf.cpp.present && grpcpp.present; } files: "grpc.cpp" Group { files: "grpc.proto" fileTags: "protobuf.grpc" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/grpc/grpc.proto0000644000175100017510000000026715154533055023172 0ustar runnerrunnersyntax = "proto3"; package Qbs; message Request { string name = 1; } message Response { string name = 1; } service Grpc { rpc doWork(Request) returns (Response) {} } qbs-src-3.2.0/tests/auto/blackbox/testdata/grpc/grpc.cpp0000644000175100017510000000357315154533055022614 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include class ServiceImpl final : public Qbs::Grpc::Service { grpc::Status doWork( grpc::ServerContext* context, const Qbs::Request* request, Qbs::Response* reply) override { (void)context; reply->set_name(request->name()); return grpc::Status::OK; } }; int main(int, char**) { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/0000755000175100017510000000000015154533055022233 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/tag-mismatch/0000755000175100017510000000000015154533055024611 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/tag-mismatch/tag-mismatch.qbs0000644000175100017510000000176315154533055027705 0ustar runnerrunnerProduct { name: "p" type: "p_type" Rule { multiplex: true outputFileTags: ["x"] outputArtifacts: [{filePath: "dummy1", fileTags: ["x","y","z"]}] prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { }; return cmd; } } Rule { inputs: ["y"] Artifact { filePath: "dummy2"; fileTags: "p_type" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { }; return cmd; } } Rule { inputs: ["x"] Artifact { filePath: "dummy3"; fileTags: "p_type" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/nonexistentWorkingDir/0000755000175100017510000000000015154533055026611 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/nonexistentWorkingDir/nonexistentWorkingDir.qbs0000644000175100017510000000057415154533055033704 0ustar runnerrunnerApplication { name: "kaputt" type: ["nutritious"] Rule { multiplex: true Artifact { filePath: "Stulle" fileTags: ["nutritious"] } prepare: { var cmd = new Command("ls"); cmd.workingDirectory = "/does/not/exist"; cmd.silent = true; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/outputArtifacts-missing-filePath/0000755000175100017510000000000015154533055030635 5ustar runnerrunner././@LongLink0000644000000000000000000000017300000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/outputArtifacts-missing-filePath/outputArtifacts-missing-filePath.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/outputArtifacts-missing-filePath/outputArtifact0000644000175100017510000000054215154533055033577 0ustar runnerrunnerCppApplication { type: base.concat("txt") files : ["main.cpp"] Rule { inputs: ["application"] outputArtifacts: [{ fileTags: ["txt"] }] outputFileTags: ["txt"] prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/outputArtifacts-missing-filePath/main.cpp0000644000175100017510000000003115154533055032257 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/outputArtifacts-missing-fileTags/0000755000175100017510000000000015154533055030637 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/outputArtifacts-missing-fileTags/main.cpp0000644000175100017510000000003115154533055032261 0ustar runnerrunnerint main() { return 0; } ././@LongLink0000644000000000000000000000017300000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/outputArtifacts-missing-fileTags/outputArtifacts-missing-fileTags.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/outputArtifacts-missing-fileTags/outputArtifact0000644000175100017510000000057215154533055033604 0ustar runnerrunnerCppApplication { type: base.concat("txt") files : ["main.cpp"] Rule { inputs: ["application"] outputArtifacts: [{ filePath: input.completeBaseName + ".txt" }] outputFileTags: ["txt"] prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/texttemplate-unknown-placeholder/0000755000175100017510000000000015154533055030730 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/texttemplate-unknown-placeholder/boom.txt.in0000644000175100017510000000004515154533055033031 0ustar runnerrunnerBoom! shake-shake-shake the ${what}! ././@LongLink0000644000000000000000000000017300000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/texttemplate-unknown-placeholder/texttemplate-unknown-placeholder.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/erroneous/texttemplate-unknown-placeholder/texttemplate-u0000644000175100017510000000024115154533055033632 0ustar runnerrunnerProduct { type: ["text"] Depends { name: "texttemplate" } texttemplate.dict: ({ wat: "room" }) // typo in key name files: [ "boom.txt.in" ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/0000755000175100017510000000000015154533055025167 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/thelibs.qbs0000644000175100017510000000033115154533055027325 0ustar runnerrunnerProject { Dll { name: "thelib" files: "lib1.cpp" } Dll { name: "theotherlib" files: "lib2.cpp" } Dll { name: "thethirdlib" files: "lib3.cpp" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/main.cpp0000644000175100017510000000032415154533055026616 0ustar runnerrunner#include "../dllexport.h" DLL_IMPORT void theOtherLibFunc(); DLL_IMPORT void theFourthLibFunc(); void theThirdLibFunc() { } int main() { theOtherLibFunc(); theThirdLibFunc(); theFourthLibFunc(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/lib3.cpp0000644000175100017510000000021615154533055026523 0ustar runnerrunner#include "../dllexport.h" #include DLL_EXPORT void theThirdLibFunc() { std::cout << "Hello from thethirdlib!" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/lib5.cpp0000644000175100017510000000003115154533055026520 0ustar runnerrunnervoid staticLibFunc() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/lib2.cpp0000644000175100017510000000021615154533055026522 0ustar runnerrunner#include "../dllexport.h" #include DLL_EXPORT void theOtherLibFunc() { std::cout << "Hello from theotherlib!" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/Dll.qbs0000644000175100017510000000062015154533055026407 0ustar runnerrunnerDynamicLibrary { Depends { name: "cpp" } Depends { name: "bundle"; condition: qbs.targetOS.includes("darwin") } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false cpp.minimumMacosVersion: "10.7" // For -rpath } install: true installImportLib: true qbs.installPrefix: "" installDir: "" importLibInstallDir: "" } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/lib4.cpp0000644000175100017510000000016315154533055026525 0ustar runnerrunner#include "../dllexport.h" DLL_IMPORT void theLibFunc(); DLL_EXPORT void theFourthLibFunc() { theLibFunc(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/theapp.qbs0000644000175100017510000000212315154533055027155 0ustar runnerrunnerimport qbs.Host Project { CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "theapp" cpp.minimumMacosVersion: "10.7" // For -rpath Depends { name: "theotherlib" } Depends { name: "thethirdlib" } Depends { name: "thefourthlib" } Depends { name: "staticlib" } files: "main.cpp" Group { fileTagsFilter: "dynamiclibrary" qbs.install: true qbs.installSourceBase: buildDirectory } } Dll { name: "thefourthlib" Depends { name: "thelib" } files: "lib4.cpp" Export { Depends { name: "cpp" } cpp.rpaths: [qbs.installRoot] } } StaticLibrary { name: "staticlib" Depends { name: "cpp" } Depends { name: "theotherlib" } files: "lib5.cpp" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/modules/0000755000175100017510000000000015154533055026637 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/modules/theotherlib/0000755000175100017510000000000015154533055031150 5ustar runnerrunner././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/modules/theotherlib/theotherlib.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/modules/theotherlib/theotherlib0000644000175100017510000000134415154533055033406 0ustar runnerrunnerimport qbs.FileInfo Module { Depends { name: "cpp" } property string baseDir: FileInfo.cleanPath(FileInfo.joinPaths(path, "..", "..")) cpp.rpaths: [product.theotherlib.baseDir] Group { name: "theotherlib dll" files: FileInfo.joinPaths(product.theotherlib.baseDir, cpp.dynamicLibraryPrefix + "theotherlib" + cpp.dynamicLibrarySuffix) fileTags: ["dynamiclibrary"] filesAreTargets: true } Group { name: "theotherlib dll import" condition: qbs.targetOS.includes("windows") files: FileInfo.joinPaths(product.theotherlib.baseDir, "theotherlib.lib") fileTags: ["dynamiclibrary_import"] filesAreTargets: true } } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/modules/thelib/0000755000175100017510000000000015154533055030106 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/modules/thelib/broken.cpp0000644000175100017510000000001515154533055032066 0ustar runnerrunnersyntax error qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/modules/thelib/thelib.qbs0000644000175100017510000000150515154533055032065 0ustar runnerrunnerimport qbs.FileInfo Module { Depends { name: "cpp" } property string baseDir: FileInfo.cleanPath(FileInfo.joinPaths(path, "..", "..")) cpp.rpaths: [product.thelib.baseDir] Group { name: "thelib dll" files: FileInfo.joinPaths(product.thelib.baseDir, cpp.dynamicLibraryPrefix + "thelib" + cpp.dynamicLibrarySuffix) fileTags: ["dynamiclibrary"] filesAreTargets: true } Group { name: "thelib dll import" condition: qbs.targetOS.includes("windows") files: FileInfo.joinPaths(product.thelib.baseDir, "thelib.lib") fileTags: ["dynamiclibrary_import"] filesAreTargets: true } Group { name: "to be ignored" filesAreTargets: true files: "broken.cpp" fileTags: ["cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/modules/thethirdlib/0000755000175100017510000000000015154533055031141 5ustar runnerrunner././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/modules/thethirdlib/thethirdlib.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/modules/thethirdlib/thethirdlib0000644000175100017510000000126415154533055033371 0ustar runnerrunnerimport qbs.FileInfo Module { Depends { name: "cpp" } property string baseDir: FileInfo.cleanPath(FileInfo.joinPaths(path, "..", "..")) Group { name: "thethirdlib dll" condition: false files: FileInfo.joinPaths(product.theotherlib.baseDir, cpp.dynamicLibraryPrefix + "thethirdlib" + cpp.dynamicLibrarySuffix) fileTags: ["dynamiclibrary"] filesAreTargets: true } Group { name: "thethirdlib dll import" condition: false files: FileInfo.joinPaths(product.thethirdlib.baseDir, "thethirdlib.lib") fileTags: ["dynamiclibrary_import"] filesAreTargets: true } } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamic-library-in-module/lib1.cpp0000644000175100017510000000020415154533055026516 0ustar runnerrunner#include "../dllexport.h" #include DLL_EXPORT void theLibFunc() { std::cout << "Hello from thelib!" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-artifact-path/0000755000175100017510000000000015154533055024365 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-artifact-path/invalid-artifact-path.qbs0000644000175100017510000000065215154533055031252 0ustar runnerrunnerProject { property string artifactDir Product { type: "t" Rule { multiplex: true Artifact { filePath: project.artifactDir + "/file.out" fileTags: "t" } prepare: { var cmd = new JavaScriptCommand(); cmd.sourceCode = function() {}; return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/add-filetag-to-generated-artifact/0000755000175100017510000000000015154533055026522 5ustar runnerrunner././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/add-filetag-to-generated-artifact/add-filetag-to-generated-artifact.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/add-filetag-to-generated-artifact/add-filetag-to-generate0000644000175100017510000000211415154533055033014 0ustar runnerrunnerimport qbs.File Project { property bool enableTagging CppApplication { name: "my_app" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } files: "main.cpp" Group { condition: project.enableTagging fileTagsFilter: ["application"] fileTags: ["app-to-compress"] } } Product { name: "my_compressed_app" type: ["compressed_application"] Depends { name: "my_app" } Rule { inputsFromDependencies: ["app-to-compress"] Artifact { filePath: "compressed-" + input.fileName fileTags: ["compressed_application"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "compressing " + input.fileName; cmd.highlight = "linker"; cmd.sourceCode = function () { File.copy(input.filePath, output.filePath); }; return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/add-filetag-to-generated-artifact/main.cpp0000644000175100017510000000001615154533055030147 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/response-files/0000755000175100017510000000000015154533055023150 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/response-files/cat-response-file.cpp0000644000175100017510000000431015154533055027172 0ustar runnerrunner/**************************************************************************** ** ** 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 #include #include #include using namespace std; int main(int argc, char *argv[]) { if (argc < 3) { cerr << "cat-response-file: not enough arguments: " << argc - 1 << endl; return 1; } if (strlen(argv[2]) < 2) { cerr << "cat-response-file: second argument is too short: " << argv[2] << endl; return 2; } if (argv[2][0] != '@') { cerr << "cat-response-file: second argument does not start with @: " << argv[2] << endl; return 3; } ifstream inf(argv[2] + 1); if (!inf.is_open()) { cerr << "cat-response-file: cannot open input file " << argv[2] + 1 << endl; return 4; } ofstream ouf(argv[1]); if (!ouf.is_open()) { cerr << "cat-response-file: cannot open output file " << argv[1] << endl; return 5; } string line; while (getline(inf, line)) ouf << line << endl; inf.close(); ouf.close(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/response-files/response-files.qbs0000644000175100017510000000572115154533055026622 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host import qbs.TextFile Project { CppApplication { name: "cat-response-file" files: ["cat-response-file.cpp"] cpp.enableExceptions: true } Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "response-file-text" type: ["text"] Depends { name: "cpp" } Depends { name: "cat-response-file" } qbs.installPrefix: "" Group { fileTagsFilter: ["text"] qbs.install: true } Rule { inputsFromDependencies: ["application"] Artifact { filePath: "response-file-content.txt" fileTags: ["text"] } prepare: { var filePath = inputs["application"][0].filePath; var args = [output.filePath, "foo", "with space", "bar"]; var cmd = new Command(filePath, args); cmd.responseFileThreshold = 1; cmd.responseFileArgumentIndex = 1; cmd.responseFileUsagePrefix = '@'; cmd.silent = true; return cmd; } } } Product { name: "lotsofobjects" type: ["dynamiclibrary"] // clang-cl does not use response file internally, thus linker complains that command is // too long. This can be worked around by calling the linker directly Properties { condition: qbs.toolchain.includes("clang-cl") cpp.linkerMode: "manual" } Depends { name: "cpp" } Rule { multiplex: true outputFileTags: ["cpp"] outputArtifacts: { var artifacts = []; for (var i = 0; i < 1000; ++i) artifacts.push({filePath: "source-" + i + ".cpp", fileTags: ["cpp"]}); return artifacts; } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + outputs["cpp"].length + " dummy source files"; cmd.outputFilePaths = outputs["cpp"].map(function (a) { return a.filePath; }); cmd.sourceCode = function () { var index = 0; outputFilePaths.map(function (fp) { var tf = new TextFile(fp, TextFile.WriteOnly); try { tf.writeLine("extern int foo" + index + "() { return 0; }"); ++index; } finally { tf.close(); } }); }; return [cmd]; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/versioncheck/0000755000175100017510000000000015154533055022675 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/versioncheck/versioncheck.qbs0000644000175100017510000000037315154533055026072 0ustar runnerrunnerProduct { property string requestedMinVersion property string requestedMaxVersion Depends { name: "higher" } Depends { name: "lower" versionAtLeast: requestedMinVersion versionBelow: requestedMaxVersion } } qbs-src-3.2.0/tests/auto/blackbox/testdata/versioncheck/modules/0000755000175100017510000000000015154533055024345 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/versioncheck/modules/higher/0000755000175100017510000000000015154533055025613 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/versioncheck/modules/higher/higher.qbs0000644000175100017510000000021015154533055027561 0ustar runnerrunnerModule { Depends { name: "lower" required: false versionAtLeast: "1.0" versionBelow: "10.0" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/versioncheck/modules/lower/0000755000175100017510000000000015154533055025475 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/versioncheck/modules/lower/lower.qbs0000644000175100017510000000001315154533055027326 0ustar runnerrunnerModule { } qbs-src-3.2.0/tests/auto/blackbox/testdata/source-artifact-changes/0000755000175100017510000000000015154533055024713 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/source-artifact-changes/source-artifact-changes.qbs0000644000175100017510000000305115154533055032122 0ustar runnerrunnerCppApplication { name: "app" type: base.concat("dummy") consoleApplication: true Properties { condition: qbs.targetOS.includes("darwin") bundle.embedInfoPlist: false } Probe { id: toolchainProbe property stringList toolchain: qbs.toolchain property string executableSuffix: cpp.executableSuffix configure: { console.info("is gcc: " + toolchain.includes("gcc")); console.info("executable suffix: " + executableSuffix); found = true; } } Rule { multiplex: true inputs: "cpp" Artifact { filePath: "dummy" fileTags: "dummy" cpp.cxxLanguageVersion: "hoppla" } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { if (output.cpp.cxxLanguageVersion !== "hoppla") throw "This cannot be!"; }; return cmd; } } Rule { multiplex: true inputs: "cpp" requiresInputs: false Artifact { filePath: "dummy2"; fileTags: "dummy" } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.info("cpp artifacts: " + (product.artifacts.cpp ? product.artifacts.cpp.length : 0)) }; return cmd; } } Depends { name: "module_with_files" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/source-artifact-changes/modules/0000755000175100017510000000000015154533055026363 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/source-artifact-changes/modules/module_with_files/0000755000175100017510000000000015154533055032065 5ustar runnerrunner././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/source-artifact-changes/modules/module_with_files/main.cppqbs-src-3.2.0/tests/auto/blackbox/testdata/source-artifact-changes/modules/module_with_files/main.cp0000644000175100017510000000001615154533055033332 0ustar runnerrunnerint main() {} ././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/source-artifact-changes/modules/module_with_files/module_with_files.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/source-artifact-changes/modules/module_with_files/module_0000644000175100017510000000060715154533055033437 0ustar runnerrunnerModule { property stringList fileTags property bool overrideTags property bool filesAreTargets Depends { name: "cpp" } Group { prefix: path + '/' files: "main.cpp" fileTags: product.module_with_files.fileTags overrideTags: product.module_with_files.overrideTags filesAreTargets: product.module_with_files.filesAreTargets } } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/0000755000175100017510000000000015154533055024547 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/irrelevant.js0000644000175100017510000000005715154533055027262 0ustar runnerrunnerfunction irrelevant() { return "irrelevant"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/import-change-tracking-product.qbs0000644000175100017510000000240015154533055033265 0ustar runnerrunnerimport "irrelevant.js" as Irrelevant import "custom1prepare1.js" as Custom1Prepare import "custom2prepare" as Custom2Prepare import "probe1.js" as ProbeFunc Product { name: "customProduct" type: ["custom1", "custom2"] property string irrelevant: Irrelevant.irrelevant() property string dummy: probe1.result Group { files: "input1.txt" fileTags: "input.custom1" } Group { files: "input2.txt" fileTags: "input.custom2" } Rule { inputs: "input.custom1" Artifact { filePath: "dummy.custom1"; fileTags: "custom1" } prepare: { return Custom1Prepare.prepare(); } } Rule { inputs: "input.custom2" Artifact { filePath: "dummy.custom2"; fileTags: "custom2" } prepare: { return Custom2Prepare.prepare(); } } Probe { id: probe1 property string input: Irrelevant.irrelevant() property string result configure: { found = true; console.info("running probe1"); return ProbeFunc.probe1Func(); } } Probe { id: probe2 configure: { console.info("running probe2"); found = true; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/import-change-tracking.qbs0000644000175100017510000000013315154533055031610 0ustar runnerrunnerProject { qbsSearchPaths: ["."] references: "import-change-tracking-product.qbs" } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/custom1command.js0000644000175100017510000000011015154533055030027 0ustar runnerrunnervar Irrelevant = require("./irrelevant.js"); function sourceCode() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/probe1.js0000644000175100017510000000013315154533055026272 0ustar runnerrunnervar Probe2 = require("./probe2.js") function probe1Func() { return Probe2.probe2Func(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/imports/0000755000175100017510000000000015154533055026244 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/imports/custom2command/0000755000175100017510000000000015154533055031177 5ustar runnerrunner././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/imports/custom2command/custom2command1.jsqbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/imports/custom2command/custom2comm0000644000175100017510000000006115154533055033367 0ustar runnerrunnervar Irrelevant = require("../../irrelevant.js"); ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/imports/custom2command/custom2command2.jsqbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/imports/custom2command/custom2comm0000644000175100017510000000011415154533055033366 0ustar runnerrunnervar Irrelevant = require("../../irrelevant.js"); function sourceCode() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/custom1prepare1.js0000644000175100017510000000023215154533055030135 0ustar runnerrunnervar CustomPrepare = require("./custom1prepare2.js"); var Irrelevant = require("./irrelevant.js"); function prepare() { return CustomPrepare.prepare(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/custom2prepare/0000755000175100017510000000000015154533055027522 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/custom2prepare/custom2prepare1.js0000644000175100017510000000000015154533055033102 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/custom2prepare/custom2prepare2.js0000644000175100017510000000045515154533055033121 0ustar runnerrunnervar Custom2Command = require("custom2command"); function prepare() { console.info("running custom2 prepare script"); var cmd = new JavaScriptCommand(); cmd.description = "running custom2 command"; cmd.sourceCode = function() { return Custom2Command.sourceCode(); }; return cmd; } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/input2.txt0000644000175100017510000000000015154533055026517 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/custom1prepare2.js0000644000175100017510000000053715154533055030146 0ustar runnerrunnervar Custom1Command = require("./custom1command.js"); var Irrelevant = require("./irrelevant.js"); function prepare() { console.info("running custom1 prepare script"); var cmd = new JavaScriptCommand(); cmd.description = "running custom1 command"; cmd.sourceCode = function() { return Custom1Command.sourceCode(); }; return cmd; } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/probe2.js0000644000175100017510000000005615154533055026277 0ustar runnerrunnerfunction probe2Func() { return "probeData"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/import-change-tracking/input1.txt0000644000175100017510000000000015154533055026516 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/0000755000175100017510000000000015154533055025353 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/maximum-c-language-version.qbs0000644000175100017510000000137615154533055033232 0ustar runnerrunnerCppApplication { name: "app" property bool enableNewestModule: true Probe { id: osProbe property string toolchainType: qbs.toolchainType property string compilerVersion: cpp.compilerVersion configure: { console.info("is msvc: " + (toolchainType === "msvc" || toolchainType === "clang-cl")); var isOld = (toolchainType === "msvc" && compilerVersion < "19.29.30138") || (toolchainType === "clang-cl" && compilerVersion < "13"); console.info("is old msvc: " + isOld); found = true; } } Depends { name: "oldmodule" } Depends { name: "newermodule" } Depends { name: "newestmodule"; condition: enableNewestModule } files: "main.c" } qbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/main.c0000644000175100017510000000003115154533055026435 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/modules/0000755000175100017510000000000015154533055027023 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/modules/newermodule/0000755000175100017510000000000015154533055031351 5ustar runnerrunner././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/modules/newermodule/newermodule.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/modules/newermodule/newermodul0000644000175100017510000000010715154533055033453 0ustar runnerrunnerModule { Depends { name: "cpp" } cpp.cLanguageVersion: "c99" } qbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/modules/oldmodule/0000755000175100017510000000000015154533055031007 5ustar runnerrunner././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/modules/oldmodule/oldmodule.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/modules/oldmodule/oldmodule.qb0000644000175100017510000000010715154533055033315 0ustar runnerrunnerModule { Depends { name: "cpp" } cpp.cLanguageVersion: "c90" } qbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/modules/newestmodule/0000755000175100017510000000000015154533055031536 5ustar runnerrunner././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/modules/newestmodule/newestmodule.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/maximum-c-language-version/modules/newestmodule/newestmod0000644000175100017510000000010715154533055033464 0ustar runnerrunnerModule { Depends { name: "cpp" } cpp.cLanguageVersion: "c11" } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamicRuleOutputs/0000755000175100017510000000000015154533055024072 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamicRuleOutputs/after/0000755000175100017510000000000015154533055025173 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamicRuleOutputs/after/numbers.l0000644000175100017510000000513615154533055027030 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of the examples of Qbs. ** ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ****************************************************************************/ /* scanner for integer and float numbers */ %option noyywrap %{ #ifndef CRUCIAL_DEFINE # error CRUCIAL_DEFINE is missing! #endif /* need this for the call to atof() below */ #include %} DIGIT [0-9] %% {DIGIT}+ { printf("integer: %s (%d)\n", yytext, atoi(yytext)); } {DIGIT}+"."{DIGIT}* { printf("float: %s (%g)\n", yytext, atof(yytext)); } "{"[\^{}}\n]*"}" /* eat up one-line comments */ [ \t\n]+ /* eat up whitespace */ . printf("Unexpected character: %s\n", yytext); %% int main(int argc, char **argv) { if (argc > 1) yyin = fopen(argv[1], "r"); else yyin = stdin; yylex(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamicRuleOutputs/before/0000755000175100017510000000000015154533055025334 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/dynamicRuleOutputs/before/flexoptionsreader.js0000644000175100017510000000671115154533055031434 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of the examples of Qbs. ** ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ****************************************************************************/ var TextFile = require("qbs.TextFile"); function readFlexOptions(filePath) { function splitOptions(str) { var options = []; var opt = ""; var inquote = false; for (var i = 0; i < str.length; ++i) { if (str[i] === '"') { opt += '"'; inquote = !inquote; } else if (str[i] === ' ' && !inquote) { options.push(opt); opt = ""; } else { opt += str[i]; } } if (opt.length) options.push(opt); return options; } function unquote(str) { var l = str.length; if (l > 2 && str[0] === '"' && str[l - 1] === '"') return str.substr(1, l - 2); return str; } function parseOptionLine(result, str) { var options = splitOptions(str); var re = /^(outfile|header-file)=(.*)$/; var reres; for (var k in options) { re.lastIndex = 0; reres = re.exec(options[k]); if (reres === null) continue; result[reres[1]] = unquote(reres[2]); } } var tf = new TextFile(filePath); var line; var optrex = /^%option\s+(.*$)/; var res; var options = {}; while (!tf.atEof()) { line = tf.readLine(); if (line === "%%") break; optrex.lastIndex = 0; res = optrex.exec(line); if (res === null) continue; parseOptionLine(options, res[1]); } tf.close(); return options; } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamicRuleOutputs/before/numbers.l0000644000175100017510000000523615154533055027172 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of the examples of Qbs. ** ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ****************************************************************************/ /* scanner for integer and float numbers */ %option noyywrap %option outfile="numberscanner.c" header-file="numberscanner.h" %{ #ifndef CRUCIAL_DEFINE # error CRUCIAL_DEFINE is missing! #endif /* need this for the call to atof() below */ #include %} DIGIT [0-9] %% {DIGIT}+ { printf("integer: %s (%d)\n", yytext, atoi(yytext)); } {DIGIT}+"."{DIGIT}* { printf("float: %s (%g)\n", yytext, atof(yytext)); } "{"[\^{}}\n]*"}" /* eat up one-line comments */ [ \t\n]+ /* eat up whitespace */ . printf("Unexpected character: %s\n", yytext); %% int main(int argc, char **argv) { if (argc > 1) yyin = fopen(argv[1], "r"); else yyin = stdin; yylex(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/dynamicRuleOutputs/before/genlexer.qbs0000644000175100017510000001174615154533055027665 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of the examples of Qbs. ** ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ****************************************************************************/ import qbs.FileInfo import qbs.Probes import qbs.TextFile import "flexoptionsreader.js" as FlexOptionsReader Project { Product { name: "genlexer" type: "application" consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: "cpp" } Group { files: ["numbers.l"] fileTags: ["flex"] } Probes.PathProbe { id: flexProbe names: ["flex"] platformSearchPaths: ["/usr/local/bin", "/usr/bin", "/bin"] } property bool isFlexAvailable: flexProbe.found Rule { inputs: ["flex"] outputFileTags: ["c", "hpp"] outputArtifacts: { var options = FlexOptionsReader.readFlexOptions(input.filePath); var sourceFileName = options["outfile"] || "lex.yy.c"; var headerFileName = options["header-file"]; var result = [{ filePath: "GeneratedFiles/" + sourceFileName, fileTags: ["c"], cpp: { defines: ["CRUCIAL_DEFINE"] } }]; if (headerFileName) { result.push({ filePath: "GeneratedFiles/" + headerFileName, fileTags: ["hpp"] }); } return result; } prepare: { var cmd; if (product.isFlexAvailable) { // flex is available. Let's call it. cmd = new Command("flex", [input.filePath]); cmd.workingDirectory = product.buildDirectory + "/GeneratedFiles"; } else { // No flex available here, generate some C source and header. cmd = new JavaScriptCommand(); cmd.sourceFileName = outputs["c"][0].filePath; cmd.headerFileName = outputs["hpp"] ? outputs["hpp"][0].filePath : ""; cmd.sourceCode = function() { var fsrc = new TextFile(sourceFileName, TextFile.WriteOnly); if (headerFileName) { fsrc.write("#include \"" + FileInfo.fileName(headerFileName) + "\"\n\n"); var fhdr = new TextFile(headerFileName, TextFile.WriteOnly); fhdr.write("// a rather empty header file\n"); fhdr.close(); } fsrc.write("\n#ifndef CRUCIAL_DEFINE\n"); fsrc.write("# error CRUCIAL_DEFINE is missing!\n"); fsrc.write("#endif\n\n"); fsrc.write("int main() { return 0; }\n"); fsrc.close(); }; } cmd.description = "flexing " + FileInfo.fileName(input.filePath); return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/rescue-transformer-data/0000755000175100017510000000000015154533055024747 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/rescue-transformer-data/main.cpp0000644000175100017510000000001615154533055026374 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/rescue-transformer-data/transformer-data-rescue.qbs0000644000175100017510000000014415154533055032212 0ustar runnerrunnerCppApplication { type: base.concat(["out"]) Depends { name: "m" } files: ["main.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/rescue-transformer-data/modules/0000755000175100017510000000000015154533055026417 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/rescue-transformer-data/modules/m/0000755000175100017510000000000015154533055026653 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/rescue-transformer-data/modules/m/m.qbs0000644000175100017510000000064615154533055027624 0ustar runnerrunnerModule { property bool p Rule { multiplex: true Artifact { filePath: "dummy" fileTags: ["out"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating dummy"; cmd.sourceCode = function() { console.info("m.p: " + product.m.p); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cpu-features/0000755000175100017510000000000015154533055022615 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cpu-features/main.cpp0000644000175100017510000000001615154533055024242 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/cpu-features/cpu-features.qbs0000644000175100017510000000073415154533055025733 0ustar runnerrunnerCppApplication { Depends { name: "cpufeatures" } cpufeatures.x86_sse2: true cpufeatures.x86_avx: true cpufeatures.x86_avx512f: false files: ["main.cpp"] property bool dummy: { console.info("is x86: " + (qbs.architecture === "x86")); console.info("is x64: " + (qbs.architecture === "x86_64")); console.info("is gcc: " + qbs.toolchain.includes("gcc")); console.info("is msvc: " + qbs.toolchain.includes("msvc")); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/msvc-asm-flags/0000755000175100017510000000000015154533055023032 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/msvc-asm-flags/msvc-asm-flags.asm0000644000175100017510000000007715154533055026360 0ustar runnerrunnerinclude header.inc .code main proc mov ecx, 16 main endp endqbs-src-3.2.0/tests/auto/blackbox/testdata/msvc-asm-flags/include/0000755000175100017510000000000015154533055024455 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/msvc-asm-flags/include/header.inc0000644000175100017510000000000015154533055026366 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/msvc-asm-flags/msvc-asm-flags.qbs0000644000175100017510000000037615154533055026367 0ustar runnerrunnerStaticLibrary { condition: qbs.toolchain.includes("msvc") && !qbs.architecture.contains("arm64") && !qbs.architecture.contains("armv7") Depends { name: "cpp" } files: "msvc-asm-flags.asm" cpp.assemblerFlags: ["/I", "include"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/env-normalization/0000755000175100017510000000000015154533055023666 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/env-normalization/env-normalization.qbs0000644000175100017510000000031115154533055030044 0ustar runnerrunnerimport qbs.Environment Product { Probe { id: dummy property var env: Environment.currentEnv() configure: { console.info(JSON.stringify(env)); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/library-type/0000755000175100017510000000000015154533055022635 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/library-type/library-type.cpp0000644000175100017510000000007015154533055025761 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void libFunc() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/library-type/library-type.qbs0000644000175100017510000000145215154533055025771 0ustar runnerrunnerProject { property bool dummy: { const isWin = qbs.targetOS.includes("windows"); const isDarwin = qbs.targetOS.includes("darwin"); const isMac = qbs.targetOS.includes("macos"); const toolGcc = qbs.toolchain.includes("gcc") || qbs.toolchain.includes("emscripten"); console.info("is windows: " + (isWin ? "yes" : "no")); console.info("is darwin: " + (isDarwin ? "yes" : "no")); console.info("is macos: " + (isMac ? "yes" : "no")); console.info("is gcc: " + (toolGcc ? "yes" : "no")); } Library { Depends { name: "cpp" } Depends { name: "bundle" } name: "mylib" files: ["library-type.cpp"] qbs.installPrefix: "" config.install.staticLibraries: true bundle.isBundle: false } } qbs-src-3.2.0/tests/auto/blackbox/testdata/explicitly-depends-on/0000755000175100017510000000000015154533055024432 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/explicitly-depends-on/step1.txt0000644000175100017510000000000315154533055026220 0ustar runnerrunnerhi qbs-src-3.2.0/tests/auto/blackbox/testdata/explicitly-depends-on/explicitly-depends-on.qbs0000644000175100017510000000675515154533055031376 0ustar runnerrunnerimport qbs.File import qbs.TextFile Project { // Cases: // step1 + in-product final -> step2 -> step3 -> final => rule cycle // step1 + dependency final -> step2 -> step3 -> final => ok // step1 + module filesAreTargets final -> step2 -> step3 -> final => ok name: "proj1" property bool useModule: false Product { name: "prod1" type: "final" property bool useExplicitlyDependsOn: false property bool useExplicitlyDependsOnFromDependencies: false Depends { condition: !project.useModule name: "prod2" } Depends { condition: project.useModule name: "module1" } Group { files: ["step1.txt"] fileTags: ["step1"] } Rule { inputs: ["step3"] outputFileTags: ["final"] Artifact { filePath: "final.txt" fileTags: ["final"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "step3 -> final"; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return cmd; } } Rule { inputs: ["step2"] outputFileTags: ["step3"] Artifact { filePath: "step3.txt" fileTags: ["step3"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "step2 -> step3"; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return cmd; } } Rule { inputs: ["step1"] outputFileTags: ["step2"] Artifact { filePath: "step2.txt" fileTags: ["step2"] } Properties { condition: useExplicitlyDependsOn explicitlyDependsOn: ["final"] } Properties { condition: useExplicitlyDependsOnFromDependencies explicitlyDependsOnFromDependencies: ["final"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "step1 -> step2"; cmd.sourceCode = function() { console.info("Using explicitlyDependsOnArtifact: " + explicitlyDependsOn["final"][0].fileName) File.copy(input.filePath, output.filePath); }; return cmd; } } } Product { name: "prod2" type: "final" condition: !project.useModule Rule { multiplex: true requiresInputs: false outputFileTags: ["final"] Artifact { filePath: "product-fish.txt" fileTags: ["final"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating 'product-fish.txt' tagged with 'final'"; cmd.sourceCode = function() { var file = new TextFile(output.filePath, TextFile.ReadWrite); file.write("Lots of fish."); file.close() }; return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/explicitly-depends-on/modules/0000755000175100017510000000000015154533055026102 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/explicitly-depends-on/modules/module1/0000755000175100017510000000000015154533055027450 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/explicitly-depends-on/modules/module1/module-fish.txt0000644000175100017510000000001415154533055032420 0ustar runnerrunnerModule fish qbs-src-3.2.0/tests/auto/blackbox/testdata/explicitly-depends-on/modules/module1/module1.qbs0000644000175100017510000000017215154533055031525 0ustar runnerrunnerModule { Group { filesAreTargets: true fileTags: ["final"] files: ["module-fish.txt"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/env-merging/0000755000175100017510000000000015154533055022430 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/env-merging/env-merging.qbs0000644000175100017510000000146215154533055025360 0ustar runnerrunnerimport qbs.Host Project { CppApplication { name: "tool" files: "main.c" } Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "p" type: "custom" Depends { name: "tool" } Rule { inputsFromDependencies: "application" outputFileTags: "custom" prepare: { var cmd = new Command(input.filePath, []); cmd.description = "running tool"; cmd.environment = ["PATH=/opt/tool/bin"]; return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/env-merging/main.c0000644000175100017510000000015415154533055023520 0ustar runnerrunner#include #include int main() { printf("PATH=%s", getenv("PATH")); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/require/0000755000175100017510000000000015154533055021666 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/require/zort.js0000644000175100017510000000044715154533055023227 0ustar runnerrunnervar File = require("qbs.File") function createCommand(filePaths) { var cmd = new JavaScriptCommand(); cmd.description = "Create another empty file"; cmd.filePaths = filePaths; cmd.sourceCode = function() { File.copy(filePaths[0], filePaths[1]); }; return cmd; } qbs-src-3.2.0/tests/auto/blackbox/testdata/require/blubb.js0000644000175100017510000000061415154533055023313 0ustar runnerrunnervar TextFile = require("qbs.TextFile") var zort = require("./zort.js") function createCommands(filePaths) { var cmd = new JavaScriptCommand(); cmd.description = "Write an empty file"; cmd.filePath = filePaths[0]; cmd.sourceCode = function() { var f = new TextFile(filePath, TextFile.WriteOnly); f.close(); } return [cmd, zort.createCommand(filePaths)]; } qbs-src-3.2.0/tests/auto/blackbox/testdata/require/require.qbs0000644000175100017510000000071615154533055024055 0ustar runnerrunnerimport 'blubb.js' as blubb Product { type: ["text"] Rule { multiplex: true Artifact { fileTags: ["text"] filePath: "one.txt" } Artifact { fileTags: ["text"] filePath: "two.txt" } prepare: { var filePaths = outputs.text.map(function (artifact) {return artifact.filePath; }); return blubb.createCommands(filePaths); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/ico/0000755000175100017510000000000015154533055020764 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/ico/icon_32x32.png0000644000175100017510000000123115154533055023260 0ustar runnerrunnerPNG  IHDR szzsRGB pHYs%%IR$iTXtXML:com.adobe.xmp 4 4 1 #2IDATX A 1g ٻx\=/ @ 0M<^IENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata/ico/icon_16x16.png0000644000175100017510000000121115154533055023262 0ustar runnerrunnerPNG  IHDRasRGB pHYs  iTXtXML:com.adobe.xmp 4 4 1 #"IDAT8c & 􂵎0a k IENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata/ico/dmg.iconset/0000755000175100017510000000000015154533055023176 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/ico/dmg.iconset/icon_128x128.png0000644000175100017510000001221015154533055025645 0ustar runnerrunnerPNG  IHDR>aOIDATx] |WڿD"R ڎFbf|7Ӗ)ih1ZeQ6XcOX$ds}7yysk)RH"E)RH"E)RH"E)RH"E)RH"E)RH"E)R ;ϯ9sIĥ;bނh>}BKp~s/p%;Ř9siW>Zp߿{#}YB/@M+Y _r~𫿽L%44>c,%072PS/U &/@ hDA)?]h++(+(+(+x#@?RU@e/gǾfߥNgC7i,vMv5:Kw%>v_f 2VoN`-[(8|z"s=Ϣg=`#G7{YE{Ű]~3zP?  <5köD2Ok@i*@4ye/$~x%M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A%! Pk׮0P  g aÆ ۄS(l?S^k-Z[־Ch`$}B`,#Bt|k:P~V ͗=~8M2<*Th̛<}u} BeΞ㯨]31 y^,,T @baiI!\0~q|RtbCIGі>z R&/M@5v,sM֭,!ؖWC|z|vIuHVZ}9^zxu89ƌ~m8s'8'w>dȐM}Yضm۱qtA?嵛GѯI5tK܃H,UIENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata/ico/dmg.iconset/icon_32x32.png0000644000175100017510000000253615154533055025503 0ustar runnerrunnerPNG  IHDR DPLTE7E6C6C6D NNNzzz ...OOOUUU"""ppp 888bbbfffjjj]]]///ARFWHX}݉n{谢aoK[HYBŞ[jCT˥ݺO_mzTdUcÜɀތ䢏ގFVhsŪٓhuTchvK[Žbp_lWfKZÿx׽ӼιǺľftRNS )2 4 $ .372?(au#!?-X5q:>QVWZfw&(/F9L,Y%L+MkL#6"(wIDATMKqon(nP!ֱS"BK/ ЩSk.K 몳\>Cz XrN6 "[:{8+&4`I4ͿxXhuAV`1M3VHc@#bRLOAZ1, ϲ/*RG%d|5j5r^%;cxrp0\pY{ˮpB0<0Uˮ.%#y5)r̕5[5Ǿ>GSs7JF5 Ƙ48 `( dߣ0 6-{K7rc$:$=o:-Xh..Cp>zTH}jbIYJg㭾Rx4g)R☜eV٩My HٖհDUA#sAN'mDO014K}g)>^ZIENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata/ico/dmg.iconset/icon_16x16.png0000644000175100017510000000074715154533055025511 0ustar runnerrunnerPNG  IHDR(-SPLTEDUcnŹARARt~ARBSL\N]O_P_P`\j]lcocqdrkx{܇|܈Ƒʩ̮ɿ\tRNS,׆P)M!X?O&BU$ So$qF &7"ۼ0WE=Gӌ_# FN#~Xl񏘼/VG:% BH{E[A ('oG>V+'?}*.$Cwac`"Io04P+'>JI! K.YO+ əG,ĿYg_YZ_}^NB@}4fb0$_p<ʲѕrB-ҷF*fuS_g]QPE' @ [!'_`'BS{D|VxXD x_d 'YX?!'e"aU_g|gcI!)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6bj/@OPX@>ZQ+hIe\PVN +) eU*]]e^[EE+ϲWsԵћ}^'( Fu2ʧ>Sٚ0UZNU2`7VP?{z]9^{)OW;SJo}>D-n 2؊tC1WYRߕHBaFgj^RWqgh^0x}{ojO'Bp-Rš2֢J(lp3E #/{~VziAri[<`-4EgkFO{+n4zH2MSty iD1'Ͱ "/AAAAs$t3IENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata/ico/ico.qbs0000644000175100017510000000343715154533055022254 0ustar runnerrunnerProject { Product { Depends { name: "ico" } type: ["ico"] name: "icon" files: [ "icon_16x16.png", "icon_32x32.png" ] } Product { Depends { name: "ico" } type: ["ico"] name: "icon-alpha" files: [ "icon_16x16.png", "icon_32x32.png" ] ico.alphaThreshold: 50 } Product { Depends { name: "ico" } type: ["ico"] name: "icon-big" files: [ "dmg.iconset/icon_16x16.png", "dmg.iconset/icon_32x32.png", "dmg.iconset/icon_128x128.png", ] Group { name: "raw" prefix: "dmg.iconset/" files: [ "icon_256x256.png", "icon_512x512.png", ] ico.raw: true } } Product { Depends { name: "ico" } type: ["cur"] name: "cursor" files: [ "icon_16x16.png", "icon_32x32.png" ] } Product { Depends { name: "ico" } type: ["cur"] name: "cursor-hotspot" Group { files: ["icon_16x16.png"] ico.cursorHotspotX: 8 ico.cursorHotspotY: 9 } Group { files: ["icon_32x32.png"] ico.cursorHotspotX: 16 ico.cursorHotspotY: 17 } } Product { Depends { name: "ico" } type: ["cur"] name: "cursor-hotspot-single" Group { files: ["icon_16x16.png"] ico.cursorHotspotX: 8 ico.cursorHotspotY: 9 } } Product { Depends { name: "ico" } type: ["ico", "cur"] name: "iconset" files: ["dmg.iconset"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/sanitizer/0000755000175100017510000000000015154533055022222 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/sanitizer/sanitizer.qbs0000644000175100017510000000305415154533055024743 0ustar runnerrunnerCppApplication { Depends { name: "Sanitizers.address" } Sanitizers.address.enabled: sanitizer === "address" property string sanitizer property bool supportsSanitizer: { if (qbs.toolchain.includes("mingw") || qbs.toolchain.contains("emscripten")) return false; if (sanitizer === "address") return Sanitizers.address._supported; if (qbs.toolchain.includes("clang-cl")) { if (cpp.toolchainInstallPath.includes("Microsoft Visual Studio") && qbs.architecture === "x86_64") { // 32 bit sanitizer shipped with VS misses the x86_64 libraries return false; } // only these are supported return sanitizer === "address" || sanitizer === "undefined"; } if (!qbs.toolchain.includes("gcc")) return false; if (qbs.targetOS.includes("ios")) { // thread sanitizer is not supported return sanitizer !== "thread"; } return true; } condition: { if (!sanitizer) return true; if (!supportsSanitizer) console.info("Compiler does not support sanitizer"); return supportsSanitizer; } qbs.buildVariant: "release" cpp.cxxLanguageVersion: "c++11" cpp.minimumMacosVersion: "10.8" consoleApplication: true cpp.runtimeLibrary: "static" cpp.driverFlags: sanitizer && sanitizer !== "address" ? ["-fsanitize=" + sanitizer] : [] cpp.debugInformation: true files: "sanitizer.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/sanitizer/sanitizer.cpp0000644000175100017510000000006315154533055024735 0ustar runnerrunnerint main(int argc, char *argv[]) { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/disappeared-profile/0000755000175100017510000000000015154533055024131 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/disappeared-profile/in1.txt0000644000175100017510000000000015154533055025347 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/disappeared-profile/in2.txt0000644000175100017510000000000015154533055025350 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/disappeared-profile/disappeared-profile.qbs0000644000175100017510000000031715154533055030560 0ustar runnerrunnerProduct { type: ["out1", "out2"] Depends { name: "m" } Group { files: ["in1.txt"] fileTags: ["in1"] } Group { files: ["in2.txt"] fileTags: ["in2"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/disappeared-profile/modules-dir/0000755000175100017510000000000015154533055026355 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/disappeared-profile/modules-dir/modules/0000755000175100017510000000000015154533055030025 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/disappeared-profile/modules-dir/modules/m/0000755000175100017510000000000015154533055030261 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/disappeared-profile/modules-dir/modules/m/m.qbs0000644000175100017510000000143515154533055031227 0ustar runnerrunnerModule { property string p1 property string p2 Rule { inputs: ["in1"] Artifact { filePath: "dummy1.txt" fileTags: ["out1"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName + " with " + product.m.p1; cmd.sourceCode = function() {}; return [cmd]; } } Rule { inputs: ["in2"] Artifact { filePath: "dummy2.txt" fileTags: ["out2"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName + " with " + product.m.p2; cmd.sourceCode = function() {}; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates/0000755000175100017510000000000015154533055024013 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates/install-duplicates.qbs0000644000175100017510000000020715154533055030322 0ustar runnerrunnerProduct { Group { files: ["*.txt"] prefix: "**/" qbs.install: true qbs.installDir: "files" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates/dir2/0000755000175100017510000000000015154533055024653 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates/dir2/file3.txt0000644000175100017510000000001315154533055026410 0ustar runnerrunnerdir2/file3 qbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates/dir2/file1.txt0000644000175100017510000000001315154533055026406 0ustar runnerrunnerdir2/file1 qbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates/dir2/file2.txt0000644000175100017510000000001315154533055026407 0ustar runnerrunnerdir2/file2 qbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates/dir1/0000755000175100017510000000000015154533055024652 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates/dir1/file1.txt0000644000175100017510000000001315154533055026405 0ustar runnerrunnerdir1/file1 qbs-src-3.2.0/tests/auto/blackbox/testdata/install-duplicates/dir1/file2.txt0000644000175100017510000000001315154533055026406 0ustar runnerrunnerdir1/file2 qbs-src-3.2.0/tests/auto/blackbox/testdata/deprecated-property/0000755000175100017510000000000015154533055024174 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/deprecated-property/deprecated-property.qbs0000644000175100017510000000021515154533055030663 0ustar runnerrunnerProduct { Depends { name: "themodule" } themodule.newProp: true themodule.expiringProp: false themodule.veryOldProp: false } qbs-src-3.2.0/tests/auto/blackbox/testdata/deprecated-property/modules/0000755000175100017510000000000015154533055025644 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/deprecated-property/modules/themodule/0000755000175100017510000000000015154533055027632 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/deprecated-property/modules/themodule/m.qbs0000644000175100017510000000120615154533055030574 0ustar runnerrunnerimport qbs.Environment Module { property bool newProp property bool expiringProp property bool forgottenProp PropertyOptions { name: "newProp" description: "Use this, it's good!" } PropertyOptions { name: "expiringProp" description: "Use newProp instead." removalVersion: Environment.getEnv("REMOVAL_VERSION") } PropertyOptions { name: "veryOldProp" description: "Use newProp instead." removalVersion: "1.3" } PropertyOptions { name: "forgottenProp" description: "Use newProp instead." removalVersion: "1.8" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/0000755000175100017510000000000015154533055022525 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/main.cpp0000644000175100017510000000003515154533055024153 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/myapp.appdata.xml0000644000175100017510000000066515154533055026015 0ustar runnerrunner myapp.desktop CC0 MyApp The coolest app ever

This is a cool application.

https://software.house/myapp GPL-2.0+ Coding Wizard
qbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/freedesktop.qbs0000644000175100017510000000175315154533055025555 0ustar runnerrunnerProject { CppApplication { name: "main" install: true property bool dummy: { console.info("is emscripten: " + qbs.toolchain.includes("emscripten")); } files: [ "main.cpp", "myapp.desktop", "myapp.appdata.xml", ] Depends { name: "freedesktop" } freedesktop.appName: "My App" freedesktop.desktopKeys: ({ 'Icon': "myapp.png" }) freedesktop.hicolorRoot: project.sourceDirectory + "/icons/" Group { name: "hicolor" prefix: project.sourceDirectory + "/icons/" files: [ "48x48/apps/myapp.png", "48x48@2/apps/myapp.png", "64x64/apps/myapp.png", "64x64@2/apps/myapp.png", "64x64/mimetypes/application-format.png", "scalable/apps/myapp.png", ] fileTags: "freedesktop.appIcon" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/myapp.desktop0000644000175100017510000000030515154533055025244 0ustar runnerrunner[Desktop Entry] GenericName=Image Editor GenericName[fr]=Éditeur d'images Comment=Create images and edit photographs Comment[fr]=Créer des images et éditer des photographies Icon=overridden.png qbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/0000755000175100017510000000000015154533055023640 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/48x48/0000755000175100017510000000000015154533055024437 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/48x48/apps/0000755000175100017510000000000015154533055025402 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/48x48/apps/myapp.png0000644000175100017510000000000015154533055027224 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/64x64@2/0000755000175100017510000000000015154533055024615 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/64x64@2/apps/0000755000175100017510000000000015154533055025560 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/64x64@2/apps/myapp.png0000644000175100017510000000000015154533055027402 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/scalable/0000755000175100017510000000000015154533055025406 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/scalable/apps/0000755000175100017510000000000015154533055026351 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/scalable/apps/myapp.png0000644000175100017510000000000015154533055030173 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/64x64/0000755000175100017510000000000015154533055024433 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/64x64/apps/0000755000175100017510000000000015154533055025376 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/64x64/apps/myapp.png0000644000175100017510000000000015154533055027220 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/64x64/mimetypes/0000755000175100017510000000000015154533055026447 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/64x64/mimetypes/application-format.png0000644000175100017510000000000015154533055032734 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/48x48@2/0000755000175100017510000000000015154533055024621 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/48x48@2/apps/0000755000175100017510000000000015154533055025564 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/freedesktop/icons/48x48@2/apps/myapp.png0000644000175100017510000000000015154533055027406 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/retagged-output-artifact/0000755000175100017510000000000015154533055025125 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/retagged-output-artifact/retagged-output-artifact.qbs0000644000175100017510000000242715154533055032554 0ustar runnerrunnerimport qbs.File import qbs.TextFile Product { name: "p" type: "p_type" property bool useTag1 Rule { multiplex: true outputFileTags: ["tag1", "tag2"] outputArtifacts: [{filePath: "a1.txt", fileTags: product.useTag1 ? "tag1" : "tag2"}] prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.filePath; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); }; return cmd; } } Rule { inputs: "tag1" Artifact { filePath: "a2.txt"; fileTags: "p_type" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.filePath; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return cmd; } } Rule { inputs: "tag2" Artifact { filePath: "a3.txt"; fileTags: "p_type" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.filePath; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/plugin-type/0000755000175100017510000000000015154533055022467 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/plugin-type/plugin-type.qbs0000644000175100017510000000155715154533055025463 0ustar runnerrunnerProject { name: "plugin_type" property bool dummy: { const isWin = qbs.targetOS.includes("windows"); const isDarwin = qbs.targetOS.includes("darwin"); const isMac = qbs.targetOS.includes("macos"); const toolGcc = qbs.toolchain.includes("gcc") || qbs.toolchain.includes("emscripten"); console.info("is windows: " + (isWin ? "yes" : "no")); console.info("is darwin: " + (isDarwin ? "yes" : "no")); console.info("is macos: " + (isMac ? "yes" : "no")); console.info("is gcc: " + (toolGcc ? "yes" : "no")); } Plugin { Depends { name: "bundle" } Depends { name: "cpp" } name: "myplugin" files: ["plugin-type.cpp"] qbs.installPrefix: "" installDir: config.install.pluginsDirectory // enforce install static plugins bundle.isBundle: false } } qbs-src-3.2.0/tests/auto/blackbox/testdata/plugin-type/plugin-type.cpp0000644000175100017510000000010615154533055025445 0ustar runnerrunner#include "../dllexport.h" extern "C" DLL_EXPORT void pluginFunc() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/output-artifact-auto-tagging/0000755000175100017510000000000015154533055025731 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/output-artifact-auto-tagging/broken.cpp.in0000644000175100017510000000002615154533055030320 0ustar runnerrunnervoid f() { blubb(); } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/output-artifact-auto-tagging/output-artifact-auto-tagging.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/output-artifact-auto-tagging/output-artifact-auto-tagging0000644000175100017510000000176115154533055033400 0ustar runnerrunnerimport qbs.File CppApplication { consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Group { files: ["broken.cpp.in", "main.cpp.in"] fileTags: ["cpp.in"] } Rule { multiplex: true inputs: ["cpp.in"] outputFileTags: ["cpp"] outputArtifacts: [{ filePath: "main.cpp" }, { filePath: "broken.nomatch" }] prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating main.cpp"; cmd.sourceCode = function() { File.copy(product.sourceDirectory + "/main.cpp.in", product.buildDirectory + "/main.cpp"); File.copy(product.sourceDirectory + "/broken.cpp.in", product.buildDirectory + "/broken.nomatch"); }; return [cmd]; } } FileTagger { patterns: ["*.nomatch"] fileTags: ["utter nonsense"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/output-artifact-auto-tagging/main.cpp.in0000644000175100017510000000001615154533055027763 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/bom-sources/0000755000175100017510000000000015154533055022450 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/bom-sources/bom-sources.qbs0000644000175100017510000000011215154533055025407 0ustar runnerrunnerCppApplication { name: "app" files: ["main.cpp", "theheader.h"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/bom-sources/main.cpp0000644000175100017510000000005115154533055024074 0ustar runnerrunner#include "theheader.h" int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/bom-sources/theheader.h0000644000175100017510000000000015154533055024540 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/per-group-define-in-export-item/0000755000175100017510000000000015154533055026241 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/per-group-define-in-export-item/main.cpp0000644000175100017510000000004115154533055027664 0ustar runnerrunner#ifdef MAIN int main() {} #endif ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/per-group-define-in-export-item/per-group-define-in-export-item.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/per-group-define-in-export-item/per-group-define-in-expor0000644000175100017510000000045315154533055033075 0ustar runnerrunnerProject { Product { name: "dep" Export { Depends { name: "cpp" } Group { cpp.defines: ["MAIN"] files: ["main.cpp"] } } } Application { name: "app" Depends { name: "dep" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/multiplexed-tool/0000755000175100017510000000000015154533055023521 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/multiplexed-tool/multiplexed-tool.qbs0000644000175100017510000000415615154533055027545 0ustar runnerrunnerimport qbs.Host Project { CppApplication { name: "tool" targetName: { var result = name; if (qbs.buildVariant === "debug") result += "-debug"; return result; } consoleApplication: true property bool _testPlatform: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } Profile { name: "debugProfile" baseProfile: project.profile qbs.buildVariant: "debug" } Profile { name: "releaseProfile" baseProfile: project.profile qbs.buildVariant: "release" } multiplexByQbsProperties: "profiles" qbs.profiles: ["debugProfile", "releaseProfile"] files: "tool.cpp" Properties { condition: qbs.buildVariant === "debug" cpp.defines: "WRONG_VARIANT" } Export { Rule { multiplex: true inputsFromDependencies: "application" Artifact { filePath: "tool.out" fileTags: "tool.output" } prepare: { var cmd = new Command(input.filePath, []); cmd.description = "creating " + output.fileName; return cmd; } } } } Product { name: "p" type: "tool.output" multiplexByQbsProperties: "buildVariants" qbs.buildVariants: ["debug", "release"] Depends { name: "tool"; profiles: "releaseProfile" } } Product { name: "p2" type: "tool.output" multiplexByQbsProperties: "buildVariants" qbs.buildVariants: ["debug", "release"] Depends { name: "helper" } } Product { name: "helper" Export { Depends { name: "tool"; profiles: "releaseProfile" } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/multiplexed-tool/tool.cpp0000644000175100017510000000013015154533055025174 0ustar runnerrunner#include int main() { #ifdef WRONG_VARIANT return EXIT_FAILURE; #endif } qbs-src-3.2.0/tests/auto/blackbox/testdata/property-precedence/0000755000175100017510000000000015154533055024171 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/property-precedence/dep.qbs0000644000175100017510000000027615154533055025455 0ustar runnerrunnerProduct { name: "dep" Export { Depends { name: "leaf" } Depends { name: "nonleaf" } // leaf.scalarProp: "export" // leaf.listProp: ["export"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/property-precedence/dummy.txt0000644000175100017510000000000015154533055026053 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/property-precedence/modules/0000755000175100017510000000000015154533055025641 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/property-precedence/modules/nonleaf/0000755000175100017510000000000015154533055027263 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/property-precedence/modules/nonleaf/nonleaf.qbs0000644000175100017510000000015515154533055031415 0ustar runnerrunnerModule { Depends { name: "leaf" } // leaf.scalarProp: "nonleaf" // leaf.listProp: ["nonleaf"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/property-precedence/modules/leaf/0000755000175100017510000000000015154533055026550 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/property-precedence/modules/leaf/leaf.qbs0000644000175100017510000000101715154533055030165 0ustar runnerrunnerModule { property string scalarProp: "leaf" property stringList listProp: ["leaf"] Rule { inputs: ["rule-input"] outputFileTags: "rule-output" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { console.info("scalar prop: " + product.leaf.scalarProp); console.info("list prop: " + JSON.stringify(product.leaf.listProp)); } return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/property-precedence/property-precedence.qbs0000644000175100017510000000060415154533055030657 0ustar runnerrunnerProject { references: ["dep.qbs"] Product { name: "toplevel" type: ["rule-output"] Depends { name: "leaf" } Depends { name: "nonleaf" } Depends { name: "dep" } Group { files: ["dummy.txt"] fileTags: ["rule-input"] } // leaf.scalarProp: "product" // leaf.listProp: ["product"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/0000755000175100017510000000000015154533055022462 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/import-std-compat/0000755000175100017510000000000015154533055026045 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/import-std-compat/main.cpp0000644000175100017510000000023015154533055027470 0ustar runnerrunnerimport std.compat; int main() { std::cout << "Hello from std.compat!" << std::endl; printf("Using printf from std.compat\n"); return 0; }qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/import-std-compat/import-std-compat.qbs0000644000175100017510000000174515154533055032146 0ustar runnerrunner// Checks simple case with a single module. Project { CppStd { useStdCompat: true } CppApplication { name: "import-std-compat" Depends { name: "CppStd" } condition: { if (qbs.toolchainType === "msvc" || ((qbs.toolchainType === "gcc" || qbs.toolchainType === "mingw") && cpp.compilerVersionMajor >= 15) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 18)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } consoleApplication: true files: [ "main.cpp" ] cpp.cxxLanguageVersion: "c++23" cpp.forceUseCxxModules: true Properties { condition: qbs.toolchainType === "clang" cpp.cxxFlags: ["-Wno-reserved-module-identifier"] cpp.cxxStandardLibrary: "libc++" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-rec/0000755000175100017510000000000015154533055024177 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-rec/main.cpp0000644000175100017510000000005715154533055025631 0ustar runnerrunnerimport b; int main() { b_p1(); b(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-rec/b.cppm0000644000175100017510000000045515154533055025305 0ustar runnerrunner module; #include export module b; import :p2; // private partition export import :p1; // public partition import a; export void b() { b_p1(); b_p2(); std::cout << "hello from module b\n"; // these are also visible as they are public in module a a_p1(); a(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-rec/b.p2.cppm0000644000175100017510000000014515154533055025621 0ustar runnerrunner module; #include module b:p2; void b_p2() { std::cout << "hello from b.part2\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-rec/CMakeLists.txt0000644000175100017510000000077415154533055026747 0ustar runnerrunnercmake_minimum_required(VERSION 3.29) project(partitions VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) add_executable(partitions) target_sources(partitions PRIVATE FILE_SET all_my_modules TYPE CXX_MODULES BASE_DIRS ${PROJECT_SOURCE_DIR} FILES a.p1.cppm a.p2.cppm a.cppm b.p1.cppm b.p2.cppm b.cppm ) target_sources(partitions PRIVATE main.cpp ) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") target_compile_options(partitions PRIVATE "-fmodules-ts") endif() qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-rec/a.p2.cppm0000644000175100017510000000014515154533055025620 0ustar runnerrunner module; #include module a:p2; void a_p2() { std::cout << "hello from a.part2\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-rec/b.p1.cppm0000644000175100017510000000016315154533055025620 0ustar runnerrunner module; #include export module b:p1; export void b_p1() { std::cout << "hello from b.part1\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-rec/partitions-recursive.qbs0000644000175100017510000000145115154533055031110 0ustar runnerrunner// Checks two modules split into partitions, one depends on the other CppApplication { name: "part-rec" condition: { if (qbs.toolchainType === "msvc" || ((qbs.toolchainType === "gcc" || qbs.toolchainType === "mingw") && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } consoleApplication: true files: [ "a.cppm", "a.p1.cppm", "a.p2.cppm", "b.cppm", "b.p1.cppm", "b.p2.cppm", "main.cpp" ] cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-rec/a.p1.cppm0000644000175100017510000000016315154533055025617 0ustar runnerrunner module; #include export module a:p1; export void a_p1() { std::cout << "hello from a.part1\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-rec/a.cppm0000644000175100017510000000032015154533055025273 0ustar runnerrunner module; #include export module a; import :p2; // private partition export import :p1; // public partition export void a() { a_p1(); a_p2(); std::cout << "hello from module a\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/partitions/0000755000175100017510000000000015154533055024656 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/partitions/main.cpp0000644000175100017510000000006015154533055026302 0ustar runnerrunnerimport a; int main() { foo(); baz(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/partitions/CMakeLists.txt0000644000175100017510000000072515154533055027422 0ustar runnerrunnercmake_minimum_required(VERSION 3.29) project(partitions VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) add_executable(partitions) target_sources(partitions PRIVATE FILE_SET all_my_modules TYPE CXX_MODULES BASE_DIRS ${PROJECT_SOURCE_DIR} FILES a.p1.cppm a.p2.cppm a.cppm ) target_sources(partitions PRIVATE main.cpp ) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") target_compile_options(partitions PRIVATE "-fmodules-ts") endif() qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/partitions/a.p2.cppm0000644000175100017510000000014015154533055026272 0ustar runnerrunner module; #include module a:p2; void bar() { std::cout << "bar from part2\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/partitions/partitions.qbs0000644000175100017510000000127115154533055027562 0ustar runnerrunner// Checks module split into partitions CppApplication { condition: { if (qbs.toolchainType === "msvc" || ((qbs.toolchainType === "gcc" || qbs.toolchainType === "mingw") && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } consoleApplication: true files: [ "a.cppm", "a.p1.cppm", "a.p2.cppm", "main.cpp" ] cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/partitions/a.p1.cppm0000644000175100017510000000015615154533055026300 0ustar runnerrunner module; #include export module a:p1; export void foo() { std::cout << "foo from part1\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/partitions/a.cppm0000644000175100017510000000031415154533055025755 0ustar runnerrunner module; #include export module a; import :p2; // private partition export import :p1; // public partition export void baz() { foo(); bar(); std::cout << "baz from module\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-depmod/0000755000175100017510000000000015154533055024676 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-depmod/main.cpp0000644000175100017510000000004515154533055026325 0ustar runnerrunnerimport b; int main() { baz(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-depmod/b.cppm0000644000175100017510000000021615154533055025777 0ustar runnerrunner module; #include export module b; export import :p; export void baz() { bar(); std::cout << "hello from module b\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-depmod/CMakeLists.txt0000644000175100017510000000072115154533055027436 0ustar runnerrunnercmake_minimum_required(VERSION 3.29) project(partitions VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) add_executable(partitions) target_sources(partitions PRIVATE FILE_SET all_my_modules TYPE CXX_MODULES BASE_DIRS ${PROJECT_SOURCE_DIR} FILES a.cppm b.cppm b.p.cppm ) target_sources(partitions PRIVATE main.cpp ) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") target_compile_options(partitions PRIVATE "-fmodules-ts") endif() ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-depmod/partitions-dependency-on-module.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-depmod/partitions-dependency-on-module.q0000644000175100017510000000134115154533055033264 0ustar runnerrunner// Checks that module partiton can depend on other modules CppApplication { name: "part-depmod" condition: { if (qbs.toolchainType === "msvc" || ((qbs.toolchainType === "gcc" || qbs.toolchainType === "mingw") && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } consoleApplication: true files: [ "a.cppm", "b.cppm", "b.p.cppm", "main.cpp" ] cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-depmod/b.p.cppm0000644000175100017510000000020315154533055026231 0ustar runnerrunner module; #include export module b:p; import a; export void bar() { foo(); std::cout << "hello from b.p\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-depmod/a.cppm0000644000175100017510000000016015154533055025774 0ustar runnerrunner module; #include export module a; export void foo() { std::cout << "hello from module a\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/dep-mods/0000755000175100017510000000000015154533055024172 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/dep-mods/main.cpp0000644000175100017510000000004515154533055025621 0ustar runnerrunnerimport c; int main() { baz(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/dep-mods/b.cppm0000644000175100017510000000007615154533055025277 0ustar runnerrunner export module b; import a; export void bar() { foo(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/dep-mods/c.cppm0000644000175100017510000000007615154533055025300 0ustar runnerrunner export module c; import b; export void baz() { bar(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/dep-mods/CMakeLists.txt0000644000175100017510000000076215154533055026737 0ustar runnerrunnercmake_minimum_required(VERSION 3.29) project(dependent_modules VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) add_executable(dependent_modules) target_sources(dependent_modules PRIVATE FILE_SET all_my_modules TYPE CXX_MODULES BASE_DIRS ${PROJECT_SOURCE_DIR} FILES a.cppm b.cppm c.cppm ) target_sources(dependent_modules PRIVATE main.cpp ) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") target_compile_options(dependent_modules PRIVATE "-fmodules-ts") endif() qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/dep-mods/dependent-modules.qbs0000644000175100017510000000131515154533055030315 0ustar runnerrunner// check the (private) dependency chain between modules CppApplication { name: "dep-mods" condition: { if (qbs.toolchainType === "msvc" || ((qbs.toolchainType === "gcc" || qbs.toolchainType === "mingw") && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) return true; console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } consoleApplication: true files: [ "a.cppm", "b.cppm", "c.cppm", "main.cpp" ] cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/dep-mods/a.cppm0000644000175100017510000000015115154533055025270 0ustar runnerrunner module; #include export module a; export void foo() { std::cout << "Hello world!\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/decl-impl/0000755000175100017510000000000015154533055024330 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/decl-impl/main.cpp0000644000175100017510000000006015154533055025754 0ustar runnerrunnerimport helloworld; int main() { hello(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/decl-impl/declaration-implementation.qbs0000644000175100017510000000137115154533055032351 0ustar runnerrunner// Checks that module can be split into a declaration module and good old cpp implementation file CppApplication { name: "decl-impl" condition: { if (qbs.toolchainType === "msvc" || ((qbs.toolchainType === "gcc" || qbs.toolchainType === "mingw") && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } consoleApplication: true files: [ "hello.cppm", "hello.cpp", "main.cpp" ] cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/decl-impl/CMakeLists.txt0000644000175100017510000000103115154533055027063 0ustar runnerrunnercmake_minimum_required(VERSION 3.29) project(declaration_implementation VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) add_executable(declaration_implementation) target_sources(declaration_implementation PRIVATE FILE_SET all_my_modules TYPE CXX_MODULES BASE_DIRS ${PROJECT_SOURCE_DIR} FILES hello.cppm ) target_sources(declaration_implementation PRIVATE hello.cpp main.cpp ) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") target_compile_options(declaration_implementation PRIVATE "-fmodules-ts") endif() qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/decl-impl/hello.cppm0000644000175100017510000000013115154533055026307 0ustar runnerrunnerexport module helloworld; export void helloImpl(); export void hello() { helloImpl(); }qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/decl-impl/hello.cpp0000644000175100017510000000015115154533055026134 0ustar runnerrunnermodule; #include module helloworld; void helloImpl() { std::cout << "Hello world!\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/lib-mod/0000755000175100017510000000000015154533055024005 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/lib-mod/lib/0000755000175100017510000000000015154533055024553 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/lib-mod/lib/dllexport.h0000644000175100017510000000324415154533055026744 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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 DLLEXPORT_H #define DLLEXPORT_H #if defined(_WIN32) || defined(WIN32) #define DLL_EXPORT __declspec(dllexport) #define DLL_IMPORT __declspec(dllimport) #else #define DLL_EXPORT __attribute__((visibility("default"))) #define DLL_IMPORT __attribute__((visibility("default"))) #endif #ifdef LIB_STATIC #define LIB_EXPORT #else #ifdef LIB_DYNAMIC #define LIB_EXPORT DLL_EXPORT #else #define LIB_EXPORT DLL_IMPORT #endif #endif #endif // include guard qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/lib-mod/lib/hello.cppm0000644000175100017510000000022615154533055026537 0ustar runnerrunnermodule; #include "dllexport.h" #include export module helloworld; export LIB_EXPORT void hello() { std::cout << "Hello world!\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/lib-mod/library-module.qbs0000644000175100017510000000303515154533055027444 0ustar runnerrunner// Checks module in a library Project { DynamicLibrary { condition: { if (qbs.toolchainType === "msvc" || (qbs.toolchainType === "gcc" && cpp.compilerVersionMajor >= 11) // TODO: investigate why MinGW 11 fails || (qbs.toolchainType === "mingw" && cpp.compilerVersionMajor >= 13) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } name: "lib" Depends { name: "cpp" } files: [ "lib/hello.cppm", ] install: true cpp.defines: "LIB_DYNAMIC" cpp.rpaths: cpp.rpathOrigin cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true } CppApplication { condition: qbs.toolchainType === "msvc" || (qbs.toolchainType === "gcc" && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "mingw" && cpp.compilerVersionMajor >= 13) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16) consoleApplication: true name: "app" Depends { name: "lib" } files: [ "app/main.cpp" ] install: true cpp.rpaths: [cpp.rpathOrigin + "/../lib"] cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/lib-mod/CMakeLists.txt0000644000175100017510000000122215154533055026542 0ustar runnerrunnercmake_minimum_required(VERSION 3.29) project(library_module VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) add_library(library_module_lib SHARED) target_sources(library_module_lib PUBLIC FILE_SET all_my_modules TYPE CXX_MODULES BASE_DIRS ${PROJECT_SOURCE_DIR} FILES lib/hello.cppm ) add_executable(library_module_app) target_sources(library_module_app PRIVATE app/main.cpp ) target_link_libraries(library_module_app library_module_lib) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") target_compile_options(library_module_lib PRIVATE "-fmodules-ts") target_compile_options(library_module_app PRIVATE "-fmodules-ts") endif() qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/lib-mod/app/0000755000175100017510000000000015154533055024565 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/lib-mod/app/main.cpp0000644000175100017510000000006015154533055026211 0ustar runnerrunnerimport helloworld; int main() { hello(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/export-import/0000755000175100017510000000000015154533055025313 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/export-import/main.cpp0000644000175100017510000000007315154533055026743 0ustar runnerrunnerimport c; int main() { baz(); bar(); foo(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/export-import/b.cppm0000644000175100017510000000017615154533055026421 0ustar runnerrunnermodule; #include export module b; export import a; export void bar() { std::cout << "hello b" << std::endl; }qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/export-import/export-import.qbs0000644000175100017510000000140015154533055030646 0ustar runnerrunner// checks that module is re-exported. in this case, that module should be added to // module map in dependent files CppApplication { condition: { if (qbs.toolchainType === "msvc" || ((qbs.toolchainType === "gcc" || qbs.toolchainType === "mingw") && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } consoleApplication: true files: [ "a.cppm", "b.cppm", "c.cppm", "main.cpp" ] cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/export-import/c.cppm0000644000175100017510000000017615154533055026422 0ustar runnerrunnermodule; #include export module c; export import b; export void baz() { std::cout << "hello c" << std::endl; }qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/export-import/CMakeLists.txt0000644000175100017510000000073615154533055030061 0ustar runnerrunnercmake_minimum_required(VERSION 3.29) project(export_import VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) add_executable(export_import) target_sources(export_import PRIVATE FILE_SET all_my_modules TYPE CXX_MODULES BASE_DIRS ${PROJECT_SOURCE_DIR} FILES a.cppm b.cppm c.cppm ) target_sources(export_import PRIVATE main.cpp ) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") target_compile_options(export_import PRIVATE "-fmodules-ts") endif() qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/export-import/a.cppm0000644000175100017510000000014515154533055026414 0ustar runnerrunner module; #include export module a; export void foo() { std::cout << "Hello a!\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/dot-in-name/0000755000175100017510000000000015154533055024572 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/dot-in-name/main.cpp0000644000175100017510000000005315154533055026220 0ustar runnerrunnerimport a.mod; int main() { hello(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/dot-in-name/CMakeLists.txt0000644000175100017510000000070515154533055027334 0ustar runnerrunnercmake_minimum_required(VERSION 3.29) project(dot_in_name VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) add_executable(dot_in_name) target_sources(dot_in_name PRIVATE FILE_SET all_my_modules TYPE CXX_MODULES BASE_DIRS ${PROJECT_SOURCE_DIR} FILES a.module.cppm ) target_sources(dot_in_name PRIVATE main.cpp ) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") target_compile_options(dot_in_name PRIVATE "-fmodules-ts") endif() qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/dot-in-name/a.module.cppm0000644000175100017510000000015615154533055027161 0ustar runnerrunnermodule; #include export module a.mod; export void hello() { std::cout << "Hello world!\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/dot-in-name/dot-in-name.qbs0000644000175100017510000000123415154533055027411 0ustar runnerrunner// Checks that module name can contain a dot CppApplication { condition: { if (qbs.toolchainType === "msvc" || ((qbs.toolchainType === "gcc" || qbs.toolchainType === "mingw") && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } consoleApplication: true files: [ "a.module.cppm", "main.cpp" ] cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/0000755000175100017510000000000015154533055024174 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/dllexport.h0000644000175100017510000000324415154533055026365 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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 DLLEXPORT_H #define DLLEXPORT_H #if defined(_WIN32) || defined(WIN32) #define DLL_EXPORT __declspec(dllexport) #define DLL_IMPORT __declspec(dllimport) #else #define DLL_EXPORT __attribute__((visibility("default"))) #define DLL_IMPORT __attribute__((visibility("default"))) #endif #ifdef LIB_STATIC #define LIB_EXPORT #else #ifdef LIB_DYNAMIC #define LIB_EXPORT DLL_EXPORT #else #define LIB_EXPORT DLL_IMPORT #endif #endif #endif // include guard qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/lib-b/0000755000175100017510000000000015154533055025161 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/lib-b/b.cppm0000644000175100017510000000026015154533055026261 0ustar runnerrunner module; #include "../dllexport.h" #include export module b; import :p2; // private partition export import :p1; // public partition export LIB_EXPORT void b(); qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/lib-b/b.p2.cppm0000644000175100017510000000021215154533055026576 0ustar runnerrunner module; #include "../dllexport.h" #include module b:p2; LIB_EXPORT void b_p2() { std::cout << "hello from b.part2\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/lib-b/b.cpp0000644000175100017510000000035615154533055026112 0ustar runnerrunner module; #include module b; import :p1; import :p2; import a; void b() { b_p1(); b_p2(); std::cout << "hello from module b\n"; // these are also visible as they are public in module a a_p1(); a(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/lib-b/b.p1.cppm0000644000175100017510000000023015154533055026575 0ustar runnerrunner module; #include "../dllexport.h" #include export module b:p1; export LIB_EXPORT void b_p1() { std::cout << "hello from b.part1\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/app/0000755000175100017510000000000015154533055024754 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/app/main.cpp0000644000175100017510000000005715154533055026406 0ustar runnerrunnerimport b; int main() { b_p1(); b(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/lib-a/0000755000175100017510000000000015154533055025160 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/lib-a/a.p2.cppm0000644000175100017510000000021215154533055026574 0ustar runnerrunner module; #include "../dllexport.h" #include module a:p2; LIB_EXPORT void a_p2() { std::cout << "hello from a.part2\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/lib-a/a.p1.cppm0000644000175100017510000000023015154533055026573 0ustar runnerrunnermodule; #include "../dllexport.h" #include export module a:p1; export LIB_EXPORT void a_p1() { std::cout << "hello from a.part1\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/lib-a/a.cppm0000644000175100017510000000041715154533055026263 0ustar runnerrunner module; #include "../dllexport.h" #include // workaround for gcc bug export module a; import :p2; // private partition export import :p1; // public partition export LIB_EXPORT void a() { a_p1(); a_p2(); std::cout << "hello from module a\n"; }qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/part-lib/partitions-library.qbs0000644000175100017510000000550015154533055030541 0ustar runnerrunner// Checks two modules split into partitions, one depends on the other Project { DynamicLibrary { condition: { if (qbs.toolchainType === "msvc" || (qbs.toolchainType === "gcc" && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "mingw" && cpp.compilerVersionMajor >= 13) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } name: "liba" Depends { name: "cpp" } files: [ "dllexport.h", "lib-a/a.cppm", "lib-a/a.p1.cppm", "lib-a/a.p2.cppm", ] install: true cpp.defines: "LIB_DYNAMIC" cpp.rpaths: cpp.rpathOrigin cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true Depends { name: "bundle" } bundle.isBundle: false } DynamicLibrary { condition: { if (qbs.toolchainType === "msvc" || (qbs.toolchainType === "gcc" && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "mingw" && cpp.compilerVersionMajor >= 13) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) return true; console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } name: "libb" Depends { name: "cpp" } Depends { name: "liba" } files: [ "dllexport.h", "lib-b/b.cpp", "lib-b/b.cppm", "lib-b/b.p1.cppm", "lib-b/b.p2.cppm", ] install: true cpp.defines: "LIB_DYNAMIC" cpp.rpaths: cpp.rpathOrigin cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true Depends { name: "bundle" } bundle.isBundle: false } CppApplication { name: "app" condition: { if (qbs.toolchainType === "msvc" || (qbs.toolchainType === "gcc" && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "mingw" && cpp.compilerVersionMajor >= 13) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) return true; console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } Depends { name: "libb" } Depends { name: "liba" } consoleApplication: true files: [ "app/main.cpp" ] install: true cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/import-std/0000755000175100017510000000000015154533055024564 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/import-std/main.cpp0000644000175100017510000000011215154533055026206 0ustar runnerrunnerimport std; int main() { std::cout << "Hello World!" << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/import-std/import-std.qbs0000644000175100017510000000167615154533055027407 0ustar runnerrunner// Checks simple case with a single module. Project { CppStd {} CppApplication { name: "import-std" Depends { name: "CppStd" } condition: { if (qbs.toolchainType === "msvc" || ((qbs.toolchainType === "gcc" || qbs.toolchainType === "mingw") && cpp.compilerVersionMajor >= 15) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 18)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } consoleApplication: true files: [ "main.cpp" ] cpp.cxxLanguageVersion: "c++23" cpp.forceUseCxxModules: true Properties { condition: qbs.toolchainType === "clang" cpp.cxxFlags: ["-Wno-reserved-module-identifier"] cpp.cxxStandardLibrary: "libc++" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/single-mod/0000755000175100017510000000000015154533055024520 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/single-mod/single-module.qbs0000644000175100017510000000125715154533055030000 0ustar runnerrunner// Checks simple case with a single module. CppApplication { name: "single-mod" condition: { if (qbs.toolchainType === "msvc" || ((qbs.toolchainType === "gcc" || qbs.toolchainType === "mingw") && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } consoleApplication: true files: [ "hello.cppm", "main.cpp" ] cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/single-mod/main.cpp0000644000175100017510000000006015154533055026144 0ustar runnerrunnerimport helloworld; int main() { hello(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/single-mod/CMakeLists.txt0000644000175100017510000000071415154533055027262 0ustar runnerrunnercmake_minimum_required(VERSION 3.29) project(single_module VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) add_executable(single_module) target_sources(single_module PRIVATE FILE_SET all_my_modules TYPE CXX_MODULES BASE_DIRS ${PROJECT_SOURCE_DIR} FILES hello.cppm ) target_sources(single_module PRIVATE main.cpp ) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") target_compile_options(single_module PRIVATE "-fmodules-ts") endif() qbs-src-3.2.0/tests/auto/blackbox/testdata/cxx-modules/single-mod/hello.cppm0000644000175100017510000000016415154533055026505 0ustar runnerrunnermodule; #include export module helloworld; export void hello() { std::cout << "Hello world!\n"; } qbs-src-3.2.0/tests/auto/blackbox/testdata/product-in-exported-module/0000755000175100017510000000000015154533055025411 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/product-in-exported-module/product-in-exported-module.qbs0000644000175100017510000000025315154533055033317 0ustar runnerrunnerProject { Product { name: "importing" Depends { name: "dep" } } Product { name: "dep" Export { Depends { name: "m" } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/product-in-exported-module/modules/0000755000175100017510000000000015154533055027061 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/product-in-exported-module/modules/m/0000755000175100017510000000000015154533055027315 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/product-in-exported-module/modules/m/m.qbs0000644000175100017510000000016115154533055030256 0ustar runnerrunnerModule { Depends { name: "dummy"; condition: { console.info("product: " + product.name); return false; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/ld/0000755000175100017510000000000015154533055020611 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/ld/ld.qbs0000644000175100017510000000106715154533055021723 0ustar runnerrunnerProject { Library { Depends { name: "cpp" } name: "coreutils" targetName: "qbs can handle any file paths, even the crazy ones! ;)" files: ["coreutils.cpp", "coreutils.h"] Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false cpp.sonamePrefix: "@rpath" } Group { fileTagsFilter: product.type qbs.install: true } } CppApplication { Depends { name: "coreutils" } files: ["main.cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/ld/main.cpp0000644000175100017510000000253115154533055022242 0ustar runnerrunner/**************************************************************************** ** ** 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 "coreutils.h" #include int main(int argc, char *argv[]) { std::printf("%d\n", foo()); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/ld/coreutils.cpp0000644000175100017510000000242015154533055023324 0ustar runnerrunner/**************************************************************************** ** ** 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 "coreutils.h" int foo() { return 42; } qbs-src-3.2.0/tests/auto/blackbox/testdata/ld/coreutils.h0000644000175100017510000000241415154533055022774 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" DLL_EXPORT int foo(); qbs-src-3.2.0/tests/auto/blackbox/testdata/whole-archive/0000755000175100017510000000000015154533055022747 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/whole-archive/unused1.cpp0000644000175100017510000000007515154533055025041 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void unusedFunc1() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/whole-archive/dynamiclib.cpp0000644000175100017510000000012115154533055025560 0ustar runnerrunner#include "../dllexport.h" void usedFunc(); DLL_EXPORT void f() { usedFunc(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/whole-archive/main3.cpp0000644000175100017510000000013415154533055024460 0ustar runnerrunner#include "../dllexport.h" DLL_IMPORT void unusedFunc3(); int main() { unusedFunc3(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/whole-archive/main2.cpp0000644000175100017510000000013515154533055024460 0ustar runnerrunner#include "../dllexport.h" DLL_IMPORT void unusedFunc2(); int main() { unusedFunc2(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/whole-archive/whole-archive.qbs0000644000175100017510000000431015154533055026211 0ustar runnerrunnerimport qbs.Utilities Project { StaticLibrary { name: "staticlib 1" Depends { name: "cpp" } files: ["unused1.cpp", "used.cpp"] } StaticLibrary { name: "staticlib2" Depends { name: "cpp" } files: ["unused2.cpp"] } StaticLibrary { name: "staticlib3" Depends { name: "cpp" } files: ["unused3.cpp"] } StaticLibrary { name: "staticlib4" Depends { name: "cpp" } files: ["unused4.cpp"] } DynamicLibrary { name: "dynamiclib" property string linkWholeArchive Depends { name: "cpp" } Probe { id: dummy property stringList toolchain: qbs.toolchain property string compilerVersion: cpp.compilerVersion property string dummy: product.linkWholeArchive // To force probe re-execution property bool isEmscripten: qbs.toolchain.contains("emscripten") configure: { if (!toolchain.includes("msvc") || toolchain.includes("clang-cl") || Utilities.versionCompare(compilerVersion, "19.0.24215.1") >= 0) { console.info("can link whole archives"); } else { console.info("cannot link whole archives"); } console.info("is emscripten: " + isEmscripten); } } Depends { name: "staticlib 1"; cpp.linkWholeArchive: product.linkWholeArchive } Depends { name: "staticlib2"; cpp.linkWholeArchive: product.linkWholeArchive } Depends { name: "staticlib3" } Depends { name: "staticlib4"; cpp.linkWholeArchive: product.linkWholeArchive } files: ["dynamiclib.cpp"] } CppApplication { name: "app1" Depends { name: "dynamiclib" } files: ["main1.cpp"] } CppApplication { name: "app2" Depends { name: "dynamiclib" } files: ["main2.cpp"] } CppApplication { name: "app3" Depends { name: "dynamiclib" } files: ["main3.cpp"] } CppApplication { name: "app4" Depends { name: "dynamiclib" } files: ["main4.cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/whole-archive/main4.cpp0000644000175100017510000000013515154533055024462 0ustar runnerrunner#include "../dllexport.h" DLL_IMPORT void unusedFunc4(); int main() { unusedFunc4(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/whole-archive/used.cpp0000644000175100017510000000002415154533055024407 0ustar runnerrunnervoid usedFunc() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/whole-archive/unused2.cpp0000644000175100017510000000007515154533055025042 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void unusedFunc2() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/whole-archive/main1.cpp0000644000175100017510000000013515154533055024457 0ustar runnerrunner#include "../dllexport.h" DLL_IMPORT void unusedFunc1(); int main() { unusedFunc1(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/whole-archive/unused4.cpp0000644000175100017510000000007515154533055025044 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void unusedFunc4() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/whole-archive/unused3.cpp0000644000175100017510000000007515154533055025043 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT void unusedFunc3() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/output-redirection/0000755000175100017510000000000015154533055024057 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/output-redirection/output.txt0000644000175100017510000000006415154533055026160 0ustar runnerrunnerthis is a plain text file this is a plain text file qbs-src-3.2.0/tests/auto/blackbox/testdata/output-redirection/input.bin0000644000175100017510000000200015154533055025700 0ustar runnerrunnerѸvʷR'.wl >}䋂b-(OOt:e"lhėʉO*d4ќih{*͎OZӮ ;oXUlXvҁiSH+,Ģj2@dq*:gwϰ:;[KΕRV2xȊ4{xǻIGD~fsT6ma엝 cy}@9l0k/ƌnn]MxmMd8f}KJ7Dg䃟'NʠH}{ʳO|lCˡQnff] o aF}s-{$˵z2{tmT7WC) t-߈`FY`"a;cGEa^}rk\en[sƎH-zT)o4l\oUWB tOx7RR{\ZQ%jīc 垽l+v x^=PC_<';?쩭iY}]U9}.ҪYr&gxł#r/  }xzhsds-v%>[]knt5pM?a3d)Srs uxf)?kmK^pXƀ",~ Hк<YXJAx3ސ',1ﳙ6rt@`Ǧń£]I80tJsvH@puDvC`@JOh ڦdIR/t t]QJb@/rPUIpVz26ξ"Ėϴ!ëZ'xnI.H5'w/Ci\ -. @h?ٛ)Z+ÈsC2j0.8,qbs-src-3.2.0/tests/auto/blackbox/testdata/output-redirection/output.bin0000644000175100017510000000400015154533055026103 0ustar runnerrunnerѸvʷR'.wl >}䋂b-(OOt:e"lhėʉO*d4ќih{*͎OZӮ ;oXUlXvҁiSH+,Ģj2@dq*:gwϰ:;[KΕRV2xȊ4{xǻIGD~fsT6ma엝 cy}@9l0k/ƌnn]MxmMd8f}KJ7Dg䃟'NʠH}{ʳO|lCˡQnff] o aF}s-{$˵z2{tmT7WC) t-߈`FY`"a;cGEa^}rk\en[sƎH-zT)o4l\oUWB tOx7RR{\ZQ%jīc 垽l+v x^=PC_<';?쩭iY}]U9}.ҪYr&gxł#r/  }xzhsds-v%>[]knt5pM?a3d)Srs uxf)?kmK^pXƀ",~ Hк<YXJAx3ސ',1ﳙ6rt@`Ǧń£]I80tJsvH@puDvC`@JOh ڦdIR/t t]QJb@/rPUIpVz26ξ"Ėϴ!ëZ'xnI.H5'w/Ci\ -. @h?ٛ)Z+ÈsC2j0.8,ѸvʷR'.wl >}䋂b-(OOt:e"lhėʉO*d4ќih{*͎OZӮ ;oXUlXvҁiSH+,Ģj2@dq*:gwϰ:;[KΕRV2xȊ4{xǻIGD~fsT6ma엝 cy}@9l0k/ƌnn]MxmMd8f}KJ7Dg䃟'NʠH}{ʳO|lCˡQnff] o aF}s-{$˵z2{tmT7WC) t-߈`FY`"a;cGEa^}rk\en[sƎH-zT)o4l\oUWB tOx7RR{\ZQ%jīc 垽l+v x^=PC_<';?쩭iY}]U9}.ҪYr&gxł#r/  }xzhsds-v%>[]knt5pM?a3d)Srs uxf)?kmK^pXƀ",~ Hк<YXJAx3ސ',1ﳙ6rt@`Ǧń£]I80tJsvH@puDvC`@JOh ڦdIR/t t]QJb@/rPUIpVz26ξ"Ėϴ!ëZ'xnI.H5'w/Ci\ -. @h?ٛ)Z+ÈsC2j0.8,qbs-src-3.2.0/tests/auto/blackbox/testdata/output-redirection/input.txt0000644000175100017510000000003215154533055025752 0ustar runnerrunnerthis is a plain text file qbs-src-3.2.0/tests/auto/blackbox/testdata/output-redirection/output-redirection.qbs0000644000175100017510000000177715154533055030447 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host Product { name: "the-product" type: "output" Group { files: "input.bin" fileTags: "binary" } Group { files: "input.txt" fileTags: "text" } Rule { inputs: ["text", "binary"] Artifact { filePath: "output." + FileInfo.completeSuffix(input.filePath) fileTags: "output" } prepare: { var binary; var prefixArgs; if (Host.os().includes("windows")) { binary = product.qbs.windowsShellPath; prefixArgs = ["/c", "type"]; } else { binary = "cat"; prefixArgs = []; } var inputPath = FileInfo.toNativeSeparators(input.filePath); var cmd = new Command(binary, prefixArgs.concat([inputPath, inputPath])); cmd.stdoutFilePath = output.filePath; cmd.highlight = "filegen"; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-host/0000755000175100017510000000000015154533055023721 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-host/host.qbs0000644000175100017510000000236515154533055025413 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host import qbs.TextFile Product { type: ["dummy"] Rule { multiplex: true outputFileTags: "dummy" prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var output = new TextFile(FileInfo.joinPaths(product.sourceDirectory, "output.txt"), TextFile.WriteOnly); output.writeLine("architecture: " +Host.architecture()); output.writeLine("os: " + Host.os()); output.writeLine("platform: " + Host.platform()); output.writeLine("osVersion: " + Host.osVersion()); output.writeLine("osBuildVersion: " + Host.osBuildVersion()); output.writeLine("osVersionParts: " + Host.osVersionParts()); output.writeLine("osVersionMajor: " + Host.osVersionMajor()); output.writeLine("osVersionMinor: " + Host.osVersionMinor()); output.writeLine("osVersionPatch: " + Host.osVersionPatch()); output.writeLine("nullDevice: " + Host.nullDevice()); output.close(); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/external-libs/0000755000175100017510000000000015154533055022763 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/external-libs/main.cpp0000644000175100017510000000006315154533055024412 0ustar runnerrunnervoid func_lib2(); int main() { func_lib2(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/external-libs/external-libs.qbs0000644000175100017510000000162515154533055026247 0ustar runnerrunnerimport qbs.TextFile Project { property string libDir: buildDirectory + "/libs" StaticLibrary { name: "lib1" destinationDirectory: project.libDir Depends { name: "cpp" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } files: ["lib1.cpp"] } StaticLibrary { name: "lib2" destinationDirectory: project.libDir Depends { name: "cpp" } Depends { name: "lib1" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } files: ["lib2.cpp"] } CppApplication { Depends { name: "lib1"; cpp.link: false } Depends { name: "lib2"; cpp.link: false } files: ["main.cpp"] cpp.libraryPaths: [project.libDir] cpp.staticLibraries: ["lib1", "lib2", "lib1"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/external-libs/lib2.cpp0000644000175100017510000000006515154533055024320 0ustar runnerrunnervoid func_lib1(); void func_lib2() { func_lib1(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/external-libs/lib1.cpp0000644000175100017510000000002515154533055024313 0ustar runnerrunnervoid func_lib1() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/0000755000175100017510000000000015154533055022501 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/lib.qbs0000644000175100017510000000360515154533055023762 0ustar runnerrunnerimport qbs.FileInfo DynamicLibrary { name: "MyLib" multiplexByQbsProperties: ["buildVariants"] aggregate: false qbs.buildVariants: ["debug", "release"] qbs.installPrefix: project.installPrefix Depends { name: "cpp" } Depends { name: "Exporter.qbs" } Exporter.qbs.fileName: name + "_" + qbs.buildVariant + ".qbs" Exporter.qbs.excludedDependencies: ["local"] Exporter.qbs.additionalContent: " condition: qbs.buildVariant === '" + qbs.buildVariant + "'" property string headersInstallDir: "include" cpp.defines: ["MYLIB_BUILD"] cpp.variantSuffix: qbs.buildVariant === "debug" ? "d" : "" Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } files: ["mylib.cpp"] property var configuration: ({feature_x: false, feature_y: true}) Group { name: "API headers" files: ["mylib.h"] qbs.install: true qbs.installDir: headersInstallDir } install: true installImportLib: true installDir: "lib" Group { fileTagsFilter: ["Exporter.qbs.module"] qbs.install: true qbs.installDir: "qbs/modules/MyLib" } Export { Depends { name: "cpp" } property string includeDir: exportingProduct.sourceDirectory property var configuration: exportingProduct.configuration Properties { cpp.includePaths: [includeDir] cpp.dynamicLibraries: [] } Properties { condition: undefined cpp.dynamicLibraries: ["nosuchlib"] } Depends { name: "local" } local.dummy: true Properties { prefixMapping: [{ prefix: includeDir, replacement: FileInfo.joinPaths(exportingProduct.qbs.installPrefix, exportingProduct.headersInstallDir) }] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/mylib.h0000644000175100017510000000063015154533055023765 0ustar runnerrunner#if defined(_WIN32) || defined(WIN32) # define DLL_EXPORT __declspec(dllexport) # define DLL_IMPORT __declspec(dllimport) #else # define DLL_EXPORT __attribute__((visibility("default"))) # define DLL_IMPORT __attribute__((visibility("default"))) # endif #ifdef MYLIB_BUILD #define MYLIB_EXPORT DLL_EXPORT #else #define MYLIB_EXPORT DLL_IMPORT #endif namespace MyLib { MYLIB_EXPORT void f(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/consumer.cpp0000644000175100017510000000005515154533055025040 0ustar runnerrunnervoid helper(); int main() { helper(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/imports/0000755000175100017510000000000015154533055024176 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/imports/Helper2/0000755000175100017510000000000015154533055025477 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/imports/Helper2/helper2.js0000644000175100017510000000002615154533055027374 0ustar runnerrunnervar suffix = ".tool"; qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/helper.js0000644000175100017510000000005515154533055024316 0ustar runnerrunnerfunction toolInputs() { return ["cpp.in"]; } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/consumer.qbs0000644000175100017510000000162715154533055025051 0ustar runnerrunnerimport qbs.Host CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() // if cpp module is not available, we can't check the architecture && (qbs.architecture === undefined || qbs.architecture === Host.architecture()); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "consumer" qbsSearchPaths: "default/install-root/usr/qbs" property string outTag: "cpp" Depends { name: "MyLib" } Depends { name: "MyTool" } files: ["consumer.cpp"] cpp.defines: { var defs = []; if (MyLib.configuration.feature_x) defs.push("FEATURE_X"); if (MyLib.configuration.feature_y) defs.push("FEATURE_Y"); return defs; } Group { files: ["helper.cpp.in"] fileTags: ["cpp.in"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/tool.cpp0000644000175100017510000000060315154533055024161 0ustar runnerrunner#include #include int main(int argc, char *argv[]) { if (argc != 3) return EXIT_FAILURE; std::ifstream in(argv[1]); if (!in) return EXIT_FAILURE; std::ofstream out(argv[2]); if (!out) return EXIT_FAILURE; char ch; while (in.get(ch)) out.put(ch); return in.eof() && out ? EXIT_SUCCESS : EXIT_FAILURE; } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/exports-qbs.qbs0000644000175100017510000000055115154533055025500 0ustar runnerrunnerimport qbs.FileInfo Project { property string installPrefix: "/usr" qbsSearchPaths: sourceDirectory Product { name: "local" Export { property bool dummy Depends { name: "cpp" } cpp.includePaths: ["/somelocaldir/include"] } } references: ["consumer.qbs", "lib.qbs", "tool.qbs"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/mylib.cpp0000644000175100017510000000006415154533055024321 0ustar runnerrunner#include "mylib.h" namespace MyLib { void f() {} } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/tool.qbs0000644000175100017510000000327615154533055024175 0ustar runnerrunnerimport qbs.FileInfo import "helper.js" as Helper import Helper2 CppApplication { name: "MyTool" consoleApplication: true property stringList toolTags: ["MyTool.tool"] Depends { name: "Exporter.qbs" } Exporter.qbs.artifactTypes: ["installable", "blubb"] files: ["tool.cpp"] install: true qbs.installPrefix: project.installPrefix Group { files: ["helper.js"] qbs.install: true qbs.installDir: "qbs/modules/MyTool" } Group { files: ["imports/Helper2/helper2.js"] qbs.install: true qbs.installDir: "qbs/imports/Helper2" } Group { fileTagsFilter: ["application"] fileTags: toolTags } Group { fileTagsFilter: ["Exporter.qbs.module"] qbs.installDir: "qbs/modules/MyTool" } Export { property stringList toolTags: exportingProduct.toolTags property stringList outTags: [importingProduct.outTag] property var helper2Obj: Helper2 Rule { inputs: Helper.toolInputs() explicitlyDependsOnFromDependencies: toolTags outputFileTags: parent.outTags outputArtifacts: [{ filePath: FileInfo.completeBaseName(input.fileName) + product.MyTool.helper2Obj.suffix, fileTags: product.MyTool.outTags }] prepare: { var cmd = new Command(explicitlyDependsOn["MyTool.tool"][0].filePath, [input.filePath, output.filePath]); cmd.description = "compiling" + input.fileName + " to " + output.fileName; return [cmd]; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/helper.cpp.in0000644000175100017510000000026115154533055025070 0ustar runnerrunner#include #ifdef FEATURE_X #error "feature x must not be present!" #endif #ifndef FEATURE_Y #error "feature y is required!" #endif void helper() { MyLib::f(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/exports-qbs/exports-qbs-products.qbs0000644000175100017510000000000015154533055027326 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/QTBUG-51237/0000755000175100017510000000000015154533055021553 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/QTBUG-51237/qtbug-51237.qbs0000644000175100017510000000067715154533055024075 0ustar runnerrunnerProduct { type: "custom" Depends { name: "mymodule" } Rule { multiplex: true outputFileTags: ["custom"] prepare: { var theProperty = product.mymodule.theProperty; if (!theProperty) throw "Oh no!"; var dummy = new JavaScriptCommand(); dummy.silent = true; dummy.sourceCode = function() {}; return [dummy]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/QTBUG-51237/modules/0000755000175100017510000000000015154533055023223 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/QTBUG-51237/modules/mymodule/0000755000175100017510000000000015154533055025056 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/QTBUG-51237/modules/mymodule/mymodule.qbs0000644000175100017510000000016315154533055027420 0ustar runnerrunnerModule { property stringList theProperty: [] //property stringList otherProperty: theProperty.concat([]) } qbs-src-3.2.0/tests/auto/blackbox/testdata/missing-project-file/0000755000175100017510000000000015154533055024244 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/missing-project-file/project-dir/0000755000175100017510000000000015154533055026466 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/missing-project-file/project-dir/main.cpp0000644000175100017510000000001615154533055030113 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/missing-project-file/project-dir/file.cpp0000644000175100017510000000001515154533055030105 0ustar runnerrunnervoid f() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/missing-project-file/project-dir/missing-project-file.qbs0000644000175100017510000000011515154533055033224 0ustar runnerrunnerCppApplication { files: [ "file.cpp", "main.cpp" ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/missing-project-file/empty-dir/0000755000175100017510000000000015154533055026156 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/missing-project-file/empty-dir/irrelevant.txt0000644000175100017510000000000015154533055031060 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/missing-project-file/ambiguous-dir/0000755000175100017510000000000015154533055027013 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/missing-project-file/ambiguous-dir/p2.qbs0000644000175100017510000000000015154533055030031 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/missing-project-file/ambiguous-dir/p1.qbs0000644000175100017510000000000015154533055030030 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/missing-project-file/ambiguous-dir/p3.qbs0000644000175100017510000000000015154533055030032 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/loadablemodule/0000755000175100017510000000000015154533055023163 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/loadablemodule/main.cpp0000644000175100017510000000641115154533055024615 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #ifdef _WIN32 #include #define PREFIX "" #define SUFFIX ".dll" #define dlopen(path, mode) LoadLibraryA(path) #define dlsym(handle, symbol) GetProcAddress(handle, symbol) #define dlclose(handle) FreeLibrary(handle) #elif defined(__APPLE__) #define PREFIX "" #define SUFFIX ".bundle" #else #define PREFIX "lib" #define SUFFIX ".so" #endif #ifndef _WIN32 #include #endif int main() { auto lib = dlopen(PREFIX "CoolPlugIn" SUFFIX, RTLD_LAZY); if (lib) { auto fptr = dlsym(lib, "foo"); if (fptr) std::cout << "foo = " << ((int (*)(void))fptr)() << std::endl; else std::cout << "function foo not found in CoolPlugIn" << std::endl; dlclose(lib); return fptr ? 0 : 1; } else { std::cout << "CoolPlugIn not loaded" << std::endl; } return 1; } qbs-src-3.2.0/tests/auto/blackbox/testdata/loadablemodule/loadablemodule.qbs0000644000175100017510000000233515154533055026646 0ustar runnerrunnerimport qbs.Host Project { LoadableModule { Depends { name: "cpp" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } name: "CoolPlugIn" files: ["exported.cpp", "exported.h"] Group { fileTagsFilter: product.type qbs.install: true } } CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } Depends { name: "cpp" } Depends { name: "CoolPlugIn"; cpp.link: false } consoleApplication: true name: "CoolApp" files: ["main.cpp"] cpp.cxxLanguageVersion: "c++11" cpp.dynamicLibraries: [qbs.targetOS.includes("windows") ? "kernel32" : "dl"] Properties { condition: qbs.targetOS.includes("unix") && !qbs.targetOS.includes("darwin") cpp.rpaths: [cpp.rpathOrigin] } Group { fileTagsFilter: product.type qbs.install: true } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/loadablemodule/exported.cpp0000644000175100017510000000245215154533055025524 0ustar runnerrunner/**************************************************************************** ** ** 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 "exported.h" extern "C" { int foo() { return 42; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/loadablemodule/exported.h0000644000175100017510000000243715154533055025174 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" extern "C" { DLL_EXPORT int foo(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-module-definition/0000755000175100017510000000000015154533055025107 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/linker-module-definition/testlib.cpp0000644000175100017510000000314315154533055027262 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include void foo() { std::printf("foo\n"); } void bar() { std::printf("bar\n"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-module-definition/linker-module-definition.qbs0000644000175100017510000000104715154533055032515 0ustar runnerrunnerimport qbs.Host Project { CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "testapp" Depends { name: "testlib"} files: ["testapp.cpp"] } DynamicLibrary { name: "testlib" Depends { name: "cpp"} files: ["testlib.cpp", "testlib.def"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-module-definition/testapp.cpp0000644000175100017510000000312715154533055027276 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ extern void foo(); extern void bar(); int main() { foo(); bar(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/linker-module-definition/testlib.def0000644000175100017510000000002015154533055027225 0ustar runnerrunnerEXPORTS foo bar qbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-invalid-dependencies/0000755000175100017510000000000015154533055026452 5ustar runnerrunner././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-invalid-dependencies/transitive-invalid-dependencies.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-invalid-dependencies/transitive-invalid-depend0000644000175100017510000000051515154533055033447 0ustar runnerrunnerProduct { property bool modulePresent: { console.info("b.present = " + b.present); console.info("c.present = " + c.present); console.info("d.present = " + d.present); } Depends { name: "b"; required: false } Depends { name: "c"; required: false } Depends { name: "d"; required: false } } qbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-invalid-dependencies/modules/0000755000175100017510000000000015154533055030122 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-invalid-dependencies/modules/b/0000755000175100017510000000000015154533055030343 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-invalid-dependencies/modules/b/b.qbs0000644000175100017510000000004515154533055031272 0ustar runnerrunnerModule { Depends { name: "a" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-invalid-dependencies/modules/d/0000755000175100017510000000000015154533055030345 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-invalid-dependencies/modules/d/d.qbs0000644000175100017510000000010115154533055031267 0ustar runnerrunnerModule { Depends { name: "b"; } Depends { name: "c"; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-invalid-dependencies/modules/c/0000755000175100017510000000000015154533055030344 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-invalid-dependencies/modules/c/c.qbs0000644000175100017510000000006615154533055031277 0ustar runnerrunnerModule { Depends { name: "a"; required: false } } qbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-invalid-dependencies/modules/a/0000755000175100017510000000000015154533055030342 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/transitive-invalid-dependencies/modules/a/a.qbs0000644000175100017510000000011215154533055031263 0ustar runnerrunnerModule { validate: { throw "Module cannot be loaded"; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/change-in-disabled-product/0000755000175100017510000000000015154533055025266 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/change-in-disabled-product/test2.txt0000644000175100017510000000000015154533055027056 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/change-in-disabled-product/change-in-disabled-product.qbs0000644000175100017510000000014015154533055033044 0ustar runnerrunnerProduct { condition: false files: [ 'test1.txt', // 'test2.txt' ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/change-in-disabled-product/test1.txt0000644000175100017510000000000015154533055027055 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/artifact-scanning/0000755000175100017510000000000015154533055023605 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/artifact-scanning/external-indirect.h0000644000175100017510000000000015154533055027365 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/artifact-scanning/external1.h0000644000175100017510000000003715154533055025661 0ustar runnerrunner#include qbs-src-3.2.0/tests/auto/blackbox/testdata/artifact-scanning/p1.cpp0000644000175100017510000000007015154533055024626 0ustar runnerrunner#include #include int main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/artifact-scanning/p3.cpp0000644000175100017510000000004615154533055024633 0ustar runnerrunner#include int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/artifact-scanning/p2.cpp0000644000175100017510000000004415154533055024630 0ustar runnerrunner#include int main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/artifact-scanning/subdir/0000755000175100017510000000000015154533055025075 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/artifact-scanning/subdir/external2.h0000644000175100017510000000000015154533055027140 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/artifact-scanning/shared.h0000644000175100017510000000002715154533055025223 0ustar runnerrunner#include qbs-src-3.2.0/tests/auto/blackbox/testdata/artifact-scanning/artifact-scanning.qbs0000644000175100017510000000105015154533055027703 0ustar runnerrunnerProject { CppApplication { name: "p1" consoleApplication: true cpp.includePaths: ["."] files: [ "p1.cpp", "shared.h", ] } CppApplication { name: "p2" consoleApplication: true cpp.includePaths: ["."] files: [ "p2.cpp", "shared.h", ] } CppApplication { name: "p3" consoleApplication: true cpp.includePaths: [".", "subdir"] files: [ "p3.cpp", ] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/multiple-configurations/0000755000175100017510000000000015154533055025075 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/multiple-configurations/main.cpp0000644000175100017510000000005315154533055026523 0ustar runnerrunner#include int main() { f(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/multiple-configurations/file.h0000644000175100017510000000001215154533055026156 0ustar runnerrunnervoid f(); qbs-src-3.2.0/tests/auto/blackbox/testdata/multiple-configurations/multiple-configurations.qbs0000644000175100017510000000046115154533055032470 0ustar runnerrunnerProject { StaticLibrary { name: "lib" Depends { name: "cpp" } files: ["lib.cpp", "lib.h"] } CppApplication { name: "app" Depends { name: "lib" } cpp.includePaths: project.sourceDirectory files: ["file.cpp", "file.h", "main.cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/multiple-configurations/file.cpp0000644000175100017510000000005015154533055026513 0ustar runnerrunner#include void f() { l(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/multiple-configurations/lib.h0000644000175100017510000000001215154533055026005 0ustar runnerrunnervoid l(); qbs-src-3.2.0/tests/auto/blackbox/testdata/multiple-configurations/lib.cpp0000644000175100017510000000001415154533055026342 0ustar runnerrunnervoid l() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/0000755000175100017510000000000015154533055025040 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/probe-in-exported-module.qbs0000644000175100017510000000010115154533055032365 0ustar runnerrunnerProject { references: [ "dependee.qbs", "dependency.qbs" ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/dependency.qbs0000644000175100017510000000013315154533055027662 0ustar runnerrunnerProduct { name: "dependency" Export { Depends { name: "mymodule" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/test2.in0000644000175100017510000000000015154533055026417 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/test.in0000644000175100017510000000000015154533055026335 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/dependee.qbs0000644000175100017510000000042415154533055027320 0ustar runnerrunnerProduct { name: "dependee" Depends { name: "myothermodule" } Depends { name: "dependency" } type: ["out", "dep-out"] Group { files: "test.in" fileTags: ["dep-in"] } Group { files: "test2.in" fileTags: ["in"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/modules/0000755000175100017510000000000015154533055026510 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/modules/mymodule/0000755000175100017510000000000015154533055030343 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/modules/mymodule/mymodule.qbs0000644000175100017510000000113615154533055032706 0ustar runnerrunnerModule { Depends { name: "depmodule" } Probe { id: theProbe configure: { found = true; } } property bool found: theProbe.found depmodule.prop: found ? "yes" : "no" depmodule.listProp: theProbe.found ? ["my"] : [] Rule { inputs: ["in"] outputFileTags: "out" prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating out artifact"; cmd.sourceCode = function() { console.info("found: " + product.mymodule.found); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/modules/myothermodule/0000755000175100017510000000000015154533055031405 5ustar runnerrunner././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/modules/myothermodule/myothermodule.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/modules/myothermodule/myothermod0000644000175100017510000000012115154533055033511 0ustar runnerrunnerModule { Depends { name: "depmodule" } depmodule.listProp: ["myother"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/modules/depmodule/0000755000175100017510000000000015154533055030466 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/probe-in-exported-module/modules/depmodule/depmodule.qbs0000644000175100017510000000077415154533055033163 0ustar runnerrunnerModule { property string prop property stringList listProp: [] Rule { inputs: ["dep-in"] outputFileTags: "dep-out" prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating dep-out artifact"; cmd.sourceCode = function() { console.info("prop: " + product.depmodule.prop); console.info("listProp: " + product.depmodule.listProp); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/conditional-export/0000755000175100017510000000000015154533055024034 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/conditional-export/main.cpp0000644000175100017510000000243515154533055025470 0ustar runnerrunner/**************************************************************************** ** ** 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 THE_DEFINE #error "missing define" #endif int main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/conditional-export/conditional-export.qbs0000644000175100017510000000053515154533055030370 0ustar runnerrunnerProject { property bool enableExport: false Product { name: "dep" Export { condition: project.enableExport Depends { name: "cpp" } cpp.defines: ["THE_DEFINE"] } } CppApplication { name: "theProduct" Depends { name: "dep" } files: "main.cpp" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/change-in-imported-file/0000755000175100017510000000000015154533055024601 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/change-in-imported-file/test.txt0000644000175100017510000000000015154533055026307 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/change-in-imported-file/change-in-imported-file.qbs0000644000175100017510000000073115154533055031700 0ustar runnerrunnerimport "prepare.js" as PrepareHelper Product { type: ["output"] Group { files: ["test.txt"] fileTags: ["input"] } Rule { inputs: ["input"] Artifact { filePath: "dummy" fileTags: product.type } prepare: { var cmd = new JavaScriptCommand(); PrepareHelper.prepare(cmd); cmd.description = "creating output"; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/change-in-imported-file/prepare.js0000644000175100017510000000013315154533055026572 0ustar runnerrunnerfunction prepare(cmd) { cmd.sourceCode = function() { console.info("old output"); }; } qbs-src-3.2.0/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/0000755000175100017510000000000015154533055030510 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/input.txt0000644000175100017510000000001015154533055032377 0ustar runnerrunnerold.txt qbs-src-3.2.0/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/p.qbs0000644000175100017510000000300515154533055031454 0ustar runnerrunnerimport qbs.File import qbs.TextFile Product { type: ["mytype.final"] Group { files: ["input.txt"] fileTags: ["mytype.in"] } Rule { inputs: ["mytype.in"] Artifact { filePath: "output.txt" fileTags: ["mytype.out"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return [cmd]; } } Rule { inputs: ["mytype.out"] outputFileTags: ["mytype.final", "dummy"] outputArtifacts: { var file; var inFile = new TextFile(input.filePath, TextFile.ReadOnly); try { file = inFile.readLine(); if (!file) throw "no file name found"; } finally { inFile.close(); } return [ { filePath: file, fileTags: ["mytype.final"] }, { filePath: "dummy", fileTags: ["dummy"], alwaysUpdated: false } ]; } prepare: { var cmd = new JavaScriptCommand(); var output = outputs["mytype.final"][0]; cmd.description = "generating " + output.fileName; cmd.outputFilePath = output.filePath; cmd.sourceCode = function() { File.copy(input.filePath, outputFilePath); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/list-property-order/0000755000175100017510000000000015154533055024160 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-property-order/product.qbs0000644000175100017510000000040115154533055026342 0ustar runnerrunnerProduct { type: "outtype" name: "toplevel" Depends { name: "higher1" } Depends { name: "higher2" } Depends { name: "higher3" } lower.listProp: ["product"] Group { files: ["dummy.txt"] fileTags: ["intype"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/list-property-order/dummy.txt0000644000175100017510000000000015154533055026042 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-property-order/modules/0000755000175100017510000000000015154533055025630 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-property-order/modules/higher2/0000755000175100017510000000000015154533055027160 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-property-order/modules/higher2/higher2.qbs0000644000175100017510000000011115154533055031210 0ustar runnerrunnerModule { Depends { name: "lower" } lower.listProp: ["higher2"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/list-property-order/modules/higher1/0000755000175100017510000000000015154533055027157 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-property-order/modules/higher1/higher1.qbs0000644000175100017510000000011115154533055031206 0ustar runnerrunnerModule { Depends { name: "lower" } lower.listProp: ["higher1"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/list-property-order/modules/higher3/0000755000175100017510000000000015154533055027161 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-property-order/modules/higher3/higher3.qbs0000644000175100017510000000011115154533055031212 0ustar runnerrunnerModule { Depends { name: "lower" } lower.listProp: ["higher3"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/list-property-order/modules/lower/0000755000175100017510000000000015154533055026760 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/list-property-order/modules/lower/lower.qbs0000644000175100017510000000073115154533055030620 0ustar runnerrunnerModule { property stringList listProp: [ "lower" ] Rule { inputs: ["intype"] Artifact { filePath: "dummy.out" fileTags: "outtype" } prepare: { var cmd = new JavaScriptCommand(); cmd.sourceCode = function() { console.warn("listProp = " + JSON.stringify(product.lower.listProp)); }; cmd.silent = true; return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/undefined-target-platform/0000755000175100017510000000000015154533055025261 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/undefined-target-platform/undefined-target-platform.qbs0000644000175100017510000000051015154533055033033 0ustar runnerrunnerimport qbs.File import qbs.FileInfo Product { name: "undefined-target-platform" qbs.targetPlatform: undefined readonly property bool _validate: { if ((qbs.targetOS instanceof Array) && qbs.targetOS.length === 0) return true; throw "Invalid qbs.targetOS value: " + qbs.targetOS; } } qbs-src-3.2.0/tests/auto/blackbox/testdata/filetagsfilter-merging/0000755000175100017510000000000015154533055024644 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/filetagsfilter-merging/main.cpp0000644000175100017510000000001615154533055026271 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/filetagsfilter-merging/MyApplication.qbs0000644000175100017510000000031115154533055030117 0ustar runnerrunnerCppApplication { consoleApplication: true Group { fileTagsFilter: "application" qbs.install:true qbs.installPrefix: product.name qbs.installDir: "wrong" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/filetagsfilter-merging/filetagsfilter-merging.qbs0000644000175100017510000000144515154533055032011 0ustar runnerrunnerimport qbs.TextFile MyApplication { name: "myapp" type: base.concat("extra-output") property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } files: "main.cpp" Group { fileTagsFilter: "application" qbs.installDir: "binDir" fileTags: "extra-input" } Rule { inputs: "extra-input" Artifact { filePath: input.baseName + ".txt" fileTags: "extra-output" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); } return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-non-dependency/0000755000175100017510000000000015154533055025762 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-non-dependency/lib/0000755000175100017510000000000015154533055026530 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-non-dependency/lib/lib.h0000644000175100017510000000003615154533055027446 0ustar runnerrunner#pragma once void lib1_foo();qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-non-dependency/app/0000755000175100017510000000000015154533055026542 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-non-dependency/app/main.cpp0000644000175100017510000000004115154533055030165 0ustar runnerrunner#include "app.h" int main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-non-dependency/app/app.h0000644000175100017510000000002115154533055027464 0ustar runnerrunner#include "lib.h" qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-non-dependency/app/app.qbs0000644000175100017510000000014015154533055030024 0ustar runnerrunnerCppApplication { cpp.includePaths: project.sourceDirectory + "/lib" files: "main.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-non-dependency/other/0000755000175100017510000000000015154533055027103 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-non-dependency/other/other.qbs0000644000175100017510000000107715154533055030740 0ustar runnerrunnerimport qbs.TextFile Product { type: "testproduct" files: "../lib/lib.h" Rule { multiplex: true Artifact { fileTags: ["testproduct"] filePath: "fubar" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating text file"; cmd.sourceCode = function() { var tf = new TextFile(output.filePath, TextFile.WriteOnly); tf.writeLine("blubb"); tf.close(); } return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/scan-result-in-non-dependency/p.qbs0000644000175100017510000000012615154533055026727 0ustar runnerrunnerProject { references: [ "app/app.qbs", "other/other.qbs", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-install-dir/0000755000175100017510000000000015154533055024060 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-install-dir/main.cpp0000644000175100017510000000001615154533055025505 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-install-dir/invalid-install-dir.qbs0000644000175100017510000000022215154533055030431 0ustar runnerrunnerCppApplication { consoleApplication: true files: ["main.cpp"] qbs.installPrefix: "" install: true installDir: "../whatever" } qbs-src-3.2.0/tests/auto/blackbox/testdata/changed-rule-inputs/0000755000175100017510000000000015154533055024070 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/changed-rule-inputs/changed-rule-inputs.qbs0000644000175100017510000000202015154533055030447 0ustar runnerrunnerProject { Product { name: "p1" type: "p1" Rule { alwaysRun: true multiplex: true Artifact { fileTags: "p1" filePath: "p1-dummy" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() {}; return cmd; } } } Product { name: "p2" type: "p2" Depends { name: "p1" } Rule { requiresInputs: false multiplex: true inputsFromDependencies: "p1" Artifact { fileTags: "p2" filePath: "p2-dummy" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() {}; return cmd; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackProducts/0000755000175100017510000000000015154533055023042 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/trackProducts/after/0000755000175100017510000000000015154533055024143 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/trackProducts/after/trackProducts.qbs0000644000175100017510000000014715154533055027504 0ustar runnerrunnerProject { name: "trackProducts" references: ["product1.qbs", "product2.qbs", "product3.qbs"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackProducts/after/product3.qbs0000644000175100017510000000016415154533055026416 0ustar runnerrunnerProduct { Depends { name: "cpp" } type: "application" consoleApplication: true files: ["zoo.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackProducts/after/zoo.cpp0000644000175100017510000000242715154533055025463 0ustar runnerrunner/**************************************************************************** ** ** 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 int main() { std::printf("zoo\n"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackProducts/before/0000755000175100017510000000000015154533055024304 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/trackProducts/before/trackProducts.qbs0000644000175100017510000000012715154533055027643 0ustar runnerrunnerProject { name: "trackProducts" references: ["product1.qbs", "product2.qbs"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackProducts/before/product1.qbs0000644000175100017510000000016415154533055026555 0ustar runnerrunnerProduct { Depends { name: "cpp" } type: "application" consoleApplication: true files: ["foo.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackProducts/before/bar.cpp0000644000175100017510000000242715154533055025561 0ustar runnerrunner/**************************************************************************** ** ** 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 int main() { std::printf("bar\n"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackProducts/before/foo.cpp0000644000175100017510000000242715154533055025600 0ustar runnerrunner/**************************************************************************** ** ** 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 int main() { std::printf("foo\n"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/trackProducts/before/product2.qbs0000644000175100017510000000016415154533055026556 0ustar runnerrunnerProduct { Depends { name: "cpp" } type: "application" consoleApplication: true files: ["bar.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata/properties-in-export-items/0000755000175100017510000000000015154533055025450 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/properties-in-export-items/properties-in-export-items.qbs0000644000175100017510000000137215154533055033420 0ustar runnerrunnerProject { minimumQbsVersion: "1.6" Product { name: "dep" Export { property string theDefine: "" Depends { name: "cpp" } cpp.defines: [theDefine] } } Application { name: "p1" consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: "dep" } dep.theDefine: "P1" cpp.minimumMacosVersion: "10.9" files: ["main1.cpp"] } Application { name: "p2" consoleApplication: true Depends { name: "dep" } cpp.minimumMacosVersion: "10.9" Group { dep.theDefine: "P2" files: ["main2.cpp"] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/properties-in-export-items/main2.cpp0000644000175100017510000000237315154533055027167 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #ifdef P2 int main() { } #endif qbs-src-3.2.0/tests/auto/blackbox/testdata/properties-in-export-items/main1.cpp0000644000175100017510000000237315154533055027166 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #ifdef P1 int main() { } #endif qbs-src-3.2.0/tests/auto/blackbox/testdata/source-artifact-in-inputs-from-dependencies/0000755000175100017510000000000015154533055030616 5ustar runnerrunner././@LongLink0000644000000000000000000000020700000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/source-artifact-in-inputs-from-dependencies/source-artifact-in-inputs-from-dependencies.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/source-artifact-in-inputs-from-dependencies/source-artifa0000644000175100017510000000313315154533055033305 0ustar runnerrunnerimport qbs.FileInfo import qbs.TextFile Project { Product { name: "dep1" Group { files: ["header.h"] qbs.install: true qbs.installDir: "include1" } } Product { name: "dep2" Group { files: ["header.h"] qbs.install: true qbs.installDir: "include2" } } Product { name: "p" type: ["custom"] Depends { name: "dep1" } Depends { name: "dep2" } Rule { multiplex: true inputsFromDependencies: ["installable"] Artifact { filePath: "output.txt" fileTags: ["custom"] } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var tf; try { tf = new TextFile(output.filePath, TextFile.WriteOnly); var artifactList = inputs["installable"]; for (var i = 0; i < (artifactList ? artifactList.length : 0); ++i) { var artifact = artifactList[i]; tf.writeLine(FileInfo.joinPaths(artifact.qbs.installDir, artifact.fileName)); } } finally { if (tf) tf.close(); } } return [cmd]; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/source-artifact-in-inputs-from-dependencies/header.h0000644000175100017510000000000015154533055032205 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-library-names/0000755000175100017510000000000015154533055024403 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-library-names/main.cpp0000644000175100017510000000235215154533055026035 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/invalid-library-names/invalid-library-names.qbs0000644000175100017510000000046715154533055031312 0ustar runnerrunnerProject { minimumQbsVersion: "1.6" property var values: [null, undefined, 5, [], ""] property int valueIndex CppApplication { cpp.dynamicLibraries: [project.values[project.valueIndex]] cpp.staticLibraries: [project.values[project.valueIndex]] files: ["main.cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/conanfile-probe/0000755000175100017510000000000015154533055023255 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/conanfile-probe/testapp/0000755000175100017510000000000015154533055024735 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/conanfile-probe/testapp/conanfile-probe-project.qbs0000644000175100017510000000124515154533055032155 0ustar runnerrunnerimport qbs.Probes import qbs.TextFile Project { readonly property bool forceFailure: false Probes.ConanfileProbe { id: conan conanfilePath: path + "/conanfile.py" options: ({opt: "True", forceFailure: (project.forceFailure ? "True" : "False")}) settings: ({os: "AIX"}) } property var check: { var tf = new TextFile(buildDirectory + "/results.json", TextFile.WriteOnly); var o = { json: conan.json.deps_env_info["ENV_VAR"], dependencies: conan.dependencies["testlib"].libs, generatedFilesPath: conan.generatedFilesPath }; tf.write(JSON.stringify(o)); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/conanfile-probe/testapp/conanfile.py0000644000175100017510000000116715154533055027252 0ustar runnerrunnerfrom conans import ConanFile class TestApp(ConanFile): name = "testapp" description = "Our project package, to be inspected by the Qbs ConanfileProbe" license = "none" version = "6.6.6" settings = "os" options = {"opt": [True, False], "forceFailure": [True, False]} default_options = {"opt": False, "forceFailure": False} requires = "testlib/1.2.3@qbs/testing" def configure(self): assert(not self.options.forceFailure) self.options["testlib"].opt = self.options.opt def source(self): pass def build(self): pass def package(self): pass qbs-src-3.2.0/tests/auto/blackbox/testdata/conanfile-probe/testlib/0000755000175100017510000000000015154533055024723 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/conanfile-probe/testlib/conanfile.py0000644000175100017510000000111115154533055027225 0ustar runnerrunnerfrom conans import ConanFile class Testlib(ConanFile): name = "testlib" description = "Represents an arbitrary package, for instance on bintray" license = "none" version = "1.2.3" settings = "os" options = {"opt": [True, False]} default_options = {"opt": False} def source(self): pass def build(self): pass def package(self): pass def package_info(self): self.cpp_info.libs = ["testlib1","testlib2"] self.env_info.ENV_VAR = "TESTLIB_ENV_VAL" self.user_info.user_var = "testlib_user_val" qbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-race-condition/0000755000175100017510000000000015154533055025641 5ustar runnerrunner././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-race-condition/artifacts-map-race-condition.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/artifacts-map-race-condition/artifacts-map-race-condition0000644000175100017510000000437315154533055033222 0ustar runnerrunnerProduct { name: "p" type: ["custom1", "custom2", "custom3", "custom4", "custom5"] Rule { multiplex: true outputFileTags: "custom1" prepare: { var cmd = new JavaScriptCommand(); cmd.description = "reader1"; cmd.sourceCode = function() { for (var i = 0; i < 1000; ++i) { for (var t in product.artifacts) { var l = product.artifacts[t]; for (var j = 0; j < l.length; ++j) var fileName = l[j].fileName; } } }; return cmd; } } Rule { multiplex: true outputFileTags: "helper" prepare: { var cmd = new JavaScriptCommand(); cmd.description = "helper"; cmd.sourceCode = function() { }; return cmd; } } Rule { inputs: ["helper"] outputFileTags: ["custom2", "custom3", "custom4"] outputArtifacts: { console.info("writer"); var artifacts = []; for (var i = 0; i < 1000; ++i) { artifacts.push({ filePath: "dummyt1" + i, fileTags: ["custom2"] }); artifacts.push({ filePath: "dummyt2" + i, fileTags: ["custom3"] }); artifacts.push({ filePath: "dummyt3" + i, fileTags: ["custom4"] }); } return artifacts; } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "writer dummy command"; cmd.sourceCode = function() { }; return cmd; } } Rule { multiplex: true outputFileTags: "custom5" prepare: { var cmd = new JavaScriptCommand(); cmd.description = "reader2"; cmd.sourceCode = function() { for (var i = 0; i < 1000; ++i) { for (var t in product.artifacts) { var l = product.artifacts[t]; for (var j = 0; j < l.length; ++j) var fileName = l[j].fileName; } } }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-textfile/0000755000175100017510000000000015154533055024570 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/jsextensions-textfile/textfile.qbs0000644000175100017510000000300315154533055027117 0ustar runnerrunnerimport qbs.TextFile Product { type: ["dummy"] Rule { multiplex: true outputFileTags: "dummy" prepare: { var commands = []; var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var file1 = new TextFile("file1.txt", TextFile.WriteOnly); file1.write("First line.\n"); // Do not close the file to test the auto close functionality. }; commands.push(cmd); cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var file1 = new TextFile("file1.txt", TextFile.WriteOnly | TextFile.Append); file1.write("Second line.\nThird line."); file1.close(); file1 = new TextFile("file1.txt", TextFile.ReadWrite); var file2 = new TextFile("file2.txt", TextFile.WriteOnly); file2.writeLine(file1.atEof()); while (true) { var line = file1.readLine(); if (!line || line.length == 0) break; file2.writeLine(line); } file1.truncate(); file2.writeLine(file1.filePath()); file2.writeLine(file1.atEof()); file1.close(); file2.close(); }; commands.push(cmd); return commands; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/nsisDependencies/0000755000175100017510000000000015154533055023475 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/nsisDependencies/nsisDependencies.qbs0000644000175100017510000000406315154533055027472 0ustar runnerrunnerimport qbs.FileInfo import qbs.TextFile Project { property bool dummy: { console.info("is Windows: " + qbs.targetOS.includes("windows")); } NSISSetup { name: "inst" destinationDirectory: project.buildDirectory Depends { name: "app" } Depends { name: "lib" } Properties { condition: nsis.present nsis.defines: ["buildDirectory=" + FileInfo.toWindowsSeparators(project.buildDirectory)] } files: ["hello.nsi"] } Application { Depends { name: "cpp" } name: "app" files: ["main.c"] destinationDirectory: project.buildDirectory install: false } DynamicLibrary { Depends { name: "cpp" } name: "lib" files: ["main.c"] Rule { // This rule tries to provoke the installer into building too early (and the test // verifies that it does not) by causing the build of the installables to take // a lot longer. multiplex: true outputFileTags: ["c"] outputArtifacts: { var artifacts = []; for (var i = 0; i < 96; ++i) artifacts.push({ filePath: "c" + i + ".c", fileTags: ["c"] }); return artifacts; } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { for (var i = 0; i < outputs["c"].length; ++i) { var tf; try { tf = new TextFile(outputs["c"][i].filePath, TextFile.WriteOnly); tf.writeLine("int main" + i + "() { return 0; }"); } finally { if (tf) tf.close(); } } }; return [cmd]; } } destinationDirectory: project.buildDirectory install: false } } qbs-src-3.2.0/tests/auto/blackbox/testdata/nsisDependencies/main.c0000644000175100017510000000003115154533055024557 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/nsisDependencies/hello.nsi0000644000175100017510000000023115154533055025307 0ustar runnerrunnerPage directory Page instfiles Section "" SetOutPath "$INSTDIR" File "${buildDirectory}\app.exe" File "${buildDirectory}\lib.dll" SectionEnd qbs-src-3.2.0/tests/auto/blackbox/testdata/new-output-artifact/0000755000175100017510000000000015154533055024134 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/new-output-artifact/input.txt0000644000175100017510000000000015154533055026022 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/new-output-artifact/new-output-artifact.qbs0000644000175100017510000000175715154533055030577 0ustar runnerrunnerimport qbs.TextFile Product { name: "theProduct" type: ["output"] property int artifactCount: 99 Group { files: ["input.txt"] fileTags: ["input"] } qbs.installPrefix: "" Group { fileTagsFilter: product.type qbs.install: true } Rule { inputs: ["input"] outputFileTags: ["output"] outputArtifacts: { var list = []; for (var i = 0; i < product.artifactCount; ++i) list.push({ filePath: "output_" + i + ".out", fileTags: ["output"]}); return list; } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { for (var i = 0; i < outputs["output"].length; ++i) { var f = new TextFile(outputs["output"][i].filePath, TextFile.WriteOnly); f.close(); } } return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/missing-override-prefix/0000755000175100017510000000000015154533055024773 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/missing-override-prefix/missing-override-prefix.qbs0000644000175100017510000000001415154533055032256 0ustar runnerrunnerProduct { } qbs-src-3.2.0/tests/auto/blackbox/testdata/generator/0000755000175100017510000000000015154533055022200 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/generator/main.cpp0000644000175100017510000000007215154533055023627 0ustar runnerrunnervoid f1(); void f2(); int main() { f1(); f2(); } qbs-src-3.2.0/tests/auto/blackbox/testdata/generator/input.file1.txt0000644000175100017510000000001215154533055025070 0ustar runnerrunnerfile1.cpp qbs-src-3.2.0/tests/auto/blackbox/testdata/generator/input.none.txt0000644000175100017510000000000015154533055025024 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/generator/generator.qbs0000644000175100017510000000230215154533055024672 0ustar runnerrunnerimport qbs.TextFile CppApplication { name: "app" files: "main.cpp" Group { files: "input.txt" fileTags: "generator.in" } Rule { inputs: ["generator.in"] Artifact { filePath: "file1.cpp"; fileTags: ["cpp", "file1"]; alwaysUpdated: false } Artifact { filePath: "file2.cpp"; fileTags: ["cpp", "file2"]; alwaysUpdated: false } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "potentially generating files"; cmd.sourceCode = function() { var f = new TextFile(input.filePath, TextFile.ReadOnly); var content = f.readAll(); f.close(); if (content.includes("file1")) { f = new TextFile(outputs.file1[0].filePath, TextFile.WriteOnly); f.writeLine("void f1() {}"); f.close(); } if (content.includes("file2")) { f = new TextFile(outputs.file2[0].filePath, TextFile.WriteOnly); f.writeLine("void f2() {}"); f.close(); } }; return cmd; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/generator/input.file2.txt0000644000175100017510000000001215154533055025071 0ustar runnerrunnerfile2.cpp qbs-src-3.2.0/tests/auto/blackbox/testdata/generator/input.both.txt0000644000175100017510000000002415154533055025027 0ustar runnerrunnerfile1.cpp file2.cpp qbs-src-3.2.0/tests/auto/blackbox/testdata/allowed-values/0000755000175100017510000000000015154533055023136 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/allowed-values/allowed-values.qbs0000644000175100017510000000067415154533055026600 0ustar runnerrunnerProduct { Depends { name: "a" } // tests VariantValue property string prop PropertyOptions { name: "prop" description: "Some prop" allowedValues: "foo" } // tests JSValue property string prop2 // setter for otherProp property string otherProp: prop2 PropertyOptions { name: "otherProp" description: "Some other prop" allowedValues: "foo" } name: "p" } qbs-src-3.2.0/tests/auto/blackbox/testdata/allowed-values/modules/0000755000175100017510000000000015154533055024606 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/allowed-values/modules/a/0000755000175100017510000000000015154533055025026 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/allowed-values/modules/a/a.qbs0000644000175100017510000000066215154533055025761 0ustar runnerrunnerModule { // tests VariantValue property stringList prop PropertyOptions { name: "prop" description: "Some prop" allowedValues: ["foo", "bar"] } // tests JSValue property stringList prop2 // setter for otherProp property stringList otherProp: prop2 PropertyOptions { name: "otherProp" description: "Some other prop" allowedValues: ["foo", "bar"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/conflicting-property-values/0000755000175100017510000000000015154533055025670 5ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/conflicting-property-values/conflicting-property-values.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/conflicting-property-values/conflicting-property-values.q0000644000175100017510000000206115154533055033527 0ustar runnerrunnerProject { Product { name: "low" Export { property string prop: "low"; property string prop2: "low" } } Product { name: "higher1" Export { Depends { name: "low" } low.prop: "higher1" } } Product { name: "higher2" Export { Depends { name: "low" } low.prop: "higher2" } } Product { name: "highest1" Export { Depends { name: "low" } Depends { name: "higher1" } Depends { name: "higher2" } low.prop: "highest1" low.prop2: "highest" } } Product { name: "highest2" Export { Depends { name: "low" } Depends { name: "higher1" } Depends { name: "higher2" } low.prop: "highest2" low.prop2: "highest" } } Product { name: "toplevel" Depends { name: "highest1" } Depends { name: "highest2" } low.prop: name property bool dummy: { console.info("final prop value: " + low.prop); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/texttemplate/0000755000175100017510000000000015154533055022732 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/texttemplate/expected/0000755000175100017510000000000015154533055024533 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/texttemplate/expected/lalala.txt0000644000175100017510000000003015154533055026513 0ustar runnerrunnerdo re mi fa so la ti do qbs-src-3.2.0/tests/auto/blackbox/testdata/texttemplate/expected/output.txt0000644000175100017510000000021615154533055026633 0ustar runnerrunnerfoo bar baz fu bar baz foo BAR baz foo bar buzz fu BAR baz fu bar buzz fu BAR buzz fooBARbaz foo\BARbaz foo\\BARbaz foo\\\BARbaz foo${bar}baz qbs-src-3.2.0/tests/auto/blackbox/testdata/texttemplate/expected/output_at.txt0000644000175100017510000000021115154533055027312 0ustar runnerrunnerfoo bar baz fu bar baz foo BAR baz foo bar buzz fu BAR baz fu bar buzz fu BAR buzz fooBARbaz foo\BARbaz foo\\BARbaz foo\\\BARbaz foo@baz qbs-src-3.2.0/tests/auto/blackbox/testdata/texttemplate/texttemplatetest.qbs0000644000175100017510000000111715154533055027061 0ustar runnerrunnerProduct { name: "one" type: ["text"] files: ["output.txt.in"] Depends { name: "texttemplate" } texttemplate.dict: ({ foo: "fu", bar: "BAR", baz: "buzz", }) Group { files: ["cdefgabc.txt.in"] texttemplate.outputFileName: "lalala.txt" texttemplate.dict: ({ c: "do", d: "re", e: "mi", f: "fa", g: "so", a: "la", b: "ti", }) } Group { files: ["output_at.txt.in"] texttemplate.placeholder: "@@" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/texttemplate/output.txt.in0000644000175100017510000000027415154533055025443 0ustar runnerrunnerfoo bar baz ${foo} bar baz foo ${bar} baz foo bar ${baz} ${foo} ${bar} baz ${foo} bar ${baz} ${foo} ${bar} ${baz} foo${bar}baz foo\${bar}baz foo\\${bar}baz foo\\\${bar}baz foo${$}{bar}baz qbs-src-3.2.0/tests/auto/blackbox/testdata/texttemplate/output_at.txt.in0000644000175100017510000000025015154533055026121 0ustar runnerrunnerfoo bar baz @foo@ bar baz foo @bar@ baz foo bar @baz@ @foo@ @bar@ baz @foo@ bar @baz@ @foo@ @bar@ @baz@ foo@bar@baz foo\@bar@baz foo\\@bar@baz foo\\\@bar@baz foo@@@baz qbs-src-3.2.0/tests/auto/blackbox/testdata/texttemplate/cdefgabc.txt.in0000644000175100017510000000005015154533055025611 0ustar runnerrunner${c} ${d} ${e} ${f} ${g} ${a} ${b} ${c} qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/0000755000175100017510000000000015154533055022217 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/greeter_cpp.qbs0000644000175100017510000000244415154533055025231 0ustar runnerrunnerimport qbs.Host Project { CppApplication { Depends { name: "capnproto.cpp"; required: false } condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); if (!capnproto.cpp.present) console.info("capnproto is not present"); return result && capnproto.cpp.present; } name: "server" consoleApplication: true cpp.minimumMacosVersion: "10.8" // workaround for broken capnproto cpp.staticLibraries: qbs.targetOS.contains("windows") ? "Advapi32" : [] capnproto.cpp.useRpc: true files: [ "greeter.capnp", "greeter-server.cpp" ] qbs.buildVariant: "release" } CppApplication { Depends { name: "capnproto.cpp"; required: false } name: "client" consoleApplication: true capnproto.cpp.useRpc: true cpp.minimumMacosVersion: "10.8" cpp.staticLibraries: qbs.targetOS.contains("windows") ? "Advapi32" : [] files: [ "greeter.capnp", "greeter-client.cpp" ] qbs.buildVariant: "release" } } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/conanfile.txt0000644000175100017510000000012015154533055024707 0ustar runnerrunner[requires] capnproto/1.0.2 [tool_requires] capnproto/1.0.2 [generators] QbsDeps qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/capnproto_relative_import.cpp0000644000175100017510000000033515154533055030216 0ustar runnerrunner#include "bar.capnp.h" #include int main() { ::capnp::MallocMessageBuilder message; auto bar = message.initRoot(); auto foo = bar.initFoo(); foo.setStr("hello"); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/capnproto_absolute_import.qbs0000644000175100017510000000124115154533055030221 0ustar runnerrunnerimport qbs.Host CppApplication { Depends { name: "capnproto.cpp"; required: false } condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); if (!capnproto.cpp.present) console.info("capnproto is not present"); return result && capnproto.cpp.present; } cpp.minimumMacosVersion: "10.8" capnproto.cpp.importPaths: "." files: [ "baz.capnp", "capnproto_absolute_import.cpp", "imports/foo.capnp", ] qbs.buildVariant: "release" } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/baz.capnp0000644000175100017510000000021315154533055024012 0ustar runnerrunner@0xc967c84bcca70a1d; using Foo = import "/imports/foo.capnp"; struct Baz { foo @0 :Foo.Foo; # Use type "Foo" defined in foo.capnp. } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/capnproto_cpp.cpp0000644000175100017510000000027715154533055025600 0ustar runnerrunner#include "foo.capnp.h" #include int main() { ::capnp::MallocMessageBuilder message; auto foo = message.initRoot(); foo.setStr("hello"); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/imports/0000755000175100017510000000000015154533055023714 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/imports/foo.capnp0000644000175100017510000000011315154533055025515 0ustar runnerrunner@0x8a2efe67220790be; struct Foo { num @0 :UInt32; str @1 :Text; } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/capnproto_cpp.qbs0000644000175100017510000000112315154533055025572 0ustar runnerrunnerimport qbs.Host CppApplication { Depends { name: "capnproto.cpp"; required: false } condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); if (!capnproto.cpp.present) console.info("capnproto is not present"); return result && capnproto.cpp.present; } cpp.minimumMacosVersion: "10.8" files: [ "capnproto_cpp.cpp", "foo.capnp" ] qbs.buildVariant: "release" } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/bar.capnp0000644000175100017510000000020215154533055024000 0ustar runnerrunner@0xc967c84bcca70a1d; using Foo = import "foo.capnp"; struct Bar { foo @0 :Foo.Foo; # Use type "Foo" defined in foo.capnp. } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/greeter-client.cpp0000644000175100017510000000116515154533055025637 0ustar runnerrunner#include "greeter.capnp.h" #include #include int main(int argc, char *argv[]) { const char address[] = "localhost:5050"; capnp::EzRpcClient client(address); Greeter::Client greeter = client.getMain(); auto& waitScope = client.getWaitScope(); for (int i = 0; i < 2; ++i) { auto request = greeter.sayHelloRequest(); request.initRequest().setName("hello workd"); auto promise = request.send(); auto response = promise.wait(waitScope); std::cout << response.getResponse().getName().cStr() << std::endl; } return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/foo.capnp0000644000175100017510000000011315154533055024020 0ustar runnerrunner@0x8a2efe67220790be; struct Foo { num @0 :UInt32; str @1 :Text; } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/capnproto_absolute_import.cpp0000644000175100017510000000033515154533055030221 0ustar runnerrunner#include "baz.capnp.h" #include int main() { ::capnp::MallocMessageBuilder message; auto baz = message.initRoot(); auto foo = baz.initFoo(); foo.setStr("hello"); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/capnproto_relative_import.qbs0000644000175100017510000000112515154533055030217 0ustar runnerrunnerimport qbs.Host CppApplication { Depends { name: "capnproto.cpp"; required: false } condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); if (!capnproto.cpp.present) console.info("capnproto is not present"); return result && capnproto.cpp.present; } cpp.minimumMacosVersion: "10.8" files: [ "bar.capnp", "capnproto_relative_import.cpp", "foo.capnp", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/greeter.capnp0000644000175100017510000000031315154533055024674 0ustar runnerrunner@0x85150b117366d14b; struct HelloRequest { name @0 :Text; } struct HelloResponse { name @0 :Text; } interface Greeter { sayHello @0 (request: HelloRequest) -> (response: HelloResponse); } qbs-src-3.2.0/tests/auto/blackbox/testdata/capnproto/greeter-server.cpp0000644000175100017510000000130015154533055025656 0ustar runnerrunner#include "greeter.capnp.h" #include #include #include class GreeterImpl final: public Greeter::Server { public: ::kj::Promise sayHello(SayHelloContext context) override { auto response = context.getResults().initResponse(); response.setName(context.getParams().getRequest().getName()); return kj::READY_NOW; }; }; int main(int argc, char *argv[]) { const char address[] = "localhost:5050"; capnp::EzRpcServer server(kj::heap(), address); auto& waitScope = server.getWaitScope(); // Run forever, accepting connections and handling requests. kj::NEVER_DONE.wait(waitScope); } qbs-src-3.2.0/tests/auto/blackbox/testdata/subprofile-change-tracking/0000755000175100017510000000000015154533055025407 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/subprofile-change-tracking/main2.cpp0000644000175100017510000000235115154533055027122 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/subprofile-change-tracking/subprofile-change-tracking.qbs0000644000175100017510000000030615154533055033312 0ustar runnerrunnerProject { CppApplication { name: "app1"; files: ["main1.cpp"] } CppApplication { name: "app2" qbs.profiles: ["qbs-autotests-subprofile"] files: ["main2.cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata/subprofile-change-tracking/main1.cpp0000644000175100017510000000235115154533055027121 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata/imports-conflict/0000755000175100017510000000000015154533055023506 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/imports-conflict/imports-conflict.qbs0000644000175100017510000000022215154533055027505 0ustar runnerrunnerProject { Product { name: "Utils" } Product { Depends { name: "Utils" } Depends { name: "themodule" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata/imports-conflict/modules/0000755000175100017510000000000015154533055025156 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/imports-conflict/modules/themodule/0000755000175100017510000000000015154533055027144 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/imports-conflict/modules/themodule/utils.js0000644000175100017510000000005615154533055030643 0ustar runnerrunnerfunction helper() { console.info("helper"); } qbs-src-3.2.0/tests/auto/blackbox/testdata/imports-conflict/modules/themodule/m.qbs0000644000175100017510000000011115154533055030100 0ustar runnerrunnerimport "utils.js" as Utils Module { validate: { Utils.helper(); } } qbs-src-3.2.0/tests/auto/blackbox/testdata/non-broken-files-in-broken-product/0000755000175100017510000000000015154533055026722 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata/non-broken-files-in-broken-product/broken.cpp0000644000175100017510000000000715154533055030703 0ustar runnerrunnerbroken qbs-src-3.2.0/tests/auto/blackbox/testdata/non-broken-files-in-broken-product/fine.cpp0000644000175100017510000000235115154533055030350 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} ././@LongLink0000644000000000000000000000016500000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata/non-broken-files-in-broken-product/non-broken-files-in-broken-product.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata/non-broken-files-in-broken-product/non-broken-files-in-br0000644000175100017510000000012615154533055033021 0ustar runnerrunnerCppApplication { consoleApplication: true files: ["fine.cpp", "broken.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/0000755000175100017510000000000015154533055022144 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-application/0000755000175100017510000000000015154533055026472 5ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-application/one-object-application.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-application/one-object-application.q0000644000175100017510000000015515154533055033203 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { files: ["main.c"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-application/main.c0000644000175100017510000000004115154533055027555 0ustar runnerrunnerint main(void) { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/BareMetalApplication.qbs0000644000175100017510000000153315154533055026675 0ustar runnerrunnerimport qbs.Host BareMetalProduct { type: "application" consoleApplication: true property bool dummy: { if (qbs.targetPlatform !== Host.platform() || qbs.architecture !== Host.architecture()) { function supportsCrossRun() { // We can run 32 bit applications on 64 bit Windows. if (Host.platform() === "windows" && Host.architecture() === "x86_64" && qbs.targetPlatform === "windows" && qbs.architecture === "x86") { return true; } } if (!supportsCrossRun()) console.info("target platform/arch differ from host platform/arch") } } Group { condition: qbs.toolchain.includes("cosmic") files: "cosmic.lkf" fileTags: "linkerscript" } } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/linker-map/0000755000175100017510000000000015154533055024203 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/linker-map/main.c0000644000175100017510000000004115154533055025266 0ustar runnerrunnerint main(void) { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/linker-map/linker-map.qbs0000644000175100017510000000033215154533055026747 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { property bool dummy: { console.info("linker map suffix: %%" + cpp.linkerMapSuffix + "%%"); } files: ["main.c"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-include-paths/0000755000175100017510000000000015154533055026514 5ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-include-paths/compiler-include-paths.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-include-paths/compiler-include-paths.q0000644000175100017510000000036715154533055033254 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { files: ["main.c"] property bool dummy: { console.info("compilerIncludePaths: %%" + cpp.compilerIncludePaths + "%%"); return true; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-include-paths/main.c0000644000175100017510000000004115154533055027577 0ustar runnerrunnerint main(void) { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/BareMetalProduct.qbs0000644000175100017510000001275615154533055026063 0ustar runnerrunnerProduct { Depends { name: "cpp" } cpp.positionIndependentCode: false Properties { condition: qbs.toolchain.includes("iar") && qbs.architecture === "stm8" cpp.driverLinkerFlags: [ "--config_def", "_CSTACK_SIZE=0x100", "--config_def", "_HEAP_SIZE=0x100", ] } Properties { condition: qbs.toolchain.includes("iar") && qbs.architecture === "rl78" cpp.driverLinkerFlags: [ "--config_def", "_NEAR_HEAP_SIZE=256", "--config_def", "_FAR_HEAP_SIZE=4096", "--config_def", "_HUGE_HEAP_SIZE=0", "--config_def", "_STACK_SIZE=128", "--config_def", "_NEAR_CONST_LOCATION_SIZE=0x6F00", "--config_def", "_NEAR_CONST_LOCATION_START=0x3000", "--define_symbol", "_NEAR_CONST_LOCATION=0", "--config", cpp.toolchainInstallPath + "/../config/lnkrl78_s3.icf" ] } Properties { condition: qbs.toolchain.includes("iar") && qbs.architecture === "rh850" cpp.driverLinkerFlags: [ "--config_def", "CSTACK_SIZE=0x1000", "--config_def", "HEAP_SIZE=0x1000", "--config", cpp.toolchainInstallPath + "/../config/lnkrh850_g3m.icf" ] } Properties { condition: qbs.toolchain.includes("iar") && qbs.architecture === "v850" cpp.driverLinkerFlags: [ "-D_CSTACK_SIZE=1000", "-D_HEAP_SIZE=1000", "-f", cpp.toolchainInstallPath + "/../config/lnk85.xcl" ] } Properties { condition: qbs.toolchain.includes("iar") && qbs.architecture === "78k" cpp.commonCompilerFlags: [ "--core", "78k0", "--code_model", "standard" ] cpp.driverLinkerFlags: [ "-D_CSTACK_SIZE=80", "-D_HEAP_SIZE=200", "-D_CODEBANK_START=0", "-D_CODEBANK_END=0", "-D_CODEBANK_BANKS=0", "-f", cpp.toolchainInstallPath + "/../config/lnk.xcl", cpp.toolchainInstallPath + "/../lib/clib/cl78ks1.r26" ] } Properties { condition: qbs.toolchain.includes("iar") && qbs.architecture === "sh" cpp.driverLinkerFlags: [ "--config_def", "_CSTACK_SIZE=0x800", "--config_def", "_HEAP_SIZE=0x800", "--config_def", "_INT_TABLE=0x10", "--config", cpp.toolchainInstallPath + "/../config/generic.icf" ] } Properties { condition: qbs.toolchain.includes("iar") && qbs.architecture === "hcs8" cpp.driverLinkerFlags: [ "-D_CSTACK_SIZE=200", "-D_HEAP_SIZE=200", "-f", cpp.toolchainInstallPath + "/../config/lnkunspecifieds08.xcl" ] } Properties { condition: qbs.toolchain.includes("iar") && qbs.architecture === "m32c" cpp.driverLinkerFlags: [ "-D_CSTACK_SIZE=100", "-D_NEAR_HEAP_SIZE=400", "-D_FAR_HEAP_SIZE=400", "-D_HUGE_HEAP_SIZE=400", "-D_ISTACK_SIZE=40", "-f", cpp.toolchainInstallPath + "/../config/lnkm32c.xcl", cpp.toolchainInstallPath + (qbs.debugInformation ? "/../lib/dlib/dlm32cnf.r48" : "/../lib/clib/clm32cf.r48") ] } Properties { condition: qbs.toolchain.includes("iar") && qbs.architecture === "riscv" cpp.driverLinkerFlags: [ "--config_def", "CSTACK_SIZE=0x1000", "--config_def", "HEAP_SIZE=0x1000" ] } Properties { condition: qbs.toolchain.includes("iar") && qbs.architecture === "m68k" cpp.cFlags: [ "--no_div" ] cpp.driverLinkerFlags: [ "-D__FLASHBEGIN=0", "-D__FLASHEND=1FFFF", "-D__RAMBEGIN=800000", "-D__RAMEND=803FFF", "-D_CSTACK_SIZE=200", "-D_HEAP_SIZE=1000", "-D_VBR_ADDRESS=0", "-f", cpp.toolchainInstallPath + "/../config/lnkm51ac128.xcl", cpp.toolchainInstallPath + "/../lib/dlcfcffdn.r68" ] } Properties { condition: qbs.toolchain.includes("keil") && qbs.architecture.startsWith("arm") && cpp.compilerName.startsWith("armcc") cpp.assemblerFlags: ["--cpu", "cortex-m0"] cpp.commonCompilerFlags: ["--cpu", "cortex-m0"] } Properties { condition: qbs.toolchain.includes("keil") && qbs.architecture.startsWith("arm") && cpp.compilerName.startsWith("armclang") cpp.assemblerFlags: ["--cpu", "cortex-m0"] cpp.commonCompilerFlags: ["-mcpu=cortex-m0", "--target=arm-arm-none-eabi"] } Properties { condition: qbs.toolchain.includes("gcc") && qbs.architecture.startsWith("arm") cpp.driverFlags: ["-specs=nosys.specs"] } Properties { condition: qbs.toolchain.includes("gcc") && qbs.architecture === "xtensa" cpp.driverFlags: ["-nostdlib"] } Properties { condition: qbs.toolchain.includes("gcc") && qbs.architecture === "msp430" cpp.driverFlags: ["-mmcu=msp430f5529", "-nostdlib"] } Properties { condition: qbs.toolchain.includes("gcc") && qbs.architecture === "m32r" cpp.driverFlags: ["-nostdlib"] } Properties { condition: qbs.toolchain.includes("gcc") && qbs.architecture === "riscv" cpp.driverFlags: ["-nostdlib"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/0000755000175100017510000000000015154533055027250 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m16c-iar.s0000644000175100017510000000013615154533055030753 0ustar runnerrunner PUBLIC main RSEG CODE:CODE:REORDER:NOROOT(0) main: MOV.W #0x0, R0 RTS END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/stm8-iar.s0000644000175100017510000000015715154533055031103 0ustar runnerrunner PUBLIC main SECTION `.near_func.text`:CODE:REORDER:NOROOT(0) CODE main: CLRW X RET END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/mcs51-sdcc.s0000644000175100017510000000020215154533055031270 0ustar runnerrunner .globl main .area PSEG (PAG,XDATA) .area XSEG (XDATA) .area HOME (CODE) main: mov dptr, #0x0000 ret qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/xtensa-gcc.s0000644000175100017510000000031715154533055031471 0ustar runnerrunner .global main .type main, @function main: addi sp, sp, -16 s32i.n a15, sp, 12 mov.n a15, sp movi.n a2, 0 mov.n sp, a15 l32i.n a15, sp, 12 addi sp, sp, 16 ret.n qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/avr32-iar.s0000644000175100017510000000015315154533055031141 0ustar runnerrunner PUBLIC main RSEG CODE32:CODE:REORDER:NOROOT(2) CODE main: MOV R12, 0x0 RET R12 END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/arm-iar.s0000644000175100017510000000015115154533055030761 0ustar runnerrunner PUBLIC main SECTION `.text`:CODE:NOROOT(1) THUMB main: MOVS R0, #+0 BX LR END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/mcs51-keil.s0000644000175100017510000000024715154533055031311 0ustar runnerrunnerPUBLIC main MAIN_SEG SEGMENT CODE RSEG MAIN_SEG main: MOV R6, #0x0 MOV R7, #0x0 RET END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m68k-iar.s0000644000175100017510000000012115154533055030764 0ustar runnerrunner PUBLIC main RSEG FCODE:CODE:NOROOT(1) main: CLR.L D0 RTS END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/stm8-sdcc.s0000644000175100017510000000012715154533055031241 0ustar runnerrunner .globl main .area DATA .area SSEG .area HOME main: clrw x ret qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/rx-iar.s0000644000175100017510000000011415154533055030632 0ustar runnerrunner PUBLIC _main SECTION CODE:CODE:ROOT(2) _main: BRA _main END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/msp430-gcc.s0000644000175100017510000000011715154533055031213 0ustar runnerrunner .global main .type main, %function main: mov #0, r15 .LIRD0: qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/v850-gcc.s0000644000175100017510000000027015154533055030667 0ustar runnerrunner .global _main .type _main, @function _main: add -4, sp st.w r29, 0[sp] mov sp, r29 mov 0, r10 mov r29, sp ld.w 0[sp], r29 add 4, sp jmp [r31] qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/cr16-iar.s0000644000175100017510000000013115154533055030753 0ustar runnerrunner PUBLIC main RSEG CODE:CODE:NOROOT(0) main: MOVW $0, R0 JUMP (RA) END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs12-iar.s0000644000175100017510000000014115154533055031121 0ustar runnerrunner PUBLIC main RSEG CODE:CODE:REORDER:NOROOT(0) main: CLRB CLRA RTS END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/v850-iar.s0000644000175100017510000000014615154533055030710 0ustar runnerrunner PUBLIC _main RSEG `CODE`:CODE:NOROOT(2) CODE _main: MOV zero, r1 JMP [lp] END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/avr32-gcc.s0000644000175100017510000000021215154533055031116 0ustar runnerrunner .global main .type main, @function main: stm --sp, r7, lr mov r7, sp mov r8, 0 mov r12, r8 ldm sp++, r7, pc qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs8-sdcc.s0000644000175100017510000000012515154533055031211 0ustar runnerrunner .globl main .area DSEG (PAG) .area HOME (CODE) main: clra tax qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/stm8-cosmic.s0000644000175100017510000000014315154533055031600 0ustar runnerrunner scross off _main: .dcall "2,0,_main" ret .scheck _main xdef _main end qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m32r-gcc.s0000644000175100017510000000020015154533055030741 0ustar runnerrunner .global main .type main, @function main: push fp mv fp, sp ldi r4, #0 mv r0, r4 pop fp jmp lr qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m68k-cosmic.s0000644000175100017510000000010115154533055031464 0ustar runnerrunner_main: .dcall "8,0,_main" rts xdef _main end qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m32c-iar.s0000644000175100017510000000013615154533055030751 0ustar runnerrunner PUBLIC main RSEG CODE:CODE:REORDER:NOROOT(0) main: MOV.W #0x0, R0 RTS END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/rh850-iar.s0000644000175100017510000000015115154533055031050 0ustar runnerrunner PUBLIC _main SECTION `.text`:CODE:NOROOT(2) CODE _main: MOV r0, r10 JMP [lp] END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/rl78-iar.s0000644000175100017510000000014015154533055030774 0ustar runnerrunner PUBLIC _main SECTION `.text`:CODE:NOROOT(0) CODE _main: CLRW AX RET END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/riscv-gcc.s0000644000175100017510000000026415154533055031316 0ustar runnerrunner .globl main .type main, @function main: add sp, sp, -16 sd s0, 8(sp) add s0, sp, 16 li a5, 0 mv a0, a5 ld s0, 8(sp) add sp, sp, 16 jr ra qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/rx-gcc.s0000644000175100017510000000021615154533055030616 0ustar runnerrunner .global _main .type _main, @function _main: push.l r10 mov.L r0, r10 mov.L #0, r5 mov.L r5, r1 rtsd #4, r10-r10 qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/arm-keil.s0000644000175100017510000000016515154533055031137 0ustar runnerrunner THUMB AREA ||.text||, CODE, READONLY, ALIGN = 1 main PROC MOVS r0, #0 BX lr ENDP END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/riscv-iar.s0000644000175100017510000000015315154533055031332 0ustar runnerrunner PUBLIC main SECTION `.text`:CODE:REORDER:NOROOT(2) CODE main: MV A0, ZERO RET END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/arm-gcc.s0000644000175100017510000000011515154533055030742 0ustar runnerrunner .global main .type main, %function main: mov r0, #0 bx lr qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs8-cosmic.s0000644000175100017510000000010115154533055031544 0ustar runnerrunner_main: .dcall "2,0,_main" rts xdef _main end qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m32c-gcc.s0000644000175100017510000000011715154533055030731 0ustar runnerrunner .global _main .type _main, @function _main: mov.w #0, r0 rts qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/msp430-iar.s0000644000175100017510000000014115154533055031227 0ustar runnerrunner PUBLIC main RSEG `CODE`:CODE:REORDER:NOROOT(1) main: MOV.W #0x0, R12 RET END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs12-cosmic.s0000644000175100017510000000010115154533055031617 0ustar runnerrunner_main: .dcall "2,0,_main" rts xdef _main end qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/c166-keil.s0000644000175100017510000000023415154533055031034 0ustar runnerrunnerMAIN_SEG SECTION CODE WORD 'NCODE' main PROC NEAR MOV R4, #0 RET main ENDP MAIN_SEG ENDS END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/r32c-iar.s0000644000175100017510000000020215154533055030750 0ustar runnerrunner PUBLIC main RSEG CODE24:CODE:REORDER:NOROOT(0) main: MOV.L:Z #0x0, R2R0 RTS RSEG SBREF:DATA:NOROOT(0) END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/mcs51-iar.s0000644000175100017510000000015615154533055031137 0ustar runnerrunner PUBLIC main RSEG NEAR_CODE:CODE:NOROOT(0) main: MOV R2, #0x0 MOV R3, #0x0 RET END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/rl78-gcc.s0000644000175100017510000000023715154533055030764 0ustar runnerrunnerr8 = 0xffef0 .text .global _main .type _main, @function _main: subw sp, #2 clrw ax movw [sp], ax movw r8, ax addw sp, #2 ret qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/arm-cosmic.s0000644000175100017510000000010315154533055031460 0ustar runnerrunner_main: movs r0, #0 bx lr xdef _main end ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-appli0000644000175100017510000001037115154533055033103 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { condition: { if (qbs.toolchainType === "cosmic") { if (qbs.architecture.startsWith("arm")) return true; if (qbs.architecture === "stm8") return true; if (qbs.architecture === "hcs8") return true; if (qbs.architecture === "hcs12") return true; if (qbs.architecture === "m68k") return true; } else if (qbs.toolchainType === "keil") { if (qbs.architecture.startsWith("arm")) return true; if (qbs.architecture === "mcs51") return true; if (qbs.architecture === "mcs251") return true; if (qbs.architecture === "c166") return true; } else if (qbs.toolchainType === "iar") { if (qbs.architecture.startsWith("arm")) return true; if (qbs.architecture === "mcs51") return true; if (qbs.architecture === "stm8") return true; if (qbs.architecture === "avr") return true; if (qbs.architecture === "avr32") return true; if (qbs.architecture === "msp430") return true; if (qbs.architecture === "rl78") return true; if (qbs.architecture === "rh850") return true; if (qbs.architecture === "v850") return true; if (qbs.architecture === "78k") return true; if (qbs.architecture === "r32c") return true; if (qbs.architecture === "sh") return true; if (qbs.architecture === "cr16") return true; if (qbs.architecture === "m16c") return true; if (qbs.architecture === "hcs8") return true; if (qbs.architecture === "hcs12") return true; if (qbs.architecture === "rx") return true; if (qbs.architecture === "m32c") return true; if (qbs.architecture === "riscv") return true; if (qbs.architecture === "m68k") return true; } else if (qbs.toolchainType === "sdcc") { if (qbs.architecture === "mcs51") return true; if (qbs.architecture === "stm8") return true; if (qbs.architecture === "hcs8") return true; } else if (qbs.toolchainType === "gcc") { if (qbs.architecture.startsWith("arm")) return true; if (qbs.architecture === "avr") return true; if (qbs.architecture === "avr32") return true; if (qbs.architecture === "msp430") return true; if (qbs.architecture === "xtensa") return true; if (qbs.architecture === "rl78") return true; if (qbs.architecture === "m32c") return true; if (qbs.architecture === "m32r") return true; if (qbs.architecture === "m68k") return true; if (qbs.architecture === "v850") return true; if (qbs.architecture === "riscv") return true; if (qbs.architecture === "rx") return true; } console.info("unsupported toolset: %%" + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%"); return false; } Properties { condition: qbs.toolchainType === "gcc" && qbs.architecture === "msp430" // We need to use this workaround to enable // the cpp.driverFlags property. cpp.linkerPath: cpp.compilerPathByLanguage["c"] } Properties { condition: qbs.toolchainType === "iar" && qbs.architecture.startsWith("arm") cpp.entryPoint: "main" } files: [(qbs.architecture.startsWith("arm") ? "arm" : qbs.architecture) + "-" + qbs.toolchainType + ".s"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/hcs8-iar.s0000644000175100017510000000014015154533055031045 0ustar runnerrunner PUBLIC main RSEG CODE:CODE:REORDER:NOROOT(0) main: LDHX #0x0000 RTS END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/sh-iar.s0000644000175100017510000000015415154533055030617 0ustar runnerrunner PUBLIC _main SECTION `.code32.text`:CODE:NOROOT(2) _main: CODE MOV #0, R0 RTS/N END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/avr-iar.s0000644000175100017510000000014115154533055030771 0ustar runnerrunner PUBLIC main RSEG CODE:CODE:NOROOT(1) main: LDI R16, 0 LDI R17, 0 RET END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/mcs251-keil.s0000644000175100017510000000024115154533055031365 0ustar runnerrunnerPUBLIC main MAIN_SEG SEGMENT CODE RSEG MAIN_SEG main PROC XRL WR6,WR6 RET ENDP END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/avr-gcc.s0000644000175100017510000000013115154533055030751 0ustar runnerrunner .global main .type main, %function main: ldi r24, 0 ldi r25, 0 ret qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/78k-iar.s0000644000175100017510000000012315154533055030612 0ustar runnerrunner PUBLIC main RSEG CODE:CODE:NOROOT(0) main: MOVW AX, #0 RET END qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m68k-gcc.s0000644000175100017510000000015115154533055030750 0ustar runnerrunner .global main .type main, @function main: link.w %fp, #0 clr.l %d0 unlk %fp rts qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/cosmic.lkf0000644000175100017510000000000315154533055024110 0ustar runnerrunner@* qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/external-static-libraries/0000755000175100017510000000000015154533055027225 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/external-static-libraries/lib-b.c0000644000175100017510000000006515154533055030357 0ustar runnerrunnerextern int a(void); int b(void) { return a(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/external-static-libraries/lib-a.c0000644000175100017510000000003615154533055030354 0ustar runnerrunnerint a(void) { return 0; } ././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/external-static-libraries/external-static-libraries.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/external-static-libraries/external-static-libra0000644000175100017510000000213215154533055033344 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication import "../BareMetalStaticLibrary.qbs" as BareMetalStaticLibrary Project { property string outputLibrariesDirectory: buildDirectory + "/libs" BareMetalStaticLibrary { name: "lib-a" destinationDirectory: project.outputLibrariesDirectory Depends { name: "cpp" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } files: ["lib-a.c"] } BareMetalStaticLibrary { name: "lib-b" destinationDirectory: project.outputLibrariesDirectory Depends { name: "cpp" } Depends { name: "lib-a" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } files: ["lib-b.c"] } BareMetalApplication { Depends { name: "lib-a"; cpp.link: false } Depends { name: "lib-b"; cpp.link: false } files: ["main.c"] cpp.libraryPaths: [project.outputLibrariesDirectory] cpp.staticLibraries: ["lib-b", "lib-a"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/external-static-libraries/main.c0000644000175100017510000000006415154533055030315 0ustar runnerrunnerextern int b(); int main(void) { return b(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/user-include-paths/0000755000175100017510000000000015154533055025660 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/user-include-paths/user-include-paths.qbs0000644000175100017510000000022215154533055032077 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { files: ["main.c"] cpp.includePaths: ["foo", "bar"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/user-include-paths/foo/0000755000175100017510000000000015154533055026443 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/user-include-paths/foo/foo.h0000644000175100017510000000010215154533055027370 0ustar runnerrunner#ifndef FOO_H #define FOO_H #define FOO_VALUE 1 #endif // FOO_H qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/user-include-paths/main.c0000644000175100017510000000013015154533055026742 0ustar runnerrunner#include "foo.h" #include "bar.h" int main(void) { return FOO_VALUE - BAR_VALUE; } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/user-include-paths/bar/0000755000175100017510000000000015154533055026424 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/user-include-paths/bar/bar.h0000644000175100017510000000010215154533055027332 0ustar runnerrunner#ifndef BAR_H #define BAR_H #define BAR_VALUE 1 #endif // BAR_H qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/toolchain-probe/0000755000175100017510000000000015154533055025231 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/toolchain-probe/toolchain-probe.qbs0000644000175100017510000000016615154533055031030 0ustar runnerrunnerProject { references: [ "probes/dmc.qbs", "probes/sdcc.qbs", "probes/watcom.qbs", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/toolchain-probe/probes/0000755000175100017510000000000015154533055026523 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/toolchain-probe/probes/dmc.qbs0000644000175100017510000000164415154533055030002 0ustar runnerrunnerimport qbs.Probes Product { id: product condition: qbs.toolchainType === "dmc" Depends { name: "cpp" } Probes.DmcProbe { id: probe compilerFilePath: cpp.compilerPath enableDefinesByLanguage: cpp.enableCompilerDefinesByLanguage _targetPlatform: qbs.targetPlatform _targetArchitecture: qbs.architecture _targetExtender: cpp.extenderName } property bool dummy: { if (!product.condition) return; if (!probe.found || !probe.compilerDefinesByLanguage || !probe.includePaths || (probe.includePaths.length === 0) || (qbs.architecture !== probe.architecture) || (qbs.targetPlatform !== probe.targetPlatform)) { console.info("broken probe: %%" + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%"); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/toolchain-probe/probes/sdcc.qbs0000644000175100017510000000146615154533055030155 0ustar runnerrunnerimport qbs.Probes Product { id: product condition: qbs.toolchainType === "sdcc" Depends { name: "cpp" } Probes.SdccProbe { id: probe compilerFilePath: cpp.compilerPath enableDefinesByLanguage: cpp.enableCompilerDefinesByLanguage preferredArchitecture: qbs.architecture } property bool dummy: { if (!product.condition) return; if (!probe.found || !probe.endianness || !probe.compilerDefinesByLanguage || !probe.includePaths || (probe.includePaths.length === 0) || (qbs.architecture !== probe.architecture)) { console.info("broken probe: %%" + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%"); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/toolchain-probe/probes/watcom.qbs0000644000175100017510000000206515154533055030527 0ustar runnerrunnerimport qbs.Probes Product { id: product condition: qbs.toolchainType === "watcom" Depends { name: "cpp" } Probes.WatcomProbe { id: probe compilerFilePath: cpp.compilerPath enableDefinesByLanguage: cpp.enableCompilerDefinesByLanguage _pathListSeparator: qbs.pathListSeparator _toolchainInstallPath: cpp.toolchainInstallPath _targetPlatform: qbs.targetPlatform _targetArchitecture: qbs.architecture } property bool dummy: { if (!product.condition) return; if (!probe.found || !probe.endianness || !probe.compilerDefinesByLanguage || !probe.environment || !probe.includePaths || (probe.includePaths.length === 0) || (qbs.architecture !== probe.architecture) || (qbs.targetPlatform !== probe.targetPlatform)) { console.info("broken probe: %%" + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%"); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-listing/0000755000175100017510000000000015154533055025425 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-listing/compiler-listing.qbs0000644000175100017510000000070615154533055031420 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { condition: { if (!qbs.toolchain.includes("gcc")) { console.info("compiler listing suffix: %%" + cpp.compilerListingSuffix + "%%"); return true; } console.info("unsupported toolset: %%" + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%"); return false; } files: ["main.c", "fun.c"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-listing/fun.c0000644000175100017510000000003615154533055026360 0ustar runnerrunnerint f(void) { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-listing/main.c0000644000175100017510000000007015154533055026512 0ustar runnerrunnerextern int f(void); int main(void) { return f(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/BareMetalStaticLibrary.qbs0000644000175100017510000000005715154533055027206 0ustar runnerrunnerBareMetalProduct { type: "staticlibrary" } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/target-platform/0000755000175100017510000000000015154533055025254 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/target-platform/target-platform.qbs0000644000175100017510000000132215154533055031071 0ustar runnerrunnerProduct { Depends { name: "cpp" } condition: { if (qbs.toolchainType === "keil" || qbs.toolchainType === "iar" || qbs.toolchainType === "sdcc" || qbs.toolchainType === "cosmic") { var hasNoPlatform = (qbs.targetPlatform === "none"); var hasNoOS = (qbs.targetOS.length === 1 && qbs.targetOS[0] === "none"); console.info("has no platform: " + hasNoPlatform); console.info("has no os: " + hasNoOS); } else { console.info("unsupported toolset: %%" + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%"); return false; } return true; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/system-include-paths/0000755000175100017510000000000015154533055026226 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/system-include-paths/system-include-paths.qbs0000644000175100017510000000023015154533055033012 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { files: ["main.c"] cpp.systemIncludePaths: ["foo", "bar"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/system-include-paths/foo/0000755000175100017510000000000015154533055027011 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/system-include-paths/foo/foo.h0000644000175100017510000000010215154533055027736 0ustar runnerrunner#ifndef FOO_H #define FOO_H #define FOO_VALUE 1 #endif // FOO_H qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/system-include-paths/main.c0000644000175100017510000000013015154533055027310 0ustar runnerrunner#include #include int main(void) { return FOO_VALUE - BAR_VALUE; } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/system-include-paths/bar/0000755000175100017510000000000015154533055026772 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/system-include-paths/bar/bar.h0000644000175100017510000000010215154533055027700 0ustar runnerrunner#ifndef BAR_H #define BAR_H #define BAR_VALUE 1 #endif // BAR_H qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/two-object-application/0000755000175100017510000000000015154533055026522 5ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/two-object-application/two-object-application.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/two-object-application/two-object-application.q0000644000175100017510000000016615154533055033265 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { files: ["main.c", "fun.c"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/two-object-application/fun.c0000644000175100017510000000003615154533055027455 0ustar runnerrunnerint f(void) { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/two-object-application/main.c0000644000175100017510000000007015154533055027607 0ustar runnerrunnerextern int f(void); int main(void) { return f(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/distribution-include-paths/0000755000175100017510000000000015154533055027421 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/distribution-include-paths/foo/0000755000175100017510000000000015154533055030204 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/distribution-include-paths/foo/foo.h0000644000175100017510000000010215154533055031131 0ustar runnerrunner#ifndef FOO_H #define FOO_H #define FOO_VALUE 1 #endif // FOO_H qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/distribution-include-paths/main.c0000644000175100017510000000013015154533055030503 0ustar runnerrunner#include #include int main(void) { return FOO_VALUE - BAR_VALUE; } ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/distribution-include-paths/distribution-include-paths.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/distribution-include-paths/distribution-include0000644000175100017510000000023615154533055033505 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { files: ["main.c"] cpp.distributionIncludePaths: ["foo", "bar"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/distribution-include-paths/bar/0000755000175100017510000000000015154533055030165 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/distribution-include-paths/bar/bar.h0000644000175100017510000000010215154533055031073 0ustar runnerrunner#ifndef BAR_H #define BAR_H #define BAR_VALUE 1 #endif // BAR_H qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/static-library-dependencies/0000755000175100017510000000000015154533055027521 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/static-library-dependencies/b.c0000644000175100017510000000006715154533055030111 0ustar runnerrunnerextern int a1(void); int b(void) { return a1(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/static-library-dependencies/app.c0000644000175100017510000000007015154533055030442 0ustar runnerrunnerextern int e(void); int main(void) { return e(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/static-library-dependencies/d.c0000644000175100017510000000011715154533055030107 0ustar runnerrunnerextern int b(void); extern int c(void); int d(void) { return b() + c(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/static-library-dependencies/a2.c0000644000175100017510000000003715154533055030167 0ustar runnerrunnerint a2(void) { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/static-library-dependencies/c.c0000644000175100017510000000006715154533055030112 0ustar runnerrunnerextern int a2(void); int c(void) { return a2(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/static-library-dependencies/e.c0000644000175100017510000000006615154533055030113 0ustar runnerrunnerextern int d(void); int e(void) { return d(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/static-library-dependencies/a1.c0000644000175100017510000000003715154533055030166 0ustar runnerrunnerint a1(void) { return 0; } ././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/static-library-dependencies/static-library-dependencies.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/static-library-dependencies/static-library-depe0000644000175100017510000000173615154533055033317 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication import "../BareMetalStaticLibrary.qbs" as BareMetalStaticLibrary Project { BareMetalStaticLibrary { name: "lib-a" Depends { name: "cpp" } files: ["a1.c", "a2.c"] } BareMetalStaticLibrary { name: "lib-b" Depends { name: "cpp" } Depends { name: "lib-a" } files: ["b.c"] } BareMetalStaticLibrary { name: "lib-c" Depends { name: "cpp" } Depends { name: "lib-a" } files: ["c.c"] } BareMetalStaticLibrary { name: "lib-d" Depends { name: "cpp" } Depends { name: "lib-b" } Depends { name: "lib-c" } files: ["d.c"] } BareMetalStaticLibrary { name: "lib-e" Depends { name: "cpp" } Depends { name: "lib-d" } files: ["e.c"] } BareMetalApplication { name: "app" Depends { name: "lib-e" } files: ["app.c"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/0000755000175100017510000000000015154533055027562 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/app.c0000644000175100017510000000004115154533055030501 0ustar runnerrunnerint main(void) { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/cpptest.cpp0000644000175100017510000000000015154533055031736 0ustar runnerrunner././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/compiler-defines-by-language.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/compiler-defines-b0000644000175100017510000000550715154533055033160 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication Project { property bool supportsCpp: { if (qbs.toolchain.includes("cosmic")) return false; if (qbs.toolchain.includes("sdcc")) return false; if (qbs.toolchain.includes("keil")) { if (qbs.architecture === "mcs51" || qbs.architecture === "mcs251" || qbs.architecture === "c166") { return false; } } return true; } BareMetalApplication { name: "c_language" files: ["app.c", "ctest.c"] cpp.enableCompilerDefinesByLanguage: [] property var foo: { if (!cpp.compilerDefinesByLanguage) throw "ASSERT cpp.compilerDefinesByLanguage: " + cpp.compilerDefinesByLanguage; if (!cpp.compilerDefinesByLanguage["c"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"c\"]: " + cpp.compilerDefinesByLanguage["c"]; if (cpp.compilerDefinesByLanguage["cpp"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"cpp\"]: " + cpp.compilerDefinesByLanguage["cpp"]; } } BareMetalApplication { condition: supportsCpp name: "cpp_language" files: ["app.c", "cpptest.cpp"] cpp.enableCompilerDefinesByLanguage: ["cpp"] cpp.enableExceptions: false property var foo: { if (!cpp.compilerDefinesByLanguage) throw "ASSERT cpp.compilerDefinesByLanguage: " + cpp.compilerDefinesByLanguage; if (cpp.compilerDefinesByLanguage["c"]) throw "ASSERT !cpp.compilerDefinesByLanguage[\"c\"]: " + cpp.compilerDefinesByLanguage["c"]; if (!cpp.compilerDefinesByLanguage["cpp"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"cpp\"]: " + cpp.compilerDefinesByLanguage["cpp"]; } } BareMetalApplication { condition: supportsCpp name: "c_and_cpp_language" files: ["app.c", "ctest.c", "cpptest.cpp"] cpp.enableCompilerDefinesByLanguage: ["c", "cpp"] cpp.enableExceptions: false property var foo: { if (!cpp.compilerDefinesByLanguage) throw "ASSERT cpp.compilerDefinesByLanguage: " + cpp.compilerDefinesByLanguage; if (!cpp.compilerDefinesByLanguage["c"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"c\"]: " + cpp.compilerDefinesByLanguage["c"]; if (!cpp.compilerDefinesByLanguage["cpp"]) throw "ASSERT cpp.compilerDefinesByLanguage[\"cpp\"]: " + cpp.compilerDefinesByLanguage["cpp"]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/compiler-defines-by-language/ctest.c0000644000175100017510000000000015154533055031036 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/preinclude-headers/0000755000175100017510000000000015154533055025707 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/preinclude-headers/preinclude.h0000644000175100017510000000013615154533055030212 0ustar runnerrunner#ifndef PREINCLUDE_H #define PREINCLUDE_H #define PREINCLUDE_VALUE 0 #endif // PREINCLUDE_H qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/preinclude-headers/preinclude-headers.qbs0000644000175100017510000000107115154533055032160 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { condition: { if (qbs.toolchainType === "keil") { if (qbs.architecture === "mcs51" || qbs.architecture === "mcs251" || qbs.architecture === "c166") { console.info("unsupported toolset: %%" + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%"); return false; } } return true; } cpp.prefixHeaders: ["preinclude.h"] files: ["main.c"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/preinclude-headers/main.c0000644000175100017510000000006015154533055026773 0ustar runnerrunnerint main(void) { return PREINCLUDE_VALUE; } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/defines/0000755000175100017510000000000015154533055023561 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/defines/defines.qbs0000644000175100017510000000021515154533055025703 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication BareMetalApplication { cpp.defines: ["FOO", "BAR"] files: ["main.c"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/defines/main.c0000644000175100017510000000016015154533055024646 0ustar runnerrunner#ifndef FOO #error FOO missing! #endif #ifndef BAR #error BAR missing! #endif int main(void) { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/shared-libraries/0000755000175100017510000000000015154533055025364 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/shared-libraries/app.c0000644000175100017510000000022715154533055026311 0ustar runnerrunner#include "../dllexport.h" #include DLL_IMPORT void foo(void); int main(void) { printf("Hello from app\n"); foo(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/shared-libraries/shared-libraries.qbs0000644000175100017510000000140115154533055031307 0ustar runnerrunnerimport "../BareMetalApplication.qbs" as BareMetalApplication Project { condition: { if (qbs.targetPlatform === "windows" && qbs.architecture === "x86") { if (qbs.toolchainType === "watcom") return true; if (qbs.toolchainType === "dmc") return true; } if (qbs.toolchainType === "msvc") return true; console.info("unsupported toolset: %%" + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%"); return false; } DynamicLibrary { Depends { name: "cpp" } name: "shared" files: ["shared.c"] } BareMetalApplication { Depends { name: "shared" } name: "app" files: ["app.c"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-baremetal/shared-libraries/shared.c0000644000175100017510000000047715154533055027006 0ustar runnerrunner#include "../dllexport.h" #include #ifdef __DMC__ #include #define EXPORT_FUN _export BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) { return TRUE; } #else #define EXPORT_FUN #endif // __DMC__ DLL_EXPORT void EXPORT_FUN foo(void) { printf("Hello from lib\n"); } qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxproviders.cpp0000644000175100017510000005144515154533055023533 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "tst_blackboxproviders.h" #include "../shared.h" #define WAIT_FOR_NEW_TIMESTAMP() waitForNewTimestamp(testDataDir) TestBlackboxProviders::TestBlackboxProviders() : TestBlackboxBase(SRCDIR "/testdata-providers", "blackbox-providers") { } void TestBlackboxProviders::allowedValues() { QFETCH(QStringList, arguments); QFETCH(bool, expectFailure); QDir::setCurrent(testDataDir + "/allowed-values"); rmDirR(relativeBuildDir()); QbsRunParameters params; params.arguments = arguments; params.expectFailure = expectFailure; QVERIFY2(runQbs(params) == int(expectFailure), m_qbsStderr); } void TestBlackboxProviders::allowedValues_data() { QTest::addColumn("arguments"); QTest::addColumn("expectFailure"); QTest::newRow("invalid js value") << QStringList{} << true; QTest::newRow("invalid variant value") << QStringList{"moduleProviders.provider.aProperty:three"} << true; QTest::newRow("valid variant value") << QStringList{"moduleProviders.provider.aProperty:one"} << false; } void TestBlackboxProviders::brokenProvider() { QDir::setCurrent(testDataDir + "/broken-provider"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY(m_qbsStderr.contains("Error executing provider for module 'qbsothermodule'")); QVERIFY(m_qbsStderr.contains("Error executing provider for module 'qbsmetatestmodule'")); QCOMPARE(m_qbsStderr.count("This provider is broken"), 2); } void TestBlackboxProviders::conanProvider() { QFETCH(bool, generateConanFiles); QFETCH(bool, successExpected); const auto executable = findExecutable({"conan"}); if (executable.isEmpty()) QSKIP("conan is not installed or not available in PATH."); const auto conanVersion = this->conanVersion(executable); if (!conanVersion.isValid()) QSKIP("Can't get conan version."); if (compare(conanVersion, qbs::Version(2, 6)) < 0) QSKIP("This test apples only to conan 2.6 and newer."); const auto profilePath = QDir::homePath() + "/.conan2/profiles/qbs-test"; if (!QFileInfo(profilePath).exists()) QSKIP("conan profile is not installed, run './scripts/setup-conan-profiles.sh'."); // install testlibdep first QProcess conan; QDir::setCurrent(testDataDir + "/conan-provider/testlibdep"); conan.start(executable, {"create", ".", "--profile:all=qbs-test"}); QVERIFY(waitForProcessSuccess(conan)); // install testlib second QDir::setCurrent(testDataDir + "/conan-provider/testlib"); conan.start(executable, {"create", ".", "--profile:all=qbs-test"}); QVERIFY(waitForProcessSuccess(conan)); // install header lib third QDir::setCurrent(testDataDir + "/conan-provider/testlibheader"); conan.start(executable, {"create", ".", "--profile:all=qbs-test"}); QVERIFY(waitForProcessSuccess(conan)); // install lib-order-test QDir::setCurrent(testDataDir + "/conan-provider/lib-order-test"); conan.start(executable, {"create", ".", "--profile:all=qbs-test"}); QVERIFY(waitForProcessSuccess(conan)); // now build an app using those libs QDir::setCurrent(testDataDir + "/conan-provider"); rmDirR(relativeBuildDir()); rmDirR("build"); if (generateConanFiles) { QStringList arguments{ "install", ".", "-g=QbsDeps", "--profile:all=qbs-test", "--output-folder=build"}; QProcess conan; conan.start(executable, arguments); QVERIFY(waitForProcessSuccess(conan)); } QbsRunParameters buildParams( "build", {"--force-probe-execution", "moduleProviders.conan.installDirectory:" + QDir::currentPath() + "/build"}); buildParams.expectFailure = !successExpected; QCOMPARE(runQbs(buildParams) == 0, successExpected); } void TestBlackboxProviders::conanProvider_data() { QTest::addColumn("generateConanFiles"); QTest::addColumn("successExpected"); QTest::addRow("no conan files generated") << false << false; QTest::addRow("conan files generated") << true << true; } void TestBlackboxProviders::conanFileProbe() { const auto executable = findExecutable({"conan"}); if (executable.isEmpty()) QSKIP("conan is not installed or not available in PATH."); const auto conanVersion = this->conanVersion(executable); if (!conanVersion.isValid()) QSKIP("Can't get conan version."); if (compare(conanVersion, qbs::Version(2, 6)) < 0) QSKIP("This test apples only to conan 2.6 and newer."); const auto profilePath = QDir::homePath() + "/.conan2/profiles/qbs-test"; if (!QFileInfo(profilePath).exists()) QSKIP("conan profile is not installed, run './scripts/setup-conan-profiles.sh'."); // install testlib QProcess conan; QDir::setCurrent(testDataDir + "/conanfile-probe/testlib"); conan.start(executable, {"create", ".", "--profile:all=qbs-test"}); QVERIFY(waitForProcessSuccess(conan)); // now build an app QDir::setCurrent(testDataDir + "/conanfile-probe"); QCOMPARE(runQbs(QbsRunParameters{"resolve"}), 0); QCOMPARE(runQbs(QbsRunParameters{"build"}), 0); } void TestBlackboxProviders::moduleProviders() { QDir::setCurrent(testDataDir + "/module-providers"); // Resolving in dry-run mode must not leave any data behind. QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(m_qbsStdout.count("Running setup script for mygenerator"), 2); QVERIFY(!QFile::exists(relativeBuildDir())); // Initial build. QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app1"})), 0); QVERIFY(QFile::exists(relativeBuildDir())); QCOMPARE(m_qbsStdout.count("Running setup script for mygenerator"), 2); QVERIFY2(m_qbsStdout.contains("The letters are A and B"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("The MY_DEFINE is app1"), m_qbsStdout.constData()); QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app2"})), 0); QVERIFY2(m_qbsStdout.contains("The letters are Z and Y"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("The MY_DEFINE is app2"), m_qbsStdout.constData()); // Rebuild with overridden module provider config. The output for product 2 must change, // but no setup script must be re-run, because both config values have already been // handled in the first run. const QStringList resolveArgs("moduleProviders.mygenerator.chooseLettersFrom:beginning"); QCOMPARE(runQbs(QbsRunParameters("resolve", resolveArgs)), 0); QVERIFY2(!m_qbsStdout.contains("Running setup script"), m_qbsStdout.constData()); QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app1"})), 0); QVERIFY2(m_qbsStdout.contains("The letters are A and B"), m_qbsStdout.constData()); QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app2"})), 0); QVERIFY2(m_qbsStdout.contains("The letters are A and B"), m_qbsStdout.constData()); // Forcing Probe execution triggers a re-run of the setup script. But only once, // because the module provider config is the same now. QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList(resolveArgs) << "--force-probe-execution")), 0); QCOMPARE(m_qbsStdout.count("Running setup script for mygenerator"), 1); QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app1"})), 0); QVERIFY2(m_qbsStdout.contains("The letters are A and B"), m_qbsStdout.constData()); QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app2"})), 0); QVERIFY2(m_qbsStdout.contains("The letters are A and B"), m_qbsStdout.constData()); // Now re-run without the module provider config override. Again, the setup script must // run once, for the config value that was not present in the last run. QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); QCOMPARE(m_qbsStdout.count("Running setup script for mygenerator"), 1); QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app1"})), 0); QVERIFY2(m_qbsStdout.contains("The letters are A and B"), m_qbsStdout.constData()); QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app2"})), 0); QVERIFY2(m_qbsStdout.contains("The letters are Z and Y"), m_qbsStdout.constData()); } // Checks regression - when loading 2 modules from the same provider, the second module should // come from provider cache void TestBlackboxProviders::moduleProvidersCache() { QDir::setCurrent(testDataDir + "/module-providers-cache"); QbsRunParameters params("resolve", {"-v"}); QCOMPARE(runQbs(params), 0); const auto qbsmetatestmoduleMessage = "Re-checking for module \"qbsmetatestmodule\" with " "newly added search paths from module provider"; const auto qbsothermoduleMessage = "Re-checking for module \"qbsothermodule\" with " "newly added search paths from module provider"; QCOMPARE(m_qbsStderr.count(qbsmetatestmoduleMessage), 1); QCOMPARE(m_qbsStderr.count(qbsothermoduleMessage), 1); QCOMPARE(m_qbsStderr.count("Re-using provider \"provider_a\" from cache"), 1); // We didn't change providers, so both modules should come from cache. params.arguments << "project.dummyProp:value"; QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStderr.count(qbsmetatestmoduleMessage), 1); QCOMPARE(m_qbsStderr.count(qbsothermoduleMessage), 1); QCOMPARE(m_qbsStderr.count("Re-using provider \"provider_a\" from cache"), 2); } void TestBlackboxProviders::nonEagerModuleProvider() { QDir::setCurrent(testDataDir + "/non-eager-provider"); QbsRunParameters params("resolve"); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains(("Running setup script for qbsmetatestmodule")), m_qbsStdout); QVERIFY2(m_qbsStdout.contains(("Running setup script for qbsothermodule")), m_qbsStdout); QVERIFY2(!m_qbsStdout.contains(("Running setup script for nonexistentmodule")), m_qbsStdout); QVERIFY2(m_qbsStdout.contains(("p1.qbsmetatestmodule.prop: from_provider_a")), m_qbsStdout); QVERIFY2(m_qbsStdout.contains(("p1.qbsothermodule.prop: from_provider_a")), m_qbsStdout); } void TestBlackboxProviders::probeInModuleProvider() { QDir::setCurrent(testDataDir + "/probe-in-module-provider"); QbsRunParameters params; params.command = "build"; params.arguments << "--force-probe-execution"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("Running probe"), m_qbsStdout); QVERIFY2(m_qbsStdout.contains("p.qbsmetatestmodule.boolProp: true"), m_qbsStdout); WAIT_FOR_NEW_TIMESTAMP(); touch("probe-in-module-provider.qbs"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("p.qbsmetatestmodule.boolProp: true"), m_qbsStdout); QVERIFY2(m_qbsStdout.contains("p.qbsmetatestmodule.prop: \"value\""), m_qbsStdout); QVERIFY2(!m_qbsStdout.contains("Running probe"), m_qbsStdout); } void TestBlackboxProviders::providersCondition() { QDir::setCurrent(testDataDir + "/providers-condition"); QbsRunParameters params("resolve"); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("p1.qbsmetatestmodule.prop: from_provider_a"), m_qbsStdout); QVERIFY2(m_qbsStdout.contains(("p1.qbsothermodule.prop: from_provider_b")), m_qbsStdout); } void TestBlackboxProviders::providersConditionProbes() { QDir::setCurrent(testDataDir + "/providers-condition-probes"); QbsRunParameters params("resolve"); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("p1.qbsmetatestmodule.prop: from_provider_a"), m_qbsStdout); QVERIFY2(m_qbsStdout.contains(("p1.qbsothermodule.prop: from_provider_b")), m_qbsStdout); } // Tests whether it is possible to set providers properties in a Product or from command-line void TestBlackboxProviders::providersProperties() { QDir::setCurrent(testDataDir + "/providers-properties"); QbsRunParameters params("build"); params.arguments = QStringList("moduleProviders.provider_b.someProp: \"first,second\""); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("p.qbsmetatestmodule.listProp: [\"someValue\"]"), m_qbsStdout); QVERIFY2(m_qbsStdout.contains( "p.qbsothermodule.listProp: [\"first\",\"second\"]"), m_qbsStdout); } // checks that we can set qbs module properties in providers and provider cache works corectly void TestBlackboxProviders::qbsModulePropertiesInProviders() { QDir::setCurrent(testDataDir + "/qbs-module-properties-in-providers"); QbsRunParameters params("resolve"); QCOMPARE(runQbs(params), 0); // We have 2 products in 2 configurations, but second product should use the cached value // so we should have only 2 copies of the module, not 4. QCOMPARE(m_qbsStdout.count("Running setup script for qbsmetatestmodule"), 2); // Check that products get correct values from modules QVERIFY2(m_qbsStdout.contains(("product1.qbsmetatestmodule.prop: /sysroot1")), m_qbsStdout); QVERIFY2(m_qbsStdout.contains(("product1.qbsmetatestmodule.prop: /sysroot2")), m_qbsStdout); QVERIFY2(m_qbsStdout.contains(("product2.qbsmetatestmodule.prop: /sysroot1")), m_qbsStdout); QVERIFY2(m_qbsStdout.contains(("product2.qbsmetatestmodule.prop: /sysroot2")), m_qbsStdout); } void TestBlackboxProviders::qbsModuleProviders_data() { QTest::addColumn("arguments"); QTest::addColumn("firstProp"); QTest::addColumn("secondProp"); QTest::newRow("default") << QStringList() << "from_provider_a" << "undefined"; QTest::newRow("override") << QStringList("projects.project.qbsModuleProviders:provider_b") << "from_provider_b" << "from_provider_b"; QTest::newRow("override list a") << QStringList("projects.project.qbsModuleProviders:provider_a,provider_b") << "from_provider_a" << "from_provider_b"; QTest::newRow("override list b") << QStringList("projects.project.qbsModuleProviders:provider_b,provider_a") << "from_provider_b" << "from_provider_b"; } // Tests whether it is possible to set qbsModuleProviders in Product and Project items // and that the order of providers results in correct priority void TestBlackboxProviders::qbsModuleProviders() { QFETCH(QStringList, arguments); QFETCH(QString, firstProp); QFETCH(QString, secondProp); QDir::setCurrent(testDataDir + "/qbs-module-providers"); QbsRunParameters params("resolve"); params.arguments << arguments << "-f" << "qbs-module-providers.qbs"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains(("p1.qbsmetatestmodule.prop: " + firstProp).toUtf8()), m_qbsStdout); QVERIFY2(m_qbsStdout.contains(("p1.qbsothermodule.prop: " + secondProp).toUtf8()), m_qbsStdout); QVERIFY2(m_qbsStdout.contains(("p2.qbsmetatestmodule.prop: " + firstProp).toUtf8()), m_qbsStdout); QVERIFY2(m_qbsStdout.contains(("p2.qbsothermodule.prop: " + secondProp).toUtf8()), m_qbsStdout); } void TestBlackboxProviders::qbsModuleProvidersCliOverride_data() { QTest::addColumn("arguments"); QTest::addColumn("propertyValue"); QTest::newRow("default") << QStringList() << "undefined"; QTest::newRow("project-wide") << QStringList("project.qbsModuleProviders:provider_a") << "from_provider_a"; QTest::newRow("concrete project") << QStringList("projects.innerProject.qbsModuleProviders:provider_a") << "from_provider_a"; QTest::newRow("concrete product") << QStringList("products.product.qbsModuleProviders:provider_a") << "from_provider_a"; QTest::newRow("concrete project override project-wide") << QStringList({ "project.qbsModuleProviders:provider_a", "projects.innerProject.qbsModuleProviders:provider_b"}) << "from_provider_b"; QTest::newRow("concrete product override project-wide") << QStringList({ "project.qbsModuleProviders:provider_a", "products.product.qbsModuleProviders:provider_b"}) << "from_provider_b"; } // Tests possible use-cases how to override providers from command-line void TestBlackboxProviders::qbsModuleProvidersCliOverride() { QFETCH(QStringList, arguments); QFETCH(QString, propertyValue); QDir::setCurrent(testDataDir + "/qbs-module-providers-cli-override"); QbsRunParameters params("resolve"); params.arguments = arguments; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains(("qbsmetatestmodule.prop: " + propertyValue).toUtf8()), m_qbsStdout); } void TestBlackboxProviders::qbsModuleProvidersCompatibility_data() { QTest::addColumn("arguments"); QTest::addColumn("propertyValue"); QTest::newRow("default") << QStringList() << "from_scoped_provider"; QTest::newRow("scoped by name") << QStringList("project.qbsModuleProviders:qbsmetatestmodule") << "from_scoped_provider"; QTest::newRow("named") << QStringList("project.qbsModuleProviders:named_provider") << "from_named_provider"; } // Tests whether scoped providers can be used as named, i.e. new provider machinery // is compatible with the old one void TestBlackboxProviders::qbsModuleProvidersCompatibility() { QFETCH(QStringList, arguments); QFETCH(QString, propertyValue); QDir::setCurrent(testDataDir + "/qbs-module-providers-compatibility"); QbsRunParameters params("resolve"); params.arguments = arguments; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains(("qbsmetatestmodule.prop: " + propertyValue).toUtf8()), m_qbsStdout); } void TestBlackboxProviders::qbspkgconfigModuleProvider() { QDir::setCurrent(testDataDir + "/qbspkgconfig-module-provider/libs"); rmDirR(relativeBuildDir()); const auto commonParams = QbsRunParameters(QStringLiteral("install"), { QStringLiteral("--install-root"), QStringLiteral("install-root") }); auto dynamicParams = commonParams; dynamicParams.arguments << "config:library" << "projects.libs.isBundle:false"; QCOMPARE(runQbs(dynamicParams), 0); QDir::setCurrent(testDataDir + "/qbspkgconfig-module-provider"); rmDirR(relativeBuildDir()); const auto sysroot = testDataDir + "/qbspkgconfig-module-provider/libs/install-root"; QbsRunParameters params; params.arguments << "moduleProviders.qbspkgconfig.sysroot:" + sysroot; QCOMPARE(runQbs(params), 0); } void TestBlackboxProviders::qtBug51237() { const SettingsPtr s = settings(); qbs::Internal::TemporaryProfile profile("qbs_autotests_qtBug51237", s.get()); profile.p.setValue("moduleProviders.provider.theProperty", QStringList()); s->sync(); QDir::setCurrent(testDataDir + "/QTBUG-51237"); QbsRunParameters params; params.profile = profile.p.name(); QCOMPARE(runQbs(params), 0); } void TestBlackboxProviders::removalVersion() { QDir::setCurrent(testDataDir + "/removal-version"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY(m_qbsStderr.contains( "Property 'deprecated' was scheduled for removal in version 2.2.0, but is still present")); } QTEST_MAIN(TestBlackboxProviders) qbs-src-3.2.0/tests/auto/blackbox/blackbox-providers.qbs0000644000175100017510000000101515154533055022705 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "blackbox-providers" Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { name: "testdata" prefix: "testdata-providers/" files: ["**/*"] fileTags: [] } files: [ "../shared.h", "tst_blackboxbase.cpp", "tst_blackboxbase.h", "tst_blackboxproviders.cpp", "tst_blackboxproviders.h", ] cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)]) } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/0000755000175100017510000000000015154533055020634 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/remove-moc-header-from-file-list/0000755000175100017510000000000015154533055026762 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/remove-moc-header-from-file-list/file.h0000644000175100017510000000022115154533055030045 0ustar runnerrunner#pragma once #include class MyObject : public QObject { Q_OBJECT public: MyObject(); signals: void someSignal(); }; ././@LongLink0000644000000000000000000000016400000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/remove-moc-header-from-file-list/remove-moc-header-from-file-list.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/remove-moc-header-from-file-list/remove-moc-header-fro0000644000175100017510000000013015154533055032762 0ustar runnerrunnerQtApplication { name: "p" files: [ "file.h", "file.cpp" ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/remove-moc-header-from-file-list/file.cpp0000644000175100017510000000014515154533055030405 0ustar runnerrunner#include "file.h" MyObject::MyObject() {} int main() { MyObject o1; } #include qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/no-relink-on-qdebug/0000755000175100017510000000000015154533055024411 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/no-relink-on-qdebug/main.cpp0000644000175100017510000000001715154533055026037 0ustar runnerrunnerint main() { } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/no-relink-on-qdebug/symbols-test.qbs0000644000175100017510000000163215154533055027567 0ustar runnerrunnerProject { CppApplication { name: "app" Depends { name: "lib" } Depends { name: "Qt.core" } property bool dummy: { var isGCC = qbs.toolchain.includes("gcc") && !qbs.toolchain.includes("emscripten") console.info("is GCC: " + isGCC); console.info("is MinGW: " + qbs.toolchain.includes("mingw")); console.info("is Darwin: " + qbs.targetOS.includes("darwin")); console.info("is emscripten: " + qbs.toolchain.contains("emscripten")); console.info("is static qt: " + Qt.core.staticBuild); } files: "main.cpp" } DynamicLibrary { name: "lib" Depends { name: "Qt.core" } cpp.cxxLanguageVersion: "c++11" cpp.defines: "SYMBOLSTEST_LIBRARY" files: [ "lib.cpp", "lib.h", ] Export { Depends { name: "Qt.core" } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/no-relink-on-qdebug/lib.h0000644000175100017510000000045715154533055025336 0ustar runnerrunner#ifndef SYMBOLSTEST_H #define SYMBOLSTEST_H #include #if defined(SYMBOLSTEST_LIBRARY) # define SYMBOLSTEST_EXPORT Q_DECL_EXPORT #else # define SYMBOLSTEST_EXPORT Q_DECL_IMPORT #endif class SYMBOLSTEST_EXPORT SymbolsTest { public: SymbolsTest(); }; #endif // SYMBOLSTEST_H qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/no-relink-on-qdebug/lib.cpp0000644000175100017510000000014115154533055025657 0ustar runnerrunner#include #include "lib.h" SymbolsTest::SymbolsTest() { // qDebug() << "hallo"; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/linker-variant/0000755000175100017510000000000015154533055023562 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/linker-variant/main.cpp0000644000175100017510000000007415154533055025213 0ustar runnerrunner#include int main() { qDebug() << "Tach."; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/linker-variant/qt-linker-variant.qbs0000644000175100017510000000041515154533055027641 0ustar runnerrunnerQtApplication { Probe { id: qtConfigProbe property stringList moduleConfig: Qt.core.moduleConfig configure: { console.info("Qt requires gold: " + moduleConfig.includes("use_gold_linker")); } } files: "main.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/combined-moc/0000755000175100017510000000000015154533055023170 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/combined-moc/main.cpp0000644000175100017510000000007515154533055024622 0ustar runnerrunner#include "theobject.h" int main() { TheObject object; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/combined-moc/combined-moc.qbs0000644000175100017510000000014315154533055026231 0ustar runnerrunnerQtApplication { name: "theapp" files: [ "main.cpp", "theobject.h", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/combined-moc/theobject.h0000644000175100017510000000010715154533055025306 0ustar runnerrunner#include class TheObject : public QObject { Q_OBJECT }; qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/trackQObjChange/0000755000175100017510000000000015154533055023622 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/trackQObjChange/i.qbs0000644000175100017510000000064215154533055024563 0ustar runnerrunnerProject { Product { type: "application" consoleApplication: true name: "i" property bool dummy: { console.info("object suffix: " + cpp.objectSuffix); console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: "Qt.core" } files: [ "bla.cpp", "bla.h" ] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/trackQObjChange/bla.cpp0000644000175100017510000000247115154533055025070 0ustar runnerrunner/**************************************************************************** ** ** 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 "bla.h" int main() { MyObject obj; obj.setObjectName("I am the object!"); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/trackQObjChange/bla_noqobject.h0000644000175100017510000000242515154533055026600 0ustar runnerrunner/**************************************************************************** ** ** 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 class MyObject : public QObject { }; qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/trackQObjChange/bla_qobject.h0000644000175100017510000000244215154533055026242 0ustar runnerrunner/**************************************************************************** ** ** 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 class MyObject : public QObject { Q_OBJECT }; qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/quick-compiler/0000755000175100017510000000000015154533055023560 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/quick-compiler/main.cpp0000644000175100017510000000063715154533055025216 0ustar runnerrunner#include #include int main(int argc, char *argv[]) { #if defined(Q_OS_WIN) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/qml/subdir/test.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/quick-compiler/qml.qrc0000644000175100017510000000014215154533055025055 0ustar runnerrunner qml/subdir/test.qml qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/quick-compiler/quick-compiler.qbs0000644000175100017510000000110015154533055027203 0ustar runnerrunnerCppApplication { Depends { name: "Qt.quick" // Must fail when using Qt4 versionAtLeast: "5" } Qt.quick.useCompiler: Qt.quick.compilerAvailable cpp.cxxLanguageVersion: "c++11" Probe { id: qtQuickCompilerProbe property bool hasCompiler: Qt.quick.compilerAvailable configure: { if (hasCompiler) console.info("compiler available"); else console.info("compiler not available"); } } files: [ "main.cpp", "qml.qrc", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/quick-compiler/qml/0000755000175100017510000000000015154533055024351 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/quick-compiler/qml/subdir/0000755000175100017510000000000015154533055025641 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/quick-compiler/qml/subdir/test.qml0000644000175100017510000000003615154533055027332 0ustar runnerrunnerimport QtQuick 2.0 Item { } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/pkgconfig-qt/0000755000175100017510000000000015154533055023225 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/pkgconfig-qt/main.cpp0000644000175100017510000000001615154533055024652 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/pkgconfig-qt/pkgconfig-qt.qbs0000644000175100017510000000016515154533055026327 0ustar runnerrunnerQtApplication { name: "p" files: "main.cpp" qbsSearchPaths: "." qbsModuleProviders: "qbspkgconfig" } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/pkgconfig-qt/module-providers/0000755000175100017510000000000015154533055026525 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/pkgconfig-qt/module-providers/dummyProvider.qbs0000644000175100017510000000005715154533055032104 0ustar runnerrunnerModuleProvider { relativeSearchPaths: "" } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/pkgconfig-qt/dump-libpath.qbs0000644000175100017510000000017015154533055026320 0ustar runnerrunnerQtApplication { files: "main.cpp" property bool test: { console.info("libPath="+Qt.core.libPath) } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qmltyperegistrar/0000755000175100017510000000000015154533055024252 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qmltyperegistrar/main.cpp0000644000175100017510000000573515154533055025714 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include #include #include #include "person.h" int main(int argc, char ** argv) { QCoreApplication app(argc, argv); QQmlEngine engine; QQmlComponent component(&engine, QUrl("qrc:example.qml")); auto *person = qobject_cast(component.create()); if (person) { qWarning() << "The person's name is" << person->name(); qWarning() << "They wear a" << person->shoeSize() << "sized shoe"; } else { qWarning() << component.errors(); } return EXIT_SUCCESS; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qmltyperegistrar/person.h0000644000175100017510000000561615154533055025741 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef PERSON_H #define PERSON_H #include #include //![0] class Person : public QObject { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(int shoeSize READ shoeSize WRITE setShoeSize) QML_ELEMENT public: Person(QObject *parent = nullptr); QString name() const; void setName(const QString &); int shoeSize() const; void setShoeSize(int); private: QString m_name; int m_shoeSize; }; //![0] #endif // PERSON_H qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qmltyperegistrar/person.cpp0000644000175100017510000000534415154533055026272 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "person.h" // ![0] Person::Person(QObject *parent) : QObject(parent), m_shoeSize(0) { } QString Person::name() const { return m_name; } void Person::setName(const QString &n) { m_name = n; } int Person::shoeSize() const { return m_shoeSize; } void Person::setShoeSize(int s) { m_shoeSize = s; } // ![0] qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qmltyperegistrar/qmltyperegistrar.qbs0000644000175100017510000000126415154533055030402 0ustar runnerrunnerimport qbs.Utilities CppApplication { name: "myapp" Depends { name: "Qt.qml" } Qt.qml.importVersion: "1" cpp.includePaths: sourceDirectory qbs.installPrefix: "" files: [ "main.cpp", "person.cpp", "person.h", ] Group { files: "example.qml" fileTags: "qt.core.resource_data" } Probe { id: versionProbe property string version: Qt.core.version configure: { if (Utilities.versionCompare(version, "5.15") >= 0) console.info("has registrar"); else console.info("does not have registrar"); found = true; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qmltyperegistrar/example.qml0000644000175100017510000000475415154533055026432 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // ![0] import People 1.0 Person { name: "Bob Jones" shoeSize: 12 } // ![0] qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/cached-qml/0000755000175100017510000000000015154533055022632 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/cached-qml/main.cpp0000644000175100017510000000052315154533055024262 0ustar runnerrunner#include #include int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(qApp->applicationDirPath() + QStringLiteral("/data/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/cached-qml/qml.qrc0000644000175100017510000000023115154533055024126 0ustar runnerrunner main.qml MainForm.ui.qml qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/cached-qml/MainForm.ui.qml0000644000175100017510000000116015154533055025467 0ustar runnerrunnerimport QtQuick 2.6 Rectangle { property alias mouseArea: mouseArea property alias textEdit: textEdit width: 360 height: 360 MouseArea { id: mouseArea anchors.fill: parent } TextEdit { id: textEdit text: qsTr("Enter some text...") verticalAlignment: Text.AlignVCenter anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter anchors.topMargin: 20 Rectangle { anchors.fill: parent anchors.margins: -10 color: "transparent" border.width: 1 } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/cached-qml/stuff.js0000644000175100017510000000005415154533055024316 0ustar runnerrunnerfunction title() { return "Wello Horld!"; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/cached-qml/main.qml0000644000175100017510000000052015154533055024266 0ustar runnerrunnerimport QtQuick 2.6 import QtQuick.Window 2.2 import "stuff.js" as Stuff Window { visible: true width: 640 height: 480 title: Stuff.title() MainForm { anchors.fill: parent mouseArea.onClicked: { console.log(qsTr('Clicked on background. Text: "' + textEdit.text + '"')) } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/cached-qml/cached-qml.qbs0000644000175100017510000000163715154533055025346 0ustar runnerrunnerimport qbs.Utilities CppApplication { name: "app" consoleApplication: true Depends { name: "Qt.core" } Depends { name: "Qt.quick" } Depends { name: "Qt.qml" } install: true installDir: "" qbs.installPrefix: "" Qt.qml.generateCacheFiles: true Qt.qml.cacheFilesInstallDir: "data" files: [ "main.cpp", "MainForm.ui.qml", "main.qml", "stuff.js" ] // Install the C++ sources to tell the blackbox test that Qt.qmlcache is not available. Group { condition: !Qt.qml.cachingEnabled fileTagsFilter: ["cpp"] qbs.install: true qbs.installDir: "data" } Probe { id: qtVersionProbe property string qtVersion: Qt.core.version configure: { console.info("qmlcachegen must work: " + (Utilities.versionCompare(qtVersion, "5.11") >= 0)) } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/static-qt-plugin-linking/0000755000175100017510000000000015154533055025472 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/static-qt-plugin-linking/main.cpp0000644000175100017510000000017715154533055027127 0ustar runnerrunner#include int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); return app.exec(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/static-qt-plugin-linking/lib.cpp0000644000175100017510000000002315154533055026737 0ustar runnerrunnervoid function() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/static-qt-plugin-linking/static-qt-plugin-linking.qbs0000644000175100017510000000117215154533055033040 0ustar runnerrunnerProduct { name: "p" Probe { id: staticQtChecker property bool staticQt: Qt.core.staticBuild configure: { found = staticQt; if (found) console.info("Qt is static"); } } Group { condition: type.includes("application") files: "main.cpp" } Group { condition: type.includes("staticlibrary") files: "lib.cpp" } Depends { name: "Qt.core" } Depends { name: "Qt.gui" } Depends { name: "Qt.qminimal"; condition: Qt.core.staticBuild && !qbs.toolchain.includes("emscripten") } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools/0000755000175100017510000000000015154533055023163 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools/main.cpp0000644000175100017510000000003515154533055024611 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools/tessellation_shader.tesc0000644000175100017510000000110515154533055030074 0ustar runnerrunner#version 410 core layout (vertices=4) out; layout(location = 0) in vec2 TexCoord[];// varying output to evaluation shader layout(location = 0) out vec2 TextureCoord[]; void main() { gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; TextureCoord[gl_InvocationID] = TexCoord[gl_InvocationID]; if (gl_InvocationID == 0) { gl_TessLevelOuter[0] = 16; gl_TessLevelOuter[1] = 16; gl_TessLevelOuter[2] = 16; gl_TessLevelOuter[3] = 16; gl_TessLevelInner[0] = 16; gl_TessLevelInner[1] = 16; } }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools/defines_shader.frag0000644000175100017510000000042215154533055026765 0ustar runnerrunner#version 440 precision mediump float; #ifndef TEST_DEFINE_1 #error "TEST_DEFINE_1 is not defined" #endif #ifndef TEST_DEFINE_2 #error "TEST_DEFINE_2 is not defined" #endif layout(location = 0) out vec4 fragColor; void main() { fragColor = vec4(1.0, 0.0, 0.0, 1.0); }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools/multiview.qbs0000644000175100017510000000031315154533055025714 0ustar runnerrunnerimport qbs QtApplication { name: "shadertools-test" type: "application" Depends { name: "Qt.shadertools" } Qt.shadertools.multiView: true files: ["basic_shader.frag", "main.cpp"] }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools/viewcount.qbs0000644000175100017510000000035715154533055025722 0ustar runnerrunnerimport qbs QtApplication { name: "view-count-test" type: "application" Depends { name: "Qt.shadertools" } Qt.shadertools.useQt6Versions: true Qt.shadertools.viewCount: 4 files: ["basic_shader.frag", "main.cpp"] }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools/basic.qbs0000644000175100017510000000043515154533055024755 0ustar runnerrunnerimport qbs QtApplication { name: "shadertools-test" type: "application" Depends { name: "Qt.shadertools" } Qt.shadertools.useQt6Versions: true Qt.shadertools.optimized: true Qt.shadertools.debugInformation: true files: ["basic_shader.frag", "main.cpp"] }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools/tessellation_shader.vert0000644000175100017510000000054515154533055030125 0ustar runnerrunner// vertex shader #version 410 core // vertex position layout (location = 0) in vec3 aPos; // texture coordinate layout (location = 1) in vec2 aTex; layout(location = 0) out vec2 TexCoord; void main() { // convert XYZ vertex to XYZW homogeneous coordinate gl_Position = vec4(aPos, 1.0); // pass texture coordinate though TexCoord = aTex; }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools/defines.qbs0000644000175100017510000000043515154533055025311 0ustar runnerrunnerimport qbs QtApplication { name: "shadertools-defines-test" type: "application" Depends { name: "Qt.shadertools" } Qt.shadertools.useQt6Versions: true Qt.shadertools.defines: ["TEST_DEFINE_1=1", "TEST_DEFINE_2=1"] files: ["defines_shader.frag", "main.cpp"] }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools/tessellation.qbs0000644000175100017510000000053415154533055026402 0ustar runnerrunnerimport qbs QtApplication { name: "shadertools-test" type: "application" Depends { name: "Qt.shadertools" } Qt.shadertools.glslVersions: ["410", "320es"] Qt.shadertools.tessellationVertexCount: 3 Qt.shadertools.tessellationMode: "triangles" files: ["tessellation_shader.vert", "tessellation_shader.tesc", "main.cpp"] }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools/basic_shader.frag0000644000175100017510000000021315154533055026427 0ustar runnerrunner#version 440 precision mediump float; layout(location = 0) out vec4 fragColor; void main() { fragColor = vec4(1.0, 0.0, 0.0, 1.0); }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qt-keywords/0000755000175100017510000000000015154533055023125 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qt-keywords/main.cpp0000644000175100017510000000021315154533055024551 0ustar runnerrunner#include class AnObject : public QObject { Q_OBJECT signals: void someSignal(); }; int main() { } #include qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qt-keywords/qt-keywords.qbs0000644000175100017510000000005215154533055026122 0ustar runnerrunnerQtApplication { files: ["main.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/forced-moc/0000755000175100017510000000000015154533055022652 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/forced-moc/main.cpp0000644000175100017510000000054615154533055024307 0ustar runnerrunner#include "myqtclass.h" #include #include #include int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); MyQtClass c; QObject::connect(&c, &MyQtClass::mySignal, [] { qDebug() << "Hello from slot"; qApp->quit(); }); QTimer::singleShot(0, &c, &MyQtClass::mySignal); return app.exec(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/forced-moc/forced-moc.qbs0000644000175100017510000000132615154533055025401 0ustar runnerrunnerimport qbs.Host import qbs.Utilities QtApplication { condition: { if (Utilities.versionCompare(Qt.core.version, "5.0") < 0) { console.info("using qt4"); return false; } var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } files: "main.cpp" Group { name: "QObject service provider" files: "createqtclass.h" fileTags: ["hpp", "unmocable"] } Group { name: "QObject service user" files: "myqtclass.h" fileTags: ["hpp", "mocable"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/forced-moc/createqtclass.h0000644000175100017510000000032415154533055025660 0ustar runnerrunner#ifndef CREATEQTCLASS_H #define CREATEQTCLASS_H #include #define CREATE_QT_CLASS(className) \ class className : public QObject \ { \ Q_OBJECT \ public: \ Q_SIGNAL void mySignal(); \ } #endif qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/forced-moc/myqtclass.h0000644000175100017510000000015115154533055025040 0ustar runnerrunner#ifndef MYQTCLASS_H #define MYQTCLASS_H #include "createqtclass.h" CREATE_QT_CLASS(MyQtClass); #endif qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/metatypes/0000755000175100017510000000000015154533055022647 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/metatypes/mocableclass1.cpp0000644000175100017510000000013715154533055026065 0ustar runnerrunner#include "mocableclass1.h" MocableClass1::MocableClass1(QObject *parent) : QObject(parent) {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/metatypes/mocableclass1.h0000644000175100017510000000020115154533055025522 0ustar runnerrunner#include class MocableClass1 : public QObject { Q_OBJECT public: MocableClass1(QObject *parent = nullptr); }; qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/metatypes/metatypes.qbs0000644000175100017510000000112515154533055025370 0ustar runnerrunnerimport qbs.Utilities StaticLibrary { name: "mylib" Depends { name: "Qt.core" } qbs.installPrefix: "some-prefix" Probe { id: capabilitiesChecker property string version: Qt.core.version configure: { if (Utilities.versionCompare(version, "5.15") >= 0) console.info("can generate"); else console.info("cannot generate"); found = true; } } files: [ "mocableclass1.cpp", "mocableclass1.h", "mocableclass2.cpp", "unmocableclass.cpp", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/metatypes/unmocableclass.cpp0000644000175100017510000000020015154533055026336 0ustar runnerrunner#include class UnmocableClass : public QObject { public: UnmocableClass(QObject *parent) : QObject(parent) {} }; qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/metatypes/mocableclass2.cpp0000644000175100017510000000025115154533055026063 0ustar runnerrunner#include class MocableClass2 : public QObject { Q_OBJECT public: MocableClass2(QObject *parent) : QObject(parent) {} }; #include qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-interfaces/0000755000175100017510000000000015154533055023712 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-interfaces/main.cpp0000644000175100017510000000531015154533055025341 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include #else #include > #endif #include #include "controller.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); Controller controller; controller.show(); return app.exec(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-interfaces/controller.cpp0000644000175100017510000000625715154533055026613 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include #include "controller.h" #include "car_interface.h" Controller::Controller(QWidget *parent) : QWidget(parent) { ui.setupUi(this); car = new org::example::Examples::CarInterface("org.example.CarExample", "/Car", QDBusConnection::sessionBus(), this); startTimer(1000); } void Controller::timerEvent(QTimerEvent *event) { Q_UNUSED(event); if (car->isValid()) ui.label->setText("connected"); else ui.label->setText("disconnected"); } void Controller::on_accelerate_clicked() { car->accelerate(); } void Controller::on_decelerate_clicked() { car->decelerate(); } void Controller::on_left_clicked() { car->turnLeft(); } void Controller::on_right_clicked() { car->turnRight(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-interfaces/car.xml0000644000175100017510000000062415154533055025203 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-interfaces/controller.h0000644000175100017510000000330015154533055026242 0ustar runnerrunner/**************************************************************************** ** ** 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 CONTROLLER_H #define CONTROLLER_H #include "ui_controller.h" #include "car_interface.h" class Controller : public QWidget { Q_OBJECT public: Controller(QWidget *parent = nullptr); protected: void timerEvent(QTimerEvent *event); private slots: void on_accelerate_clicked(); void on_decelerate_clicked(); void on_left_clicked(); void on_right_clicked(); private: Ui::Controller ui; org::example::Examples::CarInterface *car; }; #endif qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-interfaces/controller.ui0000644000175100017510000000276215154533055026443 0ustar runnerrunner Controller 0 0 255 111 Controller 9 6 Controller Qt::AlignCenter Decelerate Accelerate Right Left qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-interfaces/controller.qbs0000644000175100017510000000065015154533055026605 0ustar runnerrunnerCppApplication { name: "controller" condition: Qt.dbus.present Depends { name: "Qt.dbus"; required: false } Depends { name: "Qt.widgets" } cpp.cxxLanguageVersion: "c++11" files: [ "controller.cpp", "controller.h", "controller.ui", "main.cpp", ] Group { name: "DBUS Interface" files: ["car.xml"] fileTags: ["qt.dbus.interface"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/pkgconfig/0000755000175100017510000000000015154533055022603 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/pkgconfig/main.cpp0000644000175100017510000000303015154533055024227 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #ifdef QT_CORE_LIB #include #include #else #include #endif int main(int argc, char **argv) { #ifdef QT_CORE_LIB QCoreApplication app(argc, argv); qDebug() << "Hello world!"; #else (void)argc; (void)argv; std::cout << "Skip this test" << std::endl; #endif } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/pkgconfig/pkgconfig.qbs0000644000175100017510000000125215154533055025261 0ustar runnerrunnerimport qbs.Host import qbs.Probes Project { property string name: 'pkgconfig' CppApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: project.name Probes.PkgConfigProbe { id: pkgConfig name: "QtCore" minVersion: '4.0.0' maxVersion: '5.99.99' } files: 'main.cpp' cpp.cxxFlags: pkgConfig.cflags cpp.linkerFlags: pkgConfig.libs } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/auto-qrc/0000755000175100017510000000000015154533055022367 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/auto-qrc/main.cpp0000644000175100017510000000107115154533055024016 0ustar runnerrunner#include #include int main() { QFile resource1(":/thePrefix/resource1.txt"); if (!resource1.open(QIODevice::ReadOnly)) return 1; QFile resource2(":/thePrefix/resource2.txt"); if (!resource2.open(QIODevice::ReadOnly)) return 2; QFile resource3(":/theOtherPrefix/resource3.txt"); if (!resource3.open(QIODevice::ReadOnly)) return 3; std::cout << "resource data: " << resource1.readAll().constData() << resource2.readAll().constData() << resource3.readAll().constData() << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/auto-qrc/qrc-base/0000755000175100017510000000000015154533055024064 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/auto-qrc/qrc-base/resource1.txt0000644000175100017510000000001215154533055026526 0ustar runnerrunnerresource1 qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/auto-qrc/qrc-base/subdir/0000755000175100017510000000000015154533055025354 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/auto-qrc/qrc-base/subdir/resource2.txt0000644000175100017510000000001215154533055030017 0ustar runnerrunnerresource2 qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/auto-qrc/qrc-base/subdir/resource3.txt0000644000175100017510000000001215154533055030020 0ustar runnerrunnerresource3 qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/auto-qrc/auto-qrc.qbs0000644000175100017510000000176115154533055024636 0ustar runnerrunnerimport qbs.Host Project { QtApplication { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "app" files: ["main.cpp"] Group { prefix: "qrc-base/" Qt.core.resourcePrefix: "/thePrefix" Qt.core.resourceSourceBase: "qrc-base" files: ["resource1.txt"] fileTags: ["qt.core.resource_data"] Group { prefix: "qrc-base/subdir/" Qt.core.resourceSourceBase: "qrc-base/subdir" files: ["resource2.txt"] Group { prefix: "qrc-base/subdir/" Qt.core.resourcePrefix: "/theOtherPrefix" files: ["resource3.txt"] } } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-same-file-name/0000755000175100017510000000000015154533055024170 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-same-file-name/main.cpp0000644000175100017510000000017215154533055025620 0ustar runnerrunner#include "src1/someclass.h" #include "src2/someclass.h" int main() { Src1::SomeClass sc1; Src2::SomeClass sc2; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/0000755000175100017510000000000015154533055025041 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/someclass.h0000644000175100017510000000030115154533055027175 0ustar runnerrunner#ifndef SOMECLASS2_H #define SOMECLASS2_H #include namespace Src2 { class SomeClass : public QObject { Q_OBJECT public: SomeClass(QObject *parent = nullptr); }; } #endif qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/someclass.cpp0000644000175100017510000000015115154533055027533 0ustar runnerrunner#include "someclass.h" namespace Src2 { SomeClass::SomeClass(QObject *parent) : QObject(parent) { } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/somefile.cpp0000644000175100017510000000020415154533055027344 0ustar runnerrunner#include class MyClass2 : public QObject { Q_OBJECT }; static void f() { MyClass2 m; } #include qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/0000755000175100017510000000000015154533055025040 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/someclass.h0000644000175100017510000000030115154533055027174 0ustar runnerrunner#ifndef SOMECLASS1_H #define SOMECLASS1_H #include namespace Src1 { class SomeClass : public QObject { Q_OBJECT public: SomeClass(QObject *parent = nullptr); }; } #endif qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/someclass.cpp0000644000175100017510000000015115154533055027532 0ustar runnerrunner#include "someclass.h" namespace Src1 { SomeClass::SomeClass(QObject *parent) : QObject(parent) { } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/somefile.cpp0000644000175100017510000000020415154533055027343 0ustar runnerrunner#include class MyClass1 : public QObject { Q_OBJECT }; static void f() { MyClass1 m; } #include qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-same-file-name/moc-same-file-name.qbs0000644000175100017510000000114015154533055030227 0ustar runnerrunnerQtApplication { name: "app" cpp.cxxLanguageVersion: "c++11" files: "main.cpp" Group { name: "src1" Qt.core.generatedHeadersDir: product.buildDirectory + "/qt.headers_src1" prefix: name + '/' files: [ "someclass.cpp", "someclass.h", "somefile.cpp", ] } Group { name: "src2" prefix: name + '/' Qt.core.generatedHeadersDir: product.buildDirectory + "/qt.headers_src2" files: [ "someclass.cpp", "someclass.h", "somefile.cpp", ] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/mixed-build-variants/0000755000175100017510000000000015154533055024664 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/mixed-build-variants/main.cpp0000644000175100017510000000242315154533055026315 0ustar runnerrunner/**************************************************************************** ** ** 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 int main() { qDebug("Tach."); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/mixed-build-variants/mixed-build-variants.qbs0000644000175100017510000000066115154533055031426 0ustar runnerrunnerProject { Probe { id: tcProbe property bool isMsvc: qbs.toolchain.contains("msvc") configure: { console.info("is msvc: " + isMsvc); } } QtApplication { Properties { condition: qbs.toolchain.includes("msvc") Qt.core.qtBuildVariant: "release" qbs.buildVariant: "debug" } Qt.core.qtBuildVariant: "dummy" files: ["main.cpp"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qdoc/0000755000175100017510000000000015154533055021562 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qdoc/qdoc.qdocconf0000644000175100017510000000043015154533055024223 0ustar runnerrunnerproject = QDoc Test description = QDoc Test headerdirs = . sourcedirs = . exampledirs = . outputdir = doc/html qhp.projects = QDocTest qhp.QDocTest.file = qdoctest.qhp qhp.QDocTest.namespace = org.qt-project.QDocTest qhp.QDocTest.virtualFolder = doc qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qdoc/qdoc.qdoc0000644000175100017510000000012415154533055023355 0ustar runnerrunner/*! \page index.html \title QDoc Test QDoc Test is a test for QDoc. */qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qdoc/qdoc.qbs0000644000175100017510000000126115154533055023217 0ustar runnerrunnerimport qbs.Host import qbs.Utilities Product { condition: { if (Utilities.versionCompare(Qt.core.version, "5.0.0") < 0) { console.info("Qt is too old"); return false; } if (qbs.targetPlatform !== Host.platform() || qbs.architecture !== Host.architecture()) { console.info("target platform/arch differ from host platform/arch"); return false; } return true; } name: "QDoc Test" type: ["qdoc-html", "qch"] Depends { name: "Qt.core" } files: ["qdoc.qdoc"] Group { name: "main qdocconf file" files: "qdoc.qdocconf" fileTags: "qdocconf-main" } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/emscripten-html/0000755000175100017510000000000015154533055023747 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/emscripten-html/main.cpp0000644000175100017510000000235115154533055025400 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/emscripten-html/emscripten-html.qbs0000644000175100017510000000056415154533055027576 0ustar runnerrunnerProduct { name: "app" type: generateHtml ? ["application", "qthtml"] : ["application"] Depends { name: "Qt.core" } files: "main.cpp" property bool dummy: { console.info("is emscripten: " + qbs.toolchain.includes("emscripten")); } property bool generateHtml: false Group { fileTagsFilter: ["qthtml"] qbs.install: true } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/0000755000175100017510000000000015154533055022272 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/qt2-dummy2.cpp0000644000175100017510000000002315154533055024712 0ustar runnerrunnerstatic void f() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/qt2-main.cpp0000644000175100017510000000026515154533055024431 0ustar runnerrunner#include class M : public QObject { Q_OBJECT public: M() { auto s = tr("M message"); // auto s2 = tr("M message 2"); } }; int main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/mainwindow.ui0000644000175100017510000000120215154533055025000 0ustar runnerrunner MainWindow 0 0 800 600 The title 0 0 800 19 qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/qt1-main.cpp0000644000175100017510000000001615154533055024422 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/lupdate.qbs0000644000175100017510000000471315154533055024444 0ustar runnerrunnerimport qbs.File Project { QtApplication { name: "qt1" Depends { name: "Qt.widgets" } /*cpp.includePaths: "subdir"*/ // cpp.cxxLanguageVersion: "c++17" Group { name: "ignored" files: "qt1-main.cpp" fileTags: ["cpp", "qt.untranslatable"] } Group { name: "with extra include path" cpp.includePaths: outer.concat("subdir") files: "qt1-test.cpp" } Group { name: "translatable generator input" files: "input.txt" fileTags: "cpp.in" } Group { name: "non-translatable generator input" files: "input2.txt" fileTags: "cpp.in.nontranslatable" } files: [ "mainwindow.ui", "qt1-dummy.cpp", "qt1-dummy2.cpp", "subdir/header.h", ] Rule { inputs: "cpp.in" Artifact { filePath: "generated_" + input.baseName + ".cpp"; fileTags: "cpp" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.highlight = "filegen"; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return cmd; } } Rule { inputs: "cpp.in.nontranslatable" Artifact { filePath: "generated_" + input.baseName + ".cpp"; fileTags: ["cpp", "qt.untranslatable"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.highlight = "filegen"; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return cmd; } } } QtApplication { name: "qt2" Depends { name: "qt1" } // Tests "minimal" propagation in Executor files: [ "qt2-dummy.cpp", "qt2-dummy2.cpp", "qt2-main.cpp", /*"qt2-new.cpp"*/ ] } CppApplication { name: "noqt" Depends { name: "qt2" } // Tests "minimal" propagation in Executor files: "noqt-main.cpp" } Product { name: "translations" Depends { name: "Qt.core" } files: "lupdate_de_DE.ts" } QtLupdateRunner {} } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/qt1-test.cpp0000644000175100017510000000010415154533055024453 0ustar runnerrunner#include H::H() { const auto s = tr("H message"); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/noqt-main.cpp0000644000175100017510000000001615154533055024676 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/qt1-dummy.cpp0000644000175100017510000000002315154533055024627 0ustar runnerrunnerstatic void f() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/qt1-dummy2.cpp0000644000175100017510000000002315154533055024711 0ustar runnerrunnerstatic void f() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/input2.txt0000644000175100017510000000020415154533055024250 0ustar runnerrunner#include class C : public QObject { Q_OBJECT public: C() { auto s = tr("ignored message"); } }; qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/subdir/0000755000175100017510000000000015154533055023562 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/subdir/header.h0000644000175100017510000000012115154533055025155 0ustar runnerrunner#include class H : public QObject { Q_OBJECT public: H(); }; qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/qt2-dummy.cpp0000644000175100017510000000002315154533055024630 0ustar runnerrunnerstatic void f() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/input.txt0000644000175100017510000000017615154533055024176 0ustar runnerrunner#include class C : public QObject { Q_OBJECT public: C() { auto s = tr("C message"); } }; qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/lupdate_de_DE.ts0000644000175100017510000000013715154533055025321 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lupdate/qt2-new.cpp0000644000175100017510000000015615154533055024275 0ustar runnerrunner#include class N : public QObject { Q_OBJECT public: N() { auto s = tr("N message"); } }; qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-and-cxx-combining/0000755000175100017510000000000015154533055024715 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-and-cxx-combining/main.cpp0000644000175100017510000000007115154533055026343 0ustar runnerrunner#include "myobject.h" int main() { useMyObject(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-and-cxx-combining/myobject.h0000644000175100017510000000010315154533055026674 0ustar runnerrunner#ifndef MYOBJECT_H #define MYOBJECT_H void useMyObject(); #endif qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-and-cxx-combining/myobject.cpp0000644000175100017510000000027215154533055027236 0ustar runnerrunner#include "myobject.h" #include class MyObject : public QObject { Q_OBJECT public: void use() {} }; void useMyObject() { MyObject().use(); } #include qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-and-cxx-combining/moc-and-cxx-combining.qbs0000644000175100017510000000015015154533055031501 0ustar runnerrunnerQtApplication { cpp.combineCxxSources: true files: ["main.cpp", "myobject.h", "myobject.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-meta-data/0000755000175100017510000000000015154533055023765 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-meta-data/app.cpp0000644000175100017510000000523115154533055025252 0ustar runnerrunner/**************************************************************************** ** ** 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 #include #include #include #include #include #include #ifdef QT_STATIC Q_IMPORT_PLUGIN(ThePlugin) #endif int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QJsonObject metaData; for (const QStaticPlugin &p : QPluginLoader::staticPlugins()) { const QJsonObject &md = p.metaData(); if (md.value("className") == "ThePlugin") { metaData = md; break; } } #ifdef QT_STATIC if (metaData.isEmpty()) { qDebug() << "no static metadata"; return 1; } #else if (!metaData.isEmpty()) { qDebug() << "static metadata"; return 1; } #endif if (metaData.isEmpty()) metaData = QPluginLoader("thePlugin").metaData(); const QJsonValue v = metaData.value(QStringLiteral("theKey")); if (!v.isArray()) { qDebug() << "value is" << v; return 1; } const QJsonArray a = v.toArray(); if (a.size() != 1 || a.first() != QLatin1String("theValue")) { qDebug() << "value is" << v; return 1; } const QJsonValue v2 = metaData.value(QStringLiteral("MetaData")).toObject() .value(QStringLiteral("theOtherKey")); if (v2.toString() != QLatin1String("theOtherValue")) { qDebug() << "metadata:" << metaData; return 1; } qDebug() << "all ok!"; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs0000644000175100017510000000332215154533055027625 0ustar runnerrunnerimport qbs.Host import qbs.Utilities Project { QtApplication { condition: { if (Utilities.versionCompare(Qt.core.version, "5.0") < 0) { // qt4 moc can't be used with pluginMetaData console.info("using qt4"); return false; } var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "app" consoleApplication: true Depends { name: "thePlugin" } cpp.cxxLanguageVersion: "c++11" Properties { condition: qbs.targetOS.includes("unix") cpp.rpaths: [cpp.rpathOrigin] } config.install.binariesDirectory: "" files: ["app.cpp"] } Library { type: Qt.core.staticBuild ? "staticlibrary" : "dynamiclibrary" name: "thePlugin" Depends { name: "cpp" } Depends { name: "Qt.core" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } cpp.defines: [Qt.core.staticBuild ? "QT_STATICPLUGIN" : "QT_PLUGIN"] cpp.cxxLanguageVersion: "c++11" cpp.sonamePrefix: qbs.targetOS.includes("darwin") ? "@rpath" : undefined cpp.includePaths: ["."] Qt.core.pluginMetaData: ["theKey=theValue"] config.install.dynamicLibrariesDirectory: "" config.install.staticLibrariesDirectory: "" files: ["theplugin.cpp"] Group { files: ["metadata.json"] fileTags: ["qt_plugin_metadata"] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-meta-data/metadata.json0000644000175100017510000000005015154533055026433 0ustar runnerrunner{ "theOtherKey" : "theOtherValue" } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-meta-data/theplugin.cpp0000644000175100017510000000263715154533055026500 0ustar runnerrunner/**************************************************************************** ** ** 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 #include class ThePlugin : public QObject { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.qbs.ThePlugin" FILE "metadata.json") }; #include qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qml-debugging/0000755000175100017510000000000015154533055023356 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qml-debugging/main.cpp0000644000175100017510000000345615154533055025016 0ustar runnerrunner/**************************************************************************** ** ** 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 #include #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include #include using Application = QGuiApplication; #define AH_SO_THIS_IS_QT5 #else #include #include #define AH_SO_THIS_IS_QT4 using Application = QApplication; #endif int main(int argc, char *argv[]) { Application app(argc, argv); #ifdef AH_SO_THIS_IS_QT5 QQmlApplicationEngine engine; engine.load(QUrl("blubb")); #else QDeclarativeView view; view.setSource(QUrl("blubb")); #endif return app.exec(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qml-debugging/qml-debugging.qbs0000644000175100017510000000077315154533055026616 0ustar runnerrunnerQtApplication { name: "debuggable-app" consoleApplication: true Depends { name: "Qt.quick" } Qt.quick.qmlDebugging: true files: "main.cpp" Probe { id: checker property bool isGcc: qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("emscripten") property string executableSuffix: cpp.executableSuffix configure: { console.info("is gcc: " + isGcc); console.info("executable suffix: " + executableSuffix); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-support/0000755000175100017510000000000015154533055023644 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-support/plugin-support-main.cpp0000644000175100017510000000001615154533055030277 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-support/plugin-support.qbs0000644000175100017510000000165115154533055027366 0ustar runnerrunnerimport qbs.Utilities QtGuiApplication { condition: { // pluginTypes empty for Qt4 if (Utilities.versionCompare(Qt.core.version, "5.0") < 0) { console.info("using qt4"); return false; } return true; } Probe { id: staticProbe property bool isStaticQt: Qt.gui.isStaticLibrary property var plugins: Qt.plugin_support.effectivePluginsByType property var allPlugins: Qt.plugin_support.allPluginsByType configure: { console.info("static Qt: " + isStaticQt); console.info("requested image plugins: %" + plugins.imageformats + "%"); console.info("all image plugins: #" + allPlugins.imageformats + "#"); console.info("platform plugin count: " + (plugins.platforms || []).length); } } Depends { name: "m1" } Depends { name: "m2" } files: "plugin-support-main.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-support/modules/0000755000175100017510000000000015154533055025314 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-support/modules/m2/0000755000175100017510000000000015154533055025632 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-support/modules/m2/m2.qbs0000644000175100017510000000044315154533055026660 0ustar runnerrunnerModule { Depends { name: "Qt.plugin_support" } Properties { condition: Qt.plugin_support.allPluginsByType && Qt.plugin_support.allPluginsByType.imageformats Qt.plugin_support.pluginsByType: ({imageformats: Qt.plugin_support.allPluginsByType.imageformats[1]}) } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-support/modules/m1/0000755000175100017510000000000015154533055025631 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/plugin-support/modules/m1/m1.qbs0000644000175100017510000000066415154533055026663 0ustar runnerrunnerModule { property bool useDummy Depends { name: "Qt.plugin_support" } Properties { condition: useDummy Qt.plugin_support.pluginsByType: ({imageformats: "dummy"}) } Properties { condition: Qt.plugin_support.allPluginsByType && Qt.plugin_support.allPluginsByType.imageformats Qt.plugin_support.pluginsByType: ({imageformats: Qt.plugin_support.allPluginsByType.imageformats[0]}) } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/no-moc-run-after-touching-other-cpp-file/0000755000175100017510000000000015154533055030357 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/no-moc-run-after-touching-other-cpp-file/header1.h0000644000175100017510000000010315154533055032033 0ustar runnerrunner#include class Test1 : public QObject { Q_OBJECT }; ././@LongLink0000644000000000000000000000020400000000000011577 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/no-moc-run-after-touching-other-cpp-file/no-moc-run-after-touching-other-cpp-file.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/no-moc-run-after-touching-other-cpp-file/no-moc-run-af0000644000175100017510000000016215154533055032657 0ustar runnerrunnerQtApplication { name: "app" files: [ "header1.h", "header2.h", "main.cpp" ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/no-moc-run-after-touching-other-cpp-file/main.cpp0000644000175100017510000000007515154533055032011 0ustar runnerrunner int main(int /*argc*/, char * /*argv*/[]) { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/no-moc-run-after-touching-other-cpp-file/header2.h0000644000175100017510000000010315154533055032034 0ustar runnerrunner#include class Test2 : public QObject { Q_OBJECT }; qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qt-xml/0000755000175100017510000000000015154533055022056 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qt-xml/main.cpp0000644000175100017510000000077715154533055023521 0ustar runnerrunner#include #include #include void testDom() { QDomDocument doc("test"); QDomElement element = doc.createElement("element"); element.setAttribute("attr", "foo"); doc.appendChild(element); qDebug() << doc.toString(); } int main(int argc, char *argv[]) { QCoreApplication::setApplicationName("LinkFailureTest"); QCoreApplication::setApplicationVersion("1.0.0"); QCoreApplication app(argc, argv); testDom(); return app.exec(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qt-xml/qt-xml.qbs0000644000175100017510000000021715154533055024007 0ustar runnerrunnerCppApplication { Depends { name: "Qt.core" } Depends { name: "Qt.xml" } cpp.cxxLanguageVersion: ["c++20"] files: "main.cpp" } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qobject-in-mm/0000755000175100017510000000000015154533055023276 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qobject-in-mm/main.mm0000644000175100017510000000017415154533055024557 0ustar runnerrunner#include class Foo : public QObject { Q_OBJECT }; int main() { Foo foo; return 0; } #include "main.moc" qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qobject-in-mm/qobject-in-mm.qbs0000644000175100017510000000011215154533055026441 0ustar runnerrunnerCppApplication { Depends { name: "Qt.core" } files: ["main.mm"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qrc/0000755000175100017510000000000015154533055021421 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qrc/i.qbs0000644000175100017510000000145715154533055022367 0ustar runnerrunnerimport qbs.Host import qbs.Utilities Project { Product { condition: { if (Utilities.versionCompare(Qt.core.version, "5.0") < 0) { console.info("using qt4"); return false; } var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); console.info("executable suffix: " + cpp.executableSuffix); return result; } consoleApplication: true type: "application" name: "i" Depends { name: "Qt.core" } files: [ "bla.cpp", "bla.qrc", //"test.cpp", ] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qrc/stuff.txt0000644000175100017510000000002015154533055023301 0ustar runnerrunnera resource file qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qrc/bla.cpp0000644000175100017510000000273115154533055022666 0ustar runnerrunner/**************************************************************************** ** ** 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 int main() { QFileInfo f(":/stuff.txt"); if (!f.exists()) return 1; if (!f.isFile()) return 2; QFileInfo d(":/subdir"); if (!d.exists()) return 3; if (!d.isDir()) return 4; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qrc/test.cpp0000644000175100017510000000001715154533055023102 0ustar runnerrunnervoid test() {} qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qrc/bla.qrc0000644000175100017510000000016515154533055022670 0ustar runnerrunner stuff.txt subdir/ qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qrc/subdir/0000755000175100017510000000000015154533055022711 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qrc/subdir/dummy.txt0000644000175100017510000000000015154533055024573 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qtscxml/0000755000175100017510000000000015154533055022327 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qtscxml/main.cpp0000644000175100017510000000045515154533055023763 0ustar runnerrunner#ifdef HAS_QTSCXML #include #endif #include int main() { #ifdef HAS_QTSCXML QbsTest::QbsStateMachine machine; std::cout << "state machine name: " << qPrintable(machine.name()) << std::endl; #else std::cout << "QtScxml not present" << std::endl; #endif } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qtscxml/dummystatemachine.scxml0000644000175100017510000000016615154533055027123 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs0000644000175100017510000000412715154533055024535 0ustar runnerrunnerimport qbs.Environment import qbs.FileInfo import qbs.Host import qbs.Utilities Project { QtApplication { name: "app" Depends { name: "Qt.scxml"; required: false } Properties { condition: Qt.scxml.present && Utilities.versionCompare(Qt.core.version, "5.13.0") != 0 cpp.defines: ["HAS_QTSCXML"] } Qt.scxml.className: "QbsStateMachine" Qt.scxml.namespace: "QbsTest" Qt.scxml.generateStateMethods: true files: ["main.cpp"] Group { files: ["dummystatemachine.scxml"] fileTags: ["qt.scxml.compilable"] } } Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "runner" type: ["runner"] Depends { name: "app" } Rule { inputsFromDependencies: ["application"] outputFileTags: ["runner"] prepare: { var cmd = new Command(input.filePath); cmd.description = "running " + input.filePath; var envVars = {}; if (Host.os().includes("windows")) { envVars["PATH"] = FileInfo.toWindowsSeparators(input["Qt.core"].binPath); } else if (Host.os().includes("macos")) { envVars["DYLD_LIBRARY_PATH"] = input["Qt.core"].libPath; envVars["DYLD_FRAMEWORK_PATH"] = input["Qt.core"].libPath; } else { envVars["LD_LIBRARY_PATH"] = input["Qt.core"].libPath; } for (var varName in envVars) { var oldValue = Environment.getEnv(varName) || ""; var newValue = envVars[varName] + FileInfo.pathListSeparator() + oldValue; cmd.environment.push(varName + '=' + newValue); } return [cmd]; } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lrelease/0000755000175100017510000000000015154533055022430 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lrelease/lrelease.qbs0000644000175100017510000000060415154533055024733 0ustar runnerrunnerimport qbs.Host Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "lrelease-test" type: ["ts"] Depends { name: "Qt.core" } files: ["de.ts", "hu.ts"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lrelease/de.ts0000644000175100017510000000124415154533055023371 0ustar runnerrunner Application I am hunry Ich bin Ungar I am thirsty Ich bin Donnerstag Please press Control Bitte drücken Sie den Kontrolleur No keyboard detected. Please press F1 to continue Sehr witzig qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/lrelease/hu.ts0000644000175100017510000000074115154533055023416 0ustar runnerrunner Application My hovercraft is full of eels A légpárnásom tele van angolnákkal I will not buy this record; it is scratched Nem fogok vásárolni ezt a rekordot; ez karcos qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-compiler-defines/0000755000175100017510000000000015154533055024635 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-compiler-defines/main.cpp0000644000175100017510000000010115154533055026255 0ustar runnerrunner#include "object.h" int main() { QObject o; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-compiler-defines/object.cpp0000644000175100017510000000011415154533055026603 0ustar runnerrunner#include "object.h" Object::Object(QObject *parent) : QObject(parent) { } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-compiler-defines/object.h0000644000175100017510000000450015154533055026253 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://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 OBJECT_H #define OBJECT_H #include // These were not defined during the moc run (QBS-1592). // Do not use Q_OS_UNIX here as it is a fallback value which is defined when nothing else is. #if defined(Q_OS_DARWIN) || defined(Q_OS_LINUX) || defined(Q_OS_WIN) || defined(Q_OS_HURD) \ || defined(Q_OS_WASM) class Object : public QObject { Q_OBJECT public: explicit Object(QObject *parent = nullptr); }; #endif #endif // OBJECT_H qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-compiler-defines/moc-compiler-defines.qbs0000644000175100017510000000010415154533055031340 0ustar runnerrunnerQtApplication { files: ["main.cpp", "object.h", "object.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/unmocable/0000755000175100017510000000000015154533055022601 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/unmocable/main.cpp0000644000175100017510000000010015154533055024220 0ustar runnerrunner#include "foo.h" int main() { return someNumber() - 156; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/unmocable/unmocable.qbs0000644000175100017510000000025715154533055025261 0ustar runnerrunnerApplication { Depends { name: "Qt.core" } files: ["main.cpp"] Group { files: ["foo.h"] fileTags: ["unmocable"] overrideTags: false } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/unmocable/foo.h0000644000175100017510000000007315154533055023535 0ustar runnerrunner#define Q_OBJECT 156 int someNumber() { return Q_OBJECT; } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/trackAddMocInclude/0000755000175100017510000000000015154533055024314 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/trackAddMocInclude/after/0000755000175100017510000000000015154533055025415 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/trackAddMocInclude/after/main.cpp0000644000175100017510000000304115154533055027043 0ustar runnerrunner/**************************************************************************** ** ** 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 class MyObject : public QObject { Q_OBJECT public: MyObject(QObject *parent = nullptr) : QObject(parent) { } }; int main(int argc, char **argv) { QCoreApplication app(argc, argv); const auto obj = new MyObject(&app); return app.exec(); } #include qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/trackAddMocInclude/before/0000755000175100017510000000000015154533055025556 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/trackAddMocInclude/before/main.cpp0000644000175100017510000000301415154533055027204 0ustar runnerrunner/**************************************************************************** ** ** 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 class MyObject : public QObject { Q_OBJECT public: MyObject(QObject *parent = nullptr) : QObject(parent) { } }; int main(int argc, char **argv) { QCoreApplication app(argc, argv); const auto obj = new MyObject(&app); return app.exec(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/trackAddMocInclude/before/test.qbs0000644000175100017510000000015515154533055027245 0ustar runnerrunnerApplication { Depends { name: "Qt.core" } cpp.cxxLanguageVersion: "c++11" files: ["main.cpp"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/included-moc-cpp/0000755000175100017510000000000015154533055023757 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/included-moc-cpp/main.cpp0000644000175100017510000000015515154533055025410 0ustar runnerrunner#include "myobject.h" int main() { MyObject o; QObject::connect(&o, &QObject::destroyed, [] { }); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/included-moc-cpp/myobject.h0000644000175100017510000000016515154533055025746 0ustar runnerrunner#ifndef MYOBJECT_H #define MYOBJECT_H #include class MyObject : public QObject { Q_OBJECT }; #endif qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/included-moc-cpp/myobject.cpp0000644000175100017510000000006315154533055026276 0ustar runnerrunner#include "myobject.h" #include qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/included-moc-cpp/included-moc-cpp.qbs0000644000175100017510000000047015154533055027612 0ustar runnerrunnerimport qbs.Utilities QtApplication { condition: { if (Utilities.versionCompare(Qt.core.version, "5.0") < 0) { console.info("using qt4"); return false; } return true; } files: [ "main.cpp", "myobject.cpp", "myobject.h", ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/0000755000175100017510000000000015154533055030161 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/object.cpp.in0000644000175100017510000000256715154533055032552 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 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 #include // class InternalClass : public QObject // { // Q_OBJECT // }; void Object::f() { } // #include qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/main.cpp0000644000175100017510000000243015154533055031610 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 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 "object.h" int main() { Object o; o.f(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/object.h0000644000175100017510000000240315154533055031577 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 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$ ** ****************************************************************************/ class Object { public: void f(); }; ././@LongLink0000644000000000000000000000020200000000000011575 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/add-qobject-macro-to-generated-cpp-file.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/add-qobject-ma0000644000175100017510000000111215154533055032647 0ustar runnerrunnerimport qbs.File QtApplication { name: "p" files: ["main.cpp", "object.h"] Group { files: "object.cpp.in" fileTags: "cpp.in" } Rule { inputs: "cpp.in" Artifact { filePath: input.completeBaseName fileTags: "cpp" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generatating " + output.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return cmd; } } cpp.includePaths: path } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-flags/0000755000175100017510000000000015154533055022504 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-flags/main.cpp0000644000175100017510000000242715154533055024141 0ustar runnerrunner/**************************************************************************** ** ** 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 "blubb.h" int main() { Blubb().makeBlubb(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-flags/blubb.h0000644000175100017510000000251715154533055023750 0ustar runnerrunner/**************************************************************************** ** ** 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 class Blubb : public QObject { Q_OBJECT public: Blubb() { } void makeBlubb() { } }; qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-flags/moc-flags.qbs0000644000175100017510000000006515154533055025064 0ustar runnerrunnerQtApplication { files: ["main.cpp", "blubb.h"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-adaptors/0000755000175100017510000000000015154533055023404 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-adaptors/main.cpp0000644000175100017510000000663015154533055025041 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "car.h" #include "car_adaptor.h" #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include #include #include #else #include #include #include #endif #include int main(int argc, char *argv[]) { QApplication app(argc, argv); QGraphicsScene scene; scene.setSceneRect(-500, -500, 1000, 1000); scene.setItemIndexMethod(QGraphicsScene::NoIndex); const auto car = new Car(); scene.addItem(car); QGraphicsView view(&scene); view.setRenderHint(QPainter::Antialiasing); view.setBackgroundBrush(Qt::darkGray); view.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Qt DBus Controlled Car")); view.resize(400, 300); view.show(); new CarInterfaceAdaptor(car); QDBusConnection connection = QDBusConnection::sessionBus(); connection.registerObject("/Car", car); connection.registerService("org.example.CarExample"); return app.exec(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-adaptors/THIS.IS.A.STRANGE.FILENAME.CAR.XML0000644000175100017510000000062415154533055030115 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-adaptors/car.cpp0000644000175100017510000001135515154533055024662 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "car.h" #include #include static const double Pi = 3.14159265358979323846264338327950288419717; QRectF Car::boundingRect() const { return {-35, -81, 70, 115}; } Car::Car() : color(Qt::green), wheelsAngle(0), speed(0) { startTimer(1000 / 33); setFlag(QGraphicsItem::ItemIsMovable, true); setFlag(QGraphicsItem::ItemIsFocusable, true); } void Car::accelerate() { if (speed < 10) ++speed; } void Car::decelerate() { if (speed > -10) --speed; } void Car::turnLeft() { if (wheelsAngle > -30) wheelsAngle -= 5; } void Car::turnRight() { if (wheelsAngle < 30) wheelsAngle += 5; } void Car::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(option); Q_UNUSED(widget); painter->setBrush(Qt::gray); painter->drawRect(-20, -58, 40, 2); // front axel painter->drawRect(-20, 7, 40, 2); // rear axel painter->setBrush(color); painter->drawRect(-25, -79, 50, 10); // front wing painter->drawEllipse(-25, -48, 50, 20); // side pods painter->drawRect(-25, -38, 50, 35); // side pods painter->drawRect(-5, 9, 10, 10); // back pod painter->drawEllipse(-10, -81, 20, 100); // main body painter->drawRect(-17, 19, 34, 15); // rear wing painter->setBrush(Qt::black); painter->drawPie(-5, -51, 10, 15, 0, 180 * 16); painter->drawRect(-5, -44, 10, 10); // cocpit painter->save(); painter->translate(-20, -58); painter->rotate(wheelsAngle); painter->drawRect(-10, -7, 10, 15); // front left painter->restore(); painter->save(); painter->translate(20, -58); painter->rotate(wheelsAngle); painter->drawRect(0, -7, 10, 15); // front left painter->restore(); painter->drawRect(-30, 0, 12, 17); // rear left painter->drawRect(19, 0, 12, 17); // rear right } void Car::timerEvent(QTimerEvent *event) { Q_UNUSED(event); const qreal axelDistance = 54; qreal wheelsAngleRads = (wheelsAngle * Pi) / 180; qreal turnDistance = ::cos(wheelsAngleRads) * axelDistance * 2; qreal turnRateRads = wheelsAngleRads / turnDistance; // rough estimate qreal turnRate = (turnRateRads * 180) / Pi; qreal rotation = speed * turnRate; setTransform(QTransform().rotate(rotation), true); setTransform(QTransform::fromTranslate(0, -speed), true); update(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-adaptors/car.h0000644000175100017510000000351015154533055024321 0ustar runnerrunner/**************************************************************************** ** ** 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 CAR_H #define CAR_H #include #include class Car : public QGraphicsObject { Q_OBJECT public: Car(); QRectF boundingRect() const; public Q_SLOTS: void accelerate(); void decelerate(); void turnLeft(); void turnRight(); Q_SIGNALS: void crashed(); protected: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); void timerEvent(QTimerEvent *event); private: QBrush color; qreal wheelsAngle; // used when applying rotation qreal speed; // delta movement along the body axis }; #endif // CAR_H qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/dbus-adaptors/car.qbs0000644000175100017510000000062115154533055024657 0ustar runnerrunnerCppApplication { name: "car" condition: Qt.dbus.present cpp.cxxLanguageVersion: "c++11" Depends { name: "Qt.dbus"; required: false } Depends { name: "Qt.widgets" } files: [ "car.cpp", "car.h", "main.cpp", ] Group { name: "DBUS Adaptor" files: ["THIS.IS.A.STRANGE.FILENAME.CAR.XML"] fileTags: ["qt.dbus.adaptor"] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools-linking/0000755000175100017510000000000015154533055024614 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools-linking/main.cpp0000644000175100017510000000027115154533055026244 0ustar runnerrunner#include #include #include int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); return 0; }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools-linking/shadertools-linking.qbs0000644000175100017510000000032115154533055031277 0ustar runnerrunnerimport qbs QtApplication { name: "shadertools-linking-test" type: "application" Depends { name: "Qt.shadertools" } files: ["shader.frag", "main.cpp"] Qt.shadertools.enableLinking: true }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/shadertools-linking/shader.frag0000644000175100017510000000021315154533055026717 0ustar runnerrunner#version 440 precision mediump float; layout(location = 0) out vec4 fragColor; void main() { fragColor = vec4(1.0, 0.0, 0.0, 1.0); }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/find-shadertools.qbs0000644000175100017510000000110515154533055024605 0ustar runnerrunnerimport qbs.Utilities CppApplication { name: "check_shadertools" Depends { name: "Qt.core" } Depends { name: "Qt.shadertools"; required: false } property bool dummy: { console.info("is qt6: " + JSON.stringify(Utilities.versionCompare(Qt.core.version, "6.0") >= 0)); console.info("is static qt: " + JSON.stringify(Qt.core.staticBuild)); console.info("is shadertools present: " + JSON.stringify(Qt.shadertools.present)); console.info("has viewCount: " + JSON.stringify(Utilities.versionCompare(Qt.core.version, "6.7.0") >= 0)); } }qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/create-project/0000755000175100017510000000000015154533055023543 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/create-project/dummy.txt0000644000175100017510000000000015154533055025425 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-change-tracking/0000755000175100017510000000000015154533055024435 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-change-tracking/class.h0000644000175100017510000000023715154533055025715 0ustar runnerrunner#pragma once #include class Class1 : public QObject { Q_OBJECT public: Class1() = default; void foo(); signals: void ready(); }; qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-change-tracking/moc-change-tracking.qbs0000644000175100017510000000017215154533055030745 0ustar runnerrunnerDynamicLibrary { Depends {name: "Qt.core" } files: ["class.cpp", "class.h"] // cpp.combineCxxSources: true } qbs-src-3.2.0/tests/auto/blackbox/testdata-qt/moc-change-tracking/class.cpp0000644000175100017510000000005215154533055026243 0ustar runnerrunner#include "class.h" void Class1::foo() {} qbs-src-3.2.0/tests/auto/blackbox/tst_clangdb.cpp0000644000175100017510000001766115154533055021404 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 Christian Gagneraud. ** 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 "tst_clangdb.h" #include "../shared.h" #include #include #include #include #include #include #include #include #include using qbs::InstallOptions; using qbs::Internal::HostOsInfo; int TestClangDb::runProcess(const QString &exec, const QStringList &args, QByteArray &stdErr, QByteArray &stdOut) { QProcess process; QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(processEnvironment); process.setProcessEnvironment(env); process.start(exec, args); const int waitTime = 10 * 60000; if (!process.waitForStarted() || !process.waitForFinished(waitTime)) { stdErr = process.readAllStandardError(); return -1; } stdErr = process.readAllStandardError(); stdOut = process.readAllStandardOutput(); sanitizeOutput(&stdErr); sanitizeOutput(&stdOut); if (process.exitStatus() != QProcess::NormalExit || process.exitCode() != 0) { if (!stdErr.isEmpty()) qDebug("%s", stdErr.constData()); if (!stdOut.isEmpty()) qDebug("%s", stdOut.constData()); } return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1; } qbs::Version TestClangDb::clangVersion() { QByteArray stdErr; QByteArray stdOut; if (runProcess("clang-check", QStringList("--version"), stdErr, stdOut) != 0) return qbs::Version(); stdOut.remove(0, stdOut.indexOf("LLVM version ") + 13); stdOut.truncate(stdOut.indexOf('\n')); return qbs::Version::fromString(QString::fromLocal8Bit(stdOut)); } TestClangDb::TestClangDb() : TestBlackboxBase(SRCDIR "/testdata-clangdb", "blackbox-clangdb"), projectDir(QDir::cleanPath(testDataDir + "/project1")), projectFileName("project.qbs"), buildDir(QDir::cleanPath(projectDir + "/" + relativeBuildDir())), sourceFilePath(QDir::cleanPath(projectDir + "/i like spaces.cpp")), dbFilePath(QDir::cleanPath(buildDir + "/compile_commands.json")) { } void TestClangDb::initTestCase() { TestBlackboxBase::initTestCase(); QDir::setCurrent(projectDir); } void TestClangDb::ensureBuildTreeCreated() { QCOMPARE(runQbs(), 0); QVERIFY(QFile::exists(buildDir)); isMsvc = m_qbsStdout.contains("is msvc"); isMingw = m_qbsStdout.contains("is mingw"); if (isMsvc || isMingw) { sanitizeOutput(&m_qbsStdout); const auto lines = m_qbsStdout.split('\n'); for (const auto &line : lines) { static const QByteArray includeEnv = "INCLUDE="; static const QByteArray libEnv = "LIB="; static const QByteArray pathEnv = "PATH="; if (line.startsWith(includeEnv)) processEnvironment.insert("INCLUDE", line.mid(includeEnv.size())); if (line.startsWith(libEnv)) processEnvironment.insert("LIB", line.mid(libEnv.size())); if (line.startsWith(pathEnv)) processEnvironment.insert("PATH", line.mid(pathEnv.size())); } } } void TestClangDb::checkCanGenerateDb() { QbsRunParameters params; params.command = "generate"; params.arguments << "--generator" << "clangdb"; QCOMPARE(runQbs(params), 0); QVERIFY(QFile::exists(dbFilePath)); } void TestClangDb::checkDbIsValidJson() { QFile file(dbFilePath); QVERIFY(file.open(QFile::ReadOnly)); const QJsonDocument doc = QJsonDocument::fromJson(file.readAll()); QVERIFY(!doc.isNull()); QVERIFY(doc.isArray()); } void TestClangDb::checkDbIsConsistentWithProject() { QFile file(dbFilePath); QVERIFY(file.open(QFile::ReadOnly)); const QJsonDocument doc = QJsonDocument::fromJson(file.readAll()); // We expect only one command for now const QJsonArray array = doc.array(); QVERIFY(array.size() == 1); // Validate the "command object" const QJsonObject entry = array.at(0).toObject(); QVERIFY(entry.contains("directory")); QVERIFY(entry.value("directory").isString()); QVERIFY(entry.contains("arguments")); QVERIFY(entry.value("arguments").isArray()); QVERIFY(entry.value("arguments").toArray().size() >= 2); QVERIFY(entry.contains("file")); QVERIFY(entry.value("file").isString()); QVERIFY(entry.value("file").toString() == sourceFilePath); // Validate the compile command itself, this requires a previous build since the command // line contains 'deep' path that are created during Qbs build run QByteArray stdErr; QByteArray stdOut; QStringList arguments; const QJsonArray jsonArguments = entry.value("arguments").toArray(); QString executable = jsonArguments.at(0).toString(); for (int i=1; i/i like spaces.cpp:11:5: warning: Assigned value is garbage or undefined // int unused = garbage; // ^~~~~~~~~~ ~~~~~~~ // <...>/i like spaces.cpp:11:9: warning: Value stored to 'unused' during its initialization is never read // int unused = garbage; // ^~~~~~ ~~~~~~~ // 2 warnings generated. void TestClangDb::checkClangDetectsSourceCodeProblems() { QByteArray stdErr; QByteArray stdOut; QStringList arguments; const QString executable = findExecutable(QStringList("clang-check")); if (executable.isEmpty()) QSKIP("No working clang-check executable found"); // Older clang versions do not support the "arguments" array in the compilation database. // Should we really want to support them, we would have to fall back to "command" instead. if (clangVersion() < qbs::Version(3, 7)) QSKIP("This test requires clang-check to be based on at least LLVM 3.7.0."); // clang-check.exe does not understand MSVC command-line syntax if (isMsvc) arguments << "-extra-arg-before=--driver-mode=cl"; else if (isMingw) arguments << "-extra-arg-before=--driver-mode=g++"; arguments << "-analyze" << "-p" << relativeBuildDir() << sourceFilePath; QVERIFY(runProcess(executable, arguments, stdErr, stdOut) == 0); const QString output = QString::fromLocal8Bit(stdErr); QVERIFY(output.contains(QRegularExpression(QStringLiteral("warning.*undefined"), QRegularExpression::CaseInsensitiveOption))); QVERIFY(output.contains(QRegularExpression(QStringLiteral("warning.*never read"), QRegularExpression::CaseInsensitiveOption))); } QTEST_MAIN(TestClangDb) qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxproviders.h0000644000175100017510000000500515154533055023167 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef TST_BLACKBOXPROVIDERS_H #define TST_BLACKBOXPROVIDERS_H #include "tst_blackboxbase.h" class TestBlackboxProviders : public TestBlackboxBase { Q_OBJECT public: TestBlackboxProviders(); private slots: void allowedValues(); void allowedValues_data(); void brokenProvider(); void conanProvider(); void conanProvider_data(); void conanFileProbe(); void moduleProviders(); void moduleProvidersCache(); void nonEagerModuleProvider(); void probeInModuleProvider(); void providersCondition(); void providersConditionProbes(); void providersProperties(); void qbsModulePropertiesInProviders(); void qbsModuleProviders_data(); void qbsModuleProviders(); void qbsModuleProvidersCliOverride(); void qbsModuleProvidersCliOverride_data(); void qbsModuleProvidersCompatibility(); void qbsModuleProvidersCompatibility_data(); void qbspkgconfigModuleProvider(); void qtBug51237(); void removalVersion(); }; #endif // TST_BLACKBOXPROVIDERS_H qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/0000755000175100017510000000000015154533055021311 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/privacymanifest/0000755000175100017510000000000015154533055024515 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/privacymanifest/Lib.h0000644000175100017510000000234615154533055025401 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int foo(); qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/privacymanifest/Lib.cpp0000644000175100017510000000236715154533055025737 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int foo() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/privacymanifest/PrivacyInfo.xcprivacy0000644000175100017510000000065515154533055030706 0ustar runnerrunner NSPrivacyTracking NSPrivacyTrackingDomains NSPrivacyAccessedAPITypes NSPrivacyCollectedDataTypes qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/privacymanifest/privacymanifest.qbs0000644000175100017510000000110015154533055030420 0ustar runnerrunnerProject { Library { Depends { name: "cpp" } Depends { name: "bundle" } property bool isShallow: { console.info("isShallow: " + bundle.isShallow); return bundle.isShallow; } Group { condition: qbs.targetOS.includes("darwin") files: ["PrivacyInfo.xcprivacy"] fileTags: ["bundle.input.privacymanifest"] } name: "Lib" bundle.isBundle: true bundle.publicHeaders: ["Lib.h"] files: ["Lib.cpp"].concat(bundle.publicHeaders || []) } }qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/infoPlistVariables/0000755000175100017510000000000015154533055025111 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/infoPlistVariables/infoPlistVariables.qbs0000644000175100017510000000063415154533055031423 0ustar runnerrunnerCppApplication { Depends { name: "bundle" } cpp.minimumMacosVersion: "10.7" files: ["main.c", "Info.plist"] Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: true bundle.identifierPrefix: "com.test" bundle.extraEnv: { var result = original; result["EXE"] = "EXECUTABLE"; return result; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/infoPlistVariables/Info.plist0000644000175100017510000000156615154533055027071 0ustar runnerrunner Curly ${EXECUTABLE_NAME} Braces $(EXECUTABLE_NAME) At @EXECUTABLE_NAME@ CurlyMult ${EXECUTABLE_NAME}_${PRODUCT_NAME} BracesMult $(EXECUTABLE_NAME)_$(PRODUCT_NAME) AtMult @EXECUTABLE_NAME@_@PRODUCT_NAME@ CurlyNested ${${EXE}_NAME} BracesNested ${${EXE}_NAME} WithDefault ${NON_EXISTING:default=DEFAULT} qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/infoPlistVariables/main.c0000644000175100017510000000003115154533055026173 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/deploymentTarget/0000755000175100017510000000000015154533055024640 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/deploymentTarget/deployment.qbs0000644000175100017510000000113215154533055027524 0ustar runnerrunnerCppApplication { files: ["main.c"] // Minimum deployment targets that: // - will actually link (as of Xcode 8.1) // - exist for the given architecture(s) cpp.minimumMacosVersion: { if (qbs.architecture === "arm64") return "11.0"; if (qbs.architecture === "x86_64h") return "10.12"; return "10.6"; } cpp.minimumIosVersion: ["armv7s", "arm64", "x86_64"].includes(qbs.architecture) ? "7.0" : "6.0" cpp.minimumTvosVersion: "9.0" cpp.minimumWatchosVersion: "2.0" cpp.driverFlags: ["-v"] cpp.linkerFlags: ["-v"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/deploymentTarget/main.c0000644000175100017510000000236415154533055025735 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/codesign-destination-directory/0000755000175100017510000000000015154533055027425 5ustar runnerrunner././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/codesign-destination-directory/project-build-directory.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/codesign-destination-directory/project-build-direct0000644000175100017510000000033215154533055033361 0ustar runnerrunnerProject { CppApplication { name: "app" files: ["main.c"] codesign.enableCodeSigning: true codesign.signingType: "ad-hoc" destinationDirectory: project.buildDirectory } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/codesign-destination-directory/main.c0000644000175100017510000000012415154533055030512 0ustar runnerrunner#include int main(void) { printf("Hello, World!\n"); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/byteArrayInfoPlist/0000755000175100017510000000000015154533055025103 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/byteArrayInfoPlist/byteArrayInfoPlist.qbs0000644000175100017510000000223315154533055031404 0ustar runnerrunnerimport qbs.BundleTools import qbs.TextFile CppApplication { Depends { name: "bundle" } cpp.minimumMacosVersion: "10.7" files: ["main.c", "ByteArray-Info.plist"] type: base.concat(["txt_output"]) Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: true bundle.identifierPrefix: "com.test" } Rule { inputs: ["aggregate_infoplist"] Artifact { filePath: input.fileName + ".out" fileTags: ["txt_output"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName + " from " + input.fileName; cmd.highlight = "codegen"; cmd.sourceCode = function() { var plist = new BundleTools.infoPlistContents(input.filePath); var content = plist["DataKey"]; var int8view = new Uint8Array(content); file = new TextFile(output.filePath, TextFile.WriteOnly); file.write(String.fromCharCode.apply(null, int8view)); file.close(); } return [cmd]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/byteArrayInfoPlist/ByteArray-Info.plist0000644000175100017510000000054615154533055030760 0ustar runnerrunner DataKey VGhlIGRhdGEgdmFsdWU= StringKey The string value qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/byteArrayInfoPlist/main.c0000644000175100017510000000003115154533055026165 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/objc-arc/0000755000175100017510000000000015154533055022771 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/objc-arc/mrc.m0000644000175100017510000000010515154533055023724 0ustar runnerrunner#if __has_feature(objc_arc) #error Using ARC but shouldn't be #endif qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/objc-arc/objc-arc.qbs0000644000175100017510000000061615154533055025163 0ustar runnerrunnerProduct { Depends { name: "cpp" } consoleApplication: true type: ["application"] condition: qbs.targetOS.includes("darwin") Group { cpp.automaticReferenceCounting: true files: ["arc.m", "arc.mm"] } Group { cpp.automaticReferenceCounting: false files: ["mrc.m", "mrc.mm"] } files: "main.m" cpp.minimumMacosVersion: "10.7" } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/objc-arc/arc.mm0000644000175100017510000000010715154533055024067 0ustar runnerrunner#if !__has_feature(objc_arc) #error Not using ARC but should be #endif qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/objc-arc/arc.m0000644000175100017510000000010715154533055023712 0ustar runnerrunner#if !__has_feature(objc_arc) #error Not using ARC but should be #endif qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/objc-arc/main.m0000644000175100017510000000013615154533055024073 0ustar runnerrunner#if __has_feature(objc_arc) #error Using ARC but shouldn't be #endif int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/objc-arc/mrc.mm0000644000175100017510000000010515154533055024101 0ustar runnerrunner#if __has_feature(objc_arc) #error Using ARC but shouldn't be #endif qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/multiarch-helpers.js0000644000175100017510000000641215154533055025302 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Host = require("qbs.Host"); var Utilities = require("qbs.Utilities"); // Typically, multiple architectures are used for migration from "old" arch to a "new" one // For example: x86 -> x86_64 on macOS, armv7 -> arm64 on iOS function enableOldArch(qbs, xcodeVersion) { return qbs.targetOS.includes("macos") && xcodeVersion && (Utilities.versionCompare(xcodeVersion, "10") < 0 || Utilities.versionCompare(xcodeVersion, "12.2") >= 0) || (qbs.targetOS.includes("ios") && !qbs.targetOS.includes("ios-simulator") && Utilities.versionCompare(xcodeVersion, "14") < 0) } function getNewArch(qbs, xcodeVersion) { const isNewXcode = xcodeVersion && Utilities.versionCompare(xcodeVersion, "12.2") >= 0; if (qbs.targetOS.includes("macos")) return isNewXcode ? "arm64" : "x86_64"; else if (qbs.targetOS.includes("ios-simulator")) return "x86_64"; else if (qbs.targetOS.includes("ios")) return "arm64" else if (qbs.targetOS.includes("tvos")) return "arm64" else if (qbs.targetOS.includes("watchos")) return "armv7k" throw "unsupported targetOS: " + qbs.targetOS; } function getOldArch(qbs, xcodeVersion) { if (qbs.targetOS.includes("macos")) return xcodeVersion && Utilities.versionCompare(xcodeVersion, "12.2") >= 0 ? "x86_64" : "x86"; else if (qbs.targetOS.includes("ios-simulator")) return "x86" else if (qbs.targetOS.includes("ios")) return "armv7a" throw "unsupported targetOS: " + qbs.targetOS; } function getArchitectures(qbs, xcodeVersion) { return enableOldArch(qbs, xcodeVersion) ? [getOldArch(qbs, xcodeVersion), getNewArch(qbs, xcodeVersion)] : [getNewArch(qbs, xcodeVersion)]; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/0000755000175100017510000000000015154533055021703 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/0000755000175100017510000000000015154533055026446 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/0000755000175100017510000000000015154533055033036 5ustar runnerrunner././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/o0000755000175100017510000000000015154533055033215 5ustar runnerrunner././@LongLink0000644000000000000000000000020400000000000011577 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16@2x.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/o0000644000175100017510000000123115154533055033214 0ustar runnerrunnerPNG  IHDR szzsRGB pHYs%%IR$iTXtXML:com.adobe.xmp 4 4 1 #2IDATX A 1g ٻx\=/ @ 0M<^IENDB`././@LongLink0000644000000000000000000000020100000000000011574 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/icon_16x16.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/o0000644000175100017510000000121115154533055033212 0ustar runnerrunnerPNG  IHDRasRGB pHYs  iTXtXML:com.adobe.xmp 4 4 1 #"IDAT8c & 􂵎0a k IENDB`././@LongLink0000644000000000000000000000020000000000000011573 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/other.imageset/Contents.jsonqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog2.xcassets/o0000644000175100017510000000053315154533055033220 0ustar runnerrunner{ "images" : [ { "idiom" : "universal", "scale" : "1x", "filename" : "icon_16x16.png" }, { "idiom" : "universal", "scale" : "2x", "filename" : "icon_16x16@2x.png" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } }qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/0000755000175100017510000000000015154533055033035 5ustar runnerrunner././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/o0000755000175100017510000000000015154533055033214 5ustar runnerrunner././@LongLink0000644000000000000000000000020400000000000011577 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16@2x.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/o0000644000175100017510000000123115154533055033213 0ustar runnerrunnerPNG  IHDR szzsRGB pHYs%%IR$iTXtXML:com.adobe.xmp 4 4 1 #2IDATX A 1g ٻx\=/ @ 0M<^IENDB`././@LongLink0000644000000000000000000000020100000000000011574 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/icon_16x16.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/o0000644000175100017510000000121115154533055033211 0ustar runnerrunnerPNG  IHDRasRGB pHYs  iTXtXML:com.adobe.xmp 4 4 1 #"IDAT8c & 􂵎0a k IENDB`././@LongLink0000644000000000000000000000020000000000000011573 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/other.imageset/Contents.jsonqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/assetcatalog1.xcassets/o0000644000175100017510000000053315154533055033217 0ustar runnerrunner{ "images" : [ { "idiom" : "universal", "scale" : "1x", "filename" : "icon_16x16.png" }, { "idiom" : "universal", "scale" : "2x", "filename" : "icon_16x16@2x.png" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } }././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/multiple-asset-catalogs.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/multiple-asset-catalogs.0000644000175100017510000000022615154533055033212 0ustar runnerrunnerCppApplication { Depends { name: "ib" } files: [ "main.c", "assetcatalog1.xcassets", "assetcatalog2.xcassets" ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/multiple-asset-catalogs/main.c0000644000175100017510000000236415154533055027543 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/0000755000175100017510000000000015154533055024050 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/0000755000175100017510000000000015154533055027711 5ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000755000175100017510000000000015154533055033143 5ustar runnerrunner././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/64.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000000762015154533055033152 0ustar runnerrunnerPNG  IHDR@@iqsRGBDeXIfMM*i@@FQBIDATxZ tWdԖV JajR NGZj:SKmLK(δڪ uD )(!vEB Wĝ{%|I8w{{U`!z iXc)4ߧ *(X=8֫~rppP`啯f6r/8ĪCለԩ5nܘ&NHD@OD2%QÇGԮ],Y¢1n ~Lc╙ɳgU*X,Q`mۖŒe 4ٸq#7jP n8p ?^A4P)JXڵZqR#~6|Yo]A0_5 r t*UDG:\#⫆B΀~...4rH޽[y\LK *Zb/_~~~ʚݠpի9r*˂RsP*/ bCv숌S׍VǓ'Ofwww4i›6m3mQ)Yiqa+k  YSr?35j[VoGwT/JTQ4IJT&CHHͤovDҡ#(󭦻]>VɊ-t܅|<)OEbxPJF6 ;)ըV,^}#JK 뷓XS_ʛ@9w5boܡ6keaUw{ b)YVa؇KpT,=S29Cy[ :ݙbݦ5;=ɉ~:E{gP+ՆBfu<@3{! LDn=$(aE/XQ\`t.`yj-%f,,̬@V>^x/nݺQvԎѩ?6M?w(:Nr(_5nt*!Oǎy޽}p߼${43ڸKop7"7 ,`___w}^2f"/ݲ6gQv>~vdfB .ZϞedoݙC/P:rQi 7~[n@ z\Νy$*/7_6mʛ7o_N_r-Ԋ._5Xf|Tss8&&Ǎg/0j p@G\^  ~%txx8{zz*塜Y:hE`i`C9s1\zBDs,y;5yaxʔ)lfPرc E4]I4[C^~Cm 2/ij߾} aC`9SPWYIkJz%ab5UTQVV(\~[@$r現ڮ"\s ͛@jݺ5nLIK6r!"WC|˔jժ=X5^Cz9<|27-kڲ<Zs7&qoౘ^],w @X[Yiw)rG'YVPAxt+)U.K wIz۟X+m@",p% "yJ\(py'Sg;'4yv9ͣ8ky1%)*m "2#S.YwI.!I jIv@./)-VN/N2d%t.-6y' UA"}ԝ{j[9!%M^|xТIh'#LzP jX}ʖmҖd9m4fpe]ԃHT|A /8 PgWV"Aq4V{F^vj7$˕ ڒQGr[Qoi_Y@p-kXc wVÍHޑPodųJ,pCyQpp… U&sիC#҂j5C\g v,k>tRq .`$[NZ-1nf'񎈓F*iii=<<ꋢ%Jj[x1ߟ=<FcX#*a67wB؊:.ȎlJ4SJS .jTzj%wD*sԹ)IENDB`././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/216.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000003672715154533055033164 0ustar runnerrunnerPNG  IHDR -sRGBDeXIfMM*iؠ3j=AIDATx]|tB]Jo"M:H QĆ +ұQ{z wus\ٻr{3oٙ7 NO('B54`4|H 0W)y@S!quњ`4|H 0׹n޼I͈3eBwR 䣞eʔI!J|رTRƌ\ 1\")t)惾` BkAKmݺuF=zW_}ׯOӦM|6}6(R^wI>|8}t5PRwߥ o LB`^Ge)_ӰaѣCR&SO=Eo,YRC j h9sf)i޼y[oц 70əV.\L>,e˖F`;t Xv!C2hHƚ5k;CݻwlxXgϞ#GѣetPie2zZQ@ҥgkז")%O,44OCX)j$Y͚5+=3kQb$ϒ?4<"g?kV^-w<(>,V/^^u۷J;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@xml1HV+*:R(ZxE fowt͞8aEqe@'ʜd`nq޽2ƾﶍg(S;kPs!p~ϕo4QʁdpvK@ITA\ERIENDB`././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/172.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000002762315154533055033157 0ustar runnerrunnerPNG  IHDR1GsRGBDeXIfMM*i.IDATx]E~]‚DaHDTD맊+frHgj$ s:'MTZx#Q?A"W{ks.)UW]E?]s5[)ers\h  ׎h/m۶EvQO =}Q PǝoTE75HW$VK .`RRӧ*Z pTZU1BQFvy@5P$"+2.Ö`ںuz衇Lf:yb B 7xC8qB ter yf?T! ;ΝZnm&y*ڵkWkLQ d&GD9=!ғW4^w2jⵢK+iC]t5s`rm|תJ*vQ-ZP3f0E4b ri|=qJk(5{65g,ߤfdFE'I"Y$V<̙CK}7eч _~-[FL#e e薞Giׁ#T0  s礸394j:tSj2*jΊû`r{QӨqİbz.`рGn)OtvZm/]__剑3Nx$)_!ʌi! q6ms"ME/ |މA^fD.XM1sѕ`0xE>(_,mOť['W ,\0[nꫯҔ)S_?O5vٝ2_a-YGycc|uXlܱRMx(Sf`/r( 4;6,q#vńT6I *[!5R n4`a?(j.]i;e6~ k &TMaFd4\/,sTUj\ل67_wXZTwyFiaАnѺ{iphR<Ľ( +#Ҿ,|q06n:}=P_xN>AE@18 dxzenT_1f3&/Hx8 }Dn8 a 'B+P[ c+5*"^sf䓧B' (;ǩJRS[XZȌMkV:JӴ57YXx;zzv/KmϚ>c1p1Ee! # 9b޶G9yief^ECn5^&-\G+7ye6pdɜ݂9vb 2׫CB;V%ߌNx[xݴ G1oJH}FԘO\6ܥX^^)L-Sgoj`+%32HB(df,zu,4uሑY Skh\W Xg|n\sUB^wjʒ F~n2lm)5TفnlTE*Hf]uֹJRkJ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씀G DmWJ\^f<9%mG W2;%X?ft1IENDB`././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/72.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000001065515154533055033154 0ustar runnerrunnerPNG  IHDRHHUGsRGBDeXIfMM*iHH1FIDATx[gtT.QBDG!>T'bS|hclPm` EJ1!  ~] ~htV7ok NT"`o ڵkSZlXeEW+@ٕ^ vu `%SNXX9/_NU6U6ަʿs玘<0yl:@A`ða40Kt-=H8-֯_/TTejUURj0CA1FC~u[n"..NI $*((1}t$FG{<~ :mM*o e)5\7wMuiݫU Q)-qUu)bŽG)@7 ]t)g?P<|P~_9:*gY9"*V'dK* 2%y'\^~W~X3vߩbc++@IJe˄NG.\Q'£+S>K(5#K|~X~&bTJ+5lx΢o~W'/@<-3ӐB]!q5WɆ*iΜ9@ԩS L}/Y=Zl|"M}]#n~*ӑn'&Ơz{Zf2C57q٨/yץ)%0Fqu'=8¯mFܩ yqF9s&iӆ\\\wHIϢ -{OPJz&5FyvgxHtoGhOΎ 4r-V 8؛'"Hp{y`oGvt#ڰ$C7 ţڵChŶtnqlDҒtlC/ӹkwip?ےb >uZm ~F٠3Ξ`ҎuKnGi9+wτA{]7` 2]Kn H9xx^ |EF2aP^cXl<4xuU/ZVe d ym.1[链N}[W {xD9y]u~`q*#+Gc2Qn^Sçiՠ>n*aXܳc3sdz r,C};%'^` iҐ2rro.k#fv6ބ1x137ɻ#ǻԛѡ95Oՠ 7"mJ(;7TkՌ>~ן~F?9Nن#ⱈQ.Ύ̴ZTCrR!_k:ѧFрjmPɋ G<@ݺ,Y,Lt2ȃҌ߽!g8 WUHwjE4s̥K.<#VZF'-3zKx٧iԱUS2'V%$$мyșZ'OOO:lL[xB6g A.;ffN\'mƼ3^bEn*qgG;Ѕǰx#AP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y+I][o(J1t&S]}|(Nd`Ͽ/u͂:=xunRO#_^ejnJ j0W|-kOR3)n璏[.煚j{ȳew,HYdeP3ssq&7f Pʚ {)E^p#,,oƱ.9;9j;O"ӗ;;CH+0k۪P+0uʽR>Iӽ'M mi^ @/ΙL?>T]3νvXYe~ӓ(vR)8h @ɦSy]-4WifńK`K O,#S-9w+4CnXT׋j ~F4󲲲).n57yME8}Ӆ _`y(>NK^ѦMg +!C_!O_RJy&F;#gY&f+TEyetRꊳA>ѣZ ^zgH:/8i`Oh4iѣGk^HnWX!Lؿ}$}|H!ץ ݦE`xr" @ A9w\TjEyUU9}:S̜9Sc7tP*z tW8ŠA>>$.{RSтTU׈۾>Q gS8>G=#iگZL8Qׯ+Ӵf"rkgW̼Ws}\8X.(J5,F;-Yk)""f̘>=Jk8 />h"BX;f_B)<MtXd6p)T.:wFQ'zK].|h! 45Yj[,"U>dae .hPWcSՏ6 'Fа~^;*JHk\z:Һ?jkΞ=[J6jgwo QGI#4Hc:fy':aqڿ{N4v|@ 'R!K ]_GK^ a]fǧ`!!`2ߨÅc;QӁ+MJ΀Ό~)N\@K N4ւ1GK!U$ ~9S^/, ~u @,7(IHLJMX}CG}~(؞XDSHm6"s|=}JTspB}K2 (+-()9h">f@3( !f&$`@f!{"##BGBdNcϰqzlBٌ!mfa2=A-XuOM#qܞh3TTzT߯EJoɋUT<:ܨ;pю#obMp ydFll T*wH^{?*kL3W/ZF6>3OUEˈ{󲐜Rc27/7s4Bnێ0Z{M"_qGBr&8?| ۃ;&Aͤ;W|x Yy|r:>k[m!kD::;hdtBf2Oa\^f"d! W^ J_seejSuNk`N338q~m-EQIENDB`././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/16.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000000145315154533055033150 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O+nksVVqoP?Ʒȍ!]D'|8t`x7>J< L9 ­hDX?Mו[:\y.@A! uf"l&oNZ?ԩ,pSt*qXOH`BAkꭼ$peG~9/]y5rÜϚWÇ$s 6Z`OoUn'shڜYCљN ,? ϛ;߼)?^IrHUܽ2OG6K4x;g O+08z< /s' 6r"b0 W7\pfx=[^ ԨvrK9h1ש.!/g\~4Í2@jR=w'4QPG?́IsڗVMyj#`'0{mi09&+b&ΰPޮa `0ڛb* &!X.g@w% $0mP4T;I1"|׷`gFntͮ>3h%^ '#;mE{;*.iEޤNeZ !t%vGm]20׏f!l5ZujHvh3 P>Ǝ+|… MM= ~+jR3?%msOab,SnlČ7Xsٖ}oDßHU P"WzSf 'c)+ĝuRe`ӐnWLcUf,:qZ x5_SߧpK_{f# )!)YScl4Iպ,#B"(Cӈwk½cc!J֬^q1 u4}di)וI_s5;O> ~:iтМ؟)sJ9d襝A0\RDZͥ6'k*cűtGitt'B]U&GR\y1* ~@eG+P aN@r[Z!h%(@$ګUV)xj&QfM_F4m4Fkkm$‘!"~Z ϟ?^V0k}衇ݻMtռPHG+ݫ}fΜ-[#[nt񦓪yGHU;U hV #ĉbҩ<HM$z <0ԊW:|Lߊ ]/Hp+BvhOoČ'>~P(XO8lfTdd&Z+fr8(,х&\6MiӦ,S^BSwZgC Ύ} -)0C_)ț5LK~ }EH?>_#@|~#j5pGH?>_#@|~#j5pGK+e+IENDB`././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/50.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000000600315154533055033144 0ustar runnerrunnerPNG  IHDR22?sRGBDeXIfMM*i22u˯ mIDAThY{pA!(01*O @%HP(ȣ)Ӂ2;+#j)NQB-hʹTKP-o Q $@xJIHI"7M߹/7 w9;gw{η]."jjj2Y, HcՕ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␜ڰa}:y@[P#){.ޢ9MM| b/^[RԩSϽpNDl1ϐ@񻹜,Znep6'ngJt<9J& Z \ :t(될 2iؗo_GM#iX#BG[~Ce 9iݺ| sƟ[Y>рr]_sP˔J7g8 +eς^<^d E>OӿHJ'+B6`<.p%k[jhÕ'u\)dyNo2eu/7эSXrǰMM 2vLGX dObޝ)Q)2}Z`Arn7Ewv]6c_^HH2؋$Ҟ uXG=\dF.1C{X+9*xs޷=նm='<= w GPON~n Fz2|^Rԓ]ER焐 J-dqƐG*8|FE' d "E8v`q<>:{x DծU'FUeC@:Fn0ɶ8]%RH /-pe||P&SDIڸqco%PnԨ7o˛:Xws犆 @X/&\~d);@}( @ӁwyoРA3~XPE˨X"2x2֨Jپ}{vZU]w5 8%\"׭[' ٙVDZѫ *֫Hɏ0~/\#9ϋ|IZH`y>Tjd0E40a˚߫NX zh'v^kډZ`-v"`X {YzIENDB`././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/32.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000000345315154533055033152 0ustar runnerrunnerPNG  IHDR szzsRGBDeXIfMM*i  bIDATX WkLTW XM+%6AjjjQhl&hSӴiQ6b 5E((`w3WaI̙39g{oJ^/( u}P dM&BCC(J ͐8ity|444_Io_Ԝ< O[v 25ʺP$ĎBVgTF8\]pke th((E:BMrd|l=pV @ Ҁep,x/F "_U  :r]dZZr Ta}lZq>ȇAAA ]]͗y$ 8p!AV)K-]rhh\E/GM_f[S&؈YZ"w-6'tR)I>MIaz1Ơ$2@Fr+Z7e|r0]2cqv'L?~ے ۲֛!}d6~XR* Վk|1"7U\G㮝;vtc}Uvij38}RL4ucՁ:,bC>]ՠ`;ۭfb0ΘnL@6YۯYFc;fHz?N5l&ۋ_#A;P}iLNNKSSSYtta˝۸:;C%;3I_ 6_GTR ͉*v(=\GcL~2 W;wlǨ("lXi,:nD+hp F' H$0[XG%Ouv#GğlB݉"BfTI?yd,}|**BpjZ0V&Fd $@MAK8o<9(g 66d@s'aRRt?gz:2?,2`R(}29hgu4 _oltIENDB`././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/100.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000001477415154533055033162 0ustar runnerrunnerPNG  IHDRddpTsRGBDeXIfMM*idd/AfIDATx] |M_IH"i 5-zxJ5u NOھ)-Y9J1ADC<쓓$7q͍/{^{/Ņʊpc()#D8P*_vozؼo.h>ׯ_?sN\Z)@`b4:uW`h`^?*66Fa(%իUΝM =;A5jO>D&V@`Fٵk4h  3=o5c-[TsQ|u’ʼ%YW8p@ =}ȷu,O<:q/C3͟r& l\,N>-1 f}\=zM6͢h(Z@̇J\fѧW񹿳8%-.fZǎ;x6ٳgu  ^gf]S )%ݼ?;6W8thjRy3-=S}<Q(MVY`,40VGkP``zUBB,hE~|GܲO8(TS]([ҥw؅' OJ#4ϣoo/JMϤQVԦqu02?4x`bC<]܇#ФIyAف7 9Go&o]=+ԭM06 @7UX,x]0v!>wg҉FJ!"0?(.%ҬUUatU> oJ' mK `[0}0v: uw+6j-Ý9w> ##j@f)QRjt̶:tK+3_Pğqtt orf0瞣VZNdzzJk?E!u+QrjI@wHC{&?b`wz}`j\E :D'NKճgOz'%#88Xc\unHUA jɪQuh۴!ޝP @9? .=q4|p9Oko&-&_yemA./,\i?{cś@&@P9wE5~x/&j%0rJ*WFK1#zFǩA aǕWбy,xHYo^eFJF88Pٳlσ&]RԢнjܔ,[NE3ͯK6(tD̘1C5h O7'(ϭq jHRaT1.YxŁf[B>\5]!$L.q_oʩDcm\H8Pݺu+VPl%o߾*,,LW'JH뒫ƙ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_?Nawִs㣭+EXq IA3^kImw `cuh jm%gSZ-9Kڷa],c F3ŵcWHYgckx/uۉvAجY{-"Sqh1g svYf`DAĬ` S yBXR-Sq1#3SU5kWy_\q.rq.#CU7²:xviKpJ(W^qTdժUX761JJ+=Tpia4T]--)SYRB*}ˢڴiXQY%1J1 %JƠ񬇳davPUU5^F).g`[kjjC}uu5YQ1oX[kCٹQȘ+nƛ=;^KW"LV4P ^c=0n'xQOxRdHXR`>;q"}N3BV*zZ~)s0;$P`q2l;ךEnwL@#= [,0D_A g@uN;S"6;Ae 8* #ʓa: UR{Fg^ s=HrT2 IrmaL! aZ+ hm,JB|I ?RBza0$ ޢ(49r` U|"/ց3( H3X 5TDyQT6uRҎbpJEZ ?~yIY 8unSV2la F7 kނ93R0OBɔAƕ*>t0>HѱTvOo,ZZZĉG3<* -:WxY„8.C` +k'Q%ۊgzx,$Rl]8cd$#XшO'O& j;vPM4(S!b ޠ;qfVG[б𝯁 aw%;3͠׏KcǏ#BqV^enܹowI襯sZ @ͨ0e:XRfV.ZH).=6B@|tR3>"2I (--c;%ΥxRF$g`0 }RT-Kmn>3lڴ ,dq. e7V˗1&&F+d,(0ƌ巇 l */Ɣ 3/ɿd&:cݎR):˚7ҀouF \֣bV]{䪥:IENDB`././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/40.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000000466415154533055033157 0ustar runnerrunnerPNG  IHDR((msRGBDeXIfMM*i((zf IDATX X{P_885 ͸0ll4cu?q*a4^իWcQr :, &V}*s!,{}ll1+Kbl2?^xrCL\Dkb܅gqv v> dm7!DP0vYo>{%Aav:FJz_!9\]jсbK!QGpY*(( 0BlT8EE@uPJY~.X]=Dѽ0NVL%A~d>#$>-˦? ED +p{7a0v-+`/^3iIPsgG7A> *";%'2\[c8C\t$DPoz/ ;ŒlM~"mãppOùP Q!: [Uq'i;sPx Ϝs W`ɶh<tdr՗JEDž?rAbˀ {eLΞ|$LX[{ANJN}bqq23B,ߟ_\ЙZ;p_cY_܁055Ұ^~/pƍ򓟢kɓΝ yCL.,} sԵj-fs낵85 `ժUPlhȽz}P/q[MrTSU u-( r.1ϤV4 J[tz}RjH;~` RA'R5fEGQK))S^U 5`Ͳ0i7;~Zyft%AD xy#*T<,h3u045~9Y$J^2@P0=uСdm_9xŬrEak%˓\\OQ3A}P$ rw謃KD( ewRğJwJzm`/R=p80!x nF#07!~ {AvKޛUJ۩)FȚBV wN ,B*{b}8++K%If]y e%n6w!+Vtοy̧cSS02'Ko}yT@0xrt/k2 dPQJKKK`0KJJd2}AG@fjll"6O sT {@Od֦ PQ ieޞcki@[QXIENDB`././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/87.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000001300015154533055033137 0ustar runnerrunnerPNG  IHDRWWqlsRGBDeXIfMM*iWWRjIDATx\ xUE@ ;" , ȎN@}oA=5cXgϞgZl;Ho&M0V*?ZQMtE^5BUq)AP%~.m=Ic.ѿu~:?X%Aw@A"5ՇA|LkvkB0153XzTٟ2YׇcQ~݊?Rc#Z^z%.%''V,ָ cQC73оT;$XX2LN+vQhЯ[S`v'=E}oAC0!YlzV }i+ԥ55S]^)Qf+&ܸEWl[#(3+BX[elmwA%'Z6duT=W>LxFLժUŴEhi%y*eanB;=JAį,\[d|wh Tq"Waf s02_SP Kq ?cI+8 CaQ"r?9:y2֝ q[wlCZ!UES4~ ܻq;:U΅ByZp2hTԢE Ml݁:j,Gl}x8\h*46apPe5~$}Kc,YB;vzKcƌK.h<֬D#wbsы_2 PvxS_բy/X Y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w>CxM1 ɱ5.+v]8]@[y\xS Z8䗽*((H43@65_TŹav٣:7Z ́B+ X~Oo0a4Yn}o:+ ?msˆey9HDfD3<7\"ժUe[ͫx5\Z\g$:ئ$9R9s,\*e:} Ϣ /` &5jnݺݻw[bpe.xiǎCr̜5j.\h=/Tj0d\?Aʕ++xEN^Et]|_Հ@ݸqCM4I!aş;)54zX/>L3VB4? v5߰(7 pF1ik_*p5@k\}A,+Hr\; pmDƪ+4\ ͭFlBs+ pmDƪ+4Fp$qIENDB`././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/88.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000001323015154533055033144 0ustar runnerrunnerPNG  IHDRXXq04sRGBDeXIfMM*iXXHIDATx\ |W?%}W}bjGjhW>3Z[ZZX"DȆI+oyHͳ9s=뤘,CٲsP?GNy`hÇٙ\\\ƍrk*6ԩCCQ._ks!LJHHPfRJ„k||||ĉULLcXyQT+=1aըQ#h$fsRV-b UF>237ȽhNHJ|dv 3g*]@3fMU&MR&'=|~v* xgmG'48}8M] ׷TȍH5Օ;ƽ$Kb+7ڣ xegԓd S>8aܻw?^TumP^ R-<[=b9Ln.)DCoKwRtr/}Xb͛GݻrM8RvhϞ=dV%%%C)ݍ"c毦.N{ȅc\{hACr̍fY~LC# ih#1q4ovZW#žʁt^<'2|:4EmT'$Za5i҄lBk֬!^ӧ &kTPxs}xf=4{r6!"Ovws0n]*ujxzH[IY1ZCVn;D3msWnP^T;=rz:(ϱx{S~I 8J]S%jƦF{רGi&ܹ3-ZT(@@=C_,HN] TɢEؿPO*(5<F`WcNP8VPC[ 7 w6ЮΑtζlr3*a[ՏCK<RB_Of3Mwg篆%iݮdׂ婯ޱIloA,_OJ3_ iK7Ӫ<\vslِt1,Z֩B/7ME FiSpaJ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:d`-8EK0׽խ콮\W X3;%{1sȚsԩ4l0S0yw[JXvp-eɍ'˳-<3|;>y6TEw1(L ӓZ|Q&%_b`\R'pz֦aM=%lcb LzA.]}'f]|3VG#=ȉg`yCZ"ր{%\g$'zҒOiJ.?e,_Zُ+6ƪ?SRXUjʂ-9 @``ԅ] X\|scJY7f){QϷpI:vl|5{z}gOHTY~oQ[@V'dB9sܾWAyY&HَmH > xھ}b:߬تȩȿ .:\D ~]h}[3 k#Ό3T-`[Ǟ@t ,L!C(D01> ?+P x!oʃ´RM`Un,0D0^3\R%5~xK[ˡ)&9\7%Rz\e`Q@eM좟ʖ-+lb6 z01'u;G !֍u5kC"hGL6x-| CN# C0vhiv08v-:80ۡE!Z`;4;;D lF`chaТ`p- Ztpa CN# CgF:ט.cIENDB`././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/180.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000003023415154533055033147 0ustar runnerrunnerPNG  IHDR=2sRGBDeXIfMM*iVՖy0IDATx]E~d#\ QDPD,݁(gx("DAD\@ X` yaaI7[MM33;3;;3SS]]z]]Dnr9'('tdvWpWtqb 8:Dq}iVw$sQ䃼.rBhϞ=tBGWp88 8q^{5jԨk׎f͚% gϺnH>:zR78 V Rt*)) />W)))V=8X7eq@fwǢEW_mpŠ}hVYOÇyve.f ,6uǎj] 3bQ^vm5j(Kho7 =: L5|pUR% &hoXlXn}}*99ْ,>@5T&M,` ` n;P*t3@O^|իau71Z_Lϫt{Kҽp _ڴ<)"'ocW;v9׿XL'ç}wT*U,+l/HC=ftϟo -VD,׀SNU͛7BjM {UZZ%D LX[@ɫVR7pd 9o޷B W_U"8 KI4NW<*VXtq6l&L*t3As myȑF^V9\yvGjٲe"8%V e[, ;' zzӧ04nf۱c< 4֭+4?h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&^,/^^lai#4gjyk!oЬk0׿Uމe?pe|X9*URbEaml5Ƞ͚g ת7xnQ˓py񓉪77?ռ|P u#[i~mu) l~cWq%l-`kjĉVsmJlYS*42x'_dM.oQ h-S7uwHiGjժeδXқݻv6 ,1ME;*\q :lM-|Aw^YYXo Ijj۽,2@f^n6{U||oMxlg xm iѢ6m;SB74 f_zYV8l]nF~V́4M6-[Z@CcTc>8ktu{E閂q`IbbJ9g߾}e`p./&-mD:u$izQݦxkx*RXgXB|XQ1] FcǎWQ8JWܸ&̡˗^zY RaxxE> =4ib[i1D\ kN;nbΟ8y>|XldlXcSyڷo//xt-u9֬0- ϦS<βunצԮ][=Z7G\ ("ˁ|h >_/ZHuݲ֑rh'L:|AS"+Nj Zǫ$ ئe {aۿ:@֜Ƚ| hNӿP*_@ɗ_~9s P"7>55{M˙n/k_6-r5ȑ#|'k.;:v_~Q;wmM?DGU﷤f*Ufr.m,E5_D/`VV^m]| ݌c(;qW&2ςc:v@[=> {)Y d-)8:l͛%Aƍ% !* f$+ N}l [`]"9TCvo \>wq.b{g8>wq.b{g8>wq.b{g8>wq.b{g8>wq.b{g8>wq.b{g8>wq.b{g8>wq.b{g8>wq.b{g8>wq.b{g8>wq.b{g8>wq.b{g8>wq.b{g8>wq.b{g8>wq.b{g8>wq~IENDB`././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/76.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000001126115154533055033146 0ustar runnerrunnerPNG  IHDRLLǗQ+sRGBDeXIfMM*iLLIDATx\ xUŵ^$Q^D塼P4A( 꽠ЖV@^XZ)zP$B("AbD M0wd6;'9B8sf=k5kc-5SpשpwM!ajnt5rss-ZucJDuaz(%%Eok b 6YYYjي% S%KcէO3Pk7|pcv@ոqj ],QmF3WeҼSڵK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廊J+*ћws/o0b -yBh"*4yuۣ(B/rɶI&SX%r D',a2煯'dđ5X6Y:Z2(L:oXDWT1 eV7Lxx,{8e^m|ނ7oɝ# ʸH``%#e[zpxSk=Ar 1&IY >u# X%w$l l A5F)+N͹`*0&06r viDZvk ŌW??bVFT(gpr85mPzmToK\#;e󩐨v88N}lt֭3_wGgWKE"ܾ5a40N`wsI t߸{ӂ)a4sI}@?+ށcpfAeIz[`ǟ &}Y_rIzCԷ+EAͤu)>[J`j]f~ϩ2KQE\1+?Pd6碾S~'TsRx:δZ|Dd񠎕|9}j뛤:ww(7UM]V%eH 6A:Dgot\JHDSQI1n[4B:=8B;vGHm޼Yns,IqǸC]TuߌJLgq:h 8\y)׈"&L-IoV#o0`}9:3EɓkH1e]F^KsQΝv:yuXW$ 0 Xd;r:?w/D]Z]+Y@fp6lؠ]ݔr'z i14@{zⷖ˖-SM6FLgp0XMc[ON5)R0272  7}FL3 D\8zo/qL7 1hG|F#76NI~vE0t.`@b`Fɐ(tm}mRnkdltnx;spkA|YšsofDǛ%0pf s!S|IENDB`././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/152.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000002475615154533055033163 0ustar runnerrunnerPNG  IHDR !sRGBDeXIfMM*i_)XIDATx]UҮ% "q% ("I=Ý(&@=Ý9ΈDA@PrdTr\Xr\`ɠﯯfy;̦ٙ饟.uwի~ ''0I W=֓HJXX=A0I OUPΝ[hrEQQQO,>ϟ?/`ΝK7n$ м: \Rx}8ORf7ʕ39s@n=l$JSNz˔)SƱZSI(Yƍ̈́ \(>Z6OW6Fաb -P@t Kv8eF;|\z饗 _?/~uqhZT@>*ZIШ1QiɺmfjӨ&m\ - b>70(1* ŵ$}4Yt *Qɕ;:E@TA#Y~ۼ7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|/˜6M`o%0{7լHr>x4ϔ9D.!tAL~ R 9a6'Q3fO uCKzkw B&fbb V&]4T&s0WLq\5q{h"^^^w@--"g0K{bR>D˥u>7Hr- iO ;a'ia^`?V } ``3M&R`M8*V(1PKti؀Cԭza)lYteĒK2yU_xf' ydT\SZ- e9jBx`jP/ 2>α#1ˬB` h 毾Nuk+_,AM V _~˗x7Dzg[PVAV 4Cmդyg9v( # _9I[pDg9p*o*'VlRO09LhGFحm%`=V_/\|( a Of ~Q>N[zܐBjR<C,YKv8I,jQZk >g"[|(Ûo*G_~%!66Fت\T$=* |c0'AFH㽺gJU//# *SI| wFTRYGd6Bdl:` * v7|wb%)IﵛCaϋW^yEoX2 H(@p,Y"B7a($pЍ{bjTu7R~qLԮy}񳮌%bZg' (K79CЭ1|yZ qw͙]YUrl'@ߣG @. s- E5աxIg t'3vJ;ߚo-|U;t$єm{yeQ".;A ̖d+dׁ#fΊ69S0tl~iS@ @J)kfȐ!k>ho=Q MrIǃGb ¹yrd 3Z 9*p ȃR\8g?T\ KF%"d2f«%ں,-~Uϳ`*8jٚg5(ooƋ_yKMXg9L/`m}fӦM r'O˾?'G2*H[ׯ7wyY9(}i/<P6m+'w%[PwKY͚5 "yb `kw6PVe?CSJq%c VF'V)Mݻw'rm j &L Qp rJ_wsH@qT7;Dkz=+Ieˉ@UB㏉=p%imfnz*~6iqn{1DCCɒek!:Baxkr<@In&=@In&=@In&=@In&=@In&=@In&=@In&=@In&=@In&=@In&=@In&=@In&#)IENDB`././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/167.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000002732615154533055033157 0ustar runnerrunnerPNG  IHDRtLsRGBDeXIfMM*i5^.@IDATx]|UҟPBދ` <#؞PlaC6|"(*Jzenv9nݳgfl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U&vX.O˗iӢ\\ :Z~϶noK ~e`HG @@(E nmP 6؝5SaΑ>>´]`tj~ MxV=< <]u7@aY{fL+KZMsd? 23 xcK]r_ XY#FmGPK.;@؜e˖C@|ZW~$ץ]M즩ZcZZ>%` I: n~er<p LLY1[ ̂H.x1 2ײA5]ԠjYy34tI|&^tǟaԨQ4n8O$ >Gx? o4ѯf o`6g&|#5~i8 yFk`>Z+!KY zcj4jܡ@y09|3؟T͛77d2M9:)8sM:y*4y -ݏԴ?%T[Sq;O/1NΓ!uUoK$5xyMX&%8S||zYh6hi@9-Z(2UN5܈p "eO?)>Ș? > gѻ58apv:lӦezNn EQڳgkdѰ'#G(4s/;zr0r>?º-8˖-k`k, ڦeڲeTtCpjA?~\*wRhP$A5sL# _CK&D8Am"7lؠ:wl@ -QeʔQ|✁Ӱ㪑'(yjܸizvU>}ѣGEx*7p e ` :TyvKɇFw8]SF@DSSjÊOV|Ұtӯlذ:u.Z4.$q 9(~YFw}IhJQ[S(QB 2(+5v& A4h`@?jkۘջwouA#D7j\3Q?Wŋ7 6NGW+WԯLzF́kc;pzq~? AZN5a ׯ4H5 NN+VP:t0`Ԡ3;>uJ^k lFI{k$`3n$]8psA*|9sF֬WXQfOW^&[[.(0*\p`0 L7.8wT?8?f \pn~pLr.8wT?8&Y[p, -Inpgp\p$7Kp838|wK.8`%8p~0 R N?f \pn~pLr.8wT?8&Y[p, -Inpgp\p$7Kp838|wKtIENDB`././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/256.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000004461115154533055033153 0ustar runnerrunnerPNG  IHDR\rfsRGBDeXIfMM*igI@IDATx]`t{tiJ/ *XяPEl_vQ퀂|HAz=^B}:Mի'oYci,! /~/9=ˬ&˦J*RFЦ 06]'N(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Od=Q4{:Y2(x(Vet(10Sa6iImY_9=+Is_jk瑳: TțNSBRٴ}|y^PRCC𓫷@ݸs? d[LF&;q>[K36t!!|=@N~!^Nw! ?J(aA#>+o`^8hpX4] BM7F:2J;qK]sA;+jVDq@Y9O^Sg>h X/ kj]|B~o(%=P#|[GZiB aة%jZѣ;$ծCMp8u\f3yB8 tejLs{eCyzA6T4dWnY`7/w!v ~s1 `&ϠU8& d-_J$HǸ<4g r),?(_9ϟ&+6M< E~ X3Tv=ձϡ4M1b})i!xGL2y7‡%p-==/Ӹ 8 AR%%3wiǎsK@2!\o<֑A ƫM21:¡}%0+g"^=:AX@8 c !#hw)k 8V\<YnݺwNM6 &H^! ^L֡=ԮŢM(Y`m&QR_pyf&7b!M|1il%4Q#?Ncfn~{7 ]EMϞ= VZuY֒mZY|Y ~rh:LW>6S؁»[ yl shy$3y,+!|$hg.H\֢,BqNBτë}܀S>KDo$t~KyeYz$]ګl5.X͐!C\R I`mKOvDW6{+,<'M:a_-˻$ݦ_[Zk@f´M? $ʶ-B׮]MrrRoވ4 :u(^6мA =5&Zj/,] yUc\ndAYUx8=O9."ӏJZ E`&pÁ,Qݰ<3 1v9+ti\`QF)  `#6omM;%cNt1W6DBAUհ@ۇ?S1Y,;*??m۶5bܻv@?7z|`[:uꘟ~ɭ> [a;ZL );?(M| -L|O>C͉E@ce'-#Py6>1dٴiq/|>ܻDG8P`4@9|0<(PкKs@ Ʈx9S/G8(1x9e1DՍˑ(; n ^Dq Q&poucr$ʎc2{#Qv@ [LHeV7/G8(1x9e1DՍˑ(;_H1IENDB`././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconset/60.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/AppIconSet.xcassets/AppIcon.appiconse0000644000175100017510000000713715154533055033155 0ustar runnerrunnerPNG  IHDR<<:rsRGBDeXIfMM*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`+& X@.QDY`+& X@.QDY`+& X@.QDY`+& X@.QDY`+& X@.QDY`+& X@.QDY`+& X@.QDY`+& X@.QDY`+& X@.QDY`+& X@.QDY`+& X@.QDY`+& X@.QDY`+& X@.QDY`+& X@.Q EjIENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/appiconset.qbs0000644000175100017510000000043515154533055026726 0ustar runnerrunnerCppApplication { Depends { name: "ib" } Depends { name: "bundle" } property bool isShallow: { console.info("bundle.isShallow: " + bundle.isShallow); return bundle.isShallow; } files: ["main.c", "AppIconSet.xcassets"] ib.appIconName: "AppIcon" } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/appiconset/main.c0000644000175100017510000000003115154533055025132 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconset/0000755000175100017510000000000015154533055023347 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconset/white.iconset/0000755000175100017510000000000015154533055026132 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconset/white.iconset/icon_16x16@2x.png0000644000175100017510000000123115154533055031004 0ustar runnerrunnerPNG  IHDR szzsRGB pHYs%%IR$iTXtXML:com.adobe.xmp 4 4 1 #2IDATX A 1g ٻx\=/ @ 0M<^IENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconset/white.iconset/icon_16x16.png0000644000175100017510000000121115154533055030430 0ustar runnerrunnerPNG  IHDRasRGB pHYs  iTXtXML:com.adobe.xmp 4 4 1 #"IDAT8c & 􂵎0a k IENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconset/iconset.qbs0000644000175100017510000000012715154533055025522 0ustar runnerrunnerProduct { Depends { name: "ib" } type: ["icns"] files: ["white.iconset"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconsetapp/0000755000175100017510000000000015154533055024050 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconsetapp/iconsetapp.qbs0000644000175100017510000000036215154533055026725 0ustar runnerrunnerCppApplication { Depends { name: "ib" } Depends { name: "bundle" } property bool isShallow: { console.info("isShallow: " + bundle.isShallow); return bundle.isShallow; } files: ["main.c", "white.iconset"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconsetapp/white.iconset/0000755000175100017510000000000015154533055026633 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconsetapp/white.iconset/icon_16x16@2x.png0000644000175100017510000000123115154533055031505 0ustar runnerrunnerPNG  IHDR szzsRGB pHYs%%IR$iTXtXML:com.adobe.xmp 4 4 1 #2IDATX A 1g ٻx\=/ @ 0M<^IENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconsetapp/white.iconset/icon_16x16.png0000644000175100017510000000121115154533055031131 0ustar runnerrunnerPNG  IHDRasRGB pHYs  iTXtXML:com.adobe.xmp 4 4 1 #"IDAT8c & 􂵎0a k IENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconsetapp/main.c0000644000175100017510000000237015154533055025142 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconcomposer/0000755000175100017510000000000015154533055024403 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconcomposer/AppIcon.icon/0000755000175100017510000000000015154533055026663 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconcomposer/AppIcon.icon/icon.json0000644000175100017510000000065715154533055030516 0ustar runnerrunner{ "fill" : { "linear-gradient" : [ "display-p3:0.24168,1.00000,0.91171,1.00000", "extended-srgb:0.00000,0.47843,1.00000,1.00000" ], "orientation" : { "start" : { "x" : 0.5, "y" : 0 }, "stop" : { "x" : 0.5, "y" : 0.7 } } }, "groups" : [ ], "supported-platforms" : { "circles" : [ "watchOS" ], "squares" : "shared" } }qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconcomposer/main.c0000644000175100017510000000003115154533055025465 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/iconcomposer/iconcomposer.qbs0000644000175100017510000000042615154533055027614 0ustar runnerrunnerCppApplication { Depends { name: "ib" } Depends { name: "bundle" } property bool isShallow: { console.info("bundle.isShallow: " + bundle.isShallow); return bundle.isShallow; } files: ["main.c", "AppIcon.icon"] ib.appIconName: "AppIcon" } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/0000755000175100017510000000000015154533055024355 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/assetcatalogempty.qbs0000644000175100017510000000171015154533055030614 0ustar runnerrunnerimport qbs.Host import qbs.Utilities Project { condition: { var result = qbs.targetOS.includes("macos"); if (!result) console.info("Skip this test"); return result; } property bool includeIconset CppApplication { Depends { name: "ib" } files: { var filez = ["main.c", "MainMenu.xib"]; if (project.includeIconset) filez.push("empty.xcassets/empty.iconset"); else if (Utilities.versionCompare(xcode.version, "5") >= 0) filez.push("empty.xcassets"); if ((Host.osVersionMajor() >= 11 || Host.osVersionMinor() >= 10) // need macOS 10.10 or higher to build SBs && cpp.minimumMacosVersion !== undefined && Utilities.versionCompare(cpp.minimumMacosVersion, "10.10") >= 0) filez.push("Storyboard.storyboard"); return filez; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/MainMenu.xib0000644000175100017510000063673415154533055026615 0ustar runnerrunner 1080 11D50 2457 1138.32 568.00 com.apple.InterfaceBuilder.CocoaPlugin 2457 NSWindowTemplate NSView NSMenu NSMenuItem NSCustomObject com.apple.InterfaceBuilder.CocoaPlugin PluginDependencyRecalculationVersion NSApplication FirstResponder NSApplication AMainMenu Test 1048576 2147483647 NSImage NSMenuCheckmark NSImage NSMenuMixedState submenuAction: Test About Test 2147483647 YES YES 1048576 2147483647 Preferences… , 1048576 2147483647 YES YES 1048576 2147483647 Services 1048576 2147483647 submenuAction: Services _NSServicesMenu YES YES 1048576 2147483647 Hide Test h 1048576 2147483647 Hide Others h 1572864 2147483647 Show All 1048576 2147483647 YES YES 1048576 2147483647 Quit Test q 1048576 2147483647 _NSAppleMenu File 1048576 2147483647 submenuAction: File New n 1048576 2147483647 Open… o 1048576 2147483647 Open Recent 1048576 2147483647 submenuAction: Open Recent Clear Menu 1048576 2147483647 _NSRecentDocumentsMenu YES YES 1048576 2147483647 Close w 1048576 2147483647 Save… s 1048576 2147483647 Revert to Saved 2147483647 YES YES 1048576 2147483647 Page Setup... P 1179648 2147483647 Print… p 1048576 2147483647 Edit 1048576 2147483647 submenuAction: Edit Undo z 1048576 2147483647 Redo Z 1179648 2147483647 YES YES 1048576 2147483647 Cut x 1048576 2147483647 Copy c 1048576 2147483647 Paste v 1048576 2147483647 Paste and Match Style V 1572864 2147483647 Delete 1048576 2147483647 Select All a 1048576 2147483647 YES YES 1048576 2147483647 Find 1048576 2147483647 submenuAction: Find Find… f 1048576 2147483647 1 Find and Replace… f 1572864 2147483647 12 Find Next g 1048576 2147483647 2 Find Previous G 1179648 2147483647 3 Use Selection for Find e 1048576 2147483647 7 Jump to Selection j 1048576 2147483647 Spelling and Grammar 1048576 2147483647 submenuAction: Spelling and Grammar Show Spelling and Grammar : 1048576 2147483647 Check Document Now ; 1048576 2147483647 YES YES 2147483647 Check Spelling While Typing 1048576 2147483647 Check Grammar With Spelling 1048576 2147483647 Correct Spelling Automatically 2147483647 Substitutions 1048576 2147483647 submenuAction: Substitutions Show Substitutions 2147483647 YES YES 2147483647 Smart Copy/Paste f 1048576 2147483647 1 Smart Quotes g 1048576 2147483647 2 Smart Dashes 2147483647 Smart Links G 1179648 2147483647 3 Text Replacement 2147483647 Transformations 2147483647 submenuAction: Transformations Make Upper Case 2147483647 Make Lower Case 2147483647 Capitalize 2147483647 Speech 1048576 2147483647 submenuAction: Speech Start Speaking 1048576 2147483647 Stop Speaking 1048576 2147483647 Format 2147483647 submenuAction: Format Font 2147483647 submenuAction: Font Show Fonts t 1048576 2147483647 Bold b 1048576 2147483647 2 Italic i 1048576 2147483647 1 Underline u 1048576 2147483647 YES YES 2147483647 Bigger + 1048576 2147483647 3 Smaller - 1048576 2147483647 4 YES YES 2147483647 Kern 2147483647 submenuAction: Kern Use Default 2147483647 Use None 2147483647 Tighten 2147483647 Loosen 2147483647 Ligatures 2147483647 submenuAction: Ligatures Use Default 2147483647 Use None 2147483647 Use All 2147483647 Baseline 2147483647 submenuAction: Baseline Use Default 2147483647 Superscript 2147483647 Subscript 2147483647 Raise 2147483647 Lower 2147483647 YES YES 2147483647 Show Colors C 1048576 2147483647 YES YES 2147483647 Copy Style c 1572864 2147483647 Paste Style v 1572864 2147483647 _NSFontMenu Text 2147483647 submenuAction: Text Align Left { 1048576 2147483647 Center | 1048576 2147483647 Justify 2147483647 Align Right } 1048576 2147483647 YES YES 2147483647 Writing Direction 2147483647 submenuAction: Writing Direction YES Paragraph 2147483647 CURlZmF1bHQ 2147483647 CUxlZnQgdG8gUmlnaHQ 2147483647 CVJpZ2h0IHRvIExlZnQ 2147483647 YES YES 2147483647 YES Selection 2147483647 CURlZmF1bHQ 2147483647 CUxlZnQgdG8gUmlnaHQ 2147483647 CVJpZ2h0IHRvIExlZnQ 2147483647 YES YES 2147483647 Show Ruler 2147483647 Copy Ruler c 1310720 2147483647 Paste Ruler v 1310720 2147483647 View 1048576 2147483647 submenuAction: View Show Toolbar t 1572864 2147483647 Customize Toolbar… 1048576 2147483647 Window 1048576 2147483647 submenuAction: Window Minimize m 1048576 2147483647 Zoom 1048576 2147483647 YES YES 1048576 2147483647 Bring All to Front 1048576 2147483647 _NSWindowsMenu Help 2147483647 submenuAction: Help Test Help ? 1048576 2147483647 _NSHelpMenu _NSMainMenu 15 2 {{335, 390}, {480, 360}} 1954021376 Test NSWindow 256 {480, 360} {{0, 0}, {2560, 1418}} {10000000000000, 10000000000000} YES AppDelegate NSFontManager terminate: 449 orderFrontStandardAboutPanel: 142 delegate 495 performMiniaturize: 37 arrangeInFront: 39 print: 86 runPageLayout: 87 clearRecentDocuments: 127 performClose: 193 toggleContinuousSpellChecking: 222 undo: 223 copy: 224 checkSpelling: 225 paste: 226 stopSpeaking: 227 cut: 228 showGuessPanel: 230 redo: 231 selectAll: 232 startSpeaking: 233 delete: 235 performZoom: 240 performFindPanelAction: 241 centerSelectionInVisibleArea: 245 toggleGrammarChecking: 347 toggleSmartInsertDelete: 355 toggleAutomaticQuoteSubstitution: 356 toggleAutomaticLinkDetection: 357 saveDocument: 362 revertDocumentToSaved: 364 runToolbarCustomizationPalette: 365 toggleToolbarShown: 366 hide: 367 hideOtherApplications: 368 unhideAllApplications: 370 newDocument: 373 openDocument: 374 raiseBaseline: 426 lowerBaseline: 427 copyFont: 428 subscript: 429 superscript: 430 tightenKerning: 431 underline: 432 orderFrontColorPanel: 433 useAllLigatures: 434 loosenKerning: 435 pasteFont: 436 unscript: 437 useStandardKerning: 438 useStandardLigatures: 439 turnOffLigatures: 440 turnOffKerning: 441 toggleAutomaticSpellingCorrection: 456 orderFrontSubstitutionsPanel: 458 toggleAutomaticDashSubstitution: 461 toggleAutomaticTextReplacement: 463 uppercaseWord: 464 capitalizeWord: 467 lowercaseWord: 468 pasteAsPlainText: 486 performFindPanelAction: 487 performFindPanelAction: 488 performFindPanelAction: 489 showHelp: 493 alignCenter: 518 pasteRuler: 519 toggleRuler: 520 alignRight: 521 copyRuler: 522 alignJustified: 523 alignLeft: 524 makeBaseWritingDirectionNatural: 525 makeBaseWritingDirectionLeftToRight: 526 makeBaseWritingDirectionRightToLeft: 527 makeTextWritingDirectionNatural: 528 makeTextWritingDirectionLeftToRight: 529 makeTextWritingDirectionRightToLeft: 530 performFindPanelAction: 535 addFontTrait: 421 addFontTrait: 422 modifyFont: 423 orderFrontFontPanel: 424 modifyFont: 425 window 532 0 -2 File's Owner -1 First Responder -3 Application 29 19 56 217 83 81 75 78 72 82 124 77 73 79 112 74 125 126 205 202 198 207 214 199 203 197 206 215 218 216 200 219 201 204 220 213 210 221 208 209 57 58 134 150 136 144 129 143 236 131 149 145 130 24 92 5 239 23 295 296 297 298 211 212 195 196 346 348 349 350 351 354 371 372 375 376 377 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 450 451 452 453 454 457 459 460 462 465 466 485 490 491 492 494 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 534 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{380, 496}, {480, 360}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin 535 ABCardController NSObject id id id id id id id addCardViewField: id copy: id cut: id doDelete: id find: id paste: id saveChanges: id ABCardView NSButton NSManagedObjectContext NSSearchField NSTextField NSWindow mCardView ABCardView mEditButton NSButton mManagedObjectContext NSManagedObjectContext mSearchField NSSearchField mStatusTextField NSTextField mWindow NSWindow IBProjectSource ./Classes/ABCardController.h ABCardView NSView id id commitAndSave: id statusImageClicked: id NSObjectController NSImageView NSView ABNameFrameView NSView NSImage ABImageView mBindingsController NSObjectController mBuddyStatusImage NSImageView mHeaderView NSView mNameView ABNameFrameView mNextKeyView NSView mUserImage NSImage mUserImageView ABImageView IBProjectSource ./Classes/ABCardView.h ABImageView NSImageView id id id id copy: id cut: id delete: id paste: id IBProjectSource ./Classes/ABImageView.h DVTBorderedView DVTLayoutView_ML contentView NSView contentView contentView NSView IBProjectSource ./Classes/DVTBorderedView.h DVTDelayedMenuButton NSButton IBProjectSource ./Classes/DVTDelayedMenuButton.h DVTGradientImageButton NSButton IBProjectSource ./Classes/DVTGradientImageButton.h DVTImageAndTextCell NSTextFieldCell IBProjectSource ./Classes/DVTImageAndTextCell.h DVTImageAndTextColumn NSTableColumn IBProjectSource ./Classes/DVTImageAndTextColumn.h DVTLayoutView_ML NSView IBProjectSource ./Classes/DVTLayoutView_ML.h DVTOutlineView NSOutlineView IBProjectSource ./Classes/DVTOutlineView.h DVTSplitView NSSplitView IBProjectSource ./Classes/DVTSplitView.h DVTStackView_ML DVTLayoutView_ML IBProjectSource ./Classes/DVTStackView_ML.h DVTTableView NSTableView IBProjectSource ./Classes/DVTTableView.h DVTViewController NSViewController IBProjectSource ./Classes/DVTViewController.h HFController NSObject selectAll: id selectAll: selectAll: id IBProjectSource ./Classes/HFController.h HFRepresenterTextView NSView selectAll: id selectAll: selectAll: id IBProjectSource ./Classes/HFRepresenterTextView.h IBEditor NSObject id id id id id changeFont: id performCopy: id performCut: id selectAll: id sizeSelectionToFit: id IBProjectSource ./Classes/IBEditor.h IDECapsuleListView DVTStackView_ML dataSource id dataSource dataSource id IBProjectSource ./Classes/IDECapsuleListView.h IDEDMArrayController NSArrayController IBProjectSource ./Classes/IDEDMArrayController.h IDEDMEditor IDEEditor DVTBorderedView NSView IDEDMEditorSourceListController DVTSplitView bottomToolbarBorderView DVTBorderedView sourceListSplitViewPane NSView sourceListViewController IDEDMEditorSourceListController splitView DVTSplitView IBProjectSource ./Classes/IDEDMEditor.h IDEDMEditorController IDEViewController IBProjectSource ./Classes/IDEDMEditorController.h IDEDMEditorSourceListController IDEDMEditorController DVTBorderedView IDEDMEditor DVTImageAndTextColumn DVTOutlineView NSTreeController borderedView DVTBorderedView parentEditor IDEDMEditor primaryColumn DVTImageAndTextColumn sourceListOutlineView DVTOutlineView sourceListTreeController NSTreeController IBProjectSource ./Classes/IDEDMEditorSourceListController.h IDEDMHighlightImageAndTextCell DVTImageAndTextCell IBProjectSource ./Classes/IDEDMHighlightImageAndTextCell.h IDEDataModelBrowserEditor IDEDMEditorController IDEDataModelPropertiesTableController IDECapsuleListView NSArrayController IDEDataModelPropertiesTableController IDEDataModelEntityContentsEditor IDEDataModelPropertiesTableController attributesTableViewController IDEDataModelPropertiesTableController capsuleView IDECapsuleListView entityArrayController NSArrayController fetchedPropertiesTableViewController IDEDataModelPropertiesTableController parentEditor IDEDataModelEntityContentsEditor relationshipsTableViewController IDEDataModelPropertiesTableController IBProjectSource ./Classes/IDEDataModelBrowserEditor.h IDEDataModelConfigurationEditor IDEDMEditorController IDECapsuleListView IDEDataModelEditor IDEDataModelConfigurationTableController capsuleListView IDECapsuleListView parentEditor IDEDataModelEditor tableController IDEDataModelConfigurationTableController IBProjectSource ./Classes/IDEDataModelConfigurationEditor.h IDEDataModelConfigurationTableController IDEDMEditorController NSArrayController NSArrayController IDEDataModelConfigurationEditor XDTableView configurationsArrayController NSArrayController entitiesArrayController NSArrayController parentEditor IDEDataModelConfigurationEditor tableView XDTableView IBProjectSource ./Classes/IDEDataModelConfigurationTableController.h IDEDataModelDiagramEditor IDEDMEditorController XDDiagramView IDEDataModelEntityContentsEditor diagramView XDDiagramView parentEditor IDEDataModelEntityContentsEditor IBProjectSource ./Classes/IDEDataModelDiagramEditor.h IDEDataModelEditor IDEDMEditor DVTDelayedMenuButton DVTDelayedMenuButton NSSegmentedControl IDEDataModelConfigurationEditor IDEDataModelEntityContentsEditor IDEDataModelFetchRequestEditor NSSegmentedControl NSTabView addEntityButton DVTDelayedMenuButton addPropertyButton DVTDelayedMenuButton browserDiagramSegmentControl NSSegmentedControl configurationViewController IDEDataModelConfigurationEditor entityContentsViewController IDEDataModelEntityContentsEditor fetchRequestViewController IDEDataModelFetchRequestEditor hierarchySegmentControl NSSegmentedControl tabView NSTabView IBProjectSource ./Classes/IDEDataModelEditor.h IDEDataModelEntityContentsEditor IDEDMEditorController IDEDataModelBrowserEditor IDEDataModelDiagramEditor IDEDataModelEditor NSTabView browserViewController IDEDataModelBrowserEditor diagramViewController IDEDataModelDiagramEditor parentEditor IDEDataModelEditor tabView NSTabView IBProjectSource ./Classes/IDEDataModelEntityContentsEditor.h IDEDataModelFetchRequestEditor IDEDMEditorController NSArrayController IDEDataModelEditor IDECapsuleListView entityController NSArrayController parentEditor IDEDataModelEditor tableView IDECapsuleListView IBProjectSource ./Classes/IDEDataModelFetchRequestEditor.h IDEDataModelPropertiesTableController IDEDMEditorController IDEDMArrayController NSTableColumn NSArrayController IDEDataModelBrowserEditor IDEDMHighlightImageAndTextCell XDTableView arrayController IDEDMArrayController entitiesColumn NSTableColumn entityArrayController NSArrayController parentEditor IDEDataModelBrowserEditor propertyNameAndImageCell IDEDMHighlightImageAndTextCell tableView XDTableView IBProjectSource ./Classes/IDEDataModelPropertiesTableController.h IDEDocDownloadsTableViewController NSObject NSButtonCell DVTTableView IDEDocViewingPrefPaneController _downloadButtonCell NSButtonCell _tableView DVTTableView prefPaneController IDEDocViewingPrefPaneController IBProjectSource ./Classes/IDEDocDownloadsTableViewController.h IDEDocSetOutlineView NSOutlineView IBProjectSource ./Classes/IDEDocSetOutlineView.h IDEDocSetOutlineViewController NSObject id id id id id getDocSetAction: id showProblemInfoForUpdate: id subscribeToPublisherAction: id unsubscribeFromPublisher: id updateDocSetAction: id docSetOutlineView IDEDocSetOutlineView docSetOutlineView docSetOutlineView IDEDocSetOutlineView IBProjectSource ./Classes/IDEDocSetOutlineViewController.h IDEDocViewingPrefPaneController IDEViewController id id id id id id id id id id id addSubscription: id checkForAndInstallUpdatesNow: id deleteDocSet: id downloadAction: id minimumFontSizeComboBoxAction: id minimumFontSizeEnabledAction: id showHelp: id showSubscriptionSheet: id subscriptionCancelAction: id toggleAutoCheckForAndInstallUpdates: id toggleDocSetInfo: id DVTGradientImageButton DVTGradientImageButton DVTGradientImageButton NSSplitView NSView NSView DVTBorderedView DVTBorderedView NSButton NSTextView IDEDocSetOutlineViewController IDEDocDownloadsTableViewController NSComboBox NSTextField NSButton NSTextField NSWindow NSButton _addButton DVTGradientImageButton _deleteButton DVTGradientImageButton _showInfoAreaButton DVTGradientImageButton _splitView NSSplitView _splitViewDocSetInfoSubview NSView _splitViewDocSetsListSubview NSView borderedViewAroundSplitView DVTBorderedView borderedViewBelowTable DVTBorderedView checkAndInstallNowButton NSButton docSetInfoTextView NSTextView docSetOutlineViewController IDEDocSetOutlineViewController downloadsTableViewController IDEDocDownloadsTableViewController minimumFontSizeControl NSComboBox noUpdatesAvailableMessage NSTextField showInfoButton NSButton subscriptionTextField NSTextField subscriptionWindow NSWindow validateAddSubscriptionButton NSButton IBProjectSource ./Classes/IDEDocViewingPrefPaneController.h IDEEditor IDEViewController IBProjectSource ./Classes/IDEEditor.h IDEViewController DVTViewController IBProjectSource ./Classes/IDEViewController.h IKImageView id id id id copy: id crop: id cut: id paste: id IBProjectSource ./Classes/IKImageView.h NSDocument id id id id id id printDocument: id revertDocumentToSaved: id runPageLayout: id saveDocument: id saveDocumentAs: id saveDocumentTo: id IBProjectSource ./Classes/NSDocument.h NSResponder _insertFindPattern: id _insertFindPattern: _insertFindPattern: id IBProjectSource ./Classes/NSResponder.h QLPreviewBubble NSObject id id hide: id show: id parentWindow NSWindow parentWindow parentWindow NSWindow IBProjectSource ./Classes/QLPreviewBubble.h QTMovieView id id id id id showAll: id showCustomButton: id toggleLoops: id zoomIn: id zoomOut: id IBProjectSource ./Classes/QTMovieView.h WebView id id id id reloadFromOrigin: id resetPageZoom: id zoomPageIn: id zoomPageOut: id IBProjectSource ./Classes/WebView.h XDDiagramView NSView id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id _graphLayouterMenuItemAction: id _zoomPopUpButtonAction: id alignBottomEdges: id alignCentersHorizontallyInContainer: id alignCentersVerticallyInContainer: id alignHorizontalCenters: id alignLeftEdges: id alignRightEdges: id alignTopEdges: id alignVerticalCenters: id bringToFront: id collapseAllCompartments: id copy: id cut: id delete: id deleteBackward: id deleteForward: id deselectAll: id diagramZoomIn: id diagramZoomOut: id expandAllCompartments: id flipHorizontally: id flipVertically: id layoutGraphicsConcentrically: id layoutGraphicsHierarchically: id lock: id makeSameHeight: id makeSameWidth: id moveDown: id moveDownAndModifySelection: id moveLeft: id moveLeftAndModifySelection: id moveRight: id moveRightAndModifySelection: id moveUp: id moveUpAndModifySelection: id paste: id rollDownAllCompartments: id rollUpAllCompartments: id selectAll: id sendToBack: id sizeToFit: id toggleGridShown: id toggleHiddenGraphicsShown: id togglePageBreaksShown: id toggleRuler: id toggleSnapsToGrid: id unlock: id _diagramController IDEDataModelDiagramEditor _diagramController _diagramController IDEDataModelDiagramEditor IBProjectSource ./Classes/XDDiagramView.h XDTableView NSTableView showAllTableColumns: id showAllTableColumns: showAllTableColumns: id IBProjectSource ./Classes/XDTableView.h AppDelegate NSObject id id applicationShouldTerminate: id applicationWillFinishLaunching: id IBProjectSource ./Classes/AppDelegate.h 0 IBCocoaFramework YES 3 {11, 11} {10, 3} YES qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/Storyboard.storyboard0000644000175100017510000000540615154533055030624 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/0000755000175100017510000000000015154533055027347 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/empty.iconset/0000755000175100017510000000000015154533055032150 5ustar runnerrunner././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16@2x.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/empty.iconset/icon_10000644000175100017510000000123115154533055033240 0ustar runnerrunnerPNG  IHDR szzsRGB pHYs%%IR$iTXtXML:com.adobe.xmp 4 4 1 #2IDATX A 1g ٻx\=/ @ 0M<^IENDB`././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/empty.iconset/icon_16x16.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/empty.iconset/icon_10000644000175100017510000000121115154533055033236 0ustar runnerrunnerPNG  IHDRasRGB pHYs  iTXtXML:com.adobe.xmp 4 4 1 #"IDAT8c & 􂵎0a k IENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/0000755000175100017510000000000015154533055032265 5ustar runnerrunner././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16@2x.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/icon_0000644000175100017510000000123115154533055033274 0ustar runnerrunnerPNG  IHDR szzsRGB pHYs%%IR$iTXtXML:com.adobe.xmp 4 4 1 #2IDATX A 1g ٻx\=/ @ 0M<^IENDB`././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/icon_16x16.pngqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/icon_0000644000175100017510000000121115154533055033272 0ustar runnerrunnerPNG  IHDRasRGB pHYs  iTXtXML:com.adobe.xmp 4 4 1 #"IDAT8c & 􂵎0a k IENDB`././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/Contents.jsonqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/empty.xcassets/other.imageset/Conte0000644000175100017510000000053315154533055033261 0ustar runnerrunner{ "images" : [ { "idiom" : "universal", "scale" : "1x", "filename" : "icon_16x16.png" }, { "idiom" : "universal", "scale" : "2x", "filename" : "icon_16x16@2x.png" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } }qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/EmptyStoryboard.storyboard0000644000175100017510000000073115154533055031637 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/assetcatalog/main.c0000644000175100017510000000237015154533055025447 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/0000755000175100017510000000000015154533055025751 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/assetcatalog2.xcassets/0000755000175100017510000000000015154533055032341 5ustar runnerrunner././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/assetcatalog2.xcassets/.keepqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/assetcatalog2.xcassets/.kee0000644000175100017510000000000015154533055033074 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/assetcatalog1.xcassets/0000755000175100017510000000000015154533055032340 5ustar runnerrunner././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/assetcatalog1.xcassets/.keepqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/assetcatalog1.xcassets/.kee0000644000175100017510000000000015154533055033073 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/multiple-asset-catalogs.qbs0000644000175100017510000000022615154533055033223 0ustar runnerrunnerCppApplication { Depends { name: "ib" } files: [ "main.c", "assetcatalog1.xcassets", "assetcatalog2.xcassets" ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/ib/empty-asset-catalogs/main.c0000644000175100017510000000236415154533055027046 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/infoplist/0000755000175100017510000000000015154533055023320 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/infoplist/infoplist.qbs0000644000175100017510000000011515154533055026033 0ustar runnerrunnerCppApplication { cpp.minimumMacosVersion: "10.7" files: ["main.c"] } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/infoplist/main.c0000644000175100017510000000236415154533055024415 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/overrideInfoPlist/0000755000175100017510000000000015154533055024760 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/overrideInfoPlist/Override-Info.plist0000644000175100017510000000052515154533055030507 0ustar runnerrunner DefaultValue The default value OverriddenValue The default value qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/overrideInfoPlist/overrideInfoPlist.qbs0000644000175100017510000000064115154533055031137 0ustar runnerrunnerCppApplication { Depends { name: "bundle" } cpp.minimumMacosVersion: "10.7" files: ["main.c", "Override-Info.plist"] Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: true bundle.identifierPrefix: "com.test" bundle.infoPlist: ({ "CFBundleName": "My Bundle", "OverriddenValue": "The overridden value", }) } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/overrideInfoPlist/main.c0000644000175100017510000000003115154533055026042 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/bundle-structure/0000755000175100017510000000000015154533055024620 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/bundle-structure/shallow-unsigned.json0000644000175100017510000000335115154533055031000 0ustar runnerrunner{ "A": { "extension": ".app", "directories": [ "Headers", "PrivateHeaders" ], "files": [ "A", "Info.plist", "PkgInfo", "Headers/dummy.h", "PrivateHeaders/dummy_p.h", "resource.txt" ], "symlinks": [] }, "B": { "extension": ".framework", "directories": [ "Headers", "PrivateHeaders" ], "files": [ "B", "Headers/dummy.h", "Info.plist", "PrivateHeaders/dummy_p.h", "resource.txt" ], "symlinks": [] }, "C": { "extension": ".framework", "directories": [ "Headers", "PrivateHeaders" ], "files": [ "C", "Headers/dummy.h", "Info.plist", "PrivateHeaders/dummy_p.h", "resource.txt" ], "symlinks": [] }, "D": { "extension": ".bundle", "directories": [ "Headers", "PrivateHeaders" ], "files": [ "D", "Headers/dummy.h", "Info.plist", "PrivateHeaders/dummy_p.h", "resource.txt" ], "symlinks": [] }, "E": { "extension": ".appex", "directories": [ "Headers", "PrivateHeaders" ], "files": [ "E", "Headers/dummy.h", "Info.plist", "PrivateHeaders/dummy_p.h", "resource.txt" ], "symlinks": [] }, "F": { "extension": ".xpc", "directories": [ "Headers", "PrivateHeaders" ], "files": [ "F", "Headers/dummy.h", "Info.plist", "PrivateHeaders/dummy_p.h", "resource.txt" ], "symlinks": [] }, "G": { "extension": "", "directories": [ "Contents" ], "files": [ "ContentInfo.plist", "Contents/resource.txt" ], "symlinks": [] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/bundle-structure/dummy_p.h0000644000175100017510000000233215154533055026443 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/bundle-structure/deep.json0000644000175100017510000000701615154533055026434 0ustar runnerrunner{ "A": { "extension": ".app", "directories": [ "Contents", "Contents/Headers", "Contents/PrivateHeaders", "Contents/MacOS", "Contents/Resources", "Contents/_CodeSignature" ], "files": [ "Contents/Info.plist", "Contents/Headers/dummy.h", "Contents/PrivateHeaders/dummy_p.h", "Contents/MacOS/A", "Contents/PkgInfo", "Contents/Resources/resource.txt", "Contents/_CodeSignature/CodeResources" ], "symlinks": [] }, "B": { "extension": ".framework", "directories": [ "Versions", "Versions/A", "Versions/A/Headers", "Versions/A/PrivateHeaders", "Versions/A/Resources", "Versions/A/_CodeSignature" ], "files": [ "Versions/A/B", "Versions/A/Headers/dummy.h", "Versions/A/PrivateHeaders/dummy_p.h", "Versions/A/Resources/Info.plist", "Versions/A/Resources/resource.txt", "Versions/A/_CodeSignature/CodeResources" ], "symlinks": [ "B", "Headers", "PrivateHeaders", "Resources", "Versions/Current" ] }, "C": { "extension": ".framework", "directories": [ "Versions", "Versions/A", "Versions/A/Headers", "Versions/A/PrivateHeaders", "Versions/A/Resources", "Versions/A/_CodeSignature" ], "files": [ "Versions/A/C", "Versions/A/Headers/dummy.h", "Versions/A/PrivateHeaders/dummy_p.h", "Versions/A/Resources/Info.plist", "Versions/A/Resources/resource.txt", "Versions/A/_CodeSignature/CodeResources", "Versions/A/_CodeSignature/CodeDirectory", "Versions/A/_CodeSignature/CodeRequirements", "Versions/A/_CodeSignature/CodeRequirements-1", "Versions/A/_CodeSignature/CodeSignature" ], "symlinks": [ "C", "Headers", "PrivateHeaders", "Resources", "Versions/Current" ] }, "D": { "extension": ".bundle", "directories": [ "Contents", "Contents/Headers", "Contents/MacOS", "Contents/Resources", "Contents/PrivateHeaders", "Contents/_CodeSignature" ], "files": [ "Contents/Info.plist", "Contents/Headers/dummy.h", "Contents/MacOS/D", "Contents/PrivateHeaders/dummy_p.h", "Contents/Resources/resource.txt", "Contents/_CodeSignature/CodeResources" ], "symlinks": [] }, "E": { "extension": ".appex", "directories": [ "Contents", "Contents/Headers", "Contents/MacOS", "Contents/Resources", "Contents/PrivateHeaders", "Contents/_CodeSignature" ], "files": [ "Contents/Headers/dummy.h", "Contents/Info.plist", "Contents/MacOS/E", "Contents/PrivateHeaders/dummy_p.h", "Contents/Resources/resource.txt", "Contents/_CodeSignature/CodeResources" ], "symlinks": [] }, "F": { "extension": ".xpc", "directories": [ "Contents", "Contents/Headers", "Contents/MacOS", "Contents/Resources", "Contents/PrivateHeaders", "Contents/_CodeSignature" ], "files": [ "Contents/Info.plist", "Contents/Headers/dummy.h", "Contents/PrivateHeaders/dummy_p.h", "Contents/MacOS/F", "Contents/Resources/resource.txt", "Contents/_CodeSignature/CodeResources" ], "symlinks": [] }, "G": { "extension": "", "directories": [ "Contents" ], "files": [ "ContentInfo.plist", "Contents/resource.txt" ], "symlinks": [] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/bundle-structure/shallow-signed.json0000644000175100017510000000437515154533055030444 0ustar runnerrunner{ "A": { "extension": ".app", "directories": [ "Headers", "PrivateHeaders", "_CodeSignature" ], "files": [ "A", "Info.plist", "PkgInfo", "Headers/dummy.h", "PrivateHeaders/dummy_p.h", "resource.txt", "_CodeSignature/CodeResources" ], "symlinks": [] }, "B": { "extension": ".framework", "directories": [ "Headers", "PrivateHeaders", "_CodeSignature" ], "files": [ "B", "Headers/dummy.h", "Info.plist", "PrivateHeaders/dummy_p.h", "resource.txt", "_CodeSignature/CodeResources" ], "symlinks": [] }, "C": { "extension": ".framework", "directories": [ "Headers", "PrivateHeaders", "_CodeSignature" ], "files": [ "C", "Headers/dummy.h", "Info.plist", "PrivateHeaders/dummy_p.h", "resource.txt", "_CodeSignature/CodeResources", "_CodeSignature/CodeDirectory", "_CodeSignature/CodeRequirements", "_CodeSignature/CodeRequirements-1", "_CodeSignature/CodeSignature" ], "symlinks": [] }, "D": { "extension": ".bundle", "directories": [ "Headers", "PrivateHeaders", "_CodeSignature" ], "files": [ "D", "Headers/dummy.h", "Info.plist", "PrivateHeaders/dummy_p.h", "resource.txt", "_CodeSignature/CodeResources" ], "symlinks": [] }, "E": { "extension": ".appex", "directories": [ "Headers", "PrivateHeaders", "_CodeSignature" ], "files": [ "E", "Headers/dummy.h", "Info.plist", "PrivateHeaders/dummy_p.h", "resource.txt", "_CodeSignature/CodeResources" ], "symlinks": [] }, "F": { "extension": ".xpc", "directories": [ "Headers", "PrivateHeaders", "_CodeSignature" ], "files": [ "F", "Headers/dummy.h", "Info.plist", "PrivateHeaders/dummy_p.h", "resource.txt", "_CodeSignature/CodeResources" ], "symlinks": [] }, "G": { "extension": "", "directories": [ "Contents" ], "files": [ "ContentInfo.plist", "Contents/resource.txt" ], "symlinks": [] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/bundle-structure/bundle-structure.qbs0000644000175100017510000001256615154533055030650 0ustar runnerrunnerProject { property stringList bundleFileTags: ["bundle.content"] property stringList buildableProducts: ["A", "B", "C", "D", "E", "F", "G"] property bool enableCodeSigning: !qbs.targetOS.includes("ios") || qbs.targetOS.includes("ios-simulator") Product { Depends { name: "bundle" } condition: { console.info("bundle.isShallow: " + bundle.isShallow); console.info("qbs.targetOS: " + qbs.targetOS); console.info("enableCodeSigning: " + project.enableCodeSigning); return false; } } Application { Depends { name: "cpp" } Depends { name: "B" } Depends { name: "C" } Depends { name: "D" } condition: buildableProducts.includes("A") name: "A" bundle.isBundle: true bundle.publicHeaders: ["dummy.h"] bundle.privateHeaders: ["dummy_p.h"] bundle.resources: ["resource.txt"] codesign.enableCodeSigning: project.enableCodeSigning files: ["dummy.c"] install: true installDir: "" } Application { Depends { name: "cpp" } Depends { name: "B" } Depends { name: "C" } Depends { name: "D" } condition: buildableProducts.includes("ABadApple") name: "ABadApple" bundle._productTypeIdentifier: "com.apple.product-type.will.never.exist.ever.guaranteed" bundle.isBundle: true bundle.publicHeaders: ["dummy.h"] bundle.privateHeaders: ["dummy_p.h"] bundle.resources: ["resource.txt"] codesign.enableCodeSigning: project.enableCodeSigning files: ["dummy.c"] install: true installDir: "" } Application { Depends { name: "cpp" } Depends { name: "B" } Depends { name: "C" } Depends { name: "D" } condition: buildableProducts.includes("ABadThirdParty") name: "ABadThirdParty" bundle._productTypeIdentifier: "org.special.third.party.non.existent.product.type" bundle.isBundle: true bundle.publicHeaders: ["dummy.h"] bundle.privateHeaders: ["dummy_p.h"] bundle.resources: ["resource.txt"] codesign.enableCodeSigning: project.enableCodeSigning files: ["dummy.c"] install: true installDir: "" } DynamicLibrary { Depends { name: "cpp" } condition: buildableProducts.containsAny(["A", "B", "ABadApple", "ABadThirdParty"]) name: "B" bundle.isBundle: true bundle.publicHeaders: ["dummy.h"] bundle.privateHeaders: ["dummy_p.h"] bundle.resources: ["resource.txt"] codesign.enableCodeSigning: project.enableCodeSigning files: ["dummy.c"] install: true installDir: "" } StaticLibrary { Depends { name: "cpp" } condition: buildableProducts.containsAny(["A", "C", "ABadApple", "ABadThirdParty"]) name: "C" bundle.isBundle: true Group { name: "public headers" files: ["dummy.h"] fileTags: ["bundle.input.public_hpp", "hpp"] } Group { name: "private headers" files: ["dummy_p.h"] fileTags: ["bundle.input.private_hpp", "hpp"] } Group { name: "resources" files: ["resource.txt"] fileTags: ["bundle.input.resources"] } codesign.enableCodeSigning: project.enableCodeSigning files: ["dummy.c"] install: true installDir: "" } LoadableModule { Depends { name: "cpp" } condition: buildableProducts.containsAny(["A", "D", "ABadApple", "ABadThirdParty"]) name: "D" bundle.isBundle: true bundle.publicHeaders: ["dummy.h"] bundle.privateHeaders: ["dummy_p.h"] bundle.resources: ["resource.txt"] codesign.enableCodeSigning: project.enableCodeSigning files: ["dummy.c"] install: true installDir: "" } ApplicationExtension { Depends { name: "cpp" } condition: buildableProducts.includes("E") name: "E" bundle.isBundle: true bundle.publicHeaders: ["dummy.h"] bundle.privateHeaders: ["dummy_p.h"] bundle.resources: ["resource.txt"] codesign.enableCodeSigning: project.enableCodeSigning files: ["dummy.c"] install: true installDir: "" } XPCService { Depends { name: "cpp" } condition: buildableProducts.includes("F") name: "F" bundle.isBundle: true bundle.publicHeaders: ["dummy.h"] bundle.privateHeaders: ["dummy_p.h"] bundle.resources: ["resource.txt"] codesign.enableCodeSigning: project.enableCodeSigning files: ["dummy.c"] install: true installDir: "" } Product { Depends { name: "bundle" } condition: buildableProducts.includes("G") type: ["inapppurchase"] name: "G" bundle.isBundle: true bundle.resources: ["resource.txt"] // XCode 12.5 does not support com.apple.product-type.in-app-purchase-content type anymore, // so use older specs from Qbs bundle._useXcodeBuildSpecs: false Group { fileTagsFilter: product.type.concat(project.bundleFileTags) qbs.install: true qbs.installSourceBase: product.buildDirectory } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/bundle-structure/resource.txt0000644000175100017510000000000015154533055027176 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/bundle-structure/dummy.c0000644000175100017510000000236415154533055026124 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/bundle-structure/dummy.h0000644000175100017510000000233215154533055026124 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/lipo-symlinks/0000755000175100017510000000000015154533055024123 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/lipo-symlinks/lipo-symlinks.qbs0000644000175100017510000000122715154533055027446 0ustar runnerrunnerimport "../multiarch-helpers.js" as Helpers Project { name: "p" // we do not have the access to xcode version in qbs.architectures so we need to pass it here property string xcodeVersion property bool multiArch: false property bool multiVariant: false DynamicLibrary { Depends { name: "cpp" } name: "A" version: "1.2.3" bundle.isBundle: false files: "lib.cpp" install: true installDir: "" qbs.architectures: multiArch ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiVariant ? ["debug", "release"] : [] } }qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/lipo-symlinks/lib.cpp0000644000175100017510000000003415154533055025372 0ustar runnerrunnerint foo() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/0000755000175100017510000000000015154533055026552 5ustar runnerrunner././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/aggregateDependencyLinking.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/aggregateDependencyLinki0000644000175100017510000000333515154533055033415 0ustar runnerrunnerProject { minimumQbsVersion: "1.8" StaticLibrary { name: "multi_arch_lib" files: ["lib.c"] Depends { name: "cpp" } Depends { name: "bundle" } property bool hasX86Mac: true // cannot use xcode.version in qbs.architectures property bool hasArmMac: false bundle.isBundle: false // This will generate 2 multiplex configs and an aggregate. qbs.architectures: { if (qbs.targetPlatform === "macos") { if (hasX86Mac) return ["x86_64", "x86"]; else if (hasArmMac) return ["arm64", "x86_64"]; } else if (qbs.targetPlatform === "ios") { return ["arm64", "armv7a"]; } console.info("Cannot build fat binaries for this target platform (" + qbs.targetPlatform + ")"); return original; } qbs.buildVariant: "debug" cpp.minimumMacosVersion: "10.8" } CppApplication { name: "just_app" files: ["app.c"] // This should link only against the aggregate static library, and not against // the {debug, arm64} variant, or worse - against both the single arch variant // and the lipo-ed one. Depends { name: "multi_arch_lib" } Depends { name: "bundle" } bundle.isBundle: false qbs.architecture: { if (qbs.targetPlatform === "macos") return "x86_64"; else if (qbs.targetPlatform === "ios") return "arm64"; return original; } qbs.buildVariant: "debug" cpp.minimumMacosVersion: "10.8" multiplexByQbsProperties: [] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/app.c0000644000175100017510000000015515154533055027477 0ustar runnerrunnerextern int foo(); int main(int argc, char *argv[]) { (void) argc; (void) argv; return foo(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/lib.c0000644000175100017510000000024415154533055027464 0ustar runnerrunner#include int foo() { #ifdef __i386__ printf("Hello from i386\n"); #endif #ifdef __x86_64__ printf("Hello from x86_64\n"); #endif return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-multiconfig/0000755000175100017510000000000015154533055024730 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-multiconfig/app.c0000644000175100017510000000005715154533055025656 0ustar runnerrunnerextern int foo(); int main() { return foo(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-multiconfig/lib.c0000644000175100017510000000040215154533055025636 0ustar runnerrunner#include int foo() { #ifdef __i386__ printf("Hello from " VARIANT " i386\n"); #endif #ifdef __x86_64__ printf("Hello from " VARIANT " x86_64\n"); #endif #ifdef __arm64__ printf("Hello from " VARIANT " arm64\n"); #endif return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-multiconfig/apple-multiconfig.qbs0000644000175100017510000001365515154533055031070 0ustar runnerrunnerimport qbs.Utilities import "../multiarch-helpers.js" as Helpers Project { minimumQbsVersion: "1.8" condition: xcodeVersion property string xcodeVersion CppApplication { Depends { name: "singlelib" } Depends { name: "bundle" } property bool isShallow: { console.info("isShallow: " + bundle.isShallow); return bundle.isShallow; } name: "singleapp" targetName: "singleapp" files: ["app.c"] cpp.rpaths: [cpp.rpathOrigin + "/../../../"] cpp.minimumMacosVersion: "10.6" cpp.minimumIosVersion: "8.0" // Turn off multiplexing aggregate: false multiplexByQbsProperties: [] qbs.architecture: Helpers.getNewArch(qbs, project.xcodeVersion) install: true installDebugInformation: false installDir: "" } CppApplication { Depends { name: "singlelib" } Depends { name: "bundle" } name: "singleapp_agg" targetName: "singleapp_agg" files: ["app.c"] cpp.rpaths: [cpp.rpathOrigin + "/../../../"] cpp.minimumMacosVersion: "10.6" cpp.minimumIosVersion: "8.0" // Force aggregation when not needed aggregate: true qbs.architectures: [Helpers.getNewArch(qbs, project.xcodeVersion)] qbs.buildVariants: ["release"] install: true installDebugInformation: false installDir: "" } DynamicLibrary { Depends { name: "cpp" } Depends { name: "bundle" } name: "singlelib" targetName: "singlelib" files: ["lib.c"] cpp.sonamePrefix: qbs.targetOS.includes("darwin") ? "@rpath" : undefined cpp.defines: ["VARIANT=" + Utilities.cStringQuote(qbs.buildVariant)] // Turn off multiplexing aggregate: false multiplexByQbsProperties: [] qbs.architecture: Helpers.getNewArch(qbs, project.xcodeVersion) install: true installDebugInformation: false installDir: "" } CppApplication { Depends { name: "multilib" } Depends { name: "bundle" } name: "multiapp" targetName: "multiapp" files: ["app.c"] cpp.rpaths: [cpp.rpathOrigin + "/../../../"] cpp.minimumMacosVersion: "10.6" cpp.minimumIosVersion: "8.0" install: true installDebugInformation: false installDir: "" } CppApplication { Depends { name: "multilib" } Depends { name: "bundle" } name: "fatmultiapp" targetName: "fatmultiapp" files: ["app.c"] cpp.rpaths: [cpp.rpathOrigin + "/../../../"] cpp.minimumMacosVersion: "10.6" cpp.minimumIosVersion: "8.0" qbs.architectures: Helpers.getArchitectures(qbs, project.xcodeVersion) qbs.architecture: Helpers.getNewArch(qbs, project.xcodeVersion) multiplexByQbsProperties: Helpers.enableOldArch(qbs, project.xcodeVersion) ? ["architectures", "buildVariants"] : ["buildVariants"] qbs.buildVariants: "debug" install: true installDebugInformation: false installDir: "" } CppApplication { Depends { name: "multilib" } Depends { name: "bundle" } name: "fatmultiappmultivariant" targetName: "fatmultiappmultivariant" files: ["app.c"] cpp.rpaths: [cpp.rpathOrigin + "/../../../"] cpp.minimumMacosVersion: "10.6" cpp.minimumIosVersion: "8.0" qbs.architectures: Helpers.getArchitectures(qbs, project.xcodeVersion) qbs.buildVariants: ["debug", "profiling"] install: true installDebugInformation: false installDir: "" } DynamicLibrary { Depends { name: "cpp" } Depends { name: "bundle" } name: "multilib" targetName: "multilib" files: ["lib.c"] cpp.minimumIosVersion: "8.0" cpp.sonamePrefix: qbs.targetOS.includes("darwin") ? "@rpath" : undefined cpp.defines: ["VARIANT=" + Utilities.cStringQuote(qbs.buildVariant)] qbs.architectures: Helpers.getArchitectures(qbs, project.xcodeVersion) qbs.buildVariants: ["release", "debug", "profiling"] install: true installDebugInformation: false installDir: "" } DynamicLibrary { Depends { name: "cpp" } Depends { name: "bundle" } name: "multilib-no-release" targetName: "multilib-no-release" files: ["lib.c"] cpp.minimumIosVersion: "8.0" cpp.sonamePrefix: qbs.targetOS.includes("darwin") ? "@rpath" : undefined cpp.defines: ["VARIANT=" + Utilities.cStringQuote(qbs.buildVariant)] qbs.architectures: Helpers.getArchitectures(qbs, project.xcodeVersion) qbs.buildVariants: ["debug", "profiling"] install: true installDebugInformation: false installDir: "" } DynamicLibrary { Depends { name: "cpp" } Depends { name: "bundle" } Depends { name: "multilibB" } name: "multilibA" files: ["lib.c"] cpp.minimumIosVersion: "8.0" cpp.sonamePrefix: "@rpath" cpp.defines: ["VARIANT=" + Utilities.cStringQuote(qbs.buildVariant)] qbs.architectures: Helpers.getArchitectures(qbs, project.xcodeVersion) qbs.buildVariants: ["debug", "profiling"] install: true installDebugInformation: false installDir: "" } DynamicLibrary { Depends { name: "cpp" } Depends { name: "bundle" } name: "multilibB" files: ["lib.c"] cpp.minimumIosVersion: "8.0" cpp.sonamePrefix: "@rpath" cpp.defines: ["VARIANT=" + Utilities.cStringQuote(qbs.buildVariant)] qbs.architectures: Helpers.getArchitectures(qbs, project.xcodeVersion) qbs.buildVariants: ["debug", "profiling"] install: true installDebugInformation: false installDir: "" } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/xcode/0000755000175100017510000000000015154533055022413 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs0000644000175100017510000000452715154533055025700 0ustar runnerrunnerProject { property var sdks: {} Product { Depends { name: "xcode" } consoleApplication: { console.info("Developer directory: " + xcode.developerPath); console.info("SDK: " + xcode.sdk); console.info("Target devices: " + xcode.targetDevices.join(", ")); console.info("SDK name: " + xcode.sdkName); console.info("SDK version: " + xcode.sdkVersion); console.info("Latest SDK name: " + xcode.latestSdkName); console.info("Latest SDK version: " + xcode.latestSdkVersion); console.info("Available SDK names: " + xcode.availableSdkNames.join(", ")); console.info("Available SDK versions: " + xcode.availableSdkVersions.join(", ")); var targetOsToKey = function(targetOS) { if (targetOS.includes("ios")) return "iphoneos"; if (targetOS.includes("ios-simulator")) return "iphonesimulator"; if (targetOS.includes("macos")) return "macosx"; if (targetOS.includes("tvos")) return "appletvos"; if (targetOS.includes("tvos-simulator")) return "appletvsimulator"; if (targetOS.includes("watchos")) return "watchos"; if (targetOS.includes("watchos-simulator")) return "watchossimulator"; throw "Unsupported OS" + targetOS; } var actualList = project.sdks[targetOsToKey(qbs.targetOS)]; console.info("Actual SDK list: " + actualList.join(", ")); var msg = "Unexpected SDK list [" + xcode.availableSdkVersions.join(", ") + "]"; var testArraysEqual = function(a, b) { if (!a || !b || a.length !== b.length) { throw msg; } for (var i = 0; i < a.length; ++i) { var version1 = a[i].split('.'); var version2 = b[i].split('.'); for (var j = 0; j < version1.length; ++j) { if (version1[j] !== version2[j]) throw msg; } } } testArraysEqual(actualList, xcode.availableSdkVersions); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/main-bundle/0000755000175100017510000000000015154533055023504 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/main-bundle/shallow-unsigned.json0000644000175100017510000000304615154533055027665 0ustar runnerrunner{ "directories": [ "Applications", "Applications/F.app", "Executables", "Frameworks", "Frameworks/A.framework", "Frameworks/A.framework/Headers", "Frameworks/A.framework/PrivateHeaders", "Frameworks/B.framework", "Frameworks/B.framework/Headers", "Frameworks/B.framework/PrivateHeaders", "Headers", "PlugIns", "PlugIns/C.bundle", "PlugIns/C.bundle/Headers", "PlugIns/C.bundle/PrivateHeaders", "PrivateHeaders" ], "files": [ "MainApp", "Info.plist", "PkgInfo", "resource.txt", "Applications/F.app/F", "Applications/F.app/Info.plist", "Applications/F.app/PkgInfo", "Applications/F.app/resource.txt", "Executables/G", "Frameworks/A.framework/A", "Frameworks/A.framework/Headers/dummy.h", "Frameworks/A.framework/Info.plist", "Frameworks/A.framework/PrivateHeaders/dummy_p.h", "Frameworks/A.framework/resource.txt", "Frameworks/B.framework/B", "Frameworks/B.framework/Headers/dummy.h", "Frameworks/B.framework/Info.plist", "Frameworks/B.framework/PrivateHeaders/dummy_p.h", "Frameworks/B.framework/resource.txt", "Frameworks/libD.dylib", "Frameworks/libE.a", "Headers/dummy.h", "PlugIns/C.bundle/C", "PlugIns/C.bundle/Headers/dummy.h", "PlugIns/C.bundle/Info.plist", "PlugIns/C.bundle/PrivateHeaders/dummy_p.h", "PlugIns/C.bundle/resource.txt", "PrivateHeaders/dummy_p.h" ], "symlinks": [] } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/main-bundle/dummy_p.h0000644000175100017510000000001515154533055025323 0ustar runnerrunner#pragma once qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/main-bundle/deep.json0000644000175100017510000001046415154533055025321 0ustar runnerrunner{ "directories": [ "Contents", "Contents/_CodeSignature", "Contents/Applications", "Contents/Applications/F.app", "Contents/Applications/F.app/Contents", "Contents/Applications/F.app/Contents/_CodeSignature", "Contents/Applications/F.app/Contents/MacOS", "Contents/Applications/F.app/Contents/Resources", "Contents/Executables", "Contents/Frameworks", "Contents/Frameworks/A.framework", "Contents/Frameworks/A.framework/Versions", "Contents/Frameworks/A.framework/Versions/A", "Contents/Frameworks/A.framework/Versions/A/_CodeSignature", "Contents/Frameworks/A.framework/Versions/A/Headers", "Contents/Frameworks/A.framework/Versions/A/PrivateHeaders", "Contents/Frameworks/A.framework/Versions/A/Resources", "Contents/Frameworks/B.framework", "Contents/Frameworks/B.framework/Versions", "Contents/Frameworks/B.framework/Versions/A", "Contents/Frameworks/B.framework/Versions/A/_CodeSignature", "Contents/Frameworks/B.framework/Versions/A/Headers", "Contents/Frameworks/B.framework/Versions/A/PrivateHeaders", "Contents/Frameworks/B.framework/Versions/A/Resources", "Contents/Headers", "Contents/MacOS", "Contents/PlugIns", "Contents/PlugIns/C.bundle", "Contents/PlugIns/C.bundle/Contents", "Contents/PlugIns/C.bundle/Contents/_CodeSignature", "Contents/PlugIns/C.bundle/Contents/Headers", "Contents/PlugIns/C.bundle/Contents/MacOS", "Contents/PlugIns/C.bundle/Contents/PrivateHeaders", "Contents/PlugIns/C.bundle/Contents/Resources", "Contents/PrivateHeaders", "Contents/Resources" ], "files": [ "Contents/_CodeSignature/CodeResources", "Contents/Applications/F.app/Contents/_CodeSignature/CodeResources", "Contents/Applications/F.app/Contents/Info.plist", "Contents/Applications/F.app/Contents/MacOS/F", "Contents/Applications/F.app/Contents/PkgInfo", "Contents/Applications/F.app/Contents/Resources/resource.txt", "Contents/Executables/G", "Contents/Frameworks/A.framework/Versions/A/_CodeSignature/CodeResources", "Contents/Frameworks/A.framework/Versions/A/A", "Contents/Frameworks/A.framework/Versions/A/Headers/dummy.h", "Contents/Frameworks/A.framework/Versions/A/PrivateHeaders/dummy_p.h", "Contents/Frameworks/A.framework/Versions/A/Resources/Info.plist", "Contents/Frameworks/A.framework/Versions/A/Resources/resource.txt", "Contents/Frameworks/B.framework/Versions/A/_CodeSignature/CodeResources", "Contents/Frameworks/B.framework/Versions/A/B", "Contents/Frameworks/B.framework/Versions/A/_CodeSignature/CodeDirectory", "Contents/Frameworks/B.framework/Versions/A/_CodeSignature/CodeRequirements", "Contents/Frameworks/B.framework/Versions/A/_CodeSignature/CodeRequirements-1", "Contents/Frameworks/B.framework/Versions/A/_CodeSignature/CodeResources", "Contents/Frameworks/B.framework/Versions/A/_CodeSignature/CodeSignature", "Contents/Frameworks/B.framework/Versions/A/Headers/dummy.h", "Contents/Frameworks/B.framework/Versions/A/PrivateHeaders/dummy_p.h", "Contents/Frameworks/B.framework/Versions/A/Resources/Info.plist", "Contents/Frameworks/B.framework/Versions/A/Resources/resource.txt", "Contents/Frameworks/libD.dylib", "Contents/Frameworks/libE.a", "Contents/Headers/dummy.h", "Contents/Info.plist", "Contents/MacOS/MainApp", "Contents/PkgInfo", "Contents/PlugIns/C.bundle/Contents/_CodeSignature/CodeResources", "Contents/PlugIns/C.bundle/Contents/Headers/dummy.h", "Contents/PlugIns/C.bundle/Contents/Info.plist", "Contents/PlugIns/C.bundle/Contents/MacOS/C", "Contents/PlugIns/C.bundle/Contents/PrivateHeaders/dummy_p.h", "Contents/PlugIns/C.bundle/Contents/Resources/resource.txt", "Contents/PrivateHeaders/dummy_p.h", "Contents/Resources/resource.txt" ], "symlinks": [ "Contents/Frameworks/A.framework/A", "Contents/Frameworks/A.framework/Headers", "Contents/Frameworks/A.framework/PrivateHeaders", "Contents/Frameworks/A.framework/Resources", "Contents/Frameworks/A.framework/Versions/Current", "Contents/Frameworks/B.framework/B", "Contents/Frameworks/B.framework/Headers", "Contents/Frameworks/B.framework/PrivateHeaders", "Contents/Frameworks/B.framework/Resources", "Contents/Frameworks/B.framework/Versions/Current" ] } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/main-bundle/shallow-signed.json0000644000175100017510000000417415154533055027325 0ustar runnerrunner{ "directories": [ "_CodeSignature", "Applications", "Applications/F.app", "Applications/F.app/_CodeSignature", "Executables", "Frameworks", "Frameworks/A.framework", "Frameworks/A.framework/_CodeSignature", "Frameworks/A.framework/Headers", "Frameworks/A.framework/PrivateHeaders", "Frameworks/B.framework", "Frameworks/B.framework/_CodeSignature", "Frameworks/B.framework/Headers", "Frameworks/B.framework/PrivateHeaders", "Headers", "PlugIns", "PlugIns/C.bundle", "PlugIns/C.bundle/_CodeSignature", "PlugIns/C.bundle/Headers", "PlugIns/C.bundle/PrivateHeaders", "PrivateHeaders" ], "files": [ "MainApp", "Info.plist", "PkgInfo", "resource.txt", "_CodeSignature/CodeResources", "Applications/F.app/_CodeSignature/CodeResources", "Applications/F.app/F", "Applications/F.app/Info.plist", "Applications/F.app/PkgInfo", "Applications/F.app/resource.txt", "Executables/G", "Frameworks/A.framework/_CodeSignature/CodeResources", "Frameworks/A.framework/A", "Frameworks/A.framework/Headers/dummy.h", "Frameworks/A.framework/Info.plist", "Frameworks/A.framework/PrivateHeaders/dummy_p.h", "Frameworks/A.framework/resource.txt", "Frameworks/B.framework/_CodeSignature/CodeDirectory", "Frameworks/B.framework/_CodeSignature/CodeRequirements", "Frameworks/B.framework/_CodeSignature/CodeRequirements-1", "Frameworks/B.framework/_CodeSignature/CodeResources", "Frameworks/B.framework/_CodeSignature/CodeSignature", "Frameworks/B.framework/B", "Frameworks/B.framework/Headers/dummy.h", "Frameworks/B.framework/Info.plist", "Frameworks/B.framework/PrivateHeaders/dummy_p.h", "Frameworks/B.framework/resource.txt", "Frameworks/libD.dylib", "Frameworks/libE.a", "Headers/dummy.h", "PlugIns/C.bundle/_CodeSignature/CodeResources", "PlugIns/C.bundle/C", "PlugIns/C.bundle/Headers/dummy.h", "PlugIns/C.bundle/Info.plist", "PlugIns/C.bundle/PrivateHeaders/dummy_p.h", "PlugIns/C.bundle/resource.txt", "PrivateHeaders/dummy_p.h" ], "symlinks": [] } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/main-bundle/resource.txt0000644000175100017510000000000015154533055026062 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/main-bundle/dummy.c0000644000175100017510000000003115154533055024775 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/main-bundle/main-bundle.qbs0000644000175100017510000001355615154533055026420 0ustar runnerrunnerimport "../multiarch-helpers.js" as Helpers Project { readonly property bool enableCodeSigning: !qbs.targetOS.includes("ios") || qbs.targetOS.includes("ios-simulator") property bool multiplexArchitectures: false property bool multiplexBuildVariants: false property string xcodeVersion Product { Depends { name: "bundle" } condition: { console.info("bundle.isShallow: " + bundle.isShallow); console.info("qbs.targetOS: " + qbs.targetOS); console.info("enableCodeSigning: " + project.enableCodeSigning); return false; } } // main bundle Application { Depends { name: "cpp" } Depends { name: "bundle" } Depends { name: "A" } // framework Depends { name: "B" } // static framework Depends { name: "C" } // loadable module Depends { name: "D" } // dynamic library Depends { name: "E" } // static library Depends { name: "F" } // application Depends { name: "G" } // executable Depends { name: "H"; bundle.isForMainBundle: false; } // executable, not copied name: "MainApp" bundle.isBundle: true bundle.isMainBundle: true bundle.publicHeaders: ["dummy.h"] bundle.privateHeaders: ["dummy_p.h"] bundle.resources: ["resource.txt"] codesign.enableCodeSigning: project.enableCodeSigning qbs.architectures: project.multiplexArchitectures ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiplexBuildVariants ? ["debug", "release"] : [] files: ["dummy.c"] installDir: "" } DynamicLibrary { Depends { name: "cpp" } name: "A" bundle.isBundle: true bundle.publicHeaders: ["dummy.h"] bundle.privateHeaders: ["dummy_p.h"] bundle.resources: ["resource.txt"] codesign.enableCodeSigning: project.enableCodeSigning qbs.architectures: project.multiplexArchitectures ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiplexBuildVariants ? ["debug", "release"] : [] files: ["dummy.c"] install: false installDir: "" } StaticLibrary { Depends { name: "cpp" } name: "B" bundle.isBundle: true bundle.publicHeaders: ["dummy.h"] bundle.privateHeaders: ["dummy_p.h"] bundle.resources: ["resource.txt"] bundle.isForMainBundle: true // static library is not copied by default, override codesign.enableCodeSigning: project.enableCodeSigning qbs.architectures: project.multiplexArchitectures ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiplexBuildVariants ? ["debug", "release"] : [] files: ["dummy.c"] install: false installDir: "" } LoadableModule { Depends { name: "cpp" } name: "C" bundle.isBundle: true bundle.publicHeaders: ["dummy.h"] bundle.privateHeaders: ["dummy_p.h"] bundle.resources: ["resource.txt"] codesign.enableCodeSigning: project.enableCodeSigning qbs.architectures: project.multiplexArchitectures ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] // qbs.buildVariants: project.isMultiplexed ? ["debug", "release"] : [] files: ["dummy.c"] install: false installDir: "" } DynamicLibrary { Depends { name: "cpp" } name: "D" bundle.isBundle: false codesign.enableCodeSigning: project.enableCodeSigning qbs.architectures: project.multiplexArchitectures ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiplexBuildVariants ? ["debug", "release"] : [] files: ["dummy.c"] install: false installDir: "" } StaticLibrary { Depends { name: "cpp" } name: "E" bundle.isBundle: false bundle.isForMainBundle: true codesign.enableCodeSigning: project.enableCodeSigning qbs.architectures: project.multiplexArchitectures ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiplexBuildVariants ? ["debug", "release"] : [] files: ["dummy.c"] install: false installDir: "" } // bundle application Application { Depends { name: "cpp" } name: "F" bundle.isBundle: true bundle.resources: ["resource.txt"] codesign.enableCodeSigning: project.enableCodeSigning qbs.architectures: project.multiplexArchitectures ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiplexBuildVariants ? ["debug", "release"] : [] files: ["dummy.c"] install: false installDir: "" } // non-bundle application Application { Depends { name: "cpp" } name: "G" bundle.isBundle: false codesign.enableCodeSigning: project.enableCodeSigning qbs.architectures: project.multiplexArchitectures ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiplexBuildVariants ? ["debug", "release"] : [] files: ["dummy.c"] install: false installDir: "" } // non-bundle application Application { Depends { name: "cpp" } name: "H" bundle.isBundle: false codesign.enableCodeSigning: project.enableCodeSigning qbs.architectures: project.multiplexArchitectures ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiplexBuildVariants ? ["debug", "release"] : [] files: ["dummy.c"] install: false installDir: "" } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/main-bundle/dummy.h0000644000175100017510000000003215154533055025003 0ustar runnerrunner#pragma once int main(); qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/codesign/0000755000175100017510000000000015154533055023104 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs0000644000175100017510000000437415154533055025416 0ustar runnerrunnerimport "../multiarch-helpers.js" as Helpers Project { name: "p" // we do not have the access to xcode version in qbs.architectures so we need to pass it here property string xcodeVersion property bool isBundle: true property bool enableSigning: true property bool multiArch: false property bool multiVariant: false CppApplication { name: "A" version: "1.0.0" bundle.isBundle: project.isBundle files: "app.cpp" codesign.enableCodeSigning: project.enableSigning codesign.signingType: "ad-hoc" install: true installDir: "" qbs.architectures: multiArch ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiVariant ? ["debug", "release"] : [] } DynamicLibrary { Depends { name: "cpp" } name: "B" version: "1.0.0" bundle.isBundle: project.isBundle files: "app.cpp" codesign.enableCodeSigning: project.enableSigning codesign.signingType: "ad-hoc" install: true installDir: "" qbs.architectures: multiArch ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiVariant ? ["debug", "release"] : [] } LoadableModule { Depends { name: "cpp" } name: "C" version: "1.0.0" bundle.isBundle: project.isBundle files: "app.cpp" codesign.enableCodeSigning: project.enableSigning codesign.signingType: "ad-hoc" install: true installDir: "" qbs.architectures: multiArch ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiVariant ? ["debug", "release"] : [] } StaticLibrary { Depends { name: "cpp" } name: "D" version: "1.0.0" bundle.isBundle: project.isBundle files: "app.cpp" codesign.enableCodeSigning: project.enableSigning codesign.signingType: "ad-hoc" install: true installDir: "" qbs.architectures: multiArch ? Helpers.getArchitectures(qbs, project.xcodeVersion) : [] qbs.buildVariants: project.multiVariant ? ["debug", "release"] : [] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/codesign/app.cpp0000644000175100017510000000003115154533055024362 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/frameworkStructure/0000755000175100017510000000000015154533055025227 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/frameworkStructure/frameworkStructure.qbs0000644000175100017510000000123615154533055031656 0ustar runnerrunnerProject { property bool includeHeaders: true Library { Depends { name: "cpp" } Depends { name: "bundle" } property bool isShallow: { console.info("isShallow: " + bundle.isShallow); return bundle.isShallow; } name: "Widget" bundle.isBundle: true bundle.publicHeaders: project.includeHeaders ? ["Widget.h"] : undefined bundle.privateHeaders: project.includeHeaders ? ["WidgetPrivate.h"] : base bundle.resources: ["BaseResource", "en.lproj/EnglishResource"] files: ["Widget.cpp"].concat(bundle.publicHeaders || []).concat(bundle.privateHeaders || []) } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/frameworkStructure/BaseResource0000644000175100017510000000000015154533055027522 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/frameworkStructure/Widget.h0000644000175100017510000000234615154533055026630 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int foo(); qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/frameworkStructure/WidgetPrivate.h0000644000175100017510000000233215154533055030156 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/frameworkStructure/en.lproj/0000755000175100017510000000000015154533055026756 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/frameworkStructure/en.lproj/EnglishResource0000644000175100017510000000000015154533055031770 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/frameworkStructure/Widget.cpp0000644000175100017510000000236315154533055027162 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int foo() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/embedInfoPlist/0000755000175100017510000000000015154533055024215 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/embedInfoPlist/embedInfoPlist.qbs0000644000175100017510000000241515154533055027632 0ustar runnerrunnerProject { CppApplication { Depends { name: "lib" } Depends { name: "mod" } name: "app" consoleApplication: true files: ["main.m"] cpp.frameworks: ["Foundation"] cpp.rpaths: [cpp.rpathOrigin] cpp.minimumMacosVersion: "10.6" bundle.infoPlist: ({ "QBS": "org.qt-project.qbs.testdata.embedInfoPlist" }) install: true installDir: "" } DynamicLibrary { Depends { name: "cpp" } name: "lib" bundle.isBundle: false bundle.embedInfoPlist: true files: ["main.m"] cpp.frameworks: ["Foundation"] cpp.sonamePrefix: "@rpath" bundle.infoPlist: ({ "QBS": "org.qt-project.qbs.testdata.embedInfoPlist.dylib" }) install: true installDir: "" } LoadableModule { Depends { name: "cpp" } name: "mod" bundle.isBundle: false bundle.embedInfoPlist: true files: ["main.m"] installDir: "" cpp.frameworks: ["Foundation"] bundle.infoPlist: ({ "QBS": "org.qt-project.qbs.testdata.embedInfoPlist.bundle" }) Group { fileTagsFilter: product.type qbs.install: true } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/embedInfoPlist/main.m0000644000175100017510000000053615154533055025323 0ustar runnerrunner#import int main() { NSDictionary *infoPlist = [[NSBundle mainBundle] infoDictionary]; BOOL success = [[infoPlist objectForKey:@"QBS"] isEqualToString:@"org.qt-project.qbs.testdata.embedInfoPlist"]; fprintf(success ? stdout : stderr, "%s\n", [[infoPlist description] UTF8String]); return success ? 0 : 1; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/0000755000175100017510000000000015154533055023157 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/ru_RU.lproj/0000755000175100017510000000000015154533055025340 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/ru_RU.lproj/eula.txt0000644000175100017510000000022515154533055027026 0ustar runnerrunnerFICTIONAL CORPORATION SOFTWARE EXAMPLE AGREEMENT You agree that you will not use this app to make nuclear weapons. You agree that Qbs is the best. qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/en_US.lproj/0000755000175100017510000000000015154533055025315 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/en_US.lproj/eula.txt0000644000175100017510000000022515154533055027003 0ustar runnerrunnerFICTIONAL CORPORATION SOFTWARE EXAMPLE AGREEMENT You agree that you will not use this app to make nuclear weapons. You agree that Qbs is the best. qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/white.iconset/0000755000175100017510000000000015154533055025742 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/white.iconset/icon_16x16@2x.png0000644000175100017510000000123115154533055030614 0ustar runnerrunnerPNG  IHDR szzsRGB pHYs%%IR$iTXtXML:com.adobe.xmp 4 4 1 #2IDATX A 1g ٻx\=/ @ 0M<^IENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/white.iconset/icon_16x16.png0000644000175100017510000000121115154533055030240 0ustar runnerrunnerPNG  IHDRasRGB pHYs  iTXtXML:com.adobe.xmp 4 4 1 #"IDAT8c & 􂵎0a k IENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/zh_TW.lproj/0000755000175100017510000000000015154533055025337 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/zh_TW.lproj/eula.docx0000644000175100017510000003006215154533055027145 0ustar runnerrunnerPK!87l[Content_Types].xml (MK@!Um=H8j ^I_Nm/d}g͌&kĤ+ٰ JyfO- J&ˋl evd py ">JHq΃bz0;9l^Füܙ0pzֺi yll"U?<ҷd}] ԁlPK!`N _rels/.rels (JA 0ޝml/RM>@I}{QRK'|\ä^OiAQ8xޮgw`t8HT`]_-hBEeJ(.vIbAg/8^ 莘j Am.arůJFH %v}}fqߓ@ML̵~ U.ns=y%H]APK!? word/_rels/document.xml.rels (OK@a٤jz^oRib r|o~'jS%)tƗ7 +u*`__^i{1őLVS{tj2ԲC(iaYؔ ¦Q ='WUkɛE*$!s܌b5,D9r?'Hz hMA,8;_3bd0;bocۑ#INl$b^}PK!e word/document.xmlWMo60tOaEvEl']<m HHQ Z` -+0`(e1ReYF|?>C7\Ҁp0ZUC+^M핪VQOv'Cc*KA;qM]]'Q9+W1tC=2L#Ŝa"DtEl1I2*Z`gbBenRP9.pQ8 ffDf!rSz:'!fTAxyr[茏GU ؓFyk+fp-#)Tͦ.'O _ ]>]Fg82:C*BE gfJ,&8+"f_V}//PK! (word/theme/theme1.xmlXKo6 xߕW b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i)mAx>@6aLd;uEd>7fGd7 ?6mz%{eC#N@bs5î'exnĔR$=ScϏF_(CXitA%3֤\Ń83hxF}p2/#Xd}k5ڌ5>~yNaʻ?3:"r^hx,?pz=F\'-w+N:nak,ȶi?PK!~bjdocProps/app.xml (RMK0 һlD"lsHm0MB2ZV{ɛGwL*,`oWS}wZ7r;BDs>ʎ( u =3MH"nS+BXAIWձBoI鿢&_~7$G-LĄBH(+UY.Ad<1pթ4Y 1:b)PqrW 淀CQ%KǼ;G'cΒjݷV8lT^S 2XQiwx6O7#`(:'7[ߢK z\-*>_bq PK-!87l[Content_Types].xmlPK-!`N _rels/.relsPK-!? word/_rels/document.xml.relsPK-!e  word/document.xmlPK-! ( word/theme/theme1.xmlPK-!N0word/settings.xmlPK-!t?9z(^customXml/_rels/item1.xml.relsPK-!s?dcustomXml/itemProps1.xmlPK-!ݸ5< rword/styles.xmlPK-!rW;b#docProps/core.xmlPK-!ޑ%customXml/item1.xmlPK-!Biom&word/fontTable.xmlPK-!fv(word/webSettings.xmlPK-!~bj)docProps/app.xmlPK,qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/hello.icns0000644000175100017510000524214315154533055025153 0ustar runnerrunnericnsDcTOC hic08aic10 gic13aic096/ic12ic079il32l8mkic11 is32os8mkic146/ic08aPNG  IHDR?1 AiCCPICC ProfileH wTSϽ7" %z ;HQIP&vDF)VdTG"cE b PQDE݌k 5ޚYg}׺PtX4X\XffGD=HƳ.d,P&s"7C$ E6<~&S2)212 "įl+ɘ&Y4Pޚ%ᣌ\%g|eTI(L0_&l2E9r9hxgIbטifSb1+MxL 0oE%YmhYh~S=zU&ϞAYl/$ZUm@O ޜl^ ' lsk.+7oʿ9V;?#I3eE妧KD d9i,UQ h A1vjpԁzN6p\W p G@ K0ށiABZyCAP8C@&*CP=#t] 4}a ٰ;GDxJ>,_“@FXDBX$!k"EHqaYbVabJ0՘cVL6f3bձX'?v 6-V``[a;p~\2n5׌ &x*sb|! ߏƿ'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+q펲P%:,LO&oGh7vL&-cK|24h̐Ciq4S_MC'䃗-ҙ'L"; ]N,GivCXZd47x}qHz>m2^]KꪑxeqWJ|E|?|ÍحֻM^f T  3'Z֏@AZQ^hM _>Y[3;86KUǠ1JxY)1N#%6.ۉ f>-prh*.[ö2zop [61\?/UR-ƈ+5Q XYUv+uu\62PK*~uh5fB.FJ 4Hcr%&0پGMX@TQYa2OY UY)Pdk4jLsVW"drER:(J1GPzPV̰AH`|eLh47naCeG;еRﮒo3`%c pΎ.EWPd<+;1j$hDG %[A6 v/P>YՔʍQu*uZd$@ 1deG/ԆHSH&EʢU#5"$#grJU Z =R;圏]On e9vv}`A#e̕@-!zqiZI h 07f#2A-@r{ %97AoOrr|2nӐ ){ͬbq[A֕ ?Rr^ezsFc5O9֥Q4t8eY缕0*[zVJEsہ@$ӻҫ(nj O>#C -66gle'FdJet+5]{IA[h[Iꗔ+;U- [["eWjIn|g[%|MȪ1HY>r,RP%8CYUCvpQIHóUzxX <}.L D@[ L܈Ua%.I#a2CCwR-oJ3t Xlgi M@fޞd}ͺ;}ʦK IENDB`qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/fr_FR.lproj/0000755000175100017510000000000015154533055025302 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/fr_FR.lproj/eula.txt0000644000175100017510000000027015154533055026770 0ustar runnerrunnerSOCIÉTÉ FICTIONNEL EXEMPLE D'ACCORD DU LOGICIEL Vous vous engagez à ne pas utiliser cette application pour fabriquer des armes nucléaires. Vous acceptez que Qbs est le meilleur. qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/ja_JP.lproj/0000755000175100017510000000000015154533055025267 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/ja_JP.lproj/eula.txt0000644000175100017510000000035115154533055026755 0ustar runnerrunner架空CORPORATION ソフトウェア例契約 あなたは核兵器を作るために、このアプリを使用しないことに同意します。 あなたは、QBSがベストであることに同意するものとします。 qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/apple-dmg.qbs0000644000175100017510000000362715154533055025544 0ustar runnerrunnerProject { AppleApplicationDiskImage { Depends { name: "myapp" } Depends { name: "ib" } dmg.volumeName: "My Great App" dmg.iconSize: 128 dmg.windowWidth: 640 dmg.windowHeight: 280 files: [ "white.iconset", ] } CppApplication { name: "myapp" targetName: "My Great App" files: ["main.c"] install: true } AppleDiskImage { name: "hellodmg" targetName: "hellodmg-1.0" + (qbs.architecture ? "-" + qbs.architecture : "") dmg.volumeName: "Hello DMG" files: [ "hello.icns", "hello.tif" ] Group { files: ["en_US.lproj/eula.txt"] fileTags: ["dmg.input", "dmg.license.input"] dmg.iconX: 320 dmg.iconY: 240 dmg.licenseLocale: "en_US" } Group { files: ["*.lproj/**"] excludeFiles: ["en_US.lproj/eula.txt"] } } AppleDiskImage { name: "green" dmg.backgroundColor: "green" } AppleDiskImage { name: "german" dmg.defaultLicenseLocale: "de_DE" Group { files: ["*.lproj/**"] } } AppleDiskImage { name: "custom-buttons" Group { files: ["ru_RU.lproj/eula.txt"] dmg.licenseLocale: "sv_SE" // override auto-detected ru_RU with sv_SE dmg.licenseLanguageName: "Swedish, not Russian" dmg.licenseAgreeButtonText: "Of course" dmg.licenseDisagreeButtonText: "Never!" dmg.licensePrintButtonText: "Make Paper" dmg.licenseSaveButtonText: "Make Bits" dmg.licenseInstructionText: "Do please agree to the license!" } Group { files: ["*.lproj/**"] excludeFiles: ["ru_RU.lproj/eula.txt"] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/hello.tif0000644000175100017510000323466615154533055025012 0ustar runnerrunnerII*+ 6O ?!@XcbPG-}Ā1`49HcQM#?Q /?%O0[3}NbXr^KbG|f95jQB5':kVF&@M/)[U%P,bg(}%ٌ*ƞ;z[$;S@mQF-q'WkYGARʣY5?볱#mMcͦ=1D#϶>9XXu%Mugk kxf1HCdXx ?[e ֈ1)[4-{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data-apple/apple-dmg/hello.tif HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)Kmqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/zh_CN.lproj/0000755000175100017510000000000015154533055025305 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/zh_CN.lproj/eula.odt0000644000175100017510000000517015154533055026746 0ustar runnerrunnerPK^C^2 ''mimetypeapplication/vnd.oasis.opendocument.textPK^C \yN content.xmlXo60t, ђS]``C:Wmb)HT.Zt-!am lJnFW(r l|{|>GQ^^kÈ0:L0E%t6־>nO> -|L4r2X[a0"C##QN2K<\xU%v#gNh7j QS<}ʄ~9bXs8qlĶ0!H%aTE(a,acUIl]8TrX[h9SA4rm]jaM`W8U-j.ݐ $P~ ]gTe@֠)]l\A[qH8+pJřhgRiYR!Gnvw L 8R|KG'Ŧ9{>.F^4e^[XXNZ{wZ;d6ZKvwPM-1'8S&.85MN_>EzH"QC8 a0/ _"@Ϣ. ] ҃PMUR` ,"Ʌhzh*A690-Ehm+BW˰{Ww=%mvlS:{j1lƵcNԪ(Ԑ8 TE,F+5-J+]+]QP]Cܭ&dnH,Ʋ>\UgH|UUYۭ4襞R~fa§uO}"~\<\J'ׯO࿤r~v\R٪&߽MLh l#XboPK^CID styles.xmlVn0+ eZI $zjNM?&)%Hr]RS~$z Yp9TQ+%zDÀ˦%~OB2s`m-Z]aqc>KZ@yCkasrТV}$Xr e tZ뺆7ln$֠hL0{6y'Hݺ".iSoGÎ1`r-w뺆<]֜q}ZcrK+7Tb/#(Kl;Xެ9>vD::WOdH<߽o%b$\)_ݫ/PK^C0.eaMETA-INF/manifest.xmlj0  %I"M7MOoܒiroO_PK^C^2 ''mimetypePK^C \yN Mcontent.xmlPK^CID <styles.xmlPK^Cmeta.xmlPK^C0.eaMETA-INF/manifest.xmlPK B qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/en_GB.lproj/0000755000175100017510000000000015154533055025256 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/en_GB.lproj/eula.txt0000644000175100017510000000022515154533055026744 0ustar runnerrunnerFICTIONAL CORPORATION SOFTWARE EXAMPLE AGREEMENT You agree that you will not use this app to make nuclear weapons. You agree that Qbs is the best. qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/ko_KR.lproj/0000755000175100017510000000000015154533055025311 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/ko_KR.lproj/eula.rtf0000644000175100017510000000201615154533055026753 0ustar runnerrunner{\rtf1\ansi\ansicpg1252\cocoartf1265 {\fonttbl\f0\fnil\fcharset129 AppleSDGothicNeo-Regular;\f1\fswiss\fcharset0 Helvetica;} {\colortbl;\red255\green255\blue255;} \margl1440\margr1440\vieww10800\viewh8400\viewkind0 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural \f0\b\fs24 \cf0 \'c7\'e3\'b1\'b8 \f1 CORPORATION\ \f0 \'bc\'d2\'c7\'c1\'c6\'ae\'bf\'fe\'be\'ee \f1 \f0 \'bf\'b9 \f1 \f0 \'b0\'e8\'be\'e0 \f1\b0 \ \ \f0 \'b4\'e7\'bd\'c5\'c0\'ba \f1 \f0 \'b4\'e7\'bd\'c5\'c0\'cc \f1 \f0 \'c7\'d9\'b9\'ab\'b1\'e2\'b8\'a6 \f1 \f0 \'b8\'b8\'b5\'e9\'b1\'e2 \f1 \f0 \'c0\'a7\'c7\'d8\'c0\'cc \f1 \f0 \'c0\'c0\'bf\'eb \f1 \f0 \'c7\'c1\'b7\'ce\'b1\'d7\'b7\'a5\'c0\'bb \f1 \f0 \'bb\'e7\'bf\'eb\'c7\'cf\'c1\'f6 \f1 \f0 \'be\'ca\'c0\'bb \f1 \f0 \'b0\'cd\'bf\'a1 \f1 \f0 \'b5\'bf\'c0\'c7\'c7\'d5\'b4\'cf\'b4\'d9 \f1 .\ \ \f0 \'b4\'e7\'bd\'c5\'c0\'ba \f1 QBS \f0 \'b0\'a1 \f1 \f0 \'c3\'d6\'b0\'ed\'b6\'f3\'b0\'ed \f1 \f0 \'b5\'bf\'c0\'c7\'c7\'d5\'b4\'cf\'b4\'d9 \f1 .}qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/main.c0000644000175100017510000000003115154533055024241 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/de_DE.lproj/0000755000175100017510000000000015154533055025244 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-apple/apple-dmg/de_DE.lproj/eula.txt0000644000175100017510000000024615154533055026735 0ustar runnerrunnerFIKTIVE UNTERNEHMEN SOFTWARE BEISPIEL VEREINBARUNG Sie stimmen zu, dass Sie nicht mit dieser App auf Atomwaffen zu machen. Sie bestätigen, dass Qbs das Beste ist. qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/0000755000175100017510000000000015154533055021702 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-windows/innosetupDependencies/0000755000175100017510000000000015154533055026235 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-windows/innosetupDependencies/test.iss0000644000175100017510000000032215154533055027731 0ustar runnerrunner[Setup] AppName={#MyProgram} AppVersion={#MyProgramVersion} DefaultDirName={pf}\{#MyProgram} [Files] Source: "{#buildDirectory}\app.exe"; DestDir: "{app}" Source: "{#buildDirectory}\lib.dll"; DestDir: "{app}" qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/innosetupDependencies/innosetupDependencies.qbs0000644000175100017510000000464415154533055033307 0ustar runnerrunnerimport qbs.TextFile Project { InnoSetup { property bool _test: { var present = qbs.targetOS.includes("windows") && innosetup.present; console.info("has innosetup: " + present); } Depends { name: "app" } Depends { name: "lib" } name: "QbsSetup" targetName: "qbs.setup.test" version: "1.5" files: [ "test.iss" ] innosetup.verboseOutput: true innosetup.defines: [ "MyProgram=" + name, "MyProgramVersion=" + version, "buildDirectory=" + project.buildDirectory ] innosetup.compilerFlags: ["/V9"] destinationDirectory: project.buildDirectory } Application { Depends { name: "cpp" } name: "app" files: ["main.c"] Group { fileTagsFilter: product.type qbs.install: true } destinationDirectory: project.buildDirectory } DynamicLibrary { Depends { name: "cpp" } name: "lib" files: ["main.c"] Group { fileTagsFilter: product.type qbs.install: true } Rule { // This rule tries to provoke the installer into building too early (and the test // verifies that it does not) by causing the build of the installables to take // a lot longer. multiplex: true outputFileTags: ["c"] outputArtifacts: { var artifacts = []; for (var i = 0; i < 96; ++i) artifacts.push({ filePath: "c" + i + ".c", fileTags: ["c"] }); return artifacts; } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { for (var i = 0; i < outputs["c"].length; ++i) { var tf; try { tf = new TextFile(outputs["c"][i].filePath, TextFile.WriteOnly); tf.writeLine("int main" + i + "() { return 0; }"); } finally { if (tf) tf.close(); } } }; return [cmd]; } } destinationDirectory: project.buildDirectory } } qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/innosetupDependencies/main.c0000644000175100017510000000003115154533055027317 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/innosetup/0000755000175100017510000000000015154533055023726 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-windows/innosetup/test.iss0000644000175100017510000000016415154533055025426 0ustar runnerrunner#include "qbsinc.iss" [Setup] AppName={#MyProgram} AppVersion={#MyProgramVersion} DefaultDirName={pf}\{#MyProgram} qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/innosetup/inc/0000755000175100017510000000000015154533055024477 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-windows/innosetup/inc/qbsinc.iss0000644000175100017510000000000015154533055026464 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-windows/innosetup/innosetup.qbs0000644000175100017510000000130515154533055026460 0ustar runnerrunnerimport qbs.FileInfo Project { InnoSetup { property bool _test: { var present = qbs.targetOS.includes("windows") && innosetup.present; console.info("has innosetup: " + present); } name: "QbsSetup" targetName: "qbs.setup.test" version: "1.5" files: [ "test.iss" ] innosetup.verboseOutput: true innosetup.includePaths: ["inc"] innosetup.defines: ["MyProgram=" + name, "MyProgramVersion=" + version] innosetup.compilerFlags: ["/V9"] } InnoSetup { name: "Example1" files: [FileInfo.joinPaths(innosetup.toolchainInstallPath, "Examples", name + ".iss")] } } qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/codesign/0000755000175100017510000000000015154533055023475 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-windows/codesign/codesign.qbs0000644000175100017510000000256015154533055026002 0ustar runnerrunnerProject { name: "p" property bool enableSigning: true property string hashAlgorithm property string subjectName property string signingTimestamp CppApplication { name: "A" files: "app.cpp" condition: qbs.toolchain.includes("msvc") codesign.enableCodeSigning: project.enableSigning codesign.hashAlgorithm: project.hashAlgorithm codesign.subjectName: project.subjectName codesign.signingTimestamp: project.signingTimestamp codesign.timestampAlgorithm: "sha256" install: true installDir: "" property bool dummy: { if (codesign.codesignPath) console.info("signtool path: %%" + codesign.codesignPath + "%%"); } } DynamicLibrary { Depends { name: "cpp" } name: "B" files: "app.cpp" condition: qbs.toolchain.includes("msvc") codesign.enableCodeSigning: project.enableSigning codesign.hashAlgorithm: project.hashAlgorithm codesign.subjectName: project.subjectName codesign.signingTimestamp: project.signingTimestamp codesign.timestampAlgorithm: "sha256" install: true installDir: "" property bool dummy: { if (codesign.codesignPath) console.info("signtool path: %%" + codesign.codesignPath + "%%"); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/codesign/app.cpp0000644000175100017510000000003115154533055024753 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/wixDependencies/0000755000175100017510000000000015154533055025020 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-windows/wixDependencies/QbsSetup.wxs0000644000175100017510000000276415154533055027342 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/wixDependencies/wixDependencies.qbs0000644000175100017510000000423415154533055030650 0ustar runnerrunnerimport qbs.TextFile Project { WindowsInstallerPackage { Depends { name: "app" } Depends { name: "lib" } name: "QbsSetup" targetName: "qbs" files: ["QbsSetup.wxs"] wix.extensions: ["WixBalExtension", "WixUIExtension"] destinationDirectory: project.buildDirectory } Application { Depends { name: "cpp" } name: "app" files: ["main.c"] Group { fileTagsFilter: product.type qbs.install: true } destinationDirectory: project.buildDirectory } DynamicLibrary { Depends { name: "cpp" } name: "lib" files: ["main.c"] Group { fileTagsFilter: product.type qbs.install: true } Rule { // This rule tries to provoke the installer into building too early (and the test // verifies that it does not) by causing the build of the installables to take // a lot longer. multiplex: true outputFileTags: ["c"] outputArtifacts: { var artifacts = []; for (var i = 0; i < 96; ++i) artifacts.push({ filePath: "c" + i + ".c", fileTags: ["c"] }); return artifacts; } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { for (var j = 0; j < 1000; ++j) { // Artificial delay. for (var i = 0; i < outputs["c"].length; ++i) { var tf; try { tf = new TextFile(outputs["c"][i].filePath, TextFile.WriteOnly); tf.writeLine("int main" + i + "() { return 0; }"); } finally { if (tf) tf.close(); } } } }; return [cmd]; } } destinationDirectory: project.buildDirectory } } qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/wixDependencies/main.c0000644000175100017510000000003115154533055026102 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/wix/0000755000175100017510000000000015154533055022511 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-windows/wix/de.wxl0000644000175100017510000000011615154533055023633 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/wix/Qt.wxs0000644000175100017510000000020415154533055023634 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/wix/QbsBootstrapper.wxs0000644000175100017510000000065115154533055026410 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/wix/QbsSetup.wxs0000644000175100017510000000254415154533055025027 0ustar runnerrunner qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/wix/ExampleScript.bat0000644000175100017510000000002215154533055025753 0ustar runnerrunnerecho Hello world! qbs-src-3.2.0/tests/auto/blackbox/testdata-windows/wix/WiXInstallers.qbs0000644000175100017510000000236115154533055025772 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host Project { WindowsInstallerPackage { name: "QbsSetup" targetName: "qbs" files: ["QbsSetup.wxs", "ExampleScript.bat"] wix.defines: ["scriptName=ExampleScript.bat"] wix.extensions: ["WixBalExtension", "WixUIExtension"] qbs.targetPlatform: "windows" Export { Depends { name: "wix" } wix.defines: base.concat(["msiName=" + FileInfo.joinPaths(exportingProduct.buildDirectory, exportingProduct.targetName + wix.windowsInstallerSuffix)]) } } WindowsSetupPackage { Depends { name: "QbsSetup" } condition: Host.os().includes("windows") // currently does not work in Wine with WiX 3.9 name: "QbsBootstrapper" targetName: "qbs-setup-" + qbs.architecture files: ["QbsBootstrapper.wxs"] qbs.architecture: original || "x86" qbs.targetPlatform: "windows" } WindowsInstallerPackage { name: "RegressionBuster9000" files: ["QbsSetup.wxs", "Qt.wxs", "de.wxl"] wix.defines: ["scriptName=ExampleScript.bat"] wix.cultures: [] qbs.architecture: original || "x86" qbs.targetPlatform: "windows" } } qbs-src-3.2.0/tests/auto/blackbox/blackbox-clangdb.qbs0000644000175100017510000000077015154533055022271 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "blackbox-clangdb" Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { name: "testdata" prefix: "testdata-clangdb/" files: ["**/*"] fileTags: [] } files: [ "../shared.h", "tst_blackboxbase.cpp", "tst_blackboxbase.h", "tst_clangdb.cpp", "tst_clangdb.h", ] cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)]) } qbs-src-3.2.0/tests/auto/blackbox/tst_blackbox.cpp0000644000175100017510000154650315154533055021602 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** 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 "tst_blackbox.h" #include "../shared.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define WAIT_FOR_NEW_TIMESTAMP() waitForNewTimestamp(testDataDir) using qbs::Internal::HostOsInfo; class MacosTarHealer { public: MacosTarHealer() { if (HostOsInfo::hostOs() == HostOsInfo::HostOsMacos) { // work around absurd tar behavior on macOS qputenv("COPY_EXTENDED_ATTRIBUTES_DISABLE", "true"); qputenv("COPYFILE_DISABLE", "true"); } } ~MacosTarHealer() { if (HostOsInfo::hostOs() == HostOsInfo::HostOsMacos) { qunsetenv("COPY_EXTENDED_ATTRIBUTES_DISABLE"); qunsetenv("COPYFILE_DISABLE"); } } }; QMap TestBlackbox::findCli(int *status) { QTemporaryDir temp; QDir::setCurrent(testDataDir + "/find"); QbsRunParameters params = QStringList() << "-f" << "find-cli.qbs"; params.buildDirectory = temp.path(); const int res = runQbs(params); if (status) *status = res; QFile file(temp.path() + "/" + relativeProductBuildDir("find-cli") + "/cli.json"); if (!file.open(QIODevice::ReadOnly)) return {}; const auto tools = QJsonDocument::fromJson(file.readAll()).toVariant().toMap(); return {{"path", QDir::fromNativeSeparators(tools["path"].toString())}}; } QMap TestBlackbox::findNodejs(int *status) { QTemporaryDir temp; QDir::setCurrent(testDataDir + "/find"); QbsRunParameters params = QStringList() << "-f" << "find-nodejs.qbs"; params.buildDirectory = temp.path(); const int res = runQbs(params); if (status) *status = res; QFile file(temp.path() + "/" + relativeProductBuildDir("find-nodejs") + "/nodejs.json"); if (!file.open(QIODevice::ReadOnly)) return {}; const auto tools = QJsonDocument::fromJson(file.readAll()).toVariant().toMap(); return {{"node", QDir::fromNativeSeparators(tools["node"].toString())}}; } QMap TestBlackbox::findTypeScript(int *status) { QTemporaryDir temp; QDir::setCurrent(testDataDir + "/find"); QbsRunParameters params = QStringList() << "-f" << "find-typescript.qbs"; params.buildDirectory = temp.path(); const int res = runQbs(params); if (status) *status = res; QFile file(temp.path() + "/" + relativeProductBuildDir("find-typescript") + "/typescript.json"); if (!file.open(QIODevice::ReadOnly)) return {}; const auto tools = QJsonDocument::fromJson(file.readAll()).toVariant().toMap(); return {{"tsc", QDir::fromNativeSeparators(tools["tsc"].toString())}}; } QString TestBlackbox::findArchiver(const QString &fileName, int *status) { if (fileName == "jar") return findJdkTools(status).value(fileName); QString binary = findExecutable(QStringList(fileName)); if (binary.isEmpty()) { const SettingsPtr s = settings(); qbs::Profile p(profileName(), s.get()); binary = findExecutable(p.value("archiver.command").toStringList()); } return binary; } bool TestBlackbox::prepareAndRunConan() { QString executable = findExecutable({"conan"}); if (executable.isEmpty()) { qInfo() << "conan is not installed or not available in PATH."; return false; } const auto conanVersion = this->conanVersion(executable); if (!conanVersion.isValid()) { qInfo() << "Can't get conan version."; return false; } if (compare(conanVersion, qbs::Version(2, 6)) < 0) { qInfo() << "This test apples only to conan 2.6 and newer."; return false; } const auto profilePath = QDir::homePath() + "/.conan2/profiles/qbs-test-libs"; if (!QFileInfo(profilePath).exists()) { qInfo() << "conan profile is not installed, run './scripts/setup-conan-profiles.sh'"; return false; } QProcess conan; QDir::setCurrent(testDataDir + "/conan-provider/testlibdep"); rmDirR("build"); QStringList arguments{"install", ".", "--profile:all=qbs-test-libs", "--output-folder=build"}; conan.start(executable, arguments); return waitForProcessSuccess(conan, 60000); } bool TestBlackbox::lexYaccExist() { return !findExecutable(QStringList("lex")).isEmpty() && !findExecutable(QStringList("yacc")).isEmpty(); } qbs::Version TestBlackbox::bisonVersion() { const auto yaccBinary = findExecutable(QStringList("yacc")); QProcess process; process.start(yaccBinary, QStringList() << "--version"); if (!process.waitForStarted()) return qbs::Version(); if (!process.waitForFinished()) return qbs::Version(); const auto processStdOut = process.readAllStandardOutput(); if (processStdOut.isEmpty()) return qbs::Version(); const auto line = processStdOut.split('\n')[0]; const auto words = line.split(' '); if (words.empty()) return qbs::Version(); return qbs::Version::fromString(words.last()); } QMap TestBlackbox::getRepoStateFromApp() const { QMap result; const int startIndex = m_qbsStdout.indexOf("=="); if (startIndex == -1) return result; const int endIndex = m_qbsStdout.indexOf("==", startIndex + 2); if (endIndex == -1) return result; const QByteArray data = m_qbsStdout.mid(startIndex + 2, endIndex - startIndex - 2); const QList entries = data.split(';'); for (const QByteArray &entry : entries) { const int eqPos = entry.indexOf('='); if (eqPos != -1) result.insert(QString::fromLatin1(entry.left(eqPos)), entry.mid(eqPos + 1)); } return result; } void TestBlackbox::sevenZip() { QDir::setCurrent(testDataDir + "/archiver"); QString binary = findArchiver("7z"); if (binary.isEmpty()) QSKIP("7zip not found"); QCOMPARE(runQbs(QbsRunParameters(QStringList() << "modules.archiver.type:7zip")), 0); const QString outputFile = relativeProductBuildDir("archivable") + "/archivable.7z"; QVERIFY2(regularFileExists(outputFile), qPrintable(outputFile)); QProcess listContents; listContents.start(binary, QStringList() << "l" << outputFile); QVERIFY2(listContents.waitForStarted(), qPrintable(listContents.errorString())); QVERIFY2(listContents.waitForFinished(), qPrintable(listContents.errorString())); QVERIFY2(listContents.exitCode() == 0, listContents.readAllStandardError().constData()); const QByteArray output = listContents.readAllStandardOutput(); QVERIFY2(output.contains("2 files"), output.constData()); QVERIFY2(output.contains("test.txt"), output.constData()); QVERIFY2(output.contains("archivable.qbs"), output.constData()); } void TestBlackbox::sourceArtifactInInputsFromDependencies() { QDir::setCurrent(testDataDir + "/source-artifact-in-inputs-from-dependencies"); QCOMPARE(runQbs(), 0); QFile outFile(relativeProductBuildDir("p") + "/output.txt"); QVERIFY2(outFile.exists(), qPrintable(outFile.fileName())); QVERIFY2(outFile.open(QIODevice::ReadOnly), qPrintable(outFile.errorString())); const QByteArrayList output = outFile.readAll().trimmed().split('\n'); QCOMPARE(output.size(), 2); bool header1Found = false; bool header2Found = false; for (const QByteArray &line : output) { const QByteArray &path = line.trimmed(); if (path == "include1/header.h") header1Found = true; else if (path == "include2/header.h") header2Found = true; } QVERIFY(header1Found); QVERIFY(header2Found); } void TestBlackbox::staticLibWithoutSources() { QDir::setCurrent(testDataDir + "/static-lib-without-sources"); QCOMPARE(runQbs(), 0); } void TestBlackbox::suspiciousCalls() { const QString projectDir = testDataDir + "/suspicious-calls"; QDir::setCurrent(projectDir); rmDirR(relativeBuildDir()); QFETCH(QString, projectFile); QbsRunParameters params(QStringList() << "-f" << projectFile); QCOMPARE(runQbs(params), 0); QFETCH(QByteArray, expectedWarning); QVERIFY2(m_qbsStderr.contains(expectedWarning), m_qbsStderr.constData()); } void TestBlackbox::suspiciousCalls_data() { QTest::addColumn("projectFile"); QTest::addColumn("expectedWarning"); QTest::newRow("File.copy() in Probe") << "copy-probe.qbs" << QByteArray(); QTest::newRow("File.copy() during evaluation") << "copy-eval.qbs" << QByteArray("File.copy()"); QTest::newRow("File.copy() in prepare script") << "copy-prepare.qbs" << QByteArray("File.copy()"); QTest::newRow("File.copy() in command") << "copy-command.qbs" << QByteArray(); QTest::newRow("File.directoryEntries() in Probe") << "direntries-probe.qbs" << QByteArray(); QTest::newRow("File.directoryEntries() during evaluation") << "direntries-eval.qbs" << QByteArray("File.directoryEntries()"); QTest::newRow("File.directoryEntries() in prepare script") << "direntries-prepare.qbs" << QByteArray(); QTest::newRow("File.directoryEntries() in command") << "direntries-command.qbs" << QByteArray(); } void TestBlackbox::systemIncludePaths() { const QString projectDir = testDataDir + "/system-include-paths"; QDir::setCurrent(projectDir); QCOMPARE(runQbs(), 0); } void TestBlackbox::distributionIncludePaths() { const QString projectDir = testDataDir + "/distribution-include-paths"; QDir::setCurrent(projectDir); QCOMPARE(runQbs(), 0); } void TestBlackbox::tar() { if (HostOsInfo::hostOs() == HostOsInfo::HostOsWindows) QSKIP("Beware of the msys tar"); MacosTarHealer tarHealer; QDir::setCurrent(testDataDir + "/archiver"); rmDirR(relativeBuildDir()); QString binary = findArchiver("tar"); if (binary.isEmpty()) QSKIP("tar not found"); QCOMPARE(runQbs(QbsRunParameters(QStringList() << "modules.archiver.type:tar")), 0); const QString outputFile = relativeProductBuildDir("archivable") + "/archivable.tar.gz"; QVERIFY2(regularFileExists(outputFile), qPrintable(outputFile)); QProcess listContents; listContents.start(binary, QStringList() << "tf" << outputFile); QVERIFY2(listContents.waitForStarted(), qPrintable(listContents.errorString())); QVERIFY2(listContents.waitForFinished(), qPrintable(listContents.errorString())); QVERIFY2(listContents.exitCode() == 0, listContents.readAllStandardError().constData()); QFile listFile("list.txt"); QVERIFY2(listFile.open(QIODevice::ReadOnly), qPrintable(listFile.errorString())); QCOMPARE(listContents.readAllStandardOutput(), listFile.readAll()); } void TestBlackbox::textTemplate() { QVERIFY(QDir::setCurrent(testDataDir + "/texttemplate")); rmDirR(relativeBuildDir()); QCOMPARE(runQbs(), 0); QString outputFilePath = relativeProductBuildDir("one") + "/output.txt"; QString expectedOutputFilePath = QFINDTESTDATA("expected/output.txt"); TEXT_FILE_COMPARE(outputFilePath, expectedOutputFilePath); outputFilePath = relativeProductBuildDir("one") + "/lalala.txt"; expectedOutputFilePath = QFINDTESTDATA("expected/lalala.txt"); TEXT_FILE_COMPARE(outputFilePath, expectedOutputFilePath); // Test @var@ syntax outputFilePath = relativeProductBuildDir("one") + "/output_at.txt"; expectedOutputFilePath = QFINDTESTDATA("expected/output_at.txt"); TEXT_FILE_COMPARE(outputFilePath, expectedOutputFilePath); } static QStringList sortedFileList(const QByteArray &ba) { auto list = QString::fromUtf8(ba).split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts); std::sort(list.begin(), list.end()); return list; } void TestBlackbox::zip() { QFETCH(QString, binaryName); int status = 0; const QString binary = findArchiver(binaryName, &status); QCOMPARE(status, 0); if (binary.isEmpty()) QSKIP("zip tool not found"); QDir::setCurrent(testDataDir + "/archiver"); rmDirR(relativeBuildDir()); QbsRunParameters params(QStringList() << "modules.archiver.type:zip" << "modules.archiver.command:" + binary); QCOMPARE(runQbs(params), 0); const QString outputFile = relativeProductBuildDir("archivable") + "/archivable.zip"; QVERIFY2(regularFileExists(outputFile), qPrintable(outputFile)); QProcess listContents; if (binaryName == "zip") { // zipinfo is part of Info-Zip listContents.start("zipinfo", QStringList() << "-1" << outputFile); } else { listContents.start(binary, QStringList() << "tf" << outputFile); } QVERIFY2(listContents.waitForStarted(), qPrintable(listContents.errorString())); QVERIFY2(listContents.waitForFinished(), qPrintable(listContents.errorString())); QVERIFY2(listContents.exitCode() == 0, listContents.readAllStandardError().constData()); QFile listFile("list.txt"); QVERIFY2(listFile.open(QIODevice::ReadOnly), qPrintable(listFile.errorString())); QCOMPARE(sortedFileList(listContents.readAllStandardOutput()), sortedFileList(listFile.readAll())); // Make sure the module is still loaded when the java/jar fallback is not available params.command = "resolve"; params.arguments << "modules.java.jdkPath:/blubb"; QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); } void TestBlackbox::zip_data() { QTest::addColumn("binaryName"); QTest::newRow("zip") << "zip"; QTest::newRow("jar") << "jar"; } void TestBlackbox::zipInvalid() { QDir::setCurrent(testDataDir + "/archiver"); rmDirR(relativeBuildDir()); QbsRunParameters params(QStringList() << "modules.archiver.type:zip" << "modules.archiver.command:/bin/something"); params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("unrecognized archive tool: 'something'"), m_qbsStderr.constData()); } TestBlackbox::TestBlackbox() : TestBlackboxBase (SRCDIR "/testdata", "blackbox") { } void TestBlackbox::allowedValues() { QFETCH(QString, property); QFETCH(QString, value); QFETCH(QString, invalidValue); QDir::setCurrent(testDataDir + "/allowed-values"); rmDirR(relativeBuildDir()); QbsRunParameters params; if (!property.isEmpty() && !value.isEmpty()) { params.arguments << QStringLiteral("%1:%2").arg(property, value); } params.expectFailure = !invalidValue.isEmpty(); QCOMPARE(runQbs(params) == 0, !params.expectFailure); if (params.expectFailure) { const auto errorString = QStringLiteral("Value '%1' is not allowed for property").arg(invalidValue); QVERIFY2(m_qbsStderr.contains(errorString.toUtf8()), m_qbsStderr.constData()); } } void TestBlackbox::allowedValues_data() { QTest::addColumn("property"); QTest::addColumn("value"); QTest::addColumn("invalidValue"); QTest::newRow("default") << QString() << QString() << QString(); QTest::newRow("allowed (product, CLI)") << "products.p.prop" << "foo" << QString(); QTest::newRow("not allowed (product, CLI)") << "products.p.prop" << "bar" << "bar"; QTest::newRow("allowed (product, JS)") << "products.p.prop2" << "foo" << QString(); QTest::newRow("not allowed (product, JS)") << "products.p.prop2" << "bar" << "bar"; QTest::newRow("allowed single (module, CLI)") << "modules.a.prop" << "foo" << QString(); QTest::newRow("not allowed single (module, CLI)") << "modules.a.prop" << "baz" << "baz"; QTest::newRow("allowed mult (module, CLI)") << "modules.a.prop" << "foo,bar" << QString(); QTest::newRow("not allowed mult (module, CLI)") << "modules.a.prop" << "foo,baz" << "baz"; QTest::newRow("allowed single (module, JS)") << "modules.a.prop2" << "foo" << QString(); QTest::newRow("not allowed single (module, JS)") << "modules.a.prop2" << "baz" << "baz"; QTest::newRow("allowed mult (module, JS)") << "modules.a.prop2" << "foo,bar" << QString(); QTest::newRow("not allowed mult (module, JS)") << "modules.a.prop2" << "foo,baz" << "baz"; // undefined should always be allowed QTest::newRow("undefined (product)") << "products.p.prop" << "undefined" << QString(); QTest::newRow("undefined (module)") << "modules.a.prop" << "undefined" << QString(); } void TestBlackbox::addFileTagToGeneratedArtifact() { QDir::setCurrent(testDataDir + "/add-filetag-to-generated-artifact"); QCOMPARE(runQbs(QStringList("project.enableTagging:true")), 0); QVERIFY2(m_qbsStdout.contains("compressing my_app"), m_qbsStdout.constData()); const QString compressedAppFilePath = relativeProductBuildDir("my_compressed_app") + '/' + appendExecSuffix("compressed-my_app", m_qbsStdout); QVERIFY2(regularFileExists(compressedAppFilePath), qPrintable(compressedAppFilePath)); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("project.enableTagging:false"))), 0); QCOMPARE(runQbs(), 0); QVERIFY(!regularFileExists(compressedAppFilePath)); } void TestBlackbox::alwaysRun() { QFETCH(QString, projectFile); QDir::setCurrent(testDataDir + "/always-run"); rmDirR(relativeBuildDir()); QbsRunParameters params("build", QStringList() << "-f" << projectFile); if (projectFile.contains("transformer")) { params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("removed"), m_qbsStderr.constData()); return; } QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("yo")); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("yo")); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "alwaysRun: false", "alwaysRun: true"); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("yo")); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("yo")); } void TestBlackbox::alwaysRun_data() { QTest::addColumn("projectFile"); QTest::newRow("Transformer") << "transformer.qbs"; QTest::newRow("Rule") << "rule.qbs"; } void TestBlackbox::archiverFlags() { QDir::setCurrent(testDataDir + "/archiver-flags"); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); if (!m_qbsStdout.contains("toolchain is MSVC")) QSKIP("Test applies to MSVC toolchain only"); QCOMPARE(runQbs(QStringList({"-n", "--command-echo-mode", "command-line"})), 0); const QByteArrayList output = m_qbsStdout.split('\n'); QByteArray archiveLine; for (const QByteArray &line : output) { if (line.contains("lib.exe") && line.contains(".lib")) { archiveLine = line; break; } } QVERIFY(!archiveLine.isEmpty()); QVERIFY2(archiveLine.contains("/WX"), archiveLine.constData()); } void TestBlackbox::artifactsMapChangeTracking() { QDir::setCurrent(testDataDir + "/artifacts-map-change-tracking"); QCOMPARE(runQbs(QStringList{"-p", "TheApp"}), 0); QVERIFY2(m_qbsStdout.contains("running rule for test.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("creating test.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("linking"), m_qbsStdout.constData()); QCOMPARE(runQbs(QStringList{"-p", "meta,p"}), 0); QVERIFY2(m_qbsStdout.contains("printing artifacts"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("test.txt"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("main.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("test.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("TheBinary"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("dummy1"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("dummy2"), m_qbsStdout.constData()); // Change name of target binary. Command must be re-run, because the file name of an // artifact changed. WAIT_FOR_NEW_TIMESTAMP(); const QString projectFile("artifacts-map-change-tracking.qbs"); REPLACE_IN_FILE(projectFile, "TheBinary", "TheNewBinary"); QCOMPARE(runQbs(QStringList{"-p", "TheApp"}), 0); QVERIFY2(!m_qbsStdout.contains("running rule for test.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating test.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("linking"), m_qbsStdout.constData()); QCOMPARE(runQbs(QStringList{"-p", "meta,p"}), 0); QVERIFY2(m_qbsStdout.contains("printing artifacts"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("test.txt"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("main.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("test.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("TheNewBinary"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("TheBinary"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("dummy1"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("dummy2"), m_qbsStdout.constData()); // Add file tag to generated artifact. Command must be re-run, because it enumerates the keys // of the artifacts map. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "fileTags: 'cpp'", "fileTags: ['cpp', 'blubb']"); QCOMPARE(runQbs(QStringList{"-p", "TheApp"}), 0); QVERIFY2(m_qbsStdout.contains("running rule for test.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating test.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("linking"), m_qbsStdout.constData()); QCOMPARE(runQbs(QStringList{"-p", "meta,p"}), 0); QVERIFY2(m_qbsStdout.contains("printing artifacts"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("test.txt"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("main.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("test.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("TheNewBinary"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("dummy1"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("dummy2"), m_qbsStdout.constData()); // Add redundant file tag to generated artifact. Command must not be re-run, because // the artifacts map has not changed. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "fileTags: ['cpp', 'blubb']", "fileTags: ['cpp', 'blubb', 'blubb']"); QCOMPARE(runQbs(QStringList{"-p", "TheApp"}), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running rule for test.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating test.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("linking"), m_qbsStdout.constData()); QCOMPARE(runQbs(QStringList{"-p", "meta,p"}), 0); QVERIFY2(!m_qbsStdout.contains("printing artifacts"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("dummy1"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("dummy2"), m_qbsStdout.constData()); // Rebuild the app. Command must not be re-run, because the artifacts map has not changed. WAIT_FOR_NEW_TIMESTAMP(); touch("main.cpp"); QCOMPARE(runQbs(QStringList{"-p", "TheApp"}), 0); QVERIFY2(!m_qbsStdout.contains("running rule for test.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating test.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("linking"), m_qbsStdout.constData()); QCOMPARE(runQbs(QStringList{"-p", "meta,p"}), 0); QVERIFY2(!m_qbsStdout.contains("printing artifacts"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("dummy1"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("dummy2"), m_qbsStdout.constData()); // Add source file to app. Command must be re-run, because the artifacts map has changed. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "/* 'test.txt' */", "'test.txt'"); QCOMPARE(runQbs(QStringList{"-p", "TheApp"}), 0); QEXPECT_FAIL("", "change tracking could become even more fine-grained", Continue); QVERIFY2(!m_qbsStdout.contains("running rule for test.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating test.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("linking"), m_qbsStdout.constData()); QCOMPARE(runQbs(QStringList{"-p", "meta,p"}), 0); QVERIFY2(m_qbsStdout.contains("printing artifacts"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("test.txt"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("main.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("test.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("TheNewBinary"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("dummy1"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("dummy2"), m_qbsStdout.constData()); } void TestBlackbox::artifactsMapInvalidation() { const QString projectDir = testDataDir + "/artifacts-map-invalidation"; QDir::setCurrent(projectDir); QCOMPARE(runQbs(), 0); TEXT_FILE_COMPARE(relativeProductBuildDir("p") + "/myfile.out", "file.in"); } void TestBlackbox::artifactsMapRaceCondition() { QDir::setCurrent(testDataDir + "/artifacts-map-race-condition"); QCOMPARE(runQbs(), 0); } void TestBlackbox::artifactScanning() { const QString projectDir = testDataDir + "/artifact-scanning"; QDir::setCurrent(projectDir); QbsRunParameters params(QStringList("-vv")); QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStderr.count("scanning \"p1.cpp\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"p2.cpp\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"p3.cpp\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"shared.h\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"external1.h\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"external2.h\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"external-indirect.h\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"iostream\""), 0); WAIT_FOR_NEW_TIMESTAMP(); touch("p1.cpp"); QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStderr.count("scanning \"p1.cpp\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"p2.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p3.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"shared.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external1.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external2.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external-indirect.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"iostream\""), 0); WAIT_FOR_NEW_TIMESTAMP(); touch("p2.cpp"); QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStderr.count("scanning \"p1.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p2.cpp\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"p3.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"shared.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external1.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external2.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external-indirect.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"iostream\""), 0); WAIT_FOR_NEW_TIMESTAMP(); touch("p3.cpp"); QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStderr.count("scanning \"p1.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p2.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p3.cpp\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"shared.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external1.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external2.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external-indirect.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"iostream\""), 0); WAIT_FOR_NEW_TIMESTAMP(); touch("shared.h"); QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStderr.count("scanning \"p1.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p2.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p3.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"shared.h\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"external1.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external2.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external-indirect.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"iostream\""), 0); WAIT_FOR_NEW_TIMESTAMP(); touch("external1.h"); QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStderr.count("scanning \"p1.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p2.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p3.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"shared.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external1.h\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"external2.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external-indirect.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"iostream\""), 0); WAIT_FOR_NEW_TIMESTAMP(); touch("subdir/external2.h"); QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStderr.count("scanning \"p1.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p2.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p3.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"shared.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external1.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external2.h\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"external-indirect.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"iostream\""), 0); WAIT_FOR_NEW_TIMESTAMP(); touch("external-indirect.h"); QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStderr.count("scanning \"p1.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p2.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p3.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"shared.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external1.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external2.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external-indirect.h\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"iostream\""), 0); WAIT_FOR_NEW_TIMESTAMP(); touch("p1.cpp"); params.command = "resolve"; params.arguments << "modules.cpp.treatSystemHeadersAsDependencies:true"; QCOMPARE(runQbs(params), 0); params.command = "build"; QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStderr.count("scanning \"p1.cpp\""), 1); QCOMPARE(m_qbsStderr.count("scanning \"p2.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"p3.cpp\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"shared.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external1.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external2.h\""), 0); QCOMPARE(m_qbsStderr.count("scanning \"external-indirect.h\""), 0); // on macOS, there are 2 iostream files, and <__cxx03/iostream> QVERIFY(m_qbsStderr.count("scanning \"iostream\"") >= 1); } void TestBlackbox::buildDirectories() { const QString projectDir = QDir::cleanPath(testDataDir + QLatin1String("/build-directories")); const QString projectBuildDir = projectDir + '/' + relativeBuildDir(); QDir::setCurrent(projectDir); QCOMPARE(runQbs(), 0); const QStringList outputLines = QString::fromLocal8Bit(m_qbsStdout.trimmed()).split('\n', Qt::SkipEmptyParts); QVERIFY2(outputLines.contains(projectDir + '/' + relativeProductBuildDir("p1")), m_qbsStdout.constData()); QVERIFY2(outputLines.contains(projectDir + '/' + relativeProductBuildDir("p2")), m_qbsStdout.constData()); QVERIFY2(outputLines.contains(projectBuildDir), m_qbsStdout.constData()); QVERIFY2(outputLines.contains(projectDir), m_qbsStdout.constData()); } void TestBlackbox::buildDirPlaceholders_data() { QTest::addColumn("buildDir"); QTest::addColumn("setProjectFile"); QTest::addColumn("successExpected"); QTest::newRow("normal dir, with project file") << "somedir" << true << true; QTest::newRow("normal dir, without project file") << "somedir" << false << true; QTest::newRow("@project, with project file") << "somedir/@project" << true << true; QTest::newRow("@project, without project file") << "somedir/@project" << false << false; QTest::newRow("@path, with project file") << "somedir/@path" << true << true; QTest::newRow("@path, without project file") << "somedir/@path" << false << false; } void TestBlackbox::buildDirPlaceholders() { QFETCH(QString, buildDir); QFETCH(bool, setProjectFile); QFETCH(bool, successExpected); const QString projectDir = testDataDir + "/build-dir-placeholders"; rmDirR(projectDir); QVERIFY(QDir().mkpath(projectDir)); QDir::setCurrent(projectDir); QFile projectFile("build-dir-placeholders.qbs"); QVERIFY(projectFile.open(QIODevice::WriteOnly)); projectFile.write("Product {\n}\n"); projectFile.flush(); rmDirR(relativeBuildDir()); QbsRunParameters params; params.buildDirectory = buildDir; if (setProjectFile) { params.arguments << "-f" << "build-dir-placeholders.qbs"; } params.expectFailure = !successExpected; QCOMPARE(runQbs(params) == 0, successExpected); } void TestBlackbox::buildEnvChange() { QDir::setCurrent(testDataDir + "/buildenv-change"); QbsRunParameters params; params.expectFailure = true; params.arguments << "-k"; QVERIFY(runQbs(params) != 0); const bool isMsvc = m_qbsStdout.contains("msvc"); QVERIFY2(m_qbsStdout.contains("compiling file.c"), m_qbsStdout.constData()); QString includePath = QDir::currentPath() + "/subdir"; params.environment.insert("CPLUS_INCLUDE_PATH", includePath); params.environment.insert("CL", "/I" + includePath); QVERIFY(runQbs(params) != 0); params.command = "resolve"; params.expectFailure = false; params.arguments.clear(); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QCOMPARE(m_qbsStdout.contains("compiling file.c"), isMsvc); includePath = QDir::currentPath() + "/subdir2"; params.environment.insert("CPLUS_INCLUDE_PATH", includePath); params.environment.insert("CL", "/I" + includePath); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QCOMPARE(m_qbsStdout.contains("compiling file.c"), isMsvc); params.environment = QProcessEnvironment::systemEnvironment(); QCOMPARE(runQbs(params), 0); params.command = "build"; params.expectFailure = true; QVERIFY(runQbs(params) != 0); } void TestBlackbox::buildGraphVersions() { QDir::setCurrent(testDataDir + "/build-graph-versions"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QFile bgFile(relativeBuildGraphFilePath()); QVERIFY2(bgFile.open(QIODevice::ReadWrite), qPrintable(bgFile.errorString())); bgFile.write("blubb"); bgFile.close(); // The first attempt at simple rebuilding as well as subsequent ones must fail. QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("Cannot use stored build graph"), m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.contains("Use the 'resolve' command"), m_qbsStderr.constData()); QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("Cannot use stored build graph"), m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.contains("Use the 'resolve' command"), m_qbsStderr.constData()); // On re-resolving, the error turns into a warning and a new build graph is created. QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); QVERIFY2(m_qbsStderr.contains("Cannot use stored build graph"), m_qbsStderr.constData()); QVERIFY2(!m_qbsStderr.contains("Use the 'resolve' command"), m_qbsStderr.constData()); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStderr.contains("Cannot use stored build graph"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); } void TestBlackbox::buildVariantDefaults_data() { QTest::addColumn("buildVariant"); QTest::newRow("default") << QString(); QTest::newRow("debug") << QStringLiteral("debug"); QTest::newRow("release") << QStringLiteral("release"); QTest::newRow("profiling") << QStringLiteral("profiling"); } void TestBlackbox::buildVariantDefaults() { QFETCH(QString, buildVariant); QDir::setCurrent(testDataDir + "/build-variant-defaults"); QbsRunParameters params{QStringLiteral("resolve")}; if (!buildVariant.isEmpty()) params.arguments << ("modules.qbs.buildVariant:" + buildVariant); QCOMPARE(runQbs(params), 0); } void TestBlackbox::capnproto() { QFETCH(QString, projectFile); QFETCH(QStringList, arguments); QDir::setCurrent(testDataDir + "/capnproto"); rmDirR(relativeBuildDir()); if (QTest::currentDataTag() == QLatin1String("cpp-conan") || QTest::currentDataTag() == QLatin1String("rpc-conan")) { if (!prepareAndRunConan()) QSKIP("conan is not prepared, check messages above"); } QbsRunParameters params{QStringLiteral("resolve"), {QStringLiteral("-f"), projectFile}}; params.arguments << arguments; QCOMPARE(runQbs(params), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); if (m_qbsStdout.contains("capnproto is not present")) QSKIP("capnproto is not present"); params.command = QStringLiteral("build"); QCOMPARE(runQbs(params), 0); } void TestBlackbox::capnproto_data() { QTest::addColumn("projectFile"); QTest::addColumn("arguments"); QStringList pkgConfigArgs({"project.qbsModuleProviders:qbspkgconfig"}); QTest::newRow("cpp-pkgconfig") << QStringLiteral("capnproto_cpp.qbs") << pkgConfigArgs; QTest::newRow("rpc-pkgconfig") << QStringLiteral("greeter_cpp.qbs") << pkgConfigArgs; QTest::newRow("relative import") << QStringLiteral("capnproto_relative_import.qbs") << pkgConfigArgs; QTest::newRow("absolute import") << QStringLiteral("capnproto_absolute_import.qbs") << pkgConfigArgs; QStringList conanArgs( {"project.qbsModuleProviders:conan", "moduleProviders.conan.installDirectory:build"}); QTest::newRow("cpp-conan") << QStringLiteral("capnproto_cpp.qbs") << conanArgs; QTest::newRow("rpc-conan") << QStringLiteral("greeter_cpp.qbs") << conanArgs; } void TestBlackbox::changedFiles_data() { QTest::addColumn("useChangedFilesForInitialBuild"); QTest::newRow("initial build with changed files") << true; QTest::newRow("initial build without changed files") << false; } void TestBlackbox::changedFiles() { QFETCH(bool, useChangedFilesForInitialBuild); QDir::setCurrent(testDataDir + "/changed-files"); rmDirR(relativeBuildDir()); const QString changedFile = QDir::cleanPath(QDir::currentPath() + "/file1.cpp"); QbsRunParameters params1; if (useChangedFilesForInitialBuild) params1 = QbsRunParameters(QStringList("--changed-files") << changedFile); // Initial run: Build all files, even though only one of them was marked as changed // (if --changed-files was used). QCOMPARE(runQbs(params1), 0); QCOMPARE(m_qbsStdout.count("compiling"), 3); QCOMPARE(m_qbsStdout.count("creating"), 3); WAIT_FOR_NEW_TIMESTAMP(); touch(QDir::currentPath() + "/main.cpp"); // Now only the file marked as changed must be compiled, even though it hasn't really // changed and another one has. QbsRunParameters params2(QStringList("--changed-files") << changedFile); QCOMPARE(runQbs(params2), 0); QCOMPARE(m_qbsStdout.count("compiling"), 1); QCOMPARE(m_qbsStdout.count("creating"), 1); QVERIFY2(m_qbsStdout.contains("file1.cpp"), m_qbsStdout.constData()); } void TestBlackbox::changedInputsFromDependencies() { QDir::setCurrent(testDataDir + "/changed-inputs-from-dependencies"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("final prepare script"), m_qbsStdout.constData()); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("final prepare script"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("input.txt"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("final prepare script"), m_qbsStdout.constData()); } void TestBlackbox::changedRuleInputs() { QDir::setCurrent(testDataDir + "/changed-rule-inputs"); // Initial build. QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("generating p1-dummy"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("generating p2-dummy"), m_qbsStdout.constData()); // Re-build: p1 is always regenerated, and p2 has a dependency on it. QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("generating p1-dummy"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("generating p2-dummy"), m_qbsStdout.constData()); // Remove the dependency. p2 gets re-generated one last time, because its set of // inputs changed. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("changed-rule-inputs.qbs", "inputsFromDependencies: \"p1\"", "inputsFromDependencies: \"p3\""); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("generating p1-dummy"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("generating p2-dummy"), m_qbsStdout.constData()); // Now the artifacts are no longer connected, and p2 must not get rebuilt anymore. QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("generating p1-dummy"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("generating p2-dummy"), m_qbsStdout.constData()); } void TestBlackbox::changeInDisabledProduct() { QDir::setCurrent(testDataDir + "/change-in-disabled-product"); QCOMPARE(runQbs(), 0); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("change-in-disabled-product.qbs", "// 'test2.txt'", "'test2.txt'"); QCOMPARE(runQbs(), 0); } void TestBlackbox::changeInImportedFile() { QDir::setCurrent(testDataDir + "/change-in-imported-file"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("old output"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("prepare.js", "old output", "new output"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("new output"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("prepare.js"); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("output"), m_qbsStdout.constData()); } void TestBlackbox::changeTrackingAndMultiplexing() { QDir::setCurrent(testDataDir + "/change-tracking-and-multiplexing"); QCOMPARE(runQbs(QStringList("modules.cpp.staticLibraryPrefix:prefix1")), 0); QCOMPARE(m_qbsStdout.count("compiling lib.cpp"), 2); QCOMPARE(m_qbsStdout.count("creating prefix1l"), 2); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("modules.cpp.staticLibraryPrefix:prefix2"))), 0); QCOMPARE(runQbs(), 0); QCOMPARE(m_qbsStdout.count("compiling lib.cpp"), 0); QCOMPARE(m_qbsStdout.count("creating prefix2l"), 2); } static QJsonObject findByName(const QJsonArray &objects, const QString &name) { for (const QJsonValue &v : objects) { if (!v.isObject()) continue; QJsonObject obj = v.toObject(); const QString objName = obj.value(QStringLiteral("name")).toString(); if (objName == name) return obj; } return {}; } static void readDepsOutput(const QString &depsFilePath, QJsonDocument &jsonDocument) { jsonDocument = QJsonDocument(); QFile depsFile(depsFilePath); QVERIFY2(depsFile.open(QFile::ReadOnly), qPrintable(depsFile.errorString())); QJsonParseError jsonerror; jsonDocument = QJsonDocument::fromJson(depsFile.readAll(), &jsonerror); if (jsonerror.error != QJsonParseError::NoError) { qDebug() << jsonerror.errorString(); QFAIL("JSON parsing failed."); } } void TestBlackbox::dependenciesProperty() { QDir::setCurrent(testDataDir + QLatin1String("/dependenciesProperty")); QCOMPARE(runQbs(), 0); const QString depsFile(relativeProductBuildDir("product1") + "/product1.deps"); QJsonDocument jsondoc; readDepsOutput(depsFile, jsondoc); QVERIFY(jsondoc.isArray()); QJsonArray dependencies = jsondoc.array(); QCOMPARE(dependencies.size(), 2); QJsonObject product2 = findByName(dependencies, QStringLiteral("product2")); QJsonArray product2_type = product2.value(QStringLiteral("type")).toArray(); QCOMPARE(product2_type.size(), 1); QCOMPARE(product2_type.first().toString(), QLatin1String("application")); QCOMPARE(product2.value(QLatin1String("narf")).toString(), QLatin1String("zort")); QJsonArray product2_cppArtifacts = product2.value("artifacts").toObject().value("cpp").toArray(); QCOMPARE(product2_cppArtifacts.size(), 1); QJsonArray product2_deps = product2.value(QStringLiteral("dependencies")).toArray(); QVERIFY(!product2_deps.empty()); QJsonObject product2_qbs = findByName(product2_deps, QStringLiteral("qbs")); QVERIFY(!product2_qbs.empty()); QJsonObject product2_cpp = findByName(product2_deps, QStringLiteral("cpp")); QJsonArray product2_cpp_defines = product2_cpp.value(QLatin1String("defines")).toArray(); QCOMPARE(product2_cpp_defines.size(), 1); QCOMPARE(product2_cpp_defines.first().toString(), QLatin1String("SMURF")); QJsonArray cpp_dependencies = product2_cpp.value("dependencies").toArray(); QVERIFY(!cpp_dependencies.isEmpty()); int qbsCount = 0; for (const auto dep : cpp_dependencies) { if (dep.toObject().value("name").toString() == "qbs") ++qbsCount; } QCOMPARE(qbsCount, 1); // Add new dependency, check that command is re-run. const QString projectFile("dependenciesProperty.qbs"); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "// Depends { name: 'newDependency' }", "Depends { name: 'newDependency' }"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("generating product1.deps"), m_qbsStdout.constData()); readDepsOutput(depsFile, jsondoc); dependencies = jsondoc.array(); QCOMPARE(dependencies.size(), 3); // Add new Depends item that does not actually introduce a new dependency, check // that command is not re-run. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "// Depends { name: 'product2' }", "Depends { name: 'product2' }"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("generating product1.deps"), m_qbsStdout.constData()); readDepsOutput(depsFile, jsondoc); dependencies = jsondoc.array(); QCOMPARE(dependencies.size(), 3); // Change property of dependency, check that command is re-run. QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList{"products.product2.narf:zortofsky"})), 0); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("compiling product2.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("generating product1.deps"), m_qbsStdout.constData()); readDepsOutput(depsFile, jsondoc); dependencies = jsondoc.array(); QCOMPARE(dependencies.size(), 3); product2 = findByName(dependencies, QStringLiteral("product2")); QCOMPARE(product2.value(QLatin1String("narf")).toString(), QLatin1String("zortofsky")); // Change module property of dependency, check that command is re-run. QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList{"products.product2.narf:zortofsky", "products.product2.cpp.defines:DIGEDAG"})), 0); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling product2.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("generating product1.deps"), m_qbsStdout.constData()); readDepsOutput(depsFile, jsondoc); dependencies = jsondoc.array(); QCOMPARE(dependencies.size(), 3); product2 = findByName(dependencies, QStringLiteral("product2")); product2_deps = product2.value(QStringLiteral("dependencies")).toArray(); product2_cpp = findByName(product2_deps, QStringLiteral("cpp")); product2_cpp_defines = product2_cpp.value(QStringLiteral("defines")).toArray(); QCOMPARE(product2_cpp_defines.size(), 1); QCOMPARE(product2_cpp_defines.first().toString(), QLatin1String("DIGEDAG")); } void TestBlackbox::dependencyScanningLoop() { QDir::setCurrent(testDataDir + "/dependency-scanning-loop"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); } void TestBlackbox::deprecatedProperty() { QFETCH(QString, version); QFETCH(QString, mode); QFETCH(bool, expiringWarning); QFETCH(bool, expiringError); QDir::setCurrent(testDataDir + "/deprecated-property"); QbsRunParameters params(QStringList("-q")); params.expectFailure = true; params.environment.insert("REMOVAL_VERSION", version); if (!mode.isEmpty()) params.arguments << "--deprecation-warnings" << mode; QVERIFY(runQbs(params) != 0); m_qbsStderr = QDir::fromNativeSeparators(QString::fromLocal8Bit(m_qbsStderr)).toLocal8Bit(); const bool hasExpiringWarning = m_qbsStderr.contains(QByteArray( "deprecated-property.qbs:4:29 The property 'expiringProp' is " "deprecated and will be removed in Qbs ") + version.toLocal8Bit()); QVERIFY2(expiringWarning == hasExpiringWarning, m_qbsStderr.constData()); const bool hasRemovedOutput = m_qbsStderr.contains( "deprecated-property.qbs:5:28 The property 'veryOldProp' can no " "longer be used. It was removed in Qbs 1.3.0."); QVERIFY2(hasRemovedOutput == !expiringError, m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.contains("Property 'forgottenProp' was scheduled for removal in version " "1.8.0, but is still present."), m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.contains("themodule/m.qbs:22:5 Removal version for 'forgottenProp' " "specified here."), m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.count("Use newProp instead.") == 1 + int(expiringWarning && !expiringError), m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.count("is deprecated") == int(expiringWarning), m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.count("was removed") == int(!expiringError), m_qbsStderr.constData()); } void TestBlackbox::deprecatedProperty_data() { QTest::addColumn("version"); QTest::addColumn("mode"); QTest::addColumn("expiringWarning"); QTest::addColumn("expiringError"); const auto current = QVersionNumber::fromString(QBS_VERSION); const QString next = QVersionNumber(current.majorVersion(), current.minorVersion() + 1) .toString(); const QString nextNext = QVersionNumber(current.majorVersion(), current.minorVersion() + 2) .toString(); const QString nextMajor = QVersionNumber(current.majorVersion() + 1).toString(); QTest::newRow("default/next") << next << QString() << true << false; QTest::newRow("default/nextnext") << nextNext << QString() << false << false; QTest::newRow("default/nextmajor") << nextMajor << QString() << true << false; QTest::newRow("error/next") << next << QString("error") << true << true; QTest::newRow("error/nextnext") << nextNext << QString("error") << true << true; QTest::newRow("error/nextmajor") << nextMajor << QString("error") << true << true; QTest::newRow("on/next") << next << QString("on") << true << false; QTest::newRow("on/nextnext") << nextNext << QString("on") << true << false; QTest::newRow("on/nextmajor") << nextMajor << QString("on") << true << false; QTest::newRow("before-removal/next") << next << QString("before-removal") << true << false; QTest::newRow("before-removal/nextnext") << nextNext << QString("before-removal") << false << false; QTest::newRow("before-removal/nextmajor") << nextMajor << QString("before-removal") << true << false; QTest::newRow("off/next") << next << QString("off") << false << false; QTest::newRow("off/nextnext") << nextNext << QString("off") << false << false; QTest::newRow("off/nextmajor") << nextMajor << QString("off") << false << false; } void TestBlackbox::disappearedProfile() { QDir::setCurrent(testDataDir + "/disappeared-profile"); QbsRunParameters resolveParams; // First, we need to fail, because we don't tell qbs where the module is. resolveParams.expectFailure = true; QVERIFY(runQbs(resolveParams) != 0); // Now we set up a profile with all the necessary information, and qbs succeeds. qbs::Settings settings(QDir::currentPath() + "/settings-dir"); qbs::Profile profile("p", &settings); profile.setValue("m.p1", "p1 from profile"); profile.setValue("m.p2", "p2 from profile"); profile.setValue("preferences.qbsSearchPaths", QStringList({QDir::currentPath() + "/modules-dir"})); settings.sync(); resolveParams.command = "resolve"; resolveParams.expectFailure = false; resolveParams.settingsDir = settings.baseDirectory(); resolveParams.profile = profile.name(); QCOMPARE(runQbs(resolveParams), 0); // Now we change a property in the profile, but because we don't use the "resolve" command, // the old profile contents stored in the build graph are used. profile.setValue("m.p2", "p2 new from profile"); settings.sync(); QbsRunParameters buildParams; buildParams.profile.clear(); QCOMPARE(runQbs(buildParams), 0); QVERIFY2(m_qbsStdout.contains("creating dummy1.txt with p1 from profile"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("creating dummy2.txt with p2 from profile"), m_qbsStdout.constData()); // Now we do use the "resolve" command, so the new property value is taken into account. QCOMPARE(runQbs(resolveParams), 0); QCOMPARE(runQbs(buildParams), 0); QVERIFY2(!m_qbsStdout.contains("creating dummy1.txt"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("creating dummy2.txt with p2 new from profile"), m_qbsStdout.constData()); // Now we change the profile again without a "resolve" command. However, this time we // force re-resolving indirectly by changing a project file. The updated property value // must still not be taken into account. profile.setValue("m.p1", "p1 new from profile"); settings.sync(); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("modules-dir/modules/m/m.qbs", "property string p1", "property string p1: 'p1 from module'"); QCOMPARE(runQbs(buildParams), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating dummy1.txt"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating dummy2.txt"), m_qbsStdout.constData()); // Now we run the "resolve" command without giving the necessary settings path to find // the profile. resolveParams.expectFailure = true; resolveParams.settingsDir.clear(); resolveParams.profile.clear(); QVERIFY(runQbs(resolveParams) != 0); QVERIFY2(m_qbsStderr.contains("profile"), m_qbsStderr.constData()); } void TestBlackbox::discardUnusedData() { QDir::setCurrent(testDataDir + "/discard-unused-data"); rmDirR(relativeBuildDir()); QFETCH(QString, discardString); QFETCH(bool, symbolPresent); QbsRunParameters params; if (!discardString.isEmpty()) params.arguments << ("modules.cpp.discardUnusedData:" + discardString); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("is Darwin"), m_qbsStdout.constData()); const bool isDarwin = m_qbsStdout.contains("is Darwin: true"); const QString output = QString::fromLocal8Bit(m_qbsStdout); const QRegularExpression pattern(QRegularExpression::anchoredPattern(".*---(.*)---.*"), QRegularExpression::DotMatchesEverythingOption); const QRegularExpressionMatch match = pattern.match(output); QVERIFY2(match.hasMatch(), qPrintable(output)); QCOMPARE(match.lastCapturedIndex(), 1); const QString nmPath = match.captured(1); if (!QFile::exists(nmPath)) QSKIP("Cannot check for symbol presence: No nm found."); QProcess nm; nm.start( nmPath, QStringList(QDir::currentPath() + '/' + relativeExecutableFilePath("app", m_qbsStdout))); QVERIFY(nm.waitForStarted()); QVERIFY(nm.waitForFinished()); const QByteArray nmOutput = nm.readAllStandardOutput(); QVERIFY2(nm.exitCode() == 0, nm.readAllStandardError().constData()); if (!symbolPresent && !isDarwin) QSKIP("Unused symbol detection only supported on Darwin"); QVERIFY2(nmOutput.contains("unusedFunc") == symbolPresent, nmOutput.constData()); } void TestBlackbox::discardUnusedData_data() { QTest::addColumn("discardString"); QTest::addColumn("symbolPresent"); QTest::newRow("discard") << QString("true") << false; QTest::newRow("don't discard") << QString("false") << true; QTest::newRow("default") << QString() << true; } void TestBlackbox::dotDotPcFile() { QDir::setCurrent(testDataDir + "/dot-dot-pc-file"); QCOMPARE(runQbs(), 0); } void TestBlackbox::driverLinkerFlags() { QDir::setCurrent(testDataDir + QLatin1String("/driver-linker-flags")); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0); if (!m_qbsStdout.contains("toolchain is GCC-like")) QSKIP("Test applies on GCC-like toolchains only"); QFETCH(QString, linkerMode); QFETCH(bool, expectDriverOption); const QString linkerModeArg = "modules.cpp.linkerMode:" + linkerMode; QCOMPARE(runQbs(QStringList({"-n", "--command-echo-mode", "command-line", linkerModeArg})), 0); const QByteArray driverArg = "-nostartfiles"; const QByteArrayList output = m_qbsStdout.split('\n'); QByteArray compileLine; QByteArray linkLine; for (const QByteArray &line : output) { if (line.contains(" -c ")) compileLine = line; else if (line.contains("main.cpp.o")) linkLine = line; } QVERIFY(!compileLine.isEmpty()); QVERIFY(!linkLine.isEmpty()); QVERIFY2(!compileLine.contains(driverArg), compileLine.constData()); QVERIFY2(linkLine.contains(driverArg) == expectDriverOption, linkLine.constData()); } void TestBlackbox::driverLinkerFlags_data() { QTest::addColumn("linkerMode"); QTest::addColumn("expectDriverOption"); QTest::newRow("link using compiler driver") << "automatic" << true; QTest::newRow("link using linker") << "manual" << false; } void TestBlackbox::dynamicLibraryInModule() { QDir::setCurrent(testDataDir + "/dynamic-library-in-module"); const QString installRootSpec = QString("qbs.installRoot:") + QDir::currentPath(); QbsRunParameters libParams(QStringList({"-f", "thelibs.qbs", installRootSpec})); libParams.buildDirectory = "libbuild"; QCOMPARE(runQbs(libParams), 0); QbsRunParameters appParams("build", QStringList({"-f", "theapp.qbs", installRootSpec})); appParams.buildDirectory = "appbuild"; QCOMPARE(runQbs(appParams), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); appParams.command = "run"; QCOMPARE(runQbs(appParams), 0); QVERIFY2(m_qbsStdout.contains("Hello from thelib"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("Hello from theotherlib"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("thirdlib"), m_qbsStdout.constData()); QVERIFY(!QFileInfo::exists(appParams.buildDirectory + '/' + qbs::InstallOptions::defaultInstallRoot())); } void TestBlackbox::symlinkRemoval() { if (HostOsInfo::isWindowsHost()) QSKIP("No symlink support on Windows."); QDir::setCurrent(testDataDir + "/symlink-removal"); QVERIFY(QDir::current().mkdir("dir1")); QVERIFY(QDir::current().mkdir("dir2")); QVERIFY(QFile::link("dir2", "dir1/broken-link")); QVERIFY(QFile::link(QFileInfo("dir2").absoluteFilePath(), "dir1/valid-link-to-dir")); QVERIFY(QFile::link(QFileInfo("symlink-removal.qbs").absoluteFilePath(), "dir1/valid-link-to-file")); QCOMPARE(runQbs(), 0); QVERIFY(!QFile::exists("dir1")); QVERIFY(QFile::exists("dir2")); QVERIFY(QFile::exists("symlink-removal.qbs")); } void TestBlackbox::usingsAsSoleInputsNonMultiplexed() { QDir::setCurrent(testDataDir + QLatin1String("/usings-as-sole-inputs-non-multiplexed")); QCOMPARE(runQbs(), 0); const QString p3BuildDir = relativeProductBuildDir("p3"); QVERIFY(regularFileExists(p3BuildDir + "/custom1.out.plus")); QVERIFY(regularFileExists(p3BuildDir + "/custom2.out.plus")); } void TestBlackbox::variantSuffix() { QDir::setCurrent(testDataDir + "/variant-suffix"); QFETCH(bool, multiplex); QFETCH(bool, expectFailure); QFETCH(QString, variantSuffix); QFETCH(QString, buildVariant); QFETCH(QVariantMap, fileNames); QbsRunParameters params; params.command = "resolve"; params.arguments << "--force-probe-execution"; if (multiplex) params.arguments << "products.l.multiplex:true"; else params.arguments << ("modules.qbs.buildVariant:" + buildVariant); if (!variantSuffix.isEmpty()) params.arguments << ("modules.cpp.variantSuffix:" + variantSuffix); QCOMPARE(runQbs(params), 0); const QString fileNameMapKey = m_qbsStdout.contains("is Windows: true") ? "windows" : m_qbsStdout.contains("is Apple: true") ? "apple" : "unix"; if (variantSuffix.isEmpty() && multiplex && fileNameMapKey == "unix") expectFailure = true; params.command = "build"; params.expectFailure = expectFailure; params.arguments = QStringList("--clean-install-root"); QCOMPARE(runQbs(params) == 0, !expectFailure); if (expectFailure) return; const QStringList fileNameList = fileNames.value(fileNameMapKey).toStringList(); for (const QString &fileName : fileNameList) { QFile libFile("default/install-root/lib/" + fileName); QVERIFY2(libFile.exists(), qPrintable(libFile.fileName())); } } void TestBlackbox::variantSuffix_data() { QTest::addColumn("multiplex"); QTest::addColumn("expectFailure"); QTest::addColumn("variantSuffix"); QTest::addColumn("buildVariant"); QTest::addColumn("fileNames"); QTest::newRow("default suffix, debug") << false << false << QString() << QString("debug") << QVariantMap({std::make_pair(QString("windows"), QStringList("libl.ext")), std::make_pair(QString("apple"), QStringList("libl.ext")), std::make_pair(QString("unix"), QStringList("libl.ext"))}); QTest::newRow("default suffix, release") << false << false << QString() << QString("release") << QVariantMap({std::make_pair(QString("windows"), QStringList("libl.ext")), std::make_pair(QString("apple"), QStringList("libl.ext")), std::make_pair(QString("unix"), QStringList("libl.ext"))}); QTest::newRow("custom suffix, debug") << false << false << QString("blubb") << QString("debug") << QVariantMap({std::make_pair(QString("windows"), QStringList("liblblubb.ext")), std::make_pair(QString("apple"), QStringList("liblblubb.ext")), std::make_pair(QString("unix"), QStringList("liblblubb.ext"))}); QTest::newRow("custom suffix, release") << false << false << QString("blubb") << QString("release") << QVariantMap({std::make_pair(QString("windows"), QStringList("liblblubb.ext")), std::make_pair(QString("apple"), QStringList("liblblubb.ext")), std::make_pair(QString("unix"), QStringList("liblblubb.ext"))}); QTest::newRow("default suffix, multiplex") << true << false << QString() << QString() << QVariantMap({std::make_pair(QString("windows"), QStringList({"libl.ext", "libld.ext"})), std::make_pair(QString("apple"), QStringList({"libl.ext", "libl_debug.ext"})), std::make_pair(QString("unix"), QStringList())}); QTest::newRow("custom suffix, multiplex") << true << true << QString("blubb") << QString() << QVariantMap({std::make_pair(QString("windows"), QStringList()), std::make_pair(QString("apple"), QStringList()), std::make_pair(QString("unix"), QStringList())}); } void TestBlackbox::vcsGit() { const QString gitFilePath = findExecutable(QStringList("git")); if (gitFilePath.isEmpty()) QSKIP("git not found"); // Set up repo. QTemporaryDir repoDir; QVERIFY(repoDir.isValid()); ccp(testDataDir + "/vcs", repoDir.path()); QDir::setCurrent(repoDir.path()); QProcess git; git.start(gitFilePath, QStringList("init")); QVERIFY(waitForProcessSuccess(git)); git.start(gitFilePath, QStringList({"config", "user.name", "My Name"})); QVERIFY(waitForProcessSuccess(git)); git.start(gitFilePath, QStringList({"config", "user.email", "me@example.com"})); QVERIFY(waitForProcessSuccess(git)); QCOMPARE(runQbs({"resolve", {"-f", repoDir.path()}}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); // Run without git metadata. QbsRunParameters params("run", QStringList{"-f", repoDir.path()}); params.workingDir = repoDir.path() + "/.."; params.buildDirectory = repoDir.path(); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); QMap newRepoState = getRepoStateFromApp(); QVERIFY(newRepoState.contains("repoState")); QVERIFY(newRepoState.contains("latestTag")); QVERIFY(newRepoState.contains("commitsSinceTag")); QVERIFY(newRepoState.contains("commitSha")); QCOMPARE(newRepoState["repoState"], QByteArray("none")); QCOMPARE(newRepoState["latestTag"], QByteArray("none")); QCOMPARE(newRepoState["commitsSinceTag"], QByteArray("none")); QCOMPARE(newRepoState["commitSha"], QByteArray("none")); QMap oldRepoState = newRepoState; // Initial commit git.start(gitFilePath, QStringList({"add", "main.cpp"})); QVERIFY(waitForProcessSuccess(git)); git.start(gitFilePath, QStringList({"commit", "-m", "initial commit"})); QVERIFY(waitForProcessSuccess(git)); // Run with git metadata. WAIT_FOR_NEW_TIMESTAMP(); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QCOMPARE(newRepoState["latestTag"], QByteArray("none")); QCOMPARE(newRepoState["commitsSinceTag"], QByteArray("none")); QVERIFY(newRepoState["commitSha"] != QByteArray("none")); QVERIFY(newRepoState["commitSha"].startsWith(QByteArray("g"))); QVERIFY(oldRepoState["repoState"] != newRepoState["repoState"]); oldRepoState = newRepoState; // Run with no changes. QCOMPARE(runQbs(params), 0); QVERIFY2(!m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QCOMPARE(oldRepoState, newRepoState); // Run with changed source file. WAIT_FOR_NEW_TIMESTAMP(); touch("main.cpp"); QCOMPARE(runQbs(params), 0); QVERIFY2(!m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QCOMPARE(oldRepoState, newRepoState); // Add tag with dash WAIT_FOR_NEW_TIMESTAMP(); touch("dummy.txt"); git.start(gitFilePath, QStringList({"add", "dummy.txt"})); QVERIFY(waitForProcessSuccess(git)); git.start(gitFilePath, QStringList({"commit", "-m", "dummy!"})); QVERIFY(waitForProcessSuccess(git)); git.start(gitFilePath, QStringList({"tag", "-a", "v1.0.0-beta", "-m", "Version 1.0.0-beta"})); QVERIFY(waitForProcessSuccess(git)); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QCOMPARE(newRepoState["latestTag"], QByteArray("v1.0.0-beta")); QCOMPARE(newRepoState["commitsSinceTag"], QByteArray("0")); QVERIFY(newRepoState["commitSha"] != QByteArray("none")); QVERIFY(newRepoState["commitSha"].startsWith(QByteArray("g"))); QVERIFY(oldRepoState["repoState"] != newRepoState["repoState"]); oldRepoState = newRepoState; // Add new file to repo. Add new tag WAIT_FOR_NEW_TIMESTAMP(); touch("blubb.txt"); git.start(gitFilePath, QStringList({"add", "blubb.txt"})); QVERIFY(waitForProcessSuccess(git)); git.start(gitFilePath, QStringList({"commit", "-m", "blubb!"})); QVERIFY(waitForProcessSuccess(git)); git.start(gitFilePath, QStringList({"tag", "-a", "v1.0.0", "-m", "Version 1.0.0-beta"})); QVERIFY(waitForProcessSuccess(git)); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QCOMPARE(newRepoState["latestTag"], QByteArray("v1.0.0")); QCOMPARE(newRepoState["commitsSinceTag"], QByteArray("0")); QVERIFY(newRepoState["commitSha"] != QByteArray("none")); QVERIFY(newRepoState["commitSha"].startsWith(QByteArray("g"))); QVERIFY(oldRepoState["repoState"] != newRepoState["repoState"]); // https://bugreports.qt.io/projects/QBS/issues/QBS-1814 oldRepoState = newRepoState; WAIT_FOR_NEW_TIMESTAMP(); touch("loremipsum.txt"); git.start(gitFilePath, QStringList({"add", "loremipsum.txt"})); QVERIFY(waitForProcessSuccess(git)); git.start(gitFilePath, QStringList({"commit", "-m", "loremipsum!"})); QVERIFY(waitForProcessSuccess(git)); // Remove .git/logs/HEAD QFile::remove(repoDir.path() + "/.git/logs/HEAD"); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QCOMPARE(newRepoState["latestTag"], QByteArray("v1.0.0")); QCOMPARE(newRepoState["commitsSinceTag"], QByteArray("1")); QVERIFY(newRepoState["commitSha"] != QByteArray("none")); QVERIFY(newRepoState["commitSha"].startsWith(QByteArray("g"))); QVERIFY(oldRepoState["repoState"] != newRepoState["repoState"]); } void TestBlackbox::vcsSubversion() { const QString svnadminFilePath = findExecutable(QStringList("svnadmin")); if (svnadminFilePath.isEmpty()) QSKIP("svnadmin not found"); const QString svnFilePath = findExecutable(QStringList("svn")); if (svnFilePath.isEmpty()) QSKIP("svn not found"); if (HostOsInfo::isWindowsHost() && qEnvironmentVariableIsSet("GITHUB_ACTIONS")) QSKIP("Skip this test when running on GitHub"); // Set up repo. QTemporaryDir repoDir; QVERIFY(repoDir.isValid()); QProcess proc; proc.setWorkingDirectory(repoDir.path()); proc.start(svnadminFilePath, QStringList({"create", "vcstest"})); QVERIFY(waitForProcessSuccess(proc)); const QString projectUrl = "file://" + repoDir.path() + "/vcstest/trunk"; proc.start(svnFilePath, QStringList({"import", testDataDir + "/vcs", projectUrl, "-m", "initial import"})); QVERIFY(waitForProcessSuccess(proc)); QTemporaryDir checkoutDir; QVERIFY(checkoutDir.isValid()); proc.setWorkingDirectory(checkoutDir.path()); proc.start(svnFilePath, QStringList({"co", projectUrl, "."})); QVERIFY(waitForProcessSuccess(proc)); // Initial runs QDir::setCurrent(checkoutDir.path()); QbsRunParameters failParams; failParams.command = "run"; failParams.expectFailure = true; const int retval = runQbs(failParams); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); if (m_qbsStderr.contains("svn too old")) QSKIP("svn too old"); QCOMPARE(retval, 0); QMap newRepoState = getRepoStateFromApp(); QVERIFY(newRepoState.contains("repoState")); QVERIFY(newRepoState.contains("latestTag")); QVERIFY(newRepoState.contains("commitsSinceTag")); QVERIFY(newRepoState.contains("commitSha")); QCOMPARE(newRepoState["repoState"], QByteArray("1")); QCOMPARE(newRepoState["latestTag"], QByteArray("none")); QCOMPARE(newRepoState["commitsSinceTag"], QByteArray("none")); QCOMPARE(newRepoState["commitSha"], QByteArray("none")); QMap oldRepoState = newRepoState; QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(!m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QCOMPARE(oldRepoState, newRepoState); // Run with changed source file. WAIT_FOR_NEW_TIMESTAMP(); touch("main.cpp"); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(!m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QCOMPARE(oldRepoState, newRepoState); // Add new file to repo. WAIT_FOR_NEW_TIMESTAMP(); touch("blubb.txt"); proc.start(svnFilePath, QStringList({"add", "blubb.txt"})); QVERIFY(waitForProcessSuccess(proc)); proc.start(svnFilePath, QStringList({"commit", "-m", "blubb!"})); QVERIFY(waitForProcessSuccess(proc)); QCOMPARE(runQbs(QbsRunParameters("run")), 0); newRepoState = getRepoStateFromApp(); QVERIFY(oldRepoState["repoState"] != newRepoState["repoState"]); } void TestBlackbox::vcsMercurial() { const QString hgFilePath = findExecutable(QStringList("hg")); if (hgFilePath.isEmpty()) QSKIP("hg not found"); // Set up repo. QTemporaryDir repoDir; QVERIFY(repoDir.isValid()); ccp(testDataDir + "/vcs", repoDir.path()); QDir::setCurrent(repoDir.path()); QProcess hg; hg.start(hgFilePath, QStringList{"init"}); QVERIFY(waitForProcessSuccess(hg)); const QStringList credentials{"--config", "ui.username=\"My Name \""}; QCOMPARE(runQbs({"resolve", {"-f", repoDir.path()}}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); // Run without hg metadata QbsRunParameters params("run", QStringList{"-f", repoDir.path()}); params.workingDir = repoDir.path() + "/.."; params.buildDirectory = repoDir.path(); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); QMap newRepoState = getRepoStateFromApp(); QVERIFY(newRepoState.contains("repoState")); QVERIFY(newRepoState.contains("latestTag")); QVERIFY(newRepoState.contains("commitsSinceTag")); QVERIFY(newRepoState.contains("commitSha")); QCOMPARE(newRepoState["repoState"], QByteArray("none")); QCOMPARE(newRepoState["latestTag"], QByteArray("none")); QCOMPARE(newRepoState["commitsSinceTag"], QByteArray("none")); QCOMPARE(newRepoState["commitSha"], QByteArray("none")); QMap oldRepoState = newRepoState; // Initial commit hg.start(hgFilePath, QStringList{"add", "main.cpp"}); QVERIFY(waitForProcessSuccess(hg)); hg.start(hgFilePath, credentials + QStringList{"commit", "-m", "initial commit"}); QVERIFY(waitForProcessSuccess(hg)); // Run with hg metadata. WAIT_FOR_NEW_TIMESTAMP(); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QVERIFY(oldRepoState["repoState"] != newRepoState["repoState"]); QCOMPARE(newRepoState["latestTag"], QByteArray("null")); QCOMPARE(newRepoState["commitsSinceTag"], QByteArray("1")); QVERIFY(newRepoState["commitSha"] != QByteArray("none")); QVERIFY(newRepoState["commitSha"].startsWith(QByteArray("m"))); oldRepoState = newRepoState; // Run with no changes. QCOMPARE(runQbs(params), 0); QVERIFY2(!m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QCOMPARE(oldRepoState, newRepoState); // Run with changed source file. WAIT_FOR_NEW_TIMESTAMP(); touch("main.cpp"); QCOMPARE(runQbs(params), 0); QVERIFY2(!m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QCOMPARE(oldRepoState, newRepoState); // Add tag with dash WAIT_FOR_NEW_TIMESTAMP(); hg.start(hgFilePath, credentials + QStringList{"tag", "v1.0.0-beta"}); QVERIFY(waitForProcessSuccess(hg)); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QCOMPARE(newRepoState["latestTag"], QByteArray("v1.0.0-beta")); QCOMPARE(newRepoState["commitsSinceTag"], QByteArray("1")); QVERIFY(newRepoState["commitSha"] != QByteArray("none")); QVERIFY(newRepoState["commitSha"].startsWith(QByteArray("m"))); QVERIFY(oldRepoState["repoState"] != newRepoState["repoState"]); oldRepoState = newRepoState; // Add new file to repo. Add new tag WAIT_FOR_NEW_TIMESTAMP(); touch("blubb.txt"); hg.start(hgFilePath, QStringList{"add", "blubb.txt"}); QVERIFY(waitForProcessSuccess(hg)); hg.start(hgFilePath, credentials + QStringList{"commit", "-m", "blubb!"}); QVERIFY(waitForProcessSuccess(hg)); hg.start(hgFilePath, credentials + QStringList{"tag", "v1.0.0"}); QVERIFY(waitForProcessSuccess(hg)); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("generating my-repo-state.h"), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStderr.constData()); newRepoState = getRepoStateFromApp(); QCOMPARE(newRepoState["latestTag"], QByteArray("v1.0.0")); QCOMPARE(newRepoState["commitsSinceTag"], QByteArray("1")); QVERIFY(newRepoState["commitSha"] != QByteArray("none")); QVERIFY(newRepoState["commitSha"].startsWith(QByteArray("m"))); QVERIFY(oldRepoState["repoState"] != newRepoState["repoState"]); } void TestBlackbox::versionCheck() { QDir::setCurrent(testDataDir + "/versioncheck"); QFETCH(QString, requestedMinVersion); QFETCH(QString, requestedMaxVersion); QFETCH(QString, actualVersion); QFETCH(QString, errorMessage); QbsRunParameters params; params.expectFailure = !errorMessage.isEmpty(); params.arguments << "-n" << ("products.versioncheck.requestedMinVersion:'" + requestedMinVersion + "'") << ("products.versioncheck.requestedMaxVersion:'" + requestedMaxVersion + "'") << ("modules.lower.version:'" + actualVersion + "'"); QCOMPARE(runQbs(params) == 0, errorMessage.isEmpty()); if (params.expectFailure) QVERIFY2(QString(m_qbsStderr).contains(errorMessage), m_qbsStderr.constData()); } void TestBlackbox::versionCheck_data() { QTest::addColumn("requestedMinVersion"); QTest::addColumn("requestedMaxVersion"); QTest::addColumn("actualVersion"); QTest::addColumn("errorMessage"); QTest::newRow("ok1") << "1.0" << "1.1" << "1.0" << QString(); QTest::newRow("ok2") << "1.0" << "2.0.1" << "2.0" << QString(); QTest::newRow("ok3") << "1.0" << "2.5" << "1.5" << QString(); QTest::newRow("ok3") << "1.0" << "2.0" << "1.99" << QString(); QTest::newRow("bad1") << "2.0" << "2.1" << "1.5" << "needs to be at least"; QTest::newRow("bad2") << "2.0" << "3.0" << "1.5" << "needs to be at least"; QTest::newRow("bad3") << "2.0" << "3.0" << "3.5" << "needs to be lower than"; QTest::newRow("bad4") << "2.0" << "3.0" << "3.0" << "needs to be lower than"; // "bad" because the "higer" module has stronger requirements. QTest::newRow("bad5") << "0.1" << "0.9" << "0.5" << "Impossible version constraint"; } void TestBlackbox::versionScript() { QDir::setCurrent(testDataDir + "/versionscript"); QCOMPARE(runQbs(QbsRunParameters("resolve", {"qbs.installRoot:" + QDir::currentPath()})), 0); const bool isLinuxGcc = m_qbsStdout.contains("is gcc for Linux: true"); const bool isNotLinuxGcc = m_qbsStdout.contains("is gcc for Linux: false"); if (isNotLinuxGcc) QSKIP("version script test only applies to Linux"); QVERIFY(isLinuxGcc); QCOMPARE(runQbs(QbsRunParameters(QStringList("-q"))), 0); const QString output = QString::fromLocal8Bit(m_qbsStderr); const QRegularExpression pattern(QRegularExpression::anchoredPattern(".*---(.*)---.*"), QRegularExpression::DotMatchesEverythingOption); const QRegularExpressionMatch match = pattern.match(output); QVERIFY2(match.hasMatch(), qPrintable(output)); QCOMPARE(pattern.captureCount(), 1); const QString nmPath = match.captured(1); if (!QFile::exists(nmPath)) QSKIP("Cannot check for symbol presence: No nm found."); QProcess nm; nm.start(nmPath, QStringList(QDir::currentPath() + "/libversionscript.so")); QVERIFY(nm.waitForStarted()); QVERIFY(nm.waitForFinished()); const QByteArray allSymbols = nm.readAllStandardOutput(); QCOMPARE(nm.exitCode(), 0); QVERIFY2(allSymbols.contains("dummyLocal"), allSymbols.constData()); QVERIFY2(allSymbols.contains("dummyGlobal"), allSymbols.constData()); nm.start(nmPath, QStringList() << "-g" << QDir::currentPath() + "/libversionscript.so"); QVERIFY(nm.waitForStarted()); QVERIFY(nm.waitForFinished()); const QByteArray globalSymbols = nm.readAllStandardOutput(); QCOMPARE(nm.exitCode(), 0); QVERIFY2(!globalSymbols.contains("dummyLocal"), allSymbols.constData()); QVERIFY2(globalSymbols.contains("dummyGlobal"), allSymbols.constData()); } void TestBlackbox::wholeArchive() { QDir::setCurrent(testDataDir + "/whole-archive"); QFETCH(QString, wholeArchiveString); QFETCH(bool, ruleInvalidationExpected); QFETCH(bool, dllLinkingExpected); const QbsRunParameters resolveParams("resolve", QStringList("products.dynamiclib.linkWholeArchive:" + wholeArchiveString)); QCOMPARE(runQbs(QbsRunParameters(resolveParams)), 0); const bool linkerSupportsWholeArchive = m_qbsStdout.contains("can link whole archives"); const bool linkerDoesNotSupportWholeArchive = m_qbsStdout.contains("cannot link whole archives"); QVERIFY(linkerSupportsWholeArchive != linkerDoesNotSupportWholeArchive); if (m_qbsStdout.contains("is emscripten: true")) QSKIP("Irrelevant for emscripten"); QVERIFY(m_qbsStdout.contains("is emscripten: false")); QCOMPARE(runQbs(QbsRunParameters(QStringList({ "-vvp", "dynamiclib" }))), 0); const bool wholeArchive = !wholeArchiveString.isEmpty(); const bool outdatedVisualStudio = wholeArchive && linkerDoesNotSupportWholeArchive; const QByteArray invalidationOutput = "Value for property 'staticlib 1:cpp.linkWholeArchive' has changed."; if (!outdatedVisualStudio) QCOMPARE(m_qbsStderr.contains(invalidationOutput), ruleInvalidationExpected); QCOMPARE(m_qbsStdout.contains("linking"), dllLinkingExpected && !outdatedVisualStudio); QbsRunParameters buildParams(QStringList("-p")); buildParams.expectFailure = !wholeArchive || outdatedVisualStudio; buildParams.arguments << "app1"; QCOMPARE(runQbs(QbsRunParameters(buildParams)) == 0, wholeArchive && !outdatedVisualStudio); buildParams.arguments.last() = "app2"; QCOMPARE(runQbs(QbsRunParameters(buildParams)) == 0, wholeArchive && !outdatedVisualStudio); buildParams.arguments.last() = "app4"; QCOMPARE(runQbs(QbsRunParameters(buildParams)) == 0, wholeArchive && !outdatedVisualStudio); buildParams.arguments.last() = "app3"; buildParams.expectFailure = true; QVERIFY(runQbs(QbsRunParameters(buildParams)) != 0); } void TestBlackbox::wholeArchive_data() { QTest::addColumn("wholeArchiveString"); QTest::addColumn("ruleInvalidationExpected"); QTest::addColumn("dllLinkingExpected"); QTest::newRow("link normally") << QString() << false << true; QTest::newRow("link whole archive") << "true" << true << true; QTest::newRow("link whole archive again") << "notfalse" << false << false; } static bool symlinkExists(const QString &linkFilePath) { return QFileInfo(linkFilePath).isSymLink(); } void TestBlackbox::clean() { QDir::setCurrent(testDataDir + "/clean"); // Can't clean without a build graph. QbsRunParameters failParams("clean"); failParams.expectFailure = true; QVERIFY(runQbs(failParams) != 0); // Default behavior: Remove all. QCOMPARE(runQbs(), 0); const QString objectSuffix = parsedObjectSuffix(m_qbsStdout); const QString appObjectFilePath = relativeProductBuildDir("app") + '/' + inputDirHash(".") + "/main.cpp" + objectSuffix; const QString appExeFilePath = relativeExecutableFilePath("app", m_qbsStdout); const QString depObjectFilePath = relativeProductBuildDir("dep") + '/' + inputDirHash(".") + "/dep.cpp" + objectSuffix; const QString depLibBase = relativeProductBuildDir("dep") + '/' + QBS_HOST_DYNAMICLIB_PREFIX + "dep"; const bool isEmscripten = m_qbsStdout.contains("is emscripten: true"); const bool isNotEmscripten = m_qbsStdout.contains("is emscripten: false"); QCOMPARE(isEmscripten, !isNotEmscripten); QString depLibFilePath; QStringList symlinks; if (qbs::Internal::HostOsInfo::isMacosHost()) { depLibFilePath = depLibBase + ".1.1.0" + QBS_HOST_DYNAMICLIB_SUFFIX; symlinks << depLibBase + ".1.1" + QBS_HOST_DYNAMICLIB_SUFFIX << depLibBase + ".1" + QBS_HOST_DYNAMICLIB_SUFFIX << depLibBase + QBS_HOST_DYNAMICLIB_SUFFIX; } else if (qbs::Internal::HostOsInfo::isAnyUnixHost()) { depLibFilePath = depLibBase + QBS_HOST_DYNAMICLIB_SUFFIX + ".1.1.0"; if (!isEmscripten) { symlinks << depLibBase + QBS_HOST_DYNAMICLIB_SUFFIX + ".1.1" << depLibBase + QBS_HOST_DYNAMICLIB_SUFFIX + ".1" << depLibBase + QBS_HOST_DYNAMICLIB_SUFFIX; } } else { depLibFilePath = depLibBase + QBS_HOST_DYNAMICLIB_SUFFIX; } QVERIFY2(regularFileExists(appObjectFilePath), qPrintable(appObjectFilePath)); QVERIFY(regularFileExists(appExeFilePath)); QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("clean"))), 0); QVERIFY(!QFile(appObjectFilePath).exists()); QVERIFY(!QFile(appExeFilePath).exists()); QVERIFY(!QFile(depObjectFilePath).exists()); QVERIFY(!QFile(depLibFilePath).exists()); for (const QString &symLink : std::as_const(symlinks)) QVERIFY2(!symlinkExists(symLink), qPrintable(symLink)); // Remove all, with a forced re-resolve in between. // This checks that rescuable artifacts are also removed. QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList() << "modules.cpp.optimization:none")), 0); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(appObjectFilePath)); QVERIFY(regularFileExists(appExeFilePath)); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList() << "modules.cpp.optimization:fast")), 0); QVERIFY(regularFileExists(appObjectFilePath)); QVERIFY(regularFileExists(appExeFilePath)); QCOMPARE(runQbs(QbsRunParameters("clean")), 0); QVERIFY(!QFile(appObjectFilePath).exists()); QVERIFY(!QFile(appExeFilePath).exists()); QVERIFY(!QFile(depObjectFilePath).exists()); QVERIFY(!QFile(depLibFilePath).exists()); for (const QString &symLink : std::as_const(symlinks)) QVERIFY2(!symlinkExists(symLink), qPrintable(symLink)); // Dry run. QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(appObjectFilePath)); QVERIFY(regularFileExists(appExeFilePath)); QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("clean"), QStringList("-n"))), 0); QVERIFY(regularFileExists(appObjectFilePath)); QVERIFY(regularFileExists(appExeFilePath)); QVERIFY(regularFileExists(depObjectFilePath)); QVERIFY(regularFileExists(depLibFilePath)); for (const QString &symLink : std::as_const(symlinks)) QVERIFY2(symlinkExists(symLink), qPrintable(symLink)); // Product-wise, dependency only. QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(appObjectFilePath)); QVERIFY(regularFileExists(appExeFilePath)); QVERIFY(regularFileExists(depObjectFilePath)); QVERIFY(regularFileExists(depLibFilePath)); QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("clean"), QStringList("-p") << "dep")), 0); QVERIFY(regularFileExists(appObjectFilePath)); QVERIFY(regularFileExists(appExeFilePath)); QVERIFY(!QFile(depObjectFilePath).exists()); QVERIFY(!QFile(depLibFilePath).exists()); for (const QString &symLink : std::as_const(symlinks)) QVERIFY2(!symlinkExists(symLink), qPrintable(symLink)); // Product-wise, dependent product only. QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(appObjectFilePath)); QVERIFY(regularFileExists(appExeFilePath)); QVERIFY(regularFileExists(depObjectFilePath)); QVERIFY(regularFileExists(depLibFilePath)); QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("clean"), QStringList("-p") << "app")), 0); QVERIFY(!QFile(appObjectFilePath).exists()); QVERIFY(!QFile(appExeFilePath).exists()); QVERIFY(regularFileExists(depObjectFilePath)); QVERIFY(regularFileExists(depLibFilePath)); for (const QString &symLink : std::as_const(symlinks)) QVERIFY2(symlinkExists(symLink), qPrintable(symLink)); } void TestBlackbox::conditionalExport() { QDir::setCurrent(testDataDir + "/conditional-export"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("missing define"), m_qbsStderr.constData()); params.expectFailure = false; params.arguments << "project.enableExport:true"; params.command = "resolve"; QCOMPARE(runQbs(params), 0); params.command = "build"; QCOMPARE(runQbs(params), 0); } void TestBlackbox::conditionalFileTagger() { QDir::setCurrent(testDataDir + "/conditional-filetagger"); QbsRunParameters params(QStringList("products.theApp.enableTagger:false")); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling")); params.arguments = QStringList("products.theApp.enableTagger:true"); params.command = "resolve"; QCOMPARE(runQbs(params), 0); params.command = "build"; QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("compiling")); } void TestBlackbox::configure() { QDir::setCurrent(testDataDir + "/configure"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "run"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("Configured at"), m_qbsStdout.constData()); } void TestBlackbox::conflictingArtifacts() { QDir::setCurrent(testDataDir + "/conflicting-artifacts"); QbsRunParameters params(QStringList() << "-n"); params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("Conflicting artifacts"), m_qbsStderr.constData()); } void TestBlackbox::cxxLanguageVersion() { QDir::setCurrent(testDataDir + "/cxx-language-version"); rmDirR(relativeBuildDir()); QFETCH(QString, version); QFETCH(QVariantMap, requiredFlags); QFETCH(QVariantMap, forbiddenFlags); QbsRunParameters resolveParams; resolveParams.command = "resolve"; resolveParams.arguments << "--force-probe-execution"; resolveParams.arguments << "modules.cpp.useLanguageVersionFallback:true"; if (!version.isEmpty()) resolveParams.arguments << ("modules.cpp.cxxLanguageVersion:" + version); QCOMPARE(runQbs(resolveParams), 0); QString mapKey; if (version == "c++17" && m_qbsStdout.contains("is even newer MSVC: true")) mapKey = "msvc-brandnew"; else if (m_qbsStdout.contains("is newer MSVC: true")) mapKey = "msvc-new"; else if (m_qbsStdout.contains("is older MSVC: true")) mapKey = "msvc_old"; else if (m_qbsStdout.contains("is GCC: true")) mapKey = "gcc"; QVERIFY2(!mapKey.isEmpty(), m_qbsStdout.constData()); QbsRunParameters buildParams; buildParams.expectFailure = mapKey == "gcc" && (version == "c++17" || version == "c++21"); buildParams.arguments = QStringList({"--command-echo-mode", "command-line"}); const int retVal = runQbs(buildParams); if (!buildParams.expectFailure) QCOMPARE(retVal, 0); const QString requiredFlag = requiredFlags.value(mapKey).toString(); if (!requiredFlag.isEmpty()) QVERIFY2(m_qbsStdout.contains(requiredFlag.toLocal8Bit()), m_qbsStdout.constData()); const QString forbiddenFlag = forbiddenFlags.value(mapKey).toString(); if (!forbiddenFlag.isEmpty()) QVERIFY2(!m_qbsStdout.contains(forbiddenFlag.toLocal8Bit()), m_qbsStdout.constData()); } void TestBlackbox::cxxLanguageVersion_data() { QTest::addColumn("version"); QTest::addColumn("requiredFlags"); QTest::addColumn("forbiddenFlags"); QTest::newRow("C++98") << QString("c++98") << QVariantMap({std::make_pair(QString("gcc"), QString("-std=c++98"))}) << QVariantMap({std::make_pair(QString("msvc-old"), QString("/std:")), std::make_pair(QString("msvc-new"), QString("/std:"))}); QTest::newRow("C++11") << QString("c++11") << QVariantMap({std::make_pair(QString("gcc"), QString("-std=c++0x"))}) << QVariantMap({std::make_pair(QString("msvc-old"), QString("/std:")), std::make_pair(QString("msvc-new"), QString("/std:"))}); QTest::newRow("C++14") << QString("c++14") << QVariantMap({std::make_pair(QString("gcc"), QString("-std=c++1y")), std::make_pair(QString("msvc-new"), QString("/std:c++14")) }) << QVariantMap({std::make_pair(QString("msvc-old"), QString("/std:"))}); QTest::newRow("C++17") << QString("c++17") << QVariantMap({std::make_pair(QString("gcc"), QString("-std=c++1z")), std::make_pair(QString("msvc-new"), QString("/std:c++latest")), std::make_pair(QString("msvc-brandnew"), QString("/std:c++17")) }) << QVariantMap({std::make_pair(QString("msvc-old"), QString("/std:"))}); QTest::newRow("C++21") << QString("c++21") << QVariantMap({std::make_pair(QString("gcc"), QString("-std=c++21")), std::make_pair(QString("msvc-new"), QString("/std:c++latest")) }) << QVariantMap({std::make_pair(QString("msvc-old"), QString("/std:"))}); QTest::newRow("default") << QString() << QVariantMap() << QVariantMap({std::make_pair(QString("gcc"), QString("-std=")), std::make_pair(QString("msvc-old"), QString("/std:")), std::make_pair(QString("msvc-new"), QString("/std:"))}); } void TestBlackbox::conanfileProbe_data() { QTest::addColumn("forceFailure"); QTest::newRow("success") << false; QTest::newRow("failure") << true; } void TestBlackbox::conanfileProbe() { QFETCH(bool, forceFailure); QString executable = findExecutable({"conan"}); if (executable.isEmpty()) QSKIP("conan is not installed or not available in PATH."); const auto conanVersion = this->conanVersion(executable); if (!conanVersion.isValid()) QSKIP("Can't get conan version."); if (compare(conanVersion, qbs::Version(2, 0)) >= 0) QSKIP("This test does not apply to conan 2.0 and newer."); // We first build a dummy package testlib and use that as dependency // in the testapp package. QDir::setCurrent(testDataDir + "/conanfile-probe/testlib"); QStringList arguments{"create -o opt=True -s os=AIX . testlib/1.2.3@qbs/testing"}; QProcess conan; conan.start(executable, arguments); QVERIFY(waitForProcessSuccess(conan)); QDir::setCurrent(testDataDir + "/conanfile-probe/testapp"); QCOMPARE(runQbs(QbsRunParameters("resolve", {"--force-probe-execution", QStringLiteral("projects.conanfile-probe-project.forceFailure:") + (forceFailure ? "true" : "false")})), forceFailure ? 1 : 0); QFile file(relativeBuildDir() + "/results.json"); QVERIFY(file.open(QIODevice::ReadOnly)); QVariantMap actualResults = QJsonDocument::fromJson(file.readAll()).toVariant().toMap(); const auto generatedFilesPath = actualResults.take("generatedFilesPath").toString(); // We want to make sure that generatedFilesPath is under the project directory, // but we don't care about the actual name. QVERIFY(directoryExists(relativeBuildDir() + "/genconan/" + QFileInfo(generatedFilesPath).baseName())); const QVariantMap expectedResults = { { "json", "TESTLIB_ENV_VAL" }, { "dependencies", QVariantList{"testlib1", "testlib2"} }, }; QCOMPARE(actualResults, expectedResults); } void TestBlackbox::conflictingPropertyValues_data() { QTest::addColumn("overrideInProduct"); QTest::newRow("don't override in product") << false; QTest::newRow("override in product") << true; } void TestBlackbox::conflictingPropertyValues() { QFETCH(bool, overrideInProduct); QDir::setCurrent(testDataDir + "/conflicting-property-values"); if (overrideInProduct) REPLACE_IN_FILE("conflicting-property-values.qbs", "// low.prop: name", "low.prop: name"); else REPLACE_IN_FILE("conflicting-property-values.qbs", "low.prop: name", "// low.prop: name"); WAIT_FOR_NEW_TIMESTAMP(); QCOMPARE(runQbs(QString("resolve")), 0); if (overrideInProduct) { // Binding in product itself overrides everything else, module-level conflicts // are irrelevant. QVERIFY2(m_qbsStdout.contains("final prop value: toplevel"), m_qbsStdout.constData()); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); } else { // Only the conflicts in the highest-level modules are reported, lower-level conflicts // are irrelevant. // prop2 does not cause a conflict, because the values are the same. QVERIFY2(m_qbsStdout.contains("final prop value: highest"), m_qbsStdout.constData()); QVERIFY2(m_qbsStderr.contains("Conflicting scalar values for property 'prop'"), m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.count("values.qbs") == 2, m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.contains("values.qbs:20:23"), m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.contains("values.qbs:30:23"), m_qbsStderr.constData()); } } void TestBlackbox::cpuFeatures() { QDir::setCurrent(testDataDir + "/cpu-features"); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); const bool isX86 = m_qbsStdout.contains("is x86: true"); const bool isX64 = m_qbsStdout.contains("is x64: true"); if (!isX86 && !isX64) { QVERIFY2(m_qbsStdout.contains("is x86: false") && m_qbsStdout.contains("is x64: false"), m_qbsStdout.constData()); QSKIP("Not an x86 host"); } const bool isGcc = m_qbsStdout.contains("is gcc: true"); const bool isMsvc = m_qbsStdout.contains("is msvc: true"); if (!isGcc && !isMsvc) { QVERIFY2(m_qbsStdout.contains("is gcc: false") && m_qbsStdout.contains("is msvc: false"), m_qbsStdout.constData()); QSKIP("Neither GCC nor MSVC"); } QbsRunParameters params(QStringList{"--command-echo-mode", "command-line"}); params.expectFailure = true; runQbs(params); if (isGcc) { QVERIFY2(m_qbsStdout.contains("-msse2") && m_qbsStdout.contains("-mavx") && m_qbsStdout.contains("-mno-avx512f"), m_qbsStdout.constData()); } else { QVERIFY2(m_qbsStdout.contains("/arch:AVX"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("/arch:AVX2"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("/arch:SSE2") == isX86, m_qbsStdout.constData()); } } void TestBlackbox::cxxModules_data() { QTest::addColumn("projectDir"); QTest::newRow("single-module") << "single-mod"; QTest::newRow("dot-in-name") << "dot-in-name"; QTest::newRow("export-import") << "export-import"; QTest::newRow("import-std") << "import-std"; QTest::newRow("import-std-compat") << "import-std-compat"; QTest::newRow("dependent-modules") << "dep-mods"; QTest::newRow("declaration-implementation") << "decl-impl"; QTest::newRow("library-module") << "lib-mod"; QTest::newRow("partitions") << "partitions"; QTest::newRow("partitions-recursive") << "part-rec"; QTest::newRow("partitions-dependency-on-module") << "part-depmod"; QTest::newRow("partitions-library") << "part-lib"; } void TestBlackbox::cxxModules() { QFETCH(QString, projectDir); QDir::setCurrent(testDataDir + "/cxx-modules/" + projectDir); rmDirR(relativeBuildDir()); QCOMPARE(runQbs(QbsRunParameters{"resolve"}), 0); if (m_qbsStdout.contains("Unsupported toolchainType")) QSKIP("Modules are not supported for this toolchain"); QCOMPARE(runQbs(QbsRunParameters{"build"}), 0); } void TestBlackbox::cxxModulesChangesTracking() { const auto checkContains = [this](const QStringList &files) { for (const auto &file : files) { if (!m_qbsStdout.contains(QByteArrayLiteral("compiling ") + file.toUtf8())) return false; } return true; }; const auto checkNotContains = [this](const QStringList &files) { for (const auto &file : files) { if (m_qbsStdout.contains(QByteArrayLiteral("compiling ") + file.toUtf8())) return false; } return true; }; QDir::setCurrent(testDataDir + "/cxx-modules/dep-mods"); rmDirR(relativeBuildDir()); QCOMPARE(runQbs(QbsRunParameters{"resolve"}), 0); if (m_qbsStdout.contains("Unsupported toolchainType")) QSKIP("Modules are not supported for this toolchain"); QbsRunParameters buildParams{"build"}; QCOMPARE(runQbs(buildParams), 0); QVERIFY2(checkContains({"a.cppm", "b.cppm", "c.cppm", "main.cpp"}), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("main.cpp"); QCOMPARE(runQbs(buildParams), 0); QVERIFY2(checkContains({"main.cpp"}), m_qbsStdout.constData()); QVERIFY2(checkNotContains({"a.cppm", "b.cppm", "c.cppm"}), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("c.cppm"); QCOMPARE(runQbs(buildParams), 0); QVERIFY2(checkContains({"c.cppm", "main.cpp"}), m_qbsStdout.constData()); QVERIFY2(checkNotContains({"a.cppm", "b.cppm"}), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("b.cppm"); QCOMPARE(runQbs(buildParams), 0); QVERIFY2(checkContains({"b.cppm", "c.cppm", "main.cpp"}), m_qbsStdout.constData()); QVERIFY2(checkNotContains({"a.cppm"}), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("a.cppm"); QCOMPARE(runQbs(buildParams), 0); QVERIFY2(checkContains({"a.cppm", "b.cppm", "c.cppm", "main.cpp"}), m_qbsStdout.constData()); } void TestBlackbox::dateProperty() { QDir::setCurrent(testDataDir + "/date-property"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("The stored date was 1999-12-31"), m_qbsStdout.constData()); } void TestBlackbox::renameDependency() { QDir::setCurrent(testDataDir + "/renameDependency"); if (QFile::exists("work")) rmDirR("work"); QDir().mkdir("work"); ccp("before", "work"); QDir::setCurrent(testDataDir + "/renameDependency/work"); QCOMPARE(runQbs(), 0); WAIT_FOR_NEW_TIMESTAMP(); QFile::remove("lib.h"); QFile::remove("lib.cpp"); ccp("../after", "."); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY(m_qbsStdout.contains("compiling main.cpp")); } void TestBlackbox::separateDebugInfo() { QDir::setCurrent(testDataDir + "/separate-debug-info"); QCOMPARE(runQbs(QbsRunParameters(QStringList("qbs.debugInformation:true"))), 0); const bool isWindows = m_qbsStdout.contains("is windows: yes"); const bool isNotWindows = m_qbsStdout.contains("is windows: no"); QVERIFY(isWindows != isNotWindows); const bool isMacos = m_qbsStdout.contains("is macos: yes"); const bool isNotMacos = m_qbsStdout.contains("is macos: no"); QVERIFY(isMacos != isNotMacos); const bool isDarwin = m_qbsStdout.contains("is darwin: yes"); const bool isNotDarwin = m_qbsStdout.contains("is darwin: no"); QVERIFY(isDarwin != isNotDarwin); const bool isGcc = m_qbsStdout.contains("is gcc: yes"); const bool isNotGcc = m_qbsStdout.contains("is gcc: no"); QVERIFY(isGcc != isNotGcc); const bool isMsvc = m_qbsStdout.contains("is msvc: yes"); const bool isNotMsvc = m_qbsStdout.contains("is msvc: no"); QVERIFY(isMsvc != isNotMsvc); const bool isEmscripten = m_qbsStdout.contains("is emscripten: yes"); const bool isNotEmscripten = m_qbsStdout.contains("is emscripten: no"); QVERIFY(isEmscripten != isNotEmscripten); if (isDarwin) { QVERIFY(directoryExists(relativeProductBuildDir("app1") + "/app1.app.dSYM")); QVERIFY(regularFileExists(relativeProductBuildDir("app1") + "/app1.app.dSYM/Contents/Info.plist")); QVERIFY(regularFileExists(relativeProductBuildDir("app1") + "/app1.app.dSYM/Contents/Resources/DWARF/app1")); QCOMPARE(QDir(relativeProductBuildDir("app1") + "/app1.app.dSYM/Contents/Resources/DWARF") .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1); QVERIFY(!QFile::exists(relativeProductBuildDir("app2") + "/app2.app.dSYM")); QVERIFY(!QFile::exists(relativeProductBuildDir("app3") + "/app3.app.dSYM")); if (isMacos) { QVERIFY(regularFileExists(relativeProductBuildDir("app3") + "/app3.app/Contents/MacOS/app3.dwarf")); } else { QVERIFY(regularFileExists(relativeProductBuildDir("app3") + "/app3.app/app3.dwarf")); } QVERIFY(directoryExists(relativeProductBuildDir("app4") + "/app4.dSYM")); QVERIFY(regularFileExists(relativeProductBuildDir("app4") + "/app4.dSYM/Contents/Info.plist")); QVERIFY(regularFileExists(relativeProductBuildDir("app4") + "/app4.dSYM/Contents/Resources/DWARF/app4")); QCOMPARE(QDir(relativeProductBuildDir("app4") + "/app4.dSYM/Contents/Resources/DWARF") .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1); QVERIFY(regularFileExists(relativeProductBuildDir("app5") + "/app5.dwarf")); QVERIFY(directoryExists(relativeProductBuildDir("foo1") + "/foo1.framework.dSYM")); QVERIFY(regularFileExists(relativeProductBuildDir("foo1") + "/foo1.framework.dSYM/Contents/Info.plist")); QVERIFY(regularFileExists(relativeProductBuildDir("foo1") + "/foo1.framework.dSYM/Contents/Resources/DWARF/foo1")); QCOMPARE(QDir(relativeProductBuildDir("foo1") + "/foo1.framework.dSYM/Contents/Resources/DWARF") .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1); QVERIFY(!QFile::exists(relativeProductBuildDir("foo2") + "/foo2.framework.dSYM")); QVERIFY(!QFile::exists(relativeProductBuildDir("foo3") + "/foo3.framework.dSYM")); if (isMacos) { QVERIFY(regularFileExists(relativeProductBuildDir("foo3") + "/foo3.framework/Versions/A/foo3.dwarf")); } else { QVERIFY(regularFileExists(relativeProductBuildDir("foo3") + "/foo3.framework/foo3.dwarf")); } QVERIFY(directoryExists(relativeProductBuildDir("foo4") + "/libfoo4.dylib.dSYM")); QVERIFY(regularFileExists(relativeProductBuildDir("foo4") + "/libfoo4.dylib.dSYM/Contents/Info.plist")); QVERIFY(regularFileExists(relativeProductBuildDir("foo4") + "/libfoo4.dylib.dSYM/Contents/Resources/DWARF/libfoo4.dylib")); QCOMPARE(QDir(relativeProductBuildDir("foo4") + "/libfoo4.dylib.dSYM/Contents/Resources/DWARF") .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1); QVERIFY(regularFileExists(relativeProductBuildDir("foo5") + "/libfoo5.dylib.dwarf")); QVERIFY(directoryExists(relativeProductBuildDir("bar1") + "/bar1.bundle.dSYM")); QVERIFY(regularFileExists(relativeProductBuildDir("bar1") + "/bar1.bundle.dSYM/Contents/Info.plist")); QVERIFY(regularFileExists(relativeProductBuildDir("bar1") + "/bar1.bundle.dSYM/Contents/Resources/DWARF/bar1")); QCOMPARE(QDir(relativeProductBuildDir("bar1") + "/bar1.bundle.dSYM/Contents/Resources/DWARF") .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1); QVERIFY(!QFile::exists(relativeProductBuildDir("bar2") + "/bar2.bundle.dSYM")); QVERIFY(!QFile::exists(relativeProductBuildDir("bar3") + "/bar3.bundle.dSYM")); if (isMacos) { QVERIFY(regularFileExists(relativeProductBuildDir("bar3") + "/bar3.bundle/Contents/MacOS/bar3.dwarf")); } else { QVERIFY(regularFileExists(relativeProductBuildDir("bar3") + "/bar3.bundle/bar3.dwarf")); } QVERIFY(directoryExists(relativeProductBuildDir("bar4") + "/bar4.bundle.dSYM")); QVERIFY(regularFileExists(relativeProductBuildDir("bar4") + "/bar4.bundle.dSYM/Contents/Info.plist")); QVERIFY(regularFileExists(relativeProductBuildDir("bar4") + "/bar4.bundle.dSYM/Contents/Resources/DWARF/bar4.bundle")); QCOMPARE(QDir(relativeProductBuildDir("bar4") + "/bar4.bundle.dSYM/Contents/Resources/DWARF") .entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).size(), 1); QVERIFY(regularFileExists(relativeProductBuildDir("bar5") + "/bar5.bundle.dwarf")); } else if (isGcc && isNotEmscripten) { const QString exeSuffix = isWindows ? ".exe" : ""; const QString dllPrefix = isWindows ? "" : "lib"; const QString dllSuffix = isWindows ? ".dll" : ".so"; QVERIFY(QFile::exists(relativeProductBuildDir("app1") + "/app1" + exeSuffix + ".debug")); QVERIFY(!QFile::exists(relativeProductBuildDir("app2") + "/app2" + exeSuffix + ".debug")); QVERIFY(QFile::exists(relativeProductBuildDir("foo1") + '/' + dllPrefix + "foo1" + dllSuffix + ".debug")); QVERIFY(!QFile::exists(relativeProductBuildDir("foo2") + '/' + "foo2" + dllSuffix + ".debug")); QVERIFY(QFile::exists(relativeProductBuildDir("bar1") + '/' + dllPrefix + "bar1" + dllSuffix + ".debug")); QVERIFY(!QFile::exists(relativeProductBuildDir("bar2") + '/' + dllPrefix + "bar2" + dllSuffix + ".debug")); } else if (isEmscripten) { QVERIFY(QFile::exists(relativeProductBuildDir("app1") + "/app1.wasm.debug.wasm")); QVERIFY(!QFile::exists(relativeProductBuildDir("app2") + "/app2.wasm.debug.wasm")); } else if (isMsvc) { QVERIFY(QFile::exists(relativeProductBuildDir("app1") + "/app1.pdb")); QVERIFY(QFile::exists(relativeProductBuildDir("foo1") + "/foo1.pdb")); QVERIFY(QFile::exists(relativeProductBuildDir("bar1") + "/bar1.pdb")); // MSVC's linker even creates a pdb file if /Z7 is passed to the compiler. } else { QSKIP("Unsupported toolchain. Skipping."); } } void TestBlackbox::trackAddFile() { QList output; QDir::setCurrent(testDataDir + "/trackAddFile"); if (QFile::exists("work")) rmDirR("work"); QDir().mkdir("work"); ccp("before", "work"); QDir::setCurrent(testDataDir + "/trackAddFile/work"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); const QString objectSuffix = parsedObjectSuffix(m_qbsStdout); const QbsRunParameters runParams("run", QStringList{"-qp", "someapp"}); QCOMPARE(runQbs(runParams), 0); output = m_qbsStdout.split('\n'); QCOMPARE(output.takeFirst().trimmed().constData(), "Hello World!"); QCOMPARE(output.takeFirst().trimmed().constData(), "NARF!"); QString unchangedObjectFile = relativeBuildDir() + "/someapp/narf.cpp" + objectSuffix; QDateTime unchangedObjectFileTime1 = QFileInfo(unchangedObjectFile).lastModified(); WAIT_FOR_NEW_TIMESTAMP(); ccp("../after", "."); touch("trackAddFile.qbs"); touch("main.cpp"); QCOMPARE(runQbs(runParams), 0); output = m_qbsStdout.split('\n'); QCOMPARE(output.takeFirst().trimmed().constData(), "Hello World!"); QCOMPARE(output.takeFirst().trimmed().constData(), "NARF!"); QCOMPARE(output.takeFirst().trimmed().constData(), "ZORT!"); // the object file of the untouched source should not have changed QDateTime unchangedObjectFileTime2 = QFileInfo(unchangedObjectFile).lastModified(); QCOMPARE(unchangedObjectFileTime1, unchangedObjectFileTime2); } void TestBlackbox::trackExternalProductChanges() { QDir::setCurrent(testDataDir + "/trackExternalProductChanges"); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("compiling main.cpp")); QVERIFY(!m_qbsStdout.contains("compiling environmentChange.cpp")); QVERIFY(!m_qbsStdout.contains("compiling jsFileChange.cpp")); QVERIFY(!m_qbsStdout.contains("compiling fileExists.cpp")); QVERIFY2( m_qbsStdout.contains("[trackExternalProductChanges] installing "), m_qbsStdout.constData()); const bool isGcc = m_qbsStdout.contains("is gcc: true"); const bool isNotGcc = m_qbsStdout.contains("is gcc: false"); QbsRunParameters params; params.environment.insert("QBS_TEST_PULL_IN_FILE_VIA_ENV", "1"); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling main.cpp")); QVERIFY(!m_qbsStdout.contains("compiling environmentChange.cpp")); QVERIFY(!m_qbsStdout.contains("compiling jsFileChange.cpp")); QVERIFY(!m_qbsStdout.contains("compiling fileExists.cpp")); QVERIFY2(!m_qbsStdout.contains("Installing"), m_qbsStdout.constData()); params.command = "resolve"; QCOMPARE(runQbs(params), 0); params.command = "build"; QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling main.cpp")); QVERIFY(m_qbsStdout.contains("compiling environmentChange.cpp")); QVERIFY2(!m_qbsStdout.contains("compiling jsFileChange.cpp"), m_qbsStdout.constData()); QVERIFY(!m_qbsStdout.contains("compiling fileExists.cpp")); QVERIFY2( m_qbsStdout.contains("[trackExternalProductChanges] installing "), m_qbsStdout.constData()); rmDirR(relativeBuildDir()); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("compiling main.cpp")); QVERIFY(!m_qbsStdout.contains("compiling environmentChange.cpp")); QVERIFY(!m_qbsStdout.contains("compiling jsFileChange.cpp")); QVERIFY(!m_qbsStdout.contains("compiling fileExists.cpp")); QVERIFY2( m_qbsStdout.contains("[trackExternalProductChanges] installing "), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("fileList.js", "return []", "return ['jsFileChange.cpp']"); QCOMPARE(runQbs(), 0); QVERIFY(!m_qbsStdout.contains("compiling main.cpp")); QVERIFY(!m_qbsStdout.contains("compiling environmentChange.cpp")); QVERIFY(m_qbsStdout.contains("compiling jsFileChange.cpp")); QVERIFY(!m_qbsStdout.contains("compiling fileExists.cpp")); QVERIFY2( m_qbsStdout.contains("[trackExternalProductChanges] installing "), m_qbsStdout.constData()); rmDirR(relativeBuildDir()); REPLACE_IN_FILE("fileList.js", "['jsFileChange.cpp']", "[]"); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("compiling main.cpp")); QVERIFY(!m_qbsStdout.contains("compiling environmentChange.cpp")); QVERIFY(!m_qbsStdout.contains("compiling jsFileChange.cpp")); QVERIFY(!m_qbsStdout.contains("compiling fileExists.cpp")); QVERIFY2( m_qbsStdout.contains("[trackExternalProductChanges] installing "), m_qbsStdout.constData()); QFile cppFile("fileExists.cpp"); QVERIFY(cppFile.open(QIODevice::WriteOnly)); cppFile.write("void fileExists() { }\n"); cppFile.close(); QCOMPARE(runQbs(), 0); QVERIFY(!m_qbsStdout.contains("compiling main.cpp")); QVERIFY(!m_qbsStdout.contains("compiling environmentChange.cpp")); QVERIFY(!m_qbsStdout.contains("compiling jsFileChange.cpp")); QVERIFY(m_qbsStdout.contains("compiling fileExists.cpp")); QVERIFY2( m_qbsStdout.contains("[trackExternalProductChanges] installing "), m_qbsStdout.constData()); if (isNotGcc) QSKIP("The remainder of this test requires a GCC-like toolchain"); QVERIFY(isGcc); rmDirR(relativeBuildDir()); params.environment = QbsRunParameters::defaultEnvironment(); params.environment.insert("INCLUDE_PATH_TEST", "1"); params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("hiddenheaderqbs.h"), m_qbsStderr.constData()); params.command = "resolve"; params.environment.insert("CPLUS_INCLUDE_PATH", QDir::toNativeSeparators(QDir::currentPath() + "/hidden")); params.expectFailure = false; QCOMPARE(runQbs(params), 0); params.command = "build"; QCOMPARE(runQbs(params), 0); } void TestBlackbox::trackGroupConditionChange() { QbsRunParameters params; params.expectFailure = true; QDir::setCurrent(testDataDir + "/group-condition-change"); QVERIFY(runQbs(params) != 0); QVERIFY(m_qbsStderr.contains("jibbetnich")); params.command = "resolve"; params.arguments = QStringList("project.kaputt:false"); params.expectFailure = false; QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); } void TestBlackbox::trackRemoveFile() { QDir::setCurrent(testDataDir + "/trackAddFile"); if (QFile::exists("work")) rmDirR("work"); QDir().mkdir("work"); ccp("before", "work"); ccp("after", "work"); QDir::setCurrent(testDataDir + "/trackAddFile/work"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); const QbsRunParameters runParams("run", QStringList{"-qp", "someapp"}); QCOMPARE(runQbs(runParams), 0); const QString objectSuffix = parsedObjectSuffix(m_qbsStdout); QList output = m_qbsStdout.split('\n'); QCOMPARE(output.takeFirst().trimmed().constData(), "Hello World!"); QCOMPARE(output.takeFirst().trimmed().constData(), "NARF!"); QCOMPARE(output.takeFirst().trimmed().constData(), "ZORT!"); QString unchangedObjectFile = relativeBuildDir() + "/someapp/narf.cpp" + objectSuffix; QDateTime unchangedObjectFileTime1 = QFileInfo(unchangedObjectFile).lastModified(); WAIT_FOR_NEW_TIMESTAMP(); QFile::remove("trackAddFile.qbs"); QFile::remove("main.cpp"); QFile::copy("../before/trackAddFile.qbs", "trackAddFile.qbs"); QFile::copy("../before/main.cpp", "main.cpp"); QVERIFY(QFile::remove("zort.h")); QVERIFY(QFile::remove("zort.cpp")); QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("resolve"))), 0); touch("main.cpp"); touch("trackAddFile.qbs"); QCOMPARE(runQbs(runParams), 0); output = m_qbsStdout.split('\n'); QCOMPARE(output.takeFirst().trimmed().constData(), "Hello World!"); QCOMPARE(output.takeFirst().trimmed().constData(), "NARF!"); // the object file of the untouched source should not have changed QDateTime unchangedObjectFileTime2 = QFileInfo(unchangedObjectFile).lastModified(); QCOMPARE(unchangedObjectFileTime1, unchangedObjectFileTime2); // the object file for the removed cpp file should have vanished too QVERIFY(!regularFileExists(relativeBuildDir() + "/someapp/zort.cpp" + objectSuffix)); } void TestBlackbox::trackAddFileTag() { QList output; QDir::setCurrent(testDataDir + "/trackFileTags"); if (QFile::exists("work")) rmDirR("work"); QDir().mkdir("work"); ccp("before", "work"); QDir::setCurrent(testDataDir + "/trackFileTags/work"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); const QbsRunParameters runParams("run", QStringList{"-qp", "someapp"}); QCOMPARE(runQbs(runParams), 0); output = m_qbsStdout.split('\n'); QCOMPARE(output.takeFirst().trimmed().constData(), "there's no foo here"); WAIT_FOR_NEW_TIMESTAMP(); ccp("../after", "."); touch("main.cpp"); touch("trackFileTags.qbs"); waitForFileUnlock(); QCOMPARE(runQbs(runParams), 0); output = m_qbsStdout.split('\n'); QCOMPARE(output.takeFirst().trimmed().constData(), "there's 15 foo here"); } void TestBlackbox::trackRemoveFileTag() { QDir::setCurrent(testDataDir + "/trackFileTags"); if (QFile::exists("work")) rmDirR("work"); QDir().mkdir("work"); ccp("after", "work"); QDir::setCurrent(testDataDir + "/trackFileTags/work"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); const QString objectSuffix = parsedObjectSuffix(m_qbsStdout); const QbsRunParameters runParams("run", QStringList{"-qp", "someapp"}); QCOMPARE(runQbs(runParams), 0); // check if the artifacts are here that will become stale in the 2nd step QVERIFY(regularFileExists( relativeProductBuildDir("someapp") + '/' + inputDirHash(".") + "/main_foo.cpp" + objectSuffix)); QVERIFY(regularFileExists(relativeProductBuildDir("someapp") + "/main_foo.cpp")); QVERIFY(regularFileExists(relativeProductBuildDir("someapp") + "/main.foo")); QList output = m_qbsStdout.split('\n'); QCOMPARE(output.takeFirst().trimmed().constData(), "there's 15 foo here"); WAIT_FOR_NEW_TIMESTAMP(); ccp("../before", "."); touch("main.cpp"); touch("trackFileTags.qbs"); QCOMPARE(runQbs(runParams), 0); output = m_qbsStdout.split('\n'); QVERIFY(!output.isEmpty()); QCOMPARE(output.takeFirst().trimmed().constData(), "there's no foo here"); // check if stale artifacts have been removed QCOMPARE( regularFileExists( relativeProductBuildDir("someapp") + '/' + inputDirHash(".") + "/main_foo.cpp" + objectSuffix), false); QCOMPARE(regularFileExists(relativeProductBuildDir("someapp") + "/main_foo.cpp"), false); QCOMPARE(regularFileExists(relativeProductBuildDir("someapp") + "/main.foo"), false); } void TestBlackbox::trackAddProduct() { QDir::setCurrent(testDataDir + "/trackProducts"); if (QFile::exists("work")) rmDirR("work"); QDir().mkdir("work"); ccp("before", "work"); QDir::setCurrent(testDataDir + "/trackProducts/work"); QbsRunParameters params(QStringList() << "-f" << "trackProducts.qbs"); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("compiling foo.cpp")); QVERIFY(m_qbsStdout.contains("compiling bar.cpp")); QVERIFY(m_qbsStdout.contains("linking product1")); QVERIFY(m_qbsStdout.contains("linking product2")); WAIT_FOR_NEW_TIMESTAMP(); ccp("../after", "."); touch("trackProducts.qbs"); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("compiling zoo.cpp")); QVERIFY(m_qbsStdout.contains("linking product3")); QVERIFY(!m_qbsStdout.contains("compiling foo.cpp")); QVERIFY(!m_qbsStdout.contains("compiling bar.cpp")); QVERIFY(!m_qbsStdout.contains("linking product1")); QVERIFY(!m_qbsStdout.contains("linking product2")); } void TestBlackbox::trackRemoveProduct() { QDir::setCurrent(testDataDir + "/trackProducts"); if (QFile::exists("work")) rmDirR("work"); QDir().mkdir("work"); ccp("before", "work"); ccp("after", "work"); QDir::setCurrent(testDataDir + "/trackProducts/work"); QbsRunParameters params(QStringList() << "-f" << "trackProducts.qbs"); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("compiling foo.cpp")); QVERIFY(m_qbsStdout.contains("compiling bar.cpp")); QVERIFY(m_qbsStdout.contains("compiling zoo.cpp")); QVERIFY(m_qbsStdout.contains("linking product1")); QVERIFY(m_qbsStdout.contains("linking product2")); QVERIFY(m_qbsStdout.contains("linking product3")); WAIT_FOR_NEW_TIMESTAMP(); QFile::remove("zoo.cpp"); QFile::remove("product3.qbs"); copyFileAndUpdateTimestamp("../before/trackProducts.qbs", "trackProducts.qbs"); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling foo.cpp")); QVERIFY(!m_qbsStdout.contains("compiling bar.cpp")); QVERIFY(!m_qbsStdout.contains("compiling zoo.cpp")); QVERIFY(!m_qbsStdout.contains("linking product1")); QVERIFY(!m_qbsStdout.contains("linking product2")); QVERIFY(!m_qbsStdout.contains("linking product3")); } void TestBlackbox::wildcardRenaming() { QDir::setCurrent(testDataDir + "/wildcard_renaming"); QCOMPARE(runQbs(QbsRunParameters("install")), 0); QVERIFY(QFileInfo(defaultInstallRoot + "/pioniere.txt").exists()); WAIT_FOR_NEW_TIMESTAMP(); QFile::rename(QDir::currentPath() + "/pioniere.txt", QDir::currentPath() + "/fdj.txt"); QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("install"), QStringList("--clean-install-root"))), 0); QVERIFY(!QFileInfo(defaultInstallRoot + "/pioniere.txt").exists()); QVERIFY(QFileInfo(defaultInstallRoot + "/fdj.txt").exists()); } void TestBlackbox::recursiveRenaming() { QDir::setCurrent(testDataDir + "/recursive_renaming"); QCOMPARE(runQbs(QbsRunParameters("install")), 0); QVERIFY(QFileInfo(defaultInstallRoot + "/dir/wasser.txt").exists()); QVERIFY(QFileInfo(defaultInstallRoot + "/dir/subdir/blubb.txt").exists()); WAIT_FOR_NEW_TIMESTAMP(); QVERIFY(QFile::rename(QDir::currentPath() + "/dir/wasser.txt", QDir::currentPath() + "/dir/wein.txt")); QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("install"), QStringList("--clean-install-root"))), 0); QVERIFY(!QFileInfo(defaultInstallRoot + "/dir/wasser.txt").exists()); QVERIFY(QFileInfo(defaultInstallRoot + "/dir/wein.txt").exists()); QVERIFY(QFileInfo(defaultInstallRoot + "/dir/subdir/blubb.txt").exists()); } void TestBlackbox::recursiveWildcards() { QDir::setCurrent(testDataDir + "/recursive_wildcards"); QCOMPARE(runQbs(QbsRunParameters("install")), 0); QVERIFY(QFileInfo(defaultInstallRoot + "/dir/file1.txt").exists()); QVERIFY(QFileInfo(defaultInstallRoot + "/dir/file2.txt").exists()); QFile outputFile(defaultInstallRoot + "/output.txt"); QVERIFY2(outputFile.open(QIODevice::ReadOnly), qPrintable(outputFile.errorString())); QCOMPARE(outputFile.readAll(), QByteArray("file1.txtfile2.txt")); outputFile.close(); WAIT_FOR_NEW_TIMESTAMP(); QFile newFile("dir/subdir/file3.txt"); QVERIFY2(newFile.open(QIODevice::WriteOnly), qPrintable(newFile.errorString())); newFile.close(); QCOMPARE(runQbs(QbsRunParameters("install")), 0); QVERIFY(QFileInfo(defaultInstallRoot + "/dir/file3.txt").exists()); QVERIFY2(outputFile.open(QIODevice::ReadOnly), qPrintable(outputFile.errorString())); QCOMPARE(outputFile.readAll(), QByteArray("file1.txtfile2.txtfile3.txt")); outputFile.close(); WAIT_FOR_NEW_TIMESTAMP(); QVERIFY2(newFile.remove(), qPrintable(newFile.errorString())); QVERIFY2(!newFile.exists(), qPrintable(newFile.fileName())); QCOMPARE(runQbs(QbsRunParameters("install", QStringList{ "--clean-install-root"})), 0); QVERIFY(QFileInfo(defaultInstallRoot + "/dir/file1.txt").exists()); QVERIFY(QFileInfo(defaultInstallRoot + "/dir/file2.txt").exists()); QVERIFY(!QFileInfo(defaultInstallRoot + "/dir/file3.txt").exists()); QVERIFY2(outputFile.open(QIODevice::ReadOnly), qPrintable(outputFile.errorString())); QCOMPARE(outputFile.readAll(), QByteArray("file1.txtfile2.txt")); } void TestBlackbox::referenceErrorInExport() { QDir::setCurrent(testDataDir + "/referenceErrorInExport"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2( m_qbsStderr.contains("referenceErrorInExport.qbs:2:5 Error while handling product " "'referenceErrorInExport':"), m_qbsStderr.constData()); QVERIFY2( m_qbsStderr.contains("referenceErrorInExport.qbs:5:27 While evaluating here"), m_qbsStderr.constData()); QVERIFY2( m_qbsStderr.contains("referenceErrorInExport.qbs:15:31 includePaths is not defined"), m_qbsStderr.constData()); } void TestBlackbox::removeDuplicateLibraries_data() { QTest::addColumn("removeDuplicates"); QTest::newRow("remove duplicates") << true; QTest::newRow("don't remove duplicates") << false; } void TestBlackbox::removeDuplicateLibraries() { QDir::setCurrent(testDataDir + "/remove-duplicate-libs"); QFETCH(bool, removeDuplicates); const QbsRunParameters resolveParams("resolve", {"-f", "remove-duplicate-libs.qbs", "project.removeDuplicates:" + QString(removeDuplicates? "true" : "false")}); QCOMPARE(runQbs(resolveParams), 0); const bool isBfd = m_qbsStdout.contains("is bfd linker: true"); const bool isNotBfd = m_qbsStdout.contains("is bfd linker: false"); QVERIFY2(isBfd != isNotBfd, m_qbsStdout.constData()); QbsRunParameters buildParams("build"); buildParams.expectFailure = removeDuplicates && isBfd; QCOMPARE(runQbs(buildParams) == 0, !buildParams.expectFailure); } void TestBlackbox::reproducibleBuild() { QFETCH(bool, reproducible); QDir::setCurrent(testDataDir + "/reproducible-build"); QbsRunParameters params("resolve"); params.arguments << QString("modules.cpp.enableReproducibleBuilds:") + (reproducible ? "true" : "false"); rmDirR(relativeBuildDir()); QCOMPARE(runQbs(params), 0); const bool isGcc = m_qbsStdout.contains("is gcc: true"); const bool isNotGcc = m_qbsStdout.contains("is gcc: false"); const QString objectSuffix = parsedObjectSuffix(m_qbsStdout); if (isNotGcc) QSKIP("reproducible builds only supported for gcc"); QVERIFY(isGcc); QCOMPARE(runQbs(), 0); QFile object( relativeProductBuildDir("the product") + '/' + inputDirHash(".") + '/' + "file1.cpp" + objectSuffix); QVERIFY2(object.open(QIODevice::ReadOnly), qPrintable(object.fileName())); const QByteArray oldContents = object.readAll(); object.close(); QCOMPARE(runQbs(QbsRunParameters("clean")), 0); QVERIFY(!object.exists()); params.command = "build"; QCOMPARE(runQbs(params), 0); if (reproducible) { QVERIFY(object.open(QIODevice::ReadOnly)); const QByteArray newContents = object.readAll(); QVERIFY(oldContents == newContents); object.close(); } QCOMPARE(runQbs(QbsRunParameters("clean")), 0); } void TestBlackbox::reproducibleBuild_data() { QTest::addColumn("reproducible"); QTest::newRow("non-reproducible build") << false; QTest::newRow("reproducible build") << true; } void TestBlackbox::responseFiles() { QDir::setCurrent(testDataDir + "/response-files"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "install"; params.arguments << "--install-root" << "installed"; QCOMPARE(runQbs(params), 0); QFile file("installed/response-file-content.txt"); QVERIFY(file.open(QIODevice::ReadOnly)); const QList expected = QList() << "foo" << qbs::Internal::shellQuote(QStringLiteral("with space")).toUtf8() << "bar" << ""; QList lines = file.readAll().split('\n'); for (auto &line : lines) line = line.trimmed(); QCOMPARE(lines, expected); } void TestBlackbox::retaggedOutputArtifact() { QDir::setCurrent(testDataDir + "/retagged-output-artifact"); QbsRunParameters resolveParams("resolve"); resolveParams.arguments = QStringList("products.p.useTag1:true"); QCOMPARE(runQbs(resolveParams), 0); QCOMPARE(runQbs(), 0); const QString a2 = relativeProductBuildDir("p") + "/a2.txt"; const QString a3 = relativeProductBuildDir("p") + "/a3.txt"; QVERIFY2(QFile::exists(a2), qPrintable(a2)); QVERIFY2(!QFile::exists(a3), qPrintable(a3)); resolveParams.arguments = QStringList("products.p.useTag1:false"); QCOMPARE(runQbs(resolveParams), 0); QCOMPARE(runQbs(), 0); QVERIFY2(!QFile::exists(a2), qPrintable(a2)); QVERIFY2(QFile::exists(a3), qPrintable(a3)); resolveParams.arguments = QStringList("products.p.useTag1:true"); QCOMPARE(runQbs(resolveParams), 0); QCOMPARE(runQbs(), 0); QVERIFY2(QFile::exists(a2), qPrintable(a2)); QVERIFY2(!QFile::exists(a3), qPrintable(a3)); } void TestBlackbox::rpathlinkDeduplication() { QDir::setCurrent(testDataDir + "/rpathlink-deduplication"); QbsRunParameters resolveParams{"resolve"}; QCOMPARE(runQbs(resolveParams), 0); const bool useRPathLink = m_qbsStdout.contains("useRPathLink: true"); const bool dontUseRPathLink = m_qbsStdout.contains("useRPathLink: false"); QVERIFY2(useRPathLink || dontUseRPathLink, m_qbsStdout); if (dontUseRPathLink) QSKIP("Only applies to toolchains that support rPathLink"); const QString output = QString::fromLocal8Bit(m_qbsStdout); const QRegularExpression pattern(QRegularExpression::anchoredPattern(".*===(.*)===.*"), QRegularExpression::DotMatchesEverythingOption); const QRegularExpressionMatch match = pattern.match(output); QVERIFY2(match.hasMatch(), qPrintable(output)); QCOMPARE(pattern.captureCount(), 1); const QString linkFlag = match.captured(1); QbsRunParameters buildParams; buildParams.arguments = QStringList({"--command-echo-mode", "command-line"}); QCOMPARE(runQbs(buildParams), 0); // private DynamicLibraryA is a dependency for 2 other libs but should only appear once const auto libDir = QFileInfo(relativeProductBuildDir("DynamicLibraryA")).absoluteFilePath(); QCOMPARE(m_qbsStdout.count((linkFlag + libDir).toUtf8()), 1); } void TestBlackbox::ruleConditions_data() { QTest::addColumn("enableGroup"); QTest::addColumn("enableRule"); QTest::addColumn("enableTagger"); QTest::addColumn("fileShouldExist"); QTest::newRow("all off") << false << false << false << false; QTest::newRow("group off, rule off, tagger on") << false << false << true << false; QTest::newRow("group off, rule on, tagger off") << false << true << false << false; QTest::newRow("group off, rule on, tagger on") << false << true << true << false; QTest::newRow("group on, rule off, tagger off") << true << false << false << false; QTest::newRow("group on, rule off, tagger on") << true << false << true << false; QTest::newRow("group on, rule on, tagger off") << true << true << false << false; QTest::newRow("all on") << true << true << true << true; } void TestBlackbox::ruleConditions() { QFETCH(bool, enableGroup); QFETCH(bool, enableRule); QFETCH(bool, enableTagger); QFETCH(bool, fileShouldExist); QDir::setCurrent(testDataDir + "/ruleConditions"); rmDirR(relativeBuildDir()); static const auto b2s = [](bool b) { return QString(b ? "true" : "false"); }; const QStringList args{ "modules.narfzort.enableGroup:" + b2s(enableGroup), "modules.narfzort.enableRule:" + b2s(enableRule), "modules.narfzort.enableTagger:" + b2s(enableTagger)}; QCOMPARE(runQbs(args), 0); QVERIFY(QFileInfo(relativeExecutableFilePath("ruleConditions", m_qbsStdout)).exists()); QCOMPARE( QFileInfo(relativeProductBuildDir("ruleConditions") + "/ruleConditions.foo.narf.zort") .exists(), fileShouldExist); } void TestBlackbox::ruleConnectionWithExcludedInputs() { QDir::setCurrent(testDataDir + "/rule-connection-with-excluded-inputs"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("inputs.x: 2") && m_qbsStdout.contains("inputs.y: 0"), m_qbsStdout.constData()); } void TestBlackbox::ruleCycle() { QDir::setCurrent(testDataDir + "/ruleCycle"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY(m_qbsStderr.contains("Cycle detected in rule dependencies")); } void TestBlackbox::ruleWithNoInputs() { QDir::setCurrent(testDataDir + "/rule-with-no-inputs"); QVERIFY2(runQbs() == 0, m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("running the rule"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("creating output"), m_qbsStdout.constData()); QVERIFY2(runQbs() == 0, m_qbsStderr.constData()); QVERIFY2(!m_qbsStdout.contains("running the rule"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating output"), m_qbsStdout.constData()); QbsRunParameters params("resolve", QStringList() << "products.theProduct.version:1"); QVERIFY2(runQbs(params) == 0, m_qbsStderr.constData()); params.command = "build"; QVERIFY2(runQbs(params) == 0, m_qbsStderr.constData()); QVERIFY2(!m_qbsStdout.contains("running the rule"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating output"), m_qbsStdout.constData()); params.command = "resolve"; params.arguments = QStringList() << "products.theProduct.version:2"; QVERIFY2(runQbs(params) == 0, m_qbsStderr.constData()); params.command = "build"; QVERIFY2(runQbs(params) == 0, m_qbsStderr.constData()); QVERIFY2(!m_qbsStdout.contains("running the rule"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("creating output"), m_qbsStdout.constData()); params.command = "resolve"; params.arguments = QStringList() << "products.theProduct.version:2" << "products.theProduct.dummy:true"; QVERIFY2(runQbs(params) == 0, m_qbsStderr.constData()); params.command = "build"; QVERIFY2(runQbs(params) == 0, m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("running the rule"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating output"), m_qbsStdout.constData()); } void TestBlackbox::ruleWithNonRequiredInputs() { QDir::setCurrent(testDataDir + "/rule-with-non-required-inputs"); QbsRunParameters params("build", {"products.p.enableTagger:false"}); QCOMPARE(runQbs(params), 0); QFile outFile(relativeProductBuildDir("p") + "/output.txt"); QVERIFY2(outFile.open(QIODevice::ReadOnly), qPrintable(outFile.errorString())); QByteArray output = outFile.readAll(); QCOMPARE(output, QByteArray("()")); outFile.close(); params.command = "resolve"; params.arguments = QStringList({"products.p.enableTagger:true"}); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY2(outFile.open(QIODevice::ReadOnly), qPrintable(outFile.errorString())); output = outFile.readAll(); QCOMPARE(output, QByteArray("(a.inp,b.inp,c.inp,)")); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("generating"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("a.inp"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("generating"), m_qbsStdout.constData()); } void TestBlackbox::runMultiplexed() { QDir::setCurrent(testDataDir + "/run-multiplexed"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params("run"); params.expectFailure = true; QVERIFY(runQbs(params) != 0); params.arguments = QStringList{"-p", "app"}; QVERIFY(runQbs(params) != 0); params.expectFailure = false; params.arguments.last() = "app {\"buildVariant\":\"debug\"}"; QCOMPARE(runQbs(params), 0); params.arguments.last() = "app {\"buildVariant\":\"release\"}"; QCOMPARE(runQbs(params), 0); } void TestBlackbox::sanitizer_data() { QTest::addColumn("sanitizer"); QTest::newRow("none") << QString(); QTest::newRow("address") << QStringLiteral("address"); QTest::newRow("undefined") << QStringLiteral("undefined"); QTest::newRow("thread") << QStringLiteral("thread"); } void TestBlackbox::sanitizer() { QFETCH(QString, sanitizer); QDir::setCurrent(testDataDir + "/sanitizer"); rmDirR(relativeBuildDir()); QbsRunParameters params("build", {"--command-echo-mode", "command-line"}); if (!sanitizer.isEmpty()) { params.arguments.append( {QStringLiteral("products.sanitizer.sanitizer:\"") + sanitizer + "\""}); } QCOMPARE(runQbs(params), 0); if (m_qbsStdout.contains(QByteArrayLiteral("Compiler does not support sanitizer"))) QSKIP("Compiler does not support the specified sanitizer"); if (!sanitizer.isEmpty()) { QVERIFY2(m_qbsStdout.contains(QByteArrayLiteral("fsanitize=") + sanitizer.toLatin1()), qPrintable(m_qbsStdout)); } else { QVERIFY2(!m_qbsStdout.contains(QByteArrayLiteral("fsanitize=")), qPrintable(m_qbsStdout)); } } void TestBlackbox::scannerItem_data() { QTest::addColumn("inProduct"); QTest::addColumn("inModule"); QTest::addColumn("enableGroup"); QTest::addColumn("successExpected"); QTest::newRow("all off") << false << false << false << false; QTest::newRow("product scanner") << true << false << false << true; QTest::newRow("module scanner, group off") << false << true << false << false; QTest::newRow("module scanner, group on") << false << true << true << true; } void TestBlackbox::scannerItem() { QFETCH(bool, inProduct); QFETCH(bool, inModule); QFETCH(bool, enableGroup); QFETCH(bool, successExpected); static const auto b2s = [](bool b) { return QString(b ? "true" : "false"); }; QDir::setCurrent(testDataDir + "/scanner-item"); rmDirR(relativeBuildDir()); const QbsRunParameters params( {"-f", "scanner-item.qbs", "products.scanner-item.productScanner:" + b2s(inProduct), "products.scanner-item.moduleScanner:" + b2s(inModule), "products.scanner-item.enableGroup:" + b2s(enableGroup)}); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("handling file1.in"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("handling file2.in"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("subdir1/file.inc"); QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStdout.contains("handling file1.in"), successExpected); QVERIFY2(!m_qbsStdout.contains("handling file2.in"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("subdir2/file.inc"); QCOMPARE(runQbs(params), 0); QVERIFY2(!m_qbsStdout.contains("handling file1.in"), m_qbsStdout.constData()); QCOMPARE(m_qbsStdout.contains("handling file2.in"), successExpected); } void TestBlackbox::scanResultInOtherProduct() { QDir::setCurrent(testDataDir + "/scan-result-in-other-product"); QCOMPARE(runQbs(QStringList("-vv")), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("generating text file"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStderr.contains("The file dependency might get lost during change tracking"), m_qbsStderr.constData()); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("other/other.qbs", "blubb", "blubb2"); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("generating text file"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("lib/lib.h"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("generating text file"), m_qbsStdout.constData()); } void TestBlackbox::scanResultInNonDependency() { QDir::setCurrent(testDataDir + "/scan-result-in-non-dependency"); QCOMPARE(runQbs(QStringList("-vv")), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("generating text file"), m_qbsStdout.constData()); QVERIFY2(m_qbsStderr.contains("The file dependency might get lost during change tracking"), m_qbsStderr.constData()); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("other/other.qbs", "blubb", "blubb2"); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("generating text file"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("lib/lib.h"); QCOMPARE(runQbs(), 0); QEXPECT_FAIL("", "QBS-1532", Continue); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("generating text file"), m_qbsStdout.constData()); } void TestBlackbox::setupBuildEnvironment() { QDir::setCurrent(testDataDir + "/setup-build-environment"); QCOMPARE(runQbs(), 0); QFile f(relativeProductBuildDir("first_product") + QLatin1String("/m.output")); QVERIFY2(f.open(QIODevice::ReadOnly), qPrintable(f.errorString())); QCOMPARE(f.readAll().trimmed(), QByteArray("1")); f.close(); f.setFileName(relativeProductBuildDir("second_product") + QLatin1String("/m.output")); QVERIFY2(f.open(QIODevice::ReadOnly), qPrintable(f.errorString())); QCOMPARE(f.readAll().trimmed(), QByteArray()); } void TestBlackbox::setupRunEnvironment() { QDir::setCurrent(testDataDir + "/setup-run-environment"); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); const QString appFilePath = QDir::currentPath() + "/dryrun/" + relativeExecutableFilePath("app", m_qbsStdout); QbsRunParameters failParams("run", QStringList({"--setup-run-env-config", "ignore-lib-dependencies"})); failParams.expectFailure = true; failParams.expectCrash = m_qbsStdout.contains("is windows"); QVERIFY(runQbs(QbsRunParameters(failParams)) != 0); QVERIFY2(failParams.expectCrash || m_qbsStderr.contains("lib"), m_qbsStderr.constData()); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QbsRunParameters dryRunParams("run", QStringList("--dry-run")); dryRunParams.buildDirectory = "dryrun"; QCOMPARE(runQbs(dryRunParams), 0); QVERIFY2(m_qbsStdout.contains("Would start target") && m_qbsStdout.contains(QDir::toNativeSeparators(appFilePath).toLocal8Bit()), m_qbsStdout.constData()); } void TestBlackbox::staticLibDeps() { QFETCH(bool, withExport); QFETCH(bool, importPrivateLibraries); QFETCH(bool, successExpected); QDir::setCurrent(testDataDir + "/static-lib-deps"); rmDirR(relativeBuildDir()); QStringList args{ QStringLiteral("project.useExport:%1").arg(withExport ? "true" : "false"), QStringLiteral("modules.cpp.importPrivateLibraries:%1") .arg(importPrivateLibraries ? "true" : "false")}; QbsRunParameters params(args); params.expectFailure = !successExpected; QCOMPARE(runQbs(params) == 0, successExpected); } void TestBlackbox::staticLibDeps_data() { QTest::addColumn("withExport"); QTest::addColumn("importPrivateLibraries"); QTest::addColumn("successExpected"); QTest::newRow("no Export, with import") << false << true << true; QTest::newRow("no Export, no import") << false << false << false; QTest::newRow("with Export, with import") << true << true << true; QTest::newRow("with Export, no import") << true << false << true; } void TestBlackbox::objectLibDeps() { QFETCH(bool, withExport); QFETCH(bool, importPrivateLibraries); QFETCH(bool, successExpected); QDir::setCurrent(testDataDir + "/object-lib-deps"); rmDirR(relativeBuildDir()); QStringList args{ QStringLiteral("project.useExport:%1").arg(withExport ? "true" : "false"), QStringLiteral("modules.cpp.importPrivateLibraries:%1") .arg(importPrivateLibraries ? "true" : "false")}; QbsRunParameters params(args); params.expectFailure = !successExpected; QCOMPARE(runQbs(params) == 0, successExpected); } void TestBlackbox::objectLibDeps_data() { return staticLibDeps_data(); } void TestBlackbox::rpathLink() { QDir::setCurrent(testDataDir + "/rpath-link"); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); const bool isUnixGcc = m_qbsStdout.contains("is gcc on unix: true"); const bool isNotUnixGcc = m_qbsStdout.contains("is gcc on unix: false"); QCOMPARE(isUnixGcc, !isNotUnixGcc); if (isNotUnixGcc) QSKIP("only applies with gcc on unix systems"); // First build and install the libs QCOMPARE(runQbs(), 0); // Now that the libs are installed, resolve with consumer. QCOMPARE(runQbs(QbsRunParameters("resolve", {"project.enableConsumer:true"})), 0); // Building should fail initially, as the indirect dependency's location is not specified. QbsRunParameters failParams; failParams.expectFailure = true; QVERIFY(runQbs(failParams) != 0); QVERIFY2(m_qbsStderr.contains("needed by"), m_qbsStderr.constData()); // Now add the rpath-link and expect success. QCOMPARE( runQbs(QbsRunParameters( "resolve", {"project.enableConsumer:true", "project.enableRPathLink:true"})), 0); QCOMPARE(runQbs(), 0); } void TestBlackbox::smartRelinking() { QDir::setCurrent(testDataDir + "/smart-relinking"); rmDirR(relativeBuildDir()); QFETCH(bool, strictChecking); QbsRunParameters params(QStringList() << (QString("modules.cpp.exportedSymbolsCheckMode:%1") .arg(strictChecking ? "strict" : "ignore-undefined"))); QCOMPARE(runQbs(params), 0); if (m_qbsStdout.contains("project disabled")) QSKIP("Test does not apply on this target"); QVERIFY2(m_qbsStdout.contains("linking lib"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("linking app"), m_qbsStdout.constData()); // Irrelevant change. WAIT_FOR_NEW_TIMESTAMP(); touch("lib.cpp"); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("linking lib"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("linking app"), m_qbsStdout.constData()); // Add new private symbol. WAIT_FOR_NEW_TIMESTAMP(); params.command = "resolve"; params.arguments << "products.lib.defines:PRIV2"; QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("linking lib"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("linking app"), m_qbsStdout.constData()); // Remove private symbol. WAIT_FOR_NEW_TIMESTAMP(); params.arguments.removeLast(); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("linking lib"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("linking app"), m_qbsStdout.constData()); // Add new public symbol. WAIT_FOR_NEW_TIMESTAMP(); params.arguments << "products.lib.defines:PUB2"; QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("linking lib"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("linking app"), m_qbsStdout.constData()); // Remove public symbol. WAIT_FOR_NEW_TIMESTAMP(); params.arguments.removeLast(); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("linking lib"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("linking app"), m_qbsStdout.constData()); // Add new undefined symbol. WAIT_FOR_NEW_TIMESTAMP(); params.arguments << "products.lib.defines:PRINTF"; QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("linking lib"), m_qbsStdout.constData()); QVERIFY2(strictChecking == m_qbsStdout.contains("linking app"), m_qbsStdout.constData()); // Remove undefined symbol. WAIT_FOR_NEW_TIMESTAMP(); params.arguments.removeLast(); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("linking lib"), m_qbsStdout.constData()); QVERIFY2(strictChecking == m_qbsStdout.contains("linking app"), m_qbsStdout.constData()); } void TestBlackbox::smartRelinking_data() { QTest::addColumn("strictChecking"); QTest::newRow("strict checking") << true; QTest::newRow("ignore undefined") << false; } static QString soName(const QString &readElfPath, const QString &libFilePath) { QProcess readElf; auto env = QProcessEnvironment::systemEnvironment(); env.insert(QStringLiteral("LC_ALL"), QStringLiteral("C")); // force readelf to use US encoding readElf.setProcessEnvironment(env); readElf.start(readElfPath, QStringList() << "-a" << libFilePath); if (!readElf.waitForStarted() || !readElf.waitForFinished() || readElf.exitCode() != 0) { qDebug() << readElf.errorString() << readElf.readAllStandardError(); return {}; } const QByteArray output = readElf.readAllStandardOutput(); const QByteArray magicString = "Library soname: ["; const int magicStringIndex = output.indexOf(magicString); if (magicStringIndex == -1) return {}; const int endIndex = output.indexOf(']', magicStringIndex); if (endIndex == -1) return {}; const int nameIndex = magicStringIndex + magicString.size(); const QByteArray theName = output.mid(nameIndex, endIndex - nameIndex); return QString::fromLatin1(theName); } void TestBlackbox::soVersion() { const QString readElfPath = findExecutable(QStringList("readelf")); if (readElfPath.isEmpty() || readElfPath.endsWith("exe")) QSKIP("soversion test not applicable on this system"); QDir::setCurrent(testDataDir + "/soversion"); QFETCH(QString, soVersion); QFETCH(bool, useVersion); QFETCH(QString, expectedSoName); QbsRunParameters params; params.arguments << ("products.mylib.useVersion:" + QString((useVersion ? "true" : "false"))); if (!soVersion.isNull()) params.arguments << ("modules.cpp.soVersion:" + soVersion); const QString libFilePath = relativeProductBuildDir("mylib") + "/libmylib.so" + (useVersion ? ".1.2.3" : QString()); rmDirR(relativeBuildDir()); const bool success = runQbs(params) == 0; QVERIFY(success); QVERIFY2(regularFileExists(libFilePath), qPrintable(libFilePath)); if (m_qbsStdout.contains("is emscripten: true")) QEXPECT_FAIL(nullptr, "Emscripten does not produce dynamic libraries of elf format", Abort); QCOMPARE(soName(readElfPath, libFilePath), expectedSoName); } void TestBlackbox::soVersion_data() { QTest::addColumn("soVersion"); QTest::addColumn("useVersion"); QTest::addColumn("expectedSoName"); QTest::newRow("default") << QString() << true << QString("libmylib.so.1"); QTest::newRow("explicit soVersion") << QString("1.2") << true << QString("libmylib.so.1.2"); QTest::newRow("empty soVersion") << QString("") << true << QString("libmylib.so.1.2.3"); QTest::newRow("no version, explicit soVersion") << QString("5") << false << QString("libmylib.so.5"); QTest::newRow("no version, default soVersion") << QString() << false << QString("libmylib.so"); QTest::newRow("no version, empty soVersion") << QString("") << false << QString("libmylib.so"); } void TestBlackbox::sourceArtifactChanges() { QDir::setCurrent(testDataDir + "/source-artifact-changes"); bool useCustomFileTags = false; bool overrideFileTags = true; bool filesAreTargets = false; bool useCxx11 = false; static const auto b2s = [](bool b) { return QString(b ? "true" : "false"); }; const auto resolveParams = [&useCustomFileTags, &overrideFileTags, &filesAreTargets, &useCxx11] { return QbsRunParameters("resolve", QStringList{ "modules.module_with_files.overrideTags:" + b2s(overrideFileTags), "modules.module_with_files.filesAreTargets:" + b2s(filesAreTargets), "modules.module_with_files.fileTags:" + QString(useCustomFileTags ? "custom" : "cpp"), "modules.cpp.cxxLanguageVersion:" + QString(useCxx11 ? "c++11" : "c++98") }); }; #define VERIFY_COMPILATION(expected) \ do { \ QVERIFY2(m_qbsStdout.contains("compiling main.cpp") == expected, m_qbsStdout.constData()); \ QVERIFY2(QFile::exists(appFilePath) == expected, qPrintable(appFilePath)); \ if (expected) \ QVERIFY2(m_qbsStdout.contains("cpp artifacts: 1"), m_qbsStdout.constData()); \ else \ QVERIFY2(m_qbsStdout.contains("cpp artifacts: 0"), m_qbsStdout.constData()); \ } while (false) // Initial build. QCOMPARE(runQbs(resolveParams()), 0); QVERIFY2(m_qbsStdout.contains("is gcc: "), m_qbsStdout.constData()); const bool isGcc = m_qbsStdout.contains("is gcc: true"); const QString appFilePath = QDir::currentPath() + '/' + relativeExecutableFilePath("app", m_qbsStdout); QCOMPARE(runQbs(), 0); VERIFY_COMPILATION(true); // Overwrite the file tags. Now the source file is no longer tagged "cpp" and nothing // should get built. WAIT_FOR_NEW_TIMESTAMP(); touch("modules/module_with_files/main.cpp"); useCustomFileTags = true; QCOMPARE(runQbs(resolveParams()), 0); QCOMPARE(runQbs(), 0); VERIFY_COMPILATION(false); // Now the custom file tag exists in addition to "cpp", and the app should get built again. overrideFileTags = false; QCOMPARE(runQbs(resolveParams()), 0); QCOMPARE(runQbs(), 0); VERIFY_COMPILATION(true); // Mark the cpp file as a module target. Now it will no longer be considered an input // by the compiler rule, and nothing should get built. WAIT_FOR_NEW_TIMESTAMP(); touch("modules/module_with_files/main.cpp"); filesAreTargets = true; QCOMPARE(runQbs(resolveParams()), 0); QCOMPARE(runQbs(), 0); VERIFY_COMPILATION(false); // Now just revert the last change. filesAreTargets = false; QCOMPARE(runQbs(resolveParams()), 0); QCOMPARE(runQbs(), 0); VERIFY_COMPILATION(true); // Change a relevant cpp property. A rebuild is expected. useCxx11 = true; QCOMPARE(runQbs(resolveParams()), 0); QCOMPARE(runQbs(QStringList({"--command-echo-mode", "command-line"})), 0); if (isGcc) { QVERIFY2(m_qbsStdout.contains("-std=c++11") || m_qbsStdout.contains("-std=c++0x"), m_qbsStdout.constData()); } #undef VERIFY_COMPILATION } void TestBlackbox::overrideProjectProperties() { QDir::setCurrent(testDataDir + "/overrideProjectProperties"); QCOMPARE(runQbs(QbsRunParameters(QStringList() << QStringLiteral("-f") << QStringLiteral("overrideProjectProperties.qbs") << QStringLiteral("project.nameSuffix:ForYou") << QStringLiteral("project.someBool:false") << QStringLiteral("project.someInt:156") << QStringLiteral("project.someStringList:one") << QStringLiteral("products.MyAppForYou.mainFile:main.cpp"))), 0); QVERIFY(regularFileExists(relativeExecutableFilePath("MyAppForYou", m_qbsStdout))); QVERIFY(QFile::remove(relativeBuildGraphFilePath())); QbsRunParameters params; params.arguments << QStringLiteral("-f") << QStringLiteral("project_using_helper_lib.qbs"); params.expectFailure = true; QVERIFY(runQbs(params) != 0); rmDirR(relativeBuildDir()); params.arguments = QStringList() << QStringLiteral("-f") << QStringLiteral("project_using_helper_lib.qbs") << QStringLiteral("project.linkSuccessfully:true"); params.expectFailure = false; QCOMPARE(runQbs(params), 0); } void TestBlackbox::partiallyBuiltDependency_data() { QTest::addColumn("mode"); QTest::addColumn("expectBuilding"); QTest::newRow("default") << QByteArray("default") << true; QTest::newRow("minimal") << QByteArray("minimal") << false; QTest::newRow("full") << QByteArray("full") << true; } void TestBlackbox::partiallyBuiltDependency() { QFETCH(QByteArray, mode); QFETCH(bool, expectBuilding); QDir::setCurrent(testDataDir + "/partially-built-dependency"); rmDirR(relativeBuildDir()); QbsRunParameters params({"-p", "p"}); if (mode == "minimal") params.arguments << "project.minimalDependency:true"; else if (mode == "full") params.arguments << "project.minimalDependency:false"; QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStdout.count("generating main.cpp"), 1); QCOMPARE(m_qbsStdout.count("copying main.cpp"), 1); QCOMPARE(m_qbsStdout.count("compiling main.cpp"), expectBuilding ? 2 : 1); QVERIFY2(m_qbsStdout.contains("linking") == expectBuilding, m_qbsStdout.constData()); } void TestBlackbox::pathProbe_data() { QTest::addColumn("projectFile"); QTest::addColumn("successExpected"); QTest::newRow("non-existent") << QString("non-existent.qbs") << false; QTest::newRow("non-existent-selector.qbs") << QString("non-existent-selector.qbs") << false; QTest::newRow("single-file") << QString("single-file.qbs") << true; QTest::newRow("single-file-selector") << QString("single-file-selector.qbs") << true; QTest::newRow("single-file-selector-array") << QString("single-file-selector-array.qbs") << true; QTest::newRow("single-file-mult-variants") << QString("single-file-mult-variants.qbs") << true; QTest::newRow("mult-files") << QString("mult-files.qbs") << true; QTest::newRow("mult-files-mult-variants") << QString("mult-files-mult-variants.qbs") << true; QTest::newRow("single-file-suffixes") << QString("single-file-suffixes.qbs") << true; QTest::newRow("mult-files-suffixes") << QString("mult-files-suffixes.qbs") << true; QTest::newRow("mult-files-common-suffixes") << QString("mult-files-common-suffixes.qbs") << true; QTest::newRow("mult-files-mult-suffixes") << QString("mult-files-mult-suffixes.qbs") << true; QTest::newRow("name-filter") << QString("name-filter.qbs") << true; QTest::newRow("candidate-filter") << QString("candidate-filter.qbs") << true; QTest::newRow("environment-paths") << QString("environment-paths.qbs") << true; } void TestBlackbox::pathProbe() { QDir::setCurrent(testDataDir + "/path-probe"); QFETCH(QString, projectFile); QFETCH(bool, successExpected); rmDirR(relativeBuildDir()); QbsRunParameters buildParams("build", QStringList{"-f", projectFile}); buildParams.expectFailure = !successExpected; buildParams.environment.insert("SEARCH_PATH", "usr/bin"); QCOMPARE(runQbs(buildParams) == 0, successExpected); if (!successExpected) QVERIFY2(m_qbsStderr.contains("Probe failed to find files"), m_qbsStderr); } void TestBlackbox::pathListInProbe() { QDir::setCurrent(testDataDir + "/path-list-in-probe"); QCOMPARE(runQbs(), 0); } void TestBlackbox::pchChangeTracking() { QDir::setCurrent(testDataDir + "/pch-change-tracking"); bool success = runQbs() == 0; if (!success && m_qbsStderr.contains("mingw32_gt_pch_use_address")) QSKIP("https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91440"); QVERIFY(success); QVERIFY(m_qbsStdout.contains("precompiling pch.h (cpp)")); WAIT_FOR_NEW_TIMESTAMP(); touch("header1.h"); success = runQbs() == 0; if (!success && m_qbsStderr.contains("mingw32_gt_pch_use_address")) QSKIP("https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91440"); QVERIFY(success); QVERIFY(m_qbsStdout.contains("precompiling pch.h (cpp)")); QVERIFY(m_qbsStdout.contains("compiling header2.cpp")); QVERIFY(m_qbsStdout.contains("compiling main.cpp")); WAIT_FOR_NEW_TIMESTAMP(); touch("header2.h"); success = runQbs() == 0; if (!success && m_qbsStderr.contains("mingw32_gt_pch_use_address")) QSKIP("https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91440"); QVERIFY(success); QVERIFY2(!m_qbsStdout.contains("precompiling pch.h (cpp)"), m_qbsStdout.constData()); } void TestBlackbox::perGroupDefineInExportItem() { QDir::setCurrent(testDataDir + "/per-group-define-in-export-item"); QCOMPARE(runQbs(), 0); } void TestBlackbox::pkgConfigProbe() { const QString exe = findExecutable(QStringList() << "pkg-config"); if (exe.isEmpty()) QSKIP("This test requires the pkg-config tool"); QDir::setCurrent(testDataDir + "/pkg-config-probe"); QFETCH(QString, packageBaseName); QFETCH(QStringList, found); QFETCH(QStringList, libs); QFETCH(QStringList, cflags); QFETCH(QStringList, version); rmDirR(relativeBuildDir()); QbsRunParameters params(QStringList() << ("project.packageBaseName:" + packageBaseName)); QCOMPARE(runQbs(params), 0); const QString stdOut = m_qbsStdout; QVERIFY2(stdOut.contains("theProduct1 found: " + found.at(0)), m_qbsStdout.constData()); QVERIFY2(stdOut.contains("theProduct2 found: " + found.at(1)), m_qbsStdout.constData()); QVERIFY2(stdOut.contains("theProduct1 libs: " + libs.at(0)), m_qbsStdout.constData()); QVERIFY2(stdOut.contains("theProduct2 libs: " + libs.at(1)), m_qbsStdout.constData()); QVERIFY2(stdOut.contains("theProduct1 cflags: " + cflags.at(0)), m_qbsStdout.constData()); QVERIFY2(stdOut.contains("theProduct2 cflags: " + cflags.at(1)), m_qbsStdout.constData()); QVERIFY2(stdOut.contains("theProduct1 version: " + version.at(0)), m_qbsStdout.constData()); QVERIFY2(stdOut.contains("theProduct2 version: " + version.at(1)), m_qbsStdout.constData()); } void TestBlackbox::pkgConfigProbe_data() { QTest::addColumn("packageBaseName"); QTest::addColumn("found"); QTest::addColumn("libs"); QTest::addColumn("cflags"); QTest::addColumn("version"); QTest::newRow("existing package") << "dummy" << (QStringList() << "true" << "true") << (QStringList() << "[\"-Ldummydir1\",\"-ldummy1\"]" << "[\"-Ldummydir2\",\"-ldummy2\"]") << (QStringList() << "[]" << "[]") << (QStringList() << "0.0.1" << "0.0.2"); // Note: The array values should be "undefined", but we lose that information when // converting to QVariants in the ProjectResolver. QTest::newRow("non-existing package") << "blubb" << (QStringList() << "false" << "false") << (QStringList() << "[]" << "[]") << (QStringList() << "[]" << "[]") << (QStringList() << "undefined" << "undefined"); } void TestBlackbox::pkgConfigProbeSysroot() { const QString exe = findExecutable(QStringList() << "pkg-config"); if (exe.isEmpty()) QSKIP("This test requires the pkg-config tool"); QDir::setCurrent(testDataDir + "/pkg-config-probe-sysroot"); QCOMPARE(runQbs(QStringList("-v")), 0); QCOMPARE(m_qbsStderr.count("PkgConfigProbe: found packages"), 2); const QString outputTemplate = "theProduct%1 libs: [\"-L%2/usr/dummy\",\"-ldummy1\"]"; QVERIFY2(m_qbsStdout.contains(outputTemplate .arg("1", QDir::currentPath() + "/sysroot1").toLocal8Bit()), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains(outputTemplate .arg("2", QDir::currentPath() + "/sysroot2").toLocal8Bit()), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains(outputTemplate .arg("3", QDir::currentPath() + "/sysroot1").toLocal8Bit()), m_qbsStdout.constData()); } void TestBlackbox::pluginDependency() { QDir::setCurrent(testDataDir + "/plugin-dependency"); // Build the plugins and the helper2 lib. QCOMPARE(runQbs(QStringList{"--products", "plugin1,plugin2,plugin3,plugin4,helper2"}), 0); QVERIFY(m_qbsStdout.contains("plugin1")); QVERIFY(m_qbsStdout.contains("plugin2")); QVERIFY(m_qbsStdout.contains("plugin3")); QVERIFY(m_qbsStdout.contains("plugin4")); QVERIFY(m_qbsStdout.contains("helper2")); QVERIFY(!m_qbsStderr.contains("SOFT ASSERT")); // Build the app. Plugins 1 and 2 must not be linked. Plugin 3 must be linked. QCOMPARE(runQbs(QStringList{"--command-echo-mode", "command-line"}), 0); QByteArray output = m_qbsStdout + '\n' + m_qbsStderr; QVERIFY(!output.contains("plugin1")); QVERIFY(!output.contains("plugin2")); QVERIFY(!output.contains("helper2")); // Test change tracking for parameter in Parameters item. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("plugin-dependency.qbs", "false // marker 1", "true"); QCOMPARE(runQbs(QStringList{"-p", "plugin2"}), 0); QVERIFY2(!m_qbsStdout.contains("linking"), m_qbsStdout.constData()); QCOMPARE(runQbs(QStringList{"--command-echo-mode", "command-line"}), 0); output = m_qbsStdout + '\n' + m_qbsStderr; QVERIFY2(!output.contains("plugin1"), output.constData()); QVERIFY2(!output.contains("helper2"), output.constData()); QVERIFY2(output.contains("plugin2"), output.constData()); // Test change tracking for parameter in Depends item. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("plugin-dependency.qbs", "false /* marker 2 */", "true"); QCOMPARE(runQbs(QStringList{"-p", "helper1", "--command-echo-mode", "command-line"}), 0); output = m_qbsStdout + '\n' + m_qbsStderr; QVERIFY2(output.contains("helper2"), output.constData()); // Check that the build dependency still works. QCOMPARE(runQbs(QStringLiteral("clean")), 0); QCOMPARE(runQbs(QStringList{"--products", "myapp", "--command-echo-mode", "command-line"}), 0); QVERIFY(m_qbsStdout.contains("plugin1")); QVERIFY(m_qbsStdout.contains("plugin2")); QVERIFY(m_qbsStdout.contains("plugin3")); QVERIFY(m_qbsStdout.contains("plugin4")); } void TestBlackbox::precompiledAndPrefixHeaders() { QDir::setCurrent(testDataDir + "/precompiled-and-prefix-headers"); const bool success = runQbs() == 0; if (!success && m_qbsStderr.contains("mingw32_gt_pch_use_address")) QSKIP("https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91440"); QVERIFY(success); } void TestBlackbox::precompiledHeaderAndRedefine() { QDir::setCurrent(testDataDir + "/precompiled-headers-and-redefine"); const bool success = runQbs() == 0; if (!success && m_qbsStderr.contains("mingw32_gt_pch_use_address")) QSKIP("https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91440"); QVERIFY(success); } void TestBlackbox::preventFloatingPointValues() { QDir::setCurrent(testDataDir + "/prevent-floating-point-values"); QCOMPARE(runQbs(QStringList("products.p.version:1.50")), 0); QVERIFY2(m_qbsStdout.contains("version: 1.50"), m_qbsStdout.constData()); } void TestBlackbox::probeChangeTracking() { QDir::setCurrent(testDataDir + "/probe-change-tracking"); // Product probe disabled, other probes enabled. QbsRunParameters params; params.command = "resolve"; params.arguments = QStringList("products.theProduct.runProbe:false"); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("running tlpProbe")); QVERIFY(m_qbsStdout.contains("running subProbe")); QVERIFY(!m_qbsStdout.contains("running productProbe")); // Product probe newly enabled. params.arguments = QStringList("products.theProduct.runProbe:true"); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("running tlpProbe")); QVERIFY(!m_qbsStdout.contains("running subProbe")); QVERIFY(m_qbsStdout.contains("running productProbe: 12")); // Re-resolving with unchanged probe. WAIT_FOR_NEW_TIMESTAMP(); touch("probe-change-tracking.qbs"); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("Resolving")); QVERIFY(!m_qbsStdout.contains("running tlpProbe")); QVERIFY(!m_qbsStdout.contains("running subProbe")); QVERIFY(!m_qbsStdout.contains("running productProbe")); // Re-resolving with changed configure scripts. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("probe-change-tracking.qbs", "console.info", " console.info"); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("Resolving")); QVERIFY(m_qbsStdout.contains("running tlpProbe")); QVERIFY(m_qbsStdout.contains("running subProbe")); QVERIFY(m_qbsStdout.contains("running productProbe: 12")); // Re-resolving with added property. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("probe-change-tracking.qbs", "condition: product.runProbe", "condition: product.runProbe\nproperty string something: 'x'"); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("Resolving")); QVERIFY(!m_qbsStdout.contains("running tlpProbe")); QVERIFY(!m_qbsStdout.contains("running subProbe")); QVERIFY(m_qbsStdout.contains("running productProbe: 12")); // Re-resolving with changed property. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("probe-change-tracking.qbs", "'x'", "'y'"); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("Resolving")); QVERIFY(!m_qbsStdout.contains("running tlpProbe")); QVERIFY(!m_qbsStdout.contains("running subProbe")); QVERIFY(m_qbsStdout.contains("running productProbe: 12")); // Re-resolving with removed property. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("probe-change-tracking.qbs", "property string something: 'y'", ""); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("Resolving")); QVERIFY(!m_qbsStdout.contains("running tlpProbe")); QVERIFY(!m_qbsStdout.contains("running subProbe")); QVERIFY(m_qbsStdout.contains("running productProbe: 12")); // Re-resolving with unchanged probe again. WAIT_FOR_NEW_TIMESTAMP(); touch("probe-change-tracking.qbs"); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("Resolving")); QVERIFY(!m_qbsStdout.contains("running tlpProbe")); QVERIFY(!m_qbsStdout.contains("running subProbe")); QVERIFY(!m_qbsStdout.contains("running productProbe")); // Enforcing re-running via command-line option. params.arguments.prepend("--force-probe-execution"); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("Resolving")); QVERIFY(m_qbsStdout.contains("running tlpProbe")); QVERIFY(m_qbsStdout.contains("running subProbe")); QVERIFY(m_qbsStdout.contains("running productProbe: 12")); } void TestBlackbox::probeProperties() { QDir::setCurrent(testDataDir + "/probeProperties"); const QByteArray dir = QDir::cleanPath(testDataDir).toLocal8Bit() + "/probeProperties"; QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("probe1.fileName=bin/tool"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("probe1.path=" + dir), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("probe1.filePath=" + dir + "/bin/tool"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("probe2.fileName=tool"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("probe2.path=" + dir + "/bin"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("probe2.filePath=" + dir + "/bin/tool"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("probe3.fileName=tool"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("probe3.path=" + dir + "/bin"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("probe3.filePath=" + dir + "/bin/tool"), m_qbsStdout.constData()); } void TestBlackbox::probesAndShadowProducts() { QDir::setCurrent(testDataDir + "/probes-and-shadow-products"); QCOMPARE(runQbs(QStringList("--log-time")), 0); QVERIFY2(m_qbsStdout.contains("2 probes encountered, 1 configure scripts executed"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("probes-and-shadow-products.qbs"); QCOMPARE(runQbs(QStringList("--log-time")), 0); QVERIFY2(m_qbsStdout.contains("2 probes encountered, 0 configure scripts executed"), m_qbsStdout.constData()); } void TestBlackbox::probeInExportedModule() { QDir::setCurrent(testDataDir + "/probe-in-exported-module"); QCOMPARE(runQbs(QbsRunParameters(QStringList() << QStringLiteral("-f") << QStringLiteral("probe-in-exported-module.qbs"))), 0); QVERIFY2(m_qbsStdout.contains("found: true"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("prop: yes"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("listProp: myother,my"), m_qbsStdout.constData()); } void TestBlackbox::probesAndArrayProperties() { QDir::setCurrent(testDataDir + "/probes-and-array-properties"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("prop: [\"probe\"]"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("probes-and-array-properties.qbs", "//", ""); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("prop: [\"product\",\"probe\"]"), m_qbsStdout.constData()); } void TestBlackbox::productProperties() { QDir::setCurrent(testDataDir + "/productproperties"); QCOMPARE(runQbs(QbsRunParameters(QStringList() << QStringLiteral("-f") << QStringLiteral("productproperties.qbs"))), 0); QVERIFY(regularFileExists(relativeExecutableFilePath("blubb_user", m_qbsStdout))); } void TestBlackbox::propertyAssignmentInFailedModule() { QDir::setCurrent(testDataDir + "/property-assignment-in-failed-module"); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("modules.m.doFail:false"))), 0); QbsRunParameters failParams; failParams.expectFailure = true; QVERIFY(runQbs(failParams) != 0); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("modules.m.doFail:true"))), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); failParams.expectFailure = false; QCOMPARE(runQbs(failParams), 0); } void TestBlackbox::propertyChanges() { QDir::setCurrent(testDataDir + "/propertyChanges"); const QString projectFile("propertyChanges.qbs"); QbsRunParameters params(QStringList({"-f", "propertyChanges.qbs", "qbs.enableDebugCode:true"})); // Initial build. QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(m_qbsStdout.contains("compiling lib.cpp")); QVERIFY(m_qbsStdout.contains("linking product 1.debug")); QVERIFY(m_qbsStdout.contains("generated.txt")); QVERIFY(m_qbsStdout.contains("making output from input")); QVERIFY(m_qbsStdout.contains("default value")); QVERIFY(m_qbsStdout.contains("making output from other output")); QFile generatedFile(relativeProductBuildDir("generated text file") + "/generated.txt"); QVERIFY(generatedFile.open(QIODevice::ReadOnly)); QCOMPARE(generatedFile.readAll(), QByteArray("prefix 1contents 1suffix 1")); generatedFile.close(); // Incremental build with no changes. QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("compiling lib.cpp.cpp")); QVERIFY(!m_qbsStdout.contains("linking")); QVERIFY(!m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("making output from input")); QVERIFY(!m_qbsStdout.contains("making output from other output")); // Incremental build with no changes, but updated project file timestamp. WAIT_FOR_NEW_TIMESTAMP(); touch(projectFile); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("compiling lib.cpp")); QVERIFY(!m_qbsStdout.contains("linking")); QVERIFY(!m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("making output from input")); QVERIFY(!m_qbsStdout.contains("making output from other output")); // Incremental build, input property changed for first product WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "blubb1", "blubb01"); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(m_qbsStdout.contains("linking product 1.debug")); QVERIFY(!m_qbsStdout.contains("linking product 2")); QVERIFY(!m_qbsStdout.contains("linking product 3")); QVERIFY(!m_qbsStdout.contains("linking library")); QVERIFY(!m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("making output from input")); QVERIFY(!m_qbsStdout.contains("making output from other output")); // Incremental build, input property changed via project for second product. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "blubb2", "blubb02"); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("linking product 1")); QVERIFY(m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("linking product 3")); QVERIFY(!m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("making output from input")); QVERIFY(!m_qbsStdout.contains("making output from other output")); // Incremental build, input property changed via command line for second product. params.command = "resolve"; params.arguments << "project.projectDefines:blubb002"; QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY(!m_qbsStdout.contains("linking product 1")); QVERIFY(m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("linking product 3")); QVERIFY(!m_qbsStdout.contains("generated.txt")); params.arguments.removeLast(); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY(!m_qbsStdout.contains("linking product 1")); QVERIFY(m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("linking product 3")); QVERIFY(!m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("making output from input")); QVERIFY(!m_qbsStdout.contains("making output from other output")); // Incremental build, input property changed via environment for third product. params.environment.insert("QBS_BLACKBOX_DEFINE", "newvalue"); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("linking product 1")); QVERIFY(!m_qbsStdout.contains("linking product 2")); QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("generated.txt")); params.environment.remove("QBS_BLACKBOX_DEFINE"); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("linking product 1")); QVERIFY(!m_qbsStdout.contains("linking product 2")); QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("making output from input")); QVERIFY(!m_qbsStdout.contains("making output from other output")); params.environment.insert("QBS_BLACKBOX_DEFINE", "newvalue"); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY(!m_qbsStdout.contains("linking product 1")); QVERIFY(!m_qbsStdout.contains("linking product 2")); QVERIFY(m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("generated.txt")); params.environment.remove("QBS_BLACKBOX_DEFINE"); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY(!m_qbsStdout.contains("linking product 1")); QVERIFY(!m_qbsStdout.contains("linking product 2")); QVERIFY(m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("making output from input")); QVERIFY(!m_qbsStdout.contains("making output from other output")); // Incremental build, module property changed via command line. params.arguments << "qbs.enableDebugCode:false"; QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(m_qbsStdout.contains("linking product 1.release")); QVERIFY(m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(m_qbsStdout.contains("compiling lib.cpp")); QVERIFY(!m_qbsStdout.contains("generated.txt")); params.arguments.removeLast(); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(m_qbsStdout.contains("linking product 1.debug")); QVERIFY(m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("making output from input")); QVERIFY(!m_qbsStdout.contains("making output from other output")); // Incremental build, non-essential dependency removed. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "Depends { name: 'library' }", "// Depends { name: 'library' }"); params.command = "build"; QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("linking product 1")); QVERIFY(m_qbsStdout.contains("linking product 2")); QVERIFY(!m_qbsStdout.contains("linking product 3")); QVERIFY(!m_qbsStdout.contains("linking library")); QVERIFY(!m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("making output from input")); QVERIFY(!m_qbsStdout.contains("making output from other output")); // Incremental build, prepare script of a transformer changed. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "contents 1", "contents 2"); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("compiling lib.cpp")); QVERIFY(m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("making output from input")); QVERIFY(!m_qbsStdout.contains("making output from other output")); QVERIFY(generatedFile.open(QIODevice::ReadOnly)); QCOMPARE(generatedFile.readAll(), QByteArray("prefix 1contents 2suffix 1")); generatedFile.close(); // Incremental build, product property used in JavaScript command changed. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "prefix 1", "prefix 2"); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("compiling lib.cpp")); QVERIFY(m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("making output from input")); QVERIFY(!m_qbsStdout.contains("making output from other output")); QVERIFY(generatedFile.open(QIODevice::ReadOnly)); QCOMPARE(generatedFile.readAll(), QByteArray("prefix 2contents 2suffix 1")); generatedFile.close(); // Incremental build, project property used in JavaScript command changed. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "suffix 1", "suffix 2"); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("compiling lib.cpp")); QVERIFY(m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("making output from input")); QVERIFY(!m_qbsStdout.contains("making output from other output")); QVERIFY(generatedFile.open(QIODevice::ReadOnly)); QCOMPARE(generatedFile.readAll(), QByteArray("prefix 2contents 2suffix 2")); generatedFile.close(); // Incremental build, module property used in JavaScript command changed. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "default value", "new value"); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("compiling lib.cpp")); QVERIFY(!m_qbsStdout.contains("generated.txt")); QVERIFY(m_qbsStdout.contains("making output from input")); QVERIFY(m_qbsStdout.contains("making output from other output")); QVERIFY(m_qbsStdout.contains("new value")); // Incremental build, prepare script of a rule in a module changed. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("modules/TestModule/module.qbs", "// console.info('Change in source code')", "console.info('Change in source code')"); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("compiling lib.cpp")); QVERIFY(!m_qbsStdout.contains("generated.txt")); QVERIFY(m_qbsStdout.contains("making output from input")); QVERIFY(m_qbsStdout.contains("making output from other output")); } void TestBlackbox::propertyEvaluationContext() { const QString testDir = testDataDir + "/property-evaluation-context"; QDir::setCurrent(testDir); QCOMPARE(runQbs(), 0); QCOMPARE(m_qbsStdout.count("base.productInBase evaluated in: myapp"), 1); QCOMPARE(m_qbsStdout.count("base.productInTop evaluated in: myapp"), 1); QCOMPARE(m_qbsStdout.count("top.productInExport evaluated in: mylib"), 1); QCOMPARE(m_qbsStdout.count("top.productInTop evaluated in: myapp"), 1); } void TestBlackbox::qtBug51237() { const SettingsPtr s = settings(); qbs::Internal::TemporaryProfile profile("qbs_autotests_qtBug51237", s.get()); profile.p.setValue("mymodule.theProperty", QStringList()); s->sync(); QDir::setCurrent(testDataDir + "/QTBUG-51237"); QbsRunParameters params; params.profile = profile.p.name(); QCOMPARE(runQbs(params), 0); } void TestBlackbox::dynamicMultiplexRule() { const QString testDir = testDataDir + "/dynamicMultiplexRule"; QDir::setCurrent(testDir); QCOMPARE(runQbs(), 0); const QString outputFilePath = relativeProductBuildDir("dynamicMultiplexRule") + "/stuff-from-3-inputs"; QVERIFY(regularFileExists(outputFilePath)); WAIT_FOR_NEW_TIMESTAMP(); touch("two.txt"); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(outputFilePath)); } void TestBlackbox::dynamicProject() { const QString testDir = testDataDir + "/dynamic-project"; QDir::setCurrent(testDir); QCOMPARE(runQbs(), 0); QCOMPARE(m_qbsStdout.count("compiling main.cpp"), 2); } void TestBlackbox::dynamicRuleOutputs() { const QString testDir = testDataDir + "/dynamicRuleOutputs"; QDir::setCurrent(testDir); if (QFile::exists("work")) rmDirR("work"); QDir().mkdir("work"); ccp("before", "work"); QDir::setCurrent(testDir + "/work"); QCOMPARE(runQbs(), 0); const QString appFile = relativeExecutableFilePath("genlexer", m_qbsStdout); const QString headerFile1 = relativeProductBuildDir("genlexer") + "/GeneratedFiles/numberscanner.h"; const QString sourceFile1 = relativeProductBuildDir("genlexer") + "/GeneratedFiles/numberscanner.c"; const QString sourceFile2 = relativeProductBuildDir("genlexer") + "/GeneratedFiles/lex.yy.c"; // Check build #1: source and header file name are specified in numbers.l QVERIFY(regularFileExists(appFile)); QVERIFY(regularFileExists(headerFile1)); QVERIFY(regularFileExists(sourceFile1)); QVERIFY(!QFile::exists(sourceFile2)); QDateTime appFileTimeStamp1 = QFileInfo(appFile).lastModified(); WAIT_FOR_NEW_TIMESTAMP(); copyFileAndUpdateTimestamp("../after/numbers.l", "numbers.l"); QCOMPARE(runQbs(), 0); // Check build #2: no file names are specified in numbers.l // flex will default to lex.yy.c without header file. QDateTime appFileTimeStamp2 = QFileInfo(appFile).lastModified(); QVERIFY(appFileTimeStamp1 < appFileTimeStamp2); QVERIFY(!QFile::exists(headerFile1)); QVERIFY(!QFile::exists(sourceFile1)); QVERIFY(regularFileExists(sourceFile2)); WAIT_FOR_NEW_TIMESTAMP(); copyFileAndUpdateTimestamp("../before/numbers.l", "numbers.l"); QCOMPARE(runQbs(), 0); // Check build #3: source and header file name are specified in numbers.l QDateTime appFileTimeStamp3 = QFileInfo(appFile).lastModified(); QVERIFY(appFileTimeStamp2 < appFileTimeStamp3); QVERIFY(regularFileExists(appFile)); QVERIFY(regularFileExists(headerFile1)); QVERIFY(regularFileExists(sourceFile1)); QVERIFY(!QFile::exists(sourceFile2)); } void TestBlackbox::emptyProfile() { QDir::setCurrent(testDataDir + "/empty-profile"); const SettingsPtr s = settings(); const qbs::Profile buildProfile(profileName(), s.get()); bool isMsvc = false; auto toolchainType = buildProfile.value(QStringLiteral("qbs.toolchainType")).toString(); QbsRunParameters params; params.profile = "none"; if (toolchainType.isEmpty()) { const auto toolchain = buildProfile.value(QStringLiteral("qbs.toolchain")).toStringList(); if (!toolchain.isEmpty()) toolchainType = toolchain.first(); } if (!toolchainType.isEmpty()) { params.arguments = QStringList{QStringLiteral("qbs.toolchainType:") + toolchainType}; isMsvc = toolchainType == "msvc" || toolchainType == "clang-cl"; } if (!isMsvc) { const auto tcPath = QDir::toNativeSeparators( buildProfile.value(QStringLiteral("cpp.toolchainInstallPath")).toString()); auto paths = params.environment.value(QStringLiteral("PATH")) .split(HostOsInfo::pathListSeparator(), Qt::SkipEmptyParts); if (!tcPath.isEmpty() && !paths.contains(tcPath)) { paths.prepend(tcPath); params.environment.insert( QStringLiteral("PATH"), paths.join(HostOsInfo::pathListSeparator())); } } QCOMPARE(runQbs(params), 0); } using ASet = QSet; namespace { QString JS() { static const auto suffix = QStringLiteral(".js"); return suffix; } QString WASM() { static const auto suffix = QStringLiteral(".wasm"); return suffix; } QString WASMJS() { static const auto suffix = QStringLiteral(".wasm.js"); return suffix; } QString HTML() { static const auto suffix = QStringLiteral(".html"); return suffix; } } // namespace void TestBlackbox::emscriptenArtifacts() { QDir::setCurrent(testDataDir + "/emscripten-artifacts"); QFETCH(QString, executableSuffix); QFETCH(QString, wasmOption); QFETCH(int, buildresult); QFETCH(ASet, suffixes); const QStringList params = { QStringLiteral("modules.cpp.executableSuffix:%1").arg(executableSuffix), QStringLiteral("modules.cpp.driverLinkerFlags:%1").arg(wasmOption)}; ASet possibleSuffixes = {JS(), WASM(), WASMJS(), HTML()}; QbsRunParameters qbsParams("resolve", params); int result = runQbs(qbsParams); QCOMPARE(result, 0); if (m_qbsStdout.contains("is emscripten: false")) QSKIP("Skipping emscripten test"); QVERIFY(m_qbsStdout.contains("is emscripten: true")); result = runQbs(QbsRunParameters("build", params)); QCOMPARE(result, buildresult); if (result == 0) { const auto app = QStringLiteral("app"); const auto appWithoutSuffix = relativeProductBuildDir(app) + QLatin1Char('/') + app; ASet usedSuffixes; for (const auto &suffix : suffixes) { usedSuffixes.insert(suffix); QVERIFY(regularFileExists(appWithoutSuffix + suffix)); } possibleSuffixes.subtract(usedSuffixes); for (const auto &unusedSuffix : possibleSuffixes) { QVERIFY(!regularFileExists(appWithoutSuffix + unusedSuffix)); } } QCOMPARE(runQbs(QbsRunParameters("clean")), 0); } void TestBlackbox::emscriptenArtifacts_data() { QTest::addColumn("executableSuffix"); QTest::addColumn("wasmOption"); QTest::addColumn("buildresult"); QTest::addColumn("suffixes"); QTest::newRow(".js WASM=0") << ".js" << "-sWASM=0" << 0 << ASet{JS()}; QTest::newRow(".js WASM=1") << ".js" << "-sWASM=1" << 0 << ASet{JS(), WASM()}; QTest::newRow(".js WASM=2") << ".js" << "-sWASM=2" << 0 << ASet{JS(), WASM(), WASMJS()}; QTest::newRow(".js WASM=779") << ".js" << "-sWASM=779" << 0 << ASet{JS(), WASM()}; QTest::newRow(".wasm WASM=0") << ".wasm" << "-sWASM=0" << 1 << ASet{}; QTest::newRow(".wasm WASM=1") << ".wasm" << "-sWASM=1" << 0 << ASet{WASM()}; QTest::newRow(".wasm WASM=2") << ".wasm" << "-sWASM=2" << 0 << ASet{WASM(), WASMJS()}; QTest::newRow(".wasm WASM=848") << ".wasm" << "-sWASM=848" << 0 << ASet{WASM()}; QTest::newRow(".html WASM=0") << ".html" << "-sWASM=0" << 0 << ASet{JS(), HTML()}; QTest::newRow(".html WASM=1") << ".html" << "-sWASM=1" << 0 << ASet{JS(), HTML(), WASM()}; QTest::newRow(".html WASM=2") << ".html" << "-sWASM=2" << 0 << ASet{JS(), HTML(), WASM(), WASMJS()}; QTest::newRow(".html WASM=233") << ".html" << "-sWASM=233" << 0 << ASet{JS(), HTML(), WASM()}; } void TestBlackbox::erroneousFiles_data() { QTest::addColumn("errorMessage"); QTest::newRow("nonexistentWorkingDir") << "The working directory '.does.not.exist' for process '.*ls.*' is invalid."; QTest::newRow("outputArtifacts-missing-filePath") << "Error in Rule\\.outputArtifacts\\[0\\]\n\r?" "Property filePath must be a non-empty string\\."; QTest::newRow("outputArtifacts-missing-fileTags") << "Error in Rule\\.outputArtifacts\\[0\\]\n\r?" "Property fileTags for artifact 'outputArtifacts-missing-fileTags\\.txt' " "must be a non-empty string list\\."; QTest::newRow("texttemplate-unknown-placeholder") << "Placeholder 'what' is not defined in textemplate.dict for 'boom.txt.in'"; QTest::newRow("tag-mismatch") << "tag-mismatch.qbs:8:18.*Artifact '.*dummy1' has undeclared file tags " "\\[\"y\",\"z\"\\]."; } void TestBlackbox::erroneousFiles() { QFETCH(QString, errorMessage); QDir::setCurrent(testDataDir + "/erroneous/" + QTest::currentDataTag()); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QString err = QString::fromLocal8Bit(m_qbsStderr); if (!err.contains(QRegularExpression(errorMessage))) { qDebug().noquote() << "Output: " << err; qDebug().noquote() << "Expected: " << errorMessage; QFAIL("Unexpected error message."); } } void TestBlackbox::errorInfo() { QDir::setCurrent(testDataDir + "/error-info"); QCOMPARE(runQbs(), 0); QbsRunParameters resolveParams; QbsRunParameters buildParams; buildParams.expectFailure = true; resolveParams.command = "resolve"; resolveParams.arguments = QStringList() << "project.fail1:true"; QCOMPARE(runQbs(resolveParams), 0); buildParams.arguments = resolveParams.arguments; QVERIFY(runQbs(buildParams) != 0); QVERIFY2(m_qbsStderr.contains("error-info.qbs:24"), m_qbsStderr); resolveParams.arguments = QStringList() << "project.fail2:true"; QCOMPARE(runQbs(resolveParams), 0); buildParams.arguments = resolveParams.arguments; QVERIFY(runQbs(buildParams) != 0); QVERIFY2(m_qbsStderr.contains("error-info.qbs:36"), m_qbsStderr); resolveParams.arguments = QStringList() << "project.fail3:true"; QCOMPARE(runQbs(resolveParams), 0); buildParams.arguments = resolveParams.arguments; QVERIFY(runQbs(buildParams) != 0); QVERIFY2(m_qbsStderr.contains("error-info.qbs:51"), m_qbsStderr); resolveParams.arguments = QStringList() << "project.fail4:true"; QCOMPARE(runQbs(resolveParams), 0); buildParams.arguments = resolveParams.arguments; QVERIFY(runQbs(buildParams) != 0); QVERIFY2(m_qbsStderr.contains("error-info.qbs:66"), m_qbsStderr); resolveParams.arguments = QStringList() << "project.fail5:true"; QCOMPARE(runQbs(resolveParams), 0); buildParams.arguments = resolveParams.arguments; QVERIFY(runQbs(buildParams) != 0); QVERIFY2(m_qbsStderr.contains("helper.js:4"), m_qbsStderr); resolveParams.arguments = QStringList() << "project.fail6:true"; QCOMPARE(runQbs(resolveParams), 0); buildParams.arguments = resolveParams.arguments; QVERIFY(runQbs(buildParams) != 0); QVERIFY2(m_qbsStderr.contains("helper.js:8"), m_qbsStderr); resolveParams.arguments = QStringList() << "project.fail7:true"; QCOMPARE(runQbs(resolveParams), 0); buildParams.arguments = resolveParams.arguments; QVERIFY(runQbs(buildParams) != 0); QVERIFY2(m_qbsStderr.contains("JavaScriptCommand.sourceCode"), m_qbsStderr); QVERIFY2(m_qbsStderr.contains("error-info.qbs:57"), m_qbsStderr); } void TestBlackbox::escapedLinkerFlags() { QDir::setCurrent(testDataDir + "/escaped-linker-flags"); QbsRunParameters params("resolve", QStringList("products.app.escapeLinkerFlags:false")); QCOMPARE(runQbs(params), 0); const bool isGcc = m_qbsStdout.contains("is gcc: true"); const bool isNotGcc = m_qbsStdout.contains("is gcc: false"); if (isNotGcc) QSKIP("escaped linker flags test only applies on plain unix with gcc and GNU ld"); QVERIFY(isGcc); params.command = "build"; QCOMPARE(runQbs(params), 0); params.command = "resolve"; params.arguments = QStringList() << "products.app.escapeLinkerFlags:true"; QCOMPARE(runQbs(params), 0); params.command = "build"; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("Encountered escaped linker flag"), m_qbsStderr.constData()); } void TestBlackbox::exportedDependencyInDisabledProduct() { QDir::setCurrent(testDataDir + "/exported-dependency-in-disabled-product"); QFETCH(QString, depCondition); QFETCH(bool, compileExpected); rmDirR(relativeBuildDir()); const QString propertyArg = "products.dep.conditionString:" + depCondition; QCOMPARE(runQbs(QStringList(propertyArg)), 0); QCOMPARE(m_qbsStdout.contains("compiling"), compileExpected); } void TestBlackbox::exportedDependencyInDisabledProduct_data() { QTest::addColumn("depCondition"); QTest::addColumn("compileExpected"); QTest::newRow("dependency enabled") << "true" << true; QTest::newRow("dependency directly disabled") << "false" << false; QTest::newRow("dependency disabled via non-present module") << "nosuchmodule.present" << false; QTest::newRow("dependency disabled via failed module") << "broken.present" << false; } void TestBlackbox::exportedPropertyInDisabledProduct() { QDir::setCurrent(testDataDir + "/exported-property-in-disabled-product"); QFETCH(QString, depCondition); QFETCH(bool, successExpected); const QString propertyArg = "products.dep.conditionString:" + depCondition; QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList(propertyArg))), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QbsRunParameters buildParams; buildParams.expectFailure = !successExpected; QCOMPARE(runQbs(buildParams) == 0, successExpected); } void TestBlackbox::exportedPropertyInDisabledProduct_data() { QTest::addColumn("depCondition"); QTest::addColumn("successExpected"); QTest::newRow("dependency enabled") << "true" << false; QTest::newRow("dependency directly disabled") << "false" << true; QTest::newRow("dependency disabled via non-present module") << "nosuchmodule.present" << true; QTest::newRow("dependency disabled via failed module") << "broken.present" << true; } void TestBlackbox::systemRunPaths() { const QString lddFilePath = findExecutable(QStringList() << "ldd"); if (lddFilePath.isEmpty()) QSKIP("ldd not found"); QDir::setCurrent(testDataDir + "/system-run-paths"); QFETCH(bool, setRunPaths); rmDirR(relativeBuildDir()); QbsRunParameters params("resolve"); params.arguments << QString("project.setRunPaths:") + (setRunPaths ? "true" : "false"); QCOMPARE(runQbs(params), 0); const bool isUnix = m_qbsStdout.contains("is unix: true"); const bool isNotUnix = m_qbsStdout.contains("is unix: false"); if (isNotUnix) QSKIP("only applies on Unix"); QVERIFY(isUnix); const QString exe = relativeExecutableFilePath("app", m_qbsStdout); params.command = "build"; QCOMPARE(runQbs(params), 0); QProcess ldd; ldd.start(lddFilePath, QStringList() << exe); QVERIFY2(ldd.waitForStarted(), qPrintable(ldd.errorString())); QVERIFY2(ldd.waitForFinished(), qPrintable(ldd.errorString())); QVERIFY2(ldd.exitCode() == 0, ldd.readAllStandardError().constData()); const QByteArray output = ldd.readAllStandardOutput(); const QList outputLines = output.split('\n'); QByteArray libLine; for (const auto &line : outputLines) { if (line.contains("theLib")) { libLine = line; break; } } QVERIFY2(!libLine.isEmpty(), output.constData()); QVERIFY2(setRunPaths == libLine.contains("not found"), libLine.constData()); } void TestBlackbox::systemRunPaths_data() { QTest::addColumn("setRunPaths"); QTest::newRow("do not set system run paths") << false; QTest::newRow("do set system run paths") << true; } void TestBlackbox::exportRule() { QDir::setCurrent(testDataDir + "/export-rule"); QbsRunParameters params(QStringList{"modules.blubber.enableTagger:false"}); params.expectFailure = true; QVERIFY(runQbs(params) != 0); params.command = "resolve"; params.arguments = QStringList{"modules.blubber.enableTagger:true"}; params.expectFailure = false; QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("creating C++ source file"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("compiling myapp.cpp"), m_qbsStdout.constData()); } void TestBlackbox::exportToOutsideSearchPath() { QDir::setCurrent(testDataDir + "/export-to-outside-searchpath"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("Dependency 'aModule' not found for product 'theProduct'."), m_qbsStderr.constData()); } void TestBlackbox::exportsCMake() { QFETCH(QStringList, arguments); QDir::setCurrent(testDataDir + "/exports-cmake"); rmDirR(relativeBuildDir()); QbsRunParameters findCMakeParams("resolve", {"-f", "find-cmake.qbs"}); QCOMPARE(runQbs(findCMakeParams), 0); const QString output = QString::fromLocal8Bit(m_qbsStdout); const QRegularExpression pattern( QRegularExpression::anchoredPattern(".*---(.*)---.*"), QRegularExpression::DotMatchesEverythingOption); const QRegularExpressionMatch match = pattern.match(output); QVERIFY2(match.hasMatch(), qPrintable(output)); QCOMPARE(pattern.captureCount(), 1); const QString jsonString = match.captured(1); const QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonString.toUtf8()); const QJsonObject jsonData = jsonDoc.object(); rmDirR(relativeBuildDir()); const QStringList exporterArgs{"-f", "exports-cmake.qbs"}; QbsRunParameters exporterRunParams("build", exporterArgs); exporterRunParams.arguments << arguments; QCOMPARE(runQbs(exporterRunParams), 0); if (!jsonData.value(u"cmakeFound").toBool()) { QSKIP("cmake is not installed"); return; } if (jsonData.value(u"crossCompiling").toBool()) { QSKIP("test is not applicable with cross-compile toolchains"); return; } const auto cmakeFilePath = jsonData.value(u"cmakeFilePath").toString(); QVERIFY(!cmakeFilePath.isEmpty()); const auto generator = jsonData.value(u"generator").toString(); if (generator.isEmpty()) { QSKIP("cannot detect cmake generator"); return; } QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); const auto buildEnv = jsonData.value(u"buildEnv").toObject(); for (auto it = buildEnv.begin(), end = buildEnv.end(); it != end; ++it) { if (it.key() == "PATH") { auto paths = it.value().toString().split(HostOsInfo::pathListSeparator()); paths.append(env.value(it.key()).split(HostOsInfo::pathListSeparator())); env.insert(it.key(), paths.join(HostOsInfo::pathListSeparator())); } else { env.insert(it.key(), it.value().toString()); } } const auto installPrefix = jsonData.value(u"installPrefix").toString(); const auto cmakePrefixPath = QFileInfo(relativeBuildDir()).absoluteFilePath() + "/install-root/" + installPrefix + "/lib/cmake"; const auto sourceDirectory = testDataDir + "/exports-cmake/cmake"; QProcess configure; configure.setProcessEnvironment(env); configure.setWorkingDirectory(sourceDirectory); configure.start( cmakeFilePath, {".", "-DCMAKE_PREFIX_PATH=" + cmakePrefixPath, "-G" + generator}); QVERIFY(waitForProcessSuccess(configure, 120000)); QProcess build; build.setProcessEnvironment(env); build.setWorkingDirectory(sourceDirectory); build.start(cmakeFilePath, QStringList{"--build", "."}); QVERIFY(waitForProcessSuccess(build)); } void TestBlackbox::exportsCMake_data() { QTest::addColumn("arguments"); QTest::newRow("dynamic lib") << QStringList("project.isStatic: false"); QTest::newRow("static lib") << QStringList("project.isStatic: true"); QTest::newRow("framework") << QStringList("project.isBundle: true"); } void TestBlackbox::exportsPkgconfig() { QDir::setCurrent(testDataDir + "/exports-pkgconfig"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("creating TheFirstLib.pc"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("creating TheSecondLib.pc"), m_qbsStdout.constData()); QFile sourcePcFile(HostOsInfo::isWindowsHost() ? "TheFirstLib_windows.pc" : "TheFirstLib.pc"); QString generatedPcFilePath = relativeProductBuildDir("TheFirstLib") + "/TheFirstLib.pc"; QFile generatedPcFile(generatedPcFilePath); QVERIFY2(sourcePcFile.open(QIODevice::ReadOnly), qPrintable(sourcePcFile.errorString())); QVERIFY2(generatedPcFile.open(QIODevice::ReadOnly), qPrintable(generatedPcFile.errorString())); QCOMPARE(generatedPcFile.readAll().replace("\r", ""), sourcePcFile.readAll().replace("\r", "")); sourcePcFile.close(); generatedPcFile.close(); TEXT_FILE_COMPARE(relativeProductBuildDir("TheSecondLib") + "/TheSecondLib.pc", "TheSecondLib.pc"); WAIT_FOR_NEW_TIMESTAMP(); touch("firstlib.cpp"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("linking"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating TheFirstLib.pc"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating TheSecondLib.pc"), m_qbsStdout.constData()); } void TestBlackbox::exportsQbs() { QDir::setCurrent(testDataDir + "/exports-qbs"); QCOMPARE(runQbs({"resolve", {"-f", "exports-qbs.qbs"}}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); // First we build exportable products and use them (as products) inside // the original project. QCOMPARE(runQbs(QStringList{"-f", "exports-qbs.qbs", "--command-echo-mode", "command-line"}), 0); QVERIFY2(m_qbsStdout.contains("somelocaldir"), m_qbsStdout.constData()); // Now we build an external product against the modules that were just installed. // We try debug and release mode; one module exists for each of them. QbsRunParameters paramsExternalBuild(QStringList{"-f", "consumer.qbs", "--command-echo-mode", "command-line", "modules.qbs.buildVariant:debug",}); paramsExternalBuild.buildDirectory = QDir::currentPath() + "/external-consumer-debug"; QCOMPARE(runQbs(paramsExternalBuild), 0); QVERIFY2(!m_qbsStdout.contains("somelocaldir"), m_qbsStdout.constData()); paramsExternalBuild.arguments = QStringList{"-f", "consumer.qbs", "modules.qbs.buildVariant:release"}; paramsExternalBuild.buildDirectory = QDir::currentPath() + "/external-consumer-release"; QCOMPARE(runQbs(paramsExternalBuild), 0); // Trying to build with an unsupported build variant must fail. paramsExternalBuild.arguments = QStringList{"-f", "consumer.qbs", "modules.qbs.buildVariant:profiling"}; paramsExternalBuild.buildDirectory = QDir::currentPath() + "/external-consumer-profile"; paramsExternalBuild.expectFailure = true; QVERIFY(runQbs(paramsExternalBuild) != 0); QVERIFY2(m_qbsStderr.contains("Dependency 'MyLib' not found for product 'consumer'"), m_qbsStderr.constData()); // Removing the condition from the generated module leaves us with two conflicting // candidates. QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList{ "-f", "exports-qbs.qbs", "modules.Exporter.qbs.additionalContent:''"})), 0); QCOMPARE(runQbs(), 0); QVERIFY(runQbs(paramsExternalBuild) != 0); QVERIFY2(m_qbsStderr.contains("There is more than one equally prioritized candidate " "for module 'MyLib'."), m_qbsStderr.constData()); // Change tracking for accesses to product.exports (negative). QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList{"-f", "exports-qbs.qbs"})), 0); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("creating MyTool.qbs"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("exports-qbs.qbs"); QCOMPARE(runQbs(QStringList({"-p", "MyTool"})), 0); QVERIFY2(!m_qbsStdout.contains("creating MyTool.qbs"), m_qbsStdout.constData()); // Rebuilding the target binary should not cause recreating the module file. WAIT_FOR_NEW_TIMESTAMP(); touch("mylib.cpp"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.count("linking") >= 2, m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating MyLib"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating MyTool.qbs"), m_qbsStdout.constData()); // Changing a setting that influences the name of a target artifact should cause // recreating the module file. const QbsRunParameters resolveParams("resolve", QStringList{"-f", "exports-qbs.qbs", "modules.cpp.dynamicLibrarySuffix:.blubb"}); QCOMPARE(runQbs(resolveParams), 0); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.count("linking") >= 2, m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.count("creating MyLib") == 2, m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("creating MyTool.qbs"), m_qbsStdout.constData()); // Change tracking for accesses to product.exports (positive). WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("tool.qbs", "exportingProduct.toolTags", "[]"); QCOMPARE(runQbs(QStringList({"-p", "MyTool"})), 0); QVERIFY2(m_qbsStdout.contains("creating MyTool.qbs"), m_qbsStdout.constData()); } void TestBlackbox::externalLibs() { QDir::setCurrent(testDataDir + "/external-libs"); QCOMPARE(runQbs(), 0); } void TestBlackbox::fileDependencies() { QDir::setCurrent(testDataDir + "/fileDependencies"); rmDirR(relativeBuildDir()); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("compiling narf.cpp")); QVERIFY(m_qbsStdout.contains("compiling zort.cpp")); const QString productFileName = relativeExecutableFilePath("myapp", m_qbsStdout); QVERIFY2(regularFileExists(productFileName), qPrintable(productFileName)); // Incremental build without changes. QCOMPARE(runQbs(), 0); QVERIFY(!m_qbsStdout.contains("compiling")); QVERIFY(!m_qbsStdout.contains("linking")); // Incremental build with changed file dependency. WAIT_FOR_NEW_TIMESTAMP(); touch("awesomelib/awesome.h"); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("compiling narf.cpp")); QVERIFY(!m_qbsStdout.contains("compiling zort.cpp")); // Incremental build with changed 2nd level file dependency. WAIT_FOR_NEW_TIMESTAMP(); touch("awesomelib/magnificent.h"); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("compiling narf.cpp")); QVERIFY(!m_qbsStdout.contains("compiling zort.cpp")); // Change the product in between to force the list of dependencies to get rescued. REPLACE_IN_FILE("fileDependencies.qbs", "//", ""); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY(!m_qbsStdout.contains("compiling narf.cpp")); QVERIFY(!m_qbsStdout.contains("compiling zort.cpp")); WAIT_FOR_NEW_TIMESTAMP(); touch("awesomelib/magnificent.h"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("[myapp] compiling narf.cpp"), m_qbsStdout.constData()); QVERIFY(!m_qbsStdout.contains("compiling zort.cpp")); } void TestBlackbox::fileTagsFilterMerging() { QDir::setCurrent(testDataDir + "/filetagsfilter-merging"); QCOMPARE(runQbs(QStringList{"-f", "filetagsfilter-merging.qbs"}), 0); const QString installedApp = defaultInstallRoot + "/myapp/binDir/" + QFileInfo(relativeExecutableFilePath("myapp", m_qbsStdout)).fileName(); QVERIFY2(QFile::exists(installedApp), qPrintable(installedApp)); const QString otherOutput = relativeProductBuildDir("myapp") + "/myapp.txt"; QVERIFY2(QFile::exists(otherOutput), qPrintable(otherOutput)); } void TestBlackbox::flatbuf() { QFETCH(QString, projectFile); QDir::setCurrent(testDataDir + "/flatbuf"); rmDirR(relativeBuildDir()); if (!prepareAndRunConan()) QSKIP("conan is not prepared, check messages above"); QbsRunParameters resolveParams( "resolve", QStringList{"-f", projectFile, "moduleProviders.conan.installDirectory:build"}); QCOMPARE(runQbs(resolveParams), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); const bool withFlatbuffers = m_qbsStdout.contains("has flatbuffers: true"); const bool withoutFlatbuffers = m_qbsStdout.contains("has flatbuffers: false"); QVERIFY2(withFlatbuffers || withoutFlatbuffers, m_qbsStdout.constData()); if (withoutFlatbuffers) QSKIP("flatbuf module not present"); QbsRunParameters runParams("run"); QCOMPARE(runQbs(runParams), 0); } void TestBlackbox::flatbuf_data() { QTest::addColumn("projectFile"); // QTest::newRow("c") << QString("flat_c.qbs"); QTest::newRow("cpp") << QString("flat_cpp.qbs"); QTest::newRow("relative import") << QString("flat_relative_import.qbs"); QTest::newRow("absolute import") << QString("flat_absolute_import.qbs"); QTest::newRow("filename suffix") << QString("flat_filename_suffix.qbs"); QTest::newRow("filename extension") << QString("flat_filename_extension.qbs"); QTest::newRow("keep prefix") << QString("flat_keep_prefix.qbs"); } void TestBlackbox::freedesktop() { if (!HostOsInfo::isAnyUnixHost()) QSKIP("only applies on Unix"); if (HostOsInfo::isMacosHost()) QSKIP("Does not apply on macOS"); QDir::setCurrent(testDataDir + "/freedesktop"); QCOMPARE(runQbs(), 0); if (m_qbsStdout.contains("is emscripten: true")) QSKIP("Irrelevant for emscripten"); QVERIFY(m_qbsStdout.contains("is emscripten: false")); // Check desktop file QString desktopFilePath = defaultInstallRoot + "/usr/local/share/applications/myapp.desktop"; QVERIFY(QFile::exists(desktopFilePath)); QFile desktopFile(desktopFilePath); QVERIFY2(desktopFile.open(QIODevice::ReadOnly), qPrintable(desktopFile.errorString())); QByteArrayList lines = desktopFile.readAll().split('\n'); // Automatically filled line: QVERIFY(lines.contains("Exec=main")); // Name specified in `freedesktop.name` property QVERIFY(lines.contains("Name=My App")); // Overridden line: QVERIFY(lines.contains("Icon=myapp.png")); // Untouched line: QVERIFY(lines.contains("Terminal=false")); // Untouched localized line: QVERIFY(lines.contains("GenericName[fr]=Éditeur d'images")); // Untouched localized line: QVERIFY(lines.contains("Comment[fr]=Créer des images et éditer des photographies")); // Check AppStream file QVERIFY(QFile::exists(defaultInstallRoot + "/usr/local/share/metainfo/myapp.appdata.xml")); // Check hicolor icon files QVERIFY( QFile::exists(defaultInstallRoot + "/usr/local/share/icons/hicolor/48x48/apps/myapp.png")); QVERIFY(QFile::exists( defaultInstallRoot + "/usr/local/share/icons/hicolor/48x48@2/apps/myapp.png")); QVERIFY( QFile::exists(defaultInstallRoot + "/usr/local/share/icons/hicolor/64x64/apps/myapp.png")); QVERIFY(QFile::exists( defaultInstallRoot + "/usr/local/share/icons/hicolor/64x64@2/apps/myapp.png")); QVERIFY(QFile::exists( defaultInstallRoot + "/usr/local/share/icons/hicolor/64x64/mimetypes/application-format.png")); QVERIFY(QFile::exists( defaultInstallRoot + "/usr/local/share/icons/hicolor/scalable/apps/myapp.png")); } void TestBlackbox::installedTransformerOutput() { QDir::setCurrent(testDataDir + "/installed-transformer-output"); QCOMPARE(runQbs(), 0); const QString installedFilePath = defaultInstallRoot + "/textfiles/HelloWorld.txt"; QVERIFY2(QFile::exists(installedFilePath), qPrintable(installedFilePath)); } void TestBlackbox::installLocations_data() { QTest::addColumn("testCase"); QTest::newRow("default values") << QString("default"); QTest::newRow("explicit values, direct") << QString("direct"); QTest::newRow("explicit values, using config.install module") << QString("config"); QTest::newRow("explicit values, using installpaths module") << QString("installpaths"); } void TestBlackbox::installLocations() { QFETCH(QString, testCase); QDir::setCurrent(testDataDir + "/install-locations"); rmDirR(relativeBuildDir()); QbsRunParameters params("resolve"); QCOMPARE(runQbs(params), 0); // Extract toolchain name from console output const QString output = QString::fromLocal8Bit(m_qbsStdout); const QRegularExpression pattern( QRegularExpression::anchoredPattern(".*===toolchain:(.*)===.*"), QRegularExpression::DotMatchesEverythingOption); const QRegularExpressionMatch match = pattern.match(output); QVERIFY2(match.hasMatch(), qPrintable(output)); QCOMPARE(pattern.captureCount(), 1); const QString toolchain = match.captured(1); QVERIFY2(toolchain != "unknown", qPrintable(output)); if (testCase != "default") { const QString binDir = "bindir"; const QString libDir = "libdir"; const QString pluginDir = "pluginDir"; const QString dsymDir = "dsymDir"; if (testCase == "direct") { params.arguments.push_back("products.theapp.installDir:" + binDir); if (toolchain == "msvc" || toolchain == "mingw") { params.arguments.push_back("products.thelib.installDir:" + binDir); params.arguments.push_back("products.theloadablemodule.installDir:" + binDir); } else { params.arguments.push_back("products.thelib.installDir:" + libDir); params.arguments.push_back("products.theloadablemodule.installDir:" + libDir); } params.arguments.push_back("products.thelib.importLibInstallDir:" + libDir); params.arguments.push_back("products.theplugin.installDir:" + pluginDir); params.arguments.push_back("products.theapp.debugInformationInstallDir:" + dsymDir); params.arguments.push_back("products.thelib.debugInformationInstallDir:" + dsymDir); params.arguments.push_back( "products.theloadablemodule.debugInformationInstallDir:" + dsymDir); params.arguments.push_back("products.theplugin.debugInformationInstallDir:" + dsymDir); } else if (testCase == "config") { params.arguments.push_back("modules.config.install.binariesDirectory:" + binDir); params.arguments.push_back("modules.config.install.applicationsDirectory:" + binDir); if (toolchain == "msvc" || toolchain == "mingw") { params.arguments.push_back( "modules.config.install.dynamicLibrariesDirectory:" + binDir); } else { params.arguments.push_back( "modules.config.install.dynamicLibrariesDirectory:" + libDir); } params.arguments.push_back("modules.config.install.frameworksDirectory:" + libDir); params.arguments.push_back("modules.config.install.importLibrariesDirectory:" + libDir); params.arguments.push_back("modules.config.install.pluginsDirectory:" + pluginDir); params.arguments.push_back( "modules.config.install.loadableModulesDirectory:" + pluginDir); params.arguments.push_back( "modules.config.install.debugInformationDirectory:" + dsymDir); } else if (testCase == "installpaths") { params.arguments.push_back("modules.installpaths.bin:" + binDir); params.arguments.push_back("modules.installpaths.applications:" + binDir); params.arguments.push_back("modules.installpaths.lib:" + libDir); params.arguments.push_back("modules.installpaths.frameworks:" + libDir); params.arguments.push_back("modules.installpaths.plugins:" + pluginDir); params.arguments.push_back("modules.installpaths.loadableModules:" + pluginDir); params.arguments.push_back( "modules.config.install.debugInformationDirectory:" + dsymDir); } } QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(QbsRunParameters(QStringList("--clean-install-root"))), 0); const QString jsonFilePath = testDataDir + "/install-locations/data/" + toolchain + ".json"; QFile jsonFile(jsonFilePath); QVERIFY2(jsonFile.open(QIODevice::ReadOnly), qPrintable(jsonFilePath)); QJsonParseError parseError; const auto jsonDoc = QJsonDocument::fromJson(jsonFile.readAll(), &parseError); QVERIFY2(parseError.error == QJsonParseError::NoError, qPrintable(parseError.errorString())); const auto jsonObject = jsonDoc.object(); const QString installRoot = QDir::currentPath() + "/default/install-root"; const QString installPrefix = (toolchain == "msvc" || toolchain == "mingw" || toolchain == "emscripten") ? QString() : "/usr/local"; const QString fullInstallPrefix = installRoot + '/' + installPrefix + '/'; // Verify all binaries exist in expected locations for (auto it = jsonObject.begin(); it != jsonObject.end(); ++it) { const QString key = it.key(); const auto info = it.value().toObject(); const QString fileName = info.value("fileName").toString(); const QString installDir = testCase == "default" ? info.value("defaultInstallDir").toString() : info.value("customInstallDir").toString(); const QString subDir = info.value("subDir").toString(); const QString filePath = QDir::cleanPath( fullInstallPrefix + '/' + installDir + '/' + subDir + '/' + fileName); QVERIFY2( QFile::exists(filePath), qPrintable(QString("File does not exist: %1").arg(filePath))); } } void TestBlackbox::inputsFromDependencies() { QDir::setCurrent(testDataDir + "/inputs-from-dependencies"); QCOMPARE(runQbs(), 0); const QList output = m_qbsStdout.trimmed().split('\n'); QVERIFY2(output.contains((QDir::currentPath() + "/file1.txt").toUtf8()), m_qbsStdout.constData()); QVERIFY2(output.contains((QDir::currentPath() + "/file2.txt").toUtf8()), m_qbsStdout.constData()); QVERIFY2(output.contains((QDir::currentPath() + "/file3.txt").toUtf8()), m_qbsStdout.constData()); QVERIFY2(!output.contains((QDir::currentPath() + "/file4.txt").toUtf8()), m_qbsStdout.constData()); } void TestBlackbox::installPackage() { if (HostOsInfo::hostOs() == HostOsInfo::HostOsWindows) QSKIP("Beware of the msys tar"); QString binary = findArchiver("tar"); if (binary.isEmpty()) QSKIP("tar not found"); MacosTarHealer tarHealer; QDir::setCurrent(testDataDir + "/installpackage"); QCOMPARE(runQbs(), 0); const QString tarFilePath = relativeProductBuildDir("tar-package") + "/tar-package.tar.gz"; QVERIFY2(regularFileExists(tarFilePath), qPrintable(tarFilePath)); QProcess tarList; tarList.start(binary, QStringList() << "tf" << tarFilePath); QVERIFY2(tarList.waitForStarted(), qPrintable(tarList.errorString())); QVERIFY2(tarList.waitForFinished(), qPrintable(tarList.errorString())); const QList outputLines = tarList.readAllStandardOutput().split('\n'); QList cleanOutputLines; for (const QByteArray &line : outputLines) { const QByteArray trimmedLine = line.trimmed(); if (!trimmedLine.isEmpty()) cleanOutputLines.push_back(trimmedLine); } QCOMPARE(cleanOutputLines.size(), 3); for (const QByteArray &line : std::as_const(cleanOutputLines)) { QVERIFY2(line.contains("public_tool") || line.contains("mylib") || line.contains("lib.h"), line.constData()); } } void TestBlackbox::installRootFromProjectFile() { QDir::setCurrent(testDataDir + "/install-root-from-project-file"); const QString installRoot = QDir::currentPath() + '/' + relativeBuildDir() + "/my-install-root/"; QCOMPARE(runQbs(QbsRunParameters(QStringList("products.p.installRoot:" + installRoot))), 0); const QString installedFile = installRoot + "/install-prefix/install-dir/file.txt"; QVERIFY2(QFile::exists(installedFile), qPrintable(installedFile)); } void TestBlackbox::libraryType_data() { QTest::addColumn("libraryType"); QTest::newRow("dynamic") << QStringLiteral("dynamic"); QTest::newRow("static") << QStringLiteral("static"); } void TestBlackbox::libraryType() { QFETCH(QString, libraryType); QDir::setCurrent(testDataDir + "/library-type"); rmDirR(relativeBuildDir()); QStringList args{QStringLiteral("modules.config.build.libraryType:") + libraryType}; QCOMPARE(runQbs(QbsRunParameters("build", args)), 0); const bool isWindows = m_qbsStdout.contains("is windows: yes"); const bool isDarwin = m_qbsStdout.contains("is darwin: yes"); const bool isGcc = m_qbsStdout.contains("is gcc: yes"); QVERIFY(isWindows || isDarwin || isGcc); const QString installRoot = QDir::currentPath() + '/' + relativeBuildDir() + "/install-root"; QString filePath; if (libraryType == QLatin1String("dynamic")) { if (isWindows) { filePath = installRoot + QStringLiteral("/bin/mylib.dll"); } else if (isDarwin) { filePath = installRoot + QStringLiteral("/lib/libmylib.dylib"); } else if (isGcc) { filePath = installRoot + QStringLiteral("/lib/libmylib.so"); } } else { if (isWindows && !isGcc) { filePath = installRoot + QStringLiteral("/lib/mylib.lib"); } else { filePath = installRoot + QStringLiteral("/lib/libmylib.a"); } } if (filePath.isEmpty()) QSKIP("Cannot determine file name"); QVERIFY2(QFileInfo::exists(filePath), qPrintable(filePath)); } void TestBlackbox::pluginType_data() { QTest::addColumn("pluginType"); QTest::newRow("dynamic plugin") << QStringLiteral("pluginType:dynamic"); QTest::newRow("static plugin") << QStringLiteral("pluginType:static"); QTest::newRow("static library") << QStringLiteral("libraryType:static"); } void TestBlackbox::pluginType() { QFETCH(QString, pluginType); QDir::setCurrent(testDataDir + "/plugin-type"); rmDirR(relativeBuildDir()); QStringList args{QStringLiteral("modules.config.build.") + pluginType}; QCOMPARE(runQbs(QbsRunParameters("build", args)), 0); const bool isWindows = m_qbsStdout.contains("is windows: yes"); const bool isDarwin = m_qbsStdout.contains("is darwin: yes"); const bool isGcc = m_qbsStdout.contains("is gcc: yes"); QVERIFY(isWindows || isDarwin || isGcc); const QString installRoot = QDir::currentPath() + '/' + relativeBuildDir() + "/install-root"; const QString pluginsDir = QStringLiteral("/lib/plugin_type/plugins"); QString filePath; if (pluginType == QLatin1String("pluginType:dynamic")) { if (isWindows) { filePath = installRoot + pluginsDir + QStringLiteral("/myplugin.dll"); } else if (isDarwin) { filePath = installRoot + pluginsDir + QStringLiteral("/myplugin.bundle"); } else if (isGcc) { filePath = installRoot + pluginsDir + QStringLiteral("/libmyplugin.so"); } } else { if (isWindows && !isGcc) { filePath = installRoot + pluginsDir + QStringLiteral("/myplugin.lib"); } else { filePath = installRoot + pluginsDir + QStringLiteral("/libmyplugin.a"); } } if (filePath.isEmpty()) QSKIP("Cannot determine file name"); QVERIFY2(QFileInfo::exists(filePath), qPrintable(filePath)); } void TestBlackbox::installable() { QDir::setCurrent(testDataDir + "/installable"); QCOMPARE(runQbs(), 0); QFile installList(relativeProductBuildDir("install-list") + "/installed-files.txt"); QVERIFY2(installList.open(QIODevice::ReadOnly), qPrintable(installList.errorString())); QCOMPARE(installList.readAll().count('\n'), 2); } void TestBlackbox::installableAsAuxiliaryInput() { QDir::setCurrent(testDataDir + "/installable-as-auxiliary-input"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(m_qbsStdout.contains("f-impl"), m_qbsStdout.constData()); } void TestBlackbox::installTree() { QDir::setCurrent(testDataDir + "/install-tree"); QbsRunParameters params; params.command = "install"; QCOMPARE(runQbs(params), 0); const QString installRoot = relativeBuildDir() + "/install-root/"; QVERIFY(QFile::exists(installRoot + "content/foo.txt")); QVERIFY(QFile::exists(installRoot + "content/subdir1/bar.txt")); QVERIFY(QFile::exists(installRoot + "content/subdir2/baz.txt")); } void TestBlackbox::invalidArtifactPath_data() { QTest::addColumn("baseDir"); QTest::addColumn("isValid"); QTest::newRow("inside, normal case") << "subdir" << true; QTest::newRow("inside, build dir 1") << "project.buildDirectory" << true; QTest::newRow("inside, build dir 2") << "subdir/.." << true; QTest::newRow("outside, absolute") << "/tmp" << false; QTest::newRow("outside, relative 1") << "../../" << false; QTest::newRow("outside, relative 2") << "subdir/../../.." << false; } void TestBlackbox::invalidArtifactPath() { QFETCH(QString, baseDir); QFETCH(bool, isValid); rmDirR(relativeBuildDir()); QDir::setCurrent(testDataDir + "/invalid-artifact-path"); QbsRunParameters params(QStringList("project.artifactDir:" + baseDir)); params.expectFailure = !isValid; QCOMPARE(runQbs(params) == 0, isValid); if (!isValid) QVERIFY2(m_qbsStderr.contains("outside of build directory"), m_qbsStderr.constData()); } void TestBlackbox::invalidCommandProperty_data() { QTest::addColumn("errorType"); QTest::newRow("assigning QObject") << QString("qobject"); QTest::newRow("assigning input artifact") << QString("input"); QTest::newRow("assigning other artifact") << QString("artifact"); } void TestBlackbox::invalidCommandProperty() { QDir::setCurrent(testDataDir + "/invalid-command-property"); QFETCH(QString, errorType); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("products.p.errorType:" + errorType))), 0); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("unsuitable"), m_qbsStderr.constData()); } void TestBlackbox::invalidLibraryNames() { QDir::setCurrent(testDataDir + "/invalid-library-names"); QFETCH(QString, index); QFETCH(bool, success); QFETCH(QStringList, diagnostics); QbsRunParameters params(QStringList("project.valueIndex:" + index)); params.expectFailure = !success; QCOMPARE(runQbs(params) == 0, success); for (const QString &diag : std::as_const(diagnostics)) QVERIFY2(m_qbsStderr.contains(diag.toLocal8Bit()), m_qbsStderr.constData()); } void TestBlackbox::invalidLibraryNames_data() { QTest::addColumn("index"); QTest::addColumn("success"); QTest::addColumn("diagnostics"); QTest::newRow("null") << "0" << false << QStringList("is null"); QTest::newRow("undefined") << "1" << false << QStringList("is undefined"); QTest::newRow("number") << "2" << false << QStringList("does not have string type"); QTest::newRow("array") << "3" << false << QStringList("does not have string type"); QTest::newRow("empty string") << "4" << true << (QStringList() << "WARNING: Removing empty string from value of property " "'cpp.dynamicLibraries' in product 'invalid-library-names'." << "WARNING: Removing empty string from value of property " "'cpp.staticLibraries' in product 'invalid-library-names'."); } void TestBlackbox::invalidExtensionInstantiation() { rmDirR(relativeBuildDir()); QDir::setCurrent(testDataDir + "/invalid-extension-instantiation"); QbsRunParameters params; params.expectFailure = true; params.arguments << (QString("products.theProduct.extension:") + QTest::currentDataTag()); QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("invalid-extension-instantiation.qbs:17") && m_qbsStderr.contains('\'' + QByteArray(QTest::currentDataTag()) + "' cannot be instantiated"), m_qbsStderr.constData()); } void TestBlackbox::invalidExtensionInstantiation_data() { QTest::addColumn("dummy"); QTest::newRow("Environment"); QTest::newRow("File"); QTest::newRow("FileInfo"); QTest::newRow("Utilities"); } void TestBlackbox::invalidInstallDir() { QDir::setCurrent(testDataDir + "/invalid-install-dir"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("outside of install root"), m_qbsStderr.constData()); } void TestBlackbox::cli() { int status; findCli(&status); QCOMPARE(status, 0); const SettingsPtr s = settings(); qbs::Profile p("qbs_autotests-cli", s.get()); if (!p.exists()) QSKIP("No suitable Common Language Infrastructure test profile"); QDir::setCurrent(testDataDir + "/cli"); QbsRunParameters params(QStringList() << "-f" << "dotnettest.qbs"); params.profile = p.name(); status = runQbs(params); if (p.value("cli.toolchainInstallPath").toString().isEmpty() && status != 0 && m_qbsStderr.contains("toolchainInstallPath")) QSKIP("cli.toolchainInstallPath not set and automatic detection failed"); QCOMPARE(status, 0); rmDirR(relativeBuildDir()); QbsRunParameters params2(QStringList() << "-f" << "fshello.qbs"); params2.profile = p.name(); QCOMPARE(runQbs(params2), 0); rmDirR(relativeBuildDir()); } void TestBlackbox::combinedSources() { QDir::setCurrent(testDataDir + "/combined-sources"); QbsRunParameters params(QStringList("modules.cpp.combineCxxSources:false")); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("compiling main.cpp")); QVERIFY(m_qbsStdout.contains("compiling combinable.cpp")); QVERIFY(m_qbsStdout.contains("compiling uncombinable.cpp")); QVERIFY(!m_qbsStdout.contains("compiling amalgamated_theapp.cpp")); params.arguments = QStringList("modules.cpp.combineCxxSources:true"); params.command = "resolve"; QCOMPARE(runQbs(params), 0); WAIT_FOR_NEW_TIMESTAMP(); touch("combinable.cpp"); touch("main.cpp"); touch("uncombinable.cpp"); params.command = "build"; QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling main.cpp")); QVERIFY(!m_qbsStdout.contains("compiling combinable.cpp")); QVERIFY(m_qbsStdout.contains("compiling uncombinable.cpp")); QVERIFY(m_qbsStdout.contains("compiling amalgamated_theapp.cpp")); } void TestBlackbox::commandFile() { QDir::setCurrent(testDataDir + "/command-file"); QbsRunParameters params(QStringList() << "-p" << "theLib"); QCOMPARE(runQbs(params), 0); params.arguments = QStringList() << "-p" << "theApp"; QCOMPARE(runQbs(params), 0); } void TestBlackbox::compilerDefinesByLanguage() { QDir::setCurrent(testDataDir + "/compilerDefinesByLanguage"); QbsRunParameters params(QStringList { "-f", "compilerDefinesByLanguage.qbs" }); QCOMPARE(runQbs(params), 0); } void TestBlackbox::cppLibrary() { QDir::setCurrent(testDataDir + "/cpp-library"); QCOMPARE(runQbs(), 0); // Determine target OS from qbs output const bool isWindows = m_qbsStdout.contains("is windows"); const bool isDarwin = m_qbsStdout.contains("is darwin"); const bool isUnix = m_qbsStdout.contains("is unix"); const bool isEmscripten = m_qbsStdout.contains("is emscripten"); QVERIFY(isWindows || isDarwin || isUnix || isEmscripten); const QString libExtension = isWindows ? ".dll" : (isDarwin ? ".dylib" : ".so"); const QString libDir = relativeBuildDir() + "/install-root/" + (isWindows ? "/bin/" : "/lib/"); const QString libFile = (isWindows ? "testlib" : "libtestlib") + libExtension; QVERIFY(QFileInfo(libDir + libFile).exists()); // Test header installation - headers should be installed in subdirectories const QString publicHeaderPath = relativeBuildDir() + "/install-root/include/cpp-library/testlib/TestLib.h"; const QString privateHeaderPath = relativeBuildDir() + "/install-root/include/cpp-library/testlib/private/TestLibPrivate.h"; QVERIFY(QFileInfo(publicHeaderPath).exists()); QVERIFY(QFileInfo(privateHeaderPath).exists()); } void TestBlackbox::jsExtensionsFile() { QDir::setCurrent(testDataDir + "/jsextensions-file"); QFile fileToMove("tomove.txt"); QVERIFY2(fileToMove.open(QIODevice::WriteOnly), qPrintable(fileToMove.errorString())); fileToMove.close(); fileToMove.setPermissions(fileToMove.permissions() & ~(QFile::ReadUser | QFile::ReadOwner | QFile::ReadGroup | QFile::ReadOther)); QbsRunParameters params(QStringList() << "-f" << "file.qbs"); QCOMPARE(runQbs(params), 0); QVERIFY(!QFileInfo("original.txt").exists()); QFile copy("copy.txt"); QVERIFY(copy.exists()); QVERIFY(copy.open(QIODevice::ReadOnly)); const QList lines = copy.readAll().trimmed().split('\n'); QCOMPARE(lines.size(), 2); QCOMPARE(lines.at(0).trimmed().constData(), "false"); QCOMPARE(lines.at(1).trimmed().constData(), "true"); } void TestBlackbox::jsExtensionsFileInfo() { QDir::setCurrent(testDataDir + "/jsextensions-fileinfo"); QbsRunParameters params(QStringList() << "-f" << "fileinfo.qbs"); QCOMPARE(runQbs(params), 0); QFile output("output.txt"); QVERIFY(output.exists()); QVERIFY(output.open(QIODevice::ReadOnly)); const QList lines = output.readAll().trimmed().split('\n'); QCOMPARE(lines.size(), 28); int i = 0; QCOMPARE(lines.at(i++).trimmed().constData(), "blubb"); QCOMPARE(lines.at(i++).trimmed().constData(), qUtf8Printable( QFileInfo(QDir::currentPath()).canonicalFilePath())); QCOMPARE(lines.at(i++).trimmed().constData(), "/usr/bin"); QCOMPARE(lines.at(i++).trimmed().constData(), "blubb.tar"); QCOMPARE(lines.at(i++).trimmed().constData(), "blubb.tar.gz"); QCOMPARE(lines.at(i++).trimmed().constData(), "/tmp/blubb.tar.gz"); QCOMPARE(lines.at(i++).trimmed().constData(), "c:/tmp/blubb.tar.gz"); QCOMPARE(lines.at(i++).trimmed().constData(), "true"); QCOMPARE(lines.at(i++).trimmed().constData(), HostOsInfo::isWindowsHost() ? "true" : "false"); QCOMPARE(lines.at(i++).trimmed().constData(), "false"); QCOMPARE(lines.at(i++).trimmed().constData(), "true"); QCOMPARE(lines.at(i++).trimmed().constData(), "false"); QCOMPARE(lines.at(i++).trimmed().constData(), "false"); QCOMPARE(lines.at(i++).trimmed().constData(), "/tmp/blubb.tar.gz"); QCOMPARE(lines.at(i++).trimmed().constData(), "/tmp/blubb.tar.gz"); QCOMPARE(lines.at(i++).trimmed().constData(), "/tmp"); QCOMPARE(lines.at(i++).trimmed().constData(), "/tmp"); QCOMPARE(lines.at(i++).trimmed().constData(), "/"); QCOMPARE(lines.at(i++).trimmed().constData(), HostOsInfo::isWindowsHost() ? "d:/" : "d:"); QCOMPARE(lines.at(i++).trimmed().constData(), "d:"); QCOMPARE(lines.at(i++).trimmed().constData(), "d:/"); QCOMPARE(lines.at(i++).trimmed().constData(), "blubb.tar.gz"); QCOMPARE(lines.at(i++).trimmed().constData(), "tmp/blubb.tar.gz"); QCOMPARE(lines.at(i++).trimmed().constData(), "../blubb.tar.gz"); QCOMPARE(lines.at(i++).trimmed().constData(), "\\tmp\\blubb.tar.gz"); QCOMPARE(lines.at(i++).trimmed().constData(), "c:\\tmp\\blubb.tar.gz"); QCOMPARE(lines.at(i++).trimmed().constData(), qUtf8Printable(HostOsInfo::pathListSeparator())); QCOMPARE(lines.at(i++).trimmed().constData(), qUtf8Printable(HostOsInfo::pathSeparator())); } void TestBlackbox::jsExtensionsHost() { QDir::setCurrent(testDataDir + "//jsextensions-host"); QbsRunParameters params(QStringList { "-f", "host.qbs" }); QCOMPARE(runQbs(params), 0); QFile output("output.txt"); QVERIFY(output.exists()); QVERIFY(output.open(QIODevice::ReadOnly)); const QList lines = output.readAll().trimmed().split('\n'); QCOMPARE(lines.size(), 10); int i = 0; QCOMPARE(lines.at(i++).trimmed().constData(), "architecture: " + HostOsInfo::hostOSArchitecture()); QStringList list; for (const auto &s : HostOsInfo::canonicalOSIdentifiers(HostOsInfo::hostOSIdentifier())) list.push_back(s); QCOMPARE(lines.at(i++).trimmed().constData(), "os: " + list.join(',')); QCOMPARE(lines.at(i++).trimmed().constData(), "platform: " + HostOsInfo::hostOSIdentifier()); QCOMPARE(lines.at(i++).trimmed().constData(), "osVersion: " + HostOsInfo::hostOsVersion().toString()); QCOMPARE(lines.at(i++).trimmed().constData(), "osBuildVersion: " + (HostOsInfo::hostOsBuildVersion().isNull() ? "undefined" : HostOsInfo::hostOsBuildVersion())); QCOMPARE(lines.at(i++).trimmed().constData(), "osVersionParts: " + HostOsInfo::hostOsVersion().toString(',')); QCOMPARE(lines.at(i++).trimmed().constData(), "osVersionMajor: " + QString::number( HostOsInfo::hostOsVersion().majorVersion())); QCOMPARE(lines.at(i++).trimmed().constData(), "osVersionMinor: " + QString::number( HostOsInfo::hostOsVersion().minorVersion())); QCOMPARE(lines.at(i++).trimmed().constData(), "osVersionPatch: " + QString::number( HostOsInfo::hostOsVersion().patchLevel())); QString nullDevice = HostOsInfo::isWindowsHost() ? QStringLiteral("NUL") : QStringLiteral("/dev/null"); QCOMPARE(lines.at(i++).trimmed().constData(), "nullDevice: " + nullDevice); } void TestBlackbox::jsExtensionsProcess() { QDir::setCurrent(testDataDir + "/jsextensions-process"); QCOMPARE(runQbs({"resolve", {"-f", "process.qbs"}}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params(QStringList() << "-f" << "process.qbs"); QCOMPARE(runQbs(params), 0); QFile output("output.txt"); QVERIFY(output.exists()); QVERIFY(output.open(QIODevice::ReadOnly)); const QList lines = output.readAll().trimmed().split('\n'); QCOMPARE(lines.size(), 15); QCOMPARE(lines.at(0).trimmed().constData(), "0"); QVERIFY(lines.at(1).startsWith("qbs ")); QCOMPARE(lines.at(2).trimmed().constData(), "true"); QCOMPARE(lines.at(3).trimmed().constData(), "true"); QCOMPARE(lines.at(4).trimmed().constData(), "0"); QVERIFY(lines.at(5).startsWith("qbs ")); QCOMPARE(lines.at(6).trimmed().constData(), "Unknown error"); QCOMPARE(lines.at(7).trimmed().constData(), "false"); QVERIFY(lines.at(8).trimmed() != "Unknown error"); QCOMPARE(lines.at(9).trimmed().constData(), "Unknown error"); QCOMPARE(lines.at(10).trimmed().constData(), "-1"); QVERIFY(lines.at(11).trimmed() != "Unknown error"); QVERIFY(lines.at(12).startsWith("Error running ")); QCOMPARE(lines.at(13).trimmed().constData(), "should be"); QCOMPARE(lines.at(14).trimmed().constData(), "123"); } void TestBlackbox::jsExtensionsPropertyList() { if (!HostOsInfo::isMacosHost()) QSKIP("temporarily only applies on macOS"); QDir::setCurrent(testDataDir + "/jsextensions-propertylist"); QbsRunParameters params(QStringList() << "-nf" << "propertylist.qbs"); QCOMPARE(runQbs(params), 0); QFile file1("test.json"); QVERIFY(file1.exists()); QVERIFY(file1.open(QIODevice::ReadOnly)); QFile file2("test.xml"); QVERIFY(file2.exists()); QVERIFY(file2.open(QIODevice::ReadOnly)); QFile file3("test2.json"); QVERIFY(file3.exists()); QVERIFY(file3.open(QIODevice::ReadOnly)); QByteArray file1Contents = file1.readAll(); QCOMPARE(file3.readAll(), file1Contents); //QCOMPARE(file1Contents, file2.readAll()); // keys don't have guaranteed order QJsonParseError err1, err2; QCOMPARE(QJsonDocument::fromJson(file1Contents, &err1), QJsonDocument::fromJson(file2.readAll(), &err2)); QVERIFY(err1.error == QJsonParseError::NoError && err2.error == QJsonParseError::NoError); QFile file4("test.openstep.plist"); QVERIFY(file4.exists()); QFile file5("test3.json"); QVERIFY(file5.exists()); QVERIFY(file5.open(QIODevice::ReadOnly)); QVERIFY(file1Contents != file5.readAll()); } void TestBlackbox::jsExtensionsTemporaryDir() { QDir::setCurrent(testDataDir + "/jsextensions-temporarydir"); QbsRunParameters params; QCOMPARE(runQbs(params), 0); } void TestBlackbox::jsExtensionsTextFile() { QDir::setCurrent(testDataDir + "/jsextensions-textfile"); QbsRunParameters params(QStringList() << "-f" << "textfile.qbs"); QCOMPARE(runQbs(params), 0); QFile file1("file1.txt"); QVERIFY(file1.exists()); QVERIFY(file1.open(QIODevice::ReadOnly)); QCOMPARE(file1.size(), qint64(0)); QFile file2("file2.txt"); QVERIFY(file2.exists()); QVERIFY(file2.open(QIODevice::ReadOnly)); const QList lines = file2.readAll().trimmed().split('\n'); QCOMPARE(lines.size(), 6); QCOMPARE(lines.at(0).trimmed().constData(), "false"); QCOMPARE(lines.at(1).trimmed().constData(), "First line."); QCOMPARE(lines.at(2).trimmed().constData(), "Second line."); QCOMPARE(lines.at(3).trimmed().constData(), "Third line."); QCOMPARE(lines.at(4).trimmed().constData(), qPrintable(QDir::currentPath() + "/file1.txt")); QCOMPARE(lines.at(5).trimmed().constData(), "true"); } void TestBlackbox::jsExtensionsBinaryFile() { QDir::setCurrent(testDataDir + "/jsextensions-binaryfile"); QbsRunParameters params(QStringList() << "-f" << "binaryfile.qbs"); QCOMPARE(runQbs(params), 0); QFile source("source.dat"); QVERIFY(source.exists()); QVERIFY(source.open(QIODevice::ReadOnly)); QCOMPARE(source.size(), qint64(0)); QFile destination("destination.dat"); QVERIFY(destination.exists()); QVERIFY(destination.open(QIODevice::ReadOnly)); const QByteArray data = destination.readAll(); QCOMPARE(data.size(), 8); QCOMPARE(data.at(0), char(0x00)); QCOMPARE(data.at(1), char(0x01)); QCOMPARE(data.at(2), char(0x02)); QCOMPARE(data.at(3), char(0x03)); QCOMPARE(data.at(4), char(0x04)); QCOMPARE(data.at(5), char(0x05)); QCOMPARE(data.at(6), char(0x06)); QCOMPARE(data.at(7), char(0xFF)); QFile destination2("destination2.dat"); QVERIFY(destination2.exists()); QVERIFY(destination2.open(QIODevice::ReadOnly)); QCOMPARE(destination2.readAll(), data); } void TestBlackbox::lastModuleCandidateBroken() { QDir::setCurrent(testDataDir + "/last-module-candidate-broken"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("Dependency 'Foo' not found for product " "'last-module-candidate-broken'"), m_qbsStderr); } void TestBlackbox::ld() { QDir::setCurrent(testDataDir + "/ld"); QCOMPARE(runQbs(), 0); } void TestBlackbox::symbolLinkMode() { if (!HostOsInfo::isAnyUnixHost()) QSKIP("only applies on Unix"); QDir::setCurrent(testDataDir + "/symbolLinkMode"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "run"; const QStringList commonArgs{"-p", "driver", "--setup-run-env-config", "ignore-lib-dependencies", "qbs.installPrefix:''"}; rmDirR(relativeBuildDir()); params.arguments = QStringList() << commonArgs << "project.shouldInstallLibrary:true"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("somefunction existed and it returned 42"), m_qbsStdout.constData()); rmDirR(relativeBuildDir()); params.arguments = QStringList() << commonArgs << "project.shouldInstallLibrary:false"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("somefunction did not exist"), m_qbsStdout.constData()); rmDirR(relativeBuildDir()); params.arguments = QStringList() << commonArgs << "project.lazy:false"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("Lib was loaded!\nmeow\n"), m_qbsStdout.constData()); if (HostOsInfo::isMacosHost()) { rmDirR(relativeBuildDir()); params.arguments = QStringList() << commonArgs << "project.lazy:true"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("meow\n") && m_qbsStdout.contains("Lib was loaded!\n"), m_qbsStdout.constData()); } } void TestBlackbox::linkerMode() { if (!HostOsInfo::isAnyUnixHost()) QSKIP("only applies on Unix"); QDir::setCurrent(testDataDir + "/linkerMode"); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("qbs.installPrefix:''"))), 0); if (m_qbsStdout.contains("is emscripten: true")) QSKIP("not applicable for emscripten"); QVERIFY(m_qbsStdout.contains("is emscripten: false")); QCOMPARE(runQbs(), 0); auto testCondition = [&](const QString &lang, const std::function &condition) { if ((lang == "Objective-C" || lang == "Objective-C++") && HostOsInfo::hostOs() != HostOsInfo::HostOsMacos) return; const QString binary = defaultInstallRoot + "/LinkedProduct-" + lang; QProcess deptool; if (HostOsInfo::hostOs() == HostOsInfo::HostOsMacos) deptool.start("otool", QStringList() << "-L" << binary); else deptool.start("readelf", QStringList() << "-a" << binary); QVERIFY(deptool.waitForStarted()); QVERIFY(deptool.waitForFinished()); QByteArray deptoolOutput = deptool.readAllStandardOutput(); if (HostOsInfo::hostOs() != HostOsInfo::HostOsMacos) { QList lines = deptoolOutput.split('\n'); int sz = lines.size(); for (int i = 0; i < sz; ++i) { if (!lines.at(i).contains("NEEDED")) { lines.removeAt(i--); sz--; } } deptoolOutput = lines.join('\n'); } QCOMPARE(deptool.exitCode(), 0); QVERIFY2(condition(deptoolOutput), deptoolOutput.constData()); }; const QStringList nocpplangs = QStringList() << "Assembly" << "C" << "Objective-C"; for (const QString &lang : nocpplangs) testCondition(lang, [](const QByteArray &lddOutput) { return !lddOutput.contains("c++"); }); const QStringList cpplangs = QStringList() << "C++" << "Objective-C++"; for (const QString &lang : cpplangs) testCondition(lang, [](const QByteArray &lddOutput) { return lddOutput.contains("c++"); }); const QStringList objclangs = QStringList() << "Objective-C" << "Objective-C++"; for (const QString &lang : objclangs) testCondition(lang, [](const QByteArray &lddOutput) { return lddOutput.contains("objc"); }); } void TestBlackbox::linkerVariant_data() { QTest::addColumn("theType"); QTest::newRow("default") << QString(); QTest::newRow("bfd") << QString("bfd"); QTest::newRow("gold") << QString("gold"); QTest::newRow("mold") << QString("mold"); } void TestBlackbox::linkerVariant() { QDir::setCurrent(testDataDir + "/linker-variant"); QFETCH(QString, theType); QStringList resolveArgs("--force-probe-execution"); if (!theType.isEmpty()) resolveArgs << ("products.p.linkerVariant:" + theType); QCOMPARE(runQbs(QbsRunParameters("resolve", resolveArgs)), 0); const bool isGcc = m_qbsStdout.contains("is GCC: true"); const bool isNotGcc = m_qbsStdout.contains("is GCC: false"); QVERIFY2(isGcc != isNotGcc, m_qbsStdout.constData()); QbsRunParameters buildParams("build", QStringList{"--command-echo-mode", "command-line"}); buildParams.expectFailure = true; runQbs(buildParams); if (isGcc && !theType.isEmpty()) QCOMPARE(m_qbsStdout.count("-fuse-ld=" + theType.toLocal8Bit()), 1); else QVERIFY2(!m_qbsStdout.contains("-fuse-ld"), m_qbsStdout.constData()); } void TestBlackbox::linkerTypeRecursive() { QDir::setCurrent(testDataDir + "/linker-type-recursive"); QCOMPARE(runQbs(), 0); if (m_qbsStdout.contains("no host target")) QSKIP("The rest of the test only applies to host targets"); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(m_qbsStdout.contains("Hi!"), m_qbsStdout.constData()); } void TestBlackbox::lexyacc() { if (!lexYaccExist()) QSKIP("lex or yacc not present"); QDir::setCurrent(testDataDir + "/lexyacc/one-grammar"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); const QString parserBinary = relativeExecutableFilePath("one-grammar", m_qbsStdout); QCOMPARE(runQbs(), 0); QProcess p; const QByteArray magicString = "add to PATH: "; const int magicStringIndex = m_qbsStdout.indexOf(magicString); if (magicStringIndex != -1) { const int newLineIndex = m_qbsStdout.indexOf('\n', magicStringIndex); QVERIFY(newLineIndex != -1); const int dirIndex = magicStringIndex + magicString.length(); const QString dir = QString::fromLocal8Bit(m_qbsStdout.mid(dirIndex, newLineIndex - dirIndex)); QProcessEnvironment env; env.insert("PATH", dir); p.setProcessEnvironment(env); } p.start(parserBinary, QStringList()); QVERIFY2(p.waitForStarted(), qPrintable(p.errorString())); p.write("a && b || c && !d"); p.closeWriteChannel(); QVERIFY2(p.waitForFinished(), qPrintable(p.errorString())); QVERIFY2(p.exitCode() == 0, p.readAllStandardError().constData()); const QByteArray parserOutput = p.readAllStandardOutput(); QVERIFY2(parserOutput.contains("OR AND a b AND c NOT d"), parserOutput.constData()); QDir::setCurrent(testDataDir + "/lexyacc/two-grammars"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); params.expectFailure = false; params.command = "resolve"; params.arguments << (QStringList() << "modules.lex_yacc.uniqueSymbolPrefix:true"); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStderr.contains("whatever"), m_qbsStderr.constData()); params.arguments << "modules.lex_yacc.enableCompilerWarnings:true"; QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); const QByteArray outputToCheck = m_qbsStdout + m_qbsStderr; QVERIFY2(outputToCheck.contains("whatever"), outputToCheck.constData()); } void TestBlackbox::lexyaccOutputs() { if (!lexYaccExist()) QSKIP("lex or yacc not present"); QFETCH(QString, lexOutputFilePath); QFETCH(QString, yaccOutputFilePath); QbsRunParameters params; if (!lexOutputFilePath.isEmpty()) params.arguments << "modules.lex_yacc.lexOutputFilePath:" + lexOutputFilePath; if (!yaccOutputFilePath.isEmpty()) params.arguments << "modules.lex_yacc.yaccOutputFilePath:" + yaccOutputFilePath; #define VERIFY_COMPILATION(file) \ if (!file.isEmpty()) { \ QByteArray expected = "compiling " + file.toUtf8(); \ if (!m_qbsStdout.contains(expected)) { \ qDebug() << "Expected output:" << expected; \ qDebug() << "Actual output:" << m_qbsStdout; \ QFAIL("Expected stdout content missing."); \ } \ } const auto version = bisonVersion(); if (version >= qbs::Version(2, 6)) { // prefix only supported starting from bison 2.6 QVERIFY(QDir::setCurrent(testDataDir + "/lexyacc/lex_prefix")); rmDirR(relativeBuildDir()); QCOMPARE(runQbs(params), 0); VERIFY_COMPILATION(yaccOutputFilePath); } QVERIFY(QDir::setCurrent(testDataDir + "/lexyacc/lex_outfile")); rmDirR(relativeBuildDir()); QCOMPARE(runQbs(params), 0); VERIFY_COMPILATION(yaccOutputFilePath); if (version >= qbs::Version(2, 4)) { // output syntax was changed in bison 2.4 QVERIFY(QDir::setCurrent(testDataDir + "/lexyacc/yacc_output")); rmDirR(relativeBuildDir()); QCOMPARE(runQbs(params), 0); VERIFY_COMPILATION(lexOutputFilePath); } #undef VERIFY_COMPILATION } void TestBlackbox::lexyaccOutputs_data() { QTest::addColumn("lexOutputFilePath"); QTest::addColumn("yaccOutputFilePath"); QTest::newRow("none") << QString() << QString(); QTest::newRow("lexOutputFilePath") << QString{"lex_luthor.cpp"} << QString(); QTest::newRow("yaccOutputFilePath") << QString() << QString{"shaven_yak.cpp"}; } void TestBlackbox::linkerLibraryDuplicates() { QDir::setCurrent(testDataDir + "/linker-library-duplicates"); rmDirR(relativeBuildDir()); QFETCH(QString, removeDuplicateLibraries); QStringList runParams; if (!removeDuplicateLibraries.isEmpty()) runParams.append(removeDuplicateLibraries); QCOMPARE(runQbs(QbsRunParameters("resolve", runParams)), 0); const bool isGcc = m_qbsStdout.contains("is gcc: true"); const bool isNotGcc = m_qbsStdout.contains("is gcc: false"); if (isNotGcc) QSKIP("linkerLibraryDuplicates test only applies to GCC toolchain"); QVERIFY(isGcc); QCOMPARE(runQbs(QStringList { "--command-echo-mode", "command-line" }), 0); const QByteArrayList output = m_qbsStdout.split('\n'); QByteArray linkLine; for (const QByteArray &line : output) { if (line.contains("main.cpp.o")) linkLine = line; } QVERIFY(!linkLine.isEmpty()); /* Now check the the libraries appear just once. In order to avoid dealing * with the different file extensions used in different platforms, we check * only for the library base name. But we must also take into account that * the build directories of each library will contain the library base name, * so we now exclude them. */ QByteArrayList elementsWithoutPath; for (const QByteArray &element: linkLine.split(' ')) { if (element.indexOf('/') < 0) elementsWithoutPath.append(element); } QByteArray pathLessLinkLine = elementsWithoutPath.join(' '); typedef QMap ObjectCount; QFETCH(ObjectCount, expectedObjectCount); for (auto i = expectedObjectCount.begin(); i != expectedObjectCount.end(); i++) { QCOMPARE(pathLessLinkLine.count(i.key()), i.value()); } } void TestBlackbox::linkerLibraryDuplicates_data() { typedef QMap ObjectCount; QTest::addColumn("removeDuplicateLibraries"); QTest::addColumn("expectedObjectCount"); QTest::newRow("default") << QString() << ObjectCount { { "lib1", 1 }, { "lib2", 1 }, { "lib3", 1 }, }; QTest::newRow("enabled") << "modules.cpp.removeDuplicateLibraries:true" << ObjectCount { { "lib1", 1 }, { "lib2", 1 }, { "lib3", 1 }, }; QTest::newRow("disabled") << "modules.cpp.removeDuplicateLibraries:false" << ObjectCount { { "lib1", 3 }, { "lib2", 2 }, { "lib3", 1 }, }; } void TestBlackbox::linkerScripts() { const QString sourceDir = QDir::cleanPath(testDataDir + "/linkerscripts"); QbsRunParameters runParams("resolve", {"qbs.installRoot:" + QDir::currentPath()}); runParams.buildDirectory = sourceDir + "/build"; runParams.workingDir = sourceDir; QCOMPARE(runQbs(runParams), 0); const bool isGcc = m_qbsStdout.contains("is Linux gcc: true"); const bool isNotGcc = m_qbsStdout.contains("is Linux gcc: false"); if (isNotGcc) QSKIP("linker script test only applies to Linux"); QVERIFY(isGcc); runParams.command = "build"; QCOMPARE(runQbs(runParams), 0); const QString output = QString::fromLocal8Bit(m_qbsStderr); const QRegularExpression pattern(QRegularExpression::anchoredPattern(".*---(.*)---.*"), QRegularExpression::DotMatchesEverythingOption); const QRegularExpressionMatch match = pattern.match(output); QVERIFY2(match.hasMatch(), qPrintable(output)); QCOMPARE(pattern.captureCount(), 1); const QString nmPath = match.captured(1); if (!QFile::exists(nmPath)) QSKIP("Cannot check for symbol presence: No nm found."); const auto verifySymbols = [nmPath](const QByteArrayList& symbols) -> bool { QProcess nm; nm.start(nmPath, QStringList(QDir::currentPath() + "/liblinkerscripts.so")); if (!nm.waitForStarted()) { qDebug() << "Wait for process started failed."; return false; } if (!nm.waitForFinished()) { qDebug() << "Wait for process finished failed."; return false; } if (nm.exitCode() != 0) { qDebug() << "nm returned exit code " << nm.exitCode(); return false; } const QByteArray nmOutput = nm.readAllStandardOutput(); for (const QByteArray& symbol : symbols) { if (!nmOutput.contains(symbol)) { qDebug() << "Expected symbol" << symbol << "not found in" << nmOutput.constData(); return false; } } return true; }; QVERIFY(verifySymbols({"TEST_SYMBOL1", "TEST_SYMBOL2", "TEST_SYMBOL_FROM_INCLUDE", "TEST_SYMBOL_FROM_DIRECTORY", "TEST_SYMBOL_FROM_RECURSIVE"})); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(sourceDir + "/linkerscript_to_include", "TEST_SYMBOL_FROM_INCLUDE = 1;", "TEST_SYMBOL_FROM_INCLUDE_MODIFIED = 1;\n"); QCOMPARE(runQbs(runParams), 0); QVERIFY2(m_qbsStdout.contains("linking liblinkerscripts.so"), "No linking after modifying included file"); QVERIFY(verifySymbols({"TEST_SYMBOL1", "TEST_SYMBOL2", "TEST_SYMBOL_FROM_INCLUDE_MODIFIED", "TEST_SYMBOL_FROM_DIRECTORY", "TEST_SYMBOL_FROM_RECURSIVE"})); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(sourceDir + "/scripts/linkerscript_in_directory", "TEST_SYMBOL_FROM_DIRECTORY = 1;\n", "TEST_SYMBOL_FROM_DIRECTORY_MODIFIED = 1;\n"); QCOMPARE(runQbs(runParams), 0); QVERIFY2(m_qbsStdout.contains("linking liblinkerscripts.so"), "No linking after modifying file in directory"); QVERIFY(verifySymbols({"TEST_SYMBOL1", "TEST_SYMBOL2", "TEST_SYMBOL_FROM_INCLUDE_MODIFIED", "TEST_SYMBOL_FROM_DIRECTORY_MODIFIED", "TEST_SYMBOL_FROM_RECURSIVE"})); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(sourceDir + "/linkerscript_recursive", "TEST_SYMBOL_FROM_RECURSIVE = 1;\n", "TEST_SYMBOL_FROM_RECURSIVE_MODIFIED = 1;\n"); QCOMPARE(runQbs(runParams), 0); QVERIFY2(m_qbsStdout.contains("linking liblinkerscripts.so"), "No linking after modifying recursive file"); QVERIFY(verifySymbols({"TEST_SYMBOL1", "TEST_SYMBOL2", "TEST_SYMBOL_FROM_INCLUDE_MODIFIED", "TEST_SYMBOL_FROM_DIRECTORY_MODIFIED", "TEST_SYMBOL_FROM_RECURSIVE_MODIFIED"})); } void TestBlackbox::linkerModuleDefinition() { QDir::setCurrent(testDataDir + "/linker-module-definition"); QCOMPARE(runQbs({"build"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs({"run"}), 0); const auto verifyOutput = [this](const QByteArrayList &symbols) { for (const QByteArray &symbol : symbols) { if (!m_qbsStdout.contains(symbol)) { qDebug() << "Expected symbol" << symbol << "not found in" << m_qbsStdout; return false; } } return true; }; QVERIFY(verifyOutput({"foo", "bar"})); } void TestBlackbox::listProducts() { QDir::setCurrent(testDataDir + "/list-products"); QCOMPARE(runQbs(QbsRunParameters("list-products")), 0); m_qbsStdout.replace("\r\n", "\n"); QVERIFY2(m_qbsStdout.contains( "a\n" "b {\"architecture\":\"mips\",\"buildVariant\":\"debug\"}\n" "b {\"architecture\":\"mips\",\"buildVariant\":\"release\"}\n" "b {\"architecture\":\"vax\",\"buildVariant\":\"debug\"}\n" "b {\"architecture\":\"vax\",\"buildVariant\":\"release\"}\n" "c\n"), m_qbsStdout.constData()); } void TestBlackbox::listPropertiesWithOuter() { QDir::setCurrent(testDataDir + "/list-properties-with-outer"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("listProp: [\"product\",\"higher\",\"group\"]"), m_qbsStdout.constData()); } void TestBlackbox::listPropertyOrder() { QDir::setCurrent(testDataDir + "/list-property-order"); const QbsRunParameters params(QStringList() << "-q"); QCOMPARE(runQbs(params), 0); const QByteArray firstOutput = m_qbsStderr; QVERIFY(firstOutput.contains("listProp = [\"product\",\"higher3\",\"higher2\",\"higher1\",\"lower\"]")); for (int i = 0; i < 25; ++i) { rmDirR(relativeBuildDir()); QCOMPARE(runQbs(params), 0); if (m_qbsStderr != firstOutput) break; } QCOMPARE(m_qbsStderr.constData(), firstOutput.constData()); } void TestBlackbox::require() { QDir::setCurrent(testDataDir + "/require"); QCOMPARE(runQbs(), 0); } void TestBlackbox::rescueTransformerData() { QDir::setCurrent(testDataDir + "/rescue-transformer-data"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp") && m_qbsStdout.contains("m.p: undefined"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("main.cpp"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp") && !m_qbsStdout.contains("m.p: "), m_qbsStdout.constData()); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("modules.m.p:true"))), 0); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp") && m_qbsStdout.contains("m.p: true"), m_qbsStdout.constData()); } void TestBlackbox::multipleChanges() { QDir::setCurrent(testDataDir + "/multiple-changes"); QCOMPARE(runQbs(), 0); QFile newFile("test.blubb"); QVERIFY(newFile.open(QIODevice::WriteOnly)); newFile.close(); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList() << "project.prop:true")), 0); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("prop: true")); } void TestBlackbox::multipleConfigurations() { QDir::setCurrent(testDataDir + "/multiple-configurations"); QbsRunParameters params(QStringList{"config:x", "config:y", "config:z"}); params.profile.clear(); struct DefaultProfileSwitcher { DefaultProfileSwitcher() { const SettingsPtr s = settings(); oldDefaultProfile = s->defaultProfile(); s->setValue("defaultProfile", profileName()); s->sync(); } ~DefaultProfileSwitcher() { const SettingsPtr s = settings(); s->setValue("defaultProfile", oldDefaultProfile); s->sync(); } QVariant oldDefaultProfile; }; DefaultProfileSwitcher dps; QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStdout.count("compiling lib.cpp"), 3); QCOMPARE(m_qbsStdout.count("compiling file.cpp"), 3); QCOMPARE(m_qbsStdout.count("compiling main.cpp"), 3); } void TestBlackbox::multiplexedTool() { QDir::setCurrent(testDataDir + "/multiplexed-tool"); QCOMPARE(runQbs(QStringLiteral("resolve")), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(), 0); QCOMPARE(m_qbsStdout.count("creating tool.out"), 4); } void TestBlackbox::nestedGroups() { QDir::setCurrent(testDataDir + "/nested-groups"); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(relativeExecutableFilePath("nested-groups", m_qbsStdout))); } void TestBlackbox::nestedProperties() { QDir::setCurrent(testDataDir + "/nested-properties"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("value in higherlevel"), m_qbsStdout.constData()); } void TestBlackbox::newOutputArtifact() { QDir::setCurrent(testDataDir + "/new-output-artifact"); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(relativeBuildDir() + "/install-root/output_98.out")); const QString the100thArtifact = relativeBuildDir() + "/install-root/output_99.out"; QVERIFY(!regularFileExists(the100thArtifact)); QbsRunParameters params("resolve", QStringList() << "products.theProduct.artifactCount:100"); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(the100thArtifact)); } void TestBlackbox::noExportedSymbols_data() { QTest::addColumn("link"); QTest::addColumn("dryRun"); QTest::newRow("link") << true << false; QTest::newRow("link (dry run)") << true << true; QTest::newRow("do not link") << false << false; } void TestBlackbox::noExportedSymbols() { QDir::setCurrent(testDataDir + "/no-exported-symbols"); QFETCH(bool, link); QFETCH(bool, dryRun); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList{"--force-probe-execution", QString("products.the_app.link:") + (link ? "true" : "false")})), 0); const bool isMsvc = m_qbsStdout.contains("compiler is MSVC"); const bool isNotMsvc = m_qbsStdout.contains("compiler is not MSVC"); QVERIFY2(isMsvc || isNotMsvc, m_qbsStdout.constData()); if (isNotMsvc) QSKIP("Test applies with MSVC only"); QbsRunParameters buildParams; if (dryRun) buildParams.arguments << "--dry-run"; buildParams.expectFailure = link && !dryRun; QCOMPARE(runQbs(buildParams) == 0, !buildParams.expectFailure); QVERIFY2(m_qbsStderr.contains("This typically happens when a DLL does not export " "any symbols.") == buildParams.expectFailure, m_qbsStderr.constData()); } void TestBlackbox::noProfile() { QDir::setCurrent(testDataDir + "/no-profile"); QbsRunParameters params; params.profile = "none"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("profile: none"), m_qbsStdout.constData()); } void TestBlackbox::noSuchProfile() { QDir::setCurrent(testDataDir + "/no-such-profile"); QbsRunParameters params(QStringList("products.theProduct.p:1")); params.profile = "jibbetnich"; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("Profile 'jibbetnich' does not exist"), m_qbsStderr.constData()); } void TestBlackbox::nonBrokenFilesInBrokenProduct() { QDir::setCurrent(testDataDir + "/non-broken-files-in-broken-product"); QbsRunParameters params(QStringList() << "-k"); params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY(m_qbsStdout.contains("fine.cpp")); QVERIFY(runQbs(params) != 0); QVERIFY(!m_qbsStdout.contains("fine.cpp")); // The non-broken file must not be recompiled. } void TestBlackbox::nonDefaultProduct() { QDir::setCurrent(testDataDir + "/non-default-product"); QCOMPARE(runQbs(), 0); const QString defaultAppExe = relativeExecutableFilePath("default app", m_qbsStdout); const QString nonDefaultAppExe = relativeExecutableFilePath("non-default app", m_qbsStdout); QVERIFY2(QFile::exists(defaultAppExe), qPrintable(defaultAppExe)); QVERIFY2(!QFile::exists(nonDefaultAppExe), qPrintable(nonDefaultAppExe)); QCOMPARE(runQbs(QbsRunParameters(QStringList() << "--all-products")), 0); QVERIFY2(QFile::exists(nonDefaultAppExe), qPrintable(nonDefaultAppExe)); } void TestBlackbox::notAlwaysUpdated() { QDir::setCurrent(testDataDir + "/not-always-updated"); QCOMPARE(runQbs(), 0); QCOMPARE(runQbs(), 0); } static void switchProfileContents(qbs::Profile &p, qbs::Settings *s, bool on) { const QString scalarKey = "leaf.scalarProp"; const QString listKey = "leaf.listProp"; if (on) { p.setValue(scalarKey, "profile"); p.setValue(listKey, QStringList() << "profile"); } else { p.remove(scalarKey); p.remove(listKey); } s->sync(); } static void switchFileContents(QFile &f, bool on) { f.seek(0); QByteArray contents = f.readAll(); f.resize(0); if (on) contents.replace("// leaf.", "leaf."); else contents.replace("leaf.", "// leaf."); f.write(contents); f.flush(); } void TestBlackbox::propertyPrecedence() { QDir::setCurrent(testDataDir + "/property-precedence"); const SettingsPtr s = settings(); qbs::Internal::TemporaryProfile profile("qbs_autotests_propPrecedence", s.get()); profile.p.setValue("qbs.architecture", "x86"); // Profiles must not be empty... s->sync(); const QStringList args = QStringList() << "-f" << "property-precedence.qbs"; QbsRunParameters params(args); params.profile = profile.p.name(); QbsRunParameters resolveParams = params; resolveParams.command = "resolve"; // Case 1: [cmdline=0,prod=0,export=0,nonleaf=0,profile=0] QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QVERIFY2(m_qbsStdout.contains("scalar prop: leaf\n") && m_qbsStdout.contains("list prop: [\"leaf\"]\n"), m_qbsStdout.constData()); params.arguments.clear(); // Case 2: [cmdline=0,prod=0,export=0,nonleaf=0,profile=1] switchProfileContents(profile.p, s.get(), true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: profile\n") && m_qbsStdout.contains("list prop: [\"profile\"]\n"), m_qbsStdout.constData()); // Case 3: [cmdline=0,prod=0,export=0,nonleaf=1,profile=0] QFile nonleafFile("modules/nonleaf/nonleaf.qbs"); QVERIFY2(nonleafFile.open(QIODevice::ReadWrite), qPrintable(nonleafFile.errorString())); switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: nonleaf\n") && m_qbsStdout.contains("list prop: [\"nonleaf\",\"leaf\"]\n"), m_qbsStdout.constData()); // Case 4: [cmdline=0,prod=0,export=0,nonleaf=1,profile=1] switchProfileContents(profile.p, s.get(), true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: nonleaf\n") && m_qbsStdout.contains("list prop: [\"nonleaf\",\"profile\"]\n"), m_qbsStdout.constData()); // Case 5: [cmdline=0,prod=0,export=1,nonleaf=0,profile=0] QFile depFile("dep.qbs"); QVERIFY2(depFile.open(QIODevice::ReadWrite), qPrintable(depFile.errorString())); switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, false); switchFileContents(depFile, true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: export\n") && m_qbsStdout.contains("list prop: [\"export\",\"leaf\"]\n"), m_qbsStdout.constData()); // Case 6: [cmdline=0,prod=0,export=1,nonleaf=0,profile=1] switchProfileContents(profile.p, s.get(), true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: export\n") && m_qbsStdout.contains("list prop: [\"export\",\"profile\"]\n"), m_qbsStdout.constData()); // Case 7: [cmdline=0,prod=0,export=1,nonleaf=1,profile=0] switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: export\n") && m_qbsStdout.contains("list prop: [\"export\",\"nonleaf\",\"leaf\"]\n"), m_qbsStdout.constData()); // Case 8: [cmdline=0,prod=0,export=1,nonleaf=1,profile=1] switchProfileContents(profile.p, s.get(), true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: export\n") && m_qbsStdout.contains("list prop: [\"export\",\"nonleaf\",\"profile\"]\n"), m_qbsStdout.constData()); // Case 9: [cmdline=0,prod=1,export=0,nonleaf=0,profile=0] QFile productFile("property-precedence.qbs"); QVERIFY2(productFile.open(QIODevice::ReadWrite), qPrintable(productFile.errorString())); switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, false); switchFileContents(depFile, false); switchFileContents(productFile, true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: product\n") && m_qbsStdout.contains("list prop: [\"product\",\"leaf\"]\n"), m_qbsStdout.constData()); // Case 10: [cmdline=0,prod=1,export=0,nonleaf=0,profile=1] switchProfileContents(profile.p, s.get(), true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: product\n") && m_qbsStdout.contains("list prop: [\"product\",\"profile\"]\n"), m_qbsStdout.constData()); // Case 11: [cmdline=0,prod=1,export=0,nonleaf=1,profile=0] switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: product\n") && m_qbsStdout.contains("list prop: [\"product\",\"nonleaf\",\"leaf\"]\n"), m_qbsStdout.constData()); // Case 12: [cmdline=0,prod=1,export=0,nonleaf=1,profile=1] switchProfileContents(profile.p, s.get(), true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: product\n") && m_qbsStdout.contains("list prop: [\"product\",\"nonleaf\",\"profile\"]\n"), m_qbsStdout.constData()); // Case 13: [cmdline=0,prod=1,export=1,nonleaf=0,profile=0] switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, false); switchFileContents(depFile, true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: product\n") && m_qbsStdout.contains("list prop: [\"product\",\"export\",\"leaf\"]\n"), m_qbsStdout.constData()); // Case 14: [cmdline=0,prod=1,export=1,nonleaf=0,profile=1] switchProfileContents(profile.p, s.get(), true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: product\n") && m_qbsStdout.contains("list prop: [\"product\",\"export\",\"profile\"]\n"), m_qbsStdout.constData()); // Case 15: [cmdline=0,prod=1,export=1,nonleaf=1,profile=0] switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: product\n") && m_qbsStdout.contains("list prop: [\"product\",\"export\",\"nonleaf\",\"leaf\"]\n"), m_qbsStdout.constData()); // Case 16: [cmdline=0,prod=1,export=1,nonleaf=1,profile=1] switchProfileContents(profile.p, s.get(), true); QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: product\n") && m_qbsStdout.contains("list prop: [\"product\",\"export\",\"nonleaf\",\"profile\"]\n"), m_qbsStdout.constData()); // Command line properties wipe everything, including lists. // Case 17: [cmdline=1,prod=0,export=0,nonleaf=0,profile=0] switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, false); switchFileContents(depFile, false); switchFileContents(productFile, false); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 18: [cmdline=1,prod=0,export=0,nonleaf=0,profile=1] switchProfileContents(profile.p, s.get(), true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 19: [cmdline=1,prod=0,export=0,nonleaf=1,profile=0] switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 20: [cmdline=1,prod=0,export=0,nonleaf=1,profile=1] switchProfileContents(profile.p, s.get(), true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 21: [cmdline=1,prod=0,export=1,nonleaf=0,profile=0] switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, false); switchFileContents(depFile, true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 22: [cmdline=1,prod=0,export=1,nonleaf=0,profile=1] switchProfileContents(profile.p, s.get(), true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 23: [cmdline=1,prod=0,export=1,nonleaf=1,profile=0] switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 24: [cmdline=1,prod=0,export=1,nonleaf=1,profile=1] switchProfileContents(profile.p, s.get(), true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 25: [cmdline=1,prod=1,export=0,nonleaf=0,profile=0] switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, false); switchFileContents(depFile, false); switchFileContents(productFile, true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 26: [cmdline=1,prod=1,export=0,nonleaf=0,profile=1] switchProfileContents(profile.p, s.get(), true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 27: [cmdline=1,prod=1,export=0,nonleaf=1,profile=0] switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 28: [cmdline=1,prod=1,export=0,nonleaf=1,profile=1] switchProfileContents(profile.p, s.get(), true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 29: [cmdline=1,prod=1,export=1,nonleaf=0,profile=0] switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, false); switchFileContents(depFile, true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 30: [cmdline=1,prod=1,export=1,nonleaf=0,profile=1] switchProfileContents(profile.p, s.get(), true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 31: [cmdline=1,prod=1,export=1,nonleaf=1,profile=0] switchProfileContents(profile.p, s.get(), false); switchFileContents(nonleafFile, true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); // Case 32: [cmdline=1,prod=1,export=1,nonleaf=1,profile=1] switchProfileContents(profile.p, s.get(), true); resolveParams.arguments << "modules.leaf.scalarProp:cmdline" << "modules.leaf.listProp:cmdline"; QCOMPARE(runQbs(resolveParams), 0); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("scalar prop: cmdline\n") && m_qbsStdout.contains("list prop: [\"cmdline\"]\n"), m_qbsStdout.constData()); } void TestBlackbox::productDependenciesByType() { QDir::setCurrent(testDataDir + "/product-dependencies-by-type"); QCOMPARE(runQbs(), 0); QFile appListFile(relativeProductBuildDir("app list") + "/app-list.txt"); QVERIFY2(appListFile.open(QIODevice::ReadOnly), qPrintable(appListFile.fileName())); const QList appList = appListFile.readAll().trimmed().split('\n'); QCOMPARE(appList.size(), 6); QStringList apps = QStringList() << QDir::currentPath() + '/' + relativeExecutableFilePath("app1", m_qbsStdout) << QDir::currentPath() + '/' + relativeExecutableFilePath("app2", m_qbsStdout) << QDir::currentPath() + '/' + relativeExecutableFilePath("app3", m_qbsStdout) << QDir::currentPath() + '/' + relativeExecutableFilePath("app4", m_qbsStdout) << QDir::currentPath() + '/' + relativeProductBuildDir("other-product") + "/output.txt" << QDir::currentPath() + '/' + relativeProductBuildDir("yet-another-product") + "/output.txt"; for (const QByteArray &line : appList) { const QString cleanLine = QString::fromLocal8Bit(line.trimmed()); QVERIFY2(apps.removeOne(cleanLine), qPrintable(cleanLine)); } QVERIFY(apps.empty()); } void TestBlackbox::productInExportedModule() { QDir::setCurrent(testDataDir + "/product-in-exported-module"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("product: importing"), m_qbsStdout.constData()); } void TestBlackbox::properQuoting() { QDir::setCurrent(testDataDir + "/proper quoting"); QCOMPARE(runQbs(), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params(QStringLiteral("run"), QStringList() << "-q" << "-p" << "Hello World"); params.expectFailure = true; // Because the exit code is non-zero. QCOMPARE(runQbs(params), 156); const char * const expectedOutput = "whitespaceless\ncontains space\ncontains\ttab\n" "backslash\\\nHello World! The magic number is 156."; QCOMPARE(unifiedLineEndings(m_qbsStdout).constData(), expectedOutput); } void TestBlackbox::propertiesInExportItems() { QDir::setCurrent(testDataDir + "/properties-in-export-items"); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(relativeExecutableFilePath("p1", m_qbsStdout))); QVERIFY(regularFileExists(relativeExecutableFilePath("p2", m_qbsStdout))); QVERIFY2(m_qbsStderr.isEmpty(), m_qbsStderr.constData()); } void TestBlackbox::protobuf_data() { QTest::addColumn("projectFile"); QTest::addColumn("properties"); QTest::addColumn("hasModules"); QTest::addColumn("successExpected"); QTest::newRow("cpp-pkgconfig") << QString("addressbook_cpp.qbs") << QStringList({"project.qbsModuleProviders:qbspkgconfig"}) << true << true; QTest::newRow("cpp-conan") << QString("addressbook_cpp.qbs") << QStringList( {"project.qbsModuleProviders:conan", "qbs.buildVariant:release", "moduleProviders.conan.installDirectory:build"}) << true << true; QTest::newRow("objc") << QString("addressbook_objc.qbs") << QStringList() << false << true; QTest::newRow("nanopb") << QString("addressbook_nanopb.qbs") << QStringList() << false << true; QTest::newRow("import") << QString("import.qbs") << QStringList() << true << true; QTest::newRow("missing import dir") << QString("needs-import-dir.qbs") << QStringList() << true << false; QTest::newRow("provided import dir") << QString("needs-import-dir.qbs") << QStringList("products.app.theImportDir:subdir") << true << true; QTest::newRow("create proto library") << QString("create-proto-library.qbs") << QStringList() << true << true; } void TestBlackbox::protobuf() { QDir::setCurrent(testDataDir + "/protobuf"); QFETCH(QString, projectFile); QFETCH(QStringList, properties); QFETCH(bool, hasModules); QFETCH(bool, successExpected); rmDirR(relativeBuildDir()); if (QTest::currentDataTag() == QLatin1String("cpp-conan")) { if (!prepareAndRunConan()) QSKIP("conan is not prepared, check messages above"); } QbsRunParameters resolveParams("resolve", QStringList{"-f", projectFile} << properties); QCOMPARE(runQbs(resolveParams), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); const bool withProtobuf = m_qbsStdout.contains("has protobuf: true"); const bool withoutProtobuf = m_qbsStdout.contains("has protobuf: false"); QVERIFY2(withProtobuf || withoutProtobuf, m_qbsStdout.constData()); if (withoutProtobuf) QSKIP("protobuf module not present"); const bool hasMods = m_qbsStdout.contains("has modules: true"); const bool dontHaveMods = m_qbsStdout.contains("has modules: false"); QVERIFY2(hasMods == !dontHaveMods, m_qbsStdout.constData()); QCOMPARE(hasMods, hasModules); QbsRunParameters runParams("run"); runParams.expectFailure = !successExpected; QCOMPARE(runQbs(runParams) == 0, successExpected); } void TestBlackbox::protobufLibraryInstall() { QDir::setCurrent(testDataDir + "/protobuf-library-install"); rmDirR(relativeBuildDir()); QbsRunParameters resolveParams("resolve", QStringList{"qbs.installPrefix:/usr/local"}); QCOMPARE(runQbs(resolveParams), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); const bool withProtobuf = m_qbsStdout.contains("has protobuf: true"); const bool withoutProtobuf = m_qbsStdout.contains("has protobuf: false"); QVERIFY2(withProtobuf || withoutProtobuf, m_qbsStdout.constData()); if (withoutProtobuf) QSKIP("protobuf module not present"); QbsRunParameters buildParams("build"); buildParams.expectFailure = false; QCOMPARE(runQbs(buildParams), 0); const QString installRootInclude = relativeBuildDir() + "/install-root/usr/local/include"; QVERIFY(QFileInfo::exists(installRootInclude + "/hello.pb.h") && QFileInfo::exists(installRootInclude + "/hello/world.pb.h")); } void TestBlackbox::pseudoMultiplexing() { // This is "pseudo-multiplexing" on all platforms that initialize qbs.architectures // to an array with one element. See QBS-1243. QDir::setCurrent(testDataDir + "/pseudo-multiplexing"); QCOMPARE(runQbs(), 0); } void TestBlackbox::qbsConfig() { QbsRunParameters params("config"); #ifdef QBS_ENABLE_UNIT_TESTS QTemporaryDir tempSystemSettingsDir; params.environment.insert("QBS_AUTOTEST_SYSTEM_SETTINGS_DIR", tempSystemSettingsDir.path()); QTemporaryDir tempUserSettingsDir; QVERIFY(tempSystemSettingsDir.isValid()); QVERIFY(tempUserSettingsDir.isValid()); const QStringList settingsDirArgs = QStringList{"--settings-dir", tempUserSettingsDir.path()}; // Set values. params.arguments = settingsDirArgs + QStringList{"--system", "key.subkey.scalar", "s"}; QCOMPARE(runQbs(params), 0); params.arguments = settingsDirArgs + QStringList{"--system", "key.subkey.list", "['sl']"}; QCOMPARE(runQbs(params), 0); params.arguments = settingsDirArgs + QStringList{"--user", "key.subkey.scalar", "u"}; QCOMPARE(runQbs(params), 0); params.arguments = settingsDirArgs + QStringList{"--user", "key.subkey.bool", "true"}; QCOMPARE(runQbs(params), 0); params.arguments = settingsDirArgs + QStringList{"--user", "key.subkey.uint", "42"}; QCOMPARE(runQbs(params), 0); params.arguments = settingsDirArgs + QStringList{"--user", "key.subkey.sint", "-42"}; QCOMPARE(runQbs(params), 0); params.arguments = settingsDirArgs + QStringList{"key.subkey.list", "[\"u1\",\"u2\"]"}; QCOMPARE(runQbs(params), 0); // Check outputs. const auto valueExtractor = [this] { const QByteArray trimmed = m_qbsStdout.trimmed(); return trimmed.mid(trimmed.lastIndexOf(':') + 2); }; params.arguments = settingsDirArgs + QStringList{"--list", "key.subkey.scalar"}; QCOMPARE(runQbs(params), 0); QCOMPARE(valueExtractor(), QByteArray("\"u\"")); params.arguments = settingsDirArgs + QStringList{"--list", "--user", "key.subkey.scalar"}; QCOMPARE(runQbs(params), 0); QCOMPARE(valueExtractor(), QByteArray("\"u\"")); params.arguments = settingsDirArgs + QStringList{"--list", "--user", "key.subkey.bool"}; QCOMPARE(runQbs(params), 0); QCOMPARE(valueExtractor(), QByteArray("true")); params.arguments = settingsDirArgs + QStringList{"--list", "--user", "key.subkey.uint"}; QCOMPARE(runQbs(params), 0); QCOMPARE(valueExtractor(), QByteArray("42")); params.arguments = settingsDirArgs + QStringList{"--list", "--user", "key.subkey.sint"}; QCOMPARE(runQbs(params), 0); QCOMPARE(valueExtractor(), QByteArray("-42")); params.arguments = settingsDirArgs + QStringList{"--list", "--system", "key.subkey.scalar"}; QCOMPARE(runQbs(params), 0); QCOMPARE(valueExtractor(), QByteArray("\"s\"")); params.arguments = settingsDirArgs + QStringList{"--list", "key.subkey.list"}; QCOMPARE(runQbs(params), 0); QCOMPARE(valueExtractor(), QByteArray("[\"u1\", \"u2\", \"sl\"]")); params.arguments = settingsDirArgs + QStringList{"--list", "--user", "key.subkey.list"}; QCOMPARE(runQbs(params), 0); QCOMPARE(valueExtractor(), QByteArray("[\"u1\", \"u2\"]")); params.arguments = settingsDirArgs + QStringList{"--list", "--system", "key.subkey.list"}; QCOMPARE(runQbs(params), 0); QCOMPARE(valueExtractor(), QByteArray("[\"sl\"]")); // Remove some values and re-check. params.arguments = settingsDirArgs + QStringList{"--unset", "key.subkey.scalar"}; QCOMPARE(runQbs(params), 0); params.arguments = settingsDirArgs + QStringList{"--system", "--unset", "key.subkey.list"}; QCOMPARE(runQbs(params), 0); params.arguments = settingsDirArgs + QStringList{"--list", "key.subkey.scalar"}; QCOMPARE(runQbs(params), 0); QCOMPARE(valueExtractor(), QByteArray("\"s\"")); params.arguments = settingsDirArgs + QStringList{"--list", "key.subkey.list"}; QCOMPARE(runQbs(params), 0); QCOMPARE(valueExtractor(), QByteArray("[\"u1\", \"u2\"]")); // Check preferences.ignoreSystemSearchPaths params.arguments = settingsDirArgs + QStringList{"--system", "preferences.qbsSearchPaths", "['/usr/lib/qbs']"}; QCOMPARE(runQbs(params), 0); params.arguments = settingsDirArgs + QStringList{"preferences.qbsSearchPaths", "['/home/user/qbs']"}; QCOMPARE(runQbs(params), 0); qbs::Settings settings(tempUserSettingsDir.path(), tempSystemSettingsDir.path()); const qbs::Preferences prefs(&settings, "SomeProfile"); QVERIFY2(prefs.searchPaths().contains("/usr/lib/qbs") && prefs.searchPaths().contains("/home/user/qbs"), qPrintable(prefs.searchPaths().join(','))); settings.setValue("profiles.SomeProfile.preferences.ignoreSystemSearchPaths", true); QVERIFY2(!prefs.searchPaths().contains("/usr/lib/qbs") && prefs.searchPaths().contains("/home/user/qbs"), qPrintable(prefs.searchPaths().join(','))); #else qDebug() << "ability to redirect the system settings dir not compiled in, skipping" "most qbs-config tests"; #endif // QBS_ENABLE_UNIT_TESTS bool canWriteToSystemSettings; QString testSettingsFilePath; { QSettings testSettings( qbs::Settings::defaultSystemSettingsBaseDir() + "/dummyOrg" + "/dummyApp.conf", QSettings::IniFormat); testSettings.setValue("dummyKey", "dummyValue"); testSettings.sync(); canWriteToSystemSettings = testSettings.status() == QSettings::NoError; testSettingsFilePath = testSettings.fileName(); } if (canWriteToSystemSettings) QVERIFY(QFile::remove(testSettingsFilePath)); // Check that trying to write to actual system settings causes access failure. params.expectFailure = !canWriteToSystemSettings; params.environment.clear(); params.arguments = QStringList{"--system", "key.subkey.scalar", "s"}; QCOMPARE(runQbs(params) == 0, canWriteToSystemSettings); if (!canWriteToSystemSettings) { QVERIFY2(m_qbsStderr.contains("You do not have permission to write to that location."), m_qbsStderr.constData()); } else { // cleanup system settings params.arguments = QStringList{"--system", "--unset", "key.subkey.scalar"}; QCOMPARE(runQbs(params) == 0, canWriteToSystemSettings); } } void TestBlackbox::qbsConfigAddProfile() { QbsRunParameters params("config"); QTemporaryDir settingsDir1; QTemporaryDir settingsDir2; QVERIFY(settingsDir1.isValid()); QVERIFY(settingsDir2.isValid()); const QStringList settingsDir1Args = QStringList{"--settings-dir", settingsDir1.path()}; const QStringList settingsDir2Args = QStringList{"--settings-dir", settingsDir2.path()}; QFETCH(QStringList, args); QFETCH(QString, errorMsg); // Step 1: Run --add-profile. params.arguments = settingsDir1Args; params.arguments << "--add-profile"; params.arguments << args; params.expectFailure = !errorMsg.isEmpty(); QCOMPARE(runQbs(params) == 0, !params.expectFailure); if (params.expectFailure) { QVERIFY(QString::fromLocal8Bit(m_qbsStderr).contains(errorMsg)); return; } params.expectFailure = false; params.arguments = settingsDir1Args; params.arguments << "--list"; QCOMPARE(runQbs(params), 0); const QByteArray output1 = m_qbsStdout; // Step 2: Set properties manually. for (int i = 1; i < args.size(); i += 2) { params.arguments = settingsDir2Args; params.arguments << ("profiles." + args.first() + '.' + args.at(i)) << args.at(i + 1); QCOMPARE(runQbs(params), 0); } params.arguments = settingsDir2Args; params.arguments << "--list"; QCOMPARE(runQbs(params), 0); const QByteArray output2 = m_qbsStdout; // Step3: Compare results. QCOMPARE(output1, output2); } void TestBlackbox::qbsConfigAddProfile_data() { QTest::addColumn("args"); QTest::addColumn("errorMsg"); QTest::newRow("no arguments") << QStringList() << QString("Profile name missing"); QTest::newRow("empty name") << QStringList{"", "p", "v"} << QString("Profile name must not be empty"); QTest::newRow("no properties") << QStringList("p") << QString("Profile properties must be provided"); QTest::newRow("one property") << QStringList{"p", "p", "v"} << QString(); QTest::newRow("two properties") << QStringList{"p", "p1", "v1", "p2", "v2"} << QString(); QTest::newRow("missing value") << QStringList{"p", "p"} << QString("Profile properties must be key/value pairs"); QTest::newRow("missing values") << QStringList{"p", "p1", "v1", "p2"} << QString("Profile properties must be key/value pairs"); } void TestBlackbox::qbsConfigImport() { QFETCH(QString, format); QDir::setCurrent(testDataDir + "/qbs-config-import-export"); QbsRunParameters params("config"); QTemporaryDir settingsDir; QVERIFY(settingsDir.isValid()); const QStringList settingsDirArgs = QStringList{"--settings-dir", settingsDir.path()}; params.arguments = settingsDirArgs; params.arguments << "--import" << "config." + format; QCOMPARE(runQbs(params), 0); params.arguments = settingsDirArgs; params.arguments << "--list"; QCOMPARE(runQbs(params), 0); const QByteArray output = m_qbsStdout; const auto lines = output.split('\n'); QCOMPARE(lines.count(), 5); QCOMPARE(lines[0], "group.key1: \"value1\""); QCOMPARE(lines[1], "group.key2: \"value2\""); QCOMPARE(lines[2], "key: \"value\""); QCOMPARE(lines[3], "listKey: [\"valueOne\", \"valueTwo\"]"); QCOMPARE(lines[4], ""); } void TestBlackbox::qbsConfigImport_data() { QTest::addColumn("format"); QTest::newRow("text") << QStringLiteral("txt"); QTest::newRow("json") << QStringLiteral("json"); } void TestBlackbox::qbsConfigExport() { QFETCH(QString, format); QDir::setCurrent(testDataDir + "/qbs-config-import-export"); QbsRunParameters params("config"); QTemporaryDir settingsDir; const QString fileName = "config." + format; const QString filePath = settingsDir.path() + "/" + fileName; QVERIFY(settingsDir.isValid()); const QStringList commonArgs = QStringList{"--settings-dir", settingsDir.path(), "--user"}; std::pair values[] = { {"key", "value"}, {"listKey", "[\"valueOne\",\"valueTwo\"]"}, {"group.key1", "value1"}, {"group.key2", "value2"} }; for (const auto &value: values) { params.arguments = commonArgs; params.arguments << value.first << value.second; QCOMPARE(runQbs(params), 0); } params.arguments = commonArgs; params.arguments << "--export" << filePath; QCOMPARE(runQbs(params), 0); QVERIFY(QFileInfo(filePath).canonicalPath() != QFileInfo(fileName).canonicalPath()); QFile exported(filePath); QFile expected(fileName); QVERIFY(exported.open(QIODevice::ReadOnly | QIODevice::Text)); QVERIFY(expected.open(QIODevice::ReadOnly | QIODevice::Text)); QCOMPARE(exported.readAll(), expected.readAll()); } void TestBlackbox::qbsConfigExport_data() { QTest::addColumn("format"); QTest::newRow("text") << QStringLiteral("txt"); QTest::newRow("json") << QStringLiteral("json"); } static QJsonObject getNextSessionPacket(QProcess &session, QByteArray &data) { int totalSize = -1; QElapsedTimer timer; timer.start(); QByteArray msg; while (totalSize == -1 || msg.size() < totalSize) { if (data.isEmpty()) session.waitForReadyRead(1000); if (timer.elapsed() >= testTimeoutInMsecs()) return QJsonObject(); data += session.readAllStandardOutput(); if (totalSize == -1) { static const QByteArray magicString = "qbsmsg:"; const int magicStringOffset = data.indexOf(magicString); if (magicStringOffset == -1) continue; const int sizeOffset = magicStringOffset + magicString.length(); const int newlineOffset = data.indexOf('\n', sizeOffset); if (newlineOffset == -1) continue; const QByteArray sizeString = data.mid(sizeOffset, newlineOffset - sizeOffset); bool isNumber; const int size = sizeString.toInt(&isNumber); if (!isNumber || size <= 0) return QJsonObject(); data = data.mid(newlineOffset + 1); totalSize = size; } const int bytesToTake = std::min(totalSize - msg.size(), data.size()); msg += data.left(bytesToTake); data = data.mid(bytesToTake); } return QJsonDocument::fromJson(QByteArray::fromBase64(msg)).object(); } static void sendSessionPacket(QProcess &sessionProc, const QJsonObject &message) { const QByteArray data = QJsonDocument(message).toJson().toBase64(); sessionProc.write("qbsmsg:"); sessionProc.write(QByteArray::number(data.length())); sessionProc.write("\n"); sessionProc.write(data); } void TestBlackbox::qbsLanguageServer_data() { QTest::addColumn("request"); QTest::addColumn("location"); QTest::addColumn("insertLocation"); QTest::addColumn("insertString"); QTest::addColumn("expectedReply"); QTest::addRow("follow to module") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:4:9") << QString() << QString() << (testDataDir + "/lsp/modules/m/m.qbs:1:1"); QTest::addRow("follow to submodules") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:5:35") << QString() << QString() << ((testDataDir + "/lsp/modules/Prefix/m1/m1.qbs:1:1\n") + (testDataDir + "/lsp/modules/Prefix/m2/m2.qbs:1:1\n") + (testDataDir + "/lsp/modules/Prefix/m3/m3.qbs:1:1")); QTest::addRow("follow to product") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:9:19") << QString() << QString() << (testDataDir + "/lsp/lsp.qbs:2:5"); QTest::addRow("follow to module, non-invalidating insert") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:4:9") << "5:9" << QString("property bool dummy\n") << (testDataDir + "/lsp/modules/m/m.qbs:1:1"); QTest::addRow("follow to module, invalidating insert") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:4:9") << QString() << QString("property bool dummy\n") << QString(); QTest::addRow("follow to file in product") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:10:25") << QString() << QString() << (testDataDir + "/lsp/toplevel.txt:1:1"); QTest::addRow("follow to file in group (first element)") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:13:34") << QString() << QString() << (testDataDir + "/lsp/subdir/file1.txt:1:1"); QTest::addRow("follow to file in group (last element)") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:13:48") << QString() << QString() << (testDataDir + "/lsp/subdir/file2.txt:1:1"); QTest::addRow("follow \"references\"") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:16:24") << QString() << QString() << (testDataDir + "/lsp/other.qbs:1:1"); QTest::addRow("follow item from import path") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:17:7") << QString() << QString() << (testDataDir + "/lsp/MyProduct.qbs:2:74"); QTest::addRow("follow built-in item") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:18:7") << QString() << QString() << QString(); QTest::addRow("follow to module in binding (first segment)") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:21:12") << QString() << QString() << (testDataDir + "/lsp/modules/Prefix/m1/m1.qbs:1:1"); QTest::addRow("follow to module in binding (last segment)") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:21:17") << QString() << QString() << (testDataDir + "/lsp/modules/Prefix/m1/m1.qbs:1:1"); QTest::addRow("follow to module property") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:21:20") << QString() << QString() << (testDataDir + "/lsp/modules/Prefix/m1/m1.qbs:2:19"); QTest::addRow("follow to module property 2") << "--goto-def" << (testDataDir + "/lsp/lsp.qbs:6:13") << QString() << QString() << (testDataDir + "/lsp/modules/m/m.qbs:2:19"); QTest::addRow("completion: LHS, module prefix") << "--completion" << (testDataDir + "/lsp/lsp.qbs:7:1") << QString() << QString("P") << QString("Prefix.m1\nPrefix.m2\nPrefix.m3"); QTest::addRow("completion: LHS, module name") << "--completion" << (testDataDir + "/lsp/lsp.qbs:7:1") << QString() << QString("Prefix.m") << QString("m1\nm2\nm3"); QTest::addRow("completion: LHS, module property right after dot") << "--completion" << (testDataDir + "/lsp/lsp.qbs:7:1") << QString() << QString("Prefix.m1.") << QString("p1 bool\np2 string\nx bool"); QTest::addRow("completion: LHS, module property with identifier prefix") << "--completion" << (testDataDir + "/lsp/lsp.qbs:7:1") << QString() << QString("Prefix.m1.p") << QString("p1 bool\np2 string"); QTest::addRow("completion: simple RHS, module property") << "--completion" << (testDataDir + "/lsp/lsp.qbs:7:1") << QString() << QString("property bool dummy: Prefix.m1.p") << QString("p1 bool\np2 string"); QTest::addRow("completion: complex RHS, module property") << "--completion" << (testDataDir + "/lsp/lsp.qbs:7:1") << QString() << QString("property bool dummy: { return Prefix.m1.p") << QString("p1 bool\np2 string"); } void TestBlackbox::qbsLanguageServer() { QFETCH(QString, request); QFETCH(QString, location); QFETCH(QString, insertLocation); QFETCH(QString, insertString); QFETCH(QString, expectedReply); QDir::setCurrent(testDataDir + "/lsp"); QProcess sessionProc; sessionProc.start(qbsExecutableFilePath, QStringList("session")); QVERIFY(sessionProc.waitForStarted()); QByteArray incomingData; // Wait for and verify hello packet. QJsonObject receivedMessage = getNextSessionPacket(sessionProc, incomingData); const QString socketPath = receivedMessage.value("lsp-socket").toString(); QVERIFY(!socketPath.isEmpty()); // Resolve project. QJsonObject resolveMessage; resolveMessage.insert("type", "resolve-project"); resolveMessage.insert("top-level-profile", profileName()); resolveMessage.insert("project-file-path", QDir::currentPath() + "/lsp.qbs"); resolveMessage.insert("build-root", QDir::currentPath()); resolveMessage.insert("settings-directory", settings()->baseDirectory()); sendSessionPacket(sessionProc, resolveMessage); bool receivedReply = false; while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "project-resolved") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); } } QVERIFY(receivedReply); // Employ client app to send request. QProcess lspClient; const QFileInfo qbsFileInfo(qbsExecutableFilePath); const QString clientFilePath = HostOsInfo::appendExecutableSuffix( qbsFileInfo.absolutePath() + "/qbs_lspclient"); QStringList args{"--socket", socketPath, request, location}; if (!insertString.isEmpty()) args << "--insert-code" << insertString; if (!insertLocation.isEmpty()) args << "--insert-location" << insertLocation; lspClient.start(clientFilePath, args); QVERIFY2(lspClient.waitForStarted(), qPrintable(lspClient.errorString())); QVERIFY2(lspClient.waitForFinished(), qPrintable(lspClient.errorString())); QString errMsg; if (lspClient.exitStatus() != QProcess::NormalExit) errMsg = lspClient.errorString(); if (errMsg.isEmpty()) errMsg = QString::fromLocal8Bit(lspClient.readAllStandardError()); QVERIFY2(lspClient.exitCode() == 0, qPrintable(errMsg)); QVERIFY2(errMsg.isEmpty(), qPrintable(errMsg)); QString output = QString::fromUtf8(lspClient.readAllStandardOutput().trimmed()); output.replace("\r\n", "\n"); QCOMPARE(output, expectedReply); QJsonObject quitRequest; quitRequest.insert("type", "quit"); sendSessionPacket(sessionProc, quitRequest); QVERIFY(sessionProc.waitForFinished(3000)); } void TestBlackbox::qbsSession() { QDir::setCurrent(testDataDir + "/qbs-session"); QProcess sessionProc; sessionProc.start(qbsExecutableFilePath, QStringList("session")); // Uncomment for debugging. /* connect(&sessionProc, &QProcess::readyReadStandardError, [&sessionProc] { qDebug() << "stderr:" << sessionProc.readAllStandardError(); }); */ QVERIFY(sessionProc.waitForStarted()); const auto sendPacket = [&sessionProc](const QJsonObject &message) { sendSessionPacket(sessionProc, message); }; static const auto envToJson = [](const QProcessEnvironment &env) { QJsonObject envObj; const QStringList keys = env.keys(); for (const QString &key : keys) envObj.insert(key, env.value(key)); return envObj; }; static const auto envFromJson = [](const QJsonValue &v) { const QJsonObject obj = v.toObject(); QProcessEnvironment env; for (auto it = obj.begin(); it != obj.end(); ++it) env.insert(it.key(), it.value().toString()); return env; }; QByteArray incomingData; // Wait for and verify hello packet. QJsonObject receivedMessage = getNextSessionPacket(sessionProc, incomingData); QCOMPARE(receivedMessage.value("type"), "hello"); QCOMPARE(receivedMessage.value("api-level").toInt(), 9); QCOMPARE(receivedMessage.value("api-compat-level").toInt(), 2); // Resolve & verify structure QJsonObject resolveMessage; resolveMessage.insert("type", "resolve-project"); resolveMessage.insert("top-level-profile", profileName()); resolveMessage.insert("configuration-name", "my-config"); resolveMessage.insert("project-file-path", QDir::currentPath() + "/qbs-session.qbs"); resolveMessage.insert("build-root", QDir::currentPath()); resolveMessage.insert("settings-directory", settings()->baseDirectory()); QJsonObject overriddenValues; overriddenValues.insert("products.theLib.cpp.cxxLanguageVersion", "c++17"); resolveMessage.insert("overridden-properties", overriddenValues); resolveMessage.insert("environment", envToJson(QbsRunParameters::defaultEnvironment())); resolveMessage.insert("data-mode", "only-if-changed"); resolveMessage.insert("max-job-count", 2); resolveMessage.insert("log-time", true); resolveMessage.insert( "module-properties", QJsonArray::fromStringList( {"cpp.cxxLanguageVersion", "cpp.executableSuffix", "cpp.objectSuffix"})); sendPacket(resolveMessage); bool receivedLogData = false; bool receivedStartedSignal = false; bool receivedProgressData = false; bool receivedReply = false; QString objectSuffix; QString executableSuffix; while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "project-resolved") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); const QJsonObject projectData = receivedMessage.value("project-data").toObject(); QCOMPARE(projectData.value("name").toString(), "qbs-session"); const QJsonArray products = projectData.value("products").toArray(); QCOMPARE(products.size(), 2); for (const QJsonValue &v : products) { const QJsonObject product = v.toObject(); const QString productName = product.value("name").toString(); QVERIFY(!productName.isEmpty()); QVERIFY2(product.value("is-enabled").toBool(), qPrintable(productName)); const QJsonObject moduleProps = product.value("module-properties").toObject(); objectSuffix = moduleProps.value("cpp.objectSuffix").toString(); executableSuffix = moduleProps.value("cpp.executableSuffix").toString(); bool theLib = false; bool theApp = false; if (productName == "theLib") theLib = true; else if (productName == "theApp") theApp = true; QVERIFY2(theLib || theApp, qPrintable(productName)); const QJsonArray groups = product.value("groups").toArray(); if (theLib) QVERIFY(groups.size() >= 3); else QVERIFY(!groups.isEmpty()); for (const QJsonValue &v : groups) { const QJsonObject group = v.toObject(); const QJsonArray sourceArtifacts = group.value("source-artifacts").toArray(); const auto findArtifact = [&sourceArtifacts](const QString &fileName) { for (const QJsonValue &v : sourceArtifacts) { const QJsonObject artifact = v.toObject(); if (QFileInfo(artifact.value("file-path").toString()).fileName() == fileName) { return artifact; } } return QJsonObject(); }; const QString groupName = group.value("name").toString(); const auto getCxxLanguageVersion = [&group, &product] { QJsonObject moduleProperties = group.value("module-properties").toObject(); if (moduleProperties.isEmpty()) moduleProperties = product.value("module-properties").toObject(); return moduleProperties.toVariantMap().value("cpp.cxxLanguageVersion") .toStringList(); }; if (groupName == "sources") { const QJsonObject artifact = findArtifact("lib.cpp"); QVERIFY2(!artifact.isEmpty(), "lib.cpp"); QCOMPARE(getCxxLanguageVersion(), {"c++17"}); } else if (groupName == "headers") { const QJsonObject artifact = findArtifact("lib.h"); QVERIFY2(!artifact.isEmpty(), "lib.h"); } else if (groupName == "theApp") { const QJsonObject artifact = findArtifact("main.cpp"); QVERIFY2(!artifact.isEmpty(), "main.cpp"); QCOMPARE(getCxxLanguageVersion(), {"c++14"}); } } } break; } else if (msgType == "log-data") { if (receivedMessage.value("message").toString().contains("activity")) receivedLogData = true; } else if (msgType == "task-started") { receivedStartedSignal = true; } else if (msgType == "task-progress") { receivedProgressData = true; } else if (msgType != "new-max-progress") { QVERIFY2(false, qPrintable(QString("Unexpected message type '%1'").arg(msgType))); } } QVERIFY(receivedReply); QVERIFY(receivedLogData); QVERIFY(receivedStartedSignal); QVERIFY(receivedProgressData); // Add a dependency and re-resolve. QJsonObject addDepsRequest; addDepsRequest.insert("type", "add-dependencies"); addDepsRequest.insert("product", "theApp"); addDepsRequest.insert("group", "theApp"); addDepsRequest.insert("dependencies", QJsonArray::fromStringList({"mymodule"})); sendPacket(addDepsRequest); receivedMessage = getNextSessionPacket(sessionProc, incomingData); QCOMPARE(receivedMessage.value("type").toString(), QString("dependencies-added")); QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) { for (const auto item : error[QStringLiteral("items")].toArray()) { const auto description = QStringLiteral("Project file updates are not enabled"); if (item.toObject()[QStringLiteral("description")].toString().contains(description)) QSKIP("File updates are disabled"); } qDebug() << error; } QVERIFY(error.isEmpty()); receivedReply = false; sendPacket(resolveMessage); while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "project-resolved") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); } } QVERIFY(receivedReply); // First build: No install, log time, default command description. QJsonObject buildRequest; buildRequest.insert("type", "build-project"); buildRequest.insert("log-time", true); buildRequest.insert("install", false); buildRequest.insert("data-mode", "only-if-changed"); sendPacket(buildRequest); receivedReply = false; receivedLogData = false; receivedStartedSignal = false; receivedProgressData = false; bool receivedCommandDescription = false; bool receivedProcessResult = false; while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "project-built") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); const QJsonObject projectData = receivedMessage.value("project-data").toObject(); QCOMPARE(projectData.value("name").toString(), "qbs-session"); } else if (msgType == "log-data") { if (receivedMessage.value("message").toString().contains("activity")) receivedLogData = true; } else if (msgType == "task-started") { receivedStartedSignal = true; } else if (msgType == "task-progress") { receivedProgressData = true; } else if (msgType == "command-description") { if (receivedMessage.value("message").toString().contains("compiling main.cpp")) receivedCommandDescription = true; } else if (msgType == "process-result") { QCOMPARE(receivedMessage.value("exit-code").toInt(), 0); receivedProcessResult = true; } else if (msgType != "new-max-progress") { QVERIFY2(false, qPrintable(QString("Unexpected message type '%1'").arg(msgType))); } } QVERIFY(receivedReply); QVERIFY(receivedLogData); QVERIFY(receivedStartedSignal); QVERIFY(receivedProgressData); QVERIFY(receivedCommandDescription); QVERIFY(receivedProcessResult); const QString &exeFilePath = QDir::currentPath() + '/' + relativeProductBuildDir("theApp", "my-config") + '/' + "theApp" + executableSuffix; QVERIFY2(regularFileExists(exeFilePath), qPrintable(exeFilePath)); const QString defaultInstallRoot = QDir::currentPath() + '/' + relativeBuildDir("my-config") + "/install-root"; QVERIFY2(!directoryExists(defaultInstallRoot), qPrintable(defaultInstallRoot)); // Clean. QJsonObject cleanRequest; cleanRequest.insert("type", "clean-project"); cleanRequest.insert("settings-dir", settings()->baseDirectory()); cleanRequest.insert("log-time", true); sendPacket(cleanRequest); receivedReply = false; receivedLogData = false; receivedStartedSignal = false; receivedProgressData = false; while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "project-cleaned") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); } else if (msgType == "log-data") { if (receivedMessage.value("message").toString().contains("activity")) receivedLogData = true; } else if (msgType == "task-started") { receivedStartedSignal = true; } else if (msgType == "task-progress") { receivedProgressData = true; } else if (msgType != "new-max-progress") { QVERIFY2(false, qPrintable(QString("Unexpected message type '%1'").arg(msgType))); } } QVERIFY(receivedReply); QVERIFY(receivedLogData); QVERIFY(receivedStartedSignal); QVERIFY(receivedProgressData); QVERIFY2(!regularFileExists(exeFilePath), qPrintable(exeFilePath)); // Second build: Do not log the time, show command lines. buildRequest.insert("log-time", false); buildRequest.insert("command-echo-mode", "command-line"); sendPacket(buildRequest); receivedReply = false; receivedLogData = false; receivedStartedSignal = false; receivedProgressData = false; receivedCommandDescription = false; receivedProcessResult = false; while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "project-built") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); const QJsonObject projectData = receivedMessage.value("project-data").toObject(); QVERIFY(projectData.isEmpty()); } else if (msgType == "log-data") { if (receivedMessage.value("message").toString().contains("activity")) receivedLogData = true; } else if (msgType == "task-started") { receivedStartedSignal = true; } else if (msgType == "task-progress") { receivedProgressData = true; } else if (msgType == "command-description") { if (QDir::fromNativeSeparators(receivedMessage.value("message").toString()) .contains("/main.cpp")) { receivedCommandDescription = true; } } else if (msgType == "process-result") { QCOMPARE(receivedMessage.value("exit-code").toInt(), 0); receivedProcessResult = true; } else if (msgType != "new-max-progress") { QVERIFY2(false, qPrintable(QString("Unexpected message type '%1'").arg(msgType))); } } QVERIFY(receivedReply); QVERIFY(!receivedLogData); QVERIFY(receivedStartedSignal); QVERIFY(receivedProgressData); QVERIFY(receivedCommandDescription); QVERIFY(receivedProcessResult); QVERIFY2(regularFileExists(exeFilePath), qPrintable(exeFilePath)); QVERIFY2(!directoryExists(defaultInstallRoot), qPrintable(defaultInstallRoot)); // Install. QJsonObject installRequest; installRequest.insert("type", "install-project"); installRequest.insert("log-time", true); const QString customInstallRoot = QDir::currentPath() + "/my-install-root"; QVERIFY2(!QFile::exists(customInstallRoot), qPrintable(customInstallRoot)); installRequest.insert("install-root", customInstallRoot); sendPacket(installRequest); receivedReply = false; receivedLogData = false; receivedStartedSignal = false; receivedProgressData = false; while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "install-done") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); } else if (msgType == "log-data") { if (receivedMessage.value("message").toString().contains("activity")) receivedLogData = true; } else if (msgType == "task-started") { receivedStartedSignal = true; } else if (msgType == "task-progress") { receivedProgressData = true; } else if (msgType != "new-max-progress") { QVERIFY2(false, qPrintable(QString("Unexpected message type '%1'").arg(msgType))); } } QVERIFY(receivedReply); QVERIFY(receivedLogData); QVERIFY(receivedStartedSignal); QVERIFY(receivedProgressData); QVERIFY2(!directoryExists(defaultInstallRoot), qPrintable(defaultInstallRoot)); QVERIFY2(directoryExists(customInstallRoot), qPrintable(customInstallRoot)); // Retrieve modified environment. QJsonObject getRunEnvRequest; getRunEnvRequest.insert("type", "get-run-environment"); getRunEnvRequest.insert("product", "theApp"); const QProcessEnvironment inEnv = QProcessEnvironment::systemEnvironment(); QVERIFY(!inEnv.contains("MY_MODULE")); getRunEnvRequest.insert("base-environment", envToJson(inEnv)); sendPacket(getRunEnvRequest); receivedMessage = getNextSessionPacket(sessionProc, incomingData); QCOMPARE(receivedMessage.value("type").toString(), QString("run-environment")); error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); const QProcessEnvironment outEnv = envFromJson(receivedMessage.value("full-environment")); QVERIFY(outEnv.keys().size() > inEnv.keys().size()); QCOMPARE(outEnv.value("MY_MODULE"), QString("1")); // Add two files to library and re-build. QJsonObject addFilesRequest; addFilesRequest.insert("type", "add-files"); addFilesRequest.insert("product", "theLib"); addFilesRequest.insert("group", "sources"); addFilesRequest.insert("files", QJsonArray::fromStringList({QDir::currentPath() + "/file1.cpp", QDir::currentPath() + "/file2.cpp"})); sendPacket(addFilesRequest); receivedMessage = getNextSessionPacket(sessionProc, incomingData); QCOMPARE(receivedMessage.value("type").toString(), QString("files-added")); error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) { for (const auto item: error[QStringLiteral("items")].toArray()) { const auto description = QStringLiteral("Project file updates are not enabled"); if (item.toObject()[QStringLiteral("description")].toString().contains(description)) QSKIP("File updates are disabled"); } qDebug() << error; } QVERIFY(error.isEmpty()); receivedReply = false; sendPacket(resolveMessage); while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "project-resolved") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); const QJsonObject projectData = receivedMessage.value("project-data").toObject(); QJsonArray products = projectData.value("products").toArray(); bool file1 = false; bool file2 = false; for (const QJsonValue v : products) { const QJsonObject product = v.toObject(); const QString productName = product.value("full-display-name").toString(); const QJsonArray groups = product.value("groups").toArray(); for (const QJsonValue &v : groups) { const QJsonObject group = v.toObject(); const QString groupName = group.value("name").toString(); const QJsonArray sourceArtifacts = group.value("source-artifacts").toArray(); for (const QJsonValue &v : sourceArtifacts) { const QString filePath = v.toObject().value("file-path").toString(); if (filePath.endsWith("file1.cpp")) { QCOMPARE(productName, QString("theLib")); QCOMPARE(groupName, QString("sources")); file1 = true; } else if (filePath.endsWith("file2.cpp")) { QCOMPARE(productName, QString("theLib")); QCOMPARE(groupName, QString("sources")); file2 = true; } } } } QVERIFY(file1); QVERIFY(file2); } } QVERIFY(receivedReply); receivedReply = false; receivedProcessResult = false; bool compiledFile1 = false; bool compiledFile2 = false; bool compiledMain = false; bool compiledLib = false; buildRequest.remove("command-echo-mode"); sendPacket(buildRequest); while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "project-built") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); } else if (msgType == "command-description") { const QString msg = receivedMessage.value("message").toString(); if (msg.contains("compiling file1.cpp")) compiledFile1 = true; else if (msg.contains("compiling file2.cpp")) compiledFile2 = true; else if (msg.contains("compiling main.cpp")) compiledMain = true; else if (msg.contains("compiling lib.cpp")) compiledLib = true; } else if (msgType == "process-result") { QCOMPARE(receivedMessage.value("exit-code").toInt(), 0); receivedProcessResult = true; } } QVERIFY(receivedReply); QVERIFY(!receivedProcessResult); QVERIFY(compiledFile1); QVERIFY(compiledFile2); QVERIFY(!compiledLib); QVERIFY(!compiledMain); // Remove one of the newly added files again and re-build. WAIT_FOR_NEW_TIMESTAMP(); touch("file1.cpp"); touch("file2.cpp"); touch("main.cpp"); QJsonObject removeFilesRequest; removeFilesRequest.insert("type", "remove-files"); removeFilesRequest.insert("product", "theLib"); removeFilesRequest.insert("group", "sources"); removeFilesRequest.insert("files", QJsonArray::fromStringList({QDir::currentPath() + "/file1.cpp"})); sendPacket(removeFilesRequest); receivedMessage = getNextSessionPacket(sessionProc, incomingData); QCOMPARE(receivedMessage.value("type").toString(), QString("files-removed")); error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); receivedReply = false; sendPacket(resolveMessage); while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "project-resolved") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); const QJsonObject projectData = receivedMessage.value("project-data").toObject(); QJsonArray products = projectData.value("products").toArray(); bool file1 = false; bool file2 = false; for (const QJsonValue v : products) { const QJsonObject product = v.toObject(); const QString productName = product.value("full-display-name").toString(); const QJsonArray groups = product.value("groups").toArray(); for (const QJsonValue &v : groups) { const QJsonObject group = v.toObject(); const QString groupName = group.value("name").toString(); const QJsonArray sourceArtifacts = group.value("source-artifacts").toArray(); for (const QJsonValue &v : sourceArtifacts) { const QString filePath = v.toObject().value("file-path").toString(); if (filePath.endsWith("file1.cpp")) { file1 = true; } else if (filePath.endsWith("file2.cpp")) { QCOMPARE(productName, QString("theLib")); QCOMPARE(groupName, QString("sources")); file2 = true; } } } } QVERIFY(!file1); QVERIFY(file2); } } QVERIFY(receivedReply); receivedReply = false; receivedProcessResult = false; compiledFile1 = false; compiledFile2 = false; compiledMain = false; compiledLib = false; sendPacket(buildRequest); while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "project-built") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); } else if (msgType == "command-description") { const QString msg = receivedMessage.value("message").toString(); if (msg.contains("compiling file1.cpp")) compiledFile1 = true; else if (msg.contains("compiling file2.cpp")) compiledFile2 = true; else if (msg.contains("compiling main.cpp")) compiledMain = true; else if (msg.contains("compiling lib.cpp")) compiledLib = true; } else if (msgType == "process-result") { QCOMPARE(receivedMessage.value("exit-code").toInt(), 0); receivedProcessResult = true; } } QVERIFY(receivedReply); QVERIFY(receivedProcessResult); QVERIFY(!compiledFile1); QVERIFY(compiledFile2); QVERIFY(!compiledLib); QVERIFY(compiledMain); // Rename a file and re-build. WAIT_FOR_NEW_TIMESTAMP(); QVERIFY(QFile::rename("lib.cpp", "theLib.cpp")); QJsonObject renameFilesRequest; renameFilesRequest.insert("type", "rename-files"); renameFilesRequest.insert("product", "theLib"); renameFilesRequest.insert("group", "sources"); QJsonObject sourceAndTarget( {qMakePair(QString("source-path"), QJsonValue(QDir::currentPath() + "/lib.cpp")), qMakePair(QString("target-path"), QJsonValue(QDir::currentPath() + "/theLib.cpp"))}); renameFilesRequest.insert("files", QJsonArray{sourceAndTarget}); sendPacket(renameFilesRequest); receivedMessage = getNextSessionPacket(sessionProc, incomingData); QCOMPARE(receivedMessage.value("type").toString(), QString("files-renamed")); error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); receivedReply = false; sendPacket(resolveMessage); while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "project-resolved") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); const QJsonObject projectData = receivedMessage.value("project-data").toObject(); QJsonArray products = projectData.value("products").toArray(); bool hasOldFile = false; bool hasNewFile = false; for (const QJsonValue v : products) { const QJsonObject product = v.toObject(); const QString productName = product.value("full-display-name").toString(); const QJsonArray groups = product.value("groups").toArray(); for (const QJsonValue &v : groups) { const QJsonObject group = v.toObject(); const QString groupName = group.value("name").toString(); const QJsonArray sourceArtifacts = group.value("source-artifacts").toArray(); for (const QJsonValue &v : sourceArtifacts) { const QString filePath = v.toObject().value("file-path").toString(); if (filePath.endsWith("lib.cpp")) { hasOldFile = true; } else if (filePath.endsWith("theLib.cpp")) { QCOMPARE(productName, QString("theLib")); QCOMPARE(groupName, QString("sources")); hasNewFile = true; } } } } QVERIFY(!hasOldFile); QVERIFY(hasNewFile); } } QVERIFY(receivedReply); receivedReply = false; compiledLib = false; sendPacket(buildRequest); while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QVERIFY(!receivedMessage.isEmpty()); const QString msgType = receivedMessage.value("type").toString(); if (msgType == "project-built") { receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); } else if ( msgType == "command-description" && receivedMessage.value("message").toString().contains("compiling theLib.cpp")) { compiledLib = true; } } QVERIFY(receivedReply); QVERIFY(compiledLib); // Get generated files. QJsonObject genFilesRequestPerFile; genFilesRequestPerFile.insert("source-file", QDir::currentPath() + "/main.cpp"); genFilesRequestPerFile.insert("tags", QJsonArray{QJsonValue("obj")}); QJsonObject genFilesRequestPerProduct; genFilesRequestPerProduct.insert("full-display-name", "theApp"); genFilesRequestPerProduct.insert("requests", QJsonArray({genFilesRequestPerFile})); QJsonObject genFilesRequest; genFilesRequest.insert("type", "get-generated-files-for-sources"); genFilesRequest.insert("products", QJsonArray({genFilesRequestPerProduct})); sendPacket(genFilesRequest); receivedReply = false; while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QCOMPARE(receivedMessage.value("type").toString(), QString("generated-files-for-sources")); const QJsonArray products = receivedMessage.value("products").toArray(); QCOMPARE(products.size(), 1); const QJsonArray results = products.first().toObject().value("results").toArray(); QCOMPARE(results.size(), 1); const QJsonObject result = results.first().toObject(); QCOMPARE(result.value("source-file"), QDir::currentPath() + "/main.cpp"); const QJsonArray generatedFiles = result.value("generated-files").toArray(); QCOMPARE(generatedFiles.count(), 1); QCOMPARE( QFileInfo(generatedFiles.first().toString()).fileName(), "main.cpp" + objectSuffix); receivedReply = true; } QVERIFY(receivedReply); // Release project. const QJsonObject releaseRequest{qMakePair(QString("type"), QJsonValue("release-project"))}; sendPacket(releaseRequest); receivedReply = false; while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QCOMPARE(receivedMessage.value("type").toString(), QString("project-released")); const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); receivedReply = true; } QVERIFY(receivedReply); // Get build graph info. QJsonObject loadProjectMessage; loadProjectMessage.insert("type", "resolve-project"); loadProjectMessage.insert("configuration-name", "my-config"); loadProjectMessage.insert("build-root", QDir::currentPath()); loadProjectMessage.insert("settings-dir", settings()->baseDirectory()); loadProjectMessage.insert("restore-behavior", "restore-only"); loadProjectMessage.insert("data-mode", "only-if-changed"); sendPacket(loadProjectMessage); receivedReply = false; while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); if (receivedMessage.value("type") != "project-resolved") continue; receivedReply = true; const QJsonObject error = receivedMessage.value("error").toObject(); if (!error.isEmpty()) qDebug() << error; QVERIFY(error.isEmpty()); const QString bgFilePath = QDir::currentPath() + '/' + relativeBuildGraphFilePath("my-config"); const QJsonObject projectData = receivedMessage.value("project-data").toObject(); QCOMPARE(projectData.value("build-graph-file-path").toString(), bgFilePath); QCOMPARE(projectData.value("overridden-properties"), overriddenValues); } QVERIFY(receivedReply); // Send unknown request. const QJsonObject unknownRequest({qMakePair(QString("type"), QJsonValue("blubb"))}); sendPacket(unknownRequest); receivedReply = false; while (!receivedReply) { receivedMessage = getNextSessionPacket(sessionProc, incomingData); QCOMPARE(receivedMessage.value("type").toString(), QString("protocol-error")); receivedReply = true; } QVERIFY(receivedReply); QJsonObject quitRequest; quitRequest.insert("type", "quit"); sendPacket(quitRequest); QVERIFY(sessionProc.waitForFinished(3000)); } void TestBlackbox::radAfterIncompleteBuild_data() { QTest::addColumn("projectFileName"); QTest::newRow("Project with Rule") << "project_with_rule.qbs"; QTest::newRow("Project with Transformer") << "project_with_transformer.qbs"; } void TestBlackbox::radAfterIncompleteBuild() { QDir::setCurrent(testDataDir + "/rad-after-incomplete-build"); rmDirR(relativeBuildDir()); const QString projectFileName = "project_with_rule.qbs"; // Step 1: Have a directory where a file used to be. QbsRunParameters params(QStringList() << "-f" << projectFileName); QCOMPARE(runQbs(params), 0); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFileName, "oldfile", "oldfile/newfile"); params.expectFailure = true; QVERIFY(runQbs(params) != 0); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFileName, "oldfile/newfile", "newfile"); params.expectFailure = false; QCOMPARE(runQbs(params), 0); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFileName, "newfile", "oldfile/newfile"); QCOMPARE(runQbs(params), 0); // Step 2: Have a file where a directory used to be. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFileName, "oldfile/newfile", "oldfile"); params.expectFailure = true; QVERIFY(runQbs(params) != 0); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFileName, "oldfile", "newfile"); params.expectFailure = false; QCOMPARE(runQbs(params), 0); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFileName, "newfile", "oldfile"); QCOMPARE(runQbs(params), 0); } void TestBlackbox::subProfileChangeTracking() { QDir::setCurrent(testDataDir + "/subprofile-change-tracking"); const SettingsPtr s = settings(); qbs::Internal::TemporaryProfile subProfile("qbs-autotests-subprofile", s.get()); subProfile.p.setValue("baseProfile", profileName()); subProfile.p.setValue("cpp.includePaths", QStringList("/tmp/include1")); s->sync(); QCOMPARE(runQbs(), 0); subProfile.p.setValue("cpp.includePaths", QStringList("/tmp/include2")); s->sync(); QbsRunParameters params; params.command = "resolve"; QCOMPARE(runQbs(params), 0); params.command = "build"; QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("main1.cpp")); QVERIFY(m_qbsStdout.contains("main2.cpp")); } void TestBlackbox::successiveChanges() { QDir::setCurrent(testDataDir + "/successive-changes"); QCOMPARE(runQbs(), 0); QbsRunParameters params("resolve", QStringList() << "products.theProduct.type:output,blubb"); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); params.arguments << "project.version:2"; QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QFile output(relativeProductBuildDir("theProduct") + "/output.out"); QVERIFY2(output.open(QIODevice::ReadOnly), qPrintable(output.errorString())); const QByteArray version = output.readAll(); QCOMPARE(version.constData(), "2"); } void TestBlackbox::installedApp() { QDir::setCurrent(testDataDir + "/installed_artifact"); QCOMPARE(runQbs(), 0); const QByteArray output = m_qbsStdout; QVERIFY(regularFileExists( defaultInstallRoot + appendExecSuffix(QStringLiteral("/usr/bin/installedApp"), output))); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("qbs.installRoot:" + testDataDir + "/installed-app"))), 0); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists( testDataDir + appendExecSuffix("/installed-app/usr/bin/installedApp", output))); QFile addedFile(defaultInstallRoot + QLatin1String("/blubb.txt")); QVERIFY(addedFile.open(QIODevice::WriteOnly)); addedFile.close(); QVERIFY(addedFile.exists()); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); QCOMPARE(runQbs(QbsRunParameters(QStringList() << "--clean-install-root")), 0); QVERIFY(regularFileExists( defaultInstallRoot + appendExecSuffix(QStringLiteral("/usr/bin/installedApp"), output))); QVERIFY(regularFileExists(defaultInstallRoot + QLatin1String("/usr/src/main.cpp"))); QVERIFY(!addedFile.exists()); // Check whether changing install parameters on the product causes re-installation. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("installed_artifact.qbs", "qbs.installPrefix: \"/usr\"", "qbs.installPrefix: '/usr/local'"); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists( defaultInstallRoot + appendExecSuffix(QStringLiteral("/usr/local/bin/installedApp"), output))); QVERIFY(regularFileExists(defaultInstallRoot + QLatin1String("/usr/local/src/main.cpp"))); // Check whether changing install parameters on the artifact causes re-installation. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("installed_artifact.qbs", "qbs.installDir: \"bin\"", "qbs.installDir: 'custom'"); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists( defaultInstallRoot + appendExecSuffix(QStringLiteral("/usr/local/custom/installedApp"), output))); // Check whether changing install parameters on a source file causes re-installation. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("installed_artifact.qbs", "qbs.installDir: \"src\"", "qbs.installDir: 'source'"); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(defaultInstallRoot + QLatin1String("/usr/local/source/main.cpp"))); // Check whether changing install parameters on the command line causes re-installation. QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("qbs.installRoot:" + relativeBuildDir() + "/blubb"))), 0); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(relativeBuildDir() + "/blubb/usr/local/source/main.cpp")); // Check --no-install rmDirR(relativeBuildDir()); QCOMPARE(runQbs(QbsRunParameters(QStringList() << "--no-install")), 0); QCOMPARE(QDir(defaultInstallRoot).entryList(QDir::NoDotAndDotDot).size(), 0); // Check --no-build (with and without an existing build graph) QbsRunParameters params("install", QStringList() << "--no-build"); QCOMPARE(runQbs(params), 0); rmDirR(relativeBuildDir()); params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("Build graph not found"), m_qbsStderr.constData()); } void TestBlackbox::installDuplicates() { QDir::setCurrent(testDataDir + "/install-duplicates"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY(m_qbsStderr.contains("Cannot install files")); } void TestBlackbox::installDuplicatesNoError() { QDir::setCurrent(testDataDir + "/install-duplicates-no-error"); QbsRunParameters params; QCOMPARE(runQbs(params), 0); } void TestBlackbox::installedSourceFiles() { QDir::setCurrent(testDataDir + "/installed-source-files"); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(defaultInstallRoot + QLatin1String("/readme.txt"))); QVERIFY(regularFileExists(defaultInstallRoot + QLatin1String("/main.cpp"))); } void TestBlackbox::toolLookup() { QbsRunParameters params(QStringLiteral("setup-toolchains"), QStringList("--help")); params.profile.clear(); QCOMPARE(runQbs(params), 0); } void TestBlackbox::topLevelSearchPath() { QDir::setCurrent(testDataDir + "/toplevel-searchpath"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("MyProduct"), m_qbsStderr.constData()); params.arguments << ("project.qbsSearchPaths:" + QDir::currentPath() + "/qbs-resources"); QCOMPARE(runQbs(params), 0); } void TestBlackbox::checkProjectFilePath() { QDir::setCurrent(testDataDir + "/project_filepath_check"); QbsRunParameters params(QStringList("-f") << "project1.qbs"); QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("main.cpp"), m_qbsStdout.constData()); QCOMPARE(runQbs(params), 0); params.arguments = QStringList("-f") << "project2.qbs"; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY(m_qbsStderr.contains("project file")); params.arguments = QStringList("-f") << "project2.qbs"; params.command = "resolve"; params.expectFailure = false; QCOMPARE(runQbs(params), 0); params.command = "build"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("main2.cpp"), m_qbsStdout.constData()); } void TestBlackbox::checkTimestamps() { QDir::setCurrent(testDataDir + "/check-timestamps"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling file.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QVERIFY(QFile::remove(relativeBuildGraphFilePath())); WAIT_FOR_NEW_TIMESTAMP(); touch("file.h"); QCOMPARE(runQbs(QStringList("--check-timestamps")), 0); QVERIFY2(m_qbsStdout.contains("compiling file.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); } void TestBlackbox::chooseModuleInstanceByPriorityAndVersion() { QFETCH(QString, idol); QFETCH(QStringList, expectedSubStrings); QFETCH(bool, expectSuccess); QDir::setCurrent(testDataDir + "/choose-module-instance"); rmDirR(relativeBuildDir()); QbsRunParameters params(QStringList("modules.qbs.targetPlatform:" + idol)); params.expectFailure = !expectSuccess; if (expectSuccess) { QCOMPARE(runQbs(params), 0); } else { QVERIFY(runQbs(params) != 0); return; } const QString installRoot = relativeBuildDir() + "/install-root/"; QVERIFY(QFile::exists(installRoot + "/gerbil.txt")); QFile file(installRoot + "/gerbil.txt"); QVERIFY(file.open(QIODevice::ReadOnly)); const QString content = QString::fromUtf8(file.readAll()); for (const auto &str : expectedSubStrings) { if (content.contains(str)) continue; qDebug() << "content:" << content; qDebug() << "substring:" << str; QFAIL("missing substring"); } } void TestBlackbox::chooseModuleInstanceByPriorityAndVersion_data() { QTest::addColumn("idol"); QTest::addColumn("expectedSubStrings"); QTest::addColumn("expectSuccess"); QTest::newRow("ringo") << "Beatles" << QStringList() << false; QTest::newRow("ritchie1") << "Deep Purple" << QStringList{"slipped", "litchi", "ritchie"} << true; QTest::newRow("ritchie2") << "Rainbow" << QStringList{"slipped", "litchi", "ritchie"} << true; QTest::newRow("lord") << "Whitesnake" << QStringList{"chewed", "cord", "lord"} << true; } class TemporaryDefaultProfileRemover { public: TemporaryDefaultProfileRemover(qbs::Settings *settings) : m_settings(settings), m_defaultProfile(settings->defaultProfile()) { m_settings->remove(QStringLiteral("defaultProfile")); } ~TemporaryDefaultProfileRemover() { if (!m_defaultProfile.isEmpty()) m_settings->setValue(QStringLiteral("defaultProfile"), m_defaultProfile); } private: qbs::Settings *m_settings; const QString m_defaultProfile; }; void TestBlackbox::assembly() { QDir::setCurrent(testDataDir + "/assembly"); QCOMPARE(runQbs(QbsRunParameters("build", {"-p", "properties"})), 0); const QVariantMap properties = ([&]() { QFile propertiesFile(relativeProductBuildDir("properties") + "/properties.json"); if (propertiesFile.open(QIODevice::ReadOnly)) return QJsonDocument::fromJson(propertiesFile.readAll()).toVariant().toMap(); return QVariantMap{}; })(); QVERIFY(!properties.empty()); const auto toolchain = properties.value("qbs.toolchain").toStringList(); const auto architecture = properties.value("qbs.architecture").toString(); QVERIFY(!toolchain.empty()); const bool haveGcc = toolchain.contains("gcc"); const bool haveMSVC = toolchain.contains("msvc"); if (toolchain.contains("emscripten")) { QSKIP("Skipping test for emscripten"); } if (haveMSVC && (architecture.contains("arm"))) { QSKIP("Skipping test for MSVC ARM"); } QCOMPARE(runQbs(QbsRunParameters("build")), 0); QCOMPARE(m_qbsStdout.contains("assembling testa.s"), haveGcc); QCOMPARE(m_qbsStdout.contains("compiling testb.S"), haveGcc); QCOMPARE(m_qbsStdout.contains("compiling testc.sx"), haveGcc); QCOMPARE(m_qbsStdout.contains("creating libtesta.a"), haveGcc); QCOMPARE(m_qbsStdout.contains("creating libtestb.a"), haveGcc); QCOMPARE(m_qbsStdout.contains("creating libtestc.a"), haveGcc); QCOMPARE(m_qbsStdout.contains("creating testd.lib"), haveMSVC); } void TestBlackbox::autotestWithDependencies() { QDir::setCurrent(testDataDir + "/autotest-with-dependencies"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QStringList({"-p", "autotest-runner"})), 0); QVERIFY2(m_qbsStdout.contains("i am the test app") && m_qbsStdout.contains("i am the helper"), m_qbsStdout.constData()); } void TestBlackbox::autotestTimeout() { QFETCH(QStringList, resolveParams); QFETCH(bool, expectFailure); QFETCH(QString, errorDetails); QDir::setCurrent(testDataDir + "/autotest-timeout"); QbsRunParameters resolveParameters("resolve", resolveParams); QCOMPARE(runQbs(resolveParameters), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters buildParameters(QStringList({"-p", "autotest-runner"})); buildParameters.expectFailure = expectFailure; if (expectFailure) { QVERIFY(runQbs(buildParameters) != 0); QVERIFY( m_qbsStderr.contains("cancelled") && m_qbsStderr.contains("timeout") && m_qbsStderr.contains(errorDetails.toLocal8Bit())); } else QVERIFY(runQbs(buildParameters) == 0); } void TestBlackbox::autotestTimeout_data() { QTest::addColumn("resolveParams"); QTest::addColumn("expectFailure"); QTest::addColumn("errorDetails"); QTest::newRow("no timeout") << QStringList() << false << QString(); QTest::newRow("timeout on test") << QStringList({"products.testApp.autotest.timeout:2"}) << true << QString("testApp"); QTest::newRow("timeout on runner") << QStringList({"products.autotest-runner.timeout:2"}) << true << QString("testApp"); } void TestBlackbox::autotests_data() { QTest::addColumn("evilPropertySpec"); QTest::addColumn("expectedErrorMessage"); QTest::newRow("missing arguments") << QString("products.test1.autotest.arguments:[]") << QByteArray("This test needs exactly one argument"); QTest::newRow("missing working dir") << QString("products.test2.autotest.workingDir:''") << QByteArray("Test resource not found"); QTest::newRow("missing flaky specifier") << QString("products.test3.autotest.allowFailure:false") << QByteArray("I am an awful test"); QTest::newRow("everything's fine") << QString() << QByteArray(); } void TestBlackbox::autotests() { QDir::setCurrent(testDataDir + "/autotests"); QFETCH(QString, evilPropertySpec); QFETCH(QByteArray, expectedErrorMessage); QbsRunParameters resolveParams("resolve"); if (!evilPropertySpec.isEmpty()) resolveParams.arguments << evilPropertySpec; QCOMPARE(runQbs(resolveParams), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters testParams(QStringList{"-p", "autotest-runner"}); if (!evilPropertySpec.isEmpty()) testParams.expectFailure = true; QCOMPARE(runQbs(testParams) == 0, !testParams.expectFailure); if (testParams.expectFailure) { QVERIFY2(m_qbsStderr.contains(expectedErrorMessage), m_qbsStderr.constData()); return; } QVERIFY2(m_qbsStdout.contains("running test test1") && m_qbsStdout.contains("running test test2") && m_qbsStdout.contains("running test test3"), m_qbsStdout.constData()); QCOMPARE(m_qbsStdout.count("PASS"), 2); QCOMPARE(m_qbsStderr.count("FAIL"), 1); } void TestBlackbox::auxiliaryInputsFromDependencies() { QDir::setCurrent(testDataDir + "/aux-inputs-from-deps"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("generating dummy.out"), m_qbsStdout.constData()); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("products.dep.sleep:false"))), 0); WAIT_FOR_NEW_TIMESTAMP(); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("generating dummy.out"), m_qbsStdout.constData()); } void TestBlackbox::explicitlyDependsOn() { QFETCH(QString, useExplicitlyDependsOn); QFETCH(QString, useExplicitlyDependsOnFromDependencies); QFETCH(QString, useModule); QFETCH(bool, expectFailure); QDir::setCurrent(testDataDir + "/explicitly-depends-on"); QbsRunParameters params("", QStringList("products.prod1.useExplicitlyDependsOn:" + useExplicitlyDependsOn) << "products.prod1.useExplicitlyDependsOnFromDependencies:" + useExplicitlyDependsOnFromDependencies << "projects.proj1.useModule:" + useModule); params.expectFailure = expectFailure; rmDirR(relativeBuildDir()); if (params.expectFailure) { // Build should fail because a rule cycle is created within the product when // explicitlyDependsOn is used. QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("Cycle detected in rule dependencies"), m_qbsStderr.constData()); } else { // When explicitlyDependsOnFromDependencies is used, build should succeed due to the // "final" tag being pulled in from dependencies. QCOMPARE(runQbs(params), 0); if (useModule == QLatin1String("false")) { QVERIFY2(m_qbsStdout.contains("creating 'product-fish.txt' tagged with 'final'"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("Using explicitlyDependsOnArtifact: product-fish.txt"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("step1 -> step2"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("step2 -> step3"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("step3 -> final"), m_qbsStdout.constData()); } else { QVERIFY2(!m_qbsStdout.contains("creating 'product-fish.txt' tagged with 'final'"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("Using explicitlyDependsOnArtifact: module-fish.txt"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("step1 -> step2"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("step2 -> step3"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("step3 -> final"), m_qbsStdout.constData()); } } } void TestBlackbox::explicitlyDependsOn_data() { QTest::addColumn("useExplicitlyDependsOn"); QTest::addColumn("useExplicitlyDependsOnFromDependencies"); QTest::addColumn("useModule"); QTest::addColumn("expectFailure"); QTest::newRow("useExplicitlyDependsOn -> causes cycle") << "true" << "false" << "false" << true; QTest::newRow("explicitlyDependsOnFromDependencies + product") << "false" << "true" << "false" << false; QTest::newRow("explicitlyDependsOnFromDependencies + module + filesAreTargets") << "false" << "true" << "true" << false; } static bool haveMakeNsis() { QStringList regKeys; regKeys << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\NSIS") << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS"); QStringList paths = QProcessEnvironment::systemEnvironment().value("PATH") .split(HostOsInfo::pathListSeparator(), Qt::SkipEmptyParts); for (const QString &key : std::as_const(regKeys)) { QSettings settings(key, QSettings::NativeFormat); QString str = settings.value(QStringLiteral(".")).toString(); if (!str.isEmpty()) paths.prepend(str); } bool haveMakeNsis = false; for (const QString &path : std::as_const(paths)) { if (regularFileExists(QDir::fromNativeSeparators(path) + HostOsInfo::appendExecutableSuffix(QStringLiteral("/makensis")))) { haveMakeNsis = true; break; } } return haveMakeNsis; } void TestBlackbox::nsis() { if (!haveMakeNsis()) { QSKIP("makensis is not installed"); return; } QDir::setCurrent(testDataDir + "/nsis"); QVERIFY(runQbs() == 0); const bool targetIsWindows = m_qbsStdout.contains("is Windows: true"); const bool targetIsNotWindows = m_qbsStdout.contains("is Windows: false"); QCOMPARE(targetIsWindows, !targetIsNotWindows); QCOMPARE(m_qbsStdout.contains("compiling hello.nsi"), targetIsWindows); QCOMPARE( m_qbsStdout.contains("SetCompressor ignored due to previous call with the /FINAL switch"), targetIsWindows); QVERIFY(!QFile::exists(defaultInstallRoot + "/you-should-not-see-a-file-with-this-name.exe")); } void TestBlackbox::nsisDependencies() { if (!haveMakeNsis()) { QSKIP("makensis is not installed"); return; } QDir::setCurrent(testDataDir + "/nsisDependencies"); QCOMPARE(runQbs(), 0); const bool targetIsWindows = m_qbsStdout.contains("is Windows: true"); const bool targetIsNotWindows = m_qbsStdout.contains("is Windows: false"); QCOMPARE(targetIsWindows, !targetIsNotWindows); QCOMPARE(m_qbsStdout.contains("compiling hello.nsi"), targetIsWindows); } void TestBlackbox::outOfDateMarking() { QDir::setCurrent(testDataDir + "/out-of-date-marking"); for (int i = 0; i < 25; ++i) { QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("generating myheader.h"), qPrintable(QString::number(i))); QVERIFY2(m_qbsStdout.contains("compiling main.c"), qPrintable(QString::number(i))); } } void TestBlackbox::enableExceptions() { QFETCH(QString, file); QFETCH(bool, enable); QFETCH(bool, expectSuccess); QDir::setCurrent(testDataDir + QStringLiteral("/enableExceptions")); QbsRunParameters params; params.arguments = QStringList() << "-f" << file << (QStringLiteral("modules.cpp.enableExceptions:") + (enable ? "true" : "false")); params.expectFailure = !expectSuccess; rmDirR(relativeBuildDir()); if (!params.expectFailure) QCOMPARE(runQbs(params), 0); else QVERIFY(runQbs(params) != 0); } void TestBlackbox::enableExceptions_data() { QTest::addColumn("file"); QTest::addColumn("enable"); QTest::addColumn("expectSuccess"); QTest::newRow("no exceptions, enabled") << "none.qbs" << true << true; QTest::newRow("no exceptions, disabled") << "none.qbs" << false << true; QTest::newRow("C++ exceptions, enabled") << "exceptions.qbs" << true << true; QTest::newRow("C++ exceptions, disabled") << "exceptions.qbs" << false << false; if (HostOsInfo::isMacosHost()) { QTest::newRow("Objective-C exceptions, enabled") << "exceptions-objc.qbs" << true << true; QTest::newRow("Objective-C exceptions in Objective-C++ source, enabled") << "exceptions-objcpp.qbs" << true << true; QTest::newRow("C++ exceptions in Objective-C++ source, enabled") << "exceptions-objcpp-cpp.qbs" << true << true; QTest::newRow("Objective-C, disabled") << "exceptions-objc.qbs" << false << false; QTest::newRow("Objective-C exceptions in Objective-C++ source, disabled") << "exceptions-objcpp.qbs" << false << false; QTest::newRow("C++ exceptions in Objective-C++ source, disabled") << "exceptions-objcpp-cpp.qbs" << false << false; } } void TestBlackbox::enableRtti() { QDir::setCurrent(testDataDir + QStringLiteral("/enableRtti")); QbsRunParameters params; params.arguments = QStringList() << "modules.cpp.enableRtti:true"; rmDirR(relativeBuildDir()); QCOMPARE(runQbs(params), 0); if (HostOsInfo::isMacosHost()) { params.arguments = QStringList() << "modules.cpp.enableRtti:true" << "project.treatAsObjcpp:true"; rmDirR(relativeBuildDir()); QCOMPARE(runQbs(params), 0); } params.expectFailure = true; params.arguments = QStringList() << "modules.cpp.enableRtti:false"; rmDirR(relativeBuildDir()); QVERIFY(runQbs(params) != 0); if (HostOsInfo::isMacosHost()) { params.arguments = QStringList() << "modules.cpp.enableRtti:false" << "project.treatAsObjcpp:true"; rmDirR(relativeBuildDir()); QVERIFY(runQbs(params) != 0); } } void TestBlackbox::envMerging() { QDir::setCurrent(testDataDir + "/env-merging"); QbsRunParameters params("resolve"); QString pathVal = params.environment.value("PATH"); pathVal.prepend(HostOsInfo::pathListSeparator()).prepend("/opt/blackbox/bin"); const QString keyName = HostOsInfo::isWindowsHost() ? "pATh" : "PATH"; params.environment.insert(keyName, pathVal); QCOMPARE(runQbs(params), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); params.command = "build"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains(QByteArray("PATH=/opt/tool/bin") + HostOsInfo::pathListSeparator().toLatin1()) && m_qbsStdout.contains(HostOsInfo::pathListSeparator().toLatin1() + QByteArray("/opt/blackbox/bin")), m_qbsStdout.constData()); } void TestBlackbox::envNormalization() { QDir::setCurrent(testDataDir + "/env-normalization"); QbsRunParameters params; params.environment.insert("myvar", "x"); QCOMPARE(runQbs(params), 0); if (HostOsInfo::isWindowsHost()) QVERIFY2(m_qbsStdout.contains("\"MYVAR\":\"x\""), m_qbsStdout.constData()); else QVERIFY2(m_qbsStdout.contains("\"myvar\":\"x\""), m_qbsStdout.constData()); } void TestBlackbox::generatedArtifactAsInputToDynamicRule() { QDir::setCurrent(testDataDir + "/generated-artifact-as-input-to-dynamic-rule"); QCOMPARE(runQbs(), 0); const QString oldFile = relativeProductBuildDir("p") + "/old.txt"; QVERIFY2(regularFileExists(oldFile), qPrintable(oldFile)); WAIT_FOR_NEW_TIMESTAMP(); QFile inputFile("input.txt"); QVERIFY2(inputFile.open(QIODevice::WriteOnly), qPrintable(inputFile.errorString())); inputFile.resize(0); inputFile.write("new.txt"); inputFile.close(); QCOMPARE(runQbs(), 0); QVERIFY2(!regularFileExists(oldFile), qPrintable(oldFile)); const QString newFile = relativeProductBuildDir("p") + "/new.txt"; QVERIFY2(regularFileExists(newFile), qPrintable(oldFile)); QVERIFY2(m_qbsStdout.contains("generating"), m_qbsStdout.constData()); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("generating"), m_qbsStdout.constData()); } void TestBlackbox::generateLinkerMapFile() { QDir::setCurrent(testDataDir + "/generate-linker-map-file"); QCOMPARE(runQbs(), 0); const bool isUsed = m_qbsStdout.contains("use test: true"); const bool isNotUsed = m_qbsStdout.contains("use test: false"); QVERIFY(isUsed != isNotUsed); if (isUsed) { QVERIFY(QFile::exists(relativeProductBuildDir("app-map") + "/app-map.map")); QVERIFY(!QFile::exists(relativeProductBuildDir("app-nomap") + "/app-nomap.map")); QVERIFY(!QFile::exists(relativeProductBuildDir("app-nomap-default") + "/app-nomap-default.map")); } else { QSKIP("Unsupported toolchain. Skipping."); } } void TestBlackbox::generator() { QFETCH(QString, inputFile); QFETCH(QStringList, toBeCompiled); QDir::setCurrent(testDataDir + "/generator"); if (!inputFile.isEmpty()) { WAIT_FOR_NEW_TIMESTAMP(); QFile input(inputFile); QFile output("input.txt"); QVERIFY2(!output.exists() || output.remove(), qPrintable(output.errorString())); QVERIFY2(input.copy(output.fileName()), qPrintable(input.errorString())); touch(output.fileName()); } QCOMPARE(runQbs(), 0); QCOMPARE(toBeCompiled.contains("main.cpp"), m_qbsStdout.contains("compiling main.cpp")); QCOMPARE(toBeCompiled.contains("file1.cpp"), m_qbsStdout.contains("compiling file1.cpp")); QCOMPARE(toBeCompiled.contains("file2.cpp"), m_qbsStdout.contains("compiling file2.cpp")); } void TestBlackbox::generator_data() { QTest::addColumn("inputFile"); QTest::addColumn("toBeCompiled"); QTest::newRow("both") << "input.both.txt" << QStringList{"main.cpp", "file1.cpp", "file2.cpp"}; QTest::newRow("file1") << "input.file1.txt" << QStringList{"file1.cpp"}; QTest::newRow("file2") << "input.file2.txt" << QStringList{"file2.cpp"}; QTest::newRow("none") << "input.none.txt" << QStringList(); QTest::newRow("both again") << "input.both.txt" << QStringList{"file1.cpp", "file2.cpp"}; QTest::newRow("no update") << QString() << QStringList(); } void TestBlackbox::nodejs() { const SettingsPtr s = settings(); qbs::Profile p(profileName(), s.get()); int status; findNodejs(&status); QCOMPARE(status, 0); QDir::setCurrent(testDataDir + QLatin1String("/nodejs")); status = runQbs(); if (p.value("nodejs.toolchainInstallPath").toString().isEmpty() && status != 0 && m_qbsStderr.contains("toolchainInstallPath")) { QSKIP("nodejs.toolchainInstallPath not set and automatic detection failed"); } if (p.value("nodejs.packageManagerPrefixPath").toString().isEmpty() && status != 0 && m_qbsStderr.contains("nodejs.packageManagerPrefixPath")) { QSKIP("nodejs.packageManagerFilePath not set and automatic detection failed"); } if (p.value("nodejs.interpreterFilePath").toString().isEmpty() && status != 0 && m_qbsStderr.contains("interpreterPath")) { QSKIP("nodejs.interpreterFilePath not set and automatic detection failed"); } if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(status, 0); QbsRunParameters params; params.command = QLatin1String("run"); QCOMPARE(runQbs(params), 0); QVERIFY((bool)m_qbsStdout.contains("hello world")); QVERIFY(regularFileExists(relativeProductBuildDir("hello") + "/hello.js")); } void TestBlackbox::typescript() { if (qEnvironmentVariableIsSet("GITHUB_ACTIONS")) QSKIP("Skip this test when running on GitHub"); if (qEnvironmentVariableIsSet("EMSDK")) QSKIP("Skip this test when running with wasm"); const SettingsPtr s = settings(); qbs::Profile p(profileName(), s.get()); int status; findTypeScript(&status); QCOMPARE(status, 0); QDir::setCurrent(testDataDir + QLatin1String("/typescript")); QbsRunParameters params; params.expectFailure = true; status = runQbs(params); if (p.value("typescript.toolchainInstallPath").toString().isEmpty() && status != 0) { if (m_qbsStderr.contains("Path\" must be specified")) QSKIP("typescript probe failed"); if (m_qbsStderr.contains("typescript.toolchainInstallPath")) QSKIP("typescript.toolchainInstallPath not set and automatic detection failed"); if (m_qbsStderr.contains("nodejs.interpreterFilePath")) QSKIP("nodejs.interpreterFilePath not set and automatic detection failed"); } if (status != 0) qDebug() << m_qbsStderr; QCOMPARE(status, 0); params.expectFailure = false; params.command = QStringLiteral("run"); params.arguments = QStringList() << "-p" << "animals"; QCOMPARE(runQbs(params), 0); QVERIFY(regularFileExists(relativeProductBuildDir("animals") + "/animals.js")); QVERIFY(regularFileExists(relativeProductBuildDir("animals") + "/extra.js")); QVERIFY(regularFileExists(relativeProductBuildDir("animals") + "/main.js")); } void TestBlackbox::undefinedTargetPlatform() { QDir::setCurrent(testDataDir + "/undefined-target-platform"); QCOMPARE(runQbs(), 0); } void TestBlackbox::importInPropertiesCondition() { QDir::setCurrent(testDataDir + "/import-in-properties-condition"); QCOMPARE(runQbs(), 0); } void TestBlackbox::importSearchPath() { QDir::setCurrent(testDataDir + "/import-searchpath"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("compiling somefile.cpp"), m_qbsStdout.constData()); } void TestBlackbox::importingProduct() { QDir::setCurrent(testDataDir + "/importing-product"); QCOMPARE(runQbs(), 0); } void TestBlackbox::importsConflict() { QDir::setCurrent(testDataDir + "/imports-conflict"); QCOMPARE(runQbs(), 0); } void TestBlackbox::includeLookup() { QDir::setCurrent(testDataDir + "/includeLookup"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "run"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("definition.."), m_qbsStdout.constData()); } void TestBlackbox::inputTagsChangeTracking_data() { QTest::addColumn("generateInput"); QTest::newRow("source artifact") << QString("no"); QTest::newRow("generated artifact (static)") << QString("static"); QTest::newRow("generated artifact (dynamic)") << QString("dynamic"); } void TestBlackbox::inputTagsChangeTracking() { QDir::setCurrent(testDataDir + "/input-tags-change-tracking"); const QString xOut = QDir::currentPath() + '/' + relativeProductBuildDir("p") + "/x.out"; const QString yOut = QDir::currentPath() + '/' + relativeProductBuildDir("p") + "/y.out"; QFETCH(QString, generateInput); const QbsRunParameters resolveParams("resolve", QStringList("products.p.generateInput:" + generateInput)); QCOMPARE(runQbs(resolveParams), 0); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("generating input.txt") == (generateInput == "static")); QVERIFY2(!QFile::exists(xOut), qPrintable(xOut)); QVERIFY2(!QFile::exists(yOut), qPrintable(yOut)); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("input-tags-change-tracking.qbs", "Tags: [\"txt\", \"empty\"]", "Tags: \"txt\""); QCOMPARE(runQbs(), 0); QVERIFY2(QFile::exists(xOut), qPrintable(xOut)); QVERIFY2(!QFile::exists(yOut), qPrintable(yOut)); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("input-tags-change-tracking.qbs", "Tags: \"txt\"", "Tags: [\"txt\", \"y\"]"); QCOMPARE(runQbs(), 0); QVERIFY2(!QFile::exists(xOut), qPrintable(xOut)); QVERIFY2(QFile::exists(yOut), qPrintable(yOut)); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("input-tags-change-tracking.qbs", "Tags: [\"txt\", \"y\"]", "Tags: [\"txt\", \"empty\"]"); QCOMPARE(runQbs(), 0); QVERIFY2(!QFile::exists(xOut), qPrintable(xOut)); QVERIFY2(!QFile::exists(yOut), qPrintable(yOut)); } void TestBlackbox::outputArtifactAutoTagging() { QDir::setCurrent(testDataDir + QLatin1String("/output-artifact-auto-tagging")); QCOMPARE(runQbs(), 0); QVERIFY( regularFileExists(relativeExecutableFilePath("output-artifact-auto-tagging", m_qbsStdout))); } void TestBlackbox::outputRedirection() { QDir::setCurrent(testDataDir + "/output-redirection"); QCOMPARE(runQbs(), 0); TEXT_FILE_COMPARE("output.txt", relativeProductBuildDir("the-product") + "/output.txt"); TEXT_FILE_COMPARE("output.bin", relativeProductBuildDir("the-product") + "/output.bin"); } void TestBlackbox::wildCardsAndRules() { QDir::setCurrent(testDataDir + "/wildcards-and-rules"); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("creating output artifact")); QFile output(relativeProductBuildDir("wildcards-and-rules") + "/test.mytype"); QVERIFY2(output.open(QIODevice::ReadOnly), qPrintable(output.errorString())); QCOMPARE(output.readAll().count('\n'), 1); output.close(); // Add input. WAIT_FOR_NEW_TIMESTAMP(); touch("input2.inp"); QbsRunParameters params; params.expectFailure = true; QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("creating output artifact")); QVERIFY2(output.open(QIODevice::ReadOnly), qPrintable(output.errorString())); QCOMPARE(output.readAll().count('\n'), 2); output.close(); // Add "explicitlyDependsOn". WAIT_FOR_NEW_TIMESTAMP(); touch("dep.dep"); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("creating output artifact")); // Add nothing. QCOMPARE(runQbs(), 0); QVERIFY(!m_qbsStdout.contains("creating output artifact")); } void TestBlackbox::wildCardsAndChangeTracking_data() { QTest::addColumn("dirToModify"); QTest::addColumn("expectReResolve"); QTest::newRow("root path") << QString(".") << false; QTest::newRow("dir with recursive match") << QString("recursive1") << false; QTest::newRow("non-recursive base dir") << QString("nonrecursive") << true; QTest::newRow("empty base dir with file patterns") << QString("nonrecursive/empty") << true; } void TestBlackbox::wildCardsAndChangeTracking() { QFETCH(QString, dirToModify); QFETCH(bool, expectReResolve); const QString srcDir = testDataDir + "/wildcards-and-change-tracking"; QDir::setCurrent(srcDir); rmDirR("default"); QDir::current().mkdir("nonrecursive/empty"); QCOMPARE(runQbs({"resolve"}), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch(dirToModify + "/blubb.txt"); QCOMPARE(runQbs({"resolve"}), 0); QCOMPARE(m_qbsStdout.contains("Resolving"), expectReResolve); } void TestBlackbox::loadableModule() { QDir::setCurrent(testDataDir + QLatin1String("/loadablemodule")); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "run"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("foo = 42"), m_qbsStdout.constData()); } void TestBlackbox::localDeployment() { QDir::setCurrent(testDataDir + "/localDeployment"); QFile main("main.cpp"); QVERIFY(main.open(QIODevice::ReadOnly)); QByteArray content = main.readAll(); content.replace('\r', ""); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "run"; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains(content), m_qbsStdout.constData()); } void TestBlackbox::makefileGenerator() { QDir::setCurrent(testDataDir + "/makefile-generator"); const QbsRunParameters params("generate", QStringList{"-g", "makefile"}); QCOMPARE(runQbs(params), 0); if (HostOsInfo::isWindowsHost()) return; if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QProcess make; make.setWorkingDirectory(QDir::currentPath() + '/' + relativeBuildDir()); const QString customInstallRoot = QDir::currentPath() + "/my-install-root"; make.start("make", QStringList{"INSTALL_ROOT=" + customInstallRoot, "install"}); QVERIFY(waitForProcessSuccess(make)); QVERIFY(QFile::exists(relativeExecutableFilePath("the app", m_qbsStdout))); QVERIFY(!QFile::exists(relativeBuildGraphFilePath())); QProcess app; app.start(customInstallRoot + "/usr/local/bin/the app", QStringList()); QVERIFY(waitForProcessSuccess(app)); const QByteArray appStdout = app.readAllStandardOutput(); QVERIFY2(appStdout.contains("Hello, World!"), appStdout.constData()); make.start("make", QStringList("clean")); QVERIFY(waitForProcessSuccess(make)); QVERIFY(!QFile::exists(relativeExecutableFilePath("the app", m_qbsStdout))); } void TestBlackbox::maximumCLanguageVersion() { QDir::setCurrent(testDataDir + "/maximum-c-language-version"); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("products.app.enableNewestModule:true"))), 0); const bool isMsvc = m_qbsStdout.contains("is msvc: true"); if (isMsvc && m_qbsStdout.contains("is old msvc: true")) QSKIP("MSVC supports setting the C language version only from version 16.8, and Clang from version 13."); QCOMPARE(runQbs(QStringList({"--command-echo-mode", "command-line", "-n"})), 0); QVERIFY2(m_qbsStdout.contains("c11") || m_qbsStdout.contains("c1x"), m_qbsStdout.constData()); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("products.app.enableNewestModule:false"))), 0); QCOMPARE(runQbs(QStringList({"--command-echo-mode", "command-line", "-n"})), 0); if (isMsvc) QVERIFY2(!m_qbsStdout.contains("c11"), m_qbsStdout.constData()); else QVERIFY2(m_qbsStdout.contains("c99"), m_qbsStdout.constData()); } void TestBlackbox::maximumCxxLanguageVersion() { QDir::setCurrent(testDataDir + "/maximum-cxx-language-version"); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("products.app.enableNewestModule:true"))), 0); QCOMPARE(runQbs(QStringList({"--command-echo-mode", "command-line", "-n"})), 0); QVERIFY2( m_qbsStdout.contains("c++26") || m_qbsStdout.contains("c++2c") || m_qbsStdout.contains("c++latest"), m_qbsStdout.constData()); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("products.app.enableNewestModule:false"))), 0); QCOMPARE(runQbs(QStringList({"--command-echo-mode", "command-line", "-n"})), 0); QVERIFY2(m_qbsStdout.contains("c++14") || m_qbsStdout.contains("c++1y"), m_qbsStdout.constData()); } void TestBlackbox::minimumSystemVersion() { rmDirR(relativeBuildDir()); QDir::setCurrent(testDataDir + "/minimumSystemVersion"); QFETCH(QString, file); QFETCH(QString, output); QbsRunParameters params({ "-f", file + ".qbs" }); params.command = "resolve"; QCOMPARE(runQbs(params), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); params.command = "run"; QCOMPARE(runQbs(params), 0); if (m_qbsStdout.contains("Unsupported compiler")) QSKIP("Unsupported compiler"); if (!m_qbsStdout.contains(output.toUtf8())) { qDebug() << "expected output:" << qPrintable(output); qDebug() << "actual output:" << m_qbsStdout.constData(); } QVERIFY(m_qbsStdout.contains(output.toUtf8())); } static qbs::Version fromMinimumDeploymentTargetValue(int v, bool isMacOS) { if (isMacOS && v < 100000) return qbs::Version(v / 100, v / 10 % 10, v % 10); return qbs::Version(v / 10000, v / 100 % 100, v % 100); } static int toMinimumDeploymentTargetValue(const qbs::Version &v, bool isMacOS) { if (isMacOS && v < qbs::Version(10, 10)) return (v.majorVersion() * 100) + (v.minorVersion() * 10) + v.patchLevel(); return (v.majorVersion() * 10000) + (v.minorVersion() * 100) + v.patchLevel(); } static qbs::Version defaultClangMinimumDeploymentTarget() { QProcess process; process.start("/usr/bin/xcrun", {"-sdk", "macosx", "clang++", "-target", "x86_64-apple-macosx-macho", "-dM", "-E", "-x", "objective-c++", "/dev/null"}); if (waitForProcessSuccess(process)) { const auto lines = process.readAllStandardOutput().split('\n'); for (const auto &line : lines) { static const QByteArray prefix = "#define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ "; if (line.startsWith(prefix)) { bool ok = false; int v = line.mid(prefix.size()).trimmed().toInt(&ok); if (ok) return fromMinimumDeploymentTargetValue(v, true); break; } } } return qbs::Version(); } void TestBlackbox::minimumSystemVersion_data() { QTest::addColumn("file"); QTest::addColumn("output"); // Don't check for the full "version X.Y.Z\n" on macOS as some older versions of otool don't // show the patch version. Instead, simply check for "version X.Y" with no trailing \n. const QString unspecified = []() -> QString { if (HostOsInfo::isMacosHost()) { const auto v = defaultClangMinimumDeploymentTarget(); auto result = "__MAC_OS_X_VERSION_MIN_REQUIRED=" + QString::number(toMinimumDeploymentTargetValue(v, true)); if (v >= qbs::Version(10, 14)) result += "\nminos "; else result += "\nversion "; result += QString::number(v.majorVersion()) + "." + QString::number(v.minorVersion()); return result; } if (HostOsInfo::isWindowsHost()) return "WINVER is not defined\n"; return ""; }(); const QString specific = []() -> QString { if (HostOsInfo::isMacosHost()) { if (HostOsInfo::hostOSArchitecture() == "arm64") return "__MAC_OS_X_VERSION_MIN_REQUIRED=110000\nminos 11.0\n"; else return "__MAC_OS_X_VERSION_MIN_REQUIRED=1070\nversion 10.7\n"; } if (HostOsInfo::isWindowsHost()) return "WINVER=1538\n6.02 operating system version\n6.02 subsystem version\n"; return ""; }(); QTest::newRow("unspecified") << "unspecified" << unspecified; QTest::newRow("unspecified-forced") << "unspecified-forced" << unspecified; if (HostOsInfo::isWindowsHost() || HostOsInfo::isMacosHost()) QTest::newRow("specific") << "specific" << specific; if (HostOsInfo::isWindowsHost()) QTest::newRow("fakewindows") << "fakewindows" << "WINVER=1283\n5.03 operating system " "version\n5.03 subsystem version\n"; if (HostOsInfo::isMacosHost()) { if (HostOsInfo::hostOSArchitecture() == "arm64") { QTest::newRow("macappstore") << "macappstore" << "__MAC_OS_X_VERSION_MIN_REQUIRED=110000"; } else { QTest::newRow("macappstore") << "macappstore" << "__MAC_OS_X_VERSION_MIN_REQUIRED=1071"; } } } void TestBlackbox::missingBuildGraph() { QTemporaryDir tmpDir; QVERIFY(tmpDir.isValid()); QDir::setCurrent(tmpDir.path()); QFETCH(QString, configName); const QStringList commands({"clean", "dump-nodes-tree", "status", "update-timestamps"}); const QString actualConfigName = configName.isEmpty() ? QString("default") : configName; QbsRunParameters params; params.expectFailure = true; params.arguments << QLatin1String("config:") + actualConfigName; for (const QString &command : std::as_const(commands)) { params.command = command; QVERIFY2(runQbs(params) != 0, qPrintable(command)); const QString expectedErrorMessage = QString("Build graph not found for " "configuration '%1'").arg(actualConfigName); if (!m_qbsStderr.contains(expectedErrorMessage.toLocal8Bit())) { qDebug() << command; qDebug() << expectedErrorMessage; qDebug() << m_qbsStderr; QFAIL("unexpected error message"); } } } void TestBlackbox::missingBuildGraph_data() { QTest::addColumn("configName"); QTest::newRow("implicit config name") << QString(); QTest::newRow("explicit config name") << QString("customConfig"); } void TestBlackbox::missingDependency() { QDir::setCurrent(testDataDir + "/missing-dependency"); QbsRunParameters params; params.expectFailure = true; params.arguments << "-p" << "theApp"; QVERIFY(runQbs(params) != 0); QVERIFY2(!m_qbsStderr.contains("ASSERT"), m_qbsStderr.constData()); QCOMPARE(runQbs(QbsRunParameters(QStringList() << "-p" << "theDep")), 0); params.expectFailure = false; params.arguments << "-vv"; QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStderr.contains("false positive")); } void TestBlackbox::missingProjectFile() { QDir::setCurrent(testDataDir + "/missing-project-file/empty-dir"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("No project file given and none found in current directory"), m_qbsStderr.constData()); QDir::setCurrent(testDataDir + "/missing-project-file"); params.arguments << "-f" << "empty-dir"; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("No project file found in directory"), m_qbsStderr.constData()); params.arguments = QStringList() << "-f" << "ambiguous-dir"; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("More than one project file found in directory"), m_qbsStderr.constData()); params.expectFailure = false; params.arguments = QStringList() << "-f" << "project-dir"; QCOMPARE(runQbs(params), 0); WAIT_FOR_NEW_TIMESTAMP(); touch("project-dir/file.cpp"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling file.cpp"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); } void TestBlackbox::missingOverridePrefix() { QDir::setCurrent(testDataDir + "/missing-override-prefix"); QbsRunParameters params; params.expectFailure = true; params.arguments << "blubb.whatever:false"; QVERIFY(runQbs(params) != 0); QVERIFY2(m_qbsStderr.contains("Property override key 'blubb.whatever' not understood"), m_qbsStderr.constData()); } void TestBlackbox::moduleConditions() { QDir::setCurrent(testDataDir + "/module-conditions"); QCOMPARE(runQbs(), 0); QCOMPARE(m_qbsStdout.count("loaded m1"), 1); QCOMPARE(m_qbsStdout.count("loaded m2"), 2); QCOMPARE(m_qbsStdout.count("loaded m3"), 1); QCOMPARE(m_qbsStdout.count("loaded m4"), 1); } void TestBlackbox::movedFileDependency() { QDir::setCurrent(testDataDir + "/moved-file-dependency"); const QString subdir2 = QDir::currentPath() + "/subdir2"; QVERIFY(QDir::current().mkdir(subdir2)); const QString oldHeaderFilePath = QDir::currentPath() + "/subdir1/theheader.h"; const QString newHeaderFilePath = subdir2 + "/theheader.h"; QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QFile f(oldHeaderFilePath); QVERIFY2(f.rename(newHeaderFilePath), qPrintable(f.errorString())); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); f.setFileName(newHeaderFilePath); QVERIFY2(f.rename(oldHeaderFilePath), qPrintable(f.errorString())); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); } void TestBlackbox::msvcAsmLinkerFlags() { QDir::setCurrent(testDataDir + "/msvc-asm-flags"); QCOMPARE(runQbs(), 0); } void TestBlackbox::badInterpreter() { if (!HostOsInfo::isAnyUnixHost()) QSKIP("only applies on Unix"); QDir::setCurrent(testDataDir + QLatin1String("/badInterpreter")); QCOMPARE(runQbs(), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params("run"); params.expectFailure = true; const QRegularExpression reNoSuchFileOrDir("bad interpreter:.* No such file or directory"); const QRegularExpression rePermissionDenied("bad interpreter:.* Permission denied"); params.arguments = QStringList() << "-p" << "script-interp-missing"; QCOMPARE(runQbs(params), 1); QString strerr = QString::fromLocal8Bit(m_qbsStderr); QVERIFY2(strerr.contains(reNoSuchFileOrDir), m_qbsStderr); params.arguments = QStringList() << "-p" << "script-interp-noexec"; QCOMPARE(runQbs(params), 1); strerr = QString::fromLocal8Bit(m_qbsStderr); QVERIFY2(strerr.contains(reNoSuchFileOrDir) || strerr.contains(rePermissionDenied) || strerr.contains("script-noexec: bad interpreter: execve: Exec format error"), qPrintable(strerr)); params.arguments = QStringList() << "-p" << "script-noexec"; QCOMPARE(runQbs(params), 1); QCOMPARE(runQbs(QbsRunParameters("run", QStringList() << "-p" << "script-ok")), 0); } void TestBlackbox::bomSources() { QDir::setCurrent(testDataDir + "/bom-sources"); const bool success = runQbs() == 0; if (!success) QSKIP("Assuming compiler cannot deal with byte order mark"); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); touch("theheader.h"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); } void TestBlackbox::buildDataOfDisabledProduct() { QDir::setCurrent(testDataDir + QLatin1String("/build-data-of-disabled-product")); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("compiling test.cpp"), m_qbsStdout.constData()); // Touch a source file, disable the product, rebuild the project, verify nothing happens. WAIT_FOR_NEW_TIMESTAMP(); touch("test.cpp"); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("products.app.condition:false"))), 0); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("compiling"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("linking"), m_qbsStdout.constData()); // Enable the product again, rebuild the project, verify that only the changed source file // is rebuilt. QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("products.app.condition:true"))), 0); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("compiling main.cpp"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("compiling test.cpp"), m_qbsStdout.constData()); } void TestBlackbox::qbsVersion() { const auto v = qbs::LanguageInfo::qbsVersion(); QDir::setCurrent(testDataDir + QLatin1String("/qbsVersion")); QbsRunParameters params; params.arguments = QStringList() << "project.qbsVersion:" + v.toString() << "project.qbsVersionMajor:" + QString::number(v.majorVersion()) << "project.qbsVersionMinor:" + QString::number(v.minorVersion()) << "project.qbsVersionPatch:" + QString::number(v.patchLevel()); QCOMPARE(runQbs(params), 0); params.arguments.push_back("project.qbsVersionPatch:" + QString::number(v.patchLevel() + 1)); params.expectFailure = true; QVERIFY(runQbs(params) != 0); } void TestBlackbox::transitiveInvalidDependencies() { QDir::setCurrent(testDataDir + "/transitive-invalid-dependencies"); QbsRunParameters params; QCOMPARE(runQbs(params), 0); QVERIFY2(m_qbsStdout.contains("b.present = false"), m_qbsStdout); QVERIFY2(m_qbsStdout.contains("c.present = true"), m_qbsStdout); QVERIFY2(m_qbsStdout.contains("d.present = false"), m_qbsStdout); } void TestBlackbox::transitiveOptionalDependencies() { QDir::setCurrent(testDataDir + "/transitive-optional-dependencies"); QbsRunParameters params; QCOMPARE(runQbs(params), 0); } void TestBlackbox::groupsInModules() { QDir::setCurrent(testDataDir + "/groups-in-modules"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("compiling rock.coal to rock.diamond")); QVERIFY(m_qbsStdout.contains("compiling chunk.coal to chunk.diamond")); QVERIFY(m_qbsStdout.contains("compiling helper2.c")); QVERIFY(!m_qbsStdout.contains("compiling helper3.c")); QVERIFY(m_qbsStdout.contains("compiling helper4.c")); QVERIFY(m_qbsStdout.contains("compiling helper5.c")); QVERIFY(!m_qbsStdout.contains("compiling helper6.c")); QVERIFY(m_qbsStdout.contains("compiling helper7.c")); QVERIFY(m_qbsStdout.contains("compiling helper8.c")); QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling rock.coal to rock.diamond")); QVERIFY(!m_qbsStdout.contains("compiling chunk.coal to chunk.diamond")); WAIT_FOR_NEW_TIMESTAMP(); touch("modules/helper/diamondc.c"); waitForFileUnlock(); QCOMPARE(runQbs(params), 0); QVERIFY(m_qbsStdout.contains("compiling diamondc.c")); QVERIFY(m_qbsStdout.contains("compiling rock.coal to rock.diamond")); QVERIFY(m_qbsStdout.contains("compiling chunk.coal to chunk.diamond")); QVERIFY(regularFileExists(relativeProductBuildDir("groups-in-modules") + "/rock.diamond")); QFile output(relativeProductBuildDir("groups-in-modules") + "/rock.diamond"); QVERIFY(output.open(QIODevice::ReadOnly)); QCOMPARE(output.readAll().trimmed(), QByteArray("diamond")); } void TestBlackbox::grpc_data() { QTest::addColumn("projectFile"); QTest::addColumn("arguments"); QTest::addColumn("hasModules"); QStringList pkgConfigArgs({"project.qbsModuleProviders:qbspkgconfig"}); // on macOS, openSSL is hidden from pkg-config by default if (qbs::Internal::HostOsInfo::isMacosHost()) { pkgConfigArgs << "moduleProviders.qbspkgconfig.extraPaths:/usr/local/opt/openssl@1.1/lib/pkgconfig"; } QTest::newRow("cpp-pkgconfig") << QString("grpc_cpp.qbs") << pkgConfigArgs << true; QStringList conanArgs( {"project.qbsModuleProviders:conan", "moduleProviders.conan.installDirectory:build"}); QTest::newRow("cpp-conan") << QString("grpc_cpp.qbs") << conanArgs << true; } void TestBlackbox::grpc() { QDir::setCurrent(testDataDir + "/grpc"); QFETCH(QString, projectFile); QFETCH(QStringList, arguments); QFETCH(bool, hasModules); rmDirR(relativeBuildDir()); if (QTest::currentDataTag() == QLatin1String("cpp-conan")) { if (!prepareAndRunConan()) QSKIP("conan is not prepared, check messages above"); } QbsRunParameters resolveParams("resolve", QStringList{"-f", projectFile}); resolveParams.arguments << arguments; QCOMPARE(runQbs(resolveParams), 0); const bool withGrpc = m_qbsStdout.contains("has grpc: true"); const bool withoutGrpc = m_qbsStdout.contains("has grpc: false"); QVERIFY2(withGrpc || withoutGrpc, m_qbsStdout.constData()); if (withoutGrpc) QSKIP("grpc module not present"); const bool hasMods = m_qbsStdout.contains("has modules: true"); const bool dontHaveMods = m_qbsStdout.contains("has modules: false"); QVERIFY2(hasMods == !dontHaveMods, m_qbsStdout.constData()); QCOMPARE(hasMods, hasModules); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters runParams; QCOMPARE(runQbs(runParams), 0); } void TestBlackbox::hostOsProperties() { QDir::setCurrent(testDataDir + "/host-os-properties"); QCOMPARE(runQbs(QStringLiteral("resolve")), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QStringLiteral("run")), 0); QVERIFY2(m_qbsStdout.contains( ("HOST_ARCHITECTURE = " + HostOsInfo::hostOSArchitecture().toUtf8()).data()), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains( ("HOST_PLATFORM = " + HostOsInfo::hostOSIdentifier().toUtf8()).data()), m_qbsStdout.constData()); } void TestBlackbox::ico() { QDir::setCurrent(testDataDir + "/ico"); QbsRunParameters params; params.expectFailure = true; params.arguments << "--command-echo-mode" << "command-line"; const int status = runQbs(params); if (status != 0) { if (m_qbsStderr.contains("Could not find icotool in any of the following locations:")) QSKIP("icotool is not installed"); if (!m_qbsStderr.isEmpty()) qDebug("%s", m_qbsStderr.constData()); if (!m_qbsStdout.isEmpty()) qDebug("%s", m_qbsStdout.constData()); } QCOMPARE(status, 0); QVERIFY(QFileInfo::exists(relativeProductBuildDir("icon") + "/icon.ico")); { QFile f(relativeProductBuildDir("icon") + "/icon.ico"); QVERIFY(f.open(QIODevice::ReadOnly)); const auto b = f.readAll().toStdString(); QCOMPARE(b.at(2), '\x1'); // icon QCOMPARE(b.at(4), '\x2'); // 2 images QVERIFY(b.find("\x89PNG") == std::string::npos); } QVERIFY(QFileInfo::exists(relativeProductBuildDir("icon-alpha") + "/icon-alpha.ico")); { QFile f(relativeProductBuildDir("icon-alpha") + "/icon-alpha.ico"); QVERIFY(f.open(QIODevice::ReadOnly)); const auto b = f.readAll().toStdString(); QCOMPARE(b.at(2), '\x1'); // icon QCOMPARE(b.at(4), '\x2'); // 2 images QVERIFY(b.find("\x89PNG") == std::string::npos); QVERIFY2(m_qbsStdout.contains("--alpha-threshold="), m_qbsStdout.constData()); } QVERIFY(QFileInfo::exists(relativeProductBuildDir("icon-big") + "/icon-big.ico")); { QFile f(relativeProductBuildDir("icon-big") + "/icon-big.ico"); QVERIFY(f.open(QIODevice::ReadOnly)); const auto b = f.readAll().toStdString(); QCOMPARE(b.at(2), '\x1'); // icon QCOMPARE(b.at(4), '\x5'); // 5 images QVERIFY(b.find("\x89PNG") != std::string::npos); } QVERIFY(QFileInfo::exists(relativeProductBuildDir("cursor") + "/cursor.cur")); { QFile f(relativeProductBuildDir("cursor") + "/cursor.cur"); QVERIFY(f.open(QIODevice::ReadOnly)); const auto b = f.readAll(); QVERIFY(b.size() > 0); QCOMPARE(b.at(2), '\x2'); // cursor QCOMPARE(b.at(4), '\x2'); // 2 images QCOMPARE(b.at(10), '\0'); QCOMPARE(b.at(12), '\0'); QCOMPARE(b.at(26), '\0'); QCOMPARE(b.at(28), '\0'); } QVERIFY(QFileInfo::exists(relativeProductBuildDir("cursor-hotspot") + "/cursor-hotspot.cur")); { QFile f(relativeProductBuildDir("cursor-hotspot") + "/cursor-hotspot.cur"); QVERIFY(f.open(QIODevice::ReadOnly)); const auto b = f.readAll(); QVERIFY(b.size() > 0); QCOMPARE(b.at(2), '\x2'); // cursor QCOMPARE(b.at(4), '\x2'); // 2 images const bool hasCursorHotspotBug = m_qbsStderr.contains( "does not support setting the hotspot for cursor files with multiple images"); if (hasCursorHotspotBug) { QCOMPARE(b.at(10), '\0'); QCOMPARE(b.at(12), '\0'); QCOMPARE(b.at(26), '\0'); QCOMPARE(b.at(28), '\0'); qWarning() << "this version of icoutil does not support setting the hotspot " "for cursor files with multiple images"; } else { QCOMPARE(b.at(10), '\x8'); QCOMPARE(b.at(12), '\x9'); QCOMPARE(b.at(26), '\x10'); QCOMPARE(b.at(28), '\x11'); } } QVERIFY(QFileInfo::exists(relativeProductBuildDir("cursor-hotspot-single") + "/cursor-hotspot-single.cur")); { QFile f(relativeProductBuildDir("cursor-hotspot-single") + "/cursor-hotspot-single.cur"); QVERIFY(f.open(QIODevice::ReadOnly)); const auto b = f.readAll(); QVERIFY(b.size() > 0); QCOMPARE(b.at(2), '\x2'); // cursor QCOMPARE(b.at(4), '\x1'); // 1 image // No version check needed because the hotspot can always be set if there's only one image QCOMPARE(b.at(10), '\x8'); QCOMPARE(b.at(12), '\x9'); } QVERIFY(QFileInfo::exists(relativeProductBuildDir("iconset") + "/dmg.ico")); { QFile f(relativeProductBuildDir("iconset") + "/dmg.ico"); QVERIFY(f.open(QIODevice::ReadOnly)); const auto b = f.readAll(); QVERIFY(b.size() > 0); QCOMPARE(b.at(2), '\x1'); // icon QCOMPARE(b.at(4), '\x5'); // 5 images } QVERIFY(QFileInfo::exists(relativeProductBuildDir("iconset") + "/dmg.cur")); { QFile f(relativeProductBuildDir("iconset") + "/dmg.cur"); QVERIFY(f.open(QIODevice::ReadOnly)); const auto b = f.readAll(); QVERIFY(b.size() > 0); QCOMPARE(b.at(2), '\x2'); // cursor QCOMPARE(b.at(4), '\x5'); // 5 images QCOMPARE(b.at(10), '\0'); QCOMPARE(b.at(12), '\0'); QCOMPARE(b.at(26), '\0'); QCOMPARE(b.at(28), '\0'); } } void TestBlackbox::importAssignment() { QDir::setCurrent(testDataDir + "/import-assignment"); QCOMPARE(runQbs(QStringList("project.qbsSearchPaths:" + QDir::currentPath())), 0); QVERIFY2(m_qbsStdout.contains("key 1 = value1") && m_qbsStdout.contains("key 2 = value2"), m_qbsStdout.constData()); } void TestBlackbox::importChangeTracking() { QDir::setCurrent(testDataDir + "/import-change-tracking"); QCOMPARE(runQbs(QStringList({"-f", "import-change-tracking.qbs"})), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running probe1"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running probe2"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom1 prepare script"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom2 prepare script"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom1 command"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom2 command"), m_qbsStdout.constData()); // Change in imported file that is not used in any rule or command. WAIT_FOR_NEW_TIMESTAMP(); touch("irrelevant.js"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe1 "), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe2"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 command"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 command"), m_qbsStdout.constData()); // Change in directly imported file only used by one prepare script. WAIT_FOR_NEW_TIMESTAMP(); touch("custom1prepare1.js"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe1 "), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe2"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom1 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 command"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 command"), m_qbsStdout.constData()); // Change in recursively imported file only used by one prepare script. WAIT_FOR_NEW_TIMESTAMP(); touch("custom1prepare2.js"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe1 "), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe2"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom1 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 command"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 command"), m_qbsStdout.constData()); // Change in imported file used only by one command. WAIT_FOR_NEW_TIMESTAMP(); touch("custom1command.js"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe1 "), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe2"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 prepare script"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom1 command"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 command"), m_qbsStdout.constData()); // Change in file only used by one prepare script, using directory import. WAIT_FOR_NEW_TIMESTAMP(); touch("custom2prepare/custom2prepare2.js"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe1 "), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe2"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 prepare script"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom2 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 command"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 command"), m_qbsStdout.constData()); // Change in file used only by one command, imported via search path. WAIT_FOR_NEW_TIMESTAMP(); touch("imports/custom2command/custom2command1.js"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe1 "), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe2"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 command"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom2 command"), m_qbsStdout.constData()); // Change in directly imported file only used by one Probe WAIT_FOR_NEW_TIMESTAMP(); touch("probe1.js"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running probe1"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe2"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 command"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 command"), m_qbsStdout.constData()); // Change in indirectly imported file only used by one Probe WAIT_FOR_NEW_TIMESTAMP(); touch("probe2.js"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running probe1"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe2"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 prepare script"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom1 command"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running custom2 command"), m_qbsStdout.constData()); // Change everything at once. WAIT_FOR_NEW_TIMESTAMP(); touch("irrelevant.js"); touch("custom1prepare1.js"); touch("custom1prepare2.js"); touch("custom1command.js"); touch("custom2prepare/custom2prepare1.js"); touch("imports/custom2command/custom2command2.js"); touch("probe2.js"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running probe1"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("running probe2"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom1 prepare script"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom2 prepare script"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom1 command"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("running custom2 command"), m_qbsStdout.constData()); } void TestBlackbox::probesInNestedModules() { QDir::setCurrent(testDataDir + "/probes-in-nested-modules"); QbsRunParameters params; QCOMPARE(runQbs(params), 0); QCOMPARE(m_qbsStdout.count("running probe a"), 1); QCOMPARE(m_qbsStdout.count("running probe b"), 1); QCOMPARE(m_qbsStdout.count("running probe c"), 1); QCOMPARE(m_qbsStdout.count("running second probe a"), 1); QVERIFY(m_qbsStdout.contains("product a, outer.somethingElse = goodbye")); QVERIFY(m_qbsStdout.contains("product b, inner.something = hahaha")); QVERIFY(m_qbsStdout.contains("product c, inner.something = hello")); QVERIFY(m_qbsStdout.contains("product a, inner.something = hahaha")); QVERIFY(m_qbsStdout.contains("product a, outer.something = hahaha")); } QTEST_MAIN(TestBlackbox) qbs-src-3.2.0/tests/auto/blackbox/blackbox-examples.qbs0000644000175100017510000000101115154533055022502 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "blackbox-examples" Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { name: "testdata" prefix: "../../../examples/" files: ["**/*"] fileTags: [] } files: [ "../shared.h", "tst_blackboxexamples.cpp", "tst_blackboxexamples.h", "tst_blackboxbase.cpp", "tst_blackboxbase.h", ] cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)]) } qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxexamples.cpp0000644000175100017510000000762015154533055023330 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "tst_blackboxexamples.h" #include #include QStringList TestBlackboxExamples::collectExamples(const QString &dirPath) { QStringList result; QDir dir(dirPath); const auto subDirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); for (const auto &subDir : subDirs) { const auto path = dir.filePath(subDir); if (!QFileInfo::exists(path + "/" + subDir + ".qbs")) continue; result.append(QDir(testDataDir).relativeFilePath(path)); } return result; } TestBlackboxExamples::TestBlackboxExamples() : TestBlackboxBase(SRCDIR "/../../../examples/", "blackbox-examples") { // setNeedsQt(); } void TestBlackboxExamples::baremetal_data() { QTest::addColumn("example"); QDir baremetal(testDataDir + "/baremetal/"); const auto subDirs = baremetal.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); for (const auto &subDir : subDirs) { const auto examples = collectExamples(baremetal.filePath(subDir)); for (const auto &example: examples) { const auto relativePath = baremetal.relativeFilePath(example); QTest::newRow(relativePath.toUtf8().data()) << relativePath; } } } void TestBlackboxExamples::baremetal() { QFETCH(QString, example); QVERIFY(QDir::setCurrent(testDataDir + "/" + example)); QCOMPARE(runQbs(), 0); } void TestBlackboxExamples::examples_data() { QTest::addColumn("example"); auto examples = collectExamples(testDataDir); examples.append(collectExamples(testDataDir + "/protobuf")); examples.append(collectExamples(testDataDir + "/flatbuffers")); examples.append(collectExamples(testDataDir + "/cxx-modules")); std::sort(examples.begin(), examples.end()); for (const auto &example: examples) { if (example == u"baremetal") continue; QTest::newRow(example.toUtf8().data()) << example; } } void TestBlackboxExamples::examples() { QFETCH(QString, example); QVERIFY(QDir::setCurrent(testDataDir + "/" + example)); QVERIFY(QDir::current().mkpath("build/conan-qbs-deps")); QbsRunParameters params( {QStringLiteral("-f"), QFileInfo(example).fileName() + QStringLiteral(".qbs"), QStringLiteral("moduleProviders.conan.installDirectory:build")}); QCOMPARE(runQbs(params), 0); } QTEST_MAIN(TestBlackboxExamples) qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxandroid.cpp0000644000175100017510000020553515154533055023137 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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 "tst_blackboxandroid.h" #include "../shared.h" #include #include #include #include #include #include using qbs::Internal::none_of; using qbs::Profile; QMap TestBlackboxAndroid::findAndroid(int *status, const QString &profile) { QTemporaryDir temp; QDir::setCurrent(testDataDir + "/find"); QbsRunParameters params = QStringList({"-f", "find-android.qbs", "qbs.architecture:x86"}); params.profile = profile; params.buildDirectory = temp.path(); const int res = runQbs(params); if (status) *status = res; QFile file(temp.path() + "/" + relativeProductBuildDir("find-android") + "/android.json"); if (!file.open(QIODevice::ReadOnly)) return {}; const auto tools = QJsonDocument::fromJson(file.readAll()).toVariant().toMap(); return { {"sdk", QDir::fromNativeSeparators(tools["sdk"].toString())}, {"sdk-build-tools-dx", QDir::fromNativeSeparators(tools["sdk-build-tools-dx"].toString())}, {"sdk-build-tools-d8", QDir::fromNativeSeparators(tools["sdk-build-tools-d8"].toString())}, {"ndk", QDir::fromNativeSeparators(tools["ndk"].toString())}, {"ndk-samples", QDir::fromNativeSeparators(tools["ndk-samples"].toString())}, {"jar", QDir::fromNativeSeparators(tools["jar"].toString())}, }; } TestBlackboxAndroid::TestBlackboxAndroid() : TestBlackboxBase(SRCDIR "/testdata-android", "blackbox-android") { } static QString theProfileName(bool forQt) { return forQt ? "qbs_autotests-android-qt" : profileName(); } void TestBlackboxAndroid::android() { QFETCH(QString, projectDir); QFETCH(QStringList, productNames); QFETCH(QList, expectedFilesLists); QFETCH(QStringList, customProperties); QFETCH(bool, enableAapt2); QFETCH(bool, generateAab); QFETCH(bool, isIncrementalBuild); QFETCH(bool, enableD8); // skip tests on github except when run in docker - this var is not propagated into the image if (qEnvironmentVariableIsSet("GITHUB_ACTIONS")) QSKIP("Skip Android tests when running on GitHub"); const SettingsPtr s = settings(); Profile p(theProfileName(projectDir == "qml-app" || projectDir == "qt-app"), s.get()); if (!p.exists()) QSKIP("Qt is not installed"); int status; const auto androidPaths = findAndroid(&status, p.name()); QCOMPARE(status, 0); const auto sdkPath = androidPaths["sdk"]; if (sdkPath.isEmpty()) QSKIP("Android SDK is not installed"); const auto ndkPath = androidPaths["ndk"]; if (ndkPath.isEmpty() && projectDir != "no-native") QSKIP("Android NDK is not installed"); const auto ndkSamplesPath = androidPaths["ndk-samples"]; static const QStringList ndkSamplesDirs = QStringList() << "teapot" << "no-native"; if (!ndkPath.isEmpty() && !QFileInfo(ndkSamplesPath).isDir() && ndkSamplesDirs.contains(projectDir)) QSKIP("NDK samples directory not present"); const QString buildSubDir = enableAapt2 ? (generateAab ? "aab" : "aapt2") : "aapt"; QDir::setCurrent(testDataDir + "/" + projectDir); if (!isIncrementalBuild) rmDirR(relativeBuildDir(buildSubDir)); static const QStringList configNames { "debug", "release" }; for (const QString &configName : configNames) { auto currentExpectedFilesLists = expectedFilesLists; const QString configArgument = "config:" + configName; QbsRunParameters resolveParams("resolve"); resolveParams.buildDirectory = buildSubDir; resolveParams.arguments << configArgument << customProperties; resolveParams.profile = p.name(); QCOMPARE(runQbs(resolveParams), 0); QbsRunParameters buildParams(QStringList{"--command-echo-mode", "command-line", configArgument}); buildParams.buildDirectory = buildSubDir; buildParams.profile = p.name(); QCOMPARE(runQbs(buildParams), 0); for (const QString &productName : std::as_const(productNames)) { const QByteArray tag(QTest::currentDataTag()); QCOMPARE(m_qbsStdout.count("generating BuildConfig.java"), isIncrementalBuild ? 0 : productNames.size()); const QString packageName = productName + (generateAab ? ".aab" : ".apk"); QVERIFY(m_qbsStdout.contains(packageName.toLocal8Bit())); const QString packageFilePath = buildSubDir + "/" + relativeProductBuildDir(productName, configName) + '/' + packageName; QVERIFY2(regularFileExists(packageFilePath), qPrintable(packageFilePath)); const QString jarFilePath = androidPaths["jar"]; QVERIFY(!jarFilePath.isEmpty()); QProcess jar; jar.start(jarFilePath, QStringList() << "-tf" << packageFilePath); QVERIFY2(jar.waitForStarted(), qPrintable(jar.errorString())); QVERIFY2(jar.waitForFinished(), qPrintable(jar.errorString())); QVERIFY2(jar.exitCode() == 0, qPrintable(jar.readAllStandardError().constData())); QByteArrayList actualFiles = jar.readAllStandardOutput().trimmed().split('\n'); for (QByteArray &f : actualFiles) f = f.trimmed(); QByteArrayList missingExpectedFiles; QByteArrayList expectedFiles = currentExpectedFilesLists.takeFirst(); for (const QByteArray &expectedFile : expectedFiles) { if (expectedFile.endsWith("/libgdbserver.so") && configName == "release") continue; auto it = std::find(actualFiles.begin(), actualFiles.end(), expectedFile); if (it != actualFiles.end()) { actualFiles.erase(it); continue; } missingExpectedFiles << expectedFile; } if (!missingExpectedFiles.empty()) QFAIL(QByteArray("missing expected files:\n") + missingExpectedFiles.join('\n')); if (!actualFiles.empty()) { QByteArray msg = "unexpected files encountered:\n" + actualFiles.join('\n'); auto isFileSharedObject = [](const QByteArray &f) { return f.endsWith(".so"); }; const auto isQmlToolingLib = [](const QByteArray &f) { return f.contains("qmltooling"); }; if (none_of(actualFiles, isFileSharedObject) || qbs::Internal::all_of(actualFiles, isQmlToolingLib)) { qWarning() << msg; } else { QFAIL(msg); } } } if (projectDir == "multiple-libs-per-apk") { const auto dexCompilerPath = enableD8 ? androidPaths["sdk-build-tools-d8"] : androidPaths["sdk-build-tools-dx"]; QVERIFY(!dexCompilerPath.isEmpty()); const auto lines = m_qbsStdout.split('\n'); const auto it = std::find_if(lines.cbegin(), lines.cend(), [&](const QByteArray &line) { return !line.isEmpty() && line.startsWith(dexCompilerPath.toUtf8()); }); QVERIFY2(it != lines.cend(), qPrintable(m_qbsStdout.constData())); const auto line = *it; QVERIFY2(line.contains("lib3.jar"), qPrintable(line.constData())); QVERIFY2(!line.contains("lib4.jar"), qPrintable(line.constData())); QVERIFY2(line.contains("lib5.jar"), qPrintable(line.constData())); QVERIFY2(line.contains("lib6.jar"), qPrintable(line.constData())); QVERIFY2(!line.contains("lib7.jar"), qPrintable(line.constData())); QVERIFY2(line.contains("lib8.jar"), qPrintable(line.constData())); } } } void TestBlackboxAndroid::android_data() { const SettingsPtr s = settings(); const Profile p(profileName(), s.get()); const Profile pQt(theProfileName(true), s.get()); QStringList archsStringList = p.value(QStringLiteral("qbs.architectures")).toStringList(); if (archsStringList.empty()) archsStringList << QStringLiteral("armv7a"); // must match default in common.qbs QByteArrayList archs; std::transform(archsStringList.begin(), archsStringList.end(), std::back_inserter(archs), [] (const QString &s) { return s.toUtf8().replace("armv7a", "armeabi-v7a") .replace("armv5te", "armeabi") .replace("arm64", "arm64-v8a"); }); const auto cxxLibPath = [&p, &pQt](const QByteArray &oldcxxLib, bool forQt) { const bool usesClang = (forQt ? pQt : p).value(QStringLiteral("qbs.toolchainType")) .toString() == "clang"; const QByteArray path = "lib/${ARCH}/"; return path + (usesClang ? QByteArrayLiteral("libc++_shared.so") : oldcxxLib); }; qbs::Version version(5, 13); QStringList qmakeFilePaths = pQt.value(QStringLiteral("moduleProviders.Qt.qmakeFilePaths")). toStringList(); if (qmakeFilePaths.size() >= 1) version = TestBlackboxBase::qmakeVersion(qmakeFilePaths[0]); bool singleArchQt = (version < qbs::Version(5, 14)); QByteArray qtVersionMajor((version >= qbs::Version(6, 0)) ? "6" : "5"); QByteArrayList archsForQt; if (singleArchQt) { archsForQt = { pQt.value("qbs.architecture").toString().toUtf8() }; if (archsStringList.empty()) archsStringList << QStringLiteral("armv7a"); // must match default in common.qbs } else { QStringList archsForQtStringList = pQt.value(QStringLiteral("qbs.architectures")) .toStringList(); if (archsForQtStringList.empty()) archsForQtStringList << pQt.value("qbs.architecture").toString(); std::transform(archsForQtStringList.begin(), archsForQtStringList.end(), std::back_inserter(archsForQt), [] (const QString &s) { return s.toUtf8(); }); } QByteArrayList ndkArchsForQt; std::transform(archsForQt.begin(), archsForQt.end(), std::back_inserter(ndkArchsForQt), [] (const QString &s) { return s.toUtf8().replace("armv7a", "armeabi-v7a") .replace("armv5te", "armeabi") .replace("arm64", "arm64-v8a"); }); auto expandArchs = [] (const QByteArrayList &archs, const QByteArrayList &lst, bool aabPackage) { const QByteArray &archPlaceHolder = "${ARCH}"; QByteArrayList result; QByteArray base( aabPackage ? "base/" : ""); for (const QByteArray &entry : lst) { if (entry.contains(archPlaceHolder)) { for (const QByteArray &arch : std::as_const(archs)) result << (base + QByteArray(entry).replace(archPlaceHolder, arch)); } else { result << (base + entry); } } return result; }; auto commonFiles = [](bool generateAab, bool codeSign = true, QString keyAlias="androiddebugkey") { QByteArrayList files; if (generateAab) files << "base/manifest/AndroidManifest.xml" << "base/dex/classes.dex" << "BundleConfig.pb"; else files << "AndroidManifest.xml" << "classes.dex"; if (codeSign) files << QByteArray("META-INF/" + keyAlias.toUpper().left(8).toUtf8() + ".RSA") << QByteArray("META-INF/" + keyAlias.toUpper().left(8).toUtf8() + ".SF") << "META-INF/MANIFEST.MF"; return files; }; QTest::addColumn("projectDir"); QTest::addColumn("productNames"); QTest::addColumn>("expectedFilesLists"); QTest::addColumn("customProperties"); QTest::addColumn("enableAapt2"); QTest::addColumn("generateAab"); QTest::addColumn("isIncrementalBuild"); QTest::addColumn("enableD8"); const auto aaptVersion = [](bool enableAapt2) { return QString("modules.Android.sdk.aaptName:") + (enableAapt2 ? "aapt2" : "aapt"); }; bool enableAapt2 = false; const auto packageType = [](bool generateAab) { return QString("modules.Android.sdk.packageType:") + (generateAab ? "aab" : "apk"); }; bool generateAab = false; bool isIncrementalBuild = false; const auto dexCompilerVersion = [](bool enableD8) { return QString("modules.Android.sdk.dexCompilerName:") + (enableD8 ? "d8" : "dx"); }; bool enableD8 = true; auto qtAppExpectedFiles = [&](bool generateAab, bool enableAapt2, bool codeSign = true, QString keyAlias="androiddebugkey") { QByteArrayList expectedFile; if (singleArchQt) { expectedFile << commonFiles(generateAab, codeSign, keyAlias) + expandArchs(ndkArchsForQt, { cxxLibPath("libgnustl_shared.so", true), "assets/--Added-by-androiddeployqt--/qt_cache_pregenerated_file_list", "lib/${ARCH}/libplugins_imageformats_libqgif.so", "lib/${ARCH}/libplugins_imageformats_libqicns.so", "lib/${ARCH}/libplugins_imageformats_libqico.so", "lib/${ARCH}/libplugins_imageformats_libqjpeg.so", "lib/${ARCH}/libplugins_imageformats_libqtga.so", "lib/${ARCH}/libplugins_imageformats_libqtiff.so", "lib/${ARCH}/libplugins_imageformats_libqwbmp.so", "lib/${ARCH}/libplugins_imageformats_libqwebp.so", "lib/${ARCH}/libplugins_platforms_android_libqtforandroid.so", "lib/${ARCH}/libplugins_styles_libqandroidstyle.so", "lib/${ARCH}/libQt5Core.so", "lib/${ARCH}/libQt5Gui.so", "lib/${ARCH}/libQt5Widgets.so", "lib/${ARCH}/libqt-app.so"}, generateAab); } else { expectedFile << commonFiles(generateAab, codeSign, keyAlias) + expandArchs(ndkArchsForQt, { cxxLibPath("libgnustl_shared.so", true), "lib/${ARCH}/libplugins_imageformats_qgif_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qico_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qjpeg_${ARCH}.so", "lib/${ARCH}/libplugins_platforms_qtforandroid_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Core_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Gui_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Widgets_${ARCH}.so", "lib/${ARCH}/libqt-app_${ARCH}.so"}, generateAab); } if (generateAab) expectedFile << "base/resources.pb" << "base/native.pb"; else expectedFile << "resources.arsc"; if (version >= qbs::Version(5, 14)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libplugins_styles_qandroidstyle_${ARCH}.so"}, generateAab); if (version < qbs::Version(6, 0) && version >= qbs::Version(5, 14)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libplugins_imageformats_qicns_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qtga_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qtiff_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qwbmp_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qwebp_${ARCH}.so"}, generateAab); if (version >= qbs::Version(6, 5)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libQt6Svg_${ARCH}.so", "lib/${ARCH}/libplugins_iconengines_qsvgicon_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qsvg_${ARCH}.so"}, generateAab); if (!enableAapt2 && version < qbs::Version(6, 0)) expectedFile << "res/layout/splash.xml"; return expectedFile; }; auto codeSignProperties = [&](bool codeSign, QString keyStorePath, QString keystorePassword, QString keyPassword, QString keyAlias) { if (!codeSign) return QStringList{"modules.codesign.enableCodeSigning:false"}; return QStringList{ "modules.codesign.enableCodeSigning:true", "modules.codesign.keystorePath:" + keyStorePath, "modules.codesign.keystorePassword:" + keystorePassword, "modules.codesign.keyPassword:" + keyPassword, "modules.codesign.keyAlias:" + keyAlias, }; }; bool codeSign = true; QString keyStorePath(testDataDir + "/qt-app/test.keystore"); QString keystorePassword("qbsKeystoreTest"); QString keyPassword("qbsKeyTest"); QString keyAlias("qbsTest"); QTest::newRow("qt app") << "qt-app" << QStringList("qt-app") << (QList() << (QByteArrayList() << qtAppExpectedFiles(generateAab, enableAapt2, codeSign, keyAlias))) << (QStringList() << codeSignProperties(codeSign, keyStorePath, keystorePassword, keyPassword, keyAlias) << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild << enableD8;; codeSign = false; QTest::newRow("qt app no signing") << "qt-app" << QStringList("qt-app") << (QList() << (QByteArrayList() << qtAppExpectedFiles(generateAab, enableAapt2, codeSign, keyAlias))) << (QStringList() << codeSignProperties(codeSign, keyStorePath, keystorePassword, keyPassword, keyAlias) << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = true; codeSign = true; QTest::newRow("qt app aapt2") << "qt-app" << QStringList("qt-app") << (QList() << (QByteArrayList() << qtAppExpectedFiles(generateAab, enableAapt2, codeSign, keyAlias))) << (QStringList() << codeSignProperties(codeSign, keyStorePath, keystorePassword, keyPassword, keyAlias) << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild << enableD8; generateAab = true; QTest::newRow("qt app aab") << "qt-app" << QStringList("qt-app") << (QList() << (QByteArrayList() << qtAppExpectedFiles(generateAab, enableAapt2, codeSign, keyAlias))) << (QStringList() << codeSignProperties(codeSign, keyStorePath, keystorePassword, keyPassword, keyAlias) << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild << enableD8; codeSign = false; QTest::newRow("qt app aab no signing") << "qt-app" << QStringList("qt-app") << (QList() << (QByteArrayList() << qtAppExpectedFiles(generateAab, enableAapt2, codeSign, keyAlias))) << (QStringList() << codeSignProperties(codeSign, keyStorePath, keystorePassword, keyPassword, keyAlias) << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild << enableD8; const QByteArrayList ndkArchsForQtSave = ndkArchsForQt; ndkArchsForQt = {ndkArchsForQt.first()}; QTest::newRow("qt app (single arch)") << "qt-app" << QStringList("qt-app") << (QList() << (QByteArrayList() << qtAppExpectedFiles(generateAab, enableAapt2))) << QStringList{aaptVersion(enableAapt2), packageType(generateAab), "modules.qbs.architectures:" + archsForQt.first()} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; ndkArchsForQt = ndkArchsForQtSave; auto teaPotAppExpectedFiles = [&](const QByteArrayList &archs, bool generateAab) { QByteArrayList expectedFile; expectedFile << commonFiles(generateAab) + expandArchs(archs, { "assets/Shaders/ShaderPlain.fsh", "assets/Shaders/VS_ShaderPlain.vsh", cxxLibPath("libgnustl_shared.so", false), "lib/${ARCH}/libTeapotNativeActivity.so", "res/layout/widgets.xml", "res/mipmap-hdpi-v4/ic_launcher.png", "res/mipmap-mdpi-v4/ic_launcher.png", "res/mipmap-xhdpi-v4/ic_launcher.png", "res/mipmap-xxhdpi-v4/ic_launcher.png"}, generateAab); if (generateAab) expectedFile << "base/resources.pb" << "base/assets.pb" << "base/native.pb"; else expectedFile << "resources.arsc"; return expectedFile; }; generateAab = false; enableAapt2 = false; QTest::newRow("teapot") << "teapot" << QStringList("TeapotNativeActivity") << (QList() << teaPotAppExpectedFiles(archs, generateAab)) << QStringList{aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = true; QTest::newRow("teapot aapt2") << "teapot" << QStringList("TeapotNativeActivity") << (QList() << teaPotAppExpectedFiles(archs, generateAab)) << QStringList{aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; generateAab = true; QTest::newRow("teapot aapt2 aab") << "teapot" << QStringList("TeapotNativeActivity") << (QList() << teaPotAppExpectedFiles(archs, generateAab)) << QStringList{aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = false; generateAab = false; QTest::newRow("minimal-native") << "minimal-native" << QStringList("minimalnative") << (QList() << commonFiles(generateAab) + expandArchs({archs.first()}, { "lib/${ARCH}/libminimalnative.so", cxxLibPath("libstlport_shared.so", false), "lib/${ARCH}/libdependency.so"}, generateAab)) << QStringList{"products.minimalnative.multiplexByQbsProperties:[]", "modules.qbs.architecture:" + archsStringList.first(), aaptVersion(enableAapt2)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = true; QTest::newRow("minimal-native aapt2") << "minimal-native" << QStringList("minimalnative") << (QList() << commonFiles(generateAab) + (QByteArrayList() << "resources.arsc") + expandArchs({archs.first()}, { "lib/${ARCH}/libminimalnative.so", cxxLibPath("libstlport_shared.so", false), "lib/${ARCH}/libdependency.so"}, generateAab)) << QStringList{"products.minimalnative.multiplexByQbsProperties:[]", "modules.qbs.architecture:" + archsStringList.first(), aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; generateAab = true; QTest::newRow("minimal-native aapt2 aab") << "minimal-native" << QStringList("minimalnative") << (QList() << commonFiles(generateAab) + (QByteArrayList() << "base/resources.pb" << "base/native.pb") + expandArchs({archs.first()}, { "lib/${ARCH}/libminimalnative.so", cxxLibPath("libstlport_shared.so", false), "lib/${ARCH}/libdependency.so"}, generateAab)) << QStringList{"products.minimalnative.multiplexByQbsProperties:[]", "modules.qbs.architecture:" + archsStringList.first(), aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; auto qmlAppExpectedFiles = [&](bool generateAab, bool enableAapt2) { QByteArrayList expectedFile; if (singleArchQt) { expectedFile << commonFiles(generateAab) + expandArchs(ndkArchsForQt, { "assets/--Added-by-androiddeployqt--/qml/QtQuick.2/plugins.qmltypes", "assets/--Added-by-androiddeployqt--/qml/QtQuick.2/qmldir", "assets/--Added-by-androiddeployqt--/qml/QtQuick/Window.2/plugins.qmltypes", "assets/--Added-by-androiddeployqt--/qml/QtQuick/Window.2/qmldir", "assets/--Added-by-androiddeployqt--/qt_cache_pregenerated_file_list", cxxLibPath("libgnustl_shared.so", true), "lib/${ARCH}/libplugins_bearer_libqandroidbearer.so", "lib/${ARCH}/libplugins_imageformats_libqgif.so", "lib/${ARCH}/libplugins_imageformats_libqicns.so", "lib/${ARCH}/libplugins_imageformats_libqico.so", "lib/${ARCH}/libplugins_imageformats_libqjpeg.so", "lib/${ARCH}/libplugins_imageformats_libqtga.so", "lib/${ARCH}/libplugins_imageformats_libqtiff.so", "lib/${ARCH}/libplugins_imageformats_libqwbmp.so", "lib/${ARCH}/libplugins_imageformats_libqwebp.so", "lib/${ARCH}/libplugins_platforms_android_libqtforandroid.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_debugger.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_inspector.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_local.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_messages.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_native.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_nativedebugger.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_profiler.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_preview.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_quickprofiler.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_server.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_tcp.so", "lib/${ARCH}/libqml_QtQuick.2_libqtquick2plugin.so", "lib/${ARCH}/libqml_QtQuick_Window.2_libwindowplugin.so", "lib/${ARCH}/libQt5Core.so", "lib/${ARCH}/libQt5Gui.so", "lib/${ARCH}/libQt5Network.so", "lib/${ARCH}/libQt5Qml.so", "lib/${ARCH}/libQt5QuickParticles.so", "lib/${ARCH}/libQt5Quick.so", "lib/${ARCH}/libqmlapp.so"}, generateAab); } else { expectedFile << commonFiles(generateAab) + expandArchs(ndkArchsForQt, { "assets/android_rcc_bundle.rcc", cxxLibPath("libgnustl_shared.so", true), "lib/${ARCH}/libplugins_imageformats_qgif_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qico_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qjpeg_${ARCH}.so", "lib/${ARCH}/libplugins_platforms_qtforandroid_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_debugger_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_inspector_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_local_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_messages_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_native_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_nativedebugger_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_profiler_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_preview_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_quickprofiler_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_server_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_tcp_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Core_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Gui_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Network_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Qml_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Quick_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "QmlModels_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "QmlWorkerScript_${ARCH}.so", "lib/${ARCH}/libqmlapp_${ARCH}.so"}, generateAab); if (version < qbs::Version(5, 15)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libQt5QuickParticles_${ARCH}.so"}, generateAab); if (version >= qbs::Version(5, 15) && version < qbs::Version(6, 0)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQml_StateMachine_qtqmlstatemachine_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_WorkerScript.2_workerscriptplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_Models.2_modelsplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_qmlplugin_${ARCH}.so"}, generateAab); if (version >= qbs::Version(5, 14) && version < qbs::Version(6, 0)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQuick.2_qtquick2plugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Window.2_windowplugin_${ARCH}.so"}, generateAab); if (version < qbs::Version(6, 0)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libplugins_bearer_qandroidbearer_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qicns_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qtga_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qtiff_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qwbmp_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qwebp_${ARCH}.so"}, generateAab); if (version >= qbs::Version(6, 5)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libQt6Svg_${ARCH}.so", "lib/${ARCH}/libplugins_iconengines_qsvgicon_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qsvg_${ARCH}.so"}, generateAab); if (version >= qbs::Version(6, 0)) { expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libQt6OpenGL_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_Models_modelsplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_WorkerScript_workerscriptplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_qtquick2plugin_${ARCH}.so"}, generateAab); if (version >= qbs::Version(6, 5)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQml_Base_qmlplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_qmlmetaplugin_${ARCH}.so"}, generateAab); else expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQml_qmlplugin_${ARCH}.so"}, generateAab); } if (version >= qbs::Version(6, 2)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libplugins_networkinformation_qandroidnetworkinformation_${ARCH}.so", "lib/${ARCH}/libplugins_tls_qcertonlybackend_${ARCH}.so", "lib/${ARCH}/libplugins_tls_qopensslbackend_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Window_quickwindowplugin_${ARCH}.so", }, generateAab); if (version >= qbs::Version(6, 0) && version < qbs::Version(6, 3)) { expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libQt6QuickControls2Impl_${ARCH}.so", "lib/${ARCH}/libQt6QuickControls2_${ARCH}.so", "lib/${ARCH}/libQt6QuickParticles_${ARCH}.so", "lib/${ARCH}/libQt6QuickShapes_${ARCH}.so", "lib/${ARCH}/libQt6QuickTemplates2_${ARCH}.so", "lib/${ARCH}/libQt6Sql_${ARCH}.so", "lib/${ARCH}/libplugins_sqldrivers_qsqlite_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Basic_impl_qtquickcontrols2basicstyleimplplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Basic_qtquickcontrols2basicstyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Fusion_impl_qtquickcontrols2fusionstyleimplplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Fusion_qtquickcontrols2fusionstyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Imagine_impl_qtquickcontrols2imaginestyleimplplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Imagine_qtquickcontrols2imaginestyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Material_impl_qtquickcontrols2materialstyleimplplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Material_qtquickcontrols2materialstyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Universal_impl_qtquickcontrols2universalstyleimplplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Universal_qtquickcontrols2universalstyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_impl_qtquickcontrols2implplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_qtquickcontrols2plugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_LocalStorage_qmllocalstorageplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_NativeStyle_qtquickcontrols2nativestyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Particles_particlesplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Shapes_qmlshapesplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Templates_qtquicktemplates2plugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Timeline_qtquicktimelineplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Layouts_qquicklayoutsplugin_${ARCH}.so"}, generateAab); if (version >= qbs::Version(6, 2)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQuick_tooling_quicktoolingplugin_${ARCH}.so", "lib/${ARCH}/libQt6QmlLocalStorage_${ARCH}.so", "lib/${ARCH}/libQt6QmlXmlListModel_${ARCH}.so", "lib/${ARCH}/libQt6QuickDialogs2QuickImpl_${ARCH}.so", "lib/${ARCH}/libQt6QuickDialogs2Utils_${ARCH}.so", "lib/${ARCH}/libQt6QuickDialogs2_${ARCH}.so", "lib/${ARCH}/libQt6QuickLayouts_${ARCH}.so", "lib/${ARCH}/libQt6QuickTimeline_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_XmlListModel_qmlxmllistmodelplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Dialogs_qtquickdialogsplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Dialogs_quickimpl_qtquickdialogs2quickimplplugin_${ARCH}.so"}, generateAab); else expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQuick_Window_quickwindow_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_tooling_quicktooling_${ARCH}.so"}, generateAab); } } if (generateAab) expectedFile << "base/resources.pb" << "base/assets.pb" << "base/native.pb"; else expectedFile << "resources.arsc"; if (!enableAapt2 && version < qbs::Version(6, 0)) expectedFile << "res/layout/splash.xml"; return expectedFile; }; auto qmlAppCustomMetaDataExpectedFiles = [&](bool generateAab, bool enableAapt2) { QByteArrayList expectedFile; if (singleArchQt) { expectedFile << commonFiles(generateAab) + expandArchs(ndkArchsForQt, { "assets/--Added-by-androiddeployqt--/qml/QtQuick.2/plugins.qmltypes", "assets/--Added-by-androiddeployqt--/qml/QtQuick.2/qmldir", "assets/--Added-by-androiddeployqt--/qml/QtQuick/Window.2/plugins.qmltypes", "assets/--Added-by-androiddeployqt--/qml/QtQuick/Window.2/qmldir", "assets/--Added-by-androiddeployqt--/qt_cache_pregenerated_file_list", "assets/dummyasset.txt", cxxLibPath("libgnustl_shared.so", true), "lib/${ARCH}/libplugins_bearer_libqandroidbearer.so", "lib/${ARCH}/libplugins_imageformats_libqgif.so", "lib/${ARCH}/libplugins_imageformats_libqicns.so", "lib/${ARCH}/libplugins_imageformats_libqico.so", "lib/${ARCH}/libplugins_imageformats_libqjpeg.so", "lib/${ARCH}/libplugins_imageformats_libqtga.so", "lib/${ARCH}/libplugins_imageformats_libqtiff.so", "lib/${ARCH}/libplugins_imageformats_libqwbmp.so", "lib/${ARCH}/libplugins_imageformats_libqwebp.so", "lib/${ARCH}/libplugins_platforms_android_libqtforandroid.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_debugger.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_inspector.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_local.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_messages.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_native.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_nativedebugger.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_profiler.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_preview.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_quickprofiler.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_server.so", "lib/${ARCH}/libplugins_qmltooling_libqmldbg_tcp.so", "lib/${ARCH}/libqml_QtQuick.2_libqtquick2plugin.so", "lib/${ARCH}/libqml_QtQuick_Window.2_libwindowplugin.so", "lib/${ARCH}/libQt5Core.so", "lib/${ARCH}/libQt5Gui.so", "lib/${ARCH}/libQt5Network.so", "lib/${ARCH}/libQt5Qml.so", "lib/${ARCH}/libQt5QuickParticles.so", "lib/${ARCH}/libQt5Quick.so", "lib/${ARCH}/libqmlapp.so"}, generateAab); } else { expectedFile << commonFiles(generateAab) + expandArchs(ndkArchsForQt, { "assets/android_rcc_bundle.rcc", "assets/dummyasset.txt", cxxLibPath("libgnustl_shared.so", true), "lib/${ARCH}/libplugins_imageformats_qgif_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qico_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qjpeg_${ARCH}.so", "lib/${ARCH}/libplugins_platforms_qtforandroid_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_debugger_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_inspector_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_local_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_messages_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_native_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_nativedebugger_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_profiler_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_preview_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_quickprofiler_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_server_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_tcp_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Core_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Gui_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Network_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Qml_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "Quick_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "QmlModels_${ARCH}.so", "lib/${ARCH}/libQt" + qtVersionMajor + "QmlWorkerScript_${ARCH}.so", "lib/${ARCH}/libqmlapp_${ARCH}.so"}, generateAab); if (version < qbs::Version(5, 15)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libQt5QuickParticles_${ARCH}.so"}, generateAab); if (version >= qbs::Version(5, 15) && version < qbs::Version(6, 0)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQml_StateMachine_qtqmlstatemachine_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_WorkerScript.2_workerscriptplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_Models.2_modelsplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_qmlplugin_${ARCH}.so"}, generateAab); if (version >= qbs::Version(5, 14) && version < qbs::Version(6, 0)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQuick.2_qtquick2plugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Window.2_windowplugin_${ARCH}.so"}, generateAab); if (version < qbs::Version(6, 0)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libplugins_bearer_qandroidbearer_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qicns_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qtga_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qtiff_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qwbmp_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qwebp_${ARCH}.so"}, generateAab); if (version >= qbs::Version(6, 5)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libQt6Svg_${ARCH}.so", "lib/${ARCH}/libplugins_iconengines_qsvgicon_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qsvg_${ARCH}.so"}, generateAab); if (version >= qbs::Version(6, 0)) { expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libQt6OpenGL_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_Models_modelsplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_WorkerScript_workerscriptplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_qtquick2plugin_${ARCH}.so"}, generateAab); if (version >= qbs::Version(6, 5)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQml_Base_qmlplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_qmlmetaplugin_${ARCH}.so"}, generateAab); else expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQml_qmlplugin_${ARCH}.so"}, generateAab); } if (version >= qbs::Version(6, 2)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libplugins_networkinformation_qandroidnetworkinformation_${ARCH}.so", "lib/${ARCH}/libplugins_tls_qcertonlybackend_${ARCH}.so", "lib/${ARCH}/libplugins_tls_qopensslbackend_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Window_quickwindowplugin_${ARCH}.so", }, generateAab); if (version >= qbs::Version(6, 0) && version < qbs::Version(6, 3)) { expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libQt6QuickControls2Impl_${ARCH}.so", "lib/${ARCH}/libQt6QuickControls2_${ARCH}.so", "lib/${ARCH}/libQt6QuickParticles_${ARCH}.so", "lib/${ARCH}/libQt6QuickShapes_${ARCH}.so", "lib/${ARCH}/libQt6QuickTemplates2_${ARCH}.so", "lib/${ARCH}/libQt6Sql_${ARCH}.so", "lib/${ARCH}/libplugins_sqldrivers_qsqlite_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Basic_impl_qtquickcontrols2basicstyleimplplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Basic_qtquickcontrols2basicstyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Fusion_impl_qtquickcontrols2fusionstyleimplplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Fusion_qtquickcontrols2fusionstyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Imagine_impl_qtquickcontrols2imaginestyleimplplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Imagine_qtquickcontrols2imaginestyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Material_impl_qtquickcontrols2materialstyleimplplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Material_qtquickcontrols2materialstyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Universal_impl_qtquickcontrols2universalstyleimplplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Universal_qtquickcontrols2universalstyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_impl_qtquickcontrols2implplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_qtquickcontrols2plugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_LocalStorage_qmllocalstorageplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_NativeStyle_qtquickcontrols2nativestyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Particles_particlesplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Shapes_qmlshapesplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Templates_qtquicktemplates2plugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Timeline_qtquicktimelineplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Layouts_qquicklayoutsplugin_${ARCH}.so"}, generateAab); if (version >= qbs::Version(6, 2)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQuick_tooling_quicktoolingplugin_${ARCH}.so", "lib/${ARCH}/libQt6QmlLocalStorage_${ARCH}.so", "lib/${ARCH}/libQt6QmlXmlListModel_${ARCH}.so", "lib/${ARCH}/libQt6QuickDialogs2QuickImpl_${ARCH}.so", "lib/${ARCH}/libQt6QuickDialogs2Utils_${ARCH}.so", "lib/${ARCH}/libQt6QuickDialogs2_${ARCH}.so", "lib/${ARCH}/libQt6QuickLayouts_${ARCH}.so", "lib/${ARCH}/libQt6QuickTimeline_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_XmlListModel_qmlxmllistmodelplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Dialogs_qtquickdialogsplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Dialogs_quickimpl_qtquickdialogs2quickimplplugin_${ARCH}.so"}, generateAab); else expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQuick_Window_quickwindow_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_tooling_quicktooling_${ARCH}.so"}, generateAab); } } if (generateAab) expectedFile << "base/resources.pb" << "base/assets.pb" << "base/native.pb"; else expectedFile << "resources.arsc"; if (!enableAapt2 && version < qbs::Version(6, 0)) expectedFile << "res/layout/splash.xml"; return expectedFile; }; QStringList qmlAppCustomProperties; if (singleArchQt) { qmlAppCustomProperties = QStringList{"modules.Android.sdk.automaticSources:false", "modules.qbs.architecture:" + archsForQt.first()}; } else { qmlAppCustomProperties = QStringList{"modules.Android.sdk.automaticSources:false"}; } // aapt tool for the resources works with a directory option pointing to the parent directory // of the resources (res). // The Qt.android_support module adds res/values/libs.xml (from Qt install dir). So the res from // Qt install res directory is added to aapt. This results in adding res/layout/splash.xml to // the package eventhough the file is not needed. // On the other hand aapt2 requires giving all the resources files. // Also when enabling aapt2 the resources.arsc is always created, eventhough no resources are // declared. enableAapt2 = false; generateAab = false; QTest::newRow("qml app") << "qml-app" << QStringList("qmlapp") << (QList() << qmlAppExpectedFiles(generateAab, enableAapt2)) << (QStringList() << qmlAppCustomProperties << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = true; QTest::newRow("qml app aapt2") << "qml-app" << QStringList("qmlapp") << (QList() << qmlAppExpectedFiles(generateAab, enableAapt2)) << (QStringList() << qmlAppCustomProperties << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild << enableD8; generateAab = true; QTest::newRow("qml app aab") << "qml-app" << QStringList("qmlapp") << (QList() << qmlAppExpectedFiles(generateAab, enableAapt2)) << (QStringList() << qmlAppCustomProperties << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = false; generateAab = false; QTest::newRow("qml app with custom metadata") << "qml-app" << QStringList("qmlapp") << (QList() << (QByteArrayList() << qmlAppCustomMetaDataExpectedFiles(generateAab, enableAapt2))) << QStringList{"modules.Android.sdk.automaticSources:true", aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = true; QTest::newRow("qml app with custom metadata aapt2") << "qml-app" << QStringList("qmlapp") << (QList() << (QByteArrayList() << qmlAppCustomMetaDataExpectedFiles(generateAab, enableAapt2))) << QStringList{"modules.Android.sdk.automaticSources:true", aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; generateAab = true; if (!singleArchQt) { QTest::newRow("qml app with custom metadata aab") << "qml-app" << QStringList("qmlapp") << (QList() << (QByteArrayList() << qmlAppCustomMetaDataExpectedFiles(generateAab, enableAapt2))) << QStringList{"modules.Android.sdk.automaticSources:true", aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; } isIncrementalBuild = false; enableAapt2 = false; generateAab = false; auto noNativeExpectedFiles = [&](bool generateAab) { QByteArrayList expectedFile; expectedFile << commonFiles(generateAab) + expandArchs(archs, { "res/drawable-hdpi-v4/ic_action_play_disabled.png", "res/drawable-hdpi-v4/ic_action_play.png", "res/drawable-hdpi-v4/ic_launcher.png", "res/drawable-hdpi-v4/tile.9.png", "res/drawable-mdpi-v4/ic_action_play_disabled.png", "res/drawable-mdpi-v4/ic_action_play.png", "res/drawable-mdpi-v4/ic_launcher.png", "res/drawable/selector_play.xml", "res/drawable-xhdpi-v4/ic_action_play_disabled.png", "res/drawable-xhdpi-v4/ic_action_play.png", "res/drawable-xhdpi-v4/ic_launcher.png", "res/drawable-xxhdpi-v4/ic_launcher.png", "res/layout/sample_main.xml", "res/menu/action_menu.xml", "res/raw/vid_bigbuckbunny.mp4"}, generateAab); if (generateAab) expectedFile << "base/resources.pb"; else expectedFile << "resources.arsc"; return expectedFile; }; QTest::newRow("no native") << "no-native" << QStringList("com.example.android.basicmediadecoder") << (QList() << noNativeExpectedFiles(generateAab)) << QStringList{aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = true; QTest::newRow("no native aapt2") << "no-native" << QStringList("com.example.android.basicmediadecoder") << (QList() << noNativeExpectedFiles(generateAab)) << QStringList{aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; generateAab = true; QTest::newRow("no native aab") << "no-native" << QStringList("com.example.android.basicmediadecoder") << (QList() << noNativeExpectedFiles(generateAab)) << QStringList{aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = false; generateAab = false; QTest::newRow("aidl") << "aidl" << QStringList("io.qbs.aidltest") << (QList() << (QByteArrayList() << commonFiles(generateAab))) << QStringList{aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = true; QTest::newRow("aidl aapt2") << "aidl" << QStringList("io.qbs.aidltest") << (QList() << (QByteArrayList() << commonFiles(generateAab) << "resources.arsc")) << QStringList{aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; generateAab = true; QTest::newRow("aidl aab") << "aidl" << QStringList("io.qbs.aidltest") << (QList() << (QByteArrayList() << commonFiles(generateAab) << "base/resources.pb")) << QStringList{aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = false; generateAab = false; enableD8 = false; QTest::newRow("multiple libs") << "multiple-libs-per-apk" << QStringList("twolibs") << (QList() << commonFiles(generateAab) + expandArchs(archs, { "resources.arsc", "lib/${ARCH}/liblib1.so", "lib/${ARCH}/liblib2.so", cxxLibPath("libstlport_shared.so", false)}, generateAab)) << QStringList{aaptVersion(enableAapt2), packageType(generateAab), dexCompilerVersion(enableD8)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableD8 = true; QTest::newRow("multiple libs with d8") << "multiple-libs-per-apk" << QStringList("twolibs") << (QList() << commonFiles(generateAab) + expandArchs(archs, { "resources.arsc", "lib/${ARCH}/liblib1.so", "lib/${ARCH}/liblib2.so", cxxLibPath("libstlport_shared.so", false)}, generateAab)) << QStringList{aaptVersion(enableAapt2), packageType(generateAab), dexCompilerVersion(enableD8)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableD8 = false; enableAapt2 = true; QTest::newRow("multiple libs aapt2") << "multiple-libs-per-apk" << QStringList("twolibs") << (QList() << commonFiles(generateAab) + expandArchs(archs, { "resources.arsc", "lib/${ARCH}/liblib1.so", "lib/${ARCH}/liblib2.so", cxxLibPath("libstlport_shared.so", false)}, generateAab)) << QStringList{aaptVersion(enableAapt2), packageType(generateAab), dexCompilerVersion(enableD8)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; generateAab = true; QTest::newRow("multiple libs aab") << "multiple-libs-per-apk" << QStringList("twolibs") << (QList() << commonFiles(generateAab) + expandArchs(archs, { "resources.pb", "native.pb", "lib/${ARCH}/liblib1.so", "lib/${ARCH}/liblib2.so", cxxLibPath("libstlport_shared.so", false)}, generateAab)) << QStringList{aaptVersion(enableAapt2), packageType(generateAab), dexCompilerVersion(enableD8)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = false; generateAab = false; auto expectedFiles1 = [&](bool generateAab) { QByteArrayList expectedFile = qbs::toList(qbs::toSet(commonFiles(generateAab) + expandArchs(QByteArrayList{"armeabi-v7a", "x86"}, { "lib/${ARCH}/libp1lib1.so", cxxLibPath("libstlport_shared.so", false)}, generateAab) + expandArchs(QByteArrayList{archs}, { "lib/${ARCH}/libp1lib2.so", cxxLibPath("libstlport_shared.so", false)}, generateAab))); if (generateAab) expectedFile << "base/resources.pb" << "base/native.pb"; else expectedFile << "resources.arsc"; return expectedFile; }; auto expectedFiles2 = [&](bool generateAab) { QByteArrayList expectedFile = commonFiles(generateAab) + expandArchs(archs, { "lib/${ARCH}/libp2lib1.so", "lib/${ARCH}/libp2lib2.so", cxxLibPath("libstlport_shared.so", false)}, generateAab); return expectedFile; }; QTest::newRow("multiple apks") << "multiple-apks-per-project" << (QStringList() << "twolibs1" << "twolibs2") << QList{expectedFiles1(generateAab), expectedFiles2(generateAab)} << QStringList{aaptVersion(enableAapt2), packageType(generateAab), dexCompilerVersion(enableD8)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; enableAapt2 = true; QTest::newRow("multiple apks aapt2") << "multiple-apks-per-project" << (QStringList() << "twolibs1" << "twolibs2") << (QList() << expectedFiles1(generateAab) << (QByteArrayList() << expectedFiles2(generateAab) << "resources.arsc")) << QStringList{aaptVersion(enableAapt2), packageType(generateAab), dexCompilerVersion(enableD8)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; generateAab = true; QTest::newRow("multiple apks aab") << "multiple-apks-per-project" << (QStringList() << "twolibs1" << "twolibs2") << (QList() << expectedFiles1(generateAab) << (QByteArrayList() << expectedFiles2(generateAab) << "base/resources.pb" << "base/native.pb")) << QStringList{aaptVersion(enableAapt2), packageType(generateAab), dexCompilerVersion(enableD8)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; } QTEST_MAIN(TestBlackboxAndroid) qbs-src-3.2.0/tests/auto/blackbox/tst_blackbox.h0000644000175100017510000003037015154533055021234 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** 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 TST_BLACKBOX_H #define TST_BLACKBOX_H #include "tst_blackboxbase.h" class TestBlackbox : public TestBlackboxBase { Q_OBJECT public: TestBlackbox(); private slots: void allowedValues(); void allowedValues_data(); void addFileTagToGeneratedArtifact(); void alwaysRun(); void alwaysRun_data(); void archiverFlags(); void artifactsMapChangeTracking(); void artifactsMapInvalidation(); void artifactsMapRaceCondition(); void artifactScanning(); void assembly(); void autotestWithDependencies(); void autotestTimeout(); void autotestTimeout_data(); void autotests_data(); void autotests(); void auxiliaryInputsFromDependencies(); void badInterpreter(); void bomSources(); void buildDataOfDisabledProduct(); void buildDirectories(); void buildDirPlaceholders_data(); void buildDirPlaceholders(); void buildEnvChange(); void buildGraphVersions(); void buildVariantDefaults_data(); void buildVariantDefaults(); void capnproto(); void capnproto_data(); void changedFiles_data(); void changedFiles(); void changedInputsFromDependencies(); void changedRuleInputs(); void changeInDisabledProduct(); void changeInImportedFile(); void changeTrackingAndMultiplexing(); void checkProjectFilePath(); void checkTimestamps(); void chooseModuleInstanceByPriorityAndVersion(); void chooseModuleInstanceByPriorityAndVersion_data(); void clean(); void cli(); void combinedSources(); void commandFile(); void compilerDefinesByLanguage(); void cppLibrary(); void conditionalExport(); void conditionalFileTagger(); void configure(); void conflictingArtifacts(); void cxxLanguageVersion(); void cxxLanguageVersion_data(); void conanfileProbe_data(); void conanfileProbe(); void conflictingPropertyValues_data(); void conflictingPropertyValues(); void cpuFeatures(); void cxxModules_data(); void cxxModules(); void cxxModulesChangesTracking(); void dateProperty(); void dependenciesProperty(); void dependencyScanningLoop(); void deprecatedProperty(); void deprecatedProperty_data(); void disappearedProfile(); void discardUnusedData(); void discardUnusedData_data(); void dotDotPcFile(); void driverLinkerFlags(); void driverLinkerFlags_data(); void dynamicLibraryInModule(); void dynamicMultiplexRule(); void dynamicProject(); void dynamicRuleOutputs(); void emptyProfile(); void emscriptenArtifacts(); void emscriptenArtifacts_data(); void enableExceptions(); void enableExceptions_data(); void enableRtti(); void envMerging(); void envNormalization(); void erroneousFiles_data(); void erroneousFiles(); void errorInfo(); void escapedLinkerFlags(); void explicitlyDependsOn(); void explicitlyDependsOn_data(); void exportedDependencyInDisabledProduct(); void exportedDependencyInDisabledProduct_data(); void exportedPropertyInDisabledProduct(); void exportedPropertyInDisabledProduct_data(); void exportRule(); void exportToOutsideSearchPath(); void exportsCMake(); void exportsCMake_data(); void exportsPkgconfig(); void exportsQbs(); void externalLibs(); void fileDependencies(); void fileTagsFilterMerging(); void flatbuf(); void flatbuf_data(); void freedesktop(); void generatedArtifactAsInputToDynamicRule(); void generateLinkerMapFile(); void generator(); void generator_data(); void groupsInModules(); void grpc_data(); void grpc(); void hostOsProperties(); void ico(); void importAssignment(); void importChangeTracking(); void importInPropertiesCondition(); void importSearchPath(); void importingProduct(); void importsConflict(); void includeLookup(); void inputTagsChangeTracking_data(); void inputTagsChangeTracking(); void inputsFromDependencies(); void installable(); void installableAsAuxiliaryInput(); void installedApp(); void installDuplicates(); void installDuplicatesNoError(); void installedSourceFiles(); void installedTransformerOutput(); void installLocations_data(); void installLocations(); void installPackage(); void installRootFromProjectFile(); void installTree(); void libraryType_data(); void libraryType(); void pluginType_data(); void pluginType(); void invalidArtifactPath_data(); void invalidArtifactPath(); void invalidCommandProperty_data(); void invalidCommandProperty(); void invalidExtensionInstantiation(); void invalidExtensionInstantiation_data(); void invalidInstallDir(); void invalidLibraryNames(); void invalidLibraryNames_data(); void jsExtensionsFile(); void jsExtensionsFileInfo(); void jsExtensionsHost(); void jsExtensionsProcess(); void jsExtensionsPropertyList(); void jsExtensionsTemporaryDir(); void jsExtensionsTextFile(); void jsExtensionsBinaryFile(); void lastModuleCandidateBroken(); void ld(); void linkerMode(); void linkerVariant_data(); void linkerVariant(); void linkerTypeRecursive(); void lexyacc(); void lexyaccOutputs(); void lexyaccOutputs_data(); void linkerLibraryDuplicates(); void linkerLibraryDuplicates_data(); void linkerScripts(); void linkerModuleDefinition(); void listProducts(); void listPropertiesWithOuter(); void listPropertyOrder(); void loadableModule(); void localDeployment(); void makefileGenerator(); void maximumCLanguageVersion(); void maximumCxxLanguageVersion(); void minimumSystemVersion(); void minimumSystemVersion_data(); void missingBuildGraph(); void missingBuildGraph_data(); void missingDependency(); void missingProjectFile(); void missingOverridePrefix(); void moduleConditions(); void movedFileDependency(); void msvcAsmLinkerFlags(); void multipleChanges(); void multipleConfigurations(); void multiplexedTool(); void nestedGroups(); void nestedProperties(); void newOutputArtifact(); void noExportedSymbols_data(); void noExportedSymbols(); void noProfile(); void noSuchProfile(); void nodejs(); void nonBrokenFilesInBrokenProduct(); void nonDefaultProduct(); void notAlwaysUpdated(); void nsis(); void nsisDependencies(); void outOfDateMarking(); void outputArtifactAutoTagging(); void outputRedirection(); void overrideProjectProperties(); void partiallyBuiltDependency_data(); void partiallyBuiltDependency(); void pathProbe_data(); void pathProbe(); void pathListInProbe(); void pchChangeTracking(); void perGroupDefineInExportItem(); void pkgConfigProbe(); void pkgConfigProbe_data(); void pkgConfigProbeSysroot(); void pluginDependency(); void precompiledAndPrefixHeaders(); void precompiledHeaderAndRedefine(); void preventFloatingPointValues(); void probeChangeTracking(); void probeProperties(); void probesAndShadowProducts(); void probeInExportedModule(); void probesAndArrayProperties(); void probesInNestedModules(); void productDependenciesByType(); void productInExportedModule(); void productProperties(); void propertyAssignmentInFailedModule(); void propertyChanges(); void propertyEvaluationContext(); void propertyPrecedence(); void properQuoting(); void propertiesInExportItems(); void protobuf_data(); void protobuf(); void protobufLibraryInstall(); void pseudoMultiplexing(); void qbsConfig(); void qbsConfigAddProfile(); void qbsConfigAddProfile_data(); void qbsConfigImport(); void qbsConfigImport_data(); void qbsConfigExport(); void qbsConfigExport_data(); void qbsLanguageServer_data(); void qbsLanguageServer(); void qbsSession(); void qbsVersion(); void qtBug51237(); void radAfterIncompleteBuild(); void radAfterIncompleteBuild_data(); void recursiveRenaming(); void recursiveWildcards(); void referenceErrorInExport(); void removeDuplicateLibraries_data(); void removeDuplicateLibraries(); void reproducibleBuild(); void reproducibleBuild_data(); void require(); void rescueTransformerData(); void responseFiles(); void retaggedOutputArtifact(); void rpathlinkDeduplication(); void ruleConditions_data(); void ruleConditions(); void ruleConnectionWithExcludedInputs(); void ruleCycle(); void ruleWithNoInputs(); void ruleWithNonRequiredInputs(); void runMultiplexed(); void sanitizer_data(); void sanitizer(); void scannerItem_data(); void scannerItem(); void scanResultInOtherProduct(); void scanResultInNonDependency(); void setupBuildEnvironment(); void setupRunEnvironment(); void staticLibDeps(); void staticLibDeps_data(); void objectLibDeps(); void objectLibDeps_data(); void rpathLink(); void smartRelinking(); void smartRelinking_data(); void soVersion(); void soVersion_data(); void sourceArtifactChanges(); void subProfileChangeTracking(); void successiveChanges(); void symbolLinkMode(); void symlinkRemoval(); void renameDependency(); void separateDebugInfo(); void sevenZip(); void sourceArtifactInInputsFromDependencies(); void staticLibWithoutSources(); void suspiciousCalls(); void suspiciousCalls_data(); void systemIncludePaths(); void distributionIncludePaths(); void systemRunPaths(); void systemRunPaths_data(); void tar(); void textTemplate(); void toolLookup(); void topLevelSearchPath(); void trackAddFile(); void trackAddFileTag(); void trackAddProduct(); void trackExternalProductChanges(); void trackGroupConditionChange(); void trackRemoveFile(); void trackRemoveFileTag(); void trackRemoveProduct(); void transitiveInvalidDependencies(); void transitiveOptionalDependencies(); void typescript(); void undefinedTargetPlatform(); void usingsAsSoleInputsNonMultiplexed(); void variantSuffix(); void variantSuffix_data(); void vcsGit(); void vcsSubversion(); void vcsMercurial(); void versionCheck(); void versionCheck_data(); void versionScript(); void wholeArchive(); void wholeArchive_data(); void wildCardsAndRules(); void wildCardsAndChangeTracking_data(); void wildCardsAndChangeTracking(); void wildcardRenaming(); void zip(); void zip_data(); void zipInvalid(); private: QMap findCli(int *status); QMap findNodejs(int *status); QMap findTypeScript(int *status); QString findArchiver(const QString &fileName, int *status = nullptr); bool prepareAndRunConan(); static bool lexYaccExist(); static qbs::Version bisonVersion(); QMap getRepoStateFromApp() const; }; #endif // TST_BLACKBOX_H qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxbase.cpp0000644000175100017510000002574515154533055022434 0ustar runnerrunner/**************************************************************************** ** ** 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 "tst_blackboxbase.h" #include "../shared.h" #include #include #include #include #include #include #include using qbs::Internal::HostOsInfo; using qbs::Internal::removeDirectoryWithContents; using qbs::InstallOptions; using qbs::Profile; static QString initQbsExecutableFilePath() { const QString qbsInstallDir = QString::fromLocal8Bit(qgetenv("QBS_INSTALL_DIR")); return HostOsInfo::appendExecutableSuffix(QDir::cleanPath(!qbsInstallDir.isEmpty() ? qbsInstallDir + QLatin1String("/bin/qbs") : QCoreApplication::applicationDirPath() + QLatin1String("/qbs"))); } static bool supportsBuildDirectoryOption(const QString &command) { return !(QStringList() << "help" << "config" << "config-ui" << "setup-android" << "setup-qt" << "setup-toolchains" << "create-project") .contains(command); } static bool supportsSettingsDirOption(const QString &command) { return !(QStringList() << "help" << "create-project").contains(command); } TestBlackboxBase::TestBlackboxBase(const QString &testDataSrcDir, const QString &testName) : testDataDir(testWorkDir(testName)), testSourceDir(testDataSourceDir(testDataSrcDir)), qbsExecutableFilePath(initQbsExecutableFilePath()), defaultInstallRoot(relativeBuildDir() + QLatin1Char('/') + InstallOptions::defaultInstallRoot()) { QLocale::setDefault(QLocale::c()); } int TestBlackboxBase::runQbs(const QbsRunParameters ¶ms) { QStringList args; if (!params.command.isEmpty()) args << params.command; if (!params.settingsDir.isEmpty() && supportsSettingsDirOption(params.command)) args << "--settings-dir" << params.settingsDir; if (supportsBuildDirectoryOption(params.command)) { args.push_back(QStringLiteral("-d")); args.push_back(params.buildDirectory.isEmpty() ? QStringLiteral(".") : params.buildDirectory); } args << params.arguments; const bool commandImpliesResolve = params.command.isEmpty() || params.command == "resolve" || params.command == "build" || params.command == "install" || params.command == "run" || params.command == "generate"; if (!params.profile.isEmpty() && commandImpliesResolve) { args.push_back(QLatin1String("profile:") + params.profile); } QProcess process; if (!params.workingDir.isEmpty()) process.setWorkingDirectory(params.workingDir); process.setProcessEnvironment(params.environment); process.start(qbsExecutableFilePath, args); int exitCode = 0; if (!process.waitForStarted() || !process.waitForFinished(testTimeoutInMsecs()) || process.exitStatus() != QProcess::NormalExit) { if (!params.expectCrash) { QTest::qFail("qbs did not run correctly", __FILE__, __LINE__); qDebug("%s", qPrintable(process.errorString())); } exitCode = -1; } else if (m_qbsStdout.contains("Memory leak:")) { exitCode = 27; } else { exitCode = process.exitCode(); } m_qbsStderr = process.readAllStandardError(); m_qbsStdout = process.readAllStandardOutput(); sanitizeOutput(&m_qbsStderr); sanitizeOutput(&m_qbsStdout); const bool shouldLog = (process.exitStatus() != QProcess::NormalExit || exitCode != 0) && !params.expectFailure; if (!m_qbsStderr.isEmpty() && (shouldLog || qEnvironmentVariableIsSet("QBS_AUTOTEST_ALWAYS_LOG_STDERR"))) qDebug("%s", m_qbsStderr.constData()); if (!m_qbsStdout.isEmpty() && (shouldLog || qEnvironmentVariableIsSet("QBS_AUTOTEST_ALWAYS_LOG_STDOUT"))) qDebug("%s", m_qbsStdout.constData()); return exitCode; } /*! Recursive copy from directory to another. Note that this updates the file stamps on Linux but not on Windows. */ void TestBlackboxBase::ccp(const QString &sourceDirPath, const QString &targetDirPath) { QDir currentDir; QDirIterator dit(sourceDirPath, QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden); while (dit.hasNext()) { dit.next(); const QString targetPath = targetDirPath + QLatin1Char('/') + dit.fileName(); currentDir.mkpath(targetPath); ccp(dit.filePath(), targetPath); } QDirIterator fit(sourceDirPath, QDir::Files | QDir::Hidden); while (fit.hasNext()) { fit.next(); const QString targetPath = targetDirPath + QLatin1Char('/') + fit.fileName(); QFile::remove(targetPath); // allowed to fail QFile src(fit.filePath()); QVERIFY2(src.copy(targetPath), qPrintable(src.errorString())); } } void TestBlackboxBase::rmDirR(const QString &dir) { QString errorMessage; removeDirectoryWithContents(dir, &errorMessage); } QByteArray TestBlackboxBase::unifiedLineEndings(const QByteArray &ba) { if (HostOsInfo::isWindowsHost()) { QByteArray result; result.reserve(ba.size()); for (const char &c : ba) { if (c != '\r') result.append(c); } return result; } else { return ba; } } void TestBlackboxBase::sanitizeOutput(QByteArray *ba) { if (HostOsInfo::isWindowsHost()) ba->replace('\r', ""); } void TestBlackboxBase::initTestCase() { QVERIFY(regularFileExists(qbsExecutableFilePath)); const SettingsPtr s = settings(); if (profileName() != "none" && !s->profiles().contains(profileName())) QFAIL(QByteArray("The build profile '" + profileName().toLocal8Bit() + "' could not be found. Please set it up on your machine.")); validateTestProfile(); // Initialize the test data directory. QVERIFY(testDataDir != testSourceDir); rmDirR(testDataDir); QDir().mkpath(testDataDir); ccp(testSourceDir, testDataDir); QDir().mkpath(testDataDir + "/find"); ccp(testSourceDir + "/../find", testDataDir + "/find"); QVERIFY(copyDllExportHeader(testSourceDir, testDataDir)); } void TestBlackboxBase::validateTestProfile() { const SettingsPtr s = settings(); if (profileName() != "none" && !s->profiles().contains(profileName())) QFAIL(QByteArray("The build profile '" + profileName().toLocal8Bit() + "' could not be found. Please set it up on your machine.")); if (!m_needsQt) return; const QStringList qmakeFilePaths = Profile(profileName(), s.get()) .value("moduleProviders.Qt.qmakeFilePaths").toStringList(); if (!qmakeFilePaths.empty()) return; if (!findExecutable(QStringList{"qmake"}).isEmpty()) return; QSKIP(QByteArray("The build profile '" + profileName().toLocal8Bit() + "' is not a valid Qt profile and Qt was not found " "in the global search paths.")); } QString TestBlackboxBase::findExecutable(const QStringList &fileNames) { const QStringList path = QString::fromLocal8Bit(qgetenv("PATH")) .split(HostOsInfo::pathListSeparator(), Qt::SkipEmptyParts); for (const QString &fileName : fileNames) { QFileInfo fi(fileName); if (fi.isAbsolute()) return fi.exists() ? fileName : QString(); for (const QString &ppath : path) { const QString fullPath = HostOsInfo::appendExecutableSuffix(ppath + QLatin1Char('/') + fileName); if (QFileInfo(fullPath).exists()) return QDir::cleanPath(fullPath); } } return {}; } QMap TestBlackboxBase::findJdkTools(int *status) { QTemporaryDir temp; QDir::setCurrent(testDataDir + "/find"); QbsRunParameters params = QStringList() << "-f" << "find-jdk.qbs"; params.buildDirectory = temp.path(); const int res = runQbs(params); if (status) *status = res; QFile file(temp.path() + "/" + relativeProductBuildDir("find-jdk") + "/jdk.json"); if (!file.open(QIODevice::ReadOnly)) return {}; const auto tools = QJsonDocument::fromJson(file.readAll()).toVariant().toMap(); return { {"java", QDir::fromNativeSeparators(tools["java"].toString())}, {"javac", QDir::fromNativeSeparators(tools["javac"].toString())}, {"jar", QDir::fromNativeSeparators(tools["jar"].toString())} }; } qbs::Version TestBlackboxBase::qmakeVersion(const QString &qmakeFilePath) { QStringList arguments; arguments << "-query" << "QT_VERSION"; QProcess qmakeProcess; qmakeProcess.start(qmakeFilePath, arguments); if (!qmakeProcess.waitForStarted() || !qmakeProcess.waitForFinished() || qmakeProcess.exitStatus() != QProcess::NormalExit) { qDebug() << "qmake '" << qmakeFilePath << "' could not be run."; return qbs::Version(); } QByteArray result = qmakeProcess.readAll().simplified(); qbs::Version version = qbs::Version::fromString(result); if (!version.isValid()) qDebug() << "qmake '" << qmakeFilePath << "' version is not valid."; return version; } qbs::Version TestBlackboxBase::conanVersion(const QString &conanFilePath) { QProcess conan; conan.start(conanFilePath, {"--version"}); if (!waitForProcessSuccess(conan)) return qbs::Version{}; return qbs::Version::fromString(QString::fromLocal8Bit(conan.readAllStandardOutput()) .trimmed() .remove(QStringLiteral("Conan version")) .trimmed()); } bool waitForProcessSuccess(QProcess &p, int msecs) { if (!p.waitForStarted(msecs) || !p.waitForFinished(msecs)) { qDebug() << p.errorString(); return false; } if (p.exitCode() != 0) { qDebug().noquote() << p.readAllStandardError(); return false; } return true; } qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxtutorial.h0000644000175100017510000000344415154533055023022 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef TST_BLACKBOXTUTORIAL_H #define TST_BLACKBOXTUTORIAL_H #include "tst_blackboxbase.h" class TestBlackboxTutorial : public TestBlackboxBase { Q_OBJECT public: TestBlackboxTutorial(); private slots: void tutorial_data(); void tutorial(); }; #endif // TST_BLACKBOXTUTORIAL_H qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxqt.cpp0000644000175100017510000013200715154533055022134 0ustar runnerrunner/**************************************************************************** ** ** 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 "tst_blackboxqt.h" #include "../shared.h" #include #include #include #include #include #include #define WAIT_FOR_NEW_TIMESTAMP() waitForNewTimestamp(testDataDir) using qbs::Internal::HostOsInfo; TestBlackboxQt::TestBlackboxQt() : TestBlackboxBase (SRCDIR "/testdata-qt", "blackbox-qt") { setNeedsQt(); } std::optional TestBlackboxQt::findShaderTools(bool *hasViewCount) { QDir::setCurrent(testDataDir); rmDirR(relativeBuildDir()); QbsRunParameters checkParams; checkParams.command = "resolve"; checkParams.arguments << QStringLiteral("-f") << "find-shadertools.qbs"; if (runQbs(checkParams) != 0) { qWarning() << "fail to resolve find-shadertools.qbs" << m_qbsStderr; return std::nullopt; } if (!m_qbsStdout.contains("is qt6: ")) { qWarning() << "stdout does not contain 'is qt6:'" << m_qbsStdout; return std::nullopt; } if (!m_qbsStdout.contains("is static qt: ")) { qWarning() << "stdout does not contain 'is static qt:'" << m_qbsStdout; return std::nullopt; } if (!m_qbsStdout.contains("is shadertools present: ")) { qWarning() << "stdout does not contain 'is shadertools present:'" << m_qbsStdout; return std::nullopt; } if (!m_qbsStdout.contains("has viewCount: ")) { qWarning() << "stdout does not contain 'has viewCount:'" << m_qbsStdout; return std::nullopt; } const bool isQt6 = m_qbsStdout.contains("is qt6: true"); const bool isStaticQt = m_qbsStdout.contains("is static qt: true"); const bool isShadertoolsPresent = m_qbsStdout.contains("is shadertools present: true"); if (hasViewCount) { *hasViewCount = m_qbsStdout.contains("has viewCount: true"); } return isQt6 && !isStaticQt && isShadertoolsPresent; } void TestBlackboxQt::addQObjectMacroToGeneratedCppFile() { QDir::setCurrent(testDataDir + "/add-qobject-macro-to-generated-cpp-file"); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("moc"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("object.cpp.in", "// ", ""); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("moc"), m_qbsStdout.constData()); } void TestBlackboxQt::autoQrc() { QDir::setCurrent(testDataDir + "/auto-qrc"); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QbsRunParameters("run", QStringList{"-p", "app"})), 0); QVERIFY2(m_qbsStdout.simplified().contains("resource data: resource1 resource2"), m_qbsStdout.constData()); } void TestBlackboxQt::cachedQml() { QDir::setCurrent(testDataDir + "/cached-qml"); if ((runQbs() != 0) && m_qbsStderr.contains("Dependency 'Qt.qml' not found for product 'app'")) QSKIP("Qt version too old"); QString dataDir = relativeBuildDir() + "/install-root/data"; QVERIFY2(m_qbsStdout.contains("qmlcachegen must work: true") || m_qbsStdout.contains("qmlcachegen must work: false"), m_qbsStdout.constData()); if (m_qbsStdout.contains("qmlcachegen must work: false") && QFile::exists(dataDir + "/main.cpp")) { // If C++ source files were installed then Qt.qmlcache is not available. See project file. QSKIP("No QML cache files generated."); } QVERIFY(QFile::exists(dataDir + "/main.qmlc")); QVERIFY(QFile::exists(dataDir + "/MainForm.ui.qmlc")); QVERIFY(QFile::exists(dataDir + "/stuff.jsc")); } void TestBlackboxQt::combinedMoc() { QDir::setCurrent(testDataDir + "/combined-moc"); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("compiling moc_theobject.cpp")); QVERIFY(!m_qbsStdout.contains("creating amalgamated_moc_theapp.cpp")); QVERIFY(!m_qbsStdout.contains("compiling amalgamated_moc_theapp.cpp")); QbsRunParameters params(QStringList("modules.Qt.core.combineMocOutput:true")); params.command = "resolve"; QCOMPARE(runQbs(params), 0); params.command = "build"; QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling moc_theobject.cpp")); QVERIFY(m_qbsStdout.contains("creating amalgamated_moc_theapp.cpp")); QVERIFY(m_qbsStdout.contains("compiling amalgamated_moc_theapp.cpp")); } void TestBlackboxQt::createProject() { QDir::setCurrent(testDataDir + "/create-project"); QVERIFY(QFile::copy(testSourceDir + "/../../../../examples/helloworld-qt/main.cpp", QDir::currentPath() + "/main.cpp")); QbsRunParameters createParams("create-project"); createParams.profile.clear(); QCOMPARE(runQbs(createParams), 0); createParams.expectFailure = true; QVERIFY(runQbs(createParams) != 0); QVERIFY2(m_qbsStderr.contains("already contains qbs files"), m_qbsStderr.constData()); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling"), m_qbsStdout.constData()); } void TestBlackboxQt::dbusAdaptors() { QDir::setCurrent(testDataDir + "/dbus-adaptors"); QCOMPARE(runQbs(), 0); } void TestBlackboxQt::dbusInterfaces() { QDir::setCurrent(testDataDir + "/dbus-interfaces"); QCOMPARE(runQbs(), 0); } void TestBlackboxQt::emscriptenHtml() { QDir::setCurrent(testDataDir + "/emscripten-html"); QCOMPARE(runQbs(), 0); if (m_qbsStdout.contains("is emscripten: false")) QSKIP("Skipping emscripten test"); QVERIFY(m_qbsStdout.contains("is emscripten: true")); const auto relativeInstallRoot = relativeBuildDir() + QStringLiteral("/install-root/"); QVERIFY(!regularFileExists(relativeInstallRoot + QStringLiteral("qtloader.js"))); QVERIFY(!regularFileExists(relativeInstallRoot + QStringLiteral("qtlogo.svg"))); QVERIFY(!regularFileExists(relativeInstallRoot + QStringLiteral("app.html"))); const QStringList params = {QStringLiteral("products.app.generateHtml:true")}; QCOMPARE(runQbs(QbsRunParameters("resolve", params)), 0); QCOMPARE(runQbs(QbsRunParameters("build", params)), 0); QVERIFY(regularFileExists(relativeInstallRoot + QStringLiteral("qtloader.js"))); QVERIFY(regularFileExists(relativeInstallRoot + QStringLiteral("qtlogo.svg"))); QVERIFY(regularFileExists(relativeInstallRoot + QStringLiteral("app.html"))); } void TestBlackboxQt::forcedMoc() { QDir::setCurrent(testDataDir + "/forced-moc"); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); if (m_qbsStdout.contains("using qt4")) QSKIP("Qt version too old"); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(m_qbsStderr.contains("Hello from slot"), m_qbsStderr.constData()); } void TestBlackboxQt::includedMocCpp() { QDir::setCurrent(testDataDir + "/included-moc-cpp"); QCOMPARE(runQbs(), 0); if (m_qbsStdout.contains("using qt4")) QSKIP("Qt version too old"); QVERIFY2(!m_qbsStdout.contains("compiling moc_myobject.cpp"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("myobject.cpp", "#include ("generate"); QTest::addColumn("installDir"); QTest::newRow("don't generate") << false << QString(); QTest::newRow("don't generate with install info") << false << QString("blubb"); QTest::newRow("generate only") << true << QString(); QTest::newRow("generate and install") << true << QString("blubb"); } void TestBlackboxQt::metaTypes() { QDir::setCurrent(testDataDir + "/metatypes"); QFETCH(bool, generate); QFETCH(QString, installDir); const QStringList args{"modules.Qt.core.generateMetaTypesFile:" + QString(generate ? "true" : "false"), "modules.Qt.core.metaTypesInstallDir:" + installDir, "-v", "--force-probe-execution"}; QCOMPARE(runQbs(QbsRunParameters("resolve", args)), 0); const bool canGenerate = m_qbsStdout.contains("can generate"); const bool cannotGenerate = m_qbsStdout.contains("cannot generate"); QVERIFY(canGenerate != cannotGenerate); const bool expectFiles = generate && canGenerate; const bool expectInstalledFiles = expectFiles && !installDir.isEmpty(); QCOMPARE(runQbs(QStringList("--clean-install-root")), 0); const QString productDir = relativeProductBuildDir("mylib"); const QString outputDir = productDir + "/qt.headers"; QVERIFY(!regularFileExists(outputDir + "/moc_unmocableclass.cpp.json")); QCOMPARE(regularFileExists(outputDir + "/moc_mocableclass1.cpp.json"), expectFiles); QCOMPARE(regularFileExists(outputDir + "/mocableclass2.moc.json"), expectFiles); QCOMPARE(regularFileExists(productDir + "/mylib_metatypes.json"), expectFiles); QCOMPARE(regularFileExists(relativeBuildDir() + "/install-root/some-prefix/" + installDir + "/mylib_metatypes.json"), expectInstalledFiles); } void TestBlackboxQt::mixedBuildVariants() { QDir::setCurrent(testDataDir + "/mixed-build-variants"); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); const bool isMsvc = m_qbsStdout.contains("is msvc: true"); const bool isNotMsvc = m_qbsStdout.contains("is msvc: false"); if (isMsvc) { QVERIFY2(m_qbsStderr.contains("not allowed"), m_qbsStderr.constData()); } else { QVERIFY(isNotMsvc); QVERIFY2(m_qbsStderr.contains("not supported"), m_qbsStderr.constData()); } } void TestBlackboxQt::mocAndCppCombining() { QDir::setCurrent(testDataDir + "/moc-and-cxx-combining"); QCOMPARE(runQbs(), 0); } void TestBlackboxQt::mocChangeTracking() { QDir::setCurrent(testDataDir + "/moc-change-tracking"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("compiling moc_class.cpp"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("moc-change-tracking.qbs", "// ", ""); QCOMPARE(runQbs(), 0); QVERIFY2( m_qbsStdout.contains("compiling amalgamated_moc-change-tracking.cpp"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("moc-change-tracking.qbs"); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("linking"), m_qbsStdout.constData()); } void TestBlackboxQt::mocFlags() { QDir::setCurrent(testDataDir + "/moc-flags"); QCOMPARE(runQbs(), 0); WAIT_FOR_NEW_TIMESTAMP(); QbsRunParameters params; params.expectFailure = true; params.arguments << "Qt.core.mocFlags:-E"; QVERIFY(runQbs(params) != 0); } void TestBlackboxQt::mocCompilerDefines() { QDir::setCurrent(testDataDir + "/moc-compiler-defines"); QCOMPARE(runQbs(), 0); } void TestBlackboxQt::mocSameFileName() { QDir::setCurrent(testDataDir + "/moc-same-file-name"); QCOMPARE(runQbs(), 0); QCOMPARE(m_qbsStdout.count("compiling moc_someclass.cpp"), 2); } void TestBlackboxQt::noMocRunAfterTouchingOtherCppFile() { QDir::setCurrent(testDataDir + "/no-moc-run-after-touching-other-cpp-file"); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("moc header1.h")); QVERIFY(m_qbsStdout.contains("moc header2.h")); QVERIFY(m_qbsStdout.contains("compiling moc_header1.cpp")); QVERIFY(m_qbsStdout.contains("compiling moc_header2.cpp")); QVERIFY(m_qbsStdout.contains("compiling main.cpp")); QVERIFY(m_qbsStdout.contains("linking")); WAIT_FOR_NEW_TIMESTAMP(); touch("main.cpp"); QCOMPARE(runQbs(), 0); QVERIFY(!m_qbsStdout.contains("moc header1.h")); QVERIFY(!m_qbsStdout.contains("moc header2.h")); QVERIFY(!m_qbsStdout.contains("compiling moc_header1.cpp")); QVERIFY(!m_qbsStdout.contains("compiling moc_header2.cpp")); QVERIFY(m_qbsStdout.contains("compiling main.cpp")); QVERIFY(m_qbsStdout.contains("linking")); } void TestBlackboxQt::noRelinkOnQDebug() { QFETCH(QString, checkMode); QFETCH(bool, expectRelink); QVERIFY(QDir::setCurrent(testDataDir + "/no-relink-on-qdebug")); rmDirR("default"); // Target check. QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); if (m_qbsStdout.contains("is emscripten: true")) QSKIP("Irrelevant for emscripten"); QVERIFY(m_qbsStdout.contains("is emscripten: false")); QVERIFY2(m_qbsStdout.contains("is GCC: "), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("is MinGW: "), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("is Darwin: "), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("is static qt: "), m_qbsStdout.constData()); const bool isGCCLike = m_qbsStdout.contains("is GCC: true"); const bool isMingw = m_qbsStdout.contains("is MinGW: true"); const bool isDarwin = m_qbsStdout.contains("is Darwin: true"); const bool isStaticQt = m_qbsStdout.contains("is static qt: true"); if (!isGCCLike) expectRelink = false; else if (isMingw || isDarwin || isStaticQt) expectRelink = true; // Initial build. QbsRunParameters params("resolve"); if (isGCCLike && !checkMode.isEmpty()) params.arguments << ("modules.cpp.exportedSymbolsCheckMode:" + checkMode); QCOMPARE(runQbs(params), 0); QCOMPARE(runQbs(), 0); QCOMPARE(m_qbsStdout.count("linking"), 2); // Inserting the qDebug() statement will pull in weak symbols. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("lib.cpp", "// qDebug", "qDebug"); QCOMPARE(runQbs(), 0); QCOMPARE(m_qbsStdout.count("linking"), expectRelink ? 2 : 1); // Also check the opposite case. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("lib.cpp", "qDebug", "// qDebug"); QCOMPARE(runQbs(), 0); QCOMPARE(m_qbsStdout.count("linking"), expectRelink ? 2 : 1); } void TestBlackboxQt::noRelinkOnQDebug_data() { QTest::addColumn("checkMode"); QTest::addColumn("expectRelink"); QTest::newRow("default") << QString() << false; QTest::newRow("relaxed") << QString("ignore-undefined") << false; QTest::newRow("strict") << QString("strict") << true; } void TestBlackboxQt::pkgconfig() { QDir::setCurrent(testDataDir + "/pkgconfig"); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QbsRunParameters params; params.command = "run"; QCOMPARE(runQbs(params), 0); } void TestBlackboxQt::pkgconfigQt() { QFETCH(QStringList, arguments); QFETCH(bool, success); QDir::setCurrent(testDataDir + "/pkgconfig-qt"); rmDirR(relativeBuildDir()); QbsRunParameters dumpParams("resolve", {"-f", "dump-libpath.qbs"}); QCOMPARE(runQbs(dumpParams), 0); auto lines = QString::fromUtf8(m_qbsStdout).split('\n'); const QString needle = "libPath="; qbs::Internal::removeIf( lines, [&needle](const auto &line) { return !line.startsWith(needle); }); QCOMPARE(lines.size(), 1); const auto libPath = lines[0].mid(needle.size()); auto prefix = QFileInfo(libPath).path(); if (prefix.endsWith("/lib") && !prefix.startsWith("/lib")) prefix = QFileInfo(prefix).path(); const auto pkgConfigPath = libPath + "/pkgconfig/"; if (!QFileInfo(pkgConfigPath).exists()) QSKIP("No *.pc files found"); rmDirR(relativeBuildDir()); QbsRunParameters params("build", {"-f", "pkgconfig-qt.qbs"}); // need to override prefix for the downloaded Qt params.environment.insert("PKG_CONFIG_QT5CORE_PREFIX", prefix); params.environment.insert("PKG_CONFIG_QT6CORE_PREFIX", prefix); params.arguments << "moduleProviders.qbspkgconfig.extraPaths:" + pkgConfigPath; params.arguments << arguments; QCOMPARE(runQbs(params) == 0, success); if (!success) QVERIFY(m_qbsStderr.contains("Dependency 'Qt.core' not found for product 'p'")); } void TestBlackboxQt::pkgconfigQt_data() { QTest::addColumn("arguments"); QTest::addColumn("success"); QTest::newRow("pkgconfig") << QStringList() << true; QTest::newRow("dummy") << QStringList({"products.p.qbsModuleProviders:dummyProvider"}) << false; QTest::newRow("cross-compiling") << QStringList({"moduleProviders.qbspkgconfig.sysroot:/some/fake/sysroot"}) << false; } void TestBlackboxQt::pkgconfigNoQt() { QDir::setCurrent(testDataDir + "/pkgconfig-qt"); rmDirR(relativeBuildDir()); QbsRunParameters params("build", {"-f", "pkgconfig-qt.qbs"}); params.arguments << "moduleProviders.qbspkgconfig.libDirs:nonexistent"; params.expectFailure = true; QCOMPARE(runQbs(params) == 0, false); QVERIFY2(m_qbsStderr.contains("Dependency 'Qt.core' not found for product 'p'"), m_qbsStderr); // QBS-1777: basic check for JS exceptions in case of missing Qt QVERIFY2(!m_qbsStderr.contains("Error executing provider for module 'Qt.core'"), m_qbsStderr); } void TestBlackboxQt::pluginMetaData() { QDir::setCurrent(testDataDir + "/plugin-meta-data"); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); if (m_qbsStdout.contains("using qt4")) QSKIP("Qt version too old"); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QVERIFY2(runQbs(QbsRunParameters("run", QStringList{"-p", "app"})) == 0, m_qbsStderr.constData()); QVERIFY2(m_qbsStderr.contains("all ok!"), m_qbsStderr.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("metadata.json"); waitForFileUnlock(); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("moc"), m_qbsStdout.constData()); } void TestBlackboxQt::pluginSupport_data() { QTest::addColumn("invalidPlugin"); QTest::newRow("request valid plugins") << false; QTest::newRow("request invalid plugin") << true; } void TestBlackboxQt::pluginSupport() { QDir::setCurrent(testDataDir + "/plugin-support"); QFETCH(bool, invalidPlugin); QbsRunParameters resolveParams("resolve"); if (invalidPlugin) { resolveParams.arguments << "modules.m1.useDummy:true"; resolveParams.expectFailure = true; } bool resolveResult = runQbs(resolveParams) == 0; if (m_qbsStdout.contains("using qt4")) QSKIP("Qt version too old"); QCOMPARE(resolveResult, !invalidPlugin); if (invalidPlugin) { QVERIFY2(m_qbsStderr.contains("Plugin 'dummy' of type 'imageformats' was requested, " "but is not available"), m_qbsStderr.constData()); return; } const bool isStaticQt = m_qbsStdout.contains("static Qt: true"); const bool isDynamicQt = m_qbsStdout.contains("static Qt: false"); QVERIFY(isStaticQt != isDynamicQt); if (isStaticQt) QVERIFY2(m_qbsStdout.contains("platform plugin count: 1"), m_qbsStdout.constData()); else QVERIFY2(m_qbsStdout.contains("platform plugin count: 0"), m_qbsStdout.constData()); const auto extractList = [this](const char sep) { const int listStartIndex = m_qbsStdout.indexOf(sep); const int listEndIndex = m_qbsStdout.indexOf(sep, listStartIndex + 1); const QByteArray listString = m_qbsStdout.mid(listStartIndex + 1, listEndIndex - listStartIndex - 1); return listString.isEmpty() ? QByteArrayList() : listString.split(','); }; const QByteArrayList enabledPlugins = extractList('%'); if (isStaticQt) QCOMPARE(enabledPlugins.size(), 2); else QVERIFY(enabledPlugins.empty()); const QByteArrayList allPlugins = extractList('#'); QVERIFY(allPlugins.size() >= enabledPlugins.size()); QCOMPARE(runQbs(), 0); for (const QByteArray &plugin : allPlugins) { QCOMPARE(m_qbsStdout.contains("qt_plugin_import_" + plugin + ".cpp"), enabledPlugins.contains(plugin)); } } void TestBlackboxQt::qdoc() { QDir::setCurrent(testDataDir + "/qdoc"); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); if (m_qbsStdout.contains("Qt is too old")) QSKIP("Skip test since qdoc3 does not work properly"); QCOMPARE(runQbs(), 0); QVERIFY(QFileInfo(relativeProductBuildDir("QDoc Test") + "/qdoctest.qch").exists()); } void TestBlackboxQt::qmlDebugging() { QDir::setCurrent(testDataDir + "/qml-debugging"); QCOMPARE(runQbs(), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); const bool isGcc = m_qbsStdout.contains("is gcc: true"); const bool isNotGcc = m_qbsStdout.contains("is gcc: false"); if (isNotGcc) QSKIP("The remainder of this test only applies to gcc"); QVERIFY(isGcc); QProcess nm; nm.start("nm", QStringList(relativeExecutableFilePath("debuggable-app", m_qbsStdout))); if (!nm.waitForStarted()) QSKIP("The remainder of this test requires nm"); QVERIFY2(nm.waitForFinished(), qPrintable(nm.errorString())); QVERIFY2(nm.exitCode() == 0, nm.readAllStandardError().constData()); const QByteArray output = nm.readAllStandardOutput(); QVERIFY2(output.toLower().contains("debugginghelper"), output.constData()); } void TestBlackboxQt::qobjectInObjectiveCpp() { if (!HostOsInfo::isMacosHost()) QSKIP("only applies on macOS"); const QString testDir = testDataDir + "/qobject-in-mm"; QDir::setCurrent(testDir); QCOMPARE(runQbs(), 0); } void TestBlackboxQt::qmlTypeRegistrar_data() { QTest::addColumn("importName"); QTest::addColumn("installDir"); QTest::newRow("don't generate") << QString() << QString(); QTest::newRow("don't generate with install info") << QString() << QString("blubb"); QTest::newRow("generate only") << QString("People") << QString(); QTest::newRow("generate and install") << QString("People") << QString("blubb"); } void TestBlackboxQt::qmlTypeRegistrar() { QDir::setCurrent(testDataDir + "/qmltyperegistrar"); QFETCH(QString, importName); QFETCH(QString, installDir); rmDirR(relativeBuildDir()); const QStringList args{"modules.Qt.qml.importName:" + importName, "modules.Qt.qml.typesInstallDir:" + installDir}; if ((runQbs(QbsRunParameters("resolve", args)) != 0) && m_qbsStderr.contains("Dependency 'Qt.qml' not found for product 'myapp'")) QSKIP("Qt version too old"); const bool hasRegistrar = m_qbsStdout.contains("has registrar"); const bool doesNotHaveRegistrar = m_qbsStdout.contains("does not have registrar"); QVERIFY(hasRegistrar != doesNotHaveRegistrar); if (doesNotHaveRegistrar) QSKIP("Qt version too old"); QbsRunParameters buildParams; buildParams.arguments << "--command-echo-mode" << "command-line"; QCOMPARE(runQbs(buildParams), 0); const bool enabled = !importName.isEmpty(); QCOMPARE(m_qbsStdout.contains("--foreign-types"), enabled); QCOMPARE(m_qbsStdout.contains("myapp_qmltyperegistrations.cpp.o"), enabled); const QString buildDir = relativeProductBuildDir("myapp"); QCOMPARE(regularFileExists(buildDir + "/myapp.qmltypes"), enabled); QCOMPARE(regularFileExists(relativeBuildDir() + "/install-root/" + installDir + "/myapp.qmltypes"), enabled && !installDir.isEmpty()); } void TestBlackboxQt::qtKeywords() { QDir::setCurrent(testDataDir + "/qt-keywords"); QbsRunParameters params(QStringList("modules.Qt.core.enableKeywords:false")); params.expectFailure = true; QVERIFY(runQbs(params) != 0); params.arguments.clear(); QVERIFY(runQbs(params) != 0); params.command = "resolve"; QCOMPARE(runQbs(params), 0); params.command = "build"; QCOMPARE(runQbs(params), 0); } void TestBlackboxQt::quickCompiler() { QDir::setCurrent(testDataDir + "/quick-compiler"); if ((runQbs() != 0) && m_qbsStderr.contains("'Qt.quick' has version 4.8.7, but it needs to be at least 5.0.0.")) QSKIP("Qt version too old"); const bool hasCompiler = m_qbsStdout.contains("compiler available"); const bool doesNotHaveCompiler = m_qbsStdout.contains("compiler not available"); QVERIFY2(hasCompiler || doesNotHaveCompiler, m_qbsStdout.constData()); QCOMPARE(m_qbsStdout.contains("compiling qml_subdir_test_qml.cpp"), hasCompiler); if (doesNotHaveCompiler) QSKIP("qtquickcompiler not available"); QVERIFY2(m_qbsStdout.contains("generating loader source"), m_qbsStdout.constData()); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("generating loader source"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); touch("qml/subdir/test.qml"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("generating loader source"), m_qbsStdout.constData()); QCOMPARE(runQbs(QbsRunParameters(QStringList{"config:off", "modules.Qt.quick.useCompiler:false"})), 0); QVERIFY2(m_qbsStdout.contains("compiling"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("compiling qml_subdir_test_qml.cpp"), m_qbsStdout.constData()); } void TestBlackboxQt::qtScxml() { QDir::setCurrent(testDataDir + "/qtscxml"); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(), 0); if (m_qbsStdout.contains("QtScxml not present")) QSKIP("QtScxml module not present"); QVERIFY2(m_qbsStdout.contains("state machine name: qbs_test_machine"), m_qbsStdout.constData()); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("modules.Qt.scxml.additionalCompilerFlags:--blubb"))), 0); QbsRunParameters params; params.expectFailure = true; QVERIFY2(runQbs(params) != 0, m_qbsStdout.constData()); } // see, https://bugreports.qt.io/projects/QBS/issues/QBS-1839 // checks Qt.xml framework is linked correctly void TestBlackboxQt::qtXml() { QDir::setCurrent(testDataDir + "/qt-xml"); QCOMPARE(runQbs(), 0); } void TestBlackboxQt::removeMocHeaderFromFileList() { QDir::setCurrent(testDataDir + "/remove-moc-header-from-file-list"); QCOMPARE(runQbs(), 0); QString projectFile("remove-moc-header-from-file-list.qbs"); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "\"file.h\"", "// \"file.h\""); QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(projectFile, "// \"file.h\"", "\"file.h\""); QCOMPARE(runQbs(), 0); } void TestBlackboxQt::shadertools_data() { QTest::addColumn("projectName"); QTest::addColumn("linesToCheck"); QTest::newRow("basic") << "basic" << QStringList{ "qsb.*basic_shader.frag.qsb.*", "qsb.*--glsl ['\"]100 es,120,150['\"] --hlsl 50 --msl 20 -O -g", }; QTest::newRow("defines") << "defines" << QStringList{"qsb.*defines_shader.frag.qsb.*-DTEST_DEFINE_1=1.*-DTEST_DEFINE_2=1"}; QTest::newRow("tessellation") << "tessellation" << QStringList{ "qsb.*tessellation_shader.vert.qsb.*--glsl.*410,320es", "qsb.*tessellation_shader.tesc.qsb.*--glsl.*410,320es.*" "--msltess --tess-mode triangles --tess-vertex-count 3"}; QTest::newRow("viewcount") << "viewcount" << QStringList{ "qsb.*basic_shader.frag.qsb.*", "qsb.*--glsl ['\"]100 es,120,150['\"] --hlsl 50 --msl 20 --view-count 4", }; } void TestBlackboxQt::shadertools() { QFETCH(QString, projectName); QFETCH(QStringList, linesToCheck); bool hasViewCount = false; const auto shaderToolsFound = findShaderTools(&hasViewCount); QVERIFY(shaderToolsFound.has_value()); if (!shaderToolsFound.value()) QSKIP("Test requires Qt 6, dynamic Qt build and Qt Shader Tools"); if (projectName == "viewcount" && !hasViewCount) { QSKIP("Test requires Qt 6.7.0 or later"); } QDir::setCurrent(testDataDir + "/shadertools"); rmDirR(relativeBuildDir()); rmDirR(relativeBuildDir()); QbsRunParameters params; params.arguments << QStringLiteral("-f") << projectName + ".qbs" << "--command-echo-mode" << "command-line"; QCOMPARE(runQbs(params), 0); for (const auto &line : linesToCheck) { const QRegularExpression pattern(line); const QRegularExpressionMatch match = pattern.match(m_qbsStdout); QVERIFY2(match.hasMatch(), qPrintable(m_qbsStdout)); } } void TestBlackboxQt::shadertoolsLinking_data() { QTest::addColumn("enableLinking"); QTest::newRow("linking enabled") << true; QTest::newRow("linking disabled") << false; } void TestBlackboxQt::shadertoolsLinking() { QFETCH(bool, enableLinking); const auto shaderToolsFound = findShaderTools(); QVERIFY(shaderToolsFound.has_value()); if (!shaderToolsFound.value()) QSKIP("Test requires Qt 6, dynamic Qt build and Qt Shader Tools"); QDir::setCurrent(testDataDir + "/shadertools-linking"); QbsRunParameters params; params.arguments << QString("modules.Qt.shadertools.enableLinking:%1").arg(enableLinking); params.expectFailure = !enableLinking; if (enableLinking) { QCOMPARE(runQbs(params), 0); QVERIFY(!m_qbsStdout.contains("compiling shader.frag.qsb")); } else { QVERIFY(runQbs(params) != 0); } } void TestBlackboxQt::staticQtPluginLinking() { QDir::setCurrent(testDataDir + "/static-qt-plugin-linking"); QCOMPARE(runQbs(QStringList("products.p.type:application")), 0); const bool isStaticQt = m_qbsStdout.contains("Qt is static"); QVERIFY2(m_qbsStdout.contains("creating static import") == isStaticQt, m_qbsStdout.constData()); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("products.p.type:staticlibrary"))), 0); QCOMPARE(runQbs(), 0); QVERIFY2(!m_qbsStdout.contains("creating static import"), m_qbsStdout.constData()); } void TestBlackboxQt::trackAddMocInclude() { QDir::setCurrent(testDataDir + "/trackAddMocInclude"); if (QFile::exists("work")) rmDirR("work"); QDir().mkdir("work"); ccp("before", "work"); QDir::setCurrent(testDataDir + "/trackAddMocInclude/work"); // The build must fail because the main.moc include is missing. QbsRunParameters params; params.expectFailure = true; QVERIFY(runQbs(params) != 0); WAIT_FOR_NEW_TIMESTAMP(); ccp("../after", "."); touch("main.cpp"); QCOMPARE(runQbs(), 0); } void TestBlackboxQt::track_qobject_change() { QDir::setCurrent(testDataDir + "/trackQObjChange"); copyFileAndUpdateTimestamp("bla_qobject.h", "bla.h"); QCOMPARE(runQbs(), 0); const QString objectSuffix = parsedObjectSuffix(m_qbsStdout); const QString productFilePath = relativeExecutableFilePath("i", m_qbsStdout); QVERIFY2(regularFileExists(productFilePath), qPrintable(productFilePath)); QString moc_bla_objectFileName = relativeProductBuildDir("i") + '/' + inputDirHash("qt.headers") + "/moc_bla.cpp" + objectSuffix; QVERIFY2(regularFileExists(moc_bla_objectFileName), qPrintable(moc_bla_objectFileName)); WAIT_FOR_NEW_TIMESTAMP(); copyFileAndUpdateTimestamp("bla_noqobject.h", "bla.h"); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(productFilePath)); QVERIFY(!QFile(moc_bla_objectFileName).exists()); } void TestBlackboxQt::track_qrc() { QDir::setCurrent(testDataDir + "/qrc"); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); if (m_qbsStdout.contains("using qt4")) QSKIP("Qt version too old"); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); const QString fileName = relativeExecutableFilePath("i", m_qbsStdout); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(m_qbsStdout.contains("rcc"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("compiling test.cpp"), m_qbsStdout.constData()); QVERIFY2(regularFileExists(fileName), qPrintable(fileName)); QDateTime dt = QFileInfo(fileName).lastModified(); WAIT_FOR_NEW_TIMESTAMP(); { QFile f("stuff.txt"); f.remove(); QVERIFY(f.open(QFile::WriteOnly)); f.write("bla"); f.close(); } REPLACE_IN_FILE("i.qbs", "//\"test.cpp\"", "\"test.cpp\""); waitForFileUnlock(); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(m_qbsStdout.contains("rcc bla.qrc"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("compiling test.cpp"), m_qbsStdout.constData()); QVERIFY(regularFileExists(fileName)); QVERIFY(dt < QFileInfo(fileName).lastModified()); WAIT_FOR_NEW_TIMESTAMP(); touch("i.qbs"); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Resolving"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("rcc"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("compiling test.cpp"), m_qbsStdout.constData()); // Turn on big resources. WAIT_FOR_NEW_TIMESTAMP(); QCOMPARE(runQbs(QbsRunParameters("resolve", {"modules.Qt.core.enableBigResources:true"})), 0); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(m_qbsStdout.contains("rcc (pass 1) bla.qrc"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("rcc (pass 2) bla.qrc"), m_qbsStdout.constData()); // Check null build. WAIT_FOR_NEW_TIMESTAMP(); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Building"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("rcc"), m_qbsStdout.constData()); // Turn off big resources. WAIT_FOR_NEW_TIMESTAMP(); QCOMPARE(runQbs(QbsRunParameters("resolve", {"modules.Qt.core.enableBigResources:false"})), 0); QCOMPARE(runQbs(QbsRunParameters("run")), 0); QVERIFY2(m_qbsStdout.contains("rcc bla.qrc"), m_qbsStdout.constData()); // Check null build. WAIT_FOR_NEW_TIMESTAMP(); QCOMPARE(runQbs(), 0); QVERIFY2(m_qbsStdout.contains("Building"), m_qbsStdout.constData()); QVERIFY2(!m_qbsStdout.contains("rcc"), m_qbsStdout.constData()); } void TestBlackboxQt::unmocable() { QDir::setCurrent(testDataDir + "/unmocable"); QCOMPARE(runQbs(), 0); QVERIFY(!m_qbsStderr.contains("No relevant classes found. No output generated.")); } QTEST_MAIN(TestBlackboxQt) qbs-src-3.2.0/tests/auto/blackbox/blackbox-java.qbs0000644000175100017510000000077115154533055021621 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "blackbox-java" Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { name: "testdata" prefix: "testdata-java/" files: ["**/*"] fileTags: [] } files: [ "../shared.h", "tst_blackboxbase.cpp", "tst_blackboxbase.h", "tst_blackboxjava.cpp", "tst_blackboxjava.h", ] cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)]) } qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxjoblimits.cpp0000644000175100017510000001765615154533055023520 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 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 "tst_blackboxbase.h" #include "../shared.h" #include class TestBlackboxJobLimits : public TestBlackboxBase { Q_OBJECT public: TestBlackboxJobLimits(); private slots: void initTestCase(); void jobLimits_data(); void jobLimits(); }; TestBlackboxJobLimits::TestBlackboxJobLimits() : TestBlackboxBase (SRCDIR "/testdata-joblimits", "blackbox-joblimits") { } void TestBlackboxJobLimits::initTestCase() { TestBlackboxBase::initTestCase(); QDir::setCurrent(testDataDir + "/job-limits-init"); QCOMPARE(runQbs({"resolve"}), 0); if (m_qbsStdout.contains("target platform/arch differ from host platform/arch")) QSKIP("Skip test in cross-compiled build"); } void TestBlackboxJobLimits::jobLimits_data() { QTest::addColumn("projectJobCount"); QTest::addColumn("productJobCount"); QTest::addColumn("moduleJobCount"); QTest::addColumn("prefsJobCount"); QTest::addColumn("cliJobCount"); QTest::addColumn("projectPrecedence"); QTest::addColumn("expectSuccess"); for (int projectJobCount = -1; projectJobCount <= 1; ++projectJobCount) { for (int productJobCount = -1; productJobCount <= 1; ++productJobCount) { for (int moduleJobCount = -1; moduleJobCount <= 1; ++moduleJobCount) { for (int prefsJobCount = -1; prefsJobCount <= 1; ++prefsJobCount) { for (int cliJobCount = -1; cliJobCount <= 1; ++cliJobCount) { QString description = QString("project:%1/" "product:%2/module:%3/prefs:%4/cli:%5/project precedence") .arg(projectJobCount).arg(productJobCount).arg(moduleJobCount) .arg(prefsJobCount).arg(cliJobCount).toLocal8Bit(); bool expectSuccess; switch (productJobCount) { case 1: expectSuccess = true; break; case 0: expectSuccess = false; break; case -1: switch (projectJobCount) { case 1: expectSuccess = true; break; case 0: expectSuccess = false; break; case -1: switch (moduleJobCount) { case 1: expectSuccess = true; break; case 0: expectSuccess = false; break; case -1: switch (cliJobCount) { case 1: expectSuccess = true; break; case 0: expectSuccess = false; break; case -1: expectSuccess = prefsJobCount == 1; break; } break; } break; } break; } QTest::newRow(qPrintable(description)) << projectJobCount << productJobCount << moduleJobCount << prefsJobCount << cliJobCount << true << expectSuccess; description = QString("project:%1/" "product:%2/module:%3/prefs:%4/cli:%5/default precedence") .arg(projectJobCount).arg(productJobCount).arg(moduleJobCount) .arg(prefsJobCount).arg(cliJobCount).toLocal8Bit(); switch (cliJobCount) { case 1: expectSuccess = true; break; case 0: expectSuccess = false; break; case -1: switch (prefsJobCount) { case 1: expectSuccess = true; break; case 0: expectSuccess = false; break; case -1: switch (productJobCount) { case 1: expectSuccess = true; break; case 0: expectSuccess = false; break; case -1: switch (projectJobCount) { case 1: expectSuccess = true; break; case 0: expectSuccess = false; break; case -1: expectSuccess = moduleJobCount == 1; break; } break; } break; } break; } QTest::newRow(qPrintable(description)) << projectJobCount << productJobCount << moduleJobCount << prefsJobCount << cliJobCount << false << expectSuccess; } } } } } } void TestBlackboxJobLimits::jobLimits() { QDir::setCurrent(testDataDir + "/job-limits"); QFETCH(int, projectJobCount); QFETCH(int, productJobCount); QFETCH(int, moduleJobCount); QFETCH(int, prefsJobCount); QFETCH(int, cliJobCount); QFETCH(bool, projectPrecedence); QFETCH(bool, expectSuccess); SettingsPtr theSettings = settings(); qbs::Internal::TemporaryProfile profile("jobLimitsProfile", theSettings.get()); profile.p.setValue("preferences.jobLimit.singleton", prefsJobCount); profile.p.setValue("baseProfile", profileName()); theSettings->sync(); QbsRunParameters resolveParams("resolve"); resolveParams.profile = profile.p.name(); resolveParams.arguments << ("project.projectJobCount:" + QString::number(projectJobCount)) << ("project.productJobCount:" + QString::number(productJobCount)) << ("project.moduleJobCount:" + QString::number(moduleJobCount)); QCOMPARE(runQbs(resolveParams), 0); QbsRunParameters buildParams; buildParams.expectFailure = !expectSuccess; if (cliJobCount != -1) buildParams.arguments << "--job-limits" << ("singleton:" + QString::number(cliJobCount)); if (projectPrecedence) buildParams.arguments << "--enforce-project-job-limits"; buildParams.profile = profile.p.name(); const int exitCode = runQbs(buildParams); if (expectSuccess) QCOMPARE(exitCode, 0); else if (exitCode == 0) QSKIP("no failure with no limit in place, result inconclusive"); else QVERIFY2(m_qbsStderr.contains("exclusive"), m_qbsStderr.constData()); if (exitCode == 0) QCOMPARE(m_qbsStdout.count("running tool"), 5); } QTEST_MAIN(TestBlackboxJobLimits) #include qbs-src-3.2.0/tests/auto/blackbox/blackbox-apple.qbs0000644000175100017510000000103415154533055021772 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "blackbox-apple" Depends { name: "Qt.xml" } Depends { name: "qbs_app" } Depends { name: "qbs-setup-toolchains" } Group { name: "testdata" prefix: "testdata-apple/" files: ["**/*"] fileTags: [] } files: [ "../shared.h", "tst_blackboxapple.cpp", "tst_blackboxapple.h", "tst_blackboxbase.cpp", "tst_blackboxbase.h", ] cpp.defines: base.concat(["SRCDIR=" + Utilities.cStringQuote(path)]) } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/0000755000175100017510000000000015154533055022225 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-cli-override/0000755000175100017510000000000015154533055030672 5ustar runnerrunner././@LongLink0000644000000000000000000000017500000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-cli-override/qbs-module-providers-cli-override.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-cli-override/qbs-module-pr0000644000175100017510000000052015154533055033301 0ustar runnerrunnerProject { name: "project" Project { name: "innerProject" Product { name: "product" Depends { name: "qbsmetatestmodule"; required: false } property bool dummy: { console.info("qbsmetatestmodule.prop: " + qbsmetatestmodule.prop); } } } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-cli-override/module-providers/qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-cli-override/module-provid0000755000175100017510000000000015154533055033401 5ustar runnerrunner././@LongLink0000644000000000000000000000016700000000000011607 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-cli-override/module-providers/provider_a.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-cli-override/module-provid0000644000175100017510000000032615154533055033404 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsmetatestmodule", "from_provider_a"); return ""; } } ././@LongLink0000644000000000000000000000016700000000000011607 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-cli-override/module-providers/provider_b.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-cli-override/module-provid0000644000175100017510000000044715154533055033410 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsmetatestmodule", "from_provider_b"); Helpers.writeModule(outputBaseDir, "qbsothermodule", "from_provider_b"); return ""; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-compatibility/0000755000175100017510000000000015154533055031157 5ustar runnerrunner././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-compatibility/module-providers/qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-compatibility/module-provi0000755000175100017510000000000015154533055033522 5ustar runnerrunner././@LongLink0000644000000000000000000000017400000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-compatibility/module-providers/qbsmetatestmodule/qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-compatibility/module-provi0000755000175100017510000000000015154533055033522 5ustar runnerrunner././@LongLink0000644000000000000000000000021000000000000011574 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-compatibility/module-providers/qbsmetatestmodule/provider.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-compatibility/module-provi0000644000175100017510000000033615154533055033526 0ustar runnerrunnerimport "../../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsmetatestmodule", "from_scoped_provider"); return ""; } } ././@LongLink0000644000000000000000000000017400000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-compatibility/module-providers/named_provider.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-compatibility/module-provi0000644000175100017510000000033215154533055033522 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsmetatestmodule", "from_named_provider"); return ""; } } ././@LongLink0000644000000000000000000000017700000000000011610 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-compatibility/qbs-module-providers-compatibility.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-compatibility/qbs-module-p0000644000175100017510000000026015154533055033405 0ustar runnerrunnerProduct { name: "p" Depends { name: "qbsmetatestmodule" } property bool dummy: { console.info("qbsmetatestmodule.prop: " + qbsmetatestmodule.prop); } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers-helpers.js0000644000175100017510000000160715154533055030312 0ustar runnerrunnervar File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var TextFile = require("qbs.TextFile"); var ModUtils = require("qbs.ModUtils"); function writeModule(outputBaseDir, name, prop, listProp, boolProp) { console.info("Running setup script for " + name); var moduleDir = FileInfo.joinPaths(outputBaseDir, "modules", name); File.makePath(moduleDir); var module = new TextFile(FileInfo.joinPaths(moduleDir, "module.qbs"), TextFile.WriteOnly); module.writeLine("Module {"); module.writeLine(" property string prop: " + ModUtils.toJSLiteral(prop)); if (listProp) { module.writeLine(" property stringList listProp: " + ModUtils.toJSLiteral(listProp)); } if (boolProp) { module.writeLine(" property bool boolProp: " + ModUtils.toJSLiteral(boolProp)); } module.writeLine("}"); module.close(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/removal-version/0000755000175100017510000000000015154533055025355 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/removal-version/module-providers/0000755000175100017510000000000015154533055030655 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/removal-version/module-providers/provider_a.qbs0000644000175100017510000000053315154533055033517 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { isEager: false property bool deprecated: false PropertyOptions { name: "deprecated" removalVersion: "2.2.0" } relativeSearchPaths: { Helpers.writeModule(outputBaseDir, moduleName, "from_provider_a"); return ""; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/removal-version/removal-version.qbs0000644000175100017510000000033415154533055031214 0ustar runnerrunnerProject { qbsModuleProviders: "provider_a" name: "project" Project { name: "innerProject" Product { name: "p1" Depends { name: "qbsmetatestmodule" } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers-cache/0000755000175100017510000000000015154533055026566 5ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers-cache/module-providers-cache.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers-cache/module-providers-cache.q0000644000175100017510000000034615154533055033314 0ustar runnerrunnerProject { qbsModuleProviders: ["provider_a"] name: "project" property string dummyProp Product { name: "p1" Depends { name: "qbsothermodule" } Depends { name: "qbsmetatestmodule" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers-cache/module-providers/0000755000175100017510000000000015154533055032066 5ustar runnerrunner././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers-cache/module-providers/provider_a.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers-cache/module-providers/provide0000644000175100017510000000044715154533055033466 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsmetatestmodule", "from_provider_a"); Helpers.writeModule(outputBaseDir, "qbsothermodule", "from_provider_a"); return ""; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/broken-provider/0000755000175100017510000000000015154533055025335 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/broken-provider/broken-provider.qbs0000644000175100017510000000043415154533055031155 0ustar runnerrunnerProject { qbsModuleProviders: "provider_a" name: "project" Project { name: "innerProject" Product { name: "p1" Depends { name: "qbsothermodule"; required: false } Depends { name: "qbsmetatestmodule" } } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/broken-provider/module-providers/0000755000175100017510000000000015154533055030635 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/broken-provider/module-providers/provider_a.qbs0000644000175100017510000000013515154533055033475 0ustar runnerrunnerModuleProvider { relativeSearchPaths: { throw "This provider is broken"; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/0000755000175100017510000000000015154533055025153 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/main.cpp0000644000175100017510000000027215154533055026604 0ustar runnerrunner#include #include #include const char *nameA(); int main() { HelloWorld h(42 + hello()); std::cout << "Calling: " << nameA() << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlibheader/0000755000175100017510000000000015154533055027772 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlibheader/header.h0000644000175100017510000000006215154533055031371 0ustar runnerrunner#pragma once inline int hello() { return 0; }qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlibheader/conanfile.py0000644000175100017510000000056315154533055032306 0ustar runnerrunnerfrom conan import ConanFile from conan.tools.files import copy import os class Recipe(ConanFile): exports_sources = ("header.h") version = '0.1.0' name = 'conanmoduleprovider.testlibheader' def package(self): copy(self, "header.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include"))qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlib/0000755000175100017510000000000015154533055026621 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.cpp0000644000175100017510000000014215154533055030770 0ustar runnerrunner#include "testlib.h" #include HelloWorld::HelloWorld(int x) : m_x(foo(x)) {} qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.h0000644000175100017510000000014315154533055030436 0ustar runnerrunner#pragma once class HelloWorld { public: explicit HelloWorld(int x); private: int m_x; }; qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlib/CMakeLists.txt0000644000175100017510000000060515154533055031362 0ustar runnerrunnercmake_minimum_required(VERSION 3.15) project(conanmoduleprovider.testlib) find_package(conanmoduleprovider.testlibdep REQUIRED) add_library(${PROJECT_NAME} STATIC testlib.cpp) set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "testlib.h") target_link_libraries(${PROJECT_NAME} conanmoduleprovider.testlibdep::conanmoduleprovider.testlibdep) install(TARGETS ${PROJECT_NAME}) qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlib/conanfile.py0000644000175100017510000000162315154533055031133 0ustar runnerrunnerfrom conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps import os class ConanModuleProviderTestlib(ConanFile): name = "conanmoduleprovider.testlib" license = "none" version = "1.2.3" exports_sources = "*.cpp", "*.h", "CMakeLists.txt" settings = "os", "compiler", "build_type", "arch" def requirements(self): self.requires("conanmoduleprovider.testlibdep/1.2.3") def layout(self): cmake_layout(self) def generate(self): deps = CMakeDeps(self) deps.generate() tc = CMakeToolchain(self, generator="Ninja") tc.generate() def build(self): cmake = CMake(self) cmake.configure() cmake.build() def package(self): cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ['conanmoduleprovider.testlib'] qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/conanfile.py0000644000175100017510000000052115154533055027461 0ustar runnerrunnerfrom conan import ConanFile class Recipe(ConanFile): name = "qbstest" version = "1.0" exports_sources = "*.cpp", "*.h", "*.txt" settings = "os", "compiler", "build_type", "arch" requires = ["conanmoduleprovider.testlib/1.2.3", "conanmoduleprovider.testlibheader/0.1.0", "conanmoduleprovider.lib-order-test/1.0.0"] qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/lib-order-test/0000755000175100017510000000000015154533055030007 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/lib-order-test/A/0000755000175100017510000000000015154533055030167 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/lib-order-test/A/A.cpp0000644000175100017510000000011115154533055031044 0ustar runnerrunnerextern const char *nameB(); const char *nameA() { return nameB(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/lib-order-test/B/0000755000175100017510000000000015154533055030170 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/lib-order-test/B/B.cpp0000644000175100017510000000011115154533055031046 0ustar runnerrunnerextern const char *nameC(); const char *nameB() { return nameC(); } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/lib-order-test/CMakeLists.txt0000644000175100017510000000051615154533055032551 0ustar runnerrunnercmake_minimum_required(VERSION 3.15) project(lib_order_test CXX) add_library(C STATIC C/C.cpp) add_library(B STATIC B/B.cpp) add_library(A STATIC A/A.cpp) target_link_libraries(B PUBLIC C) target_link_libraries(A PUBLIC B) install(TARGETS A B C ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/lib-order-test/conanfile.py0000644000175100017510000000250015154533055032314 0ustar runnerrunnerfrom conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps from conan.tools.files import copy import os class LibAConan(ConanFile): name = "conanmoduleprovider.lib-order-test" version = "1.0.0" license = "none" settings = "os", "compiler", "build_type", "arch" exports_sources = "CMakeLists.txt", "A/*", "B/*", "C/*" build_policy = "missing" def layout(self): cmake_layout(self) def generate(self): deps = CMakeDeps(self) deps.generate() tc = CMakeToolchain(self, generator="Ninja") tc.generate() def build(self): cmake = CMake(self) cmake.configure() cmake.build() def package(self): cmake = CMake(self) cmake.install() def package_info(self): # Component C self.cpp_info.components["C"].includedirs = [] self.cpp_info.components["C"].libs = ["C"] # Component B depends on C self.cpp_info.components["B"].includedirs = [] self.cpp_info.components["B"].libs = ["B"] self.cpp_info.components["B"].requires = ["C"] # Component A depends on B self.cpp_info.components["A"].includedirs = [] self.cpp_info.components["A"].libs = ["A"] self.cpp_info.components["A"].requires = ["B"] qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/lib-order-test/C/0000755000175100017510000000000015154533055030171 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/lib-order-test/C/C.cpp0000644000175100017510000000005015154533055031052 0ustar runnerrunnerconst char *nameC() { return "C"; } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/conan-module-provider.qbs0000644000175100017510000000055115154533055032074 0ustar runnerrunnerCppApplication { consoleApplication: true name: "p" files: "main.cpp" qbsModuleProviders: "conan" qbs.buildVariant: "release" qbs.installPrefix: "" install: true Depends { name: "conanmoduleprovider.testlib" } Depends { name: "conanmoduleprovider.testlibheader" } Depends { name: "conanmoduleprovider.lib-order-test" } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/0000755000175100017510000000000015154533055027312 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/lorem_ipsum.txt0000644000175100017510000000007015154533055032403 0ustar runnerrunnerLorem ipsum dolor sit amet, consectetur adipiscing elit.qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/CMakeLists.txt0000644000175100017510000000044115154533055032051 0ustar runnerrunnercmake_minimum_required(VERSION 3.15) project(conanmoduleprovider.testlibdep) add_library(${PROJECT_NAME} STATIC testlibdep.cpp) set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "testlibdep.h") install(TARGETS ${PROJECT_NAME}) install(FILES lorem_ipsum.txt DESTINATION share)qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/conanfile.py0000644000175100017510000000160315154533055031622 0ustar runnerrunnerfrom conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps from conan.tools.files import copy import os class ConanModuleProviderTestlib(ConanFile): name = "conanmoduleprovider.testlibdep" license = "none" version = "1.2.3" exports_sources = "*.cpp", "*.h", "*.txt" settings = "os", "compiler", "build_type", "arch" def layout(self): cmake_layout(self) def generate(self): deps = CMakeDeps(self) deps.generate() tc = CMakeToolchain(self, generator="Ninja") tc.generate() def build(self): cmake = CMake(self) cmake.configure() cmake.build() def package(self): cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ['conanmoduleprovider.testlibdep'] self.cpp_info.resdirs = ['share'] qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.h0000644000175100017510000000003515154533055031620 0ustar runnerrunner#pragma once int foo(int i);qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.cpp0000644000175100017510000000007515154533055032157 0ustar runnerrunner#include "testlibdep.h" int foo(int i) { return i * i; }qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-properties-in-providers/0000755000175100017510000000000015154533055031106 5ustar runnerrunner././@LongLink0000644000000000000000000000017700000000000011610 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-properties-in-providers/qbs-module-properties-in-providers.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-properties-in-providers/qbs-module-p0000644000175100017510000000157515154533055033346 0ustar runnerrunnerProject { qbsModuleProviders: "provider_a" name: "project" Profile { name: "profile1" qbs.sysroot: "/sysroot1" } Profile { name: "profile2" qbs.sysroot: "/sysroot2" } Product { name: "product1" Depends { name: "qbsmetatestmodule" } property bool dummy: { console.info("product1.qbsmetatestmodule.prop: " + qbsmetatestmodule.prop); } // multiplex over profiles, sysroot should not be cached qbs.profiles: ["profile1", "profile2"] } Product { name: "product2" Depends { name: "qbsmetatestmodule" } property bool dummy: { console.info("product2.qbsmetatestmodule.prop: " + qbsmetatestmodule.prop); } // multiplex over profiles, sysroot should not be cached qbs.profiles: ["profile1", "profile2"] } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-properties-in-providers/module-providers/qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-properties-in-providers/module-provi0000755000175100017510000000000015154533055033451 5ustar runnerrunner././@LongLink0000644000000000000000000000017000000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-properties-in-providers/module-providers/provider_a.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-properties-in-providers/module-provi0000644000175100017510000000036515154533055033457 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { property string sysroot: qbs.sysroot relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsmetatestmodule", sysroot); return ""; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbspkgconfig-module-provider/0000755000175100017510000000000015154533055030015 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbspkgconfig-module-provider/main.cpp0000644000175100017510000000020315154533055031440 0ustar runnerrunner#include #ifndef THE_MAGIC_DEFINE #error "missing the magic define" #endif int main() { foo(); return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbspkgconfig-module-provider/libs/0000755000175100017510000000000015154533055030746 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbspkgconfig-module-provider/libs/libs.qbs0000644000175100017510000000246615154533055032416 0ustar runnerrunnerimport qbs.FileInfo Project { property bool isBundle: false DynamicLibrary { Depends { name: "cpp" } Depends { name: "bundle" } Depends { name: "Exporter.pkgconfig" } Exporter.pkgconfig.versionEntry: "1.0" name: "libA" bundle.isBundle: project.isBundle bundle.publicHeaders: ["libA.h"] files: "libA.cpp" cpp.defines: { var result = []; if (project.isBundle) result.push("MYLIB_FRAMEWORK"); return result; } qbs.installPrefix: "/usr" install: true installImportLib: true installDir: "lib" Group { files: ["libA.h"] qbs.install: !project.isBundle qbs.installDir: FileInfo.joinPaths("include", product.name) } Group { fileTagsFilter: ["Exporter.pkgconfig.pc"] qbs.install: !project.isBundle qbs.installDir: FileInfo.joinPaths("share", "pkgconfig") } Export { Depends { name: "cpp" } cpp.defines: ["THE_MAGIC_DEFINE"] cpp.includePaths: [FileInfo.joinPaths(exportingProduct.qbs.installPrefix, "include")] cpp.libraryPaths: [FileInfo.joinPaths(exportingProduct.qbs.installPrefix, "lib")] } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbspkgconfig-module-provider/libs/libA.cpp0000644000175100017510000000033515154533055032322 0ustar runnerrunner#include "libA.h" #include void foo() { std::cout << "hello from foo: "; #ifdef MYLIB_FRAMEWORK std::cout << "bundled: yes"; #else std::cout << "bundled: no"; #endif std::cout << std::endl; } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbspkgconfig-module-provider/libs/libA.h0000644000175100017510000000076115154533055031772 0ustar runnerrunner#pragma once #if defined(_WIN32) || defined(WIN32) # define DECL_EXPORT __declspec(dllexport) # define DECL_IMPORT __declspec(dllimport) #else # define DECL_EXPORT __attribute__((visibility("default"))) # define DECL_IMPORT __attribute__((visibility("default"))) # endif #if defined(LIBA_STATIC_LIBRARY) # define LIBA_EXPORT #else # if defined(MYLIB_LIBRARY) # define LIBA_EXPORT DECL_EXPORT # else # define LIBA_EXPORT DECL_IMPORT # endif #endif LIBA_EXPORT void foo(); ././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbspkgconfig-module-provider/qbspkgconfig-module-provider.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbspkgconfig-module-provider/qbspkgconfig-modul0000644000175100017510000000017315154533055033534 0ustar runnerrunnerCppApplication { name: "p" Depends { name: "libA" } files: "main.cpp" qbsModuleProviders: "qbspkgconfig" } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-properties/0000755000175100017510000000000015154533055026434 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-properties/providers-properties.qbs0000644000175100017510000000071215154533055033352 0ustar runnerrunnerProduct { qbsModuleProviders: ["provider_a", "provider_b"] name: "p" Depends { name: "qbsmetatestmodule" } Depends { name: "qbsothermodule" } moduleProviders.provider_a.someProp: "someValue" property bool dummy: { console.info("p.qbsmetatestmodule.listProp: " + JSON.stringify(qbsmetatestmodule.listProp)); console.info("p.qbsothermodule.listProp: " + JSON.stringify(qbsothermodule.listProp)); } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-properties/module-providers/0000755000175100017510000000000015154533055031734 5ustar runnerrunner././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-properties/module-providers/provider_a.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-properties/module-providers/provider_0000644000175100017510000000040715154533055033651 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { property stringList someProp: "provider_a" relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsmetatestmodule", undefined, someProp); return ""; } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-properties/module-providers/provider_b.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-properties/module-providers/provider_0000644000175100017510000000040415154533055033646 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { property stringList someProp: "provider_b" relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsothermodule", undefined, someProp); return ""; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers/0000755000175100017510000000000015154533055026310 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers/qbs-module-providers.qbs0000644000175100017510000000022015154533055033074 0ustar runnerrunnerProject { SubProject { // This strange construct tests QBS-1836 inheritProperties: false filePath: "subproject.qbs" } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers/subproject.qbs0000644000175100017510000000151315154533055031177 0ustar runnerrunnerProject { qbsModuleProviders: "provider_a" name: "project" Project { name: "innerProject" Product { name: "p1" Depends { name: "qbsmetatestmodule" } Depends { name: "qbsothermodule"; required: false } property bool dummy: { console.info("p1.qbsmetatestmodule.prop: " + qbsmetatestmodule.prop); console.info("p1.qbsothermodule.prop: " + qbsothermodule.prop); } } } Product { name: "p2" Depends { name: "qbsmetatestmodule" } Depends { name: "qbsothermodule"; required: false } property bool dummy: { console.info("p2.qbsmetatestmodule.prop: " + qbsmetatestmodule.prop); console.info("p2.qbsothermodule.prop: " + qbsothermodule.prop); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers/module-providers/0000755000175100017510000000000015154533055031610 5ustar runnerrunner././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers/module-providers/provider_a.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers/module-providers/provider_0000644000175100017510000000032615154533055033525 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsmetatestmodule", "from_provider_a"); return ""; } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers/module-providers/provider_b.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/qbs-module-providers/module-providers/provider_0000644000175100017510000000044715154533055033531 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsmetatestmodule", "from_provider_b"); Helpers.writeModule(outputBaseDir, "qbsothermodule", "from_provider_b"); return ""; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers/0000755000175100017510000000000015154533055025525 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers/main.cpp0000644000175100017510000000030515154533055027153 0ustar runnerrunner#include int main() { std::cout << "The letters are " << LETTER1 << " and " << LETTER2 << std::endl; std::cout << "The MY_DEFINE is " << MY_DEFINE << std::endl; return 0; } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers/module-providers/0000755000175100017510000000000015154533055031025 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers/module-providers/mygenerator/0000755000175100017510000000000015154533055033361 5ustar runnerrunner././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers/module-providers/mygenerator/provider.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers/module-providers/mygenerator/p0000644000175100017510000000255015154533055033545 0ustar runnerrunnerimport qbs.File; import qbs.FileInfo; import qbs.TextFile; ModuleProvider { property string chooseLettersFrom relativeSearchPaths: { console.info("Running setup script for " + name); var startAtBeginning = chooseLettersFrom === "beginning"; var moduleBaseDir = FileInfo.joinPaths(outputBaseDir, "modules", "mygenerator"); var module1Dir = FileInfo.joinPaths(moduleBaseDir, "module1"); File.makePath(module1Dir); var module1 = new TextFile(FileInfo.joinPaths(module1Dir, "module1.qbs"), TextFile.WriteOnly); module1.writeLine("Module {"); module1.writeLine(" Depends { name: 'cpp' }"); module1.writeLine(" cpp.defines: 'LETTER1=" + (startAtBeginning ? "\\\'A\\\'" : "\\\'Z\\\'") + "'"); module1.writeLine("}"); module1.close(); var module2Dir = FileInfo.joinPaths(moduleBaseDir, "module2"); File.makePath(module2Dir); var module2 = new TextFile(FileInfo.joinPaths(module2Dir, "module2.qbs"), TextFile.WriteOnly); module2.writeLine("Module {"); module2.writeLine(" Depends { name: 'cpp' }"); module2.writeLine(" cpp.defines: 'LETTER2=" + (startAtBeginning ? "\\\'B\\\'" : "\\\'Y\\\'") + "'"); module2.writeLine("}"); module2.close(); return ""; } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers/module-providers/othergenerator/qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers/module-providers/othergenerato0000755000175100017510000000000015154533055033614 5ustar runnerrunner././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers/module-providers/othergenerator/provider.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers/module-providers/othergenerato0000644000175100017510000000124315154533055033616 0ustar runnerrunnerimport qbs.File; import qbs.FileInfo; import qbs.TextFile; ModuleProvider { property string someDefines relativeSearchPaths: { console.info("Running setup script for " + name); var moduleDir = FileInfo.joinPaths(outputBaseDir, "modules", "othergenerator"); File.makePath(moduleDir); var module = new TextFile(FileInfo.joinPaths(moduleDir, "module.qbs"), TextFile.WriteOnly); module.writeLine("Module {"); module.writeLine(" Depends { name: 'cpp' }"); module.writeLine(" cpp.defines: 'MY_DEFINE=\"" + someDefines + "\"'"); module.writeLine("}"); module.close(); return ""; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/module-providers/module-providers.qbs0000644000175100017510000000243315154533055031536 0ustar runnerrunnerimport qbs.Host Project { property bool dummy: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } readonly property string beginning: "beginning" CppApplication { name: "app1" property string chooseLettersFrom: project.beginning // This indirection tests QBS-1747. Depends { name: "mygenerator.module1" } Depends { name: "mygenerator.module2" } Depends { name: "othergenerator" } moduleProviders.mygenerator.chooseLettersFrom: chooseLettersFrom moduleProviders.othergenerator.someDefines: name files: "main.cpp" } CppApplication { readonly property string end: "end" name: "app2" Depends { name: "mygenerator.module1" } Depends { name: "mygenerator.module2" } Depends { name: "othergenerator" } Profile { name: "myProfile" baseProfile: project.profile moduleProviders.mygenerator.chooseLettersFrom: product.end moduleProviders.othergenerator.someDefines: "app2" } qbs.profile: "myProfile" files: "main.cpp" } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition/0000755000175100017510000000000015154533055026226 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition/providers-condition.qbs0000644000175100017510000000065515154533055032744 0ustar runnerrunnerProject { name: "project" qbsModuleProviders: ["provider_a", "provider_b"] Product { name: "p1" Depends { name: "qbsmetatestmodule" } Depends { name: "qbsothermodule"; required: false } property bool dummy: { console.info("p1.qbsmetatestmodule.prop: " + qbsmetatestmodule.prop); console.info("p1.qbsothermodule.prop: " + qbsothermodule.prop); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition/module-providers/0000755000175100017510000000000015154533055031526 5ustar runnerrunner././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition/module-providers/provider_a.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition/module-providers/provider_a0000644000175100017510000000042215154533055033601 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { isEager: false condition: moduleName === "qbsmetatestmodule" relativeSearchPaths: { Helpers.writeModule(outputBaseDir, moduleName, "from_provider_a"); return ""; } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition/module-providers/provider_b.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition/module-providers/provider_b0000644000175100017510000000042515154533055033605 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { isEager: false condition: moduleName === "qbsothermodule" relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsothermodule", "from_provider_b"); return ""; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/non-eager-provider/0000755000175100017510000000000015154533055025730 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/non-eager-provider/module-providers/0000755000175100017510000000000015154533055031230 5ustar runnerrunner././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/non-eager-provider/module-providers/provider_a.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/non-eager-provider/module-providers/provider_a.0000644000175100017510000000045615154533055033370 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { isEager: false relativeSearchPaths: { if (moduleName === "nonexistentmodule") return undefined; Helpers.writeModule(outputBaseDir, moduleName, "from_provider_a"); return ""; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/non-eager-provider/non-eager-provider.qbs0000644000175100017510000000067315154533055032150 0ustar runnerrunnerProject { Product { name: "p1" Depends { name: "qbsmetatestmodule" } Depends { name: "qbsothermodule" } Depends { name: "nonexistentmodule"; required: false } property bool dummy: { console.info("p1.qbsmetatestmodule.prop: " + qbsmetatestmodule.prop); console.info("p1.qbsothermodule.prop: " + qbsothermodule.prop); } qbsModuleProviders: "provider_a" } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/QTBUG-51237/0000755000175100017510000000000015154533055023566 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/QTBUG-51237/qtbug-51237.qbs0000644000175100017510000000073715154533055026105 0ustar runnerrunnerProduct { type: "custom" Depends { name: "mymodule" } qbsModuleProviders: "provider" Rule { multiplex: true outputFileTags: ["custom"] prepare: { var theProperty = product.mymodule.listProp; if (!theProperty) throw "Oh no!"; var dummy = new JavaScriptCommand(); dummy.silent = true; dummy.sourceCode = function() {}; return [dummy]; } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/QTBUG-51237/module-providers/0000755000175100017510000000000015154533055027066 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/QTBUG-51237/module-providers/provider.qbs0000644000175100017510000000037415154533055031433 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { property stringList theProperty relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "mymodule", "from_provider", theProperty); return ""; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conanfile-probe/0000755000175100017510000000000015154533055025270 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conanfile-probe/main.cpp0000644000175100017510000000007315154533055026720 0ustar runnerrunner#include int main() { HelloWorld h(42); } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conanfile-probe/conanfile-probe.qbs0000644000175100017510000000103115154533055031035 0ustar runnerrunnerimport qbs.Probes Project { Probes.ConanfileProbe { id: conanProbe conanfilePath: path + "/conanfile.py" additionalArguments: "-pr:a=qbs-test" } CppApplication { consoleApplication: true name: "p" files: "main.cpp" qbsModuleProviders: "conan" moduleProviders.conan.installDirectory: conanProbe.generatedFilesPath qbs.buildVariant: "release" qbs.installPrefix: "" install: true Depends { name: "conanfileprobe.testlib" } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conanfile-probe/testlib/0000755000175100017510000000000015154533055026736 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conanfile-probe/testlib/testlib.cpp0000644000175100017510000000010415154533055031103 0ustar runnerrunner#include "testlib.h" HelloWorld::HelloWorld(int x) : m_x(x) {} qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conanfile-probe/testlib/testlib.h0000644000175100017510000000014315154533055030553 0ustar runnerrunner#pragma once class HelloWorld { public: explicit HelloWorld(int x); private: int m_x; }; qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conanfile-probe/testlib/CMakeLists.txt0000644000175100017510000000034315154533055031476 0ustar runnerrunnercmake_minimum_required(VERSION 3.15) project(conanfileprobe.testlib) add_library(${PROJECT_NAME} STATIC testlib.cpp) set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "testlib.h") install(TARGETS ${PROJECT_NAME}) qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conanfile-probe/testlib/conanfile.py0000644000175100017510000000153015154533055031245 0ustar runnerrunnerfrom conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps import os class ConanModuleProviderTestlib(ConanFile): name = "conanfileprobe.testlib" license = "none" version = "1.2.3" exports_sources = "*.cpp", "*.h", "CMakeLists.txt" settings = "os", "compiler", "build_type", "arch" def requirements(self): pass def layout(self): cmake_layout(self) def generate(self): deps = CMakeDeps(self) deps.generate() tc = CMakeToolchain(self, generator="Ninja") tc.generate() def build(self): cmake = CMake(self) cmake.configure() cmake.build() def package(self): cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ['conanfileprobe.testlib'] qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/conanfile-probe/conanfile.py0000644000175100017510000000036515154533055027604 0ustar runnerrunnerfrom conan import ConanFile class Recipe(ConanFile): name = "qbstest" version = "1.0" exports_sources = "*.cpp", "*.h", "*.txt" settings = "os", "compiler", "build_type", "arch" requires = ["conanfileprobe.testlib/1.2.3"] qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/probe-in-module-provider/0000755000175100017510000000000015154533055027053 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/probe-in-module-provider/module-providers/0000755000175100017510000000000015154533055032353 5ustar runnerrunner././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/probe-in-module-provider/module-providers/provider_a.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/probe-in-module-provider/module-providers/provi0000644000175100017510000000130215154533055033431 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { property string sysroot: qbs.sysroot Probe { id: theProbe property string theValue: "value" property string dummy: sysroot configure: { console.info("Running probe with irrelevant value '" + dummy + "'"); found = true; } } isEager: false property bool found: theProbe.found property string theValue: theProbe.theValue relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsmetatestmodule", theValue, undefined, found); if (sysroot !== qbs.sysroot) throw "this is unexpected"; return ""; } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/probe-in-module-provider/probe-in-module-provider.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/probe-in-module-provider/probe-in-module-provid0000644000175100017510000000051615154533055033277 0ustar runnerrunnerProduct { qbsModuleProviders: ["provider_a"] name: "p" Depends { name: "qbsmetatestmodule" } property bool dummy: { console.info("p.qbsmetatestmodule.boolProp: " + JSON.stringify(qbsmetatestmodule.boolProp)); console.info("p.qbsmetatestmodule.prop: " + JSON.stringify(qbsmetatestmodule.prop)); } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition-probes/0000755000175100017510000000000015154533055027516 5ustar runnerrunner././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition-probes/providers-condition-probes.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition-probes/providers-condition-0000644000175100017510000000065515154533055033525 0ustar runnerrunnerProject { name: "project" qbsModuleProviders: ["provider_a", "provider_b"] Product { name: "p1" Depends { name: "qbsmetatestmodule" } Depends { name: "qbsothermodule"; required: false } property bool dummy: { console.info("p1.qbsmetatestmodule.prop: " + qbsmetatestmodule.prop); console.info("p1.qbsothermodule.prop: " + qbsothermodule.prop); } } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition-probes/module-providers/0000755000175100017510000000000015154533055033016 5ustar runnerrunner././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition-probes/module-providers/provider_a.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition-probes/module-providers/pro0000644000175100017510000000062315154533055033542 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { isEager: false condition: theProbe.found Probe { id: theProbe condition: moduleName === "qbsmetatestmodule" configure: { found = true } } relativeSearchPaths: { Helpers.writeModule(outputBaseDir, moduleName, "from_provider_a"); return ""; } } ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition-probes/module-providers/provider_b.qbsqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/providers-condition-probes/module-providers/pro0000644000175100017510000000062615154533055033545 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { isEager: false condition: theProbe.found Probe { id: theProbe condition: moduleName === "qbsothermodule" configure: { found = true } } relativeSearchPaths: { Helpers.writeModule(outputBaseDir, "qbsothermodule", "from_provider_b"); return ""; } } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/allowed-values/0000755000175100017510000000000015154533055025151 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/allowed-values/allowed-values.qbs0000644000175100017510000000013115154533055030577 0ustar runnerrunnerProduct { Depends { name: "qbsmetatestmodule" } qbsModuleProviders: "provider" } qbs-src-3.2.0/tests/auto/blackbox/testdata-providers/allowed-values/module-providers/0000755000175100017510000000000015154533055030451 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/blackbox/testdata-providers/allowed-values/module-providers/provider.qbs0000644000175100017510000000054415154533055033015 0ustar runnerrunnerimport "../../qbs-module-providers-helpers.js" as Helpers ModuleProvider { isEager: false property stringList aProperty: "zero" PropertyOptions { name: "aProperty" allowedValues: ["one", "two"] } relativeSearchPaths: { Helpers.writeModule(outputBaseDir, moduleName, "from_provider"); return ""; } } qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxbaremetal.h0000644000175100017510000000450015154533055023105 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Denis Shienkov ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef TST_BLACKBOXBAREMETAL_H #define TST_BLACKBOXBAREMETAL_H #include "tst_blackboxbase.h" class TestBlackboxBareMetal : public TestBlackboxBase { Q_OBJECT public: TestBlackboxBareMetal(); private slots: void targetPlatform(); void application_data(); void application(); void staticLibraryDependencies(); void externalStaticLibraries(); void sharedLibraries(); void userIncludePaths(); void systemIncludePaths(); void distributionIncludePaths(); void compilerIncludePaths(); void preincludeHeaders(); void defines(); void compilerListingFiles_data(); void compilerListingFiles(); void linkerMapFile_data(); void linkerMapFile(); void compilerDefinesByLanguage(); void toolchainProbe(); private: }; #endif // TST_BLACKBOXBAREMETAL_H qbs-src-3.2.0/tests/auto/blackbox/tst_blackboxexamples.h0000644000175100017510000000363015154533055022772 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef TST_BLACKBOXEXAMPLES_H #define TST_BLACKBOXEXAMPLES_H #include "tst_blackboxbase.h" class TestBlackboxExamples : public TestBlackboxBase { Q_OBJECT private: QStringList collectExamples(const QString &dirPath); public: TestBlackboxExamples(); private slots: void baremetal_data(); void baremetal(); void examples_data(); void examples(); }; #endif // TST_BLACKBOXEXAMPLES_H qbs-src-3.2.0/tests/auto/api/0000755000175100017510000000000015154533055015365 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/CMakeLists.txt0000644000175100017510000000044215154533055020125 0ustar runnerrunneradd_qbs_test(api DEFINES "QBS_RELATIVE_LIBEXEC_PATH=\"${QBS_RELATIVE_LIBEXEC_PATH}\"" "QBS_RELATIVE_SEARCH_PATH=\"${QBS_RELATIVE_SEARCH_PATH}\"" "QBS_RELATIVE_PLUGINS_PATH=\"${QBS_RELATIVE_PLUGINS_PATH}\"" SOURCES tst_api.cpp tst_api.h ) qbs-src-3.2.0/tests/auto/api/api.qbs0000644000175100017510000000114415154533055016645 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { testName: "api" files: ["../shared.h", "tst_api.h", "tst_api.cpp"] cpp.defines: base.concat([ "SRCDIR=" + Utilities.cStringQuote(path), "QBS_RELATIVE_LIBEXEC_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativeLibexecPath), "QBS_RELATIVE_SEARCH_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativeSearchPath), "QBS_RELATIVE_PLUGINS_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativePluginsPath) ]) Group { name: "testdata" prefix: "testdata/" files: ["**/*"] fileTags: [] } } qbs-src-3.2.0/tests/auto/api/testdata/0000755000175100017510000000000015154533055017176 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/timeout-process/0000755000175100017510000000000015154533055022340 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/timeout-process/main.cpp0000644000175100017510000000255715154533055024001 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Jochen Ulrich ** 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 #include int main() { std::this_thread::sleep_for(std::chrono::seconds(700)); return 0; } qbs-src-3.2.0/tests/auto/api/testdata/timeout-process/timeout.qbs0000644000175100017510000000254315154533055024541 0ustar runnerrunnerimport qbs.Host Project { CppApplication { type: "application" consoleApplication: true // suppress bundle generation files: "main.cpp" name: "infinite-loop" cpp.cxxLanguageVersion: "c++11" cpp.minimumOsxVersion: "10.8" // For Properties { condition: qbs.toolchain.includes("gcc") cpp.driverFlags: "-pthread" } } Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } type: "product-under-test" name: "caller" Depends { name: "infinite-loop" } Depends { name: "cpp" // Make sure build environment is set up properly. condition: Host.os().includes("windows") && qbs.toolchain.includes("gcc") } Rule { inputsFromDependencies: "application" outputFileTags: "product-under-test" prepare: { var cmd = new Command(inputs["application"][0].filePath); cmd.description = "calling application that runs forever"; cmd.timeout = 3; return cmd; } } } } qbs-src-3.2.0/tests/auto/api/testdata/precompiled-header-dynamic/0000755000175100017510000000000015154533055024351 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/precompiled-header-dynamic/main.cpp0000644000175100017510000000236315154533055026005 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { f(); } qbs-src-3.2.0/tests/auto/api/testdata/precompiled-header-dynamic/autogen.h.in0000644000175100017510000000012715154533055026571 0ustar runnerrunner#ifndef AUTOGEN_IN_H #define AUTOGEN_IN_H inline void f() { } #endif // AUTOGEN_IN_H qbs-src-3.2.0/tests/auto/api/testdata/precompiled-header-dynamic/precompiled-header-dynamic.qbs0000644000175100017510000000142515154533055032235 0ustar runnerrunnerimport qbs.File CppApplication { name: "MyApp" consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } cpp.includePaths: [product.buildDirectory] Group { files: ["pch.h"] fileTags: ["cpp_pch_src"] } Group { files: ["autogen.h.in"] fileTags: ["hpp.in"] } files: ["main.cpp"] Rule { inputs: ["hpp.in"] Artifact { filePath: "autogen.h" fileTags: ["hpp"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return [cmd]; } } } qbs-src-3.2.0/tests/auto/api/testdata/precompiled-header-dynamic/pch.h0000644000175100017510000000236015154533055025275 0ustar runnerrunner/**************************************************************************** ** ** 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 "autogen.h" qbs-src-3.2.0/tests/auto/api/testdata/buildgraph-locking/0000755000175100017510000000000015154533055022743 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/buildgraph-locking/buildgraph-locking.qbs0000644000175100017510000000001415154533055027212 0ustar runnerrunnerProject { } qbs-src-3.2.0/tests/auto/api/testdata/moc-cpp/0000755000175100017510000000000015154533055020534 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/moc-cpp/bla.cpp0000644000175100017510000000254615154533055022005 0ustar runnerrunner/**************************************************************************** ** ** 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 class MyObject : public QObject { Q_OBJECT }; int main() { MyObject obj; return 0; } #include "bla.moc" qbs-src-3.2.0/tests/auto/api/testdata/moc-cpp/moc-cpp.qbs0000644000175100017510000000044715154533055022606 0ustar runnerrunnerProject { Product { type: "application" consoleApplication: true name: "moc_cpp" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: "Qt.core" } files: ["bla.cpp"] } } qbs-src-3.2.0/tests/auto/api/testdata/remove-file-dependency/0000755000175100017510000000000015154533055023524 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/remove-file-dependency/someheader.h0000644000175100017510000000240315154533055026010 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ inline int magicValue() { return 156; } qbs-src-3.2.0/tests/auto/api/testdata/remove-file-dependency/main.cpp0000644000175100017510000000253715154533055025163 0ustar runnerrunner/**************************************************************************** ** ** 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 "someheader.h" #include int main() { std::printf("The magic value is %d.\n", magicValue()); return 0; } qbs-src-3.2.0/tests/auto/api/testdata/remove-file-dependency/removeFileDependency.qbs0000644000175100017510000000020215154533055030321 0ustar runnerrunnerCppApplication { files: ["main.cpp"] // Do not reference header files here to force them to be FileDependency objects. } qbs-src-3.2.0/tests/auto/api/testdata/no-asserts-in-relaxed-mode/0000755000175100017510000000000015154533055024244 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/no-asserts-in-relaxed-mode/no-asserts-in-relaxed-mode.qbs0000644000175100017510000000024515154533055032022 0ustar runnerrunnerProject { Product { name: "p" Depends { name: "dep" } } Product { name: "dep" property bool p: { throw "oops"; } } } qbs-src-3.2.0/tests/auto/api/testdata/moc-hpp-included/0000755000175100017510000000000015154533055022326 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/moc-hpp-included/object2.mm0000644000175100017510000000031515154533055024210 0ustar runnerrunner#include "object2.h" Object2::Object2(QObject *parent) : QObject(parent) {} #include "moc_object2.cpp" #include int main2() { Object2 obj; printf("Hello World\n"); return 0; } qbs-src-3.2.0/tests/auto/api/testdata/moc-hpp-included/object.cpp0000644000175100017510000000263115154533055024302 0ustar runnerrunner/**************************************************************************** ** ** 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 "object.h" Object::Object(QObject *parent) : QObject(parent) {} #include "moc_object.cpp" #include int main() { Object obj; std::printf("Hello World\n"); } qbs-src-3.2.0/tests/auto/api/testdata/moc-hpp-included/object.h0000644000175100017510000000257115154533055023752 0ustar runnerrunner/**************************************************************************** ** ** 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 OBJECT_H #define OBJECT_H #include class Object : public QObject { Q_OBJECT public: Object(QObject *parent = nullptr); }; #endif qbs-src-3.2.0/tests/auto/api/testdata/moc-hpp-included/object2.h0000644000175100017510000000257515154533055024040 0ustar runnerrunner/**************************************************************************** ** ** 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 OBJECT2_H #define OBJECT2_H #include class Object2 : public QObject { Q_OBJECT public: Object2(QObject *parent = nullptr); }; #endif qbs-src-3.2.0/tests/auto/api/testdata/moc-hpp-included/moc-hpp-included.qbs0000644000175100017510000000072715154533055026173 0ustar runnerrunnerProject { Product { type: "application" consoleApplication: true name: "moc_hpp_included" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: "Qt.core" } cpp.cxxLanguageVersion: "c++11" files: ["object.cpp", "object.h"] Group { condition: qbs.targetOS.includes("darwin") files: ["object2.mm", "object2.h"] } } } qbs-src-3.2.0/tests/auto/api/testdata/transformers/0000755000175100017510000000000015154533055021723 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/transformers/transformers.qbs0000644000175100017510000000561015154533055025161 0ustar runnerrunnerimport qbs.File import qbs.TextFile import qbs.Xml import qbs.FileInfo Project { Product { name: "HelloWorld" type: "application" consoleApplication: true Group { files: ["main.cpp"] fileTags: ["main"] } Depends { name: "cpp" } Rule { // no inputs -> just a generator multiplex: true Artifact { filePath: "foo.txt" fileTags: "text" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating foo.txt"; cmd.highlight = "linker"; cmd.sourceCode = function () { File.remove(output.filePath); var f = new TextFile(output.filePath, TextFile.WriteOnly); f.write("Dear Sir/Madam,\n\n"); f.write("this is a generated file.\n\n\n"); f.write("Best Regards and Mellow Greetings,\nYour Build Tool.\n"); f.close(); } return cmd; } } Rule { multiplex: true // no inputs -> just a generator Artifact { filePath: "foo.xml" fileTags: "xml" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating foo.xml"; cmd.highlight = "linker"; cmd.sourceCode = function () { File.remove(output.filePath); var doc = new Xml.DomDocument(); var root = doc.createElement("root"); doc.appendChild(root); var tag = doc.createElement("Greeting"); root.appendChild(tag); tag.appendChild(doc.createTextNode("text node")); doc.save(output.filePath); } return cmd; } } Rule { inputs: ["main"] Artifact { filePath: "bar.txt" fileTags: "text" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating bar.txt"; cmd.highlight = "linker"; cmd.inputFileName = input.filePath; cmd.sourceCode = function() { File.remove(output.filePath); var f = new TextFile(output.filePath, TextFile.WriteOnly); f.write("Dear Sir/Madam,\n\n"); f.write("this file was generated from " + inputFileName + ".\n\n\n"); f.write("Best Regards and Mellow Greetings,\nYour Build Tool.\n"); f.close(); } return cmd; } } } } qbs-src-3.2.0/tests/auto/api/testdata/transformers/main.cpp0000644000175100017510000000437315154533055023362 0ustar runnerrunner/**************************************************************************** ** ** 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 #include #include using namespace std; bool displayTextFile(const string &dirPath, const string &fileName) { string fullPath = dirPath + fileName; ifstream istream(fullPath.c_str()); if (!istream.is_open()) { cout << "Cannot open " << fileName << endl; return false; } cout << "---" << fileName << "---" << endl; char buf[256]; unsigned int i = 1; while (istream.good()) { istream.getline(buf, sizeof(buf)); cout << i++ << ": " << buf << endl; } return true; } int main(int, char **argv) { string appPath(argv[0]); size_t i = appPath.find_last_of('/'); if (i == string::npos) i = appPath.find_last_of('\\'); if (i == string::npos) // No path, plain executable was called appPath.clear(); else appPath.resize(i + 1); if (!displayTextFile(appPath, "foo.txt")) return 1; if (!displayTextFile(appPath, "bar.txt")) return 2; cout << "-------------" << endl; return 0; } qbs-src-3.2.0/tests/auto/api/testdata/export-simple/0000755000175100017510000000000015154533055022006 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/export-simple/main.cpp0000644000175100017510000000257015154533055023442 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" #include DLL_IMPORT int lib1_hello(); int main() { std::puts("application says hello!"); return lib1_hello(); } qbs-src-3.2.0/tests/auto/api/testdata/export-simple/export-simple.qbs0000644000175100017510000000172715154533055025334 0ustar runnerrunnerProject { Application { name : "HelloWorld" Group { files : [ "main.cpp" ] } Depends { name: "cpp" } Depends { name: 'dummy' } } Product { name: 'dummy' Group { files: 'main.cpp' qbs.install: true } Export { Depends { name: 'dummy2' } Properties { // QBS-550 condition: false qbs.optimization: "ludicrous speed" } } } Product { name: 'dummy2' Group { files: 'lib1.cpp' qbs.install: true } Export { Depends { name: 'lib1' } } } DynamicLibrary { name : "lib1" Group { files : [ "lib1.cpp" ] } Depends { name: "cpp" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } } qbs-src-3.2.0/tests/auto/api/testdata/export-simple/lib1.cpp0000644000175100017510000000253115154533055023342 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" #include DLL_EXPORT int lib1_hello() { std::puts("lib1 says hello!"); return 0; } qbs-src-3.2.0/tests/auto/api/testdata/rc/0000755000175100017510000000000015154533055017602 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/rc/main.cpp0000644000175100017510000000237015154533055021234 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/api/testdata/rc/rc.qbs0000644000175100017510000000032015154533055020710 0ustar runnerrunnerApplication { type: "application" consoleApplication: true name: "rctest" Depends { name: 'cpp' } cpp.includePaths: "subdir" files: [ "main.cpp", "test.rc" ] } qbs-src-3.2.0/tests/auto/api/testdata/rc/subdir/0000755000175100017510000000000015154533055021072 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/rc/subdir/rc-include.h0000644000175100017510000000000015154533055023256 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/rc/test.rc0000644000175100017510000000062115154533055021106 0ustar runnerrunner#define IDR_VERSION1 1 #include IDR_VERSION1 VERSIONINFO FILEVERSION 1,0,0,0 PRODUCTVERSION 1,0,0,0 FILEOS 0x00000004 FILETYPE 0x00000000 BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "FFFF0000" BEGIN VALUE "FileVersion", "1.0.0.0\0" VALUE "ProductVersion", "1.0.0.0\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0xFFFF, 0x0000 END END qbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-process/0000755000175100017510000000000015154533055023426 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-process/main.cpp0000644000175100017510000000251315154533055025057 0ustar runnerrunner/**************************************************************************** ** ** 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 #include int main() { std::this_thread::sleep_for(std::chrono::seconds(700)); } qbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-process/infinite-loop.qbs0000644000175100017510000000173715154533055026721 0ustar runnerrunnerimport qbs.Host Project { CppApplication { type: "application" consoleApplication: true // suppress bundle generation files: "main.cpp" name: "infinite-loop" cpp.cxxLanguageVersion: "c++11" Properties { condition: qbs.toolchain.includes("gcc") cpp.driverFlags: "-pthread" } } Product { type: "mytype" name: "caller" Depends { name: "infinite-loop" } Depends { name: "cpp" // Make sure build environment is set up properly. condition: Host.os().includes("windows") && qbs.toolchain.includes("gcc") } Rule { inputsFromDependencies: "application" outputFileTags: "mytype" prepare: { var cmd = new Command(inputs["application"][0].filePath); cmd.description = "calling application that runs forever"; return cmd; } } } } qbs-src-3.2.0/tests/auto/api/testdata/references/0000755000175100017510000000000015154533055021317 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/references/valid.qbs0000644000175100017510000000006615154533055023127 0ustar runnerrunnerProject { references: "subdir-with-one-project" } qbs-src-3.2.0/tests/auto/api/testdata/references/subdir-with-one-project/0000755000175100017510000000000015154533055026003 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/references/subdir-with-one-project/test.txt0000644000175100017510000000000015154533055027511 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/references/subdir-with-one-project/p.qbs0000644000175100017510000000001415154533055026744 0ustar runnerrunnerProject { } qbs-src-3.2.0/tests/auto/api/testdata/references/invalid1.qbs0000644000175100017510000000006415154533055023535 0ustar runnerrunnerProject { references: "subdir-with-no-project" }qbs-src-3.2.0/tests/auto/api/testdata/references/subdir-with-no-project/0000755000175100017510000000000015154533055025636 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/references/subdir-with-no-project/test.txt0000644000175100017510000000000015154533055027344 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/references/invalid2.qbs0000644000175100017510000000007315154533055023536 0ustar runnerrunnerProject { references: "subdir-with-multiple-projects" }qbs-src-3.2.0/tests/auto/api/testdata/references/subdir-with-multiple-projects/0000755000175100017510000000000015154533055027240 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/references/subdir-with-multiple-projects/subproject3.qbs0000644000175100017510000000000015154533055032200 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/references/subdir-with-multiple-projects/subproject1.qbs0000644000175100017510000000000015154533055032176 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/references/subdir-with-multiple-projects/subproject2.qbs0000644000175100017510000000000015154533055032177 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/empty-filetag-list/0000755000175100017510000000000015154533055022716 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/empty-filetag-list/dontcompilethis.cpp0000644000175100017510000000002115154533055026620 0ustar runnerrunnerThis is not C++. qbs-src-3.2.0/tests/auto/api/testdata/empty-filetag-list/empty-filetag-list.qbs0000644000175100017510000000013715154533055027146 0ustar runnerrunnerCppApplication { Group { files: "dontcompilethis.cpp" fileTags: [] } } qbs-src-3.2.0/tests/auto/api/testdata/error-in-setup-run-environment/0000755000175100017510000000000015154533055025235 5ustar runnerrunner././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootqbs-src-3.2.0/tests/auto/api/testdata/error-in-setup-run-environment/error-in-setup-run-environment.qbsqbs-src-3.2.0/tests/auto/api/testdata/error-in-setup-run-environment/error-in-setup-run-environment.0000644000175100017510000000006415154533055033275 0ustar runnerrunnerCppApplication { Depends { name: "mymodule" } } qbs-src-3.2.0/tests/auto/api/testdata/error-in-setup-run-environment/modules/0000755000175100017510000000000015154533055026705 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/error-in-setup-run-environment/modules/mymodule/0000755000175100017510000000000015154533055030540 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/error-in-setup-run-environment/modules/mymodule/mymodule.qbs0000644000175100017510000000007515154533055033104 0ustar runnerrunnerModule { setupRunEnvironment: { trallala } } qbs-src-3.2.0/tests/auto/api/testdata/add-qobject-macro-to-cpp-file/0000755000175100017510000000000015154533055024567 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/add-qobject-macro-to-cpp-file/main.cpp0000644000175100017510000000243015154533055026216 0ustar runnerrunner/**************************************************************************** ** ** 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 "object.h" int main() { Object o; o.f(); } qbs-src-3.2.0/tests/auto/api/testdata/add-qobject-macro-to-cpp-file/object.cpp0000644000175100017510000000256715154533055026553 0ustar runnerrunner/**************************************************************************** ** ** 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 "object.h" #include // class InternalClass : public QObject // { // Q_OBJECT // }; void Object::f() { } // #include "object.moc" qbs-src-3.2.0/tests/auto/api/testdata/add-qobject-macro-to-cpp-file/object.h0000644000175100017510000000240315154533055026205 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ class Object { public: void f(); }; ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/api/testdata/add-qobject-macro-to-cpp-file/add-qobject-macro-to-cpp-file.qbsqbs-src-3.2.0/tests/auto/api/testdata/add-qobject-macro-to-cpp-file/add-qobject-macro-to-cpp-file.qb0000644000175100017510000000010515154533055032500 0ustar runnerrunnerQtApplication { files: ["main.cpp", "object.h", "object.cpp"] } qbs-src-3.2.0/tests/auto/api/testdata/relaxed-mode-recovery/0000755000175100017510000000000015154533055023400 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/relaxed-mode-recovery/relaxed-mode-recovery.qbs0000644000175100017510000000031115154533055030304 0ustar runnerrunnerProject { Product { name: "dep" Export { Depends { name: "blubb" } } } Product { name: "p1"; Depends { name: "dep" } } Product { name: "p2"; Depends { name: "dep" } } } qbs-src-3.2.0/tests/auto/api/testdata/productNameWithDots/0000755000175100017510000000000015154533055023145 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/productNameWithDots/productNameWithDots.qbs0000644000175100017510000000055715154533055027632 0ustar runnerrunnerProject { CppApplication { name: "myapp" consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: "foo.bar.bla" } files: ["app.cpp"] } StaticLibrary { Depends { name: "cpp" } name: "foo.bar.bla" files: ["lib.cpp"] } } qbs-src-3.2.0/tests/auto/api/testdata/productNameWithDots/app.cpp0000644000175100017510000000236415154533055024436 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/api/testdata/productNameWithDots/lib.cpp0000644000175100017510000000235115154533055024420 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void foo() {} qbs-src-3.2.0/tests/auto/api/testdata/link-static-lib/0000755000175100017510000000000015154533055022164 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/link-static-lib/helper1/0000755000175100017510000000000015154533055023524 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/link-static-lib/helper1/helper1.h0000644000175100017510000000244415154533055025241 0ustar runnerrunner/**************************************************************************** ** ** 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 HELPER1_H #define HELPER1_H extern int getSomeNumber(); #endif qbs-src-3.2.0/tests/auto/api/testdata/link-static-lib/helper1/helper1.cpp0000644000175100017510000000247615154533055025601 0ustar runnerrunner/**************************************************************************** ** ** 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 "helper1.h" #include int getSomeNumber() { return 12 * getOddNumber(); } qbs-src-3.2.0/tests/auto/api/testdata/link-static-lib/main.cpp0000644000175100017510000000243415154533055023617 0ustar runnerrunner/**************************************************************************** ** ** 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 int bla(); int main() { return bla(); } qbs-src-3.2.0/tests/auto/api/testdata/link-static-lib/mystaticlib.cpp0000644000175100017510000000257115154533055025221 0ustar runnerrunner/**************************************************************************** ** ** 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 #include int bla() { int n = getSomeNumber(); std::printf("Hello World! The magic number is %d.", n); return n; } qbs-src-3.2.0/tests/auto/api/testdata/link-static-lib/helper2/0000755000175100017510000000000015154533055023525 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/link-static-lib/helper2/helper2.h0000644000175100017510000000244315154533055025242 0ustar runnerrunner/**************************************************************************** ** ** 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 HELPER2_H #define HELPER2_H extern int getOddNumber(); #endif qbs-src-3.2.0/tests/auto/api/testdata/link-static-lib/helper2/helper2.cpp0000644000175100017510000000242715154533055025577 0ustar runnerrunner/**************************************************************************** ** ** 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 "helper2.h" int getOddNumber() { return 13; } qbs-src-3.2.0/tests/auto/api/testdata/link-static-lib/link-static-lib.qbs0000644000175100017510000000220315154533055025656 0ustar runnerrunnerProject { Product { type: "application" consoleApplication: true name: "HelloWorld" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } files : [ "main.cpp" ] Depends { name: "cpp" } Depends { name: "mystaticlib" } } StaticLibrary { name : "mystaticlib" files : [ "mystaticlib.cpp" ] Depends { name: "cpp" } Depends { name: "helper1" } } StaticLibrary { name : "helper1" files : [ "helper1/helper1.h", "helper1/helper1.cpp" ] Depends { name: "cpp" } Depends { name: "helper2" } Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory + '/helper1'] } } StaticLibrary { name : "helper2" files : [ "helper2/helper2.h", "helper2/helper2.cpp" ] Depends { name: "cpp" } Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory + '/helper2'] } } } qbs-src-3.2.0/tests/auto/api/testdata/link-static-lib/mystaticlibhelper.cpp0000644000175100017510000000240615154533055026416 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int helper_function() { return 156; } qbs-src-3.2.0/tests/auto/api/testdata/project-invalidation/0000755000175100017510000000000015154533055023323 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-invalidation/project.late-error.qbs0000644000175100017510000000027215154533055027554 0ustar runnerrunnerProduct { type: "mytype" Rule { inputs: ["mytype"] Artifact { filePath: "blubb" fileTags: "mytype" } prepare: [] } } qbs-src-3.2.0/tests/auto/api/testdata/project-invalidation/project.no-error.qbs0000644000175100017510000000003715154533055027242 0ustar runnerrunnerProduct { type: "mytype" } qbs-src-3.2.0/tests/auto/api/testdata/project-invalidation/project.early-error.qbs0000644000175100017510000000007315154533055027742 0ustar runnerrunnerProduct { type: "mytype" files: "nosuchfile.txt" } qbs-src-3.2.0/tests/auto/api/testdata/run-disabled-product/0000755000175100017510000000000015154533055023225 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/run-disabled-product/run-disabled-product.qbs0000644000175100017510000000007015154533055027760 0ustar runnerrunnerCppApplication { name: "app" condition: false } qbs-src-3.2.0/tests/auto/api/testdata/filetagsfilter_override/0000755000175100017510000000000015154533055024101 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/filetagsfilter_override/main.cpp0000644000175100017510000000235115154533055025532 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/api/testdata/filetagsfilter_override/InstalledApp.qbs0000644000175100017510000000027015154533055027167 0ustar runnerrunnerCppApplication { type: "application" consoleApplication: true Group { fileTagsFilter: product.type qbs.install: true qbs.installDir: "hurz" } } qbs-src-3.2.0/tests/auto/api/testdata/filetagsfilter_override/filetagsfilter_override.qbs0000644000175100017510000000034715154533055031517 0ustar runnerrunnerimport "InstalledApp.qbs" as InstalledApp InstalledApp { files: "main.cpp" config.install.install: false Group { fileTagsFilter: product.type qbs.install: true qbs.installDir: "habicht" } } qbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-js/0000755000175100017510000000000015154533055022364 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-js/infinite-loop.qbs0000644000175100017510000000065515154533055025655 0ustar runnerrunnerProduct { type: "mytype" Rule { multiplex: true Artifact { filePath: "output.txt" fileTags: "mytype" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "running infinite loop"; cmd.sourceCode = function() { while (true) ; } return cmd; } } } qbs-src-3.2.0/tests/auto/api/testdata/target-artifact-status/0000755000175100017510000000000015154533055023600 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/target-artifact-status/target-artifact-status.qbs0000644000175100017510000000141215154533055030707 0ustar runnerrunnerimport qbs.TextFile Product { name: "p" type: "p_type" property bool enableTagging Rule { multiplex: true Artifact { filePath: "a1"; fileTags: "p_type" } Artifact { filePath: "a2"; fileTags: "x" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating outputs"; cmd.sourceCode = function() { var f = new TextFile(outputs.p_type[0].filePath, TextFile.WriteOnly); f.close(); f = new TextFile(outputs.x[0].filePath, TextFile.WriteOnly); f.close(); }; return cmd; } } Group { condition: enableTagging fileTagsFilter: "x" fileTags: "p_type" } } qbs-src-3.2.0/tests/auto/api/testdata/QBS-728/0000755000175100017510000000000015154533055020141 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/QBS-728/QBS-728.qbs0000644000175100017510000000026215154533055021613 0ustar runnerrunnerProduct { property bool isBlubbOS: qbs.targetOS.includes("blubb-OS") qbs.profiles: isBlubbOS ? ["blubb-profile"] : [project.profile] qbs.architecture: "blubb-arch" } qbs-src-3.2.0/tests/auto/api/testdata/codegen/0000755000175100017510000000000015154533055020602 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/codegen/codegen.qbs0000644000175100017510000000537415154533055022726 0ustar runnerrunnerimport qbs.FileInfo Project { property string name: 'codegen' property string osSpecificName: name.toUpperCase() + '_' + qbs.targetPlatform.toUpperCase() Product { type: 'application' consoleApplication: true name: project.name property var replacements: ({ NUMBERTYPE: "int", STRINGTYPE: "char **", FUNCTIONNAME: "main" }) property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Group { files: 'foo.txt' fileTags: ['text'] } Depends { name: 'cpp' } Depends { name: 'Qt.core' } } Rule { inputs: ['text'] Artifact { fileTags: ['cpp'] filePath: input.baseName + '.cpp' } prepare: { function expandMacros(str, table) { var rex = /\$\w+/; var m = rex.exec(str); while (m != null) { str = str.substr(0, m.index) + table[m[0].substr(1)] + str.substr(m.index + m[0].length); m = rex.exec(str); } return str; } // check whether multipart module name translation is working var actual = product.moduleProperty("Qt.core", "mocName"); if (!actual || !actual.includes("moc")) throw "multipart module name translation is broken"; // check whether we can access project properties here var expected = "CODEGEN_" + product.moduleProperty("qbs", "targetPlatform").toUpperCase(); if (project.osSpecificName !== expected) throw "Wrong project property value: " + project.osSpecificName + "\nexpected: " + expected; var code = '$NUMBERTYPE $FUNCTIONNAME($NUMBERTYPE, $STRINGTYPE) { return 0; }'; code = expandMacros(code, product.replacements); var args = ['echo ' + code + '>' + output.filePath] var cmd if (product.moduleProperty("qbs", "hostOS").includes('windows')) { cmd = new Command(product.qbs.windowsShellPath, ['/C'].concat(args)); } else { args[0] = args[0].replace(/\(/g, '\\(') args[0] = args[0].replace(/\)/g, '\\)') args[0] = args[0].replace(/;/g, '\\;') cmd = new Command(product.qbs.shellPath, ['-c'].concat(args)) } cmd.description = 'generating ' + FileInfo.fileName(output.filePath); cmd.highlight = 'codegen'; return cmd; } } } qbs-src-3.2.0/tests/auto/api/testdata/codegen/foo.txt0000644000175100017510000000001415154533055022121 0ustar runnerrunnerHello World qbs-src-3.2.0/tests/auto/api/testdata/properties-blocks/0000755000175100017510000000000015154533055022645 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/properties-blocks/main.cpp0000644000175100017510000000301715154533055024276 0ustar runnerrunner/**************************************************************************** ** ** 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 #ifndef HAVE_MAIN_CPP # error missing define HAVE_MAIN_CPP #endif #ifndef DEFINE_IN_PROPERTIES # error missing define DEFINE_IN_PROPERTIES #endif int main() { #ifdef _DEBUG std::puts("Hello World! (debug version)"); #else std::puts("Hello World! (release version)"); #endif } qbs-src-3.2.0/tests/auto/api/testdata/properties-blocks/properties-blocks.qbs0000644000175100017510000000100515154533055027017 0ustar runnerrunnerProduct { Depends { name: 'cpp' } Properties { type: 'application' consoleApplication: true name: 'HelloWorld' } Properties { condition: name == 'HelloWorld' cpp.defines: ['DEFINE_IN_PROPERTIES'] } Properties { condition: qbs.targetOS.includes("weird") cpp.staticLibraries: "abc" } Group { cpp.defines: outer.concat(['HAVE_MAIN_CPP', cpp.debugInformation ? '_DEBUG' : '_RELEASE']) files: ['main.cpp'] } } qbs-src-3.2.0/tests/auto/api/testdata/objc/0000755000175100017510000000000015154533055020113 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/objc/main.mm0000644000175100017510000000072015154533055021371 0ustar runnerrunner#import #include int main(int argc, char **argv) { // We support both C++ std::cout << "Hello from C++" << std::endl; // And Objective-C NSDictionary *version = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]; NSString *productVersion = [version objectForKey:@"ProductVersion"]; NSLog(@"Hello, macOS %@!", productVersion); // So it's Objective-C++ } qbs-src-3.2.0/tests/auto/api/testdata/objc/objc.qbs0000644000175100017510000000023315154533055021535 0ustar runnerrunnerProject { CppApplication { condition: qbs.targetOS.includes("macos") files: "main.mm" cpp.frameworks: [ "Foundation" ] } } qbs-src-3.2.0/tests/auto/api/testdata/added-file-persistent/0000755000175100017510000000000015154533055023352 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/added-file-persistent/main.cpp0000644000175100017510000000237215154533055025006 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void f(); int main() { f(); } qbs-src-3.2.0/tests/auto/api/testdata/added-file-persistent/file.cpp0000644000175100017510000000235015154533055024775 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void f() { } qbs-src-3.2.0/tests/auto/api/testdata/added-file-persistent/added-file-persistent.qbs0000644000175100017510000000012315154533055030231 0ustar runnerrunnerCppApplication { files: [ 'main.cpp', /* 'file.cpp' */ ] } qbs-src-3.2.0/tests/auto/api/testdata/two-default-property-values/0000755000175100017510000000000015154533055024610 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/two-default-property-values/test.txt0000644000175100017510000000000015154533055026316 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/two-default-property-values/two-default-property-values.qbs0000644000175100017510000000036515154533055032735 0ustar runnerrunnerProduct { name: "two-default-property-values" type: "mymodule" Depends { name: "mymodule" } Depends { name: "myothermodule" } mymodule.direct: "dummy" Group { files: ["test.txt"] fileTags: ["txt"] } } qbs-src-3.2.0/tests/auto/api/testdata/two-default-property-values/modules/0000755000175100017510000000000015154533055026260 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/two-default-property-values/modules/mymodule/0000755000175100017510000000000015154533055030113 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/two-default-property-values/modules/mymodule/mymodule.qbs0000644000175100017510000000114315154533055032454 0ustar runnerrunnerimport qbs.TextFile Module { property string direct property string indirect: direct ? "set" : "unset" Rule { inputs: ["txt"] Artifact { filePath: product.moduleProperty("mymodule", "indirect") fileTags: ["mymodule"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/api/testdata/two-default-property-values/modules/myothermodule/0000755000175100017510000000000015154533055031155 5ustar runnerrunner././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootqbs-src-3.2.0/tests/auto/api/testdata/two-default-property-values/modules/myothermodule/myothermodule.qbsqbs-src-3.2.0/tests/auto/api/testdata/two-default-property-values/modules/myothermodule/myothermodul0000644000175100017510000000005415154533055033627 0ustar runnerrunnerModule { Depends { name: "mymodule" } } qbs-src-3.2.0/tests/auto/api/testdata/command-extraction/0000755000175100017510000000000015154533055022772 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/command-extraction/main.cpp0000644000175100017510000000235115154533055024423 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/api/testdata/command-extraction/command-extraction.qbs0000644000175100017510000000005115154533055027271 0ustar runnerrunnerCppApplication { files: "main.cpp" } qbs-src-3.2.0/tests/auto/api/testdata/project-with-probe-and-profile-item/0000755000175100017510000000000015154533055026054 5ustar runnerrunner././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/api/testdata/project-with-probe-and-profile-item/project-with-probe-and-profile-item.qbsqbs-src-3.2.0/tests/auto/api/testdata/project-with-probe-and-profile-item/project-with-probe-and-pro0000644000175100017510000000051715154533055033064 0ustar runnerrunnerProject { property bool probesEvaluated: probe.found Probe { id: probe configure: { found = true; } } Profile { name: "the-profile" cpp.includePaths: { if (!probesEvaluated) throw "project-level probes not evaluated"; } } } qbs-src-3.2.0/tests/auto/api/testdata/disabled-product/0000755000175100017510000000000015154533055022423 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/disabled-product/main.cpp0000644000175100017510000000002315154533055024046 0ustar runnerrunnerthiswillnotcompile qbs-src-3.2.0/tests/auto/api/testdata/disabled-product/disabled-product.qbs0000644000175100017510000000023515154533055026357 0ustar runnerrunnerCppApplication { condition: false files: "main.cpp" Group { condition: qbs.targetOS.includes("stuff") qbs.install: false } } qbs-src-3.2.0/tests/auto/api/testdata/missing-source-file/0000755000175100017510000000000015154533055023062 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/missing-source-file/file3.txt0000644000175100017510000000000015154533055024613 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/missing-source-file/missing-source-file.qbs0000644000175100017510000000013615154533055027455 0ustar runnerrunnerProduct { files: [ "file1.txt", "file2.txt", "file3.txt", ] } qbs-src-3.2.0/tests/auto/api/testdata/missing-source-file/file2.txt.missing0000644000175100017510000000000015154533055026262 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/missing-source-file/file1.txt0000644000175100017510000000000015154533055024611 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/new-pattern-match/0000755000175100017510000000000015154533055022534 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/new-pattern-match/new-pattern-match.qbs0000644000175100017510000000003715154533055026601 0ustar runnerrunnerProduct { files: "*.txt" } qbs-src-3.2.0/tests/auto/api/testdata/lib-same-source/0000755000175100017510000000000015154533055022165 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/lib-same-source/main.cpp0000644000175100017510000000243415154533055023620 0ustar runnerrunner/**************************************************************************** ** ** 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 int main() { std::puts("Hello WOrld!"); } qbs-src-3.2.0/tests/auto/api/testdata/lib-same-source/lib-same-source.qbs0000644000175100017510000000074615154533055025672 0ustar runnerrunnerProject { Product { type: "application" consoleApplication: true name : "HelloWorldApp" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: 'cpp' } Group { files : [ "main.cpp" ] } } Product { type: "staticlibrary" name : "HelloWorldLib" Depends { name: 'cpp' } Group { files : [ "main.cpp" ] } } } qbs-src-3.2.0/tests/auto/api/testdata/local-profiles/0000755000175100017510000000000015154533055022111 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/local-profiles/local-profiles.qbs0000644000175100017510000000236715154533055025543 0ustar runnerrunnerProject { property string windowsProfile: "windowsProfile" property bool enableProfiles property string mingwToolchain: "mingw" property string mingwProfile: "mingwProfile" Profile { name: windowsProfile qbs.targetPlatform: "windows" } Profile { name: project.mingwProfile condition: enableProfiles baseProfile: project.windowsProfile qbs.toolchainType: project.mingwToolchain } Application { name: "app" Depends { name: "cpp"; required: false } aggregate: false multiplexByQbsProperties: ["buildVariants"] qbs.buildVariants: ["debug", "release"] qbs.profile: project.mingwProfile } Library { type: "dynamiclibrary" name: "lib" Depends { name: "cpp"; required: false } property string clangToolchain: "clang" property string clangProfileName: "clangProfile" Profile { name: product.clangProfileName condition: project.enableProfiles qbs.targetPlatform: "linux" qbs.toolchainType: product.clangToolchain } multiplexByQbsProperties: ["profiles"] qbs.profiles: [project.mingwProfile, "clangProfile"] } } qbs-src-3.2.0/tests/auto/api/testdata/build-error-code-location/0000755000175100017510000000000015154533055024142 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/build-error-code-location/build-error-code-location.qbs0000644000175100017510000000025215154533055031614 0ustar runnerrunnerProduct { name: "p" type: ["p.out"] Rule { multiplex: true outputFileTags: ["p.out"] outputArtifacts: { } prepare: {} } } qbs-src-3.2.0/tests/auto/api/testdata/buildgraph-info/0000755000175100017510000000000015154533055022250 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/buildgraph-info/buildgraph-info.qbs0000644000175100017510000000005315154533055026027 0ustar runnerrunnerProduct { qbs.shellPath: "/bin/bash" } qbs-src-3.2.0/tests/auto/api/testdata/project-locking/0000755000175100017510000000000015154533055022270 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-locking/project-locking.qbs0000644000175100017510000000001415154533055026064 0ustar runnerrunnerProject { } qbs-src-3.2.0/tests/auto/api/testdata/multi-arch/0000755000175100017510000000000015154533055021243 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/multi-arch/multi-arch.qbs0000644000175100017510000000273615154533055024027 0ustar runnerrunnerimport qbs.FileInfo import qbs.TextFile Project { property string hostProfile property string targetProfile Product { property stringList myProfiles name: "p1" type: "output" qbs.profiles: myProfiles ? myProfiles : [project.targetProfile, project.hostProfile] Group { files: "host+target.input" fileTags: "input" } qbs.installPrefix: "" Group { fileTagsFilter: "output" qbs.install: true qbs.installDir: qbs.profile } } Product { name: "p2" type: "output" qbs.profiles: [project.hostProfile] Group { files: "host-tool.input" fileTags: "input" } qbs.installPrefix: "" Group { fileTagsFilter: "output" qbs.install: true qbs.installDir: qbs.profile } } Rule { inputs: "input" Artifact { filePath: FileInfo.baseName(input.fileName) + ".output" fileTags: "output" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var file = new TextFile(output.filePath, TextFile.WriteOnly); file.write(product.moduleProperty("qbs", "architecture")); file.close(); } return cmd; } } } qbs-src-3.2.0/tests/auto/api/testdata/multi-arch/host-tool.input0000644000175100017510000000000015154533055024242 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/multi-arch/host+target.input0000644000175100017510000000000015154533055024551 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/build-properties-source/0000755000175100017510000000000015154533055023765 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/build-properties-source/main.cpp0000644000175100017510000000252515154533055025421 0ustar runnerrunner/**************************************************************************** ** ** 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 #ifndef WORLD # error WORLD is not defined #endif int main() { std::puts("Hello " WORLD "!"); } qbs-src-3.2.0/tests/auto/api/testdata/build-properties-source/build-properties-source.qbs0000644000175100017510000000054215154533055031264 0ustar runnerrunnerProject { Product { type: "application" consoleApplication: true name: "HelloWorld" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: 'cpp' } Group { cpp.defines: ['WORLD="BANANA"'] files : [ "main.cpp" ] } } } qbs-src-3.2.0/tests/auto/api/testdata/transformer-data/0000755000175100017510000000000015154533055022447 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/transformer-data/transformer-data.qbs0000644000175100017510000000163115154533055026430 0ustar runnerrunnerimport qbs.File import qbs.TextFile Product { type: ["theType"] Rule { multiplex: true Artifact { filePath: "artifact1" fileTags: ["type1"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); }; return [cmd]; } } Rule { inputs: ["type1"] Artifact { filePath: "artifact2" fileTags: ["theType"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/api/testdata/restored-warnings/0000755000175100017510000000000015154533055022653 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/restored-warnings/main.cpp0000644000175100017510000000001615154533055024300 0ustar runnerrunnerint main() {} qbs-src-3.2.0/tests/auto/api/testdata/restored-warnings/file.cpp0000644000175100017510000000001415154533055024271 0ustar runnerrunnervoid f() {} qbs-src-3.2.0/tests/auto/api/testdata/restored-warnings/restored-warnings.qbs0000644000175100017510000000071615154533055027043 0ustar runnerrunnerimport qbs.Process 1.5 Project { CppApplication { name: "theProduct" cpp.blubb: true files: ["file.cpp", "main.cpp"] } Product { name: "theOtherProduct" property bool dummy: { throw "this one comes from a thread"; } } Product { name: "aThirdProduct" property bool moreFiles: false Group { condition: moreFiles files: ["blubb.txt"] } } } qbs-src-3.2.0/tests/auto/api/testdata/dependency-on-multiplexed-type/0000755000175100017510000000000015154533055025237 5ustar runnerrunner././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootqbs-src-3.2.0/tests/auto/api/testdata/dependency-on-multiplexed-type/dependency-on-multiplexed-type.qbsqbs-src-3.2.0/tests/auto/api/testdata/dependency-on-multiplexed-type/dependency-on-multiplexed-type.0000644000175100017510000000053315154533055033302 0ustar runnerrunnerProject { Product { name: "dep"; type: "x" } Product { name: "p1" multiplexByQbsProperties: "architectures" qbs.architectures: ["a", "b"] aggregate: true Depends { productTypes: "x" } multiplexedType: "x" } Product { name: "p2" Depends { productTypes: "x" } } } qbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-scanning-scan/0000755000175100017510000000000015154533055024472 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-scanning-scan/file.in0000644000175100017510000000000015154533055025727 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-scanning-scan/infinite-loop.qbs0000644000175100017510000000063615154533055027762 0ustar runnerrunnerProduct { type: "t" Depends { name: "m" } Group { files: "file.in" fileTags: "i" } Rule { inputs: "i" Artifact { filePath: "dummy" fileTags: "t" } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() {}; return cmd; } } } qbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-scanning-scan/modules/0000755000175100017510000000000015154533055026142 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-scanning-scan/modules/m/0000755000175100017510000000000015154533055026376 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-scanning-scan/modules/m/m.qbs0000644000175100017510000000012215154533055027334 0ustar runnerrunnerModule { Scanner { inputs: "i" scan: { while (true); } } }qbs-src-3.2.0/tests/auto/api/testdata/projectd0000644000175100017510000000000015154533055020721 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-scanning-searchpaths/0000755000175100017510000000000015154533055026053 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-scanning-searchpaths/file.in0000644000175100017510000000000015154533055027310 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-scanning-searchpaths/infinite-loop.qbs0000644000175100017510000000063615154533055031343 0ustar runnerrunnerProduct { type: "t" Depends { name: "m" } Group { files: "file.in" fileTags: "i" } Rule { inputs: "i" Artifact { filePath: "dummy" fileTags: "t" } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() {}; return cmd; } } } qbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-scanning-searchpaths/modules/0000755000175100017510000000000015154533055027523 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-scanning-searchpaths/modules/m/0000755000175100017510000000000015154533055027757 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-scanning-searchpaths/modules/m/m.qbs0000644000175100017510000000015315154533055030721 0ustar runnerrunnerModule { Scanner { inputs: "i" searchPaths: { while (true); } scan: [] } } qbs-src-3.2.0/tests/auto/api/testdata/disabled-project/0000755000175100017510000000000015154533055022411 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/disabled-project/disabled-project.qbs0000644000175100017510000000015115154533055026330 0ustar runnerrunnerimport qbs.File Project { condition: File.exists("blubb"); references: "blubb/nosuchfile.qbs" } qbs-src-3.2.0/tests/auto/api/testdata/project-editing/0000755000175100017510000000000015154533055022265 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-editing/newfile1.txt0000644000175100017510000000000015154533055024526 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-editing/main.cpp0000644000175100017510000000233215154533055023715 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ qbs-src-3.2.0/tests/auto/api/testdata/project-editing/file.h0000644000175100017510000000233215154533055023355 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ qbs-src-3.2.0/tests/auto/api/testdata/project-editing/test.wildcard0000644000175100017510000000000015154533055024745 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-editing/existingfile1.txt0000644000175100017510000000000015154533055025567 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-editing/project-with-no-files.qbs0000644000175100017510000000007715154533055027131 0ustar runnerrunnerCppApplication { Group { files: "file.cpp" } } qbs-src-3.2.0/tests/auto/api/testdata/project-editing/existingfile3.txt0000644000175100017510000000000015154533055025571 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-editing/newfile4.txt0000644000175100017510000000000015154533055024531 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-editing/project-editing.qbs0000644000175100017510000000137015154533055026064 0ustar runnerrunnerCppApplication { Group { name: "Existing Group 1" files: ["existingfile1.txt"] } property string aFile: "existingfile2.txt" Group { name: "Existing Group 2" files: product.aFile } Group { name: "Existing Group 3" files: { var file = "existingfile3.txt"; return file; } } Group { name: "Existing Group 4" prefix: "subdir/" files: [] } Group { name: "Existing Group 5" prefix: "blubb" files: [] } Group { name: "Group with wildcards" files: "*.klaus" } Group { name: "Other group with wildcards" files: "*.wildcard" } files: "main.cpp" } qbs-src-3.2.0/tests/auto/api/testdata/project-editing/newfile2.txt0000644000175100017510000000000015154533055024527 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-editing/file.cpp0000644000175100017510000000233215154533055023710 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ qbs-src-3.2.0/tests/auto/api/testdata/project-editing/existingfile2.txt0000644000175100017510000000000015154533055025570 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-editing/newfile3.txt0000644000175100017510000000000015154533055024530 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-editing/subdir/0000755000175100017510000000000015154533055023555 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-editing/subdir/file.txt0000644000175100017510000000000015154533055025223 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-objectlibs/0000755000175100017510000000000015154533055024545 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-objectlibs/object1.cpp0000644000175100017510000000024515154533055026601 0ustar runnerrunner#include "../dllexport.h" #include DLL_IMPORT void dynamic2_hello(); void object1_hello() { dynamic2_hello(); std::puts("object1 says hello!"); } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-objectlibs/dynamic2.cpp0000644000175100017510000000025515154533055026761 0ustar runnerrunner#include "../dllexport.h" #include "object2.h" #include DLL_EXPORT void dynamic2_hello() { TestMe tm; tm.hello(); std::puts("dynamic2 says hello!"); } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-objectlibs/main.cpp0000644000175100017510000000027615154533055026202 0ustar runnerrunner#include "../dllexport.h" #include DLL_IMPORT int dynamic1_hello(); int main() { int result = dynamic1_hello(); std::puts("application says hello!"); return result; } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-objectlibs/dynamic1.cpp0000644000175100017510000000026315154533055026757 0ustar runnerrunner#include #include "../dllexport.h" void object1_hello(); DLL_EXPORT int dynamic1_hello() { object1_hello(); std::puts("dynamic1 says hello!"); return 0; } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-objectlibs/link-dynamiclibs-objectlibs.qbs0000644000175100017510000000254315154533055032627 0ustar runnerrunnerProject { Application { name : "HelloWorld" files : [ "main.cpp" ] Depends { name: "cpp" } Depends { name: "dynamic1" } } DynamicLibrary { name : "dynamic1" files : [ "dynamic1.cpp" ] Depends { name: "cpp" } Depends { name: "object1" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } ObjectLibrary { name: "object1" files: [ "object1.cpp" ] Depends { name: "cpp" } Depends { name: "dynamic2" } } DynamicLibrary { name: "dynamic2" files: [ "dynamic2.cpp" ] Depends { name: "cpp" } Depends { name: "object2" } cpp.visibility: 'hidden' Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } ObjectLibrary { name: "object2" files: [ "object2.cpp", "object2.h" ] Depends { name: "cpp" } Probe { id: tcPrinter property bool isGcc: qbs.toolchain.contains("gcc") property bool isEmscripten: qbs.toolchain.contains("emscripten") configure: { console.info("is gcc: " + isGcc); console.info("is emscripten: " + isEmscripten); } } } } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-objectlibs/object2.h0000644000175100017510000000015415154533055026246 0ustar runnerrunner#ifndef OBJECT2_H #define OBJECT2_H class TestMe { public: void hello() const; }; #endif // OBJECT2_H qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-objectlibs/object2.cpp0000644000175100017510000000015515154533055026602 0ustar runnerrunner#include "object2.h" #include void TestMe::hello() const { std::puts("object2 says hello!"); } qbs-src-3.2.0/tests/auto/api/testdata/check-outputs/0000755000175100017510000000000015154533055021774 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/check-outputs/check-outputs.qbs0000644000175100017510000000152615154533055025305 0ustar runnerrunnerimport qbs.File Project { Product { type: 'application' consoleApplication: true Group { files: 'foo.txt' fileTags: ['text'] } Depends { name: 'cpp' } } Rule { inputs: ['text'] Artifact { fileTags: ['cpp'] filePath: input.baseName + '.cpp' } Artifact { fileTags: ['ghost'] filePath: input.baseName + '.ghost' } prepare: { var cmd = new JavaScriptCommand(); cmd.inp = inputs["text"][0].filePath; cmd.out = outputs["cpp"][0].filePath; cmd.description = "generating " + outputs["cpp"][0].fileName; cmd.sourceCode = function() { File.copy(inp, out); }; return cmd; } } } qbs-src-3.2.0/tests/auto/api/testdata/check-outputs/foo.txt0000644000175100017510000000003115154533055023312 0ustar runnerrunnerint main() { return 0; } qbs-src-3.2.0/tests/auto/api/testdata/multiplexing/0000755000175100017510000000000015154533055021717 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/multiplexing/multiplexing.qbs0000644000175100017510000000645115154533055025155 0ustar runnerrunnerimport qbs.TextFile Project { Project { name: "subproject 1" Product { name: "multiplex-using-export" multiplexByQbsProperties: ["architectures"] qbs.architectures: ["TRS-80", "C64"] Depends { name: "multiplex-with-export" } } Product { name: "multiplex-without-aggregator-2-depend-on-non-multiplexed" multiplexByQbsProperties: ["architectures"] qbs.architectures: ["TRS-80", "C64"] Depends { name: "no-multiplexing" } } Product { name: "multiplex-with-aggregator-2" aggregate: true multiplexByQbsProperties: ["architectures"] qbs.architectures: ["TRS-80", "C64"] qbs.architecture: "Atari ST" } Product { name: "multiplex-with-aggregator-2-dependent" Depends { name: "multiplex-with-aggregator-2" } } Product { name: "non-multiplexed-with-dependencies-on-multiplexed" Depends { name: "multiplex-without-aggregator-2" } } Product { name: "non-multiplexed-with-dependencies-on-multiplexed-via-export1" Depends { name: "multiplex-with-export" } } Product { name: "non-multiplexed-with-dependencies-on-multiplexed-via-export2" Depends { name: "nonmultiplex-with-export" } } Product { name: "non-multiplexed-with-dependencies-on-aggregation-via-export" Depends { name: "nonmultiplex-exporting-aggregation" } } } Project { name: "subproject 2" Product { name: "no-multiplexing" } Product { name: "multiplex-without-aggregator-2" multiplexByQbsProperties: ["architectures"] qbs.architectures: ["TRS-80", "C64"] } Product { name: "multiplex-with-export" multiplexByQbsProperties: ["architectures"] qbs.architectures: ["TRS-80", "C64"] Export { Depends { name: "multiplex-without-aggregator-2" } } } Product { name: "nonmultiplex-with-export" Export { Depends { name: "multiplex-without-aggregator-2" } } } Product { name: "nonmultiplex-exporting-aggregation" Export { Depends { name: "multiplex-with-aggregator-2" } } } Product { name: "multiplex-without-aggregator-4" multiplexByQbsProperties: ["architectures", "buildVariants"] qbs.architectures: ["TRS-80", "C64"] qbs.buildVariants: ["debug", "release"] } Product { name: "multiplex-without-aggregator-4-depends-2" multiplexByQbsProperties: ["architectures", "buildVariants"] qbs.architectures: ["TRS-80", "C64"] qbs.buildVariants: ["debug", "release"] Depends { name: "multiplex-without-aggregator-2" } } } Product { name: "aggregate-with-dependencies-on-aggregation-via-export" Depends { name: "nonmultiplex-exporting-aggregation" } aggregate: true multiplexByQbsProperties: ["architectures"] qbs.architectures: ["TRS-80", "C64"] qbs.architecture: "Atari ST" } } qbs-src-3.2.0/tests/auto/api/testdata/installed-artifact/0000755000175100017510000000000015154533055022750 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/installed-artifact/main.cpp0000644000175100017510000000235115154533055024401 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/api/testdata/installed-artifact/installed-artifact.qbs0000644000175100017510000000131015154533055027224 0ustar runnerrunner Project { CppApplication { name: "other app" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } files: ["main.cpp"] } CppApplication { name: "installedApp" type: "application" consoleApplication: true Depends { name: "other app" } Group { files: "main.cpp" qbs.install: true qbs.installDir: "src" } qbs.installPrefix: "/usr" install: true installDebugInformation: false installDir: "bin" Group { fileTagsFilter: "obj" qbs.install: true qbs.installDir: "objects" } } } qbs-src-3.2.0/tests/auto/api/testdata/project-properties-by-name/0000755000175100017510000000000015154533055024364 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-properties-by-name/main2.cpp0000644000175100017510000000250515154533055026100 0ustar runnerrunner/**************************************************************************** ** ** 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 SUB2 #error "Missing define" #endif #ifdef SUB1 #error "Extraneous define" #endif int main() { } qbs-src-3.2.0/tests/auto/api/testdata/project-properties-by-name/main1.cpp0000644000175100017510000000250515154533055026077 0ustar runnerrunner/**************************************************************************** ** ** 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 SUB1 #error "Missing define" #endif #ifdef SUB2 #error "Extraneous define" #endif int main() { } qbs-src-3.2.0/tests/auto/api/testdata/project-properties-by-name/project-properties-by-name.qbs0000644000175100017510000000071015154533055032257 0ustar runnerrunnerProject { name: "toplevel" property stringList theDefines: [] Project { name: "subproject1" CppApplication { name: "subproduct1" files: ["main1.cpp"] cpp.defines: project.theDefines } } Project { name: "subproject2" CppApplication { name: "subproduct2" files: ["main2.cpp"] cpp.defines: project.theDefines } } } qbs-src-3.2.0/tests/auto/api/testdata/export-with-recursive-depends/0000755000175100017510000000000015154533055025115 5ustar runnerrunner././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/api/testdata/export-with-recursive-depends/export-with-recursive-depends.qbsqbs-src-3.2.0/tests/auto/api/testdata/export-with-recursive-depends/export-with-recursive-depends.qb0000644000175100017510000000036315154533055033362 0ustar runnerrunnerProject { CppApplication { name: "app1" files: "main1.cpp" Export { Depends { name: "module1" } } } CppApplication { name: "app2" Depends { name: "app1" } files: "main2.cpp" } } qbs-src-3.2.0/tests/auto/api/testdata/export-with-recursive-depends/main2.cpp0000644000175100017510000000241615154533055026632 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { #ifndef HAS_FOO blubb(); #endif } qbs-src-3.2.0/tests/auto/api/testdata/export-with-recursive-depends/main1.cpp0000644000175100017510000000235115154533055026627 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/api/testdata/export-with-recursive-depends/modules/0000755000175100017510000000000015154533055026565 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/export-with-recursive-depends/modules/module2/0000755000175100017510000000000015154533055030134 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/export-with-recursive-depends/modules/module2/module2.qbs0000644000175100017510000000010415154533055032205 0ustar runnerrunnerModule { Depends { name: "cpp" } cpp.defines: ["HAS_FOO"] } qbs-src-3.2.0/tests/auto/api/testdata/export-with-recursive-depends/modules/module1/0000755000175100017510000000000015154533055030133 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/export-with-recursive-depends/modules/module1/module1.qbs0000644000175100017510000000005315154533055032206 0ustar runnerrunnerModule { Depends { name: "module2" } } qbs-src-3.2.0/tests/auto/api/testdata/duplicate-product-names/0000755000175100017510000000000015154533055023727 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/duplicate-product-names/explicit.qbs0000644000175100017510000000014615154533055026260 0ustar runnerrunnerProject { Product { name: "blubb" } Product { name: "blubb" } Product { name: "blubb" } } qbs-src-3.2.0/tests/auto/api/testdata/duplicate-product-names/implicit.qbs0000644000175100017510000000007415154533055026251 0ustar runnerrunnerProject { Product { } Product { } Product { } } qbs-src-3.2.0/tests/auto/api/testdata/duplicate-product-names/subdir1/0000755000175100017510000000000015154533055025300 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/duplicate-product-names/subdir1/subproject.qbs0000644000175100017510000000001415154533055030162 0ustar runnerrunnerProduct { } qbs-src-3.2.0/tests/auto/api/testdata/duplicate-product-names/implicit-indirect.qbs0000644000175100017510000000012115154533055030041 0ustar runnerrunnerProject { references: ["subdir1/subproject.qbs", "subdir2/subproject.qbs"] } qbs-src-3.2.0/tests/auto/api/testdata/duplicate-product-names/subdir2/0000755000175100017510000000000015154533055025301 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/duplicate-product-names/subdir2/subproject.qbs0000644000175100017510000000001415154533055030163 0ustar runnerrunnerProduct { } qbs-src-3.2.0/tests/auto/api/testdata/file-tagger/0000755000175100017510000000000015154533055021364 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/file-tagger/bla.txt0000644000175100017510000000021315154533055022657 0ustar runnerrunner#include class MyObject : public QObject { Q_OBJECT }; int main() { MyObject obj; return 0; } #include "bla.moc" qbs-src-3.2.0/tests/auto/api/testdata/file-tagger/moc_cpp.qbs0000644000175100017510000000203015154533055023506 0ustar runnerrunnerimport qbs.TextFile import qbs.FileInfo Project { Product { type: "application" consoleApplication: true name: "moc_cpp" Depends { name: "Qt.core" } Group { files: 'bla.txt' fileTags: ['text'] } } Rule { inputs: ['text'] Artifact { fileTags: ['cpp'] filePath: input.baseName + '.cpp' } prepare: { var cmd = new JavaScriptCommand(); cmd.sourceCode = function () { var file = new TextFile(input.filePath, TextFile.ReadOnly); var text = file.readAll(); file.close(); file = new TextFile(output.filePath, TextFile.WriteOnly); file.truncate(); file.write(text); file.close(); } cmd.description = 'generating ' + FileInfo.fileName(output.filePath); cmd.highlight = 'codegen'; return cmd; } } } qbs-src-3.2.0/tests/auto/api/testdata/tool-in-module/0000755000175100017510000000000015154533055022042 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/tool-in-module/use-within-project/0000755000175100017510000000000015154533055025602 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/tool-in-module/use-within-project/main.cpp0000644000175100017510000000026715154533055027237 0ustar runnerrunner#include #include int main(int argc, char *argv[]) { assert(argc == 2); std::ofstream file(argv[1]); assert(file.is_open()); file << "content"; } qbs-src-3.2.0/tests/auto/api/testdata/tool-in-module/use-within-project/use-within-project.qbs0000644000175100017510000000253315154533055032054 0ustar runnerrunnerimport qbs.Host Project { CppApplication { name: "thetool" consoleApplication: true files: "main.cpp" property bool skip: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } install: true installDir: "" qbs.installPrefix: "" Group { fileTagsFilter: ["application"] fileTags: ["thetool.thetool"] } Export { Depends { name: "cpp" } Rule { multiplex: true explicitlyDependsOnFromDependencies: ["thetool.thetool"] Artifact { filePath: "tool-output.txt" fileTags: ["thetool.output"] } prepare: { var cmd = new Command(explicitlyDependsOn["thetool.thetool"][0].filePath, output.filePath); cmd.description = "running the tool"; return [cmd]; } } } } Product { name: "user-in-project" type: ["thetool.output"] Depends { name: "thetool" } } } qbs-src-3.2.0/tests/auto/api/testdata/tool-in-module/use-within-project/tool-input.txt0000644000175100017510000000000015154533055030443 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/tool-in-module/use-outside-project/0000755000175100017510000000000015154533055025754 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/tool-in-module/use-outside-project/use-outside-project.qbs0000644000175100017510000000015215154533055032373 0ustar runnerrunnerProduct { name: "user-outside-project" type: ["thetool.output"] Depends { name: "thetool" } } qbs-src-3.2.0/tests/auto/api/testdata/tool-in-module/use-outside-project/modules/0000755000175100017510000000000015154533055027424 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/tool-in-module/use-outside-project/modules/thetool/0000755000175100017510000000000015154533055031102 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/tool-in-module/use-outside-project/modules/thetool/thetool.qbs0000644000175100017510000000144415154533055033272 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host Module { Depends { name: "cpp" } Group { name: "thetool binary" files: FileInfo.cleanPath(FileInfo.joinPaths(path, "..", "..", "thetool" + (Host.os().includes("windows") ? ".exe" : ""))); fileTags: ["thetool.thetool"] filesAreTargets: true } Rule { multiplex: true explicitlyDependsOnFromDependencies: ["thetool.thetool"] Artifact { filePath: "tool-output.txt" fileTags: ["thetool.output"] } prepare: { var cmd = new Command(explicitlyDependsOn["thetool.thetool"][0].filePath, output.filePath); cmd.description = "running the tool"; return [cmd]; } } } qbs-src-3.2.0/tests/auto/api/testdata/simple-probe/0000755000175100017510000000000015154533055021574 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/simple-probe/main.cpp0000644000175100017510000000236415154533055023231 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { return 0; } qbs-src-3.2.0/tests/auto/api/testdata/simple-probe/simple-probe.qbs0000644000175100017510000000135115154533055024701 0ustar runnerrunnerimport qbs.Probes CppApplication { Probe { id: probe1 property string someString configure: { someString = "one"; found = true; } } Probe { id: probe2 configure: { found = false; } } type: ["application"] name: "MyApp" consoleApplication: { if (!probe1.found) throw "probe1 not found"; if (probe2.found) throw "probe2 unexpectedly found"; if (probe1.someString !== "one") throw "probe1.someString expected to be \"one\"." return true } property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } files: ["main.cpp"] } qbs-src-3.2.0/tests/auto/api/testdata/link-objectlibs-dynamiclibs/0000755000175100017510000000000015154533055024545 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/link-objectlibs-dynamiclibs/object1.cpp0000644000175100017510000000026515154533055026603 0ustar runnerrunner#include "../dllexport.h" #include DLL_IMPORT int dynamic1_hello(); void object1_hello() { int n = dynamic1_hello(); std::printf("object%d says hello!\n", n); } qbs-src-3.2.0/tests/auto/api/testdata/link-objectlibs-dynamiclibs/dynamic2.cpp0000644000175100017510000000017115154533055026756 0ustar runnerrunner#include "../dllexport.h" #include DLL_EXPORT void dynamic2_hello() { std::puts("dynamic2 says hello!"); } qbs-src-3.2.0/tests/auto/api/testdata/link-objectlibs-dynamiclibs/main.cpp0000644000175100017510000000020615154533055026173 0ustar runnerrunner#include void object1_hello(); int main() { object1_hello(); std::puts("application says hello!"); return 0; } qbs-src-3.2.0/tests/auto/api/testdata/link-objectlibs-dynamiclibs/dynamic1.cpp0000644000175100017510000000027215154533055026757 0ustar runnerrunner#include "../dllexport.h" #include "object2.h" #include DLL_EXPORT int dynamic1_hello() { TestMe tm; tm.hello(); std::puts("dynamic1 says hello!"); return 1; } qbs-src-3.2.0/tests/auto/api/testdata/link-objectlibs-dynamiclibs/object2.h0000644000175100017510000000015415154533055026246 0ustar runnerrunner#ifndef OBJECT2_H #define OBJECT2_H class TestMe { public: void hello() const; }; #endif // OBJECT2_H qbs-src-3.2.0/tests/auto/api/testdata/link-objectlibs-dynamiclibs/object2.cpp0000644000175100017510000000030015154533055026572 0ustar runnerrunner#include "object2.h" #include "../dllexport.h" #include DLL_IMPORT void dynamic2_hello(); void TestMe::hello() const { dynamic2_hello(); std::puts("object2 says hello!"); } qbs-src-3.2.0/tests/auto/api/testdata/link-objectlibs-dynamiclibs/link-objectlibs-dynamiclibs.qbs0000644000175100017510000000310615154533055032623 0ustar runnerrunnerProject { Application { name : "HelloWorld" files : [ "main.cpp" ] Depends { name: "cpp" } Depends { name: "object1" } } ObjectLibrary { name: "object1" files: [ "object1.cpp" ] Depends { name: "cpp" } Depends { name: "dynamic1" } Probe { id: osCheck property bool isNormalUnix: qbs.targetOS.includes("unix") && !qbs.targetOS.includes("darwin") property bool isGcc: qbs.toolchain.contains("gcc") property bool isEmscripten: qbs.toolchain.contains("emscripten") configure: { console.info("is normal unix: " + (isNormalUnix ? "yes" : "no")); console.info("is gcc: " + isGcc); console.info("is emscripten: " + isEmscripten); } } } DynamicLibrary { name : "dynamic1" files : [ "dynamic1.cpp" ] Depends { name: "cpp" } Depends { name: "object2" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } ObjectLibrary { name: "object2" files: [ "object2.cpp", "object2.h" ] Depends { name: "cpp" } Depends { name: "dynamic2" } } DynamicLibrary { name: "dynamic2" files: [ "dynamic2.cpp" ] Depends { name: "cpp" } cpp.visibility: 'hidden' Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } } qbs-src-3.2.0/tests/auto/api/testdata/is-runnable/0000755000175100017510000000000015154533055021415 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/is-runnable/is-runnable.qbs0000644000175100017510000000034315154533055024343 0ustar runnerrunnerProject { CppApplication { name: "app" } DynamicLibrary { name: "lib" Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } } qbs-src-3.2.0/tests/auto/api/testdata/export-item-with-group/0000755000175100017510000000000015154533055023556 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/export-item-with-group/main.cpp0000644000175100017510000000235215154533055025210 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { } qbs-src-3.2.0/tests/auto/api/testdata/export-item-with-group/export-item-with-group.qbs0000644000175100017510000000055015154533055030645 0ustar runnerrunnerProject { Product { name: "dep" Export { Depends { name: "cpp" } Group { files: ["main.cpp"] } } } Application { name: "app" consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: "dep" } } } qbs-src-3.2.0/tests/auto/api/testdata/soft-dependency/0000755000175100017510000000000015154533055022265 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/soft-dependency/main.cpp0000644000175100017510000000240315154533055023714 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { thisShouldNotLink(); } qbs-src-3.2.0/tests/auto/api/testdata/soft-dependency/soft-dependency.qbs0000644000175100017510000000026515154533055026066 0ustar runnerrunnerCppApplication { Depends { name: "nosuchmodule" required: false } Properties { condition: nosuchmodule.present files: "main.cpp" } } qbs-src-3.2.0/tests/auto/api/testdata/precompiled-header-new/0000755000175100017510000000000015154533055023516 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/precompiled-header-new/main.cpp0000644000175100017510000000334215154533055025150 0ustar runnerrunner/**************************************************************************** ** ** 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 #include #include using namespace std; int main() { MyObject obj; list 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::iterator it=lst.begin(); it != lst.end(); ++it) cout << *it << ", "; cout << endl; return 0; } qbs-src-3.2.0/tests/auto/api/testdata/precompiled-header-new/myobject.h0000644000175100017510000000251015154533055025501 0ustar runnerrunner/**************************************************************************** ** ** 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 class MyObject { public: MyObject(); ~MyObject(); }; #endif qbs-src-3.2.0/tests/auto/api/testdata/precompiled-header-new/precompiled-header-new.qbs0000644000175100017510000000050515154533055030545 0ustar runnerrunnerCppApplication { name: "MyApp" consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Group { name: "precompiled headers" files: ["stable.h"] fileTags: ["cpp_pch_src"] } files: ["myobject.h", "main.cpp", "myobject.cpp"] } qbs-src-3.2.0/tests/auto/api/testdata/precompiled-header-new/myobject.cpp0000644000175100017510000000263515154533055026044 0ustar runnerrunner/**************************************************************************** ** ** 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 #include "myobject.h" MyObject::MyObject() { std::cout << "MyObject::MyObject()\n"; } MyObject::~MyObject() { std::cout << "MyObject::~MyObject()" << std::endl; } qbs-src-3.2.0/tests/auto/api/testdata/precompiled-header-new/stable.h0000644000175100017510000000253615154533055025147 0ustar runnerrunner/**************************************************************************** ** ** 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 # include #endif qbs-src-3.2.0/tests/auto/api/testdata/lots-of-dots/0000755000175100017510000000000015154533055021530 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/lots-of-dots/object.narf.cpp0000644000175100017510000000251115154533055024426 0ustar runnerrunner/**************************************************************************** ** ** 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 "object.narf.h" #include ObjectNarf::ObjectNarf(QObject *parent) : QObject(parent) {} qbs-src-3.2.0/tests/auto/api/testdata/lots-of-dots/object.narf.h0000644000175100017510000000260115154533055024073 0ustar runnerrunner/**************************************************************************** ** ** 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 OBJECT_H #define OBJECT_H #include class ObjectNarf : public QObject { Q_OBJECT public: ObjectNarf(QObject *parent = nullptr); }; #endif qbs-src-3.2.0/tests/auto/api/testdata/lots-of-dots/lots-of-dots.qbs0000644000175100017510000000067015154533055024574 0ustar runnerrunnerProject { QtGuiApplication { type: "application" consoleApplication: true name: "lots.of.dots" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } cpp.cxxLanguageVersion: "c++11" files : [ "m.a.i.n.cpp", "object.narf.h", "object.narf.cpp", "polka.dots.qrc", "dotty.matrix.ui" ] } } qbs-src-3.2.0/tests/auto/api/testdata/lots-of-dots/dotty.matrix.ui0000644000175100017510000000065415154533055024542 0ustar runnerrunner Form 0 0 400 300 Form qbs-src-3.2.0/tests/auto/api/testdata/lots-of-dots/polka.dots.qrc0000644000175100017510000000014415154533055024314 0ustar runnerrunner m.a.i.n.cpp qbs-src-3.2.0/tests/auto/api/testdata/lots-of-dots/m.a.i.n.cpp0000644000175100017510000000253615154533055023400 0ustar runnerrunner/**************************************************************************** ** ** 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 "object.narf.h" #include #include int main() { ObjectNarf obj; std::puts("..."); } qbs-src-3.2.0/tests/auto/api/testdata/timeout-js/0000755000175100017510000000000015154533055021276 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/timeout-js/timeout.qbs0000644000175100017510000000074215154533055023476 0ustar runnerrunnerProduct { type: "product-under-test" Rule { multiplex: true Artifact { filePath: "output.txt" fileTags: "product-under-test" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "running infinite loop"; cmd.sourceCode = function() { while (true) ; } cmd.timeout = 3; return cmd; } } } qbs-src-3.2.0/tests/auto/api/testdata/restore-and-resolve/0000755000175100017510000000000015154533055023076 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/restore-and-resolve/broken-product.qbs0000644000175100017510000000067015154533055026546 0ustar runnerrunnerimport qbs.TextFile syntax error Product { type: "t" Rule { multiplex: true Artifact { filePath: "dummy.txt"; fileTags: "t" } prepare: { var cmd = JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { new TextFile(output.filePath, TextFile.WriteOnly); }; return cmd; } } } qbs-src-3.2.0/tests/auto/api/testdata/restore-and-resolve/restore-and-resolve.qbs0000644000175100017510000000006115154533055027502 0ustar runnerrunnerProject { references: "broken-product.qbs" } qbs-src-3.2.0/tests/auto/api/testdata/rename-product/0000755000175100017510000000000015154533055022123 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/rename-product/main.cpp0000644000175100017510000000237615154533055023563 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void f(); int main() { f(); } qbs-src-3.2.0/tests/auto/api/testdata/rename-product/rename.qbs0000644000175100017510000000062715154533055024106 0ustar runnerrunnerProject { CppApplication { Depends { name: "TheLib" } cpp.defines: "MY_EXPORT=" files: "main.cpp" } DynamicLibrary { name: "TheLib" Depends { name: "cpp" } cpp.defines: "MY_EXPORT=DLL_EXPORT" files: "lib.cpp" Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } } qbs-src-3.2.0/tests/auto/api/testdata/rename-product/lib.cpp0000644000175100017510000000241515154533055023377 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" MY_EXPORT void f() { } qbs-src-3.2.0/tests/auto/api/testdata/disappeared-wildcard-file/0000755000175100017510000000000015154533055024163 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/disappeared-wildcard-file/disappeared-wildcard-file.qbs0000644000175100017510000000006115154533055031654 0ustar runnerrunnerProduct { name: "dummy" files: "*.txt" } qbs-src-3.2.0/tests/auto/api/testdata/disappeared-wildcard-file/file1.txt0000644000175100017510000000000015154533055025712 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/disappeared-wildcard-file/file2.txt0000644000175100017510000000000015154533055025713 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/rename-target-artifact/0000755000175100017510000000000015154533055023524 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/rename-target-artifact/main.cpp0000644000175100017510000000237615154533055025164 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void f(); int main() { f(); } qbs-src-3.2.0/tests/auto/api/testdata/rename-target-artifact/rename.qbs0000644000175100017510000000077515154533055025513 0ustar runnerrunnerProject { CppApplication { Depends { name: "TheLib" } cpp.defines: "MY_EXPORT=" qbs.buildVariant: "release" files: "main.cpp" } DynamicLibrary { name: "TheLib" targetName: "the_lib" Depends { name: "cpp" } cpp.defines: "MY_EXPORT=DLL_EXPORT" qbs.buildVariant: "release" files: "lib.cpp" Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } } qbs-src-3.2.0/tests/auto/api/testdata/rename-target-artifact/lib.cpp0000644000175100017510000000241515154533055025000 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" MY_EXPORT void f() { } qbs-src-3.2.0/tests/auto/api/testdata/same-base-name/0000755000175100017510000000000015154533055021751 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/same-base-name/lib.m0000644000175100017510000000016715154533055022701 0ustar runnerrunner#import extern void printHelloObjc() { NSLog(@"Hello from Objective-C in " __FILE__); } qbs-src-3.2.0/tests/auto/api/testdata/same-base-name/lib.mm0000644000175100017510000000027215154533055023053 0ustar runnerrunner#include #import extern "C" void printHelloObjcpp() { NSLog(@"Hello from Objective-C++..."); std::cout << "...in " __FILE__ << std::endl; } qbs-src-3.2.0/tests/auto/api/testdata/same-base-name/same-base-name.qbs0000644000175100017510000000136515154533055025240 0ustar runnerrunnerProject { CppApplication { type: "application" consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: "basenamelib" } name: "basename" files: "main.c" } StaticLibrary { Depends { name: "cpp" } name: "basenamelib" files: [ "lib.c", "lib.cpp" ] Group { condition: qbs.targetOS.includes("darwin") files: [ "lib.m", "lib.mm" ] } Export { Depends { name: "cpp" } cpp.frameworks: qbs.targetOS.includes("darwin") ? "Foundation" : undefined } } } qbs-src-3.2.0/tests/auto/api/testdata/same-base-name/lib.c0000644000175100017510000000247315154533055022671 0ustar runnerrunner/**************************************************************************** ** ** 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 extern void printHelloC() { printf("Hello from C in " __FILE__ "\n"); } qbs-src-3.2.0/tests/auto/api/testdata/same-base-name/lib.cpp0000644000175100017510000000252415154533055023226 0ustar runnerrunner/**************************************************************************** ** ** 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 extern "C" void printHelloCpp() { std::cout << "Hello from C++ in " << __FILE__ << std::endl; } qbs-src-3.2.0/tests/auto/api/testdata/same-base-name/main.c0000644000175100017510000000276615154533055023054 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ extern void printHelloC(); extern void printHelloCpp(); #ifdef __APPLE__ extern void printHelloObjc(); extern void printHelloObjcpp(); #endif int main() { printHelloC(); printHelloCpp(); #ifdef __APPLE__ printHelloObjc(); printHelloObjcpp(); #endif return 0; } qbs-src-3.2.0/tests/auto/api/testdata/link-staticlib-dynamiclib/0000755000175100017510000000000015154533055024220 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/link-staticlib-dynamiclib/main.cpp0000644000175100017510000000010215154533055025641 0ustar runnerrunnerint static_foo(); int main() { return static_foo() - 156; } qbs-src-3.2.0/tests/auto/api/testdata/link-staticlib-dynamiclib/mydynamiclib.cpp0000644000175100017510000000010715154533055027403 0ustar runnerrunner#include "../dllexport.h" DLL_EXPORT int dynamic_foo() { return 12; } qbs-src-3.2.0/tests/auto/api/testdata/link-staticlib-dynamiclib/mystaticlib.cpp0000644000175100017510000000015215154533055027246 0ustar runnerrunner#include "../dllexport.h" DLL_IMPORT int dynamic_foo(); int static_foo() { return dynamic_foo() * 13; } qbs-src-3.2.0/tests/auto/api/testdata/link-staticlib-dynamiclib/link-staticlib-dynamiclib.qbs0000644000175100017510000000103315154533055031746 0ustar runnerrunnerProject { CppApplication { Depends { name: "mystaticlib" } name: "app" consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } files: ["main.cpp"] } StaticLibrary { Depends { name: "cpp" } Depends { name: "mydynamiclib" } name: "mystaticlib" files: ["mystaticlib.cpp"] } DynamicLibrary { name: "mydynamiclib" Depends { name: "cpp" } files: ["mydynamiclib.cpp"] } } qbs-src-3.2.0/tests/auto/api/testdata/app-without-sources/0000755000175100017510000000000015154533055023140 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/app-without-sources/b.c0000644000175100017510000000246215154533055023531 0ustar runnerrunner/**************************************************************************** ** ** 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 int foo(); // defined in a.cpp int main() { return foo(); } qbs-src-3.2.0/tests/auto/api/testdata/app-without-sources/a.c0000644000175100017510000000236415154533055023531 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int foo() { return 42; } qbs-src-3.2.0/tests/auto/api/testdata/app-without-sources/app-without-sources.qbs0000644000175100017510000000146315154533055027615 0ustar runnerrunnerProject { StaticLibrary { name: "a" Depends { name: "cpp" } files: [ "a.c", ] } StaticLibrary { name: "b" Depends { name: "a" } Depends { name: "cpp" } files: [ "b.c", ] } CppApplication { name: "appWithoutSources" consoleApplication: true property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } // HACK: cpp.entryPoint currently not working 100% with gcc Properties { condition: qbs.toolchain.includes("msvc") cpp.entryPoint: "main" cpp.dynamicLibraries: ["ucrt", "kernel32"] } cpp.entryPoint: undefined Depends { name: "a" } Depends { name: "b" } } } qbs-src-3.2.0/tests/auto/api/testdata/source-file-in-build-dir/0000755000175100017510000000000015154533055023670 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/source-file-in-build-dir/source-file-in-build-dir.qbs0000644000175100017510000000112715154533055031072 0ustar runnerrunnerimport qbs.TextFile CppApplication { name: "theProduct" type: base.concat(["dummy"]) Rule { multiplex: true Artifact { filePath: "generated.cpp" fileTags: ["dummy"] } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); }; return [cmd]; } } Group { name: "the group" files: "**/*.cpp" } } qbs-src-3.2.0/tests/auto/api/testdata/source-file-in-build-dir/file.cpp0000644000175100017510000000235215154533055025315 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-staticlibs/0000755000175100017510000000000015154533055024566 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-staticlibs/dynamic2.cpp0000644000175100017510000000025515154533055027002 0ustar runnerrunner#include "../dllexport.h" #include "static2.h" #include DLL_EXPORT void dynamic2_hello() { TestMe tm; tm.hello(); std::puts("dynamic2 says hello!"); } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-staticlibs/main.cpp0000644000175100017510000000027615154533055026223 0ustar runnerrunner#include "../dllexport.h" #include DLL_IMPORT int dynamic1_hello(); int main() { int result = dynamic1_hello(); std::puts("application says hello!"); return result; } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-staticlibs/static1.cpp0000644000175100017510000000024515154533055026643 0ustar runnerrunner#include "../dllexport.h" #include DLL_IMPORT void dynamic2_hello(); void static1_hello() { dynamic2_hello(); std::puts("static1 says hello!"); } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-staticlibs/static2.cpp0000644000175100017510000000015515154533055026644 0ustar runnerrunner#include "static2.h" #include void TestMe::hello() const { std::puts("static2 says hello!"); } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-staticlibs/static2.h0000644000175100017510000000015415154533055026310 0ustar runnerrunner#ifndef STATIC2_H #define STATIC2_H class TestMe { public: void hello() const; }; #endif // STATIC2_H qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-staticlibs/dynamic1.cpp0000644000175100017510000000026315154533055027000 0ustar runnerrunner#include #include "../dllexport.h" void static1_hello(); DLL_EXPORT int dynamic1_hello() { static1_hello(); std::puts("dynamic1 says hello!"); return 0; } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs-staticlibs/link-dynamiclibs-staticlibs.qbs0000644000175100017510000000254315154533055032671 0ustar runnerrunnerProject { Application { name : "HelloWorld" files : [ "main.cpp" ] Depends { name: "cpp" } Depends { name: "dynamic1" } } DynamicLibrary { name : "dynamic1" files : [ "dynamic1.cpp" ] Depends { name: "cpp" } Depends { name: "static1" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } StaticLibrary { name: "static1" files: [ "static1.cpp" ] Depends { name: "cpp" } Depends { name: "dynamic2" } } DynamicLibrary { name: "dynamic2" files: [ "dynamic2.cpp" ] Depends { name: "cpp" } Depends { name: "static2" } cpp.visibility: 'hidden' Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } StaticLibrary { name: "static2" files: [ "static2.cpp", "static2.h" ] Depends { name: "cpp" } Probe { id: tcPrinter property bool isGcc: qbs.toolchain.contains("gcc") property bool isEmscripten: qbs.toolchain.contains("emscripten") configure: { console.info("is gcc: " + isGcc); console.info("is emscripten: " + isEmscripten); } } } } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs/0000755000175100017510000000000015154533055022427 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs/main.cpp0000644000175100017510000000265015154533055024062 0ustar runnerrunner/**************************************************************************** ** ** 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 #include DLL_IMPORT int lib1_hello(); int main() { std::puts("application says hello!"); TestMe test; test.hello1(); test.hello2(); return lib1_hello(); } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs/lib3.cpp0000644000175100017510000000265615154533055023775 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" #include DLL_EXPORT void lib3_hello() { std::puts("lib3 says hello!"); } DLL_EXPORT char* lib3_greeting() { static char greeting[] = "hello"; return greeting; } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs/lib2.cpp0000644000175100017510000000257615154533055023775 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" #include DLL_IMPORT void lib3_hello(); DLL_EXPORT void lib2_hello() { std::puts("lib2 says hello!"); lib3_hello(); } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs/lib4.h0000644000175100017510000000307415154533055023436 0ustar runnerrunner/**************************************************************************** ** ** 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 LIB4_H #define LIB4_H #include "../dllexport.h" #include #ifdef TEST_LIB # define LIB_EXPORT DLL_EXPORT #else # define LIB_EXPORT DLL_IMPORT #endif class LIB_EXPORT TestMe { public: TestMe(); void hello1() const; inline void hello2() const { hello2Impl(); } private: void hello2Impl() const; }; #endif // LIB4_H qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs/link-dynamiclibs.qbs0000644000175100017510000000332515154533055026372 0ustar runnerrunnerProject { Application { name : "HelloWorld" property bool dummy: { console.info("is emscripten: " + qbs.toolchain.includes("emscripten")); } Group { files : [ "main.cpp" ] } Depends { name: "cpp" } Depends { name: "lib1" } Depends { name: "lib4" } } DynamicLibrary { name : "lib1" Group { files : [ "lib1.cpp" ] } Depends { name: "cpp" } Depends { name: "lib2" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } DynamicLibrary { name : "lib2" cpp.visibility: 'default' Group { files : [ "lib2.cpp" ] } Depends { name: "cpp" } Depends { name: "lib3" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } DynamicLibrary { name : "lib3" cpp.visibility: 'hidden' Group { files : [ "lib3.cpp" ] } Depends { name: "cpp" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } DynamicLibrary { name : "lib4" cpp.visibility: 'hiddenInlines' cpp.defines: "TEST_LIB" Group { files : [ "lib4.h", "lib4.cpp" ] } Depends { name: "cpp" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory] } } } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs/lib4.cpp0000644000175100017510000000262615154533055023773 0ustar runnerrunner/**************************************************************************** ** ** 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 "lib4.h" TestMe::TestMe() { } void TestMe::hello1() const { std::puts("lib4 says hello!"); } void TestMe::hello2Impl() const { std::puts("lib4 says hello inline!"); } qbs-src-3.2.0/tests/auto/api/testdata/link-dynamiclibs/lib1.cpp0000644000175100017510000000261215154533055023763 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" #include DLL_IMPORT void lib2_hello(); DLL_EXPORT int lib1_hello() { std::puts("lib1 says hello!"); lib2_hello(); return 0; } qbs-src-3.2.0/tests/auto/api/testdata/base-properties/0000755000175100017510000000000015154533055022302 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/base-properties/main.cpp0000644000175100017510000000261415154533055023735 0ustar runnerrunner/**************************************************************************** ** ** 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 FROM_FOO #error FROM_FOO missing! #endif #ifndef FROM_BAR #error FROM_BAR missing! #endif #ifndef FROM_PRJ #error FROM_PRJ missing! #endif int main() { return 0; } qbs-src-3.2.0/tests/auto/api/testdata/base-properties/imports/0000755000175100017510000000000015154533055023777 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/base-properties/imports/Foo.qbs0000644000175100017510000000015115154533055025226 0ustar runnerrunnerBar { type: "application" consoleApplication: true cpp.defines: base.concat(["FROM_FOO"]) } qbs-src-3.2.0/tests/auto/api/testdata/base-properties/imports/Bar.qbs0000644000175100017510000000010615154533055025207 0ustar runnerrunnerProduct { Depends { name: "cpp" } cpp.defines: ["FROM_BAR"] } qbs-src-3.2.0/tests/auto/api/testdata/base-properties/prj.qbs0000644000175100017510000000021015154533055023575 0ustar runnerrunnerimport "imports/Foo.qbs" as Foo Project { Foo { cpp.defines: base.concat(["FROM_PRJ"]); files: "main.cpp" } } qbs-src-3.2.0/tests/auto/api/testdata/empty-submodules-list/0000755000175100017510000000000015154533055023465 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/empty-submodules-list/empty-submodules-list.qbs0000644000175100017510000000012415154533055030460 0ustar runnerrunnerCppApplication { Depends { name: "dummy" submodules: [] } } qbs-src-3.2.0/tests/auto/api/testdata/uic/0000755000175100017510000000000015154533055017756 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/uic/ui.ui0000644000175100017510000000126415154533055020735 0ustar runnerrunner MainWindow 0 0 800 600 MainWindow 0 0 800 25 qbs-src-3.2.0/tests/auto/api/testdata/uic/ui.h0000644000175100017510000000235615154533055020552 0ustar runnerrunner/**************************************************************************** ** ** 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 "ui_ui.h" qbs-src-3.2.0/tests/auto/api/testdata/uic/bla.cpp0000644000175100017510000000246615154533055021230 0ustar runnerrunner/**************************************************************************** ** ** 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 "bla.h" int main() { Ui::MainWindow mainWindow; Q_UNUSED(mainWindow); } qbs-src-3.2.0/tests/auto/api/testdata/uic/bla.h0000644000175100017510000000235315154533055020670 0ustar runnerrunner/**************************************************************************** ** ** 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 "ui.h" qbs-src-3.2.0/tests/auto/api/testdata/uic/uic.qbs0000644000175100017510000000035115154533055021244 0ustar runnerrunnerProject { QtGuiApplication { type: "application" consoleApplication: true name: "ui" files: [ "bla.cpp", "bla.h", "ui.ui", "ui.h" ] } } qbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/0000755000175100017510000000000015154533055023527 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/emptydir/0000755000175100017510000000000015154533055025364 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/emptydir/.gitignore0000644000175100017510000000000015154533055027342 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/cycle.qbs0000644000175100017510000000021315154533055025331 0ustar runnerrunnerProject { property string productName: "p1" Product { name: project.productName } references: ["referenced-file-errors.qbs"] } qbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/ambiguousdir/0000755000175100017510000000000015154533055026221 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/ambiguousdir/p2.qbs0000644000175100017510000000000015154533055027237 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/ambiguousdir/p1.qbs0000644000175100017510000000000015154533055027236 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/referenced-file-errors.qbs0000644000175100017510000000074115154533055030571 0ustar runnerrunnerProject { references: [ "ambiguousdir", "cycle.qbs", "emptydir", "nosuchfile.qbs", "okay.qbs", "wrongtype.qbs", ] SubProject { filePath: "cycle.qbs" Properties { productName: "p3" } } SubProject { filePath: "nosuchfile.qbs" } SubProject { filePath: "okay2.qbs" } Product { name: "p5" Depends { name: "brokenmodule" } } } qbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/okay.qbs0000644000175100017510000000002715154533055025200 0ustar runnerrunnerProduct { name: "p2" } qbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/wrongtype.qbs0000644000175100017510000000001315154533055026266 0ustar runnerrunnerModule { } qbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/modules/0000755000175100017510000000000015154533055025177 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/modules/brokenmodule/0000755000175100017510000000000015154533055027665 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/modules/brokenmodule/brokenmodule.qbs0000644000175100017510000000003415154533055033057 0ustar runnerrunnerModule { syntax error } qbs-src-3.2.0/tests/auto/api/testdata/referenced-file-errors/okay2.qbs0000644000175100017510000000002715154533055025262 0ustar runnerrunnerProduct { name: "p4" } qbs-src-3.2.0/tests/auto/api/testdata/project-data-after-product-invalidation/0000755000175100017510000000000015154533055027007 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-data-after-product-invalidation/main.cpp0000644000175100017510000000235115154533055030440 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/api/testdata/project-data-after-product-invalidation/file.cpp0000644000175100017510000000235015154533055030432 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void f() { } ././@LongLink0000644000000000000000000000017200000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/api/testdata/project-data-after-product-invalidation/project-data-after-product-invalidation.qbsqbs-src-3.2.0/tests/auto/api/testdata/project-data-after-product-invalidation/project-data-after-pro0000644000175100017510000000014515154533055033204 0ustar runnerrunnerCppApplication { name: "theProduct" files: [ "file.cpp", "main.cpp", ] } qbs-src-3.2.0/tests/auto/api/testdata/recursive-wildcards/0000755000175100017510000000000015154533055023157 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/recursive-wildcards/dir/0000755000175100017510000000000015154533055023735 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/recursive-wildcards/dir/file1.txt0000644000175100017510000000000015154533055025464 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/recursive-wildcards/dir/subdir/0000755000175100017510000000000015154533055025225 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/recursive-wildcards/dir/subdir/file2.txt0000644000175100017510000000000015154533055026755 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/recursive-wildcards/recursive-wildcards.qbs0000644000175100017510000000021015154533055027640 0ustar runnerrunnerProduct { qbs.installPrefix: "" Group { files: "dir/**" qbs.install: true qbs.installDir: "dir" } } qbs-src-3.2.0/tests/auto/api/testdata/build-single-file/0000755000175100017510000000000015154533055022471 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/build-single-file/compiled.cpp0000644000175100017510000000243115154533055024771 0ustar runnerrunner/**************************************************************************** ** ** 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 void f() { std::cout << "test"; } qbs-src-3.2.0/tests/auto/api/testdata/build-single-file/ignored1.cpp0000644000175100017510000000000015154533055024673 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/build-single-file/ignored2.cpp0000644000175100017510000000000015154533055024674 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/build-single-file/build-single-file.qbs0000644000175100017510000000136315154533055026476 0ustar runnerrunnerimport qbs.TextFile CppApplication { consoleApplication: true files: ["ignored1.cpp", "ignored2.cpp", "compiled.cpp"] cpp.includePaths: [buildDirectory] Group { files: ["pch.h"] fileTags: ["cpp_pch_src"] } install: true installDir: "" Rule { multiplex: true Artifact { filePath: "generated.h" fileTags: ["hpp"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var header = new TextFile(output.filePath, TextFile.WriteOnly); header.close(); }; return [cmd]; } } } qbs-src-3.2.0/tests/auto/api/testdata/build-single-file/pch.h0000644000175100017510000000002415154533055023410 0ustar runnerrunner#include qbs-src-3.2.0/tests/auto/api/testdata/explicitly-depends-on/0000755000175100017510000000000015154533055023416 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/explicitly-depends-on/a.in0000644000175100017510000000000015154533055024154 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/explicitly-depends-on/explicitly-depends-on.qbs0000644000175100017510000000416715154533055030355 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host import qbs.TextFile Project { CppApplication { name: "compiler" files: ["compiler.cpp"] Group { fileTagsFilter: ["application"] fileTags: ["compiler"] } } Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "p" type: ["mytype"] Depends { name: "compiler" } Depends { name: "cpp" } Rule { inputs: ["mytype.in"] explicitlyDependsOnFromDependencies: ["compiler"] Artifact { filePath: input.fileName + ".out" fileTags: product.type } prepare: { var compiler = explicitlyDependsOn["compiler"][0].filePath; var cmd = new Command(compiler, [input.filePath, output.filePath]); cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; return [cmd]; } } Rule { multiplex: true explicitlyDependsOnFromDependencies: ["compiler"] Artifact { filePath: "compiler-name.txt" fileTags: product.type } prepare: { var nameCmd = new JavaScriptCommand(); nameCmd.description = "writing compiler name"; nameCmd.sourceCode = function() { var compiler = explicitlyDependsOn["compiler"][0].filePath; var file = new TextFile(output.filePath, TextFile.WriteOnly); file.write("compiler file name: " + FileInfo.baseName(compiler)); file.close(); } return [nameCmd]; } } FileTagger { patterns: "*.in" fileTags: ["mytype.in"] } files: ["a.in", "b.in", "c.in"] } } qbs-src-3.2.0/tests/auto/api/testdata/explicitly-depends-on/c.in0000644000175100017510000000000015154533055024156 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/explicitly-depends-on/b.in0000644000175100017510000000000015154533055024155 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/explicitly-depends-on/compiler.cpp0000644000175100017510000000026215154533055025734 0ustar runnerrunner#include #include int main(int argc, char *argv[]) { assert(argc == 3); std::ofstream target(argv[2]); assert(target); target << argv[1]; } qbs-src-3.2.0/tests/auto/api/testdata/renamed-qbs-source-file/0000755000175100017510000000000015154533055023607 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/renamed-qbs-source-file/the-product/0000755000175100017510000000000015154533055026045 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/renamed-qbs-source-file/the-product/the-prodduct.qbs0000644000175100017510000000001415154533055031151 0ustar runnerrunnerProduct { } qbs-src-3.2.0/tests/auto/api/testdata/renamed-qbs-source-file/renamed-qbs-source-file.qbs0000644000175100017510000000025115154533055030725 0ustar runnerrunnerProject { references: "the-product/the-prodduct.qbs" Product { Group { files: "the-product/*.qbs" fileTags: [] } } } qbs-src-3.2.0/tests/auto/api/testdata/fallback-gcc/0000755000175100017510000000000015154533055021467 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/fallback-gcc/fallback-gcc.qbs0000644000175100017510000000106315154533055024467 0ustar runnerrunnerCppApplication { name: "app" cpp._skipAllChecks: true Profile { name: "unixProfile" qbs.targetOS: ["unix"] qbs.toolchain: ["gcc"] // qbs.targetPlatform: "unix" // qbs.toolchainType: "gcc" } Profile { name: "gccProfile" qbs.targetOS: [] qbs.toolchain: ["gcc"] // qbs.targetPlatform: undefined // qbs.toolchainType: "gcc" } multiplexByQbsProperties: ["profiles"] qbs.profiles: ["unixProfile", "gccProfile"] } qbs-src-3.2.0/tests/auto/api/testdata/nonexistingprojectproperties/0000755000175100017510000000000015154533055025247 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/nonexistingprojectproperties/invalidaccessfromproduct.qbs0000644000175100017510000000005415154533055033052 0ustar runnerrunnerProject { Product { type: project.blubb } } qbs-src-3.2.0/tests/auto/api/testdata/nonexistingprojectproperties/nonexistingprojectproperties.qbs0000644000175100017510000000001415154533055034022 0ustar runnerrunnerProject { } qbs-src-3.2.0/tests/auto/api/testdata/enable-and-disable-product/0000755000175100017510000000000015154533055024243 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/enable-and-disable-product/main.cpp0000644000175100017510000000235115154533055025674 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/api/testdata/enable-and-disable-product/enable-and-disable-product.qbs0000644000175100017510000000027515154533055032023 0ustar runnerrunnerCppApplication { property string prop: undefined // Influences source artifact properties and the product condition condition: prop cpp.visibility: prop files: "main.cpp" } qbs-src-3.2.0/tests/auto/api/testdata/moc-hpp/0000755000175100017510000000000015154533055020541 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/moc-hpp/object.cpp0000644000175100017510000000257615154533055022525 0ustar runnerrunner/**************************************************************************** ** ** 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 "object.h" #include Object::Object(QObject *parent) : QObject(parent) {} int main() { Object obj; std::printf("Hello World\n"); } qbs-src-3.2.0/tests/auto/api/testdata/moc-hpp/object.h0000644000175100017510000000257115154533055022165 0ustar runnerrunner/**************************************************************************** ** ** 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 OBJECT_H #define OBJECT_H #include class Object : public QObject { Q_OBJECT public: Object(QObject *parent = nullptr); }; #endif qbs-src-3.2.0/tests/auto/api/testdata/moc-hpp/moc-hpp.qbs0000644000175100017510000000056015154533055022614 0ustar runnerrunnerProject { Product { type: "application" consoleApplication: true name: "moc_hpp" property bool dummy: { console.info("executable suffix: " + cpp.executableSuffix); } Depends { name: "Qt.core" } cpp.cxxLanguageVersion: "c++11" files : [ "object.h", "object.cpp" ] } } qbs-src-3.2.0/tests/auto/api/testdata/disabled_install_group/0000755000175100017510000000000015154533055023707 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/disabled_install_group/main.cpp0000644000175100017510000000235215154533055025341 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() { } qbs-src-3.2.0/tests/auto/api/testdata/disabled_install_group/disabled_install_group.qbs0000644000175100017510000000032215154533055031124 0ustar runnerrunnerCppApplication { consoleApplication: true files: "main.cpp" config.install.install: false Group { condition: false qbs.install: true fileTagsFilter: product.type } } qbs-src-3.2.0/tests/auto/api/testdata/excluded-inputs/0000755000175100017510000000000015154533055022313 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/excluded-inputs/excluded-inputs.qbs0000644000175100017510000000720215154533055026140 0ustar runnerrunnerimport qbs.File import qbs.TextFile Project { Product { name: "dep" type: "the_tag" Rule { multiplex: true Artifact { filePath: "file1.txt" fileTags: "the_tag" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.writeLine("the_content"); f.close(); }; return cmd; } } Rule { inputs: "the_tag" excludedInputs: "the_other_tag" Artifact { filePath: "file2.txt" fileTags: "the_other_tag" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); var f = new TextFile(output.filePath, TextFile.Append); f.writeLine("the_other_content"); f.close(); }; return cmd; } } Group { fileTagsFilter: "the_other_tag" fileTags: "the_tag" } } Product { name: "p" type: "p_type" Depends { name: "dep" } Rule { multiplex: true inputsFromDependencies: "the_tag" Artifact { filePath: "dummy1.txt" fileTags: "p_type" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName;; if (!inputs["the_tag"] || inputs["the_tag"].length != 2) throw "Huch?"; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); }; return cmd; } } Rule { multiplex: true inputsFromDependencies: "the_tag" excludedInputs: "the_other_tag" Artifact { filePath: "dummy2.txt" fileTags: "p_type" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName;; if (!inputs["the_tag"] || inputs["the_tag"].length != 1) throw "Huch?"; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); }; return cmd; } } Rule { multiplex: true explicitlyDependsOnFromDependencies: "the_tag" excludedInputs: "the_other_tag" Artifact { filePath: "dummy3.txt" fileTags: "p_type" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; if (!explicitlyDependsOn["the_tag"] || explicitlyDependsOn["the_tag"].length != 1) throw "Huch?"; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.close(); }; return cmd; } } } } qbs-src-3.2.0/tests/auto/api/testdata/project-with-properties-item/0000755000175100017510000000000015154533055024743 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/project-with-properties-item/project-with-properties-item.qbs0000644000175100017510000000034615154533055033222 0ustar runnerrunnerProject { property string binPath: "/usr/bin" property string libPath: "/usr/lib" Properties { condition: qbs.targetOS.includes("macos") binPath: "/Users/boo" libPath: "/Libraries/foo" } } qbs-src-3.2.0/tests/auto/api/testdata/subprojects/0000755000175100017510000000000015154533055021541 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/subprojects/subproject1/0000755000175100017510000000000015154533055024002 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/subprojects/subproject1/main.cpp0000644000175100017510000000237615154533055025442 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void f(); int main() { f(); } qbs-src-3.2.0/tests/auto/api/testdata/subprojects/toplevelproject.qbs0000644000175100017510000000055115154533055025472 0ustar runnerrunnerProject { name: "top level project" references: ["subproject2"] Project { condition: true name: "app-project" CppApplication { name: "app" Depends { name: "testLib" } cpp.defines: "MY_EXPORT=" files: "subproject1/main.cpp" } } qbsSearchPaths: ["resources"] } qbs-src-3.2.0/tests/auto/api/testdata/subprojects/resources/0000755000175100017510000000000015154533055023553 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/subprojects/resources/imports/0000755000175100017510000000000015154533055025250 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/subprojects/resources/imports/LibraryType/0000755000175100017510000000000015154533055027516 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/subprojects/resources/imports/LibraryType/type.js0000644000175100017510000000005515154533055031035 0ustar runnerrunnerfunction type() { return "dynamiclibrary"; } qbs-src-3.2.0/tests/auto/api/testdata/subprojects/resources/modules/0000755000175100017510000000000015154533055025223 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/subprojects/resources/modules/cute/0000755000175100017510000000000015154533055026163 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/subprojects/resources/modules/cute/core/0000755000175100017510000000000015154533055027113 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/subprojects/resources/modules/cute/core/cuteglobal.h0000644000175100017510000000004115154533055031400 0ustar runnerrunner#define Q_DECL_EXPORT DLL_EXPORT qbs-src-3.2.0/tests/auto/api/testdata/subprojects/resources/modules/cute/core/core.qbs0000644000175100017510000000010415154533055030545 0ustar runnerrunnerModule { Depends { name: "cpp" } cpp.includePaths: [path] } qbs-src-3.2.0/tests/auto/api/testdata/subprojects/resources/modules/QtCoreDepender/0000755000175100017510000000000015154533055030067 5ustar runnerrunner././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/api/testdata/subprojects/resources/modules/QtCoreDepender/qtcoredepender.qbsqbs-src-3.2.0/tests/auto/api/testdata/subprojects/resources/modules/QtCoreDepender/qtcoredepender.qb0000644000175100017510000000005515154533055033417 0ustar runnerrunnerModule { Depends { name: "cute.core" } } qbs-src-3.2.0/tests/auto/api/testdata/subprojects/subproject2/0000755000175100017510000000000015154533055024003 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/subprojects/subproject2/subproject3/0000755000175100017510000000000015154533055026246 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/subprojects/subproject2/subproject3/testlib.cpp0000644000175100017510000000245215154533055030423 0ustar runnerrunner/**************************************************************************** ** ** 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 #include "../../../dllexport.h" MY_EXPORT void f() {} qbs-src-3.2.0/tests/auto/api/testdata/subprojects/subproject2/subproject3/subproject3.qbs0000644000175100017510000000063115154533055031220 0ustar runnerrunnerimport LibraryType Project { condition: false property string libNameSuffix: "blubb" Product { name: project.libNamePrefix + project.libNameSuffix type: LibraryType.type() Depends { name: "cpp" } Depends { name: "QtCoreDepender" } cpp.defines: "MY_EXPORT=Q_DECL_EXPORT" files: "testlib.cpp" Export { Depends { name: "cute.core" } } } } qbs-src-3.2.0/tests/auto/api/testdata/subprojects/subproject2/subproject2.qbs0000644000175100017510000000051015154533055026750 0ustar runnerrunnerProject { name: "subproject2" property string libNamePrefix: "test" SubProject { filePath: "subproject3/subproject3.qbs" inheritProperties: true Properties { name: "overridden name" condition: qbs.targetOS.length > 0 libNameSuffix: "Lib" } } } qbs-src-3.2.0/tests/auto/api/testdata/process-result/0000755000175100017510000000000015154533055022170 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/process-result/main.cpp0000644000175100017510000000257015154533055023624 0ustar runnerrunner/**************************************************************************** ** ** 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 #include int main(int argc, char *argv[]) { std::cout << "stdout"; std::cerr << "stderr"; return atoi(argv[1]); } qbs-src-3.2.0/tests/auto/api/testdata/process-result/process-result.qbs0000644000175100017510000000232215154533055025670 0ustar runnerrunnerimport qbs.Host Project { CppApplication { name: "app" consoleApplication: true files: ["main.cpp"] } Product { condition: { var result = qbs.targetPlatform === Host.platform() && qbs.architecture === Host.architecture(); if (!result) console.info("target platform/arch differ from host platform/arch"); return result; } name: "app-caller" type: "mytype" Depends { name: "app" } Depends { name: "cpp" } property bool redirectStdout property bool redirectStderr property int argument Rule { inputsFromDependencies: ["application"] outputFileTags: "mytype" prepare: { var cmd = new Command(inputs["application"][0].filePath, [product.argument]); if (product.redirectStdout) cmd.stdoutFilePath = product.buildDirectory + "/stdout.txt"; if (product.redirectStderr) cmd.stderrFilePath = product.buildDirectory + "/stderr.txt"; cmd.description = "building app-caller"; return [cmd]; } } } } qbs-src-3.2.0/tests/auto/api/testdata/generated-files-list/0000755000175100017510000000000015154533055023205 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/generated-files-list/mainwindow.ui0000644000175100017510000000116615154533055025724 0ustar runnerrunner MainWindow 0 0 400 300 MainWindow qbs-src-3.2.0/tests/auto/api/testdata/generated-files-list/main.cpp0000644000175100017510000000260715154533055024642 0ustar runnerrunner/**************************************************************************** ** ** 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 "mainwindow.h" #include int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } qbs-src-3.2.0/tests/auto/api/testdata/generated-files-list/generated-files-list.qbs0000644000175100017510000000071715154533055027730 0ustar runnerrunnerCppApplication { Depends { name: "Qt.widgets" } consoleApplication: true property bool dummy: { console.info("is emscripten: " + qbs.toolchain.includes("emscripten")); } cpp.cxxLanguageVersion: "c++11" cpp.debugInformation: false cpp.separateDebugInformation: false files: [ "main.cpp", "mainwindow.cpp", "mainwindow.h", "mainwindow.ui" ] Depends { name: "bundle" } bundle.isBundle: false } qbs-src-3.2.0/tests/auto/api/testdata/generated-files-list/mainwindow.h0000644000175100017510000000305015154533055025530 0ustar runnerrunner/**************************************************************************** ** ** 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 MAINWINDOW_H #define MAINWINDOW_H #include QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H qbs-src-3.2.0/tests/auto/api/testdata/generated-files-list/mainwindow.cpp0000644000175100017510000000266615154533055026077 0ustar runnerrunner/**************************************************************************** ** ** 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 "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } qbs-src-3.2.0/tests/auto/api/testdata/qt5-plugin/0000755000175100017510000000000015154533055021203 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/qt5-plugin/echoplugin.cpp0000644000175100017510000000247515154533055024054 0ustar runnerrunner/**************************************************************************** ** ** 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 "echoplugin.h" QString EchoPlugin::echo(const QString &message) { return message; } qbs-src-3.2.0/tests/auto/api/testdata/qt5-plugin/echointerface.h0000644000175100017510000000312215154533055024151 0ustar runnerrunner/**************************************************************************** ** ** 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 ECHOINTERFACE_H #define ECHOINTERFACE_H #include //! [0] class EchoInterface { public: virtual ~EchoInterface() {} virtual QString echo(const QString &message) = 0; }; QT_BEGIN_NAMESPACE #define EchoInterface_iid "org.qt-project.Qt.Examples.EchoInterface" Q_DECLARE_INTERFACE(EchoInterface, EchoInterface_iid) QT_END_NAMESPACE //! [0] #endif qbs-src-3.2.0/tests/auto/api/testdata/qt5-plugin/echoplugin.json.source0000644000175100017510000000000315154533055025523 0ustar runnerrunner{} qbs-src-3.2.0/tests/auto/api/testdata/qt5-plugin/qt5-plugin.qbs0000644000175100017510000000222315154533055023716 0ustar runnerrunnerimport qbs.File import qbs.FileInfo DynamicLibrary { name: "echoplugin" Depends { name: "Qt.core" } Depends { name: "cpp" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } Group { condition: Qt.core.versionMajor >= 5 files: [ "echoplugin.h", "echoplugin.cpp", ] } Group { condition: Qt.core.versionMajor >= 5 files: ["echoplugin.json.source"] fileTags: ["json_in"] } Group { condition: Qt.core.versionMajor < 5 files: "echoplugin_dummy.cpp" } cpp.includePaths: buildDirectory Rule { condition: Qt.core.versionMajor >= 5 inputs: ["json_in"] Artifact { filePath: "echoplugin.json" fileTags: ["qt_plugin_metadata"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + FileInfo.fileName(output.filePath); cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return cmd; } } } qbs-src-3.2.0/tests/auto/api/testdata/qt5-plugin/echoplugin.h0000644000175100017510000000310315154533055023506 0ustar runnerrunner/**************************************************************************** ** ** 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 ECHOPLUGIN_H #define ECHOPLUGIN_H #include #include #include "echointerface.h" class EchoPlugin : public QObject, EchoInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.EchoInterface" FILE "echoplugin.json") Q_INTERFACES(EchoInterface) public: QString echo(const QString &message); }; #endif qbs-src-3.2.0/tests/auto/api/testdata/qt5-plugin/echoplugin_dummy.cpp0000644000175100017510000000235715154533055025266 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ void dummyFunc() {} qbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/0000755000175100017510000000000015154533055024003 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/main.cpp0000644000175100017510000000245315154533055025437 0ustar runnerrunner/**************************************************************************** ** ** 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 HAVE_BLI #error HAVE_BLI missing! #endif int main() { return 0; } qbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/imports/0000755000175100017510000000000015154533055025500 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/imports/Foo.qbs0000644000175100017510000000013615154533055026732 0ustar runnerrunnerProduct { type: "application" consoleApplication: true Depends { name: 'bli' } } qbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/subdir/0000755000175100017510000000000015154533055025273 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/subdir/modules/0000755000175100017510000000000015154533055026743 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/subdir/modules/bli/0000755000175100017510000000000015154533055027511 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/subdir/modules/bli/m.qbs0000644000175100017510000000010615154533055030451 0ustar runnerrunnerModule { Depends {name : "cpp" } cpp.defines: ["HAVE_BLI"] } qbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/prj.qbs0000644000175100017510000000026715154533055025312 0ustar runnerrunnerimport "imports/Foo.qbs" as Foo Project { qbsSearchPaths: "subdir" Project { qbsSearchPaths: "subdir2" Foo { files: "main.cpp" } } } qbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/subdir2/0000755000175100017510000000000015154533055025355 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/subdir2/modules/0000755000175100017510000000000015154533055027025 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/subdir2/modules/bla/0000755000175100017510000000000015154533055027563 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/inherit-qbs-search-paths/subdir2/modules/bla/m.qbs0000644000175100017510000000010615154533055030523 0ustar runnerrunnerModule { Depends {name : "cpp" } cpp.defines: ["HAVE_BLA"] } qbs-src-3.2.0/tests/auto/api/testdata/change-dependent-lib/0000755000175100017510000000000015154533055023133 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/change-dependent-lib/main.cpp0000644000175100017510000000257315154533055024572 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" #include DLL_IMPORT int mylib_hello(); int main() { std::puts("application says hello!"); return mylib_hello(); } qbs-src-3.2.0/tests/auto/api/testdata/change-dependent-lib/change-dependent-lib.qbs0000644000175100017510000000100215154533055027570 0ustar runnerrunnerProject { Application { name : "HelloWorld" Group { files : [ "main.cpp" ] } Depends { name: "cpp" } Depends { name: "mylib" } } DynamicLibrary { name : "mylib" version: "1.2.3" Group { files : [ "mylib.cpp" ] } Depends { name: "cpp" } cpp.defines: ["XXXX"] Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } } qbs-src-3.2.0/tests/auto/api/testdata/change-dependent-lib/mylib.cpp0000644000175100017510000000253415154533055024757 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" #include DLL_EXPORT int mylib_hello() { std::puts("mylib says hello!"); return 0; } qbs-src-3.2.0/tests/auto/api/testdata/group-visibility/0000755000175100017510000000000015154533055022517 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/group-visibility/group-visibility.qbs0000644000175100017510000000027015154533055026546 0ustar runnerrunnerProduct { Depends { name: "m" } Group { name: "should be visible (product)" files: [] } Group { name: "should not be visible (product)" } } qbs-src-3.2.0/tests/auto/api/testdata/group-visibility/modules/0000755000175100017510000000000015154533055024167 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/group-visibility/modules/m/0000755000175100017510000000000015154533055024423 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/group-visibility/modules/m/m.qbs0000644000175100017510000000041115154533055025362 0ustar runnerrunnerModule { Group { name: "should not be visible (module)" Group { name: "should be visible (module)" files: [] Group { name: "should also not be visible (module)" } } } } qbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-resolving/0000755000175100017510000000000015154533055023760 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/infinite-loop-resolving/infinite-loop-resolving.qbs0000644000175100017510000000007015154533055031246 0ustar runnerrunnerProduct { type: { while (true); return "Haha!"; } } qbs-src-3.2.0/tests/auto/api/testdata/link-staticlibs-dynamiclibs/0000755000175100017510000000000015154533055024566 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/link-staticlibs-dynamiclibs/dynamic2.cpp0000644000175100017510000000017115154533055026777 0ustar runnerrunner#include "../dllexport.h" #include DLL_EXPORT void dynamic2_hello() { std::puts("dynamic2 says hello!"); } qbs-src-3.2.0/tests/auto/api/testdata/link-staticlibs-dynamiclibs/main.cpp0000644000175100017510000000020615154533055026214 0ustar runnerrunner#include void static1_hello(); int main() { static1_hello(); std::puts("application says hello!"); return 0; } qbs-src-3.2.0/tests/auto/api/testdata/link-staticlibs-dynamiclibs/static1.cpp0000644000175100017510000000026515154533055026645 0ustar runnerrunner#include "../dllexport.h" #include DLL_IMPORT int dynamic1_hello(); void static1_hello() { int n = dynamic1_hello(); std::printf("static%d says hello!\n", n); } qbs-src-3.2.0/tests/auto/api/testdata/link-staticlibs-dynamiclibs/static2.cpp0000644000175100017510000000030015154533055026634 0ustar runnerrunner#include "../dllexport.h" #include "static2.h" #include DLL_IMPORT void dynamic2_hello(); void TestMe::hello() const { dynamic2_hello(); std::puts("static2 says hello!"); } qbs-src-3.2.0/tests/auto/api/testdata/link-staticlibs-dynamiclibs/static2.h0000644000175100017510000000015415154533055026310 0ustar runnerrunner#ifndef STATIC2_H #define STATIC2_H class TestMe { public: void hello() const; }; #endif // STATIC2_H qbs-src-3.2.0/tests/auto/api/testdata/link-staticlibs-dynamiclibs/dynamic1.cpp0000644000175100017510000000027215154533055027000 0ustar runnerrunner#include "../dllexport.h" #include "static2.h" #include DLL_EXPORT int dynamic1_hello() { TestMe tm; tm.hello(); std::puts("dynamic1 says hello!"); return 1; } qbs-src-3.2.0/tests/auto/api/testdata/link-staticlibs-dynamiclibs/link-staticlibs-dynamiclibs.qbs0000644000175100017510000000310615154533055032665 0ustar runnerrunnerProject { Application { name : "HelloWorld" files : [ "main.cpp" ] Depends { name: "cpp" } Depends { name: "static1" } } StaticLibrary { name: "static1" files: [ "static1.cpp" ] Depends { name: "cpp" } Depends { name: "dynamic1" } Probe { id: osCheck property bool isNormalUnix: qbs.targetOS.includes("unix") && !qbs.targetOS.includes("darwin") property bool isGcc: qbs.toolchain.contains("gcc") property bool isEmscripten: qbs.toolchain.contains("emscripten") configure: { console.info("is normal unix: " + (isNormalUnix ? "yes" : "no")); console.info("is gcc: " + isGcc); console.info("is emscripten: " + isEmscripten); } } } DynamicLibrary { name : "dynamic1" files : [ "dynamic1.cpp" ] Depends { name: "cpp" } Depends { name: "static2" } Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } StaticLibrary { name: "static2" files: [ "static2.cpp", "static2.h" ] Depends { name: "cpp" } Depends { name: "dynamic2" } } DynamicLibrary { name: "dynamic2" files: [ "dynamic2.cpp" ] Depends { name: "cpp" } cpp.visibility: 'hidden' Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } } qbs-src-3.2.0/tests/auto/api/testdata/missing-qobject-header/0000755000175100017510000000000015154533055023522 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/missing-qobject-header/main.cpp0000644000175100017510000000243015154533055025151 0ustar runnerrunner/**************************************************************************** ** ** 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" int main() { MyObject().func(); } qbs-src-3.2.0/tests/auto/api/testdata/missing-qobject-header/myobject.h0000644000175100017510000000247415154533055025516 0ustar runnerrunner/**************************************************************************** ** ** 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 class MyObject : public QObject { Q_OBJECT public: void func(); }; qbs-src-3.2.0/tests/auto/api/testdata/missing-qobject-header/myobject.cpp0000644000175100017510000000241415154533055026043 0ustar runnerrunner/**************************************************************************** ** ** 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" void MyObject::func() { } qbs-src-3.2.0/tests/auto/api/testdata/type-change/0000755000175100017510000000000015154533055021402 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/type-change/main.cpp0000644000175100017510000000235115154533055023033 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/api/testdata/type-change/type-change.qbs0000644000175100017510000000013115154533055024310 0ustar runnerrunnerProduct { files: "main.cpp" Depends { name: "cpp" } // type: "application" } qbs-src-3.2.0/tests/auto/api/testdata/rule-conflict/0000755000175100017510000000000015154533055021744 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/rule-conflict/main.cpp0000644000175100017510000000235115154533055023375 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ int main() {} qbs-src-3.2.0/tests/auto/api/testdata/rule-conflict/pch2.h0000644000175100017510000000233215154533055022751 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ qbs-src-3.2.0/tests/auto/api/testdata/rule-conflict/pch1.h0000644000175100017510000000233215154533055022750 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ qbs-src-3.2.0/tests/auto/api/testdata/rule-conflict/rule-conflict.qbs0000644000175100017510000000023115154533055025215 0ustar runnerrunnerCppApplication { files: "main.cpp" Group { name: "pch files" files: ["pch1.h", "pch2.h"] fileTags: "cpp_pch_src" } } qbs-src-3.2.0/tests/auto/api/testdata/new-output-artifact-in-dependency/0000755000175100017510000000000015154533055025640 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/api/testdata/new-output-artifact-in-dependency/main.cpp0000644000175100017510000000240215154533055027266 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ //void f(); int main() { // f(); } ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/api/testdata/new-output-artifact-in-dependency/new-output-artifact-in-dependency.qbsqbs-src-3.2.0/tests/auto/api/testdata/new-output-artifact-in-dependency/new-output-artifact-in-depen0000644000175100017510000000056115154533055033204 0ustar runnerrunnerProject { Library { type: "dynamiclibrary" //Depends { name: "cpp" } name: "lib" files: "lib.cpp" Properties { condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } } CppApplication { name: "app" files: "main.cpp" Depends { name: "lib" } } } qbs-src-3.2.0/tests/auto/api/testdata/new-output-artifact-in-dependency/lib.cpp0000644000175100017510000000241515154533055027114 0ustar runnerrunner/**************************************************************************** ** ** 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 "../dllexport.h" DLL_EXPORT void f() {} qbs-src-3.2.0/tests/auto/api/tst_api.cpp0000644000175100017510000044534015154533055017546 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** 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 "tst_api.h" #include "../shared.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define VERIFY_NO_ERROR(errorInfo) \ QVERIFY2(!errorInfo.hasError(), qPrintable(errorInfo.toString())) #define WAIT_FOR_NEW_TIMESTAMP() waitForNewTimestamp(m_workingDataDir) class LogSink: public qbs::ILogSink { public: QString output; void doPrintWarning(const qbs::ErrorInfo &error) override { qDebug("%s", qPrintable(error.toString())); warnings.push_back(error); } void doPrintError(const qbs::ErrorInfo &error) override { qDebug("%s", qPrintable(error.toString())); errors.push_back(error); } void doPrintMessage(qbs::LoggerLevel, const QString &message, const QString &) override { output += '\n' + message; } QList warnings; QList errors; }; class BuildDescriptionReceiver : public QObject { Q_OBJECT public: QString descriptions; QStringList descriptionLines; void handleDescription(const QString &, const QString &description) { descriptions += description; descriptionLines << description; } }; class ProcessResultReceiver : public QObject { Q_OBJECT public: QString output; std::vector results; void handleProcessResult(const qbs::ProcessResult &result) { results.push_back(result); output += result.stdErr().join(QLatin1Char('\n')); output += result.stdOut().join(QLatin1Char('\n')); } }; class TaskReceiver : public QObject { Q_OBJECT public: QString taskDescriptions; void handleTaskStart(const QString &task) { taskDescriptions += task; } }; static void removeBuildDir(const qbs::SetupProjectParameters ¶ms) { QString message; const QString dir = params.buildRoot() + '/' + params.configurationName(); if (!qbs::Internal::removeDirectoryWithContents(dir, &message)) qFatal("Could not remove build dir: %s", qPrintable(message)); } static bool waitForFinished(qbs::AbstractJob *job, int timeout = 0) { if (job->state() == qbs::AbstractJob::StateFinished) return true; QEventLoop loop; QObject::connect(job, &qbs::AbstractJob::finished, &loop, &QEventLoop::quit); if (timeout > 0) { QTimer timer; QObject::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); timer.setSingleShot(true); timer.start(timeout); loop.exec(); return timer.isActive(); // Timer ended the loop <=> job did not finish. } loop.exec(); return true; } TestApi::TestApi() : m_logSink(new LogSink) , m_sourceDataDir(testDataSourceDir(SRCDIR "/testdata")) , m_workingDataDir(testWorkDir(QStringLiteral("api"))) { } TestApi::~TestApi() { delete m_logSink; } void TestApi::initTestCase() { QString errorMessage; qbs::Internal::removeDirectoryWithContents(m_workingDataDir, &errorMessage); QVERIFY2(qbs::Internal::copyFileRecursion(m_sourceDataDir, m_workingDataDir, false, true, &errorMessage), qPrintable(errorMessage)); QVERIFY(copyDllExportHeader(m_sourceDataDir, m_workingDataDir)); } void TestApi::init() { m_logSink->warnings.clear(); m_logSink->errors.clear(); m_logSink->setLogLevel(qbs::LoggerInfo); } void TestApi::addQObjectMacroToCppFile() { BuildDescriptionReceiver receiver; qbs::ErrorInfo errorInfo = doBuildProject("add-qobject-macro-to-cpp-file", &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY2(!receiver.descriptions.contains("moc"), qPrintable(receiver.descriptions)); receiver.descriptions.clear(); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("object.cpp", "// ", ""); errorInfo = doBuildProject("add-qobject-macro-to-cpp-file", &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY2(receiver.descriptions.contains("moc"), qPrintable(receiver.descriptions)); } static bool isAboutUndefinedSymbols(const QString &_message) { const QString message = _message.toLower(); return message.contains("undefined") || message.contains("unresolved"); } void TestApi::addedFilePersistent() { // On the initial run, linking will fail. const QString relProjectFilePath = "added-file-persistent"; ProcessResultReceiver receiver; qbs::ErrorInfo errorInfo = doBuildProject(relProjectFilePath, nullptr, &receiver); QVERIFY(errorInfo.hasError()); QVERIFY2(isAboutUndefinedSymbols(receiver.output), qPrintable((receiver.output))); receiver.output.clear(); // Add a file. qbs must schedule it for rule application on the next build. WAIT_FOR_NEW_TIMESTAMP(); const qbs::SetupProjectParameters params = defaultSetupParameters(relProjectFilePath); REPLACE_IN_FILE(params.projectFilePath(), "/* 'file.cpp' */", "'file.cpp'"); std::unique_ptr setupJob(qbs::Project().setupProject(params, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); setupJob.reset(nullptr); // Remove the file again. qbs must unschedule the rule application again. // Consequently, the linking step must fail as in the initial run. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(params.projectFilePath(), "'file.cpp'", "/* 'file.cpp' */"); errorInfo = doBuildProject(relProjectFilePath, nullptr, &receiver); QVERIFY(errorInfo.hasError()); QVERIFY2(isAboutUndefinedSymbols(receiver.output), qPrintable((receiver.output))); // Add the file again. qbs must schedule it for rule application on the next build. WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE(params.projectFilePath(), "/* 'file.cpp' */", "'file.cpp'"); setupJob.reset(qbs::Project().setupProject(params, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); setupJob.reset(nullptr); // qbs must remember that a file was scheduled for rule application. The build must then // succeed, as now all necessary symbols are linked in. errorInfo = doBuildProject(relProjectFilePath); VERIFY_NO_ERROR(errorInfo); } void TestApi::baseProperties() { const qbs::ErrorInfo errorInfo = doBuildProject("base-properties/prj.qbs"); VERIFY_NO_ERROR(errorInfo); } void TestApi::buildGraphInfo() { SettingsPtr s = settings(); qbs::Internal::TemporaryProfile p("bgInfoProfile", s.get()); p.p.setValue("qbs.targetPlatform", "xenix"); qbs::SetupProjectParameters setupParams = defaultSetupParameters("buildgraph-info"); setupParams.setTopLevelProfile(p.p.name()); setupParams.setOverriddenValues({std::make_pair("qbs.architecture", "arm")}); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); const QString bgFilePath = setupParams.buildRoot() + QLatin1Char('/') + relativeBuildGraphFilePath(); QVERIFY2(QFileInfo::exists(bgFilePath), qPrintable(bgFilePath)); qbs::Project::BuildGraphInfo bgInfo = qbs::Project::getBuildGraphInfo(bgFilePath, QStringList()); QVERIFY(bgInfo.error.hasError()); // Build graph is still locked. setupJob.reset(nullptr); const QStringList requestedProperties({"qbs.architecture", "qbs.shellPath", "qbs.targetPlatform"}); bgInfo = qbs::Project::getBuildGraphInfo(bgFilePath, requestedProperties); QVERIFY2(!bgInfo.error.hasError(), qPrintable(bgInfo.error.toString())); QCOMPARE(bgFilePath, bgInfo.bgFilePath); QCOMPARE(bgInfo.profileData.size(), 1); QCOMPARE(bgInfo.profileData.value(p.p.name()).toMap().size(), 1); QCOMPARE(bgInfo.profileData.value(p.p.name()).toMap().value("qbs").toMap().value( "targetPlatform"), p.p.value("qbs.targetPlatform")); QCOMPARE(bgInfo.overriddenProperties, setupParams.overriddenValues()); QCOMPARE(bgInfo.requestedProperties.size(), requestedProperties.size()); QCOMPARE(bgInfo.requestedProperties.value("qbs.architecture").toString(), QString("arm")); QCOMPARE(bgInfo.requestedProperties.value("qbs.shellPath").toString(), QString("/bin/bash")); QCOMPARE(bgInfo.requestedProperties.value("qbs.targetPlatform").toString(), QString("xenix")); } void TestApi::buildErrorCodeLocation() { const qbs::ErrorInfo errorInfo = doBuildProject("build-error-code-location/build-error-code-location.qbs"); QVERIFY(errorInfo.hasError()); const qbs::ErrorItem errorItem = errorInfo.items().front(); QCOMPARE(errorItem.description(), QString("Rule.outputArtifacts must return an array of objects.")); const qbs::CodeLocation errorLoc = errorItem.codeLocation(); QCOMPARE(QFileInfo(errorLoc.filePath()).fileName(), QString("build-error-code-location.qbs")); QCOMPARE(errorLoc.line(), 7); QCOMPARE(errorLoc.column(), 26); } void TestApi::buildGraphLocking() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("buildgraph-locking"); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); const qbs::Project project = setupJob->project(); Q_UNUSED(project); // Case 1: Setting up a competing project from scratch. setupJob.reset(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY(setupJob->error().hasError()); QVERIFY2(setupJob->error().toString().contains("lock"), qPrintable(setupJob->error().toString())); // Case 2: Setting up a non-competing project and then making it competing. qbs::SetupProjectParameters setupParams2 = setupParams; setupParams2.setBuildRoot(setupParams.buildRoot() + "/2"); setupJob.reset(qbs::Project().setupProject(setupParams2, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); const QString buildDirName = relativeBuildDir(setupParams2.configurationName()); const QString lockFile = setupParams2.buildRoot() + '/' + buildDirName + '/' + buildDirName + ".bg.lock"; QVERIFY2(QFileInfo(lockFile).isFile(), qPrintable(lockFile)); qbs::Project project2 = setupJob->project(); QVERIFY(project2.isValid()); setupJob.reset(project2.setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY(setupJob->error().hasError()); QVERIFY2(setupJob->error().toString().contains("lock"), qPrintable(setupJob->error().toString())); QVERIFY2(QFileInfo(lockFile).isFile(), qPrintable(lockFile)); // Case 3: Changing the build directory of an existing project to something non-competing. qbs::SetupProjectParameters setupParams3 = setupParams2; setupParams3.setBuildRoot(setupParams.buildRoot() + "/3"); setupJob.reset(qbs::Project().setupProject(setupParams3, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); project2 = qbs::Project(); QVERIFY2(!QFileInfo(lockFile).exists(), qPrintable(lockFile)); const QString newLockFile = setupParams3.buildRoot() + '/' + buildDirName + '/' + buildDirName + ".bg.lock"; QVERIFY2(QFileInfo(newLockFile).isFile(), qPrintable(newLockFile)); qbs::Project project3 = setupJob->project(); QVERIFY(project3.isValid()); // Case 4: Changing the build directory again, but cancelling the job. setupJob.reset(project3.setupProject(setupParams2, m_logSink, nullptr)); QThread::sleep(1); setupJob->cancel(); waitForFinished(setupJob.get()); QVERIFY(setupJob->error().hasError()); QVERIFY2(!QFileInfo(lockFile).exists(), qPrintable(lockFile)); QVERIFY2(QFileInfo(newLockFile).isFile(), qPrintable(newLockFile)); setupJob.reset(nullptr); project3 = qbs::Project(); QVERIFY2(!QFileInfo(newLockFile).exists(), qPrintable(newLockFile)); } void TestApi::buildProject() { QFETCH(QString, projectSubDir); QFETCH(QString, productNameOrFilePath); const QString projectFilePath = projectSubDir + QLatin1Char('/') + projectSubDir + QLatin1String(".qbs"); qbs::SetupProjectParameters params = defaultSetupParameters(projectFilePath); removeBuildDir(params); ProcessResultReceiver resultReceiver; qbs::ErrorInfo errorInfo = doBuildProject(projectFilePath, nullptr, &resultReceiver); if (resultReceiver.output.contains("mingw32_gt_pch_use_address")) QSKIP("https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91440"); VERIFY_NO_ERROR(errorInfo); QVERIFY(regularFileExists(relativeBuildGraphFilePath())); const QString productFilePath = getProductFilePath(productNameOrFilePath); if (!productFilePath.isEmpty()) { QVERIFY2(regularFileExists(productFilePath), qPrintable(productFilePath)); QVERIFY2(QFile::remove(productFilePath), qPrintable(productFilePath)); } WAIT_FOR_NEW_TIMESTAMP(); qbs::BuildOptions options; options.setForceTimestampCheck(true); errorInfo = doBuildProject(projectFilePath, nullptr, nullptr, nullptr, options); VERIFY_NO_ERROR(errorInfo); if (!productFilePath.isEmpty()) QVERIFY2(regularFileExists(productFilePath), qPrintable(productFilePath)); QVERIFY(regularFileExists(relativeBuildGraphFilePath())); } void TestApi::buildProject_data() { QTest::addColumn("projectSubDir"); QTest::addColumn("productNameOrFilePath"); QTest::newRow("BPs in Sources") << QString("build-properties-source") << QString("HelloWorld"); QTest::newRow("code generator") << QString("codegen") << QString("codegen"); QTest::newRow("link static libs") << QString("link-static-lib") << QString("HelloWorld"); QTest::newRow("link staticlib dynamiclib") << QString("link-staticlib-dynamiclib") << QString("app"); QTest::newRow("precompiled header new") << QString("precompiled-header-new") << QString("MyApp"); QTest::newRow("precompiled header dynamic") << QString("precompiled-header-dynamic") << QString("MyApp"); QTest::newRow("lots of dots") << QString("lots-of-dots") << QString("lots.of.dots"); QTest::newRow("Qt5 plugin") << QString("qt5-plugin") << relativeProductBuildDir("echoplugin") + '/' + qbs::Internal::HostOsInfo::dynamicLibraryName("echoplugin"); QTest::newRow("Q_OBJECT in source") << QString("moc-cpp") << QString("moc_cpp"); QTest::newRow("Q_OBJECT in header") << QString("moc-hpp") << QString("moc_hpp"); QTest::newRow("Q_OBJECT in header, moc_XXX.cpp included") << QString("moc-hpp-included") << QString("moc_hpp_included"); QTest::newRow("app and lib with same source file") << QString("lib-same-source") << QString("HelloWorldApp"); QTest::newRow("source files with the same base name but different extensions") << QString("same-base-name") << QString("basename"); QTest::newRow("simple probes") << QString("simple-probe") << QString("MyApp"); QTest::newRow("application without sources") << QString("app-without-sources") << QString("appWithoutSources"); QTest::newRow("productNameWithDots") << QString("productNameWithDots") << QString("myapp"); QTest::newRow("only default properties") << QString("two-default-property-values") << relativeProductBuildDir("two-default-property-values") + "/set"; QTest::newRow("Export item with Group") << QString("export-item-with-group") << QString("app"); QTest::newRow("QBS-728") << QString("QBS-728") << QString(); } void TestApi::buildProjectDryRun() { QFETCH(QString, projectSubDir); QFETCH(QString, productNameOrFilePath); const QString projectFilePath = projectSubDir + QLatin1Char('/') + projectSubDir + QLatin1String(".qbs"); qbs::SetupProjectParameters params = defaultSetupParameters(projectFilePath); removeBuildDir(params); qbs::BuildOptions options; options.setDryRun(true); const qbs::ErrorInfo errorInfo = doBuildProject(projectFilePath, nullptr, nullptr, nullptr, options); VERIFY_NO_ERROR(errorInfo); QVERIFY2(!QFileInfo::exists(relativeBuildDir()), qPrintable(QDir(relativeBuildDir()) .entryList(QDir::NoDotAndDotDot | QDir::AllEntries | QDir::System).join(", "))); } void TestApi::buildProjectDryRun_data() { return buildProject_data(); } void TestApi::buildSingleFile() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("build-single-file"); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); qbs::Project project = setupJob->project(); qbs::BuildOptions options; options.setFilesToConsider(QStringList(setupParams.buildRoot() + "/compiled.cpp")); options.setActiveFileTags(QStringList("obj")); m_logSink->setLogLevel(qbs::LoggerMaxLevel); std::unique_ptr buildJob(project.buildAllProducts(options)); BuildDescriptionReceiver receiver; ProcessResultReceiver resultReceiver; connect(buildJob.get(), &qbs::BuildJob::reportProcessResult, &resultReceiver, &ProcessResultReceiver::handleProcessResult); connect(buildJob.get(), &qbs::BuildJob::reportCommandDescription, &receiver, &BuildDescriptionReceiver::handleDescription); waitForFinished(buildJob.get()); if (resultReceiver.output.contains("mingw32_gt_pch_use_address")) QSKIP("https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91440"); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); QCOMPARE(receiver.descriptions.count("compiling"), 2); QCOMPARE(receiver.descriptions.count("precompiling"), 1); QVERIFY2(receiver.descriptions.contains("generating generated.h"), qPrintable(receiver.descriptions)); QVERIFY2(receiver.descriptions.contains("compiling compiled.cpp"), qPrintable(receiver.descriptions)); } void TestApi::canonicalToolchainList() { // All the known toolchain lists should be equal QCOMPARE(qbs::canonicalToolchain(QStringList({"xcode", "clang", "llvm", "gcc"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"clang", "llvm", "gcc"})), QStringList({"clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"clang-cl", "msvc"})), QStringList({"clang-cl", "msvc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"llvm", "gcc"})), QStringList({"llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"mingw", "gcc"})), QStringList({"mingw", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"gcc"})), QStringList({"gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"msvc"})), QStringList({"msvc"})); // Single names should canonicalize to the known lists QCOMPARE(qbs::canonicalToolchain(QStringList({"xcode"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"clang"})), QStringList({"clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"clang-cl"})), QStringList({"clang-cl", "msvc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"llvm"})), QStringList({"llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"mingw"})), QStringList({"mingw", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"gcc"})), QStringList({"gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"msvc"})), QStringList({"msvc"})); // Missing some in the middle QCOMPARE(qbs::canonicalToolchain(QStringList({"xcode", "llvm", "gcc"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"xcode", "clang", "gcc"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"xcode", "gcc"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"clang", "llvm"})), QStringList({"clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"clang", "gcc"})), QStringList({"clang", "llvm", "gcc"})); // Sorted wrong, missing some in the middle QCOMPARE(qbs::canonicalToolchain(QStringList({"gcc", "llvm", "clang", "xcode"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"clang", "gcc", "llvm", "xcode"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"llvm", "clang", "xcode", "gcc"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"gcc", "llvm", "clang"})), QStringList({"clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"gcc", "clang", "xcode"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"gcc", "llvm"})), QStringList({"llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"gcc", "mingw"})), QStringList({"mingw", "gcc"})); // Duplicates QCOMPARE(qbs::canonicalToolchain(QStringList({"gcc", "llvm", "clang", "xcode", "xcode", "xcode"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"clang", "gcc", "llvm", "clang", "xcode"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"llvm", "clang", "clang", "xcode", "xcode", "gcc"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"llvm", "clang", "gcc", "llvm", "clang"})), QStringList({"clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"xcode", "gcc", "clang", "gcc", "clang", "xcode"})), QStringList({"xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"llvm", "gcc", "llvm", "llvm"})), QStringList({"llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain(QStringList({"gcc", "gcc", "gcc", "mingw"})), QStringList({"mingw", "gcc"})); // Custom insanity QCOMPARE(qbs::canonicalToolchain( QStringList({"crazy", "gcc", "llvm", "clang", "xcode", "insane"})), QStringList({"crazy", "insane", "xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain( QStringList({"crazy", "gcc", "llvm", "clang", "xcode", "insane", "crazy"})), QStringList({"crazy", "insane", "xcode", "clang", "llvm", "gcc"})); QCOMPARE(qbs::canonicalToolchain( QStringList({"crazy", "insane", "gcc", "trade", "llvm", "clang", "xcode", "insane", "mark", "crazy"})), QStringList({"crazy", "insane", "trade", "mark", "xcode", "clang", "llvm", "gcc"})); } void TestApi::checkOutputs() { QFETCH(bool, check); qbs::SetupProjectParameters params = defaultSetupParameters("/check-outputs"); qbs::BuildOptions options; options.setForceOutputCheck(check); removeBuildDir(params); qbs::ErrorInfo errorInfo = doBuildProject("/check-outputs", nullptr, nullptr, nullptr, options); if (check) QVERIFY(errorInfo.hasError()); else VERIFY_NO_ERROR(errorInfo); } void TestApi::checkOutputs_data() { QTest::addColumn("check"); QTest::newRow("checked outputs") << true; QTest::newRow("unchecked outputs") << false; } qbs::GroupData findGroup(const qbs::ProductData &product, const QString &name) { const auto groups = product.groups(); for (const qbs::GroupData &g : groups) { if (g.name() == name) return g; } return qbs::GroupData(); } static qbs::Project::ProductSelection defaultProducts() { return qbs::Project::ProductSelectionDefaultOnly; } void TestApi::changeContent() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("project-editing"); std::unique_ptr job; qbs::Project project; qbs::ProjectData projectData; qbs::ProductData product; const auto resolve = [&] { job.reset(project.setupProject(setupParams, m_logSink, 0)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); project = job->project(); projectData = project.projectData(); QCOMPARE(projectData.allProducts().size(), 1); product = projectData.allProducts().front(); }; resolve(); QVERIFY(product.groups().size() >= 5); // Error handling: Invalid product. qbs::ErrorInfo errorInfo = project.addGroup(qbs::ProductData(), "blubb"); QVERIFY(errorInfo.hasError()); QVERIFY(errorInfo.toString().contains("invalid")); // Error handling: Empty group name. errorInfo = project.addGroup(product, QString()); QVERIFY(errorInfo.hasError()); QVERIFY(errorInfo.toString().contains("empty")); WAIT_FOR_NEW_TIMESTAMP(); errorInfo = project.addGroup(product, "New Group 1"); VERIFY_NO_ERROR(errorInfo); errorInfo = project.addGroup(product, "New Group 2"); VERIFY_NO_ERROR(errorInfo); resolve(); QVERIFY(product.groups().size() >= 10); // Error handling: Group already inserted. errorInfo = project.addGroup(product, "New Group 1"); QVERIFY(errorInfo.hasError()); QVERIFY(errorInfo.toString().contains("already")); // Error handling: Add list of files with double entries. errorInfo = project.addFiles(product, qbs::GroupData(), QStringList() << "file.cpp" << "file.cpp"); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("more than once"), qPrintable(errorInfo.toString())); // Add files to empty array literal. WAIT_FOR_NEW_TIMESTAMP(); qbs::GroupData group = findGroup(product, "New Group 1"); QVERIFY(group.isValid()); errorInfo = project.addFiles(product, group, QStringList() << "file.h" << "file.cpp"); VERIFY_NO_ERROR(errorInfo); // Error handling: Add the same file again. resolve(); group = findGroup(product, "New Group 1"); QVERIFY(group.isValid()); errorInfo = project.addFiles(product, group, QStringList() << "file.cpp"); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("already"), qPrintable(errorInfo.toString())); // Remove one of the newly added files again. WAIT_FOR_NEW_TIMESTAMP(); errorInfo = project.removeFiles(product, group, QStringList("file.h")); VERIFY_NO_ERROR(errorInfo); // Error handling: Try to remove the same file again. resolve(); group = findGroup(product, "New Group 1"); QVERIFY(group.isValid()); errorInfo = project.removeFiles(product, group, QStringList() << "file.h"); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("not known"), qPrintable(errorInfo.toString())); // Error handling: Try to remove a file from a complex list. group = findGroup(product, "Existing Group 2"); QVERIFY(group.isValid()); errorInfo = project.removeFiles(product, group, QStringList() << "existingfile2.txt"); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("complex"), qPrintable(errorInfo.toString())); // Remove file from product's 'files' binding. WAIT_FOR_NEW_TIMESTAMP(); errorInfo = project.removeFiles(product, qbs::GroupData(), QStringList("main.cpp")); VERIFY_NO_ERROR(errorInfo); resolve(); // Add file to non-empty array literal. WAIT_FOR_NEW_TIMESTAMP(); group = findGroup(product, "Existing Group 1"); QVERIFY(group.isValid()); errorInfo = project.addFiles(product, group, QStringList() << "newfile1.txt"); VERIFY_NO_ERROR(errorInfo); resolve(); // Add files to list represented as a single string. WAIT_FOR_NEW_TIMESTAMP(); errorInfo = project.addFiles(product, qbs::GroupData(), QStringList() << "newfile2.txt"); VERIFY_NO_ERROR(errorInfo); resolve(); // Add files to list represented as an identifier. WAIT_FOR_NEW_TIMESTAMP(); group = findGroup(product, "Existing Group 2"); QVERIFY(group.isValid()); errorInfo = project.addFiles(product, group, QStringList() << "newfile3.txt"); VERIFY_NO_ERROR(errorInfo); resolve(); // Add files to list represented as a block of code (not yet implemented). group = findGroup(product, "Existing Group 3"); QVERIFY(group.isValid()); errorInfo = project.addFiles(product, group, QStringList() << "newfile4.txt"); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("complex"), qPrintable(errorInfo.toString())); // Add file to group with directory prefix. WAIT_FOR_NEW_TIMESTAMP(); group = findGroup(product, "Existing Group 4"); QVERIFY(group.isValid()); errorInfo = project.addFiles(product, group, QStringList() << "file.txt"); VERIFY_NO_ERROR(errorInfo); resolve(); // Error handling: Add file to group with non-directory prefix. group = findGroup(product, "Existing Group 5"); QVERIFY(group.isValid()); errorInfo = project.addFiles(product, group, QStringList() << "newfile1.txt"); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("prefix"), qPrintable(errorInfo.toString())); // Remove group. WAIT_FOR_NEW_TIMESTAMP(); group = findGroup(product, "Existing Group 5"); QVERIFY(group.isValid()); errorInfo = project.removeGroup(product, group); VERIFY_NO_ERROR(errorInfo); resolve(); // Error handling: Try to remove the same group again. errorInfo = project.removeGroup(product, group); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("does not exist"), qPrintable(errorInfo.toString())); // Add a file to a group where the file name is already matched by a wildcard. projectData = project.projectData(); QVERIFY(projectData.products().size() == 1); product = projectData.products().front(); group = findGroup(product, "Group with wildcards"); QVERIFY(group.isValid()); QFile newFile("koerper.klaus"); QVERIFY2(newFile.open(QIODevice::WriteOnly), qPrintable(newFile.errorString())); newFile.close(); errorInfo = project.addFiles(product, group, QStringList() << newFile.fileName()); VERIFY_NO_ERROR(errorInfo); resolve(); group = findGroup(product, "Group with wildcards"); QVERIFY(group.isValid()); QCOMPARE(group.sourceArtifactsFromWildcards().size(), 1); QCOMPARE(group.sourceArtifactsFromWildcards().front().filePath(), QFileInfo(newFile).absoluteFilePath()); // Error checking: Try to remove a file that originates from a wildcard pattern. projectData = project.projectData(); QVERIFY(projectData.products().size() == 1); product = projectData.products().front(); group = findGroup(product, "Other group with wildcards"); QVERIFY(group.isValid()); errorInfo = project.removeFiles(product, group, QStringList() << "test.wildcard"); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("pattern"), qPrintable(errorInfo.toString())); // Check whether building will take the added and removed cpp files into account. // This must not be moved below the re-resolving test!!! qbs::BuildOptions buildOptions; buildOptions.setDryRun(true); BuildDescriptionReceiver rcvr; std::unique_ptr buildJob(project.buildAllProducts(buildOptions, defaultProducts(), this)); connect(buildJob.get(), &qbs::BuildJob::reportCommandDescription, &rcvr, &BuildDescriptionReceiver::handleDescription); waitForFinished(buildJob.get()); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); QVERIFY(rcvr.descriptions.contains("compiling file.cpp")); QVERIFY(!rcvr.descriptions.contains("compiling main.cpp")); // Error handling: Try to change the project during a build. buildJob.reset(project.buildAllProducts(buildOptions, defaultProducts(), this)); errorInfo = project.addGroup(projectData.products().front(), "blubb"); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("in progress"), qPrintable(errorInfo.toString())); waitForFinished(buildJob.get()); errorInfo = project.addGroup(projectData.products().front(), "blubb"); VERIFY_NO_ERROR(errorInfo); project = qbs::Project(); job.reset(nullptr); buildJob.reset(nullptr); removeBuildDir(setupParams); // Add a file to the top level of a product that does not have a "files" binding yet. setupParams.setProjectFilePath(QDir::cleanPath(m_workingDataDir + "/project-editing/project-with-no-files.qbs")); resolve(); WAIT_FOR_NEW_TIMESTAMP(); errorInfo = project.addFiles(product, qbs::GroupData(), QStringList("main.cpp")); VERIFY_NO_ERROR(errorInfo); resolve(); rcvr.descriptions.clear(); buildJob.reset(project.buildAllProducts(buildOptions, defaultProducts(), this)); connect(buildJob.get(), &qbs::BuildJob::reportCommandDescription, &rcvr, &BuildDescriptionReceiver::handleDescription); waitForFinished(buildJob.get()); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); QVERIFY(rcvr.descriptions.contains("compiling main.cpp")); job.reset(project.setupProject(setupParams, m_logSink, 0)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); } void TestApi::commandExtraction() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("/command-extraction"); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); qbs::Project project = setupJob->project(); qbs::ProjectData projectData = project.projectData(); QCOMPARE(projectData.allProducts().size(), 1); qbs::ProductData productData = projectData.allProducts().front(); qbs::ErrorInfo errorInfo; const QString projectDirPath = QDir::cleanPath(QFileInfo(setupParams.projectFilePath()).path()); const QString sourceFilePath = projectDirPath + "/main.cpp"; // Before the first build, no rules exist. qbs::RuleCommandList commands = project.ruleCommands(productData, sourceFilePath, "obj", &errorInfo); QCOMPARE(commands.size(), 0); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("No rule"), qPrintable(errorInfo.toString())); qbs::BuildOptions options; options.setDryRun(true); std::unique_ptr buildJob(project.buildAllProducts(options)); waitForFinished(buildJob.get()); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); projectData = project.projectData(); QCOMPARE(projectData.allProducts().size(), 1); productData = projectData.allProducts().front(); errorInfo = qbs::ErrorInfo(); // After the build, the compile command must be found. commands = project.ruleCommands(productData, sourceFilePath, "obj", &errorInfo); QCOMPARE(commands.size(), 1); QVERIFY2(!errorInfo.hasError(), qPrintable(errorInfo.toString())); const qbs::RuleCommand command = commands.front(); QCOMPARE(command.type(), qbs::RuleCommand::ProcessCommandType); QVERIFY(!command.executable().isEmpty()); QVERIFY(!command.arguments().empty()); } void TestApi::dependencyOnMultiplexedType() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("/dependency-on-multiplexed-type"); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); qbs::Project project = setupJob->project(); qbs::ProjectData projectData = project.projectData(); const QList allProducts = projectData.allProducts(); QCOMPARE(allProducts.size(), 5); int depCount = 0; int p1Count = 0; int p2Count = 0; for (const qbs::ProductData &p : allProducts) { if (p.name() == "dep") { ++depCount; QCOMPARE(p.dependencies().size(), 0); } else if (p.name() == "p1") { ++p1Count; if (p.multiplexConfigurationId().isEmpty()) // aggregate QCOMPARE(p.dependencies().size(), 3); else QCOMPARE(p.dependencies().size(), 1); } else { QVERIFY(p.name() == "p2"); ++p2Count; QVERIFY(p.dependencies().contains("dep")); } } QCOMPARE(depCount, 1); QCOMPARE(p1Count, 3); QCOMPARE(p2Count, 1); std::unique_ptr buildJob(project.buildAllProducts(qbs::BuildOptions())); waitForFinished(buildJob.get()); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); } void TestApi::changeDependentLib() { qbs::ErrorInfo errorInfo = doBuildProject("change-dependent-lib"); VERIFY_NO_ERROR(errorInfo); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("change-dependent-lib.qbs", "cpp.defines: [\"XXXX\"]", "cpp.defines: [\"ABCD\"]"); errorInfo = doBuildProject("change-dependent-lib"); VERIFY_NO_ERROR(errorInfo); } void TestApi::enableAndDisableProduct() { BuildDescriptionReceiver bdr; qbs::ErrorInfo errorInfo = doBuildProject("enable-and-disable-product", &bdr); VERIFY_NO_ERROR(errorInfo); QVERIFY(!bdr.descriptions.contains("compiling")); WAIT_FOR_NEW_TIMESTAMP(); QFile projectFile("enable-and-disable-product.qbs"); QVERIFY(projectFile.open(QIODevice::ReadWrite)); QByteArray content = projectFile.readAll(); content.replace("undefined", "'hidden'"); projectFile.resize(0); projectFile.write(content); projectFile.close(); bdr.descriptions.clear(); errorInfo = doBuildProject("enable-and-disable-product", &bdr); VERIFY_NO_ERROR(errorInfo); QVERIFY(bdr.descriptions.contains("linking")); WAIT_FOR_NEW_TIMESTAMP(); touch("main.cpp"); QVERIFY(projectFile.open(QIODevice::ReadWrite)); content = projectFile.readAll(); content.replace("'hidden'", "undefined"); projectFile.resize(0); projectFile.write(content); projectFile.close(); bdr.descriptions.clear(); errorInfo = doBuildProject("enable-and-disable-product", &bdr); VERIFY_NO_ERROR(errorInfo); QVERIFY(!bdr.descriptions.contains("compiling")); } void TestApi::errorInSetupRunEnvironment() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("error-in-setup-run-environment"); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); const qbs::Project project = job->project(); QVERIFY(project.isValid()); QCOMPARE(project.projectData().products().size(), 1); const qbs::ProductData product = project.projectData().products().front(); bool exceptionCaught = false; try { const SettingsPtr s = settings(); qbs::RunEnvironment runEnv = project.getRunEnvironment(product, qbs::InstallOptions(), QProcessEnvironment(), QStringList(), s.get()); qbs::ErrorInfo error; const QProcessEnvironment env = runEnv.runEnvironment(&error); QVERIFY(error.hasError()); QVERIFY2(error.toString().contains("trallala"), qPrintable(error.toString())); } catch (const qbs::ErrorInfo &) { exceptionCaught = true; } QVERIFY(!exceptionCaught); } void TestApi::excludedInputs() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("excluded-inputs"); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); const qbs::Project project = job->project(); std::unique_ptr buildJob(project.buildAllProducts(qbs::BuildOptions())); waitForFinished(buildJob.get()); QVERIFY2(!buildJob->error().hasError(), qPrintable(job->error().toString())); QVERIFY(project.isValid()); const qbs::ProjectData projectData = project.projectData(); QCOMPARE(projectData.products().size(), 2); qbs::ProductData depProduct; qbs::ProductData pProduct; for (const qbs::ProductData &p : projectData.products()) { if (p.name() == "dep") depProduct = p; else if (p.name() == "p") pProduct = p; } QVERIFY(depProduct.isValid()); QVERIFY(pProduct.isValid()); int theTagCount = 0; for (const qbs::ArtifactData &artifact : depProduct.targetArtifacts()) { if (!artifact.fileTags().contains("the_tag")) continue; ++theTagCount; QFile f(artifact.filePath()); QVERIFY2(f.open(QIODevice::ReadOnly), qPrintable(f.errorString())); const QByteArray content = f.readAll(); QVERIFY2(content.contains("the_content"), content.constData()); QCOMPARE(artifact.fileTags().contains("the_other_tag"), content.contains("the_other_content")); } QCOMPARE(theTagCount, 2); int dummyCount = 0; for (const qbs::ArtifactData &artifact : pProduct.targetArtifacts()) { QFileInfo fi(artifact.filePath()); QVERIFY2(fi.exists(), qPrintable(fi.filePath())); if (fi.fileName().startsWith("dummy")) ++dummyCount; } QCOMPARE(dummyCount, 3); } static qbs::ErrorInfo forceRuleEvaluation(const qbs::Project &project) { qbs::BuildOptions buildOptions; buildOptions.setDryRun(true); std::unique_ptr buildJob(project.buildAllProducts(buildOptions)); waitForFinished(buildJob.get()); return buildJob->error(); } void TestApi::disabledInstallGroup() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("disabled_install_group"); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); const qbs::Project project = job->project(); const qbs::ErrorInfo errorInfo = forceRuleEvaluation(project); VERIFY_NO_ERROR(errorInfo); qbs::ProjectData projectData = project.projectData(); QCOMPARE(projectData.allProducts().size(), 1); qbs::ProductData product = projectData.allProducts().front(); const QList targets = product.targetArtifacts(); QCOMPARE(targets.size(), 1); QVERIFY(targets.front().isGenerated()); QVERIFY(targets.front().isExecutable()); QVERIFY(targets.front().isTargetArtifact()); QCOMPARE(projectData.installableArtifacts().size(), 0); QCOMPARE(product.targetExecutable(), targets.front().filePath()); } void TestApi::disabledProduct() { const qbs::ErrorInfo errorInfo = doBuildProject("disabled-product"); VERIFY_NO_ERROR(errorInfo); } void TestApi::disabledProject() { const qbs::ErrorInfo errorInfo = doBuildProject("disabled-project"); VERIFY_NO_ERROR(errorInfo); } void TestApi::disappearedWildcardFile() { const qbs::SetupProjectParameters setupParams = defaultSetupParameters("disappeared-wildcard-file/disappeared-wildcard-file.qbs"); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); QVERIFY(waitForFinished(setupJob.get())); VERIFY_NO_ERROR(setupJob->error()); qbs::Project project = setupJob->project(); qbs::ProjectData projectData = project.projectData(); QVERIFY(projectData.isValid()); QList products = projectData.allProducts(); QCOMPARE(products.size(), 1); QCOMPARE(products.first().groups().size(), 1); QCOMPARE(products.first().groups().first().allFilePaths().size(), 2); std::unique_ptr buildJob(project.buildAllProducts({})); QVERIFY(waitForFinished(buildJob.get())); VERIFY_NO_ERROR(buildJob->error()); WAIT_FOR_NEW_TIMESTAMP(); const QString fileToRemove = QFileInfo(setupParams.projectFilePath()).path() + "/file2.txt"; QVERIFY(QFile::remove(fileToRemove)); buildJob.reset(project.buildAllProducts({})); QVERIFY(waitForFinished(buildJob.get())); QVERIFY(buildJob->error().hasError()); QVERIFY2(buildJob->error().toString().contains( tr("Source file '%1' has disappeared.") .arg(fileToRemove)), qPrintable(buildJob->error().toString())); setupJob.reset(project.setupProject(setupParams, m_logSink, nullptr)); QVERIFY(waitForFinished(setupJob.get())); VERIFY_NO_ERROR(setupJob->error()); project = setupJob->project(); projectData = project.projectData(); QVERIFY(projectData.isValid()); products = projectData.allProducts(); QCOMPARE(products.size(), 1); QCOMPARE(products.first().groups().size(), 1); QCOMPARE(products.first().groups().first().allFilePaths().size(), 1); buildJob.reset(project.buildAllProducts({})); QVERIFY(waitForFinished(buildJob.get())); VERIFY_NO_ERROR(buildJob->error()); } void TestApi::renamedQbsSource() { const qbs::SetupProjectParameters setupParams = defaultSetupParameters("renamed-qbs-source-file/renamed-qbs-source-file.qbs"); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); QVERIFY(waitForFinished(setupJob.get())); VERIFY_NO_ERROR(setupJob->error()); qbs::Project project = setupJob->project(); QCOMPARE(project.projectData().allProducts().size(), 2); std::unique_ptr buildJob(project.buildAllProducts({})); QVERIFY(waitForFinished(buildJob.get())); VERIFY_NO_ERROR(buildJob->error()); WAIT_FOR_NEW_TIMESTAMP(); const QString oldFilePath = QFileInfo(setupParams.projectFilePath()).path() + "/the-product/the-prodduct.qbs"; const QString newFilePath = QFileInfo(setupParams.projectFilePath()).path() + "/the-product/the-product.qbs"; QVERIFY(QFile::rename(oldFilePath, newFilePath)); REPLACE_IN_FILE(setupParams.projectFilePath(), "prodduct", "product"); buildJob.reset(project.buildAllProducts({})); QVERIFY(waitForFinished(buildJob.get())); QVERIFY(buildJob->error().hasError()); QVERIFY2(buildJob->error().toString().contains( tr("Source file '%1' has disappeared.") .arg(oldFilePath)), qPrintable(buildJob->error().toString())); setupJob.reset(project.setupProject(setupParams, m_logSink, nullptr)); QVERIFY(waitForFinished(setupJob.get())); VERIFY_NO_ERROR(setupJob->error()); project = setupJob->project(); QCOMPARE(project.projectData().allProducts().size(), 2); buildJob.reset(project.buildAllProducts({})); QVERIFY(waitForFinished(buildJob.get())); VERIFY_NO_ERROR(buildJob->error()); } void TestApi::duplicateProductNames() { QFETCH(QString, projectFileName); const qbs::ErrorInfo errorInfo = doBuildProject("duplicate-product-names/" + projectFileName); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("Duplicate product name"), qPrintable(errorInfo.toString())); } void TestApi::duplicateProductNames_data() { QTest::addColumn("projectFileName"); QTest::newRow("Names explicitly set") << QString("explicit.qbs"); QTest::newRow("Unnamed products in same file") << QString("implicit.qbs"); QTest::newRow("Unnamed products in files of the same name") << QString("implicit-indirect.qbs"); } void TestApi::emptyFileTagList() { const qbs::ErrorInfo errorInfo = doBuildProject("empty-filetag-list"); VERIFY_NO_ERROR(errorInfo); } void TestApi::emptySubmodulesList() { const qbs::ErrorInfo errorInfo = doBuildProject("empty-submodules-list"); VERIFY_NO_ERROR(errorInfo); } void TestApi::explicitlyDependsOn() { BuildDescriptionReceiver receiver; qbs::ErrorInfo errorInfo = doBuildProject("explicitly-depends-on", &receiver); VERIFY_NO_ERROR(errorInfo); if (m_logSink->output.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QVERIFY2(receiver.descriptions.contains("compiling compiler.cpp"), qPrintable(receiver.descriptions)); QVERIFY2(receiver.descriptions.contains("compiling a.in"), qPrintable(receiver.descriptions)); QVERIFY2(receiver.descriptions.contains("compiling b.in"), qPrintable(receiver.descriptions)); QVERIFY2(receiver.descriptions.contains("compiling c.in"), qPrintable(receiver.descriptions)); QFile txtFile(relativeProductBuildDir("p") + "/compiler-name.txt"); QVERIFY2(txtFile.open(QIODevice::ReadOnly), qPrintable(txtFile.errorString())); const QByteArray content = txtFile.readAll(); QCOMPARE(content, QByteArray("compiler file name: compiler")); receiver.descriptions.clear(); errorInfo = doBuildProject("explicitly-depends-on", &receiver); QVERIFY2(!receiver.descriptions.contains("compiling compiler.cpp"), qPrintable(receiver.descriptions)); QVERIFY2(!receiver.descriptions.contains("compiling a.in"), qPrintable(receiver.descriptions)); QVERIFY2(!receiver.descriptions.contains("compiling b.in"), qPrintable(receiver.descriptions)); QVERIFY2(!receiver.descriptions.contains("compiling c.in"), qPrintable(receiver.descriptions)); VERIFY_NO_ERROR(errorInfo); WAIT_FOR_NEW_TIMESTAMP(); touch("compiler.cpp"); waitForFileUnlock(); errorInfo = doBuildProject("explicitly-depends-on", &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY2(receiver.descriptions.contains("compiling compiler.cpp"), qPrintable(receiver.descriptions)); QVERIFY2(receiver.descriptions.contains("compiling a.in"), qPrintable(receiver.descriptions)); QVERIFY2(receiver.descriptions.contains("compiling b.in"), qPrintable(receiver.descriptions)); QVERIFY2(receiver.descriptions.contains("compiling c.in"), qPrintable(receiver.descriptions)); } void TestApi::exportSimple() { const qbs::ErrorInfo errorInfo = doBuildProject("export-simple"); VERIFY_NO_ERROR(errorInfo); } void TestApi::exportWithRecursiveDepends() { const qbs::ErrorInfo errorInfo = doBuildProject("export-with-recursive-depends"); VERIFY_NO_ERROR(errorInfo); } void TestApi::fallbackGcc() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("fallback-gcc/fallback-gcc.qbs"); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); VERIFY_NO_ERROR(job->error()); qbs::ProjectData project = job->project().projectData(); QVERIFY(project.isValid()); QList products = project.allProducts(); QCOMPARE(products.size(), 2); for (const qbs::ProductData &p : std::as_const(products)) { if (p.profile() == "unixProfile") { qbs::PropertyMap moduleProps = p.moduleProperties(); QCOMPARE(moduleProps.getModuleProperty("qbs", "targetOS").toStringList(), QStringList({"unix"})); QCOMPARE(moduleProps.getModuleProperty("qbs", "toolchain").toStringList(), QStringList({"gcc"})); QCOMPARE(QFileInfo(moduleProps.getModuleProperty("cpp", "cxxCompilerName").toString()) .completeBaseName(), QString("g++")); QCOMPARE(moduleProps.getModuleProperty("cpp", "dynamicLibrarySuffix").toString(), QString(".so")); } else { QCOMPARE(p.profile(), QString("gccProfile")); qbs::PropertyMap moduleProps = p.moduleProperties(); QCOMPARE(moduleProps.getModuleProperty("qbs", "targetOS").toStringList(), QStringList()); QCOMPARE(moduleProps.getModuleProperty("qbs", "toolchain").toStringList(), QStringList({"gcc"})); QCOMPARE(QFileInfo(moduleProps.getModuleProperty("cpp", "cxxCompilerName").toString()) .completeBaseName(), QString("g++")); QCOMPARE(moduleProps.getModuleProperty("cpp", "dynamicLibrarySuffix").toString(), QString()); } } } void TestApi::fileTagger() { BuildDescriptionReceiver receiver; const qbs::ErrorInfo errorInfo = doBuildProject("file-tagger/moc_cpp.qbs", &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY2(receiver.descriptions.contains("moc bla.cpp"), qPrintable(receiver.descriptions)); } void TestApi::fileTagsFilterOverride() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("filetagsfilter_override"); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); qbs::Project project = job->project(); const qbs::ErrorInfo errorInfo = forceRuleEvaluation(project); VERIFY_NO_ERROR(errorInfo); qbs::ProjectData projectData = project.projectData(); QCOMPARE(projectData.allProducts().size(), 1); const qbs::ProductData product = projectData.allProducts().front(); QList installableFiles = product.installableArtifacts(); QCOMPARE(installableFiles.size(), 1); QVERIFY(installableFiles.front().installData().installFilePath().contains("habicht")); } void TestApi::generatedFilesList() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("generated-files-list"); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); QVERIFY(waitForFinished(setupJob.get())); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); const bool isEmscripten = m_logSink->output.contains("is emscripten: true"); const bool isNotEmscripten = m_logSink->output.contains("is emscripten: false"); QCOMPARE(isEmscripten, !isNotEmscripten); qbs::Project project = setupJob->project(); qbs::BuildOptions options; options.setExecuteRulesOnly(true); const std::unique_ptr buildJob(project.buildAllProducts(options)); QVERIFY(waitForFinished(buildJob.get())); VERIFY_NO_ERROR(buildJob->error()); const qbs::ProjectData projectData = project.projectData(); QCOMPARE(projectData.products().size(), 1); const qbs::ProductData product = projectData.products().front(); QString uiFilePath; QVERIFY(product.generatedArtifacts().size() >= 6); const auto &artifacts = product.generatedArtifacts(); for (const qbs::ArtifactData &a : artifacts) { QVERIFY(a.isGenerated()); QFileInfo fi(a.filePath()); using qbs::Internal::HostOsInfo; const QStringList possibleFileNames = QStringList() << "main.cpp.o" << "main.cpp.obj" << "mainwindow.cpp.o" << "mainwindow.cpp.obj" << "moc_mainwindow.cpp" << "moc_mainwindow.cpp.o" << "moc_mainwindow.cpp.obj" << "ui_mainwindow.h" << "generated-files-list.wasm" << "generated-files-list.worker.js" << "generated-files-list.js" << "generated-files-list.html" << qbs::Internal::HostOsInfo::appendExecutableSuffix( "generated-files-list"); QVERIFY2(possibleFileNames.contains(fi.fileName()) || fi.fileName().endsWith(".plist") || fi.fileName().contains("qt_plugin_import"), qPrintable(fi.fileName())); } const auto groups = product.groups(); for (const qbs::GroupData &group : groups) { const auto artifacts = group.sourceArtifacts(); for (const qbs::ArtifactData &a : artifacts) { QVERIFY(!a.isGenerated()); QVERIFY(!a.isTargetArtifact()); if (a.fileTags().contains(QLatin1String("ui"))) { uiFilePath = a.filePath(); break; } } if (!uiFilePath.isEmpty()) break; } QVERIFY(!uiFilePath.isEmpty()); const QStringList directParents = project.generatedFiles(product, uiFilePath, false); QCOMPARE(directParents.size(), 1); const QFileInfo uiHeaderFileInfo(directParents.front()); QCOMPARE(uiHeaderFileInfo.fileName(), QStringLiteral("ui_mainwindow.h")); QVERIFY(!uiHeaderFileInfo.exists()); const QStringList allParents = project.generatedFiles(product, uiFilePath, true); if (isEmscripten) QCOMPARE(allParents.size(), 5); //built with "-pthread" support else QCOMPARE(allParents.size(), 3); } void TestApi::groupVisibility() { qbs::SetupProjectParameters setupParams = defaultSetupParameters( "group-visibility/group-visibility.qbs"); std::unique_ptr job( qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); qbs::ProjectData project = job->project().projectData(); QCOMPARE(project.allProducts().size(), 1); qbs::ProductData product = project.allProducts().front(); const QList groups = product.groups(); QCOMPARE(groups.size(), 3); for (const qbs::GroupData &g : groups) { QVERIFY2( g.name().contains("should be visible") || g.name() == "group-visibility", qPrintable(g.name())); } } void TestApi::infiniteLoopBuilding() { QFETCH(QString, projectDirName); qbs::SetupProjectParameters setupParams = defaultSetupParameters(projectDirName + "/infinite-loop.qbs"); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); qbs::Project project = setupJob->project(); const std::unique_ptr buildJob(project.buildAllProducts(qbs::BuildOptions())); QTimer::singleShot(1000, buildJob.get(), &qbs::AbstractJob::cancel); QVERIFY(waitForFinished(buildJob.get(), testTimeoutInMsecs())); QVERIFY(buildJob->error().hasError()); } void TestApi::infiniteLoopBuilding_data() { QTest::addColumn("projectDirName"); QTest::newRow("JS Command") << QString("infinite-loop-js"); QTest::newRow("Process Command") << QString("infinite-loop-process"); QTest::newRow("Scanner (scan property)") << QString("infinite-loop-scanning-scan"); QTest::newRow("Scanner (searchPaths property)") << QString("infinite-loop-scanning-searchpaths"); } void TestApi::infiniteLoopResolving() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("infinite-loop-resolving"); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); QTimer::singleShot(1000, setupJob.get(), &qbs::AbstractJob::cancel); QVERIFY(waitForFinished(setupJob.get(), testTimeoutInMsecs())); QVERIFY2(setupJob->error().toString().toLower().contains("cancel"), qPrintable(setupJob->error().toString())); } void TestApi::inheritQbsSearchPaths() { const QString projectFilePath = "inherit-qbs-search-paths/prj.qbs"; qbs::ErrorInfo errorInfo = doBuildProject(projectFilePath); VERIFY_NO_ERROR(errorInfo); WAIT_FOR_NEW_TIMESTAMP(); QFile projectFile(m_workingDataDir + '/' + projectFilePath); QVERIFY(projectFile.open(QIODevice::ReadWrite)); QByteArray content = projectFile.readAll(); content.replace("qbsSearchPaths: \"subdir\"", "//qbsSearchPaths: \"subdir\""); projectFile.resize(0); projectFile.write(content); projectFile.close(); errorInfo = doBuildProject(projectFilePath); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("Dependency 'bli' not found"), qPrintable(errorInfo.toString())); QVariantMap overriddenValues; overriddenValues.insert("project.qbsSearchPaths", QStringList() << m_workingDataDir + "/inherit-qbs-search-paths/subdir"); errorInfo = doBuildProject(projectFilePath, nullptr, nullptr, nullptr, qbs::BuildOptions(), overriddenValues); VERIFY_NO_ERROR(errorInfo); } template typename T::value_type findElem(const T &list, Pred p) { const auto it = std::find_if(list.cbegin(), list.cend(), p); return it == list.cend() ? typename T::value_type() : *it; } void TestApi::installableFiles() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("installed-artifact"); QVariantMap overriddenValues; overriddenValues.insert(QStringLiteral("qbs.installRoot"), QStringLiteral("/tmp")); setupParams.setOverriddenValues(overriddenValues); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); qbs::Project project = job->project(); const qbs::ErrorInfo errorInfo = forceRuleEvaluation(project); VERIFY_NO_ERROR(errorInfo); qbs::ProjectData projectData = project.projectData(); QCOMPARE(projectData.allProducts().size(), 2); qbs::ProductData product = findElem(projectData.allProducts(), [](const qbs::ProductData &p) { return p.name() == QLatin1String("installedApp"); }); QVERIFY(product.isValid()); const QList beforeInstallableFiles = product.installableArtifacts(); QCOMPARE(beforeInstallableFiles.size(), 3); for (const qbs::ArtifactData &f : beforeInstallableFiles) { if (!QFileInfo(f.filePath()).fileName().startsWith("main")) { QVERIFY(f.isExecutable()); const auto expectedTargetFilePath = appendExecSuffix( QStringLiteral("/tmp/usr/bin/installedApp"), m_logSink->output.toLocal8Bit()); QCOMPARE(f.installData().localInstallFilePath(), expectedTargetFilePath); QCOMPARE(product.targetExecutable(), expectedTargetFilePath); break; } } setupParams = defaultSetupParameters("recursive-wildcards"); setupParams.setOverriddenValues(overriddenValues); job.reset(project.setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); project = job->project(); projectData = project.projectData(); QCOMPARE(projectData.allProducts().size(), 1); product = projectData.allProducts().front(); const QList afterInstallableFiles = product.installableArtifacts(); QCOMPARE(afterInstallableFiles.size(), 2); for (const qbs::ArtifactData &f : afterInstallableFiles) QVERIFY(!f.isExecutable()); QCOMPARE(afterInstallableFiles.front().installData().localInstallFilePath(), QLatin1String("/tmp/dir/file1.txt")); QCOMPARE(afterInstallableFiles.last().installData().localInstallFilePath(), QLatin1String("/tmp/dir/file2.txt")); } void TestApi::isRunnable() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("is-runnable"); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); qbs::Project project = job->project(); const QList products = project.projectData().products(); QCOMPARE(products.size(), 2); for (const qbs::ProductData &p : products) { QVERIFY2(p.name() == "app" || p.name() == "lib", qPrintable(p.name())); if (p.name() == "app") QVERIFY(p.isRunnable()); else QVERIFY(!p.isRunnable()); } } void TestApi::linkDynamicLibs() { const qbs::ErrorInfo errorInfo = doBuildProject("link-dynamiclibs"); const bool isEmscripten = m_logSink->output.contains("is emscripten: true"); const bool isNotEmscripten = m_logSink->output.contains("is emscripten: false"); if (isEmscripten) QEXPECT_FAIL(nullptr, "Emscripten does not support dynamic linking", Abort); QVERIFY(isNotEmscripten); VERIFY_NO_ERROR(errorInfo); } void TestApi::linkDynamicAndStaticLibs() { BuildDescriptionReceiver bdr; qbs::BuildOptions options; options.setEchoMode(qbs::CommandEchoModeCommandLine); m_logSink->output.clear(); const qbs::ErrorInfo errorInfo = doBuildProject("link-dynamiclibs-staticlibs", &bdr, nullptr, nullptr, options); const bool isEmscripten = m_logSink->output.contains("is emscripten: true"); const bool isNotEmscripten = m_logSink->output.contains("is emscripten: false"); if (isEmscripten) QEXPECT_FAIL(nullptr, "Emscripten does not support dynamic linking", Abort); VERIFY_NO_ERROR(errorInfo); QVERIFY(isNotEmscripten); const bool isGcc = m_logSink->output.contains("is gcc: true"); const bool isNotGcc = m_logSink->output.contains("is gcc: false"); if (isNotGcc) QSKIP("The remainder of this test applies only to GCC"); QVERIFY(isGcc); // The dependent static libs should not appear in the link command for the executable. static const std::regex appLinkCmdRex(" -o [^ ]*/HelloWorld" QBS_HOST_EXE_SUFFIX "'? "); QString appLinkCmd; for (const QString &line : std::as_const(bdr.descriptionLines)) { const auto ln = line.toStdString(); if (std::regex_search(ln, appLinkCmdRex)) { appLinkCmd = line; break; } } QVERIFY(!appLinkCmd.isEmpty()); QVERIFY(!appLinkCmd.contains("static1")); QVERIFY(!appLinkCmd.contains("static2")); } void TestApi::linkDynamicAndObjectLibs() { BuildDescriptionReceiver bdr; qbs::BuildOptions options; options.setEchoMode(qbs::CommandEchoModeCommandLine); m_logSink->output.clear(); const qbs::ErrorInfo errorInfo = doBuildProject( "link-dynamiclibs-objectlibs", &bdr, nullptr, nullptr, options); const bool isEmscripten = m_logSink->output.contains("is emscripten: true"); const bool isNotEmscripten = m_logSink->output.contains("is emscripten: false"); if (isEmscripten) QEXPECT_FAIL(nullptr, "Emscripten does not support dynamic linking", Abort); VERIFY_NO_ERROR(errorInfo); QVERIFY(isNotEmscripten); const bool isGcc = m_logSink->output.contains("is gcc: true"); const bool isNotGcc = m_logSink->output.contains("is gcc: false"); if (isNotGcc) QSKIP("The remainder of this test applies only to GCC"); QVERIFY(isGcc); // The dependent object libs should not appear in the link command for the executable. static const std::regex appLinkCmdRex(" -o [^ ]*/HelloWorld" QBS_HOST_EXE_SUFFIX " "); QString appLinkCmd; for (const QString &line : std::as_const(bdr.descriptionLines)) { const auto ln = line.toStdString(); if (std::regex_search(ln, appLinkCmdRex)) { appLinkCmd = line; break; } } QVERIFY(!appLinkCmd.isEmpty()); QVERIFY(!appLinkCmd.contains("object1")); QVERIFY(!appLinkCmd.contains("object2")); } void TestApi::linkStaticAndDynamicLibs() { BuildDescriptionReceiver bdr; qbs::BuildOptions options; options.setEchoMode(qbs::CommandEchoModeCommandLine); m_logSink->output.clear(); const qbs::ErrorInfo errorInfo = doBuildProject( "link-staticlibs-dynamiclibs", &bdr, nullptr, nullptr, options); const bool isNormalUnix = m_logSink->output.contains("is normal unix: yes"); const bool isNotNormalUnix = m_logSink->output.contains("is normal unix: no"); QVERIFY2(isNormalUnix != isNotNormalUnix, qPrintable(m_logSink->output)); const bool isGcc = m_logSink->output.contains("is gcc: true"); const bool isNotGcc = m_logSink->output.contains("is gcc: false"); const bool isEmscripten = m_logSink->output.contains("is emscripten: true"); const bool isNotEmscripten = m_logSink->output.contains("is emscripten: false"); if (isEmscripten) QEXPECT_FAIL(nullptr, "Emscripten does not support dynamic linking", Abort); VERIFY_NO_ERROR(errorInfo); QVERIFY(isNotEmscripten); if (isNotGcc) QSKIP("The remainder of this test applies only to GCC"); QVERIFY(isGcc); // The dependencies libdynamic1.so and libstatic2.a must not appear in the link command for the // executable. The -rpath-link line for libdynamic1.so must be there. static const std::regex appLinkCmdRex(" -o [^ ]*/HelloWorld" QBS_HOST_EXE_SUFFIX "'? "); QString appLinkCmd; for (const QString &line : std::as_const(bdr.descriptionLines)) { const auto ln = line.toStdString(); if (std::regex_search(ln, appLinkCmdRex)) { appLinkCmd = line; break; } } QVERIFY(!appLinkCmd.isEmpty()); if (isNormalUnix) { const std::regex rpathLinkRex("-rpath-link=\\S*/" + relativeProductBuildDir("dynamic2").toStdString()); const auto ln = appLinkCmd.toStdString(); QVERIFY(std::regex_search(ln, rpathLinkRex)); } QVERIFY(!appLinkCmd.contains("libstatic2.a")); QVERIFY(!appLinkCmd.contains("libdynamic2.so")); } void TestApi::linkObjectAndDynamicLibs() { BuildDescriptionReceiver bdr; qbs::BuildOptions options; options.setEchoMode(qbs::CommandEchoModeCommandLine); m_logSink->output.clear(); const qbs::ErrorInfo errorInfo = doBuildProject( "link-objectlibs-dynamiclibs", &bdr, nullptr, nullptr, options); const bool isNormalUnix = m_logSink->output.contains("is normal unix: yes"); const bool isNotNormalUnix = m_logSink->output.contains("is normal unix: no"); QVERIFY2(isNormalUnix != isNotNormalUnix, qPrintable(m_logSink->output)); const bool isGcc = m_logSink->output.contains("is gcc: true"); const bool isNotGcc = m_logSink->output.contains("is gcc: false"); const bool isEmscripten = m_logSink->output.contains("is emscripten: true"); const bool isNotEmscripten = m_logSink->output.contains("is emscripten: false"); if (isEmscripten) QEXPECT_FAIL(nullptr, "Emscripten does not support dynamic linking", Abort); VERIFY_NO_ERROR(errorInfo); QVERIFY(isNotEmscripten); if (isNotGcc) QSKIP("The remainder of this test applies only to GCC"); QVERIFY(isGcc); // The dependencies libdynamic1.so and object2.o must not appear in the link command for the // executable. The -rpath-link line for libdynamic1.so must be there. static const std::regex appLinkCmdRex(" -o [^ ]*/HelloWorld" QBS_HOST_EXE_SUFFIX " "); QString appLinkCmd; for (const QString &line : std::as_const(bdr.descriptionLines)) { const auto ln = line.toStdString(); if (std::regex_search(ln, appLinkCmdRex)) { appLinkCmd = line; break; } } QVERIFY(!appLinkCmd.isEmpty()); if (isNormalUnix) { const std::regex rpathLinkRex( "-rpath-link=\\S*/" + relativeProductBuildDir("dynamic2").toStdString()); const auto ln = appLinkCmd.toStdString(); QVERIFY(std::regex_search(ln, rpathLinkRex)); } QVERIFY(!appLinkCmd.contains("object2.o")); QVERIFY(!appLinkCmd.contains("libdynamic2.so")); } void TestApi::listBuildSystemFiles() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("subprojects/toplevelproject.qbs"); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); const auto buildSystemFiles = job->project().buildSystemFiles(); QVERIFY(buildSystemFiles.count(setupParams.projectFilePath())); QVERIFY(buildSystemFiles.count(setupParams.buildRoot() + "/subproject2/subproject2.qbs")); QVERIFY(buildSystemFiles.count(setupParams.buildRoot() + "/subproject2/subproject3/subproject3.qbs")); } void TestApi::localProfiles() { QFETCH(bool, enableProfiles); qbs::SetupProjectParameters setupParams = defaultSetupParameters("local-profiles/local-profiles.qbs"); setupParams.setOverriddenValues( {std::make_pair(QString("project.enableProfiles"), enableProfiles)}); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); QString taskDescriptions; const auto taskDescHandler = [&taskDescriptions](const QString &desc, int, qbs::AbstractJob *) { taskDescriptions += '\n' + desc; }; connect(job.get(), &qbs::AbstractJob::taskStarted, taskDescHandler); waitForFinished(job.get()); const QString error = job->error().toString(); QVERIFY2(job->error().hasError() == !enableProfiles, qPrintable(error)); if (!enableProfiles) { QVERIFY2(error.contains("does not exist"), qPrintable(error)); return; } QVERIFY2(taskDescriptions.contains("Resolving"), qPrintable(taskDescriptions)); qbs::ProjectData project = job->project().projectData(); QList products = project.allProducts(); QCOMPARE(products.size(), 4); qbs::ProductData libMingw; qbs::ProductData libClang; qbs::ProductData appDebug; qbs::ProductData appRelease; for (const qbs::ProductData &p : std::as_const(products)) { if (p.name() == "lib") { if (p.profile() == "mingwProfile") libMingw = p; else if (p.profile() == "clangProfile") libClang = p; } else if (p.name() == "app") { const QString buildVariant = p.moduleProperties().getModuleProperty("qbs", "buildVariant").toString(); if (buildVariant == "debug") appDebug = p; else if (buildVariant == "release") appRelease = p; } } QVERIFY(libMingw.isValid()); QVERIFY((libClang.isValid())); QVERIFY(appDebug.isValid()); QVERIFY(appRelease.isValid()); QCOMPARE(appDebug.profile(), QLatin1String("mingwProfile")); QCOMPARE(appRelease.profile(), QLatin1String("mingwProfile")); qbs::PropertyMap moduleProps = libMingw.moduleProperties(); QCOMPARE(moduleProps.getModuleProperty("qbs", "targetOS").toStringList(), QStringList({"windows"})); QCOMPARE(moduleProps.getModuleProperty("qbs", "toolchain").toStringList(), QStringList({"mingw", "gcc"})); if (moduleProps.getModuleProperty("cpp", "present").toBool()) { QCOMPARE(moduleProps.getModuleProperty("cpp", "cxxCompilerName").toString(), qbs::Internal::HostOsInfo::appendExecutableSuffix(QString("g++"))); } moduleProps = libClang.moduleProperties(); QCOMPARE(moduleProps.getModuleProperty("qbs", "targetOS").toStringList(), QStringList({"linux", "unix"})); QCOMPARE(moduleProps.getModuleProperty("qbs", "toolchain").toStringList(), QStringList({"clang", "llvm", "gcc"})); if (moduleProps.getModuleProperty("cpp", "present").toBool()) { QCOMPARE(moduleProps.getModuleProperty("cpp", "cxxCompilerName").toString(), qbs::Internal::HostOsInfo::appendExecutableSuffix(QString("clang++"))); } moduleProps = appDebug.moduleProperties(); if (moduleProps.getModuleProperty("cpp", "present").toBool()) QCOMPARE(moduleProps.getModuleProperty("cpp", "optimization").toString(), QString("none")); moduleProps = appRelease.moduleProperties(); if (moduleProps.getModuleProperty("cpp", "present").toBool()) QCOMPARE(moduleProps.getModuleProperty("cpp", "optimization").toString(), QString("fast")); taskDescriptions.clear(); job.reset(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); connect(job.get(), &qbs::AbstractJob::taskStarted, taskDescHandler); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); QVERIFY2(!taskDescriptions.contains("Resolving"), qPrintable(taskDescriptions)); WAIT_FOR_NEW_TIMESTAMP(); QFile projectFile(setupParams.projectFilePath()); QVERIFY2(projectFile.open(QIODevice::ReadWrite), qPrintable(projectFile.errorString())); QByteArray content = projectFile.readAll(); content.replace("\"clang\"", "\"gcc\""); projectFile.resize(0); projectFile.write(content); projectFile.close(); job.reset(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); project = job->project().projectData(); products = project.allProducts(); QCOMPARE(products.size(), 4); int clangProfiles = 0; for (const qbs::ProductData &p : std::as_const(products)) { if (p.profile() == "clangProfile") { ++clangProfiles; moduleProps = p.moduleProperties(); if (moduleProps.getModuleProperty("cpp", "present").toBool()) { QCOMPARE(moduleProps.getModuleProperty("cpp", "cxxCompilerName").toString(), qbs::Internal::HostOsInfo::appendExecutableSuffix(QString("g++"))); } } } QCOMPARE(clangProfiles, 1); } void TestApi::localProfiles_data() { QTest::addColumn("enableProfiles"); QTest::newRow("profiles enabled") << true; QTest::newRow("profiles disabled") << false; } void TestApi::missingSourceFile() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("missing-source-file/missing-source-file.qbs"); setupParams.setProductErrorMode(qbs::ErrorHandlingMode::Relaxed); m_logSink->setLogLevel(qbs::LoggerMinLevel); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); qbs::ProjectData project = job->project().projectData(); QCOMPARE(project.allProducts().size(), 1); qbs::ProductData product = project.allProducts().front(); QCOMPARE(product.groups().size(), 1); qbs::GroupData group = product.groups().front(); QCOMPARE(group.allSourceArtifacts().size(), 2); QFile::rename("file2.txt.missing", "file2.txt"); job.reset(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); project = job->project().projectData(); QCOMPARE(project.allProducts().size(), 1); product = project.allProducts().front(); QCOMPARE(product.groups().size(), 1); group = product.groups().front(); QCOMPARE(group.allSourceArtifacts().size(), 3); } void TestApi::mocCppIncluded() { // Initial build. qbs::ErrorInfo errorInfo = doBuildProject("moc-hpp-included"); VERIFY_NO_ERROR(errorInfo); // Touch header and try again. WAIT_FOR_NEW_TIMESTAMP(); QFile headerFile("object.h"); QVERIFY2(headerFile.open(QIODevice::WriteOnly | QIODevice::Append), qPrintable(headerFile.errorString())); headerFile.write("\n"); headerFile.close(); errorInfo = doBuildProject("moc-hpp-included"); VERIFY_NO_ERROR(errorInfo); // Touch cpp file and try again. WAIT_FOR_NEW_TIMESTAMP(); QFile cppFile("object.cpp"); QVERIFY2(cppFile.open(QIODevice::WriteOnly | QIODevice::Append), qPrintable(cppFile.errorString())); cppFile.write("\n"); cppFile.close(); errorInfo = doBuildProject("moc-hpp-included"); VERIFY_NO_ERROR(errorInfo); } void TestApi::multiArch() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("multi-arch"); const SettingsPtr s = settings(); qbs::Internal::TemporaryProfile tph("host", s.get()); qbs::Profile hostProfile = tph.p; hostProfile.setValue("qbs.architecture", "host-arch"); qbs::Internal::TemporaryProfile tpt("target", s.get()); qbs::Profile targetProfile = tpt.p; targetProfile.setValue("qbs.architecture", "target-arch"); QVariantMap overriddenValues; overriddenValues.insert("project.hostProfile", hostProfile.name()); overriddenValues.insert("project.targetProfile", targetProfile.name()); setupParams.setOverriddenValues(overriddenValues); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); qbs::Project project = setupJob->project(); QCOMPARE(project.profile(), profileName()); const qbs::ProjectData projectData = project.projectData(); const QList &products = projectData.products(); QCOMPARE(products.size(), 3); QList hostProducts; QList targetProducts; for (const qbs::ProductData &p : products) { QVERIFY2(p.profile() == hostProfile.name() || p.profile() == targetProfile.name(), qPrintable(p.profile())); if (p.profile() == hostProfile.name()) hostProducts.push_back(p); else targetProducts.push_back(p); } QCOMPARE(hostProducts.size(), 2); QCOMPARE(targetProducts.size(), 1); QCOMPARE(targetProducts.front().name(), QLatin1String("p1")); QStringList hostProductNames = QStringList() << hostProducts.front().name() << hostProducts.last().name(); QCOMPARE(hostProductNames.count("p1"), 1); QCOMPARE(hostProductNames.count("p2"), 1); const QString p1HostMultiplexCfgId = hostProducts.at(0).multiplexConfigurationId(); const QString p2HostMultiplexCfgId = hostProducts.at(1).multiplexConfigurationId(); const QString p1TargetMultiplexCfgId = targetProducts.at(0).multiplexConfigurationId(); std::unique_ptr buildJob(project.buildAllProducts(qbs::BuildOptions())); waitForFinished(buildJob.get()); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); const QString outputBaseDir = setupParams.buildRoot() + '/'; QFile p1HostArtifact(outputBaseDir + relativeProductBuildDir("p1", QString(), p1HostMultiplexCfgId) + "/host+target.output"); QVERIFY2(p1HostArtifact.exists(), qPrintable(p1HostArtifact.fileName())); QVERIFY2(p1HostArtifact.open(QIODevice::ReadOnly), qPrintable(p1HostArtifact.errorString())); QCOMPARE(p1HostArtifact.readAll().constData(), "host-arch"); QFile p1TargetArtifact(outputBaseDir + relativeProductBuildDir("p1", QString(), p1TargetMultiplexCfgId) + "/host+target.output"); QVERIFY2(p1TargetArtifact.exists(), qPrintable(p1TargetArtifact.fileName())); QVERIFY2(p1TargetArtifact.open(QIODevice::ReadOnly), qPrintable(p1TargetArtifact.errorString())); QCOMPARE(p1TargetArtifact.readAll().constData(), "target-arch"); QFile p2Artifact(outputBaseDir + relativeProductBuildDir("p2", QString(), p2HostMultiplexCfgId) + "/host-tool.output"); QVERIFY2(p2Artifact.exists(), qPrintable(p2Artifact.fileName())); QVERIFY2(p2Artifact.open(QIODevice::ReadOnly), qPrintable(p2Artifact.errorString())); QCOMPARE(p2Artifact.readAll().constData(), "host-arch"); const QString installRoot = outputBaseDir + relativeBuildDir() + '/' + qbs::InstallOptions::defaultInstallRoot(); std::unique_ptr installJob(project.installAllProducts(qbs::InstallOptions())); waitForFinished(installJob.get()); QVERIFY2(!installJob->error().hasError(), qPrintable(installJob->error().toString())); QFile p1HostArtifactInstalled(installRoot + "/host/host+target.output"); QVERIFY2(p1HostArtifactInstalled.exists(), qPrintable(p1HostArtifactInstalled.fileName())); QFile p1TargetArtifactInstalled(installRoot + "/target/host+target.output"); QVERIFY2(p1TargetArtifactInstalled.exists(), qPrintable(p1TargetArtifactInstalled.fileName())); QFile p2ArtifactInstalled(installRoot + "/host/host-tool.output"); QVERIFY2(p2ArtifactInstalled.exists(), qPrintable(p2ArtifactInstalled.fileName())); // Specifying the same profile twice should not result in an attempt to multiplex. overriddenValues.insert("project.targetProfile", hostProfile.name()); setupParams.setOverriddenValues(overriddenValues); setupJob.reset(project.setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY(!setupJob->error().hasError()); QCOMPARE(int(setupJob->project().projectData().products().size()), 2); // The same, but this time attaching the properties via the product name. overriddenValues.remove(QStringLiteral("project.targetProfile")); overriddenValues.insert("products.p1.myProfiles", targetProfile.name() + ',' + targetProfile.name()); setupParams.setOverriddenValues(overriddenValues); setupJob.reset(project.setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY(!setupJob->error().hasError()); QCOMPARE(int(setupJob->project().projectData().products().size()), 2); } struct ProductDataSelector { void clear() { name.clear(); qbsProperties.clear(); } bool matches(const qbs::ProductData &p) const { return name == p.name() && qbsPropertiesMatch(p); } bool qbsPropertiesMatch(const qbs::ProductData &p) const { for (auto it = qbsProperties.begin(); it != qbsProperties.end(); ++it) { if (!qbs::qVariantsEqual( it.value(), p.moduleProperties().getModuleProperty("qbs", it.key()))) return false; } return true; } QString name; QVariantMap qbsProperties; }; static qbs::ProductData takeMatchingProduct(QList &products, const ProductDataSelector &s) { qbs::ProductData result; auto it = std::find_if(products.begin(), products.end(), [&s] (const qbs::ProductData &pd) { return s.matches(pd); }); if (it != products.end()) { result = *it; products.erase(it); } return result; } void TestApi::multiplexing() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("multiplexing"); std::unique_ptr setupJob( qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); qbs::Project project = setupJob->project(); QList products = project.projectData().allProducts(); qbs::ProductData product; ProductDataSelector selector; selector.name = "no-multiplexing"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(!product.isMultiplexed()); QVERIFY(product.dependencies().empty()); selector.clear(); selector.name = "multiplex-without-aggregator-2"; selector.qbsProperties["architecture"] = "TRS-80"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QVERIFY(product.dependencies().empty()); selector.qbsProperties["architecture"] = "C64"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QVERIFY(product.dependencies().empty()); selector.clear(); selector.name = "multiplex-with-export"; selector.qbsProperties["architecture"] = "TRS-80"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QVERIFY(product.dependencies().empty()); selector.qbsProperties["architecture"] = "C64"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QVERIFY(product.dependencies().empty()); selector.clear(); selector.name = "nonmultiplex-with-export"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(!product.isMultiplexed()); QVERIFY(product.dependencies().empty()); selector.clear(); selector.name = "nonmultiplex-exporting-aggregation"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(!product.isMultiplexed()); QVERIFY(product.dependencies().empty()); selector.clear(); selector.name = "multiplex-using-export"; selector.qbsProperties["architecture"] = "TRS-80"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 2); selector.qbsProperties["architecture"] = "C64"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 2); selector.clear(); selector.name = "multiplex-without-aggregator-2-depend-on-non-multiplexed"; selector.qbsProperties["architecture"] = "TRS-80"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 1); selector.qbsProperties["architecture"] = "C64"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 1); selector.clear(); selector.name = "multiplex-without-aggregator-4"; selector.qbsProperties["architecture"] = "C64"; selector.qbsProperties["buildVariant"] = "debug"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QVERIFY(product.dependencies().empty()); selector.qbsProperties["buildVariant"] = "release"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QVERIFY(product.dependencies().empty()); selector.qbsProperties["architecture"] = "TRS-80"; selector.qbsProperties["buildVariant"] = "debug"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QVERIFY(product.dependencies().empty()); selector.qbsProperties["buildVariant"] = "release"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QVERIFY(product.dependencies().empty()); selector.clear(); selector.name = "multiplex-without-aggregator-4-depends-2"; selector.qbsProperties["architecture"] = "C64"; selector.qbsProperties["buildVariant"] = "debug"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 1); selector.qbsProperties["buildVariant"] = "release"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 1); selector.qbsProperties["architecture"] = "TRS-80"; selector.qbsProperties["buildVariant"] = "debug"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 1); selector.qbsProperties["buildVariant"] = "release"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 1); selector.clear(); selector.name = "multiplex-with-aggregator-2"; selector.qbsProperties["architecture"] = "C64"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 0); selector.qbsProperties["architecture"] = "TRS-80"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 0); selector.qbsProperties["architecture"] = "Atari ST"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 2); selector.clear(); selector.name = "multiplex-with-aggregator-2-dependent"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(!product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 1); selector.clear(); selector.name = "non-multiplexed-with-dependencies-on-multiplexed"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(!product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 2); selector.clear(); selector.name = "non-multiplexed-with-dependencies-on-multiplexed-via-export1"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(!product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 4); selector.clear(); selector.name = "non-multiplexed-with-dependencies-on-multiplexed-via-export2"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(!product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 3); selector.clear(); selector.name = "non-multiplexed-with-dependencies-on-aggregation-via-export"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(!product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 2); selector.clear(); selector.name = "aggregate-with-dependencies-on-aggregation-via-export"; selector.qbsProperties["architecture"] = "C64"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 2); selector.qbsProperties["architecture"] = "TRS-80"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 2); selector.qbsProperties["architecture"] = "Atari ST"; product = takeMatchingProduct(products, selector); QVERIFY(product.isValid()); QVERIFY(product.isMultiplexed()); QCOMPARE(product.dependencies().size(), 4); QVERIFY(products.empty()); } void TestApi::newOutputArtifactInDependency() { BuildDescriptionReceiver receiver; qbs::ErrorInfo errorInfo = doBuildProject("new-output-artifact-in-dependency", &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY(receiver.descriptions.contains("linking app")); const QByteArray linkingLibString = QByteArray("linking ") + qbs::Internal::HostOsInfo::dynamicLibraryName("lib").toLatin1(); QVERIFY(!receiver.descriptions.contains(linkingLibString)); receiver.descriptions.clear(); WAIT_FOR_NEW_TIMESTAMP(); QFile projectFile("new-output-artifact-in-dependency.qbs"); QVERIFY2(projectFile.open(QIODevice::ReadWrite), qPrintable(projectFile.errorString())); QByteArray contents = projectFile.readAll(); contents.replace("//Depends", "Depends"); projectFile.resize(0); projectFile.write(contents); projectFile.close(); errorInfo = doBuildProject("new-output-artifact-in-dependency", &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY(receiver.descriptions.contains("linking app")); QVERIFY(receiver.descriptions.contains(linkingLibString)); } void TestApi::newPatternMatch() { TaskReceiver receiver; qbs::ErrorInfo errorInfo = doBuildProject("new-pattern-match", nullptr, nullptr, &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY2(receiver.taskDescriptions.contains("Resolving"), qPrintable(m_logSink->output)); receiver.taskDescriptions.clear(); errorInfo = doBuildProject("new-pattern-match", nullptr, nullptr, &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY(!receiver.taskDescriptions.contains("Resolving")); WAIT_FOR_NEW_TIMESTAMP(); QFile f("test.txt"); QVERIFY2(f.open(QIODevice::WriteOnly), qPrintable(f.errorString())); f.close(); errorInfo = doBuildProject("new-pattern-match", nullptr, nullptr, &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY(receiver.taskDescriptions.contains("Resolving")); receiver.taskDescriptions.clear(); errorInfo = doBuildProject("new-pattern-match", nullptr, nullptr, &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY(!receiver.taskDescriptions.contains("Resolving")); WAIT_FOR_NEW_TIMESTAMP(); f.remove(); errorInfo = doBuildProject("new-pattern-match", nullptr, nullptr, &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY(receiver.taskDescriptions.contains("Resolving")); } void TestApi::noAssertsInRelaxedMode() { qbs::SetupProjectParameters setupParams = defaultSetupParameters( "no-asserts-in-relaxed-mode/no-asserts-in-relaxed-mode.qbs"); setupParams.setProductErrorMode(qbs::ErrorHandlingMode::Relaxed); setupParams.setPropertyCheckingMode(qbs::ErrorHandlingMode::Relaxed); const std::unique_ptr job( qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); } void TestApi::nonexistingProjectPropertyFromProduct() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("nonexistingprojectproperties/invalidaccessfromproduct.qbs"); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QEXPECT_FAIL("", "QBS-432", Abort); QVERIFY(job->error().hasError()); QVERIFY2(job->error().toString().contains(QLatin1String("blubb")), qPrintable(job->error().toString())); } void TestApi::nonexistingProjectPropertyFromCommandLine() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("nonexistingprojectproperties"); removeBuildDir(setupParams); QVariantMap projectProperties; projectProperties.insert(QStringLiteral("project.blubb"), QStringLiteral("true")); setupParams.setOverriddenValues(projectProperties); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY(job->error().hasError()); QVERIFY2(job->error().toString().contains(QLatin1String("blubb")), qPrintable(job->error().toString())); } void TestApi::objC() { const qbs::ErrorInfo errorInfo = doBuildProject("objc"); VERIFY_NO_ERROR(errorInfo); } void TestApi::projectDataAfterProductInvalidation() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("project-data-after-" "product-invalidation/project-data-after-product-invalidation.qbs"); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); qbs::Project project = setupJob->project(); QVERIFY(project.isValid()); QCOMPARE(project.projectData().products().size(), 1); QVERIFY(project.projectData().products().front().generatedArtifacts().empty()); std::unique_ptr buildJob(project.buildAllProducts(qbs::BuildOptions())); waitForFinished(buildJob.get()); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); QCOMPARE(project.projectData().products().size(), 1); const qbs::ProductData productAfterBulding = project.projectData().products().front(); QVERIFY(!productAfterBulding.generatedArtifacts().empty()); QFile projectFile(setupParams.projectFilePath()); WAIT_FOR_NEW_TIMESTAMP(); QVERIFY2(projectFile.open(QIODevice::ReadWrite), qPrintable(projectFile.errorString())); QByteArray content = projectFile.readAll(); QVERIFY(!content.isEmpty()); content.replace("\"file.cpp", "// \"file.cpp"); projectFile.resize(0); projectFile.write(content); projectFile.flush(); setupJob.reset(project.setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); QVERIFY(!project.isValid()); project = setupJob->project(); QVERIFY(project.isValid()); QCOMPARE(project.projectData().products().size(), 1); QVERIFY(project.projectData().products().front().generatedArtifacts() == productAfterBulding.generatedArtifacts()); buildJob.reset(project.buildAllProducts(qbs::BuildOptions())); waitForFinished(buildJob.get()); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); QCOMPARE(project.projectData().products().size(), 1); QVERIFY(project.projectData().products().front().generatedArtifacts() != productAfterBulding.generatedArtifacts()); } void TestApi::processResult() { waitForFileUnlock(); removeBuildDir(defaultSetupParameters("process-result")); QFETCH(int, expectedExitCode); QFETCH(bool, redirectStdout); QFETCH(bool, redirectStderr); QVariantMap overridden; overridden.insert("products.app-caller.argument", expectedExitCode); overridden.insert("products.app-caller.redirectStdout", redirectStdout); overridden.insert("products.app-caller.redirectStderr", redirectStderr); ProcessResultReceiver resultReceiver; const qbs::ErrorInfo errorInfo = doBuildProject("process-result", nullptr, &resultReceiver, nullptr, qbs::BuildOptions(), overridden); if (m_logSink->output.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(expectedExitCode != 0, errorInfo.hasError()); QVERIFY(resultReceiver.results.size() > 1); const qbs::ProcessResult &result = resultReceiver.results.back(); QVERIFY2(result.executableFilePath().contains("app"), qPrintable(result.executableFilePath())); QCOMPARE(expectedExitCode, result.exitCode()); QCOMPARE(expectedExitCode == 0, result.success()); QCOMPARE(result.error(), QProcess::UnknownError); struct CheckParams { CheckParams(bool r, QString f, QByteArray c, QStringList co) : redirect(r) , fileName(std::move(f)) , expectedContent(std::move(c)) , consoleOutput(std::move(co)) {} bool redirect; QString fileName; QByteArray expectedContent; const QStringList consoleOutput; }; const std::vector checkParams({ CheckParams(redirectStdout, "stdout.txt", "stdout", result.stdOut()), CheckParams(redirectStderr, "stderr.txt", "stderr", result.stdErr()) }); for (const CheckParams &p : checkParams) { QFile f(relativeProductBuildDir("app-caller") + '/' + p.fileName); QCOMPARE(f.exists(), p.redirect); if (p.redirect) { QVERIFY2(f.open(QIODevice::ReadOnly), qPrintable(f.errorString())); QCOMPARE(f.readAll(), p.expectedContent); QCOMPARE(p.consoleOutput, QStringList()); } else { QCOMPARE(p.consoleOutput.join("").toLocal8Bit(), p.expectedContent); } } } void TestApi::processResult_data() { QTest::addColumn("expectedExitCode"); QTest::addColumn("redirectStdout"); QTest::addColumn("redirectStderr"); QTest::newRow("success, no redirection") << 0 << false << false; QTest::newRow("success, stdout redirection") << 0 << true << false; QTest::newRow("failure, stderr redirection") << 1 << false << true; } void TestApi::projectInvalidation() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("project-invalidation"); QVERIFY(QFile::copy("project.no-error.qbs", "project-invalidation.qbs")); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); qbs::Project project = setupJob->project(); QVERIFY(project.isValid()); WAIT_FOR_NEW_TIMESTAMP(); copyFileAndUpdateTimestamp("project.early-error.qbs", "project-invalidation.qbs"); setupJob.reset(project.setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY(setupJob->error().hasError()); QVERIFY(project.isValid()); // Error in Loader, old project still valid. WAIT_FOR_NEW_TIMESTAMP(); copyFileAndUpdateTimestamp("project.late-error.qbs", "project-invalidation.qbs"); setupJob.reset(project.setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY(setupJob->error().hasError()); QVERIFY(!project.isValid()); // Error in build data re-resolving, old project not valid anymore. } void TestApi::projectLocking() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("project-locking"); std::unique_ptr setupJob(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); qbs::Project project = setupJob->project(); setupJob.reset(project.setupProject(setupParams, m_logSink, nullptr)); std::unique_ptr setupJob2(project.setupProject(setupParams, m_logSink, nullptr)); waitForFinished(setupJob2.get()); QVERIFY(setupJob2->error().hasError()); QVERIFY2(setupJob2->error().toString() .contains("Cannot start a job while another one is in progress."), qPrintable(setupJob2->error().toString())); waitForFinished(setupJob.get()); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); } void TestApi::projectPropertiesByName() { const QString projectFile = "project-properties-by-name/project-properties-by-name.qbs"; qbs::ErrorInfo errorInfo = doBuildProject(projectFile); QVERIFY(errorInfo.hasError()); QVariantMap overridden; overridden.insert("project.theDefines", QStringList() << "SUB1" << "SUB2"); errorInfo = doBuildProject(projectFile, nullptr, nullptr, nullptr, qbs::BuildOptions(), overridden); QVERIFY(errorInfo.hasError()); overridden.clear(); overridden.insert("projects.subproject1.theDefines", QStringList() << "SUB1"); errorInfo = doBuildProject(projectFile, nullptr, nullptr, nullptr, qbs::BuildOptions(), overridden); QVERIFY(errorInfo.hasError()); overridden.insert("projects.subproject2.theDefines", QStringList() << "SUB2"); errorInfo = doBuildProject(projectFile, nullptr, nullptr, nullptr, qbs::BuildOptions(), overridden); VERIFY_NO_ERROR(errorInfo); } void TestApi::projectWithPropertiesItem() { const qbs::ErrorInfo errorInfo = doBuildProject("project-with-properties-item"); VERIFY_NO_ERROR(errorInfo); } void TestApi::projectWithProbeAndProfileItem() { const qbs::ErrorInfo errorInfo = doBuildProject("project-with-probe-and-profile-item"); VERIFY_NO_ERROR(errorInfo); } void TestApi::propertiesBlocks() { const qbs::ErrorInfo errorInfo = doBuildProject("properties-blocks"); VERIFY_NO_ERROR(errorInfo); } void TestApi::rc() { BuildDescriptionReceiver bdr; ProcessResultReceiver prr; const auto buildRc = [this, &bdr, &prr]() { bdr.descriptions.clear(); bdr.descriptionLines.clear(); prr.output.clear(); prr.results.clear(); const qbs::ErrorInfo errorInfo = doBuildProject("rc", &bdr, &prr); if (errorInfo.hasError()) qDebug() << prr.output; return errorInfo; }; const auto rcFileWasCompiled = [&bdr]() { return bdr.descriptions.contains("compiling test.rc"); }; qbs::ErrorInfo error = buildRc(); VERIFY_NO_ERROR(error); QCOMPARE(rcFileWasCompiled(), qbs::Internal::HostOsInfo::isWindowsHost()); WAIT_FOR_NEW_TIMESTAMP(); error = buildRc(); VERIFY_NO_ERROR(error); QVERIFY(!rcFileWasCompiled()); touch("subdir/rc-include.h"); error = buildRc(); VERIFY_NO_ERROR(error); QCOMPARE(rcFileWasCompiled(), qbs::Internal::HostOsInfo::isWindowsHost()); } void TestApi::referencedFileErrors() { QFETCH(bool, relaxedMode); qbs::SetupProjectParameters params = defaultSetupParameters("referenced-file-errors"); params.setDryRun(true); params.setProductErrorMode(relaxedMode ? qbs::ErrorHandlingMode::Relaxed : qbs::ErrorHandlingMode::Strict); m_logSink->setLogLevel(qbs::LoggerMinLevel); std::unique_ptr job(qbs::Project().setupProject(params, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(job->error().hasError() != relaxedMode, qPrintable(job->error().toString())); const qbs::Project project = job->project(); QCOMPARE(project.isValid(), relaxedMode); if (!relaxedMode) return; const QList products = project.projectData().allProducts(); QCOMPARE(products.size(), 5); for (const qbs::ProductData &p : products) QCOMPARE(p.isEnabled(), p.name() != "p5"); } void TestApi::referencedFileErrors_data() { QTest::addColumn("relaxedMode"); QTest::newRow("strict mode") << false; QTest::newRow("relaxed mode") << true; } qbs::SetupProjectParameters TestApi::defaultSetupParameters(const QString &projectFileOrDir) const { QFileInfo fi(m_workingDataDir + QLatin1Char('/') + projectFileOrDir); QString projectDirPath; QString projectFilePath; if (fi.isDir()) { projectDirPath = fi.absoluteFilePath(); projectFilePath = projectDirPath + QLatin1Char('/') + projectFileOrDir + QStringLiteral(".qbs"); } else { projectDirPath = fi.absolutePath(); projectFilePath = fi.absoluteFilePath(); } qbs::SetupProjectParameters setupParams; auto environment = QProcessEnvironment::systemEnvironment(); environment.insert("QBS_AUTOTEST_CODE_SIGNING_REQUIRED", "0"); setupParams.setEnvironment(environment); setupParams.setProjectFilePath(projectFilePath); setupParams.setPropertyCheckingMode(qbs::ErrorHandlingMode::Strict); setupParams.setOverrideBuildGraphData(true); QDir::setCurrent(projectDirPath); setupParams.setBuildRoot(projectDirPath); const SettingsPtr s = settings(); const qbs::Preferences prefs(s.get(), profileName()); setupParams.setSearchPaths(prefs.searchPaths(QDir::cleanPath(QCoreApplication::applicationDirPath() + QLatin1String("/" QBS_RELATIVE_SEARCH_PATH)))); setupParams.setPluginPaths(prefs.pluginPaths(QDir::cleanPath(QCoreApplication::applicationDirPath() + QLatin1String("/" QBS_RELATIVE_PLUGINS_PATH)))); setupParams.setLibexecPath(QDir::cleanPath(QCoreApplication::applicationDirPath() + QLatin1String("/" QBS_RELATIVE_LIBEXEC_PATH))); setupParams.setTopLevelProfile(profileName()); setupParams.setMaxJobCount(2); setupParams.setConfigurationName(QStringLiteral("default")); setupParams.setSettingsDirectory(settings()->baseDirectory()); return setupParams; } void TestApi::references() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("references/invalid1.qbs"); const QString projectDir = QDir::cleanPath(m_workingDataDir + "/references"); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY(job->error().hasError()); QString errorString = job->error().toString(); QVERIFY2(errorString.contains("does not contain"), qPrintable(errorString)); setupParams.setProjectFilePath(projectDir + QLatin1String("/invalid2.qbs")); job.reset(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY(job->error().hasError()); errorString = job->error().toString(); QVERIFY2(errorString.contains("contains more than one"), qPrintable(errorString)); setupParams.setProjectFilePath(projectDir + QLatin1String("/valid.qbs")); job.reset(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); const qbs::ProjectData topLevelProject = job->project().projectData(); QCOMPARE(topLevelProject.subProjects().size(), 1); const QString subProjectFileName = QFileInfo(topLevelProject.subProjects().front().location().filePath()).fileName(); QCOMPARE(subProjectFileName, QString("p.qbs")); } void TestApi::relaxedModeRecovery() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("relaxed-mode-recovery"); setupParams.setProductErrorMode(qbs::ErrorHandlingMode::Relaxed); setupParams.setPropertyCheckingMode(qbs::ErrorHandlingMode::Relaxed); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); if (m_logSink->errors.size() != 4) { for (const qbs::ErrorInfo &error : std::as_const(m_logSink->errors)) qDebug() << error.toString(); } QCOMPARE(m_logSink->errors.size(), 4); for (const qbs::ErrorInfo &error : std::as_const(m_logSink->errors)) { QVERIFY2(!error.toString().contains("ASSERT") && (error.toString().contains("Dependency 'blubb' not found") || error.toString().contains("Product 'p1' had errors and was disabled") || error.toString().contains("Product 'p2' had errors and was disabled")), qPrintable(error.toString())); } } void TestApi::renameProduct() { // Initial run. qbs::ErrorInfo errorInfo = doBuildProject("rename-product/rename.qbs"); VERIFY_NO_ERROR(errorInfo); // Rename lib and adapt Depends item. WAIT_FOR_NEW_TIMESTAMP(); QFile f("rename.qbs"); QVERIFY(f.open(QIODevice::ReadWrite)); QByteArray contents = f.readAll(); contents.replace("TheLib", "thelib"); f.resize(0); f.write(contents); f.close(); errorInfo = doBuildProject("rename-product/rename.qbs"); VERIFY_NO_ERROR(errorInfo); // Rename lib and don't adapt Depends item. WAIT_FOR_NEW_TIMESTAMP(); QVERIFY(f.open(QIODevice::ReadWrite)); contents = f.readAll(); const int libNameIndex = contents.lastIndexOf("thelib"); QVERIFY(libNameIndex != -1); contents.replace(libNameIndex, 6, "TheLib"); f.resize(0); f.write(contents); f.close(); errorInfo = doBuildProject("rename-product/rename.qbs"); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("Dependency 'thelib' not found"), qPrintable(errorInfo.toString())); } void TestApi::renameTargetArtifact() { // Initial run. BuildDescriptionReceiver receiver; qbs::ErrorInfo errorInfo = doBuildProject("rename-target-artifact/rename.qbs", &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY2(receiver.descriptions.contains("compiling"), qPrintable(receiver.descriptions)); QCOMPARE(receiver.descriptions.count("linking"), 2); receiver.descriptions.clear(); // Rename library file name. WAIT_FOR_NEW_TIMESTAMP(); QFile f("rename.qbs"); QVERIFY(f.open(QIODevice::ReadWrite)); QByteArray contents = f.readAll(); contents.replace("the_lib", "TheLib"); f.resize(0); f.write(contents); f.close(); errorInfo = doBuildProject("rename-target-artifact/rename.qbs", &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY2(!receiver.descriptions.contains("compiling"), qPrintable(receiver.descriptions)); QCOMPARE(receiver.descriptions.count("linking"), 2); } void TestApi::removeFileDependency() { qbs::ErrorInfo errorInfo = doBuildProject("remove-file-dependency/removeFileDependency.qbs"); VERIFY_NO_ERROR(errorInfo); QFile::remove("someheader.h"); ProcessResultReceiver receiver; errorInfo = doBuildProject("remove-file-dependency/removeFileDependency.qbs", nullptr, &receiver); QVERIFY(errorInfo.hasError()); QVERIFY2(receiver.output.contains("someheader.h"), qPrintable(receiver.output)); } void TestApi::resolveProject() { QFETCH(QString, projectSubDir); QFETCH(QString, productNameOrFilePath); const qbs::SetupProjectParameters params = defaultSetupParameters(projectSubDir); removeBuildDir(params); const std::unique_ptr setupJob(qbs::Project().setupProject(params, m_logSink, nullptr)); waitForFinished(setupJob.get()); VERIFY_NO_ERROR(setupJob->error()); const QString productFilePath = getProductFilePath(productNameOrFilePath); QVERIFY2(!QFile::exists(productFilePath), qPrintable(productFilePath)); QVERIFY(regularFileExists(relativeBuildGraphFilePath())); } void TestApi::resolveProject_data() { return buildProject_data(); } void TestApi::resolveProjectDryRun() { QFETCH(QString, projectSubDir); QFETCH(QString, productNameOrFilePath); qbs::SetupProjectParameters params = defaultSetupParameters(projectSubDir); params.setDryRun(true); removeBuildDir(params); const std::unique_ptr setupJob(qbs::Project().setupProject(params, m_logSink, nullptr)); waitForFinished(setupJob.get()); VERIFY_NO_ERROR(setupJob->error()); const QString productFilePath = getProductFilePath(productNameOrFilePath); QVERIFY2(!QFile::exists(productFilePath), qPrintable(productFilePath)); QVERIFY(!regularFileExists(relativeBuildGraphFilePath())); } void TestApi::resolveProjectDryRun_data() { return resolveProject_data(); } void TestApi::restoredWarnings() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("restored-warnings"); setupParams.setPropertyCheckingMode(qbs::ErrorHandlingMode::Relaxed); setupParams.setProductErrorMode(qbs::ErrorHandlingMode::Relaxed); // Initial resolving: Errors are new. std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); job.reset(nullptr); QCOMPARE(toSet(m_logSink->warnings).size(), 1); QVERIFY2( m_logSink->warnings.first().toString().contains("Superfluous version"), qPrintable(m_logSink->warnings.first().toString())); QCOMPARE(toSet(m_logSink->errors).size(), 4); for (const qbs::ErrorInfo &e : std::as_const(m_logSink->errors)) { const QString msg = e.toString(); QVERIFY2( msg.contains("Property 'blubb' is not declared") || msg.contains("this one comes from a thread") || msg.contains("Product 'theOtherProduct' had errors and was disabled") || msg.contains("Product 'theProduct' had errors and was disabled"), qPrintable(msg)); } m_logSink->warnings.clear(); m_logSink->errors.clear(); // Re-resolving with no changes: Errors come from the stored build graph. job.reset(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); job.reset(nullptr); QCOMPARE(toSet(m_logSink->warnings).size(), 1); QCOMPARE(toSet(m_logSink->errors).size(), 4); m_logSink->warnings.clear(); m_logSink->errors.clear(); // Re-resolving with changes: Errors come from the re-resolving, stored ones must be suppressed. QVariantMap overridenValues; overridenValues.insert("products.aThirdProduct.moreFiles", true); setupParams.setOverriddenValues(overridenValues); job.reset(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); job.reset(nullptr); QCOMPARE(toSet(m_logSink->warnings).size(), 1); QVERIFY2( m_logSink->warnings.first().toString().contains("Superfluous version"), qPrintable(m_logSink->warnings.first().toString())); QCOMPARE(toSet(m_logSink->errors).size(), 5); // One more for the additional group for (const qbs::ErrorInfo &e : std::as_const(m_logSink->errors)) { const QString msg = e.toString(); QVERIFY2( msg.contains("Property 'blubb' is not declared") || msg.contains("blubb.txt' does not exist") || msg.contains("this one comes from a thread") || msg.contains("Product 'theOtherProduct' had errors and was disabled") || msg.contains("Product 'theThirdProduct' had errors and was disabled") || msg.contains("Product 'theProduct' had errors and was disabled"), qPrintable(msg)); } m_logSink->warnings.clear(); m_logSink->errors.clear(); } void TestApi::restoreAndResolve() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("restore-and-resolve"); setupParams.setPropertyCheckingMode(qbs::ErrorHandlingMode::Relaxed); setupParams.setProductErrorMode(qbs::ErrorHandlingMode::Relaxed); // Initial resolving finishes with warnings due to syntax error. std::unique_ptr resolveJob( qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(resolveJob.get()); QVERIFY2(!resolveJob->error().hasError(), qPrintable(resolveJob->error().toString())); QVERIFY(!m_logSink->errors.isEmpty()); QVERIFY(resolveJob->project().projectData().products().isEmpty()); // Fix syntax error. Next attempt at resolving still fails, because the failed file is not // in the list of build system files and therefore the default RestoreAndTrackChanges mode // cannot detect any changes. m_logSink->errors.clear(); REPLACE_IN_FILE("broken-product.qbs", "syntax error", ""); WAIT_FOR_NEW_TIMESTAMP(); resolveJob.reset(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(resolveJob.get()); QVERIFY2(!resolveJob->error().hasError(), qPrintable(resolveJob->error().toString())); QVERIFY(!m_logSink->errors.isEmpty()); QVERIFY(resolveJob->project().projectData().products().isEmpty()); // Now force a new resolve, which should succeed. m_logSink->errors.clear(); setupParams.setRestoreBehavior(qbs::SetupProjectParameters::RestoreAndResolve); resolveJob.reset(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(resolveJob.get()); QVERIFY2(!resolveJob->error().hasError(), qPrintable(resolveJob->error().toString())); QVERIFY(m_logSink->errors.isEmpty()); QCOMPARE(int(resolveJob->project().projectData().products().size()), 1); // Build the product. BuildDescriptionReceiver bdr; std::unique_ptr buildJob( resolveJob->project().buildAllProducts(qbs::BuildOptions())); connect( buildJob.get(), &qbs::BuildJob::reportCommandDescription, &bdr, &BuildDescriptionReceiver::handleDescription); QVERIFY(waitForFinished(buildJob.get())); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); QVERIFY2(bdr.descriptions.contains("creating dummy.txt"), qPrintable(bdr.descriptions)); buildJob.reset(nullptr); // Now force a new resolve again and verify that nothing gets rebuilt. m_logSink->errors.clear(); bdr.descriptions.clear(); resolveJob.reset(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(resolveJob.get()); QVERIFY2(!resolveJob->error().hasError(), qPrintable(resolveJob->error().toString())); QVERIFY(m_logSink->errors.isEmpty()); QCOMPARE(int(resolveJob->project().projectData().products().size()), 1); buildJob.reset(resolveJob->project().buildAllProducts(qbs::BuildOptions())); connect( buildJob.get(), &qbs::BuildJob::reportCommandDescription, &bdr, &BuildDescriptionReceiver::handleDescription); QVERIFY(waitForFinished(buildJob.get())); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); QVERIFY2(bdr.descriptions.isEmpty(), qPrintable(bdr.descriptions)); } void TestApi::ruleConflict() { const qbs::ErrorInfo errorInfo = doBuildProject("rule-conflict"); QVERIFY(errorInfo.hasError()); const QString errorString = errorInfo.toString(); QVERIFY2(errorString.contains("conflict") && errorString.contains("pch1.h") && errorString.contains("pch2.h"), qPrintable(errorString)); } void TestApi::runEnvForDisabledProduct() { const qbs::SetupProjectParameters params = defaultSetupParameters("run-disabled-product/run-disabled-product.qbs"); const std::unique_ptr setupJob(qbs::Project().setupProject(params, m_logSink, nullptr)); QVERIFY(waitForFinished(setupJob.get())); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); const qbs::Project project = setupJob->project(); const std::unique_ptr buildJob(project.buildAllProducts(qbs::BuildOptions())); QVERIFY(waitForFinished(buildJob.get())); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); const qbs::ProjectData projectData = project.projectData(); const QList products = projectData.products(); QCOMPARE(products.size(), 1); const qbs::ProductData product = products.front(); qbs::RunEnvironment runEnv = project.getRunEnvironment( product, qbs::InstallOptions(), QProcessEnvironment(), QStringList(), settings().get()); qbs::ErrorInfo runError; const QProcessEnvironment env = runEnv.runEnvironment(&runError); QVERIFY2(runError.toString().contains("Cannot run disabled product 'app'"), qPrintable(runError.toString())); runError.clear(); runEnv.runTarget(QString(), QStringList(), true, &runError); QVERIFY2(runError.toString().contains("Cannot run disabled product 'app'"), qPrintable(runError.toString())); } void TestApi::softDependency() { const qbs::ErrorInfo errorInfo = doBuildProject("soft-dependency"); VERIFY_NO_ERROR(errorInfo); } void TestApi::sourceFileInBuildDir() { VERIFY_NO_ERROR(doBuildProject("source-file-in-build-dir")); qbs::SetupProjectParameters setupParams = defaultSetupParameters("source-file-in-build-dir"); const QString generatedFile = relativeProductBuildDir("theProduct") + "/generated.cpp"; QVERIFY2(regularFileExists(generatedFile), qPrintable(generatedFile)); std::unique_ptr job(qbs::Project().setupProject(setupParams, m_logSink, nullptr)); waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); const qbs::ProjectData projectData = job->project().projectData(); QCOMPARE(projectData.allProducts().size(), 1); const qbs::ProductData product = projectData.allProducts().front(); QCOMPARE(product.profile(), profileName()); const qbs::GroupData group = findGroup(product, "the group"); QVERIFY(group.isValid()); QCOMPARE(group.allFilePaths().size(), 1); } void TestApi::subProjects() { const qbs::SetupProjectParameters params = defaultSetupParameters("subprojects/toplevelproject.qbs"); removeBuildDir(params); // Check all three types of subproject creation, plus property overrides. qbs::ErrorInfo errorInfo = doBuildProject("subprojects/toplevelproject.qbs"); VERIFY_NO_ERROR(errorInfo); // Disabling both the project with the dependency and the one with the dependent // should not cause an error. WAIT_FOR_NEW_TIMESTAMP(); QFile f(params.projectFilePath()); QVERIFY(f.open(QIODevice::ReadWrite)); QByteArray contents = f.readAll(); contents.replace("condition: true", "condition: false"); f.resize(0); f.write(contents); f.close(); f.setFileName(params.buildRoot() + "/subproject2/subproject2.qbs"); QVERIFY(f.open(QIODevice::ReadWrite)); contents = f.readAll(); contents.replace("condition: qbs.targetOS.length > 0", "condition: false"); f.resize(0); f.write(contents); f.close(); errorInfo = doBuildProject("subprojects/toplevelproject.qbs"); VERIFY_NO_ERROR(errorInfo); // Disabling the project with the dependency only is an error. // This tests also whether changes in sub-projects are detected. WAIT_FOR_NEW_TIMESTAMP(); f.setFileName(params.projectFilePath()); QVERIFY(f.open(QIODevice::ReadWrite)); contents = f.readAll(); contents.replace("condition: false", "condition: true"); f.resize(0); f.write(contents); f.close(); errorInfo = doBuildProject("subprojects/toplevelproject.qbs"); QVERIFY(errorInfo.hasError()); QVERIFY2(errorInfo.toString().contains("Dependency 'testLib' not found"), qPrintable(errorInfo.toString())); } void TestApi::targetArtifactStatus_data() { QTest::addColumn("enableTagging"); QTest::newRow("tagging off") << false; QTest::newRow("tagging on") << true; QTest::newRow("tagging off again") << false; } void TestApi::targetArtifactStatus() { QFETCH(bool, enableTagging); qbs::SetupProjectParameters params = defaultSetupParameters("target-artifact-status/target-artifact-status.qbs"); params.setOverriddenValues({std::make_pair("products.p.enableTagging", enableTagging)}); const std::unique_ptr setupJob(qbs::Project().setupProject(params, m_logSink, nullptr)); waitForFinished(setupJob.get()); VERIFY_NO_ERROR(setupJob->error()); const qbs::Project project = setupJob->project(); QVERIFY(project.isValid()); const std::unique_ptr buildJob(project.buildAllProducts(qbs::BuildOptions())); QVERIFY(waitForFinished(buildJob.get())); VERIFY_NO_ERROR(buildJob->error()); const qbs::ProjectData projectData = project.projectData(); const QList products = projectData.products(); QCOMPARE(products.size(), 1); const qbs::ProductData product = products.front(); QCOMPARE(product.targetArtifacts().size(), enableTagging ? 2 : 1); } void TestApi::timeout() { QFETCH(QString, projectDirName); QFETCH(QString, cancelOutput); const auto setupParams = defaultSetupParameters(projectDirName + "/timeout.qbs"); std::unique_ptr setupJob{ qbs::Project().setupProject(setupParams, m_logSink, nullptr)}; waitForFinished(setupJob.get()); if (m_logSink->output.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); auto project = setupJob->project(); const auto products = project.projectData().products(); QList helperProducts; qbs::ProductData productUnderTest; for (const auto &product : products) { if (!product.type().contains(QLatin1String("product-under-test"))) helperProducts.append(product); else productUnderTest = product; } const std::unique_ptr buildHelpersJob{ project.buildSomeProducts(helperProducts, qbs::BuildOptions())}; QVERIFY(waitForFinished(buildHelpersJob.get(), testTimeoutInMsecs())); if (buildHelpersJob->error().hasError()) { qDebug().noquote() << buildHelpersJob->error().toString(); QFAIL("Could not build helper products"); } const std::unique_ptr buildJob(project.buildOneProduct(productUnderTest, qbs::BuildOptions())); QVERIFY(waitForFinished(buildJob.get(), testTimeoutInMsecs())); QVERIFY(buildJob->error().hasError()); const auto errorString = buildJob->error().toString(); QVERIFY2(errorString.contains("cancel"), qPrintable(errorString)); QVERIFY(errorString.contains("timeout")); QVERIFY(errorString.contains(cancelOutput)); } void TestApi::timeout_data() { QTest::addColumn("projectDirName"); QTest::addColumn("cancelOutput"); QTest::newRow("JS Command") << QString("timeout-js") << QString("infinite loop"); QTest::newRow("Process Command") << QString("timeout-process") << QString("infinite-loop"); } void TestApi::toolInModule() { QVariantMap overrides({std::make_pair("qbs.installRoot", m_workingDataDir + "/tool-in-module/use-outside-project")}); qbs::SetupProjectParameters params = defaultSetupParameters("tool-in-module/use-within-project/use-within-project.qbs"); params.setOverriddenValues(overrides); std::unique_ptr setupJob( qbs::Project().setupProject(params, m_logSink, nullptr)); QVERIFY(waitForFinished(setupJob.get())); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); if (m_logSink->output.contains("target platform/arch differ from host platform/arch")) QSKIP("Cannot run binaries in cross-compiled build"); std::unique_ptr buildJob(setupJob->project() .buildAllProducts(qbs::BuildOptions())); QVERIFY(waitForFinished(buildJob.get())); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); const QString toolOutput = relativeProductBuildDir("user-in-project") + "/tool-output.txt"; QVERIFY2(QFile::exists(toolOutput), qPrintable(toolOutput)); params = defaultSetupParameters("tool-in-module/use-outside-project/use-outside-project.qbs"); setupJob.reset(qbs::Project().setupProject(params, m_logSink, nullptr)); QVERIFY(waitForFinished(setupJob.get())); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); const auto project = setupJob->project(); const auto projectData = project.projectData(); const auto products = projectData.products(); QCOMPARE(products.size(), 1); const qbs::ProductData product = products.front(); const auto groups = product.groups(); for (const qbs::GroupData &group : groups) QVERIFY(group.name() != "thetool binary"); buildJob.reset(setupJob->project().buildAllProducts(qbs::BuildOptions())); QVERIFY(waitForFinished(buildJob.get())); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); const QString toolOutput2 = relativeProductBuildDir("user-outside-project") + "/tool-output.txt"; QVERIFY2(QFile::exists(toolOutput2), qPrintable(toolOutput2)); } void TestApi::trackAddQObjectHeader() { const qbs::SetupProjectParameters params = defaultSetupParameters("missing-qobject-header/missingheader.qbs"); QFile qbsFile(params.projectFilePath()); QVERIFY(qbsFile.open(QIODevice::WriteOnly | QIODevice::Truncate)); qbsFile.write("CppApplication {\n Depends { name: 'Qt.core' }\n" " files: ['main.cpp', 'myobject.cpp']\n}"); qbsFile.close(); ProcessResultReceiver receiver; qbs::ErrorInfo errorInfo = doBuildProject("missing-qobject-header/missingheader.qbs", nullptr, &receiver); QVERIFY(errorInfo.hasError()); QVERIFY2(isAboutUndefinedSymbols(receiver.output), qPrintable(receiver.output)); WAIT_FOR_NEW_TIMESTAMP(); QVERIFY(qbsFile.open(QIODevice::WriteOnly | QIODevice::Truncate)); qbsFile.write("CppApplication {\n Depends { name: 'Qt.core' }\n" " files: ['main.cpp', 'myobject.cpp','myobject.h']\n}"); qbsFile.close(); errorInfo = doBuildProject("missing-qobject-header/missingheader.qbs"); VERIFY_NO_ERROR(errorInfo); } void TestApi::trackRemoveQObjectHeader() { const qbs::SetupProjectParameters params = defaultSetupParameters("missing-qobject-header/missingheader.qbs"); removeBuildDir(params); QFile qbsFile(params.projectFilePath()); QVERIFY(qbsFile.open(QIODevice::WriteOnly | QIODevice::Truncate)); qbsFile.write("CppApplication {\n Depends { name: 'Qt.core' }\n" " files: ['main.cpp', 'myobject.cpp','myobject.h']\n}"); qbsFile.close(); qbs::ErrorInfo errorInfo = doBuildProject("missing-qobject-header/missingheader.qbs"); VERIFY_NO_ERROR(errorInfo); WAIT_FOR_NEW_TIMESTAMP(); QVERIFY(qbsFile.open(QIODevice::WriteOnly | QIODevice::Truncate)); qbsFile.write("CppApplication {\n Depends { name: 'Qt.core' }\n" " files: ['main.cpp', 'myobject.cpp']\n}"); qbsFile.close(); ProcessResultReceiver receiver; errorInfo = doBuildProject("missing-qobject-header/missingheader.qbs", nullptr, &receiver); QVERIFY(errorInfo.hasError()); QVERIFY2(isAboutUndefinedSymbols(receiver.output), qPrintable(receiver.output)); } void TestApi::transformerData() { const qbs::SetupProjectParameters params = defaultSetupParameters("transformer-data/transformer-data.qbs"); const std::unique_ptr setupJob(qbs::Project().setupProject(params, m_logSink, nullptr)); QVERIFY(waitForFinished(setupJob.get())); QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); const qbs::Project project = setupJob->project(); const std::unique_ptr buildJob(project.buildAllProducts(qbs::BuildOptions())); QVERIFY(waitForFinished(buildJob.get())); QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString())); qbs::ErrorInfo error; const qbs::ProjectTransformerData projectTData = project.transformerData(&error); QVERIFY2(!error.hasError(), qPrintable(error.toString())); QCOMPARE(projectTData.size(), 1); const qbs::ProductTransformerData productTData = projectTData.first().second; QCOMPARE(productTData.size(), 2); bool firstTransformerFound = false; bool secondTransformerFound = false; for (const qbs::TransformerData &tData : productTData) { if (tData.inputs().empty()) { firstTransformerFound = true; QCOMPARE(tData.outputs().size(), 1); QCOMPARE(QFileInfo(tData.outputs().first().filePath()).fileName(), QString("artifact1")); QCOMPARE(tData.commands().size(), 1); QCOMPARE(tData.commands().first().type(), qbs::RuleCommand::JavaScriptCommandType); } else { secondTransformerFound = true; QCOMPARE(tData.inputs().size(), 1); QCOMPARE(QFileInfo(tData.inputs().first().filePath()).fileName(), QString("artifact1")); QCOMPARE(tData.outputs().size(), 1); QCOMPARE(QFileInfo(tData.outputs().first().filePath()).fileName(), QString("artifact2")); QCOMPARE(tData.commands().size(), 1); QCOMPARE(tData.commands().first().type(), qbs::RuleCommand::JavaScriptCommandType); } } QVERIFY(firstTransformerFound); QVERIFY(secondTransformerFound); } void TestApi::transformers() { const qbs::ErrorInfo errorInfo = doBuildProject("transformers/transformers.qbs"); VERIFY_NO_ERROR(errorInfo); } void TestApi::typeChange() { BuildDescriptionReceiver receiver; qbs::ErrorInfo errorInfo = doBuildProject("type-change", &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY2(!receiver.descriptions.contains("compiling"), qPrintable(receiver.descriptions)); WAIT_FOR_NEW_TIMESTAMP(); QFile projectFile("type-change.qbs"); QVERIFY2(projectFile.open(QIODevice::ReadWrite), qPrintable(projectFile.errorString())); QByteArray content = projectFile.readAll(); content.replace("//", ""); projectFile.resize(0); projectFile.write(content); projectFile.close(); errorInfo = doBuildProject("type-change", &receiver); VERIFY_NO_ERROR(errorInfo); QVERIFY2(receiver.descriptions.contains("compiling"), qPrintable(receiver.descriptions)); } void TestApi::uic() { const qbs::ErrorInfo errorInfo = doBuildProject("uic"); VERIFY_NO_ERROR(errorInfo); } qbs::ErrorInfo TestApi::doBuildProject( const QString &projectFilePath, BuildDescriptionReceiver *buildDescriptionReceiver, ProcessResultReceiver *procResultReceiver, TaskReceiver *taskReceiver, const qbs::BuildOptions &options, const QVariantMap &overriddenValues) { qbs::SetupProjectParameters params = defaultSetupParameters(projectFilePath); params.setOverriddenValues(overriddenValues); params.setDryRun(options.dryRun()); const std::unique_ptr setupJob(qbs::Project().setupProject(params, m_logSink, nullptr)); if (taskReceiver) { connect(setupJob.get(), &qbs::AbstractJob::taskStarted, taskReceiver, &TaskReceiver::handleTaskStart); } waitForFinished(setupJob.get()); if (setupJob->error().hasError()) return setupJob->error(); const std::unique_ptr buildJob(setupJob->project().buildAllProducts(options)); if (buildDescriptionReceiver) { connect(buildJob.get(), &qbs::BuildJob::reportCommandDescription, buildDescriptionReceiver, &BuildDescriptionReceiver::handleDescription); } if (procResultReceiver) { connect(buildJob.get(), &qbs::BuildJob::reportProcessResult, procResultReceiver, &ProcessResultReceiver::handleProcessResult); } waitForFinished(buildJob.get()); return buildJob->error(); } QString TestApi::getProductFilePath(const QString &productNameOrFilePath) { if (productNameOrFilePath.isEmpty()) return {}; return productNameOrFilePath.contains('/') ? productNameOrFilePath : relativeExecutableFilePath(productNameOrFilePath, m_logSink->output.toLocal8Bit()); } QTEST_MAIN(TestApi) #include "tst_api.moc" qbs-src-3.2.0/tests/auto/api/tst_api.h0000644000175100017510000001310215154533055017176 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** 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 QBS_TST_API_H #define QBS_TST_API_H #include #include #include namespace qbs { class ErrorInfo; class SetupProjectParameters; } class BuildDescriptionReceiver; class LogSink; class ProcessResultReceiver; class TaskReceiver; class TestApi : public QObject { Q_OBJECT public: TestApi(); ~TestApi() override; private slots: void initTestCase(); void init(); void addQObjectMacroToCppFile(); void addedFilePersistent(); void baseProperties(); void buildErrorCodeLocation(); void buildGraphInfo(); void buildGraphLocking(); void buildProject(); void buildProject_data(); void buildProjectDryRun(); void buildProjectDryRun_data(); void buildSingleFile(); void canonicalToolchainList(); void changeContent(); void changeDependentLib(); void checkOutputs(); void checkOutputs_data(); void commandExtraction(); void dependencyOnMultiplexedType(); void disabledInstallGroup(); void disabledProduct(); void disabledProject(); void disappearedWildcardFile(); void duplicateProductNames(); void duplicateProductNames_data(); void emptyFileTagList(); void emptySubmodulesList(); void enableAndDisableProduct(); void errorInSetupRunEnvironment(); void excludedInputs(); void explicitlyDependsOn(); void exportSimple(); void exportWithRecursiveDepends(); void fallbackGcc(); void fileTagger(); void fileTagsFilterOverride(); void generatedFilesList(); void groupVisibility(); void infiniteLoopBuilding(); void infiniteLoopBuilding_data(); void infiniteLoopResolving(); void inheritQbsSearchPaths(); void installableFiles(); void isRunnable(); void linkDynamicLibs(); void linkDynamicAndStaticLibs(); void linkDynamicAndObjectLibs(); void linkStaticAndDynamicLibs(); void linkObjectAndDynamicLibs(); void listBuildSystemFiles(); void localProfiles(); void localProfiles_data(); void missingSourceFile(); void mocCppIncluded(); void multiArch(); void multiplexing(); void newOutputArtifactInDependency(); void newPatternMatch(); void noAssertsInRelaxedMode(); void nonexistingProjectPropertyFromCommandLine(); void nonexistingProjectPropertyFromProduct(); void objC(); void projectDataAfterProductInvalidation(); void processResult(); void processResult_data(); void projectInvalidation(); void projectLocking(); void projectPropertiesByName(); void projectWithPropertiesItem(); void projectWithProbeAndProfileItem(); void propertiesBlocks(); void rc(); void referencedFileErrors(); void referencedFileErrors_data(); void references(); void relaxedModeRecovery(); void removeFileDependency(); void renameProduct(); void renameTargetArtifact(); void renamedQbsSource(); void resolveProject(); void resolveProject_data(); void resolveProjectDryRun(); void resolveProjectDryRun_data(); void restoredWarnings(); void restoreAndResolve(); void ruleConflict(); void runEnvForDisabledProduct(); void softDependency(); void sourceFileInBuildDir(); void subProjects(); void targetArtifactStatus_data(); void targetArtifactStatus(); void timeout(); void timeout_data(); void toolInModule(); void trackAddQObjectHeader(); void trackRemoveQObjectHeader(); void transformerData(); void transformers(); void typeChange(); void uic(); private: qbs::SetupProjectParameters defaultSetupParameters(const QString &projectFileOrDir) const; qbs::ErrorInfo doBuildProject(const QString &projectFilePath, BuildDescriptionReceiver *buildDescriptionReceiver = 0, ProcessResultReceiver *procResultReceiver = 0, TaskReceiver *taskReceiver = 0, const qbs::BuildOptions &options = qbs::BuildOptions(), const QVariantMap &overriddenValues = QVariantMap()); QString getProductFilePath(const QString &productNameOrFilePath); LogSink * const m_logSink; const QString m_sourceDataDir; const QString m_workingDataDir; }; #endif // Include guard. qbs-src-3.2.0/tests/auto/shared.h0000644000175100017510000003277715154533055016253 0ustar runnerrunner/**************************************************************************** ** ** 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 QBS_TEST_SHARED_H #define QBS_TEST_SHARED_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define REPLACE_IN_FILE(filePath, oldContent, newContent) \ do { \ QFile f((filePath)); \ QVERIFY2(f.open(QIODevice::ReadWrite), qPrintable(f.errorString())); \ QByteArray content = f.readAll(); \ const QByteArray savedContent = content; \ content.replace((oldContent), (newContent)); \ QVERIFY(content != savedContent); \ f.resize(0); \ f.write(content); \ } while (false) inline int testTimeoutInMsecs() { bool ok; int timeoutInSecs = qEnvironmentVariableIntValue("QBS_AUTOTEST_TIMEOUT", &ok); if (!ok) timeoutInSecs = 600; return timeoutInSecs * 1000; } // On Windows, it appears that a lock is sometimes held on files for a short while even after // they are closed. The likelihood for that seems to increase with the slowness of the machine. inline void waitForFileUnlock() { bool ok; int timeoutInSecs = qEnvironmentVariableIntValue("QBS_AUTOTEST_IO_GRACE_PERIOD", &ok); if (!ok) timeoutInSecs = qbs::Internal::HostOsInfo::isWindowsHost() ? 1 : 0; if (timeoutInSecs > 0) QTest::qWait(timeoutInSecs * 1000); } using SettingsPtr = std::unique_ptr; inline SettingsPtr settings() { const QString settingsDir = QLatin1String(qgetenv("QBS_AUTOTEST_SETTINGS_DIR")); return std::make_unique(settingsDir); } inline QString profileName() { const QString suiteProfile = QLatin1String( qgetenv("QBS_AUTOTEST_PROFILE_" QBS_TEST_SUITE_NAME)); if (!suiteProfile.isEmpty()) return suiteProfile; const QString profile = QLatin1String(qgetenv("QBS_AUTOTEST_PROFILE")); return !profile.isEmpty() ? profile : QLatin1String("none"); } inline QString relativeBuildDir(const QString &configurationName = QString()) { return !configurationName.isEmpty() ? configurationName : QLatin1String("default"); } inline QString relativeBuildGraphFilePath(const QString &configName = QString()) { return relativeBuildDir(configName) + QLatin1Char('/') + relativeBuildDir(configName) + QLatin1String(".bg"); } inline bool regularFileExists(const QString &filePath) { const QFileInfo fi(filePath); return fi.exists() && fi.isFile(); } inline bool directoryExists(const QString &dirPath) { const QFileInfo fi(dirPath); return fi.exists() && fi.isDir(); } struct ReadFileContentResult { QByteArray content; QString errorString; }; inline ReadFileContentResult readFileContent(const QString &filePath) { ReadFileContentResult result; QFile file(filePath); if (!file.open(QIODevice::ReadOnly)) { result.errorString = file.errorString(); return result; } result.content = file.readAll(); return result; } inline QByteArray diffText(const QByteArray &actual, const QByteArray &expected) { QByteArray result; QList actualLines = actual.split('\n'); QList expectedLines = expected.split('\n'); int n = 1; while (!actualLines.isEmpty() && !expectedLines.isEmpty()) { QByteArray actualLine = actualLines.takeFirst(); QByteArray expectedLine = expectedLines.takeFirst(); if (actualLine != expectedLine) { result += QStringLiteral("%1: actual: %2\n%1:expected: %3\n") .arg(n, 2) .arg(QString::fromUtf8(actualLine)) .arg(QString::fromUtf8(expectedLine)) .toUtf8(); } n++; } auto addLines = [&result, &n] (const QList &lines) { for (const QByteArray &line : std::as_const(lines)) { result += QStringLiteral("%1: %2\n") .arg(n) .arg(QString::fromUtf8(line)) .toUtf8(); n++; } }; if (!actualLines.isEmpty()) { result += "Extra unexpected lines:\n"; addLines(actualLines); } if (!expectedLines.isEmpty()) { result += "Missing expected lines:\n"; addLines(expectedLines); } return result; } #define READ_TEXT_FILE(filePath, contentVariable) \ QByteArray contentVariable; \ { \ auto c = readFileContent(filePath); \ QVERIFY2(c.errorString.isEmpty(), \ qUtf8Printable(QStringLiteral("Cannot open file %1. %2") \ .arg(filePath, c.errorString))); \ contentVariable = std::move(c.content); \ } #define TEXT_FILE_COMPARE(actualFilePath, expectedFilePath) \ { \ READ_TEXT_FILE(actualFilePath, ba1); \ READ_TEXT_FILE(expectedFilePath, ba2); \ if (ba1 != ba2) { \ QByteArray msg = "File contents differ:\n" + diffText(ba1, ba2); \ QFAIL(msg.constData()); \ } \ } template inline QString prefixedIfNonEmpty(const T &prefix, const QString &str) { if (str.isEmpty()) return QString(); return prefix + str; } inline QString uniqueProductName(const QString &productName, const QString &multiplexConfigurationId) { return productName + prefixedIfNonEmpty(QLatin1Char('.'), multiplexConfigurationId); } inline QString relativeProductBuildDir(const QString &productName, const QString &configurationName = QString(), const QString &multiplexConfigurationId = QString()) { const QString fullName = uniqueProductName(productName, multiplexConfigurationId); QString dirName = qbs::Internal::HostOsInfo::rfc1034Identifier(fullName); const QByteArray hash = QCryptographicHash::hash(fullName.toUtf8(), QCryptographicHash::Sha1); dirName.append('.').append(hash.toHex().left(8)); return relativeBuildDir(configurationName) + '/' + dirName; } inline QString appendExecSuffix(const QString &productName, const QByteArray &output) { const QByteArray marker = "executable suffix: "; const int markerOffset = output.indexOf(marker); if (markerOffset == -1) return ".error"; const int suffixOffset = markerOffset + marker.size(); const int newlineOffset = output.indexOf('\n', suffixOffset); if (newlineOffset == -1) return ".error"; return productName + QString::fromLocal8Bit( output.mid(suffixOffset, newlineOffset - suffixOffset).trimmed()); } inline QString relativeExecutableFilePath( const QString &productName, const QByteArray &output, const QString &configName = QString()) { const auto relativeDir = relativeProductBuildDir(productName, configName) + QLatin1Char('/'); return relativeDir + appendExecSuffix(productName, output); } inline void waitForNewTimestamp(const QString &testDir) { // Waits for the time that corresponds to the host file system's time stamp granularity. if (qbs::Internal::HostOsInfo::isWindowsHost()) { QTest::qWait(1); // NTFS has 100 ns precision. Let's ignore exFAT. } else { const QString nameTemplate = testDir + "/XXXXXX"; QTemporaryFile f1(nameTemplate); if (!f1.open()) qFatal("Failed to open temp file"); const QDateTime initialTime = QFileInfo(f1).lastModified(); int totalMsPassed = 0; while (totalMsPassed <= 2000) { static const int increment = 50; QTest::qWait(increment); totalMsPassed += increment; QTemporaryFile f2(nameTemplate); if (!f2.open()) qFatal("Failed to open temp file"); if (QFileInfo(f2).lastModified() > initialTime) return; } qWarning("Got no new timestamp after two seconds, going ahead anyway. Subsequent " "test failure might not be genuine."); } } inline void touch(const QString &fn) { QFile f(fn); int s = f.size(); if (!f.open(QFile::ReadWrite)) qFatal("cannot open file %s", qPrintable(fn)); f.resize(s+1); f.resize(s); } inline void copyFileAndUpdateTimestamp(const QString &source, const QString &target) { QFile::remove(target); if (!QFile::copy(source, target)) qFatal("Failed to copy '%s' to '%s'", qPrintable(source), qPrintable(target)); touch(target); } inline QString parsedObjectSuffix(const QByteArray &output) { const QByteArray marker = "object suffix: "; const int markerOffset = output.indexOf(marker); if (markerOffset == -1) return ".fail"; const int suffixOffset = markerOffset + marker.size(); const int newlineOffset = output.indexOf('\n', suffixOffset); if (newlineOffset == -1) return ".fail"; return QString::fromLocal8Bit(output.mid(suffixOffset, newlineOffset - suffixOffset).trimmed()); } inline QString inputDirHash(const QString &dir) { return QCryptographicHash::hash(dir.toLatin1(), QCryptographicHash::Sha1).toHex().left(16); } inline QString testDataSourceDir(const QString &dir) { QDir result; QString testSourceRootDirFromEnv = QDir::fromNativeSeparators(qEnvironmentVariable("QBS_TEST_SOURCE_ROOT")); if (testSourceRootDirFromEnv.isEmpty()) { result.setPath(dir); } else { QDir testSourceRootDir(dir); while (testSourceRootDir.dirName() != "tests") testSourceRootDir = QFileInfo(testSourceRootDir, "").dir(); QString relativeDataPath = testSourceRootDir.relativeFilePath(dir); QString absoluteDataPath = QDir(testSourceRootDirFromEnv).absoluteFilePath(relativeDataPath); result.setPath(absoluteDataPath); } if (!result.exists()) qFatal("Expected data folder '%s' to be present, but it does not exist. You may set " "QBS_TEST_SOURCE_ROOT to the 'tests' folder in your qbs repository to configure " "a custom location.", qPrintable(result.absolutePath())); return result.absolutePath(); } inline QString testWorkDir(const QString &testName) { QString dir = QDir::fromNativeSeparators(QString::fromLocal8Bit(qgetenv("QBS_TEST_WORK_ROOT"))); if (dir.isEmpty()) { dir = QCoreApplication::applicationDirPath() + QStringLiteral("/../tests/auto/"); } else { if (!dir.endsWith(QLatin1Char('/'))) dir += QLatin1Char('/'); } return QDir::cleanPath(dir + testName + "/testWorkDir"); } inline bool copyDllExportHeader(const QString &srcDataDir, const QString &targetDataDir) { QFile sourceFile(srcDataDir + "/../../dllexport.h"); if (!sourceFile.exists()) return true; const QString targetPath = targetDataDir + "/dllexport.h"; QFile::remove(targetPath); return sourceFile.copy(targetPath); } #endif // Include guard. qbs-src-3.2.0/tests/auto/language/0000755000175100017510000000000015154533055016377 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/tst_language.h0000644000175100017510000001706015154533055021231 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 TST_LANGUAGE_H #define TST_LANGUAGE_H #include #include #include #include #include #include #include #include class TestLanguage : public QObject { Q_OBJECT public: TestLanguage(qbs::ILogSink *logSink, qbs::Settings *settings); ~TestLanguage(); private slots: void init(); void initTestCase(); void additionalProductTypes(); void baseProperty(); void baseValidation(); void brokenDependencyCycle(); void brokenDependencyCycle_data(); void buildConfigStringListSyntax(); void builtinFunctionInSearchPathsProperty(); void chainedProbes(); void canonicalArchitecture(); void conditionalDepends(); void convertStringList(); void correctDeclInParentLookup(); void delayedError(); void delayedError_data(); void dependencyOnAllProfiles(); void dependsItemInGroup_data(); void dependsItemInGroup(); void derivedSubProject(); void disabledPropertiesItem_data(); void disabledPropertiesItem(); void disabledSubProject(); void dottedNames_data(); void dottedNames(); void duplicateMultiplexValues_data(); void duplicateMultiplexValues(); void emptyJsFile(); void enumerateProjectProperties(); void evalErrorInNonPresentModule_data(); void evalErrorInNonPresentModule(); void environmentVariable(); void errorInDisabledProduct(); void erroneousFiles_data(); void erroneousFiles(); void exports(); void fileContextProperties(); void fileInProductAndModule_data(); void fileInProductAndModule(); void fileTags_data(); void fileTags(); void groupConditions_data(); void groupConditions(); void groupName(); void getNativeSetting(); void homeDirectory(); void identifierSearch_data(); void identifierSearch(); void idUsage(); void idUniqueness(); void importCollection(); void inheritedPropertiesItems_data(); void inheritedPropertiesItems(); void invalidBindingInDisabledItem(); void invalidOverrides(); void invalidOverrides_data(); void invalidPropOnNonRequiredModule_data(); void invalidPropOnNonRequiredModule(); void itemPrototype(); void itemScope(); void jsExtensions(); void jsImportUsedInMultipleScopes_data(); void jsImportUsedInMultipleScopes(); void keepLoadingDependencies(); void localProfileAsTopLevelProfile(); void moduleMergingVariantValues(); void moduleNameCollisions_data(); void moduleNameCollisions(); void moduleParameters_data(); void moduleParameters(); void modulePrioritizationBySearchPath_data(); void modulePrioritizationBySearchPath(); void moduleProperties_data(); void moduleProperties(); void modulePropertiesInGroups(); void modulePropertyOverridesPerProduct(); void moduleScope(); void moduleWithProductDependency(); void modules_data(); void modules(); void multipleModuleBackendsViaOwnProperty_data(); void multipleModuleBackendsViaOwnProperty(); void multiplexedExports(); void multiplexingByProfile(); void multiplexingByProfile_data(); void nonApplicableModulePropertyInProfile(); void nonApplicableModulePropertyInProfile_data(); void nonRequiredProducts(); void nonRequiredProducts_data(); void outerInGroup(); void overrideProductPropFromSubProjectItem(); void overriddenPropertiesAndPrototypes(); void overriddenPropertiesAndPrototypes_data(); void overriddenVariantProperty(); void parameterTypes(); void projectPropertyForwarding(); void pathProperties(); void probesAndMultiplexing(); void productConditions(); void productDirectories(); void profileValuesAndOverriddenValues(); void projectFileLookup(); void projectFileLookup_data(); void propertiesBlocks_data(); void propertiesBlocks(); void propertiesBlockInGroup_data(); void propertiesBlockInGroup(); void propertiesItemInModule(); void propertyAssignmentInExportedGroup(); void qbs1275(); void qbsPropertiesInProjectCondition(); void qbsPropertyConvenienceOverride(); void relaxedErrorMode(); void relaxedErrorMode_data(); void requiredAndNonRequiredDependencies(); void requiredAndNonRequiredDependencies_data(); void suppressedAndNonSuppressedErrors(); void throwingProbe(); void throwingProbe_data(); void defaultValue(); void defaultValue_data(); void qualifiedId(); void recursiveProductDependencies(); void rfc1034Identifier(); void throwThings_data(); void throwThings(); void useInternalProfile(); void versionCompare(); void wildcards_data(); void wildcards(); private: QHash productsFromProject( qbs::Internal::ResolvedProjectPtr project); qbs::Internal::ResolvedModuleConstPtr findModuleByName( qbs::Internal::ResolvedProductPtr product, const QString &name); QVariant productPropertyValue(qbs::Internal::ResolvedProductPtr product, QString propertyName); void handleInitCleanupDataTags(const char *projectFileName, bool *handled); qbs::Internal::TopLevelProjectPtr resolveProject(const char *relProjectFilePath = nullptr); qbs::ILogSink * const m_logSink; qbs::Settings * const m_settings; qbs::Internal::Logger m_logger; std::unique_ptr m_engine; qbs::Internal::TopLevelProjectPtr project; qbs::SetupProjectParameters defaultParameters; const QString m_wildcardsTestDirPath; QTemporaryDir m_tempDir; QRandomGenerator m_rand; }; #endif // TST_LANGUAGE_H qbs-src-3.2.0/tests/auto/language/CMakeLists.txt0000644000175100017510000000031215154533055021133 0ustar runnerrunneradd_qbs_test(language DEFINES "QBS_VERSION=\"${QBS_VERSION}\"" DEPENDS qbsquickjsheaders Qt6Core5Compat SOURCES tst_language.cpp tst_language.h ) qbs-src-3.2.0/tests/auto/language/testdata/0000755000175100017510000000000015154533055020210 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/file-in-product-and-module.qbs0000644000175100017510000000026215154533055025743 0ustar runnerrunnerProduct { name: "p" Depends { name: "module_with_file" } property bool addFileToProduct Group { files: "zort" condition: addFileToProduct } } qbs-src-3.2.0/tests/auto/language/testdata/throw.qbs0000644000175100017510000000070315154533055022062 0ustar runnerrunnerProject { property string throwType property bool dummy: { if (throwType === "bool") throw true; if (throwType === "int") throw 43; if (throwType === "string") throw "an error"; if (throwType === "list") throw ["an", "error"]; if (throwType === "object") throw { result: "crash", reason: "overheating" }; throw "type missing"; } } qbs-src-3.2.0/tests/auto/language/testdata/main.cpp0000644000175100017510000000000015154533055021626 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/relaxed-error-mode/0000755000175100017510000000000015154533055023705 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/relaxed-error-mode/relaxed-error-mode.qbs0000644000175100017510000000121015154533055030103 0ustar runnerrunnerProject { Product { name: "recursive depender" Depends { name: "depender required" } files: "file1.txt" } Product { name: "broken" Depends { name: "nosuchmodule" } } Product { name: "depender required" Depends { name: "broken" } files: "file1.txt" } Product { name: "depender nonrequired" Depends { name: "broken"; required: false } files: "file1.txt" } Product { name: "missing file" files: ["file1.txt", "file3.txt", "file2.txt"] } Product { name: "fine" files: "file2.txt" } } qbs-src-3.2.0/tests/auto/language/testdata/relaxed-error-mode/file1.txt0000644000175100017510000000000015154533055025434 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/relaxed-error-mode/file2.txt0000644000175100017510000000000015154533055025435 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/non-required-products.qbs0000644000175100017510000000134115154533055025167 0ustar runnerrunnerProject { Product { name: "depender" Depends { name: "dummy" } Depends { name: "dependee"; required: false } Properties { condition: dependee.present dummy.defines: ["WITH_DEPENDEE"] } } Project { name: "subproject" Product { name: "dependee" } } Product { name: "p1" condition: p2.present Depends { name: "p2"; required: false } } Product { name: "p2" condition: p3.present Depends { name: "p3"; required: false } } Product { name: "p3" condition: nosuchmodule.present Depends { name: "nosuchmodule"; required: false } } } qbs-src-3.2.0/tests/auto/language/testdata/module-property-overrides-per-product.qbs0000644000175100017510000000056715154533055030340 0ustar runnerrunnerProject { Product { Depends { name: "dummy" } name: "a" property stringList rpaths: dummy.rpaths } Product { Depends { name: "dummy" } name: "b" property stringList rpaths: dummy.rpaths } Product { Depends { name: "dummy" } name: "c" property stringList rpaths: dummy.rpaths } } qbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/0000755000175100017510000000000015154533055027366 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/project.qbs0000644000175100017510000000005415154533055031542 0ustar runnerrunnerProject { references: ["product.qbs"] } qbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/product.qbs0000644000175100017510000000007215154533055031554 0ustar runnerrunnerProduct { Depends { name: "conflicting-instances" } } qbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/foo/0000755000175100017510000000000015154533055030151 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/foo/modules/0000755000175100017510000000000015154533055031621 5ustar runnerrunner././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/foo/modules/conflicting-instances/qbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/foo/modules/conflict0000755000175100017510000000000015154533055033343 5ustar runnerrunner././@LongLink0000644000000000000000000000017200000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/foo/modules/conflicting-instances/foo.qbsqbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/foo/modules/conflict0000644000175100017510000000006415154533055033345 0ustar runnerrunnerModule { property string moduleVariant: "foo" } qbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/bar/0000755000175100017510000000000015154533055030132 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/bar/modules/0000755000175100017510000000000015154533055031602 5ustar runnerrunner././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/bar/modules/conflicting-instances/qbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/bar/modules/conflict0000755000175100017510000000000015154533055033324 5ustar runnerrunner././@LongLink0000644000000000000000000000017200000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/bar/modules/conflicting-instances/bar.qbsqbs-src-3.2.0/tests/auto/language/testdata/module-prioritization-by-search-path/bar/modules/conflict0000644000175100017510000000006415154533055033326 0ustar runnerrunnerModule { property string moduleVariant: "bar" } qbs-src-3.2.0/tests/auto/language/testdata/narf.zort0000644000175100017510000000000015154533055022044 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/idusage.qbs0000644000175100017510000000135415154533055022343 0ustar runnerrunnerimport "idusagebase.qbs" as DerivedProduct Project { id: theProject property int initialNr: 0 DerivedProduct { id: product1 } Product { id: product2 property int nr: theProject.initialNr + product1.nr + 1 name: "product2_" + nr } Product { id: product3 property int nr: product2.nr + 1 name: "product3_" + nr } DerivedProduct { id: product4 nr: product3.nr + 1 name: "product4_" + nr } Product { name: "product5" Depends { name: "deepdummy.deep.moat"; id: moat } Group { Group { condition: moat.present files: "dummy.txt" } } } } qbs-src-3.2.0/tests/auto/language/testdata/propertiesblocks_base.qbs0000644000175100017510000000041115154533055025277 0ustar runnerrunnerProduct { property bool defineBase: true Depends { name: "dummy" } Properties { condition: defineBase dummy.defines: ["BASE"] } dummy.defines: ["SOMETHING"] property stringList myCFlags: ["BASE"] dummy.cFlags: myCFlags } qbs-src-3.2.0/tests/auto/language/testdata/product-with-property.qbs0000644000175100017510000000005015154533055025225 0ustar runnerrunnerProduct { property string theProp } qbs-src-3.2.0/tests/auto/language/testdata/exports.qbs0000644000175100017510000000735015154533055022430 0ustar runnerrunnerimport "exports_product.qbs" as ProductWithInheritedExportItem Project { Product { type: "app" name: "myapp" Depends { name: "mylib" } Depends { name: "dummy" } Depends { name: "qbs" } dummy.defines: ["BUILD_" + product.name.toUpperCase()] dummy.includePaths: ["./app"] } references: [ "subdir/exports-mylib.qbs", "subdir2/exports-mylib2.qbs" ] Product { type: "app" name: "A" Depends { name: "qbs" } Depends { name: "B" } } Product { type: "lib" name: "B" Export { Depends { name: "C" } Depends { name: "qbs" } } } Product { type: "lib" name: "C" Export { Depends { name: "D" } Depends { name: "qbs" } } } Product { type: "lib" name: "D" } Product { type: "app" name: "myapp2" Depends { name: "productWithInheritedExportItem" } Depends { name: "qbs" } } ProductWithInheritedExportItem { name: "productWithInheritedExportItem" Export { dummy.cFlags: base.concat("PRODUCT_" + exportingProduct.name.toUpperCase()) dummy.cxxFlags: ["-bar"] Properties { dummy.defines: base.concat(["DEF"]) } } } Product { type: "app" name: "myapp3" Depends { name: "productWithInheritedExportItem"; versionAtLeast: "2.0" } } Project { name: "sub1" Product { name: "sub p1" Export { Depends { name: "dummy" } dummy.someString: project.name } } } Project { name: "sub2" Product { name: "sub p2" Depends { name: "sub p1" } } } ParentWithExport { name: "libA" Export { Depends { name: "libB" } } } ParentWithExport { name: "libB" } ParentWithExport { name: "libC" Export { Depends { name: "libA" } } } ParentWithExport { name: "libD" Export { Depends { name: "libA" } } } Product { name: "libE" Depends { name: "libD" } Depends { name: "libC" } Group { qbs.install: false } } Product { name: "dependency" Probe { id: configProbe property var config configure: { var obj = {}; obj.featureX = true; obj.featureY = false; obj.featureZ = true; config = obj; found = true; } } property var config: configProbe.config Export { property bool depend: false property var config: exportingProduct.config Group { condition: depend Depends { name: "cpp" } Properties { cpp.includePaths: ["."] } } } } Product { name: "depender" Depends { name: "dependency" } property bool featureX: dependency.config.featureX property bool featureY: dependency.config.featureY property bool featureZ: dependency.config.featureZ } Product { name: "broken_cycle1" Export { property bool depend: true Depends { name: "broken_cycle3"; condition: depend } } } Product { name: "broken_cycle2" Export { Depends { name: "broken_cycle1" } broken_cycle1.depend: false } } Product { name: "broken_cycle3" Depends { name: "broken_cycle2" } } } qbs-src-3.2.0/tests/auto/language/testdata/property-assignment-in-exported-group.qbs0000644000175100017510000000047315154533055030343 0ustar runnerrunnerProject { Product { name: "dep" Export { Depends { name: "dummy" } Group { name: "exported_group" dummy.someString: "test" files: ["narf"] } } } Product { Depends { name: "dep" } } } qbs-src-3.2.0/tests/auto/language/testdata/baseproperty_base.qbs0000644000175100017510000000010115154533055024420 0ustar runnerrunnerProduct { property var narf property var zort: ["bar"] } qbs-src-3.2.0/tests/auto/language/testdata/baseproperty.qbs0000644000175100017510000000022215154533055023432 0ustar runnerrunnerimport "baseproperty_base.qbs" as BaseProduct BaseProduct { name: "product1" narf: base.concat(["boo"]) zort: base.concat(["boo"]) } qbs-src-3.2.0/tests/auto/language/testdata/properties-block-in-group.qbs0000644000175100017510000000073715154533055025750 0ustar runnerrunnerProduct { name: "in-group" property bool featureEnabled: true Depends { name: "dummy" } Depends { name: "module_with_group" } dummy.defines: ["BASEDEF"] Group { condition: featureEnabled name: "the group" files: ["dummy.txt" ] Properties { condition: name === "the group" dummy.defines: ["FEATURE_ENABLED", name.toUpperCase().replace(' ', '_')] } dummy.defines: "GROUP_ONLY" } } qbs-src-3.2.0/tests/auto/language/testdata/filecontextproperties.qbs0000644000175100017510000000014315154533055025356 0ustar runnerrunnerProduct { name: "product1" property string narf: filePath property string zort: path } qbs-src-3.2.0/tests/auto/language/testdata/dirwithoneproject/0000755000175100017510000000000015154533055023753 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/dirwithoneproject/project.qbs0000644000175100017510000000000015154533055026116 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/multiple-module-backends-via-own-property.qbs0000644000175100017510000000041115154533055031041 0ustar runnerrunnerProduct { name: "p" multiplexByQbsProperties: ["profiles"] qbs.profiles: ["theProfile"] Depends { name: "multiple_backends_via_own_property" } Profile { name: "theProfile" multiple_backends_via_own_property.type: "type1" } } qbs-src-3.2.0/tests/auto/language/testdata/modules.qbs0000644000175100017510000000256615154533055022400 0ustar runnerrunnerProject { Product { name: "no_modules" property var foo } Product { name: "qt_core" dummyqt.core.version: "1.2.3" property var foo: dummyqt.core.coreVersion Depends { name: "dummyqt.core" } } Product { name: "qt_gui" property var foo: dummyqt.gui.guiProperty Depends { name: "dummyqt.gui" } } Product { name: "qt_gui_network" property var foo: dummyqt.gui.guiProperty + ',' + dummyqt.network.networkProperty Depends { name: "dummyqt" submodules: ["gui", "network"] } } Product { name: "deep_module_name" property var foo: deepdummy.deep.moat.depth Depends { name: "deepdummy.deep.moat" } } Product { name: "deep_module_name_submodule_syntax1" property var foo: deepdummy.deep.moat.depth Depends { name: "deepdummy.deep" submodules: ["moat"] } } Product { name: "deep_module_name_submodule_syntax2" property var foo: deepdummy.deep.moat.depth Depends { name: "deepdummy" submodules: ["deep.moat"] } } Product { name: "dummy_twice" Depends { name: "dummy" } Depends { name: "dummy" } } } qbs-src-3.2.0/tests/auto/language/testdata/module-merging-variant-values/0000755000175100017510000000000015154533055026062 5ustar runnerrunner././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/module-merging-variant-values/module-merging-variant-values.qbsqbs-src-3.2.0/tests/auto/language/testdata/module-merging-variant-values/module-merging-variant-valu0000644000175100017510000000017315154533055033330 0ustar runnerrunnerProduct { multiplexByQbsProperties: ["architectures"] qbs.architectures: ["a1", "a2"] Depends { name: "m2" } } qbs-src-3.2.0/tests/auto/language/testdata/module-merging-variant-values/modules/0000755000175100017510000000000015154533055027532 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-merging-variant-values/modules/m2/0000755000175100017510000000000015154533055030050 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-merging-variant-values/modules/m2/m2.qbs0000644000175100017510000000071715154533055031102 0ustar runnerrunnerModule { Depends { name: "m1" } m1.arch: qbs.architecture property string arch: qbs.architecture validate: { if (qbs.architecture !== "a1" && qbs.architecture !== "a2") throw "Unexpected arch " + qbs.architecture; if (arch !== qbs.architecture) throw "Oops: " + arch + "/" + qbs.architecture; if (m1.arch !== qbs.architecture) throw "Oops: " + m1.arch + "/" + qbs.architecture; } } qbs-src-3.2.0/tests/auto/language/testdata/module-merging-variant-values/modules/m1/0000755000175100017510000000000015154533055030047 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-merging-variant-values/modules/m1/m1.qbs0000644000175100017510000000027215154533055031074 0ustar runnerrunnerModule { condition: qbs.architecture === "a1" || qbs.architecture === "a2" property string arch qbs.architecture: undefined // We do something like this in GenericGCC.qbs } qbs-src-3.2.0/tests/auto/language/testdata/buildconfigstringlistsyntax.qbs0000644000175100017510000000006015154533055026572 0ustar runnerrunnerProject { property stringList someStrings } qbs-src-3.2.0/tests/auto/language/testdata/recursive-dependencies/0000755000175100017510000000000015154533055024643 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/recursive-dependencies/recursive-dependencies.qbs0000644000175100017510000000043015154533055032002 0ustar runnerrunnerProject { Product { name: "p1" Depends { name: "p3" } } Product { name: "p2" Depends { name: "p3" } } Product { name: "p3" Export { Depends { name: "p4" } } } Product { name: "p4" } } qbs-src-3.2.0/tests/auto/language/testdata/drawline.asm0000644000175100017510000000000015154533055022505 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/empty-js-file.js0000644000175100017510000000000015154533055023221 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/0000755000175100017510000000000015154533055027545 5ustar runnerrunner././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/required-chain-module.qbsqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/required-chain-modu0000644000175100017510000000021515154533055033330 0ustar runnerrunnerProduct { Depends { name: "failing-validation"; required: false } Depends { name: "failing-validation-indirect"; required: false } } qbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/complicated.qbs0000644000175100017510000000030115154533055032532 0ustar runnerrunnerProduct { Depends { name: "failing-validation"; required: false } Depends { name: "failing-validation-indirect" } Depends { name: "failing-validation-indirect"; required: false } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/dependency-via-export.qbsqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/dependency-via-expo0000644000175100017510000000036715154533055033342 0ustar runnerrunnerProject { Product { name: "dep" Export { Depends { name: "failing-validation" } } } Product { Depends { name: "failing-validation"; required: false } Depends { name: "dep" } } } ././@LongLink0000644000000000000000000000016400000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/required-chain-export-indirect.qbsqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/required-chain-expo0000644000175100017510000000057515154533055033350 0ustar runnerrunnerProject { Product { name: "dep2" Export { Depends { name: "dep1" } } } Product { name: "dep1" Export { Depends { name: "failing-validation-indirect" } } } Product { Depends { name: "failing-validation"; required: false } Depends { name: "dep2"; required: false } } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/direct-dependencies.qbsqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/direct-dependencies0000644000175100017510000000016315154533055033366 0ustar runnerrunnerProduct { Depends { name: "failing-validation"; required: false } Depends { name: "failing-validation" } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/dependency-via-module.qbsqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/dependency-via-modu0000644000175100017510000000017415154533055033327 0ustar runnerrunnerProduct { Depends { name: "failing-validation"; required: false } Depends { name: "failing-validation-indirect" } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/required-chain-export.qbsqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/required-chain-expo0000644000175100017510000000041015154533055033334 0ustar runnerrunnerProject { Product { name: "dep" Export { Depends { name: "failing-validation" } } } Product { Depends { name: "failing-validation"; required: false } Depends { name: "dep"; required: false } } } qbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/0000755000175100017510000000000015154533055031215 5ustar runnerrunner././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-validation/qbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-val0000755000175100017510000000000015154533055033327 5ustar runnerrunner././@LongLink0000644000000000000000000000020300000000000011576 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-validation/failing-validation.qbsqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-val0000644000175100017510000000007015154533055033326 0ustar runnerrunnerModule { validate: { throw "validation error!"; } } ././@LongLink0000644000000000000000000000016600000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-validation-indirect/qbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-val0000755000175100017510000000000015154533055033327 5ustar runnerrunner././@LongLink0000644000000000000000000000022500000000000011602 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-validation-indirect/failing-validation-indirect.qbsqbs-src-3.2.0/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-val0000644000175100017510000000006615154533055033333 0ustar runnerrunnerModule { Depends { name: "failing-validation" } } qbs-src-3.2.0/tests/auto/language/testdata/productdirectories.qbs0000644000175100017510000000003615154533055024633 0ustar runnerrunnerProduct { name: "MyApp" } qbs-src-3.2.0/tests/auto/language/testdata/chained-probes/0000755000175100017510000000000015154533055023073 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/chained-probes/chained-probes.qbs0000644000175100017510000000004615154533055026465 0ustar runnerrunnerProduct { Depends { name: "m" } } qbs-src-3.2.0/tests/auto/language/testdata/chained-probes/modules/0000755000175100017510000000000015154533055024543 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/chained-probes/modules/m/0000755000175100017510000000000015154533055024777 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/chained-probes/modules/m/m.qbs0000644000175100017510000000064615154533055025750 0ustar runnerrunnerModule { Probe { id: probe1 property string probe1Prop configure: { probe1Prop = "probe1Val"; found = true } } Probe { id: probe2 property string inputProp: prop1 property string probe2Prop configure: { probe2Prop = inputProp + "probe2Val"; found = true } } property string prop1: probe1.probe1Prop property string prop2: probe2.probe2Prop } qbs-src-3.2.0/tests/auto/language/testdata/broken-dependency-cycle2.qbs0000644000175100017510000000050115154533055025466 0ustar runnerrunnerProject { Product { name: "p1" Export { property bool c: true Depends { name: "p2"; condition: c } } } Product { name: "p3" Depends { name: "p1" } } Product { name: "p2" Depends { name: "p1" } p1.c: false } } qbs-src-3.2.0/tests/auto/language/testdata/versionCompare.qbs0000644000175100017510000000113515154533055023713 0ustar runnerrunnerimport qbs.Utilities Product { name: { var e = "unexpected comparison result"; if (Utilities.versionCompare("1.5", "1.5") !== 0) throw e; if (Utilities.versionCompare("1.5", "1.5.0") !== 0) throw e; if (Utilities.versionCompare("1.5", "1.6") >= 0) throw e; if (Utilities.versionCompare("1.6", "1.5") <= 0) throw e; if (Utilities.versionCompare("2.5", "1.6") <= 0) throw e; if (Utilities.versionCompare("1.6", "2.5") >= 0) throw e; return "versionCompare"; } } qbs-src-3.2.0/tests/auto/language/testdata/getNativeSetting.qbs0000644000175100017510000000163415154533055024207 0ustar runnerrunnerimport qbs.FileInfo import qbs.Utilities import qbs.Host Project { Product { name: "p1" targetName: { if (Host.os().includes("macos")) { return Utilities.getNativeSetting("/System/Library/CoreServices/SystemVersion.plist", "ProductName"); } else if (Host.os().includes("windows")) { var productName = Utilities.getNativeSetting("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion", "ProductName"); if (productName.includes("Windows")) { return "Windows"; } return undefined; } else { return Utilities.getNativeSetting(FileInfo.joinPaths(path, "nativesettings.ini"), "osname"); } } } Product { name: "p2" targetName: Utilities.getNativeSetting("/dev/null", undefined, "fallback"); } } qbs-src-3.2.0/tests/auto/language/testdata/invalid-overrides.qbs0000644000175100017510000000032215154533055024342 0ustar runnerrunnerProject { name: "My.Project" property bool x Product { name: "MyProduct" property bool x } Product { name: "MyOtherProduct" Depends { name: "cpp" } } } qbs-src-3.2.0/tests/auto/language/testdata/modulepropertiesingroups.qbs0000644000175100017510000000450715154533055026116 0ustar runnerrunnerProject { Product { name: "grouptest" Depends { name: "gmod.gmod1" } Depends { name: "gmod3" } Depends { name: "gmod4" } gmod.gmod1.gmod1_list2: base.concat([name, gmod.gmod1.gmod1_string]) gmod.gmod1.gmod1_list3: ["product"] gmod.gmod1.p1: 1 Group { name: "g1" files: ["Banana"] gmod.gmod1.gmod1_string: name gmod.gmod1.gmod1_list2: outer.concat([name]) gmod.gmod1.p2: 2 gmod2.prop: 1 gmod2.commonName: "g1" gmod3.gmod3_string: "g1_gmod3" gmod4.gmod4_string: "g1_gmod4" Group { name: "g1.1" gmod.gmod1.gmod1_string: name gmod.gmod1.gmod1_list2: outer.concat([name]) gmod.gmod1.p2: 4 gmod2.prop: 2 gmod2.commonName: name gmod3.gmod3_string: "g1.1_gmod3" gmod4.gmod4_string: "g1.1_gmod4" } Group { name: "g1.2" gmod.gmod1.gmod1_string: name gmod.gmod1.gmod1_list2: outer.concat([name]) gmod.gmod1.p2: 8 gmod2.commonName: name gmod3.gmod3_string: "g1.2_gmod3" } } Group { name: "g2" files: ["zort"] gmod.gmod1.gmod1_string: name gmod.gmod1.p1: 2 gmod.gmod1.p2: 4 gmod2.prop: 2 gmod3.gmod3_string: name + "_gmod3" gmod4.gmod4_string: name + "_gmod4" Group { name: "g2.1" Group { name: "g2.1.1" gmod.gmod1.gmod1_list2: [name] gmod.gmod1.p2: 15 } } } } Product { name: "grouptest2" Depends { name: "gmod.gmod1" } Group { name: "g1" gmod.gmod1.gmod1_list2: ["G1"] Group { name: "g1.1" gmod.gmod1.gmod1_string: "G1.1" } } } Product { name: "module-property-in-group-condition" Depends { name: "cpp" } Group { condition: qbs.architecture === "x86_64" cpp.includePaths: "." } } } qbs-src-3.2.0/tests/auto/language/testdata/zort0000644000175100017510000000000015154533055021117 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/depends-item-in-group.qbs0000644000175100017510000000070715154533055025037 0ustar runnerrunnerProject { Product { name: "dep" } Product { name: "main" property bool enableGroup1 property bool enableGroup2 property bool enableDepends Group { condition: enableGroup1 Group { condition: product.enableGroup2 property bool forwarded: product.enableDepends Depends { name: "dep"; condition: forwarded } } } } } qbs-src-3.2.0/tests/auto/language/testdata/disabled-properties-item/0000755000175100017510000000000015154533055025105 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/disabled-properties-item/disabled-properties-item.qbs0000644000175100017510000000102415154533055032506 0ustar runnerrunnerProduct { name: "p" Depends { name: "higher1" } Depends { name: "higher2" } property bool setProp property string value: "fromProduct" property stringList productProp: "default" lower.n: 10 Group { condition: setProp product.lower.prop: value product.lower.listProp: "WITH_PRODUCT_PROP" product.productProp: "condition1" } Group { condition: lower.n > 7 product.lower.listProp: "N_GREATER_7" product.productProp: "condition2" } } qbs-src-3.2.0/tests/auto/language/testdata/disabled-properties-item/modules/0000755000175100017510000000000015154533055026555 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/disabled-properties-item/modules/higher2/0000755000175100017510000000000015154533055030105 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/disabled-properties-item/modules/higher2/higher2.qbs0000644000175100017510000000043315154533055032144 0ustar runnerrunnerModule { Depends { name: "lower" } property bool setProp Properties { condition: setProp lower.prop: undefined lower.listProp: "WITH_HIGHER2_PROP" } Properties { condition: lower.n > 6 lower.listProp: "N_GREATER_6" } } qbs-src-3.2.0/tests/auto/language/testdata/disabled-properties-item/modules/higher1/0000755000175100017510000000000015154533055030104 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/disabled-properties-item/modules/higher1/higher1.qbs0000644000175100017510000000076615154533055032153 0ustar runnerrunnerModule { Depends { name: "lower" } property bool setProp property string value: "fromHigher1" Properties { condition: setProp lower.prop: value lower.listProp: "WITH_HIGHER1_PROP" } Properties { condition: lower.n > 5 lower.listProp: "N_GREATER_5" } Properties { condition: lower.n < 10 lower.listProp: "N_LESS_10" } Properties { condition: lower.n < 20 lower.listProp: "N_LESS_20" } } qbs-src-3.2.0/tests/auto/language/testdata/disabled-properties-item/modules/lower/0000755000175100017510000000000015154533055027705 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/disabled-properties-item/modules/lower/lower.qbs0000644000175100017510000000056715154533055031554 0ustar runnerrunnerModule { property bool setProp property string value: "fromLower" property string prop: "default" property stringList listProp property int n: 0 Group { condition: setProp module.prop: outer + "_" + value module.listProp: "WITH_LOWER_PROP" } Group { condition: n module.listProp: ["N_NON_ZERO"] } } qbs-src-3.2.0/tests/auto/language/testdata/local-profile-as-top-level-profile.qbs0000644000175100017510000000020115154533055027404 0ustar runnerrunnerProduct { Profile { name: "test-profile" qbs.architecture: "arm" qbs.targetPlatform: "macos" } } qbs-src-3.2.0/tests/auto/language/testdata/builtinFunctionInSearchPathsProperty.qbs0000644000175100017510000000024615154533055030257 0ustar runnerrunnerimport qbs.Environment Project { qbsSearchPaths: { if (!Environment.getEnv("PATH")) throw "Environment.getEnv doesn't seem to work"; } } qbs-src-3.2.0/tests/auto/language/testdata/defaultvalue/0000755000175100017510000000000015154533055022671 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/defaultvalue/test.txt0000644000175100017510000000000015154533055024377 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/defaultvalue/egon.qbs0000644000175100017510000000031115154533055024323 0ustar runnerrunnerProject { Product { name: "dep" Export { Depends { name: "higher" } } } Product { name: "egon" Depends { name: "dep" } lower.prop1: "blubb" } } qbs-src-3.2.0/tests/auto/language/testdata/defaultvalue/modules/0000755000175100017510000000000015154533055024341 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/defaultvalue/modules/higher/0000755000175100017510000000000015154533055025607 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/defaultvalue/modules/higher/higher.qbs0000644000175100017510000000025215154533055027563 0ustar runnerrunnerModule { Depends { name: "lower" } lower.prop2: lower.prop1 === "egon" ? "withEgon" : original lower.listProp: lower.prop1 === "egon" ? ["egon"] : original } qbs-src-3.2.0/tests/auto/language/testdata/defaultvalue/modules/lower/0000755000175100017510000000000015154533055025471 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/defaultvalue/modules/lower/lower.qbs0000644000175100017510000000030615154533055027327 0ustar runnerrunnerModule { property string prop1 property string prop2: prop1 === "blubb" ? "withBlubb" : "withoutBlubb" property stringList listProp: prop1 === "blubb" ? ["blubb", "other"] : ["other"] } qbs-src-3.2.0/tests/auto/language/testdata/nativesettings.ini0000644000175100017510000000001615154533055023755 0ustar runnerrunnerosname = Unix qbs-src-3.2.0/tests/auto/language/testdata/import-collection/0000755000175100017510000000000015154533055023653 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/import-collection/collection/0000755000175100017510000000000015154533055026006 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/import-collection/collection/file2.js0000644000175100017510000000004115154533055027340 0ustar runnerrunnerfunction f2() { return "C2f2"; } qbs-src-3.2.0/tests/auto/language/testdata/import-collection/collection/file1.js0000644000175100017510000000004115154533055027337 0ustar runnerrunnerfunction f1() { return "C2f1"; } qbs-src-3.2.0/tests/auto/language/testdata/import-collection/imports/0000755000175100017510000000000015154533055025350 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/import-collection/imports/Collection/0000755000175100017510000000000015154533055027443 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/import-collection/imports/Collection/file2.js0000644000175100017510000000004115154533055030775 0ustar runnerrunnerfunction f2() { return "C1f2"; } qbs-src-3.2.0/tests/auto/language/testdata/import-collection/imports/Collection/file1.js0000644000175100017510000000004115154533055030774 0ustar runnerrunnerfunction f1() { return "C1f1"; } qbs-src-3.2.0/tests/auto/language/testdata/import-collection/project.qbs0000644000175100017510000000005515154533055026030 0ustar runnerrunnerProject { references: ["product.qbs"] } qbs-src-3.2.0/tests/auto/language/testdata/import-collection/product.qbs0000644000175100017510000000030215154533055026035 0ustar runnerrunnerimport Collection as Collection1 import "collection" as Collection2 Product { name: "da product" targetName: Collection1.f1() + Collection1.f2() + Collection2.f1() + Collection2.f2() } qbs-src-3.2.0/tests/auto/language/testdata/homeDirectory.qbs0000644000175100017510000000066115154533055023537 0ustar runnerrunnerProject { Product { name: "home" // These should resolve property path home: "~" property path homeSlash: "~/" property path homeUp: "~/.." property path homeFile: "~/a" // These are sanity checks and should not property path bogus1: "a~b" property path bogus2: "a/~/bb" property path user: "~foo/bar" // we don't resolve other-user paths } } qbs-src-3.2.0/tests/auto/language/testdata/MyProperties.qbs0000644000175100017510000000001715154533055023357 0ustar runnerrunnerProperties { } qbs-src-3.2.0/tests/auto/language/testdata/keep-loading-dependencies.qbs0000644000175100017510000000011115154533055025673 0ustar runnerrunnerProduct { Depends { name: "none"; submodules: ["m1", "m2", "m3"] } } qbs-src-3.2.0/tests/auto/language/testdata/productconditions.qbs0000644000175100017510000000143015154533055024467 0ustar runnerrunnerimport qbs.Probes Project { Product { name: "product_no_condition" } Product { name: "product_true_condition" condition: 1 === 1 } Product { name: "product_false_condition" condition: 1 === 2 } Product { name: "product_condition_dependent_of_module" condition: qbs.architecture !== (qbs.architecture + "foo") } Product { name: "product_probe_condition_true" condition: trueProbe.found Probe { id: trueProbe configure: { found = true; } } } Product { name: "product_probe_condition_false" condition: falseProbe.found Probe { id: falseProbe configure: { found = false; } } } } qbs-src-3.2.0/tests/auto/language/testdata/canonicalArchitecture.qbs0000644000175100017510000000012415154533055025206 0ustar runnerrunnerimport qbs.Utilities Product { name: Utilities.canonicalArchitecture("i386") } qbs-src-3.2.0/tests/auto/language/testdata/rfc1034identifier.qbs0000644000175100017510000000046415154533055024050 0ustar runnerrunnerimport qbs.Utilities CppApplication { name: Utilities.rfc1034Identifier("this!has@special#characters$uh-oh,Undersc0r3s_Are.Bad") Properties { condition: qbs.targetOS.includes("darwin") bundle.infoPlist: { return {"CFBundleIdentifier": "$(PRODUCT_NAME:rfc1034identifier)"}; } } } qbs-src-3.2.0/tests/auto/language/testdata/ParentWithExport.qbs0000644000175100017510000000017615154533055024212 0ustar runnerrunnerProduct { Export { Depends { name: "dummy" } dummy.defines: [exportingProduct.name.toUpperCase()] } } qbs-src-3.2.0/tests/auto/language/testdata/empty-js-file.qbs0000644000175100017510000000006015154533055023400 0ustar runnerrunnerimport "empty-js-file.js" as Empty Product { } qbs-src-3.2.0/tests/auto/language/testdata/environmentvariable.qbs0000644000175100017510000000012115154533055024763 0ustar runnerrunnerimport qbs.Environment Product { name: Environment.getEnv("PRODUCT_NAME") } qbs-src-3.2.0/tests/auto/language/testdata/dirwithnoprojects/0000755000175100017510000000000015154533055023771 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/dirwithnoprojects/.gitignore0000644000175100017510000000001615154533055025756 0ustar runnerrunner* !.gitignore qbs-src-3.2.0/tests/auto/language/testdata/modulescope.qbs0000644000175100017510000000040015154533055023230 0ustar runnerrunnerimport "modulescope_base.qbs" as MyProduct Project { MyProduct { name: "product1" property int e: 12 property int f: 13 scopemod.a: 2 scopemod.f: 2 scopemod.g: e * f scopemod.h: base + 2 } } qbs-src-3.2.0/tests/auto/language/testdata/broken-dependency-cycle1.qbs0000644000175100017510000000050115154533055025465 0ustar runnerrunnerProject { Product { name: "p1" Export { property bool c: true Depends { name: "p2"; condition: c } } } Product { name: "p2" Depends { name: "p1" } p1.c: false } Product { name: "p3" Depends { name: "p1" } } } qbs-src-3.2.0/tests/auto/language/testdata/aboutdialog.cpp0000644000175100017510000000000015154533055023174 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-parameters/0000755000175100017510000000000015154533055023636 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-parameters/module-parameters.qbs0000644000175100017510000000175015154533055027776 0ustar runnerrunnerProject { property bool overrideFromModule property bool overrideFromExport property bool overrideFromProduct Product { name: "dep" Export { Depends { name: "higher"; condition: project.overrideFromExport lower.param: "fromExportDepends" } Parameters { lower.param: "fromParameters" } } } Product { name: "main" Depends { name: "dep" condition: project.overrideFromProduct lower.param: "fromProductDepends" } Depends { name: "higher" condition: project.overrideFromProduct lower.param: "fromProductDepends" } Depends { name: "dep"; condition: !project.overrideFromProduct } Depends { name: "higher"; condition: !project.overrideFromProduct } Depends { name: "highest" } Depends { name: "broken"; required: false } } } qbs-src-3.2.0/tests/auto/language/testdata/module-parameters/modules/0000755000175100017510000000000015154533055025306 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-parameters/modules/higher/0000755000175100017510000000000015154533055026554 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-parameters/modules/higher/higher.qbs0000644000175100017510000000013215154533055030525 0ustar runnerrunnerModule { Depends { name: "lower" } Parameters { lower.param: "fromParameters" } } qbs-src-3.2.0/tests/auto/language/testdata/module-parameters/modules/highest/0000755000175100017510000000000015154533055026741 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-parameters/modules/highest/highest.qbs0000644000175100017510000000021515154533055031101 0ustar runnerrunnerModule { Depends { name: "higher" condition: project.overrideFromModule lower.param: "fromModuleDepends" } } qbs-src-3.2.0/tests/auto/language/testdata/module-parameters/modules/broken/0000755000175100017510000000000015154533055026566 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-parameters/modules/broken/broken.qbs0000644000175100017510000000022515154533055030554 0ustar runnerrunnerModule { Depends { name: "higher"; lower.param: "shouldNeverAppear" } validate: { throw "As the name indicates, this module is broken."; } } qbs-src-3.2.0/tests/auto/language/testdata/module-parameters/modules/lower/0000755000175100017510000000000015154533055026436 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-parameters/modules/lower/lower.qbs0000644000175100017510000000007515154533055030277 0ustar runnerrunnerModule { Parameter { property string param: "origin" } } qbs-src-3.2.0/tests/auto/language/testdata/dependencyOnAllProfiles.qbs0000644000175100017510000000041015154533055025462 0ustar runnerrunnerProject { property string profile1 property string profile2 Product { name: "dep" qbs.profiles: [project.profile1, project.profile2] } Product { name: "main" Depends { name: "dep" } } } qbs-src-3.2.0/tests/auto/language/testdata/filetags.qbs0000644000175100017510000000307315154533055022520 0ustar runnerrunnerProject { FileTagger { patterns: "*.cpp" fileTags: ["cpp"] } Product { name: "filetagger_project_scope" files: ["main.cpp"] } Product { name: "filetagger_product_scope" files: ["drawline.asm"] FileTagger { patterns: "*.asm" fileTags: ["asm"] } } Product { name: "filetagger_static_pattern" files: "Banana" FileTagger { patterns: "Banana" fileTags: ["yellow"] } } Product { name: "unknown_file_tag" files: "narf.zort" } Product { name: "set_file_tag_via_group" Group { files: ["main.cpp"] fileTags: ["c++"] } } Product { name: "override_file_tag_via_group" Group { files: "main.cpp" // gets file tag "cpp" through the FileTagger fileTags: ["c++"] } } Product { name: "add_file_tag_via_group" Group { overrideTags: false files: "main.cpp" fileTags: ["zzz"] } } Product { name: "prioritized_filetagger" files: ["main.cpp"] FileTagger { patterns: ["*.cpp"] fileTags: ["cpp1"] priority: 3 } FileTagger { patterns: ["*.cpp"] fileTags: ["cpp2"] priority: 3 } FileTagger { patterns: ["*.cpp"] fileTags: ["ignored"] priority: 2 } } } qbs-src-3.2.0/tests/auto/language/testdata/propertiesblocks.qbs0000644000175100017510000001312415154533055024312 0ustar runnerrunnerimport "propertiesblocks_base.qbs" as ProductBase Project { Product { name: "property_append" Depends { name: "dummy" } dummy.defines: ["SOMETHING"] Properties { dummy.defines: ["APPENDED"] } } Product { name: "property_set_indirect" Depends { name: "dummyqt.core" } Properties { dummyqt.core.zort: "VAL" } } Product { name: "property_overwrite" Depends { name: "dummy" } Properties { dummy.defines: ["OVERWRITTEN"] } } Product { name: "property_append_indirect" Depends { name: "dummy" } property stringList myDefines: ["ONE"] dummy.defines: myDefines Properties { dummy.defines: ["TWO"] } } ProductBase { name: "property_append_to_indirect_derived" Properties { dummy.cFlags: outer.concat("PROPS") } } ProductBase { name: "property_append_to_indirect_derived2" Properties { dummy.cFlags: "PROPS" } dummy.cFlags: ["PRODUCT"] } ProductBase { name: "property_append_to_indirect_derived3" Properties { dummy.cFlags: "PROPS" } dummy.cFlags: base.concat("PRODUCT") } Product { name: "property_append_to_indirect_merged" Depends { name: "dummy" } property string justOne: "ONE" dummy.rpaths: [justOne] Properties { dummy.rpaths: ["TWO"] } } Product { name: "multiple_exclusive_properties" Depends { name: "dummy" } Properties { dummy.defines: ["OVERWRITTEN"] } Properties { condition: false dummy.defines: ["IMPOSSIBLE"] } Properties { condition: undefined dummy.defines: ["SOMETHING"] } } Product { name: "multiple_exclusive_properties_no_match" Depends { name: "dummy" } Properties { condition: undefined dummy.defines: ["OVERWRITTEN"] } Properties { condition: false dummy.defines: ["IMPOSSIBLE"] } } Product { name: "multiple_exclusive_properties_append" Depends { name: "dummy" } dummy.defines: ["ONE"] Properties { dummy.defines: ["TWO"] } Properties { condition: false dummy.defines: ["IMPOSSIBLE"] } } Product { name: "ambiguous_properties" Depends { name: "dummy" } dummy.defines: ["ONE"] Properties { dummy.defines: ["TWO"] } Properties { condition: false dummy.defines: outer.concat(["IMPOSSIBLE"]) } Properties { dummy.defines: ["THREE"] } } Product { name: "condition_refers_to_product_property" property bool narf: true property string someString: "SOMETHING" Depends { name: "dummy" } Properties { condition: narf dummy.defines: ["OVERWRITTEN"] someString: "OVERWRITTEN" } } property bool zort: true Product { name: "condition_refers_to_project_property" property string someString: "SOMETHING" Depends { name: "dummy" } Properties { condition: project.zort dummy.defines: ["OVERWRITTEN"] someString: "OVERWRITTEN" } } ProductBase { name: "inheritance_overwrite_in_subitem" dummy.defines: ["OVERWRITTEN_IN_SUBITEM"] } ProductBase { name: "inheritance_retain_base1" dummy.defines: base.concat("SUB") } ProductBase { name: "inheritance_retain_base2" Properties { condition: true dummy.defines: base.concat("SUB") } Properties { condition: undefined dummy.defines: ["GNAMPF"] } } ProductBase { name: "inheritance_retain_base3" Properties { condition: true dummy.defines: base.concat("SUB") } // no dummy.defines binding } ProductBase { name: "inheritance_retain_base4" Properties { condition: false dummy.defines: ["NEVERMORE"] } // no "else case" for dummy.defines. The value is derived from ProductBase. } ProductBase { name: "inheritance_condition_in_subitem1" defineBase: false dummy.defines: base.concat("SUB") } ProductBase { name: "inheritance_condition_in_subitem2" defineBase: false // no dummy.defines binding } Product { id: knolf name: "gnampf" } Product { name: "condition_references_id" Depends { name: "dummy" } Properties { condition: knolf.name === "gnampf" dummy.defines: ["OVERWRITTEN"] } } Product { name: "using_derived_Properties_item" Depends { name: "dummy" } MyProperties { condition: true dummy.defines: ["string from MyProperties"] } } Product { name: "conditional-depends" Depends { name: "dummy" condition: false } Properties { condition: false dummy.defines: ["a string"] } } Product { name: "use-module-with-properties-item" Depends { name: "module-with-properties-item" } } } qbs-src-3.2.0/tests/auto/language/testdata/non-applicable-module-property-in-profile.qbs0000644000175100017510000000067215154533055031017 0ustar runnerrunnerProject { property string targetOS property string toolchain Product { name: "p" multiplexByQbsProperties: ["profiles"] qbs.profiles: ["theProfile"] Depends { name: "multiple_backends" } Profile { name: "theProfile" qbs.targetOS: [project.targetOS] qbs.toolchain: [project.toolchain] multiple_backends.backend3Prop: "value" } } } qbs-src-3.2.0/tests/auto/language/testdata/duplicate-multiplex-value2.qbs0000644000175100017510000000024715154533055026111 0ustar runnerrunnerProduct { name: "p" multiplexByQbsProperties: ["architectures", "buildVariants", "architectures"] aggregate: false qbs.architectures: ["x86", "arm"] } qbs-src-3.2.0/tests/auto/language/testdata/suppressed-and-non-suppressed-errors.qbs0000644000175100017510000000033415154533055030151 0ustar runnerrunnerProject { Product { name: "mysterious creature" files: ["easter bunny"] } Product { name: "tasty food" condition: false Depends { name: "TheBeautifulSausage" } } } qbs-src-3.2.0/tests/auto/language/testdata/invalid-prop-on-non-required-module/0000755000175100017510000000000015154533055027117 5ustar runnerrunner././@LongLink0000644000000000000000000000016700000000000011607 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/invalid-prop-on-non-required-module/invalid-prop-on-non-required-module.qbsqbs-src-3.2.0/tests/auto/language/testdata/invalid-prop-on-non-required-module/invalid-prop-on-non-r0000644000175100017510000000066615154533055033117 0ustar runnerrunnerProject { property bool useExistingModule Product { name: "a" condition: project.useExistingModule Depends { name: "deploader" } Depends { name: "dep" } dep.nosuchprop: true } Product { name: "b" condition: !project.useExistingModule Depends { name: "deploader" } Depends { name: "random"; required: false } random.nosuchprop: true } } qbs-src-3.2.0/tests/auto/language/testdata/invalid-prop-on-non-required-module/modules/0000755000175100017510000000000015154533055030567 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/invalid-prop-on-non-required-module/modules/dep/0000755000175100017510000000000015154533055031337 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/invalid-prop-on-non-required-module/modules/dep/dep.qbs0000644000175100017510000000001215154533055032607 0ustar runnerrunnerModule {} qbs-src-3.2.0/tests/auto/language/testdata/invalid-prop-on-non-required-module/modules/deploader/0000755000175100017510000000000015154533055032526 5ustar runnerrunner././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/invalid-prop-on-non-required-module/modules/deploader/deploader.qbsqbs-src-3.2.0/tests/auto/language/testdata/invalid-prop-on-non-required-module/modules/deploader/dep0000644000175100017510000000050115154533055033215 0ustar runnerrunnerModule { // This indirection exists to properly model QBS-1776. // "deploader" corresponds to "bundle", and "dep" corresponds to "codesign" Depends { condition: project.useExistingModule; name: "dep"; required: false } Depends { condition: !project.useExistingModule; name: "random"; required: false } } qbs-src-3.2.0/tests/auto/language/testdata/Banana0000644000175100017510000000003215154533055021306 0ustar runnerrunnerPeanut butter jelly time! qbs-src-3.2.0/tests/auto/language/testdata/delayed-error/0000755000175100017510000000000015154533055022746 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/delayed-error/validation.qbs0000644000175100017510000000025015154533055025604 0ustar runnerrunnerProject { property bool enableProduct: true Product { name: "theProduct" condition: project.enableProduct Depends { name: "m" } } } qbs-src-3.2.0/tests/auto/language/testdata/delayed-error/nonexisting.qbs0000644000175100017510000000026315154533055026023 0ustar runnerrunnerProject { property bool enableProduct: true Product { name: "theProduct" condition: project.enableProduct Depends { name: "nosuchmodule" } } } qbs-src-3.2.0/tests/auto/language/testdata/delayed-error/modules/0000755000175100017510000000000015154533055024416 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/delayed-error/modules/m/0000755000175100017510000000000015154533055024652 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/delayed-error/modules/m/m.qbs0000644000175100017510000000007015154533055025612 0ustar runnerrunnerModule { validate: { throw "Validation error!"; } } qbs-src-3.2.0/tests/auto/language/testdata/subdir/0000755000175100017510000000000015154533055021500 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/subdir/exports-mylib.qbs0000644000175100017510000000074715154533055025035 0ustar runnerrunnerStaticLibrary { name: "mylib" Depends { name: "dummy" } dummy.defines: ["BUILD_" + product.name.toUpperCase()] property string definePrefix: "USE_" property path aPath: "." dummy.somePath: aPath Export { Depends { name: "dummy" } Depends { name: "mylib2" } dummy.defines: [exportingProduct.definePrefix + exportingProduct.name.toUpperCase()] dummy.includePaths: ["./lib"] dummy.somePath: exportingProduct.aPath } } qbs-src-3.2.0/tests/auto/language/testdata/subdir/pathproperties_base.qbs0000644000175100017510000000016615154533055026255 0ustar runnerrunnerProduct { property path base_fileInProductDir: "foo" property path base_fileInBaseProductDir: path + "/bar" } qbs-src-3.2.0/tests/auto/language/testdata/idusagebase.qbs0000644000175100017510000000063315154533055023175 0ustar runnerrunnerimport "idusagebasebase.qbs" as DeriveMeCrazy import "idusage_group.qbs" as MyGroup import "idusage_group2.qbs" as MyGroup2 DeriveMeCrazy { id: baseProduct property int nr: theProject.initialNr + 1 name: "product1_" + nr property string productName: baseProduct.name MyGroup { name: "group in base product" } MyGroup2 { name: "another group in base product" } } qbs-src-3.2.0/tests/auto/language/testdata/project-property-forwarding.qbs0000644000175100017510000000032315154533055026405 0ustar runnerrunnerProject { property string prop: "parent" Project { property string prop: parent.prop + "2" Project { property bool dummy: { console.info("prop: " + prop); } } } } qbs-src-3.2.0/tests/auto/language/testdata/conditionaldepends.qbs0000644000175100017510000000421615154533055024570 0ustar runnerrunnerimport "conditionaldepends_base.qbs" as CondBase Project { CondBase { name: 'conditionaldepends_derived' someProp: true } CondBase { name: 'conditionaldepends_derived_false' someProp: "knolf" === "narf" } Product { name: "product_props_true" property bool someTrueProp: true Depends { condition: someTrueProp; name: "dummy" } } Product { name: "product_props_false" property bool someFalseProp: false Depends { condition: someFalseProp; name: "dummy" } } property bool someTruePrjProp: true Product { name: "project_props_true" Depends { condition: project.someTruePrjProp; name: "dummy" } } property bool someFalsePrjProp: false Product { name: "project_props_false" Depends { condition: project.someFalsePrjProp; name: "dummy" } } Product { name: "module_props_true" Depends { name: "dummy2" } Depends { condition: dummy2.someTrueProp; name: "dummy" } } Product { name: "module_props_false" Depends { name: "dummy2" } Depends { condition: dummy2.someFalseProp; name: "dummy" } } Product { name: "multilevel_module_props_true" Depends { name: "dummy3" } dummy3.loadDummy: true } Product { name: "multilevel_module_props_false" Depends { name: "dummy3" } } Product { name: "multilevel_module_props_overridden" Depends { name: "dummy3" } } Product { name: "multilevel2_module_props_true" Depends { name: "dummy3_loader" } } Product { name: "contradictory_conditions1" Depends { condition: false; name: "dummy" } Depends { condition: true; name: "dummy" } // this one wins } Product { name: "contradictory_conditions2" Depends { condition: true; name: "dummy" } // this one wins Depends { condition: false; name: "dummy" } } Product { name: "unknown_dependency_condition_false" Depends { condition: false; name: "doesonlyexistifhellfreezesover" } } } qbs-src-3.2.0/tests/auto/language/testdata/dotted-names/0000755000175100017510000000000015154533055022574 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/dotted-names/dotted-names.qbs0000644000175100017510000000077415154533055025677 0ustar runnerrunnerProject { name: "theProject" property bool includeDottedProduct property bool includeDottedModule Project { condition: project.includeDottedProduct Product { name: "a.b" Export { property string c: "default" } } } Product { name: "p" Depends { name: "a.b"; condition: project.includeDottedProduct } Depends { name: "x.y"; condition: project.includeDottedModule } a.b.c: "p" x.y.z: "p" } } qbs-src-3.2.0/tests/auto/language/testdata/dotted-names/modules/0000755000175100017510000000000015154533055024244 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/dotted-names/modules/x/0000755000175100017510000000000015154533055024513 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/dotted-names/modules/x/y/0000755000175100017510000000000015154533055024763 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/dotted-names/modules/x/y/xy.qbs0000644000175100017510000000005415154533055026131 0ustar runnerrunnerModule { property string z: "default" } qbs-src-3.2.0/tests/auto/language/testdata/eval-error-in-non-present-module.qbs0000644000175100017510000000016415154533055027133 0ustar runnerrunnerProduct { name: "p" property bool moduleRequired Depends { name: "broken"; required: moduleRequired } } qbs-src-3.2.0/tests/auto/language/testdata/duplicate-multiplex-value.qbs0000644000175100017510000000021215154533055026017 0ustar runnerrunnerProduct { name: "p" multiplexByQbsProperties: "architectures" aggregate: false qbs.architectures: ["x86", "arm", "x86"] } qbs-src-3.2.0/tests/auto/language/testdata/moduleproperties.qbs0000644000175100017510000000370515154533055024326 0ustar runnerrunnerProject { name: "MyProject" property string projectName: name Product { name: "merge_lists" Depends { name: "dummyqt"; submodules: ["gui", "network"] } Depends { name: "dummy" } dummy.defines: ["THE_PRODUCT"] } Product { name: "merge_lists_and_values" Depends { name: "dummyqt"; submodules: ["network", "gui"] } Depends { name: "dummy" } dummy.defines: "THE_PRODUCT" } Product { name: "merge_lists_with_duplicates" Depends { name: "dummy" } dummy.cxxFlags: ["-foo", "BAR", "-foo", "BAZ"] } Product { name: "merge_lists_with_prototype_values" Depends { name: "dummyqt"; submodules: ["gui", "network"] } Depends { name: "dummy" } } Product { name: "list_property_that_references_product" type: ["blubb"] Depends { name: "dummy" } dummy.listProp: ["x"] } Product { name: "list_property_depending_on_overridden_property" Depends { name: "dummy" } dummy.listProp2: ["PRODUCT_STUFF"] dummy.controllingProp: true } Product { name: "overridden_list_property" Depends { name: "dummy" } Properties { overrideListProperties: true dummy.listProp: ["PRODUCT_STUFF"] } } Product { name: "shadowed-list-property" property string productName: name Depends { name: "dummy" } dummy.defines: [projectName, productName] } Product { name: "shadowed-scalar-property" property string productName: name Depends { name: "dummy" } dummy.someString: projectName + "_" + productName } Product { name: "merged-varlist" property string productName: name Depends { name: "dummy" } Depends { name: "dummyqt.core" } dummy.controllingProp: true dummy.varListProp: ({d: "product"}) } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/0000755000175100017510000000000015154533055022231 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/erroneous/throw_in_property_binding.qbs0000644000175100017510000000010215154533055030220 0ustar runnerrunnerProduct { name: { throw "something is wrong"; } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/unknown_item_type.qbs0000644000175100017510000000014315154533055026514 0ustar runnerrunnerNarf { zort: 1 // This invalid binding should not hide the "Unexpected item type" error. } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/multiple_exports.qbs0000644000175100017510000000005015154533055026352 0ustar runnerrunnerProduct { Export {} Export {} } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/dependency_cycle3a.qbs0000644000175100017510000000026215154533055026461 0ustar runnerrunnerProject { Product { name: "B" Depends { productTypes: ["a"] } } Product { type: ["a"] name: "A" Depends { name: "B" } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/undefined_stringlist_element_in_probe.qbs0000644000175100017510000000022315154533055032546 0ustar runnerrunnerProduct { Probe { id: dummy property stringList l configure: { l = ["a", undefined, "b"] } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/overwrite-inherited-readonly-property.qbs0000644000175100017510000000007715154533055032440 0ustar runnerrunnerParentItem { readOnlyString: "changing the unchangeable" } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/main.cpp0000644000175100017510000000356015154533055023665 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ int main() { } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/dependency_cycle3.qbs0000644000175100017510000000026215154533055026320 0ustar runnerrunnerProject { Product { type: ["a"] name: "A" Depends { name: "B" } } Product { name: "B" Depends { productTypes: ["a"] } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/undeclared_property_in_export_item.qbs0000644000175100017510000000030015154533055032110 0ustar runnerrunnerProject { Product { name: "p1" Export { Depends { name: "cpp" } cpp.blubb: "x" } } Product { Depends { name: "p1" } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/subproject_cycle3.qbs0000644000175100017510000000011515154533055026357 0ustar runnerrunnerProject { SubProject { filePath: "subproject_cycle.qbs" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/multiple_properties_in_subproject.qbs0000644000175100017510000000016015154533055031772 0ustar runnerrunnerProject { SubProject { Properties { condition: false } Properties { name: "blubb" } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/overwrite-readonly-module-property.qbs0000644000175100017510000000014615154533055031747 0ustar runnerrunnerProduct { Depends { name: "readonly" } readonly.readOnlyString: "changing the unchangeable" } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/duplicate_sources_wildcards.qbs0000644000175100017510000000014615154533055030512 0ustar runnerrunnerProduct { files: ["*.qbs"] Group { files: ["duplicate_sources_wildcards.qbs"] } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/missing-colon.qbs0000644000175100017510000000013215154533055025515 0ustar runnerrunnerProduct { Depends { name: "dummy" } qbsSearchPaths: ".." dummy.cxxFlags { } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/nonexistentouter.qbs0000644000175100017510000000006415154533055026375 0ustar runnerrunnerProject { Product { name: outer } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/unknown_module.qbs0000644000175100017510000000007415154533055026005 0ustar runnerrunnerProduct { Depends { name: "neitherModuleNorProduct" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/recursive-property-direct.qbs0000644000175100017510000000004315154533055030076 0ustar runnerrunnerProduct { property bool a: a } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/undeclared_property_in_export_item2.qbs0000644000175100017510000000024215154533055032177 0ustar runnerrunnerProject { Product { name: "p1" Export { something.other: "x" } } Product { Depends { name: "p1" } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/properties-item-with-invalid-condition.qbs0000644000175100017510000000023415154533055032450 0ustar runnerrunnerProduct { Depends { name: "cpp" } Properties { condition: cpp.nonexistingproperty.includes("somevalue") cpp.defines: ["ABC"] } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/module-var-in-product.qbs0000644000175100017510000000011115154533055027066 0ustar runnerrunnerProduct { property bool p Group { module.p: true } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/conflicting_fileTagsFilter.qbs0000644000175100017510000000026215154533055030223 0ustar runnerrunnerProduct { type: "app" Group { fileTagsFilter: "app" qbs.install: true } Group { fileTagsFilter: "app" qbs.install: false } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/dependency-profile-mismatch.qbs0000644000175100017510000000035015154533055030315 0ustar runnerrunnerProject { Profile { name: "profile1" } Product { name: "dep" qbs.profiles: ["profile1"] } Product { name: "main" Depends { name: "dep"; profiles: ["profile47"]; } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/undeclared_property_in_Properties_item.qbs0000644000175100017510000000007215154533055032731 0ustar runnerrunnerProduct { Properties { blubb.bla: "x" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/wrongQbsVersionFormat.qbs0000644000175100017510000000006215154533055027257 0ustar runnerrunnerProject { minimumQbsVersion: "hfyh1234wat?" } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/original-in-product-property.qbs0000644000175100017510000000005115154533055030504 0ustar runnerrunnerProduct { property int n: original } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/invalid-references.qbs0000644000175100017510000000006015154533055026501 0ustar runnerrunnerProject { references: "nosuchproject.qbs" } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/dependency_cycle2.qbs0000644000175100017510000000055615154533055026325 0ustar runnerrunnerProject { Product { name: "A" Depends { name: "B" } files: ["main.cpp"] } Product { name: "B" Depends { name: "C" } files: ["main.cpp"] } Product { name: "C" Depends { name: "A" } files: ["main.cpp"] } Product { name: "D" files: ["main.cpp"] } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/subproject_cycle2.qbs0000644000175100017510000000011615154533055026357 0ustar runnerrunnerProject { SubProject { filePath: "subproject_cycle3.qbs" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/dependency-profile-mismatch-2.qbs0000644000175100017510000000044115154533055030455 0ustar runnerrunnerProject { Profile { name: "profile1" } Profile { name: "profile2" } Product { name: "dep" qbs.profiles: ["profile1", "profile2"] } Product { name: "main" Depends { name: "dep"; profiles: ["profile47"]; } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/mismatching-multiplex-dependency.qbs0000644000175100017510000000046315154533055031403 0ustar runnerrunnerProject { Product { name: "a" multiplexByQbsProperties: ["architectures"] qbs.architectures: ["x86", "arm"] } Product { name: "b" Depends { name: "a" } multiplexByQbsProperties: ["architectures"] qbs.architectures: ["mips", "ppc"] } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/importloop2.qbs0000644000175100017510000000004515154533055025225 0ustar runnerrunnerimport "importloop1.qbs" as X X {} qbs-src-3.2.0/tests/auto/language/testdata/erroneous/undeclared_property.qbs0000644000175100017510000000004215154533055027006 0ustar runnerrunnerProduct { doesntexist: 123 } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/invalid-parameter-rhs.qbs0000644000175100017510000000017415154533055027140 0ustar runnerrunnerProduct { Depends { name: "prefix2.suffix" } Depends { name: "readonly"; prefix2.suffix.nope: access.will.fail } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/missing-js-file.qbs0000644000175100017510000000007315154533055025740 0ustar runnerrunnerProduct { Depends { name: "missing-js-file-module" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/original-in-export-item3.qbs0000644000175100017510000000033015154533055027502 0ustar runnerrunnerProject { Product { name: "a" Export { Properties { x.y.z: original } } } Product { name: "b" Depends { name: "a" } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/invalid_stringlist_element.qbs0000644000175100017510000000005715154533055030363 0ustar runnerrunnerProduct { files: ["foo", ["zoo"], "bar"] } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/syntax-error-in-probe.qbs0000644000175100017510000000012515154533055027124 0ustar runnerrunnerProduct { Probe { id: hurz configure: { fngkgsdjfgklkf } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/invalid_file.qbs0000644000175100017510000000005715154533055025367 0ustar runnerrunnerProduct { files: ["main.cpp", "other.h"] } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/conflicting-module-instances.qbs0000644000175100017510000000007215154533055030506 0ustar runnerrunnerProduct { Depends { name: "conflicting-instances" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/conflicting-properties-in-export-items.qbs0000644000175100017510000000011015154533055032463 0ustar runnerrunnerParentWithExport { Export { property string theProp } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/original-in-export-item.qbs0000644000175100017510000000027115154533055027423 0ustar runnerrunnerProject { Product { name: "a" Export { property string p: original } } Product { name: "b" Depends { name: "a" } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/wrong-toplevel-item.qbs0000644000175100017510000000001515154533055026654 0ustar runnerrunnerArtifact { } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/module-property-binding-in-project.qbs0000644000175100017510000000004115154533055031562 0ustar runnerrunnerProject { qbs.sysroot: "/" } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/original-in-export-item2.qbs0000644000175100017510000000025515154533055027507 0ustar runnerrunnerProject { Product { name: "a" Export { x.y.z: original } } Product { name: "b" Depends { name: "a" } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/invalid_property_type.qbs0000644000175100017510000000005315154533055027371 0ustar runnerrunnerProduct { property nonsense esnesnon } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/ParentWithExport.qbs0000644000175100017510000000007515154533055026231 0ustar runnerrunnerProduct { Export { property bool theProp } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/references_cycle2.qbs0000644000175100017510000000006715154533055026325 0ustar runnerrunnerProject { references: ["references_cycle3.qbs"] } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/frozen-object.qbs0000644000175100017510000000047315154533055025513 0ustar runnerrunner Product { Probe { id: probe property var output configure: { output = {"key": "value"} found = true } } property var test: { "use strict" var result = probe.output; result.key = "newValue"; return result; } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/ParentItem.qbs0000644000175100017510000000014615154533055025011 0ustar runnerrunnerProduct { property bool cpp readonly property string readOnlyString: "I cannot be changed!" } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/undeclared_property_wrapper.qbs0000644000175100017510000000011715154533055030551 0ustar runnerrunnerProject { SubProject { filePath: "undeclared_property.qbs" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/no-configure-in-probe.qbs0000644000175100017510000000005715154533055027046 0ustar runnerrunnerProduct { Probe { id: hurz } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/misused-inherited-property.qbs0000644000175100017510000000005515154533055030244 0ustar runnerrunnerParentItem { cpp.compilerName: "blubb" } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/invalid_child_item_type.qbs0000644000175100017510000000005115154533055027604 0ustar runnerrunnerProject { Depends { name: "foo" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/module-with-id.qbs0000644000175100017510000000010115154533055025560 0ustar runnerrunnerProduct { name: "p" Depends { name: "module-with-id" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/invalid-parameter-type.qbs0000644000175100017510000000034215154533055027322 0ustar runnerrunnerProduct { Depends { name: "module_with_parameters" } Depends { name: "readonly" module_with_parameters.boolParameter: "This is not an error." module_with_parameters.stringParameter: 123 } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/oldQbsVersion.qbs0000644000175100017510000000013715154533055025533 0ustar runnerrunnerProject { minimumQbsVersion: "999.5.4" Product { qbs.enableSound: true } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/recursive-property-indirect.qbs0000644000175100017510000000012115154533055030422 0ustar runnerrunnerProduct { property bool a: b property bool b: c property bool c: a } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/undeclared_property_in_export_item3.qbs0000644000175100017510000000017215154533055032202 0ustar runnerrunnerProject { Product { name: "p1" Export { blubb: false } } Product { Depends { name: "p1" } } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/subproject_cycle.qbs0000644000175100017510000000011615154533055026275 0ustar runnerrunnerProject { SubProject { filePath: "subproject_cycle2.qbs" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/importloop1.qbs0000644000175100017510000000004515154533055025224 0ustar runnerrunnerimport "importloop2.qbs" as X X {} qbs-src-3.2.0/tests/auto/language/testdata/erroneous/dependency_cycle.qbs0000644000175100017510000000045415154533055026240 0ustar runnerrunnerProject { Product { name: "A" Depends { name: "B" } files: ["main.cpp"] } Product { name: "B" Depends { name: "C" } files: ["main.cpp"] } Product { name: "C" Depends { name: "A" } files: ["main.cpp"] } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/undeclared-parameter2.qbs0000644000175100017510000000012415154533055027103 0ustar runnerrunnerProduct { name: "myproduct" Depends { name: "readonly"; foo.bar: "bla" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/reserved_name_in_import.qbs0000644000175100017510000000006515154533055027640 0ustar runnerrunnerimport "../idusagebase.qbs" as TextFile Product { } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/duplicate_sources.qbs0000644000175100017510000000012215154533055026450 0ustar runnerrunnerProduct { files: ["main.cpp"] Group { files: ["main.cpp"] } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/recursive-property-indirect-via-module.qbs0000644000175100017510000000013515154533055032467 0ustar runnerrunnerProduct { Depends { name: "recursion_helper" } property bool a: recursion_helper.a } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/references_cycle.qbs0000644000175100017510000000006715154533055026243 0ustar runnerrunnerProject { references: ["references_cycle2.qbs"] } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/undefined_stringlist_element.qbs0000644000175100017510000000010715154533055030672 0ustar runnerrunnerProduct { property string blubb files: ["foo", blubb, "bar"] } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/undeclared-parameter1.qbs0000644000175100017510000000016215154533055027104 0ustar runnerrunnerProduct { Depends { name: "prefix2.suffix" } Depends { name: "readonly"; prefix2.suffix.nope: "nope" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/undeclared_module_property_in_module.qbs0000644000175100017510000000010315154533055032404 0ustar runnerrunnerProduct { name: "p" Depends { name: "no_such_property" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/undeclared_item.qbs0000644000175100017510000000005515154533055026064 0ustar runnerrunnerProduct { cpp.defines: ["SUPERCRAZY"] } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/frozen-object-list.qbs0000644000175100017510000000044615154533055026464 0ustar runnerrunner Product { Probe { id: probe property varList output configure: { output = [{"key": "value"}]; found = true; } } property var test: { var result = probe.output; result.push({}); return result; } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/references_cycle3.qbs0000644000175100017510000000006615154533055026325 0ustar runnerrunnerProject { references: ["references_cycle.qbs"] } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/original-in-module-prototype.qbs0000644000175100017510000000010115154533055030466 0ustar runnerrunnerProduct { Depends { name: "module-with-invalid-original" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/dependency_cycle4.qbs0000644000175100017510000000005515154533055026321 0ustar runnerrunnerProduct { Depends { name: "module-a" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/ambiguous-multiplex-dependency.qbs0000644000175100017510000000056315154533055031074 0ustar runnerrunnerProject { Product { name: "a" multiplexByQbsProperties: ["architectures", "buildVariants"] qbs.architectures: ["x86", "arm"] qbs.buildVariants: ["debug", "release"] } Product { name: "b" Depends { name: "a" } multiplexByQbsProperties: ["architectures"] qbs.architectures: ["x86", "arm"] } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/invalid-property-option.qbs0000644000175100017510000000010615154533055027553 0ustar runnerrunnerProduct { Depends { name: "module-with-wrong-property-option" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/0000755000175100017510000000000015154533055023701 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module-b/0000755000175100017510000000000015154533055025405 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module-b/module-b.qbs0000644000175100017510000000005415154533055027617 0ustar runnerrunnerModule { Depends { name: "module-a" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module-a/0000755000175100017510000000000015154533055025404 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module-a/module-a.qbs0000644000175100017510000000005415154533055027615 0ustar runnerrunnerModule { Depends { name: "module-b" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module-with-wrong-property-option/0000755000175100017510000000000015154533055032461 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module-with-wrong-property-option/m.qbs0000644000175100017510000000023015154533055033417 0ustar runnerrunnerModule { property string someProp PropertyOptions { name: "s0meProp" description: "Oops, spelt the property name wrong" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/no_such_property/0000755000175100017510000000000015154533055027303 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/no_such_property/no-such-property.qbs0000644000175100017510000000015215154533055033246 0ustar runnerrunnerModule { Depends { name: "module_with_parameters" } module_with_parameters.noSuchProperty: true } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/recursion_helper/0000755000175100017510000000000015154533055027251 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/recursion_helper/recursion_helper.qbs0000644000175100017510000000005215154533055033325 0ustar runnerrunnerModule { property bool a: product.a } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/missing-js-file-module/0000755000175100017510000000000015154533055030164 5ustar runnerrunner././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/missing-js-file-module/missing-js-file.jsqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/missing-js-file-module/missing-js-file.0000644000175100017510000000005415154533055033164 0ustar runnerrunnervar userfile = require("javascriptfile.js") ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/missing-js-file-module/missing-js-file-module.qbsqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/missing-js-file-module/missing-js-file-0000644000175100017510000000007115154533055033162 0ustar runnerrunnerimport "missing-js-file.js" as MissingJsFile Module { } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/readonly/0000755000175100017510000000000015154533055025516 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/readonly/readonly.qbs0000644000175100017510000000011715154533055030041 0ustar runnerrunnerModule { readonly property string readOnlyString: "I cannot be changed!" } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module_with_parameters/0000755000175100017510000000000015154533055030444 5ustar runnerrunner././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module_with_parameters/module_with_parameters.qbsqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module_with_parameters/module_with_para0000644000175100017510000000032115154533055033706 0ustar runnerrunnerModule { Parameter { property bool boolParameter } Parameter { property int intParameter } Parameter { property stringList stringListParameter } Parameter { property string stringParameter } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/prefix2/0000755000175100017510000000000015154533055025260 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/prefix2/prefix2.qbs0000644000175100017510000000006215154533055027344 0ustar runnerrunnerModule { Depends { name: "prefix2.suffix" } } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/prefix2/suffix/0000755000175100017510000000000015154533055026564 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/prefix2/suffix/suffix.qbs0000644000175100017510000000001315154533055030571 0ustar runnerrunnerModule { } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module-with-invalid-original/0000755000175100017510000000000015154533055031365 5ustar runnerrunner././@LongLink0000644000000000000000000000017300000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module-with-invalid-original/module-with-invalid-original.qbsqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module-with-invalid-original/module-wit0000644000175100017510000000005315154533055033374 0ustar runnerrunnerModule { property string p: original } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module-with-id/0000755000175100017510000000000015154533055026531 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module-with-id/ModuleWithIdParent.qbs0000644000175100017510000000001215154533055032741 0ustar runnerrunnerModule {} qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/module-with-id/ModuleWithId.qbs0000644000175100017510000000003715154533055031576 0ustar runnerrunnerModuleWithIdParent { id: foo } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/conflicting-instances/0000755000175100017510000000000015154533055030165 5ustar runnerrunner././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/conflicting-instances/conflicting-instance2.qbsqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/conflicting-instances/conflicting-insta0000644000175100017510000000001315154533055033515 0ustar runnerrunnerModule { } ././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/conflicting-instances/conflicting-instance1.qbsqbs-src-3.2.0/tests/auto/language/testdata/erroneous/modules/conflicting-instances/conflicting-insta0000644000175100017510000000001315154533055033515 0ustar runnerrunnerModule { } qbs-src-3.2.0/tests/auto/language/testdata/erroneous/rule-without-output-tags.qbs0000644000175100017510000000034615154533055027705 0ustar runnerrunnerProduct { Rule { inputs: "input-tag" prepare: { var cmd = new JavaScriptCommand; cmd.silent = true; cmd.sourceCode = function() {}; return cmd; } } } qbs-src-3.2.0/tests/auto/language/testdata/groupname.qbs0000644000175100017510000000054115154533055022714 0ustar runnerrunnerProject { Product { name: "MyProduct" Group { name: product.name + ".MyGroup" files: "*" } } Product { name: "My2ndProduct" Group { name: product.name + ".MyGroup" files: ["narf"] } Group { files: ["zort"] } } } qbs-src-3.2.0/tests/auto/language/testdata/profilevaluesandoverriddenvalues.qbs0000644000175100017510000000142215154533055027563 0ustar runnerrunnerProject { Product { name: "product1" property bool dummyProp: { if (!(dummy.cFlags instanceof Array)) throw new Error("dummy.cFlags: Array type expected."); if (!(dummy.cxxFlags instanceof Array)) throw new Error("dummy.cxxFlags: Array type expected."); if (!(dummy.defines instanceof Array)) throw new Error("dummy.defines: Array type expected."); return true; } consoleApplication: true Depends { name: "dummy" } // dummy.cxxFlags is set via profile and is not overridden dummy.defines: ["IN_FILE"] // set in profile, overridden in file dummy.cFlags: ["IN_FILE"] // set in profile, overridden on command line } } qbs-src-3.2.0/tests/auto/language/testdata/enum-project-props.qbs0000644000175100017510000000041215154533055024465 0ustar runnerrunnerProject { property string anExistingFile: "dummy.txt" Product { files: { for (var k in project) { if (k === "anExistingFile") return [project[k]]; } return []; } } } qbs-src-3.2.0/tests/auto/language/testdata/pathproperties.qbs0000644000175100017510000000042315154533055023767 0ustar runnerrunnerimport "subdir/pathproperties_base.qbs" as ProductBase ProductBase { name: "product1" property path projectFileDir: "." property pathList filesInProjectFileDir: ["./aboutdialog.h", "aboutdialog.cpp"] Depends { name: "dummy" } dummy.includePaths: ["."] } qbs-src-3.2.0/tests/auto/language/testdata/derived-sub-project/0000755000175100017510000000000015154533055024065 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/derived-sub-project/project.qbs0000644000175100017510000000021215154533055026235 0ustar runnerrunnerProject { DerivedSubProject { filePath: "subproject.qbs" Properties { name: "something" } } } qbs-src-3.2.0/tests/auto/language/testdata/derived-sub-project/subproject.qbs0000644000175100017510000000001415154533055026747 0ustar runnerrunnerProduct { } qbs-src-3.2.0/tests/auto/language/testdata/derived-sub-project/DerivedSubProject.qbs0000644000175100017510000000001715154533055030155 0ustar runnerrunnerSubProject { } qbs-src-3.2.0/tests/auto/language/testdata/idusagebasebase.qbs0000644000175100017510000000017615154533055024032 0ustar runnerrunnerProduct { id: baseBaseProduct name: "ace of base" property string productNameInBaseOfBase: baseBaseProduct.name } qbs-src-3.2.0/tests/auto/language/testdata/multiplexing-by-profile/0000755000175100017510000000000015154533055024777 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/multiplexing-by-profile/p2.qbs0000644000175100017510000000055115154533055026030 0ustar runnerrunnerProject { Profile { name: "profile1" qbs.architecture: "dummy" } Profile { name: "profile2" qbs.architecture: "blubb" } Product { name: "p1" qbs.profiles: ["profile1"] } Product { name: "p2" qbs.profiles: ["profile1", "profile2"] Depends { name: "p1" } } } qbs-src-3.2.0/tests/auto/language/testdata/multiplexing-by-profile/p4.qbs0000644000175100017510000000060115154533055026026 0ustar runnerrunnerProject { Profile { name: "profile1" qbs.architecture: "dummy" } Profile { name: "profile2" qbs.architecture: "blubb" } Product { name: "p1" qbs.profiles: ["profile1"] Depends { name: "p2"; profiles: ["profile1"] } } Product { name: "p2" qbs.profiles: ["profile1", "profile2"] } } qbs-src-3.2.0/tests/auto/language/testdata/multiplexing-by-profile/p1.qbs0000644000175100017510000000042415154533055026026 0ustar runnerrunnerProject { Profile { name: "theProfile" qbs.architecture: "dummy" } Product { name: "p1" qbs.profiles: ["theProfile"] } Product { name: "p2" qbs.profiles: ["theProfile"] Depends { name: "p1" } } } qbs-src-3.2.0/tests/auto/language/testdata/multiplexing-by-profile/p3.qbs0000644000175100017510000000102115154533055026022 0ustar runnerrunnerProject { Profile { name: "profile1" qbs.architecture: "dummy" } Profile { name: "profile2" qbs.architecture: "blubb" } Profile { name: "profile3" qbs.architecture: "hurz" } Profile { name: "profile4" qbs.architecture: "zonk" } Product { name: "p1" qbs.profiles: ["profile1", "profile2"] Depends { name: "p2" } } Product { name: "p2" qbs.profiles: ["profile3", "profile4"] } } qbs-src-3.2.0/tests/auto/language/testdata/id-uniqueness.qbs0000644000175100017510000000040615154533055023510 0ustar runnerrunnerimport "idusagebase.qbs" as DerivedProduct Project { id: theProject DerivedProduct { id: baseProduct // OK - even though 'baseProduct' is used in the base item. } DerivedProduct { id: baseProduct // ERROR } } qbs-src-3.2.0/tests/auto/language/testdata/use-internal-profile.qbs0000644000175100017510000000030015154533055024754 0ustar runnerrunnerProject { name: "theproject" Profile { name: "theprofile" dummy.defines: name } Product { name: "theproduct" Depends { name: "dummy" } } }qbs-src-3.2.0/tests/auto/language/testdata/throwing-probe.qbs0000644000175100017510000000030215154533055023660 0ustar runnerrunnerProduct { name: "theProduct" property bool enableProbe Probe { id: whatever condition: enableProbe configure: { throw "Error!"; } } } qbs-src-3.2.0/tests/auto/language/testdata/dirwithmultipleprojects/0000755000175100017510000000000015154533055025210 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/dirwithmultipleprojects/project.qbs0000644000175100017510000000000015154533055027353 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/dirwithmultipleprojects/project2.qbs0000644000175100017510000000000015154533055027435 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/groupconditions.qbs0000644000175100017510000000214015154533055024142 0ustar runnerrunnerProject { property bool someTrueProperty: true Product { name: "no_condition_no_group" files: ["main.cpp"] } Product { name: "no_condition" Group { files: ["main.cpp"] } } Product { name: "true_condition" Group { condition: true files: ["main.cpp"] } } Product { name: "false_condition" Group { condition: false files: ["main.cpp"] } } Product { name: "true_condition_from_product" property bool anotherTrueProperty: true Group { condition: anotherTrueProperty files: ["main.cpp"] } } Product { name: "true_condition_from_project" Group { condition: project.someTrueProperty files: ["main.cpp"] } } Product { name: "condition_accessing_module_property" Group { condition: qbs.targetOS.includes("narf") files: ["main.cpp"] qbs.install: false } } } qbs-src-3.2.0/tests/auto/language/testdata/idusage_group2.qbs0000644000175100017510000000014015154533055023631 0ustar runnerrunnerimport "idusage_group.qbs" as MyGroup MyGroup { name: "between the hammer and the anvil" } qbs-src-3.2.0/tests/auto/language/testdata/qbs1275.qbs0000644000175100017510000000111115154533055022015 0ustar runnerrunnerProject { Product { name: "v-bug" Export { Depends { name: "cpp"} cpp.defines: "" } } Product { name: "e-bug" Export { Depends { name: "v-bug" } } } Product { name: "u-bug" Export { Depends { name: "c-bug" } } } Product { name: "c-bug" Export { Depends { name: "e-bug" } } } Product { name: "H-bug" Depends { name: "e-bug" } Depends { name: "u-bug" } Group { qbs.install: true } } } qbs-src-3.2.0/tests/auto/language/testdata/disabled-subproject.qbs0000644000175100017510000000076115154533055024650 0ustar runnerrunnerProject { SubProject { condition: false filePath: "nosuchfile.qbs" } SubProject { Properties { condition: false } filePath: "nosuchfile.qbs" } SubProject { condition: true Properties { condition: false } filePath: "nosuchfile.qbs" } SubProject { condition: false Properties { condition: true } filePath: "nosuchfile.qbs" } } qbs-src-3.2.0/tests/auto/language/testdata/correct-decl-in-parent-lookup.qbs0000644000175100017510000000013715154533055026470 0ustar runnerrunnerProduct { name: "p" Depends { name: "dummy" } dummy.cxxFlags: base.concat(["x"]) } qbs-src-3.2.0/tests/auto/language/testdata/override-product-prop-from-subproject-item.qbs0000644000175100017510000000017615154533055031251 0ustar runnerrunnerProject { SubProject { filePath: "product-with-property.qbs" Properties { theProp: "overridden" } } } qbs-src-3.2.0/tests/auto/language/testdata/inherited-properties-items/0000755000175100017510000000000015154533055025474 5ustar runnerrunner././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/inherited-properties-items/inherited-properties-items-product.qbsqbs-src-3.2.0/tests/auto/language/testdata/inherited-properties-items/inherited-properties-items-pro0000644000175100017510000000011415154533055033475 0ustar runnerrunnerProduct { name: "product_default" DebugName {} ReleaseName {} } qbs-src-3.2.0/tests/auto/language/testdata/inherited-properties-items/imports/0000755000175100017510000000000015154533055027171 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/inherited-properties-items/imports/DebugName.qbs0000644000175100017510000000012515154533055031525 0ustar runnerrunnerProperties { condition: qbs.buildVariant === "debug" name: "product_debug" } qbs-src-3.2.0/tests/auto/language/testdata/inherited-properties-items/imports/ReleaseName.qbs0000644000175100017510000000013115154533055032054 0ustar runnerrunnerProperties { condition: qbs.buildVariant === "release" name: "product_release" } qbs-src-3.2.0/tests/auto/language/testdata/inherited-properties-items/inherited-properties-items.qbs0000644000175100017510000000015115154533055033464 0ustar runnerrunnerProject { qbsSearchPaths: sourceDirectory references: "inherited-properties-items-product.qbs" } qbs-src-3.2.0/tests/auto/language/testdata/exports_product.qbs0000644000175100017510000000033615154533055024165 0ustar runnerrunnerProduct { Export { version: "2.0" Depends { name: "dummy" } dummy.cFlags: ["BASE_" + exportingProduct.name.toUpperCase()] dummy.cxxFlags: ["-foo"] dummy.defines: ["ABC"] } } qbs-src-3.2.0/tests/auto/language/testdata/invalidBindingInDisabledItem.qbs0000644000175100017510000000051515154533055026377 0ustar runnerrunnerProject { Product { name: "product1" condition: false someNonsense: "Bitte stellen Sie die Tassen auf den Tisch." } Product { name: "product2" Group { condition: false moreNonsense: "Follen. Follen. Hünuntergefollen. Auf dön Töppüch." } } } qbs-src-3.2.0/tests/auto/language/testdata/base-validate/0000755000175100017510000000000015154533055022711 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/base-validate/base-validate.qbs0000644000175100017510000000004615154533055026121 0ustar runnerrunnerProduct { Depends { name: "m" } } qbs-src-3.2.0/tests/auto/language/testdata/base-validate/modules/0000755000175100017510000000000015154533055024361 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/base-validate/modules/m/0000755000175100017510000000000015154533055024615 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/base-validate/modules/m/MParent.qbs0000644000175100017510000000006315154533055026671 0ustar runnerrunnerModule { condition: false validate: true } qbs-src-3.2.0/tests/auto/language/testdata/base-validate/modules/m/m.qbs0000644000175100017510000000030615154533055025557 0ustar runnerrunnerMParent { condition: true validate: { var parentResult = base; if (!parentResult) throw "Parent failed"; throw "Parent succeeded, child failed."; } } qbs-src-3.2.0/tests/auto/language/testdata/overridden-variant-property.qbs0000644000175100017510000000006415154533055026404 0ustar runnerrunnerProduct { name: "p" property var myObject } qbs-src-3.2.0/tests/auto/language/testdata/qbs-properties-in-project-condition.qbs0000644000175100017510000000016015154533055027727 0ustar runnerrunnerProject { condition: qbs.targetOS.includes("whatever") Product { name: "never reached" } } qbs-src-3.2.0/tests/auto/language/testdata/parameter-types.qbs0000644000175100017510000000073415154533055024045 0ustar runnerrunnerProject { Product { name: "foo" qbsSearchPaths: "./erroneous" Depends { name: "module_with_parameters" } Depends { name: "bar" module_with_parameters.boolParameter: true module_with_parameters.intParameter: 156 module_with_parameters.stringParameter: "hello" module_with_parameters.stringListParameter: ["la", "le", "lu"] } } Product { name: "bar" } } qbs-src-3.2.0/tests/auto/language/testdata/module-depends-on-product.qbs0000644000175100017510000000022515154533055025713 0ustar runnerrunnerProject { Product { name: "p1" Depends { name: "module-with-product-dependency" } } Product { name: "p2" } } qbs-src-3.2.0/tests/auto/language/testdata/properties-item-in-module.qbs0000644000175100017510000000020415154533055025732 0ustar runnerrunnerProject { Product { name: "a"; Depends { name: "dummyqt.core" } } Product { name: "b"; Depends { name: "dummyqt.core" } } } qbs-src-3.2.0/tests/auto/language/testdata/dummy.txt0000644000175100017510000000000015154533055022072 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/multiplexed-exports.qbs0000644000175100017510000000101215154533055024747 0ustar runnerrunnerProject { Product { name: "dep" multiplexByQbsProperties: ["buildVariants"] qbs.buildVariants: ["debug", "release"] property string includeDir: qbs.buildVariant === "debug" ? "/d" : "/r" Export { Depends { name: "cpp" } cpp.includePaths: exportingProduct.includeDir } } Product { name: "p" Depends { name: "dep" } multiplexByQbsProperties: ["buildVariants"] qbs.buildVariants: ["debug", "release"] } } qbs-src-3.2.0/tests/auto/language/testdata/modulescope_base.qbs0000644000175100017510000000010315154533055024222 0ustar runnerrunnerProduct { Depends { name: "scopemod" } scopemod.h: e * f } qbs-src-3.2.0/tests/auto/language/testdata/jsextensions.js0000644000175100017510000000420715154533055023305 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ (function() { // Function wrapper to keep the environment clean. /* * poor man's JS test suite */ var testctx = {}; function initTestContext(name) { testctx.nr = 1; testctx.name = name; } function verify(c) { if (!c) throw testctx.name + ": verification #" + testctx.nr + " failed."; testctx.nr++; } /* * Tests for extensions of JavaScript builtin types. */ var a = ["one", "two", "three"]; initTestContext("Array.prototype.contains"); for (var k in a) verify(k !== "contains"); verify(a.includes("one")); verify(a.includes("two")); verify(a.includes("three")); verify(!a.includes("four")); })() // END function wrapper qbs-src-3.2.0/tests/auto/language/testdata/subdir2/0000755000175100017510000000000015154533055021562 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/subdir2/exports-mylib2.qbs0000644000175100017510000000053715154533055025176 0ustar runnerrunnerStaticLibrary { name: "mylib2" Depends { name: "dummy" } dummy.defines: ["BUILD_" + product.name.toUpperCase()] property string definePrefix: "USE_" Export { Depends { name: "dummy" } dummy.defines: [exportingProduct.definePrefix + exportingProduct.name.toUpperCase()] dummy.includePaths: ["./lib"] } } qbs-src-3.2.0/tests/auto/language/testdata/narf0000644000175100017510000000000015154533055021047 0ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/qbs-property-convenience-override.qbs0000644000175100017510000000007615154533055027500 0ustar runnerrunnerProduct { name: "p" qbs.installPrefix: "/usr/local" } qbs-src-3.2.0/tests/auto/language/testdata/additional-product-types.qbs0000644000175100017510000000046015154533055025647 0ustar runnerrunnerProduct { name: "p" type: ["tag1"] Depends { name: "dummy" } Depends { name: "dummy2" } property bool hasTag1: type.includes("tag1") property bool hasTag2: type.includes("tag2") property bool hasTag3: type.includes("tag3") property bool hasTag4: type.includes("tag4") } qbs-src-3.2.0/tests/auto/language/testdata/idusage_group.qbs0000644000175100017510000000011015154533055023544 0ustar runnerrunnerGroup { id: baseGroup name: "base" prefix: baseGroup.name } qbs-src-3.2.0/tests/auto/language/testdata/modules/0000755000175100017510000000000015154533055021660 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/dummy/0000755000175100017510000000000015154533055023013 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/dummy/dummy.qbs0000644000175100017510000000173115154533055024657 0ustar runnerrunnerimport "dummy_base.qbs" as DummyBase DummyBase { condition: true additionalProductTypes: ["tag2"] property bool falseProperty: false property stringList defines property stringList cFlags property stringList cxxFlags property stringList rpaths: ["$ORIGIN"] property string someString property string productName: product.name property string upperCaseProductName: productName.toUpperCase() property string zort: "zort in dummy" property pathList includePaths property path somePath property stringList listProp: product.type.includes("blubb") ? ["123"] : ["456"] property bool controllingProp: false property stringList listProp2: controllingProp ? ["DEFAULT_STUFF", "EXTRA_STUFF"] : ["DEFAULT_STUFF"] property varList varListProp: [{a: controllingProp, b: someString}] Probe { id: QBS_1821 property stringList Flags: cxxFlags configure: {} } } qbs-src-3.2.0/tests/auto/language/testdata/modules/dummy/dummy_base.qbs0000644000175100017510000000010315154533055025641 0ustar runnerrunnerModule { condition: false property pathList includePaths } qbs-src-3.2.0/tests/auto/language/testdata/modules/module_with_file/0000755000175100017510000000000015154533055025177 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/module_with_file/module-with-file.qbs0000644000175100017510000000056715154533055031071 0ustar runnerrunnerModule { property bool file1IsTarget property bool file2IsTarget Group { prefix: product.sourceDirectory + '/' files: "zort" filesAreTargets: product.module_with_file.file1IsTarget } Group { prefix: product.sourceDirectory + '/' files: "zort" filesAreTargets: product.module_with_file.file2IsTarget } } qbs-src-3.2.0/tests/auto/language/testdata/modules/dummy2/0000755000175100017510000000000015154533055023075 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/dummy2/dummy2.qbs0000644000175100017510000000022415154533055025017 0ustar runnerrunnerModule { additionalProductTypes: ["tag3"] property var defines property var someTrueProp: true property var someFalseProp: false } qbs-src-3.2.0/tests/auto/language/testdata/modules/gmod4/0000755000175100017510000000000015154533055022672 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/gmod4/gmod4.qbs0000644000175100017510000000027615154533055024420 0ustar runnerrunnerModule { Depends { name: "gmod2" } Depends { name: "gmod3" } property string gmod4_string: "gmod4_string_proto" gmod2.gmod2_list: [gmod4_string + "_" + gmod3.gmod3_string] } qbs-src-3.2.0/tests/auto/language/testdata/modules/module-with-properties-item/0000755000175100017510000000000015154533055027244 5ustar runnerrunner././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/modules/module-with-properties-item/module-with-properties-item.qbsqbs-src-3.2.0/tests/auto/language/testdata/modules/module-with-properties-item/module-with-propertie0000644000175100017510000000033015154533055033430 0ustar runnerrunnerModule { property bool boolProperty: true property string stringProperty: "set in Module item" Properties { condition: boolProperty stringProperty: "overridden in Properties item" } } qbs-src-3.2.0/tests/auto/language/testdata/modules/multiple_backends/0000755000175100017510000000000015154533055025345 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/multiple_backends/backend2.qbs0000644000175100017510000000017615154533055027531 0ustar runnerrunnerModule { condition: qbs.targetOS.includes("os2") property string prop: "backend 2" property string backend2Prop } qbs-src-3.2.0/tests/auto/language/testdata/modules/multiple_backends/backend3.qbs0000644000175100017510000000021015154533055027517 0ustar runnerrunnerModule { condition: qbs.targetOS.includes("os2") && qbs.toolchain.includes("tc") priority: 1 property string backend3Prop } qbs-src-3.2.0/tests/auto/language/testdata/modules/multiple_backends/backend1.qbs0000644000175100017510000000013515154533055027523 0ustar runnerrunnerModule { condition: qbs.targetOS.includes("os1") property string prop: "backend 1" } qbs-src-3.2.0/tests/auto/language/testdata/modules/module_with_group/0000755000175100017510000000000015154533055025414 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/module_with_group/module_with_group.qbs0000644000175100017510000000072415154533055031662 0ustar runnerrunnerModule { Depends { name: "dummy" } property string moduleDefine: "module_define" property string group Group { name: "module_group" condition: group == name Properties { dummy.defines: [moduleDefine.toUpperCase(), name.toUpperCase()] } } Group { name: "module_group_alt" condition: group == name product.dummy.defines: [moduleDefine.toUpperCase(), name.toUpperCase()] } } qbs-src-3.2.0/tests/auto/language/testdata/modules/deepdummy/0000755000175100017510000000000015154533055023651 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/deepdummy/deep/0000755000175100017510000000000015154533055024566 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/deepdummy/deep/moat/0000755000175100017510000000000015154533055025526 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/deepdummy/deep/moat/dummydeepmoat.qbs0000644000175100017510000000020215154533055031101 0ustar runnerrunnerModule { property string depth: "abysmal" Depends { name: "dummy"; id: dummyId } property string zort: dummyId.zort } qbs-src-3.2.0/tests/auto/language/testdata/modules/multiple_backends_via_own_property/0000755000175100017510000000000015154533055031033 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/multiple_backends_via_own_property/backend2.qbs0000644000175100017510000000010015154533055033202 0ustar runnerrunnerBackend { condition: type === "type2" value: "value2" } qbs-src-3.2.0/tests/auto/language/testdata/modules/multiple_backends_via_own_property/Backend.qbs0000644000175100017510000000012315154533055033065 0ustar runnerrunnerModule { condition: false property string type property string value } qbs-src-3.2.0/tests/auto/language/testdata/modules/multiple_backends_via_own_property/backend1.qbs0000644000175100017510000000010015154533055033201 0ustar runnerrunnerBackend { condition: type === "type1" value: "value1" } qbs-src-3.2.0/tests/auto/language/testdata/modules/scopemod/0000755000175100017510000000000015154533055023471 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/scopemod/scopemod.qbs0000644000175100017510000000030315154533055026005 0ustar runnerrunnerModule { property int a: 1 property int b: 1 property int c: a + 1 property int d: b + 1 property int e: 1 property int f: 1 property int g: 1 property int h: 1 } qbs-src-3.2.0/tests/auto/language/testdata/modules/dummy3_loader/0000755000175100017510000000000015154533055024424 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/dummy3_loader/dummy3_loader.qbs0000644000175100017510000000010515154533055027673 0ustar runnerrunnerModule { Depends { name: "dummy3" } dummy3.loadDummy: true } qbs-src-3.2.0/tests/auto/language/testdata/modules/gmod2/0000755000175100017510000000000015154533055022670 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/gmod2/gmod2.qbs0000644000175100017510000000031215154533055024403 0ustar runnerrunnerModule { property int prop: 0 property string gmod2_string: "gmod2_string_proto" property string commonName: "commonName_in_gmod2" property stringList gmod2_list: ["gmod2_list_proto"] } qbs-src-3.2.0/tests/auto/language/testdata/modules/gmod3/0000755000175100017510000000000015154533055022671 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/gmod3/qmod3.qbs0000644000175100017510000000020515154533055024420 0ustar runnerrunnerModule { Depends { name: "gmod2" } property string gmod3_string: "gmod3_string_proto" gmod2.gmod2_list: [gmod3_string] } qbs-src-3.2.0/tests/auto/language/testdata/modules/dummy3/0000755000175100017510000000000015154533055023076 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/dummy3/dummy3.qbs0000644000175100017510000000014215154533055025020 0ustar runnerrunnerModule { property bool loadDummy: false Depends { name: "dummy"; condition: loadDummy } } qbs-src-3.2.0/tests/auto/language/testdata/modules/module-with-product-dependency/0000755000175100017510000000000015154533055027710 5ustar runnerrunner././@LongLink0000644000000000000000000000016500000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/modules/module-with-product-dependency/module-with-product-dependency.qbsqbs-src-3.2.0/tests/auto/language/testdata/modules/module-with-product-dependency/module-with-produc0000644000175100017510000000004615154533055033363 0ustar runnerrunnerModule { Depends { name: "p2" } } qbs-src-3.2.0/tests/auto/language/testdata/modules/broken/0000755000175100017510000000000015154533055023140 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/broken/broken.qbs0000644000175100017510000000056515154533055025135 0ustar runnerrunnerModule { Probe { id: theProbe property stringList broken property stringList fine configure: { broken = [["x"]]; fine = ["x"] found = true; } } property stringList broken: theProbe.broken property stringList fine: theProbe.fine.filter(function(incl) { return incl != "y"; }); } qbs-src-3.2.0/tests/auto/language/testdata/modules/dummyqt/0000755000175100017510000000000015154533055023360 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/dummyqt/network/0000755000175100017510000000000015154533055025051 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/dummyqt/network/dummynetwork.qbs0000644000175100017510000000027115154533055030325 0ustar runnerrunnerModule { Depends { name: "dummyqt"; submodules: ["core"] } property string networkProperty: "networkProperty" Depends { name: "dummy" } dummy.defines: ["QT_NETWORK"] } qbs-src-3.2.0/tests/auto/language/testdata/modules/dummyqt/gui/0000755000175100017510000000000015154533055024144 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/dummyqt/gui/dummygui.qbs0000644000175100017510000000041615154533055026514 0ustar runnerrunnerModule { Depends { name: "dummyqt.core" } property string guiProperty: "guiProperty" property string someString: "ene mene muh" Depends { name: "dummy" } dummy.defines: ["QT_GUI"] dummy.someString: someString dummy.zort: dummyqt.core.zort } qbs-src-3.2.0/tests/auto/language/testdata/modules/dummyqt/core/0000755000175100017510000000000015154533055024310 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/dummyqt/core/dummycore.qbs0000644000175100017510000000111615154533055027022 0ustar runnerrunnerModule { property int versionMajor: 5 property int versionMinor: 0 property int versionPatch: 0 property string version: versionMajor.toString() + "." + versionMinor.toString() + "." + versionPatch.toString() property string coreProperty: "coreProperty" property string coreVersion: version property string zort: "zort in dummyqt.core" Depends { name: "dummy" } dummy.defines: ["QT_CORE"] dummy.rpaths: ["/opt/qt/lib"] dummy.cFlags: [zort] dummy.varListProp: [{c: "qtcore"}] Properties { dummy.productName: product.name } } qbs-src-3.2.0/tests/auto/language/testdata/modules/gmod/0000755000175100017510000000000015154533055022606 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/gmod/gmod1/0000755000175100017510000000000015154533055023615 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/modules/gmod/gmod1/gmod1.qbs0000644000175100017510000000106315154533055025333 0ustar runnerrunnerModule { Depends { name: "gmod2" } Depends { name: "gmod4" } property stringList gmod1_list1: ["gmod1_list1_proto", gmod1_string] property stringList gmod1_list2: ["gmod1_list2_proto"] property stringList gmod1_list3: [gmod1_string] property string gmod1_string: "gmod1_string_proto" property string commonName: "commonName_in_gmod1" property int depProp: gmod2.prop property int p0: p1 + p2 property int p1: 0 property int p2: 0 gmod2.gmod2_string: gmod1_string gmod2.gmod2_list: [gmod1_string, commonName] } qbs-src-3.2.0/tests/auto/language/testdata/probes-and-multiplexing.qbs0000644000175100017510000000062615154533055025474 0ustar runnerrunnerProduct { multiplexByQbsProperties: "architectures" qbs.architectures: ["x86", "x86_64", "arm"] property string archFromProbe: theProbe.archOut Probe { id: theProbe property string archIn: qbs.architecture property string archOut configure: { archOut = archIn; } } Group { name: "theGroup" qbs.sysroot: "/" + theProbe.archOut } } qbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/0000755000175100017510000000000015154533055024567 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/simple-collision1.qbs0000644000175100017510000000006315154533055030640 0ustar runnerrunnerProduct { Depends { name: "prefix1.suffix" } } qbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/complex-collision.qbs0000644000175100017510000000014415154533055030735 0ustar runnerrunnerProduct { Depends { name: "prefix1.middle1" } Depends { name: "prefix1.middle1.suffix1" } } qbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/no-collision2.qbs0000644000175100017510000000014315154533055027763 0ustar runnerrunnerProduct { Depends { name: "prefix1.middle1" } Depends { name: "prefix1.middle2.suffix" } } qbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/simple-collision2.qbs0000644000175100017510000000005415154533055030641 0ustar runnerrunnerProduct { Depends { name: "prefix2" } } qbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/0000755000175100017510000000000015154533055026237 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix2/0000755000175100017510000000000015154533055027616 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix2/prefix2.qbs0000644000175100017510000000006215154533055031702 0ustar runnerrunnerModule { Depends { name: "prefix2.suffix" } } qbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix2/suffix/0000755000175100017510000000000015154533055031122 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix2/suffix/suffix.qbs0000644000175100017510000000001315154533055033127 0ustar runnerrunnerModule { } qbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/0000755000175100017510000000000015154533055027615 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/suffix/0000755000175100017510000000000015154533055031121 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/suffix/suffix.qbs0000644000175100017510000000005315154533055033132 0ustar runnerrunnerModule { Depends { name: "prefix1" } } qbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/prefix1.qbs0000644000175100017510000000001315154533055031674 0ustar runnerrunnerModule { } qbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/0000755000175100017510000000000015154533055031134 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/suffix2/0000755000175100017510000000000015154533055032522 5ustar runnerrunner././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/suffix2/suffix2.qbsqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/suffix2/su0000644000175100017510000000001215154533055033065 0ustar runnerrunnerModule {} qbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/suffix1/0000755000175100017510000000000015154533055032521 5ustar runnerrunner././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/suffix1/suffix1.qbsqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/suffix1/su0000644000175100017510000000001215154533055033064 0ustar runnerrunnerModule {} ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/middle1.qbsqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/middle1.qb0000644000175100017510000000001215154533055032770 0ustar runnerrunnerModule {} qbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle2/0000755000175100017510000000000015154533055031135 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle2/suffix/0000755000175100017510000000000015154533055032441 5ustar runnerrunner././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle2/suffix/suffix.qbsqbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle2/suffix/suf0000644000175100017510000000001215154533055033152 0ustar runnerrunnerModule {} qbs-src-3.2.0/tests/auto/language/testdata/module-name-collisions/no-collision1.qbs0000644000175100017510000000015415154533055027764 0ustar runnerrunnerProduct { Depends { name: "prefix1.middle1.suffix1" } Depends { name: "prefix1.middle1.suffix2" } } qbs-src-3.2.0/tests/auto/language/testdata/error-in-disabled-product.qbs0000644000175100017510000000161715154533055025704 0ustar runnerrunnerProject { Product { name: "a" condition: false property stringList l: [undefined] } Product { name: "b" condition: false Group { name: { throw "boo!" } } } Product { name: "c" Group { condition: false name: { throw "boo!" } } } Project { condition: false Project { condition: true Product { name: "d" condition: { throw "ouch!" } } } } Product { condition: false Rule { inputs: [5] } } Project { condition: false minimumQbsVersion: false } Product { name: "e" condition: dummy.falseProperty Depends { name: "does.not.exist" } Depends { name: "dummy" } } } qbs-src-3.2.0/tests/auto/language/testdata/conditionaldepends_base.qbs0000644000175100017510000000023015154533055025552 0ustar runnerrunnerProduct { name: 'conditionaldepends_base' property bool someProp: false Depends { condition: someProp name: 'dummy' } } qbs-src-3.2.0/tests/auto/language/testdata/jsimportsinmultiplescopes.qbs0000644000175100017510000000025315154533055026271 0ustar runnerrunnerimport "jsimportsinmultiplescopes.js" as MyFunctions Product { name: MyFunctions.getName(qbs) qbs.installDir: MyFunctions.getInstallDir() files: "main.cpp" } qbs-src-3.2.0/tests/auto/language/testdata/jsimportsinmultiplescopes.js0000644000175100017510000000030115154533055026112 0ustar runnerrunnerfunction getName(qbsModule) { if (qbsModule.debugInformation) return "MyProduct_debug"; else return "MyProduct"; } function getInstallDir() { return "somewhere"; } qbs-src-3.2.0/tests/auto/language/testdata/outerInGroup.qbs0000644000175100017510000000075515154533055023370 0ustar runnerrunnerProject { Product { name: "OuterInGroup" Depends { name: "dummy" } qbs.installDir: "/somewhere" dummy.someString: "s1" Properties { dummy.someString: outer.concat("s2") } files: ["main.cpp"] Group { Group { name: "Special Group" files: ["aboutdialog.cpp"] qbs.installDir: outer + "/else" dummy.someString: outer.concat("s3") } } } } qbs-src-3.2.0/tests/auto/language/testdata/overridden-properties-and-prototypes.qbs0000644000175100017510000000010415154533055030233 0ustar runnerrunnerProduct { name: "p" Depends { name: "multiple_backends" } } qbs-src-3.2.0/tests/auto/language/tst_language.cpp0000644000175100017510000047431715154533055021600 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #undef QT_NO_CAST_FROM_ASCII // I am qmake, and I approve this hack. #include "tst_language.h" #include "../shared.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include Q_DECLARE_METATYPE(QList) using namespace qbs; using namespace qbs::Internal; static QString testDataDir() { return testDataSourceDir(SRCDIR "/testdata"); } static QString testProject(const char *fileName) { return testDataDir() + QLatin1Char('/') + QLatin1String(fileName); } class JSSourceValueCreator { FileContextPtr m_fileContext; std::vector> m_strings; public: JSSourceValueCreator(const FileContextPtr &fileContext) : m_fileContext(fileContext) { } JSSourceValuePtr create(const QString &sourceCode) { JSSourceValuePtr value = JSSourceValue::create(); value->setFile(m_fileContext); auto str = std::make_unique(sourceCode); value->setSourceCode(*str.get()); m_strings.push_back(std::move(str)); return value; } }; TestLanguage::TestLanguage(ILogSink *logSink, Settings *settings) : m_logSink(logSink) , m_settings(settings) , m_wildcardsTestDirPath(QDir::tempPath() + QLatin1String("/_wildcards_test_dir_")) { m_rand.seed(QTime::currentTime().msec()); qRegisterMetaType >("QList"); } TestLanguage::~TestLanguage() = default; QHash TestLanguage::productsFromProject(ResolvedProjectPtr project) { QHash result; const auto products = project->allProducts(); for (const ResolvedProductPtr &product : products) result.insert(product->name, product); return result; } template typename C::value_type findByName(const C &container, const QString &name) { auto endIt = std::end(container); auto it = std::find_if(std::begin(container), endIt, [&name] (const typename C::value_type &thing) { return thing->name == name; }); if (it != endIt) return *it; return typename C::value_type(); } ResolvedModuleConstPtr TestLanguage::findModuleByName(ResolvedProductPtr product, const QString &name) { return findByName(product->modules, name); } QVariant TestLanguage::productPropertyValue(ResolvedProductPtr product, QString propertyName) { QStringList propertyNameComponents = propertyName.split(QLatin1Char('.')); if (propertyNameComponents.size() > 1) return product->moduleProperties->property(propertyNameComponents); return getConfigProperty(product->productProperties, propertyNameComponents); } void TestLanguage::handleInitCleanupDataTags(const char *projectFileName, bool *handled) { const QByteArray dataTag = QTest::currentDataTag(); if (dataTag == "init") { *handled = true; bool exceptionCaught = false; try { resolveProject(projectFileName); QVERIFY(!!project); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } else if (dataTag == "cleanup") { *handled = true; project.reset(); } else { *handled = false; } } TopLevelProjectPtr TestLanguage::resolveProject(const char *relProjectFilePath) { if (relProjectFilePath) defaultParameters.setProjectFilePath(testProject(relProjectFilePath)); defaultParameters.expandBuildConfiguration(); ProjectResolver resolver(defaultParameters, m_engine.get(), m_logger); return project = resolver.resolve(); } void TestLanguage::init() { // clear caches, otherwise StoredVariantValues may end up being at the same address // as the destroyed value m_engine->reset(); m_logSink->setLogLevel(LoggerInfo); defaultParameters = {}; defaultParameters.setBuildRoot(m_tempDir.path() + "/buildroot"); defaultParameters.setPropertyCheckingMode(ErrorHandlingMode::Strict); defaultParameters.setSettingsDirectory(m_settings->baseDirectory()); defaultParameters.setTopLevelProfile(profileName()); defaultParameters.setMaxJobCount(1); defaultParameters.setConfigurationName("default"); defaultParameters.setEnvironment(QProcessEnvironment::systemEnvironment()); defaultParameters.setSearchPaths({SRCDIR "/../../../share/qbs"}); QVERIFY(m_tempDir.isValid()); } #define HANDLE_INIT_CLEANUP_DATATAGS(fn) {\ bool handled;\ handleInitCleanupDataTags(fn, &handled);\ if (handled)\ return;\ QVERIFY(!!project);\ } void TestLanguage::initTestCase() { m_logger = Logger(m_logSink); m_engine = ScriptEngine::create(m_logger, EvalContext::PropertyEvaluation); QVERIFY(QFileInfo(m_wildcardsTestDirPath).isAbsolute()); } void TestLanguage::additionalProductTypes() { bool exceptionCaught = false; try { resolveProject("additional-product-types.qbs"); QVERIFY(!!project); const QHash products = productsFromProject(project); const ResolvedProductConstPtr product = products.value("p"); QVERIFY(!!product); const QVariantMap cfg = product->productProperties; QVERIFY(cfg.value("hasTag1").toBool()); QVERIFY(cfg.value("hasTag2").toBool()); QVERIFY(cfg.value("hasTag3").toBool()); QVERIFY(!cfg.value("hasTag4").toBool()); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::baseProperty() { bool exceptionCaught = false; try { resolveProject("baseproperty.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); ResolvedProductPtr product = products.value("product1"); QVERIFY(!!product); QVariantMap cfg = product->productProperties; QCOMPARE(cfg.value("narf").toStringList(), QStringList() << "boo"); QCOMPARE(cfg.value("zort").toStringList(), QStringList() << "bar" << "boo"); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::baseValidation() { try { resolveProject("base-validate/base-validate.qbs"); QVERIFY2(false, "exception expected"); } catch (const qbs::ErrorInfo &e) { QVERIFY2(e.toString().contains("Parent succeeded, child failed."), qPrintable(e.toString())); } } void TestLanguage::brokenDependencyCycle() { QFETCH(QString, projectFileName); try { resolveProject(qPrintable(projectFileName)); } catch (const qbs::ErrorInfo &e) { QVERIFY2(false, qPrintable(e.toString())); } } void TestLanguage::brokenDependencyCycle_data() { QTest::addColumn("projectFileName"); QTest::newRow("one order of products") << "broken-dependency-cycle1.qbs"; QTest::newRow("another order of products") << "broken-dependency-cycle2.qbs"; } void TestLanguage::buildConfigStringListSyntax() { bool exceptionCaught = false; try { QVariantMap overriddenValues; overriddenValues.insert("project.someStrings", "foo,bar,baz"); defaultParameters.setOverriddenValues(overriddenValues); resolveProject("buildconfigstringlistsyntax.qbs"); QVERIFY(!!project); QCOMPARE(project->projectProperties().value("someStrings").toStringList(), QStringList() << "foo" << "bar" << "baz"); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::builtinFunctionInSearchPathsProperty() { bool exceptionCaught = false; try { QVERIFY(resolveProject("builtinFunctionInSearchPathsProperty.qbs")); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::chainedProbes() { bool exceptionCaught = false; try { resolveProject("chained-probes/chained-probes.qbs"); QVERIFY(!!project); QCOMPARE(project->products.size(), size_t(1)); const QString prop1Val = project->products.front()->moduleProperties ->moduleProperty("m", "prop1").toString(); QCOMPARE(prop1Val, QLatin1String("probe1Val")); const QString prop2Val = project->products.front()->moduleProperties ->moduleProperty("m", "prop2").toString(); QCOMPARE(prop2Val, QLatin1String("probe1Valprobe2Val")); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::versionCompare() { bool exceptionCaught = false; try { QVERIFY(resolveProject("versionCompare.qbs")); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::canonicalArchitecture() { bool exceptionCaught = false; try { resolveProject("canonicalArchitecture.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); ResolvedProductPtr product = products.value(QStringLiteral("x86")); QVERIFY(!!product); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::rfc1034Identifier() { bool exceptionCaught = false; try { resolveProject("rfc1034identifier.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); ResolvedProductPtr product = products.value(QStringLiteral("this-has-special-characters-" "uh-oh-Undersc0r3s-Are.Bad")); QVERIFY(!!product); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::throwThings_data() { QTest::addColumn("type"); QTest::addColumn("result"); QTest::addRow("bool") << "bool" << "true"; QTest::addRow("int") << "int" << "43"; QTest::addRow("string") << "string" << "an error"; QTest::addRow("list") << "list" << R"([ "an", "error" ])"; QTest::addRow("object") << "object" << R"({ "reason": "overheating", "result": "crash" })"; } void TestLanguage::throwThings() { QFETCH(QString, type); QFETCH(QString, result); bool exceptionCaught = false; try { defaultParameters.setOverriddenValues({{"project.throwType", type}}); resolveProject("throw.qbs"); } catch (const ErrorInfo &e) { exceptionCaught = true; QVERIFY2(e.toString().contains(result), qPrintable(e.toString())); } QVERIFY(exceptionCaught); } void TestLanguage::conditionalDepends() { bool exceptionCaught = false; ResolvedProductPtr product; ResolvedModuleConstPtr dependency; try { defaultParameters.setOverriddenValues({std::make_pair(QString("products." "multilevel_module_props_overridden.dummy3.loadDummy"), true)}); resolveProject("conditionaldepends.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); product = products.value("conditionaldepends_derived"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy"); QVERIFY(!!dependency); product = products.value("conditionaldepends_derived_false"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy"); QCOMPARE(dependency, ResolvedModuleConstPtr()); product = products.value("product_props_true"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy"); QVERIFY(!!dependency); product = products.value("product_props_false"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy"); QCOMPARE(dependency, ResolvedModuleConstPtr()); product = products.value("project_props_true"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy"); QVERIFY(!!dependency); product = products.value("project_props_false"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy"); QCOMPARE(dependency, ResolvedModuleConstPtr()); product = products.value("module_props_true"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy2"); QVERIFY(!!dependency); dependency = findModuleByName(product, "dummy"); QVERIFY(!!dependency); product = products.value("module_props_false"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy2"); QVERIFY(!!dependency); dependency = findModuleByName(product, "dummy"); QCOMPARE(dependency, ResolvedModuleConstPtr()); product = products.value("multilevel_module_props_true"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy3"); QVERIFY(!!dependency); dependency = findModuleByName(product, "dummy"); QVERIFY(!!dependency); product = products.value("multilevel_module_props_false"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy3"); QVERIFY(!!dependency); dependency = findModuleByName(product, "dummy"); QCOMPARE(dependency, ResolvedModuleConstPtr()); product = products.value("multilevel_module_props_overridden"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy3"); QVERIFY(!!dependency); dependency = findModuleByName(product, "dummy"); QVERIFY(!!dependency); product = products.value("multilevel2_module_props_true"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy3_loader"); QVERIFY(!!dependency); dependency = findModuleByName(product, "dummy3"); QVERIFY(!!dependency); dependency = findModuleByName(product, "dummy"); QVERIFY(!!dependency); product = products.value("contradictory_conditions1"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy"); QVERIFY(!!dependency); product = products.value("contradictory_conditions2"); QVERIFY(!!product); dependency = findModuleByName(product, "dummy"); QVERIFY(!!dependency); product = products.value("unknown_dependency_condition_false"); QVERIFY(!!product); dependency = findModuleByName(product, "doesonlyexistifhellfreezesover"); QVERIFY(!dependency); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::convertStringList() { FileContextPtr fileContext = FileContext::create(); fileContext->setFilePath("/dev/null"); JSSourceValueCreator sourceValueCreator(fileContext); ItemPool pool; Item *scope = Item::create(&pool, ItemType::Scope); scope->setProperty("x", sourceValueCreator.create("[\"a\", \"b\"]")); Evaluator evaluator(m_engine.get()); auto variantValue = evaluator.variantValue(scope, "x"); // despite we have a stringList prop, we evaluate it as a QVariantList QCOMPARE(variantValue.userType(), QMetaType::Type::QVariantList); // and we have to convert it explicitly #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) variantValue.convert(QMetaType(QMetaType::QStringList)); #else variantValue.convert(QMetaType::QStringList); #endif QCOMPARE(variantValue.userType(), QMetaType::Type::QStringList); QCOMPARE(variantValue, QStringList({"a", "b"})); } void TestLanguage::correctDeclInParentLookup() { ErrorInfo exception; try { resolveProject("correct-decl-in-parent-lookup.qbs"); QVERIFY(project); QCOMPARE(project->products.size(), size_t(1)); const ResolvedProductConstPtr theProduct = productsFromProject(project).value("p"); QVERIFY(theProduct); QCOMPARE( theProduct->moduleProperties->moduleProperty("dummy", "cxxFlags").toStringList(), QStringList("x")); } catch (const ErrorInfo &e) { exception = e; } QVERIFY2(!exception.hasError(), qPrintable(exception.toString())); } void TestLanguage::delayedError() { QFETCH(bool, productEnabled); try { QFETCH(QString, projectFileName); QVariantMap overriddenValues; overriddenValues.insert("project.enableProduct", productEnabled); defaultParameters.setOverriddenValues(overriddenValues); resolveProject(projectFileName.toLatin1()); QCOMPARE(productEnabled, false); QVERIFY(!!project); QCOMPARE(project->products.size(), size_t(1)); const ResolvedProductConstPtr theProduct = productsFromProject(project).value("theProduct"); QVERIFY(!!theProduct); QCOMPARE(theProduct->enabled, false); } catch (const ErrorInfo &e) { if (!productEnabled) qDebug() << e.toString(); QCOMPARE(productEnabled, true); } } void TestLanguage::delayedError_data() { QTest::addColumn("projectFileName"); QTest::addColumn("productEnabled"); QTest::newRow("product enabled, module validation error") << "delayed-error/validation.qbs" << true; QTest::newRow("product disabled, module validation error") << "delayed-error/validation.qbs" << false; QTest::newRow("product enabled, module not found") << "delayed-error/nonexisting.qbs" << true; QTest::newRow("product disabled, module not found") << "delayed-error/nonexisting.qbs" << false; } void TestLanguage::dependencyOnAllProfiles() { bool exceptionCaught = false; try { TemporaryProfile p1("p1", m_settings); p1.p.setValue("qbs.architecture", "arch1"); TemporaryProfile p2("p2", m_settings); p2.p.setValue("qbs.architecture", "arch2"); QVariantMap overriddenValues; overriddenValues.insert("project.profile1", "p1"); overriddenValues.insert("project.profile2", "p2"); defaultParameters.setOverriddenValues(overriddenValues); resolveProject("dependencyOnAllProfiles.qbs"); QVERIFY(!!project); QCOMPARE(project->products.size(), size_t(3)); const ResolvedProductConstPtr mainProduct = productsFromProject(project).value("main"); QVERIFY(!!mainProduct); QCOMPARE(mainProduct->dependencies.size(), size_t { 2 }); for (const ProductDependency &p : mainProduct->dependencies) { QCOMPARE(p.product->name, QLatin1String("dep")); QVERIFY(p.product->profile() == "p1" || p.product->profile() == "p2"); } } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::dependsItemInGroup_data() { QTest::addColumn("enableGroup1"); QTest::addColumn("enableGroup2"); QTest::addColumn("enableDepends"); QTest::addColumn("dependencyExpected"); QTest::newRow("all disabled") << false << false << false << false; QTest::newRow("only Depends enabled") << false << false << true << false; QTest::newRow("only inner Group enabled") << false << true << false << false; QTest::newRow("inner Group and Depends enabled") << false << true << true << false; QTest::newRow("only outer Group enabled") << true << false << false << false; QTest::newRow("only outer Group and Depends enabled") << true << false << true << false; QTest::newRow("only Groups enabled") << true << true << false << false; QTest::newRow("everything enabled") << true << true << true << true; } void TestLanguage::dependsItemInGroup() { QFETCH(bool, enableGroup1); QFETCH(bool, enableGroup2); QFETCH(bool, enableDepends); QFETCH(bool, dependencyExpected); bool exceptionCaught = false; try { const QVariantMap overriddenValues{ std::make_pair("products.main.enableGroup1", enableGroup1), std::make_pair("products.main.enableGroup2", enableGroup2), std::make_pair("products.main.enableDepends", enableDepends)}; defaultParameters.setOverriddenValues(overriddenValues); resolveProject("depends-item-in-group.qbs"); QVERIFY(project); const ResolvedProductConstPtr mainProduct = productsFromProject(project).value("main"); QVERIFY(mainProduct); QCOMPARE(mainProduct->dependencies.empty(), !dependencyExpected); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::derivedSubProject() { bool exceptionCaught = false; try { resolveProject("derived-sub-project/project.qbs"); QVERIFY(!!project); const QHash products = productsFromProject(project); QCOMPARE(products.size(), 1); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::disabledPropertiesItem_data() { QTest::addColumn("setInProduct"); QTest::addColumn("setInHigher1"); QTest::addColumn("setInHigher2"); QTest::addColumn("setInLower"); QTest::addColumn("expectedValue"); QTest::addColumn("expectedListValue"); QTest::addColumn("expectedProductValue"); QTest::newRow("default") << false << false << false << false << QString("default") << QStringList{"N_GREATER_7", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"} << QStringList{"condition2", "default"}; QTest::newRow("lower only") << false << false << false << true << QString("default_fromLower") << QStringList{"N_GREATER_7", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "WITH_LOWER_PROP", "N_NON_ZERO"} << QStringList{"condition2", "default"}; QTest::newRow("higher2 only") << false << false << true << false << QString() << QStringList{"N_GREATER_7", "WITH_HIGHER2_PROP", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"} << QStringList{"condition2", "default"}; QTest::newRow("lower and higher2") << false << false << true << true << QString() << QStringList{"N_GREATER_7", "WITH_HIGHER2_PROP", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "WITH_LOWER_PROP", "N_NON_ZERO"} << QStringList{"condition2", "default"}; QTest::newRow("higher1 only") << false << true << false << false << QString("fromHigher1") << QStringList{"N_GREATER_7", "N_GREATER_6", "WITH_HIGHER1_PROP", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"} << QStringList{"condition2", "default"}; QTest::newRow("lower and higher1") << false << true << false << true << QString("fromHigher1") << QStringList{"N_GREATER_7", "N_GREATER_6", "WITH_HIGHER1_PROP", "N_GREATER_5", "N_LESS_20", "WITH_LOWER_PROP", "N_NON_ZERO"} << QStringList{"condition2", "default"}; QTest::newRow("product only") << true << false << false << false << QString("fromProduct") << QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"} << QStringList{"condition1", "condition2", "default"}; QTest::newRow("product and lower") << true << false << false << true << QString("fromProduct") << QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "WITH_LOWER_PROP", "N_NON_ZERO"} << QStringList{"condition1", "condition2", "default"}; QTest::newRow("product and higher2") << true << false << true << false << QString("fromProduct") << QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "WITH_HIGHER2_PROP", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"} << QStringList{"condition1", "condition2", "default"}; QTest::newRow("product, higher2 and lower") << true << false << true << true << QString("fromProduct") << QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "WITH_HIGHER2_PROP", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "WITH_LOWER_PROP", "N_NON_ZERO"} << QStringList{"condition1", "condition2", "default"}; QTest::newRow("product and higher1") << true << true << false << false << QString("fromProduct") << QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "N_GREATER_6", "WITH_HIGHER1_PROP", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"} << QStringList{"condition1", "condition2", "default"}; QTest::newRow("product, higher1 and higher2") << true << true << true << false << QString("fromProduct") << QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "WITH_HIGHER2_PROP", "N_GREATER_6", "WITH_HIGHER1_PROP", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"} << QStringList{"condition1", "condition2", "default"}; QTest::newRow("all") << true << true << true << true << QString("fromProduct") << QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "WITH_HIGHER2_PROP", "N_GREATER_6", "WITH_HIGHER1_PROP", "N_GREATER_5", "N_LESS_20", "WITH_LOWER_PROP", "N_NON_ZERO"} << QStringList{"condition1", "condition2", "default"}; } void TestLanguage::disabledPropertiesItem() { QFETCH(bool, setInLower); QFETCH(bool, setInHigher1); QFETCH(bool, setInHigher2); QFETCH(bool, setInProduct); QFETCH(QString, expectedValue); QFETCH(QStringList, expectedListValue); QFETCH(QStringList, expectedProductValue); QVariantMap overriddenValues; overriddenValues.insert("modules.lower.setProp", setInLower); overriddenValues.insert("modules.higher1.setProp", setInHigher1); overriddenValues.insert("modules.higher2.setProp", setInHigher2); overriddenValues.insert("products.p.setProp", setInProduct); defaultParameters.setOverriddenValues(overriddenValues); bool exceptionCaught = false; try { resolveProject("disabled-properties-item/disabled-properties-item.qbs"); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); QVERIFY(!!project); const QHash products = productsFromProject(project); QCOMPARE(products.size(), 1); const ResolvedProductConstPtr &p = *products.constBegin(); QCOMPARE(p->moduleProperties->moduleProperty("lower", "prop").toString(), expectedValue); QCOMPARE( p->moduleProperties->moduleProperty("lower", "listProp").toStringList(), expectedListValue); QCOMPARE(p->productProperties.value("productProp").toStringList(), expectedProductValue); } void TestLanguage::disabledSubProject() { bool exceptionCaught = false; try { resolveProject("disabled-subproject.qbs"); QVERIFY(!!project); const QHash products = productsFromProject(project); QCOMPARE(products.size(), 0); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::dottedNames_data() { QTest::addColumn("useProduct"); QTest::addColumn("useModule"); QTest::addColumn("expectSuccess"); QTest::addColumn("expectedErrorMessage"); QTest::newRow("missing product dependency") << false << true << false << QString("Item 'a.b' is not declared. Did you forget to add a Depends item"); QTest::newRow("missing module dependency") << true << false << false << QString("Item 'x.y' is not declared. Did you forget to add a Depends item"); QTest::newRow("missing both dependencies") << false << false << false << QString(); QTest::newRow("ok") << true << true << true << QString(); } void TestLanguage::dottedNames() { QFETCH(bool, expectSuccess); try { QFETCH(bool, useProduct); QFETCH(bool, useModule); const QVariantMap overridden{ std::make_pair("projects.theProject.includeDottedProduct", useProduct), std::make_pair("projects.theProject.includeDottedModule", useModule) }; defaultParameters.setOverriddenValues(overridden); resolveProject("dotted-names/dotted-names.qbs"); QVERIFY(expectSuccess); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), useProduct ? 2 : 1); const ResolvedProductPtr product = products.value("p"); QVERIFY(!!product); QCOMPARE(product->moduleProperties->moduleProperty("a.b", "c").toString(), QString("p")); QCOMPARE(product->moduleProperties->moduleProperty("x.y", "z").toString(), QString("p")); } catch (const ErrorInfo &e) { QVERIFY(!expectSuccess); QFETCH(QString, expectedErrorMessage); if (!expectedErrorMessage.isEmpty()) QVERIFY2(e.toString().contains(expectedErrorMessage), qPrintable(e.toString())); } } void TestLanguage::duplicateMultiplexValues_data() { QTest::addColumn("dummy"); QTest::newRow("duplicate-multiplex-value") << true; QTest::newRow("duplicate-multiplex-value2") << true; } void TestLanguage::duplicateMultiplexValues() { bool exceptionCaught = false; try { resolveProject(qPrintable(QString::fromLocal8Bit(QTest::currentDataTag()) + QLatin1String(".qbs"))); QVERIFY(project); const std::vector products = project->allProducts(); QCOMPARE(products.size(), 2); bool x86 = false; bool arm = false; for (const ResolvedProductPtr &p : products) { if (p->moduleProperties->moduleProperty("qbs", "architecture").toString() == "x86") x86 = true; else if (p->moduleProperties->moduleProperty("qbs", "architecture").toString() == "arm") arm = true; } QVERIFY(x86); QVERIFY(arm); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QVERIFY(!exceptionCaught); } void TestLanguage::emptyJsFile() { bool exceptionCaught = false; try { resolveProject("empty-js-file.qbs"); QVERIFY(!!project); const QHash products = productsFromProject(project); QCOMPARE(products.size(), 1); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::enumerateProjectProperties() { bool exceptionCaught = false; try { resolveProject("enum-project-props.qbs"); QVERIFY(!!project); const auto products = productsFromProject(project); QCOMPARE(products.size(), 1); const ResolvedProductConstPtr product = *products.begin(); QCOMPARE(product->groups.size(), size_t(1)); const auto files = product->groups.front()->files; QVERIFY(files); QCOMPARE(files->size(), size_t(1)); const QString fileName = FileInfo::fileName(files->front()->absoluteFilePath); QCOMPARE(fileName, QString("dummy.txt")); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::evalErrorInNonPresentModule_data() { QTest::addColumn("moduleRequired"); QTest::addColumn("errorMessage"); QTest::newRow("module required") << true << "broken.qbs:2:5 Element at index 0 of list property 'broken' " "does not have string type"; QTest::newRow("module not required") << false << QString(); } void TestLanguage::evalErrorInNonPresentModule() { QFETCH(bool, moduleRequired); QFETCH(QString, errorMessage); try { QVariantMap overridden{std::make_pair("products.p.moduleRequired", moduleRequired)}; defaultParameters.setOverriddenValues(overridden); resolveProject("eval-error-in-non-present-module.qbs"); QVERIFY(errorMessage.isEmpty()); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 1); const ResolvedProductPtr product = products.value("p"); QVERIFY(!!product); } catch (const ErrorInfo &e) { QVERIFY(!errorMessage.isEmpty()); QVERIFY2(e.toString().contains(errorMessage), qPrintable(e.toString())); } } void TestLanguage::defaultValue() { bool exceptionCaught = false; try { QFETCH(QString, prop1Value); QVariantMap overridden; if (!prop1Value.isEmpty()) overridden.insert("modules.lower.prop1", prop1Value); defaultParameters.setOverriddenValues(overridden); resolveProject("defaultvalue/egon.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 2); const ResolvedProductPtr product = products.value("egon"); QVERIFY(!!product); QStringList propertyName = QStringList() << "lower" << "prop2"; QVariant propertyValue = product->moduleProperties->property(propertyName); QFETCH(QVariant, expectedProp2Value); QCOMPARE(propertyValue, expectedProp2Value); propertyName = QStringList() << "lower" << "listProp"; propertyValue = product->moduleProperties->property(propertyName); QFETCH(QVariant, expectedListPropValue); QCOMPARE(propertyValue.toStringList(), expectedListPropValue.toStringList()); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::defaultValue_data() { QTest::addColumn("prop1Value"); QTest::addColumn("expectedProp2Value"); QTest::addColumn("expectedListPropValue"); QTest::newRow("controlling property with random value") << "random" << QVariant("withoutBlubb") << QVariant(QStringList({"other"})); QTest::newRow("controlling property with blubb value") << "blubb" << QVariant("withBlubb") << QVariant(QStringList({"blubb", "other"})); QTest::newRow("controlling property with egon value") << "egon" << QVariant("withEgon") << QVariant(QStringList({"egon", "other"})); QTest::newRow("controlling property not overwritten") << "" << QVariant("withBlubb") << QVariant(QStringList({"blubb", "other"})); } void TestLanguage::environmentVariable() { bool exceptionCaught = false; try { // Create new environment: const QString varName = QStringLiteral("PRODUCT_NAME"); const QString productName = QLatin1String("MyApp") + QString::number(m_rand.generate()); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(varName, productName); QProcessEnvironment origEnv = defaultParameters.environment(); // store orig environment defaultParameters.setEnvironment(env); resolveProject("environmentvariable.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); ResolvedProductPtr product = products.value(productName); QVERIFY(!!product); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::errorInDisabledProduct() { bool exceptionCaught = false; try { resolveProject("error-in-disabled-product.qbs"); QVERIFY(!!project); auto products = productsFromProject(project); QCOMPARE(products.size(), 5); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::erroneousFiles_data() { QTest::addColumn("errorMessage"); QTest::newRow("unknown_module") << "Dependency 'neitherModuleNorProduct' not found"; QTest::newRow("multiple_exports") << "Multiple Export items in one product are prohibited."; QTest::newRow("multiple_properties_in_subproject") << "Multiple instances of item 'Properties' found where at most one " "is allowed."; QTest::newRow("importloop1") << "Loop detected when importing"; QTest::newRow("nonexistentouter") << "outer is not defined"; QTest::newRow("invalid_file") << "does not exist"; QTest::newRow("invalid-parameter-rhs") << "access is not defined"; QTest::newRow("invalid-parameter-type") << "Value assigned to property 'stringParameter' does not have type 'string'."; QTest::newRow("invalid_property_type") << "Unknown type 'nonsense' in property declaration."; QTest::newRow("reserved_name_in_import") << "Cannot reuse the name of built-in extension 'TextFile'."; QTest::newRow("throw_in_property_binding") << "something is wrong"; QTest::newRow("no-configure-in-probe") << "no-configure-in-probe.qbs:2:5.*Probe.configure must be set"; QTest::newRow("dependency_cycle") << "Cyclic dependencies detected."; QTest::newRow("dependency_cycle2") << "Cyclic dependencies detected."; QTest::newRow("dependency_cycle3") << "Cyclic dependencies detected."; QTest::newRow("dependency_cycle3a") << "Cyclic dependencies detected."; QTest::newRow("dependency_cycle4") << "Cyclic dependencies detected."; QTest::newRow("references_cycle") << "Cycle detected while referencing file '.*references_cycle.qbs'."; QTest::newRow("subproject_cycle") << "Cycle detected while loading subproject file 'subproject_cycle.qbs'."; QTest::newRow("invalid_stringlist_element") << "Element at index 1 of list property 'files' does not have string type."; QTest::newRow("undefined_stringlist_element") << "Element at index 1 of list property 'files' is undefined. String expected."; QTest::newRow("undefined_stringlist_element_in_probe") << "Element at index 1 of list property 'l' is undefined. String expected."; QTest::newRow("undeclared_item") << "Item 'cpp' is not declared."; QTest::newRow("undeclared-parameter1") << "Parameter 'prefix2.suffix.nope' is not declared."; QTest::newRow("undeclared-parameter2") << "Cannot set parameter 'foo.bar', " "because 'myproduct' does not have a dependency on 'foo'."; QTest::newRow("undeclared_property_wrapper") << "Property 'doesntexist' is not declared."; QTest::newRow("undeclared_property_in_export_item") << "Property 'blubb' is not declared."; QTest::newRow("undeclared_property_in_export_item2") << "Item 'something' is not declared."; QTest::newRow("undeclared_property_in_export_item3") << "Property 'blubb' is not declared."; QTest::newRow("undeclared_module_property_in_module") << "Property 'noSuchProperty' is not declared."; QTest::newRow("unknown_item_type") << "Unexpected item type 'Narf'"; QTest::newRow("invalid_child_item_type") << "Items of type 'Project' cannot contain items of type 'Depends'."; QTest::newRow("conflicting_fileTagsFilter") << "Conflicting fileTagsFilter in Group items"; QTest::newRow("duplicate_sources") << "Duplicate source file '.*main.cpp'" ".*duplicate_sources.qbs:2:12.*duplicate_sources.qbs:4:16."; QTest::newRow("duplicate_sources_wildcards") << "Duplicate source file '.*duplicate_sources_wildcards.qbs'" ".*duplicate_sources_wildcards.qbs:2:12" ".*duplicate_sources_wildcards.qbs:4:16."; QTest::newRow("oldQbsVersion") << "The project requires at least qbs version \\d+\\.\\d+.\\d+, " "but this is qbs version " QBS_VERSION "."; QTest::newRow("wrongQbsVersionFormat") << "The value '.*' of Project.minimumQbsVersion is not a valid version string."; QTest::newRow("properties-item-with-invalid-condition") << "properties-item-with-invalid-condition.qbs:4:19.*" "cannot read property 'includes' of undefined"; QTest::newRow("misused-inherited-property") << "Binding to non-item property"; QTest::newRow("undeclared_property_in_Properties_item") << "Item 'blubb' is not declared"; QTest::newRow("conflicting-properties-in-export-items") << "Export item in inherited item redeclares property 'theProp' with different type."; QTest::newRow("invalid-property-option") << "PropertyOptions item refers to non-existing property 's0meProp'"; QTest::newRow("missing-colon") << "Invalid item 'dummy.cxxFlags'. Did you mean to set a module property?"; QTest::newRow("syntax-error-in-probe") << "syntax-error-in-probe.qbs:4:20.*fngkgsdjfgklkf is not defined"; QTest::newRow("wrong-toplevel-item") << "wrong-toplevel-item.qbs:1:1.*The top-level item must be of type 'Project' or " "'Product', but it is of type 'Artifact'."; QTest::newRow("conflicting-module-instances") << "There is more than one equally prioritized candidate for module " "'conflicting-instances'."; QTest::newRow("overwrite-inherited-readonly-property") << "overwrite-inherited-readonly-property.qbs" ":2:21.*Cannot set read-only property 'readOnlyString'."; QTest::newRow("overwrite-readonly-module-property") << "overwrite-readonly-module-property.qbs" ":3:30.*Cannot set read-only property 'readOnlyString'."; QTest::newRow("original-in-product-property") << "original-in-product-property.qbs" ":2:21.*The special value 'original' can only be used with module properties."; QTest::newRow("rule-without-output-tags") << "rule-without-output-tags.qbs:2:5.*A rule needs to have Artifact items or " "a non-empty outputFileTags property."; QTest::newRow("original-in-module-prototype") << "module-with-invalid-original.qbs:2:24.*The special value 'original' cannot be used " "on the right-hand side of a property declaration."; QTest::newRow("original-in-export-item") << "original-in-export-item.qbs:5:32.*The special value 'original' cannot be used " "on the right-hand side of a property declaration."; QTest::newRow("original-in-export-item2") << "original-in-export-item2.qbs:4:9.*Item 'x.y' is not declared. Did you forget " "to add a Depends item"; QTest::newRow("original-in-export-item3") << "original-in-export-item3.qbs:6:9.*Item 'x.y' is not declared. Did you forget " "to add a Depends item"; QTest::newRow("mismatching-multiplex-dependency") << "mismatching-multiplex-dependency.qbs:9:9.*Dependency from product " "'b \\{\"architecture\":\"mips\"\\}' to product 'a'" " not fulfilled. There are no eligible multiplex candidates."; QTest::newRow("ambiguous-multiplex-dependency") << "ambiguous-multiplex-dependency.qbs:10:9.*Dependency from product 'b " "\\{\"architecture\":\"x86\"\\}' to product 'a' is ambiguous. Eligible multiplex " "candidates: a \\{\"architecture\":\"x86\",\"buildVariant\":\"debug\"\\}, " "a \\{\"architecture\":\"x86\",\"buildVariant\":\"release\"\\}."; QTest::newRow("dependency-profile-mismatch") << "dependency-profile-mismatch.qbs:10:5.*Product 'main' depends on 'dep', " "which does not exist for the requested profile 'profile47'."; QTest::newRow("dependency-profile-mismatch-2") << "dependency-profile-mismatch-2.qbs:15:9 Dependency from product 'main' to " "product 'dep' not fulfilled. There are no eligible multiplex candidates."; QTest::newRow("invalid-references") << "invalid-references.qbs:2:17.*Cannot open '.*nosuchproject.qbs'"; QTest::newRow("missing-js-file") << "missing-js-file.qbs.*Cannot open '.*javascriptfile.js'.*missing-js-file.js:1"; QTest::newRow("frozen-object") << "'key' is read-only"; QTest::newRow("frozen-object-list") << "object is not extensible"; QTest::newRow("module-property-binding-in-project") << "Module properties cannot be set in Project items"; QTest::newRow("module-with-id") << "Module items cannot have an id property"; QTest::newRow("module-var-in-product") << "module-var-in-product.qbs:4:19 Use of 'module' is only allowed in Module items"; QTest::newRow("recursive-property-direct") << "refers to itself"; QTest::newRow("recursive-property-indirect") << "refers to itself.*via 'b'.*via 'c'"; QTest::newRow("recursive-property-indirect-via-module") << "refers to itself.*via 'a'"; } void TestLanguage::erroneousFiles() { QFETCH(QString, errorMessage); QString fileName = QString::fromLocal8Bit(QTest::currentDataTag()) + QLatin1String(".qbs"); try { resolveProject(qPrintable("/erroneous/" + fileName)); } catch (const ErrorInfo &e) { const QRegularExpression reg(errorMessage, QRegularExpression::DotMatchesEverythingOption); if (!e.toString().contains(reg)) { qDebug() << "Message: " << e.toString(); qDebug() << "Expected: " << errorMessage; QFAIL("Unexpected error message."); } return; } QEXPECT_FAIL("undeclared_property_in_Properties_item", "Too expensive to check", Continue); QEXPECT_FAIL("original-in-export-item3", "Too expensive to check", Continue); QVERIFY(!"No error thrown on invalid input."); } void TestLanguage::exports() { bool exceptionCaught = false; try { defaultParameters.setDeprecationWarningMode(DeprecationWarningMode::On); resolveProject("exports.qbs"); QVERIFY(!!project); Set warningLocations; QHash products = productsFromProject(project); QCOMPARE(products.size(), 22); ResolvedProductPtr product; product = products.value("myapp"); QVERIFY(!!product); QStringList propertyName = QStringList() << "dummy" << "defines"; QVariant propertyValue = product->moduleProperties->property(propertyName); QCOMPARE(propertyValue.toStringList(), QStringList() << "BUILD_MYAPP" << "USE_MYLIB" << "USE_MYLIB2"); propertyName = QStringList() << "dummy" << "includePaths"; QVariantList propertyValues = product->moduleProperties->property(propertyName).toList(); QCOMPARE(propertyValues.size(), 3); QVERIFY(propertyValues.at(0).toString().endsWith("/app")); QVERIFY(propertyValues.at(1).toString().endsWith("/testdata/lib")); QVERIFY(propertyValues.at(2).toString().endsWith("/testdata/lib")); QCOMPARE(product->moduleProperties->moduleProperty("dummy", "productName").toString(), QString("myapp")); QVERIFY(product->moduleProperties->moduleProperty("dummy", "somePath").toString() .endsWith("/subdir")); product = products.value("mylib"); QVERIFY(!!product); propertyName = QStringList() << "dummy" << "defines"; propertyValue = product->moduleProperties->property(propertyName); QCOMPARE(propertyValue.toStringList(), QStringList() << "BUILD_MYLIB"); QVERIFY(product->moduleProperties->moduleProperty("dummy", "somePath").toString() .endsWith("/subdir")); product = products.value("mylib2"); QVERIFY(!!product); propertyName = QStringList() << "dummy" << "defines"; propertyValue = product->moduleProperties->property(propertyName); QCOMPARE(propertyValue.toStringList(), QStringList() << "BUILD_MYLIB2"); product = products.value("A"); QVERIFY(!!product); QVERIFY(contains(product->dependencies, ProductDependency{products.value("B"), false})); QVERIFY(contains(product->dependencies, ProductDependency{products.value("C"), false})); QVERIFY(contains(product->dependencies, ProductDependency{products.value("D"), false})); product = products.value("B"); QVERIFY(!!product); QVERIFY(product->dependencies.empty()); QCOMPARE(product->exportedModule.productDependencies, std::vector{"C"}); product = products.value("C"); QVERIFY(!!product); QVERIFY(product->dependencies.empty()); product = products.value("D"); QVERIFY(!!product); QVERIFY(product->dependencies.empty()); product = products.value("myapp2"); QVERIFY(!!product); propertyName = QStringList() << "dummy" << "cFlags"; propertyValue = product->moduleProperties->property(propertyName); QCOMPARE(propertyValue.toStringList(), QStringList() << "BASE_PRODUCTWITHINHERITEDEXPORTITEM" << "PRODUCT_PRODUCTWITHINHERITEDEXPORTITEM"); propertyName = QStringList() << "dummy" << "cxxFlags"; propertyValue = product->moduleProperties->property(propertyName); QCOMPARE(propertyValue.toStringList(), QStringList() << "-bar"); propertyName = QStringList() << "dummy" << "defines"; propertyValue = product->moduleProperties->property(propertyName); QCOMPARE(propertyValue.toStringList(), QStringList({"ABC", "DEF"})); QCOMPARE(product->moduleProperties->moduleProperty("dummy", "productName").toString(), QString("myapp2")); QCOMPARE(product->moduleProperties->moduleProperty("dummy", "upperCaseProductName").toString(), QString("MYAPP2")); // Check whether we're returning incorrect cached values. product = products.value("myapp3"); QVERIFY(!!product); QCOMPARE(product->moduleProperties->moduleProperty("dummy", "productName").toString(), QString("myapp3")); QCOMPARE(product->moduleProperties->moduleProperty("dummy", "upperCaseProductName").toString(), QString("MYAPP3")); // Verify we refer to the right "project" variable. product = products.value("sub p2"); QVERIFY(!!product); QCOMPARE(product->moduleProperties->moduleProperty("dummy", "someString").toString(), QString("sub1")); product = products.value("libE"); QVERIFY(!!product); propertyName = QStringList() << "dummy" << "defines"; propertyValue = product->moduleProperties->property(propertyName); QCOMPARE(propertyValue.toStringList(), QStringList() << "LIBD" << "LIBC" << "LIBA" << "LIBB"); propertyName = QStringList() << "dummy" << "productName"; propertyValue = product->moduleProperties->property(propertyName); QCOMPARE(propertyValue.toString(), QString("libE")); product = products.value("depender"); QVERIFY(!!product); QCOMPARE(product->modules.size(), size_t(2)); for (const ResolvedModulePtr &m : product->modules) { QVERIFY2(m->name == QString("qbs") || m->name == QString("dependency"), qPrintable(m->name)); } QCOMPARE(product->productProperties.value("featureX").toBool(), true); QCOMPARE(product->productProperties.value("featureY").toBool(), false); QCOMPARE(product->productProperties.value("featureZ").toBool(), true); product = products.value("broken_cycle3"); QVERIFY(!!product); QCOMPARE(product->modules.size(), size_t(3)); for (const ResolvedModulePtr &m : product->modules) { QVERIFY2(m->name == QString("qbs") || m->name == QString("broken_cycle1") || m->name == QString("broken_cycle2"), qPrintable(m->name)); } } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::fileContextProperties() { bool exceptionCaught = false; try { resolveProject("filecontextproperties.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); ResolvedProductPtr product = products.value("product1"); QVERIFY(!!product); QVariantMap cfg = product->productProperties; QCOMPARE(cfg.value("narf").toString(), defaultParameters.projectFilePath()); QString dirPath = QFileInfo(defaultParameters.projectFilePath()).absolutePath(); QCOMPARE(cfg.value("zort").toString(), dirPath); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::fileInProductAndModule_data() { QTest::addColumn("file1IsTarget"); QTest::addColumn("file2IsTarget"); QTest::addColumn("addFileToProduct"); QTest::addColumn("successExpected"); QTest::newRow("file occurs twice in module as non-target") << false << false << false << false; QTest::newRow("file occurs twice in module as non-target, and in product as well") << false << false << true << false; QTest::newRow("file occurs in module as non-target and target") << false << true << false << true; QTest::newRow("file occurs in module as non-target and target, and in product as well") << false << true << true << false; QTest::newRow("file occurs in module as target and non-target") << true << false << false << true; QTest::newRow("file occurs in module as target and non-target, and in product as well") << true << false << true << false; QTest::newRow("file occurs twice in module as target") << true << true << false << false; QTest::newRow("file occurs twice in module as target, and in product as well") << true << true << true << false; } void TestLanguage::fileInProductAndModule() { bool exceptionCaught = false; QFETCH(bool, file1IsTarget); QFETCH(bool, file2IsTarget); QFETCH(bool, addFileToProduct); QFETCH(bool, successExpected); try { defaultParameters.setOverriddenValues(QVariantMap{ std::make_pair("modules.module_with_file.file1IsTarget", file1IsTarget), std::make_pair("modules.module_with_file.file2IsTarget", file2IsTarget), std::make_pair("products.p.addFileToProduct", addFileToProduct), }); resolveProject("file-in-product-and-module.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 1); } catch (const ErrorInfo &e) { exceptionCaught = true; QVERIFY2(e.toString().contains("Duplicate"), qPrintable(e.toString())); } QCOMPARE(exceptionCaught, !successExpected); } void TestLanguage::getNativeSetting() { bool exceptionCaught = false; try { resolveProject("getNativeSetting.qbs"); QString expectedTargetName; if (HostOsInfo::isMacosHost()) { if (HostOsInfo::hostOsVersion() >= qbs::Version(11)) expectedTargetName = QStringLiteral("macOS"); else expectedTargetName = QStringLiteral("Mac OS X"); } else if (HostOsInfo::isWindowsHost()) { expectedTargetName = QStringLiteral("Windows"); } else { expectedTargetName = QStringLiteral("Unix"); } QVERIFY(!!project); QHash products; for (const ResolvedProductPtr &product : project->allProducts()) products.insert(product->targetName, product); ResolvedProductPtr product = products.value(expectedTargetName); QVERIFY(!!product); ResolvedProductPtr product2 = products.value(QStringLiteral("fallback")); QVERIFY(!!product2); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::groupConditions_data() { QTest::addColumn("groupCount"); QTest::addColumn>("groupEnabled"); QTest::newRow("init") << size_t(0) << std::vector(); QTest::newRow("no_condition_no_group") << size_t(1) << std::vector{ true }; QTest::newRow("no_condition") << size_t(2) << std::vector{ true, true }; QTest::newRow("true_condition") << size_t(2) << std::vector{ true, true }; QTest::newRow("false_condition") << size_t(2) << std::vector{ true, false }; QTest::newRow("true_condition_from_product") << size_t(2) << std::vector{ true, true }; QTest::newRow("true_condition_from_project") << size_t(2) << std::vector{ true, true }; QTest::newRow("condition_accessing_module_property") << size_t(2) << std::vector{ true, false }; QTest::newRow("cleanup") << size_t(0) << std::vector(); } void TestLanguage::groupConditions() { HANDLE_INIT_CLEANUP_DATATAGS("groupconditions.qbs"); QFETCH(size_t, groupCount); QFETCH(std::vector, groupEnabled); QCOMPARE(groupCount, groupEnabled.size()); const QHash products = productsFromProject(project); const QString productName = QString::fromLocal8Bit(QTest::currentDataTag()); ResolvedProductPtr product = products.value(productName); QVERIFY(!!product); QCOMPARE(product->name, productName); QCOMPARE(product->groups.size(), groupCount); for (size_t i = 0; i < groupCount; ++i) { if (product->groups.at(i)->enabled != groupEnabled.at(i)) { QFAIL(qPrintable( QString("groups.at(%1)->enabled != %2").arg(i).arg(bool(groupEnabled.at(i))))); } } } void TestLanguage::groupName() { bool exceptionCaught = false; try { resolveProject("groupname.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 2); ResolvedProductPtr product = products.value("MyProduct"); QVERIFY(!!product); QCOMPARE(product->groups.size(), size_t(2)); GroupConstPtr group = product->groups.at(0); QVERIFY(!!group); QCOMPARE(group->name, QString("MyProduct")); group = product->groups.at(1); QVERIFY(!!group); QCOMPARE(group->name, QString("MyProduct.MyGroup")); product = products.value("My2ndProduct"); QVERIFY(!!product); QCOMPARE(product->groups.size(), size_t(3)); group = product->groups.at(0); QVERIFY(!!group); QCOMPARE(group->name, QString("My2ndProduct")); group = product->groups.at(1); QVERIFY(!!group); QCOMPARE(group->name, QString("My2ndProduct.MyGroup")); group = product->groups.at(2); QVERIFY(!!group); QCOMPARE(group->name, QString("Group 2")); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::homeDirectory() { try { resolveProject("homeDirectory.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 1); ResolvedProductPtr product = products.value("home"); QVERIFY(!!product); QDir dir = QDir::home(); QCOMPARE(product->productProperties.value("home").toString(), dir.path()); QCOMPARE(product->productProperties.value("homeSlash").toString(), dir.path()); dir.cdUp(); QCOMPARE(product->productProperties.value("homeUp").toString(), dir.path()); dir = QDir::home(); QCOMPARE(product->productProperties.value("homeFile").toString(), dir.filePath("a")); QCOMPARE(product->productProperties.value("bogus1").toString(), FileInfo::resolvePath(product->sourceDirectory, QStringLiteral("a~b"))); QCOMPARE(product->productProperties.value("bogus2").toString(), FileInfo::resolvePath(product->sourceDirectory, QStringLiteral("a/~/bb"))); QCOMPARE(product->productProperties.value("user").toString(), FileInfo::resolvePath(product->sourceDirectory, QStringLiteral("~foo/bar"))); } catch (const ErrorInfo &e) { qDebug() << e.toString(); } } void TestLanguage::identifierSearch_data() { QTest::addColumn("expectedHasNarf"); QTest::addColumn("expectedHasZort"); QTest::addColumn("sourceCode"); QTest::newRow("no narf, no zort") << false << false << QString( "Product {\n" " name: {\n" " var foo = 'bar';\n" " console.info(foo);\n" " return foo;\n" " }\n" "}\n"); QTest::newRow("narf, no zort") << true << false << QString( "Product {\n" " name: {\n" " var foo = 'zort';\n" " console.info(narf + foo);\n" " return foo;\n" " }\n" "}\n"); QTest::newRow("no narf, zort") << false << true << QString( "Product {\n" " name: {\n" " var foo = 'narf';\n" " console.info(zort + foo);\n" " return foo;\n" " }\n" "}\n"); QTest::newRow("narf, zort") << true << true << QString( "Product {\n" " name: {\n" " var foo = narf;\n" " foo = foo + zort;\n" " return foo;\n" " }\n" "}\n"); QTest::newRow("2 narfs, 1 zort") << true << true << QString( "Product {\n" " name: {\n" " var foo = narf;\n" " foo = narf + foo + zort;\n" " return foo;\n" " }\n" "}\n"); } void TestLanguage::identifierSearch() { QFETCH(bool, expectedHasNarf); QFETCH(bool, expectedHasZort); QFETCH(QString, sourceCode); bool hasNarf = !expectedHasNarf; bool hasZort = !expectedHasZort; IdentifierSearch isearch; isearch.add("narf", &hasNarf); isearch.add("zort", &hasZort); QbsQmlJS::Engine engine; QbsQmlJS::Lexer lexer(&engine); lexer.setCode(sourceCode, 1); QbsQmlJS::Parser parser(&engine); QVERIFY(parser.parse()); QVERIFY(parser.ast()); isearch.start(parser.ast()); QCOMPARE(hasNarf, expectedHasNarf); QCOMPARE(hasZort, expectedHasZort); } void TestLanguage::idUsage() { bool exceptionCaught = false; try { resolveProject("idusage.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 5); QVERIFY(products.contains("product1_1")); QVERIFY(products.contains("product2_2")); QVERIFY(products.contains("product3_3")); ResolvedProductPtr product4 = products.value("product4_4"); QVERIFY(!!product4); auto product4Property = [&product4] (const char *name) { return product4->productProperties.value(QString::fromUtf8(name)).toString(); }; QCOMPARE(product4Property("productName"), product4->name); QCOMPARE(product4Property("productNameInBaseOfBase"), product4->name); GroupPtr group = findByName(product4->groups, "group in base product"); QVERIFY(!!group); QCOMPARE(qPrintable(group->prefix), "group in base product"); group = findByName(product4->groups, "another group in base product"); QVERIFY(!!group); QCOMPARE(qPrintable(group->prefix), "another group in base product"); ResolvedProductPtr product5 = products.value("product5"); QVERIFY(!!product5); QCOMPARE(product5->moduleProperties->moduleProperty("deepdummy.deep.moat", "zort") .toString(), QString("zort in dummy")); QCOMPARE(int(product5->allEnabledFiles().size()), 1); QVERIFY(product5->allEnabledFiles().at(0)->absoluteFilePath.endsWith("dummy.txt")); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QVERIFY(!exceptionCaught); } void TestLanguage::idUniqueness() { bool exceptionCaught = false; try { resolveProject("id-uniqueness.qbs"); } catch (const ErrorInfo &e) { exceptionCaught = true; const QList items = e.items(); QCOMPARE(items.size(), 3); QCOMPARE(items.at(0).toString(), QString::fromUtf8("The id 'baseProduct' is not unique.")); QVERIFY(items.at(1).toString().contains("id-uniqueness.qbs:5:5 First occurrence is here.")); QVERIFY(items.at(2).toString().contains("id-uniqueness.qbs:8:5 Next occurrence is here.")); } QVERIFY(exceptionCaught); } void TestLanguage::importCollection() { bool exceptionCaught = false; try { resolveProject("import-collection/project.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); const ResolvedProductConstPtr product = products.value("da product"); QCOMPARE(product->productProperties.value("targetName").toString(), QLatin1String("C1f1C1f2C2f1C2f2")); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QVERIFY(!exceptionCaught); } void TestLanguage::inheritedPropertiesItems_data() { QTest::addColumn("buildVariant"); QTest::addColumn("productName"); QTest::newRow("debug build") << "debug" << "product_debug"; QTest::newRow("release build") << "release" << "product_release"; } void TestLanguage::inheritedPropertiesItems() { bool exceptionCaught = false; try { QFETCH(QString, buildVariant); QFETCH(QString, productName); defaultParameters.setOverriddenValues(QVariantMap{std::make_pair("qbs.buildVariant", buildVariant)}); resolveProject("inherited-properties-items/inherited-properties-items.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 1); QVERIFY(!!products.value(productName)); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QVERIFY(!exceptionCaught); } void TestLanguage::invalidBindingInDisabledItem() { bool exceptionCaught = false; try { resolveProject("invalidBindingInDisabledItem.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 2); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QVERIFY(!exceptionCaught); } void TestLanguage::invalidOverrides() { QFETCH(QString, key); QFETCH(QString, expectedErrorMessage); const bool successExpected = expectedErrorMessage.isEmpty(); bool exceptionCaught = false; try { defaultParameters.setOverriddenValues(QVariantMap{std::make_pair(key, true)}); resolveProject("invalid-overrides.qbs"); QVERIFY(!!project); } catch (const ErrorInfo &e) { exceptionCaught = true; if (successExpected) qDebug() << e.toString(); else QVERIFY2(e.toString().contains(expectedErrorMessage), qPrintable(e.toString())); } QEXPECT_FAIL("no such module in product", "not easily checkable", Continue); QCOMPARE(!exceptionCaught, successExpected); } void TestLanguage::invalidOverrides_data() { QTest::addColumn("key"); QTest::addColumn("expectedErrorMessage"); QTest::newRow("no such project") << "projects.myproject.x" << QString("Unknown project 'myproject' in property override."); QTest::newRow("no such project property") << "projects.My.Project.y" << QString("Unknown property: projects.My.Project.y"); QTest::newRow("valid project property override") << "projects.My.Project.x" << QString(); QTest::newRow("no such product") << "products.myproduct.x" << QString("Unknown product 'myproduct' in property override."); QTest::newRow("no such product (with module)") << "products.myproduct.cpp.useRPaths" << QString("Unknown product 'myproduct' in property override."); QTest::newRow("no such product property") << "products.MyProduct.y" << QString("Unknown property: products.MyProduct.y"); QTest::newRow("valid product property override") << "products.MyProduct.x" << QString(); // This cannot be an error, because the semantics are "if some product in the project has // such a module, then set that property", and the code that does the property overrides // does not have a global view. QTest::newRow("no such module") << "modules.blubb.x" << QString(); QTest::newRow("no such module in product") << "products.MyProduct.cpp.useRPaths" << QString("Invalid module 'cpp' in property override."); QTest::newRow("no such module property") << "modules.cpp.blubb" << QString("Unknown property: modules.cpp.blubb"); QTest::newRow("no such module property (per product)") << "products.MyOtherProduct.cpp.blubb" << QString("Unknown property: products.MyOtherProduct.cpp.blubb"); QTest::newRow("valid per-product module property override") << "products.MyOtherProduct.cpp.useRPaths" << QString(); } void TestLanguage::invalidPropOnNonRequiredModule_data() { QTest::addColumn("useExistingModule"); QTest::addColumn("errorExpected"); QTest::newRow("existing module") << true << true; QTest::newRow("non-existing module") << false << false; } void TestLanguage::invalidPropOnNonRequiredModule() { QFETCH(bool, useExistingModule); QFETCH(bool, errorExpected); try { defaultParameters.setOverriddenValues( {std::make_pair("project.useExistingModule", useExistingModule)}); resolveProject("invalid-prop-on-non-required-module"); QVERIFY(!errorExpected); } catch (const ErrorInfo &e) { const QString errorString = e.toString(); QVERIFY2(errorExpected, qPrintable(errorString)); QVERIFY2(errorString.contains("Property 'nosuchprop' is not declared"), qPrintable(errorString)); } } void TestLanguage::itemPrototype() { FileContextPtr fileContext = FileContext::create(); fileContext->setFilePath("/dev/null"); JSSourceValueCreator sourceValueCreator(fileContext); ItemPool pool; Item *proto = Item::create(&pool, ItemType::Product); proto->setProperty("x", sourceValueCreator.create("1")); proto->setProperty("y", sourceValueCreator.create("1")); Item *item = Item::create(&pool, ItemType::Product); item->setPrototype(proto); item->setProperty("y", sourceValueCreator.create("x + 1")); item->setProperty("z", sourceValueCreator.create("2")); Evaluator evaluator(m_engine.get()); JSContext * const ctx = m_engine->context(); QCOMPARE(getJsVariant(ctx, evaluator.property(proto, "x")).toInt(), 1); QCOMPARE(getJsVariant(ctx, evaluator.property(proto, "y")).toInt(), 1); QVERIFY(JS_IsUndefined(evaluator.property(proto, "z"))); QCOMPARE(getJsVariant(ctx, evaluator.property(item, "x")).toInt(), 1); QCOMPARE(getJsVariant(ctx, evaluator.property(item, "y")).toInt(), 2); QCOMPARE(getJsVariant(ctx, evaluator.property(item, "z")).toInt(), 2); } void TestLanguage::itemScope() { FileContextPtr fileContext = FileContext::create(); fileContext->setFilePath("/dev/null"); JSSourceValueCreator sourceValueCreator(fileContext); ItemPool pool; Item *scope1 = Item::create(&pool, ItemType::Scope); scope1->setProperty("x", sourceValueCreator.create("1")); Item *scope2 = Item::create(&pool, ItemType::Scope); scope2->setScope(scope1); scope2->setProperty("y", sourceValueCreator.create("x + 1")); Item *item = Item::create(&pool, ItemType::Scope); item->setScope(scope2); item->setProperty("z", sourceValueCreator.create("x + y")); Evaluator evaluator(m_engine.get()); JSContext * const ctx = m_engine->context(); QCOMPARE(getJsVariant(ctx, evaluator.property(scope1, "x")).toInt(), 1); QCOMPARE(getJsVariant(ctx, evaluator.property(scope2, "y")).toInt(), 2); QVERIFY(JS_IsUndefined(evaluator.property(scope2, "x"))); QCOMPARE(getJsVariant(ctx, evaluator.property(item, "z")).toInt(), 3); } void TestLanguage::jsExtensions() { QFile file(testProject("jsextensions.js")); QVERIFY(file.open(QFile::ReadOnly)); QTextStream ts(&file); QString code = ts.readAll(); QVERIFY(!code.isEmpty()); m_engine->evaluate(JsValueOwner::Caller, code, file.fileName(), 1); if (m_engine->checkForJsError({})) { const ErrorInfo ex = m_engine->getAndClearJsError(); QFAIL(qPrintable(ex.toString())); } } void TestLanguage::jsImportUsedInMultipleScopes_data() { QTest::addColumn("buildVariant"); QTest::addColumn("expectedProductName"); QTest::newRow("debug") << QString("debug") << QString("MyProduct_debug"); QTest::newRow("release") << QString("release") << QString("MyProduct"); } void TestLanguage::jsImportUsedInMultipleScopes() { QFETCH(QString, buildVariant); QFETCH(QString, expectedProductName); bool exceptionCaught = false; try { defaultParameters.setOverriddenValues({std::make_pair(QStringLiteral("qbs.buildVariant"), buildVariant)}); resolveProject("jsimportsinmultiplescopes.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 1); ResolvedProductPtr product = products.values().front(); QVERIFY(!!product); QCOMPARE(product->name, expectedProductName); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QVERIFY(!exceptionCaught); } void TestLanguage::keepLoadingDependencies() { QString error; try { resolveProject("keep-loading-dependencies.qbs"); QFAIL("Should not get here!"); } catch (const ErrorInfo &e) { error = e.toString(); } QVERIFY2(error.contains("Dependency 'none.m1' not found"), qPrintable(error)); QVERIFY2(error.contains("Dependency 'none.m2' not found"), qPrintable(error)); QVERIFY2(error.contains("Dependency 'none.m3' not found"), qPrintable(error)); QVERIFY2(!error.contains("QBS_CHECK"), qPrintable(error)); } void TestLanguage::localProfileAsTopLevelProfile() { bool exceptionCaught = false; try { defaultParameters.setTopLevelProfile("test-profile"); resolveProject("local-profile-as-top-level-profile.qbs"); QVERIFY(!!project); QCOMPARE(int(project->products.size()), 1); const PropertyMapConstPtr &props = project->products.front()->moduleProperties; QCOMPARE(props->qbsPropertyValue("architecture"), "arm"); QCOMPARE(props->qbsPropertyValue("targetPlatform"), "macos"); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::moduleMergingVariantValues() { bool exceptionCaught = false; try { resolveProject("module-merging-variant-values/module-merging-variant-values.qbs"); QVERIFY(!!project); QCOMPARE(int(project->products.size()), 2); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::moduleNameCollisions_data() { QTest::addColumn("projectFile"); QTest::addColumn("collisionExpected"); QTest::newRow("simple collision (one order)") << "simple-collision1.qbs" << true; QTest::newRow("simple collision (other order)") << "simple-collision2.qbs" << true; QTest::newRow("collision with more components") << "complex-collision.qbs" << true; QTest::newRow("no collision (same length)") << "no-collision1.qbs" << false; QTest::newRow("no collision (different length)") << "no-collision2.qbs" << false; } void TestLanguage::moduleNameCollisions() { QFETCH(QString, projectFile); QFETCH(bool, collisionExpected); try { const QString compositeProjectFilePath = QString("module-name-collisions/") + projectFile; QVERIFY(resolveProject(qPrintable(compositeProjectFilePath))); QVERIFY(!collisionExpected); } catch (const ErrorInfo &e) { const QString errorString = e.toString(); QVERIFY2(collisionExpected, qPrintable(errorString)); QVERIFY2(errorString.contains("not allowed"), qPrintable(errorString)); } } void TestLanguage::moduleParameters_data() { QTest::addColumn("inputProperties"); QTest::addColumn("expectedModuleParameters"); QTest::addColumn("errorExpected"); QTest::newRow("no overrides") << QVariantMap{ std::make_pair("project.overrideFromModule", "false"), std::make_pair("project.overrideFromExport", "false"), std::make_pair("project.overrideFromProduct", "false")} << QVariantMap{ std::make_pair("higher", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromParameters")})}), std::make_pair("dep", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromParameters")})})} << false; QTest::newRow("override from product") << QVariantMap{ std::make_pair("project.overrideFromModule", "false"), std::make_pair("project.overrideFromExport", "false"), std::make_pair("project.overrideFromProduct", "true")} << QVariantMap{ std::make_pair("higher", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromProductDepends")})}), std::make_pair("dep", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromProductDepends")})})} << false; QTest::newRow("override from export") << QVariantMap{ std::make_pair("project.overrideFromModule", "false"), std::make_pair("project.overrideFromExport", "true"), std::make_pair("project.overrideFromProduct", "false")} << QVariantMap{ std::make_pair("higher", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromExportDepends")})}), std::make_pair("dep", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromParameters")})})} << false; QTest::newRow("override from export and product") << QVariantMap{ std::make_pair("project.overrideFromModule", "false"), std::make_pair("project.overrideFromExport", "true"), std::make_pair("project.overrideFromProduct", "true")} << QVariantMap{ std::make_pair("higher", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromProductDepends")})}), std::make_pair("dep", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromProductDepends")})})} << false; QTest::newRow("override from module") << QVariantMap{ std::make_pair("project.overrideFromModule", "true"), std::make_pair("project.overrideFromExport", "false"), std::make_pair("project.overrideFromProduct", "false")} << QVariantMap{ std::make_pair("higher", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromModuleDepends")})}), std::make_pair("dep", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromParameters")})})} << false; QTest::newRow("override from module and product") << QVariantMap{ std::make_pair("project.overrideFromModule", "true"), std::make_pair("project.overrideFromExport", "false"), std::make_pair("project.overrideFromProduct", "true")} << QVariantMap{ std::make_pair("higher", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromProductDepends")})}), std::make_pair("dep", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromProductDepends")})})} << false; QTest::newRow("override from module and export") << QVariantMap{ std::make_pair("project.overrideFromModule", "true"), std::make_pair("project.overrideFromExport", "true"), std::make_pair("project.overrideFromProduct", "false")} << QVariantMap{ std::make_pair("higher", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromExportDepends")})}), std::make_pair("dep", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromParameters")})})} << true; QTest::newRow("override from module, export and product") << QVariantMap{ std::make_pair("project.overrideFromModule", "true"), std::make_pair("project.overrideFromExport", "true"), std::make_pair("project.overrideFromProduct", "true")} << QVariantMap{ std::make_pair("higher", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromProductDepends")})}), std::make_pair("dep", QVariantMap{std::make_pair("lower", QVariantMap{std::make_pair("param", "fromProductDepends")})})} << false; } void TestLanguage::moduleParameters() { QFETCH(QVariantMap, inputProperties); QFETCH(QVariantMap, expectedModuleParameters); QFETCH(bool, errorExpected); try { defaultParameters.setOverriddenValues(inputProperties); resolveProject("module-parameters/module-parameters.qbs"); QVERIFY(!errorExpected); QVERIFY(project); QCOMPARE(int(project->products.size()), 2); const ResolvedProductPtr mainProduct = productsFromProject(project).value("main"); QVERIFY(mainProduct); QCOMPARE(int(mainProduct->moduleParameters.size()), 2); for (auto it = expectedModuleParameters.cbegin(); it != expectedModuleParameters.cend(); ++it) { const auto findInProduct = [&](const QString &moduleName) { for (auto it = mainProduct->moduleParameters.cbegin(); it != mainProduct->moduleParameters.cend(); ++it) { if (it.key()->name == moduleName) return it.value(); } return QVariantMap(); }; const QVariantMap actual = findInProduct(it.key()); const QVariantMap expected = it.value().toMap(); const bool same = qVariantMapsEqual(actual, expected); if (!same) { qDebug().noquote() << "---" << expected; qDebug().noquote() << "+++" << actual; } QVERIFY(same); } } catch (const ErrorInfo &e) { QVERIFY2(errorExpected, qPrintable(e.toString())); } } void TestLanguage::modulePrioritizationBySearchPath_data() { QTest::addColumn("searchPaths"); QTest::addColumn("expectedVariant"); QTest::newRow("foo has priority") << QStringList{"./foo", "./bar"} << "foo"; QTest::newRow("bar has priority") << QStringList{"./bar", "./foo"} << "bar"; } void TestLanguage::modulePrioritizationBySearchPath() { QFETCH(QStringList, searchPaths); QFETCH(QString, expectedVariant); bool exceptionCaught = false; try { defaultParameters.setOverriddenValues( {std::make_pair(QStringLiteral("project.qbsSearchPaths"), searchPaths)}); resolveProject("module-prioritization-by-search-path/project.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 1); ResolvedProductPtr product = products.values().front(); QVERIFY(!!product); const QString actualVariant = product->moduleProperties->moduleProperty ("conflicting-instances", "moduleVariant").toString(); QCOMPARE(actualVariant, expectedVariant); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QVERIFY(!exceptionCaught); } void TestLanguage::moduleProperties_data() { QTest::addColumn("propertyName"); QTest::addColumn("expectedValue"); QTest::newRow("init") << QString() << QVariant(); QTest::newRow("merge_lists") << "defines" << QVariant(QStringList() << "THE_PRODUCT" << "QT_NETWORK" << "QT_GUI" << "QT_CORE"); QTest::newRow("merge_lists_and_values") << "defines" << QVariant(QStringList() << "THE_PRODUCT" << "QT_NETWORK" << "QT_GUI" << "QT_CORE"); QTest::newRow("merge_lists_with_duplicates") << "cxxFlags" << QVariant(QStringList() << "-foo" << "BAR" << "-foo" << "BAZ"); QTest::newRow("merge_lists_with_prototype_values") << "rpaths" << QVariant(QStringList() << "/opt/qt/lib" << "$ORIGIN"); QTest::newRow("list_property_that_references_product") << "listProp" << QVariant(QStringList() << "x" << "123"); QTest::newRow("list_property_depending_on_overridden_property") << "listProp2" << QVariant(QStringList() << "PRODUCT_STUFF" << "DEFAULT_STUFF" << "EXTRA_STUFF"); QTest::newRow("overridden_list_property") << "listProp" << QVariant(QStringList() << "PRODUCT_STUFF"); QTest::newRow("shadowed-list-property") << "defines" << QVariant(QStringList() << "MyProject" << "shadowed-list-property"); QTest::newRow("shadowed-scalar-property") << "someString" << QVariant(QString("MyProject_shadowed-scalar-property")); QTest::newRow("merged-varlist") << "varListProp" << QVariant(QVariantList() << QVariantMap({std::make_pair("d", "product")}) << QVariantMap({std::make_pair("c", "qtcore")}) << QVariantMap({std::make_pair("a", true), std::make_pair("b", QVariant())})); QTest::newRow("cleanup") << QString() << QVariant(); } void TestLanguage::moduleProperties() { HANDLE_INIT_CLEANUP_DATATAGS("moduleproperties.qbs"); QFETCH(QString, propertyName); QFETCH(QVariant, expectedValue); QHash products = productsFromProject(project); const QString productName = QString::fromLocal8Bit(QTest::currentDataTag()); ResolvedProductPtr product = products.value(productName); QVERIFY(!!product); const QVariant value = product->moduleProperties->moduleProperty("dummy", propertyName); QCOMPARE(value, expectedValue); } void TestLanguage::modulePropertiesInGroups() { defaultParameters.setProjectFilePath(testProject("modulepropertiesingroups.qbs")); bool exceptionCaught = false; try { resolveProject(); QVERIFY(!!project); const QHash products = productsFromProject(project); ResolvedProductPtr product = products.value("grouptest"); QVERIFY(!!product); GroupConstPtr g1; GroupConstPtr g11; GroupConstPtr g12; GroupConstPtr g2; GroupConstPtr g21; GroupConstPtr g211; for (const GroupPtr &g : product->groups) { if (g->name == "g1") g1= g; else if (g->name == "g2") g2 = g; else if (g->name == "g1.1") g11 = g; else if (g->name == "g1.2") g12 = g; else if (g->name == "g2.1") g21 = g; else if (g->name == "g2.1.1") g211 = g; } QVERIFY(!!g1); QVERIFY(!!g2); QVERIFY(!!g11); QVERIFY(!!g12); QVERIFY(!!g21); QVERIFY(!!g211); const QVariantMap productProps = product->moduleProperties->value(); const auto &productGmod1List1 = moduleProperty(productProps, "gmod.gmod1", "gmod1_list1") .toStringList(); QCOMPARE(productGmod1List1, QStringList() << "gmod1_list1_proto" << "gmod1_string_proto"); const auto &productGmod1List2 = moduleProperty(productProps, "gmod.gmod1", "gmod1_list2") .toStringList(); QCOMPARE(productGmod1List2, QStringList() << "grouptest" << "gmod1_string_proto" << "gmod1_list2_proto"); const auto &productGmod1List3 = moduleProperty(productProps, "gmod.gmod1", "gmod1_list3") .toStringList(); QCOMPARE(productGmod1List3, QStringList() << "product" << "gmod1_string_proto"); const int productP0 = moduleProperty(productProps, "gmod.gmod1", "p0").toInt(); QCOMPARE(productP0, 1); const int productDepProp = moduleProperty(productProps, "gmod.gmod1", "depProp").toInt(); QCOMPARE(productDepProp, 0); const auto &productGmod2String = moduleProperty(productProps, "gmod2", "gmod2_string") .toString(); QCOMPARE(productGmod2String, QString("gmod1_string_proto")); const auto &productGmod2List = moduleProperty(productProps, "gmod2", "gmod2_list") .toStringList(); QCOMPARE(productGmod2List, QStringList() << "gmod1_string_proto" << "commonName_in_gmod1" << "gmod4_string_proto_gmod3_string_proto" << "gmod3_string_proto" << "gmod2_list_proto"); const QVariantMap g1Props = g1->properties->value(); const auto &g1Gmod1List1 = moduleProperty(g1Props, "gmod.gmod1", "gmod1_list1") .toStringList(); QCOMPARE(g1Gmod1List1, QStringList() << "gmod1_list1_proto" << "g1"); const auto &g1Gmod1List2 = moduleProperty(g1Props, "gmod.gmod1", "gmod1_list2") .toStringList(); QCOMPARE(g1Gmod1List2, QStringList() << "grouptest" << "gmod1_string_proto" << "gmod1_list2_proto" << "g1"); const auto &g1Gmod1List3 = moduleProperty(g1Props, "gmod.gmod1", "gmod1_list3") .toStringList(); QCOMPARE(g1Gmod1List3, QStringList() << "product" << "g1"); const int g1P0 = moduleProperty(g1Props, "gmod.gmod1", "p0").toInt(); QCOMPARE(g1P0, 3); const int g1DepProp = moduleProperty(g1Props, "gmod.gmod1", "depProp").toInt(); QCOMPARE(g1DepProp, 1); const auto &g1Gmod2String = moduleProperty(g1Props, "gmod2", "gmod2_string").toString(); QCOMPARE(g1Gmod2String, QString("g1")); const auto &g1Gmod2List = moduleProperty(g1Props, "gmod2", "gmod2_list") .toStringList(); QCOMPARE(g1Gmod2List, QStringList() << "g1" << "commonName_in_gmod1" << "g1_gmod4_g1_gmod3" << "g1_gmod3" << "gmod2_list_proto"); const QVariantMap g11Props = g11->properties->value(); const auto &g11Gmod1List1 = moduleProperty(g11Props, "gmod.gmod1", "gmod1_list1") .toStringList(); QCOMPARE(g11Gmod1List1, QStringList() << "gmod1_list1_proto" << "g1.1"); const auto &g11Gmod1List2 = moduleProperty(g11Props, "gmod.gmod1", "gmod1_list2") .toStringList(); QCOMPARE(g11Gmod1List2, QStringList() << "grouptest" << "gmod1_string_proto" << "gmod1_list2_proto" << "g1" << "g1.1"); const auto &g11Gmod1List3 = moduleProperty(g11Props, "gmod.gmod1", "gmod1_list3") .toStringList(); QCOMPARE(g11Gmod1List3, QStringList() << "product" << "g1.1"); const int g11P0 = moduleProperty(g11Props, "gmod.gmod1", "p0").toInt(); QCOMPARE(g11P0, 5); const int g11DepProp = moduleProperty(g11Props, "gmod.gmod1", "depProp").toInt(); QCOMPARE(g11DepProp, 2); const auto &g11Gmod2String = moduleProperty(g11Props, "gmod2", "gmod2_string").toString(); QCOMPARE(g11Gmod2String, QString("g1.1")); const auto &g11Gmod2List = moduleProperty(g11Props, "gmod2", "gmod2_list") .toStringList(); QCOMPARE(g11Gmod2List, QStringList() << "g1.1" << "commonName_in_gmod1" << "g1.1_gmod4_g1.1_gmod3" << "g1.1_gmod3" << "gmod2_list_proto"); const QVariantMap g12Props = g12->properties->value(); const auto &g12Gmod1List1 = moduleProperty(g12Props, "gmod.gmod1", "gmod1_list1") .toStringList(); QCOMPARE(g12Gmod1List1, QStringList() << "gmod1_list1_proto" << "g1.2"); const auto &g12Gmod1List2 = moduleProperty(g12Props, "gmod.gmod1", "gmod1_list2") .toStringList(); QCOMPARE(g12Gmod1List2, QStringList() << "grouptest" << "gmod1_string_proto" << "gmod1_list2_proto" << "g1" << "g1.2"); const auto &g12Gmod1List3 = moduleProperty(g12Props, "gmod.gmod1", "gmod1_list3") .toStringList(); QCOMPARE(g12Gmod1List3, QStringList() << "product" << "g1.2"); const int g12P0 = moduleProperty(g12Props, "gmod.gmod1", "p0").toInt(); QCOMPARE(g12P0, 9); const int g12DepProp = moduleProperty(g12Props, "gmod.gmod1", "depProp").toInt(); QCOMPARE(g12DepProp, 1); const auto &g12Gmod2String = moduleProperty(g12Props, "gmod2", "gmod2_string").toString(); QCOMPARE(g12Gmod2String, QString("g1.2")); const auto &g12Gmod2List = moduleProperty(g12Props, "gmod2", "gmod2_list") .toStringList(); QCOMPARE(g12Gmod2List, QStringList() << "g1.2" << "commonName_in_gmod1" << "g1_gmod4_g1.2_gmod3" << "g1.2_gmod3" << "gmod2_list_proto"); const QVariantMap g2Props = g2->properties->value(); const auto &g2Gmod1List1 = moduleProperty(g2Props, "gmod.gmod1", "gmod1_list1") .toStringList(); QCOMPARE(g2Gmod1List1, QStringList() << "gmod1_list1_proto" << "g2"); const auto &g2Gmod1List2 = moduleProperty(g2Props, "gmod.gmod1", "gmod1_list2") .toStringList(); QCOMPARE(g2Gmod1List2, QStringList() << "grouptest" << "gmod1_string_proto" << "gmod1_list2_proto"); const int g2P0 = moduleProperty(g2Props, "gmod.gmod1", "p0").toInt(); QCOMPARE(g2P0, 6); const int g2DepProp = moduleProperty(g2Props, "gmod.gmod1", "depProp").toInt(); QCOMPARE(g2DepProp, 2); const auto &g2Gmod2String = moduleProperty(g2Props, "gmod2", "gmod2_string").toString(); QCOMPARE(g2Gmod2String, QString("g2")); const auto &g2Gmod2List = moduleProperty(g2Props, "gmod2", "gmod2_list") .toStringList(); QCOMPARE(g2Gmod2List, QStringList() << "g2" << "commonName_in_gmod1" << "g2_gmod4_g2_gmod3" << "g2_gmod3" << "gmod2_list_proto"); const QVariantMap g21Props = g21->properties->value(); const auto &g21Gmod1List1 = moduleProperty(g21Props, "gmod.gmod1", "gmod1_list1") .toStringList(); QCOMPARE(g21Gmod1List1, QStringList() << "gmod1_list1_proto" << "g2"); const auto &g21Gmod1List2 = moduleProperty(g21Props, "gmod.gmod1", "gmod1_list2") .toStringList(); QEXPECT_FAIL(nullptr, "no re-eval when no module props set", Continue); QCOMPARE(g21Gmod1List2, QStringList() << "grouptest" << "g2.1" << "gmod1_list2_proto"); const int g21P0 = moduleProperty(g21Props, "gmod.gmod1", "p0").toInt(); QCOMPARE(g21P0, 6); const int g21DepProp = moduleProperty(g21Props, "gmod.gmod1", "depProp").toInt(); QCOMPARE(g21DepProp, 2); const auto &g21Gmod2String = moduleProperty(g21Props, "gmod2", "gmod2_string").toString(); QCOMPARE(g21Gmod2String, QString("g2")); const auto &g21Gmod2List = moduleProperty(g21Props, "gmod2", "gmod2_list") .toStringList(); QEXPECT_FAIL(nullptr, "no re-eval when no module props set", Continue); QCOMPARE(g21Gmod2List, QStringList() << "g2" << "commonName_in_gmod1" << "g2.1_gmod4_g2.1_gmod3" << "g2.1_gmod3" << "gmod2_list_proto"); const QVariantMap g211Props = g211->properties->value(); const auto &g211Gmod1List1 = moduleProperty(g211Props, "gmod.gmod1", "gmod1_list1") .toStringList(); QCOMPARE(g211Gmod1List1, QStringList() << "gmod1_list1_proto" << "g2"); const auto &g211Gmod1List2 = moduleProperty(g211Props, "gmod.gmod1", "gmod1_list2") .toStringList(); QCOMPARE(g211Gmod1List2, QStringList() << "g2.1.1"); const int g211P0 = moduleProperty(g211Props, "gmod.gmod1", "p0").toInt(); QCOMPARE(g211P0, 17); const int g211DepProp = moduleProperty(g211Props, "gmod.gmod1", "depProp").toInt(); QCOMPARE(g211DepProp, 2); const auto &g211Gmod2String = moduleProperty(g211Props, "gmod2", "gmod2_string").toString(); QEXPECT_FAIL(nullptr, "re-eval not triggered", Continue); QCOMPARE(g211Gmod2String, QString("g2.1.1")); const auto &g211Gmod2List = moduleProperty(g211Props, "gmod2", "gmod2_list") .toStringList(); QEXPECT_FAIL(nullptr, "re-eval not triggered", Continue); QCOMPARE(g211Gmod2List, QStringList() << "g2.1.1" << "commonName_in_gmod1" << "g2.1.1_gmod4_g2.1.1_gmod3" << "g2.1.1_gmod3" << "gmod2_list_proto"); product = products.value("grouptest2"); QVERIFY(!!product); g1.reset(); g11.reset(); for (const GroupPtr &g : product->groups) { if (g->name == "g1") g1= g; else if (g->name == "g1.1") g11 = g; } QVERIFY(!!g1); QVERIFY(!!g11); QCOMPARE(moduleProperty(g1->properties->value(), "gmod.gmod1", "gmod1_list2") .toStringList(), QStringList({"G1"})); QCOMPARE(moduleProperty(g11->properties->value(), "gmod.gmod1", "gmod1_list2") .toStringList(), moduleProperty(g1->properties->value(), "gmod.gmod1", "gmod1_list2") .toStringList()); QCOMPARE(moduleProperty(g11->properties->value(), "gmod.gmod1", "gmod1_string").toString(), QString("G1.1")); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::modulePropertyOverridesPerProduct() { bool exceptionCaught = false; try { defaultParameters.setOverriddenValues({ std::make_pair("modules.dummy.rpaths", QStringList({"/usr/lib"})), std::make_pair("modules.dummy.someString", "m"), std::make_pair("products.b.dummy.someString", "b"), std::make_pair("products.c.dummy.someString", "c"), std::make_pair("products.c.dummy.rpaths", QStringList({"/home", "/tmp"})) }); resolveProject("module-property-overrides-per-product.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 3); const ResolvedProductConstPtr a = products.value("a"); QVERIFY(!!a); const ResolvedProductConstPtr b = products.value("b"); QVERIFY(!!b); const ResolvedProductConstPtr c = products.value("c"); QVERIFY(!!c); const auto stringPropertyValue = [](const ResolvedProductConstPtr &p) -> QString { return p->moduleProperties->moduleProperty("dummy", "someString").toString(); }; const auto listPropertyValue = [](const ResolvedProductConstPtr &p) -> QStringList { return p->moduleProperties->moduleProperty("dummy", "rpaths").toStringList(); }; const auto productPropertyValue = [](const ResolvedProductConstPtr &p) -> QStringList { return p->productProperties.value("rpaths").toStringList(); }; QCOMPARE(stringPropertyValue(a), QString("m")); QCOMPARE(stringPropertyValue(b), QString("b")); QCOMPARE(stringPropertyValue(c), QString("c")); QCOMPARE(listPropertyValue(a), QStringList({"/usr/lib"})); QCOMPARE(listPropertyValue(b), QStringList({"/usr/lib"})); QCOMPARE(listPropertyValue(c), QStringList({"/home", "/tmp"})); QCOMPARE(listPropertyValue(a), productPropertyValue(a)); QCOMPARE(listPropertyValue(b), productPropertyValue(b)); QCOMPARE(listPropertyValue(c), productPropertyValue(c)); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::moduleScope() { bool exceptionCaught = false; try { defaultParameters.setProjectFilePath(testProject("modulescope.qbs")); resolveProject(); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 1); ResolvedProductPtr product = products.value("product1"); QVERIFY(!!product); auto intModuleValue = [product] (const QString &name) -> int { return product->moduleProperties->moduleProperty("scopemod", name).toInt(); }; QCOMPARE(intModuleValue("a"), 2); // overridden in module instance QCOMPARE(intModuleValue("b"), 1); // genuine QCOMPARE(intModuleValue("c"), 3); // genuine, dependent on overridden value QCOMPARE(intModuleValue("d"), 2); // genuine, dependent on genuine value QCOMPARE(intModuleValue("e"), 1); // genuine QCOMPARE(intModuleValue("f"), 2); // overridden QCOMPARE(intModuleValue("g"), 156); // overridden, dependent on product properties QCOMPARE(intModuleValue("h"), 158); // overridden, base dependent on product properties } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::moduleWithProductDependency() { bool exceptionCaught = false; try { defaultParameters.setProjectFilePath(testProject("module-depends-on-product.qbs")); resolveProject(); QVERIFY(project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 2); ResolvedProductPtr product = products.value("p1"); QVERIFY(product); QCOMPARE(int(product->dependencies.size()), 1); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::modules_data() { QTest::addColumn("expectedModulesInProduct"); QTest::addColumn("expectedProductProperty"); QTest::newRow("init") << QStringList(); QTest::newRow("no_modules") << (QStringList() << "qbs") << QString(); QTest::newRow("qt_core") << (QStringList() << "qbs" << "dummy" << "dummyqt.core") << QString("1.2.3"); QTest::newRow("qt_gui") << (QStringList() << "qbs" << "dummy" << "dummyqt.core" << "dummyqt.gui") << QString("guiProperty"); QTest::newRow("qt_gui_network") << (QStringList() << "qbs" << "dummy" << "dummyqt.core" << "dummyqt.gui" << "dummyqt.network") << QString("guiProperty,networkProperty"); QTest::newRow("deep_module_name") << (QStringList() << "qbs" << "deepdummy.deep.moat" << "dummy") << QString("abysmal"); QTest::newRow("deep_module_name_submodule_syntax1") << (QStringList() << "qbs" << "deepdummy.deep.moat" << "dummy") << QString("abysmal"); QTest::newRow("deep_module_name_submodule_syntax2") << (QStringList() << "qbs" << "deepdummy.deep.moat" << "dummy") << QString("abysmal"); QTest::newRow("dummy_twice") << (QStringList() << "qbs" << "dummy") << QString(); QTest::newRow("cleanup") << QStringList(); } void TestLanguage::modules() { HANDLE_INIT_CLEANUP_DATATAGS("modules.qbs"); QFETCH(QStringList, expectedModulesInProduct); QFETCH(QString, expectedProductProperty); QHash products = productsFromProject(project); const QString productName = QString::fromLocal8Bit(QTest::currentDataTag()); const ResolvedProductPtr product = products.value(productName); QVERIFY(!!product); QCOMPARE(product->name, productName); QStringList modulesInProduct; for (ResolvedModuleConstPtr m : product->modules) modulesInProduct += m->name; modulesInProduct.sort(); expectedModulesInProduct.sort(); QCOMPARE(modulesInProduct, expectedModulesInProduct); QCOMPARE(product->productProperties.value("foo").toString(), expectedProductProperty); } void TestLanguage::multipleModuleBackendsViaOwnProperty_data() { QTest::addColumn("type"); QTest::addColumn("expectedValue"); QTest::newRow("default") << QString() << QString("value1"); QTest::newRow("no-op override") << QString("type1") << QString("value1"); QTest::newRow("actual override") << QString("type2") << QString("value2"); } void TestLanguage::multipleModuleBackendsViaOwnProperty() { QFETCH(QString, type); QFETCH(QString, expectedValue); bool exceptionCaught = false; try { if (!type.isEmpty()) { defaultParameters.setOverriddenValues( {{"modules.multiple_backends_via_own_property.type", type}}); } resolveProject("multiple-module-backends-via-own-property.qbs"); QVERIFY(!!project); const auto products = project->allProducts(); QCOMPARE(products.size(), size_t(1)); QCOMPARE( products.front() ->moduleProperties->moduleProperty("multiple_backends_via_own_property", "value") .toString(), expectedValue); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::multiplexedExports() { bool exceptionCaught = false; try { resolveProject("multiplexed-exports.qbs"); QVERIFY(!!project); const auto products = project->allProducts(); QCOMPARE(products.size(), size_t(4)); std::set pVariants; for (const auto &product : products) { if (product->name != "p") continue; static const auto buildVariant = [](const ResolvedProductConstPtr &p) { return p->moduleProperties->qbsPropertyValue("buildVariant").toString(); }; static const auto cppIncludePaths = [](const ResolvedProductConstPtr &p) { return p->moduleProperties->moduleProperty("cpp", "includePaths").toStringList(); }; if (buildVariant(product) == "debug") { pVariants.insert(product); QCOMPARE(cppIncludePaths(product), QStringList("/d")); } else if (buildVariant(product) == "release") { pVariants.insert(product); QCOMPARE(cppIncludePaths(product), QStringList("/r")); } } QCOMPARE(int(pVariants.size()), 2); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::multiplexingByProfile() { QFETCH(QString, projectFileName); QFETCH(bool, successExpected); try { defaultParameters.setDryRun(true); resolveProject(qPrintable("/multiplexing-by-profile/" + projectFileName)); QVERIFY(successExpected); QVERIFY(!!project); } catch (const ErrorInfo &e) { QVERIFY2(!successExpected, qPrintable(e.toString())); } } void TestLanguage::multiplexingByProfile_data() { QTest::addColumn("projectFileName"); QTest::addColumn("successExpected"); QTest::newRow("same profile") << "p1.qbs" << true; QTest::newRow("dependency on non-multiplexed") << "p2.qbs" << true; QTest::newRow("dependency by non-multiplexed") << "p3.qbs" << false; QTest::newRow("dependency by non-multiplexed with Depends.profile") << "p4.qbs" << true; } void TestLanguage::nonApplicableModulePropertyInProfile() { QFETCH(QString, targetOS); QFETCH(QString, toolchain); QFETCH(bool, successExpected); try { defaultParameters.setOverriddenValues({std::make_pair("project.targetOS", targetOS), std::make_pair("project.toolchain", toolchain)}); resolveProject("non-applicable-module-property-in-profile.qbs"); QVERIFY(!!project); QVERIFY(successExpected); } catch (const ErrorInfo &e) { QVERIFY2(!successExpected, qPrintable(e.toString())); QVERIFY2(e.toString().contains("Loading module 'multiple_backends' for product 'p' failed " "due to invalid values in profile 'theProfile'"), qPrintable(e.toString())); QVERIFY2(e.toString().contains("backend3Prop"), qPrintable(e.toString())); } } void TestLanguage::nonApplicableModulePropertyInProfile_data() { QTest::addColumn("targetOS"); QTest::addColumn("toolchain"); QTest::addColumn("successExpected"); QTest::newRow("no matching property (1)") << "os1" << QString() << false; QTest::newRow("no matching property (2)") << "os2" << QString() << false; // The point here is that there's a second, lower-prioritized candidate with a matching // condition that doesn't have the property. This candidate must not throw an error. QTest::newRow("matching property") << "os2" << "tc" << true; } void TestLanguage::nonRequiredProducts() { bool exceptionCaught = false; try { QFETCH(bool, subProjectEnabled); QFETCH(bool, dependeeEnabled); QVariantMap overriddenValues; if (!subProjectEnabled) overriddenValues.insert("projects.subproject.condition", false); else if (!dependeeEnabled) overriddenValues.insert("products.dependee.condition", false); defaultParameters.setOverriddenValues(overriddenValues); resolveProject("non-required-products.qbs"); QVERIFY(!!project); const auto products = productsFromProject(project); QCOMPARE(products.size(), 4 + !!subProjectEnabled); const ResolvedProductConstPtr dependee = products.value("dependee"); QCOMPARE(subProjectEnabled, !!dependee); if (dependee) QCOMPARE(dependeeEnabled, dependee->enabled); const ResolvedProductConstPtr depender = products.value("depender"); QVERIFY(!!depender); const QStringList defines = depender->moduleProperties->moduleProperty("dummy", "defines") .toStringList(); QCOMPARE(subProjectEnabled && dependeeEnabled, defines.contains("WITH_DEPENDEE")); for (const auto &name : std::vector({ "p3", "p2", "p1"})) { const ResolvedProductConstPtr &product = products.value(name); QVERIFY2(product, name); QVERIFY2(!product->enabled, name); } } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::nonRequiredProducts_data() { QTest::addColumn("subProjectEnabled"); QTest::addColumn("dependeeEnabled"); QTest::newRow("dependee enabled") << true << true; QTest::newRow("dependee disabled") << true << false; QTest::newRow("sub project disabled") << false << true; } void TestLanguage::outerInGroup() { bool exceptionCaught = false; try { defaultParameters.setProjectFilePath(testProject("outerInGroup.qbs")); resolveProject(); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 1); ResolvedProductPtr product = products.value("OuterInGroup"); QVERIFY(!!product); QCOMPARE(product->groups.size(), size_t(3)); GroupPtr group = product->groups.at(0); QVERIFY(!!group); QCOMPARE(group->name, product->name); QVERIFY(group->files); QCOMPARE(group->files->size(), size_t(1)); SourceArtifactConstPtr artifact = group->files->front(); QVariant installDir = artifact->properties->qbsPropertyValue("installDir"); QCOMPARE(installDir.toString(), QString("/somewhere")); group = product->groups.at(2); QVERIFY(!!group); QCOMPARE(group->name, QString("Special Group")); QVERIFY(group->files); QCOMPARE(group->files->size(), size_t(1)); artifact = group->files->front(); installDir = artifact->properties->qbsPropertyValue("installDir"); QCOMPARE(installDir.toString(), QString("/somewhere/else")); const QVariant stringProp = artifact->properties->moduleProperty("dummy", "someString"); QCOMPARE(stringProp.toString(), "s1s2s3"); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::overrideProductPropFromSubProjectItem() { bool exceptionCaught = false; try { resolveProject("override-product-prop-from-subproject-item.qbs"); QVERIFY(!!project); const auto products = project->allProducts(); QCOMPARE(products.size(), size_t(1)); QCOMPARE(products.front()->productProperties.value("theProp").toString(), "overridden"); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::overriddenPropertiesAndPrototypes() { bool exceptionCaught = false; try { QFETCH(QString, osName); QFETCH(QString, backendName); defaultParameters.setOverriddenValues({std::make_pair("modules.qbs.targetPlatform", osName)}); resolveProject("overridden-properties-and-prototypes.qbs"); QVERIFY(!!project); QCOMPARE(project->products.size(), size_t(1)); QCOMPARE(project->products.front()->moduleProperties->moduleProperty( "multiple_backends", "prop").toString(), backendName); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::overriddenPropertiesAndPrototypes_data() { QTest::addColumn("osName"); QTest::addColumn("backendName"); QTest::newRow("first backend") << "os1" << "backend 1"; QTest::newRow("second backend") << "os2" << "backend 2"; } void TestLanguage::overriddenVariantProperty() { bool exceptionCaught = false; try { const QVariantMap objectValue{std::make_pair("x", 1), std::make_pair("y", 2)}; defaultParameters.setOverriddenValues({std::make_pair("products.p.myObject", objectValue)}); resolveProject("overridden-variant-property.qbs"); QVERIFY(!!project); QCOMPARE(project->products.size(), size_t(1)); QCOMPARE(project->products.front()->productProperties.value("myObject").toMap(), objectValue); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::parameterTypes() { bool exceptionCaught = false; try { defaultParameters.setProjectFilePath(testProject("parameter-types.qbs")); resolveProject(); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::projectPropertyForwarding() { bool exceptionCaught = false; try { defaultParameters.setProjectFilePath(testProject("project-property-forwarding.qbs")); resolveProject(); QVERIFY(project); QCOMPARE(project->projectProperties().value("prop").toString(), "parent"); QCOMPARE(int(project->subProjects.size()), 1); QCOMPARE( project->subProjects.front()->projectProperties().value("prop").toString(), "parent2"); QCOMPARE(int(project->subProjects.front()->subProjects.size()), 1); QCOMPARE( project->subProjects.front() ->subProjects.front() ->projectProperties() .value("prop") .toString(), "parent22"); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::pathProperties() { bool exceptionCaught = false; try { resolveProject("pathproperties.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); ResolvedProductPtr product = products.value("product1"); QVERIFY(!!product); QString projectFileDir = QFileInfo(defaultParameters.projectFilePath()).absolutePath(); const QVariantMap productProps = product->productProperties; QCOMPARE(productProps.value("projectFileDir").toString(), projectFileDir); QStringList filesInProjectFileDir = QStringList() << FileInfo::resolvePath(projectFileDir, "aboutdialog.h") << FileInfo::resolvePath(projectFileDir, "aboutdialog.cpp"); QCOMPARE(productProps.value("filesInProjectFileDir").toStringList(), filesInProjectFileDir); QStringList includePaths = product->moduleProperties->property( QStringList() << "dummy" << "includePaths").toStringList(); QCOMPARE(includePaths, QStringList() << projectFileDir); QCOMPARE(productProps.value("base_fileInProductDir").toString(), FileInfo::resolvePath(projectFileDir, QStringLiteral("foo"))); QCOMPARE(productProps.value("base_fileInBaseProductDir").toString(), FileInfo::resolvePath(projectFileDir, QStringLiteral("subdir/bar"))); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::probesAndMultiplexing() { bool exceptionCaught = false; try { resolveProject("probes-and-multiplexing.qbs"); QVERIFY(project); QCOMPARE(int(project->products.size()), 3); QStringList architectures{"x86", "x86_64", "arm"}; for (const ResolvedProductPtr &product : project->products) { const QString arch = product->moduleProperties->moduleProperty("qbs", "architecture") .toString(); QVERIFY2(architectures.removeOne(arch), qPrintable(arch)); QCOMPARE(product->productProperties.value("archFromProbe").toString(), arch); bool foundGroup = false; for (const GroupPtr &group : product->groups) { if (group->name == "theGroup") { foundGroup = true; QCOMPARE(group->properties->moduleProperty("qbs", "sysroot"), "/" + arch); } } QVERIFY(foundGroup); } } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::profileValuesAndOverriddenValues() { bool exceptionCaught = false; try { TemporaryProfile tp(QStringLiteral("tst_lang_profile"), m_settings); Profile profile = tp.p; profile.setValue("dummy.defines", "IN_PROFILE"); profile.setValue("dummy.cFlags", "IN_PROFILE"); profile.setValue("dummy.cxxFlags", "IN_PROFILE"); profile.setValue("qbs.architecture", "x86"); defaultParameters.setTopLevelProfile(profile.name()); QVariantMap overriddenValues; overriddenValues.insert("modules.dummy.cFlags", "OVERRIDDEN"); defaultParameters.setOverriddenValues(overriddenValues); resolveProject("profilevaluesandoverriddenvalues.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); ResolvedProductPtr product = products.value("product1"); QVERIFY(!!product); QVariantList values; values = product->moduleProperties->moduleProperty("dummy", "cxxFlags").toList(); QCOMPARE(values.length(), 1); QCOMPARE(values.front().toString(), QString("IN_PROFILE")); values = product->moduleProperties->moduleProperty("dummy", "defines").toList(); QCOMPARE(values, QVariantList() << QStringLiteral("IN_FILE") << QStringLiteral("IN_PROFILE")); values = product->moduleProperties->moduleProperty("dummy", "cFlags").toList(); QCOMPARE(values.length(), 1); QCOMPARE(values.front().toString(), QString("OVERRIDDEN")); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::projectFileLookup() { QFETCH(QString, projectFileInput); QFETCH(QString, projectFileOutput); QFETCH(bool, failureExpected); try { SetupProjectParameters params; params.setProjectFilePath(projectFileInput); params.finalizeProjectFilePath(); QVERIFY(!failureExpected); QCOMPARE(params.projectFilePath(), projectFileOutput); } catch (const ErrorInfo &) { QVERIFY(failureExpected); } } void TestLanguage::projectFileLookup_data() { QTest::addColumn("projectFileInput"); QTest::addColumn("projectFileOutput"); QTest::addColumn("failureExpected"); const QString baseDir = testDataDir(); const QString multiProjectsDir = baseDir + "/dirwithmultipleprojects"; const QString noProjectsDir = baseDir + "/dirwithnoprojects"; const QString oneProjectDir = baseDir + "/dirwithoneproject"; QVERIFY(QDir(noProjectsDir).exists() && QDir(oneProjectDir).exists() && QDir(multiProjectsDir).exists()); const QString fullFilePath = multiProjectsDir + "/project.qbs"; QTest::newRow("full file path") << fullFilePath << fullFilePath << false; QTest::newRow("base dir ") << oneProjectDir << (oneProjectDir + "/project.qbs") << false; QTest::newRow("empty dir") << noProjectsDir << QString() << true; QTest::newRow("ambiguous dir") << multiProjectsDir << QString() << true; } void TestLanguage::productConditions() { bool exceptionCaught = false; try { resolveProject("productconditions.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 6); ResolvedProductPtr product; product = products.value("product_no_condition"); QVERIFY(!!product); QVERIFY(product->enabled); product = products.value("product_true_condition"); QVERIFY(!!product); QVERIFY(product->enabled); product = products.value("product_condition_dependent_of_module"); QVERIFY(!!product); QVERIFY(product->enabled); product = products.value("product_false_condition"); QVERIFY(!!product); QVERIFY(!product->enabled); product = products.value("product_probe_condition_false"); QVERIFY(!!product); QVERIFY(!product->enabled); product = products.value("product_probe_condition_true"); QVERIFY(!!product); QVERIFY(product->enabled); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::productDirectories() { bool exceptionCaught = false; try { resolveProject("productdirectories.qbs"); QVERIFY(!!project); QHash products = productsFromProject(project); QCOMPARE(products.size(), 1); ResolvedProductPtr product; product = products.value("MyApp"); QVERIFY(!!product); const QVariantMap config = product->productProperties; QCOMPARE(config.value(QStringLiteral("buildDirectory")).toString(), product->buildDirectory()); QCOMPARE(config.value(QStringLiteral("sourceDirectory")).toString(), testDataDir()); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::propertiesBlocks_data() { QTest::addColumn("propertyName"); QTest::addColumn("expectedValue"); QTest::addColumn("expectedStringValue"); QTest::newRow("init") << QString() << QVariant() << QString(); QTest::newRow("property_append") << QString("dummy.defines") << QVariant(QStringList{"APPENDED", "SOMETHING"}) << QString(); QTest::newRow("property_set_indirect") << QString("dummy.cFlags") << QVariant(QStringList("VAL")) << QString(); QTest::newRow("property_overwrite") << QString("dummy.defines") << QVariant(QStringList("OVERWRITTEN")) << QString(); QTest::newRow("property_append_indirect") << QString("dummy.defines") << QVariant(QStringList{"TWO", "ONE"}) << QString(); QTest::newRow("property_append_to_indirect_derived") << QString("dummy.cFlags") << QVariant(QStringList{"BASE", "PROPS"}) << QString(); QTest::newRow("property_append_to_indirect_derived2") << QString("dummy.cFlags") << QVariant(QStringList{"PROPS", "PRODUCT"}) << QString(); QTest::newRow("property_append_to_indirect_derived3") << QString("dummy.cFlags") << QVariant(QStringList{"PROPS", "BASE", "PRODUCT"}) << QString(); QTest::newRow("property_append_to_indirect_merged") << QString("dummy.rpaths") << QVariant(QStringList{"TWO", "ONE", "$ORIGIN"}) << QString(); QTest::newRow("multiple_exclusive_properties") << QString("dummy.defines") << QVariant(QStringList("OVERWRITTEN")) << QString(); QTest::newRow("multiple_exclusive_properties_no_match") << QString("dummy.defines") << QVariant(QStringList("OVERWRITTEN")) << QString(); QTest::newRow("multiple_exclusive_properties_append") << QString("dummy.defines") << QVariant(QStringList{"TWO", "ONE"}) << QString(); QTest::newRow("condition_refers_to_product_property") << QString("dummy.defines") << QVariant(QStringList("OVERWRITTEN")) << QString("OVERWRITTEN"); QTest::newRow("condition_refers_to_project_property") << QString("dummy.defines") << QVariant(QStringList("OVERWRITTEN")) << QString("OVERWRITTEN"); QTest::newRow("ambiguous_properties") << QString("dummy.defines") << QVariant(QStringList{"TWO", "THREE", "ONE"}) << QString(); QTest::newRow("inheritance_overwrite_in_subitem") << QString("dummy.defines") << QVariant(QStringList() << QString("OVERWRITTEN_IN_SUBITEM")) << QString(); QTest::newRow("inheritance_retain_base1") << QString("dummy.defines") << QVariant(QStringList{"BASE", "SOMETHING", "SUB"}) << QString(); QTest::newRow("inheritance_retain_base2") << QString("dummy.defines") << QVariant(QStringList{"BASE", "SOMETHING", "SUB"}) << QString(); QTest::newRow("inheritance_retain_base3") << QString("dummy.defines") << QVariant(QStringList{"BASE", "SOMETHING", "SUB"}) << QString(); QTest::newRow("inheritance_retain_base4") << QString("dummy.defines") << QVariant(QStringList{"BASE", "SOMETHING"}) << QString(); QTest::newRow("inheritance_condition_in_subitem1") << QString("dummy.defines") << QVariant(QStringList() << QString("SOMETHING") << QString("SUB")) << QString(); QTest::newRow("inheritance_condition_in_subitem2") << QString("dummy.defines") << QVariant(QStringList() << QString("SOMETHING")) << QString(); QTest::newRow("condition_references_id") << QString("dummy.defines") << QVariant(QStringList() << QString("OVERWRITTEN")) << QString(); QTest::newRow("using_derived_Properties_item") << "dummy.defines" << QVariant(QStringList() << "string from MyProperties") << QString(); QTest::newRow("conditional-depends") << QString("dummy.defines") << QVariant() << QString(); QTest::newRow("use-module-with-properties-item") << QString("module-with-properties-item.stringProperty") << QVariant(QString("overridden in Properties item")) << QString(); QTest::newRow("cleanup") << QString() << QVariant() << QString(); } void TestLanguage::propertiesBlocks() { defaultParameters.setDeprecationWarningMode(DeprecationWarningMode::On); HANDLE_INIT_CLEANUP_DATATAGS("propertiesblocks.qbs"); QFETCH(QString, propertyName); QFETCH(QVariant, expectedValue); QFETCH(QString, expectedStringValue); QVERIFY(!!project); QHash products = productsFromProject(project); const QString productName = QString::fromLocal8Bit(QTest::currentDataTag()); ResolvedProductPtr product = products.value(productName); QVERIFY(!!product); QCOMPARE(product->name, productName); QVariant v = productPropertyValue(product, propertyName); QCOMPARE(v, expectedValue); if (!expectedStringValue.isEmpty()) { v = productPropertyValue(product, "someString"); QCOMPARE(v.toString(), expectedStringValue); } } void TestLanguage::propertiesBlockInGroup_data() { QTest::addColumn("withGroup"); QTest::addColumn("moduleGroup"); QTest::addColumn("expectedValue"); QTest::newRow("with group, use primary module group") << true << "module_group" << QStringList{"FEATURE_ENABLED", "THE_GROUP", "BASEDEF", "MODULE_DEFINE", "MODULE_GROUP"}; QTest::newRow("with group, use alternative module group") << true << "module_group_alt" << QStringList{ "FEATURE_ENABLED", "THE_GROUP", "BASEDEF", "MODULE_DEFINE", "MODULE_GROUP_ALT"}; QTest::newRow("without group, use primary module group") << false << "module_group" << QStringList{"BASEDEF", "MODULE_DEFINE", "MODULE_GROUP"}; QTest::newRow("without group, use alternative module group") << false << "module_group_alt" << QStringList{"BASEDEF", "MODULE_DEFINE", "MODULE_GROUP_ALT"}; } void TestLanguage::propertiesBlockInGroup() { QFETCH(bool, withGroup); QFETCH(QString, moduleGroup); QFETCH(QStringList, expectedValue); bool exceptionCaught = false; try { defaultParameters.setOverriddenValues( {std::make_pair(QString("products.in-group.featureEnabled"), withGroup), std::make_pair(QString("modules.module_with_group.group"), moduleGroup)}); resolveProject("properties-block-in-group.qbs"); QVERIFY(!!project); QCOMPARE(project->allProducts().size(), size_t(1)); const ResolvedProductConstPtr product = project->allProducts().front(); const QStringList productValue = moduleProperty(product->moduleProperties->value(), "dummy", "defines").toStringList(); QCOMPARE(productValue, expectedValue); const auto groupIt = std::find_if(product->groups.cbegin(), product->groups.cend(), [](const GroupConstPtr &g) { return g->name == "the group"; }); QVERIFY(groupIt != product->groups.cend()); const QStringList groupValue = moduleProperty((*groupIt)->properties->value(), "dummy", "defines").toStringList(); QCOMPARE(groupValue, QStringList{"GROUP_ONLY"}); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::propertiesItemInModule() { bool exceptionCaught = false; try { resolveProject("properties-item-in-module.qbs"); QVERIFY(!!project); const QHash products = productsFromProject(project); QCOMPARE(products.size(), 2); for (const ResolvedProductPtr &p : products) { QCOMPARE(p->moduleProperties->moduleProperty("dummy", "productName").toString(), p->name); } } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::propertyAssignmentInExportedGroup() { bool exceptionCaught = false; try { resolveProject("property-assignment-in-exported-group.qbs"); QVERIFY(!!project); const QHash products = productsFromProject(project); QCOMPARE(products.size(), 2); for (const ResolvedProductPtr &p : products) { QCOMPARE(p->moduleProperties->moduleProperty("dummy", "someString").toString(), QString()); for (const GroupPtr &g : p->groups) { const QString propValue = g->properties->moduleProperty("dummy", "someString").toString(); if (g->name == "exported_group") QCOMPARE(propValue, QString("test")); else QCOMPARE(propValue, QString()); } } } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::qbs1275() { bool exceptionCaught = false; try { resolveProject("qbs1275.qbs"); QVERIFY(!!project); const QHash products = productsFromProject(project); QCOMPARE(products.count(), 5); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::qbsPropertiesInProjectCondition() { bool exceptionCaught = false; try { resolveProject("qbs-properties-in-project-condition.qbs"); QVERIFY(!!project); QVERIFY(!project->enabled); const QHash products = productsFromProject(project); QCOMPARE(products.size(), 0); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::qbsPropertyConvenienceOverride() { bool exceptionCaught = false; try { defaultParameters.setOverriddenValues({std::make_pair("qbs.installPrefix", "/opt")}); resolveProject("qbs-property-convenience-override.qbs"); QVERIFY(!!project); QCOMPARE(project->products.size(), size_t(1)); QCOMPARE(project->products.front()->moduleProperties->qbsPropertyValue("installPrefix") .toString(), QString("/opt")); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::relaxedErrorMode() { m_logSink->setLogLevel(LoggerMinLevel); QFETCH(bool, strictMode); try { defaultParameters.setProductErrorMode(strictMode ? ErrorHandlingMode::Strict : ErrorHandlingMode::Relaxed); resolveProject("relaxed-error-mode/relaxed-error-mode.qbs"); QVERIFY(!strictMode); const auto productMap = productsFromProject(project); const ResolvedProductConstPtr brokenProduct = productMap.value("broken"); QVERIFY(!brokenProduct->enabled); QVERIFY(brokenProduct->location.isValid()); QCOMPARE(brokenProduct->allFiles().size(), size_t(0)); const ResolvedProductConstPtr dependerRequired = productMap.value("depender required"); QVERIFY(!dependerRequired->enabled); QVERIFY(dependerRequired->location.isValid()); QCOMPARE(dependerRequired->allFiles().size(), size_t(1)); const ResolvedProductConstPtr dependerNonRequired = productMap.value("depender nonrequired"); QVERIFY(dependerNonRequired->enabled); QCOMPARE(dependerNonRequired->allFiles().size(), size_t(1)); const ResolvedProductConstPtr recursiveDepender = productMap.value("recursive depender"); QVERIFY(!recursiveDepender->enabled); QVERIFY(recursiveDepender->location.isValid()); QCOMPARE(recursiveDepender->allFiles().size(), size_t(1)); const ResolvedProductConstPtr missingFile = productMap.value("missing file"); QVERIFY(missingFile->enabled); QCOMPARE(missingFile->groups.size(), size_t(1)); QVERIFY(missingFile->groups.front()->enabled); QVERIFY(missingFile->groups.front()->files); QCOMPARE(missingFile->groups.front()->files->size(), size_t(2)); const ResolvedProductConstPtr fine = productMap.value("fine"); QVERIFY(fine->enabled); QCOMPARE(fine->allFiles().size(), size_t(1)); } catch (const ErrorInfo &e) { QVERIFY2(strictMode, qPrintable(e.toString())); } } void TestLanguage::relaxedErrorMode_data() { QTest::addColumn("strictMode"); QTest::newRow("strict mode") << true; QTest::newRow("relaxed mode") << false; } void TestLanguage::requiredAndNonRequiredDependencies() { QFETCH(QString, projectFile); QFETCH(bool, exceptionExpected); try { resolveProject(qPrintable("required-and-nonrequired-dependencies/" + projectFile)); QVERIFY(!!project); QVERIFY(!exceptionExpected); } catch (const ErrorInfo &e) { QVERIFY(exceptionExpected); QVERIFY2(e.toString().contains("validation error!"), qPrintable(e.toString())); } } void TestLanguage::requiredAndNonRequiredDependencies_data() { QTest::addColumn("projectFile"); QTest::addColumn("exceptionExpected"); QTest::newRow("same file") << "direct-dependencies.qbs" << true; QTest::newRow("dependency via module") << "dependency-via-module.qbs" << true; QTest::newRow("dependency via export") << "dependency-via-export.qbs" << true; QTest::newRow("more indirection") << "complicated.qbs" << true; QTest::newRow("required chain (module)") << "required-chain-module.qbs" << false; QTest::newRow("required chain (export)") << "required-chain-export.qbs" << false; QTest::newRow("required chain (export indirect)") << "required-chain-export-indirect.qbs" << false; } void TestLanguage::suppressedAndNonSuppressedErrors() { try { resolveProject("suppressed-and-non-suppressed-errors.qbs"); QFAIL("failure expected"); } catch (const ErrorInfo &e) { QVERIFY2(e.toString().contains("easter bunny"), qPrintable(e.toString())); QVERIFY2(!e.toString().contains("TheBeautifulSausage"), qPrintable(e.toString())); } } void TestLanguage::throwingProbe() { QFETCH(bool, enableProbe); try { QVariantMap properties; properties.insert(QStringLiteral("products.theProduct.enableProbe"), enableProbe); defaultParameters.setOverriddenValues(properties); resolveProject("throwing-probe.qbs"); QVERIFY(!!project); QVERIFY(!enableProbe); } catch (const ErrorInfo &e) { QVERIFY2(enableProbe, qPrintable(e.toString())); } } void TestLanguage::throwingProbe_data() { QTest::addColumn("enableProbe"); QTest::newRow("enabled probe") << true; QTest::newRow("disabled probe") << false; } void TestLanguage::qualifiedId() { QString str = "foo.bar.baz"; QualifiedId id = QualifiedId::fromString(str); QCOMPARE(id.size(), 3); QCOMPARE(id.toString(), str); id = QualifiedId("blubb.di.blubb"); // c'tor does not split QCOMPARE(id.size(), 1); QList ids; ids << QualifiedId::fromString("a") << QualifiedId::fromString("a.a") << QualifiedId::fromString("b") << QualifiedId::fromString("c.a") << QualifiedId::fromString("c.b.a") << QualifiedId::fromString("c.c"); QList sorted = ids; std::sort(sorted.begin(), sorted.end()); QCOMPARE(ids, sorted); } void TestLanguage::recursiveProductDependencies() { bool exceptionCaught = false; try { resolveProject("recursive-dependencies/recursive-dependencies.qbs"); QVERIFY(!!project); const QHash products = productsFromProject(project); QCOMPARE(products.size(), 4); const ResolvedProductConstPtr p1 = products.value("p1"); QVERIFY(!!p1); const ResolvedProductConstPtr p2 = products.value("p2"); QVERIFY(!!p2); const ResolvedProductPtr p3 = products.value("p3"); QVERIFY(!!p3); const ResolvedProductPtr p4 = products.value("p4"); QVERIFY(!!p4); QVERIFY(p1->depsAsProductList() == std::vector({p3, p4})); QVERIFY(p2->depsAsProductList() == std::vector({p3, p4})); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } void TestLanguage::fileTags_data() { QTest::addColumn("numberOfGroups"); QTest::addColumn("expectedFileTags"); QTest::newRow("init") << size_t(0) << QStringList(); QTest::newRow("filetagger_project_scope") << size_t(1) << (QStringList() << "cpp"); QTest::newRow("filetagger_product_scope") << size_t(1) << (QStringList() << "asm"); QTest::newRow("filetagger_static_pattern") << size_t(1) << (QStringList() << "yellow"); QTest::newRow("unknown_file_tag") << size_t(1) << (QStringList() << "unknown-file-tag"); QTest::newRow("set_file_tag_via_group") << size_t(2) << (QStringList() << "c++"); QTest::newRow("override_file_tag_via_group") << size_t(2) << (QStringList() << "c++"); QTest::newRow("add_file_tag_via_group") << size_t(2) << (QStringList() << "cpp" << "zzz"); QTest::newRow("prioritized_filetagger") << size_t(1) << (QStringList() << "cpp1" << "cpp2"); QTest::newRow("cleanup") << size_t(0) << QStringList(); } void TestLanguage::fileTags() { HANDLE_INIT_CLEANUP_DATATAGS("filetags.qbs"); QFETCH(size_t, numberOfGroups); QFETCH(QStringList, expectedFileTags); QHash products = productsFromProject(project); ResolvedProductPtr product; const QString productName = QString::fromLocal8Bit(QTest::currentDataTag()); QVERIFY(!!(product = products.value(productName))); QCOMPARE(product->groups.size(), numberOfGroups); GroupPtr group = *(product->groups.end() - 1); QVERIFY(!!group); QVERIFY(group->files); QCOMPARE(group->files->size(), size_t(1)); SourceArtifactConstPtr sourceFile = group->files->front(); QStringList fileTags = sourceFile->fileTags.toStringList(); fileTags.sort(); QCOMPARE(fileTags, expectedFileTags); } void TestLanguage::useInternalProfile() { const QString profile(QStringLiteral("theprofile")); defaultParameters.setTopLevelProfile(profile); resolveProject("use-internal-profile.qbs"); QVERIFY(!!project); QCOMPARE(project->profile(), profile); QCOMPARE(project->products.size(), size_t(1)); const ResolvedProductConstPtr product = project->products[0]; QCOMPARE(product->profile(), profile); QCOMPARE(product->moduleProperties->moduleProperty("dummy", "defines").toString(), profile); } void TestLanguage::wildcards_data() { QTest::addColumn("useGroup"); QTest::addColumn("filesToCreate"); QTest::addColumn("projectFileSubDir"); QTest::addColumn("prefix"); QTest::addColumn("patterns"); QTest::addColumn("excludePatterns"); QTest::addColumn("expected"); const bool useGroup = true; for (int i = 0; i <= 1; ++i) { const bool useGroup = i; const QByteArray dataTagSuffix = useGroup ? " group" : " nogroup"; QTest::newRow(QByteArray("simple 1") + dataTagSuffix) << useGroup << (QStringList() << "foo.h" << "foo.cpp" << "bar.h" << "bar.cpp") << QString() << QString() << (QStringList() << "*.h") << QStringList() << (QStringList() << "foo.h" << "bar.h"); QTest::newRow(QByteArray("simple 2") + dataTagSuffix) << useGroup << (QStringList() << "foo.h" << "foo.cpp" << "bar.h" << "bar.cpp") << QString() << QString() << (QStringList() << "foo.*") << QStringList() << (QStringList() << "foo.h" << "foo.cpp"); QTest::newRow(QByteArray("simple 3") + dataTagSuffix) << useGroup << (QStringList() << "foo.h" << "foo.cpp" << "bar.h" << "bar.cpp") << QString() << QString() << (QStringList() << "*.h" << "*.cpp") << QStringList() << (QStringList() << "foo.h" << "foo.cpp" << "bar.h" << "bar.cpp"); QTest::newRow(QByteArray("exclude 1") + dataTagSuffix) << useGroup << (QStringList() << "foo.h" << "foo.cpp" << "bar.h" << "bar.cpp") << QString() << QString() << (QStringList() << "*.h" << "*.cpp") << (QStringList() << "bar*") << (QStringList() << "foo.h" << "foo.cpp"); QTest::newRow(QByteArray("exclude 2") + dataTagSuffix) << useGroup << (QStringList() << "foo.h" << "foo.cpp" << "bar.h" << "bar.cpp") << QString() << QString() << (QStringList() << "*") << (QStringList() << "*.qbs") << (QStringList() << "foo.h" << "foo.cpp" << "bar.h" << "bar.cpp"); QTest::newRow(QByteArray("non-recursive") + dataTagSuffix) << useGroup << (QStringList() << "a/foo.h" << "a/foo.cpp" << "a/b/bar.h" << "a/b/bar.cpp") << QString() << QString() << (QStringList() << "a/*") << QStringList() << (QStringList() << "a/foo.h" << "a/foo.cpp"); QTest::newRow(QByteArray("absolute paths") + dataTagSuffix) << useGroup << (QStringList() << "foo.h" << "foo.cpp" << "bar.h" << "bar.cpp") << QString() << QString() << (QStringList() << m_wildcardsTestDirPath + "/?oo.*") << QStringList() << (QStringList() << "foo.h" << "foo.cpp"); QTest::newRow(QByteArray("relative paths with dotdot") + dataTagSuffix) << useGroup << (QStringList() << "bar.h" << "bar.cpp") << QString("TheLaughingLlama") << QString() << (QStringList() << "../bar.*") << QStringList() << (QStringList() << "bar.h" << "bar.cpp"); } QTest::newRow(QByteArray("recursive 1")) << useGroup << (QStringList() << "a/foo.h" << "a/foo.cpp" << "a/b/bar.h" << "a/b/bar.cpp") << QString() << QString() << (QStringList() << "a/**") << QStringList() << (QStringList() << "a/foo.h" << "a/foo.cpp" << "a/b/bar.h" << "a/b/bar.cpp"); QTest::newRow(QByteArray("recursive 2")) << useGroup << (QStringList() << "d/1.h" << "b/d/1.h" << "b/c/d/1.h" << "d/e/1.h" << "b/d/e/1.h" << "b/c/d/e/1.h" << "a/d/1.h" << "a/b/d/1.h" << "a/b/c/d/1.h" << "a/d/e/1.h" << "a/b/d/e/1.h" << "a/b/c/d/e/1.h" << "a/d/1.cpp" << "a/b/d/1.cpp" << "a/b/c/d/1.h" << "a/d/e/1.cpp" << "a/b/d/e/1.cpp" << "a/b/c/d/e/1.cpp") << QString() << QString() << (QStringList() << "a/**/d/*.h") << QStringList() << (QStringList() << "a/d/1.h" << "a/b/d/1.h" << "a/b/c/d/1.h"); QTest::newRow(QByteArray("recursive 3")) << useGroup << (QStringList() << "a/foo.h" << "a/foo.cpp" << "a/b/bar.h" << "a/b/bar.cpp") << QString() << QString() << (QStringList() << "a/**/**/**") << QStringList() << (QStringList() << "a/foo.h" << "a/foo.cpp" << "a/b/bar.h" << "a/b/bar.cpp"); QTest::newRow(QByteArray("prefix")) << useGroup << (QStringList() << "subdir/foo.h" << "subdir/foo.cpp" << "subdir/bar.h" << "subdir/bar.cpp") << QString() << QString("subdir/") << (QStringList() << "*.h") << QStringList() << (QStringList() << "subdir/foo.h" << "subdir/bar.h"); QTest::newRow(QByteArray("non-existing absolute path")) << useGroup << QStringList() << QString() << QString("/dir") << (QStringList() << "*.whatever") << QStringList() << QStringList(); QTest::newRow(QByteArray("case sensitivity")) << useGroup << (QStringList{"test1.txt", "test2.TXT"}) << QString() << QString() << (QStringList{"*.TXT"}) << QStringList() << (HostOsInfo::isWindowsHost() ? QStringList{"test1.txt", "test2.TXT"} : QStringList("test2.TXT")); } void TestLanguage::wildcards() { QFETCH(bool, useGroup); QFETCH(QStringList, filesToCreate); QFETCH(QString, projectFileSubDir); QFETCH(QString, prefix); QFETCH(QStringList, patterns); QFETCH(QStringList, excludePatterns); QFETCH(QStringList, expected); // create test directory QDir::setCurrent(QDir::tempPath()); { QString errorMessage; if (QFile::exists(m_wildcardsTestDirPath)) { if (!removeDirectoryWithContents(m_wildcardsTestDirPath, &errorMessage)) { qDebug() << errorMessage; QVERIFY2(false, "removeDirectoryWithContents failed"); } } QVERIFY(QDir().mkdir(m_wildcardsTestDirPath)); } // create project file const QString groupName = "Keks"; QString dataTag = QString::fromLocal8Bit(QTest::currentDataTag()); dataTag.replace(' ', '_'); if (!projectFileSubDir.isEmpty()) { if (!projectFileSubDir.startsWith('/')) projectFileSubDir.prepend('/'); if (projectFileSubDir.endsWith('/')) projectFileSubDir.chop(1); QVERIFY(QDir().mkpath(m_wildcardsTestDirPath + projectFileSubDir)); } const QString projectFilePath = m_wildcardsTestDirPath + projectFileSubDir + "/test_" + dataTag + ".qbs"; { QFile projectFile(projectFilePath); QVERIFY(projectFile.open(QIODevice::WriteOnly)); QTextStream s(&projectFile); using Qt::endl; s << "Application {" << endl << " name: \"MyProduct\"" << endl; if (useGroup) { s << " Group {" << endl << " name: " << toJSLiteral(groupName) << endl; } if (!prefix.isEmpty()) s << " prefix: " << toJSLiteral(prefix) << endl; if (!patterns.empty()) s << " files: " << toJSLiteral(patterns) << endl; if (!excludePatterns.empty()) s << " excludeFiles: " << toJSLiteral(excludePatterns) << endl; if (useGroup) s << " }" << endl; s << "}" << endl << endl; } // create files for (QString filePath : std::as_const(filesToCreate)) { filePath.prepend(m_wildcardsTestDirPath + '/'); QFileInfo fi(filePath); if (!QDir(fi.path()).exists()) QVERIFY(QDir().mkpath(fi.path())); QFile file(filePath); QVERIFY(file.open(QIODevice::WriteOnly)); } // read the project bool exceptionCaught = false; ResolvedProductPtr product; try { defaultParameters.setProjectFilePath(projectFilePath); resolveProject(); QVERIFY(!!project); const QHash products = productsFromProject(project); product = products.value("MyProduct"); QVERIFY(!!product); GroupPtr group; if (useGroup) { QCOMPARE(product->groups.size(), size_t(HostOsInfo::isMacosHost() ? 4 : 2)); for (const GroupPtr &rg : product->groups) { if (rg->name == groupName) { group = rg; break; } } } else { QCOMPARE(product->groups.size(), size_t(HostOsInfo::isMacosHost() ? 3 : 1)); group = product->groups.front(); } QVERIFY(!!group); QVERIFY(group->files); QCOMPARE(group->files->size(), expected.size()); // we assume all files are wildcards QVERIFY(!!group->wildcards); QStringList actualFilePaths; for (const SourceArtifactPtr &artifact : *group->files) { QString str = artifact->absoluteFilePath; int idx = str.indexOf(m_wildcardsTestDirPath); if (idx != -1) str.remove(0, idx + m_wildcardsTestDirPath.size() + 1); actualFilePaths << str; } actualFilePaths.sort(); expected.sort(); QCOMPARE(actualFilePaths, expected); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); } QCOMPARE(exceptionCaught, false); } int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); const SettingsPtr s = settings(); TestLanguage tl(ConsoleLogger::instance().logSink(), s.get()); return QTest::qExec(&tl, argc, argv); } qbs-src-3.2.0/tests/auto/language/language.qbs0000644000175100017510000000122115154533055020665 0ustar runnerrunnerimport qbs.Utilities QbsUnittest { Depends { name: "qbsversion" } Depends { name: "qbsconsolelogger" } testName: "language" condition: qbsbuildconfig.enableUnitTests Properties { condition: qbs.toolchain.contains("mingw") cpp.cxxFlags: "-Wno-maybe-uninitialized" } files: [ "tst_language.cpp", "tst_language.h" ] cpp.defines: base.concat([ "QBS_VERSION=" + Utilities.cStringQuote(qbsversion.version), "SRCDIR=" + Utilities.cStringQuote(path) ]) Group { name: "testdata" prefix: "testdata/" files: ["**/*"] fileTags: [] } } qbs-src-3.2.0/tests/auto/cmdlineparser/0000755000175100017510000000000015154533055017444 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/cmdlineparser/CMakeLists.txt0000644000175100017510000000115715154533055022210 0ustar runnerrunnerset(PARSER_SOURCES commandlineoption.cpp commandlineoption.h commandlineoptionpool.cpp commandlineoptionpool.h commandlineparser.cpp commandlineparser.h commandpool.cpp commandpool.h commandtype.h parsercommand.cpp parsercommand.h ) list_transform_prepend(PARSER_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/app/qbs/parser/") add_qbs_test(cmdlineparser DEFINES "QBS_VERSION=\"${QBS_VERSION}\"" INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/../../../src" SOURCES tst_cmdlineparser.cpp ../../../src/app/qbs/qbstool.cpp ${PARSER_SOURCES} ) qbs-src-3.2.0/tests/auto/cmdlineparser/cmdlineparser.qbs0000644000175100017510000000161415154533055023005 0ustar runnerrunnerimport qbs.Utilities QbsAutotest { Depends { name: "qbsversion" } Depends { name: "qbsconsolelogger" } testName: "cmdlineparser" files: ["tst_cmdlineparser.cpp", "../../../src/app/qbs/qbstool.cpp"] cpp.defines: base.concat([ "SRCDIR=" + Utilities.cStringQuote(path), "QBS_VERSION=" +Utilities.cStringQuote(qbsversion.version) ]) // TODO: Make parser a static library? Group { name: "parser" prefix: "../../../src/app/qbs/parser/" files: [ "commandlineoption.cpp", "commandlineoption.h", "commandlineoptionpool.cpp", "commandlineoptionpool.h", "commandlineparser.cpp", "commandlineparser.h", "commandpool.cpp", "commandpool.h", "commandtype.h", "parsercommand.cpp", "parsercommand.h", ] } } qbs-src-3.2.0/tests/auto/cmdlineparser/tst_cmdlineparser.cpp0000644000175100017510000002622315154533055023677 0ustar runnerrunner/**************************************************************************** ** ** 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 "../shared.h" #include #include #include #include #include #include #include #include using namespace qbs; class TestCmdLineParser : public QObject { Q_OBJECT public: TestCmdLineParser() { ConsoleLogger::instance().logSink()->setEnabled(false); } private slots: void initTestCase() { QVERIFY(m_projectFile.open()); m_fileArgs = QStringList() << "-f" << m_projectFile.fileName(); } void testResolve_data() { QTest::addColumn("args"); QTest::addColumn("expectedJobCount"); QTest::newRow("default job count") << QStringList() << BuildOptions::defaultMaxJobCount(); QTest::newRow("explicit job count") << QStringList("-j5") << 5; } void testResolve() { QFETCH(QStringList, args); QFETCH(int, expectedJobCount); CommandLineParser parser; QVERIFY(parser.parseCommandLine(QStringList("resolve") << args << m_fileArgs)); QCOMPARE(parser.command(), ResolveCommandType); QCOMPARE(parser.jobCount(profileName()), expectedJobCount); } void testValidCommandLine() { QStringList args; args.push_back("-vvk"); args.push_back("-v"); args << "--products" << "blubb"; args << "--changed-files" << "foo,bar" << m_fileArgs; args << "--check-timestamps"; args << "--check-outputs"; CommandLineParser parser; QVERIFY(parser.parseCommandLine(args)); QCOMPARE(ConsoleLogger::instance().logSink()->logLevel(), LoggerTrace); QCOMPARE(parser.command(), BuildCommandType); QCOMPARE(parser.products(), QStringList() << "blubb"); QCOMPARE(parser.buildOptions(QString()).changedFiles().size(), 2); QVERIFY(parser.buildOptions(QString()).keepGoing()); QVERIFY(parser.forceTimestampCheck()); QVERIFY(parser.forceOutputCheck()); QVERIFY(!parser.logTime()); QCOMPARE(parser.buildConfigurations().size(), 1); QVERIFY(parser.parseCommandLine(QStringList() << "-vvvqqq" << m_fileArgs)); QCOMPARE(ConsoleLogger::instance().logSink()->logLevel(), defaultLogLevel()); QVERIFY(parser.parseCommandLine(QStringList() << "-t" << m_fileArgs)); QVERIFY(parser.logTime()); // Note: We cannot just check for !parser.logTime() here, because if the test is not // run in a terminal, "--show-progress" is ignored, in which case "--log-time" // takes effect. QVERIFY(parser.parseCommandLine(QStringList() << "-t" << "--show-progress" << m_fileArgs)); QVERIFY(parser.showProgress() != parser.logTime()); QVERIFY(parser.parseCommandLine(QStringList() << "-vvqqq" << m_fileArgs)); QCOMPARE(ConsoleLogger::instance().logSink()->logLevel(), LoggerWarning); QVERIFY(parser.parseCommandLine(QStringList() << "-vvvqq" << m_fileArgs)); QCOMPARE(ConsoleLogger::instance().logSink()->logLevel(), LoggerDebug); QVERIFY(parser.parseCommandLine(QStringList() << "--log-level" << "trace" << m_fileArgs)); QCOMPARE(ConsoleLogger::instance().logSink()->logLevel(), LoggerTrace); // Second "global" profile overwrites first. QVERIFY(parser.parseCommandLine(QStringList() << "profile:a" << m_fileArgs << "profile:b")); QCOMPARE(parser.buildConfigurations().size(), 1); QCOMPARE(parser.buildConfigurations().front().value("qbs.profile").toString(), QLatin1String("b")); // Second build configuration-specific profile overwrites first. QVERIFY(parser.parseCommandLine(QStringList(m_fileArgs) << "config:debug" << "profile:a" << "profile:b")); QCOMPARE(parser.buildConfigurations().size(), 1); QCOMPARE(parser.buildConfigurations().front().value("qbs.profile").toString(), QLatin1String("b")); QVERIFY(parser.parseCommandLine(QStringList(m_fileArgs) << "config:a-debug" << "profile:a" << "config:b-debug" << "profile:b")); QCOMPARE(parser.buildConfigurations().size(), 2); QCOMPARE(parser.buildConfigurations().front().value("qbs.configurationName").toString(), QLatin1String("a-debug")); QCOMPARE(parser.buildConfigurations().front().value("qbs.profile").toString(), QLatin1String("a")); QCOMPARE(parser.buildConfigurations().at(1).value("qbs.configurationName").toString(), QLatin1String("b-debug")); QCOMPARE(parser.buildConfigurations().at(1).value("qbs.profile").toString(), QLatin1String("b")); // Redundant build request QVERIFY(parser.parseCommandLine(QStringList(m_fileArgs) << "config:debug" << "profile:a" << "config:debug" << "profile:a")); QCOMPARE(parser.buildConfigurations().size(), 1); QVERIFY(parser.parseCommandLine(QStringList() << "config:debug" << "profile:a" << "config:release" << "profile:b" << m_fileArgs)); QCOMPARE(parser.buildConfigurations().size(), 2); QCOMPARE(parser.buildConfigurations().front().value("qbs.configurationName").toString(), QLatin1String("debug")); QCOMPARE(parser.buildConfigurations().front().value("qbs.profile").toString(), QLatin1String("a")); QCOMPARE(parser.buildConfigurations().at(1).value("qbs.configurationName").toString(), QLatin1String("release")); QCOMPARE(parser.buildConfigurations().at(1).value("qbs.profile").toString(), QLatin1String("b")); // Non-global property takes precedence. QVERIFY(parser.parseCommandLine(QStringList(m_fileArgs) << "profile:a" << "config:debug" << "profile:b")); QCOMPARE(parser.buildConfigurations().size(), 1); QCOMPARE(parser.buildConfigurations().front().value("qbs.configurationName").toString(), QLatin1String("debug")); QCOMPARE(parser.buildConfigurations().front().value("qbs.profile").toString(), QLatin1String("b")); // Digits are always handled as option parameters. QVERIFY(parser.parseCommandLine(QStringList(m_fileArgs) << "-j" << "123")); QCOMPARE(parser.buildOptions(QString()).maxJobCount(), 123); QVERIFY(parser.parseCommandLine(QStringList(m_fileArgs) << "-j123")); QCOMPARE(parser.buildOptions(QString()).maxJobCount(), 123); // Argument list separation for the "run" command. QVERIFY(parser.parseCommandLine(QStringList("run") << m_fileArgs << "config:custom" << "-j123")); QCOMPARE(parser.command(), RunCommandType); QCOMPARE(parser.buildOptions(QString()).maxJobCount(), 123); QCOMPARE(parser.buildConfigurations().front().value("qbs.configurationName").toString(), QLatin1String("custom")); QVERIFY(parser.runArgs().empty()); QVERIFY(parser.parseCommandLine(QStringList("run") << m_fileArgs << "-j" << "123" << "--" << "config:custom")); QCOMPARE(parser.command(), RunCommandType); QCOMPARE(parser.buildOptions(QString()).maxJobCount(), 123); QCOMPARE(parser.buildConfigurations().front().value("qbs.configurationName").toString(), QLatin1String("default")); QCOMPARE(parser.runArgs(), QStringList({"config:custom"})); // show-version QVERIFY(parser.parseCommandLine(QStringList("show-version"))); QVERIFY(parser.showVersion()); QVERIFY(parser.parseCommandLine(QStringList("--version"))); QVERIFY(parser.showVersion()); QVERIFY(parser.parseCommandLine(QStringList("-V"))); QVERIFY(parser.showVersion()); QVERIFY(parser.parseCommandLine(QStringList{"run", "--setup-run-env-config", "x,y,z"})); QCOMPARE(parser.runEnvConfig(), QStringList({"x", "y", "z"})); } void testInvalidCommandLine() { QFETCH(QStringList, commandLine); CommandLineParser parser; QVERIFY(!parser.parseCommandLine(commandLine)); } void testInvalidCommandLine_data() { QTest::addColumn("commandLine"); QTest::newRow("Unknown short option") << (QStringList() << m_fileArgs << "-x"); QTest::newRow("Unknown long option") << (QStringList() << m_fileArgs << "--xyz"); QTest::newRow("Invalid position") << (QStringList() << m_fileArgs << "-vjv"); QTest::newRow("Missing jobs argument") << (QStringList() << m_fileArgs << "-j"); QTest::newRow("Missing products argument") << (QStringList() << m_fileArgs << "--products"); QTest::newRow("Wrong argument") << (QStringList() << "-j" << "0" << m_fileArgs); QTest::newRow("Invalid list argument") << (QStringList() << "--changed-files" << "," << m_fileArgs); QTest::newRow("Invalid log level") << (QStringList() << "--log-level" << "blubb" << m_fileArgs); QTest::newRow("Unknown numeric argument") << (QStringList() << m_fileArgs << "-123"); QTest::newRow("Unknown parameter") << (QStringList() << m_fileArgs << "debug"); QTest::newRow("Too many arguments") << (QStringList("help") << "build" << "clean"); QTest::newRow("Property assignment for clean") << (QStringList("clean") << "profile:x"); QTest::newRow("Property assignment for dump-nodes-tree") << (QStringList("dump-nodes-tree") << "profile:x"); QTest::newRow("Property assignment for status") << (QStringList("status") << "profile:x"); QTest::newRow("Property assignment for update-timestamps") << (QStringList("update-timestamps") << "profile:x"); QTest::newRow("Argument for show-version") << (QStringList("show-version") << "config:debug"); } private: QTemporaryFile m_projectFile; QStringList m_fileArgs; }; QTEST_MAIN(TestCmdLineParser) #include "tst_cmdlineparser.moc" qbs-src-3.2.0/tests/auto/tools/0000755000175100017510000000000015154533055015754 5ustar runnerrunnerqbs-src-3.2.0/tests/auto/tools/tst_tools.cpp0000644000175100017510000010745715154533055020530 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #undef QT_NO_CAST_FROM_ASCII // I am qmake, and I approve this hack. #include "tst_tools.h" #include "../shared.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace qbs; using namespace qbs::Internal; namespace std { template struct hash> { std::size_t operator()(const std::vector &v) const noexcept { return hashRange(v); } }; } // namespace std TestTools::TestTools(Settings *settings) : m_settings(settings), testDataDir(testWorkDir("tools")) { } TestTools::~TestTools() { qDeleteAll(m_tmpDirs); } void TestTools::initTestCase() { QDir().mkpath(testDataDir); } void TestTools::fileSaver() { QVERIFY(QDir::setCurrent(testDataDir)); static const char *fn = "foo.txt"; const auto run = [](const std::function &func) { if (QFile::exists(fn)) QVERIFY(QFile::remove(fn)); func(); if (QFile::exists(fn)) QVERIFY(QFile::remove(fn)); }; // failing to open the file means nothing works run([] { Internal::FileSaver fs(fn); QVERIFY(!fs.device()); QVERIFY(!fs.write("hello")); QVERIFY(!fs.commit()); QVERIFY(!QFile::exists(fn)); }); // verify that correct usage creates a file with the right contents run([] { Internal::FileSaver fs(fn); QVERIFY(fs.open()); QVERIFY(fs.device()); QVERIFY(fs.write("hello")); QVERIFY(fs.commit()); QVERIFY(QFile::exists(fn)); QFile f(fn); QVERIFY(f.open(QIODevice::ReadOnly)); QCOMPARE(f.readAll(), QByteArrayLiteral("hello")); }); // failing to commit writes nothing run([] { Internal::FileSaver fs(fn); QVERIFY(fs.open()); QVERIFY(fs.device()); QVERIFY(fs.write("hello")); QVERIFY(!QFile::exists(fn)); }); // verify that correct usage creates a file with the right contents and does not overwrite run([] { { Internal::FileSaver fs(fn); QVERIFY(fs.open()); QVERIFY(fs.device()); QVERIFY(fs.write("hello")); QVERIFY(fs.commit()); QVERIFY(QFile::exists(fn)); QFile f(fn); QVERIFY(f.open(QIODevice::ReadOnly)); QCOMPARE(f.readAll(), QByteArrayLiteral("hello")); } const auto lm = QFileInfo(fn).lastModified(); QVERIFY(lm.isValid()); waitForNewTimestamp("."); { Internal::FileSaver fs(fn); QVERIFY(fs.open()); QVERIFY(fs.device()); QVERIFY(fs.write("hello")); QVERIFY(fs.commit()); QVERIFY(QFile::exists(fn)); } const auto lm2 = QFileInfo(fn).lastModified(); QVERIFY(lm2.isValid()); QCOMPARE(lm, lm2); // timestamps should be the same since content did not change waitForNewTimestamp("."); { Internal::FileSaver fs(fn); QVERIFY(fs.open()); QVERIFY(fs.device()); QVERIFY(fs.write("hello2")); QVERIFY(fs.commit()); QVERIFY(QFile::exists(fn)); QFile f(fn); QVERIFY(f.open(QIODevice::ReadOnly)); QCOMPARE(f.readAll(), QByteArrayLiteral("hello2")); } const auto lm3 = QFileInfo(fn).lastModified(); QVERIFY(lm3.isValid()); QVERIFY(lm != lm3); // timestamps should differ since the content changed waitForNewTimestamp("."); { // Test overwriteIfUnchanged Internal::FileSaver fs(fn, true); QVERIFY(fs.open()); QVERIFY(fs.device()); QVERIFY(fs.write("hello2")); QVERIFY(fs.commit()); QVERIFY(QFile::exists(fn)); QFile f(fn); QVERIFY(f.open(QIODevice::ReadOnly)); QCOMPARE(f.readAll(), QByteArrayLiteral("hello2")); } const auto lm4 = QFileInfo(fn).lastModified(); QVERIFY(lm4.isValid()); QVERIFY(lm3 != lm4); // timestamps should differ since we always overwrite }); } void TestTools::testFileInfo() { QCOMPARE(FileInfo::fileName("C:/waffl/copter.exe"), QString("copter.exe")); QCOMPARE(FileInfo::baseName("C:/waffl/copter.exe.lib"), QString("copter")); QCOMPARE(FileInfo::completeBaseName("C:/waffl/copter.exe.lib"), QString("copter.exe")); QCOMPARE(FileInfo::suffix("C:/waffl/copter.exe.lib"), QString("lib")); QCOMPARE(FileInfo::completeSuffix("C:/waffl/copter.exe.lib"), QString("exe.lib")); QCOMPARE(FileInfo::path("abc"), QString(".")); QCOMPARE(FileInfo::path("/abc/lol"), QString("/abc")); QCOMPARE(FileInfo::path("/fileInRoot"), QString(QLatin1Char('/'))); if (HostOsInfo::isWindowsHost()) QCOMPARE(FileInfo::path("C:/fileInDriveRoot"), QString("C:/")); QVERIFY(!FileInfo::isAbsolute("bla/lol")); QVERIFY(FileInfo::isAbsolute("/bla/lol")); if (HostOsInfo::isWindowsHost()) { QVERIFY(FileInfo::isAbsolute("C:\\bla\\lol")); QVERIFY(FileInfo::isAbsolute("C:\\")); QVERIFY(FileInfo::isAbsolute("C:/")); QVERIFY(!FileInfo::isAbsolute("C:")); } QCOMPARE(FileInfo::resolvePath("/abc/lol", "waffl"), QString("/abc/lol/waffl")); QCOMPARE(FileInfo::resolvePath("/abc/def/ghi/jkl/", "../foo/bar"), QString("/abc/def/ghi/foo/bar")); QCOMPARE(FileInfo::resolvePath("/abc/def/ghi/jkl/", "../../foo/bar"), QString("/abc/def/foo/bar")); QCOMPARE(FileInfo::resolvePath("/abc", "../../../foo/bar"), QString("/foo/bar")); if (HostOsInfo::isWindowsHost()) { QCOMPARE(FileInfo::resolvePath("C:/share", ".."), QString("C:/")); QCOMPARE(FileInfo::resolvePath("C:/share", "D:/"), QString("D:/")); QCOMPARE(FileInfo::resolvePath("C:/share", "D:"), QString()); // should soft-assert } QCOMPARE(FileInfo("/does/not/exist").lastModified(), FileTime()); } void TestTools::fileCaseCheck() { QTemporaryFile tempFile(QDir::tempPath() + QLatin1String("/CamelCase")); QVERIFY2(tempFile.open(), qPrintable(tempFile.errorString())); QFileInfo tempFileInfo(tempFile.fileName()); const QString lowerFilePath = tempFileInfo.absolutePath() + QLatin1Char('/') + tempFileInfo.fileName().toLower(); const QString upperFilePath = tempFileInfo.absolutePath() + QLatin1Char('/') + tempFileInfo.fileName().toUpper(); QVERIFY(FileInfo::isFileCaseCorrect(tempFileInfo.absoluteFilePath())); if (QFile::exists(lowerFilePath)) QVERIFY(!FileInfo::isFileCaseCorrect(lowerFilePath)); if (QFile::exists(upperFilePath)) QVERIFY(!FileInfo::isFileCaseCorrect(upperFilePath)); } void TestTools::testProfiles() { TemporaryProfile tpp("parent", m_settings); Profile parentProfile = tpp.p; TemporaryProfile tpc("child", m_settings); Profile childProfile = tpc.p; parentProfile.removeBaseProfile(); parentProfile.remove("testKey"); QCOMPARE(parentProfile.value("testKey", "none").toString(), QLatin1String("none")); parentProfile.setValue("testKey", "testValue"); QCOMPARE(parentProfile.value("testKey").toString(), QLatin1String("testValue")); childProfile.remove("testKey"); childProfile.removeBaseProfile(); QCOMPARE(childProfile.value("testKey", "none").toString(), QLatin1String("none")); childProfile.setBaseProfile("parent"); QCOMPARE(childProfile.value("testKey").toString(), QLatin1String("testValue")); // Change base profile and check if the inherited value also changes. TemporaryProfile tpf("foo", m_settings); Profile fooProfile = tpf.p; fooProfile.setValue("testKey", "gnampf"); childProfile.setBaseProfile("foo"); QCOMPARE(childProfile.value("testKey", "none").toString(), QLatin1String("gnampf")); ErrorInfo errorInfo; childProfile.setBaseProfile("SmurfAlongWithMe"); childProfile.value("blubb", QString(), &errorInfo); QVERIFY(errorInfo.hasError()); errorInfo.clear(); childProfile.setBaseProfile("parent"); parentProfile.setBaseProfile("child"); QVERIFY(!childProfile.value("blubb", QString(), &errorInfo).isValid()); QVERIFY(errorInfo.hasError()); QVERIFY(!childProfile.allKeys(Profile::KeySelectionNonRecursive).empty()); errorInfo.clear(); QVERIFY(childProfile.allKeys(Profile::KeySelectionRecursive, &errorInfo).empty()); QVERIFY(errorInfo.hasError()); } void TestTools::testSettingsMigration() { QFETCH(QString, baseDir); QFETCH(bool, hasOldSettings); Settings settings(baseDir); if (hasOldSettings) { // checks that we do not copy old "profiles/" dir anymore QVERIFY(!QFileInfo(settings.baseDirectory() + "/qbs/" QBS_VERSION "/profiles/right.txt") .exists()); QVERIFY(!settings.value("key", Settings::UserScope).toString().isEmpty()); } else { QVERIFY(!QFileInfo(settings.baseDirectory() + "/qbs/" QBS_VERSION "/profiles").exists()); QVERIFY(settings.allKeys(Settings::UserScope).empty()); } } void TestTools::testSettingsMigration_data() { QTest::addColumn("baseDir"); QTest::addColumn("hasOldSettings"); QTest::newRow("settings dir with lots of versions") << setupSettingsDir1() << true; QTest::newRow("settings dir with only a fallback") << setupSettingsDir2() << true; QTest::newRow("no previous settings") << setupSettingsDir3() << false; } QString TestTools::setupSettingsDir1() { const auto baseDir = new QTemporaryDir; m_tmpDirs.push_back(baseDir); const Version thisVersion = Version::fromString(QBS_VERSION); Version predecessor; if (thisVersion.patchLevel() > 0) { predecessor.setMajorVersion(thisVersion.majorVersion()); predecessor.setMinorVersion(thisVersion.minorVersion()); predecessor.setPatchLevel(thisVersion.patchLevel() - 1); } else if (thisVersion.minorVersion() > 0) { predecessor.setMajorVersion(thisVersion.majorVersion()); predecessor.setMinorVersion(thisVersion.minorVersion() - 1); predecessor.setPatchLevel(99); } else { predecessor.setMajorVersion(thisVersion.majorVersion() - 1); predecessor.setMajorVersion(99); predecessor.setPatchLevel(99); } const auto versions = QList() << Version(0, 1, 0) << Version(1, 0, 5) << predecessor << Version(thisVersion.majorVersion() + 1, thisVersion.minorVersion(), thisVersion.patchLevel()) << Version(thisVersion.majorVersion(), thisVersion.minorVersion() + 1, thisVersion.patchLevel()) << Version(thisVersion.majorVersion(), thisVersion.minorVersion(), thisVersion.patchLevel() + 1) << Version(99, 99, 99); for (const Version &v : versions) { const QString settingsDir = baseDir->path() + "/qbs/" + v.toString(); QSettings s(settingsDir + "/qbs.conf", HostOsInfo::isWindowsHost() ? QSettings::IniFormat : QSettings::NativeFormat); const QString profilesDir = settingsDir + "/profiles"; QDir::root().mkpath(profilesDir); const QString magicString = v == predecessor ? "right" : "wrong"; QFile f(profilesDir + '/' + magicString + ".txt"); f.open(QIODevice::WriteOnly); s.setValue("org/qt-project/qbs/key", profilesDir + magicString); } return baseDir->path(); } QString TestTools::setupSettingsDir2() { const auto baseDir = new QTemporaryDir; m_tmpDirs.push_back(baseDir); const QString settingsDir = baseDir->path(); QSettings s(settingsDir + QLatin1String("/qbs.conf"), HostOsInfo::isWindowsHost() ? QSettings::IniFormat : QSettings::NativeFormat); const QString profilesDir = settingsDir + QLatin1String("/qbs/profiles"); QDir::root().mkpath(profilesDir); QFile f(profilesDir + "/right.txt"); f.open(QIODevice::WriteOnly); s.setValue("org/qt-project/qbs/key", profilesDir + "right"); return baseDir->path(); } QString TestTools::setupSettingsDir3() { const auto baseDir = new QTemporaryDir; m_tmpDirs.push_back(baseDir); return baseDir->path(); } void TestTools::testBuildConfigMerging() { TemporaryProfile tp(QLatin1String("tst_tools_profile"), m_settings); Profile profile = tp.p; profile.setValue(QStringLiteral("topLevelKey"), QStringLiteral("topLevelValue")); profile.setValue(QStringLiteral("qbs.toolchain"), QStringLiteral("gcc")); profile.setValue(QStringLiteral("qbs.architecture"), QStringLiteral("Jean-Claude Pillemann")); profile.setValue(QStringLiteral("cpp.treatWarningsAsErrors"), true); QVariantMap overrideMap; overrideMap.insert(QStringLiteral("qbs.toolchain"), QStringLiteral("clang")); overrideMap.insert(QStringLiteral("qbs.installRoot"), QStringLiteral("/blubb")); SetupProjectParameters params; params.setSettingsDirectory(m_settings->baseDirectory()); params.setTopLevelProfile(profile.name()); params.setConfigurationName(QStringLiteral("debug")); params.setOverriddenValues(overrideMap); const ErrorInfo error = params.expandBuildConfiguration(); QVERIFY2(!error.hasError(), qPrintable(error.toString())); const QVariantMap finalMap = params.finalBuildConfigurationTree(); QCOMPARE(finalMap.size(), 3); QCOMPARE(finalMap.value(QStringLiteral("topLevelKey")).toString(), QStringLiteral("topLevelValue")); const QVariantMap finalQbsMap = finalMap.value(QStringLiteral("qbs")).toMap(); QCOMPARE(finalQbsMap.size(), 4); QCOMPARE(finalQbsMap.value(QStringLiteral("toolchain")).toString(), QStringLiteral("clang")); QCOMPARE(finalQbsMap.value(QStringLiteral("configurationName")).toString(), QStringLiteral("debug")); QCOMPARE(finalQbsMap.value(QStringLiteral("architecture")).toString(), QStringLiteral("Jean-Claude Pillemann")); QCOMPARE(finalQbsMap.value(QStringLiteral("installRoot")).toString(), QLatin1String("/blubb")); const QVariantMap finalCppMap = finalMap.value(QStringLiteral("cpp")).toMap(); QCOMPARE(finalCppMap.size(), 1); QCOMPARE(finalCppMap.value(QStringLiteral("treatWarningsAsErrors")).toBool(), true); } void TestTools::testProcessNameByPid() { QCOMPARE(qAppName(), processNameByPid(QCoreApplication::applicationPid())); } int toNumber(const QString &str) { int res = 0; for (const QChar &c : str) res = (res * 10) + c.digitValue(); return res; } void TestTools::set_operator_eq() { { Set set1, set2; QVERIFY(set1 == set2); QVERIFY(!(set1 != set2)); set1.insert(1); QVERIFY(set1 != set2); QVERIFY(!(set1 == set2)); set2.insert(1); QVERIFY(set1 == set2); QVERIFY(!(set1 != set2)); set2.insert(1); QVERIFY(set1 == set2); QVERIFY(!(set1 != set2)); set1.insert(2); QVERIFY(set1 != set2); QVERIFY(!(set1 == set2)); } { Set set1, set2; QVERIFY(set1 == set2); QVERIFY(!(set1 != set2)); set1.insert("one"); QVERIFY(set1 != set2); QVERIFY(!(set1 == set2)); set2.insert("one"); QVERIFY(set1 == set2); QVERIFY(!(set1 != set2)); set2.insert("one"); QVERIFY(set1 == set2); QVERIFY(!(set1 != set2)); set1.insert("two"); QVERIFY(set1 != set2); QVERIFY(!(set1 == set2)); } { Set a; Set b; a += "otto"; b += "willy"; QVERIFY(a != b); QVERIFY(!(a == b)); } { Set s1, s2; s1.reserve(100); s2.reserve(4); QVERIFY(s1 == s2); s1 << 100 << 200 << 300 << 400; s2 << 400 << 300 << 200 << 100; QVERIFY(s1 == s2); } } void TestTools::set_swap() { Set s1, s2; s1.insert(1); s2.insert(2); s1.swap(s2); QCOMPARE(*s1.begin(),2); QCOMPARE(*s2.begin(),1); } void TestTools::set_size() { Set set; QVERIFY(set.size() == 0); QVERIFY(set.empty()); QVERIFY(set.size() == set.size()); set.insert(1); QVERIFY(set.size() == 1); QVERIFY(!set.empty()); QVERIFY(set.size() == set.size()); set.insert(1); QVERIFY(set.size() == 1); QVERIFY(!set.empty()); QVERIFY(set.size() == set.size()); set.insert(2); QVERIFY(set.size() == 2); QVERIFY(!set.empty()); QVERIFY(set.size() == set.size()); set.remove(1); QVERIFY(set.size() == 1); QVERIFY(!set.empty()); QVERIFY(set.size() == set.size()); set.remove(1); QVERIFY(set.size() == 1); QVERIFY(!set.empty()); QVERIFY(set.size() == set.size()); set.remove(2); QVERIFY(set.size() == 0); QVERIFY(set.empty()); QVERIFY(set.size() == set.size()); } void TestTools::set_capacity() { Set set; size_t n = set.capacity(); QVERIFY(n == 0); for (int i = 0; i < 1000; ++i) { set.insert(i); QVERIFY(set.capacity() >= set.size()); } } void TestTools::set_reserve() { Set set; set.reserve(1000); QVERIFY(set.capacity() >= 1000); for (int i = 0; i < 500; ++i) set.insert(i); QVERIFY(set.capacity() >= 1000); for (int j = 0; j < 500; ++j) set.remove(j); QVERIFY(set.capacity() >= 1000); } void TestTools::set_clear() { Set set1, set2; QVERIFY(set1.size() == 0); set1.clear(); QVERIFY(set1.size() == 0); set1.insert("foo"); QVERIFY(set1.size() != 0); set2 = set1; set1.clear(); QVERIFY(set1.size() == 0); QVERIFY(set2.size() != 0); set2.clear(); QVERIFY(set1.size() == 0); QVERIFY(set2.size() == 0); } void TestTools::set_remove() { Set set1; const size_t max = 500; for (size_t i = 0; i < max; ++i) set1.insert(QString::number(i)); QCOMPARE(set1.size(), max); for (size_t j = 0; j < max; ++j) { set1.remove(QString::number((j * 17) % max)); QCOMPARE(set1.size(), max - j - 1); } } void TestTools::set_contains() { Set set1; for (int i = 0; i < 500; ++i) { QVERIFY(!set1.contains(QString::number(i))); set1.insert(QString::number(i)); QVERIFY(set1.contains(QString::number(i))); } QCOMPARE(set1.size(), size_t { 500 }); for (int j = 0; j < 500; ++j) { int i = (j * 17) % 500; QVERIFY(set1.contains(QString::number(i))); set1.remove(QString::number(i)); QVERIFY(!set1.contains(QString::number(i))); } } void TestTools::set_containsSet() { Set set1; Set set2; // empty set contains the empty set QVERIFY(set1.contains(set2)); for (int i = 0; i < 500; ++i) { set1.insert(QString::number(i)); set2.insert(QString::number(i)); } QVERIFY(set1.contains(set2)); set2.remove(QString::number(19)); set2.remove(QString::number(82)); set2.remove(QString::number(7)); QVERIFY(set1.contains(set2)); set1.remove(QString::number(23)); QVERIFY(!set1.contains(set2)); // filled set contains the empty set as well Set set3; QVERIFY(set1.contains(set3)); // the empty set doesn't contain a filled set QVERIFY(!set3.contains(set1)); // verify const signature const Set set4; QVERIFY(set3.contains(set4)); } void TestTools::set_find() { Set set1; for (int i = 0; i < 500; ++i) { QVERIFY(set1.find(QString::number(i)) == set1.end()); set1.insert(QString::number(i)); const auto it = set1.find(QString::number(i)); QVERIFY(it != set1.end()); QVERIFY(*it == QString::number(i)); } QCOMPARE(set1.size(), size_t { 500 }); for (int j = 0; j < 500; ++j) { int i = (j * 17) % 500; const auto it = set1.find(QString::number(i)); QVERIFY(it != set1.end()); QVERIFY(*it == QString::number(i)); set1.remove(QString::number(i)); QVERIFY(set1.find(QString::number(i)) == set1.end()); } } void TestTools::set_begin() { Set set1; Set set2 = set1; { const auto i = set1.constBegin(); const auto j = set1.cbegin(); const auto k = set2.constBegin(); const auto ell = set2.cbegin(); QVERIFY(i == j); QVERIFY(k == ell); } set1.insert(44); { const auto i = set1.constBegin(); const auto j = set1.cbegin(); const auto k = set2.constBegin(); const auto ell = set2.cbegin(); QVERIFY(i == j); QVERIFY(k == ell); } set2 = set1; { const auto i = set1.constBegin(); const auto j = set1.cbegin(); const auto k = set2.constBegin(); const auto ell = set2.cbegin(); QVERIFY(i == j); QVERIFY(k == ell); } } void TestTools::set_end() { Set set1; Set set2 = set1; { const auto i = set1.constEnd(); const auto j = set1.cend(); const auto k = set2.constEnd(); const auto ell = set2.cend(); QVERIFY(i == j); QVERIFY(k == ell); QVERIFY(set1.constBegin() == set1.constEnd()); QVERIFY(set2.constBegin() == set2.constEnd()); } set1.insert(44); { const auto i = set1.constEnd(); const auto j = set1.cend(); const auto k = set2.constEnd(); const auto ell = set2.cend(); QVERIFY(i == j); QVERIFY(k == ell); QVERIFY(set1.constBegin() != set1.constEnd()); QVERIFY(set2.constBegin() == set2.constEnd()); } set2 = set1; { const auto i = set1.constEnd(); const auto j = set1.cend(); const auto k = set2.constEnd(); const auto ell = set2.cend(); QVERIFY(i == j); QVERIFY(k == ell); QVERIFY(set1.constBegin() != set1.constEnd()); QVERIFY(set2.constBegin() != set2.constEnd()); } set1.clear(); set2.clear(); QVERIFY(set1.constBegin() == set1.constEnd()); QVERIFY(set2.constBegin() == set2.constEnd()); } struct IdentityTracker { int value, id; }; inline bool operator==(IdentityTracker lhs, IdentityTracker rhs) { return lhs.value == rhs.value; } inline bool operator<(IdentityTracker lhs, IdentityTracker rhs) { return lhs.value < rhs.value; } void TestTools::set_insert() { { Set set1; QVERIFY(set1.size() == 0); set1.insert(1); QVERIFY(set1.size() == 1); set1.insert(2); QVERIFY(set1.size() == 2); set1.insert(2); QVERIFY(set1.size() == 2); QVERIFY(set1.contains(2)); set1.remove(2); QVERIFY(set1.size() == 1); QVERIFY(!set1.contains(2)); set1.insert(2); QVERIFY(set1.size() == 2); QVERIFY(set1.contains(2)); } { Set set1; QVERIFY(set1.size() == 0); set1 << 1; QVERIFY(set1.size() == 1); set1 << 2; QVERIFY(set1.size() == 2); set1 << 2; QVERIFY(set1.size() == 2); QVERIFY(set1.contains(2)); set1.remove(2); QVERIFY(set1.size() == 1); QVERIFY(!set1.contains(2)); set1 << 2; QVERIFY(set1.size() == 2); QVERIFY(set1.contains(2)); } { Set set; QCOMPARE(set.size(), size_t { 0 }); const int dummy = -1; IdentityTracker id00 = {0, 0}, id01 = {0, 1}, searchKey = {0, dummy}; QCOMPARE(set.insert(id00).first->id, id00.id); QCOMPARE(set.size(), size_t { 1 }); QCOMPARE(set.insert(id01).first->id, id00.id); // first inserted is kept QCOMPARE(set.size(), size_t { 1 }); QCOMPARE(set.find(searchKey)->id, id00.id); } } void TestTools::set_reverseIterators() { Set s; s << 1 << 17 << 61 << 127 << 911; std::vector v(s.begin(), s.end()); std::reverse(v.begin(), v.end()); const Set &cs = s; QVERIFY(std::equal(v.begin(), v.end(), s.rbegin())); QVERIFY(std::equal(v.begin(), v.end(), s.crbegin())); QVERIFY(std::equal(v.begin(), v.end(), cs.rbegin())); QVERIFY(std::equal(s.rbegin(), s.rend(), v.begin())); QVERIFY(std::equal(s.crbegin(), s.crend(), v.begin())); QVERIFY(std::equal(cs.rbegin(), cs.rend(), v.begin())); } void TestTools::set_stlIterator() { Set set1; for (int i = 0; i < 25000; ++i) set1.insert(QString::number(i)); { int sum = 0; auto i = set1.cbegin(); while (i != set1.end()) { sum += toNumber(*i); ++i; } QVERIFY(sum == 24999 * 25000 / 2); } { int sum = 0; auto i = set1.cend(); while (i != set1.begin()) { --i; sum += toNumber(*i); } QVERIFY(sum == 24999 * 25000 / 2); } } void TestTools::set_stlMutableIterator() { Set set1; for (int i = 0; i < 25000; ++i) set1.insert(QString::number(i)); { int sum = 0; auto i = set1.begin(); while (i != set1.end()) { sum += toNumber(*i); ++i; } QVERIFY(sum == 24999 * 25000 / 2); } { int sum = 0; auto i = set1.end(); while (i != set1.begin()) { --i; sum += toNumber(*i); } QVERIFY(sum == 24999 * 25000 / 2); } { Set set2 = set1; Set set3 = set2; auto i = set2.begin(); auto j = set3.begin(); while (i != set2.end()) { i = set2.erase(i); } QVERIFY(set2.empty()); QVERIFY(!set3.empty()); j = set3.end(); while (j != set3.begin()) { j--; if (j + 1 != set3.end()) set3.erase(j + 1); } if (set3.begin() != set3.end()) set3.erase(set3.begin()); QVERIFY(set2.empty()); QVERIFY(set3.empty()); i = set2.insert("foo").first; QCOMPARE(*i, QLatin1String("foo")); } } void TestTools::set_setOperations() { Set set1, set2; set1 << "alpha" << "beta" << "gamma" << "delta" << "zeta" << "omega"; set2 << "beta" << "gamma" << "delta" << "epsilon" << "iota" << "omega"; Set set3 = set1; set3.unite(set2); QVERIFY(set3.size() == 8); QVERIFY(set3.contains("alpha")); QVERIFY(set3.contains("beta")); QVERIFY(set3.contains("gamma")); QVERIFY(set3.contains("delta")); QVERIFY(set3.contains("epsilon")); QVERIFY(set3.contains("zeta")); QVERIFY(set3.contains("iota")); QVERIFY(set3.contains("omega")); Set set4 = set2; set4.unite(set1); QVERIFY(set4.size() == 8); QVERIFY(set4.contains("alpha")); QVERIFY(set4.contains("beta")); QVERIFY(set4.contains("gamma")); QVERIFY(set4.contains("delta")); QVERIFY(set4.contains("epsilon")); QVERIFY(set4.contains("zeta")); QVERIFY(set4.contains("iota")); QVERIFY(set4.contains("omega")); QVERIFY(set3 == set4); Set set5 = set1; set5.intersect(set2); QVERIFY(set5.size() == 4); QVERIFY(set5.contains("beta")); QVERIFY(set5.contains("gamma")); QVERIFY(set5.contains("delta")); QVERIFY(set5.contains("omega")); Set set6 = set2; set6.intersect(set1); QVERIFY(set6.size() == 4); QVERIFY(set6.contains("beta")); QVERIFY(set6.contains("gamma")); QVERIFY(set6.contains("delta")); QVERIFY(set6.contains("omega")); QVERIFY(set5 == set6); Set set7 = set1; set7.subtract(set2); QVERIFY(set7.size() == 2); QVERIFY(set7.contains("alpha")); QVERIFY(set7.contains("zeta")); Set set8 = set2; set8.subtract(set1); QVERIFY(set8.size() == 2); QVERIFY(set8.contains("epsilon")); QVERIFY(set8.contains("iota")); Set set9 = set1 | set2; QVERIFY(set9 == set3); Set set10 = set1 & set2; QVERIFY(set10 == set5); Set set11 = set1 + set2; QVERIFY(set11 == set3); Set set12 = set1 - set2; QVERIFY(set12 == set7); Set set13 = set2 - set1; QVERIFY(set13 == set8); Set set14 = set1; set14 |= set2; QVERIFY(set14 == set3); Set set15 = set1; set15 &= set2; QVERIFY(set15 == set5); Set set16 = set1; set16 += set2; QVERIFY(set16 == set3); Set set17 = set1; set17 -= set2; QVERIFY(set17 == set7); Set set18 = set2; set18 -= set1; QVERIFY(set18 == set8); } void TestTools::set_makeSureTheComfortFunctionsCompile() { Set set1, set2, set3; set1 << 5; set1 |= set2; set1 |= 5; set1 &= set2; set1 &= 5; set1 += set2; set1 += 5; set1 -= set2; set1 -= 5; set1 = set2 | set3; set1 = set2 & set3; set1 = set2 + set3; set1 = set2 - set3; } void TestTools::set_initializerList() { Set set = {1, 1, 2, 3, 4, 5}; QCOMPARE(set.size(), size_t { 5 }); QVERIFY(set.contains(1)); QVERIFY(set.contains(2)); QVERIFY(set.contains(3)); QVERIFY(set.contains(4)); QVERIFY(set.contains(5)); // check _which_ of the equal elements gets inserted (in the QHash/QMap case, it's the last): const Set set2 = {{1, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}; QCOMPARE(set2.size(), size_t { 5 }); const int dummy = -1; const IdentityTracker searchKey = {1, dummy}; QCOMPARE(set2.find(searchKey)->id, 0); Set emptySet{}; QVERIFY(emptySet.empty()); Set set3{{}, {}, {}}; QVERIFY(!set3.empty()); } void TestTools::set_intersects() { Set s1; Set s2; QVERIFY(!s1.intersects(s1)); QVERIFY(!s1.intersects(s2)); s1 << 100; QVERIFY(s1.intersects(s1)); QVERIFY(!s1.intersects(s2)); s2 << 200; QVERIFY(!s1.intersects(s2)); s1 << 200; QVERIFY(s1.intersects(s2)); Set s3; s3 << 500; QVERIFY(!s1.intersects(s3)); s3 << 200; QVERIFY(s1.intersects(s3)); } void TestTools::stringutils_join() { QFETCH(std::vector, input); QFETCH(std::string, separator); QFETCH(std::string, expectedResult); QCOMPARE(join(input, separator), expectedResult); } void TestTools::stringutils_join_data() { QTest::addColumn>("input"); QTest::addColumn("separator"); QTest::addColumn("expectedResult"); QTest::newRow("data1") << std::vector() << std::string() << std::string(); QTest::newRow("data2") << std::vector() << std::string("separator") << std::string(); QTest::newRow("data3") << std::vector({"one"}) << std::string("separator") << std::string("one"); QTest::newRow("data4") << std::vector({"one"}) << std::string("separator") << std::string("one"); QTest::newRow("data5") << std::vector({"a", "b"}) << std::string(" ") << std::string("a b"); QTest::newRow("data6") << std::vector({"a", "b", "c"}) << std::string(" ") << std::string("a b c"); } void TestTools::stringutils_join_empty() { std::vector list; std::string string = join(list, std::string()); QVERIFY(string.empty()); } void TestTools::stringutils_join_char() { QFETCH(std::vector, input); QFETCH(char, separator); QFETCH(std::string, expectedResult); QCOMPARE(join(input, separator), expectedResult); } void TestTools::stringutils_join_char_data() { QTest::addColumn>("input"); QTest::addColumn("separator"); QTest::addColumn("expectedResult"); QTest::newRow("data1") << std::vector() << ' ' << std::string(); QTest::newRow("data5") << std::vector({"a", "b"}) << ' ' << std::string("a b"); QTest::newRow("data6") << std::vector({"a", "b", "c"}) << ' ' << std::string("a b c"); } void TestTools::stringutils_trimmed() { std::string a; a = "Text"; QCOMPARE(a, std::string("Text")); QCOMPARE(trimmed(a), std::string("Text")); QCOMPARE(a, std::string("Text")); a = " "; QCOMPARE(trimmed(a), std::string("")); QCOMPARE(a, std::string(" ")); a = " a "; QCOMPARE(trimmed(a), std::string("a")); a = "Text"; QCOMPARE(trimmed(std::move(a)), std::string("Text")); a = " "; QCOMPARE(trimmed(std::move(a)), std::string("")); a = " a "; QCOMPARE(trimmed(std::move(a)), std::string("a")); } void TestTools::hash_tuple() { using Key = std::tuple; Key key0{0, 5}; Key key1{10, 20}; Key key2{30, 40}; std::unordered_map map; map.insert({key1, 1}); map.insert({key2, 2}); QCOMPARE(map[key0], 0); QCOMPARE(map[key1], 1); QCOMPARE(map[key2], 2); } void TestTools::hash_range() { using Key = std::vector; Key key0; Key key1{1}; Key key2{1, 2}; std::unordered_map map; map.insert({key1, 1}); map.insert({key2, 2}); QCOMPARE(map[key0], 0); QCOMPARE(map[key1], 1); QCOMPARE(map[key2], 2); } void TestTools::span() { std::vector vec; qbs::Internal::span span(vec); } int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); const SettingsPtr s = settings(); TestTools tt(s.get()); return QTest::qExec(&tt, argc, argv); } qbs-src-3.2.0/tests/auto/tools/CMakeLists.txt0000644000175100017510000000020415154533055020510 0ustar runnerrunneradd_qbs_test(tools DEFINES "QBS_VERSION=\"${QBS_VERSION}\"" SOURCES tst_tools.cpp tst_tools.h ) qbs-src-3.2.0/tests/auto/tools/tools.qbs0000644000175100017510000000045515154533055017627 0ustar runnerrunnerimport qbs.Utilities QbsUnittest { Depends { name: "qbsversion" } testName: "tools" condition: qbsbuildconfig.enableUnitTests files: [ "tst_tools.cpp", "tst_tools.h" ] cpp.defines: base.concat(["QBS_VERSION=" + Utilities.cStringQuote(qbsversion.version)]) } qbs-src-3.2.0/tests/auto/tools/tst_tools.h0000644000175100017510000000663515154533055020171 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include #include QT_BEGIN_NAMESPACE class QTemporaryDir; QT_END_NAMESPACE namespace qbs { class Settings; } class TestTools : public QObject { Q_OBJECT public: TestTools(qbs::Settings *settings); ~TestTools(); public slots: virtual void initTestCase(); private slots: void fileSaver(); void fileCaseCheck(); void testBuildConfigMerging(); void testFileInfo(); void testProcessNameByPid(); void testProfiles(); void testSettingsMigration(); void testSettingsMigration_data(); void set_operator_eq(); void set_swap(); void set_size(); void set_capacity(); void set_reserve(); void set_clear(); void set_remove(); void set_contains(); void set_containsSet(); void set_find(); void set_begin(); void set_end(); void set_insert(); void set_reverseIterators(); void set_stlIterator(); void set_stlMutableIterator(); void set_setOperations(); void set_makeSureTheComfortFunctionsCompile(); void set_initializerList(); void set_intersects(); void stringutils_join(); void stringutils_join_data(); void stringutils_join_empty(); void stringutils_join_char(); void stringutils_join_char_data(); void stringutils_trimmed(); void hash_tuple(); void hash_range(); void span(); private: QString setupSettingsDir1(); QString setupSettingsDir2(); QString setupSettingsDir3(); qbs::Settings * const m_settings; QList m_tmpDirs; const QString testDataDir; }; qbs-src-3.2.0/tests/benchmarker/0000755000175100017510000000000015154533055016125 5ustar runnerrunnerqbs-src-3.2.0/tests/benchmarker/valgrindrunner.h0000644000175100017510000000622315154533055021341 0ustar runnerrunner/**************************************************************************** ** ** 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 QBS_BENCHMARKER_BENCHMARKRUNNER_H #define QBS_BENCHMARKER_BENCHMARKRUNNER_H #include "activities.h" #include #include namespace qbsBenchmarker { class ValgrindResult { public: ValgrindResult(Activity a, qint64 ic, qint64 mem) : activity(a), instructionCount(ic), peakMemoryUsage(mem) {} Activity activity; qint64 instructionCount; qint64 peakMemoryUsage; }; class ValgrindRunner { public: ValgrindRunner( Activities activities, QString testProject, const QString &qbsBuildDir, const QString &baseOutputDir, bool sequential); void run(); QList results() const { return m_results; } private: void traceResolving(); void traceRuleExecution(); void traceNullBuild(); void traceActivity(Activity activity, const QString &buildDirCallgrind, const QString &buildDirMassif); QStringList qbsCommandLine(const QString &command, const QString &buildDir, bool dryRun) const; QStringList wrapForValgrind(const QStringList &commandLine, const QString &tool, const QString &outFile) const; QStringList valgrindCommandLine(const QString &qbsCommand, const QString &buildDir, bool dryRun, const QString &tool, const QString &outFile) const; void addToResults(const ValgrindResult &results); qint64 runCallgrind(const QString &qbsCommand, const QString &buildDir, bool dryRun, const QString &outFile); qint64 runMassif(const QString &qbsCommand, const QString &buildDir, bool dryRun, const QString &outFile); const Activities m_activities; const QString m_testProject; const QString m_qbsBinary; const QString m_baseOutputDir; const bool m_sequential; QList m_results; std::mutex m_resultsMutex; }; } // namespace qbsBenchmarker #endif // Include guard. qbs-src-3.2.0/tests/benchmarker/valgrindrunner.cpp0000644000175100017510000002560715154533055021703 0ustar runnerrunner/**************************************************************************** ** ** 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 "valgrindrunner.h" #include "exception.h" #include "runsupport.h" #include #include #include #include #include #include #include #include #include namespace qbsBenchmarker { ValgrindRunner::ValgrindRunner( Activities activities, QString testProject, const QString &qbsBuildDir, const QString &baseOutputDir, bool sequential) : m_activities(activities) , m_testProject(std::move(testProject)) , m_qbsBinary(qbsBuildDir + "/benchmarker/install-root/bin/qbs") , m_baseOutputDir(baseOutputDir) , m_sequential(sequential) { if (!QDir::root().mkpath(m_baseOutputDir)) throw Exception(QStringLiteral("Failed to create directory '%1'.").arg(baseOutputDir)); } void ValgrindRunner::run() { if (m_sequential) { if (m_activities & ActivityResolving) traceResolving(); if (m_activities & ActivityRuleExecution) traceRuleExecution(); if (m_activities & ActivityNullBuild) traceNullBuild(); return; } std::deque> futures; if (m_activities & ActivityResolving) futures.push_back(QtConcurrent::run([this]{ traceResolving(); })); if (m_activities & ActivityRuleExecution) futures.push_back(QtConcurrent::run([this]{ traceRuleExecution(); })); if (m_activities & ActivityNullBuild) futures.push_back(QtConcurrent::run([this]{ traceNullBuild(); })); while (!futures.empty()) { futures.front().waitForFinished(); futures.pop_front(); } } void ValgrindRunner::traceResolving() { const QString buildDirCallgrind = m_baseOutputDir + "/build-dir.resolving.callgrind"; const QString buildDirMassif = m_baseOutputDir + "/build-dir.resolving.massif"; traceActivity(ActivityResolving, buildDirCallgrind, buildDirMassif); } void ValgrindRunner::traceRuleExecution() { const QString buildDirCallgrind = m_baseOutputDir + "/build-dir.rule-execution.callgrind"; const QString buildDirMassif = m_baseOutputDir + "/build-dir.rule-execution.massif"; runProcess(qbsCommandLine("resolve", buildDirCallgrind, false)); runProcess(qbsCommandLine("resolve", buildDirMassif, false)); traceActivity(ActivityRuleExecution, buildDirCallgrind, buildDirMassif); } void ValgrindRunner::traceNullBuild() { const QString buildDirCallgrind = m_baseOutputDir + "/build-dir.null-build.callgrind"; const QString buildDirMassif = m_baseOutputDir + "/build-dir.null-build.massif"; runProcess(qbsCommandLine("build", buildDirCallgrind, false)); runProcess(qbsCommandLine("build", buildDirMassif, false)); traceActivity(ActivityNullBuild, buildDirCallgrind, buildDirMassif); } void ValgrindRunner::traceActivity(Activity activity, const QString &buildDirCallgrind, const QString &buildDirMassif) { QString activityString; QString qbsCommand; bool dryRun = false; switch (activity) { case ActivityResolving: activityString = "resolving"; qbsCommand = "resolve"; break; case ActivityRuleExecution: activityString = "rule-execution"; qbsCommand = "build"; dryRun = true; break; case ActivityNullBuild: activityString = "null-build"; qbsCommand = "build"; break; } const QString outFileCallgrind = m_baseOutputDir + "/outfile." + activityString + ".callgrind"; const QString outFileMassif = m_baseOutputDir + "/outfile." + activityString + ".massif"; qint64 instructionCount = 0; qint64 memUsage = 0; const auto callgrindRunner = [this, qbsCommand, buildDirCallgrind, dryRun, outFileCallgrind] { return runCallgrind(qbsCommand, buildDirCallgrind, dryRun, outFileCallgrind); }; const auto massifRunner = [this, qbsCommand, buildDirMassif, dryRun, outFileMassif] { return runMassif(qbsCommand, buildDirMassif, dryRun, outFileMassif); }; if (m_sequential) { instructionCount = callgrindRunner(); memUsage = massifRunner(); } else { QFuture callGrindFuture = QtConcurrent::run(callgrindRunner); QFuture massifFuture = QtConcurrent::run(massifRunner); callGrindFuture.waitForFinished(); instructionCount = callGrindFuture.result(); massifFuture.waitForFinished(); memUsage = massifFuture.result(); } addToResults(ValgrindResult(activity, instructionCount, memUsage)); } QStringList ValgrindRunner::qbsCommandLine(const QString &command, const QString &buildDir, bool dryRun) const { QStringList commandLine = QStringList() << m_qbsBinary << command << "-qq" << "-d" << buildDir << "-f" << m_testProject; if (dryRun) commandLine << "--dry-run"; return commandLine; } QStringList ValgrindRunner::wrapForValgrind(const QStringList &commandLine, const QString &tool, const QString &outFile) const { return QStringList() << "valgrind" << "--smc-check=all" << "--trace-children=yes" << ("--tool=" + tool) << ("--" + tool + "-out-file=" + outFile) << commandLine; } QStringList ValgrindRunner::valgrindCommandLine(const QString &qbsCommand, const QString &buildDir, bool dryRun, const QString &tool, const QString &outFile) const { return wrapForValgrind(qbsCommandLine(qbsCommand, buildDir, dryRun), tool, outFile); } void ValgrindRunner::addToResults(const ValgrindResult &result) { std::lock_guard locker(m_resultsMutex); m_results.push_back(result); } qint64 ValgrindRunner::runCallgrind(const QString &qbsCommand, const QString &buildDir, bool dryRun, const QString &outFile) { runProcess(valgrindCommandLine(qbsCommand, buildDir, dryRun, "callgrind", outFile)); QFile f(outFile); if (!f.open(QIODevice::ReadOnly)) { throw Exception(QStringLiteral("Failed to open file '%1': %2") .arg(outFile, f.errorString())); } while (!f.atEnd()) { const QByteArray line = f.readLine().trimmed(); static const QByteArray magicString = "summary: "; if (!line.startsWith(magicString)) continue; const QByteArray icString = line.mid(magicString.size()); bool ok; const qint64 iCount = icString.toLongLong(&ok); if (!ok) { throw Exception(QStringLiteral("Unexpected line in callgrind output file " "'%1': '%2'.") .arg(outFile, QString::fromLocal8Bit(line))); } return iCount; } throw Exception(QStringLiteral("Failed to find summary line in callgrind " "output file '%1'.").arg(outFile)); } qint64 ValgrindRunner::runMassif(const QString &qbsCommand, const QString &buildDir, bool dryRun, const QString &outFile) { runProcess(valgrindCommandLine(qbsCommand, buildDir, dryRun, "massif", outFile)); QByteArray ms_printOutput; runProcess(QStringList() << "ms_print" << outFile, QString(), &ms_printOutput); QBuffer buffer(&ms_printOutput); buffer.open(QIODevice::ReadOnly); QByteArray peakSnapshot; const QString exceptionStringPattern = QStringLiteral("Failed to extract peak memory " "usage from file '%1': %2").arg(outFile); while (!buffer.atEnd()) { const QByteArray line = buffer.readLine(); static const QByteArray magicString = " (peak)"; const int magicStringOffset = line.indexOf(magicString); if (magicStringOffset == -1) continue; int delimiterOffset = line.lastIndexOf(',', magicStringOffset); if (delimiterOffset == -1) delimiterOffset = line.lastIndexOf('[', magicStringOffset); if (delimiterOffset == -1) { const QString details = QStringLiteral("Failed to extract peak snapshot from " "line '%1'.").arg(QString::fromLocal8Bit(line)); throw Exception(exceptionStringPattern.arg(details)); } peakSnapshot = line.mid(delimiterOffset + 1, magicStringOffset - delimiterOffset).trimmed(); break; } if (peakSnapshot.isEmpty()) throw Exception(exceptionStringPattern.arg("No peak marker found")); while (!buffer.atEnd()) { const QByteArray line = buffer.readLine().simplified(); if (!line.startsWith(QByteArray(peakSnapshot + ' '))) continue; const QList entries = line.split(' '); if (entries.size() != 6) { const QString details = QStringLiteral("Expected 6 entries in line '%1', but " "there are %2.").arg(QString::fromLocal8Bit(line)).arg(entries.size()); throw Exception(exceptionStringPattern.arg(details)); } QByteArray peakMemoryString = entries.at(2); peakMemoryString.replace(',', QByteArray()); bool ok; qint64 peakMemoryUsage = peakMemoryString.toLongLong(&ok); if (!ok) { const QString details = QStringLiteral("Failed to parse peak memory value '%1' " "as a number.").arg(QString::fromLocal8Bit(peakMemoryString)); throw Exception(exceptionStringPattern.arg(details)); } return peakMemoryUsage; } const QString details = QStringLiteral("Failed to find snapshot '%1'.") .arg(QString::fromLocal8Bit(peakSnapshot)); throw Exception(exceptionStringPattern.arg(details)); } } // namespace qbsBenchmarker qbs-src-3.2.0/tests/benchmarker/benchmarker.h0000644000175100017510000000505715154533055020566 0ustar runnerrunner/**************************************************************************** ** ** 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 QBS_BENCHMARKER_BENCHMARKER_H #define QBS_BENCHMARKER_BENCHMARKER_H #include "activities.h" #include #include #include #include namespace qbsBenchmarker { class BenchmarkResult { public: qint64 oldInstructionCount; qint64 newInstructionCount; qint64 oldPeakMemoryUsage; qint64 newPeakMemoryUsage; }; using BenchmarkResults = QHash; class Benchmarker { public: Benchmarker( Activities activities, QString oldCommit, QString newCommit, QString testProject, QString qbsRepo, bool sequential); ~Benchmarker(); void benchmark(); void keepRawData() { m_baseOutputDir.setAutoRemove(false ); } BenchmarkResults results() const { return m_results; } QString rawDataBaseDir() const { return m_baseOutputDir.path(); } private: void rememberCurrentRepoState(); void buildQbs(const QString &buildDir) const; const Activities m_activities; const QString m_oldCommit; const QString m_newCommit; const QString m_testProject; const QString m_qbsRepo; const bool m_sequential; QString m_commitToRestore; QTemporaryDir m_baseOutputDir; BenchmarkResults m_results; }; } // namespace qbsBenchmarker #endif // Include guard. qbs-src-3.2.0/tests/benchmarker/benchmarker-main.cpp0000644000175100017510000001205715154533055022041 0ustar runnerrunner/**************************************************************************** ** ** 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 "benchmarker.h" #include "commandlineparser.h" #include "exception.h" #include #include #include using namespace qbsBenchmarker; static bool hasRegression = false; static int relativeChange(qint64 oldVal, qint64 newVal) { return newVal == 0 ? 0 : (newVal - oldVal) * 1000 / oldVal; } static QByteArray relativeChangeString(int change) { QByteArray changeString = QByteArray::number(change / 10); changeString += " % (" + QByteArray::number(change) + " ‰)"; if (change > 0) changeString.prepend('+'); return changeString; } static void printResults(Activity activity, const BenchmarkResults &results, int regressionThreshold) { std::cout << "========== Performance data for "; switch (activity) { case ActivityResolving: std::cout << "Resolving"; break; case ActivityRuleExecution: std::cout << "Rule Execution"; break; case ActivityNullBuild: std::cout << "Null Build"; break; } std::cout << " ==========" << std::endl; const BenchmarkResult result = results.value(activity); const char * const indent = " "; std::cout << indent << "Old instruction count: " << result.oldInstructionCount << std::endl; std::cout << indent << "New instruction count: " << result.newInstructionCount << std::endl; int change = relativeChange(result.oldInstructionCount, result.newInstructionCount); if (change > regressionThreshold) hasRegression = true; std::cout << indent << "Relative change: " << relativeChangeString(change).constData() << std::endl; std::cout << indent << "Old peak memory usage: " << result.oldPeakMemoryUsage << " Bytes" << std::endl; std::cout << indent << "New peak memory usage: " << result.newPeakMemoryUsage << " Bytes" << std::endl; change = relativeChange(result.oldPeakMemoryUsage, result.newPeakMemoryUsage); if (change > regressionThreshold) hasRegression = true; std::cout << indent << "Relative change: " << relativeChangeString(change).constData() << std::endl; } static void printResults(Activities activities, const BenchmarkResults &results, int regressionThreshold) { if (activities & ActivityResolving) printResults(ActivityResolving, results, regressionThreshold); if (activities & ActivityRuleExecution) printResults(ActivityRuleExecution, results, regressionThreshold); if (activities & ActivityNullBuild) printResults(ActivityNullBuild, results, regressionThreshold); } int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); CommandLineParser clParser; try { clParser.parse(); } catch (const Exception &e) { std::cerr << qPrintable(e.description()) << std::endl; return EXIT_FAILURE; } Benchmarker benchmarker( clParser.activies(), clParser.oldCommit(), clParser.newCommit(), clParser.testProjectFilePath(), clParser.qbsRepoDirPath(), clParser.sequential()); try { benchmarker.benchmark(); printResults(clParser.activies(), benchmarker.results(), clParser.regressionThreshold()); if (hasRegression) { benchmarker.keepRawData(); std::cout << "Performance regression detected. Raw benchmarking data available " "under " << qPrintable(benchmarker.rawDataBaseDir()) << '.' << std::endl; } } catch (const Exception &e) { benchmarker.keepRawData(); std::cerr << qPrintable(e.description()) << std::endl; std::cerr << "Build data available under " << qPrintable(benchmarker.rawDataBaseDir()) << '.' << std::endl; return EXIT_FAILURE; } } qbs-src-3.2.0/tests/benchmarker/CMakeLists.txt0000644000175100017510000000057015154533055020667 0ustar runnerrunnerset(SOURCES activities.h benchmarker-main.cpp benchmarker.cpp benchmarker.h commandlineparser.cpp commandlineparser.h exception.h runsupport.cpp runsupport.h valgrindrunner.cpp valgrindrunner.h ) add_qbs_app(qbs_benchmarker DEPENDS Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Concurrent SOURCES ${SOURCES} ) qbs-src-3.2.0/tests/benchmarker/benchmarker.cpp0000644000175100017510000001327515154533055021122 0ustar runnerrunner/**************************************************************************** ** ** 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 "benchmarker.h" #include "exception.h" #include "runsupport.h" #include "valgrindrunner.h" #include #include #include #include namespace qbsBenchmarker { Benchmarker::Benchmarker( Activities activities, QString oldCommit, QString newCommit, QString testProject, QString qbsRepo, bool sequential) : m_activities(activities) , m_oldCommit(std::move(oldCommit)) , m_newCommit(std::move(newCommit)) , m_testProject(std::move(testProject)) , m_qbsRepo(std::move(qbsRepo)) , m_sequential(sequential) { } Benchmarker::~Benchmarker() { if (!m_commitToRestore.isEmpty()) { try { runProcess(QStringList() << "git" << "checkout" << m_commitToRestore, m_qbsRepo); } catch (const Exception &e) { qDebug("Failed to restore original commit %s: %s", qPrintable(m_commitToRestore), qPrintable(e.description())); } } } void Benchmarker::benchmark() { rememberCurrentRepoState(); runProcess(QStringList() << "git" << "checkout" << m_oldCommit, m_qbsRepo); const QString oldQbsBuildDir = m_baseOutputDir.path() + "/qbs-build." + m_oldCommit; std::cout << "Building from old repo state..." << std::endl; buildQbs(oldQbsBuildDir); runProcess(QStringList() << "git" << "checkout" << m_newCommit, m_qbsRepo); const QString newQbsBuildDir = m_baseOutputDir.path() + "/qbs-build." + m_newCommit; std::cout << "Building from new repo state..." << std::endl; buildQbs(newQbsBuildDir); std::cout << "Now running valgrind. This can take a while." << std::endl; ValgrindRunner oldDataRetriever( m_activities, m_testProject, oldQbsBuildDir, m_baseOutputDir.path() + "/benchmark-data." + m_oldCommit, m_sequential); ValgrindRunner newDataRetriever( m_activities, m_testProject, newQbsBuildDir, m_baseOutputDir.path() + "/benchmark-data." + m_newCommit, m_sequential); if (m_sequential) { oldDataRetriever.run(); newDataRetriever.run(); } else { QFuture oldFuture = QtConcurrent::run( [&oldDataRetriever] { oldDataRetriever.run(); }); QFuture newFuture = QtConcurrent::run( [&newDataRetriever] { newDataRetriever.run(); }); oldFuture.waitForFinished(); newFuture.waitForFinished(); } const auto oldValgrindResults = oldDataRetriever.results(); for (const ValgrindResult &valgrindResult : oldValgrindResults) { BenchmarkResult &benchmarkResult = m_results[valgrindResult.activity]; benchmarkResult.oldInstructionCount = valgrindResult.instructionCount; benchmarkResult.oldPeakMemoryUsage = valgrindResult.peakMemoryUsage; } const auto newValgrindResults = newDataRetriever.results(); for (const ValgrindResult &valgrindResult : newValgrindResults) { BenchmarkResult &benchmarkResult = m_results[valgrindResult.activity]; benchmarkResult.newInstructionCount = valgrindResult.instructionCount; benchmarkResult.newPeakMemoryUsage = valgrindResult.peakMemoryUsage; } std::cout << "Done!" << std::endl; } void Benchmarker::rememberCurrentRepoState() { QByteArray commit; int exitCode = 0; try { runProcess(QStringList() << "git" << "symbolic-ref" << "--short" << "HEAD", m_qbsRepo, &commit, &exitCode); } catch (const Exception &) { if (exitCode == 0) { // runProcess did not throw because of the exit code. throw; } // Fallback, in case git cannot retrieve a nice symbolic name. runProcess(QStringList() << "git" << "describe" << "HEAD", m_qbsRepo, &commit); } m_commitToRestore = QString::fromLatin1(commit); } void Benchmarker::buildQbs(const QString &buildDir) const { if (!QDir::root().mkpath(buildDir)) throw Exception(QStringLiteral("Failed to create directory '%1'.").arg(buildDir)); runProcess(QStringList() << QCoreApplication::applicationDirPath() + "/qbs" << "resolve" << "config:benchmarker" << "qbs.buildVariant:profiling" << "qbs.installPrefix:''" << "-f" << m_qbsRepo + "/qbs.qbs", buildDir); runProcess(QStringList() << QCoreApplication::applicationDirPath() + "/qbs" << "build" << "config:benchmarker", buildDir); } } // namespace qbsBenchmarker qbs-src-3.2.0/tests/benchmarker/runsupport.cpp0000644000175100017510000000521015154533055021070 0ustar runnerrunner/**************************************************************************** ** ** 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 "runsupport.h" #include "exception.h" #include #include #include #include namespace qbsBenchmarker { void runProcess(const QStringList &commandLine, const QString &workingDir, QByteArray *output, int *exitCode) { QStringList args = commandLine; const QString command = args.takeFirst(); QProcess p; if (!workingDir.isEmpty()) p.setWorkingDirectory(workingDir); p.start(command, args); if (!p.waitForStarted()) throw Exception(QStringLiteral("Process '%1' failed to start.").arg(command)); p.waitForFinished(-1); if (p.exitStatus() != QProcess::NormalExit) { throw Exception(QStringLiteral("Error running '%1': %2") .arg(command, p.errorString())); } if (exitCode) *exitCode = p.exitCode(); if (p.exitCode() != 0) { QString errorString = QStringLiteral("Command '%1' finished with exit code %2.") .arg(command).arg(p.exitCode()); const QByteArray stdErr = p.readAllStandardError(); if (!stdErr.isEmpty()) { errorString += QStringLiteral("\nStandard error output was: '%1'") .arg(QString::fromLocal8Bit(stdErr)); } throw Exception(errorString); } if (output) *output = p.readAllStandardOutput().trimmed(); } } // namespace qbsBenchmarker qbs-src-3.2.0/tests/benchmarker/commandlineparser.h0000644000175100017510000000462215154533055022005 0ustar runnerrunner/**************************************************************************** ** ** 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 QBS_BENCHMARKER_COMMANDLINEPARSER_H #define QBS_BENCHMARKER_COMMANDLINEPARSER_H #include "activities.h" #include namespace qbsBenchmarker { class CommandLineParser { public: CommandLineParser(); void parse(); Activities activies() const { return m_activities; } QString oldCommit() const { return m_oldCommit; } QString newCommit() const { return m_newCommit; } QString testProjectFilePath() const { return m_testProjectFilePath; } QString qbsRepoDirPath() const { return m_qbsRepoDirPath; } int regressionThreshold() const { return m_regressionThreshold; } bool sequential() const { return m_sequential; } private: [[noreturn]] void throwException(const QString &optionName, const QString &illegalValue, const QString &helpText); [[noreturn]] void throwException(const QString &missingOption, const QString &helpText); Activities m_activities; QString m_oldCommit; QString m_newCommit; QString m_testProjectFilePath; QString m_qbsRepoDirPath; int m_regressionThreshold = 0; bool m_sequential = false; }; } // namespace qbsBenchmarker #endif // Include guard. qbs-src-3.2.0/tests/benchmarker/commandlineparser.cpp0000644000175100017510000001503415154533055022337 0ustar runnerrunner/**************************************************************************** ** ** 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 "commandlineparser.h" #include "exception.h" #include #include #include #include namespace qbsBenchmarker { static QString resolveActivity() { return "resolving"; } static QString ruleExecutionActivity() { return "rule-execution"; } static QString nullBuildActivity() { return "null-build"; } static QString allActivities() { return "all"; } CommandLineParser::CommandLineParser() = default; void CommandLineParser::parse() { QCommandLineParser parser; parser.setApplicationDescription("This tool aims to detect qbs performance regressions " "using valgrind."); parser.addHelpOption(); QCommandLineOption oldCommitOption(QStringList{"old-commit", "o"}, "The old qbs commit.", "old commit"); parser.addOption(oldCommitOption); QCommandLineOption newCommitOption(QStringList{"new-commit", "n"}, "The new qbs commit.", "new commit"); parser.addOption(newCommitOption); QCommandLineOption testProjectOption(QStringList{"test-project", "p"}, "The example project to use for the benchmark.", "project file path"); parser.addOption(testProjectOption); QCommandLineOption qbsRepoOption(QStringList{"qbs-repo", "r"}, "The qbs repository.", "repo path"); parser.addOption(qbsRepoOption); QCommandLineOption activitiesOption(QStringList{"activities", "a"}, QStringLiteral("The activities to benchmark. Possible values (CSV): %1,%2,%3,%4") .arg(resolveActivity(), ruleExecutionActivity(), nullBuildActivity(), allActivities()), "activities", allActivities()); parser.addOption(activitiesOption); QCommandLineOption thresholdOption(QStringList{"regression-threshold", "t"}, "A relative increase higher than this is considered a performance regression. " "All temporary data from running the benchmarks will be kept if that happens.", "value in per cent"); parser.addOption(thresholdOption); QCommandLineOption sequentialOption( QStringList{"sequential", "s"}, "Run the valgrind processes sequentially, rather than in parallel. This can help to " "prevent OOM situations with large test projects."); parser.addOption(sequentialOption); parser.process(*QCoreApplication::instance()); const QList mandatoryOptions = QList() << oldCommitOption << newCommitOption << testProjectOption << qbsRepoOption; for (const QCommandLineOption &o : mandatoryOptions) { if (!parser.isSet(o)) throwException(o.names().constFirst(), parser.helpText()); if (parser.value(o).isEmpty()) throwException(o.names().constFirst(), QString(), parser.helpText()); } m_oldCommit = parser.value(oldCommitOption); m_newCommit = parser.value(newCommitOption); if (m_oldCommit == m_newCommit) { throw Exception(QStringLiteral("Error parsing command line: " "'new commit' and 'old commit' must be different commits.\n%1").arg(parser.helpText())); } m_testProjectFilePath = parser.value(testProjectOption); m_qbsRepoDirPath = parser.value(qbsRepoOption); const QStringList activitiesList = parser.value(activitiesOption).split(','); m_activities = Activities(); for (const QString &activityString : activitiesList) { if (activityString == allActivities()) { m_activities = ActivityResolving | ActivityRuleExecution | ActivityNullBuild; break; } else if (activityString == resolveActivity()) { m_activities = ActivityResolving; } else if (activityString == ruleExecutionActivity()) { m_activities |= ActivityRuleExecution; } else if (activityString == nullBuildActivity()) { m_activities |= ActivityNullBuild; } else { throwException(activitiesOption.names().constFirst(), activityString, parser.helpText()); } } m_regressionThreshold = 50; if (parser.isSet(thresholdOption)) { bool ok = true; const QString rawThresholdValue = parser.value(thresholdOption); m_regressionThreshold = 10 * rawThresholdValue.toInt(&ok); if (!ok) throwException(thresholdOption.names().constFirst(), rawThresholdValue, parser.helpText()); } m_sequential = parser.isSet(sequentialOption); } void CommandLineParser::throwException(const QString &optionName, const QString &illegalValue, const QString &helpText) { const QString errorText(QStringLiteral("Error parsing command line: Illegal value '%1' " "for option '--%2'.\n%3").arg(illegalValue, optionName, helpText)); throw Exception(errorText); } void CommandLineParser::throwException(const QString &missingOption, const QString &helpText) { const QString errorText(QStringLiteral("Error parsing command line: Missing mandatory " "option '--%1'.\n%3").arg(missingOption, helpText)); throw Exception(errorText); } } // namespace qbsBenchmarker qbs-src-3.2.0/tests/benchmarker/activities.h0000644000175100017510000000307615154533055020450 0ustar runnerrunner/**************************************************************************** ** ** 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 QBS_BENCHMARKER_ACTIVITY_H #define QBS_BENCHMARKER_ACTIVITY_H #include namespace qbsBenchmarker { enum Activity { ActivityResolving = 1, ActivityRuleExecution = 2, ActivityNullBuild = 4 }; Q_DECLARE_FLAGS(Activities, Activity) Q_DECLARE_OPERATORS_FOR_FLAGS(Activities) } // namespace qbsBenchmarker #endif // Include guard. qbs-src-3.2.0/tests/benchmarker/benchmarker.qbs0000644000175100017510000000141115154533055021112 0ustar runnerrunnerQtApplication { name: "qbs_benchmarker" type: "application" consoleApplication: true cpp.cxxLanguageVersion: "c++20" cpp.minimumMacosVersion: "11.0" condition: Qt.concurrent.present Depends { name: "qbsbuildconfig" } Depends { name: "Qt.concurrent" required: false } files: [ "activities.h", "benchmarker-main.cpp", "benchmarker.cpp", "benchmarker.h", "commandlineparser.cpp", "commandlineparser.h", "exception.h", "runsupport.cpp", "runsupport.h", "valgrindrunner.cpp", "valgrindrunner.h", ] Group { fileTagsFilter: product.type qbs.install: true qbs.installDir: qbsbuildconfig.appInstallDir } } qbs-src-3.2.0/tests/benchmarker/exception.h0000644000175100017510000000350315154533055020275 0ustar runnerrunner/**************************************************************************** ** ** 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 QBS_BENCHMARKER_EXCEPTION_H #define QBS_BENCHMARKER_EXCEPTION_H #include #include namespace qbsBenchmarker { class Exception : public QException { public: explicit Exception(QString description) : m_description(std::move(description)) {} ~Exception() throw() override = default; QString description() const { return m_description; } private: void raise() const override { throw *this; } Exception *clone() const override { return new Exception(*this); } QString m_description; }; } // namespace qbsBenchmarker #endif // Include guard. qbs-src-3.2.0/tests/benchmarker/runsupport.h0000644000175100017510000000325215154533055020541 0ustar runnerrunner/**************************************************************************** ** ** 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 QBS_BENCHMARKER_RUNSUPPORT_H #define QBS_BENCHMARKER_RUNSUPPORT_H #include #include #include QT_BEGIN_NAMESPACE class QByteArray; QT_END_NAMESPACE namespace qbsBenchmarker { void runProcess(const QStringList &commandLine, const QString& workingDir = QString(), QByteArray *output = nullptr, int *exitCode = nullptr); } // namespace qbsBenchmarker #endif // Include guard. qbs-src-3.2.0/tests/fuzzy-test/0000755000175100017510000000000015154533055016010 5ustar runnerrunnerqbs-src-3.2.0/tests/fuzzy-test/main.cpp0000644000175100017510000000624415154533055017446 0ustar runnerrunner/**************************************************************************** ** ** 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 "commandlineparser.h" #include "fuzzytester.h" #include #include #include static bool parseCommandLine(const QStringList &commandLine, QString &profile, QString &startCommi, int &maxDuration, int &jobCount, bool &log); static bool runTest(const QString &profile, const QString &startCommit, int maxDuration, int jobCount, bool log); int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QString profile; QString startCommit; int maxDuration; int jobCount; bool log; if (!parseCommandLine(app.arguments(), profile, startCommit, maxDuration, jobCount, log)) return EXIT_FAILURE; if (!runTest(profile, startCommit, maxDuration, jobCount, log)) return EXIT_FAILURE; std::cout << "Test finished successfully." << std::endl; return EXIT_SUCCESS; } bool parseCommandLine(const QStringList &commandLine, QString &profile, QString &startCommit, int &maxDuration, int &jobCount, bool &log) { CommandLineParser cmdParser; try { cmdParser.parse(commandLine); } catch (const ParseException &e) { std::cerr << "Invalid command line: " << qPrintable(e.errorMessage) << std::endl; std::cerr << "Usage:" << std::endl << qPrintable(cmdParser.usageString()) << std::endl; return false; } profile = cmdParser.profile(); startCommit = cmdParser.startCommit(); maxDuration = cmdParser.maxDurationInMinutes(); jobCount = cmdParser.jobCount(); log = cmdParser.log(); return true; } bool runTest(const QString &profile, const QString &startCommit, int maxDuration, int jobCount, bool log) { try { FuzzyTester().runTest(profile, startCommit, maxDuration, jobCount, log); } catch (const TestError &e) { std::cerr << qPrintable(e.errorMessage) << std::endl; return false; } return true; } qbs-src-3.2.0/tests/fuzzy-test/fuzzy-test.qbs0000644000175100017510000000076215154533055020670 0ustar runnerrunnerQtApplication { name: "qbs_fuzzy-test" type: "application" consoleApplication: true Depends { name: "qbsbuildconfig" } cpp.cxxLanguageVersion: "c++20" cpp.minimumMacosVersion: "11.0" files: [ "commandlineparser.cpp", "commandlineparser.h", "fuzzytester.cpp", "fuzzytester.h", "main.cpp", ] Group { fileTagsFilter: product.type qbs.install: true qbs.installDir: qbsbuildconfig.appInstallDir } } qbs-src-3.2.0/tests/fuzzy-test/fuzzytester.h0000644000175100017510000000543215154533055020603 0ustar runnerrunner/**************************************************************************** ** ** 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 QBS_FUZZYTESTER_H #define QBS_FUZZYTESTER_H #include #include #include class TestError { public: TestError(QString errorMessage) : errorMessage(std::move(errorMessage)) {} ~TestError() throw() = default; QString errorMessage; private: const char *what() const throw() { return qPrintable(errorMessage); } }; class FuzzyTester { public: FuzzyTester(); ~FuzzyTester(); void runTest(const QString &profile, const QString &startCommit, int maxDurationInMinutes, int jobCount, bool log); private: void checkoutCommit(const QString &commit); QStringList findAllCommits(const QString &startCommit); QString findWorkingStartCommit(const QString &startCommit); void runGit(const QStringList &arguments, QString *output = 0); bool runQbs(const QString &buildDir, const QString &command, QString *errorOutput = 0); void removeDir(const QString &dir); bool doCleanBuild(QString *errorMessage = 0); void throwIncrementalBuildError(const QString &message, const QStringList &commitSequence); void loadSettings(); void storeSettings() const; static QString logFilePath(const QString &commit, const QString &activity); static QString defaultBuildDir(); QString m_profile; int m_jobCount = 0; bool m_log = false; QString m_headCommit; QString m_currentCommit; QString m_currentActivity; std::queue m_commitsWithLogFiles; QStringList m_unbuildableCommits; QStringList m_buildableCommits; }; #endif // Include guard. qbs-src-3.2.0/tests/fuzzy-test/CMakeLists.txt0000644000175100017510000000033015154533055020544 0ustar runnerrunnerset(SOURCES commandlineparser.cpp commandlineparser.h fuzzytester.cpp fuzzytester.h main.cpp ) add_qbs_app(qbs_fuzzy-test DEPENDS Qt${QT_VERSION_MAJOR}::Core SOURCES ${SOURCES} ) qbs-src-3.2.0/tests/fuzzy-test/commandlineparser.h0000644000175100017510000000464615154533055021676 0ustar runnerrunner/**************************************************************************** ** ** 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 QBS_FUZZYTEST_COMMANDLINEPARSER_H #define QBS_FUZZYTEST_COMMANDLINEPARSER_H #include #include class ParseException : public std::exception { public: ParseException(QString error) : errorMessage(std::move(error)) { } ~ParseException() throw() override = default; QString errorMessage; private: const char *what() const throw() override { return qPrintable(errorMessage); } }; class CommandLineParser { public: CommandLineParser(); void parse(const QStringList &commandLine); QString profile() const { return m_profile; } QString startCommit() const { return m_startCommit; } int maxDurationInMinutes() const { return m_maxDuration; } int jobCount() const { return m_jobCount; } bool log() const { return m_log; } QString usageString() const; private: void assignOptionArgument(const QString &option, QString &argument); void assignOptionArgument(const QString &option, int &argument); void parseDuration(); QStringList m_commandLine; QString m_command; QString m_profile; QString m_startCommit; int m_maxDuration = 0; int m_jobCount = 0; bool m_log = false; }; #endif // Include guard. qbs-src-3.2.0/tests/fuzzy-test/commandlineparser.cpp0000644000175100017510000001142215154533055022217 0ustar runnerrunner/**************************************************************************** ** ** 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 "commandlineparser.h" #include #include static QString profileOption() { return "--profile"; } static QString startCommitOption() { return "--start-commit"; } static QString maxDurationoption() { return "--max-duration"; } static QString jobCountOption() { return "--jobs"; } static QString logOption() { return "--log"; } CommandLineParser::CommandLineParser() = default; void CommandLineParser::parse(const QStringList &commandLine) { m_profile.clear(); m_startCommit.clear(); m_maxDuration = 0; m_jobCount = 0; m_log = false; m_commandLine = commandLine; Q_ASSERT(!m_commandLine.empty()); m_command = m_commandLine.takeFirst(); while (!m_commandLine.empty()) { const QString arg = m_commandLine.takeFirst(); if (arg == profileOption()) assignOptionArgument(arg, m_profile); else if (arg == startCommitOption()) assignOptionArgument(arg, m_startCommit); else if (arg == jobCountOption()) assignOptionArgument(arg, m_jobCount); else if (arg == maxDurationoption()) parseDuration(); else if (arg == logOption()) m_log = true; else throw ParseException(QStringLiteral("Unknown parameter '%1'").arg(arg)); } if (m_profile.isEmpty()) throw ParseException("No profile given."); if (m_startCommit.isEmpty()) throw ParseException("No start commit given."); } QString CommandLineParser::usageString() const { return QStringLiteral("%1 %2 %3 [%4 ] " "[%5 ] [%6]") .arg(QFileInfo(m_command).fileName(), profileOption(), startCommitOption(), maxDurationoption(), jobCountOption(), logOption()); } void CommandLineParser::assignOptionArgument(const QString &option, QString &argument) { if (m_commandLine.empty()) throw ParseException(QStringLiteral("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) { throw ParseException(QStringLiteral("Argument for option '%1' must not be empty.") .arg(option)); } } void CommandLineParser::assignOptionArgument(const QString &option, int &argument) { QString numberString; assignOptionArgument(option, numberString); bool ok; argument = numberString.toInt(&ok); if (!ok || argument <= 0) { throw ParseException(QStringLiteral("Invalid argument '%1' for option '%2'.") .arg(numberString, option)); } } void CommandLineParser::parseDuration() { QString durationString; QString choppedDurationString; assignOptionArgument(maxDurationoption(), durationString); choppedDurationString = durationString; const char suffix = durationString.at(durationString.size() - 1).toLatin1(); const bool hasSuffix = !std::isdigit(suffix); if (hasSuffix) choppedDurationString.chop(1); bool ok; m_maxDuration = choppedDurationString.toInt(&ok); if (!ok || m_maxDuration <= 0) { throw ParseException(QStringLiteral("Invalid duration argument '%1'.") .arg(durationString)); } if (hasSuffix) { switch (suffix) { case 'm': break; case 'd': m_maxDuration *= 24; // Fall-through. case 'h': m_maxDuration *= 60; break; default: throw ParseException(QStringLiteral("Invalid duration suffix '%1'.") .arg(suffix)); } } } qbs-src-3.2.0/tests/fuzzy-test/fuzzytester.cpp0000644000175100017510000002753315154533055021144 0ustar runnerrunner/**************************************************************************** ** ** 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 "fuzzytester.h" #include #include #include #include #include #include #include #include #include static QString resolveIncrementalActivity() { return "resolve-incremental"; } static QString buildIncrementalActivity() { return "build-incremental"; } static QString buildFromScratchActivity() { return "build-from-scratch"; } FuzzyTester::FuzzyTester() { loadSettings(); } FuzzyTester::~FuzzyTester() { storeSettings(); } void FuzzyTester::runTest(const QString &profile, const QString &startCommit, int maxDurationInMinutes, int jobCount, bool log) { m_profile = profile; m_jobCount = jobCount; m_log = log; runGit(QStringList() << "rev-parse" << "HEAD", &m_headCommit); qDebug("HEAD is %s", qPrintable(m_headCommit)); qDebug("Trying to find a buildable commit to start with..."); const QString workingStartCommit = findWorkingStartCommit(startCommit); qDebug("Found buildable start commit %s.", qPrintable(workingStartCommit)); QStringList allCommits = findAllCommits(workingStartCommit); qDebug("The test set comprises all %d commits between the start commit and HEAD.", int(allCommits.size())); // Shuffle the initial sequence. Otherwise all invocations of the tool with the same start // commit would try the same sequence of commits. std::srand(std::time(nullptr)); std::shuffle(allCommits.begin(), allCommits.end(), std::mt19937(std::random_device()())); quint64 run = 0; QStringList buildSequence(workingStartCommit); QElapsedTimer timer; const qint64 maxDurationInMillis = maxDurationInMinutes * 60 * 1000; if (maxDurationInMillis != 0) timer.start(); bool timerHasExpired = false; while (std::next_permutation(allCommits.begin(), allCommits.end()) && !timerHasExpired) { qDebug("Testing permutation %llu...", ++run); const auto &allCommitsImmutable = allCommits; for (const QString ¤tCommit : allCommitsImmutable) { if (timer.isValid() && timer.hasExpired(maxDurationInMillis)) { timerHasExpired = true; break; } m_currentCommit = currentCommit; buildSequence << currentCommit; checkoutCommit(currentCommit); qDebug("Testing incremental build #%d (%s)", int(buildSequence.size()) - 1, qPrintable(currentCommit)); // Doing "resolve" and "build" separately introduces additional possibilities // for errors, as information from change tracking has to be serialized correctly. QString qbsError; m_currentActivity = resolveIncrementalActivity(); bool success = runQbs(defaultBuildDir(), QStringLiteral("resolve"), &qbsError); if (success) { m_currentActivity = buildIncrementalActivity(); success = runQbs(defaultBuildDir(), QStringLiteral("build"), &qbsError); } m_currentActivity = buildFromScratchActivity(); if (success) { if (!doCleanBuild(&qbsError)) { QString message = "An incremental build succeeded " "with a commit for which a clean build failed."; if (!m_log) { message += QStringLiteral("\nThe qbs error message " "for the clean build was: '%1'").arg(qbsError); } throwIncrementalBuildError(message, buildSequence); } } else { qDebug("Incremental build failed. Checking whether clean build works..."); if (doCleanBuild()) { QString message = "An incremental build failed " "with a commit for which a clean build succeeded."; if (!m_log) { message += QStringLiteral("\nThe qbs error message for " "the incremental build was: '%1'").arg(qbsError); } throwIncrementalBuildError(message, buildSequence); } else { qDebug("Clean build also fails. Continuing."); } } } } if (timerHasExpired) qDebug("Maximum duration reached."); else qDebug("All possible permutations were tried."); } void FuzzyTester::checkoutCommit(const QString &commit) { runGit(QStringList() << "checkout" << commit); runGit(QStringList() << "submodule" << "update" << "--init"); } QStringList FuzzyTester::findAllCommits(const QString &startCommit) { QString allCommitsString; runGit(QStringList() << "log" << (startCommit + "~1.." + m_headCommit) << "--format=format:%h", &allCommitsString); return allCommitsString.simplified().split(QLatin1Char(' '), Qt::SkipEmptyParts); } QString FuzzyTester::findWorkingStartCommit(const QString &startCommit) { const QStringList allCommits = findAllCommits(startCommit); QString qbsError; m_currentActivity = buildFromScratchActivity(); for (auto it = allCommits.crbegin(), end = allCommits.crend(); it != end; ++it) { m_currentCommit = *it; if (m_unbuildableCommits.contains(m_currentCommit)) { qDebug("Skipping known bad commit %s.", qPrintable(m_currentCommit)); continue; } checkoutCommit(m_currentCommit); removeDir(defaultBuildDir()); if (runQbs(defaultBuildDir(), QStringLiteral("build"), &qbsError)) { m_buildableCommits << m_currentCommit; return m_currentCommit; } qDebug("Commit %s is not buildable.", qPrintable(m_currentCommit)); m_unbuildableCommits << m_currentCommit; } throw TestError(QStringLiteral("Cannot run test: Failed to find a single commit that " "builds successfully with qbs. The last qbs error was: '%1'").arg(qbsError)); } void FuzzyTester::runGit(const QStringList &arguments, QString *output) { QProcess git; git.start("git", arguments); if (!git.waitForStarted()) throw TestError("Failed to start git. It is expected to be in the PATH."); if (!git.waitForFinished(300000) || git.exitStatus() != QProcess::NormalExit) // 5 minutes ought to be enough for everyone throw TestError(QStringLiteral("git failed: %1").arg(git.errorString())); if (git.exitCode() != 0) { throw TestError(QStringLiteral("git failed: %1") .arg(QString::fromLocal8Bit(git.readAllStandardError()))); } if (output) *output = QString::fromLocal8Bit(git.readAllStandardOutput()).trimmed(); } bool FuzzyTester::runQbs(const QString &buildDir, const QString &command, QString *errorOutput) { if (errorOutput) errorOutput->clear(); QProcess qbs; QStringList commandLine = QStringList(command) << "-d" << buildDir; if (m_log) { commandLine << "-vv"; const size_t maxLoggedCommits = 2; Q_ASSERT(m_commitsWithLogFiles.size() <= maxLoggedCommits + 1); if (m_commitsWithLogFiles.size() == maxLoggedCommits + 1) { static const QStringList allActivities = QStringList() << resolveIncrementalActivity() << buildIncrementalActivity() << buildFromScratchActivity(); const QString oldCommit = m_commitsWithLogFiles.front(); m_commitsWithLogFiles.pop(); for (const QString &a : allActivities) QFile::remove(logFilePath(oldCommit, a)); } qbs.setStandardErrorFile(logFilePath(m_currentCommit, m_currentActivity)); if (m_commitsWithLogFiles.empty() || m_commitsWithLogFiles.back() != m_currentCommit) m_commitsWithLogFiles.push(m_currentCommit); } else { commandLine << "-qq"; } if (m_jobCount != 0) commandLine << "--jobs" << QString::number(m_jobCount); commandLine << ("profile:" + m_profile); qbs.start("qbs", commandLine); if (!qbs.waitForStarted()) { throw TestError(QStringLiteral("Failed to start qbs. It is expected to be " "in the PATH. QProcess error string: '%1'").arg(qbs.errorString())); } if (!qbs.waitForFinished(-1) || qbs.exitCode() != 0) { if (errorOutput) *errorOutput = QString::fromLocal8Bit(qbs.readAllStandardError()); return false; } return true; } void FuzzyTester::removeDir(const QString &dirPath) { QDir dir(dirPath); if (!dir.removeRecursively()) { throw TestError(QStringLiteral("Failed to remove temporary dir '%1'.") .arg(dir.absolutePath())); } } bool FuzzyTester::doCleanBuild(QString *errorMessage) { if (m_unbuildableCommits.contains(m_currentCommit)) { qDebug("Commit is known not to be buildable, not running qbs."); return false; } if (m_buildableCommits.contains(m_currentCommit)) { qDebug("Commit is known to be buildable, not running qbs."); return true; } const QString cleanBuildDir = "fuzzytest-verification-build"; removeDir(cleanBuildDir); if (runQbs(cleanBuildDir, QStringLiteral("build"), errorMessage)) { m_buildableCommits << m_currentCommit; return true; } m_unbuildableCommits << m_currentCommit; return false; } void FuzzyTester::throwIncrementalBuildError(const QString &message, const QStringList &commitSequence) { const QString commitSequenceString = commitSequence.join(QLatin1Char(',')); throw TestError(QStringLiteral("Found qbs bug with incremental build!\n" "%1\n" "The sequence of commits was: %2.").arg(message, commitSequenceString)); } QString FuzzyTester::logFilePath(const QString &commit, const QString &activity) { return "log." + commit + '.' + activity; } QString FuzzyTester::defaultBuildDir() { return "fuzzytest-build"; } static QString organization() { return "QtProject"; } static QString app() { return "qbs-fuzzy-tester"; } static QString unbuildableCommitsKey() { return "unbuildable-commits"; } static QString buildableCommitsKey() { return "buildable-commits"; } void FuzzyTester::loadSettings() { QSettings s(organization(), app()); m_unbuildableCommits = s.value(unbuildableCommitsKey()).toStringList(); m_buildableCommits = s.value(buildableCommitsKey()).toStringList(); } void FuzzyTester::storeSettings() const { QSettings s(organization(), app()); s.setValue(unbuildableCommitsKey(), m_unbuildableCommits); s.setValue(buildableCommitsKey(), m_buildableCommits); } qbs-src-3.2.0/tests/tests.qbs0000644000175100017510000000300515154533055015513 0ustar runnerrunnerimport qbs.FileInfo Project { references: [ "auto/auto.qbs", "benchmarker/benchmarker.qbs", "clang-format-test/clang-format-test.qbs", "fuzzy-test/fuzzy-test.qbs", "lspclient/lspclient.qbs", ] AutotestRunner { Depends { name: "Qt.core" } Depends { name: "qbs resources" } Depends { name: "qbs_cpp_scanner" } Depends { name: "qbs_qt_scanner" } arguments: project.autotestArguments wrapper: project.autotestWrapper environment: { var env = base; env.push("QBS_INSTALL_DIR=" + FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix)); if (qbs.hostOS.contains("windows") && qbs.targetOS.contains("windows")) { var path = ""; for (var i = 0; i < env.length; ++i) { if (env[i].startsWith("PATH=")) { path = env[i].substring(5); break; } } path = Qt.core.binPath + ";" + path; var arrayElem = "PATH=" + path; if (i < env.length) env[i] = arrayElem; else env.push(arrayElem); } if (qbs.hostOS.contains("darwin") && qbs.targetOS.contains("darwin")) { env.push("DYLD_FRAMEWORK_PATH=" + Qt.core.libPath); env.push("DYLD_LIBRARY_PATH=" + Qt.core.libPath); } return env; } } } qbs-src-3.2.0/changelogs/0000755000175100017510000000000015154533055014614 5ustar runnerrunnerqbs-src-3.2.0/changelogs/changes-2.0.0.md0000644000175100017510000000111315154533055017175 0ustar runnerrunner# General * Switched JavaScript engine from QtScript to QuickJS * Removed the long-deprecated loadFile() and loadExtension() functions * Removed the qmake project files # Qt support * Adapt to androiddeployqt on Windows no longer accepting tool paths without suffix in 6.4 (QTBUG-111558) # BareMetal support * Added support for HPPA architectures # Other modules * Renamed "name" to "appName" in the freedesktop module to prevent clash with built-in property # Infrastructure * Added USBSAN CI job # Contributors * Christian Kandeler * Ivan Komissarov * Orgad Shaneh * Pino Toscano qbs-src-3.2.0/changelogs/changes-1.12.1.md0000644000175100017510000000100515154533055017260 0ustar runnerrunner# Important bugfixes * Lifted the restriction that the -march option cannot appear in cpp.*Flags (QBS-1018). * All required header files get installed now (QBS-1370). * Fixed rpaths not ending up on the command line under certain circumstances (QBS-1372). * Fixed possible crash when scanning qrc files (QBS-1375). * Fixed spurious re-building of .pc and .qbs module files. * Fixed possible crash on storing a build graph after re-resolving. * Fixed possible assertion on input artifacts with alwaysUpdated == false. qbs-src-3.2.0/changelogs/changes-1.19.2.md0000644000175100017510000000033715154533055017277 0ustar runnerrunner# 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) qbs-src-3.2.0/changelogs/changes-1.15.0.md0000644000175100017510000000327715154533055017277 0ustar runnerrunner# General * Added a session command which offers a JSON-based API for interaction with other tools via stdin/ stdout. This allows for proper Qbs support in IDEs that do not use Qt or even C++. # Language * Probes are now evaluated before Profile items and can be used to create profiles on project level. * AutotestRunner got a separate job pool. * Added a timeout property to Command, JavaScriptCommand and AutotestRunner. This allows to identify and kill stuck commands. # C/C++ Support * Ensure proper support of Xcode 11. * Linker map files can be generated with all toolchains. * Bare metal toolchains can now generate listing files. * Improve the command line output filtering of bare metal toolchains. * Added support for clang in mingw mode on Windows. * Added msp430 support to GCC and IAR. * Added STM8 support to IAR and SDCC. * Added IDE project generators for IAR Embedded Workbench for ARM, AVR, 8051, MSP430, and STM8 architectures. * Added IDE project generators for KEIL uVision v4 for ARM and 8051 architectures. * Added more bare metal project examples for various target platforms. * The IAR, KEIL and SDCC toolchains are now found automatically in various. locations by the setup-toolchains command and by probes if no installPath is set in the profile. # Infrastructure * Automated build and testing on Ubuntu, macOS and Windows. * Added Ubuntu bionic Docker image which replaces Debian stretch. * Updated Qt in the Ubuntu and Windows Docker images to 5.12. * When building Qbs, Qt libraries can now be bundled on Linux, macOS and Windows. # Contributors * Alberto Mardegan * Christian Kandeler * Denis Shienkov * Ivan Komissarov * Jochen Ulrich * Joerg Bornemann * Richard Weickelt qbs-src-3.2.0/changelogs/changes-2.0.2.md0000644000175100017510000000054515154533055017207 0ustar runnerrunner# General * Fixed handling of non-string exceptions (QBS-1734). * Fixed Utilities.versionCompare() for four-segment versions numbers (QBS-1733). # Qt Support * Added special handling for unclean paths in prl files (QBS-1732). * Fixed support for static plugins and Qt >= 6.5 (QBS-1732). # Contributors * Christian Kandeler * Ivan Komissarov * Leon Buckel qbs-src-3.2.0/changelogs/changes-1.23.2.md0000644000175100017510000000026615154533055017273 0ustar runnerrunner# Qt Support * Set _ENABLE_EXTENDED_ALIGNED_STORAGE for MSVC # Documentation * Fix installation with cmake # Contributors * Christian Kandeler * Ivan Komissarov * Marius Gripsgard qbs-src-3.2.0/changelogs/changes-1.19.1.md0000644000175100017510000000047015154533055017274 0ustar runnerrunner# 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) qbs-src-3.2.0/changelogs/changes-1.9.0.md0000644000175100017510000000531215154533055017212 0ustar runnerrunner# General * Setting module property values from the command line can now be done per product. * Introduced new properties `qbs.architectures` and `qbs.buildVariants` to allow product multiplexing by `qbs.architecture` and `qbs.buildVariant`, respectively. * When rebuilding a project, the environment, project file and property values are taken from the existing build graph. # Language * `Depends` items can now be parameterized to set special module parameters for one particular product dependency. The new item type `Parameter` is used to declare such parameters in a module. The new item type `Parameters` is used to allow products to set default values for such parameters in their `Export` item. * The functions `loadExtension` and `loadFile` have been deprecated and will be removed in a future version. Use the `require` function instead. # Custom Rules and Commands * Artifacts corresponding to the `explicitlyDependsOn` property are now available under this name in rules and commands. * A rule's `auxiliaryInputs` and `explicitlyDependsOn` tags are now also matched against rules of dependencies, if these rules are creating target artifacts. * Rules now have a property `requiresInputs`. If it is `false`, the rule will be run even if no artifacts are present that match its input tags. * Added a new property `relevantEnvironmentVariables` to the `Command` class. Use it if the command runs an external tool whose behavior can be influenced by special environment variables. # C/C++ Support * Added the `cpp.link` parameter to enable library dependencies to be excluded from linking. * When pulling in static library products, the new `Depends` parameter `cpp.linkWholeArchive` can now be specified to force all the library's objects into the target binary. * When pulling in library products, the new `Depends` parameter `cpp.symbolLinkMode` can now be specified to control how the library is linked into the target binary on Apple platforms: specifically, whether the library is linked as weak, lazy, reexported, and/or upward (see the `ld64` man page for more information). * The property `cpp.useCxxPrecompiledHeader`, as well as the variants for the other languages, now defaults to true. * The property `cpp.cxxLanguageVersion` now gets mapped to MSVC's `/std` option, if applicable. # Apple * Added support for building macOS disk images. # Android * Product multiplexing is no longer done via profiles, but via architecture, employing the new `qbs.architectures` property (see above). As a result, the `setup-android` command now sets up only one profile, rather than one for each architecture. * Added support for NDK Unified Headers. # Documentation * Added a "How-to" section. qbs-src-3.2.0/changelogs/changes-3.1.1.md0000644000175100017510000000030315154533055017200 0ustar runnerrunner# C/C++ support * Modules support: Properly handle absolute paths in the files pointing to the std modules. # Contributors * Christian Kandeler * Ivan Komissarov * Orgad Shaneh * Pino Toscano qbs-src-3.2.0/changelogs/changes-2.2.0.md0000644000175100017510000000233115154533055017202 0ustar runnerrunner# General * Improved speed of project resolving by employing multiple CPU cores, if available. * Improved speed of probes execution on macOS. * Object and array (var and varList) properties are now immutable in Probe items. # Language * Modules can now contain `Parameters` items. * ModuleProviders can now contain `PropertyOptions` items. # C/C++ support * Allow `"mold"` as value for `cpp.linkerVariant`. * The systemIncludePaths property is now handled correctly for clang-cl. # Apple support * Updated dmgbuild tool. This fixes bug that additional licenses are not shown in the combobox in the resulting DMG image. # Qt support * Only create qbs modules for those Qt modules that products actually need. * Users can now opt out of using RPATH when linking on Linux. # Other * Protobuf module now requires pkg-config or built-in runtime. * Protobuf module now requires C++17 on all platforms. * Capnproto module: the outputDir property is now mutable. * Added support for Groups to the VisualStudio generator. * pkgconfig module provider: mergeDependencies property is deprecated. # Contributors * Christian Kandeler * Dmitrii Meshkov * Ivan Komissarov * Nick Karg * Serhii Olendarenko * Thiemo van Engelen * Thorbjørn Lindeijer qbs-src-3.2.0/changelogs/changes-1.14.0.md0000644000175100017510000000167015154533055017271 0ustar runnerrunner# Language * The `PathProbe` item was extended to support looking for multiple files and filtering candidate files. # C/C++ Support * Added support for Visual Studio 2019. * Added support for clang-cl. * Various improvements for bare-metal toolchains, including new example projects and support for the SDCC toolchain. # Qt Support * Added the `Qt.android_support.extraLibs` property. # Other modules * The `pkgconfig` module now has a `sysroot` property. * Added gRPC support to the `protobuf.cpp` module. # Android Support * Removed support for NDK < r19. * Added new `Android.sdk` properties `versionCode` and `versionName`. # Infrastructure * Added configuration files for Travis CI. * Various fixes and improvements in the Debian Docker image; updated to to Qt 5.11.3. # Contributors * BogDan Vatra * Christian Kandeler * Christian Stenger * Davide Pesavento * Denis Shienkov * hjk * Ivan Komissarov * Joerg Bornemann * Richard Weickelt qbs-src-3.2.0/changelogs/changes-1.13.1.md0000644000175100017510000000106115154533055017263 0ustar runnerrunner# Important bugfixes * Qt support: Plugins are no longer linked into static libraries when building against a static Qt (QBS-1441). * Qt support: Fixed excessively long linker command lines (QBS-1441). * Qt support: Host libraries are now looked up at the right location (QBS-1445). * Qt support: Fixed failure to find Qt modules in Qt Creator when re-parsing a project that hasn't been built yet. * macOS: Properties in bundle.infoPlist are no longer overridden (QBS-1447). * iOS: Fixed generation of default Info.plist (QBS-1447). qbs-src-3.2.0/changelogs/changes-1.22.0.md0000644000175100017510000000210715154533055017264 0ustar runnerrunner# General * A new Host service was introduced, providing information about the host system that used to be available from the qbs module, but did not really belong there. In addition, some more qbs module properties have moved to the FileInfo service. * The product variable in Export items now points to the importing product, rather than the exporting one. * Probes are now also available in ModuleProvider items. # C/C++ Support * Added support for the Open Watcom toolchain. * Reduced unneeded re-linking on Linux by ignoring changes to weak symbols in library dependencies by default. # Qt Support * Android multi-arch packages are supported again wth Qt >= 6.3. * We now use cpp.systemIncludePaths for Qt headers, so that building Qt applications no longer triggers warnings from Qt headers unrelated to the user code. # Infrastructure * Added coverage for Digital Mars compiler. * Added coverage for static Qt builds. # Contributors * Christian Kandeler * Denis Shienkov * Ivan Komissarov * Jan Blackquill * Leena Miettinen * Marius Gripsgard * Mitch Curtis * Raphael Cotty qbs-src-3.2.0/changelogs/changes-3.0.1.md0000644000175100017510000000021415154533055017200 0ustar runnerrunner # Apple support * Fixed support for booleans in .plist files on Apple Silicon macs. # Contributors * Christian Kandeler * Ivan Komissarov qbs-src-3.2.0/changelogs/changes-1.8.10000644000175100017510000000077615154533055016624 0ustar runnerrunnerImportant bug fixes: * Qbs-specific build errors are now correctly linked in Qt Creator's issues pane (QBS-1151). * Fixed automatic base profile assignment for MSVC Qt installations (QBS-1141) * Various QNX fixes (QBS-1136, QBS-1137, QBS-1138, QBS-1139, QBS-1143). Behavior changes: * Users now get early error messages if they forget the "modules", "products" or "projects" prefix in command line property overrides such as "modules.cpp.enableExceptions:false". qbs-src-3.2.0/changelogs/changes-1.23.1.md0000644000175100017510000000115315154533055017266 0ustar runnerrunner# C/C++ Support * Added support for c17 and c2x values in cpp.cLanguageVersion. * Added support for cpp.cLanguageVersion for the MSVC toolchain. * Fix passing linker scripts to iar and keil toolchains (QBS-1704). # Qt Support * Adapted to new location of qscxmlc in Qt 6.3. * Adapted to new location of qhelpgenerator in Qt 6.3. * Fixed setting up Qt 6.3 with qbspkgconfig. * Added QtScript module to the source tarballs (QBS-1703). # Other modules * Fixed protobuf linking on macOS 11. * Fixed handling empty variables in qbspkgconfig (QBS-1702) # Contributors * Christian Kandeler * Ivan Komissarov * Orgad Shaneh qbs-src-3.2.0/changelogs/changes-2.4.2.md0000644000175100017510000000062515154533055017212 0ustar runnerrunner# General * Fixed possible crash when exiting Qbs Session (QBS-1803). * Fixed possible "undefined" value passed to the filterFunction in ProcessCommandExecutor. # JSON API * Undefined module properties are omitted now. # Docker * Linux images now contain GNU Debugger. # CI * CI now collects and prints coredumps on Mac and Linux on test failure. # Contributors * Christian Kandeler * Ivan Komissarov qbs-src-3.2.0/changelogs/changes-1.10.1.md0000644000175100017510000000123515154533055017263 0ustar runnerrunner# Important bugfixes * Fix assertion on project loading (QBS-1275). * Fix crash when the "original" value is misused (QBS-1255). * Fix qtquickcompiler support for qml files in subdirectories (QBS-1261). * Fix constant rebuilding after moving an external header file (QBS-1285). * Fix GCC support for "bare metal" systems (QBS-1263, QBS-1265). * Fix using ids in Depends items (QBS-1264). * Fix access to module instances in dependency parameters (QBS-1253). * Fix race condition when creating Inno Setup, NSIS, or WiX installers. * Fix release builds for Android with NDK r12 and above (QBS-1256). * Fix parametrized dependencies in Export and Module items (QBS-1287). qbs-src-3.2.0/changelogs/changes-1.13.0.md0000644000175100017510000000322615154533055017267 0ustar runnerrunner# General * Added a lot more documentation. * The `--show-progress` command line option is now supported on Windows. # Language * Introduced module providers. * The `Depends` item now falls back to `pkg-config` to locate dependencies whose names do not correspond to a qbs module. * Added the concept of job pools for limiting concurrent execution of commands by type. * Added support for rules without output artifacts. * Added `atEnd` function to the `Process` service. * Added `canonicalPath` function to the `FileInfo` service. * Removed the need to add "import qbs" at the head of project files. * The `Application`, `DynamicLibrary` and `StaticLibrary` items now have properties for more convenient installation of target binaries. # C/C++ Support * Added recursive dependency scanning of GNU ld linkerscripts. * Added new `cpp` property `linkerVariant` to force use of `gold`, `bfd` or `lld`. # Qt Support * It is no longer required to call `setup-qt` before building Qt projects. * Introduced the property `Qt.core.enableBigResources` for the creation of "big" Qt resources. * Static builds now pull in the default set of plugins as specified by Qt, and the user can specify the set of plugins by type. * Files can be explicitly tagged as mocable now. # Other modules * Added `protobuf` support for C++ and Objective-C. * Introduced the `texttemplate` module, a facility similar to qmake's `SUBSTITUTES` feature. # Android Support * The `AndroidApk` item was deprecated, a normal `Application` item can be used instead. * Building Qt apps is properly supported now, by making use of the `androiddeployqt` tool. # Autotest support * Introduced the `autotest` module. qbs-src-3.2.0/changelogs/changes-2.5.1.md0000644000175100017510000000042715154533055017212 0ustar runnerrunner# General * Fixed use of wrong declaration when looking up properties via the parent item (QBS-1821). * Fixed crash when resolving Probes. # CI * Updated to Qt 6.7.3 for macOS (QBS-1799). * Switched macOS jobs to macOS 13. # Contributors * Christian Kandeler * Ivan Komissarov qbs-src-3.2.0/changelogs/changes-1.18.0.md0000644000175100017510000000517115154533055017275 0ustar runnerrunner# General * capnp: The outputDir property is now public and read-only. * setup-toochains: Include the Xcode version into the profile name profile when auto-detection an Xcode installation. * innosetup module: Add support for InnoSetup v6 * JSON API: Use the full display name of multiplexed products in the dependencies array. This allows clients to for example to properly update the search path for multiplexed dynamic libraries. # Language * Deprecate the product variable inside Export items in favor of a new exportingProduct variable. It will be removed in Qbs 1.20 (QBS-1576). * Qbs now checks string and stringList values according to the allowedValues property in the PropertyOptions item. # Protocol Buffers Support (Protobuf Module) * The deprecated protocBinary property has been removed. Use compilerPath instead. * A nanopb submodule has been added. * The outputDir property is now public and read-only. # C/C++ Support * baremetal: cpp.generateCompilerListingFiles has been implemented for KEIL ARM Clang * baremetal: cpp.enableDefinesByLanguage does now work with SDCC as well. # Qt Support * Moc is now disabled when building aggregate products. # Android Support * Support for the new directory layout of Qt6 has been added (QBS-1609). * Input file generation for androiddeployqt has been improved (QBS-1613). * Debugging experience of multi-architecture Android projects with Qbs and Qt Creator has been improved. Binaries are now generated in a directory layout that Qt Creator expects and debug information is no longer stripped away. # Documentation * baremetal: A new WiFi access point example for the ESP8266 MCU using the GCC toolchain has been added. * baremetal: A new example for Nordic's pca10001 board has been added. It supports GCC, KEIL and IAR. * baremetal: The stm32f103 example supports IAR as well. * A howto has been added showing how to easily disable compiler warnings. * Instructions for building Qbs with CMake have been added (QBS-1618). # Important Bug Fixes * Qt modules could not be used in Export item when building for Android (QBS-1576). * Variable substitution in Info.plist files was broken for '@VAR@' syntax (QBS-1601). * CppApplication failed to build for Android when using Qt > 5.14.0 and multiplexing over multiple architectures (QBS-1608). * Moc output was broken when including Boost project header files (QBS-1621). # Contributors * Alberto Mardegan * André Pönitz * Christian Kandeler * Christian Stenger * Cristian Adam * Denis Shienkov * Eike Ziller * Ivan Komissarov * Jochen Ulrich * Kai Dohmen * Mitch Curtis * Orgad Shaneh * Raphaël Cotty * Richard Weickelt qbs-src-3.2.0/changelogs/changes-1.17.1.md0000644000175100017510000000035715154533055017276 0ustar runnerrunner# Important bugfixes * Android: Fix support for Qt 5.15 (QBS-1580). * Android: Allow exporting of Qt modules in Export items (QBS-1576) * Darwin: Fix ios-simulator builds with XCode 12 # Contributors * Raphaël Cotty * Ivan Komissarov qbs-src-3.2.0/changelogs/changes-1.11.1.md0000644000175100017510000000050615154533055017264 0ustar runnerrunner# Important bugfixes * Speed up run environment setup (QTCREATORBUG-20175). * Fix qbs command line generated by the Visual Studio project generator (QBS-1303). * Install all required header files when building Qbs with qmake. * Fix undefined behavior in the qbscore library where a reference to a temporary object was stored. qbs-src-3.2.0/changelogs/changes-1.6.10000644000175100017510000000040715154533055016611 0ustar runnerrunnerFeatures: * Added cpp.linkerWrapper property. Important bug fixes: * Fixed a number of bugs evaluating module properties (QBS-845, QBS-1005). * Fixed x86_64 > x86 cross compiling (QBS-1028). * Fixed dynamic rules with generated inputs (QBS-1029). qbs-src-3.2.0/changelogs/changes-3.1.2.md0000644000175100017510000000014615154533055017206 0ustar runnerrunner# General * Fixed CMake build with Qt >= 6.10. # Contributors * Christian Kandeler * Ivan Komissarov qbs-src-3.2.0/changelogs/changes-1.12.2.md0000644000175100017510000000104115154533055017261 0ustar runnerrunner# Important bugfixes * The Visual Studio 2017 Build Tools are properly supported now. * Android NDK r18 is properly supported now. * Removed invalid assertion that prevented deriving from the Properties item. * Fixed build error on some BSD hosts (QBS-1395). * setup-qt fixes: * The QtWebkit module is now properly detected (QBS-1399). * The case of the qtmain library being called "qt5main" is properly handled now (QBS-767). * Building against a Qt that was built with sanitizing support works out of the box now (QBS-1387). qbs-src-3.2.0/changelogs/changes-1.11.0.md0000644000175100017510000000606715154533055017273 0ustar runnerrunner# General * Added `qbs.targetPlatform` and `qbs.hostPlatform` properties which are scalar versions of `qbs.targetOS` and `qbs.hostOS`. `qbs.targetPlatform` is a "write-only" property that can be used to set the OS/platform that is being targeted, while `qbs.targetOS` and `qbs.hostOS` should continue to be used to *read* the OS/platform that is being targeted. `qbs.targetOS` is also now read-only. * The "run" functionality as used by the command-line command of the same name now considers an executable's library dependencies, that is, it adds the paths they are located in to the respective environment variable (e.g. PATH on Windows). # Language * Modules can now declare target artifacts using the new `filesAreTargets` property of the `Group` item. * The Module.setupRunEnvironment script now has a new parameter `config`. Users can set it via the `--setup-run-env-config` option of the `run` command. The only value currently supported is `ignore-lib-dependencies`, which turns off the abovementioned injection of library dependencies' paths into the run environment. * Module.setupBuildEnvironment and Module.setupRunEnvironment now have access to the `product` and `project` variables. With regards to accessing module properties, these script now behave like rules, rather than normal properties. * Added the `BinaryFile` service for reading and writing binary data files. * The `SubProject` item now has a condition property. # C/C++ Support * Added property `cpp.rpathOrigin` which evaluates to `@loader_path` on Darwin and `$ORIGIN` on other Unix-like platforms. * Added the `qbs.toolchainType` property, which is a scalar version of the `qbs.toolchain` property and is used to set the current toolchain. * Added `cpp.driverLinkerFlags` for flags to be passed to the compiler driver only when linking. * We now properly support `"c++17"` as a possible value of `cpp.cxxLanguageVersion`. * The auto-detection mechanism for GCC-like compilers now considers typical mingw prefixes. # Qt Support * Added the Qt.scxml.generateStateMethods property to back the --statemethods option. # Command-line interface * Configuration names are now passed as "config:". * Options do not have to precede property assignments anymore. * Referencing a non-existing product in a property override now results in an error. # Documentation * Major overhaul of the module and item reference for improved readability. * Added a how-to on the topic of pre-compiled headers. * Added documentation for the built-in XML support. * Added documentation for qbs.Utilities. * Added documentation on how to target specific platforms. # Important bug fixes * Fixed some inconsistencies related to item ids (QBS-1016, QBS-1262). * Fixed slow project resolving on macOS (QBS-1277). * Fixed problems with qtquickcompiler support in Qt 5.11 (QBS-1299). * Fixed race conditions in multi-configuration builds (QBS-1308). # Other * The `InnoSetup`, `nsis`, and `wix` modules' rules now have a dependency on installable artifacts of dependencies. * Introduced the `ico` module for creating .ico and .cur files. qbs-src-3.2.0/changelogs/changes-1.24.0.md0000644000175100017510000000045315154533055017270 0ustar runnerrunner# General * Users can now control if and when warnings for deprecated properties are emitted. * Added FileInfo.executableSuffix(). # Qt Support * Minimum windows version is now 10.0, like for cmake and qmake. # Contributors * Christian Kandeler * Ivan Komissarov * Petr Mikhalicin * Raphael Cotty qbs-src-3.2.0/changelogs/changes-1.20.1.md0000644000175100017510000000055515154533055017270 0ustar runnerrunner# General * Fixed target linker flags on FreeBSD (QBS-1312). * Fixed file time precision on FreeBSD. * Added additional logging to the Qt module provider when no qmakes were found. * Some fixes to CMake build. * Fixed incorrect usage of the qmlcachegen binary (QBS-1676). # Android Support * Added stripping for release builds. * Fix generation of aab packages. qbs-src-3.2.0/changelogs/changes-1.21.0.md0000644000175100017510000000412015154533055017260 0ustar runnerrunner# General * A new qbsModuleProviders property was added to Project and Product items which allows to specify which providers will be run (QBS-1604). * Added a new library for reading *.pc files which allows to avoid launching multiple pkg-config processes and also gives QBS more information about dependencies between *.pc files (QBS-1615). * A new qbspkgconfig provider was added which will replace the fallback provider (QBS-1614). This new provider uses the built-in library and is capable of setting Qt libraries as well. * capnproto and protobuf modules can now use runtime provided by the qbspkgconfig provider. * A new ConanfileProbe.verbose property was added which can be useful to debug problems with Conan. * Qbs no longer migrates the "profiles/" dir from earlier Qbs versions (QTCREATORBUG-26475). Old directories might be cleaned up manually. * FileInfo now always uses high-precision timer on all OSes. * Fixed a problem with overriding stringList properties in ModuleProviders from command-line. # C/C++ Support * Added support for c++23. * Add Elbrus E2K architecture for the GCC toolchain (QBS-1675). * COSMIC cpp module now avoids using relative file paths as much as possible. * Some refactoring was done in the cpp modules to share more code. # Android Support * Added Android.ndk.buildId property which allows to overwrite the default value (sha1) for the --build-id linker flag. * Fixed reading *.prl files with Qt >= 6.0. * Fixed rcc path with Qt >= 6.2. # Documentation * Added a new page with the list of ModuleProviders. * Qt provider now has its own page. * Clarified that application won't be runnable by default, unless env or rpaths are set correctly. # Infrastructure * Added standalone job for building documentation. * Xcode version was bumped to 12.5.1. * Added OpenSUSE Leap docker image. * Added Android tests with different NDK versions. * Fixed QMake build with Qt 6. # Contributors * Christian Kandeler * Christian Stenger * Davide Pesavento * Denis Shienkov * Ivan Komissarov * Kai Dohmen * Orgad Shaneh * Raphaël Cotty * Richard Weickelt * Thorbjørn Lindeijer qbs-src-3.2.0/changelogs/changes-3.2.0.md0000644000175100017510000000202515154533055017203 0ustar runnerrunner# General * Fixed restoring integer configuration values (QBS-1739). * Fixed resoures location detection when Qbs is called via symlink on macOS (QBS-1873). * Updated QuickJS to version 0.11.0. # Fixed missing TLS plugins in Qbs build with bundled Qt. # Language * The `SubProject` item can now override properties of a loaded `Product` item (QBS-1661). * Module properties provided via the command line are now considered when evaluating the respective module's condition (QBS-1841). # C/C++ support * Added an `ObjectLibrary` item (QBS-1834). * Added a `CppLibrary` convenience item. * Added support for C++26. * Added a `cpp.rpathLinkDirs` property (QBS-1501). * With MSVC, manifest files are now also generated for DLLs (QBS-1857). # Apple * Added support for IconComposer icons (QBS-1871). * Updated dmgbuild to fix an issue with backround images on macOS Tahoe 26.2 (QBS-1872). * Fixed provisioning profiles location with XCode 26 (QBS-1875). # Contributors * Björn Schäpers * Christian Kandeler * Denis Shienkov * Ivan Komissarov qbs-src-3.2.0/changelogs/changes-2.5.0.md0000644000175100017510000000302015154533055017201 0ustar runnerrunner# Language * `Product` items can now contain `Scanner` items. * `Group` items can now contain other items, namely `Depends`, `FileTagger`, `Rule`, and `Scanner`. * `Group` items can now act like `Properties` items. Top-level properties can be set via the `product` and `module` prefixes, respectively. * The conditions of `Properties` items can now overlap, allowing more than one such item to contribute to the value of list properties. * The "else case" semantics for `Properties` items is now deprecated. Instead, `Properties` items can be marked as containing fallback values by giving them a condition with the special value `undefined`. * The conditions of `Properties` items now default to `true`. * Introduced the special `module` variable for `Module` items, which acts like `product` in `Product` items. * Resolving values of path properties in `Export` items relative to the exporting product's location is now deprecated. # C/C++ Support * Added support for C++20 modules. # Android support * Added new properties `Android.sdk.d8Desugaring` and `Android.sdk.extraResourcePackages`. # Qt Support * Added new property `Qt.core.translationsPath`. * Adapted to changes in framework releases (QBS-1816). # Other * Added experimental WebAssembly support via emscripten. * The `freedesktop` module now supports localization and deployment of more than one icon. * The JSON API now supports renaming files. # Contributors * Aaron McCarthy * Christian Kandeler * Danya Patrushev * Ivan Komissarov * Leon Buckel * Roman Telezhynskyi qbs-src-3.2.0/changelogs/changes-2.6.0.md0000644000175100017510000000242115154533055017206 0ustar runnerrunner# General * Command descriptions are now printed with the product name as the prefix instead of the suffix. * When building only specific products via the `-p` option, dependent products are not necessarily built in their entirety anymore. Instead, only the artifacts required for the requested products are built. * ConanfileProbe now supports Conan 2 and QbsDeps generator. # Language * Added new `Rule` property `auxiliaryInputsFromDependencies`. * The `Rule` property `explicitlyDependsOnFromDependencies` now matches all artifacts from the dependencies, not just target artifacts. * The version requirement in a `Depends` item is now checked earlier, fixing the problem that a non-matching version of a library could break project resolving if it was found before the matching version. # API * Added a mode that loads a build graph followed by a forced re-resolve. * In IDE mode, messages of type "error" instead of "warning" are now emitted for errors that would stop the build in non-IDE mode (QBS-1818). # Darwin support * Added privacy manifest support for frameworks (QBS-1812). # Qt Support * Added `lupdate` support via the new `QtLupdateRunner` item (QBS-486). # Contributors * Christian Kandeler * Ivan Komissarov * Marcus Tillmanns * Orgad Shaneh * Turkaev Usman qbs-src-3.2.0/changelogs/changes-3.0.0.md0000644000175100017510000000253715154533055017211 0ustar runnerrunner# General * Infinite recursion in property assignments is now properly diagnosed instead of triggering a crash (QBS-1793). * Errors during project resolving print a sort of stack trace now, giving users a better idea about what is going wrong. * The JavaScript backend was switched to `QuickJS-NG`, which is actively maintained. * Added support for C++ standard library modules - "import std;" and "import std.compat;". * Fixed support for arm64/armv7 with MSVC. * Fixed Conan module provider when there are multiple values in array. # Language * Introduced new property `minimal` to `Depends` item that controls whether the dependency should get built in its entirety or only as far as needed by the rules in the depending product. * Relative paths in `Export` items are now resolved relative to the importing product. * Top-level list property assignments no longer act as fallbacks for `Properties` items, but unconditionally contribute to the aggregate value of the property. # API * It is now possible to add dependencies to a product. # Darwin support * The `bundle` module now uses file tags instead of properties to collect header and resource files (QBS-1726). # Qt Support * A `Qt.shadertools` module was added. * moc now uses response files, if necessary. # Contributors * Christian Kandeler * Danya Patrushev * Ivan Komissarov * Richard Weickelt qbs-src-3.2.0/changelogs/changes-2.4.1.md0000644000175100017510000000065415154533055017213 0ustar runnerrunner# General * Fix LibraryProbe to take into account libraries both with and without the "lib" prefix. This fixes the Conan provider for MinGW. * Conan module provider no longer sets platform to "none" for baremetal toolchains (QBS-1795). # CI * CI now covers Conan tests for all platforms. Conan is also included in Linux images now. * GDB is now included in Linux images. # Contributors * Christian Kandeler * Ivan Komissarovqbs-src-3.2.0/changelogs/changes-2.3.0.md0000644000175100017510000000254415154533055017211 0ustar runnerrunner# General * Added an LSP language server that provides support for following symbols and completion in IDEs (QBS-395). * Module properties are now directly available within groups in modules (QBS-1770). * Added possibility to export products to CMake via the new Exporter.cmake module. * Deprecated the pkgconfig-based fallback module provider. * If a project needs to be re-resolved, we now print the reason. * Added some tutorials. * Wildards handling was rewritten to track changes more accurate. * Module 'validate' scripts are no longer run for erroneous product in IDE mode. * Add example how to use Exporters. # C/C++ Support * Private dependencies of products are not traversed more than once anymore (QBS-1714). # Language * Module properties are now accessible for groups in modules (QBS-1770). * Fixed pathList properties in Probes (QBS-1785). * The qbspkgconfig.mergeDependencies property was removed. * ModuleProviders now support the 'allowedValues' property of the PropertyOptions item (QBS-1748). # Apple * Adapted darwin support to Xcode 15.3. # CI * Changed Linux Docker images from Focal to Jammy. * Updated compilers and linters to recent versions. * Added clang-format job to check code style. * The project.withExamples property was removed. # Contributors * Christian Kandeler * Dmitrii Meshkov * Ivan Komissarov * Raphael Cotty * Richard Weickelt qbs-src-3.2.0/changelogs/changes-1.14.1.md0000644000175100017510000000023415154533055017265 0ustar runnerrunner# Important bugfixes * Qt support: Fix static builds on Windows (QBS-1465). * Qt support: Fix static builds with Qt >= 5.13.1. * Darwin: Adapt to Xcode 11. qbs-src-3.2.0/changelogs/changes-2.2.2.md0000644000175100017510000000100615154533055017202 0ustar runnerrunner# General * Fixed name collision check for multi-part modules (QBS-1772). * Fixed potential assertion when attaching properties on non-present modules (QBS-1776). # C/C++ * Fixed handling assember flags with MSVC (QBS-1774). # Qt * Fixed the qbspkgconfig Qt provider for the case when there is no Qt (QBS-1777). # Other * Make protobuf usable without qbspkgconfig again (QBS-1663). * Add support for the definePrefix option to qbspkgconfig. # Contributors * Björn Schäpers * Christian Kandeler * Ivan Komissarov qbs-src-3.2.0/changelogs/changes-2.4.0.md0000644000175100017510000000142715154533055017211 0ustar runnerrunner# General * Added a Conan module provider (QBS-1665). * Added a flatbuffers module (QBS-1666). * Rules trying to create artifacts outside the build directory is now a hard error (QBS-1268). * More details are now printed when a command times out (QBS-1750). * Updated the bundled quickjs library. # Language * The pkg-config based fallback provider was removed. * It is no longer allowed to attach a QML id to a module item. # Apple support * Fixed symlinks for multi-arch binaries on Apple platforms (QBS-1797). # C/C++ Support * Added new cpp.importPrivateLibraries property that controls whether to automatically import external libraries from dependencies. # Documentation * Added more tutorials. # Contributors * Christian Kandeler * Ivan Komissarov * Kai Dohmen * Raphael Cotty qbs-src-3.2.0/changelogs/changes-1.23.0.md0000644000175100017510000000066215154533055017271 0ustar runnerrunner# C/C++ Support * Added new module Sanitizers.address for simple cross-platform ASan configuration. # Qt Support * Add the now-required /permissive- flag for MSVC automatically. # Android Support * Support use of cmdline-tools in addition to SDK tools. * Consider .jar files also in the product itself, not just in dependencies. # Contributors * Christian Kandeler * Dmitry Shachnev * Ivan Komissarov * Max Bespalov * Orgad Shaneh qbs-src-3.2.0/changelogs/changes-1.7.00000644000175100017510000000204715154533055016613 0ustar runnerrunnerFeatures: * Added a generator for Visual Studio projects. * The Group item is now nestable. * Stricter type checking for properties. * Added support for generating qrc files. * Added full support for the QtScxml module. * Introduced cpp.soVersion. * Added support for building Inno Setup packages. * Tentative support for Visual Studio 2017. * We now assume UTF-8 encoding for project files. * In Scanner items, input.fileName now contains a filename rather than the full path. * Warnings encountered during project resolving are now stored and re-displayed when the project is loaded. * Documentation was improved in several places, most notably for the Rule item. * Support for the deprecated Transformer item was removed. Important bug fixes: * Long paths on Windows are handled (QBS-1068). * Cyclic module dependencies are detected (QBS-1044). * The libqbscore soname now includes the minor version, so that it will not stay the same across ABI changes (QBS-1002). qbs-src-3.2.0/changelogs/changes-2.0.1.md0000644000175100017510000000133215154533055017201 0ustar runnerrunner# General * Fixed crash when importing missing JavaScript file (QBS-1730). # C/C++ Support * Fixed building applications with mingw toolchain and Qt6 (QBS-1724). # Apple Support * Added support for Xcode 14.3. * Fixed codesigning on macOS (QBS-1722). * Fixed detecting Xcode via xcode-select tool. # Qt Support * Fixed support for Qt 6.3 on iOS. * Fixed install-qt.sh to properly support Qt for iOS. * Do not setup Qt in qbspkgconfig when cross compiling (QBS-1717). # Build System * Fixed qbsbuildconfig module. * Fixed build with Qt6.5. * Updated CI to test via Qt 6.5 on macOS and Windows. * Updated CI to test via Xcode 14.2 on macOS. # Contributors * Björn Schäpers * Christian Kandeler * Ivan Komissarov * Kai Dohmen qbs-src-3.2.0/changelogs/changes-1.12.0.md0000644000175100017510000000355715154533055017275 0ustar runnerrunner# General * Added new module `Exporter.qbs` for creating qbs modules from products. * Added new module `Exporter.pkgconfig` for creating pkg-config metadata files. * Introduced the concept of system-level qbs settings. * Added a Makefile generator. * All command descriptions now contain the product name. # Language * The `explicitlyDependsOn` property of the `Rule` item no longer considers target artifacts of product dependencies. The new property `explicitlyDependsOnFromDependencies` can be used for that purpose. * The `excludedAuxiliaryInputs` property of the `Rule` item has been renamed to `excludedInputs`. The old name is now deprecated. * Added a new property type `varList`. * Added `FileInfo.suffix` and `FileInfo.completeSuffix`. * The deprecated JS extensions `XmlDomDocument` and `XmlDomElement` have been removed. Use `Xml.DomDocument` and `Xml.DomDocument` instead. # C/C++ Support * For MSVC static libraries, compiler-generated PDB files are now tagged as `debuginfo_cl` to make them installable. * The `cxxLanguageVersion` property can now be set to different values in different modules, and the highest value will be chosen. # Qt Support * Amalgamation builds work properly now in the presence of "mocable" files. * Fixed some redundancy on the linker command line. # Other modules * Added support for `%option outfile` and `%output` to the `lex_yacc` module. * The `vcs` module now creates the header file even if no repository is present. # Autotest support * Added an `auxiliaryInputs` property to the `AutotestRunner` item for specifying run-time dependencies of test executables. * The `AutotestRunner` item now has a `workingDirectory` property. By default, the respective test executable's location is used. # Important bug fixes * Disabled products no longer cause their exported dependencies to get pulled into the importing product (QBS-1250). qbs-src-3.2.0/changelogs/changes-2.1.1.md0000644000175100017510000000032715154533055017205 0ustar runnerrunner# General * Fixed Probe lookup in multiplexed products. * Fixed excessively slow module merging in some circumstances. * Fixed building QuickJS on x86 systems. # Contributors * Christian Kandeler * Ivan Komissarov qbs-src-3.2.0/changelogs/changes-1.10.0.md0000644000175100017510000000353715154533055017271 0ustar runnerrunner# General * Added the `vcs` module to provide VCS repository information. Git and Subversion are supported initially. * Added initial support for the Universal Windows Platform. * Improved a lot of error messages. # Language * Profiles can now be defined within a project using the `Profile` item. * Groups without a prefix now inherit the one of the parent group. * Both the `Module` and the `FileTagger` item now have a `priority` property, allowing them to override conflicting instances. * It is now possible to add file tags to generated artifacts by setting the new `fileTags` property in a group that has a `fileTagsFilter`. * Added new open mode `TextFile.Append`. * Added the `filePath` function to the `TextFile` class. * `Process` and `TextFile` objects in rules, commands and configure scripts are now closed automatically after script execution. # C/C++ Support * Added the `cpufeatures` module for abstracting compiler flags related to CPU features such as SSE. * Added property `cpp.discardUnusedData` abstracting linker options that strip unneeded symbols or sections. * Added property `cpp.variantSuffix` for making binary names unique when multiplexing products. * Added property `cpp.compilerDefinesByLanguage` providing the compiler's pre-defined macros. # Android * The deprecated `apkbuilder` tool is no longer used. # Qt * Added support for the Qt Quick compiler. * Added support for `qmlcachegen`. # Command-line interface * Removed some non-applicable options from a number of tools. * The `run` command can now deploy and run Android apps on devices, and deploy and run iOS and tvOS apps on the simulator. * Added new command `list-products`. # Documentation * Added porting guide for qmake projects. * Added in-depth descriptions of all command-line tools. * Added "How-to" for creating modules for third-party libraries. * Added a man page. qbs-src-3.2.0/changelogs/changes-1.22.1.md0000644000175100017510000000054615154533055017272 0ustar runnerrunner# General * Adapted to changes in Xcode 13.3 (QBS-1693). * Re-added several bugfixes from 1.21.1 that got lost in 1.22.0. # Qt Support * Fixed building against static Qt 6 (QBS-1692). # Android Support * Fixed wrong include path being added to the command line (QBS-1691). # Documentation * Fixed outdated use of "product" in Export items (QBS-1694). qbs-src-3.2.0/changelogs/changes-1.24.1.md0000644000175100017510000000023015154533055017262 0ustar runnerrunner# C/C++ Support Fix macros and include paths retrieval for IAR # Build System Add fix for cmake >= 3.18 # Contributors * Denis Shienkov * Eike Ziller qbs-src-3.2.0/changelogs/changes-3.1.0.md0000644000175100017510000000274715154533055017215 0ustar runnerrunner# General * Qbs now prints information about files being installed. * New modules were added for fine-tuning builds: `config.build`, `config.install` and `installpaths`. * The `install` property in convenience items such as `CppApplication` now defaults to `true`. * The `texttemplate` module received support for an alternative syntax (QBS-1833). * The `Process` service now has an `errrorString` method. * The `vcs` module now supports the `Mercurial` tool and there are new properties `repoLatestTag`, `repoCommitsSinceTag`, and `repoCommitSha`. * Added a `Graphviz` generator to visualize project structures. * The bundled QuickJS was updated to version 0.10.1. # Language * Expansion of wildcards appearing on the right-hand side of a `files` property is now done in a case-sensitive manner on non-Windows hosts (QBS-1844). # C/C++ support * The `CppStd` convenience item was introduced to be able to use the `std.cppm` C++ module without having to build it for every product. * The gcc module now detects the `Alpha` architecture. # API * The LSP support was extended to implement "go to definition" for module names, module properties, user-defined items and the content of the `files` and `references` properties. # Qt Support * Fixed iOS support with Qt >= 6.8 (QBS-1839). # Apple support * Added support for Xcode 26.0. * Added support for embedding dependencies into a bundle. # Contributors * Christian Kandeler * Ivan Komissarov * Jan Blackquill * Pino Toscano * Roman Telezhynskyi qbs-src-3.2.0/changelogs/changes-2.1.0.md0000644000175100017510000000156715154533055017213 0ustar runnerrunner# General * Improved speed and correctness of project resolving. * Fixed possible segmentation fault when quitting a session. * Fixed regression in BinaryFile (QBS-1740). * Added possibility to import and export Qbs settings in the JSON format (QBS-1685). # Modules * Dependencies are no longer merged by default in the qbspkgconfig module provider (QBS-1710). * Protobuf modules now export the desired c++ version (c++17 on macOS, c++14 otherwise). # Apple Support * Updated dmgbuild to the upstream. # Documentation * Added documentation for the path, filePath, product and project variables. * Added sample codesign settings to the Cocoa Touch Application example. # Build System * Updated Qt static Docker image to Qt 6.5.0 and Qbs 1.24. # Contributors * Andrey Filipenkov * Christian Kandeler * Denis Shienkov * Ivan Komissarov * Marc Mutz * Raphael Cotty * Thiemo van Engelen qbs-src-3.2.0/changelogs/changes-1.17.0.md0000644000175100017510000000651215154533055017274 0ustar runnerrunner# General * The lookup order in PathProbe changed to [environmentPaths, searchPaths, platformEnvironmentPaths, platformSearchPaths]. * The pathPrefix and platformPaths properties have been removed from the PathProbe item. They were deprecated since Qbs 1.13. * The protocBinary property in the protobuf module has been renamed to compilerPath. * A new module capnp for Cap'n Proto in C++ applications has been added. Cap'n Proto is a serialization protocol similar to protobuf. * The qbs-setup-android tool got a --system flag to install profiles system-wide similar to qbs-setup-qt and qbs-setup-toolchains. # Language * The product and project variables are now available on the right-hand-side of moduleProvider expressions and the default scope is product (QBS-1587). # C/C++ Support * Lots of improvements have been made on toolchain support for bare-metal devices in general. Bare-metal targets can be selected by setting qbs.targetPlatform to 'none'. * KEIL: The ARMCLANG, C166 and C251 toolchains are now supported. * IAR: National's CR16, Microchip's AVR32, NXP's M68K, Renesas' M8/16C/M32C/R32C/SuperH targets and RISC-V targets are now supported. * GCC: National's CR16, NXP M68K, Renesas M32C/M32R/SuperH/V850 as well as RISC-V and Xtensa targets are now supported. * MSVC: Module definition files can now be used to provide the linker with information about exports and attributes (QBS-571). * MSVC: "/external:I" is now used to set system include paths (QBS-1573). * MSVC: cpp.generateCompilerListingFiles is now supported to generate assembler listings. * Xcode: macOS framework paths on the command line are now automatically deduplicated (QBS-1552). * Xcode: Support for Xcode 12.0 has been added (QBS-1582). # Qt Support * The Qt for Android modules have been cleaned up. Support for ARMv5, MIPS and MIPS64 targets has been removed (QBS-1496). * Initial support for Qt6 has been added. # Android Support * A packageType property has been added to the Android.sdk module which allows to create Android App bundles (aab) instead of apk packages only. * A aaptName property has been added to the Android.sdk module which allows to use aapt2 (QBS-1562) since aapt has been deprecated. # Documentation * New bare-metal examples have been added and existing examples have been ported to more toolchains. * A new how-to about cpp.rPaths has been added (QBS-1204). * Various minor improvements have been made. # Important Bug Fixes * Building Qt for Android applications as static libraries has been fixed (QBS-1545). * Trailing slashes are no longer removed from Visual Studio environment variables (QBS-1551). * The MSVC cpp module did not use the cpp.distributionIncludePaths property (QBS-1572). * The visual studio generator has been fixed to work with Visual Studio 16.6 (QBS-1569). * Fixed extraction of build information from CONFIG and QT_CONFIG variables in Qt installations (QBS-1387). * The version number is no longer appended to .so files on Android (QBS-1578). * Compiler defines are now correctly passed to moc when processing header files (QBS-1592). # Contributors * Alberto Mardegan * Christian Gagneraud * Christian Kandeler * Christian Stenger * Denis Shienkov * Ivan Komissarov * Jake Petroules * Jochen Ulrich * Mitch Curtis * Oliver Wolff * Raphaël Cotty * Richard Weickelt * Sergey Zhuravlev qbs-src-3.2.0/changelogs/changes-1.7.20000644000175100017510000000045215154533055016613 0ustar runnerrunnerImportant bug fixes: * macOS: Fixed App Extension builds on older versions of Xcode/macOS * Windows: Fixed handling of files on network shares * Fixed syntax error in Qt module that occurred with static Qt builds * Several fixes for the Visual Studio generator (QBS-1077, QBS-1100) qbs-src-3.2.0/changelogs/changes-1.18.2.md0000644000175100017510000000171615154533055017300 0ustar runnerrunner# C/C++ Support * qbs-setup-toolchains is now able to detect clang-cl properly * The Library and Include probes take more paths into account on Linux to better support containerization systems such as Flatpak. * Xcode autodetection now uses xcode-select to find Xcode on the system. # Protocol Buffers Support (Protobuf Module) * A missing nanopb generator file extension on windows has been added. * The problem that property _libraryName was incorrect when protobuf was not found has been fixed. # Android Support * An assertion when building Android applications using additional java classes with native methods has been fixed (QBS-1628). # Qt Support * A problem related to handling Qt6EntryPoint in the Qt module provider has been fixed. # Infrastructure * A Qt4 docker image for basic testing has been added. # Contributors * Christian Kandeler * Eike Ziller * Ivan Komissarov * Jan Blackquill * Kai Dohmen * Raphaël Cotty * Richard Weickelt qbs-src-3.2.0/changelogs/changes-1.7.10000644000175100017510000000037115154533055016612 0ustar runnerrunnerImportant bug fixes: * Fixed race condition in qmake build (QBS-1091) * Qt Creator no longer leaves empty build directories behind after cancelled project loading (QTCREATORBUG-17543) * Fixed an exception crossing the API boundary qbs-src-3.2.0/changelogs/changes-2.6.1.md0000644000175100017510000000057315154533055017215 0ustar runnerrunner# General * Fixed vcs module behavior when .git/logs/HEAD is not present (QBS-1814). # Language * Fixed behavior of SubProject.inheritProperties (QBS-1836). # Darwin support * Fixed generating iOS codesign entitlements (QBS-1826). # Qt support * Fixed Qt module provider when multiple qmake binaries are present in PATH. # Contributors * Christian Kandeler * Ivan Komissarov qbs-src-3.2.0/changelogs/changes-1.6.00000644000175100017510000000163115154533055016610 0ustar runnerrunner* Added lex_yacc module. * Introduced property cpp.systemRunPaths. * Introduced the ability to check a module's version in a Depends item. * Introduced cpp.driverFlags, which allows specifying flags to be passed to the compiler driver (in any mode), but never the system linker. * Introduced cpp.linkerMode property to allow selection of the correct linker (C driver, C++ driver, or system linker) based on the objects being linked. * Added automatic escaping of arguments passed to the cpp.linkerFlags and cpp.platformLinkerFlags properties using the -Wl or -Xlinker syntaxes. To revert to the old behavior, Project.minimumQbsVersion can be set to a version lower than 1.6. * Each build configuration now requires a unique name, which is specified on the command line in the same place that qbs.buildVariant used to be specified. This allows building for multiple configurations with the same variant. qbs-src-3.2.0/changelogs/changes-1.20.0.md0000644000175100017510000000410115154533055017256 0ustar runnerrunner# General * CMake and Qbs builds now fully support building with Qt6. * Qbs now prints the old properties set when refusing to build a project with changed properties. * Added convenience command to qbs-config to add a profile in one go instead of setting properties separately (QTCREATORBUG-25463). * Added profiling timer for module providers. # C/C++ Support * Added support for the COSMIC COLDFIRE (also known as M68K) compiler (QBS-1648). * Added support for the COSMIC HCS08 compiler (QBS-1641). * Added support for the COSMIC HCS12 compiler (QBS-1640). * Added support for the COSMIC STM8 compiler (QBS-1639). * Added support for the COSMIC STM32 compiler (QBS-1638). * Added support for the new Digital Mars toolchain (QBS-1636). * The new cpp.enableCxxLanguageMacro property was added for the MSVC toolchain that controls the /Zc:__cplusplus required for proper support of the new C++ standards (QBS-1655). * Added support for the "c++20" language version for the MSVC toolchain which results in adding the /std:c++latest flag (QBS-1656). # Qt Support * Consider "external" modules * Fix support for qml binaries that were moved to the libexec directory in Qt 6.2 (QBS-1636). # Android Support * Added option to use dex compiler d8 instead of dx. * Ministro support was removed. * Fix link with static stl on Android (QBS-1654) * The default Android Asset Packaging Tool was change from aapt to aapt2. # Apple Support * Qbs now uses embedded build specs from Xcode 12.4 when bundle.useXcodeBuildSpecs is true instead of older specs from Xcode 9.2. # Important Bug Fixes * Fix handling cpp.linkerWrapper with the MSVC toolchain (QBS-1653). # Infrastructure * Windows-only tests are moved to a separate tst_blackbox_windows binary. * Qbs was updated to 1.18.2 in Docker images as well as in GitHub actions jobs. * Added Qbs build and tests with the MinGW toolchain. * Added CMake build with Qt6 on Linux. # Contributors * Christian Kandeler * Denis Shienkov * Eike Ziller * Ivan Komissarov * Jan Blackquill * Mitch Curtis * Oswald Buddenhagen * Raphaël Cotty * Richard Weickelt qbs-src-3.2.0/changelogs/changes-2.2.1.md0000644000175100017510000000040615154533055017204 0ustar runnerrunner# Language * Fixed JavaScript Date() constructor on Windows (QBS-1768). # C/C++ support * Worked around crash in cl.exe when retrieving built-in defines (QBS-1743). # CI * Fixed building release packages. # Contributors * Christian Kandeler * Ivan Komissarov qbs-src-3.2.0/changelogs/changes-1.16.0.md0000644000175100017510000001224115154533055017267 0ustar runnerrunner# General * A new freedesktop module helps UNIX application developers to follow the freedesktop.org guidelines. * The Android module now allows resourcesDir, sourcesDir and assetsDir to be specified as relative paths. * A new ConanfileProbe allows better and more flexible integration of Qbs and the Conan package manager. * A new hostArchitecture property has been added to the qbs module. # Language * List properties in modules are now merged according to inter-module dependencies. This is important when flags like cpp.staticLibraries are contributed by multiple modules with dependencies between each other. (QBS-1517). * Dependency matching of multiplexed products is now less strict and does not require all multiplex properties to match. For instance, if product A is multiplexed over qbs.architecture and qbs.buildVariant while product B is only multiplexed over one of these axes, then Qbs no longer fails (QBS-1515). # C/C++ Support * The Renesas RL78 architecture is now supported in GCC and IAR and the toolchains are auto-detected by qbs-setup-toolchains. * The Renesas RX as well as the RH850, V850, 78K are now supported in IAR and the toolchains are auto-detected by qbs-setup-toolchains. * The MPLAB X32 GCC-based toolchain is now auto-detected on Windows. * Multiple occurrences of static libraries on the linker command line are now pruned and the last instance always wins when using GCC or LLVM-based toolchains. This avoids problems with excessively long linker command lines (QBS-1273). * Clang-cl and MSVC toolchains use the compiler frontend instead of the linker when linking. The old behavior can be restored by setting cpp.linkerMode to "manual". This allows to use sanitizers with clang-cl by passing "-fsanitise=xxx" via cpp.driverFlags (QBS-1522). * The clang-cl toolchain now uses "link.exe" as the default linker. "lld-link.exe" can be explicitly selected by setting cpp.linkerVariant to "lld" (QBS-1522). * The MSVC, clang-cl and MinGW toolchains are now automatically detected if the profile does not set an explicit installation location, for instance because no profile was given. * Installation of separate debug information can now be enabled and configured by simply setting the installDebugInformation and debugInformationInstallDir properties in the Application and Library convenience items. This works for toolchains based upon GCC, MSVC or clang-cl. * Xcode version 11.4 is now supported on macOS. # Qt Support * Qbs now supports Qt 5.14 for Android which comes as a multi-architecture package. The qbs-setup-android tool has been updated accordingly (QBS-1497). * JSON metatype files generated by moc (Qt >= 5.15) are supported by setting Qt.core.generateMetaTypesFile and Qt.core.metaTypesInstallDir (QBS-1531). * Pure debug builds of Qt (>= 5.14) with MinGW are now properly supported. They don't have the 'd' suffix (QTBUG-80792). * The QML type declaration mechanism introduced in Qt 5.15 is now supported by the Qt.qml module (QBS-1531). * Generated qmltypes files are now named according to the product's targetName property (QTBUG-82710). # Documentation * The how-to chapter has been extended with sections about debugging Qbs files and about building separate debug information in C++ projects. * The item and module reference documentation has been improved for the cpp.libraryPaths, cpp.dynamicLibraries (QBS-1516), qbs.toolchainType and qbs.toolchain properties as well as the Export item and the Library convenience item. * Documentation for various path probes has been added (QBS-1187). * The README was extended and a CONTRIBUTING file has been added which provides useful information for potential contributors. This is important for people looking at our github mirror. # Infrastructure * The Debian Docker image has been removed. * We are now using ccache and clcache in our CI pipelines to shrink the build time. * Clang-tidy is now used to identify potential problems in the code base and a lot of action was taken upon a lot of findings. * A Docker image for testing Qbs with Android and Qt has been added. # Important Bug Fixes * Fix nullpointer access and heap-use-after-free error (QBS-1485). * Select the right instance when Depends.profiles is used on a dependency with an aggregator product (QBS-1513). * Fix crash when specifying a non-existing profile in Depends.profiles (QBS-1514). * Try harder to detect GCC toolchains in qbs-setup-toolchains (QBS-1524). * Code signing for Core Foundation Bundles on macOS has been fixed. * Automatic artifact scanning now prefers artifacts from product dependencies if multiple candidates are found. This improves dependency tracking in complex projects (QBS-1532). * The grpcIncludePath property in the probufcpp module has been fixed (QBS-1542). * Qbs does no longer crash when accessing a property of a non-existent module in "IDE mode". # Contributors * Alberto Mardegan * Björn Schäpers * BogDan Vatra * Christian Kandeler * Christian Stenger * Denis Shienkov * Ivan Komissarov * Jochen Ulrich * Joerg Bornemann * Leon Buckel * Marius Sincovici * Maximilian Goldstein * Mitch Curtis * Oliver Wolff * Orgad Shaneh * Raphaël Cotty * Richard Weickelt qbs-src-3.2.0/changelogs/changes-1.8.00000644000175100017510000000317015154533055016612 0ustar runnerrunnerFeatures: * General: * It is no longer strictly required to provide a profile. * Sub-second timestamp resolutions are now supported on Unix systems. * Added a convenient replacement for product.moduleProperty("module", "property"), namely product.module.property. * The loadFile and loadExtension functions are deprecated in favor of the new require function, which accepts arguments of either form accepted by the deprecated functions. * Added new tool qbs-create-project to set up a new qbs project from an existing source tree. * FileTagger items can now have conditions. * Probe items can now appear directly under a Project item. * Cpp module: * Added support for QNX and the QCC toolchain * Added the cpp.useRPathLink property to control whether to use the -rpath-link linker option. * Provided the means to easily combine source files for the C language family in order to support "amalgamation builds". * Introduced cpp.treatSystemHeadersAsDependencies. * Qt modules: * Introduced property Qt.core.combineMocOutput. * Introduced Qt.core.enableKeywords for simple disabling of the "signals", "slots" and "emit" symbols. Important bug fixes: * Improved scalability of parallel builds on Linux by starting Process commands via a dedicated launcher process. Behavior changes: * The base directory for source files changed from the product source directory to the parent directory of the file where the files are listed. qbs-src-3.2.0/changelogs/changes-1.9.1.md0000644000175100017510000000037315154533055017215 0ustar runnerrunner# Important bugfixes * Lower the response file threshold on Windows to fix build failures with mingw (QBS-1201). * Fix explicitly specified build variant being ignored for Darwin targets (QBS-1202). * Fix building for the AVR architecture (QBS-1203). qbs-src-3.2.0/changelogs/changes-2.3.1.md0000644000175100017510000000064715154533055017214 0ustar runnerrunner# Language * Fixed look-up of qbs properties in module providers via probes (QBS-1742). # Apple support * Fixed codesign module when multiplexing over build variants (QBS-1775). # Qt support * Fixed retrieving minimum macOS/iOS versions for Qt 6.7.1. # CI * Fixed release jobs. * Fixed macOS 14.2 job. * Updated GitHub actions to recent versions to avoid warnings. # Contributors * Christian Kandeler * Ivan Komissarov qbs-src-3.2.0/changelogs/changes-1.19.0.md0000644000175100017510000000471415154533055017300 0ustar runnerrunner# General * New codesign module was added to implement code signing for Apple, Android and Windows platforms (QBS-899, QBS-1546). * It is now possible to build Qbs with Qt 6. * Project files update API depending on the Qt.gui module was removed. This allows to enable project files update API unconditionally when building Qbs. * Convenience items such as Application, DynamicLibrary and StaticLibrary now properly install artifacts when multiplexing. # C/C++ Support * Qbs now supports multiple MSVC compiler versions installed in one Visual Studio installation (QBS-1498). Also, multiple compiler versions are properly detected by qbs setup-toolchains. * It is now possible to specify Windows SDK version for the MSVC and clang-cl toolchains via the new cpp.windowsSdkVersion property. * baremetal: Fix generation of compiler listing files with custom extension for the SDCC compiler. * baremetal: Fix generation of compiler listing files for the ARMCC compiler. * baremetal: Fix detection for Keil toolchains. * baremetal: Add support for HCS08 architectures to SDCC and IAR toolchains (QBS-1631, QBS-1629). * baremetal: Add support for HCS12 architectures to GCC and IAR toolchains (QBS-1630, QBS-1550). # Qt Support * Fix possible command line length issue with qmlimportscanner (QBS-1633). * Fix accessing binaries from libexec for Qt 6.1 and above (QBS-1636). # Android Support * Added a workaround for the Qt.Network module dependencies for 5.15.0 < Qt < 5.15.3 (QTBUG-87288) * Fix aapt command invocation on Windows. * Added support for ndk 22.1.7171670. # Documentation * Added How-To about codesigning on Apple platforms. * Cocoa Touch Application example is brought up-to date to use modern Apple practices. * Added example how to use the cpp.linkerVariant property. * Added missing documentation for the cpp.toolchainInstallPath property. * Added missing documentation for the supported 'bare-metal' architectures. # Important Bug Fixes * Added support for Xcode 12.5 (QBS-1644). * Fix support for Python 3.9 for building Apple DMG images (QBS-1642). # Infrastructure * Ubuntu Focal image was updated to use Qt 5.15.2 and Qbs 1.17.1. * Added automated tests for Qt 6 for macOS, Linux and Windows. * Added a self-hosted runner to run 'bare-metal' tests on Windows. # Contributors * Andrey Filipenkov * Denis Shienkov * Christian Kandeler * Jan Blackquill * Jake Petroules * Ivan Komissarov * Max Bespalov * Mitch Curtis * Orgad Shaneh * Raphaël Cotty * Richard Weickelt qbs-src-3.2.0/changelogs/changes-3.0.3.md0000644000175100017510000000111515154533055017203 0ustar runnerrunner# General * Fixed spurious complaint about property binding loop (QBS-1845). # CI * Ad-hoc signed macOS artifacts are now published by release jobs. # C/C++ support * Made defines and include paths for windres unique. * Fixed support for STABLE and CURRENT releases for FreeBSD. * Fixed default values for qbspkgconfig search paths on FreeBSD. # Qt support * Fixed building Qt apps for iOS-simulator when qbs.architecture is undefined. * Fixed duplicate JSON metadata files appearing on qmlregistrar command lines. # Contributors * Björn Schäpers * Christian Kandeler * Pino Toscano qbs-src-3.2.0/changelogs/changes-2.1.2.md0000644000175100017510000000105215154533055017202 0ustar runnerrunner# General * Fixed handling JS floating-point values for x86. * Fixed scope pollution and potential crash when assigning to provider properties (QBS-1747). * Fixed potential access to freed JSValues (QBS-1751). # Qt * Fixed building against Qt with "profiling" build variant (QBS-1758). # Apple * Fixed bundle module with Xcode-less profiles. * Fixed ApplicationExtension with Xcode-less profiles. # Infrastructure * Added CI job to be able to test XCode-less profiles on macOS. # Contributors * Christian Kandeler * Dmitry Shachnev * Ivan Komissarov qbs-src-3.2.0/LICENSE.LGPLv210000644000175100017510000006350215154533055014603 0ustar runnerrunner GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! qbs-src-3.2.0/docker/0000755000175100017510000000000015154533055013751 5ustar runnerrunnerqbs-src-3.2.0/docker/entrypoint.sh0000755000175100017510000000720015154533055016522 0ustar runnerrunner#!/usr/bin/env bash set -e ############################################################################# ## ## Copyright (C) 2019 Richard Weickelt ## 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$ ## ############################################################################# # # Entrypoint script when starting the container. The script checks the current # working directory and changes the uid/gid of developer/users to match whatever # is found in the working directory. This is useful to match the user and group # of mounted volumes into the container # # If not root, re-run script as root to fix ids # if [ "$(id -u)" != "0" ]; then exec gosu root /sbin/entrypoint.sh "$@" fi # # Try to determine the uid of the working directory and adjust the current # user's uid/gid accordingly. # USER_GID=${USER_GID:-$(stat -c "%g" .)} USER_UID=${USER_UID:-$(stat -c "%u" .)} USER_NAME=${USER_NAME:-devel} USER_GROUP=${USER_GROUP:-devel} EXEC="" export HOME=/home/${USER_NAME} # # This is a problem on Linux hosts when we mount a folder from the # user file system and write artifacts into that. Thus, we downgrade # the current user and make sure that the uid and gid matches the one # of the mounted project folder. # # This work-around is not needed on Windows hosts as Windows doesn't # have such a concept. # if [ "${USER_UID}" != "0" ]; then if [ "$(id -u ${USER_NAME})" != "${USER_UID}" ]; then usermod -o -u ${USER_UID} ${USER_NAME} # After changing the user's uid, all files in user's home directory # automatically get the new uid. fi current_gid=$(id -g ${USER_NAME}) if [ "$(id -g ${USER_NAME})" != "${USER_GID}" ]; then groupmod -o -g ${USER_GID} ${USER_GROUP} # Set the new gid on all files in the home directory that still have the # old gid. find /home/${USER_NAME} -gid "${current_gid}" ! -type l -exec chgrp ${USER_GID} {} \; fi fi EXEC="exec gosu ${USER_NAME}:${USER_GROUP}" if [ -z "$1" ]; then ${EXEC} bash -l else ${EXEC} bash -l -c "$*" fi qbs-src-3.2.0/docker/leap/0000755000175100017510000000000015154533055014672 5ustar runnerrunnerqbs-src-3.2.0/docker/leap/entrypoint.sh0000755000175100017510000000720415154533055017447 0ustar runnerrunner#!/usr/bin/env bash set -e ############################################################################# ## ## Copyright (C) 2019 Richard Weickelt ## 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$ ## ############################################################################# # # Entrypoint script when starting the container. The script checks the current # working directory and changes the uid/gid of developer/users to match whatever # is found in the working directory. This is useful to match the user and group # of mounted volumes into the container # # If not root, re-run script as root to fix ids # if [ "$(id -u)" != "0" ]; then exec sudo -i /sbin/entrypoint.sh "$@" fi # # Try to determine the uid of the working directory and adjust the current # user's uid/gid accordingly. # USER_GID=${USER_GID:-$(stat -c "%g" .)} USER_UID=${USER_UID:-$(stat -c "%u" .)} USER_NAME=${USER_NAME:-devel} USER_GROUP=${USER_GROUP:-devel} EXEC="" export HOME=/home/${USER_NAME} # # This is a problem on Linux hosts when we mount a folder from the # user file system and write artifacts into that. Thus, we downgrade # the current user and make sure that the uid and gid matches the one # of the mounted project folder. # # This work-around is not needed on Windows hosts as Windows doesn't # have such a concept. # if [ "${USER_UID}" != "0" ]; then if [ "$(id -u ${USER_NAME})" != "${USER_UID}" ]; then usermod -o -u ${USER_UID} ${USER_NAME} # After changing the user's uid, all files in user's home directory # automatically get the new uid. fi current_gid=$(id -g ${USER_NAME}) if [ "$(id -g ${USER_NAME})" != "${USER_GID}" ]; then groupmod -o -g ${USER_GID} ${USER_GROUP} # Set the new gid on all files in the home directory that still have the # old gid. find /home/${USER_NAME} -gid "${current_gid}" ! -type l -exec chgrp ${USER_GID} {} \; fi fi EXEC="exec sudo -u ${USER_NAME} -g ${USER_GROUP}" if [ -z "$1" ]; then ${EXEC} bash -l else ${EXEC} bash -l -c "$*" fi qbs-src-3.2.0/docker/leap/Dockerfile0000644000175100017510000000557615154533055016701 0ustar runnerrunner# # Install Qt and Qbs for Linux # FROM opensuse/leap:15.3 LABEL Description="OpenSUSE development environment for Qbs with Qt and various dependencies for testing Qbs modules and functionality" ARG QT_VERSION ARG QTCREATOR_VERSION # Allow colored output on command line. ENV TERM=xterm-color # # Make it possible to change UID/GID in the entrypoint script. The docker # container usually runs as root user on Linux hosts. When the Docker container # mounts a folder on the host and creates files there, those files would be # owned by root instead of the current user. Thus we create a user here who's # UID will be changed in the entrypoint script to match the UID of the current # host user. # ARG USER_UID=1000 ARG USER_NAME=devel RUN zypper in -y \ ca-certificates \ sudo \ system-user-mail \ system-group-wheel && \ groupadd -g ${USER_UID} ${USER_NAME} && \ useradd -s /bin/bash -u ${USER_UID} -g ${USER_NAME} -o -c "" -m ${USER_NAME} && \ usermod -a -G wheel ${USER_NAME} && \ echo "%devel ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers COPY docker/leap/entrypoint.sh /sbin/entrypoint.sh ENTRYPOINT ["/sbin/entrypoint.sh"] # # Qbs build dependencies RUN zypper install -y \ bison \ capnproto \ ccache \ cmake \ command-not-found \ curl \ gcc10 \ gcc10-c++ \ glibc-devel-static \ flex \ fontconfig \ git \ gzip \ help2man \ icoutils \ libcapnp-devel \ libgthread-2_0-0 \ libfreetype6 \ Mesa-libGL-devel \ Mesa-libGL1 \ nanopb-devel \ ninja \ perl \ pkg-config \ psmisc \ python3-pip \ p7zip-full \ subversion \ tar \ unzip \ which \ zip && \ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 && \ update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100 && \ pip install --upgrade pip && \ pip install beautifulsoup4 lxml # # Install Qt and Qbs for Linux from qt.io # COPY scripts/install-qt.sh install-qt.sh RUN ./install-qt.sh --version ${QT_VERSION} qtbase qtdeclarative qttools qtx11extras qtscxml qt5compat icu && \ ./install-qt.sh --version ${QTCREATOR_VERSION} qtcreator && \ echo "export PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:/opt/Qt/Tools/QtCreator/bin:\${PATH}" > /etc/profile.d/qt.sh ENV PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:/opt/Qt/Tools/QtCreator/bin:${PATH} # Configure Qbs USER $USER_NAME RUN qbs-setup-toolchains /usr/bin/g++ gcc && \ qbs-setup-qt /opt/Qt/${QT_VERSION}/gcc_64/bin/qmake qt-gcc_64 && \ qbs config profiles.qt-gcc_64.baseProfile gcc && \ qbs config defaultProfile qt-gcc_64 # Switch back to root user for the entrypoint script. USER root # Work-around for QTBUG-79020 RUN echo "export QT_NO_GLIB=1" >> /etc/profile.d/qt.sh qbs-src-3.2.0/docker/noble/0000755000175100017510000000000015154533055015050 5ustar runnerrunnerqbs-src-3.2.0/docker/noble/test-baremetal.Dockerfile0000644000175100017510000000300115154533055021744 0ustar runnerrunner# # Baremetal toolchains for testing Qbs # FROM ubuntu:noble LABEL Description="Ubuntu baremetal test environment for Qbs" # Allow colored output on command line. ENV TERM=xterm-color # # Make it possible to change UID/GID in the entrypoint script. The docker # container usually runs as root user on Linux hosts. When the Docker container # mounts a folder on the host and creates files there, those files would be # owned by root instead of the current user. Thus we create a user here who's # UID will be changed in the entrypoint script to match the UID of the current # host user. # ARG USER_UID=1000 ARG USER_NAME=devel RUN apt-get update -qq && \ apt-get install -qq -y \ ca-certificates \ gosu \ sudo && \ userdel ubuntu && \ groupadd -g ${USER_UID} ${USER_NAME} && \ useradd -s /bin/bash -u ${USER_UID} -g ${USER_NAME} -o -c "" -m ${USER_NAME} && \ usermod -a -G sudo ${USER_NAME} && \ echo "%devel ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers COPY docker/entrypoint.sh /sbin/entrypoint.sh ENTRYPOINT ["/sbin/entrypoint.sh"] # Install baremetal toolchains and Qbs runtime dependencies. RUN apt-get update -qq && \ apt-get install -qq -y \ libasan5 \ libglib2.0-0 \ libgssapi-krb5-2 \ gcc-arm-none-eabi \ gcc-avr \ avr-libc \ sdcc \ binutils-xtensa-lx106 \ gcc-xtensa-lx106 \ gcc-riscv64-unknown-elf # Work-around for QTBUG-79020. RUN echo "export QT_NO_GLIB=1" >> /etc/profile.d/qt.sh qbs-src-3.2.0/docker/noble/test-android.Dockerfile0000644000175100017510000001266215154533055021445 0ustar runnerrunner# # Android SDK/NDK + Qt for Android for testing Qbs # FROM ubuntu:noble LABEL Description="Ubuntu test environment for Qbs and Qt for Android" # Allow colored output on command line. ENV TERM=xterm-color # # Make it possible to change UID/GID in the entrypoint script. The docker # container usually runs as root user on Linux hosts. When the Docker container # mounts a folder on the host and creates files there, those files would be # owned by root instead of the current user. Thus we create a user here who's # UID will be changed in the entrypoint script to match the UID of the current # host user. # ARG USER_UID=1000 ARG USER_NAME=devel RUN apt-get update -qq && \ apt-get install -qq -y \ ca-certificates \ gosu \ sudo && \ userdel ubuntu && \ groupadd -g ${USER_UID} ${USER_NAME} && \ useradd -s /bin/bash -u ${USER_UID} -g ${USER_NAME} -o -c "" -m ${USER_NAME} && \ usermod -a -G sudo ${USER_NAME} && \ echo "%devel ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers COPY docker/entrypoint.sh /sbin/entrypoint.sh ENTRYPOINT ["/sbin/entrypoint.sh"] # Qbs build dependencies RUN apt-get update -qq && \ apt-get install -qq -y --no-install-recommends \ ca-certificates \ curl \ gdb \ libasan5 \ libglib2.0-0 \ locales \ openjdk-8-jdk-headless \ p7zip-full \ unzip # Set the locale RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ locale-gen ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 RUN echo "export JAVA_HOME=${JAVA_HOME}" > /etc/profile.d/android.sh && \ echo "export PATH=${JAVA_HOME}/bin:\${PATH}" >> /etc/profile.d/android.sh ARG ANDROID_NDK_VERSION ENV ANDROID_HOME="/home/${USER_NAME}/android" ENV ANDROID_SDK_ROOT=${ANDROID_HOME} ENV ANDROID_NDK_ROOT=${ANDROID_HOME}/"ndk"/${ANDROID_NDK_VERSION} ENV PATH="${JAVA_HOME}:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/cmdline-tools/bin:$PATH" RUN echo "export ANDROID_HOME=/home/${USER_NAME}/android" >> /etc/profile.d/android.sh && \ echo "export ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" >> /etc/profile.d/android.sh && \ echo "export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT}" >> /etc/profile.d/android.sh && \ echo "export PATH=${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/cmdline-tools/bin:\$PATH" >> /etc/profile.d/android.sh # # We ned to run the following steps as the target user # USER ${USER_NAME} RUN mkdir ${ANDROID_HOME} # Get Android command line tools ARG COMMAND_LINE_TOOLS_VERSION="6858069" RUN curl -s https://dl.google.com/android/repository/commandlinetools-linux-${COMMAND_LINE_TOOLS_VERSION}_latest.zip > ${ANDROID_HOME}/commandlinetools.zip && \ unzip ${ANDROID_HOME}/commandlinetools.zip -d ${ANDROID_HOME} && \ rm -v ${ANDROID_HOME}/commandlinetools.zip # Accept SDK license ARG ANDROID_PLATFORM="android-30" ARG BUILD_TOOLS="29.0.2" RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" --verbose --licenses && \ sdkmanager "--sdk_root=${ANDROID_HOME}" --update && \ sdkmanager "--sdk_root=${ANDROID_HOME}" "platforms;${ANDROID_PLATFORM}" RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "build-tools;${BUILD_TOOLS}" RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "platform-tools" RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "tools" RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "ndk;${ANDROID_NDK_VERSION}" RUN /usr/lib/jvm/java-8-openjdk-amd64/bin/keytool -genkey -keystore /home/${USER_NAME}/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname 'CN=Android Debug,O=Android,C=US' # Install ndk samples in ${ANDROID_NDK_ROOT}/samples RUN cd ${ANDROID_NDK_ROOT} && \ curl -sLO https://github.com/android/ndk-samples/archive/master.zip && \ unzip -q master.zip && \ rm -v master.zip && \ mv ndk-samples-master samples # Install android-BasicMediaDecoder in ${ANDROID_SDK_ROOT}/samples RUN mkdir ${ANDROID_SDK_ROOT}/samples && \ cd ${ANDROID_SDK_ROOT}/samples && \ curl -sLO https://github.com/googlearchive/android-BasicMediaDecoder/archive/master.zip && \ unzip -q master.zip && \ rm -v master.zip && \ mv android-BasicMediaDecoder-master android-BasicMediaDecoder # Download buildtool to generate aab packages in ${ANDROID_SDK_ROOT} RUN cd ${ANDROID_SDK_ROOT} && \ curl -sLO https://github.com/google/bundletool/releases/download/1.3.0/bundletool-all-1.3.0.jar USER root # # Install Qt and Qbs for Linux from qt.io # ARG QT_VERSION COPY scripts/install-qt.sh install-qt.sh RUN if [ "${QT_VERSION}" \< "5.14" ] || [ ! "${QT_VERSION}" \< "6.0.0" ]; then \ QT_ABIS="android_armv7 android_arm64_v8a android_x86 android_x86_64"; \ else \ QT_ABIS="any"; \ fi; \ if [ ! "${QT_VERSION}" \< "6.0.0" ]; then \ ./install-qt.sh --version ${QT_VERSION} qtbase qtdeclarative icu; \ if [ "${QT_VERSION}" \< "6.1.0" ]; then \ QT_COMPONENTS="qtbase qtdeclarative qttools qtquickcontrols2 qtquicktimeline svg"; \ else \ QT_COMPONENTS="qtbase qtdeclarative qttools qtquicktimeline svg"; \ fi; \ else \ QT_COMPONENTS="qtbase qtdeclarative qttools qtimageformats"; \ fi; \ for abi in ${QT_ABIS}; do \ ./install-qt.sh --version ${QT_VERSION} --target android --toolchain ${abi} ${QT_COMPONENTS}; \ done && \ echo "export QT_VERSION=${QT_VERSION}" >> /etc/profile.d/qt.sh qbs-src-3.2.0/docker/noble/test-qt6-static.Dockerfile0000644000175100017510000002151115154533055022015 0ustar runnerrunner# # Testing Qbs with static qt6 # FROM ubuntu:noble LABEL Description="Ubuntu static qt6 test environment for Qbs" ARG QT_VERSION ARG QTCREATOR_VERSION # Allow colored output on command line. ENV TERM=xterm-color # # Make it possible to change UID/GID in the entrypoint script. The docker # container usually runs as root user on Linux hosts. When the Docker container # mounts a folder on the host and creates files there, those files would be # owned by root instead of the current user. Thus we create a user here who's # UID will be changed in the entrypoint script to match the UID of the current # host user. # ARG USER_UID=1000 ARG USER_NAME=devel RUN apt-get update -qq && \ apt-get install -qq -y \ ca-certificates \ gosu \ sudo && \ userdel ubuntu && \ groupadd -g ${USER_UID} ${USER_NAME} && \ useradd -s /bin/bash -u ${USER_UID} -g ${USER_NAME} -o -c "" -m ${USER_NAME} && \ usermod -a -G sudo ${USER_NAME} && \ echo "%devel ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers COPY docker/entrypoint.sh /sbin/entrypoint.sh ENTRYPOINT ["/sbin/entrypoint.sh"] RUN apt-get update -qq && \ DEBIAN_FRONTEND="noninteractive" apt-get install -qq -y --no-install-recommends \ apt-transport-https \ build-essential \ clang-18 \ cmake \ git \ libassimp-dev \ libb2-dev \ libclang-18-dev \ libdbus-1-dev \ libdrm-dev \ libegl-dev \ libfontconfig1-dev \ libfreetype6-dev \ libglib2.0-dev \ libgstreamer1.0-dev \ libharfbuzz-dev \ libicu-dev \ libjpeg-dev \ libmd4c-html0-dev \ libssl-dev \ libsystemd-dev \ libudev-dev \ libvulkan-dev \ libwayland-dev \ libx11-dev \ libx11-xcb-dev \ libxcb-composite0-dev \ libxcb-cursor-dev \ libxcb-damage0-dev \ libxcb-dpms0-dev \ libxcb-dri2-0-dev \ libxcb-dri3-dev \ libxcb-ewmh-dev \ libxcb-glx0-dev \ libxcb-icccm4-dev \ libxcb-image0-dev \ libxcb-keysyms1-dev \ libxcb-present-dev \ libxcb-present-dev \ libxcb-randr0-dev \ libxcb-record0-dev \ libxcb-render-util0-dev \ libxcb-res0-dev \ libxcb-screensaver0-dev \ libxcb-shape0-dev \ libxcb-shm0-dev \ libxcb-sync-dev \ libxcb-sync0-dev \ libxcb-util-dev \ libxcb-xf86dri0-dev \ libxcb-xfixes0-dev \ libxcb-xinerama0-dev \ libxcb-xinput-dev \ libxcb-xtest0-dev \ libxcb-xv0-dev \ libxcb-xvmc0-dev \ libxcb1-dev \ libxext-dev \ libxfixes-dev \ libxi-dev \ libxkbcommon-dev \ libxkbcommon-x11-dev \ libxrender-dev \ libzstd-dev \ locales \ llvm-18-dev \ ninja-build \ perl \ python3 \ zlib1g-dev # Set the locale RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ locale-gen ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 ENV QT_HOME="/home/${USER_NAME}/qt" USER ${USER_NAME} RUN mkdir ${QT_HOME} RUN cd ${QT_HOME} && git clone https://code.qt.io/qt/qt5.git RUN cd ${QT_HOME}/qt5 && git checkout v${QT_VERSION} && perl init-repository COPY docker/noble/qt6.5.3-static.patch ${QT_HOME}/qt6.5.3-static.patch # fixes build with Ubuntu 24.04, see https://bugreports.qt.io/browse/QTBUG-117950 # RUN cd ${QT_HOME}/qt5/qtbase && git cherry-pick --no-commit bcdec67cd2e8063aca6beed6b301e47974bcd2ce # The following patch fixes by appling some commits # https://bugreports.qt.io/browse/QTBUG-117950 # bcdec67cd2e8063aca6beed6b301e47974bcd2ce # https://bugreports.qt.io/browse/QTBUG-119469 # 3f45905953d57e0174059d7d9d6bc75c3c1c406c # 7d9d1220f367d9275dfaa7ce12e89b0a9f4c1978 # 3073b9c4dec5e5877363794bf81cbd4b84fdb9ee RUN cd ${QT_HOME}/qt5/qtbase && git apply ${QT_HOME}/qt6.5.3-static.patch RUN mkdir ${QT_HOME}/static-build && \ cd ${QT_HOME}/static-build && \ ../qt5/configure -prefix /opt/Qt/${QT_VERSION}/gcc_64 -static \ -skip qt3d \ -skip qtactiveqt \ -skip qtcharts \ -skip qtconnectivity \ -skip qtcoap \ -skip qtdatavis3d \ -skip qthttpserver \ -skip qtimageformats \ -skip qtlanguageserver \ -skip qtlocation \ -skip qtlottie \ -skip qtmqtt \ -skip qtmultimedia \ -skip qtopcua \ -skip qtpositioning \ -skip qtqa \ -skip qtquick3d \ -skip qtquick3dphysics \ -skip qtquickeffectmaker \ -skip qtquicktimeline \ -skip qtsensors \ -skip qtspeech \ -skip qtvirtualkeyboard \ -skip qtwebchannel \ -skip qtwebview \ -skip qtwebengine RUN cd ${QT_HOME}/static-build && cmake --build . --parallel USER root RUN cd ${QT_HOME}/static-build && cmake --install . FROM ubuntu:noble LABEL Description="Ubuntu static qt6 test environment for Qbs" ARG QT_VERSION ARG QTCREATOR_VERSION RUN mkdir -p /opt/Qt COPY --from=0 /opt/Qt/${QT_VERSION} /opt/Qt/${QT_VERSION} # Allow colored output on command line. ENV TERM=xterm-color ARG USER_UID=1000 ARG USER_NAME=devel RUN apt-get update -qq && \ apt-get install -qq -y \ ca-certificates \ gosu \ sudo && \ userdel ubuntu && \ groupadd -g ${USER_UID} ${USER_NAME} && \ useradd -s /bin/bash -u ${USER_UID} -g ${USER_NAME} -o -c "" -m ${USER_NAME} && \ usermod -a -G sudo ${USER_NAME} && \ echo "%devel ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers COPY docker/entrypoint.sh /sbin/entrypoint.sh ENTRYPOINT ["/sbin/entrypoint.sh"] # Qbs build dependencies RUN apt-get update -qq && \ DEBIAN_FRONTEND="noninteractive" apt-get install -qq -y --no-install-recommends \ bison \ build-essential \ ca-certificates \ capnproto \ ccache \ clang-18 \ clang-tidy-18 \ cmake \ curl \ flex \ git \ help2man \ icoutils \ libb2-dev \ libbrotli-dev \ libcapnp-dev \ libdbus-1-dev \ libdrm-dev \ libfontconfig1-dev \ libfreetype6-dev \ libgl1-mesa-dev \ libglib2.0-dev \ libgrpc++-dev \ libharfbuzz-dev \ libicu-dev \ libjpeg-dev \ libmd4c-html0 \ libnanopb-dev \ libpcre++ \ libprotobuf-dev \ libx11-xcb-dev \ libxcb-composite0-dev \ libxcb-cursor-dev \ libxcb-damage0-dev \ libxcb-dpms0-dev \ libxcb-dri2-0-dev \ libxcb-dri3-dev \ libxcb-ewmh-dev \ libxcb-glx0-dev \ libxcb-icccm4-dev \ libxcb-image0-dev \ libxcb-keysyms1-dev \ libxcb-present-dev \ libxcb-present-dev \ libxcb-randr0-dev \ libxcb-record0-dev \ libxcb-render-util0-dev \ libxcb-res0-dev \ libxcb-screensaver0-dev \ libxcb-shape0-dev \ libxcb-shm0-dev \ libxcb-sync-dev \ libxcb-sync0-dev \ libxcb-util-dev \ libxcb-xf86dri0-dev \ libxcb-xfixes0-dev \ libxcb-xinerama0-dev \ libxcb-xinput-dev \ libxcb-xtest0-dev \ libxcb-xv0-dev \ libxcb-xvmc0-dev \ libxcb1-dev \ libxkbcommon-dev \ libudev-dev \ libxkbcommon-x11-dev \ libzstd-dev \ locales \ nanopb \ ninja-build \ nsis \ p7zip-full \ pkg-config \ protobuf-compiler \ protobuf-compiler-grpc \ psmisc \ python3-pip \ python3-setuptools \ python3-venv \ subversion \ unzip \ zip && \ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 && \ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100 && \ update-alternatives --install /usr/bin/clang-check clang-check /usr/bin/clang-check-18 100 && \ update-alternatives --install /usr/bin/python python /usr/bin/python3 100 ENV LLVM_INSTALL_DIR=/usr/lib/llvm-18 # Set up Python RUN python3 -m venv /venv && \ /venv/bin/pip3 install beautifulsoup4 lxml protobuf==3.19.1 pyyaml conan ENV PATH=/venv/bin:${PATH} # Set the locale RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ locale-gen ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 # # Install Qbs for Linux from qt.io # COPY scripts/install-qt.sh install-qt.sh RUN ./install-qt.sh --version ${QTCREATOR_VERSION} qtcreator && \ echo "export PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:/opt/Qt/Tools/QtCreator/bin:\${PATH}" > /etc/profile.d/qt.sh ENV PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:/opt/Qt/Tools/QtCreator/bin:${PATH} # Configure Qbs USER $USER_NAME RUN qbs-setup-toolchains /usr/bin/g++ gcc && \ qbs-setup-qt /opt/Qt/${QT_VERSION}/gcc_64/bin/qmake qt-gcc_64 && \ qbs config profiles.qt-gcc_64.baseProfile gcc && \ qbs config defaultProfile qt-gcc_64 # Switch back to root user for the entrypoint script. USER root # Work-around for QTBUG-79020 RUN echo "export QT_NO_GLIB=1" >> /etc/profile.d/qt.sh qbs-src-3.2.0/docker/noble/qt6.5.3-static.patch0000644000175100017510000000556515154533055020407 0ustar runnerrunnerdiff --git a/cmake/FindWrapZSTD.cmake b/cmake/FindWrapZSTD.cmake index fb86c27676..f1613543a4 100644 --- a/cmake/FindWrapZSTD.cmake +++ b/cmake/FindWrapZSTD.cmake @@ -25,14 +25,17 @@ find_package(zstd CONFIG QUIET) include(FindPackageHandleStandardArgs) -if(TARGET zstd::libzstd_static OR TARGET zstd::libzstd_shared) +if(TARGET zstd::libzstd_static OR TARGET zstd::libzstd_shared OR TARGET zstd::libzstd) find_package_handle_standard_args(WrapZSTD REQUIRED_VARS zstd_VERSION VERSION_VAR zstd_VERSION) - if(TARGET zstd::libzstd_static) - set(zstdtargetsuffix "_static") - else() + if(TARGET zstd::libzstd_shared) set(zstdtargetsuffix "_shared") + elseif(TARGET zstd::libzstd) + set(zstdtargetsuffix "") + else() + set(zstdtargetsuffix "_static") endif() + if(NOT TARGET WrapZSTD::WrapZSTD) add_library(WrapZSTD::WrapZSTD INTERFACE IMPORTED) set_target_properties(WrapZSTD::WrapZSTD PROPERTIES diff --git a/configure.cmake b/configure.cmake index be1a4f3bc3..e1ce168d26 100644 --- a/configure.cmake +++ b/configure.cmake @@ -109,8 +109,15 @@ SSL_free(SSL_new(0)); } ") -# special case end -qt_find_package(WrapZSTD 1.3 PROVIDED_TARGETS WrapZSTD::WrapZSTD MODULE_NAME global QMAKE_LIB zstd) +qt_find_package(WrapZSTD 1.3 + PROVIDED_TARGETS + WrapZSTD::WrapZSTD + zstd::libzstd + zstd::libzstd_static + zstd::libzstd_shared + MODULE_NAME global + QMAKE_LIB zstd +) qt_find_package(WrapDBus1 1.2 PROVIDED_TARGETS dbus-1 MODULE_NAME global QMAKE_LIB dbus) qt_find_package(Libudev PROVIDED_TARGETS PkgConfig::Libudev MODULE_NAME global QMAKE_LIB libudev) qt_find_package(LTTngUST PROVIDED_TARGETS LTTng::UST MODULE_NAME core QMAKE_LIB lttng-ust) diff --git a/src/gui/platform/unix/qxkbcommon.cpp b/src/gui/platform/unix/qxkbcommon.cpp index fc014b38e2..0de9e98fc7 100644 --- a/src/gui/platform/unix/qxkbcommon.cpp +++ b/src/gui/platform/unix/qxkbcommon.cpp @@ -239,10 +239,14 @@ static constexpr const auto KeyTbl = qMakeArray( Xkb2Qt, Xkb2Qt, Xkb2Qt, +/* The following four XKB_KEY_dead keys got removed in libxkbcommon 1.6.0 + The define check is kind of version check here. */ +#ifdef XKB_KEY_dead_lowline Xkb2Qt, Xkb2Qt, Xkb2Qt, Xkb2Qt, +#endif // Special keys from X.org - This include multimedia keys, // wireless/bluetooth/uwb keys, special launcher keys, etc. qbs-src-3.2.0/docker/noble/test-qt6-wasm.Dockerfile0000644000175100017510000000465215154533055021504 0ustar runnerrunner# # Testing Qbs with Web Assembly # FROM ubuntu:noble LABEL Description="Ubuntu wasm test environment for Qbs" ARG QT_VERSION ARG EMSCRIPTEN_VERSION # Allow colored output on command line. ENV TERM=xterm-color # # Make it possible to change UID/GID in the entrypoint script. The docker # container usually runs as root user on Linux hosts. When the Docker container # mounts a folder on the host and creates files there, those files would be # owned by root instead of the current user. Thus we create a user here who's # UID will be changed in the entrypoint script to match the UID of the current # host user. # ARG USER_UID=1000 ARG USER_NAME=devel RUN apt-get update -qq && \ apt-get install -qq -y \ ca-certificates \ gosu \ sudo && \ userdel ubuntu && \ groupadd -g ${USER_UID} ${USER_NAME} && \ useradd -s /bin/bash -u ${USER_UID} -g ${USER_NAME} -o -c "" -m ${USER_NAME} && \ usermod -a -G sudo ${USER_NAME} && \ echo "%devel ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers COPY docker/entrypoint.sh /sbin/entrypoint.sh ENTRYPOINT ["/sbin/entrypoint.sh"] RUN sudo apt-get update -qq && \ apt-get install -qq -y \ curl \ libglib2.0-0 \ locales \ p7zip-full \ python3 \ python3-pip \ unzip # Set the locale RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ locale-gen ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 RUN curl -L https://github.com/emscripten-core/emsdk/archive/refs/heads/main.zip > /emsdk.zip && \ unzip /emsdk.zip && \ rm /emsdk.zip && \ mv /emsdk-main /emsdk && \ cd /emsdk && \ ./emsdk install ${EMSCRIPTEN_VERSION} && \ ./emsdk activate ${EMSCRIPTEN_VERSION} ENV EMSDK=/emsdk \ PATH="/emsdk:/emsdk/upstream/emscripten:/emsdk/node/18.20.3_64bit/bin:${PATH}" # # Install Qt for Wasm from qt.io # COPY scripts/install-qt.sh install-qt.sh RUN ./install-qt.sh --version ${QT_VERSION} qtbase qtdeclarative qttools qtx11extras qtscxml qt5compat icu && \ echo "export PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:\${PATH}" > /etc/profile.d/qt.sh RUN ./install-qt.sh --version ${QT_VERSION} --target wasm --toolchain wasm_multithread qtbase qtdeclarative qttools qtx11extras qtscxml qt5compat icu && \ echo "export PATH=/opt/Qt/${QT_VERSION}/wasm_multithread/bin:\${PATH}" > /etc/profile.d/qt.sh # Work-around for QTBUG-79020 RUN echo "export QT_NO_GLIB=1" >> /etc/profile.d/qt.sh qbs-src-3.2.0/docker/noble/Dockerfile0000644000175100017510000000774015154533055017052 0ustar runnerrunner# # Install Qt and Qbs for Linux # FROM ubuntu:noble LABEL Description="Ubuntu development environment for Qbs with Qt and various dependencies for testing Qbs modules and functionality" ARG QT_VERSION ARG QBS_VERSION # Allow colored output on command line. ENV TERM=xterm-color # # Make it possible to change UID/GID in the entrypoint script. The docker # container usually runs as root user on Linux hosts. When the Docker container # mounts a folder on the host and creates files there, those files would be # owned by root instead of the current user. Thus we create a user here who's # UID will be changed in the entrypoint script to match the UID of the current # host user. # ARG USER_UID=1000 ARG USER_NAME=devel RUN apt-get update -qq && \ apt-get install -qq -y \ ca-certificates \ gosu \ sudo && \ userdel ubuntu && \ groupadd -g ${USER_UID} ${USER_NAME} && \ useradd -s /bin/bash -u ${USER_UID} -g ${USER_NAME} -o -c "" -m ${USER_NAME} && \ usermod -a -G sudo ${USER_NAME} && \ echo "%devel ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers COPY docker/entrypoint.sh /sbin/entrypoint.sh ENTRYPOINT ["/sbin/entrypoint.sh"] # Qbs build dependencies RUN apt-get update -qq && \ DEBIAN_FRONTEND="noninteractive" apt-get install -qq -y --no-install-recommends \ bison \ build-essential \ ca-certificates \ capnproto \ ccache \ clang-18 \ clang-tidy-18 \ cmake \ curl \ flex \ git \ gdb \ help2man \ icoutils \ libcapnp-dev \ libc++-18-dev \ libclang-rt-18-dev \ libdbus-1-3 \ libfreetype6 \ libfontconfig1 \ libgl1-mesa-dev \ libnanopb-dev \ libprotobuf-dev \ libgrpc++-dev \ libxkbcommon-x11-0 \ locales \ nanopb \ ninja-build \ nsis \ pkg-config \ protobuf-compiler \ protobuf-compiler-grpc \ psmisc \ python3-pip \ python3-setuptools \ python3-venv \ p7zip-full \ subversion \ unzip \ zip && \ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 && \ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100 && \ update-alternatives --install /usr/bin/clang-check clang-check /usr/bin/clang-check-18 100 && \ update-alternatives --install /usr/bin/python python /usr/bin/python3 100 ENV LLVM_INSTALL_DIR=/usr/lib/llvm-18 # Set up Python RUN python3 -m venv /venv && \ /venv/bin/pip3 install beautifulsoup4 lxml protobuf==3.19.1 pyyaml conan mercurial ENV PATH=/venv/bin:${PATH} # Set the locale RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ locale-gen ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 # # Install Qt and Qbs for Linux from qt.io # COPY scripts/install-qt.sh install-qt.sh COPY scripts/install-qbs.sh install-qbs.sh RUN ./install-qt.sh --version ${QT_VERSION} qtbase qtdeclarative qttools qtx11extras qtscxml qtshadertools qt5compat icu && \ ./install-qbs.sh --version ${QBS_VERSION} && \ echo "export PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:/opt/qbs/qbs-linux-x86_64-${QBS_VERSION}/bin:\${PATH}" > /etc/profile.d/qt.sh ENV PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:/opt/qbs/qbs-linux-x86_64-${QBS_VERSION}/bin:${PATH} # Configure Qbs USER $USER_NAME RUN qbs-setup-toolchains /usr/bin/g++ gcc && \ qbs-setup-toolchains /usr/bin/clang clang && \ qbs-setup-qt /opt/Qt/${QT_VERSION}/gcc_64/bin/qmake qt-gcc_64 && \ qbs config profiles.qt-gcc_64.baseProfile gcc && \ qbs-setup-qt /opt/Qt/${QT_VERSION}/gcc_64/bin/qmake qt-clang_64 && \ qbs config profiles.qt-clang_64.baseProfile clang && \ qbs config defaultProfile qt-gcc_64 # Configure Conan RUN conan profile detect --name qbs-test # Switch back to root user for the entrypoint script. USER root # Work-around for QTBUG-79020 RUN echo "export QT_NO_GLIB=1" >> /etc/profile.d/qt.sh qbs-src-3.2.0/docker/noble/test-android-no-qt.Dockerfile0000644000175100017510000001040715154533055022474 0ustar runnerrunner# # Android SDK/NDK for testing Qbs # FROM ubuntu:noble LABEL Description="Ubuntu test environment for Qbs for Android" # Allow colored output on command line. ENV TERM=xterm-color # # Make it possible to change UID/GID in the entrypoint script. The docker # container usually runs as root user on Linux hosts. When the Docker container # mounts a folder on the host and creates files there, those files would be # owned by root instead of the current user. Thus we create a user here who's # UID will be changed in the entrypoint script to match the UID of the current # host user. # ARG USER_UID=1000 ARG USER_NAME=devel RUN apt-get update -qq && \ apt-get install -qq -y \ ca-certificates \ gosu \ sudo && \ userdel ubuntu && \ groupadd -g ${USER_UID} ${USER_NAME} && \ useradd -s /bin/bash -u ${USER_UID} -g ${USER_NAME} -o -c "" -m ${USER_NAME} && \ usermod -a -G sudo ${USER_NAME} && \ echo "%devel ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers COPY docker/entrypoint.sh /sbin/entrypoint.sh ENTRYPOINT ["/sbin/entrypoint.sh"] # Qbs build dependencies RUN apt-get update -qq && \ apt-get install -qq -y --no-install-recommends \ ca-certificates \ curl \ gdb \ libasan5 \ libglib2.0-0 \ openjdk-8-jdk-headless \ p7zip-full \ unzip ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 RUN echo "export JAVA_HOME=${JAVA_HOME}" > /etc/profile.d/android.sh && \ echo "export PATH=${JAVA_HOME}/bin:\${PATH}" >> /etc/profile.d/android.sh ARG ANDROID_NDK_VERSION ENV ANDROID_HOME="/home/${USER_NAME}/android" ENV ANDROID_SDK_ROOT=${ANDROID_HOME} ENV ANDROID_NDK_ROOT=${ANDROID_HOME}/"ndk"/${ANDROID_NDK_VERSION} ENV PATH="${JAVA_HOME}:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/cmdline-tools/bin:$PATH" RUN echo "export ANDROID_HOME=/home/${USER_NAME}/android" >> /etc/profile.d/android.sh && \ echo "export ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" >> /etc/profile.d/android.sh && \ echo "export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT}" >> /etc/profile.d/android.sh && \ echo "export PATH=${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/cmdline-tools/bin:\$PATH" >> /etc/profile.d/android.sh # # We ned to run the following steps as the target user # USER ${USER_NAME} RUN mkdir ${ANDROID_HOME} # Get Android command line tools ARG COMMAND_LINE_TOOLS_VERSION="6858069" RUN curl -s https://dl.google.com/android/repository/commandlinetools-linux-${COMMAND_LINE_TOOLS_VERSION}_latest.zip > ${ANDROID_HOME}/commandlinetools.zip && \ unzip ${ANDROID_HOME}/commandlinetools.zip -d ${ANDROID_HOME} && \ rm -v ${ANDROID_HOME}/commandlinetools.zip # Accept SDK license ARG ANDROID_PLATFORM="android-29" ARG BUILD_TOOLS="29.0.2" RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" --verbose --licenses && \ sdkmanager "--sdk_root=${ANDROID_HOME}" --update && \ sdkmanager "--sdk_root=${ANDROID_HOME}" "platforms;${ANDROID_PLATFORM}" RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "build-tools;${BUILD_TOOLS}" RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "platform-tools" RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "tools" RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "ndk;${ANDROID_NDK_VERSION}" RUN /usr/lib/jvm/java-8-openjdk-amd64/bin/keytool -genkey -keystore /home/${USER_NAME}/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname 'CN=Android Debug,O=Android,C=US' # Install ndk samples in ${ANDROID_NDK_ROOT}/samples RUN cd ${ANDROID_NDK_ROOT} && \ curl -sLO https://github.com/android/ndk-samples/archive/master.zip && \ unzip -q master.zip && \ rm -v master.zip && \ mv ndk-samples-master samples # Install android-BasicMediaDecoder in ${ANDROID_SDK_ROOT}/samples RUN mkdir ${ANDROID_SDK_ROOT}/samples && \ cd ${ANDROID_SDK_ROOT}/samples && \ curl -sLO https://github.com/googlearchive/android-BasicMediaDecoder/archive/master.zip && \ unzip -q master.zip && \ rm -v master.zip && \ mv android-BasicMediaDecoder-master android-BasicMediaDecoder # Download buildtool to generate aab packages in ${ANDROID_SDK_ROOT} RUN cd ${ANDROID_SDK_ROOT} && \ curl -sLO https://github.com/google/bundletool/releases/download/1.3.0/bundletool-all-1.3.0.jar USER root qbs-src-3.2.0/docker/docker.qbs0000644000175100017510000000042115154533055015724 0ustar runnerrunner // This is a convenience product to be able to use Qt Creator for editing the docker files. // For building and managing the images, use docker-compose as explained in // https://doc.qt.io/qbs/building-qbs.html#using-docker. Product { name: "docker" files: "**" } qbs-src-3.2.0/docker/windowsservercore/0000755000175100017510000000000015154533055017543 5ustar runnerrunnerqbs-src-3.2.0/docker/windowsservercore/Dockerfile0000644000175100017510000000431215154533055021535 0ustar runnerrunner FROM mcr.microsoft.com/windows/servercore:ltsc2022 LABEL Description="Windows Server Core 2022 development environment for Qbs with Qt, Chocolatey and various dependencies for testing Qbs modules and functionality" # Disable crash dialog for release-mode runtimes RUN reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v Disabled /t REG_DWORD /d 1 /f RUN reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v DontShowUI /t REG_DWORD /d 1 /f # Install VS 2019 from the website since chocolatey has broken .NET 4.8 (dotnetfx package) which is a # dependency for the visualstudio2019buildtools package RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \ Invoke-WebRequest "https://aka.ms/vs/17/release/vs_community.exe" \ -OutFile "%TEMP%\vs_community.exe" -UseBasicParsing RUN "%TEMP%\vs_community.exe" --quiet --wait --norestart --noUpdateInstaller \ --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \ --add Microsoft.VisualStudio.Component.Windows10SDK.19041 RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \ $Env:chocolateyVersion = '0.10.15' ; \ $Env:chocolateyUseWindowsCompression = 'false' ; \ "[Net.ServicePointManager]::SecurityProtocol = \"tls12, tls11, tls\"; iex ((New-Object System.Net.WebClient).DownloadString('http://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" RUN choco install -y python --version 3.13.6 && \ choco install -y 7zip --version 25.1.0 && \ choco install -y git --version 2.50.1 --params "/GitAndUnixToolsOnPath" && \ choco install -y vswhere RUN python.exe -m pip install --upgrade pip # for building the documentation RUN python.exe -m pip install beautifulsoup4 lxml ########### Install Qt ############# ARG QT_VERSION COPY scripts/install-qt.sh install-qt.sh RUN bash -c "./install-qt.sh -d /c/Qt --version ${QT_VERSION} --toolchain win64_msvc2022_64 qtbase qtdeclarative qttools qt5compat" ENV QTDIR64=C:\\Qt\\${QT_VERSION}\\msvc2022_64 ########### Install Qbs ############# ARG QBS_VERSION RUN choco install -y qbs --version %QBS_VERSION% RUN qbs setup-toolchains --detect && \ qbs setup-qt %QTDIR64%/bin/qmake.exe qt64 && \ qbs config defaultProfile qt64 qbs-src-3.2.0/.clang-tidy0000644000175100017510000000423515154533055014542 0ustar runnerrunner--- Checks: > -*, bugprone-*, -bugprone-easily-swappable-parameters, -bugprone-narrowing-conversions, -bugprone-throw-keyword-missing, -bugprone-unchecked-optional-access, cppcoreguidelines-interfaces-global-init, cppcoreguidelines-pro-type-member-init, cppcoreguidelines-slicing, fuchsia-virtual-inheritance, google-build-explicit-make-pair, google-build-namespaces, google-global-names-in-headers, google-objc-*, google-readability-namespace-comments, google-runtime-operator, misc-definitions-in-headers, misc-misplaced-const, misc-new-delete-overloads, misc-non-copyable-objects, misc-redundant-expression, misc-static-assert, misc-uniqueptr-reset-release, misc-unused-*, modernize-avoid-bind, modernize-deprecated-headers, modernize-loop-convert, modernize-make-*, modernize-pass-by-value, modernize-redundant-void-arg, modernize-replace-*, modernize-return-braced-init-list, modernize-shrink-to-fit, modernize-unary-static-assert, modernize-use-auto, modernize-use-bool-literals, modernize-use-emplace, modernize-use-equals-*, modernize-use-noexcept, modernize-use-nullptr, modernize-use-override, modernize-use-transparent-functors, modernize-use-using, performance-*, -performance-no-int-to-ptr, readability-avoid-const-params-in-decls, readability-container-size-empty, readability-delete-null-pointer, readability-deleted-default, readability-identifier-naming, readability-misleading-indentation, readability-misplaced-array-index, readability-non-const-parameter, readability-redundant-*, -readability-redundant-member-init, readability-simplify-boolean-expr, readability-static-definition-in-anonymous-namespace, readability-uniqueptr-delete-release WarningsAsErrors: > bugprone-*, cppcoreguidelines-*, google-*, misc-unused-*, modernize-*, performance-*, readability-*, -readability-container-size-empty HeaderFilterRegex: '' AnalyzeTemporaryDtors: false CheckOptions: modernize-loop-convert.UseCxx20ReverseRanges: false qbs-src-3.2.0/share/0000755000175100017510000000000015154533055013604 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/0000755000175100017510000000000015154533055014371 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/imports/0000755000175100017510000000000015154533055016066 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/imports/qbs/0000755000175100017510000000000015154533055016653 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/imports/qbs/WindowsUtils/0000755000175100017510000000000015154533055021326 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/imports/qbs/WindowsUtils/windows-utils.js0000644000175100017510000000662415154533055024524 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ function winapiFamilyDefine(name) { return { "desktop": "DESKTOP_APP", "phone": "PHONE_APP", "pc": "PC_APP", "server": "SERVER", "system": "SYSTEM" }[name]; } function winapiPartitionDefine(name) { return { "app": "APP", "desktop": "DESKTOP", "phone": "PHONE_APP", "pc": "PC_APP", "server": "SERVER", "system": "SYSTEM" }[name]; } function characterSetDefines(charset) { var defines = []; if (charset === "unicode") defines.push("UNICODE", "_UNICODE"); else if (charset === "mbcs") defines.push("_MBCS"); return defines; } function canonicalizeVersion(version) { switch (version) { case "7": return "6.1"; case "8": return "6.2"; case "8.1": return "6.3"; default: return version; } } function knownWindowsVersions() { // Add new Windows versions to this list when they are released return ['10.0', '6.3', '6.2', '6.1', '6.0', '5.2', '5.1', '5.0', '4.0']; } function isValidWindowsVersion(systemVersion) { var realVersions = knownWindowsVersions(); for (i in realVersions) if (systemVersion === realVersions[i]) return true; return false; } function getWindowsVersionInFormat(systemVersion, format) { if (!systemVersion) return undefined; var major = parseInt(systemVersion.split('.')[0], 10); var minor = parseInt(systemVersion.split('.')[1], 10); switch (format) { case "hex": // https://msdn.microsoft.com/en-us/library/6sehtctf.aspx return "0x" + ("0000" + ((major << 8) | minor).toString(16)).slice(-4); case "subsystem": // https://msdn.microsoft.com/en-us/library/fcc1zstk.aspx return major + '.' + (minor < 10 ? '0' : '') + minor; default: throw ("Unrecognized Windows version format " + format + ". Must be in {hex, subsystem}."); } } qbs-src-3.2.0/share/qbs/imports/qbs/ModUtils/0000755000175100017510000000000015154533055020413 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/imports/qbs/ModUtils/utils.js0000644000175100017510000006272115154533055022121 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Environment = require("qbs.Environment"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var Process = require("qbs.Process"); var TemporaryDir = require("qbs.TemporaryDir"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); function mergeCFiles(inputs, outputFilePath) { var f = new TextFile(outputFilePath, TextFile.WriteOnly); try { for (var i = 0; i < inputs.length; ++i) f.writeLine('#include ' + Utilities.cStringQuote(inputs[i].filePath)); } finally { f.close(); } } function sanitizedList(list, product, fullPropertyName) { if (!(list instanceof Array)) return list; var filterFunc = function(elem) { if (typeof elem === "string" && elem.length === 0) { var msg = "Removing empty string from value of property '" + fullPropertyName + "'"; // product might actually be a module if (product.name) msg += " in product '" + product.name + "'."; console.warn(msg); return false; } return true; } return list.filter(filterFunc); } function checkCompatibilityMode(project, minimumQbsVersion, message) { if (Utilities.versionCompare(project.minimumQbsVersion || "1.3", minimumQbsVersion) < 0) { console.warn([message || "", "This message can be silenced by setting your Project's " + "minimumQbsVersion to " + minimumQbsVersion + " (and the new behavior will take effect)."].join(" ")); return true; } return false; } function artifactInstalledFilePath(artifact) { var relativeInstallDir = artifact.moduleProperty("qbs", "installDir"); var installPrefix = artifact.moduleProperty("qbs", "installPrefix"); var installSourceBase = artifact.moduleProperty("qbs", "installSourceBase"); var targetDir = FileInfo.joinPaths(artifact.moduleProperty("qbs", "installRoot"), installPrefix, relativeInstallDir); if (installSourceBase) { if (!FileInfo.isAbsolutePath(installSourceBase)) throw "installSourceBase is not an absolute path"; if (!artifact.filePath.startsWith(installSourceBase)) throw "artifact file path doesn't start with the value of qbs.installSourceBase"; return FileInfo.joinPaths(targetDir, artifact.filePath.substr(installSourceBase.length)); } return FileInfo.joinPaths(targetDir, artifact.fileName); } /** * Given a list of file tags, returns the file tag (one of [c, cpp, objc, objcpp]) * corresponding to the C-family language the file should be compiled as. * * If no such tag is found, undefined is returned. If more than one match is * found, an exception is thrown. */ function fileTagForTargetLanguage(fileTags) { var srcTags = ["c", "cpp", "objc", "objcpp", "asm", "asm_cpp", "cppm"]; var pchTags = ["c_pch", "cpp_pch", "objc_pch", "objcpp_pch"]; var canonicalTag = undefined; var foundTagCount = 0; for (var i = 0; i < fileTags.length; ++i) { var idx = srcTags.indexOf(fileTags[i]); if (idx === -1) idx = pchTags.indexOf(fileTags[i]); if (idx !== -1) { canonicalTag = srcTags[idx]; if (++foundTagCount > 1) break; } } if (foundTagCount > 1) throw ("source files cannot be identified as more than one language"); return foundTagCount == 1 ? canonicalTag : undefined; } /** * Returns the name of a language-specific property given the file tag * for that property, and the base property name. * * If \a fileTag is undefined, the language-agnostic property name is returned. */ function languagePropertyName(propertyName, fileTag) { if (!fileTag) fileTag = "common"; var asm = { "flags": "assemblerFlags", "platformFlags": "platformAssemblerFlags" }; var map = { "c": { "flags": "cFlags", "platformFlags": "platformCFlags", "usePrecompiledHeader": "useCPrecompiledHeader" }, "cpp": { "flags": "cxxFlags", "platformFlags": "platformCxxFlags", "usePrecompiledHeader": "useCxxPrecompiledHeader" }, "objc": { "flags": "objcFlags", "platformFlags": "platformObjcFlags", "usePrecompiledHeader": "useObjcPrecompiledHeader" }, "objcpp": { "flags": "objcxxFlags", "platformFlags": "platformObjcxxFlags", "usePrecompiledHeader": "useObjcxxPrecompiledHeader" }, "common": { "flags": "commonCompilerFlags", "platformFlags": "platformCommonCompilerFlags" }, "asm": asm, "asm_cpp": asm }; var lang = map[fileTag]; if (!lang) return propertyName; return lang[propertyName] || propertyName; } function modulePropertiesFromArtifacts(product, artifacts, moduleName, propertyName, langFilter) { var result = product.moduleProperty( moduleName, languagePropertyName(propertyName, langFilter)) || []; for (var i in artifacts) { var artifactProp = artifacts[i].moduleProperty( moduleName, languagePropertyName(propertyName, langFilter)); if (artifactProp) result = result.concat(artifactProp); } return sanitizedList(result, product, moduleName + "." + propertyName); } function moduleProperty(product, propertyName, langFilter) { return sanitizedModuleProperty(product, product.moduleName, propertyName, langFilter); } function sanitizedModuleProperty(obj, moduleName, propertyName, langFilter) { return sanitizedList(obj.moduleProperty(moduleName, languagePropertyName(propertyName, langFilter)), obj, moduleName + "." + propertyName); } /** * Returns roughly the same value as moduleProperty for a product, but ensures that all of the * given input artifacts share the same value of said property, as a sort of sanity check. * * This allows us to verify that users do not, for example, try to set different values on input * artifacts for which the value is input specific (not product specific), but which must be the * same for all inputs. */ function modulePropertyFromArtifacts(product, artifacts, moduleName, propertyName, langFilter) { var values = [product.moduleProperty(moduleName, languagePropertyName(propertyName, langFilter))]; for (var i in artifacts) { var value = artifacts[i].moduleProperty(moduleName, languagePropertyName(propertyName, langFilter)); if (!values.contains(value)) { values.push(value); } } if (values.length !== 1) { throw "The value of " + [moduleName, propertyName].join(".") + " must be identical for the following input artifacts: " + artifacts.map(function (artifact) { return artifact.filePath; }); } return values[0]; } function concatAll() { var result = []; for (var i = 0; i < arguments.length; ++i) { var arg = arguments[i]; if (arg === undefined) continue; else if (arg instanceof Array) result = result.concat(arg); else result.push(arg); } return result; } function allFileTags(fileTaggers) { var tags = []; for (var ext in fileTaggers) tags = tags.uniqueConcat(fileTaggers[ext]); return tags; } /** * Flattens a dictionary (string keys to strings) * into a string list containing items like \c key=value1 */ function flattenDictionary(dict, separator) { separator = separator || "="; var list = []; for (var i in dict) { var value = i; if (dict[i] !== undefined) // allow differentiation between undefined and empty string value += separator + dict[i]; list.push(value); } return list; } function ModuleError(message) { var e = new Error(message); e.fileName = ""; return e; } var EnvironmentVariable = (function () { function EnvironmentVariable(name, separator, convertPathSeparators) { if (!name) throw "EnvironmentVariable c'tor needs a name as first argument."; this.name = name; this.value = Environment.getEnv(name) || ""; this.separator = separator || ""; this.convertPathSeparators = convertPathSeparators || false; } EnvironmentVariable.prototype.prepend = function (v) { if (this.value.length > 0 && this.value.charAt(0) !== this.separator) this.value = this.separator + this.value; if (this.convertPathSeparators) v = FileInfo.toWindowsSeparators(v); this.value = v + this.value; }; EnvironmentVariable.prototype.append = function (v) { if (this.value.length > 0) this.value += this.separator; if (this.convertPathSeparators) v = FileInfo.toWindowsSeparators(v); this.value += v; }; EnvironmentVariable.prototype.set = function () { Environment.putEnv(this.name, this.value); }; EnvironmentVariable.prototype.unset = function () { Environment.unsetEnv(this.name); }; return EnvironmentVariable; })(); var PropertyValidator = (function () { function PropertyValidator(moduleName) { this.requiredProperties = {}; this.propertyValidators = []; if (!moduleName) throw "PropertyValidator c'tor needs a module name as a first argument."; this.moduleName = moduleName; } PropertyValidator.prototype.setRequiredProperty = function (propertyName, propertyValue, message) { this.requiredProperties[propertyName] = { propertyValue: propertyValue, message: message }; }; PropertyValidator.prototype.addRangeValidator = function (propertyName, propertyValue, min, max, allowFloats) { var message = []; if (min !== undefined) message.push(">= " + min); if (max !== undefined) message.push("<= " + max); this.addCustomValidator(propertyName, propertyValue, function (value) { if (typeof value !== "number") return false; if (!allowFloats && value % 1 !== 0) return false; if (min !== undefined && value < min) return false; if (max !== undefined && value > max) return false; return true; }, "must be " + (!allowFloats ? "an integer " : "") + message.join(" and ") + ", actual value: " + propertyValue); }; PropertyValidator.prototype.addVersionValidator = function (propertyName, propertyValue, minComponents, maxComponents, allowSuffixes) { if (minComponents !== undefined && (typeof minComponents !== "number" || minComponents % 1 !== 0 || minComponents < 1)) throw "minComponents must be at least 1"; if (maxComponents !== undefined && (typeof maxComponents !== "number" || maxComponents % 1 !== 0 || maxComponents < minComponents)) throw "maxComponents must be >= minComponents"; this.addCustomValidator(propertyName, propertyValue, function (value) { if (typeof value !== "string") return false; return value && value.match("^[0-9]+(\\.[0-9]+){" + ((minComponents - 1) || 0) + "," + ((maxComponents - 1) || "") + "}" + (!allowSuffixes ? "$" : "")) !== null; }, "must be a version number with " + (minComponents === maxComponents ? minComponents : (minComponents + " to " + maxComponents)) + (minComponents === maxComponents && minComponents === 1 ? " component" : " components") + ", actual value: " + propertyValue); }; PropertyValidator.prototype.addFileNameValidator = function (propertyName, propertyValue) { this.addCustomValidator(propertyName, propertyValue, function (value) { return !/[/?<>\\:*|"\u0000-\u001f\u0080-\u009f]/.test(propertyValue) && propertyValue !== "." && propertyValue !== ".."; }, "cannot contain reserved or control characters and cannot be \".\" or \"..\""); }; PropertyValidator.prototype.addCustomValidator = function (propertyName, propertyValue, validator, message) { this.propertyValidators.push({ propertyName: propertyName, propertyValue: propertyValue, validator: validator, message: message }); }; PropertyValidator.prototype.validate = function (throwOnError) { var i; var lines; // Find any missing properties var missingProperties = {}; for (i in this.requiredProperties) { var propValue = this.requiredProperties[i].propertyValue; if (propValue === undefined || propValue === null || propValue === "") { missingProperties[i] = this.requiredProperties[i]; } } // Find any properties that don't satisfy their validator function var invalidProperties = {}; for (var j = 0; j < this.propertyValidators.length; ++j) { var v = this.propertyValidators[j]; if (!v.validator(v.propertyValue)) { var messages = invalidProperties[v.propertyName] || []; messages.push(v.message); invalidProperties[v.propertyName] = messages; } } var errorMessage = ""; if (Object.keys(missingProperties).length > 0) { errorMessage += "The following properties are not set. Set them in your profile or product:\n"; lines = []; for (i in missingProperties) { var obj = missingProperties[i]; lines.push(this.moduleName + "." + i + ((obj && obj.message) ? (": " + obj.message) : "")); } errorMessage += lines.join("\n"); } if (Object.keys(invalidProperties).length > 0) { if (errorMessage) errorMessage += "\n"; errorMessage += "The following properties have invalid values:\n"; lines = []; for (i in invalidProperties) { for (j = 0; j < invalidProperties[i].length; ++j) { lines.push(this.moduleName + "." + i + ": " + invalidProperties[i][j]); } } errorMessage += lines.join("\n"); } if (throwOnError !== false && errorMessage.length > 0) throw errorMessage; return errorMessage.length == 0; }; return PropertyValidator; })(); var BlackboxOutputArtifactTracker = (function () { function BlackboxOutputArtifactTracker() { } BlackboxOutputArtifactTracker.prototype.artifacts = function (outputDirectory) { var process; var fakeOutputDirectory; try { fakeOutputDirectory = new TemporaryDir(); if (!fakeOutputDirectory.isValid()) throw "could not create temporary directory"; process = new Process(); if (this.commandEnvironmentFunction) { var env = this.commandEnvironmentFunction(fakeOutputDirectory.path()); for (var key in env) process.setEnv(key, env[key]); } process.exec(this.command, this.commandArgsFunction(fakeOutputDirectory.path()), true); var artifacts = []; if (this.fileTaggers) { var files = this.findFiles(fakeOutputDirectory.path()); for (var i = 0; i < files.length; ++i) artifacts.push(this.createArtifact(fakeOutputDirectory.path(), files[i])); } if (this.processStdOutFunction) artifacts = artifacts.concat(this.processStdOutFunction(process.readStdOut())); artifacts = this.fixArtifactPaths(artifacts, outputDirectory, fakeOutputDirectory.path()); return artifacts; } finally { if (process) process.close(); if (fakeOutputDirectory) fakeOutputDirectory.remove(); } }; BlackboxOutputArtifactTracker.prototype.createArtifact = function (root, filePath) { for (var ext in this.fileTaggers) { if (filePath.endsWith(ext)) { return { filePath: filePath, fileTags: this.fileTaggers[ext] }; } } if (!this.defaultFileTags) { var relFilePath = (filePath.startsWith(root + '/') || filePath.startsWith(root + '\\')) ? filePath.substring(root.length + 1) : filePath; throw "BlackboxOutputArtifactTracker: no matching file taggers for path '" + relFilePath + "'. Set defaultFileTags to an array of file tags to " + "apply to files not tagged by the fileTaggers map, which was:\n" + JSON.stringify(this.fileTaggers, undefined, 4); } return { filePath: filePath, fileTags: this.defaultFileTags }; }; BlackboxOutputArtifactTracker.prototype.findFiles = function (dir) { var fileList = File.directoryEntries(dir, File.Files).map(function (p) { return FileInfo.joinPaths(dir, p); }); var dirList = File.directoryEntries(dir, File.Dirs | File.NoDotAndDotDot).map(function (p) { return FileInfo.joinPaths(dir, p); }); for (var i = 0; i < dirList.length; ++i) fileList = fileList.concat(this.findFiles(dirList[i])); return fileList; }; BlackboxOutputArtifactTracker.prototype.fixArtifactPaths = function (artifacts, realBasePath, fakeBasePath) { for (var i = 0; i < artifacts.length; ++i) { artifacts[i].filePath = FileInfo.joinPaths( realBasePath, FileInfo.relativePath(fakeBasePath, artifacts[i].filePath)) } return artifacts; }; return BlackboxOutputArtifactTracker; })(); function hasAnyOf(m, tokens) { for (var i = 0; i < tokens.length; ++i) { if (m[tokens[i]] !== undefined) return true; } } function guessArchitecture(m) { var architecture; if (m) { // based on the search algorithm from qprocessordetection.h in qtbase var arm64Defs = ["_M_ARM64", "__aarch64__", "__ARM64__", "__ARM_ARCH_ISA_A64"]; if (hasAnyOf(m, ["__arm__", "__TARGET_ARCH_ARM", "_M_ARM"].concat(arm64Defs))) { if (hasAnyOf(m, arm64Defs)) { architecture = "arm64"; } else { architecture = "arm"; var foundSubarch = false; for (var i = 8; i >= 4; --i) { var codes = ["zk", "tej", "te", "t2"].concat([].concat.apply([], new Array(26)).map(function(_, i) { return String.fromCharCode(122 - i); })); for (var j = 0; j < codes.length; ++j) { if (m["__ARM_ARCH_" + i + codes[j].toUpperCase() + "__"] !== undefined) { architecture += "v" + i + codes[j].toLowerCase(); foundSubarch = true; break; } } if (i === 7 && (m["_ARM_ARCH_7"] !== undefined || m["_M_ARM"] === "7")) { architecture += "v7"; foundSubarch = true; } if (foundSubarch) break; } } } else if (hasAnyOf(m, ["__i386", "__i386__", "__386__"])) { architecture = "x86"; } else if (hasAnyOf(m, ["_M_IX86"])) { var code = parseInt(m["_M_IX86"]); architecture = (code < 300) ? "x86_16" : "x86"; } else if (hasAnyOf(m, ["_M_I86"])) { architecture = "x86_16"; } else if (hasAnyOf(m, ["__x86_64", "__x86_64__", "__amd64", "_M_X64", "_M_AMD64"])) { architecture = "x86_64"; if (hasAnyOf(m, ["__x86_64h", "__x86_64h__"])) architecture = "x86_64h"; } else if (hasAnyOf(m, ["__ia64", "__ia64__", "_M_IA64"])) { architecture = "ia64"; } else if (hasAnyOf(m, ["__mips", "__mips__", "_M_MRX000"])) { architecture = "mips"; if (hasAnyOf(m, ["_MIPS_ARCH_MIPS64", "__mips64"])) architecture += "64"; } else if (hasAnyOf(m, ["__ppc__", "__ppc", "__powerpc__", "_ARCH_COM", "_ARCH_PWR", "_ARCH_PPC", "_M_MPPC", "_M_PPC"])) { architecture = "ppc"; if (hasAnyOf(m, ["__ppc64__", "__powerpc64__", "__64BIT__"])) architecture += "64"; } else if (hasAnyOf(m, ["__s390__"])) { if (hasAnyOf(m, ["__s390x__"])) architecture = "s390x"; } else if (hasAnyOf(m, ["__sparc__"])) { architecture = "sparc"; if (hasAnyOf(m, ["__sparc64__"])) architecture += "64"; } else if (hasAnyOf(m, ["__AVR__"])) { architecture = "avr"; } else if (hasAnyOf(m, ["__AVR32__"])) { architecture = "avr32"; } else if (hasAnyOf(m, ["__MSP430__"])) { architecture = "msp430"; } else if (hasAnyOf(m, ["__RL78__"])) { architecture = "rl78"; } else if (hasAnyOf(m, ["__RX__"])) { architecture = "rx"; } else if (hasAnyOf(m, ["__v850__"])) { architecture = "v850"; } else if (hasAnyOf(m, ["__riscv"])) { architecture = "riscv"; } else if (hasAnyOf(m, ["__xtensa__", "__XTENSA__"])) { architecture = "xtensa"; } else if (hasAnyOf(m, ["__m68k__"])) { architecture = "m68k"; } else if (hasAnyOf(m, ["__m32c__"])) { architecture = "m32c"; } else if (hasAnyOf(m, ["__m32r__", "__M32R__"])) { architecture = "m32r"; } else if (hasAnyOf(m, ["__sh__", "__SH__"])) { architecture = "sh"; } else if (hasAnyOf(m, ["__CR16__"])) { architecture = "cr16"; } else if (hasAnyOf(m, ["__mc68hc1x__", "__mc68hc1x"])) { architecture = "hcs12"; } else if (hasAnyOf(m, ["__e2k__"])) { architecture = "e2k"; } else if (hasAnyOf(m, ["__hppa__"])) { architecture = "hppa"; } else if (hasAnyOf(m, ["__alpha__"])) { architecture = "alpha"; } } return Utilities.canonicalArchitecture(architecture); } function guessTargetPlatform(m) { if (m) { if (hasAnyOf(m, ["__ANDROID__", "ANDROID"])) return "android"; if (hasAnyOf(m, ["__QNXNTO__"])) return "qnx"; if (hasAnyOf(m, ["__INTEGRITY"])) return "integrity"; if (hasAnyOf(m, ["__vxworks"])) return "vxworks"; if (hasAnyOf(m, ["__APPLE__"])) return "darwin"; if (hasAnyOf(m, ["WIN32", "_WIN32", "__WIN32__", "__NT__", "__WINDOWS__", "_WINDOWS"])) return "windows"; if (hasAnyOf(m, ["MSDOS", "__DOS__", "DOS386"])) return "dos"; if (hasAnyOf(m, ["__OS2__"])) return "os2"; if (hasAnyOf(m, ["_AIX"])) return "aix"; if (hasAnyOf(m, ["hpux", "__hpux"])) return "hpux"; if (hasAnyOf(m, ["__sun", "sun"])) return "solaris"; if (hasAnyOf(m, ["__linux__", "__linux", "__LINUX__"])) return "linux"; if (hasAnyOf(m, ["__FreeBSD__", "__DragonFly__", "__FreeBSD_kernel__"])) return "freebsd"; if (hasAnyOf(m, ["__NetBSD__"])) return "netbsd"; if (hasAnyOf(m, ["__OpenBSD__"])) return "openbsd"; if (hasAnyOf(m, ["__GNU__"])) return "hurd"; if (hasAnyOf(m, ["__HAIKU__"])) return "haiku"; if (hasAnyOf(m, ["__wasm__"])) return "wasm-emscripten" } } function toJSLiteral(v) { if (v === undefined) return "undefined"; return JSON.stringify(v); } qbs-src-3.2.0/share/qbs/imports/qbs/UnixUtils/0000755000175100017510000000000015154533055020617 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/imports/qbs/UnixUtils/unix-utils.js0000644000175100017510000000533015154533055023277 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); function soname(product, outputFileName) { var soVersion = product.moduleProperty("cpp", "soVersion"); if (product.moduleProperty("qbs", "targetOS").contains("darwin")) { // If this is a bundle, ignore the parameter and use the relative path to the bundle binary // For example: qbs.framework/Versions/1/qbs if (product.moduleProperty("bundle", "isBundle")) outputFileName = product.moduleProperty("bundle", "executablePath"); } else if (soVersion) { // For non-Darwin platforms, append the shared library major version number to the soname // For example: libqbscore.so.1 var version = product.moduleProperty("cpp", "internalVersion"); if (version) { outputFileName = outputFileName.substr(0, outputFileName.length - version.length) + soVersion; } else { outputFileName += "." + soVersion; } } // Prepend the soname prefix // For example, @rpath/libqbscore.dylib or /usr/lib/libqbscore.so.1 var prefix = product.moduleProperty("cpp", "sonamePrefix"); if (prefix) outputFileName = FileInfo.joinPaths(prefix, outputFileName); return outputFileName; } qbs-src-3.2.0/share/qbs/imports/qbs/DarwinTools/0000755000175100017510000000000015154533055021120 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/imports/qbs/DarwinTools/darwin-tools.js0000644000175100017510000002355215154533055024107 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); var Utilities = require("qbs.Utilities"); var _deviceMap = { "mac": undefined, // only devices have an ID "iphone": 1, "ipad": 2, "tv": 3, "watch": 4, "car": 5 }; var _platformMap = { "ios": "iPhone", "macos": "MacOSX", "tvos": "AppleTV", "watchos": "Watch" }; var _platformDeviceMap = { "ios": ["iphone", "ipad"], "macos": ["mac"], "tvos": ["tv"], "watchos": ["watch"] } /** * Returns the numeric identifier corresponding to an Apple device name * (i.e. for use by TARGETED_DEVICE_FAMILY). */ function appleDeviceNumber(deviceName) { return _deviceMap[deviceName]; } /** * Returns the list of target devices available for the given qbs target OS list. */ function targetDevices(targetOS) { for (var key in _platformDeviceMap) { if (targetOS.contains(key)) return _platformDeviceMap[key]; } } /** * Returns the TARGETED_DEVICE_FAMILY string given a list of target device names. */ function targetedDeviceFamily(deviceNames) { return deviceNames.map(function (deviceName) { return appleDeviceNumber(deviceName); }); } /** * Returns the most appropriate Apple platform name given a targetOS list. */ function applePlatformName(targetOSList, platformType) { return applePlatformDirectoryName(targetOSList, platformType).toLowerCase(); } /** * Returns the most appropriate Apple platform directory name given a targetOS list and version. */ function applePlatformDirectoryName(targetOSList, platformType, version, throwOnError) { var suffixMap = { "device": "OS", "simulator": "Simulator" }; for (var key in _platformMap) { if (targetOSList.contains(key)) { // there are no MacOSXOS or MacOSXSimulator platforms var suffix = (key !== "macos") ? (suffixMap[platformType] || "") : ""; return _platformMap[key] + suffix + (version || ""); } } if (throwOnError || throwOnError === undefined) throw("No Apple platform corresponds to target OS list: " + targetOSList); } /** * Returns the localization of the resource at the given path, * or undefined if the path does not contain an {xx}.lproj path segment. */ function localizationKey(path) { return _resourceFileProperties(path)[0]; } /** * Returns the path of a localized resource at the given path, * relative to its containing {xx}.lproj directory, or '.' * if the resource is unlocalized (not contained in an lproj directory). */ function relativeResourcePath(path) { return _resourceFileProperties(path)[1]; } function _resourceFileProperties(path) { var lprojKey = ".lproj/"; var lproj = path.indexOf(lprojKey); if (lproj >= 0) { // The slash preceding XX.lproj var slashIndex = path.slice(0, lproj).lastIndexOf('/'); if (slashIndex >= 0) { var localizationKey = path.slice(slashIndex + 1, lproj); var relativeResourcePath = FileInfo.path(path.slice(lproj + lprojKey.length)); return [ localizationKey, relativeResourcePath ]; } } return [ undefined, '.' ]; } var PropertyListVariableExpander = (function () { function PropertyListVariableExpander() { } /** * Recursively perform variable replacements in an environment dictionary. */ 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) { var syntax; var idx = -1; for (var i in syntaxes) { var j; // normal case - we search for the last occurrence to do a correct replacement // for nested variables, e.g. ${VAR1_${VAR2}}. This doesn't work in case // when start == end, e.g. @VAR@ - in that case we search from the start if (syntaxes[i].open !== syntaxes[i].close) j = str.lastIndexOf(syntaxes[i].open); else j = str.indexOf(syntaxes[i].open); if (j > idx) { syntax = syntaxes[i]; idx = j; } } return { "syntax": syntax, "index": idx }; } function expandString(key, str, env, seenVars) { if (!str) return str; var repl = indexOfReplacementStart(syntaxes, str); var i = repl.index; while (i !== -1) { var j = str.indexOf(repl.syntax.close, i + repl.syntax.open.length); if (j === -1) return str; var varParts = str.slice(i + repl.syntax.open.length, j).split(':'); var varName = varParts[0]; var varFormatter = varParts[1]; var envValue = env[varName]; // if we end up expanding the same variable again, break the recursion if (seenVars.indexOf(varName) !== -1) envValue = ""; else seenVars.push(varName); var varValue = expandString(key, envValue, env, seenVars); seenVars.pop(); if (undefined === varValue) { // skip replacement if ($this.undefinedVariableFunction) $this.undefinedVariableFunction(key, varName); varValue = ""; } varValue = String(varValue); if (varFormatter !== undefined) { // TODO: XCode supports multiple formatters separated by a comma var varFormatterLower = varFormatter.toLowerCase(); if (varFormatterLower === "rfc1034identifier" || varFormatterLower === "identifier") varValue = Utilities.rfc1034Identifier(varValue); if (varValue === "" && varFormatterLower.startsWith("default=")) varValue = varFormatter.split("=")[1]; } str = str.slice(0, i) + varValue + str.slice(j + repl.syntax.close.length); repl = indexOfReplacementStart(syntaxes, str); i = repl.index; } return str; } 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; var expandedValue = expandString(key, value, env, []); if (expandedValue !== value) obj[key] = expandedValue; } } 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); } /** * Recursively removes any undefined, null, or empty string values from the property list. */ function cleanPropertyList(plist) { if (typeof(plist) !== "object") return; for (var key in plist) { if (plist[key] === undefined || plist[key] === null || plist[key] === "") delete plist[key]; else cleanPropertyList(plist[key]); } } qbs-src-3.2.0/share/qbs/imports/qbs/ProviderUtils/0000755000175100017510000000000015154533055021466 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/imports/qbs/ProviderUtils/provider-utils.js0000644000175100017510000001160015154533055025012 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2023 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Utilities = require("qbs.Utilities"); function pkgConfigToModuleName(packageName) { return packageName.replace(/\./g, '-'); } function isMsvcQt(qtProps) { return qtProps.mkspecName.contains("-msvc"); } function isMinGwQt(qtProps) { return qtProps.mkspecName.startsWith("win32-g++") || qtProps.mkspecName.startsWith("mingw"); } function isDesktopWindowsQt(qtProps) { return qtProps.mkspecName.startsWith("win32-") || isMinGwQt(qtProps); } function qtNeedsDSuffix(qtProps) { return !isMinGwQt(qtProps) || Utilities.versionCompare(qtProps.qtVersion, "5.14.0") < 0 || qtProps.configItems.contains("debug_and_release"); } function qtIsFramework(modInfo, qtProps) { if (modInfo.isFramework) return true; if (!qtProps.frameworkBuild || modInfo.isStaticLibrary) return false; var modulesNeverBuiltAsFrameworks = [ "bootstrap", "openglextensions", "platformsupport", "qmldevtools", "harfbuzzng" ]; if (qtProps.qtMajorVersion <= 5) { modulesNeverBuiltAsFrameworks.push("uitools"); // is framework since qt6 } return !modulesNeverBuiltAsFrameworks.contains(modInfo.qbsName); } function qtLibBaseName(modInfo, libName, debugBuild, qtProps) { var name = libName; if (qtProps.mkspecName.startsWith("win")) { if (debugBuild && qtNeedsDSuffix(qtProps)) name += 'd'; if (!modInfo.isStaticLibrary && qtProps.qtMajorVersion < 5) name += qtProps.qtMajorVersion; } if (qtProps.mkspecName.contains("macx") || qtProps.mkspecName.contains("ios") || qtProps.mkspecName.contains("darwin")) { if (!qtIsFramework(modInfo, qtProps) && qtProps.buildVariant.contains("debug") && (!qtProps.buildVariant.contains("release") || debugBuild)) { name += "_debug"; } } return name; } function qtModuleNameWithoutPrefix(modInfo) { if (modInfo.name === "Phonon") return "phonon"; if (!modInfo.modulePrefix && modInfo.name.startsWith("Qt")) return modInfo.name.slice(2); // Strip off "Qt". if (modInfo.name.startsWith(modInfo.modulePrefix)) return modInfo.name.slice(modInfo.modulePrefix.length); return modInfo.name; } function qtLibraryBaseName(modInfo, qtProps, debugBuild) { if (modInfo.isPlugin) return qtLibBaseName(modInfo, modInfo.name, debugBuild, qtProps); // Some modules use a different naming scheme, so it doesn't get boring. var libNameBroken = modInfo.name === "Enginio" || modInfo.name === "DataVisualization" || modInfo.name === "Phonon"; var libName = ""; if (!modInfo.isExternal) { libName += !modInfo.modulePrefix && !libNameBroken ? "Qt" : modInfo.modulePrefix; if (qtProps.qtMajorVersion >= 5 && !qtIsFramework(modInfo, qtProps) && !libNameBroken) libName += qtProps.qtMajorVersion; } libName += qtModuleNameWithoutPrefix(modInfo); if (!modInfo.isExternal) libName += qtProps.qtLibInfix; return qtLibBaseName(modInfo, libName, debugBuild, qtProps); } function qtLibNameForLinker(modInfo, qtProps, debugBuild) { if (!modInfo.hasLibrary) return undefined; var libName = qtLibraryBaseName(modInfo, qtProps, debugBuild); if (qtProps.mkspecName.contains("msvc")) libName += ".lib"; return libName; } qbs-src-3.2.0/share/qbs/imports/qbs/base/0000755000175100017510000000000015154533055017565 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/imports/qbs/base/InnoSetup.qbs0000644000175100017510000000326415154533055022225 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ Product { condition: qbs.targetOS.contains("windows") && innosetup.present Depends { name: "innosetup"; condition: qbs.targetOS.contains("windows"); required: false } type: ["innosetup.exe"] } qbs-src-3.2.0/share/qbs/imports/qbs/base/Application.qbs0000644000175100017510000000703715154533055022546 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ NativeBinary { type: isForAndroid && !consoleApplication ? ["android.package"] : ["application"] property bool usesNativeCode Depends { // Note: If we are multiplexing, then this dependency is technically only needed in // the aggregate. However, the user should not have to write the respective // condition when assigning to properties of this module, so we load it // regardless and turn off its rules for the native part of the build. name: "Android.sdk" condition: isForAndroid && !consoleApplication } Properties { condition: isForAndroid && !consoleApplication && !usesNativeCode multiplexByQbsProperties: [] aggregate: false } Properties { condition: isForAndroid && !consoleApplication && usesNativeCode && multiplexByQbsProperties && multiplexByQbsProperties.contains("architectures") && qbs.architectures && qbs.architectures.length > 1 aggregate: true multiplexedType: "android.nativelibrary" } Properties { condition: undefined multiplexByQbsProperties: base multiplexedType: base } aggregate: base Depends { name: "config.install" } install: config.install.install && !isForAndroid installDir: isBundle ? config.install.applicationsDirectory : config.install.binariesDirectory installDebugInformation: config.install.debugInformation && !isForAndroid debugInformationInstallDir: config.install.debugInformationDirectory || installDir Group { condition: install && _installable fileTagsFilter: isBundle ? "bundle.content" : "application" qbs.install: true qbs.installDir: installDir qbs.installSourceBase: isBundle ? destinationDirectory : outer } Group { condition: installDebugInformation && _installable fileTagsFilter: ["debuginfo_app"] qbs.install: true qbs.installDir: debugInformationInstallDir qbs.installSourceBase: destinationDirectory } } qbs-src-3.2.0/share/qbs/imports/qbs/base/AndroidApk.qbs0000644000175100017510000000317415154533055022315 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo Product { type: ["android.package"] qbs.targetPlatform: "android" Depends { name: "Android.sdk" } } qbs-src-3.2.0/share/qbs/imports/qbs/base/AutotestRunner.qbs0000644000175100017510000001101015154533055023267 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.ModUtils Product { name: "autotest-runner" type: ["autotest-result"] builtByDefault: false property stringList arguments: [] property stringList environment: ModUtils.flattenDictionary(qbs.commonRunEnvironment) property bool limitToSubProject: true property stringList wrapper: [] property string workingDir property stringList auxiliaryInputs property int timeout: -1 Depends { productTypes: "autotest" limitToSubProject: product.limitToSubProject } Depends { productTypes: auxiliaryInputs limitToSubProject: product.limitToSubProject } Rule { inputsFromDependencies: "application" auxiliaryInputsFromDependencies: product.auxiliaryInputs outputFileTags: "autotest-result" prepare: { // TODO: This is hacky. Possible solution: Add autotest tag to application // in autotest module and have that as inputsFromDependencies instead of application. if (!input.product.type.contains("autotest")) { var cmd = new JavaScriptCommand(); cmd.silent = true; return cmd; } var commandFilePath; var installed = input.moduleProperty("qbs", "install"); if (installed) commandFilePath = ModUtils.artifactInstalledFilePath(input); if (!commandFilePath || !File.exists(commandFilePath)) commandFilePath = input.filePath; var workingDir = product.workingDir ? product.workingDir : FileInfo.path(commandFilePath); var arguments = product.arguments; var allowFailure = false; var timeout = product.timeout; if (input.autotest) { // FIXME: We'd like to let the user override with an empty list, but // qbscore turns undefined lists into empty ones at the moment. if (input.autotest.arguments && input.autotest.arguments.length > 0) arguments = input.autotest.arguments; if (input.autotest.workingDir) workingDir = input.autotest.workingDir; allowFailure = input.autotest.allowFailure; if (input.autotest.timeout !== undefined) timeout = input.autotest.timeout; } var fullCommandLine = product.wrapper .concat([commandFilePath]) .concat(arguments); var cmd = new Command(fullCommandLine[0], fullCommandLine.slice(1)); cmd.description = "running test " + input.fileName; cmd.environment = product.environment; cmd.workingDirectory = workingDir; cmd.timeout = timeout; cmd.jobPool = "autotest-runner"; if (allowFailure) cmd.maxExitCode = 32767; return cmd; } } } qbs-src-3.2.0/share/qbs/imports/qbs/base/NetModule.qbs0000644000175100017510000000010415154533055022163 0ustar runnerrunnerProduct { Depends { name: "cli" } type: ["cli.netmodule"] } qbs-src-3.2.0/share/qbs/imports/qbs/base/CppApplication.qbs0000644000175100017510000000305515154533055023205 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ Application { Depends { name: "cpp" } usesNativeCode: true } qbs-src-3.2.0/share/qbs/imports/qbs/base/InstallPackage.qbs0000644000175100017510000000530615154533055023162 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.FileInfo import qbs.ModUtils import qbs.TextFile Product { type: ["archiver.archive"] builtByDefault: false Depends { name: "archiver" } archiver.type: "tar" archiver.workingDirectory: qbs.installRoot Rule { multiplex: true inputsFromDependencies: ["installable"] Artifact { filePath: product.name + ".tarlist" fileTags: ["archiver.input-list"] } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode =function() { var ofile = new TextFile(output.filePath, TextFile.WriteOnly); try { for (var i = 0; i < inputs["installable"].length; ++i) { var inp = inputs["installable"][i]; var installRoot = inp.moduleProperty("qbs", "installRoot"); var installedFilePath = ModUtils.artifactInstalledFilePath(inp); ofile.writeLine(FileInfo.relativePath(installRoot, installedFilePath)); } } finally { ofile.close(); } }; return [cmd]; } } } qbs-src-3.2.0/share/qbs/imports/qbs/base/CppLibrary.qbs0000644000175100017510000000175515154533055022353 0ustar runnerrunnerLibrary { property stringList publicHeaders property stringList privateHeaders property string headersDirectoryName: targetName property string publicHeadersDirectory: installpaths.headers + "/" + headersDirectoryName property string privateHeadersDirectory: installpaths.headers + "/" + headersDirectoryName + "/private" Depends { name: "cpp" } Depends { name: "installpaths" } Group { name: "Public Headers" files: publicHeaders fileTags: ["bundle.input.public_hpp", "hpp"] prefix: product.sourceDirectory + "/" qbs.install: install && !(isForDarwin && bundle.isBundle) qbs.installDir: publicHeadersDirectory } Group { name: "Private Headers" files: privateHeaders fileTags: ["bundle.input.private_hpp", "hpp"] prefix: product.sourceDirectory + "/" qbs.install: install && !(isForDarwin && bundle.isBundle) qbs.installDir: privateHeadersDirectory } } qbs-src-3.2.0/share/qbs/imports/qbs/base/QtPlugin.qbs0000644000175100017510000000324315154533055022041 0ustar runnerrunnerimport qbs.FileInfo import qbs.TextFile QtModule { isPlugin: true property string className property stringList extendsModules enableLinking: { if (!base) return false; if (!isStaticLibrary) return false; if (!Qt.plugin_support.linkPlugins) return false; if (!(Qt.plugin_support.enabledPlugins || []).contains(qtModuleName)) return false; if (!extendsModules || extendsModules.length === 0) return true; for (var i = 0; i < extendsModules.length; ++i) { var moduleName = extendsModules[i]; if (product.Qt[moduleName] && product.Qt[moduleName].present) return true; } return false; } Rule { condition: enableLinking multiplex: true Artifact { filePath: product.targetName + "_qt_plugin_import_" + product.moduleProperty(product.moduleName, "qtModuleName") + ".cpp" fileTags: ["cpp", "qt.untranslatable"] } prepare: { var cmd = new JavaScriptCommand(); var pluginName = product.moduleProperty(product.moduleName, "qtModuleName"); cmd.description = "creating static import for plugin '" + pluginName + "'"; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); var className = product.moduleProperty(product.moduleName, "className"); f.writeLine("#include \n\nQ_IMPORT_PLUGIN(" + className + ")"); f.close(); }; return cmd; } } } qbs-src-3.2.0/share/qbs/imports/qbs/base/JavaClassCollection.qbs0000644000175100017510000000305115154533055024156 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ Product { Depends { name: "java" } type: ["java.class"] } qbs-src-3.2.0/share/qbs/imports/qbs/base/WindowsSetupPackage.qbs0000644000175100017510000000312315154533055024222 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ Product { Depends { name: "wix"; condition: qbs.targetOS.contains("windows") } type: ["wixsetup"] } qbs-src-3.2.0/share/qbs/imports/qbs/base/NodeJSApplication.qbs0000644000175100017510000000302215154533055023577 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ Product { Depends { name: "nodejs" } } qbs-src-3.2.0/share/qbs/imports/qbs/base/NSISSetup.qbs0000644000175100017510000000312515154533055022072 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ Product { Depends { name: "nsis"; condition: qbs.targetOS.contains("windows") } type: ["nsissetup"] } qbs-src-3.2.0/share/qbs/imports/qbs/base/CppStd.qbs0000644000175100017510000000064515154533055021476 0ustar runnerrunnerStaticLibrary { name: "CppStd" property bool useStdCompat: false Depends { name: "cpp" } cpp.cxxLanguageVersion: "c++23" cpp.forceUseCxxModules: true cpp.forceUseImportStd: true cpp.forceUseImportStdCompat: useStdCompat Properties { condition: qbs.toolchainType === "clang" cpp.cxxFlags: ["-Wno-reserved-module-identifier"] cpp.cxxStandardLibrary: "libc++" } } qbs-src-3.2.0/share/qbs/imports/qbs/base/DynamicLibrary.qbs0000644000175100017510000000311115154533055023201 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ CppLibrary { type: ["dynamiclibrary"].concat(isForAndroid ? ["android.nativelibrary"] : []) } qbs-src-3.2.0/share/qbs/imports/qbs/base/StaticLibrary.qbs0000644000175100017510000000302215154533055023045 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ CppLibrary { type: ["staticlibrary"] } qbs-src-3.2.0/share/qbs/imports/qbs/base/WindowsInstallerPackage.qbs0000644000175100017510000000311615154533055025061 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ Product { Depends { name: "wix"; condition: qbs.targetOS.contains("windows") } type: ["msi"] } qbs-src-3.2.0/share/qbs/imports/qbs/base/ObjectLibrary.qbs0000644000175100017510000000314315154533055023030 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2025 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ CppLibrary { type: "objectlibrary" Group { fileTagsFilter: "obj" fileTags: "objectlibrary" } } qbs-src-3.2.0/share/qbs/imports/qbs/base/QtLupdateRunner.qbs0000644000175100017510000001435215154533055023376 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.TextFile import qbs.Utilities Product { condition: Utilities.versionCompare(Qt.core.version, "5.13") >= 0 name: "lupdate-runner" type: "lupdate-result" builtByDefault: false property bool limitToSubProject: true property stringList extraArguments Depends { name: "Qt.core" } Depends { productTypes: "qm"; minimal: true; limitToSubProject: product.limitToSubProject } Rule { multiplex: true auxiliaryInputsFromDependencies: ["cpp", "objcpp", "qt.qml.qml", "qt.qml.js", "ui"] excludedInputs: "qt.untranslatable" Artifact { filePath: "lupdate.json" fileTags: "lupdate_json" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating lupdate project file"; cmd.highlight = "filegen"; cmd.sourceCode = function() { /* * From the original commit message in qttools: * Project ::= { * string projectFile // Name of the project file. * string codec // Source code codec. Valid values are * // currently "utf-16" or "utf-8" (default). * string[] translations // List of .ts files of the project. * string[] includePaths // List of include paths. * string[] sources // List of source files. * string[] excluded // List of source files, which are * // excluded for translation. * Project[] subProjects // List of sub-projects. * } */ var mainProject = { projectFile: "main", sources: [], translations: [], subProjects: [] }; var cxxArtifactsByIncludePaths = {}; function handleProduct(product) { (product.artifacts["ts"] || []).forEach(function(artifact) { mainProject.translations.push(artifact.filePath); }); ["qt.qml.qml", "qt.qml.js", "ui"].forEach(function(tag) { (product.artifacts[tag] || []).forEach(function(artifact) { mainProject.sources.push(artifact.filePath); }); }); ["cpp", "objcpp"].forEach(function(tag) { (product.artifacts[tag] || []).forEach(function(artifact) { if (!artifact.cpp || artifact.fileTags.contains("qt.untranslatable")) return; var key = (artifact.cpp.includePaths || []).join(""); var current = cxxArtifactsByIncludePaths[key] || []; current.push(artifact); cxxArtifactsByIncludePaths[key] = current; }); }); }; product.dependencies.forEach(function(dep) { if (!dep.present) handleProduct(dep); }); var cxxProductNr = 0; for (key in cxxArtifactsByIncludePaths) { var artifactList = cxxArtifactsByIncludePaths[key]; var cxxProject = { projectFile: "cxx " + ++cxxProductNr, includePaths: artifactList[0].cpp.includePaths, sources: [] }; artifactList.forEach(function(artifact) { cxxProject.sources.push(artifact.filePath); }); mainProject.subProjects.push(cxxProject); } (new TextFile(output.filePath, TextFile.WriteOnly)).write( JSON.stringify(mainProject)); } return cmd; } } // This is a pure action target that intentionally does not do any change tracking. // It is implemented this way because it writes source files and therefore needs to be able // to overwrite user edits (e.g. accidental removal of a source string). Rule { inputs: "lupdate_json" outputFileTags: "lupdate-result" prepare: { var tool = product.Qt.core.binPath + '/' + product.Qt.core.lupdateName; var args = ["-project", inputs.lupdate_json[0].filePath] .concat(product.extraArguments || []); var cmd = new Command(tool, args); cmd.description = "updating translation files"; return cmd; } } } qbs-src-3.2.0/share/qbs/imports/qbs/base/ConfigInstall.qbs0000644000175100017510000000174515154533055023037 0ustar runnerrunnerModule { Depends { name: "installpaths" } property bool install: true property string binariesDirectory: installpaths.bin property string applicationsDirectory: installpaths.applications property bool dynamicLibraries: install property string dynamicLibrariesDirectory: qbs.targetOS.contains("windows") ? installpaths.bin : installpaths.lib property bool staticLibraries: false property string staticLibrariesDirectory: installpaths.lib property bool frameworks: install property string frameworksDirectory: installpaths.frameworks property bool importLibraries: false property string importLibrariesDirectory: installpaths.lib property bool plugins: install property string pluginsDirectory: installpaths.plugins property bool loadableModules: install property string loadableModulesDirectory: installpaths.loadableModules property bool debugInformation: install property string debugInformationDirectory } qbs-src-3.2.0/share/qbs/imports/qbs/base/QtModule.qbs0000644000175100017510000000736215154533055022036 0ustar runnerrunnerimport qbs.FileInfo Module { condition: (qbs.targetPlatform === targetPlatform || isCombinedUIKitBuild) && (!qbs.architecture || architectures.length === 0 || architectures.contains(qbs.architecture)) readonly property bool isCombinedUIKitBuild: ["ios", "tvos", "watchos"].contains(targetPlatform) && (!qbs.architecture || ["x86", "x86_64"].contains(qbs.architecture)) && qbs.targetPlatform === targetPlatform + "-simulator" Depends { name: "cpp" } Depends { name: "Qt.core" } Depends { name: "Qt.plugin_support" } property stringList pluginTypes Qt.plugin_support.pluginTypes: pluginTypes Depends { condition: Qt.core.staticBuild && !isPlugin name: "Qt"; submodules: { // We have to pull in all plugins here, because dependency resolving happens // before module merging, and we don't know yet if someone set // Qt.pluginSupport.pluginsByType in the product. // TODO: We might be able to use Qt.pluginSupport.pluginsByType now. // The real filtering is done later by the plugin module files themselves. var list = []; var allPlugins = Qt.plugin_support.allPluginsByType; for (var i = 0; i < (pluginTypes || []).length; ++i) Array.prototype.push.apply(list, allPlugins[pluginTypes[i]]) return list; } } property string qtModuleName property path binPath: Qt.core.binPath property path incPath: Qt.core.incPath property path libPath: Qt.core.libPath property string qtLibInfix: Qt.core.libInfix property string libNameForLinkerDebug property string libNameForLinkerRelease property string libNameForLinker: Qt.core.qtBuildVariant === "debug" ? libNameForLinkerDebug : libNameForLinkerRelease property string libFilePathDebug property string libFilePathRelease property string libFilePath: Qt.core.qtBuildVariant === "debug" ? libFilePathDebug : libFilePathRelease property bool hasLibrary: true property bool isStaticLibrary: false property bool isFramework: false property bool isPlugin: false property stringList architectures property string targetPlatform property stringList staticLibsDebug property stringList staticLibsRelease property stringList dynamicLibsDebug property stringList dynamicLibsRelease property stringList linkerFlagsDebug property stringList linkerFlagsRelease property stringList staticLibs: Qt.core.qtBuildVariant === "debug" ? staticLibsDebug : staticLibsRelease property stringList dynamicLibs: Qt.core.qtBuildVariant === "debug" ? dynamicLibsDebug : dynamicLibsRelease property stringList frameworksDebug property stringList frameworksRelease property stringList frameworkPathsDebug property stringList frameworkPathsRelease property stringList mFrameworks: Qt.core.qtBuildVariant === "debug" ? frameworksDebug : frameworksRelease property stringList mFrameworkPaths: Qt.core.qtBuildVariant === "debug" ? frameworkPathsDebug: frameworkPathsRelease cpp.linkerFlags: Qt.core.qtBuildVariant === "debug" ? linkerFlagsDebug : linkerFlagsRelease property bool enableLinking: qtModuleName != undefined && hasLibrary property stringList moduleConfig Properties { condition: enableLinking cpp.staticLibraries: staticLibs cpp.dynamicLibraries: dynamicLibs cpp.frameworks: mFrameworks.concat(isFramework ? [libNameForLinker] : []) cpp.systemFrameworkPaths: mFrameworkPaths } } qbs-src-3.2.0/share/qbs/imports/qbs/base/Library.qbs0000644000175100017510000001034515154533055021703 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ NativeBinary { Depends { name: "config.build" } type: { var defaultType = config.build.libraryType + "library"; if (qbs.targetOS.contains("ios") && parseInt(cpp.minimumIosVersion, 10) < 8) return ["staticlibrary"]; if (defaultType === "dynamiclibrary" && isForAndroid) return [defaultType, "android.nativelibrary"]; return [defaultType]; } readonly property bool isDynamicLibrary: type.contains("dynamiclibrary") readonly property bool isStaticLibrary: type.contains("staticlibrary") readonly property bool isLoadableModule: type.contains("loadablemodule") Depends { name: "config.install" } install: installDir !== undefined installDir: { if (isForAndroid) return undefined; if (isForDarwin && bundle.isBundle && config.install.frameworks) return config.install.frameworksDirectory; if (isStaticLibrary && config.install.staticLibraries) return config.install.staticLibrariesDirectory; if (isDynamicLibrary && config.install.dynamicLibraries) return config.install.dynamicLibrariesDirectory; return undefined; } property bool installImportLib: config.install.importLibraries property string importLibInstallDir: config.install.importLibrariesDirectory debugInformationInstallDir: config.install.debugInformationDirectory || installDir Group { condition: install && _installable fileTagsFilter: { if (isBundle) return ["bundle.content"]; if (isDynamicLibrary) return ["dynamiclibrary", "dynamiclibrary_symlink"]; if (isStaticLibrary) return ["staticlibrary"]; if (isLoadableModule) return ["loadablemodule"]; return []; } qbs.install: true qbs.installDir: installDir qbs.installSourceBase: isBundle ? destinationDirectory : outer } Group { condition: installImportLib && type.contains("dynamiclibrary") && _installable fileTagsFilter: "dynamiclibrary_import" qbs.install: true qbs.installDir: importLibInstallDir } Group { condition: installDebugInformation && _installable fileTagsFilter: { if (isDynamicLibrary) return ["debuginfo_dll"]; else if (isLoadableModule) return ["debuginfo_loadablemodule"]; return []; } qbs.install: true qbs.installDir: debugInformationInstallDir qbs.installSourceBase: destinationDirectory } Group { condition: isBundle product.bundle.isForMainBundle: !isStaticLibrary } } qbs-src-3.2.0/share/qbs/imports/qbs/base/JavaJarFile.qbs0000644000175100017510000000310615154533055022412 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ Product { Depends { name: "java" } type: ["java.jar"] property string entryPoint } qbs-src-3.2.0/share/qbs/imports/qbs/base/LoadableModule.qbs0000644000175100017510000000305415154533055023147 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ DynamicLibrary { type: isForDarwin ? ["loadablemodule"] : base } qbs-src-3.2.0/share/qbs/imports/qbs/base/QtGuiApplication.qbs0000644000175100017510000000303015154533055023505 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ QtApplication { Depends { name: "Qt.gui" } } qbs-src-3.2.0/share/qbs/imports/qbs/base/QtApplication.qbs0000644000175100017510000000303215154533055023042 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ CppApplication { Depends { name: "Qt.core" } } qbs-src-3.2.0/share/qbs/imports/qbs/base/ApplicationExtension.qbs0000644000175100017510000000550015154533055024434 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ XPCService { Depends { name: "xcode" } type: base.concat(["applicationextension"]) property bool _useLegacyExtensionLibraries: qbs.targetOS.contains("macos") && xcode.present && parseInt(xcode.sdkVersion.split(".")[1], 10) < 11 || qbs.targetOS.contains("ios") && xcode.present && parseInt(xcode.sdkVersion.split(".")[0], 10) < 9 cpp.entryPoint: "_NSExtensionMain" cpp.frameworkPaths: base.concat(_useLegacyExtensionLibraries ? qbs.sysroot + "/System/Library/PrivateFrameworks/" : []) cpp.frameworks: { var frameworks = base.concat(["Foundation"]); if (_useLegacyExtensionLibraries) frameworks.push("PlugInKit"); return frameworks; } cpp.requireAppExtensionSafeApi: true xpcServiceType: undefined property var extensionAttributes property string extensionPointIdentifier property string extensionPrincipalClass bundle.infoPlist: { var infoPlist = base; infoPlist["NSExtension"] = { "NSExtensionAttributes": extensionAttributes || {}, "NSExtensionPointIdentifier": extensionPointIdentifier, "NSExtensionPrincipalClass": extensionPrincipalClass }; return infoPlist; } } qbs-src-3.2.0/share/qbs/imports/qbs/base/Plugin.qbs0000644000175100017510000000470715154533055021542 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com). ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ Library { Depends { name: "config.install" } Depends { name: "config.build" } type: { var defaultType = config.build.pluginType + "library"; if (qbs.targetOS.contains("ios") && parseInt(cpp.minimumIosVersion, 10) < 8) return ["staticlibrary"]; if (defaultType === "dynamiclibrary") { if (isForDarwin) return ["loadablemodule"]; if (isForAndroid) return [defaultType, "android.nativelibrary"]; } return [defaultType]; } installDir: { if (config.build.pluginType == "dynamic" && config.install.plugins) { if (isForDarwin && bundle.isBundle) return config.install.loadableModulesDirectory return config.install.pluginsDirectory; } return undefined; } debugInformationInstallDir: config.install.debugInformationDirectory || installDir } qbs-src-3.2.0/share/qbs/imports/qbs/base/AppleApplicationDiskImage.qbs0000644000175100017510000001170715154533055025305 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.ModUtils AppleDiskImage { property string sourceBase: "/Applications" readonly property string absoluteSourceBase: FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, sourceBase) property stringList symlinks: ["/Applications:Applications"] readonly property string stageDirectory: FileInfo.joinPaths(destinationDirectory, "Volumes", dmg.volumeName) Rule { multiplex: true outputFileTags: ["dmg.input", "dmg.input.symlink"] outputArtifacts: Array.prototype.map.call(product.symlinks, function (symlink) { var symlinkTarget = symlink.split(':')[0]; var symlinkName = symlink.split(':')[1] || symlinkTarget; if (FileInfo.isAbsolutePath(symlinkName)) throw(symlink + " is an invalid symlink; the destination must be a relative path"); return { filePath: FileInfo.joinPaths(product.stageDirectory, symlinkName), fileTags: ["dmg.input", "dmg.input.symlink"], dmg: { symlinkTarget: symlinkTarget, sourceBase: product.stageDirectory }, }; }) prepare: Array.prototype.map.call(outputs["dmg.input"], function (symlink) { var cmd = new Command("ln", ["-sfn", symlink.dmg.symlinkTarget, symlink.filePath]); cmd.workingDirectory = product.stageDirectory; cmd.description = "symlinking " + symlink.fileName + " to " + symlink.dmg.symlinkTarget; return cmd; }); } Rule { multiplex: true inputs: ["dmg.input.symlink"] inputsFromDependencies: ["installable"] outputFileTags: ["dmg.input"] outputArtifacts: { var absSourceBase = product.absoluteSourceBase; var symlinkPaths = (inputs["dmg.input.symlink"] || []).map(function (s) { return s.filePath; }); return Array.prototype.map.call(inputs["installable"], function (a) { var fp = ModUtils.artifactInstalledFilePath(a); if (fp.startsWith(absSourceBase)) { var outputFilePath = fp.replace(absSourceBase, product.stageDirectory); // Check for symlink conflicts for (var i in symlinkPaths) { if (outputFilePath.startsWith(symlinkPaths[i])) throw new Error("Cannot install '" + a.filePath + "' to '" + outputFilePath + "' because it " + "would conflict with the symlink at '" + symlinkPaths[i] + "'"); } return { filePath: outputFilePath, fileTags: ["dmg.input"], dmg: { sourceBase: product.stageDirectory } } } }).filter(function (a) { return !!a; }); } prepare: { var absSourceBase = product.absoluteSourceBase; var cmds = [], dmgs = outputs["dmg.input"]; for (var i in dmgs) { var a = dmgs[i]; var cmd = new JavaScriptCommand(); cmd.src = a.filePath.replace(product.stageDirectory, absSourceBase); cmd.dst = a.filePath; cmd.silent = true; cmd.sourceCode = function () { File.copy(src, dst); }; cmds.push(cmd); } return cmds; } } } qbs-src-3.2.0/share/qbs/imports/qbs/base/ConfigBuild.qbs0000644000175100017510000000045315154533055022463 0ustar runnerrunnerModule { property string libraryType: "dynamic" PropertyOptions { name: "libraryType" allowedValues: ["static", "dynamic"] } property string pluginType: libraryType PropertyOptions { name: "pluginType" allowedValues: ["static", "dynamic"] } } qbs-src-3.2.0/share/qbs/imports/qbs/base/NativeBinary.qbs0000644000175100017510000000571615154533055022700 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ Product { property bool isForAndroid: qbs.targetOS.contains("android") property bool isForDarwin: qbs.targetOS.contains("darwin") property bool isBundle: isForDarwin && bundle.isBundle property bool install: !isForAndroid property string installDir // Product artifacts should be installed if it's not multiplexed or aggregated, // or if it is multiplexed and it's the aggregate product readonly property bool _installable: type && !type.includes("objectlibrary") && (!multiplexed || !aggregate || !multiplexConfigurationId) property bool installDebugInformation: install property string debugInformationInstallDir: installDir Depends { name: "bundle"; condition: isForDarwin } aggregate: { if (!isForDarwin) return false; var multiplexProps = multiplexByQbsProperties; if (!multiplexProps) return false; if (multiplexProps.contains("architectures")) { var archs = qbs.architectures; if (archs && archs.length > 1) return true; } if (multiplexProps.contains("buildVariants")) { var variants = qbs.buildVariants; return variants && variants.length > 1; } return false; } multiplexByQbsProperties: { if (isForDarwin) return ["profiles", "architectures", "buildVariants"]; if (isForAndroid) return ["architectures"] return ["profiles"]; } } qbs-src-3.2.0/share/qbs/imports/qbs/base/XPCService.qbs0000644000175100017510000000354415154533055022255 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ Application { type: base.concat(["xpcservice"]) condition: qbs.targetOS.contains("darwin") property string xpcServiceType: "Application" bundle.infoPlist: { var infoPlist = base; if (xpcServiceType) { infoPlist["XPCService"] = { "ServiceType": xpcServiceType }; } return infoPlist; } } qbs-src-3.2.0/share/qbs/imports/qbs/base/AppleDiskImage.qbs0000644000175100017510000000304515154533055023115 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ Product { Depends { name: "dmg" } type: ["dmg.dmg"] } qbs-src-3.2.0/share/qbs/imports/qbs/BundleTools/0000755000175100017510000000000015154533055021105 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/imports/qbs/BundleTools/bundle-tools.js0000644000175100017510000000603515154533055024056 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); var DarwinTools = require("qbs.DarwinTools"); var PropertyList = require("qbs.PropertyList"); function destinationDirectoryForResource(product, input) { var path = product.destinationDirectory; var inputFilePath = FileInfo.joinPaths(input.baseDir, input.fileName); var key = DarwinTools.localizationKey(inputFilePath); if (key) { path = FileInfo.joinPaths(path, localizedResourcesFolderPath(product, key)); var subPath = DarwinTools.relativeResourcePath(inputFilePath); if (subPath && subPath !== '.') path = FileInfo.joinPaths(path, subPath); } else { path = FileInfo.joinPaths(path, product.moduleProperty("bundle", "unlocalizedResourcesFolderPath")); } return path; } function localizedResourcesFolderPath(product, key) { return FileInfo.joinPaths(product.moduleProperty("bundle", "unlocalizedResourcesFolderPath"), key + product.moduleProperty("bundle", "localizedResourcesFolderSuffix")); } function infoPlistContents(infoPlistFilePath) { if (infoPlistFilePath === undefined) return undefined; var plist = new PropertyList(); try { plist.readFromFile(infoPlistFilePath); return plist.toObject(); } finally { plist.clear(); } } function infoPlistFormat(infoPlistFilePath) { if (infoPlistFilePath === undefined) return undefined; var plist = new PropertyList(); try { plist.readFromFile(infoPlistFilePath); return plist.format(); } finally { plist.clear(); } } qbs-src-3.2.0/share/qbs/imports/qbs/PathTools/0000755000175100017510000000000015154533055020570 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/imports/qbs/PathTools/path-tools.js0000644000175100017510000002473115154533055023227 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); function _bundleExecutableTemporaryFilePath(product, variantSuffix) { if (variantSuffix === undefined) variantSuffix = product.cpp.variantSuffix; return ".tmp/" + FileInfo.fileName(bundleExecutableFilePath(product, variantSuffix)); } function bundleExecutableFilePath(product, variantSuffix) { if (variantSuffix === undefined) variantSuffix = product.cpp.variantSuffix; return product.moduleProperty("bundle", "executablePath") + (variantSuffix || ""); } function applicationFilePath(product, variantSuffix) { if (variantSuffix === undefined) variantSuffix = product.cpp.variantSuffix; if (product.moduleProperty("bundle", "isBundle")) return _bundleExecutableTemporaryFilePath(product, variantSuffix); return product.moduleProperty("cpp", "executablePrefix") + product.targetName + (variantSuffix || "") + product.moduleProperty("cpp", "executableSuffix"); } function loadableModuleFilePath(product, variantSuffix) { if (variantSuffix === undefined) variantSuffix = product.cpp.variantSuffix; if (product.moduleProperty("bundle", "isBundle")) return _bundleExecutableTemporaryFilePath(product, variantSuffix); return product.moduleProperty("cpp", "loadableModulePrefix") + product.targetName + (variantSuffix || "") + product.moduleProperty("cpp", "loadableModuleSuffix"); } function staticLibraryFilePath(product, variantSuffix) { if (variantSuffix === undefined) variantSuffix = product.cpp.variantSuffix; if (product.moduleProperty("bundle", "isBundle")) return _bundleExecutableTemporaryFilePath(product, variantSuffix); return product.moduleProperty("cpp", "staticLibraryPrefix") + product.targetName + (variantSuffix || "") + product.moduleProperty("cpp", "staticLibrarySuffix"); } function dynamicLibraryFilePath(product, variantSuffix, version, maxParts) { if (variantSuffix === undefined) variantSuffix = product.cpp.variantSuffix; if (product.moduleProperty("bundle", "isBundle")) return _bundleExecutableTemporaryFilePath(product, variantSuffix); // If no override version was given, use the product's version // We specifically want to differentiate between undefined and i.e. // empty string as empty string should be taken to mean "no version" // and undefined should be taken to mean "use the product's version" // (which could still end up being "no version") if (version === undefined) version = product.moduleProperty("cpp", "internalVersion"); // If we have a version number, potentially strip off some components if (maxParts === 0) version = undefined; else if (maxParts && version) version = version.split('.').slice(0, maxParts).join('.'); // Start with prefix + name (i.e. libqbs, qbs) var fileName = product.moduleProperty("cpp", "dynamicLibraryPrefix") + product.targetName + (variantSuffix || ""); // For Mach-O images, append the version number if there is one (i.e. libqbs.1.0.0) var imageFormat = product.moduleProperty("cpp", "imageFormat"); if (version && imageFormat === "macho") { fileName += "." + version; version = undefined; } fileName += product.moduleProperty("cpp", "archSuffix"); // Append the suffix (i.e. libqbs.1.0.0.dylib, libqbs.so, qbs.dll) fileName += product.moduleProperty("cpp", "dynamicLibrarySuffix"); // For ELF images, append the version number if there is one (i.e. libqbs.so.1.0.0) if (version && (imageFormat === "elf" || imageFormat === "wasm")) fileName += "." + version; return fileName; } function linkerOutputFilePath(fileTag, product, variantSuffix, version, maxParts) { switch (fileTag) { case "application": return applicationFilePath(product, variantSuffix); case "loadablemodule": return loadableModuleFilePath(product, variantSuffix); case "staticlibrary": return staticLibraryFilePath(product, variantSuffix); case "dynamiclibrary": return dynamicLibraryFilePath(product, variantSuffix, version, maxParts); default: throw new Error("Unknown linker output file tag: " + fileTag); } } function importLibraryFilePath(product) { return product.moduleProperty("cpp", "dynamicLibraryPrefix") + product.targetName + (product.cpp.variantSuffix || "") + product.moduleProperty("cpp", "dynamicLibraryImportSuffix"); } function debugInfoIsBundle(product) { if (!product.moduleProperty("qbs", "targetOS").contains("darwin")) return false; var flags = product.moduleProperty("cpp", "dsymutilFlags") || []; return !flags.contains("-f") && !flags.contains("--flat"); } function debugInfoFileName(product, variantSuffix, fileTag) { var suffix = ""; // For dSYM bundles, the DWARF debug info file has no suffix if (!product.moduleProperty("qbs", "targetOS").contains("darwin") || !debugInfoIsBundle(product)) suffix = product.moduleProperty("cpp", "debugInfoSuffix"); if (product.qbs.toolchain.includes("emscripten")) return product.targetName + ".wasm.debug.wasm"; if (product.moduleProperty("bundle", "isBundle")) { return FileInfo.fileName(bundleExecutableFilePath(product, variantSuffix)) + suffix; } else { switch (fileTag) { case "application": return applicationFilePath(product, variantSuffix) + suffix; case "dynamiclibrary": return dynamicLibraryFilePath(product, variantSuffix) + suffix; case "loadablemodule": return loadableModuleFilePath(product, variantSuffix) + suffix; case "staticlibrary": return staticLibraryFilePath(product, variantSuffix) + suffix; default: return product.targetName + (variantSuffix || "") + suffix; } } } function debugInfoBundlePath(product, fileTag) { if (!debugInfoIsBundle(product)) return undefined; var suffix = product.moduleProperty("cpp", "debugInfoBundleSuffix"); if (product.moduleProperty("qbs", "targetOS").contains("darwin") && product.moduleProperty("bundle", "isBundle")) return product.moduleProperty("bundle", "bundleName") + suffix; return debugInfoFileName(product, undefined, fileTag) + suffix; } function debugInfoFilePath(product, variantSuffix, fileTag) { var name = debugInfoFileName(product, variantSuffix, fileTag); if (product.moduleProperty("qbs", "targetOS").contains("darwin") && debugInfoIsBundle(product)) { return FileInfo.joinPaths(debugInfoBundlePath(product, fileTag), "Contents", "Resources", "DWARF", name); } else if (product.moduleProperty("bundle", "isBundle")) { return FileInfo.joinPaths(product.moduleProperty("bundle", "executableFolderPath"), name); } return name; } function debugInfoPlistFilePath(product, fileTag) { if (!debugInfoIsBundle(product)) return undefined; return FileInfo.joinPaths(debugInfoBundlePath(product, fileTag), "Contents", "Info.plist"); } // Returns whether the string looks like a library filename function isLibraryFileName(product, fileName, prefix, suffixes, isShared) { var suffix, i; var os = product.moduleProperty("qbs", "targetOS"); for (i = 0; i < suffixes.length; ++i) { suffix = suffixes[i]; if (isShared && os.contains("unix") && !os.contains("darwin")) suffix += "(\\.[0-9]+){0,3}"; if (fileName.match("^" + prefix + ".+?\\" + suffix + "$")) return true; } return false; } function frameworkExecutablePath(frameworkPath) { var suffix = ".framework"; var isAbsoluteFrameworkPath = frameworkPath.slice(-suffix.length) === suffix; if (isAbsoluteFrameworkPath) { var frameworkName = FileInfo.fileName(frameworkPath).slice(0, -suffix.length); return FileInfo.joinPaths(frameworkPath, frameworkName); } return undefined; } // pathList is also a string, using the respective separator function prependOrSetPath(path, pathList, separator) { if (!pathList || pathList.length === 0) return path; return path + separator + pathList; } function librarySuffixes(targetOS, types, forImport) { if (targetOS.includes("windows")) { if (forImport) { return [] .concat(types.includes("shared") ? [".lib"] : []) // mingw uses .a for static libs .concat(types.includes("static") ? [".lib", ".a"] : []); } return [].concat(types.includes("shared") ? [".dll"] : []); } if (targetOS.includes("darwin")) { return [] .concat(types.includes("shared") ? [".dylib"] : []) .concat(types.includes("static") ? [".a"] : []); } return [] .concat(types.includes("shared") ? [".so"] : []) .concat(types.includes("static") ? [".a"] : []); } function libraryNameFilter() { return function(name) { return [name, "lib" + name]; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/0000755000175100017510000000000015154533055020105 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/imports/qbs/Probes/IarProbe.qbs0000644000175100017510000000626115154533055022324 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import "../../../modules/cpp/iar.js" as IAR PathProbe { // Inputs property string compilerFilePath property stringList enableDefinesByLanguage // Outputs property string architecture property string endianness property int versionMajor property int versionMinor property int versionPatch property stringList includePaths property var compilerDefinesByLanguage configure: { compilerDefinesByLanguage = {}; if (!File.exists(compilerFilePath)) { found = false; return; } var languages = enableDefinesByLanguage; if (!languages || languages.length === 0) languages = ["c"]; var defaultPathsByLanguage = {}; for (var i = 0; i < languages.length; ++i) { var tag = languages[i]; compilerDefinesByLanguage[tag] = IAR.dumpMacros( compilerFilePath, tag); var paths = IAR.dumpDefaultPaths(compilerFilePath, tag); defaultPathsByLanguage[tag] = paths; } var macros = compilerDefinesByLanguage["c"] || compilerDefinesByLanguage["cpp"]; architecture = IAR.guessArchitecture(macros); endianness = IAR.guessEndianness(macros); var defaultPaths = defaultPathsByLanguage["cpp"] || defaultPathsByLanguage["c"]; includePaths = defaultPaths.includePaths; var version = IAR.guessVersion(macros, architecture); if (version) { versionMajor = version.major; versionMinor = version.minor; versionPatch = version.patch; found = !!architecture && !!endianness; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/NpmProbe.qbs0000644000175100017510000000650015154533055022337 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.FileInfo import qbs.Host import qbs.ModUtils import "path-probe.js" as PathProbeConfigure import "../../../modules/nodejs/nodejs.js" as NodeJs NodeJsProbe { names: ["npm"] // Inputs property string interpreterPath // Outputs property path npmBin property path npmRoot property path npmPrefix configure: { if (!interpreterPath) throw '"interpreterPath" must be specified'; var selectors; var results = PathProbeConfigure.configure( selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths, pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths); var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), Host.os().contains("windows")); v.prepend(interpreterPath); var resultsMapper = function(result) { result.npmBin = result.found ? NodeJs.findLocation(result.filePath, "bin", v.value) : undefined; result.npmRoot = result.found ? NodeJs.findLocation(result.filePath, "root", v.value) : undefined; result.npmPrefix = result.found ? NodeJs.findLocation(result.filePath, "prefix", v.value) : undefined; return result; }; results.files = results.files.map(resultsMapper); found = results.found; allResults = results.files; var result = results.files[0]; candidatePaths = result.candidatePaths; path = result.path; filePath = result.filePath; fileName = result.fileName; npmBin = result.npmBin; npmRoot = result.npmRoot; npmPrefix = result.npmPrefix; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/ClangClProbe.qbs0000644000175100017510000001001415154533055023103 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.Utilities import "../../../modules/cpp/gcc.js" as Gcc PathProbe { // Inputs property string compilerFilePath property string vcvarsallFilePath property stringList enableDefinesByLanguage property string preferredArchitecture property string winSdkVersion // Outputs property int versionMajor property int versionMinor property int versionPatch property stringList includePaths property string architecture property var buildEnv property var compilerDefinesByLanguage configure: { var languages = enableDefinesByLanguage; if (!languages || languages.length === 0) languages = ["c"]; var info = languages.contains("c") ? Utilities.clangClCompilerInfo( compilerFilePath, preferredArchitecture, vcvarsallFilePath, "c", winSdkVersion) : {}; var infoCpp = languages.contains("cpp") ? Utilities.clangClCompilerInfo( compilerFilePath, preferredArchitecture, vcvarsallFilePath, "cpp", winSdkVersion) : {}; found = (!languages.contains("c") || (!!info && !!info.macros && !!info.buildEnvironment)) && (!languages.contains("cpp") || (!!infoCpp && !!infoCpp.macros && !!infoCpp.buildEnvironment)); compilerDefinesByLanguage = { "c": info.macros, "cpp": infoCpp.macros, }; var macros = info.macros || infoCpp.macros; versionMajor = parseInt(macros["__clang_major__"], 10); versionMinor = parseInt(macros["__clang_minor__"], 10); versionPatch = parseInt(macros["__clang_patchlevel__"], 10); buildEnv = info.buildEnvironment || infoCpp.buildEnvironment; // clang-cl is just a wrapper around clang.exe, so the includes *should be* the same var clangPath = FileInfo.joinPaths(FileInfo.path(compilerFilePath), "clang.exe"); var defaultPaths = Gcc.dumpDefaultPaths(buildEnv, clangPath, [], Host.nullDevice(), FileInfo.pathListSeparator(), "", ""); includePaths = defaultPaths.includePaths; architecture = ModUtils.guessArchitecture(macros); } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/BinaryProbe.qbs0000644000175100017510000000335015154533055023031 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Host PathProbe { nameSuffixes: Host.os().contains("windows") ? [".com", ".exe", ".bat", ".cmd"] : undefined platformSearchPaths: Host.os().contains("unix") ? ["/usr/bin", "/usr/local/bin"] : [] platformEnvironmentPaths: [ "PATH" ] } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/path-probe.js0000644000175100017510000001370215154533055022507 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Environment = require("qbs.Environment"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); function asStringList(key, value) { if (typeof(value) === "string") return [value]; if (value instanceof Array) return value; throw key + " must be a string or a stringList"; } function canonicalSelectors(selectors, nameSuffixes) { var mapper = function(selector) { if (typeof(selector) === "string") return {names : [selector]}; if (selector instanceof Array) return {names : selector}; // dict if (!selector.names) throw '"names" must be specified'; selector.names = asStringList("names", selector.names); if (selector.nameSuffixes) selector.nameSuffixes = asStringList("nameSuffixes", selector.nameSuffixes); else selector.nameSuffixes = nameSuffixes; return selector; }; return selectors.map(mapper); } function pathsFromEnvs(envs, pathListSeparator) { envs = envs || []; var result = []; for (var i = 0; i < envs.length; ++i) { var value = Environment.getEnv(envs[i]) || ''; if (value.length > 0) result = result.concat(value.split(pathListSeparator)); } return result; } function configure(selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths, pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths) { var result = { found: false, files: [] }; if (!selectors && !names) throw '"names" or "selectors" must be specified'; if (!selectors) { selectors = [ {names: names, nameSuffixes: nameSuffixes} ]; } else { selectors = canonicalSelectors(selectors, nameSuffixes); } if (nameFilter) { selectors.forEach(function(selector) { selector.names = ModUtils.concatAll.apply(undefined, selector.names.map(nameFilter)); }); } selectors.forEach(function(selector) { selector.names = ModUtils.concatAll.apply(undefined, selector.names.map(function(name) { return (selector.nameSuffixes || [""]).map(function(suffix) { return name + suffix; }); })); }); // FIXME: Suggest how to obtain paths from system var _paths = ModUtils.concatAll( pathsFromEnvs(environmentPaths, FileInfo.pathListSeparator()), searchPaths, pathsFromEnvs(platformEnvironmentPaths, FileInfo.pathListSeparator()), platformSearchPaths); var _suffixes = ModUtils.concatAll('', pathSuffixes); _paths = _paths.map(function(p) { return FileInfo.fromNativeSeparators(p); }); _suffixes = _suffixes.map(function(p) { return FileInfo.fromNativeSeparators(p); }); var findFile = function(selector) { var file = { found: false, candidatePaths: [] }; for (var i = 0; i < selector.names.length; ++i) { for (var j = 0; j < _paths.length; ++j) { for (var k = 0; k < _suffixes.length; ++k) { var _filePath = FileInfo.joinPaths(_paths[j], _suffixes[k], selector.names[i]); file.candidatePaths.push(_filePath); if (File.exists(_filePath) && (!candidateFilter || candidateFilter(_filePath))) { file.found = true; file.filePath = _filePath; // Manually specify the path components that constitute _filePath rather // than using the FileInfo.path and FileInfo.fileName functions because we // want to break _filePath into its constituent parts based on the input // originally given by the user. For example, the FileInfo functions would // produce a different result if any of the items in the names property // contained more than a single path component. file.fileName = selector.names[i]; file.path = FileInfo.joinPaths(_paths[j], _suffixes[k]); return file; } } } } return file; }; result.files = selectors.map(findFile); result.found = result.files.reduce(function(acc, value) { return acc && value.found }, true); return result; } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/JdkProbe.qbs0000644000175100017510000000443615154533055022323 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Environment import qbs.Host import "../../../modules/java/utils.js" as JavaUtils PathProbe { // Inputs property string architecture: !_androidCrossCompiling ? qbs.architecture : undefined property bool _androidCrossCompiling: qbs.targetOS.contains("android") && !Host.os().contains("android") environmentPaths: Environment.getEnv("JAVA_HOME") platformSearchPaths: [ "/usr/lib/jvm/default-java", // Debian/Ubuntu "/etc/alternatives/java_sdk_openjdk", // Fedora "/usr/lib/jvm/default" // Arch ] configure: { path = JavaUtils.findJdkPath(Host.os(), architecture, environmentPaths, platformSearchPaths); found = !!path; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs0000644000175100017510000000526115154533055023451 0ustar runnerrunnerimport qbs.Environment import qbs.FileInfo import qbs.Host import "path-probe.js" as PathProbeConfigure BinaryProbe { nameSuffixes: undefined // _compilerName already contains ".exe" suffix on Windows // Inputs property string _compilerName property string _toolchainPrefix // Outputs property string tcPrefix platformSearchPaths: { var paths = base; if (qbs.targetOS.contains("windows") && Host.os().contains("windows")) paths.push(FileInfo.joinPaths( Environment.getEnv("SystemDrive"), "MinGW", "bin")); return paths; } names: { var prefixes = []; if (_toolchainPrefix) { prefixes.push(_toolchainPrefix); } else { var arch = qbs.architecture; if (qbs.targetOS.contains("windows")) { if (!arch || arch === "x86") { prefixes.push("mingw32-", "i686-w64-mingw32-", "i686-w64-mingw32.shared-", "i686-w64-mingw32.static-", "i686-mingw32-", "i586-mingw32msvc-"); } if (!arch || arch === "x86_64") { prefixes.push("x86_64-w64-mingw32-", "x86_64-w64-mingw32.shared-", "x86_64-w64-mingw32.static-", "amd64-mingw32msvc-"); } } } return prefixes.map(function(prefix) { return prefix + _compilerName; }).concat([_compilerName]); } configure: { var selectors; var results = PathProbeConfigure.configure( selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths, pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths); found = results.found; if (!found) return; var resultsMapper = function(result) { (nameSuffixes || [""]).forEach(function(suffix) { var end = _compilerName + suffix; if (result.fileName.endsWith(end)) result.tcPrefix = result.fileName.slice(0, -end.length); }); return result; }; results.files = results.files.map(resultsMapper); allResults = results.files; var result = results.files[0]; candidatePaths = result.candidatePaths; path = result.path; filePath = result.filePath; fileName = result.fileName; tcPrefix = result.tcPrefix; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/AndroidNdkProbe.qbs0000644000175100017510000001320115154533055023616 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Environment import qbs.File import qbs.FileInfo import qbs.Host import qbs.TextFile import "../../../modules/Android/android-utils.js" as AndroidUtils PathProbe { // Inputs property path sdkPath environmentPaths: Environment.getEnv("ANDROID_NDK_ROOT") platformSearchPaths: { var paths = []; if (sdkPath) paths.push(FileInfo.joinPaths(sdkPath, "ndk-bundle")); if (Host.os().contains("windows")) paths.push(FileInfo.joinPaths(Environment.getEnv("LOCALAPPDATA"), "Android", "sdk", "ndk-bundle")); if (Host.os().contains("macos")) paths.push(FileInfo.joinPaths(Environment.getEnv("HOME"), "Library", "Android", "sdk", "ndk-bundle")); if (Host.os().contains("linux")) paths.push(FileInfo.joinPaths(Environment.getEnv("HOME"), "Android", "Sdk", "ndk-bundle")); return paths; } // Outputs property stringList candidatePaths property string samplesDir property var hostArch property stringList toolchains: [] property string ndkVersion configure: { function readFileContent(filePath) { var result = null; if (!File.exists(filePath)) return result; try { var tf = new TextFile(filePath, TextFile.ReadOnly); result = tf.readAll(); } finally { if (tf) tf.close(); } return result; } var i, j, allPaths = (environmentPaths || []).concat(platformSearchPaths || []); candidatePaths = allPaths; for (i in allPaths) { var platforms = []; if (Host.os().contains("windows")) platforms.push("windows-x86_64", "windows"); if (Host.os().contains("darwin")) platforms.push("darwin-x86_64", "darwin-x86"); if (Host.os().contains("linux")) platforms.push("linux-x86_64", "linux-x86"); for (j in platforms) { if (File.exists(FileInfo.joinPaths(allPaths[i], "prebuilt", platforms[j]))) { path = allPaths[i]; if (File.exists(FileInfo.joinPaths(path, "samples"))) samplesDir = FileInfo.joinPaths(path, "samples"); // removed in r11 hostArch = platforms[j]; toolchains = File.directoryEntries(FileInfo.joinPaths(path, "toolchains"), File.Dirs | File.NoDotAndDotDot); // NDK r11 and above var content = readFileContent(path + "/source.properties"); if (content) { var lines = content.trim().split(/\r?\n/g).filter(function (line) { return line.length > 0; }); for (var l = 0; l < lines.length; ++l) { var m = lines[l].match(/^Pkg\.Revision\s*=\s*([0-9\.]+)$/); if (m) { ndkVersion = m[1]; found = true; return; } } } // NDK r10 and below var releaseTextFileCandidates = ["RELEASE.txt", "RELEASE.TXT"] .map(function(v) { return FileInfo.joinPaths(path, v); }) .filter(File.exists); content = releaseTextFileCandidates.length ? readFileContent(releaseTextFileCandidates[0]) : null; if (content) { var m = content.trim().match(/^r([0-9]+[a-z]?).*/); if (m) { ndkVersion = m[1]; found = true; return; } } } } } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs0000644000175100017510000000712215154533055023714 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import "path-probe.js" as PathProbeConfigure import "../../../modules/typescript/typescript.js" as TypeScript BinaryProbe { id: tsc names: ["tsc"] searchPaths: packageManagerBinPath ? [packageManagerBinPath] : [] // Inputs property path interpreterPath property path packageManagerBinPath property path packageManagerRootPath // Outputs property var version configure: { if (!condition) return; if (!interpreterPath) throw '"interpreterPath" must be specified'; if (!packageManagerBinPath) throw '"packageManagerBinPath" must be specified'; if (!packageManagerRootPath) throw '"packageManagerRootPath" must be specified'; var selectors; var results = PathProbeConfigure.configure( selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths, pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths); var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), Host.os().contains("windows")); v.prepend(interpreterPath); var resultsMapper = function(result) { result.version = result.found ? TypeScript.findTscVersion(result.filePath, v.value) : undefined; if (FileInfo.fromNativeSeparators(packageManagerBinPath) !== result.path || !File.exists( FileInfo.fromNativeSeparators(packageManagerRootPath, "typescript"))) { result = { found: false }; } return result; }; results.files = results.files.map(resultsMapper); found = results.found; allResults = results.files; var result = results.files[0]; candidatePaths = result.candidatePaths; path = result.path; filePath = result.filePath; fileName = result.fileName; version = result.version; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/KeilProbe.qbs0000644000175100017510000000607515154533055022500 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.Host import "../../../modules/cpp/keil.js" as KEIL PathProbe { // Inputs property string compilerFilePath property stringList enableDefinesByLanguage // Outputs property string architecture property string endianness property int versionMajor property int versionMinor property int versionPatch property stringList includePaths property var compilerDefinesByLanguage configure: { compilerDefinesByLanguage = {}; if (!File.exists(compilerFilePath)) { found = false; return; } var languages = enableDefinesByLanguage; if (!languages || languages.length === 0) languages = ["c"]; for (var i = 0; i < languages.length; ++i) { var tag = languages[i]; compilerDefinesByLanguage[tag] = KEIL.dumpMacros( compilerFilePath, tag, Host.nullDevice()); } var macros = compilerDefinesByLanguage["c"] || compilerDefinesByLanguage["cpp"]; architecture = KEIL.guessArchitecture(macros); endianness = KEIL.guessEndianness(macros); var defaultPaths = KEIL.dumpDefaultPaths( compilerFilePath, Host.nullDevice()); includePaths = defaultPaths.includePaths; var version = KEIL.guessVersion(macros); if (version) { versionMajor = version.major; versionMinor = version.minor; versionPatch = version.patch; found = !!architecture && !!endianness; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/WiXProbe.qbs0000644000175100017510000000563715154533055022326 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Utilities PathProbe { // Inputs property string registryKey: { var keys = [ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Installer XML", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Installer XML" ]; for (var i in keys) { var groups = Utilities.nativeSettingGroups(keys[i]).filter(function (v) { return v.match(/^([0-9]+)\.([0-9]+)$/); }); groups.sort(function (a, b) { var re = /^([0-9]+)\.([0-9]+)$/; a = a.match(re); b = b.match(re); a = {major: a[1], minor: a[2]}; b = {major: b[1], minor: b[2]}; if (a.major === b.major) return b.minor - a.minor; return b.major - a.major; }); for (var j in groups) { var fullKey = keys[i] + "\\" + groups[j]; if (Utilities.getNativeSetting(fullKey, "ProductVersion")) return fullKey; } } } // Outputs property var root property var version configure: { var key = registryKey; path = Utilities.getNativeSetting(key, "InstallFolder"); root = Utilities.getNativeSetting(key, "InstallRoot"); version = Utilities.getNativeSetting(key, "ProductVersion"); found = path && root && version; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/ClBinaryProbe.qbs0000644000175100017510000000556315154533055023320 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.FileInfo import qbs.ModUtils import qbs.Utilities import "path-probe.js" as PathProbeConfigure BinaryProbe { // input property string preferredArchitecture configure: { var _selectors; var results = PathProbeConfigure.configure(_selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths, pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths); if (!results.found) { var msvcs = Utilities.installedMSVCs(preferredArchitecture); if (msvcs.length >= 1) { var result = {}; result.fileName = "cl.exe"; result.path = msvcs[0].binPath; result.filePath = FileInfo.joinPaths(path, fileName); result.candidatePaths = result.filePath; results.found = true; results.files = [result]; } } found = results.found; allResults = results.files; if (allResults.length === 1) { var result = allResults[0]; candidatePaths = result.candidatePaths; path = result.path; filePath = result.filePath; fileName = result.fileName; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/QbsPkgConfigProbe.qbs0000644000175100017510000000455515154533055024132 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import "qbs-pkg-config-probe.js" as PkgConfigProbeConfigure Probe { // Inputs property string _executableFilePath property stringList _extraPaths property stringList _libDirs property bool _staticMode: false property bool _definePrefix: false property path _sysroot // Output property var packages property var packagesByModuleName property var brokenPackages property stringList qmakePaths configure: { var result = PkgConfigProbeConfigure.configure( _executableFilePath, _extraPaths, _libDirs, _staticMode, _definePrefix, _sysroot); packages = result.packages; packagesByModuleName = result.packagesByModuleName; brokenPackages = result.brokenPackages; qmakePaths = result.qmakePaths; found = true; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/NodeJsProbe.qbs0000644000175100017510000000412315154533055022766 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Environment import qbs.FileInfo import qbs.Host BinaryProbe { names: ["node", "nodejs"] platformSearchPaths: { var paths = base; if (Host.os().contains("windows")) { var env32 = Environment.getEnv("PROGRAMFILES(X86)"); var env64 = Environment.getEnv("PROGRAMFILES"); if (env64 === env32 && env64.endsWith(" (x86)")) env64 = env64.slice(0, -(" (x86)".length)); // QTBUG-3845 paths.push(FileInfo.joinPaths(env64, "nodejs")); paths.push(FileInfo.joinPaths(env32, "nodejs")); } return paths; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/IncludeProbe.qbs0000644000175100017510000000345315154533055023174 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ PathProbe { platformSearchPaths: qbs.targetOS.contains("unix") ? [ "/usr/include", "/usr/local/include", "/include", "/app/include", ] : [] platformEnvironmentPaths: { if (qbs.toolchain.contains('msvc')) return [ "INCLUDE" ]; return undefined; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/DmcProbe.qbs0000644000175100017510000000675015154533055022317 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.ModUtils import "../../../modules/cpp/dmc.js" as DMC PathProbe { // Inputs property string compilerFilePath property stringList enableDefinesByLanguage property string _targetPlatform property string _targetArchitecture property string _targetExtender // Only for DOS 16/32 bit. // Outputs property string architecture property string targetPlatform property int versionMajor property int versionMinor property int versionPatch property stringList includePaths property var compilerDefinesByLanguage configure: { compilerDefinesByLanguage = {}; if (!File.exists(compilerFilePath)) { found = false; return; } var languages = enableDefinesByLanguage; if (!languages || languages.length === 0) languages = ["c"]; var defaultPathsByLanguage = {}; for (var i = 0; i < languages.length; ++i) { var tag = languages[i]; compilerDefinesByLanguage[tag] = DMC.dumpMacros( compilerFilePath, _targetPlatform, _targetArchitecture, _targetExtender, tag); var paths = DMC.dumpDefaultPaths(compilerFilePath, tag); defaultPathsByLanguage[tag] = paths; } var macros = compilerDefinesByLanguage["c"] || compilerDefinesByLanguage["cpp"]; architecture = ModUtils.guessArchitecture(macros); targetPlatform = ModUtils.guessTargetPlatform(macros); var defaultPaths = defaultPathsByLanguage["cpp"] || defaultPathsByLanguage["c"]; includePaths = defaultPaths.includePaths; var version = DMC.guessVersion(macros); if (version) { versionMajor = version.major; versionMinor = version.minor; versionPatch = version.patch; found = !!architecture; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/GccProbe.qbs0000644000175100017510000001131215154533055022276 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import "../../../modules/cpp/gcc.js" as Gcc PathProbe { // Inputs property var compilerFilePathByLanguage property stringList enableDefinesByLanguage property stringList flags: [] property var environment property string _sysroot: qbs.sysroot property stringList _targetOS: qbs.targetOS // Outputs property string architecture property string endianness property string targetPlatform property stringList includePaths property stringList libraryPaths property stringList frameworkPaths property var compilerDefinesByLanguage configure: { compilerDefinesByLanguage = {}; var languages = enableDefinesByLanguage; if (!languages || languages.length === 0) languages = ["c"]; for (var i = 0; i < languages.length; ++i) { var fp = compilerFilePathByLanguage[languages[i]]; if (fp && File.exists(fp)) { try { compilerDefinesByLanguage[languages[i]] = Gcc.dumpMacros(environment, fp, flags, Host.nullDevice(), languages[i]); } catch (e) { // Only throw errors when determining the compiler defines for the C language; // for other languages we presume it is an indication that the language is not // installed (as is typically the case for Objective-C/C++ on non-Apple systems) if (languages[i] === "c") throw e; } } else if (languages[i] === "c") { found = false; return; } } var macros = compilerDefinesByLanguage["c"] || compilerDefinesByLanguage["cpp"] || compilerDefinesByLanguage["objc"] || compilerDefinesByLanguage["objcpp"]; var defaultPaths = Gcc.dumpDefaultPaths(environment, compilerFilePathByLanguage["cpp"] || compilerFilePathByLanguage["c"], flags, Host.nullDevice(), FileInfo.pathListSeparator(), _sysroot, _targetOS); found = !!macros && !!defaultPaths; includePaths = defaultPaths.includePaths; libraryPaths = defaultPaths.libraryPaths; frameworkPaths = defaultPaths.frameworkPaths; // We have to dump the compiler's macros; -dumpmachine is not suitable because it is not // always complete (for example, the subarch is not included for arm architectures). architecture = ModUtils.guessArchitecture(macros); targetPlatform = ModUtils.guessTargetPlatform(macros); switch (macros["__BYTE_ORDER__"]) { case "__ORDER_BIG_ENDIAN__": endianness = "big"; break; case "__ORDER_LITTLE_ENDIAN__": endianness = "little"; break; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/qbs-pkg-config-probe.js0000644000175100017510000001201115154533055024352 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Environment = require("qbs.Environment"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var PkgConfig = require("qbs.PkgConfig"); var ProviderUtils = require("qbs.ProviderUtils"); var Process = require("qbs.Process"); function getQmakePaths(pkg) { var packageName = pkg.baseFileName; if (packageName === "QtCore" || packageName === "Qt5Core" || packageName === "Qt6Core") { var binDir = pkg.variables["bindir"] || pkg.variables["host_bins"]; if (!binDir) { if (packageName === "QtCore") { // Qt4 does not have host_bins var mocLocation = pkg.variables["moc_location"]; if (!mocLocation) { console.warn("No moc_location variable in " + packageName); return; } binDir = FileInfo.path(mocLocation); } else { console.warn("No 'bindir' or 'host_bins' variable in " + packageName); return; } } var suffix = FileInfo.executableSuffix(); var ret = []; const infixes = ["", "5", "6"]; for (var index in infixes) { const infix = infixes[index]; var fileName = FileInfo.joinPaths(binDir, "qmake" + infix + suffix); if (File.exists(fileName)) { ret.push(fileName); } } return ret; } } function configure( executableFilePath, extraPaths, libDirs, staticMode, definePrefix, sysroot) { var result = {}; result.packages = []; result.packagesByModuleName = {}; result.brokenPackages = []; result.qtInfos = []; var options = {}; options.libDirs = libDirs; options.sysroot = sysroot; options.definePrefix = definePrefix; if (options.sysroot) options.allowSystemLibraryPaths = true; options.staticMode = staticMode; options.extraPaths = extraPaths; if (options.sysroot && !options.libDirs) { options.libDirs = [ options.sysroot + "/usr/lib/pkgconfig", options.sysroot + "/usr/share/pkgconfig" ]; } if (!options.libDirs) { // if we have pkg-config/pkgconf installed, let's ask it for its search paths (since // built-in search paths can differ between platforms) if (executableFilePath) { var p = new Process() if (p.exec(executableFilePath, ['pkg-config', '--variable=pc_path']) === 0) { var stdout = p.readStdOut().trim(); options.libDirs = stdout ? stdout.split(FileInfo.pathListSeparator()): []; var installDir = FileInfo.path(executableFilePath); options.libDirs = options.libDirs.map(function(path){ if (FileInfo.isAbsolutePath(path)) return path; return FileInfo.cleanPath(FileInfo.joinPaths(installDir, path)); }); } } } var pkgConfig = new PkgConfig(options); result.packages = pkgConfig.packages(); for (var packageName in result.packages) { var pkg = result.packages[packageName]; var moduleName = ProviderUtils.pkgConfigToModuleName(packageName); result.packagesByModuleName[moduleName] = pkg; if (packageName.startsWith("Qt")) { if (!sysroot) { var qmakePaths = getQmakePaths(pkg); if (qmakePaths !== undefined) result.qmakePaths = qmakePaths; } } } return result; } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/ClangClBinaryProbe.qbs0000644000175100017510000000603615154533055024261 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.FileInfo import qbs.ModUtils import qbs.Utilities import "path-probe.js" as PathProbeConfigure BinaryProbe { // output property string vcvarsallPath configure: { var _selectors; var results = PathProbeConfigure.configure(_selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths, pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths); var compilerPath; if (results.found) compilerPath = results.files[0].filePath; var compilers = Utilities.installedClangCls(compilerPath); if (compilers.length >= 1) { var result = {}; result.fileName = "clang-cl.exe"; result.path = compilers[0].toolchainInstallPath; result.filePath = FileInfo.joinPaths(result.path, result.fileName); result.candidatePaths = result.filePath; result.vcvarsallPath = compilers[0].vcvarsallPath; results.found = true; results.files = [result]; } found = results.found; allResults = results.files; if (allResults.length === 1) { var result = allResults[0]; candidatePaths = result.candidatePaths; path = result.path; filePath = result.filePath; fileName = result.fileName; vcvarsallPath = result.vcvarsallPath; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/QmakeProbe.qbs0000644000175100017510000000335315154533055022646 0ustar runnerrunner /**************************************************************************** ** ** Copyright (C) 2023 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import "qmake-probe.js" as QmakeProbeConfigure Probe { property stringList qmakePaths property varList qtInfos configure: { qtInfos = QmakeProbeConfigure.configure(qmakePaths); found = qtInfos.length > 0; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/XcodeLocationProbe.qbs0000644000175100017510000000364015154533055024342 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Process Probe { property path developerPath configure: { var p = new Process(); try { p.exec("/usr/bin/xcode-select", ["--print-path"], true); developerPath = p.readStdOut().trim(); } catch (e) { developerPath = "/Applications/Xcode.app/Contents/Developer"; } finally { p.close(); found = true; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/qmake-probe.js0000644000175100017510000016244115154533055022656 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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$ ** ****************************************************************************/ var Environment = require("qbs.Environment"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var Host = require("qbs.Host"); var Process = require("qbs.Process"); var ProviderUtils = require("qbs.ProviderUtils"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); function splitNonEmpty(s, c) { return s.split(c).filter(function(e) { return e; }); } function getQmakeFilePaths(qmakeFilePaths) { if (qmakeFilePaths && qmakeFilePaths.length > 0) return qmakeFilePaths; console.info("Detecting Qt installations..."); var filePaths = []; var pathValue = Environment.getEnv("PATH"); if (pathValue) { var dirs = splitNonEmpty(pathValue, FileInfo.pathListSeparator()); for (var i = 0; i < dirs.length; ++i) { var candidate = FileInfo.joinPaths(dirs[i], "qmake" + FileInfo.executableSuffix()); var canonicalCandidate = FileInfo.canonicalPath(candidate); if (!canonicalCandidate || !File.exists(canonicalCandidate)) continue; if (FileInfo.completeBaseName(canonicalCandidate) !== "qtchooser") candidate = canonicalCandidate; if (!filePaths.contains(candidate)) { console.info("Found Qt at '" + FileInfo.toNativeSeparators(candidate) + "'."); filePaths.push(candidate); } } } if (filePaths.length === 0) { console.warn("Could not find any qmake executables in PATH. Either make sure a qmake " + "executable is present in PATH or set the moduleProviders.Qt.qmakeFilePaths property " + "to point to a qmake executable."); } return filePaths; } function queryQmake(qmakeFilePath) { var qmakeProcess = new Process; qmakeProcess.exec(qmakeFilePath, ["-query"]); if (qmakeProcess.exitCode() !== 0) { throw "The qmake executable '" + FileInfo.toNativeSeparators(qmakeFilePath) + "' failed with exit code " + qmakeProcess.exitCode() + "."; } var queryResult = {}; while (!qmakeProcess.atEnd()) { var line = qmakeProcess.readLine(); var index = (line || "").indexOf(":"); if (index !== -1) queryResult[line.slice(0, index)] = line.slice(index + 1).trim(); } return queryResult; } function pathQueryValue(queryResult, key) { var p = queryResult[key]; if (p) return FileInfo.fromNativeSeparators(p); } function readFileContent(filePath) { var f = new TextFile(filePath, TextFile.ReadOnly); var content = f.readAll(); f.close(); return content; } // TODO: Don't do the split every time... function configVariable(configContent, key) { var configContentLines = configContent.split('\n'); var regexp = new RegExp("^\\s*" + key + "\\s*\\+{0,1}=(.*)"); for (var i = 0; i < configContentLines.length; ++i) { var line = configContentLines[i]; var match = regexp.exec(line); if (match) return match[1].trim(); } } function configVariableItems(configContent, key) { var list = []; var configContentLines = configContent.split('\n'); var regexp = new RegExp("^\\s*" + key + "\\s*([+-]?=)(.*)"); for (var i = 0; i < configContentLines.length; ++i) { var line = configContentLines[i]; var match = regexp.exec(line); if (!match) continue; var op = match[1]; var lineList = splitNonEmpty(match[2], ' '); if (op === '=') { list = lineList; continue; } if (op === '+=') { list = list.concat(lineList); continue; } if (op === '-=') { for (var j = 0; j < lineList.length; ++j) { var idx = list.indexOf(lineList[j]); if (idx !== -1) list.splice(idx, 1); } } } return list; } function msvcCompilerVersionForYear(year) { var mapping = { "2005": "14", "2008": "15", "2010": "16", "2012": "17", "2013": "18", "2015": "19", "2017": "19.1", "2019": "19.2" }; return mapping[year]; } function msvcPrefix() { return "win32-msvc"; } function msvcCompilerVersionFromMkspecName(mkspecName) { if (mkspecName.startsWith(msvcPrefix())) { return msvcCompilerVersionForYear(mkspecName.slice(msvcPrefix().length)); } return undefined; } function addQtBuildVariant(qtProps, buildVariantName) { if (qtProps.qtConfigItems.contains(buildVariantName)) qtProps.buildVariant.push(buildVariantName); } function checkForStaticBuild(qtProps) { if (qtProps.qtMajorVersion >= 5) return qtProps.qtConfigItems.contains("static"); if (qtProps.frameworkBuild) return false; // there are no Qt4 static frameworks var isWin = qtProps.mkspecName.startsWith("win"); var libDir = isWin ? qtProps.binaryPath : qtProps.libraryPath; var coreLibFiles = File.directoryEntries(libDir, File.Files) .filter(function(fp) { return fp.contains("Core"); }); if (coreLibFiles.length === 0) throw "Could not determine whether Qt is a static build."; for (var i = 0; i < coreLibFiles.length; ++i) { if (Utilities.isSharedLibrary(coreLibFiles[i])) return false; } return true; } function guessMinimumWindowsVersion(qtProps) { if (qtProps.mkspecName.startsWith("winrt-")) return "10.0"; if (!ProviderUtils.isDesktopWindowsQt(qtProps)) return ""; if (qtProps.qtMajorVersion >= 6) return "10.0"; if (qtProps.architecture === "x86_64" || qtProps.architecture === "ia64") return "5.2" var match = qtProps.mkspecName.match(/^win32-msvc(\d+)$/); if (match) { var msvcVersion = match[1]; if (msvcVersion < 2012) return "5.0"; return "5.1"; } return qtProps.qtMajorVersion < 5 ? "5.0" : "5.1"; } function fillEntryPointLibs(qtProps, debug) { result = []; var isMinGW = ProviderUtils.isMinGwQt(qtProps); // Some Linux distributions rename the qtmain library. var qtMainCandidates = ["qtmain"]; if (isMinGW && qtProps.qtMajorVersion === 5) qtMainCandidates.push("qt5main"); if (qtProps.qtMajorVersion === 6) qtMainCandidates.push("Qt6EntryPoint"); for (var i = 0; i < qtMainCandidates.length; ++i) { var baseNameCandidate = qtMainCandidates[i]; var qtmain = qtProps.libraryPath + '/'; if (isMinGW) qtmain += "lib"; qtmain += baseNameCandidate + qtProps.qtLibInfix; if (debug && ProviderUtils.qtNeedsDSuffix(qtProps)) qtmain += 'd'; if (isMinGW) { qtmain += ".a"; } else { qtmain += ".lib"; if (Utilities.versionCompare(qtProps.qtVersion, "5.4.0") >= 0) result.push("Shell32.lib"); } if (File.exists(qtmain)) { result.push(qtmain); break; } } if (result.length === 0) { console.warn("Could not find the qtmain library at '" + FileInfo.toNativeSeparators(qtProps.libraryPath) + "'. You will not be able to link Qt applications."); } return result; } function getQtProperties(qmakeFilePath) { var queryResult = queryQmake(qmakeFilePath); var qtProps = {}; qtProps.installPrefixPath = pathQueryValue(queryResult, "QT_INSTALL_PREFIX"); qtProps.documentationPath = pathQueryValue(queryResult, "QT_INSTALL_DOCS"); qtProps.translationsPath = pathQueryValue(queryResult, "QT_INSTALL_TRANSLATIONS"); qtProps.includePath = pathQueryValue(queryResult, "QT_INSTALL_HEADERS"); qtProps.libraryPath = pathQueryValue(queryResult, "QT_INSTALL_LIBS"); qtProps.hostLibraryPath = pathQueryValue(queryResult, "QT_HOST_LIBS"); qtProps.binaryPath = pathQueryValue(queryResult, "QT_HOST_BINS") || pathQueryValue(queryResult, "QT_INSTALL_BINS"); qtProps.installPath = pathQueryValue(queryResult, "QT_INSTALL_BINS"); qtProps.pluginPath = pathQueryValue(queryResult, "QT_INSTALL_PLUGINS"); qtProps.qmlPath = pathQueryValue(queryResult, "QT_INSTALL_QML"); qtProps.qmlImportPath = pathQueryValue(queryResult, "QT_INSTALL_IMPORTS"); qtProps.qtVersion = queryResult.QT_VERSION; var mkspecsBaseSrcPath; if (Utilities.versionCompare(qtProps.qtVersion, "5") >= 0) { qtProps.mkspecBasePath = FileInfo.joinPaths(pathQueryValue(queryResult, "QT_HOST_DATA"), "mkspecs"); mkspecsBaseSrcPath = FileInfo.joinPaths(pathQueryValue(queryResult, "QT_HOST_DATA/src"), "mkspecs"); } else { qtProps.mkspecBasePath = FileInfo.joinPaths (pathQueryValue(queryResult, "QT_INSTALL_DATA"), "mkspecs"); } if (Utilities.versionCompare(qtProps.qtVersion, "6") >= 0) { qtProps.libExecPath = pathQueryValue(queryResult, "QT_HOST_LIBEXECS") || pathQueryValue(queryResult, "QT_INSTALL_LIBEXECS"); } // QML tools were only moved in Qt 6.2. qtProps.qmlLibExecPath = Utilities.versionCompare(qtProps.qtVersion, "6.2") >= 0 ? qtProps.libExecPath : qtProps.binaryPath; // qhelpgenerator was only moved in Qt 6.3. qtProps.helpGeneratorLibExecPath = Utilities.versionCompare(qtProps.qtVersion, "6.3") >= 0 ? qtProps.libExecPath : qtProps.binaryPath; if (!File.exists(qtProps.mkspecBasePath)) throw "Cannot extract the mkspecs directory."; var qconfigContent = readFileContent(FileInfo.joinPaths(qtProps.mkspecBasePath, "qconfig.pri")); qtProps.qtMajorVersion = parseInt(configVariable(qconfigContent, "QT_MAJOR_VERSION")); qtProps.qtMinorVersion = parseInt(configVariable(qconfigContent, "QT_MINOR_VERSION")); qtProps.qtPatchVersion = parseInt(configVariable(qconfigContent, "QT_PATCH_VERSION")); qtProps.qtNameSpace = configVariable(qconfigContent, "QT_NAMESPACE"); qtProps.qtLibInfix = configVariable(qconfigContent, "QT_LIBINFIX") || ""; qtProps.architecture = configVariable(qconfigContent, "QT_TARGET_ARCH") || configVariable(qconfigContent, "QT_ARCH") || "x86"; qtProps.configItems = configVariableItems(qconfigContent, "CONFIG"); qtProps.qtConfigItems = configVariableItems(qconfigContent, "QT_CONFIG"); qtProps.enabledFeatures = configVariableItems(qconfigContent, "QT.global.enabled_features"); qtProps.disabledFeatures = configVariableItems(qconfigContent, "QT.global.disabled_features"); // retrieve the mkspec if (qtProps.qtMajorVersion >= 5) { qtProps.mkspecName = queryResult.QMAKE_XSPEC; qtProps.mkspecPath = FileInfo.joinPaths(qtProps.mkspecBasePath, qtProps.mkspecName); if (mkspecsBaseSrcPath && !File.exists(qtProps.mkspecPath)) qtProps.mkspecPath = FileInfo.joinPaths(mkspecsBaseSrcPath, qtProps.mkspecName); } else { if (Host.os().contains("windows")) { var baseDirPath = FileInfo.joinPaths(qtProps.mkspecBasePath, "default"); var fileContent = readFileContent(FileInfo.joinPaths(baseDirPath, "qmake.conf")); qtProps.mkspecPath = configVariable(fileContent, "QMAKESPEC_ORIGINAL"); if (!File.exists(qtProps.mkspecPath)) { // Work around QTBUG-28792. // The value of QMAKESPEC_ORIGINAL is wrong for MinGW packages. Y u h8 me? var match = fileContent.exec(/\binclude\(([^)]+)\/qmake\.conf\)/m); if (match) { qtProps.mkspecPath = FileInfo.cleanPath(FileInfo.joinPaths( baseDirPath, match[1])); } } } else { qtProps.mkspecPath = FileInfo.canonicalPath( FileInfo.joinPaths(qtProps.mkspecBasePath, "default")); } // E.g. in qmake.conf for Qt 4.8/mingw we find this gem: // QMAKESPEC_ORIGINAL=C:\\Qt\\Qt\\4.8\\mingw482\\mkspecs\\win32-g++ qtProps.mkspecPath = FileInfo.cleanPath(qtProps.mkspecPath); qtProps.mkspecName = qtProps.mkspecPath; var idx = qtProps.mkspecName.lastIndexOf('/'); if (idx !== -1) qtProps.mkspecName = qtProps.mkspecName.slice(idx + 1); } if (!File.exists(qtProps.mkspecPath)) throw "mkspec '" + FileInfo.toNativeSeparators(qtProps.mkspecPath) + "' does not exist"; // Starting with qt 5.14, android sdk provides multi-abi if (Utilities.versionCompare(qtProps.qtVersion, "5.14.0") >= 0 && qtProps.mkspecPath.contains("android")) { var qdeviceContent = readFileContent(FileInfo.joinPaths(qtProps.mkspecBasePath, "qdevice.pri")); qtProps.androidAbis = configVariable(qdeviceContent, "DEFAULT_ANDROID_ABIS").split(' '); } // determine MSVC version if (ProviderUtils.isMsvcQt(qtProps)) { var msvcMajor = configVariable(qconfigContent, "QT_MSVC_MAJOR_VERSION"); var msvcMinor = configVariable(qconfigContent, "QT_MSVC_MINOR_VERSION"); var msvcPatch = configVariable(qconfigContent, "QT_MSVC_PATCH_VERSION"); if (msvcMajor && msvcMinor && msvcPatch) qtProps.msvcVersion = msvcMajor + "." + msvcMinor + "." + msvcPatch; else qtProps.msvcVersion = msvcCompilerVersionFromMkspecName(qtProps.mkspecName); } // determine whether we have a framework build qtProps.frameworkBuild = qtProps.mkspecPath.contains("macx") && qtProps.configItems.contains("qt_framework"); // determine whether Qt is built with debug, release or both qtProps.buildVariant = []; addQtBuildVariant(qtProps, "debug"); addQtBuildVariant(qtProps, "release"); qtProps.staticBuild = checkForStaticBuild(qtProps); qtProps.multiThreading = qtProps.enabledFeatures.contains("thread"); // determine whether user apps require C++11 if (qtProps.qtConfigItems.contains("c++11") && qtProps.staticBuild) qtProps.configItems.push("c++11"); // Set the minimum operating system versions appropriate for this Qt version qtProps.windowsVersion = guessMinimumWindowsVersion(qtProps); if (qtProps.windowsVersion) { // Is target OS Windows? if (qtProps.buildVariant.contains("debug")) qtProps.entryPointLibsDebug = fillEntryPointLibs(qtProps, true); if (qtProps.buildVariant.contains("release")) qtProps.entryPointLibsRelease = fillEntryPointLibs(qtProps, false); } else if (qtProps.mkspecPath.contains("macx")) { if (qtProps.qtMajorVersion >= 5) { // Since Qt 6.7.1, QMAKE_MACOSX|IOS_DEPLOYMENT_TARGET is no longer present in // qmake.conf. But it is also present in qconfig.pri, so first try to read it from there qtProps.macosVersion = configVariable(qconfigContent, "QMAKE_MACOSX_DEPLOYMENT_TARGET"); qtProps.iosVersion = configVariable(qconfigContent, "QMAKE_IOS_DEPLOYMENT_TARGET"); // Next, we override the value from qmake.conf, if present there // Note, that TVOS/WATCHOS variables are only present in qmake.conf (as of Qt 6.7.1) var lines = getFileContentsRecursively(FileInfo.joinPaths(qtProps.mkspecPath, "qmake.conf")); for (var i = 0; i < lines.length; ++i) { var line = lines[i].trim(); match = line.match (/^QMAKE_(MACOSX|IOS|TVOS|WATCHOS)_DEPLOYMENT_TARGET\s*=\s*(.*)\s*$/); if (match) { var platform = match[1]; var version = match[2]; if (platform === "MACOSX") qtProps.macosVersion = version; else if (platform === "IOS") qtProps.iosVersion = version; else if (platform === "TVOS") qtProps.tvosVersion = version; else if (platform === "WATCHOS") qtProps.watchosVersion = version; } } var isMac = qtProps.mkspecName !== "macx-ios-clang" && qtProps.mkspecName !== "macx-tvos-clang" && qtProps.mkspecName !== "macx-watchos-clang"; if (isMac) { // Qt 5.0.x placed the minimum version in a different file if (!qtProps.macosVersion) qtProps.macosVersion = "10.6"; // If we're using C++11 with libc++, make sure the deployment target is >= 10.7 if (Utilities.versionCompare(qtProps.macosVersion, "10, 7") < 0 && qtProps.qtConfigItems.contains("c++11")) { qtProps.macosVersion = "10.7"; } } } else if (qtProps.qtMajorVersion === 4 && qtProps.qtMinorVersion >= 6) { var qconfigDir = qtProps.frameworkBuild ? FileInfo.joinPaths(qtProps.libraryPath, "QtCore.framework", "Headers") : FileInfo.joinPaths(qtProps.includePath, "Qt"); try { var qconfig = new TextFile(FileInfo.joinPaths(qconfigDir, "qconfig.h"), TextFile.ReadOnly); var qtCocoaBuild = false; var ok = true; do { line = qconfig.readLine(); if (line.match(/\s*#define\s+QT_MAC_USE_COCOA\s+1\s*/)) { qtCocoaBuild = true; break; } } while (!qconfig.atEof()); qtProps.macosVersion = qtCocoaBuild ? "10.5" : "10.4"; } catch (e) {} finally { if (qconfig) qconfig.close(); } if (!qtProps.macosVersion) { throw "Could not determine whether Qt is using Cocoa or Carbon from '" + FileInfo.toNativeSeparators(qconfig.filePath()) + "'."; } } } else if (qtProps.mkspecPath.contains("android")) { if (qtProps.qtMajorVersion >= 5) qtProps.androidVersion = "2.3"; else if (qtProps.qtMajorVersion === 4 && qtProps.qtMinorVersion >= 8) qtProps.androidVersion = "1.6"; // Necessitas } if (qtProps.qtMajorVersion > 5) { qtProps.archData = pathQueryValue(queryResult, "QT_INSTALL_ARCHDATA"); qtProps.metaTypeFiles = File.directoryEntries(qtProps.archData + "/metatypes", File.Files); } return qtProps; } function makePluginData() { var pluginData = {}; pluginData.type = undefined; pluginData.className = undefined; pluginData.autoLoad = true; pluginData["extends"] = []; return pluginData; } function makeQtModuleInfo(name, qbsName, deps) { var moduleInfo = {}; moduleInfo.name = name; // As in the path to the headers and ".name" in the pri files. if (moduleInfo.name === undefined) moduleInfo.name = ""; moduleInfo.qbsName = qbsName; // Lower-case version without "qt" prefix. moduleInfo.dependencies = deps || []; // qbs names. if (moduleInfo.qbsName && moduleInfo.qbsName !== "core" && !moduleInfo.dependencies.contains("core")) { moduleInfo.dependencies.unshift("core"); } moduleInfo.isPrivate = qbsName && qbsName.endsWith("-private"); moduleInfo.hasLibrary = !moduleInfo.isPrivate; moduleInfo.isStaticLibrary = false; moduleInfo.isPlugin = false; moduleInfo.mustExist = true; moduleInfo.modulePrefix = ""; // empty value means "Qt". moduleInfo.version = undefined; moduleInfo.includePaths = []; moduleInfo.compilerDefines = []; moduleInfo.staticLibrariesDebug = []; moduleInfo.staticLibrariesRelease = []; moduleInfo.dynamicLibrariesDebug = []; moduleInfo.dynamicLibrariesRelease = []; moduleInfo.linkerFlagsDebug = []; moduleInfo.linkerFlagsRelease = []; moduleInfo.libFilePathDebug = undefined; moduleInfo.libFilePathRelease = undefined; moduleInfo.frameworksDebug = []; moduleInfo.frameworksRelease = []; moduleInfo.frameworkPathsDebug = []; moduleInfo.frameworkPathsRelease = []; moduleInfo.libraryPaths = []; moduleInfo.libDir = ""; moduleInfo.config = []; moduleInfo.supportedPluginTypes = []; moduleInfo.pluginData = makePluginData(); return moduleInfo; } function frameworkHeadersPath(qtModuleInfo, qtProps) { return FileInfo.joinPaths(qtProps.libraryPath, qtModuleInfo.name + ".framework", "Headers"); } function qt4ModuleIncludePaths(qtModuleInfo, qtProps) { var paths = []; if (ProviderUtils.qtIsFramework(qtModuleInfo, qtProps)) paths.push(frameworkHeadersPath(qtModuleInfo, qtProps)); else paths.push(qtProps.includePath, FileInfo.joinPaths(qtProps.includePath, qtModuleInfo.name)); return paths; } // We erroneously called the "testlib" module "test" for quite a while. Let's not punish users // for that. function addTestModule(modules) { var testModule = makeQtModuleInfo("QtTest", "test", ["testlib"]); testModule.hasLibrary = false; modules.push(testModule); } // See above. function addDesignerComponentsModule(modules) { var module = makeQtModuleInfo("QtDesignerComponents", "designercomponents", ["designercomponents-private"]); module.hasLibrary = false; modules.push(module); } function guessLibraryFilePath(prlFilePath, libDir, qtProps) { var baseName = FileInfo.baseName(prlFilePath); var prefixCandidates = ["", "lib"]; var suffixCandidates = ["so." + qtProps.qtVersion, "so", "a", "lib", "dll.a"]; for (var i = 0; i < prefixCandidates.length; ++i) { var prefix = prefixCandidates[i]; for (var j = 0; j < suffixCandidates.length; ++j) { var suffix = suffixCandidates[j]; var candidate = FileInfo.joinPaths(libDir, prefix + baseName + '.' + suffix); if (File.exists(candidate)) return candidate; } } } function doReplaceQtLibNamesWithFilePath(namePathMap, libList) { for (var i = 0; i < libList.length; ++i) { var lib = libList[i]; var path = namePathMap[lib]; if (path) libList[i] = path; } } function replaceQtLibNamesWithFilePath(modules, qtProps) { // We don't want to add the libraries for Qt modules via "-l", because of the // danger that a wrong one will be picked up, e.g. from /usr/lib. Instead, // we pull them in using the full file path. var linkerNamesToFilePathsDebug = {}; var linkerNamesToFilePathsRelease = {}; for (var i = 0; i < modules.length; ++i) { var m = modules[i]; linkerNamesToFilePathsDebug[ ProviderUtils.qtLibNameForLinker(m, qtProps, true)] = m.libFilePathDebug; linkerNamesToFilePathsRelease[ ProviderUtils.qtLibNameForLinker(m, qtProps, false)] = m.libFilePathRelease; } for (i = 0; i < modules.length; ++i) { var module = modules[i]; doReplaceQtLibNamesWithFilePath(linkerNamesToFilePathsDebug, module.dynamicLibrariesDebug); doReplaceQtLibNamesWithFilePath(linkerNamesToFilePathsDebug, module.staticLibrariesDebug); doReplaceQtLibNamesWithFilePath(linkerNamesToFilePathsRelease, module.dynamicLibrariesRelease); doReplaceQtLibNamesWithFilePath(linkerNamesToFilePathsRelease, module.staticLibrariesRelease); } } function doSetupLibraries(modInfo, qtProps, debugBuild, nonExistingPrlFiles, androidAbi) { if (!modInfo.hasLibrary) return; // Can happen for Qt4 convenience modules, like "widgets". if (debugBuild) { if (!qtProps.buildVariant.contains("debug")) return; var modulesNeverBuiltAsDebug = ["bootstrap", "qmldevtools"]; for (var i = 0; i < modulesNeverBuiltAsDebug.length; ++i) { var m = modulesNeverBuiltAsDebug[i]; if (modInfo.qbsName === m || modInfo.qbsName === m + "-private") return; } } else if (!qtProps.buildVariant.contains("release")) { return; } var libs = modInfo.isStaticLibrary ? (debugBuild ? modInfo.staticLibrariesDebug : modInfo.staticLibrariesRelease) : (debugBuild ? modInfo.dynamicLibrariesDebug : modInfo.dynamicLibrariesRelease); var frameworks = debugBuild ? modInfo.frameworksDebug : modInfo.frameworksRelease; var frameworkPaths = debugBuild ? modInfo.frameworkPathsDebug : modInfo.frameworkPathsRelease; var flags = debugBuild ? modInfo.linkerFlagsDebug : modInfo.linkerFlagsRelease; var libFilePath; if (qtProps.mkspecName.contains("ios") && modInfo.isStaticLibrary) { libs.push("z", "m"); if (qtProps.qtMajorVersion === 5 && qtProps.qtMinorVersion < 8) { var platformSupportModule = makeQtModuleInfo("QtPlatformSupport", "platformsupport"); libs.push(ProviderUtils.qtLibNameForLinker(platformSupportModule, qtProps, debugBuild)); } if (modInfo.name === "qios") { flags.push("-force_load", FileInfo.joinPaths( qtProps.pluginPath, "platforms", ProviderUtils.qtLibBaseName( modInfo, "libqios", debugBuild, qtProps) + ".a")); } } var prlFilePath = modInfo.isPlugin ? FileInfo.joinPaths(qtProps.pluginPath, modInfo.pluginData.type) : (modInfo.libDir ? modInfo.libDir : qtProps.libraryPath); var libDir = prlFilePath; if (ProviderUtils.qtIsFramework(modInfo, qtProps)) { prlFilePath = FileInfo.joinPaths( prlFilePath, ProviderUtils.qtLibraryBaseName(modInfo, qtProps, false) + ".framework"); libDir = prlFilePath; if (Utilities.versionCompare(qtProps.qtVersion, "5.14") >= 0) { var candidates = [ FileInfo.joinPaths(prlFilePath, "Resources"), // E.g. 5.15.9, 6.8.0/macOS FileInfo.joinPaths(prlFilePath, "Versions/A/Resources") // E.g. 6.8.0/iOS ]; for (i = 0; i < candidates.length; ++i) { if (File.exists(candidates[i])) { prlFilePath = candidates[i]; break; } } } } var baseName = ProviderUtils.qtLibraryBaseName(modInfo, qtProps, debugBuild); if (!qtProps.mkspecName.startsWith("win") && !ProviderUtils.qtIsFramework(modInfo, qtProps)) baseName = "lib" + baseName; prlFilePath = FileInfo.joinPaths(prlFilePath, baseName); var isNonStaticQt4OnWindows = qtProps.mkspecName.startsWith("win") && !modInfo.isStaticLibrary && qtProps.qtMajorVersion < 5; if (isNonStaticQt4OnWindows) prlFilePath = prlFilePath.slice(0, prlFilePath.length - 1); // The prl file base name does *not* contain the version number... // qt for android versions 6.0 and 6.1 don't have the architecture suffix in the prl file if (androidAbi.length > 0 && modInfo.name !== "QtBootstrap" && (modInfo.name !== "QtQmlDevTools" || modInfo.name === "QtQmlDevTools" && Utilities.versionCompare(qtProps.qtVersion, "6.2") >= 0) && (Utilities.versionCompare(qtProps.qtVersion, "6.0") < 0 || Utilities.versionCompare(qtProps.qtVersion, "6.2") >= 0)) { prlFilePath += "_"; prlFilePath += androidAbi; } prlFilePath += ".prl"; try { var prlFile = new TextFile(prlFilePath, TextFile.ReadOnly); while (!prlFile.atEof()) { var line = prlFile.readLine().trim(); var equalsOffset = line.indexOf('='); if (equalsOffset === -1) continue; if (line.startsWith("QMAKE_PRL_TARGET")) { var isMingw = qtProps.mkspecName.startsWith("win") && qtProps.mkspecName.contains("g++"); var isQtVersionBefore56 = qtProps.qtMajorVersion < 5 || (qtProps.qtMajorVersion === 5 && qtProps.qtMinorVersion < 6); // QMAKE_PRL_TARGET has a "lib" prefix, except for mingw. // Of course, the exception has an exception too: For static libs, mingw *does* // have the "lib" prefix. var libFileName = ""; if (isQtVersionBefore56 && qtProps.qtMajorVersion === 5 && isMingw && !modInfo.isStaticLibrary) { libFileName += "lib"; } libFileName += line.slice(equalsOffset + 1).trim(); if (isNonStaticQt4OnWindows) libFileName += 4; // This is *not* part of QMAKE_PRL_TARGET... if (isQtVersionBefore56) { if (qtProps.mkspecName.contains("msvc")) { libFileName += ".lib"; } else if (isMingw) { libFileName += ".a"; if (!File.exists(FileInfo.joinPaths(libDir, libFileName))) libFileName = libFileName.slice(0, -2) + ".dll"; } } libFilePath = FileInfo.joinPaths(libDir, libFileName); continue; } if (line.startsWith("QMAKE_PRL_CONFIG")) { modInfo.config = splitNonEmpty(line.slice(equalsOffset + 1).trim(), ' '); continue; } if (!line.startsWith("QMAKE_PRL_LIBS =")) continue; var parts = extractPaths(line.slice(equalsOffset + 1).trim(), prlFilePath); for (i = 0; i < parts.length; ++i) { var part = parts[i]; part = part.replace("$$[QT_INSTALL_LIBS]", qtProps.libraryPath); part = part.replace("$$[QT_INSTALL_PLUGINS]", qtProps.pluginPath); part = part.replace("$$[QT_INSTALL_PREFIX]", qtProps.installPrefixPath); if (part.startsWith("-l")) { libs.push(part.slice(2)); } else if (part.startsWith("-L")) { modInfo.libraryPaths.push(part.slice(2)); } else if (part.startsWith("-F")) { frameworkPaths.push(part.slice(2)); } else if (part === "-framework") { if (++i < parts.length) frameworks.push(parts[i]); } else if (part === "-pthread") { // prl files for android have QMAKE_PRL_LIBS = -llog -pthread but the pthread // functionality is included in libc. if (androidAbi.length === 0) libs.push("pthread"); } else if (part.startsWith('-')) { // Some other option console.debug("QMAKE_PRL_LIBS contains non-library option '" + part + "' in file '" + prlFilePath + "'"); flags.push(part); } else if (part.startsWith("/LIBPATH:")) { libraryPaths.push(part.slice(9).replace(/\\/g, '/')); } else { // Assume it's a file path/name. libs.push(part.replace(/\\/g, '/')); } } } } catch (e) { // qt_ext_lib_extX.pri (usually) don't have a corresponding prl file. // So the pri file variable QMAKE_LIBS_LIBX points to the library if (modInfo.isExternal) { libFilePath = debugBuild ? modInfo.staticLibrariesDebug[0] : modInfo.staticLibrariesRelease[0]; } if (!libFilePath || !File.exists(libFilePath)) libFilePath = guessLibraryFilePath(prlFilePath, libDir, qtProps); if (nonExistingPrlFiles.contains(prlFilePath)) return; nonExistingPrlFiles.push(prlFilePath); if (modInfo.mustExist) { console.warn("Could not open prl file '" + FileInfo.toNativeSeparators(prlFilePath) + "' for module '" + modInfo.name + "' (" + e + "), and failed to deduce the library file path. " + " This module will likely not be usable by qbs."); } } finally { if (prlFile) prlFile.close(); } if (debugBuild) modInfo.libFilePathDebug = libFilePath; else modInfo.libFilePathRelease = libFilePath; } function setupLibraries(qtModuleInfo, qtProps, nonExistingPrlFiles, androidAbi) { doSetupLibraries(qtModuleInfo, qtProps, true, nonExistingPrlFiles, androidAbi); doSetupLibraries(qtModuleInfo, qtProps, false, nonExistingPrlFiles, androidAbi); } function allQt4Modules(qtProps) { // as per http://doc.qt.io/qt-4.8/modules.html + private stuff. var modules = []; var core = makeQtModuleInfo("QtCore", "core"); core.compilerDefines.push("QT_CORE_LIB"); if (qtProps.qtNameSpace) core.compilerDefines.push("QT_NAMESPACE=" + qtProps.qtNameSpace); modules.push(core, makeQtModuleInfo("QtCore", "core-private", ["core"]), makeQtModuleInfo("QtGui", "gui"), makeQtModuleInfo("QtGui", "gui-private", ["gui"]), makeQtModuleInfo("QtMultimedia", "multimedia", ["gui", "network"]), makeQtModuleInfo("QtMultimedia", "multimedia-private", ["multimedia"]), makeQtModuleInfo("QtNetwork", "network"), makeQtModuleInfo("QtNetwork", "network-private", ["network"]), makeQtModuleInfo("QtOpenGL", "opengl", ["gui"]), makeQtModuleInfo("QtOpenGL", "opengl-private", ["opengl"]), makeQtModuleInfo("QtOpenVG", "openvg", ["gui"]), makeQtModuleInfo("QtScript", "script"), makeQtModuleInfo("QtScript", "script-private", ["script"]), makeQtModuleInfo("QtScriptTools", "scripttools", ["script", "gui"]), makeQtModuleInfo("QtScriptTools", "scripttools-private", ["scripttools"]), makeQtModuleInfo("QtSql", "sql"), makeQtModuleInfo("QtSql", "sql-private", ["sql"]), makeQtModuleInfo("QtSvg", "svg", ["gui"]), makeQtModuleInfo("QtSvg", "svg-private", ["svg"]), makeQtModuleInfo("QtWebKit", "webkit", ["gui", "network"]), makeQtModuleInfo("QtWebKit", "webkit-private", ["webkit"]), makeQtModuleInfo("QtXml", "xml"), makeQtModuleInfo("QtXml", "xml-private", ["xml"]), makeQtModuleInfo("QtXmlPatterns", "xmlpatterns", ["network"]), makeQtModuleInfo("QtXmlPatterns", "xmlpatterns-private", ["xmlpatterns"]), makeQtModuleInfo("QtDeclarative", "declarative", ["gui", "script"]), makeQtModuleInfo("QtDeclarative", "declarative-private", ["declarative"]), makeQtModuleInfo("QtDesigner", "designer", ["gui", "xml"]), makeQtModuleInfo("QtDesigner", "designer-private", ["designer"]), makeQtModuleInfo("QtUiTools", "uitools"), makeQtModuleInfo("QtUiTools", "uitools-private", ["uitools"]), makeQtModuleInfo("QtHelp", "help", ["network", "sql"]), makeQtModuleInfo("QtHelp", "help-private", ["help"]), makeQtModuleInfo("QtTest", "testlib"), makeQtModuleInfo("QtTest", "testlib-private", ["testlib"])); if (qtProps.mkspecName.startsWith("win")) { var axcontainer = makeQtModuleInfo("QAxContainer", "axcontainer"); axcontainer.modulePrefix = "Q"; axcontainer.isStaticLibrary = true; axcontainer.includePaths.push(FileInfo.joinPaths(qtProps.includePath, "ActiveQt")); modules.push(axcontainer); var axserver = makeQtModuleInfo("QAxServer", "axserver"); axserver.modulePrefix = "Q"; axserver.isStaticLibrary = true; axserver.compilerDefines.push("QAXSERVER"); axserver.includePaths.push(FileInfo.joinPaths(qtProps.includePath, "ActiveQt")); modules.push(axserver); } else { modules.push(makeQtModuleInfo("QtDBus", "dbus")); modules.push(makeQtModuleInfo("QtDBus", "dbus-private", ["dbus"])); } var designerComponentsPrivate = makeQtModuleInfo( "QtDesignerComponents", "designercomponents-private", ["gui-private", "designer-private"]); designerComponentsPrivate.hasLibrary = true; modules.push(designerComponentsPrivate); var phonon = makeQtModuleInfo("Phonon", "phonon"); phonon.includePaths = qt4ModuleIncludePaths(phonon, qtProps); modules.push(phonon); // Set up include paths that haven't been set up before this point. for (i = 0; i < modules.length; ++i) { var module = modules[i]; if (module.includePaths.length > 0) continue; module.includePaths = qt4ModuleIncludePaths(module, qtProps); } // Set up compiler defines haven't been set up before this point. for (i = 0; i < modules.length; ++i) { module = modules[i]; if (module.compilerDefines.length > 0) continue; module.compilerDefines.push("QT_" + module.qbsName.toUpperCase() + "_LIB"); } // These are for the convenience of project file authors. It allows them // to add a dependency to e.g. "Qt.widgets" without a version check. var virtualModule = makeQtModuleInfo(undefined, "widgets", ["core", "gui"]); virtualModule.hasLibrary = false; modules.push(virtualModule); virtualModule = makeQtModuleInfo(undefined, "quick", ["declarative"]); virtualModule.hasLibrary = false; modules.push(virtualModule); virtualModule = makeQtModuleInfo(undefined, "concurrent"); virtualModule.hasLibrary = false; modules.push(virtualModule); virtualModule = makeQtModuleInfo(undefined, "printsupport", ["core", "gui"]); virtualModule.hasLibrary = false; modules.push(virtualModule); addTestModule(modules); addDesignerComponentsModule(modules); var modulesThatCanBeDisabled = [ "xmlpatterns", "multimedia", "phonon", "svg", "webkit", "script", "scripttools", "declarative", "gui", "dbus", "opengl", "openvg"]; var nonExistingPrlFiles = []; for (i = 0; i < modules.length; ++i) { module = modules[i]; var name = module.qbsName; var privateIndex = name.indexOf("-private"); if (privateIndex !== -1) name = name.slice(0, privateIndex); if (modulesThatCanBeDisabled.contains(name)) module.mustExist = false; if (qtProps.staticBuild) module.isStaticLibrary = true; setupLibraries(module, qtProps, nonExistingPrlFiles, ""); } replaceQtLibNamesWithFilePath(modules, qtProps); return modules; } function getFileContentsRecursively(filePath) { var file = new TextFile(filePath, TextFile.ReadOnly); var lines = splitNonEmpty(file.readAll(), '\n'); for (var i = 0; i < lines.length; ++i) { var includeString = "include("; var line = lines[i].trim(); if (!line.startsWith(includeString)) continue; var offset = includeString.length; var closingParenPos = line.indexOf(')', offset); if (closingParenPos === -1) { console.warn("Invalid include statement in '" + FileInfo.toNativeSeparators(filePath) + "'"); continue; } var includedFilePath = line.slice(offset, closingParenPos); if (!FileInfo.isAbsolutePath(includedFilePath)) includedFilePath = FileInfo.joinPaths(FileInfo.path(filePath), includedFilePath); var includedContents = getFileContentsRecursively(includedFilePath); var j = i; for (var k = 0; k < includedContents.length; ++k) lines.splice(++j, 0, includedContents[k]); lines.splice(i--, 1); } file.close(); return lines; } function extractPaths(rhs, filePath) { var paths = []; var startIndex = 0; for (;;) { while (startIndex < rhs.length && rhs.charAt(startIndex) === ' ') ++startIndex; if (startIndex >= rhs.length) break; var endIndex; if (rhs.charAt(startIndex) === '"') { ++startIndex; endIndex = rhs.indexOf('"', startIndex); if (endIndex === -1) { console.warn("Unmatched quote in file '" + FileInfo.toNativeSeparators(filePath) + "'"); break; } } else { endIndex = rhs.indexOf(' ', startIndex + 1); if (endIndex === -1) endIndex = rhs.length; } paths.push(FileInfo.cleanPath(rhs.slice(startIndex, endIndex) .replace("$$PWD", FileInfo.path(filePath)))); startIndex = endIndex + 1; } return paths; } function removeDuplicatedDependencyLibs(modules) { var revDeps = {}; var currentPath = []; var getLibraries; var getLibFilePath; function setupReverseDependencies(modules) { var moduleByName = {}; for (var i = 0; i < modules.length; ++i) moduleByName[modules[i].qbsName] = modules[i]; for (i = 0; i < modules.length; ++i) { var module = modules[i]; for (var j = 0; j < module.dependencies.length; ++j) { var depmod = moduleByName[module.dependencies[j]]; if (!depmod) continue; if (!revDeps[depmod.qbsName]) revDeps[depmod.qbsName] = []; revDeps[depmod.qbsName].push(module); } } } function roots(modules) { var result = []; for (i = 0; i < modules.length; ++i) { var module = modules[i] if (module.dependencies.length === 0) result.push(module); } return result; } function traverse(module, libs) { if (currentPath.contains(module)) return; currentPath.push(module); var moduleLibraryLists = getLibraries(module); for (var i = 0; i < moduleLibraryLists.length; ++i) { var modLibList = moduleLibraryLists[i]; for (j = modLibList.length - 1; j >= 0; --j) { if (libs.contains(modLibList[j])) modLibList.splice(j, 1); } } var libFilePath = getLibFilePath(module); if (libFilePath) libs.push(libFilePath); for (i = 0; i < moduleLibraryLists.length; ++i) libs = libs.concat(moduleLibraryLists[i]); libs.sort(); var deps = revDeps[module.qbsName]; for (i = 0; i < (deps || []).length; ++i) traverse(deps[i], libs); currentPath.pop(); } setupReverseDependencies(modules); // Traverse the debug variants of modules. getLibraries = function(module) { return [module.dynamicLibrariesDebug, module.staticLibrariesDebug]; }; getLibFilePath = function(module) { return module.libFilePathDebug; }; var rootModules = roots(modules); for (var i = 0; i < rootModules.length; ++i) traverse(rootModules[i], []); // Traverse the release variants of modules. getLibraries = function(module) { return [module.dynamicLibrariesRelease, module.staticLibrariesRelease]; }; getLibFilePath = function(module) { return module.libFilePathRelease; }; for (i = 0; i < rootModules.length; ++i) traverse(rootModules[i], []); } function allQt5Modules(qtProps, androidAbi) { var nonExistingPrlFiles = []; var modules = []; var modulesDir = FileInfo.joinPaths(qtProps.mkspecBasePath, "modules"); var modulePriFiles = File.directoryEntries(modulesDir, File.Files); for (var i = 0; i < modulePriFiles.length; ++i) { var priFileName = modulePriFiles[i]; var priFilePath = FileInfo.joinPaths(modulesDir, priFileName); var externalFileNamePrefix = "qt_ext_"; var moduleFileNamePrefix = "qt_lib_"; var pluginFileNamePrefix = "qt_plugin_"; var moduleFileNameSuffix = ".pri"; var fileHasExternalPrefix = priFileName.startsWith(externalFileNamePrefix); var fileHasModulePrefix = priFileName.startsWith(moduleFileNamePrefix); var fileHasPluginPrefix = priFileName.startsWith(pluginFileNamePrefix); if (!fileHasPluginPrefix && !fileHasModulePrefix && !fileHasExternalPrefix || !priFileName.endsWith(moduleFileNameSuffix)) { continue; } var moduleInfo = makeQtModuleInfo(); moduleInfo.isPlugin = fileHasPluginPrefix; moduleInfo.isExternal = !moduleInfo.isPlugin && !fileHasModulePrefix; var fileNamePrefix = moduleInfo.isPlugin ? pluginFileNamePrefix : moduleInfo.isExternal ? externalFileNamePrefix : moduleFileNamePrefix; moduleInfo.qbsName = priFileName.slice(fileNamePrefix.length, -moduleFileNameSuffix.length); if (moduleInfo.isPlugin) { moduleInfo.name = moduleInfo.qbsName; moduleInfo.isStaticLibrary = true; } var moduleKeyPrefix = (moduleInfo.isPlugin ? "QT_PLUGIN" : "QT") + '.' + moduleInfo.qbsName + '.'; moduleInfo.qbsName = moduleInfo.qbsName.replace("_private", "-private"); var hasV2 = false; var hasModuleEntry = false; var lines = getFileContentsRecursively(priFilePath); if (moduleInfo.isExternal) { moduleInfo.name = "qt" + moduleInfo.qbsName; moduleInfo.isStaticLibrary = true; for (var k = 0; k < lines.length; ++k) { var extLine = lines[k].trim(); var extFirstEqualsOffset = extLine.indexOf('='); if (extFirstEqualsOffset === -1) continue; var extKey = extLine.slice(0, extFirstEqualsOffset).trim(); var extValue = extLine.slice(extFirstEqualsOffset + 1).trim(); if (!extKey.startsWith("QMAKE_") || !extValue) continue; var elements = extKey.split('_'); if (elements.length >= 3) { if (elements[1] === "LIBS") { extValue = extValue.replace("/home/qt/work/qt/qtbase/lib", qtProps.libraryPath); extValue = extValue.replace("$$[QT_INSTALL_LIBS]", qtProps.libraryPath); extValue = extValue.replace("$$[QT_INSTALL_LIBS/get]", qtProps.libraryPath); if (elements.length === 4 ) { if (elements[3] === androidAbi) { moduleInfo.staticLibrariesRelease.push(extValue); moduleInfo.staticLibrariesDebug.push(extValue); } } else if (elements.length === 5 ) { // That's for "x86_64" var abi = elements[3] + '_' + elements[4]; if (abi === androidAbi) { moduleInfo.staticLibrariesRelease.push(extValue); moduleInfo.staticLibrariesDebug.push(extValue); } } else { moduleInfo.staticLibrariesRelease.push(extValue); moduleInfo.staticLibrariesDebug.push(extValue); } } else if (elements[1] === "INCDIR") { moduleInfo.includePaths.push(extValue.replace("$$[QT_INSTALL_HEADERS]", qtProps.includePath)); } } } moduleInfo.compilerDefines.push("QT_" + moduleInfo.qbsName.toUpperCase() + "_LIB"); moduleInfo.mustExist = false; } else { for (var j = 0; j < lines.length; ++j) { var line = lines[j].trim(); var firstEqualsOffset = line.indexOf('='); if (firstEqualsOffset === -1) continue; var key = line.slice(0, firstEqualsOffset).trim(); var value = line.slice(firstEqualsOffset + 1).trim(); if (!key.startsWith(moduleKeyPrefix) || !value) continue; if (key.endsWith(".name")) { moduleInfo.name = value; } else if (key.endsWith(".module")) { hasModuleEntry = true; } else if (key.endsWith(".depends")) { moduleInfo.dependencies = splitNonEmpty(value, ' '); for (var k = 0; k < moduleInfo.dependencies.length; ++k) { moduleInfo.dependencies[k] = moduleInfo.dependencies[k].replace("_private", "-private"); } } else if (key.endsWith(".module_config")) { var elems = splitNonEmpty(value, ' '); for (k = 0; k < elems.length; ++k) { var elem = elems[k]; if (elem === "no_link") moduleInfo.hasLibrary = false; else if (elem === "staticlib") moduleInfo.isStaticLibrary = true; else if (elem === "internal_module") moduleInfo.isPrivate = true; else if (elem === "v2") hasV2 = true; else if (elem === "lib_bundle") moduleInfo.isFramework = true; } } else if (key.endsWith(".includes")) { moduleInfo.includePaths = extractPaths(value, priFilePath); for (k = 0; k < moduleInfo.includePaths.length; ++k) { moduleInfo.includePaths[k] = moduleInfo.includePaths[k] .replace("$$QT_MODULE_INCLUDE_BASE", qtProps.includePath) .replace("$$QT_MODULE_HOST_LIB_BASE", qtProps.hostLibraryPath) .replace("$$QT_MODULE_LIB_BASE", qtProps.libraryPath); } } else if (key.endsWith(".libs")) { var libDirs = extractPaths(value, priFilePath); if (libDirs.length === 1) { moduleInfo.libDir = libDirs[0] .replace("$$QT_MODULE_HOST_LIB_BASE", qtProps.hostLibraryPath) .replace("$$QT_MODULE_LIB_BASE", qtProps.libraryPath); } else { moduleInfo.libDir = qtProps.libraryPath; } } else if (key.endsWith(".DEFINES")) { moduleInfo.compilerDefines = splitNonEmpty(value, ' '); } else if (key.endsWith(".VERSION")) { moduleInfo.version = value; } else if (key.endsWith(".plugin_types")) { moduleInfo.supportedPluginTypes = splitNonEmpty(value, ' '); } else if (key.endsWith(".TYPE")) { moduleInfo.pluginData.type = value; } else if (key.endsWith(".EXTENDS")) { moduleInfo.pluginData["extends"] = splitNonEmpty(value, ' '); for (k = 0; k < moduleInfo.pluginData["extends"].length; ++k) { if (moduleInfo.pluginData["extends"][k] === "-") { moduleInfo.pluginData["extends"].splice(k, 1); moduleInfo.pluginData.autoLoad = false; break; } } } else if (key.endsWith(".CLASS_NAME")) { moduleInfo.pluginData.className = value; } } } if (hasV2 && !hasModuleEntry && !moduleInfo.isStaticLibrary) moduleInfo.hasLibrary = false; // Fix include paths for Apple frameworks. // The qt_lib_XXX.pri files contain wrong values for versions < 5.6. if (!hasV2 && ProviderUtils.qtIsFramework(moduleInfo, qtProps)) { moduleInfo.includePaths = []; var baseIncDir = frameworkHeadersPath(moduleInfo, qtProps); if (moduleInfo.isPrivate) { baseIncDir = FileInfo.joinPaths(baseIncDir, moduleInfo.version); moduleInfo.includePaths.push(baseIncDir, FileInfo.joinPaths(baseIncDir, moduleInfo.name)); } else { moduleInfo.includePaths.push(baseIncDir); } } setupLibraries(moduleInfo, qtProps, nonExistingPrlFiles, androidAbi); modules.push(moduleInfo); if (moduleInfo.qbsName === "testlib") addTestModule(modules); if (moduleInfo.qbsName === "designercomponents-private") addDesignerComponentsModule(modules); } replaceQtLibNamesWithFilePath(modules, qtProps); removeDuplicatedDependencyLibs(modules); return modules; } function getQtInfo(qmakeFilePath) { if (!File.exists(qmakeFilePath)) { throw "The specified qmake file path '" + FileInfo.toNativeSeparators(qmakeFilePath) + "' does not exist."; } var qtProps = getQtProperties(qmakeFilePath); var androidAbis = []; if (qtProps.androidAbis !== undefined) { // Multiple androidAbis detected: Qt >= 5.14 androidAbis = qtProps.androidAbis; } else { // Single abi detected: Qt < 5.14 androidAbis.push(''); } if (androidAbis.length > 1) console.info("Qt with multiple abi detected: '" + androidAbis + "'"); var result = {}; result.qtProps = qtProps; result.abiInfos = []; result.qmakeFilePath = qmakeFilePath; for (a = 0; a < androidAbis.length; ++a) { var abiInfo = {}; if (androidAbis.length > 1) console.info("Found abi '" + androidAbis[a] + "'..."); abiInfo.androidAbi = androidAbis[a]; var allModules = qtProps.qtMajorVersion < 5 ? allQt4Modules(qtProps) : allQt5Modules(qtProps, androidAbis[a]);; abiInfo.modules = {}; for (var i = 0; i < allModules.length; ++i) { var module = allModules[i]; abiInfo.modules[module.qbsName] = module; } abiInfo.pluginsByType = {}; abiInfo.nonEssentialPlugins = []; for (var moduleName in abiInfo.modules) { var m = abiInfo.modules[moduleName]; if (m.isPlugin) { if (!abiInfo.pluginsByType[m.pluginData.type]) abiInfo.pluginsByType[m.pluginData.type] = []; abiInfo.pluginsByType[m.pluginData.type].push(m.name); if (!m.pluginData.autoLoad) abiInfo.nonEssentialPlugins.push(m.name); } } result.abiInfos.push(abiInfo); } return result; } function configure(qmakeFilePaths) { var result = []; qmakeFilePaths = getQmakeFilePaths(qmakeFilePaths); if (!qmakeFilePaths || qmakeFilePaths.length === 0) return result; for (var i = 0; i < qmakeFilePaths.length; ++i) { var qtInfo = {}; try { console.info("Getting info about Qt at '" + FileInfo.toNativeSeparators(qmakeFilePaths[i]) + "'..."); qtInfo = getQtInfo(qmakeFilePaths[i]); result.push(qtInfo); } catch (e) { console.warn("Error getting info about Qt for '" + FileInfo.toNativeSeparators(qmakeFilePaths[i]) + "': " + e); throw e; } } return result; } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/FrameworkProbe.qbs0000644000175100017510000000342115154533055023541 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ PathProbe { platformSearchPaths: (qbs.sysroot ? [qbs.sysroot + "/System/Library/Frameworks"] : []).concat([ "~/Library/Frameworks", "/usr/local/lib", "/Library/Frameworks", "/System/Library/Frameworks" ]) nameSuffixes: ".framework" } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/IcoUtilsVersionProbe.qbs0000644000175100017510000000335415154533055024712 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import "../../../modules/ico/ico.js" as IcoUtils Probe { // Inputs property string toolFilePath // Outputs property var version configure: { version = IcoUtils.findIcoUtilsVersion(toolFilePath); found = !!version; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/JdkVersionProbe.qbs0000644000175100017510000000333615154533055023667 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import "../../../modules/java/utils.js" as JavaUtils Probe { // Inputs property string javac // Outputs property var version configure: { version = JavaUtils.findJdkVersion(javac); found = !!version; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/PkgConfigProbe.qbs0000644000175100017510000001365715154533055023467 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Host import qbs.Process import qbs.FileInfo Probe { // Inputs property string sysroot: qbs.sysroot property string executable: 'pkg-config' property string name property stringList packageNames: [name] property string minVersion property string exactVersion property string maxVersion property bool forStaticBuild: false property stringList libDirs // Full, non-sysrooted paths, mirroring the environment variable // Output property stringList cflags // Unmodified --cflags output property stringList libs // Unmodified --libs output property stringList defines property stringList libraries property stringList libraryPaths property stringList includePaths property stringList compilerFlags property stringList linkerFlags property string modversion configure: { if (!packageNames || packageNames.length === 0) throw 'PkgConfigProbe.packageNames must be specified.'; var p = new Process(); var stdout; try { var libDirsToSet = libDirs; if (sysroot) { p.setEnv("PKG_CONFIG_SYSROOT_DIR", sysroot); if (!libDirsToSet) { libDirsToSet = [ sysroot + "/usr/lib/pkgconfig", sysroot + "/usr/share/pkgconfig" ]; } } if (libDirsToSet) p.setEnv("PKG_CONFIG_LIBDIR", libDirsToSet.join(FileInfo.pathListSeparator())); var versionArgs = []; if (minVersion !== undefined) versionArgs.push("--atleast-version=" + minVersion); if (exactVersion !== undefined) versionArgs.push("--exact-version=" + exactVersion); if (maxVersion !== undefined) versionArgs.push("--max-version=" + maxVersion); if (versionArgs.length !== 0 && p.exec(executable, versionArgs.concat(packageNames)) !== 0) { return; } // protobuf is reserved as qbs module name, which depends on the protobuflib module packageNames = packageNames.map(function(name) { return name === "protobuflib" ? "protobuf" : name; }); var args = packageNames; if (p.exec(executable, args.concat([ '--cflags' ])) === 0) { stdout = p.readStdOut().trim(); cflags = stdout ? stdout.split(/\s/): []; var libsArgs = args.concat("--libs"); if (forStaticBuild) libsArgs.push("--static"); if (p.exec(executable, libsArgs) === 0) { stdout = p.readStdOut().trim(); libs = stdout ? stdout.split(/\s/): []; if (p.exec(executable, [packageNames[0]].concat([ '--modversion' ])) === 0) { modversion = p.readStdOut().trim(); found = true; includePaths = []; defines = [] compilerFlags = []; for (var i = 0; i < cflags.length; ++i) { var flag = cflags[i]; if (flag.startsWith("-I")) includePaths.push(flag.slice(2)); else if (flag.startsWith("-D")) defines.push(flag.slice(2)); else compilerFlags.push(flag); } libraries = []; libraryPaths = []; linkerFlags = []; for (i = 0; i < libs.length; ++i) { flag = libs[i]; if (flag.startsWith("-l")) libraries.push(flag.slice(2)); else if (flag.startsWith("-L")) libraryPaths.push(flag.slice(2)); else linkerFlags.push(flag); } console.debug("PkgConfigProbe: found packages " + packageNames); return; } } } found = false; cflags = undefined; libs = undefined; } finally { p.close(); } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/XcodeProbe.qbs0000644000175100017510000001034515154533055022651 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.Process import qbs.PropertyList import "../../../modules/xcode/xcode.js" as Xcode Probe { // Inputs property string sdksPath property string developerPath property string xcodebuildPath property stringList targetOS: qbs.targetOS property string platformType property string platformPath property string devicePlatformPath property string _xcodeInfoPlist: FileInfo.joinPaths(developerPath, "..", "Info.plist") // Outputs property var architectureSettings property var availableSdks property var platformSettings property string xcodeVersion configure: { if (File.exists(_xcodeInfoPlist)) { // Optimized case (no forking): reads CFBundleShortVersionString from // Xcode.app/Contents/Info.plist var propertyList = new PropertyList(); try { propertyList.readFromFile(_xcodeInfoPlist); var plist = propertyList.toObject(); if (plist) xcodeVersion = plist["CFBundleShortVersionString"]; } finally { propertyList.clear(); } } else { // Fallback case: execute xcodebuild -version if Xcode.app/Contents/Info.plist is // missing; this can happen if developerPath is /, for example var process; try { process = new Process(); process.exec(xcodebuildPath, ["-version"], true); var lines = process.readStdOut().trim().split(/\r?\n/g).filter(function (line) { return line.length > 0; }); for (var l = 0; l < lines.length; ++l) { var m = lines[l].match(/^Xcode ([0-9\.]+)$/); if (m) { xcodeVersion = m[1]; break; } } } finally { process.close(); } } architectureSettings = {}; var archSpecsPath = Xcode.archsSpecsPath(xcodeVersion, targetOS, platformType, platformPath, devicePlatformPath, developerPath); var archSpecsReader = new Xcode.XcodeArchSpecsReader(archSpecsPath); archSpecsReader.getArchitectureSettings().map(function (setting) { var val = archSpecsReader.getArchitectureSettingValue(setting); if (val) architectureSettings[setting] = val; }); availableSdks = Xcode.sdkInfoList(sdksPath); var platformInfoPlist = FileInfo.joinPaths(platformPath, "Info.plist"); platformSettings = Xcode.platformInfo(platformInfoPlist); found = !!xcodeVersion; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/ConanfileProbe.qbs0000644000175100017510000001414415154533055023506 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Richard Weickelt ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Process import qbs.File import qbs.FileInfo import qbs.TextFile import qbs.Utilities Probe { // Inputs property stringList additionalArguments: [] property path conanfilePath property path packageReference property path executable: "conan" + FileInfo.executableSuffix() property stringList generators property var options property var settings property string profileAll property bool verbose: false // Output property path generatedFilesPath property var dependencies property var json // Internal // Ensure that the probe is re-run automatically whenever conanfile changes // by making a file system property part of the probe's signature. property int _conanfileLastModified: conanfilePath ? File.lastModified(conanfilePath) : 0 property path _projectBuildDirectory: project.buildDirectory configure: { if (conanfilePath && packageReference) throw("conanfilePath and packageReference must not be defined at the same time."); if (!conanfilePath && !packageReference) throw("Either conanfilePath or packageReference must be defined."); var reference = packageReference || FileInfo.cleanPath(conanfilePath); console.info("Probing '" + reference + "'. This might take a while..."); if (conanfilePath && !File.exists(reference)) throw("The conanfile '" + reference + "' does not exist."); function getConanVersion() { var p = new Process(); p.exec(executable, ["--version"], true); return p.readStdOut().trim().replace("Conan version", "").trim(); } const isConan2 = Utilities.versionCompare(getConanVersion(), "2.0.0") >= 0; var args = [ "install", reference, ]; if (options) { if (typeof options !== "object") throw("The property 'options' must be an object."); Object.keys(options).forEach(function(key,index) { args.push("-o"); args.push(key + "=" + options[key]); }); } if (settings) { if (typeof settings !== "object") throw("The property 'settings' must be an object."); Object.keys(settings).forEach(function(key,index) { args.push("-s"); args.push(key + "=" + settings[key]); }); } if (generators === undefined) { if (isConan2) generators = ["QbsDeps"]; else generators = ["json"]; } if (!isConan2 && !generators.contains("json")) generators.push("json"); for (var i = 0; i < generators.length; i++) args = args.concat(["-g", generators[i]]); for (var i = 0; i < additionalArguments.length; i++) args.push(additionalArguments[i]); generatedFilesPath = FileInfo.cleanPath(_projectBuildDirectory + "/genconan/" + Utilities.getHash(args.join())); const outputFolderOption = isConan2 ? "--output-folder" : "--install-folder"; args = args.concat([outputFolderOption, generatedFilesPath]); var p = new Process(); p.start(executable, args); while (!p.waitForFinished(500)) { const output = isConan2 ? p.readStdErr() : p.readStdOut(); if (verbose && output) { console.info(output); } } while (!p.atEnd()) { const output = isConan2 ? p.readStdErr() : p.readStdOut(); if (verbose && output) { console.info(output); } } if (p.exitCode()) { const errorOutput = p.readStdErr(); p.close(); throw errorOutput; } const output = isConan2 ? p.readStdErr() : p.readStdOut(); if (verbose && output) { console.info(output); } p.close(); if (!isConan2 && generators.contains("json")) { if (!File.exists(generatedFilesPath + "/conanbuildinfo.json")) throw("No conanbuildinfo.json has been generated."); var jsonFile = new TextFile(generatedFilesPath + "/conanbuildinfo.json", TextFile.ReadOnly); json = JSON.parse(jsonFile.readAll()); jsonFile.close(); dependencies = {}; for (var i = 0; i < json.dependencies.length; ++i) { var dep = json.dependencies[i]; dependencies[dep.name] = dep; } } found = true; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/PathProbe.qbs0000644000175100017510000000553615154533055022511 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import "path-probe.js" as PathProbeConfigure import qbs.Host import qbs.ModUtils Probe { // Inputs property stringList names property stringList nameSuffixes property var nameFilter property var candidateFilter property varList selectors property pathList searchPaths property stringList pathSuffixes property pathList platformSearchPaths: Host.os().contains("unix") ? ['/usr', '/usr/local'] : [] property stringList environmentPaths property stringList platformEnvironmentPaths // Output property stringList candidatePaths property string path property string filePath property string fileName property varList allResults configure: { var results = PathProbeConfigure.configure(selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths, pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths); found = results.found; allResults = results.files; if (allResults.length === 1) { var result = allResults[0]; candidatePaths = result.candidatePaths; path = result.path; filePath = result.filePath; fileName = result.fileName; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/SdccProbe.qbs0000644000175100017510000000613215154533055022462 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import "../../../modules/cpp/sdcc.js" as SDCC PathProbe { // Inputs property string compilerFilePath property stringList enableDefinesByLanguage property string preferredArchitecture // Outputs property string architecture property string endianness property int versionMajor property int versionMinor property int versionPatch property stringList includePaths property var compilerDefinesByLanguage configure: { compilerDefinesByLanguage = {}; if (!File.exists(compilerFilePath)) { found = false; return; } var languages = enableDefinesByLanguage; if (!languages || languages.length === 0) languages = ["c"]; // SDCC compiler support only the C-language. if (!languages.contains("c")) { found = false; return; } var macros = SDCC.dumpMacros(compilerFilePath, preferredArchitecture); if (!macros) { found = false; return; } compilerDefinesByLanguage["c"] = macros; architecture = SDCC.guessArchitecture(macros); endianness = SDCC.guessEndianness(macros); var defaultPaths = SDCC.dumpDefaultPaths(compilerFilePath, architecture); includePaths = defaultPaths.includePaths; var version = SDCC.guessVersion(macros); if (version) { versionMajor = version.major; versionMinor = version.minor; versionPatch = version.patch; found = !!architecture && !!endianness; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/CosmicProbe.qbs0000644000175100017510000000610115154533055023017 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import "../../../modules/cpp/cosmic.js" as COSMIC PathProbe { // Inputs property string compilerFilePath property stringList enableDefinesByLanguage // Outputs property string architecture property string endianness property int versionMajor property int versionMinor property int versionPatch property stringList includePaths property var compilerDefinesByLanguage configure: { compilerDefinesByLanguage = {}; if (!File.exists(compilerFilePath)) { found = false; return; } var languages = enableDefinesByLanguage; if (!languages || languages.length === 0) languages = ["c"]; // COSMIC compiler support only the C-language. if (!languages.contains("c")) { found = false; return; } var macros = COSMIC.dumpMacros(compilerFilePath); if (!macros) { found = false; return; } compilerDefinesByLanguage["c"] = macros; architecture = COSMIC.guessArchitecture(compilerFilePath); endianness = COSMIC.guessEndianness(architecture); var defaultPaths = COSMIC.dumpDefaultPaths(compilerFilePath, architecture); includePaths = defaultPaths.includePaths; var version = COSMIC.dumpVersion(compilerFilePath); if (version) { versionMajor = version.major; versionMinor = version.minor; versionPatch = version.patch; found = !!architecture && !!endianness; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/LibraryProbe.qbs0000644000175100017510000000635715154533055023223 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.PathTools PathProbe { property string endianness nameSuffixes: PathTools.librarySuffixes(qbs.targetOS, ["shared", "static"], true) platformSearchPaths: { var result = []; if (qbs.targetOS.contains("unix")) { if (qbs.targetOS.contains("linux") && qbs.architecture) { if (qbs.architecture === "armv7") result = ["/usr/lib/arm-linux-gnueabihf"] else if (qbs.architecture === "arm64") result = ["/usr/lib/aarch64-linux-gnu"] else if (qbs.architecture === "mips" && endianness === "big") result = ["/usr/lib/mips-linux-gnu"] else if (qbs.architecture === "mips" && endianness === "little") result = ["/usr/lib/mipsel-linux-gnu"] else if (qbs.architecture === "mips64") result = ["/usr/lib/mips64el-linux-gnuabi64"] else if (qbs.architecture === "ppc") result = ["/usr/lib/powerpc-linux-gnu"] else if (qbs.architecture === "ppc64") result = ["/usr/lib/powerpc64le-linux-gnu"] else if (qbs.architecture === "x86_64") result = ["/usr/lib64", "/usr/lib/x86_64-linux-gnu"] else if (qbs.architecture === "x86") result = ["/usr/lib32", "/usr/lib/i386-linux-gnu"] } result = result.concat(["/usr/lib", "/usr/local/lib", "/lib", "/app/lib"]); } return result; } nameFilter: PathTools.libraryNameFilter() platformEnvironmentPaths: { if (qbs.targetOS.contains("windows")) return [ "PATH" ]; else return [ "LIBRARY_PATH" ]; } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/WatcomProbe.qbs0000644000175100017510000000716415154533055023046 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2022 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.Host import qbs.ModUtils import "../../../modules/cpp/watcom.js" as WATCOM PathProbe { // Inputs property string compilerFilePath property stringList enableDefinesByLanguage property string _pathListSeparator property string _toolchainInstallPath property string _targetPlatform property string _targetArchitecture // Outputs property string architecture property string endianness property string targetPlatform property int versionMajor property int versionMinor property int versionPatch property stringList includePaths property var compilerDefinesByLanguage property var environment configure: { compilerDefinesByLanguage = {}; if (!File.exists(compilerFilePath)) { found = false; return; } var languages = enableDefinesByLanguage; if (!languages || languages.length === 0) languages = ["c"]; environment = WATCOM.guessEnvironment(Host.os(), _targetPlatform, _targetArchitecture, _toolchainInstallPath, _pathListSeparator); includePaths = environment["INCLUDE"].split(_pathListSeparator).filter(function(path) { return File.exists(path); }); for (var i = 0; i < languages.length; ++i) { var tag = languages[i]; compilerDefinesByLanguage[tag] = WATCOM.dumpMacros( environment, compilerFilePath, _targetPlatform, _targetArchitecture, tag); } var macros = compilerDefinesByLanguage["c"] || compilerDefinesByLanguage["cpp"]; endianness = macros["__BIG_ENDIAN"] ? "big" : "little"; architecture = ModUtils.guessArchitecture(macros); targetPlatform = ModUtils.guessTargetPlatform(macros); var version = WATCOM.guessVersion(macros); if (version) { versionMajor = version.major; versionMinor = version.minor; versionPatch = version.patch; found = !!architecture && !!targetPlatform; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/MsvcProbe.qbs0000644000175100017510000001012315154533055022511 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.ModUtils import qbs.Utilities PathProbe { // Inputs property string compilerFilePath property stringList enableDefinesByLanguage property string preferredArchitecture property string winSdkVersion // Outputs property string architecture property int versionMajor property int versionMinor property int versionPatch property stringList includePaths property string modulesPath property var buildEnv property var compilerDefinesByLanguage configure: { var languages = enableDefinesByLanguage; if (!languages || languages.length === 0) languages = ["c"]; var info = languages.contains("c") ? Utilities.msvcCompilerInfo(compilerFilePath, "c", winSdkVersion) : {}; var infoCpp = languages.contains("cpp") ? Utilities.msvcCompilerInfo(compilerFilePath, "cpp", winSdkVersion) : {}; found = (!languages.contains("c") || (!!info && !!info.macros && !!info.buildEnvironment)) && (!languages.contains("cpp") || (!!infoCpp && !!infoCpp.macros && !!infoCpp.buildEnvironment)); compilerDefinesByLanguage = { "c": info.macros, "cpp": infoCpp.macros, }; var macros = info.macros || infoCpp.macros; architecture = ModUtils.guessArchitecture(macros); var ver = macros["_MSC_FULL_VER"]; versionMajor = parseInt(ver.substr(0, 2), 10); versionMinor = parseInt(ver.substr(2, 2), 10); versionPatch = parseInt(ver.substr(4), 10); buildEnv = info.buildEnvironment || infoCpp.buildEnvironment; var clParentDir = FileInfo.joinPaths(FileInfo.path(compilerFilePath), ".."); var inclPath = FileInfo.joinPaths(clParentDir, "INCLUDE"); if (!File.exists(inclPath)) inclPath = FileInfo.joinPaths(clParentDir, "..", "INCLUDE"); if (!File.exists(inclPath)) inclPath = FileInfo.joinPaths(clParentDir, "..", "..", "INCLUDE"); if (File.exists(inclPath)) includePaths = [inclPath]; var modsPath = FileInfo.joinPaths(clParentDir, "..", "..", "modules"); if (File.exists(modsPath)) modulesPath = modsPath; if (preferredArchitecture && Utilities.canonicalArchitecture(preferredArchitecture) !== Utilities.canonicalArchitecture(architecture)) { throw "'" + preferredArchitecture + "' differs from the architecture produced by this compiler (" + architecture + ")"; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/InnoSetupProbe.qbs0000644000175100017510000000457615154533055023544 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Utilities PathProbe { // Outputs property var version configure: { var keys = [ "HKEY_LOCAL_MACHINE\\SOFTWARE\\", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\" ]; var keySuffixes = [ "Microsoft\\Windows\\CurrentVersion\\Uninstall\\Inno Setup 5_is1", "Microsoft\\Windows\\CurrentVersion\\Uninstall\\Inno Setup 6_is1" ]; for (var i = 0; i < keys.length; ++i) { for (var j = 0; j < keySuffixes.length; ++j) { var key = keys[i] + keySuffixes[j]; var v = Utilities.getNativeSetting(key, "DisplayVersion"); if (v) { path = Utilities.getNativeSetting(key, "InstallLocation"); version = v; found = path && version; return; } } } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/GccVersionProbe.qbs0000644000175100017510000000504615154533055023653 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.Host import "../../../modules/cpp/gcc.js" as Gcc PathProbe { // Inputs property string compilerFilePath property var environment property stringList _toolchain: qbs.toolchain // Outputs property int versionMajor property int versionMinor property int versionPatch configure: { if (!File.exists(compilerFilePath)) { found = false; return; } var macros = Gcc.dumpMacros(environment, compilerFilePath, undefined, Host.nullDevice()); if (_toolchain.contains("clang")) { versionMajor = parseInt(macros["__clang_major__"], 10); versionMinor = parseInt(macros["__clang_minor__"], 10); versionPatch = parseInt(macros["__clang_patchlevel__"], 10); found = true; } else { versionMajor = parseInt(macros["__GNUC__"], 10); versionMinor = parseInt(macros["__GNUC_MINOR__"], 10); versionPatch = parseInt(macros["__GNUC_PATCHLEVEL__"], 10); found = true; } } } qbs-src-3.2.0/share/qbs/imports/qbs/Probes/AndroidSdkProbe.qbs0000644000175100017510000000577015154533055023637 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Environment import qbs.File import qbs.FileInfo import qbs.Host import "../../../modules/Android/sdk/utils.js" as SdkUtils import "../../../modules/Android/android-utils.js" as AndroidUtils PathProbe { environmentPaths: Environment.getEnv("ANDROID_HOME") platformSearchPaths: { if (Host.os().contains("windows")) return [FileInfo.joinPaths(Environment.getEnv("LOCALAPPDATA"), "Android", "sdk")]; if (Host.os().contains("macos")) return [FileInfo.joinPaths(Environment.getEnv("HOME"), "Library", "Android", "sdk")]; if (Host.os().contains("linux")) return [FileInfo.joinPaths(Environment.getEnv("HOME"), "Android", "Sdk")]; } // Outputs property stringList candidatePaths property var buildToolsVersions property string buildToolsVersion property var platforms property string platform configure: { var i, allPaths = (environmentPaths || []).concat(platformSearchPaths || []); candidatePaths = allPaths; for (i in allPaths) { if (File.exists(FileInfo.joinPaths(allPaths[i], "build-tools"))) { path = allPaths[i]; buildToolsVersions = SdkUtils.availableBuildToolsVersions(path) buildToolsVersion = buildToolsVersions[buildToolsVersions.length - 1]; platforms = AndroidUtils.availablePlatforms(path) platform = platforms[platforms.length - 1]; found = true; return; } } } } qbs-src-3.2.0/share/qbs/module-providers/0000755000175100017510000000000015154533055017671 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/module-providers/conan.qbs0000644000175100017510000000036115154533055021476 0ustar runnerrunnerimport "conan.js" as ConanHelper ModuleProvider { /* input */ property path installDirectory isEager: false relativeSearchPaths: { return ConanHelper.configure(installDirectory, moduleName, outputBaseDir); } } qbs-src-3.2.0/share/qbs/module-providers/qbspkgconfig.qbs0000644000175100017510000002123615154533055023061 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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$ ** ****************************************************************************/ import qbs.Environment import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.PkgConfig import qbs.ProviderUtils import qbs.Probes import qbs.Process import qbs.TextFile import "Qt/setup-qt.js" as SetupQt ModuleProvider { property stringList executableNames: ["pkgconf", "pkg-config"] property string executableFilePath: pkgConfigProbe.filePath property stringList extraPaths property stringList libDirs property bool staticMode: false property bool definePrefix: Host.os().includes("windows") // We take the sysroot default from qbs.sysroot, except for Xcode toolchains, where // the sysroot points into the Xcode installation and does not contain .pc files. property path sysroot: qbs.toolchain && qbs.toolchain.includes("xcode") ? undefined : qbs.sysroot Probes.BinaryProbe { id: pkgConfigProbe condition: !executableFilePath names: executableNames } Probes.QbsPkgConfigProbe { id: theProbe _executableFilePath: executableFilePath _extraPaths: extraPaths _sysroot: sysroot _libDirs: libDirs _staticMode: staticMode _definePrefix: definePrefix } Probes.QmakeProbe { id: qmakeProbe condition: moduleName.startsWith("Qt") && theProbe.qmakePaths qmakePaths: theProbe.qmakePaths } isEager: false relativeSearchPaths: { function getModuleInfo(pkg, staticMode) { var result = {}; var mapper = function(flag) { return flag.value; } var typeFilter = function(type) { return function(flag) { return flag.type === type; } } function getLibsInfo(libs) { var result = {}; result.dynamicLibraries = libs.filter(typeFilter(PkgConfig.LibraryName)).map(mapper); result.staticLibraries = libs.filter(typeFilter(PkgConfig.StaticLibraryName)).map(mapper); result.libraryPaths = libs.filter(typeFilter(PkgConfig.LibraryPath)).map(mapper); result.frameworks = libs.filter(typeFilter(PkgConfig.Framework)).map(mapper); result.frameworkPaths = libs.filter(typeFilter(PkgConfig.FrameworkPath)).map(mapper); result.driverLinkerFlags = libs.filter(typeFilter(PkgConfig.LinkerFlag)).map(mapper); return result; } result.version = pkg.version; result.includePaths = pkg.cflags.filter(typeFilter(PkgConfig.IncludePath)).map(mapper); result.systemIncludePaths = pkg.cflags.filter(typeFilter(PkgConfig.SystemIncludePath)).map(mapper); result.defines = pkg.cflags.filter(typeFilter(PkgConfig.Define)).map(mapper); result.commonCompilerFlags = pkg.cflags.filter(typeFilter(PkgConfig.CompilerFlag)).map(mapper); var allLibs = pkg.libs; if (staticMode) allLibs = allLibs.concat(pkg.libsPrivate); var libsInfo = getLibsInfo(allLibs); for (var key in libsInfo) { result[key] = libsInfo[key]; } return result; } function getModuleDependencies(pkg, staticMode) { var mapper = function(p) { var result = {}; for (var key in p) result[key] = p[key]; result.name = ProviderUtils.pkgConfigToModuleName(result.name); return result; } var result = pkg.requires.map(mapper); if (staticMode) result = result.concat(pkg.requiresPrivate.map(mapper)); return result; } console.debug("Running pkgconfig provider for " + moduleName + "."); var outputDir = FileInfo.joinPaths(outputBaseDir, "modules"); File.makePath(outputDir); var moduleMapping = { "protobuf": "protobuflib" } var reverseMapping = {} for (var key in moduleMapping) reverseMapping[moduleMapping[key]] = key if (moduleName.startsWith("Qt")) { function setupQt(packageName, qtInfos) { if (qtInfos === undefined || qtInfos.length === 0) return []; var qtProviderDir = FileInfo.joinPaths(path, "Qt"); return SetupQt.doSetup(packageName, qtInfos, outputBaseDir, qtProviderDir); } if (!sysroot) { return setupQt(moduleName, qmakeProbe.qtInfos); } return []; } var pkg; pkg = theProbe.packages[reverseMapping[moduleName]]; if (pkg === undefined) pkg = theProbe.packagesByModuleName[moduleName]; if (pkg === undefined) return []; if (pkg.isBroken) { console.warn("Failed to load " + moduleName + " as it's pkg-config package is broken"); return []; } var moduleInfo = getModuleInfo(pkg, staticMode); var deps = getModuleDependencies(pkg, staticMode); var moduleDir = FileInfo.joinPaths(outputDir, moduleName); File.makePath(moduleDir); var module = new TextFile(FileInfo.joinPaths(moduleDir, "module.qbs"), TextFile.WriteOnly); module.writeLine("Module {"); module.writeLine(" version: " + ModUtils.toJSLiteral(moduleInfo.version)); module.writeLine(" Depends { name: 'cpp' }"); deps.forEach(function(dep) { var depName = ProviderUtils.pkgConfigToModuleName( moduleMapping[dep.name] ? moduleMapping[dep.name] : dep.name); module.write(" Depends { name: '" + depName + "'"); for (var k in dep) { if (k === "name") continue; module.write("; " + k + ": " + ModUtils.toJSLiteral(dep[k])); } module.writeLine(" }"); }) function writeProperty(propertyName) { var value = moduleInfo[propertyName]; if (value.length !== 0) { // skip empty props for simplicity of the module file module.writeLine( " cpp." + propertyName + ":" + ModUtils.toJSLiteral(value)); } } writeProperty("includePaths"); writeProperty("systemIncludePaths"); writeProperty("defines"); writeProperty("commonCompilerFlags"); writeProperty("dynamicLibraries"); writeProperty("staticLibraries"); writeProperty("libraryPaths"); writeProperty("frameworks"); writeProperty("frameworkPaths"); writeProperty("driverLinkerFlags"); module.writeLine("}"); module.close(); return ""; } } qbs-src-3.2.0/share/qbs/module-providers/conan.js0000644000175100017510000002323015154533055021325 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Kai Dohmen ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com). ** 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$ ** ****************************************************************************/ var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var PathProbe = require("../imports/qbs/Probes/path-probe.js") var PathTools = require("qbs.PathTools"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); const architectureMap = { 'x86': 'x86', 'x86_64': 'x86_64', 'ppc32be': 'ppc', 'ppc32': 'ppc', 'ppc64le': 'ppc64', 'ppc64': 'ppc64', 'armv4': 'arm', 'armv4i': 'arm', 'armv5el': 'arm', 'armv5hf': 'arm', 'armv6': 'arm', 'armv7': 'arm', 'armv7hf': 'arm', 'armv7s': 'arm', 'armv7k': 'arm', 'armv8': 'arm64', 'armv8_32': 'arm64', 'armv8.3': 'arm64', 'sparc': 'sparc', 'sparcv9': 'sparc64', 'mips': 'mips', 'mips64': 'mips64', 'avr': 'avr', 's390': 's390x', 's390x': 's390x', 'sh4le': 'sh' } const platformMap = { 'Windows': 'windows', 'WindowsStore': 'windows', 'WindowsCE': 'windows', 'Linux': 'linux', 'Macos': 'macos', 'Android': 'android', 'iOS': 'ios', 'watchOS': 'watchos', 'tvOS': 'tvos', 'FreeBSD': 'freebsd', 'SunOS': 'solaris', 'AIX': 'aix', 'Emscripten': undefined, 'Arduino': 'none', 'Neutrino': 'qnx', 'VxWorks': 'vxworks', } function findLibs(libnames, libdirs, libtypes, targetOS, forImport) { var result = []; if (libnames === null || libdirs === null) return result; libnames.forEach(function(libraryName) { const suffixes = PathTools.librarySuffixes(targetOS, libtypes, forImport); const lib = PathProbe.configure( undefined, // selectors [libraryName], suffixes, PathTools.libraryNameFilter(), undefined, // candidateFilter libdirs, // searchPaths undefined, // pathSuffixes [], // platformSearchPaths undefined, // environmentPaths undefined // platformEnvironmentPaths ); if (lib.found) result.push(lib.files[0].filePath); }); return result; } function getLibraryTypes(options) { if (options !== undefined && options !== null) { if (options.shared === undefined) return ["shared", "static"]; else if (options.shared === "True") return ["shared"]; else if (options.shared === "False") return ["static"]; } return ["shared", "static"]; } function configure(installDirectory, moduleName, outputBaseDir, jsonProbe) { if (!installDirectory || installDirectory.trim() === "") throw "Conan install directory is not set. Please define moduleProviders.conan.installDirectory in your product."; const depsDir = FileInfo.joinPaths(installDirectory, "conan-qbs-deps"); if (!File.exists(depsDir)) throw "The directory '" + depsDir + "' does not exist. Ensure moduleProviders.conan.installDirectory points to a valid Conan install output."; const moduleMapping = {"protobuflib": "protobuf"} const realModuleName = moduleMapping[moduleName] || moduleName; const moduleFilePath = FileInfo.joinPaths(depsDir, realModuleName + ".json") if (!File.exists(moduleFilePath)) return []; var reverseMapping = {} for (var key in moduleMapping) reverseMapping[moduleMapping[key]] = key console.info("Setting up Conan module '" + moduleName + "'"); var moduleFile = new TextFile(moduleFilePath, TextFile.ReadOnly); const moduleInfo = JSON.parse(moduleFile.readAll()); const outputDir = FileInfo.joinPaths(outputBaseDir, "modules", moduleName.replace(".", "/")); File.makePath(outputDir); const outputFilePath = FileInfo.joinPaths(outputDir, "module.qbs"); const cppInfo = moduleInfo.cpp_info; var moduleContent = ""; // function write(data) { moduleContent = moduleContent + data } function writeLine(data) { moduleContent = moduleContent + data + "\n"; } function writeProperty(propertyName, propertyValue) { if (propertyValue === undefined || propertyValue === null) propertyValue = []; writeLine(" readonly property stringList " + propertyName + ": " + ModUtils.toJSLiteral(propertyValue)); } function writeCppProperty(propertyName, propertyValue) { writeProperty(propertyName, propertyValue); // skip empty props for simplicity of the module file if (propertyValue !== undefined && propertyValue != null && propertyValue.length !== 0) { writeLine(" cpp." + propertyName + ": " + propertyName); } } writeLine("Module {"); writeLine(" version: " + ModUtils.toJSLiteral(moduleInfo.version)); const architecture = architectureMap[moduleInfo.settings.arch]; const platform = platformMap[moduleInfo.settings.os]; const targetOS = Utilities.canonicalPlatform(platform); writeLine(" readonly property string architecture: " + ModUtils.toJSLiteral(architecture)); if (platform !== undefined) writeLine(" readonly property string platform: " + ModUtils.toJSLiteral(platform)); writeLine(" condition: true"); if (architecture !== undefined) { writeLine(" && (!qbs.architecture || qbs.architecture === architecture)"); } if (platform !== undefined) { if (["ios", "tvos", "watchos"].includes(platform)) { writeLine(" && (qbs.targetPlatform === platform || qbs.targetPlatform === platform + \"-simulator\")"); } else { writeLine(" && qbs.targetPlatform === platform"); } } writeLine(" Depends { name: 'cpp' }"); moduleInfo.dependencies.reverse().forEach(function(dep) { const realDepName = reverseMapping[dep.name] || dep.name; writeLine(" Depends { name: " + ModUtils.toJSLiteral(realDepName) + "; version: " + ModUtils.toJSLiteral(dep.version) + "}"); }); const buildBindirs = moduleInfo.build_bindirs.map(FileInfo.fromNativeSeparators); writeLine(" readonly property stringList hostBinDirs: (" + ModUtils.toJSLiteral(buildBindirs) + ")"); const targetBindirs = cppInfo.bindirs.map(FileInfo.fromNativeSeparators); writeLine(" readonly property stringList binDirs: (" + ModUtils.toJSLiteral(targetBindirs) + ")"); // TODO: there's a weird issue with system include dirs with xcode-less clang - incorrect include order? writeCppProperty("includePaths", cppInfo.includedirs.map(FileInfo.fromNativeSeparators)); writeProperty("libraryPaths", cppInfo.libdirs.map(FileInfo.fromNativeSeparators)); writeCppProperty("frameworkPaths", cppInfo.frameworkdirs.map(FileInfo.fromNativeSeparators)); writeCppProperty("frameworks", cppInfo.frameworks); writeCppProperty("defines", cppInfo.defines); writeCppProperty("cFlags", cppInfo.cflags); writeCppProperty("cxxFlags", cppInfo.cxxflags); writeCppProperty("linkerFlags", (cppInfo.sharedlinkflags || []).concat(cppInfo.exelinkflags || [])); writeProperty("resources", cppInfo.resdirs.map(FileInfo.fromNativeSeparators)); const isForImport = targetOS.includes("windows") const libraryTypes = getLibraryTypes(moduleInfo.options); libraryTypes.forEach(function(libraryType){ const cppInfoLibs = cppInfo.libs === null ? [] : cppInfo.libs; const libdirs = cppInfo.libdirs.map(FileInfo.fromNativeSeparators); const libs = findLibs(cppInfoLibs, libdirs, libraryType, targetOS, isForImport) .concat(cppInfo.system_libs === null ? [] : cppInfo.system_libs); const property = libraryType === "shared" ? "dynamicLibraries" : "staticLibraries"; writeCppProperty(property, libs); }); writeLine("}"); var moduleFile = new TextFile(outputFilePath, TextFile.WriteOnly); moduleFile.write(moduleContent); moduleFile.close(); return ""; } qbs-src-3.2.0/share/qbs/module-providers/Qt/0000755000175100017510000000000015154533055020255 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/module-providers/Qt/templates/0000755000175100017510000000000015154533055022253 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/module-providers/Qt/templates/plugin.qbs0000644000175100017510000000163415154533055024264 0ustar runnerrunnerQtPlugin { qtModuleName: @name@ Depends { name: "Qt"; submodules: @dependencies@} version: @version@ className: @className@ architectures: @archs@ targetPlatform: @targetPlatform@ staticLibsDebug: @staticLibsDebug@ staticLibsRelease: @staticLibsRelease@ dynamicLibsDebug: @dynamicLibsDebug@ dynamicLibsRelease: @dynamicLibsRelease@ linkerFlagsDebug: @linkerFlagsDebug@ linkerFlagsRelease: @linkerFlagsRelease@ frameworksDebug: @frameworksDebug@ frameworksRelease: @frameworksRelease@ frameworkPathsDebug: @frameworkPathsDebug@ frameworkPathsRelease: @frameworkPathsRelease@ libNameForLinkerDebug: @libNameForLinkerDebug@ libNameForLinkerRelease: @libNameForLinkerRelease@ libFilePathDebug: @libFilePathDebug@ libFilePathRelease: @libFilePathRelease@ cpp.libraryPaths: @libraryPaths@ extendsModules: @extends@ @additionalContent@ } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/qdoc.js0000644000175100017510000000754015154533055023545 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); function qdocArgs(product, input, outputDir) { var args = [input.filePath]; var qtVersion = ModUtils.moduleProperty(product, "versionMajor"); if (qtVersion >= 5) { args.push("-outputdir"); args.push(outputDir); } return args; } var _qdocDefaultFileTag = "qdoc-output"; function qdocFileTaggers() { var t = _qdocDefaultFileTag; return { ".qhp": [t, "qhp"], ".qhp.sha1": [t, "qhp-sha1"], ".css": [t, "qdoc-css"], ".html": [t, "qdoc-html"], ".index": [t, "qdoc-index"], ".png": [t, "qdoc-png"] }; } function outputArtifacts(product, input) { var tracker = new ModUtils.BlackboxOutputArtifactTracker(); tracker.hostOS = product.moduleProperty("qbs", "hostOS"); tracker.shellPath = product.moduleProperty("qbs", "shellPath"); tracker.defaultFileTags = [_qdocDefaultFileTag]; tracker.fileTaggers = qdocFileTaggers(); tracker.command = FileInfo.joinPaths(ModUtils.moduleProperty(product, "binPath"), ModUtils.moduleProperty(product, "qdocName")); tracker.commandArgsFunction = function (outputDirectory) { return qdocArgs(product, input, outputDirectory); }; tracker.commandEnvironmentFunction = function (outputDirectory) { var env = {}; var qdocEnv = ModUtils.moduleProperty(product, "qdocEnvironment"); for (var j = 0; j < qdocEnv.length; ++j) { var e = qdocEnv[j]; var idx = e.indexOf("="); var name = e.slice(0, idx); var value = e.slice(idx + 1, e.length); env[name] = value; } env["OUTDIR"] = outputDirectory; // Qt 4 replacement for -outputdir return env; }; return tracker.artifacts(ModUtils.moduleProperty(product, "qdocOutputDir")); } function commands(product, input) { var outputDir = product.Qt.core.qdocOutputDir; var args = qdocArgs(product, input, outputDir); var cmd = new Command(product.Qt.core.binPath + '/' + product.Qt.core.qdocName, args); cmd.description = 'qdoc ' + input.fileName; cmd.highlight = 'filegen'; cmd.environment = product.Qt.core.qdocEnvironment; cmd.environment.push("OUTDIR=" + outputDir); // Qt 4 replacement for -outputdir return cmd; } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/dbus.qbs0000644000175100017510000000420115154533055023714 0ustar runnerrunnerimport qbs.FileInfo import qbs.ModUtils import "dbus.js" as DBus QtModule { qtModuleName: "DBus" property string xml2cppName: "qdbusxml2cpp" property stringList xml2CppHeaderFlags: [] property stringList xml2CppSourceFlags: [] Rule { inputs: ["qt.dbus.adaptor"] Artifact { filePath: FileInfo.joinPaths(input.moduleProperty("Qt.core", "generatedHeadersDir"), DBus.outputFileName(input, "_adaptor.h")) fileTags: ["hpp"] } Artifact { filePath: DBus.outputFileName(input, "_adaptor.cpp") fileTags: ["cpp", "qt.untranslatable"] } prepare: DBus.createCommands(product, input, outputs, "-a") } Rule { inputs: ["qt.dbus.interface"] Artifact { filePath: FileInfo.joinPaths(input.moduleProperty("Qt.core", "generatedHeadersDir"), DBus.outputFileName(input, "_interface.h")) fileTags: ["hpp"] } Artifact { filePath: DBus.outputFileName(input, "_interface.cpp") fileTags: ["cpp", "qt.untranslatable"] } prepare: DBus.createCommands(product, input, outputs, "-p") } version: @version@ architectures: @archs@ targetPlatform: @targetPlatform@ staticLibsDebug: @staticLibsDebug@ staticLibsRelease: @staticLibsRelease@ dynamicLibsDebug: @dynamicLibsDebug@ dynamicLibsRelease: @dynamicLibsRelease@ linkerFlagsDebug: @linkerFlagsDebug@ linkerFlagsRelease: @linkerFlagsRelease@ frameworksDebug: @frameworksDebug@ frameworksRelease: @frameworksRelease@ frameworkPathsDebug: @frameworkPathsDebug@ frameworkPathsRelease: @frameworkPathsRelease@ libNameForLinkerDebug: @libNameForLinkerDebug@ libNameForLinkerRelease: @libNameForLinkerRelease@ libFilePathDebug: @libFilePathDebug@ libFilePathRelease: @libFilePathRelease@ pluginTypes: @pluginTypes@ moduleConfig: @moduleConfig@ cpp.defines: @defines@ cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @additionalContent@ } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/qml.js0000644000175100017510000002171115154533055023404 0ustar runnerrunnervar File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var Process = require("qbs.Process"); var TextFile = require("qbs.TextFile"); function scannerData(scannerFilePath, qmlFiles, qmlPath, hostOS) { var p; try { p = new Process(); if (!hostOS.contains("windows")) { p.exec(scannerFilePath, ["-qmlFiles"].concat(qmlFiles).concat(["-importPath", qmlPath]), true); return JSON.parse(p.readStdOut()); } var data = []; var nextFileIndex = 0; while (nextFileIndex < qmlFiles.length) { var currentFileList = []; var currentFileListStringLength = 0; while (nextFileIndex < qmlFiles.length && currentFileListStringLength < 30000) { var currentFile = qmlFiles[nextFileIndex++]; currentFileList.push(currentFile); currentFileListStringLength += currentFile.length; } p.exec(scannerFilePath, ["-qmlFiles"].concat(currentFileList) .concat(["-importPath", qmlPath]), true); data = data.concat(JSON.parse(p.readStdOut())); } return data; } finally { if (p) p.close(); } } function getPrlRhs(line) { return line.split('=')[1].trim(); } function getLibsForPlugin(pluginData, product) { var targetOS = product.qbs.targetOS; var toolchain = product.qbs.toolchain; var buildVariant = product.Qt.core.qtBuildVariant; var qtLibDir = product.Qt.core.libPath; var qtPluginDir = product.Qt.core.pluginPath; var qtDir = product.Qt.core.installPrefixPath; var qtQmlPath = product.Qt.qml.qmlPath; if (!pluginData.path) return ""; var prlFileName = ""; if (!targetOS.contains("windows")) prlFileName += "lib"; prlFileName += pluginData.plugin; if (buildVariant === "debug") { if (targetOS.contains("windows")) { prlFileName += "d"; } else if (product.Qt.core.versionMajor >= 6 && (targetOS.contains("ios") || targetOS.contains("tvos") || targetOS.contains("watchos"))) { prlFileName += "_debug"; } } prlFileName += ".prl"; var prlFilePath = FileInfo.joinPaths(pluginData.path, prlFileName); if (!File.exists(prlFilePath)) { console.warn("prl file for QML plugin '" + pluginData.plugin + "' not present at '" + prlFilePath + "'. Linking may fail."); return ""; } var prlFile = new TextFile(prlFilePath, TextFile.ReadOnly); try { var pluginLib; var otherLibs = []; var line; while (!prlFile.atEof()) { line = prlFile.readLine().trim(); if (!line) continue; if (line.startsWith("QMAKE_PRL_TARGET")) pluginLib = FileInfo.joinPaths(pluginData.path, getPrlRhs(line)); if (line.startsWith("QMAKE_PRL_LIBS = ")) { var otherLibsLine = ' ' + getPrlRhs(line); if (toolchain.contains("msvc")) { otherLibsLine = otherLibsLine.replace(/ -L/g, " /LIBPATH:"); otherLibsLine = otherLibsLine.replace(/-l([^ ]+)/g, "$1" + ".lib"); } otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_LIBS\]/g, qtLibDir); otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_PLUGINS\]/g, qtPluginDir); otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_PREFIX\]/g, qtDir); otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_QML\]/g, qtQmlPath); otherLibs = otherLibs.concat(otherLibsLine.split(' ').map(FileInfo.cleanPath)); } } if (!pluginLib) throw "Malformed prl file '" + prlFilePath + "'."; return [pluginLib].concat(otherLibs); } finally { prlFile.close(); } } function typeRegistrarCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var versionParts = product.Qt.qml._importVersionParts; var args = [ "--generate-qmltypes=" + outputs["qt.qml.types"][0].filePath, "--import-name=" + product.Qt.qml.importName, "--major-version=" + versionParts[0], "--minor-version=" + (versionParts.length > 1 ? versionParts[1] : "0") ]; var foreignTypes = product.Qt.qml.extraMetaTypesFiles || []; var metaTypeArtifactsFromDeps = explicitlyDependsOn["qt.core.metatypes"] || []; var filePathFromArtifact = function(a) { return a.filePath; }; foreignTypes = foreignTypes.uniqueConcat(metaTypeArtifactsFromDeps.map(filePathFromArtifact)); if (foreignTypes.length > 0) args.push("--foreign-types=" + foreignTypes.join(",")); args.push("-o", outputs.cpp[0].filePath); args = args.concat(inputs["qt.core.metatypes"].map(filePathFromArtifact)); var cmd = new Command(product.Qt.core.qmlLibExecPath + "/qmltyperegistrar", args); cmd.description = "running qmltyperegistrar"; cmd.highlight = "codegen"; return cmd; } function generatePluginImportOutputArtifacts(product, inputs) { var list = []; if (inputs["qt.qml.qml"]) list.push({ filePath: "qml_plugin_import.cpp", fileTags: ["cpp"] }); list.push({ filePath: product.Qt.core.qtBuildVariant === "debug" ? product.Qt.qml.pluginListFilePathDebug : product.Qt.qml.pluginListFilePathRelease, fileTags: ["qt.qml.pluginlist"] }); return list; } function getCppLibsAndFrameworks(cpp) { var libs = {"frameworks": {}, "libraries": {}}; for (var i = 0; i < cpp.frameworks.length; ++i) libs.frameworks[cpp.frameworks[i]] = true; for (var i = 0; i < cpp.staticLibraries.length; ++i) libs.libraries[cpp.staticLibraries[i]] = true; for (var i = 0; i < cpp.dynamicLibraries.length; ++i) libs.libraries[cpp.dynamicLibraries[i]] = true; return libs; } function getUniqueLibs(libs, seen) { var uniqueLibs = []; for (var i = 0; i < libs.length; ++i) { if (libs[i] == "-framework") { var frameworkName = libs[i + 1]; if (frameworkName && !seen.frameworks[frameworkName]) { seen.frameworks[frameworkName] = true; uniqueLibs.push("-framework", frameworkName); } ++i; // Skip framework name } else { var libName; if (libs[i].startsWith("-l")) libName = libs[i].substr(2); else libName = libs[i]; if (!seen.libraries[libName]) { seen.libraries[libName] = true; uniqueLibs.push(libs[i]); } } } return uniqueLibs; } function generatePluginImportCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmd = new JavaScriptCommand(); if (inputs["qt.qml.qml"]) cmd.description = "creating " + outputs["cpp"][0].fileName; else cmd.silent = true; cmd.sourceCode = function() { var qmlInputs = inputs["qt.qml.qml"]; if (!qmlInputs) qmlInputs = []; var scannerData = Qml.scannerData(product.Qt.qml.qmlImportScannerFilePath, qmlInputs.map(function(inp) { return inp.filePath; }), product.Qt.qml.qmlPath, Host.os()); var cppFile; var listFile; try { if (qmlInputs.length > 0) cppFile = new TextFile(outputs["cpp"][0].filePath, TextFile.WriteOnly); listFile = new TextFile(outputs["qt.qml.pluginlist"][0].filePath, TextFile.WriteOnly); if (cppFile) cppFile.writeLine("#include "); var plugins = { }; var seen = Qml.getCppLibsAndFrameworks(product.cpp); var libsWithUniqueObjects = []; for (var p in scannerData) { var plugin = scannerData[p].plugin; if (!plugin || plugins[plugin]) continue; plugins[plugin] = true; var className = scannerData[p].classname; if (!className) { throw "QML plugin '" + plugin + "' is missing a classname entry. " + "Please add one to the qmldir file."; } if (cppFile) cppFile.writeLine("Q_IMPORT_PLUGIN(" + className + ")"); var libs = Qml.getLibsForPlugin(scannerData[p], product); var uniqueLibs = Qml.getUniqueLibs(libs, seen); libsWithUniqueObjects = libsWithUniqueObjects.concat(uniqueLibs); } listFile.write(libsWithUniqueObjects.join("\n")); } finally { if (cppFile) cppFile.close(); if (listFile) listFile.close(); }; }; return [cmd]; } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/core.qbs0000644000175100017510000004616615154533055023727 0ustar runnerrunnerimport qbs.FileInfo import qbs.ModUtils import qbs.TextFile import qbs.Utilities import "core.js" as Core import "moc.js" as Moc import "qdoc.js" as Qdoc import "rcc.js" as Rcc Module { condition: (qbs.targetPlatform === targetPlatform || isCombinedUIKitBuild) && (!qbs.architecture || architectures.length === 0 || architectures.contains(qbs.architecture)) readonly property bool isCombinedUIKitBuild: ["ios", "tvos", "watchos"].contains(targetPlatform) && (!qbs.architecture || ["x86", "x86_64"].contains(qbs.architecture)) && qbs.targetPlatform === targetPlatform + "-simulator" Depends { name: "cpp" } Depends { name: "Sanitizers.address"; condition: config.contains("sanitize_address") } Group { condition: qbs.targetOS.contains("android") Depends { name: "Qt.android_support" } product.Qt.android_support._qtBinaryDir: FileInfo.path(binPath) product.Qt.android_support._qtInstallDir: FileInfo.path(installPath) product.Qt.android_support.version: version product.Qt.android_support.rccFilePath: Rcc.fullPath(product) } // qmlImportScanner is required by androiddeployqt even if the project doesn't // depend on qml. That's why the scannerName must be defined here and not in the // qml module property string qmlImportScannerName: "qmlimportscanner" property string qmlImportScannerFilePath: qmlLibExecPath + '/' + qmlImportScannerName version: @version@ property stringList architectures: @archs@ property string targetPlatform: @targetPlatform@ property string libInfix: @libInfix@ property stringList config: @config@ property stringList qtConfig: @qtConfig@ readonly property stringList enabledFeatures: @enabledFeatures@ readonly property stringList disabledFeatures: @disabledFeatures@ property path binPath: @binPath@ property path installPath: @installPath@ property path incPath: @incPath@ property path libPath: @libPath@ property path installPrefixPath: @installPrefixPath@ property path libExecPath: @libExecPath@ property path qmlLibExecPath: @qmlLibExecPath@ property path pluginPath: @pluginPath@ property string mkspecName: @mkspecName@ property path mkspecPath: @mkspecPath@ property string mocName: "moc" property stringList mocFlags: [] property string lreleaseName: "lrelease" property string lupdateName: "lupdate" property string rccName: "rcc" property string qdocName: versionMajor >= 5 ? "qdoc" : "qdoc3" property stringList qdocEnvironment property path docPath: @docPath@ property path translationsPath: @translationsPath@ property string helpGeneratorLibExecPath: @helpGeneratorLibExecPath@ property stringList helpGeneratorArgs: versionMajor >= 5 ? ["-platform", "minimal"] : [] property var versionParts: version ? version.split('.').map(function(item) { return parseInt(item, 10); }) : [] property int versionMajor: versionParts[0] property int versionMinor: versionParts[1] property int versionPatch: versionParts[2] property bool frameworkBuild: @frameworkBuild@ property bool staticBuild: @staticBuild@ property bool multiThreading: @multiThreading@ property stringList pluginMetaData: [] property bool enableKeywords: true property bool generateMetaTypesFile readonly property bool _generateMetaTypesFile: generateMetaTypesFile && Utilities.versionCompare(version, "5.15") >= 0 property string metaTypesInstallDir property stringList availableBuildVariants: @availableBuildVariants@ property string qtBuildVariant: { if (availableBuildVariants.contains(qbs.buildVariant)) return qbs.buildVariant; if (qbs.buildVariant === "profiling" && availableBuildVariants.contains("release")) return "release"; return availableBuildVariants.length > 0 ? availableBuildVariants[0] : ""; } property stringList staticLibsDebug: @staticLibsDebug@ property stringList staticLibsRelease: @staticLibsRelease@ property stringList dynamicLibsDebug: @dynamicLibsDebug@ property stringList dynamicLibsRelease: @dynamicLibsRelease@ property stringList staticLibs: qtBuildVariant === "debug" ? staticLibsDebug : staticLibsRelease property stringList dynamicLibs: qtBuildVariant === "debug" ? dynamicLibsDebug : dynamicLibsRelease property stringList linkerFlagsDebug: @linkerFlagsDebug@ property stringList linkerFlagsRelease: @linkerFlagsRelease@ property stringList coreLinkerFlags: qtBuildVariant === "debug" ? linkerFlagsDebug : linkerFlagsRelease property stringList frameworksDebug: @frameworksDebug@ property stringList frameworksRelease: @frameworksRelease@ property stringList coreFrameworks: qtBuildVariant === "debug" ? frameworksDebug : frameworksRelease property stringList frameworkPathsDebug: @frameworkPathsDebug@ property stringList frameworkPathsRelease: @frameworkPathsRelease@ property stringList coreFrameworkPaths: qtBuildVariant === "debug" ? frameworkPathsDebug : frameworkPathsRelease property string libNameForLinkerDebug: @libNameForLinkerDebug@ property string libNameForLinkerRelease: @libNameForLinkerRelease@ property string libNameForLinker: qtBuildVariant === "debug" ? libNameForLinkerDebug : libNameForLinkerRelease property string libFilePathDebug: @libFilePathDebug@ property string libFilePathRelease: @libFilePathRelease@ property string libFilePath: qtBuildVariant === "debug" ? libFilePathDebug : libFilePathRelease property bool useRPaths: qbs.targetOS.contains("linux") && !qbs.targetOS.contains("android") property stringList coreLibPaths: @libraryPaths@ property bool hasLibrary: true // These are deliberately not path types // We don't want to resolve them against the source directory property string generatedHeadersDir: product.buildDirectory + "/qt.headers" property string qdocOutputDir: product.buildDirectory + "/qdoc_html" property string qmDir: product.destinationDirectory property string qmBaseName: product.targetName property bool lreleaseMultiplexMode: false property stringList moduleConfig: @moduleConfig@ Properties { condition: moduleConfig.contains("use_gold_linker") cpp.linkerVariant: "gold" } Properties { condition: Utilities.versionCompare(version, "6") >= 0 cpp.cxxLanguageVersion: "c++17" } Properties { condition: Utilities.versionCompare(version, "6") < 0 && Utilities.versionCompare(version, "5.7.0") >= 0 cpp.cxxLanguageVersion: "c++11" } cpp.enableCompilerDefinesByLanguage: ["cpp"].concat( qbs.targetOS.contains("darwin") ? ["objcpp"] : []) cpp.defines: { var defines = @defines@; // ### QT_NO_DEBUG must be added if the current build variant is not derived // from the build variant "debug" if (!qbs.enableDebugCode) defines.push("QT_NO_DEBUG"); if (!enableKeywords) defines.push("QT_NO_KEYWORDS"); if (qbs.targetOS.containsAny(["ios", "tvos"])) { defines = defines.concat(["DARWIN_NO_CARBON", "QT_NO_CORESERVICES", "QT_NO_PRINTER", "QT_NO_PRINTDIALOG"]); if (Utilities.versionCompare(version, "5.6.0") < 0) defines.push("main=qtmn"); } if (qbs.toolchain.contains("msvc")) defines.push("_ENABLE_EXTENDED_ALIGNED_STORAGE"); return defines; } cpp.driverFlags: { var flags = []; if (qbs.toolchain.contains("gcc")) { if (config.contains("sanitize_undefined")) flags.push("-fsanitize=undefined"); if (config.contains("sanitize_thread")) flags.push("-fsanitize=thread"); if (config.contains("sanitize_memory")) flags.push("-fsanitize=memory"); } return flags; } cpp.includePaths: generatedHeadersDir cpp.systemIncludePaths: @includes@.concat(mkspecPath) cpp.libraryPaths: { var libPaths = [libPath]; if (staticBuild && pluginPath) libPaths.push(pluginPath + "/platforms"); libPaths = libPaths.concat(coreLibPaths); return libPaths; } cpp.staticLibraries: { var libs = []; if (qbs.targetOS.contains('windows') && !product.consoleApplication) { libs = libs.concat(qtBuildVariant === "debug" ? @entryPointLibsDebug@ : @entryPointLibsRelease@); } libs = libs.concat(staticLibs); return libs; } cpp.dynamicLibraries: dynamicLibs cpp.linkerFlags: coreLinkerFlags cpp.systemFrameworkPaths: coreFrameworkPaths.concat(frameworkBuild ? [libPath] : []) cpp.frameworks: { var frameworks = coreFrameworks if (frameworkBuild) frameworks.push(libNameForLinker); if (qbs.targetOS.contains('ios') && staticBuild) frameworks = frameworks.concat(["Foundation", "CoreFoundation"]); if (frameworks.length === 0) return undefined; return frameworks; } cpp.rpaths: useRPaths ? libPath : undefined cpp.rpathLinkDirs: useRPaths ? undefined : libPath Properties { condition: qbs.toolchain.contains("msvc") && config.contains("static_runtime") cpp.runtimeLibrary: "static" } Properties { condition: qbs.toolchain.contains("msvc") && !config.contains("static_runtime") cpp.runtimeLibrary: "dynamic" } Properties { condition: versionMajor >= 5 cpp.positionIndependentCode: true } cpp.cxxFlags: { var flags = []; if (qbs.toolchain.contains('msvc')) { if (versionMajor < 5) flags.push('/Zc:wchar_t-'); if (Utilities.versionCompare(version, "6.3") >= 0 && Utilities.versionCompare(cpp.compilerVersion, "19.10") >= 0) { flags.push("/permissive-"); } } if (qbs.toolchain.includes("emscripten") && multiThreading) flags.push("-pthread"); return flags; } Properties { condition: qbs.targetOS.contains('darwin') && qbs.toolchain.contains('clang') && config.contains('c++11') cpp.cxxStandardLibrary: "libc++" } Properties { condition: qbs.toolchain.includes("emscripten") cpp.driverLinkerFlags: { var flags = [ "-sMAX_WEBGL_VERSION=2", "-sFETCH=1", "-sWASM_BIGINT=1", "-sMODULARIZE", "-sEXPORT_NAME=createQtAppInstance", "-sALLOW_MEMORY_GROWTH", '-sASYNCIFY_IMPORTS=["qt_asyncify_suspend_js", "qt_asyncify_resume_js"]', '-sEXPORTED_RUNTIME_METHODS=["UTF16ToString", "stringToUTF16", "JSEvents", "specialHTMLTargets", "FS", "callMain"]', "-lembind" ]; if (multiThreading) flags.push("-pthread") return flags; } } cpp.minimumWindowsVersion: @minWinVersion_optional@ cpp.minimumMacosVersion: @minMacVersion_optional@ cpp.minimumIosVersion: @minIosVersion_optional@ cpp.minimumTvosVersion: @minTvosVersion_optional@ cpp.minimumWatchosVersion: @minWatchosVersion_optional@ cpp.minimumAndroidVersion: @minAndroidVersion_optional@ // Universal Windows Platform support cpp.windowsApiFamily: mkspecName.startsWith("winrt-") ? "pc" : undefined cpp.windowsApiAdditionalPartitions: mkspecPath.startsWith("winrt-") ? ["phone"] : undefined cpp.requireAppContainer: mkspecName.startsWith("winrt-") additionalProductTypes: ["qm", "qt.core.metatypes"] validate: { var validator = new ModUtils.PropertyValidator("Qt.core"); validator.setRequiredProperty("binPath", binPath); validator.setRequiredProperty("incPath", incPath); validator.setRequiredProperty("libPath", libPath); validator.setRequiredProperty("mkspecPath", mkspecPath); validator.setRequiredProperty("version", version); validator.setRequiredProperty("config", config); validator.setRequiredProperty("qtConfig", qtConfig); validator.setRequiredProperty("versionMajor", versionMajor); validator.setRequiredProperty("versionMinor", versionMinor); validator.setRequiredProperty("versionPatch", versionPatch); if (!staticBuild) validator.setRequiredProperty("pluginPath", pluginPath); // Allow custom version suffix since some distributions might want to do this, // but otherwise the version must start with a valid 3-component string validator.addVersionValidator("version", version, 3, 3, true); validator.addRangeValidator("versionMajor", versionMajor, 1); validator.addRangeValidator("versionMinor", versionMinor, 0); validator.addRangeValidator("versionPatch", versionPatch, 0); validator.addCustomValidator("availableBuildVariants", availableBuildVariants, function (v) { return v.length > 0; }, "the Qt installation supports no build variants"); validator.addCustomValidator("qtBuildVariant", qtBuildVariant, function (variant) { return availableBuildVariants.contains(variant); }, "'" + qtBuildVariant + "' is not supported by this Qt installation"); validator.addCustomValidator("qtBuildVariant", qtBuildVariant, function (variant) { return variant === qbs.buildVariant || !qbs.toolchain.contains("msvc"); }, " is '" + qtBuildVariant + "', but qbs.buildVariant is '" + qbs.buildVariant + "', which is not allowed when using MSVC"); validator.addFileNameValidator("resourceFileBaseName", resourceFileBaseName); validator.validate(); } FileTagger { patterns: ["*.qrc"] fileTags: ["qrc"] } FileTagger { patterns: ["*.ts"] fileTags: ["ts"] } FileTagger { patterns: ["*.qdoc", "*.qdocinc"] fileTags: ["qdoc"] } FileTagger { patterns: ["*.qdocconf"] fileTags: ["qdocconf"] } FileTagger { patterns: ["*.qhp"] fileTags: ["qhp"] } property bool combineMocOutput: cpp.combineCxxSources property bool enableBigResources: false // Product should not moc in the aggregate when multiplexing. property bool enableMoc: !(product.multiplexed || product.aggregate) || product.multiplexConfigurationId Group { condition: enableMoc Rule { name: "QtCoreMocRuleCpp" property string cppInput: cpp.combineCxxSources ? "cpp.combine" : "cpp" property string objcppInput: cpp.combineObjcxxSources ? "objcpp.combine" : "objcpp" inputs: [objcppInput, cppInput] auxiliaryInputs: "qt_plugin_metadata" excludedInputs: "unmocable" outputFileTags: ["hpp", "unmocable", "qt.core.metatypes.in", "qt.untranslatable"] outputArtifacts: Moc.outputArtifacts.apply(Moc, arguments) prepare: Moc.commands.apply(Moc, arguments) } Rule { name: "QtCoreMocRuleHpp" inputs: "hpp" auxiliaryInputs: ["qt_plugin_metadata", "cpp", "objcpp"] excludedInputs: "unmocable" outputFileTags: ["hpp", "cpp", "moc_cpp", "unmocable", "qt.core.metatypes.in", "qt.untranslatable"] outputArtifacts: Moc.outputArtifacts.apply(Moc, arguments) prepare: Moc.commands.apply(Moc, arguments) } } Rule { multiplex: true inputs: ["moc_cpp"] Artifact { filePath: "amalgamated_moc_" + product.targetName + ".cpp" fileTags: ["cpp", "unmocable", "qt.untranslatable"] } prepare: Moc.generateMocCppCommands(inputs, output) } Rule { multiplex: true inputs: "qt.core.metatypes.in" Artifact { filePath: product.targetName.toLowerCase() + "_metatypes.json" fileTags: "qt.core.metatypes" qbs.install: product.Qt.core.metaTypesInstallDir qbs.installDir: product.Qt.core.metaTypesInstallDir } prepare: Moc.generateMetaTypesCommands(inputs, output) } property path resourceSourceBase property string resourcePrefix: "/" property string resourceFileBaseName: product.targetName Rule { multiplex: true inputs: ["qt.core.resource_data"] Artifact { filePath: product.Qt.core.resourceFileBaseName + ".qrc" fileTags: ["qrc"] } prepare: Rcc.generateQrcFileCommands.apply(Rcc, arguments) } Rule { inputs: ["qrc"] outputFileTags: ["cpp", "cpp_intermediate_object", "qt.untranslatable"] outputArtifacts: Rcc.rccOutputArtifacts(input) prepare: Rcc.rccCommands(product, input, output) } Rule { inputs: ["intermediate_obj"] Artifact { filePath: input.completeBaseName + ".2" + input.cpp.objectSuffix fileTags: ["obj"] } prepare: Rcc.rccPass2Commands(product, input, output) } Rule { inputs: ["ts"] multiplex: lreleaseMultiplexMode Artifact { filePath: FileInfo.joinPaths(product.Qt.core.qmDir, (product.Qt.core.lreleaseMultiplexMode ? product.Qt.core.qmBaseName : input.baseName) + ".qm") fileTags: ["qm"] } prepare: Core.lreleaseCommands.apply(Core, arguments) } Rule { inputs: "qdocconf-main" explicitlyDependsOn: ["qdoc", "qdocconf"] outputFileTags: ModUtils.allFileTags(Qdoc.qdocFileTaggers()) outputArtifacts: Qdoc.outputArtifacts(product, input) prepare: Qdoc.commands(product, input) } Rule { inputs: "qhp" auxiliaryInputs: ModUtils.allFileTags(Qdoc.qdocFileTaggers()) .filter(function(tag) { return tag !== "qhp"; }) Artifact { filePath: input.completeBaseName + ".qch" fileTags: ["qch"] } prepare: Core.qhelpGeneratorCommands(product, input, output) } Group { condition: qbs.toolchain.includes("emscripten") && (product.type.includes("application") && product.type.includes("qthtml")) Rule { inputs: ["application"] multiplex: true Artifact { filePath : FileInfo.joinPaths(product.buildDirectory, product.targetName + ".html") fileTags : ["qthtml"] } prepare: Core.wasmQtHtmlCommands(product, output) } Group { fileTags: ["qthtml"] files: [ module.pluginPath + "/platforms/qtloader.js", module.pluginPath + "/platforms/qtlogo.svg" ] } } @additionalContent@ } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/android_support.qbs0000644000175100017510000001306215154533055026200 0ustar runnerrunnerimport qbs.FileInfo import qbs.ModUtils import qbs.Utilities import qbs.Xml import "android_support.js" as Impl Module { version: @version@ property string qmlRootDir: product.sourceDirectory property stringList extraPrefixDirs property stringList qmlImportPaths property stringList deploymentDependencies // qmake: ANDROID_DEPLOYMENT_DEPENDENCIES property stringList extraPlugins // qmake: ANDROID_EXTRA_PLUGINS property stringList extraLibs // qmake: ANDROID_EXTRA_LIBS property bool verboseAndroidDeployQt: false property string _androidDeployQtFilePath: FileInfo.joinPaths(_qtBinaryDir, "bin", "androiddeployqt") property string rccFilePath property string _qtBinaryDir property string _qtInstallDir property bool _enableSdkSupport: product.type && product.type.contains("android.package") && !product.consoleApplication property bool _enableNdkSupport: !product.aggregate || product.multiplexConfigurationId property string _templatesBaseDir: FileInfo.joinPaths(_qtInstallDir, "src", "android") property string _deployQtOutDir: FileInfo.joinPaths(product.buildDirectory, "deployqt_out") property bool _multiAbi: Utilities.versionCompare(version, "5.14") >= 0 // QTBUG-87288: correct QtNetwork jar dependencies for 5.15.0 < Qt < 5.15.3 property bool _correctQtNetworkDependencies: Utilities.versionCompare(version, "5.15.0") > 0 && Utilities.versionCompare(version, "5.15.3") < 0 readonly property string _qtAndroidJarFileName: Utilities.versionCompare(version, "6.0") >= 0 ? "Qt6Android.jar" : "QtAndroid.jar" Group { condition: _enableSdkSupport name: "helper sources from qt" Depends { name: "Android.sdk" } Depends { name: "java" } product.Android.sdk.customManifestProcessing: true product.Android.sdk._bundledInAssets: _multiAbi product.java._tagJniHeaders: false // prevent rule cycle Properties { condition: Utilities.versionCompare(version, "5.15") >= 0 && Utilities.versionCompare(version, "6.0") < 0 java.additionalClassPaths: [FileInfo.joinPaths(_qtInstallDir, "jar", "QtAndroid.jar")] } Properties { condition: Utilities.versionCompare(version, "6.0") >= 0 java.additionalClassPaths: [FileInfo.joinPaths(_qtInstallDir, "jar", "Qt6Android.jar")] Android.sdk.minimumVersion: "23" } Properties { condition: Utilities.versionCompare(version, "6.0") < 0 Android.sdk.minimumVersion: "21" } prefix: Qt.android_support._templatesBaseDir + "/java/" Android.sdk.aidlSearchPaths: prefix + "src" files: [ "**/*.java", "**/*.aidl", ] Rule { multiplex: true property stringList inputTags: ["android.nativelibrary", "qrc"] inputsFromDependencies: inputTags inputs: product.aggregate ? [] : inputTags Artifact { filePath: "androiddeployqt.json" fileTags: "qt_androiddeployqt_input" } prepare: Impl.prepareDeployQtCommands.apply(Impl, arguments) } // We use the manifest template from the Qt installation if and only if the project // does not provide a manifest file. Rule { multiplex: true requiresInputs: false inputs: "android.manifest" excludedInputs: "qt.android_manifest" outputFileTags: ["android.manifest", "qt.android_manifest"] outputArtifacts: Impl.qtManifestOutputArtifacts(inputs) prepare: Impl.qtManifestCommands(product, output) } Rule { multiplex: true property stringList defaultInputs: ["qt_androiddeployqt_input", "android.manifest_processed"] property stringList allInputs: ["qt_androiddeployqt_input", "android.manifest_processed", "android.nativelibrary"] inputsFromDependencies: "android.nativelibrary" inputs: product.aggregate ? defaultInputs : allInputs outputFileTags: [ "android.manifest_final", "android.resources", "android.assets", "bundled_jar", "android.deployqt_list", ] outputArtifacts: Impl.deployQtOutputArtifacts(product) prepare: Impl.deployQtCommands.apply(Impl, arguments) } } Group { condition: _enableNdkSupport Depends { name: "cpp" } Depends { name: "Android.ndk" } product.Android.ndk.appStl: qbs.toolchain.contains("clang") ? "c++_shared" : "gnustl_shared" Properties { condition: _multiAbi cpp.archSuffix: "_" + Android.ndk.abi } // "ANDROID_HAS_WSTRING" was removed from qtcore qstring.h in Qt 5.14.0 Properties { condition: Utilities.versionCompare(version, "5.14.0") < 0 && (Android.ndk.abi === "armeabi-v7a" || Android.ndk.abi === "x86") cpp.defines: "ANDROID_HAS_WSTRING" } } validate: { if (Utilities.versionCompare(version, "5.12") < 0) throw ModUtils.ModuleError("Cannot use Qt " + version + " with Android. " + "Version 5.12 or later is required."); } } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/shadertools.js0000644000175100017510000001173015154533055025142 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com). ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require('qbs.FileInfo'); function getOutputFileTags(input) { const tags = ["qt.compiled_shader"]; if (input.fileTags.includes("qt.shader.vertex")) { tags.push("qt.compiled_shader.vertex"); } if (input.fileTags.includes("qt.shader.tessellation")) { tags.push("qt.compiled_shader.tessellation"); } if (input.fileTags.includes("qt.shader.fragment")) { tags.push("qt.compiled_shader.fragment"); } if (input.fileTags.includes("qt.shader.compute")) { tags.push("qt.compiled_shader.compute"); } return tags; } function compilerOutputArtifacts(input) { var artifacts = []; const addResourceData = input.Qt.shadertools.addResourceData; artifacts.push({ filePath: FileInfo.joinPaths(input.Qt.shadertools.generatedShadersDir, input.fileName + '.qsb'), fileTags: getOutputFileTags(input).concat(addResourceData ? ["qt.core.resource_data"] : []), Qt: addResourceData ? { core: { resourcePrefix: input.Qt.core.resourcePrefix } } : {} }); return artifacts; } function compilerCommands(project, product, inputs, outputs, input, output) { const qsbPath = FileInfo.joinPaths(input.Qt.core.binPath, input.Qt.shadertools.qsbName); var glslVersions = input.Qt.shadertools.glslVersions; var hlslVersions = input.Qt.shadertools.hlslVersions; var mslVersions = input.Qt.shadertools.mslVersions; var args = [input.filePath, '-o', output.filePath]; if (input.Qt.shadertools.useQt6Versions && glslVersions.length === 0 && hlslVersions.length === 0 && mslVersions.length === 0) { glslVersions = ['100 es', '120', '150']; hlslVersions = ['50']; mslVersions = ['20']; } if (glslVersions.length > 0) { args.push('--glsl', glslVersions.join(',')); } if (hlslVersions.length > 0) { args.push('--hlsl', hlslVersions.join(',')); } if (mslVersions.length > 0) { args.push('--msl', mslVersions.join(',')); } if (input.Qt.shadertools.batchable) { args.push('-b'); if (input.Qt.shadertools.zOrderLocation !== undefined) { args.push('--zorder-loc', input.Qt.shadertools.zOrderLocation); } } if (input.Qt.shadertools.tessellation && input.fileTags.includes("qt.shader.tessellation")) { args.push('--msltess'); const tessellationMode = input.Qt.shadertools.tessellationMode; if (tessellationMode !== undefined) { args.push('--tess-mode', tessellationMode); } const tessellationVertexCount = input.Qt.shadertools.tessellationVertexCount; if (tessellationVertexCount !== undefined) { args.push('--tess-vertex-count', tessellationVertexCount); } } const viewCount = input.Qt.shadertools.viewCount; if (viewCount !== undefined) { args.push('--view-count', viewCount); } if (input.Qt.shadertools.optimized) { args.push('-O'); } const defines = input.Qt.shadertools.defines || []; if (defines.length > 0) { args = args.concat(defines.map(function(define) { return '-D' + define; })); } if (input.Qt.shadertools.debugInformation) { args.push('-g'); } var cmd = new Command(qsbPath, args); cmd.description = 'compiling ' + output.fileName; cmd.highlight = 'codegen'; cmd.environment = ["LANG=en_US.UTF-8"]; return [cmd]; } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/shadertools.qbs0000644000175100017510000000564515154533055025323 0ustar runnerrunnerimport "shadertools.js" as ShaderTools QtModule { qtModuleName: "ShaderTools" additionalProductTypes: ["qt.compiled_shader"] property string generatedShadersDir: "shaders" property string qsbName: "qsb" property stringList glslVersions property stringList hlslVersions property stringList mslVersions property bool useQt6Versions: true property bool tessellation: true property string tessellationMode PropertyOptions { name: "tessellationMode" allowedValues: ["triangles", "quads"] } property int tessellationVertexCount property int viewCount property bool batchable: false property int zOrderLocation property bool optimized: false property stringList defines property bool debugInformation: false property bool addResourceData: true property bool useCompiler: !enableLinking Depends { name: "Qt"; submodules: @dependencies@ } version: @version@ hasLibrary: @has_library@ architectures: @archs@ targetPlatform: @targetPlatform@ staticLibsDebug: @staticLibsDebug@ staticLibsRelease: @staticLibsRelease@ dynamicLibsDebug: @dynamicLibsDebug@ dynamicLibsRelease: @dynamicLibsRelease@ linkerFlagsDebug: @linkerFlagsDebug@ linkerFlagsRelease: @linkerFlagsRelease@ frameworksDebug: @frameworksDebug@ frameworksRelease: @frameworksRelease@ frameworkPathsDebug: @frameworkPathsDebug@ frameworkPathsRelease: @frameworkPathsRelease@ libNameForLinkerDebug: @libNameForLinkerDebug@ libNameForLinkerRelease: @libNameForLinkerRelease@ libFilePathDebug: @libFilePathDebug@ libFilePathRelease: @libFilePathRelease@ pluginTypes: @pluginTypes@ moduleConfig: @moduleConfig@ cpp.defines: @defines@ cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @additionalContent@ enableLinking: false Group { condition: useCompiler FileTagger { patterns: ["*.vert"] fileTags: ["qt.shader.vertex", "qt.shader"] } FileTagger { patterns: ["*.tesc", "*.tese"] fileTags: ["qt.shader.tessellation", "qt.shader"] } FileTagger { patterns: ["*.frag"] fileTags: ["qt.shader.fragment", "qt.shader"] } FileTagger { patterns: ["*.comp"] fileTags: ["qt.shader.compute", "qt.shader"] } Rule { inputs: ["qt.shader"] outputFileTags: [ "qt.compiled_shader", "qt.compiled_shader.vertex", "qt.compiled_shader.tessellation", "qt.compiled_shader.fragment", "qt.compiled_shader.compute", "qt.core.resource_data", ] outputArtifacts: ShaderTools.compilerOutputArtifacts(input) prepare: ShaderTools.compilerCommands.apply(ShaderTools, arguments) } } } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/android_support.js0000644000175100017510000004664315154533055026042 0ustar runnerrunnervar File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var Process = require("qbs.Process"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); function prepareDeployQtCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { var theBinary; var nativeLibs = inputs["android.nativelibrary"]; var architectures = []; var triples = []; var qtInstallDirectories = []; var hostArch; var targetArchitecture; if (nativeLibs.length === 1) { theBinary = nativeLibs[0]; hostArch = theBinary.Android.ndk.hostArch; targetArchitecture = theBinary.Android.ndk.abi; if (product.Qt.android_support._multiAbi) { architectures.push(theBinary.Android.ndk.abi); triples.push(theBinary.cpp.toolchainTriple); qtInstallDirectories.push(theBinary.Qt.android_support._qtInstallDir); } } else { for (i = 0; i < nativeLibs.length; ++i) { var candidate = nativeLibs[i]; if (product.Qt.android_support._multiAbi) { if (candidate.product.name === product.name) { architectures.push(candidate.Android.ndk.abi); triples.push(candidate.cpp.toolchainTriple); qtInstallDirectories.push( candidate.Qt.android_support._qtInstallDir); hostArch = candidate.Android.ndk.hostArch; targetArchitecture = candidate.Android.ndk.abi; theBinary = candidate; } } else { if (!candidate.fileName.contains(candidate.product.targetName)) continue; if (!theBinary) { theBinary = candidate; hostArch = theBinary.Android.ndk.hostArch; targetArchitecture = theBinary.Android.ndk.abi; continue; } if (candidate.product.name !== product.name) { continue; // This is not going to be a match } if (candidate.product.name === product.name && theBinary.product.name !== product.name) { theBinary = candidate; // The new candidate is a better match. hostArch = theBinary.Android.ndk.hostArch; targetArchitecture = theBinary.Android.ndk.abi; continue; } throw "Qt applications for Android support only one native binary " + "per package.\n" + "In particular, you cannot build a Qt app for more than " + "one architecture at the same time."; } } } var f = new TextFile(output.filePath, TextFile.WriteOnly); f.writeLine("{"); f.writeLine('"description": "This file was generated by qbs to be read by ' + 'androiddeployqt and should not be modified by hand.",'); if (Utilities.versionCompare(product.Qt.core.version, "6.3.0") >= 0) { var line = '"qt": {'; for (var i = 0; i < qtInstallDirectories.length && i < architectures.length; ++i) { line = line + '"' + architectures[i] + '":"' + qtInstallDirectories[i] + '"'; if (i < qtInstallDirectories.length-1 || i < architectures.length-1) line = line + ','; } line = line + "},"; f.writeLine(line); } else { f.writeLine('"qt": "' + product.Qt.android_support._qtInstallDir + '",'); } f.writeLine('"sdk": "' + product.Android.sdk.sdkDir + '",'); f.writeLine('"sdkBuildToolsRevision": "' + product.Android.sdk.buildToolsVersion + '",'); f.writeLine('"ndk": "' + product.Android.sdk.ndkDir + '",'); f.writeLine('"toolchain-prefix": "llvm",'); f.writeLine('"tool-prefix": "llvm",'); f.writeLine('"useLLVM": true,'); f.writeLine('"ndk-host": "' + hostArch + '",'); if (!product.Qt.android_support._multiAbi) { f.writeLine('"target-architecture": "' + targetArchitecture + '",'); } else { var line = '"architectures": {'; for (var i in architectures) { line = line + '"' + architectures[i] + '":"' + triples[i] + '"'; if (i < architectures.length-1) line = line + ','; } line = line + "},"; f.writeLine(line); } f.writeLine('"qml-root-path": "' + product.Qt.android_support.qmlRootDir + '",'); var deploymentDeps = product.Qt.android_support.deploymentDependencies; if (deploymentDeps && deploymentDeps.length > 0) f.writeLine('"deployment-dependencies": "' + deploymentDeps.join() + '",'); var extraPlugins = product.Qt.android_support.extraPlugins; if (extraPlugins && extraPlugins.length > 0) f.writeLine('"android-extra-plugins": "' + extraPlugins.join() + '",'); var extraLibs = product.Qt.android_support.extraLibs; if (extraLibs && extraLibs.length > 0) { for (var i = 0; i < extraLibs.length; ++i) { if (!FileInfo.isAbsolutePath(extraLibs[i])) { extraLibs[i] = FileInfo.joinPaths(product.sourceDirectory, extraLibs[i]); } } f.writeLine('"android-extra-libs": "' + extraLibs.join() + '",'); } var prefixDirs = product.Qt.android_support.extraPrefixDirs; if (prefixDirs && prefixDirs.length > 0) f.writeLine('"extraPrefixDirs": ' + JSON.stringify(prefixDirs) + ','); var qmlImportPaths = product.Qt.android_support.qmlImportPaths; if (qmlImportPaths && qmlImportPaths.length > 0) f.writeLine('"qml-import-paths": "' + qmlImportPaths.join(',') + '",'); else if ((product.qmlImportPaths instanceof Array) && product.qmlImportPaths.length > 0) f.writeLine('"qml-import-paths": "' + product.qmlImportPaths.join(',') + '",'); if (Utilities.versionCompare(product.Qt.android_support.version, "6.0") >= 0) { f.writeLine('"qml-importscanner-binary": "' + product.Qt.core.qmlImportScannerFilePath + FileInfo.executableSuffix() + '",'); f.writeLine('"rcc-binary": "' + product.Qt.android_support.rccFilePath + FileInfo.executableSuffix() + '",'); if (inputs["qrc"] && inputs["qrc"].length > 0) { var qrcFiles = []; var qrcInputs = inputs["qrc"]; for (i = 0; i < qrcInputs.length; ++i) { qrcFiles.push(qrcInputs[i].filePath); } f.writeLine('"qrcFiles": "' + qrcFiles.join(',') + '",'); } } // QBS-1429 if (!product.Qt.android_support._multiAbi) { f.writeLine('"stdcpp-path": "' + (product.cpp.sharedStlFilePath ? product.cpp.sharedStlFilePath : product.cpp.staticStlFilePath) + '",'); f.writeLine('"application-binary": "' + theBinary.filePath + '"'); } else { f.writeLine('"stdcpp-path": "' + product.Android.sdk.ndkDir + '/toolchains/llvm/prebuilt/' + hostArch + '/sysroot/usr/lib/",'); f.writeLine('"application-binary": "' + theBinary.product.targetName + '"'); } f.writeLine("}"); f.close(); }; return cmd; } function qtManifestOutputArtifacts(inputs) { if (inputs["android.manifest"]) return []; return [{ filePath: "qt_manifest/AndroidManifest.xml", fileTags: ["android.manifest", "qt.android_manifest"] }]; } function qtManifestCommands(product, output) { var cmd = new JavaScriptCommand(); cmd.description = "copying Qt Android manifest template"; cmd.sourceCode = function() { File.copy(FileInfo.joinPaths(product.Qt.android_support._templatesBaseDir, "templates", "AndroidManifest.xml"), output.filePath); }; return cmd; } function deployQtOutputArtifacts(product) { return [ { filePath: "AndroidManifest.xml", fileTags: "android.manifest_final" }, { filePath: product.Qt.android_support._deployQtOutDir + "/res/values/libs.xml", fileTags: "android.resources" }, { filePath: product.Qt.android_support._deployQtOutDir + "/res/values/strings.xml", fileTags: "android.resources" }, { filePath: product.Qt.android_support._deployQtOutDir + "/assets/.dummy", fileTags: "android.assets" }, { filePath: "deployqt.list", fileTags: "android.deployqt_list" }, // androiddeployqt potentially copies more jar files but this one will always be there // since it comes with Qt.core { filePath: FileInfo.joinPaths(product.java.classFilesDir, product.Qt.android_support._qtAndroidJarFileName), fileTags: "bundled_jar" } ]; } function deployQtCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; var copyCmd = new JavaScriptCommand(); copyCmd.description = "copying Qt resource templates"; copyCmd.sourceCode = function() { File.copy(inputs["android.manifest_processed"][0].filePath, product.Qt.android_support._deployQtOutDir + "/AndroidManifest.xml"); File.copy(product.Qt.android_support._templatesBaseDir + "/java/res", product.Qt.android_support._deployQtOutDir + "/res"); File.copy(product.Qt.android_support._templatesBaseDir + "/templates/res/values/libs.xml", product.Qt.android_support._deployQtOutDir + "/res/values/libs.xml"); if (!product.Qt.android_support._multiAbi) { try { File.remove(FileInfo.path(outputs["android.assets"][0].filePath)); } catch (e) { } } else { for (var i in inputs["android.nativelibrary"]) { var input = inputs["android.nativelibrary"][i]; File.copy(input.filePath, FileInfo.joinPaths(product.Qt.android_support._deployQtOutDir, "libs", input.Android.ndk.abi, input.fileName)); } } }; cmds.push(copyCmd); var androidDeployQtArgs = [ "--output", product.Qt.android_support._deployQtOutDir, "--input", inputs["qt_androiddeployqt_input"][0].filePath, "--aux-mode", "--deployment", "bundled", "--android-platform", product.Android.sdk.platform, ]; if (product.Qt.android_support.verboseAndroidDeployQt) androidDeployQtArgs.push("--verbose"); var androidDeployQtCmd = new Command( product.Qt.android_support._androidDeployQtFilePath, androidDeployQtArgs); androidDeployQtCmd.description = "running androiddeployqt"; cmds.push(androidDeployQtCmd); // We do not want androiddeployqt to write directly into our APK base dir, so // we ran it on an isolated directory and now we move stuff over. // We remember the files for which we do that, so if the next invocation // of androiddeployqt creates fewer files, the other ones are removed from // the APK base dir. var moveCmd = new JavaScriptCommand(); moveCmd.description = "processing androiddeployqt output"; moveCmd.sourceCode = function() { File.makePath(product.java.classFilesDir); var libsDir = product.Qt.android_support._deployQtOutDir + "/libs"; var libDir = product.Android.sdk.packageContentsDir + "/lib"; var listFilePath = outputs["android.deployqt_list"][0].filePath; var oldLibs = []; try { var listFile = new TextFile(listFilePath, TextFile.ReadOnly); var listFileLine = listFile.readLine(); while (listFileLine) { oldLibs.push(listFileLine); listFileLine = listFile.readLine(); } listFile.close(); } catch (e) { } listFile = new TextFile(listFilePath, TextFile.WriteOnly); var newLibs = []; var moveLibFiles = function(prefix) { var fullSrcPrefix = FileInfo.joinPaths(libsDir, prefix); var files = File.directoryEntries(fullSrcPrefix, File.Files); for (var i = 0; i < files.length; ++i) { var file = files[i]; var srcFilePath = FileInfo.joinPaths(fullSrcPrefix, file); var targetFilePath; if (file.endsWith(".jar")) targetFilePath = FileInfo.joinPaths(product.java.classFilesDir, file); else targetFilePath = FileInfo.joinPaths(libDir, prefix, file); File.move(srcFilePath, targetFilePath); listFile.writeLine(targetFilePath); newLibs.push(targetFilePath); } var dirs = File.directoryEntries(fullSrcPrefix, File.Dirs | File.NoDotAndDotDot); for (i = 0; i < dirs.length; ++i) moveLibFiles(FileInfo.joinPaths(prefix, dirs[i])); }; moveLibFiles(""); listFile.close(); for (i = 0; i < oldLibs.length; ++i) { if (!newLibs.contains(oldLibs[i])) File.remove(oldLibs[i]); } }; cmds.push(moveCmd); // androiddeployqt doesn't strip the deployed libraries anymore so it has to done here // but only for release build if (product.qbs.buildVariant == "release") { var stripLibsCmd = new JavaScriptCommand(); stripLibsCmd.description = "stripping unneeded symbols from deployed qt libraries"; stripLibsCmd.sourceCode = function() { var stripArgs = ["--strip-all"]; var architectures = []; for (var i in inputs["android.nativelibrary"]) architectures.push(inputs["android.nativelibrary"][i].Android.ndk.abi); for (var i in architectures) { var abiDirPath = FileInfo.joinPaths(product.Android.sdk.packageContentsDir, "lib", architectures[i]); var files = File.directoryEntries(abiDirPath, File.Files); for (var i = 0; i < files.length; ++i) { var filePath = FileInfo.joinPaths(abiDirPath, files[i]); if (FileInfo.suffix(filePath) == "so") { stripArgs.push(filePath); } } } var process = new Process(); process.exec(product.cpp.stripPath, stripArgs, false); } cmds.push(stripLibsCmd); } var correctingCmd = new JavaScriptCommand(); if (product.Qt.android_support._correctQtNetworkDependencies) { correctingCmd.description = "correcting network jar dependency"; correctingCmd.sourceCode = function() { var findNetworkLib = function() { var libsDir = product.Android.sdk.packageContentsDir + "/lib"; var dirList = File.directoryEntries(libsDir, File.Dirs | File.NoDotAndDotDot); for (var i = 0; i < dirList.length; ++i) { var archDir = FileInfo.joinPaths(libsDir, dirList[i]); var fileList = File.directoryEntries(archDir, File.Files); if (fileList) { for (var j = 0; j < fileList.length; ++j) { if (fileList[j].contains("libQt5Network")) { return true; } } } } return false; } if (findNetworkLib()) { var manifestData = new Xml.DomDocument(); var manifestFilePath = product.Qt.android_support._deployQtOutDir + "/AndroidManifest.xml" manifestData.load(manifestFilePath); var rootElem = manifestData.documentElement(); if (!rootElem || !rootElem.isElement() || rootElem.tagName() != "manifest") throw "No manifest tag found in '" + manifestFilePath + "'."; var appElem = rootElem.firstChild("application"); if (!appElem || !appElem.isElement() || appElem.tagName() != "application") throw "No application tag found in '" + manifestFilePath + "'."; var activityElem = appElem.firstChild("activity"); if (!activityElem || !activityElem.isElement() || activityElem.tagName() != "activity") throw "No activity tag found in '" + manifestFilePath + "'."; var metaDataElem = activityElem.firstChild("meta-data"); while (metaDataElem && metaDataElem.isElement()) { if (metaDataElem.attribute("android:name") == "android.app.load_local_jars" ) { var value = metaDataElem.attribute("android:value"); var fileName = "QtAndroidNetwork.jar"; metaDataElem.setAttribute("android:value", value + ":jar/" + fileName); var jarFilePath = FileInfo.joinPaths( product.Qt.android_support._qtInstallDir, "jar", fileName); var targetFilePath = FileInfo.joinPaths(product.java.classFilesDir, fileName); File.copy(jarFilePath, targetFilePath); break; } metaDataElem = metaDataElem.nextSibling("meta-data"); } manifestData.save(outputs["android.manifest_final"][0].filePath, 4); } else { File.move(product.Qt.android_support._deployQtOutDir + "/AndroidManifest.xml", outputs["android.manifest_final"][0].filePath); } }; } else { correctingCmd.description = "copying manifest"; correctingCmd.sourceCode = function() { File.move(product.Qt.android_support._deployQtOutDir + "/AndroidManifest.xml", outputs["android.manifest_final"][0].filePath); } } cmds.push(correctingCmd); return cmds; } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/moc.js0000644000175100017510000001320615154533055023371 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var ModUtils = require("qbs.ModUtils"); var Utilities = require("qbs.Utilities"); function args(product, input, outputs) { var defines = product.cpp.compilerDefinesByLanguage; if (input.fileTags.contains("objcpp")) defines = ModUtils.flattenDictionary(defines["objcpp"]) || []; else if (input.fileTags.contains("cpp") || input.fileTags.contains("hpp")) defines = ModUtils.flattenDictionary(defines["cpp"]) || []; else defines = []; defines = defines.uniqueConcat(product.cpp.platformDefines); defines = defines.uniqueConcat(input.cpp.defines); var includePaths = input.cpp.includePaths; includePaths = includePaths.uniqueConcat(input.cpp.systemIncludePaths); var useCompilerPaths = product.Qt.core.versionMajor >= 5; if (useCompilerPaths) { includePaths = includePaths.uniqueConcat(input.cpp.compilerIncludePaths); } var frameworkPaths = product.cpp.frameworkPaths; frameworkPaths = frameworkPaths.uniqueConcat( product.cpp.systemFrameworkPaths); if (useCompilerPaths) { frameworkPaths = frameworkPaths.uniqueConcat( product.cpp.compilerFrameworkPaths); } var pluginMetaData = product.Qt.core.pluginMetaData; var args = []; if (product.Qt.core._generateMetaTypesFile) args.push("--output-json"); var outputFileName; for (tag in outputs) { if (tag !== "qt.core.metatypes.in") { outputFileName = outputs[tag][0].filePath; break; } } args = args.concat( defines.map(function(item) { return '-D' + item; }), includePaths.map(function(item) { return '-I' + item; }), frameworkPaths.map(function(item) { return '-F' + item; }), pluginMetaData.map(function(item) { return '-M' + item; }), product.Qt.core.mocFlags, '-o', outputFileName, input.filePath); return args; } function fullPath(product) { if (Utilities.versionCompare(product.Qt.core.version, "6.1") < 0) return product.Qt.core.binPath + '/' + product.Qt.core.mocName; return product.Qt.core.libExecPath + '/' + product.Qt.core.mocName; } function outputArtifacts(project, product, inputs, input) { var mocInfo = QtMocScanner.apply(input); if (!mocInfo.hasQObjectMacro) return []; var artifact = { fileTags: ["unmocable"] }; if (mocInfo.hasPluginMetaDataMacro) artifact.explicitlyDependsOn = ["qt_plugin_metadata"]; if (input.fileTags.contains("hpp")) { artifact.filePath = input.Qt.core.generatedHeadersDir + "/moc_" + input.completeBaseName + ".cpp"; var amalgamate = input.Qt.core.combineMocOutput; artifact.fileTags.push(mocInfo.mustCompile ? (amalgamate ? "moc_cpp" : "cpp") : "hpp"); } else { artifact.filePath = input.Qt.core.generatedHeadersDir + '/' + input.completeBaseName + ".moc"; artifact.fileTags.push("hpp"); } var artifacts = [artifact]; if (product.Qt.core._generateMetaTypesFile) artifacts.push({filePath: artifact.filePath + ".json", fileTags: "qt.core.metatypes.in"}); return artifacts; } function commands(project, product, inputs, outputs, input, output) { var cmd = new Command(fullPath(product), args(product, input, outputs)); cmd.description = 'moc ' + input.fileName; cmd.highlight = 'codegen'; cmd.responseFileUsagePrefix = "@"; return cmd; } function generateMocCppCommands(inputs, output) { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.highlight = "codegen"; cmd.sourceCode = function() { ModUtils.mergeCFiles(inputs["moc_cpp"], output.filePath); }; return [cmd]; } function generateMetaTypesCommands(inputs, output) { var inputFilePaths = inputs["qt.core.metatypes.in"].map(function(a) { return a.filePath; }); var cmd = new Command(fullPath(product), ["--collect-json", "-o", output.filePath].concat(inputFilePaths)); cmd.description = "generating " + output.fileName; cmd.highlight = "codegen"; cmd.responseFileUsagePrefix = "@"; return cmd; } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/module.qbs0000644000175100017510000000200315154533055024242 0ustar runnerrunnerQtModule { qtModuleName: @name@ Depends { name: "Qt"; submodules: @dependencies@} version: @version@ architectures: @archs@ targetPlatform: @targetPlatform@ hasLibrary: @has_library@ staticLibsDebug: @staticLibsDebug@ staticLibsRelease: @staticLibsRelease@ dynamicLibsDebug: @dynamicLibsDebug@ dynamicLibsRelease: @dynamicLibsRelease@ linkerFlagsDebug: @linkerFlagsDebug@ linkerFlagsRelease: @linkerFlagsRelease@ frameworksDebug: @frameworksDebug@ frameworksRelease: @frameworksRelease@ frameworkPathsDebug: @frameworkPathsDebug@ frameworkPathsRelease: @frameworkPathsRelease@ libNameForLinkerDebug: @libNameForLinkerDebug@ libNameForLinkerRelease: @libNameForLinkerRelease@ libFilePathDebug: @libFilePathDebug@ libFilePathRelease: @libFilePathRelease@ pluginTypes: @pluginTypes@ moduleConfig: @moduleConfig@ cpp.defines: @defines@ cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @additionalContent@ } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/scxml.qbs0000644000175100017510000000605215154533055024113 0ustar runnerrunnerimport qbs.FileInfo import qbs.Utilities QtModule { qtModuleName: "Scxml" property string _qscxmlcDir: Utilities.versionCompare(Qt.core.version, "6.3") >= 0 ? Qt.core.libExecPath : Qt.core.binPath property string qscxmlcName: "qscxmlc" property string className property string namespace property bool generateStateMethods property stringList additionalCompilerFlags Rule { inputs: ["qt.scxml.compilable"] Artifact { filePath: FileInfo.joinPaths(input.moduleProperty("Qt.core", "generatedHeadersDir"), input.baseName + ".h") fileTags: ["hpp", "unmocable"] } Artifact { filePath: input.baseName + ".cpp" fileTags: ["cpp", "unmocable", "qt.untranslatable"] } prepare: { var compilerName = product.moduleProperty("Qt.scxml", "qscxmlcName"); var compilerPath = FileInfo.joinPaths(input.Qt.scxml._qscxmlcDir, compilerName); var args = ["--header", outputs["hpp"][0].filePath, "--impl", outputs["cpp"][0].filePath]; var cxx98 = input.moduleProperty("cpp", "cxxLanguageVersion") === "c++98"; if (cxx98) args.push("-no-c++11"); var className = input.moduleProperty("Qt.scxml", "className"); if (className) args.push("--classname", className); var namespace = input.moduleProperty("Qt.scxml", "namespace"); if (namespace) args.push("--namespace", namespace); if (input.Qt.scxml.generateStateMethods && Utilities.versionCompare(product.Qt.scxml.version, "5.9") >= 0) { args.push("--statemethods"); } if (input.Qt.scxml.additionalCompilerFlags) args = args.concat(input.Qt.scxml.additionalCompilerFlags); args.push(input.filePath); var cmd = new Command(compilerPath, args); cmd.description = "compiling " + input.fileName; cmd.highlight = "codegen"; return [cmd]; } } version: @version@ architectures: @archs@ targetPlatform: @targetPlatform@ staticLibsDebug: @staticLibsDebug@ staticLibsRelease: @staticLibsRelease@ dynamicLibsDebug: @dynamicLibsDebug@ dynamicLibsRelease: @dynamicLibsRelease@ linkerFlagsDebug: @linkerFlagsDebug@ linkerFlagsRelease: @linkerFlagsRelease@ frameworksDebug: @frameworksDebug@ frameworksRelease: @frameworksRelease@ frameworkPathsDebug: @frameworkPathsDebug@ frameworkPathsRelease: @frameworkPathsRelease@ libNameForLinkerDebug: @libNameForLinkerDebug@ libNameForLinkerRelease: @libNameForLinkerRelease@ libFilePathDebug: @libFilePathDebug@ libFilePathRelease: @libFilePathRelease@ pluginTypes: @pluginTypes@ moduleConfig: @moduleConfig@ cpp.defines: @defines@ cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @additionalContent@ } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/dbus.js0000644000175100017510000000600415154533055023546 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); function outputFileName(input, suffix) { var parts = input.fileName.split('.').filter(function(s) { return s.length > 0; }); if (parts.length === 0) throw "Cannot run qdbusxml2cpp on '" + input.filePath + "': Unsuitable file name."; var outputBaseName = parts.length === 1 ? parts[0] : parts[parts.length - 2]; return outputBaseName.toLowerCase() + suffix; } function createCommands(product, input, outputs, option) { var exe = ModUtils.moduleProperty(product, "binPath") + '/' + ModUtils.moduleProperty(product, "xml2cppName"); var hppOutput = outputs["hpp"][0]; var hppArgs = ModUtils.moduleProperty(product, "xml2CppHeaderFlags"); hppArgs.push(option, hppOutput.fileName + ':', input.filePath); // Can't use filePath on Windows var hppCmd = new Command(exe, hppArgs) hppCmd.description = "qdbusxml2cpp " + input.fileName + " -> " + hppOutput.fileName; hppCmd.highlight = "codegen"; hppCmd.workingDirectory = FileInfo.path(hppOutput.filePath); var cppOutput = outputs["cpp"][0]; var cppArgs = ModUtils.moduleProperty(product, "xml2CppSourceFlags"); cppArgs.push("-i", hppOutput.filePath, option, ':' + cppOutput.fileName, input.filePath); var cppCmd = new Command(exe, cppArgs) cppCmd.description = "qdbusxml2cpp " + input.fileName + " -> " + cppOutput.fileName; cppCmd.highlight = "codegen"; cppCmd.workingDirectory = FileInfo.path(cppOutput.filePath); return [hppCmd, cppCmd]; } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/plugin_support.qbs0000644000175100017510000000544215154533055026061 0ustar runnerrunnerModule { // Set by user. property varList pluginsByType property bool linkPlugins: product.type && (product.type.contains("application") || product.type.contains("sharedlibrary")) // Set by Qt modules. property stringList pluginTypes // Set by setup-qt. readonly property var allPluginsByType: @allPluginsByType@ readonly property stringList nonEssentialPlugins: @nonEssentialPlugins@ // Derived. readonly property var defaultPluginsByType: { var map = {}; for (var i = 0; i < (pluginTypes || []).length; ++i) { var pType = pluginTypes[i]; map[pType] = (allPluginsByType[pType] || []).filter(function(p) { return !nonEssentialPlugins.contains(p); }); } return map; } readonly property var effectivePluginsByType: { var ppt = pluginsByType || []; var eppt = {}; for (var i = 0; i < ppt.length; ++i) { var listEntry = ppt[i]; for (var pluginType in listEntry) { var newValue = listEntry[pluginType]; if (!newValue) newValue = []; else if (typeof newValue == "string") newValue = [newValue]; if (!newValue instanceof Array) throw "Invalid value '" + newValue + "' in Qt.plugin_support.pluginsByType"; eppt[pluginType] = (eppt[pluginType] || []).uniqueConcat(newValue); } } var dppt = defaultPluginsByType; for (var pluginType in dppt) { if (!eppt[pluginType]) eppt[pluginType] = dppt[pluginType]; } return eppt; } readonly property stringList enabledPlugins: { var list = []; var eppt = effectivePluginsByType; for (var t in eppt) Array.prototype.push.apply(list, eppt[t]); return list; } validate: { var ppt = pluginsByType; if (!ppt) return; var appt = allPluginsByType; for (var i = 0; i < ppt.length; ++i) { for (var pluginType in ppt[i]) { var requestedPlugins = ppt[i][pluginType]; if (!requestedPlugins) continue; var availablePlugins = appt[pluginType] || []; if (typeof requestedPlugins === "string") requestedPlugins = [requestedPlugins]; for (var j = 0; j < requestedPlugins.length; ++j) { if (!availablePlugins.contains(requestedPlugins[j])) { throw "Plugin '" + requestedPlugins[j] + "' of type '" + pluginType + "' was requested, but is not available."; } } } } } } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/core.js0000644000175100017510000000364215154533055023546 0ustar runnerrunnervar TextFile = require("qbs.TextFile"); function lreleaseCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var inputFilePaths; if (product.Qt.core.lreleaseMultiplexMode) inputFilePaths = inputs["ts"].map(function(artifact) { return artifact.filePath; }); else inputFilePaths = [input.filePath]; var args = ['-silent', '-qm', output.filePath].concat(inputFilePaths); var cmd = new Command(product.Qt.core.binPath + '/' + product.Qt.core.lreleaseName, args); cmd.description = 'creating ' + output.fileName; cmd.highlight = 'filegen'; return cmd; } function qhelpGeneratorCommands(product, input, output) { var args = [input.filePath]; args = args.concat(product.Qt.core.helpGeneratorArgs); args.push("-o"); args.push(output.filePath); var cmd = new Command( product.Qt.core.helpGeneratorLibExecPath + "/qhelpgenerator", args); cmd.description = 'qhelpgenerator ' + input.fileName; cmd.highlight = 'filegen'; cmd.stdoutFilterFunction = function(output) { return ""; }; return cmd; } function wasmQtHtmlCommands(product, output) { var cmd = new JavaScriptCommand(); cmd.description = "Generating Qt html for " + product.targetName; cmd.highlight = "filegen"; cmd.sourceCode = function() { var platformsPath = product.Qt.core.pluginPath + "/platforms"; var wasmShellFile = new TextFile(platformsPath + "/wasm_shell.html"); var content = wasmShellFile.readAll(); var appNameTemplate = "@APPNAME@"; var finalContent = content.replaceAll(appNameTemplate, product.name); var preload = "@PRELOAD@";//TODO: figure out what it's for finalContent = finalContent.replace(preload, ""); var finalHtmlFile = new TextFile(output.filePath, OpenMode = TextFile.WriteOnly); finalHtmlFile.write(finalContent); } return cmd; } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/qmlcache.qbs0000644000175100017510000000563015154533055024543 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.Process import qbs.Utilities Module { additionalProductTypes: ["qt.qml.qmlc", "qt.qml.jsc"] validate: { if (!qmlcachegenProbe.found) throw "qmlcachegen unsupported for this target"; } property string qmlCacheGenPath: FileInfo.joinPaths(Qt.core.qmlLibExecPath, "qmlcachegen") + FileInfo.executableSuffix() 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"; if (arch.startsWith("armv")) return "arm"; return arch; } var args = ["--target-architecture", translateArch(qbs.architecture)]; return args; } 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; if (!found) { var msg = "QML cache generation was requested but is unsupported on " + "architecture '" + arch + "'."; console.warn(msg); } } finally { process.close(); } } } Rule { condition: qmlcachegenProbe.found inputs: ["qt.qml.qml", "qt.qml.js"] outputArtifacts: [{ filePath: input.fileName + 'c', fileTags: input.fileTags.filter(function(tag) { return tag === "qt.qml.qml" || tag === "qt.qml.js"; })[0] + 'c' }] outputFileTags: ["qt.qml.qmlc", "qt.qml.jsc"] prepare: { var args = input.Qt.qmlcache._targetArgs.concat(input.filePath, "-o", output.filePath); var cmd = new Command(input.Qt.qmlcache.qmlCacheGenPath, args); cmd.description = "precompiling " + input.fileName; cmd.highlight = "compiler"; return cmd; } } Group { condition: product.Qt.qmlcache.installDir !== undefined fileTagsFilter: product.Qt.qmlcache.additionalProductTypes qbs.install: true qbs.installDir: product.Qt.qmlcache.installDir } } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/quick.js0000644000175100017510000001571015154533055023731 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); var Process = require("qbs.Process"); var Rcc = require("rcc.js"); var TextFile = require("qbs.TextFile"); function scanQrc(product, qrcFilePath) { var absInputDir = FileInfo.path(qrcFilePath); var result = []; var process = new Process(); try { var rcc = FileInfo.joinPaths(Rcc.fullPath(product) + FileInfo.executableSuffix()); var exitCode = process.exec(rcc, ["--list", qrcFilePath], true); for (;;) { var line = process.readLine(); if (!line) break; line = line.trim(); line = FileInfo.relativePath(absInputDir, line); result.push(line); } } finally { process.close(); } return result; } function qtQuickCompilerOutputName(filePath) { var str = filePath.replace(/\//g, '_'); var i = str.lastIndexOf('.'); if (i != -1) str = str.substr(0, i) + '_' + str.substr(i + 1); str += ".cpp"; return str; } function qtQuickResourceFileOutputName(fileName) { return fileName.replace(/\.qrc$/, "_qtquickcompiler.qrc"); } function contentFromQrc(product, qrcFilePath) { var supportsFiltering = product.Qt.quick._supportsQmlJsFiltering; var filesInQrc = scanQrc(product, qrcFilePath); var qmlJsFiles = filesInQrc.filter(function (filePath) { return (/\.(mjs|js|qml)$/).test(filePath); } ); var content = {}; if (!supportsFiltering || filesInQrc.length - qmlJsFiles.length > 0) { content.newQrcFileName = qtQuickResourceFileOutputName(input.fileName); } content.qmlJsFiles = qmlJsFiles.map(function (filePath) { return { input: filePath, output: qtQuickCompilerOutputName(filePath) }; }); return content; } function generateCompilerInputCommands(product, input, output) { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { var content = contentFromQrc(product, input.filePath); content.qrcFilePath = input.filePath; var tf = new TextFile(output.filePath, TextFile.WriteOnly); tf.write(JSON.stringify(content)); tf.close(); } return cmd; } function compilerOutputArtifacts(product, inputs) { var infos = []; inputs["qt.quick.qrcinfo"].forEach(function (input) { var tf = new TextFile(input.filePath, TextFile.ReadOnly); infos.push(JSON.parse(tf.readAll())); tf.close(); }); var result = []; infos.forEach(function (info) { if (info.newQrcFileName) { result.push({ filePath: info.newQrcFileName, fileTags: ["qrc"] }); } info.qmlJsFiles.forEach(function (qmlJsFile) { result.push({ filePath: qmlJsFile.output, fileTags: ["cpp"] }); }); }); result.push({ filePath: product.Qt.quick._generatedLoaderFileName, fileTags: ["cpp"] }); return result; } function compilerCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var infos = []; inputs["qt.quick.qrcinfo"].forEach(function (input) { var tf = new TextFile(input.filePath, TextFile.ReadOnly); infos.push(JSON.parse(tf.readAll())); tf.close(); }); var cmds = []; var qmlCompiler = product.Qt.quick.compilerFilePath; var useCacheGen = product.Qt.quick._compilerIsQmlCacheGen; var cmd; var loaderFlags = []; function findOutput(fileName) { for (var k in outputs) { for (var i in outputs[k]) { if (outputs[k][i].fileName === fileName) return outputs[k][i]; } } throw new Error("Qt Quick compiler rule: Cannot find output artifact " + fileName + "."); } infos.forEach(function (info) { if (info.newQrcFileName) { loaderFlags.push("--resource-file-mapping=" + FileInfo.fileName(info.qrcFilePath) + '=' + info.newQrcFileName); // Qt 5.15 doesn't really filter anyting but merely copies the qrc // content to the new location var args = ["--filter-resource-file", info.qrcFilePath]; if (useCacheGen) args.push("-o"); args.push(findOutput(info.newQrcFileName).filePath); cmd = new Command(qmlCompiler, args); cmd.description = "generating " + info.newQrcFileName; cmds.push(cmd); } else { loaderFlags.push("--resource-file-mapping=" + info.qrcFilePath); } info.qmlJsFiles.forEach(function (qmlJsFile) { var args = ["--resource=" + info.qrcFilePath, qmlJsFile.input]; if (useCacheGen) args.push("-o"); args.push(findOutput(qmlJsFile.output).filePath); cmd = new Command(qmlCompiler, args); cmd.description = "generating " + qmlJsFile.output; cmd.workingDirectory = FileInfo.path(info.qrcFilePath); cmds.push(cmd); }); }); var args = loaderFlags.concat(infos.map(function (info) { return info.qrcFilePath; })); if (useCacheGen) args.push("-o"); args.push(findOutput(product.Qt.quick._generatedLoaderFileName).filePath); cmd = new Command(qmlCompiler, args); cmd.description = "generating loader source"; cmds.push(cmd); return cmds; } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/gui.qbs0000644000175100017510000000466315154533055023557 0ustar runnerrunnerimport qbs.FileInfo import qbs.ModUtils import qbs.Utilities QtModule { qtModuleName: "Gui" property string uicName: "uic" FileTagger { patterns: ["*.ui"] fileTags: ["ui"] } Rule { inputs: ["ui"] Artifact { filePath: FileInfo.joinPaths(input.moduleProperty("Qt.core", "generatedHeadersDir"), 'ui_' + input.completeBaseName + '.h') fileTags: ["hpp", "qt.untranslatable"] } prepare: { var uicPath = Utilities.versionCompare(product.Qt.gui.version, "6.1") < 0 ? product.Qt.core.binPath + '/' + product.Qt.gui.uicName : product.Qt.core.libExecPath + '/' + product.Qt.gui.uicName; var cmd = new Command(uicPath, [input.filePath, '-o', output.filePath]); cmd.description = 'generating ' + output.fileName; cmd.highlight = 'codegen'; return cmd; } } property string defaultQpaPlugin: @defaultQpaPlugin@ version: @version@ architectures: @archs@ targetPlatform: @targetPlatform@ staticLibsDebug: @staticLibsDebug@ staticLibsRelease: @staticLibsRelease@ dynamicLibsDebug: @dynamicLibsDebug@ dynamicLibsRelease: @dynamicLibsRelease@ linkerFlagsDebug: @linkerFlagsDebug@ linkerFlagsRelease: @linkerFlagsRelease@ frameworksDebug: @frameworksDebug@ frameworksRelease: @frameworksRelease@ frameworkPathsDebug: @frameworkPathsDebug@ frameworkPathsRelease: @frameworkPathsRelease@ libNameForLinkerDebug: @libNameForLinkerDebug@ libNameForLinkerRelease: @libNameForLinkerRelease@ libFilePathDebug: @libFilePathDebug@ libFilePathRelease: @libFilePathRelease@ pluginTypes: @pluginTypes@ cpp.entryPoint: qbs.targetOS.containsAny(["ios", "tvos"]) && Utilities.versionCompare(version, "5.6.0") >= 0 ? "_qt_main_wrapper" : undefined cpp.defines: @defines@ cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ Properties { condition: Qt.core.staticBuild && qbs.targetOS.contains("ios") cpp.frameworks: base.concat(["UIKit", "QuartzCore", "CoreText", "CoreGraphics", "Foundation", "CoreFoundation", "AudioToolbox"]) } Properties { condition: undefined cpp.frameworks: base } @additionalContent@ } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/rcc.js0000644000175100017510000001005215154533055023356 0ustar runnerrunnervar FileInfo = require("qbs.FileInfo"); var Utilities = require("qbs.Utilities"); var Xml = require("qbs.Xml"); function fullPath(product) { if (Utilities.versionCompare(product.Qt.core.version, "6.1") < 0) return product.Qt.core.binPath + '/' + product.Qt.core.rccName; return product.Qt.core.libExecPath + '/' + product.Qt.core.rccName; } function generateQrcFileCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var doc = new Xml.DomDocument("RCC"); var rccNode = doc.createElement("RCC"); rccNode.setAttribute("version", "1.0"); doc.appendChild(rccNode); var inputsByPrefix = {} for (var i = 0; i < inputs["qt.core.resource_data"].length; ++i) { var inp = inputs["qt.core.resource_data"][i]; var prefix = inp.Qt.core.resourcePrefix; var inputsList = inputsByPrefix[prefix] || []; inputsList.push(inp); inputsByPrefix[prefix] = inputsList; } for (var prefix in inputsByPrefix) { var qresourceNode = doc.createElement("qresource"); qresourceNode.setAttribute("prefix", prefix); rccNode.appendChild(qresourceNode); for (var i = 0; i < inputsByPrefix[prefix].length; ++i) { var inp = inputsByPrefix[prefix][i]; var fullResPath = inp.filePath; var baseDir = inp.Qt.core.resourceSourceBase; var resAlias = baseDir ? FileInfo.relativePath(baseDir, fullResPath) : inp.fileName; var fileNode = doc.createElement("file"); fileNode.setAttribute("alias", resAlias); qresourceNode.appendChild(fileNode); var fileTextNode = doc.createTextNode(fullResPath); fileNode.appendChild(fileTextNode); } } doc.save(output.filePath, 4); }; return [cmd]; } function rccOutputArtifacts(input) { var artifact = { filePath: "qrc_" + input.completeBaseName + ".cpp", fileTags: ["cpp"] }; if (input.Qt.core.enableBigResources) artifact.fileTags.push("cpp_intermediate_object"); return [artifact]; } function rccCommands(product, input, output) { var args = [input.filePath, "-name", FileInfo.completeBaseName(input.filePath), "-o", output.filePath]; if (input.Qt.core.enableBigResources) args.push("-pass", "1"); if (product.Qt.core.disabledFeatures.contains("zstd") && Utilities.versionCompare(product.Qt.core.version, "5.13") >= 0) { args.push("--no-zstd"); } var cmd = new Command(fullPath(product), args); cmd.description = "rcc " + (input.Qt.core.enableBigResources ? "(pass 1) " : "") + input.fileName; cmd.highlight = 'codegen'; return cmd; } function rccPass2Commands(product, input, output) { function findChild(artifact, predicate) { var children = artifact.children; var len = children.length; for (var i = 0; i < len; ++i) { var child = children[i]; if (predicate(child)) return child; child = findChild(child, predicate); if (child) return child; } return undefined; } var qrcArtifact = findChild(input, function(c) { return c.fileTags.contains("qrc"); }); var cppArtifact = findChild(input, function(c) { return c.fileTags.contains("cpp"); }); var cmd = new Command(fullPath(product), [qrcArtifact.filePath, "-temp", input.filePath, "-name", FileInfo.completeBaseName(input.filePath), "-o", output.filePath, "-pass", "2"]); cmd.description = "rcc (pass 2) " + qrcArtifact.fileName; cmd.highlight = 'codegen'; return cmd; } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/quick.qbs0000644000175100017510000001116415154533055024101 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.Utilities import 'quick.js' as QC QtModule { qtModuleName: @name@ Depends { name: "Qt"; submodules: @dependencies@ } version: @version@ hasLibrary: @has_library@ architectures: @archs@ targetPlatform: @targetPlatform@ staticLibsDebug: @staticLibsDebug@ staticLibsRelease: @staticLibsRelease@ dynamicLibsDebug: @dynamicLibsDebug@ dynamicLibsRelease: @dynamicLibsRelease@ linkerFlagsDebug: @linkerFlagsDebug@ linkerFlagsRelease: @linkerFlagsRelease@ frameworksDebug: @frameworksDebug@ frameworksRelease: @frameworksRelease@ frameworkPathsDebug: @frameworkPathsDebug@ frameworkPathsRelease: @frameworkPathsRelease@ libNameForLinkerDebug: @libNameForLinkerDebug@ libNameForLinkerRelease: @libNameForLinkerRelease@ libFilePathDebug: @libFilePathDebug@ libFilePathRelease: @libFilePathRelease@ pluginTypes: @pluginTypes@ moduleConfig: @moduleConfig@ cpp.defines: @defines@ cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @additionalContent@ readonly property bool _compilerIsQmlCacheGen: Utilities.versionCompare(Qt.core.version, "5.11") >= 0 readonly property bool _supportsQmlJsFiltering: Utilities.versionCompare(Qt.core.version, "5.15") < 0 readonly property string _generatedLoaderFileName: _compilerIsQmlCacheGen ? "qmlcache_loader.cpp" : "qtquickcompiler_loader.cpp" property string _compilerBaseDir: _compilerIsQmlCacheGen ? Qt.core.qmlLibExecPath : Qt.core.binPath property string compilerBaseName: (_compilerIsQmlCacheGen ? "qmlcachegen" : "qtquickcompiler") property string compilerFilePath: FileInfo.joinPaths(_compilerBaseDir, compilerBaseName + FileInfo.executableSuffix()) property bool compilerAvailable: File.exists(compilerFilePath); property bool useCompiler: compilerAvailable && !_compilerIsQmlCacheGen Group { condition: useCompiler FileTagger { patterns: "*.qrc" fileTags: ["qt.quick.qrc"] priority: 100 } Scanner { inputs: 'qt.quick.qrc' searchPaths: [FileInfo.path(input.filePath)] scan: QC.scanQrc(product, input.filePath) } Rule { inputs: ["qt.quick.qrc"] Artifact { filePath: input.fileName + ".json" fileTags: ["qt.quick.qrcinfo"] } prepare: QC.generateCompilerInputCommands(product, input, output) } Rule { inputs: ["qt.quick.qrcinfo"] outputFileTags: ["cpp", "qrc", "qt.untranslatable"] multiplex: true outputArtifacts: QC.compilerOutputArtifacts(product, inputs) prepare: QC.compilerCommands.apply(QC, arguments) } } } qbs-src-3.2.0/share/qbs/module-providers/Qt/templates/qml.qbs0000644000175100017510000001074015154533055023555 0ustar runnerrunnerimport qbs.FileInfo import qbs.Host import qbs.TextFile import "qml.js" as Qml QtModule { qtModuleName: "Qml" Depends { name: "Qt"; submodules: @dependencies@} property string qmlImportScannerName: Qt.core.qmlImportScannerName property string qmlImportScannerFilePath: Qt.core.qmlImportScannerFilePath property string qmlPath: @qmlPath@ property bool generateCacheFiles: false Depends { name: "Qt.qmlcache"; condition: generateCacheFiles; required: false } readonly property bool cachingEnabled: generateCacheFiles && Qt.qmlcache.present property string qmlCacheGenPath Properties { condition: cachingEnabled Qt.qmlcache.qmlCacheGenPath: qmlCacheGenPath || original Qt.qmlcache.installDir: cacheFilesInstallDir || original } property string cacheFilesInstallDir readonly property string pluginListFilePathDebug: product.buildDirectory + "/plugins.list.d" readonly property string pluginListFilePathRelease: product.buildDirectory + "/plugins.list" property bool linkPlugins: isStaticLibrary && Qt.plugin_support.linkPlugins version: @version@ hasLibrary: @has_library@ architectures: @archs@ targetPlatform: @targetPlatform@ staticLibsDebug: (linkPlugins ? ['@' + pluginListFilePathDebug] : []).concat(@staticLibsDebug@) staticLibsRelease: (linkPlugins ? ['@' + pluginListFilePathRelease] : []).concat(@staticLibsRelease@) dynamicLibsDebug: @dynamicLibsDebug@ dynamicLibsRelease: @dynamicLibsRelease@ linkerFlagsDebug: @linkerFlagsDebug@ linkerFlagsRelease: @linkerFlagsRelease@ frameworksDebug: @frameworksDebug@ frameworksRelease: @frameworksRelease@ frameworkPathsDebug: @frameworkPathsDebug@ frameworkPathsRelease: @frameworkPathsRelease@ libNameForLinkerDebug: @libNameForLinkerDebug@ libNameForLinkerRelease: @libNameForLinkerRelease@ libFilePathDebug: @libFilePathDebug@ libFilePathRelease: @libFilePathRelease@ pluginTypes: @pluginTypes@ moduleConfig: @moduleConfig@ cpp.defines: @defines@ cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @additionalContent@ FileTagger { patterns: ["*.qml"] fileTags: ["qt.qml.qml"] } FileTagger { patterns: ["*.js"] fileTags: ["qt.qml.js"] } // Type registration property string importName property string importVersion: product.version readonly property stringList _importVersionParts: (importVersion || "").split(".") property string typesFileName: { if (product.type && product.type.contains("application")) return product.targetName + ".qmltypes"; return "plugins.qmltypes"; } property string typesInstallDir property stringList extraMetaTypesFiles Group { condition: importName product.Qt.core.generateMetaTypesFile: true Rule { inputs: "qt.core.metatypes" multiplex: true explicitlyDependsOnFromDependencies: "qt.core.metatypes" Artifact { filePath: product.targetName.toLowerCase() + "_qmltyperegistrations.cpp" fileTags: ["cpp", "unmocable", "qt.untranslatable"] } Artifact { filePath: product.Qt.qml.typesFileName fileTags: "qt.qml.types" qbs.install: product.Qt.qml.typesInstallDir qbs.installDir: product.Qt.qml.typesInstallDir } prepare: Qml.typeRegistrarCommands.apply(Qml, arguments) } } Rule { condition: linkPlugins multiplex: true requiresInputs: false inputs: ["qt.qml.qml"] outputFileTags: ["cpp", "qt.qml.pluginlist", "qt.untranslatable"] outputArtifacts: Qml.generatePluginImportOutputArtifacts(product, inputs) prepare: Qml.generatePluginImportCommands.apply(Qml, arguments) } validate: { if (importName) { if (!importVersion) throw "Qt.qml.importVersion must be set if Qt.qml.importName is set."; var isInt = function(value) { return !isNaN(value) && parseInt(Number(value)) == value && !isNaN(parseInt(value, 10)); } if (!isInt(_importVersionParts[0]) || (_importVersionParts.length > 1 && !isInt(_importVersionParts[1]))) { throw "Qt.qml.importVersion must be of the form x.y, where x and y are integers."; } } } } qbs-src-3.2.0/share/qbs/module-providers/Qt/setup-qt.js0000644000175100017510000005776515154533055022421 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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$ ** ****************************************************************************/ var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var ProviderUtils = require("qbs.ProviderUtils"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); function extractQbsArchs(module, qtProps) { if (qtProps.mkspecName.startsWith("macx-")) { var archs = []; if (module.libFilePathRelease) archs = Utilities.getArchitecturesFromBinary(module.libFilePathRelease); return archs; } var qbsArch = Utilities.canonicalArchitecture(qtProps.architecture); if (qbsArch === "arm" && qtProps.mkspecPath.contains("android")) qbsArch = "armv7a"; // Qt4 has "QT_ARCH = windows" in qconfig.pri for both MSVC and mingw. if (qbsArch === "windows") return [] return [qbsArch]; } function qbsTargetPlatformFromQtMkspec(qtProps) { var mkspec = qtProps.mkspecName; var idx = mkspec.lastIndexOf('/'); if (idx !== -1) mkspec = mkspec.slice(idx + 1); if (mkspec.startsWith("aix-")) return "aix"; if (mkspec.startsWith("android-")) return "android"; if (mkspec.startsWith("cygwin-")) return "windows"; if (mkspec.startsWith("darwin-")) return "macos"; if (mkspec.startsWith("freebsd-")) return "freebsd"; if (mkspec.startsWith("haiku-")) return "haiku"; if (mkspec.startsWith(("hpux-")) || mkspec.startsWith(("hpuxi-"))) return "hpux"; if (mkspec.startsWith("hurd-")) return "hurd"; if (mkspec.startsWith("integrity-")) return "integrity"; if (mkspec.startsWith("linux-")) return "linux"; if (mkspec.startsWith("macx-")) { if (mkspec.startsWith("macx-ios-")) return "ios"; if (mkspec.startsWith("macx-tvos-")) return "tvos"; if (mkspec.startsWith("macx-watchos-")) return "watchos"; return "macos"; } if (mkspec.startsWith("netbsd-")) return "netbsd"; if (mkspec.startsWith("openbsd-")) return "openbsd"; if (mkspec.startsWith("qnx-")) return "qnx"; if (mkspec.startsWith("solaris-")) return "solaris"; if (mkspec.startsWith("vxworks-")) return "vxworks"; if (ProviderUtils.isDesktopWindowsQt(qtProps) || mkspec.startsWith("winrt-")) return "windows"; if (mkspec.startsWith("wasm-")) return "wasm-emscripten"; } function pathToJSLiteral(path) { return JSON.stringify(FileInfo.fromNativeSeparators(path)); } function defaultQpaPlugin(module, qtProps) { if (qtProps.qtMajorVersion < 5) return undefined; function findInPriFile(filePath) { var priFile = new TextFile(filePath); var magicString = "QT_DEFAULT_QPA_PLUGIN ="; while (!priFile.atEof()) { var line = priFile.readLine().trim(); if (line.startsWith(magicString)) return line.slice(magicString.length).trim(); } }; if (qtProps.qtMajorVersion === 5 && qtProps.qtMinorVersion < 8) { var pluginName = findInPriFile(FileInfo.joinPaths(qtProps.mkspecBasePath, "qconfig.pri")); if (pluginName) return pluginName; } else { pluginName = findInPriFile(FileInfo.joinPaths(qtProps.mkspecBasePath, "modules", "qt_lib_gui.pri")); if (pluginName) return pluginName; var gtGuiHeadersPath = qtProps.frameworkBuild ? FileInfo.joinPaths(qtProps.libraryPath, "QtGui.framework", "Headers") : FileInfo.joinPaths(qtProps.includePath, "QtGui"); var qtGuiConfigHeader = FileInfo.joinPaths(gtGuiHeadersPath, "qtgui-config.h"); var headerFiles = []; headerFiles.push(qtGuiConfigHeader); while (headerFiles.length > 0) { var filePath = headerFiles.shift(); var headerFile = new TextFile(filePath, TextFile.ReadOnly); var regexp = /^#define QT_QPA_DEFAULT_PLATFORM_NAME "(.+)".*$/; var includeRegexp = /^#include "(.+)".*$/; while (!headerFile.atEof()) { var line = headerFile.readLine().trim(); var match = line.match(regexp); if (match) return 'q' + match[1]; match = line.match(includeRegexp); if (match) { var includedFile = match[1]; if (!FileInfo.isAbsolutePath(includedFile)) { includedFile = FileInfo.cleanPath( FileInfo.joinPaths(FileInfo.path(filePath), includedFile)); } headerFiles.push(includedFile); } } headerFile.close(); } } if (module.isStaticLibrary) console.warn("Could not determine default QPA plugin for static Qt."); } function libraryFileTag(module, qtProps) { if (module.isStaticLibrary) return "staticlibrary"; return ProviderUtils.isMsvcQt(qtProps) || qtProps.mkspecName.startsWith("win32-g++") ? "dynamiclibrary_import" : "dynamiclibrary"; } function findVariable(content, start) { var result = [-1, -1]; result[0] = content.indexOf('@', start); if (result[0] === -1) return result; result[1] = content.indexOf('@', result[0] + 1); if (result[1] === -1) { result[0] = -1; return result; } var forbiddenChars = [' ', '\n']; for (var i = 0; i < forbiddenChars.length; ++i) { var forbidden = forbiddenChars[i]; var k = content.indexOf(forbidden, result[0] + 1); if (k !== -1 && k < result[1]) return findVariable(content, result[0] + 1); } return result; } function minVersionJsString(minVersion) { return !minVersion ? "" : ModUtils.toJSLiteral(minVersion); } function abiToArchitecture(abi) { switch (abi) { case "armeabi-v7a": return "armv7a"; case "arm64-v8a": return "arm64"; case "x86": case "x86_64": default: return abi; } } function replaceSpecialValues(content, module, qtProps, abi) { var architectures = []; if (abi.length > 0) architectures.push(abiToArchitecture(abi)); else architectures = extractQbsArchs(module, qtProps); var dict = { archs: ModUtils.toJSLiteral(architectures), targetPlatform: ModUtils.toJSLiteral(qbsTargetPlatformFromQtMkspec(qtProps)), config: ModUtils.toJSLiteral(qtProps.configItems), qtConfig: ModUtils.toJSLiteral(qtProps.qtConfigItems), enabledFeatures: ModUtils.toJSLiteral(qtProps.enabledFeatures), disabledFeatures: ModUtils.toJSLiteral(qtProps.disabledFeatures), binPath: ModUtils.toJSLiteral(qtProps.binaryPath), installPath: ModUtils.toJSLiteral(qtProps.installPath), installPrefixPath: ModUtils.toJSLiteral(qtProps.installPrefixPath), libPath: ModUtils.toJSLiteral(qtProps.libraryPath), libExecPath: ModUtils.toJSLiteral(qtProps.libExecPath), qmlLibExecPath: ModUtils.toJSLiteral(qtProps.qmlLibExecPath), pluginPath: ModUtils.toJSLiteral(qtProps.pluginPath), incPath: ModUtils.toJSLiteral(qtProps.includePath), docPath: ModUtils.toJSLiteral(qtProps.documentationPath), translationsPath: ModUtils.toJSLiteral(qtProps.translationsPath), helpGeneratorLibExecPath: ModUtils.toJSLiteral(qtProps.helpGeneratorLibExecPath), mkspecName: ModUtils.toJSLiteral(qtProps.mkspecName), mkspecPath: ModUtils.toJSLiteral(qtProps.mkspecPath), version: ModUtils.toJSLiteral(qtProps.qtVersion), libInfix: ModUtils.toJSLiteral(qtProps.qtLibInfix), availableBuildVariants: ModUtils.toJSLiteral(qtProps.buildVariant), staticBuild: ModUtils.toJSLiteral(qtProps.staticBuild), multiThreading: ModUtils.toJSLiteral(qtProps.multiThreading), frameworkBuild: ModUtils.toJSLiteral(qtProps.frameworkBuild), name: ModUtils.toJSLiteral(ProviderUtils.qtModuleNameWithoutPrefix(module)), has_library: ModUtils.toJSLiteral(module.hasLibrary), dependencies: ModUtils.toJSLiteral(module.dependencies), includes: ModUtils.toJSLiteral(module.includePaths), staticLibsDebug: ModUtils.toJSLiteral(module.staticLibrariesDebug), staticLibsRelease: ModUtils.toJSLiteral(module.staticLibrariesRelease), dynamicLibsDebug: ModUtils.toJSLiteral(module.dynamicLibrariesDebug), dynamicLibsRelease: ModUtils.toJSLiteral(module.dynamicLibrariesRelease), linkerFlagsDebug: ModUtils.toJSLiteral(module.linkerFlagsDebug), linkerFlagsRelease: ModUtils.toJSLiteral(module.linkerFlagsRelease), libraryPaths: ModUtils.toJSLiteral(module.libraryPaths), frameworkPathsDebug: ModUtils.toJSLiteral(module.frameworkPathsDebug), frameworkPathsRelease: ModUtils.toJSLiteral(module.frameworkPathsRelease), frameworksDebug: ModUtils.toJSLiteral(module.frameworksDebug), frameworksRelease: ModUtils.toJSLiteral(module.frameworksRelease), libFilePathDebug: ModUtils.toJSLiteral(module.libFilePathDebug), libFilePathRelease: ModUtils.toJSLiteral(module.libFilePathRelease), libNameForLinkerDebug: ModUtils.toJSLiteral(ProviderUtils.qtLibNameForLinker(module, qtProps, true)), pluginTypes: ModUtils.toJSLiteral(module.supportedPluginTypes), moduleConfig: ModUtils.toJSLiteral(module.config), libNameForLinkerRelease: ModUtils.toJSLiteral(ProviderUtils.qtLibNameForLinker(module, qtProps, false)), entryPointLibsDebug: ModUtils.toJSLiteral(qtProps.entryPointLibsDebug), entryPointLibsRelease: ModUtils.toJSLiteral(qtProps.entryPointLibsRelease), minWinVersion_optional: minVersionJsString(qtProps.windowsVersion), minMacVersion_optional: minVersionJsString(qtProps.macosVersion), minIosVersion_optional: minVersionJsString(qtProps.iosVersion), minTvosVersion_optional: minVersionJsString(qtProps.tvosVersion), minWatchosVersion_optional: minVersionJsString(qtProps.watchosVersion), minAndroidVersion_optional: minVersionJsString(qtProps.androidVersion), }; var additionalContent = ""; var compilerDefines = ModUtils.toJSLiteral(module.compilerDefines); if (module.qbsName === "declarative" || module.qbsName === "quick") { var debugMacro = module.qbsName === "declarative" || qtProps.qtMajorVersion < 5 ? "QT_DECLARATIVE_DEBUG" : "QT_QML_DEBUG"; var indent = " "; additionalContent = "property bool qmlDebugging: false\n" + indent + "property string qmlPath"; if (qtProps.qmlPath) additionalContent += ": " + pathToJSLiteral(qtProps.qmlPath) + '\n'; else additionalContent += '\n'; additionalContent += indent + "property string qmlImportsPath: " + pathToJSLiteral(qtProps.qmlImportPath); compilerDefines = "{\n" + indent + indent + "var result = " + compilerDefines + ";\n" + indent + indent + "if (qmlDebugging)\n" + indent + indent + indent + "result.push(\"" + debugMacro + "\");\n" + indent + indent + "return result;\n" + indent + "}"; } dict.defines = compilerDefines; if (module.qbsName === "gui") dict.defaultQpaPlugin = ModUtils.toJSLiteral(defaultQpaPlugin(module, qtProps)); if (module.qbsName === "qml") dict.qmlPath = pathToJSLiteral(qtProps.qmlPath); if (module.isFramework && module.qbsName !== "core") { if (additionalContent) additionalContent += "\n "; additionalContent += "isFramework: true"; } if (module.isStaticLibrary && module.qbsName !== "core") { if (additionalContent) additionalContent += "\n "; additionalContent += "isStaticLibrary: true"; } if (module.isPlugin) { dict.className = ModUtils.toJSLiteral(module.pluginData.className); dict["extends"] = ModUtils.toJSLiteral(module.pluginData["extends"]); } indent = " "; var useMajorVersion = qtProps.qtMajorVersion > 5 || !qtProps.mkspecPath.contains("macx"); var metaTypesFileNamePrefix = "qt" + (useMajorVersion ? qtProps.qtMajorVersion : "") + module.qbsName + '_'; var metatypesFileNameSuffix = "metatypes.json"; var metaTypesFile; if (qtProps.qtMajorVersion > 5) { function isMetaTypesFileForModule(fileName) { return fileName.startsWith(metaTypesFileNamePrefix) && fileName.endsWith(metatypesFileNameSuffix); }; metaTypesFile = qtProps.archData + "/metatypes/" + qtProps.metaTypeFiles.find(isMetaTypesFileForModule); } else { metaTypesFile = qtProps.libraryPath + "/metatypes/" + metaTypesFileNamePrefix + metatypesFileNameSuffix; } if (File.exists(metaTypesFile)) { if (additionalContent) additionalContent += "\n" + indent; additionalContent += "Group {\n"; additionalContent += indent + indent + "files: " + JSON.stringify(metaTypesFile) + "\n" + indent + indent + "filesAreTargets: true\n" + indent + indent + "fileTags: [\"qt.core.metatypes\"]\n" + indent + "}"; } if (module.hasLibrary && !ProviderUtils.qtIsFramework(module, qtProps)) { if (additionalContent) additionalContent += "\n" + indent; additionalContent += "Group {\n"; if (module.isPlugin) { additionalContent += indent + indent + "condition: enableLinking\n"; } additionalContent += indent + indent + "files: libFilePath\n" + indent + indent + "filesAreTargets: true\n" + indent + indent + "fileTags: [\"" + libraryFileTag(module, qtProps) + "\"]\n" + indent + "}"; } dict.additionalContent = additionalContent; for (var pos = findVariable(content, 0); pos[0] !== -1; pos = findVariable(content, pos[0])) { var varName = content.slice(pos[0] + 1, pos[1]); var replacement = dict[varName] || ""; if (!replacement && varName.endsWith("_optional")) { var prevNewline = content.lastIndexOf('\n', pos[0]); if (prevNewline === -1) prevNewline = 0; var nextNewline = content.indexOf('\n', pos[0]); if (nextNewline === -1) prevNewline = content.length; content = content.slice(0, prevNewline) + content.slice(nextNewline); pos[0] = prevNewline; } else { content = content.slice(0, pos[0]) + replacement + content.slice(pos[1] + 1); pos[0] += replacement.length; } } return content; } function copyTemplateFile(fileName, targetDirectory, qtProps, abi, location, allFiles, module, pluginMap, nonEssentialPlugins) { if (!File.makePath(targetDirectory)) { throw "Cannot create directory '" + FileInfo.toNativeSeparators(targetDirectory) + "'."; } var sourceFile = new TextFile(FileInfo.joinPaths(location, "templates", fileName), TextFile.ReadOnly); var newContent = sourceFile.readAll(); if (module) { newContent = replaceSpecialValues(newContent, module, qtProps, abi); } else { newContent = newContent.replace("@allPluginsByType@", '(' + ModUtils.toJSLiteral(pluginMap) + ')'); newContent = newContent.replace("@nonEssentialPlugins@", ModUtils.toJSLiteral(nonEssentialPlugins)); newContent = newContent.replace("@version@", ModUtils.toJSLiteral(qtProps.qtVersion)); } sourceFile.close(); var targetPath = FileInfo.joinPaths(targetDirectory, fileName); allFiles.push(targetPath); var targetFile = new TextFile(targetPath, TextFile.WriteOnly); targetFile.write(newContent); targetFile.close(); } function setupOneQt(moduleName, qtInfo, outputBaseDir, uniquify, location) { var qtProps = qtInfo.qtProps; var relativeSearchPaths = []; for (a = 0; a < qtInfo.abiInfos.length; ++a) { var abiInfo = qtInfo.abiInfos[a]; var androidAbi = abiInfo.androidAbi; if (qtInfo.abiInfos.length > 1) console.info("Configuring abi '" + androidAbi + "'..."); var relativeSearchPath = uniquify ? Utilities.getHash(qtInfo.qmakeFilePath) : ""; relativeSearchPath = FileInfo.joinPaths(relativeSearchPath, androidAbi); var qbsQtModuleBaseDir = FileInfo.joinPaths(outputBaseDir, relativeSearchPath, "modules", "Qt"); // TODO: // if (File.exists(qbsQtModuleBaseDir)) // File.remove(qbsQtModuleBaseDir); var allFiles = []; if (moduleName === "plugin_support") { copyTemplateFile("plugin_support.qbs", FileInfo.joinPaths(qbsQtModuleBaseDir, "plugin_support"), qtProps, androidAbi, location, allFiles, undefined, abiInfo.pluginsByType, abiInfo.nonEssentialPlugins); relativeSearchPaths.push(relativeSearchPath); return relativeSearchPaths; } else if (moduleName === "android_support") { // Note that it's not strictly necessary to copy this one, as it has no variable content. // But we do it anyway for consistency. copyTemplateFile("android_support.qbs", FileInfo.joinPaths(qbsQtModuleBaseDir, "android_support"), qtProps, androidAbi, location, allFiles); copyTemplateFile("android_support.js", FileInfo.joinPaths(qbsQtModuleBaseDir, "android_support"), qtProps, androidAbi, location, allFiles); relativeSearchPaths.push(relativeSearchPath); return relativeSearchPaths; } else if (moduleName === "qmlcache") { var qmlcacheStr = "qmlcache"; if (File.exists(FileInfo.joinPaths(qtProps.qmlLibExecPath, "qmlcachegen" + FileInfo.executableSuffix()))) { copyTemplateFile(qmlcacheStr + ".qbs", FileInfo.joinPaths(qbsQtModuleBaseDir, qmlcacheStr), qtProps, androidAbi, location, allFiles); } relativeSearchPaths.push(relativeSearchPath); return relativeSearchPaths; } if (abiInfo.modules[moduleName] !== undefined) { var module = abiInfo.modules[moduleName]; var qbsQtModuleDir = FileInfo.joinPaths(qbsQtModuleBaseDir, module.qbsName); var moduleTemplateFileName; if (module.qbsName === "core") { moduleTemplateFileName = "core.qbs"; copyTemplateFile("core.js", qbsQtModuleDir, qtProps, androidAbi, location, allFiles); copyTemplateFile("moc.js", qbsQtModuleDir, qtProps, androidAbi, location, allFiles); copyTemplateFile("qdoc.js", qbsQtModuleDir, qtProps, androidAbi, location, allFiles); copyTemplateFile("rcc.js", qbsQtModuleDir, qtProps, androidAbi, location, allFiles); } else if (module.qbsName === "gui") { moduleTemplateFileName = "gui.qbs"; } else if (module.qbsName === "scxml") { moduleTemplateFileName = "scxml.qbs"; } else if (module.qbsName === "dbus") { moduleTemplateFileName = "dbus.qbs"; copyTemplateFile("dbus.js", qbsQtModuleDir, qtProps, androidAbi, location, allFiles); } else if (module.qbsName === "qml") { moduleTemplateFileName = "qml.qbs"; copyTemplateFile("qml.js", qbsQtModuleDir, qtProps, androidAbi, location, allFiles); } else if (module.qbsName === "quick") { moduleTemplateFileName = "quick.qbs"; copyTemplateFile("quick.js", qbsQtModuleDir, qtProps, androidAbi, location, allFiles); copyTemplateFile("rcc.js", qbsQtModuleDir, qtProps, androidAbi, location, allFiles); } else if (module.qbsName === "shadertools") { moduleTemplateFileName = "shadertools.qbs"; copyTemplateFile("shadertools.js", qbsQtModuleDir, qtProps, androidAbi, location, allFiles); } else if (module.isPlugin) { moduleTemplateFileName = "plugin.qbs"; } else { moduleTemplateFileName = "module.qbs"; } copyTemplateFile(moduleTemplateFileName, qbsQtModuleDir, qtProps, androidAbi, location, allFiles, module); relativeSearchPaths.push(relativeSearchPath); } } return relativeSearchPaths; } function doSetup(moduleName, qtInfos, outputBaseDir, location) { if (!qtInfos || qtInfos.length === 0) return []; var uniquifySearchPath = qtInfos.length > 1; var allSearchPaths = []; moduleName = moduleName.substring(3); for (var i = 0; i < qtInfos.length; ++i) { try { console.info("Setting up Qt module '" + moduleName + "' for Qt located at '" + FileInfo.toNativeSeparators(qtInfos[i].qmakeFilePath) + "'."); var searchPaths = setupOneQt(moduleName, qtInfos[i], outputBaseDir, uniquifySearchPath, location); if (searchPaths.length > 0) { for (var j = 0; j < searchPaths.length; ++j ) allSearchPaths.push(searchPaths[j]); } } catch (e) { console.warn("Error setting up Qt module '" + moduleName + "' for '" + FileInfo.toNativeSeparators(qtInfos[i].qmakeFilePath) + "': " + e); throw e; } } return allSearchPaths; } qbs-src-3.2.0/share/qbs/module-providers/Qt/provider.qbs0000644000175100017510000000065015154533055022617 0ustar runnerrunnerimport "setup-qt.js" as SetupQt import qbs.Probes ModuleProvider { Probes.QmakeProbe { condition: moduleName.startsWith("Qt.") id: probe qmakePaths: qmakeFilePaths } property stringList qmakeFilePaths readonly property varList _qtInfos: probe.qtInfos condition: probe.found isEager: false relativeSearchPaths: SetupQt.doSetup(moduleName, _qtInfos, outputBaseDir, path) } qbs-src-3.2.0/share/qbs/modules/0000755000175100017510000000000015154533055016041 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/java/0000755000175100017510000000000015154533055016762 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/java/utils.js0000644000175100017510000003576715154533055020502 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var Process = require("qbs.Process"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); var WindowsUtils = require("qbs.WindowsUtils"); function is64bitProcess() { var y = jdkRootRegistryKey(true); var n = jdkRootRegistryKey(false); y = Utilities.getNativeSetting(y + "\\" + Utilities.getNativeSetting(y, "CurrentVersion"), "JavaHome"); n = Utilities.getNativeSetting(n + "\\" + Utilities.getNativeSetting(n, "CurrentVersion"), "JavaHome"); return y !== n; } function useWow64Key(arch) { var wow64 = false; switch (arch) { case "x86_64": case "ia64": // QTBUG-3845 if (!is64bitProcess()) return undefined; break; case "x86": case "armv7": wow64 = is64bitProcess(); break; } return wow64; } function jdkRootRegistryKey(wow64) { // If an architecture is specified, search the appropriate key for that architecture, // on this version of Windows (i.e. WOW64 or not) if compatible, // otherwise get both keys since any JDK will be usable if (wow64 === undefined) return undefined; return FileInfo.toWindowsSeparators(FileInfo.joinPaths("HKEY_LOCAL_MACHINE", "SOFTWARE", (wow64 ? "Wow6432Node" : undefined), "JavaSoft", "Java Development Kit")); } function findJdkPath(hostOS, arch, environmentPaths, searchPaths) { var i; for (i = 0; i < environmentPaths.length; ++i) { if (environmentPaths[i]) return environmentPaths[i]; } if (hostOS.includes("windows")) { var rootKey = jdkRootRegistryKey(useWow64Key(arch)); if (rootKey) { var current = Utilities.getNativeSetting(rootKey, "CurrentVersion"); // 1.8 etc. if (current) { var home = Utilities.getNativeSetting([rootKey, current].join("\\"), "JavaHome"); if (home) { return home; } } } return undefined; } if (hostOS.includes("macos")) { var p = new Process(); try { // We filter by architecture here so that we'll get a compatible JVM for JNI use. var args = []; var canonicalArch; if (arch) { // Hardcoding apple/macosx/macho here is fine because we know we're on macOS canonicalArch = Utilities.canonicalTargetArchitecture(arch, undefined, "apple", "macosx", "macho"); args.push("--arch", canonicalArch); } // --failfast doesn't print the default JVM if nothing matches the filter(s). var status = p.exec("/usr/libexec/java_home", args.concat(["--failfast"])); if (status === 0) return p.readStdOut().trim(); // It has been obvserved that java_home fails for any architecture that is passed, // so try without the filter and look up the JDK architecture manually. if (!canonicalArch) return undefined; if (p.exec("/usr/libexec/java_home", ["--failfast"]) !== 0) return undefined; var jdkPath = p.readStdOut().trim(); var releaseFile = new TextFile(jdkPath + "/release", TextFile.ReadOnly); var line; while ((line = releaseFile.readLine())) { if (!line.startsWith("OS_ARCH=")) continue; var firstQuote = line.indexOf('"'); if (firstQuote === -1) break; var secondQuote = line.indexOf('"', firstQuote + 1); if (secondQuote === -1) break; var archFromFile = line.substring(firstQuote + 1, secondQuote); if (archFromFile !== canonicalArch) break; return jdkPath; } return undefined; } finally { p.close(); } } if (hostOS.includes("unix")) { var requiredTools = ["javac", "java", "jar"]; for (i = 0; i < searchPaths.length; ++i) { function fullToolPath(tool) { return FileInfo.joinPaths(searchPaths[i], "bin", tool); } if (requiredTools.map(function(p) { return fullToolPath(p); }) .every(function(p) { return File.exists(p); })) { return searchPaths[i]; } } return undefined; } } function findJdkVersion(compilerFilePath) { var p = new Process(); try { p.exec(compilerFilePath, ["-version"]); var re = /^javac (([0-9]+(?:\.[0-9]+){0,2})(_([0-9]+))?)(.*)?$/m; var match = p.readStdErr().trim().match(re); if (!match) match = p.readStdOut().trim().match(re); if (match !== null) return match; } finally { p.close(); } } function splitVersionString(compilerVersion) { if (!compilerVersion) return []; var result = compilerVersion.split(/[\._]/).map(function(item) { return parseInt(item, 10); }); // special case, if javac -version returned "12" instead of "12.0.0" if (result.length === 1) result.push(0, 0); return result; } function supportsGeneratedNativeHeaderFiles(product) { var compilerVersionMajor = ModUtils.moduleProperty(product, "compilerVersionMajor"); if (compilerVersionMajor === 1) { if (ModUtils.moduleProperty(product, "compilerVersionMinor") >= 8) { return true; } } return compilerVersionMajor > 1; } function javacArguments(product, inputs, overrides) { function getModuleProperty(product, propertyName, overrides) { if (overrides && overrides[propertyName]) return overrides[propertyName]; return ModUtils.moduleProperty(product, propertyName); } function getModuleProperties(product, propertyName, overrides) { if (overrides && overrides[propertyName]) return overrides[propertyName]; return ModUtils.moduleProperty(product, propertyName); } var i; var outputDir = getModuleProperty(product, "classFilesDir", overrides); var classPaths = [outputDir]; var additionalClassPaths = getModuleProperties(product, "additionalClassPaths", overrides); if (additionalClassPaths) classPaths = classPaths.concat(additionalClassPaths); for (i in inputs["java.jar"]) classPaths.push(inputs["java.jar"][i].filePath); var debugArg = product.moduleProperty("qbs", "buildVariant") === "debug" ? "-g" : "-g:none"; var pathListSeparator = FileInfo.pathListSeparator(); var args = [ "-classpath", classPaths.join(pathListSeparator), "-s", product.buildDirectory, debugArg, "-d", outputDir ]; if (supportsGeneratedNativeHeaderFiles(product)) args.push("-h", product.buildDirectory); var runtimeVersion = getModuleProperty(product, "runtimeVersion", overrides); if (runtimeVersion) args.push("-target", runtimeVersion); var languageVersion = getModuleProperty(product, "languageVersion", overrides); if (languageVersion) args.push("-source", languageVersion); var bootClassPaths = getModuleProperties(product, "bootClassPaths", overrides); if (bootClassPaths && bootClassPaths.length > 0 && (!runtimeVersion || Utilities.versionCompare(runtimeVersion, "9") < 0)) { args.push("-bootclasspath", bootClassPaths.join(pathListSeparator)); } if (!getModuleProperty(product, "enableWarnings", overrides)) args.push("-nowarn"); if (getModuleProperty(product, "warningsAsErrors", overrides)) args.push("-Werror"); var otherFlags = getModuleProperties(product, "additionalCompilerFlags", overrides); if (otherFlags) args = args.concat(otherFlags); for (i in inputs["java.java"]) args.push(inputs["java.java"][i].filePath); for (i in inputs["java.java-internal"]) args.push(inputs["java.java-internal"][i].filePath); return args; } /** * Returns a list of fully qualified Java class names for the compiler helper tool. * * @param type @c java to return names of sources, @c to return names of compiled classes */ function helperFullyQualifiedNames(type) { var names = [ "io/qt/qbs/Artifact", "io/qt/qbs/ArtifactListJsonWriter", "io/qt/qbs/ArtifactListWriter", "io/qt/qbs/tools/JavaCompilerScannerTool", "io/qt/qbs/tools/utils/JavaCompilerOptions", "io/qt/qbs/tools/utils/JavaCompilerScanner", "io/qt/qbs/tools/utils/JavaCompilerScanner$1", "io/qt/qbs/tools/utils/NullFileObject", "io/qt/qbs/tools/utils/NullFileObject$1", "io/qt/qbs/tools/utils/NullFileObject$2", ]; if (type === "java") { return names.filter(function (name) { return !name.includes("$"); }); } else if (type === "class") { return names; } } function helperOutputArtifacts(product) { File.makePath(ModUtils.moduleProperty(product, "internalClassFilesDir")); return helperFullyQualifiedNames("class").map(function (name) { return { filePath: FileInfo.joinPaths(ModUtils.moduleProperty(product, "internalClassFilesDir"), name + ".class"), fileTags: ["java.class-internal"] }; }); } function helperOverrideArgs(product, tool) { var overrides = {}; if (tool === "javac") { // Build the helper tool with the same source and target version as the JDK it's being // compiled with. Both are irrelevant here since the resulting tool will only be run // with the same JDK as it was built with, and we know in advance the source is // compatible with all Java language versions from 1.6 and above. var jdkVersionArray = [product.java.compilerVersionMajor]; if (product.java.compilerVersionMajor < 9) jdkVersionArray.push(product.java.compilerVersionMinor); var jdkVersion = jdkVersionArray.join("."); overrides["languageVersion"] = jdkVersion; overrides["runtimeVersion"] = jdkVersion; // Build the helper tool's class files separately from the actual product's class files overrides["classFilesDir"] = ModUtils.moduleProperty(product, "internalClassFilesDir"); // Add tools.jar to the classpath as required for the tree scanner API var toolsJarPath = ModUtils.moduleProperty(product, "toolsJarPath"); if (toolsJarPath) overrides["additionalClassPaths"] = [toolsJarPath].concat( ModUtils.moduleProperty(product, "additionalClassPaths")); } // Inject the current JDK's runtime classes into the boot class path when building/running the // dependency scanner. This is normally not necessary but is important for Android platforms // where android.jar is the only JAR on the boot classpath and JSR 199 is unavailable. var rtJarPath = product.java.runtimeJarPath; overrides["bootClassPaths"] = (rtJarPath ? [rtJarPath] : []).concat( ModUtils.moduleProperty(product, "bootClassPaths")); return overrides; } function outputArtifacts(product, inputs) { // Handle the case where a product depends on Java but has no Java sources if (!inputs["java.java"] || inputs["java.java"].length === 0) return []; // We need to ensure that the output directory is created first, because the Java compiler // internally checks that it is present before performing any actions File.makePath(ModUtils.moduleProperty(product, "classFilesDir")); var process; try { process = new Process(); process.setWorkingDirectory( FileInfo.joinPaths(ModUtils.moduleProperty(product, "internalClassFilesDir"))); var sep = FileInfo.pathListSeparator(); var toolsJarPath = ModUtils.moduleProperty(product, "toolsJarPath"); var javaArgs = [ "-classpath", process.workingDirectory() + (toolsJarPath ? (sep + toolsJarPath) : ""), "io/qt/qbs/tools/JavaCompilerScannerTool", ]; process.exec(ModUtils.moduleProperty(product, "interpreterFilePath"), javaArgs .concat(javacArguments(product, inputs, helperOverrideArgs(product))), true); var out = JSON.parse(process.readStdOut()); console.error(process.readStdErr()); return out; } finally { if (process) process.close(); } } function manifestContents(filePath) { if (filePath === undefined) return undefined; var contents, file; try { file = new TextFile(filePath); contents = file.readAll(); } finally { if (file) { file.close(); } } if (contents) { var dict = {}; var lines = contents.split(/\r?\n/g).filter(function (line) { return line.length > 0; }); for (var i = 0; i < lines.length; ++i) { var kv = lines[i].split(":"); if (kv.length !== 2) throw new Error("Syntax error in manifest file '" + filePath + "'; found \"" + lines[i] + "\" on line " + parseInt(i, 10) + "; expected format \"Key: Value\""); dict[kv[0].trim()] = kv[1].trim(); } return dict; } } qbs-src-3.2.0/share/qbs/modules/java/JavaModule.qbs0000644000175100017510000003364315154533055021531 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.Probes import qbs.Process import qbs.TextFile import qbs.Utilities import "utils.js" as JavaUtils Module { Probes.JdkProbe { id: jdk environmentPaths: (jdkPath ? [jdkPath] : []).concat(base) } Probes.JdkVersionProbe { id: jdkVersionProbe javac: compilerFilePath } property stringList additionalClassPaths property stringList additionalCompilerFlags property stringList additionalJarFlags property stringList bootClassPaths property string compilerFilePath: FileInfo.joinPaths(jdkPath, "bin", compilerName) property string compilerName: "javac" property bool enableWarnings: true property string interpreterFilePath : FileInfo.joinPaths(jdkPath, "bin", interpreterName) property string interpreterName: "java" property string jarFilePath: FileInfo.joinPaths(jdkPath, "bin", jarName) property string jarName: "jar" property string jarsignerFilePath: FileInfo.joinPaths(jdkPath, "bin", jarsignerName) property string jarsignerName: "jarsigner" property string keytoolFilePath: FileInfo.joinPaths(jdkPath, "bin", keytoolName) property string keytoolName: "keytool" property bool _tagJniHeaders: true property string jdkPath: jdk.path version: [compilerVersionMajor, compilerVersionMinor, compilerVersionPatch].join(".") property string compilerVersion: jdkVersionProbe.version ? jdkVersionProbe.version[1] : undefined property var compilerVersionParts: JavaUtils.splitVersionString(compilerVersion) property int compilerVersionMajor: compilerVersionParts[0] property int compilerVersionMinor: compilerVersionParts[1] property int compilerVersionPatch: compilerVersionParts[2] property int compilerVersionUpdate: compilerVersionParts[3] property string languageVersion PropertyOptions { name: "languageVersion" description: "Java language version to interpret source code as" } property string runtimeVersion PropertyOptions { name: "runtimeVersion" description: "version of the Java runtime to generate compatible bytecode for" } property var manifest: { return { "Manifest-Version": "1.0", "Class-Path": manifestClassPath ? manifestClassPath.join(" ") : undefined }; } PropertyOptions { name: "manifest" description: "properties to add to the manifest file when building a JAR" } PropertyOptions { name: "manifestFile" description: "Use files tagged \"java.manifest\" instead." removalVersion: "1.9" } property stringList manifestClassPath PropertyOptions { name: "manifestClassPath" description: "entries to add to the manifest's Class-Path when building a JAR" } property bool warningsAsErrors: false property pathList jdkIncludePaths: { var paths = []; if (isAppleJava) { paths.push(FileInfo.joinPaths(qbs.sysroot, "/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers")); } else { paths.push(FileInfo.joinPaths(jdkPath, "include")); var hostOS = Host.os().includes("windows") ? Host.os().concat(["win32"]) : Host.os(); var platforms = ["win32", "darwin", "linux", "bsd", "solaris"]; for (var i = 0; i < platforms.length; ++i) { if (hostOS.includes(platforms[i])) { // Corresponds to JDK_INCLUDE_SUBDIR in the JDK Makefiles paths.push(FileInfo.joinPaths(jdkPath, "include", platforms[i])); break; } } } return paths; } // Internal properties property path classFilesDir: FileInfo.joinPaths(product.buildDirectory, "classes") property path internalClassFilesDir: FileInfo.joinPaths(product.buildDirectory, ".classes") property bool isAppleJava: Host.os().includes("darwin") && (compilerVersionMajor < 1 || (compilerVersionMajor === 1 && compilerVersionMinor < 7)) // https://developer.apple.com/library/content/documentation/Java/Conceptual/Java14Development/02-JavaDevTools/JavaDevTools.html // tools.jar does not exist. Classes usually located here are instead included in classes.jar. // The same is true for rt.jar, although not mentioned in the documentation property path classesJarPath: { if (isAppleJava) return FileInfo.joinPaths(jdkPath, "bundle", "Classes", "classes.jar"); } property path runtimeJarPath: { if (compilerVersionMajor >= 9) return undefined; if (classesJarPath) return classesJarPath; return FileInfo.joinPaths(jdkPath, "jre", "lib", "rt.jar"); } property path toolsJarPath: { if (compilerVersionMajor >= 9) return undefined; if (classesJarPath) return classesJarPath; return FileInfo.joinPaths(jdkPath, "lib", "tools.jar"); } validate: { var validator = new ModUtils.PropertyValidator("java"); validator.setRequiredProperty("jdkPath", jdkPath); validator.setRequiredProperty("compilerVersion", compilerVersion); validator.setRequiredProperty("compilerVersionParts", compilerVersionParts); validator.setRequiredProperty("compilerVersionMajor", compilerVersionMajor); validator.setRequiredProperty("compilerVersionMinor", compilerVersionMinor); if (Utilities.versionCompare(version, "9") < 0) validator.setRequiredProperty("compilerVersionUpdate", compilerVersionUpdate); validator.addVersionValidator("compilerVersion", compilerVersion ? compilerVersion.replace("_", ".") : undefined, 1, 4); validator.addRangeValidator("compilerVersionMajor", compilerVersionMajor, 1); validator.addRangeValidator("compilerVersionMinor", compilerVersionMinor, 0); validator.addRangeValidator("compilerVersionPatch", compilerVersionPatch, 0); if (Utilities.versionCompare(version, "9") < 0) validator.addRangeValidator("compilerVersionUpdate", compilerVersionUpdate, 0); validator.validate(); } FileTagger { patterns: "*.java" fileTags: ["java.java"] } FileTagger { patterns: ["*.mf"] fileTags: ["java.manifest"] } Group { name: "io.qt.qbs.internal.java-helper" files: { return JavaUtils.helperFullyQualifiedNames("java").map(function(name) { return FileInfo.joinPaths(path, name + ".java"); }); } fileTags: ["java.java-internal"] } Rule { multiplex: true inputs: ["java.java-internal"] outputFileTags: ["java.class-internal"] outputArtifacts: { return JavaUtils.helperOutputArtifacts(product); } prepare: { var cmd = new Command(ModUtils.moduleProperty(product, "compilerFilePath"), JavaUtils.javacArguments(product, inputs, JavaUtils.helperOverrideArgs(product, "javac"))); cmd.ignoreDryRun = true; cmd.silent = true; return [cmd]; } } Rule { multiplex: true inputs: ["java.java"] inputsFromDependencies: ["java.jar"] explicitlyDependsOn: ["java.class-internal"] outputFileTags: ["java.class"].concat(_tagJniHeaders ? ["hpp"] : ["java.jni-hpp"]) // Annotations can produce additional java source files. Ignored for now. outputArtifacts: { var artifacts = JavaUtils.outputArtifacts(product, inputs); if (!product.java._tagJniHeaders) { for (var i = 0; i < artifacts.length; ++i) { var a = artifacts[i]; if (a.fileTags instanceof Array) a.fileTags = a.fileTags.map(function(tag) { if (tag === "hpp") return "java.jni-hpp"; return tag; }); } } return artifacts; } prepare: { var cmd = new Command(ModUtils.moduleProperty(product, "compilerFilePath"), JavaUtils.javacArguments(product, inputs)); cmd.description = "compiling Java sources"; cmd.highlight = "compiler"; return [cmd]; } } Rule { inputs: ["java.class", "java.manifest"] multiplex: true Artifact { fileTags: ["java.jar"] filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + ".jar") } prepare: { var i, key; var flags = "cf"; var args = [output.filePath]; var aggregateManifest = {}; var manifestFiles = (inputs["java.manifest"] || []).map(function (a) { return a.filePath; }); manifestFiles.forEach(function (manifestFile) { var mf = JavaUtils.manifestContents(manifestFile); for (key in mf) { if (mf.hasOwnProperty(key)) { var oldValue = aggregateManifest[key]; var newValue = mf[key]; if (oldValue !== undefined && oldValue !== newValue) { throw new Error("Conflicting values '" + oldValue + "' and '" + newValue + "' for manifest file key '" + key + "'"); } aggregateManifest[key] = newValue; } } }); // Add local key-value pairs (overrides equivalent keys specified in the file if // one was given) var manifest = product.java.manifest; for (key in manifest) { if (manifest.hasOwnProperty(key)) aggregateManifest[key] = manifest[key]; } for (key in aggregateManifest) { if (aggregateManifest.hasOwnProperty(key) && aggregateManifest[key] === undefined) delete aggregateManifest[key]; } // Use default manifest unless we actually have properties to set var needsManifestFile = manifestFiles.length > 0 || aggregateManifest !== {"Manifest-Version": "1.0"}; var manifestFile = FileInfo.joinPaths(product.buildDirectory, "manifest.mf"); var mf; try { mf = new TextFile(manifestFile, TextFile.WriteOnly); // Ensure that manifest version comes first mf.write("Manifest-Version: " + (aggregateManifest["Manifest-Version"] || "1.0") + "\n"); delete aggregateManifest["Manifest-Version"]; for (key in aggregateManifest) mf.write(key + ": " + aggregateManifest[key] + "\n"); mf.write("\n"); } finally { if (mf) { mf.close(); } } if (needsManifestFile) { flags += "m"; args.push(manifestFile); } var entryPoint = ModUtils.moduleProperty(product, "entryPoint"); var entryPoint = product.entryPoint; if (entryPoint) { flags += "e"; args.push(entryPoint); } args.unshift(flags); var otherFlags = ModUtils.moduleProperty(product, "additionalJarFlags"); if (otherFlags) args = args.concat(otherFlags); for (i in inputs["java.class"]) args.push(FileInfo.relativePath(ModUtils.moduleProperty(product, "classFilesDir"), inputs["java.class"][i].filePath)); var cmd = new Command(ModUtils.moduleProperty(product, "jarFilePath"), args); cmd.workingDirectory = ModUtils.moduleProperty(product, "classFilesDir"); cmd.description = "building " + FileInfo.fileName(output.fileName); cmd.highlight = "linker"; return cmd; } } } qbs-src-3.2.0/share/qbs/modules/java/io/0000755000175100017510000000000015154533055017371 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/java/io/qt/0000755000175100017510000000000015154533055020015 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/java/io/qt/qbs/0000755000175100017510000000000015154533055020602 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/java/io/qt/qbs/Artifact.java0000644000175100017510000000501615154533055023204 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ package io.qt.qbs; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Artifact { private String filePath; private List fileTags; public Artifact(String filePath) { if (filePath == null) throw new IllegalArgumentException("filePath"); this.filePath = filePath; this.fileTags = new ArrayList(); } public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } public List getFileTags() { return Collections.unmodifiableList(fileTags); } public void setFileTags(List fileTags) { this.fileTags = new ArrayList(fileTags); } public void addFileTag(String fileTag) { this.fileTags.add(fileTag); } public void removeFileTag(String fileTag) { this.fileTags.remove(fileTag); } public void clearFileTags() { this.fileTags.clear(); } } qbs-src-3.2.0/share/qbs/modules/java/io/qt/qbs/ArtifactListWriter.java0000644000175100017510000000334415154533055025237 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ package io.qt.qbs; import java.io.IOException; import java.io.OutputStream; import java.util.List; public interface ArtifactListWriter { void write(List artifacts, OutputStream outputStream) throws IOException; } qbs-src-3.2.0/share/qbs/modules/java/io/qt/qbs/ArtifactListJsonWriter.java0000644000175100017510000001302715154533055026070 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ package io.qt.qbs; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.util.List; /** * This uses a custom JSON implementation because the Java Standard Library does * not yet have native support for JSON, and only minimal support is required * here. */ public class ArtifactListJsonWriter implements ArtifactListWriter { private static final int TAB_WIDTH = 4; // based on escapeString from qtbase/qjsonwriter.cpp private static String escapeString(String s) { String out = ""; for (int i = 0; i < s.length();) { int u = s.codePointAt(i); // unpaired surrogate if (u >= Character.MIN_SURROGATE && u <= Character.MAX_SURROGATE) { out += "\ufffd"; i += Character.charCount(u); continue; } if (u < 0x80) { if (u < 0x20 || u == 0x22 || u == 0x5c) { out += "\\"; switch (u) { case 0x22: out += "\""; break; case 0x5c: out += "\\"; break; case 0x8: out += "b"; break; case 0xc: out += "f"; break; case 0xa: out += "n"; break; case 0xd: out += "r"; break; case 0x9: out += "t"; break; default: out += "u"; out += "0"; out += "0"; String hex = Integer.toHexString(u); if (hex.length() == 1) out += "0"; out += hex; break; } } else { out += s.substring(i, i + Character.charCount(u)); } } else { out += s.substring(i, i + Character.charCount(u)); } i += Character.charCount(u); } return out; } private static void writeString(PrintStream printWriter, String s) { printWriter.print("\""); printWriter.print(escapeString(s)); printWriter.print("\""); } private static void writeIndent(PrintStream printWriter, int level) { for (int i = 0; i < level * TAB_WIDTH; ++i) { printWriter.print(" "); } } private static void writeArtifact(Artifact artifact, PrintStream printWriter, int indentLevel, Boolean comma) { writeIndent(printWriter, indentLevel++); printWriter.print("{\n"); writeIndent(printWriter, indentLevel); writeString(printWriter, "filePath"); printWriter.print(": "); writeString(printWriter, artifact.getFilePath()); printWriter.println(","); writeIndent(printWriter, indentLevel); writeString(printWriter, "fileTags"); printWriter.print(": ["); for (int i = 0; i < artifact.getFileTags().size(); ++i) { writeString(printWriter, artifact.getFileTags().get(i)); if (i != artifact.getFileTags().size() - 1) printWriter.print(", "); } printWriter.println("]"); writeIndent(printWriter, --indentLevel); printWriter.println("}" + (comma ? "," : "")); } @Override public void write(List artifacts, OutputStream outputStream) throws IOException { PrintStream printWriter = new PrintStream(outputStream); printWriter.print("[\n"); for (int i = 0; i < artifacts.size(); ++i) { writeArtifact(artifacts.get(i), printWriter, 1, i != artifacts.size() - 1); } printWriter.println("]"); } } qbs-src-3.2.0/share/qbs/modules/java/io/qt/qbs/tools/0000755000175100017510000000000015154533055021742 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/java/io/qt/qbs/tools/JavaCompilerScannerTool.java0000644000175100017510000000412015154533055027326 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ package io.qt.qbs.tools; import io.qt.qbs.tools.utils.JavaCompilerScanner; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; public class JavaCompilerScannerTool { public static void main(String[] args) { try { JavaCompilerScanner scanner = new JavaCompilerScanner(); int result = scanner.run(new ArrayList(Arrays.asList(args))); scanner.write(System.out); System.exit(result); } catch (IOException e) { e.printStackTrace(); System.exit(1); } } } qbs-src-3.2.0/share/qbs/modules/java/io/qt/qbs/tools/utils/0000755000175100017510000000000015154533055023102 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/java/io/qt/qbs/tools/utils/JavaCompilerOptions.java0000644000175100017510000000771015154533055027702 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ package io.qt.qbs.tools.utils; import javax.lang.model.SourceVersion; import javax.tools.JavaCompiler; import javax.tools.JavaFileManager; import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class JavaCompilerOptions { private final List recognizedOptions; private final List classNames; private final List files; private JavaCompilerOptions(List recognizedOptions, List classNames, List files) { this.recognizedOptions = recognizedOptions; this.classNames = classNames; this.files = files; } public static JavaCompilerOptions parse(JavaCompiler compiler, JavaFileManager fileManager, String... arguments) { List recognizedOptions = new ArrayList(); List classNames = new ArrayList(); List files = new ArrayList(); for (int i = 0; i < arguments.length; ++i) { int argumentCount = compiler.isSupportedOption(arguments[i]); if (argumentCount < 0) argumentCount = fileManager.isSupportedOption(arguments[i]); if (argumentCount >= 0) { // isSupportedOption() returns 1 for -Xlint* in Java 9. Bug? if (arguments[i].startsWith("-Xlint")) argumentCount = 0; for (int j = 0; j < argumentCount + 1; ++j) { if (i + j >= arguments.length) { throw new IllegalArgumentException(arguments[i]); } recognizedOptions.add(arguments[i + j]); } i += argumentCount; } else { File file = new File(arguments[i]); if (file.exists()) files.add(file); else if (SourceVersion.isName(arguments[i])) classNames.add(arguments[i]); else throw new IllegalArgumentException(arguments[i]); } } return new JavaCompilerOptions(recognizedOptions, classNames, files); } public List getRecognizedOptions() { return Collections.unmodifiableList(recognizedOptions); } public List getFiles() { return Collections.unmodifiableList(files); } public List getClassNames() { return Collections.unmodifiableList(classNames); } } qbs-src-3.2.0/share/qbs/modules/java/io/qt/qbs/tools/utils/NullFileObject.java0000644000175100017510000001040215154533055026603 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ package io.qt.qbs.tools.utils; import javax.lang.model.element.Modifier; import javax.lang.model.element.NestingKind; import javax.tools.FileObject; import javax.tools.JavaFileObject; import java.io.*; import java.net.URI; /** * Represents a FileObject that discards its output when written. */ public class NullFileObject implements FileObject, JavaFileObject { FileObject obj; public NullFileObject(FileObject obj) { this.obj = obj; } @Override public URI toUri() { return obj.toUri(); } @Override public String getName() { return obj.getName(); } @Override public InputStream openInputStream() throws IOException { return obj.openInputStream(); } @Override public OutputStream openOutputStream() throws IOException { return new OutputStream() { @Override public void write(int b) throws IOException { } }; } @Override public Reader openReader(boolean ignoreEncodingErrors) throws IOException { return obj.openReader(ignoreEncodingErrors); } @Override public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { return obj.getCharContent(ignoreEncodingErrors); } @Override public Writer openWriter() throws IOException { return new Writer() { @Override public void write(char[] cbuf, int off, int len) throws IOException { } @Override public void flush() throws IOException { } @Override public void close() throws IOException { } }; } @Override public long getLastModified() { return obj.getLastModified(); } @Override public boolean delete() { return true; } @Override public Kind getKind() { if (obj instanceof JavaFileObject) { return ((JavaFileObject) obj).getKind(); } throw new UnsupportedOperationException(); } @Override public boolean isNameCompatible(String simpleName, Kind kind) { if (obj instanceof JavaFileObject) { return ((JavaFileObject) obj).isNameCompatible(simpleName, kind); } throw new UnsupportedOperationException(); } @Override public NestingKind getNestingKind() { if (obj instanceof JavaFileObject) { return ((JavaFileObject) obj).getNestingKind(); } throw new UnsupportedOperationException(); } @Override public Modifier getAccessLevel() { if (obj instanceof JavaFileObject) { return ((JavaFileObject) obj).getAccessLevel(); } throw new UnsupportedOperationException(); } } qbs-src-3.2.0/share/qbs/modules/java/io/qt/qbs/tools/utils/JavaCompilerScanner.java0000644000175100017510000001102315154533055027630 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ package io.qt.qbs.tools.utils; import io.qt.qbs.*; import javax.tools.*; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.util.*; public class JavaCompilerScanner { private List artifacts = new ArrayList(); private ArtifactListWriter writer = new ArtifactListJsonWriter(); public List getArtifacts() { return this.artifacts; } public int run(List compilerArguments) { artifacts.clear(); JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); StandardJavaFileManager standardFileManager = compiler .getStandardFileManager(null, null, null); final JavaFileManager fileManager = new ForwardingJavaFileManager( standardFileManager) { @Override public JavaFileObject getJavaFileForOutput( JavaFileManager.Location location, String className, JavaFileObject.Kind kind, FileObject sibling) throws IOException { JavaFileObject o = super.getJavaFileForOutput(location, className, kind, sibling); Artifact artifact = new Artifact(new File(o.toUri() .getSchemeSpecificPart()).toString()); if (kind.equals(JavaFileObject.Kind.CLASS)) { artifact.addFileTag("java.class"); } else if (kind.equals(JavaFileObject.Kind.SOURCE)) { artifact.addFileTag("java.java"); } artifacts.add(artifact); return new NullFileObject(o); } @Override public FileObject getFileForOutput( JavaFileManager.Location location, String packageName, String relativeName, FileObject sibling) throws IOException { FileObject o = super.getFileForOutput(location, packageName, relativeName, sibling); Artifact artifact = new Artifact(new File(o.toUri() .getSchemeSpecificPart()).toString()); if (o.getName().endsWith(".h")) { artifact.addFileTag("hpp"); } artifacts.add(artifact); return new NullFileObject(o); } }; final JavaCompilerOptions options = JavaCompilerOptions .parse(compiler, standardFileManager, compilerArguments .toArray(new String[compilerArguments.size()])); return compiler.getTask( null, fileManager, null, options.getRecognizedOptions(), options.getClassNames(), standardFileManager.getJavaFileObjectsFromFiles(options .getFiles())).call() ? 0 : 1; } public void write(OutputStream outputStream) throws IOException { writer.write(getArtifacts(), outputStream); } } qbs-src-3.2.0/share/qbs/modules/flatbuf/0000755000175100017510000000000015154533055017464 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/flatbuf/flatbuffersbase.qbs0000644000175100017510000000411215154533055023327 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs import qbs.File import qbs.FileInfo import qbs.Probes import "flatbuffers.js" as HelperFunctions Module { property string compilerName: "flatc" property string compilerPath: compilerProbe.filePath property pathList importPaths: [] property string _outputDir: FileInfo.joinPaths(product.buildDirectory, "flatbuf") property stringList _searchPaths FileTagger { patterns: ["*.fbs"] fileTags: ["flatbuf.input"]; } Probes.BinaryProbe { id: compilerProbe names: [compilerName] searchPaths: _searchPaths } } qbs-src-3.2.0/share/qbs/modules/flatbuf/cpp/0000755000175100017510000000000015154533055020246 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/flatbuf/cpp/flatbuffers-cpp.qbs0000644000175100017510000000510415154533055024040 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs import qbs.FileInfo import "../flatbuffers.js" as Flatbuf import "../flatbuffersbase.qbs" as FlatbufBase FlatbufBase { Depends { name: "cpp" } Depends { name: "flatbuffers" } property string filenameExtension: "h" property string filenameSuffix: "_generated" property string includePrefix // TODO: test property bool keepPrefix: false _outputDir: FileInfo.joinPaths(product.buildDirectory, "flatbuf", "cpp") _searchPaths: flatbuffers.hostBinDirs cpp.cxxLanguageVersion: "c++11" cpp.systemIncludePaths: base.concat([_outputDir]) Rule { inputs: ["flatbuf.input"] outputFileTags: ["hpp"] outputArtifacts: { var module = input.flatbuf.cpp; var fullSuffix = module.filenameSuffix + "." + module.filenameExtension; return [ Flatbuf.artifact(module, input, "hpp", fullSuffix) ]; } prepare: { return Flatbuf.doPrepareCpp(input.flatbuf.cpp, input, output); } } validate: { Flatbuf.validateCompiler(compilerName, compilerPath); } } qbs-src-3.2.0/share/qbs/modules/flatbuf/c/0000755000175100017510000000000015154533055017706 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/flatbuf/c/flatbuffers-c.qbs0000644000175100017510000000434315154533055023144 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs import qbs.FileInfo import "../flatbuffers.js" as Flatbuf import "../flatbuffersbase.qbs" as FlatbufBase FlatbufBase { Depends { name: "cpp" } Depends { name: "flatcc" } compilerName: "flatcc" _outputDir: FileInfo.joinPaths(product.buildDirectory, "flatbuf", "c") _searchPaths: flatbuffers.hostBinDirs cpp.systemIncludePaths: base.concat([_outputDir]) Rule { inputs: ["flatbuf.input"] outputFileTags: ["hpp"] outputArtifacts: [Flatbuf.artifactC(input.flatbuf.c, input, "hpp", "_generated.h")] prepare: { return Flatbuf.doPrepareC(input.flatbuf.c, input); } } validate: { Flatbuf.validateCompiler(compilerName, compilerPath); } } qbs-src-3.2.0/share/qbs/modules/flatbuf/flatbuffers.js0000644000175100017510000001040115154533055022321 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var File = require("qbs.File"); function validateCompiler(compilerName, compilerPath) { if (!File.exists(compilerPath)) { throw "Can't find '" + compilerName + "' binary. Please set the compilerPath property or " + "make sure the compiler is found in PATH"; } } function getOutputDir(module, input) { var outputDir = module._outputDir; if (!module.keepPrefix) return outputDir; var importPaths = module.importPaths; if (importPaths !== undefined && importPaths.length !== 0) { var canonicalInput = File.canonicalFilePath(FileInfo.path(input.filePath)); for (var i = 0; i < importPaths.length; ++i) { var path = File.canonicalFilePath(importPaths[i]); if (canonicalInput.startsWith(path)) { return outputDir + "/" + FileInfo.relativePath(path, canonicalInput); } } } return outputDir; } function artifactC(module, input, tag, suffix) { var outputDir = module._outputDir; return { fileTags: [tag], filePath: outputDir + "/" + FileInfo.baseName(input.fileName) + suffix, cpp: { warningLevel: "none"} }; } function doPrepareC(module, input) { var args = []; args.push("-a") // write all args.push("-o", input.flatbuf.c._outputDir) // output dir var importPaths = module.importPaths; importPaths.forEach(function(path) { args.push("-I", path); }); args.push(input.filePath); var cmd = new Command(module.compilerPath, args); cmd.workingDirectory = FileInfo.path(module._outputDir) cmd.highlight = "codegen"; cmd.description = "generating C files for " + input.fileName; return [cmd]; } function artifact(module, input, tag, suffix) { var outputDir = getOutputDir(module, input); return { fileTags: [tag], filePath: outputDir + "/" + FileInfo.baseName(input.fileName) + suffix, cpp: { warningLevel: "none" } }; } function doPrepareCpp(module, input, output) { var outputDir = FileInfo.path(output.filePath); var result = []; var args = []; args.push("--cpp") var importPaths = module.importPaths; importPaths.forEach(function(path) { args.push("-I", path); }); args.push("--filename-ext", module.filenameExtension); args.push("--filename-suffix", module.filenameSuffix); if (module.includePrefix) args.push("--include-prefix", module.includePrefix); if (module.keepPrefix) args.push("--keep-prefix"); args.push(input.filePath); var cmd = new Command(input.flatbuf.cpp.compilerPath, args); cmd.workingDirectory = outputDir; cmd.highlight = "codegen"; cmd.description = "generating C++ files for " + input.fileName; result.push(cmd); return result; } qbs-src-3.2.0/share/qbs/modules/vcs/0000755000175100017510000000000015154533055016634 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/vcs/vcs-module.qbs0000644000175100017510000002253515154533055021430 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.Process import qbs.TextFile import qbs.Utilities Module { property string type: typeProbe.type property string repoDir: project.sourceDirectory property string toolFilePath: { if (type === "git") return "git"; if (type === "svn") return "svn"; if (type === "hg") return "hg"; } property string headerFileName: "vcs-repo-state.h" readonly property string repoState: gitProbe.repoState || subversionProbe.repoState || mercurialProbe.repoState readonly property string repoLatestTag: gitProbe.repoLatestTag || subversionProbe.repoLatestTag || mercurialProbe.repoLatestTag readonly property string repoCommitsSinceTag: gitProbe.repoCommitsSinceTag || subversionProbe.repoCommitsSinceTag || mercurialProbe.repoCommitsSinceTag readonly property string repoCommitSha: gitProbe.repoCommitSha || subversionProbe.repoCommitSha || mercurialProbe.repoCommitSha // Internal readonly property string includeDir: FileInfo.joinPaths(product.buildDirectory, "vcs-include") readonly property string metaDataBaseDir: typeProbe.metaDataBaseDir PropertyOptions { name: "type" allowedValues: ["git", "svn", "hg"] description: "the version control system your project is using" } Group { condition: headerFileName Depends { name: "cpp" } product.cpp.includePaths: [includeDir] Rule { multiplex: true Artifact { filePath: FileInfo.joinPaths(product.vcs.includeDir, product.vcs.headerFileName) fileTags: ["hpp"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.highlight = "codegen"; cmd.repoState = product.vcs.repoState; cmd.repoLatestTag = product.vcs.repoLatestTag; cmd.repoCommitsSinceTag = product.vcs.repoCommitsSinceTag; cmd.repoCommitSha = product.vcs.repoCommitSha; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); try { f.writeLine("#ifndef VCS_REPO_STATE_H"); f.writeLine("#define VCS_REPO_STATE_H"); f.writeLine('#define VCS_REPO_STATE "' + (repoState ? repoState : "none") + '"') f.writeLine('#define VCS_REPO_LATEST_TAG "' + (repoLatestTag ? repoLatestTag : "none") + '"') f.writeLine('#define VCS_REPO_COMMITS_SINCE_TAG "' + (repoCommitsSinceTag ? repoCommitsSinceTag : "none") + '"') f.writeLine('#define VCS_REPO_COMMIT_SHA "' + (repoCommitSha ? repoCommitSha : "none") + '"') f.writeLine("#endif"); } finally { f.close(); } }; return [cmd]; } } } Probe { id: typeProbe property string tool: toolFilePath property string theRepoDir: repoDir property string type property string metaDataBaseDir configure: { var detector = new Process(); try { detector.setWorkingDirectory(theRepoDir); if (detector.exec(tool || "git", ["rev-parse", "--git-dir"]) === 0) { found = true; type = "git"; metaDataBaseDir = detector.readStdOut().trim(); if (!FileInfo.isAbsolutePath(metaDataBaseDir)) metaDataBaseDir = FileInfo.joinPaths(theRepoDir, metaDataBaseDir); return; } if (detector.exec(tool || "svn", ["info", "--show-item", "wc-root", "--no-newline"]) === 0) { found = true type = "svn"; metaDataBaseDir = FileInfo.joinPaths(detector.readStdOut(), ".svn"); return; } else if (detector.exec(tool || "svn", ["info"]) === 0) { if (detector.exec(tool || "svn", ["--version", "--quiet"]) === 0 && Utilities.versionCompare(detector.readStdOut().trim(), "1.9") < 0) { throw "svn too old, version >= 1.9 required"; } } else if (detector.exec(tool || "hg", ["root"]) === 0) { found = true; type = "hg"; var hgRoot = detector.readStdOut().trim(); metaDataBaseDir = FileInfo.joinPaths(hgRoot, ".hg"); return; } } finally { detector.close(); } } } Probe { id: gitProbe condition: type === "git" property string tool: toolFilePath property string theRepoDir: repoDir property string filePath: FileInfo.joinPaths(metaDataBaseDir, "logs/HEAD") property var timestamp: File.lastModified(filePath) property string repoState property string repoLatestTag property string repoCommitsSinceTag property string repoCommitSha configure: { if (!File.exists(filePath)) { // it is possible that the HEAD file is not present in CI environments, in this // case we can use the commit count to determine the repo state // see https://bugreports.qt.io/projects/QBS/issues/QBS-1814 try { var proc = new Process(); proc.setWorkingDirectory(theRepoDir); proc.exec(tool, ["rev-list", "HEAD", "--count"], true); } catch (e) { return; // No commits yet. } finally { proc.close(); } } try { var proc = new Process(); proc.setWorkingDirectory(theRepoDir); proc.exec(tool, ["describe", "--always", "--long", "HEAD"], true); repoState = proc.readStdOut().trim(); if (repoState) { found = true; // tag is formatted as TAG-N-gSHA: // 1. latest tag is TAG // 2. number of commits since latest TAG is N // 3. latest commit is gSHA const tagSections = repoState.split("-").reverse(); if (tagSections.length >= 3) { repoCommitSha = tagSections[0]; repoCommitsSinceTag = tagSections[1]; repoLatestTag = tagSections.slice(2).reverse().join("-"); // Handle tags with dashes } else { repoCommitSha = "g" + tagSections[0]; } } } finally { proc.close(); } } } Probe { id: subversionProbe condition: type === "svn" property string tool: toolFilePath property string theRepoDir: repoDir property string filePath: FileInfo.joinPaths(metaDataBaseDir, "wc.db") property var timestamp: File.lastModified(filePath) property string repoState property string repoLatestTag property string repoCommitsSinceTag property string repoCommitSha configure: { var proc = new Process(); try { proc.setWorkingDirectory(theRepoDir); proc.exec(tool, ["info", "-r", "HEAD", "--show-item", "revision", "--no-newline"], true); repoState = proc.readStdOut().trim(); if (repoState) found = true; } finally { proc.close(); } } } Probe { id: mercurialProbe condition: type === "hg" property string tool: toolFilePath property string theRepoDir: repoDir property string filePath: FileInfo.joinPaths(metaDataBaseDir, "dirstate") property var timestamp: File.lastModified(filePath) property string repoState property string repoLatestTag property string repoCommitsSinceTag property string repoCommitSha configure: { if (!File.exists(filePath)) return; var proc = new Process(); try { proc.setWorkingDirectory(theRepoDir); var template = "{latesttag}-{latesttagdistance}-m{node|short}"; if (proc.exec(tool || "hg", ["log", "-r", ".", "--template", template]) === 0) { repoState = proc.readStdOut().trim(); found = true; // Parse output: TAG-N-mSHA const tagSections = repoState.split("-").reverse(); if (tagSections.length >= 3) { repoCommitSha = tagSections[0]; repoCommitsSinceTag = tagSections[1]; repoLatestTag = tagSections.slice(2).reverse().join("-"); // Handle tags with dashes } } } finally { proc.close(); } } } } qbs-src-3.2.0/share/qbs/modules/installpaths/0000755000175100017510000000000015154533055020547 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/installpaths/linux.qbs0000644000175100017510000000113415154533055022414 0ustar runnerrunnerimport "base.qbs" as Base import "debian.js" as Debian Base { priority: 0 condition: qbs.targetOS.contains("linux") lib: libdirProbe.found ? libdirProbe.libDir : base Probe { id: libdirProbe condition: autotetect property string libDir configure: { if (Debian.isDebian()) { libDir = Debian.getDebianLibPath(qbs.architecture); } else if (File.exists("/usr/lib64")) { libDir = "lib64"; } else { libDir = "lib"; } found = true; } } } qbs-src-3.2.0/share/qbs/modules/installpaths/base.qbs0000644000175100017510000000155615154533055022177 0ustar runnerrunnerModule { priority: -100 property bool autotetect: false property string bin: "bin" property string etc: "etc" property string include: "include" property string lib: "lib" property string topLevelProjectName: { var p = project; while (p.parent !== undefined) { p = p.parent; } return p.name; } property string subdir: topLevelProjectName.toLowerCase(); property string libexec: "libexec/" + subdir property string plugins: lib + "/" + subdir + "/plugins" property string headers: include + "/" + subdir property string share: "share/" + subdir property string applications: "Applications" property string frameworks: library + "/Frameworks" property string loadableModules: library + "/" + topLevelProjectName + "/PlugIns" property string library: "Library" } qbs-src-3.2.0/share/qbs/modules/installpaths/debian.js0000644000175100017510000000154115154533055022330 0ustar runnerrunner var File = require("qbs.File"); var Process = require("qbs.Process"); const debianArchMap = { "arm": "arm", "arm64": "arm64", "hppa": "hppa", "ia64": "ia64", "mips": "mips", "mips64": "mips64", "ppc64": "ppc64", "riscv": "riscv64", "s390x": "s390x", "sparc": "sparc", "sparc64": "sparc64", "x86": "i386", "x86_64": "amd64", }; function isDebian() { return File.exists("/etc/debian_version"); } // logic yoinked from meson function getDebianLibPath(qbsArchitecture) { var proc = new Process() const debianArch = debianArchMap[qbsArchitecture] if (debianArch === undefined) return "lib"; const args = ["-qDEB_TARGET_MULTIARCH", "-A", debianArch]; if (proc.exec("dpkg-architecture", args, true) == 0) { return "lib/" + proc.readStdOut().trim(); } return "lib"; } qbs-src-3.2.0/share/qbs/modules/Android/0000755000175100017510000000000015154533055017421 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/Android/sdk/0000755000175100017510000000000015154533055020202 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/Android/sdk/utils.js0000644000175100017510000006403015154533055021703 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var Process = require("qbs.Process"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); var Xml = require("qbs.Xml"); function availableBuildToolsVersions(sdkDir) { var re = /^([0-9]+)\.([0-9]+)\.([0-9]+)$/; var buildTools = File.directoryEntries(FileInfo.joinPaths(sdkDir, "build-tools"), File.Dirs | File.NoDotAndDotDot); var versions = []; for (var i = 0; i < buildTools.length; ++i) { var match = buildTools[i].match(re); if (match !== null) { versions.push(buildTools[i]); } } // Sort by version number versions.sort(function (a, b) { return Utilities.versionCompare(a, b); }); return versions; } function prepareDex(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var dexCompilerFilePath = product.Android.sdk._useD8 ? product.Android.sdk.d8FilePath : product.Android.sdk.dxFilePath; var args = ["--output", FileInfo.path(output.filePath)]; if (product.Android.sdk._useD8) { if (!product.Android.sdk.d8Desugaring) args.push("--no-desugaring"); if (product.Android.sdk.minimumVersion) { args.push("--min-api", product.Android.sdk.minimumVersion); } args.push("--release"); var classes = inputs["java.class"]; if (classes) { args = args.concat(classes.map(function(javaClass) { return FileInfo.relativePath(product.java.classFilesDir, javaClass.filePath) })); } } else { args.unshift("--dex"); args.push(product.java.classFilesDir); } var jarFiles = []; function traverseJarDeps(dep) { if (dep.parameters.Android && dep.parameters.Android.sdk && dep.parameters.Android.sdk.embedJar === false) return; var isJar = typeof dep.artifacts["java.jar"] !== "undefined"; if (!isJar) return; dep.artifacts["java.jar"].forEach(function(artifact) { if (!jarFiles.includes(artifact.filePath)) jarFiles.push(artifact.filePath); }); dep.dependencies.forEach(traverseJarDeps); } product.dependencies.forEach(traverseJarDeps); if (typeof product.artifacts["java.jar"] !== "undefined") { product.artifacts["java.jar"].forEach(function(artifact) { if (!jarFiles.includes(artifact.filePath)) jarFiles.push(artifact.filePath); }); } args = args.concat(jarFiles); var cmd; if (product.Android.sdk._useD8) { cmd = new JavaScriptCommand(); cmd.args = args; cmd.dexCompilerFilePath = dexCompilerFilePath; cmd.description = "creating " + output.fileName; cmd.workingDirectory = product.java.classFilesDir; cmd.extendedDescription = dexCompilerFilePath + " " + args.join(' '); cmd.highlight = "compiler"; cmd.sourceCode = function() { // androiddeployqt copied jar files in product.java.classFilesDir // but the rule only tags one jar file ("QtAndroid.jar"/"Qt6Android.jar") // So to pass all files to d8, Qbs needs to read the directory var bundledJarFilesDir = product.java.classFilesDir; var bundledJarFiles = File.directoryEntries(bundledJarFilesDir, File.Files | File.NoDotAndDotDot); args = args.concat(bundledJarFiles.map(function(jarFile) { return FileInfo.joinPaths(bundledJarFilesDir, jarFile) })); var process = new Process(); var exitCode; process.setWorkingDirectory(workingDirectory); process.exec(dexCompilerFilePath, args, true); try { process.exec(dexCompilerFilePath, args, true); } catch (e) { throw new Error("Error while running dex compiler command: '" + Process.shellQuote(dexCompilerFilePath, args) + "': " + e.toString()); } finally { process.close(); } } } else { cmd = new Command(dexCompilerFilePath, args); cmd.description = "creating " + output.fileName; cmd.workingDirectory = product.java.classFilesDir; } return [cmd]; } function findParentDir(filePath, parentDirName) { var lastDir; var currentDir = FileInfo.path(filePath); while (lastDir !== currentDir) { if (FileInfo.fileName(currentDir) === parentDirName) return currentDir; lastDir = currentDir; currentDir = FileInfo.path(currentDir); } } function commonAaptPackageArgs(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var manifestFilePath = inputs["android.manifest_final"][0].filePath; var args = ["package", "--auto-add-overlay", "-f", "-M", manifestFilePath, "-I", product.Android.sdk.androidJarFilePath]; var resources = inputs["android.resources"]; var resourceDirs = []; if (resources) { for (var i = 0; i < resources.length; ++i) { var resDir = findParentDir(resources[i].filePath, "res"); if (!resDir) { throw "File '" + resources[i].filePath + "' is tagged as an Android resource, " + "but is not located under a directory called 'res'."; } if (!resourceDirs.includes(resDir)) resourceDirs.push(resDir); } } for (i = 0; i < resourceDirs.length; ++i) args.push("-S", resourceDirs[i]); var assets = inputs["android.assets"]; var assetDirs = []; if (assets) { for (i = 0; i < assets.length; ++i) { var assetDir = findParentDir(assets[i].filePath, "assets"); if (!assetDir) { throw "File '" + assets[i].filePath + "' is tagged as an Android asset, " + "but is not located under a directory called 'assets'."; } if (!assetDirs.includes(assetDir)) assetDirs.push(assetDir); } } for (i = 0; i < assetDirs.length; ++i) args.push("-A", assetDirs[i]); if (product.qbs.buildVariant === "debug") args.push("--debug-mode"); return args; } // Rules: from https://developer.android.com/studio/command-line/aapt2 // Input Output // XML resource files, such as Resource table with *.arsc.flat as its extension. // String and Style, which are // located in the res/values/ // directory. // All other resource files. All files other than the files under res/values/ directory are // converted to binary XML files with *.flat extensions. // Additionally all PNG files are crunched by default and adopt // *.png.flat extensions. function generateAapt2ResourceFileName(filePath) { var suffix = FileInfo.suffix(filePath); if (suffix === "xml") { var data = new Xml.DomDocument(); data.load(filePath); var rootElem = data.documentElement(); if (rootElem && rootElem.isElement() && rootElem.tagName() === "resources") // This is a valid XML resource file suffix = "arsc"; // If the xml file is not a "resources" one then it's treated like any other resource file. } var dir = FileInfo.path(filePath); var baseName = FileInfo.completeBaseName(filePath) return FileInfo.fileName(dir) + "_" + baseName + "." + suffix + ".flat"; } function aapt2CompileResourceOutputs(product, inputs) { var outputs = []; var resources = inputs["android.resources"]; for (var i = 0; i < resources.length; ++i) { var filePath = resources[i].filePath; var resourceFileName = generateAapt2ResourceFileName(filePath); var compiledName = FileInfo.joinPaths(product.Android.sdk.compiledResourcesDir, resourceFileName); outputs.push({filePath: compiledName, fileTags: "android.resources_compiled"}); } return outputs; } function prepareAapt2CompileResource(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; var resources = inputs["android.resources"]; var compilesResourcesDir = product.Android.sdk.compiledResourcesDir; if (!File.makePath(compilesResourcesDir)) { throw "Cannot create directory '" + FileInfo.toNativeSeparators(compilesResourcesDir) + "'."; } var args = ["compile", FileInfo.toNativeSeparators(input.filePath), "-o", FileInfo.toNativeSeparators(compilesResourcesDir)]; var cmd = new Command(product.Android.sdk.aaptFilePath, args); var outputFileName = generateAapt2ResourceFileName(input.filePath); cmd.description = "compiling resource " + input.fileName + " into " + outputFileName; cmds.push(cmd); return cmds; } function aaptLinkOutputs(product, inputs) { var artifacts = []; artifacts.push({ filePath: product.Android.sdk.apkBaseName + (product.Android.sdk._generateAab ? ".apk_aab" : ".apk_apk"), fileTags: ["android.apk_resources"] }); var resources = inputs["android.resources_compiled"]; if (resources && resources.length) { artifacts.push({ filePath: FileInfo.joinPaths(product.Android.sdk.generatedJavaFilesDir, "R.java"), fileTags: ["java.java"] }); } for (var rp in product.Android.sdk.extraResourcePackages) { var resourcePackageName = product.Android.sdk.extraResourcePackages[rp]; artifacts.push({ filePath: FileInfo.joinPaths(product.Android.sdk.generatedJavaFilesBaseDir, resourcePackageName.split('.').join('/'), "R.java"), fileTags: ["java.java"] }); } return artifacts; } function prepareAapt2Link(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; var baseOutputFilePath = outputs["android.apk_resources"][0].filePath; var manifestFilePath = inputs["android.manifest_final"][0].filePath; var compilesResourcesDir = product.Android.sdk.compiledResourcesDir; var compiledResources = inputs["android.resources_compiled"]; var args = ["link", "-o", baseOutputFilePath, "-I", product.Android.sdk.androidJarFilePath]; var i = 0; if (compiledResources) { for (i = 0; i < compiledResources.length; ++i) args.push(compiledResources[i].filePath); } args.push("--no-auto-version"); args.push("--auto-add-overlay"); args.push("--manifest", manifestFilePath); args.push("--java", product.Android.sdk.generatedJavaFilesBaseDir); var assets = inputs["android.assets"]; var assetDirs = []; if (assets) { for (i = 0; i < assets.length; ++i) { var assetDir = findParentDir(assets[i].filePath, "assets"); if (!assetDir) { throw "File '" + assets[i].filePath + "' is tagged as an Android asset, " + "but is not located under a directory called 'assets'."; } if (!assetDirs.includes(assetDir)) assetDirs.push(assetDir); } } for (i = 0; i < assetDirs.length; ++i) args.push("-A", assetDirs[i]); if (product.qbs.buildVariant === "debug") args.push("-v"); if (product.Android.sdk._generateAab) args.push("--proto-format"); if (product.Android.sdk.extraResourcePackages) { args.push("--extra-packages"); args.push(product.Android.sdk.extraResourcePackages.join(":")); } var cmd = new Command(product.Android.sdk.aaptFilePath, args); cmd.description = "linking resources"; cmd.workingDirectory = product.buildDirectory; cmds.push(cmd); return cmds; } function aaptGenerateOutputs(product, inputs) { var artifacts = []; var resources = inputs["android.resources"]; if (resources && resources.length) { artifacts.push({ filePath: FileInfo.joinPaths(product.Android.sdk.generatedJavaFilesDir, "R.java"), fileTags: ["java.java"] }); } return artifacts; } function prepareAaptGenerate(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var args = commonAaptPackageArgs.apply(this, arguments); args.push("--no-crunch", "-m"); var resources = inputs["android.resources"]; if (resources && resources.length) args.push("-J", ModUtils.moduleProperty(product, "generatedJavaFilesBaseDir")); var cmd = new Command(product.Android.sdk.aaptFilePath, args); cmd.description = "processing resources"; return [cmd]; } function prepareAaptPackage(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; var apkOutput = outputs["android.package_unsigned"][0]; var args = commonAaptPackageArgs.apply(this, arguments); args.push("-F", apkOutput.filePath + ".unaligned"); args.push(product.Android.sdk.packageContentsDir); var cmd = new Command(product.Android.sdk.aaptFilePath, args); cmd.description = "generating " + apkOutput.fileName; cmds.push(cmd); cmd = new Command(product.Android.sdk.zipalignFilePath, ["-f", "4", apkOutput.filePath + ".unaligned", apkOutput.filePath]); cmd.silent = true; cmds.push(cmd); cmd = new JavaScriptCommand(); cmd.silent = true; cmd.unalignedApk = apkOutput.filePath + ".unaligned"; cmd.sourceCode = function() { File.remove(unalignedApk); }; cmds.push(cmd); return cmds; } function prepareApkPackage(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; var apkInputFilePath = inputs["android.apk_resources"][0].filePath; var apkOutput = outputs["android.package_unsigned"][0]; var apkOutputFilePathUnaligned = apkOutput.filePath + ".unaligned"; var dexFilePath = inputs["android.dex"][0].filePath; var copyCmd = new JavaScriptCommand(); copyCmd.description = "copying apk"; copyCmd.source = apkInputFilePath; copyCmd.target = apkOutputFilePathUnaligned; copyCmd.sourceCode = function() { File.copy(source, target); } cmds.push(copyCmd); var jarArgs = ["-uvf", apkOutputFilePathUnaligned, "."]; var libPath = FileInfo.joinPaths(product.Android.sdk.packageContentsDir); var jarCmd = new Command(product.java.jarFilePath, jarArgs); jarCmd.description = "packaging files"; jarCmd.workingDirectory = libPath; cmds.push(jarCmd); cmd = new Command(product.Android.sdk.zipalignFilePath, ["-f", "4", apkOutputFilePathUnaligned, apkOutput.filePath]); cmd.silent = true; cmds.push(cmd); cmd = new JavaScriptCommand(); cmd.silent = true; cmd.unalignedApk = apkOutputFilePathUnaligned; cmd.sourceCode = function() { File.remove(unalignedApk); }; cmds.push(cmd); return cmds; } function prepareBundletoolPackage(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; var baseModuleDir = product.Android.sdk.packageContentsDir; var manifestDirName = FileInfo.joinPaths(baseModuleDir, "manifest"); var pkgBaseFileName = inputs["android.apk_resources"][0].filePath; var jarResourcesArgs = ["xf", pkgBaseFileName]; var jarResourcesCmd = new Command(product.java.jarFilePath, jarResourcesArgs); jarResourcesCmd.description = "extracting resources apk"; jarResourcesCmd.workingDirectory = baseModuleDir; cmds.push(jarResourcesCmd); var moveManifestCmd = new JavaScriptCommand(); moveManifestCmd.description = "moving manifest in manifest directory"; moveManifestCmd.path = manifestDirName; moveManifestCmd.manifestFilePath = baseModuleDir + "/AndroidManifest.xml"; moveManifestCmd.sourceCode = function() { if (!File.exists(path)) File.makePath(path); if (File.exists(manifestFilePath)) File.move(manifestFilePath, path + "/AndroidManifest.xml"); } cmds.push(moveManifestCmd); var baseFilePath = FileInfo.joinPaths(product.buildDirectory, "base.zip"); var jarBaseArgs = ["cfM", baseFilePath, "."]; var jarBaseCmd = new Command(product.java.jarFilePath, jarBaseArgs); jarBaseCmd.description = "compressing base module"; jarBaseCmd.workingDirectory = baseModuleDir; cmds.push(jarBaseCmd); var aabFilePath = outputs["android.package_unsigned"][0].filePath; var removeCmd = new JavaScriptCommand(); removeCmd.description = "removing previous aab"; removeCmd.filePath = aabFilePath; removeCmd.sourceCode = function() { if (File.exists(filePath)) File.remove(filePath); } cmds.push(removeCmd); var bundleConfigFilePath = FileInfo.joinPaths(product.buildDirectory, "BundleConfig.json"); var createBundleConfigCmd = new JavaScriptCommand(); createBundleConfigCmd.description = "create BundleConfig.json"; createBundleConfigCmd.filePath = bundleConfigFilePath; createBundleConfigCmd.sourceCode = function() { var bc = new TextFile(filePath, TextFile.WriteOnly); bc.writeLine('{"optimizations": {'); bc.writeLine('"uncompress_native_libraries": {'); bc.writeLine('"enabled": false'); bc.writeLine('}}}'); } cmds.push(createBundleConfigCmd); var args = ["-jar", product.Android.sdk.bundletoolFilePath, "build-bundle"]; args.push("--modules=" + baseFilePath); args.push("--output=" + aabFilePath); args.push("--config=" + bundleConfigFilePath); var cmd = new Command(product.java.interpreterFilePath, args); cmd.description = "generating " + aabFilePath.fileName; cmds.push(cmd); return cmds; } function stlDeploymentData(product, inputs, type) { var data = { uniqueInputs: [], outputFilePaths: []}; var uniqueFilePaths = []; var theInputs = inputs["android.stl"]; if (!theInputs) return data; for (var i = 0; i < theInputs.length; ++i) { var currentInput = theInputs[i]; if (uniqueFilePaths.includes(currentInput.filePath)) continue; uniqueFilePaths.push(currentInput.filePath); data.uniqueInputs.push(currentInput); var outputFileName = currentInput.fileName; data.outputFilePaths.push(FileInfo.joinPaths(product.Android.sdk.packageContentsDir, "lib", currentInput.Android.ndk.abi, outputFileName)); } return data; } function elementHasBundledAttributes(element) { return element.hasAttribute("android:name") && (element.attribute("android:name") === "android.app.bundled_in_assets_resource_id") || (element.attribute("android:name") === "android.app.bundled_in_lib_resource_id"); } function deployStlOutputs(product, inputs) { var deploymentData = stlDeploymentData(product, inputs, "stl"); var outputs = []; for (var i = 0; i < deploymentData.outputFilePaths.length; ++i) { outputs.push({filePath: deploymentData.outputFilePaths[i], fileTags: "android.stl_deployed"}); } return outputs; } function deployStlCommands(product, inputs) { var cmds = []; var deploymentData = stlDeploymentData(product, inputs); for (var i = 0; i < deploymentData.uniqueInputs.length; ++i) { var input = deploymentData.uniqueInputs[i]; var stripArgs = ["--strip-all", "-o", deploymentData.outputFilePaths[i], input.filePath]; var cmd = new Command(input.cpp.stripPath, stripArgs); cmd.description = "deploying " + input.fileName; cmds.push(cmd); } return cmds; } function generateBuildConfigJavaCommands(product, output) { var cmd = new JavaScriptCommand(); cmd.description = "generating BuildConfig.java"; cmd.sourceCode = function() { var debugValue = product.qbs.buildVariant === "debug" ? "true" : "false"; var ofile = new TextFile(output.filePath, TextFile.WriteOnly); ofile.writeLine("package " + product.Android.sdk.packageName + ";") ofile.writeLine("public final class BuildConfig {"); ofile.writeLine(" public final static boolean DEBUG = " + debugValue + ";"); ofile.writeLine("}"); ofile.close(); }; return [cmd]; } function generateProcessedManifestCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmd = new JavaScriptCommand(); cmd.description = "ensuring correct package name in Android manifest file"; cmd.sourceCode = function() { var manifestData = new Xml.DomDocument(); manifestData.load(input.filePath); var rootElem = manifestData.documentElement(); if (!rootElem || !rootElem.isElement() || rootElem.tagName() !== "manifest") throw "No manifest tag found in '" + input.filePath + "'."; // Quick sanity check. Don't try to be fancy; let's not risk rejecting valid names. var packageName = product.Android.sdk.packageName; if (!packageName.match(/^[^.]+(?:\.[^.]+)+$/)) { throw "Package name '" + packageName + "' is not valid. Please set " + "Android.sdk.packageName to a name following the " + "'com.mycompany.myproduct' pattern." } rootElem.setAttribute("package", packageName); if (product.Android.sdk.versionCode !== undefined) rootElem.setAttribute("android:versionCode", product.Android.sdk.versionCode); if (product.Android.sdk.versionName !== undefined) rootElem.setAttribute("android:versionName", product.Android.sdk.versionName); if (product.Android.sdk._bundledInAssets) { // Remove // custom AndroidManifest.xml because assets are in rcc files for qt >= 5.14 var appElem = rootElem.firstChild("application"); if (!appElem || !appElem.isElement() || appElem.tagName() !== "application") throw "No application tag found in '" + input.filePath + "'."; var activityElem = appElem.firstChild("activity"); if (!activityElem || !activityElem.isElement() || activityElem.tagName() !== "activity") throw "No activity tag found in '" + input.filePath + "'."; var metaDataElem = activityElem.firstChild("meta-data"); while (metaDataElem && metaDataElem.isElement()) { if (elementHasBundledAttributes(metaDataElem)) { var elemToRemove = metaDataElem; metaDataElem = metaDataElem.nextSibling("meta-data"); activityElem.removeChild(elemToRemove); } else { metaDataElem = metaDataElem.nextSibling("meta-data"); } } } var usedSdkElem = rootElem.firstChild("uses-sdk"); if (!usedSdkElem || !usedSdkElem.isElement()) { usedSdkElem = manifestData.createElement("uses-sdk"); rootElem.appendChild(usedSdkElem); } else { if (!usedSdkElem.isElement()) throw "Tag uses-sdk is not an element in '" + input.filePath + "'."; } usedSdkElem.setAttribute("android:minSdkVersion", product.Android.sdk.minimumVersion); usedSdkElem.setAttribute("android:targetSdkVersion", product.Android.sdk.targetVersion); rootElem.appendChild(usedSdkElem); manifestData.save(output.filePath, 4); } return cmd; } function processAidlCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var aidl = product.Android.sdk.aidlFilePath; var args = ["-p" + product.Android.sdk.frameworkAidlFilePath]; var aidlSearchPaths = input.Android.sdk.aidlSearchPaths; for (var i = 0; i < (aidlSearchPaths ? aidlSearchPaths.length : 0); ++i) args.push("-I" + aidlSearchPaths[i]); args.push(input.filePath, output.filePath); var cmd = new Command(aidl, args); cmd.description = "processing " + input.fileName; return [cmd]; } qbs-src-3.2.0/share/qbs/modules/Android/sdk/sdk.qbs0000644000175100017510000004061015154533055021473 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Environment import qbs.File import qbs.FileInfo import qbs.ModUtils import qbs.Probes import qbs.TextFile import qbs.Utilities import qbs.Xml import "utils.js" as SdkUtils Module { Probes.AndroidSdkProbe { id: sdkProbe environmentPaths: (sdkDir ? [sdkDir] : []).concat(base) } Probes.AndroidNdkProbe { id: ndkProbe sdkPath: sdkProbe.path environmentPaths: (ndkDir ? [ndkDir] : []).concat(base) } Probes.PathProbe { id: bundletoolProbe platformSearchPaths: [sdkDir] names: ["bundletool-all"] nameSuffixes: ["-0.11.0.jar", "-0.12.0.jar", "-0.13.0.jar", "-0.13.3.jar", "-0.13.4.jar", "-0.14.0.jar", "-0.15.0.jar", "-1.0.0.jar", "-1.1.0.jar", "-1.2.0.jar", "-1.3.0.jar", "-1.4.0.jar", "-1.5.0.jar", "-1.6.0.jar", "-1.6.1.jar", "-1.7.0.jar", "-1.7.1.jar", "-1.8.0.jar"] } property path sdkDir: sdkProbe.path property path ndkDir: ndkProbe.path property path ndkSamplesDir: ndkProbe.samplesDir property string buildToolsVersion: sdkProbe.buildToolsVersion property var buildToolsVersionParts: buildToolsVersion ? buildToolsVersion.split('.').map(function(item) { return parseInt(item, 10); }) : [] property int buildToolsVersionMajor: buildToolsVersionParts[0] property int buildToolsVersionMinor: buildToolsVersionParts[1] property int buildToolsVersionPatch: buildToolsVersionParts[2] property string platform: sdkProbe.platform property string minimumVersion: "21" property string targetVersion: platformVersion.toString() property path bundletoolFilePath: bundletoolProbe.filePath // Product-specific properties and files property string packageName: { var idx = product.name.indexOf(".") if (idx > 0 && idx < product.name.length) return product.name; return "com.example." + product.name; } property int versionCode property string versionName property string apkBaseName: packageName property bool automaticSources: true property bool legacyLayout: false property path sourceSetDir: legacyLayout ? product.sourceDirectory : FileInfo.joinPaths(product.sourceDirectory, "src/main") property path resourcesDir: FileInfo.joinPaths(sourceSetDir, "res") property path assetsDir: FileInfo.joinPaths(sourceSetDir, "assets") property path sourcesDir: FileInfo.joinPaths(sourceSetDir, legacyLayout ? "src" : "java") property string manifestFile: defaultManifestFile readonly property string defaultManifestFile: FileInfo.joinPaths(sourceSetDir, "AndroidManifest.xml") property bool customManifestProcessing: false property bool _enableRules: !product.multiplexConfigurationId && !!packageName property bool _bundledInAssets: true // Internal properties. property int platformVersion: { if (platform) { var match = platform.match(/^android-([0-9]+)$/); if (match !== null) { return parseInt(match[1], 10); } } } property string platformJavaVersion: { if (platformVersion >= 21) return "1.7"; return "1.5"; } property path buildToolsDir: FileInfo.joinPaths(sdkDir, "build-tools", buildToolsVersion) property string aaptName: "aapt2" PropertyOptions { name: "aaptName" allowedValues: ["aapt", "aapt2"] } property path aaptFilePath: FileInfo.joinPaths(buildToolsDir, aaptName) readonly property bool _enableAapt2: aaptName === "aapt2" property string packageType: "apk" PropertyOptions { name: "packageType" allowedValues: ["apk", "aab"] } readonly property bool _generateAab: packageType == "aab" property stringList extraResourcePackages PropertyOptions { name: "extraResourcePackages" description: "extra resource packages to compile resources for" } property path apksignerFilePath: FileInfo.joinPaths(buildToolsDir, "apksigner") property path aidlFilePath: FileInfo.joinPaths(buildToolsDir, "aidl") property path dxFilePath: FileInfo.joinPaths(buildToolsDir, "dx") property path d8FilePath: FileInfo.joinPaths(buildToolsDir, "d8") property string dexCompilerName: "d8" PropertyOptions { name: "dexCompilerName" allowedValues: ["dx", "d8"] } readonly property bool _useD8: dexCompilerName === "d8" property bool d8Desugaring: false PropertyOptions { name: "d8Desugaring" description: "enable desugaring in d8 dex compiler" } property path zipalignFilePath: FileInfo.joinPaths(buildToolsDir, "zipalign") property path androidJarFilePath: FileInfo.joinPaths(sdkDir, "platforms", platform, "android.jar") property path frameworkAidlFilePath: FileInfo.joinPaths(sdkDir, "platforms", platform, "framework.aidl") property path generatedJavaFilesBaseDir: FileInfo.joinPaths(product.buildDirectory, "gen") property path generatedJavaFilesDir: FileInfo.joinPaths(generatedJavaFilesBaseDir, (packageName || "").split('.').join('/')) property path compiledResourcesDir: FileInfo.joinPaths(product.buildDirectory, "compiled_resources") property string packageContentsDir: FileInfo.joinPaths(product.buildDirectory, packageType) property stringList aidlSearchPaths Group { condition: automaticSources Group { name: "java sources" prefix: FileInfo.resolvePath(product.sourceDirectory, module.sourcesDir + '/') files: "**/*.java" } Group { name: "android resources" fileTags: ["android.resources"] prefix: FileInfo.resolvePath(product.sourceDirectory, module.resourcesDir + '/') files: "**/*" } Group { name: "android assets" fileTags: ["android.assets"] prefix: FileInfo.resolvePath(product.sourceDirectory, module.assetsDir + '/') files: "**/*" } Group { name: "manifest" fileTags: ["android.manifest"] files: module.manifestFile && module.manifestFile !== module.defaultManifestFile ? [module.manifestFile] : (File.exists(module.defaultManifestFile) ? [module.defaultManifestFile] : []) } } Group { condition: !customManifestProcessing fileTagsFilter: "android.manifest_processed" fileTags: "android.manifest_final" } Group { condition: _enableRules Depends { name: "java" } Depends { name: "codesign" } product.java.languageVersion: platformJavaVersion product.java.runtimeVersion: platformJavaVersion product.java.bootClassPaths: androidJarFilePath product.codesign.apksignerFilePath: apksignerFilePath product.codesign._packageName: apkBaseName + (_generateAab ? ".aab" : ".apk") product.codesign.useApksigner: !_generateAab Rule { inputs: ["android.aidl"] Artifact { filePath: FileInfo.joinPaths(Utilities.getHash(input.filePath), input.completeBaseName + ".java") fileTags: ["java.java"] } prepare: SdkUtils.processAidlCommands.apply(SdkUtils, arguments) } Rule { inputs: "android.manifest" Artifact { filePath: FileInfo.joinPaths("processed_manifest", input.fileName) fileTags: "android.manifest_processed" } prepare: SdkUtils.generateProcessedManifestCommands.apply(SdkUtils, arguments) } Rule { multiplex: true Artifact { filePath: FileInfo.joinPaths(product.Android.sdk.generatedJavaFilesDir, "BuildConfig.java") fileTags: ["java.java"] } prepare: SdkUtils.generateBuildConfigJavaCommands(product, output) } Rule { multiplex: true inputs: ["java.class"] inputsFromDependencies: ["java.jar", "bundled_jar"] Artifact { filePath: product.Android.sdk._generateAab ? FileInfo.joinPaths(product.Android.sdk.packageContentsDir, "dex", "classes.dex") : FileInfo.joinPaths(product.Android.sdk.packageContentsDir, "classes.dex") fileTags: ["android.dex"] } prepare: SdkUtils.prepareDex.apply(SdkUtils, arguments) } Rule { property stringList inputTags: "android.nativelibrary" inputsFromDependencies: inputTags inputs: product.aggregate ? [] : inputTags Artifact { filePath: FileInfo.joinPaths(product.Android.sdk.packageContentsDir, "lib", input.Android.ndk.abi, product.Android.sdk._archInName ? input.baseName + "_" + input.Android.ndk.abi + ".so" : input.fileName) fileTags: "android.nativelibrary_deployed" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "copying " + input.fileName + " for packaging"; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return cmd; } } Rule { multiplex: true property stringList inputTags: "android.stl" inputsFromDependencies: inputTags inputs: product.aggregate ? [] : inputTags outputFileTags: "android.stl_deployed" outputArtifacts: SdkUtils.deployStlOutputs(product, inputs) prepare: SdkUtils.deployStlCommands(product, inputs) } Group { condition: module._enableAapt2 Rule { inputs: ["android.resources"] outputFileTags: ["android.resources_compiled"] outputArtifacts: SdkUtils.aapt2CompileResourceOutputs(product, inputs) prepare: SdkUtils.prepareAapt2CompileResource.apply(SdkUtils, arguments) } Rule { multiplex: true inputs: ["android.resources_compiled", "android.assets", "android.manifest_final"] outputFileTags: ["java.java", "android.apk_resources"] outputArtifacts: SdkUtils.aaptLinkOutputs(product, inputs) prepare: SdkUtils.prepareAapt2Link.apply(SdkUtils, arguments) } Rule { condition: module._generateAab multiplex: true inputs: [ "android.apk_resources", "android.manifest_final", "android.dex", "android.stl_deployed", "android.nativelibrary_deployed" ] Artifact { filePath: product.Android.sdk.apkBaseName + ".aab_unsigned" fileTags: "android.package_unsigned" } prepare: SdkUtils.prepareBundletoolPackage.apply(SdkUtils, arguments) } Rule { condition: !module._generateAab multiplex: true inputs: [ "android.apk_resources", "android.manifest_final", "android.dex", "android.stl_deployed", "android.nativelibrary_deployed" ] Artifact { filePath: product.Android.sdk.apkBaseName + ".apk_unsigned" fileTags: "android.package_unsigned" } prepare: SdkUtils.prepareApkPackage.apply(SdkUtils, arguments) } } Group { condition: !module._enableAapt2 Rule { multiplex: true inputs: ["android.resources", "android.assets", "android.manifest_final"] outputFileTags: ["java.java"] outputArtifacts: SdkUtils.aaptGenerateOutputs(product, inputs) prepare: SdkUtils.prepareAaptGenerate.apply(SdkUtils, arguments) } Rule { condition: !module._generateAab multiplex: true inputs: [ "android.resources", "android.assets", "android.manifest_final", "android.dex", "android.stl_deployed", "android.nativelibrary_deployed" ] Artifact { filePath: product.Android.sdk.apkBaseName + ".apk_unsigned" fileTags: "android.package_unsigned" } prepare: SdkUtils.prepareAaptPackage.apply(SdkUtils, arguments) } } } validate: { if (!sdkDir) { throw ModUtils.ModuleError("Could not find an Android SDK at any of the following " + "locations:\n\t" + sdkProbe.candidatePaths.join("\n\t") + "\nInstall the Android SDK to one of the above locations, " + "or set the Android.sdk.sdkDir property or " + "ANDROID_HOME environment variable to a valid " + "Android SDK location."); } if (!bundletoolFilePath && _generateAab) { throw ModUtils.ModuleError("Could not find Android bundletool at the following " + "location:\n\t" + Android.sdk.sdkDir + "\nInstall the Android bundletool to the above location, " + "or set the Android.sdk.bundletoolFilePath property.\n" + "Android bundletool can be downloaded from " + "https://github.com/google/bundletool"); } if (Utilities.versionCompare(buildToolsVersion, "24.0.3") < 0) { throw ModUtils.ModuleError("Version of Android SDK build tools too old. This version " + "is " + buildToolsVersion + " and minimum version is " + "24.0.3. Please update the Android SDK.") } } FileTagger { patterns: ["AndroidManifest.xml"] fileTags: ["android.manifest"] } FileTagger { patterns: ["*.aidl"] fileTags: ["android.aidl"] } Parameter { property bool embedJar: true } } qbs-src-3.2.0/share/qbs/modules/Android/ndk/0000755000175100017510000000000015154533055020175 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/Android/ndk/utils.js0000644000175100017510000000646315154533055021704 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Utilities = require("qbs.Utilities") function abiNameToDirName(abiName) { switch (abiName) { case "armeabi": case "armeabi-v7a": return "arm"; case "arm64-v8a": return "arm64"; default: return abiName; } } function androidAbi(arch) { switch (arch) { case "arm64": return "arm64-v8a"; case "armv5": case "armv5te": return "armeabi"; case "armv7": case "armv7a": return "armeabi-v7a"; default: return arch; } } function commonCompilerFlags(toolchain, buildVariant, ndk) { var flags = ["-Werror=format-security"]; var abi = ndk.abi; var armMode = ndk.armMode; if (abi === "arm64-v8a") flags.push("-fpic"); if (abi === "armeabi" || abi === "armeabi-v7a") { flags.push("-fpic"); if (abi === "armeabi") flags.push("-mtune=xscale", "-msoft-float"); if (abi === "armeabi-v7a") { flags.push("-mfpu=vfpv3-d16"); flags.push("-mfloat-abi=softfp"); } } if (abi === "x86" || abi === "x86_64") flags.push("-fPIC"); flags.push("-fno-limit-debug-info"); if (armMode) flags.push("-m" + armMode); // https://github.com/android-ndk/ndk/issues/884 is fixed in r21 if (ndk.version < 21) flags.push("-fno-addrsig"); // https://github.com/android/ndk/issues/635 is fixed in api 24 if (abi === "x86" && ndk.platformVersion < 24) flags.push("-mstackrealign"); return flags; } function commonLinkerFlags(ndk) { var buildId = (ndk.buildId) ? "--build-id=" + ndk.buildId : "--build-id"; return ["-z", "noexecstack", "-z", "relro", "-z", "now", buildId, "--gc-sections"]; } function stlFileName(prefix, ndk, suffix) { return prefix + ndk.appStl.slice(0, ndk.appStl.indexOf('_')) + suffix; } qbs-src-3.2.0/share/qbs/modules/Android/ndk/ndk.qbs0000644000175100017510000001322015154533055021456 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.ModUtils import qbs.Probes import qbs.Utilities import "utils.js" as NdkUtils Module { Probes.AndroidNdkProbe { id: ndkProbe environmentPaths: (ndkDir ? [ndkDir] : []).concat(base) } version: ndkProbe.ndkVersion readonly property string abi: NdkUtils.androidAbi(qbs.architecture) PropertyOptions { name: "abi" description: "Supported Android ABIs" allowedValues: ["arm64-v8a", "armeabi-v7a", "x86", "x86_64"] } // From https://android.googlesource.com/platform/ndk/+/refs/heads/ndk-release-r21/docs/BuildSystemMaintainers.md // Android Studio‘s LLDB debugger uses a binary’s build ID to locate debug information. To // ensure that LLDB works with a binary, pass an option like -Wl,--build-id=sha1 to Clang when // linking. Other --build-id= modes are OK, but avoid a plain --build-id argument when using // LLD, because Android Studio‘s version of LLDB doesn’t recognize LLD's default 8-byte build // ID. See Issue 885. // Plain --build-id option is nevertheless implemented when buildId property is empty. // Possible values (from man page of ld.lld — ELF linker from the LLVM project): // one of fast, md5, sha1, tree, uuid, 0xhex-string, and none. tree is an alias for sha1. // Build-IDs of type fast, md5, sha1, and tree are calculated from the object contents. fast is // not intended to be cryptographically secure. property string buildId: "sha1" // See https://developer.android.com/ndk/guides/cpp-support.html property string appStl: "c++_shared" PropertyOptions { name: "appStl" description: "C++ Runtime Libraries." allowedValues: ["c++_static", "c++_shared"] } property string hostArch: ndkProbe.hostArch property string ndkDir: ndkProbe.path property string ndkSamplesDir: ndkProbe.samplesDir property string platform: { switch (abi) { case "armeabi-v7a": // case "x86": // x86 has broken wstring support return "android-19"; default: return "android-21"; } } property int platformVersion: { if (platform) { var match = platform.match(/^android-([0-9]+)$/); if (match !== null) { return parseInt(match[1], 10); } } } property stringList abis: { var list = ["armeabi-v7a"]; if (platformVersion >= 16) list.push("x86"); if (platformVersion >= 21) list.push("arm64-v8a", "x86_64"); return list; } property string armMode: abi && abi.startsWith("armeabi") ? (qbs.buildVariant === "debug" ? "arm" : "thumb") : undefined; PropertyOptions { name: "armMode" description: "Determines the instruction set for armeabi configurations." allowedValues: ["arm", "thumb"] } validate: { if (!ndkDir) { throw ModUtils.ModuleError("Could not find an Android NDK at any of the following " + "locations:\n\t" + ndkProbe.candidatePaths.join("\n\t") + "\nInstall the Android NDK to one of the above locations, " + "or set the Android.ndk.ndkDir property or " + "ANDROID_NDK_ROOT environment variable to a valid " + "Android NDK location."); } if (Utilities.versionCompare(version, "19") < 0) throw ModUtils.ModuleError("Unsupported NDK version " + Android.ndk.version + ", please upgrade your NDK to r19+"); if (product.aggregate && !product.multiplexConfigurationId) return; var validator = new ModUtils.PropertyValidator("Android.ndk"); validator.setRequiredProperty("abi", abi); validator.setRequiredProperty("appStl", appStl); validator.setRequiredProperty("hostArch", hostArch); validator.setRequiredProperty("platform", platform); return validator.validate(); } } qbs-src-3.2.0/share/qbs/modules/Android/android-utils.js0000644000175100017510000000416515154533055022543 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); function availablePlatforms(baseDir) { var re = /^android-([0-9]+)$/; var platforms = File.directoryEntries(FileInfo.joinPaths(baseDir, "platforms"), File.Dirs | File.NoDotAndDotDot); var versions = []; for (var i = 0; i < platforms.length; ++i) { var match = platforms[i].match(re); if (match !== null) { versions.push(platforms[i]); } } versions.sort(function (a, b) { return parseInt(a.match(re)[1], 10) - parseInt(b.match(re)[1], 10); }); return versions; } qbs-src-3.2.0/share/qbs/modules/cli/0000755000175100017510000000000015154533055016610 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/cli/cli.js0000644000175100017510000001621315154533055017720 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); function prepareCompiler(product, inputs, output) { var i; var args = ["/nologo"]; var platformDefines = product.moduleProperty("cli", "platformDefines"); var compilerDefines = product.moduleProperty("cli", "compilerDefines"); var defines = product.moduleProperty("cli", "defines"); var platformCompilerFlags = product.moduleProperty("cli", "platformCompilerFlags"); var compilerFlags = product.moduleProperty("cli", "compilerFlags") var libraryPaths = product.moduleProperty("cli", "libraryPaths"); var dynamicLibraries = product.moduleProperty("cli", "dynamicLibraries"); var netmodules = product.moduleProperty("cli", "netmodules"); var warnAsError = product.moduleProperty("cli", "treatWarningsAsErrors"); var warningLevel = product.moduleProperty("cli", "warningLevel"); var debugInformation = product.moduleProperty("cli", "debugInformation"); var optimization = product.moduleProperty("cli", "optimization"); var architecture = product.moduleProperty("cli", "architecture"); var csharpCompilerPath = product.moduleProperty("cli", "csharpCompilerPath"); var vbCompilerPath = product.moduleProperty("cli", "vbCompilerPath"); var fsharpCompilerPath = product.moduleProperty("cli", "fsharpCompilerPath"); var compilers = { "cli.csharp": csharpCompilerPath, "cli.vb": vbCompilerPath, "cli.fsharp": fsharpCompilerPath }; var pathFunction = product.moduleProperty("qbs", "hostOS").includes("windows") ? FileInfo.toWindowsSeparators : function (path) { return path; }; var outputDescription = "assembly"; if (output.fileTags.includes("application")) { args.push("/target:" + (product.consoleApplication === false ? "winexe" : "exe")); } else if (output.fileTags.includes("dynamiclibrary")) { args.push("/target:library"); } else if (output.fileTags.includes("cli.netmodule")) { args.push("/target:module"); outputDescription = "netmodule"; } // Make sure our input files are all the same language var keys = Object.keys(inputs); var language; for (i in keys) { if (Object.keys(compilers).includes(keys[i])) { if (language) throw("You cannot compile source files in more than one CLI language into a single " + outputDescription + "."); language = keys[i]; } } if (!compilers[language]) { throw("No CLI compiler available to compile " + language + " files."); } // docs state "/platform is not available in the development environment in Visual C# Express" // does this mean from the IDE or the compiler itself shipped with Express does not support it? if (architecture !== undefined) { if (architecture === "x86" || architecture === "anycpu" || architecture === "anycpu32bitpreferred") // requires .NET 4.5 ; else if (architecture === "x86_64") architecture = "x64"; else if (architecture === "ia64") architecture = "Itanium"; else if (architecture === "arm") architecture = "ARM"; else throw("Invalid CLI architecture: " + architecture); args.push("/platform:" + architecture); } if (debugInformation !== undefined) args.push("/debug" + (debugInformation ? "+" : "-")); if (optimization !== undefined) args.push("/optimize" + (optimization !== "none" ? "+" : "-")); if (warnAsError !== undefined) args.push("/warnaserror" + (warnAsError ? "+" : "-")); if (warningLevel !== undefined) { if (language === "cli.vb") { if (warningLevel === "none" || warningLevel === "0") args.push("/quiet"); } else { if (warningLevel === "all") warningLevel = "4"; else if (warningLevel === "none") warningLevel = "0"; args.push("/warn:" + warningLevel); } } // Preprocessor defines var allDefines = (platformDefines || []).concat(compilerDefines || []).concat(defines || []); if (allDefines.length > 0) args.push("/define:" + allDefines.join(";")); // Library search paths for (i in libraryPaths) args.push("/lib:" + libraryPaths.join(",")); // Dependent libraries for (i in dynamicLibraries) { args.push("/reference:" + dynamicLibraries[i] + product.moduleProperty("cli", "dynamicLibrarySuffix")); } for (i in inputs.dynamiclibrary) args.push("/reference:" + inputs.dynamiclibrary[i].filePath); // Dependent netmodules for (i in netmodules) { args.push("/addmodule:" + netmodules.map(function (f) { return f + product.moduleProperty("cli", "netmoduleSuffix"); }).join(";")); } if (inputs["cli.netmodule"]) { args.push("/addmodule:" + inputs["cli.netmodule"].map(function (f) { return f.filePath; }).join(";")); } // Dependent resources for (i in inputs["cli.resources"]) args.push("/resource:" + pathFunction(inputs["cli.resources"][i].filePath)); // Additional compiler flags args = args.concat((platformCompilerFlags || []).concat(compilerFlags || [])); args.push("/out:" + pathFunction(output.filePath)); for (i in inputs[keys[0]]) args.push(pathFunction(inputs[keys[0]][i].filePath)); var cmd = new Command(compilers[language], args); cmd.description = "linking " + output.fileName; cmd.highlight = "linker"; cmd.workingDirectory = FileInfo.path(output.filePath); return cmd; } qbs-src-3.2.0/share/qbs/modules/cli/CLIModule.qbs0000644000175100017510000001553715154533055021107 0ustar runnerrunner// base for Common Language Infrastructure modules import qbs.FileInfo import qbs.Host import qbs.ModUtils import "cli.js" as CLI Module { Group { condition: qbs.targetOS.includes("darwin") Depends { name: "bundle" } product.bundle.isBundle: false } condition: false property string warningLevel: 'all' // 'none', 'all' property bool treatWarningsAsErrors: false property string architecture: "anycpu" // for the CLI this is a much better default than qbs.architecture property string optimization: qbs.optimization property bool debugInformation: qbs.debugInformation property stringList defines property stringList platformDefines: qbs.enableDebugCode ? [] : ["NDEBUG"] property stringList compilerDefines PropertyOptions { name: "compilerDefines" description: "preprocessor macros that are defined when using this particular compiler" } property pathList libraryPaths property string csharpCompilerName property string csharpCompilerPath: FileInfo.joinPaths(toolchainInstallPath, csharpCompilerName) property string vbCompilerName property string vbCompilerPath: FileInfo.joinPaths(toolchainInstallPath, vbCompilerName) property string fsharpCompilerName property string fsharpCompilerPath: FileInfo.joinPaths(toolchainInstallPath, fsharpCompilerName) property string resgenName: "resgen" property string resgenPath: FileInfo.joinPaths(toolchainInstallPath, resgenName) property string dynamicLibrarySuffix: ".dll" property string executableSuffix: ".exe" property string netmoduleSuffix: ".netmodule" property string debugInfoSuffix property stringList dynamicLibraries // list of names, will be linked with /reference:name property stringList netmodules // list of netmodule files, will be linked with /addmodule:name property bool generateManifestFile: true property string toolchainInstallPath property stringList compilerFlags PropertyOptions { name: "compilerFlags" description: "additional compiler flags" } // Platform properties. Those are intended to be set by the toolchain setup // and are prepended to the corresponding user properties. property stringList platformCompilerFlags FileTagger { patterns: ["*.cs", "*.CS"] fileTags: ["cli.csharp"] } FileTagger { patterns: ["*.vb", "*.VB"] fileTags: ["cli.vb"] } FileTagger { patterns: ["*.fs", "*.FS"] fileTags: ["cli.fsharp"] } FileTagger { patterns: ["*.fsi", "*.FSI"] fileTags: ["cli.fsharp_signature"] } FileTagger { patterns: ["*.resx", "*.RESX"] fileTags: ["cli.resx"] } validate: { var validator = new ModUtils.PropertyValidator("cli"); validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath); validator.validate(); } setupBuildEnvironment: { var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), Host.os().includes("windows")); v.prepend(product.cli.toolchainInstallPath); v.set(); } Rule { id: cliApplication multiplex: true inputs: ["cli.csharp", "cli.vb", "cli.fsharp"] inputsFromDependencies: ["cli.netmodule", "dynamiclibrary", "cli.resources"] Artifact { fileTags: ["application"] filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + product.moduleProperty(product.moduleName, "executableSuffix")) } Artifact { fileTags: ["debuginfo_app"] filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + product.moduleProperty(product.moduleName, "debugInfoSuffix")) } prepare: CLI.prepareCompiler(product, inputs, outputs.application[0]) } Rule { id: cliDynamicLibrary multiplex: true inputs: ["cli.csharp", "cli.vb", "cli.fsharp"] inputsFromDependencies: ["cli.netmodule", "dynamiclibrary", "cli.resources"] Artifact { fileTags: ["dynamiclibrary"] filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + product.moduleProperty(product.moduleName, "dynamicLibrarySuffix")) } Artifact { fileTags: ["debuginfo_dll"] filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + product.moduleProperty(product.moduleName, "debugInfoSuffix")) } prepare: CLI.prepareCompiler(product, inputs, outputs.dynamiclibrary[0]) } Rule { id: netmodule multiplex: true inputs: ["cli.csharp", "cli.vb", "cli.fsharp"] inputsFromDependencies: ["cli.netmodule", "dynamiclibrary", "cli.resources"] Artifact { fileTags: ["cli.netmodule"] filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + product.moduleProperty(product.moduleName, "netmoduleSuffix")) } Artifact { fileTags: ["debuginfo_netmodule"] filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + product.moduleProperty(product.moduleName, "debugInfoSuffix")) } prepare: CLI.prepareCompiler(product, inputs, outputs["cli.netmodule"][0]) } Rule { inputs: ["cli.resx"] Artifact { fileTags: ["cli.resources"] filePath: FileInfo.joinPaths(product.destinationDirectory, input.completeBaseName + ".resources") } prepare: { var args = [ input.filePath, output.filePath ]; var cmd = new Command(ModUtils.moduleProperty(product, "resgenPath"), args); cmd.description = "building " + input.fileName; cmd.highlight = "compiler"; cmd.workingDirectory = FileInfo.path(output.filePath); return cmd; } } } qbs-src-3.2.0/share/qbs/modules/cli/windows-dotnet.qbs0000644000175100017510000000200715154533055022303 0ustar runnerrunnerimport qbs.Utilities CLIModule { condition: qbs.toolchain && qbs.toolchain.includes("dotnet") debugInfoSuffix: ".pdb" csharpCompilerName: "csc" vbCompilerName: "vbc" fsharpCompilerName: "fsc" Probe { id: dotnetProbe property string toolchainInstallPath // Output configure: { // https://msdn.microsoft.com/en-us/library/hh925568.aspx var keys = [ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\NET Framework Setup\\NDP" ]; for (var i in keys) { var key = keys[i] + "\\v4\\Full"; var value = Utilities.getNativeSetting(key, "InstallPath"); if (value) { toolchainInstallPath = value; found = true; break; } } } } toolchainInstallPath: dotnetProbe.toolchainInstallPath } qbs-src-3.2.0/share/qbs/modules/cli/mono.qbs0000644000175100017510000000123115154533055020264 0ustar runnerrunnerimport qbs.File import qbs.Host import qbs.Probes CLIModule { condition: qbs.toolchain && qbs.toolchain.includes("mono") debugInfoSuffix: ".mdb" csharpCompilerName: "mcs" vbCompilerName: "vbnc" fsharpCompilerName: "fsharpc" Probes.PathProbe { id: monoProbe names: ["mono"] platformSearchPaths: { var paths = []; if (Host.os().includes("macos")) paths.push("/Library/Frameworks/Mono.framework/Commands"); if (Host.os().includes("unix")) paths.push("/usr/bin"); return paths; } } toolchainInstallPath: monoProbe.path } qbs-src-3.2.0/share/qbs/modules/archiver/0000755000175100017510000000000015154533055017644 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/archiver/archiver.qbs0000644000175100017510000002307115154533055022161 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Environment import qbs.File import qbs.Host import qbs.FileInfo import qbs.Probes Module { // jar is a suitable fallback for creating zip files as they are the same format // This will most likely end up being used on Windows Depends { name: "java"; required: false } Probes.BinaryProbe { id: tarProbe names: ["tar"] } Probes.BinaryProbe { id: zipProbe names: ["zip"] } Probes.BinaryProbe { id: sevenZipProbe names: ["7z"] platformSearchPaths: { var paths = base; if (Host.os().includes("windows")) { var env32 = Environment.getEnv("PROGRAMFILES(X86)"); var env64 = Environment.getEnv("PROGRAMFILES"); if (env64 === env32 && env64.endsWith(" (x86)")) env64 = env64.slice(0, -(" (x86)".length)); // QTBUG-3845 paths.push(FileInfo.joinPaths(env64, "7-Zip")); paths.push(FileInfo.joinPaths(env32, "7-Zip")); } return paths; } } property string type property string archiveBaseName: product.targetName property string workingDirectory property stringList flags: [] property path outputDirectory: product.destinationDirectory property string archiveExtension: { if (type === "7zip") return "7z"; if (type == "tar") { var extension = "tar"; if (compressionType !== "none") extension += "." + compressionType; return extension; } if (type === "zip") return "zip"; return undefined; } property string command: { if (type === "7zip") return sevenZipProbe.filePath; if (type === "tar") { if (tarProbe.found) return tarProbe.filePath; if (sevenZipProbe.found) return sevenZipProbe.filePath; } if (type === "zip") { // Prefer zip (probably Info-Zip) and fall back to 7z or jar when it's not available // (as is the likely case on Windows) if (zipProbe.found) return zipProbe.filePath; if (sevenZipProbe.found) return sevenZipProbe.filePath; if (java.present) return java.jarFilePath; } return undefined; } property string compressionLevel property string compressionType: { if (type === "tar") return "gz"; return undefined; } PropertyOptions { name: "type" description: "The type of archive to create." allowedValues: ["7zip", "tar", "zip"] } PropertyOptions { name: "compressionLevel" description: "How much effort to put into compression.\n" + "Higher numbers mean smaller archive files at the cost of taking more time.\n" + "This property is only used for the '7zip' and 'zip' types.\n" + "'7zip' only supports 0 and odd numbers." allowedValues: [undefined, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] } PropertyOptions { name: "compressionType" description: "The compression format to use.\n" + "For tar archives, the respective tool needs to be present.\n" + "This property is only used for the 'tar' and 'zip' types." allowedValues: ["none", "gz", "bz2", "Z", "xz", "deflate", "store"] } Rule { inputs: ["archiver.input-list"] Artifact { filePath: FileInfo.joinPaths(product.moduleProperty("archiver", "outputDirectory"), product.moduleProperty("archiver", "archiveBaseName") + '.' + product.moduleProperty("archiver", "archiveExtension")); fileTags: ["archiver.archive"] } prepare: { var binary = product.moduleProperty("archiver", "command"); var binaryName = FileInfo.baseName(binary); var args = []; var commands = []; var type = product.moduleProperty("archiver", "type"); var compression = product.moduleProperty("archiver", "compressionType"); var compressionLevel = product.moduleProperty("archiver", "compressionLevel"); if (binaryName === "7z") { var rmCommand = new JavaScriptCommand(); rmCommand.silent = true; rmCommand.sourceCode = function() { if (File.exists(output.filePath)) File.remove(output.filePath); }; commands.push(rmCommand); args.push("a", "-y", "-mmt=on"); switch (type) { case "7zip": args.push("-t7z"); break; case "zip": args.push("-tzip"); break; case "tar": if (compression === "gz") args.push("-tgzip"); else if (compression === "bz2") args.push("-tbzip2"); else args.push("-ttar"); break; default: throw "7zip: unrecognized archive type: '" + type + "'"; } if (compressionLevel) args.push("-mx" + compressionLevel); args = args.concat(product.moduleProperty("archiver", "flags")); args.push(output.filePath); args.push("@" + input.filePath); } else if (binaryName === "tar" && type === "tar") { args.push("-c"); if (compression === "gz") args.push("-z"); else if (compression === "bz2") args.push("-j"); else if (compression === "Z") args.push("-Z"); else if (compression === "xz") args.push("-J"); args.push("-f", output.filePath, "-T", input.filePath); args = args.concat(product.moduleProperty("archiver", "flags")); } else if (binaryName === "jar" && type === "zip") { if (compression === "none" || compressionLevel === "0") args.push("-0"); args.push("-cfM", output.filePath, "@" + input.filePath); args = args.concat(product.moduleProperty("archiver", "flags")); } else if (binaryName === "zip" && type === "zip") { // The "zip" program included with most Linux and Unix distributions // (including macOS) is Info-ZIP's Zip, so this should be fairly portable. if (compression === "none") { args.push("-0"); } else { compression = compression === "bz2" ? "bzip2" : compression; if (["store", "deflate", "bzip2"].includes(compression)) args.push("-Z", compression); if (compressionLevel) args.push("-" + compressionLevel); } args.push("-r", output.filePath, ".", "-i@" + input.filePath); args = args.concat(product.moduleProperty("archiver", "flags")); } else if (["tar", "zip", "jar"].includes(binaryName)) { throw binaryName + ": unrecognized archive type: '" + type + "'"; } else if (binaryName) { throw "unrecognized archive tool: '" + binaryName + "'"; } else { throw "no archive tool available to produce archive type: '" + type + "'"; } var archiverCommand = new Command(binary, args); archiverCommand.description = "creating archive file " + output.fileName; archiverCommand.highlight = "linker"; archiverCommand.workingDirectory = product.moduleProperty("archiver", "workingDirectory"); commands.push(archiverCommand); return commands; } } } qbs-src-3.2.0/share/qbs/modules/qbs/0000755000175100017510000000000015154533055016626 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/qbs/common.qbs0000644000175100017510000002435315154533055020634 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Environment import qbs.FileInfo import qbs.ModUtils import qbs.PathTools import qbs.Utilities Module { readonly property string configurationName: "default" property string defaultBuildVariant: { switch (configurationName.toLowerCase()) { case "release": return "release"; default: return "debug"; } } property string buildVariant: defaultBuildVariant property bool enableDebugCode: buildVariant == "debug" property bool debugInformation: (buildVariant !== "release") property string optimization: (buildVariant === "debug" ? "none" : "fast") readonly property string hostPlatform: undefined // set internally readonly property stringList hostOS: Utilities.canonicalPlatform(hostPlatform) property string hostOSVersion: { if (hostOS && hostOS.includes("macos")) { return Utilities.getNativeSetting("/System/Library/CoreServices/ServerVersion.plist", "ProductVersion") || Utilities.getNativeSetting("/System/Library/CoreServices/SystemVersion.plist", "ProductVersion"); } else if (hostOS && hostOS.includes("windows")) { var version = Utilities.getNativeSetting(windowsRegistryKey, "CurrentVersion"); return version + "." + hostOSBuildVersion; } } readonly property string hostArchitecture: undefined // set internally property string hostOSBuildVersion: { if (hostOS.includes("macos")) { return Utilities.getNativeSetting("/System/Library/CoreServices/ServerVersion.plist", "ProductBuildVersion") || Utilities.getNativeSetting("/System/Library/CoreServices/SystemVersion.plist", "ProductBuildVersion"); } else if (hostOS.includes("windows")) { return Utilities.getNativeSetting(windowsRegistryKey, "CurrentBuildNumber"); } } readonly property var hostOSVersionParts: hostOSVersion ? hostOSVersion.split('.').map(function(item) { return parseInt(item, 10); }) : [] readonly property int hostOSVersionMajor: hostOSVersionParts[0] || 0 readonly property int hostOSVersionMinor: hostOSVersionParts[1] || 0 readonly property int hostOSVersionPatch: hostOSVersionParts[2] || 0 property string targetPlatform: hostPlatform readonly property stringList targetOS: Utilities.canonicalPlatform(targetPlatform) property string pathListSeparator: hostOS.includes("windows") ? ";" : ":" property string pathSeparator: hostOS.includes("windows") ? "\\" : "/" property string nullDevice: hostOS.includes("windows") ? "NUL" : "/dev/null" property path shellPath: hostOS.includes("windows") ? windowsShellPath : "/bin/sh" property string profile: project.profile property string toolchainType: { if (targetOS.includes("windows")) return hostOS.includes("windows") ? "msvc" : "mingw"; if (targetOS.includes("darwin")) return hostOS.includes("macos") ? "xcode" : "clang"; if (targetOS.includes("freebsd")) return "clang"; if (targetOS.includes("qnx")) return "qcc"; if (targetOS.containsAny(["haiku", "vxworks", "unix"])) return "gcc"; } readonly property stringList toolchain: Utilities.canonicalToolchain(toolchainType) property string architecture property bool install: false property path installSourceBase property string installRoot: project.buildDirectory + "/install-root" property string installDir property string installPrefix: targetOS.includes("unix") ? "/usr/local" : "" property path sysroot PropertyOptions { name: "buildVariant" allowedValues: ['debug', 'release', 'profiling'] description: "name of the build variant" } PropertyOptions { name: "optimization" allowedValues: ['none', 'fast', 'small'] description: "optimization level" } validate: { var validator = new ModUtils.PropertyValidator("qbs"); validator.setRequiredProperty("hostOS", hostOS); validator.setRequiredProperty("targetOS", targetOS); validator.addCustomValidator("targetOS", targetOS, function (value) { if (!value || (value.includes("osx") && !value.includes("macos"))) return false; return true; }, "the value 'osx' has been replaced by 'macos'; use that instead and update " + "hostOS and targetOS condition checks in your project accordingly"); if (hostOS && (hostOS.includes("windows") || hostOS.includes("macos"))) { validator.setRequiredProperty("hostOSVersion", hostOSVersion, "could not detect host operating system version; " + "verify that system files and registry keys have not " + "been modified."); if (hostOSVersion) validator.addVersionValidator("hostOSVersion", hostOSVersion, 2, 4); validator.setRequiredProperty("hostOSBuildVersion", hostOSBuildVersion, "could not detect host operating system build version; " + "verify that system files or registry have not been " + "tampered with."); } validator.addCustomValidator("architecture", architecture, function (value) { return !architecture || architecture === Utilities.canonicalArchitecture(architecture); }, "'" + architecture + "' is invalid." + (architecture ? " You must use the canonical name '" + Utilities.canonicalArchitecture(architecture) : "") + "'"); validator.addCustomValidator("toolchain", toolchain, function (value) { if (toolchain === undefined) return false; // cannot have null toolchain, empty is valid... for now var canonical = Utilities.canonicalToolchain.apply(Utilities, toolchain); for (var i = 0; i < Math.max(canonical.length, toolchain.length); ++i) { if (canonical[i] !== toolchain[i]) return false; } return true; }, "'" + toolchain + "' is invalid. You must use the canonical list '" + Utilities.canonicalToolchain.apply(Utilities, toolchain) + "'"); validator.addCustomValidator("toolchain", toolchain, function (value) { // None of the pairs listed here may appear in the same toolchain list. // Note that this check is applied AFTER canonicalization, so for example // {"clang", "msvc"} need not be checked, since a toolchain containing clang is // guaranteed to also contain gcc. var pairs = [ ["gcc", "msvc"], ["llvm", "mingw"] ]; var canonical = Utilities.canonicalToolchain.apply(Utilities, value); for (var i = 0; i < pairs.length; ++i) { if (canonical.includes(pairs[i][0]) && canonical.includes(pairs[i][1])) return false; } return true; }, "'" + toolchain + "' contains one or more mutually exclusive toolchain types."); validator.validate(); } // private properties property string windowsRegistryKey: "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion" property path windowsSystemRoot: FileInfo.fromWindowsSeparators(Utilities.getNativeSetting(windowsRegistryKey, "SystemRoot")) property path windowsShellPath: FileInfo.fromWindowsSeparators(Environment.getEnv("COMSPEC")) || FileInfo.joinPaths(windowsSystemRoot, "System32", "cmd.exe") property string windowsPathVariable: hostOS.includes("windows") ? "PATH" : "WINEPATH" property var commonRunEnvironment: ({}) setupRunEnvironment: { var env = product.qbs.commonRunEnvironment; for (var i in env) { var v = new ModUtils.EnvironmentVariable(i, product.qbs.pathListSeparator, product.qbs.hostOS.includes("windows")); v.value = env[i]; v.set(); } } // Properties that can be set for multiplexing products. property stringList profiles: [] property stringList architectures: [] property stringList buildVariants: [] // internal properties readonly property string version: [versionMajor, versionMinor, versionPatch].join(".") readonly property int versionMajor: undefined // set internally readonly property int versionMinor: undefined // set internally readonly property int versionPatch: undefined // set internally readonly property var multiplexMap: ({ profiles: "profile", architectures: "architecture", buildVariants: "buildVariant" }) } qbs-src-3.2.0/share/qbs/modules/lex_yacc/0000755000175100017510000000000015154533055017630 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/lex_yacc/lexyacc.js0000644000175100017510000001173015154533055021620 0ustar runnerrunnervar FileInfo = require("qbs.FileInfo"); var TextFile = require("qbs.TextFile"); function unquote(s) { return s.startsWith('"') && s.endsWith('"') ? s.substr(1, s.length - 2) : s; } function readLexOptions(filePath) { var result = {}; var f = new TextFile(filePath, TextFile.ReadOnly); var regex = /^%option\s+([^ \t=]+)(?:\s*=\s*(\S+))?/; while (!f.atEof()) { var line = f.readLine(); var m = regex.exec(line); if (!m) { if (line === "%%") break; continue; } result[m[1]] = m[2] || true; } f.close(); return result; } function lexOutputFilePath(input, posixFileName, options) { var outDir = input.lex_yacc.outputDir; var fileName; if (options.outfile) { fileName = unquote(options.outfile); } else if (options.prefix) { fileName = FileInfo.baseName(posixFileName) + '.' + unquote(options.prefix) + '.' + FileInfo.suffix(posixFileName); } else if (input.lex_yacc.uniqueSymbolPrefix) { fileName = input.baseName; fileName += posixFileName; } else { fileName = posixFileName; } return FileInfo.joinPaths(outDir, fileName); } function readYaccOptions(filePath) { var result = {}; var f = new TextFile(filePath, TextFile.ReadOnly); var regex = /^%output\s+(.+)/; while (!f.atEof()) { var line = f.readLine(); var m = regex.exec(line); if (!m) { if (line === "%%") break; continue; } result.output = m[1]; break; } f.close(); return result; } function yaccOutputFilePath(input, posixFileName, options) { var outDir = input.lex_yacc.outputDir; var fileName; if (options.output) { var outputFileName = unquote(options.output); var suffix = FileInfo.suffix(posixFileName); if (suffix === "c") { fileName = outputFileName; } else { fileName = FileInfo.completeBaseName(outputFileName) + '.' + suffix + FileInfo.suffix(outputFileName).slice(1); } } else if (input.lex_yacc.uniqueSymbolPrefix) { fileName = input.baseName + posixFileName.slice(1); } else { fileName = posixFileName; } return FileInfo.joinPaths(outDir, fileName); } function yaccOutputArtifacts(product, input) { var src = { fileTags: [product.lex_yacc.outputTag], lex_yacc: {}, }; var options = readYaccOptions(input.filePath); if (!options.output && input.lex_yacc.yaccOutputFilePath) { options.output = input.lex_yacc.yaccOutputFilePath; src.lex_yacc.useOutputFromModule = true; } var hdr = { filePath: yaccOutputFilePath(input, "y.tab.h", options), fileTags: ["hpp"], }; src.filePath = yaccOutputFilePath(input, "y.tab.c", options); src.cpp = { includePaths: [].concat(input.cpp.includePaths, input.lex_yacc.outputDir), warningLevel: input.lex_yacc.enableCompilerWarnings ? "all" : "none", }; return [hdr, src]; } function yaccCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var args = input.lex_yacc.yaccFlags; args.push("-d"); var impl = outputs[input.lex_yacc.outputTag][0]; if (impl.lex_yacc.useOutputFromModule) args.push("-o" + input.lex_yacc.yaccOutputFilePath); else if (input.lex_yacc.uniqueSymbolPrefix) args.push("-b", input.baseName, "-p", input.baseName); args.push(input.filePath); var cmd = new Command(input.lex_yacc.yaccBinary, args); cmd.workingDirectory = input.lex_yacc.outputDir; cmd.description = "generating " + impl.fileName + " and " + outputs["hpp"][0].fileName; return [cmd]; } function lexOutputArtifacts(product, input) { var output = { fileTags: [product.lex_yacc.outputTag], lex_yacc: {}, }; var options = readLexOptions(input.filePath); if (!options.outfile && input.lex_yacc.lexOutputFilePath) { options.outfile = input.lex_yacc.lexOutputFilePath; output.lex_yacc.useOutfileFromModule = true; } output.filePath = lexOutputFilePath(input, "lex.yy.c", options); output.cpp = { includePaths: [].concat(input.cpp.includePaths, input.lex_yacc.outputDir), warningLevel: input.lex_yacc.enableCompilerWarnings ? "all" : "none", }; return [output]; } function lexCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var args = input.lex_yacc.lexFlags; if (output.lex_yacc.useOutfileFromModule) args.push("-o" + input.lex_yacc.lexOutputFilePath); else if (input.lex_yacc.uniqueSymbolPrefix) args.push("-P" + input.baseName, "-o" + output.filePath); args.push(input.filePath); var cmd = new Command(input.lex_yacc.lexBinary, args); cmd.workingDirectory = input.lex_yacc.outputDir; cmd.description = "generating " + output.fileName; return [cmd]; } qbs-src-3.2.0/share/qbs/modules/lex_yacc/lexyacc.qbs0000644000175100017510000000226015154533055021767 0ustar runnerrunnerimport "lexyacc.js" as HelperFunctions Module { Depends { name: "cpp" } property bool enableCompilerWarnings: false property string lexBinary: "lex" property string yaccBinary: "yacc" property string outputTag: "c" property bool uniqueSymbolPrefix: false property string lexOutputFilePath property string yaccOutputFilePath property stringList lexFlags: [] property stringList yaccFlags: [] readonly property string outputDir: product.buildDirectory + "/lexyacc" Rule { inputs: ["lex.input"] outputFileTags: [product.lex_yacc.outputTag] outputArtifacts: HelperFunctions.lexOutputArtifacts(product, input) prepare: HelperFunctions.lexCommands.apply(HelperFunctions, arguments) } Rule { inputs: ["yacc.input"] outputFileTags: [product.lex_yacc.outputTag, "hpp"] outputArtifacts: HelperFunctions.yaccOutputArtifacts(product, input) prepare: HelperFunctions.yaccCommands.apply(HelperFunctions, arguments) } FileTagger { patterns: ["*.l"] fileTags: ["lex.input"]; } FileTagger { patterns: ["*.y"] fileTags: ["yacc.input"]; } } qbs-src-3.2.0/share/qbs/modules/pkgconfig/0000755000175100017510000000000015154533055020010 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/pkgconfig/pkgconfig.qbs0000644000175100017510000000507115154533055022471 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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$ ** ****************************************************************************/ import qbs.File import qbs.Probes Module { Probes.BinaryProbe { id: pkgconfigProbe names: "pkg-config" } property path sysroot: { if (qbs.targetOS.includes("macos")) return ""; return qbs.sysroot; } property string executableFilePath: pkgconfigProbe.filePath property stringList libDirs property bool staticMode: false validate: { if (!executableFilePath) { throw "No pkg-config executable found. " + "Please set modules.pkgconfig.executableFilePath."; } if (!File.exists(executableFilePath)) throw "The pkg-config executable '" + executableFilePath + "' does not exist."; } } qbs-src-3.2.0/share/qbs/modules/cpp/0000755000175100017510000000000015154533055016623 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/cpp/msvc.js0000644000175100017510000007747215154533055020152 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Codesign = require("../codesign/codesign.js"); var Cpp = require("cpp.js"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); var WindowsUtils = require("qbs.WindowsUtils"); function effectiveLinkerPath(product, inputs) { if (product.cpp.linkerMode === "automatic") { var compiler = product.cpp.compilerPath; if (compiler) { if (inputs.obj || inputs.staticlibrary) { console.log("Found C/C++ objects, using compiler as a linker for " + product.name); return compiler; } } console.log("Found no C-language objects, choosing system linker for " + product.name); } return product.cpp.linkerPath; } function handleCpuFeatures(input, flags) { if (!input.qbs.architecture) return; if (input.qbs.architecture.startsWith("x86")) { if (input.qbs.architecture === "x86") { var sse2 = input.cpufeatures.x86_sse2; if (sse2 === true) flags.push("/arch:SSE2"); if (sse2 === false) flags.push("/arch:IA32"); } if (input.cpufeatures.x86_avx === true) flags.push("/arch:AVX"); if (input.cpufeatures.x86_avx2 === true) flags.push("/arch:AVX2"); } else if (input.qbs.architecture.startsWith("arm")) { if (input.cpufeatures.arm_vfpv4 === true) flags.push("/arch:VFPv4"); if (input.cpp.machineType === "armv7ve") flags.push("/arch:ARMv7VE"); } } function hasCxx17Option(input) { // Probably this is not the earliest version to support the flag, but we have tested this one // and it's a pain to find out the exact minimum. return (input.qbs.toolchain.includes("clang-cl") && input.cpp.compilerVersionMajor >= 7) || Utilities.versionCompare(input.cpp.compilerVersion, "19.12.25831") >= 0; } function hasZCplusPlusOption(input) { // /Zc:__cplusplus is supported starting from Visual Studio 15.7 // Looks like closest MSVC version is 14.14.26428 (cl ver 19.14.26433) // At least, this version is tested // https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus // clang-cl supports this option starting around-ish versions 8/9, but it // ignores this option, so this doesn't really matter // https://reviews.llvm.org/D45877 return (input.qbs.toolchain.includes("clang-cl") && input.cpp.compilerVersionMajor >= 9) || Utilities.versionCompare(input.cpp.compilerVersion, "19.14.26433") >= 0; } function hasCxx20Option(input) { return (input.qbs.toolchain.includes("clang-cl") && input.cpp.compilerVersionMajor >= 13) || Utilities.versionCompare(input.cpp.compilerVersion, "19.29.30133.0") >= 0; } function hasCVerOption(input) { return (input.qbs.toolchain.includes("clang-cl") && input.cpp.compilerVersionMajor >= 13) || Utilities.versionCompare(input.cpp.compilerVersion, "19.29.30138.0") >= 0; } function supportsExternalIncludesOption(input) { if (input.qbs.toolchain.includes("clang-cl")) return false; // Exclude clang-cl. // This option was introcuded since MSVC 2017 v15.6 (aka _MSC_VER 19.13). // But due to some MSVC bugs: // * https://developercommunity.visualstudio.com/content/problem/181006/externali-include-paths-not-working.html // this option has been fixed since MSVC 2017 update 9, v15.9 (aka _MSC_VER 19.16). return Utilities.versionCompare(input.cpp.compilerVersion, "19.16") >= 0; } function addCxxLanguageVersionFlag(input, args) { var cxxVersion = Cpp.languageVersion(input.cpp.cxxLanguageVersion, ["c++26", "c++23", "c++20", "c++17", "c++14", "c++11", "c++98"], "C++"); if (!cxxVersion) return; // Visual C++ 2013, Update 3 or clang-cl var hasStdOption = input.qbs.toolchain.includes("clang-cl") || Utilities.versionCompare(input.cpp.compilerVersion, "18.00.30723") >= 0; if (!hasStdOption) return; var flag; if (cxxVersion === "c++14") flag = "/std:c++14"; else if (cxxVersion === "c++17" && hasCxx17Option(input)) flag = "/std:c++17"; else if (cxxVersion === "c++20" && hasCxx20Option(input)) flag = "/std:c++20"; else if (cxxVersion !== "c++11" && cxxVersion !== "c++98") flag = "/std:c++latest"; if (flag) args.push(flag); } function addCLanguageVersionFlag(input, args) { var cVersion = Cpp.languageVersion(input.cpp.cLanguageVersion, ["c17", "c11"], "C"); if (!cVersion) return; var hasStdOption = hasCVerOption(input); if (!hasStdOption) return; var flag; if (cVersion === "c17") flag = "/std:c17"; else if (cVersion === "c11") flag = "/std:c11"; if (flag) args.push(flag); } function handleClangClArchitectureFlags(product, architecture, flags) { if (product.qbs.toolchain.includes("clang-cl")) { if (architecture === "x86") flags.push("-m32"); else if (architecture === "x86_64") flags.push("-m64"); } } function prepareCompilerInternal(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var i; var debugInformation = input.cpp.debugInformation; var args = ['/nologo', '/c'] handleCpuFeatures(input, args); // Determine which C-language we're compiling var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(Object.keys(outputs))); if (!["c", "cpp", "cppm"].includes(tag)) throw ("unsupported source language"); var enableExceptions = input.cpp.enableExceptions; if (enableExceptions) { var ehModel = input.cpp.exceptionHandlingModel; switch (ehModel) { case "default": args.push("/EHsc"); // "Yes" in VS break; case "seh": args.push("/EHa"); // "Yes with SEH exceptions" in VS break; case "externc": args.push("/EHs"); // "Yes with Extern C functions" in VS break; } } var enableRtti = input.cpp.enableRtti; if (enableRtti !== undefined) { args.push(enableRtti ? "/GR" : "/GR-"); } switch (input.cpp.optimization) { case "small": args.push('/Os') break; case "fast": args.push('/O2') break; case "none": args.push("/Od"); break; } handleClangClArchitectureFlags(product, input.cpp.architecture, args); if (debugInformation) { if (product.cpp.separateDebugInformation) args.push('/Zi'); else args.push('/Z7'); } var rtl = product.cpp.runtimeLibrary; if (rtl) { rtl = (rtl === "static" ? "/MT" : "/MD"); if (product.qbs.enableDebugCode) rtl += "d"; args.push(rtl); } args = args.concat(Cpp.collectMiscDriverArguments(product)); // warnings: var warningLevel = input.cpp.warningLevel; if (warningLevel === 'none') args.push('/w') if (warningLevel === 'all') args.push('/Wall') if (input.cpp.treatWarningsAsErrors) args.push('/WX') var includePaths = Cpp.collectIncludePaths(input); args = args.concat([].uniqueConcat(includePaths).map(function(path) { return input.cpp.includeFlag + FileInfo.toWindowsSeparators(path); })); var includeFlag = input.qbs.toolchain.includes("clang-cl") ? input.cpp.systemIncludeFlag : input.cpp.includeFlag; if (!input.qbs.toolchain.includes("clang-cl")) { if (supportsExternalIncludesOption(input)) { args.push("/experimental:external"); var enforcesSlashW = Utilities.versionCompare(input.cpp.compilerVersion, "19.29.30037") >= 0 if (enforcesSlashW) args.push("/external:W0") includeFlag = input.cpp.systemIncludeFlag; } } var systemIncludePaths = Cpp.collectSystemIncludePaths(input); args = args.concat([].uniqueConcat(systemIncludePaths).map(function(path) { return includeFlag + FileInfo.toWindowsSeparators(path); })); var defines = Cpp.collectDefines(input); args = args.concat([].uniqueConcat(defines).map(function(define) { return input.cpp.defineFlag + define.replace(/%/g, "%%"); })); var minimumWindowsVersion = product.cpp.minimumWindowsVersion; if (minimumWindowsVersion) { var hexVersion = WindowsUtils.getWindowsVersionInFormat(minimumWindowsVersion, 'hex'); if (hexVersion) { var versionDefs = [ 'WINVER', '_WIN32_WINNT', '_WIN32_WINDOWS' ]; for (i in versionDefs) { args.push(input.cpp.defineFlag + versionDefs[i] + '=' + hexVersion); } } } if (product.cpp.debugInformation && product.cpp.separateDebugInformation) args.push("/Fd" + product.targetName + ".cl" + product.cpp.debugInfoSuffix); if (input.cpp.generateCompilerListingFiles) args.push("/Fa" + FileInfo.toWindowsSeparators(outputs.lst[0].filePath)); if (input.cpp.enableCxxLanguageMacro && hasZCplusPlusOption(input)) args.push("/Zc:__cplusplus"); var objectMap = outputs.obj || outputs.intermediate_obj var objOutput = objectMap ? objectMap[0] : undefined args.push('/Fo' + FileInfo.toWindowsSeparators(objOutput.filePath)) args.push(FileInfo.toWindowsSeparators(input.filePath)) var preincludePaths = Cpp.collectPreincludePaths(input); args = args.concat([].uniqueConcat(preincludePaths).map(function(path) { return input.cpp.preincludeFlag + FileInfo.toWindowsSeparators(path); })); // Language if (tag === "cpp" || tag === "cppm") { args.push("/TP"); addCxxLanguageVersionFlag(input, args); } else if (tag === "c") { args.push("/TC"); addCLanguageVersionFlag(input, args); } var moduleMap = (outputs["modulemap"] || [])[0]; if (moduleMap) { args.push("@" + moduleMap.filePath); } // Whether we're compiling a precompiled header or normal source file var pchOutput = outputs[tag + "_pch"] ? outputs[tag + "_pch"][0] : undefined; var pchInputs = explicitlyDependsOn[tag + "_pch"]; if (pchOutput) { // create PCH if (input.qbs.toolchain.includes("clang-cl")) { // clang-cl does not support /Yc flag without filename args.push("/Yc" + FileInfo.toWindowsSeparators(input.filePath)); // clang-cl complains when pch file is not included args.push("/FI" + FileInfo.toWindowsSeparators(input.filePath)); args.push("/Fp" + FileInfo.toWindowsSeparators(pchOutput.filePath)); } else { // real msvc args.push("/Yc"); args.push("/Fp" + FileInfo.toWindowsSeparators(pchOutput.filePath)); args.push(FileInfo.toWindowsSeparators(input.filePath)); } } else if (pchInputs && pchInputs.length === 1 && ModUtils.moduleProperty(input, "usePrecompiledHeader", tag)) { // use PCH var pchSourceArtifacts = product.artifacts[tag + "_pch_src"]; if (pchSourceArtifacts && pchSourceArtifacts.length > 0) { var pchSourceFilePath = pchSourceArtifacts[0].filePath; var pchFilePath = FileInfo.toWindowsSeparators(pchInputs[0].filePath); args.push("/FI" + pchSourceFilePath); args.push("/Yu" + pchSourceFilePath); args.push("/Fp" + pchFilePath); } else { console.warning("products." + product.name + ".usePrecompiledHeader is true, " + "but there is no " + tag + "_pch_src artifact."); } } args = args.concat(Cpp.collectMiscCompilerArguments(input, tag)); var compilerPath = product.cpp.compilerPath; var wrapperArgs = product.cpp.compilerWrapper; if (wrapperArgs && wrapperArgs.length > 0) { args.unshift(compilerPath); compilerPath = wrapperArgs.shift(); args = wrapperArgs.concat(args); } var cmd = new Command(compilerPath, args) cmd.description = (pchOutput ? 'pre' : '') + 'compiling ' + input.fileName; if (pchOutput) cmd.description += ' (' + tag + ')'; cmd.highlight = "compiler"; cmd.jobPool = "compiler"; cmd.workingDirectory = product.buildDirectory; cmd.responseFileUsagePrefix = '@'; // cl.exe outputs the cpp file name. We filter that out. cmd.inputFileName = input.fileName; cmd.relevantEnvironmentVariables = ["CL", "_CL_", "INCLUDE"]; cmd.stdoutFilterFunction = function(output) { return output.split(inputFileName + "\r\n").join(""); }; return [cmd]; } function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var result = Cpp.prepareModules(project, product, inputs, outputs, input, output); result = result.concat(prepareCompilerInternal( project, product, inputs, outputs, input, output, explicitlyDependsOn)); return result; } function linkerSupportsWholeArchive(product) { return product.qbs.toolchainType.includes("clang-cl") || Utilities.versionCompare(product.cpp.compilerVersion, "19.0.24215.1") >= 0 } function handleDiscardProperty(product, flags) { var discardUnusedData = product.cpp.discardUnusedData; if (discardUnusedData === true) flags.push("/OPT:REF"); else if (discardUnusedData === false) flags.push("/OPT:NOREF"); } function prepareLinker(project, product, inputs, outputs, input, output) { var i; var linkDLL = (outputs.dynamiclibrary ? true : false) var primaryOutput = (linkDLL ? outputs.dynamiclibrary[0] : outputs.application[0]) var debugInformation = product.cpp.debugInformation; var additionalManifestInputs = Array.prototype.map.call(inputs["native.pe.manifest"] || [], function (a) { return a.filePath; }); var moduleDefinitionInputs = Array.prototype.map.call(inputs["def"] || [], function (a) { return a.filePath; }); var generateManifestFiles = product.cpp.generateManifestFile; var useClangCl = product.qbs.toolchain.includes("clang-cl"); var canEmbedManifest = useClangCl || product.cpp.compilerVersionMajor >= 17 // VS 2012 var linkerPath = effectiveLinkerPath(product, inputs); var useCompilerDriver = linkerPath === product.cpp.compilerPath; // args variable is built as follows: // [linkerWrapper] linkerPath /nologo [driverFlags driverLinkerFlags] // allInputs libDeps [/link] linkerArgs var args = [] if (useCompilerDriver) { args.push('/nologo'); args = args.concat(Cpp.collectMiscDriverArguments(product), Cpp.collectMiscLinkerArguments(product)); } var allInputs = [].concat(Cpp.collectLinkerObjectPaths(inputs), Cpp.collectResourceObjectPaths(inputs)); args = args.concat([].uniqueConcat(allInputs).map(function(path) { return FileInfo.toWindowsSeparators(path); })); var linkerArgs = ['/nologo'] if (linkDLL) { linkerArgs.push('/DLL'); linkerArgs.push('/IMPLIB:' + FileInfo.toWindowsSeparators(outputs.dynamiclibrary_import[0].filePath)); } if (debugInformation) { linkerArgs.push("/DEBUG"); var debugInfo = outputs.debuginfo_app || outputs.debuginfo_dll; if (debugInfo) linkerArgs.push("/PDB:" + debugInfo[0].fileName); } else { linkerArgs.push('/INCREMENTAL:NO') } switch (product.qbs.architecture) { case "x86": linkerArgs.push("/MACHINE:X86"); break; case "x86_64": linkerArgs.push("/MACHINE:X64"); break; case "ia64": linkerArgs.push("/MACHINE:IA64"); break; case "armv7": linkerArgs.push("/MACHINE:ARM"); break; case "arm64": linkerArgs.push("/MACHINE:ARM64"); break; } if (useCompilerDriver) handleClangClArchitectureFlags(product, product.qbs.architecture, args); var requireAppContainer = product.cpp.requireAppContainer; if (requireAppContainer !== undefined) linkerArgs.push("/APPCONTAINER" + (requireAppContainer ? "" : ":NO")); var minimumWindowsVersion = product.cpp.minimumWindowsVersion; var subsystemSwitch = undefined; if (minimumWindowsVersion || product.consoleApplication !== undefined) { // Ensure that we default to console if product.consoleApplication is undefined // since that could still be the case if only minimumWindowsVersion had been defined subsystemSwitch = product.consoleApplication === false ? '/SUBSYSTEM:WINDOWS' : '/SUBSYSTEM:CONSOLE'; } var useLldLink = useCompilerDriver && product.cpp.linkerVariant === "lld" || !useCompilerDriver && product.cpp.linkerName === "lld-link.exe"; if (minimumWindowsVersion) { var subsystemVersion = WindowsUtils.getWindowsVersionInFormat(minimumWindowsVersion, 'subsystem'); if (subsystemVersion) { subsystemSwitch += ',' + subsystemVersion; // llvm linker does not support /OSVERSION if (!useLldLink) linkerArgs.push('/OSVERSION:' + subsystemVersion); } } if (subsystemSwitch) linkerArgs.push(subsystemSwitch); var linkerOutputNativeFilePath = FileInfo.toWindowsSeparators(primaryOutput.filePath); var manifestFileNames = []; if (generateManifestFiles) { if (canEmbedManifest) { linkerArgs.push("/MANIFEST:embed"); additionalManifestInputs.forEach(function (manifestFileName) { linkerArgs.push("/MANIFESTINPUT:" + manifestFileName); }); } else { linkerOutputNativeFilePath = FileInfo.toWindowsSeparators( FileInfo.path(primaryOutput.filePath) + "/intermediate." + primaryOutput.fileName); var manifestFileName = linkerOutputNativeFilePath + ".manifest"; linkerArgs.push('/MANIFEST', '/MANIFESTFILE:' + manifestFileName); manifestFileNames = [manifestFileName].concat(additionalManifestInputs); } } if (moduleDefinitionInputs.length === 1) linkerArgs.push("/DEF:" + moduleDefinitionInputs[0]); else if (moduleDefinitionInputs.length > 1) throw new Error("Only one '.def' file can be specified for linking"); var wholeArchiveSupported = linkerSupportsWholeArchive(product); var wholeArchiveRequested = false; var libDeps = Cpp.collectLibraryDependencies(product); var prevLib; for (i = 0; i < libDeps.length; ++i) { var dep = libDeps[i]; var lib = dep.filePath; if (lib === prevLib) continue; prevLib = lib; if (wholeArchiveSupported && dep.wholeArchive) { // need to pass libraries to the driver to avoid "no input files" error if no object // files are specified; thus libraries are duplicated when using "WHOLEARCHIVE" if (useCompilerDriver && allInputs.length === 0) args.push(FileInfo.toWindowsSeparators(lib)); linkerArgs.push("/WHOLEARCHIVE:" + FileInfo.toWindowsSeparators(lib)); } else { args.push(FileInfo.toWindowsSeparators(lib)); } if (dep.wholeArchive) wholeArchiveRequested = true; } if (wholeArchiveRequested && !wholeArchiveSupported) { console.warn("Product '" + product.name + "' sets cpp.linkWholeArchive on a dependency, " + "but your linker does not support the /WHOLEARCHIVE option. " + "Please upgrade to Visual Studio 2015 Update 2 or higher."); } if (product.cpp.entryPoint) linkerArgs.push("/ENTRY:" + product.cpp.entryPoint); if (outputs.application && product.cpp.generateLinkerMapFile) { if (useLldLink) linkerArgs.push("/lldmap:" + outputs.mem_map[0].filePath); else linkerArgs.push("/MAP:" + outputs.mem_map[0].filePath); } if (useCompilerDriver) args.push('/Fe' + linkerOutputNativeFilePath); else linkerArgs.push('/OUT:' + linkerOutputNativeFilePath); var libraryPaths = Cpp.collectLibraryPaths(product); linkerArgs = linkerArgs.concat([].uniqueConcat(libraryPaths).map(function(path) { return product.cpp.libraryPathFlag + FileInfo.toWindowsSeparators(path); })); handleDiscardProperty(product, linkerArgs); var linkerFlags = product.cpp.platformLinkerFlags.concat(product.cpp.linkerFlags); linkerArgs = linkerArgs.concat(linkerFlags); if (product.cpp.allowUnresolvedSymbols) linkerArgs.push("/FORCE:UNRESOLVED"); var wrapperArgs = product.cpp.linkerWrapper; if (wrapperArgs && wrapperArgs.length > 0) { args.unshift(linkerPath); linkerPath = wrapperArgs.shift(); args = wrapperArgs.concat(args); } var commands = []; var warningCmd = new JavaScriptCommand(); warningCmd.silent = true; warningCmd.libDeps = libDeps; warningCmd.sourceCode = function() { for (var i = 0; i < libDeps.length; ++i) { if (!libDeps[i].productName || File.exists(libDeps[i].filePath)) continue; console.warn("Import library '" + FileInfo.toNativeSeparators(libDeps[i].filePath) + "' does not exist. This typically happens when a DLL does not " + "export any symbols. Please make sure the '" + libDeps[i].productName + "' library exports symbols, or, if you do not intend to actually " + "link against it, specify \"cpp.link: false\" in the Depends item."); } }; commands.push(warningCmd); if (linkerArgs.length !== 0) args = args.concat(useCompilerDriver ? ['/link'] : []).concat(linkerArgs); var cmd = new Command(linkerPath, args) cmd.description = 'linking ' + primaryOutput.fileName; cmd.highlight = 'linker'; cmd.jobPool = "linker"; cmd.relevantEnvironmentVariables = ["LINK", "_LINK_", "LIB", "TMP"]; cmd.workingDirectory = FileInfo.path(primaryOutput.filePath) cmd.responseFileUsagePrefix = '@'; cmd.responseFileSeparator = useCompilerDriver ? ' ' : '\n'; cmd.stdoutFilterFunction = function(output) { res = output.replace(/^.*performing full link.*\s*/, ""); res = res.replace(/^ *Creating library.*\s*/, ""); res = res.replace(/^\s*Generating code\s*/, ""); res = res.replace(/^\s*Finished generating code\s*/, ""); return res; }; commands.push(cmd); if (generateManifestFiles && !canEmbedManifest) { var outputNativeFilePath = FileInfo.toWindowsSeparators(primaryOutput.filePath); cmd = new JavaScriptCommand(); cmd.src = linkerOutputNativeFilePath; cmd.dst = outputNativeFilePath; cmd.sourceCode = function() { File.copy(src, dst); } cmd.silent = true commands.push(cmd); args = ['/nologo', '/manifest'].concat(manifestFileNames); args.push("/outputresource:" + outputNativeFilePath + ";#" + (linkDLL ? "2" : "1")); cmd = new Command("mt.exe", args) cmd.description = 'embedding manifest into ' + primaryOutput.fileName; cmd.highlight = 'linker'; cmd.workingDirectory = FileInfo.path(primaryOutput.filePath) commands.push(cmd); } if (product.cpp.shouldSignArtifacts) { Array.prototype.push.apply( commands, Codesign.prepareSigntool( project, product, inputs, outputs, input, output)); } return commands; } function createRcCommand(binary, input, output, logo) { var platformDefines = input.cpp.platformDefines; var defines = input.cpp.defines; var includePaths = input.cpp.includePaths; var systemIncludePaths = input.cpp.systemIncludePaths; var args = []; if (logo === "can-suppress-logo") args.push("/nologo"); for (i in platformDefines) { args.push("/d"); args.push(platformDefines[i]); } for (i in defines) { args.push("/d"); args.push(defines[i]); } for (i in includePaths) { args.push("/I"); args.push(includePaths[i]); } for (i in systemIncludePaths) { args.push("/I"); args.push(systemIncludePaths[i]); } args = args.concat(["/FO", output.filePath, input.filePath]); var cmd = new Command(binary, args); cmd.description = 'compiling ' + input.fileName; cmd.highlight = 'compiler'; cmd.jobPool = "compiler"; if (logo === "always-shows-logo") { // Remove the first two lines of stdout. That's the logo. cmd.stdoutFilterFunction = function(output) { var idx = 0; for (var i = 0; i < 3; ++i) idx = output.indexOf('\n', idx + 1); return output.substr(idx + 1); } } return cmd; } function assemblerCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var args = ["/nologo", "/c", "/Fo" + FileInfo.toWindowsSeparators(output.filePath)]; if (product.cpp.debugInformation) args.push("/Zi"); args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm")); args.push(FileInfo.toWindowsSeparators(input.filePath)); var cmd = new Command(product.cpp.assemblerPath, args); cmd.description = "assembling " + input.fileName; cmd.jobPool = "assembler"; cmd.inputFileName = input.fileName; cmd.stdoutFilterFunction = function(output) { var lines = output.split("\r\n").filter(function (s) { return !s.endsWith(inputFileName); }); return lines.join("\r\n"); }; return cmd; } function libtoolOutputArtifacts(product) { var artifacts = [ { fileTags: ["staticlibrary"], filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.staticLibraryFilePath(product)) } ]; if (product.cpp.debugInformation && product.cpp.separateDebugInformation) { artifacts.push({ fileTags: ["debuginfo_cl"], filePath: product.targetName + ".cl" + product.cpp.debugInfoSuffix }); } return artifacts; } function libtoolCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var args = ['/nologo'] var lib = outputs["staticlibrary"][0]; var nativeOutputFileName = FileInfo.toWindowsSeparators(lib.filePath) args.push('/OUT:' + nativeOutputFileName) Array.prototype.push.apply(args, product.cpp.archiverFlags); for (var i in inputs.obj) { var fileName = FileInfo.toWindowsSeparators(inputs.obj[i].filePath) args.push(fileName) } for (var i in inputs.res) { var fileName = FileInfo.toWindowsSeparators(inputs.res[i].filePath) args.push(fileName) } var cmd = new Command(product.cpp.archiverPath, args); cmd.description = 'creating ' + lib.fileName; cmd.highlight = 'linker'; cmd.jobPool = "linker"; cmd.workingDirectory = FileInfo.path(lib.filePath) cmd.responseFileUsagePrefix = '@'; return cmd; } function dllLinkerOutputArtifacts(product) { var artifacts = [ { fileTags: ["dynamiclibrary"].concat( product.cpp.shouldSignArtifacts ? ["codesign.signed_artifact"] : []), filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.dynamicLibraryFilePath(product)) }, { fileTags: ["dynamiclibrary_import"], filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.importLibraryFilePath(product)), alwaysUpdated: false } ]; if (product.cpp.debugInformation && product.cpp.separateDebugInformation) { var lib = artifacts[0]; artifacts.push({ fileTags: ["debuginfo_dll"], filePath: lib.filePath.substr(0, lib.filePath.length - 4) + product.cpp.debugInfoSuffix }); } return artifacts; } function appLinkerOutputArtifacts(product) { var app = { fileTags: ["application"].concat( product.cpp.shouldSignArtifacts ? ["codesign.signed_artifact"] : []), filePath: FileInfo.joinPaths( product.destinationDirectory, PathTools.applicationFilePath(product)) }; var artifacts = [app]; if (product.cpp.debugInformation && product.cpp.separateDebugInformation) { artifacts.push({ fileTags: ["debuginfo_app"], filePath: app.filePath.substr(0, app.filePath.length - 4) + product.cpp.debugInfoSuffix }); } if (product.cpp.generateLinkerMapFile) { artifacts.push({ fileTags: ["mem_map"], filePath: FileInfo.joinPaths( product.destinationDirectory, product.targetName + product.cpp.linkerMapSuffix) }); } return artifacts; } function configureStdModules() { try { const modulesJsonPath = FileInfo.joinPaths(_modulesDirPath, "modules.json"); if (File.exists(modulesJsonPath)) { const jsonFile = new TextFile(modulesJsonPath, TextFile.ReadOnly); const json = JSON.parse(jsonFile.readAll()); jsonFile.close(); const moduleSources = json["module-sources"]; if (moduleSources) { const modules = moduleSources .filter(function(module) { if (module === "std.ixx" && (_forceUseImportStd || _forceUseImportStdCompat)) { return true; } else if (module === "std.compat.ixx" && _forceUseImportStdCompat) { return true; } return false; }) .map(function(module) { return FileInfo.joinPaths(_modulesDirPath, module); }) .filter(function(module) { return File.exists(module); }); if (modules.length > 0) { found = true; _stdModulesFiles = modules; } } } } catch (e) { console.error("Error reading modules.json: " + e); } } qbs-src-3.2.0/share/qbs/modules/cpp/windows-clang-mingw.qbs0000644000175100017510000000742515154533055023235 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.Utilities import "msvc.js" as MSVC import "setuprunenv.js" as SetupRunEnv MingwBaseModule { condition: qbs.targetOS.includes("windows") && qbs.toolchain && qbs.toolchain.includes("clang") priority: 0 // llvm-as and llvm-objopy are not shipped with the official binaries on Windows at the // moment (8.0). We fall back to using the mingw versions in that case. assemblerName: "llvm-as" + compilerExtension assemblerPath: { if (File.exists(base)) return base; if (qbs.sysroot) return FileInfo.joinPaths(qbs.sysroot, "bin", "as" + compilerExtension); } objcopyName: "llvm-objcopy" + compilerExtension objcopyPath: { if (File.exists(base)) return base; if (qbs.sysroot) return FileInfo.joinPaths(qbs.sysroot, "bin", "objcopy" + compilerExtension); } archiverName: "llvm-ar" + compilerExtension linkerVariant: "lld" targetVendor: "pc" targetSystem: "windows" targetAbi: "gnu" property string rcFilePath: FileInfo.joinPaths(toolchainInstallPath, "llvm-rc" + compilerExtension) setupBuildEnvironment: { if (Host.os().includes("windows") && product.qbs.sysroot) { var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), true); v.prepend(FileInfo.joinPaths(product.qbs.sysroot, "bin")); v.set(); } } setupRunEnvironment: { if (Host.os().includes("windows") && product.qbs.sysroot) { var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), true); v.prepend(FileInfo.joinPaths(product.qbs.sysroot, "bin")); v.set(); SetupRunEnv.setupRunEnvironment(product, config); } } Rule { inputs: ["rc"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] Artifact { filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir), input.completeBaseName + ".res") fileTags: ["obj"] } prepare: MSVC.createRcCommand(product.cpp.rcFilePath, input, output) } } qbs-src-3.2.0/share/qbs/modules/cpp/windows-clang-cl.qbs0000644000175100017510000000745415154533055022514 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Host import qbs.ModUtils import qbs.Probes import qbs.FileInfo import 'windows-msvc-base.qbs' as MsvcBaseModule MsvcBaseModule { condition: Host.os().includes('windows') && qbs.targetOS.includes('windows') && qbs.toolchain && qbs.toolchain.includes('clang-cl') priority: 100 Probes.ClangClBinaryProbe { id: clangPathProbe condition: !toolchainInstallPath && !_skipAllChecks names: ["clang-cl"] } Probes.ClangClProbe { id: clangClProbe condition: !_skipAllChecks compilerFilePath: compilerPath vcvarsallFilePath: vcvarsallPath enableDefinesByLanguage: enableCompilerDefinesByLanguage preferredArchitecture: qbs.architecture winSdkVersion: windowsSdkVersion } Properties { condition: clangClProbe.found qbs.architecture: clangClProbe.architecture } compilerVersionMajor: clangClProbe.versionMajor compilerVersionMinor: clangClProbe.versionMinor compilerVersionPatch: clangClProbe.versionPatch compilerIncludePaths: clangClProbe.includePaths compilerDefinesByLanguage: clangClProbe.compilerDefinesByLanguage toolchainInstallPath: clangPathProbe.found ? clangPathProbe.path : undefined buildEnv: clangClProbe.buildEnv property string linkerVariant PropertyOptions { name: "linkerVariant" allowedValues: ["lld", "link"] description: "Allows to specify the linker variant. Maps to clang-cl's -fuse-ld option." } Properties { condition: linkerVariant driverLinkerFlags: "-fuse-ld=" + linkerVariant } property string vcvarsallPath : clangPathProbe.found ? clangPathProbe.vcvarsallPath : undefined archiverName: "llvm-lib.exe" compilerName: "clang-cl.exe" linkerName: "lld-link.exe" linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) systemIncludeFlag: "/imsvc" validateFunc: { var baseFunc = base; return function() { if (_skipAllChecks) return; var validator = new ModUtils.PropertyValidator("cpp"); validator.setRequiredProperty("vcvarsallPath", vcvarsallPath); validator.validate(); baseFunc(); } } } qbs-src-3.2.0/share/qbs/modules/cpp/GenericGCC.qbs0000644000175100017510000006756015154533055021241 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.PathTools import qbs.Probes import qbs.Process import qbs.TextFile import qbs.Utilities import qbs.UnixUtils import qbs.WindowsUtils import 'cpp.js' as Cpp import 'gcc.js' as Gcc CppModule { condition: qbs.toolchain && qbs.toolchain.includes("gcc") priority: -100 Depends { name: "codesign" } Probes.GccBinaryProbe { id: compilerPathProbe condition: !toolchainInstallPath && !_skipAllChecks _compilerName: compilerName _toolchainPrefix: toolchainPrefix } // Find the version as early as possible in case other things depend on it, // for example the question of whether certain flags are supported and which need to be used // in the GccProbe itself. Probes.GccVersionProbe { id: gccVersionProbe compilerFilePath: compilerPath environment: probeEnv } Probes.GccProbe { id: gccProbe condition: !_skipAllChecks compilerFilePathByLanguage: compilerPathByLanguage enableDefinesByLanguage: enableCompilerDefinesByLanguage environment: probeEnv flags: targetDriverFlags.concat(sysrootFlags) _sysroot: sysroot } stdModulesFiles: stdModulesProbe.found ? stdModulesProbe._stdModulesFiles : undefined Probe { // input property bool _forceUseImportStd : forceUseImportStd property bool _forceUseImportStdCompat : forceUseImportStdCompat property stringList _toolchain: qbs.toolchain property string _compilerPath : compilerPathByLanguage["cpp"] // output property stringList _stdModulesFiles id: stdModulesProbe condition: !_skipAllChecks && stdModulesFiles === undefined && !qbs.toolchain.includes("mingw") && (forceUseImportStd || forceUseImportStdCompat) configure: Gcc.configureStdModules() } property var probeEnv Probes.BinaryProbe { id: binutilsProbe condition: !File.exists(archiverPath) && !_skipAllChecks names: Gcc.toolNames([archiverName, assemblerName, linkerName, nmName, objcopyName, stripName], toolchainPrefix) } targetLinkerFlags: Gcc.targetFlags("linker", false, target, targetArch, machineType, qbs.targetOS) targetAssemblerFlags: Gcc.targetFlags("assembler", assemblerHasTargetOption, target, targetArch, machineType, qbs.targetOS) targetDriverFlags: Gcc.targetFlags("compiler", compilerHasTargetOption, target, targetArch, machineType, qbs.targetOS) Probe { id: nmProbe condition: !_skipAllChecks property string theNmPath: nmPath property bool hasDynamicOption configure: { var proc = new Process(); try { hasDynamicOption = proc.exec(theNmPath, ["-D", theNmPath], false) == 0; console.debug("nm has -D: " + hasDynamicOption); } finally { proc.close(); } } } Properties { condition: gccProbe.found qbs.architecture: gccProbe.architecture } endianness: gccProbe.endianness compilerDefinesByLanguage: gccProbe.compilerDefinesByLanguage compilerVersionMajor: gccVersionProbe.versionMajor compilerVersionMinor: gccVersionProbe.versionMinor compilerVersionPatch: gccVersionProbe.versionPatch compilerIncludePaths: gccProbe.includePaths compilerFrameworkPaths: gccProbe.frameworkPaths compilerLibraryPaths: gccProbe.libraryPaths staticLibraryPrefix: "lib" staticLibrarySuffix: ".a" precompiledHeaderSuffix: ".gch" property bool compilerHasTargetOption: qbs.toolchain.includes("clang") && Utilities.versionCompare(compilerVersion, "3.1") >= 0 property bool assemblerHasTargetOption: qbs.toolchain.includes("xcode") && Utilities.versionCompare(compilerVersion, "7") >= 0 property string target: targetArch ? [targetArch, targetVendor, targetSystem, targetAbi].join("-") : undefined property string targetArch: Utilities.canonicalTargetArchitecture( qbs.architecture, endianness, targetVendor, targetSystem, targetAbi) property string targetVendor: "unknown" property string targetSystem: "unknown" property string targetAbi: "unknown" property string toolchainPrefix: compilerPathProbe.found ? compilerPathProbe.tcPrefix : undefined toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined property string binutilsPath: binutilsProbe.found ? binutilsProbe.path : toolchainInstallPath assemblerName: 'as' + compilerExtension compilerName: cxxCompilerName linkerName: 'ld' + compilerExtension archiverName: 'ar' + compilerExtension property string nmName: 'nm' + compilerExtension property string objcopyName: "objcopy" + compilerExtension property string stripName: "strip" + compilerExtension property string dsymutilName: "dsymutil" + compilerExtension property string lipoName property string sysroot: qbs.sysroot property string syslibroot: sysroot property stringList sysrootFlags: sysroot ? ["--sysroot=" + sysroot] : [] property string exportedSymbolsCheckMode: "ignore-undefined" PropertyOptions { name: "exportedSymbolsCheckMode" allowedValues: ["strict", "ignore-undefined"] description: "Controls when we consider an updated dynamic library as changed with " + "regards to other binaries depending on it. The default is \"ignore-undefined\", " + "which means we do not care about undefined symbols being added or removed. " + "If you do care about that, e.g. because you link dependent products with an option " + "such as \"--no-undefined\", then you should set this property to \"strict\"." } property string linkerVariant PropertyOptions { name: "linkerVariant" allowedValues: ["bfd", "gold", "lld", "mold"] description: "Allows to specify the linker variant. Maps to gcc's and clang's -fuse-ld " + "option." } Properties { condition: linkerVariant driverLinkerFlags: "-fuse-ld=" + linkerVariant } property string toolchainPathPrefix: Gcc.pathPrefix(toolchainInstallPath, toolchainPrefix) property string binutilsPathPrefix: Gcc.pathPrefix(binutilsPath, toolchainPrefix) property string cCompilerName: (qbs.toolchain.includes("clang") ? "clang" : "gcc") + compilerExtension property string cxxCompilerName: (qbs.toolchain.includes("clang") ? "clang++" : "g++") + compilerExtension compilerPathByLanguage: ({ "c": toolchainPathPrefix + cCompilerName, "cpp": toolchainPathPrefix + cxxCompilerName, "cppm": toolchainPathPrefix + cxxCompilerName, "objc": toolchainPathPrefix + cCompilerName, "objcpp": toolchainPathPrefix + cxxCompilerName, "asm_cpp": toolchainPathPrefix + cCompilerName }) assemblerPath: binutilsPathPrefix + assemblerName compilerPath: toolchainPathPrefix + compilerName linkerPath: binutilsPathPrefix + linkerName archiverPath: binutilsPathPrefix + archiverName property string nmPath: binutilsPathPrefix + nmName property bool _nmHasDynamicOption: nmProbe.hasDynamicOption property string objcopyPath: binutilsPathPrefix + objcopyName property string stripPath: binutilsPathPrefix + stripName property string dsymutilPath: toolchainPathPrefix + dsymutilName property string lipoPath property stringList dsymutilFlags property bool alwaysUseLipo: false defineFlag: "-D" includeFlag: "-I" systemIncludeFlag: "-isystem" preincludeFlag: "-include" libraryPathFlag: "-L" linkerScriptFlag: "-T" readonly property bool shouldCreateSymlinks: { return createSymlinks && internalVersion && ["macho", "elf"].includes(imageFormat); } readonly property bool shouldSignArtifacts: codesign._canSignArtifacts && codesign.enableCodeSigning // codesigning is done during the lipo step && !product.multiplexed readonly property bool isForMainBundle: product.bundle && product.bundle.isForMainBundle && !product.bundle.isBundle && !product.multiplexed property string internalVersion: { if (product.version === undefined) return undefined; var coreVersion = product.version.match("^([0-9]+\.){0,3}[0-9]+"); if (!coreVersion) return undefined; var maxVersionParts = 3; var versionParts = coreVersion[0].split('.').slice(0, maxVersionParts); // pad if necessary for (var i = versionParts.length; i < maxVersionParts; ++i) versionParts.push("0"); return versionParts.join('.'); } property string soVersion: { if (!internalVersion) return ""; return internalVersion.split('.')[0]; } property var buildEnv: { var env = {}; if (qbs.toolchain.includes("mingw")) env.PATH = toolchainInstallPath; // For libwinpthread etc return env; } compiledModuleSuffix: qbs.toolchain.includes("clang") ? ".pcm" : ".gcm" moduleOutputFlag: qbs.toolchain.includes("clang") ? "-fmodule-output=" : "%module% " moduleFileFlag: qbs.toolchain.includes("clang") ? "-fmodule-file=%module%=" : "%module% " exceptionHandlingModel: { if (qbs.toolchain.includes("mingw")) { // https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html claims // __USING_SJLJ_EXCEPTIONS__ is defined as 1 when using SJLJ exceptions, but there don't // seem to be defines for the other models, so use the presence of the DLLs for now. var prefix = toolchainInstallPath; if (!Host.os().includes("windows")) prefix = FileInfo.joinPaths(toolchainInstallPath, "..", "lib", "gcc", toolchainPrefix, [compilerVersionMajor, compilerVersionMinor].join(".")); var models = ["seh", "sjlj", "dw2"]; for (var i = 0; i < models.length; ++i) { if (File.exists(FileInfo.joinPaths(prefix, "libgcc_s_" + models[i] + "-1.dll"))) { return models[i]; } } } return base; } validate: { if (_skipAllChecks) return; if (!File.exists(compilerPath)) { var pathMessage = FileInfo.isAbsolutePath(compilerPath) ? "at '" + compilerPath + "'" : "'" + compilerPath + "' in PATH"; throw ModUtils.ModuleError("Could not find selected C++ compiler " + pathMessage + ". " + "Ensure that the compiler is properly " + "installed, or set cpp.toolchainInstallPath to a valid " + "toolchain path, or consider whether you meant to set " + "cpp.compilerName instead."); } var isWrongTriple = false; if (gccProbe.architecture) { if (Utilities.canonicalArchitecture(architecture) !== Utilities.canonicalArchitecture(gccProbe.architecture)) isWrongTriple = true; } else if (architecture) { // This is a warning and not an error on the rare chance some new architecture comes // about which qbs does not know about the macros of. But it *might* still work. console.warn("Unknown architecture '" + architecture + "' " + "may not be supported by this compiler."); } if (gccProbe.endianness) { if (endianness !== gccProbe.endianness) isWrongTriple = true; } else if (endianness) { console.warn("Could not detect endianness ('" + endianness + "' given)"); } if (gccProbe.targetPlatform) { // Can't differentiate Darwin OSes at the compiler level alone if (gccProbe.targetPlatform === "darwin" ? !qbs.targetOS.includes("darwin") : qbs.targetPlatform !== gccProbe.targetPlatform) isWrongTriple = true; } else if (qbs.targetPlatform) { console.warn("Could not detect target platform ('" + qbs.targetPlatform + "' given)"); } if (isWrongTriple) { var realTriple = [ Utilities.canonicalArchitecture(gccProbe.architecture), gccProbe.targetPlatform, gccProbe.endianness ? gccProbe.endianness + "-endian" : undefined ].join("-"); var givenTriple = [ Utilities.canonicalArchitecture(architecture), qbs.targetPlatform, endianness ? endianness + "-endian" : undefined ].join("-"); var msg = "The selected compiler '" + compilerPath + "' produces code for '" + realTriple + "', but '" + givenTriple + "' was given, which is incompatible."; if (validateTargetTriple) { msg += " If you are absolutely certain that your configuration is correct " + "(check the values of the qbs.architecture, qbs.targetPlatform, " + "and qbs.endianness properties) and that this message has been " + "emitted in error, set the cpp.validateTargetTriple property to " + "false. However, you should consider submitting a bug report in any " + "case."; throw ModUtils.ModuleError(msg); } else { console.warn(msg); } } var validateFlagsFunction = function (value) { if (value) { for (var i = 0; i < value.length; ++i) { if (["-target", "-triple", "-arch"].includes(value[i])) return false; } } return true; } var validator = new ModUtils.PropertyValidator("cpp"); var msg = "'-target', '-triple' and '-arch' cannot appear in flags; set qbs.architecture instead"; validator.addCustomValidator("assemblerFlags", assemblerFlags, validateFlagsFunction, msg); validator.addCustomValidator("cppFlags", cppFlags, validateFlagsFunction, msg); validator.addCustomValidator("cFlags", cFlags, validateFlagsFunction, msg); validator.addCustomValidator("cxxFlags", cxxFlags, validateFlagsFunction, msg); validator.addCustomValidator("objcFlags", objcFlags, validateFlagsFunction, msg); validator.addCustomValidator("objcxxFlags", objcxxFlags, validateFlagsFunction, msg); validator.addCustomValidator("commonCompilerFlags", commonCompilerFlags, validateFlagsFunction, msg); validator.addCustomValidator("platformAssemblerFlags", platformAssemblerFlags, validateFlagsFunction, msg); //validator.addCustomValidator("platformCppFlags", platformCppFlags, validateFlagsFunction, msg); validator.addCustomValidator("platformCFlags", platformCFlags, validateFlagsFunction, msg); validator.addCustomValidator("platformCxxFlags", platformCxxFlags, validateFlagsFunction, msg); validator.addCustomValidator("platformObjcFlags", platformObjcFlags, validateFlagsFunction, msg); validator.addCustomValidator("platformObjcxxFlags", platformObjcxxFlags, validateFlagsFunction, msg); validator.addCustomValidator("platformCommonCompilerFlags", platformCommonCompilerFlags, validateFlagsFunction, msg); validator.setRequiredProperty("compilerVersion", compilerVersion); validator.setRequiredProperty("compilerVersionMajor", compilerVersionMajor); validator.setRequiredProperty("compilerVersionMinor", compilerVersionMinor); validator.setRequiredProperty("compilerVersionPatch", compilerVersionPatch); validator.addVersionValidator("compilerVersion", compilerVersion, 3, 3); validator.addRangeValidator("compilerVersionMajor", compilerVersionMajor, 1); validator.addRangeValidator("compilerVersionMinor", compilerVersionMinor, 0); validator.addRangeValidator("compilerVersionPatch", compilerVersionPatch, 0); validator.setRequiredProperty("compilerIncludePaths", compilerIncludePaths); validator.setRequiredProperty("compilerFrameworkPaths", compilerFrameworkPaths); validator.setRequiredProperty("compilerLibraryPaths", compilerLibraryPaths); validator.validate(); } // Product should be linked if it's not multiplexed or aggregated at all, // or if it is multiplexed, if it's not the aggregate product readonly property bool shouldLink: !(product.multiplexed || product.aggregate) || product.multiplexConfigurationId Group { condition: shouldLink Rule { name: "dynamicLibraryLinker" multiplex: true inputs: { var tags = ["obj", "res", "linkerscript", "versionscript"]; if (product.bundle && product.bundle.embedInfoPlist && product.qbs.targetOS.includes("darwin")) { tags.push("aggregate_infoplist"); } return tags; } inputsFromDependencies: ["dynamiclibrary_symbols", "staticlibrary", "objectlibrary", "dynamiclibrary_import"] outputFileTags: { var tags = ["bundle.input", "dynamiclibrary", "dynamiclibrary_symlink", "dynamiclibrary_symbols", "debuginfo_dll", "debuginfo_bundle", "dynamiclibrary_import", "debuginfo_plist"]; if (product.cpp.isForMainBundle) tags = tags.concat(["bundle.main.library", "bundle.main.input"]); if (product.cpp.shouldSignArtifacts) tags.push("codesign.signed_artifact"); return tags; } outputArtifacts: Gcc.dynamicLibLinkerOutputArtifacts(product) prepare: Gcc.prepareLinker.apply(Gcc, arguments) } Rule { name: "staticLibraryLinker" multiplex: true inputs: ["obj", "res", "linkerscript"] inputsFromDependencies: ["dynamiclibrary_symbols", "dynamiclibrary_import", "staticlibrary", "objectlibrary"] outputFileTags: { var tags = ["bundle.input", "bundle.main.input", "bundle.main.library", "staticlibrary", "c_staticlibrary", "cpp_staticlibrary"] if (product.cpp.shouldSignArtifacts) tags.push("codesign.signed_artifact"); return tags; } outputArtifacts: Gcc.staticLibLinkerOutputArtifacts(product, inputs) prepare: Gcc.staticLibLinkerCommands.apply(Gcc, arguments) } Rule { name: "loadableModuleLinker" multiplex: true inputs: { var tags = ["obj", "res", "linkerscript"]; if (product.bundle && product.bundle.embedInfoPlist && product.qbs.targetOS.includes("darwin")) { tags.push("aggregate_infoplist"); } return tags; } inputsFromDependencies: ["dynamiclibrary_symbols", "dynamiclibrary_import", "staticlibrary", "objectlibrary"] outputFileTags: { var tags = ["bundle.input", "loadablemodule", "debuginfo_loadablemodule", "debuginfo_bundle", "debuginfo_plist"]; if (product.cpp.isForMainBundle) tags = tags.concat(["bundle.main.plugin", "bundle.main.input"]); if (product.cpp.shouldSignArtifacts) tags.push("codesign.signed_artifact"); return tags; } outputArtifacts: Gcc.moduleLinkerOutputArtifacts(product) prepare: Gcc.prepareLinker.apply(Gcc, arguments) } Rule { name: "applicationLinker" multiplex: true inputs: { var tags = ["obj", "res", "linkerscript"]; if (product.bundle && product.bundle.embedInfoPlist && product.qbs.targetOS.includes("darwin")) { tags.push("aggregate_infoplist"); } return tags; } inputsFromDependencies: ["dynamiclibrary_symbols", "dynamiclibrary_import", "staticlibrary", "objectlibrary"] outputFileTags: { var tags = ["bundle.input", "application", "debuginfo_app", "debuginfo_bundle", "debuginfo_plist"]; if (product.cpp.isForMainBundle) tags = tags.concat(["bundle.main.executable", "bundle.main.input"]); if (product.cpp.shouldSignArtifacts) tags.push("codesign.signed_artifact"); if (product.cpp.generateLinkerMapFile) tags.push("mem_map"); if(product.qbs.toolchain.includes("emscripten")) tags.push("wasm") return tags; } outputArtifacts: Gcc.appLinkerOutputArtifacts(product) prepare: Gcc.prepareLinker.apply(Gcc, arguments) } } Rule { name: "cpp_compiler" inputs: ["cpp", "cppm", "c", "objcpp", "objc", "asm_cpp"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] explicitlyDependsOn: ["c_pch", "cpp_pch", "objc_pch", "objcpp_pch"] outputFileTags: Cpp.compilerOutputTags(/*withListingFiles*/ false, /*withCxxModules*/ true) .concat(["c_obj", "cpp_obj"]) outputArtifacts: Cpp.compilerOutputArtifacts(input, inputs, /*withCxxModules*/ true) prepare: Gcc.prepareCompiler.apply(Gcc, arguments) } Rule { name: "assembler" inputs: ["asm"] outputFileTags: Cpp.assemblerOutputTags(false) outputArtifacts: Cpp.assemblerOutputArtifacts(input) prepare: Gcc.prepareAssembler.apply(Gcc, arguments) } Rule { condition: useCPrecompiledHeader inputs: ["c_pch_src"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.precompiledHeaderOutputTags("c", false) outputArtifacts: Cpp.precompiledHeaderOutputArtifacts(input, product, "c", false) prepare: Gcc.prepareCompiler.apply(Gcc, arguments) } Rule { condition: useCxxPrecompiledHeader inputs: ["cpp_pch_src"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.precompiledHeaderOutputTags("cpp", false) outputArtifacts: Cpp.precompiledHeaderOutputArtifacts(input, product, "cpp", false) prepare: Gcc.prepareCompiler.apply(Gcc, arguments) } Rule { condition: useObjcPrecompiledHeader inputs: ["objc_pch_src"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.precompiledHeaderOutputTags("objc", false) outputArtifacts: Cpp.precompiledHeaderOutputArtifacts(input, product, "objc", false) prepare: Gcc.prepareCompiler.apply(Gcc, arguments) } Rule { condition: useObjcxxPrecompiledHeader inputs: ["objcpp_pch_src"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.precompiledHeaderOutputTags("objcpp", false) outputArtifacts: Cpp.precompiledHeaderOutputArtifacts(input, product, "objcpp", false) prepare: Gcc.prepareCompiler.apply(Gcc, arguments) } FileTagger { patterns: "*.s" fileTags: ["asm"] } FileTagger { patterns: "*.S" fileTags: ["asm_cpp"] } FileTagger { patterns: "*.sx" fileTags: ["asm_cpp"] } Scanner { inputs: ["linkerscript"] recursive: true scan: { console.debug("scanning linkerscript " + filePath + " for dependencies"); var retval = []; var linkerScript = new TextFile(filePath, TextFile.ReadOnly); var regexp = /[\s]*INCLUDE[\s]+(\S+).*/ // "INCLUDE filename" var match; while (!linkerScript.atEof()) { match = regexp.exec(linkerScript.readLine()); if (match) { var dependencyFileName = match[1]; retval.push(dependencyFileName); console.debug("linkerscript " + filePath + " depends on " + dependencyFileName); } } linkerScript.close(); return retval; } searchPaths: { var retval = []; for (var i = 0; i < (product.cpp.libraryPaths || []).length; i++) retval.push(product.cpp.libraryPaths[i]); var regexp = /[\s]*SEARCH_DIR\((\S+)\).*/ // "SEARCH_DIR(path)" var match; var linkerScript = new TextFile(input.filePath, TextFile.ReadOnly); while (!linkerScript.atEof()) { match = regexp.exec(linkerScript.readLine()); if(match) { var additionalPath = match[1]; // path can be quoted to use non-latin letters, remove quotes if present if (additionalPath.startsWith("\"") && additionalPath.endsWith("\"")) additionalPath = additionalPath.slice(1, additionalPath.length - 1); retval.push(additionalPath); } } linkerScript.close(); return retval; } } } qbs-src-3.2.0/share/qbs/modules/cpp/cpp.js0000644000175100017510000006207515154533055017755 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var BinaryFile = require("qbs.BinaryFile"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var PathTools = require("qbs.PathTools"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); function languageVersion(versionArray, knownValues, lang) { if (!versionArray) return undefined; var versions = [].uniqueConcat(versionArray); if (versions.length === 1) return versions[0]; for (var i = 0; i < knownValues.length; ++i) { var candidate = knownValues[i]; if (versions.includes(candidate)) return candidate; } var version = versions[0]; console.debug("Randomly choosing '" + version + "' from list of unknown " + lang + " version strings (" + versions + ")"); return version; } function extractMacros(output, regexp) { var m = {}; output.trim().split(/\r?\n/g).map(function(line) { if (regexp) { var match = regexp.exec(line); if (!match) return; line = match[1]; } var prefix = "#define "; if (!line.startsWith(prefix)) return; var index = line.indexOf(" ", prefix.length); if (index !== -1) m[line.substr(prefix.length, index - prefix.length)] = line.substr(index + 1); }); return m; } function relativePath(baseDirectory, filePath) { if (FileInfo.isAbsolutePath(filePath)) return FileInfo.relativePath(baseDirectory, filePath); return filePath; } function assemblerOutputTags(needsListingFiles) { var tags = ["obj"]; if (needsListingFiles) tags.push("lst"); return tags; } function compilerOutputTags(withListingFiles, withCxxModules) { var tags = ["obj", "intermediate_obj"]; if (withListingFiles) tags.push("lst"); if (withCxxModules) tags = tags.concat(["compiled-module", "modulemap", "moduleinfo"]); return tags; } function applicationLinkerOutputTags(needsLinkerMapFile) { var tags = ["application"]; if (needsLinkerMapFile) tags.push("mem_map"); return tags; } function dynamicLibraryLinkerOutputTags() { return ["dynamiclibrary", "dynamiclibrary_import"]; } function staticLibraryLinkerOutputTags() { return ["staticlibrary"]; } function resourceCompilerOutputTags() { return ["res"]; } function precompiledHeaderOutputTags(lang, generateObjects) { var tags = [lang + "_pch"]; if (generateObjects) tags.push("obj"); return tags; }; function assemblerOutputArtifacts(input) { var artifacts = []; artifacts.push({ fileTags: ["obj"], filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir), input.fileName + input.cpp.objectSuffix) }); if (input.cpp.generateAssemblerListingFiles) { artifacts.push({ fileTags: ["lst"], filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir), input.fileName + input.cpp.assemblerListingSuffix) }); } return artifacts; } function cxxModulesArtifacts(input) { var artifacts = []; if (input.cpp.forceUseCxxModules === false) return artifacts; if (input.cpp.compiledModuleSuffix === undefined || input.cpp.moduleOutputFlag === undefined || input.cpp.moduleFileFlag === undefined) { console.warn("Skip additional artifacts for '" + input.fileName + "' since '" + input.qbs.toolchainType + "' toolchain does not support C++ Modules."); return artifacts; } var moduleInformation = CppModulesScanner.apply(input); if (moduleInformation.providesModule || moduleInformation.requiresModules.length > 0) { artifacts.push({ filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir), input.fileName + input.cpp.moduleMapSuffix), fileTags: ["modulemap"], // we can't use maps here only strings and lists cpp: { _providesModule: moduleInformation.providesModule, _isInterfaceModule: moduleInformation.isInterfaceModule, _requiresModules : moduleInformation.requiresModules, }, }) } if (input.fileTags.includes("cppm")) { const moduleName = moduleInformation.providesModule ? moduleInformation.providesModule : undefined; if (moduleName) { const moduleFileName = moduleName.replace(':', '-'); artifacts.push({ filePath: FileInfo.joinPaths("cxx-modules", moduleFileName + product.cpp.compiledModuleSuffix), fileTags: ["compiled-module"], }) artifacts.push({ filePath: FileInfo.joinPaths("cxx-modules", moduleFileName + product.cpp.moduleInfoSuffix), fileTags: ["moduleinfo"], }) } else { console.warn("File '" + input.fileName + "' has 'cppm' tag, but does not " + "provide a module interface unit or partition"); } } return artifacts; } function compilerOutputArtifacts(input, inputs, withCxxModules) { var objTags = input.fileTags.includes("cpp_intermediate_object") ? ["intermediate_obj"] : ["obj"]; if (inputs) { if (inputs.c || inputs.objc) objTags.push("c_obj"); if (inputs.cpp || inputs.objcpp || inputs.cppm) objTags.push("cpp_obj"); } var artifacts = [{ fileTags: objTags, filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir), input.fileName + input.cpp.objectSuffix) }]; if (input.cpp.generateCompilerListingFiles) { artifacts.push({ fileTags: ["lst"], filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir), input.fileName + input.cpp.compilerListingSuffix) }); } if (withCxxModules) artifacts = artifacts.concat(cxxModulesArtifacts(input)); return artifacts; } function applicationLinkerOutputArtifacts(product) { var artifacts = [{ fileTags: ["application"], filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.applicationFilePath(product)) }]; if (product.cpp.generateLinkerMapFile) { artifacts.push({ fileTags: ["mem_map"], filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + product.cpp.linkerMapSuffix) }); } return artifacts; } function dynamicLibraryLinkerOutputArtifacts(product) { return [{ fileTags: ["dynamiclibrary"], filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.dynamicLibraryFilePath(product)) }, { fileTags: ["dynamiclibrary_import"], filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.importLibraryFilePath(product)), alwaysUpdated: false }]; } function staticLibraryLinkerOutputArtifacts(product) { return [{ fileTags: ["staticlibrary"], filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.staticLibraryFilePath(product)) }]; } function resourceCompilerOutputArtifacts(input) { return [{ fileTags: ["res"], filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir), input.completeBaseName + input.cpp.resourceSuffix) }]; } function precompiledHeaderOutputArtifacts(input, product, lang, generateObjects) { var artifacts = [{ fileTags: [lang + "_pch"], filePath: product.name + "_" + lang + product.cpp.precompiledHeaderSuffix }]; if (generateObjects) { artifacts.push({ fileTags: ["obj"], filePath: Utilities.getHash(input.completeBaseName) + "_" + lang + input.cpp.objectSuffix }); } return artifacts; } function collectLibraryDependencies(product) { var seen = {}; var seenObjectFiles = []; var result = []; function addFilePath(filePath, wholeArchive, productName) { result.push({ filePath: filePath, wholeArchive: wholeArchive, productName: productName }); } function addArtifactFilePaths(dep, artifacts) { if (!artifacts) return; var artifactFilePaths = artifacts.map(function(a) { return a.filePath; }); var wholeArchive = dep.parameters.cpp && dep.parameters.cpp.linkWholeArchive; var artifactsAreImportLibs = artifacts.length > 0 && artifacts[0].fileTags.includes("dynamiclibrary_import"); for (var i = 0; i < artifactFilePaths.length; ++i) { addFilePath(artifactFilePaths[i], wholeArchive, artifactsAreImportLibs ? dep.name : undefined); } } function addExternalLibs(obj) { if (!obj.cpp) return; function ensureArray(a) { return (a instanceof Array) ? a : []; } function sanitizedModuleListProperty(obj, moduleName, propertyName) { return ensureArray(ModUtils.sanitizedModuleProperty(obj, moduleName, propertyName)); } function handleExternalLibraries(tag, libSuffix, objSuffix) { var externalLibs = sanitizedModuleListProperty(obj, "cpp", tag) || []; externalLibs.forEach(function(libName) { var isObjectFile = objSuffix && libName.endsWith(objSuffix); if (isObjectFile) { if (seenObjectFiles.includes(libName)) return; seenObjectFiles.push(libName); } if (!libName.endsWith(libSuffix) && !isObjectFile && !libName.startsWith('@')) libName += libSuffix; addFilePath(libName, false); }); } handleExternalLibraries("staticLibraries", obj.moduleProperty("cpp", "staticLibrarySuffix"), obj.moduleProperty("cpp", "objectSuffix")); handleExternalLibraries("dynamicLibraries", obj.moduleProperty("cpp", "dynamicLibraryImportSuffix")); } function traverse(dep) { if (seen.hasOwnProperty(dep.name)) return; if (dep.parameters.cpp && dep.parameters.cpp.link === false) return; var staticLibraryArtifacts = dep.artifacts["staticlibrary"] || dep.artifacts["objectlibrary"]; var dynamicLibraryArtifacts = staticLibraryArtifacts ? null : dep.artifacts["dynamiclibrary_import"]; if (staticLibraryArtifacts) { seen[dep.name] = true; dep.dependencies.forEach(traverse); addArtifactFilePaths(dep, staticLibraryArtifacts); if (product.cpp.importPrivateLibraries) addExternalLibs(dep); } else if (dynamicLibraryArtifacts) { seen[dep.name] = true; addArtifactFilePaths(dep, dynamicLibraryArtifacts); } } product.dependencies.forEach(traverse); addExternalLibs(product); return result; } function collectAbsoluteLibraryDependencyPaths(product) { var paths = collectLibraryPaths(product); var deps = collectLibraryDependencies(product); return deps.map(function(dep) { var filePath = dep.filePath; if (FileInfo.isAbsolutePath(filePath)) return filePath; for (var i = 0; i < paths.length; ++i) { var fullPath = FileInfo.joinPaths(paths[i], filePath); if (File.exists(fullPath)) return fullPath; } return filePath; }); } function collectDefines(input) { var allDefines = []; var platformDefines = input.cpp.platformDefines; if (platformDefines) allDefines = allDefines.uniqueConcat(platformDefines); var defines = input.cpp.defines; if (defines) allDefines = allDefines.uniqueConcat(defines); return allDefines; } function collectIncludePaths(input) { var allIncludePaths = []; var includePaths = input.cpp.includePaths; if (includePaths) allIncludePaths = allIncludePaths.uniqueConcat(includePaths); var builtIns = input.cpp.compilerIncludePaths; return allIncludePaths.filter(function(p) { return !builtIns.includes(p); }); } function collectSystemIncludePaths(input) { var allIncludePaths = []; var systemIncludePaths = input.cpp.systemIncludePaths; if (systemIncludePaths) allIncludePaths = allIncludePaths.uniqueConcat(systemIncludePaths); var distributionIncludePaths = input.cpp.distributionIncludePaths; if (distributionIncludePaths) allIncludePaths = allIncludePaths.uniqueConcat(distributionIncludePaths); var builtIns = input.cpp.compilerIncludePaths; return allIncludePaths.filter(function(p) { return !builtIns.includes(p); }); } function collectPreincludePaths(input) { return input.cpp.prefixHeaders; } function collectLibraryPaths(product) { var allLibraryPaths = []; var libraryPaths = product.cpp.libraryPaths; if (libraryPaths) allLibraryPaths = allLibraryPaths.uniqueConcat(libraryPaths); var distributionLibraryPaths = product.cpp.distributionLibraryPaths; if (distributionLibraryPaths) allLibraryPaths = allLibraryPaths.uniqueConcat(distributionLibraryPaths); return allLibraryPaths; } function collectLinkerScriptPaths(inputs) { return inputs.linkerscript ? inputs.linkerscript.map(function(script) { return script.filePath; }) : []; } function collectLinkerObjectPaths(inputs) { return inputs.obj ? inputs.obj.filter(function(obj) { return !obj.fileTags.includes("objectlibrary"); }) .map(function(obj) { return obj.filePath; }) : []; } function collectResourceObjectPaths(inputs) { return inputs.res ? inputs.res.map(function(res) { return res.filePath; }) : []; } function collectLibraryDependenciesArguments(product) { var deps = collectLibraryDependencies(product); return deps.map(function(dep) { return product.cpp.libraryDependencyFlag + dep.filePath }) } function collectDefinesArguments(input) { var defines = collectDefines(input); return defines.map(function(define) { return input.cpp.defineFlag + define }); } function collectIncludePathsArguments(input) { var paths = collectIncludePaths(input); return paths.map(function(path) { return input.cpp.includeFlag + path }); } function collectSystemIncludePathsArguments(input, flag) { flag = (flag === undefined) ? input.cpp.systemIncludeFlag : flag; var paths = collectSystemIncludePaths(input); return paths.map(function(path) { return flag + path }); } function collectPreincludePathsArguments(input, split) { var paths = collectPreincludePaths(input); if (split) { var args = []; for (var i = 0; i < paths.length; ++i) args.push(input.cpp.preincludeFlag, paths[i]); return args; } else { return paths.map(function(path) { return input.cpp.preincludeFlag + path }); } } function collectLibraryPathsArguments(product, flag) { flag = (flag === undefined) ? product.cpp.libraryPathFlag : flag; var paths = collectLibraryPaths(product); return paths.map(function(path) { return flag + path }); } function collectLinkerScriptPathsArguments(product, inputs, split, flag) { flag = (flag === undefined) ? product.cpp.linkerScriptFlag : flag; var paths = collectLinkerScriptPaths(inputs); if (split) { var args = []; for (var i = 0; i < paths.length; ++i) args.push(flag, paths[i]); return args; } else { return paths.map(function(path) { return flag + path }); } } function collectLinkerObjectPathsArguments(product, inputs, flag) { flag = (flag === undefined) ? "" : flag; var paths = collectLinkerObjectPaths(product); return paths.map(function(path) { return flag + path }); } function collectMiscCompilerArguments(input, tag) { if (tag === "cppm") tag = "cpp"; return [].concat(ModUtils.moduleProperty(input, "platformFlags"), ModUtils.moduleProperty(input, "flags"), ModUtils.moduleProperty(input, "platformFlags", tag), ModUtils.moduleProperty(input, "flags", tag)); } function collectMiscAssemblerArguments(input, tag) { return [].concat(ModUtils.moduleProperty(input, "platformFlags", tag), ModUtils.moduleProperty(input, "flags", tag)); } function collectMiscDriverArguments(config) { return [].concat(ModUtils.moduleProperty(config, "platformDriverFlags"), ModUtils.moduleProperty(config, "driverFlags"), ModUtils.moduleProperty(config, "targetDriverFlags")); } function collectMiscLinkerArguments(product) { return [].concat(ModUtils.moduleProperty(product, "driverLinkerFlags")); } function collectMiscEscapableLinkerArguments(product) { return [].concat(ModUtils.moduleProperty(product, "platformLinkerFlags"), ModUtils.moduleProperty(product, "linkerFlags")); } function supportsArchitecture(architecture, knownArchitectures) { for (var i = 0; i < knownArchitectures.length; ++i) { if (architecture.startsWith("arm")) { if (architecture.startsWith(knownArchitectures[i])) return true; } else { if (architecture === knownArchitectures[i]) return true; } } return false; } function prepareModuleInfo(moduleInformation, input, output, product) { var command = new JavaScriptCommand() command.moduleInformation = moduleInformation command.outPath = output.filePath command.description = "generating module info for " + input.fileName command.highlight = "filegen" command.sourceCode = function() { var file = new TextFile(outPath, TextFile.WriteOnly); file.write(JSON.stringify(moduleInformation, undefined, 4)); file.close(); } return command; } function prepareModuleMap(moduleInformation, input, mm, product) { var modulesFromDeps = {}; product.dependencies.forEach(function(dep){ (dep.artifacts["compiled-module"] || []).forEach(function(a) { modulesFromDeps[a.completeBaseName.replace('-', ':')] = a.filePath; }); }); var generateModuleMap = new JavaScriptCommand() generateModuleMap.outPath = mm.filePath generateModuleMap.moduleInformation = moduleInformation; generateModuleMap.compiledModuleSuffix = product.cpp.compiledModuleSuffix; generateModuleMap.moduleInfoSuffix = product.cpp.moduleInfoSuffix; generateModuleMap.moduleOutputFlag = product.cpp.moduleOutputFlag; generateModuleMap.moduleFileFlag = product.cpp.moduleFileFlag; generateModuleMap.toolchain = product.qbs.toolchain; generateModuleMap.toolchainType = product.qbs.toolchainType; generateModuleMap.modulesFromDeps = modulesFromDeps; generateModuleMap.description = "generating module map for " + input.fileName generateModuleMap.highlight = "filegen" generateModuleMap.sourceCode = function() { function moduleFileOption(moduleName) { return moduleFileFlag.replace("%module%", moduleName); } function moduleOutputOption(moduleName) { return moduleOutputFlag.replace("%module%", moduleName); } var content = ""; if (toolchainType === "gcc" || toolchainType === "mingw") content += "$root .\n"; const isModule = input.fileTags.includes("cppm"); function modulePath(moduleName) { return FileInfo.joinPaths( product.buildDirectory, "cxx-modules", moduleName.replace(':', "-") + compiledModuleSuffix); } const providesModule = moduleInformation.providesModule if (isModule && providesModule !== undefined) { if (toolchainType === "msvc") { if (moduleInformation.isInterfaceModule) content += "-interface\n"; else content += "-internalPartition\n"; } content += moduleOutputOption(providesModule) + modulePath(providesModule) + "\n"; } function isHeaderImport(mod) { return mod.length > 2 && (mod[0] == '<' && mod[mod.length - 1] == '>' || mod[0] == '"' && mod[mod.length - 1] == '"') } function processImport(mod) { if (!isHeaderImport(mod)) { const moduleFile = modulesFromDeps[mod] || modulePath(mod); content += moduleFileOption(mod) + moduleFile + "\n"; function getModuleInfo(moduleFile) { const moduleInfoPath = FileInfo.joinPaths( FileInfo.path(moduleFile), FileInfo.completeBaseName(moduleFile) + moduleInfoSuffix); var file = new TextFile(moduleInfoPath, TextFile.ReadOnly); const moduleInfo = JSON.parse(file.readAll()); file.close(); return moduleInfo; } function processImportsRecursive(moduleFile) { // can we do better rather than pass info via a file? const moduleInfo = getModuleInfo(moduleFile); const requiresModules = moduleInfo['requiresModules'] || []; requiresModules.forEach(function(importModule) { const importModuleFile = modulesFromDeps[importModule] || modulePath(importModule); content += moduleFileOption(importModule) + importModuleFile + "\n"; processImportsRecursive(importModuleFile); }); } processImportsRecursive(moduleFile); } } moduleInformation.requiresModules.forEach(processImport); // converts UTF string to an array of bytes function encode(string) { var bytes = []; for (var i = 0; i < string.length; i++) { bytes.push(string.charCodeAt(i)); } return bytes; } // MinGW fails if file contains \r on Windows, so we use Unix line-endings on all platforms // and thus we use BinaryFile instead of TextFile here var file = new BinaryFile(outPath, TextFile.WriteOnly); file.write(encode(content)); file.close(); } return generateModuleMap; } function prepareModules(project, product, inputs, outputs, input, output) { var commands = []; // module map is present for both cppm and regular cpp files if they use modules const moduleMapOutputs = outputs["modulemap"]; if (moduleMapOutputs === undefined) return commands; const cppModuleMap = moduleMapOutputs[0]; if (cppModuleMap === undefined) return commands; const moduleInformation = { providesModule: cppModuleMap.cpp._providesModule, isInterfaceModule: cppModuleMap.cpp._isInterfaceModule, requiresModules: cppModuleMap.cpp._requiresModules, }; // module info json is present only for cppm var cppModuleInfo = outputs["moduleinfo"]; if (cppModuleInfo) commands.push(prepareModuleInfo(moduleInformation, input, cppModuleInfo[0], product)); commands.push(prepareModuleMap(moduleInformation, input, cppModuleMap, product)); return commands; } qbs-src-3.2.0/share/qbs/modules/cpp/DarwinGCC.qbs0000644000175100017510000002730715154533055021104 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.DarwinTools import qbs.File import qbs.FileInfo import qbs.ModUtils import qbs.PathTools import qbs.Probes import qbs.PropertyList import qbs.TextFile import qbs.Utilities import "darwin.js" as Darwin import "gcc.js" as Gcc UnixGCC { condition: false Depends { name: "xcode"; required: qbs.toolchain && qbs.toolchain.includes("xcode") } Probes.BinaryProbe { id: lipoProbe condition: !_skipAllChecks names: [lipoName] platformSearchPaths: { var paths = (xcode.present && xcode.devicePlatformPath) ? [xcode.devicePlatformPath + "/Developer/usr/bin"] : []; return paths.concat([toolchainInstallPath, "/usr/bin"]); } } property string lipoPathPrefix: Gcc.pathPrefix(lipoProbe.found ? lipoProbe.path : toolchainInstallPath, toolchainPrefix) lipoName: "lipo" lipoPath: lipoPathPrefix + lipoName property bool enableAggregationRules: product.aggregate && !product.multiplexConfigurationId targetVendor: "apple" targetSystem: "darwin" targetAbi: "macho" imageFormat: "macho" cxxStandardLibrary: libcxxAvailable ? "libc++" : base loadableModulePrefix: "" loadableModuleSuffix: ".bundle" dynamicLibrarySuffix: ".dylib" Properties { condition: product.multiplexByQbsProperties.includes("buildVariants") && qbs.buildVariants && qbs.buildVariants.length > 1 && (!product.aggregate || !!product.multiplexConfigurationId) && qbs.buildVariant !== "release" variantSuffix: "_" + qbs.buildVariant } separateDebugInformation: true debugInfoBundleSuffix: ".dSYM" debugInfoSuffix: ".dwarf" rpathOrigin: "@loader_path" useRPathLink: !minimumDarwinVersion || Utilities.versionCompare(minimumDarwinVersion, "10.5") < 0 rpathLinkFlag: "-L" toolchainInstallPath: xcode.present ? FileInfo.joinPaths(xcode.toolchainPath, "usr", "bin") : base sysroot: xcode.present ? xcode.sdkPath : base sysrootFlags: sysroot ? ["-isysroot", sysroot] : [] setupBuildEnvironment: { for (var key in product.cpp.buildEnv) { var v = new ModUtils.EnvironmentVariable(key); v.value = product.cpp.buildEnv[key]; v.set(); } } property var defaultInfoPlist: { var dict = {}; if (qbs.targetOS.includes("macos")) { dict["NSPrincipalClass"] = "NSApplication"; // needed for Retina display support // QBS-1670: set this flag by default to avoid extensive GPU usage dict["NSSupportsAutomaticGraphicsSwitching"] = true; if (minimumMacosVersion) dict["LSMinimumSystemVersion"] = minimumMacosVersion; } if (qbs.targetOS.includes("ios") && minimumIosVersion) dict["MinimumOSVersion"] = minimumIosVersion; else if (qbs.targetOS.includes("tvos") && minimumTvosVersion) dict["MinimumOSVersion"] = minimumTvosVersion; else if (qbs.targetOS.includes("watchos") && minimumWatchosVersion) dict["MinimumOSVersion"] = minimumWatchosVersion; if (qbs.targetOS.containsAny(["ios", "tvos"])) { dict["LSRequiresIPhoneOS"] = true; if (xcode.platformType === "device") { if (qbs.targetOS.includes("ios")) { if (qbs.architecture === "arm64") dict["UIRequiredDeviceCapabilities"] = ["arm64"]; else dict["UIRequiredDeviceCapabilities"] = ["armv7"]; } if (qbs.targetOS.includes("tvos")) dict["UIRequiredDeviceCapabilities"] = ["arm64"]; } } if (xcode.present) { var targetDevices = DarwinTools.targetedDeviceFamily(xcode.targetDevices); if (qbs.targetOS.includes("ios")) dict["UIDeviceFamily"] = targetDevices; if (qbs.targetOS.containsAny(["ios", "watchos"])) { var orientations = [ "UIInterfaceOrientationPortrait", "UIInterfaceOrientationPortraitUpsideDown", "UIInterfaceOrientationLandscapeLeft", "UIInterfaceOrientationLandscapeRight" ]; if (targetDevices.includes("ipad")) dict["UISupportedInterfaceOrientations~ipad"] = orientations; if (targetDevices.includes("watch")) dict["UISupportedInterfaceOrientations"] = orientations.slice(0, 2); if (targetDevices.includes("iphone")) { orientations.splice(1, 1); dict["UISupportedInterfaceOrientations"] = orientations; } } } return dict; } targetLinkerFlags: darwinArchFlags.concat(minimumDarwinVersionLinkerFlags) targetAssemblerFlags: !assemblerHasTargetOption ? darwinArchFlags : base; targetDriverFlags: !compilerHasTargetOption ? legacyTargetDriverFlags : base property stringList legacyTargetDriverFlags: base.concat(darwinArchFlags).concat(minimumDarwinVersionCompilerFlags) // private properties readonly property stringList darwinArchFlags: targetArch ? ["-arch", targetArch] : [] readonly property stringList minimumDarwinVersionCompilerFlags: (minimumDarwinVersionCompilerFlag && minimumDarwinVersion) ? [minimumDarwinVersionCompilerFlag + "=" + minimumDarwinVersion] : [] readonly property stringList minimumDarwinVersionLinkerFlags: (minimumDarwinVersionLinkerFlag && minimumDarwinVersion && compilerVersionMajor < 11) ? [minimumDarwinVersionLinkerFlag, minimumDarwinVersion] : [] readonly property var buildEnv: { var env = { "ARCHS_STANDARD": xcode.standardArchitectures, "EXECUTABLE_NAME": product.targetName, "PRODUCT_NAME": product.name } // Set the corresponding environment variable even if the minimum OS version is undefined, // because this indicates the default deployment target for that OS if (qbs.targetOS.includes("ios") && minimumIosVersion) env["IPHONEOS_DEPLOYMENT_TARGET"] = minimumIosVersion; if (qbs.targetOS.includes("macos") && minimumMacosVersion) env["MACOSX_DEPLOYMENT_TARGET"] = minimumMacosVersion; if (qbs.targetOS.includes("watchos") && minimumWatchosVersion) env["WATCHOS_DEPLOYMENT_TARGET"] = minimumWatchosVersion; if (qbs.targetOS.includes("tvos") && minimumTvosVersion) env["TVOS_DEPLOYMENT_TARGET"] = minimumTvosVersion; if (xcode.present) env["TARGETED_DEVICE_FAMILY"] = DarwinTools.targetedDeviceFamily(xcode.targetDevices).join(","); return env; } property string minimumDarwinVersion property string minimumDarwinVersionCompilerFlag property string minimumDarwinVersionLinkerFlag property bool libcxxAvailable: qbs.toolchain.includes("clang") && cxxLanguageVersion !== "c++98" Group { condition: enableAggregationRules Rule { inputsFromDependencies: ["application"] multiplex: true outputFileTags: ["bundle.input", "bundle.main.input", "bundle.main.executable", "application", "primary", "debuginfo_app", "debuginfo_bundle", "bundle.variant_copy", "debuginfo_plist", "codesign.signed_artifact"] outputArtifacts: Darwin.lipoOutputArtifacts(product, inputs, "application", "app") prepare: Darwin.prepareLipo.apply(Darwin, arguments) } Rule { inputsFromDependencies: ["loadablemodule"] multiplex: true outputFileTags: ["bundle.input", "bundle.main.input", "bundle.main.plugin", "loadablemodule", "primary", "debuginfo_loadablemodule", "debuginfo_bundle", "debuginfo_plist", "codesign.signed_artifact"] outputArtifacts: Darwin.lipoOutputArtifacts(product, inputs, "loadablemodule", "loadablemodule") prepare: Darwin.prepareLipo.apply(Darwin, arguments) } Rule { inputsFromDependencies: ["dynamiclibrary"] multiplex: true outputFileTags: ["bundle.input", "bundle.main.input", "bundle.main.library", "dynamiclibrary", "dynamiclibrary_symbols", "primary", "debuginfo_dll","debuginfo_bundle","bundle.variant_copy", "debuginfo_plist", "codesign.signed_artifact", "dynamiclibrary_symlink"] outputArtifacts: Darwin.lipoOutputArtifacts(product, inputs, "dynamiclibrary", "dll") prepare: Darwin.prepareLipo.apply(Darwin, arguments) } Rule { inputsFromDependencies: ["staticlibrary"] multiplex: true outputFileTags: ["bundle.input", "bundle.main.input", "bundle.main.library", "staticlibrary", "primary", "codesign.signed_artifact"] outputArtifacts: Darwin.lipoOutputArtifacts(product, inputs, "staticlibrary") prepare: Darwin.prepareLipo.apply(Darwin, arguments) } } Rule { condition: qbs.targetOS.includes("darwin") multiplex: true Artifact { filePath: product.name + "-cpp-Info.plist" fileTags: ["partial_infoplist"] } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.inputData = product.cpp.defaultInfoPlist; cmd.outputFilePath = output.filePath; cmd.sourceCode = function() { var plist = new PropertyList(); try { plist.readFromObject(inputData); plist.writeToFile(outputFilePath, "xml1"); } finally { plist.clear(); } }; return [cmd]; } } } qbs-src-3.2.0/share/qbs/modules/cpp/LinuxGCC.qbs0000644000175100017510000000540515154533055020752 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Host import qbs.Process UnixGCC { condition: qbs.targetOS.includes('linux') && qbs.toolchain && qbs.toolchain.includes('gcc') priority: 1 targetVendor: "pc" targetSystem: "linux" targetAbi: "gnu" Probe { id: runPathsProbe condition: !_skipAllChecks && qbs.targetPlatform === Host.platform() property stringList systemRunPaths: [] configure: { var paths = []; var ldconfig = new Process(); try { var success = ldconfig.exec("ldconfig", ["-vNX"]); if (success === -1) return; var line; do { line = ldconfig.readLine(); if (line.charAt(0) === '/') { var colonIndex = line.indexOf(':'); if (colonIndex == -1) continue; paths.push(line.slice(0, colonIndex)); } } while (line && line.length > 0) found = true; systemRunPaths = paths; } finally { ldconfig.close(); } } } systemRunPaths: runPathsProbe.found ? runPathsProbe.systemRunPaths : base } qbs-src-3.2.0/share/qbs/modules/cpp/gcc.js0000644000175100017510000022176515154533055017732 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Codesign = require("../codesign/codesign.js"); var Cpp = require("cpp.js"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var Host = require("qbs.Host"); var DarwinTools = require("qbs.DarwinTools"); var ModUtils = require("qbs.ModUtils"); var PathTools = require("qbs.PathTools"); var Process = require("qbs.Process"); var TextFile = require("qbs.TextFile"); var UnixUtils = require("qbs.UnixUtils"); var Utilities = require("qbs.Utilities"); var WindowsUtils = require("qbs.WindowsUtils"); function getLinkerTypeRecursively(product, isDep) { if (isDep) { if (!product.type || !product.artifacts || !product.type.includes("staticlibrary")) return undefined; if (product.artifacts.cpp_staticlibrary) return "cpp"; } var linkerType = undefined; for (var i = 0; i < (product.dependencies || []).length; ++i) { var depType = getLinkerTypeRecursively(product.dependencies[i], true); if (depType === "cpp") return "cpp"; if (depType === "c") linkerType = "c"; } if (!linkerType && product.artifacts.c_staticlibrary) return "c"; return linkerType; } function effectiveLinkerPath(product, inputs) { if (product.cpp.linkerMode === "automatic") { var compilers = product.cpp.compilerPathByLanguage; if (compilers) { if (inputs.cpp_obj || inputs.cpp_staticlibrary) { console.log("Found C++ or Objective-C++ objects, choosing C++ linker for " + product.name); return compilers["cpp"]; } var linkerTypeFromDeps = getLinkerTypeRecursively(product, false); if (linkerTypeFromDeps) return compilers[linkerTypeFromDeps]; if (inputs.c_obj || inputs.c_staticlibrary) { console.log("Found C or Objective-C objects, choosing C linker for " + product.name); return compilers["c"]; } } console.log("Found no C-language objects, choosing system linker for " + product.name); } return product.cpp.linkerPath; } function useCompilerDriverLinker(product, inputs) { var linker = effectiveLinkerPath(product, inputs); var compilers = product.cpp.compilerPathByLanguage; if (compilers) { return linker === compilers["cpp"] || linker === compilers["c"]; } return linker === product.cpp.compilerPath; } function collectLibraryDependencies(product, isDarwin) { var publicDeps = {}; var privateDeps = {}; var objects = []; var objectByFilePath = {}; var tagForLinkingAgainstSharedLib = product.cpp.imageFormat === "pe" ? "dynamiclibrary_import" : "dynamiclibrary"; var removeDuplicateLibraries = product.cpp.removeDuplicateLibraries function addObject(obj, addFunc) { /* If the object is already known, remove its previous usage and insert * it again in the new desired position. This preserves the order of * the other objects, and is analogous to what qmake does (see the * mergeLflags parameter in UnixMakefileGenerator::findLibraries()). */ if (removeDuplicateLibraries && (obj.filePath in objectByFilePath)) { var oldObj = objectByFilePath[obj.filePath]; var i = objects.indexOf(oldObj); if (i >= 0) objects.splice(i, 1); } addFunc.call(objects, obj); objectByFilePath[obj.filePath] = obj; } function addPublicFilePath(filePath, dep) { var existing = objectByFilePath[filePath]; var wholeArchive = dep.parameters.cpp && dep.parameters.cpp.linkWholeArchive; var symbolLinkMode = dep.parameters.cpp && dep.parameters.cpp.symbolLinkMode; if (existing) { existing.direct = true; existing.wholeArchive = wholeArchive; existing.symbolLinkMode = symbolLinkMode; } else { addObject({ direct: true, filePath: filePath, wholeArchive: wholeArchive, symbolLinkMode: symbolLinkMode }, Array.prototype.unshift); } } function addPrivateFilePath(filePath) { var existing = objectByFilePath[filePath]; if (!existing) addObject({ direct: false, filePath: filePath }, Array.prototype.unshift); } function addArtifactFilePaths(dep, tag, addFunction) { var artifacts = dep.artifacts[tag]; if (!artifacts) return; var artifactFilePaths = artifacts.map(function(a) { return a.filePath; }); for (var i = 0; i < artifactFilePaths.length; ++i) addFunction(artifactFilePaths[i], dep); } function addExternalLibs(obj) { if (!obj.cpp) return; function ensureArray(a) { return (a instanceof Array) ? a : []; } function sanitizedModuleListProperty(obj, moduleName, propertyName) { return ensureArray(ModUtils.sanitizedModuleProperty(obj, moduleName, propertyName)); } var externalLibs = [].concat( ensureArray(sanitizedModuleListProperty(obj, "cpp", "staticLibraries")), ensureArray(sanitizedModuleListProperty(obj, "cpp", "dynamicLibraries"))); for (var i = 0, len = externalLibs.length; i < len; ++i) addObject({ direct: true, filePath: externalLibs[i] }, Array.prototype.push); if (isDarwin) { externalLibs = [].concat( ensureArray(sanitizedModuleListProperty(obj, "cpp", "frameworks"))); for (var i = 0, len = externalLibs.length; i < len; ++i) addObject({ direct: true, filePath: externalLibs[i], framework: true }, Array.prototype.push); externalLibs = [].concat( ensureArray(sanitizedModuleListProperty(obj, "cpp", "weakFrameworks"))); for (var i = 0, len = externalLibs.length; i < len; ++i) addObject({ direct: true, filePath: externalLibs[i], framework: true, symbolLinkMode: "weak" }, Array.prototype.push); } } function traverse(dep, isBelowIndirectDynamicLib, someDepConsumesObjects) { if (publicDeps[dep.name]) return; if (dep.parameters.cpp && dep.parameters.cpp.link === false) return; var isStaticLibrary = typeof dep.artifacts["staticlibrary"] !== "undefined"; var isObjectLibrary = !isStaticLibrary && typeof dep.artifacts["objectlibrary"] !== "undefined"; var isDynamicLibrary = !isStaticLibrary && !isObjectLibrary && typeof dep.artifacts[tagForLinkingAgainstSharedLib] !== "undefined"; if (!isStaticLibrary && !isObjectLibrary && !isDynamicLibrary) return; if (isBelowIndirectDynamicLib && privateDeps[dep.name]) return; var nextIsBelowIndirectDynamicLib = isBelowIndirectDynamicLib || isDynamicLibrary; dep.dependencies.forEach(function(depdep) { // If "dep" is an aggregate product, and "depdep" is one of the multiplexed variants // of the same product, we don't want to depend on the multiplexed variants, because // that could mean linking more than one time against the same library. Instead skip // the multiplexed dependency, and depend only on the aggregate one. if (depdep.name === dep.name) return; traverse(depdep, nextIsBelowIndirectDynamicLib, someDepConsumesObjects || !isObjectLibrary); }); if (isStaticLibrary || isObjectLibrary) { if (!isBelowIndirectDynamicLib) { if (isStaticLibrary || !someDepConsumesObjects) { addArtifactFilePaths(dep, isStaticLibrary ? "staticlibrary" : "objectlibrary", addPublicFilePath); } if (product.cpp.importPrivateLibraries) addExternalLibs(dep); publicDeps[dep.name] = true; } } else if (isDynamicLibrary) { if (!isBelowIndirectDynamicLib) { addArtifactFilePaths(dep, tagForLinkingAgainstSharedLib, addPublicFilePath); publicDeps[dep.name] = true; } else { addArtifactFilePaths(dep, tagForLinkingAgainstSharedLib, addPrivateFilePath); privateDeps[dep.name] = true; } } } function traverseDirectDependency(dep) { traverse(dep, false, false); } product.dependencies.forEach(traverseDirectDependency); addExternalLibs(product); var result = { libraries: [], rpath_link: [] }; objects.forEach( function (obj) { if (obj.direct) { result.libraries.push({ filePath: obj.filePath, wholeArchive: obj.wholeArchive, symbolLinkMode: obj.symbolLinkMode, framework: obj.framework }); } else { var dirPath = FileInfo.path(obj.filePath); result.rpath_link.push(dirPath); } }); return result; } function escapeLinkerFlags(product, inputs, linkerFlags) { if (!linkerFlags || linkerFlags.length === 0) return []; if (useCompilerDriverLinker(product, inputs)) { var sep = ","; var useXlinker = linkerFlags.some(function (f) { return f.includes(sep); }); if (useXlinker) { // One or more linker arguments contain the separator character itself // Use -Xlinker to handle these var xlinkerFlags = []; linkerFlags.map(function (linkerFlag) { if (product.cpp.enableSuspiciousLinkerFlagWarnings && linkerFlag.startsWith("-Wl,")) { console.warn("Encountered escaped linker flag '" + linkerFlag + "'. This may " + "cause the target to fail to link. Please do not escape these " + "flags manually; qbs does that for you."); } xlinkerFlags.push("-Xlinker", linkerFlag); }); return xlinkerFlags; } if (product.cpp.enableSuspiciousLinkerFlagWarnings && linkerFlags.includes("-Xlinker")) { console.warn("Encountered -Xlinker linker flag escape sequence. This may cause the " + "target to fail to link. Please do not escape these flags manually; " + "qbs does that for you."); } // If no linker arguments contain the separator character we can just use -Wl, // which is more compact and easier to read in logs return [["-Wl"].concat(linkerFlags).join(sep)]; } return linkerFlags; } function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPath) { var isDarwin = product.qbs.targetOS.includes("darwin"); var libraryDependencies = collectLibraryDependencies(product, isDarwin); var systemRunPaths = product.cpp.systemRunPaths || []; var canonicalSystemRunPaths = systemRunPaths.map(function(p) { return File.canonicalFilePath(p); }); var i, args = additionalCompilerAndLinkerFlags(product); var escapableLinkerFlags = []; if (primaryOutput.fileTags.includes("dynamiclibrary")) { if (isDarwin) { args.push((function () { var tags = ["c", "cpp", "cppm", "objc", "objcpp", "asm_cpp"]; for (var i = 0; i < tags.length; ++i) { if (linkerPath === product.cpp.compilerPathByLanguage[tags[i]]) return "-dynamiclib"; } return "-dylib"; // for ld64 })()); } else { args.push("-shared"); } if (isDarwin) { if (product.cpp.internalVersion) args.push("-current_version", product.cpp.internalVersion); escapableLinkerFlags.push("-install_name", UnixUtils.soname(product, primaryOutput.fileName)); } else if (product.cpp.imageFormat === "elf") { escapableLinkerFlags.push("-soname=" + UnixUtils.soname(product, primaryOutput.fileName)); } } if (primaryOutput.fileTags.includes("loadablemodule")) args.push(isDarwin ? "-bundle" : "-shared"); if (primaryOutput.fileTags.containsAny(["dynamiclibrary", "loadablemodule"])) { if (isDarwin) escapableLinkerFlags.push("-headerpad_max_install_names"); else if (product.cpp.imageFormat === "elf") escapableLinkerFlags.push("--as-needed"); } if (isLegacyQnxSdk(product)) { ["c", "cpp"].map(function (tag) { if (linkerPath === product.cpp.compilerPathByLanguage[tag]) args = args.concat(qnxLangArgs(product, tag)); }); } var targetLinkerFlags = product.cpp.targetLinkerFlags; if (targetLinkerFlags) Array.prototype.push.apply(escapableLinkerFlags, targetLinkerFlags); var sysroot = product.cpp.syslibroot; if (sysroot) { if (product.qbs.toolchain.includes("qcc")) escapableLinkerFlags.push("--sysroot=" + sysroot); else if (isDarwin) escapableLinkerFlags.push("-syslibroot", sysroot); else args.push("--sysroot=" + sysroot); // do not escape, compiler-as-linker also needs it } if (product.cpp.allowUnresolvedSymbols) { if (isDarwin) escapableLinkerFlags.push("-undefined", "suppress"); else escapableLinkerFlags.push("--unresolved-symbols=ignore-all"); } function fixupRPath(rpath) { // iOS, tvOS, watchOS, and others, are fine if (!product.qbs.targetOS.includes("macos")) return rpath; // ...as are newer versions of macOS var min = product.cpp.minimumMacosVersion; if (min && Utilities.versionCompare(min, "10.10") >= 0) return rpath; // In older versions of dyld, a trailing slash is required if (!rpath.endsWith("/")) return rpath + "/"; return rpath; } function isNotSystemRunPath(p) { return !FileInfo.isAbsolutePath(p) || (!systemRunPaths.includes(p) && !canonicalSystemRunPaths.includes(File.canonicalFilePath(p))); }; if (product.cpp.useRPathLink && !product.cpp.rpathLinkFlag) throw new Error("cpp.useRPathLink is enabled, but cpp.rpathLinkFlag is not defined"); if (!product.qbs.targetOS.includes("windows")) { var rpaths = product.cpp.useRPaths ? product.cpp.rpaths : undefined; for (i in rpaths) { if (isNotSystemRunPath(rpaths[i])) escapableLinkerFlags.push("-rpath", fixupRPath(rpaths[i])); } var rpathLinks = product.cpp.useRPathLink ? product.cpp.rpathLinkDirs : undefined; for (i in rpathLinks) escapableLinkerFlags.push("-rpath-link", rpathLinks[i]); } if (product.cpp.entryPoint) escapableLinkerFlags.push("-e", product.cpp.entryPoint); if (product.qbs.toolchain.includes("mingw")) { if (product.consoleApplication !== undefined) escapableLinkerFlags.push("-subsystem", product.consoleApplication ? "console" : "windows"); var minimumWindowsVersion = product.cpp.minimumWindowsVersion; if (minimumWindowsVersion) { // workaround for QBS-1724, mingw seems to be broken if (Utilities.versionCompare(minimumWindowsVersion, "6.2") > 0) minimumWindowsVersion = "6.2"; var subsystemVersion = WindowsUtils.getWindowsVersionInFormat(minimumWindowsVersion, 'subsystem'); if (subsystemVersion) { var major = subsystemVersion.split('.')[0]; var minor = subsystemVersion.split('.')[1]; // http://sourceware.org/binutils/docs/ld/Options.html escapableLinkerFlags.push("--major-subsystem-version", major, "--minor-subsystem-version", minor, "--major-os-version", major, "--minor-os-version", minor); } } } if (inputs.aggregate_infoplist) args.push("-sectcreate", "__TEXT", "__info_plist", inputs.aggregate_infoplist[0].filePath); var isLinkingCppObjects = !!(inputs.cpp_obj || inputs.cpp_staticlibrary); var stdlib = isLinkingCppObjects ? product.cpp.cxxStandardLibrary : undefined; if (stdlib && product.qbs.toolchain.includes("clang")) args.push("-stdlib=" + stdlib); // Flags for library search paths var allLibraryPaths = Cpp.collectLibraryPaths(product); var builtIns = product.cpp.compilerLibraryPaths allLibraryPaths = allLibraryPaths.filter(function(p) { return !builtIns.includes(p); }); args = args.concat(allLibraryPaths.map(function(path) { return product.cpp.libraryPathFlag + path })); escapableLinkerFlags = escapableLinkerFlags.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs)); var versionScripts = inputs.versionscript ? inputs.versionscript.map(function(a) { return a.filePath; }) : []; Array.prototype.push.apply(escapableLinkerFlags, [].uniqueConcat(versionScripts) .map(function(path) { return '--version-script=' + path })); if (isDarwin && product.cpp.warningLevel === "none") args.push('-w'); var useCompilerDriver = useCompilerDriverLinker(product, inputs); args = args.concat(configFlags(product, useCompilerDriver)); escapableLinkerFlags = escapableLinkerFlags.concat(Cpp.collectMiscEscapableLinkerArguments(product)); // Note: due to the QCC response files hack in prepareLinker(), at least one object file or // library file must follow the output file path so that QCC has something to process before // sending the rest of the arguments through the response file. args.push("-o", primaryOutput.filePath); args = args.concat(Cpp.collectLinkerObjectPaths(inputs)); args = args.concat(Cpp.collectResourceObjectPaths(inputs)); var wholeArchiveActive = false; var prevLib; for (i = 0; i < libraryDependencies.libraries.length; ++i) { var dep = libraryDependencies.libraries[i]; var lib = dep.filePath; if (lib === prevLib) continue; prevLib = lib; if (dep.wholeArchive && !wholeArchiveActive) { var wholeArchiveFlag; if (isDarwin) { wholeArchiveFlag = "-force_load"; } else { wholeArchiveFlag = "--whole-archive"; wholeArchiveActive = true; } Array.prototype.push.apply(args, escapeLinkerFlags(product, inputs, [wholeArchiveFlag])); } if (!dep.wholeArchive && wholeArchiveActive) { Array.prototype.push.apply(args, escapeLinkerFlags(product, inputs, ["--no-whole-archive"])); wholeArchiveActive = false; } var symbolLinkMode = dep.symbolLinkMode; if (isDarwin && symbolLinkMode) { if (!["lazy", "reexport", "upward", "weak"].includes(symbolLinkMode)) throw new Error("unknown value '" + symbolLinkMode + "' for cpp.symbolLinkMode"); } var supportsLazyMode = Utilities.versionCompare(product.cpp.compilerVersion, "15.0.0") < 0; if (isDarwin && symbolLinkMode && (symbolLinkMode !== "lazy" || supportsLazyMode)) { if (FileInfo.isAbsolutePath(lib) || lib.startsWith('@')) escapableLinkerFlags.push("-" + symbolLinkMode + "_library", lib); else if (dep.framework) escapableLinkerFlags.push("-" + symbolLinkMode + "_framework", lib); else escapableLinkerFlags.push("-" + symbolLinkMode + "-l" + lib); } else if (FileInfo.isAbsolutePath(lib) || lib.startsWith('@')) { args.push(dep.framework ? PathTools.frameworkExecutablePath(lib) : lib); } else if (dep.framework) { args.push("-framework", lib); } else { args.push('-l' + lib); } } if (wholeArchiveActive) { Array.prototype.push.apply(args, escapeLinkerFlags(product, inputs, ["--no-whole-archive"])); } var discardUnusedData = product.cpp.discardUnusedData; if (discardUnusedData !== undefined) { var flags = []; if (discardUnusedData === true) { if (isDarwin) escapableLinkerFlags.push("-dead_strip"); else escapableLinkerFlags.push("--gc-sections"); } else if (!isDarwin) { escapableLinkerFlags.push("--no-gc-sections"); } } if (product.cpp.useRPathLink) { Array.prototype.push.apply(escapableLinkerFlags, libraryDependencies.rpath_link.map( function(dir) { return product.cpp.rpathLinkFlag + dir; })); } var importLibs = outputs.dynamiclibrary_import; if (importLibs) escapableLinkerFlags.push("--out-implib", importLibs[0].filePath); if (outputs.application && product.cpp.generateLinkerMapFile) { if (isDarwin) escapableLinkerFlags.push("-map", outputs.mem_map[0].filePath); else escapableLinkerFlags.push("-Map=" + outputs.mem_map[0].filePath); } var escapedLinkerFlags = escapeLinkerFlags(product, inputs, escapableLinkerFlags); Array.prototype.push.apply(escapedLinkerFlags, args); if (useCompilerDriver) escapedLinkerFlags = escapedLinkerFlags.concat(Cpp.collectMiscLinkerArguments(product)); if (product.qbs.toolchain.includes("mingw") && product.cpp.runtimeLibrary === "static") escapedLinkerFlags = ['-static-libgcc', '-static-libstdc++'].concat(escapedLinkerFlags); return escapedLinkerFlags; } // for compiler AND linker function configFlags(config, isDriver) { var args = []; if (isDriver !== false) args = args.concat(Cpp.collectMiscDriverArguments(config)); var frameworkPaths = config.cpp.frameworkPaths; if (frameworkPaths) args = args.uniqueConcat(frameworkPaths.map(function(path) { return '-F' + path })); var allSystemFrameworkPaths = []; var systemFrameworkPaths = config.cpp.systemFrameworkPaths; if (systemFrameworkPaths) allSystemFrameworkPaths = allSystemFrameworkPaths.uniqueConcat(systemFrameworkPaths); var distributionFrameworkPaths = config.cpp.distributionFrameworkPaths; if (distributionFrameworkPaths) allSystemFrameworkPaths = allSystemFrameworkPaths.uniqueConcat(distributionFrameworkPaths); args = args.concat(allSystemFrameworkPaths.map(function(path) { return '-iframework' + path })); return args; } function languageTagFromFileExtension(toolchain, fileName) { var i = fileName.lastIndexOf('.'); if (i === -1) return; var m = { "c" : "c", "C" : "cpp", "cpp" : "cpp", "cxx" : "cpp", "c++" : "cpp", "cc" : "cpp", "m" : "objc", "mm" : "objcpp", "s" : "asm", "S" : "asm_cpp" }; if (!toolchain.includes("clang")) m["sx"] = "asm_cpp"; // clang does NOT recognize .sx else m["cppm"] = "cppm"; return m[fileName.substring(i + 1)]; } // Older versions of the QNX SDK have C and C++ compilers whose filenames differ only by case, // which won't work in case insensitive environments like Win32+NTFS, HFS+ and APFS function isLegacyQnxSdk(config) { return config.qbs.toolchain.includes("qcc") && config.qnx && !config.qnx.qnx7; } function effectiveCompilerInfo(toolchain, input, output) { var compilerPath, language; var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags)); // Whether we're compiling a precompiled header or normal source file var pchOutput = output.fileTags.includes(tag + "_pch"); var compilerPathByLanguage = input.cpp.compilerPathByLanguage; if (compilerPathByLanguage) compilerPath = compilerPathByLanguage[tag]; if (!compilerPath || tag !== languageTagFromFileExtension(toolchain, input.fileName) || isLegacyQnxSdk(input)) { if (input.qbs.toolchain.includes("qcc")) language = qnxLangArgs(input, tag); else language = ["-x", languageName(tag) + (pchOutput ? '-header' : '')]; } if (!compilerPath) // fall back to main compiler compilerPath = input.cpp.compilerPath; return { path: compilerPath, language: language, tag: tag }; } function qnxLangArgs(config, tag) { switch (tag) { case "c": return ["-lang-c"]; case "cpp": return ["-lang-c++"]; default: return []; } } function handleCpuFeatures(input, flags) { function potentiallyAddFlagForFeature(propName, flagName) { var propValue = input.cpufeatures[propName]; if (propValue === true) flags.push("-m" + flagName); else if (propValue === false) flags.push("-mno-" + flagName); } if (!input.qbs.architecture) return; if (input.qbs.architecture.startsWith("x86")) { potentiallyAddFlagForFeature("x86_avx", "avx"); potentiallyAddFlagForFeature("x86_avx2", "avx2"); potentiallyAddFlagForFeature("x86_avx512bw", "avx512bw"); potentiallyAddFlagForFeature("x86_avx512cd", "avx512cd"); potentiallyAddFlagForFeature("x86_avx512dq", "avx512dq"); potentiallyAddFlagForFeature("x86_avx512er", "avx512er"); potentiallyAddFlagForFeature("x86_avx512f", "avx512f"); potentiallyAddFlagForFeature("x86_avx512ifma", "avx512ifma"); potentiallyAddFlagForFeature("x86_avx512pf", "avx512pf"); potentiallyAddFlagForFeature("x86_avx512vbmi", "avx512vbmi"); potentiallyAddFlagForFeature("x86_avx512vl", "avx512vl"); potentiallyAddFlagForFeature("x86_f16c", "f16c"); potentiallyAddFlagForFeature("x86_sse2", "sse2"); potentiallyAddFlagForFeature("x86_sse3", "sse3"); potentiallyAddFlagForFeature("x86_sse4_1", "sse4.1"); potentiallyAddFlagForFeature("x86_sse4_2", "sse4.2"); potentiallyAddFlagForFeature("x86_ssse3", "ssse3"); } else if (input.qbs.architecture.startsWith("arm")) { if (input.cpufeatures.arm_neon === true) flags.push("-mfpu=neon"); if (input.cpufeatures.arm_vfpv4 === true) flags.push("-mfpu=vfpv4"); } else if (input.qbs.architecture.startsWith("mips")) { potentiallyAddFlagForFeature("mips_dsp", "dsp"); potentiallyAddFlagForFeature("mips_dspr2", "dspr2"); } } function standardFallbackValueOrDefault(toolchain, compilerVersion, languageVersion, useLanguageVersionFallback) { // NEVER use the fallback values (safety brake for users in case our version map is ever wrong) if (useLanguageVersionFallback === false) return languageVersion; // Deprecated, but compatible with older compiler versions. // Note that these versions are the first to support the *value* to the -std= command line // option, not necessarily the first versions where support for that language standard was // considered fully implemented. Tested manually. var languageVersionsMap = { "c++11": { "fallback": "c++0x", "toolchains": [ {"name": "xcode", "version": "4.3"}, {"name": "clang", "version": "3.0"}, {"name": "gcc", "version": "4.7"} ] }, "c11": { "fallback": "c1x", "toolchains": [ {"name": "xcode", "version": "5.0"}, {"name": "clang", "version": "3.1"}, {"name": "gcc", "version": "4.7"} ] }, "c17": { "fallback": "c11", "toolchains": [ {"name": "xcode", "version": "10.2"}, {"name": "clang", "version": "7.0"}, {"name": "gcc", "version": "8.1"} ] }, "c2x": { "fallback": "c17", "toolchains": [ {"name": "xcode", "version": "11.4"}, {"name": "clang", "version": "9.0"}, {"name": "gcc", "version": "9.0"} ] }, "c++14": { "fallback": "c++1y", "toolchains": [ {"name": "xcode", "version": "6.3"}, {"name": "clang", "version": "3.5"}, {"name": "gcc", "version": "4.9"} ] }, "c++17": { "fallback": "c++1z", "toolchains": [ {"name": "xcode", "version": "9.3"}, {"name": "clang", "version": "5.0"}, {"name": "gcc", "version": "5.1"} ] }, "c++20": { "fallback": "c++2a", "toolchains": [ {"name": "xcode", "version": "12.5"}, {"name": "clang", "version": "11.0"}, {"name": "gcc", "version": "10.1"} ] }, "c++23": { "fallback": "c++2b", "toolchains": [ {"name": "xcode", "version": "15.0"}, {"name": "clang", "version": "13.0"}, {"name": "gcc", "version": "11.1"} ] }, "c++26": { "fallback": "c++2c", "toolchains": [ {"name": "xcode", "version": "17.0"}, {"name": "clang", "version": "19.0"}, {"name": "gcc", "version": "15.1"} ] } }; var m = languageVersionsMap[languageVersion]; if (m) { for (var idx = 0; idx < m.toolchains.length; ++idx) { var tc = m.toolchains[idx]; if (toolchain.includes(tc.name)) { // If we found our toolchain and it doesn't yet support the language standard // we're requesting, or we're using an older version that only supports the // preliminary flag, use that. if (useLanguageVersionFallback || !tc.version || Utilities.versionCompare(compilerVersion, tc.version) < 0) return m.fallback; break; } } } // If we didn't find our toolchain at all, simply use the standard value. return languageVersion; } function compilerFlags(project, product, outputs, input, output, explicitlyDependsOn) { var i; // Determine which C-language we're compiling var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags)); if (!["c", "cpp", "cppm", "objc", "objcpp", "asm_cpp"].includes(tag)) throw ("unsupported source language: " + tag); var compilerInfo = effectiveCompilerInfo(product.qbs.toolchain, input, output); var args = additionalCompilerAndLinkerFlags(product); Array.prototype.push.apply(args, product.cpp.sysrootFlags); handleCpuFeatures(input, args); if (input.cpp.debugInformation) args.push('-g'); var opt = input.cpp.optimization if (opt === 'fast') args.push('-O2'); if (opt === 'small') args.push('-Os'); if (opt === 'none') args.push('-O0'); if (input.cpp.forceUseCxxModules) { if (!product.qbs.toolchain.includes("clang")) args.push('-fmodules-ts') } var warnings = input.cpp.warningLevel if (warnings === 'none') args.push('-w'); if (warnings === 'all') { args.push('-Wall'); args.push('-Wextra'); } if (input.cpp.treatWarningsAsErrors) args.push('-Werror'); var moduleMap = (outputs["modulemap"] || [])[0]; if (moduleMap) { const moduleMapperFlag = product.qbs.toolchain.includes("clang") ? "@" // clang uses response file with the list of flags : "-fmodule-mapper="; // gcc uses file with special syntax args.push(moduleMapperFlag + moduleMap.filePath); } args = args.concat(configFlags(input)); if (!input.qbs.toolchain.includes("qcc")) args.push('-pipe'); if (input.cpp.enableReproducibleBuilds) { var toolchain = product.qbs.toolchain; if (!toolchain.includes("clang")) { var hashString = FileInfo.relativePath(project.sourceDirectory, input.filePath); var hash = Utilities.getHash(hashString); args.push("-frandom-seed=0x" + hash.substring(0, 8)); } var major = product.cpp.compilerVersionMajor; var minor = product.cpp.compilerVersionMinor; if ((toolchain.includes("clang") && (major > 3 || (major === 3 && minor >= 5))) || (toolchain.includes("gcc") && (major > 4 || (major === 4 && minor >= 9)))) { args.push("-Wdate-time"); } } var useArc = input.cpp.automaticReferenceCounting; if (useArc !== undefined && (tag === "objc" || tag === "objcpp")) { args.push(useArc ? "-fobjc-arc" : "-fno-objc-arc"); } var enableExceptions = input.cpp.enableExceptions; if (enableExceptions !== undefined) { if (tag === "cpp" || tag === "objcpp" || tag === "cppm") args.push(enableExceptions ? "-fexceptions" : "-fno-exceptions"); if (tag === "objc" || tag === "objcpp") { args.push(enableExceptions ? "-fobjc-exceptions" : "-fno-objc-exceptions"); if (useArc !== undefined) args.push(useArc ? "-fobjc-arc-exceptions" : "-fno-objc-arc-exceptions"); } } var enableRtti = input.cpp.enableRtti; if (enableRtti !== undefined && (tag === "cpp" || tag === "objcpp" || tag === "cppm")) { args.push(enableRtti ? "-frtti" : "-fno-rtti"); } var visibility = input.cpp.visibility; if (!product.qbs.toolchain.includes("mingw")) { if (visibility === 'hidden' || visibility === 'minimal') args.push('-fvisibility=hidden'); if ((visibility === 'hiddenInlines' || visibility === 'minimal') && tag === 'cpp') args.push('-fvisibility-inlines-hidden'); if (visibility === 'default') args.push('-fvisibility=default') } if (compilerInfo.language) // Only push language arguments if we have to. Array.prototype.push.apply(args, compilerInfo.language); args = args.concat(Cpp.collectMiscCompilerArguments(input, tag)); var pchTag = compilerInfo.tag + "_pch"; var pchOutput = output.fileTags.includes(pchTag); var pchInputs = explicitlyDependsOn[pchTag]; if (!pchOutput && pchInputs && pchInputs.length === 1 && ModUtils.moduleProperty(input, 'usePrecompiledHeader', tag)) { var pchInput = pchInputs[0]; if (input.qbs.toolchain.includes("clang")) { args.push("-include-pch", pchInput.filePath); } else { var pchFilePath = FileInfo.joinPaths(FileInfo.path(pchInput.filePath), pchInput.completeBaseName); args.push(input.cpp.preincludeFlag, pchFilePath); } } args = args.concat(Cpp.collectPreincludePathsArguments(input)); var positionIndependentCode = input.cpp.positionIndependentCode; if (positionIndependentCode && !product.qbs.targetOS.includes("windows")) args.push('-fPIC'); var cppFlags = input.cpp.cppFlags; for (i in cppFlags) args.push('-Wp,' + cppFlags[i]) args = args.concat(Cpp.collectDefinesArguments(input)); args = args.concat(Cpp.collectIncludePathsArguments(input)); args = args.concat(Cpp.collectSystemIncludePathsArguments(input)); var minimumWindowsVersion = input.cpp.minimumWindowsVersion; if (minimumWindowsVersion && product.qbs.targetOS.includes("windows")) { var hexVersion = WindowsUtils.getWindowsVersionInFormat(minimumWindowsVersion, 'hex'); if (hexVersion) { var versionDefs = [ 'WINVER', '_WIN32_WINNT', '_WIN32_WINDOWS' ]; for (i in versionDefs) args.push(input.cpp.defineFlag + versionDefs[i] + '=' + hexVersion); } } function currentLanguageVersion(tag) { switch (tag) { case "c": case "objc": var knownValues = ["c2x", "c17", "c11", "c99", "c90", "c89"]; return Cpp.languageVersion(input.cpp.cLanguageVersion, knownValues, "C"); case "cpp": case "cppm": case "objcpp": knownValues = ["c++26", "c++2c", "c++23", "c++2b", "c++20", "c++2a", "c++17", "c++1z", "c++14", "c++1y", "c++11", "c++0x", "c++03", "c++98"]; return Cpp.languageVersion(input.cpp.cxxLanguageVersion, knownValues, "C++"); } } var langVersion = currentLanguageVersion(tag); if (langVersion) { args.push("-std=" + standardFallbackValueOrDefault(product.qbs.toolchain, product.cpp.compilerVersion, langVersion, product.cpp.useLanguageVersionFallback)); } if (tag === "cpp" || tag === "objcpp" || tag === "cppm") { var cxxStandardLibrary = product.cpp.cxxStandardLibrary; if (cxxStandardLibrary && product.qbs.toolchain.includes("clang")) { args.push("-stdlib=" + cxxStandardLibrary); } } args.push("-o", output.filePath); args.push("-c", input.filePath); return args; } function additionalCompilerAndLinkerFlags(product) { var args = [] var requireAppExtensionSafeApi = product.cpp.requireAppExtensionSafeApi; if (requireAppExtensionSafeApi !== undefined && product.qbs.targetOS.includes("darwin")) { args.push(requireAppExtensionSafeApi ? "-fapplication-extension" : "-fno-application-extension"); } return args } // Returns the GCC language name equivalent to fileTag, accepted by the -x argument function languageName(fileTag) { if (fileTag === 'c') return 'c'; else if (fileTag === 'cpp') return 'c++'; else if (fileTag === 'cppm') return 'c++'; else if (fileTag === 'objc') return 'objective-c'; else if (fileTag === 'objcpp') return 'objective-c++'; else if (fileTag === 'asm') return 'assembler'; else if (fileTag === 'asm_cpp') return 'assembler-with-cpp'; } function prepareAssembler(project, product, inputs, outputs, input, output) { var assemblerPath = product.cpp.assemblerPath; var args = product.cpp.targetAssemblerFlags; if (input.cpp.debugInformation) args.push('-g'); var warnings = input.cpp.warningLevel if (warnings === 'none') args.push('-W'); args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm")); args = args.concat(Cpp.collectIncludePathsArguments(input)); args = args.concat(Cpp.collectSystemIncludePathsArguments(input, input.cpp.includeFlag)); args.push("-o", output.filePath); args.push(input.filePath); var cmd = new Command(assemblerPath, args); cmd.description = "assembling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "assembler"; return cmd; } function compilerEnvVars(config, compilerInfo) { if (config.qbs.toolchain.includes("qcc")) return ["QCC_CONF_PATH"]; var list = ["CPATH", "TMPDIR"]; if (compilerInfo.tag === "c") list.push("C_INCLUDE_PATH"); else if (compilerInfo.tag === "cpp") list.push("CPLUS_INCLUDE_PATH"); else if (compilerInfo.tag === "cppm") list.push("CPLUS_INCLUDE_PATH"); else if (compilerInfo.tag === "objc") list.push("OBJC_INCLUDE_PATH"); else if (compilerInfo.tag === "objccpp") list.push("OBJCPLUS_INCLUDE_PATH"); if (config.qbs.targetOS.includes("macos")) list.push("MACOSX_DEPLOYMENT_TARGET"); else if (config.qbs.targetOS.includes("ios")) list.push("IPHONEOS_DEPLOYMENT_TARGET"); else if (config.qbs.targetOS.includes("tvos")) list.push("TVOS_DEPLOYMENT_TARGET"); else if (config.qbs.targetOS.includes("watchos")) list.push("WATCHOS_DEPLOYMENT_TARGET"); if (config.qbs.toolchain.includes("clang")) { list.push("TEMP", "TMP"); } else { list.push("LANG", "LC_CTYPE", "LC_MESSAGES", "LC_ALL", "GCC_COMPARE_DEBUG", "GCC_EXEC_PREFIX", "COMPILER_PATH", "SOURCE_DATE_EPOCH"); } return list; } function linkerEnvVars(config, inputs) { if (config.qbs.toolchain.includes("clang") || config.qbs.toolchain.includes("qcc")) return []; var list = ["GNUTARGET", "LDEMULATION", "COLLECT_NO_DEMANGLE"]; if (useCompilerDriverLinker(config, inputs)) list.push("LIBRARY_PATH"); return list; } function setResponseFileThreshold(command, product) { if (Host.os().includes("windows")) command.responseFileThreshold = 8000; } function prepareCompilerInternal(project, product, inputs, outputs, input, output_, explicitlyDependsOn) { var output = output_ || outputs["obj"][0]; var compilerInfo = effectiveCompilerInfo(product.qbs.toolchain, input, output); var compilerPath = compilerInfo.path; var pchOutput = output.fileTags.includes(compilerInfo.tag + "_pch"); var args = compilerFlags(project, product, outputs, input, output, explicitlyDependsOn); var wrapperArgsLength = 0; var wrapperArgs = product.cpp.compilerWrapper; var extraEnv; if (wrapperArgs && wrapperArgs.length > 0) { // distcc cannot deal with absolute compiler paths (QBS-1336). for (var i = 0; i < wrapperArgs.length; ++i) { if (FileInfo.baseName(wrapperArgs[i]) !== "distcc") continue; if (i === wrapperArgs.length - 1) { if (FileInfo.isAbsolutePath(compilerPath)) { extraEnv = ["PATH=" + FileInfo.path(compilerPath)]; compilerPath = FileInfo.fileName(compilerPath); } } else if (FileInfo.isAbsolutePath(wrapperArgs[i + 1])) { extraEnv = ["PATH=" + FileInfo.path(FileInfo.path(wrapperArgs[i + 1]))]; wrapperArgs[i + 1] = FileInfo.fileName(wrapperArgs[i + 1]); } break; } wrapperArgsLength = wrapperArgs.length; args.unshift(compilerPath); compilerPath = wrapperArgs.shift(); args = wrapperArgs.concat(args); } var cmd = new Command(compilerPath, args); cmd.description = (pchOutput ? 'pre' : '') + 'compiling ' + input.fileName; if (pchOutput) cmd.description += ' (' + compilerInfo.tag + ')'; cmd.highlight = "compiler"; cmd.jobPool = "compiler"; cmd.relevantEnvironmentVariables = compilerEnvVars(input, compilerInfo); if (extraEnv) cmd.environment = extraEnv; cmd.responseFileArgumentIndex = wrapperArgsLength; cmd.responseFileUsagePrefix = '@'; setResponseFileThreshold(cmd, product); return cmd; } function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var result = Cpp.prepareModules(project, product, inputs, outputs, input, output); result = result.concat(prepareCompilerInternal( project, product, inputs, outputs, input, output, explicitlyDependsOn)); return result; } // Concatenates two arrays of library names and preserves the dependency order that ld needs. function concatLibs(libs, deplibs) { var r = []; var s = {}; function addLibs(lst) { for (var i = lst.length; --i >= 0;) { var lib = lst[i]; if (!s[lib]) { s[lib] = true; r.unshift(lib); } } } addLibs(deplibs); addLibs(libs); return r; } function collectStdoutLines(command, args) { var p = new Process(); try { p.exec(command, args); return p.readStdOut().split(/\r?\n/g).filter(function (e) { return e; }); } finally { p.close(); } } function getSymbolInfo(product, inputFile) { var result = { }; var command = product.cpp.nmPath; var args = ["-g", "-P"]; if (product.cpp._nmHasDynamicOption) args.push("-D"); try { result.allGlobalSymbols = collectStdoutLines(command, args.concat(inputFile)); // GNU nm has the "--defined" option but POSIX nm does not, so we have to manually // construct the list of defined symbols by subtracting. var undefinedGlobalSymbols = collectStdoutLines(command, args.concat(["-u", inputFile])); result.definedGlobalSymbols = result.allGlobalSymbols.filter(function(line) { return !undefinedGlobalSymbols.includes(line); }); result.success = true; } catch (e) { console.debug("Failed to collect symbols for shared library: nm command '" + command + "' failed (" + e.toString() + ")"); result.success = false; } return result; } function createSymbolFile(filePath, allSymbols, definedSymbols) { var file; try { file = new TextFile(filePath, TextFile.WriteOnly); for (var lineNr in allSymbols) file.writeLine(allSymbols[lineNr]); file.writeLine("==="); for (lineNr in definedSymbols) file.writeLine(definedSymbols[lineNr]); } finally { if (file) file.close(); } } function readSymbolFile(filePath) { var result = { success: true, allGlobalSymbols: [], definedGlobalSymbols: [] }; var file; try { file = new TextFile(filePath, TextFile.ReadOnly); var prop = "allGlobalSymbols"; while (true) { var line = file.readLine(); if (!line) break; if (line === "===") { prop = "definedGlobalSymbols"; continue; } result[prop].push(line); } } catch (e) { console.debug("Failed to read symbols from '" + filePath + "'"); result.success = false; } finally { if (file) file.close(); } return result; } function createSymbolCheckingCommands(product, outputs) { var commands = []; if (!outputs.dynamiclibrary || !outputs.dynamiclibrary_symbols) return commands; if (outputs.dynamiclibrary.length !== outputs.dynamiclibrary_symbols.length) throw new Error("The number of outputs tagged dynamiclibrary (" + outputs.dynamiclibrary.length + ") must be equal to the number of " + "outputs tagged dynamiclibrary_symbols (" + outputs.dynamiclibrary_symbols.length + ")"); for (var d = 0; d < outputs.dynamiclibrary_symbols.length; ++d) { // Update the symbols file if the list of relevant symbols has changed. var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.d = d; cmd.sourceCode = function() { if (outputs.dynamiclibrary[d].qbs.buildVariant !== outputs.dynamiclibrary_symbols[d].qbs.buildVariant) throw new Error("Build variant of output tagged dynamiclibrary (" + outputs.dynamiclibrary[d].qbs.buildVariant + ") is not equal to " + "build variant of output tagged dynamiclibrary_symbols (" + outputs.dynamiclibrary_symbols[d].qbs.buildVariant + ") at index " + d); var libFilePath = outputs.dynamiclibrary[d].filePath; var symbolFilePath = outputs.dynamiclibrary_symbols[d].filePath; var newNmResult = getSymbolInfo(product, libFilePath); if (!newNmResult.success) return; if (!File.exists(symbolFilePath)) { console.debug("Symbol file '" + symbolFilePath + "' does not yet exist."); createSymbolFile(symbolFilePath, newNmResult.allGlobalSymbols, newNmResult.definedGlobalSymbols); return; } var oldNmResult = readSymbolFile(symbolFilePath); var checkMode = product.cpp.exportedSymbolsCheckMode; var oldSymbols; var newSymbols; if (checkMode === "strict") { oldSymbols = oldNmResult.allGlobalSymbols; newSymbols = newNmResult.allGlobalSymbols; } else { var weakFilter = function(line) { var symbolType = line.split(/\s+/)[1]; return symbolType != "v" && symbolType != "V" && symbolType != "w" && symbolType != "W"; }; oldSymbols = oldNmResult.definedGlobalSymbols.filter(weakFilter); newSymbols = newNmResult.definedGlobalSymbols.filter(weakFilter); } if (oldSymbols.length !== newSymbols.length) { console.debug("List of relevant symbols differs for '" + libFilePath + "'."); createSymbolFile(symbolFilePath, newNmResult.allGlobalSymbols, newNmResult.definedGlobalSymbols); return; } for (var i = 0; i < oldSymbols.length; ++i) { var oldLine = oldSymbols[i]; var newLine = newSymbols[i]; var oldLineElems = oldLine.split(/\s+/); var newLineElems = newLine.split(/\s+/); if (oldLineElems[0] !== newLineElems[0] // Object name. || oldLineElems[1] !== newLineElems[1]) { // Object type console.debug("List of relevant symbols differs for '" + libFilePath + "'."); createSymbolFile(symbolFilePath, newNmResult.allGlobalSymbols, newNmResult.definedGlobalSymbols); return; } } } commands.push(cmd); } return commands; } function separateDebugInfoCommands(product, outputs, primaryOutput) { var commands = []; var debugInfo = outputs.debuginfo_app || outputs.debuginfo_dll || outputs.debuginfo_loadablemodule; if (debugInfo && !product.qbs.toolchain.includes("emscripten")) { var objcopy = product.cpp.objcopyPath; var cmd = new Command(objcopy, ["--only-keep-debug", primaryOutput.filePath, debugInfo[0].filePath]); cmd.silent = true; commands.push(cmd); cmd = new Command(objcopy, ["--strip-debug", primaryOutput.filePath]); cmd.silent = true; commands.push(cmd); cmd = new Command(objcopy, ["--add-gnu-debuglink=" + debugInfo[0].filePath, primaryOutput.filePath]); cmd.silent = true; commands.push(cmd); } return commands; } function separateDebugInfoCommandsDarwin(product, outputs, primaryOutputs) { var commands = []; var debugInfo = outputs.debuginfo_app || outputs.debuginfo_dll || outputs.debuginfo_loadablemodule; if (debugInfo) { var dsymPath = debugInfo[0].filePath; if (outputs.debuginfo_bundle && outputs.debuginfo_bundle[0]) dsymPath = outputs.debuginfo_bundle[0].filePath; var flags = product.cpp.dsymutilFlags || []; var files = primaryOutputs.map(function (f) { return f.filePath; }); var cmd = new Command(product.cpp.dsymutilPath, flags.concat(["-o", dsymPath].concat(files))); cmd.description = "generating dSYM for " + product.name; commands.push(cmd); // strip debug info cmd = new Command(product.cpp.stripPath, ["-S"].concat(files)); cmd.silent = true; commands.push(cmd); } return commands; } function librarySymlinkArtifacts(product, buildVariantSuffix) { var artifacts = []; if (product.cpp.shouldCreateSymlinks && (!product.bundle || !product.bundle.isBundle)) { var maxVersionParts = product.cpp.internalVersion ? 3 : 1; var primaryFileName = PathTools.dynamicLibraryFilePath(product, buildVariantSuffix, undefined); for (var i = 0; i < maxVersionParts; ++i) { var symlink = { filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.dynamicLibraryFilePath( product, buildVariantSuffix, undefined, i)), fileTags: ["dynamiclibrary_symlink"], cpp: { primaryFileName: primaryFileName } }; if (i > 0 && artifacts[i-1].filePath == symlink.filePath) break; // Version number has less than three components. artifacts.push(symlink); } } return artifacts; } function librarySymlinkCommands(outputs, primaryOutput) { var commands = []; // Create symlinks from {libfoo, libfoo.1, libfoo.1.0} to libfoo.1.0.0 var links = outputs["dynamiclibrary_symlink"]; var symlinkCount = links ? links.length : 0; for (i = 0; i < symlinkCount; ++i) { var cmd = new Command("ln", ["-sf", links[i].cpp.primaryFileName, links[i].filePath]); cmd.highlight = "filegen"; cmd.description = "creating symbolic link '" + links[i].fileName + "'"; cmd.workingDirectory = FileInfo.path(primaryOutput.filePath); commands.push(cmd); } return commands; } function prepareLinker(project, product, inputs, outputs, input, output) { var i, primaryOutput, cmd, commands = []; if (outputs.application) { primaryOutput = outputs.application[0]; } else if (outputs.dynamiclibrary) { primaryOutput = outputs.dynamiclibrary[0]; } else if (outputs.loadablemodule) { primaryOutput = outputs.loadablemodule[0]; } var linkerPath = effectiveLinkerPath(product, inputs) var args = linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPath); var wrapperArgsLength = 0; var wrapperArgs = product.cpp.linkerWrapper; if (wrapperArgs && wrapperArgs.length > 0) { wrapperArgsLength = wrapperArgs.length; args.unshift(linkerPath); linkerPath = wrapperArgs.shift(); args = wrapperArgs.concat(args); } var responseFileArgumentIndex = wrapperArgsLength; // qcc doesn't properly handle response files, so we have to do it manually var useQnxResponseFileHack = product.qbs.toolchain.includes("qcc") && useCompilerDriverLinker(product, inputs); if (useQnxResponseFileHack) { // qcc needs to see at least one object/library file to think it has something to do, // so start the response file at the second object file (so, 3 after the last -o option) var idx = args.lastIndexOf("-o"); if (idx !== -1 && idx + 3 < args.length) responseFileArgumentIndex += idx + 3; } cmd = new Command(linkerPath, args); cmd.description = 'linking ' + primaryOutput.fileName; cmd.highlight = 'linker'; cmd.jobPool = "linker"; cmd.relevantEnvironmentVariables = linkerEnvVars(product, inputs); cmd.responseFileArgumentIndex = responseFileArgumentIndex; cmd.responseFileUsagePrefix = useQnxResponseFileHack ? "-Wl,@" : "@"; setResponseFileThreshold(cmd, product); commands.push(cmd); if (product.qbs.toolchain.includes("emscripten") && outputs.application && product.cpp.separateDebugInformation) { args.push("-gseparate-dwarf"); } else if (product.qbs.targetOS.includes("darwin")) { if (!product.aggregate) { commands = commands.concat(separateDebugInfoCommandsDarwin( product, outputs, [primaryOutput])); } } else { commands = commands.concat(separateDebugInfoCommands(product, outputs, primaryOutput)); } if (outputs.dynamiclibrary) { Array.prototype.push.apply(commands, createSymbolCheckingCommands(product, outputs)); Array.prototype.push.apply(commands, librarySymlinkCommands(outputs, primaryOutput)); } if (product.cpp.shouldSignArtifacts) { Array.prototype.push.apply( commands, Codesign.prepareSign(project, product, inputs, outputs, input, output)); } return commands; } function debugInfoArtifacts(product, variants, debugInfoTagSuffix) { var fileTag; switch (debugInfoTagSuffix) { case "app": fileTag = "application"; break; case "dll": fileTag = "dynamiclibrary"; break; default: fileTag = debugInfoTagSuffix; break; } variants = variants || [{}]; var artifacts = []; var separateDebugInfo = product.cpp.separateDebugInformation; if (separateDebugInfo && product.qbs.toolchain.includes("emscripten")) separateDebugInfo = fileTag === "application"; if (separateDebugInfo) { variants.map(function (variant) { artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.debugInfoFilePath(product, variant.suffix, fileTag)), fileTags: ["debuginfo_" + debugInfoTagSuffix] }); }); if (PathTools.debugInfoIsBundle(product)) { artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.debugInfoBundlePath(product, fileTag)), fileTags: ["debuginfo_bundle"] }); artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.debugInfoPlistFilePath(product, fileTag)), fileTags: ["debuginfo_plist"] }); } } return artifacts; } function dumpMacros(env, compilerFilePath, args, nullDevice, tag) { var p = new Process(); try { p.setEnv("LC_ALL", "C"); for (var key in env) p.setEnv(key, env[key]); // qcc NEEDS the explicit -Wp, prefix to -dM; clang and gcc do not but all three accept it p.exec(compilerFilePath, (args || []).concat(["-Wp,-dM", "-E", "-x", languageName(tag || "c") , nullDevice]), true); return Cpp.extractMacros(p.readStdOut()); } finally { p.close(); } } function dumpDefaultPaths(env, compilerFilePath, args, nullDevice, pathListSeparator, sysroot, targetOS) { var p = new Process(); try { p.setEnv("LC_ALL", "C"); for (var key in env) p.setEnv(key, env[key]); args = args || []; p.exec(compilerFilePath, args.concat(["-v", "-E", "-x", "c++", nullDevice]), true); var suffix = " (framework directory)"; var includePaths = []; var libraryPaths = []; var frameworkPaths = []; var addIncludes = false; var lines = p.readStdErr().trim().split(/\r?\n/g).map(function (line) { return line.trim(); }); for (var i = 0; i < lines.length; ++i) { var line = lines[i]; var prefix = "LIBRARY_PATH="; if (line.startsWith(prefix)) { libraryPaths = libraryPaths.concat(line.substr(prefix.length) .split(pathListSeparator)); } else if (line === "#include <...> search starts here:") { addIncludes = true; } else if (line === "End of search list.") { addIncludes = false; } else if (addIncludes) { if (line.endsWith(suffix)) frameworkPaths.push(line.substr(0, line.length - suffix.length)); else includePaths.push(line); } } sysroot = sysroot || ""; if (includePaths.length === 0) includePaths.push(sysroot + "/usr/include", sysroot + "/usr/local/include"); if (libraryPaths.length === 0) libraryPaths.push(sysroot + "/lib", sysroot + "/usr/lib"); if (frameworkPaths.length === 0 && targetOS.includes("darwin")) frameworkPaths.push(sysroot + "/System/Library/Frameworks"); return { "includePaths": includePaths, "libraryPaths": libraryPaths, "frameworkPaths": frameworkPaths }; } finally { p.close(); } } function targetLinkerFlags(targetArch, targetOS) { var linkerFlags = { "windows": { "i386": "i386pe", "x86_64": "i386pep", }, "freebsd": { "i386": "elf_i386_fbsd", "x86_64": "elf_x86_64_fbsd", }, "other": { "i386": "elf_i386", "x86_64": "elf_x86_64", } }; if (targetOS.includes("windows")) return linkerFlags["windows"][targetArch]; else if (targetOS.includes("freebsd")) return linkerFlags["freebsd"][targetArch]; return linkerFlags["other"][targetArch]; } function targetFlags(tool, hasTargetOption, target, targetArch, machineType, targetOS) { var args = []; if (hasTargetOption) { if (target) args.push("-target", target); } else { var archArgs = { "compiler": { "i386": ["-m32"], "x86_64": ["-m64"], }, "linker": { "i386": ["-m", targetLinkerFlags("i386", targetOS)], "x86_64": ["-m", targetLinkerFlags("x86_64", targetOS)], }, "assembler": { "i386": ["--32"], "x86_64": ["--64"], }, }; var flags = archArgs[tool] ? archArgs[tool][targetArch] : undefined; if (flags) args = args.concat(flags); if (machineType && tool !== "linker") args.push("-march=" + machineType); } return args; } function toolNames(rawToolNames, toolchainPrefix) { return toolchainPrefix ? rawToolNames.map(function(rawName) { return toolchainPrefix + rawName; }) : rawToolNames; } function pathPrefix(baseDir, prefix) { var path = ''; if (baseDir) { path += baseDir; if (path.substr(-1) !== '/') path += '/'; } if (prefix) path += prefix; return path; } function appLinkerOutputArtifacts(product) { var app = { filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.applicationFilePath(product)), fileTags: ["bundle.input", "application"] .concat(product.cpp.isForMainBundle ? ["bundle.main.input", "bundle.main.executable"] : []) .concat(product.cpp.shouldSignArtifacts ? ["codesign.signed_artifact"] : []), bundle: { _bundleFilePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.bundleExecutableFilePath(product)) } } var artifacts = [app]; if (!product.aggregate) artifacts = artifacts.concat(debugInfoArtifacts(product, undefined, "app")); if (product.cpp.generateLinkerMapFile) { artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + product.cpp.linkerMapSuffix), fileTags: ["mem_map"] }); } if (product.qbs.toolchain.includes("emscripten")) artifacts = artifacts.concat(wasmArtifacts(product)); return artifacts; } function moduleLinkerOutputArtifacts(product, inputs) { var app = { filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.loadableModuleFilePath(product)), fileTags: ["bundle.input", "loadablemodule"] .concat(product.cpp.isForMainBundle ? ["bundle.main.input", "bundle.main.plugin"] : []) .concat(product.cpp.shouldSignArtifacts ? ["codesign.signed_artifact"] : []), bundle: { _bundleFilePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.bundleExecutableFilePath(product)) } } var artifacts = [app]; if (!product.aggregate) artifacts = artifacts.concat(debugInfoArtifacts(product, undefined, "loadablemodule")); return artifacts; } function staticLibLinkerOutputArtifacts(product) { var tags = ["bundle.input", "staticlibrary"] .concat(product.cpp.isForMainBundle ? ["bundle.main.input", "bundle.main.library"] : []) .concat(product.cpp.shouldSignArtifacts ? ["codesign.signed_artifact"] : []); var objs = inputs["obj"]; var objCount = objs ? objs.length : 0; for (var i = 0; i < objCount; ++i) { var ft = objs[i].fileTags; if (ft.includes("c_obj")) tags.push("c_staticlibrary"); if (ft.includes("cpp_obj")) tags.push("cpp_staticlibrary"); } return [{ filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.staticLibraryFilePath(product)), fileTags: tags, bundle: { _bundleFilePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.bundleExecutableFilePath(product)) } }]; } function staticLibLinkerCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var commands = []; var args = ['rcs']; Array.prototype.push.apply(args, product.cpp.archiverFlags); args.push(output.filePath); for (var i in inputs.obj) args.push(inputs.obj[i].filePath); for (var i in inputs.res) args.push(inputs.res[i].filePath); var cmd = new Command(product.cpp.archiverPath, args); cmd.description = 'creating ' + output.fileName; cmd.highlight = 'linker' cmd.jobPool = "linker"; cmd.responseFileUsagePrefix = '@'; setResponseFileThreshold(cmd, product); commands.push(cmd); if (product.cpp.shouldSignArtifacts) { Array.prototype.push.apply( commands, Codesign.prepareSign(project, product, inputs, outputs, input, output)); } return commands; } function dynamicLibLinkerOutputArtifacts(product) { var artifacts = [{ filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.dynamicLibraryFilePath(product)), fileTags: ["bundle.input", "dynamiclibrary"] .concat(product.cpp.isForMainBundle ? ["bundle.main.input", "bundle.main.library"] : []) .concat(product.cpp.shouldSignArtifacts ? ["codesign.signed_artifact"] : []), bundle: { _bundleFilePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.bundleExecutableFilePath(product)) } }]; if (product.cpp.imageFormat === "pe") { artifacts.push({ fileTags: ["dynamiclibrary_import"], filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.importLibraryFilePath(product)), alwaysUpdated: false }); } else { // List of libfoo's public symbols for smart re-linking. artifacts.push({ filePath: product.destinationDirectory + "/.sosymbols/" + PathTools.dynamicLibraryFilePath(product), fileTags: ["dynamiclibrary_symbols"], alwaysUpdated: false, }); } artifacts = artifacts.concat(librarySymlinkArtifacts(product)); if (!product.aggregate) artifacts = artifacts.concat(debugInfoArtifacts(product, undefined, "dll")); return artifacts; } function wasmArtifacts(product) { var flags = product.cpp.driverLinkerFlags; var wasmoption = 1; var pthread = false; for (var index in flags) { var option = flags[index]; if (option.indexOf("WASM") !== -1) { option = option.trim(); wasmoption = option.substring(option.length - 1); } else if (option.indexOf("-pthread") !== -1) { pthread = true; } } var artifacts = []; var createAppArtifact = function(fileName) { return { filePath: FileInfo.joinPaths(product.destinationDirectory, fileName), fileTags: ["wasm"] }; }; var suffix = product.cpp.executableSuffix; if (suffix !== ".wasm") { if (suffix === ".html") artifacts.push(createAppArtifact(product.targetName + ".js")); if (pthread) artifacts.push(createAppArtifact(product.targetName + ".worker.js")); } if (wasmoption !== 0 && suffix !== ".wasm") //suffix .wasm will already result in "application".wasm artifacts.push(createAppArtifact(product.targetName + ".wasm")); if (wasmoption == 2) artifacts.push(createAppArtifact(product.targetName + ".wasm.js")); return artifacts; } function configureStdModules() { try { var probe = new Process(); // check which stdlib is used? this actually works: // clang-18 -print-file-name=libstdc++.modules.json --sysroot /opt/gcc-15/ const modulesJsonFiles = [ "libc++.modules.json", "libstdc++.modules.json", "../../c++/libc++.modules.json", ]; for (var i = 0; i < modulesJsonFiles.length; ++i) { const modulesJsonFile = modulesJsonFiles[i]; const result = probe.exec(_compilerPath, ["-print-file-name=" + modulesJsonFile], false); if (result !== 0) continue; const path = probe.readStdOut().trim(); if (path !== modulesJsonFile && FileInfo.isAbsolutePath(path) && File.exists(path)) { const jsonFile = new TextFile(path, TextFile.ReadOnly); const json = JSON.parse(jsonFile.readAll()); jsonFile.close(); const modules = json.modules .filter(function(module) { const logicalName = module["logical-name"]; if (logicalName === "std" && (_forceUseImportStd || _forceUseImportStdCompat)) { return true; } else if (logicalName === "std.compat" && _forceUseImportStdCompat) { return true; } return false; }) .map(function(module) { const sourcePath = module["source-path"]; if (FileInfo.isAbsolutePath(sourcePath)) return sourcePath; return FileInfo.joinPaths(FileInfo.path(path), sourcePath); }) .filter(function(module) { return File.exists(module); }); if (modules.length > 0) { found = true; _stdModulesFiles = modules; break; } } } } finally { probe.close(); } } qbs-src-3.2.0/share/qbs/modules/cpp/iar.qbs0000644000175100017510000001332515154533055020111 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.PathTools import qbs.Probes import qbs.Utilities import "cpp.js" as Cpp import "iar.js" as IAR CppModule { condition: qbs.toolchain && qbs.toolchain.includes("iar") Probes.BinaryProbe { id: compilerPathProbe condition: !toolchainInstallPath && !_skipAllChecks names: ["iccarm"] } Probes.IarProbe { id: iarProbe condition: !_skipAllChecks compilerFilePath: compilerPath enableDefinesByLanguage: enableCompilerDefinesByLanguage } Properties { condition: iarProbe.found qbs.architecture: iarProbe.architecture } qbs.targetPlatform: "none" compilerVersionMajor: iarProbe.versionMajor compilerVersionMinor: iarProbe.versionMinor compilerVersionPatch: iarProbe.versionPatch endianness: iarProbe.endianness compilerDefinesByLanguage: iarProbe.compilerDefinesByLanguage compilerIncludePaths: iarProbe.includePaths toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined /* Work-around for QtCreator which expects these properties to exist. */ property string cCompilerName: compilerName property string cxxCompilerName: compilerName compilerName: toolchainDetails.compilerName + compilerExtension compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) assemblerName: toolchainDetails.assemblerName + compilerExtension assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName) linkerName: toolchainDetails.linkerName + compilerExtension linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) archiverName: toolchainDetails.archiverName + compilerExtension archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) runtimeLibrary: "static" staticLibrarySuffix: toolchainDetails.staticLibrarySuffix executableSuffix: toolchainDetails.executableSuffix objectSuffix: toolchainDetails.objectSuffix imageFormat: toolchainDetails.imageFormat enableExceptions: false enableRtti: false defineFlag: "-D" includeFlag: "-I" systemIncludeFlag: "-I" preincludeFlag: "--preinclude" libraryDependencyFlag: "" libraryPathFlag: toolchainDetails.libraryPathFlag linkerScriptFlag: toolchainDetails.linkerScriptFlag property string linkerSilentFlag: toolchainDetails.linkerSilentFlag property string linkerMapFileFlag: toolchainDetails.linkerMapFileFlag property string linkerEntryPointFlag: toolchainDetails.linkerEntryPointFlag toolchainDetails: IAR.toolchainDetails(qbs) knownArchitectures: ["78k", "arm", "avr", "avr32", "cr16", "hcs12", "hcs8", "m16c", "m32c", "m68k", "mcs51", "msp430", "r32c", "rh850", "riscv", "rl78", "rx", "sh", "stm8", "v850"] Rule { id: assembler inputs: ["asm"] outputFileTags: Cpp.assemblerOutputTags(generateAssemblerListingFiles) outputArtifacts: Cpp.assemblerOutputArtifacts(input) prepare: IAR.prepareAssembler.apply(IAR, arguments) } FileTagger { patterns: ["*.s", "*.s43", "*.s51", "*.s90", "*.msa", "*.asm"] fileTags: ["asm"] } Rule { id: compiler inputs: ["cpp", "c"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.compilerOutputTags(generateCompilerListingFiles) outputArtifacts: Cpp.compilerOutputArtifacts(input) prepare: IAR.prepareCompiler.apply(IAR, arguments) } Rule { id: applicationLinker multiplex: true inputs: ["obj", "linkerscript"] inputsFromDependencies: ["staticlibrary", "objectlibrary"] outputFileTags: Cpp.applicationLinkerOutputTags(generateLinkerMapFile) outputArtifacts: Cpp.applicationLinkerOutputArtifacts(product) prepare: IAR.prepareLinker.apply(IAR, arguments) } Rule { id: staticLibraryLinker multiplex: true inputs: ["obj"] inputsFromDependencies: ["staticlibrary", "objectlibrary"] outputFileTags: Cpp.staticLibraryLinkerOutputTags() outputArtifacts: Cpp.staticLibraryLinkerOutputArtifacts(product) prepare: IAR.prepareArchiver.apply(IAR, arguments) } } qbs-src-3.2.0/share/qbs/modules/cpp/dmc.qbs0000644000175100017510000001565015154533055020104 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.Host import qbs.PathTools import qbs.Probes import qbs.Utilities import "dmc.js" as DMC import "cpp.js" as Cpp CppModule { condition: Host.os().includes("windows") && qbs.toolchain && qbs.toolchain.includes("dmc") Probes.BinaryProbe { id: compilerPathProbe condition: !toolchainInstallPath && !_skipAllChecks names: ["dmc"] } Probes.DmcProbe { id: dmcProbe condition: !_skipAllChecks compilerFilePath: compilerPath enableDefinesByLanguage: enableCompilerDefinesByLanguage _targetPlatform: qbs.targetPlatform _targetArchitecture: qbs.architecture _targetExtender: extenderName } Properties { condition: dmcProbe.found qbs.architecture: dmcProbe.architecture qbs.targetPlatform: dmcProbe.targetPlatform } compilerVersionMajor: dmcProbe.versionMajor compilerVersionMinor: dmcProbe.versionMinor compilerVersionPatch: dmcProbe.versionPatch endianness: "little" compilerDefinesByLanguage: dmcProbe.compilerDefinesByLanguage compilerIncludePaths: dmcProbe.includePaths toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined /* Work-around for QtCreator which expects these properties to exist. */ property string cCompilerName: compilerName property string cxxCompilerName: compilerName compilerName: "dmc.exe" compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) assemblerName: "dmc.exe" assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName) linkerName: "link.exe" linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) archiverName: "lib.exe" archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) property string rccCompilerName: "rcc.exe" property string rccCompilerPath: FileInfo.joinPaths(toolchainInstallPath, rccCompilerName) property string extenderName PropertyOptions { name: "extenderName" allowedValues: [undefined, "dosz", "dosr", "dosx", "dosp"] description: "Specifies the DOS memory extender to compile with:\n" + " - \"dosz\" is the ZPM 16 bit DOS Extender\n" + " - \"dosr\" is the Rational 16 bit DOS Extender\n" + " - \"dosx\" is the DOSX 32 bit DOS Extender\n" + " - \"dosp\" is the Pharlap 32 bit DOS Extender\n" ; } runtimeLibrary: "dynamic" staticLibrarySuffix: ".lib" dynamicLibrarySuffix: ".dll" executableSuffix: ".exe" objectSuffix: ".obj" imageFormat: { if (qbs.targetPlatform === "dos") return "mz"; else if (qbs.targetPlatform === "windows") return "pe"; } defineFlag: "-D" includeFlag: "-I" systemIncludeFlag: "-I" preincludeFlag: "-HI" libraryPathFlag: "-L/packcode" knownArchitectures: ["x86", "x86_16"] Rule { id: assembler inputs: ["asm"] outputFileTags: DMC.depsOutputTags().concat( Cpp.assemblerOutputTags(generateAssemblerListingFiles)) outputArtifacts: DMC.depsOutputArtifacts(input, product).concat( Cpp.assemblerOutputArtifacts(input)) prepare: DMC.prepareAssembler.apply(DMC, arguments) } FileTagger { patterns: ["*.s", "*.asm"] fileTags: ["asm"] } Rule { id: compiler inputs: ["cpp", "c"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: DMC.depsOutputTags().concat( Cpp.compilerOutputTags(generateCompilerListingFiles)) outputArtifacts: DMC.depsOutputArtifacts(input, product).concat( Cpp.compilerOutputArtifacts(input)) prepare: DMC.prepareCompiler.apply(DMC, arguments) } Rule { id: rccCompiler inputs: ["rc"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.resourceCompilerOutputTags() outputArtifacts: Cpp.resourceCompilerOutputArtifacts(input) prepare: DMC.prepareRccCompiler.apply(DMC, arguments) } FileTagger { patterns: ["*.rc"] fileTags: ["rc"] } Rule { id: applicationLinker multiplex: true inputs: ["obj", "res", "linkerscript"] inputsFromDependencies: ["staticlibrary", "objectlibrary", "dynamiclibrary_import"] outputFileTags: Cpp.applicationLinkerOutputTags(generateLinkerMapFile) outputArtifacts: Cpp.applicationLinkerOutputArtifacts(product) prepare: DMC.prepareLinker.apply(DMC, arguments) } Rule { id: dynamicLibraryLinker multiplex: true inputs: ["obj", "res"] inputsFromDependencies: ["staticlibrary", "objectlibrary", "dynamiclibrary_import"] outputFileTags: Cpp.dynamicLibraryLinkerOutputTags() outputArtifacts: Cpp.dynamicLibraryLinkerOutputArtifacts(product) prepare: DMC.prepareLinker.apply(DMC, arguments) } Rule { id: staticLibraryLinker multiplex: true inputs: ["obj"] inputsFromDependencies: ["staticlibrary", "objectlibrary", "dynamiclibrary_import"] outputFileTags: Cpp.staticLibraryLinkerOutputTags() outputArtifacts: Cpp.staticLibraryLinkerOutputArtifacts(product) prepare: DMC.prepareArchiver.apply(DMC, arguments) } } qbs-src-3.2.0/share/qbs/modules/cpp/darwin.js0000644000175100017510000002267715154533055020463 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Codesign = require("../codesign/codesign.js"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var Gcc = require("./gcc.js"); var ModUtils = require("qbs.ModUtils"); var PathTools = require("qbs.PathTools"); function lipoOutputArtifacts(product, inputs, fileTag, debugSuffix) { var buildVariants = []; for (var i = 0; i < inputs[fileTag].length; ++i) { var variant = inputs[fileTag][i].qbs.buildVariant; var suffix = inputs[fileTag][i].cpp.variantSuffix; if (!buildVariants.some(function (x) { return x.name === variant; })) buildVariants.push({ name: variant, suffix: suffix }); } var list = []; if (fileTag === "dynamiclibrary") { Array.prototype.push.apply(list, buildVariants.map(function (variant) { return { filePath: product.destinationDirectory + "/.sosymbols/" + PathTools.dynamicLibraryFilePath(product, variant.suffix), fileTags: ["dynamiclibrary_symbols"], qbs: { buildVariant: variant.name }, cpp: { variantSuffix: variant.suffix }, alwaysUpdated: false }; })); buildVariants.forEach(function (variant) { Array.prototype.push.apply(list, Gcc.librarySymlinkArtifacts(product, variant.suffix)); }); } // Bundles should have a "normal" variant. In the case of frameworks, they cannot normally be // linked to without a default variant unless a variant is specifically chosen at link time // by passing the full path to the shared library executable instead of the -framework switch. // Technically this doesn't affect qbs since qbs always uses full paths for internal // dependencies but the "normal" variant is always the one that is linked to, since the // alternative variants should only be chosen at runtime using the DYLD_IMAGE_SUFFIX variable. // So for frameworks we'll create a copy of the "default" variant as chosen by the user // (we cannot do this automatically since the user must tell us which variant should be // preferred, if there are multiple alternative variants). Applications are fine without a // copy but still need an explicitly chosen variant to set as the CFBundleExecutable so that // Finder/LaunchServices can launch it normally but for simplicity we'll just use the copy // approach for all bundle types. var defaultVariant; if (!buildVariants.some(function (x) { return x.name === "release"; }) && product.multiplexByQbsProperties.includes("buildVariants") && product.qbs.buildVariants && product.qbs.buildVariants.length > 1) { var defaultBuildVariant = product.qbs.defaultBuildVariant; buildVariants.map(function (variant) { if (variant.name === defaultBuildVariant) defaultVariant = variant; }); if (!defaultVariant) { throw new Error("qbs.defaultBuildVariant is '" + defaultBuildVariant + "', but this " + "variant is not in the qbs.buildVariants list (" + product.qbs.buildVariants.join(", ") + ")"); } buildVariants.push({ name: "release", suffix: "", isVariantCopy: true }); } Array.prototype.push.apply(list, buildVariants.map(function (variant) { var tags = ["bundle.input"]; if (variant.isVariantCopy) tags.push("bundle.variant_copy"); else tags.push(fileTag, "primary"); // Non-main bundles should be copyable into main bundles if (product.bundle && !product.bundle.isMainBundle && !product.bundle.isBundle) { // Static libraries are not supported as an input to main bundle since // they cannot be signed and main bundle should have all additional files signed. tags.push("bundle.main.input"); if (fileTag === "application") tags.push("bundle.main.executable"); else if (fileTag === "dynamiclibrary") tags.push("bundle.main.library"); else if (fileTag === "staticlibrary") tags.push("bundle.main.library"); else if (fileTag === "loadablemodule") tags.push("bundle.main.plugin"); } if (product.codesign.enableCodeSigning) tags.push("codesign.signed_artifact"); return { filePath: FileInfo.joinPaths(product.destinationDirectory, PathTools.linkerOutputFilePath(fileTag, product, variant.suffix)), fileTags: tags, qbs: { buildVariant: variant.name, _buildVariantFilePath: variant.isVariantCopy && defaultVariant ? FileInfo.joinPaths(product.destinationDirectory, PathTools.linkerOutputFilePath( fileTag, product, defaultVariant.suffix)) : undefined }, bundle: { _bundleFilePath: product.destinationDirectory + "/" + PathTools.bundleExecutableFilePath(product, variant.suffix) }, cpp: { variantSuffix: variant.suffix } }; })); if (debugSuffix) Array.prototype.push.apply(list, Gcc.debugInfoArtifacts(product, buildVariants, debugSuffix)); return list; } function prepareLipo(project, product, inputs, outputs, input, output) { var cmd; var commands = []; for (var p in inputs) inputs[p] = inputs[p].filter(function(inp) { return inp.product.name === product.name; }); var allInputs = [].concat.apply([], Object.keys(inputs).map(function (tag) { return ["application", "dynamiclibrary", "staticlibrary", "loadablemodule"].includes(tag) ? inputs[tag] : []; })); for (var i = 0; i < outputs.primary.length; ++i) { var vInputs = allInputs.filter(function (f) { return f.qbs.buildVariant === outputs.primary[i].qbs.buildVariant }).map(function (f) { return f.filePath }); if (vInputs.length > 1 || product.cpp.alwaysUseLipo) { cmd = new Command(ModUtils.moduleProperty(product, "lipoPath"), ["-create", "-output", outputs.primary[i].filePath].concat(vInputs)); cmd.description = "lipo " + outputs.primary[i].fileName; cmd.highlight = "linker"; } else { cmd = new JavaScriptCommand(); cmd.src = vInputs[0]; cmd.dst = outputs.primary[i].filePath; cmd.sourceCode = function () { File.copy(src, dst); }; cmd.silent = true; } Array.prototype.push.apply(commands, Gcc.librarySymlinkCommands(outputs, outputs.primary[i])); commands.push(cmd); } (outputs["bundle.variant_copy"] || []).map(function (copy) { cmd = new JavaScriptCommand(); cmd.src = copy.qbs._buildVariantFilePath; cmd.dst = copy.filePath; cmd.sourceCode = function () { File.copy(src, dst); }; cmd.silent = true; commands.push(cmd); }); commands = commands.concat( Gcc.separateDebugInfoCommandsDarwin(product, outputs, outputs.primary)); if (outputs.dynamiclibrary_symbols) Array.prototype.push.apply(commands, Gcc.createSymbolCheckingCommands(product, outputs)); if (product.codesign.enableCodeSigning) { Array.prototype.push.apply( commands, Codesign.prepareSign(project, product, inputs, outputs, input, output)); } return commands; } qbs-src-3.2.0/share/qbs/modules/cpp/windows-msvc.qbs0000644000175100017510000000713415154533055021777 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Host import qbs.Probes import "windows-msvc-base.qbs" as MsvcBaseModule import 'msvc.js' as MSVC MsvcBaseModule { condition: Host.os().includes('windows') && qbs.targetOS.includes('windows') && qbs.toolchain && qbs.toolchain.includes('msvc') priority: 50 Probes.ClBinaryProbe { id: compilerPathProbe preferredArchitecture: qbs.architecture condition: !toolchainInstallPath && !_skipAllChecks names: ["cl"] } Probes.MsvcProbe { id: msvcProbe condition: !_skipAllChecks compilerFilePath: compilerPath enableDefinesByLanguage: enableCompilerDefinesByLanguage preferredArchitecture: qbs.architecture winSdkVersion: windowsSdkVersion } Properties { condition: msvcProbe.found qbs.architecture: msvcProbe.architecture } compilerVersionMajor: msvcProbe.versionMajor compilerVersionMinor: msvcProbe.versionMinor compilerVersionPatch: msvcProbe.versionPatch compilerIncludePaths: msvcProbe.includePaths compilerDefinesByLanguage: msvcProbe.compilerDefinesByLanguage toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined buildEnv: msvcProbe.buildEnv enableCxxLanguageMacro: true compiledModuleSuffix: ".ifc" moduleOutputFlag: "-ifcOutput " moduleFileFlag: "-reference %module%=" stdModulesFiles: stdModulesProbe.found ? stdModulesProbe._stdModulesFiles : undefined Probe { id: stdModulesProbe condition: msvcProbe.found && !_skipAllChecks && stdModulesFiles === undefined && (forceUseImportStd || forceUseImportStdCompat) // input property string _modulesDirPath: msvcProbe.modulesPath property bool _forceUseImportStd : forceUseImportStd property bool _forceUseImportStdCompat : forceUseImportStdCompat // output property stringList _stdModulesFiles configure: MSVC.configureStdModules() } } qbs-src-3.2.0/share/qbs/modules/cpp/macos-gcc.qbs0000644000175100017510000000403215154533055021165 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.ModUtils import qbs.Utilities DarwinGCC { priority: 1 condition: qbs.targetOS.includes('macos') && qbs.toolchain && qbs.toolchain.includes('gcc') targetSystem: "macosx" + (minimumMacosVersion || "") minimumDarwinVersion: minimumMacosVersion minimumDarwinVersionCompilerFlag: "-mmacosx-version-min" minimumDarwinVersionLinkerFlag: "-macosx_version_min" libcxxAvailable: base && minimumDarwinVersion && Utilities.versionCompare(minimumDarwinVersion, "10.7") >= 0 } qbs-src-3.2.0/share/qbs/modules/cpp/sdcc.qbs0000644000175100017510000001321215154533055020245 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.Probes import "cpp.js" as Cpp import "sdcc.js" as SDCC CppModule { condition: qbs.toolchain && qbs.toolchain.includes("sdcc") Probes.BinaryProbe { id: compilerPathProbe condition: !toolchainInstallPath && !_skipAllChecks names: ["sdcc"] } Probes.SdccProbe { id: sdccProbe condition: !_skipAllChecks compilerFilePath: compilerPath enableDefinesByLanguage: enableCompilerDefinesByLanguage preferredArchitecture: qbs.architecture } Properties { condition: sdccProbe.found qbs.architecture: sdccProbe.architecture } qbs.targetPlatform: "none" compilerVersionMajor: sdccProbe.versionMajor compilerVersionMinor: sdccProbe.versionMinor compilerVersionPatch: sdccProbe.versionPatch endianness: sdccProbe.endianness compilerDefinesByLanguage: sdccProbe.compilerDefinesByLanguage compilerIncludePaths: sdccProbe.includePaths toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined /* Work-around for QtCreator which expects these properties to exist. */ property string cCompilerName: compilerName property string cxxCompilerName: compilerName property string linkerMode: "automatic" compilerName: "sdcc" + compilerExtension compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) assemblerName: toolchainDetails.assemblerName + compilerExtension assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName) linkerName: toolchainDetails.linkerName + compilerExtension linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) archiverName: "sdar" + compilerExtension archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) runtimeLibrary: "static" staticLibrarySuffix: ".lib" executableSuffix: ".ihx" objectSuffix: ".rel" imageFormat: "ihx" enableExceptions: false enableRtti: false defineFlag: "-D" includeFlag: "-I" systemIncludeFlag: "-isystem" preincludeFlag: "-include" libraryDependencyFlag: "-l" libraryPathFlag: "-L" linkerScriptFlag: "-f" toolchainDetails: SDCC.toolchainDetails(qbs) knownArchitectures: ["hcs8", "mcs51", "stm8"] Rule { id: assembler inputs: ["asm"] outputFileTags: SDCC.extraCompilerOutputTags().concat( Cpp.assemblerOutputTags(generateAssemblerListingFiles)) outputArtifacts: SDCC.extraCompilerOutputArtifacts(input).concat( Cpp.assemblerOutputArtifacts(input)) prepare: SDCC.prepareAssembler.apply(SDCC, arguments) } FileTagger { patterns: ["*.s", "*.a51", "*.asm"] fileTags: ["asm"] } Rule { id: compiler inputs: ["cpp", "c"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: SDCC.extraCompilerOutputTags().concat( Cpp.compilerOutputTags(generateCompilerListingFiles)) outputArtifacts: SDCC.extraCompilerOutputArtifacts(input).concat( Cpp.compilerOutputArtifacts(input)) prepare: SDCC.prepareCompiler.apply(SDCC, arguments) } Rule { id: applicationLinker multiplex: true inputs: ["obj", "linkerscript"] inputsFromDependencies: ["staticlibrary", "objectlibrary"] outputFileTags: SDCC.extraApplicationLinkerOutputTags().concat( Cpp.applicationLinkerOutputTags(generateLinkerMapFile)) outputArtifacts: SDCC.extraApplicationLinkerOutputArtifacts(product).concat( Cpp.applicationLinkerOutputArtifacts(product)) prepare: SDCC.prepareLinker.apply(SDCC, arguments) } Rule { id: staticLibraryLinker multiplex: true inputs: ["obj"] inputsFromDependencies: ["staticlibrary", "objectlibrary"] outputFileTags: Cpp.staticLibraryLinkerOutputTags() outputArtifacts: Cpp.staticLibraryLinkerOutputArtifacts(product) prepare: SDCC.prepareArchiver.apply(SDCC, arguments) } } qbs-src-3.2.0/share/qbs/modules/cpp/ios-gcc.qbs0000644000175100017510000000752115154533055020663 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.DarwinTools import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.Utilities DarwinGCC { priority: 1 condition: qbs.targetOS.includes('ios') && qbs.toolchain && qbs.toolchain.includes('gcc') minimumIosVersion: { if (Host.architecture() == "armv7a") return "6.0"; // XCode 12 requres version (at least 8.0) to be present in the -target triplet // when compiling for ios-simulator if (xcode.present && Utilities.versionCompare(xcode.version, "12.0") >= 0) return "8.0"; } targetSystem: { return "ios" + (minimumIosVersion || "") + (qbs.targetOS.includes('ios-simulator') ? "-simulator" : ""); } minimumDarwinVersion: minimumIosVersion minimumDarwinVersionCompilerFlag: qbs.targetOS.includes("ios-simulator") ? "-mios-simulator-version-min" : "-miphoneos-version-min" minimumDarwinVersionLinkerFlag: qbs.targetOS.includes("ios-simulator") ? "-ios_simulator_version_min" : "-iphoneos_version_min" libcxxAvailable: base && (!minimumDarwinVersion || Utilities.versionCompare(minimumDarwinVersion, "5") >= 0) platformObjcFlags: base.concat(simulatorObjcFlags) platformObjcxxFlags: base.concat(simulatorObjcFlags) // Private properties readonly property stringList simulatorObjcFlags: { // default in Xcode and also required for building 32-bit Simulator binaries with ARC // since the default ABI version is 0 for 32-bit targets return qbs.targetOS.includes("ios-simulator") ? ["-fobjc-abi-version=2", "-fobjc-legacy-dispatch"] : []; } Rule { condition: !product.qbs.targetOS.includes("ios-simulator") inputsFromDependencies: ["bundle.content"] Artifact { filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + ".ipa") fileTags: ["ipa"] } prepare: { var cmd = new Command("PackageApplication", [input.filePath, "-o", output.filePath]); cmd.description = "creating ipa"; cmd.highlight = "codegen"; return cmd; } } } qbs-src-3.2.0/share/qbs/modules/cpp/freebsd.js0000644000175100017510000000062715154533055020600 0ustar runnerrunnervar Utilities = require("qbs.Utilities"); function stripKernelReleaseSuffix(r) { var suffixes = ["-RELEASE", "-STABLE", "-CURRENT"]; for (var i = 0; i < suffixes.length; i++) { var idx = r.indexOf(suffixes[i]); if (idx >= 0) return r.substr(0, idx); } return r; } function hostKernelRelease() { return stripKernelReleaseSuffix(Utilities.kernelVersion()); } qbs-src-3.2.0/share/qbs/modules/cpp/watcom.qbs0000644000175100017510000001613715154533055020634 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2022 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs 1.0 import qbs.File import qbs.FileInfo import qbs.ModUtils import qbs.Probes import "cpp.js" as Cpp import "watcom.js" as WATCOM CppModule { condition: qbs.toolchain && qbs.toolchain.includes("watcom") Probes.BinaryProbe { id: compilerPathProbe condition: !toolchainInstallPath && !_skipAllChecks names: ["owcc"] } Probes.WatcomProbe { id: watcomProbe condition: !_skipAllChecks compilerFilePath: compilerPath enableDefinesByLanguage: enableCompilerDefinesByLanguage _pathListSeparator: qbs.pathListSeparator _toolchainInstallPath: toolchainInstallPath _targetPlatform: qbs.targetPlatform _targetArchitecture: qbs.architecture } Properties { condition: watcomProbe.found qbs.architecture: watcomProbe.architecture qbs.targetPlatform: watcomProbe.targetPlatform } compilerVersionMajor: watcomProbe.versionMajor compilerVersionMinor: watcomProbe.versionMinor compilerVersionPatch: watcomProbe.versionPatch endianness: watcomProbe.endianness compilerDefinesByLanguage: watcomProbe.compilerDefinesByLanguage compilerIncludePaths: watcomProbe.includePaths toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined /* Work-around for QtCreator which expects these properties to exist. */ property string cCompilerName: compilerName property string cxxCompilerName: compilerName compilerName: "owcc" + compilerExtension compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) assemblerName: "wasm" + compilerExtension assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName) linkerName: "wlink" + compilerExtension linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) property string disassemblerName: "wdis" + compilerExtension property string disassemblerPath: FileInfo.joinPaths(toolchainInstallPath, disassemblerName) property string resourceCompilerName: "wrc" + compilerExtension property string resourceCompilerPath: FileInfo.joinPaths(toolchainInstallPath, resourceCompilerName) archiverName: "wlib" + compilerExtension archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) runtimeLibrary: "dynamic" staticLibrarySuffix: ".lib" dynamicLibrarySuffix: toolchainDetails.dynamicLibrarySuffix executableSuffix: toolchainDetails.executableSuffix objectSuffix: ".obj" imageFormat: toolchainDetails.imageFormat defineFlag: "-D" includeFlag: "-I" systemIncludeFlag: "-I" preincludeFlag: "-include" libraryDependencyFlag: "-l" libraryPathFlag: "-L" linkerScriptFlag: "" toolchainDetails: WATCOM.toolchainDetails(qbs) knownArchitectures: ["x86", "x86_16"] property var buildEnv: watcomProbe.environment setupBuildEnvironment: { for (var key in product.cpp.buildEnv) { var v = new ModUtils.EnvironmentVariable(key, product.qbs.pathListSeparator); v.prepend(product.cpp.buildEnv[key]); v.set(); } } Rule { id: assembler inputs: ["asm"] outputFileTags: Cpp.assemblerOutputTags(generateAssemblerListingFiles) outputArtifacts: Cpp.assemblerOutputArtifacts(input) prepare: WATCOM.prepareAssembler.apply(WATCOM, arguments) } FileTagger { patterns: ["*.asm"] fileTags: ["asm"] } Rule { id: compiler inputs: ["cpp", "c"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.compilerOutputTags(generateCompilerListingFiles) outputArtifacts: Cpp.compilerOutputArtifacts(input) prepare: WATCOM.prepareCompiler.apply(WATCOM, arguments) } Rule { id: rccCompiler inputs: ["rc"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.resourceCompilerOutputTags() outputArtifacts: Cpp.resourceCompilerOutputArtifacts(input) prepare: WATCOM.prepareResourceCompiler.apply(WATCOM, arguments) } FileTagger { patterns: ["*.rc"] fileTags: ["rc"] } Rule { id: applicationLinker multiplex: true inputs: ["obj", "res", "linkerscript"] inputsFromDependencies: ["staticlibrary", "objectlibrary", "dynamiclibrary_import"] outputFileTags: Cpp.applicationLinkerOutputTags(generateLinkerMapFile) outputArtifacts: Cpp.applicationLinkerOutputArtifacts(product) prepare: WATCOM.prepareLinker.apply(WATCOM, arguments) } Rule { id: dynamicLibraryLinker condition: qbs.targetOS.includes("windows") multiplex: true inputs: ["obj", "res"] inputsFromDependencies: ["staticlibrary", "objectlibrary", "dynamiclibrary_import"] outputFileTags: Cpp.dynamicLibraryLinkerOutputTags(); outputArtifacts: Cpp.dynamicLibraryLinkerOutputArtifacts(product) prepare: WATCOM.prepareLinker.apply(WATCOM, arguments) } Rule { id: libraryManager multiplex: true inputs: ["obj"] inputsFromDependencies: ["staticlibrary", "objectlibrary", "dynamiclibrary_import"] outputFileTags: Cpp.staticLibraryLinkerOutputTags() outputArtifacts: Cpp.staticLibraryLinkerOutputArtifacts(product) prepare: WATCOM.prepareLibraryManager.apply(WATCOM, arguments) } JobLimit { jobPool: "watcom_job_pool" jobCount: 1 } } qbs-src-3.2.0/share/qbs/modules/cpp/keil.qbs0000644000175100017510000001304515154533055020261 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.Host import qbs.Probes import "cpp.js" as Cpp import "keil.js" as KEIL CppModule { condition: Host.os().includes("windows") && qbs.toolchain && qbs.toolchain.includes("keil") Probes.BinaryProbe { id: compilerPathProbe condition: !toolchainInstallPath && !_skipAllChecks names: ["c51"] } Probes.KeilProbe { id: keilProbe condition: !_skipAllChecks compilerFilePath: compilerPath enableDefinesByLanguage: enableCompilerDefinesByLanguage } Properties { condition: keilProbe.found qbs.architecture: keilProbe.architecture } qbs.targetPlatform: "none" compilerVersionMajor: keilProbe.versionMajor compilerVersionMinor: keilProbe.versionMinor compilerVersionPatch: keilProbe.versionPatch endianness: keilProbe.endianness compilerDefinesByLanguage: keilProbe.compilerDefinesByLanguage compilerIncludePaths: keilProbe.includePaths toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined /* Work-around for QtCreator which expects these properties to exist. */ property string cCompilerName: compilerName property string cxxCompilerName: compilerName compilerName: toolchainDetails.compilerName + compilerExtension compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) assemblerName: toolchainDetails.assemblerName + compilerExtension assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName) linkerName: toolchainDetails.linkerName + compilerExtension linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) archiverName: toolchainDetails.archiverName + compilerExtension archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) property string disassemblerName: toolchainDetails.disassemblerName + compilerExtension property string disassemblerPath: FileInfo.joinPaths(toolchainInstallPath, disassemblerName) runtimeLibrary: "static" staticLibrarySuffix: ".lib" executableSuffix: toolchainDetails.executableSuffix objectSuffix: toolchainDetails.objectSuffix linkerMapSuffix: toolchainDetails.linkerMapSuffix imageFormat: toolchainDetails.imageFormat enableExceptions: false enableRtti: false defineFlag: "-D" includeFlag: "-I" systemIncludeFlag: "-I" preincludeFlag: KEIL.preincludeFlag(compilerPath) libraryDependencyFlag: "" libraryPathFlag: "--userlibpath=" linkerScriptFlag: "--scatter" toolchainDetails: KEIL.toolchainDetails(qbs) knownArchitectures: ["arm", "c166", "mcs251", "mcs51"] Rule { id: assembler inputs: ["asm"] outputFileTags: Cpp.assemblerOutputTags(generateAssemblerListingFiles) outputArtifacts: Cpp.assemblerOutputArtifacts(input) prepare: KEIL.prepareAssembler.apply(KEIL, arguments) } FileTagger { patterns: ["*.s", "*.a51", ".asm"] fileTags: ["asm"] } Rule { id: compiler inputs: ["cpp", "c"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.compilerOutputTags(generateCompilerListingFiles) outputArtifacts: Cpp.compilerOutputArtifacts(input) prepare: KEIL.prepareCompiler.apply(KEIL, arguments) } Rule { id: applicationLinker multiplex: true inputs: ["obj", "linkerscript"] inputsFromDependencies: ["staticlibrary", "objectlibrary"] outputFileTags: Cpp.applicationLinkerOutputTags(generateLinkerMapFile) outputArtifacts: Cpp.applicationLinkerOutputArtifacts(product) prepare: KEIL.prepareLinker.apply(KEIL, arguments) } Rule { id: staticLibraryLinker multiplex: true inputs: ["obj"] inputsFromDependencies: ["staticlibrary", "objectlibrary"] outputFileTags: Cpp.staticLibraryLinkerOutputTags() outputArtifacts: Cpp.staticLibraryLinkerOutputArtifacts(product) prepare: KEIL.prepareArchiver.apply(KEIL, arguments) } } qbs-src-3.2.0/share/qbs/modules/cpp/windows-msvc-base.qbs0000644000175100017510000002034215154533055022703 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.ModUtils import qbs.PathTools import qbs.Probes import qbs.Utilities import qbs.WindowsUtils import 'cpp.js' as Cpp import 'msvc.js' as MSVC CppModule { condition: false Depends { name: "codesign" } windowsApiCharacterSet: "unicode" platformDefines: { var defines = base.concat(WindowsUtils.characterSetDefines(windowsApiCharacterSet)) .concat("WIN32"); var def = WindowsUtils.winapiFamilyDefine(windowsApiFamily); if (def) defines.push("WINAPI_FAMILY=WINAPI_FAMILY_" + def); (windowsApiAdditionalPartitions || []).map(function (name) { defines.push("WINAPI_PARTITION_" + WindowsUtils.winapiPartitionDefine(name) + "=1"); }); return defines; } platformCommonCompilerFlags: { var flags = base; if (compilerVersionMajor >= 18) // 2013 flags.push("/FS"); return flags; } warningLevel: "default" compilerName: "cl.exe" compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) assemblerName: { switch (qbs.architecture) { case "armv7": return "armasm.exe"; case "arm64": return "armasm64.exe"; case "ia64": return "ias.exe"; case "x86": return "ml.exe"; case "x86_64": return "ml64.exe"; } } archiverName: "lib.exe" archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) linkerName: "link.exe" runtimeLibrary: "dynamic" separateDebugInformation: true property bool generateManifestFile: true architecture: qbs.architecture endianness: "little" staticLibrarySuffix: ".lib" dynamicLibrarySuffix: ".dll" executableSuffix: ".exe" debugInfoSuffix: ".pdb" objectSuffix: ".obj" precompiledHeaderSuffix: ".pch" imageFormat: "pe" Properties { condition: product.multiplexByQbsProperties.includes("buildVariants") && qbs.buildVariants && qbs.buildVariants.length > 1 && qbs.buildVariant !== "release" && product.type.containsAny(["staticlibrary", "dynamiclibrary"]) variantSuffix: "d" } property var buildEnv readonly property bool shouldSignArtifacts: codesign.enableCodeSigning property bool enableCxxLanguageMacro: false setupBuildEnvironment: { for (var key in product.cpp.buildEnv) { var v = new ModUtils.EnvironmentVariable(key, ';'); v.prepend(product.cpp.buildEnv[key]); v.set(); } } property string windowsSdkVersion defineFlag: "/D" includeFlag: "/I" systemIncludeFlag: "/external:I" preincludeFlag: "/FI" libraryPathFlag: "/LIBPATH:" Rule { condition: useCPrecompiledHeader inputs: ["c_pch_src"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.precompiledHeaderOutputTags("c", true) outputArtifacts: Cpp.precompiledHeaderOutputArtifacts(input, product, "c", true) prepare: MSVC.prepareCompiler.apply(MSVC, arguments) } Rule { condition: useCxxPrecompiledHeader inputs: ["cpp_pch_src"] explicitlyDependsOn: ["c_pch"] // to prevent vc--0.pdb conflict auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.precompiledHeaderOutputTags("cpp", true) outputArtifacts: Cpp.precompiledHeaderOutputArtifacts(input, product, "cpp", true) prepare: MSVC.prepareCompiler.apply(MSVC, arguments) } Rule { name: "cpp_compiler" inputs: ["cpp", "cppm", "c"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] explicitlyDependsOn: ["c_pch", "cpp_pch"] outputFileTags: Cpp.compilerOutputTags(generateCompilerListingFiles, /*withCxxModules*/ true) outputArtifacts: Cpp.compilerOutputArtifacts(input, undefined, /*withCxxModules*/ true) prepare: MSVC.prepareCompiler.apply(MSVC, arguments) } FileTagger { patterns: ["*.manifest"] fileTags: ["native.pe.manifest"] } FileTagger { patterns: ["*.def"] fileTags: ["def"] } Rule { name: "applicationLinker" multiplex: true inputs: ['obj', 'res', 'native.pe.manifest', 'def'] inputsFromDependencies: ['staticlibrary', 'objectlibrary', 'dynamiclibrary_import', "debuginfo_app"] outputFileTags: { var tags = ["application", "debuginfo_app"]; if (generateLinkerMapFile) tags.push("mem_map"); if (shouldSignArtifacts) tags.push("codesign.signed_artifact"); return tags; } outputArtifacts: MSVC.appLinkerOutputArtifacts(product) prepare: MSVC.prepareLinker.apply(MSVC, arguments) } Rule { name: "dynamicLibraryLinker" multiplex: true inputs: ['obj', 'res', 'native.pe.manifest', 'def'] inputsFromDependencies: ['staticlibrary', 'objectlibrary', 'dynamiclibrary_import', "debuginfo_dll"] outputFileTags: { var tags = ["dynamiclibrary", "dynamiclibrary_import", "debuginfo_dll"]; if (shouldSignArtifacts) tags.push("codesign.signed_artifact"); return tags; } outputArtifacts: MSVC.dllLinkerOutputArtifacts(product) prepare: MSVC.prepareLinker.apply(MSVC, arguments) } Rule { name: "libtool" multiplex: true inputs: ["obj", "res"] inputsFromDependencies: ["staticlibrary", "dynamiclibrary_import"] outputFileTags: ["staticlibrary", "debuginfo_cl"] outputArtifacts: MSVC.libtoolOutputArtifacts(product) prepare: MSVC.libtoolCommands.apply(MSVC, arguments) } FileTagger { patterns: ["*.rc"] fileTags: ["rc"] } Rule { inputs: ["rc"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.resourceCompilerOutputTags() outputArtifacts: Cpp.resourceCompilerOutputArtifacts(input) prepare: { // From MSVC 2010 on, the logo can be suppressed. var logo = product.cpp.compilerVersionMajor >= 16 ? "can-suppress-logo" : "always-shows-logo"; return MSVC.createRcCommand("rc", input, output, logo); } } FileTagger { patterns: "*.asm" fileTags: ["asm"] } Rule { inputs: ["asm"] outputFileTags: Cpp.assemblerOutputTags(false) outputArtifacts: Cpp.assemblerOutputArtifacts(input) prepare: MSVC.assemblerCommands.apply(MSVC, arguments) } } qbs-src-3.2.0/share/qbs/modules/cpp/UnixGCC.qbs0000644000175100017510000000371215154533055020575 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File GenericGCC { condition: qbs.toolchain && qbs.toolchain.includes("gcc") && qbs.targetOS.includes("unix") priority: -50 dynamicLibraryPrefix: "lib" loadableModulePrefix: "lib" dynamicLibrarySuffix: ".so" debugInfoSuffix: ".debug" imageFormat: "elf" systemRunPaths: ["/lib", "/usr/lib"].filter(function(p) { return File.exists(p); }) rpathOrigin: "$ORIGIN" useRPathLink: true rpathLinkFlag: "-rpath-link=" } qbs-src-3.2.0/share/qbs/modules/cpp/keil.js0000644000175100017510000011105315154533055020106 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Cpp = require("cpp.js"); var Environment = require("qbs.Environment"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var PathTools = require("qbs.PathTools"); var Process = require("qbs.Process"); var TemporaryDir = require("qbs.TemporaryDir"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); function isMcs51Architecture(architecture) { return architecture === "mcs51"; } function isMcs251Architecture(architecture) { return architecture === "mcs251"; } function isMcsArchitecture(architecture) { return isMcs51Architecture(architecture) || isMcs251Architecture(architecture); } function isC166Architecture(architecture) { return architecture === "c166"; } function isArmArchitecture(architecture) { return architecture.startsWith("arm"); } function isMcsCompiler(compilerPath) { var base = FileInfo.baseName(compilerPath).toLowerCase(); return base === "c51" || base === "cx51" || base === "c251"; } function isC166Compiler(compilerPath) { return FileInfo.baseName(compilerPath).toLowerCase() === "c166"; } function isArmCCCompiler(compilerPath) { return FileInfo.baseName(compilerPath).toLowerCase() === "armcc"; } function isArmClangCompiler(compilerPath) { return FileInfo.baseName(compilerPath).toLowerCase() === "armclang"; } function preincludeFlag(compilerPath) { if (isArmCCCompiler(compilerPath)) return "--preinclude"; else if (isArmClangCompiler(compilerPath)) return "-include"; } function toolchainDetails(qbs) { var architecture = qbs.architecture; if (isMcs51Architecture(architecture)) { return { "imageFormat": "omf", "linkerMapSuffix":".m51", "objectSuffix": ".obj", "executableSuffix": ".abs", "compilerName": "c51", "assemblerName": "a51", "linkerName": "bl51", "archiverName": "lib51" }; } else if (isMcs251Architecture(architecture)) { return { "imageFormat": "omf", "linkerMapSuffix":".m51", "objectSuffix": ".obj", "executableSuffix": ".abs", "compilerName": "c251", "assemblerName": "a251", "linkerName": "l251", "archiverName": "lib251" }; } else if (isC166Architecture(architecture)) { return { "imageFormat": "omf", "linkerMapSuffix":".m66", "objectSuffix": ".obj", "executableSuffix": ".abs", "compilerName": "c166", "assemblerName": "a166", "linkerName": "l166", "archiverName": "lib166" }; } else if (isArmArchitecture(architecture)) { return { "imageFormat": "elf", "linkerMapSuffix":".map", "objectSuffix": ".o", "executableSuffix": ".axf", "disassemblerName": "fromelf", "compilerName": "armcc", "assemblerName": "armasm", "linkerName": "armlink", "archiverName": "armar" }; } } function guessArmCCArchitecture(targetArchArm, targetArchThumb) { var arch = "arm"; if (targetArchArm === "4" && targetArchThumb === "0") arch += "v4"; else if (targetArchArm === "4" && targetArchThumb === "1") arch += "v4t"; else if (targetArchArm === "5" && targetArchThumb === "2") arch += "v5t"; else if (targetArchArm === "6" && targetArchThumb === "3") arch += "v6"; else if (targetArchArm === "6" && targetArchThumb === "4") arch += "v6t2"; else if (targetArchArm === "0" && targetArchThumb === "3") arch += "v6m"; else if (targetArchArm === "7" && targetArchThumb === "4") arch += "v7r"; else if (targetArchArm === "0" && targetArchThumb === "4") arch += "v7m"; return arch; } function guessArmClangArchitecture(targetArchArm, targetArchProfile) { targetArchProfile = targetArchProfile.replace(/'/g, ""); var arch = "arm"; if (targetArchArm !== "" && targetArchProfile !== "") arch += "v" + targetArchArm + targetArchProfile.toLowerCase(); return arch; } function guessArchitecture(macros) { if (macros["__C51__"]) return "mcs51"; else if (macros["__C251__"]) return "mcs251"; else if (macros["__C166__"]) return "c166"; else if (macros["__CC_ARM"] === "1") return guessArmCCArchitecture(macros["__TARGET_ARCH_ARM"], macros["__TARGET_ARCH_THUMB"]); else if (macros["__clang__"] === "1" && macros["__arm__"] === "1") return guessArmClangArchitecture(macros["__ARM_ARCH"], macros["__ARM_ARCH_PROFILE"]); } function guessEndianness(macros) { if (macros["__C51__"] || macros["__C251__"]) { // The 8051 processors are 8-bit. So, the data with an integer type // represented by more than one byte is stored as big endian in the // Keil toolchain. See for more info: // * http://www.keil.com/support/man/docs/c51/c51_ap_2bytescalar.htm // * http://www.keil.com/support/man/docs/c51/c51_ap_4bytescalar.htm // * http://www.keil.com/support/man/docs/c251/c251_ap_2bytescalar.htm // * http://www.keil.com/support/man/docs/c251/c251_ap_4bytescalar.htm return "big"; } else if (macros["__C166__"]) { // The C166 processors are 16-bit. So, the data with an integer type // represented by more than one byte is stored as little endian in the // Keil toolchain. See for more info: // * http://www.keil.com/support/man/docs/c166/c166_ap_ints.htm // * http://www.keil.com/support/man/docs/c166/c166_ap_longs.htm return "little"; } else if (macros["__CC_ARM"]) { return macros["__BIG_ENDIAN"] ? "big" : "little"; } else if (macros["__clang__"] && macros["__arm__"]) { switch (macros["__BYTE_ORDER__"]) { case "__ORDER_BIG_ENDIAN__": return "big"; case "__ORDER_LITTLE_ENDIAN__": return "little"; } } } function guessVersion(macros) { if (macros["__C51__"] || macros["__C251__"]) { var mcsVersion = macros["__C51__"] || macros["__C251__"]; return { major: parseInt(mcsVersion / 100), minor: parseInt(mcsVersion % 100), patch: 0 } } else if (macros["__C166__"]) { var xcVersion = macros["__C166__"]; return { major: parseInt(xcVersion / 100), minor: parseInt(xcVersion % 100), patch: 0 } } else if (macros["__CC_ARM"] || macros["__clang__"]) { var armVersion = macros["__ARMCC_VERSION"]; return { major: parseInt(armVersion / 1000000), minor: parseInt(armVersion / 10000) % 100, patch: parseInt(armVersion) % 10000 } } } function dumpMcsCompilerMacros(compilerFilePath, tag) { // C51 or C251 compiler support only C language. if (tag === "cpp") return {}; // Note: The C51 or C251 compiler does not support the predefined // macros dumping. So, we do it with the following trick, where we try // to create and compile a special temporary file and to parse the console // output with the own magic pattern: (""|"key"|"value"|""). var outputDirectory = new TemporaryDir(); var outputFilePath = FileInfo.fromNativeSeparators(FileInfo.joinPaths(outputDirectory.path(), "dump-macros.c")); var outputFile = new TextFile(outputFilePath, TextFile.WriteOnly); outputFile.writeLine("#define VALUE_TO_STRING(x) #x"); outputFile.writeLine("#define VALUE(x) VALUE_TO_STRING(x)"); // Predefined keys for C51 and C251 compilers, see details: // * https://www.keil.com/support/man/docs/c51/c51_pp_predefmacroconst.htm // * https://www.keil.com/support/man/docs/c251/c251_pp_predefmacroconst.htm var keys = ["__C51__", "__CX51__", "__C251__", "__MODEL__", "__STDC__", "__FLOAT64__", "__MODSRC__"]; // For C51 compiler. outputFile.writeLine("#if defined(__C51__) || defined(__CX51__)"); outputFile.writeLine("# define VAR_NAME_VALUE(var) \"(\"\"\"\"|\"#var\"|\"VALUE(var)\"|\"\"\"\")\""); for (var i in keys) { var key = keys[i]; outputFile.writeLine("# if defined (" + key + ")"); outputFile.writeLine("# pragma message (VAR_NAME_VALUE(" + key + "))"); outputFile.writeLine("# endif"); } outputFile.writeLine("#endif"); // For C251 compiler. outputFile.writeLine("#if defined(__C251__)"); outputFile.writeLine("# define VAR_NAME_VALUE(var) \"\"|#var|VALUE(var)|\"\""); for (var i in keys) { var key = keys[i]; outputFile.writeLine("# if defined (" + key + ")"); outputFile.writeLine("# warning (VAR_NAME_VALUE(" + key + "))"); outputFile.writeLine("# endif"); } outputFile.writeLine("#endif"); outputFile.close(); var process = new Process(); process.exec(compilerFilePath, [outputFilePath], false); File.remove(outputFilePath); var map = {}; process.readStdOut().trim().split(/\r?\n/g).map(function(line) { var parts = line.split("\"|\"", 4); if (parts.length === 4) map[parts[1]] = parts[2]; }); return map; } function dumpC166CompilerMacros(compilerFilePath, tag) { // C166 compiler support only C language. if (tag === "cpp") return {}; // Note: The C166 compiler does not support the predefined // macros dumping. Also, it does not support the '#pragma' and // '#message|warning|error' directives properly (it is impossible // to print to console the value of macro). // So, we do it with the following trick, where we try // to create and compile a special temporary file and to parse the console // output with the own magic pattern, e.g: // // *** WARNING C320 IN LINE 41 OF c51.c: __C166__ // *** WARNING C2 IN LINE 42 OF c51.c: '757': unknown #pragma/control, line ignored // // where the '__C166__' is a key, and the '757' is a value. var outputDirectory = new TemporaryDir(); var outputFilePath = FileInfo.fromNativeSeparators(outputDirectory.path() + "/dump-macros.c"); var outputFile = new TextFile(outputFilePath, TextFile.WriteOnly); // Predefined keys for C166 compiler, see details: // * https://www.keil.com/support/man/docs/c166/c166_pp_predefmacroconst.htm var keys = ["__C166__", "__DUS__", "__MAC__", "__MOD167__", "__MODEL__", "__MODV2__", "__SAVEMAC__", "__STDC__"]; // For C166 compiler. outputFile.writeLine("#if defined(__C166__)"); for (var i in keys) { var key = keys[i]; outputFile.writeLine("# if defined (" + key + ")"); outputFile.writeLine("# warning " + key); outputFile.writeLine("# pragma " + key); outputFile.writeLine("# endif"); } outputFile.writeLine("#endif"); outputFile.close(); function extractKey(line, knownKeys) { for (var i in keys) { var key = knownKeys[i]; var regexp = new RegExp("^\\*\\*\\* WARNING C320 IN LINE .+: (" + key + ")$"); var match = regexp.exec(line); if (match) return key; } }; function extractValue(line) { var regexp = new RegExp("^\\*\\*\\* WARNING C2 IN LINE .+'(.+)':.+$"); var match = regexp.exec(line); if (match) return match[1]; }; var process = new Process(); process.exec(compilerFilePath, [outputFilePath], false); File.remove(outputFilePath); var lines = process.readStdOut().trim().split(/\r?\n/g); var map = {}; for (var i = 0; i < lines.length; ++i) { // First line should contains the macro key. var keyLine = lines[i]; var key = extractKey(keyLine, keys); if (!key) continue; i += 1; if (i >= lines.length) break; // Second line should contains the macro value. var valueLine = lines[i]; var value = extractValue(valueLine); if (!value) continue; map[key] = value; } return map; } function dumpArmCCCompilerMacros(compilerFilePath, tag, nullDevice) { var args = [ "-E", "--list-macros", "--cpu=cortex-m0", nullDevice ]; if (tag === "cpp") args.push("--cpp"); var p = new Process(); p.exec(compilerFilePath, args, false); return Cpp.extractMacros(p.readStdOut()); } function dumpArmClangCompilerMacros(compilerFilePath, tag, nullDevice) { var args = [ "--target=arm-arm-none-eabi", "-mcpu=cortex-m0", "-dM", "-E", "-x", ((tag === "cpp") ? "c++" : "c"), nullDevice ]; var p = new Process(); p.exec(compilerFilePath, args, false); return Cpp.extractMacros(p.readStdOut()); } function dumpMacros(compilerFilePath, tag, nullDevice) { if (isMcsCompiler(compilerFilePath)) return dumpMcsCompilerMacros(compilerFilePath, tag, nullDevice); else if (isC166Compiler(compilerFilePath)) return dumpC166CompilerMacros(compilerFilePath, tag, nullDevice); else if (isArmCCCompiler(compilerFilePath)) return dumpArmCCCompilerMacros(compilerFilePath, tag, nullDevice); else if (isArmClangCompiler(compilerFilePath)) return dumpArmClangCompilerMacros(compilerFilePath, tag, nullDevice); return {}; } function dumpMcsCompilerIncludePaths(compilerFilePath) { var includePath = compilerFilePath.replace(/bin[\\\/](.*)$/i, "inc"); return [includePath]; } function dumpC166CompilerIncludePaths(compilerFilePath) { // Same as for MCS compiler. return dumpMcsCompilerIncludePaths(compilerFilePath); } function dumpArmCCCompilerIncludePaths(compilerFilePath) { var includePath = compilerFilePath.replace(/bin[\\\/](.*)$/i, "include"); return [includePath]; } function dumpArmClangCompilerIncludePaths(compilerFilePath, nullDevice) { var args = [ "--target=arm-arm-none-eabi", "-mcpu=cortex-m0", "-v", "-E", "-x", "c++", nullDevice ]; var p = new Process(); p.exec(compilerFilePath, args, false); var lines = p.readStdErr().trim().split(/\r?\n/g).map(function (line) { return line.trim(); }); var addIncludes = false; var includePaths = []; for (var i = 0; i < lines.length; ++i) { var line = lines[i]; if (line === "#include <...> search starts here:") addIncludes = true; else if (line === "End of search list.") addIncludes = false; else if (addIncludes) includePaths.push(line); } return includePaths; } function dumpDefaultPaths(compilerFilePath, nullDevice) { var includePaths = []; if (isMcsCompiler(compilerFilePath)) includePaths = dumpMcsCompilerIncludePaths(compilerFilePath); else if (isC166Compiler(compilerFilePath)) includePaths = dumpC166CompilerIncludePaths(compilerFilePath); else if (isArmCCCompiler(compilerFilePath)) includePaths = dumpArmCCCompilerIncludePaths(compilerFilePath); else if (isArmClangCompiler(compilerFilePath)) includePaths = dumpArmClangCompilerIncludePaths(compilerFilePath, nullDevice); return { "includePaths": includePaths }; } function filterMcsOutput(output) { var filteredLines = []; output.split(/\r\n|\r|\n/).forEach(function(line) { var regexp = /^\s*\*{3}\s|^\s{29}|^\s{4}\S|^\s{2}[0-9A-F]{4}|^\s{21,25}\d+|^[0-9A-F]{4}\s\d+/; if (regexp.exec(line)) filteredLines.push(line); }); return filteredLines.join('\n'); }; function filterC166Output(output) { var filteredLines = []; output.split(/\r\n|\r|\n/).forEach(function(line) { var regexp = /^\s*\*{3}\s|^\s{29}|^\s{27,28}\d+|^\s{21}\d+|^\s{4}\S|^\s{2}[0-9A-F]{4}|^[0-9A-F]{4}\s\d+/; if (regexp.exec(line)) filteredLines.push(line); }); return filteredLines.join('\n'); }; function compilerFlags(project, product, input, outputs, explicitlyDependsOn) { // Determine which C-language we're compiling. var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags)); var args = []; var architecture = input.qbs.architecture; if (isMcsArchitecture(architecture) || isC166Architecture(architecture)) { // Input. args.push(input.filePath); // Output. args.push("OBJECT(" + FileInfo.toWindowsSeparators(outputs.obj[0].filePath) + ")"); // Defines. var defines = Cpp.collectDefines(input); if (defines.length > 0) args = args.concat("DEFINE (" + defines.join(",") + ")"); // Includes. var allIncludePaths = [].concat(Cpp.collectIncludePaths(input), Cpp.collectSystemIncludePaths(input)); if (allIncludePaths.length > 0) args = args.concat("INCDIR(" + allIncludePaths.map(function(path) { return FileInfo.toWindowsSeparators(path); }).join(";") + ")"); // Debug information flags. if (input.cpp.debugInformation) args.push("DEBUG"); // Optimization level flags. switch (input.cpp.optimization) { case "small": args.push("OPTIMIZE (SIZE)"); break; case "fast": args.push("OPTIMIZE (SPEED)"); break; case "none": args.push("OPTIMIZE (0)"); break; } // Warning level flags. switch (input.cpp.warningLevel) { case "none": args.push("WARNINGLEVEL (0)"); break; case "all": args.push("WARNINGLEVEL (2)"); if (isMcs51Architecture(architecture)) args.push("FARWARNING"); break; } // Listing files generation flag. if (!input.cpp.generateCompilerListingFiles) args.push("NOPRINT"); else args.push("PRINT(" + FileInfo.toWindowsSeparators(outputs.lst[0].filePath) + ")"); } else if (isArmArchitecture(architecture)) { // Input. args.push("-c", input.filePath); // Output. args.push("-o", outputs.obj[0].filePath); // Preinclude headers. args = args.concat(Cpp.collectPreincludePathsArguments(input, true)); // Defines. args = args.concat(Cpp.collectDefinesArguments(input)); // Includes. args = args.concat(Cpp.collectIncludePathsArguments(input)); args = args.concat(Cpp.collectSystemIncludePathsArguments(input)); var compilerPath = input.cpp.compilerPath; if (isArmCCCompiler(compilerPath)) { // Debug information flags. if (input.cpp.debugInformation) { args.push("--debug"); args.push("-g"); } // Optimization level flags. switch (input.cpp.optimization) { case "small": args.push("-Ospace") break; case "fast": args.push("-Otime") break; case "none": args.push("-O0") break; } // Warning level flags. switch (input.cpp.warningLevel) { case "none": args.push("-W"); break; default: // By default all warnings are enabled. break; } if (tag === "c") { // C language version flags. var knownCLanguageValues = ["c99", "c90"]; var cLanguageVersion = Cpp.languageVersion( input.cpp.cLanguageVersion, knownCLanguageValues, "C"); switch (cLanguageVersion) { case "c99": args.push("--c99"); break; case "c90": args.push("--c90"); break; } } else if (tag === "cpp") { // C++ language version flags. var knownCppLanguageValues = ["c++11", "c++03"]; var cppLanguageVersion = Cpp.languageVersion( input.cpp.cxxLanguageVersion, knownCppLanguageValues, "C++"); switch (cppLanguageVersion) { case "c++11": args.push("--cpp11"); break; default: // Default C++ language is C++03. args.push("--cpp"); break; } // Exceptions flags. var enableExceptions = input.cpp.enableExceptions; if (enableExceptions !== undefined) args.push(enableExceptions ? "--exceptions" : "--no_exceptions"); // RTTI flags. var enableRtti = input.cpp.enableRtti; if (enableRtti !== undefined) args.push(enableRtti ? "--rtti" : "--no_rtti"); } // Listing files generation flag. if (input.cpp.generateCompilerListingFiles) { args.push("--list"); args.push("--list_dir", FileInfo.path(outputs.lst[0].filePath)); } } else if (isArmClangCompiler(compilerPath)) { // Debug information flags. if (input.cpp.debugInformation) args.push("-g"); // Optimization level flags. switch (input.cpp.optimization) { case "small": args.push("-Oz") break; case "fast": args.push("-Ofast") break; case "none": args.push("-O0") break; } // Warning level flags. switch (input.cpp.warningLevel) { case "all": args.push("-Wall"); break; default: break; } if (input.cpp.treatWarningsAsErrors) args.push("-Werror"); if (tag === "c") { // C language version flags. var knownCLanguageValues = ["c11", "c99", "c90", "c89"]; var cLanguageVersion = Cpp.languageVersion( input.cpp.cLanguageVersion, knownCLanguageValues, "C"); if (cLanguageVersion) args.push("-std=" + cLanguageVersion); } else if (tag === "cpp") { // C++ language version flags. var knownCppLanguageValues = ["c++17", "c++14", "c++11", "c++03", "c++98"]; var cppLanguageVersion = Cpp.languageVersion( input.cpp.cxxLanguageVersion, knownCppLanguageValues, "C++"); if (cppLanguageVersion) args.push("-std=" + cppLanguageVersion); // Exceptions flags. var enableExceptions = input.cpp.enableExceptions; if (enableExceptions !== undefined) args.push(enableExceptions ? "-fexceptions" : "-fno-exceptions"); // RTTI flags. var enableRtti = input.cpp.enableRtti; if (enableRtti !== undefined) args.push(enableRtti ? "-frtti" : "-fno-rtti"); } // Listing files generation does not supported! // There are only a workaround: http://www.keil.com/support/docs/4152.htm } } // Misc flags. args = args.concat(Cpp.collectMiscCompilerArguments(input, tag), Cpp.collectMiscDriverArguments(input)); return args; } function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) { var args = []; var architecture = input.qbs.architecture; if (isMcsArchitecture(architecture) || isC166Architecture(architecture)) { // Input. args.push(input.filePath); // Output. 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.map(function(path) { return FileInfo.toWindowsSeparators(path); }).join(";") + ")"); // Debug information flags. if (input.cpp.debugInformation) args.push("DEBUG"); // Enable errors printing. args.push("EP"); // Listing files generation flag. if (!input.cpp.generateAssemblerListingFiles) args.push("NOPRINT"); else args.push("PRINT(" + FileInfo.toWindowsSeparators(outputs.lst[0].filePath) + ")"); } else if (isArmArchitecture(architecture)) { // Input. args.push(input.filePath); // Output. args.push("-o", outputs.obj[0].filePath); // Includes. args = args.concat(Cpp.collectIncludePathsArguments(input)); args = args.concat(Cpp.collectSystemIncludePathsArguments(input)); // Debug information flags. if (input.cpp.debugInformation) { args.push("--debug"); args.push("-g"); } // Warning level flags. if (input.cpp.warningLevel === "none") args.push("--no_warn"); // Byte order flags. var endianness = input.cpp.endianness; if (endianness) args.push((endianness === "little") ? "--littleend" : "--bigend"); // Listing files generation flag. if (input.cpp.generateAssemblerListingFiles) args.push("--list", outputs.lst[0].filePath); } // Misc flags. args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm")); return args; } function disassemblerFlags(project, product, input, outputs, explicitlyDependsOn) { var args = ["--disassemble", "--interleave=source"]; args.push(outputs.obj[0].filePath); args.push("--output=" + outputs.lst[0].filePath); return args; } function linkerFlags(project, product, inputs, outputs) { var args = []; var libraryPaths = Cpp.collectLibraryPaths(product); var architecture = product.qbs.architecture; if (isMcsArchitecture(architecture) || isC166Architecture(architecture)) { // Semi-intelligent handling the library paths. // We need to add the full path prefix to the library file if this // file is not absolute or not relative. Reason is that the C51, C251, // and C166 linkers does not support the library paths. function collectLibraryObjectPaths(product) { var libraryObjects = Cpp.collectLibraryDependencies(product); return libraryObjects.map(function(dep) { var filePath = dep.filePath; if (FileInfo.isAbsolutePath(filePath)) return filePath; for (var i = 0; i < libraryPaths.length; ++i) { var fullPath = FileInfo.joinPaths(libraryPaths[i], filePath); if (File.exists(fullPath)) return fullPath; } return filePath; }); } // Note: The C51, C251, or C166 linker does not distinguish an object files and // a libraries, it interpret all this stuff as an input objects, // so, we need to pass it together in one string. function collectAllObjectPathsArguments(product, inputs) { return [].concat(Cpp.collectLinkerObjectPaths(inputs), collectLibraryObjectPaths(product)); } // Add all input objects as arguments (application and library object files). var allObjectPaths = collectAllObjectPathsArguments(product, inputs); if (allObjectPaths.length > 0) args = args.concat(allObjectPaths.map(function(path) { return FileInfo.toWindowsSeparators(path); }).join(",")); // Output. args.push("TO", FileInfo.toWindowsSeparators(outputs.application[0].filePath)); // Map file generation flag. if (!product.cpp.generateLinkerMapFile) args.push("NOPRINT"); else args.push("PRINT(" + FileInfo.toWindowsSeparators(outputs.mem_map[0].filePath) + ")"); } else if (isArmArchitecture(architecture)) { // Inputs. args = args.concat(Cpp.collectLinkerObjectPaths(inputs)); // Output. args.push("--output", outputs.application[0].filePath); // Library paths. if (libraryPaths.length > 0) args.push(product.cpp.libraryPathFlag + libraryPaths.join(",")); // Library dependencies. args = args.concat(Cpp.collectLibraryDependenciesArguments(product)); // Linker scripts. args = args.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs, true)); // Map file generation flag. if (product.cpp.generateLinkerMapFile) args.push("--list", outputs.mem_map[0].filePath); // Entry point flag. if (product.cpp.entryPoint) args.push("--entry", product.cpp.entryPoint); // Debug information flag. var debugInformation = product.cpp.debugInformation; if (debugInformation !== undefined) args.push(debugInformation ? "--debug" : "--no_debug"); } // Misc flags. args = args.concat(Cpp.collectMiscEscapableLinkerArguments(product), Cpp.collectMiscLinkerArguments(product), Cpp.collectMiscDriverArguments(product)); return args; } function archiverFlags(project, product, inputs, outputs) { var args = []; // Inputs. var objectPaths = Cpp.collectLinkerObjectPaths(inputs); var architecture = product.qbs.architecture; if (isMcsArchitecture(architecture) || isC166Architecture(architecture)) { // Library creation command. args.push("TRANSFER"); // Inputs. if (objectPaths.length > 0) args = args.concat(objectPaths.map(function(path) { return FileInfo.toWindowsSeparators(path); }).join(",")); // Output. 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. // Output. args.push("--create", outputs.staticlibrary[0].filePath); // Inputs. args = args.concat(objectPaths); // Debug information flag. if (product.cpp.debugInformation) args.push("--debug_symbols"); } Array.prototype.push.apply(args, product.cpp.archiverFlags); return args; } // The ARMCLANG compiler does not support generation // for the listing files: // * https://www.keil.com/support/docs/4152.htm // So, we generate the listing files from the object files // using the disassembler. function generateClangCompilerListing(project, product, inputs, outputs, input, output) { if (isArmClangCompiler(input.cpp.compilerPath) && input.cpp.generateCompilerListingFiles) { var args = disassemblerFlags(project, product, input, outputs, explicitlyDependsOn); var disassemblerPath = input.cpp.disassemblerPath; var cmd = new Command(disassemblerPath, args); cmd.silent = true; return cmd; } } // The ARMCC compiler generates the listing files only in a short form, // e.g. to 'module.lst' instead of 'module.{c|cpp}.lst', that complicates // the auto-tests. Therefore we need to rename generated listing files // with correct unified names. function generateArmccCompilerListing(project, product, inputs, outputs, input, output) { if (isArmCCCompiler(input.cpp.compilerPath) && input.cpp.generateCompilerListingFiles) { var listingPath = FileInfo.path(outputs.lst[0].filePath); var cmd = new JavaScriptCommand(); cmd.oldListing = FileInfo.joinPaths(listingPath, input.baseName + ".lst"); cmd.newListing = FileInfo.joinPaths( listingPath, input.fileName + input.cpp.compilerListingSuffix); cmd.silent = true; cmd.sourceCode = function() { File.move(oldListing, newListing); }; return cmd; } } function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn); var compilerPath = input.cpp.compilerPath; var architecture = input.cpp.architecture; var cmd = new Command(compilerPath, args); cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "compiler"; if (isMcsArchitecture(architecture)) { cmd.maxExitCode = 1; cmd.stdoutFilterFunction = filterMcsOutput; } else if (isC166Architecture(architecture)) { cmd.maxExitCode = 1; cmd.stdoutFilterFunction = filterC166Output; } cmds.push(cmd); cmd = generateClangCompilerListing(project, product, inputs, outputs, input, output); if (cmd) cmds.push(cmd); cmd = generateArmccCompilerListing(project, product, inputs, outputs, input, output); if (cmd) cmds.push(cmd); return cmds; } function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var args = assemblerFlags(project, product, input, outputs, explicitlyDependsOn); var assemblerPath = input.cpp.assemblerPath; var architecture = input.cpp.architecture; var cmd = new Command(assemblerPath, args); cmd.description = "assembling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "assembler"; if (isMcsArchitecture(architecture)) { cmd.maxExitCode = 1; cmd.stdoutFilterFunction = filterMcsOutput; } else if (isC166Architecture(architecture)) { cmd.maxExitCode = 1; cmd.stdoutFilterFunction = filterC166Output; } return [cmd]; } function prepareLinker(project, product, inputs, outputs, input, output) { var primaryOutput = outputs.application[0]; var args = linkerFlags(project, product, inputs, outputs); var linkerPath = product.cpp.linkerPath; var architecture = product.cpp.architecture; var cmd = new Command(linkerPath, args); cmd.description = "linking " + primaryOutput.fileName; cmd.highlight = "linker"; cmd.jobPool = "linker"; if (isMcsArchitecture(architecture)) { cmd.maxExitCode = 1; cmd.stdoutFilterFunction = filterMcsOutput; } else if (isC166Architecture(architecture)) { cmd.maxExitCode = 1; cmd.stdoutFilterFunction = filterC166Output; } return [cmd]; } function prepareArchiver(project, product, inputs, outputs, input, output) { var args = archiverFlags(project, product, inputs, outputs); var archiverPath = product.cpp.archiverPath; var architecture = product.cpp.architecture; var cmd = new Command(archiverPath, args); cmd.description = "creating " + output.fileName; cmd.highlight = "linker"; cmd.jobPool = "linker"; if (isMcsArchitecture(architecture)) { cmd.stdoutFilterFunction = filterMcsOutput; } else if (isC166Architecture(architecture)) { cmd.stdoutFilterFunction = filterC166Output; } return [cmd]; } qbs-src-3.2.0/share/qbs/modules/cpp/qnx-qcc.qbs0000644000175100017510000000710115154533055020703 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.FileInfo UnixGCC { Depends { name: "qnx" } condition: qbs.targetOS.includes("qnx") && qbs.toolchain && qbs.toolchain.includes("qcc") priority: 1 distributionIncludePaths: FileInfo.joinPaths(qnx.targetDir, "usr", "include") toolchainInstallPath: FileInfo.joinPaths(qnx.hostDir, "usr", "bin") sysroot: qnx.targetDir sysrootFlags: sysroot ? [systemIncludeFlag + FileInfo.joinPaths(sysroot, "usr", "include")] : [] cCompilerName: "qcc" + compilerExtension cxxCompilerName: (qnx.qnx7 ? "q++" : "QCC") + compilerExtension targetDriverFlags: qnxTarget ? ["-V" + qnxTarget] : [] systemIncludeFlag: !qnx.qnx7 ? includeFlag : base property string qnxTarget: qbs.architecture ? qnx.compilerName + "_" + targetSystem + qnxTargetArchName : undefined property string qnxTargetArchName: { switch (qbs.architecture) { case "arm64": return "aarch64le"; case "armv7a": return "armv7le"; case "x86": case "x86_64": return qbs.architecture; } } // QNX doesn't support Objective-C or Objective-C++ and qcc/q++ don't use toolchainPrefix compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) compilerPathByLanguage: ({ "c": FileInfo.joinPaths(toolchainInstallPath, cCompilerName), "cpp": FileInfo.joinPaths(toolchainInstallPath, cxxCompilerName), "objc": undefined, "objcpp": undefined, "asm_cpp": FileInfo.joinPaths(toolchainInstallPath, cCompilerName) }) toolchainPrefix: target + "-" targetVendor: ["x86", "x86_64"].includes(qbs.architecture) ? "pc" : base targetSystem: "nto" targetAbi: "qnx" + qnx.version + (qnxTargetArchName === "armv7le" ? "eabi" : "") buildEnv: qnx.buildEnv probeEnv: buildEnv setupBuildEnvironment: { for (var key in product.cpp.buildEnv) { v = new ModUtils.EnvironmentVariable(key); v.value = product.cpp.buildEnv[key]; v.set(); } } } qbs-src-3.2.0/share/qbs/modules/cpp/watcom.js0000644000175100017510000005470115154533055020462 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2022 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Cpp = require("cpp.js"); var Environment = require("qbs.Environment"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var PathTools = require("qbs.PathTools"); var Process = require("qbs.Process"); var TemporaryDir = require("qbs.TemporaryDir"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); function toolchainDetails(qbs) { var platform = qbs.targetPlatform; var details = {}; if (platform === "dos") { details.imageFormat = "mz"; details.executableSuffix = ".exe"; } else if (platform === "os2") { details.imageFormat = "pe"; details.executableSuffix = ".exe"; details.dynamicLibrarySuffix = ".dll"; } else if (platform === "windows") { details.imageFormat = "pe"; details.executableSuffix = ".exe"; details.dynamicLibrarySuffix = ".dll"; } else if (platform === "linux") { details.imageFormat = "elf"; details.executableSuffix = ""; details.dynamicLibrarySuffix = ".so"; } return details; } function languageFlag(tag) { if (tag === "c") return "-xc"; else if (tag === "cpp") return "-xc++"; } function targetFlag(platform, architecture, type) { if (platform === "dos") { if (architecture === "x86_16") return "-bdos"; else if (architecture === "x86") return "-bdos4g"; } else if (platform === "os2") { if (architecture === "x86_16") return "-bos2"; else if (architecture === "x86") return "-bos2v2"; } else if (platform === "windows") { if (architecture === "x86_16") { if (type.includes("dynamiclibrary")) return "-bwindows_dll"; return "-bwindows"; } else if (architecture === "x86") { if (type.includes("dynamiclibrary")) return "-bnt_dll"; return "-bnt"; } } else if (platform === "linux") { return "-blinux"; } } function guessVersion(macros) { var version = parseInt(macros["__WATCOMC__"], 10) || parseInt(macros["__WATCOM_CPLUSPLUS__"], 10); if (version) { return { major: parseInt((version - 1100) / 100), minor: parseInt(version / 10) % 10, patch: ((version % 10) > 0) ? parseInt(version % 10) : 0 } } } function guessEnvironment(hostOs, platform, architecture, toolchainInstallPath, pathListSeparator) { var toolchainRootPath = FileInfo.path(toolchainInstallPath); if (!File.exists(toolchainRootPath)) { throw "Unable to deduce environment due to compiler root directory: '" + toolchainRootPath + "' does not exist"; } var env = {}; function setVariable(key, properties, path, separator) { var values = []; for (var i = 0; i < properties.length; ++i) { if (path) { var fullpath = FileInfo.joinPaths(path, properties[i]); values.push(FileInfo.toNativeSeparators(fullpath)); } else { values.push(properties[i]); } } env[key] = values.join(separator); } setVariable("WATCOM", [toolchainRootPath], undefined, pathListSeparator); setVariable("EDPATH", ["eddat"], toolchainRootPath, pathListSeparator); if (hostOs.includes("linux")) setVariable("PATH", ["binl64", "binl"], toolchainRootPath, pathListSeparator); else if (hostOs.includes("windows")) setVariable("PATH", ["binnt64", "binnt"], toolchainRootPath, pathListSeparator); if (platform === "linux") { setVariable("INCLUDE", ["lh"], toolchainRootPath, pathListSeparator); } else { // Common for DOS, Windows, OS/2. setVariable("WIPFC", ["wipfc"], toolchainRootPath, pathListSeparator); setVariable("WHTMLHELP", ["binnt/help"], toolchainRootPath, pathListSeparator); var includes = ["h"]; if (platform === "dos") { // Same includes as before. } else if (platform === "os2") { if (architecture === "x86") includes = includes.concat(["h/os2"]); else if (architecture === "x86_16") includes = includes.concat(["h/os21x"]); } else if (platform === "windows") { if (architecture === "x86") includes = includes.concat(["h/nt", "h/nt/directx", "h/nt/ddk"]); else if (architecture === "x86_16") includes = includes.concat(["h/win"]); } else { throw "Unable to deduce environment for unsupported target platform: '" + platform + "'"; } setVariable("INCLUDE", includes, toolchainRootPath, pathListSeparator); } return env; } function dumpMacros(environment, compilerPath, platform, architecture, tag) { // Note: The Open Watcom compiler does not support the predefined // macros dumping. So, we do it with the following trick, where we try // to create and compile a special temporary file and to parse the console // output with the own magic pattern: #define . var outputDirectory = new TemporaryDir(); var outputFilePath = FileInfo.joinPaths(outputDirectory.path(), "dump-macros.c"); var outputFile = new TextFile(outputFilePath, TextFile.WriteOnly); outputFile.writeLine("#define VALUE_TO_STRING(x) #x"); outputFile.writeLine("#define VALUE(x) VALUE_TO_STRING(x)"); outputFile.writeLine("#define VAR_NAME_VALUE(var) \"#define \"#var\" \"VALUE(var)"); // Declare all available pre-defined macros of Watcon compiler. var keys = [ // Prepare the DOS target macros. "__DOS__", "_DOS", "MSDOS", // Prepare the OS/2 target macros. "__OS2__", // Prepare the QNX target macros. "__QNX__", // Prepare the Netware target macros. "__NETWARE__", "__NETWARE_386__", // Prepare the Windows target macros. "__NT__", "__WINDOWS__", "_WINDOWS", "__WINDOWS_386__", // Prepare the Linux and Unix target macros. "__LINUX__", "__UNIX__", // Prepare the 16-bit target specific macros. "__I86__", "M_I86", "_M_I86", "_M_IX86", // Prepare the 32-bit target specific macros. "__386__", "M_I386", "_M_I386", "_M_IX86", // Prepare the indicated options macros. "_MT", "_DLL", "__FPI__", "__CHAR_SIGNED__", "__INLINE_FUNCTIONS__", "_CPPRTTI", "_CPPUNWIND", "NO_EXT_KEYS", // Prepare the common memory model macros. "__FLAT__", "__SMALL__", "__MEDIUM__", "__COMPACT__", "__LARGE__", "__HUGE__", // Prepare the 16-bit memory model macros. "M_I86SM", "_M_I86SM", "M_I86MM", "_M_I86MM", "M_I86CM", "_M_I86CM", "M_I86LM", "_M_I86LM", "M_I86HM", "_M_I86HM", // Prepare the 32-bit memory model macros. "M_386FM", "_M_386FM", "M_386SM", "M_386MM", "_M_386MM", "M_386CM", "_M_386CM", "M_386LM", "_M_386LM", // Prepare the compiler macros. "__X86__", "__cplusplus", "__WATCOMC__", "__WATCOM_CPLUSPLUS__", "_INTEGRAL_MAX_BITS", "_PUSHPOP_SUPPORTED", "_STDCALL_SUPPORTED", // Prepare the other macros. "__3R__", "_based", "_cdecl", "cdecl", "_export", "_far16", "_far", "far", "_fastcall", "_fortran", "fortran", "_huge", "huge", "_inline", "_interrupt", "interrupt", "_loadds", "_near", "near", "_pascal", "pascal", "_saveregs", "_segment", "_segname", "_self", "SOMDLINK", "_STDCALL_SUPPORTED", "__SW_0", "__SW_3R", "__SW_5", "__SW_FP287", "__SW_FP2", "__SW_FP387", "__SW_FP3", "__SW_FPI", "__SW_MF", "__SW_MS", "__SW_ZDP", "__SW_ZFP", "__SW_ZGF", "__SW_ZGP", "_stdcall", "_syscall", "__BIG_ENDIAN" ]; for (var i = 0; i < keys.length; ++i) { var key = keys[i]; outputFile.writeLine("#if defined(" + key + ")"); outputFile.writeLine("#pragma message (VAR_NAME_VALUE(" + key + "))"); outputFile.writeLine("#endif"); } outputFile.close(); var process = new Process(); process.setWorkingDirectory(outputDirectory.path()); for (var envkey in environment) process.setEnv(envkey, environment[envkey]); var target = targetFlag(platform, architecture, ["application"]); var lang = languageFlag(tag); var args = [ target, lang, outputFilePath ]; process.exec(compilerPath, args, false); var m = Cpp.extractMacros(process.readStdOut(), /"?(#define(\s\w+){1,2})"?$/); if (tag === "cpp" && m["__cplusplus"] === "1") return m; else if (tag === "c") return m; } function effectiveLinkerPath(product) { if (product.cpp.linkerMode === "automatic") { var compilerPath = product.cpp.compilerPath; if (compilerPath) return compilerPath; console.log("Found no C-language objects, choosing system linker for " + product.name); } return product.cpp.linkerPath; } function useCompilerDriverLinker(product) { var linker = effectiveLinkerPath(product); var compiler = product.cpp.compilerPath; return linker === compiler; } function escapeLinkerFlags(useCompilerDriver, linkerFlags) { if (!linkerFlags || linkerFlags.length === 0) return []; if (useCompilerDriver) { var sep = ","; return [["-Wl"].concat(linkerFlags).join(sep)]; } return linkerFlags; } function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) { var args = [FileInfo.toNativeSeparators(input.filePath)]; args.push("-fo=" + FileInfo.toNativeSeparators(outputs.obj[0].filePath)); args = args.concat(Cpp.collectPreincludePaths(input).map(function(path) { return "-fi" + FileInfo.toNativeSeparators(path); })); args = args.concat(Cpp.collectDefinesArguments(input, "-d")); var includePaths = [].concat(Cpp.collectIncludePaths(input)).concat( Cpp.collectSystemIncludePaths(input)); args = args.concat(includePaths.map(function(path) { return "-i" + FileInfo.toNativeSeparators(path); })); if (input.cpp.debugInformation) args.push("-d1"); var warnings = input.cpp.warningLevel if (warnings === "none") args.push("-w0"); else if (warnings === "all") args.push("-wx"); if (input.cpp.treatWarningsAsErrors) args.push("-we"); args.push("-zq"); // Silent. args = args.concat(Cpp.collectMiscAssemblerArguments(input)); return args; } function compilerFlags(project, product, input, outputs, explicitlyDependsOn) { var args = ["-g" + (input.cpp.debugInformation ? "3" : "0")]; var target = targetFlag(product.qbs.targetPlatform, product.qbs.architecture, product.type); args.push(target); if (product.type.includes("application")) { if (product.qbs.targetPlatform === "windows") { var consoleApplication = product.consoleApplication; args.push(consoleApplication ? "-mconsole" : "-mwindows"); } } else if (product.type.includes("dynamiclibrary")) { args.push("-shared"); } var optimization = input.cpp.optimization if (optimization === "fast") args.push("-Ot"); else if (optimization === "small") args.push("-Os"); else if (optimization === "none") args.push("-O0"); var warnings = input.cpp.warningLevel if (warnings === "none") { args.push("-w"); } else if (warnings === "all") { args.push("-Wall"); args.push("-Wextra"); } if (input.cpp.treatWarningsAsErrors) args.push("-Werror"); var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags)); var langFlag = languageFlag(tag); if (langFlag) args.push(langFlag); if (tag === "cpp") { var enableExceptions = input.cpp.enableExceptions; if (enableExceptions) { var ehModel = input.cpp.exceptionHandlingModel; switch (ehModel) { case "direct": args.push("-feh-direct"); break; case "table": args.push("-feh-table"); break; default: args.push("-feh"); break; } } else { args.push("-fno-eh"); } var enableRtti = input.cpp.enableRtti; args.push(enableRtti ? "-frtti" : "-fno-rtti"); } else if (tag === "c") { var knownValues = ["c99", "c89"]; var cLanguageVersion = Cpp.languageVersion(input.cpp.cLanguageVersion, knownValues, "C"); switch (cLanguageVersion) { case "c89": args.push("-std=c89"); break; case "c99": args.push("-std=c99"); break; } } var preincludePaths = Cpp.collectPreincludePaths(input); for (var i = 0; i < preincludePaths.length; ++i) args.push(input.cpp.preincludeFlag, preincludePaths[i]); args = args.concat(Cpp.collectDefinesArguments(input)); args = args.concat(Cpp.collectIncludePaths(input).map(function(path) { return input.cpp.includeFlag + FileInfo.toNativeSeparators(path); })); args = args.concat(Cpp.collectSystemIncludePaths(input).map(function(path) { return input.cpp.systemIncludeFlag + FileInfo.toNativeSeparators(path); })); args = args.concat(Cpp.collectMiscCompilerArguments(input, tag), Cpp.collectMiscDriverArguments(input)); args.push("-o", FileInfo.toNativeSeparators(outputs.obj[0].filePath)); args.push("-c", FileInfo.toNativeSeparators(input.filePath)); return args; } function resourceCompilerFlags(project, product, input, outputs) { var args = [input.filePath]; args.push("-fo=" + FileInfo.toNativeSeparators(outputs.res[0].filePath)); args = args.concat(Cpp.collectDefinesArguments(input, "-d")); args = args.concat(Cpp.collectIncludePaths(input).map(function(path) { return input.cpp.includeFlag + FileInfo.toNativeSeparators(path); })); args = args.concat(Cpp.collectSystemIncludePaths(input).map(function(path) { return input.cpp.includeFlag + FileInfo.toNativeSeparators(path); })); args.push("-q", "-ad", "-r"); return args; } function linkerFlags(project, product, inputs, outputs) { var args = []; var useCompilerDriver = useCompilerDriverLinker(product); if (useCompilerDriver) { var target = targetFlag(product.qbs.targetPlatform, product.qbs.architecture, product.type); args.push(target); if (product.type.includes("application")) { args.push("-o", FileInfo.toNativeSeparators(outputs.application[0].filePath)); if (product.cpp.generateLinkerMapFile) args.push("-fm=" + FileInfo.toNativeSeparators(outputs.mem_map[0].filePath)); } else if (product.type.includes("dynamiclibrary")) { if (product.qbs.targetPlatform === "windows") { args.push("-Wl, option implib=" + FileInfo.toNativeSeparators( outputs.dynamiclibrary_import[0].filePath)); } args.push("-o", FileInfo.toNativeSeparators(outputs.dynamiclibrary[0].filePath)) } var escapableLinkerFlags = []; var targetLinkerFlags = product.cpp.targetLinkerFlags; if (targetLinkerFlags) escapableLinkerFlags = escapableLinkerFlags.concat(targetLinkerFlags); escapableLinkerFlags = escapableLinkerFlags.concat( Cpp.collectMiscEscapableLinkerArguments(product)); var escapedLinkerFlags = escapeLinkerFlags(useCompilerDriver, escapableLinkerFlags); if (escapedLinkerFlags) args = args.concat(escapedLinkerFlags); args = args.concat(Cpp.collectLibraryPaths(product).map(function(path) { return product.cpp.libraryPathFlag + FileInfo.toNativeSeparators(path); })); args = args.concat(Cpp.collectLinkerObjectPaths(inputs).map(function(path) { return FileInfo.toNativeSeparators(path); })); var libraryDependencies = Cpp.collectLibraryDependencies(product); for (var i = 0; i < libraryDependencies.length; ++i) { var lib = libraryDependencies[i].filePath; if (FileInfo.isAbsolutePath(lib) || lib.startsWith('@')) args.push(FileInfo.toNativeSeparators(lib)); else args.push("-Wl, libfile " + lib); } var resourcePaths = Cpp.collectResourceObjectPaths(inputs).map(function(path) { return FileInfo.toNativeSeparators(path); }); if (resourcePaths.length > 0) args = args.concat("-Wl, resource " + resourcePaths.join(",")); } args = args.concat(Cpp.collectMiscLinkerArguments(product), Cpp.collectMiscDriverArguments(product)); return args; } function libraryManagerFlags(project, product, inputs, outputs) { var args = ["-b", "-n", "-q"]; args = args.concat(Cpp.collectLinkerObjectPaths(inputs).map(function(path) { return "+" + FileInfo.toNativeSeparators(path); })); args.push("-o", FileInfo.toNativeSeparators(outputs.staticlibrary[0].filePath)); return args; } function disassemblerFlags(project, product, inputs, outputs) { var objectPath = Cpp.relativePath(product.buildDirectory, outputs.obj[0].filePath); var listingPath = Cpp.relativePath(product.buildDirectory, outputs.lst[0].filePath); var args = []; args.push(FileInfo.toNativeSeparators(objectPath)); args.push("-l=" + FileInfo.toNativeSeparators(listingPath)); args.push("-s", "-a"); return args; } function generateCompilerListing(project, product, inputs, outputs, input, output) { var args = disassemblerFlags(project, product, input, outputs); var cmd = new Command(input.cpp.disassemblerPath, args); cmd.workingDirectory = product.buildDirectory; cmd.silent = true; cmd.jobPool = "watcom_job_pool"; return cmd; } function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; var args = assemblerFlags(project, product, input, outputs); var cmd = new Command(input.cpp.assemblerPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "assembling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "watcom_job_pool"; cmds.push(cmd); if (input.cpp.generateAssemblerListingFiles) cmds.push(generateCompilerListing(project, product, inputs, outputs, input, output)); return cmds; } function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn); var cmd = new Command(input.cpp.compilerPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "watcom_job_pool"; cmds.push(cmd); if (input.cpp.generateCompilerListingFiles) cmds.push(generateCompilerListing(project, product, inputs, outputs, input, output)); return cmds; } function prepareResourceCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var args = resourceCompilerFlags(project, product, input, outputs); var cmd = new Command(input.cpp.resourceCompilerPath, args); // Set working directory to source directory as a workaround // to make the resources compilable by resource compiler (it is magic). cmd.workingDirectory = product.sourceDirectory; cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "watcom_job_pool"; return [cmd]; } function prepareLinker(project, product, inputs, outputs, input, output) { var primaryOutput = outputs.dynamiclibrary ? outputs.dynamiclibrary[0] : outputs.application[0]; var args = linkerFlags(project, product, inputs, outputs); var linkerPath = effectiveLinkerPath(product); var cmd = new Command(linkerPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "linking " + primaryOutput.fileName; cmd.highlight = "linker"; cmd.jobPool = "watcom_job_pool"; return [cmd]; } function prepareLibraryManager(project, product, inputs, outputs, input, output) { var args = libraryManagerFlags(project, product, inputs, outputs); var cmd = new Command(product.cpp.archiverPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "linking " + outputs.staticlibrary[0].fileName; cmd.highlight = "linker"; cmd.jobPool = "watcom_job_pool"; return [cmd]; } qbs-src-3.2.0/share/qbs/modules/cpp/setuprunenv.js0000644000175100017510000001411115154533055021555 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); var File = require("qbs.File"); var Host = require("qbs.Host"); var ModUtils = require("qbs.ModUtils"); // TODO: append/prepend functionality should go to qbs.Environment function addNewElement(list, elem) { if (!list.includes(elem)) list.push(elem); } function artifactDir(artifact) { if (!artifact.qbs.install) return FileInfo.path(artifact.filePath); return FileInfo.path(ModUtils.artifactInstalledFilePath(artifact)); } function addExternalLibPath(product, list, path) { addNewElement(list, path); if (Host.os().includes("windows") && FileInfo.fileName(path) === "lib") { var binPath = FileInfo.joinPaths(FileInfo.path(path), "bin"); if (File.exists(binPath)) addNewElement(list, binPath); } } function gatherPaths(product, libPaths, frameworkPaths, seenProducts) { if (seenProducts.includes(product.name)) return; seenProducts.push(product.name); // Gather explicitly given library paths. if (product.cpp && product.cpp.libraryPaths) product.cpp.libraryPaths.forEach(function(p) { addExternalLibPath(product, libPaths, p); }); if (product.cpp && product.cpp.frameworkPaths) product.cpp.frameworkPaths.forEach(function(p) { addNewElement(frameworkPaths, p); }); if (product.cpp && product.cpp.systemFrameworkPaths) product.cpp.systemFrameworkPaths.forEach(function(p) { addNewElement(frameworkPaths, p); }); // Extract paths from dynamic libraries, if they are given as file paths. if (product.cpp && product.cpp.dynamicLibraries) { product.cpp.dynamicLibraries.forEach(function(dll) { if (FileInfo.isAbsolutePath(dll)) addExternalLibPath(product, libPaths, FileInfo.path(dll)); }); } // Traverse library dependencies. for (var i = 0; i < product.dependencies.length; ++i) { var dep = product.dependencies[i]; var dllSymlinkArtifacts = dep.artifacts["bundle.symlink.executable"]; if (dllSymlinkArtifacts) { var addArtifact = function(artifact) { addNewElement(frameworkPaths, FileInfo.path(artifactDir(artifact))); }; dllSymlinkArtifacts.forEach(addArtifact); // TODO: Will also catch applications. Can we prevent that? } else { addArtifact = function(artifact) { addNewElement(libPaths, artifactDir(artifact)); }; var dllArtifacts = dep.artifacts["dynamiclibrary"]; if (dllArtifacts) dllArtifacts.forEach(addArtifact); var loadableModuleArtifacts = dep.artifacts["loadablemodule"]; if (loadableModuleArtifacts) loadableModuleArtifacts.forEach(addArtifact); } if (!dep.hasOwnProperty("present")) // Recurse if the dependency is a product. TODO: Provide non-heuristic way to decide whether dependency is a product. gatherPaths(dep, libPaths, frameworkPaths, seenProducts); } } function setupRunEnvironment(product, config) { if (config.includes("ignore-lib-dependencies")) return; if (Host.platform() !== product.qbs.targetPlatform) return; var libPaths = []; var frameworkPaths = []; gatherPaths(product, libPaths, frameworkPaths, []); var runPaths = product.cpp ? product.cpp.systemRunPaths : undefined; if (runPaths && runPaths.length > 0) { var canonicalRunPaths = runPaths.map(function(p) { return File.canonicalFilePath(p); }); var filterFunc = function(libPath) { return !runPaths.includes(libPath) && !canonicalRunPaths.includes(File.canonicalFilePath(libPath)); }; libPaths = libPaths.filter(filterFunc); frameworkPaths = frameworkPaths.filter(filterFunc); } if (libPaths.length > 0) { var envVarName; if (product.qbs.targetOS.includes("windows")) envVarName = "PATH"; else if (product.qbs.targetOS.includes("macos")) envVarName = "DYLD_LIBRARY_PATH"; else envVarName = "LD_LIBRARY_PATH"; var envVar = new ModUtils.EnvironmentVariable(envVarName, FileInfo.pathListSeparator(), Host.os().includes("windows")); libPaths.forEach(function(p) { envVar.prepend(p); }); envVar.set(); } if (product.qbs.targetOS.includes("macos") && frameworkPaths.length > 0) { envVar = new ModUtils.EnvironmentVariable("DYLD_FRAMEWORK_PATH", ':', false); frameworkPaths.forEach(function(p) { envVar.prepend(p); }); envVar.set(); } } qbs-src-3.2.0/share/qbs/modules/cpp/tvos-gcc.qbs0000644000175100017510000000416415154533055021064 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ DarwinGCC { priority: 1 condition: qbs.targetOS.includes('tvos') && qbs.toolchain && qbs.toolchain.includes('gcc') targetSystem: "tvos" + (minimumTvosVersion || "") minimumDarwinVersion: minimumTvosVersion minimumDarwinVersionCompilerFlag: qbs.targetOS.includes("tvos-simulator") ? "-mtvos-simulator-version-min" : "-mtvos-version-min" minimumDarwinVersionLinkerFlag: qbs.targetOS.includes("tvos-simulator") ? "-tvos_simulator_version_min" : "-tvos_version_min" } qbs-src-3.2.0/share/qbs/modules/cpp/iar.js0000644000175100017510000006307515154533055017747 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Cpp = require("cpp.js"); var Environment = require("qbs.Environment"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var Process = require("qbs.Process"); var TemporaryDir = require("qbs.TemporaryDir"); var TextFile = require("qbs.TextFile"); function supportXLinker(architecture) { return architecture === "78k" || architecture === "avr" || architecture === "avr32" || architecture === "cr16" || architecture === "hcs12" || architecture === "hcs8" || architecture === "m16c" || architecture === "m32c" || architecture === "m68k" || architecture === "mcs51" || architecture === "msp430" || architecture === "r32c" || architecture === "v850"; } function supportILinker(architecture) { return architecture.startsWith("arm") || architecture === "rh850" || architecture === "riscv" || architecture === "rl78" || architecture === "rx" || architecture === "sh" || architecture === "stm8"; } function supportXArchiver(architecture) { return architecture === "78k" || architecture === "avr" || architecture === "avr32" || architecture === "cr16" || architecture === "hcs12" || architecture === "hcs8" || architecture === "m16c" || architecture === "m32c" || architecture === "m68k" || architecture === "mcs51" || architecture === "msp430" || architecture === "r32c" || architecture === "v850"; } function supportIArchiver(architecture) { return architecture.startsWith("arm") || architecture === "rh850" || architecture === "riscv" || architecture === "rl78" || architecture === "rx" || architecture === "sh" || architecture === "stm8"; } function supportXAssembler(architecture) { return architecture.startsWith("arm") || architecture === "78k" || architecture === "avr" || architecture === "hcs12" || architecture === "m16c" || architecture === "mcs51" || architecture === "msp430" || architecture === "m32c" || architecture === "v850"; } function supportIAssembler(architecture) { return architecture === "avr32" || architecture === "cr16" || architecture === "hcs8" || architecture === "r32c" || architecture === "rh850" || architecture === "riscv" || architecture === "rl78" || architecture === "rx" || architecture === "sh" || architecture === "stm8" || architecture === "m68k"; } function supportEndianness(architecture) { return architecture.startsWith("arm") || architecture === "rx"; } function supportCppExceptions(architecture) { return architecture.startsWith("arm") || architecture === "rh850" || architecture === "riscv" || architecture === "rl78" || architecture === "rx"; } function supportCppRtti(architecture) { return architecture.startsWith("arm") || architecture === "rh850" || architecture === "riscv" || architecture === "rl78" || architecture === "rx"; } function supportCppWarningAboutCStyleCast(architecture) { return architecture.startsWith("arm") || architecture === "avr" || architecture === "avr32" || architecture === "cr16" || architecture === "mcs51" || architecture === "msp430" || architecture === "rh850" || architecture === "rl78" || architecture === "rx" || architecture === "stm8" || architecture === "v850"; } function supportDeprecatedFeatureWarnings(architecture) { return architecture.startsWith("arm") || architecture === "avr" || architecture === "cr16" || architecture === "mcs51" || architecture === "msp430" || architecture === "rh850" || architecture === "rl78" || architecture === "rx" || architecture === "stm8" || architecture === "v850"; } function supportCLanguageVersion(architecture) { return architecture !== "78k"; } function supportCppLanguage(compilerFilePath) { var baseName = FileInfo.baseName(compilerFilePath); return baseName !== "iccs08"; } // It is a 'magic' IAR-specific target architecture code. function architectureCode(architecture) { switch (architecture) { case "78k": return "26"; case "avr": return "90"; case "avr32": return "82"; case "mcs51": return "51"; case "msp430": return "43"; case "v850": return "85"; case "m68k": return "68"; case "m32c": return "48"; case "r32c": return "53"; case "m16c": return "34"; case "cr16": return "45"; case "hcs12": return "12"; case "hcs8": return "78"; case "rh850": case "riscv": case "rl78": case "rx": case "sh": case "stm8": return ""; default: if (architecture.startsWith("arm")) return ""; break; } } function toolchainDetails(qbs) { var architecture = qbs.architecture; var code = architectureCode(architecture); var details = {}; if (supportXLinker(architecture)) { details.libraryPathFlag = "-I"; details.linkerScriptFlag = "-f"; details.linkerName = "xlink"; details.linkerSilentFlag = "-S"; details.linkerMapFileFlag = "-l"; details.linkerEntryPointFlag = "-s"; } else if (supportILinker(architecture)) { details.libraryPathFlag = "-L"; details.linkerScriptFlag = "--config"; details.linkerSilentFlag = "--silent"; details.linkerMapFileFlag = "--map"; details.linkerEntryPointFlag = "--entry"; details.linkerName = architecture.startsWith("arm") ? "ilinkarm" : ("ilink" + architecture); } if (supportXArchiver(architecture)) details.archiverName = "xar"; else if (supportIArchiver(architecture)) details.archiverName = "iarchive"; var hasCode = (code !== ""); details.staticLibrarySuffix = hasCode ? (".r" + code) : ".a"; details.executableSuffix = hasCode ? ((qbs.debugInformation) ? (".d" + code) : (".a" + code)) : ".out"; details.objectSuffix = hasCode ? (".r" + code) : ".o"; details.imageFormat = hasCode ? "ubrof" : "elf"; if (architecture.startsWith("arm")) { details.compilerName = "iccarm"; details.assemblerName = "iasmarm"; } else if (architecture === "78k") { details.compilerName = "icc78k"; details.assemblerName = "a78k"; } else if (architecture === "avr") { details.compilerName = "iccavr"; details.assemblerName = "aavr"; } else if (architecture === "avr32") { details.compilerName = "iccavr32"; details.assemblerName = "aavr32"; } else if (architecture === "cr16") { details.compilerName = "icccr16c"; details.assemblerName = "acr16c"; } else if (architecture === "hcs12") { details.compilerName = "icchcs12"; details.assemblerName = "ahcs12"; } else if (architecture === "hcs8") { details.compilerName = "iccs08"; details.assemblerName = "as08"; } else if (architecture === "m16c") { details.compilerName = "iccm16c"; details.assemblerName = "am16c"; } else if (architecture === "m32c") { details.compilerName = "iccm32c"; details.assemblerName = "am32c"; } else if (architecture === "m68k") { details.compilerName = "icccf"; details.assemblerName = "acf"; } else if (architecture === "mcs51") { details.compilerName = "icc8051"; details.assemblerName = "a8051"; } else if (architecture === "msp430") { details.compilerName = "icc430"; details.assemblerName = "a430"; } else if (architecture === "r32c") { details.compilerName = "iccr32c"; details.assemblerName = "ar32c"; } else if (architecture === "rh850") { details.compilerName = "iccrh850"; details.assemblerName = "iasmrh850"; } else if (architecture === "riscv") { details.compilerName = "iccriscv"; details.assemblerName = "iasmriscv"; } else if (architecture === "rl78") { details.compilerName = "iccrl78"; details.assemblerName = "iasmrl78"; } else if (architecture === "rx") { details.compilerName = "iccrx"; details.assemblerName = "iasmrx"; } else if (architecture === "sh") { details.compilerName = "iccsh"; details.assemblerName = "iasmsh"; } else if (architecture === "stm8") { details.compilerName = "iccstm8"; details.assemblerName = "iasmstm8"; } else if (architecture === "v850") { details.compilerName = "iccv850"; details.assemblerName = "av850"; } return details; } function guessArmArchitecture(core) { var arch = "arm"; if (core === "__ARM4M__") arch += "v4m"; else if (core === "__ARM4TM__") arch += "v4tm"; else if (core === "__ARM5E__") arch += "v5e"; else if (core === "__ARM5__") arch += "v5"; else if (core === "__ARM6M__") arch += "v6m"; else if (core === "__ARM6SM__") arch += "v6sm"; else if (core === "__ARM6__") arch += "v6"; else if (core === "__ARM7M__") arch += "v7m"; else if (core === "__ARM7R__") arch += "v7r"; return arch; } function guessArchitecture(macros) { if (macros["__ICC430__"] === "1") return "msp430"; else if (macros["__ICC78K__"] === "1") return "78k"; else if (macros["__ICC8051__"] === "1") return "mcs51"; else if (macros["__ICCARM__"] === "1") return guessArmArchitecture(macros["__CORE__"]); else if (macros["__ICCAVR32__"] === "1") return "avr32"; else if (macros["__ICCAVR__"] === "1") return "avr"; else if (macros["__ICCCF__"] === "1") return "m68k"; else if (macros["__ICCCR16C__"] === "1") return "cr16"; else if (macros["__ICCHCS12__"] === "1") return "hcs12"; else if (macros["__ICCM16C__"] === "1") return "m16c"; else if (macros["__ICCM32C__"] === "1") return "m32c"; else if (macros["__ICCR32C__"] === "1") return "r32c"; else if (macros["__ICCRH850__"] === "1") return "rh850"; else if (macros["__ICCRISCV__"] === "1") return "riscv"; else if (macros["__ICCRL78__"] === "1") return "rl78"; else if (macros["__ICCRX__"] === "1") return "rx"; else if (macros["__ICCS08__"] === "1") return "hcs8"; else if (macros["__ICCSH__"] === "1") return "sh"; else if (macros["__ICCSTM8__"] === "1") return "stm8"; else if (macros["__ICCV850__"] === "1") return "v850"; } function guessEndianness(macros) { if (macros["__LITTLE_ENDIAN__"] === "1") return "little"; return "big" } function guessVersion(macros, architecture) { var version = parseInt(macros["__VER__"], 10); if (architecture.startsWith("arm")) { return { major: parseInt(version / 1000000), minor: parseInt(version / 1000) % 1000, patch: parseInt(version) % 1000 } } else if (architecture === "78k" || architecture === "avr" || architecture === "avr32" || architecture === "cr16" || architecture === "hcs12" || architecture === "hcs8" || architecture === "m16c" || architecture === "m32c" || architecture === "m68k" || architecture === "mcs51" || architecture === "msp430" || architecture === "r32c" || architecture === "rh850" || architecture === "riscv" || architecture === "rl78" || architecture === "rx" || architecture === "sh" || architecture === "stm8" || architecture === "v850") { return { major: parseInt(version / 100), minor: parseInt(version % 100), patch: 0 } } } function cppLanguageOption(compilerFilePath) { var baseName = FileInfo.baseName(compilerFilePath); switch (baseName) { case "iccarm": case "iccrh850": case "iccriscv": case "iccrl78": case "iccrx": return "--c++"; case "icc430": case "icc78k": case "icc8051": case "iccavr": case "iccavr32": case "icccf": case "icccr16c": case "icchcs12": case "iccm16c": case "iccm32c": case "iccr32c": case "iccsh": case "iccstm8": case "iccv850": return "--ec++"; } } function dumpMacros(compilerFilePath, tag) { var tempDir = new TemporaryDir(); var inFilePath = FileInfo.fromNativeSeparators(tempDir.path() + "/empty-source.c"); var inFile = new TextFile(inFilePath, TextFile.WriteOnly); var outFilePath = FileInfo.fromNativeSeparators(tempDir.path() + "/iar-macros.predef"); var args = [ inFilePath, "--predef_macros", outFilePath ]; if (tag === "cpp" && supportCppLanguage(compilerFilePath)) args.push(cppLanguageOption(compilerFilePath)); var p = new Process(); p.setWorkingDirectory(tempDir.path()); p.exec(compilerFilePath, args, true); var outFile = new TextFile(outFilePath, TextFile.ReadOnly); return Cpp.extractMacros(outFile.readAll()); } function dumpCompilerIncludePaths(compilerFilePath, tag) { // We can dump the compiler include paths using the undocumented `--IDE3` flag, // e.g. which also is used in the IAR extension for the VSCode. In this case the // compiler procuces the console output in the following format: // `$$TOOL_BEGIN $$VERSION "3" $$INC_BEGIN $$FILEPATH "" $$TOOL_END` var tempDir = new TemporaryDir(); var inFilePath = FileInfo.fromNativeSeparators(tempDir.path() + "/empty-source.c"); var inFile = new TextFile(inFilePath, TextFile.WriteOnly); var args = ["--IDE3", inFilePath]; if (tag === "cpp" && supportCppLanguage(compilerFilePath)) args.push(cppLanguageOption(compilerFilePath)); var includePaths = []; var p = new Process(); p.setWorkingDirectory(tempDir.path()); // It is possible that the process can return an error code in case the // compiler does not support the `--IDE3` flag. So, don't throw an error in this case. p.exec(compilerFilePath, args, false); p.readStdOut().trim().split(/\r?\n/g).map(function(line) { var m = line.match(/\$\$INC_BEGIN\s\$\$FILEPATH\s\"([^"]*)/); if (m) { var includePath = m[1].replace(/\\\\/g, '/'); if (includePath && File.exists(includePath)) includePaths.push(includePath); } }); if (includePaths.length === 0) { // This can happen if the compiler does not support the `--IDE3` flag, // e.g. IAR for S08 architecture. In this case we use fallback to the // detection of the `inc` directory. var includePath = FileInfo.joinPaths(FileInfo.path(compilerFilePath), "../inc/"); if (File.exists(includePath)) includePaths.push(includePath); } return includePaths; } function dumpDefaultPaths(compilerFilePath, tag) { var includePaths = dumpCompilerIncludePaths(compilerFilePath, tag); return { "includePaths": includePaths }; } function compilerFlags(project, product, input, outputs, explicitlyDependsOn) { var args = []; // Input. args.push(input.filePath); // Output. args.push("-o", outputs.obj[0].filePath); // Preinclude headers. args = args.concat(Cpp.collectPreincludePathsArguments(input, true)); // Defines. args = args.concat(Cpp.collectDefinesArguments(input)); // Includes. args = args.concat(Cpp.collectIncludePathsArguments(input)); args = args.concat(Cpp.collectSystemIncludePathsArguments(input)); // Silent output generation flag. args.push("--silent"); // Debug information flags. if (input.cpp.debugInformation) args.push("--debug"); // Optimization flags. switch (input.cpp.optimization) { case "small": args.push("-Ohz"); break; case "fast": args.push("-Ohs"); break; case "none": args.push("-On"); break; } var architecture = input.qbs.architecture; var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags)); // Warning level flags. switch (input.cpp.warningLevel) { case "none": args.push("--no_warnings"); break; case "all": if (supportDeprecatedFeatureWarnings(architecture)) { args.push("--deprecated_feature_warnings=" +"+attribute_syntax," +"+preprocessor_extensions," +"+segment_pragmas"); } if (tag === "cpp" && supportCppWarningAboutCStyleCast(architecture)) args.push("--warn_about_c_style_casts"); break; } if (input.cpp.treatWarningsAsErrors) args.push("--warnings_are_errors"); // C language version flags. if (tag === "c" && supportCLanguageVersion(architecture)) { var knownValues = ["c89"]; var cLanguageVersion = Cpp.languageVersion( input.cpp.cLanguageVersion, knownValues, "C"); switch (cLanguageVersion) { case "c89": args.push("--c89"); break; default: // Default C language version is C18/C11/C99 that // depends on the IAR version. break; } } // C++ language version flags. var compilerFilePath = input.cpp.compilerPath; if (tag === "cpp" && supportCppLanguage(compilerFilePath)) { // C++ language flag. var cppOption = cppLanguageOption(compilerFilePath); args.push(cppOption); // Exceptions flag. var enableExceptions = input.cpp.enableExceptions; if (!enableExceptions && supportCppExceptions(architecture)) args.push("--no_exceptions"); // RTTI flag. var enableRtti = input.cpp.enableRtti; if (!enableRtti && supportCppRtti(architecture)) args.push("--no_rtti"); } // Byte order flags. var endianness = input.cpp.endianness; if (endianness && supportEndianness(architecture)) args.push("--endian=" + endianness); // Listing files generation flag. if (input.cpp.generateCompilerListingFiles) args.push("-l", outputs.lst[0].filePath); // Misc flags. args = args.concat(Cpp.collectMiscCompilerArguments(input, tag), Cpp.collectMiscDriverArguments(product)); return args; } function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) { var args = []; // Input. args.push(input.filePath); // Output. args.push("-o", outputs.obj[0].filePath); var architecture = input.qbs.architecture; // The `--preinclude` flag is only supported for a certain // set of assemblers, not for all. if (supportIAssembler(architecture)) args = args.concat(Cpp.collectPreincludePathsArguments(input)); // Includes. args = args.concat(Cpp.collectIncludePathsArguments(input)); args = args.concat(Cpp.collectSystemIncludePathsArguments(input)); // Debug information flags. if (input.cpp.debugInformation) args.push("-r"); // Architecture specific flags. if (supportIAssembler(architecture)) { // Silent output generation flag. args.push("--silent"); // Warning level flags. if (input.cpp.warningLevel === "none") args.push("--no_warnings"); if (input.cpp.treatWarningsAsErrors) args.push("--warnings_are_errors"); } else if (supportXAssembler(architecture)){ // Silent output generation flag. args.push("-S"); // Warning level flags. args.push("-w" + (input.cpp.warningLevel === "none" ? "-" : "+")); } // Byte order flags. var endianness = input.cpp.endianness; if (endianness && supportEndianness(architecture)) args.push("--endian", endianness); // Listing files generation flag. if (input.cpp.generateAssemblerListingFiles) args.push("-l", outputs.lst[0].filePath); // Misc flags. args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm")); return args; } function linkerFlags(project, product, inputs, outputs) { var args = []; // Inputs. args = args.concat(Cpp.collectLinkerObjectPaths(inputs)); // Output. args.push("-o", outputs.application[0].filePath); // Library paths. args = args.concat(Cpp.collectLibraryPathsArguments(product)); // Library dependencies. args = args.concat(Cpp.collectLibraryDependenciesArguments(product)); // Linker scripts. args = args.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs, true)); // Silent output generation flag. args.push(product.cpp.linkerSilentFlag); // Map file generation flag. if (product.cpp.generateLinkerMapFile) args.push(product.cpp.linkerMapFileFlag, outputs.mem_map[0].filePath); // Entry point flag. if (product.cpp.entryPoint) args.push(product.cpp.linkerEntryPointFlag, product.cpp.entryPoint); // Debug information flag. if (supportXLinker(product.qbs.architecture)) { if (product.cpp.debugInformation) args.push("-rt"); } // Misc flags. args = args.concat(Cpp.collectMiscEscapableLinkerArguments(product), Cpp.collectMiscLinkerArguments(product), Cpp.collectMiscDriverArguments(product)); return args; } function archiverFlags(project, product, inputs, outputs) { var args = []; // Inputs. args = args.concat(Cpp.collectLinkerObjectPaths(inputs)); // Output. var architecture = product.qbs.architecture; if (supportIArchiver(architecture)) args.push("--create"); args.push("-o", outputs.staticlibrary[0].filePath); Array.prototype.push.apply(args, product.cpp.archiverFlags); return args; } function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn); var compilerPath = input.cpp.compilerPath; var cmd = new Command(compilerPath, args); cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "compiler"; return [cmd]; } function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var args = assemblerFlags(project, product, input, outputs, explicitlyDependsOn); var assemblerPath = input.cpp.assemblerPath; var cmd = new Command(assemblerPath, args); cmd.description = "assembling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "assembler"; return [cmd]; } function prepareLinker(project, product, inputs, outputs, input, output) { var primaryOutput = outputs.application[0]; var args = linkerFlags(project, product, inputs, outputs); var linkerPath = product.cpp.linkerPath; var cmd = new Command(linkerPath, args); cmd.description = "linking " + primaryOutput.fileName; cmd.highlight = "linker"; cmd.jobPool = "linker"; return [cmd]; } function prepareArchiver(project, product, inputs, outputs, input, output) { var args = archiverFlags(project, product, inputs, outputs); var archiverPath = product.cpp.archiverPath; var cmd = new Command(archiverPath, args); cmd.description = "creating " + output.fileName; cmd.highlight = "linker"; cmd.jobPool = "linker"; cmd.stdoutFilterFunction = function(output) { return ""; }; return [cmd]; } qbs-src-3.2.0/share/qbs/modules/cpp/windows-mingw.qbs0000644000175100017510000000737315154533055022155 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.ModUtils import qbs.Utilities import 'cpp.js' as Cpp import "setuprunenv.js" as SetupRunEnv MingwBaseModule { condition: qbs.targetOS.includes("windows") && qbs.toolchain && qbs.toolchain.includes("mingw") priority: 0 probeEnv: buildEnv property string windresName: "windres" + compilerExtension property path windresPath: { var filePath = toolchainPathPrefix + windresName; if (!File.exists(filePath)) filePath = FileInfo.joinPaths(toolchainInstallPath, windresName); return filePath; } setupBuildEnvironment: { var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), true); v.prepend(product.cpp.toolchainInstallPath); v.set(); } setupRunEnvironment: { var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), true); v.prepend(product.cpp.toolchainInstallPath); v.set(); SetupRunEnv.setupRunEnvironment(product, config); } Rule { inputs: ["rc"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.resourceCompilerOutputTags() outputArtifacts: Cpp.resourceCompilerOutputArtifacts(input) prepare: { var platformDefines = input.cpp.platformDefines; var defines = input.cpp.defines; var includePaths = input.cpp.includePaths; var systemIncludePaths = input.cpp.systemIncludePaths; var args = []; var i; for (i in platformDefines) { args.push('-D'); args.push(platformDefines[i]); } args = args.concat(Cpp.collectDefinesArguments(input)); args = args.concat(Cpp.collectIncludePathsArguments(input)); args = args.concat(Cpp.collectSystemIncludePathsArguments(input, "-I")); args.push("-O", "coff"); // Set COFF format explicitly. args = args.concat(['-i', input.filePath, '-o', output.filePath]); var cmd = new Command(product.cpp.windresPath, args); cmd.description = 'compiling ' + input.fileName; cmd.highlight = 'compiler'; return cmd; } } } qbs-src-3.2.0/share/qbs/modules/cpp/sdcc.js0000644000175100017510000005026215154533055020102 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var BinaryFile = require("qbs.BinaryFile"); var Cpp = require("cpp.js"); var Environment = require("qbs.Environment"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var Host = require("qbs.Host"); var ModUtils = require("qbs.ModUtils"); var PathTools = require("qbs.PathTools"); var Process = require("qbs.Process"); var TemporaryDir = require("qbs.TemporaryDir"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); var WindowsUtils = require("qbs.WindowsUtils"); function toolchainDetails(qbs) { var architecture = qbs.architecture; if (architecture === "mcs51") { return { "assemblerName": "sdas8051", "linkerName": "sdld" } } else if (architecture === "stm8") { return { "assemblerName": "sdasstm8", "linkerName": "sdldstm8" } } else if (architecture === "hcs8") { return { "assemblerName": "sdas6808", "linkerName": "sdld6808" } } } function targetArchitectureFlag(architecture) { if (architecture === "mcs51") return "-mmcs51"; if (architecture === "stm8") return "-mstm8"; if (architecture === "hcs8") return "-mhc08"; } function guessArchitecture(macros) { if (macros["__SDCC_mcs51"] === "1") return "mcs51"; if (macros["__SDCC_stm8"] === "1") return "stm8"; if (macros["__SDCC_hc08"] === "1") return "hcs8"; } function guessEndianness(macros) { // SDCC stores numbers in little-endian format. return "little"; } function guessVersion(macros) { if ("__SDCC_VERSION_MAJOR" in macros && "__SDCC_VERSION_MINOR" in macros && "__SDCC_VERSION_PATCH" in macros) { return { major: parseInt(macros["__SDCC_VERSION_MAJOR"], 10), minor: parseInt(macros["__SDCC_VERSION_MINOR"], 10), patch: parseInt(macros["__SDCC_VERSION_PATCH"], 10) } } else if ("__SDCC" in macros) { var versions = macros["__SDCC"].split("_"); if (versions.length === 3) { return { major: parseInt(versions[0], 10), minor: parseInt(versions[1], 10), patch: parseInt(versions[2], 10) }; } } } function dumpMacros(compilerFilePath, architecture) { var tempDir = new TemporaryDir(); var fakeIn = new TextFile(tempDir.path() + "/empty-source.c", TextFile.WriteOnly); var args = [ fakeIn.filePath(), "-dM", "-E" ]; var targetFlag = targetArchitectureFlag(architecture); if (targetFlag) args.push(targetFlag); var p = new Process(); p.exec(compilerFilePath, args, true); return Cpp.extractMacros(p.readStdOut()); } function dumpDefaultPaths(compilerFilePath, architecture) { var args = [ "--print-search-dirs" ]; var targetFlag = targetArchitectureFlag(architecture); if (targetFlag) args.push(targetFlag); var p = new Process(); p.exec(compilerFilePath, args, true); var includePaths = []; var addIncludePaths = false; var lines = p.readStdOut().trim().split(/\r?\n/g); for (var i in lines) { var line = lines[i]; if (line.startsWith("includedir:")) { addIncludePaths = true; } else if (line.startsWith("programs:") || line.startsWith("datadir:") || line.startsWith("libdir:") || line.startsWith("libpath:")) { addIncludePaths = false; } else if (addIncludePaths) { if (File.exists(line)) includePaths.push(line); } } return { "includePaths": includePaths } } function effectiveLinkerPath(product) { if (product.cpp.linkerMode === "automatic") return product.cpp.compilerPath; return product.cpp.linkerPath; } function useCompilerDriverLinker(product) { var linker = effectiveLinkerPath(product); return linker === product.cpp.compilerPath; } function escapeLinkerFlags(product, linkerFlags) { if (!linkerFlags || linkerFlags.length === 0 || !useCompilerDriverLinker(product)) return linkerFlags; return ["-Wl " + linkerFlags.join(",")]; } function escapePreprocessorFlags(preprocessorFlags) { if (!preprocessorFlags || preprocessorFlags.length === 0) return preprocessorFlags; return ["-Wp " + preprocessorFlags.join(",")]; } // We need to use the asm_adb, asm_src, asm_sym and rst_data // artifacts without of any conditions. Because SDCC always generates // it (and seems, this behavior can not be disabled for SDCC). function extraCompilerOutputTags() { return ["asm_adb", "asm_src", "asm_sym", "rst_data"]; } // We need to use the lk_cmd, and mem_summary artifacts without // of any conditions. Because SDCC always generates // it (and seems, this behavior can not be disabled for SDCC). function extraApplicationLinkerOutputTags() { return ["lk_cmd", "mem_summary"]; } // We need to use the asm_adb, asm_src, asm_sym and rst_data // artifacts without of any conditions. Because SDCC always generates // it (and seems, this behavior can not be disabled for SDCC). function extraCompilerOutputArtifacts(input) { return [{ fileTags: ["asm_adb"], filePath: Utilities.getHash(input.baseDir) + "/" + input.fileName + ".adb" }, { fileTags: ["asm_src"], filePath: Utilities.getHash(input.baseDir) + "/" + input.fileName + ".asm" }, { fileTags: ["asm_sym"], filePath: Utilities.getHash(input.baseDir) + "/" + input.fileName + ".sym" }, { fileTags: ["rst_data"], filePath: Utilities.getHash(input.baseDir) + "/" + input.fileName + ".rst" }]; } // We need to use the lk_cmd, and mem_summary artifacts without // of any conditions. Because SDCC always generates // it (and seems, this behavior can not be disabled for SDCC). function extraApplicationLinkerOutputArtifacts(product) { return [{ fileTags: ["lk_cmd"], filePath: FileInfo.joinPaths( product.destinationDirectory, product.targetName + ".lk") }, { fileTags: ["mem_summary"], filePath: FileInfo.joinPaths( product.destinationDirectory, product.targetName + ".mem") }]; } function compilerFlags(project, product, input, outputs, explicitlyDependsOn) { var args = []; var escapablePreprocessorFlags = []; // Input. args.push(input.filePath); // Output. args.push("-c"); args.push("-o", outputs.obj[0].filePath); // Prefix headers. escapablePreprocessorFlags = escapablePreprocessorFlags.concat( Cpp.collectPreincludePathsArguments(input)); // Defines. args = args.concat(Cpp.collectDefinesArguments(input)); // Includes. args = args.concat(Cpp.collectIncludePathsArguments(input)); escapablePreprocessorFlags = escapablePreprocessorFlags.concat( Cpp.collectSystemIncludePathsArguments(input)); // Target MCU flag. var targetFlag = targetArchitectureFlag(input.cpp.architecture); if (targetFlag) args.push(targetFlag); // Debug information flags. if (input.cpp.debugInformation) args.push("--debug"); // Optimization level flags. switch (input.cpp.optimization) { case "small": args.push("--opt-code-size"); break; case "fast": args.push("--opt-code-speed"); break; case "none": // SDCC has not option to disable the optimization. break; } // Warning level flags. var warnings = input.cpp.warningLevel if (warnings === "none") { args.push("--less-pedantic"); escapablePreprocessorFlags.push("-w"); } else if (warnings === "all") { escapablePreprocessorFlags.push("-Wall"); } if (input.cpp.treatWarningsAsErrors) args.push("--Werror"); // Determine which C-language we"re compiling. var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags)); // C language version flags. if (tag === "c") { var knownValues = ["c2x", "c17", "c11", "c99", "c89"]; var cLanguageVersion = Cpp.languageVersion( input.cpp.cLanguageVersion, knownValues, "C"); switch (cLanguageVersion) { case "c17": cLanguageVersion = "c11"; // fall through case "c89": case "c99": case "c11": case "c2x": args.push("--std-" + cLanguageVersion); break; } } var escapedPreprocessorFlags = escapePreprocessorFlags(escapablePreprocessorFlags); if (escapedPreprocessorFlags) Array.prototype.push.apply(args, escapedPreprocessorFlags); // Misc flags. args = args.concat(Cpp.collectMiscCompilerArguments(input, tag), Cpp.collectMiscDriverArguments(input)); return args; } function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) { var args = []; // Includes. args = args.concat(Cpp.collectIncludePathsArguments(input)); args = args.concat(Cpp.collectSystemIncludePathsArguments(input, input.cpp.includeFlag)); // Misc flags. args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm")); args.push("-ol"); args.push(outputs.obj[0].filePath); args.push(input.filePath); return args; } function linkerFlags(project, product, inputs, outputs) { var args = []; // Target MCU flag. var targetFlag = targetArchitectureFlag(product.cpp.architecture); if (targetFlag) args.push(targetFlag); var escapableLinkerFlags = []; // Map file generation flag. if (product.cpp.generateLinkerMapFile) escapableLinkerFlags.push("-m"); escapableLinkerFlags = escapableLinkerFlags.concat(Cpp.collectMiscEscapableLinkerArguments(product)); var useCompilerDriver = useCompilerDriverLinker(product); // Output. if (useCompilerDriver) args.push("-o"); args.push(outputs.application[0].filePath); // Inputs. args = args.concat(Cpp.collectLinkerObjectPaths(inputs)); // Library paths. var libraryPathFlag = useCompilerDriver ? "-L" : "-k"; args = args.concat(Cpp.collectLibraryPathsArguments(product, libraryPathFlag)); // Linker scripts. // Note: We need to split the '-f' flag and the file path to separate // lines when we don't use the compiler driver mode. escapableLinkerFlags = escapableLinkerFlags.concat( Cpp.collectLinkerScriptPathsArguments(product, inputs, !useCompilerDriver)); // Library dependencies. args = args.concat(Cpp.collectLibraryDependenciesArguments(product)); var escapedLinkerFlags = escapeLinkerFlags(product, escapableLinkerFlags); if (escapedLinkerFlags) Array.prototype.push.apply(args, escapedLinkerFlags); // Misc flags. if (useCompilerDriver) { args = args.concat(Cpp.collectMiscLinkerArguments(product), Cpp.collectMiscDriverArguments(product)); } return args; } function archiverFlags(project, product, inputs, outputs) { var args = ["-rc"]; Array.prototype.push.apply(args, product.cpp.archiverFlags); args.push(outputs.staticlibrary[0].filePath); args = args.concat(Cpp.collectLinkerObjectPaths(inputs)); return args; } function buildLinkerMapFilePath(target, suffix) { return FileInfo.joinPaths(FileInfo.path(target.filePath), FileInfo.completeBaseName(target.fileName) + suffix); } // This is the workaround for the SDCC bug on a Windows host: // * https://sourceforge.net/p/sdcc/bugs/2970/ // We need to replace the '\r\n\' line endings with the'\n' line // endings for each generated object file. function patchObjectFile(project, product, inputs, outputs, input, output) { var isWindows = Host.os().includes("windows"); if (isWindows && input.cpp.debugInformation) { var cmd = new JavaScriptCommand(); cmd.objectPath = outputs.obj[0].filePath; cmd.silent = true; cmd.sourceCode = function() { var file = new BinaryFile(objectPath, BinaryFile.ReadWrite); var data = file.read(file.size()); file.resize(0); for (var pos = 0; pos < data.length; ++pos) { // Find the next index of CR (\r) symbol. var index = data.indexOf(0x0d, pos); if (index < 0) index = data.length; // Write next data chunk between the previous position and the CR // symbol, exclude the CR symbol. file.write(data.slice(pos, index)); pos = index; } }; return cmd; } } // It is a workaround which removes the generated linker map file // if it is disabled by cpp.generateLinkerMapFile property. // Reason is that the SDCC compiler always generates this file, // and does not have an option to disable generation for a linker // map file. So, we can to remove a listing files only after the // linking completes. function removeLinkerMapFile(project, product, inputs, outputs, input, output) { if (!product.cpp.generateLinkerMapFile) { var target = outputs.application[0]; var cmd = new JavaScriptCommand(); cmd.mapFilePath = buildLinkerMapFilePath(target, product.cpp.linkerMapSuffix) cmd.silent = true; cmd.sourceCode = function() { File.remove(mapFilePath); }; return cmd; } } // It is a workaround to rename the extension of the output linker // map file to the specified one, since the linker generates only // files with the '.map' extension. function renameLinkerMapFile(project, product, inputs, outputs, input, output) { if (product.cpp.generateLinkerMapFile && (product.cpp.linkerMapSuffix !== ".map")) { var target = outputs.application[0]; var cmd = new JavaScriptCommand(); cmd.newMapFilePath = buildLinkerMapFilePath(target, product.cpp.linkerMapSuffix); cmd.oldMapFilePath = buildLinkerMapFilePath(target, ".map"); cmd.silent = true; cmd.sourceCode = function() { File.move(oldMapFilePath, newMapFilePath); }; return cmd; } } // It is a workaround which removes the generated listing files // if it is disabled by cpp.generateCompilerListingFiles property // or when the cpp.compilerListingSuffix differs with '.lst'. // Reason is that the SDCC compiler does not have an option to // disable generation for a listing files. Besides, the SDCC // compiler use this files and for the linking. So, we can to // remove a listing files only after the linking completes. function removeCompilerListingFiles(project, product, inputs, outputs, input, output) { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { inputs.obj.forEach(function(object) { if (!object.filePath.endsWith(".c" + object.cpp.objectSuffix)) return; // Skip the assembler generated objects. if (!object.cpp.generateCompilerListingFiles || (object.cpp.compilerListingSuffix !== ".lst")) { var listingPath = FileInfo.joinPaths(FileInfo.path(object.filePath), object.completeBaseName + ".lst"); File.remove(listingPath); } }) }; return cmd; } // It is a workaround that duplicates the generated listing files // but with desired names. The problem is that the SDCC compiler does // not support an options to specify names for the generated listing // files. At the same time, the compiler always generates the listing // files in the form of 'module.c.lst', which makes it impossible to // change the file suffix to a user-specified one. In addition, these // files are also somehow used for linking. Thus, we can not rename them // on the compiling stage. function duplicateCompilerListingFile(project, product, inputs, outputs, input, output) { if (input.cpp.generateCompilerListingFiles && (input.cpp.compilerListingSuffix !== ".lst")) { var cmd = new JavaScriptCommand(); cmd.newListing = outputs.lst[0].filePath; cmd.oldListing = FileInfo.joinPaths(FileInfo.path(outputs.lst[0].filePath), outputs.lst[0].completeBaseName + ".lst"); cmd.silent = true; cmd.sourceCode = function() { File.copy(oldListing, newListing); }; return cmd; } } function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn); var compilerPath = input.cpp.compilerPath; var cmd = new Command(compilerPath, args); cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "compiler"; cmds.push(cmd); cmd = patchObjectFile(project, product, inputs, outputs, input, output); if (cmd) cmds.push(cmd); cmd = duplicateCompilerListingFile(project, product, inputs, outputs, input, output); if (cmd) cmds.push(cmd); return cmds; } function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; var args = assemblerFlags(project, product, input, outputs, explicitlyDependsOn); var assemblerPath = input.cpp.assemblerPath; var cmd = new Command(assemblerPath, args); cmd.description = "assembling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "assembler"; cmds.push(cmd); cmd = patchObjectFile(project, product, inputs, outputs, input, output); if (cmd) cmds.push(cmd); return cmds; } function prepareLinker(project, product, inputs, outputs, input, output) { var cmds = []; var args = linkerFlags(project, product, inputs, outputs); var linkerPath = effectiveLinkerPath(product); var cmd = new Command(linkerPath, args); cmd.description = "linking " + outputs.application[0].fileName; cmd.highlight = "linker"; cmd.jobPool = "linker"; cmds.push(cmd); cmd = removeCompilerListingFiles(project, product, inputs, outputs, input, output); if (cmd) cmds.push(cmd); cmd = renameLinkerMapFile(project, product, inputs, outputs, input, output); if (cmd) cmds.push(cmd); cmd = removeLinkerMapFile(project, product, inputs, outputs, input, output); if (cmd) cmds.push(cmd); return cmds; } function prepareArchiver(project, product, inputs, outputs, input, output) { var args = archiverFlags(project, product, inputs, outputs); var archiverPath = product.cpp.archiverPath; var cmd = new Command(archiverPath, args); cmd.description = "creating " + output.fileName; cmd.highlight = "linker"; cmd.jobPool = "linker"; return [cmd]; } qbs-src-3.2.0/share/qbs/modules/cpp/cosmic.js0000644000175100017510000003730315154533055020444 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Cpp = require("cpp.js"); var Environment = require("qbs.Environment"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var Process = require("qbs.Process"); var TemporaryDir = require("qbs.TemporaryDir"); var TextFile = require("qbs.TextFile"); function toolchainDetails(qbs) { var architecture = qbs.architecture; if (architecture.startsWith("arm")) { return { "executableSuffix": ".cxm", "staticLibrarySuffix": ".cxm", "assemblerName": "cacorm", "compilerName": "cxcorm" }; } else if (architecture === "stm8") { return { "executableSuffix": ".sm8", "staticLibrarySuffix": ".sm8", "assemblerName": "castm8", "compilerName": "cxstm8" }; } else if (architecture === "hcs8") { return { "executableSuffix": ".h08", "staticLibrarySuffix": ".h08", "assemblerName": "ca6808", "compilerName": "cx6808" }; } else if (architecture === "hcs12") { return { "executableSuffix": ".h12", "staticLibrarySuffix": ".h12", "assemblerName": "ca6812", "compilerName": "cx6812" }; } else if (architecture === "m68k") { return { "executableSuffix": ".332", "staticLibrarySuffix": ".332", "assemblerName": "ca332", "compilerName": "cx332" }; } } function guessArchitecture(compilerFilePath) { var baseName = FileInfo.baseName(compilerFilePath); if (baseName === "cxcorm") return "arm"; else if (baseName === "cxstm8") return "stm8"; else if (baseName === "cx6808") return "hcs8"; else if (baseName === "cx6812") return "hcs12"; else if (baseName === "cx332") return "m68k"; } function dumpMacros(compilerFilePath) { // Note: The COSMIC compiler does not support the predefined // macros dumping. So, we do it with the following trick, where we try // to create and compile a special temporary file and to parse the console // output with the own magic pattern: (""|"key"|"value"|""). var outputDirectory = new TemporaryDir(); var outputFilePath = FileInfo.fromNativeSeparators(FileInfo.joinPaths(outputDirectory.path(), "dump-macros.c")); var outputFile = new TextFile(outputFilePath, TextFile.WriteOnly); outputFile.writeLine("#define VALUE_TO_STRING(x) #x"); outputFile.writeLine("#define VALUE(x) VALUE_TO_STRING(x)"); outputFile.writeLine("#define VAR_NAME_VALUE(var) #var VALUE(var)"); // The COSMIC compiler defines only one pre-defined macro // (at least nothing is said about other macros in the documentation). var keys = ["__CSMC__"]; for (var i in keys) { var key = keys[i]; outputFile.writeLine("#if defined (" + key + ")"); outputFile.writeLine("#pragma message (VAR_NAME_VALUE(" + key + "))"); outputFile.writeLine("#endif"); } outputFile.close(); var process = new Process(); process.exec(compilerFilePath, [outputFilePath], false); File.remove(outputFilePath); var map = {}; // COSMIC compiler use the errors output! process.readStdErr().trim().split(/\r?\n/g).map(function(line) { var match = line.match(/^#message \("(.+)" "(.+)"\)$/); if (match) map[match[1]] = match[2]; }); return map; } function dumpVersion(compilerFilePath) { var p = new Process(); p.exec(compilerFilePath, ["-vers"]); // COSMIC compiler use the errors output! var output = p.readStdErr(); var match = output.match(/^COSMIC.+V(\d+)\.?(\d+)\.?(\*|\d+)?/); if (match) { var major = match[1] ? parseInt(match[1], 10) : 0; var minor = match[2] ? parseInt(match[2], 10) : 0; var patch = match[3] ? parseInt(match[3], 10) : 0; return { major: major, minor: minor, patch: patch }; } } function guessEndianness(architecture) { // There is no mention of supported endianness in the cosmic compiler. return "big"; } function dumpDefaultPaths(compilerFilePath, architecture) { var rootPath = FileInfo.path(compilerFilePath); var includePath; var includePaths = []; if (architecture.startsWith("arm")) { includePath = FileInfo.joinPaths(rootPath, "hcorm"); if (File.exists(includePath)) includePaths.push(includePath); } else if (architecture === "stm8") { includePath = FileInfo.joinPaths(rootPath, "hstm8"); if (File.exists(includePath)) includePaths.push(includePath); } else if (architecture === "hcs8") { includePath = FileInfo.joinPaths(rootPath, "h6808"); if (File.exists(includePath)) includePaths.push(includePath); } else if (architecture === "hcs12") { includePath = FileInfo.joinPaths(rootPath, "h6812"); if (File.exists(includePath)) includePaths.push(includePath); } else if (architecture === "m68k") { includePath = FileInfo.joinPaths(rootPath, "h332"); if (File.exists(includePath)) includePaths.push(includePath); } var libraryPaths = []; var libraryPath = FileInfo.joinPaths(rootPath, "lib"); if (File.exists(libraryPath)) libraryPaths.push(libraryPath); return { "includePaths": includePaths, "libraryPaths": libraryPaths, } } function compilerFlags(project, product, input, outputs, explicitlyDependsOn) { var args = []; // Up to 128 include files. args = args.concat(Cpp.collectPreincludePathsArguments(input)); // Defines. args = args.concat(Cpp.collectDefinesArguments(input)); // Up to 128 include paths. args = args.concat(Cpp.collectIncludePathsArguments(input)); args = args.concat(Cpp.collectSystemIncludePathsArguments(input)); // Debug information flags. if (input.cpp.debugInformation) args.push("+debug"); var architecture = input.qbs.architecture; var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags)); // Warning level flags. switch (input.cpp.warningLevel) { case "none": // Disabled by default. break; case "all": // Highest warning level. args.push("-pw7"); break; } // C language version flags. if (tag === "c") { var knownValues = ["c99"]; var cLanguageVersion = Cpp.languageVersion( input.cpp.cLanguageVersion, knownValues, "C"); switch (cLanguageVersion) { case "c99": args.push("-p", "c99"); break; default: break; } } // Objects output directory. args.push("-co", FileInfo.path(outputs.obj[0].filePath)); // Listing files generation flag. if (input.cpp.generateCompilerListingFiles) { // Enable listings. args.push("-l"); // Listings output directory. args.push("-cl", FileInfo.path(outputs.lst[0].filePath)); } // Misc flags. args = args.concat(Cpp.collectMiscCompilerArguments(input, tag), Cpp.collectMiscDriverArguments(product)); // Input. args.push(input.filePath); return args; } function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) { var args = []; // Up to 128 include paths. args = args.concat(Cpp.collectIncludePathsArguments(input)); args = args.concat(Cpp.collectSystemIncludePathsArguments(input)); // Debug information flags. if (input.cpp.debugInformation) args.push("-xx"); // Misc flags. args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm")); // Listing files generation flag. if (input.cpp.generateAssemblerListingFiles) { args.push("-l"); args.push("+l", outputs.lst[0].filePath); } // Objects output file path. args.push("-o", outputs.obj[0].filePath); // Input. args.push(input.filePath); return args; } function linkerFlags(project, product, inputs, outputs) { var args = []; // Library paths. args = args.concat(Cpp.collectLibraryPaths(product).map(function(path) { // It is workaround to use the relative paths avoids a strange linking // errors. Maybe it is related to the limitations on the length of the // command arguments, or on the length of the paths. return product.cpp.libraryPathFlag + Cpp.relativePath(product.buildDirectory, path); })); // Output. args.push("-o", outputs.application[0].filePath); // Map file generation flag. if (product.cpp.generateLinkerMapFile) args.push("-m", outputs.mem_map[0].filePath); // Misc flags. args = args.concat(Cpp.collectMiscEscapableLinkerArguments(product), Cpp.collectMiscLinkerArguments(product), Cpp.collectMiscDriverArguments(product)); // Linker scripts. args = args.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs)); // Input objects. args = args.concat(Cpp.collectLinkerObjectPaths(inputs)); // Library dependencies (order has matters). args = args.concat(Cpp.collectLibraryDependencies(product).map(function(dep) { // It is workaround to use the relative paths avoids a strange linking // errors. Maybe it is related to the limitations on the length of the // command arguments, or on the length of the paths. return Cpp.relativePath(product.buildDirectory, dep.filePath); })); return args; } function archiverFlags(project, product, inputs, outputs) { var args = ["-cl"]; Array.prototype.push.apply(args, product.cpp.archiverFlags); // Output. args.push(outputs.staticlibrary[0].filePath); // Input objects. args = args.concat(Cpp.collectLinkerObjectPaths(inputs)); return args; } function createPath(fullPath) { var cmd = new JavaScriptCommand(); cmd.fullPath = fullPath; cmd.silent = true; cmd.sourceCode = function() { File.makePath(fullPath); }; return cmd; } // It is a workaround to rename the generated object file to the desired name. // Reason is that the Cosmic compiler always generates the object files in the // format of 'module.o', but we expect it in flexible format, e.g. 'module.c.obj' // or 'module.c.o' depending on the cpp.objectSuffix property. function renameObjectFile(project, product, inputs, outputs, input, output) { var object = outputs.obj[0]; var cmd = new JavaScriptCommand(); cmd.newObject = object.filePath; cmd.oldObject = FileInfo.joinPaths(FileInfo.path(object.filePath), object.baseName + ".o"); cmd.silent = true; cmd.sourceCode = function() { File.move(oldObject, newObject); }; return cmd; } // It is a workaround to rename the generated listing file to the desired name. // Reason is that the Cosmic compiler always generates the listing files in the // format of 'module.ls', but we expect it in flexible format, e.g. 'module.c.lst' // or 'module.c.ls' depending on the cpp.compilerListingSuffix property. function renameListingFile(project, product, inputs, outputs, input, output) { var listing = outputs.lst[0]; var cmd = new JavaScriptCommand(); cmd.newListing = listing.filePath; cmd.oldListing = FileInfo.joinPaths(FileInfo.path(listing.filePath), listing.baseName + ".ls"); cmd.silent = true; cmd.sourceCode = function() { File.move(oldListing, newListing); }; return cmd; } function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; // Create output objects path, because the Cosmic doesn't do it. var cmd = createPath(FileInfo.path(outputs.obj[0].filePath)); cmds.push(cmd); // Create output listing path, because the Cosmic doesn't do it. if (input.cpp.generateCompilerListingFiles) { cmd = createPath(FileInfo.path(outputs.lst[0].filePath)); cmds.push(cmd); } var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn); cmd = new Command(input.cpp.compilerPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "compiler"; cmds.push(cmd); cmds.push(renameObjectFile(project, product, inputs, outputs, input, output)); if (input.cpp.generateCompilerListingFiles) cmds.push(renameListingFile(project, product, inputs, outputs, input, output)); return cmds; } function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmds = []; // Create output objects path, because the Cosmic doesn't do it. var cmd = createPath(FileInfo.path(outputs.obj[0].filePath)); cmds.push(cmd); // Create output listing path, because the Cosmic doesn't do it. if (input.cpp.generateCompilerListingFiles) { cmd = createPath(FileInfo.path(outputs.lst[0].filePath)); cmds.push(cmd); } var args = assemblerFlags(project, product, input, outputs, explicitlyDependsOn); cmd = new Command(input.cpp.assemblerPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "assembling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "assembler"; cmds.push(cmd); return cmds; } function prepareLinker(project, product, inputs, outputs, input, output) { var primaryOutput = outputs.application[0]; var args = linkerFlags(project, product, inputs, outputs); var cmd = new Command(product.cpp.linkerPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "linking " + primaryOutput.fileName; cmd.highlight = "linker"; cmd.jobPool = "linker"; return [cmd]; } function prepareArchiver(project, product, inputs, outputs, input, output) { var args = archiverFlags(project, product, inputs, outputs); var cmd = new Command(product.cpp.archiverPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "creating " + output.fileName; cmd.highlight = "linker"; cmd.jobPool = "linker"; return [cmd]; } qbs-src-3.2.0/share/qbs/modules/cpp/cosmic.qbs0000644000175100017510000001231315154533055020607 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.PathTools import qbs.Probes import qbs.Utilities import "cosmic.js" as COSMIC import "cpp.js" as Cpp CppModule { condition: qbs.toolchain && qbs.toolchain.includes("cosmic") Probes.BinaryProbe { id: compilerPathProbe condition: !toolchainInstallPath && !_skipAllChecks names: ["cxcorm"] } Probes.CosmicProbe { id: cosmicProbe condition: !_skipAllChecks compilerFilePath: compilerPath enableDefinesByLanguage: enableCompilerDefinesByLanguage } Properties { condition: cosmicProbe.found qbs.architecture: cosmicProbe.architecture } qbs.targetPlatform: "none" compilerVersionMajor: cosmicProbe.versionMajor compilerVersionMinor: cosmicProbe.versionMinor compilerVersionPatch: cosmicProbe.versionPatch endianness: cosmicProbe.endianness compilerDefinesByLanguage: cosmicProbe.compilerDefinesByLanguage compilerIncludePaths: cosmicProbe.includePaths toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined /* Work-around for QtCreator which expects these properties to exist. */ property string cCompilerName: compilerName property string cxxCompilerName: compilerName compilerName: toolchainDetails.compilerName + compilerExtension compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) assemblerName: toolchainDetails.assemblerName + compilerExtension assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName) linkerName: "clnk" + compilerExtension linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) archiverName: "clib" + compilerExtension archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) runtimeLibrary: "static" staticLibrarySuffix: toolchainDetails.staticLibrarySuffix executableSuffix: toolchainDetails.executableSuffix imageFormat: "cosmic" enableExceptions: false enableRtti: false defineFlag: "-d" includeFlag: "-i" systemIncludeFlag: "-i" preincludeFlag: "-ph" libraryDependencyFlag: "" libraryPathFlag: "-l" linkerScriptFlag: "" toolchainDetails: COSMIC.toolchainDetails(qbs) knownArchitectures: ["arm", "hcs12", "hcs8", "m68k", "stm8"] Rule { id: assembler inputs: ["asm"] outputFileTags: Cpp.assemblerOutputTags(generateAssemblerListingFiles) outputArtifacts: Cpp.assemblerOutputArtifacts(input) prepare: COSMIC.prepareAssembler.apply(COSMIC, arguments) } FileTagger { patterns: ["*.s"] fileTags: ["asm"] } Rule { id: compiler inputs: ["cpp", "c"] auxiliaryInputs: ["hpp"] auxiliaryInputsFromDependencies: ["hpp"] outputFileTags: Cpp.compilerOutputTags(generateCompilerListingFiles) outputArtifacts: Cpp.compilerOutputArtifacts(input) prepare: COSMIC.prepareCompiler.apply(COSMIC, arguments) } Rule { id: applicationLinker multiplex: true inputs: ["obj", "linkerscript"] inputsFromDependencies: ["staticlibrary", "objectlibrary"] outputFileTags: Cpp.applicationLinkerOutputTags(generateLinkerMapFile) outputArtifacts: Cpp.applicationLinkerOutputArtifacts(product) prepare: COSMIC.prepareLinker.apply(COSMIC, arguments) } Rule { id: staticLibraryLinker multiplex: true inputs: ["obj"] inputsFromDependencies: ["staticlibrary", "objectlibrary"] outputFileTags: Cpp.staticLibraryLinkerOutputTags() outputArtifacts: Cpp.staticLibraryLinkerOutputArtifacts(product) prepare: COSMIC.prepareArchiver.apply(COSMIC, arguments) } } qbs-src-3.2.0/share/qbs/modules/cpp/dmc.js0000644000175100017510000004717715154533055017744 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Cpp = require("cpp.js"); var Environment = require("qbs.Environment"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var Process = require("qbs.Process"); var TemporaryDir = require("qbs.TemporaryDir"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); function targetFlags(platform, architecture, extender, consoleApp, type) { if (platform === "dos") { if (architecture === "x86_16") { if (extender === "dosz") return ["-mz"]; else if (extender === "dosr") return ["-mr"]; return ["-mc"]; } else if (architecture === "x86") { if (extender === "dosx") return ["-mx"]; else if (extender === "dosp") return ["-mp"]; } } else if (platform === "windows") { var flags = []; if (architecture === "x86_16") { flags.push("-ml"); if (type.includes("application") && !consoleApp) flags.push("-WA"); else if (type.includes("dynamiclibrary")) flags.push("-WD"); } else if (architecture === "x86") { flags.push("-mn"); if (type.includes("application")) flags.push("-WA"); else if (type.includes("dynamiclibrary")) flags.push("-WD"); } return flags; } return []; } function languageFlags(tag) { if (tag === "cpp") return ["-cpp"]; return []; } function dumpMacros(compilerPath, platform, architecture, extender, tag) { // Note: The DMC compiler does not support the predefined/ macros dumping. So, we do it // with the following trick, where we try to create and compile a special temporary file // and to parse the console output with the own magic pattern: #define . var outputDirectory = new TemporaryDir(); var outputFilePath = FileInfo.joinPaths(outputDirectory.path(), "dump-macros.c"); var outputFile = new TextFile(outputFilePath, TextFile.WriteOnly); outputFile.writeLine("#define VALUE_TO_STRING(x) #x"); outputFile.writeLine("#define VALUE(x) VALUE_TO_STRING(x)"); outputFile.writeLine("#define VAR_NAME_VALUE(var) \"#define \" #var\" \"VALUE(var)"); // Declare all available pre-defined macros of DMC compiler. var keys = [ // Prepare the DOS target macros. "_MSDOS", "MSDOS", // Prepare the OS/2 target macros. "__OS2__", // Prepare the Windows target macros. "WIN32", "_WIN32", "__NT__", // Prepare extended the 32 and 16 bit DOS target macros. "DOS386", "DOS16RM", // Prepare the memory model macros. "M_I86", "_M_I86", "_M_I86TM", "M_I86TM", "_M_I86SM", "M_I86SM", "_M_I86MM", "M_I86MM", "_M_I86CM", "M_I86CM", "_M_I86LM", "M_I86LM", "_M_I86VM", "M_I86VM", // Prepare 8086 macros. "_M_I8086", "M_I8086", // Prepare 286 macros. "_M_I286", "M_I286", // Prepare 32 bit macros. "_M_IX86", // Prepare compiler identification macros. "__DMC__", "__DMC_VERSION_STRING__", // Prepare common compiler macros. "_CHAR_UNSIGNED", "_CHAR_EQ_UCHAR", "_DEBUG_TRACE", "_DLL", "_ENABLE_ARRAYNEW", "_BOOL_DEFINED", "_WCHAR_T_DEFINED", "_CPPRTTI", "_CPPUNWIND", "_MD", "_PUSHPOP_SUPPORTED", "_STDCALL_SUPPORTED", "__INTSIZE", "__DEFALIGN", "_INTEGRAL_MAX_BITS", "_WINDOWS", "_WINDLL", "__INLINE_8087", "__I86__", "__SMALL__", "__MEDIUM__", "__COMPACT__", "__LARGE__", "__VCM__", "__FPCE__", "__FPCE__IEEE__", "DEBUG", // Prepare C99 and C++98 macros. "__STDC__", "__STDC_HOSTED__", "__STDC_VERSION__", "__STDC_IEC_559__", "__STDC_IEC_559_COMPLEX__", "__STDC_ISO_10646__", "__cplusplus" ]; for (var i = 0; i < keys.length; ++i) { var key = keys[i]; outputFile.writeLine("#if defined (" + key + ")"); outputFile.writeLine("#pragma message (VAR_NAME_VALUE(" + key + "))"); outputFile.writeLine("#endif"); } outputFile.close(); var process = new Process(); process.setWorkingDirectory(outputDirectory.path()); var lang = languageFlags(tag); var target = targetFlags(platform, architecture, extender, false, ["application"]); var args = ["-c"].concat(lang, target, FileInfo.toWindowsSeparators(outputFilePath)); process.exec(compilerPath, args, false); File.remove(outputFilePath); var out = process.readStdOut(); return Cpp.extractMacros(out); } function dumpDefaultPaths(compilerFilePath, tag) { var binPath = FileInfo.path(compilerFilePath); var rootPath = FileInfo.path(binPath); var includePaths = []; var cppIncludePath = FileInfo.joinPaths(rootPath, "stlport/stlport"); if (File.exists(cppIncludePath)) includePaths.push(cppIncludePath); var cIncludePath = FileInfo.joinPaths(rootPath, "include"); if (File.exists(cIncludePath)) includePaths.push(cIncludePath); var libraryPaths = []; var libraryPath = FileInfo.joinPaths(rootPath, "lib"); if (File.exists(libraryPath)) libraryPaths.push(libraryPath); return { "includePaths": includePaths, "libraryPaths": libraryPaths, } } function guessVersion(macros) { var version = macros["__DMC__"]; return { major: parseInt(version / 100), minor: parseInt(version % 100), patch: 0 }; } function effectiveLinkerPath(product) { if (product.cpp.linkerMode === "automatic") { var compilerPath = product.cpp.compilerPath; if (compilerPath) return compilerPath; console.log("Found no C-language objects, choosing system linker for " + product.name); } return product.cpp.linkerPath; } function useCompilerDriverLinker(product) { var linker = effectiveLinkerPath(product); var compilers = product.cpp.compilerPathByLanguage; if (compilers) return linker === compilers["cpp"] || linker === compilers["c"]; return linker === product.cpp.compilerPath; } function depsOutputTags() { return ["dep"]; } function depsOutputArtifacts(input, product) { return [{ fileTags: depsOutputTags(), filePath: FileInfo.joinPaths(product.destinationDirectory, input.baseName + ".dep") }]; } function compilerFlags(project, product, input, outputs, explicitlyDependsOn) { var args = ["-c"]; var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags)); args = args.concat(languageFlags(tag)); args = args.concat(targetFlags(product.qbs.targetPlatform, product.qbs.architecture, product.cpp.extenderName, product.consoleApplication, product.type)); // Input. args.push(FileInfo.toWindowsSeparators(input.filePath)); // Output. args.push("-o" + FileInfo.toWindowsSeparators(outputs.obj[0].filePath)); // Preinclude headers. args = args.concat(Cpp.collectPreincludePaths(input).map(function(path) { return input.cpp.preincludeFlag + FileInfo.toWindowsSeparators(path); })); // Defines. args = args.concat(Cpp.collectDefinesArguments(input)); if (tag === "cpp") { // We need to add the paths to the STL includes, because the DMC compiler does // not handle it by default (because the STL libraries is a separate port). var compilerIncludePaths = input.cpp.compilerIncludePaths || []; args = args.concat(compilerIncludePaths.map(function(path) { return input.cpp.includeFlag + FileInfo.toWindowsSeparators(path); })); } // Other includes. args = args.concat(Cpp.collectIncludePaths(input).map(function(path) { return input.cpp.includeFlag + FileInfo.toWindowsSeparators(path); })); args = args.concat(Cpp.collectSystemIncludePaths(input).map(function(path) { return input.cpp.systemIncludeFlag + FileInfo.toWindowsSeparators(path); })); // Debug information flags. if (input.cpp.debugInformation) args.push("-d"); // Optimization flags. switch (input.cpp.optimization) { case "small": args.push("-o+space"); break; case "fast": args.push("-o+speed"); break; case "none": args.push("-o+none"); break; } // Warning level flags. switch (input.cpp.warningLevel) { case "none": args.push("-w"); break; case "all": args.push("-w-"); break; } if (input.cpp.treatWarningsAsErrors) args.push("-wx"); if (tag === "cpp") { // Exceptions flag. if (input.cpp.enableExceptions) args.push("-Ae"); // RTTI flag. var enableRtti = input.cpp.enableRtti; if (input.cpp.enableRtti) args.push("-Ar"); } // Listing files generation flag. if (input.cpp.generateCompilerListingFiles) { // We need to use the relative path here, because the DMC compiler does not handle // a long file path for this option. var listingPath = Cpp.relativePath(product.buildDirectory, outputs.lst[0].filePath); args.push("-l" + FileInfo.toWindowsSeparators(listingPath)); } // Misc flags. args = args.concat(Cpp.collectMiscCompilerArguments(input, tag), Cpp.collectMiscDriverArguments(product)); return args; } function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) { var args = ["-c"]; // Input. args.push(FileInfo.toWindowsSeparators(input.filePath)); // Output. args.push("-o" + FileInfo.toWindowsSeparators(outputs.obj[0].filePath)); // Preinclude headers. args = args.concat(Cpp.collectPreincludePaths(input).map(function(path) { return input.cpp.preincludeFlag + FileInfo.toWindowsSeparators(path); })); // Defines. args = args.concat(Cpp.collectDefinesArguments(input)); // Other includes. args = args.concat(Cpp.collectIncludePaths(input).map(function(path) { return input.cpp.includeFlag + FileInfo.toWindowsSeparators(path); })); args = args.concat(Cpp.collectSystemIncludePaths(input).map(function(path) { return input.cpp.systemIncludeFlag + FileInfo.toWindowsSeparators(path); })); // Misc flags. args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm")); return args; } function linkerFlags(project, product, inputs, outputs) { var args = []; var useCompilerDriver = useCompilerDriverLinker(product); if (useCompilerDriver) { args = args.concat(targetFlags(product.qbs.targetPlatform, product.qbs.architecture, product.cpp.extenderName, product.consoleApplication, product.type)); // Input objects. args = args.concat(Cpp.collectLinkerObjectPaths(inputs).map(function(path) { return FileInfo.toWindowsSeparators(path); })); // Input resources. args = args.concat(Cpp.collectResourceObjectPaths(inputs).map(function(path) { return FileInfo.toWindowsSeparators(path); })); // Input libraries. args = args.concat(Cpp.collectAbsoluteLibraryDependencyPaths(product).map(function(path) { return FileInfo.toWindowsSeparators(path); })); // Output. if (product.type.includes("application")) { args.push("-o" + FileInfo.toWindowsSeparators(outputs.application[0].filePath)); args.push("-L/" + (product.cpp.generateLinkerMapFile ? "MAP" : "NOMAP")); if (product.qbs.targetPlatform === "windows" && product.qbs.architecture === "x86") args.push("-L/SUBSYSTEM:" + (product.consoleApplication ? "CONSOLE" : "WINDOWS")); } else if (product.type.includes("dynamiclibrary")) { args.push("-o" + FileInfo.toWindowsSeparators(outputs.dynamiclibrary[0].filePath)); if (product.qbs.targetPlatform === "windows" && product.qbs.architecture === "x86") { args.push("kernel32.lib"); args.push("-L/IMPLIB:" + FileInfo.toWindowsSeparators( outputs.dynamiclibrary_import[0].filePath)); } } if (product.cpp.debugInformation) args.push("-L/DEBUG"); args.push("-L/NOLOGO", "-L/SILENT"); } // Misc flags. args = args.concat(Cpp.collectMiscEscapableLinkerArguments(product), Cpp.collectMiscLinkerArguments(product), Cpp.collectMiscDriverArguments(product)); return args; } function archiverFlags(project, product, inputs, outputs) { var args = ["-c"]; Array.prototype.push.apply(args, product.cpp.archiverFlags); // Output. args.push(FileInfo.toWindowsSeparators(outputs.staticlibrary[0].filePath)); // Input objects. args = args.concat(Cpp.collectLinkerObjectPaths(inputs).map(function(path) { return FileInfo.toWindowsSeparators(path); })); return args; } function rccCompilerFlags(project, product, input, outputs) { // Input. var args = [FileInfo.toWindowsSeparators(input.filePath)]; // Output. args.push("-o" + FileInfo.toWindowsSeparators(outputs.res[0].filePath)); // Bitness. args.push("-32"); // Defines args = args.concat(Cpp.collectDefinesArguments(input)); // Other includes. args = args.concat(Cpp.collectIncludePaths(input).map(function(path) { return input.cpp.includeFlag + FileInfo.toWindowsSeparators(path); })); args = args.concat(Cpp.collectSystemIncludePaths(input).map(function(path) { return input.cpp.systemIncludeFlag + FileInfo.toWindowsSeparators(path); })); return args; } function buildLinkerMapFilePath(target, suffix) { return FileInfo.joinPaths(FileInfo.path(target.filePath), FileInfo.completeBaseName(target.fileName) + suffix); } // It is a workaround which removes the generated linker map file if it is disabled // by cpp.generateLinkerMapFile property. Reason is that the DMC compiler always // generates this file, and does not have an option to disable generation for a linker // map file. So, we can to remove a listing files only after the linking completes. function removeLinkerMapFile(project, product, inputs, outputs, input, output) { var target = outputs.dynamiclibrary ? outputs.dynamiclibrary[0] : outputs.application[0]; var cmd = new JavaScriptCommand(); cmd.mapFilePath = buildLinkerMapFilePath(target, ".map") cmd.silent = true; cmd.sourceCode = function() { File.remove(mapFilePath); }; return cmd; } // It is a workaround to rename the extension of the output linker map file to the // specified one, since the linker generates only files with the '.map' extension. function renameLinkerMapFile(project, product, inputs, outputs, input, output) { var target = outputs.dynamiclibrary ? outputs.dynamiclibrary[0] : outputs.application[0]; var cmd = new JavaScriptCommand(); cmd.newMapFilePath = buildLinkerMapFilePath(target, product.cpp.linkerMapSuffix); cmd.oldMapFilePath = buildLinkerMapFilePath(target, ".map"); cmd.silent = true; cmd.sourceCode = function() { if (oldMapFilePath !== newMapFilePath) File.move(oldMapFilePath, newMapFilePath); }; return cmd; } function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn); var cmd = new Command(input.cpp.compilerPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "compiler"; return [cmd]; } function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var args = assemblerFlags(project, product, input, outputs, explicitlyDependsOn); var cmd = new Command(input.cpp.assemblerPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "assembler"; return [cmd]; } function prepareLinker(project, product, inputs, outputs, input, output) { var cmds = []; var primaryOutput = outputs.dynamiclibrary ? outputs.dynamiclibrary[0] : outputs.application[0]; var args = linkerFlags(project, product, inputs, outputs); var linkerPath = effectiveLinkerPath(product); var cmd = new Command(linkerPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "linking " + primaryOutput.fileName; cmd.highlight = "linker"; cmd.jobPool = "linker"; cmds.push(cmd); if (product.cpp.generateLinkerMapFile) cmds.push(renameLinkerMapFile(project, product, inputs, outputs, input, output)); else cmds.push(removeLinkerMapFile(project, product, inputs, outputs, input, output)); return cmds; } function prepareArchiver(project, product, inputs, outputs, input, output) { var args = archiverFlags(project, product, inputs, outputs); var cmd = new Command(product.cpp.archiverPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "creating " + output.fileName; cmd.highlight = "linker"; cmd.jobPool = "linker"; return [cmd]; } function prepareRccCompiler(project, product, inputs, outputs, input, output) { var args = rccCompilerFlags(project, product, input, outputs); var cmd = new Command(input.cpp.rccCompilerPath, args); cmd.workingDirectory = product.buildDirectory; cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; cmd.jobPool = "compiler"; return [cmd]; } qbs-src-3.2.0/share/qbs/modules/cpp/MingwBaseModule.qbs0000644000175100017510000001023415154533055022354 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.TextFile import qbs.Utilities import qbs.WindowsUtils import "setuprunenv.js" as SetupRunEnv GenericGCC { condition: false dynamicLibrarySuffix: ".dll" executableSuffix: ".exe" debugInfoSuffix: ".debug" imageFormat: "pe" windowsApiCharacterSet: "unicode" platformDefines: base.concat(WindowsUtils.characterSetDefines(windowsApiCharacterSet)) .concat("WIN32") runtimeLibrary: "dynamic" Properties { condition: product.multiplexByQbsProperties.includes("buildVariants") && qbs.buildVariants && qbs.buildVariants.length > 1 && qbs.buildVariant !== "release" && product.type.containsAny(["staticlibrary", "dynamiclibrary"]) variantSuffix: "d" } FileTagger { patterns: ["*.manifest"] fileTags: ["native.pe.manifest"] } FileTagger { patterns: ["*.rc"] fileTags: ["rc"] } Rule { inputs: ["native.pe.manifest"] multiplex: true outputFileTags: ["rc"] outputArtifacts: { if (product.type.containsAny(["application", "dynamiclibrary"])) { return [{ filePath: input.completeBaseName + ".rc", fileTags: ["rc"] }]; } return []; } prepare: { var inputList = inputs["native.pe.manifest"]; // TODO: Emulate manifest merging like Microsoft's mt.exe tool does if (inputList.length !== 1) { throw("The MinGW toolchain does not support manifest merging; " + "you may only specify a single manifest file to embed into your assembly."); } var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.productType = product.type; cmd.inputFilePath = inputList[0].filePath; cmd.outputFilePath = output.filePath; cmd.sourceCode = function() { var tf; try { tf = new TextFile(outputFilePath, TextFile.WriteOnly); if (productType.includes("application")) tf.write("1 "); // CREATEPROCESS_MANIFEST_RESOURCE_ID else if (productType.includes("dynamiclibrary")) tf.write("2 "); // ISOLATIONAWARE_MANIFEST_RESOURCE_ID tf.write("24 "); // RT_MANIFEST tf.writeLine(Utilities.cStringQuote(inputFilePath)); } finally { if (tf) tf.close(); } }; return [cmd]; } } } qbs-src-3.2.0/share/qbs/modules/cpp/watchos-gcc.qbs0000644000175100017510000000427015154533055021537 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ DarwinGCC { priority: 1 condition: qbs.targetOS.includes('watchos') && qbs.toolchain && qbs.toolchain.includes('gcc') targetSystem: "watchos" + (minimumWatchosVersion || "") minimumDarwinVersion: minimumWatchosVersion minimumDarwinVersionCompilerFlag: qbs.targetOS.includes("watchos-simulator") ? "-mwatchos-simulator-version-min" : "-mwatchos-version-min" minimumDarwinVersionLinkerFlag: qbs.targetOS.includes("watchos-simulator") ? "-watchos_simulator_version_min" : "-watchos_version_min" } qbs-src-3.2.0/share/qbs/modules/cpp/emcc.qbs0000644000175100017510000000152115154533055020240 0ustar runnerrunnerimport qbs import qbs.ModUtils GenericGCC { condition: qbs.toolchain && qbs.toolchain.includes("emscripten") priority: 100 qbs.targetPlatform: "wasm-emscripten" cCompilerName: "emcc" cxxCompilerName: "em++" archiverName: "emar" dynamicLibrarySuffix: ".so" dynamicLibraryPrefix: "lib" executableSuffix: ".js" rpathOrigin: "irrelevant"//to pass tests imageFormat: "wasm" Depends { name: "emsdk" } emsdk.configuredInstallPath: toolchainInstallPath toolchainInstallPath: emsdk.detectedInstallPath ? emsdk.detectedInstallPath : undefined probeEnv: emsdk.environment setupBuildEnvironment: { for (var key in product.cpp.probeEnv) { var v = new ModUtils.EnvironmentVariable(key); v.value = product.cpp.probeEnv[key]; v.set(); } } } qbs-src-3.2.0/share/qbs/modules/cpp/freebsd-gcc.qbs0000644000175100017510000000355515154533055021506 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import "freebsd.js" as FreeBSD import qbs.Host UnixGCC { condition: qbs.targetOS.includes("freebsd") && qbs.toolchain && qbs.toolchain.includes("gcc") priority: 1 targetSystem: "freebsd" + (Host.os().includes("freebsd") ? FreeBSD.hostKernelRelease() : "") distributionIncludePaths: ["/usr/local/include"] distributionLibraryPaths: ["/usr/local/lib"] } qbs-src-3.2.0/share/qbs/modules/cpp/CppModule.qbs0000644000175100017510000005713715154533055021237 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ // base for Cpp modules import qbs.FileInfo import qbs.ModUtils import qbs.Utilities import qbs.WindowsUtils import "cpp.js" as Cpp import "setuprunenv.js" as SetupRunEnv Module { condition: false Depends { name: "cpufeatures" } version: compilerVersion property string compilerVersion: [compilerVersionMajor, compilerVersionMinor, compilerVersionPatch].join(".") property int compilerVersionMajor property int compilerVersionMinor property int compilerVersionPatch property string warningLevel : 'all' // 'none', 'all' property bool treatWarningsAsErrors : false property bool enableSuspiciousLinkerFlagWarnings: true property string architecture: qbs.architecture property string endianness property string machineType // undocumented property string imageFormat // undocumented property string optimization: qbs.optimization property bool debugInformation: qbs.debugInformation property bool enableReproducibleBuilds: false property bool separateDebugInformation: false property pathList prefixHeaders property bool useCPrecompiledHeader: true property bool useCxxPrecompiledHeader: true property bool useObjcPrecompiledHeader: true property bool useObjcxxPrecompiledHeader: true property bool forceUseCxxModules: false property bool forceUseImportStd: false property bool forceUseImportStdCompat: false property stringList stdModulesFiles property string moduleOutputFlag // undocumented property string moduleFileFlag // undocumented property bool treatSystemHeadersAsDependencies: false property stringList defines property stringList platformDefines: qbs.enableDebugCode ? [] : ["NDEBUG"] property stringList compilerDefines: compilerDefinesByLanguage ? ModUtils.flattenDictionary(compilerDefinesByLanguage["c"]) : [] property var compilerDefinesByLanguage: undefined PropertyOptions { name: "compilerDefinesByLanguage" description: "preprocessor macros that are defined when using this particular compiler" } property stringList enableCompilerDefinesByLanguage: [] property string windowsApiCharacterSet property string windowsApiFamily property stringList windowsApiAdditionalPartitions property bool requireAppContainer property string minimumWindowsVersion PropertyOptions { name: "minimumWindowsVersion" description: "A version number in the format [major].[minor] indicating the earliest \ version of Windows that the product should run on. Defines WINVER, \ _WIN32_WINNT, and _WIN32_WINDOWS, and applies a version number to the \ linker flags /SUBSYSTEM and /OSVERSION for MSVC or \ --major-subsystem-version, --minor-subsystem-version, \ --major-os-version and --minor-os-version for MinGW. \ If undefined, compiler defaults will be used." } property string minimumOsxVersion property string minimumMacosVersion: minimumOsxVersion PropertyOptions { name: "minimumMacosVersion" description: "a version number in the format [major].[minor] indicating the earliest \ version of macOS that the product should run on. passes -mmacosx-version-min= \ to the compiler. if undefined, compiler defaults will be used." } property string minimumIosVersion: qbs.architecture == "armv7a" ? "6.0" : undefined PropertyOptions { name: "minimumIosVersion" description: "a version number in the format [major].[minor] indicating the earliest \ version of iOS that the product should run on. passes -miphoneos-version-min= \ to the compiler. if undefined, compiler defaults will be used." } property string minimumWatchosVersion PropertyOptions { name: "minimumWatchosVersion" description: "a version number in the format [major].[minor] indicating the earliest \ version of watchOS that the product should run on. if undefined, compiler \ defaults will be used." } property string minimumTvosVersion: "6.0" PropertyOptions { name: "minimumTvosVersion" description: "a version number in the format [major].[minor] indicating the earliest \ version of tvOS that the product should run on. if undefined, compiler \ defaults will be used." } property string minimumAndroidVersion // not used, undocumented PropertyOptions { name: "minimumAndroidVersion" description: "a version number in the format [major].[minor] indicating the earliest \ version of Android that the product should run on. this value is converted into an SDK \ version which is then written to AndroidManifest.xml." } property string maximumAndroidVersion // not used, undocumented PropertyOptions { name: "maximumAndroidVersion" description: "a version number in the format [major].[minor] indicating the latest \ version of Android that the product should run on. this value is converted into an SDK \ version which is then written to AndroidManifest.xml. if undefined, no upper limit will \ be set." } property string toolchainInstallPath PropertyOptions { name: "toolchainInstallPath" description: "a path to the directory where the toolchain executable files are located." } property pathList includePaths property pathList systemIncludePaths property pathList distributionIncludePaths property pathList compilerIncludePaths property pathList libraryPaths property pathList distributionLibraryPaths property pathList compilerLibraryPaths property pathList frameworkPaths property pathList systemFrameworkPaths property pathList distributionFrameworkPaths property pathList compilerFrameworkPaths property stringList systemRunPaths: [] property string archiverName property string archiverPath: archiverName property string assemblerName property string assemblerPath: assemblerName property string compilerName property string compilerPath: compilerName property var compilerPathByLanguage property stringList compilerWrapper property string linkerName property string linkerPath: linkerName property stringList linkerWrapper property string staticLibraryPrefix: "" property string dynamicLibraryPrefix: "" property string loadableModulePrefix: "" property string executablePrefix: "" property string staticLibrarySuffix: "" property string dynamicLibrarySuffix: "" property string archSuffix: "" property string loadableModuleSuffix: "" property string executableSuffix: "" property string debugInfoSuffix: "" property string debugInfoBundleSuffix: "" property string variantSuffix: "" property string dynamicLibraryImportSuffix: ".lib" property string objectSuffix: ".o" property string linkerMapSuffix: ".map" property string compilerListingSuffix: ".lst" property string assemblerListingSuffix: ".lst" property string resourceSuffix: ".res" property string compiledModuleSuffix property string moduleMapSuffix: ".modulemap" property string moduleInfoSuffix: ".moduleinfo.json" property string precompiledHeaderSuffix property bool createSymlinks: true property stringList dynamicLibraries // list of names, will be linked with -lname property stringList staticLibraries // list of static library files property stringList frameworks // list of frameworks, will be linked with '-framework ' property stringList weakFrameworks // list of weakly-linked frameworks, will be linked with '-weak_framework ' property string rpathOrigin property stringList rpaths property stringList rpathLinkDirs property string sonamePrefix: "" property bool useRPaths: true property bool useRPathLink property string rpathLinkFlag property bool discardUnusedData property bool removeDuplicateLibraries: true property string defineFlag property string includeFlag property string systemIncludeFlag property string preincludeFlag property string libraryDependencyFlag property string libraryPathFlag property string linkerScriptFlag property stringList knownArchitectures: [] property var toolchainDetails property string compilerExtension: FileInfo.executableSuffix() property string linkerMode: "automatic" PropertyOptions { name: "linkerMode" allowedValues: ["automatic", "manual"] description: "Controls whether to automatically use an appropriate compiler frontend " + "in place of the system linker when linking binaries. The default is \"automatic\", " + "which chooses either the C++ compiler, C compiler, or system linker specified by " + "the linkerName/linkerPath properties, depending on the type of object files " + "present on the linker command line. \"manual\" allows you to explicitly specify " + "the linker using the linkerName/linkerPath properties, and allows linker flags " + "passed to the linkerFlags and platformLinkerFlags properties to be escaped " + "manually (using -Wl or -Xlinker) instead of automatically based on the selected " + "linker." } property stringList archiverFlags property stringList assemblerFlags PropertyOptions { name: "assemblerFlags" description: "additional flags for the assembler" } property stringList cppFlags PropertyOptions { name: "cppFlags" description: "additional flags for the C preprocessor" } property stringList cFlags PropertyOptions { name: "cFlags" description: "additional flags for the C compiler" } property stringList cxxFlags PropertyOptions { name: "cxxFlags" description: "additional flags for the C++ compiler" } property stringList objcFlags PropertyOptions { name: "objcFlags" description: "additional flags for the Objective-C compiler" } property stringList objcxxFlags PropertyOptions { name: "objcxxFlags" description: "additional flags for the Objective-C++ compiler" } property stringList commonCompilerFlags PropertyOptions { name: "commonCompilerFlags" description: "flags added to all compilation independently of the language" } property stringList linkerFlags PropertyOptions { name: "linkerFlags" description: "additional linker flags" } property stringList driverFlags PropertyOptions { name: "driverFlags" description: "additional compiler driver flags" } property stringList driverLinkerFlags PropertyOptions { name: "driverLinkerFlags" description: "additional compiler driver flags used for linking only" } property bool generateLinkerMapFile: false PropertyOptions { name: "generateLinkerMapFile" description: "generate linker map file" } property bool generateCompilerListingFiles: false PropertyOptions { name: "generateCompilerListingFiles" description: "generate compiler listing files" } property bool generateAssemblerListingFiles: false PropertyOptions { name: "generateAssemblerListingFiles" description: "generate assembler listing files" } property bool positionIndependentCode: true PropertyOptions { name: "positionIndependentCode" description: "generate position independent code" } property string entryPoint PropertyOptions { name: "entryPoint" description: "entry point symbol for an executable or dynamic library" } property string runtimeLibrary PropertyOptions { name: "runtimeLibrary" description: "determine which runtime library to use" allowedValues: ['static', 'dynamic'] } property string visibility: 'default' PropertyOptions { name: "visibility" description: "export symbols visibility level" allowedValues: ['default', 'hidden', 'hiddenInlines', 'minimal'] } property stringList cLanguageVersion PropertyOptions { name: "cLanguageVersion" description: "The version of the C standard with which the code must comply." } property stringList cxxLanguageVersion PropertyOptions { name: "cxxLanguageVersion" description: "The version of the C++ standard with which the code must comply." } property bool useLanguageVersionFallback PropertyOptions { name: "useLanguageVersionFallback" description: "whether to explicitly use the language standard version fallback values in " + "compiler command line invocations" } property string cxxStandardLibrary PropertyOptions { name: "cxxStandardLibrary" allowedValues: ["libstdc++", "libc++"] description: "version of the C++ standard library to use" } property bool enableExceptions: true PropertyOptions { name: "enableExceptions" description: "enable/disable exception handling (enabled by default)" } property string exceptionHandlingModel: "default" PropertyOptions { name: "exceptionHandlingModel" description: "the kind of exception handling to be used by the compiler" } property bool enableRtti // Platform properties. Those are intended to be set by the toolchain setup // and are prepended to the corresponding user properties. property stringList platformAssemblerFlags property stringList platformCommonCompilerFlags property stringList platformCFlags property stringList platformCxxFlags property stringList platformObjcFlags property stringList platformObjcxxFlags property stringList platformLinkerFlags property stringList platformDriverFlags // Apple platforms properties property bool automaticReferenceCounting PropertyOptions { name: "automaticReferenceCounting" description: "whether to enable Automatic Reference Counting (ARC) for Objective-C" } property bool requireAppExtensionSafeApi PropertyOptions { name: "requireAppExtensionSafeApi" description: "whether to require app-extension-safe APIs only" } property bool allowUnresolvedSymbols property bool combineCSources: false property bool combineCxxSources: false property bool combineObjcSources: false property bool combineObjcxxSources: false // Those are set internally by different cpp module implementations property stringList targetAssemblerFlags property stringList targetDriverFlags property stringList targetLinkerFlags property bool _skipAllChecks: false // Internal property bool validateTargetTriple: true // undocumented property bool importPrivateLibraries: true Group { name: "std modules" condition: stdModulesFiles !== undefined files: stdModulesFiles fileTags: "cppm" } // TODO: The following four rules could use a convenience base item if rule properties // were available in Artifact items and prepare scripts. Rule { multiplex: true inputs: ["c.combine"] Artifact { filePath: "amalgamated_" + product.targetName + ".c" fileTags: ["c"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.highlight = "codegen"; cmd.sourceCode = function() { ModUtils.mergeCFiles(inputs["c.combine"], output.filePath); }; return [cmd]; } } Rule { multiplex: true inputs: ["cpp.combine"] Artifact { filePath: "amalgamated_" + product.targetName + ".cpp" fileTags: ["cpp"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.highlight = "codegen"; cmd.sourceCode = function() { ModUtils.mergeCFiles(inputs["cpp.combine"], output.filePath); }; return [cmd]; } } Rule { multiplex: true inputs: ["objc.combine"] Artifact { filePath: "amalgamated_" + product.targetName + ".m" fileTags: ["objc"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.highlight = "codegen"; cmd.sourceCode = function() { ModUtils.mergeCFiles(inputs["objc.combine"], output.filePath); }; return [cmd]; } } Rule { multiplex: true inputs: ["objcpp.combine"] Artifact { filePath: "amalgamated_" + product.targetName + ".mm" fileTags: ["objccpp"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.highlight = "codegen"; cmd.sourceCode = function() { ModUtils.mergeCFiles(inputs["objcpp.combine"], output.filePath); }; return [cmd]; } } // This rule does not create any commands, but is needed for transitive dependencies // on object libraries to work. While it could be argued that such dependencies // should be exported instead, we have traditionally supported the "private dependency" // use case for static libs, and we want object libraries to work as a // drop-in replacement for these. Rule { inputsFromDependencies: ["objectlibrary", "staticlibrary", "dynamiclibrary_import"] outputFileTags: "objectlibrary" outputArtifacts: [] prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() {}; return cmd; } } FileTagger { patterns: ["*.c"] fileTags: combineCSources ? ["c.combine"] : ["c"] } FileTagger { patterns: ["*.C", "*.cpp", "*.cxx", "*.c++", "*.cc"] fileTags: combineCxxSources ? ["cpp.combine"] : ["cpp"] } FileTagger { patterns: ["*.cppm", "*.ixx"] fileTags: ["cppm"] } FileTagger { patterns: ["*.m"] fileTags: combineObjcSources ? ["objc.combine"] : ["objc"] } FileTagger { patterns: ["*.mm"] fileTags: combineObjcxxSources ? ["objcpp.combine"] : ["objcpp"] } FileTagger { patterns: ["*.h", "*.H", "*.hpp", "*.hxx", "*.h++"] fileTags: ["hpp"] } property var validateFunc: { return function() { var validator = new ModUtils.PropertyValidator("cpp"); validator.setRequiredProperty("architecture", architecture, "you might want to re-run 'qbs-setup-toolchains'"); validator.addCustomValidator("architecture", architecture, function (value) { return !architecture || architecture === Utilities.canonicalArchitecture(architecture); }, "'" + architecture + "' is invalid. You must use the canonical name '" + Utilities.canonicalArchitecture(architecture) + "'"); validator.setRequiredProperty("endianness", endianness); validator.setRequiredProperty("compilerDefinesByLanguage", compilerDefinesByLanguage); validator.setRequiredProperty("compilerVersion", compilerVersion); validator.setRequiredProperty("compilerVersionMajor", compilerVersionMajor); validator.setRequiredProperty("compilerVersionMinor", compilerVersionMinor); validator.setRequiredProperty("compilerVersionPatch", compilerVersionPatch); validator.addVersionValidator("compilerVersion", compilerVersion, 3, 3); validator.addRangeValidator("compilerVersionMajor", compilerVersionMajor, 1); validator.addRangeValidator("compilerVersionMinor", compilerVersionMinor, 0); validator.addRangeValidator("compilerVersionPatch", compilerVersionPatch, 0); if (minimumWindowsVersion) { validator.addVersionValidator("minimumWindowsVersion", minimumWindowsVersion, 2, 2); validator.addCustomValidator("minimumWindowsVersion", minimumWindowsVersion, function (v) { return !v || v === WindowsUtils.canonicalizeVersion(v); }, "'" + minimumWindowsVersion + "' is invalid. Did you mean '" + WindowsUtils.canonicalizeVersion(minimumWindowsVersion) + "'?"); } validator.validate(); if (minimumWindowsVersion && !WindowsUtils.isValidWindowsVersion(minimumWindowsVersion)) { console.warn("Unknown Windows version '" + minimumWindowsVersion + "'; expected one of: " + WindowsUtils.knownWindowsVersions().map(function (a) { return '"' + a + '"'; }).join(", ") + ". See https://docs.microsoft.com/en-us/windows/desktop/SysInfo/operating-system-version"); } if (knownArchitectures && knownArchitectures.length > 0) { var isSupported = Cpp.supportsArchitecture(qbs.architecture, knownArchitectures); if (!isSupported) { throw ModUtils.ModuleError("Unsupported architecture: '" + qbs.architecture + "'"); } } } } validate: { return validateFunc(); } setupRunEnvironment: { SetupRunEnv.setupRunEnvironment(product, config); } Parameter { property bool link } Parameter { property bool linkWholeArchive } Parameter { property string symbolLinkMode } } qbs-src-3.2.0/share/qbs/modules/cpp/android-gcc.qbs0000644000175100017510000001713515154533055021513 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.ModUtils import qbs.TextFile import qbs.Utilities import "../../modules/Android/ndk/utils.js" as NdkUtils import 'gcc.js' as Gcc LinuxGCC { Depends { name: "Android.ndk" } condition: qbs.targetOS.includes("android") && qbs.toolchain && qbs.toolchain.includes("llvm") priority: 2 rpaths: [] // toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android cxxLanguageVersion: "c++14" property string archLibsDir: { switch (qbs.architecture) { case "arm64": return "aarch64"; case "armv7a": return "arm"; case "x86_64": return qbs.architecture; case "x86": return "i686"; } } property string targetDir: "android" + (["armeabi", "armeabi-v7a"].includes(Android.ndk.abi) ? "eabi" : "") property string triple: [archLibsDir, targetSystem, targetDir].join("-") property string libsDir: FileInfo.joinPaths(sysroot, "usr", "lib", triple); property string sharedStlFilePath: (libsDir && Android.ndk.appStl.endsWith("_shared")) ? FileInfo.joinPaths(libsDir, dynamicLibraryPrefix + Android.ndk.appStl + dynamicLibrarySuffix) : undefined property string staticStlFilePath: (libsDir && Android.ndk.appStl.endsWith("_static")) ? FileInfo.joinPaths(libsDir, Android.ndk.platformVersion, NdkUtils.stlFileName(staticLibraryPrefix, Android.ndk, staticLibrarySuffix)) : undefined toolchainInstallPath: FileInfo.joinPaths(Android.ndk.ndkDir, "toolchains", "llvm", "prebuilt", Android.ndk.hostArch, "bin") property string toolchainTriple: [targetAbi === "androideabi" ? "arm" : targetArch, targetSystem, targetAbi].join("-") internalVersion: undefined toolchainPrefix: undefined machineType: { if (Android.ndk.abi === "armeabi-v7a") return "armv7-a"; } qbs.optimization: targetAbi === "androideabi" ? "small" : base enableExceptions: Android.ndk.appStl !== "system" enableRtti: Android.ndk.appStl !== "system" commonCompilerFlags: NdkUtils.commonCompilerFlags(qbs.toolchain, qbs.buildVariant, Android.ndk) linkerFlags: NdkUtils.commonLinkerFlags(Android.ndk); driverLinkerFlags: { var flags = ["-fuse-ld=lld", "-Wl,--exclude-libs,libgcc.a", "-nostdlib++"]; // See https://android.googlesource.com/platform/ndk/+/ndk-release-r21/docs/BuildSystemMaintainers.md#Unwinding if (Android.ndk.abi === "armeabi-v7a") { flags = flags.concat(["-Wl,--exclude-libs,libgcc_real.a"]); if (Android.ndk.appStl.startsWith("c++")) flags = flags.concat(["-Wl,--exclude-libs,libunwind.a"]); } return flags; } platformDriverFlags: ["-fdata-sections", "-ffunction-sections", "-funwind-tables", "-fstack-protector-strong", "-no-canonical-prefixes"] dynamicLibraries: { var libs = ["c", "m"]; if (sharedStlFilePath) libs.push(FileInfo.joinPaths(libsDir, Android.ndk.platformVersion, NdkUtils.stlFileName(dynamicLibraryPrefix, Android.ndk, dynamicLibrarySuffix))); return libs; } staticLibraries: staticStlFilePath // When using ndk r19c, llvm doesn't add sysroot/usr/include/c++/v1 to the path // But it works starting with ndk r20b systemIncludePaths: (Utilities.versionCompare(Android.ndk.version, "20") < 0) ? FileInfo.joinPaths(sysroot, "usr", "include", "c++", "v1") : [] defines: ["ANDROID", "__ANDROID__"] binutilsPath: FileInfo.joinPaths(Android.ndk.ndkDir, "toolchains", "llvm", "prebuilt", Android.ndk.hostArch, "bin"); binutilsPathPrefix: FileInfo.joinPaths(binutilsPath, "llvm-") sysroot: FileInfo.joinPaths(Android.ndk.ndkDir, "toolchains", "llvm", "prebuilt", Android.ndk.hostArch, "sysroot") targetArch: { switch (qbs.architecture) { case "arm64": return "aarch64"; case "armv5": case "armv5te": return "armv5te"; case "armv7a": case "x86_64": return qbs.architecture; case "x86": return "i686"; } } target: [targetArch, targetSystem, targetAbi].join("-") targetSystem: "linux" targetAbi: "android" + (["armeabi", "armeabi-v7a"].includes(Android.ndk.abi) ? "eabi" : "") + Android.ndk.platformVersion endianness: "little" Group { condition: shouldLink Group { name: "Android STL" condition: module.sharedStlFilePath files: module.sharedStlFilePath ? [module.sharedStlFilePath] : [] fileTags: "android.stl" } Rule { inputs: "dynamiclibrary" Artifact { filePath: FileInfo.joinPaths("stripped-libs", input.fileName) fileTags: "android.nativelibrary" } prepare: { var stripArgs = ["--strip-all", "-o", output.filePath, input.filePath]; var stripCmd = new Command(product.cpp.stripPath, stripArgs); stripCmd.description = "stripping unneeded symbols from " + input.fileName; return stripCmd; } } } _skipAllChecks: !shouldLink validate: { if (_skipAllChecks) return; var baseValidator = new ModUtils.PropertyValidator("qbs"); baseValidator.addCustomValidator("architecture", targetArch, function (value) { return value !== undefined; }, "unknown Android architecture '" + qbs.architecture + "'."); var validator = new ModUtils.PropertyValidator("cpp"); validator.setRequiredProperty("targetArch", targetArch); return baseValidator.validate() && validator.validate(); } } qbs-src-3.2.0/share/qbs/modules/emsdk/0000755000175100017510000000000015154533055017144 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/emsdk/emsdk.js0000644000175100017510000001015315154533055020605 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Danya Patrushev ** 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$ ** ****************************************************************************/ var Process = require("qbs.Process"); var Host = require("qbs.Host"); var FileInfo = require("qbs.FileInfo"); var File = require("qbs.File"); var Environment = require("qbs.Environment"); function getEnvironment(shellPath, emccDir) { var winOs = Host.os().includes("windows") var emsdkEnvFileName = "emsdk_env." + (winOs ? "bat" : "sh") var sep = FileInfo.pathSeparator() //if the compiler comes from emsdk its directory should be */emsdk/upstream/emscripten/ var emsdkEnvFilePath = FileInfo.cleanPath(emccDir + sep + ".." + sep + ".." + sep + emsdkEnvFileName) if (!File.exists(emsdkEnvFilePath)) { if (!winOs) { console.info("Emcc compiler found but " + emsdkEnvFilePath + " doesn't exist - assuming compiler is provided by system package") return {} } else throw emsdkEnvFilePath + " not found"; } else { var env = {} // If the environment already contains emsdk specific variables, running the script // will return a concise message about "Setting up EMSDK environment" without all // the data that we need, so we check the environment first. var dir = Environment.getEnv("EMSDK") //use it as an indication that the environment is already set if (dir) { env["EMSDK"] = dir; var python = Environment.getEnv("EMSDK_PYTHON") if (python) env["EMSDK_PYTHON"] = python; var node = Environment.getEnv("EMSDK_NODE"); if (node) env["EMSDK_NODE"] = node; } else { var process = new Process(); process.exec(shellPath, [emsdkEnvFilePath]); var equalStr = " = "; var lines = process.readStdErr().split("\n"); for (var i in lines) { var line = lines[i]; var index = line.indexOf(equalStr); if (index === -1) continue; var key = line.slice(0, index); if (key === "PATH") continue; env[key] = line.slice(index + equalStr.length); } } return env; } } qbs-src-3.2.0/share/qbs/modules/emsdk/emsdk.qbs0000644000175100017510000000135415154533055020761 0ustar runnerrunnerimport qbs.Probes import "emsdk.js" as Emsdk Module { property string configuredInstallPath property string detectedInstallPath: emccPathProbe.found ? emccPathProbe.path : undefined Probes.BinaryProbe { id: emccPathProbe condition: !configuredInstallPath names: ["emcc"] } property var environment: emsdkEnvProbe.environment Probe { id: emsdkEnvProbe property string emccDir: configuredInstallPath || detectedInstallPath property string shellPath: product.qbs.shellPath property var environment condition: emccDir configure: { environment = Emsdk.getEnvironment(shellPath, emccDir); found = true; } } } qbs-src-3.2.0/share/qbs/modules/nodejs/0000755000175100017510000000000015154533055017323 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/nodejs/nodejs.js0000644000175100017510000000360215154533055021144 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Process = require("qbs.Process"); function findLocation(packageManagerFilePath, location, nodejsPath) { var p = new Process(); try { if (nodejsPath) p.setEnv("PATH", nodejsPath); if (p.exec(packageManagerFilePath, [location, "-g"]) !== 0) console.error(p.readStdErr().trim()); return p.readStdOut().trim(); } finally { p.close(); } } qbs-src-3.2.0/share/qbs/modules/nodejs/NodeJS.qbs0000644000175100017510000001416415154533055021162 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Environment import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.Probes Module { // JavaScript files which have been "processed" - currently this simply means "copied to output // directory" but might later include minification and obfuscation processing additionalProductTypes: ["nodejs_processed_js"].concat(applicationFile ? ["application"] : []) Probes.NodeJsProbe { id: nodejs searchPaths: toolchainInstallPath ? [toolchainInstallPath] : [] } Probes.NpmProbe { id: npm searchPaths: toolchainInstallPath ? [toolchainInstallPath] : [] interpreterPath: FileInfo.path(nodejs.filePath) } property path applicationFile PropertyOptions { name: "applicationFile" description: "file whose corresponding output will be executed when running the Node.js app" } Group { name: "Application file"; files: nodejs.applicationFile ? [nodejs.applicationFile] : [] } property path toolchainInstallPath: { if (nodejs.path && npm.path && nodejs.path !== npm.path) throw("node and npm binaries do not belong to the same installation (" + nodejs.path + " vs " + npm.path + ")"); return nodejs.path || npm.path; } property path interpreterFileName: nodejs.fileName property path interpreterFilePath: nodejs.filePath property path packageManagerFileName: npm.fileName property path packageManagerFilePath: npm.filePath property path packageManagerBinPath: npm.npmBin property path packageManagerRootPath: npm.npmRoot property path packageManagerPrefixPath: npm.npmPrefix // private properties readonly property path compiledIntermediateDir: FileInfo.joinPaths(product.buildDirectory, "tmp", "nodejs.intermediate") setupBuildEnvironment: { var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), Host.os().includes("windows")); v.prepend(product.nodejs.toolchainInstallPath); v.set(); } setupRunEnvironment: { var v = new ModUtils.EnvironmentVariable("NODE_PATH", FileInfo.pathListSeparator(), Host.os().includes("windows")); v.prepend(FileInfo.path(Environment.getEnv("QBS_RUN_FILE_PATH"))); v.set(); } FileTagger { patterns: ["*.js"] fileTags: ["js"] } validate: { var validator = new ModUtils.PropertyValidator("nodejs"); validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath); validator.setRequiredProperty("interpreterFileName", interpreterFileName); validator.setRequiredProperty("interpreterFilePath", interpreterFilePath); validator.setRequiredProperty("packageManagerFileName", packageManagerFileName); validator.setRequiredProperty("packageManagerFilePath", packageManagerFilePath); validator.setRequiredProperty("packageManagerBinPath", packageManagerBinPath); validator.setRequiredProperty("packageManagerRootPath", packageManagerRootPath); validator.setRequiredProperty("packageManagerPrefixPath", packageManagerPrefixPath); validator.validate(); } Rule { inputs: ["js"] outputArtifacts: { var tags = ["nodejs_processed_js"]; if (input.fileTags.includes("application_js") || product.moduleProperty("nodejs", "applicationFile") === input.filePath) tags.push("application"); // Preserve directory structure of input files var intermediatePath = product.sourceDirectory; // Handle nodejs.compiledIntermediateDir (QBS-5 workaround) var compiled = product.moduleProperty("nodejs", "compiledIntermediateDir"); if (input.filePath.startsWith(compiled)) { intermediatePath = compiled; } intermediatePath = FileInfo.path(FileInfo.relativePath(intermediatePath, input.filePath)); return [{ filePath: FileInfo.joinPaths(product.destinationDirectory, intermediatePath, input.fileName), fileTags: tags }]; } outputFileTags: ["nodejs_processed_js", "application"] prepare: { var cmd = new JavaScriptCommand(); cmd.description = "copying " + input.fileName; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; return cmd; } } } qbs-src-3.2.0/share/qbs/modules/ib/0000755000175100017510000000000015154533055016433 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/ib/IBModule.qbs0000644000175100017510000001615115154533055020606 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.BundleTools import qbs.DarwinTools import qbs.File import qbs.Host import qbs.FileInfo import qbs.ModUtils import qbs.Process import 'ib.js' as Ib Module { Depends { name: "xcode"; required: false } Probe { id: ibProbe property string toolPath: ibtoolPath // input property string toolVersion // output configure: { toolVersion = Ib.ibtoolVersion(toolPath); found = true; } } condition: Host.os().includes("darwin") && qbs.targetOS.includes("darwin") property bool warnings: true property bool errors: true property bool notices: true property stringList flags // tiffutil specific property string tiffutilName: "tiffutil" property string tiffutilPath: FileInfo.joinPaths("/usr/bin", tiffutilName) property bool combineHidpiImages: true // iconutil specific property string iconutilName: "iconutil" property string iconutilPath: FileInfo.joinPaths("/usr/bin", iconutilName) // XIB/NIB specific property string ibtoolName: "ibtool" property string ibtoolPath: FileInfo.joinPaths(xcode.developerPath, "/usr/bin", ibtoolName) property bool flatten: true property string module property bool autoActivateCustomFonts: true // Asset catalog specific property string actoolName: xcode.present ? "actool" : "ictool" property string actoolPath: FileInfo.joinPaths(xcode.developerPath, "/usr/bin", actoolName) property string appIconName property string launchImageName property bool compressPngs: true // private properties property string outputFormat: "human-readable-text" property string tiffSuffix: ".tiff" property string appleIconSuffix: ".icns" property string compiledAssetCatalogSuffix: ".car" property string compiledNibSuffix: ".nib" property string compiledStoryboardSuffix: ".storyboardc" version: ibtoolVersion property string ibtoolVersion: ibProbe.toolVersion property var ibtoolVersionParts: ibtoolVersion ? ibtoolVersion.split('.').map(function(item) { return parseInt(item, 10); }) : [] property int ibtoolVersionMajor: ibtoolVersionParts[0] property int ibtoolVersionMinor: ibtoolVersionParts[1] property int ibtoolVersionPatch: ibtoolVersionParts[2] property stringList targetDevices: xcode.present ? xcode.targetDevices : DarwinTools.targetDevices(qbs.targetOS) validate: { var validator = new ModUtils.PropertyValidator("ib"); validator.setRequiredProperty("ibtoolVersion", ibtoolVersion); validator.setRequiredProperty("ibtoolVersionMajor", ibtoolVersionMajor); validator.setRequiredProperty("ibtoolVersionMinor", ibtoolVersionMinor); validator.addVersionValidator("ibtoolVersion", ibtoolVersion, 2, 3); validator.addRangeValidator("ibtoolVersionMajor", ibtoolVersionMajor, 1); validator.addRangeValidator("ibtoolVersionMinor", ibtoolVersionMinor, 0); if (ibtoolVersionPatch !== undefined) validator.addRangeValidator("ibtoolVersionPatch", ibtoolVersionPatch, 0); validator.validate(); } FileTagger { patterns: ["*.png"] fileTags: ["png"] } FileTagger { patterns: ["*.iconset"] // bundle fileTags: ["iconset"] } FileTagger { patterns: ["*.nib", "*.xib"] fileTags: ["nib"] } FileTagger { patterns: ["*.storyboard"] fileTags: ["storyboard"] } FileTagger { patterns: ["*.xcassets"] // bundle fileTags: ["assetcatalog"] } FileTagger { patterns: ["*.icon"] // bundle fileTags: ["iconcomposer"] } Rule { multiplex: true inputs: ["png"] outputFileTags: ["tiff"] outputArtifacts: Ib.tiffutilArtifacts(product, inputs) prepare: Ib.prepareTiffutil.apply(Ib, arguments) } Rule { inputs: ["iconset"] outputFileTags: ["icns", "bundle.input"] outputArtifacts: ([{ filePath: FileInfo.joinPaths(product.destinationDirectory, input.completeBaseName + ModUtils.moduleProperty(product, "appleIconSuffix")), fileTags: ["icns", "bundle.input"], bundle: { _bundleFilePath: FileInfo.joinPaths(BundleTools.destinationDirectoryForResource(product, input), input.completeBaseName + ModUtils.moduleProperty(product, "appleIconSuffix")) } }]) prepare: { var args = ["--convert", "icns", "--output", output.filePath, input.filePath]; var cmd = new Command(ModUtils.moduleProperty(product, "iconutilPath"), args); cmd.description = "compiling " + input.fileName; return cmd; } } Rule { inputs: ["nib", "storyboard"] outputFileTags: { var tags = ["partial_infoplist"]; for (var i = 0; i < inputs.length; ++i) tags = tags.uniqueConcat(ModUtils.allFileTags(Ib.ibtoolFileTaggers(inputs[i]))); return tags; } outputArtifacts: Ib.ibtoolOutputArtifacts(product, inputs, input) prepare: Ib.ibtoolCommands.apply(Ib, arguments) } Rule { inputs: ["assetcatalog", "iconcomposer"] multiplex: true outputArtifacts: Ib.actoolOutputArtifacts(product, inputs) outputFileTags: ["bundle.input", "compiled_assetcatalog", "partial_infoplist"] prepare: Ib.compileAssetCatalogCommands.apply(Ib, arguments) } } qbs-src-3.2.0/share/qbs/modules/ib/ib.js0000644000175100017510000004103315154533055017364 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var BundleTools = require("qbs.BundleTools"); var DarwinTools = require("qbs.DarwinTools"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var Process = require("qbs.Process"); var PropertyList = require("qbs.PropertyList"); function artifactsFromInputs(inputs) { var artifacts = []; for (var tag in inputs) { artifacts = artifacts.concat(inputs[tag]); } return artifacts; } function tiffutilScalesMap(inputs) { return artifactsFromInputs(inputs).map(function (a) { var m = a.filePath.match(/^(.+?)(@(\d+)x)?(\..+?)$/); var basePath = m[1]; var scale = m[2] || ""; var nscale = m[3]; var extension = m[4]; if (scale && scale < 1) throw new Error("Invalid scale '" + nscale + "' for image '" + a.filePath + "'"); return { basePath: basePath, extension: extension, scale: scale }; }).reduce(function (previous, current) { previous[current["basePath"]] = (previous[current["basePath"]] || []).concat([{ extension: current["extension"], scale: current["scale"] }]); return previous; }, {}); } function tiffutilOutputFilePath(product, basePath) { return FileInfo.joinPaths(product.destinationDirectory, "hidpi-images", FileInfo.relativePath(product.sourceDirectory, basePath) + product.ib.tiffSuffix); } function tiffutilArtifacts(product, inputs) { var artifacts = []; var map = tiffutilScalesMap(inputs); for (var key in map) { artifacts.push({ filePath: tiffutilOutputFilePath(product, key), fileTags: ["tiff"] }); } return artifacts; } function prepareTiffutil(project, product, inputs, outputs, input, output) { var cmds = []; var map = tiffutilScalesMap(inputs); for (var key in map) { var args = ["-cat" + (product.ib.combineHidpiImages ? "hidpicheck" : "")]; var count = 0; map[key].forEach(function (obj) { args.push(key + obj["scale"] + obj["extension"]); ++count; }); args.push("-out", tiffutilOutputFilePath(product, key)); var cmd = new Command(product.ib.tiffutilPath, args); cmd.description = "creating " + output.fileName; cmd.count = count; cmd.outputFilePath = output.filePath; cmd.stderrFilterFunction = function (output) { return output.replace(count + " images written to " + outputFilePath + ".", ""); }; cmds.push(cmd); } return cmds; } function ibtooldArguments(product, inputs, input, outputs, overrideOutput) { var i; var args = []; var allInputs = artifactsFromInputs(inputs); var outputFormat = ModUtils.moduleProperty(product, "outputFormat"); if (outputFormat) { if (!["binary1", "xml1", "human-readable-text"].includes(outputFormat)) throw("Invalid ibtoold output format: " + outputFormat + ". " + "Must be in [binary1, xml1, human-readable-text]."); args.push("--output-format", outputFormat); } var debugFlags = ["warnings", "errors", "notices"]; for (var j in debugFlags) { var flag = debugFlags[j]; if (ModUtils.modulePropertyFromArtifacts(product, allInputs, product.moduleName, flag)) { args.push("--" + flag); } } if (inputs.assetcatalog || inputs.iconcomposer) { args.push("--platform", DarwinTools.applePlatformName( product.moduleProperty("qbs", "targetOS"), product.moduleProperty("xcode", "platformType"))); var appIconName = ModUtils.modulePropertyFromArtifacts(product, inputs.assetcatalog, product.moduleName, "appIconName"); if (appIconName) args.push("--app-icon", appIconName); var launchImageName = ModUtils.modulePropertyFromArtifacts(product, inputs.assetcatalog, product.moduleName, "launchImageName"); if (launchImageName) args.push("--launch-image", launchImageName); // Undocumented but used by Xcode (only for iOS?), probably runs pngcrush or equivalent if (ModUtils.modulePropertyFromArtifacts(product, inputs.assetcatalog, product.moduleName, "compressPngs")) args.push("--compress-pngs"); } else { var sysroot = product.moduleProperty("qbs", "sysroot"); if (sysroot) args.push("--sdk", sysroot); args.push("--flatten", ModUtils.modulePropertyFromArtifacts(product, allInputs, product.moduleName, "flatten") ? 'YES' : 'NO'); // --module and --auto-activate-custom-fonts were introduced in Xcode 6.0 if (ModUtils.moduleProperty(product, "ibtoolVersionMajor") >= 6) { var module = ModUtils.moduleProperty(product, "module"); if (module) args.push("--module", module); if (ModUtils.modulePropertyFromArtifacts(product, allInputs, product.moduleName, "autoActivateCustomFonts")) args.push("--auto-activate-custom-fonts"); } } // --minimum-deployment-target was introduced in Xcode 5.0 var minimumDarwinVersion = product.moduleProperty("cpp", "minimumDarwinVersion"); if (minimumDarwinVersion && ModUtils.moduleProperty(product, "ibtoolVersionMajor") >= 5) args.push("--minimum-deployment-target", minimumDarwinVersion); // --target-device and -output-partial-info-plist were introduced in Xcode 6.0 for ibtool if (ModUtils.moduleProperty(product, "ibtoolVersionMajor") >= 6 || inputs.assetcatalog || inputs.iconcomposer) { args.push("--output-partial-info-plist", (outputs && outputs.partial_infoplist) ? outputs.partial_infoplist[outputs.partial_infoplist.length - 1].filePath : "/dev/null"); // For iOS, we'd normally only output the devices specified in TARGETED_DEVICE_FAMILY // We can't get this info from Info.plist keys due to dependency order, so use the qbs prop var targetDevices = ModUtils.moduleProperty(product, "targetDevices"); for (i in targetDevices) { args.push("--target-device", targetDevices[i]); } } args = args.concat(ModUtils.modulePropertiesFromArtifacts(product, allInputs, product.moduleName, "flags")); if (overrideOutput) { args.push("--compile", overrideOutput); } else { if (outputs.compiled_assetcatalog) args.push("--compile", product.buildDirectory + "/actool.dir"); else // compiled_ibdoc args.push("--compile", product.buildDirectory + "/ibtool.dir/" + ibtoolCompiledDirSuffix(product, input)); } for (i in allInputs) args.push(allInputs[i].filePath); return args; } function ibtoolFileTaggers(fileTags) { var ext; if (fileTags.includes("nib") && !fileTags.includes("storyboard")) ext = "nib"; if (fileTags.includes("storyboard") && !fileTags.includes("nib")) ext = "storyboard"; if (!ext) throw "unknown ibtool input file tags: " + fileTags; var t = ["bundle.input", "compiled_ibdoc"]; return { ".nib": t.concat(["compiled_" + ext + (ext !== "nib" ? "_nib" : "")]), ".plist": t.concat(["compiled_" + ext + "_infoplist"]), ".storyboard": t.concat(["compiled_" + ext]) }; } function ibtoolCompiledDirSuffix(product, input) { var suffix = input.completeBaseName; if (input.fileTags.includes("nib")) suffix += ModUtils.moduleProperty(product, "compiledNibSuffix"); else if (input.fileTags.includes("storyboard")) suffix += ModUtils.moduleProperty(product, "compiledStoryboardSuffix"); return suffix; } function ibtoolOutputArtifacts(product, inputs, input) { var suffix = ibtoolCompiledDirSuffix(product, input); var tracker = new ModUtils.BlackboxOutputArtifactTracker(); tracker.hostOS = product.moduleProperty("qbs", "hostOS"); tracker.shellPath = product.moduleProperty("qbs", "shellPath"); tracker.fileTaggers = ibtoolFileTaggers(input.fileTags); tracker.command = ModUtils.moduleProperty(product, "ibtoolPath"); tracker.commandArgsFunction = function (outputDirectory) { // Last --output-format argument overrides any previous ones // Append the name of the base output since it can be either a file or a directory // in the case of XIB compilations return ibtooldArguments(product, inputs, input, undefined, FileInfo.joinPaths(outputDirectory, suffix)) .concat(["--output-format", "xml1"]); }; var ibtoolBuildDirectory = product.buildDirectory + "/ibtool.dir"; var main = BundleTools.destinationDirectoryForResource(product, input); var artifacts = tracker.artifacts(ibtoolBuildDirectory); if (product.moduleProperty("ib", "ibtoolVersionMajor") >= 6) { var prefix = input.fileTags.includes("storyboard") ? "SB" : ""; var path = FileInfo.joinPaths(product.destinationDirectory, input.completeBaseName + "-" + prefix + "PartialInfo.plist"); artifacts.push({ filePath: path, fileTags: ["partial_infoplist"] }); } // Let the output artifacts known the "main" output // This can be either a file or directory so the artifact might already exist in the output list for (var i = 0; i < artifacts.length; ++i) { if (artifacts[i].fileTags.includes("compiled_ibdoc")) artifacts[i].bundle = { _bundleFilePath: artifacts[i].filePath.replace(ibtoolBuildDirectory, main) }; } return artifacts; } function ibtoolCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmd = new Command(ModUtils.moduleProperty(product, "ibtoolPath"), ibtooldArguments(product, inputs, input, outputs)); cmd.description = "compiling " + input.fileName; // Also display the language name of the nib/storyboard being compiled if it has one var localizationKey = DarwinTools.localizationKey(input.filePath); if (localizationKey) cmd.description += ' (' + localizationKey + ')'; cmd.highlight = 'compiler'; // May not be strictly needed, but is set by some versions of Xcode if (input.fileTags.includes("storyboard")) cmd.environment.push("IBSC_MINIMUM_COMPATIBILITY_VERSION=" + (product.moduleProperty("cpp", "minimumDarwinVersion") || "")); cmd.stdoutFilterFunction = function(output) { return ""; }; return cmd; } function actoolOutputArtifacts(product, inputs) { // actool has no --dry-run option (rdar://21786925), // so compile to a fake temporary directory in order to extract the list of output files var tracker = new ModUtils.BlackboxOutputArtifactTracker(); tracker.hostOS = product.moduleProperty("qbs", "hostOS"); tracker.shellPath = product.moduleProperty("qbs", "shellPath"); tracker.command = ModUtils.moduleProperty(product, "actoolPath"); tracker.commandArgsFunction = function (outputDirectory) { // Last --output-format argument overrides any previous ones return ibtooldArguments(product, inputs, undefined, undefined, outputDirectory).concat(["--output-format", "xml1"]); }; tracker.processStdOutFunction = parseActoolOutput; var artifacts = tracker.artifacts(product.buildDirectory + "/actool.dir"); // Newer versions of actool don't generate *anything* if there's no input; // in that case a partial Info.plist would not have been generated either if (artifacts && artifacts.length > 0) { artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, "assetcatalog_generated_info.plist"), fileTags: ["partial_infoplist"] }); } for (var i = 0; i < artifacts.length; ++i) { if (artifacts[i].fileTags.includes("compiled_assetcatalog")) { var referenceInput = inputs.assetcatalog ? inputs.assetcatalog[0] : inputs.iconcomposer[0]; artifacts[i].bundle = { _bundleFilePath: artifacts[i].filePath.replace( product.buildDirectory + "/actool.dir", BundleTools.destinationDirectoryForResource(product, referenceInput)) }; } } return artifacts; } function parseActoolOutput(output) { var propertyList = new PropertyList(); try { propertyList.readFromString(output); var plist = propertyList.toObject(); if (plist) plist = plist["com.apple.actool.compilation-results"]; if (plist) { var artifacts = []; files = plist["output-files"]; for (var i in files) { if (files[i] === "/dev/null") continue; var tags = files[i].endsWith(".plist") ? ["partial_infoplist"] : ["bundle.input", "compiled_assetcatalog"]; artifacts.push({ // Even though we pass in a canonical base dir, the paths in the XML File // are non-canonical. See QBS-1417. filePath: FileInfo.canonicalPath(files[i]), fileTags: tags }); } return artifacts; } } finally { propertyList.clear(); } } function ibtoolVersion(ibtool) { var process; var version; try { process = new Process(); if (process.exec(ibtool, ["--version", "--output-format", "xml1"], true) !== 0) console.error(process.readStdErr()); var propertyList = new PropertyList(); try { propertyList.readFromString(process.readStdOut()); var plist = propertyList.toObject(); if (plist) plist = plist["com.apple.ibtool.version"]; if (plist) version = plist["short-bundle-version"]; } finally { propertyList.clear(); } } finally { process.close(); } return version; } function compileAssetCatalogCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var mkdir = new JavaScriptCommand(); mkdir.silent = true; mkdir.sourceCode = function () { File.makePath(FileInfo.joinPaths(product.buildDirectory, "actool.dir")); }; var cmd = new Command(ModUtils.moduleProperty(product, "actoolPath"), ibtooldArguments(product, inputs, input, outputs)); const inputFiles = [].concat(inputs["assetcatalog"] || [], inputs["iconcomposer"] || []); cmd.description = inputFiles.map(function (input) { return "compiling " + input.fileName; }).join('\n'); cmd.highlight = "compiler"; cmd.stdoutFilterFunction = function(output) { return ""; }; return [mkdir, cmd]; } qbs-src-3.2.0/share/qbs/modules/qnx/0000755000175100017510000000000015154533055016647 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/qnx/qnx.qbs0000644000175100017510000001206215154533055020165 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Environment import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.Probes import qbs.Utilities Module { Probes.PathProbe { id: qnxSdkProbe names: ["qnx700", "qnx660", "qnx650"] searchPaths: Host.os().includes("windows") ? [Environment.getEnv("USERPROFILE"), Environment.getEnv("SystemDrive")] : [Environment.getEnv("HOME"), "/opt"] } Probe { id: qnxTargetOsProbe property string qnxSdkDir: sdkDir property stringList targets: [] configure: { if (qnxSdkDir) { var validEntries = []; var entries = File.directoryEntries( FileInfo.joinPaths(qnxSdkDir, "target"), File.Dirs | File.NoDotAndDotDot); for (var i = 0; i < entries.length; ++i) { if (/^qnx[0-9]$/.test(entries[i])) validEntries.push(entries[i]); } validEntries.sort(); validEntries.reverse(); targets = validEntries; found = targets.length > 0; } else { found = false; } } } version: qnxSdkProbe.found ? qnxSdkProbe.fileName.substr(3, 3).split("").join(".") : undefined readonly property bool qnx7: version ? Utilities.versionCompare(version, "7") >= 0 : false property string sdkDir: qnxSdkProbe.filePath property string hostArch: qnx7 ? "x86_64" : "x86" property string hostOs: { if (Host.os().includes("linux")) return "linux"; if (Host.os().includes("macos")) return "darwin"; if (Host.os().includes("windows")) return qnx7 ? "win64" : "win32"; } property string targetOs: qnxTargetOsProbe.targets[0] property string compilerName: "gcc" property string configurationDir: FileInfo.joinPaths(Environment.getEnv("HOME"), ".qnx") property string hostDir: FileInfo.joinPaths(sdkDir, "host", hostOs, hostArch) property string targetDir: FileInfo.joinPaths(sdkDir, "target", targetOs) property var buildEnv: ({ "QNX_HOST": hostDir, "QNX_TARGET": targetDir, "QNX_CONFIGURATION": configurationDir }) qbs.sysroot: targetDir validate: { if (!sdkDir) { throw ModUtils.ModuleError("Could not find a QNX SDK in any of the following " + "locations:\n\t" + qnxSdkProbe.candidatePaths.join("\n\t") + "\nInstall the QNX SDK to one of the above locations, " + "or set the qnx.sdkDir property to a valid QNX SDK " + "location."); } if (!hostOs) { throw ModUtils.ModuleError("Host operating system '" + Host.os() + "' is not supported by the QNX SDK."); } else if (!File.exists(hostDir)) { throw ModUtils.ModuleError("Detected host tools operating system '" + hostOs + "' and architecture '" + hostArch + "' directory is not " + "present in the QNX SDK installed at '" + sdkDir + "' in the expected location '" + hostDir + "'; did you forget to install it?"); } if (!targetOs) throw ModUtils.ModuleError("Could not find any QNX targets in '" + targetDir + "'"); } } qbs-src-3.2.0/share/qbs/modules/config/0000755000175100017510000000000015154533055017306 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/config/install/0000755000175100017510000000000015154533055020754 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/config/install/module.qbs0000644000175100017510000000002215154533055022742 0ustar runnerrunnerConfigInstall { } qbs-src-3.2.0/share/qbs/modules/config/build/0000755000175100017510000000000015154533055020405 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/config/build/module.qbs0000644000175100017510000000002015154533055022371 0ustar runnerrunnerConfigBuild { } qbs-src-3.2.0/share/qbs/modules/innosetup/0000755000175100017510000000000015154533055020065 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/innosetup/InnoSetupModule.qbs0000644000175100017510000001321115154533055023664 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.FileInfo import qbs.ModUtils import qbs.Probes Module { condition: qbs.targetOS.includes("windows") Probes.InnoSetupProbe { id: innoSetupProbe } property path toolchainInstallPath: innoSetupProbe.path version: innoSetupProbe.version property var versionParts: version ? version.split('.').map(function (item) { return parseInt(item, 10); }) : [] property int versionMajor: versionParts[0] property int versionMinor: versionParts[1] property int versionPatch: versionParts[2] property string compilerName: "ISCC.exe" property string compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) property bool verboseOutput: false PropertyOptions { name: "verboseOutput" description: "display verbose output from the Inno Setup compiler" } property pathList includePaths PropertyOptions { name: "includePaths" description: "directories to add to the include search path" } property stringList defines PropertyOptions { name: "defines" description: "variables that are defined when using the Inno Setup compiler" } property stringList compilerFlags PropertyOptions { name: "compilerFlags" description: "additional flags for the Inno Setup compiler" } readonly property string executableSuffix: ".exe" validate: { if (!innoSetupProbe.found) { throw ModUtils.ModuleError("Could not find InnoSetup in Windows registry. Make " + "sure InnoSetup is installed correctly."); } var validator = new ModUtils.PropertyValidator("innosetup"); validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath); validator.setRequiredProperty("version", version); validator.setRequiredProperty("versionMajor", versionMajor); validator.setRequiredProperty("versionMinor", versionMinor); validator.setRequiredProperty("versionPatch", versionPatch); validator.addVersionValidator("version", version, 3, 3); validator.addRangeValidator("versionMajor", versionMajor, 1); validator.addRangeValidator("versionMinor", versionMinor, 0); validator.addRangeValidator("versionPatch", versionPatch, 0); validator.validate(); } // Inno Setup Script FileTagger { patterns: ["*.iss"] fileTags: ["innosetup.iss"] } Rule { id: innoSetupCompiler inputs: ["innosetup.iss"] auxiliaryInputs: ["installable"] auxiliaryInputsFromDependencies: ["installable"] Artifact { fileTags: ["innosetup.exe", "application"] filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + ModUtils.moduleProperty(product, "executableSuffix")) } prepare: { var i; var args = [ "/O" + FileInfo.toNativeSeparators(FileInfo.path(output.filePath)), "/F" + FileInfo.toNativeSeparators(FileInfo.completeBaseName(output.fileName)) ]; if (!ModUtils.moduleProperty(product, "verboseOutput")) args.push("/Q"); var includePaths = ModUtils.moduleProperty(product, "includePaths"); for (i in includePaths) args.push("/I" + FileInfo.toNativeSeparators(includePaths[i])); // User-supplied defines var defines = ModUtils.moduleProperty(product, "defines"); for (i in defines) args.push("/D" + defines[i]); // User-supplied flags var flags = ModUtils.moduleProperty(product, "compilerFlags"); for (i in flags) args.push(flags[i]); args.push(FileInfo.toNativeSeparators(input.filePath)); var cmd = new Command(ModUtils.moduleProperty(product, "compilerPath"), args); cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; cmd.workingDirectory = FileInfo.path(input.filePath); return cmd; } } } qbs-src-3.2.0/share/qbs/modules/nsis/0000755000175100017510000000000015154533055017015 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/nsis/NSISModule.qbs0000644000175100017510000002257015154533055021454 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.Utilities Module { condition: qbs.targetOS.includes("windows") property path toolchainInstallPath: Utilities.getNativeSetting(registryKey) version: (versionMajor !== undefined && versionMinor !== undefined) ? (versionMajor + "." + versionMinor) : undefined property var versionParts: [ versionMajor, versionMinor, versionPatch, versionBuild ] property int versionMajor: Utilities.getNativeSetting(registryKey, "VersionMajor") property int versionMinor: Utilities.getNativeSetting(registryKey, "VersionMinor") property int versionPatch: Utilities.getNativeSetting(registryKey, "VersionBuild") property int versionBuild: Utilities.getNativeSetting(registryKey, "VersionRevision") property string compilerName: "makensis" property string compilerPath: compilerName property string warningLevel: "normal" PropertyOptions { name: "warningLevel" allowedValues: ["none", "normal", "errors", "warnings", "info", "all"] } property bool disableConfig: false PropertyOptions { name: "disableConfig" description: "disable inclusion of nsisconf.nsh" } property bool enableQbsDefines: true PropertyOptions { name: "enableQbsDefines" description: "built-in variables that are defined when using the NSIS compiler" } property stringList defines PropertyOptions { name: "defines" description: "variables that are defined when using the NSIS compiler" } property stringList compilerFlags PropertyOptions { name: "compilerFlags" description: "additional flags for the NSIS compiler" } property string compressor: "default" PropertyOptions { name: "compressor" description: "the compression algorithm used to compress files/data in the installer" allowedValues: ["default", "zlib", "zlib-solid", "bzip2", "bzip2-solid", "lzma", "lzma-solid"] } property string executableSuffix: ".exe" // Private properties property string registryKey: { if (!Host.os().includes("windows")) return undefined; var keys = [ "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\NSIS" ]; for (var i in keys) { if (Utilities.getNativeSetting(keys[i])) return keys[i]; } } validate: { var validator = new ModUtils.PropertyValidator("nsis"); // Only *require* the toolchain install path on Windows // On other (Unix-like) operating systems it'll probably be in the PATH if (qbs.targetOS.includes("windows")) validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath); validator.setRequiredProperty("versionMajor", versionMajor); validator.setRequiredProperty("versionMinor", versionMinor); validator.setRequiredProperty("versionPatch", versionPatch); validator.setRequiredProperty("versionBuild", versionBuild); validator.addVersionValidator("version", version, 2, 4); validator.addRangeValidator("versionMajor", versionMajor, 1); validator.addRangeValidator("versionMinor", versionMinor, 0); validator.addRangeValidator("versionPatch", versionPatch, 0); validator.addRangeValidator("versionBuild", versionBuild, 0); validator.validate(); } setupBuildEnvironment: { if (product.nsis.toolchainInstallPath) { var v = new ModUtils.EnvironmentVariable("PATH", ";", true); v.prepend(product.nsis.toolchainInstallPath); v.prepend(FileInfo.joinPaths(product.nsis.toolchainInstallPath, "bin")); v.set(); } } // NSIS Script File FileTagger { patterns: ["*.nsi"] fileTags: ["nsi"] } // NSIS Header File FileTagger { patterns: ["*.nsh"] fileTags: ["nsh"] } Rule { id: nsisCompiler multiplex: true inputs: ["nsi"] auxiliaryInputs: ["installable"] auxiliaryInputsFromDependencies: ["installable"] Artifact { fileTags: ["nsissetup", "application"] filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + ModUtils.moduleProperty( product, "executableSuffix")) } prepare: { var i; var args = []; // Prefix character for makensis options var opt = product.moduleProperty("qbs", "hostOS").includes("windows") ? "/" : "-"; if (ModUtils.moduleProperty(product, "disableConfig")) { args.push(opt + "NOCONFIG"); } var warningLevel = ModUtils.moduleProperty(product, "warningLevel"); var warningLevels = ["none", "errors", "warnings", "info", "all"]; if (warningLevel !== "normal") { var level = warningLevels.indexOf(warningLevel); if (level < 0) { throw("Unexpected warning level '" + warningLevel + "'."); } else { args.push(opt + "V" + level); } } var enableQbsDefines = ModUtils.moduleProperty(product, "enableQbsDefines") if (enableQbsDefines) { var map = { "project.": project, "product.": product }; for (var prefix in map) { var obj = map[prefix]; for (var prop in obj) { var val = obj[prop]; if (typeof val !== 'function' && typeof val !== 'object' && !prop.startsWith("_")) { args.push(opt + "D" + prefix + prop + "=" + val); } } } // Users are likely to need this var arch = product.moduleProperty("qbs", "architecture"); args.push(opt + "Dqbs.architecture=" + arch); // Helper define for alternating between 32-bit and 64-bit logic if (arch === "x86_64" || arch === "ia64") { args.push(opt + "DWin64"); } } // User-supplied defines var defines = ModUtils.moduleProperty(product, "defines"); for (i in defines) { args.push(opt + "D" + defines[i]); } // User-supplied flags var flags = ModUtils.moduleProperty(product, "compilerFlags"); for (i in flags) { args.push(flags[i]); } // Override the compression algorithm if needed var compressor = ModUtils.moduleProperty(product, "compressor"); if (compressor !== "default") { var compressorFlag = opt + "XSetCompressor /FINAL "; if (compressor.endsWith("-solid")) { compressorFlag += "/SOLID "; } args.push(compressorFlag + compressor.split('-')[0]); } var inputFileNames = []; for (i in inputs.nsi) { inputFileNames.push(inputs.nsi[i].fileName); args.push(FileInfo.toNativeSeparators(inputs.nsi[i].filePath, product.moduleProperty("qbs", "hostOS"))); } // Output file name - this goes last to override any OutFile command in the script args.push(opt + "XOutFile " + output.filePath); var cmd = new Command(ModUtils.moduleProperty(product, "compilerPath"), args); cmd.description = "compiling " + inputFileNames.join(", "); cmd.highlight = "compiler"; cmd.workingDirectory = FileInfo.path(output.filePath); return cmd; } } } qbs-src-3.2.0/share/qbs/modules/typescript/0000755000175100017510000000000015154533055020247 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/typescript/TypeScriptModule.qbs0000644000175100017510000003055315154533055024240 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.ModUtils import qbs.Probes import qbs.Process import "typescript.js" as TypeScript Module { // Qbs does NOT support standalone TypeScript installations // (for example, %PROGRAMFILES%\Microsoft SDKs\TypeScript and some Debian and RPM packages), // because they do not include typescript.d.ts, which is necessary for building internal tools. // Only npm-based installations of TypeScript are supported (this is also the most common). Depends { name: "nodejs" } additionalProductTypes: ["compiled_typescript"] Probes.TypeScriptProbe { id: tsc interpreterPath: FileInfo.path(nodejs.interpreterFilePath) packageManagerBinPath: nodejs.packageManagerBinPath packageManagerRootPath: nodejs.packageManagerRootPath } property path toolchainInstallPath: tsc.path property path toolchainLibDirName: (versionMajor > 1 || (versionMajor === 1 && versionMinor >= 6)) ? "lib" : "bin" property path toolchainLibInstallPath: FileInfo.joinPaths(nodejs.packageManagerRootPath, "typescript", toolchainLibDirName) version: tsc.version ? tsc.version[2] : undefined property var versionParts: version ? version.split('.').map(function(item) { return parseInt(item, 10); }) : [] property int versionMajor: versionParts[0] property int versionMinor: versionParts[1] property int versionPatch: versionParts[2] property int versionBuild: versionParts[3] property string versionSuffix: tsc.version ? tsc.version[3] : undefined property string compilerName: tsc.fileName property string compilerPath: tsc.filePath property string warningLevel: "normal" PropertyOptions { name: "warningLevel" description: "pedantic to warn on expressions and declarations with an implied 'any' type" allowedValues: ["normal", "pedantic"] } property string targetVersion PropertyOptions { name: "targetVersion" description: "ECMAScript target version" allowedValues: ["ES3", "ES5", "ES2015"] } property string moduleLoader PropertyOptions { name: "moduleLoader" allowedValues: ["commonjs", "amd"] } property bool stripComments: !qbs.debugInformation PropertyOptions { name: "stripComments" description: "whether to remove comments from the generated output" } property bool generateDeclarations: false PropertyOptions { name: "generateDeclarations" description: "whether to generate corresponding .d.ts files during compilation" } // In release mode, nodejs can/should default-enable minification and obfuscation, // making the source maps useless, so these default settings work out fine property bool generateSourceMaps: qbs.debugInformation PropertyOptions { name: "generateSourceMaps" description: "whether to generate corresponding .map files during compilation" } property stringList compilerFlags PropertyOptions { name: "compilerFlags" description: "additional flags for the TypeScript compiler" } property bool singleFile: false PropertyOptions { name: "singleFile" description: "whether to compile all source files to a single output file" } validate: { var interpreterMessage = "TypeScript requires the Node.js interpreter to be called 'node'."; if (File.exists("/etc/debian_version")) { interpreterMessage += " Did you forget to install the nodejs-legacy package? " + "See https://lists.debian.org/debian-devel-announce/2012/07/msg00002.html " + "for more information."; } var preValidator = new ModUtils.PropertyValidator("nodejs"); preValidator.addCustomValidator("interpreterFileName", nodejs.interpreterFileName, function (value) { return value === "node" + FileInfo.executableSuffix(); }, interpreterMessage); preValidator.addCustomValidator("interpreterFilePath", nodejs.interpreterFilePath, function (value) { return value.endsWith(nodejs.interpreterFileName); }, interpreterMessage); preValidator.validate(); var validator = new ModUtils.PropertyValidator("typescript"); validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath); validator.setRequiredProperty("compilerName", compilerName); validator.setRequiredProperty("compilerPath", compilerPath); validator.setRequiredProperty("version", version); validator.setRequiredProperty("versionParts", versionParts); validator.setRequiredProperty("versionMajor", versionMajor); validator.setRequiredProperty("versionMinor", versionMinor); validator.setRequiredProperty("versionPatch", versionPatch); validator.addVersionValidator("version", version, 3, 4); validator.addRangeValidator("versionMajor", versionMajor, 1); validator.addRangeValidator("versionMinor", versionMinor, 0); validator.addRangeValidator("versionPatch", versionPatch, 0); if (versionParts && versionParts.length >= 4) { validator.setRequiredProperty("versionBuild", versionBuild); validator.addRangeValidator("versionBuild", versionBuild, 0); } validator.validate(); } // TypeScript declaration files FileTagger { patterns: ["*.d.ts"] fileTags: ["typescript_declaration"] } // TypeScript source files FileTagger { patterns: ["*.ts"] fileTags: ["typescript"] } Group { name: "io.qt.qbs.internal.typescript-helper" files: [ FileInfo.joinPaths(path, "qbs-tsc-scan", "qbs-tsc-scan.ts"), FileInfo.joinPaths(typescript.toolchainLibInstallPath, "typescript.d.ts"), FileInfo.joinPaths(typescript.toolchainLibInstallPath, "..", "package.json") ] fileTags: ["typescript.typescript-internal"] } Rule { multiplex: true inputs: ["typescript.typescript-internal"] outputFileTags: ["typescript.compiled_typescript-internal"] outputArtifacts: { if (!TypeScript.supportsModernFeatures(product)) return []; return [{ filePath: FileInfo.joinPaths(product.buildDirectory, ".io.qt.qbs.internal.typescript", "qbs-tsc-scan.ts"), fileTags: ["typescript.typescript-internal.copy"] }, { filePath: FileInfo.joinPaths(product.buildDirectory, ".io.qt.qbs.internal.typescript", "node_modules", "typescript", "lib", "typescript.d.ts"), fileTags: ["typescript.typescript-internal.copy"] }, { filePath: FileInfo.joinPaths(product.buildDirectory, ".io.qt.qbs.internal.typescript", "node_modules", "typescript", "package.json"), fileTags: ["typescript.typescript-internal.copy"] }, { filePath: FileInfo.joinPaths(product.buildDirectory, ".io.qt.qbs.internal.typescript", "qbs-tsc-scan.js"), fileTags: ["typescript.compiled_typescript-internal"] }]; } prepare: { var inputPaths = inputs["typescript.typescript-internal"].map(function (input) { return input.filePath; }); var outputPaths = outputs["typescript.typescript-internal.copy"].map(function (output) { return output.filePath; }); var sortFunc = function (a, b) { return FileInfo.fileName(a).localeCompare(FileInfo.fileName(b)); }; var jcmd = new JavaScriptCommand(); jcmd.ignoreDryRun = true; jcmd.silent = true; jcmd.inputPaths = inputPaths.sort(sortFunc); jcmd.outputPaths = outputPaths.sort(sortFunc); jcmd.sourceCode = function() { for (var i = 0; i < inputPaths.length; ++i) File.copy(inputPaths[i], outputPaths[i]); }; var outDir = FileInfo.path( outputs["typescript.compiled_typescript-internal"][0].filePath); var args = ["--module", "commonjs", "--outDir", outDir].concat(outputPaths.filter(function (f) { return !f.endsWith(".json"); })); var cmd = new Command(ModUtils.moduleProperty(product, "compilerPath"), args); cmd.ignoreDryRun = true; cmd.silent = true; return [jcmd, cmd]; } } Rule { id: typescriptCompiler multiplex: true inputs: ["typescript"] inputsFromDependencies: ["typescript_declaration"] explicitlyDependsOn: ["typescript.compiled_typescript-internal"] outputArtifacts: TypeScript.outputArtifacts(product, inputs) outputFileTags: ["application_js", "compiled_typescript", "js", "source_map", "typescript_declaration"] prepare: { var cmd, cmds = []; cmd = new Command(ModUtils.moduleProperty(product, "compilerPath"), TypeScript.tscArguments(product, inputs)); cmd.description = "compiling " + (ModUtils.moduleProperty(product, "singleFile") ? outputs.compiled_typescript[0].fileName : inputs.typescript.map(function(obj) { return obj.fileName; }).join(", ")); cmd.highlight = "compiler"; cmds.push(cmd); // QBS-5 // Move the compiled JavaScript files compiled by TypeScript to an intermediate // directory so that the nodejs module can perform any necessary postprocessing // on the result. The nodejs module will move the files back to their original // locations after postprocessing. cmd = new JavaScriptCommand(); cmd.silent = true; cmd.outDir = product.buildDirectory; cmd.sourceCode = function() { for (var i = 0; i < outputs.compiled_typescript.length; ++i) { var output = outputs.compiled_typescript[i]; var intermediatePath = FileInfo.path(FileInfo.relativePath(product.moduleProperty("nodejs", "compiledIntermediateDir"), output.filePath)); var originalFilePath = FileInfo.joinPaths(outDir, intermediatePath, output.fileName); File.copy(originalFilePath, output.filePath); File.remove(originalFilePath); } }; cmds.push(cmd); return cmds; } } } qbs-src-3.2.0/share/qbs/modules/typescript/qbs-tsc-scan/0000755000175100017510000000000015154533055022545 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/typescript/qbs-tsc-scan/qbs-tsc-scan.ts0000644000175100017510000000516715154533055025424 0ustar runnerrunnerimport ts = require("typescript"); declare var process: any; export namespace io.qt.qbs { export class Artifact { filePath: string; fileTags: string[]; } export namespace tools { export namespace utils { function stringEndsWith(s: string, e: string) { return s.slice(-e.length) === e; } export function artifactFromFilePath(filePath: string): Artifact { var fileTags: string[] = []; if (stringEndsWith(filePath, ".js.map")) { fileTags.push("source_map"); } else if (stringEndsWith(filePath, ".js")) { fileTags.push("js", "compiled_typescript"); } else if (stringEndsWith(filePath, ".d.ts")) { fileTags.push("typescript_declaration"); } return { filePath: filePath, fileTags: fileTags }; } } function compileInternal(fileNames: string[], options: ts.CompilerOptions): qbs.Artifact[] { var outputArtifacts: qbs.Artifact[] = []; var program = ts.createProgram(fileNames, options); var emitResult = program.emit(undefined, filePath => { outputArtifacts.push(utils.artifactFromFilePath(filePath)); }); var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(diagnostic => { var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); if (diagnostic.file) { var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.error(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); } else { console.error(message); } }); return emitResult.emitSkipped ? undefined : outputArtifacts; } export function compile(commandLineArguments: string[]): qbs.Artifact[] { var parsedCommandLine = ts.parseCommandLine(commandLineArguments); return compileInternal(parsedCommandLine.fileNames, parsedCommandLine.options); } export function TypeScriptCompilerScannerToolMain(): void { var outputArtifacts = compile(process.argv.slice(2)); if (outputArtifacts !== undefined) { console.log(JSON.stringify(outputArtifacts)); } else { process.exit(1); } } } } io.qt.qbs.tools.TypeScriptCompilerScannerToolMain(); qbs-src-3.2.0/share/qbs/modules/typescript/qbs-tsc-scan/.gitignore0000644000175100017510000000016115154533055024533 0ustar runnerrunner# Visual Studio Code IDE tsconfig.json qbs-tsc-scan.js typings/node/node.d.ts typings/typescript/typescript.d.ts qbs-src-3.2.0/share/qbs/modules/typescript/typescript.js0000644000175100017510000002465015154533055023022 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var Process = require("qbs.Process"); function findTscVersion(compilerFilePath, nodejsPath) { var p = new Process(); try { if (nodejsPath) p.setEnv("PATH", nodejsPath); p.exec(compilerFilePath, ["--version"]); var re = /^(?:message TS6029: )?Version (([0-9]+(?:\.[0-9]+){1,3})(?:-(.+?))?)$/m; var match = p.readStdOut().trim().match(re); if (match !== null) return match; } finally { p.close(); } } function tscArguments(product, inputs) { var i; var args = []; if (ModUtils.moduleProperty(product, "warningLevel") === "pedantic") { args.push("--noImplicitAny"); } var targetVersion = ModUtils.moduleProperty(product, "targetVersion"); if (targetVersion) { args.push("--target"); args.push(targetVersion); } var moduleLoader = ModUtils.moduleProperty(product, "moduleLoader"); if (moduleLoader) { args.push("--module"); args.push(moduleLoader); } if (ModUtils.moduleProperty(product, "stripComments")) { args.push("--removeComments"); } if (ModUtils.moduleProperty(product, "generateDeclarations")) { args.push("--declaration"); } if (ModUtils.moduleProperty(product, "generateSourceMaps")) { args.push("--sourcemap"); } // User-supplied flags var flags = ModUtils.moduleProperty(product, "compilerFlags"); for (i in flags) { args.push(flags[i]); } if (supportsModernFeatures(product)) { args.push("--rootDir", product.sourceDirectory); } args.push("--outDir", product.buildDirectory); if (ModUtils.moduleProperty(product, "singleFile")) { args.push(outOption(product), FileInfo.joinPaths(product.destinationDirectory, product.targetName) + ".js"); } if (inputs.typescript_declaration) { for (i = 0; i < inputs.typescript_declaration.length; ++i) { args.push(inputs.typescript_declaration[i].filePath); } } if (inputs.typescript) { for (i = 0; i < inputs.typescript.length; ++i) { args.push(inputs.typescript[i].filePath); } } if (inputs["typescript.typescript-internal"]) { for (i = 0; i < inputs["typescript.typescript-internal"].length; ++i) { args.push(inputs["typescript.typescript-internal"][i].filePath); } } return args; } function outputArtifacts(product, inputs) { if (!supportsModernFeatures(product)) { console.warn("Qbs does not properly support TypeScript versions prior to 1.5 due to " + "severe limitations in dependency tracking. This is TypeScript version " + ModUtils.moduleProperty(product, "version") + ". It is strongly recommended " + "that you upgrade TypeScript, or continue at your own risk."); return legacyOutputArtifacts(product, inputs); } var process; try { process = new Process(); process.setEnv("NODE_PATH", [ ModUtils.moduleProperty(product, "toolchainInstallPath"), product.moduleProperty("nodejs", "packageManagerRootPath") ].join(FileInfo.pathListSeparator())); process.exec(product.moduleProperty("nodejs", "interpreterFilePath"), [FileInfo.joinPaths(product.buildDirectory, ".io.qt.qbs.internal.typescript", "qbs-tsc-scan.js")] .concat(tscArguments(product, inputs)), true); var artifacts = JSON.parse(process.readStdOut()); // Find and tag the "main" output file var applicationFile = product.moduleProperty("nodejs", "applicationFile"); if (applicationFile) { var i, appIndex = -1; if (product.moduleProperty("typescript", "singleFile")) { for (i = 0; i < artifacts.length; ++i) { if (artifacts[i].fileTags.includes("compiled_typescript")) { appIndex = i; break; } } } else { var expected = FileInfo.relativePath(product.sourceDirectory, applicationFile); if (!expected.endsWith(".ts")) // tsc doesn't allow this anyways, so it's a perfectly reasonable restriction throw "TypeScript source file name '" + applicationFile + "' does not end with .ts"; expected = expected.slice(0, -2) + "js"; for (i = 0; i < artifacts.length; ++i) { if (expected === FileInfo.relativePath(product.buildDirectory, artifacts[i].filePath)) { appIndex = i; break; } } } if (appIndex === -1 || !artifacts[appIndex].fileTags.includes("compiled_typescript")) throw "nodejs.applicationFile was set, but Qbs couldn't find the compiled " + "JavaScript file corresponding to '" + applicationFile + "'"; artifacts[appIndex].fileTags = artifacts[appIndex].fileTags.concat(["application_js"]); } return artifacts; } finally { if (process) process.close(); } } function legacyOutputArtifacts(product, inputs) { var artifacts = []; if (!inputs.typescript) { return artifacts; } var jsTags = ["js", "compiled_typescript"]; var filePath = FileInfo.joinPaths(product.destinationDirectory, product.targetName); if (product.moduleProperty("typescript", "singleFile")) { // We could check // if (product.moduleProperty("nodejs", "applicationFile") === inputs.typescript[i].filePath) // but since we're compiling to a single file there's no need to state it explicitly jsTags.push("application_js"); artifacts.push({fileTags: jsTags, filePath: FileInfo.joinPaths( product.moduleProperty("nodejs", "compiledIntermediateDir"), product.targetName + ".js")}); if (product.moduleProperty("typescript", "generateDeclarations")) { artifacts.push({fileTags: ["typescript_declaration"], filePath: filePath + ".d.ts"}); } if (product.moduleProperty("typescript", "generateSourceMaps")) { artifacts.push({fileTags: ["source_map"], filePath: filePath + ".js.map"}); } } else { for (var i = 0; i < inputs.typescript.length; ++i) { jsTags = ["js", "compiled_typescript"]; if (product.moduleProperty("nodejs", "applicationFile") === inputs.typescript[i].filePath) jsTags.push("application_js"); var intermediatePath = FileInfo.path(FileInfo.relativePath( product.sourceDirectory, inputs.typescript[i].filePath)); var baseName = FileInfo.baseName(inputs.typescript[i].fileName); filePath = FileInfo.joinPaths(product.destinationDirectory, intermediatePath, baseName); artifacts.push({fileTags: jsTags, filePath: FileInfo.joinPaths( product.moduleProperty("nodejs", "compiledIntermediateDir"), intermediatePath, baseName + ".js")}); if (product.moduleProperty("typescript", "generateDeclarations")) { artifacts.push({fileTags: ["typescript_declaration"], filePath: filePath + ".d.ts"}); } if (product.moduleProperty("typescript", "generateSourceMaps")) { artifacts.push({fileTags: ["source_map"], filePath: filePath + ".js.map"}); } } } return artifacts; } function outOption(product) { var compilerVersionMajor = ModUtils.moduleProperty(product, "versionMajor"); if (compilerVersionMajor === 1) { if (ModUtils.moduleProperty(product, "versionMinor") < 6) { return "--out"; } } return "--outFile"; } function supportsModernFeatures(product) { var compilerVersionMajor = ModUtils.moduleProperty(product, "versionMajor"); if (compilerVersionMajor === 1) { if (ModUtils.moduleProperty(product, "versionMinor") >= 5) { return true; } } return compilerVersionMajor > 1; } qbs-src-3.2.0/share/qbs/modules/Sanitizers/0000755000175100017510000000000015154533055020174 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/Sanitizers/address/0000755000175100017510000000000015154533055021621 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/Sanitizers/address/asan.qbs0000644000175100017510000000632315154533055023256 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2022 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Utilities Module { Depends { name: "cpp" } property bool enabled: true readonly property bool _supported: qbs.toolchain.includes("gcc") || qbs.toolchain.includes("clang-cl") || (qbs.toolchain.includes("msvc") && Utilities.versionCompare(cpp.compilerVersion, "19.28.29500.0") >= 0) readonly property bool _enabled: enabled && _supported property string detectUseAfterReturn: "always" PropertyOptions { name: "detectUseAfterReturn" description: "Whether to detect problems with stack use after return from a function" allowedValues: ["never", "runtime", "always"] } property bool detectUseAfterScope: true cpp.driverFlags: { var flags = []; if (!_enabled) return flags; if (qbs.toolchain.includes("msvc") && !qbs.toolchain.includes("clang-cl")) { flags.push("/fsanitize=address"); if (detectUseAfterReturn !== "never") flags.push("/fsanitize-address-use-after-return"); return flags; } flags.push("-fsanitize=address", "-fno-omit-frame-pointer"); if (detectUseAfterScope) flags.push("-fsanitize-address-use-after-scope"); if (detectUseAfterReturn) { if (qbs.toolchain.includes("llvm")) { var minVersion = qbs.toolchain.contains("xcode") ? "14" : "13"; if (Utilities.versionCompare(cpp.compilerVersion, minVersion) >= 0) flags.push("-fsanitize-address-use-after-return=" + detectUseAfterReturn); } else if (detectUseAfterReturn === "never") { flags.push("--param", "asan-use-after-return=0"); } } return flags; } } qbs-src-3.2.0/share/qbs/modules/protobuf/0000755000175100017510000000000015154533055017701 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/protobuf/objc/0000755000175100017510000000000015154533055020616 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/protobuf/objc/protobufobjc.qbs0000644000175100017510000000436115154533055024027 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.Probes import "../protobufbase.qbs" as ProtobufBase import "../protobuf.js" as HelperFunctions ProtobufBase { property string includePath: includeProbe.path property string libraryPath: libraryProbe.path property string frameworkPath: frameworkProbe.path Depends { name: "cpp" } cpp.includePaths: [outputDir].concat(!frameworkPath && includePath ? [includePath] : []) cpp.libraryPaths: !frameworkPath && libraryPath ? [libraryPath] : [] cpp.dynamicLibraries: !frameworkPath && libraryPath ? ["ProtocolBuffers"] : [] cpp.frameworkPaths: frameworkPath ? [frameworkPath] : [] cpp.frameworks: ["Foundation"].concat(frameworkPath ? ["Protobuf"] : []) cpp.defines: frameworkPath ? ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS"] : [] Rule { inputs: ["protobuf.input"] outputFileTags: ["hpp", "protobuf.hpp", "objc"] outputArtifacts: { var outputDir = HelperFunctions.getOutputDir(input.protobuf.objc, input); return [ HelperFunctions.objcArtifact(outputDir, input, ["hpp", "protobuf.hpp"], ".pbobjc.h"), HelperFunctions.objcArtifact(outputDir, input, ["objc"], ".pbobjc.m") ]; } prepare: HelperFunctions.doPrepare(input.protobuf.objc, product, input, outputs, "objc") } Probes.IncludeProbe { id: includeProbe names: "GPBMessage.h" } Probes.LibraryProbe { id: libraryProbe names: "ProtocolBuffers" } Probes.FrameworkProbe { id: frameworkProbe names: ["Protobuf"] } validate: { HelperFunctions.validateCompiler(compilerName, compilerPath); if (!HelperFunctions.checkPath(frameworkPath)) { if (!HelperFunctions.checkPath(includePath)) { throw "Can't find objective-c protobuf include files. Please set the includePath " + "or frameworkPath property."; } if (!HelperFunctions.checkPath(libraryPath)) { throw "Can't find objective-c protobuf library. Please set the libraryPath or " + "frameworkPath property."; } } } } qbs-src-3.2.0/share/qbs/modules/protobuf/cpp/0000755000175100017510000000000015154533055020463 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/protobuf/cpp/protobufcpp.qbs0000644000175100017510000000566115154533055023545 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.Probes import qbs.ModUtils import "../protobufbase.qbs" as ProtobufBase import "../protobuf.js" as HelperFunctions ProtobufBase { property bool useGrpc: false property bool _linkLibraries: true readonly property bool _hasModules: protobuflib.present && (!useGrpc || grpcpp.present) property string _cxxLanguageVersion: "c++17" _searchPaths: protobuflib.present ? protobuflib.hostBinDirs : undefined property stringList _grpcSearchPaths: grpcpp.present ? grpcpp.hostBinDirs : undefined cpp.includePaths: outputDir Depends { name: "cpp" } Depends { name: "protobuflib"; condition: _linkLibraries; required: false } Depends { name: "grpc++"; id: grpcpp condition: _linkLibraries && useGrpc; required: false } property path grpcPluginPath: grpcPluginProbe.filePath Probes.BinaryProbe { condition: useGrpc id: grpcPluginProbe names: "grpc_cpp_plugin" searchPaths: _grpcSearchPaths } cpp.cxxLanguageVersion: _cxxLanguageVersion Rule { inputs: ["protobuf.input", "protobuf.grpc"] outputFileTags: ["hpp", "protobuf.hpp", "cpp"] outputArtifacts: { var outputDir = HelperFunctions.getOutputDir(input.protobuf.cpp, input); var result = [ HelperFunctions.cppArtifact(outputDir, input, ["hpp", "protobuf.hpp"], ".pb.h"), HelperFunctions.cppArtifact(outputDir, input, "cpp", ".pb.cc") ]; if (input.fileTags.includes("protobuf.grpc")) { result.push( HelperFunctions.cppArtifact(outputDir, input, ["hpp", "protobuf.hpp"], ".grpc.pb.h"), HelperFunctions.cppArtifact(outputDir, input, ["cpp"], ".grpc.pb.cc")); } return result; } prepare: { var result = HelperFunctions.doPrepare( input.protobuf.cpp, product, input, outputs, "cpp"); if (input.fileTags.includes("protobuf.grpc")) { result = ModUtils.concatAll(result, HelperFunctions.doPrepare( input.protobuf.cpp, product, input, outputs, "grpc", "protoc-gen-grpc=" + input.protobuf.cpp.grpcPluginPath)); } return result; } } validate: { HelperFunctions.validateCompiler(compilerName, compilerPath); if (_linkLibraries && ! _hasModules) { throw "Can't find cpp protobuf runtime. Make sure .pc files are present"; } if (useGrpc) { if (!File.exists(grpcPluginPath)) throw "Can't find grpc_cpp_plugin plugin. Please set the grpcPluginPath property."; } } } qbs-src-3.2.0/share/qbs/modules/protobuf/protobufbase.qbs0000644000175100017510000000106615154533055023106 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.Probes import "protobuf.js" as HelperFunctions Module { property string compilerName: "protoc" property string compilerPath: compilerProbe.filePath property var _searchPaths property pathList importPaths: [] readonly property string outputDir: product.buildDirectory + "/protobuf" FileTagger { patterns: ["*.proto"] fileTags: ["protobuf.input"] } Probes.BinaryProbe { id: compilerProbe names: [compilerName] searchPaths: _searchPaths } } qbs-src-3.2.0/share/qbs/modules/protobuf/protobuf.js0000644000175100017510000001106015154533055022075 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); function validateCompiler(compilerName, compilerPath) { if (!File.exists(compilerPath)) { throw "Can't find '" + compilerName + "' binary. Please set the compilerPath property or " + "make sure the compiler is found in PATH"; } } function checkPath(path) { return path && File.exists(path); }; function toCamelCase(str){ return str.split('_').map(function(word, index) { // If it is the first word make sure to lowercase all the chars. if (index === 0) { return word.toLowerCase(); } // If it is not the first word only upper case the first char and lowercase the rest. return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(); }).join(''); } function getOutputDir(module, input) { var outputDir = module.outputDir; var importPaths = module.importPaths; if (importPaths.length !== 0) { var canonicalInput = File.canonicalFilePath(FileInfo.path(input.filePath)); for (var i = 0; i < importPaths.length; ++i) { var path = File.canonicalFilePath(importPaths[i]); if (canonicalInput.startsWith(path)) { return outputDir + "/" + FileInfo.relativePath(path, canonicalInput); } } } return outputDir; } function cppArtifact(outputDir, input, tags, suffix) { return { fileTags: tags, filePath: FileInfo.joinPaths(outputDir, FileInfo.baseName(input.fileName) + suffix), cpp: { includePaths: [].concat(input.cpp.includePaths, outputDir), defines: ["NDEBUG"], warningLevel: "none", } }; } function objcArtifact(outputDir, input, tags, suffix) { return { fileTags: tags, filePath: FileInfo.joinPaths( outputDir, toCamelCase(FileInfo.baseName(input.fileName)) + suffix), cpp: { automaticReferenceCounting: false, includePaths: [].concat(input.cpp.includePaths, outputDir), warningLevel: "none", } } } function doPrepare(module, product, input, outputs, generator, plugin, generatorOptions) { var outputDir = module.outputDir; var args = []; if (!!plugin) args.push("--plugin=" + plugin) args.push("--" + generator + "_out", outputDir); if (!!generatorOptions) { for (var i = 0; i < generatorOptions.length; ++i) args.push("--" + generator + "_opt=" + generatorOptions[i]) } var importPaths = module.importPaths; if (importPaths.length === 0) importPaths = [FileInfo.path(input.filePath)]; importPaths.forEach(function(path) { if (!FileInfo.isAbsolutePath(path)) path = FileInfo.joinPaths(product.sourceDirectory, path); args.push("--proto_path", path); }); args.push(input.filePath); var cmd = new Command(module.compilerPath, args); cmd.highlight = "codegen"; cmd.description = "generating " + generator + " files for " + input.fileName; return [cmd]; } qbs-src-3.2.0/share/qbs/modules/protobuf/nanopb/0000755000175100017510000000000015154533055021156 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/protobuf/nanopb/nanopb.qbs0000644000175100017510000000654715154533055023156 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.Probes import qbs.ModUtils import "../protobufbase.qbs" as ProtobufBase import "../protobuf.js" as HelperFunctions ProtobufBase { property string includePath: includeProbe.found ? includeProbe.path : undefined property string libraryPath: libraryProbe.found ? libraryProbe.path : undefined property string pluginPath: pluginProbe.filePath property string pluginName: "protoc-gen-nanopb" readonly property string _plugin: "protoc-gen-nanopb=" + pluginPath readonly property string _libraryName: { var libraryName; if (libraryProbe.found) { libraryName = FileInfo.baseName(libraryProbe.fileName); if (libraryName.startsWith("lib")) libraryName = libraryName.substring(3); } return libraryName; } Depends { name: "cpp" } cpp.libraryPaths: { var result = []; if (libraryProbe.found) result.push(libraryProbe.path); return result; } cpp.dynamicLibraries: { var result = []; if (_libraryName) result.push(_libraryName); return result; } cpp.includePaths: { var result = [outputDir]; if (includeProbe.found) result.push(includePath); return result; } cpp.cxxLanguageVersion: qbs.targetOS.contains("darwin") ? ["c++17"] : ["c++11"] Rule { inputs: ["protobuf.input"] outputFileTags: ["hpp", "protobuf.hpp", "cpp"] outputArtifacts: { var outputDir = HelperFunctions.getOutputDir(input.protobuf.nanopb, input); var result = [ HelperFunctions.cppArtifact(outputDir, input, ["hpp", "protobuf.hpp"], ".pb.h"), HelperFunctions.cppArtifact(outputDir, input, ["cpp"], ".pb.c") ]; return result; } prepare: { var options = input.protobuf.nanopb.importPaths.map(function (path) { return "-I" + path; }) var result = HelperFunctions.doPrepare( input.protobuf.nanopb, product, input, outputs, "nanopb", input.protobuf.nanopb._plugin, options); return result; } } Probes.IncludeProbe { id: includeProbe names: ["pb.h", "pb_encode.h", "pb_decode.h", "pb_common.h"] platformSearchPaths: includePath ? [] : base searchPaths: includePath ? [includePath] : [] } Probes.LibraryProbe { id: libraryProbe names: [ "protobuf-nanopb", "protobuf-nanopbd", ] platformSearchPaths: libraryPath ? [] : base searchPaths: libraryPath ? [libraryPath] : [] } Probes.BinaryProbe { id: pluginProbe names: pluginName } validate: { HelperFunctions.validateCompiler(compilerName, compilerPath); if (!includeProbe.found) throw "Can't find nanopb protobuf include files. Please set the includePath property."; if (!libraryProbe.found) throw "Can't find nanopb protobuf library. Please set the libraryPath property."; if (!HelperFunctions.checkPath(pluginPath)) throw "Can't find nanopb protobuf plugin. Please set the pluginPath property."; } } qbs-src-3.2.0/share/qbs/modules/xcode/0000755000175100017510000000000015154533055017143 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/xcode/xcode.js0000644000175100017510000002602215154533055020605 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Jake Petroules. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var DarwinTools = require("qbs.DarwinTools"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var Process = require("qbs.Process"); var PropertyList = require("qbs.PropertyList"); var Utilities = require("qbs.Utilities"); var XcodeArchSpecsReader = (function () { function XcodeArchSpecsReader(specsPath) { var plist = new PropertyList(); try { plist.readFromFile(specsPath); this.specsObject = plist.toObject(); } finally { plist.clear(); } } XcodeArchSpecsReader.prototype.getArchitectureSettings = function () { if (this.specsObject) { var names = []; for (var i = 0; i < this.specsObject.length; ++i) { var dict = this.specsObject[i]; var name = dict["ArchitectureSetting"]; if (name) names.push(name); } return names; } }; XcodeArchSpecsReader.prototype.getArchitectureSettingValue = function (settingName) { // settingName can be: ARCHS_STANDARD, ARCHS_STANDARD_32_BIT, ARCHS_STANDARD_64_BIT, // ARCHS_STANDARD_32_64_BIT, ARCHS_STANDARD_INCLUDING_64_BIT, or ARCHS_UNIVERSAL_IPHONE_OS. // NATIVE_ARCH_ACTUAL doesn't have a RealArchitectures property since it's determined by // Xcode programmatically. if (this.specsObject) { for (var i = 0; i < this.specsObject.length; ++i) { var dict = this.specsObject[i]; if (dict["ArchitectureSetting"] === settingName) { var realArchs = dict["RealArchitectures"]; if (realArchs) { var effectiveRealArchs = []; for (var j = 0; j < realArchs.length; ++j) { var re = /^\$\(([A-Za-z0-9_]+)\)$/; var match = realArchs[j].match(re); if (match) { var val = this.getArchitectureSettingValue(match[1]); // Don't silently omit values if missing. For example, if // ARCHS_FOO=[x86_64, $(ARCHS_BAR)], return 'undefined' instead of // simply [x86_64]. Not known to have any real world occurrences. if (!val) return undefined; Array.prototype.push.apply(effectiveRealArchs, val); } else { effectiveRealArchs.push(realArchs[j]); } } return effectiveRealArchs; } } } } }; return XcodeArchSpecsReader; }()); function platformInfo(platformInfoPlist) { var propertyList = new PropertyList(); try { propertyList.readFromFile(platformInfoPlist); return propertyList.toObject(); } finally { propertyList.clear(); } } function sdkInfoList(sdksPath) { var sdkInfo = []; var sdks = File.directoryEntries(sdksPath, File.Dirs | File.NoDotAndDotDot); for (var i in sdks) { // SDK directory name must contain a version number; // we don't want the versionless iPhoneOS.sdk directory for example if (!sdks[i].match(/[0-9]+/)) continue; if (sdks[i].startsWith("DriverKit") || sdks[i].startsWith("AssetRuntime")) continue; var settingsPlist = FileInfo.joinPaths(sdksPath, sdks[i], "SDKSettings.plist"); var propertyList = new PropertyList(); try { propertyList.readFromFile(settingsPlist); function checkPlist(plist) { if (!plist || !plist["CanonicalName"] || !plist["Version"]) return false; var re = /^[0-9]+\.[0-9]+(\.[0-9]+)?$/; return plist["Version"].match(re); } var plist = propertyList.toObject(); if (!checkPlist(plist)) { console.warn("Skipping corrupted SDK installation: " + FileInfo.joinPaths(sdksPath, sdks[i])); continue; } sdkInfo.push(plist); } finally { propertyList.clear(); } } // Sort by SDK version number sdkInfo.sort(function (a, b) { return Utilities.versionCompare(a["Version"], b["Version"]); }); return sdkInfo; } function findSigningIdentities(security, searchString) { var process; var identities; if (searchString) { try { process = new Process(); if (process.exec(security, ["find-identity", "-p", "codesigning", "-v"], true) !== 0) console.error(process.readStdErr()); var lines = process.readStdOut().split("\n"); for (var i in lines) { // e.g. 1) AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA "Mac Developer: John Doe (XXXXXXXXXX) john.doe@example.org" var match = lines[i].match(/^\s*[0-9]+\)\s+([A-Fa-f0-9]{40})\s+"([^"]+)"$/); if (match !== null) { var hexId = match[1]; var displayName = match[2]; if (hexId === searchString || displayName.startsWith(searchString)) { if (!identities) identities = []; identities.push([hexId, displayName]); break; } } } } finally { process.close(); } } return identities; } function provisioningProfilePlistContents(filePath) { if (filePath === undefined || !File.exists(filePath)) return undefined; var plist = new PropertyList(); try { plist.readFromFile(filePath); return plist.toObject(); } finally { plist.clear(); } } function boolFromSdkOrPlatform(varName, sdkProps, platformProps, defaultValue) { var values = [(sdkProps || {})[varName], (platformProps || {})[varName]]; for (var i = 0; i < values.length; ++i) { if (values[i] === "YES") return true; if (values[i] === "NO") return false; } return defaultValue; } function specsBaseName(version, targetOS) { const targetPlatform = targetOS[0]; const oldSpecNames = { "macos": "MacOSX Architectures", "ios": "iOS Device", "ios-simulator": "iOS Simulator", "tvos": "tvOS Device", "tvos-simulator": "tvOS Simulator", "watchos": "watchOS Device", "watchos-simulator": "watchOS Simulator" }; const newSpecNames = { "macos": "macOSArchitectures", "ios": "iOSDevice", "ios-simulator": "iOSSimulator", "tvos": "tvOSDevice", "tvos-simulator": "tvOSSimulator", "watchos": "watchOSDevice", "watchos-simulator": "watchOSSimulator" }; if (Utilities.versionCompare(version, "26") < 0) { return oldSpecNames[targetPlatform]; } return newSpecNames[targetPlatform]; } function archsSpecsPath(version, targetOS, platformType, platformPath, devicePlatformPath, developerPath) { if (Utilities.versionCompare(version, "13.3") >= 0) { var pluginsDir; if (Utilities.versionCompare(version, "15.3") >= 0) { pluginsDir = FileInfo.joinPaths(developerPath, "..", "SharedFrameworks", "XCBuild.framework", "PlugIns", "XCBBuildService.bundle", "Contents", "PlugIns"); } else if (Utilities.versionCompare(version, "14.3") >= 0) { pluginsDir = FileInfo.joinPaths(developerPath, "Library", "Xcode", "Plug-ins"); } else { pluginsDir = FileInfo.joinPaths(developerPath, "..", "PlugIns"); } var baseDir = FileInfo.joinPaths(pluginsDir, "XCBSpecifications.ideplugin", "Contents", "Resources"); return FileInfo.joinPaths(baseDir, specsBaseName(version, targetOS) + ".xcspec"); } var _specsPluginBaseName; if (Utilities.versionCompare(version, "12") >= 0) { if (targetOS.includes("macos")) _specsPluginBaseName = "OSX"; } if (Utilities.versionCompare(version, "7") >= 0) { if (targetOS.includes("ios")) _specsPluginBaseName = "iOSPlatform"; if (targetOS.includes("tvos")) _specsPluginBaseName = "AppleTV"; if (targetOS.includes("watchos")) _specsPluginBaseName = "Watch"; } var _archSpecsDir = _specsPluginBaseName ? FileInfo.joinPaths(devicePlatformPath, "Developer", "Library", "Xcode", "PrivatePlugIns", "IDE" + _specsPluginBaseName + "SupportCore.ideplugin", "Contents", "Resources") : FileInfo.joinPaths(platformPath, "Developer", "Library", "Xcode", "Specifications"); var _archSpecsFileBaseName = targetOS.includes("ios") ? (targetOS.includes("ios-simulator") ? "iPhone Simulator " : "iPhoneOS") : DarwinTools.applePlatformDirectoryName(targetOS, platformType) + " "; if (_specsPluginBaseName) { switch (platformType) { case "device": return FileInfo.joinPaths(_archSpecsDir, "Device.xcspec"); case "simulator": return FileInfo.joinPaths(_archSpecsDir, "Simulator.xcspec"); } } return FileInfo.joinPaths(_archSpecsDir, _archSpecsFileBaseName + "Architectures.xcspec"); } qbs-src-3.2.0/share/qbs/modules/xcode/xcode.qbs0000644000175100017510000002020515154533055020753 0ustar runnerrunnerimport qbs.BundleTools import qbs.Environment import qbs.File import qbs.FileInfo import qbs.DarwinTools import qbs.ModUtils import qbs.Probes import qbs.PropertyList import qbs.Utilities Module { Probes.XcodeLocationProbe { id: xcodeLocationProbe condition: !developerPath } Probes.XcodeProbe { id: xcodeProbe developerPath: parent.developerPath platformType: parent.platformType platformPath: parent.platformPath devicePlatformPath: parent.devicePlatformPath xcodebuildPath: parent.xcodebuildPath sdksPath: parent.sdksPath } condition: qbs.targetOS.includes("darwin") && qbs.toolchain && qbs.toolchain.includes("xcode") version: xcodeProbe.xcodeVersion property path developerPath: xcodeLocationProbe.found ? xcodeLocationProbe.developerPath : undefined property string sdk: DarwinTools.applePlatformName(qbs.targetOS, platformType) property stringList targetDevices: DarwinTools.targetDevices(qbs.targetOS) property string platformType: { if (qbs.targetOS.containsAny(["ios-simulator", "tvos-simulator", "watchos-simulator"])) return "simulator"; if (qbs.targetOS.containsAny(["ios", "tvos", "watchos"])) return "device"; } readonly property string sdkName: { if (_sdkSettings) { return _sdkSettings["CanonicalName"]; } } readonly property string sdkVersion: { if (_sdkSettings) { return _sdkSettings["Version"]; } } readonly property string shortSdkVersion: { var v = sdkVersion; if (v && v.split('.').length > 2) v = v.slice(0, v.lastIndexOf('.')); return v; } readonly property string latestSdkName: { if (_latestSdk) { return _latestSdk["CanonicalName"]; } } readonly property string latestSdkVersion: { if (_latestSdk) { return _latestSdk["Version"]; } } readonly property stringList availableSdkNames: { if (_availableSdks) { return _availableSdks.map(function (obj) { return obj["CanonicalName"]; }); } } readonly property stringList availableSdkVersions: { if (_availableSdks) { return _availableSdks.map(function (obj) { return obj["Version"]; }); } } readonly property path toolchainPath: FileInfo.joinPaths(toolchainsPath, "XcodeDefault" + ".xctoolchain") readonly property path platformPath: FileInfo.joinPaths(platformsPath, DarwinTools.applePlatformDirectoryName( qbs.targetOS, platformType) + ".platform") readonly property path devicePlatformPath: FileInfo.joinPaths( platformsPath, DarwinTools.applePlatformDirectoryName( qbs.targetOS, "device") + ".platform") readonly property path simulatorPlatformPath: FileInfo.joinPaths( platformsPath, DarwinTools.applePlatformDirectoryName( qbs.targetOS, "simulator") + ".platform") readonly property path sdkPath: FileInfo.joinPaths(sdksPath, DarwinTools.applePlatformDirectoryName( qbs.targetOS, platformType, shortSdkVersion) + ".sdk") // private properties readonly property path toolchainsPath: FileInfo.joinPaths(developerPath, "Toolchains") readonly property path platformsPath: FileInfo.joinPaths(developerPath, "Platforms") readonly property path sdksPath: FileInfo.joinPaths(platformPath, "Developer", "SDKs") readonly property path platformInfoPlist: FileInfo.joinPaths(platformPath, "Info.plist") readonly property path sdkSettingsPlist: FileInfo.joinPaths(sdkPath, "SDKSettings.plist") readonly property path toolchainInfoPlist: FileInfo.joinPaths(toolchainPath, "ToolchainInfo.plist") readonly property var _platformSettings: xcodeProbe.platformSettings readonly property var _platformProps: { if (_platformSettings) return _platformSettings["DefaultProperties"]; } readonly property stringList standardArchitectures: _architectureSettings["ARCHS_STANDARD"] readonly property var _architectureSettings: xcodeProbe.architectureSettings readonly property var _availableSdks: xcodeProbe.availableSdks readonly property var _latestSdk: _availableSdks[_availableSdks.length - 1] readonly property var _sdkSettings: { if (_availableSdks) { // see 'sdk' property doc to understand why this loop is needed for (var i in _availableSdks) { if (_availableSdks[i]["Version"] === sdk) return _availableSdks[i]; if (_availableSdks[i]["CanonicalName"] === sdk) return _availableSdks[i]; } // Latest SDK available for the platform (default case) if (DarwinTools.applePlatformName(qbs.targetOS, platformType) === sdk) return _latestSdk; } } readonly property var _sdkProps: { if (_sdkSettings) { return _sdkSettings["DefaultProperties"]; } } qbs.sysroot: sdkPath validate: { if (!_availableSdks) { throw "There are no SDKs available for this platform in the Xcode installation."; } if (!_sdkSettings) { throw "There is no matching SDK available for " + sdk + "."; } var validator = new ModUtils.PropertyValidator("xcode"); validator.setRequiredProperty("developerPath", developerPath); validator.setRequiredProperty("sdk", sdk); validator.setRequiredProperty("sdkName", sdkName); validator.setRequiredProperty("sdkVersion", sdkVersion); validator.setRequiredProperty("toolchainsPath", toolchainsPath); validator.setRequiredProperty("toolchainPath", toolchainPath); validator.setRequiredProperty("platformsPath", platformsPath); validator.setRequiredProperty("platformPath", platformPath); validator.setRequiredProperty("sdksPath", sdkPath); validator.setRequiredProperty("sdkPath", sdkPath); validator.addVersionValidator("sdkVersion", sdkVersion, 2, 3); validator.addCustomValidator("sdkName", sdkName, function (value) { return value === DarwinTools.applePlatformDirectoryName( qbs.targetOS, platformType, shortSdkVersion, false).toLowerCase(); }, "is '" + sdkName + "', but target OS is [" + qbs.targetOS.join(",") + "] and Xcode SDK version is '" + sdkVersion + "'"); validator.addCustomValidator("sdk", sdk, function (value) { return value === sdkName || (value + shortSdkVersion) === sdkName; }, "is '" + sdk + "', but canonical SDK name is '" + sdkName + "'"); validator.validate(); } property var buildEnv: ({ "DEVELOPER_DIR": developerPath, "SDKROOT": sdkPath }) setupBuildEnvironment: { var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), false); v.prepend(product.xcode.platformPath + "/Developer/usr/bin"); v.prepend(product.xcode.developerPath + "/usr/bin"); v.set(); for (var key in product.xcode.buildEnv) { v = new ModUtils.EnvironmentVariable(key); v.value = product.xcode.buildEnv[key]; v.set(); } } } qbs-src-3.2.0/share/qbs/modules/Exporter/0000755000175100017510000000000015154533055017651 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/Exporter/exporter.js0000644000175100017510000000642015154533055022061 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of the Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ function getPrefixToStrip(project, product, propName, value) { function checkValuePrefix(forbiddenPrefix, prefixDescription) { if (value.startsWith(forbiddenPrefix)) { throw "Value '" + value + "' for exported property '" + propName + "' in product '" + product.name + "' points into " + prefixDescription + ".\n" + "Did you forget to set the prefixMapping property in an Export item?"; } } // Catch user oversights: Paths that point into the project source or build directories // make no sense in the module. if (!value.startsWith(product.qbs.installRoot)) { checkValuePrefix(project.buildDirectory, "project build directory"); checkValuePrefix(project.sourceDirectory, "project source directory"); } // Adapt file paths pointing into the install dir, that is, make them relative to the // module file for relocatability. We accept them with or without the install root. // The latter form will typically be a result of applying the prefixMapping property, // while the first one could be an untransformed path, for instance if the project // file is written in such a way that include paths are picked up from the installed // location rather than the source directory. var result; var fullInstallPrefix = FileInfo.joinPaths(product.qbs.installRoot, product.qbs.installPrefix); if (fullInstallPrefix.length > 1 && value.startsWith(fullInstallPrefix)) { result = fullInstallPrefix; } else { var installPrefix = FileInfo.joinPaths("/", product.qbs.installPrefix); if (installPrefix.length > 1 && value.startsWith(installPrefix)) result = installPrefix; } return result; } qbs-src-3.2.0/share/qbs/modules/Exporter/qbs/0000755000175100017510000000000015154533055020436 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/Exporter/qbs/qbsexporter.qbs0000644000175100017510000000612715154533055023531 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.FileInfo import qbs.TextFile import "qbsexporter.js" as HelperFunctions Module { property stringList artifactTypes property string fileName: product.targetName + ".qbs" property stringList excludedDependencies property string additionalContent property stringList _artifactTypes: artifactTypes ? artifactTypes : ["installable"] additionalProductTypes: ["Exporter.qbs.module"] Rule { multiplex: true requiresInputs: false // Make sure we only run when all other artifacts are already present. auxiliaryInputs: product.type.filter(function(t) { return t !== "Exporter.qbs.module"; }) Artifact { filePath: product.Exporter.qbs.fileName fileTags: ["Exporter.qbs.module"] qbs.install: true } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); HelperFunctions.writeImportStatements(product, f); f.writeLine("\nModule {"); HelperFunctions.writeModuleProperties(project, product, output, f); HelperFunctions.writeTargetArtifactGroups(product, output, f); HelperFunctions.writeChildItems(product, f); if (product.Exporter.qbs.additionalContent) f.writeLine(product.Exporter.qbs.additionalContent); f.writeLine("}"); f.close(); }; return [cmd]; } } } qbs-src-3.2.0/share/qbs/modules/Exporter/qbs/qbsexporter.js0000644000175100017510000002320315154533055023352 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var ExporterHelpers = require("../exporter.js"); function tagListToString(tagList) { return JSON.stringify(tagList); } function stringToTagList(tagListString) { return JSON.parse(tagListString); } function writeTargetArtifactGroup(output, tagList, artifactList, moduleInstallDir, moduleFile) { // Do not add our qbs module file itself. if (tagListToString(tagList) === tagListToString(output.fileTags)) return; moduleFile.writeLine(" Group {"); moduleFile.writeLine(" filesAreTargets: true"); var filteredTagList = tagList.filter(function(t) { return t !== "installable"; }); moduleFile.writeLine(" fileTags: " + JSON.stringify(filteredTagList)); moduleFile.writeLine(" files: ["); for (i = 0; i < artifactList.length; ++i) { var artifact = artifactList[i]; var installedArtifactFilePath = ModUtils.artifactInstalledFilePath(artifact); // Use relative file paths for relocatability. var relativeInstalledArtifactFilePath = FileInfo.relativePath(moduleInstallDir, installedArtifactFilePath); moduleFile.writeLine(" " + JSON.stringify(relativeInstalledArtifactFilePath) + ","); } moduleFile.writeLine(" ]"); moduleFile.writeLine(" }"); } function writeTargetArtifactGroups(product, output, moduleFile) { var relevantArtifacts = []; for (var i = 0; i < (product.Exporter.qbs._artifactTypes || []).length; ++i) { var tag = product.Exporter.qbs._artifactTypes[i]; var artifactsForTag = product.artifacts[tag] || []; for (var j = 0; j < artifactsForTag.length; ++j) { if (!relevantArtifacts.includes(artifactsForTag[j])) relevantArtifacts.push(artifactsForTag[j]); } } var artifactsByTags = {}; var artifactCount = relevantArtifacts ? relevantArtifacts.length : 0; for (i = 0; i < artifactCount; ++i) { var artifact = relevantArtifacts[i]; if (!artifact.fileTags.includes("installable")) continue; // Put all artifacts with the same set of file tags into the same group, so we don't // create more groups than necessary. var key = tagListToString(artifact.fileTags); var currentList = artifactsByTags[key]; if (currentList) currentList.push(artifact); else currentList = [artifact]; artifactsByTags[key] = currentList; } var moduleInstallDir = FileInfo.path(ModUtils.artifactInstalledFilePath(output)); for (var tagListKey in artifactsByTags) { writeTargetArtifactGroup(output, stringToTagList(tagListKey), artifactsByTags[tagListKey], moduleInstallDir, moduleFile); } } function stringifyValue(project, product, moduleInstallDir, prop, value) { if (value instanceof Array) { var repr = "["; for (var i = 0; i < value.length; ++i) { repr += stringifyValue(project, product, moduleInstallDir, prop, value[i]) + ", "; } repr += "]"; return repr; } if (typeof(value) !== "string") { var value = JSON.stringify(value); if (prop.type === "variant") value = '(' + value + ')'; return value; } var valuePrefixToStrip = ExporterHelpers.getPrefixToStrip(project, product, prop.name, value); if (valuePrefixToStrip) { var fullInstallPrefix = FileInfo.joinPaths(product.qbs.installRoot, product.qbs.installPrefix); var deployedModuleInstallDir = moduleInstallDir.slice(fullInstallPrefix.length); return "FileInfo.cleanPath(FileInfo.joinPaths(path, FileInfo.relativePath(" + JSON.stringify(deployedModuleInstallDir) + ", " + JSON.stringify(value.slice(valuePrefixToStrip.length) || "/") + ")))"; } return JSON.stringify(value); } function writeProperty(project, product, moduleInstallDir, prop, indentation, considerValue, moduleFile) { var line = indentation; var separatorIndex = prop.name.lastIndexOf("."); var isModuleProperty = separatorIndex !== -1; var needsDeclaration = !prop.isBuiltin && !isModuleProperty; if (needsDeclaration) line += "property " + prop.type + " "; var moduleName; if (isModuleProperty) { moduleName = prop.name.slice(0, separatorIndex); if ((product.Exporter.qbs.excludedDependencies || []).includes(moduleName)) return; } line += prop.name + ": "; // We emit the literal value, unless the source code clearly refers to values from inside the // original project, in which case the evaluated value is used. if (considerValue && /(project|product|exportingProduct)\./.test(prop.sourceCode)) { var value; if (isModuleProperty) { var propertyName = prop.name.slice(separatorIndex + 1); value = product.exports[moduleName][propertyName]; } else { value = product.exports[prop.name]; } line += stringifyValue(project, product, moduleInstallDir, prop, value); } else { line += prop.sourceCode.replace(/importingProduct\./g, "product."); } moduleFile.writeLine(line); } function writeProperties(project, product, moduleInstallDir, list, indentation, considerValue, moduleFile) { for (var i = 0; i < list.length; ++i) { writeProperty(project, product, moduleInstallDir, list[i], indentation, considerValue, moduleFile); } } // This writes properties set on other modules in the Export item, i.e. property assignments // like "cpp.includePaths: '...'". function writeModuleProperties(project, product, output, moduleFile) { var moduleInstallDir = FileInfo.path(ModUtils.artifactInstalledFilePath(output)); var filteredProps = product.exports.properties.filter(function(p) { return p.name !== "name"; }); // The right-hand side can refer to values from the exporting product, in which case // the evaluated value, rather than the source code, needs to go into the module file. var considerValues = true; writeProperties(project, product, moduleInstallDir, filteredProps, " ", considerValues, moduleFile); } function writeItem(product, item, indentation, moduleFile) { moduleFile.writeLine(indentation + item.name + " {"); var newIndentation = indentation + " "; // These are sub-items of the Export item, whose properties entirely live in the context // of the importing product. Therefore, they must never use pre-evaluated values. var considerValues = false; writeProperties(undefined, product, undefined, item.properties, newIndentation, considerValues, moduleFile) for (var i = 0; i < item.childItems.length; ++i) writeItem(product, item.childItems[i], newIndentation, moduleFile); moduleFile.writeLine(indentation + "}"); } function isExcludedDependency(product, childItem) { if ((product.Exporter.qbs.excludedDependencies || []).length === 0) return false; if (childItem.name !== "Depends") return false; for (var i = 0; i < childItem.properties.length; ++i) { var prop = childItem.properties[i]; var unquotedRhs = prop.sourceCode.slice(1, -1); if (prop.name === "name" && product.Exporter.qbs.excludedDependencies.includes(unquotedRhs)) return true; } return false; } function writeChildItems(product, moduleFile) { for (var i = 0; i < product.exports.childItems.length; ++i) { var item = product.exports.childItems[i]; if (!isExcludedDependency(product, item)) writeItem(product, item, " ", moduleFile); } } function writeImportStatements(product, moduleFile) { var imports = product.exports.imports; // We potentially use FileInfo ourselves when transforming paths in stringifyValue(). if (!imports.includes("import qbs.FileInfo")) imports.push("import qbs.FileInfo"); for (var i = 0; i < imports.length; ++i) moduleFile.writeLine(imports[i]); } qbs-src-3.2.0/share/qbs/modules/Exporter/pkgconfig/0000755000175100017510000000000015154533055021620 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs0000644000175100017510000000736515154533055024311 0ustar runnerrunnerimport qbs.FileInfo import qbs.TextFile import "pkgconfig.js" as HelperFunctions Module { property string fileName: product.targetName + ".pc" property bool autoDetect: true property var transformFunction // function(product, moduleName, propertyName, valueElement) property stringList excludedDependencies property string nameEntry: product.name property string descriptionEntry: product.name property string versionEntry: product.version property string urlEntry property stringList cflagsEntry: [] property stringList libsEntry: [] property stringList libsPrivateEntry: [] property stringList requiresEntry: [] property stringList requiresPrivateEntry: [] property stringList conflictsEntry: [] property var customVariables property bool _usePrefix: autoDetect && qbs.installPrefix additionalProductTypes: ["Exporter.pkgconfig.pc"] Rule { multiplex: true requiresInputs: false // Make sure all relevant library artifacts have been created by the time we run. auxiliaryInputs: { if (!autoDetect) return undefined; if (product.type.includes("staticlibrary")) return ["staticlibrary"]; if (product.type.includes("dynamiclibrary")) return ["dynamiclibrary"]; } Artifact { filePath: product.Exporter.pkgconfig.fileName fileTags: ["Exporter.pkgconfig.pc"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "creating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); if (product.Exporter.pkgconfig._usePrefix) f.writeLine("prefix=" + product.qbs.installPrefix + "\n"); var customVariables = product.Exporter.pkgconfig.customVariables; if (customVariables) { for (var customVar in customVariables) f.writeLine(customVar + "=" + customVariables[customVar]); f.writeLine(""); } var autoDetectedData = HelperFunctions.collectAutodetectedData(product); HelperFunctions.writeEntry(product, f, "Name", "nameEntry", true); HelperFunctions.writeEntry(product, f, "Description", "descriptionEntry", true); HelperFunctions.writeEntry(product, f, "Version", "versionEntry", true); HelperFunctions.writeEntry(product, f, "URL", "urlEntry"); HelperFunctions.writeEntry(product, f, "Cflags", "cflagsEntry", false, autoDetectedData.cflags); HelperFunctions.writeEntry(product, f, "Libs", "libsEntry", false, autoDetectedData.libs); HelperFunctions.writeEntry(product, f, "Libs.private", "libsPrivateEntry"); HelperFunctions.writeEntry(product, f, "Requires", "requiresEntry", false, autoDetectedData.requires); HelperFunctions.writeEntry(product, f, "Requires.private", "requiresPrivateEntry", false, autoDetectedData.requiresPrivate); HelperFunctions.writeEntry(product, f, "Conflicts", "conflictsEntry"); }; return [cmd]; } } validate: { if (requiresEntry && excludedDependencies && requiresEntry.containsAny(excludedDependencies)) { throw "The contents of Export.pkgconfig.requiresEntry and " + "Export.pkgconfig.excludedDependencies must not overlap."; } } } qbs-src-3.2.0/share/qbs/modules/Exporter/pkgconfig/pkgconfig.js0000644000175100017510000002320615154533055024130 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); function quote(value) { if (value.includes(" ") || value.includes("'") || value.includes('"')) { return '"' + value.replace(/(["'\\])/g, "\\$1") + '"'; } return value; } function writeEntry(product, file, key, propertyName, required, additionalValues) { var value = product.Exporter.pkgconfig[propertyName]; if (additionalValues && additionalValues.length > 0) value = (value || []).concat(additionalValues); var valueIsNotEmpty = value && (!(value instanceof Array) || value.length > 0); if (valueIsNotEmpty) { if (value instanceof Array) value = value.join(' '); file.writeLine(key + ": " + value); } else if (required) { throw "Failure creating " + FileInfo.fileName(file.filePath()) + ": The entry '" + key + "' is required, but property Exporter.pkgconfig." + propertyName + " is not set."; } } function collectAutodetectedData(topLevelProduct) { var data = { libs: [], cflags: [], requires: [], requiresPrivate: [] }; if (!topLevelProduct.Exporter.pkgconfig.autoDetect) return data; var excludedDeps = topLevelProduct.Exporter.pkgconfig.excludedDependencies || []; var explicitRequires = topLevelProduct.Exporter.pkgconfig.requiresEntry || []; var explicitRequiresPrivate = topLevelProduct.Exporter.pkgconfig.requiresPrivateEntry || []; var transformFunc = topLevelProduct.Exporter.pkgconfig.transformFunction; // Make use of the "prefix" convenience variable if applicable. function quoteAndPrefixify(value) { var quotedValue = quote(value); var installPrefix = topLevelProduct.qbs.installPrefix || ""; if (!topLevelProduct.Exporter.pkgconfig._usePrefix || typeof value !== "string" || !value.startsWith(installPrefix) || (value.length > installPrefix.length && value[installPrefix.length] !== '/')) { return quotedValue; } return quotedValue.replace(topLevelProduct.qbs.installPrefix, "${prefix}"); } function transformedValue(product, moduleName, propertyName) { var originalValue = product.exports[moduleName][propertyName]; var value = transformFunc ? eval("(" + transformFunc + ")(product, moduleName, propertyName, originalValue)") : originalValue; if (value instanceof Array) value.forEach(function(v, i, a) { a[i] = quoteAndPrefixify(v); }); else if (value) value = quoteAndPrefixify(value); return value; } function collectLibs(productOrModule) { var libs = []; var libArtifacts; var isProduct = !productOrModule.present; var considerDynamicLibs = !isProduct || (productOrModule.type && productOrModule.type.includes("dynamiclibrary")); if (considerDynamicLibs) { libArtifacts = productOrModule.artifacts.dynamiclibrary; } else { var considerStaticLibs = !isProduct || (productOrModule.type && productOrModule.type.includes("staticlibrary")); if (considerStaticLibs) libArtifacts = productOrModule.artifacts.staticlibrary; } for (var i = 0; i < (libArtifacts || []).length; ++i) { var libArtifact = libArtifacts[i]; if (libArtifact.qbs.install) { var installDir = FileInfo.path(ModUtils.artifactInstalledFilePath(libArtifact)); installDir = installDir.slice(libArtifact.qbs.installRoot.length); libs.push("-L" + quoteAndPrefixify(FileInfo.cleanPath(installDir)), "-l" + quote(productOrModule.targetName)); } } if (!productOrModule.exports.cpp) return libs; var libPaths = transformedValue(productOrModule, "cpp", "libraryPaths"); if (libPaths) libs.push.apply(libs, libPaths.map(function(p) { return "-L" + p; })); function libNamesToLibEntries(libNames) { return libNames.map(function(libName) { return "-l" + libName; }); }; var dlls = transformedValue(productOrModule, "cpp", "dynamicLibraries"); if (dlls) libs.push.apply(libs, libNamesToLibEntries(dlls)); var staticLibs = transformedValue(productOrModule, "cpp", "staticLibraries"); if (staticLibs) libs.push.apply(libs, libNamesToLibEntries(staticLibs)); var lFlags = transformedValue(productOrModule, "cpp", "linkerFlags"); if (lFlags) libs.push.apply(libs, lFlags); lFlags = transformedValue(productOrModule, "cpp", "driverFlags"); if (lFlags) libs.push.apply(libs, lFlags); lFlags = transformedValue(productOrModule, "cpp", "driverLinkerFlags"); if (lFlags) libs.push.apply(libs, lFlags); return libs; } function collectCFlags(productOrModule) { if (!productOrModule.exports.cpp) return []; var flags = []; var defs = transformedValue(productOrModule, "cpp", "defines"); if (defs) flags.push.apply(flags, defs.map(function(d) { return "-D" + d; })); var incPaths = transformedValue(productOrModule, "cpp", "includePaths"); if (incPaths) flags.push.apply(flags, incPaths.map(function(p) { return "-I" + p; })); var cflags = transformedValue(productOrModule, "cpp", "commonCompilerFlags"); if (cflags) flags.push.apply(flags, cflags); cflags = transformedValue(productOrModule, "cpp", "driverFlags"); if (cflags) flags.push.apply(flags, cflags); cflags = transformedValue(productOrModule, "cpp", "cxxFlags") || transformedValue(productOrModule, "cpp", "cFlags"); if (cflags) flags.push.apply(flags, cflags); return flags; } function collectAutodetectedDataRecursive(productOrModule, privateContext) { if (!privateContext) { data.libs.push.apply(data.libs, collectLibs(productOrModule)); data.cflags.push.apply(data.cflags, collectCFlags(productOrModule)); } var exportedDeps = productOrModule.exports ? productOrModule.exports.dependencies : []; var exportedDepNames = []; var privateDeps = []; for (var i = 0; i < exportedDeps.length; ++i) exportedDepNames.push(exportedDeps[i].name); for (i = 0; i < (productOrModule.dependencies || []).length; ++i) { var dep = productOrModule.dependencies[i]; if (exportedDepNames.includes(dep.name)) continue; privateDeps.push(dep); } function gatherData(dep) { if (dep.name === "Exporter.pkgconfig") return; var depHasPkgConfig = dep.Exporter && dep.Exporter.pkgconfig; if (depHasPkgConfig) { var entry = FileInfo.completeBaseName(dep.Exporter.pkgconfig.fileName); if (excludedDeps.includes(entry)) return; if (isPrivateDep && !data.requiresPrivate.includes(entry) && !explicitRequiresPrivate.includes(entry)) { data.requiresPrivate.push(entry); } if (!isPrivateDep && !data.requires.includes(entry) && !explicitRequires.includes(entry)) { data.requires.push(entry); } } else { if (excludedDeps.includes(dep.name)) return; if (isPrivateDep && explicitRequiresPrivate.includes(dep.name)) return; if (!isPrivateDep && explicitRequires.includes(dep.name)) return; collectAutodetectedDataRecursive(dep, isPrivateDep); } } var isPrivateDep = privateContext; exportedDeps.forEach(gatherData); isPrivateDep = true; privateDeps.forEach(gatherData); } collectAutodetectedDataRecursive(topLevelProduct, false); return data; } qbs-src-3.2.0/share/qbs/modules/Exporter/cmake/0000755000175100017510000000000015154533055020731 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/Exporter/cmake/cmakeexporter.qbs0000644000175100017510000000643515154533055024321 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Raphaël Cotty ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com) ** 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$ ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.ModUtils import qbs.TextFile import "cmakeexporter.js" as HelperFunctions Module { property string configFileName: packageName + "Config.cmake" property string versionFileName: packageName + "ConfigVersion.cmake" property string packageName: product.targetName additionalProductTypes: ["Exporter.cmake.package"] Rule { multiplex: true requiresInputs: false auxiliaryInputs: { if (product.type.includes("staticlibrary")) return ["staticlibrary"]; if (product.type.includes("dynamiclibrary")) return ["dynamiclibrary"]; } Artifact { filePath: product.Exporter.cmake.configFileName fileTags: ["Exporter.cmake.package", "Exporter.cmake.configFile"] } Artifact { filePath: product.Exporter.cmake.versionFileName fileTags: ["Exporter.cmake.package", "Exporter.cmake.versionFile"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generate cmake package files"; cmd.sourceCode = function() { HelperFunctions.writeConfigFile(project, product, outputs); HelperFunctions.writeVersionFile(product, outputs); } return [cmd]; } } } qbs-src-3.2.0/share/qbs/modules/Exporter/cmake/cmakeexporter.js0000644000175100017510000002417615154533055024152 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Raphaël Cotty ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of the Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); var ModUtils = require("qbs.ModUtils"); var ExporterHelpers = require("../exporter.js"); function tagListToString(tagList) { return JSON.stringify(tagList); } function collectAutodetectedData(project, topLevelProduct, outputs) { var packageName = topLevelProduct.Exporter.cmake.packageName; var data = {}; data.packageName = packageName; data.installPrefixDir = "_" + packageName.toUpperCase() + "_INSTALL_PREFIX"; data.packages = []; function quote(value) { return "\"" + value + "\""; } function quoteAndPrefixify(propName) { function quoteAndPrefixifyHelper(value) { var prefixToStrip = ExporterHelpers.getPrefixToStrip(project, topLevelProduct, propName, value); if (typeof value !== "string" || !prefixToStrip || (value.length > prefixToStrip.length && value[prefixToStrip.length] !== '/')) { return quote(value); } return quote("${" + data.installPrefixDir + "}" + value.slice(prefixToStrip.length)); } return quoteAndPrefixifyHelper; } var installedOutputFilePath = ModUtils.artifactInstalledFilePath( outputs["Exporter.cmake.configFile"][0]); var installedOutputPathName = FileInfo.path(installedOutputFilePath); var installRootPath = FileInfo.joinPaths(topLevelProduct.qbs.installRoot, topLevelProduct.qbs.installPrefix); data.installPrefix = FileInfo.relativePath(installedOutputPathName, installRootPath); var libArtifacts; var libImportArtifacts; var isProduct = !topLevelProduct.present; var considerFramework = !isProduct || (topLevelProduct.type && topLevelProduct.type.includes("bundle.content")) && topLevelProduct.bundle && topLevelProduct.bundle.isBundle && topLevelProduct.qbs.targetOS.includes("darwin"); var considerDynamicLibs = !isProduct || (topLevelProduct.type && topLevelProduct.type.includes("dynamiclibrary")); var considerStaticLibs = !isProduct || (topLevelProduct.type && topLevelProduct.type.includes("staticlibrary")); if (considerFramework) { libArtifacts = topLevelProduct.artifacts["bundle.symlink.executable"]; if (considerDynamicLibs) data.type = "SHARED"; else if (considerStaticLibs) data.type = "STATIC"; else data.type = "INTERFACE"; } else if (considerDynamicLibs) { libArtifacts = topLevelProduct.artifacts.dynamiclibrary; libImportArtifacts = topLevelProduct.artifacts.dynamiclibrary_import; data.type = "SHARED"; } else if (considerStaticLibs) { libArtifacts = topLevelProduct.artifacts.staticlibrary; data.type = "STATIC"; } else { data.type = "INTERFACE"; } for (var i = 0; i < (libArtifacts || []).length; ++i) { var libArtifact = libArtifacts[i]; var libImportArtifact = (libImportArtifacts || [])[i]; if (libArtifact.qbs.install) { var installPath = ModUtils.artifactInstalledFilePath(libArtifact); data.importedLocation = quoteAndPrefixify("installRoot")(installPath); data.soName = topLevelProduct.targetName; if (libImportArtifact && libImportArtifact.qbs.install) { installPath = ModUtils.artifactInstalledFilePath(libImportArtifact); data.importedImplibLocation = quoteAndPrefixify("installRoot")(installPath); } break; } } var cpp = topLevelProduct.exports.cpp; if (cpp) { data.libraryPaths = (cpp.libraryPaths || []).map(quoteAndPrefixify("cpp.libraryPaths")); data.linkLibraries = []; data.linkLibraries = data.linkLibraries.concat(cpp.dynamicLibraries || []); data.linkLibraries = data.linkLibraries.concat(cpp.staticLibraries || []); data.linkLibraries = data.linkLibraries.map(quoteAndPrefixify("cpp.dynamicLibraries")); data.linkOptions = []; data.linkOptions = data.linkOptions.concat(cpp.driverLinkerFlags || []); if ((cpp.linkerFlags || []).length > 0) { data.linkOptions = data.linkOptions.concat("LINKER:" + (cpp.linkerFlags || []).join(",")); } data.linkOptions = data.linkOptions.map(quote); data.includeDirectories = (cpp.includePaths || []).map(quoteAndPrefixify("cpp.includePaths")); data.compileDefinitions = (cpp.defines || []).map(quote); data.compileOptions = []; data.compileOptions = data.compileOptions.concat(cpp.commonCompilerFlags || []); data.compileOptions = data.compileOptions.concat(cpp.driverFlags || []); data.compileOptions = data.compileOptions.concat(cpp.cxxFlags || []); data.compileOptions = data.compileOptions.concat(cpp.cFlags || []); data.compileOptions = data.compileOptions.map(quote); } function gatherDeps(dep) { if (dep.name === "Exporter.cmake") return; var depHasExporter = dep.Exporter && dep.Exporter.cmake; if (!depHasExporter) return; data.packages.push(dep.Exporter.cmake.packageName); } var exportedDeps = topLevelProduct.exports ? topLevelProduct.exports.dependencies : []; exportedDeps.forEach(gatherDeps); return data; } function writeConfigFile(project, product, outputs) { var autoDetectedData = collectAutodetectedData(project, product, outputs); var packageName = autoDetectedData.packageName; function writeCommand(command, lines) { if ((lines || []).length === 0) return; cmakeConfigFile.writeLine(command + "(" + packageName + " INTERFACE"); for (i = 0; i < lines.length; i++) { cmakeConfigFile.writeLine(" " + lines[i]); } cmakeConfigFile.writeLine(")"); } var cmakeConfigFile = new TextFile(outputs["Exporter.cmake.configFile"][0].filePath, TextFile.WriteOnly); cmakeConfigFile.writeLine("# Generated by Qbs"); cmakeConfigFile.writeLine("cmake_minimum_required(VERSION 3.5)"); cmakeConfigFile.writeLine("if(TARGET " + packageName + ")"); cmakeConfigFile.writeLine(" return()"); cmakeConfigFile.writeLine("endif()"); cmakeConfigFile.writeLine("set(" + autoDetectedData.installPrefixDir + " \"${CMAKE_CURRENT_LIST_DIR}/" + autoDetectedData.installPrefix + "\")"); autoDetectedData.packages.forEach(function(packageName) { cmakeConfigFile.writeLine("find_package(" + packageName + " REQUIRED SILENT)"); }); cmakeConfigFile.writeLine( "add_library(" + packageName + " " + autoDetectedData.type + " IMPORTED)"); var configuration = (product.qbs.buildVariant) ? product.qbs.buildVariant.toUpperCase() : "NONE"; cmakeConfigFile.writeLine("set_property(TARGET " + packageName + " APPEND PROPERTY IMPORTED_CONFIGURATIONS " + configuration + ")"); cmakeConfigFile.writeLine("set_target_properties(" + packageName + " PROPERTIES"); cmakeConfigFile.writeLine(" IMPORTED_LINK_INTERFACE_LANGUAGES_" + configuration + " CXX"); if (autoDetectedData.type !== "INTERFACE") { cmakeConfigFile.writeLine(" IMPORTED_LOCATION_" + configuration + " " + autoDetectedData.importedLocation); } if (autoDetectedData.importedImplibLocation) { cmakeConfigFile.writeLine(" IMPORTED_IMPLIB_" + configuration + " " + autoDetectedData.importedImplibLocation); } cmakeConfigFile.writeLine(")"); writeCommand("target_link_directories", autoDetectedData.libraryPaths); writeCommand("target_link_libraries", autoDetectedData.linkLibraries.concat(autoDetectedData.packages)); writeCommand("target_link_options", autoDetectedData.linkOptions); writeCommand("target_include_directories", autoDetectedData.includeDirectories); writeCommand("target_compile_definitions", autoDetectedData.compileDefinitions); writeCommand("target_compile_options", autoDetectedData.compileOptions); cmakeConfigFile.close(); } function writeVersionFile(product, outputs) { var cmakeVersionFile = new TextFile( outputs["Exporter.cmake.versionFile"][0].filePath, TextFile.WriteOnly); cmakeVersionFile.writeLine("# Generated by Qbs"); cmakeVersionFile.writeLine("set(PACKAGE_VERSION \"" + product.version + "\")"); cmakeVersionFile.close(); } qbs-src-3.2.0/share/qbs/modules/codesign/0000755000175100017510000000000015154533055017634 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/codesign/signtool.qbs0000644000175100017510000000700415154533055022202 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.Host import qbs.ModUtils import qbs.Probes import "codesign.js" as CODESIGN CodeSignModule { condition: qbs.targetOS.includes("windows") && Host.os().includes("windows") && qbs.toolchain.includes("msvc") _canSignArtifacts: true Probes.BinaryProbe { id: signtoolProbe names: [codesignName] searchPaths: CODESIGN.findBestSignToolSearchPaths(Host.architecture()) } codesignName: "signtool" codesignPath: signtoolProbe.filePath property string subjectName PropertyOptions { name: "subjectName" description: "Name of the subject of the signing certificate." } property string rootSubjectName PropertyOptions { name: "rootSubjectName" description: "Name of the subject of the root certificate that the signing " + "certificate must chain to." } property string hashAlgorithm PropertyOptions { name: "hashAlgorithm" description: "Name of the hash algorithm used on the signing certificate." 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" description: "Path to the signing certificate PFX file." } property string certificatePassword PropertyOptions { name: "certificatePassword" description: "Password to use when opening a certificate PFX file." } property path crossCertificatePath PropertyOptions { name: "crossCertificatePath" description: "Path to the additional certificate CER file." } validate: { if (enableCodeSigning && !File.exists(codesignPath)) { throw ModUtils.ModuleError("Could not find 'signtool' utility"); } } } qbs-src-3.2.0/share/qbs/modules/codesign/CodeSignModule.qbs0000644000175100017510000000404015154533055023202 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import "codesign.js" as CodeSign Module { condition: false property bool enableCodeSigning: false property string codesignName property string codesignPath: codesignName property stringList codesignFlags property string signingTimestamp PropertyOptions { name: "signingTimestamp" description: "URL of the RFC 3161 time stamp server." } property bool _canSignArtifacts: false // whether can sign individual actifacts } qbs-src-3.2.0/share/qbs/modules/codesign/apple.qbs0000644000175100017510000002207415154533055021451 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.BundleTools import qbs.DarwinTools import qbs.Environment import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.PropertyList import qbs.Probes import qbs.Utilities import "codesign.js" as CodeSign import "../xcode/xcode.js" as XcodeUtils CodeSignModule { Depends { name: "xcode"; required: qbs.toolchain && qbs.toolchain.includes("xcode") } Probes.BinaryProbe { id: codesignProbe names: [codesignName] } condition: Host.os().includes("macos") && qbs.targetOS.includes("darwin") priority: 0 enableCodeSigning: _codeSigningRequired codesignName: "codesign" codesignPath: codesignProbe.filePath _canSignArtifacts: true property string signingType: { if (_adHocCodeSigningAllowed) return "ad-hoc"; if (_codeSigningAllowed) return "app-store"; } PropertyOptions { name: "signingType" allowedValues: ["app-store", "apple-id", "ad-hoc"] } property string signingIdentity: { if (signingType === "ad-hoc") // only useful on macOS return "-"; var isDebug = qbs.buildVariant !== "release"; if (qbs.targetOS.includes("ios") || qbs.targetOS.includes("tvos") || qbs.targetOS.includes("watchos")) { switch (signingType) { case "app-store": return isDebug ? "iPhone Developer" : "iPhone Distribution"; } } if (qbs.targetOS.includes("macos")) { switch (signingType) { case "app-store": return isDebug ? "Mac Developer" : "3rd Party Mac Developer Application"; case "apple-id": return "Developer ID Application"; } } } signingTimestamp: "none" property string provisioningProfile PropertyOptions { name: "provisioningProfile" description: "Name or UUID of the provisioning profile to embed in the application; " + "typically left blank to allow automatic provisioning" } property string teamIdentifier PropertyOptions { name: "teamIdentifier" description: "Name or identifier of the development team whose identities will be used; " + "typically left blank unless signed into multiple development teams" } property path provisioningProfilesPath: { if (xcode.present && Utilities.versionCompare(xcode.version, "26.0.0") < 0) return "~/Library/MobileDevice/Provisioning Profiles"; return "~/Library/Developer/Xcode/UserData/Provisioning Profiles" } readonly property var _actualSigningIdentity: { if (signingIdentity === "-") { return { SHA1: signingIdentity, subjectInfo: { CN: "ad hoc" } } } var identities = CodeSign.findSigningIdentities(signingIdentity, teamIdentifier); if (identities && Object.keys(identities).length > 1) { throw "Multiple codesigning identities (i.e. certificate and private key pairs) " + "matching '" + signingIdentity + "' were found." + CodeSign.humanReadableIdentitySummary(identities); } for (var i in identities) return identities[i]; } // Allowed for macOS readonly property bool _adHocCodeSigningAllowed: XcodeUtils.boolFromSdkOrPlatform("AD_HOC_CODE_SIGNING_ALLOWED", xcode._sdkProps, xcode._platformProps, true) // Allowed for all device platforms (not simulators) readonly property bool _codeSigningAllowed: XcodeUtils.boolFromSdkOrPlatform("CODE_SIGNING_ALLOWED", xcode._sdkProps, xcode._platformProps, true) // Required for tvOS, iOS, and watchOS (not simulators) property bool _codeSigningRequired: { // allow to override value from Xcode so tests do not require signing var envRequired = Environment.getEnv("QBS_AUTOTEST_CODE_SIGNING_REQUIRED"); if (envRequired) return envRequired === "1"; return XcodeUtils.boolFromSdkOrPlatform("CODE_SIGNING_REQUIRED", xcode._sdkProps, xcode._platformProps, false) } // Required for tvOS, iOS, and watchOS (not simulators) readonly property bool _entitlementsRequired: XcodeUtils.boolFromSdkOrPlatform("ENTITLEMENTS_REQUIRED", xcode._sdkProps, xcode._platformProps, false) readonly property bool _provisioningProfileAllowed: product.bundle && product.bundle.isBundle && product.type.includes("application") && xcode.platformType !== "simulator" // Required for tvOS, iOS, and watchOS (not simulators) // PROVISIONING_PROFILE_REQUIRED is specified only in Embedded-Device.xcspec in the // IDEiOSSupportCore IDE plugin, so we'll just write out the logic here manually readonly property bool _provisioningProfileRequired: _provisioningProfileAllowed && !qbs.targetOS.includes("macos") // Not used on simulator platforms either but provisioning profiles aren't used there anyways readonly property string _provisioningProfilePlatform: { if (qbs.targetOS.includes("macos")) return "OSX"; if (qbs.targetOS.includes("ios") || qbs.targetOS.includes("watchos")) return "iOS"; if (qbs.targetOS.includes("tvos")) return "tvOS"; } readonly property string _embeddedProfileName: (xcode._platformProps || {})["EMBEDDED_PROFILE_NAME"] || "embedded.mobileprovision" setupBuildEnvironment: { var prefixes = product.xcode ? [ product.xcode.platformPath + "/Developer", product.xcode.toolchainPath, product.xcode.developerPath ] : []; for (var i = 0; i < prefixes.length; ++i) { var codesign_allocate = prefixes[i] + "/usr/bin/codesign_allocate"; if (File.exists(codesign_allocate)) { var v = new ModUtils.EnvironmentVariable("CODESIGN_ALLOCATE"); v.value = codesign_allocate; v.set(); break; } } } Group { name: "Provisioning Profiles" prefix: provisioningProfilesPath + "/" files: ["*.mobileprovision", "*.provisionprofile"] } FileTagger { fileTags: ["codesign.entitlements"] patterns: ["*.entitlements"] } FileTagger { fileTags: ["codesign.provisioningprofile"] patterns: ["*.mobileprovision", "*.provisionprofile"] } Group { condition: enableCodeSigning Rule { multiplex: true inputs: ["codesign.entitlements", "codesign.embedded_provisioningprofile"] Artifact { filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + ".xcent") fileTags: ["codesign.xcent"] } prepare: CodeSign.generateAppleEntitlementsCommands.apply(CodeSign, arguments) } Rule { multiplex: true condition: module._provisioningProfileAllowed inputs: ["codesign.provisioningprofile"] outputFileTags: ["codesign.embedded_provisioningprofile"] outputArtifacts: CodeSign.generateAppleProvisioningProfileOutputs(product, inputs) prepare: CodeSign.generateAppleProvisioningProfileCommands.apply(CodeSign, arguments) } } } qbs-src-3.2.0/share/qbs/modules/codesign/android.qbs0000644000175100017510000001223115154533055021762 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Raphaël Cotty ** Contact: http://www.qt.io/licensing ** ** This file is part of the Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.Environment import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.Probes import "codesign.js" as CodeSign CodeSignModule { condition: qbs.targetOS.includes("android") priority: 1 enableCodeSigning: true property bool useApksigner: true property path apksignerFilePath Probes.JdkProbe { id: jdk environmentPaths: (jdkPath ? [jdkPath] : []).concat(base) } property string jdkPath: jdk.path property string jarsignerFilePath: FileInfo.joinPaths(jdkPath, "bin", jarsignerName) property string jarsignerName: "jarsigner" property string keytoolFilePath: FileInfo.joinPaths(jdkPath, "bin", keytoolName) property string keytoolName: "keytool" property string debugKeystorePath: FileInfo.joinPaths( Environment.getEnv(Host.os().includes("windows") ? "USERPROFILE" : "HOME"), ".android", "debug.keystore") readonly property string debugKeystorePassword: "android" readonly property string debugPassword: "android" readonly property string debugKeyAlias: "androiddebugkey" property string keystorePath: debugKeystorePath property string keystorePassword: debugKeystorePassword property string keyPassword: debugPassword property string keyAlias: debugKeyAlias // Private property set by the Android.sdk module property string _packageName Rule { condition: useApksigner inputs: ["android.package_unsigned"] Artifact { filePath: product.codesign._packageName fileTags: "android.package" } prepare: CodeSign.signApkPackage.apply(this, arguments) } Rule { condition: !useApksigner inputs: ["android.package_unsigned"] Artifact { filePath: product.codesign._packageName fileTags: "android.package" } prepare: CodeSign.signAabPackage.apply(this, arguments) } validate: { // Typically there is a debug keystore in ~/.android/debug.keystore which gets created // by the native build tools the first time a build is done. However, we don't want to // create it ourselves, because writing to a location outside the qbs build directory is // both polluting and has the potential for race conditions. So we'll instruct the user what // to do. if (keystorePath === debugKeystorePath && !File.exists(debugKeystorePath)) { throw ModUtils.ModuleError("Could not find an Android debug keystore at " + codesign.debugKeystorePath + ". " + "If you are developing for Android on this machine for the first time and " + "have never built an application using the native Gradle / Android Studio " + "tooling, this is normal. You must create the debug keystore now using the " + "following command, in order to continue:\n\n" + CodeSign.createDebugKeyStoreCommandString(codesign.keytoolFilePath, codesign.debugKeystorePath, codesign.debugKeystorePassword, codesign.debugPassword, codesign.debugKeyAlias) + "\n\n" + "See the following URL for more information: " + "https://developer.android.com/studio/publish/app-signing.html#debug-mode"); } } } qbs-src-3.2.0/share/qbs/modules/codesign/codesign.js0000644000175100017510000006504215154533055021774 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var PathTools = require("qbs.PathTools"); var Process = require("qbs.Process"); var PropertyList = require("qbs.PropertyList"); var Utilities = require("qbs.Utilities"); function findSigningIdentities(searchString, team) { if (!searchString) return {}; var identities = Utilities.signingIdentities(); var matchedIdentities = {}; for (var key in identities) { var identity = identities[key]; if (team && ![identity.subjectInfo.O, identity.subjectInfo.OU].includes(team)) continue; if (searchString === key || (identity.subjectInfo.CN && identity.subjectInfo.CN.startsWith(searchString))) { matchedIdentities[key] = identity; } } return matchedIdentities; } function humanReadableIdentitySummary(identities) { return "\n\t" + Object.keys(identities).map(function (key) { return identities[key].subjectInfo.CN + " in team " + identities[key].subjectInfo.O + " (" + identities[key].subjectInfo.OU + ")"; }).join("\n\t"); } /** * Returns the best provisioning profile for code signing a binary with the given parameters. * Ideally, this should behave identically as Xcode but the algorithm is not documented * \l{https://developer.apple.com/library/ios/qa/qa1814/_index.html}{Automatic Provisioning} */ function findBestProvisioningProfile(product, files) { var actualSigningIdentity = product.codesign._actualSigningIdentity || {}; var teamIdentifier = product.codesign.teamIdentifier; var bundleIdentifier = product.bundle.identifier; var targetOS = product.qbs.targetOS; var buildVariant = product.qbs.buildVariant; var query = product.codesign.provisioningProfile; var profilePlatform = product.codesign._provisioningProfilePlatform; // Read all provisioning profiles on disk into plist objects in memory var profiles = files.map(function(filePath) { var plist = new PropertyList(); try { plist.readFromData(Utilities.smimeMessageContent(filePath)); return { data: plist.toObject(), filePath: filePath }; } finally { plist.clear(); } }); // Do a simple search by matching UUID or Name if (query) { for (var i = 0; i < profiles.length; ++i) { var obj = profiles[i]; if (obj.data && (obj.data.UUID === query || obj.data.Name === query)) return obj; } // If we asked for a specific provisioning profile, don't select one automatically return undefined; } // Provisioning profiles are not normally used with ad-hoc code signing or non-apps // We do these checks down here only for the automatic selection but not above because // if the user explicitly selects a provisioning profile it should be used no matter what if (actualSigningIdentity.SHA1 === "-" || !product.type.includes("application")) return undefined; // Filter out any provisioning profiles we know to be unsuitable from the start profiles = profiles.filter(function (profile) { var data = profile.data; if (actualSigningIdentity.subjectInfo) { var certCommonNames = (data["DeveloperCertificates"] || []).map(function (cert) { return Utilities.certificateInfo(cert).subjectInfo.CN; }); if (!certCommonNames.includes(actualSigningIdentity.subjectInfo.CN)) { console.log("Skipping provisioning profile with no matching certificate names for '" + actualSigningIdentity.subjectInfo.CN + "' (found " + certCommonNames.join(", ") + "): " + profile.filePath); return false; } } var platforms = data["Platform"] || []; if (platforms.length > 0 && profilePlatform && !platforms.includes(profilePlatform)) { console.log("Skipping provisioning profile for platform " + platforms.join(", ") + " (current platform " + profilePlatform + ")" + ": " + profile.filePath); return false; } if (teamIdentifier && !data["TeamIdentifier"].includes(teamIdentifier) && data["TeamName"] !== teamIdentifier) { console.log("Skipping provisioning profile for team " + data["TeamIdentifier"] + " (" + data["TeamName"] + ") (current team " + teamIdentifier + ")" + ": " + profile.filePath); return false; } if (Date.parse(data["ExpirationDate"]) <= Date.now()) { console.log("Skipping expired provisioning profile: " + profile.filePath); return false; } // Filter development vs distribution profiles; // though the certificate common names check should have been sufficient var isDebug = buildVariant === "debug"; if (data["Entitlements"]["get-task-allow"] !== isDebug) { console.log("Skipping provisioning profile for wrong debug mode: " + profile.filePath); return false; } var prefix = data["ApplicationIdentifierPrefix"]; var fullAppId = data["Entitlements"]["application-identifier"]; if ([prefix, bundleIdentifier].join(".") !== fullAppId && [prefix, "*"].join(".") !== fullAppId) { console.log("Skipping provisioning profile not matching full (" + [prefix, bundleIdentifier].join(".") + ") or wildcard (" + [prefix, "*"].join(".") + ") app ID (found " + fullAppId + "): " + profile.filePath); return false; } return true; }); // Sort by expiration date - sooner expiration dates come last profiles.sort(function(profileA, profileB) { var expA = Date.parse(profileA.data["ExpirationDate"]); var expB = Date.parse(profileB.data["ExpirationDate"]); if (expA < expB) return -1; if (expA > expB) return 1; return 0; }); // Sort by application identifier - wildcard profiles come last profiles.sort(function(profileA, profileB) { var idA = profileA.data["Entitlements"]["application-identifier"]; var idB = profileB.data["Entitlements"]["application-identifier"]; if (!idA.endsWith(".*") && idB.endsWith(".*")) return -1; if (idA.endsWith(".*") && !idB.endsWith(".*")) return 1; return 0; }); if (profiles.length) { console.log("Automatic provisioning using profile " + profiles[0].data.UUID + " (" + profiles[0].data.TeamName + " - " + profiles[0].data.Name + ") in product " + product.name); return profiles[0]; } } /** * Finds out the search paths for the `signtool.exe` utility supplied with * the Windows SDK's. */ function findBestSignToolSearchPaths(arch) { var searchPaths = []; var keys = [ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows" ]; for (var keyIndex = 0; keyIndex < keys.length; ++keyIndex) { var re = /^v([0-9]+)\.([0-9]+)$/; var groups = Utilities.nativeSettingGroups(keys[keyIndex]).filter(function(version) { return version.match(re); }); groups.sort(function(a, b) { return Utilities.versionCompare(b.substring(1), a.substring(1)); }); function addSearchPath(searchPath) { if (File.exists(searchPath) && !searchPaths.includes(searchPath)) { searchPaths.push(searchPath); return true; } return false; } for (var groupIndex = 0; groupIndex < groups.length; ++groupIndex) { var fullKey = keys[keyIndex] + "\\" + groups[groupIndex]; var fullVersion = Utilities.getNativeSetting(fullKey, "ProductVersion"); if (fullVersion) { var installRoot = FileInfo.cleanPath( Utilities.getNativeSetting(fullKey, "InstallationFolder")); if (installRoot) { // Try to add the architecture-independent path at first. var searchPath = FileInfo.joinPaths(installRoot, "App Certification Kit"); if (!addSearchPath(searchPath)) { // Try to add the architecture-dependent paths at second. var binSearchPath = FileInfo.joinPaths(installRoot, "bin/" + fullVersion); if (!File.exists(binSearchPath)) { binSearchPath += ".0"; if (!File.exists(binSearchPath)) continue; } function kitsArchitectureSubDirectory(arch) { if (arch === "x86") return "x86"; else if (arch === "x86_64") return "x64"; else if (arch.startsWith("arm64")) return "arm64"; else if (arch.startsWith("arm")) return "arm"; } var archDir = kitsArchitectureSubDirectory(arch); searchPath = FileInfo.joinPaths(binSearchPath, archDir); addSearchPath(searchPath); } } } } } return searchPaths; } function prepareSign(project, product, inputs, outputs, input, output) { var cmd, cmds = []; if (!product.codesign.enableCodeSigning) return cmds; var isBundle = "bundle.content" in outputs; var artifacts = []; if (isBundle) { artifacts = [{ filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName), fileName: product.bundle.bundleName }]; } else { artifacts = outputs["codesign.signed_artifact"]; } var isProductBundle = product.bundle && product.bundle.isBundle; var shouldSignArtifact = !isProductBundle || isBundle; var enableCodeSigning = product.codesign.enableCodeSigning; if (enableCodeSigning) { var actualSigningIdentity = product.codesign._actualSigningIdentity; if (!actualSigningIdentity) { throw "No codesigning identities (i.e. certificate and private key pairs) matching “" + product.codesign.signingIdentity + "” were found."; } // If this is a framework, we need to sign its versioned directory var subpath = ""; if (isBundle) { var isFramework = product.bundle.packageType === "FMWK"; if (isFramework) { subpath = product.bundle.contentsFolderPath; subpath = subpath.substring(product.bundle.bundleName.length); } } // The codesign tool behaves weirdly. It can sign a bundle with a single artifact, but if // say debug build variant is present, it starts complaining that it is not signed. // We could always sign everything, but again, in case of a framework (but not in case of // app or loadable bundle), codesign produces a warning that artifact is already signed. // So, we skip signing the release artifact and only sign if other build variants present. if (!shouldSignArtifact && artifacts.length == 1) { artifacts = []; } for (var i = 0; i < artifacts.length; ++i) { if (!shouldSignArtifact && artifacts[i].qbs && artifacts[i].qbs.buildVariant === "release") { continue; } var outputFilePath = artifacts[i].filePath; var outputFileName = artifacts[i].fileName; 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 var signingTimestamp = product.codesign.signingTimestamp; if (signingTimestamp) { // If signingTimestamp is an empty string, specify the flag but do // not specify a value - this uses a default Apple-provided server var flag = "--timestamp"; if (signingTimestamp) flag += "=" + signingTimestamp; args.push(flag); } for (var j in inputs["codesign.xcent"]) { 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 + " (" + actualSigningIdentity.subjectInfo.CN + ")"; cmd.outputFilePath = outputFilePath; cmd.stderrFilterFunction = function(stderr) { return stderr.replace(/^.*: replacing existing signature\n$/, ""); }; cmds.push(cmd); } } if (isBundle) { cmd = new Command("touch", ["-c", outputFilePath]); cmd.silent = true; cmds.push(cmd); } return cmds; } function signApkPackage(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var apkInput = inputs["android.package_unsigned"][0]; var apkOutput = outputs["android.package"][0]; var cmd; if (product.codesign.enableCodeSigning) { var args = ["sign", "--ks", product.codesign.keystorePath, "--ks-pass", "pass:" + product.codesign.keystorePassword, "--ks-key-alias", product.codesign.keyAlias, "--key-pass", "pass:" + product.codesign.keyPassword, "--out", apkOutput.filePath, apkInput.filePath]; cmd = new Command(product.codesign.apksignerFilePath, args); cmd.description = "signing " + apkOutput.fileName; } else { cmd = new JavaScriptCommand(); cmd.description = "copying without signing " + apkOutput.fileName; cmd.source = apkInput.filePath; cmd.target = apkOutput.filePath; cmd.silent = true; cmd.sourceCode = function() { // If enableCodeSigning is changed to false without any change to unsigned package then // the copy won't happen because of timestamps. So the target file needs file needs to // be removed to avoid it. File.remove(target); File.copy(source, target); } } return cmd; } function signAabPackage(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var aabInput = inputs["android.package_unsigned"][0]; var aabOutput = outputs["android.package"][0]; var cmd; if (product.codesign.enableCodeSigning) { args = ["-sigalg", "SHA1withRSA", "-digestalg", "SHA1", "-keystore", product.codesign.keystorePath, "-storepass", product.codesign.keystorePassword, "-keypass", product.codesign.keyPassword, "-signedjar", aabOutput.filePath, aabInput.filePath, product.codesign.keyAlias]; cmd = new Command(product.codesign.jarsignerFilePath, args); cmd.description = "signing " + aabOutput.fileName; } else { cmd = new JavaScriptCommand(); cmd.description = "copying without signing " + aabOutput.fileName; cmd.source = aabInput.filePath; cmd.target = aabOutput.filePath; cmd.silent = true; cmd.sourceCode = function() { // If enableCodeSigning is changed to false without any change to unsigned package then // the copy won't happen because of timestamps. So the target file needs file needs to // be removed to avoid it. File.remove(target); File.copy(source, target); } } return cmd; } function createDebugKeyStoreCommandString(keytoolFilePath, keystoreFilePath, keystorePassword, keyPassword, keyAlias) { var args = ["-genkey", "-keystore", keystoreFilePath, "-alias", keyAlias, "-storepass", keystorePassword, "-keypass", keyPassword, "-keyalg", "RSA", "-keysize", "2048", "-validity", "10000", "-dname", "CN=Android Debug,O=Android,C=US"]; return Process.shellQuote(keytoolFilePath, args); } function prepareSigntool(project, product, inputs, outputs, input, output) { var cmd, cmds = []; if (!product.codesign.enableCodeSigning) return cmds; var args = ["sign"]; var subjectName = product.codesign.subjectName; if (subjectName) args.push("/n", subjectName); var rootSubjectName = product.codesign.rootSubjectName; if (rootSubjectName) args.push("/r", rootSubjectName); var hashAlgorithm = product.codesign.hashAlgorithm; if (hashAlgorithm) args.push("/fd", hashAlgorithm); var signingTimestamp = product.codesign.signingTimestamp; 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); var certificatePassword = product.codesign.certificatePassword; if (certificatePassword) args.push("/p", certificatePassword); var crossCertificatePath = product.codesign.crossCertificatePath; if (crossCertificatePath) args.push("/ac", crossCertificatePath); args = args.concat(product.codesign.codesignFlags || []); var outputArtifact = outputs["codesign.signed_artifact"][0]; args.push(outputArtifact.filePath); cmd = new Command(product.codesign.codesignPath, args); cmd.description = "signing " + outputArtifact.fileName; cmd.highlight = "linker"; cmds.push(cmd); return cmds; } function generateAppleProvisioningProfileOutputs() { var artifacts = []; var provisioningProfiles = (inputs["codesign.provisioningprofile"] || []) .map(function (a) { return a.filePath; }); var bestProfile = findBestProvisioningProfile(product, provisioningProfiles); var uuid = product.provisioningProfile; if (bestProfile) { artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, product.codesign._embeddedProfileName), fileTags: ["codesign.embedded_provisioningprofile"], codesign: { _provisioningProfileFilePath: bestProfile.filePath, _provisioningProfileData: JSON.stringify(bestProfile.data), } }); } else if (uuid) { throw "Your build settings specify a provisioning profile with the UUID '" + uuid + "', however, no such provisioning profile was found."; } else if (product._provisioningProfileRequired) { var hasProfiles = !!((inputs["codesign.provisioningprofile"] || []).length); var teamIdentifier = product.teamIdentifier; var codeSignIdentity = product.signingIdentity; if (hasProfiles) { if (codeSignIdentity) { console.warn("No provisioning profiles matching the bundle identifier '" + product.bundle.identifier + "' were found."); } else { console.warn("No provisioning profiles matching an applicable signing " + "identity were found."); } } else { if (codeSignIdentity) { if (teamIdentifier) { console.warn("No provisioning profiles with a valid signing identity " + "(i.e. certificate and private key pair) matching the " + "team ID '" + teamIdentifier + "' were found.") } else { console.warn("No provisioning profiles with a valid signing identity " + "(i.e. certificate and private key pair) were found."); } } else { console.warn("No non-expired provisioning profiles were found."); } } } return artifacts; } function generateAppleProvisioningProfileCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmd = new JavaScriptCommand(); var data = JSON.parse(output.codesign._provisioningProfileData); cmd.source = output.codesign._provisioningProfileFilePath; cmd.destination = output.filePath; cmd.description = "using provisioning profile " + data.Name + " (" + data.UUID + ")"; cmd.highlight = "filegen"; cmd.sourceCode = function() { File.copy(source, destination); }; return [cmd]; } function generateAppleEntitlementsCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmd = new JavaScriptCommand(); cmd.description = "generating entitlements"; cmd.highlight = "codegen"; cmd.bundleIdentifier = product.bundle.identifier; cmd.signingEntitlements = (inputs["codesign.entitlements"] || []) .map(function (a) { return a.filePath; }); cmd.provisioningProfiles = (inputs["codesign.embedded_provisioningprofile"] || []) .map(function (a) { return a.filePath; }); cmd.platformPath = product.xcode ? product.xcode.platformPath : undefined; cmd.sdkPath = product.xcode ? product.xcode.sdkPath : undefined; cmd.sourceCode = function() { var i; var provData = {}; var provisionProfiles = inputs["codesign.embedded_provisioningprofile"]; for (i in provisionProfiles) { var plist = new PropertyList(); try { plist.readFromData(Utilities.smimeMessageContent( provisionProfiles[i].filePath)); provData = plist.toObject(); } finally { plist.clear(); } } var aggregateEntitlements = {}; // Start building up an aggregate entitlements plist from the files in the SDKs, // which contain placeholders in the same manner as Info.plist function entitlementsFileContents(path) { return File.exists(path) ? BundleTools.infoPlistContents(path) : undefined; } var entitlementsSources = []; if (platformPath) { entitlementsSources.push( entitlementsFileContents( FileInfo.joinPaths(platformPath, "Entitlements.plist"))); } if (sdkPath) { entitlementsSources.push( entitlementsFileContents( FileInfo.joinPaths(sdkPath, "Entitlements.plist"))); } for (i = 0; i < signingEntitlements.length; ++i) { entitlementsSources.push(entitlementsFileContents(signingEntitlements[i])); } for (i = 0; i < entitlementsSources.length; ++i) { var contents = entitlementsSources[i]; for (var key in contents) { if (contents.hasOwnProperty(key)) aggregateEntitlements[key] = contents[key]; } } contents = provData["Entitlements"]; for (key in contents) { if (contents.hasOwnProperty(key) && !aggregateEntitlements.hasOwnProperty(key)) aggregateEntitlements[key] = contents[key]; } // Expand entitlements variables with data from the provisioning profile var env = { "AppIdentifierPrefix": (provData["ApplicationIdentifierPrefix"] || "") + ".", "CFBundleIdentifier": bundleIdentifier }; DarwinTools.expandPlistEnvironmentVariables(aggregateEntitlements, env, true); // Anything with an undefined or otherwise empty value should be removed // Only JSON-formatted plists can have null values, other formats error out // This also follows Xcode behavior DarwinTools.cleanPropertyList(aggregateEntitlements); var plist = new PropertyList(); try { plist.readFromObject(aggregateEntitlements); plist.writeToFile(outputs["codesign.xcent"][0].filePath, "xml1"); } finally { plist.clear(); } }; return [cmd]; } qbs-src-3.2.0/share/qbs/modules/codesign/noop.qbs0000644000175100017510000000313315154533055021316 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ CodeSignModule { condition: true priority: -100 } qbs-src-3.2.0/share/qbs/modules/autotest/0000755000175100017510000000000015154533055017711 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/autotest/autotest.qbs0000644000175100017510000000021315154533055022264 0ustar runnerrunnerModule { property stringList arguments property bool allowFailure: false property string workingDir property int timeout } qbs-src-3.2.0/share/qbs/modules/ico/0000755000175100017510000000000015154533055016613 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/ico/ico.js0000644000175100017510000000773715154533055017741 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var Process = require("qbs.Process"); function prepareIconset(project, product, inputs, outputs, input, output) { inputs = File.directoryEntries(input.filePath, File.Files).map(function (p) { return { filePath: FileInfo.joinPaths(input.filePath, p), fileTags: p.endsWith(".png") ? ["png"] : [], ico: {} }; }); inputs = {"png": inputs.filter(function (a) { return a.fileTags.includes("png"); })}; input = undefined; return prepare(project, product, inputs, outputs, input, output); } function prepare(project, product, inputs, outputs, input, output) { var args = ["--create", "--output=" + output.filePath]; if (output.fileTags.includes("ico")) { args.push("--icon"); if (product.ico.alphaThreshold !== undefined) args.push("--alpha-threshold=" + product.ico.alphaThreshold); } var isCursor = output.fileTags.includes("cur"); if (isCursor) args.push("--cursor"); var hasMultipleImages = inputs["png"].length > 1; inputs["png"].map(function(inp) { if (isCursor) { var hasX = inp.ico.cursorHotspotX !== undefined; var hasY = inp.ico.cursorHotspotY !== undefined; if (hasX || hasY) { if (hasMultipleImages && product.ico.hasCursorHotspotBug) { console.warn("icotool " + product.ico.version + " does not support setting " + "the hotspot for cursor files with multiple images. Install " + "icoutils 0.32.0 or newer to use this feature."); } else { if (hasX) args.push("--hotspot-x=" + inp.ico.cursorHotspotX); if (hasY) args.push("--hotspot-y=" + inp.ico.cursorHotspotY); } } } if (inp.ico.raw) args.push("-r"); args.push(inp.filePath); }); var cmd = new Command(product.ico.icotoolFilePath, args); cmd.description = "creating " + output.fileName; return [cmd]; } function findIcoUtilsVersion(toolFilePath) { var p = new Process(); try { p.exec(toolFilePath, ["--version"]); var re = /^[a-z]+ \(icoutils\) ([0-9]+(?:\.[0-9]+){1,2})$/m; var match = p.readStdOut().trim().match(re); if (match !== null) return match[1]; } finally { p.close(); } } qbs-src-3.2.0/share/qbs/modules/ico/IcoModule.qbs0000644000175100017510000000462615154533055021212 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.ModUtils import qbs.Probes import qbs.Process import qbs.Utilities import "ico.js" as IcoUtils Module { Probes.BinaryProbe { id: icotoolProbe names: ["icotool"] } Probes.IcoUtilsVersionProbe { id: icotoolVersionProbe toolFilePath: icotoolFilePath } version: icotoolVersionProbe.version property int alphaThreshold property int cursorHotspotX property int cursorHotspotY property bool raw // private properties property string icotoolFilePath: icotoolProbe.filePath readonly property bool hasCursorHotspotBug: Utilities.versionCompare(version, "0.32") < 0 FileTagger { patterns: ["*.png"] fileTags: ["png"] } FileTagger { patterns: ["*.iconset"] // bundle fileTags: ["iconset"] } Rule { inputs: ["iconset"] Artifact { filePath: input.baseName + ".ico" fileTags: ["ico"] } prepare: IcoUtils.prepareIconset.apply(IcoUtils, arguments) } Rule { multiplex: true inputs: ["png"] Artifact { filePath: product.targetName + ".ico" fileTags: ["ico"] } prepare: IcoUtils.prepare.apply(IcoUtils, arguments) } Rule { inputs: ["iconset"] Artifact { filePath: input.baseName + ".cur" fileTags: ["cur"] } prepare: IcoUtils.prepareIconset.apply(IcoUtils, arguments) } Rule { multiplex: true inputs: ["png"] Artifact { filePath: product.targetName + ".cur" fileTags: ["cur"] } prepare: IcoUtils.prepare.apply(IcoUtils, arguments) } validate: { if (!icotoolFilePath) throw ModUtils.ModuleError("Could not find icotool in any of the following " + "locations:\n\t" + icotoolProbe.candidatePaths.join("\n\t") + "\nInstall the icoutils package on your platform."); if (!version) throw ModUtils.ModuleError("Could not determine icoutils package version."); var validator = new ModUtils.PropertyValidator("ico"); validator.setRequiredProperty("version", version); validator.addVersionValidator("version", version, 2, 3); return validator.validate() } } qbs-src-3.2.0/share/qbs/modules/freedesktop/0000755000175100017510000000000015154533055020354 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/freedesktop/FreeDesktop.qbs0000644000175100017510000000647415154533055023311 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Alberto Mardegan ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.ModUtils import qbs.TextFile import "freedesktop.js" as Fdo Module { property string name: product.name property string appName: name property string hicolorRoot: undefined property var desktopKeys readonly property var defaultDesktopKeys: { return { 'Type': 'Application', 'Name': product.freedesktop.appName, 'Exec': product.targetName, 'Terminal': 'false', 'Version': '1.1', } } property bool _fdoSupported: qbs.targetOS.includes("unix") && !qbs.targetOS.includes("darwin") additionalProductTypes: "freedesktop.desktopfile" FileTagger { patterns: [ "*.desktop" ] fileTags: [ "freedesktop.desktopfile_source" ] } Group { condition: _fdoSupported qbs.install: true Group { fileTagsFilter: [ "freedesktop.desktopfile" ] qbs.installDir: "share/applications" } Group { condition: product.freedesktop.hicolorRoot !== undefined fileTagsFilter: [ "freedesktop.appIcon" ] qbs.installDir: "share/icons/hicolor" qbs.installSourceBase: product.freedesktop.hicolorRoot } Group { fileTagsFilter: [ "freedesktop.appstream" ] qbs.installDir: "share/metainfo" } Rule { inputs: [ "freedesktop.desktopfile_source" ] outputFileTags: [ "freedesktop.desktopfile" ] Artifact { fileTags: [ "freedesktop.desktopfile" ] filePath: input.fileName } prepare: Fdo.generateDesktopFileCommands.apply(Fdo, arguments) } } FileTagger { patterns: [ "*.metainfo.xml", "*.appdata.xml" ] fileTags: [ "freedesktop.appstream" ] } } qbs-src-3.2.0/share/qbs/modules/freedesktop/freedesktop.js0000644000175100017510000000731015154533055023226 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Alberto Mardegan ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var TextFile = require("qbs.TextFile"); function parseDesktopFile(filePath) { var file = new TextFile(filePath); var fileValues = {}; var currentSection = {}; var sectionRex = /^\[(.+)\]$/g; while (!file.atEof()) { var line = file.readLine().trim(); if (line.length == 0) continue; if (line[0] == '#') continue; var match = sectionRex.exec(line); if (match) { var currentSectionName = match[1]; fileValues[currentSectionName] = {}; currentSection = fileValues[currentSectionName]; continue; } var parts = line.split('=', 2); currentSection[parts[0]] = parts[1] } file.close(); return fileValues } function dumpDesktopFile(filePath, keys) { var file = new TextFile(filePath, TextFile.WriteOnly); for (var sectionName in keys) { file.writeLine('[' + sectionName + ']'); var section = keys[sectionName]; for (var key in section) { var line = key + '=' + section[key]; file.writeLine(line); } // Write an empty line between sections (and before EOF) file.writeLine(''); } file.close(); } function generateDesktopFileCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName + " from " + input.fileName; cmd.highlight = "codegen"; cmd.sourceCode = function() { var aggregateDesktopKeys = parseDesktopFile(input.filePath); var desktopKeys = ModUtils.moduleProperty(product, "desktopKeys") || {} var mainSection = aggregateDesktopKeys['Desktop Entry']; for (key in desktopKeys) { if (desktopKeys.hasOwnProperty(key)) { mainSection[key] = desktopKeys[key]; } } var defaultValues = product.freedesktop.defaultDesktopKeys for (key in defaultValues) { if (!(key in mainSection)) { mainSection[key] = defaultValues[key]; } } dumpDesktopFile(output.filePath, aggregateDesktopKeys); } return [cmd]; } qbs-src-3.2.0/share/qbs/modules/dmg/0000755000175100017510000000000015154533055016610 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/dmg/DMGModule.qbs0000644000175100017510000001305215154533055021075 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.DarwinTools import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.Process import qbs.Probes import qbs.TextFile import "dmg.js" as Dmg Module { Depends { name: "xcode"; required: false } condition: Host.os().includes("darwin") && qbs.targetOS.includes("darwin") property string volumeName: product.targetName PropertyOptions { name: "volumeName" description: "the name of the disk image (displayed in Finder when mounted)" } property bool badgeVolumeIcon: false PropertyOptions { name: "badgeVolumeIcon" description: "whether to render the user-supplied icon on top of the " + "default volume icon instead of using it directly" } property string format: "UDBZ" PropertyOptions { name: "format" description: "the format to create the disk image in" } property int compressionLevel: qbs.buildVariant === "release" ? 9 : undefined PropertyOptions { name: "compressionLevel" description: "sets the zlib or bzip2 compression level for UDZO and UDBZ disk images" } property string textutilPath: "/usr/bin/textutil" property string hdiutilPath: "/usr/bin/hdiutil" property string dmgSuffix: ".dmg" property string sourceBase Probes.BinaryProbe { id: pythonProbe names: ["python3"] } property string pythonExePath: pythonProbe.found ? pythonProbe.filePath : "python3" readonly property string pythonPath: File.canonicalFilePath(FileInfo.joinPaths(path, "..", "..", "python")) property string backgroundColor property int iconSize: 128 property int windowX: 100 property int windowY: 100 property int windowWidth: 640 property int windowHeight: 480 property var iconPositions property int iconX: windowWidth / 2 property int iconY: windowHeight / 2 property string defaultLicenseLocale property string licenseLocale property string licenseLanguageName property string licenseAgreeButtonText property string licenseDisagreeButtonText property string licensePrintButtonText property string licenseSaveButtonText property string licenseInstructionText FileTagger { patterns: [ "*.txt", "*.rtf", "*.html", "*.doc", "*.docx", "*.odt", "*.xml", "*.webarchive", "LICENSE" ] fileTags: ["dmg.license.input"] } FileTagger { patterns: ["*.icns"] fileTags: ["icns"] } FileTagger { patterns: ["*.tif", "*.tiff"] fileTags: ["tiff"] } Rule { inputs: ["dmg.license.input"] outputFileTags: ["dmg.license"] outputArtifacts: ([{ filePath: FileInfo.joinPaths(product.destinationDirectory, "licenses", FileInfo.relativePath(product.sourceDirectory, input.filePath) + ".rtf"), fileTags: ["dmg.license"], dmg: { licenseLocale: input.dmg.licenseLocale, licenseLanguageName: input.dmg.licenseLanguageName, licenseAgreeButtonText: input.dmg.licenseAgreeButtonText, licenseDisagreeButtonText: input.dmg.licenseDisagreeButtonText, licensePrintButtonText: input.dmg.licensePrintButtonText, licenseSaveButtonText: input.dmg.licenseSaveButtonText, licenseInstructionText: input.dmg.licenseInstructionText } }]) prepare: Dmg.prepareLicense.apply(Dmg, arguments) } Rule { multiplex: true inputs: ["dmg.input", "dmg.license", "icns", "tiff"] Artifact { fileTags: ["dmg.dmg"] filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + product.dmg.dmgSuffix) } prepare: Dmg.prepareDmg.apply(Dmg, arguments) } } qbs-src-3.2.0/share/qbs/modules/dmg/dmg.js0000644000175100017510000002053115154533055017716 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var DarwinTools = require("qbs.DarwinTools"); var FileInfo = require("qbs.FileInfo"); var TextFile = require("qbs.TextFile"); var Utilities = require("qbs.Utilities"); function localizationFromArtifact(input) { var locale = input.dmg.licenseLocale || DarwinTools.localizationKey(input.filePath); if (!locale) throw("Could not determine localization for license file: " + input.filePath); return locale; } function dmgbuildSettings(product, inputs) { var backgroundImages = inputs["tiff"]; var backgroundImage; if (backgroundImages) { if (backgroundImages.length > 1) throw new Error("only one background image may be specified"); backgroundImage = backgroundImages[0].filePath; } var volumeIcons = inputs["icns"]; var volumeIcon; if (volumeIcons) { if (volumeIcons.length > 1) throw new Error("only one volume icon may be specified"); volumeIcon = volumeIcons[0].filePath; } var licenseFileObjects = Array.prototype.map.call(inputs["dmg.license"] || [], function (a) { return { "dmg": { "licenseLocale": localizationFromArtifact(a), "licenseLanguageName": a.dmg.licenseLanguageName, "licenseAgreeButtonText": a.dmg.licenseAgreeButtonText, "licenseDisagreeButtonText": a.dmg.licenseDisagreeButtonText, "licensePrintButtonText": a.dmg.licensePrintButtonText, "licenseSaveButtonText": a.dmg.licenseSaveButtonText, "licenseInstructionText": a.dmg.licenseInstructionText, }, "filePath": a.filePath }; }); function reduceLicensesForKey(licenseFileObjects, key) { return licenseFileObjects.reduce(function (accumulator, currentValue) { var locale = currentValue.dmg.licenseLocale; if (accumulator[locale]) throw new Error("Multiple license files for localization '" + locale + "'"); switch (key) { case "licenses": accumulator[locale] = currentValue.filePath; break; case "buttons": var texts = [ currentValue.dmg.licenseLanguageName, currentValue.dmg.licenseAgreeButtonText, currentValue.dmg.licenseDisagreeButtonText, currentValue.dmg.licensePrintButtonText, currentValue.dmg.licenseSaveButtonText, currentValue.dmg.licenseInstructionText ]; accumulator[locale] = texts.every(function (a) { return !!a; }) ? texts : undefined; break; } return accumulator; }, {}); } var contentsArray = Array.prototype.map.call(inputs["dmg.input"] || [], function (a) { if (a.dmg.sourceBase && !a.filePath.startsWith(a.dmg.sourceBase)) { throw new Error("Cannot install '" + a.filePath + "', " + "because it doesn't start with the value of " + "dmg.sourceBase '" + a.dmg.sourceBase + "'."); } var isSymlink = a.fileTags.includes("dmg.input.symlink"); return { "x": a.dmg.iconX, "y": a.dmg.iconY, "type": isSymlink ? "link" : "file", "path": isSymlink ? a.dmg.symlinkTarget : a.filePath, "name": FileInfo.relativePath(a.dmg.sourceBase || FileInfo.path(a.filePath), a.filePath) }; }); Array.prototype.forEach.call(product.dmg.iconPositions || [], function (obj) { var existingIndex = -1; Array.prototype.forEach.call(contentsArray, function (contentsItem, i) { if (contentsItem["name"] === obj["path"]) existingIndex = i; }); if (existingIndex >= 0) { contentsArray[existingIndex]["x"] = obj["x"]; contentsArray[existingIndex]["y"] = obj["y"]; } else { contentsArray.push({ "type": "position", "name": obj["path"], // name => path is not a typo "path": obj["path"], "x": obj["x"], "y": obj["y"] }); } }); var result = { "title": product.dmg.volumeName, "icon": !product.dmg.badgeVolumeIcon ? volumeIcon : undefined, "badge-icon": product.dmg.badgeVolumeIcon ? volumeIcon : undefined, "background": backgroundImage, "background-color": product.dmg.backgroundColor, "icon-size": product.dmg.iconSize, "window": { "position": { "x": product.dmg.windowX, "y": product.dmg.windowY }, "size": { "width": product.dmg.windowWidth, "height": product.dmg.windowHeight } }, "format": product.dmg.format, "compression-level": product.dmg.compressionLevel, "contents": contentsArray }; if (licenseFileObjects.length >= 0) { result["license"] = { "default-language": product.dmg.defaultLicenseLocale, "licenses": reduceLicensesForKey(licenseFileObjects, "licenses"), "buttons": reduceLicensesForKey(licenseFileObjects, "buttons") }; } return result; } function prepareLicense(project, product, inputs, outputs, input, output) { var cmd = new Command(product.dmg.textutilPath, [ "-convert", "rtf", "-strip", "-font", "Arial", "-output", output.filePath, "--", input.filePath ]); cmd.description = "converting " + input.fileName; return [cmd]; } function prepareDmg(project, product, inputs, outputs, input, output) { var i; var cmd; var cmds = []; var settingsJsonFilePath = FileInfo.joinPaths(product.destinationDirectory, "settings.json"); cmd = new JavaScriptCommand(); cmd.silent = true; cmd.settingsJSON = dmgbuildSettings(product, inputs); cmd.settingsJsonFilePath = settingsJsonFilePath; cmd.sourceCode = function () { var tf; try { tf = new TextFile(settingsJsonFilePath, TextFile.WriteOnly); tf.writeLine(JSON.stringify(settingsJSON, undefined, 4)); } finally { if (tf) tf.close(); } } cmds.push(cmd); // Create the actual DMG via dmgbuild cmd = new Command(product.dmg.pythonExePath, ["-m", "dmgbuild", product.dmg.volumeName, output.filePath, "--no-hidpi", // qbs handles this by itself "--settings", settingsJsonFilePath]); cmd.environment = ["PYTHONPATH=" + product.dmg.pythonPath]; cmd.description = "creating " + output.fileName; cmds.push(cmd); return cmds; } qbs-src-3.2.0/share/qbs/modules/wix/0000755000175100017510000000000015154533055016650 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/wix/WiXModule.qbs0000644000175100017510000004205615154533055021243 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.Probes import qbs.Utilities Module { condition: qbs.targetOS.includes("windows") Probes.WiXProbe { id: wixProbe } property path toolchainInstallPath: wixProbe.path property path toolchainInstallRoot: wixProbe.root version: wixProbe.version property var versionParts: version ? version.split('.').map(function(item) { return parseInt(item, 10); }) : [] property int versionMajor: versionParts[0] property int versionMinor: versionParts[1] property int versionPatch: versionParts[2] property int versionBuild: versionParts[3] property string compilerName: "candle.exe" property string compilerPath: FileInfo.joinPaths(toolchainInstallRoot, compilerName) property string linkerName: "light.exe" property string linkerPath: FileInfo.joinPaths(toolchainInstallRoot, linkerName) property string warningLevel: "normal" PropertyOptions { name: "warningLevel" allowedValues: ["none", "normal", "pedantic"] } property bool debugInformation: qbs.debugInformation property bool treatWarningsAsErrors: false property bool verboseOutput: false PropertyOptions { name: "verboseOutput" description: "display verbose output from the compiler and linker" } property bool visualStudioCompatibility: true PropertyOptions { name: "visualStudioCompatibility" description: "whether to define most of the same variables as " + "Visual Studio when using the Candle compiler" } property bool enableQbsDefines: true PropertyOptions { name: "enableQbsDefines" description: "built-in variables that are defined when using the Candle compiler" } property pathList includePaths PropertyOptions { name: "includePaths" description: "directories to add to the include search path" } property stringList defines PropertyOptions { name: "defines" description: "variables that are defined when using the Candle compiler" } property stringList compilerFlags PropertyOptions { name: "compilerFlags" description: "additional flags for the Candle compiler" } property stringList linkerFlags PropertyOptions { name: "linkerFlags" description: "additional flags for the Light linker" } property stringList cultures PropertyOptions { name: "cultures" description: "the list of localizations to build the MSI for; leave undefined to build all localizations" } property stringList extensions: product.type.includes("wixsetup") ? ["WixBalExtension"] : [] // default to WiX Standard Bootstrapper extension // private properties property string targetSuffix: { if (product.type.includes("msi")) { return windowsInstallerSuffix; } else if (product.type.includes("wixsetup")) { return executableSuffix; } } // MSI/MSM package validation only works natively on Windows property bool enablePackageValidation: Host.os().includes("windows") property string executableSuffix: ".exe" property string windowsInstallerSuffix: ".msi" validate: { var validator = new ModUtils.PropertyValidator("wix"); validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath); validator.setRequiredProperty("toolchainInstallRoot", toolchainInstallRoot); validator.setRequiredProperty("version", version); validator.setRequiredProperty("versionMajor", versionMajor); validator.setRequiredProperty("versionMinor", versionMinor); validator.setRequiredProperty("versionPatch", versionPatch); validator.addVersionValidator("version", version, 3, 4); validator.addRangeValidator("versionMajor", versionMajor, 1); validator.addRangeValidator("versionMinor", versionMinor, 0); validator.addRangeValidator("versionPatch", versionPatch, 0); if (versionParts && versionParts.length >= 4) { validator.setRequiredProperty("versionBuild", versionBuild); validator.addRangeValidator("versionBuild", versionBuild, 0); } validator.validate(); } setupBuildEnvironment: { var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), true); v.prepend(product.wix.toolchainInstallPath); v.prepend(product.wix.toolchainInstallRoot); v.set(); } // WiX Include Files FileTagger { patterns: ["*.wxi"] fileTags: ["wxi"] } // WiX Localization Files FileTagger { patterns: ["*.wxl"] fileTags: ["wxl"] } // WiX Source Files FileTagger { patterns: ["*.wxs"] fileTags: ["wxs"] } Rule { id: candleCompiler inputs: ["wxs"] auxiliaryInputs: ["wxi", "installable"] auxiliaryInputsFromDependencies: ["wxi", "installable"] Artifact { fileTags: ["wixobj"] filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir), FileInfo.baseName(input.fileName) + ".wixobj") } prepare: { var i; var args = ["-nologo"]; if (ModUtils.moduleProperty(input, "warningLevel") === "none") { args.push("-sw"); } else { if (ModUtils.moduleProperty(input, "warningLevel") === "pedantic") { args.push("-pedantic"); } if (ModUtils.moduleProperty(input, "treatWarningsAsErrors")) { args.push("-wx"); } } if (ModUtils.moduleProperty(input, "verboseOutput")) { args.push("-v"); } var arch = product.moduleProperty("qbs", "architecture"); // http://wixtoolset.org/documentation/manual/v3/xsd/wix/package.html switch (arch) { case "x86_64": arch = "x64"; break; case "armv7": case "armv7a": arch = "arm"; break; } // Visual Studio defines these variables along with various solution and project names and paths; // we'll pass most of them to ease compatibility between QBS and WiX projects originally created // using Visual Studio. The only definitions we don't pass are the ones which make no sense at all // in QBS, like the solution and project directories since they do not exist. if (ModUtils.moduleProperty(input, "visualStudioCompatibility")) { var toolchain = product.moduleProperty("qbs", "toolchain"); var toolchainInstallPath = product.moduleProperty("cpp", "toolchainInstallPath"); if (toolchain && toolchain.includes("msvc") && toolchainInstallPath) { var vcDir = toolchainInstallPath.replace(/[\\/]bin$/i, ""); var vcRootDir = vcDir.replace(/[\\/]VC$/i, ""); args.push("-dDevEnvDir=" + FileInfo.toWindowsSeparators(FileInfo.joinPaths(vcRootDir, 'Common7', 'IDE'))); } var buildVariant = product.moduleProperty("qbs", "buildVariant"); if (buildVariant === "debug") { args.push("-dDebug"); args.push("-dConfiguration=Debug"); } else if (buildVariant === "release") { // VS doesn't define "Release" args.push("-dConfiguration=Release"); } var productTargetExt = ModUtils.moduleProperty(input, "targetSuffix"); if (!productTargetExt) { throw("WiX: Unsupported product type '" + product.type + "'"); } var builtBinaryFilePath = FileInfo.joinPaths(product.destinationDirectory, product.targetName + productTargetExt); args.push("-dOutDir=" + FileInfo.toWindowsSeparators(FileInfo.path(builtBinaryFilePath))); // in VS, relative to the project file by default args.push("-dPlatform=" + (arch || "x86")); args.push("-dProjectName=" + project.name); args.push("-dTargetDir=" + FileInfo.toWindowsSeparators(FileInfo.path(builtBinaryFilePath))); // in VS, an absolute path args.push("-dTargetExt=" + productTargetExt); args.push("-dTargetFileName=" + product.targetName + productTargetExt); args.push("-dTargetName=" + product.targetName); args.push("-dTargetPath=" + FileInfo.toWindowsSeparators(builtBinaryFilePath)); } var includePaths = ModUtils.moduleProperty(input, "includePaths"); for (i in includePaths) { args.push("-I" + includePaths[i]); } var enableQbsDefines = ModUtils.moduleProperty(input, "enableQbsDefines") if (enableQbsDefines) { var map = { "project.": project, "product.": product }; for (var prefix in map) { var obj = map[prefix]; for (var prop in obj) { var val = obj[prop]; if (typeof val !== 'function' && typeof val !== 'object' && !prop.startsWith("_")) { args.push("-d" + prefix + prop + "=" + val); } } } // Helper define for alternating between 32-bit and 64-bit logic if (arch === "x64" || arch === "ia64") { args.push("-dWin64"); } } // User-supplied defines var defines = ModUtils.moduleProperty(input, "defines"); for (i in defines) { args.push("-d" + defines[i]); } // User-supplied flags var flags = ModUtils.moduleProperty(input, "compilerFlags"); for (i in flags) { args.push(flags[i]); } args.push("-out"); args.push(FileInfo.toWindowsSeparators(output.filePath)); if (arch) { args.push("-arch"); args.push(arch); } var extensions = ModUtils.moduleProperty(input, "extensions"); for (i in extensions) { args.push("-ext"); args.push(extensions[i]); } args.push(FileInfo.toWindowsSeparators(input.filePath)); var cmd = new Command(ModUtils.moduleProperty(product, "compilerPath"), args); cmd.description = "compiling " + input.fileName; cmd.highlight = "compiler"; cmd.workingDirectory = FileInfo.path(output.filePath); // candle.exe outputs the file name. We filter that out. cmd.inputFileName = input.fileName; cmd.stdoutFilterFunction = function(output) { return output.split(inputFileName + "\r\n").join(""); }; return cmd; } } Rule { id: lightLinker multiplex: true inputs: ["wixobj", "wxl"] auxiliaryInputs: ["installable"] auxiliaryInputsFromDependencies: ["installable"] inputsFromDependencies: product.type.includes("wixsetup") ? ["msi"] : [] outputArtifacts: { var artifacts = []; if (product.type.includes("wixsetup")) { artifacts.push({ fileTags: ["wixsetup", "application"], filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + ModUtils.moduleProperty(product, "executableSuffix")) }); } if (product.type.includes("msi")) { artifacts.push({ fileTags: ["msi"], filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + ModUtils.moduleProperty(product, "windowsInstallerSuffix")) }); } if (ModUtils.moduleProperty(product, "debugInformation")) { artifacts.push({ fileTags: ["wixpdb"], filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + ".wixpdb") }); } return artifacts; } outputFileTags: ["application", "msi", "wixpdb", "wixsetup"] prepare: { var i; var primaryOutput; if (product.type.includes("wixsetup")) { primaryOutput = outputs.wixsetup[0]; } else if (product.type.includes("msi")) { primaryOutput = outputs.msi[0]; } else { throw("WiX: Unsupported product type '" + product.type + "'"); } var args = ["-nologo"]; if (!ModUtils.moduleProperty(product, "enablePackageValidation")) { args.push("-sval"); } if (ModUtils.moduleProperty(product, "warningLevel") === "none") { args.push("-sw"); } else { if (ModUtils.moduleProperty(product, "warningLevel") === "pedantic") { args.push("-pedantic"); } if (ModUtils.moduleProperty(product, "treatWarningsAsErrors")) { args.push("-wx"); } } if (ModUtils.moduleProperty(product, "verboseOutput")) { args.push("-v"); } args.push("-out"); args.push(FileInfo.toWindowsSeparators(primaryOutput.filePath)); if (ModUtils.moduleProperty(product, "debugInformation")) { args.push("-pdbout"); args.push(FileInfo.toWindowsSeparators(outputs.wixpdb[0].filePath)); } else { args.push("-spdb"); } var extensions = ModUtils.moduleProperty(product, "extensions"); for (i in extensions) { args.push("-ext"); args.push(extensions[i]); } for (i in inputs.wxl) { args.push("-loc"); args.push(FileInfo.toWindowsSeparators(inputs.wxl[i].filePath)); } if (product.type.includes("msi")) { var cultures = ModUtils.moduleProperty(product, "cultures"); args.push("-cultures:" + (cultures && cultures.length > 0 ? cultures.join(";") : "null")); } // User-supplied flags var flags = ModUtils.moduleProperty(product, "linkerFlags"); for (i in flags) { args.push(flags[i]); } for (i in inputs.wixobj) { args.push(FileInfo.toWindowsSeparators(inputs.wixobj[i].filePath)); } var cmd = new Command(ModUtils.moduleProperty(product, "linkerPath"), args); cmd.description = "linking " + primaryOutput.fileName; cmd.highlight = "linker"; cmd.workingDirectory = FileInfo.path(primaryOutput.filePath); return cmd; } } } qbs-src-3.2.0/share/qbs/modules/bundle/0000755000175100017510000000000015154533055017312 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/bundle/bundle.js0000644000175100017510000011704515154533055021131 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var Codesign = require("../codesign/codesign.js"); var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var DarwinTools = require("qbs.DarwinTools"); var ModUtils = require("qbs.ModUtils"); var Process = require("qbs.Process"); var Utilities = require("qbs.Utilities"); // HACK: Workaround until the PropertyList extension is supported cross-platform var TextFile = require("qbs.TextFile"); var PropertyList2 = (function () { function PropertyList2() { } PropertyList2.prototype.readFromFile = function (filePath) { var str; var process = new Process(); try { if (process.exec("plutil", ["-convert", "json", "-o", "-", filePath], false) === 0) { str = process.readStdOut(); } else { var tf = new TextFile(filePath); try { str = tf.readAll(); } finally { tf.close(); } } } finally { process.close(); } if (str) this.obj = JSON.parse(str); }; PropertyList2.prototype.toObject = function () { return this.obj; }; PropertyList2.prototype.clear = function () { }; return PropertyList2; }()); // Order is significant due to productTypeIdentifier() search path var _productTypeIdentifiers = { "inapppurchase": "com.apple.product-type.in-app-purchase-content", "applicationextension": "com.apple.product-type.app-extension", "xpcservice": "com.apple.product-type.xpc-service", "application": "com.apple.product-type.application", "dynamiclibrary": "com.apple.product-type.framework", "loadablemodule": "com.apple.product-type.bundle", "staticlibrary": "com.apple.product-type.framework.static", "kernelmodule": "com.apple.product-type.kernel-extension" }; function productTypeIdentifier(productType) { for (var k in _productTypeIdentifiers) { if (productType.includes(k)) return _productTypeIdentifiers[k]; } return "com.apple.package-type.wrapper"; } function excludedAuxiliaryInputs(project, product) { var chain = product.bundle._productTypeIdentifierChain; var bestPossibleType; for (var i = chain.length - 1; i >= 0; --i) { switch (chain[i]) { case "com.apple.product-type.bundle": bestPossibleType = "loadablemodule"; break; case "com.apple.product-type.framework": bestPossibleType = "dynamiclibrary"; break; case "com.apple.product-type.framework.static": bestPossibleType = "staticlibrary"; break; case "com.apple.product-type.application": case "com.apple.product-type.xpc-service": bestPossibleType = "application"; break; } } var excluded = []; var possibleTypes = ["application", "dynamiclibrary", "staticlibrary", "loadablemodule"]; for (i = 0; i < possibleTypes.length; ++i) { if (possibleTypes[i] !== bestPossibleType) excluded.push(possibleTypes[i]); } return excluded; } function packageType(productTypeIdentifier) { switch (productTypeIdentifier) { case "com.apple.product-type.in-app-purchase-content": return undefined; case "com.apple.product-type.app-extension": case "com.apple.product-type.xpc-service": return "XPC!"; case "com.apple.product-type.application": return "APPL"; case "com.apple.product-type.framework": case "com.apple.product-type.framework.static": return "FMWK"; case "com.apple.product-type.kernel-extension": case "com.apple.product-type.kernel-extension.iokit": return "KEXT"; default: return "BNDL"; } } function _assign(target, source) { if (source) { for (var k in source) { if (source.hasOwnProperty(k)) target[k] = source[k]; } return target; } } function macOSSpecsPaths(version, developerPath) { var result = []; if (Utilities.versionCompare(version, "15.3") >= 0) { result.push(FileInfo.joinPaths( developerPath, "..", "SharedFrameworks", "XCBuild.framework", "PlugIns", "XCBBuildService.bundle", "Contents", "PlugIns", "XCBSpecifications.ideplugin", "Contents", "Resources")); } if (Utilities.versionCompare(version, "14.3") >= 0) { result.push(FileInfo.joinPaths( developerPath, "Library", "Xcode", "Plug-ins", "XCBSpecifications.ideplugin", "Contents", "Resources")); } else if (Utilities.versionCompare(version, "12.5") >= 0) { result.push(FileInfo.joinPaths( developerPath, "..", "PlugIns", "XCBSpecifications.ideplugin", "Contents", "Resources")); } else if (Utilities.versionCompare(version, "12") >= 0) { result.push(FileInfo.joinPaths( developerPath, "Platforms", "MacOSX.platform", "Developer", "Library", "Xcode", "PrivatePlugIns", "IDEOSXSupportCore.ideplugin", "Contents", "Resources")); } else { result.push(FileInfo.joinPaths( developerPath, "Platforms", "MacOSX.platform", "Developer", "Library", "Xcode", "Specifications")); } return result; } var XcodeBuildSpecsReader = (function () { function XcodeBuildSpecsReader(specsPaths, separator, additionalSettings, useShallowBundles) { this._additionalSettings = additionalSettings; this._useShallowBundles = useShallowBundles; this._packageTypes = []; this._productTypes = []; var i, j; for (i = 0; i < specsPaths.length; ++i) { var specsPath = specsPaths[i]; var names = ["", "Darwin", "MacOSX"]; for (j = 0; j < names.length; ++j) { var name = names[j]; var plist = new PropertyList2(); var plist2 = new PropertyList2(); try { var plistName = [name, "Package", "Types.xcspec"].join(name ? separator : ""); var plistName2 = [name, "Product", "Types.xcspec"].join(name ? separator : ""); var plistPath = FileInfo.joinPaths(specsPath, plistName); var plistPath2 = FileInfo.joinPaths(specsPath, plistName2); if (File.exists(plistPath)) { plist.readFromFile(plistPath); this._packageTypes = this._packageTypes.concat(plist.toObject()); } if (File.exists(plistPath2)) { plist2.readFromFile(plistPath2); this._productTypes = this._productTypes.concat(plist2.toObject()); } } finally { plist.clear(); plist2.clear(); } } } this._types = {}; for (i = 0; i < this._packageTypes.length; ++i) this._types[this._packageTypes[i]["Identifier"]] = this._packageTypes[i]; for (i = 0; i < this._productTypes.length; ++i) this._types[this._productTypes[i]["Identifier"]] = this._productTypes[i]; } XcodeBuildSpecsReader.prototype.productTypeIdentifierChain = function (typeIdentifier) { var ids = [typeIdentifier]; var obj = this._types[typeIdentifier]; var parentId = obj && obj["BasedOn"]; if (parentId) return ids.concat(this.productTypeIdentifierChain(parentId)); return ids; }; XcodeBuildSpecsReader.prototype.settings = function (typeIdentifier, recursive, skipPackageTypes) { // Silently use shallow bundles when preferred since it seems to be some sort of automatic // shadowing mechanism. For example, this matches Xcode behavior where static frameworks // are shallow even though no such product specification exists, and also seems to match // other behavior i.e. where productType in pbxproj files is never explicitly shallow. if (this._useShallowBundles && this._types[typeIdentifier + ".shallow"] && !skipPackageTypes) typeIdentifier += ".shallow"; var typesObject = this._types[typeIdentifier]; if (typesObject) { var buildProperties = {}; if (recursive) { // Get all the settings for the product's package type if (!skipPackageTypes && typesObject["PackageTypes"]) { for (var k = 0; k < typesObject["PackageTypes"].length; ++k) { var props = this.settings(typesObject["PackageTypes"][k], recursive, true); for (var y in props) { if (props.hasOwnProperty(y)) buildProperties[y] = props[y]; } break; } } // Get all the settings for the product's inherited product type if (typesObject["BasedOn"]) { // We'll only do the auto shallow substitution for wrapper package types... // this ensures that in-app purchase content bundles are non-shallow on both // macOS and iOS, for example (which matches Xcode behavior) var isWrapper = false; if (typesObject["ProductReference"]) { var fileType = typesObject["ProductReference"]["FileType"]; if (fileType) isWrapper = fileType.startsWith("wrapper."); } // Prevent recursion loop if this spec's base plus .shallow would be the same // as the current spec's identifier var baseIdentifier = typesObject["BasedOn"]; if (this._useShallowBundles && isWrapper && this._types[baseIdentifier + ".shallow"] && typeIdentifier !== baseIdentifier + ".shallow") baseIdentifier += ".shallow"; props = this.settings(baseIdentifier, recursive, true); for (y in props) { if (props.hasOwnProperty(y)) buildProperties[y] = props[y]; } } } if (typesObject["Type"] === "PackageType") { props = typesObject["DefaultBuildSettings"]; for (y in props) { if (props.hasOwnProperty(y)) buildProperties[y] = props[y]; } } if (typesObject["Type"] === "ProductType") { props = typesObject["DefaultBuildProperties"]; for (y in props) { if (props.hasOwnProperty(y)) buildProperties[y] = props[y]; } } return buildProperties; } }; XcodeBuildSpecsReader.prototype.setting = function (typeIdentifier, settingName) { var obj = this.settings(typeIdentifier, false); if (obj) { return obj[settingName]; } }; XcodeBuildSpecsReader.prototype.expandedSettings = function (typeIdentifier, baseSettings) { var obj = this.settings(typeIdentifier, true); if (obj) { for (var k in obj) obj[k] = this.expandedSetting(typeIdentifier, baseSettings, k); return obj; } }; XcodeBuildSpecsReader.prototype.expandedSetting = function (typeIdentifier, baseSettings, settingName) { var obj = {}; _assign(obj, baseSettings); // todo: copy recursively obj = _assign(obj, this.settings(typeIdentifier, true)); if (obj) { for (var x in this._additionalSettings) { var additionalSetting = this._additionalSettings[x]; if (additionalSetting !== undefined) obj[x] = additionalSetting; } var setting = obj[settingName]; var original; while (original !== setting) { original = setting; setting = DarwinTools.expandPlistEnvironmentVariables({ key: setting }, obj, false)["key"]; } return setting; } }; return XcodeBuildSpecsReader; }()); function filePathToArtifactLike(filePath) { return { filePath: filePath, fileName: FileInfo.fileName(filePath), path: FileInfo.path(filePath) }; } function getMainBundleTags(product) { if (product.bundle.isMainBundle) return []; var tags = ["bundle.main.input"]; var packageType = product.bundle && product.bundle.packageType; if (packageType === "APPL") tags.push("bundle.main.application"); else if (packageType === "FMWK") tags.push("bundle.main.framework"); else if (packageType === "BNDL") tags.push("bundle.main.plugin"); return tags; } function getCopiedDepenendencyFilePath(product, input) { var filePath = FileInfo.relativePath(input.product.buildDirectory, input.filePath) if (input.fileTags.includes("bundle.main.executable")) filePath = FileInfo.joinPaths(product.bundle.executablesFolderPath, filePath); else if (input.fileTags.includes("bundle.main.application")) filePath = FileInfo.joinPaths(product.bundle.applicationsFolderPath, filePath); else if (input.fileTags.includes("bundle.main.library")) filePath = FileInfo.joinPaths(product.bundle.frameworksFolderPath, filePath); else if (input.fileTags.includes("bundle.main.framework")) filePath = FileInfo.joinPaths(product.bundle.frameworksFolderPath, filePath); else if (input.fileTags.includes("bundle.main.plugin")) filePath = FileInfo.joinPaths(product.bundle.pluginsFolderPath, filePath); else return undefined; return FileInfo.joinPaths(product.buildDirectory, filePath); } function generateMainBundleOutputs(product, inputs) { var skippedDeps = {}; product.dependencies.forEach(function(dep) { if (dep.parameters.bundle && dep.parameters.bundle.isForMainBundle === false) skippedDeps[dep.name] = true; }); var artifacts = []; if (product.bundle.isMainBundle) { (inputs["bundle.main.input"] || []).forEach(function(input) { if (!input.bundle.isForMainBundle) return; if (skippedDeps[input.product.name]) return; const filePath = getCopiedDepenendencyFilePath(product, input); // We could probably just skip such files silently if (filePath === undefined) throw("Cannot determine main bundle file path for " + input.filePath); artifacts.push({ filePath: filePath, fileTags: ["bundle.content", "bundle.content.copied.from.dependencies"], bundle: { _mainBundleInputFilePath: input.filePath }, }); }); } return artifacts; } function generateMainBundleCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { if (!product.bundle.isMainBundle) return []; const mainBundleOutputs = outputs["bundle.content.copied.from.dependencies"]; if (mainBundleOutputs.length === 0) return []; var cmd = new JavaScriptCommand(); cmd.description = "copying main bundle dependencies"; cmd.highlight = "filegen"; cmd.sources = mainBundleOutputs.map(function(output) { return output.bundle._mainBundleInputFilePath; }); cmd.destinations = mainBundleOutputs.map(function(output) { return output.filePath; }); cmd.sourceCode = function() { for (var i = 0; i < sources.length; ++i) { File.copy(sources[i], destinations[i]); } }; return [cmd]; } function generateBundleOutputs(product, inputs) { var artifacts = []; if (product.bundle.isBundle) { const mainBundleTags = getMainBundleTags(product); (inputs["bundle.input"] || []).forEach(function(input) { var fp = input.bundle._bundleFilePath; if (!fp) throw("Artifact " + input.filePath + " has no associated bundle file path"); var extraTags = input.fileTags.includes("application") ? ["bundle.application-executable"] : []; artifacts.push({ filePath: fp, fileTags: ["bundle.content", "bundle.content.copied"] .concat(extraTags).concat(mainBundleTags), }); }); (inputs["codesign.embedded_provisioningprofile"] || []).forEach(function(input) { artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.contentsFolderPath, input.fileName), fileTags: ["bundle.provisioningprofile", "bundle.content"].concat(mainBundleTags), }); }); (inputs["bundle.input.privacymanifest"] || []).forEach(function(input) { var filePath; if (product.qbs.targetOS.includes("macos")) { filePath = FileInfo.joinPaths(product.destinationDirectory, product.bundle.contentsFolderPath, "Resources", input.fileName); } else if (product.qbs.targetOS.includes("ios")) { filePath = FileInfo.joinPaths(product.destinationDirectory, product.bundle.contentsFolderPath, input.fileName); } if (filePath) { artifacts.push({ filePath: filePath, fileTags: ["bundle.content", "bundle.privacymanifest"].concat(mainBundleTags), }); } }); var packageType = product.bundle.packageType; var isShallow = product.bundle.isShallow; if (packageType === "FMWK" && !isShallow) { var publicHeaders = (inputs["bundle.input.public_hpp"] || []) .concat(product.bundle.publicHeaders); if (publicHeaders.length > 0) { artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName, "Headers"), fileTags: ["bundle.symlink.headers", "bundle.content"].concat(mainBundleTags), }); } var privateHeaders = (inputs["bundle.input.private_hpp"] || []) .concat(product.bundle.privateHeaders); if (privateHeaders.length > 0) { artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName, "PrivateHeaders"), fileTags: ["bundle.symlink.private-headers", "bundle.content"].concat(mainBundleTags), }); } artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName, "Resources"), fileTags: ["bundle.symlink.resources", "bundle.content"].concat(mainBundleTags), }); artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName, product.targetName), fileTags: ["bundle.symlink.executable", "bundle.content"].concat(mainBundleTags), }); artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.versionsFolderPath, "Current"), fileTags: ["bundle.symlink.version", "bundle.content"].concat(mainBundleTags), }); } ["public", "private"].forEach(function(headerType) { const sources = (inputs["bundle.input." + headerType + "_hpp"] || []) .concat(product.bundle[headerType + "Headers"].map(filePathToArtifactLike)); const destination = FileInfo.joinPaths(product.destinationDirectory, ModUtils.moduleProperty(product, headerType + "HeadersFolderPath")); sources.forEach(function(source) { artifacts.push({ filePath: FileInfo.joinPaths(destination, source.fileName), fileTags: ["bundle.hpp", "bundle.content"].concat(mainBundleTags), }); }); }); const resources = (inputs["bundle.input.resources"] || []) .concat(product.bundle.resources.map(filePathToArtifactLike)); resources.forEach(function(resource) { destination = BundleTools.destinationDirectoryForResource( product, {baseDir: resource.path, fileName: resource.fileName}); artifacts.push({ filePath: FileInfo.joinPaths(destination, resource.fileName), fileTags: ["bundle.resource", "bundle.content"].concat(mainBundleTags), }); }); if (Host.os().includes("darwin") && product.codesign && product.codesign.enableCodeSigning) { var signatureFiles = ["CodeResources"]; // Static libraries generate additional code signature artifacts // This is also true for any framework without a mach-o binary, but do we support those? const isStaticLibrary = product.type.includes("staticlibrary"); if (isStaticLibrary) { signatureFiles = signatureFiles.concat([ "CodeDirectory", "CodeRequirements", "CodeRequirements-1", "CodeSignature", ]); } Array.prototype.push.apply(artifacts, signatureFiles.map(function(file) { return { filePath: FileInfo.joinPaths( product.destinationDirectory, product.bundle.contentsFolderPath, "_CodeSignature", file), fileTags: ["bundle.code-signature", "bundle.content"].concat(mainBundleTags) }; })); } } return artifacts; } function generateBundleCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var i, cmd, commands = []; var packageType = product.bundle.packageType; var bundleType = "bundle"; if (packageType === "APPL") bundleType = "application"; if (packageType === "FMWK") bundleType = "framework"; // Product is unbundled if (!product.bundle.isBundle) { cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function () { }; commands.push(cmd); } var symlinks = outputs["bundle.symlink.version"]; for (i in symlinks) { cmd = new Command("ln", ["-sfn", product.bundle.frameworkVersion, symlinks[i].filePath]); cmd.silent = true; commands.push(cmd); } var publicHeaders = outputs["bundle.symlink.headers"]; for (i in publicHeaders) { cmd = new Command("ln", ["-sfn", "Versions/Current/Headers", publicHeaders[i].filePath]); cmd.silent = true; commands.push(cmd); } var privateHeaders = outputs["bundle.symlink.private-headers"]; for (i in privateHeaders) { cmd = new Command("ln", ["-sfn", "Versions/Current/PrivateHeaders", privateHeaders[i].filePath]); cmd.silent = true; commands.push(cmd); } var resources = outputs["bundle.symlink.resources"]; for (i in resources) { cmd = new Command("ln", ["-sfn", "Versions/Current/Resources", resources[i].filePath]); cmd.silent = true; commands.push(cmd); } var executables = outputs["bundle.symlink.executable"]; for (i in executables) { cmd = new Command("ln", ["-sfn", FileInfo.joinPaths("Versions", "Current", product.targetName), executables[i].filePath]); cmd.silent = true; commands.push(cmd); } function sortedArtifactList(list, func) { if (list) { return list.sort(func || (function (a, b) { return a.filePath.localeCompare(b.filePath); })); } } var bundleInputs = sortedArtifactList(inputs["bundle.input"], function (a, b) { return a.bundle._bundleFilePath.localeCompare( b.bundle._bundleFilePath); }); var bundleContents = sortedArtifactList(outputs["bundle.content.copied"]); for (i in bundleContents) { cmd = new JavaScriptCommand(); cmd.silent = true; cmd.source = bundleInputs[i].filePath; cmd.destination = bundleContents[i].filePath; cmd.sourceCode = function() { File.copy(source, destination); }; commands.push(cmd); } cmd = new JavaScriptCommand(); cmd.description = "copying provisioning profile"; cmd.highlight = "filegen"; cmd.sources = (inputs["codesign.embedded_provisioningprofile"] || []) .map(function(artifact) { return artifact.filePath; }); cmd.destination = (outputs["bundle.provisioningprofile"] || []) .map(function(artifact) { return artifact.filePath; }); cmd.sourceCode = function() { var i; for (var i in sources) { File.copy(sources[i], destination[i]); } }; if (cmd.sources && cmd.sources.length) commands.push(cmd); cmd = new JavaScriptCommand(); cmd.description = "copying privacy manifest"; cmd.highlight = "filegen"; cmd.sources = (inputs["bundle.input.privacymanifest"] || []) .map(function(artifact) { return artifact.filePath; }); cmd.destination = (outputs["bundle.privacymanifest"] || []) .map(function(artifact) { return artifact.filePath; }); cmd.sourceCode = function() { var i; for (var i = 0; i < sources.length; ++i) File.copy(sources[i], destination[i]); }; if (cmd.sources && cmd.sources.length) commands.push(cmd); cmd = new JavaScriptCommand(); cmd.description = "copying public headers"; cmd.highlight = "filegen"; cmd.sources = (inputs["bundle.input.public_hpp"] || []) .map(function(artifact) { return artifact.filePath; }) .concat(product.bundle.publicHeaders); cmd.destination = FileInfo.joinPaths(product.destinationDirectory, product.bundle.publicHeadersFolderPath); cmd.sourceCode = function() { var i; for (var i in sources) { File.copy(sources[i], FileInfo.joinPaths(destination, FileInfo.fileName(sources[i]))); } }; if (cmd.sources && cmd.sources.length) commands.push(cmd); cmd = new JavaScriptCommand(); cmd.description = "copying private headers"; cmd.highlight = "filegen"; cmd.sources = (inputs["bundle.input.private_hpp"] || []) .map(function(artifact) { return artifact.filePath; }) .concat(product.bundle.privateHeaders); cmd.destination = FileInfo.joinPaths(product.destinationDirectory, product.bundle.privateHeadersFolderPath); cmd.sourceCode = function() { var i; for (var i in sources) { File.copy(sources[i], FileInfo.joinPaths(destination, FileInfo.fileName(sources[i]))); } }; if (cmd.sources && cmd.sources.length) commands.push(cmd); cmd = new JavaScriptCommand(); cmd.description = "copying resources"; cmd.highlight = "filegen"; cmd.sources = (inputs["bundle.input.resources"] || []) .map(function(artifact) { return artifact.filePath; }) .concat(product.bundle.resources); cmd.sourceCode = function() { var i; for (var i in sources) { var destination = BundleTools.destinationDirectoryForResource(product, {baseDir: FileInfo.path(sources[i]), fileName: FileInfo.fileName(sources[i])}); File.copy(sources[i], FileInfo.joinPaths(destination, FileInfo.fileName(sources[i]))); } }; if (cmd.sources && cmd.sources.length) commands.push(cmd); if (product.qbs.hostOS.includes("darwin")) { Array.prototype.push.apply(commands, Codesign.prepareSign( project, product, inputs, outputs, input, output)); if (bundleType === "application" && product.qbs.targetOS.includes("macos")) { var bundlePath = FileInfo.joinPaths( product.destinationDirectory, product.bundle.bundleName); cmd = new Command(product.bundle.lsregisterPath, ["-f", bundlePath]); cmd.description = "registering " + product.bundle.bundleName; commands.push(cmd); } } return commands; } function generatePkgInfoOutputs(product) { var artifacts = []; if (product.bundle.isBundle && product.bundle.generatePackageInfo) { artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, "PkgInfo"), fileTags: ["bundle.input", "pkginfo"], bundle: { _bundleFilePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.pkgInfoPath) } }); } return artifacts; } function generatePkgInfoCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmd = new JavaScriptCommand(); cmd.description = "generating PkgInfo for " + product.name; cmd.highlight = "codegen"; cmd.sourceCode = function() { var infoPlist = BundleTools.infoPlistContents(inputs.aggregate_infoplist[0].filePath); var pkgType = infoPlist['CFBundlePackageType']; if (!pkgType) throw("CFBundlePackageType not found in Info.plist; this should not happen"); var pkgSign = infoPlist['CFBundleSignature']; if (!pkgSign) throw("CFBundleSignature not found in Info.plist; this should not happen"); var pkginfo = new TextFile(outputs.pkginfo[0].filePath, TextFile.WriteOnly); pkginfo.write(pkgType + pkgSign); pkginfo.close(); } return cmd; } function aggregateInfoPlistOutputs(product) { var artifacts = []; var embed = product.bundle.embedInfoPlist; if (product.bundle.isBundle || embed) { artifacts.push({ filePath: FileInfo.joinPaths( product.destinationDirectory, product.name + "-Info.plist"), fileTags: ["aggregate_infoplist"].concat(!embed ? ["bundle.input"] : []), bundle: { _bundleFilePath: FileInfo.joinPaths( product.destinationDirectory, product.bundle.infoPlistPath), } }); } return artifacts; } function aggregateInfoPlistCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn) { var cmd = new JavaScriptCommand(); cmd.description = "generating Info.plist for " + product.name; cmd.highlight = "codegen"; cmd.infoPlist = product.bundle.infoPlist || {}; cmd.processInfoPlist = product.bundle.processInfoPlist; cmd.infoPlistFormat = product.bundle.infoPlistFormat; cmd.extraEnv = product.bundle.extraEnv; cmd.qmakeEnv = product.bundle.qmakeEnv; // TODO: bundle module should know nothing about cpp module cmd.buildEnv = product.moduleProperty("cpp", "buildEnv"); cmd.developerPath = product.bundle._developerPath; cmd.platformInfoPlist = product.bundle._platformInfoPlist; cmd.sdkSettingsPlist = product.bundle._sdkSettingsPlist; cmd.toolchainInfoPlist = product.bundle._toolchainInfoPlist; cmd.osBuildVersion = product.qbs.hostOSBuildVersion; cmd.sourceCode = function() { var plist, process, key, i; // Contains the combination of default, file, and in-source keys and values // Start out with the contents of this file as the "base", if given var aggregatePlist = {}; for (i = 0; i < (inputs.infoplist || []).length; ++i) { aggregatePlist = BundleTools.infoPlistContents(inputs.infoplist[i].filePath); infoPlistFormat = (infoPlistFormat === "same-as-input") ? BundleTools.infoPlistFormat(inputs.infoplist[i].filePath) : "xml1"; break; } // Add local key-value pairs (overrides equivalent keys specified in the file if // one was given) for (key in infoPlist) { if (infoPlist.hasOwnProperty(key)) aggregatePlist[key] = infoPlist[key]; } // Do some postprocessing if desired if (processInfoPlist) { // Add default values to the aggregate plist if the corresponding keys // for those values are not already present var defaultValues = product.bundle.defaultInfoPlist; for (key in defaultValues) { if (defaultValues.hasOwnProperty(key) && !(key in aggregatePlist)) aggregatePlist[key] = defaultValues[key]; } // Add keys from platform's Info.plist if not already present var platformInfo = {}; var sdkSettings = {}; var toolchainInfo = {}; if (developerPath) { plist = new PropertyList(); try { plist.readFromFile(platformInfoPlist); platformInfo = plist.toObject(); } finally { plist.clear(); } var additionalProps = platformInfo["AdditionalInfo"]; for (key in additionalProps) { // override infoPlist? if (additionalProps.hasOwnProperty(key) && !(key in aggregatePlist)) aggregatePlist[key] = defaultValues[key]; } props = platformInfo['OverrideProperties']; for (key in props) { aggregatePlist[key] = props[key]; } plist = new PropertyList(); try { plist.readFromFile(sdkSettingsPlist); sdkSettings = plist.toObject(); } finally { plist.clear(); } plist = new PropertyList(); try { plist.readFromFile(toolchainInfoPlist); toolchainInfo = plist.toObject(); } finally { plist.clear(); } } aggregatePlist["BuildMachineOSBuild"] = osBuildVersion; // setup env env = { "SDK_NAME": sdkSettings["CanonicalName"], "XCODE_VERSION_ACTUAL": toolchainInfo["DTXcode"], "SDK_PRODUCT_BUILD_VERSION": toolchainInfo["DTPlatformBuild"], "GCC_VERSION": platformInfo["DTCompiler"], "XCODE_PRODUCT_BUILD_VERSION": platformInfo["DTPlatformBuild"], "PLATFORM_PRODUCT_BUILD_VERSION": platformInfo["ProductBuildVersion"], } env["MAC_OS_X_PRODUCT_BUILD_VERSION"] = osBuildVersion; for (key in extraEnv) env[key] = extraEnv[key]; for (key in buildEnv) env[key] = buildEnv[key]; for (key in qmakeEnv) env[key] = qmakeEnv[key]; 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 = 0; i < (inputs.infoplist || []).length; ++i) allFilePaths.push(inputs.infoplist[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 (var j = 0; j < (inputs.partial_infoplist || []).length; ++j) { var partialInfoPlist = BundleTools.infoPlistContents( inputs.partial_infoplist[j].filePath) || {}; for (key in partialInfoPlist) { if (partialInfoPlist.hasOwnProperty(key) && aggregatePlist[key] === undefined) aggregatePlist[key] = partialInfoPlist[key]; } } } // Anything with an undefined or otherwise empty value should be removed // Only JSON-formatted plists can have null values, other formats error out // This also follows Xcode behavior DarwinTools.cleanPropertyList(aggregatePlist); if (infoPlistFormat === "same-as-input") infoPlistFormat = "xml1"; var validFormats = [ "xml1", "binary1", "json" ]; if (!validFormats.includes(infoPlistFormat)) throw("Invalid Info.plist format " + infoPlistFormat + ". " + "Must be in [xml1, binary1, json]."); // Write the plist contents in the format appropriate for the current platform plist = new PropertyList(); try { plist.readFromObject(aggregatePlist); plist.writeToFile(outputs.aggregate_infoplist[0].filePath, infoPlistFormat); } finally { plist.clear(); } } return cmd; } qbs-src-3.2.0/share/qbs/modules/bundle/MacOSX-Product-Types.xcspec0000644000175100017510000007550015154533055024342 0ustar runnerrunner// // MacOSX Product Types.xcspec // // Copyright © 1999-2020 Apple Inc. All rights reserved. // // Product type specifications in the macOS platform. // ( // // Single-file product types // // Tool (normal Unix command-line executable) { Type = ProductType; Identifier = com.apple.product-type.tool; Class = PBXToolProductType; Name = "Command-line Tool"; Description = "Standalone command-line tool"; IconNamePrefix = "TargetExecutable"; DefaultTargetName = "Command-line Tool"; DefaultBuildProperties = { FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)"; MACH_O_TYPE = "mh_execute"; EXECUTABLE_PREFIX = ""; EXECUTABLE_SUFFIX = ""; REZ_EXECUTABLE = YES; INSTALL_PATH = "/usr/local/bin"; FRAMEWORK_FLAG_PREFIX = "-framework"; LIBRARY_FLAG_PREFIX = "-l"; LIBRARY_FLAG_NOSPACE = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_INLINES_ARE_PRIVATE_EXTERN = YES; STRIP_STYLE = "all"; CODE_SIGNING_ALLOWED = YES; }; PackageTypes = ( com.apple.package-type.mach-o-executable // default ); WantsSigningEditing = YES; WantsBundleIdentifierEditing = YES; }, // Java tool { Type = ProductType; Identifier = com.apple.product-type.tool.java; Name = "Java Command-line Tool"; Description = "Java Command-line tool"; IconNamePrefix = "TargetExecutable"; DefaultTargetName = "Java Command-line Tool"; DefaultBuildProperties = { FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)"; REZ_EXECUTABLE = YES; INSTALL_PATH = "/usr/local/bin"; }; IsJava = YES; PackageTypes = ( com.apple.package-type.jarfile, // default com.apple.package-type.zipfile, com.apple.package-type.javaclassfolder ); }, // Object file { Type = ProductType; Identifier = com.apple.product-type.objfile; Class = XCStandaloneExecutableProductType; Name = "Object File"; Description = "Object File"; IconNamePrefix = "TargetPlugin"; DefaultTargetName = "Object File"; DefaultBuildProperties = { FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)"; MACH_O_TYPE = "mh_object"; LINK_WITH_STANDARD_LIBRARIES = NO; REZ_EXECUTABLE = YES; EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)"; EXECUTABLE_EXTENSION = "o"; PUBLIC_HEADERS_FOLDER_PATH = "/usr/local/include"; PRIVATE_HEADERS_FOLDER_PATH = "/usr/local/include"; INSTALL_PATH = "$(HOME)/Objects"; FRAMEWORK_FLAG_PREFIX = "-framework"; LIBRARY_FLAG_PREFIX = "-l"; LIBRARY_FLAG_NOSPACE = YES; SKIP_INSTALL = YES; STRIP_STYLE = "debugging"; GCC_INLINES_ARE_PRIVATE_EXTERN = YES; KEEP_PRIVATE_EXTERNS = YES; DEAD_CODE_STRIPPING = NO; }; PackageTypes = ( com.apple.package-type.mach-o-objfile // default ); }, // Dynamic library { Type = ProductType; Identifier = com.apple.product-type.library.dynamic; Class = PBXDynamicLibraryProductType; Name = "Dynamic Library"; Description = "Dynamic library"; IconNamePrefix = "TargetLibrary"; DefaultTargetName = "Dynamic Library"; DefaultBuildProperties = { FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)"; MACH_O_TYPE = "mh_dylib"; REZ_EXECUTABLE = YES; EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)"; EXECUTABLE_EXTENSION = "dylib"; PUBLIC_HEADERS_FOLDER_PATH = "/usr/local/include"; PRIVATE_HEADERS_FOLDER_PATH = "/usr/local/include"; INSTALL_PATH = "/usr/local/lib"; DYLIB_INSTALL_NAME_BASE = "$(INSTALL_PATH)"; LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)"; DYLIB_COMPATIBILITY_VERSION = "1"; DYLIB_CURRENT_VERSION = "1"; FRAMEWORK_FLAG_PREFIX = "-framework"; LIBRARY_FLAG_PREFIX = "-l"; LIBRARY_FLAG_NOSPACE = YES; STRIP_STYLE = "debugging"; GCC_INLINES_ARE_PRIVATE_EXTERN = YES; CODE_SIGNING_ALLOWED = YES; CODE_SIGNING_REQUIRED = NO; }; PackageTypes = ( com.apple.package-type.mach-o-dylib // default ); }, // Static library { Type = ProductType; Identifier = com.apple.product-type.library.static; Class = PBXStaticLibraryProductType; Name = "Static Library"; Description = "Static library"; IconNamePrefix = "TargetLibrary"; DefaultTargetName = "Static Library"; DefaultBuildProperties = { FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)"; MACH_O_TYPE = "staticlib"; REZ_EXECUTABLE = YES; EXECUTABLE_PREFIX = "lib"; EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)"; EXECUTABLE_EXTENSION = "a"; PUBLIC_HEADERS_FOLDER_PATH = "/usr/local/include"; PRIVATE_HEADERS_FOLDER_PATH = "/usr/local/include"; INSTALL_PATH = "/usr/local/lib"; FRAMEWORK_FLAG_PREFIX = "-framework"; LIBRARY_FLAG_PREFIX = "-l"; LIBRARY_FLAG_NOSPACE = YES; STRIP_STYLE = "debugging"; CLANG_ENABLE_MODULE_DEBUGGING = NO; CODE_SIGNING_ALLOWED = NO; }; AlwaysPerformSeparateStrip = YES; PackageTypes = ( com.apple.package-type.static-library // default ); }, // Java library (jar or zip file) { Type = ProductType; Identifier = com.apple.product-type.library.java.archive; Name = "Java Library"; Description = "Java library packaged as a Jar file, Zip file, or class folder"; IconNamePrefix = "TargetPlugin"; DefaultTargetName = "Java Library"; DefaultBuildProperties = { FULL_PRODUCT_NAME = "$(PRODUCT_NAME)"; INSTALL_PATH = "/usr/local/lib"; }; IsJava = YES; PackageTypes = ( com.apple.package-type.jarfile, // default com.apple.package-type.zipfile, com.apple.package-type.javaclassfolder ); }, // // Wrapper product types // // Bundle { Type = ProductType; Identifier = com.apple.product-type.bundle; Class = PBXBundleProductType; Name = "Bundle"; Description = "Generic bundle"; IconNamePrefix = "TargetPlugin"; DefaultTargetName = "Bundle"; DefaultBuildProperties = { FULL_PRODUCT_NAME = "$(WRAPPER_NAME)"; MACH_O_TYPE = "mh_bundle"; WRAPPER_PREFIX = ""; WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; WRAPPER_EXTENSION = "bundle"; WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)"; FRAMEWORK_FLAG_PREFIX = "-framework"; LIBRARY_FLAG_PREFIX = "-l"; LIBRARY_FLAG_NOSPACE = YES; STRIP_STYLE = "non-global"; GCC_INLINES_ARE_PRIVATE_EXTERN = YES; CODE_SIGNING_ALLOWED = YES; }; PackageTypes = ( com.apple.package-type.wrapper, // default com.apple.package-type.wrapper.shallow // Not clear if this is needed in the presence of the Shallow Bundle product type below. ); IsWrapper = YES; HasInfoPlist = YES; HasInfoPlistStrings = YES; WantsBundleIdentifierEditing = YES; WantsSigningEditing = YES; }, // Shallow Bundle Product { Type = ProductType; Identifier = com.apple.product-type.bundle.shallow; BasedOn = com.apple.product-type.bundle; Class = PBXBundleProductType; Name = "Bundle (Shallow)"; Description = "Bundle (Shallow)"; PackageTypes = ( com.apple.package-type.wrapper.shallow ); }, // Application { Type = ProductType; Identifier = com.apple.product-type.application; BasedOn = com.apple.product-type.bundle; Class = PBXApplicationProductType; Name = "Application"; Description = "Application"; IconNamePrefix = "TargetApp"; DefaultTargetName = "Application"; DefaultBuildProperties = { MACH_O_TYPE = "mh_execute"; GCC_DYNAMIC_NO_PIC = NO; GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_INLINES_ARE_PRIVATE_EXTERN = YES; WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; WRAPPER_EXTENSION = "app"; INSTALL_PATH = "$(LOCAL_APPS_DIR)"; STRIP_STYLE = "all"; CODE_SIGNING_ALLOWED = YES; LD_RUNPATH_SEARCH_PATHS = "$(LD_RUNPATH_SEARCH_PATHS_$(IS_MACCATALYST))"; LD_RUNPATH_SEARCH_PATHS_YES = ( "@loader_path/../Frameworks", ); }; PackageTypes = ( com.apple.package-type.wrapper.application // default ); /** Product type validation hooks */ Validation = { // Checks - a dictionary of checks that are perform just prior to building the product // Each dictionary key is the "XCPropertyMacroExpression" to evaluate // The dictionary value contains the error message to display if the condition evaluates to false. Checks = { // This is intentially empty as currently all of the checks are done in-code for this particular application type. However, we enable the plubmbing for the validation tool spec infrastructure to be called to avoid any further hacks in pbxbuild or xcbuild. This is to enable rdar://problem/45590882. }; // Determines if the legacy build system has support for this validation hook. This is a workaround for enabling additional validation in xcbuild (specifically for rdar://problem/45590882), which does not have the same plugin restriction that is imposed on pbxbuild's implementation of the validation hooks. EnabledForLegacyBuildSystem = NO; // ValidationToolSpec - the identifier of the tool (script) to run after a target is constructed. ValidationToolSpec = "com.apple.build-tools.platform.validate"; }; CanEmbedCompilerSanitizerLibraries = YES; RunpathSearchPathForEmbeddedFrameworks = "@executable_path/../Frameworks"; ValidateEmbeddedBinaries = YES; ProvisioningProfileSupported = YES; ProvisioningProfileRequired = NO; WantsBundleIdentifierEditing = YES; WantsSigningEditing = YES; }, // Shallow Application Product { Type = ProductType; Identifier = com.apple.product-type.application.shallow; BasedOn = com.apple.product-type.application; Class = PBXApplicationProductType; // see radar 5604879, this shouldn't be necesary Name = "Application (Shallow Bundle)"; Description = "Application (Shallow Bundle)"; PackageTypes = ( com.apple.package-type.wrapper.application.shallow ); }, // Java Application { Type = ProductType; Identifier = com.apple.product-type.application.java; BasedOn = com.apple.product-type.application; Name = "Java Application"; Description = "Java Application"; DefaultTargetName = "Java Application"; DefaultBuildProperties = { INFOPLIST_PATH = ""; PKGINFO_PATH = ""; }; IsJava = YES; }, // Framework { Type = ProductType; Identifier = com.apple.product-type.framework; BasedOn = com.apple.product-type.bundle; Class = PBXFrameworkProductType; Name = "Framework"; Description = "Framework"; IconNamePrefix = "TargetFramework"; DefaultTargetName = "Framework"; DefaultBuildProperties = { MACH_O_TYPE = "mh_dylib"; FRAMEWORK_VERSION = "A"; WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; WRAPPER_EXTENSION = "framework"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; DYLIB_INSTALL_NAME_BASE = "$(INSTALL_PATH)"; LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)"; STRIP_STYLE = "debugging"; CODE_SIGNING_ALLOWED = YES; CODE_SIGNING_REQUIRED = NO; ENTITLEMENTS_REQUIRED = NO; CODE_SIGNING_REQUIRES_TEAM = YES; }; PackageTypes = ( com.apple.package-type.wrapper.framework // default ); }, // Shallow Framework Product { Type = ProductType; Identifier = com.apple.product-type.framework.shallow; BasedOn = com.apple.product-type.framework; Class = PBXFrameworkProductType; Name = "Framework (Shallow Bundle)"; Description = "Framework (Shallow Bundle)"; PackageTypes = ( com.apple.package-type.wrapper.framework.shallow ); }, // Static framework { Type = ProductType; Identifier = com.apple.product-type.framework.static; BasedOn = com.apple.product-type.framework; Class = XCStaticFrameworkProductType; Name = "Static Framework"; Description = "Static Framework"; IconNamePrefix = "TargetFramework"; DefaultTargetName = "Static Framework"; DefaultBuildProperties = { MACH_O_TYPE = "staticlib"; FRAMEWORK_VERSION = "A"; WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; WRAPPER_EXTENSION = "framework"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; DYLIB_INSTALL_NAME_BASE = ""; LD_DYLIB_INSTALL_NAME = ""; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; CODE_SIGNING_ALLOWED = NO; }; AlwaysPerformSeparateStrip = YES; PackageTypes = ( com.apple.package-type.wrapper.framework.static // default ); }, // System extension { Type = ProductType; Identifier = com.apple.product-type.system-extension; BasedOn = com.apple.product-type.bundle; Name = "DriverKit Driver"; Description = "DriverKit driver"; DefaultTargetName = "DriverKit Driver"; DefaultBuildProperties = { MACH_O_TYPE = "mh_execute"; WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; WRAPPER_EXTENSION = "systemextension"; PRODUCT_NAME = "$(PRODUCT_BUNDLE_IDENTIFIER)"; }; PackageTypes = ( com.apple.package-type.wrapper.system-extension, ); ProvisioningProfileSupported = YES; ProvisioningProfileRequired = NO; }, // DriverKit driver { Type = ProductType; Identifier = com.apple.product-type.driver-extension; BasedOn = com.apple.product-type.system-extension; Name = "DriverKit Driver"; Description = "DriverKit driver"; DefaultTargetName = "DriverKit Driver"; DefaultBuildProperties = { SDKROOT = "driverkit"; MACH_O_TYPE = "mh_execute"; WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; WRAPPER_EXTENSION = "dext"; INSTALL_PATH = "$(DEFAULT_DEXT_INSTALL_PATH)"; STRIP_STYLE = "debugging"; DEXT_FRAMEWORK_NAME = "DriverKit"; DEXT_FRAMEWORK = "$(SYSTEM_LIBRARY_DIR)/Frameworks/$(DEXT_FRAMEWORK_NAME).framework"; GCC_SYMBOLS_PRIVATE_EXTERN = NO; PRODUCT_NAME = "$(PRODUCT_BUNDLE_IDENTIFIER)"; PRODUCT_TYPE_HEADER_SEARCH_PATHS = "$(inherited) $(IIG_HEADERS_DIR)"; }; DefaultEntitlements = { "com.apple.developer.driverkit" = YES; }; PackageTypes = ( com.apple.package-type.wrapper.driver-extension, ); }, // Kernel Extension { Type = ProductType; Identifier = com.apple.product-type.kernel-extension; BasedOn = com.apple.product-type.bundle; Class = XCKernelExtensionProductType; Name = "Kernel Extension"; Description = "Kernel extension"; DefaultTargetName = "Kernel Extension"; DefaultBuildProperties = { MACH_O_TYPE = "mh_execute"; WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)"; WRAPPER_EXTENSION = "kext"; INSTALL_PATH = "$(DEFAULT_KEXT_INSTALL_PATH)"; STRIP_STYLE = "debugging"; KEXT_FRAMEWORK_NAME = "Kernel"; KEXT_FRAMEWORK = "$(SYSTEM_LIBRARY_DIR)/Frameworks/$(KEXT_FRAMEWORK_NAME).framework"; KEXT_FAMILY_NAME = "family"; PUBLIC_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/Headers/$(KEXT_FAMILY_NAME)"; PRIVATE_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/PrivateHeaders/$(KEXT_FAMILY_NAME)"; MODULE_NAME = "com.company.driver.modulename"; MODULE_VERSION = "1.0"; MODULE_START = "0"; MODULE_STOP = "0"; ENABLE_APPLE_KEXT_CODE_GENERATION = YES; // -fapple-kext GCC_ENABLE_KERNEL_DEVELOPMENT = YES; // -mkernel GCC_USE_STANDARD_INCLUDE_SEARCHING = NO; // -nostdinc GCC_ENABLE_PASCAL_STRINGS = NO; // Disables -fpascal-strings GCC_FORCE_CPU_SUBTYPE_ALL = YES; // -force_cpusubtype_ALL GCC_CHECK_RETURN_VALUE_OF_OPERATOR_NEW = YES; // -fcheck-new GCC_INLINES_ARE_PRIVATE_EXTERN = NO; // -fvisibility-inlines-hidden GCC_ENABLE_BUILTIN_FUNCTIONS = NO; // -fno-builtin GCC_NO_COMMON_BLOCKS = YES; // -fno-common GCC_ENABLE_CPP_EXCEPTIONS = NO; // -fno-exceptions GCC_ENABLE_CPP_RTTI = NO; // -fno-rtti // Supposedly these two flags are the default in GCC, but they're provided here for compatibility with older Xcode versions. GCC_ENABLE_FUNCTION_INLINING = YES; // -finline GCC_DISABLE_STATIC_FUNCTION_INLINING = YES; // -fno-keep-inline-functions // Per-product-type settings. // The KERNEL_*** settings are defined differently for some SDKs, so we continue to use them for compatibility reasons. KERNEL_FRAMEWORK = "$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/Kernel.framework"; KERNEL_FRAMEWORK_HEADERS = "$(KERNEL_FRAMEWORK)/Headers"; KERNEL_EXTENSION_HEADER_SEARCH_PATHS = "$(KERNEL_FRAMEWORK)/PrivateHeaders $(KERNEL_FRAMEWORK_HEADERS)"; // These settings are reserved for use by product types. GCC_PRODUCT_TYPE_PREPROCESSOR_DEFINITIONS = "$(inherited) KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT"; PRODUCT_TYPE_CFLAGS = "$(inherited) $(KEXT_CFLAGS)"; PRODUCT_TYPE_CPLUSPLUSFLAGS = "$(inherited) $(KEXT_CPLUSPLUSFLAGS)"; PRODUCT_SPECIFIC_LDFLAGS = "$(inherited) $(KEXT_LDFLAGS)"; PRODUCT_TYPE_HEADER_SEARCH_PATHS = "$(inherited) $(KERNEL_EXTENSION_HEADER_SEARCH_PATHS)"; CODE_SIGNING_ALLOWED = YES; ARCHS_STANDARD = "arm64e x86_64"; ARCHS_STANDARD_64_BIT = "$(ARCHS_STANDARD)"; ARCHS_STANDARD_INCLUDING_64_BIT = "$(ARCHS_STANDARD)"; }; PackageTypes = ( com.apple.package-type.wrapper.kernel-extension, // Default com.apple.package-type.wrapper.kernel-extension.shallow, ); }, // Shallow Kernel Extension { Type = ProductType; Identifier = com.apple.product-type.kernel-extension.shallow; BasedOn = com.apple.product-type.kernel-extension; Class = XCKernelExtensionProductType; Name = "Kernel Extension (Shallow)"; Description = "Kernel extension (shallow)"; DefaultBuildProperties = { // None yet }; PackageTypes = ( com.apple.package-type.wrapper.kernel-extension.shallow, ); }, // IOKit Kernel Extension { Type = ProductType; Identifier = com.apple.product-type.kernel-extension.iokit; BasedOn = com.apple.product-type.kernel-extension; Class = XCKernelExtensionProductType; Name = "IOKit Kernel Extension"; Description = "IOKit Kernel extension"; DefaultTargetName = "IOKit Kernel Extension"; DefaultBuildProperties = { CODE_SIGNING_ALLOWED = YES; }; PackageTypes = ( com.apple.package-type.wrapper.kernel-extension, // Default com.apple.package-type.wrapper.kernel-extension.shallow, ); }, // Shallow IOKit Kernel Extension { Type = ProductType; Identifier = com.apple.product-type.kernel-extension.iokit.shallow; BasedOn = com.apple.product-type.kernel-extension; Class = XCKernelExtensionProductType; Name = "IOKit Kernel Extension (Shallow)"; Description = "IOKit Kernel extension (Shallow)"; DefaultTargetName = "IOKit Kernel Extension (Shallow)"; DefaultBuildProperties = { // None yet }; PackageTypes = ( com.apple.package-type.wrapper.kernel-extension.shallow, ); }, // Unit Test Bundle { Type = ProductType; Identifier = com.apple.product-type.bundle.unit-test; BasedOn = com.apple.product-type.bundle; Class = PBXXCTestBundleProductType; Name = "Unit Test Bundle"; Description = "Unit Test Bundle"; DefaultBuildProperties = { WRAPPER_EXTENSION = "xctest"; ENABLE_TESTING_SEARCH_PATHS = YES; PRODUCT_SPECIFIC_LDFLAGS = "-framework XCTest"; XCTRUNNER_PATH = "$(XCTRUNNER_PATH$(TEST_BUILD_STYLE))"; LD_RUNPATH_SEARCH_PATHS = "$(LD_RUNPATH_SEARCH_PATHS_$(IS_MACCATALYST))"; LD_RUNPATH_SEARCH_PATHS_YES = ( "@loader_path/../Frameworks", "@executable_path/../Frameworks", ); }; PackageTypes = ( com.apple.package-type.bundle.unit-test ); CanEmbedCompilerSanitizerLibraries = YES; IsUnitTest = YES; WantsBundleIdentifierEditing = NO; }, // UI Testing Bundle { Type = ProductType; Identifier = com.apple.product-type.bundle.ui-testing; BasedOn = com.apple.product-type.bundle.unit-test; Class = PBXXCTestBundleProductType; Name = "UI Testing Bundle"; Description = "UI Testing Bundle"; DefaultBuildProperties = { USES_XCTRUNNER = "YES"; }; PackageTypes = ( com.apple.package-type.bundle.unit-test ); ProvisioningProfileSupported = YES; IsUITest = YES; InfoPlistAdditions = { XCTContainsUITests = YES; }; WantsBundleIdentifierEditing = NO; }, // Legacy OCUnit Test Bundle { Type = ProductType; Identifier = com.apple.product-type.bundle.ocunit-test; BasedOn = com.apple.product-type.bundle; Class = PBXBundleProductType; Name = "OCUnit Test Bundle"; Description = "OCUnit Test Bundle"; DefaultBuildProperties = { WRAPPER_EXTENSION = "octest"; }; PackageTypes = ( com.apple.package-type.bundle.ocunit-test ); IsUnitTest = YES; }, // In-App Purchase Content { Type = ProductType; Identifier = com.apple.product-type.in-app-purchase-content; Class = PBXBundleProductType; Name = "In-App Purchase Content"; Description = "In-App Purchase Content"; DefaultBuildProperties = { CODE_SIGNING_ALLOWED = NO; FULL_PRODUCT_NAME = "$(WRAPPER_NAME)"; }; PackageTypes = ( com.apple.package-type.in-app-purchase-content, // default ); IsWrapper = YES; HasInfoPlist = YES; HasInfoPlistStrings = NO; }, // XPC Service { Type = ProductType; Identifier = "com.apple.product-type.xpc-service"; BasedOn = "com.apple.product-type.bundle"; Class = PBXBundleProductType; Name = "XPC Service"; Description = "XPC Service"; IconNamePrefix = XPCService; DefaultTargetName = "XPC Service"; CanEmbedCompilerSanitizerLibraries = YES; "DefaultBuildProperties" = { "MACH_O_TYPE" = "mh_execute"; WRAPPER_EXTENSION = "xpc"; LD_RUNPATH_SEARCH_PATHS = "$(LD_RUNPATH_SEARCH_PATHS_$(IS_MACCATALYST)_$(_BOOL_$(SKIP_INSTALL)))"; LD_RUNPATH_SEARCH_PATHS_YES_YES = ( "@loader_path/../Frameworks", "@loader_path/../../../../Frameworks", ); LD_RUNPATH_SEARCH_PATHS_YES_NO = ( "@loader_path/../Frameworks", ); }; PackageTypes = ( "com.apple.package-type.xpc-service", ); ProvisioningProfileSupported = YES; ProvisioningProfileRequired = NO; WantsBundleIdentifierEditing = YES; WantsSigningEditing = YES; }, // PlugIn-Kit PlugIn { Type = ProductType; Identifier = "com.apple.product-type.pluginkit-plugin"; BasedOn = "com.apple.product-type.xpc-service"; Class = PBXBundleProductType; Name = "PlugInKit PlugIn"; Description = "PlugInKit PlugIn"; IconNamePrefix = XPCService; DefaultTargetName = "PlugInKit PlugIn"; "DefaultBuildProperties" = { "PRODUCT_SPECIFIC_LDFLAGS" = "$(SDKROOT)/System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit"; WRAPPER_EXTENSION = "pluginkit"; }; PackageTypes = ( "com.apple.package-type.pluginkit-plugin", ); }, // App Extension { Type = ProductType; Identifier = "com.apple.product-type.app-extension"; BasedOn = "com.apple.product-type.pluginkit-plugin"; Class = PBXBundleProductType; Name = "App Extension"; Description = "App Extension"; IconNamePrefix = AppExtension; DefaultTargetName = "App Extension"; "DefaultBuildProperties" = { "CODE_SIGNING_ALLOWED" = YES; "APPLICATION_EXTENSION_API_ONLY" = YES; "PRODUCT_SPECIFIC_LDFLAGS" = "-e _NSExtensionMain"; WRAPPER_EXTENSION = "appex"; }; PackageTypes = ( "com.apple.package-type.app-extension", ); ProvisioningProfileSupported = YES; ProvisioningProfileRequired = NO; WantsBundleIdentifierEditing = YES; WantsSigningEditing = YES; }, // Xcode Extension { Type = ProductType; Identifier = "com.apple.product-type.xcode-extension"; BasedOn = "com.apple.product-type.app-extension"; Name = "Xcode Extension"; Description = "Xcode Extension"; IconNamePrefix = XcodeExtension; DefaultTargetName = "Xcode Extension"; "DefaultBuildProperties" = { "CODE_SIGNING_ALLOWED" = YES; "APPLICATION_EXTENSION_API_ONLY" = YES; "PRODUCT_SPECIFIC_LDFLAGS" = "-e _XCExtensionMain -lXcodeExtension"; "PRODUCT_TYPE_FRAMEWORK_SEARCH_PATHS" = ( "$(inherited)", "$(DEVELOPER_FRAMEWORKS_DIR)", ); "PRODUCT_TYPE_LIBRARY_SEARCH_PATHS" = ( "$(inherited)", "$(DEVELOPER_USR_DIR)/lib", ); LD_RUNPATH_SEARCH_PATHS = ( "@loader_path/../Frameworks", ); WRAPPER_EXTENSION = "appex"; }; PackageTypes = ( "com.apple.package-type.app-extension", ); ProvisioningProfileSupported = YES; ProvisioningProfileRequired = NO; WantsBundleIdentifierEditing = YES; WantsSigningEditing = YES; }, // Spotlight Importer { Type = ProductType; Identifier = "com.apple.product-type.spotlight-importer"; BasedOn = "com.apple.product-type.bundle"; Class = PBXBundleProductType; Name = "Spotlight Importer"; Description = "Spotlight Importer"; DefaultTargetName = "Spotlight"; "DefaultBuildProperties" = { "CODE_SIGNING_ALLOWED" = YES; }; PackageTypes = ( "com.apple.package-type.spotlight-importer", ); }, // Copied from iOS specs to aid in build system diagnostic support. // Later, we should put these in some central place. { Type = ProductType; Identifier = "com.apple.product-type.app-extension.messages"; BasedOn = "com.apple.product-type.app-extension"; }, { Type = ProductType; Identifier = "com.apple.product-type.app-extension.messages-sticker-pack"; BasedOn = "com.apple.product-type.app-extension"; IsCapabilitiesUnsupported = YES; WantsSimpleTargetEditing = YES; DefaultBuildProperties = { MESSAGES_APPLICATION_EXTENSION_PRODUCT_BINARY_SOURCE_PATH = "$(PLATFORM_DIR)/Library/Application Support/MessagesApplicationExtensionStub/MessagesApplicationExtensionStub"; ASSETCATALOG_COMPILER_INCLUDE_STICKER_CONTENT = YES; ASSETCATALOG_COMPILER_TARGET_STICKERS_ICON_ROLE = "extension"; ASSETCATALOG_COMPILER_STICKER_PACK_IDENTIFIER_PREFIX = "$(PRODUCT_BUNDLE_IDENTIFIER).sticker-pack."; }; AllowedBuildPhases = ( "com.apple.buildphase.resources", "com.apple.buildphase.shell-script", ); InfoPlistAdditions = { LSApplicationIsStickerProvider = YES; }; }, { Type = ProductType; Identifier = "com.apple.product-type.application.on-demand-install-capable"; BasedOn = "com.apple.product-type.application"; Name = "App Clip"; Description = "App Clip"; DefaultBuildProperties = { ENABLE_ON_DEMAND_RESOURCES = NO; ASSETCATALOG_COMPILER_STANDALONE_ICON_BEHAVIOR = none; // Don't include standalone icons to keep size down PRODUCT_SPECIFIC_LDFLAGS = "$(inherited) -framework AppClip"; SKIP_INSTALL = YES; }; DefaultEntitlements = { "com.apple.developer.on-demand-install-capable" = YES; }; SupportsOnDemandResources = NO; IsEmbeddable = YES; BuildPhaseInjectionsWhenEmbedding = ( { BuildPhase = "CopyFiles"; Name = "Embed App Clips"; RunOnlyForDeploymentPostprocessing = NO; DstSubFolderSpec = 16; DstPath = "$(CONTENTS_FOLDER_PATH)/AppClips"; } ); }, ) qbs-src-3.2.0/share/qbs/modules/bundle/BundleModule.qbs0000644000175100017510000004234015154533055022403 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.BundleTools import qbs.DarwinTools import qbs.Environment import qbs.File import qbs.FileInfo import qbs.Host import qbs.ModUtils import qbs.PropertyList import qbs.TextFile import qbs.Utilities import "bundle.js" as Bundle import "../codesign/codesign.js" as Codesign Module { Depends { name: "xcode"; required: false; } Depends { name: "codesign"; required: false; } Depends { name: "installpaths" } Probe { id: bundleSettingsProbe condition: qbs.targetOS.includes("darwin") property string xcodeDeveloperPath: xcode.developerPath property var xcodeArchSettings: xcode._architectureSettings property string productTypeIdentifier: _productTypeIdentifier property bool useXcodeBuildSpecs: !useBuiltinXcodeBuildSpecs property bool isMacOs: qbs.targetOS.includes("macos") property bool xcodePresent: xcode.present property string xcodeVersion: xcode.version // Note that we include several settings pointing to properties which reference the output // of this probe (WRAPPER_NAME, WRAPPER_EXTENSION, etc.). This is to ensure that derived // properties take into account the value of these settings if the user customized them. property var additionalSettings: ({ "DEVELOPMENT_LANGUAGE": "English", "EXECUTABLE_VARIANT_SUFFIX": "", // e.g. _debug, _profile "FRAMEWORK_VERSION": frameworkVersion, "GENERATE_PKGINFO_FILE": generatePackageInfo !== undefined ? (generatePackageInfo ? "YES" : "NO") : undefined, "IS_MACCATALYST": "NO", "LD_RUNPATH_SEARCH_PATHS_NO": [], "PRODUCT_NAME": product.targetName, "LOCAL_APPS_DIR": FileInfo.joinPaths("/", installpaths.applications), "LOCAL_LIBRARY_DIR": FileInfo.joinPaths("/", installpaths.library), // actually, this is cpp.targetAbi, but XCode does not set it for non-simulator builds // while Qbs set it to "macho". "LLVM_TARGET_TRIPLE_SUFFIX": qbs.targetOS.includes("simulator") ? "-simulator" : "", "SWIFT_PLATFORM_TARGET_PREFIX": isMacOs ? "macos" : qbs.targetOS.includes("ios") ? "ios" : "", "TARGET_BUILD_DIR": product.buildDirectory, "WRAPPER_NAME": bundleName, "WRAPPER_EXTENSION": extension }) // Outputs property var xcodeSettings: ({}) property var productTypeIdentifierChain: [] configure: { var specsPaths = [path]; var specsSeparator = "-"; if (xcodeDeveloperPath && useXcodeBuildSpecs) { specsPaths = Bundle.macOSSpecsPaths(xcodeVersion, xcodeDeveloperPath); specsSeparator = " "; if (Utilities.versionCompare(xcodeVersion, "26.0") >= 0) specsSeparator = ""; } var reader = new Bundle.XcodeBuildSpecsReader(specsPaths, specsSeparator, additionalSettings, !isMacOs); var settings = reader.expandedSettings(productTypeIdentifier, xcodePresent ? xcodeArchSettings : {}); var chain = reader.productTypeIdentifierChain(productTypeIdentifier); if (settings && chain) { xcodeSettings = settings; productTypeIdentifierChain = chain; found = true; } else { xcodeSettings = {}; productTypeIdentifierChain = []; found = false; } } } additionalProductTypes: !(product.multiplexed || product.aggregate) || !product.multiplexConfigurationId ? ["bundle.content"] : [] property bool isBundle: !product.consoleApplication && qbs.targetOS.includes("darwin") property bool isMainBundle: false property bool isForMainBundle: true readonly property bool isShallow: bundleSettingsProbe.xcodeSettings["SHALLOW_BUNDLE"] === "YES" property string identifierPrefix: "org.example" property string identifier: [identifierPrefix, Utilities.rfc1034Identifier(product.targetName)].join(".") property string extension: bundleSettingsProbe.xcodeSettings["WRAPPER_EXTENSION"] property string packageType: Bundle.packageType(_productTypeIdentifier) property string signature: "????" // legacy creator code in Mac OS Classic (CFBundleSignature), can be ignored property string bundleName: bundleSettingsProbe.xcodeSettings["WRAPPER_NAME"] property string frameworkVersion: { var n = parseInt(product.version, 10); return isNaN(n) ? bundleSettingsProbe.xcodeSettings["FRAMEWORK_VERSION"] : String(n); } property bool generatePackageInfo: { // Make sure to return undefined as default to indicate "not set" var genPkgInfo = bundleSettingsProbe.xcodeSettings["GENERATE_PKGINFO_FILE"]; if (genPkgInfo) return genPkgInfo === "YES"; } property pathList publicHeaders property pathList privateHeaders property pathList resources property var infoPlist property bool processInfoPlist: true property bool embedInfoPlist: product.consoleApplication && !isBundle property string infoPlistFormat: qbs.targetOS.includes("macos") ? "same-as-input" : "binary1" property string localizedResourcesFolderSuffix: ".lproj" property string lsregisterName: "lsregister" property string lsregisterPath: FileInfo.joinPaths( "/System/Library/Frameworks/CoreServices.framework" + "/Versions/A/Frameworks/LaunchServices.framework" + "/Versions/A/Support", lsregisterName); // all paths are relative to the directory containing the bundle readonly property string infoPlistPath: bundleSettingsProbe.xcodeSettings["INFOPLIST_PATH"] readonly property string infoStringsPath: bundleSettingsProbe.xcodeSettings["INFOSTRINGS_PATH"] readonly property string pbdevelopmentPlistPath: bundleSettingsProbe.xcodeSettings["PBDEVELOPMENTPLIST_PATH"] readonly property string pkgInfoPath: bundleSettingsProbe.xcodeSettings["PKGINFO_PATH"] readonly property string versionPlistPath: bundleSettingsProbe.xcodeSettings["VERSIONPLIST_PATH"] readonly property string executablePath: bundleSettingsProbe.xcodeSettings["EXECUTABLE_PATH"] readonly property string contentsFolderPath: bundleSettingsProbe.xcodeSettings["CONTENTS_FOLDER_PATH"] readonly property string applicationsFolderPath: FileInfo.joinPaths(contentsFolderPath, "Applications") readonly property string documentationFolderPath: bundleSettingsProbe.xcodeSettings["DOCUMENTATION_FOLDER_PATH"] readonly property string executableFolderPath: bundleSettingsProbe.xcodeSettings["EXECUTABLE_FOLDER_PATH"] readonly property string executablesFolderPath: bundleSettingsProbe.xcodeSettings["EXECUTABLES_FOLDER_PATH"] readonly property string frameworksFolderPath: bundleSettingsProbe.xcodeSettings["FRAMEWORKS_FOLDER_PATH"] readonly property string javaFolderPath: bundleSettingsProbe.xcodeSettings["JAVA_FOLDER_PATH"] readonly property string localizedResourcesFolderPath: bundleSettingsProbe.xcodeSettings["LOCALIZED_RESOURCES_FOLDER_PATH"] readonly property string pluginsFolderPath: bundleSettingsProbe.xcodeSettings["PLUGINS_FOLDER_PATH"] readonly property string privateHeadersFolderPath: bundleSettingsProbe.xcodeSettings["PRIVATE_HEADERS_FOLDER_PATH"] readonly property string publicHeadersFolderPath: bundleSettingsProbe.xcodeSettings["PUBLIC_HEADERS_FOLDER_PATH"] readonly property string scriptsFolderPath: bundleSettingsProbe.xcodeSettings["SCRIPTS_FOLDER_PATH"] readonly property string sharedFrameworksFolderPath: bundleSettingsProbe.xcodeSettings["SHARED_FRAMEWORKS_FOLDER_PATH"] readonly property string sharedSupportFolderPath: bundleSettingsProbe.xcodeSettings["SHARED_SUPPORT_FOLDER_PATH"] readonly property string unlocalizedResourcesFolderPath: bundleSettingsProbe.xcodeSettings["UNLOCALIZED_RESOURCES_FOLDER_PATH"] readonly property string versionsFolderPath: bundleSettingsProbe.xcodeSettings["VERSIONS_FOLDER_PATH"] property bool useBuiltinXcodeBuildSpecs: !_useXcodeBuildSpecs // true to use ONLY the qbs build specs // private properties property string _productTypeIdentifier: Bundle.productTypeIdentifier(product.type) property stringList _productTypeIdentifierChain: bundleSettingsProbe.productTypeIdentifierChain readonly property path _developerPath: xcode.developerPath readonly property path _platformInfoPlist: xcode.platformInfoPlist readonly property path _sdkSettingsPlist: xcode.sdkSettingsPlist readonly property path _toolchainInfoPlist: xcode.toolchainInfoPlist property bool _useXcodeBuildSpecs: true // TODO: remove in 1.25 property var extraEnv: ({ "PRODUCT_BUNDLE_IDENTIFIER": identifier }) readonly property var qmakeEnv: { return { "BUNDLEIDENTIFIER": identifier, "EXECUTABLE": product.targetName, "FULL_VERSION": product.version || "1.0", // CFBundleVersion "ICON": product.targetName, // ### QBS-73 "LIBRARY": product.targetName, "SHORT_VERSION": product.version || "1.0", // CFBundleShortVersionString "TYPEINFO": signature // CFBundleSignature }; } readonly property var defaultInfoPlist: { return { CFBundleDevelopmentRegion: "en", // default localization CFBundleDisplayName: product.targetName, // localizable CFBundleExecutable: product.targetName, CFBundleIdentifier: identifier, CFBundleInfoDictionaryVersion: "6.0", CFBundleName: product.targetName, // short display name of the bundle, localizable CFBundlePackageType: packageType, CFBundleShortVersionString: product.version || "1.0", // "release" version number, localizable CFBundleSignature: signature, // legacy creator code in Mac OS Classic, can be ignored CFBundleVersion: product.version || "1.0.0" // build version number, must be 3 octets }; } validate: { if (!qbs.targetOS.includes("darwin")) return; if (!bundleSettingsProbe.found) { var error = "Bundle product type " + _productTypeIdentifier + " is not supported."; if ((_productTypeIdentifier || "").startsWith("com.apple.product-type.")) error += " You may need to upgrade Xcode."; throw error; } var validator = new ModUtils.PropertyValidator("bundle"); validator.setRequiredProperty("bundleName", bundleName); validator.setRequiredProperty("infoPlistPath", infoPlistPath); validator.setRequiredProperty("pbdevelopmentPlistPath", pbdevelopmentPlistPath); validator.setRequiredProperty("pkgInfoPath", pkgInfoPath); validator.setRequiredProperty("versionPlistPath", versionPlistPath); validator.setRequiredProperty("executablePath", executablePath); validator.setRequiredProperty("contentsFolderPath", contentsFolderPath); validator.setRequiredProperty("documentationFolderPath", documentationFolderPath); validator.setRequiredProperty("executableFolderPath", executableFolderPath); validator.setRequiredProperty("executablesFolderPath", executablesFolderPath); validator.setRequiredProperty("frameworksFolderPath", frameworksFolderPath); validator.setRequiredProperty("javaFolderPath", javaFolderPath); validator.setRequiredProperty("localizedResourcesFolderPath", localizedResourcesFolderPath); validator.setRequiredProperty("pluginsFolderPath", pluginsFolderPath); validator.setRequiredProperty("privateHeadersFolderPath", privateHeadersFolderPath); validator.setRequiredProperty("publicHeadersFolderPath", publicHeadersFolderPath); validator.setRequiredProperty("scriptsFolderPath", scriptsFolderPath); validator.setRequiredProperty("sharedFrameworksFolderPath", sharedFrameworksFolderPath); validator.setRequiredProperty("sharedSupportFolderPath", sharedSupportFolderPath); validator.setRequiredProperty("unlocalizedResourcesFolderPath", unlocalizedResourcesFolderPath); if (packageType === "FMWK") { validator.setRequiredProperty("frameworkVersion", frameworkVersion); validator.setRequiredProperty("versionsFolderPath", versionsFolderPath); } // extension and infoStringsPath might not be set return validator.validate(); } FileTagger { fileTags: ["infoplist"] patterns: ["Info.plist", "*-Info.plist"] } Rule { condition: qbs.targetOS.includes("darwin") multiplex: true requiresInputs: false // TODO: The resources property should probably be a tag instead. inputs: ["infoplist", "partial_infoplist"] outputFileTags: ["bundle.input", "aggregate_infoplist"] outputArtifacts: Bundle.aggregateInfoPlistOutputs(product) prepare: Bundle.aggregateInfoPlistCommands.apply(Bundle, arguments) } Rule { condition: qbs.targetOS.includes("darwin") multiplex: true inputs: ["aggregate_infoplist"] outputFileTags: ["bundle.input", "pkginfo"] outputArtifacts: Bundle.generatePkgInfoOutputs(product) prepare: Bundle.generatePkgInfoCommands.apply(Bundle, arguments) } Rule { condition: qbs.targetOS.includes("darwin") multiplex: true inputs: ["bundle.input", "aggregate_infoplist", "pkginfo", "hpp", "icns", "codesign.xcent", "compiled_ibdoc", "compiled_assetcatalog", "codesign.embedded_provisioningprofile", "bundle.input.privacymanifest", "bundle.input.public_hpp", "bundle.input.private_hpp", "bundle.input.resources"] // Make sure the inputs of this rule are only those rules which produce outputs compatible // with the type of the bundle being produced. excludedInputs: Bundle.excludedAuxiliaryInputs(project, product) // We need to wait for the main bundle inputs to be copied before signing explicitlyDependsOn: ["bundle.content.copied.from.dependencies"] outputFileTags: [ "bundle.content", "bundle.main.input", "bundle.main.application", "bundle.main.framework", "bundle.main.plugin", "bundle.symlink.headers", "bundle.symlink.private-headers", "bundle.symlink.resources", "bundle.symlink.executable", "bundle.symlink.version", "bundle.hpp", "bundle.resource", "bundle.provisioningprofile", "bundle.content.copied", "bundle.application-executable", "bundle.code-signature", "bundle.privacymanifest"] outputArtifacts: Bundle.generateBundleOutputs(product, inputs) prepare: Bundle.generateBundleCommands.apply(Bundle, arguments) } Rule { condition: qbs.targetOS.includes("darwin") multiplex: true requiresInputs: false inputsFromDependencies: ["bundle.main.input"] outputFileTags: ["bundle.content", "bundle.content.copied.from.dependencies"] outputArtifacts: Bundle.generateMainBundleOutputs(product, inputs) prepare: Bundle.generateMainBundleCommands.apply(Bundle, arguments) } Parameter { property bool isForMainBundle: true } } qbs-src-3.2.0/share/qbs/modules/bundle/MacOSX-Package-Types.xcspec0000644000175100017510000005047115154533055024255 0ustar runnerrunner/** MacOSX Package Types.xcspec Copyright (c) 1999-2015 Apple Inc. All rights reserved. Package type specifications in the Mac OS X platform. */ ( // Mach-O executable { Type = PackageType; Identifier = com.apple.package-type.mach-o-executable; Name = "Mach-O Executable"; Description = "Mach-O executable"; DefaultBuildSettings = { EXECUTABLE_PREFIX = ""; EXECUTABLE_SUFFIX = ""; EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; }; ProductReference = { FileType = compiled.mach-o.executable; Name = "$(EXECUTABLE_NAME)"; IsLaunchable = YES; }; }, // Mach-O object file { Type = PackageType; Identifier = com.apple.package-type.mach-o-objfile; Name = "Mach-O Object File"; Description = "Mach-O Object File"; DefaultBuildSettings = { EXECUTABLE_PREFIX = ""; EXECUTABLE_SUFFIX = ""; EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; }; ProductReference = { FileType = compiled.mach-o.objfile; Name = "$(EXECUTABLE_NAME)"; IsLaunchable = NO; }; }, // Mach-O dynamic library { Type = PackageType; Identifier = com.apple.package-type.mach-o-dylib; Name = "Mach-O Dynamic Library"; Description = "Mach-O dynamic library"; DefaultBuildSettings = { EXECUTABLE_PREFIX = ""; EXECUTABLE_SUFFIX = ""; EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; }; ProductReference = { FileType = compiled.mach-o.dylib; Name = "$(EXECUTABLE_NAME)"; IsLaunchable = NO; }; }, // Static library ('ar' archive containing .o files) { Type = PackageType; Identifier = com.apple.package-type.static-library; Name = "Mach-O Static Library"; Description = "Mach-O static library"; DefaultBuildSettings = { EXECUTABLE_PREFIX = "lib"; EXECUTABLE_SUFFIX = ".a"; EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; }; ProductReference = { FileType = archive.ar; Name = "$(EXECUTABLE_NAME)"; IsLaunchable = NO; }; }, // Mach-O bundle (not related to a CFBundle) { Type = PackageType; Identifier = com.apple.package-type.mach-o-bundle; Name = "Mach-O Loadable"; Description = "Mach-O loadable"; DefaultBuildSettings = { EXECUTABLE_PREFIX = ""; EXECUTABLE_SUFFIX = ".dylib"; EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; }; ProductReference = { FileType = compiled.mach-o.bundle; Name = "$(EXECUTABLE_NAME)"; IsLaunchable = NO; }; }, // CFBundle wrapper { Type = PackageType; Identifier = com.apple.package-type.wrapper; Name = "Wrapper"; Description = "Wrapper"; DefaultBuildSettings = { PRODUCT_BUNDLE_PACKAGE_TYPE = "BNDL"; WRAPPER_PREFIX = ""; WRAPPER_SUFFIX = ".bundle"; WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)"; CONTENTS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH_SHALLOW_BUNDLE_$(SHALLOW_BUNDLE))"; EXECUTABLE_PREFIX = ""; EXECUTABLE_SUFFIX = ""; EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; EXECUTABLE_FOLDER_PATH = "$(EXECUTABLE_FOLDER_PATH_SHALLOW_BUNDLE_$(SHALLOW_BUNDLE))"; EXECUTABLE_PATH = "$(EXECUTABLE_FOLDER_PATH)/$(EXECUTABLE_NAME)"; INFOPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/Info.plist"; INFOSTRINGS_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/InfoPlist.strings"; PKGINFO_PATH = "$(CONTENTS_FOLDER_PATH)/PkgInfo"; PBDEVELOPMENTPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/pbdevelopment.plist"; VERSIONPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/version.plist"; PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers"; PRIVATE_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PrivateHeaders"; EXECUTABLES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Executables"; // Not the same as EXECUTABLE_FOLDER_PATH FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Frameworks"; SHARED_FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedFrameworks"; SHARED_SUPPORT_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedSupport"; UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH_SHALLOW_BUNDLE_$(SHALLOW_BUNDLE))"; LOCALIZED_RESOURCES_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(DEVELOPMENT_LANGUAGE).lproj"; DOCUMENTATION_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/Documentation"; MODULES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Modules"; PLUGINS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PlugIns"; SCRIPTS_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Scripts"; JAVA_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Java"; SYSTEM_EXTENSIONS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Library/SystemExtensions"; // Settings specific to deep bundles (macOS) CONTENTS_FOLDER_PATH_SHALLOW_BUNDLE_NO = "$(WRAPPER_NAME)/Contents"; EXECUTABLE_FOLDER_PATH_SHALLOW_BUNDLE_NO = "$(CONTENTS_FOLDER_PATH)/MacOS"; UNLOCALIZED_RESOURCES_FOLDER_PATH_SHALLOW_BUNDLE_NO = "$(CONTENTS_FOLDER_PATH)/Resources"; // Settings specific to shallow bundles (iOS, DriverKit on any OS) CONTENTS_FOLDER_PATH_SHALLOW_BUNDLE_YES = "$(WRAPPER_NAME)"; EXECUTABLE_FOLDER_PATH_SHALLOW_BUNDLE_YES = "$(CONTENTS_FOLDER_PATH)"; UNLOCALIZED_RESOURCES_FOLDER_PATH_SHALLOW_BUNDLE_YES = "$(CONTENTS_FOLDER_PATH)"; // DriverKit should always use shallow bundles SHALLOW_BUNDLE = "$(SHALLOW_BUNDLE_$(SWIFT_PLATFORM_TARGET_PREFIX))"; SHALLOW_BUNDLE_ = YES; SHALLOW_BUNDLE_macos = NO; SHALLOW_BUNDLE_ios = NO; // for macCatalyst SHALLOW_BUNDLE_driverkit = YES; }; ProductReference = { FileType = wrapper.cfbundle; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // Shallow CFBundle wrapper { Type = PackageType; Identifier = com.apple.package-type.wrapper.shallow; BasedOn = com.apple.package-type.wrapper; Name = "Wrapper (Shallow)"; Description = "Shallow Wrapper"; DefaultBuildSettings = { SHALLOW_BUNDLE = YES; }; ProductReference = { FileType = wrapper.cfbundle; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // Application wrapper { Type = PackageType; Identifier = com.apple.package-type.wrapper.application; BasedOn = com.apple.package-type.wrapper; Name = "Application Wrapper"; Description = "Application Wrapper"; DefaultBuildSettings = { PRODUCT_BUNDLE_PACKAGE_TYPE = "APPL"; GENERATE_PKGINFO_FILE = YES; }; ProductReference = { FileType = wrapper.application; Name = "$(WRAPPER_NAME)"; IsLaunchable = YES; }; }, // Shallow Application wrapper { Type = PackageType; Identifier = com.apple.package-type.wrapper.application.shallow; BasedOn = com.apple.package-type.wrapper.shallow; Name = "Application Wrapper (Shallow)"; Description = "Shallow Application Wrapper"; DefaultBuildSettings = { PRODUCT_BUNDLE_PACKAGE_TYPE = "APPL"; GENERATE_PKGINFO_FILE = YES; SHALLOW_BUNDLE = YES; }; ProductReference = { FileType = wrapper.application; Name = "$(WRAPPER_NAME)"; IsLaunchable = YES; }; }, // System extension wrapper { Type = PackageType; Identifier = com.apple.package-type.wrapper.system-extension; BasedOn = com.apple.package-type.wrapper; Name = "System Extension Wrapper"; Description = "System Extension Wrapper"; DefaultBuildSettings = { PRODUCT_BUNDLE_PACKAGE_TYPE = "SYSX"; }; ProductReference = { FileType = wrapper.system-extension; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // Driver extension wrapper { Type = PackageType; Identifier = com.apple.package-type.wrapper.driver-extension; BasedOn = com.apple.package-type.wrapper.system-extension; Name = "Driver Extension Wrapper"; Description = "Driver Extension Wrapper"; DefaultBuildSettings = { PRODUCT_BUNDLE_PACKAGE_TYPE = "DEXT"; }; ProductReference = { FileType = wrapper.driver-extension; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // Kernel extension wrapper { Type = PackageType; Identifier = com.apple.package-type.wrapper.kernel-extension; BasedOn = com.apple.package-type.wrapper; Name = "Kernel Extension Wrapper"; Description = "Kernel Extension Wrapper"; DefaultBuildSettings = { PRODUCT_BUNDLE_PACKAGE_TYPE = "KEXT"; PUBLIC_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/Headers/$(KEXT_FAMILY_NAME)"; PRIVATE_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/PrivateHeaders/$(KEXT_FAMILY_NAME)"; }; ProductReference = { FileType = wrapper.cfbundle; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // Shallow Kernel extension wrapper { Type = PackageType; Identifier = com.apple.package-type.wrapper.kernel-extension.shallow; BasedOn = com.apple.package-type.wrapper.shallow; Name = "Kernel Extension Wrapper (Shallow)"; Description = "Shallow Kernel Extension Wrapper"; DefaultBuildSettings = { PRODUCT_BUNDLE_PACKAGE_TYPE = "KEXT"; PUBLIC_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/Headers/$(KEXT_FAMILY_NAME)"; PRIVATE_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/PrivateHeaders/$(KEXT_FAMILY_NAME)"; SHALLOW_BUNDLE = YES; }; ProductReference = { FileType = wrapper.cfbundle; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // Framework wrapper { Type = PackageType; Identifier = com.apple.package-type.wrapper.framework; BasedOn = com.apple.package-type.wrapper; Name = "Framework Wrapper"; Description = "Framework wrapper"; DefaultBuildSettings = { PRODUCT_BUNDLE_PACKAGE_TYPE = "FMWK"; WRAPPER_SUFFIX = ".framework"; VERSIONS_FOLDER_PATH = "$(VERSIONS_FOLDER_PATH_SHALLOW_BUNDLE_$(SHALLOW_BUNDLE))"; CURRENT_VERSION = "Current"; INFOPLIST_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Info.plist"; PKGINFO_PATH = "$(WRAPPER_NAME)/PkgInfo"; VERSIONPLIST_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/version.plist"; EXECUTABLES_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)"; // Not the same as EXECUTABLE_FOLDER_PATH SHARED_SUPPORT_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)"; CODESIGNING_FOLDER_PATH = "$(TARGET_BUILD_DIR)/$(CONTENTS_FOLDER_PATH)"; // Settings specific to deep bundles (macOS) VERSIONS_FOLDER_PATH_SHALLOW_BUNDLE_NO = "$(WRAPPER_NAME)/Versions"; CONTENTS_FOLDER_PATH_SHALLOW_BUNDLE_NO = "$(VERSIONS_FOLDER_PATH)/$(FRAMEWORK_VERSION)"; EXECUTABLE_FOLDER_PATH_SHALLOW_BUNDLE_NO = "$(CONTENTS_FOLDER_PATH)"; // Settings specific to shallow bundles (iOS, DriverKit on any OS) VERSIONS_FOLDER_PATH_SHALLOW_BUNDLE_YES = "$(WRAPPER_NAME)"; }; ProductReference = { FileType = wrapper.framework; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // Static framework wrapper (like a framework, except that it contains a libX.a instead of a dylib) { Type = PackageType; Identifier = com.apple.package-type.wrapper.framework.static; Name = "Mach-O Static Framework"; Description = "Mach-O static framework"; BasedOn = com.apple.package-type.wrapper.framework; DefaultBuildSettings = { }; ProductReference = { FileType = wrapper.framework.static; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // Shallow Framework Package { Type = PackageType; Identifier = com.apple.package-type.wrapper.framework.shallow; Name = "Shallow Framework Wrapper"; Description = "Shallow framework wrapper"; BasedOn = com.apple.package-type.wrapper.framework; DefaultBuildSettings = { SHALLOW_BUNDLE = YES; }; ProductReference = { FileType = wrapper.framework; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // Unit Test Bundle wrapper { Type = PackageType; Identifier = com.apple.package-type.bundle.unit-test; BasedOn = com.apple.package-type.wrapper; Name = "Unit Test Bundle"; Description = "Unit Test Bundle"; DefaultBuildSettings = { WRAPPER_SUFFIX = "xctest"; }; ProductReference = { FileType = wrapper.cfbundle; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // Legacy OCUnit Test Bundle wrapper { Type = PackageType; Identifier = com.apple.package-type.bundle.ocunit-test; BasedOn = com.apple.package-type.wrapper; Name = "OCUnit Test Bundle"; Description = "OCUnit Test Bundle"; DefaultBuildSettings = { WRAPPER_SUFFIX = "octest"; }; ProductReference = { FileType = wrapper.cfbundle; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // In-app Purchase Content wrapper { Type = PackageType; Identifier = com.apple.package-type.in-app-purchase-content; BasedOn = com.apple.package-type.wrapper; Name = "In-App Purchase Content"; Description = "In-App Purchase Content"; DefaultBuildSettings = { PRODUCT_BUNDLE_PACKAGE_TYPE = ""; WRAPPER_SUFFIX = ""; EXECUTABLE_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)"; INFOPLIST_PATH = "$(WRAPPER_NAME)/ContentInfo.plist"; INFOSTRINGS_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/ContentInfo.strings"; PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)"; PRIVATE_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)"; EXECUTABLES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)"; FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)"; SHARED_FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)"; SHARED_SUPPORT_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)"; UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)"; LOCALIZED_RESOURCES_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(DEVELOPMENT_LANGUAGE).lproj"; DOCUMENTATION_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)"; MODULES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)"; PLUGINS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)"; SCRIPTS_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)"; JAVA_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)"; }; ProductReference = { FileType = folder; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // XPC Service wrapper { Type = PackageType; Identifier = com.apple.package-type.xpc-service; BasedOn = com.apple.package-type.wrapper; Name = "XPC Service"; Description = "XPC Service"; DefaultBuildSettings = { PRODUCT_BUNDLE_PACKAGE_TYPE = "XPC!"; WRAPPER_SUFFIX = ".xpc"; }; ProductReference = { FileType = wrapper.xpc-service; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // PlugInKit PlugIn wrapper { Type = PackageType; Identifier = com.apple.package-type.pluginkit-plugin; BasedOn = com.apple.package-type.xpc-service; Name = "PlugInKit PlugIn"; Description = "PlugInKit PlugIn"; DefaultBuildSettings = { WRAPPER_SUFFIX = ".pluginkit"; }; ProductReference = { FileType = wrapper.app-extension; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // App Extension wrapper { Type = PackageType; Identifier = com.apple.package-type.app-extension; BasedOn = com.apple.package-type.pluginkit-plugin; Name = "App Extension"; Description = "App Extension"; DefaultBuildSettings = { WRAPPER_SUFFIX = ".appex"; }; ProductReference = { FileType = wrapper.app-extension; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // Spotlight Importer wrapper { Type = PackageType; Identifier = com.apple.package-type.spotlight-importer; BasedOn = com.apple.package-type.wrapper; Name = "Spotlight Importer"; Description = "Spotlight Importer"; DefaultBuildSettings = { }; ProductReference = { FileType = wrapper.spotlight-importer; Name = "$(WRAPPER_NAME)"; IsLaunchable = NO; }; }, // Jar file { Type = PackageType; Identifier = com.apple.package-type.jarfile; Name = "Jar File"; Description = "Jar file"; DefaultBuildSettings = { EXECUTABLE_PREFIX = ""; EXECUTABLE_SUFFIX = ".jar"; EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_SUFFIX)"; EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; JAVA_ARCHIVE_CLASSES = YES; JAVA_MAKE_ZIPFILE = NO; }; ProductReference = { FileType = archive.jar; Name = "$(EXECUTABLE_NAME)"; IsLaunchable = NO; }; }, // Zip file { Type = PackageType; Identifier = com.apple.package-type.zipfile; Name = "Zip File"; Description = "Zip file"; DefaultBuildSettings = { EXECUTABLE_PREFIX = ""; EXECUTABLE_SUFFIX = ".zip"; EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_SUFFIX)"; EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; JAVA_ARCHIVE_CLASSES = YES; JAVA_MAKE_ZIPFILE = YES; }; ProductReference = { FileType = archive.zip; Name = "$(EXECUTABLE_NAME)"; IsLaunchable = NO; }; }, // Java class folder { Type = PackageType; Identifier = com.apple.package-type.javaclassfolder; Name = "Class Folder"; Description = "Class folder"; DefaultBuildSettings = { EXECUTABLE_PREFIX = ""; EXECUTABLE_SUFFIX = ""; EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_SUFFIX)"; EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; JAVA_ARCHIVE_CLASSES = NO; }; ProductReference = { FileType = wrapper.java-classfolder; Name = "$(EXECUTABLE_NAME)"; IsLaunchable = NO; }; }, ) qbs-src-3.2.0/share/qbs/modules/texttemplate/0000755000175100017510000000000015154533055020561 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/texttemplate/texttemplate.qbs0000644000175100017510000000571415154533055024017 0ustar runnerrunnerimport qbs.TextFile Module { property string placeholder: "${}" PropertyOptions { name: "placeholder" description: "The placeholder string to use for text template files." allowedValues: ["${}", "@@"] } property var dict: ({}) property string outputTag: "text" property string outputFileName FileTagger { patterns: ["*.in"] fileTags: ["texttemplate.input"] } Rule { inputs: ["texttemplate.input"] outputFileTags: [product.texttemplate.outputTag] outputArtifacts: [ { fileTags: [product.texttemplate.outputTag], filePath: input.texttemplate.outputFileName || input.completeBaseName } ] prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { try { var src = new TextFile(input.filePath, TextFile.ReadOnly); var dst = new TextFile(output.filePath, TextFile.WriteOnly); const isDefaultPlaceholder = input.texttemplate.placeholder === "${}"; var rex = isDefaultPlaceholder ? /\${(\$|\w+)}/g : /@(\@|\w+)@/g; var match; while (!src.atEof()) { rex.lastIndex = 0; var line = src.readLine(); var matches = []; while (match = rex.exec(line)) matches.push(match); for (var i = matches.length; --i >= 0;) { match = matches[i]; var replacement; if (isDefaultPlaceholder && match[1] === "$") { replacement = "$"; } else if (!isDefaultPlaceholder && match[1] === "@") { replacement = "@"; } else { replacement = input.texttemplate.dict[match[1]]; if (typeof replacement === "undefined") { throw new Error("Placeholder '" + match[1] + "' is not defined in textemplate.dict for '" + input.fileName + "'."); } } line = line.substr(0, match.index) + replacement + line.substr(match.index + match[0].length); } dst.writeLine(line); } } finally { if (src) src.close(); if (dst) dst.close(); } }; return [cmd]; } } } qbs-src-3.2.0/share/qbs/modules/capnproto/0000755000175100017510000000000015154533055020046 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/capnproto/cpp/0000755000175100017510000000000015154533055020630 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/capnproto/cpp/capnprotocpp.qbs0000644000175100017510000000502615154533055024052 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import "../capnprotobase.qbs" as CapnProtoBase import "../capnproto.js" as HelperFunctions CapnProtoBase { property bool useRpc: false Depends { name: "cpp" } Depends { name: "capnp" } Depends { name: "capnp-rpc"; condition: useRpc } pluginName: "capnpc-c++" version: capnp.version _searchPaths: capnp.hostBinDirs cpp.systemIncludePaths: outputDir cpp.cxxLanguageVersion: "c++14" Rule { inputs: ["capnproto.input"] outputFileTags: ["hpp", "cpp"] outputArtifacts: { var outputDir = HelperFunctions.getOutputDir(input.capnproto.cpp, input); var result = [ HelperFunctions.artifact(outputDir, input, "hpp", ".capnp.h"), HelperFunctions.artifact(outputDir, input, "cpp", ".capnp.c++") ]; return result; } prepare: { var result = HelperFunctions.doPrepare( input.capnproto.cpp, product, input, outputs, "cpp"); return result; } } } qbs-src-3.2.0/share/qbs/modules/capnproto/capnproto.js0000644000175100017510000000725215154533055022417 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var Utilities = require("qbs.Utilities"); function validateCompiler(name, path) { if (!File.exists(path)) throw "Cannot find executable '" + name + "'. Please set the compilerPath " + "property or make sure the compiler is found in PATH"; } function validatePlugin(name, path) { if (!name) throw "pluginName is not set"; if (!File.exists(path)) throw "Cannot find plugin '" + name + "'. Please set the pluginPath " + "property or make sure the plugin is found in PATH"; } function getOutputDir(module, input) { var outputDir = module.outputDir; var importPaths = module.importPaths; if (importPaths.length !== 0) { var canonicalInput = File.canonicalFilePath(FileInfo.path(input.filePath)); for (var i = 0; i < importPaths.length; ++i) { var path = File.canonicalFilePath(importPaths[i]); if (canonicalInput.startsWith(path)) { return outputDir + "/" + FileInfo.relativePath(path, canonicalInput); } } } return outputDir; } function artifact(outputDir, input, tag, suffix) { return { fileTags: [tag], filePath: FileInfo.joinPaths(outputDir, FileInfo.baseName(input.fileName) + suffix), cpp: { includePaths: [].concat(input.cpp.includePaths, outputDir), warningLevel: "none", } }; } function doPrepare(module, product, input, outputs, lang) { var outputDir = FileInfo.path(outputs["cpp"][0].filePath); var args = []; args.push("--output=" + module.pluginPath + ":" + outputDir); args.push("--src-prefix=" + FileInfo.path(input.filePath)); var importPaths = module.importPaths; importPaths.forEach(function(path) { if (!FileInfo.isAbsolutePath(path)) path = FileInfo.joinPaths(product.sourceDirectory, path); args.push("--import-path", path); }); args.push(input.filePath); var cmd = new Command(module.compilerPath, args); cmd.highlight = "codegen"; cmd.description = "generating " + lang + " files for " + input.fileName; return [cmd]; } qbs-src-3.2.0/share/qbs/modules/capnproto/capnprotobase.qbs0000644000175100017510000000464515154533055023426 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ import qbs.FileInfo import qbs.Probes import "capnproto.js" as HelperFunctions Module { property string compilerName: "capnpc" property string compilerPath: compilerProbe.filePath property string pluginName property string pluginPath: pluginProbe.filePath property pathList importPaths: [] property string outputDir: product.buildDirectory + "/capnp" property var _searchPaths Probes.BinaryProbe { id: compilerProbe names: compilerName ? [compilerName] : [] searchPaths: _searchPaths } Probes.BinaryProbe { id: pluginProbe names: pluginName ? [pluginName] : [] searchPaths: _searchPaths } FileTagger { patterns: ["*.capnp"] fileTags: ["capnproto.input"]; } validate: { HelperFunctions.validateCompiler(compilerName, compilerPath); HelperFunctions.validatePlugin(pluginName, pluginPath); } } qbs-src-3.2.0/share/qbs/modules/cpufeatures/0000755000175100017510000000000015154533055020367 5ustar runnerrunnerqbs-src-3.2.0/share/qbs/modules/cpufeatures/cpufeatures.qbs0000644000175100017510000000116015154533055023422 0ustar runnerrunnerModule { property bool arm_neon property bool arm_vfpv4 property bool mips_dsp property bool mips_dspr2 property bool x86_avx property bool x86_avx2 property bool x86_avx512bw property bool x86_avx512cd property bool x86_avx512dq property bool x86_avx512er property bool x86_avx512f property bool x86_avx512ifma property bool x86_avx512pf property bool x86_avx512vbmi property bool x86_avx512vl property bool x86_f16c property bool x86_sse2 property bool x86_sse3 property bool x86_sse4_1 property bool x86_sse4_2 property bool x86_ssse3 } qbs-src-3.2.0/share/CMakeLists.txt0000644000175100017510000000712615154533055016352 0ustar runnerrunnerif(WIN32) install( FILES ../bin/ibmsvc.xml ../bin/ibqbs.bat DESTINATION "${QBS_APP_INSTALL_DIR}" ) endif() # below we copy some files that are required to run qbs from the build directory # emulating the same layout we will have after the installation # copy & install python packages set(_SITE_PACKAGES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../src/3rdparty/python/lib/python3.9/site-packages/) file(GLOB_RECURSE _SITE_PACKAGES_RELATIVE RELATIVE "${_SITE_PACKAGES_DIR}" "${_SITE_PACKAGES_DIR}/*.py") set(_SITE_PACKAGES_SRC ${_SITE_PACKAGES_RELATIVE}) list_transform_prepend(_SITE_PACKAGES_SRC "${_SITE_PACKAGES_DIR}/") set(_SITE_PACKAGES_DST ${_SITE_PACKAGES_RELATIVE}) list_transform_prepend(_SITE_PACKAGES_DST "${CMAKE_BINARY_DIR}/${QBS_OUTPUT_PREFIX}${QBS_RESOURCES_INSTALL_DIR}/qbs/python/") add_custom_command( OUTPUT ${_SITE_PACKAGES_DST} DEPENDS ${_SITE_PACKAGES_SRC} COMMAND ${CMAKE_COMMAND} -E copy_directory "${_SITE_PACKAGES_DIR}" ${CMAKE_BINARY_DIR}/${QBS_OUTPUT_PREFIX}${QBS_RESOURCES_INSTALL_DIR}/qbs/python COMMENT "Copying Python packages" ) install( # trailing slash avoid copying the 'site-packages' dir and only copies its content DIRECTORY "${_SITE_PACKAGES_DIR}" DESTINATION "${QBS_RESOURCES_INSTALL_DIR}/qbs/python" FILES_MATCHING PATTERN "*.py" ) # copy & install the "share/qbs" dir file(GLOB_RECURSE _QBS_RESOURCES_RELATIVE RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/qbs/*") set(_QBS_RESOURCES_SRC ${_QBS_RESOURCES_RELATIVE}) list_transform_prepend(_QBS_RESOURCES_SRC "${CMAKE_CURRENT_SOURCE_DIR}/") set(_QBS_RESOURCES_DST ${_QBS_RESOURCES_RELATIVE}) list_transform_prepend(_QBS_RESOURCES_DST "${CMAKE_BINARY_DIR}/${QBS_OUTPUT_PREFIX}${QBS_RESOURCES_INSTALL_DIR}/") add_custom_command( OUTPUT ${_QBS_RESOURCES_DST} DEPENDS ${_QBS_RESOURCES_SRC} COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/qbs ${CMAKE_BINARY_DIR}/${QBS_OUTPUT_PREFIX}${QBS_RESOURCES_INSTALL_DIR}/qbs COMMENT "Copying QBS resources" ) install( DIRECTORY qbs DESTINATION "${QBS_RESOURCES_INSTALL_DIR}" PATTERN ".gitignore" EXCLUDE ) # install examples dir install( DIRECTORY ../examples DESTINATION "${QBS_RESOURCES_INSTALL_DIR}/qbs" ) set(_QMLTYPES_INSTALL_PATH "${PROJECT_BINARY_DIR}/resources-build/install-root/share/qbs/qml-type-descriptions/qbs.qmltypes") get_update_path_command(UPDATE_PATH_COMMAND) get_target_property(_QBS_OUTPUT_DIR qbs RUNTIME_OUTPUT_DIRECTORY) add_custom_command( OUTPUT "${_QMLTYPES_INSTALL_PATH}" COMMAND ${CMAKE_COMMAND} -E env "${UPDATE_PATH_COMMAND}" ${_QBS_OUTPUT_DIR}/qbs resolve --settings-dir ${PROJECT_BINARY_DIR}/settings -f ${PROJECT_SOURCE_DIR}/qbs.qbs -d ${PROJECT_BINARY_DIR}/ config:resources-build qbs.installPrefix:"" project.withCode:false project.withDocumentation:false profile:none COMMAND ${CMAKE_COMMAND} -E env "${UPDATE_PATH_COMMAND}" ${_QBS_OUTPUT_DIR}/qbs build --settings-dir ${PROJECT_BINARY_DIR}/settings -f ${PROJECT_SOURCE_DIR}/qbs.qbs -d ${PROJECT_BINARY_DIR}/ config:resources-build -p "qbs resources" DEPENDS qbs "${_QBS_RESOURCES_DST}" qbs_processlauncher ) add_custom_target( BuildQbsResources ALL DEPENDS ${_SITE_PACKAGES_DST} ${_QBS_RESOURCES_DST} "${_QMLTYPES_INSTALL_PATH}" ) install( DIRECTORY ${PROJECT_BINARY_DIR}/resources-build/install-root/share/qbs/qml-type-descriptions DESTINATION "${QBS_RESOURCES_INSTALL_DIR}/qbs" ) qbs-src-3.2.0/share/share.qbs0000644000175100017510000001103115154533055015411 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.TextFile import qbs.Utilities Product { name: "qbs resources" type: ["qbs qml type descriptions", "qbs qml type bundle"] Depends { name: "qbsbuildconfig" } Group { name: "Incredibuild" prefix: "../bin/" files: ["ibmsvc.xml", "ibqbs.bat"] fileTags: [] qbs.install: qbs.targetOS.contains("windows") qbs.installDir: qbsbuildconfig.appInstallDir } Group { name: "CMake" files: "CMakeLists.txt" } Group { name: "Python packages" prefix: "../src/3rdparty/python/**/" files: ["*.py"] fileTags: ["qbs resources"] qbs.install: true qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share/qbs/python" qbs.installSourceBase: "../src/3rdparty/python/lib/python3.9/site-packages" } Group { name: "Imports" files: ["qbs/imports/qbs/**/*"] fileTags: ["qbs resources"] qbs.install: true qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share" qbs.installSourceBase: "." } Group { name: "Modules" files: ["qbs/modules/**/*"] fileTags: ["qbs resources"] qbs.install: true qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share" qbs.installSourceBase: "." } Group { name: "Module providers" files: ["qbs/module-providers/*", "qbs/module-providers/**/*"] fileTags: ["qbs resources"] qbs.install: true qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share" qbs.installSourceBase: "." } Group { name: "Examples as resources" files: ["../examples/**/*"] fileTags: [] qbs.install: true qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share/qbs" qbs.installSourceBase: ".." } Rule { condition: Utilities.versionCompare(product.qbs.version, "1.9.1") >= 0 multiplex: true Artifact { filePath: "qbs.qmltypes" fileTags: ["qbs qml type descriptions"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.highlight = "codegen"; cmd.sourceCode = function() { var tf; try { tf = new TextFile(output.filePath, TextFile.WriteOnly); tf.writeLine(Utilities.qmlTypeInfo()); } finally { if (tf) tf.close(); } }; return cmd; } } Rule { condition: Utilities.versionCompare(product.qbs.version, "1.9.1") >= 0 multiplex: true Artifact { filePath: "qbs-bundle.json" fileTags: ["qbs qml type bundle"] } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.highlight = "codegen"; cmd.sourceCode = function() { var tf; try { var imports = File.directoryEntries(FileInfo.joinPaths(product.sourceDirectory, "qbs", "imports", "qbs"), File.Dirs | File.NoDotAndDotDot).filter( function(i) { return i !== "base"; }).concat( Utilities.builtinExtensionNames()).map( function(i) { return "qbs." + i; }); imports.sort(); var obj = { "name": "qbs", "searchPaths": ["$(QBS_IMPORT_PATH)"], "installPaths": ["$(QBS_IMPORT_PATH)"], "implicitImports": ["__javascriptQt5__"], "supportedImports": ["qbs"].concat(imports) }; tf = new TextFile(output.filePath, TextFile.WriteOnly); tf.writeLine(JSON.stringify(obj, undefined, 4)); } finally { if (tf) tf.close(); } }; return cmd; } } Group { name: "QML Type Info" fileTagsFilter: ["qbs qml type descriptions", "qbs qml type bundle"] qbs.install: true qbs.installDir: qbsbuildconfig.qmlTypeDescriptionsInstallDir } } qbs-src-3.2.0/.dockerignore0000644000175100017510000000002715154533055015155 0ustar runnerrunner* !docker/* !scripts/* qbs-src-3.2.0/CONTRIBUTING.md0000644000175100017510000000741115154533055014736 0ustar runnerrunner# Contributing to Qbs The main source code repository is hosted at [codereview.qt-project.org](https://codereview.qt-project.org/q/project:qbs/qbs). The Qbs source code is also mirrored on [code.qt.io](https://code.qt.io/cgit/qbs/qbs.git/) and on [GitHub](https://github.com/qbs/qbs). Please note that those mirrors are read-only and we do not accept pull-requests on GitHub. However, we gladly accept contributions via [Gerrit](https://codereview.qt-project.org/q/project:qbs/qbs). This document briefly describes steps required to be able to propose changes to the Qbs project. See the [Qt Contribution Guidelines](https://wiki.qt.io/Qt_Contribution_Guidelines) page, [Setting up Gerrit](https://wiki.qt.io/Setting_up_Gerrit) and [Gerrit Introduction](https://wiki.qt.io/Gerrit_Introduction) for more details about how to upload patches to Gerrit. ## Preparations * [Set up](https://wiki.qt.io/Setting_up_Gerrit#How_to_get_started_-_Gerrit_registration) a Gerrit account * Tweak your SSH config as instructed [here](https://wiki.qt.io/Setting_up_Gerrit#Local_Setup) * Use the recommended Git settings, defined [here](https://wiki.qt.io/Setting_up_Gerrit#Configuring_Git) * Get the source code as described below ## Cloning Qbs Clone Qbs from the [code.qt.io](https://code.qt.io/cgit/qbs/qbs.git/) mirror ``` git clone git://code.qt.io/qbs/qbs.git ``` Alternatively, you can clone from the mirror on the [GitHub](https://github.com/qbs/qbs) ``` git clone https://github.com/qbs/qbs.git ``` Set up the Gerrit remote ``` git remote add gerrit ssh://@codereview.qt-project.org:29418/qbs/qbs ``` ## Setting up git hooks Install the hook generating Commit-Id files into your top level project directory: ``` gitdir=$(git rev-parse --git-dir); scp -p -P 29418 codereview.qt-project.org:hooks/commit-msg "${gitdir}/hooks/" ``` This hook automatically adds a "Change-Id: …" line to the commit message. Change-Id is used to identify new Patch Sets for existing [Changes](https://wiki.qt.io/Gerrit_Introduction#Terminology). ## Making changes Commit your changes in the usual way you do in Git. After making changes, you might want to ensure that Qbs can be built and autotests pass: ``` qbs build -p autotest-runner ``` See ["Appendix A: Building Qbs"](http://doc.qt.io/qbs/building-qbs.html) for details. In case your changes might significantly affect performance (in either way), the 'qbs_benchmarker' tool can be used (Linux only, requires Valgrind to be installed): ``` qbs_benchmarker -r -o -n -a -p ``` Use 'qbs_benchmarker --help' for details. ## Pushing your changes to Gerrit After committing your changes locally, push them to Gerrit ``` git push gerrit HEAD:refs/for/master ``` Gerrit will print a URL that can be used to access the newly created Change. ## Adding reviewers Use the "ADD REVIEWER" button on the Change's web page to ask people to do the review. To find possible reviewers, you can examine the Git history with 'git log' and/or 'git blame' or ask on the mailing list: qbs@qt-project.org ## Modifying Commits During the review process, it might be necessary to do some changes to the commit. To include you changes in the last commit, use ``` git commit --amend ``` This will edit the last commit instead of creating a new one. Make sure to preserve the Change-Id footer when amending commits. For details, see [Updating a Contribution With New Code](https://wiki.qt.io/Gerrit_Introduction#Updating_a_Contribution_With_New_Code) ## Abandoning changes Changes which are inherently flawed or became inapplicable should be abandoned. You can do that on the Change's web page with the "ABANDON" button. Make sure to remove the abandoned commit from your working copy by using '[git reset](https://git-scm.com/docs/git-reset)'. qbs-src-3.2.0/CMakeLists.txt0000644000175100017510000000425615154533055015251 0ustar runnerrunnercmake_minimum_required(VERSION 3.10) if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.15") cmake_policy(VERSION 3.15) endif() ## Add paths to check for cmake modules: list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(FeatureSummary) include(QbsBuildConfig) include(QbsDocumentation) file(STRINGS VERSION QBS_VERSION) project(Qbs VERSION ${QBS_VERSION}) # Force C++ standard, do not fall back, do not use compiler extensions set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Set up Qt stuff: set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) if(WITH_TESTS) enable_testing() set(QT_TEST_COMPONENT Test) set(IMPLICIT_DEPENDS Qt${QT_VERSION_MAJOR}::Test) endif() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Concurrent Core Gui Network Widgets Xml ${QT_TEST_COMPONENT} REQUIRED ) find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Script QUIET) if (Qt6_FOUND) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat REQUIRED) if(NOT TARGET Qt6Core5Compat) if(CMAKE_VERSION VERSION_LESS 3.18) set_property(TARGET Qt6::Core5Compat PROPERTY IMPORTED_GLOBAL TRUE) # hack for CMake < 3.18 endif() add_library(Qt6Core5Compat ALIAS Qt6::Core5Compat) endif() if (Qt6Core_VERSION VERSION_GREATER_EQUAL 6.9.0) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS CorePrivate REQUIRED) endif() else() if(NOT TARGET Qt6Core5Compat) add_library(Qt6Core5Compat INTERFACE) endif() find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DocTools) endif() if (QBS_INSTALL_HTML_DOCS OR QBS_INSTALL_QCH_DOCS) find_package(Python3 COMPONENTS Interpreter) if (Qt6_FOUND) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Tools REQUIRED) else() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Help REQUIRED) endif() endif() add_definitions(-DQT_NO_QSNPRINTF -D_UCRT_NOISY_NAN) add_subdirectory(src) add_subdirectory(doc) add_subdirectory(share) if(WITH_TESTS) add_subdirectory(tests) endif() qbs-src-3.2.0/qbs.qbs0000644000175100017510000000212615154533055013777 0ustar runnerrunnerProject { minimumQbsVersion: "1.6" qbsSearchPaths: ["qbs-resources"] property bool withCode: true property bool withDocumentation: true property bool withTests: withCode property stringList autotestArguments: [] property stringList autotestWrapper: [] references: [ "docker/docker.qbs", "examples/examples.qbs", "share/share.qbs", "scripts/scripts.qbs", "tutorial/tutorial.qbs", ] SubProject { filePath: "doc/doc.qbs" Properties { condition: parent.withDocumentation } } SubProject { filePath: "src/src.qbs" Properties { condition: parent.withCode } } SubProject { filePath: "tests/tests.qbs" Properties { condition: parent.withTests } } Product { name: "version" files: ["VERSION"] } Product { name: "continuous integration files" files: [ ".clang-tidy", "docker-compose.yml", ".github/**/*.yml", ] } } qbs-src-3.2.0/RELEASE.md0000644000175100017510000000670515154533055014114 0ustar runnerrunner# Release Instructions This file contains instructions how to publish a Qbs release into various package systems. ## Building packages Release packages are built automatically by the [Build release packages](https://github.com/qbs/qbs/actions/workflows/release.yml) job on GitHub actions. The job builds every commit, so you'll need to find a specific run triggered by pushing a git tag instead of a commit. The only interesting artifact is qbs-release-v1.x.y - it contains Windows binary packages as well as source packages. Packages should then be uploaded to the [Qt Website](https://download.qt.io/official_releases/qbs/). ## Chocolatey For updating Qbs in [Chocolatey](https://community.chocolatey.org/packages/qbs), you'll need to be a maintainer of the Qbs project. You'll also will need an API key from your [account](https://community.chocolatey.org/account) (make sure you have one). Get the qbs.1.x.y.nupkg file from the qbs-release-v1.x.y.zip archive and run the following command: ``` choco push --api-key qbs.1.x.y.nupkg" ``` Choco will upload the file, download binary packages from the Qt Website and publish Qbs automatically. ## Homebrew First, you'll need to [install](https://docs.brew.sh/Installation) Homewbrew. Second, you'll need to fork the [homebrew-core](https://github.com/Homebrew/homebrew-core) repo to you GitHub account. Next you'll need to add your remote to the existing repo: ``` $ brew update $ cd "$(brew --repository homebrew/core)" $ git remote add github git@github.com:/homebrew-core.git # Create a new git branch for your formula so your pull request is easy to # modify if any changes come up during review. $ git checkout -b origin/master ``` You'll need a SHA-256 sum for the qbs-src-1.x.y.tar.gz source package. SHA-256 sum can be found in the sha256sums.txt file from the qbs-release-v1.x.y.zip. Check if the same upgrade has been already submitted by searching the open pull requests for [Qbs](https://github.com/Homebrew/homebrew-core/pulls?q=is%3Apr+is%3Aopen+qbs). Run the following command, replacing the version and SHA-256 sum: ``` $ brew bump-formula-pr --strict qbs \ --url https://download.qt.io/official_releases/qbs/1.x.y/qbs-src-1.x.y.tar.gz \ --sha256= ``` The above can also be done manually by editing the formula source code and creating a pull request. Some useful commands to build/test formula locally: ``` $ brew install --build-from-source qbs $ brew test qbs $ brew audit --strict qbs ``` ## Mac Ports Fork [macports-ports](https://github.com/macports/macports-ports) to your GitHub account and clone the repo. Run the following command in the repo dir (must be done only once): ``` $ sudo /opt/local/bin/portindex ``` Make sure that /opt/local/etc/macports/sources.conf contains a line like file:///Users/abbapoh/dev/macports-ports [default] pointing to your local repo. Get the qbs-src-1.x.y.tar.gz source package from the archive or from the [Qt Website](https://download.qt.io/official_releases/qbs/) and make note of the file size: ``` $ ls -l qbs-src-1.x.y.tar.gz ``` Get checksums: ``` $ openssl sha256 qbs-src-1.x.y.tar.gz $ openssl rmd160 qbs-src-1.x.y.tar.gz ``` Update the devel/qbs/Portfile file with the new url, filesize and checksums. Build the package: ``` $ /opt/local/bin/port lint qbs $ sudo /opt/local/bin/port -vst install qbs $ /opt/local/bin/qbs --version # Check that this reports the right version ``` Commit. Push. Create merge request. qbs-src-3.2.0/.github/0000755000175100017510000000000015154533055014042 5ustar runnerrunnerqbs-src-3.2.0/.github/actions/0000755000175100017510000000000015154533055015502 5ustar runnerrunnerqbs-src-3.2.0/.github/actions/download-qt/0000755000175100017510000000000015154533055017733 5ustar runnerrunnerqbs-src-3.2.0/.github/actions/download-qt/action.yml0000644000175100017510000000126215154533055021734 0ustar runnerrunnername: 'Download Qt' description: 'Downloads Qt' inputs: version: description: 'Qt version' required: false default: '6.8.3' target: description: 'Qt target (desktop, ios, android)' required: false default: 'desktop' toolchain: description: 'Qt toolchain' required: true runs: using: "composite" steps: - name: Install Qt run: | QT_DIR=$(./scripts/install-qt.sh -d $HOME/Qt --version ${{ inputs.version }} --target ${{ inputs.target }} --toolchain ${{ inputs.toolchain }} qtbase qtdeclarative qttools qtscxml qt5compat qtshadertools) (cygpath -w ${QT_DIR} 2>/dev/null || echo ${QT_DIR}) >> ${GITHUB_PATH} shell: bash qbs-src-3.2.0/.github/actions/download-qbs/0000755000175100017510000000000015154533055020074 5ustar runnerrunnerqbs-src-3.2.0/.github/actions/download-qbs/action.yml0000644000175100017510000000063115154533055022074 0ustar runnerrunnername: 'Download Qbs' description: 'Downloads Qbs' inputs: version: description: 'Qbs version' required: false default: '2.5.0' runs: using: "composite" steps: - name: Install Qt Creator run: | QBS_DIR=$(./scripts/install-qbs.sh -d $HOME/qbs --version ${{ inputs.version }}) (cygpath -w ${QBS_DIR} 2>/dev/null || echo ${QBS_DIR}) >> ${GITHUB_PATH} shell: bash qbs-src-3.2.0/.github/actions/download-qtc/0000755000175100017510000000000015154533055020076 5ustar runnerrunnerqbs-src-3.2.0/.github/actions/download-qtc/action.yml0000644000175100017510000000066715154533055022107 0ustar runnerrunnername: 'Download Qt Creator' description: 'Downloads Qt Creator' inputs: version: description: 'Qt Creator version' required: false default: '11.0.3' runs: using: "composite" steps: - name: Install Qt Creator run: | QTC_DIR=$(./scripts/install-qt.sh -d $HOME/Qt --version ${{ inputs.version }} qtcreator) (cygpath -w ${QTC_DIR} 2>/dev/null || echo ${QTC_DIR}) >> ${GITHUB_PATH} shell: bash qbs-src-3.2.0/.github/actions/download-dm/0000755000175100017510000000000015154533055017707 5ustar runnerrunnerqbs-src-3.2.0/.github/actions/download-dm/action.yml0000644000175100017510000000065415154533055021714 0ustar runnerrunnername: 'Download DigitalMars' description: 'Downloads DigitalMars' inputs: version: description: 'DigitalMars version' required: false default: '8.57' runs: using: "composite" steps: - name: Install DigitalMars run: | DM_DIR=$(./scripts/install-dm.sh -d $HOME/dm --version ${{ inputs.version }}) (cygpath -w ${DM_DIR} 2>/dev/null || echo ${DM_DIR}) >> ${GITHUB_PATH} shell: bash qbs-src-3.2.0/.github/actions/download-mingw/0000755000175100017510000000000015154533055020430 5ustar runnerrunnerqbs-src-3.2.0/.github/actions/download-mingw/action.yml0000644000175100017510000000104115154533055022424 0ustar runnerrunnername: 'Download MinGW' description: 'Downloads MinGW' inputs: version: description: 'MinGW version' required: false default: '9.0.0' toolchain: description: 'Toolchain' required: false default: 'win64_mingw' runs: using: "composite" steps: - name: Install MinGW run: | MINGW_DIR=$(./scripts/install-qt.sh -d $HOME/Qt --version ${{ inputs.version }} --toolchain ${{ inputs.toolchain }} mingw) (cygpath -w ${MINGW_DIR} 2>/dev/null || echo ${MINGW_DIR}) >> ${GITHUB_PATH} shell: bash qbs-src-3.2.0/.github/actions/download-ow/0000755000175100017510000000000015154533055017734 5ustar runnerrunnerqbs-src-3.2.0/.github/actions/download-ow/action.yml0000644000175100017510000000065315154533055021740 0ustar runnerrunnername: 'Download OpenWatcom' description: 'Downloads OpenWatcom' inputs: version: description: 'OpenWatcom version' required: false default: '2.0' runs: using: "composite" steps: - name: Install OpenWatcom run: | OW_DIR=$(./scripts/install-ow.sh -d $HOME/watcom --version ${{ inputs.version }}) (cygpath -w ${OW_DIR} 2>/dev/null || echo ${OW_DIR}) >> ${GITHUB_PATH} shell: bash qbs-src-3.2.0/.github/workflows/0000755000175100017510000000000015154533055016077 5ustar runnerrunnerqbs-src-3.2.0/.github/workflows/docs.yml0000644000175100017510000000163615154533055017560 0ustar runnerrunnername: Build and Qbs docs on: push: paths: - 'doc/**' - 'examples/**' - 'scripts/build-qbs-doc.sh' - 'VERSION' jobs: build-docs: name: ${{ matrix.config.name }} runs-on: ubuntu-latest timeout-minutes: 60 strategy: fail-fast: false matrix: config: - { name: 'Build Qbs Docs', options: '', script: './scripts/build-qbs-doc.sh' } env: BUILD_OPTIONS: ${{ matrix.config.options }} WITH_TESTS: 0 steps: - uses: actions/checkout@v1 - name: Pull the Docker Image run: docker compose pull noble - name: Build Qbs Docs run: docker compose run noble ${{ matrix.config.script }} - name: Upload artifacts uses: 'actions/upload-artifact@v4' with: name: qbs-docs-${{ github.run_id }} path: documentation/install-root/usr/local/share/doc/qbs/ qbs-src-3.2.0/.github/workflows/release.yml0000644000175100017510000002436615154533055020255 0ustar runnerrunnername: Build release packages on: push: branches-ignore: - 'gerrit/*' tags: - 'v*' jobs: build-linux: name: ${{ matrix.config.name }} runs-on: ubuntu-latest timeout-minutes: 60 strategy: fail-fast: false matrix: config: - { name: 'Build on Linux (gcc)', options: 'qbs.installPrefix:"" modules.cpp.compilerWrapper:ccache modules.qbsbuildconfig.enableAddressSanitizer:false project.withTests:false modules.qbsbuildconfig.enableUnitTests:false products.qbs_archive.targetName:qbs-linux-${{ github.run_id }}', script: './scripts/build-qbs-with-qbs.sh', cacheid: 'gcc-release', } env: BUILD_OPTIONS: ${{ matrix.config.options }} WITH_TESTS: 0 steps: - uses: actions/checkout@v1 - name: Create .ccache dir run: mkdir -p ~/.ccache - name: prepare timestamp id: get-timestamp run: echo "timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT shell: bash - name: ccache cache files uses: actions/cache@v4 with: path: ~/.ccache key: ${{ runner.os }}-${{ matrix.config.cacheid }}-ccache-${{ steps.get-timestamp.outputs.timestamp }} restore-keys: ${{ runner.os }}-${{ matrix.config.cacheid }}-ccache - name: Pull the Docker Image run: docker compose pull noble-qt6 - name: Print ccache stats run: docker compose run noble-qt6 ccache -s - name: Build Qbs run: docker compose run noble-qt6 ${{ matrix.config.script }} - name: Print ccache stats run: docker compose run noble-qt6 ccache -s - name: Get archive name id: get-archive-name run: echo "archive-name=$(git describe)" >> $GITHUB_OUTPUT - name: Upload artifacts uses: 'actions/upload-artifact@v4' with: name: qbs-linux-${{ github.run_id }}.tar.gz path: release/qbs-linux-${{ github.run_id }}.tar.gz build-macos: name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.runner }} timeout-minutes: 60 strategy: fail-fast: false matrix: config: - { name: 'Build on macOS (arm64)', runner: 'macos-14', profile: 'xcode_15_1-macosx-arm64', toolchain: 'clang_64', options: 'qbs.installPrefix:"" modules.cpp.compilerWrapper:ccache project.withTests:false modules.qbsbuildconfig.enableUnitTests:false modules.qbsbuildconfig.enableAddressSanitizer:false products.qbs_archive.targetName:qbs-macos-arm64-${{ github.run_id }}', suffix: 'macos-arm64', } - { name: 'Build on macOS (x86_64)', runner: 'macos-14', profile: 'xcode_15_1-macosx-x86_64', toolchain: 'clang_64', options: 'qbs.installPrefix:"" modules.cpp.compilerWrapper:ccache project.withTests:false modules.qbsbuildconfig.enableUnitTests:false modules.qbsbuildconfig.enableAddressSanitizer:false products.qbs_archive.targetName:qbs-macos-x86_64-${{ github.run_id }}', suffix: 'macos-x86_64', } env: BUILD_OPTIONS: ${{ matrix.config.options }} WITH_TESTS: 0 steps: - uses: actions/checkout@v1 - name: Create .ccache dir run: mkdir -p ~/.ccache - name: prepare timestamp id: get-timestamp run: echo "timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT shell: bash - name: ccache cache files uses: actions/cache@v4 with: path: ~/.ccache key: ${{ runner.os }}-release-ccache-${{ steps.get-timestamp.outputs.timestamp }} restore-keys: ${{ runner.os }}-release-ccache - name: Install required packages run: brew install ccache - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.13' - name: Install Python dependencies run: | python -m pip install --upgrade pip pip install beautifulsoup4 lxml - name: Install Qt uses: ./.github/actions/download-qt with: toolchain: ${{ matrix.config.toolchain }} - name: Install Qt Creator uses: ./.github/actions/download-qtc - name: Setup Qbs run: | qbs setup-toolchains --detect qbs setup-qt --detect qbs config profiles.qt.baseProfile ${{ matrix.config.profile }} qbs config defaultProfile qt qbs config --list - name: Print ccache stats run: ccache -s - name: Build Qbs run: scripts/build-qbs-with-qbs.sh - name: Print ccache stats run: ccache -s - name: Upload artifacts uses: 'actions/upload-artifact@v4' with: name: qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz path: release/qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz build-windows-with-docker: name: Build on Windows (Docker) runs-on: windows-2022 timeout-minutes: 60 env: WITH_TESTS: 0 QT_ASSUME_STDERR_HAS_CONSOLE: 1 steps: - uses: actions/checkout@v1 - name: Create .ccache dir run: mkdir -p ~/.ccache shell: bash - name: Pull the Windows Image run: docker compose pull windows - name: Build Qbs run: > docker compose run --rm windows qbs build -p dist qbs.buildVariant:release project.withTests:false modules.qbsbuildconfig.enableBundledQt:true modules.qbsbuildconfig.enableUnitTests:false modules.cpp.treatWarningsAsErrors:true project.withDocumentation:true config:release profile:qt64 - name: Get archive name id: get-archive-name run: echo "archive-name=$(git describe)" >> $GITHUB_OUTPUT - name: Upload artifacts uses: 'actions/upload-artifact@v4' with: name: qbs-windows-${{ github.run_id }} path: | release/qbs.*.nupkg release/qbs-windows-*.zip create-archives: name: Create Archives runs-on: ubuntu-latest needs: [build-macos, build-linux, build-windows-with-docker] steps: - uses: actions/checkout@v1 with: submodules: true - name: Get version name id: get-version-name run: echo "version-name=$(cat VERSION)" >> $GITHUB_OUTPUT - name: Create directories run: | mkdir release mkdir tmp - name: Copy sources run: rsync -av --exclude='.git/' --exclude='tmp/' . ./tmp/qbs-src-${{ steps.get-version-name.outputs.version-name }} - name: Zip Archive run: | cd tmp/ zip -r ../release/qbs-src-${{ steps.get-version-name.outputs.version-name }}.zip qbs-src-${{ steps.get-version-name.outputs.version-name }} - name: Tarball Archive run: | cd tmp/ tar czf ../release/qbs-src-${{ steps.get-version-name.outputs.version-name }}.tar.gz qbs-src-${{ steps.get-version-name.outputs.version-name }} - name: Download Linux artifacts uses: actions/download-artifact@v4 with: name: qbs-linux-${{ github.run_id }}.tar.gz path: ./tmp - name: Repack Linux artifact run: | mkdir -p tmp/qbs-linux-x86_64-${{ steps.get-version-name.outputs.version-name }} tar xzf ./tmp/qbs-linux-${{ github.run_id }}.tar.gz -C tmp/qbs-linux-x86_64-${{ steps.get-version-name.outputs.version-name }} cd tmp/ tar czf ../release/qbs-linux-x86_64-${{ steps.get-version-name.outputs.version-name }}.tar.gz qbs-linux-x86_64-${{ steps.get-version-name.outputs.version-name }} - name: Download Windows artifacts uses: actions/download-artifact@v4 with: name: qbs-windows-${{ github.run_id }} path: ./tmp/release - name: Copy Windows artifacts run: | cp ./tmp/release/qbs.*.nupkg ./release cp ./tmp/release/qbs-windows-x86_64-*.zip ./release - name: Download macOS arm64 artifacts uses: actions/download-artifact@v4 with: name: qbs-macos-arm64-${{ github.run_id }}.tar.gz path: ./tmp/ - name: Repack Macos arm64 artifact run: | mkdir -p tmp/qbs-macos-arm64-${{ steps.get-version-name.outputs.version-name }} tar xzf ./tmp/qbs-macos-arm64-${{ github.run_id }}.tar.gz -C tmp/qbs-macos-arm64-${{ steps.get-version-name.outputs.version-name }} cd tmp/ tar czf ../release/qbs-macos-arm64-${{ steps.get-version-name.outputs.version-name }}.tar.gz qbs-macos-arm64-${{ steps.get-version-name.outputs.version-name }} - name: Download macOS x86_64 artifacts uses: actions/download-artifact@v4 with: name: qbs-macos-x86_64-${{ github.run_id }}.tar.gz path: ./tmp - name: Repack Macos x86_64 artifact run: | mkdir -p tmp/qbs-macos-x86_64-${{ steps.get-version-name.outputs.version-name }} tar xzf ./tmp/qbs-macos-x86_64-${{ github.run_id }}.tar.gz -C tmp/qbs-macos-x86_64-${{ steps.get-version-name.outputs.version-name }} cd tmp/ tar czf ../release/qbs-macos-x86_64-${{ steps.get-version-name.outputs.version-name }}.tar.gz qbs-macos-x86_64-${{ steps.get-version-name.outputs.version-name }} - name: Copy changelog run: cp changelogs/changes-${{ steps.get-version-name.outputs.version-name }}.md release || echo "changelog not found" - name: Generate checksums run: | cd release/ find . -type f -printf '%f\n' | grep -v .txt | xargs md5sum > md5sums.txt find . -type f -printf '%f\n' | grep -v .txt | xargs sha256sum > sha256sums.txt - name: Get archive name id: get-archive-name run: echo "archive-name=$(git describe)" >> $GITHUB_OUTPUT - name: Upload artifacts uses: 'actions/upload-artifact@v4' with: name: qbs-release-${{ steps.get-archive-name.outputs.archive-name }} path: | release/qbs-src-*.zip release/qbs-src-*.tar.gz release/qbs-linux-*.tar.gz release/qbs-macos-*.tar.gz release/qbs.*.nupkg release/qbs-windows-x86_64-*.zip release/changes-*.md release/md5sums.txt release/sha256sums.txt qbs-src-3.2.0/.github/workflows/main.yml0000644000175100017510000010045215154533055017550 0ustar runnerrunnername: Build and test Qbs on: push: paths-ignore: - 'changelogs/**' - 'doc/**' jobs: build-linux: name: ${{ matrix.config.name }} runs-on: ubuntu-latest timeout-minutes: 60 strategy: fail-fast: false matrix: config: - { name: 'Build on Linux (Noble, gcc)', image: 'noble-qt6', options: 'modules.cpp.compilerWrapper:ccache modules.qbs.debugInformation:true products.qbs_archive.targetName:qbs-linux-noble-${{ github.run_id }} products.qbs_archive.includeTests:true', script: './scripts/build-qbs-with-qbs.sh', cacheid: 'gcc-qt6-noble', suffix: 'linux-noble', } env: BUILD_OPTIONS: ${{ matrix.config.options }} WITH_TESTS: 0 steps: - uses: actions/checkout@v1 - name: Create .ccache dir run: mkdir -p ~/.ccache - name: prepare timestamp id: get-timestamp run: echo "timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT shell: bash - name: ccache cache files uses: actions/cache@v4 with: path: ~/.ccache key: ${{ runner.os }}-${{ matrix.config.cacheid }}-ccache-${{ steps.get-timestamp.outputs.timestamp }} restore-keys: ${{ runner.os }}-${{ matrix.config.cacheid }}-ccache - name: Pull the Docker Image run: docker compose pull ${{ matrix.config.image }} - name: Print ccache stats run: docker compose run ${{ matrix.config.image }} ccache -s - name: Build Qbs run: docker compose run ${{ matrix.config.image }} ${{ matrix.config.script }} - name: Print ccache stats run: docker compose run ${{ matrix.config.image }} ccache -s - name: Upload artifacts uses: 'actions/upload-artifact@v4' with: name: qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz path: release/qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz build-linux-extra: name: ${{ matrix.config.name }} runs-on: ubuntu-latest timeout-minutes: 90 strategy: fail-fast: false matrix: config: - { name: 'Build on Linux (clang_tidy)', script: './scripts/run-analyzer.sh', image: 'noble-qt6', options: 'profile:qt-clang_64 modules.cpp.compilerWrapper:ccache', cacheid: 'clang', } - { name: 'Build on Linux (CMake)', script: './scripts/build-qbs-with-cmake.sh', image: 'noble-qt6', cacheid: 'cmake', } - { name: 'Build on Linux (gcc, ASAN)', image: 'noble-qt6', script: './scripts/build-qbs-with-qbs.sh', options: 'modules.cpp.compilerWrapper:ccache modules.qbsbuildconfig.enableAddressSanitizer:true modules.qbs.debugInformation:true', cacheid: 'gcc-asan', } - { name: 'Build on Linux (gcc, UBSAN)', image: 'noble-qt6', script: './scripts/build-qbs-with-qbs.sh', options: 'modules.cpp.compilerWrapper:ccache modules.qbsbuildconfig.enableUbSanitizer:true modules.qbs.debugInformation:true', cacheid: 'gcc-ubsan', } - { name: 'Build on Linux (gcc, Qt 5.15)', image: 'noble-qt5', script: './scripts/build-qbs-with-qbs.sh', options: 'modules.cpp.compilerWrapper:ccache modules.qbs.debugInformation:true', cacheid: 'gcc-qt5', } env: BUILD_OPTIONS: ${{ matrix.config.options }} QTEST_FUNCTION_TIMEOUT: 9000000 steps: - uses: actions/checkout@v1 - name: Create .ccache dir run: mkdir -p ~/.ccache - name: prepare timestamp id: get-timestamp run: echo "timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT shell: bash - name: ccache cache files uses: actions/cache@v4 with: path: ~/.ccache key: ${{ runner.os }}-${{ matrix.config.cacheid }}-ccache-${{ steps.get-timestamp.outputs.timestamp }} restore-keys: ${{ runner.os }}-${{ matrix.config.cacheid }}-ccache - name: Setup Coredumps run: | sudo bash -c 'echo "/cores/core.%e.%t.%p" > /proc/sys/kernel/core_pattern' sudo mkdir /cores sudo chmod 777 /cores - name: Pull the Docker Image run: docker compose pull ${{ matrix.config.image }} - name: Print ccache stats run: docker compose run ${{ matrix.config.image }} ccache -s - name: Build Qbs run: docker compose run ${{ matrix.config.image }} ${{ matrix.config.script }} - name: Print ccache stats run: docker compose run ${{ matrix.config.image }} ccache -s - name: Coredump on failure if: ${{ failure() }} run: docker compose run ${{ matrix.config.image }} ./scripts/print-cores.sh clang-format: name: Check Style runs-on: macos-15 timeout-minutes: 60 strategy: fail-fast: false steps: - uses: actions/checkout@v1 - name: Update PATH run: echo "$(brew --prefix llvm@18)/bin" >> ${GITHUB_PATH} - name: Run clang-format run: | git diff -U0 --no-color --relative HEAD^ | $(brew --prefix llvm@18)/share/clang/clang-format-diff.py -i -p1 -regex ".*\.(cxx|cpp|hpp|h)" -v - name: Check diff run: git diff --exit-code build-macos: name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.runner }} timeout-minutes: 60 strategy: fail-fast: false matrix: config: - { name: 'Build on macOS (Qbs, arm64)', runner: 'macos-14', profile: 'xcode_15_1-macosx-arm64', toolchain: 'clang_64', script: './scripts/build-qbs-with-qbs.sh', options: 'modules.cpp.compilerWrapper:ccache modules.qbs.debugInformation:true modules.qbsbuildconfig.enableAddressSanitizer:false products.qbs_archive.targetName:qbs-macos-arm64-${{ github.run_id }} products.qbs_archive.includeTests:true', cacheid: 'clang-arm64', with_tests: 0, suffix: 'macos-arm64', } - { name: 'Build on macOS (Qbs, x64)', runner: 'macos-14', profile: 'xcode_15_1-macosx-x86_64', toolchain: 'clang_64', script: './scripts/build-qbs-with-qbs.sh', options: 'modules.cpp.compilerWrapper:ccache modules.qbs.debugInformation:true modules.qbsbuildconfig.enableAddressSanitizer:false products.qbs_archive.targetName:qbs-macos-${{ github.run_id }} products.qbs_archive.includeTests:true', cacheid: 'clang', with_tests: 0, suffix: 'macos', } - { name: 'Build on macOS (CMake, x64)', runner: 'macos-15-intel', profile: 'xcode_16_4-macosx-x86_64', toolchain: 'clang_64', script: './scripts/build-qbs-with-cmake.sh', options: '', cacheid: 'clang-cmake', with_tests: 0, suffix: 'macos', } env: BUILD_OPTIONS: ${{ matrix.config.options }} WITH_TESTS: ${{ matrix.config.with_tests }} steps: - uses: actions/checkout@v1 - name: Create .ccache dir run: mkdir -p ~/.ccache - name: prepare timestamp id: get-timestamp run: echo "timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT shell: bash - name: ccache cache files uses: actions/cache@v4 with: path: ~/.ccache key: ${{ runner.os }}-${{ matrix.config.cacheid }}-ccache-${{ steps.get-timestamp.outputs.timestamp }} restore-keys: ${{ runner.os }}-${{ matrix.config.cacheid }}-ccache - name: Install required packages run: brew install ccache - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.13' - name: Install Python dependencies run: | python -m pip install --upgrade pip pip install beautifulsoup4 lxml - name: Install Qt uses: ./.github/actions/download-qt with: toolchain: ${{ matrix.config.toolchain }} - name: Install Qt Creator uses: ./.github/actions/download-qtc - name: Setup Qbs run: | qbs setup-toolchains --detect qbs setup-qt --detect qbs config profiles.qt.baseProfile ${{ matrix.config.profile }} qbs config defaultProfile qt qbs config --list - name: Print ccache stats run: ccache -s - name: Build Qbs run: ${{ matrix.config.script }} - name: Print ccache stats run: ccache -s - name: Upload artifacts uses: 'actions/upload-artifact@v4' if: matrix.config.cacheid != 'clang-cmake' with: name: qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz path: release/qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz build-windows: name: ${{ matrix.config.name }} runs-on: windows-2022 timeout-minutes: 60 strategy: fail-fast: false matrix: config: - { name: 'Build on Windows (Qbs)', script: './scripts/build-qbs-with-qbs.sh', options: 'modules.cpp.compilerWrapper:clcache modules.qbs.debugInformation:true modules.qbsbuildconfig.enableAddressSanitizer:false products.qbs_archive.targetName:qbs-windows-${{ github.run_id }} products.qbs_archive.includeTests:true', cacheid: 'msvc', with_tests: 0, suffix: 'windows', qmake: 'qmake.exe', } - { name: 'Build on Windows (CMake)', script: './scripts/build-qbs-with-cmake.sh', options: '', cacheid: 'msvc-cmake', with_tests: 0, suffix: 'windows-cmake', qmake: 'qmake.exe', } env: BUILD_OPTIONS: ${{ matrix.config.options }} WITH_TESTS: ${{ matrix.config.with_tests }} QT_ASSUME_STDERR_HAS_CONSOLE: 1 steps: - uses: actions/checkout@v1 - name: prepare timestamp id: get-timestamp run: echo "timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT shell: bash - name: clcache cache files uses: actions/cache@v4 with: path: ~/clcache key: ${{ runner.os }}-${{ matrix.config.cacheid }}-clcache-${{ steps.get-timestamp.outputs.timestamp }} restore-keys: ${{ runner.os }}-msvc-clcache - name: Set up Python uses: actions/setup-python@v5 with: python-version: 3.8 - name: Install required packages run: | python -m pip install --upgrade pip pip install beautifulsoup4 lxml pip install git+https://github.com/frerich/clcache.git@cae73d8255d78db8ba11e23c51fd2c9a89e7475b - name: Install Ninja run: choco install ninja shell: bash - name: Install Qt uses: ./.github/actions/download-qt with: toolchain: win64_msvc2022_64 - name: Install Qbs uses: ./.github/actions/download-qbs - name: Setup self-signed certificate run: | New-SelfSignedCertificate -DnsName qbs@community.test -Type CodeSigning -CertStoreLocation cert:\CurrentUser\My shell: powershell - uses: TheMrMilchmann/setup-msvc-dev@v3 with: arch: x64 - name: Test qmake run: | echo "$PATH" echo "qmake: ${{ matrix.config.qmake }}" echo "qmake: $(which ${{ matrix.config.qmake }})" echo "qmake\\path: $(where ${{ matrix.config.qmake }})" echo "qmake/path: $(cygpath $(where ${{ matrix.config.qmake }}))" shell: bash - name: Setup Qbs run: | qbs setup-toolchains --detect qbs setup-qt $(which qmake).exe qt qbs config profiles.qt.baseProfile MSVC2022-1-x86_x64 qbs config defaultProfile qt qbs config --list shell: bash - name: Print clcache stats run: clcache -s - name: Build Qbs run: ${{ matrix.config.script }} shell: bash - name: Print clcache stats run: clcache -s - name: Upload artifacts uses: 'actions/upload-artifact@v4' with: name: qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.zip path: release/qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.zip build-windows-mingw: name: Build on Windows (MinGW) runs-on: windows-2022 timeout-minutes: 60 env: BUILD_OPTIONS: | modules.cpp.compilerWrapper:ccache modules.qbsbuildconfig.enableAddressSanitizer:false products.qbs_archive.targetName:qbs-windows-mingw-${{ github.run_id }} products.qbs_archive.includeTests:true, QT_ASSUME_STDERR_HAS_CONSOLE: 1 WITH_TESTS: 0 CCACHE_DIR: ${{ github.workspace }}\ccache steps: - uses: actions/checkout@v1 - name: prepare timestamp id: get-timestamp run: echo "timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT shell: bash - name: ccache cache files uses: actions/cache@v4 with: path: ~/.ccache key: ${{ runner.os }}-mingw-ccache-${{ steps.get-timestamp.outputs.timestamp }} restore-keys: ${{ runner.os }}-mingw-ccache - name: Set up Python uses: actions/setup-python@v5 with: python-version: 3.8 - name: Install required packages run: | choco install ccache python -m pip install --upgrade pip pip install beautifulsoup4 lxml - name: Install Qt uses: ./.github/actions/download-qt with: toolchain: win64_mingw - name: Install Qbs uses: ./.github/actions/download-qbs - name: Install MinGW uses: ./.github/actions/download-mingw - name: Setup Qbs run: | qbs setup-toolchains --type mingw $(which g++).exe mingw-qt qbs setup-qt $(which qmake).exe qt qbs config profiles.qt.baseProfile mingw-qt qbs config defaultProfile qt qbs config --list shell: bash - name: Print ccache stats run: ccache -s - name: Build Qbs run: scripts/build-qbs-with-qbs.sh shell: bash - name: Print ccache stats run: ccache -s - name: Upload artifacts uses: 'actions/upload-artifact@v4' with: name: qbs-windows-mingw-${{ github.run_id }}.zip path: release/qbs-windows-mingw-${{ github.run_id }}.zip test-linux: name: ${{ matrix.config.name }} runs-on: ubuntu-latest timeout-minutes: 90 needs: build-linux strategy: fail-fast: false matrix: config: - { name: 'Test Linux (gcc, Qt 6)', image: 'noble-qt6', suffix: 'linux-noble', profile: 'qt-gcc_64', script: './scripts/test-qbs.sh', } - { name: 'Test Linux (clang, Qt 6)', image: 'noble-qt6', suffix: 'linux-noble', profile: 'qt-clang_64', script: './scripts/test-qbs.sh', } - { name: 'Test Linux (gcc, Qt 6, static)', image: 'noble-qt6-static', suffix: 'linux-noble', profile: 'qt-gcc_64', script: './scripts/test-qbs.sh', } - { name: 'Test Linux (gcc, Qt 5)', image: 'noble-qt5', suffix: 'linux-noble', profile: 'qt-gcc_64', script: './scripts/test-qt.sh', } - { name: 'Test Android (Qt 6.5)', image: 'noble-android-65', suffix: 'linux-noble', profile: '', script: './scripts/test-qt-for-android.sh', } - { name: 'Test Android (Qt 5.15)', image: 'noble-android-515', suffix: 'linux-noble', profile: '', script: './scripts/test-qt-for-android.sh', } - { name: 'Test Android (ndk r25)', image: 'noble-android-ndk-r25', suffix: 'linux-noble', profile: '', script: './scripts/test-for-android.sh', } - { name: 'Test WebAssembly', image: 'noble-qt6-wasm', suffix: 'linux-noble', profile: '', script: './scripts/test-wasm.sh', } env: QBS_TEST_SOURCE_ROOT: 'tests' QBS_AUTOTEST_PROFILE: ${{ matrix.config.profile }} QTEST_FUNCTION_TIMEOUT: 9000000 steps: - uses: actions/checkout@v1 - name: Download artifact uses: actions/download-artifact@v4 with: name: qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz path: ./ - name: Unpack artifact run: mkdir -p release/install-root/ && tar xzf qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz -C release/install-root/ - name: Setup Coredumps run: | sudo bash -c 'echo "/cores/core.%e.%t.%p" > /proc/sys/kernel/core_pattern' sudo mkdir /cores sudo chmod 777 /cores - name: Pull the Docker Image run: docker compose pull ${{ matrix.config.image }} - name: Run tests run: docker compose run ${{ matrix.config.image }} ${{ matrix.config.script }} release/install-root/usr/local/bin - name: Coredump on failure if: ${{ failure() }} run: docker compose run ${{ matrix.config.image }} ./scripts/print-cores.sh test-baremetal: name: Test Baremetal (Linux) runs-on: ubuntu-latest timeout-minutes: 60 needs: build-linux env: QBS_TEST_SOURCE_ROOT: 'tests' steps: - uses: actions/checkout@v1 - name: Download artifact uses: actions/download-artifact@v4 with: name: qbs-linux-noble-${{ github.run_id }}.tar.gz path: ./ - name: Unpack artifact run: mkdir -p release/install-root/ && tar xzf qbs-linux-noble-${{ github.run_id }}.tar.gz -C release/install-root/ - name: Pull the Docker Image run: docker compose pull noble-baremetal - name: arm-none-eabi-gcc-13_2 run: QBS_AUTOTEST_PROFILE=arm-none-eabi-gcc-13_2 docker compose run noble-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - name: avr-gcc-7_3 run: QBS_AUTOTEST_PROFILE=avr-gcc-7_3 docker compose run noble-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - name: riscv64-unknown-elf-gcc-13_2 run: QBS_AUTOTEST_PROFILE=riscv64-unknown-elf-gcc-13_2 docker compose run noble-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - name: sdcc-4_0_0-hcs8 run: QBS_AUTOTEST_PROFILE=sdcc-4_2_0-hcs8 docker compose run noble-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - name: sdcc-4_0_0-mcs51 run: QBS_AUTOTEST_PROFILE=sdcc-4_2_0-mcs51 docker compose run noble-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - name: sdcc-4_0_0-stm8 run: QBS_AUTOTEST_PROFILE=sdcc-4_2_0-stm8 docker compose run noble-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - name: xtensa-lx106-elf-gcc-13_2 run: QBS_AUTOTEST_PROFILE=xtensa-lx106-elf-gcc-13_2 docker compose run noble-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin test-macos: name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.runner }} timeout-minutes: 60 needs: build-macos env: QTEST_FUNCTION_TIMEOUT: 9000000 QBS_AUTOTEST_PROFILE: 'qt' QBS_TEST_SOURCE_ROOT: 'tests' QBS_EXTRA_GRPC_LIBS: 'absl_cord,absl_cordz_handle,absl_cordz_info,absl_synchronization,grpc,gpr' strategy: fail-fast: false matrix: config: - { name: 'Test macOS (Xcode 16.4, arm64)', runner: 'macos-15', target: 'desktop', toolchain: 'clang_64', xcodeVersion: '16.4', testProfile: 'xcode_16_4-macosx-arm64', qtVersion: '6.8.3', suffix: 'macos-arm64', script: './scripts/test-qbs.sh', } - { name: 'Test iOS (Xcode 16.4, arm64)', runner: 'macos-15', target: 'ios', toolchain: 'ios', xcodeVersion: '16.4', testProfile: 'xcode_16_4-iphoneos-arm64', qtVersion: '6.8.3', suffix: 'macos-arm64', script: './scripts/test-qbs.sh', } - { name: 'Test iOS-sim (Xcode 16.4, x64)', runner: 'macos-15', target: 'ios', toolchain: 'ios', xcodeVersion: '16.4', # Qt does not support arm64 simulators, # see https://bugreports.qt.io/browse/QTBUG-101276 testProfile: 'xcode_16_4-iphonesimulator-x86_64', qtVersion: '6.8.3', suffix: 'macos-arm64', script: './scripts/test-qbs.sh', } - { name: 'Test macOS (Xcode 16.4, x64)', runner: 'macos-15-intel', target: 'desktop', toolchain: 'clang_64', xcodeVersion: '16.4', testProfile: 'xcode_16_4-macosx-x86_64', qtVersion: '6.8.3', suffix: 'macos', script: './scripts/test-qbs.sh', } - { name: 'Test macOS (Xcode 16.4, Qt 5.15, x64)', runner: 'macos-15-intel', target: 'desktop', toolchain: 'clang_64', xcodeVersion: '16.4', testProfile: 'xcode_16_4-macosx-x86_64', qtVersion: '5.15.2', suffix: 'macos', script: './scripts/test-qt.sh', } - { name: 'Test macOS (Xcode 15.4, arm64)', runner: 'macos-14', target: 'desktop', toolchain: 'clang_64', xcodeVersion: '15.4', testProfile: 'xcode_15_4-macosx-arm64', qtVersion: '6.8.3', suffix: 'macos-arm64', script: './scripts/test-qbs.sh', } - { name: 'Test macOS (Xcode-less, arm64)', runner: 'macos-15', target: 'desktop', toolchain: 'clang_64', xcodeVersion: '', testProfile: 'clang', qtVersion: '6.8.3', suffix: 'macos-arm64', script: './scripts/test-qbs.sh', } steps: - uses: actions/checkout@v1 - name: Download artifact uses: actions/download-artifact@v4 with: name: qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz path: ./ - name: Unpack artifact run: mkdir -p release/install-root/ && tar xzf qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz -C release/install-root/ - name: Update PATH run: echo "./release/install-root/usr/local/bin" >> $GITHUB_PATH - name: Install required packages run: brew install capnp ccache grpc icoutils makensis protobuf - name: Set up Python uses: actions/setup-python@v5 if: matrix.config.toolchain == 'clang_64' with: python-version: 3.12 - name: Install Conan if: matrix.config.toolchain == 'clang_64' uses: turtlebrowser/get-conan@main - name: Setup Conan if: matrix.config.toolchain == 'clang_64' run: ./scripts/setup-conan-profiles.sh - name: Install Host Qt if: matrix.config.toolchain == 'ios' uses: ./.github/actions/download-qt with: target: 'desktop' toolchain: 'clang_64' version: ${{ matrix.config.qtVersion }} - name: Install Qt uses: ./.github/actions/download-qt with: target: ${{ matrix.config.target }} toolchain: ${{ matrix.config.toolchain }} version: ${{ matrix.config.qtVersion }} - name: Select Xcode run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.config.xcodeVersion }}.app if: matrix.config.xcodeVersion != '' - name: Setup Qbs run: | qbs setup-toolchains --detect qbs setup-qt $(which qmake) qt qbs config profiles.qt.baseProfile ${{ matrix.config.testProfile }} qbs config defaultProfile qt qbs config --list if: matrix.config.xcodeVersion != '' - name: Setup Qbs (Xcode-less) run: | qbs setup-toolchains $(brew --prefix llvm@18)/bin/clang ${{ matrix.config.testProfile }} qbs config profiles.${{ matrix.config.testProfile }}.qbs.architecture arm64 qbs setup-qt $(which qmake) qt qbs config profiles.qt.baseProfile ${{ matrix.config.testProfile }} qbs config defaultProfile qt qbs config --list if: matrix.config.xcodeVersion == '' - name: Run Tests run: | sudo chmod 777 /cores ulimit -c unlimited ${{ matrix.config.script }} ./release/install-root/usr/local/bin - name: Coredump on failure if: ${{ failure() }} run: | for f in $(find /cores -maxdepth 1 -name 'core.*' -print); do lldb --core $f --batch --one-line "bt all" done; test-windows: name: ${{ matrix.config.name }} runs-on: windows-2022 timeout-minutes: 60 needs: build-windows strategy: fail-fast: false matrix: config: - { name: 'Test Windows (MSVC 2022, x64)', target: 'desktop', toolchain: 'win64_msvc2022_64', testProfile: 'MSVC2022-x64', conan_toolchain: 'msvc_64', qtVersion: '6.8.3', script: './scripts/test-qbs.sh', qmake: 'qmake.exe', } - { name: 'Test Windows (MSVC 2022, arm64)', target: 'desktop', toolchain: 'win64_msvc2022_arm64_cross_compiled', testProfile: 'MSVC2022-x64_arm64', conan_toolchain: '', qtVersion: '6.8.3', script: './scripts/test-qbs.sh', qmake: 'qmake.bat', } - { name: 'Test Windows (MSVC 2022, Qt 5.15)', target: 'desktop', toolchain: 'win64_msvc2019_64', testProfile: 'MSVC2022-x64', conan_toolchain: '', qtVersion: '5.15.2', script: './scripts/test-qt.sh', qmake: 'qmake.exe', } - { name: 'Test Windows (clang-cl)', target: 'desktop', toolchain: 'win64_msvc2022_64', testProfile: 'clang-cl-x86_64', conan_toolchain: '', qtVersion: '6.8.3', script: './scripts/test-qbs.sh', qmake: 'qmake.exe', } - { name: 'Test Windows (MinGW)', target: 'desktop', toolchain: 'win64_mingw', testProfile: 'mingw-qt', conan_toolchain: 'mingw_64', qtVersion: '6.5.0', script: './scripts/test-qbs.sh', qmake: 'qmake.exe', } env: QTEST_FUNCTION_TIMEOUT: 9000000 QBS_AUTOTEST_PROFILE: 'qt' QBS_TEST_SOURCE_ROOT: 'tests' QT_ASSUME_STDERR_HAS_CONSOLE: 1 steps: - uses: actions/checkout@v1 - name: Download artifact uses: actions/download-artifact@v4 with: name: qbs-windows-${{ github.run_id }}.zip path: ./ - name: Unpack artifact run: | mkdir -p release/install-root cd release/install-root 7z x ../../qbs-windows-${{ github.run_id }}.zip shell: bash - name: Update PATH run: echo "./release/install-root/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Install required packages run: choco install -y pkgconfiglite --download-checksum=6004df17818f5a6dbf19cb335cc92702 continue-on-error: true # pkgconfiglite installation is flaky - name: Install Qt uses: ./.github/actions/download-qt with: toolchain: ${{ matrix.config.toolchain }} version: ${{ matrix.config.qtVersion }} - name: Install Host Qt if: matrix.config.toolchain == 'win64_msvc2022_arm64_cross_compiled' uses: ./.github/actions/download-qt with: target: 'desktop' toolchain: 'win64_msvc2022_64' version: ${{ matrix.config.qtVersion }} - name: Install MinGW uses: ./.github/actions/download-mingw - name: Install Ninja if: matrix.config.conan_toolchain != '' run: | choco install ninja shell: bash - name: Install Conan if: matrix.config.conan_toolchain != '' uses: turtlebrowser/get-conan@main - name: Configure Conan if: matrix.config.conan_toolchain != '' run: | ./scripts/setup-conan-profiles.sh --toolchain ${{ matrix.config.conan_toolchain }} which ninja shell: bash - name: Setup Qbs run: | qbs setup-toolchains --detect qbs setup-toolchains --type mingw $(which g++).exe mingw-qt qbs setup-qt $(cygpath $(where ${{ matrix.config.qmake }})) qt qbs config profiles.qt.baseProfile ${{ matrix.config.testProfile }} qbs config defaultProfile qt qbs config --list shell: bash - name: Setup self-signed certificate run: | New-SelfSignedCertificate -DnsName qbs@community.test -Type CodeSigning -CertStoreLocation cert:\CurrentUser\My shell: powershell - name: Run Tests run: ${{ matrix.config.script }} ./release/install-root/bin shell: bash test-windows-extra: name: ${{ matrix.config.name }} runs-on: windows-latest timeout-minutes: 60 needs: build-windows strategy: fail-fast: false matrix: config: - { name: 'Test Windows (OpenWatcom DOS 32 bit)', testProfile: 'watcom-2_0_0-dos-x86', script: './scripts/test-baremetal.sh', } - { name: 'Test Windows (OpenWatcom DOS 16 bit)', testProfile: 'watcom-2_0_0-dos-x86_16', script: './scripts/test-baremetal.sh', } - { name: 'Test Windows (OpenWatcom OS/2 32 bit)', testProfile: 'watcom-2_0_0-os2-x86', script: './scripts/test-baremetal.sh', } - { name: 'Test Windows (OpenWatcom OS/2 16 bit)', testProfile: 'watcom-2_0_0-os2-x86_16', script: './scripts/test-baremetal.sh', } - { name: 'Test Windows (OpenWatcom Windows 32 bit)', testProfile: 'watcom-2_0_0-windows-x86', script: './scripts/test-baremetal.sh', } - { name: 'Test Windows (OpenWatcom Windows 16 bit)', testProfile: 'watcom-2_0_0-windows-x86_16', script: './scripts/test-baremetal.sh', } - { name: 'Test Windows (DigitalMars DOS 16 bit)', testProfile: 'dmc-8_57_0-dos-x86_16', script: './scripts/test-baremetal.sh', } - { name: 'Test Windows (DigitalMars Windows 32 bit)', testProfile: 'dmc-8_57_0-windows-x86', script: './scripts/test-baremetal.sh', } - { name: 'Test Windows (DigitalMars Windows 16 bit)', testProfile: 'dmc-8_57_0-windows-x86_16', script: './scripts/test-baremetal.sh', } env: QTEST_FUNCTION_TIMEOUT: 9000000 QBS_AUTOTEST_PROFILE: 'extra' QBS_TEST_SOURCE_ROOT: 'tests' QT_ASSUME_STDERR_HAS_CONSOLE: 1 steps: - uses: actions/checkout@v1 - name: Download artifact uses: actions/download-artifact@v4 with: name: qbs-windows-${{ github.run_id }}.zip path: ./ - name: Unpack artifact run: | mkdir -p release/install-root cd release/install-root 7z x ../../qbs-windows-${{ github.run_id }}.zip shell: bash - name: Update PATH run: echo "./release/install-root/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Install OpenWatcom uses: ./.github/actions/download-ow - name: Install DigitalMars uses: ./.github/actions/download-dm - name: Setup Qbs run: | qbs setup-toolchains --detect qbs config profiles.extra.baseProfile ${{ matrix.config.testProfile }} qbs config defaultProfile extra qbs config --list shell: bash - name: Run Tests run: ${{ matrix.config.script }} ./release/install-root/bin shell: bash qbs-src-3.2.0/.gitattributes0000644000175100017510000000014715154533055015377 0ustar runnerrunner/.gitignore export-ignore /.gitattributes export-ignore /scripts/make-release-archive.sh export-ignore qbs-src-3.2.0/doc/0000755000175100017510000000000015154533055013247 5ustar runnerrunnerqbs-src-3.2.0/doc/targets/0000755000175100017510000000000015154533055014720 5ustar runnerrunnerqbs-src-3.2.0/doc/targets/qbs-target-apple-common.qdocinc0000644000175100017510000001010015154533055022710 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! //! [xcode] \note \QBS does not yet support the Swift programming language. The \l{xcode} module contains properties and rules for Xcode-based development. //! [xcode] //! [building user interfaces] \section1 Building User Interfaces The \l{ib} module contains properties and rules for building Interface Builder documents, storyboards, asset catalogs, and icon sets. //! [building user interfaces] //! [creating app bundles] \section1 Creating App Bundles The \l{bundle} module contains properties and rules for building and working with Core Foundation bundles (application bundles and frameworks) on Apple platforms. To build an application product as a bundle, or a dynamic or static library product as a framework, add a dependency on the bundle module and set the \l{bundle::isBundle}{bundle.isBundle} property to \c true: \code Depends { name: "bundle" } bundle.isBundle: true \endcode \QBS also provides a number of powerful features to assist in creating the Info.plist file that is part of your bundle. In fact, you do not need to provide an Info.plist file at all. Instead, \QBS will generate one automatically with the necessary keys, based on the values of module properties set in the product. If you do specify an Info.plist file, \QBS may still inject additional keys into the final output from other sources. One notable source of Info.plist keys are \e partial Info.plist files which are generated as a result of compiling other resources like asset catalogs, XIBs/NIBs, and storyboards. You may also use the \c bundle.infoPlist property to apply a set of key-value pairs to be added to the final Info.plist. This can be used instead of or in addition to an actual Info.plist file on disk. //! [creating app bundles] //! [architectures and variants] \section1 Multiple Architectures and Build Variants \QBS uses \l{Multiplexing}{multiplexing} to create multi-architecture \e fat binaries and multi-variant frameworks, where a single framework can contain both a release and debug build of a library on Apple platforms. You can set the \c qbs.architectures property to a list of CPU architectures (such as \c x86, \c x86_64, \c armv7a, \c armv7k, and \c arm64), and the \c qbs.buildVariants property to a list of build variants (such as \c debug and \c release), and \QBS will transparently perform the necessary steps to produce the various artifacts and combine them into a single bundle. Since the individual build configurations are completely independent of one another, you can continue to use conditional branches in your projects such as the following: \code Properties { condition: qbs.buildVariant === "release" cpp.optimization: "small" } \endcode //! [architectures and variants] */ qbs-src-3.2.0/doc/targets/qbs-target-windows.qdoc0000644000175100017510000000601315154533055021331 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qbs-target-windows.html \ingroup platforms \title Building for Windows \brief Platform notes for Windows. This topic describes the \QBS features specific to Windows. \note \QBS does not currently support building applications using .NET technologies and languages such as C#, F#, and Visual Basic. At this time we recommend that you use MSBuild and the tools shipped with the various implementations of the .NET platform. \section1 Windows Resources The \l{ico} module contains rules and properties for building Windows icon (.ico) and cursor (.cur) files from a set of raw PNGs. \section1 Universal Windows Platform Building applications for the Universal Windows Platform is currently only partially supported. Notably, support for building APPX packages is missing, but will be added in a future release. Relevant properties include: \list \li \l{cpp::windowsApiFamily}{cpp.windowsApiFamily} \li \l{cpp::windowsApiAdditionalPartitions} {cpp.windowsApiAdditionalPartitions} \li \l{cpp::requireAppContainer}{cpp.requireAppContainer} \endlist See the \l{cpp} module for more information. \note \QBS does not (and will not) support building Windows Runtime applications targeting Windows 8 or Windows 8.1. We encourage users to instead build desktop applications for older versions of Windows, or migrate to Windows 10 and the Universal Windows Platform. \section1 Building Windows Installers The following modules contain properties and rules for building Windows installers using a number of different technologies: \list \li \l{innosetup} - Inno Setup \li \l{nsis} - Nullsoft Scriptable Install System \li \l{wix} - Windows Installer XML Toolset \endlist */ qbs-src-3.2.0/doc/targets/qbs-target-tvos.qdoc0000644000175100017510000000321015154533055020626 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qbs-target-tvos.html \ingroup platforms \title Building for tvOS \brief Platform notes for tvOS. This topic describes the \QBS features specific to tvOS. \include qbs-target-apple-common.qdocinc xcode \include qbs-target-apple-common.qdocinc building user interfaces \include qbs-target-apple-common.qdocinc creating app bundles \include qbs-target-apple-common.qdocinc architectures and variants */ qbs-src-3.2.0/doc/targets/qbs-target-ios.qdoc0000644000175100017510000000320415154533055020430 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qbs-target-ios.html \ingroup platforms \title Building for iOS \brief Platform notes for iOS. This topic describes the \QBS features specific to iOS. \include qbs-target-apple-common.qdocinc xcode \include qbs-target-apple-common.qdocinc building user interfaces \include qbs-target-apple-common.qdocinc creating app bundles \include qbs-target-apple-common.qdocinc architectures and variants */ qbs-src-3.2.0/doc/targets/qbs-target-vxworks.qdoc0000644000175100017510000000314715154533055021367 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qbs-target-vxworks.html \ingroup platforms \title Building for VxWorks \brief Platform notes for VxWorks. The Wind River VxWorks RTOS is not yet supported but is planned for a future release. For more information about developing applications for the WindRiver VxWorks RTOS, see the \l{https://www.windriver.com/products/vxworks/} {VxWorks Product Documentation}. */ qbs-src-3.2.0/doc/targets/qbs-target-platforms.qdoc0000644000175100017510000000427115154533055021652 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \previouspage installing-files.html \group platforms \nextpage shell.html \title Target Platforms \QBS has built-in support for building applications for all major platforms. Platform support is implemented as a set of \l{List of Modules}{modules} that products depend on. The following topics describe the features specific to a particular platform, point out things to look out for, and provide tips for fully benefiting from the \QBS functions. In addition to the platforms explicitly listed below, \QBS should generally work on other UNIX and Unix-like platforms but these are not regularly tested or officially supported. \QBS recognizes the existence of at least AIX, HP-UX, Solaris, FreeBSD, NetBSD, OpenBSD, GNU Hurd, and Haiku, but provides no explicit support (except some minimal support for FreeBSD). For instructions on how to setup the target platform, see the \l {qbs::targetPlatform}{qbs.targetPlatform} property. */ qbs-src-3.2.0/doc/targets/qbs-target-integrity.qdoc0000644000175100017510000000317315154533055021661 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qbs-target-integrity.html \ingroup platforms \title Building for INTEGRITY \brief Platform notes for INTEGRITY. The Green Hills INTEGRITY RTOS is not yet supported but is planned for a future release. For more information about developing applications for the Green Hills INTEGRITY RTOS, see the \l{https://www.ghs.com/products/rtos/integrity.html} {INTEGRITY Product Documentation}. */ qbs-src-3.2.0/doc/targets/qbs-target-linux.qdoc0000644000175100017510000000266715154533055021011 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qbs-target-linux.html \ingroup platforms \title Building for Linux \brief Platform notes for Linux. To develop applications for Linux, you need a GCC or Clang toolchain installed on your host machine. */ qbs-src-3.2.0/doc/targets/qbs-target-macos.qdoc0000644000175100017510000000620015154533055020737 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qbs-target-macos.html \ingroup platforms \title Building for macOS \brief Platform notes for macOS. This topic describes the \QBS features specific to macOS. \include qbs-target-apple-common.qdocinc xcode \include qbs-target-apple-common.qdocinc building user interfaces \include qbs-target-apple-common.qdocinc creating app bundles \include qbs-target-apple-common.qdocinc architectures and variants \section1 Building macOS Disk Images The \l{AppleDiskImage} and \l{AppleApplicationDiskImage} items have a dependency on the \l{dmg} module. The former represents a product that is a basic Apple disk image, while the latter extends the former to create a drag 'n' drop disk image installer used for installing single application bundles. For example, the following code snippet creates a macOS disk image with a custom background and icon layout: \code AppleApplicationDiskImage { targetName: "cocoa-application-" + version version: "1.0" files: [ "CocoaApplication/dmg.iconset", "CocoaApplication/en_US.lproj/LICENSE", // comment out the following line to use a solid-color background // (see dmg.backgroundColor below) "CocoaApplication/background*" ] dmg.backgroundColor: "#41cd52" dmg.badgeVolumeIcon: true dmg.iconPositions: [ {"x": 200, "y": 200, "path": "Cocoa Application.app"}, {"x": 400, "y": 200, "path": "Applications"} ] dmg.windowX: 420 dmg.windowY: 250 dmg.windowWidth: 600 dmg.windowHeight: 422 // this includes the macOS title bar height of 22 dmg.iconSize: 64 } \endcode \image qbs-dmg.png In addition, \QBS supports multi-language license agreement prompts that appear when the DMG is opened, with full Unicode and rich-text formatting support. */ qbs-src-3.2.0/doc/targets/qbs-target-qnx.qdoc0000644000175100017510000000522515154533055020451 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qbs-target-qnx.html \ingroup platforms \title Building for QNX \brief Platform notes for QNX. To develop applications for the QNX Neutrino RTOS, you need to install the QNX Software Development Platform (SDP) on a Linux, macOS, or Windows development host. You can deploy the QNX Neutrino RTOS on a target system, such as embedded hardware, a virtual machine, or a PC. \QBS automatically determines the location of the SDP base directory if the SDP is installed at one of the standard locations, such as \c ~/qnx700, \c /opt/qnx700, or \c C:\qnx700. In addition, \QBS uses the SDP and the information it has about the host operating system to determine the location of the QNX host and target directories. If the QNX SDP path could not be determined automatically, you must add a dependency to the \l{qnx} module to your application and set the \l{qnx::sdkDir}{qnx.sdkDir} property: \code Application { name: "helloworld" files: "main.cpp" Depends { name: "cpp" } Depends { name: "qnx" } qnx.sdkDir: "/path/to/qnx700" } \endcode Alternatively, you can set the \c qnx.sdkDir property in a profile or on the command line. \QBS supports QNX SDP version 6.5 and above. For more information about developing applications for the QNX Neutrino RTOS, see the \l{http://www.qnx.com/developers/docs/} {QNX Product Documentation}. */ qbs-src-3.2.0/doc/targets/qbs-target-watchos.qdoc0000644000175100017510000000322415154533055021310 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qbs-target-watchos.html \ingroup platforms \title Building for watchOS \brief Platform notes for watchOS. This topic describes the \QBS features specific to watchOS. \include qbs-target-apple-common.qdocinc xcode \include qbs-target-apple-common.qdocinc building user interfaces \include qbs-target-apple-common.qdocinc creating app bundles \include qbs-target-apple-common.qdocinc architectures and variants */ qbs-src-3.2.0/doc/targets/qbs-target-android.qdoc0000644000175100017510000000622115154533055021260 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qbs-target-android.html \ingroup platforms \title Building for Android \brief Platform notes for Android. To develop applications for Android, you need development tools provided by the Android SDK from Google, and (optionally) a C/C++ toolchain provided by the Android NDK. \note \QBS does not yet support the Kotlin programming language. \section1 Creating Android Application Packages On Android, applications are distributed in a specially structured type of ZIP package called an APK. The following files should be created and bundled into an APK: \list \li Android assets. \li Android resource files. \li AndroidManifest.xml, which provides meta-information about your application. \li Compiled Java code, which serves as the entry point into your application and that automatically executes the native code in your application (if there is any). \li Shared libraries containing native code. \endlist You can use the \l{Application} item to build application packages for Android. If the \l{qbs::targetPlatform}{target platform} is \c{"android"}, then the Application item has a dependency on the \l{Android.sdk} module, which contains the properties and rules to create Android application packages from source files. You can use the \l{DynamicLibrary} item to build native Android libraries that are bundled into the APK. The \c qbs.architectures property specifies the architectures to build for, with the default value \c armv7a. If you have only one native library, you can simply list its sources within the main Application item, and it will get built and packaged automatically. The \l{DynamicLibrary} item, as well as the \l CppApplication item, has a dependency on the \l{Android.ndk} module, and contains the properties and rules to create native libraries. */ qbs-src-3.2.0/doc/tutorial.qdoc0000644000175100017510000010330115154533055015760 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com). ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \previouspage module-providers.html \page tutorial.html \nextpage tutorial-1.html \title Tutorial The tutorial describes the process of creating a typical \QBS project and explains core concepts. \list \li \l{tutorial-1.html}{Console Application} \li \l{tutorial-2.html}{Static Library} \li \l{tutorial-3.html}{Dynamic Library} \li \l{tutorial-4.html}{Convenience Items} \li \l{tutorial-5.html}{Autotest} \li \l{tutorial-6.html}{Project Properties} \li \l{tutorial-7.html}{Buildconfig Module} \li \l{tutorial-8.html}{Configurable Library} \li \l{tutorial-9.html}{Version Header} \li \l{tutorial-10.html}{C++20 Modules} \endlist */ /*! \previouspage tutorial.html \page tutorial-1.html \nextpage tutorial-2.html \title Console Application Let's start with a mandatory Hello World example. There is a Hello World example in the \l{overview.html#well-defined-language}{overview section}, but this time we will create a real-world project. We will start with a simple \QBS project file: \snippet ../tutorial/chapter-1/myproject.qbs 0 Here, we set the \l{Project::name}{name} of the project to \c "My Project" - it is mainly used for IDEs but can also be used to reference a project when setting properties from command-line. We also set the \l{Project::minimumQbsVersion}{minimumQbsVersion} - this property can be useful if the project depends on features that are not present in earlier \QBS versions. The \l{Project::references}{references} property contains the path to a file that describes our application. This file is located in a separate \c app directory - typically, projects tend to have quite a complicated structure but \QBS does not enforce any specific layout, so we will simply put each product in a separate directory. The application file sets several properties: \snippet ../tutorial/chapter-1/app/app.qbs 0 The \l{Product::name}{name} property identifies the product. The \l{Product::targetName}{targetName} property sets the name of the resulting binary (without the \c .exe extension on Windows, which is appended automatically). By default, \l{Product::targetName}{targetName} defaults to \l{Product::name}{name}. The \l{Product::files}{files} property contains a single \c main.c file which is a trivial \e{hello world} application: \snippet ../tutorial/chapter-1/app/main.c 0 We set \l{Product::consoleApplication}{consoleApplication} to \c true to indicate that our application is going to be used from a terminal. For example, on Windows, this will spawn a new console window if you double-click the resulting binary, while on macOS it will create a standalone binary file instead of an \l{https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html}{application bundle}. By default, \QBS installs binaries into an \e{installation root} folder which by default is named \c install-root and located under the build directory. This folder will contain only resulting artifacts without the build leftovers and files will have the same layout as in the target system. In order to skip installation of the specific Application product, set the \l{Application::install}{CppApplication.install} property to \c false. See the \l{installing-files.html}{Installing Files} section for more details. We can now build and run our application from the project directory: \code chapter-1 $ qbs build ... Building for configuration default compiling main.c [My Application] ... linking myapp [My Application] ... Build done for configuration default. chapter-1 $ qbs run ... Starting target. Full command line: .../default/install-root/usr/local/bin/myapp Hello, world \endcode The \QBS output to console and default installation location may vary between different platforms. In most cases, \QBS should be able to find the default compiler (for example, GCC or Clang on Linux, Visual Studio on Windows, or Xcode on macOS), but if that's not the case, see the \l{configuring.html}{configuring} section. In the following chapters, we will continue to improve our project: we will add a library and make it configurable. */ /*! \previouspage tutorial-1.html \page tutorial-2.html \nextpage tutorial-3.html \title Static Library Let's add a static library to our project so we can reuse some code. Analogous to what we did for the application, we put the file into the \c{lib} directory and add it to the \l{Project::references}{references} property in our project. The modified project may look like this: \snippet ../tutorial/chapter-2/myproject.qbs 0 Let's take a look at the the library file now: \snippet ../tutorial/chapter-2/lib/lib.qbs 0 It contains the \l{StaticLibrary} item which sets the \l{Product::type}{type} of the product to \c "staticlibrary" and sets some defaults like where to install that library. The \l{StaticLibrary} item inherits the \l{CppLibrary} item which pulls in the dependency on the \l{cpp} module. As before, we set the \l{Product::files}{files} property with a header: \snippet ../tutorial/chapter-2/lib/lib.h 0 And we set the implementation file of our library: \snippet ../tutorial/chapter-2/lib/lib.c 0 We will keep our library really simple - it only contains one function, which we will later use in our application. The source file requires a \c "CRUCIAL_DEFINE" to be passed to a preprocessor. That is why we set the \l{cpp::defines}{cpp.defines} property: \snippet ../tutorial/chapter-2/lib/lib.qbs 1 Next, we need to tell \QBS where to look for public headers of our library when building products that depend on it. By default, \QBS knows nothing about the layout of our library, so we tell it to look for headers in the library's source directory using the \l{Export} item: \snippet ../tutorial/chapter-2/lib/lib.qbs 2 You can export any \l{Module} property within the \l{Export} item - it will be merged in the depending product with other properties. For example, you can export \l{cpp::defines}{cpp.defines} or specific \l{cpp::commonCompilerFlags}{compiler flags} that are required to use this product. We depend on the \l{cpp} module twice - once within the \l{StaticLibrary} item and once in the \l{Export} item. This is because by default \QBS does not export anything when depending on this product and the dependencies in this item (as well as properties set in this item) are private to this product while dependencies and properties set in the \l{Export} item are for export only. Finally, we have some Apple-specific settings. You can skip this part of the tutorial if you are using some other platform. We depend on the \l{bundle} module and set the \l{bundle::isBundle}{bundle.isBundle} to false: \snippet ../tutorial/chapter-2/lib/lib.qbs 3 By default, \QBS builds static and dynamic libraries as \l{https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WhatAreFrameworks.html}{Frameworks} on macOS. So, to keep things simple, we disable the framework build and build a plain old static library file here. */ /*! \previouspage tutorial-2.html \page tutorial-3.html \nextpage tutorial-4.html \title Dynamic Library Let's now turn our static library into a dynamic library. It is a bit trickier with dynamic libraries since several things should be tweaked. First, we need to be able to mark methods (or classes) in our library as exported. Second, we need to tell our application where to look for our library at run time using \l{https://en.wikipedia.org/wiki/Rpath}{rpaths}. Some compilers, like MSVC, require us to mark which symbols we want to export or import. The \l{https://stackoverflow.com/a/6840659}{canonical} way would be to define some helper macros. Let's start with a header that defines those helper macros: \snippet ../tutorial/chapter-3/lib/lib_global.h 0 This header defines the \c MYLIB_EXPORT macro that expands either to an "export" or to an "import" directive based on the presence of the \c MYLIB_LIBRARY macro. We can use this macro to mark a function as follows: \snippet ../tutorial/chapter-3/lib/lib.h 0 The modified library product may look like this: \snippet ../tutorial/chapter-3/lib/lib.qbs 0 The most important change is that we changed the item type from \l{StaticLibrary} to \l{DynamicLibrary}. We moved the \c "lib.h" header into the \l{CppLibrary::publicHeaders}{publicHeaders} property. That way, the header will be installed with the library to the \c{/include/my project/mylib/} directory. If you do not want to ship headers with your library, simply put those into the \l{Product::files}{files} property like we did in the previous chapter. We also added the \c MYLIB_LIBRARY to the list of \l{cpp::defines}{defines}. We do this only when building the library but we are not exporting it - that way the users of our library will have methods marked for import rather than export. Finally, we set \l{cpp::sonamePrefix}{cpp.sonamePrefix} to \c "@rpath". This is required only for Apple platforms, see \l{https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/RunpathDependentLibraries.html}{Run-Path Dependent Libraries} for details. It is also required to set \l{cpp::rpaths}{cpp.rpaths} in our application file. Since the library is installed to the \c{lib} directory and the application is installed to the \c{bin} directory, we need to tell the loader to look in the \c{lib} directory. The \l{jsextension-fileinfo.html#relativePath}{FileInfo.relativePath} method can help us: \snippet ../tutorial/chapter-3/app/app.qbs 0 On Linux, this expression would be equivalent to this: \c{cpp.rpaths: ["$ORIGIN/../lib"]}. Don't forget to \c{import qbs.FileInfo} in order to be able to use the \l{jsextension-fileinfo.html} extension. To make the example complete, here's how the full \c app/app.qbs file should look like: \snippet ../tutorial/chapter-3/app/app.qbs 1 */ /*! \previouspage tutorial-3.html \page tutorial-4.html \nextpage tutorial-5.html \title Convenience Items As you might have noticed, we are repeating ourselves when setting the same properties in our products - we set \l{Product::version}{version}, \l{cpp::rpaths}{cpp.rpaths}, and so on. For a single application and a library, that is not a big deal, but what if we have a dozen libraries? Luckily, this can be achieved using item \l{language-introduction.html#reusing-project-file-code}{inheritance} - we move the common code to the base item and in the real product we will only set what is specific to that product (for example, the list of \l{Product::files}{files}). First, we need to tell \QBS where to look for our new base items. This can be achieved using the \l{Project::qbsSearchPaths}{qbsSearchPaths} property. We set this property to \c "qbs" so that \QBS will search our items in the \c{qbs} directory located in the project directory: \snippet ../tutorial/chapter-4/myproject.qbs 0 \note This directory has a pre-defined structure: base items should be located under the \c{imports} subdirectory. See \l{Custom Modules and Items} for details. Let's create a base item for all our applications and move common code there: \snippet ../tutorial/chapter-4/qbs/imports/MyApplication.qbs 0 As you see, we managed to extract most of the code here, and our application file now only contains what's relevant to it: \snippet ../tutorial/chapter-4/app/app.qbs 0 Now let's do the same for our library: \snippet ../tutorial/chapter-4/qbs/imports/MyLibrary.qbs 0 Here, we introduce a helper property, \c libraryMacro, with a default value calculated based on the capitalized product name. Since the name of out library product is \c "mylib", this property will expand to \c "MYLIB_LIBRARY". We can also override the default value for the macro in products that inherit our item like this: \code MyLibrary { libraryMacro: "SOME_OTHER_LIBRARY_MACRO" } \endcode Let's take a look at the refactored library file: \snippet ../tutorial/chapter-4/lib/lib.qbs 0 We managed to extract the reusable parts to common base items leaving the actual products clean and simple. Unfortunately, item inheritance comes with a price - when both parent and child items set the same property (\l{cpp::defines}{cpp.defines} in our case), the value in the child item wins. To work around this, the special \l{special-property-values.html#base}{base} value exists - it gives access to the base item's value of the current property and makes it possible to extend its value rather than override it. Here, we concatenate the list of defines from the base item \c{["MYLIB_LIBRARY"]} with a new list, specific to this product (namely, \c{['CRUCIAL_DEFINE']}). */ /*! \previouspage tutorial-4.html \page tutorial-5.html \nextpage tutorial-6.html \title Autotest Now that we can re-use our base items, let's add a simple autotest. We inherit the new item from the \c MyApplication item and add an \c "autotest" type: \snippet ../tutorial/chapter-5/qbs/imports/MyAutoTest.qbs 0 This additional type is required for the helper \l{AutotestRunner} item. This item runs all products with the \c "autotest" type when it is being built. It also implicitly depends on all such products, so they will be built before running as well. Let's add this item to our top-level \l{Project} item: \code Project { name: "My Project" minimumQbsVersion: "2.0" // ... AutotestRunner { timeout: 60 } } \endcode Here we set the \l{AutotestRunner::timeout}{timeout} property to 60 seconds so that our runner kills tests that run way too long. Now we need to add our first test. Let's create a new product with the following content: \snippet ../tutorial/chapter-5/test/test.qbs 0 Here we depend on our library (which we are going to test), set the product \l{Product::name}{name}, and specify the source file, which looks like this: \snippet ../tutorial/chapter-5/test/test.c 0 The test compares the value from the library with the value from the command line. Don't forget to add the new test product to the references property in the Project: \snippet ../tutorial/chapter-5/myproject.qbs 0 Now we can build the autotest product - this will also launch our test: \code $ qbs build -p "autotest-runner" ... running test mytest [autotest-runner] Build done for configuration default. \endcode */ /*! \previouspage tutorial-5.html \page tutorial-6.html \nextpage tutorial-7.html \title Project Properties It would be nice if our project was configurable. Let's add some properties to our root project file: \snippet ../tutorial/chapter-6/myproject.qbs 0 Now we can use those properties in our helper items and in products: \snippet ../tutorial/chapter-6/qbs/imports/MyApplication.qbs 0 Here, we access the project file using the special \l{special-property-values.html#project}{project} value. If the nearest project in the project tree does not have the desired property, \QBS looks it up in the parent project, potentially all the way up to the top-level project. Let's now disable the tests if \c project.withTests is \c false: \snippet ../tutorial/chapter-6/myproject.qbs 1 Here we use the \l{Properties} item within the \l{SubProject} item. This item allows to override a subproject's properties which can be useful when adding some other \QBS project as a Git submodule. Of course, it is not very useful in our particular case since we only set the \l{Project::condition}{Project.condition} property. We could achieve the same effect by setting the \l{SubProject::condition}{condition} property of the \l{SubProject} item: \code SubProject { filePath: "test/test.qbs" condition: parent.withTests } \endcode Another way would be to disable the test product. That way, an IDE would still show the whole project tree including disabled tests: \code // qbs/imports/MyAutoTest.qbs MyApplication { condition: project.withTests type: base.concat(["autotest"]) } \endcode Let's finally make our \l{AutotestRunner} configurable too: \snippet ../tutorial/chapter-6/myproject.qbs 2 There are several ways to override project properties from the command line. First, the special \c project variable can be used to set the properties of the top-level project: \code $ qbs resolve project.withTests:false \endcode You can also refer to properties using project's \l{Project::name}{name}: \code $ qbs resolve "projects.My Project.withTests:false" \endcode This can again be useful for accessing the properties of external sub-projects. Note that since the project name contains spaces, we use quotes here. */ /*! \previouspage tutorial-6.html \page tutorial-7.html \nextpage tutorial-8.html \title Config Module In the previous chapter, we added some properties to our main \l{Project} file. While this is a perfect approach for \e public properties of the project, sometimes we want to add some \e private properties for better tuning. Of course, we could put everything in the \l{Project} file, but that would make it very convoluted. Also, accessing the top-level project all the way from products makes things strongly tied. Let's create a file named \c{module.qbs} and put it into the \c{qbs/modules/config/install} directory, near the \c{qbs/imports} directory: \code // qbs/modules/config/install/module.qbs ConfigInstall { } \endcode Here we inherit the \l{ConfigInstall} item in order to re-use its properies. Since custom \l{Project::qbsSearchPaths}{qbsSearchPaths} are searched first, now our version will be used instead of built-in one. First, let's change the default value of the \l{ConfigInstall::importLibraries}{config.install.importLibraries} in order to install import libraries on Windows: \code // qbs/modules/config/install/module.qbs ConfigInstall { importLibraries: true } \endcode We could extend the \l{config.install} module with additional properties, but that could create collisions when someone tries to include the source code of your project into their project. Thus, we will create a new \c{config.myproject} module and use the same approach with the base item as \QBS does for the \c{config.install} module. Let's create a new item and add a new property to it: \snippet ../tutorial/chapter-7/qbs/imports/ConfigMyProject.qbs 0 We added the \c{enableAddressSanitizer} property and a dependency on the \l{Sanitizer.address} module if that property is set to \c{true}. Now let's use the item in a module: \snippet ../tutorial/chapter-7/qbs/modules/config/myproject/module.qbs 0 Now we can use our module in the \c{MyLibrary.qbs} item by pulling in the new module using the \l{Depends} item: \snippet ../tutorial/chapter-7/qbs/imports/MyLibrary.qbs 0 Now we can enable sanitizer build by setting the \c{enableAddressSanitizer} property from command-line: \code $ qbs resolve modules.config.myproject.enableAddressSanitizer:true $ qbs build \endcode Instead of the \c{config.myproject.enableAddressSanitizer} property, we could also use the property in the \l{Project} item similar to how we did in the previous chapter. There is no strong preference which way to use, however using modules for configuration is more flexible as it is also possible to set properties of other modules as described below. \QBS \l{Module}{modules} have the feature to automatically export properties of other modules. Those exported properties are merged in the resulting product. We can use this feature to set the \l{cpp::rpaths}{cpp.rpaths} in our module rather than in products: \snippet ../tutorial/chapter-7/qbs/imports/ConfigMyProject.qbs 1 Here, we inject the dependency on the \l{cpp} module and calculate the \c{libRPaths} property. This is a relative path from the \c{product.installDir} (which is either \c{"bin"} or \c{"lib"}, depending on product type) to \l{ConfigInstall::dynamicLibrariesDirectory}{dynamicLibrariesDirectory} (which is \c{"lib"} by default). Finally, we set \l{cpp::rpaths}{cpp.rpaths} to this property. This way, those \c rpaths will be automatically exported to all products that depend on the \c{config.myproject} module. We should also update the \c{MyApplication} item to add a dependency on the \c{"config.myproject"} in order to inject \l{cpp::rpaths}{cpp.rpaths} we set in the module: \snippet ../tutorial/chapter-7/qbs/imports/MyApplication.qbs 0 */ /*! \previouspage tutorial-7.html \page tutorial-8.html \nextpage tutorial-9.html \title Configurable Library In this chapter, we will make our library more configurable to be able to choose between static and dynamic builds. We need to do some modifications to export macros in the \c lib/lib_global.h header: \snippet ../tutorial/chapter-8/lib/lib_global.h 0 Here' we added a new branch when \c MYLIB_STATIC_LIBRARY is defined. In that case, we make the \c MY_LIB_EXPORT macro empty. Now, let's modify the \c qbs/imports/MyLibrary.qbs file as follows: \snippet ../tutorial/chapter-8/qbs/imports/MyLibrary.qbs 0 First thing to notice is that we changed the type of the item from \l{DynamicLibrary} to the \l{Library} item which is a common base item for dynamic and static libraries. Second, we change our \e{export macro} to be different in the static and dynamic builds to correspond with the changes we made to the \c lib_global.h: \code readonly property string _nameUpper : name.replace(" ", "_").toUpperCase() property string libraryMacro: _nameUpper + "_LIBRARY" property string staticLibraryMacro: _nameUpper + "_STATIC_LIBRARY" cpp.defines: config.build.libraryType === "static" ? [staticLibraryMacro] : [libraryMacro] \endcode Note that in a static build we export the \c MYLIB_STATIC_LIBRARY macro so that the dependent products will know whether they link to a static or dynamic library: \code Export { ... cpp.defines: exportingProduct.config.build.libraryType === "static" ? [exportingProduct.staticLibraryMacro] : [] } \endcode Now we can build our project in dynamic or static mode: \code $ qbs resolve modules.config.build.libraryType:static && qbs build ... $ ls default/install-root/usr/local/lib/ libmylib.1.0.0.so libmylib.1.0.so libmylib.1.so libmylib.so $ rm -r default $ qbs resolve modules.config.myproject.staticBuild:true modules.config.install.staticLibraries:true && qbs build ... $ $ ls default/install-root/usr/local/lib/ libmylib.a \endcode \note \QBS does not install static libraries by default, thats why we set the \l{ConfigInstall::staticLibraries}{config.install.staticLibraries} property to \c{true} to enforce installation of the static library. We can also change the default in the \c{config.install} module: \code // qbs/modules/config/install/module.qbs ConfigInstall { ... importLibraries: true staticLibraries: true ... } \endcode */ /*! \previouspage tutorial-8.html \page tutorial-9.html \nextpage tutorial-10.html \title Version Header To create new files, such as version headers, during the build, use \l{Rules}. Every command \QBS executes, such as compile or linker commands, is described by a corresponding Rule in a Module or a Product. In this section, we will create a simple header with a string constant based on the variable in our project. First, we add this variable to our \c config.myproject base item: \snippet ../tutorial/chapter-9/qbs/imports/ConfigMyProject.qbs 0 Next, we create a new file, \c{version.h.in}, located in the \c{version-header} directory. This file contains the template for our header: \snippet ../tutorial/chapter-9/version-header/version.h.in 0 Now we create a file called \c{version-header.qbs} in the same directory. This file contains a \l{Product} with a \l{Rule} that turns the \c{version.h.in} into a real header. Let's go through the contents of the file: \snippet ../tutorial/chapter-9/version-header/version-header.qbs 0 First, we import \l{TextFile Service}{TextFile}. We will need this class to read the template and write the resulting header. Second, we declare a new \l{Product} named \c{"version_header"} and with the \c{"hpp"} type. This is the type of the artifact we will create in the Rule. Third, we add the dependency on the \c config.myproject module to use the new \c config.myproject.productVersion variable. We also add a \l{Group} with the template file and assign the \c{version_h_in} tag to the file: \snippet ../tutorial/chapter-9/version-header/version-header.qbs 1 \QBS Rules work with file tags, instead of working with files directly, which makes it easy to reuse rules. The name of the tag is chosen arbitrarily here. We could use the name of the file as a tag, but to avoid confusion between file name and file tag, we use underscores in the tag instead of dots. Now we can create a Rule itself: \snippet ../tutorial/chapter-9/version-header/version-header.qbs 2 Here, we specify that our Rule takes files tagged as \c "version_h_in" and produces an \l{Artifact} with the name \c "version.h" and tagged \c "hpp". By default, files are created in the \l{Product::destinationDirectory}{Product.destinationDirectory} folder. We add the \c "hpp" tag for the header as this is the tag the \l{cpp}{cpp module} uses for headers. That way, \QBS can track changes and process our generated file the same way it treats all other headers. Note that earlier we set the product type to \c "hpp" as well. \QBS requires that artifact type should match the product type directly or be accessible via the chain of Rules. Otherwise, the Rule won't be executed. For details, see the \l{Rules and Product Types} section. The actual code generation happens in the \l{Rule::prepare}{Rule.prepare} script: \snippet ../tutorial/chapter-9/version-header/version-header.qbs 3 In this script, we create a \l {JavaScriptCommand} object and set some meta properties, such as the description and highlight. For details about Commands, see \l{Command and JavaScriptCommand}. In the sourceCode variable, we create a JavaScript function that opens the \l{The inputs and outputs Variables}{input file}, reads its content using the \l{TextFile Service}{TextFile} object, replaces the \c "${PRODUCT_VERSION}" placeholder with the actual value in the \c product.config.myproject.productVersion variable, and writes the resulting content into the \l{The inputs and outputs Variables}{output file}. Finally, we export the \l{Product::buildDirectory}{exportingProduct.buildDirectory} so that products that depend on this product can include our generated header: \snippet ../tutorial/chapter-9/version-header/version-header.qbs 4 The full content of the file should look like this: \snippet ../tutorial/chapter-9/version-header/version-header.qbs 5 Let's now add our Product into the root project so \QBS will be aware of it: \snippet ../tutorial/chapter-9/myproject.qbs 0 We also need to add the dependency on the \c "version_header" to our application: \snippet ../tutorial/chapter-9/app/app.qbs 0 Now we can include the header in the \c main.c file and print the contents of the string constant: \snippet ../tutorial/chapter-9/app/main.c 0 Let's try and run our application. You should see something like this: \code $ qbs run -p "My Application" Starting target. Full command line: .../default/install-root/usr/local/bin/myapp Hello, world Hello from library ProductVersion = 1.0.0 \endcode */ /*! \previouspage tutorial-9.html \page tutorial-10.html \nextpage howtos.html \title C++20 Modules This tutorial implies you have some knowledge about C++20 modules. If not, see \l{https://learn.microsoft.com/en-us/cpp/cpp/modules-cpp}{Overview of modules in C++} for introduction. \section1 Named Modules Using C++20 modules with \QBS is pretty straightforward. Let's suppose you have a module file that exports a single function \c printHello: \snippet ../tutorial/chapter-10-1/hello.cppm 0 \note Currently, Clang only recognizes \c .cppm files as modules, however, for GCC and MSVC \QBS also recognizes \c .ixx files as C++ modules. \QBS assigns the \c "cppm" file tag to these files. You can assign this tag manually to module files with different extensions. This function is later used in the \c main.cpp file as follows: \snippet ../tutorial/chapter-10-1/main.cpp 0 The project file simply lists files and sets the \l{cpp::forceUseCxxModules}{cpp.forceUseCxxModules} property to \c true. \code // myproject.qbs CppApplication { consoleApplication: true files: ["hello.cppm", "main.cpp"] cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true } \endcode Now, you can build the project by simply calling \c{qbs}, assuming that your compiler supports C++20 modules. \section1 Module Partitions \l{https://learn.microsoft.com/en-us/cpp/cpp/modules-cpp?view=msvc-170#module-partitions}{Module partitions} are treated as regular modules and should also have the same extension or assigned the \c "cppm" tag manually. See this \l{https://github.com/qbs/qbs/tree/2.5/examples/cxx-modules/mod3}{example} on how to use both interface module and partitions. \section1 Modules and Libraries Using modules in dynamic libraries requires using the same export/import macros as it was shown in the \l{tutorial-3.html}{Dynamic Library} section: \snippet ../tutorial/chapter-10-2/lib/hello.cppm 0 As shown in that section, the library \c .qbs file should also define the \c MYLIB_LIBRARY macro in order to mark symbols as exported: \code // lib/lib.qbs DynamicLibrary { name: "mylib" files: ["hello.cppm", "lib_global.h"] version: "1.0.0" Depends { name: "cpp" } cpp.defines: "MYLIB_LIBRARY" cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true // ... } \endcode For more details, see the complete \l{https://github.com/qbs/qbs/tree/2.5/tutorial/chapter-10-2}{example}. \section1 Import std module Starting with C++23, you can use the standard library as a module by using \c{import std;} or \c{import std.compat;}. In order to use \c{import std;}, you need to define the \l{CppStd} product somewhere in your project and add a dependency on it to products that require the \c{std} module: \code Project { CppStd {} CppApplication { Depends { name: "CppStd" } } } \endcode Here's a simple example that demonstrates the use of the standard library module: \snippet ../tutorial/chapter-10-3/main.cpp 0 The project file needs to be configured to use C++23 and enable the standard library module: \snippet ../tutorial/chapter-10-3/myproject.qbs 0 \note This feature requires a compiler and standard library that support the C++23 standard library module. Currently, this feature is experimental and may not be available in all toolchains. The full product file may look like this: \snippet ../tutorial/chapter-10-3/myproject.qbs 1 In order to use \c{import std.compat;}, you will also need to set the \l{CppStd::useStdCompat}{CppStd.useStdCompat} property to \c{true}: \code CppStd { useStdCompat: true } \endcode */ qbs-src-3.2.0/doc/qbs.qdoc0000644000175100017510000025240015154533055014707 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ // ********************************************************************** // NOTE: the sections are not ordered by their logical order to avoid // reshuffling the file each time the index order changes (i.e., often). // Run the fixnavi.pl script to adjust the links to the index order. // ********************************************************************** /*! \page index.html \nextpage overview.html \title Qbs Manual \section1 Version \qbsversion \QBS is a tool that helps simplify the build process for developing projects across multiple platforms. \QBS can be used for any software project, regardless of programming language, toolkit, or libraries used. \note Please report bugs and suggestions to the \l{http://bugreports.qt.io/}{Qt Bug Tracker}. \list \li \l{Introduction} \li \l{Setup} \list \li \l{Installing} \li \l{Configuring Profiles and Preferences} \li \l{Managing Qt Versions} \endlist \li \l{Usage} \list \li \l{Language Introduction} \li \l{Building Applications} \li \l{Running Applications} \li \l{Installing Files} \li \l{Target Platforms} \li \l{Using the Shell} \li \l{Generators} \li \l{Multiplexing} \li \l{Custom Modules and Items} \li \l{Special Property Values} \li \l{Module Providers} \endlist \li \l{Tutorial} \list \li \l{tutorial-1.html}{Console Application} \li \l{tutorial-2.html}{Static Library} \li \l{tutorial-3.html}{Dynamic Library} \li \l{tutorial-4.html}{Convenience Items} \li \l{tutorial-5.html}{Autotest} \li \l{tutorial-6.html}{Project Properties} \li \l{tutorial-7.html}{Buildconfig Module} \li \l{tutorial-8.html}{Configurable Library} \li \l{tutorial-9.html}{Version Header} \li \l{tutorial-10.html}{C++20 Modules} \endlist \li \l{How-tos} \li \l{Reference} \list \li \l{List of All Items} \list \li \l{List of Language Items} \li \l{List of Convenience Items} \li \l{List of Probes} \endlist \li \l{List of Built-in Services} \li \l{Command-Line Interface} \li \l{List of Modules} \li \l{List of Module Providers} \li \l{Command and JavaScriptCommand} \endlist \li \l{Appendix A: Building Qbs} \li \l{Appendix B: Migrating from Other Build Systems} \li \l{Appendix C: The JSON API} \li \l{Appendix D: Licenses and Code Attributions} \endlist */ /*! \previouspage index.html \page overview.html \nextpage setup.html \title Introduction \QBS is a build automation tool designed to conveniently manage the build process of software projects across multiple platforms. \section1 Features \QBS provides the following benefits: \list \li Declarative paradigm \li Well-defined language \li Platform and programming language independence \li Correct and fast incremental builds \li Extensible architecture \li Easy integration to IDEs \endlist \section2 Declarative Paradigm When writing a project, it is important to describe the build tasks and dependencies between them, rather than the build order. It is difficult to determine the correct build order in complex projects, especially during parallel builds. The build tool should bear that burden, not the developer. With a declarative language, \QBS enables you to express intent rather than specifying single build steps. This provides the appropriate level of abstraction for a build system. For example, \e dependencies can be created between \e products, such that the target \e artifacts of the dependency can be used as input to the build \e rules in the context of the depending product. In addition, you can \e export dependencies and \e properties to other products. \QBS is modular with clean interfaces between modules. A \e module is a collection of properties and \e {language items} that are used for building a product if the product depends on the module. The properties that can be set for a module are used to control the behavior of the toolchain used to build the module. \QBS itself knows nothing about file types or extensions, and therefore all source files in a product are handled equally. However, you can assign \e {file tags} to an artifact to act as markers or to specify a file type. \QBS applies a rule to the source files of the project and chooses the ones that match the input file tags specified by the rule. It then creates artifacts in the build graph that have other filenames and file tags. Products and projects can contain \e probes that are run prior to building, for instance to locate dependent headers, libraries, and other files outside the project directory. \section2 Well-Defined Language \QBS projects are specified in a QML dialect. QML is a concise, easy to learn, and intuitive language that is used successfully in the Qt project. Its core is declarative, but it can be extended with JavaScript snippets for extra flexibility. \QBS builds applications based on the information in a project file. Each project file specifies one \l{Project}{project} that can contain several \l{Product}{products}. You specify the type of the product, such as an \e application, and the dependencies the product has on other products. The product type determines the set of \l{Rule}{rules} that \QBS applies to produce artifacts from input files. The input files can be divided into \l{Group}{groups} according to their type or purpose, for example. A group can also be used to attach \l{Properties}{properties} to products. The following is an example of a minimal project file that specifies the product type, application name, source file, and a dependency on the \l{cpp} module: \code Application { name: "helloworld" files: "main.cpp" Depends { name: "cpp" } } \endcode For more information, see \l{Language Introduction}. \section2 Platform and Programming Language Independence \QBS can be used for any software project, regardless of programming language, toolkit, or libraries used. \QBS has built-in support for building applications for Windows, Linux, macOS, Android, iOS, tvOS, watchOS, QNX, and FreeBSD, as well as for cross-compilation. It can be easily extended to support further platforms. Invoking \l{build}{qbs build} from the command line automatically builds the project for the current host platform using the best available toolchain and settings, unless a default profile is set. You can configure additional profiles for each toolchain you want to use and select the profile to use at build time. For example, to build applications for Android devices, you would need to set up a profile for the Android toolchain and select it when you build the application. If you name the profile \e Android, you would then enter the following command: \code qbs build profile:Android \endcode For more information, see \l{Building Applications}. Platform and programming language support is implemented as a set of \l{List of Modules}{modules} that your product depends on. In the language example above, the dependency on the \l{cpp} module determines that the C++ sources are compiled and linked into a binary. Alternatively, you could use the \l{CppApplication} convenience item that implies a dependency on the \l{cpp} module: \code CppApplication { name: "helloworld" files: "main.cpp" } \endcode Additionally, if the sources use Qt, you need a dependency to the \l{Qt.core} module, and so on. In addition to building projects, \QBS can install the build artifacts to a location from where they can be run on the desktop or on a device. \QBS modules can be used to create installers for the end users of the applications. For example, the \l{dmg} module contains properties and rules for building Apple Disk Images, which are typically used to distribute applications and installers on macOS. The \l{innosetup}, \l{nsis}, and \l{wix} modules contain properties and rules for building installers for Windows platforms. \section2 Correct and Fast Incremental Builds \QBS is an all-in-one tool that generates a build graph from a high-level project description (like qmake or CMake) and additionally undertakes the task of executing the commands in the low-level build graph (like make). \QBS automatically takes advantage of multi-processor and multi-core systems to achieve maximum build parallelization. By default, running \c qbs without any arguments is roughly equivalent to running \c {make -j} where \c n is the number of CPU cores. Similarly, \QBS allows the number of concurrent jobs to be explicitly specified using its own \c -j option. \QBS has knowledge about the whole project, and therefore builds remain correct even when you build sub-projects, because \QBS ensures that all dependencies are built too. This virtually eliminates the need for clean builds. \QBS uses dynamic build graphs with build rules that can generate a variable number of files and that are executed only when needed. When figuring out which rules to execute, \QBS starts at the product type and then looks for a way to produce artifacts with matching file tags from source files, using a chain of rules that are connected by their respective input and output tags. For an example of how rules are applied when building products, see \l{Rules and Product Types}. The \QBS build rules can produce a variable number of outputs. If the input changes, only the required rules are applied at build time. If a rule is applied, all the dependent rules are applied as well, but only those. This feature ensures the correctness of the build graph after source code changes without having to re-configure the whole project. Changing properties that do not affect the build, because they are not used by rules, will not cause the project to be rebuilt. The use of properties is tracked. Generated artifacts that cease to exist are deleted to avoid picking outdated generated artifacts and indefinitely increasing the size of the build directory. Fast incremental builds are crucial for a fast edit-build-run cycle. Instead of retrieving the timestamps of generated files, \QBS uses the time stamps stored in the build graph. This is especially important on Windows, where file system operations are slow. If the project files were not changed, the build graph is loaded from disk. It is stored in a binary format that can be loaded much faster than the real project files. The project files are parsed only if they were changed. \section2 Extensible Architecture You can create your own custom \l{List of Modules}{modules} and \l{List of Language Items}{items} and make \QBS aware of them. You store the custom modules and items in a subdirectory of the project directory and specify the path to the subdirectory as a value of the \l{Project::}{qbsSearchPaths} property. For example, if the custom module is located at \c my-modules/modules/modulename/modulename.qbs, you would specify it in the project file as follows: \code Project { qbsSearchPaths: "my-modules" \endcode For more information, see \l{Custom Modules and Items}. \section2 IDE Integration \QBS can be used not only from the command line, but also in combination with an IDE, such as Qt Creator or Visual Studio Code. These IDEs directly support \QBS projects using the new \QBS \l{session} feature. Thus, these IDEs can retrieve all the information required to build a single file or project through a session's JSON protocol \l{Appendix C: The JSON API}{API}. In addition, \QBS can generate projects for Visual Studio, IAR EW, and Keil uVision, but it still is an experimental option. For more information, see \l {Generators}. \section3 Qt Creator \l{http://doc.qt.io/qtcreator/index.html}{Qt Creator} provides accurate information about the build progress and displays a project tree that reflects the logical structure of the project, instead of presenting low-level information, such as the file system structure. Adding or removing source files keeps the existing project file structure intact. For more information about using \QBS to build projects from Qt Creator, see \l{http://doc.qt.io/qtcreator/creator-project-qbs.html}{Setting Up Qbs}. \section3 Visual Studio Code \l{https://code.visualstudio.com/}{Visual Studio Code} provides the \l{https://marketplace.visualstudio.com/items?itemName=qbs-community.qbs-tools} {qbs-community} plugin that provides accurate information about the build progress and displays a project tree that reflects the logical structure of the project. Also, it can provide low-level information, such as the file system structure. For more information about using \QBS to build projects from Visual Studio Code, see \l{https://github.com/denis-shienkov/vscode-qbs/blob/master/docs/how-to.md} {How To}. \section1 Build Process \image qbs-build-process.png The build process of a product starts by examining the \l{Product::}{type} property of the product. It contains a list of \e {file tags} that are similar to MIME types. The following example product contains one file tag, \e application: \code Product { Depends { name: "cpp" } type: ["application"] files: ["main.cpp", "class.cpp", "class.h"] } \endcode \QBS then searches through all \e rules available in the context, meaning rules that are defined in the project or those that are made available through the dependency on a module, such as the compiler and linker rules pulled in from the \c cpp dependency in the example. When \QBS finds a rule that produces one or more artifacts with the relevant file tag, it looks at the depencencies of that rule and finds out that it produces artifacts tagged \c obj. It then finds a rule that produces \c obj artifacts that takes \c .cpp artifacts as input. \code Module { // ... Rule { inputs: ["cpp"] Artifact { filePath: input.fileName + ".o" fileTags: ["obj"] } prepare: { // g++ -c main.cpp -o main.o ... } } //... } \endcode There is no rule in the current context that produces \c .cpp files, but we have defined \c .cpp files as inputs for the product. When we added a dependency on the \l{cpp} module, that dependency also pulled in another \QBS primitive called the \l{FileTagger}{file tagger}. The file tagger looked for files matching the pattern \c *.cpp, and then applied the \c cpp tag to those input files: \code Module { // ... FileTagger { patterns: "*.cpp" fileTags: ["cpp"] } //... } \endcode Since the \c .cpp files are input files, they by definition have no other dependencies, and we can go back the opposite way in the tree starting with the compiler rule described above. This design works well for generated files. The \c .cpp artifacts could come from another rule that produced them by processing some other input, either instead of or in addition to the raw files listed in the product. The compiler rule will be invoked twice, once for each \c .cpp file, producing a separate object file for each one. Then the linker rule will be invoked. Its \c multiplex property is set to \c true, which means that instead of producing one output per input and invoking the rule multiple times, all input will be collected before invoking the rule only once to produce the final application object. The standard versus multiplex rules map well to the compiler and linker processes. The compiler takes one input file to produce one output file, whereas the linker takes multiple input files to produce one output file. Finally, after the linker rule has been invoked, it produces an artifact tagged \c application. Because the product's type property did not contain other file tags, the build process is now complete. */ /*! \previouspage overview.html \page setup.html \nextpage installing.html \title Setup \list \li \l{Installing} \li \l{Configuring Profiles and Preferences} \li \l{Managing Qt Versions} \endlist */ /*! \previouspage reference.html \page building-qbs.html \nextpage porting-to-qbs.html \title Appendix A: Building Qbs \QBS can be \l{Installing}{installed from binary packages} or built from sources, as described in this appendix. In addition, this appendix describes how to use Docker images for developing \QBS. \section1 Supported Platforms \QBS can be installed and run on the following platforms: \list \li Windows 7, or later \li Linux (tested on Debian 8 and 9, Ubuntu 16.04, OpenSuSE 13.2, and Arch Linux) \li macOS 10.7, or later \endlist \section1 System Requirements To build \QBS from the source, you need: \list \li Qt 5.15, or later \li Windows: MinGW with GCC 4.9 or Microsoft Visual Studio 2015, or later \li Linux: GCC 4.9, or later, or Clang 3.9.0, or later \li macOS: Xcode 6.2, or later \endlist An installed toolchain has to match the one that Qt was compiled with. \section2 Documentation Building the \QBS documentation requires Python 2.7 or 3.2 or above, as well as some third party Python modules. These can be installed via \c pip: \code pip install beautifulsoup4 lxml \endcode Regenerating the man page requires the \c help2man tool. \section1 Building \QBS with СMake To build \QBS, enter the following commands: \code mkdir build && cd build cmake -DQt5_DIR=${QT_DIR}/lib/cmake/Qt5/ .. make \endcode Where \c ${QT_DIR} is the directory where Qt is installed. Passing the \c Qt5_DIR option is not necessary if \c qmake is present in \c PATH. Depending on your platform, you might use \c mingw32-make, \c nmake, or \c jom instead of \c make. Alternatively, you can use the \l{https://cmake.org/cmake/help/latest/generator/Ninja.html}{Ninja} generator: \code cmake -GNinja -DQt5_DIR=${QT_DIR}/lib/cmake/Qt5/ .. ninja \endcode \section2 CMake Configure Options \QBS recognizes the following CMake options (passed to CMake in the form of \c{-DOPTION=value}) to customize the build: \table \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 \li \c OFF \row \li INSTALL_PUBLIC_HEADERS \li Whether to install public headers. \li \c ON \endtable \section2 Using ccache with CMake To enable using \l{https://ccache.dev}{ccache} when building \QBS, pass the following options to CMake: \code cmake -DQt5_DIR=${QT_DIR}/lib/cmake/Qt5/ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. \endcode \section1 Building \QBS with \QBS It is also possible to build \QBS with the previously installed \QBS version. To build \QBS, enter the following command in the source directory: \code qbs \endcode This will use the \c defaultProfile or pick up the Qt version and the toolchain from the \c PATH if the \c defaultProfile is not set. See \l {Configuring Profiles and Preferences} for details about profiles. To run automatic tests, the \c autotest-runner product should be built: \code qbs build -p autotest-runner \endcode \QBS will use an empty profile when running tests which means it will try to autodetect toolchains, Qt versions and other things based on the system environment. It is possible to specify which profile should be used during the test-run by passing the \c QBS_AUTOTEST_PROFILE environment variable. This variable should be set prior to building \QBS itself; otherwise the \c resolve command should be used to update the environment stored in the buildgraph: \code export QBS_AUTOTEST_PROFILE=qt qbs resolve qbs build -p autotest-runner \endcode It is also possible to set up a separate profile for a particular testsuite. A profile for the \c tst_blackbox_android suite can be set up as follows: \code qbs setup-android pie export QBS_AUTOTEST_PROFILE_BLACKBOX_ANDROID=pie \endcode It might be useful to set up the directory with the \QBS settings to isolate the test environment: \code export QBS_AUTOTEST_SETTINGS_DIR=~/path/to/qbs/settings \endcode \section2 \QBS Build Options The \c qbsbuildconfig module can be used to customize the build. Properties of that module can be passed using command line as follows: \code qbs build modules.qbsbuildconfig.enableAddressSanitizer:true \endcode \QBS recognizes the following properties: \table \header \li Property \li Default value \li Notes \row \li enableAddressSanitizer \li \c false \li Whether to use address sanitizer or not. Enabling this option will add the -fsanitize=address flag. \row \li enableUnitTests \li \c false \li Enable additional autotests. Enabling this option will export some symbols that would otherwise be private. \row \li enableRPath \li \c true \li Use this property to disable the use of rpath. This can be used when packaging \QBS for distributions which do not permit the use of rpath, such as Fedora. \row \li installApiHeaders \li \c true \li Holds whether to install the header files for the \QBS libraries or not. This option is required to build against the \QBS libraries. \row \li enableBundledQt \li \c false \li Holds whether the Qt libraries that \QBS depends on will be bundled with \QBS during the \c install step. This option is only implemented on macOS. \row \li libDirName \li \c "lib" \li Directory name used by \c libInstallDir and \c importLibInstallDir properties. \row \li appInstallDir \li \c "bin" \li Relative directory path under the install prefix path to put application binaries. \row \li libInstallDir \li \c "bin" on Windows, \c libDirName otherwise \li Relative directory path under the install prefix path where to put shared libraries (excluding plugins, see the \c relativePluginsPath property). \row \li importLibInstallDir \li \c libDirName \li Relative directory path under the install prefix path where to put import libs. \row \li libexecInstallDir \li \c appInstallDir on Windows, \c "libexec/qbs" otherwise \li Relative directory path under the install prefix path where to put auxiliary binaries executed by the \QBS libraries. \row \li systemSettingsDir \li \c undefined \li Directory that will be used by \QBS to store its settings. If not specified, a default platform-dependent directory is used. \row \li installManPage \li \c true on Unix, \c false otherwise \li Whether to install man pages. \row \li installHtml \li \c true \li Whether to install HTML help pages. \row \li installQch \li \c false \li Whether to install qch files. See \l{https://doc.qt.io/qt-5/qthelp-framework.html}{The Qt Help Framework} for details about qch files. \row \li generatePkgConfigFiles \li auto-detected \li Whether to generate files for pkg-config. \row \li generateQbsModules \li auto-detected \li Whether to generate \QBS modules for the exported \QBS libraries. Use this when building another product against \QBS libraries using \QBS as build system. \row \li docInstallDir \li \c "share/doc/qbs/html" \li Relative directory path under the install prefix path where to put documentation. \row \li pkgConfigInstallDir \li \c libDirName + \c "/pkgconfig" \li Relative directory path under the install prefix path where to put pkg-config files. \row \li qbsModulesBaseDir \li \c libDirName + \c "/qbs/modules" \li Relative directory path under the install prefix path where to put \QBS modules. Applies only when \c generateQbsModules is \c true. \row \li relativeLibexecPath \li \c "../" + \c libexecInstallDir \li Path to the auxiliary binaries relative to the application binary. \row \li relativePluginsPath \li \c "../" + \c libDirName \li Path to plugin libraries relative to the application binary. \row \li relativeSearchPath \li \c ".." \li Relative path to the directory where to look for \QBS development modules and items. \row \li libRPaths \li auto-detected \li List of rpaths. \row \li resourcesInstallDir \li \c "" \li Relative directory path under the install prefix path where to put shared resources like documentation, \QBS user modules and items. \row \li pluginsInstallDir \li \c libDirName + \c "/qbs/plugins" \li Relative path to the directory where to put plugins to. \endtable \section1 Using Docker A set of Docker images for developing \QBS (which are maintained by the \QBS team) is available \l{https://hub.docker.com/u/qbsbuild/}{on Docker Hub}. Both Windows 10 and Debian Linux container types are available. \note The source code for the \QBS development Docker images is located in the \c{docker/} directory of the \QBS source tree, if you wish to build them yourself. \section2 Linux Containers The easiest way to get started is to build \QBS using a Linux container. These types of containers are supported out of the box on all the supported host platforms: Windows, macOS, and Linux. The images provide everything that is necessary to build and test \QBS: \list \li Qt SDK for building \QBS with \c qmake \li Latest stable release of \QBS for building \QBS with \QBS \endlist We are using docker-compose for building and running the Docker images because it simplifies the Docker command line and ensures that the correct image tag is used. All available images are listed in the \c docker-compose.yml file in the project root directory. Run the following command to download the \QBS development image based on Ubuntu 20.04 \e Focal: \code docker-compose pull focal \endcode You can then create a new container with the \QBS source directory mounted from your host machine's file system, by running: \code docker-compose run --rm focal \endcode You will now be in an interactive Linux shell where you can develop and build \QBS. \section2 Windows Containers To build \QBS for Windows using Windows containers, your host OS must be running Windows 10 Pro and have Hyper-V enabled. \l{https://docs.docker.com/docker-for-windows/#switch-between-windows-and-linux-containers}{Switch your Docker environment to use Windows containers}. We are using docker-compose for building and running the Docker images because it simplifies the Docker command line and ensures that the correct image tag is used. All available images are listed in the \c docker-compose.yml file in the project root directory. Run the following command to download the \QBS development image based on Windows 10: \code docker-compose pull windows \endcode You can then create a new container with the \QBS source directory mounted from your host machine's file system, by running: \code docker-compose run --rm windows \endcode If you want to use Windows containers on a macOS or Linux host, you will have to create a virtual machine running Windows 10 and register it with \c{docker-machine}. There is at least \l{https://github.com/StefanScherer/windows-docker-machine}{one Open Source project} that helps to facilitate this by using using Packer, Vagrant, and VirtualBox. The \c{docker run} command to spawn a Windows container on a Unix host will look slightly different (assuming \c windows is the name of the Docker machine associated with the Windows container hosting VM): \code eval $(docker-machine env windows) docker-compose run --rm windows \endcode \section2 Building Release Packages Release packages for \QBS for Windows can be built using the following command on Windows: \code docker-compose run --rm windows cmd /c scripts\make-release-archives \endcode For building release packages for Windows on macOS or Linux: \code eval $(docker-machine env windows) docker-compose run --rm windows cmd /c scripts\\make-release-archives \endcode */ /*! \previouspage setup.html \page installing.html \nextpage configuring.html \title Installing \QBS binaries are available for Windows, macOS, Linux, and FreeBSD. On all platforms, \QBS binaries are part of the \l{Qt Creator} and \l{Qt SDK} installers. You can find the \c qbs executable in the \c bin directory of Qt Creator, or within the application bundle's \c MacOS directory on macOS. \QBS can also be built locally from sources. For more information, see \l{Appendix A: Building Qbs}. \section1 Windows The Qt Project provides prebuilt binaries for Windows (x86 and x64) at \l{https://download.qt.io/official_releases/qbs/}. For commercial customers of The Qt Company, the binaries are available in the \l {Qt Account}. The binaries are packaged in a .zip folder that can be extracted to a location of your choice. \QBS is also available as a \l Chocolatey package, which can be installed in the usual way: \code choco install qbs \endcode The \c .nupkg file can also be downloaded directly from \l{https://download.qt.io/official_releases/qbs/} for \l{https://chocolatey.org/security#organizational-use-of-chocolatey}{offline installation}. \section1 macOS \QBS can be conveniently installed on macOS with the \l{MacPorts} or \l{Homebrew} package managers: \code brew install qbs \endcode or \code port install qbs \endcode \section1 Linux and FreeBSD \QBS is \l{https://repology.org/metapackage/qbs/versions}{available via the package management systems} of Linux distributions, and FreeBSD. */ /*! \previouspage installing.html \page configuring.html \nextpage qt-versions.html \title Configuring Profiles and Preferences Profiles contain properties that apply to one or more projects. They are stored independently of the project files and are usually not shared between build hosts. Typically, profiles contain module properties, such as installation paths of tools or libraries on the host computer. This approach has the following advantages, among others: \list \li Team members with different computer setups can work together smoothly because no host-specific settings end up in the project files. \li Different versions of a tool or library can be used to build the same project without affecting each other. \endlist For example, a profile for building C++ applications contains at least the installation path and the type of the compiler toolchain. A profile for building Qt applications contains the toolchain-specific properties as well as \l{Qt::qmakeFilePaths}{the path to the Qt installation}. This topic describes profiles stored in the \QBS settings. In some cases it might be beneficial to keep profiles explicitly in the project sources. This can be achieved with the \l{Profile} item. \section1 Setting Up Toolchain Profiles \QBS comes with a helper tool \l{setup-toolchains} that can create profiles for many toolchains. Open a terminal window and type: \code qbs setup-toolchains --detect \endcode This will automatically set up a profile for each detected toolchain on your computer. You can list the existing profiles by running: \code qbs config --list profiles \endcode Some toolchains, especially for bare-metal targets, may require additional module properties. Those can be added with the \l{config} or the \l{config-ui} tools. Now you should be ready to build your first project with \QBS. Go into examples/helloworld-minimal and type: \code qbs build profile: \endcode You have successfully built your first \QBS project. If you want to build projects that use Qt, additional steps might be necessary. Please refer to \l{Managing Qt Versions} for more information. \section1 Global Preferences In addition to profiles, \QBS provides some global preferences such as \c qbsSearchPaths and \c defaultProfile. \section1 Managing Profiles and Preferences You can use the \l{config} command to manage all \QBS configuration settings, such as profiles and global preferences from the command line, for example: \code qbs config profiles..qbs.architecture arm \endcode For convenience, \QBS provides a tool \l{config-ui} where you can manage the settings in a hierarchical view. \image qbs-settings-gui.png \QBS Settings displays the keys in the specified settings directory and their values. To expand all keys, select \uicontrol View > \uicontrol {Expand All} (\key Ctrl+E or \key Cmd+E on macOS). To collapse all keys, select \uicontrol {Collapse All} (\key Ctrl+C or \key Cmd+C). To change the value of a key, double-click it and enter the new value. To save your changes, select \uicontrol File > \uicontrol Save. To refresh the settings from the settings directory, select \uicontrol File > \uicontrol Reload. */ /*! \previouspage configuring.html \page qt-versions.html \nextpage usage.html \title Managing Qt Versions \section1 Introduction If your environment has the right \c qmake binary in its \c PATH and is also set up properly for a matching toolchain, then you do not necessarily need a profile to build projects with a Qt dependency. Otherwise, you should create one: \code qbs setup-qt /usr/bin/qmake myqt \endcode This will create the \c myqt profile which can then be used on the command line: \code qbs profile:myqt \endcode \note If the \c setup-toolchains command has found more than one toolchain, you will need to manually link your Qt profile to one of them, like this: \code qbs config profiles.myqt.baseProfile \endcode \section1 Multiple Qt Builds To support multiple Qt builds, or in fact any combination of related settings, you need to create several profiles. The following example illustrates how to set up three different profiles, each for a different Qt build: \code qbs setup-qt ~/dev/qt/4.7/bin/qmake qt47 qbs setup-qt ~/dev/qt/4.8/bin/qmake qt48 qbs setup-qt ~/dev/qt/5.0/qtbase/bin/qmake qt5 \endcode You can set the default Qt build like this: \code qbs config defaultProfile qt5 \endcode To choose a Qt build that is different from the default, use: \code qbs build profile:qt48 \endcode You can set other properties in a profile (not just Qt ones), in the same way you override them from the command line. For example: \code qbs setup-qt C:\Qt\5.0.0\qtbase\bin\qmake.exe qt5 qbs config profiles.qt5.qbs.architecture x86_64 qbs config profiles.qt5.baseProfile msvc2010 \endcode The last example uses the inheritance feature of profiles. All settings in the profile set as \c baseProfile are known in the derived profile as well. They can of course be overridden there. */ /*! \previouspage qt-versions.html \page usage.html \nextpage language-introduction.html \title Usage \list \li \l{Language Introduction} \li \l{Building Applications} \li \l{Running Applications} \li \l{Installing Files} \li \l{Target Platforms} \li \l{Using the Shell} \li \l{Generators} \li \l{Multiplexing} \li \l{Custom Modules and Items} \li \l{Special Property Values} \li \l{Module Providers} \endlist */ /*! \previouspage usage.html \page language-introduction.html \nextpage building-applications.html \title Language Introduction \QBS uses project files (*.qbs) to describe the contents of a project. A project contains one or more \l{Product}{products}. A product is the target of a build process, typically an application, library or maybe a tar ball. \note \QBS source files are assumed to be UTF-8 encoded. \section1 The Obligatory Hello World Example \QBS project files are written using a QML dialect. A very simple C++ hello world project looks like this: \code ---helloworld.qbs--- Application { name: "helloworld" files: "main.cpp" Depends { name: "cpp" } } \endcode \a Application describes the product we want to build. In this case, an application. This is just a shortcut for writing \code Product { type: "application" // ... } \endcode The \a name is the name of the product. In this case it is also the name of the produced executable (on Windows, the ".exe" extension is added by default). In the property \a files, we specify the source files for our product. Unlike QML, the right-hand side can be either a string or a string list. A single string is converted to a stringlist containing just one element. So we could have also written \code files: [ "main.cpp" ] \endcode \a Depends adds the dependency to the \l{cpp} module. This is necessary to let \QBS know that we have a C++ project and want to compile main.cpp with a C++ compiler. For more information about \QBS modules, see \l{Modules}. \section1 Reusing Project File Code QML-like inheritance works also in \QBS. \code ---CrazyProduct.qbs--- Product { property string craziness: "low" files: [ "Crazy.h", "Crazy.cpp" ] } ---hellocrazyworld.qbs--- import "CrazyProduct.qbs" as CrazyProduct CrazyProduct { craziness: "enormous" name: "hellocrazyworld" files: base.concat(["main.cpp"]) // ... } \endcode You can put JS code into separate \c{.js} files and then import them. \code ---helpers.js--- function planetsCorrectlyAligned() { // implementation } ---myproject.qbs--- import "helpers.js" as Helpers Product { name: "myproject" Group { condition: Helpers.planetsCorrectlyAligned() file: "magic_hack.cpp" } // ... } \endcode See \l {Special Property Values} for more details about the \l base property. \section1 Modules A \e module is a collection of properties and language items that are used for building a product if the product depends on (or loads) the module. For example, the \a cpp module looks like this (simplified): \code Module { name: "cpp" property string warningLevel property string optimization property bool debugInformation property pathList includePaths // ... FileTagger { patterns: "*.cpp" fileTags: ["cpp"] } Rule {...} // compiler Rule {...} // application linker Rule {...} // static lib linker Rule {...} // dynamic lib linker } \endcode The properties that can be set for the \a cpp module are used to control the behavior of your C++ toolchain. In addition, you can use FileTaggers and Rules that are explained later. As soon as your product depends on a module, it can set the properties of the module. You specify the optimization level for your product (and all build variants) like this: \code ---helloworld.qbs--- Application { name: "helloworld" files: ["main.cpp"] cpp.optimization: "ludicrousSpeed" Depends { name: "cpp" } } \endcode A module can depend on other modules. For example, the \l{Qt.core} module depends on the \l{cpp} module. The module dependencies are transitive, i.e. in a Product, all dependent modules are accessible: \code Application { name: "helloworld" files: ["main.cpp"] Depends { name: "Qt.core" } // the "cpp" module is available since // "Qt.core" depends on "cpp". cpp.optimization: "ludicrousSpeed" } \endcode \section2 Different Properties for a Single File Not only the product, but all the source files of the product can have their own set of module properties. For example, assume you have some files that are known to crash your compiler if you turn on optimizations. You want to turn off optimizations for just these files and this is how you do it: \code Application { name: "helloworld" files: "main.cpp" Group { files: ["bad_file.cpp", "other_bad_file.cpp"] cpp.optimization: "none" } Depends { name: "cpp" } } \endcode \section2 Selecting Files by Properties Sometimes you have a file that is only going to be compiled on a certain platform. This is how you do it: \code Group { condition: qbs.targetOS.includes("windows") files: [ "harddiskdeleter_win.cpp", "blowupmonitor_win.cpp", "setkeyboardonfire_win.cpp" ] } Group { condition: qbs.targetOS.includes("linux") files: [ "harddiskdeleter_linux.cpp", "blowupmonitor_linux.cpp", "setkeyboardonfire_linux.cpp" ] } \endcode In the above example, \l{qbs::targetOS}{qbs.targetOS} is a property of the target of the the \l{qbs} module. The \c qbs module is always implicitly loaded. Its main properties are: \list \li \l{qbs::}{buildVariant} that specifies the name of the build variant for the current build. \li \l{qbs::}{targetOS} that specifies the operating system you want to build the project for. \endlist You can set these properties on the command line or by using a profile. \code $ qbs # qbs.buildVariant:debug, profile: (or profile:none, if no default profile exists) $ qbs config:release # qbs.buildVariant:release, profile: $ qbs config:debug config:release # builds two configurations of the project $ qbs profile:none # all module properties have their default values \endcode To select files by build variant: \code Group { condition: qbs.buildVariant == "debug" files: "debughelper.cpp" } \endcode To set properties for a build variant: \code Properties { condition: qbs.buildVariant == "debug" cpp.debugInformation: true cpp.optimization: "none" } \endcode Or, to use a more QML-like style: \code cpp.debugInformation: qbs.buildVariant == "debug" ? true : false cpp.optimization: qbs.buildVariant == "debug" ? "none" : "fast" \endcode \section1 Property Types While properties in \QBS generally work the same way as in QML, the set of possible property types has been adapted to reflect the specific needs of a build tool. The supported types are as follows: \table \header \li Property type \li Example \li Description \row \li \c bool \li \c{property bool someBoolean: false} \li The usual boolean values. \row \li \c int \li \c{property int theAnswer: 42} \li Integral numbers. \row \li \c path \li \c{property path aFile: "file.txt"} \li File paths resolved relative to the directory the product they are associated with is located in. \row \li \c pathList \li \c{property pathList twoFiles: ["file1.txt", "./file2.txt"]} \li A list of \c path values. \row \li \c string \li \c{property string parentalAdvisory: "explicit lyrics"} \li JavaScript strings. \row \li \c stringList \li \c{property stringList realWorldExample: ["no", "not really"]} \li A list of JavaScript strings. \row \li \c var \li \c{property var aMap: ({ key1: "value1", key2: "value2" })} \li Generic data, as in QML. \row \li \c varList \li \c{property var aMapList: [{ key1: "value1", key2: "value2" }, { key1: "value3" }]} \li A list of generic data, typically JavaScript objects. \endtable \section1 Overriding Property Values from the Command Line Property values set in project files or profiles can be overridden on the command line. The syntax is \c{.:}. The following command lines demonstrate how to set different kinds of properties: \code $ qbs projects.someProject.projectProperty:false # set a property of a project $ qbs products.someProduct.productProperty:false # set a property of a product $ qbs modules.cpp.treatWarningsAsErrors:true # set a module property for all products $ qbs products.someProduct.cpp.treatWarningsAsErrors:true # set a module property for one product \endcode Property values on the command line can also be expressed in JavaScript form, the same way as you would write them in a project file. Make sure to take care of proper quoting, so that the shell does not interpret any of the values itself. Properties of type \c stringList can also be provided as comma-separated values, if none of the strings contain special characters: \code $ qbs projects.someProject.listProp:'["a", "b", "c"]' $ qbs projects.someProject.listProp:a,b,c # same as above $ qbs projects.someProject.listProp:'["a b", "c"]' # no CSV equivalent \endcode \section1 File Tags and Taggers \QBS itself knows nothing about C++ files or file extensions. All source files in a product are handled equally. However, you can assign \a{file tags} to an artifact to act as a marker or to specify a file type. An artifact can have multiple file tags. For example, you can use the \a Group item to group files with the same file tags (or a set of properties). \code Product { Group { files: ["file1.cpp", "file2.cpp"] fileTags: ["cpp"] } Group { files: "mydsl_scanner.l" fileTags: ["flex", "foobar"] } // ... } \endcode When you load the \a cpp module, you also load the following item: \code FileTagger { patterns: "*.cpp" fileTags: ["cpp"] } \endcode This construct means that each source file that matches the pattern \c{*.cpp} (and has not explicitly set a file tag) gets the file tag \c{cpp}. The above example can be simplified to \code Product { Depends: "cpp" files: ["file1.cpp", "file2.cpp"] Group { files: "mydsl_scanner.l" fileTags: ["flex", "foobar"] } // ... } \endcode The \a FileTagger from the \a cpp module automatically assigns the \c cpp file tag to the source files. Groups that just contain the \a files property can be more simply expressed by using the \a files property of the product. File tags are used by \a rules to transform one type of artifact into another. For instance, the C++ compiler rule transforms artifacts with the file tag \c cpp to artifacts with the file tag \c{obj}. In addition, it is possible to use file taggers to tag files and specify custom file tags: \code Product { Depends: "cpp" Group { overrideTags: false // The overrideTags property defaults to true. fileTags: ["foobar"] files: ["main.cpp"] // Gets the file tag "cpp" through a FileTagger item and // "foobar" from this group's fileTags property. } // ... } \endcode \section1 Rules \QBS applies a \e rule to a pool of artifacts (in the beginning it is just the set of source files of the project) and chooses the ones that match the input file tags specified by the rule. Then it creates output artifacts in the build graph that have other filenames and file tags. It also creates a script that transforms the input artifacts into the output artifacts. Artifacts created by one rule can (and typically do) serve as inputs to another rule. In this way, rules are connected to one another via their input and output file tags. For examples of rules, see the share/qbs/modules directory in the \QBS repository. You can define rules in your own module to be provided along with your project. Or you can put a rule directly into your project file. For more information, see \l{Rule}. */ /*! \previouspage language-introduction.html \page building-applications.html \nextpage running-applications.html \title Building Applications This section assumes that \QBS is present in \c PATH. For the details how to install \QBS, see the \l{Installing} page. To build applications from the command line, enter the following commands: \code cd examples/collidingmice qbs \endcode By default, \QBS uses all the CPU cores available to achieve maximum build parallelization. To explicitly specify the number of concurrent jobs, use the \c -j option. For example, to run 4 concurrent jobs, enter the following command: \code qbs -j4 \endcode The application is built using the default build profile that is set up in your \QBS configuration. You can use the \l{config} command to set the max number of jobs per profile. For example, to set four jobs as the default option for a profile named \e Android, enter the following command: \code qbs config profiles.Android.preferences.jobs 4 \endcode To build with other profiles than the default one, specify options for the \l{build} command. For example, to build debug and release configurations with the \e Android profile, enter the following command: \code qbs build profile:Android config:debug config:release \endcode The position of the property assignment is important. In the example above, the profile property is set for all build configurations that come afterwards. To set a property just for one build configuration, place the assignment after the build configuration name. In the following example, the property \l{cpp::treatWarningsAsErrors} {cpp.treatWarningsAsErrors} is set to \c true for debug only and \l{cpp::optimization}{cpp.optimization} is set to \c small for release only. \code qbs build config:debug modules.cpp.treatWarningsAsErrors:true config:release modules.cpp.optimization:small \endcode Projects are built in the debug build configuration by default. */ /*! \previouspage running-applications.html \page installing-files.html \nextpage {Target Platforms} \title Installing Files To install your project, specify the necessary information in the project file: \code Application { Group { name: "Icons" files: "*.png" qbs.install: true qbs.installDir: "share/icons/myproject" } Group { name: "Docs" fileTagsFilter: "generated_docs" qbs.install: true qbs.installDir: "share/man/man7" } } \endcode In this example, we want to install some \c{.png} files and documentation built by the project. The Application is installed automatically unless the \l{Application::install}{install} property is set to \c false. When building, \QBS installs artifacts into the default root folder, namely \c{/install-root}. The \l{qbs::installPrefix}{qbs.installPrefix} and \l{qbs::installDir}{qbs.installDir} properties are appended to the root folder. \code qbs build qbs.installPrefix:/usr \endcode In this example, the executable will be installed into the \c{/install-root/usr/bin} folder and the QML files will be installed into the \c{/install-root/usr/share/myproject} folder. To skip installation during the build, use the \c --no-install option. To override the default location, use the \c --install-root option of the \c{qbs install} command: \code qbs build --no-install qbs.installPrefix:/usr sudo qbs install --no-build --install-root / \endcode In this example, artifacts will be installed directly into the \c /usr folder. Since the \c{qbs install} command implies \c build, we use the \c --no-build parameter to ensure that we do not accidentally rebuild the project, thereby changing the artifacts' owner to \c root. Sometimes, it makes sense to install the application into a temporary root folder, keeping the same folder structure within that root folder as in the examples above; for instance, when building a Linux package such as \c deb or \c rmp. To install the application into the \c /tmp/myProjectRoot folder, use the following command: \code $ qbs install --install-root /tmp/myProjectRoot \endcode In this example, the executable will be installed into the \c{/tmp/myProjectRoot/usr/bin} folder and QML files will be installed into the \c{/tmp/myProjectRoot/usr/share/myproject} folder. To remove all files from the install root prior to installing, use the \c --clean-install-root parameter: \code qbs install --clean-install-root --install-root /tmp/myProjectRoot \endcode For more information about how the installation path is constructed, see \l {Installation Properties}. */ /*! \previouspage building-applications.html \page running-applications.html \nextpage installing-files.html \title Running Applications Qbs has the convenience \l{run}{qbs run} command that simplifies running applications. For example, entering the following command runs the Qt Creator application: \code qbs run --products qtcreator \endcode By default, running an application also builds it and installs it to a location from where it can be run on the desktop or on a device. Also, this command \l{Module::setupRunEnvironment}{sets up} the environment so that the application can find dependent libraries. This is not the case when running the binary manually - you'll have to make sure that the app will find its dependencies and/or is relocatable. You can achieve that by \l{How do I make use of rpaths?}{configuring rpaths} properly or setting the appropriate environment variable for the respective host system. */ /*! \previouspage {Target Platforms} \page shell.html \nextpage generators.html \title Using the Shell To use the \QBS shell, enter the following command: \code qbs shell \endcode This is mainly a debugging tool. It opens a shell with the same environment that \QBS uses when building the project, so you can, for example, inspect which environment variables will be set up. */ /*! \previouspage multiplexing.html \page custom-modules.html \nextpage special-property-values.html \title Custom Modules and Items Users of \QBS are not limited to the pre-defined \l{List of Modules}{modules} and \l{List of Language Items}{items}, they can also create their own. Here we describe how to set up custom modules and items so that \QBS will find them. \section1 File System Layout Items and modules are located under a common base directory, whose name and location is completely arbitrary. We will refer to it as \c search-path here. This directory has two subdirectories \c modules and \c imports, which contain \QBS modules and items, respectively. \section1 Custom Modules To introduce a custom module \c mymodule, create a directory \c{search-path/modules/mymodule/}. \note Module names are case-sensitive, and this also goes for the corresponding directory name. Then, put a file containing an instance of the \l{Module} in there and give it the \c{.qbs} extension. This module will be pulled in if a \l{Product}{product} declares a \l{Depends}{dependency} on \c mymodule. \section1 Custom Items To introduce a custom item \c MyItem, create the file \c{search-path/imports/MyItem.qbs}. \note Item file names must start with a capital letter due to the fact that type names can only start with a capital letter. Otherwise, the file will be silently ignored. \section1 Making \QBS Aware of Custom Modules and Items To be able to use your custom modules and items, you need to make them known to \QBS. You can do this per project or globally. \section2 Project-specific Modules and Items Let's assume you have a project that is located in \c{project_dir} and you have created some modules in \c{project_dir/custom-stuff/modules/} as well as some items in \c{project_dir/custom-stuff/imports/} that you want to use in the project. To achieve this, your top-level project file should look like this: \code // ... Project { // .. qbsSearchPaths: "custom-stuff" // .. } \endcode \note For technical reasons, the custom modules and items will not be available in the file that contains the \l{Project::qbsSearchPaths} {Project.qbsSearchPaths} property. Any product that wants to make use of them needs to be in a different file that is pulled in via the \l{Project::references}{Project.references} property, for example. This is not a serious limitation, since every well-structured project will be split up in this manner. \section2 Making Custom Modules and Items Available Across Projects What if your modules and items are generally useful and you want to access them in several projects? In this case, it is best to add the location to your preferences. For example: \code qbs config preferences.qbsSearchPaths /usr/local/share/custom-qbs-extensions \endcode */ /*! \previouspage custom-modules.html \page special-property-values.html \nextpage module-providers.html \title Special Property Values Depending on the context, \QBS provides the following special values for use in property bindings and JavaScript code: \list \li \l base \li \l exportingProduct \li \l filePath \li \l importingProduct \li \l module \li \l original \li \l outer \li \l path \li \l product \li \l project \endlist \section2 \c base This value is useful when making use of inheritance. It stands for the value of the respective property in the item one level up in the inheritance chain. For instance: \code Product { // defined in MyProduct.qbs Depends { name: "mymodule" } mymodule.someProperty: ["value1"] } ------ some other file ------ MyProduct { mymodule.someProperty: base.concat(["value2"]) // => ["value1", "value2"] } \endcode \section2 \c exportingProduct Within an \l Export item, you can use the \c exportingProduct variable to refer to the product which defines the Export item: \code Product { Export { Depends { name: "cpp" } cpp.includePaths: exportingProduct.sourceDirectory } } \endcode \section2 \c filePath This value holds the full file path to the \c .qbs file it appears in. This property is rarely used, but might be useful when debugging: \code Product { property bool dummy: { console.info("I'm located at " + filePath); } } \endcode \section2 \c importingProduct Within an \l Export item, you can use the \c importingProduct variable to refer to the product that pulls in the resulting module: \code Product { Export { Depends { name: "cpp" } cpp.includePaths: importingProduct.buildDirectory } } \endcode Usually, you should use the \l product variable instead for consistency with \l Module items. \section2 \c module This value holds the properties of the module that contains the current item: \code Module { property bool enableGroup property bool enableRule Group { condition: enableGroup // available without qualification because Module is a direct parent item Rule { condition: module.enableRule // Shortcut for product..enableRule // ... } } } \endcode \section2 \c original On the right-hand side of a module property binding, this refers to the value of the property in the module itself (possibly overridden from a profile). Use it to set a module property conditionally: \code Module { // This is mymodule property string aProperty: "z" } ---------- Product { Depends { name: "mymodule" } Depends { name: "myothermodule" } // "y" if myothermodule.anotherProperty is "x", "z" otherwise: mymodule.aProperty: myothermodule.anotherProperty === "x" ? "y" : original } \endcode \note In all but the most exotic cases, a \l{Properties} item is the preferred way to achieve the same result: \code Product { Depends { name: "mymodule" } Depends { name: "myothermodule" } Properties { condition: myothermodule.anotherProperty === "x" mymodule.aProperty: "y" } \endcode \section2 \c outer This value is used in nested items, where it refers to the value of the respective property in the surrounding item. It is only valid in \l{Group} and \l{Properties} items: \code Product { Depends { name: "mymodule" } mymodule.someProperty: ["value1"] Group { name: "special files" files: ["somefile1", "somefile2"] mymodule.someProperty: outer.concat(["value"]) // => ["value1", "value2"] } } \endcode \section2 \c path This value holds the path to the folder where the \c .qbs file is located. Use it to e.g. add the product's directory to file paths: \code Product { Depends { name: "cpp" } cpp.includePaths: path } \endcode \section2 \c product This value holds the properties of the product that contains the current item or pulls in the current module: \code Module { Rule { Artifact { fileTags: product.type filePath: { var result = input.fileName; // module properties are available as well if (product.qbs.buildVariant === "debug") result = result + "_debug"; result = result + ".out"; return result; } } } } \endcode Within the \l Export item, same as \l importingProduct. \section2 \c project This value holds the properties of the project that references the current item or pulls in the current module: \code Project { property bool enableProduct: true Product { name: "theProduct" condition: project.enableProduct } } \endcode If the nearest project in the project tree does not have the desired property, \QBS looks it up in the parent project, potentially all the way up to the top-level project. */ /*! \previouspage special-property-values.html \page module-providers.html \nextpage tutorial.html \title Module Providers There are use cases for which a pre-defined module is not flexible enough. For instance, the overall set of modules related to a certain task might depend on some information present on the local platform. Use Module Providers to create new modules during the \c resolve stage, for example when locating external dependencies such as libraries. Consider the following example: \code CppApplication { files: "main.cpp" Depends { name: "zlib" } qbsModuleProviders: ["conan", "qbspkgconfig"] } \endcode Here, we want to use the \l{https://www.zlib.net}{zlib} compression library in our application. Since there is no pre-defined module called \c "zlib", \QBS will try to create it using Module Providers. \QBS will invoke all providers specified in the \l{Product::qbsModuleProviders}{qbsModuleProviders} property and those providers will create the requested module if possible. Providers contribute to the \l{Product::}{qbsSearchPaths} in the order specified by this property, so modules generated by providers specified earlier are prioritised. In the example above, modules created by the \l conan provider have higher priority than modules created by \c qbspkgconfig. \section1 Lookup Based on Module Name Originally, the \l{Qt} module provider was a the only provider in \QBS and we wanted to make its usage transparent to users. Thus, it was implemented by automatically kicking in when \QBS saw the dependency on the \c Qt module such as "Qt.core". It is also possible to specify the order of providers explicitly: \code CppApplication { files: "main.cpp" Depends { name: "Qt.core" } qbsModuleProviders: ["Qt", "qbspkgconfig"] } \endcode That way, users have more control over the module priorities. Note that setting the \c qbsModuleProviders property disables the lookup based on the module name entirely. \section1 Provider Eagerness Historically, providers were implemented in an \e eager way meaning that once a provider is called, it creates as many modules as it can. For example, when called, the \l{qbspkgconfig} provider created a module for each .pc file found in the system. Even though providers are quite fast, this violates the zero-overhead principle (you don't pay for what you don't use). Thus, we introduced non-eager providers which only create one module at a time when that module is requested by the \l{Depends} item. This behavior is controlled by the \l{ModuleProvider::isEager}{isEager} property. We advise against using eager providers in new code. \section1 Selecting Module Providers As described above, you can select which providers to run using the \l{Product::qbsModuleProviders}{qbsModuleProviders} property. This property can be set on the Product as well as the \l{Project::qbsModuleProviders}{Project} level: \code $ qbs resolve project.qbsModuleProviders:providerA \ # sets property globally for the Project projects.SomeProject.qbsModuleProviders:providerB \ # overrides property for the specific Project products.SomeProduct.qbsModuleProviders:providerC \ # overrides property for the specific Product \endcode \section1 Parameterizing Module Providers You can pass information to module providers from the command line, via profiles or from within a product, in a similar way as you would do for modules. For instance, the following invocation of \QBS passes information to two module providers \c a and \c b: \code $ qbs moduleProviders.a.p1:true moduleProviders.a.p2:true moduleProviders.b.p:false \endcode \QBS will set the properties of the respective module providers accordingly. In the above example, module provider \c a needs to declare two boolean properties \c p1 and \c p2, and they will be set to \c true and \c false, respectively. \note The following section contains some implementation details. Reading this section is not required for most people's everyday work. \section1 How \QBS Uses Module Providers If \QBS encounters a \l Depends item whose name does not match a known module, it checks whether such a module can be generated. This procedure works as follows: \list 1 \li If the \l{Product::qbsModuleProviders}{qbsModuleProviders} property is not \c undefined, for each provider name in the list, all \l{Project::qbsSearchPaths}{search paths} are scanned for a file called \c {module-providers/.qbs} or \c {module-providers//provider.qbs}. \li If the \l{Product::qbsModuleProviders}{qbsModuleProviders} property is \c undefined, \l{Project::qbsSearchPaths}{search paths} are scanned for a file called \c {module-providers//provider.qbs}, where \c is the name of the dependency as specified in the \c Depends item. Multi-component names such as "a.b" are turned into nested directories, and each of them is scanned, starting with the deepest path. For instance, if the dependency's name is \c {a.b}, then \QBS will look for \c {a/b/provider.qbs} and then \c {a/provider.qbs}. \li If such a file is found, it needs to contain a \l ModuleProvider item. This item is instantiated, which potentially leads to the creation of one or more modules, and \QBS retrieves the search paths to find these modules from the item. The details are described in the \l ModuleProvider documentation. \li If a matching module provider was found and provided new search paths, a second attempt will be made to locate the dependency using the new paths. The search for a matching module provider ends as soon as one was found, regardless of whether it created any modules or not. \endlist */ /*! \previouspage shell.html \page generators.html \nextpage multiplexing.html \title Generators Generators are a \QBS sub-tool and set of APIs that enable arbitrary processing to be performed on the build graph. Currently, they are used to integrate \QBS with popular IDEs, such as Microsoft Visual Studio, and to generate Clang compilation databases. \section1 Generating Microsoft Visual Studio Projects To generate a project for another build system, such as Microsoft Visual Studio, use the \l{generate}{qbs generate} command and specify a generator using the \l{generate-generator}{-g} option. For example: \code # For Visual Studio qbs generate -g visualstudio2015 \endcode \QBS will then generate a series of files in the current directory, based on the generator that was chosen. The resulting project files can be opened in the respective IDE and all work can be performed there. The project files will expose as much information as possible to the IDE and will use \QBS to perform the actual build. \note You cannot modify build system files and expect the changes to be reflected in \QBS. You must edit your \QBS project files and re-run \l{generate}{qbs generate} in order for the changes to be reflected in your IDE. \section1 Generating IAR Embedded Workbench Projects To generate a project for \l{https://www.iar.com/iar-embedded-workbench/} {IAR Embedded Workbench}, use the \l{generate}{qbs generate} command and specify a generator using the \l{generate-generator}{-g} option. For example: \code # For IAREW v8xxxx qbs generate -g iarew8 profile: qbs generate -g iarew8 -d -f profile: \endcode \note You need to specify a specific QBS profile, which is required for a generator to fetch a target architecture to generate the project. \note IAR EW generator creates a native target project. Supported IAR EW generators are listed in a table below: \table \header \li Generator \li IAR EW Version \li Target Architecture \row \li iarew8 \li All 8.x.y versions \li ARM \row \li iarew7 \li All 7.x.y versions \li AVR, MSP430 \row \li iarew10 \li All 10.x.y versions \li 8051 (aka MCS51) \row \li iarew3 \li All 3.x.y versions \li STM8 \endtable \section1 KEIL uVision Projects To generate a project for \l{https://www2.keil.com/mdk5/uvision/} {KEIL uVision}, use the \l{generate}{qbs generate} command and specify a generator using the \l{generate-generator}{-g} option. For example: \code # For KEIL UV5 qbs generate -g keiluv5 profile: qbs generate -g keiluv5 -d -f profile: \endcode \note You need to specify a specific QBS profile, which is required for a generator to fetch a target architecture to generate the project. \note KEIL UV generator creates a native target project. Supported KEIL UV generators are listed in a table below: \table \header \li Generator \li KEIL UV Version \li Target Architecture \row \li keiluv5 \li All 5.x.y versions \li 8051 (aka MCS51), ARM \endtable \section1 Generating Clang Compilation Databases To generate a \l{JSON Compilation Database Format Specification} {Clang compilation database (clangdb)}, use the following command: \code qbs generate --generator clangdb \endcode \section1 Generating Makefiles To generate a Makefile, use the following command: \code qbs generate --generator makefile \endcode \section2 Targets The generated Makefile will contain targets for all output artifacts known to \QBS. In addition, the following targets are created for every product: \list \li \c {} to build the product \li \c {clean-} to remove all files generated by the above target \li \c {install-} to install the product's artifacts that have \c{qbs.install} set \endlist In the above list, the placeholder \c{} stands for the product's name with all characters that are not ASCII letters, digits, dots or underscores replaced with underscore characters. The special target \c all builds all products whose \l{Product::builtByDefault}{builtByDefault} property is enabled. This is the default target. It is complemented by \c install and \c clean. \note The Makefile will not be able to build artifacts created by \l{JavaScriptCommand}{JavaScriptCommands}, because there is no command line to run for them. \section2 Pre-defined Variables The build directory and the install root are set to whatever you specified when calling the generator. If you did not specify anything, \QBS' default values are used. You can override these values when invoking the \c make tool by explicitly setting the \c{BUILD_ROOT} and \c{INSTALL_ROOT} variables, respectively. For instance: \code $ qbs generate -g makefile config:make modules.qbs.installRoot:/opt/mydir $ make -f make/Makefile # Will install to /opt/mydir $ make -f make/Makefile INSTALL_ROOT=/opt/myotherdir # Will install to /opt/myotherdir \endcode \section2 Spaces in Directory Names Due to the difficulties involved in making this work correctly, \QBS will refuse to generate a Makefile if the source, build or install root directories contain spaces. It will try to handle spaces in file names of output artifacts, though. \section2 Platform-specific Differences in Format \QBS assumes that the Makefile will be invoked on the current host platform, so that platform's tools will be used for copying and removing files, and path separators will be converted to backslashes on Windows. When dealing with spaces in artifact names, on Unix-like systems compatibility with GNU make is assumed with regards to quoting. \section1 Limitations Due to the high flexibility of the \QBS project format and build engine, some projects may be too complex to produce an equivalent project file for another build system. This list of limitations aims to be as small as possible, but one of the most notable (at least for the Microsoft Visual Studio generator) is that certain properties must contain the same value across all build configurations. For example, the following is not allowed: \code Product { // ERROR: 'name' property cannot have different values based on the configuration name: qbs.configuration === "debug" ? "MyProduct_debug" : "MyProduct" } \endcode \note This limitation only applies when property values are varied on the configuration name. For example, the following is OK (as long as the value of xyz itself does not vary across configurations): \code Product { // OK property bool isDebug: name: isDebug ? "MyProduct_debug" : "MyProduct" } \endcode The properties to which the limitation applies includes but is not limited to: \list \li \l{Product::name}{Product.name} \li \l{bundle::isBundle}{bundle.isBundle} \endlist If a simple workaround is possible in a particular case (for example, varying \l{Product::targetName}{Product.targetName} across configuration instead of \l{Product::name}{Product.name}, the generator will typically suggest it in the error message. */ /*! \previouspage generators.html \page multiplexing.html \nextpage custom-modules.html \title Multiplexing Multiplexing is an advanced \QBS feature that allows a product to be transparently built in multiple \e passes along with an optional, final \e aggregate pass that allows the output artifacts of the initial passes to be combined or otherwise operated on in some way. The multiplexing feature is used to implement certain platform-specific behavior: specifically, it allows applications and libraries on Apple platforms to be compiled into \e fat binaries containing multiple CPU architectures, the creation of Apple frameworks containing multiple \e variants (for example, combined debug and release builds), and the creation of Android application and library packages containing native code built for multiple Android ABIs. A product can be multiplexed over the \l{qbs::architectures} {qbs.architectures} property (which maps to \l{qbs::architecture} {qbs.architecture}), \l{qbs::buildVariants}{qbs.buildVariants} property (which maps to \l{qbs::buildVariant}{qbs.buildVariant}), and \l{qbs::profiles} {qbs.profiles} (which maps to \l{Project::profile}{Project.profile}). For example, to build a "fat" \c iOS binary containing two architectures, use the following command: \code qbs build modules.qbs.targetPlatform:ios modules.qbs.architectures:arm64,armv7a \endcode \note The implementation details around multiplexing are subject to change. Product multiplexing works by examining the \l{Product::multiplexByQbsProperties}{Product.multiplexByQbsProperties} property, which can be set to the list of properties your product should multiplex over. For example, \c multiplexByQbsProperties might contain two strings, \c "architectures" and \c "buildVariants". \QBS evaluates the values of \c qbs.architectures and \c qbs.buildVariants, which in turn might contain the values \c ["x86", "x86_64"] and \c ["debug", "release"]. \QBS will build all the possible configurations of the product: \c {(x86, debug)}, \c {(x86, release)}, \c {(x86_64, debug)}, and \c {(x86_64, release)}. If the \l{Product::aggregate}{Product.aggregate} property is \c true, the product will also be built a fifth time, with the values of the multiplexed properties left undefined. The aggregate product will have an automatic dependency on the original four instances of the product, allowing it to collect their output artifacts and to operate on them. The aggregate product is used in situations where the target artifacts of the individually multiplexed instances must be combined into one final aggregate artifact that makes up the overall product. Bundle products on Apple platforms use the aggregate product to create the bundle artifacts (such as \c Info.plist and \c PkgInfo) that are independent of a particular architecture or build variant. In addition, they use the \c lipo tool to join together the built native code for different architectures (such as \c x86 and \c x86_64) into the final, multi-architecture fat binary that the app bundle contains. */ /*! \previouspage json-api.html \page attributions.html \title Appendix D: Licenses and Code Attributions \section1 Licenses The \QBS library and tools are available under commercial licenses from \l{Qt Licensing}{The Qt Company}. In addition, they are available under \l{GNU Lesser General Public License, Version 3} (LGPL version 3) and \l{GNU General Public License, version 2} (GPL version 2). Shared functionality, which might be pulled in by user build scripts, is available under commercial licenses, \l{GNU Lesser General Public License, Version 2.1} (LGPL version 2.1) with \l{The Qt Company LGPL Exception version 1.1}, and LGPL version 3. Autotests are available under commercial licenses and \l{GNU General Public License Version 3, Annotated with The Qt Company GPL Exception 1.0}. Examples are available under commercial licenses and \l{BSD}. \section2 GNU Lesser General Public License, Version 3 \quotefile ../LICENSE.LGPLv3 \section2 GNU General Public License Version 3, Annotated with The Qt Company GPL Exception 1.0 \quotefile ../LICENSE.GPL3-EXCEPT \section2 GNU Lesser General Public License, Version 2.1 \quotefile ../LICENSE.LGPLv21 \section2 The Qt Company LGPL Exception version 1.1 \quotefile ../LGPL_EXCEPTION.txt \section1 Third-Party Attibutions \QBS contains third-party code, which we gratefully acknowledge: \generatelist{groupsbymodule attributions-qbs} */ qbs-src-3.2.0/doc/qbs-hugo.qdocconf0000644000175100017510000000020315154533055016505 0ustar runnerrunnerinclude(config/qbs-project.qdocconf) syntaxhighlighting = true HTML.prologue = "

" qbs-src-3.2.0/doc/man/0000755000175100017510000000000015154533055014022 5ustar runnerrunnerqbs-src-3.2.0/doc/man/see-also.h2m0000644000175100017510000000025515154533055016144 0ustar runnerrunner[SEE ALSO] For detailed help on a command, use the .B help command. For instance: .IP qbs help build .PP The full documentation for .B qbs is available at . qbs-src-3.2.0/doc/man/qbs.10000644000175100017510000000326115154533055014673 0ustar runnerrunner.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. .TH QBS "1" "January 2026" "qbs 3.2.0" "User Commands" .SH NAME qbs \- the Qbs build tool .SH SYNOPSIS .B qbs [\fI\,command\/\fR] [\fI\,command parameters\/\fR] .SH DESCRIPTION Qbs 3.2.0, a cross\-platform build tool. .SS "Built-in commands:" .TP build Build (parts of) a project. This is the default command. .TP clean Remove the files generated during a build. .TP dump\-nodes\-tree Dumps the nodes in the build graph to stdout. .TP generate Generate project files for another build tool. .TP help Show general or command\-specific help. .TP install Install (parts of) a project. .TP list\-products Lists all products in the project, including sub\-projects. .TP resolve Resolve a project without building it. .TP run Run an executable generated by building a project. .TP session Starts a session for an IDE. .TP shell Open a shell with a product's environment. .TP show\-version Print the Qbs version number to stdout. .TP status Show the status of files in the project directory. .TP update\-timestamps Mark the build as up to date. .SS "Auxiliary commands:" .TP config This tool manages qbs settings. .TP config\-ui This tool displays qbs settings in a GUI. .TP create\-project This tool creates a qbs project from an existing source tree. .TP setup\-android This tool creates qbs profiles from Android SDK and NDK installations. .TP setup\-qt This tool creates qbs profiles from Qt versions. .TP setup\-toolchains This tool creates qbs profiles from toolchains. .SH "SEE ALSO" For detailed help on a command, use the .B help command. For instance: .IP qbs help build .PP The full documentation for .B qbs is available at . qbs-src-3.2.0/doc/man/CMakeLists.txt0000644000175100017510000000020015154533055016552 0ustar runnerrunnerif (QBS_INSTALL_MAN_PAGE) install(FILES qbs.1 DESTINATION ${QBS_RESOURCES_INSTALL_DIR}/man/man1 COMPONENT qbs_docs) endif() qbs-src-3.2.0/doc/man/man.qbs0000644000175100017510000000467215154533055015315 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.ModUtils import qbs.Probes import qbs.Utilities Product { name: "qbs man page" type: ["manpage"] Depends { productTypes: ["qbsapplication"]; condition: updateManPage } Depends { name: "qbsbuildconfig" } property bool updateManPage: false property string help2ManFilePath: help2ManProbe.filePath Group { name: "man page" files: ["qbs.1"] qbs.install: qbsbuildconfig.installManPage qbs.installDir: "share/man/man1" } Group { name: "additional sections" files: ["see-also.h2m"] fileTags: ["man.section"] } Rule { condition: updateManPage multiplex: true // TODO: Remove in 1.14. explicitlyDependsOn: ["application"] property stringList explicitlyDependsOnFromDependencies: ["application"] inputs: ["man.section"] Artifact { filePath: "qbs.1" fileTags: ["manpage"] } prepare: { var help2ManExe = product.help2ManFilePath; if (!help2ManExe) throw "Cannot update man page: help2man not available"; if (Utilities.versionCompare(product.qbs.version, "1.9") < 0) throw "Cannot update man page: qbs >= 1.9 required"; var qbsApp; for (var i = 0; i < explicitlyDependsOn.application.length; ++i) { var artifact = explicitlyDependsOn.application[i]; if (artifact.product.name === "qbs_app") qbsApp = ModUtils.artifactInstalledFilePath(artifact); } var args = [qbsApp, "-o", output.filePath, "--no-info", "--name=the Qbs build tool"]; var sections = inputs ? inputs["man.section"] : []; for (var i = 0; i < sections.length; ++i) args.push("--include=" + sections[i].filePath); var help2ManCmd = new Command(help2ManExe, args); help2ManCmd.description = "creating man page"; var copyCmd = new JavaScriptCommand(); copyCmd.silent = true; copyCmd.sourceCode = function() { File.copy(output.filePath, FileInfo.joinPaths(product.sourceDirectory, output.fileName)); } return [help2ManCmd, copyCmd]; } } Probes.BinaryProbe { id: help2ManProbe names: ["help2man"] } } qbs-src-3.2.0/doc/config/0000755000175100017510000000000015154533055014514 5ustar runnerrunnerqbs-src-3.2.0/doc/config/style/0000755000175100017510000000000015154533055015654 5ustar runnerrunnerqbs-src-3.2.0/doc/config/style/qt5-sidebar.html0000644000175100017510000000152115154533055020661 0ustar runnerrunner

Qbs Manual

qbs-src-3.2.0/doc/config/macros.qdocconf0000644000175100017510000000560115154533055017520 0ustar runnerrunnermacro.QBS = "Qbs" macro.qbsversion = $QBS_VERSION macro.defaultvalue = "Default:" macro.nodefaultvalue = "Default: Undefined" macro.appleproperty = "This property is specific to Apple platforms." macro.androidproperty = "This property is specific to Android platforms." macro.unixproperty = "This property is specific to Unix platforms." macro.windowsproperty = "This property is specific to Windows." macro.baremetalproperty = "This property is specific to bare-metal platforms." macro.funsince.HTML = "

This function was introduced in version \1.

" macro.aacute.HTML = "á" macro.Aring.HTML = "Å" macro.aring.HTML = "å" macro.Auml.HTML = "Ä" macro.author = "\\b{Author:}" macro.BR.HTML = "
" macro.copyright.HTML = "©" macro.eacute.HTML = "é" macro.gui = "\\b" macro.HR.HTML = "
" macro.iacute.HTML = "í" macro.key = "\\b" macro.macos = "macOS" macro.menu = "\\b" macro.oslash.HTML = "ø" macro.ouml.HTML = "ö" macro.QA = "\\e{Qt Assistant}" macro.QD = "\\e{Qt Designer}" macro.QL = "\\e{Qt Linguist}" macro.QQV = "\\e{Qt QML Viewer}" macro.param = "\\e" macro.raisedaster.HTML = "*" macro.rarrow.HTML = "→" macro.reg.HTML = "®" macro.return = "Returns" macro.starslash = "\\c{*/}" macro.begincomment = "\\c{/*}" macro.endcomment = "\\c{*/}" macro.uuml.HTML = "ü" macro.mdash.HTML = "—" macro.pi.HTML = "Π" macro.beginqdoc.HTML = "/*!" macro.endqdoc.HTML = "*/" macro.borderedimage = "\\div {class=\"border\"} \\image \1\n\\enddiv" macro.beginfloatleft.HTML = "
" macro.beginfloatright.HTML = "
" macro.endfloat.HTML = "
" macro.clearfloat.HTML = "
" macro.emptyspan.HTML = "" macro.CMAKE = "CMake" # Embed YouTube content by video ID - Example: \youtube dQw4w9WgXcQ # Also requires a .jpg thumbnail for offline docs. In .qdocconf, add: # # HTML.extraimages += images/dQw4w9WgXcQ.jpg # qhp.ProjectName.extraFiles += images/dQw4w9WgXcQ.jpg # macro.youtube.HTML = "
\n\n" \ "
\n" qbs-src-3.2.0/doc/config/qbs-project.qdocconf0000644000175100017510000000220115154533055020456 0ustar runnerrunnerinclude($QT_INSTALL_DOCS/global/qt-cpp-defines.qdocconf) include($QT_INSTALL_DOCS/global/compat.qdocconf) include($QT_INSTALL_DOCS/global/fileextensions.qdocconf) project = "Qbs" description = "Qbs Manual" #Words to ignore for auto-linking ignorewords += macOS headerdirs = sourcedirs = .. imagedirs = ../images ../templates/images exampledirs = .. include(macros.qdocconf) sources.fileextensions = "*.qdoc" qhp.projects = Qbs qhp.Qbs.file = qbs.qhp qhp.Qbs.namespace = org.qt-project.qbs.$QBS_VERSION_TAG qhp.Qbs.virtualFolder = doc qhp.Qbs.indexTitle = Qbs qhp.Qbs.filterAttributes = qbs $QBS_VERSION qhp.Qbs.customFilters.Qbs.name = Qbs $QBS_VERSION qhp.Qbs.customFilters.Qbs.filterAttributes = qbs $QBS_VERSION qhp.Qbs.indexRoot = qhp.Qbs.subprojects = manual qhp.Qbs.subprojects.manual.title = Qbs Manual qhp.Qbs.subprojects.manual.indexTitle = Qbs Manual qhp.Qbs.subprojects.manual.type = manual # Doxygen compatibility commands macro.see = "\\sa" macro.function = "\\fn" navigation.homepage = "Qbs Manual" buildversion = "Qbs $QBS_VERSION" qbs-src-3.2.0/doc/CMakeLists.txt0000644000175100017510000000157215154533055016014 0ustar runnerrunnerset(_DOC_SOURCES ../README.md ../CONTRIBUTING.md classic.css external-resources.qdoc fixnavi.pl howtos.qdoc qbs.qdoc qbs-online.qdocconf config/style/qt5-sidebar.html ) file(GLOB_RECURSE _DOC_APPENDIX_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/appendix/*") file(GLOB_RECURSE _DOC_REFERENCE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/reference/*") file(GLOB_RECURSE _DOC_TEMPLATES_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/templates/*") file(GLOB_RECURSE _DOC_IMAGES_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/images/*") file(GLOB_RECURSE _DOC_TARGETS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/targets/*") add_qbs_documentation( "qbs.qdocconf" SOURCES ${_DOC_SOURCES} ${_DOC_APPENDIX_SOURCES} ${_DOC_REFERENCE_SOURCES} ${_DOC_TEMPLATES_SOURCES} ${_DOC_IMAGES_SOURCES} ${_DOC_TARGETS_SOURCES} ) add_subdirectory(man) qbs-src-3.2.0/doc/codeattributions.qdoc0000644000175100017510000002375315154533055017513 0ustar runnerrunner/*! \ingroup attributions-libs \ingroup attributions-qbs \page qbs-attribution-ds_store.html attribution \target ds_store \title ds_store \brief MIT License Manipulate Finder .DS_Store files from Python Used in the qbs dmg module for building Apple disk images. The sources can be found in src/3rdparty/python/lib/python2.7/site-packages/ds_store. \l{https://github.com/al45tair/ds_store}{Project Homepage}, upstream version: 1.1.2 \badcode Copyright (c) 2014 Alastair Houghton \endcode \l{https://spdx.org/licenses/MIT.html}{MIT License}. \badcode Copyright (c) 2014 Alastair Houghton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \endcode */ /*! \ingroup attributions-libs \ingroup attributions-qbs \page qbs-attribution-dmgbuild.html attribution \target dmgbuild \title dmgbuild \brief MIT License macOS command line utility to build disk images Used in the qbs dmg module for building Apple disk images. The sources can be found in src/3rdparty/python/lib/python2.7/site-packages/dmgbuild. \l{https://github.com/al45tair/dmgbuild}{Project Homepage}, upstream version: 1.3.1 \badcode Copyright (c) 2014 Alastair Houghton \endcode \l{https://spdx.org/licenses/MIT.html}{MIT License}. \badcode Copyright (c) 2014 Alastair Houghton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \endcode */ /*! \ingroup attributions-libs \ingroup attributions-qbs \page qbs-attribution-mac_alias.html attribution \target mac_alias \title mac_alias \brief MIT License Generate/parse Mac OS Alias records from Python Used in the qbs dmg module for building Apple disk images. The sources can be found in src/3rdparty/python/lib/python2.7/site-packages/mac_alias. \l{https://github.com/al45tair/mac_alias}{Project Homepage}, upstream version: 2.0.6 \badcode Copyright (c) 2014 Alastair Houghton \endcode \l{https://spdx.org/licenses/MIT.html}{MIT License}. \badcode Copyright (c) 2014 Alastair Houghton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \endcode */ /*! \ingroup attributions-libs \ingroup attributions-qbs \page qbs-attribution-biplist.html attribution \target biplist \title biplist \brief BSD 3-clause "New" or "Revised" License biplist is a library for reading/writing binary plists. Used in the qbs dmg module for building Apple disk images. The sources can be found in src/3rdparty/python/lib/python2.7/site-packages/biplist. \l{https://bitbucket.org/wooster/biplist}{Project Homepage}, upstream version: 1.0.2 \badcode Copyright (c) 2010, Andrew Wooster \endcode \l{https://spdx.org/licenses/BSD-3-Clause.html}{BSD 3-clause "New" or "Revised" License}. \badcode Copyright (c) 2010, Andrew Wooster All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of biplist nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \endcode */ /*! \ingroup attributions-libs \ingroup attributions-qbs \page qbs-attribution-cppscanner.html attribution \target cppscanner \title cppscanner \brief MIT License The cpp scanner module is used to parse C/C++ files and to find includes in them. The sources can be found in src/plugins/scanner/cpp. \badcode Copyright (c) 2008 Roberto Raggi \endcode \l{https://spdx.org/licenses/MIT.html}{MIT License}. \badcode // Copyright (c) 2008 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. \endcode */ /*! \ingroup attributions-libs \ingroup attributions-qbs \page qbs-attribution-quickjs.html attribution \target quickjs \title QuickJS \brief MIT License The JavaScript engine used to evaluate all JavaScript code in \QBS project files. The sources can be found in src/shared/quickjs. \badcode Copyright (c) 2017-2021 Fabrice Bellard Copyright (c) 2017-2021 Charlie Gordon \endcode \l{https://spdx.org/licenses/MIT.html}{MIT License}. \badcode QuickJS Javascript Engine Copyright (c) 2017-2021 Fabrice Bellard Copyright (c) 2017-2021 Charlie Gordon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \endcode */ qbs-src-3.2.0/doc/fix-qmlimports.py0000755000175100017510000001322015154533055016615 0ustar runnerrunner#!/usr/bin/env python3 ############################################################################# ## ## Copyright (C) 2017 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$ ## ############################################################################# from __future__ import print_function import os import glob import errno import sys import argparse import shutil import urllib from subprocess import Popen, PIPE import re from collections import Counter import platform useShell = (platform.system() == 'Windows') gotSoup = True try: from bs4 import BeautifulSoup except ImportError: print('Warning: Failed to import BeautifulSoup. Some functionality is disabled.', file=sys.stderr) gotSoup = False qmlTypeString = ' QML Type' # Modifies a QML Type reference page to look like a generic # JavaScript reference - Removes the 'QML Type' strings from # the titles as well as the import statement information. # This is used in the Installer Framework docs, which contain # JS reference documentation generated using commands specific # to documenting QML code. # # Parameters: a Beautiful Soup object constructed with an opened # html file to process. # # Returns True if the element tree was modified, False otherwise def modifyQMLReference(soup): pageTitle = soup.head.title.string soup.head.title.string = pageTitle.replace(qmlTypeString, '') for t in soup.find_all('h1', class_='title'): t.string = t.string.replace(qmlTypeString, '') for table in soup.find_all('table'): td = table.find('td') if td and td.string: if 'Import Statement:' in td.string: td.parent.extract() return True return False if __name__ == '__main__': parser = argparse.ArgumentParser( description = """Removes bogus import statements from the offline docs""") parser.add_argument('outputdir', help = 'output directory of the generated html files') args = parser.parse_args() if not gotSoup: print('Error: This script requires the Beautiful Soup library.', file=sys.stderr) sys.exit(1) if not os.path.isdir(args.outputdir): print('Error: No such directory:', args.outputdir, file=sys.stderr) sys.exit(1) # compile a list of all html files in the outputdir htmlFiles = [] for f in os.listdir(args.outputdir): fullPath = os.path.join(args.outputdir, f) if os.path.isdir(fullPath): continue if os.path.splitext(f)[1] == '.html': htmlFiles.append(fullPath) sys.stdout.flush() modified = {} pre_blocks = {} fileCount = 0 progStep = max(16, len(htmlFiles)) / 16 for html in htmlFiles: fileCount += 1 if not (fileCount % progStep): print('.', end='') sys.stdout.flush() with open(html, 'r+', encoding='utf8') as file_: try: soup = BeautifulSoup(file_, 'lxml') actions = [] val = 0 if modifyQMLReference(soup): actions.append('Removed QML type info') for a in actions: modified[a] = modified.get(a, 0) + 1 if actions: file_.seek(0) file_.write(str(soup)) file_.truncate() file_.close() except (AttributeError, KeyError): print('\nFailed to parse', html, ':', sys.exc_info()[0], file=sys.stderr) except IOError as e: print('\nError:', e, file=sys.stderr) except ValueError as e: print('\nError:', e, file=sys.stderr) if 'lxml' in str(e): print('(If using pip, try \"pip install lxml\")', file=sys.stderr) quit(1) for k, v in modified.items(): print ('\n\t', k, 'in %d files' % v, end='') pb = pre_blocks.get(k, 0) if pb: print (' (', pb, '
 blocks)', sep='', end='')
    print('\n')
qbs-src-3.2.0/doc/reference/0000755000175100017510000000000015154533055015205 5ustar  runnerrunnerqbs-src-3.2.0/doc/reference/commands.qdoc0000644000175100017510000002316415154533055017664 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2019 Jochen Ulrich 
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

// TODO: "\c" markup is used for all properties in table due to QTBUG-35505.

/*!
    \page commands.html

    \title Command and JavaScriptCommand
    \brief Types of commands to be used in rules

    A \e command is what \QBS executes at build time. It is represented in the language by an object
    of type \c Command, which runs a process, or \c JavaScriptCommand, which executes arbitrary
    JavaScript code. A command is always created in the prepare script of a \c Rule.

    \section1 Command

    A \c Command represents a process that will be invoked at build time. Its constructor
    arguments are the binary to run and a list of command-line arguments. For instance:
    \code
        var insaneCommand = new Command("rm", ["-r", "/"]);
    \endcode
    The \l{Rule} item documentation shows a \c Command in context.

    \section1 JavaScriptCommand

    A \c JavaScriptCommand represents a chunk of JavaScript code that is run at build time.
    For instance:
    \code
        var cmd = new JavaScriptCommand();
        cmd.apology = "Sorry.";
        cmd.sourceCode = function() {
            console.info("I'm a rather pointless command.");
            console.info(apology);
        };
    \endcode

    Within the source code, the special identifiers \c project and \c product
    (giving access to project and product properties, respectively) as well as \c inputs and
    \c outputs are available. As the example shows, arbitrary properties can be set on the command
    object and then used within the source code. This technique is typically used to forward values
    from the prepare script to the command.
    The \l{Rule} item documentation shows a \c JavaScriptCommand in context.

    \section1 Properties

    \section2 Common Properties
    The following properties are available in both \c Command and \c JavaScriptCommand.

    \table
    \header
        \li Property
        \li Type
        \li Default
        \li Description
    \row
        \li \c description
        \li string
        \li empty
        \li A message that is displayed when the command is executed.
    \row
        \li \c extendedDescription
        \li string
        \li empty
        \li A detailed description that is displayed when the command is executed.
    \row
        \li \c highlight
        \li string
        \li empty
        \li A tag that can be used to influence how the \c description is displayed. In principle,
            the values are arbitrary. The \QBS command-line tool understands the following values and
            maps them to different colors if the output device is a terminal:
            \list
                \li "compiler" indicates that the command processes source code
                \li "linker" indicates that the command links objects
                \li "codegen" indicates that the command generates source code
                \li "filegen" indicates that the command creates arbitrary files
            \endlist
            All other values are mapped to the default color.
    \row
        \li \c jobPool
        \li string
        \li empty
        \li Determines which job pool the command will use. An empty
            string, which is the default, stands for the global job pool.
            See \l{JobLimit}{here} and \l{job-pool-howto}{here} for more information on job pools.
    \row
        \li \c silent
        \li bool
        \li false
        \li A flag that controls whether the \c description is printed. Set it to \c true for commands that
            users need not know about. \note If this property is \c false, then \c description must
            not be empty.
    \row
        \li \c timeout
        \li int
        \li -1
        \li Time limit for the command execution in seconds. If the command does not finish within
            the timeout, it is cancelled. In case of a \c Command, the process is requested to
            terminate. If it does not terminate within three seconds, it is killed. A value below
            or equal to 0 means no timeout. \br
            This property was introduced in Qbs 1.15.
    \endtable


    \section2 Command Properties

    \table
    \header
        \li Property
        \li Type
        \li Default
        \li Description
    \row
        \li \c arguments
        \li stringList
        \li empty
        \li The list of arguments to invoke the command with. Explicitly setting this property
            overrides an argument list provided when instantiating the object.
    \row
        \li \c environment
        \li stringList
        \li empty
        \li A list of environment variables that are added to the common build environment.
            They are provided as a list of strings in the form "varName=value".
    \row
        \li \c maxExitCode
        \li int
        \li 0
        \li The maximum exit code from the process to interpret as success. Setting this should
            rarely be necessary, as all well-behaved applications use values other than zero
            to indicate failure.
    \row
        \li \c program
        \li string
        \li undefined
        \li The binary to invoke. Explicitly setting this property overrides a path provided when
            instantiating the object.
    \row
        \li \c relevantEnvironmentVariables
        \li stringList
        \li undefined
        \li Names of environment variables that the invoked binary considers.
            If one of these variables changes in the build environment, the command will be
            re-run even if the input files are still up to date.
    \row
        \li \c responseFileThreshold
        \li int
        \li 32000 on Windows, -1 elsewhere
        \li If this value is greater than zero and less than the length of the full command line,
            and if \c responseFileUsagePrefix is not empty, the contents of the command line are
            moved to a temporary file, whose path becomes the entire contents of the
            argument list. The program is then supposed to read the full argument list from that
            file. This mechanism is mainly useful to work around Windows limitations regarding
            the maximum length of the command line and will only work with programs that explicitly
            support it.
    \row
        \li \c responseFileArgumentIndex
        \li int
        \li 0
        \li Index of the first argument to include in the response file. For example this may be
            used in conjunction with a compiler wrapper where the first argument (the path to the
            compiler) must be included on the raw command line.
    \row
        \li \c responseFileUsagePrefix
        \li string
        \li empty
        \li The prefix that informs \c program that the rest of the argument
            is a path to a file containing the actual command line.
    \row
        \li \c stderrFilterFunction
        \li function
        \li undefined
        \li A function that takes as input the command's actual standard error output and returns a string
            that is presented to the user as the command's standard error output.
            If it is not set, the output is shown unfiltered.
    \row
        \li \c stdoutFilterFunction
        \li function
        \li undefined
        \li A function that takes as input the command's actual standard output and returns a string
            that is presented to the user as the command's standard output.
            If it is not set, the output is shown unfiltered.
    \row
        \li \c workingDirectory
        \li string
        \li empty
        \li The program's working directory.
    \row
        \li \c stdoutFilePath
        \li string
        \li undefined
        \li Redirects the filtered standard output content to \c stdoutFilePath. If \c stdoutFilePath is undefined,
            the filtered standard output is forwarded to \QBS, possibly to be printed to the console.
    \row
        \li \c stderrFilePath
        \li string
        \li undefined
        \li Redirects the filtered standard error output content to \c stderrFilePath. If \c stderrFilePath is undefined,
            the filtered standard error output is forwarded to \QBS, possibly to be printed to the console.
    \endtable

    \section2 JavaScriptCommand Properties

    \table
    \header
        \li Property
        \li Type
        \li Default
        \li Description
    \row
        \li \c sourceCode
        \li function
        \li undefined
        \li The JavaScript function to execute.
    \endtable
*/
qbs-src-3.2.0/doc/reference/cli/0000755000175100017510000000000015154533055015754 5ustar  runnerrunnerqbs-src-3.2.0/doc/reference/cli/cli.qdoc0000644000175100017510000000325115154533055017374 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \group cli

    \title Command-Line Interface
    \brief A list of available command-line commands.

    The \c qbs command-line commands can be invoked as \c{qbs }.

    This reference summarizes the command-line commands. The authoritative
    source of up-to-date information is the respective help screen, which you
    get by calling \c{qbs help }.

    Some commands are described in context in the \l{Usage} section of the
    manual.
*/
qbs-src-3.2.0/doc/reference/cli/cli-options.qdocinc0000644000175100017510000003156315154533055021566 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!

//! [all-products]

    \section2 \c --all-products

    Processes all \l{Product}{products}, even if their \c builtByDefault
    property is \c false.

//! [all-products]

//! [blacklist]

    \section2 \c {--blacklist }

    Ignores files whose names match the patterns specified by \c .
    The list entries can contain wildcards and are separated by commas.

    By default, no files are ignored.

//! [blacklist]

//! [build-directory]

    \section2 \c {--build-directory|-d }

    Specifies a \c  where build artifacts are stored.

    The default value is the current directory unless
    \c preferences.defaultBuildDirectory is set.

    Relative paths will be interpreted relative to the current directory.

    You can use the following special values as placeholders:

    \list
        \li \c @project is expanded to the name of the project file excluding
            the extension \c .qbs.
        \li \c @path is expanded to the name of the directory containing the
            project file.
    \endlist

//! [build-directory]

//! [changed-files]

    \section2 \c {--changed-files [,...]}

    Assumes that the files specified by \c , and only those files, have
    changed.

//! [changed-files]

//! [check-outputs]

    \section2 \c --check-outputs

    Forces transformer output \l{Artifact}{artifact} checks.

    Verifies that the output artifacts declared by \l{Rule}{rules} in the
    \l{Project}{project} are actually created.

//! [check-outputs]

//! [check-timestamps]

    \section2 \c --check-timestamps

    Forces timestamp checks.

    Retrieves the timestamps from the file system, instead of using the file
    timestamps that are stored in the build graph.

//! [check-timestamps]

//! [clean_install_root]

    \section2 \c --clean-install-root

    Removes the installation base directory before installing.

//! [clean_install_root]

//! [command-echo-mode]

    \section2 \c {--command-echo-mode }

    Determines what kind of output to show when executing commands.

    Possible values of \c  are:

    \list
        \li \c silent
        \li \c summary (default value)
        \li \c command-line
        \li \c command-line-with-environment
    \endlist

//! [command-echo-mode]

//! [detect-qt-versions]

    \section2 \c --detect

    Attempts to auto-detect all known Qt versions, looking them up in the PATH
    environment variable.

//! [detect-qt-versions]

//! [detect-toolchains]

    \section2 \c --detect

    Attempts to auto-detect all known toolchains, looking them up in the PATH
    environment variable.

//! [detect-toolchains]

//! [dry-run]

    \section2 \c --dry-run|-n

    Performs a dry run. No commands will be executed and no permanent changes to
    the build graph will be done.

//! [dry-run]

//! [export]

    \section2 \c {--export }

    Exports settings to the specified \c .

//! [export]

//! [project-file]

    \section2 \c {[--file|-f ]}

    Uses \c  as the project file. If \c  is a directory and it
    contains a single file with the extension \c .qbs, that file will be used.

    If this option is not given at all, the behavior is the same as for
    \c{-f }.

//! [project-file]

//! [flat]

    \section2 \c --flat

    Does not create nested project files, even if there are subdirectories and
    the top-level directory does not contain any files.

//! [flat]

//! [force-probe-execution]

    \section2 \c --force-probe-execution

    Forces re-execution of all \l{Probe} items' configure scripts,
    rather than using the cached data.

//! [force-probe-execution]

//! [generator]

    \section2 \c {--generator|-g }

    Uses the specified build system generator.

    Possible values of \c  include:

    \list
        \li \c clangdb
        \li \c visualstudio2015
        \li \c iarew8
    \endlist

    The available generators are listed if you run the \c {qbs generate} command
    without passing a generator to it.

//! [generator]

//! [help]

    \section2 \c {--help|-h|-?}

    Displays help for the command.

//! [help]

//! [import]

    \section2 \c {--import }

    Imports settings from the specified \c .

//! [import]

//! [install-root]

    \section2 \c {--install-root }

    Installs into the specified \c . If the directory does not exist,
    it will be created.

    The default value is \c /install-root.

    Use the special value \c @sysroot to install into the \c sysroot. That is,
    the value of the \l{qbs::sysroot}{qbs.sysroot} property.

//! [install-root]

//! [jobs]

    \section2 \c {--jobs|-j }

    Uses \c  concurrent build jobs, where \c  must be an integer greater
    than zero.

    The default is the number of logical cores.

//! [jobs]

//! [job-limits]

    \section2 \c {--job-limits :[,:...]}

    Sets pool-specific job limits. See \l{job-pool-howto}{here} for more information on
    job pools.

    \section2 \c {--enforce-project-job-limits}

    Normally, job limits defined in project files via the \l JobLimit item get overridden
    by those set on the command line. If this option is passed, they get maximum priority
    instead. Use it if there are product-specific limits that make more sense for
    that part of the code base than the generic ones you'd like to apply globally.

//! [job-limits]

//! [keep-going]

    \section2 \c --keep-going|-k

    Keeps going when errors occur, if at all possible.

//! [keep-going]

//! [less-verbose]

    \section2 \c --less-verbose|-q

    Becomes more quiet by decreasing the log level by one. This option can be
    given more than once. Excessive occurrences have no effect.

    If the option \c --log-level appears anywhere on the command line in
    addition to this option, its value is taken as the base for the decrease.

//! [less-verbose]

//! [list-root]

    \section2 \c {--list [ ...]}

    Lists keys under the key \c  or all keys if the root is not specified.

    Possible values are:

    \list
        \li \c defaultProfile is the default \l{Profile}{profile} to use
            if a profile is not specified
        \li \c preferences accepts build preferences as second-level keys
        \li \c profiles accepts profile names as second-level keys

    \endlist

//! [list-root]

//! [config-user]

    \section2 \c {--user}

    Causes read operations to display only the user-level settings,
    while the system-level settings are ignored.
    Write operations will target the user-level settings, which is also the default.

//! [config-user]

//! [config-system]

    \section2 \c {--system}

    Read and write operations will consider only the system-level settings.

//! [config-system]

//! [config-ui-system]

    \section2 \c {--system}

    Instructs the tool to work on the system-level settings. Otherwise,
    the user-level settings are presented.

//! [config-ui-system]

//! [deprecation-warnings]

    \section2 \c {--deprecation-warnings }

    Uses the specified deprecation warning mode, which controls what to do when deprecated
    items or properties are encountered in the project. By default, a warning is emitted
    if the item or property is scheduled for removal in the next minor version of \QBS.
    Warnings can also be switched on or off unconditionally, and it can be specified that
    project resolving should abort if deprecated constructs are present.

    Possible values of \c  are:

    \list
        \li \c error
        \li \c on
        \li \c before-removal (default value)
        \li \c off
   \endlist

//! [deprecation-warnings]

//! [log-level]

    \section2 \c {--log-level }

    Uses the specified log level.

    Possible values of \c  are:

    \list
        \li \c error
        \li \c warning
        \li \c info (default value)
        \li \c debug
        \li \c trace
   \endlist

//! [log-level]

//! [log-time]

    \section2 \c --log-time

    Logs the time that the operations involved in this command take.

    This option is implied in log levels \c debug and higher.

    This option is mutually exclusive with \c --show-progress.

//! [log-time]

//! [more-verbose]

    \section2 \c --more-verbose|-v

    Becomes more verbose by increasing the log level by one. This option can be
    given more than once. Excessive occurrences have no effect.

    If the option \c --log-level appears anywhere on the command line in
    addition to this option, its value is taken as the base for the increase.

//! [more-verbose]

//! [ndk-dir]

    \section2 \c {--ndk-dir }

    Specifies a \c  that contains an Android NDK.

//! [ndk-dir]

//! [no-build]

    \section2 \c --no-build

    Does not re-build the project before installing or running it.

//! [no-build]

//! [no-install]

    \section2 \c --no-install

    Does not install any artifacts as part of the build process.

//! [no-install]

//! [products-specified]

    \section2 \c {--products|-p [,...]}

    Takes only the \l{Product}{products} specified by \c  and their
    dependencies into account.

//! [products-specified]

//! [qt-dir]

    \section2 \c {--qt-dir }

    Specifies a \c  that contains a Qt version.

//! [qt-dir]

//! [sdk-dir]

    \section2 \c {--sdk-dir }

    Specifies a \c  that contains an Android SDK.

//! [sdk-dir]

//! [settings-dir]

    \section2 \c {--settings-dir }

    Reads all settings (such as \l{Profile}{profile} information) from the
    specified \c . If the directory does not exist, it will be
    created.

    The default value is system-specific. For example:

    \list
        \li Linux: \c $HOME/.config/QtProject/qbs
        \li Windows: \c %APPDATA%\QtProject\qbs
        \li macOS: \c $HOME/Library/Preferences/qbs
    \endlist

//! [settings-dir]

//! [setup-run-env-config]

    \target --setup-run-env-config
    \section2 \c --setup-run-env-config

    A comma-separated list of strings. They will show up in the \c config
    parameter of all \l{Module::}{setupRunEnvironment} scripts.

//! [setup-run-env-config]


//! [show-progress]

    \section2 \c --show-progress

    Shows how command execution is progressing.

    This option is mutually exclusive with \c --log-time.

//! [show-progress]


//! [setup-tools-system]

    \section2 \c {--system}

    If this option is given, the profile(s) created by this tool will end up
    in the system-level settings and thus be available to all users.
    Otherwise, they go into the user-level settings.

//! [setup-tools-system]

//! [type]

    \section2 \c {--type }

    Specifies the type of the toolchain. Needed if \QBS cannot determine the
    compiler from the name of the executable file located in the specified
    directory.

    Possible values include:

    \list
        \li \c clang
        \li \c gcc
        \li \c mingw
        \li \c msvc
        \li \c iar
        \li \c keil
        \li \c sdcc
        \li \c cosmic
        \li \c dmc
        \li \c watcom
     \endlist

//! [type]

//! [unset]

    \section2 \c {--unset }

    Removes the specified \c .

//! [unset]

//! [wait-lock]

    \section2 \c --wait-lock

    Waits indefinitely for other processes to release the build graph lock.

    This option is typically used by \l{Generators}{generators}, which may
    re-invoke multiple \QBS processes on the same project simultaneously.

//! [wait-lock]

//! [whitelist]

    \section2 \c {--whitelist }

    Considers only files whose names match the patterns specified by
    \c . The list entries can contain wildcards and are separated by
    commas.

    By default, all files are considered.

//! [whitelist]

*/
qbs-src-3.2.0/doc/reference/cli/cli-parameters.qdocinc0000644000175100017510000000721315154533055022231 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!

//! [arguments]

    \section2 \c -- 

    Command-line arguments to be passed to the program to be run.

//! [arguments]


//! [configuration-name]

    \section2 \c config:configuration-name

    Specifies the build configuration to use.

    \QBS can build a project for one or multiple configurations at once, each
    having a different set of parameters. The \c config parameter has a
    special function: with each occurrence a new configuration instance begins
    and all subsequent parameters until the next \c config are assigned to this
    instance. Parameter assignments before the first occurrence of \c config are
    applied to all build configurations. Inside products and modules, the
    current active build configuration can be retrieved via
    \l{qbs::configurationName}{qbs.configurationName}.

    In the following snippet, a profile \c clang is applied to all
    configurations while \c cpp.optimization is different for \c debug and
    \c release:

    \code
    profile:clang config:debug cpp.optimization:none config:release cpp.optimization:small
    \endcode

    The value of \c config determines the name of the build folder and affects
    the default value of the \l{qbs::buildVariant}{qbs.buildVariant} property.
    \QBS knows the \c config values \c{"debug"} and \c{"release"}, but in
    general any name can be chosen. When naming configurations created for
    special purposes, follow the rules for legal names generally used in
    programming languages:

    \list
        \li The first character must be a letter (a-z), an underscore (_), or a
            dollar sign ($).
        \li Subsequent characters may be letters, digits, underscores, or dollar
            signs.
    \endlist

//! [configuration-name]

//! [key]

    \section2 \c 

    Typically, a \c  consists of several levels separated by periods. The
    first level shows a \e root value, such as \e preferences or \e profiles.
    The root determines whether the second-level keys are build preferences or
    profile names. The lower level keys consist of a module name, followed by a
    property name.

//! [key]

//! [property]

    \section2 \c {property:value}

    Property values set in project files or profiles can be overridden on the
    command line. The syntax is:

    \code
    .:
    \endcode

    For more information, see
    \l{Overriding Property Values from the Command Line}.

//! [property]
*/
qbs-src-3.2.0/doc/reference/cli/builtin/0000755000175100017510000000000015154533055017422 5ustar  runnerrunnerqbs-src-3.2.0/doc/reference/cli/builtin/cli-clean.qdoc0000644000175100017510000000435215154533055022125 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-clean.html
    \ingroup cli

    \title clean
    \brief Removes the files generated during a build.

    \section1 Synopsis

    \code
    qbs clean [options] [config:configuration-name]
    \endcode

    \section1 Description

    Removes build \l{Artifact}{artifacts} for the specified build
    configuration.

    \section1 Options

    \include cli-options.qdocinc build-directory
    \include cli-options.qdocinc dry-run
    \include cli-options.qdocinc keep-going
    \include cli-options.qdocinc less-verbose
    \include cli-options.qdocinc log-level
    \include cli-options.qdocinc log-time
    \include cli-options.qdocinc more-verbose
    \include cli-options.qdocinc products-specified
    \include cli-options.qdocinc settings-dir
    \include cli-options.qdocinc show-progress

    \section1 Parameters

    \include cli-parameters.qdocinc configuration-name

    \section1 Examples

    Removes the build artifacts in the current directory for the default build
    configuration:

    \code
    qbs clean
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-update-timestamps.qdoc0000644000175100017510000000453415154533055024513 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-update-timestamps.html
    \ingroup cli

    \title update-timestamps
    \brief Marks the build as up-to-date.

    \section1 Synopsis

    \code
    qbs update-timestamps [options] [config:configuration-name] ...
    \endcode

    \section1 Description

    Updates the timestamps of all build \l{Artifact}{artifacts}, causing
    the next builds of the \l{Project}{project} to do nothing until source
    files are updated again.

    This command is useful if you know that the current changes to source files
    are irrelevant to the build.

    \note Using this command causes a discrepancy between the actual state of
    source files and the information in the build graph, so be careful.

    \section1 Options

    \include cli-options.qdocinc build-directory
    \include cli-options.qdocinc less-verbose
    \include cli-options.qdocinc log-level
    \include cli-options.qdocinc more-verbose
    \include cli-options.qdocinc products-specified
    \include cli-options.qdocinc settings

    \section1 Parameters

    \include cli-parameters.qdocinc configuration-name
    \include cli-parameters.qdocinc property

    \section1 Examples
*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-list-products.qdoc0000644000175100017510000000361015154533055023653 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-list-products.html
    \ingroup cli

    \title list-products
    \brief Lists all products in the given project.

    \section1 Synopsis

    \code
    qbs list-products [options] [config:configuration-name]
    \endcode

    \section1 Description

    Lists all products that exist in a project.

    \section1 Options

    \include cli-options.qdocinc project-file
    \include cli-options.qdocinc build-directory
    \include cli-options.qdocinc settings-dir

    \section1 Parameters

    \include cli-parameters.qdocinc configuration-name

    \section1 Examples

    To list all products for the project in the current directory:

    \code
    qbs list-products
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-help.qdoc0000644000175100017510000000346715154533055022001 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-help.html
    \ingroup cli

    \title help
    \brief Shows general or command-specific help.

    \section1 Synopsis

    \code
    qbs help []
    \endcode

    \section1 Description

    Shows a list of available commands with descriptions. Specify a command
    name to list the options that the command takes with descriptions.

    \section1 Options

    This command takes no options.

    \section1 Examples

    Shows an overview of all commands:

    \code
    qbs help
    \endcode

    Lists the options that the \c build command takes:

    \code
    qbs help build
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-run.qdoc0000644000175100017510000000631715154533055021652 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-run.html
    \ingroup cli

    \title run
    \brief Runs an executable generated by building a project.

    \section1 Synopsis

    \code
    qbs run [options] [config:configuration-name] [property:value] ... [ -- ]
    \endcode

    \section1 Description

    Runs the specified product's executable with the specified \c .
    If the project has only one product, the \c --products option may be
    omitted.

    The product will be built if it is not up to date, unless the \c --no-build
    option is specified. For more information, see \l{build}.

    For more information about running applications, see
    \l{Running Applications}.

    \section1 Options

    \include cli-options.qdocinc all-products
    \include cli-options.qdocinc build-directory
    \include cli-options.qdocinc changed-files
    \include cli-options.qdocinc check-outputs
    \include cli-options.qdocinc check-timestamps
    \include cli-options.qdocinc clean_install_root
    \include cli-options.qdocinc command-echo-mode
    \include cli-options.qdocinc dry-run
    \include cli-options.qdocinc project-file
    \include cli-options.qdocinc force-probe-execution
    \include cli-options.qdocinc install-root
    \include cli-options.qdocinc jobs
    \include cli-options.qdocinc keep-going
    \include cli-options.qdocinc less-verbose
    \include cli-options.qdocinc log-level
    \include cli-options.qdocinc log-time
    \include cli-options.qdocinc more-verbose
    \include cli-options.qdocinc no-build
    \include cli-options.qdocinc products-specified
    \include cli-options.qdocinc settings-dir
    \include cli-options.qdocinc setup-run-env-config
    \include cli-options.qdocinc wait-lock

    \section1 Parameters

    \include cli-parameters.qdocinc configuration-name
    \include cli-parameters.qdocinc property

    \section1 Arguments

    \include cli-parameters.qdocinc arguments

    \section1 Examples

    Runs the Qt Creator application:

    \code
    qbs run --products qtcreator
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-shell.qdoc0000644000175100017510000000412715154533055022152 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-shell.html
    \ingroup cli

    \title shell
    \brief Opens a shell with a product's environment.

    \section1 Synopsis

    \code
    qbs shell [options] [config:configuration-name] [property:value]
    \endcode

    \section1 Description

    Opens a shell in the environment that a build with the specified parameters
    would use.

    For more information, see \l{Using the Shell}.

    \section1 Options

    \include cli-options.qdocinc build-directory
    \include cli-options.qdocinc project-file
    \include cli-options.qdocinc products-specified
    \include cli-options.qdocinc settings-dir

    \section1 Parameters

    \include cli-parameters.qdocinc configuration-name
    \include cli-parameters.qdocinc property

    \section1 Examples

    Opens a shell with the same environment that \QBS uses when building the
    project:

    \code
    qbs shell
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-resolve.qdoc0000644000175100017510000000461515154533055022524 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-resolve.html
    \ingroup cli

    \title resolve
    \brief Resolves a project without building it.

    \section1 Synopsis

    \code
    qbs resolve [options] [[config:configuration-name] [property:value] ...]
    \endcode

    \section1 Description

    Resolves a \l{Project}{project} in one or more configurations. Run this
    command to change the properties of an existing build.

    \section1 Options

    \include cli-options.qdocinc build-directory
    \include cli-options.qdocinc dry-run
    \include cli-options.qdocinc project-file
    \include cli-options.qdocinc force-probe-execution
    \include cli-options.qdocinc less-verbose
    \include cli-options.qdocinc log-level
    \include cli-options.qdocinc log-time
    \include cli-options.qdocinc more-verbose
    \include cli-options.qdocinc settings-dir
    \include cli-options.qdocinc show-progress
    \include cli-options.qdocinc deprecation-warnings

    \section1 Parameters

    \include cli-parameters.qdocinc configuration-name
    \include cli-parameters.qdocinc property

    \section1 Examples

    Resolves the default configuration of the project in the current directory:

    \code
    qbs resolve
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-build.qdoc0000644000175100017510000000771215154533055022145 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-build.html
    \ingroup cli

    \title build
    \brief Builds a project.

    \section1 Synopsis

    \code
    qbs build [options] [[config:configuration-name] [property:value] ...]
    \endcode

    \section1 Description

    Builds projects in one or more configurations.

    You can specify \l{Project}{project}, \l{Product}{product}, or
    \l{List of Modules}{module} properties, as well as a \l{Profile}
    {profile} separately for each configuration.

    This is the default command.

    If the build directory does not exist, it will be created.

    For more information, see \l{Building Applications}.

    \section1 Options

    \target build-all-products
    \include cli-options.qdocinc all-products
    \include cli-options.qdocinc build-directory
    \include cli-options.qdocinc changed-files
    \include cli-options.qdocinc check-outputs
    \include cli-options.qdocinc check-timestamps
    \include cli-options.qdocinc clean_install_root
    \include cli-options.qdocinc command-echo-mode
    \include cli-options.qdocinc dry-run
    \include cli-options.qdocinc project-file
    \target build-force-probe-execution
    \include cli-options.qdocinc force-probe-execution
    \include cli-options.qdocinc jobs
    \include cli-options.qdocinc job-limits
    \include cli-options.qdocinc keep-going
    \include cli-options.qdocinc less-verbose
    \include cli-options.qdocinc log-level
    \include cli-options.qdocinc log-time
    \include cli-options.qdocinc more-verbose
    \include cli-options.qdocinc no-install
    \target build-products
    \include cli-options.qdocinc products-specified
    \include cli-options.qdocinc settings-dir
    \include cli-options.qdocinc show-progress
    \include cli-options.qdocinc wait-lock

    \section1 Parameters

    \include cli-parameters.qdocinc configuration-name
    \include cli-parameters.qdocinc property

    \section1 Examples

    Builds the application specified by the \c .qbs file in the current
    directory using the default profile:

    \code
    qbs
    \endcode

    Builds the application using four concurrent build jobs:

    \code
    qbs -j 4
    \endcode

    Builds the default configuration of an application using the profile called
    \c Android:

    \code
    qbs build profile:Android
    \endcode

    Builds the application using different \l{cpp} module properties
    for debug and release configurations. For the debug configuration, warnings
    will cause the build to fail, whereas for the release configuration, the
    size of the build artifacts will be optimized. Both configurations are built
    with a profile named \c{"qt"}:

    \code
    qbs build profile:qt config:debug modules.cpp.treatWarningsAsErrors:true config:release modules.cpp.optimization:small
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-install.qdoc0000644000175100017510000000544215154533055022512 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-install.html
    \ingroup cli

    \title install
    \brief Installs a project.

    \section1 Synopsis

    \code
    qbs install [options] [[config:configuration-name] [property:value] ...]
    \endcode

    \section1 Description

    Install all files marked as installable to their respective destinations.
    The project is built first, if necessary, unless the \c --no-build option is
    given.

    For more information, see \l{Installing Files}.

    \section1 Options

    \include cli-options.qdocinc all-products
    \include cli-options.qdocinc build-directory
    \include cli-options.qdocinc changed-files
    \include cli-options.qdocinc check-outputs
    \include cli-options.qdocinc check-timestamps
    \include cli-options.qdocinc clean_install_root
    \include cli-options.qdocinc command-echo-mode
    \include cli-options.qdocinc dry-run
    \include cli-options.qdocinc project-file
    \include cli-options.qdocinc force-probe-execution
    \include cli-options.qdocinc install-root
    \include cli-options.qdocinc jobs
    \include cli-options.qdocinc keep-going
    \include cli-options.qdocinc less-verbose
    \include cli-options.qdocinc log-level
    \include cli-options.qdocinc log-time
    \include cli-options.qdocinc more-verbose
    \include cli-options.qdocinc no-build
    \include cli-options.qdocinc products-specified
    \include cli-options.qdocinc settings-dir
    \include cli-options.qdocinc wait-lock

    \section1 Parameters

    \include cli-parameters.qdocinc configuration-name
    \include cli-parameters.qdocinc property

    \section1 Examples

*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-status.qdoc0000644000175100017510000000363315154533055022367 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-status.html
    \ingroup cli

    \title status
    \brief Shows the status of files in the project directory.

    \section1 Synopsis

    \code
    qbs status [options] [config:configuration-name]
    \endcode

    \section1 Description

    Lists all the files in the project directory and shows whether they are
    known to \QBS in the respective configuration.

    \section1 Options

    \include cli-options.qdocinc build-directory
    \include cli-options.qdocinc settings-dir

    \section1 Parameters

    \include cli-parameters.qdocinc configuration-name

    \section1 Examples

    To list the files in the project directory and view their status:

    \code
    qbs status
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-generate.qdoc0000644000175100017510000000514115154533055022632 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-generate.html
    \ingroup cli

    \title generate
    \brief Invokes a project generator, for example to create project files for
    another build tool.

    \section1 Synopsis

    \code
    qbs generate [options] [[config:configuration-name] [property:value] ...]
    \endcode

    \section1 Description

    Invokes a project generator, for example to create project files for another
    build tool.

    For more information, see \l{Generators}.

    \section1 Options

    \target generate-generator
    \include cli-options.qdocinc generator
    \include cli-options.qdocinc build-directory
    \include cli-options.qdocinc project-file
    \include cli-options.qdocinc install-root
    \include cli-options.qdocinc less-verbose
    \include cli-options.qdocinc log-level
    \include cli-options.qdocinc log-time
    \include cli-options.qdocinc more-verbose
    \include cli-options.qdocinc settings-dir
    \include cli-options.qdocinc show-progress

    \section1 Parameters

    \include cli-parameters.qdocinc configuration-name
    \include cli-parameters.qdocinc property

    \section1 Examples

    Generates a project for Microsoft Visual Studio:

    \code
    qbs generate -g visualstudio2015
    \endcode

    Generates a \l{https://clang.llvm.org/docs/JSONCompilationDatabase.html}
    {Clang compilation database (clangdb)}:

    \code
    qbs generate --generator clangdb
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-session.qdoc0000644000175100017510000000360615154533055022527 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-session.html
    \ingroup cli

    \title session
    \brief Starts a session for interacting with an IDE

    \section1 Synopsis

    \code
    qbs session
    \endcode

    \section1 Description

    Starts a session, communicating via standard input and standard output.

    In this mode, \QBS takes commands from standard input and sends replies
    to standard output, using a \l{Appendix C: The JSON API}{JSON-based API}.

    This is the recommended \QBS interface for IDEs. It can be used to retrieve
    information about a project and interact with it in various ways, such
    as building it, collecting the list of executables, adding new source files
    and so on.

*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-version.qdoc0000644000175100017510000000277715154533055022541 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-version.html
    \ingroup cli

    \title show-version
    \brief Prints the \QBS version.

    \section1 Synopsis

    \code
    qbs show-version
    \endcode

    \section1 Description

    Prints the version of \QBS to stdout.

    \section1 Options

    This command takes no options.

*/
qbs-src-3.2.0/doc/reference/cli/builtin/cli-dump-nodes-tree.qdoc0000644000175100017510000000377315154533055024061 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-dump-nodes-tree.html
    \ingroup cli

    \title dump-nodes-tree
    \brief Dumps the nodes in the build graph to \c stdout.

    \section1 Synopsis

    \code
    qbs dump-nodes-tree [options] [config:configuration-name]
    \endcode

    \section1 Description

    Dumps the nodes in the build graph to \c stdout.

    This is an internal command that is used for debugging purposes only.

    \section1 Options

    \include cli-options.qdocinc build-directory
    \include cli-options.qdocinc products-specified
    \include cli-options.qdocinc settings-dir

    \section1 Parameters

    \include cli-parameters.qdocinc configuration-name

    \section1 Examples

    Dumps the nodes tree into a file called \c nodes-tree.log:

    \code
    qbs dump-nodes-tree >nodes-tree.log
    \endcode

*/
qbs-src-3.2.0/doc/reference/cli/tools/0000755000175100017510000000000015154533055017114 5ustar  runnerrunnerqbs-src-3.2.0/doc/reference/cli/tools/cli-config-ui.qdoc0000644000175100017510000000414015154533055022410 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-config-ui.html
    \ingroup cli

    \title config-ui
    \brief Opens a GUI application for managing \QBS settings, such as
    preferences and profiles.

    \section1 Synopsis

    \code
    qbs config-ui [--settings-dir ] [--system]
    \endcode

    \section1 Description

    Opens the \QBS Settings application for managing \QBS settings, such as
    preferences and profiles, in a hierarchical view. This makes it easier to
    manage a large number of settings than using the \l{config} command from
    the command line.

    \image qbs-settings-gui.png

    For more information, see \l{Configuring Profiles and Preferences}.

    \section1 Options

    \include cli-options.qdocinc settings-dir
    \include cli-options.qdocinc config-ui-system
    \include cli-options.qdocinc help

    \section1 Examples

    Opens \QBS Settings:

    \code
    qbs config-ui
    \endcode

*/
qbs-src-3.2.0/doc/reference/cli/tools/cli-setup-toolchains.qdoc0000644000175100017510000000573015154533055024037 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-setup-toolchains.html
    \ingroup cli

    \title setup-toolchains
    \brief Creates \QBS profiles for toolchains, such as GCC or MSVC.

    \section1 Synopsis

    \code
    qbs setup-toolchains [--settings-dir ] [--system] --detect
    qbs setup-toolchains [--settings-dir ] [--system] [--type ]
                          
    \endcode

    \section1 Description

    The first form tries to auto-detect all known toolchains, looking them up
    via the PATH variable.

    The second form creates a profile with the name \c {} for the
    toolchain located at \c {}. It will attempt to
    determine the toolchain type automatically based on the file name or the
    compiler executable. If that fails, you need to provide the compiler type as
    a value of the \c --type option.

    For more information, see \l{Configuring Profiles and Preferences}.

    \section1 Options

    \include cli-options.qdocinc settings-dir
    \include cli-options.qdocinc setup-tools-system
    \include cli-options.qdocinc detect-toolchains
    \include cli-options.qdocinc type
    \include cli-options.qdocinc help

    \section1 Examples

    Looks up toolchains via the PATH variable and creates profiles for them:

    \code
    qbs setup-toolchains --detect
    \endcode

    Creates a profile called \c mingw for the toolchain located in
    \c C:\mingw530_32\bin on Windows:

    \code
    qbs setup-toolchains C:\mingw530_32\bin\g++.exe mingw
    \endcode

    Creates a profile called \c g++-mingw-w64 for the toolchain located in
    \c /usr/bin/x86_64-w64-mingw32-g++ g++-mingw-w64 on Ubuntu:

    \code
    qbs setup-toolchains /usr/bin/x86_64-w64-mingw32-g++ g++-mingw-w64
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/tools/cli-config.qdoc0000644000175100017510000001064015154533055021777 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-config.html
    \ingroup cli

    \title config
    \brief Manages \QBS settings, such as preferences and profiles.

    \section1 Synopsis

    \code
    qbs config [--settings-dir ] [--user|--system] [--list [ ...]]
               [--unset ] [--export ] [--import ]
    qbs config [--settings-dir ] [--user|--system] 
    qbs config [--settings-dir ] [--user|--system]  
    \endcode

    \section1 Description

    Manages \QBS settings, such as preferences and profiles. You can list all
    keys and remove the specified key, as well as import settings from a file
    or export them to a file.

    The second form of this command displays the specified \c .

    The third form sets the specified \c  with the specified \c .

    There are two sets of settings: The system-level settings affect all users,
    while the user-level settings are specific to the current user.
    By default, the read operations consider both sources. If the same key is
    present in both settings, then for list values, the system value is
    appended to the user value, while for other types of values the user-level
    one takes precedence. Write operations go to the user-level settings by default.
    Use the \c {--user} and \c {--system} options to change this behavior.
    \note It is conceivable that the default system value of the
    \c {preferences.qbsSearchPaths} setting could pull in unwanted \QBS modules,
    in particular when doing cross-builds. In such a case, you can set
    \c {preferences.ignoreSystemSearchPaths} to exclude the search paths coming
    from the system settings. You'll typically do this for a specific profile:
    \code
    $ qbs config profiles.myprofile.preferences.ignoreSystemSearchPaths true
    \endcode

    You can use the \l{config-ui} command to open the Qbs Settings tool for
    managing settings in a hierarchical view.

    For more information, see \l{Configuring Profiles and Preferences}, \l{Managing Qt Versions},
    \l{Modules}, \l {List of Modules}, and \l{Custom Modules and Items}.

    \section1 Options

    \include cli-options.qdocinc settings-dir
    \include cli-options.qdocinc list-root
    \include cli-options.qdocinc unset
    \include cli-options.qdocinc export
    \include cli-options.qdocinc import
    \include cli-options.qdocinc config-user
    \include cli-options.qdocinc config-system
    \include cli-options.qdocinc help

    \section1 Parameters

    \include cli-parameters.qdocinc key

    \section1 Examples

    Lists the existing profiles:

    \code
    qbs config --list profiles
    \endcode

    Shows the default profile:

    \code
    qbs config defaultProfile
    \endcode

    \note If no output is shown, the default profile used is the built-in
    profile \c none, which sets no properties.

    Sets the profile called \c gcc as the base profile of the Qt profile called
    \c myqt:

    \code
    qbs config profiles.myqt.baseProfile gcc
    \endcode

    Adds the location of a custom module to your preferences, to make the module
    accessible in several projects:

    \code
    qbs config preferences.qbsSearchPaths /usr/local/share/custom-qbs-extensions
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/tools/cli-setup-qt.qdoc0000644000175100017510000000457615154533055022327 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-setup-qt.html
    \ingroup cli

    \title setup-qt
    \brief Creates \QBS profiles for Qt installations.

    \section1 Synopsis

    \code
    qbs setup-qt [--settings-dir ] [--system] --detect
    qbs setup-qt [--settings-dir ] [--system]  
    \endcode

    \section1 Description

    Creates \QBS profiles for Qt installations.

    The first form tries to auto-detect all known Qt versions, looking them up
    via the PATH variable.

    The second form creates a profile with the name \c {} for the
    Qt version located at \c {}.

    For more information, see \l{Managing Qt Versions}.

    \section1 Options

    \include cli-options.qdocinc detect-qt-versions
    \include cli-options.qdocinc settings-dir
    \include cli-options.qdocinc setup-tools-system
    \include cli-options.qdocinc help

    \section1 Examples

    Looks up Qt versions in the PATH and creates profiles for them:

    \code
    qbs setup-qt --detect
    \endcode

    Creates a profile called \c myqt for the Qt version located in
    \c /usr/bin/qmake:

    \code
    qbs setup-qt /usr/bin/qmake myqt
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/tools/cli-setup-android.qdoc0000644000175100017510000000447115154533055023315 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-setup-android.html
    \ingroup cli

    \title setup-android
    \brief Creates \QBS profiles for Android SDK and NDK installations.

    \section1 Synopsis

    \code
    qbs setup-android [--settings-dir ] [--ndk-dir ]
                      [--sdk-dir ] [--qt-dir ]
                      
    \endcode

    \section1 Description

    Creates \QBS profiles for Android SDK and NDK installations.

    If a Qt path is given, these additional profiles will be suitable for
    building Qt binaries for the respective architecture, if the Qt
    installation has support for it.

    \section1 Options

    \include cli-options.qdocinc settings-dir
    \include cli-options.qdocinc ndk-dir
    \include cli-options.qdocinc sdk-dir
    \include cli-options.qdocinc qt-dir
    \include cli-options.qdocinc help

    \section1 Examples

    Creates a profile with the name \c oreo that specifies the target platforms'
    \l{qbs::}{architectures} and operating systems, as well as the
    toolchains available:

    \code
    qbs setup-android oreo
    \endcode
*/
qbs-src-3.2.0/doc/reference/cli/tools/cli-create-project.qdoc0000644000175100017510000000457515154533055023453 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page cli-create-project.html
    \ingroup cli

    \title create-project
    \brief Creates a \QBS project from an existing set of source files.

    \section1 Synopsis

    \code
    qbs create-project [--blacklist ] [--whitelist ]
                       [--flat]
    \endcode

    \section1 Description

    Automatically generates \QBS project files from an arbitrary directory
    structure. You can filter the files to add to the project by blacklisting
    or whitelisting them. The command creates nested project files, unless you
    use the \c --flat option.

    This is a useful starting point when migrating from other build tools, such
    as qmake or CMake.

    \note Run this command from the project directory.

    After generating the initial .qbs files, add the missing configuration
    variables and functions to them.

    \section1 Options

    \include cli-options.qdocinc blacklist
    \include cli-options.qdocinc whitelist
    \include cli-options.qdocinc flat
    \include cli-options.qdocinc help

    \section1 Examples

    Creates \c .qbs files in the project directory when run from there:

    \code
    qbs create-project
    \endcode
*/
qbs-src-3.2.0/doc/reference/jsextensions/0000755000175100017510000000000015154533055017741 5ustar  runnerrunnerqbs-src-3.2.0/doc/reference/jsextensions/jsextension-temporarydir.qdoc0000644000175100017510000000443715154533055025711 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page jsextension-temporarydir.html
    \ingroup list-of-builtin-services

    \title TemporaryDir Service
    \brief Creates a unique directory for temporary use.

    The \c TemporaryDir service creates a unique directory for temporary use.

    \section1 Available Operations

    \section2 Constructor
    \code
    TemporaryDir()
    \endcode
    Allocates and returns a new TemporaryDir object.
    This method creates the temporary directory.

    \section2 isValid
    \code
    isValid(): boolean
    \endcode
    Returns \c true if the temporary directory was created successfully.

    \section2 path
    \code
    path(): string
    \endcode
    Returns the path to the temporary directory.
    Empty if the temporary directory could not be created.

    \section2 remove
    \code
    remove(): boolean
    \endcode
    Removes the temporary directory, including all its contents.
    Returns \c true if removing was successful.
    It is recommended to always call this function as soon as you are finished with the temporary
    directory. The directory will not be removed automatically.
*/
qbs-src-3.2.0/doc/reference/jsextensions/jsextensions-general.qdoc0000644000175100017510000001153315154533055024763 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2015 Petroules Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \page jsextensions-general.html
    \ingroup list-of-builtin-services

    \title General Services
    \brief Provides various operations.

    These are operations that do not fit into any of the other categories.
    They are automatically available in any \QBS project file or JavaScript file.

    \section1 Available Operations

    \section2 require
    \code
    require(identifier: string): any
    \endcode
    Loads an extension and returns an object representing the extension.
    If \a identifier is a relative or absolute file path, this function will load a JavaScript file
    and return an object containing the evaluated context of that file. Otherwise, loads a \QBS
    extension named \a identifier and returns an object that contains the extension's context.
    This function is only available in JavaScript files and is designed to behave similarly to the
    CommonJS/RequireJS/Node.js module resolution systems.
    \code
    var MyFunctions = require("./myfunctions.js");
    MyFunctions.doSomething();
    var FileInfo = require("qbs.FileInfo");
    var fileName = FileInfo.fileName(filePath);
    \endcode


    \section1 Extensions to JavaScript Built-in Objects

    \section2 Array.containsAll
    \code
    Array.containsAll(other: any[]): boolean
    \endcode
    Returns \c{true} if the array contains every element in the \c{other} array.
    Returns \c{false} otherwise.

    \section2 Array.containsAny
    \code
    Array.containsAny(other: any[]): boolean
    \endcode
    Returns \c{true} if the array contains some element(s) in the \c{other} array.
    Returns \c{false} otherwise.

    \section2 Array.uniqueConcat
    \code
    Array.uniqueConcat(other: any[]): any[]
    \endcode
    Returns a copy of this array joined with the array \c{other}.
    Duplicates that would originate from the concatenation are removed.
    The order of elements is preserved.


    \section1 Console API

    \QBS provides a subset of the non-standard Console API available in most ECMAScript runtimes.

    The output of each of these functions will only be displayed if the logging level is at least
    the level which the function outputs at. Logging levels from lowest to highest are:
    'error', 'warning', 'info', 'debug', and 'trace'. The default is 'info'.

    \warning The contents of this section are subject to change in order to align with future
    \l{https://www.w3.org/2011/08/browser-testing-charter.html}{standardization}
    \l{https://github.com/DeveloperToolsWG/console-object/blob/master/api.md}{processes}.

    \section2 console.debug
    \code
    console.debug(s: string): void
    \endcode
    This method is an alias for \c{console.log()}.

    \section2 console.error
    \code
    console.error(s: string): void
    \endcode
    Logs an \c{error} level message.
    Outputs to stderr when the logger output is a terminal.
    The string will be prefixed with \c{"ERROR: "} and colored red when the logger output is a
    color-capable terminal.

    \section2 console.info
    \code
    console.info(s: string): void
    \endcode
    Logs an \c{info} level message.
    Outputs to stdout when the logger output is a terminal.

    \section2 console.log
    \code
    console.log(s: string): void
    \endcode
    Logs a \c{debug} level message.
    Outputs to stderr when the logger output is a terminal.

    \section2 console.warn
    \code
    console.warn(s: string): void
    \endcode
    Logs a \c{warning} level message.
    Outputs to stderr when the logger output is a terminal.
    The string will be prefixed with \c{"WARNING: "} and colored yellow when the logger output is a
    color-capable terminal.
*/
qbs-src-3.2.0/doc/reference/jsextensions/jsextension-utilities.qdoc0000644000175100017510000000561615154533055025203 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page jsextension-utilities.html
    \ingroup list-of-builtin-services

    \title Utilities Service
    \brief Provides miscellaneous operations.

    The \c Utilities service offers miscellaneous operations.

    \section1 Available Operations

    \section2 cStringQuote

    \badcode
    Utilities.cStringQuote(str: string): string
    \endcode

    Takes a string and escapes special characters in a way that the result is
    suitable for use as a C/C++ string literal. This function is typically used
    to specify values for \l{cpp::defines}{cpp.defines}.

    \section2 getHash

    \badcode
    Utilities.getHash(key: string): string
    \endcode

    Calculates a 16-byte hash of the input and returns it.
    Rules in modules should use this function to find unique locations for output
    artifacts in the build directory without duplicating the whole directory structure of
    the respective input file (to deal with the case of two files with the same name in different
    subdirectories of the same product).

    \section2 rfc1034Identifier

    \badcode
    Utilities.rfc1034Identifier(str: string): string
    \endcode

    Returns an RFC-1034 compliant identifier based on the given string by replacing each character
    that is not Latin alphanumeric or \c{.} with \c{-}.

    \section2 versionCompare

    \badcode
    Utilities.versionCompare(version1: string, version2: string): number
    \endcode

    Interprets the two arguments as version numbers and returns a number that
    is smaller than, equal to, or greater than zero if \c version1 is smaller
    than, equal to, or greater than \c version2, respectively.

    The version strings consist of up to three numbers separated by dots.
*/
qbs-src-3.2.0/doc/reference/jsextensions/jsextension-propertylist.qdoc0000644000175100017510000001137315154533055025745 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page jsextension-propertylist.html
    \ingroup list-of-builtin-services

    \title PropertyList Service
    \brief Provides read, write and convert operations on property list files.

    The \c PropertyList service allows you to read and write property list files in
    all formats supported by the Core Foundation API: XML, binary, JSON, and OpenStep (read-only).

    This service is only available on Darwin platforms such as iOS, macOS, tvOS, and watchOS.

    \section1 Available operations

    \section2 Constructor
    \code
    PropertyList()
    \endcode
    Allocates and returns a new PropertyList object.

    \section2 clear
    \code
    clear(): void
    \endcode
    Voids the property list by deleting its internal object reference.

    \section2 isEmpty
    \code
    isEmpty(): boolean
    \endcode
    Returns true if the property list has no internal object reference set, otherwise false.

    \section2 format
    \code
    format(): string
    \endcode
    Returns the data format that the property list data was deserialized from. This property is set
    after calling \c readFromString or \c readFromFile.
    Possible return values include: \c "binary1", \c "json", \c "openstep", and \c "xml1".
    If the property list object is empty or the input format could not be determined,
    returns \c undefined.

    \section2 readFromFile
    \code
    readFromFile(filePath: string): void
    \endcode
    Parses the file and stores the result in the property list.
    Throws an exception if an I/O error occurs or the input is in an invalid format.

    \section2 readFromObject
    \code
    readFromObject(obj: any): void
    \endcode
    Sets the given object as the property list's internal object.
    \c format() will return \c undefined as this method does not deserialize a storage format.

    \section2 readFromString
    \code
    readFromString(input: string): void
    \endcode
    Parses \c input and stores the result in the property list.
    This is most useful for initializing a property list object from the result of a
    \c JSON.stringify call.
    Throws an exception if the input is in an invalid format.

    \section2 toObject
    \code
    toObject(): any
    \endcode
    Returns an object representing the property list.

    \section2 toJSON
    \code
    toJSON(style: string = "compact"): string
    \endcode
    Returns a string representation of the property list in JSON format.
    Possible values for \c style include \c "pretty" and \c "compact". The default is compact.

    \section2 toString
    \code
    toString(format: string): string
    \endcode
    Returns a string representation of the property list in the specified format.
    Possible values for \c format include: \c "json" (compact), \c "json-compact", \c "json-pretty",
    and \c "xml1". Currently, the OpenStep format is not supported.
    Throws an exception if the object cannot be written in the given format.

    \section2 toXMLString
    \code
    toXMLString(): string
    \endcode
    Returns a string representation of the property list in XML format.
    This function is a synonym for \c toString("xml1").

    \section2 writeToFile
    \code
    writeToFile(filePath: string, format: string): void
    \endcode
    Writes the property list to the file in the given format.
    Possible values for \c format include: \c "binary1", \c "json" (compact), \c "json-compact",
    \c "json-pretty", and \c "xml1". Currently, the OpenStep format is not supported for writing.
    Throws an exception if an I/O error occurs or the object cannot be written in the given format.
*/
qbs-src-3.2.0/doc/reference/jsextensions/jsextension-binaryfile.qdoc0000644000175100017510000000712615154533055025312 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 Sergey Belyashov 
** Copyright (C) 2017 Denis Shienkov 
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page jsextension-binaryfile.html
    \ingroup list-of-builtin-services

    \title BinaryFile Service
    \brief Provides read and write operations on binary files.

    The \c BinaryFile service allows you to read from and write into binary files.

    \section1 Related Declarations

    \section2 BinaryFile.OpenMode
    \code
    enum BinaryFile.OpenMode { ReadOnly, WriteOnly, ReadWrite }
    \endcode
    List of modes that a file may be opened in.

    The OpenMode values can be combined with the bitwise or operator.

    \section1 Available operations

    \section2 Constructor
    \code
    BinaryFile(filePath: string, openMode: OpenMode = BinaryFile.ReadOnly)
    \endcode
    Opens the file at \c filePath in the given mode and returns the object representing the file.
    \note The mode influences which of the operations listed below can actually be used on the file.

    \section2 atEof
    \code
    atEof(): boolean
    \endcode
    Returns \c{true} if no more data can be read from the file, \c{false} otherwise.

    \section2 close
    \code
    close(): void
    \endcode
    Closes the file. It is recommended to always call this function as soon as you are finished
    with the file, in order to keep the number of in-flight file descriptors as low as possible.

    \section2 filePath
    \code
    filePath(): string
    \endcode
    The absolute path of the file represented by this object.

    \section2 size
    \code
    size(): number
    \endcode
    Returns the size of the file (in bytes).

    \section2 resize
    \code
    resize(size: number): void
    \endcode
    Sets the file \c size (in bytes). If \c size is larger than the file currently is, the new
    bytes will be set to 0; if \c size is smaller, the file is truncated.

    \section2 pos
    \code
    pos(): number
    \endcode
    Returns the position that data is written to or read from.

    \section2 seek
    \code
    seek(pos: number): void
    \endcode
    Sets the current position to \c pos.

    \section2 read
    \code
    read(size: number): number[]
    \endcode
    Reads at most \c size bytes of data from the file and returns it as an array.

    \section2 write
    \code
    write(data: number[]): void
    \endcode
    Writes \c data into the file at the current position.
*/
qbs-src-3.2.0/doc/reference/jsextensions/jsextension-xml.qdoc0000644000175100017510000001760215154533055023766 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page jsextension-xml.html
    \ingroup list-of-builtin-services

    \title Xml Service
    \brief Provides a DOM parser and generator to JavaScript.

    The \c Xml service enables you to access and manipulate XML Document
    Object Model (DOM) documents. The entire document is a \e {document node},
    each XML element is an \e {element node}, the text paragraphs in the XML
    elements are \e {text nodes}, and each attribute is an \e {attribute node}.

    XML DOM presents documents as tree structures. The contents of the nodes
    can be accessed in the tree. They can be modified or deleted, and new
    nodes can be created.

    The nodes in the node tree have a hierarchical relationship to each other.
    The top node is called the \e root. Each node, except the root, has exactly
    one \e parent node, while it can have any number of \e children. Nodes with
    the same parent are called \e siblings.

    \section1 XML DOM Document Node Operations

    A document node represents an entire document. That is, the root of the DOM
    tree.

    \section2 Constructor

    \badcode
    Xml.DomDocument()
    \endcode

    Creates an XML DOM root node that can contain one element.

    \section2 createCDATASection

    \badcode
    Xml.DomDocument.createCDATASection(value: string)
    \endcode

    Creates a CDATA section that is not parsed by a parser. It can be used to
    include XML fragments without having to escape the delimiters, for example.
    Tags inside the section are not treated as markup nor are entities expanded.

    \section2 createElement

    \badcode
    Xml.DomDocument.createElement(tagName: string)
    \endcode

    Creates an element that can contain other elements, CDATA sections, and text
    nodes.

    \section2 createTextNode

    \badcode
    Xml.DomDocument.createTextNode(value: string)
    \endcode

    Creates a text node that represents textual content in an element or
    attribute.

    \section2 documentElement

    \badcode
    Xml.DomDocument.documentElement()
    \endcode

    Returns the document element.

    \section2 load

    \badcode
    Xml.DomDocument.load(filePath: string): void
    \endcode

    Loads the document specified by \c filePath.

    \section2 save

    \badcode
    Xml.DomDocument.save(filePath: string, indentation: int): void
    \endcode

    Saves the document at the location specified by \c filePath with the
    indentation specified by \c int.

    \section2 setContent

    \badcode
    Xml.DomDocument.setContent(content: string)
    \endcode

    Returns the content of the document.

    \section2 toString

    \badcode
    Xml.DomDocument.toString(indentation: int)
    \endcode

    Converts the document to a string with the indentation specified by \c int.

    \section1 XML DOM Node Operations

    A node represents a single node in the document tree. There are several
    different types of nodes, such as element, attribute, and text nodes.

    All objects inherit the node properties for handling parents and children,
    even if they cannot have parents or children. For example, attempting to add
    children to text nodes results in a DOM error.

    \section2 Constructor

    \badcode
    Xml.DomNode()
    \endcode

    Creates an XML DOM node.

    \section2 appendChild

    \badcode
    Xml.DomNode.appendChild(tagName: string)
    \endcode

    Appends a new child node to the end of the list of children of a node.

    \section2 attribute

    \badcode
    Xml.DomNode.attribute(name: string, defaultValue: string)
    \endcode

    Returns the name and default value of the attribute.

    \section2 clear

    \badcode
    Xml.DomNode.clear()
    \endcode

    Clears the contents of the node.

    \section2 data

    \badcode
    Xml.DomNode.data()
    \endcode

    Returns the contents of the text node, CDATA section, or character data
    node.

    \section2 firstChild

    \badcode
    Xml.DomNode.firstChild(tagName: string)
    \endcode

    Returns the first child of a node.

    \section2 hasAttribute

    \badcode
    Xml.DomNode.hasAttribute(name: string) boolean
    \endcode

    Returns \c true if the node has the specified attribute.

    \section2 hasAttributes

    \badcode
    Xml.DomNode.hasAttributes() boolean
    \endcode

    Returns \c true if the node has attributes.

    \section2 hasChildNodes

    \badcode
    Xml.DomNode.hasChildNodes() boolean
    \endcode

    Returns \c true if the node has children.

    \section2 insertAfter

    \badcode
    Xml.DomNode.insertAfter(newChild: tagName, refChild: tagName)
    \endcode

    Inserts a new child node after the child node specified by \c refChild.

    \section2 insertBefore

    \badcode
    Xml.DomNode.insertBefore(newChild: tagName, refChild: tagName)
    \endcode

    Inserts a new child node before the child node specified by \c refChild.

    \section2 isCDATASection

    \badcode
    Xml.DomNode.isCDATASection() boolean
    \endcode

    Returns \c true if this is a CDATA section.

    \section2 isElement

    \badcode
    Xml.DomNode.isElement() boolean
    \endcode

    Returns \c true if this is an element.

    \section2 isText

    \badcode
    Xml.DomNode.isText() boolean
    \endcode

    Returns \c true if this is a text node.

    \section2 lastChild

    \badcode
    Xml.DomNode.lastChild(tagName: string)
    \endcode

    Returns the last child of a node.

    \section2 nextSibling

    \badcode
    Xml.DomNode.nextSibling(tagName: string)
    \endcode

    Returns the node immediately following a node.

    \section2 parentNode

    \badcode
    Xml.DomNode.parentNode()
    \endcode

    Returns the parent of the node.

    \section2 previousSibling

    \badcode
    Xml.DomNode.previousSibling(tagName: string)
    \endcode

    Returns the node before a node.

    \section2 removeChild

    \badcode
    Xml.DomNode.removeChild(tagName: string)
    \endcode

    Removes the child node.

    \section2 replaceChild

    \badcode
    Xml.DomNode.replaceChild(newChild: tagName, oldChild: tagName)
    \endcode

    Replaces a child node with another one.

    \section2 setAttribute

    \badcode
    Xml.DomNode.setAttribute(name: string, value: string)
    \endcode

    Sets the name and value of an attribute.

    \section2 setData

    \badcode
    Xml.DomNode.setData(value: string): void
    \endcode

    Sets the data of the node to a text node, CDATA section, or character data
    node.

    \section2 setTagName

    \badcode
    Xml.DomNode.setTagName(tagName: string)
    \endcode

    Sets the tag name of the node.

    \section2 tagName

    \badcode
    Xml.DomNode.tagName()
    \endcode

    Returns the tag name of the node.

    \section2 text

    \badcode
    Xml.DomNode.text()
    \endcode

    Returns the text of the node.
*/
qbs-src-3.2.0/doc/reference/jsextensions/jsextension-host.qdoc0000644000175100017510000001100115154533055024126 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2022 Raphaël Cotty 
** 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$
**
****************************************************************************/

/*!
    \page jsextension-host.html
    \ingroup list-of-builtin-services

    \title Host Service
    \brief Provides host information.

    The \c Host service offers various information about the host environment, such as operating
    system names, platform name.

    \section1 Available Operations

    \section2 architecture
    \code
    Host.architecture(): string
    \endcode
    Returns the host operating system architecture.

    See \l{qbs::architecture}{qbs.architecture} for the target-specific equivalent property.
    architecture.
    \funsince 1.22

    \section2 os
    \code
    Host.os(): string[]
    \endcode
    Returns the host operating system names.

    See the \l{qbs::targetOS}{qbs.targetOS} for the target-specific equivalent property.
    \funsince 1.22

    \section2 platform
    \code
    Host.platform(): string
    \endcode
    Returns the host operating system platform.

    See the \l{qbs::targetPlatform}{qbs.targetPlatform} for the target-specific equivalent property.
    \funsince 1.22


    \section2 osVersion
    \code
    Host.osVersion(): string
    \endcode
    Returns the host operating system version. Currently, only defined for Windows and Apple
    platforms.

    Consists of two or three numbers separated by dots. For example, \c "10.9" or \c "6.3.9600".
    \funsince 1.22

    \section2 osBuildVersion
    \code
    Host.osBuildVersion(): string
    \endcode
    Returns the host operating system build version. Currently, only defined for Windows and Apple
    platforms.

    On Windows, this is the 4 or 5 digit Windows build number and is equivalent
    to \l{qbs::}{versionPatch}. On Apple platforms, this is a standard build number in the Apple
    versioning scheme. For example, \c "13C64".
    \funsince 1.22

    \section2 osVersionParts
    \code
    Host.osVersionParts(): string[]
    \endcode
    Returns the host operating system version as a list.

    For example, Windows 8.1 (version 6.3.9600) would correspond to a value of \c[6, 3, 9600].
    \funsince 1.22

    \section2 osVersionMajor
    \code
    Host.osVersionMajor(): number
    \endcode
    Returns the host operating system major version.
    \funsince 1.22

    \section2 osVersionMinor
    \code
    Host.osVersionMinor(): number
    \endcode
    Returns the host operating system minor version.
    \funsince 1.22

    \section2 osVersionPatch
    \code
    Host.osVersionPatch(): number
    \endcode
    Returns the host operating system patch level.
    \funsince 1.22

    \section2 nullDevice
    \code
    Host.nullDevice(): string[]
    \endcode
    Returns the platform-specific file path corresponding to the null device.
    \funsince 1.22
*/
qbs-src-3.2.0/doc/reference/jsextensions/jsextension-file.qdoc0000644000175100017510000000753615154533055024112 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page jsextension-file.html
    \ingroup list-of-builtin-services

    \title File Service
    \brief Provides operations on the file system.

    The \c File service offers limited access to the file system for operations such as copying
    or removing files.

    \section1 Available Operations

    \section2 copy
    \code
    File.copy(sourceFilePath: string, targetFilePath: string): boolean
    \endcode
    Copies \c sourceFilePath to \c targetFilePath. Any directory components in \c targetFilePath
    that do not yet exist will be created. If \c sourceFilePath is a directory, a recursive
    copy will be made. If an error occurs, a JavaScript exception will be thrown.
    \note \c targetFilePath must be the counterpart of \c sourceFilePath at the new location,
    \b{not} the new parent directory. This allows the copy to have a different name and is true
    even if \c sourceFilePath is a directory.
    \note The file is not copied if the source file timestamp is older than the destination file
    timestamp. If you want to replace the newer file, you need to remove it first via
    File.remove().

    \section2 exists
    \code
    File.exists(filePath: string): boolean
    \endcode
    Returns true if and only if there is a file at \c filePath.

    \section2 directoryEntries
    \code
    File.directoryEntries(path: string, filter: File.Filter): string[]
    \endcode
    Returns a sorted list of the directory \c{path}'s contents non-recursively,
    filtered by \c filter. The values of \c filter are equivalent to Qt's \c QDir::Filter.

    \section2 lastModified
    \code
    File.lastModified(filePath: string): number
    \endcode
    Returns the time of last modification for the file at \c filePath. The concrete semantics of the
    returned value are platform-specific. You should only rely on the property that a smaller value
    indicates an older timestamp.

    \section2 makePath
    \code
    File.makePath(path: string): boolean
    \endcode
    Makes the directory at \c path, creating intermediate directories if necessary.
    Conceptually equivalent to \c{mkdir -p}

    \section2 move
    \code
    File.move(oldPath: string, newPath: string, overwrite: boolean = true): boolean
    \endcode
    Renames the file \c oldPath to \c newPath.
    Returns \c true if successful; otherwise returns \c false.
    If a file with the name \c newPath already exists, and \c overwrite is \c false,
    \c move() returns \c false (that is, the file will not be overwritten).

    \section2 remove
    \code
    File.remove(filePath: string): boolean
    \endcode
    Removes the file at \c filePath. In case of a directory, it will be removed recursively.
*/
qbs-src-3.2.0/doc/reference/jsextensions/jsextension-fileinfo.qdoc0000644000175100017510000001436515154533055024764 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page jsextension-fileinfo.html
    \ingroup list-of-builtin-services

    \title FileInfo Service
    \brief Provides operations on file paths.

    The \c FileInfo service offers various operations on file paths, such as turning absolute
    paths into relative ones, splitting a path into its components, and so on.

    \section1 Available Operations

    \section2 baseName
    \code
    FileInfo.baseName(filePath: string): string
    \endcode
    Returns the file name of \c filePath up to (but not including) the first '.' character.

    \section2 canonicalPath
    \code
    FileInfo.canonicalPath(filePath: string): string
    \endcode
    Returns a canonicalized \c filePath, i.e. an absolute path without symbolic
    links or redundant "." or ".." elements.
    On Windows, drive substitutions are also resolved.

    It is recommended to use \c{canonicalPath} in only those cases where
    canonical paths are really necessary. In most cases, \c{cleanPath} should
    be enough.

    \section2 cleanPath
    \code
    FileInfo.cleanPath(filePath: string): string
    \endcode
    Returns \c filePath without redundant separators and with resolved occurrences of
    \c{.} and \c{..} components. For instance, \c{/usr/local//../bin/} becomes \c{/usr/bin}.

    \section2 completeBaseName
    \code
    FileInfo.completeBaseName(filePath: string): string
    \endcode
    Returns the file name of \c filePath up to (but not including) the last '.' character.

    \section2 completeSuffix
    \code
    FileInfo.completeSuffix(filePath: string): string
    \endcode
    Returns the file suffix of \c filePath from (but not including) the last '.' character.
    \funsince 1.12

    \section2 fileName
    \code
    FileInfo.fileName(filePath: string): string
    \endcode
    Returns the last component of \c filePath, that is, everything after the
    last '/' character.

    \section2 fromNativeSeparators
    \code
    FileInfo.fromNativeSeparators(filePath: string): string
    \endcode
    On Windows hosts, this function behaves the same as \l fromWindowsSeparators. On other
    operating systems, it returns the input unmodified.

    \section2 fromWindowsSeparators
    \code
    FileInfo.fromWindowsSeparators(filePath: string): string
    \endcode
    Returns \c filePath with all '\\' characters replaced by '/'.

    \section2 isAbsolutePath
    \code
    FileInfo.isAbsolutePath(filePath: string, hostOS?: string[]): boolean
    \endcode
    Returns true if \c filePath is an absolute path and false if it is a relative one.
    If \c hostOS is specified, treats \c filePath as a file path of the kind found on that platform.
    This parameter defaults to the host OS on which \QBS is running and should normally be omitted.

    \section2 joinPaths
    \code
    FileInfo.joinPaths(...paths: string[]): string
    \endcode
    Concatenates the given paths using the '/' character.

    \section2 path
    \code
    FileInfo.path(filePath: string, hostOS?: string[]): string
    \endcode
    Returns the part of \c filePath that is not the file name, that is,
    everything up to
    (but not including) the last '/' character. If \c filePath is just a file name, then '.'
    is returned. If \c filePath ends with a '/' character, then the file name is assumed to be empty
    for the purpose of the above definition.
    If \c hostOS is specified, treats \c filePath as a file path of the kind found on that platform.
    This parameter defaults to the host OS on which \QBS is running and should normally be omitted.

    \section2 relativePath
    \code
    FileInfo.relativePath(dirPath: string, filePath: string): string
    \endcode
    Returns a relative path so that joining \c dirPath and the returned path results in \c filePath.
    If necessary, '..' components are inserted.
    The function assumes \c dirPath and \c filePath to be absolute paths and \c dirPath to
    be a directory.

    \section2 suffix
    \code
    FileInfo.suffix(filePath: string): string
    \endcode
    Returns the file suffix of \c filePath from (but not including) the first '.' character.
    \funsince 1.12

    \section2 toNativeSeparators
    \code
    FileInfo.toNativeSeparators(filePath: string): string
    \endcode
    On Windows hosts, this function behaves the same as \l toWindowsSeparators. On other
    operating systems, it returns the input unmodified.

    \section2 toWindowsSeparators
    \code
    FileInfo.toWindowsSeparators(filePath: string): string
    \endcode
    Returns \c filePath with all '/' characters replaced by '\\'.

    \section2 pathListSeparator
    \code
    FileInfo.pathListSeparator(): string
    \endcode
    Returns the host operating system separator for a path list that is used in environment
    variables or other contexts.
    \funsince 1.22

    \section2 pathSeparator
    \code
    FileInfo.pathSeparator(): string
    \endcode
    Returns the host operating system path separator.
    \funsince 1.22

    \section2 executableSuffix
    \code
        FileInfo.executableSuffix(): string
    \endcode
    Returns the host operating system executable suffix.
    \funsince 1.23
*/
qbs-src-3.2.0/doc/reference/jsextensions/jsextension-textfile.qdoc0000644000175100017510000000707515154533055025015 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page jsextension-textfile.html
    \ingroup list-of-builtin-services

    \title TextFile Service
    \brief Provides read and write operations on text files.

    The \c TextFile service allows you to read from and write into text files.

    \section1 Related Declarations

    \section2 TextFile.OpenMode
    \code
    enum TextFile.OpenMode { ReadOnly, WriteOnly, ReadWrite, Append }
    \endcode
    List of modes that a file may be opened in.

    The OpenMode values can be combined with the bitwise or operator.

    \section1 Available operations

    \section2 Constructor
    \code
    TextFile(filePath: string, openMode: OpenMode = TextFile.ReadOnly)
    \endcode
    Opens the file at \c filePath in the given mode and returns the object representing the file.
    \note The mode influences which of the operations listed below can actually be used on the file.

    \section2 atEof
    \code
    atEof(): boolean
    \endcode
    Returns \c{true} if no more data can be read from the file, \c{false} otherwise.

    \section2 close
    \code
    close(): void
    \endcode
    Closes the file. It is recommended to always call this function as soon as you are finished
    with the file, in order to keep the number of in-flight file descriptors as low as possible.

    \section2 filePath
    \code
    filePath(): string
    \endcode
    The absolute path of the file represented by this object.

    \section2 readAll
    \code
    readAll(): string
    \endcode
    Reads all data from the file and returns it.

    \section2 readLine
    \code
    readLine(): string
    \endcode
    Reads one line of text from the file and returns it. The returned string does not contain
    the newline characters.

    \section2 setCodec
    \code
    setCodec(codec: string): void
    \endcode
    Sets the text codec to \c codec. The supported codecs are the same as for \c QTextCodec,
    for example: "UTF-8", "UTF-16", and "ISO 8859-1".

    \section2 truncate
    \code
    truncate(): void
    \endcode
    Truncates the file, that is, gives it the size of zero, removing all content.

    \section2 write
    \code
    write(data: string): void
    \endcode
    Writes \c data into the file at the current position.

    \section2 writeLine
    \code
    writeLine(data: string): void
    \endcode
    Writes \c data into the file at the current position and appends the newline character(s).
*/
qbs-src-3.2.0/doc/reference/jsextensions/jsextension-environment.qdoc0000644000175100017510000000513015154533055025523 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page jsextension-environment.html
    \ingroup list-of-builtin-services

    \title Environment Service
    \brief Provides operations on the system environment.

    The \c Environment service offers access to the system environment or process environment.

    \section1 Available Operations

    \section2 currentEnv
    \code
    Environment.currentEnv(): { [key: string]: string; }
    \endcode
    Returns the environment of \QBS in the current context as an object whose properties are
    the environment variables.

    \section2 getEnv
    \code
    Environment.getEnv(key: string): string
    \endcode
    Tries to find a variable with the given name in the current context's environment and returns
    its value. If no such variable could be found, \c undefined is returned.

    \section2 putEnv
    \code
    Environment.putEnv(key: string, value: string): void
    \endcode
    Sets the value of the environment variable with the given name in the build or run environment.
    This method is only available in the \c Module.setupBuildEnvironment and
    \c Module.setupRunEnvironment scripts.

    \section2 unsetEnv
    \code
    Environment.unsetEnv(key: string): void
    \endcode
    Unsets the environment variable with the given name from the build or run environment.
    This method is only available in the \c Module.setupBuildEnvironment and
    \c Module.setupRunEnvironment scripts.
*/
qbs-src-3.2.0/doc/reference/jsextensions/jsextension-process.qdoc0000644000175100017510000001461315154533055024643 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page jsextension-process.html
    \ingroup list-of-builtin-services

    \title Process Service
    \brief Allows you to start external processes.

    The \c Process service allows you to start processes, track their output,
    and so on.

    \section1 Available Operations

    \section2 Constructor
    \code
    Process()
    \endcode
    Allocates and returns a new Process object.

    \section2 close
    \code
    close(): void
    \endcode
    Frees the resources associated with the process. It is recommended to always call this function as
    soon as you are finished with the process.

    \section2 closeWriteChannel
    \code
    closeWriteChannel(): void
    \endcode
    Schedules the stdin channel of process to be closed. The channel will close once all data has been
    written to the process. After calling this function, any attempts to write to the process will do
    nothing. See \c QProcess::closeWriteChannel() for more details.

    \section2 errorString
    \code
    errorString(): string
    \endcode
    Returns a human-readable description of the last error that occurred with the process.
    This can be useful when \c start() or \c exec() fails, to provide more detailed information
    about the reason (for example, "No such file or directory"). See \c QIODevice::errorString() for
    more details.
    \since Qbs 3.1.0

    \section2 exec
    \code
    exec(filePath: string, arguments: string[], throwOnError: boolean): number
    \endcode
    Executes the program at \c filePath with the given argument list and blocks until the
    process is finished. If an error occurs (for example, there is no executable
    file at \c filePath)
    and \c throwOnError is true, then a JavaScript exception will be thrown. Otherwise
    (the default), -1 will be returned in case of an error. The normal return code is the exit code
    of the process.

    \section2 exitCode
    \code
    exitCode(): number
    \endcode
    Returns the exit code of the process. This is needed for retrieving the exit code from
    processes started via \c start(), rather than \c exec().

    \section2 getEnv
    \code
    getEnv(varName: string): string
    \endcode
    Returns the value of the variable \c varName in the process' environment.

    \section2 kill
    \code
    kill(): void
    \endcode
    Kills the process, causing it to exit immediately.

    \section2 readLine
    \code
    readLine(): string
    \endcode
    Reads and returns one line of text from the process output, without the newline character(s).

    \section2 atEnd
    \code
    atEnd(): boolean
    \endcode
    Returns true if there is no more data to be read from the process output, otherwise
    returns false.

    \section2 readStdErr
    \code
    readStdErr(): string
    \endcode
    Reads and returns all data from the process' standard error channel.

    \section2 readStdOut
    \code
    readStdOut(): string
    \endcode
    Reads and returns all data from the process' standard output channel.

    \section2 setCodec
    \code
    setCodec(codec)
    \endcode
    Sets the text codec to \c codec. The codec is used for reading and writing from and to
    the process, respectively. The supported codecs are the same as for \c QTextCodec, for example:
    "UTF-8", "UTF-16", and "ISO 8859-1".

    \section2 setEnv
    \code
    setEnv(varName: string, varValue: string): string
    \endcode
    Sets the value of variable \c varName to \c varValue in the process environment.
    This only has an effect if called before the process is started.

    \section2 setWorkingDirectory
    \code
    setWorkingDirectory(path: string): void
    \endcode
    Sets the directory the process will be started in.
    This only has an effect if called before the process is started.

    \section2 start
    \code
    start(filePath: string, arguments: string[]): boolean
    \endcode
    Starts the program at \c filePath with the given list of arguments. Returns \c{true} if the
    process could be started and \c{false} otherwise.
    \note This call returns right after starting the process and should be used only if you need
    to interact with the process while it is running. Most of the time, you want to use \c exec()
    instead.

    \section2 terminate
    \code
    terminate(): void
    \endcode
    Tries to terminate the process. This is not guaranteed to make the process exit immediately;
    if you need that, use \c kill().

    \section2 waitForFinished
    \code
    waitForFinished(timeout: number): boolean
    \endcode
    Blocks until the process has finished or \c timeout milliseconds have passed (default is 30000).
    Returns true if the process has finished and false if the operation has timed out.
    Calling this function only makes sense for processes started via \c start() (as opposed to
    \c exec()).

    \section2 workingDirectory
    \code
    workingDirectory(): string
    \endcode
    Returns the directory the process will be started in.

    \section2 write
    \code
    write(data: string): void
    \endcode
    Writes \c data into the process' input channel.

    \section2 writeLine
    \code
    writeLine(data: string): void
    \endcode
    Writes \c data, followed by the newline character(s), into the process' input channel.
*/
qbs-src-3.2.0/doc/reference/reference.qdoc0000644000175100017510000000716415154533055020023 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage howtos.html
    \page reference.html
    \nextpage building-qbs.html

    \title Reference

    \list
        \li \l{List of All Items}
        \list
            \li \l{List of Language Items}
            \li \l{List of Convenience Items}
            \li \l{List of Probes}
        \endlist
        \li \l{List of Built-in Services}
        \li \l{Command-Line Interface}
        \li \l{List of Modules}
        \li \l{Command and JavaScriptCommand}
    \endlist
*/

/*!
    \group list-of-builtin-services
    \title List of Built-in Services
    \QBS provides the following built-in JavaScript extensions to simplify operations that
    are expected to be needed often in project files.

    To gain access to the operations provided by a particular Service - for example,
    the File service - use the following statement at the top of your \QBS project file:
    \code
    import qbs.File
    \endcode

    If you instead need to access the service from a JavaScript file, import it using the following
    statement at the top of your JavaScript file:
    \code
    var File = require("qbs.File");
    \endcode
*/

/*!
    \qmlmodule QbsModules
    \title List of Modules
    These are the modules shipped with \QBS.

    For a list of \QBS modules that provide support for Qt modules, see
    \l{Qt Modules}. Only the Qt modules that have properties and relevant file
    tags are described in separate topics.
*/

/*!
    \qmlmodule QbsModuleProviders
    \title List of Module Providers
    These are the module providers shipped with \QBS.
*/

/*!
    \group list-of-items
    \title List of All Items

    \QBS provides the following \l{List of Language Items}{built-in},
    \l{List of Convenience Items}{convenience}, and \l{List of Probes}{probe}
    items to define projects.
*/

/*!
    \qmlmodule QbsLanguageItems
    \title List of Language Items

    \QBS provides the following built-in QML items to define projects.
    These are the primitives upon which all other \QBS items are built.
*/

/*!
    \qmlmodule QbsConvenienceItems
    \title List of Convenience Items

    \QBS provides the following QML items for convenience.
*/

/*!
    \qmlmodule QbsProbes
    \title List of Probes

    These are the probes shipped with \QBS.

    Probes are used to retrieve information from the system prior to building. Typically, probes
    call external processes to get the required information. For details, see \l{Probe}{Probe} page.
*/
qbs-src-3.2.0/doc/reference/items/0000755000175100017510000000000015154533055016326 5ustar  runnerrunnerqbs-src-3.2.0/doc/reference/items/probe/0000755000175100017510000000000015154533055017435 5ustar  runnerrunnerqbs-src-3.2.0/doc/reference/items/probe/keil-probe.qdoc0000644000175100017510000000501215154533055022334 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2019 Denis Shienkov 
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \qmltype KeilProbe
    \inqmlmodule QbsProbes
    \ingroup list-of-items
    \keyword QML.KeilProbe
    \inherits PathProbe
    \brief Collects KEIL toolchain compiler information.
    \since Qbs 1.13
    \internal

    Detects the version, supported architecture and the platform
    endianness of the specified compiler executable file from the
    \l{https://www.keil.com/}{KEIL} toolchain.
*/

/*!
    \qmlproperty string KeilProbe::compilerFilePath

    An input property which is a full path to the KEIL compiler executable file.

    \nodefaultvalue
*/

/*!
    \qmlproperty string KeilProbe::architecture

    Detected architecture of the target platform's processor.

    The possible values are \c "arm", \c "mcs51", \c "mcs251" and \c "c166".

    \nodefaultvalue
*/

/*!
    \qmlproperty string KeilProbe::endianness

    Detected endianness of the target platform's processor architecture.

    The possible values are \c "big" or \c "little".

    \nodefaultvalue
*/

/*!
    \qmlproperty int KeilProbe::versionMajor

    Detected major compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty int KeilProbe::versionMinor

    Detected minor compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty int KeilProbe::versionPatch

    Detected patch compiler version.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/items/probe/include-probe.qdoc0000644000175100017510000000350615154533055023041 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype IncludeProbe
    \inqmlmodule QbsProbes
    \ingroup list-of-items
    \keyword QML.IncludeProbe
    \inherits PathProbe

    \brief Locates header files outside the project.

    This is the convenience item that searches for files in "include" directories.

    For example, IncludeProbe can be used to search for a zlib header as follows:

    \code
    import qbs.Probes

    CppApplication {
        Probes.IncludeProbe {
            id: zlibProbe
            names: "zlib.h"
        }
        cpp.includePaths: zlibProbe.found ? [zlibProbe.path] : []
        files: 'main.cpp'
    }
    \endcode
*/
qbs-src-3.2.0/doc/reference/items/probe/sdcc-probe.qdoc0000644000175100017510000000477215154533055022340 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2019 Denis Shienkov 
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \qmltype SdccProbe
    \inqmlmodule QbsProbes
    \ingroup list-of-items
    \keyword QML.SdccProbe
    \inherits PathProbe
    \brief Collects SDCC toolchain compiler information.
    \since Qbs 1.14
    \internal

    Detects the version, supported architecture and the platform
    endianness of the specified compiler executable file from the
    \l{http://sdcc.sourceforge.net/}{SDCC} toolchain.
*/

/*!
    \qmlproperty string SdccProbe::compilerFilePath

    An input property which is a full path to the SDCC compiler executable file.

    \nodefaultvalue
*/

/*!
    \qmlproperty string SdccProbe::architecture

    Detected architecture of the target platform's processor.

    The possible values are \c "mcs51", \c "stm8", and \c "hcs8".

    \nodefaultvalue
*/

/*!
    \qmlproperty string SdccProbe::endianness

    Detected endianness of the target platform's processor architecture.

    The possible values are \c "little".

    \nodefaultvalue
*/

/*!
    \qmlproperty int SdccProbe::versionMajor

    Detected major compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty int SdccProbe::versionMinor

    Detected minor compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty int SdccProbe::versionPatch

    Detected patch compiler version.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/items/probe/dmc-probe.qdoc0000644000175100017510000000543615154533055022165 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2021 Denis Shienkov 
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype DmcProbe
    \inqmlmodule QbsProbes
    \ingroup list-of-items
    \keyword QML.DmcProbe
    \inherits PathProbe
    \brief Collects Digital Mars toolchain compiler information.
    \since Qbs 1.13
    \internal

    Detects the version, supported architecture, the platform
    endianness, and other stuff for the specified compiler executable
    from the \l{https://www.digitalmars.com/}{Digital Mars} toolchain.
*/

/*!
    \qmlproperty string DmcProbe::compilerFilePath

    An input property which is a full path to the Digital Mars compiler
    executable.

    \nodefaultvalue
*/

/*!
    \qmlproperty string DmcProbe::architecture

    Detected architecture of the target platform's processor.

    The possible values are \c "x86" and \c "x86_16".

    \nodefaultvalue
*/

/*!
    \qmlproperty string DmcProbe::targetPlatform

    Detected target platform.

    The possible values are \c "windows" and \c "dos".

    \nodefaultvalue
*/

/*!
    \qmlproperty int DmcProbe::versionMajor

    Detected major compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty int DmcProbe::versionMinor

    Detected minor compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty int DmcProbe::versionPatch

    Detected patch compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList DmcProbe::includePaths

    Detected compiler include paths.

    \nodefaultvalue
*/

/*!
    \qmlproperty var DmcProbe::compilerDefinesByLanguage

    Detected set of compiler pre-defined macros depending
    on the \c "C" or \c "C++" language.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/items/probe/framework-probe.qdoc0000644000175100017510000000433015154533055023407 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype FrameworkProbe
    \inqmlmodule QbsProbes
    \ingroup list-of-items
    \keyword QML.FrameworkProbe
    \inherits PathProbe

    \brief Locates \macos frameworks outside the project.

    Finds \macos frameworks that have the specified file names.

    By default, FrameworkProbe searches for frameworks in \c ~/Library/Frameworks,
    \c /usr/local/lib, \c /Library/Frameworks, and in \c /System/Library/Frameworks.

    Also, if \l {qbs::sysroot}{qbs.sysroot} is specified (for example, when compiling using XCode
    SDK), the probe searches in the \c sysroot/System/Library/Frameworks folder first.

    For example, a simple FrameworkProbe that searches for the Foundation framework can be used as
    follows:

    \code
    import qbs.Probes
    Product {
        Depends { name: "cpp"; }
        Probes.FrameworkProbe {
            id: foundationProbe
            names: ["Foundation"]
        }
        cpp.frameworkPaths: foundationProbe.found ? [foundationProbe.path] : []
    }
    \endcode
*/
qbs-src-3.2.0/doc/reference/items/probe/path-probe.qdoc0000644000175100017510000001572615154533055022361 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \qmltype PathProbe
    \inqmlmodule QbsProbes
    \ingroup list-of-items
    \keyword QML.PathProbe

    \brief Locates files outside the project.

    Finds files that have the specified file name suffix, such as \e .exe, from the specified
    locations.

    PathProbe takes as input lists of paths to search files from and file name patterns. The paths
    are specified by using the environmentPaths, searchPaths, platformEnvironmentPaths and
    platformSearchPaths properties; the path are searched in the same order as listed. The file
    name patterns are specified by the \l names and nameSuffixes properties. Returns the first file
    that matches the file name patterns. If no such file is found, the
    \l {Probe::found}{probe.found} property is set to \c false.

    For example, a simple PathProbe that searches for the stdio.h header can be used as follows:

    \code
    Product {
        Depends { name: "cpp" }
        PathProbe {
            id: probe
            pathSuffixes: ["include"]
            names: ["stdio.h"]
        }
        cpp.includePaths: probe.found ? [probe.path] : []
    }
    \endcode
*/

/*!
    \qmlproperty varList PathProbe::allResults

    This property contains the list of objects, each object representing a single found file:
    \code
    {
        found: true,
        candidatePaths: ["path1/to/file", "path2/to/file", ...]
        filePath: "path/to/file"
        fileName: "file"
        path: "path/to"
    }
    \endcode
    \sa {PathProbe::filePath}{filePath}, {PathProbe::fileName}{fileName},
    {PathProbe::path}{path}
*/

/*!
    \qmlproperty var PathProbe::candidateFilter

    This property holds the function that can be used to filter out unsuitable candidates.
    For example, when searching for a library, it might be necessary to check its architecture:
    \code
    PathProbe {
        pathSuffixes: [".so", ".dll", ".dylib"]
        candidateFilter: {
            function getLibraryArchitecture(file) { ... }
            return function(file) {
                return Utilities.isSharedLibrary(file)
                        && getLibraryArchitecture(file) == qbs.architecture;
            }
        }
    }
    \endcode
*/

/*!
    \qmlproperty stringList PathProbe::names

    The list of file names to search for.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PathProbe::nameSuffixes

    The list of file suffixes to search for. These suffixes are appended to every file name passed
    via the \l names property.

    \nodefaultvalue
*/

/*!
    \qmlproperty script PathProbe::nameFilter

    A script that is executed for each file name before prepending file suffixes. Can be used to
    transform file names.
*/

/*!
    \qmlproperty pathList PathProbe::searchPaths

    The list of paths where to search files.

    \nodefaultvalue
*/

/*!
    \qmlproperty pathList PathProbe::platformSearchPaths

    The list of platform paths where to search files.

    \defaultvalue \c {['/usr', '/usr/local']} on Unix hosts, empty otherwise
*/

/*!
    \qmlproperty stringList PathProbe::pathSuffixes

    A list of relative paths that are appended to each path where PathProbe searches for files.
    That is, the file should be located within one of the subfolders passed using this
    property.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PathProbe::environmentPaths

    The list of environment variables that contains paths where to search files. Paths in the
    environment variable should be separated using
    \l{pathListSeparator}{FileInfo.pathListSeparator()}.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PathProbe::platformEnvironmentPaths

    The list of platform environment variables that contains paths where to search files. Paths in
    the environment variable should be separated using
    \l{pathListSeparator}{FileInfo.pathListSeparator()}.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PathProbe::candidatePaths

    This property contains the result list of all paths that were checked before a file was found
    (including the file names).

    This property is set even if the Probe didn't find anything and can be used to give the user
    a hint what went wrong:
    \code
    Module {
        Probes.BinaryProbe {
            id: pythonProbe
            names: "python"
        }
        validate: {
            if (!pythonProbe.found) {
                throw ModUtils.ModuleError(
                        "Could not find python binary at any of the following locations:\n\t" +
                        pythonProbe.candidatePaths.join("\n\t"));
            }
        }
    }
    \endcode

    \nodefaultvalue
*/

/*!
    \qmlproperty string PathProbe::path

    This property contains the full path where the found file is located
    (that is, the file directory).

    \nodefaultvalue
*/

/*!
    \qmlproperty string PathProbe::filePath

    This property contains the full path to the found file, including the file name.

    \nodefaultvalue
*/

/*!
    \qmlproperty string PathProbe::fileName

    This property contains the found file's name (excluding the path).

    \nodefaultvalue
*/

/*!
    \qmlproperty varList PathProbe::selectors

    This property should be used to search for multiple files. It contains the list of selectors
    each of which describes a single file to search for. A selector can be either a string, a
    stringList, or a dictionary.

    The following example searches for three files and illustrates different ways to specify
    selectors:
    \code
    selectors: [
        // 1st file with a single name
        "header.h",
        // 2nd file with possible name variants
        ["config.h", "foo-config.h", "bar-config.h"],
        // 3rd file with possible name and suffix variants
        {names: ["footk", "footk-version"], nameSuffixes: [".h", ".hpp"]}
    ]
    \endcode
*/
qbs-src-3.2.0/doc/reference/items/probe/library-probe.qdoc0000644000175100017510000000432615154533055023063 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype LibraryProbe
    \inqmlmodule QbsProbes
    \ingroup list-of-items
    \keyword QML.IncludeProbe
    \inherits PathProbe

    \brief Locates library files outside the project.

    On Windows, searches for library files within directories specified by the \c PATH environment
    variable.

    On Unix, searches for library files within directories specified by the \c LIBRARY_PATH
    environment variable, as well as in \c "/usr/lib" and \c "/usr/local/lib".

    On Linux, also searches in platform-specific directories, such as \c "/usr/lib64" and
    \c "/usr/lib/x86_64-linux-gnu".

    For example, LibraryProbe can be used to search for a \c zlib library as follows:

    \code
    import qbs.Probes

    CppApplication {
        Probes.LibraryProbe {
            id: zlibProbe
            names: "z"
        }
        cpp.libraryPaths: zlibProbe.found ? [zlibProbe.path] : []
        cpp.dynamicLibraries: zlibProbe.found ? [zlibProbe.names] : []
        files: 'main.cpp'
    }
    \endcode
*/
qbs-src-3.2.0/doc/reference/items/probe/conanfile-probe.qdoc0000644000175100017510000002234415154533055023355 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2020 Richard Weickelt
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype ConanfileProbe
    \inqmlmodule QbsProbes
    \ingroup list-of-items
    \keyword QML.ConanfileProbe

    \brief Extracts information about dependencies from a Conan recipe file.

    The \c ConanfileProbe interfaces \QBS to the \l{https://conan.io/}{Conan
    package manager}. It runs
    \l{https://docs.conan.io/en/latest/reference/commands/consumer/install.html}{conan
    install} on a Conan recipe file such as \c conanfile.py or \c conanfile.txt
    and extracts all available meta information about package dependencies using
    the \l{https://docs.conan.io/en/latest/reference/generators/json.html}{json
    generator}. The output may be used to set up \l{Profile} items or module
    properties in products. \c ConanfileProbe can also be used to run other
    Conan generators and to retrieve their output.

    \section1 Examples

    In the following examples we assume that our project contains a \c conanfile.py.
    This file describes all dependencies of our project. The dependency packages are
    expected to export meta information to be consumed by our project.

    \section2 Using ConanfileProbe with Conan Module Provider

    Conan 2.6 has a built-in
    \l{https://docs.conan.io/2/reference/tools/qbs/qbsdeps.html#qbsdeps}{QbsDeps} generator
    that creates JSON files suitable for consumption by the \l{conan}{conan} module provider.
    Use it to access dependencies.

    \qml
    import qbs.Probes

    Project {
        property string conanInstallPath: conanProbe.generatedFilesPath
        Probes.ConanfileProbe {
            id: conanProbe
            conanfilePath: project.sourceDirectory + "/conanfile.py"
            generators: "QbsDeps"
        }

        // somewhere in the project, maybe in a base item
        CppApplication {
            type: "application"
            files: "main.cpp"
            qbsModuleProviders: "conan"
            moduleProviders.conan.installDirectory: project.conanInstallPath
            Depends { name: "mylib" }
        }
    }
    \endqml

    \section2 Including Files Generated by Conan

    \note This example does not apply to Conan 2.0, or newer.

    Conan 1 has a built-in
    \l{https://docs.conan.io/en/latest/reference/generators/qbs.html}{qbs
    generator} that creates a project file containing dummy products. This is
    the easiest way to access dependencies, but also the least flexible one. It
    requires each Conan package to export correct meta information and works only
    if the dependency is a library.

    \qml
    import qbs.Probes

    Project {
        Probes.ConanfileProbe {
            id: conan
            conanfilePath: project.sourceDirectory + "/conanfile.py"
            generators: "qbs"
        }

        references: conan.generatedFilesPath + "/conanbuildinfo.qbs"

        CppApplication {
            type: "application"
            files: "main.cpp"
            Depends { name: "mylib" }
        }
    }
    \endqml

    \section2 Setting Module Properties in Products

    \note This example does not apply to Conan 2.0, or newer.

    When a product depends on a Conan package that does not have a
    dedicated \l{List of Modules}{module}, package meta information may be
    directly fed into the \l{cpp} module.

    This approach is very flexible.

    \qml
    import qbs.Probes

    CppApplication {
        Probes.ConanfileProbe {
            id: conan
            conanfilePath: product.sourceDirectory + "/conanfile.py"
            options: ({opt1: "True"; opt2: "TheValue"})
        }
        cpp.includePaths: conan.dependencies["myLib"].include_paths
        cpp.libraryPaths: conan.dependencies["myLib"].lib_paths
        cpp.dynamicLibraries: conan.dependencies["mylib"].libs
    }
    \endqml

    \section2 Setting Up a Profile

    \note This example does not apply to Conan 2.0, or newer.

    When multiple products depend on one or more Conan packages, the dependency
    information may be combined in a \l{Profile}. This is especially useful when
    \QBS modules are available for some of the packages, but some of their
    properties need to be initialized. Otherwise, it would have to be done
    manually in global profiles.

    \qml
    import qbs.Probes

    Project {
        Probes.ConanfileProbe {
            id: conan
            conanfilePath: project.sourceDirectory + "/conanfile.py"
        }
        Profile {
            name: "arm-gcc"
            cpp.toolchainInstallPath: conan.dependencies["arm-none-eabi-gcc"].rootpath + "/bin"
            cpp.toolchainPrefix: "arm-linux-gnueabi-"
            qbs.toolchainType: "gcc"
        }
    }
    \endqml

    This allows fully automated dependency management, including compiler
    toolchains and is very useful when teams work in heterougeneous
    environments.

*/

/*!
    \qmlproperty stringList ConanfileProbe::additionalArguments

    Additional command line arguments that are appended to the \c{conan install}
    command.

    \defaultvalue []
*/

/*!
    \qmlproperty path ConanfileProbe::conanfilePath

    Path to a \c conanfile.py or \c conanfile.txt that is used by this probe.

    This property cannot be set at the same time as \l{ConanfileProbe::}{packageReference}.

    \nodefaultvalue
*/

/*!
    \qmlproperty var ConanfileProbe::dependencies

    This property contains the same information as
    \l{ConanfileProbe::}{json}.dependencies, but instead of an array, \c
    dependencies is a map with package names as keys for convenient access.

    \note This property does not apply to Conan 2.0, or newer.

    \readonly
    \nodefaultvalue
*/

/*!
    \qmlproperty path ConanfileProbe::executable

    The name of or the path to the Conan executable.

    \defaultvalue "conan.exe" on Windows, "conan" otherwise
*/

/*!
    \qmlproperty path ConanfileProbe::generatedFilesPath

    The path of the folder where Conan generators store their files. Each
    instance of this probe creates a unique folder under
    \l{Project::buildDirectory}{Project.buildDirectory}. The folder name is a
    hash of the arguments supplied to \c{conan install}.

    \readonly
    \nodefaultvalue
*/

/*!
    \qmlproperty stringList ConanfileProbe::generators

    Conan generators to be executed by this probe.

    When using Conan 2.x,
    \l{https://docs.conan.io/2/reference/tools/qbs/qbsdeps.html#qbsdeps}{QbsDeps} generator is
    added by default.

    When using Conan 1.x, the
    \l{https://docs.conan.io/en/latest/reference/generators/json.html}{JSON
    generator} is always enabled.

    All generated files are written to the
    \l{ConanfileProbe::generatedFilesPath}{generatedFilesPath} folder.

    \sa {https://docs.conan.io/en/latest/reference/generators.html}{Available
    generators}

    \defaultvalue \c auto-detected
*/

/*!
    \qmlproperty var ConanfileProbe::json

    The parsed output of Conan's
    \l{https://docs.conan.io/en/latest/reference/generators/json.html}{JSON
    generator} as a JavaScript object.

    \note This property does not apply to Conan 2.0, or newer.

    \readonly
    \nodefaultvalue
*/

/*!
    \qmlproperty var ConanfileProbe::options

    Options applied to \c{conan install} via the \c{-o} flag.
    This property is an object in the form \c{key:value}.

    Example:
    \qml
    options: ({someOpt: "True", someOtherOpt: "TheValue"})
    \endqml

    \nodefaultvalue
*/

/*!
    \qmlproperty string ConanfileProbe::packageReference

    Reference of a Conan package in the form \c{name/version@user/channel}.
    Use this property if you want to probe an existing package in the local
    cache or on a remote.

    This property cannot be set at the same time as \l{ConanfileProbe::}{conanfilePath}.

    \nodefaultvalue
*/

/*!
    \qmlproperty var ConanfileProbe::settings

    Settings applied to \c{conan install} via the \c{-s} flag.
    This property is an object in the form \c{key:value}.

    Example:
    \qml
    settings: ({os: "Linux", compiler: "gcc"})
    \endqml

    \nodefaultvalue
*/

/*!
    \qmlproperty var ConanfileProbe::verbose

    Set to \c{true} to print all output of `conan install`.
    If this property is \c{false} only error output will be printed.

    \defaultvalue \c{false}
*/
qbs-src-3.2.0/doc/reference/items/probe/watcom-probe.qdoc0000644000175100017510000000622415154533055022710 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2022 Denis Shienkov 
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype WatcomProbe
    \inqmlmodule QbsProbes
    \ingroup list-of-items
    \keyword QML.WatcomProbe
    \inherits PathProbe
    \brief Collects Oopen Watcom toolchain compiler information.
    \since Qbs 1.22
    \internal

    Detects the version, supported architecture, the platform
    endianness, and other stuff for the specified compiler executable
    from the \l{https://github.com/open-watcom}{Open Watcom} toolchain.
*/

/*!
    \qmlproperty string WatcomProbe::compilerFilePath

    An input property which is a full path to the Digital Mars compiler
    executable.

    \nodefaultvalue
*/

/*!
    \qmlproperty string WatcomProbe::architecture

    Detected architecture of the target platform's processor.

    The possible values are \c "x86" and \c "x86_16".

    \nodefaultvalue
*/

/*!
    \qmlproperty string WatcomProbe::endianness

    Detected endianness of the target platform's processor architecture.

    The possible values are \c "big" and \c "little".

    \nodefaultvalue
*/

/*!
    \qmlproperty string WatcomProbe::targetPlatform

    Detected target platform.

    The possible values are \c "windows", \c "linux", \c "os2" and \c "dos".

    \nodefaultvalue
*/

/*!
    \qmlproperty int WatcomProbe::versionMajor

    Detected major compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty int WatcomProbe::versionMinor

    Detected minor compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty int WatcomProbe::versionPatch

    Detected patch compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList WatcomProbe::includePaths

    Detected compiler include paths.

    \nodefaultvalue
*/

/*!
    \qmlproperty var WatcomProbe::compilerDefinesByLanguage

    Detected set of compiler pre-defined macros depending
    on the \c "C" or \c "C++" language.

    \nodefaultvalue
*/

/*!
    \qmlproperty var WatcomProbe::environment

    Detected compiler run environment.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/items/probe/pkgconfig-probe.qdoc0000644000175100017510000001566215154533055023373 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype PkgConfigProbe
    \inqmlmodule QbsProbes
    \ingroup list-of-items
    \keyword QML.PkgConfigProbe

    \brief Retrieves the information about installed packages using the pkg-config binary.

    This probe takes the package name or the list of package names as input and returns the
    information that is required to compile and link using those packages.

    Usually, you can simply use a Depends item as described in
    \l{How do I build against libraries that provide pkg-config files?}.

    Alternatively, the probe can be used directly as follows:

    \code
    CppApplication {
        name: project.name
        Probes.PkgConfigProbe {
            id: pkgConfig
            name: "QtCore"
            minVersion: '4.0.0'
            maxVersion: '5.99.99'
        }
        files: 'main.cpp'
        cpp.defines : pkgConfig.defines
        cpp.includePaths: pkgConfig.includePaths
        cpp.dynamicLibraries: pkgConfig.libraries
        cpp.libraryPaths: pkgConfig.libraryPaths
        cpp.commonCompilerFlags: pkgConfig.compilerFlags
        cpp.linkerFlags: pkgConfig.linkerFlags
    }
    \endcode
*/

/*!
    \qmlproperty string PkgConfigProbe::sysroot

    This property sets the value of the \c PKG_CONFIG_SYSROOT_DIR environment variable passed to
    the \c pkg-config binary. This variable modifies -I and -L flags to use the directories located
    in target sysroot.

    This property is useful when cross-compiling packages that use \c pkg-config to determine CFLAGS
    and LDFLAGS. For example, if \c sysroot is set to \c /var/target, a \c -I/usr/include/libfoo
    will become \c -I/var/target/usr/include/libfoo.

    \defaultvalue \c qbs.sysroot
*/

/*!
    \qmlproperty string PkgConfigProbe::executable

    The name of or the path to the pkg-config executable.

    \defaultvalue "pkg-config"
*/

/*!
    \qmlproperty string PkgConfigProbe::name

    The name this probe. This property is used as
    \l{PkgConfigProbe::packageNames}{PkgConfigProbe.packageNames} value by default.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PkgConfigProbe::packageNames

    The list of package names to pass to the pkg-config executable. For each package, pkg-config
    will return the information required to compile and link to this package.

    \defaultvalue [\l{PkgConfigProbe::name}{PkgConfigProbe.name}]
*/

/*!
    \qmlproperty string PkgConfigProbe::minVersion

    The minimum version of the required package. If set, pkg-config will ignore packages with
    version less than the value of this property.

    \nodefaultvalue
*/

/*!
    \qmlproperty string PkgConfigProbe::exactVersion

    The exact version of the required package. If set, pkg-config will ignore packages with
    version that is not equal to the value of this property.

    \nodefaultvalue
*/

/*!
    \qmlproperty string PkgConfigProbe::maxVersion

    The maximum version of the required package. If set, pkg-config will ignore packages with
    version greater than the value of this property.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool PkgConfigProbe::forStaticBuild

    If \c true, pkg-config will return linker flags for a static linking instead of dynamic.

    \defaultvalue \c false
*/

/*!
    \qmlproperty stringList PkgConfigProbe::libDirs

    List of full, non-sysrooted paths where pkg-config should search for .pc files. This overrides
    the built-in path (which is usually /usr/lib/pkgconfig).

    This property sets the value of the \c PKG_CONFIG_LIBDIR environment variable passed to
    the \c pkg-config binary.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PkgConfigProbe::cflags

    \internal

    This property contains the unparsed output from "pkg-config --cflags" call. Usually, you should
    use \l{PkgConfigProbe::defines}{PkgConfigProbe.defines},
    \l{PkgConfigProbe::includePaths}{PkgConfigProbe.includePaths} and
    \l{PkgConfigProbe::compilerFlags}{PkgConfigProbe.compilerFlags} properties instead.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PkgConfigProbe::libs

    \internal

    This property contains the unparsed output from "pkg-config --libs" call. Usually, you should
    use \l{PkgConfigProbe::libraries}{PkgConfigProbe.libraries},
    \l{PkgConfigProbe::libraryPaths}{PkgConfigProbe.libraryPaths} and
    \l{PkgConfigProbe::linkerFlags}{PkgConfigProbe.linkerFlags} properties instead.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PkgConfigProbe::defines

    This output property contains the list of defines that should be passed to a compiler when
    using requested package.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PkgConfigProbe::libraries

    This output property contains the list of library names that should be passed to a linker when
    using requested package.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PkgConfigProbe::libraryPaths

    This output property contains the list of library paths that should be passed to a linker when
    using requested package.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PkgConfigProbe::includePaths

    This output property contains the list of include paths that should be passed to a compiler when
    using requested package.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PkgConfigProbe::compilerFlags

    This output property contains the list of flags that should be passed to a compiler when
    using requested package.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PkgConfigProbe::linkerFlags

    This output property contains the list of flags that should be passed to a linker when
    using requested package.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList PkgConfigProbe::modversion

    This output property contains the version of the found package.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/items/probe/binary-probe.qdoc0000644000175100017510000000607315154533055022704 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype BinaryProbe
    \inqmlmodule QbsProbes
    \ingroup list-of-items
    \keyword QML.BinaryProbe
    \inherits PathProbe

    \brief Locates executable files outside the project.

    Finds executable files that have the specified file names.

    BinaryProbe searches for executable files within directories specified by the PATH environment
    variable.

    \note On Unix, also searches in the \c /usr/bin and \c /usr/local/bin directories by default.
    Override \l {PathProbe::platformSearchPaths}{PathProbe.platformSearchPaths} to change this
    behavior.

    \note On Windows, only files that have \e .com, \e .exe, \e .bat, \e .cmd extensions are
    considered \e executables. Override \l {PathProbe::nameSuffixes}{PathProbe.nameSuffixes} to
    change this behavior.

    For example, BinaryProbe can be used to search for a protobuf compiler executable as follows:

    \code
    // Assuming module is called "myproto"
    import qbs.File
    import qbs.Probes

    Module {
        // search for a protoc executable
        Probes.BinaryProbe {
            id: protocProbe
            names: "protoc"
        }
        property string executableFilePath: protocProbe.filePath

        validate: {
            if (!File.exists(executableFilePath))
                throw "The executable '" + executableFilePath + "' does not exist.";
        }

        // use the found executable
        Rule {
            // rule input/outputs here...

            // run executable for the module called "myproto":
            prepare: {
                var args = // initialize arguments...
                var cmd = new Command(input.myproto.executableFilePath, args);
                cmd.highlight = "codegen";
                cmd.description = "generating protobuf files for " + input.fileName;
                return [cmd];
            }
        }
    }
    \endcode
*/
qbs-src-3.2.0/doc/reference/items/probe/iar-probe.qdoc0000644000175100017510000000527115154533055022172 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2019 Denis Shienkov 
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \qmltype IarProbe
    \inqmlmodule QbsProbes
    \ingroup list-of-items
    \keyword QML.IarProbe
    \inherits PathProbe
    \brief Collects IAR toolchain compiler information.
    \since Qbs 1.13
    \internal

    Detects the version, supported architecture and the platform
    endianness of the specified compiler executable file from the
    \l{https://www.iar.com/}{IAR} toolchain.
*/

/*!
    \qmlproperty string IarProbe::compilerFilePath

    An input property which is a full path to the IAR compiler executable file.

    \nodefaultvalue
*/

/*!
    \qmlproperty string IarProbe::architecture

    Detected architecture of the target platform's processor.

    The possible values are \c "arm", \c "mcs51", \c "avr", \c "avr32",
    \c "stm8", \c "riscv", \c "rl78", \c "rx", \c "rh850", \c "v850",
    \c "78k", \c "sh", \c "r32c", \c "m32c", \c "m16c", \c "msp430",
    \c "hcs12", \c "hcs8", \c "m68k", and \c "cr16".

    \nodefaultvalue
*/

/*!
    \qmlproperty string IarProbe::endianness

    Detected endianness of the target platform's processor architecture.

    The possible values are \c "big" or \c "little".

    \nodefaultvalue
*/

/*!
    \qmlproperty int IarProbe::versionMajor

    Detected major compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty int IarProbe::versionMinor

    Detected minor compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty int IarProbe::versionPatch

    Detected patch compiler version.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/items/convenience/0000755000175100017510000000000015154533055020622 5ustar  runnerrunnerqbs-src-3.2.0/doc/reference/items/convenience/qtapplication.qdoc0000644000175100017510000000335515154533055024350 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage ObjectLibrary
    \nextpage QtGuiApplication
    \qmltype QtApplication
    \inherits CppApplication
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.QtApplication

    \brief Application with a dependency on the Qt Core module.

    A QtApplication is a \l{CppApplication}{C++ application} that has a
    \l{Depends}{dependency} on the \l{Qt.core} module. It is entirely
    equivalent to the following:

    \code
    CppApplication {
        Depends { name: "Qt.core" }
    }
    \endcode

*/
qbs-src-3.2.0/doc/reference/items/convenience/library.qdoc0000644000175100017510000001041715154533055023141 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \previouspage JavaJarFile
    \nextpage LoadableModule
    \qmltype Library
    \since Qbs 1.4
    \inherits Product
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.NativeBinary

    \brief Generic library.

    A Library item is a base item for native libraries and can have \l{Product::}{type} set to
    one of the following values: \c "dynamiclibrary", \c "staticlibrary", \c "objectlibrary",
    \c "loadablemodule".

    The default \l{Product::}{type} value is \c "dynamiclibrary" except for iOS prior to
    version 8, in which case the default value is \c "staticlibrary".

    This item can automatically install the library target (and library symlinks on Unix) and
    separated debug information.

    For Android targets, the following applies:
    \list
        \li The \l{Product::type}{Product.type} property value contains
            \c "android.nativelibrary" in addition to \c "dynamiclibrary".
        \li There is a dependency on the \l{cpp} and \l{Android.ndk} modules.
    \endlist
*/

/*!
    \qmlproperty bool Library::install

    If \c{true}, the library will be installed to \l{Library::installDir}{installDir}.

    \defaultvalue \c false
    \since Qbs 1.13
*/

/*!
    \qmlproperty string Library::installDir

    Where to install the library, if \l{Library::install}{install} is enabled. On Unix,
    the symbolic links are also installed to this location.

    The value is appended to \l{qbs::installPrefix}{qbs.installPrefix}
    when constructing the actual installation directory.

    \defaultvalue \c Library/Frameworks if the library is a \l{bundle::isBundle}{bundle},
                  otherwise \c bin for Windows and \c lib for Unix-like targets.
    \since Qbs 1.13
*/

/*!
    \qmlproperty bool Library::installDebugInformation

    If \c{true}, the debug information will be installed to
    \l{Library::debugInformationInstallDir}{debugInformationInstallDir}.

    \defaultvalue \c false
    \since Qbs 1.16
    \sa{How do I separate and install debugging symbols?}
*/

/*!
    \qmlproperty string Library::debugInformationInstallDir

    Where to install the debug information if \l installDebugInformation is enabled.

    The value is appended to \l{qbs::installPrefix}{qbs.installPrefix}
    when constructing the actual installation directory.

    \defaultvalue \l installDir.
    \since Qbs 1.16

    \sa{How do I separate and install debugging symbols?}
*/

/*!
    \qmlproperty bool Library::installImportLib

    If \c{true}, the import library will be installed to \l importLibInstallDir.
    This property is only relevant for Windows targets.
    Enable it if you want to create a development package.

    \defaultvalue \c false
    \since Qbs 1.13
*/

/*!
    \qmlproperty string Library::importLibInstallDir

    Where to install the import library, if \l installImportLib is enabled.

    The value is appended to \l{qbs::installPrefix}{qbs.installPrefix}
    when constructing the actual installation directory.

    This property is only relevant for Windows targets.

    \defaultvalue \c lib
    \since Qbs 1.13
*/

qbs-src-3.2.0/doc/reference/items/convenience/innosetup.qdoc0000644000175100017510000000312715154533055023521 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage DynamicLibrary
    \nextpage InstallPackage
    \qmltype InnoSetup
    \inherits Product
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.InnoSetup

    \brief Inno Setup installer executable.

    A InnoSetup item is a \l{Product}{product} of the \l{Product::}{type}
    \c{"innosetup.exe"} that has a dependency on the \l{innosetup} module.
*/
qbs-src-3.2.0/doc/reference/items/convenience/applicationextension.qdoc0000644000175100017510000000331415154533055025733 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2015 Jake Petroules.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Application
    \nextpage AutotestRunner
    \qmltype ApplicationExtension
    \inherits XPCService
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.ApplicationExtension

    \brief Application Extension for iOS, macOS, tvOS, or watchOS.

    An ApplicationExtension item is a \l{Product} based on the \l{XPCService}
    item that sets some properties required for iOS, macOS, tvOS, or watchOS
    Application Extensions.
*/
qbs-src-3.2.0/doc/reference/items/convenience/loadablemodule.qdoc0000644000175100017510000000352415154533055024447 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2015 Jake Petroules.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Library
    \nextpage ObjectLibrary
    \qmltype LoadableModule
    \inherits DynamicLibrary
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.LoadableModule

    \brief Loadable module.

    A LoadableModule item is a \l{Product}{product} of the \l{Product::}{type}
    \c{"loadablemodule"}. It exists for the convenience of project file authors.

    Unlike the \l{Plugin} item, the LoadableModule item cannot be build as static library and is
    installed into the same directory as \l{DynamicLibrary} items. Prefer using \l{Plugin} item in
    new code.
*/
qbs-src-3.2.0/doc/reference/items/convenience/cpplibrary.qdoc0000644000175100017510000000637215154533055023651 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com).
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage CppApplication
    \nextpage CppStd
    \qmltype CppLibrary
    \inherits Library
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.CppLibrary

    \brief C++ library.

    A CppLibrary is an \l{Library}{Library} that has a dependency on the
    \l{cpp} module.

    It also provides additional properties to ease the installation of public and private headers.

    \since Qbs 3.2
*/

/*!
    \qmlproperty string CppLibrary::headersDirectoryName

    The name of the directory where headers are installed.

    \defaultvalue \l{product::targetName}{Product.targetName}
    \since Qbs 3.2
*/

/*!
    \qmlproperty stringList CppLibrary::publicHeaders

    The list of the public headers.

    Files are autoatically tagged with the \c "hpp" tag and are installed to
    \l{publicHeadersDirectory} if library installation is requested.

    On Apple platforms, if \l{bundle::isBundle}{isBundle} is \c true, files are also tagged as
    \c "bundle.input.public_hpp" and are copied into the \c Headers directory within the bundle.

    \defaultvalue \c []
    \since Qbs 3.2
*/

/*!
    \qmlproperty string CppLibrary::publicHeadersDirectory

    The directory where to install public headers.

    \defaultvalue \l{installpaths.headers} + \c{"/"} + \l{headersDirectoryName}
    \since Qbs 3.2
*/

/*!
    \qmlproperty stringList CppLibrary::privateHeaders

    The list of the private headers.

    Files are autoatically tagged with the \c "hpp" tag and are installed to
    \l{privateHeadersDirectory} if library installation is requested.

    On Apple platforms, if \l{bundle::isBundle}{isBundle} is \c true, files are also tagged as
    \c "bundle.input.public_hpp" and are copied into the \c PrivateHeaders directory within the
    bundle.

    \defaultvalue \c []
    \since Qbs 3.2
*/

/*!
    \qmlproperty string CppLibrary::privateHeadersDirectory

    The directory where to install private headers.

    \defaultvalue \l{installpaths.headers} + \c{"/"} + \l{headersDirectoryName} + \c{"/private"}
    \since Qbs 3.2
*/
qbs-src-3.2.0/doc/reference/items/convenience/objectlibrary.qdoc0000644000175100017510000000347715154533055024340 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2025 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage LoadableModule
    \nextpage Plugin
    \qmltype ObjectLibrary
    \inherits CppLibrary
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.ObjectLibrary

    \brief A collection of object files.

    An ObjectLibrary item is a \l{CppLibrary}{library} of the \l{Product::}{type}
    \c "objectlibrary".
    It behaves exactly like a \l StaticLibrary, except that the object files are
    not packaged into a container. It is suitable if the library does not need to
    be installed and distributed, for instance when it is used as an internal
    abstraction inside a project.
*/
qbs-src-3.2.0/doc/reference/items/convenience/autotestrunner.qdoc0000644000175100017510000001340615154533055024600 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2019 Jochen Ulrich 
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage ApplicationExtension
    \nextpage ConfigInstall
    \qmltype AutotestRunner
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.AutotestRunner

    \brief Product that runs all autotests in the project.

    An AutotestRunner has a dependency on all \l{Product}{products} with the
    \l{Product::}{type} \c "autotest". Building the AutotestRunner product
    will then run the respective executables. The \l{Product::}{builtByDefault}
    property is set to \c false by default, so running the autotests
    has to be explicitly requested. The default name of the product is
    \c "autotest-runner".

    To use this feature:

    \list 1
        \li Attach the \c "autotest" type to your autotests:
            \code
            CppApplication {
                name: "tst_mytest"
                type: ["application", "autotest"]
                // ...
            }
            \endcode
        \li Instantiate exactly one AutotestRunner in your project, typically at
            the top level:
            \code
            Project {
                // ...
                AutotestRunner { }
                // ...
            }
            \endcode
        \li Trigger the autotest execution by building the product:
            \code
            qbs build -p autotest-runner
            \endcode
    \endlist


    \section2 Setting Properties for individual Tests
    \target autotestrunner-autotest-module

    To control the behavior of individual tests, some properties of the \c AutotestRunner
    can be overridden by depending on the \l autotest module and setting its properties:

    \code
    CppApplication {
        name: "tst_mytest"
        type: ["application", "autotest"]

        Depends { name: "autotest" }

        autotest.timeout: 60

        // ...
    }
    \endcode


    \section2 Relevant Job Pools
    \target autotestrunner-job-pools

    \table
    \header
        \li Pool
        \li Since
        \li Description
    \row
        \li \c{"autotest-runner"}
        \li 1.15
        \li The job pool used to run the tests.
    \endtable

*/

/*!
    \qmlproperty stringList AutotestRunner::arguments

    The list of arguments to invoke the autotest with.
    A test can override this by setting the \l{autotest::arguments}{arguments} property
    of the \l autotest module.

    \defaultvalue \c []
*/

/*!
    \qmlproperty stringList AutotestRunner::auxiliaryInputs

    This property can contain arbitrary file tags. The AutotestRunner will get dependencies
    on all products whose type matches at least one of these tags, and invocation of the
    test executables will happen only after all of the respective artifacts have been built.
    Set this property if your test executables have run-time dependencies on other products.

    \nodefaultvalue
    \since Qbs 1.12
*/

/*!
    \qmlproperty stringList AutotestRunner::environment

    A list of environment variables that are added to the run environment.
    They are provided as a list of strings in the form \c "varName=value".

    \defaultvalue DYLD_LIBRARY_PATH, DYLD_FRAMEWORK_PATH, and DYLD_ROOT_PATH
    are set on macOS, or an empty list for other platforms.
*/

/*!
    \qmlproperty bool AutotestRunner::limitToSubProject

    By default, only those autotests are considered that are in the same sub-project that
    AutotestRunner was instantiated in. If you want to run all autotests regardless
    of their location in the project hierarchy, set this property to \c false.

    \defaultvalue \c true
*/

/*!
    \qmlproperty string AutotestRunner::workingDir

    If this property is set, it will be the working directory for all invoked test executables.
    Otherwise, the working directory will the the parent directory of the respective executable.
    A test can override this by setting the \l{autotest::workingDir}{workingDir} property
    of the \l autotest module.

    \nodefaultvalue
    \since Qbs 1.12
*/

/*!
    \qmlproperty stringList AutotestRunner::wrapper

    Wrapper binary and its arguments for wrapping autotest calls.
    This is useful for tools like Valgrind and alike.

    \defaultvalue empty
*/

/*!
    \qmlproperty int AutotestRunner::timeout

    Time limit for the execution of the individual tests. If a test does not finish within
    the time limit, the test is cancelled and considered failed. A value below or equal to 0
    means no timeout.
    A test can override this by setting the \l{autotest::timeout}{timeout} property
    of the \l autotest module.

    \defaultvalue -1
    \since Qbs 1.15
*/
qbs-src-3.2.0/doc/reference/items/convenience/installpackage.qdoc0000644000175100017510000000551015154533055024455 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage InnoSetup
    \nextpage JavaClassCollection
    \qmltype InstallPackage
    \inherits Product
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.InstallPackage

    \brief Archive of an installed project.

    An InstallPackage item is a \l{Product}{product} of the \l{Product::}{type}
    \c{archiver.archive} that has a \l{Depends}{dependency} on the \l{archiver}
    module. It is used to produce an archive from a set of installable files.

    Consider the following example project:

    \code
    Project {
        CppApplication {
            name: "myapp"
            Depends { name: "mylib" }
            files: ["main.cpp"]
            Group {
                fileTagsFilter: product.type
                qbs.install: true
                qbs.installDir: "bin"
            }
        }
        DynamicLibrary {
            name: "mylib"
            files: ["mylib.cpp"]
            Group {
                name: "public headers"
                files: ["mylib.h"]
                qbs.install: true
                qbs.installDir: "include"
            }
            Group {
                fileTagsFilter: product.type
                qbs.install: true
                qbs.installDir: "lib"
            }
        }

        InstallPackage {
            archiver.type: "tar"
            name: "tar-package"
            Depends { name: "myapp" }
            Depends { name: "mylib" }
        }
    }
    \endcode

    Building the product \c "tar-package" on a Unix system will result in a tar
    file with these contents:

    \code
    include/mylib.h
    lib/libmylib.so
    bin/myapp
    \endcode
*/
qbs-src-3.2.0/doc/reference/items/convenience/configbuild.qdoc0000644000175100017510000000450415154533055023762 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com).
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \previouspage AutotestRunner
    \nextpage ConfigInstall
    \qmltype ConfigBuild
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \since Qbs 3.1

    \brief This is the base item for the \l{config.build} module.

    This items contains properties that configure built-in
    items such as \l{Application}, \l{Library}, and \l{Plugin}.
*/
/*!
    \qmlproperty string ConfigBuild::libraryType
    Controls the default library kind produced by \l{Library} items.

    Allowed values are \c{"dynamic"} and \c{"static"}.

    \defaultvalue \c{"dynamic"}.

    On Apple iOS targets prior to iOS 8, dynamic libraries are not supported;
    in that case a static library will be produced regardless of this setting.
*/

/*!
    \qmlproperty string ConfigBuild::pluginType
    Controls the default library kind produced by \l{Plugin} and l{LoadableModule} items.

    Allowed values are \c{"dynamic"} and \c{"static"}.

    \defaultvalue \l{libraryType}.

    On Apple iOS targets prior to iOS 8, dynamic libraries are not supported;
    in that case a static plugin will be produced regardless of this setting.
*/
qbs-src-3.2.0/doc/reference/items/convenience/configinstall.qdoc0000644000175100017510000001140315154533055024325 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com).
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \previouspage ConfigBuild
    \nextpage CppApplication
    \qmltype ConfigInstall
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \since Qbs 3.1

    \brief This is the base item for the \l{config.install} module.

    This items contains properties that configure built-in
    items such as \l{Application}, \l{Library}, and \l{Plugin}.
*/

/*!
    \qmlproperty string ConfigInstall::applicationsDirectory
    The directory where application bundles should be installed on Apple platforms.
    \defaultvalue \l{installpaths::applications}{installpaths.applications}
*/

/*!
    \qmlproperty string ConfigInstall::binariesDirectory
    The directory where binaries should be installed.
    \defaultvalue \l{installpaths::bin}{installpaths.bin}
*/

/*!
    \qmlproperty string ConfigInstall::debugInformationDirectory
    The directory where debug information should be installed.

    If not set, the value is auto-detected based on item type installing debug info into the
    same folder as the main artifact.

    \nodefaultvalue
*/

/*!
    \qmlproperty string ConfigInstall::dynamicLibrariesDirectory
    The directory where dynamic libraries should be installed.
    \defaultvalue \l{installpaths::bin}{installpaths.bin} on Windows,
    \l{installpaths::lib}{installpaths.lib} otherwise
*/

/*!
    \qmlproperty string ConfigInstall::frameworksDirectory
    The directory where frameworks should be installed.
    \defaultvalue \l{installpaths::library}{installpaths.library} + \c{"/"}
        + \l{installpaths::frameworks}{installpaths.frameworks}
*/

/*!
    \qmlproperty string ConfigInstall::importLibrariesDirectory
    The directory where import libraries should be installed.
    \defaultvalue \l{installpaths::lib}{installpaths.lib}
*/

/*!
    \qmlproperty bool ConfigInstall::install
    Controls whether products should be installed by default.
    \defaultvalue \c true
*/

/*!
    \qmlproperty bool ConfigInstall::debugInformation
    Controls whether debug information should be installed.
    \defaultvalue \l{install}
*/

/*!
    \qmlproperty bool ConfigInstall::dynamicLibraries
    Controls whether dynamic libraries should be installed.
    \defaultvalue \l{install}
*/

/*!
    \qmlproperty bool ConfigInstall::frameworks
    Controls whether frameworks should be installed.
    \defaultvalue \l{install}
*/

/*!
    \qmlproperty bool ConfigInstall::importLibraries
    Controls whether import libraries should be installed (relevant for Windows dynamic libraries).
    \defaultvalue \c false
*/

/*!
    \qmlproperty bool ConfigInstall::loadableModules
    Controls whether loadable modules should be installed.
    \defaultvalue \l{install}
*/

/*!
    \qmlproperty bool ConfigInstall::plugins
    Controls whether plugins should be installed.
    \defaultvalue \l{install}
*/

/*!
    \qmlproperty bool ConfigInstall::staticLibraries
    Controls whether static libraries should be installed.
    \defaultvalue \c false
*/

/*!
    \qmlproperty string ConfigInstall::loadableModulesDirectory
    The directory where loadable modules should be installed.
    \defaultvalue \l{installpaths::library}{installpaths.library} + \c{"/"}
        + \l{installpaths::frameworks}{installpaths.frameworks}
*/

/*!
    \qmlproperty string ConfigInstall::pluginsDirectory
    The directory where plugins should be installed.
    \defaultvalue \l{installpaths::plugins}{installpaths.plugins}
*/

/*!
    \qmlproperty string ConfigInstall::staticLibrariesDirectory
    The directory where static libraries should be installed.
    \defaultvalue \l{installpaths::lib}{installpaths.lib}
*/
qbs-src-3.2.0/doc/reference/items/convenience/qtlupdaterunner.qdoc0000644000175100017510000000627015154533055024734 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2024 The Qt Company Ltd.
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage QtGuiApplication
    \nextpage StaticLibrary
    \qmltype QtLupdateRunner
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.QtLupdateRunner
    \since 2.6

    \brief A product that updates all Qt translation files in the project.

    A QtLupdateRunner has a dependency on all \l{Product}{products} that have
    a Qt dependency.

    Building the QtLupdateRunner product will run the
    \l{https://doc.qt.io/qt-6/linguist-lupdate.html}{lupdate} tool on eligible
    source files from these products in order to update the project's translation
    files with regard to the translatable strings in these sources.

    The \l{Product::}{builtByDefault} property is set to \c false by default,
    so updating the translation files has to be explicitly requested.

    The default name of the product is \c "lupdate-runner".

    To use this feature:

    \list 1
        \li Instantiate a \c QtLupdateRunner in your project, typically at
            the top level:
            \code
            Project {
                // ...
                QtLupdateRunner { }
                // ...
            }
            \endcode
        \li Trigger the translation files update by building the product:
            \code
            qbs build -p lupdate-runner
            \endcode
    \endlist

    \section2 Relevant File Tags

    \table
    \header
        \li Tag
        \li Since
        \li Description
    \row
        \li \c{"qt.untranslatable"}
        \li 2.6
        \li Attach this tag to source files that lupdate should not consider.
    \endtable
*/

/*!
    \qmlproperty bool QtLupdateRunner::limitToSubProject

    By default, only the source files of products that live in the same sub-project that
    QtLupdateRunner was instantiated in are looked at.
    Set this property to \c false to consider all products in the project.

    \defaultvalue \c true
*/

/*!
    \qmlproperty stringList QtLupdateRunner::extraArguments

    Additional arguments to pass to the \c lupdate tool.

    \nodefaultvalue
*/

qbs-src-3.2.0/doc/reference/items/convenience/dynamiclibrary.qdoc0000644000175100017510000000350715154533055024510 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage CppStd
    \nextpage InnoSetup
    \qmltype DynamicLibrary
    \inherits CppLibrary
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.DynamicLibrary


    \brief Dynamic library.

    A DynamicLibrary item is a \l{CppLibrary}{library} of the \l{Product::}{type}
    \c "dynamiclibrary".

    For Android targets, the following applies:
    \list
        \li The \l{Product::type}{Product.type} property value contains
            \c "android.nativelibrary" in addition to \c "dynamiclibrary".
        \li There is a dependency on the \l{cpp} and \l{Android.ndk} modules.
    \endlist
*/
qbs-src-3.2.0/doc/reference/items/convenience/xpcservice.qdoc0000644000175100017510000000317015154533055023646 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2015 Jake Petroules.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage StaticLibrary
    \qmltype XPCService
    \inherits Application
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.XPCService

    \brief XPC service for macOS, iOS, tvOS, or watchOS.

    An XPCService item is a convenience item based on \l Application that
    sets some properties required for macOS, iOS, tvOS, or watchOS XPC services.
*/
qbs-src-3.2.0/doc/reference/items/convenience/javajarfile.qdoc0000644000175100017510000000337115154533055023754 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage JavaClassCollection
    \nextpage Library
    \qmltype JavaJarFile
    \inherits Product
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.JavaJarFile

    \brief Collection of Java class files bundled in a jar file.

    A JavaJarFile item is a \l{Product}{product} of the \l{Product::}{type}
    \c{java.jar}. It is used to produce a jar archive from a set of Java
    sources.
*/

/*!
    \qmlproperty string JavaJarFile::entryPoint

    The entry point for an executable jar file.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/items/convenience/qtguiapplication.qdoc0000644000175100017510000000314015154533055025045 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage QtApplication
    \nextpage QtLupdateRunner
    \qmltype QtGuiApplication
    \inherits QtApplication
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.QtGuiApplication

    \brief Application with a dependency on the Qt GUI module.

    A QtGuiApplication is an application that extends the \l{QtApplication} item
    by loading the \l{Qt.gui} module.
*/
qbs-src-3.2.0/doc/reference/items/convenience/cppapplication.qdoc0000644000175100017510000000323515154533055024503 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage AutotestRunner
    \nextpage CppStd
    \qmltype CppApplication
    \inherits Application
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.CppApplication

    \brief C++ application.

    A CppApplication is an \l{Application}{application} that has a dependency on the
    \l{cpp} module. It is entirely equivalent to the following:

    \code
    Application {
        Depends { name: "cpp" }
    }
    \endcode
*/
qbs-src-3.2.0/doc/reference/items/convenience/application.qdoc0000644000175100017510000000646615154533055024011 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage AppleDiskImage
    \nextpage ApplicationExtension
    \qmltype Application
    \inherits Product
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.Application

    \brief Product of the type application.

    An Application item is a \l{Product} representing an application.

    The target artifact of this type of product is usually an executable binary
    tagged \c "application".
    However, on Android, unless you set \l{Product::}{consoleApplication} to \c true,
    the application target will be an APK or an AAB package tagged \c "android.package"
    according to the \l{Android.sdk}{packageType} property. A dependency to the \l{Android.sdk}
    module is automatically added to the product.
*/

/*!
    \qmlproperty bool Application::install

    If \c{true}, the executable that is produced when building the application will be installed
    to \l{Application::installDir}{installDir}.

    \defaultvalue \c false
    \since Qbs 1.13
*/

/*!
    \qmlproperty string Application::installDir

    Where to install the executable that is produced when building the application, if
    \l{Application::install}{install} is enabled.

    The value is appended to \l{qbs::installPrefix}{qbs.installPrefix}
    when constructing the actual installation directory.

    \defaultvalue \c Applications if the app is a \l{bundle::isBundle}{bundle}, \c bin otherwise.
    \since Qbs 1.13
*/

/*!
    \qmlproperty bool Application::installDebugInformation

    If \c{true}, the debug information will be installed to
    \l{Application::debugInformationInstallDir}{debugInformationInstallDir}.

    \defaultvalue \c false
    \since Qbs 1.16
    \sa{How do I separate and install debugging symbols?}
*/

/*!
    \qmlproperty string Application::debugInformationInstallDir

    Where to install the debug information if \l installDebugInformation is enabled.

    The value is appended to \l{qbs::installPrefix}{qbs.installPrefix}
    when constructing the actual installation directory.

    \defaultvalue \l installDir.
    \since Qbs 1.16

    \sa{How do I separate and install debugging symbols?}
*/
qbs-src-3.2.0/doc/reference/items/convenience/javaclasscollection.qdoc0000644000175100017510000000333615154533055025522 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage InstallPackage
    \nextpage JavaJarFile
    \qmltype JavaClassCollection
    \inherits Product
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.JavaClassCollection

    \brief Collection of Java class files not bundled in a jar file.

    A JavaClassCollection item is a \l{Product}{product} of the \l{Product::}
    {type} \c{"java.class"} that has a dependency on the \l{java} module.
    If the files should end up in a jar file, you should use \l{JavaJarFile}
    instead.
*/
qbs-src-3.2.0/doc/reference/items/convenience/appleapplicationdiskimage.qdoc0000644000175100017510000001017215154533055026676 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \nextpage AppleDiskImage
    \qmltype AppleApplicationDiskImage
    \since Qbs 1.9
    \inherits AppleDiskImage
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.AppleApplicationDiskImage

    \brief Apple application drag 'n' drop disk image installer.

    An AppleApplicationDiskImage item is a \l{Product}{product} of the
    \l{Product::}{type} \c{"dmg.dmg"} that has a dependency on the
    \l{dmg} module. In addition, it has rules and properties
    specific to building drag 'n' drop disk image installers with an application
    bundle and symbolic link to the \c /Applications directory.

    Any artifacts of product dependencies that are tagged \c{"installable"} will
    be copied into the disk image, provided their file paths are relative to the
    path specified by the \l{sourceBase} property (that is, are located in that
    directory). Any artifacts tagged \c{"installable"} that are not relative to
    \l{sourceBase} will be ignored.

    Here is what the project file could look like for a simple DMG installer:
    \code
        AppleApplicationDiskImage {
            Depends { name: "myapp" }
            name: "My App"
            dmg.volumeName: name
            dmg.iconSize: 128
            dmg.windowWidth: 640
            dmg.windowHeight: 280
            dmg.iconPositions: [
                {"path": "Applications", "x": 128, "y": 128},
                {"path": "My App.app", "x": 256, "y": 128}
            ]
            files: ["background.tiff", "volume-icon.icns"]
            Group {
                files: ["*.lproj/**"] // licenses
                fileTags: ["dmg.license.input"]
            }
        }
    \endcode

    For plain disk images whose contents are not a single application bundle, consider the base
    \l{AppleDiskImage} item instead.
*/

/*!
    \qmlproperty string AppleApplicationDiskImage::sourceBase

    The base directory from which artifacts installed into the disk image will be copied.
    This directory is always considered to be relative to \l{qbs::installRoot}
    {qbs.installRoot}/\l{qbs::installPrefix}
    {qbs.installPrefix}.
    For example, if the application Example.app exists at
    \c{qbs.installRoot/qbs.installPrefix/Applications/Example.app}, and the value of this property
    is \c{"/Applications"}, the application will be located at \c{/Example.app}
    relative to the disk image root. Therefore, its full path when the disk
    image is mounted would be something like \c{/Volumes/Example-1.0/Example.app}.

    \defaultvalue \c{"/Applications"}
*/

/*!
    \qmlproperty stringList AppleApplicationDiskImage::symlinks

    List of symlinks to create in the disk image. This is specified as a list of strings,
    each string containing two file paths separated by a colon. The first path is the
    symlink target, and the second path is the name of the symlink relative to the root of
    the disk image.

    \defaultvalue \c{["/Applications:Applications"]}
*/
qbs-src-3.2.0/doc/reference/items/convenience/cppstd.qdoc0000644000175100017510000000400715154533055022770 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com).
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage CppApplication
    \nextpage DynamicLibrary
    \qmltype CppStd
    \inherits StaticLibrary
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.CppStd

    \brief A helper product for building C++ std modules.

    The dependencies of this product gain access to the \c{std} named
    \l{https://en.cppreference.com/w/cpp/standard_library.html}{module}.

    An example usage:
    \code
    Project {
        CppStd {}
        CppApplication {
            Depends { name: "CppStd" }
        }
    }
    \endcode

    See the \l{tutorial-10.html}{C++20 Modules} page in the tutorial for details.
    \since Qbs 3.1
*/

/*!
    \qmlproperty bool CppStd::useStdCompat

    Whether to build the \c{std.compat} module.

    \defaultvalue \c false
    \since Qbs 3.1
*/
qbs-src-3.2.0/doc/reference/items/convenience/applediskimage.qdoc0000644000175100017510000000335515154533055024457 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage AppleApplicationDiskImage
    \nextpage Application
    \qmltype AppleDiskImage
    \inherits Product
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.AppleDiskImage

    \brief Apple disk image.

    An AppleDiskImage item is a is a \l{Product}{product} of the \l{Product::}
    {type} \c{"dmg.dmg"} that has a dependency on the \l{dmg} module.

    For single-application drag 'n' drop disk image installers, you will
    probably want to use the \l{AppleApplicationDiskImage} item instead.
*/
qbs-src-3.2.0/doc/reference/items/convenience/staticlibrary.qdoc0000644000175100017510000000304215154533055024345 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage QtLupdateRunner
    \nextpage XPCService
    \qmltype StaticLibrary
    \inherits CppLibrary
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.StaticLibrary

    \brief Static library.

    A StaticLibrary item is a \l{CppLibrary}{library} of the \l{Product::}{type}
    \c "staticlibrary".
*/
qbs-src-3.2.0/doc/reference/items/convenience/plugin.qdoc0000644000175100017510000000421115154533055022766 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2015 Jake Petroules.
** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com).
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage ObjectLibrary
    \nextpage QtApplication
    \qmltype Plugin
    \inherits Library
    \inqmlmodule QbsConvenienceItems
    \ingroup list-of-items
    \keyword QML.Plugin

    \brief Plugin base item.

    A Plugin item is a \l{Library} that is installed to the
    \l{ConfigInstall::pluginsDirectory}{pluginsDirectory}.
    It can be built as a dynamic or static library; the behavior is controlled
    by the \l{ConfigBuild::pluginType}{config.build.pluginType} property.

    On Apple platforms, the Plugin item has the \c{"loadablemodule"} type when building as dynamic
    plugin. If \l{bundle::isBundle}{bundle.isBundle} is set to \c true (the default), artifacts
    are installed into the
    \l{ConfigInstall::loadableModulesDirectory}{loadableModulesDirectory}.

    This item exists for the convenience of project file authors.
*/
qbs-src-3.2.0/doc/reference/items/language/0000755000175100017510000000000015154533055020111 5ustar  runnerrunnerqbs-src-3.2.0/doc/reference/items/language/probe.qdoc0000644000175100017510000000571115154533055022074 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Parameters
    \nextpage Product
    \qmltype Probe
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \ingroup list-of-probes
    \keyword QML.Probe

    \brief Locates files outside the project.

    Probe items can appear inside \l{Product}, \l{Project} and \l{ModuleProvider} items.
    They are run prior to building, for instance to locate dependent headers, libraries, and other
    files outside the project directory whose locations are not known ahead of time.
    Probes can be parameterized via their properties and typically store results in
    properties as well. These results are then retrieved via the Probe's id, which is mandatory:
    \code
    Product {
        Probe {
            id: valueCalculator
            property string parameter: "whatever"
            property int value
            configure: {
                value = Utils.calculateValue(parameter); // Expensive operation
                found = true;
            }
        }
        property int theValue: valueCalculator.value
    }
    \endcode

    \note Because Probes often invoke external processes, which is relatively expensive compared
          to evaluating normal properties, their results are cached. To force re-evaluation
          of a Probe, you can supply the \l{build-force-probe-execution}
          {--force-probe-execution} command-line option to the \l{build} command.
*/

/*!
    \qmlproperty bool Probe::condition

    Determines whether the probe will actually be run.

    \defaultvalue \c true
*/

/*!
    \qmlproperty bool Probe::found

    Indicates whether the probe was run successfully. Set by \l{configure}.

    \nodefaultvalue
*/

/*!
    \qmlproperty script Probe::configure

    A script that is executed when the probe is run.
*/
qbs-src-3.2.0/doc/reference/items/language/parameters.qdoc0000644000175100017510000000436415154533055023133 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Parameter
    \nextpage Probe
    \qmltype Parameters
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Parameters

    \brief Defines default values for dependency parameters within Module and Export items.

    The Parameters item defines default values for dependency parameters within
    \l{Module} and \l{Export} items.

    Example:
    \code
    DynamicLibrary {
       name: "foo"
       ...
       Export {
           ...
           Parameters {
               cpp.link: false
           }
       }
    }
    \endcode

    Every dependency on \e{foo} has the parameter \l{dependency-parameters-cpp}
    {cpp.link} set to \c{false} by default.

    This can be overridden explicitly:
    \code
    Depends { name: "foo"; cpp.link: true }
    \endcode

    The Parameters item contains a number of property bindings where
    each property must be a properly declared dependency parameter.
    For more information, see \l{Parameter} and
    \l{Module#dependency-parameters}{Module - Dependency Parameters}.
*/
qbs-src-3.2.0/doc/reference/items/language/propertyoptions.qdoc0000644000175100017510000000401615154533055024262 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Properties
    \nextpage Rule
    \inqmlmodule QbsLanguageItems
    \qmltype PropertyOptions
    \ingroup list-of-items
    \keyword QML.PropertyOptions

    \brief Provides inline documentation for properties within product and module items.

    A PropertyOptions item can appear inside a \l{Product} or \l{Module} item to
    provide inline documentation for properties.
*/

/*!
    \qmlproperty stringList PropertyOptions::allowedValues

    A list of the values permitted by the property.

    The default value, \c{undefined}, indicates that any value is permitted.
*/

/*!
    \qmlproperty string PropertyOptions::description

    A brief description of the property.

    \nodefaultvalue
*/

/*!
    \qmlproperty string PropertyOptions::name

    The name of the property to document.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/items/language/filetagger.qdoc0000644000175100017510000000706515154533055023102 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Export
    \nextpage Group
    \qmltype FileTagger
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.FileTagger

    \brief Assigns file tags to files.

    This item assigns file tags to files.
    The FileTagger item can appear in \l{Product} items or \l{Module} items.

    For every source artifact that has no file tag, \QBS will search for a
    FileTagger with a pattern that matches the file name of the source
    artifact. If a matching file tagger is found, then the file tags specified
    in the FileTagger item are assigned to the source artifact.

    If there is more than one matching FileTagger, all file taggers with the
    same highest priority are taken into account and their file tags are
    accumulated.

    The FileTagger item can be attached to a product or a module. In the latter
    case, its effect is the same as if it had been attached to all products
    having a dependency on the respective module. For instance, the
    \l{cpp} module of \QBS has, among others, the following file tagger:

    \code
    FileTagger {
        patterns: "*.cpp"
        fileTags: ["cpp"]
    }
    \endcode

    As a result, the \c "cpp" tag is automatically attached to all files ending
    with \c ".cpp" in products depending on the \c cpp module. This causes them
    to be compiled, because a C++ compiler rule has \c "cpp" in its list of
    matching input tags.

    File taggers are disabled if file tags are set explicitly in a \l{Product}
    {product} or \l{Group}{group}. For example, the \c "cpp" tag is not attached
    to the \c .cpp files in the following product:

    \code
    Product {
        Depends { name: "cpp" }
        Group {
            files: "*.cpp"
            fileTags: "other"
        }
    }
    \endcode
*/

/*!
    \qmlproperty stringList FileTagger::patterns
    \since Qbs 1.0

    A list of patterns to match against. Supports the usual wildcards '*', '?'
    and '[]'.

    Neither the list itself nor any of its elements may be empty.
*/

/*!
    \qmlproperty list FileTagger::fileTags
    \since Qbs 1.0

    Tags to attach to a product's files. These can then be matched by a rule.

    \defaultvalue An empty list
*/

/*!
    \qmlproperty int FileTagger::priority
    \since Qbs 1.10

    The priority of the FileTagger. A higher numerical value means a higher
    priority.

    \defaultvalue 0
*/
qbs-src-3.2.0/doc/reference/items/language/parameter.qdoc0000644000175100017510000000347415154533055022751 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Module
    \nextpage Parameters
    \qmltype Parameter
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Parameter

    \brief Declares a dependency parameter.

    The Parameter item declares a dependency parameter. It can appear only
    within \l{Module} and \l{Export} items.

    The Parameter item contains exactly one property declaration.

    Example:
    \code
    Module {
        Parameter { property string extra }
    }
    \endcode

    For more information about dependency parameters, see
    \l{Module#dependency-parameters}{Module - Dependency Parameters}.
*/
qbs-src-3.2.0/doc/reference/items/language/profile.qdoc0000644000175100017510000000616315154533055022427 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Product
    \nextpage Project
    \qmltype Profile
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Profile

    \brief Creates a profile within the project.

    The profiles used by \QBS are normally set up on a user's machine and are then available
    to all projects. See \l{Configuring Profiles and Preferences} for information on how
    to set up and use profiles on the command line.
    In some rare cases, however, the creator of a project has complete knowledge about the system
    on which that project is to be built. Then it can make sense to integrate the profile into
    the project:

    \code
    Product {
        // ...
        Profile {
            name: "my-special-profile"
            qbs.toolchainType: "gcc"
            qbs.targetPlatform: "linux"
            qbs.architecture: "armv7a"
            cpp.toolchainInstallPath: "/opt/special-gcc/bin"
            cpp.toolchainPrefix: "arm-linux-gnueabi-"
        }
        qbs.profiles: ["my-special-profile"]
        // ...
    }
    \endcode

    The project in the above example can be built in a particular well-known environment
    without any additional setup.

    \c Profile items can appear inside \l{Product} and \l{Project} items.
*/

/*!
    \qmlproperty string Profile::baseProfile

    The name of a profile from which this profile inherits. If the same property is
    set in both this profile and the base profile, the value from this profile
    takes precedence.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool Profile::condition

    Determines whether this profile can be used.

    If this property is set to \c false, the profile cannot be used.

    \defaultvalue \c true
*/

/*!
    \qmlproperty string Profile::name

    The name under which the profile can be referenced later. Setting this property
    is required. The value must be unique among all profiles in an entire project.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/items/language/export.qdoc0000644000175100017510000001106615154533055022306 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Depends
    \nextpage FileTagger
    \qmltype Export
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Export

    \brief Exports dependencies and properties to other products.

    An Export item can appear inside a \l{Product} item. It defines a \l{Module}
    with the product's name that can be depended on by other products.
    The properties attached to the Export item will take effect in all products
    that depend on the product inside which the Export item is defined.
    As an example, consider these two products:
    \code
    Product {
        name: "A"
        Export {
            Depends { name: "cpp" }
            cpp.includePaths: exportingProduct.sourceDirectory
            cpp.defines: ["USING_" + exportingProduct.name.toUpperCase()]
        }
    }

    Product {
        name: "B"
        Depends { name: "A" }
    }
    \endcode

    The sources in product B will be able to use headers from product A without specifying
    the full path to them, because the include path has been made known to the compiler via
    A's Export item. Additionally, product B will be compiled with the define \c{USING_A}.

    The dependent \l{Product}'s modules are not exported unless explicitly specified within the
    \l{Export} item:
    \code
    Product {
        name: "B-Exporting-A"
        Depends { name: "A" }
        Export {
            Depends { name: "A" }
        }
    }
    \endcode

    The relationship of the exported dependencies is transitive. A product C depending on a
    product B-Exporting-A will also get a direct dependency on A and thus inherit include
    paths and preprocessor macros exported by A.

    \code
    Product {
        name: "C"
        Depends { name: "B-Exporting-A" }
    }
    \endcode

    Within an Export item, you can use the \c exportingProduct variable to refer to
    the product which defines the Export item. Use the \c{importingProduct} variable
    to refer to the product that pulls in the resulting module:
    \code
    Product {
        name: "D"
        Export {
            Depends { name: "cpp" }
            cpp.includePaths: [exportingProduct.sourceDirectory, importingProduct.buildDirectory]
        }
    }
    \endcode
*/

/*!
    \qmlproperty var Export::prefixMapping

    This property allows to provide a translation of exported values between non-deployed and
    deployed contexts. It is an array of objects with properties \c prefix and \c replacement.
    The array's elements get applied to all other properties set in this item such that if the
    property's value start with \c prefix, that prefix gets replaced with \c replacement.
    It is typically used for C/C++ include paths. For instance, in a library that provides
    header files for inclusion both directly from its source directory (when building it
    as part of a bigger project) and from some installed location (when building an unrelated
    project against it), you would write something like the following:
    \code
    Export {
        Depends { name: "cpp" }
        cpp.includePaths: [exportingProduct.sourceDirectory]
        prefixMapping: [{
                prefix: exportingProduct.sourceDirectory,
                replacement: FileInfo.joinPaths(qbs.installPrefix, "include")
        }]
    }
    \endcode

    \defaultvalue \c undefined
    \see Exporter.qbs
    \see Exporter.pkgconfig
    \since 1.12
*/
qbs-src-3.2.0/doc/reference/items/language/moduleprovider.qdoc0000644000175100017510000001251215154533055024022 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Module
    \nextpage Parameter
    \qmltype ModuleProvider
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.ModuleProvider

    \brief Creates modules on demand.

    The \c ModuleProvider item implements the module creation part of the procedure described
    in the \l {Module Providers} overview. It is always located in a file called \c provider.qbs.

    The actual module creation is done on the right-hand side of the
    \l{ModuleProvider::relativeSearchPaths}{relativeSearchPaths} property.

    A ModuleProvider item may contain \l{Probe} items.

    Here is a complete minimal example of a module provider. It just creates an empty module.
    If you put this item into the file \c {module-providers/mymodule/provider.qbs}
    in your project source directory, you will be able to successfully build a product which
    contains a dependency on the module \c mymodule.
    \code
        import qbs.File
        import qbs.FileInfo
        import qbs.TextFile

        ModuleProvider {
            relativeSearchPaths: {
                var moduleDir = FileInfo.joinPaths(outputBaseDir, "modules", name);
                File.makePath(moduleDir);
                var moduleFilePath = FileInfo.joinPaths(moduleDir, name + ".qbs");
                var moduleFile = new TextFile(moduleFilePath, TextFile.WriteOnly);
                moduleFile.writeLine("Module {");
                moduleFile.writeLine("}");
                moduleFile.close();
                return "";
            }
        }
    \endcode
*/

/*!
    \qmlproperty bool ModuleProvider::isEager

    Holds whether provider is eager.

    Eager provider is executed only once and should create multiple modules at once when executed).
    A non-eager provider is executed multiple times, one time for each module \QBS tries to
    instantiate.

    \sa ModuleProvider::moduleName
    \default true
*/

/*!
    \qmlproperty string ModuleProvider::name

    The name of the module provider.

    This property is set by \QBS.

    If provider is \l{How \QBS Uses Module Providers}{requested} via the
    \l{Product::qbsModuleProviders}{qbsModuleProviders} property, it is the name specified in this
    property and matches the provider file name, without the \c .qbs extension.
    Otherwise, it is the name of the directory the provider was found in, relative to
    the particular module-providers base directory. For instance, if the dependency is \c {x.m1} and
    the provider was found in \c {module-providers/x/m1/provider.qbs}, then \c name is \c {x.m1}.
    If the provider was found in \c {module-providers/x/provider.qbs}, then \c name is \c x.
*/

/*!
    \qmlproperty string ModuleProvider::moduleName

    This property is set by QBS for non-eager providers and contains the name of the module
    that is currently being instantiated by the provider.

    For eager providers, the value of this property is \c undefined.

    \sa ModuleProvider::isEager
*/

/*!
    \qmlproperty string ModuleProvider::outputBaseDir

    The path under which the new modules should be created when \l relativeSearchPaths
    is evaluated. The path is unique for the current provider in the given configuration.

    This property is set by \QBS.
*/

/*!
    \qmlproperty stringList ModuleProvider::relativeSearchPaths

    This property gets evaluated by \QBS to retrieve new search paths with which
    to re-attempt the module look-up.

    It is here where you need to put the code that creates the new module files.
    Use the directory structure explained in \l {Custom Modules and Items}.
    That is, the file for a module called \c m will be located in a directory \c {modules/m/},
    anchored at \l outputBaseDir.

    The return value is the list of search paths required to find the new module,
    relative to \l outputBaseDir. In most cases, only a single search path will be required,
    in which case a single-element list containing an empty string should be returned
    (or just the empty string, because of \QBS' auto-conversion feature).

    The returned list can also be empty, which means that the module provider was not able
    to generate any modules in this environment.
*/
qbs-src-3.2.0/doc/reference/items/language/group.qbs0000644000175100017510000000343015154533055021754 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** 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 http://www.qt.io/terms-conditions. For further information
** use the contact form at http://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 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights.  These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/

Project {
    Product {
//! [0]
        Group {
            name: "Word processing documents"
            files: ["*.doc", "*.rtf"]
            prefix: "**/"
            qbs.install: true
            qbs.installDir: "share"
            excludeFiles: "do_not_install_this_file.*"
        }
//! [0]
    }
}
qbs-src-3.2.0/doc/reference/items/language/joblimit.qdoc0000644000175100017510000000732215154533055022576 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Group
    \nextpage Module
    \qmltype JobLimit
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.JobLimit

    \brief Restricts concurrent execution of jobs in a given pool.

    In addition to the global limit on concurrently running commands, a project might
    want to restrict concurrent execution of certain types of commands even further,
    for instance because they are not well-suited to share certain types of resources.

    In the following example, we define a rule that runs a tool of which at most one
    instance can be running for the same project at any given time:
    \code
    Rule {
        // ...
        prepare: {
            var cmd = new Command("my-exclusive-tool", [project.buildDirectory]);
            cmd.description = "running the exclusive tool";
            cmd.jobPool = "exclusive_tool";
            return cmd;
        }
    }
    JobLimit {
        jobPool: "exclusive_tool"
        jobCount: 1
    }
    \endcode

    \c JobLimit items can appear inside \l Product, \l Project and \l Module items.
    In the case of collisions, that is, items matching the same job pool but setting
    different values, the ones defined inside products have the highest precedence,
    and the ones inside modules have the lowest. Items defined in sub-projects have
    higher precedence than those defined in parent projects. For items with the same
    precedence level, the most restrictive one is chosen, that is, the one with the
    lowest job number greater than zero.

    \see {How do I limit the number of concurrent jobs for the linker only?}
*/

/*!
    \qmlproperty bool JobLimit::condition

    Determines whether the job limit is active.

    If this property is set to \c false, the job limit is ignored.

    \defaultvalue \c true
*/

/*!
    \qmlproperty int JobLimit::jobCount

    The maximum number of commands in the given \l{jobPool}{job pool} that can run
    concurrently.

    A value of zero means "unlimited", negative values are not allowed.

    \note The global job limit always applies: For instance, if you set this
          property to 100 for some job pool, and "-j 8" was given on the
          command line, then no more than eight instances of commands from
          the respective job pool will run at any time.

    This property must always be set.

    \nodefaultvalue
*/

/*!
    \qmlproperty string JobLimit::jobPool

    The job pool to which apply the limit.

    This property must always be set to a non-empty value.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/items/language/product.qdoc0000644000175100017510000002066015154533055022445 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Probe
    \nextpage Profile
    \qmltype Product
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Product

    \brief Represents the result of a build process.

    A Product typically represents the result of a build process. It specifies a set of
    input and output files and a way to transform the former into the latter. For example, the
    following product sets up a very simple C++ application:
    \code
    Product {
        name: "helloworld"
        type: "application"
        files: "main.cpp"
        Depends { name: "cpp" }
    }
    \endcode
    The \l{type} property specifies what will be built (an executable). The
    \l{files} property specifies the input files (one C++ source file), and the
    \l{Depends} item pulls in the logic from the \l{cpp} module
    about how to do the necessary transformations.
    For some often-used types of products, \QBS pre-defines special derived items that save
    users some typing. These are:
    \list
        \li \l{Application}
        \li \l{CppApplication}
        \li \l{DynamicLibrary}
        \li \l{StaticLibrary}
    \endlist
    Therefore, the above example could also be written like this:
    \code
    CppApplication {
        name: "helloworld"
        files: "main.cpp"
    }
    \endcode
    Any property \c prop attached to this item is available in sub-items as \c product.prop, as
    well as in modules that are loaded from this product.

    \section1 Multiplexing Properties

    The following properties are relevant for product multiplexing only.
    Unless multiplexing is desired, they can be left at their default values:

    \list
        \li \l{aggregate}
        \li \l{multiplexedType}
        \li \l{multiplexByQbsProperties}
    \endlist

    \note We do not promise backwards compatibility for multiplexing properties
    as they are likely to change in future \QBS versions.

    \section1 Read-Only Properties

    The following properties are automatically set by \QBS and cannot be
    changed by the user:

    \list
        \li \l{buildDirectory}
        \li \l{sourceDirectory}
    \endlist
*/

/*!
    \qmlproperty bool Product::builtByDefault

    Determines whether the product will be built.

    If \c false, the product will only be built if this is explicitly requested,
    either by listing the product name as an argument to the
    \l{build-products}{--products} option or by using the
    \l{build-all-products}{--all-products} option of the \l{build} command.

    \defaultvalue \c true
*/

/*!
    \qmlproperty bool Product::condition

    Determines whether the product will be built.

    If \c false, the product will not be built.

    \defaultvalue \c true
*/

/*!
    \qmlproperty string Product::name

    The name of the product. Used to identify the product in a \l{Depends} item, for
    example. The value of this property must be a simple JavaScript expression that
    does not depend on module properties or values that are non-local to this product.

    \code
    CppApplication {
        name: "hello" + "world"
        // valid
    }
    CppApplication {
        name: "app_" + qbs.targetOS.join("_")
        // invalid
    }
    \endcode

    To change the name of your product's target artifact, modify \l{targetName}
    instead.

    \defaultvalue An empty string
*/

/*!
    \qmlproperty stringList Product::type

    The file tags matching the product's target artifacts.

    \defaultvalue An empty list
*/

/*!
    \qmlproperty string Product::targetName

    The base file name of the product's target artifacts.

    \defaultvalue The value of \l{name} with illegal file name characters
    replaced by underscores.
*/

/*!
    \qmlproperty string Product::destinationDirectory

    The directory where the target artifacts will be located. If a relative path
    is given, the base directory will be \l{Project::buildDirectory}
    {project.buildDirectory}.

    \defaultvalue \c{product.buildDirectory}
*/

/*!
    \qmlproperty stringList Product::files

    A list of source files. Syntactic sugar to save a \l{Group} item for simple
    products.

    Relative paths are resolved using the parent directory of the project file
    that sets the property.

    \defaultvalue An empty list
*/

/*!
    \qmlproperty stringList Product::excludeFiles

    A list of source files not to include. Useful with wildcards.
    For more information, see \l{Group}.

    \defaultvalue An empty list
*/

/*!
    \qmlproperty bool Product::consoleApplication

    On Windows, determines whether a console or GUI application is generated.

    If \c true, a console application is generated. If \c false, a GUI
    application is generated.

    On Apple platforms, influences the default application type.

    If \c true, a normal executable is generated.
    If \c false, an application bundle is generated.

    \defaultvalue Linker-dependent
*/

/*!
    \qmlproperty stringList Product::qbsSearchPaths

    A list of paths that are searched for imports, modules and module providers.

    The value set here will be merged with the value of
    \l{Project::qbsSearchPaths}{project.qbsSearchPaths}.

    For the details about how to add custom items, see the \l{Custom Modules and Items} page.

    \defaultvalue \l{Project::qbsSearchPaths}{project.qbsSearchPaths}
*/

/*!
    \qmlproperty string Product::version

    The version number of the product. Used in shared library filenames and generated
    Info.plist files in Apple application and framework bundles, for example.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool Product::aggregate

    If \c{true}, an aggregate product will be created that has dependencies on all
    multiplex instances of this product.

    \note If you do not want to do multiplexing, you can use the default value
    \c{undefined}.
*/

/*!
    \qmlproperty stringList Product::multiplexedType

    Specifies the product type for the multiplexed product instances.

    \note If you do not want to do multiplexing, you can use the default value
    \c{undefined}.
*/

/*!
    \qmlproperty stringList Product::multiplexByQbsProperties

    Specifies which properties of the \l{qbs} module will be used for product
    multiplexing:

    \list
        \li \l{qbs::architectures}{architectures}
        \li \l{qbs::buildVariants}{buildVariants}
        \li \l{qbs::profiles}{profiles}
    \endlist

    The value must be a subset of the above values.

    \note If you do not want to do multiplexing, you can use the default value
    \c{["profiles"]}.
*/

/*!
    \qmlproperty path Product::buildDirectory
    \readonly

    The build directory for this product. This is the directory where generated
    files are placed.

    The value of this property is automatically set by \QBS and cannot be
    changed by the user.
*/

/*!
    \qmlproperty path Product::sourceDirectory
    \readonly

    The source directory for this product. This is the directory of the file
    where this product is defined.

    The value of this property is automatically set by \QBS and cannot be
    changed by the user.
*/

/*!
    \qmlproperty stringList Product::qbsModuleProviders

    The list of \l{Module Providers} to use for this product.

    Overrides \l{Project::qbsModuleProviders}{Project.qbsModuleProviders}.

    \sa Project::qbsModuleProviders

    \since Qbs 1.21
*/
qbs-src-3.2.0/doc/reference/items/language/depends.qdoc0000644000175100017510000001455115154533055022411 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Artifact
    \nextpage Export
    \qmltype Depends
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Depends

    \brief Represents dependencies between products and modules.

    A Depends item can appear inside a \l{Product} or \l{Module} item.

    For example, the following product will load the \l{cpp} module. In
    addition, it will try to load modules that may or may not exist, and
    pass this information on to the compiler.

    \code
    Product {
        Depends { name: "cpp" }
        Depends {
            name: "optional_module"
            versionAtLeast: "2.0"
            required: false
        }

        Properties {
            condition: optional_module.present
            cpp.defines: "HAS_OPTIONAL_MODULE"
        }

        // ...
    }
    \endcode


    \section1 Dependency Parameters

    Sometimes it is desirable to have certain dependencies handled differently
    than others. For example, one might want to depend on a dynamic library
    without linking it.

    This can be done by setting the \l{dependency-parameters-cpp}{cpp.link}
    dependency parameter to \c{true} in the dynamic library dependency:

    \code
    Product {
        Depends { name: "cpp" }
        Depends { name: "some_dynamic_lib"; cpp.link: false }

        // ...
    }
    \endcode

    Dependency parameters are a special type of property that can only be set
    within Depends and \l [QML] {Parameters} items. Dependency parameters are
    declared in the modules they belong to.

    In the example above, the \l{cpp} module declares the parameter \c{link}.
    The Depends item for \c{some_dynamic_lib} sets \c{cpp.link} to
    \c{false}, which tells the linker rule to ignore this particular dependency.
*/

/*!
    \qmlproperty bool Depends::condition

    Determines whether the dependency will actually be applied.

    \defaultvalue \c true
*/

/*!
    \qmlproperty string Depends::versionAtLeast

    The minimum value that the dependency's \c version property needs to have.
    If the actual version is lower than that, loading the dependency will fail.
    The value consists of integers separated by dots.

    \nodefaultvalue
*/

/*!
    \qmlproperty string Depends::versionBelow

    A value that the dependency's \c version property must be lower than. If the
    actual version is equal to or higher than that, loading the dependency will
    fail. The value consists of integers separated by dots.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList Depends::productTypes

    A list of product types. Any enabled product in the project that has a
    matching type will become a dependency of the product containing the Depends
    item.

    This property is mutually exclusive with the \l name and \l submodules
    properties.

    The \l required and \l profiles properties are ignored if this property is
    set.

    \note This property does not work recursively. Consider this example:
    \code
    Product {
        name: "A"
        type: "x"
        Depends { productTypes: "someTag" }
    }
    Product {
        name: "B"
        Depends { productTypes: "x" }
    }
    \endcode
    It is not guaranteed that \c A will show up in \c B's dependencies.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool Depends::required

    Setting this property to \c false creates a \e{soft dependency}, meaning
    that it is not considered an error if the given module cannot be found.
    In such a case, an instance of the respective module will be created, but
    only the \l{Module::present}{Module.present} property will be available for
    querying, and it will be set to \c false.

    \defaultvalue \c true
*/

/*!
    \qmlproperty bool Depends::minimal

    Setting this property to \c false instructs \QBS to build the respective product
    only to the extent that is necessary for the depending product.
    Otherwise (the default), the dependency gets fully built.
    This property only has an effect if the user requested a subset of the project
    to be built (that is, the -p option is used), the dependency is not in that subset
    and no other product in the subset has a non-minimal dependency on it.

    \defaultvalue \c false
    \since Qbs 3.0
*/

/*!
    \qmlproperty string Depends::name

    The name of the dependent product or module.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList Depends::profiles

    A list of profiles.

    If the dependency is on a product and that product is going to be built for
    more than one profile, you can specify here which instance of the product
    the dependency is on.

    See the \l{qbs::profiles}{qbs.profiles} property for more information.
    An empty list means a dependency on all instances of the product with the given name,
    regardless of their profile.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool Depends::limitToSubProject

    If \l productTypes is set and this property is \c true, only products that
    are in the same sub-project as the product containing the Depends item are
    considered.

    \defaultvalue \c false
*/

/*!
    \qmlproperty stringList Depends::submodules

    A list of submodules of the module to depend on, if applicable.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/items/language/subproject.qdoc0000644000175100017510000000743015154533055023145 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Scanner
    \qmltype SubProject
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.SubProject

    \brief Adds a project from a different file.

    A SubProject item is used to add a sub-project that is defined in
    a separate file. Additionally, properties of the sub-project can
    be set without modifying the separate project file.

    The following example adds a sub-project defined in
    \c{subdir/project.qbs} and overrides its name.

    \code
    Project {
        SubProject {
            filePath: "subdir/project.qbs"
            Properties {
                name: "A sub-project"
            }
        }
        ...
    }
    \endcode

    A typical use case for SubProject items is to conditionally
    include sub-projects. The following example pulls in the \e{tests}
    sub-project if and only if the \c{withTests} property is \c{true}.

    \code
    Project {
        property bool withTests: false
        SubProject {
            filePath: "tests/tests.qbs"
            Properties {
                condition: parent.withTests
            }
        }
        ...
    }
    \endcode

    If you do not need to set any properties on the sub-project, you can also
    use the \l{Project::references}{Project.references} property, the same way
    you would for a product.

    \code
    Project {
        references: "subdir/project.qbs"
    }
    \endcode

    is equivalent with

    \code
    Project {
        SubProject {
            filePath: "subdir/project.qbs"
        }
    }
    \endcode

    It is also possible to nest \l{Project} items directly in the same file.
*/

/*!
    \qmlproperty bool SubProject::condition

    Whether the sub-project is added. If \c false, the sub-project is not
    included.

    Setting this property has the same effect as setting the \c{condition}
    property within a \l{Properties} item. If both this property and the
    \c{condition} property within a \l{Properties} item are defined, the
    sub-project is included only if both properties evaluate to \c{true}.

    \defaultvalue \c true
*/

/*!
    \qmlproperty path SubProject::filePath

    The file path of the project to add as a sub-project. If the top-level item
    in this file is a \l{Product}, it gets wrapped automatically in a new project.

    \defaultvalue empty
*/

/*!
    \qmlproperty bool SubProject::inheritProperties

    Determines whether the sub-project should inherit the properties of the
    surrounding \l{Project}. You can use this feature to share global
    settings between projects and sub-projects.

    \defaultvalue \c true
*/
qbs-src-3.2.0/doc/reference/items/language/scanner.qdoc0000644000175100017510000000615315154533055022417 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Rule
    \nextpage SubProject
    \qmltype Scanner
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Scanner

    \brief Creates custom dependency scanners in products or modules.

    A Scanner item can appear inside a \l{Module} item, and allows to extract
    dependencies for artifacts from the artifacts' file contents.
    For example, this is what a scanner for "qrc" files might look like:
    \code
    import qbs.Xml

    Module {
      Scanner {
        inputs: 'qrc'
        scan: {
          var xml = new Xml.DomDocument(input.filePath);
          dependencies = [];
          // retrieve  entries from the XML document
          return dependencies;
        }
      }
    }
    \endcode
*/

/*!
    \qmlproperty bool Scanner::condition

    If \c true, the scanner is enabled, otherwise it does nothing.

    \defaultvalue \c true
*/

/*!
    \qmlproperty stringList Scanner::inputs

    A list of \l{FileTagger}{file tags} the input artifacts must match.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool Scanner::recursive

    Determines whether to scan the returned dependencies using
    the same scanner.

    \defaultvalue \c false
*/

/*!
    \qmlproperty script Scanner::searchPaths

    A script that returns the paths where to look for dependencies.

    The code in this script is treated as a function with the signature
    \c{function(project, product, input)}.

    \nodefaultvalue
*/

/*!
    \qmlproperty script Scanner::scan

    A script that reads the input artifact and returns a string list with
    dependencies.

    The code in this script is treated as a function with the signature
    \c{function(project, product, input, filePath)}, where \c input is
    the artifact at which the scan originated, and \c filePath is the
    currently scanned file. For non-recursive scans, \c filePath is
    always equal to \c{input.filePath}.


    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/items/language/rule.qdoc0000644000175100017510000003160515154533055021735 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage PropertyOptions
    \nextpage Scanner
    \qmltype Rule
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Rule

    \brief Creates transformers for input tags.

    In \QBS, rules create \e transformers that produce output files from input files.
    The term \e transformer refers to a list of \l{Command and JavaScriptCommand}{commands}.
    These commands are created in a rule's \l{prepare} script. They do the actual work, either
    directly or by executing external commands.

    \section1 A Simple Example

    The following rule takes text files and replaces Windows-style line endings with their
    Unix-style counterparts. We will look at it one piece at a time.

    \quotefromfile ../examples/rule/rule.qbs

    \skipto Rule
    \printuntil multiplex: false

    A \e {multiplex rule} creates one transformer that takes all input artifacts with the
    matching input file tag and creates one or more output artifacts. We are setting the
    respective property to \c false here, indicating that we want to create one transformer
    per input file.
    \note This is actually the default, so the above assignment is not required.

    \printuntil inputs: ["txt_input"]

    Here we are specifying that our rule is interested in input files that have the tag
    \c "txt_input". Such files could be source files, in which case you would tag them
    using a \l{Group}. Or they could in turn get generated by a different rule,
    in which case that rule would assign the file tag.
    The files matching the tag will be available in the \l{prepare} script under the name
    \c inputs (see \l{inputs and outputs}{The inputs and outputs Variables}).

    \printuntil }

    Here we are specifying that for every input file, we want to create one output file
    whose name is the same as the input file, but with an additional extension. Because we are
    giving a relative path, \QBS will prepend that path by the product's build directory.

    In addition, we tell \QBS that the output files should get the file tag \c "txt_output". This
    enables other rules to use these files as inputs. You must always assign suitable file tags
    to your output artifacts, or the rule will not be run.
    See \l{Rules and Product Types} for details.

    If you want to create more than one output file per input file, you simply provide multiple
    \l Artifact items. The set of output artifacts will be available in the prepare script
    under the name \c outputs (see \l{inputs and outputs}{The inputs and outputs Variables}).

    \printuntil /^\s{4}\}/

    The prepare script shown above puts everything together by creating the command that does
    the actual transformation of the file contents, employing the help of the
    \l{TextFile Service}{TextFile} class.

    As you can see, the return value is an array, meaning you can provide several commands to
    implement the rule's functionality. For instance, if we had provided two \c Artifact items,
    we might have also provided two commands, each of them creating one output file.

    For the \c input and \c output variables used in the code, see the next section.

    \target inputs and outputs
    \section1 The \c inputs and \c outputs Variables

    We already mentioned that the input and output artifacts are available in the prepare script
    via the variables \c inputs and \c outputs, respectively. These variables are JavaScript
    objects whose property keys are file tags and whose property values are lists of objects
    representing the artifacts matching these tags. In our example, the \c inputs variable
    has a single property \c txt_input, whose value is a list with one element. Similarly, the
    \c outputs variable also has one single property \c txt_output, again with a list containing
    one element.

    The actual artifact objects have the following properties:
    \table
    \header
        \li Property
        \li Description
    \row
        \li \c baseName
        \li The file name without any extension.
    \row
        \li \c completeBaseName
        \li The file name without the last extension.
    \row
        \li \c fileName
        \li The name of the file (that is, \c filePath without any directory components).
    \row
        \li \c filePath
        \li The full file path.
    \row
        \li \c fileTags
        \li The list of the artifact's file tags.
    \endtable

    The artifact object contains a property for every module that is used in the product. That can
    be used to access the module's properties. For instance, for an artifact in a C++ product,
    \c{artifact.cpp.defines} is the list of defines that will be passed when compiling the
    respective file.

    But what about the variables \c input and \c output that appeared in our example? These
    are simply convenience variables which are available in the case that the \c inputs
    and \c outputs variables contain only one artifact, respectively. So in our example, instead
    of \c input we also could have written \c {inputs.txt_input[0]}, which is considerably
    more verbose.

    \section1 Rules and Product Types

    It is important to know that when figuring out which rules to execute, \QBS starts at the
    product type and then looks for a way to produce artifacts with matching file tags from
    source files, using a chain of rules that are connected by their respective input and output
    tags. For instance, consider this simple C++ project:
    \code
    Product {
        type: ["application"]
        Depends { name: "cpp" }
        files: ["main.cpp"]
    }
    \endcode
    Here's how this product is built:
    \list 1
        \li \QBS looks for a rule that can produce artifacts with the file tag
            \c{"application"}. Such a rule is found in the \l{cpp} module
            (namely, the rule that invokes the linker).
        \li Since the rule found in the previous step takes inputs of type \c{"obj"}, \QBS now
            looks for a rule that produces artifacts of that type. Again, such a rule is found in
            the \c cpp module (the rule that runs the compiler).
        \li The rule found in the previous step takes inputs of type \c{"cpp"}. No rule is found
            that creates such artifacts, but we do have a source file with a matching type (because
            the \c cpp module contains a \l{FileTagger} which attached that type
            to \c{"main.cpp"} due to its file extension).
        \li Now that there is a chain of rules leading from a source file tag to the product type,
            the commands of these rules are executed one after the other until we end up with
            our executable.
    \endlist

    \section1 A Complete Example

    The following code snippet shows a single \l{Rule} within a \l{Product} and summarizes the
    previous sections.

    \note The product's type is set up to the \c "txt_output" file tag to tell \QBS that the
    product depends on output artifacts produced by the custom rule. Otherwise the rule would not
    be executed.

    \quotefile ../examples/rule/rule.qbs
*/

/*!
    \qmlproperty bool Rule::multiplex

    Determines whether this is a multiplex rule.

    \defaultvalue \c false
*/

/*!
    \qmlproperty stringList Rule::inputs

    A list of file tags the input artifacts must match.

    All output artifacts will depend on all artifacts in the product with
    the given input file tags. Also, these artifacts are available in the
    \c inputs variable of the \l{prepare} script.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList Rule::auxiliaryInputs

    A list of file tags. This rule will be dependent on (that is: applied after)
    every other rule in the same product that (potentially) produces artifacts
    that are compatible with the value of this property.

    Unlike \l{inputs}, this property has no effect on the content of the
    \c inputs variable of the \l{prepare} script.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList Rule::auxiliaryInputsFromDependencies

    Like \l auxiliaryInputs, except that instead of rules from the current product,
    those from product dependencies are considered.

    \nodefaultvalue
    \since 2.6
*/

/*!
    \qmlproperty stringList Rule::excludedInputs

    A list of file tags. Connections to rules that produce these file tags are
    prevented.

    \nodefaultvalue
    \since Qbs 1.12
*/

/*!
    \qmlproperty stringList Rule::inputsFromDependencies

    A list of file tags that the artifacts of product dependencies must match.

    For example, the product \a foo might appear as follows in the current
    product:

    \code
     Depends {
         name: "foo"
     }
    \endcode

    All artifacts of \a foo that match the given file tags will appear in the
    \c inputs variable of the \l{prepare} script.

    \nodefaultvalue
*/

/*!
    \qmlproperty var Rule::outputArtifacts

    An array of output artifacts, specified as JavaScript objects.

    For example:

    \code
    outputArtifacts: [{
        filePath: "myfile.cpp",
        fileTags: ["cpp"],
        cpp: { cxxLanguageVersion: "c++11" }
    }]
    \endcode

    For a description of the possible properties, see the documentation of the
    \l{Artifact} item.

    Output artifacts can be specified either by this property or by \l{Artifact}
    items. Use this property if the set of outputs is not fixed but depends the
    input's content. If no file tags are provided, \QBS will apply all
    \l{FileTagger}{file taggers} known in the current context to the output file
    name.

    The user may set the property \c{explicitlyDependsOn} on artifact objects, which is
    similar to \l{Rule::explicitlyDependsOn}{Rule.explicitlyDependsOn}.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList Rule::outputFileTags

    If output artifacts are specified by \l{outputArtifacts}, this property must
    specify a list of file tags that the rule potentially produces.

     \nodefaultvalue
*/

/*!
    \qmlproperty bool Rule::condition

    If \c true, the rule is enabled, otherwise it does nothing.

    \defaultvalue \c true
*/

/*!
    \qmlproperty stringList Rule::explicitlyDependsOn

    A list of file tags. Each artifact that matches the file tags is added to
    the dependencies of each output node. All artifacts in the current product
    are considered.

    The main difference between this property and \l inputs is that all matching artifacts
    are dependencies for all output artifacts, regardless of whether \l multiplex
    is true or not.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList Rule::explicitlyDependsOnFromDependencies

    Like \l explicitlyDependsOn, except that instead of artifacts from the current product,
    those from product dependencies are considered.

    \nodefaultvalue
    \since Qbs 1.12
*/

/*!
    \qmlproperty script Rule::prepare

    A script that prepares the commands to transform the inputs to outputs.

    The code in this script is treated as a function with the signature
    \c{function(project, product, inputs, outputs, input, output, explicitlyDependsOn)}.

    The argument \c{input} is \c{undefined} if there's more than one input
    artifact for this rule. Similarly, \c{output} is only defined if there is
    exactly one output artifact.

   \nodefaultvalue

*/

/*!
    \qmlproperty bool Rule::requiresInputs

    Specifies whether a rule's commands should be created even if no inputs are
    available.

    Enabling this property can be useful if you are not sure whether input
    files exist, and you want \QBS to create an output file even if they do not.

    Set to \c true if the rule declares any inputs, \c false otherwise.
*/

/*!
    \qmlproperty bool Rule::alwaysRun

    If \c true, the rule's commands are always executed, even if all output
    artifacts are up to date.

    \defaultvalue \c false
*/
qbs-src-3.2.0/doc/reference/items/language/artifact.qdoc0000644000175100017510000000533215154533055022561 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \nextpage Depends
    \ingroup list-of-language-items
    \qmltype Artifact
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Artifact

    \brief Describes a file produced by a Rule.

    An Artifact represents a single file produced by a \l{Rule}.

    For example, if a rule produces three files, it needs to contain three
    Artifact items.

    In addition to Artifact properties, you can set module properties within an
    Artifact item, as follows:

    \code
    Artifact {
        filePath: "somefile.cpp"
        fileTags: ["cpp"]
        cpp.cxxLanguageVersion: "c++11"
        // ...
    }
    \endcode

    \note The code on the right-hand side of Artifact properties has access to
    the set of input artifacts. That is, it can refer to the \c inputs map and,
    if the rule is not a multiplex rule, the \c input variable.
*/

/*!
    \qmlproperty bool Artifact::alwaysUpdated

    Setting this property to \c false means the file is not necessarily always
    written to by any command run by the rule.
    If all artifacts of a rule have this property set to \c false, the commands
    of the rule are only executed if all of them are out of date compared to the inputs.

    \defaultvalue \c true
*/

/*!
    \qmlproperty string Artifact::filePath

    The file path of the target artifact.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList Artifact::fileTags

    A list of tags to attach to the target file. These can then be matched by a
    \l{Rule}.

    \defaultvalue An empty list
*/
qbs-src-3.2.0/doc/reference/items/language/project.qdoc0000644000175100017510000001055515154533055022435 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Profile
    \nextpage Properties
    \qmltype Project
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Project

    \brief Represents a collection of products and properties.

    A Project item represents a collection of of products. In a
    non-trivial project, these products are typically defined in their own files and
    referenced in the main project file:
    \code
    Project {
        references: [
            "product1/product1.qbs",
            "product2/product2.qbs"
        ]
    }
    \endcode
    Any property \c prop attached to this item is available in sub-items as \c project.prop.

    While the root of the item hierarchy is always a Project, this kind of item
    can also appear further down the hierarchy. Such sub-projects are usually
    introduced to group products. See \l{SubProject} for details.

    \note If your project consists of only one product, the Project item can be
    omitted.
*/

/*!
    \qmlproperty path Project::buildDirectory
    \readonly

    The build directory of the top-level project.
*/

/*!
    \qmlproperty string Project::name

    The project name. Only relevant when displaying a project tree in an IDE,
    for example.

    \defaultvalue The basename of the file that defines the project.
*/

/*!
    \qmlproperty string Project::profile
    \readonly

    The top-level \l{Profile}{profile} for building the project. This property
    is set by \QBS when the project is being set up.
*/

/*!
    \qmlproperty bool Project::condition

    Whether the project is enabled. If \c false, no \l{Product}{products} or
    sub-projects will be collected.

    \defaultvalue \c true
*/

/*!
    \qmlproperty stringList Project::qbsSearchPaths

    A list of paths that are searched for imports, modules and module providers in addition to the
    ones listed in \c{preferences.qbsSearchPaths}. The value set here is merged with the value
    inherited from the parent project, if there is one. The result is inherited by
    all products in the project.

    For the details about how to add custom items, see the \l{Custom Modules and Items} page.

    \defaultvalue An empty list
*/

/*!
    \qmlproperty pathList Project::references

    A list of files from which to import products. This is equivalent to defining
    the respective \l{Product} items directly under this Project item.

    \defaultvalue An empty list
*/

/*!
    \qmlproperty path Project::sourceDirectory
    \readonly

    The directory where the file containing the top-level Project item is
    located.
*/

/*!
    \qmlproperty string Project::minimumQbsVersion

    The minimum version of \QBS that is needed to build this project.

    \defaultvalue \c "1.3.0"
*/

/*!
    \qmlproperty stringList Project::qbsModuleProviders

    The list of \l{Module Providers} to use for this project.

    Providers contribute to the \l{Product::}{qbsSearchPaths} in the order specified here, so
    modules generated by providers specified earlier are prioritized.
    Currently, this order also corresponds with the actual execution order of the providers, but
    this should not be relied upon.

    \sa Product::qbsModuleProviders

    \since Qbs 1.21
*/

qbs-src-3.2.0/doc/reference/items/language/group.qdoc0000644000175100017510000002242515154533055022122 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \previouspage FileTagger
    \nextpage JobLimit
    \qmltype Group
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Group

    \brief Groups files and other items in a product or module.

    This item is attached to a \l{Product}{product} or \l{Module}{module} and used to group files
    and other items that have something in common.

    \section1 Typical Uses of Groups by Example

    \code
    Application {
        Group {
            name: "common files"
            files: ["myclass.h", "myclass_common_impl.cpp"]
        }
        Group {
            name: "Windows files"
            condition: qbs.targetOS.includes("windows")
            files: "myclass_win_impl.cpp"
        }
        Group {
            name: "Unix files"
            condition: qbs.targetOS.includes("unix")
            files: "unixhelper.cpp"
            Group {
                name: "Linux files"
                condition: qbs.targetOS.includes("linux")
                files: "myclass_linux_impl.cpp"
            }
            Group {
                name: "FreeBSD files"
                condition: qbs.targetOS.includes("freebsd")
                files: "myclass_freebsd_impl.cpp"
            }
        }
        Group {
            name: "Files to install"
            qbs.install: true
            qbs.installDir: "share"
            files: "runtime_resource.txt"
        }
    }
    \endcode

    \section1 Wildcards

    When specifying files, you can use the wildcards \c "*", \c "?" and \c "[]", which
    have their
    \l{https://en.wikipedia.org/wiki/Wildcard_character#File_and_directory_patterns}{usual meaning}
    as in Unix Shell. By default, matching files are only picked up directly from the
    parent directory, but you can tell \QBS to consider the whole directory tree.
    It is also possible to exclude certain files from the list.
    The pattern \c "**" used in a pathname expansion context will match all files and zero or more
    directories and subdirectories.
    For example:
    \snippet reference/items/language/group.qbs 0

    \section1 Attaching Module Properties to Source Files

    Within a \c Group item, module properties can be attached either to all files in the
    product, or to only the files in that group. The following example demonstrates both:
    \code
    Product {
        // ...
        Group {
            condition: project.hasSpecialFeature
            cpp.defines: "FEATURE_SPECIFIC"
            product.cpp.defines: "WITH_FEATURE"
            files: "feature.cpp"
        }
    }
    \endcode
    Here, the macro \c "FEATURE_SPECIFIC" will only be visible inside \c feature.cpp, whereas
    \c "WITH_FEATURE" applies to all source files in the product.

    A group-level property binding starting with \c "product." is semantically equivalent
    to putting the same property binding without that prefix inside a top-level \l Properties item
    with the same condition as the group. The above example could therefore also have been written
    like this:
    \code
    Product {
        // ...
        Group {
            condition: project.hasSpecialFeature
            cpp.defines: "FEATURE_SPECIFIC"
            files: "feature.cpp"
        }
        Properties {
            condition: project.hasSpecialFeature
            cpp.defines: "WITH_FEATURE"
        }
    }
    \endcode
    Obviously, the original variant is to be preferred, as it does not duplicate the condition
    and keeps related code close together.

    It should be noted that there is a third way to write the same example, with a \l Properties
    item inside the group:
    \code
    Product {
        // ...
        Group {
            condition: project.hasSpecialFeature
            cpp.defines: "FEATURE_SPECIFIC"
            files: "feature.cpp"
            Properties {
                cpp.defines: "WITH_FEATURE"
            }
        }
    }
    \endcode
    This construct just adds verbosity here, but might be useful in cases where the product-level
    property binding is dependent on an additional condition.

    \section1 Attaching Module Properties to Generated Files

    A group can also be used to attach properties to build artifacts such as executables or
    libraries. In the following example, an application is installed to "/bin".
    \code
    Application {
        Group {
            fileTagsFilter: "application"
            qbs.install: true
            qbs.installDir: "bin"
        }
    }
    \endcode

    \section1 Groups in Modules

    Groups may also appear in \l{Module}{modules}, which causes the respective
    sources to be added to the products depending on the said module, unless
    the \l{filesAreTargets} property is set.

    \section1 Grouping Related Items

    Groups can contain other items, namely \l Depends, \l FileTagger, \l Rule and \l Scanner items.
    They can also contain other groups, that is, they can be nested. The \l{condition} of
    a groups's child item gets logically ANDed with the one of the parent group. Additionally,
    if the child item is a group itself, the child group inherits the module properties and
    \l{FileTagger}{file tags} as well as the prefix of its parent group.
*/

/*!
    \qmlproperty string Group::name

    The name of the group. Not used internally; mainly useful for IDEs.

    \defaultvalue "Group x", where x is a unique number among all the
    groups in the product.
*/

/*!
    \qmlproperty pathList Group::files

    The files in the group. Mutually exclusive with \l{fileTagsFilter}.
    Relative paths are resolved using the parent directory of the file
    that contains the Group item. However, if the \l{prefix} property is set to
    an absolute path, then that one becomes the base directory.

    The values can contain wildcards.

    \defaultvalue An empty list
*/

/*!
    \qmlproperty bool Group::filesAreTargets

    If this property is \c true and the group is in a \l{Module}, the files in the
    group will not become source artifacts of the product that depends on the module.
    Instead, they are treated like target artifacts of products. That is, they will be
    matched against the \l{Rule::inputsFromDependencies}{inputsFromDependencies}
    file tag list of \l{Rule}{rules} in products that depend on the module.

    \defaultvalue \c false
*/

/*!
    \qmlproperty string Group::prefix

    A string to prepend to all files. Slashes are allowed and have directory
    semantics.

    \defaultvalue The prefix of the parent group if one exists, otherwise empty.
*/

/*!
    \qmlproperty stringList Group::fileTagsFilter

    List of \l{Artifact::fileTags}{artifact.fileTags} to match. Any properties
    set in this group will be applied to the product's artifacts whose file tags
    match the ones listed here.

    The file tags that the group's \l{fileTags} property specifies will
    be added to the matching artifacts.

    This property is mutually exclusive with \l{files}.

    \defaultvalue An empty list
*/

/*!
    \qmlproperty bool Group::condition

    Determines whether the files in the group are actually considered part of
    the project.

    \defaultvalue \c true
*/

/*!
    \qmlproperty stringList Group::fileTags

    A list of file tags to attach to the group's files. These can then be
    matched by a \l{Rule}{rule}.

    \note \l{FileTagger}{File taggers} are never applied to a file that has this
    property set.

    \defaultvalue An empty list
*/

/*!
    \qmlproperty bool Group::overrideTags

    Determines how tags on files that are listed both at the top level of
    a product (or the parent group, if there is one) and a group are handled.
    If this property is \c true, then the \l{FileTagger}{file tags} set via the
    group replace the ones set via the product or parent group.
    If it is \c false, the \e {group tags} are added to the \e {parent tags}.

    This property is ignored if \l{fileTagsFilter} is set.

    \defaultvalue \c true
*/

/*!
    \qmlproperty pathList Group::excludeFiles

    A list of files that are \e subtracted from the \l{files} list.

    The values can contain wildcards.

    This property is ignored if \l{fileTagsFilter} is set.

    \defaultvalue An empty list
*/
qbs-src-3.2.0/doc/reference/items/language/module.qdoc0000644000175100017510000002301615154533055022250 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage JobLimit
    \nextpage ModuleProvider
    \qmltype Module
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Module

    \brief Represents a collection of properties and items that can be loaded into a product.

    A Module item is a collection of properties and language items. It
    contributes to building a product if the product has a
    \l{Depends}{dependency} on the module. Modules may contain the following
    items:

    \list
        \li \l{Depends}
        \li \l{FileTagger}
        \li \l{Group}
        \li \l{JobLimit}
        \li \l{Parameter}
        \li \l{Probe}
        \li \l{PropertyOptions}
        \li \l{Rule}
        \li \l{Scanner}
    \endlist

    When a product expresses a dependency on a module, \QBS will create an
    instance of the module item in the scope of the product. The product can
    then read and write properties from and to the loaded module, respectively.

    Modules in different products are isolated from each other, just as products
    cannot access each other's properties. However, products can use the
    \l{Export} item to pass dependencies and properties of modules to other
    dependent products.

    The following (somewhat artificial) module pre-processes text files by removing certain
    characters from them. The module's name is \c{txt_processor}.

    \qml
    import qbs.FileInfo
    import qbs.TextFile

    Module {
        property stringList unwantedCharacters: []

        FileTagger {
            patterns: ["*.raw"]
            fileTags: ["raw-txt"]
        }

        Rule {
            inputs: ["raw-txt"]

            Artifact {
                filePath: FileInfo.relativePath(input.filePath, product.sourceDirectory) +
                           "/" + input.fileName + ".processed"
                fileTags: ["processed-txt"]
            }

            prepare: {
                var cmd = new JavaScriptCommand();
                cmd.description = "Processing " + input.fileName;
                cmd.sourceCode = function() {
                    var inFile = new TextFile(input.filePath, TextFile.ReadOnly);
                    var content = inFile.readAll();
                    inFile.close();
                    var unwantedChars = input.txt_processor.unwantedCharacters;
                    for (var c in unwantedChars)
                        content = content.replace(unwantedChars[c], "");
                    var outFile = new TextFile(output.filePath, TextFile.WriteOnly);
                    outFile.write(content);
                    outFile.close();
                };
                return cmd;
            }
        }
    }
    \endqml

    And this is how a \l{Product} would use the module:

    \qml
    Product {
        type: "processed-txt"
        Depends { name: "txt_processor" }
        txt_processor.unwantedCharacters: ["\r"]
        files: [
            "file1.raw",
            "file2.raw"
        ]
    }
    \endqml

    The resulting files are tagged with \c{processed-txt} and might be consumed
    by a rule in another module. That is possible if another rule has
    \c{processed-txt} in its \l{Rule::inputs}{inputs} property.

    For more information about how you make your own modules available to \QBS,
    see \l{Custom Modules and Items}.

    \section1 Accessing Product and Module Properties

    When defining a property in a module item, the right-hand side expression is
    a binding. Bindings may reference other properties of:

    \list
        \li the current module
        \li other modules that this module depends on
        \li the dependent product
    \endlist

    Please note that this applies to bindings in modules only. Property access
    in rules and other nested items is different.

    \section2 Accessing Properties of the Current Module

    Sibling properties in the same module can be accessed directly by their name:

    \qml
    Module {
        property stringList windowsDefaults: ["\r"]
        property stringList unwantedCharacters: windowsDefaults
    }
    \endqml

    \section2 Properties of the Dependent Modules

    When a module loads another module through a \l{Depends} element, it can
    access properties of the other module through its name. Assuming there was a
    module \c OtherModule with a property \c otherProperty, such an access would
    look like this:

    \qml
    Module {
        Depends { name: "OtherModule" }
        property string myProperty: "something-" + OtherModule.otherProperty
    }
    \endqml

    \section2 Accessing Properties of the Dependent Product

    \qml
    Module {
        property bool featureEnabled:
                (product.type.includes("application")) ?  true : false
    }
    \endqml

    \section2 Special Property Values

    For every property defined in a module, \QBS provides the special
    \l{Special Property Values#original}{original} value containing the value of the property in
    the module itself (possibly overridden from a profile).

    \section1 Dependency Parameters

    Modules can declare dependency parameters. Those parameters can be set
    within \l{Depends} items. \l{Rule}{Rules} of the module can read the
    parameters of dependencies and act accordingly.

    In the following example, the module \e{foo} declares the parameter
    \c{ignore}. A dependency to \c{bar} then sets the parameter \c{foo.ignore}
    to \c{true}. A rule in \c{foo} ignores all dependencies that have
    \c{foo.ignore} set to true.

    \code
    Module {    // Definition of module 'foo'.
        Parameter { property bool ignore }
        Rule {
            ...
            prepare: {
                for (i in product.dependencies) {
                    var dep = product.dependencies[i];
                    if (dep.foo.ignore)
                        continue;
                    // Do something with the dependency.
                }
            }
        }
        ...
    }
    ----------
    Product {
        Depends { name: "foo" }
        Depends { name: "bar"; foo.ignore: true }
    }
    \endcode
*/

/*!
    \qmlproperty stringList Module::additionalProductTypes

    A list of elements that will be added to the \l{Product::type}{type}
    property of a product that has a dependency on the module.

    \defaultvalue \c []
*/

/*!
    \qmlproperty bool Module::condition

    Whether the module is enabled. If this property is \c false, the
    surrounding Module item will not be considered in the module look-up.

    \defaultvalue \c true
*/

/*!
    \qmlproperty bool Module::present
    \readonly

    This property is \c false if and only if the respective \l{Depends} item had
    its \l{Depends::required}{required} property set to \c false and the module
    was not found.

    \defaultvalue \c true
*/

/*!
    \qmlproperty int Module::priority

    The priority of this module instance. If there is more than one module
    instance available for a module name, the module with the highest priority
    is chosen.

    \defaultvalue 0
*/

/*!
    \qmlproperty script Module::setupBuildEnvironment

    A script for setting up the environment in which a product is built.

    The code in this script is treated as a function with the signature
    \c{function(project, product)}.

    Use the \l{Environment Service}{Environment} functions to alter the
    environment.

    The return value of this script is ignored.

    \nodefaultvalue
*/

/*!
    \qmlproperty script Module::setupRunEnvironment

    A script for setting up the environment in which a product is run.

    The code in this script is treated as a function with the signature
    \c{function(project, product, config)}.

    The \c config parameter is a list of arbitrary strings that can be passed
    via the \l{run} command. The values supported by specific modules are
    listed in their respective documentation.

    Use the \l{Environment Service}{Environment} functions to alter the
    environment.

    The return value of this script is ignored.

    \nodefaultvalue
*/

/*!
    \qmlproperty script Module::validate

    A script that is run after the module is loaded. It can be used to check
    property values and throw errors in unexpected cases. The return value is
    ignored.

    \nodefaultvalue
*/

/*!
    \qmlproperty string Module::version

    The module's version. It consists of integer values separated by dots. You
    can check for specific values of this property in a \l{Depends} item.
*/
qbs-src-3.2.0/doc/reference/items/language/properties.qdoc0000644000175100017510000001240615154533055023160 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \previouspage Project
    \nextpage PropertyOptions
    \qmltype Properties
    \inqmlmodule QbsLanguageItems
    \ingroup list-of-items
    \keyword QML.Properties

    \brief Provides conditional setting of properties.

    \note This topic documents the Properties item in the context of \l{Product}
    {products}. For more information about using it in sub-projects, see
    \l{SubProject}.

    The Properties item is an auxiliary item for setting multiple property values conditionally.

    In the following example, two properties are set if the project is built for Windows:
    \code
    Product {
        Properties {
            condition: qbs.targetOS.includes("windows")
            cpp.defines: ["ON_WINDOWS"]
            cpp.includePaths: ["extraWindowsIncludes"]
        }
    }
    \endcode

    As the above example demonstrates, the \c Properties item is especially useful if there are
    several properties whose values depend on the same set of conditions.
    These conditions do not need to be mutually exclusive, but care should be taken not to set
    the same scalar property in more than one matching \c Properties item. \QBS makes no guarantees
    about the value of the property in such cases.

    If the same property is set both inside and outside of a \c Properties
    item, the behavior depends on the type of property:
    \list
    \li For scalar values, the outside binding is only considered if none of the \c Properties
        conditions match, that is, it acts as an "else" case.
    \li For list values, the outside value is always considered.
    \endlist
    \code
    Product {
        Properties {
            condition: qbs.targetOS.includes("windows")
            cpp.defines: ["ON_WINDOWS"]
            cpp.includePaths: ["myWindowsIncludes"]
            cpp.treatWarningsAsErrors: false
        }
        Properties {
            condition: qbs.targetOS.includes("linux")
            cpp.defines: ["ON_LINUX"]
            cpp.includePaths: ["myLinuxIncludes"]
        }
        cpp.defines: ["ALL_PLATFORMS"]
        cpp.treatWarningsAsErrors: true
    }
    \endcode
    is roughly equivalent to
    \code
    Product {
        cpp.defines: {
            var defines = ["ALL_PLATFORMS"];
            if (qbs.targetOS.includes("windows"))
                defines.push("ON_WINDOWS");
            if (qbs.targetOS.includes("linux"))
                defines.push("ON_LINUX");
            return defines;
        }
        cpp.includePaths: {
            if (qbs.targetOS.includes("windows"))
                return ["myWindowsIncludes"];
            if (qbs.targetOS.includes("linux"))
                return ["myLinuxIncludes"];
            return base ? base : original;
        }
        cpp.treatWarningsAsErrors: !qbs.targetOS.includes("windows")
    }
    \endcode

    In Properties items, one can access the \l{Special Property Values#outer}{outer} value of a
    property.
    \code
    Product {
        property string theFeature: "basic"
        Properties {
            condition: qbs.targetOS.includes("windows")
            theFeature: outer + "_plus_windows" // === "basic_plus_windows"
        }
        Properties {
            condition: qbs.targetOS.includes("linux")
            theFeature: outer + "_plus_linux"   // === "basic_plus_linux"
        }
        cpp.defines: 'THE_FEATURE="' + theFeature + '"'
    }
    \endcode

*/

/*!
    \qmlproperty bool Properties::condition

    The condition to be used for the other bindings in this item.

    \default true
    \note The special value \c undefined can be used to indicate
          that this condition should be considered true if and only if none of the other
          Properties items matched for a given property binding.
*/

/*!
    \qmlproperty bool Properties::overrideListProperties

    List properties set within this item will override the values coming from
    modules, rather than getting merged with them, which is the default behavior.
    Use this in the rare case that a module you depend on inserts a value into
    a list property that is problematic for some product.

    \defaultvalue \c false
*/
qbs-src-3.2.0/doc/reference/module-providers/0000755000175100017510000000000015154533055020505 5ustar  runnerrunnerqbs-src-3.2.0/doc/reference/module-providers/qt-module-provider.qdoc0000644000175100017510000000575015154533055025123 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Qt
    \inqmlmodule QbsModuleProviders

    \brief Module provider that generates Qt modules.

    Looking up a Qt installation happens via a \l{Module Providers}{module provider}.
    By default, if a dependency to a Qt module is encountered, \QBS collects all Qt installations
    it can find. This lookup happens by searching for \c qmake executables in the \c PATH
    environment variable. Alternatively, you can explicitly tell \QBS which Qt
    installations it should consider by setting the qmakeFilePaths
    module provider \l{Parameterizing Module Providers}{property}. In that case,
    the environment will be ignored. For instance, with the following Linux command line,
    \QBS will build the project against a custom Qt instead of the standard one in \c{/usr/bin}:
    \code
    $ qbs moduleProviders.Qt.qmakeFilePaths:/opt/myqt/bin/qmake
    \endcode
    You can also set the module provider property in a profile. The simplest way to do
    this is via the \l setup-qt tool. For examples of how to use this tool, see the
    \l{Managing Qt Versions} section.

    This provider is activated automatically when encountering a dependency on the Qt
    module and the \l{Product::qbsModuleProviders}{qbsModuleProviders} property
    is \c undefined:
    \code
    CppApplication {
        Depends { name: "Qt.core" }
        files: "main.cpp"
    }
    \endcode

    Alternatively, you can activate this provider explicitly via the
    \l{Product::qbsModuleProviders}{qbsModuleProviders} property:
    \code
    CppApplication {
        Depends { name: "Qt.core" }
        files: "main.cpp"
        qbsModuleProviders: "Qt"
    }
    \endcode
*/

/*!
    \qmlproperty stringList Qt::qmakeFilePaths

    List of paths to \c qmake executables.

    \defaultvalue undefined
*/
qbs-src-3.2.0/doc/reference/module-providers/conan-module-provider.qdoc0000644000175100017510000000652015154533055025571 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype conan
    \inqmlmodule QbsModuleProviders
    \since 2.4

    \brief Module provider for the Conan package manager.

    This module provider allows integration with the \l{https://conan.io}{Conan} package manager.

    \section1 Prerequisites
    In order to use this provider, you will need \c Conan version 2.5.0 or higher. Earlier versions
    do not have the \c QbsDeps generator.

    \section1 Example
    For details on how to setup a project to use with Conan, see the \
    l{https://github.com/qbs/qbs/blob/master/examples/protobuf/addressbook_conan}{addressbook_conan}
    folder in examples.
    First, you will need a \l{https://docs.conan.io/2/reference/conanfile_txt.html}{conanfile} as
    shown below.
    \code
    [requires]
    protobuf/3.21.12
    [tool_requires]
    protobuf/3.21.12
    [generators]
    QbsDeps
    \endcode
    We use the text version for simplicity, but you can use the Python conanfile as well.

    Next, set the \l{Product::qbsModuleProviders}{qbsModuleProviders} property to \c "conan":
    \snippet ../examples/protobuf/addressbook_conan/addressbook_conan.qbs 0

    Install Conan dependencies and run the QbsDeps generator from the \c addressbook_conan dir:
    \code
    $ conan install . -g=QbsDeps --output-folder=build --build missing
    \endcode
    This will create the \c{./build/qbs-deps} directory contaning files for provider. Now you can
    pass the conan install directory to the provider:
    \code
    $ qbs moduleProviders.conan.installDirectory:build
    \endcode
    You should see the following output if everything is correct:
    \code
    Build graph does not yet exist for configuration 'default'. Starting from scratch.
    Resolving project for configuration default
    Setting up Conan module 'protobuflib'
    Setting up Conan module 'zlib'
    ...
    Build done for configuration default.
    \endcode
*/

/*!
    \qmlproperty string conan::installDirectory

    The path to the conan install installDirectory.

    \QBS searches for files created by the QbsDeps generator in that directory.

    If not set, the provider will not be run.

    \defaultvalue undefined
*/
qbs-src-3.2.0/doc/reference/module-providers/qbspkgconfig-module-provider.qdoc0000644000175100017510000001107715154533055027153 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype qbspkgconfig
    \inqmlmodule QbsModuleProviders
    \since 1.20

    \brief Module provider based on the qbspkg-config library.

    \QBS uses a built-in parser of the \c{*.pc} files and does not require the presence of the
    \c pkg-config tool in the system. However, if the \c pkg-config tool is present, \QBS will
    use the same libDirs as the system pkg-config uses by default; otherwise, a built-in list of
    paths is used.

    In order to enable usage of this provider in your Product, set the
    \l{Product::qbsModuleProviders}{qbsModuleProviders} property as shown in the example below:
    \snippet ../examples/pkgconfig-provider/pkgconfig-provider.qbs 0
*/

/*!
    \qmlproperty string qbspkgconfig::executableFilePath

    The path to the \c {pkg-config} executable. If not set, the pkg-config from PATH is used.

    \defaultvalue undefined
*/

/*!
    \qmlproperty stringList qbspkgconfig::libDirs

    Set this if you need to overwrite the default search directories.
    \note You do not need to set this for cross-compilation in order to point
          to the sysroot. \QBS does that for you.

    This property is the equivalent of the \c{PKG_CONFIG_LIBDIR} variable
    for the \c{pkg-config} tool.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList qbspkgconfig::extraPaths

    Set this if you need to add extra search directories.

    This property is the equivalent of the \c{PKG_CONFIG_PATH} variable
    for the \c{pkg-config} tool.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool qbspkgconfig::staticMode

    If this property is \c true, then \QBS will include "private" libs and dependencies of the
    package. This property is the equivalent of the
    \c{--static} option for the \c{pkg-config} tool.

    Set this if your product is to be linked statically.

    \defaultvalue \c false
*/

/*!
    \qmlproperty bool qbspkgconfig::definePrefix

    If this property is \c true, then \QBS will override the ${prefix} variable in the packages
    with a value that is guessed based on the location of the .pc file.

    This option corresponds to the \c --define-prefix / \c --dont-define-prefix command line
    options of the \c pkg-config tool.

    \defaultvalue \c true on Windows, \c false otherwise
*/

/*!
    \qmlproperty stringList qbspkgconfig::executableNames

    The names of the \c pkg-config executable to search for.

    Note that since newer distributions use \l{http://pkgconf.org}{pkgconf} by default, it has
    higher priority over \c pkg-config.

    \defaultvalue \c{["pkgconf", "pkg-config"]}
*/

/*!
    \qmlproperty path qbspkgconfig::sysroot

    Set this property if you need to overwrite the default search sysroot path used by
    \c pkg-config.

    This can be useful if \c pkg-config files are located in the directory other than qbs.sysroot.
    This is the case on macOS platform - all XCode profiles are sysrooted to the SDK
    directory, but \c pkg-config is typically intalled using Brew and resides in the
    \c /usr/local directory.

    Setting this property to \c undefined or empty (\c "") value will use pkg-config's default
    search paths:
    \code
        qbs resolve moduleProviders.qbspkgconfig.sysroot:undefined
    \endcode

    This property is the equivalent of the \c{PKG_CONFIG_SYSROOT_DIR} variable for the
    \c{pkg-config} tool.

    \defaultvalue \c "" on macOS, \c qbs.sysroot on other platforms
*/
qbs-src-3.2.0/doc/reference/modules/0000755000175100017510000000000015154533055016655 5ustar  runnerrunnerqbs-src-3.2.0/doc/reference/modules/bundle-module.qdoc0000644000175100017510000004447015154533055022272 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype bundle
    \inqmlmodule QbsModules
    \since Qbs 1.4

    \brief Provides Core Foundation bundle support.

    The \c bundle module contains properties and rules for building and working with
    Core Foundation bundles on Apple platforms (commonly known as CFBundles or simply \e bundles),
    directories with a standardized hierarchical structure that hold executable code and resources.
    Examples include applications, frameworks, and plugins.

    This module is available on all platforms but is currently only useful on Apple platforms.

    \note Core Foundation bundles are not to be confused with Mach-O loadable modules, which are
    also referred to as (loadable) \e bundles in Apple parlance.
    In \QBS, Core Foundation bundles are referred to as \e bundles,
    while Mach-O loadable bundles are referred to as \e {loadable modules}.

    \target dependency-parameters-bundle
    \section2 Dependency Parameters

    \table
    \header
        \li Parameter
        \li Type
        \li Since
        \li Default
        \li Description
    \row
        \li \c{isForMainBundle}
        \li \c{bool}
        \li 3.1
        \li true
        \li If \c{false}, the dependency will not be copied into this main bundle.
    \endtable

    \section2 Relevant File Tags
    \target filetags-bundle

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"bundle.content"}
        \li -
        \li 1.8
        \li Attached to the output artifacts of the rule that produces the
            bundle.
    \row
        \li \c{"infoplist"}
        \li \c{Info.plist}, \c{*-Info.plist}
        \li 1.5
        \li Source files with this tag are Info property lists files or fragments that are merged
            into the bundle's final \c Info.plist.
    \row
        \li \c{"bundle.input.public_hpp"}
        \li n/a
        \li 3.0
        \li Source files with this tag will be copied to the \c{Headers} directory within a bundle.
    \row
        \li \c{"bundle.input.private_hpp"}
        \li n/a
        \li 3.0
        \li Source files with this tag will be copied to the \c{PrivateHeaders} directory within
            a bundle.
    \row
        \li \c{"bundle.input.resources"}
        \li n/a
        \li 3.0
        \li Source files with this tag will be copied to the \c{Resources} directory within
            a bundle.
    \endtable

    \section2 Main bundles

    It is possible to create a bundle that contains other products within itself. This is useful
    for big applications which depend on custom frameworks and/or other applications.

    Creating a main bundle is quite easy, simply set the \l{isMainBundle} property to \c true
    and all dependencies will be copied automatically to appropriate locations:
    \code
    CppApplication {
        name: "main"
        files: "main.cpp"
        Depends { name: "mylib" }
        Depends { name: "bundle" }
        bundle.isMainBundle: true
    }
    DynamicLibrary {
        name: "mylib"
        Depends { name: "cpp" }
        files: "mylib.cpp"
        install: false // skip installing the framework
    }
    \endcode

    In order to exclude a dependency from the main bundle, set the \l{bundle::isForMainBundle}
    property to \c false in the product:
    \code
    DynamicLibrary {
        name: "otherlib"
        Depends { name: "bundle" }
        bundle.isForMainBundle: false
    }
    \endcode
    Alternatively, set the \c{bundle.isForMainBundle} dependency parameter in the main bundle
    itself:
    \code
    CppApplication {
        name: "main"
        Depends { name: "otherlib"; bundle.isForMainBundle: false }
        // ...
    }
    \endcode
    See the full example the the
    \l{https://github.com/qbs/qbs/tree/master/examples/main-bundle}{examples} folder.

    \note Currently, static frameworks and libraries are not supported as an input to a main bundle.
*/

/*!
    \qmlproperty bool bundle::isBundle

    Whether the product should actually be packaged as a bundle as opposed to a
    flat file. This allows a product indirectly dependent on the \c{bundle}
    module to retain control of whether it should actually be built as a bundle.

    \defaultvalue \c{true} for applications and dynamic libraries on Apple
    platforms, \c{false} otherwise.
*/

/*!
    \qmlproperty bool bundle::isForMainBundle
    \since Qbs 3.1

    Set this property to \c false to skip copying of this product into any dependent main bundle.

    \defaultvalue \c true.
    \sa isMainBundle
*/

/*!
    \qmlproperty bool bundle::isMainBundle
    \since Qbs 3.1

    Whether to copy dependencies into this bundle.

    \defaultvalue \c false
    \sa isForMainBundle
*/

/*!
    \qmlproperty bool bundle::isShallow
    \readonly

    Whether the bundle directory tree is \e shallow. That is, whether it lacks a
    \c Contents subdirectory. This is the default on all platforms other than
    macOS.

    \defaultvalue \c{false} on macOS, otherwise \c{true}.
*/

/*!
    \qmlproperty string bundle::identifierPrefix

    A prefix for the product's bundle identifier. If \l{bundle::}{identifier}
    is left unset, the bundle identifier will be a concatenation of this value
    and the \l{Product::targetName}{Product.targetName} property formatted as
    an RFC-1034 identifier, separated by a period (.). This corresponds to the
    organization identifier in Xcode.

    \defaultvalue \c{org.example}
*/

/*!
    \qmlproperty string bundle::identifier

    The bundle's identifier. If left unset, the bundle identifier will be a
    concatenation of the \l{bundle::}{identifierPrefix} value and the
    \l{Product::targetName}{Product.targetName} propertyy formatted as an
    RFC-1034 identifier, separated by a period (.).

    \defaultvalue A combination of \l{bundle::}{identifierPrefix} and the
    product's target name formatted as an RFC-1034 identifier.
*/

/*!
    \qmlproperty string bundle::extension

    The extension of the bundle's wrapper directory, without the leading period
    (.).

    This property should not normally need to be set unless creating a custom
    bundle type.

    \defaultvalue \c{"app"} for \c{"APPL"} packages, \c{"framework"} for
    \c{"FMWK"} packages, and \c{"bundle"} for \c{"BNDL"} and custom packages.
*/

/*!
    \qmlproperty string bundle::packageType

    The four-letter file type code of the bundle, specified in the bundle's
    \c PkgInfo file and in the bundle's \c Info.plist as the value for the
    \c CFBundlePackageType key.

    This property should almost never need to be changed, even though specifying
    an alternative package type for custom bundles is allowed.

    \defaultvalue \c{"APPL"} for applications, \c{"FMWK"} for frameworks, and
    \c{"BNDL"} for custom bundles.
*/

/*!
    \qmlproperty bool bundle::generatePackageInfo
    \since Qbs 1.5

    Whether to generate a \c PkgInfo file for the bundle.

    This property should almost never need to be changed, even though enabling
    it when specifying an alternative package type for custom bundles using
    \l{bundle::}{packageType} is allowed.

    \defaultvalue \c{true} for applications, otherwise \c{false}.
*/

/*!
    \qmlproperty string bundle::signature

    The four-letter signature specific to the bundle, also known as the creator
    code, specified in the bundle's \c PkgInfo file and in the bundle's
    \c Info.plist as the value for the \c CFBundleSignature key.

    This property should normally never need to be set.

    \defaultvalue \c{"????"}
*/

/*!
    \qmlproperty string bundle::bundleName

    The file name of the bundle's wrapper directory.

    This property should not normally need to be changed.

    \defaultvalue A combination of the product's \l{Product::}{targetName} and
    bundle's \l{bundle::}{extension}.
*/

/*!
    \qmlproperty string bundle::frameworkVersion

    For framework bundles, the version of the framework. Not used for other
    package types.

    \defaultvalue \c{"A"}
*/

/*!
    \qmlproperty pathList bundle::publicHeaders

    A list of public header files to copy to a framework bundle's \c Headers
    subdirectory.

    It is recommended to attach the \c{"bundle.input.public_hpp"} file tag to headers instead:
    \code
    CppApplication {
        Depends { name: "bundle" }
        files: "main.cpp"
        Group {
            name: "public headers"
            files: ["header.h"]
            fileTags: ["bundle.input.public_hpp", "hpp"]
        }
    }
    \endcode
    \note Since \l{Group::fileTags}{Group.fileTags} property replaces file tags attached by
    the \l{FileTagger} item, the \c{"hpp"} tag should also be present.

    \nodefaultvalue
*/

/*!
    \qmlproperty pathList bundle::privateHeaders

    A list of private header files to copy to a framework bundle's
    \c PrivateHeaders subdirectory

    It is recommended to attach the \c{"bundle.input.private_hpp"} file tag to headers instead:
    \code
    CppApplication {
        Depends { name: "bundle" }
        files: "main.cpp"
        Group {
            name: "private headers"
            files: ["header.h"]
            fileTags: ["bundle.input.private_hpp", "hpp"]
        }
    }
    \endcode
    \note Since \l{Group::fileTags}{Group.fileTags} property replaces file tags attached by
    the \l{FileTagger} item, the \c{"hpp"} tag should also be present.

    \nodefaultvalue
*/

/*!
    \qmlproperty pathList bundle::resources

    A list of resources to copy to a bundle's \c Resources subdirectory. Files
    will automatically be copied into \c lproj subdirectories corresponding to
    the input files' paths.

    It is recommended to attach the \c{"bundle.input.resources"} file tag to resources instead:
    \code
    CppApplication {
        Depends { name: "bundle" }
        files: "main.cpp"
        Group {
            name: "resources"
            files: ["file.txt"]
            fileTags: ["bundle.input.resources"]
        }
    }
    \endcode

    \nodefaultvalue
*/

/*!
    \qmlproperty var bundle::infoPlist

    A dictionary of key-value pairs to add to the bundle's \c Info.plist.

    The contents of this property will be aggregated with the values from any
    \c plist files. If this property and any \c plist files contain the same
    key, this property will take precedence. However, it might be overridden
    during postprocessing (see \l{bundle::}{processInfoPlist}).

    If \c undefined, will not be taken into account.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool bundle::processInfoPlist

    Whether to perform post-processing on the aggregated \c Info.plist contents.

    If this property is \c{true}, various post-processing operations will be
    applied to the bundle's property list dictionary after it has been
    aggregated from the contents of any \c plist files on disk, and the
    \l{bundle::}{infoPlist} property.

    First, values from a list of defaults will be added to the dictionary if
    they were not already present. Second, values from the \c AdditionalInfo key
    of the platform SDK's \c Info.plist file will be added to the dictionary if
    they were not already present, as well as some other miscellaneous keys,
    such as \c BuildMachineOSBuild and \c UIDeviceFamily (on iOS). Finally,
    variable expansions will be performed such that substrings of the form
    \c $(VAR) or \c ${VAR} will be replaced with their corresponding environment
    variables.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty bool bundle::embedInfoPlist

    Whether to create a \c{__TEXT} section in the product's executable
    containing the processed \c Info.plist.

    Only applies to command line applications.

    \defaultvalue \c{true} if the product is a command line tool, otherwise
    \c{false}.
*/

/*!
    \qmlproperty string bundle::infoPlistFormat

    The file format to write the product's resulting \c Info.plist in.

    Possible values are:

    \list
        \li \c{"binary1"}
        \li \c{"json"}
        \li \c{"same-as-input"}
        \li \c{"xml1"}
    \endlist

    \defaultvalue \c{"binary1"} for iOS, \c{"same-as-input"} or \c{"xml1"}
    for macOS depending on whether a \c plist file is used, and \c{undefined}
    for all other operating systems.
*/

/*!
    \qmlproperty string bundle::infoPlistPath
    \readonly

    The path that the \c Info.plist file will be written to.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::infoStringsPath
    \readonly
    \since Qbs 1.5

    The path that the \c InfoPlist.strings file will be written to.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::pkgInfoPath
    \readonly

    The path that the \c PkgInfo file will be written to.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::versionPlistPath
    \readonly

    The path that the \c version.plist file will be written to.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::executablePath
    \readonly

    The path that the main executable file will be written to.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::contentsFolderPath
    \readonly

    The path of the bundle's \c Contents subdirectory.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::applicationsFolderPath
    \readonly

    The path of the directory where dependent applications will be copied.

    This property applies only if \l{isMainBundle} is \c true.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::documentationFolderPath
    \readonly
    \since Qbs 1.5

    The path of the directory where documentation will be written.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::executableFolderPath
    \readonly

    The path of the directory where the main exectuable will be written.

    The path is relative to the directory that contains the bundle.

    Not to be confused with \l{bundle::}{executablesFolderPath}.
*/

/*!
    \qmlproperty string bundle::executablesFolderPath
    \readonly

    The path of the directory where auxiliary executables will be copied.

    The path is relative to the directory that contains the bundle.

    Not to be confused with \l{bundle::}{executableFolderPath}.
*/

/*!
    \qmlproperty string bundle::frameworksFolderPath
    \readonly

    The path of the directory where internal frameworks will be copied.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::javaFolderPath
    \readonly
    \since Qbs 1.5

    The path of the directory where Java content will be written.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::localizedResourcesFolderPath
    \readonly
    \since Qbs 1.5

    The path of the directory where localized resource files will be copied.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::pluginsFolderPath
    \readonly

    The path of the directory where plugins will be copied.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::privateHeadersFolderPath
    \readonly

    The path of the directory where private header files will be copied.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::publicHeadersFolderPath
    \readonly

    The path of the directory where public headers files will be copied.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::scriptsFolderPath
    \readonly

    The path of the directory where script files will be copied.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::sharedFrameworksFolderPath
    \readonly

    The path of the directory where shared frameworks will be copied.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::sharedSupportFolderPath
    \readonly

    The path of the directory where shared support files will be copied.

    The path is relative to the directory that contains the bundle.
*/

/*!
    \qmlproperty string bundle::unlocalizedResourcesFolderPath
    \readonly

    The path of the directory where non-localized resource files will be copied.

    The path is relative to the directory that contains the bundle.

    This is the same as the base resources path.
*/

/*!
    \qmlproperty bool bundle::useBuiltinXcodeBuildSpecs

    Set this property to \c true to use Xcode \c .xcspec files shipped with \QBS.

    This property can be used as a workaround when using a new Xcode version that is not supported
    by \QBS yet.

    \default false
*/

/*!
    \qmlproperty string bundle::versionsFolderPath
    \readonly
    \since Qbs 1.5

    The path of the bundle's \c Versions subdirectory.

    The path is relative to the directory that contains the bundle.

    This is only relevant for (non-shallow) framework bundles.
*/
qbs-src-3.2.0/doc/reference/modules/flatbuf-c-module.qdoc0000644000175100017510000000476515154533055022667 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype flatbuf.c
    \inqmlmodule QbsModules
    \since Qbs 2.4

    \brief Provides support for \l{https://google.github.io/flatbuffers/}{FlatBuffers} for the
    C language.

    The \c flatbuf.c module provides support for generating C headers
    and sources from flatbuffers definition files using the \c flatcc tool.

    \section2 Relevant File Tags

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"flatbuffers.input"}
        \li \c{*.fbs}
        \li 2.4.0
        \li Source files with this tag are considered inputs to the \c flatcc compiler.
    \endtable

    \section2 Dependencies
    This module depends on the \c flatcc module which can be created via the \l{conan}{Conan}
    module provider.
*/

/*!
    \qmlproperty string flatbuf.c::compilerName

    The name of the \c flatcc binary.

    \defaultvalue \c "flatcc"
*/

/*!
    \qmlproperty string flatbuf.c::compilerPath

    The path to the \c flatcc binary.

    Use this property to override the auto-detected location.

    \defaultvalue \c auto-detected
*/

/*!
    \qmlproperty pathList flatbuf.c::importPaths

    The list of import paths that are passed to the \c flatcc tool via the \c -I option.

    \defaultvalue \c []
*/
qbs-src-3.2.0/doc/reference/modules/qt-android_support-module.qdoc0000644000175100017510000000562115154533055024652 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Qt.android_support
    \inqmlmodule QbsModules
    \brief Provides Qt support for the Android platform.

    The \c Qt.android_support module provides the glue for \QBS'
    Qt and Android support.
    It is automatically pulled in by \c Qt.core, so you do not need to
    add an explicit dependency to it in your product, unless you want
    to set one of its properties.
*/

/*!
    \qmlproperty string Qt.android_support::qmlRootDir

    The root directory of the product's QML files. This information is passed to
    the \c androiddeployqt tool, which will use it to decide which resources to
    include in the APK file.

    \defaultvalue \c product.sourceDirectory
*/

/*!
    \qmlproperty stringList Qt.android_support::deploymentDependencies

    Use this property to completely override the Qt deployment dependencies
    of your app. Corresponds to qmake's ANDROID_DEPLOYMENT_DEPENDENCIES.

    \defaultvalue \c undefined
*/

/*!
    \qmlproperty stringList Qt.android_support::extraPlugins

    Additional non-asset files to be packaged. Corresponds to qmake's ANDROID_EXTRA_PLUGINS.

    \defaultvalue \c undefined
*/

/*!
    \qmlproperty stringList Qt.android_support::extraLibs

    Additional libs to be packaged and loaded on start-up (mind the order).
    Corresponds to qmake's ANDROID_EXTRA_LIBS.

    \defaultvalue \c undefined
*/

/*!
    \qmlproperty stringList Qt.android_support::qmlImportPaths

    Additional directories to search for QML imports.

    \defaultvalue \c undefined
    \since 1.22
*/

/*!
    \qmlproperty bool Qt.android_support::verboseAndroidDeployQt

    Enable this property if you want verbose output from the
    \c androiddeployqt tool.

    \defaultvalue \c false
*/
qbs-src-3.2.0/doc/reference/modules/android-ndk-module.qdoc0000644000175100017510000000664315154533055023213 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Android.ndk
    \inqmlmodule QbsModules
    \since Qbs 1.4

    \brief Provides support for building native Android libraries.

    The \c Android.ndk module contains the properties and rules to create native libraries
    for use in Android applications.

    Normally, you will not use this module directly, but instead work
    with the \l{DynamicLibrary}, \l{StaticLibrary} and \l Application items
    that \QBS provides.

    Here is what the project file for the \c hello-jni example that comes with
    the NDK could look like:

    \code
        CppApplication {
            name: "HelloJni"
            Android.sdk.packageName: "com.example.hellojni"
            qbs.architectures: ["arm", "x86"]
            files: "app/src/main/jni/hello-jni.c"
        }
    \endcode

    \section2 Relevant File Tags
    \target filetags-android-ndk

    \table
    \header
        \li Tag
        \li Since
        \li Description
    \row
        \li \c{"android.nativelibrary"}
        \li 1.4.0
        \li Attached to dynamic libraries that will end up in APK packages.
            You do not normally need to use the tag explicitly, as it is the
            default type of the \l{DynamicLibrary} item for Android targets.
    \endtable
*/

/*!
    \qmlproperty string Android.ndk::abi

    The ABI name as it appears under \c "lib/" in the application package.
    Corresponds to \c APP_ABI in \c Android.mk.

    \nodefaultvalue
*/

/*!
    \qmlproperty string Android.ndk::buildId

    Value to pass to the --build-id linker flag.
    Plain --build-id option is used when buildId property is empty.

    \since Qbs 1.21

    \defaultvalue \c "sha1"
*/

/*!
    \qmlproperty string Android.ndk::appStl

    The library to use for C++. The possible values are:

    \list
        \li \c "c++_shared"
        \li \c "c++_static"
    \endlist

    \defaultvalue \c{"c++_shared"}
*/

/*!
    \qmlproperty path Android.ndk::ndkDir

    The NDK base directory.

    \nodefaultvalue
*/

/*!
    \qmlproperty string Android.ndk::platform

    The versioned platform name.

    \defaultvalue \c{"android-16"} for 32 bit arm ABIs
    and \c{"android-21"} for all 64 bit ABIs and x86.
    x86 ABI has broken wstring support in android-16 to android-19.
*/
qbs-src-3.2.0/doc/reference/modules/qt-quick-module.qdoc0000644000175100017510000000545015154533055022552 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Qt.quick
    \inqmlmodule QbsModules
    \brief Provides Qt Quick 2 support.

    The Qt.quick module provides support for Qt Quick 2.

    \sa Qt.qml, Qt.declarative

    \section2 Relevant File Tags
    \target filetags-quick

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"qt.quick.qrc"}
        \li \c{*.qrc}
        \li 1.10
        \li Qt resource files with this file tag will be picked up by the
            Qt Quick compiler rule, and all QML files in the resource will be
            compiled.

            This file tag will only be added automatically if the Qt Quick
            compiler is available.
    \endtable
*/

/*!
    \qmlproperty bool Qt.quick::compilerAvailable

    Whether the Qt installation contains the Qt Quick compiler.

    \defaultvalue auto-detected
    \since 1.10
*/

/*!
    \qmlproperty bool Qt.quick::useCompiler

    Whether to make use of the Qt Quick compiler.

    \defaultvalue \l compilerAvailable
    \since 1.11
*/

/*!
    \qmlproperty bool Qt.quick::qmlDebugging

    Whether QML debugging support should be compiled into your binaries.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty string Qt.quick::qmlImportsPath

    The absolute path to the directory where Qt's QML imports are installed.

    \defaultvalue Determined by \l{setup-qt}.
*/

/*!
    \qmlproperty string Qt.quick::qmlPath

    The absolute path to the directory where Qt's QML files are installed.

    This property is left undefined for Qt 4.

    \defaultvalue Determined by \l{setup-qt}.
*/
qbs-src-3.2.0/doc/reference/modules/cpp-module.qdoc0000644000175100017510000015437115154533055021605 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype cpp
    \inqmlmodule QbsModules
    \since Qbs 1.0

    \brief Provides C/C++ support.

    The \c cpp module contains the properties and rules for toolchains of the C/C++ family.
    On Apple platforms, this includes support for Objective-C/C++.

    \section2 Setting Up the Run Environment

    When running an application that has dependencies on dynamic libraries, the
    script specified by \l{Module::setupRunEnvironment}{Module.setupRunEnvironment}
    automatically adds the locations of the libraries to the environment.
    That is, to \c PATH on Windows, \c DYLD_LIBRARY_PATH on macOS,
    and \c LD_LIBRARY_PATH on Linux and other Unix platforms. If the value
    \c{"ignore-lib-dependencies"} shows up in the \c config array, this behavior
    is disabled. Users can set the value via the \l run command.

    \target dependency-parameters-cpp
    \section2 Dependency Parameters

    \table
    \header
        \li Parameter
        \li Type
        \li Since
        \li Default
        \li Description
    \row
        \li \c{link}
        \li \c{bool}
        \li 1.9
        \li undefined
        \li If \c{false}, the dependency will not be linked, even if
            it is a valid input for a linker rule. This property
            affects library dependencies only.
    \row
        \li \c{linkWholeArchive}
        \li \c{bool}
        \li 1.9
        \li undefined
        \li If \c{true}, then if the dependency is a static library, all of its objects
            will be pulled into target binary, even if their symbols do not appear to be used.
            This parameter is mainly useful when creating a dynamic library from static libraries.
    \row
        \li \c{symbolLinkMode}
        \li \c{string}
        \li 1.9
        \li undefined
        \li Attribute specifying how the library or framework will be linked.
            May contain the values: "weak", "lazy", "reexport", and "upward"; refer to the Apple
            ld64 man page for full details. \c{undefined} uses normal linking.
            Currently only applies when linking for Apple platforms.
            Note that \c "lazy" mode is deprecated and doesn't work with Xcode 15 and above.
    \endtable

    \section2 Relevant File Tags
    \target filetags-cpp

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"application"}
        \li n/a
        \li 1.0.1
        \li The rule that creates executable files (typically via a linker) attaches this tag
            to its output artifact.
    \row
        \li \c{"asm"}
        \li \c{*.s} (for GCC-like toolchains), \c{*.asm} (for MSVC)
        \li 1.1.0
        \li Source files with this tag serve as inputs to a rule invoking the toolchain's
            assembler. One object file is generated for each such file.
    \row
        \li \c{"asm_cpp"}
        \li \c{*.S}, \c{*.sx}
        \li 1.1.0
        \li Like \c{"asm"}, but for source files that need preprocessing. This tag only has an
            effect with GCC-like toolchains.
    \row
        \li \c{"c"}
        \li \c{*.c} (if \c combineCSources is not enabled)
        \li 1.0.1
        \li Source files with this tag serve as inputs to a rule invoking the toolchain's
            C compiler. One object file is generated for each such file.
    \row
        \li \c{"c.combine"}
        \li \c{*.c} (if \c combineCSources is enabled)
        \li 1.8
        \li Source files with this tag serve as inputs to a rule combining them into
            a single C file, which will then be compiled.
    \row
        \li \c{"cpp"}
        \li \c{*.C}, \c{*.cpp}, \c{*.cxx}, \c{*.c++}, \c{*.cc}
            (if \c combineCxxSources is not enabled)
        \li 1.0.1
        \li Source files with this tag serve as inputs to a rule invoking the toolchain's
            C++ compiler. One object file is generated for each such file.
    \row
        \li \c{"cpp.combine"}
        \li \c{*.C}, \c{*.cpp}, \c{*.cxx}, \c{*.c++}, \c{*.cc}
            (if \c combineCxxSources is enabled)
        \li 1.8
        \li Source files with this tag serve as inputs to a rule combining them into
            a single C++ file, which will then be compiled.
    \row
        \li \c{"c_pch_src"}, \c{"cpp_pch_src"}, \c{"objc_pch_src"}, \c{"objcpp_pch_src"}
        \li -
        \li 1.5
        \li Files with this tag will be turned into precompiled headers for C, C++, Objective-C
            and Objective-C++, respectively. There can be only one such file per product and
            language.
    \row
        \li \c{"def"}
        \li -
        \li 1.17.0
        \li This tag is used for a module-definition file (.def) to be passed to the linker.
            Such a file provides the linker with information about exports, attributes,
            and other information about the program to be linked. This file tag only has
            an effect with the MSVC toolchain.
    \row
        \li \c{"dynamiclibrary"}
        \li n/a
        \li 1.0.1
        \li The rule that creates dynamic libraries (typically via a linker) attaches this tag
            to its output artifact.
    \row
        \li \c{"dynamiclibrary_import"}
        \li n/a
        \li 1.0.0
        \li This tag is used for import libraries of dynamic libraries.  For
            example, the MSVC linker rule creates a \c{dynamiclibrary_import}
            artifact \c{foo.lib} in addition to a \c{dynamiclibrary} artifact
            \c{foo.dll}.
    \row
        \li \c{"hpp"}
        \li \c{*.h}, \c{*.H}, \c{*.hpp}, \c{*.hxx}, \c{*.h++}
        \li 1.0.1
        \li This tag is used for header files (C, C++, Objective-C and Objective-C++). No rule
            in this module generates output artifacts from such files directly, but the compiler
            rule will have a dependency on all rules that create such files.
    \row
        \li \c{"linkerscript"}
        \li -
        \li 1.5.0
        \li This tag is used for \c ld linker scripts. You can provide such a file if you need
            to replace the default linker script.
            This file tag only has an effect with GCC-like toolchains. The linker needs to be
            \c{ld}-compatible.
    \row
        \li \c{"native.pe.manifest"}
        \li *.manifest
        \li 1.8.0
        \li This tag is automatically assigned to Microsoft manifest files. Manifests are embedded
            into the resulting binary.
    \row
        \li \c{"obj"}
        \li n/a
        \li 1.0.1
        \li The rule that creates object files (typically via a compiler) attaches this tag
            to its output artifacts. Such files are usually intermediate artifacts of the build
            process and rarely need to be referenced in project files.
    \row
        \li \c{"objc"}
        \li \c{*.m} (if \c combineObjcSources is not enabled)
        \li 1.1.0
        \li Source files with this tag serve as inputs to a rule invoking the toolchain's
            Objective-C compiler. One object file is generated for each such file.
    \row
        \li \c{"objc.combine"}
        \li \c{*.m} (if \c combineObjcSources is enabled)
        \li 1.8
        \li Source files with this tag serve as inputs to a rule combining them into
            a single Objective-C file, which will then be compiled.
    \row
        \li \c{"objcpp"}
        \li \c{*.mm} (if \c combineObjcxxSources is not enabled)
        \li 1.1.0
        \li Source files with this tag serve as inputs to a rule invoking the toolchain's
            Objective-C++ compiler. One object file is generated for each such file.
    \row
        \li \c{"objcpp.combine"}
        \li \c{*.mm} (if \c combineObjcxxSources is enabled)
        \li 1.8
        \li Source files with this tag serve as inputs to a rule combining them into
            a single Objective-C++ file, which will then be compiled.
    \row
        \li \c{"rc"}
        \li \c{*.rc}
        \li 1.1.0
        \li Files with this tag serve as inputs to the Windows resource compiler. One object file
            is generated for each such file. The tag has no effect on target platforms other than
            Windows.
    \row
        \li \c{"staticlibrary"}
        \li n/a
        \li 1.0.1
        \li The rule that creates static libraries (typically via a linker) attaches this tag
            to its output artifact.
    \row
        \li \c{"objectlibrary"}
        \li n/a
        \li 3.2.0
        \li The \l ObjectLibrary item attaches this tag to its \c "obj" artifacts.
    \row
        \li \c{"versionscript"}
        \li -
        \li 1.5.0
        \li This tag is used for \c ld linker scripts. You can provide such a file if you need
            fine-grained control over the symbols present in a shared library.
            This file tag only has an effect with GCC-like toolchains. The linker needs to be
            \c{ld}-compatible.
    \endtable

    \section2 Relevant Job Pools
    \target cpp-job-pools

    \table
    \header
        \li Pool
        \li Since
        \li Description
    \row
        \li \c{"assembler"}
        \li 1.13
        \li The job pool used by rules that run the toolchain's assembler. This is only
            relevant for direct invocations of the assembler binary, not for running it
            indirectly via the compiler.
    \row
        \li \c{"compiler"}
        \li 1.13
        \li The job pool used by rules that run a compiler. All language variants use
            the same pool.
    \row
        \li \c{"linker"}
        \li 1.13
        \li The job pool used by rules that run a linker.
    \endtable
*/

/*!
    \qmlproperty bool cpp::allowUnresolvedSymbols
    \since Qbs 1.2

    Set to \c true if you want the linking step to succeed even if the resulting
    binary contains unresolved symbols. Normally, this makes little sense, but
    in special cases it is possible that the respective symbols will be
    available at load time even if they are not present during linking.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::architecture

    The target architecture.

    \defaultvalue \l{qbs::architecture}{qbs.architecture}
*/

/*!
    \qmlproperty string cpp::endianness
    \since Qbs 1.9

    Specifies the endianness of the target platform's processor architecture
    (\c{"big"} or \c{"little"}).

    The value is automatically detected from the compiler's default values, but
    can also be manually set in order to select a specific endianness when
    targeting bi-endian architectures like MIPS and PowerPC.

    \defaultvalue Compiler default value.
*/

/*!
    \qmlproperty bool cpp::debugInformation

    Whether to generate debug information.

    \defaultvalue \l{qbs::debugInformation}{qbs.debugInformation}
*/

/*!
    \qmlproperty bool cpp::combineCSources
    \since Qbs 1.8

    Enabling this property on a \l{Product}{product} instructs the
    \l{FileTagger}{file tagger} to attach the tag \c{"c.combine"} to C sources,
    rather than \c{"c"}. As a result, all C sources of the product will be
    combined into a single file, which is then compiled.

    This can speed up initial compilation significantly, but is of course
    detrimental in the context of incremental builds. Also, perfectly legal code
    may fail to compile with this option due to the merging of translation
    units.

    To enable this property in a product that has sources that cannot be merged,
    put the sources into a dedicated \l{Group} and set their \l{Group::}
    {fileTags} property to \c{"c"}, overriding the file tagger.

    \note Module properties set on specific source files (that is, at the Group
    level) will not be taken into account when building the combined file. You
    either need to set these properties at the product level or prevent the
    respective files from getting combined via the mechanism described above.

    \defaultvalue \c false
*/

/*!
    \qmlproperty bool cpp::combineCxxSources
    \since Qbs 1.8

    Like \l{cpp::}{combineCSources}, but for C++. The \l{filetags-cpp}
    {relevant file tags} are \c{"cpp"} and \c{"cpp.combine"}.

    \defaultvalue \c false

    \sa combineCSources
*/

/*!
    \qmlproperty bool cpp::combineObjcSources
    \since Qbs 1.8

    Like \l{cpp::}{combineCSources}, but for Objective-C. The \l{filetags-cpp}
    {relevant file tags} are \c{"objc"} and \c{"objc.combine"}.

    \defaultvalue \c false

    \sa combineCSources
*/

/*!
    \qmlproperty bool cpp::combineObjcxxSources
    \since Qbs 1.8

    Like \l{cpp::}{combineCSources}, but for Objective-C++. The \l{filetags-cpp}
    {relevant file tags} are \c{"objcpp"} and \c{"objcpp.combine"}.

    \defaultvalue \c false

    \sa combineCSources
*/

/*!
    \qmlproperty bool cpp::createSymlinks
    \unixproperty

    Whether to create version alias symlinks when building a dynamic library.

    \defaultvalue \c true
*/

/*!
    \qmlproperty bool cpp::discardUnusedData
    \since Qbs 1.10

    If this property is \c true, the linker will discard data from objects that
    it determines to be unused. With MSVC and on Apple platforms, the
    granularity is per symbol, elsewhere it is per section.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpp::separateDebugInformation
    \since Qbs 1.4

    Whether to store debug information in an external file or bundle instead of
    within the binary.

    The type of files that will be generated when this property is \c{true} is
    dependent on the compiler and target platform:

    \list
        \li With MSVC, this property controls the generation of
            \c{.pdb} (Program Debug Database) files.
        \li On Apple platforms with GCC or Clang, this property controls the
            generation of \c{.dSYM} (DWARF Symbol) bundles or, if
            \l{cpp::}{dsymutilFlags} contains the \c{-f} or \c{--flat} flags,
            \c{.dwarf} symbol files.
        \li On other platforms with GCC or Clang (including Windows/MinGW), this
            property controls the generation of \c{.debug} symbol files.
    \endlist

    \defaultvalue \c{true} for MSVC and with GCC or Clang on Apple platforms,
    otherwise \c{false}.

    \sa debugInformation, {How do I separate and install debugging symbols?}
*/

/*!
    \qmlproperty stringList cpp::defines

    A list of preprocessor macros that gets passed to the compiler.

    To set macro values, use the following syntax:

    \code
    cpp.defines: ["USE_COLORS=1", 'COLOR_STR="blanched almond"']
    \endcode

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::platformDefines

    A list of preprocessor macros that are used for all projects that are built
    for the current target platform. User project files usually do not set this
    property.

    \nodefaultvalue
*/

/*!
    \qmlproperty pathList cpp::includePaths

    A list of include paths.

    Relative paths are considered to be relative to the \c .qbs product file
    they are used in.

    \nodefaultvalue
*/

/*!
    \qmlproperty pathList cpp::systemIncludePaths

    A list of include paths that are passed as system include paths to the
    compiler.

    For header files in those paths, warnings will be ignored.

    Relative paths are considered to be relative to the \c .qbs product file
    they are used in.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::systemRunPaths
    \since Qbs 1.6

    The paths the dynamic linker uses on process start-up to locate dynamic
    libraries.

    \defaultvalue Auto-detected for host builds on Linux via \c ldconfig,
    \c{["/lib", "/usr/lib"]} otherwise on Unix, \c [] on Windows.
*/

/*!
    \qmlproperty pathList cpp::libraryPaths

    A list of library search paths.

    The paths will be passed to the linker in the appropriate way. For
    example, the \c {-L} argument will be used when using \c {ld}-like
    linkers.

    Relative paths are considered to be relative to the \c .qbs product file
    they are used in.

    \nodefaultvalue

    \sa dynamicLibraries, {How do I create a module for a third-party library?}
*/

/*!
    \qmlproperty stringList cpp::dynamicLibraries

    A List of dynamic libraries to be linked.

    If the library is part of your project, consider using a \l{Depends} item
    instead.

    Each library can be specified in one of two ways:

    \list
    \li An absolute file path (for example, \c "/foo/bar.lib"), in which case
        it is passed directly to the linker, ignoring \l libraryPaths.
    \li A library basename (for example, \c "bar"), in which case
        the directory that contains the library must be provided via
        \l libraryPaths.
    \endlist

    Relative paths (\c "foo/bar.lib") are not allowed.

    \nodefaultvalue

    \sa libraryPaths, {How do I create a module for a third-party library?}
*/

/*!
    \qmlproperty stringList cpp::staticLibraries

    A list of static libraries to be linked.

    If the library is part of your project, consider using a \l{Depends} item
    instead.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::executablePrefix

    A string to prepend to the executable file \l{Product::targetName}{name}.

    \defaultvalue \c ""
*/

/*!
    \qmlproperty string cpp::dynamicLibraryPrefix

    A string to prepend to the dynamic library file \l{Product::targetName}{name}.

    \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical values are \c "" or \c "lib"
*/

/*!
    \qmlproperty string cpp::loadableModulePrefix
    \appleproperty

    A string to prepend to the Darwin loadable module file \l{Product::targetName}{name}.

    \defaultvalue \c ""
*/

/*!
    \qmlproperty string cpp::staticLibraryPrefix

    A string to prepend to the static library file \l{Product::targetName}{name}.

    \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical values are \c "" or \c "lib"
*/

/*!
    \qmlproperty string cpp::executableSuffix

    A string to append to the executable file \l{Product::targetName}{name}.

    \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical values are \c "" or \c ".exe"
*/

/*!
    \qmlproperty string cpp::dynamicLibrarySuffix

    A string to append to the dynamic library file \l{Product::targetName}{name}.

    \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical values are \c ".so", \c ".dll"
    or \c "dylib"
*/

/*!
    \qmlproperty string cpp::dynamicLibraryImportSuffix
    \windowsproperty

    A string to append to the dynamic library import file \l{Product::targetName}{name}.

    \defaultvalue \c ".lib"
*/

/*!
    \qmlproperty string cpp::loadableModuleSuffix
    \appleproperty

    A string to append to the Darwin loadable module file \l{Product::targetName}{name}.

    \defaultvalue \c ".bundle"
*/

/*!
    \qmlproperty string cpp::staticLibrarySuffix

    A string to append to the executable file \l{Product::targetName}{name}.

    \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical values are \c ".a" or \c ".lib"
*/

/*!
    \qmlproperty string cpp::debugInfoSuffix

    A string to append to the debug information file name.

    \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical values are \c ".debug",
    \c ".pdb" or \c ".dwarf"
*/

/*!
    \qmlproperty string cpp::debugInfoBundleSuffix
    \appleproperty

    A string to append to the debug information bundle name.

    \defaultvalue \c ".dSYM"
*/

/*!
    \qmlproperty string cpp::objectSuffix

    A string to append to the generated object files.

    \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical values are \c ".o" or \c ".obj"
*/

/*!
    \qmlproperty string cpp::linkerMapSuffix

    A string to append to the generated linker memory map files.

    \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical value is \c ".map"
*/

/*!
    \qmlproperty string cpp::compilerListingSuffix

    A string to append to the generated compiler listing files.

    \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical value is \c ".lst"
*/

/*!
    \qmlproperty string cpp::assemblerListingSuffix

    A string to append to the generated assembler listing files.

    \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical value is \c ".lst"
*/

/*!
    \qmlproperty pathList cpp::prefixHeaders
    \since Qbs 1.0.1

    A list of files to automatically include at the beginning of each source
    file in the \l{Product}{product}.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::optimization

    The optimization level.

    \defaultvalue \l{qbs::optimization}{qbs.optimization}
*/

/*!
    \qmlproperty bool cpp::treatWarningsAsErrors

    Whether warnings will be handled as errors and cause the build to fail.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty bool cpp::useCPrecompiledHeader
    \since Qbs 1.5

    Whether to use a precompiled header for compiling C sources if one is
    present.

    Set this property to \c false in a \l Group item to disable precompiled
    headers for some sources even though a precompiled header is present in the
    product.

    See \l{filetags-cpp}{Relevant File Tags} for the associated file tags.

    \defaultvalue \c true
*/

/*!
    \qmlproperty bool cpp::useCxxPrecompiledHeader
    \since Qbs 1.5

    Like \l useCPrecompiledHeader, but for C++.

    \defaultvalue \c true
*/

/*!
    \qmlproperty bool cpp::useObjcPrecompiledHeader
    \since Qbs 1.5

    Like \l useCPrecompiledHeader, but for Objective-C.

    \defaultvalue \c true
*/

/*!
    \qmlproperty bool cpp::useObjcxxPrecompiledHeader
    \since Qbs 1.5

    Like \l useCPrecompiledHeader, but for Objective-C++.

    \defaultvalue \c true
*/

/*!
    \qmlproperty string cpp::warningLevel

    The warning level for the compiler: \c{"none"} or \c{"all"}.

    \defaultvalue \c{"all"}
*/

/*!
    \qmlproperty stringList cpp::driverFlags
    \since Qbs 1.6

    A list of flags that are added to all compilation and linking commands
    performed by the compiler driver, independently of the language.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::driverLinkerFlags
    \since Qbs 1.11

    A list of flags that are added to all linking commands performed by the
    compiler driver, independently of the language.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::commonCompilerFlags
    \since Qbs 1.0.1

    A list of flags that are added to all compilation commands independently of
    the language.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::compilerVersion

    Compiler version string consisting of major, minor and patch numbers,
    separated by a dot.

    \nodefaultvalue
*/

/*!
    \qmlproperty int cpp::compilerVersionMajor
    \since Qbs 1.4

    The major version of the compiler.

    \nodefaultvalue
*/

/*!
    \qmlproperty int cpp::compilerVersionMinor
    \since Qbs 1.4

    The minor version of the compiler.

    \nodefaultvalue
*/

/*!
    \qmlproperty int cpp::compilerVersionPatch
    \since Qbs 1.4

    The patch level component of the compiler version.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::assemblerFlags
    \since Qbs 1.5

    A list of additional flags for the assembler.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::cppFlags

    A list of additional flags for the C preprocessor.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::cFlags

    A list of additional flags for the C compiler.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::cxxFlags

    A list of additional flags for the C++ compiler.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::cLanguageVersion
    \since Qbs 1.4

    The version of the C standard with which the code must comply.

    If this property is set, the corresponding compiler and linker flags will be
    added, depending on the toolchain.

    If the value is left undefined, the compiler default will be used.
    If the list contains more than one value, the highest version is chosen.

    Possible values include: \c{"c89"}, \c{"c99"}, \c{"c11"}, \c{"c17"}, \c{"c2x"}.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::cxxLanguageVersion
    \since Qbs 1.4

    The version of the C++ standard with which the code must comply.

    If this property is set, the corresponding compiler and linker flags will be
    added, depending on the toolchain.

    If the value is left undefined, the compiler default will be used.
    If the list contains more than one value, the highest version is chosen.

    Possible values include: \c{"c++98"}, \c{"c++11"}, \c{"c++14"}, \c{"c++17"}, \c{"c++20"},
                             \c{"c++23"}, \c{"c++26"}.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpp::useLanguageVersionFallback
    \since Qbs 1.11

    Whether to explicitly use the language standard version fallback values in
    compiler command line invocations.

    By default, \QBS will automatically substitute fallback values for the C and
    C++ language standard versions specified by the \l cLanguageVersion and
    \l cxxLanguageVersion properties, which are passed to the \c{-std=} compiler
    command line option with GNU-compatible toolchains, if it detects that you
    are using an older toolchain which does not support the standard values. The
    substitutions are made as follows:

    \table
    \header
        \li Value
        \li Substitute
    \row
        \li c++11
        \li c++0x
    \row
        \li c11
        \li c1x
    \row
        \li c++14
        \li c++1y
    \row
        \li c++17
        \li c++1z
    \endtable

    If this property is explicitly set to \c true, \QBS will always use the
    fallback values.

    If this property is explicitly set to \c false, \QBS will never use the
    fallback values.

    This property has no effect with the Microsoft Visual C++ compiler.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::cxxStandardLibrary
    \since Qbs 1.4

    The C++ standard library to link to.

    If this property is set, the corresponding compiler and linker flags will be
    added, assuming the value is valid for the current toolchain.

    If the value is left undefined, the compiler default will be used.

    Possible values include: \c{"libstdc++"}, \c{"libc++"}.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::objcFlags

    A list of additional flags for the Objective-C compiler.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::objcxxFlags

    A list of additional flags for the Objective-C++ compiler.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::linkerFlags

    A list of additional flags for the linker.

    These flags should \e not be escaped using the \c -Wl or \c -Xlinker
    syntaxes, as \QBS will do this automatically based on the linker being used.

    \sa linkerMode

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::assemblerName
    \since Qbs 1.5

    The name of the assembler binary. This property is set in the build profile.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty string cpp::toolchainInstallPath

    The directory path where the toolchain is installed. This property is set
    in the build profile.

    This is usually the base property from which all compiler and tool paths
    are automatically derived.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty string cpp::assemblerPath
    \since Qbs 1.5

    The full path of the assembler binary. This property is set in the build
    profile.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty string cpp::compilerName

    The name of the main compiler binary. This property is set in the build profile.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty string cpp::compilerPath

    The full path of the main compiler binary. This property is set in the build profile.

    If the toolchain provides different compilers for different languages,
    \l{cpp::}{compilerPathByLanguage} is used.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty var cpp::compilerPathByLanguage
    \since Qbs 1.3

    A \c{string} to \c{string} map that maps file tags to full paths of compiler
    binaries. This property is set in the build profile.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty stringList cpp::compilerWrapper
    \since Qbs 1.1

    A wrapper binary and its arguments for wrapping compiler calls.
    This is useful for compiler wrappers, such as \c ccache.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::linkerName
    \since Qbs 1.1.1

    The name of the linker binary. This property is set in the build profile.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty string cpp::linkerPath
    \since Qbs 1.1.1

    The full path of the linker binary. This property is set in the build profile.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty stringList cpp::linkerWrapper
    \since Qbs 1.6.2

    A wrapper binary and its arguments for wrapping linker calls.
    This is useful for linker wrappers as needed by Bullseye Coverage, for
    example.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::entryPoint
    \since Qbs 1.3

    The name of the entry point of an executable or dynamic library.

    If this property is left undefined, the toolchain's default is used.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::runtimeLibrary
    \since Qbs 1.3.3

    The type of the runtime library used.

    Accepted values are \c{"static"} and \c{"dynamic"}.

    If this property is set to \c{undefined}, the default runtime library of the
    toolchain is used.

    \note This property is only functional for MSVC and MinGW.

    \defaultvalue \c{"dynamic"} for MSVC and MinGW, \c{undefined} for other compilers.
*/

/*!
    \qmlproperty bool cpp::enableExceptions
    \since Qbs 1.5

    Whether to enable exceptions in C++ code.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty bool cpp::enableSuspiciousLinkerFlagWarnings
    \since Qbs 1.8

    Whether to print warnings about escaped linker flags (such as \c -Xlinker and \c -Wl).

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty string cpp::exceptionHandlingModel
    \since Qbs 1.5

    The exception handling model to use.

    For MSVC, this can be \c{"default"}, \c{"seh"} or \c{"externc"}. For all
    other compilers, \c{"default"} indicates the default or the only exception
    handling model.

    \defaultvalue \c{"default"}
*/

/*!
    \qmlproperty bool cpp::enableRtti
    \since Qbs 1.5

    Whether to enable runtime type information in C++ code.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpp::enableReproducibleBuilds
    \since Qbs 1.5

    Whether the compiler should try to generate reproducible object files.

    Some compilers (notably GCC) use random numbers for generating symbol names
    that have to be different in every compilation unit. This is avoided by
    setting this property to \c{true}.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty bool cpp::treatSystemHeadersAsDependencies
    \since Qbs 1.8

    Whether included header files found via \l{cpp::}{systemIncludePaths},
    \l{cpp::}{distributionIncludePaths}, or \l{cpp::}{compilerIncludePaths}
    will be added to the dependencies of the respective object file.

    This means that modification of such header files (or any of the headers
    they include) will cause recompilation.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty stringList cpp::dsymutilFlags
    \since Qbs 1.4.1

    \appleproperty

    Additional flags for the \c dsymutil tool.

    \note If this property contains the \c{-f} or \c{--flat} options, this will
    cause \QBS to generate "flat" (single-file) \c{.dwarf} debug symbol files
    instead of \c{.dSYM} bundles (directories) when
    \l{cpp::}{separateDebugInformation} is set to \c{true}.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::dsymutilPath
    \since Qbs 1.4

    \appleproperty

    The full path of the \c dsymutil binary. This property is set in the build
    profile.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty string cpp::lipoPath
    \since Qbs 1.9

    \appleproperty

    The full path of the \c lipo binary.

    \defaultvalue Determined automatically.
*/

/*!
    \qmlproperty pathList cpp::frameworkPaths

    \appleproperty

    A list of framework search paths.

    Relative paths are considered to be relative to the \c .qbs product file
    they are used in.

    \nodefaultvalue
*/

/*!
    \qmlproperty pathList cpp::systemFrameworkPaths

    \appleproperty

    A list of framework search paths.

    Relative paths are considered to be relative to the \c .qbs product file
    they are used in. Header files in frameworks in those paths will not cause
    warnings.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::frameworks

    \appleproperty

    A list of frameworks to be linked.

    If the framework is part of your project, consider using a \l{Depends} item
    instead.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::weakFrameworks

    \appleproperty

    A list of frameworks to be weakly linked.

    If the framework is part of your project, consider using a \l{Depends} item
    instead.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpp::automaticReferenceCounting
    \since Qbs 1.4

    \appleproperty

    Whether to enable Automatic Reference Counting (ARC) for Objective-C and
    Objective-C++ source code.

    If left undefined, uses the compiler default (probably \c{false}).

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpp::requireAppExtensionSafeApi
    \since Qbs 1.4

    \appleproperty

    Whether to enforce the use of only app-extension-safe APIs on Apple
    platforms. This is necessary for building Application Extensions in OS X
    Yosemite and iOS 8 and above.

    If left undefined, uses the compiler and linker defaults (probably
    \c{false}).

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::minimumIosVersion

    \appleproperty

    A version number in the format \c{[major].[minor]} indicating the earliest
    version of iOS that the product should run on.

    Passes \c{-miphoneos-version-min=} to the compiler.

    If set to undefined, compiler defaults will be used.

    \note \QBS sets minimum version to \c "6.0" for \c armv7a because earlier iOS versions are
    broken in recent XCode installations.

    \defaultvalue \c "6.0" for \c armv7a, \c undefined otherwise
*/

/*!
    \qmlproperty string cpp::minimumOsxVersion
    \obsolete

    \appleproperty

    Deprecated in \QBS 1.5.2. Use \l{cpp::minimumMacosVersion} instead.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::minimumMacosVersion
    \since Qbs 1.5.2

    \appleproperty

    A version number in the format \c{[major].[minor]}indicating the earliest
    version of macOS that the product should run on.

    Passes \c{-mmacosx-version-min=} to the compiler.

    If left undefined, compiler defaults will be used.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::minimumWatchosVersion

    \appleproperty

    A version number in the format \c{[major].[minor]} indicating the earliest
    version of Apple watchOS that the product should run on.

    If left undefined, compiler defaults will be used.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::minimumTvosVersion
    \since Qbs 1.5

    \appleproperty

    A version number in the format \c{[major].[minor]} indicating the earliest
    version of Apple tvOS that the product should run on.

    If left undefined, compiler defaults will be used.

    \note \QBS sets the minimum version to \c "6.0", because earlier tvOS
    versions are not supported by recent XCode installations by default.

    \defaultvalue \c "6.0
*/

/*!
    \qmlproperty string cpp::archiverName

    The name of the archiver binary. This property is usually predetermined by the toolchain and
    may be overridden. For instance, when enabling link-time optimization in a gcc-based toolchain,
    \c{"gcc-ar"} has to be used instead of \c{"ar"}.

    \defaultvalue Depends on the selected toolchain.
*/

/*!
    \qmlproperty string cpp::archiverPath

    The full path of the archiver binary.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty string cpp::archiverFlags

    Additional flags that are appended to the archiver command.

    \defaultvalue An empty list
    \since Qbs 3.0.0
*/

/*!
    \qmlproperty string cpp::exportedSymbolsCheckMode
    \since Qbs 1.4.1

    \unixproperty

    Controls how \QBS determines whether an updated dynamic library causes
    relinking of dependents.

    The default value is \c "ignore-undefined", which means that undefined
    symbols being added or removed do not cause any relinking. If that should
    happen, for example because dependent products are linked with an option
    such as \c "--no-undefined", this property can be set to \c "strict".

    \defaultvalue \c "ignore-undefined"
*/

/*!
    \qmlproperty string cpp::linkerMode
    \since Qbs 1.6

    Controls whether to automatically use an appropriate compiler frontend
    instead of the system linker when linking binaries.

    The default is \c{"automatic"}, which chooses either the C++ compiler, C
    compiler, or system linker specified by the \l{cpp::}{linkerName} and
    \l{cpp::}{linkerPath} properties, depending on the type of object files
    present on the linker command line.

    Set this property to \c{"manual"} to explicitly specify the linker using the
    \l{cpp::}{linkerName} and \l{cpp::}{linkerPath} properties.

    \defaultvalue \c "automatic"
*/

/*!
    \qmlproperty string cpp::linkerVariant
    \since Qbs 1.13

    Set this property to force the use of a specific linker. A non-empty value
    will result in the \c {-fuse-ld} option being emitted when linking with \c gcc,
    \c clang or \c clang-cl. Other toolchains do not support this property.

    The possible values for \c clang and \c gcc are \c "bfd", \c "gold", \c "lld"
    and \c "mold", the possible values for \c clang-cl are \c "link" and \c "lld".

    The following example demonstrates how to change the linker for different toolchains:

    \code
    Properties {
        condition: qbs.toolchain.includes("gcc")
        cpp.linkerVariant: "gold"
    }
    Properties {
        condition: qbs.toolchain.includes("clang-cl")
        cpp.linkerVariant: "lld"
    }
    \endcode

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::nmName
    \since Qbs 1.2

    \unixproperty

    The name of the \c nm binary. This property is set in the build profile.

    \defaultvalue \c{"nm"}
*/

/*!
    \qmlproperty string cpp::nmPath
    \since Qbs 1.2

    \unixproperty

    The full path of the \c nm binary. This property is set in the build
    profile.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty string cpp::objcopyName
    \since Qbs 1.4

    \unixproperty

    The name of the \c objcopy binary. This property is set in the build
    profile.

    \defaultvalue \c{"objcopy"}
*/

/*!
    \qmlproperty string cpp::objcopyPath
    \since Qbs 1.4

    \unixproperty

    The full path of the \c objcopy binary. This property is set in the build
    profile.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty string cpp::stripName
    \since Qbs 1.4

    \unixproperty

    The name of the \c strip binary. This property is set in the build profile.

    \defaultvalue \c{"strip"}
*/

/*!
    \qmlproperty string cpp::stripPath
    \since Qbs 1.4

    \unixproperty

    The full path of the \c strip binary. This property is set in the build
    profile.

    \defaultvalue Determined by \l{setup-toolchains}{qbs setup-toolchains}.
*/

/*!
    \qmlproperty bool cpp::positionIndependentCode

    \unixproperty

    Whether to generate position-independent code.

    If this property is left undefined, position-independent code is generated
    for libraries, but not for applications.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::rpathOrigin
    \since Qbs 1.11

    \unixproperty

    A placeholder value used in an \c rpath string to refer to the directory
    containing the referring executable or shared library.

    \defaultvalue \c{"@loader_path"} on Mach-O based platforms (macOS, iOS,
    tvOS, watchOS); \c{"$ORIGIN"} on ELF based platforms (Linux and most other
    Unix-like platforms).
*/

/*!
    \qmlproperty stringList cpp::rpaths

    \unixproperty

    A list of \c rpaths that are passed to the linker. Paths that also appear in
    \l{cpp::}{systemRunPaths} are ignored.
    This property has no effect if \l useRPaths is not enabled.

    \nodefaultvalue

    \sa{How do I make use of rpaths?}
*/

/*!
    \qmlproperty stringList cpp::rpathLinkDirs
    \since Qbs 3.2

    \unixproperty

    A list of \c paths that are passed to the linker as arguments to the
    \l rpathLinkFlag.
    Setting this property might be required in some cases when \l useRPaths
    is disabled.
    This property has no effect if \l useRPathLink is not enabled.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::sonamePrefix
    \since Qbs 1.5

    \unixproperty

    A library name or full library path.

    If defined, the value of this property is used as a path to be prepended to
    the built shared library's \c SONAME identifier. The \c SONAME
    (\c LC_ID_DYLIB on Apple platforms, \c DT_SONAME on other Unix-like
    platforms) is the identifier that the dynamic linker will later use to
    reference the library.

    On Apple platforms, the path may contain the following placeholders:

    \list
        \li \c @rpath -
            Expands to paths defined by \c LC_RPATH Mach-O commands in
            the current process executable or the referring libraries.
        \li \c @executable_path -
            Expands to the current process executable location.
        \li \c @loader_path -
            Expands to the referring executable or library location.
    \endlist

    In most cases, using \c @rpath is sufficient and recommended.
    However, the prefix may be also specified using different placeholders, or
    an absolute path.

    For more information, see the \l{DYLD documentation} on dynamic library
    install names.

    \nodefaultvalue

    \sa{How do I make use of rpaths?}
*/

/*!
    \qmlproperty string cpp::soVersion
    \since Qbs 1.7

    \unixproperty

    The version number to be appended to the soname in ELF shared libraries.

    \defaultvalue The major part of \l{Product::version}{product.version} if a
    version is set, otherwise \c [].
*/

/*!
    \qmlproperty bool cpp::useRPaths
    \since Qbs 1.3

    \unixproperty

    If \c{false}, prevents the linker from writing \c rpaths to the binary.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty bool cpp::useRPathLink
    \since Qbs 1.8

    \unixproperty

    Whether to use the \c{-rpath-link} linker option for transitive shared
    objects.

    \defaultvalue \c{true} on non-Darwin Unix platforms or when targeting
    macOS 10.4.x and older.
*/

/*!
    \qmlproperty string cpp::rpathLinkFlag
    \since Qbs 1.9

    The rpath link flag used by the linker.

    \defaultvalue \l{qbs::toolchain}{toolchain}-dependent, typical values are \c "-rpath-link="
    or \c "-L"
*/

/*!
    \qmlproperty string cpp::variantSuffix
    \since Qbs 1.10

    A suffix to add to a product's target name if that product is of the
    \l{Product::type}{type} \c staticlibrary or \c dynamiclibrary.

    On Darwin platforms, applications and loadable modules are also affected.

    By default, this property is left empty on all platforms unless the product
    is multiplexed over the \l{qbs::buildVariants}{qbs.buildVariants} property.
    In that case, for the debug variant of the product, the default value
    is \c{"d"} on Windows and \c{"_debug"} on Darwin platforms, such as macOS.
    On all other platforms and in release mode, the default value is \c [].

    For example, building a dynamic library called \c MyLib that is multiplexed
    over the \l{qbs::buildVariants}{qbs.buildVariants} property with MSVC will
    produce files called \c{MyLib.dll} (for the release version of the product)
    and \c{MyLibd.dll} (for the debug version).

    \defaultvalue Platform-specific.
*/

/*!
    \qmlproperty string cpp::visibility

    \unixproperty

    The visibility level for exported symbols.

    Possible values include: \c{"default"}, \c{"hidden"}, \c{"hiddenInlines"},
    and \c{"minimal"}, which combines \c{"hidden"} and \c{"hiddenInlines"}.

    \defaultvalue \c{"default"}
*/

/*!
    \qmlproperty bool cpp::generateManifestFile
    \since Qbs 1.5.0

    \windowsproperty

    Whether to auto-generate a manifest file and include it in the binary.

    Set this property to \c false if you provide your own \c rc file.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty string cpp::windowsApiCharacterSet
    \since Qbs 1.0.1

    \windowsproperty


    The character set used in the Win32 API.

    The value \c "unicode" defines the preprocessor symbols \c UNICODE and
    \c _UNICODE, \c "mbcs" defines \c _MBCS, and setting the value to
    \c undefined will use the default character set.

    \defaultvalue \c{"unicode"}
*/

/*!
    \qmlproperty string cpp::windowsApiFamily
    \since Qbs 1.10

    \windowsproperty


    The Windows API family that the application or library is targeting.

    This value is used when building Universal Windows Platform applications.

    Possible values include: \c{"desktop"}, \c{"pc"}, \c{"phone"}, \c{"server"},
    and \c{"system"}, which are mapped to the corresponding set of possible
    values for the \c WINAPI_FAMILY preprocessor define in the Windows SDK.

    \defaultvalue Undefined, which lets the Windows SDK headers determine the
    default.
*/

/*!
    \qmlproperty stringList cpp::windowsApiAdditionalPartitions
    \since Qbs 1.10

    \windowsproperty

    A list of additional Windows API partitions to enable in addition to the
    ones implicitly enabled by the value of \l{cpp::}{windowsApiFamily}
    (\c WINAPI_FAMILY).

    This value is used when building Windows Store applications. For example,
    setting \l{cpp::}{windowsApiFamily} to \c{"pc"} and this property to
    \c{["phone"]} will allow you to create Windows Store applications that
    target all Universal Windows Platform device families (\c "Universal" apps).

    Possible values include: \c{"app"}, \c{"desktop"}, \c{"pc"}, \c{"phone"},
    \c{"server"}, and \c{"system"}, which are mapped to the corresponding set of
    possible \c WINAPI_PARTITION_* preprocessor defines in the Windows SDK.

    \defaultvalue Undefined, which lets the Windows SDK headers determine
    the default partitions based on the value of \c WINAPI_FAMILY.

    \sa windowsApiFamily
*/

/*!
    \qmlproperty bool cpp::requireAppContainer
    \since Qbs 1.10

    \windowsproperty

    Whether the generated executable or dynamic-link library \e requires an
    AppContainer execution environment. Set to \c true when creating
    Universal Windows Platform applications.

    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::minimumWindowsVersion

    \windowsproperty

    A version number in the format \c{[major].[minor]} indicating the earliest
    version of Windows that the product should run on.

    Defines \c WINVER, \c _WIN32_WINNT, and \c _WIN32_WINDOWS, and applies a
    version number to the linker flags \c /SUBSYSTEM and \c /OSVERSION for
    MSVC or \c --major-subsystem-version, \c --minor-subsystem-version,
    \c --major-os-version, and \c --minor-os-version for MinGW.

    If left undefined, compiler defaults will be used.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpp::alwaysUseLipo
    \since Qbs 1.9

    Whether to always use \c lipo when combining Mach-O output files on
    Apple platforms, even if there is only one CPU architecture. This value
    should not normally need to be changed.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty var cpp::compilerDefinesByLanguage
    \since Qbs 1.10

    A \c{string} to \c{string} to \c{string} map of language tags to list of
    preprocessor macros that are used for all projects that are using the
    current toolchain.

    User project files usually do not set this property.

    \note This property will not be usable without also setting
    \l{cpp::}{enableCompilerDefinesByLanguage}.

    \nodefaultvalue
*/

/*!
    \qmlproperty pathList cpp::compilerIncludePaths
    \since Qbs 1.6

    A list of \c #include search paths that are used for all projects that are
    using the current toolchain.

    User project files usually do not set this property.

    \defaultvalue Determined automatically by probing the compiler.
*/

/*!
    \qmlproperty pathList cpp::compilerFrameworkPaths
    \since Qbs 1.6

    A list of framework search paths that are used for all projects that are
    using the current toolchain.

    User project files usually do not set this property.

    \defaultvalue Determined automatically by probing the compiler.
*/

/*!
    \qmlproperty pathList cpp::compilerLibraryPaths
    \since Qbs 1.6

    A list of library search paths that are used for all projects that are using
    the current toolchain.

    User project files usually do not set this property.

    \defaultvalue Determined automatically by probing the compiler.
*/

/*!
    \qmlproperty pathList cpp::distributionFrameworkPaths
    \since Qbs 1.8

    A list of distribution-specific framework search paths, prioritized after
    \l{cpp::}{systemFrameworkPaths}.

    Intended for use by module authors implementing support for new operating
    systems or distributions.

    User project files should not set this property.

    \nodefaultvalue
*/

/*!
    \qmlproperty pathList cpp::distributionIncludePaths
    \since Qbs 1.8

    A list of distribution-specific include paths that are passed as system
    include paths to the compiler, prioritized after
    \l{cpp::}{systemIncludePaths}.

    Intended for use by module authors implementing support for new operating
    systems or distributions.

    User project files should not set this property.

    \nodefaultvalue
*/

/*!
    \qmlproperty pathList cpp::distributionLibraryPaths
    \since Qbs 1.8

    A list of distribution-specific library search paths.

    Intended for use by module authors implementing support for new operating
    systems or distributions.

    User project files should not set this property.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList cpp::enableCompilerDefinesByLanguage
    \since Qbs 1.10

    A list of languages (one or more of \c{"c"}, \c{"cpp"}, \c{"objc"},
    \c{"objcpp"}) to extract the list of default compiler defines for in
    \l{cpp::}{compilerDefinesByLanguage}.

    Because this has performance implications, no languages are enabled by
    default.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpp::generateLinkerMapFile
    \since Qbs 1.13

    Whether to auto-generate a linker map file.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty bool cpp::generateCompilerListingFiles
    \since Qbs 1.15

    Whether to auto-generate compiler listing files.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty bool cpp::generateAssemblerListingFiles
    \since Qbs 1.15

    \baremetalproperty

    Whether to auto-generate an assembler listing files.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty bool cpp::removeDuplicateLibraries
    \since Qbs 1.16

    Whether the list of the objects and libraries is reduced to a
    list of unique values before being passed to the linker.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty string cpp::windowsSdkVersion
    \since Qbs 1.19

    Which Windows SDK version should be used with MSVC toolchain. By default,
    the latest SDK is used.

    \windowsproperty
    \nodefaultvalue
*/

/*!
    \qmlproperty string cpp::enableCxxLanguageMacro
    \since Qbs 1.20

    Whether to set the \c{/Zc:__cplusplus} macro
    (\l{https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus})

    This property only applies to MSVC toolchain. clang-cl also supports
    this option, but it has no effect.

    \windowsproperty
    \defaultvalue \c{true} for MSVC, \c{false} for clang-cl
*/

/*!
    \qmlproperty string cpp::importPrivateLibraries
    \since Qbs 2.4

    Whether to automatically import external libraries from dependencies.

    If set to true in the product that depends on the static library, the external dependencies
    (such as \l{cpp::staticLibraries}{staticLibraries} and
    \l{cpp::dynamicLibraries}{dynamicLibraries}) of this library are also added to products that
    depend on this library.
    \code
    StaticLibrary {
        files: "lib.cpp"
        cpp.staticLibraries: ["l", "y"]
    }
    \endcode

    If set to false, the explicit \l{Export} item is required:
    \code
    StaticLibrary {
        files: "lib.cpp"
        Export {
            Depends { name: "cpp" }
            cpp.staticLibraries: ["l", "y"]
        }
    }
    \endcode

    We recommend using the \l{Export} item as it provides more flexibility.

    \note The default value is subject to change.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty bool cpp::forceUseCxxModules
    \since Qbs 2.5

    Set this property to \c true to force support for C++20 Modules.

    On details how to use modules, see the corresponding \l{tutorial-10.html}{section} in the
    tutorial.

    By default, modules support is disabled since this feature is considered experimental.

    \note The default value is subject to change.

    \defaultvalue \c{false}
*/
qbs-src-3.2.0/doc/reference/modules/protobufnanopb-module.qdoc0000644000175100017510000001056415154533055024054 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype protobuf.nanopb
    \inqmlmodule QbsModules
    \since Qbs 1.18

    \brief Provides support for protocol buffers for embedded systems.

    The \c protobuf.nanopb module provides support for generating nanopb C headers
    and sources from proto definition files using the \l nanopb plugin for the
    \l protoc tool suitable for embedded systems.

    A simple qbs file that uses protobuf can be written as follows:
    \code
    CppApplication {
        Depends { name: "protobuf.nanopb" }
        files: ["foo.proto", "main.cpp"]
    }
    \endcode
    A generated header now can be included in the C++ sources:
    \code
        #include 

        int main(int argc, char* argv[]) {
            Foo bar;
            bar.has_answer = true;
            bar.answer = 42;
            return 0;
        }
    \endcode

    Nanopb .options files to define nanopb specific proto options are supported.

    \section2 Relevant File Tags

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"protobuf.input"}
        \li \c{*.proto}
        \li 1.13.0
        \li Source files with this tag are considered inputs to the \c protoc compiler.
    \row
        \li \c{"protobuf.hpp"}
        \li
        \li 1.18.0
        \li This tag is attached to the header files generated by \c protoc compiler.
    \endtable
*/

/*!
    \qmlproperty string protobuf.nanopb::compilerName

    The name of the protoc binary.

    \defaultvalue \c "protoc"
*/

/*!
    \qmlproperty string protobuf.nanopb::compilerPath

    The path to the protoc binary.

    Use this property to override the auto-detected location.

    \defaultvalue \c auto-detected
*/

/*!
    \qmlproperty pathList protobuf.nanopb::importPaths

    The list of imports that are passed to the \c protoc tool via the \c --proto_path option.
    These imports should contain the proto files. They are used to determine
    the relative structure of the generated files.
    \note The paths are passed to \c protoc in the same order as specified in this property and
    \c protoc output may differ depending on that order.

    \defaultvalue \c []
*/

/*!
    \qmlproperty string protobuf.nanopb::includePath

    The path where protobuf nanopb C headers are located. Set this property to override the
    default location.

    \defaultvalue \c auto-detected
*/

/*!
    \qmlproperty string protobuf.nanopb::libraryPath

    The path where the protobuf nanopb runtime library is located. Set this property to override the
    default location.

    \defaultvalue \c auto-detected
*/

/*!
    \qmlproperty string protobuf.nanopb::outputDir
    \readonly

    The directory where the \c protoc compiler generated files are placed.

    The value of this property is automatically set by \QBS and cannot be
    changed by the user.
*/

/*!
    \qmlproperty string protobuf.nanopb::pluginName

    The name of the nanopb protoc plugin.

    \defaultvalue \c "protoc-gen-nanopb"
*/

/*!
    \qmlproperty string protobuf.nanopb::pluginPath

    The path to the nanopb protoc plugin.

    Use this property to override the auto-detected location.

    \defaultvalue \c auto-detected
*/
qbs-src-3.2.0/doc/reference/modules/protobufobjc-module.qdoc0000644000175100017510000000726415154533055023517 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype protobuf.objc
    \inqmlmodule QbsModules
    \since Qbs 1.13

    \brief Provides support for protocol buffers for the Objective-C language.

    The \c protobuf.objc module provides support for generating Objective-C
    headers and sources from proto definition files using the \l protoc tool.

    \section2 Relevant File Tags

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"protobuf.input"}
        \li \c{*.proto}
        \li 1.13.0
        \li Source files with this tag are considered inputs to the \c protoc compiler.
    \row
        \li \c{"protobuf.hpp"}
        \li
        \li 1.18.0
        \li This tag is attached to the header files generated by \c protoc compiler.
    \endtable
*/

/*!
    \qmlproperty string protobuf.objc::compilerName

    The name of the protoc binary.

    \since Qbs 1.17
    \defaultvalue \c "protoc"
*/

/*!
    \qmlproperty string protobuf.objc::compilerPath

    The path to the protoc binary.

    Use this property to override the auto-detected location.

    \since Qbs 1.17
    \defaultvalue \c auto-detected
*/

/*!
    \qmlproperty pathList protobuf.objc::importPaths

    The list of imports that are passed to the \c protoc tool via the \c --proto_path option.
    These imports should contain the proto files. They are used to determine
    the relative structure of the generated files.
    \note The paths are passed to \c protoc in the same order as specified in this property and
    \c protoc output may differ depending on that order.

    \defaultvalue \c []
*/

/*!
    \qmlproperty string protobuf.objc::includePath

    The path where protobuf Objective-C headers are located. Set this property
    to override the default location.

    \note If frameworkPath is specified, this property has no effect.

    \defaultvalue \c auto-detected
*/

/*!
    \qmlproperty string protobuf.objc::libraryPath

    \note If frameworkPath is specified, this property has no effect.

    \defaultvalue \c auto-detected
*/

/*!
    \qmlproperty string protobuf.objc::frameworkPath

    The path where \c Protobuf.framework is located. Set this property to override the
    default location.

    \defaultvalue \c auto-detected
*/

/*!
    \qmlproperty string protobuf.objc::outputDir
    \readonly

    The directory where the \c protoc compiler generated files are placed.

    The value of this property is automatically set by \QBS and cannot be
    changed by the user.
*/
qbs-src-3.2.0/doc/reference/modules/wix-module.qdoc0000644000175100017510000001753615154533055021633 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype wix
    \inqmlmodule QbsModules
    \since Qbs 1.2

    \brief Provides Windows Installer XML Toolset support.

    The \c wix module contains properties and rules for building MSI and
    EXE setup packages with the \l{Windows Installer XML Toolset}.

    This module is available on all platforms.

    \section2 Relevant File Tags
    \target filetags-wix

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"msi"}
        \li -
        \li 1.2
        \li The rule that creates the Microsoft Installer setup file attaches this tag to its output
            artifact.
    \row
        \li \c{"wixpdb"}
        \li -
        \li 1.2
        \li The rule that creates the Microsoft Installer setup file or WiX setup executable
            attaches this tag to the associated debug symbol file.
    \row
        \li \c{"wixsetup"}
        \li -
        \li 1.2
        \li The rule that creates the WiX setup executable attaches this tag to its output artifact.
    \row
        \li \c{"wxi"}
        \li \c{*.wxi}
        \li 1.2
        \li This tag is attached to WiX include files.
    \row
        \li \c{"wxl"}
        \li \c{*.wxl}
        \li 1.2
        \li This tag is attached to WiX localization files.
    \row
        \li \c{"wxs"}
        \li \c{*.wxs}
        \li 1.2
        \li This tag is attached to WiX source files.
            Each source file will be compiled into one WiX object file.
    \endtable
*/

/*!
    \qmlproperty bool wix::debugInformation

    Whether to generate debug information.

    \sa {qbs::debugInformation}{qbs.debugInformation}

    \defaultvalue \l{qbs::debugInformation}{qbs.debugInformation}
*/

/*!
    \qmlproperty stringList wix::defines

    A list of preprocessor macros that get passed to the compiler.

    To set macro values, use the following syntax:

    \badcode
    wix.defines: ["USE_COLORS=1", 'COLOR_STR="blanched almond"']
    \endcode

    \nodefaultvalue
*/

/*!
    \qmlproperty bool wix::enableQbsDefines

    Whether to define preprocessor macros corresponding to values from the
    project and product objects.

    When building a 64-bit package, the preprocessor variable \c{Win64} will
    also be defined.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty bool wix::visualStudioCompatibility

    Whether to pass most of the same preprocessor macros to the compiler as
    Visual Studio does.

    This allows easier authoring of WiX files that are compatible with both
    \QBS and MSBuild.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty pathList wix::includePaths

    A list of include paths.

    Relative paths are considered to be relative to the \c .qbs product file
    they are used in.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool wix::treatWarningsAsErrors

    Whether warnings will be handled as errors and cause the build to fail.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty string wix::warningLevel

    The severity of warnings to emit.

    The higher the level, the more warnings will be shown.

    Possible values include: \c{"none"}, \c{"normal"}, \c{"pedantic"}

    \defaultvalue \c{"normal"}
*/

/*!
    \qmlproperty bool wix::verboseOutput

    Whether to display verbose output from the compiler and linker.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty stringList wix::compilerFlags

    A list of additional flags for the Candle compiler.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList wix::linkerFlags

    A list of additional flags for the Light linker.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList wix::cultures

    A list of localizations to include in the MSI.

    If left undefined, includes all localizations.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList wix::extensions

    A list of extension assemblies to link into the output.

    Possible values include:

    \list
        \li custom assemblies
        \li \c{"WixBalExtension"}
        \li \c{"WixComPlusExtension"}
        \li \c{"WixDependencyExtension"}
        \li \c{"WixDifxAppExtension"}
        \li \c{"WixDirectXExtension"}
        \li \c{"WixFirewallExtension"}
        \li \c{"WixGamingExtension"}
        \li \c{"WixIisExtension"}
        \li \c{"WixMsmqExtension"}
        \li \c{"WixNetFxExtension"}
        \li \c{"WixPSExtension"}
        \li \c{"WixSqlExtension"}
        \li \c{"WixTagExtension"}
        \li \c{"WixUIExtension"}
        \li \c{"WixUtilExtension"}
        \li \c{"WixVSExtension"}
    \endlist

    \defaultvalue \c{["WixBalExtension"]} if the product type is an EXE setup
    application, otherwise \c{undefined}.
*/

/*!
    \qmlproperty string wix::version

    The WiX version.

    Consists of four numbers separated by dots. For example, "3.7.1224.0".

    \nodefaultvalue
*/

/*!
    \qmlproperty int wix::versionMajor

    The WiX major version.

    \defaultvalue \c{versionParts[0]}
*/

/*!
    \qmlproperty int wix::versionMinor

    The WiX minor version.

    \defaultvalue \c{versionParts[1]}
*/

/*!
    \qmlproperty list wix::versionParts

    The WiX version as a list.

    For example, WiX version 3.7.1224.0 would correspond to a value of
    \c[3, 7, 1224, 0].

    \defaultvalue \c []
*/

/*!
    \qmlproperty int wix::versionPatch

    The WiX patch level.

    \defaultvalue \c{versionParts[2]}
*/

/*!
    \qmlproperty int wix::versionBuild

    The fourth WiX version number component.

    \defaultvalue \c{versionParts[3]}
*/

/*!
    \qmlproperty path wix::toolchainInstallPath

    The WiX installation directory.

    This property should not normally need to be changed.

    \defaultvalue Determined automatically by searching the registry for the
    latest version.
*/

/*!
    \qmlproperty path wix::toolchainInstallRoot

    The WiX binaries directory.

    This property should not normally need to be changed.

    \defaultvalue Determined automatically by searching the registry for the
    latest version.
*/

/*!
    \qmlproperty string wix::compilerName

    The name of the compiler binary.

    This property should not normally need to be changed.

    \defaultvalue \c{"candle.exe"}
*/

/*!
    \qmlproperty string wix::compilerPath

    The directory where the compiler binary is located.

    This property should not normally need to be changed.

    \defaultvalue \l{wix::}{compilerName}
*/

/*!
    \qmlproperty string wix::linkerName

    The name of the linker binary.

    This property should not normally need to be changed.

    \defaultvalue \c{"light.exe"}
*/

/*!
    \qmlproperty string wix::linkerPath

    The directory where the linker binary is located.

    This property should not normally need to be changed.

    \defaultvalue \l{wix::}{linkerName}
*/
qbs-src-3.2.0/doc/reference/modules/qt-core-module.qdoc0000644000175100017510000003375015154533055022372 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Qt.core
    \inqmlmodule QbsModules
    \brief Provides Qt Core support.

    All other Qt modules have a dependency on the Qt.core module, and therefore
    you do not need to list it in your dependencies if you depend on at least
    one other \l{Qt Modules}{Qt module}.

    Some of the Qt.core properties only need to be defined if the respective
    installation of Qt was built in some unusual way, for instance by setting
    non-default \c configure flags.

    \section2 Relevant File Tags
    \target filetags-qtcore

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"qch"}
        \li n/a
        \li 1.1
        \li This tag is attached to the output artifacts of the rule that runs the
            \c qhelpgenerator tool.
    \row
        \li \c{"qdoc"}
        \li \c{*.qdoc}
        \li 1.1
        \li Source files with this tag trigger a re-execution of the rule running the \c qdoc
            tool when their timestamp changes.
    \row
        \li \c{"qdocconf"}
        \li \c{*.qdocconf}
        \li 1.1
        \li Source files with this tag trigger a re-execution of the rule running the \c qdoc
            tool when their timestamp changes.
    \row
        \li \c{"qdocconf-main"}
        \li -
        \li 1.1
        \li Source files with this tag serve as inputs to the rule running the \c qdoc tool.
    \row
        \li \c{"qdoc-output"}
        \li n/a
        \li 1.5
        \li Use this tag to match all \c qdoc outputs, for instance in a \l{Group}
            using the \l{Group::fileTagsFilter}{group.fileTagsFilter} property.
    \row
        \li \c{"qhp"}
        \li \c{*.qhp}
        \li 1.1
        \li Files with this tag serve as inputs to the rule running the \c qhelpgenerator tool.
            Such files are created by \c qdoc, but can also appear as source files.
    \row
        \li \c{"qm"}
        \li n/a
        \li 1.1
        \li This tag is attached to the output artifacts of the rule that runs the \c lrelease tool.
    \row
        \li \c{"qrc"}
        \li \c{*.qrc}
        \li 1.0
        \li Files with this tag serve as inputs to the rule running the \c rcc tool.
    \row
        \li \c{"qt_plugin_metadata"}
        \li -
        \li 1.0
        \li Source files with this tag trigger a re-execution of the rule running the \c moc
            tool when their timestamp changes.
    \row
        \li \c{"qt.core.metatypes"}
        \li n/a
        \li 1.16
        \li This tag is attached to the JSON files that are potentially created if
            \l{Qt.core::generateMetaTypesFile}{generateMetaTypesFile} is enabled.
    \row
        \li \c{"qt.core.resource_data"}
        \li -
        \li 1.7
        \li Source files with this tag serve as inputs to the rule creating \c qrc files.
    \row
        \li \c{"ts"}
        \li \c{*.ts}
        \li 1.0
        \li Files with this tag serve as inputs to the rule running the \c lrelease tool.
    \row
        \li \c{"mocable"}
        \li -
        \li 1.13
        \li Use this tag to force \QBS to run \c moc on the respective files, even though
            they do not contain \c Q_OBJECT or a related macro.
    \row
        \li \c{"unmocable"}
        \li -
        \li 1.2
        \li Use this tag for files that \QBS should not run \c moc on, even though they contain
            \c Q_OBJECT or a related macro.
    \endtable
*/

/*!
    \qmlproperty stringList Qt.core::availableBuildVariants

    The build variants that this Qt installation offers.

    \defaultvalue Set by \l{setup-qt}.
*/

/*!
    \qmlproperty path Qt.core::binPath

    The path in which Qt tools such as \c qmake, \c moc, and so on are located.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool Qt.core::combineMocOutput

    Whether the C++ sources created by \c moc are combined into a single C++
    file per product. For projects where many header files are to be handled by
    \c moc, this can speed up compilation considerably. However, side effects
    may occur as a result of merging translation units.

    \defaultvalue \l{cpp::combineCxxSources}{cpp.combineCxxSources}
*/

/*!
    \qmlproperty bool Qt.core::enableBigResources

    Whether the Qt resource compiler is run in a two-pass fashion that supports
    the creation of big resources.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty stringList Qt.core::config

    Corresponds to the default value of qmake's \c CONFIG variable.

    \defaultvalue \c []
*/

/*!
    \qmlproperty stringList Qt.core::disabledFeatures

    Corresponds to cmake's \c QT_DISABLED_PUBLIC_FEATURES variable.

    \readonly
*/

/*!
    \qmlproperty path Qt.core::docPath

    The path in which the Qt documentation is located.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList Qt.core::enabledFeatures

    Corresponds to cmake's \c QT_ENABLED_PUBLIC_FEATURES variable.

    \readonly
*/

/*!
    \qmlproperty bool Qt.core::enableKeywords

    Set this property to \c false if you do not want Qt to define the symbols
    \c {signals}, \c {slots}, and \c {emit}. This can be necessary if your
    project interacts with code that also defines such symbols.

    \defaultvalue \c true
*/

/*!
    \qmlproperty bool Qt.core::frameworkBuild

    Whether Qt was built as a framework. This is only relevant for Darwin
    systems.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool Qt.core::generateMetaTypesFile

    If this property is enabled, a JSON file tagged as \c "qt.core.metatypes" will potentially
    be generated from metatype information collected by \c moc.

    \nodefaultvalue
    \since Qbs 1.16
*/

/*!
    \qmlproperty string Qt.core::generatedHeadersDir

    The directory where tools that generate headers (such as \c moc or \c uic) put resulting
    files.

    Normally, you don't need to change this property. The one use-case is when there are several
    files with the same file name in the Product. The file name produced by \c moc is based
    only on the source file's base file name (without the directory path) which leads to a conflict
    in the mentioned case. You can resolve the conflict by setting this property to a non-default
    value for one of the files. For example:

    \code
        QtApplication {
            files: ["my_cool_header.h", "main.cpp"]
            Group {
                name: "legacy"
                files: "legacy/my_cool_header.h"
                Qt.core.generatedHeadersDir: "qt.legacy.headers"
            }
        }
    \endcode

    \defaultvalue \c product.buildDirectory + "/qt.headers"
*/

/*!
    \qmlproperty bool Qt.core::metaTypesInstallDir

    The directory to install the metatypes file into. If this property is empty or undefined,
    the metatypes file will not be installed. If the
    \l{Qt.core::generateMetaTypesFile}{generateMetaTypesFile} property is not \c true, then
    this property has no effect.

    \nodefaultvalue
    \since Qbs 1.16
*/

/*!
    \qmlproperty path Qt.core::incPath

    The base path of the Qt headers.

    \nodefaultvalue
*/

/*!
    \qmlproperty string Qt.core::libInfix

    The library infix can be set at Qt build time to change the name of Qt's
    libraries.

    For example, if the infix is \c "Test", on Unix systems, the Qt Core library
    will be in a file called \c{libQt5CoreTest.so} instead of the default
    \c{libQt5Core.so}.

    \defaultvalue \c []
*/

/*!
    \qmlproperty path Qt.core::libPath

    The path in which the Qt libraries are located.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool Qt.core::lreleaseMultiplexMode

    If this property is \c true, \c lrelease will merge all \c .ts files into
    one \c .qm file. Otherwise, one \c .qm file will be created for each \c .ts
    file.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty string Qt.core::lreleaseName

    The base name of the \c lrelease tool. Set this if your system uses a name
    such as \c "lrelease-qt4".

    \defaultvalue \c{"lrelease"}
*/

/*!
    \qmlproperty path Qt.core::mkspecPath

    The path in which the Qt \c mkspecs are located.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList Qt.core::mocFlags

    A list of additional flags to \c moc.

    You will rarely need to set this property.

    \defaultvalue \c []
*/

/*!
    \qmlproperty string Qt.core::mocName

    The base name of the \c moc tool.

    Set this if your system uses a name such as \c "moc-qt4".

    \defaultvalue \c{"moc"}
*/

/*!
    \qmlproperty string Qt.core::namespace

    The Qt namespace that can be set at build time via the \c configure script.

    By default, Qt is not built in a namespace.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList Qt.core::pluginMetaData

    A list of additional plugin metadata.

    The elements of the list are key-value pairs separated by the \c =
    character.

    A possible use case is to set the plugin URI when building a static QML
    plugin:

    \badcode
    Qt.core.pluginMetaData: ["uri=thePlugin"]
    \endcode

    \defaultvalue \c []
*/

/*!
    \qmlproperty path Qt.core::pluginPath

    The path in which the Qt plugins are located.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList Qt.core::qdocEnvironment

    The environment for calls to \c qdoc. Typically, you will need to set some
    variables here when running \c qdoc to build your project documentation.

    \nodefaultvalue
*/

/*!
    \qmlproperty string Qt.core::qdocName

    The base name of the \c qdoc tool.

    \defaultvalue \c{"qdoc3"} for Qt 4, \c{"qdoc"} otherwise.
*/

/*!
    \qmlproperty string Qt.core::qdocOutputDir

    The directory name where the \c qdoc tool writes its output.

    \defaultvalue \c{product.buildDirectory + "/qdoc_html"}
*/

/*!
    \qmlproperty string Qt.core::qmBaseName

    The base name of the \c .qm file to be built from the \c .ts files in the
    product.

    This property is ignored if \l{Qt.core::}{lreleaseMultiplexMode} is \c false.

    \defaultvalue \l{Product::targetName}{product.targetName}
*/

/*!
    \qmlproperty string Qt.core::qmDir

    The directory name where to put the \c .qm file to be built.

    \defaultvalue \l{Product::destinationDirectory}{product.destinationDirectory}
*/

/*!
    \qmlproperty string Qt.core::qtBuildVariant

    Specifies the type of Qt libraries to build against: \c "debug" or
    \c "release".

    \note On some systems, it is not possible to link code built in debug mode
    against libraries built in release mode and vice versa.

    \defaultvalue The build variant of the code linking against Qt. If Qt does
    not offer that build variant, the build variant offered by Qt is chosen
    instead.
*/

/*!
    \qmlproperty stringList Qt.core::qtConfig

    Corresponds to the default value of qmake's \c QT_CONFIG variable.

    \defaultvalue \c []
*/

/*!
    \qmlproperty path Qt.core::resourceSourceBase

    For files tagged as \l{filetags-qtcore}{qt.core.resource_data}, this
    property determines which part of their path will end up in the generated
    \c .qrc file. If this property is set to \c undefined, only the file name is
    used.

    \nodefaultvalue
*/

/*!
    \qmlproperty string Qt.core::resourcePrefix

    For files tagged as \l{filetags-qtcore}{qt.core.resource_data}, this
    property determines the prefix under which they will be available in the
    generated \c .qrc file.

    \defaultvalue \c{"/"}
*/

/*!
    \qmlproperty string Qt.core::resourceFileBaseName

    For files tagged as \l{filetags-qtcore}{qt.core.resource_data}, this
    property determines the base name of the generated \c .qrc file.

    If this property needs to be changed, it must be set in the corresponding
    \l{Product}{product} rather than in a \l{Group}.

    \defaultvalue \l{Product::targetName}{product.targetName}
*/

/*!
    \qmlproperty bool Qt.core::staticBuild

    Whether Qt was built statically.

    \nodefaultvalue
*/

/*!
    \qmlproperty path Qt.core::translationsPath

    This property provides the absolute path to the directory where the Qt
    translation files (.qm) are installed.

    \nodefaultvalue
    \since 2.5
*/

/*!
    \qmlproperty string Qt.core::version

    The Qt version.

    Consists of three numbers separated by dots. For example "5.9.1".

    \nodefaultvalue
*/

/*!
    \qmlproperty int Qt.core::versionMajor

    The Qt major version.

    \defaultvalue \c{versionParts[0]}
*/

/*!
    \qmlproperty int Qt.core::versionMinor

    The Qt minor version.

    \defaultvalue \c{versionParts[1]}
*/

/*!
    \qmlproperty list Qt.core::versionParts

    The Qt version as a list.

    For example, Qt version 5.9.1 would correspond to a value of \c[5, 9, 1].

    \defaultvalue \c []
*/

/*!
    \qmlproperty int Qt.core::versionPatch

    The Qt patch level.

    \defaultvalue \c{versionParts[2]}
*/

/*!
    \qmlproperty bool Qt.core::useRPaths

    Whether to add \l{Qt.core::libPath}{Qt.core.libPath} to \l{cpp::rpaths}{cpp.rpaths}.

    \defaultvalue \c true on Linux, \c false everywhere else.
*/
qbs-src-3.2.0/doc/reference/modules/config-install-module.qdoc0000644000175100017510000000365415154533055023731 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com).
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype config.install
    \inqmlmodule QbsModules
    \since Qbs 3.1

    \brief Provides properties for configuring installation paths and rules for various build
    artifacts.

    The \c{config.install} module contains properties that configure built-in
    items such as \l{Application}, \l{Library}, and \l{Plugin}.

    An example showing how to enable installation of static libraries:
    \code
    qbs modules.config.install.staticLibraries:true
    \endcode

    An example showing how to change the install diretory for dynamic libraries:
    \code
    qbs modules.config.install.dynamicLibrariesDirectory:opt/lib
    \endcode

    For the list of available properties, see the \l{ConfigInstall} item.
*/
qbs-src-3.2.0/doc/reference/modules/qt-shadertools-module.qdoc0000644000175100017510000002005615154533055023764 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com).
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Qt.shadertools
    \inqmlmodule QbsModules
    \brief Provides Qt Shader Tools support.

    The Qt.shadertools module provides functionality for compiling and processing shaders
    in \QBS projects. It supports various shader languages including GLSL, HLSL, and MSL.

    \section2 Relevant File Tags
    \target filetags-qtshadertools

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{qt.shader}
        \li \c{*.vert, *.tesc, *.tese, *.frag, *.comp}
        \li \c{3.0}
        \li Source files with these extensions are considered shaders and are processed by
            the qsb tool.
    \row
        \li \c{qt.shader.vertex}
        \li \c{*.vert}
        \li \c{3.0}
        \li Source files with this extension are considered vertex shaders.
    \row
        \li \c{qt.shader.fragment}
        \li \c{*.frag}
        \li \c{3.0}
        \li Source files with this extension are considered fragment shaders.
    \row
        \li \c{qt.shader.compute}
        \li \c{*.comp}
        \li \c{3.0}
        \li Source files with this extension are considered compute shaders.
    \row
        \li \c{qt.shader.tessellation}
        \li \c{*.tesc}
        \li \c{3.0}
        \li Source files with this extension are considered tessellation shaders. These shaders
            are automatically processed by using tessellation properties.
    \row
        \li \c{qt.compiled_shader}
        \li n/a
        \li \c{3.0}
        \li This tag is attached to the output artifacts of the rule that runs the qsb tool.
    \endtable

    \section2 Example

    \code
    QtApplication {
        name: "shader-app"
        type: "application"

        Depends { name: "Qt.shadertools" }

        files: ["shader.frag", "shader.vert"]
        Qt.shadertools.glslVersions: ["300 es", "330"]
        Qt.shadertools.hlslVersions: ["50"]
        Qt.shadertools.mslVersions: ["12"]
    }
    \endcode

    For more details on the \c{qsb} tool, see
    \l{https://doc.qt.io/qt-6/qtshadertools-qsb.html}{its documentation}

*/

/*!
    \qmlproperty string Qt.shadertools::generatedShadersDir

    The directory where compiled shaders will be placed.

    \defaultvalue \c{"shaders"}
*/

/*!
    \qmlproperty string Qt.shadertools::qsbName

    The name of the Qt Shader Tools compiler executable.

    \defaultvalue \c{"qsb"}
*/

/*!
    \qmlproperty stringList Qt.shadertools::glslVersions

    List of GLSL versions to generate. Each version should be specified as a string,
    for example \c{"100 es"} for GLSL ES 1.00.

    If this property is set to \c{[]}, GLSL generation is disabled.

    \defaultvalue \c{[]}
*/

/*!
    \qmlproperty stringList Qt.shadertools::hlslVersions

    List of HLSL (shader model) versions to generate. The versions follow GLSL-style
    version numbers, where 50 corresponds to Shader Model 5.0.

    If this property is set to \c{[]}, HLSL generation is disabled.

    \defaultvalue \c{[]}
*/

/*!
    \qmlproperty stringList Qt.shadertools::mslVersions

    List of Metal Shading Language versions to generate. 12 corresponds to version 1.2.

    If this property is set to \c{[]}, MSL generation is disabled.

    \defaultvalue \c{[]}
*/

/*!
    \qmlproperty bool Qt.shadertools::useQt6Versions

    Use default version used by Qt6.

    This is equivalent to passing \c{--qt6} switch to the \c{qsb} tool.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty bool Qt.shadertools::tessellation

    Whether the shaders are used in a pipeline that uses tessellation.

    By default, \QBS adds flags contolled by \l{tessellationMode} and \l{tessellationVertexCount}
    properties for all files with the \c{"qt.shader.tessellation"} file tag. Set this property to
    \c{false} to disable tessellation options for such files.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty string Qt.shadertools::tessellationMode

    The tessellation mode. Can be either \c{"triangles"} or \c{"quads"}.

    This property must be specified when a tessellation control shader is used.

    \defaultvalue \c{"triangles"}
*/

/*!
    \qmlproperty int Qt.shadertools::tessellationVertexCount

    The output vertex count from the tessellation control stage.

    \defaultvalue \c{3}
*/

/*!
    \qmlproperty int Qt.shadertools::viewCount

    The number of views a vertex shader is used with. Relevant for multiview
    functionality (GL_OVR_multiview2, VK_KHR_multiview, D3D12 view instancing).

    \defaultvalue \c{undefined}
*/

/*!
    \qmlproperty bool Qt.shadertools::batchable

    Whether vertex shaders should be made batchable for use with Qt Quick.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty int Qt.shadertools::zOrderLocation

    When \l{Qt.shadertools::batchable}{batchable} is true, this specifies the location for the
    additional vertex input that is injected with location 7 by default.

    Use this property to change the location of the injected vertex input to another value.

    This becomes relevant if the vertex shader has many inputs and 7 is in use and would clash.

    \defaultvalue \c{undefined}
*/

/*!
    \qmlproperty bool Qt.shadertools::optimized

    Whether to perform SPIR-V optimizations using spirv-opt.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty stringList Qt.shadertools::defines

    List of preprocessor defines to be active during shader compilation.

    Defines should be added as \c{"="} pairs.

    \defaultvalue \c{[]}
*/

/*!
    \qmlproperty bool Qt.shadertools::debugInformation

    Whether to generate full debug information for SPIR-V.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty bool Qt.shadertools::addResourceData

    Whether to automatically add the compiled shaders to the Qt resource data.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty bool Qt.shadertools::enableLinking

    Set this property to \c{true} to enable linking to the QtShaderTools library.

    For example:
    \code
    QtApplication {
        name: "shader-app"
        Depends { name: "Qt.shadertools" }
        Qt.shadertools.enableLinking: true
    }
    \endcode

    The Qt.shadertools module can be used in two ways:
    \list
        \li Using the \c{qsb} tool to compile shaders.
        \li Linking directly to the \l{https://doc.qt.io/qt-6/qtshadertools-index.html}{QtShaderTools}
            library and using the \l{https://doc.qt.io/qt-6/qshaderbaker.html}{QShaderBaker} class.
    \endlist

    This property and \l{useCompiler} property controls which mode is used. You can also enable
    both modes by setting both properties to \c{true}.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty bool Qt.shadertools::useCompiler

    Whether to use the Qt Shader Tools compiler.

    Set this property to \c{false} to disable the qsb tool. This is set to \c{false} by default
    if \l{Qt.shadertools::enableLinking}{enableLinking} is \c{true}.

    \defaultvalue \c{true}
*/
qbs-src-3.2.0/doc/reference/modules/nodejs-module.qdoc0000644000175100017510000000324115154533055022272 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype nodejs
    \inqmlmodule QbsModules
    \since Qbs 1.3

    \brief Provides Node.js support.

    The \c nodejs module contains support for running \l{Node.js} applications
    from \QBS.
*/

/*!
    \qmlproperty path Node.js::applicationFile

    The input JavaScript file whose corresponding output will be executed when
    running the Node.js application. If this property is \c{undefined}, the
    product will not be runnable.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/modules/qt-scxml-module.qdoc0000644000175100017510000000531415154533055022563 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Qt.scxml
    \inqmlmodule QbsModules
    \brief Provides Qt SCXML support.

    The Qt.scxml module provides support for the Qt SCXML module, which enables
    creating state machines from SCXML files.

    \section2 Relevant File Tags
    \target filetags-scxml

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"qt.scxml.compilable"}
        \li -
        \li 1.7
        \li Source files with this tag serve as inputs to the rule running the
            Qt SCXML compiler, which will create a C++ class representing a
            state machine.
    \endtable
*/

/*!
    \qmlproperty string Qt.scxml::className

    The class name of the generated state machine.

    By default, the compiler will use the \c name attribute of the input file's
    \c{} tag.

    \nodefaultvalue
*/

/*!
    \qmlproperty string Qt.scxml::generateStateMethods

    If this property is \c true, the Qt SCXML compiler will generate read and notify methods
    for states.

    \defaultvalue \c false
    \since 1.11
*/

/*!
    \qmlproperty string Qt.scxml::namespace

    The C++ namespace in which to put the generated class.

    By default, the compiler will place the class in the global namespace.

    \nodefaultvalue
*/

/*!
    \qmlproperty string Qt.scxml::qscxmlcName

    The base name of the Qt SCXML compiler.

    Set this value if your system uses a name different from the default value.

    \defaultvalue  \c{"qscxmlc"}
*/
qbs-src-3.2.0/doc/reference/modules/innosetup-module.qdoc0000644000175100017510000001144415154533055023040 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype innosetup
    \inqmlmodule QbsModules
    \since Qbs 1.7

    \brief Provides Inno Setup support.

    The \c innosetup module contains properties and rules for building EXE
    setup packages with \l{Inno Setup}. Inno Setup 5 and above are supported.

    \note A typical Inno Setup Script includes an \c OutputBaseFilename command
    to set the filename of the generated installer executable. However, \QBS
    overrides any \c OutputBaseFilename commands found in the script by passing
    the \c /F option to the ISCC compiler, and therefore, you must use
    the \l{Product::targetName}{Product.targetName} property to set the
    filename. \QBS also overrides any \c Output commands by passing the \c /O
    option to the ISCC compiler.

    \section2 Relevant File Tags
    \target filetags-innosetup

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"innosetup.iss"}
        \li \c{"*.iss"}
        \li 1.7
        \li Source files with this tag identify Inno Setup Script files, which serve as inputs
            to a rule invoking the Inno Setup Script Compiler.
    \row
        \li \c{"innosetup.exe"}
        \li n/a
        \li 1.7
        \li The rule that creates Inno Setup executable files attaches this tag
            (as well as the \l{filetags-cpp}{"application"} tag) to its output
            artifact.
    \endtable
*/

/*!
    \qmlproperty stringList innosetup::defines

    A list of preprocessor macros that get passed to the compiler.

    To set macro values, use the following syntax:

    \badcode
    innosetup.defines: ["USE_COLORS=1", 'COLOR_STR="blanched almond"']
    \endcode

    \nodefaultvalue
*/

/*!
    \qmlproperty pathList innosetup::includePaths

    A list of include paths.

    Relative paths are considered to be relative to the \c .qbs product file
    they are used in.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool innosetup::verboseOutput

    Whether to display verbose output from the Inno Setup compiler.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty stringList innosetup::compilerFlags

    A list of additional flags for the Inno Setup compiler.

    \nodefaultvalue
*/

/*!
    \qmlproperty string innosetup::version

    The Inno Setup version.

    Consists of three numbers separated by dots, for instance \c {"5.5.9"}.

    \nodefaultvalue
*/

/*!
    \qmlproperty int innosetup::versionMajor

    The Inno Setup major version.

    \defaultvalue \c{versionParts[0]}
*/

/*!
    \qmlproperty int innosetup::versionMinor

    The Inno Setup minor version.

    \defaultvalue \c{versionParts[1]}
*/

/*!
    \qmlproperty list innosetup::versionParts

    The Inno Setup version as a list.

    For instance, Inno Setup version 5.5.9 would correspond to a value of
    \c[5, 5, 9].

    \defaultvalue \c []
*/

/*!
    \qmlproperty int innosetup::versionPatch

    The Inno Setup patch level.

    \defaultvalue \c{versionParts[2]}
*/

/*!
    \qmlproperty path innosetup::toolchainInstallPath

    The Inno Setup installation directory.

    Determined by searching the registry for the latest version.

    This property should not normally need to be changed.

    \defaultvalue Determined automatically.
*/

/*!
    \qmlproperty string innosetup::compilerName

    The name of the compiler binary.

    This property should not normally need to be changed.

    \defaultvalue \c{"ISCC.exe"}
*/

/*!
    \qmlproperty string innosetup::compilerPath

    The full path of the compiler binary.

    This property should not normally need to be changed.

    \defaultvalue \c{compilerName}
*/
qbs-src-3.2.0/doc/reference/modules/ib-module.qdoc0000644000175100017510000002025015154533055021401 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype ib
    \inqmlmodule QbsModules
    \since Qbs 1.1

    \brief Provides support for Apple Interface Builder and related tools and file types.

    The \c ib module contains properties and rules for building Interface Builder documents,
    storyboards, asset catalogs, and icon sets.

    This module is only available on Apple platforms.

    \section2 Relevant File Tags
    \target filetags-ib

    The file tags determine how the tagged directories and files are handled.

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"assetcatalog"}
        \li \c{*.xcassets}
        \li 1.3
        \li Tagged directories are compiled into compiled asset catalog
            archives (\c .car files) on supported platforms, or a collection of
            loose resource files. The resulting files will be automatically
            tagged \l{filetags-bundle}{bundle.input}. If the current product is
            a bundle, the files will be included in the bundle's resources
            directory.
    \row
        \li \c{"iconcomposer"}
        \li \c{*.icon}
        \li 3.2
        \li Tagged directories are Icon Composer icon bundles created with the
            Icon Composer tool in Xcode 26 or later. These layered, adaptive
            icon files are compiled using \c actool alongside asset catalogs.
            The resulting files will be automatically tagged \l{filetags-bundle}
            {bundle.input}. If the current product is a bundle, the files will
            be included in the bundle's resources directory. Icon Composer icons
            can coexist with traditional asset catalog icons in the same project.
    \row
        \li \c{"iconset"}
        \li \c{*.iconset}
        \li 1.3
        \li Tagged directories are compiled into Apple ICNS files. The resulting
            files will be automatically tagged \l{filetags-bundle}
            {bundle.input}. If the current product is a bundle, the files will
            be included in the bundle's resources directory.
    \row
        \li \c{"nib"}
        \li \c{*.nib}, \c{*.xib}
        \li 1.1
        \li Tagged "NIB" and "XIB" files will be compiled. The output may be a
            flat file or a bundle (directory structure). The resulting
            files will be automatically tagged \l{filetags-bundle}
            {bundle.input}. If the current product is a bundle, the files will
            be included in the bundle's resources directory.
    \row
        \li \c{"png"}
        \li \c{*.png}
        \li 1.9
        \li Tagged PNG files may be converted into multi-resolution TIFFs.
            Source files should adopt the \l{Adopt the @2x Naming Convention}
            {@2x naming convention} in order to be properly grouped. The
            resulting files will be given the \l{filetags-dmg}{tiff} file tag.
    \row
        \li \c{"storyboard"}
        \li \c{*.storyboard}
        \li 1.3
        \li Tagged storyboard files will be compiled. The output may be a flat
            file or a bundle (directory structure). The resulting
            files will be automatically tagged \l{filetags-bundle}
            {bundle.input}. If the current product is a bundle, the files will
            be included in the bundle's resources directory.
    \endtable
*/

/*!
    \qmlproperty bool ib::warnings

    Whether to print warnings when compiling.

    Does not apply to icon sets.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty bool ib::errors

    Whether to print errors when compiling.

    Does not apply to icon sets.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty bool ib::notices

    Whether to print notifications when compiling.

    Does not apply to icon sets.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty stringList ib::flags

    Additional flags to pass to the underlying tool (\c ibtool, \c actool,
    \c iconutil).

    \nodefaultvalue

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty string ib::ibtoolName
    \since Qbs 1.3

    The name of the \c ibtool binary used to compile NIBs and storyboards.

    This property should not normally need to be changed.

    \defaultvalue \c{"ibtool"}
*/

/*!
    \qmlproperty string ib::ibtoolPath
    \since Qbs 1.3

    The directory where the \c ibtool binary is located.

    This property should not normally need to be changed.

    \defaultvalue \c{ibtoolName}
*/

/*!
    \qmlproperty bool ib::flatten

    Compiles XIBs and storyboards into flattened (non-wrapper) files.

    Set to \c{false} to preserve editability of the resulting NIB and storyboard
    bundles in Interface Builder.

    This property should not normally need to be changed.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty string ib::module
    \since Qbs 1.3

    Sets the name of the module that the NIB or storyboard is a part of.

    Requires Xcode 6 or newer.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool ib::autoActivateCustomFonts
    \since Qbs 1.3

    Instructs the \c ibtool compiler to add custom fonts to the application's
    \c Info.plist when compiling XIBs and storyboards, which will cause the
    fonts to activate upon application launch.

    Requires Xcode 6 or newer.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty string ib::actoolName
    \since Qbs 1.3

    The name of the \c actool binary used to compile asset catalogs.

    This property should not normally need to be changed.

    \defaultvalue \c{"actool"}
*/

/*!
    \qmlproperty string ib::actoolPath
    \since Qbs 1.3

    The directory where the \c actool binary is located.

    This property should not normally need to be changed.

    \defaultvalue \c{actoolName}
*/

/*!
    \qmlproperty string ib::appIconName
    \since Qbs 1.3

    The name of the resource in the asset catalog that will be used as the
    application's icon.

    Used to generate the partial \c Info.plist which will be merged into the
    resulting app.

    If this property is \c{undefined}, no application icon will be specified.

    \nodefaultvalue
*/

/*!
    \qmlproperty string ib::launchImageName
    \since Qbs 1.3

    The name of the resource in the asset catalog that will be used as the
    application's launch image.

    Used to generate the partial \c Info.plist which will be merged into the
    resulting app.

    If this property is \c{undefined}, no launch image will be specified.

    This property is specific to iOS.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool ib::compressPngs
    \since Qbs 1.3

    Whether to compress PNG image files when building asset catalogs.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty string ib::iconutilName
    \since Qbs 1.3

    The name of the \c iconutil binary used to compile icon sets.

    This property should not normally need to be changed.

    \defaultvalue \c{"iconutil"}
*/

/*!
    \qmlproperty string ib::iconutilPath
    \since Qbs 1.3

    The directory where the \c iconutil binary is located.

    This property should not normally need to be changed.

    \defaultvalue \c{iconutilName}
*/
qbs-src-3.2.0/doc/reference/modules/config-build-module.qdoc0000644000175100017510000000327115154533055023355 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com).
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype config.build
    \inqmlmodule QbsModules
    \since Qbs 3.1

    \brief Provides properties for configuring building.

    The \c{config.build} module contains properties that configure built-in
    items such as \l{Application}, \l{Library}, and \l{Plugin}.

    An example showing how change the default library type:
    \code
    qbs modules.config.build.libraryType:static
    \endcode

    For the list of available properties, see the \l{ConfigBuild} item.
*/
qbs-src-3.2.0/doc/reference/modules/archiver-module.qdoc0000644000175100017510000001142215154533055022613 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype archiver
    \inqmlmodule QbsModules
    \since Qbs 1.4

    \brief Provides support for building archives.

    The \c archiver module contains the properties and rules for creating (compressed) archives.
    The output artifact has the file tag \c "archiver.archive". The sole input artifact is a text file
    containing the list of files to package, with one file path per line. The paths can be
    relative, in which case they will be looked for in \l{archiver::}{workingDirectory}. The file tag
    of this input artifact is \c "archiver.input-list".
*/

/*!
    \qmlproperty stringList archiver::flags

    Custom options not covered by any of the other properties.

    \defaultvalue \c []
*/

/*!
    \qmlproperty string archiver::archiveBaseName

    The base name of the archive file. That is, the file name without any
    extensions.

    \defaultvalue \l{Product::targetName}{product.targetName}
*/

/*!
    \qmlproperty string archiver::compressionLevel

    How much effort to put into the compression of a \c 7-Zip or \c zip archive.

    Possible values for zip are:

    \list
        \li \c undefined
        \li \c "0"
        \li \c "1"
        \li \c "2"
        \li \c "3"
        \li \c "4"
        \li \c "5"
        \li \c "6"
        \li \c "7"
        \li \c "8"
        \li \c "9"
    \endlist

    7-Zip only supports 0 and the odd numbers above.

    Higher numbers result in a smaller archive, but the compression process will
    take more time.

    If the value is left undefined, the default compression level is used.

    \nodefaultvalue
*/

/*!
    \qmlproperty string archiver::compressionType

    How to compress a \c tar or \c zip archive.

    Possible options are:

    \list
        \li \c "bz2"
        \li \c "deflate"
        \li \c "gz"
        \li \c "none"
        \li \c "store"
        \li \c undefined, which uses the archiver's default compression type.
        \li \c "xz"
        \li \c "Z"
    \endlist

    \defaultvalue \c{"gz"} for \c tar archives, otherwise \c undefined.
*/

/*!
    \qmlproperty string archiver::outputDirectory

    Where to put the archive file.

    \defaultvalue \l{Product::destinationDirectory}
    {product.destinationDirectory}
*/

/*!
    \qmlproperty string archiver::type

    Which kind of archiver to use.

    The currently supported values are:

    \list
        \li \c "7zip"
        \li \c "tar"
        \li \c "zip"
    \endlist

    \nodefaultvalue
*/

/*!
    \qmlproperty string archiver::workingDirectory

    The directory in which to execute the archiver tool specified by
    \l{archiver::}{command}.

    \nodefaultvalue
*/

/*!
    \qmlproperty string archiver::command

    The path to the executable used to create the archive.

    This is usually the native tool corresponding to the archive type being
    produced, but may fall back to another tool also capable of producing that
    archive type if the native tool is not installed on the host system.
    This behavior is especially useful on platforms such as Windows, where the
    native tools for producing \c tar and \c zip archives in particular are
    much less likely to be installed.

    The following table lists the supported \l{archiver::type}{archive types}
    and the tools capable of producing them, listed in search order from left to
    right:

    \table
    \header
        \li Type
        \li Supported tools
    \row
        \li 7zip
        \li 7z
    \row
        \li tar
        \li tar, 7z
    \row
        \li zip
        \li zip \e (Info-Zip), 7z, jar \e (from Java JDK)
    \endtable

    \defaultvalue Depends on \l{archiver::}{type}.
*/
qbs-src-3.2.0/doc/reference/modules/qt-qml-module.qdoc0000644000175100017510000001314715154533055022231 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Qt.qml
    \inqmlmodule QbsModules
    \brief Provides Qt QML support.

    The Qt.qml module provides support for the Qt QML module, which contains
    classes for QML and JavaScript languages.

    \note If the current value of \l{qbs::architecture}{qbs.architecture} is not
    supported by \c qmlcachegen, the QML cache file generator rule is disabled.

    \sa Qt.quick, Qt.declarative

    \section2 Relevant File Tags
    \target filetags-qml

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"qt.qml.js"}
        \li \c{*.js}
        \li 1.10
        \li QML companion JavaScript files. Source files with this tag serve as
            input for the QML cache file generator.
    \row
        \li \c{"qt.qml.qml"}
        \li \c{*.qml}
        \li 1.8
        \li Source files with this tag serve as inputs to the QML plugin
            scanner.
    \row
        \li \c{"qt.qml.types"}
        \li n/a
        \li 1.16
        \li This tag is attached to the files created by the \c qmltyperegistrar
            tool if the \l importName property is set.
    \endtable
*/

/*!
    \qmlproperty string Qt.qml::importName

    Setting this value triggers QML type registration via the \c qmltyperegistrar tool,
    which results in the creation of a file with the tag \c{"qt.qml.types"}.
    The given string is the name under which the registered types can be imported
    by QML code that wants to use them.

    \note This functionality is only available with Qt 5.15 or later.

    \since Qbs 1.16
    \nodefaultvalue
*/

/*!
    \qmlproperty string Qt.qml::importVersion

    Specifies the version of the types to be registered.
    Values consist of a major and an optional minor number, separated by dots.
    This property has no effect if \l importName is not set.

    \since Qbs 1.16
    \defaultvalue \l {Product::version}{The product version}
*/

/*!
    \qmlproperty string Qt.qml::typesFileName

    Specifies the name of the file that declares the types registered for this product.
    For applications, the default value is \c{.qmltypes},
    where \c{} is the product's \l{Product::targetName}{target name}.
    Otherwise, the default value is "plugins.qmltypes".
    \note The naming conventions are still in flux.
          When in doubt, consult the Qt documentation.

    This property has no effect if \l importName is not set.

    \since Qbs 1.16
*/

/*!
    \qmlproperty string Qt.qml::typesInstallDir

    The directory to install the qmltypes file into. If this property is empty or undefined,
    the file will not be installed.
    This property has no effect if \l importName is not set.

    \since Qbs 1.16
    \nodefaultvalue
*/

/*!
    \qmlproperty stringList Qt.qml::extraMetaTypesFiles

    Specifies extra metatypes files to pass to the \c qmltyperegistrar tool
    via the \c{--foreign-types} option when registering QML types.
    \note This property is only needed for external libraries, not products or modules
          pulled via \c Depends items. In particular, you don't need to (and should not)
          use it to collect the metatypes files of Qt modules. These are found automatically.
    This property has no effect if \l importName is not set.

    \since Qbs 1.16
    \nodefaultvalue
*/

/*!
    \qmlproperty string Qt.qml::qmlImportScannerName

    The base name of the QML import scanner.

    Set this value if your system uses a name different from the default value.

    \defaultvalue \c{"qmlimportscanner"}
*/

/*!
    \qmlproperty string Qt.qml::qmlPath

    The absolute path to the directory where Qt's QML files are installed.

    \defaultvalue Determined by \l{setup-qt}.
*/

/*!
    \qmlproperty bool Qt.qml::generateCacheFiles

    Whether QML cache files are generated.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty bool Qt.qml::cachingEnabled
    \readonly

    This property is \c true if \l{Qt.qml::}{generateCacheFiles} is \c{true}
    and the platform supports QML cache generation.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty string Qt.qml::qmlCacheGenPath

    The absolute path to the \c qmlcachegen executable.

    \defaultvalue Determined by \l{setup-qt}.
*/

/*!
    \qmlproperty string Qt.qml::cacheFilesInstallDir

    The path to the directory where the cache files are installed.

    If this property is set, QML cache files are automatically installed.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/modules/codesign-module.qdoc0000644000175100017510000002347615154533055022617 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype codesign
    \inqmlmodule QbsModules
    \since Qbs 1.19

    \brief Provides code signing support.

    The \c codesign module contains properties and rules for code signing on Apple and Android
    platforms.

    \section2 Relevant File Tags

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"codesign.entitlements"}
        \li \c{*.entitlements}
        \li 1.19.0
        \li \l{https://developer.apple.com/documentation/bundleresources/entitlements}{Xcode entitlements}
    \row
        \li \c{"codesign.provisioningprofile"}
        \li \c{*.mobileprovision, *.provisionprofile}
        \li 1.19.0
        \li Xcode provisioning profiles
    \row
        \li \c{"codesign.signed_artifact"}
        \li n/a
        \li 1.19.0
        \li This tag is attached to all signed artifacts such as applications or libraries
    \endtable
*/

/*!
    \qmlproperty string codesign::signingTimestamp

    URL of the timestamp authority RFC 3161 server to be contacted to authenticate code signing.
    \c undefined or \c empty indicates that a system-specific default should be used;
    \c{"none"} explicitly disables the use of timestamp services on Apple platforms.

    \since Qbs 1.19

    \defaultvalue \c "none" on Apple, \c undefined otherwise
*/

/*!
    \qmlproperty stringList codesign::codesignFlags

    Additional flags passed to the \c{codesign} tool.

    \since Qbs 1.19

    \nodefaultvalue
*/

/*!
    \qmlproperty string codesign::codesignName

    The name of the \c{codesign} binary.

    \since Qbs 1.19

    \defaultvalue Determined automatically
*/

/*!
    \qmlproperty string codesign::codesignPath

    Path to the \c{codesign} tool.

    \since Qbs 1.19

    \defaultvalue Determined automatically
*/

/*!
    \qmlproperty bool codesign::enableCodeSigning

    Whether to actually perform code signing.

    \since Qbs 1.19

    \defaultvalue \c false
*/

/*!
    \qmlproperty string codesign::provisioningProfile

    Name or UUID of the provisioning profile to embed in the product.
    Typically this should be left blank to allow \QBS to use automatic provisioning.

    \since Qbs 1.19

    \defaultvalue \c undefined

    \appleproperty
*/

/*!
    \qmlproperty path codesign::provisioningProfilesPath

    Path to directory containing provisioning profiles installed on the system.
    This should not normally need to be changed.

    \since Qbs 1.19

    \defaultvalue \c{"~/Library/MobileDevice/Provisioning Profiles"}

    \appleproperty
*/

/*!
    \qmlproperty string codesign::signingIdentity

    Search string used to find the certificate to sign the product. This does not have to be
    a full certificate name like "Mac Developer: John Doe (XXXXXXXXXX)", and can instead be
    a partial string like "Mac Developer" or the certificate's SHA1 fingerprint.
    The search string should generally be one of the following:
    \list
        \li 3rd Party Mac Developer Application
        \li 3rd Party Mac Developer Installer
        \li Developer ID Application
        \li Developer ID Installer
        \li iPhone Developer
        \li iPhone Distribution
        \li Mac Developer
    \endlist

    It is also possible to use the special \c "-" value to use the ad-hoc signing.

    See \l{https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html#//apple_ref/doc/uid/TP40012582-CH31-SW41}{Maintaining Your Signing Identities and Certificates}
    for complete documentation on the existing certificate types.
    In general you should use \l{codesign::signingType}{signingType} instead.

    \since Qbs 1.19

    \defaultvalue Determined by \l{codesign::signingType}{signingType}

    \appleproperty
*/

/*!
    \qmlproperty string codesign::signingType

    Type of code signing to use. This should generally be used in preference to an explicit
    signing identity like "Mac Developer: John Doe (XXXXXXXXXX)" since it is not user
    specific and can be set in a project file.
    Possible values include: \c{"app-store"}, \c{"apple-id"}, \c{"ad-hoc"}, which sign for
    the App Store or Mac App Store, Developer ID, and Ad-hoc code signing, respectively.

    \section1 Relation between the signingType and signingIdentity

    The following table shows how the signingIdentity's default value is calculated.

    \table
    \header
        \li \c qbs.targetOS
        \li \c codesign.signingType
        \li \c qbs.buildVariant
        \li \c codesign.signingIdentity
    \row
        \li {1, 4} \c "macos"
        \li \c "ad-hoc"
        \li any
        \li \c "-"
    \row
        \li {1, 2} \c "app-store"
        \li \c "debug", \c "profiling"
        \li \c "Mac Developer"
    \row
        \li \c "release"
        \li \c "3rd Party Mac Developer Application"
    \row
        \li \c "apple-id"
        \li any
        \li \c "Developer ID Application"
    \row
        \li {1, 2} \c "ios", \c "tvos", \c "watchos"
        \li {1, 2} \c "app-store"
        \li \c "debug", \c "profiling"
        \li \c "iPhone Developer"
    \row
        \li \c "release"
        \li \c "iPhone Distribution"
    \endtable

    \since Qbs 1.19

    \defaultvalue Determined automatically

    \appleproperty
*/

/*!
    \qmlproperty string codesign::teamIdentifier

    Human readable name or 10-digit identifier of the Apple development team that the
    signing identity belongs to. This is used to disambiguate between multiple certificates
    of the same type in different teams. Typically this can be left blank if the development
    machine is only signed in to a single development team, and should be set in a profile
    otherwise.

    \since Qbs 1.19

    \defaultvalue \c undefined

    \appleproperty
*/

/*!
    \qmlproperty bool codesign::useApksigner

    If \c true, the package is signed using apksignerFilePath binary.
    Set this property to \c false to use the jarsignerFilePath one.
    Set by the Android.sdk module.

    \since Qbs 1.19

    \defaultvalue \c true

    \androidproperty
*/

/*!
    \qmlproperty string codesign::keystorePath

    The absolute path to the keystore file.

    \since Qbs 1.19

    \defaultvalue \c "${HOME}/.android/debug.keystore"

    \androidproperty
*/

/*!
    \qmlproperty string codesign::keystorePassword

    The keystore password.

    \since Qbs 1.19

    \defaultvalue \c "android"

    \androidproperty
*/

/*!
    \qmlproperty string codesign::keyPassword

    The key password.

    \since Qbs 1.19

    \defaultvalue \c "android"

    \androidproperty
*/

/*!
    \qmlproperty string codesign::keyAlias

    The key alias.

    \since Qbs 1.19

    \defaultvalue \c "androiddebugkey"

    \androidproperty
*/

/*!
    \qmlproperty string codesign::subjectName

    Specifies the name of the subject of the signing certificate.
    This value can be a substring of the entire subject name.

    \since Qbs 1.19

    \defaultvalue \c undefined

    \windowsproperty
*/

/*!
    \qmlproperty string codesign::rootSubjectName

    Specifies the name of the subject of the root certificate that
    the signing certificate must chain to. This value may be a substring
    of the entire subject name of the root certificate.

    \since Qbs 1.19

    \defaultvalue \c undefined

    \windowsproperty
*/

/*!
    \qmlproperty string codesign::hashAlgorithm

    Specifies the default hash algorithm used on the signing certificate.
    The possible values are \c sha1, \c sha256, \c sha384, and \c sha512.

    \note Only available in Windows 10 kit builds 20236 and later.

    \since Qbs 1.19

    \defaultvalue \c undefined

    \windowsproperty
*/

/*!
    \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).

    \since Qbs 1.19

    \defaultvalue \c undefined

    \windowsproperty
*/

/*!
    \qmlproperty string codesign::certificatePassword

    Specifies the password to use when opening a signing certificate file (*.pfx).

    \since Qbs 1.19

    \defaultvalue \c undefined

    \windowsproperty
*/

/*!
    \qmlproperty string codesign::crossCertificatePath

    Specifies the full path to the additional certificate file (*.cer).

    \since Qbs 1.19

    \defaultvalue \c undefined

    \windowsproperty
*/
qbs-src-3.2.0/doc/reference/modules/autotest-module.qdoc0000644000175100017510000000503615154533055022664 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype autotest
    \inqmlmodule QbsModules
    \since Qbs 1.13

    \brief Allows to fine-tune autotest execution.

    The \c autotest module provides properties that allow autotest applications to specify
    how exactly they should be run.
*/

/*!
    \qmlproperty bool autotest::allowFailure

    Autotests for which this property is \c true can return a non-zero exit code without
    causing the entire \l AutotestRunner to fail. Use this for tests that are known
    to be unreliable.

    \defaultvalue \c false
*/

/*!
    \qmlproperty stringList autotest::arguments

    The list of arguments to invoke the autotest with. If not specified, then
    the \l{AutotestRunner::arguments}{arguments} property of the
    \l AutotestRunner that invokes the autotest is used.

    \nodefaultvalue
*/

/*!
    \qmlproperty string autotest::workingDir

    The working directory for running the autotest. If not specified, then
    the \l{AutotestRunner::workingDir}{workingDir} property of the
    \l AutotestRunner that invokes the autotest is used.

    \nodefaultvalue
*/

/*!
    \qmlproperty int autotest::timeout

    The time limit for the execution of the autotest. If not specified, the
    \l{AutotestRunner::timeout}{timeout} property of the \l AutotestRunner
    that invokes the autotest is used.

    \nodefaultvalue
    \since Qbs 1.15
*/

qbs-src-3.2.0/doc/reference/modules/asan-module.qdoc0000644000175100017510000000540615154533055021737 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Sanitizers.address
    \inqmlmodule QbsModules
    \brief Provides AddressSanitizer support.

    Provides support for the \l{https://clang.llvm.org/docs/AddressSanitizer.html}{AddressSanitizer}
    tool, which uses compiler instrumentation to detect memory corruption bugs at runtime.
*/


/*!
    \qmlproperty string Sanitizers.address::detectUseAfterReturn

    Controls whether support for detecting problems with stack use after returning
    from a function should be built into the application.

    The possible values are:
    \list
    \li \c "always": Check for this type of problem unconditionally.
    \li \c "runtime": Build with this capability, but only do the respective checks if they
                   are explicitly requested at runtime.
    \li \c "never": Do not build with support for this check.
    \endlist

    \note Only the clang compiler (starting at 13.0) supports the full set of values.
          With GCC and MSVC, "runtime" maps to "always".

    \defaultvalue \c "always"
*/

/*!
    \qmlproperty bool Sanitizers.address::detectUseAfterScope

    Controls whether to detect bugs relating the use of variables after they've gone out of scope.

    \note This property has no effect when building with with GCC and MSVC.

    \defaultvalue \c true
*/

/*!
    \qmlproperty bool Sanitizers.address::enabled

    Controls whether to enable AddressSanitizer.

    \note You do not need to check if the current toolchain supports AddressSanitizer:
          If \QBS detects that it doesn't, this property has no effect.

    \defaultvalue \c true
*/
qbs-src-3.2.0/doc/reference/modules/install-paths-module.qdoc0000644000175100017510000000770315154533055023602 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2025 Janet Black.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype installpaths
    \inqmlmodule QbsModules
    \since Qbs 3.1

    \brief Provides properties for install directories.

    The \c installpaths module contains properties indicating directories where
    files should be installed to in a manner allowing distributors to make necessary
    adjustments.

    Example usage:
    \code
    qbs modules.installPaths.libexec:lib64/libexec
    \endcode

    \note On Debian-like Linux distributions, this module also provides some convenience
    auto-detection mechanism using the \c dpkg-architecture tool: If installPaths::autotedect
    is true, \QBS will query the library paths from the system.
*/

/*!
    \qmlproperty string installpaths::autotedect

    Whether to try autodetecting paths using system tools.

    This property has an effect only on Debian-like Linux systems.

    \defaultvalue \c false
*/

/*!
    \qmlproperty string installpaths::applications

    The location where to install applictaton bundles on Apple platforms.

    \defaultvalue \c "Applications"
*/

/*!
    \qmlproperty string installpaths::bin

    The location where to install binaries.

    \defaultvalue \c "bin"
*/

/*!
    \qmlproperty string installpaths::etc

    The location where to install configs.

    \defaultvalue \c "etc"
*/

/*!
    \qmlproperty string installpaths::frameworks

    The location where to install Frameworks on Apple platforms.

    \defaultvalue \c "Library/Frameworks"
*/

/*!
    \qmlproperty string installpaths::include

    The location where to install include files.

    \defaultvalue \c "include"
*/

/*!
    \qmlproperty string installpaths::lib

    The location where to install libraries.

    \defaultvalue \c "lib"
*/

/*!
    \qmlproperty string installpaths::libexec

    The location where to install additional executables.

    \defaultvalue \c{"libexec/"} + \l{subdir}
*/

/*!
    \qmlproperty string installpaths::library

    The location where to install support files on Apple platforms.

    \defaultvalue \c "Library"
*/

/*!
    \qmlproperty string installpaths::loadableModules

    The location where to install loadable modules (bundle plugins) on Apple platforms.

    \defaultvalue \c "Library//PlugIns"
*/

/*!
    \qmlproperty string installpaths::subdir

    The additional directory appended to the libexec, share and plugins paths.

    \defaultvalue lower-case \l{Project::name}{Project.name}
*/

/*!
    \qmlproperty string installpaths::plugins

    The location where to install plugins.

    On Apple platforms, non-bundle loadable modules are also installed here.

    \defaultvalue \l{lib} + \c{"/"} + \l{subdir} + \c{"/plugins"}
*/

/*!
    \qmlproperty string installpaths::share

    The location where to install resources.

    \defaultvalue \c{"share/"} + \l{subdir}
*/
qbs-src-3.2.0/doc/reference/modules/typescript-module.qdoc0000644000175100017510000001172215154533055023221 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype typescript
    \inqmlmodule QbsModules
    \since Qbs 1.3

    \brief Provides TypeScript support.

    The \c typescript module contains properties and rules for building
    \l{TypeScript} applications and may be used in combination with the
    \l{nodejs} module to run the applications directly from \QBS.
*/

/*!
    \qmlproperty string typescript::warningLevel

    The severity of warnings to emit. The higher the level, the more warnings
    will be shown.

    \c{pedantic} causes the TypeScript to emit warnings on expressions and
    declarations with an implied \e any type.

    \defaultvalue \c{"normal"}
*/

/*!
    \qmlproperty string typescript::targetVersion

    The ECMAScript target version for generated JavaScript code.

    If left undefined, the TypeScript \l{Compiler Options}{compiler default} is
    used.

    \nodefaultvalue
*/

/*!
    \qmlproperty string typescript::moduleLoader

    If TypeScript modules are being used, the JavaScript module loading
    mechanism to use in the generated JavaScript code.

    If left undefined, modules are not used.

    See \l{Compiler Options} for a list of possible values.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool typescript::stripComments

    Whether to remove comments from the generated JavaScript files.

    \defaultvalue \l{qbs::debugInformation}{!qbs.debugInformation}
*/

/*!
    \qmlproperty bool typescript::generateDeclarations

    Whether to generate the corresponding \c .d.ts files during compilation.
    These are TypeScript's equivalent of header files.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty bool typescript::generateSourceMaps

    Whether to generate the corresponding \c .map files during compilation.

    \defaultvalue \l{qbs::debugInformation}{qbs.debugInformation}
*/

/*!
    \qmlproperty stringList typescript::compilerFlags

    A list of additional flags for the TypeScript compiler.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool typescript::singleFile

    Whether to compile all TypeScript source files to a single JavaScript output
    file.

    The default is to compile each TypeScript file to a corresponding JavaScript
    file. This property is incompatible with \l{typescript}{moduleLoader}.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty string typescript::version

    The TypeScript version.

    Consists of four numbers separated by dots. For example, "1.0.0.0".

    \nodefaultvalue
*/

/*!
    \qmlproperty int typescript::versionMajor

    The TypeScript major version.

    \defaultvalue \c{versionParts[0]}
*/

/*!
    \qmlproperty int typescript::versionMinor

    The TypeScript minor version.

    \defaultvalue \c{versionParts[1]}
*/

/*!
    \qmlproperty list typescript::versionParts

    The TypeScript version as a list.

    For example, TypeScript version 1.0 would correspond to a value of
    \c[1, 0, 0, 0].

    \defaultvalue \c []
*/

/*!
    \qmlproperty int typescript::versionPatch

    The TypeScript patch level.

    \defaultvalue \c{versionParts[2]}
*/

/*!
    \qmlproperty int typescript::versionBuild

    The fourth TypeScript version number component.

    \defaultvalue \c{versionParts[3]}
*/

/*!
    \qmlproperty path typescript::toolchainInstallPath

    The TypeScript installation directory.

    This property should not normally need to be changed if \c{tsc} is available
    by searching the PATH environment variable.

    \nodefaultvalue
*/

/*!
    \qmlproperty string typescript::compilerName

    The name of the compiler binary.

    This property should not normally need to be changed.

    \defaultvalue \c{"tsc"}
*/

/*!
    \qmlproperty string typescript::compilerPath

    The directory where the compiler binary is located.

    This property should not normally need to be changed.

    \defaultvalue \c{compilerName}
*/
qbs-src-3.2.0/doc/reference/modules/xcode-module.qdoc0000644000175100017510000001103715154533055022114 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2015 Jake Petroules.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
    \qmltype xcode
    \inqmlmodule QbsModules
    \since Qbs 1.5

    \brief Provides Xcode support.

    The \c xcode module contains properties and rules for Xcode-based development.
    This module provides the foundation for several other modules on Apple
    platforms, including the \l{cpp} and \l{ib} modules.
*/

/*!
    \qmlproperty path xcode::developerPath

    The developer directory of the Xcode installation.

    Corresponds to the \c DEVELOPER_DIR environment variable.

    \defaultvalue The developer directory of the Xcode installation at its
    default location in \c /Applications. For example,
    \c{"/Applications/Xcode.app/Contents/Developer"}.

*/

/*!
    \qmlproperty string xcode::sdk

    The version of the Xcode SDK used to build products.

    This can be specified as a full canonical SDK name (\c{"macosx10.10"}), a
    platform version number (\c{"10.10"}), or a platform identifier
    (\c{"macosx"}), in which case the latest SDK available for that platform
    will be used.

    \defaultvalue The latest SDK available in the Xcode installation for the
    current platform. Determined by \l{qbs::targetOS}{qbs.targetOS}.
*/

/*!
    \qmlproperty stringList xcode::targetDevices

    A list of the Apple devices targeted by this product.

    For macOS, watchOS, and tvOS, this should always be \c "mac", \c "watch",
    and \c "tv", respectively. For iOS, this can be one or both of \c "iphone"
    and \c "ipad".

    \defaultvalue The list of all device types supported by the current
    platform. Determined by \l{qbs::targetOS}{qbs.targetOS}.
*/

/*!
    \qmlproperty string xcode::sdkName
    \readonly

    The canonical name of the SDK used to build products.

    For example, \c macosx10.9.

    \defaultvalue \l{xcode::}{sdk}
*/

/*!
    \qmlproperty string xcode::sdkVersion
    \readonly

    The version number of the SDK used to build products.

    For example, 10.9.

    \defaultvalue \l{xcode::}{sdk}
*/

/*!
    \qmlproperty string xcode::latestSdkName
    \readonly

    The canonical name of the latest SDK available in the Xcode installation.

    For example, \c {macosx10.10}.

    \defaultvalue \l{xcode::}{developerPath}
*/

/*!
    \qmlproperty string xcode::latestSdkVersion
    \readonly

    The version number of the latest SDK available in the Xcode installation.

    For example, 10.10.

    \defaultvalue \l{xcode::}{developerPath}
*/

/*!
    \qmlproperty stringList xcode::availableSdkNames
    \readonly

    The canonical names of all SDKs available in the Xcode installation for the
    current platform.

    For example, \c {[macosx10.9, macosx10.10]}.

    \defaultvalue \l{xcode::}{developerPath}
*/

/*!
    \qmlproperty stringList xcode::availableSdkVersions
    \readonly

    The version numbers of all SDK available in the Xcode installation for the
    current platform.

    For example, \c {[10.9, 10.10]}.

    \defaultvalue \l{xcode::}{developerPath}
*/

/*!
    \qmlproperty path xcode::platformPath
    \readonly

    The path of the platform directory containing \l{xcode::}{sdkPath}.

    \defaultvalue \l{xcode::}{developerPath}
*/

/*!
    \qmlproperty path xcode::sdkPath
    \readonly

    The path of the SDK used to build products. Equivalent to
    \l{qbs::sysroot}{qbs.sysroot}.

    \defaultvalue Determined by \l{xcode::}{developerPath} and \l{xcode::}{sdk}.
*/
qbs-src-3.2.0/doc/reference/modules/lexyacc-module.qdoc0000644000175100017510000001047315154533055022445 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype lex_yacc
    \inqmlmodule QbsModules
    \since Qbs 1.6

    \brief Provides support for the \c lex and \c yacc tools.

    The \c lex_yacc module allows you to create scanners and parsers via the POSIX tools \c lex
    and \c yacc, respectively. These tools are closely related and share a number of properties,
    which is why they are represented by a single module.

    \section2 Relevant File Tags
    \target filetags-lexyacc

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"lex.input"}
        \li \c{*.l}
        \li 1.6
        \li Source files with this tag serve as inputs to the \c lex tool.
    \row
        \li \c{"yacc.input"}
        \li \c{*.y}
        \li 1.6
        \li Source files with this tag serve as inputs to the \c yacc tool.
    \endtable
*/

/*!
    \qmlproperty bool lex_yacc::enableCompilerWarnings
    \since Qbs 1.8

    Whether compiler warnings are displayed.

    Because \c lex and \c yacc are known to produce files that will trigger
    compiler warnings, such warnings are suppressed by default. Set this
    property to \c true if you want to see them.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty string lex_yacc::lexBinary

    The file path of the \c lex tool.

    \defaultvalue \c{"lex"}
*/

/*!
    \qmlproperty stringList lex_yacc::lexFlags

    Additional command-line options for the \c lex tool.

    \defaultvalue \c []
*/

/*!
    \qmlproperty string lex_yacc::lexOutputFilePath

    The output file for the \c lex tool.

    This corresponds to \c{%option outfile} in the .l file.
    If \c{%option outfile} is set in the .l file then this property is ignored.

    \defaultvalue \c undefined
    \since 1.12
*/

/*!
    \qmlproperty string lex_yacc::outputTag

    The file tag for the generated scanner and parser sources.

    Use \l{filetags-cpp}{"cpp"} if you want to use a C++ compiler on them.

    \defaultvalue \l{filetags-cpp}{"c"}
*/

/*!
    \qmlproperty bool lex_yacc::uniqueSymbolPrefix

    If this property is \c true, the prefix \c yy normally used for the
    generated lexer and parser functions is replaced by the base name of the
    file provided as input to \c lex and \c yacc, respectively.

    Enable this property if you want to use more than one lexer or parser in a
    single product.

    \note Enabling this property requires that the associated lexer and scanner
    source files have the same base name. It also assumes a variant of \c lex
    that supports the non-POSIX option \c{-P}, such as \c flex.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty string lex_yacc::yaccBinary

    The file path of the \c yacc tool.

    \defaultvalue \c{"yacc"}
*/

/*!
    \qmlproperty stringList lex_yacc::yaccFlags

    Additional command-line options for the \c yacc tool.

    \defaultvalue \c []
*/

/*!
    \qmlproperty string lex_yacc::yaccOutputFilePath

    Main output file for the \c yacc tool.

    This corresponds to \c{%output} in the .y file.
    If \c{%output} is set in the .y file then this property is ignored.

    \defaultvalue \c undefined
    \since 1.12
*/
qbs-src-3.2.0/doc/reference/modules/freedesktop-module.qdoc0000644000175100017510000001426615154533055023334 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2019 Alberto Mardegan
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype freedesktop
    \inqmlmodule QbsModules
    \since Qbs 1.16

    \brief Provides support for some freedesktop.org specifications.

    The \c freedesktop module contains properties and rules for building and working with
    applications compliant to freedesktop.org specifications on UNIX platforms.
    The areas in which this module can be of use include:

    \list
        \li Creation or post-processing of
            \l{https://specifications.freedesktop.org/desktop-entry-spec/latest/}{\c{.desktop}
            files}
        \li Installation of \l{https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html}{AppStream} metadata
        \li Defining the location for
            \l{https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout}
            {application icons}
    \endlist

    This module is available on all platforms but is currently only useful on UNIX platforms.

    \section2 Example usage
    \target example-freedesktop

    \code
    Application {
        ...
        Depends { name: "freedesktop" }

        Group {
            files: [
                ...

                // Declare the desktop and appstream files
                "data/my-app.desktop",
                "data/my-app.metainfo.xml",
            ]
        }

        // Add/change some fields in the desktop file
        freedesktop.desktopKeys: ({
            'Exec': FileInfo.joinPaths(qbs.installPrefix,
                                       product.installDir,
                                       product.targetName) + ' --argument',
            'X-Application-Version': product.version,
        })

        // Define the source directory for application icons
        freedesktop.hicolorRoot: project.sourceDirectory + "/icons/"

        // Declare the application icons
        Group {
            prefix: project.sourceDirectory + "/icons/"
            files: [
                "32x32/apps/my-application.png",
                "32x32@2/apps/my-application.png",
                "32x32/mimetypes/application-format.png",
                ...
                "scalable/apps/my-application.svg",
            ]
            fileTags: "freedesktop.appIcon"
        }
    }
    \endcode

    \section2 Relevant File Tags
    \target filetags-freedesktop

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"freedesktop.desktopfile_source"}
        \li \c{*.desktop}
        \li 1.16
        \li A source file with this tag is a \c{.desktop} file or fragment that
            will be merged into the application's final \c{.desktop} file.
    \row
        \li \c{"freedesktop.desktopfile"}
        \li -
        \li 1.16
        \li Attached to the output artifacts of the rule that produces the
            merged \c{.desktop} file.
    \row
        \li \c{"freedesktop.appstream"}
        \li \c{*.metainfo.xml}, \c{*.appdata.xml}
        \li 1.16
        \li Source files with this tag are AppStream metadata files which will
            be installed under \l{qbs::}{installPrefix}\c{/share/metainfo}
    \row
        \li \c{"freedesktop.appIcon"}
        \li -
        \li 1.16
        \li Source files with this tag are application icons compliant with the
            \l{https://specifications.freedesktop.org/icon-theme-spec/}{freedesktop.org Icon Theme Specification}.
            These icons will be installed under \l{qbs::}{installPrefix}\c{/share/icons/hicolor} in their
            respective resolution-based directories (e.g., \c{48x48/apps/}, \c{256x256/apps/}),
            ensuring compatibility with desktop environments following this specification.

            \note After Qbs version 2.5, the \c{hicolorRoot} property must be set to define the source directory for
            these icons. Without setting this property, icons will not be installed.
    \endtable
*/

/*!
    \qmlproperty string freedesktop::appName

    The display name of the application which will be stored in the \c{.desktop} file.

    \defaultvalue \l{Product::name}{product.name}
*/

/*!
    \qmlproperty var freedesktop::desktopKeys

    A dictionary of key-value pairs to add to the application's \c{.desktop}
    file.

    The contents of this property will be aggregated with the values from any
    \c{.desktop} file. If this property and any \c{.desktop} files contain the
    same key, this property will take precedence.

    \nodefaultvalue
*/

/*!
    \qmlproperty string freedesktop::hicolorRoot

    Defines the source directory for application icons, which are installed
    according to the \l{https://specifications.freedesktop.org/icon-theme-spec/}{freedesktop.org Icon Theme Specification}.
    It is used with the \c{freedesktop.appIcon} tag to install icons into the
    \c{share/icons/hicolor} directory structure (e.g., \c{48x48/apps/}, \c{256x256/apps/}).

    If \c{hicolorRoot} is not set, icons will not be installed. Set this property
    to the path containing your icon files.

    \nodefaultvalue
    \since 2.5
*/
qbs-src-3.2.0/doc/reference/modules/dmg-module.qdoc0000644000175100017510000003165115154533055021565 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype dmg
    \inqmlmodule QbsModules
    \since Qbs 1.9

    \brief Provides support for building Apple Disk Images.

    The \c dmg module contains properties and rules for building Apple Disk Images, which are
    typically used to distribute applications and installers on macOS.

    This module is only available on Apple platforms.

    \QBS enables you to build macOS disk images with custom backgrounds and icon
    layouts. Most applications on macOS are installed via a \c .dmg file, which
    is usually customized by using a custom image background and icon layout.
    Unfortunately, it is challenging to construct such DMG files correctly,
    because the layout relies on several undocumented proprietary file formats,
    some of which date back to the Mac OS Classic days, and which are even
    nested within one another.

    Most of the existing tools to create DMG files do so by using AppleScript to
    manipulate the Finder graphically to generate the appropriate icon layout,
    which is both unstable and incompatible with headless build servers, because
    the necessary OS services to launch graphical applications may not be
    running at all. Many projects create the primary \c .DS_Store
    file manually, and commit the result to their source repository. This binary
    blob is difficult to inspect and edit, and might not be backwards compatible
    with older versions of the OS, depending on how it was generated.

    \QBS takes a different approach. It generates the necessary files
    programmatically, in an entirely reproducible manner. There are no external
    dependencies that need to be separately installed nor do any binary blobs
    need to be committed to your source repository.

    \section2 Appearance Properties

    Appearance properties are used to control the contents of the .DS_Store file
    and its embedded Alias and Bookmark records, that will be generated by \QBS
    in order to control the appearance of the disk image when mounted in Finder.

    \section2 License Properties

    License properties are used to control the content and appearance of the
    license prompt displayed when a user attempts to mount the resulting disk
    image via Finder.

    \section2 Relevant File Tags
    \target filetags-dmg

    The file tags determine how the tagged files are handled.

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"dmg.input"}
        \li n/a
        \li 1.9
        \li Tagged files are copied into the disk image. The
            \l{dmg::}{sourceBase} property controls the destination directory
            and hierarchy of copied files within the disk image.
    \row
        \li \c{"dmg.license.input"}
        \li \c{*.txt}, \c{*.rtf}, \c{*.html}, \c{*.doc}, \c{*.docx}, \c{*.odt}, \c{*.xml},
            \c{*.webarchive}
        \li 1.9
        \li Tagged files are converted into rich text and used for the license
            prompt when mounting the DMG.
    \row
        \li \c{"icns"}
        \li \c{*.icns}
        \li 1.3
        \li The tagged file is added as the Apple Disk Image volume icon, which
            will show up in the Finder as an overlay on the file icon.
    \row
        \li \c{"tiff"}
        \li \c{*.tif}, \c{*.tiff}
        \li 1.9
        \li The tagged file is used as the background image of the directory as
            shown in Finder when the DMG file is mounted.
    \endtable
*/

/*!
    \qmlproperty string dmg::volumeName

    The name of the disk image that is displayed in Finder when the DMG is
    mounted.

    \defaultvalue \l{Product::targetName}{product.targetName}
*/

/*!
    \qmlproperty bool dmg::badgeVolumeIcon

    Whether to render the user-supplied icon (\l{filetags-dmg}{"icns"}) on top
    of the default volume icon instead of using it directly. This generally
    gives the disk image icon a better and more consistent appearance.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty string dmg::format

    The format to create the disk image in.

    Allowed values include but are not limited to \c{"UDZO"}, \c{"UDBZ"}, and
    \c{"ULFO"}.

    \defaultvalue \c{"UDBZ"}
*/

/*!
    \qmlproperty int dmg::compressionLevel

    The \c zlib, \c bzip2, or \c lzfse compression level for UDZO, UDBZ, or ULFO
    disk images.

    \defaultvalue \c 9 in release mode, otherwise \c undefined.
*/

/*!
    \qmlproperty string dmg::sourceBase

    The base directory of the files that are going to be embedded in the DMG
    (\l{filetags-dmg}{"dmg.input"}). The source base directory
    is omitted from the target directory path of the DMG directory.

    \defaultvalue The directory of the current file to be embedded, relative to
    the product's source directory.
*/

/*!
    \qmlproperty string dmg::backgroundColor

    The background color of the disk image as seen when mounted in Finder.

    For the full list of supported color names and formats, see the
    \l{dmgbuild - Settings} documentation.

    For more information about how to use an image for the background instead,
    see \l{filetags-dmg}{"tiff"}.

    \nodefaultvalue
*/

/*!
    \qmlproperty int dmg::iconSize

    The width and height of the file icons as seen when the disk image is
    mounted in Finder.

    \defaultvalue \c{128}
*/

/*!
    \qmlproperty int dmg::windowX

    The x position of the Finder window that displays the disk image contents
    when it is mounted.

    \defaultvalue \c{100}
*/

/*!
    \qmlproperty int dmg::windowY

    The y position of the Finder window that displays the disk image contents
    when it is mounted.

    \defaultvalue \c{100}
*/

/*!
    \qmlproperty int dmg::windowWidth

    The width of the Finder window that displays the disk image contents
    when it is mounted.

    \defaultvalue \c{640}
*/

/*!
    \qmlproperty int dmg::windowHeight

    The height of the Finder window that displays the disk image contents when
    it is mounted.

    \note The window height includes the height of the standard macOS title bar
    (22 points).

    \defaultvalue \c{480}
*/

/*!
    \qmlproperty list dmg::iconPositions

    A list of objects containing the \c{path}, \c{x}, and \c{y} properties,
    which correspond to disk image-relative file paths and visual coordinates of
    file icons in the disk image as seen when it is mounted in Finder.

    For example:

    \code
    dmg.iconPositions: [
        {"path": "Applications", "x": 128, "y": 128},
        {"path": "Foo Bar.app", "x": 256, "y": 128}
    ]
    \endcode

    This property is useful for specifying the positions of files where you do
    not have direct control over the corresponding \QBS artifact, or there is no
    corresponding \QBS artifact (for example, "Foo Bar.app" is a directory,
    which has no equivalent artifact in the build graph).

    For files to which you are directly applying the \l{filetags-dmg}{dmg.input}
    file tag, you should use the \l{dmg::}{iconX} and \l{dmg::}{iconY}
    properties instead.

    \nodefaultvalue
*/

/*!
    \qmlproperty int dmg::iconX

    The x position of the file icon in the Finder window that displayed the disk
    image contents when it is mounted.

    This property is only useful with artifacts tagged \l{filetags-dmg}
    {dmg.input}. It cannot be used at the product level to affect all files.

    If you do not have access to the artifact corresponding to the file whose
    position you want to set, use the \l{dmg::}{iconPositions} property instead.

    \defaultvalue \c{windowWidth / 2}
*/

/*!
    \qmlproperty int dmg::iconY

    The y position of the file icon in the Finder window that displayed the disk
    image contents when it is mounted.

    This property is only useful with artifacts tagged \l{filetags-dmg}
    {dmg.input}. It cannot be used at the product level to affect all files.

    If you do not have access to the artifact corresponding to the file whose
    position you want to set, use the \l{dmg::}{iconPositions} property instead.

    \defaultvalue \c{windowHeight / 2}
*/

/*!
    \qmlproperty string dmg::defaultLicenseLocale

    The locale of the default license to display when there is no license whose
    locale matches the system locale.

    \defaultvalue \c{"en_US"}
*/

/*!
    \qmlproperty string dmg::licenseLocale

    The locale of the license file.

    Defaults to a value guessed from the file path, specifically the base name
    of any \c .lproj directory found in the file's path. If the locale could not
    be determined from the file path and this property is not set, an error will
    be emitted.

    This property is only useful with artifacts tagged \l{filetags-dmg}
    {dmg.license.input}. It cannot be used at the product level to affect all
    files.

    \defaultvalue Determined automatically.
*/

/*!
    \qmlproperty string dmg::licenseLanguageName

    The name of the language associated with the license file, localized to that
    language.

    This property is only useful with artifacts tagged \l{filetags-dmg}
    {dmg.license.input}. It cannot be used at the product level to affect all
    files.

    \defaultvalue \c{"English"}
*/

/*!
    \qmlproperty string dmg::licenseAgreeButtonText

    The text shown on the \e Agree button associated with the license file,
    localized to the value of \l{dmg::}{licenseLanguageName}.

    This property is only useful with artifacts tagged \l{filetags-dmg}
    {dmg.license.input}. It cannot be used at the product level to affect all
    files.

    \defaultvalue \c{"Agree"}
*/

/*!
    \qmlproperty string dmg::licenseDisagreeButtonText

    The text shown on the \c Disagree button associated with the license file,
    localized to the value of \l{dmg::}{licenseLanguageName}.

    This property is only useful with artifacts tagged \l{filetags-dmg}
    {dmg.license.input}. It cannot be used at the product level to affect all
    files.

    \defaultvalue \c{"Disagree"}
*/

/*!
    \qmlproperty string dmg::licensePrintButtonText

    The text shown on the \c Print button associated with the license file,
    localized to the value of \l{dmg::}{licenseLanguageName}.

    This property is only useful with artifacts tagged \l{filetags-dmg}
    {dmg.license.input}. It cannot be used at the product level to affect all
    files.

    \defaultvalue \c{"Print"}
*/

/*!
    \qmlproperty string dmg::licenseSaveButtonText

    The text shown on the \e Save button associated with the license file,
    localized to the value of \l{dmg::}{licenseLanguageName}.

    This property is only useful with artifacts tagged \l{filetags-dmg}
    {dmg.license.input}. It cannot be used at the product level to affect all
    files.

    \defaultvalue \c{"Save"}
*/

/*!
    \qmlproperty string dmg::licenseInstructionText

    An instruction text associated with the license file that will be shown on
    the license dialog, localized to the value of
    \l{dmg::}{licenseLanguageName}.

    This property is only useful with artifacts tagged \l{filetags-dmg}
    {dmg.license.input}. It cannot be used at the product level to affect all
    files.

    \defaultvalue \c{"If you agree with the terms of this license, press
    \"Agree\" to install the software. If you do not agree, press
    \"Disagree\"."}
*/

/*!
    \qmlproperty string dmg::dmgSuffix

    The file extension for disk images.

    This should not normally need to be changed.

    \defaultvalue \c{".dmg"}
*/

/*!
    \qmlproperty string dmg::hdiutilPath

    The path to the \c hdiutil binary used to perform disk image related
    operations.

    This should not normally need to be changed.

    \defaultvalue \c{"/usr/bin/hdiutil"}
*/

/*!
    \qmlproperty string dmg::textutilPath

    The path to the \c textutil binary used to convert license agreement files
    to rich text format.

    This should not normally need to be changed.

    \defaultvalue \c{"/usr/bin/textutil"}
*/
qbs-src-3.2.0/doc/reference/modules/pkgconfig-module.qdoc0000644000175100017510000000617215154533055022765 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype pkgconfig
    \inqmlmodule QbsModules
    \since 1.13

    \brief Allows to configure the pkg-config tool.

    The \c pkgconfig module is used to fine-tune the behavior of the \c {pkg-config} tool,
    which is
    \l{How do I build against libraries that provide pkg-config files?}{potentially employed}
    when looking up dependencies.
*/

/*!
    \qmlproperty string pkgconfig::executableFilePath

    The path to the \c {pkg-config} executable.

    \defaultvalue auto-detected
*/

/*!
    \qmlproperty stringList pkgconfig::libDirs

    Set this if you need to overwrite the default search directories. The values
    given here will be forwarded to the tool via the \c PKG_CONFIG_LIBDIR environment
    variable.
    \note You do not need to set this for cross-compilation in order to point
          \c {pkg-config} to the sysroot. \QBS does that for you.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool pkgconfig::staticMode

    If this property is \c true, then calls to \c{pkg-config} will include the
    \c{--static} option. Set this if your product is to be linked statically.

    \defaultvalue \c false
*/

/*!
    \qmlproperty path pkgconfig::sysroot

    This property controls the value of the \l{PkgConfigProbe::sysroot}{PkgConfigProbe.sysroot}
    property.

    Set this property if you need to overwrite the default search sysroot path used by
    \c pkg-config.

    This can be useful if \c pkg-config files are located in the directory other than qbs.sysroot.
    This is the case on macOS platform - all XCode profiles are sysrooted to the SDK
    directory, but \c pkg-config is typically intalled using Brew and resides in the
    \c /usr/local directory.

    Setting this property to \c undefined or empty (\c "") value will use pkg-config's default
    search paths:
    \code
        qbs build modules.pkgconfig.sysroot:undefined
    \endcode

    \defaultvalue \c "" on macOS, \c qbs.sysroot on other platforms
*/
qbs-src-3.2.0/doc/reference/modules/texttemplate-module.qdoc0000644000175100017510000001001015154533055023520 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype texttemplate
    \inqmlmodule QbsModules
    \since Qbs 1.13

    \brief Provides support for text template files.

    The \c texttemplate module provides support for text template files.

    \section2 Example

    Consider the following text file \e{greeting.txt.in}.

    \code
    ${greeting} ${name}!
    \endcode

    This can be used in a project like this:

    \code
    Product {
        type: ["text"]
        files: ["greeting.txt.in"]
        Depends { name: "texttemplate" }
        texttemplate.dict: ({
                greeting: "Hello",
                name: "World"
            })
    }
    \endcode

    Which will create the file \e{greeting.txt}.

    \code
    Hello World!
    \endcode

    The same result can be achieved using the alternative placeholder format:

    \code
    Product {
        type: ["text"]
        files: ["greeting.txt.in"]
        Depends { name: "texttemplate" }
        texttemplate.placeholder: "@@"
        texttemplate.dict: ({
                greeting: "Hello",
                name: "World"
            })
    }
    \endcode

    Where \e{greeting.txt.in} contains:

    \code
    @greeting@ @name@!
    \endcode


    \section2 Placeholder Syntax

    The texttemplate module supports two placeholder formats, controlled by the
    \c{placeholder} property.

    A placeholder \c{${foo}} is replaced by its corresponding value in
    \e{texttemplate.dict}.
    Placeholder names consist of alphanumeric characters only.

    The placeholder \c{${$}} is always replaced with \c{$}.
    If you need a literal \c{${foo}} in your template, use \c{${$}{foo}}.

    When \c{texttemplate.placeholder} is set to \c{"@@"}, placeholders use
    the format \c{@foo@} instead.

    Placeholders that are not defined in the dictionary will produce an error.


    \section2 Relevant File Tags
    \target filetags-texttemplate

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"texttemplate.input"}
        \li \c{*.in}
        \li 1.13.0
        \li Source files with this tag serve as inputs for the text template rule.
    \endtable
*/

/*!
    \qmlproperty var texttemplate::dict

    The dictionary containing values for all keys used in the template file.

    \defaultvalue \c{{}}
*/

/*!
    \qmlproperty string texttemplate::outputFileName

    The output file name that is assigned to produced artifacts.

    \defaultvalue Complete base name of the input file
*/

/*!
    \qmlproperty string texttemplate::outputTag

    The output tag that is assigned to produced artifacts.

    \defaultvalue \c{"text"}
*/

/*!
    \qmlproperty string texttemplate::placeholder

    The placeholder format to use for text template files.

    Possible values: \c{"${}"}, \c{"@@"}

    \defaultvalue \c{"${}"}
    \since Qbs 3.1
*/
qbs-src-3.2.0/doc/reference/modules/exporter-pkgconfig-module.qdoc0000644000175100017510000001573615154533055024641 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Exporter.pkgconfig
    \inqmlmodule QbsModules
    \since Qbs 1.12

    \brief Provides support for generating pkg-config files.

    The \c Exporter.pkgconfig module contains the properties and rules to create a
    \l{https://www.freedesktop.org/wiki/Software/pkg-config}{pkg-config}
    metadata (\c{.pc}) file for a \l Product.

    By default, \QBS will attempt to derive some of the \c {.pc} file's contents from
    the product's \l Export item. This behavior can be suppressed by setting the
    \l autoDetect property to \c false.

    \section2 Relevant File Tags
    \target filetags-exporter-pkgconfig

    \table
    \header
        \li Tag
        \li Since
        \li Description
    \row
        \li \c{"Exporter.pkgconfig.pc"}
        \li 1.12.0
        \li This tag is attached to the generated \c{.pc} file.
    \endtable
*/

/*!
    \qmlproperty bool Exporter.pkgconfig::autoDetect

    If this property is enabled, then \QBS will try to derive various \c {.pc} file
    entries from the contents of the product's \l Export item, including the dependencies
    declared therein. Values for these fields can still be explicitly provided via the
    respective properties, in which case they will be concatenated with the auto-detected ones.
    If an exported dependency is known to correspond to a pkg-config module (either by
    pulling in the \c{Exporter.pkgconfig} module or by appearing in the \l requiresEntry
    property), it will end up in the \c Requires field of the \c{.pc} file, otherwise
    its exported \l cpp properties will be collected for use in the \c Cflags and \c Libs fields.
    The \l excludedDependencies property can be used to ignore specific products altogether.

    \defaultvalue \c true
*/

/*!
    \qmlproperty stringList Exporter.pkgconfig::cflagsEntry

    The value of the \c Cflags field in the \c {.pc} file.

    If \l autoDetect is enabled, then this value will be appended to the flags derived from
    the product's \l Export item and the dependencies declared therein.

    \defaultvalue \c {[]}
*/

/*!
    \qmlproperty stringList Exporter.pkgconfig::conflictsEntry

    The value of the \c Conflicts field in the \c {.pc} file.

    \defaultvalue \c {[]}
*/

/*!
    \qmlproperty stringList Exporter.pkgconfig::excludedDependencies

    If \l autoDetect is enabled, the entries of this property will be matched against
    the product's exported dependencies. In case such a dependency's name is present in the array,
    \QBS will not traverse that dependency to collect entries for the
    \c Cflags, \c Libs, \c Requires and \c {Requires.private} fields.

    This list must not contain any values that are present in \l requiresEntry.

    \defaultvalue \c undefined
*/

/*!
    \qmlproperty string Exporter.pkgconfig::fileName

    The file name of the generated pkg-config metadata file.

    \defaultvalue \c {product.targetName + ".pc"}
*/

/*!
    \qmlproperty stringList Exporter.pkgconfig::libsEntry

    The value of the \c Libs field in the \c {.pc} file.

    If \l autoDetect is enabled, then this value will be appended to the flags derived from
    the product's \l Export item and the dependencies declared therein.

    \defaultvalue \c {[]}
*/

/*!
    \qmlproperty stringList Exporter.pkgconfig::libsPrivateEntry

    The value of the \c Libs.Private field in the \c {.pc} file.

    \defaultvalue \c {[]}
*/

/*!
    \qmlproperty string Exporter.pkgconfig::nameEntry

    The value of the \c Name field in the \c {.pc} file.

    \defaultvalue \c {product.name}
*/


/*!
    \qmlproperty stringList Exporter.pkgconfig::requiresEntry

    The value of the \c Requires field in the \c {.pc} file.

    If \l autoDetect is enabled, then those of the product's exported dependencies
    that pull in the \c {Exporter.pkgconfig} module will also end up in the
    \c Requires field, provided they are not listed in \l excludedDependencies.

    If an exported dependency matches an entry of this array, \QBS will not traverse that
    dependency to gather \l cpp properties for use in the \l cflagsEntry and \l libsEntry values,
    as pkg-config takes care of that itself.

    \defaultvalue \c {[]}
*/

/*!
    \qmlproperty stringList Exporter.pkgconfig::requiresPrivateEntry

    The value of the \c Requires.private field in the \c {.pc} file.

    If \l autoDetect is enabled, then those of the product's non-exported dependencies
    that pull in the \c {Exporter.pkgconfig} module will also end up in the
    \c Requires.private field, provided they are not listed in \l excludedDependencies.

    \defaultvalue \c {[]}
*/

/*!
    \qmlproperty var Exporter.pkgconfig::transformFunction

    A function with the signature
    \c {function(product, moduleName, propertyName, value)}.
    This can be useful to "fine-tune" property values if \l autoDetect is enabled, in case
    they need amending for the purpose of pkg-config.
    The \c product parameter represents the exporting product, the remaining parameters describe
    the module property. The modified value of the module property shall be returned.

    \defaultvalue \c undefined
*/

/*!
    \qmlproperty string Exporter.pkgconfig::urlEntry

    The value of the \c URL field in the \c {.pc} file.

    \defaultvalue \c undefined
*/

/*!
    \qmlproperty string Exporter.pkgconfig::versionEntry

    The value of the \c Version field in the \c {.pc} file.

    \defaultvalue \c {product.version}
*/

/*!
    \qmlproperty string Exporter.pkgconfig::customVariables

    Use this property to add arbitrary variable assignments into the \c .pc file.
    The property is a map that will produce one assignment per entry.
    The keys and values of the map represent the left-hand sides and right-hand
    sides of these assignments, respectively. The values are strings that will
    be written into the file verbatim.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/modules/flatbuf-cpp-module.qdoc0000644000175100017510000000777015154533055023226 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype flatbuf.cpp
    \inqmlmodule QbsModules
    \since Qbs 2.4

    \brief Provides support for \l{https://google.github.io/flatbuf/}{flatbuf} for the
    C++ language.

    The \c flatbuf.cpp module provides support for generating C++ headers
    and sources from flatbuf definition files using the \c flatc tool.

    A simple qbs file that uses flatbuf can be written as follows:
    \code
    CppApplication {
        Depends { name: "flatbuf.cpp" }
        files: ["foo.fbs", "main.cpp"]
    }
    \endcode
    A generated header now can be included in the C++ sources:
    \code
        #include 

        int main(int argc, char* argv[]) {
            flatbuf::FlatBufferBuilder builder;

            auto foo = QbsTest::CreateFoo(builder, 42);
            return 0;
        }
    \endcode

    \section2 Relevant File Tags

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"flatbuf.input"}
        \li \c{*.fbs}
        \li 2.4.0
        \li Source files with this tag are considered inputs to the \c flatc compiler.
    \endtable

    \section2 Dependencies
    This module depends on the \c flatbuffers module which can be created via the \l{conan}{Conan}
    module provider.
*/

/*!
    \qmlproperty string flatbuf.cpp::compilerName

    The name of the \c flatc binary.

    \defaultvalue \c "flatc"
*/

/*!
    \qmlproperty string flatbuf.cpp::compilerPath

    The path to the \c flatc binary.

    Use this property to override the auto-detected location.

    \defaultvalue \c auto-detected
*/

/*!
    \qmlproperty string flatbuf.cpp::filenameExtension

    The extension appended to the generated file names. If not specified, the default extension
    (\c ".h") is used.

    This property corresponds to the \c --filename-ext option of the \c flatc tool.

    \nodefaultvalue
*/

/*!
    \qmlproperty string flatbuf.cpp::filenameSuffix

    The suffix appended to the generated file names. If not specified, the default suffix
    (\c "_generated") is used.

    This property corresponds to the \c --filename-suffix option of the \c flatc tool.

    \nodefaultvalue
*/

/*!
    \qmlproperty pathList flatbuf.cpp::importPaths

    The list of import paths that are passed to the \c flatc tool via the \c -I option.

    \defaultvalue \c []
*/

/*!
    \qmlproperty string flatbuf.cpp::includePrefix

    Prefix path prepended to any generated include statements.

    This property corresponds to the \c --include-prefix option of the \c flatc tool.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool flatbuf.cpp::keepPrefix

    Whether to keep original prefix of schema include statement.

    This property corresponds to the \c --keep-prefix option of the \c flatc tool.

    \defaultvalue \c false
*/
qbs-src-3.2.0/doc/reference/modules/android-sdk-module.qdoc0000644000175100017510000002024415154533055023211 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Android.sdk
    \inqmlmodule QbsModules
    \since Qbs 1.4

    \brief Provides support for building Android packages.

    The Android.sdk module contains the properties and rules to create Android
    application packages from Java sources, resources, and so on.
    It is usually pulled in indirectly by declaring an \l Application product.

    \section2 Relevant File Tags
    \target filetags-android-sdk

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"android.aidl"}
        \li \c{*.aidl}
        \li 1.4.0
        \li Attached to Android AIDL files. One Java source file will be
            generated for each such file.
    \row
        \li \c{"android.assets"}
        \li -
        \li 1.4.0
        \li Attached to Android assets, which are typically located in an
            \c{assets/} subdirectory. These files are tagged automatically
            if the \l automaticSources property is enabled.
    \row
        \li \c{"android.manifest"}
        \li \c{AndroidManifest.xml}
        \li 1.4.0
        \li Attached to the Android manifest. There must be one such file for
            every Android app.
    \row
        \li \c{"android.resources"}
        \li -
        \li 1.4.0
        \li Attached to Android resources, which are typically located in a
            \c{res/} subdirectory. These files are tagged automatically
            if the \l automaticSources property is enabled.
    \endtable
*/

/*!
    \qmlproperty string Android.sdk::buildToolsVersion

    The version of the build tools such as \c aapt and \c dx.

    \defaultvalue Highest build tools version version available in the SDK.
*/

/*!
    \qmlproperty string Android.sdk::ndkDir

    The NDK base directory, if an NDK is present.

    \defaultvalue Determined automatically based on standard search paths.
*/

/*!
    \qmlproperty string Android.sdk::platform

    The versioned platform name (for example, \c "android-21").

    \defaultvalue Highest build tools version version available in the SDK.
*/

/*!
    \qmlproperty string Android.sdk::sdkDir

    The SDK base directory.

    \defaultvalue Determined automatically based on standard search paths.
*/

/*!
    \qmlproperty bool Android.sdk::embedJar
    \since Qbs 1.10

    If \c true, then if the dependency is a JAR file, its classes and the
    classes of its dependencies (if \c{embedJar} is also true for them) will
    be recursively processed by \c{dex} and included in the final APK.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty path Android.sdk::assetsDir

    The base directory for Android assets in the respective product.

    \note Android requires that the file name of this directory is always
    \c "assets".

    \defaultvalue \c "src/main/assets" in the product source directory
*/

/*!
    \qmlproperty bool Android.sdk::automaticSources

    If \c true, Java sources as well as Android resources, assets, and the
    manifest file will be automatically included in the respective product
    via wildcards. Set this property to \c false if you want to specify
    these files manually.

    \defaultvalue \c true
*/

/*!
    \qmlproperty string Android.sdk::manifestFile

    The file path to the Android manifest file.
    This property is only relevant if \l automaticSources is enabled.

    \note Android requires that the file name is always "AndroidManifest.xml".

    \defaultvalue \c "src/main/AndroidManifest.xml" in the product source directory
*/

/*!
    \qmlproperty string Android.sdk::packageName

    The package name of the respective product. The \c package attribute in the manifest file
    will be set to this value automatically.

    \defaultvalue \c name
*/

/*!
    \qmlproperty string Android.sdk::versionCode

    The Android Manifest version code of the respective product. The \c android:versionCode
    attribute in the manifest file will be set to this value if not undefined.

    In the following example we provide an architecture-specific value
    for \c android:versionCode:

    \code
    // ...
    property int _version: 1
    property int _patchVersion: 0
    Android.sdk.versionCode: {
        switch (Android.ndk.abi) {
        case "armeabi-v7a":
            return 132000000 | _version * 10 + _patchVersion;
        case "arm64-v8a":
            return 164000000 | _version * 10 + _patchVersion;
        case "x86":
            return 232000000 | _version * 10 + _patchVersion;
        case "x86_64":
            return 264000000 | _version * 10 + _patchVersion;
        }
        throw "Unknown architecture";
    }
    \endcode

    \defaultvalue \c undefined
*/

/*!
    \qmlproperty string Android.sdk::versionName

    The Android Manifest version name of the respective product. The \c android:versionName
    attribute in the manifest file will be set to this value if not undefined.

    \defaultvalue \c undefined
*/

/*!
    \qmlproperty path Android.sdk::resourcesDir

    The base directory for Android resources in the respective product.

    \note Android requires that the file name of this directory is always
    \c "res".

    \defaultvalue \c "src/main/res" in the product source directory
*/

/*!
    \qmlproperty path Android.sdk::sourcesDir

    The base directory for Java sources. This property is only relevant if
    \l automaticSources is enabled.

    \defaultvalue \c "src/main/java" in the product source directory
*/

/*!
    \qmlproperty string Android.sdk::apkBaseName

    The base name of the APK file to to be built, that is, the file name
    without the ".apk" extension.

    \defaultvalue \l packageName
*/

/*!
  \qmlproperty stringList Android.sdk::aidlSearchPaths
  Search paths for import statements to pass to the \c aidl tool via the \c{-I} option.
*/

/*!
    \qmlproperty string Android.sdk::aaptName
    \since Qbs 1.17

    Name of the aapt binary. Allowed options: "aapt" and "aapt2".

    \defaultvalue \c "aapt2"
*/

/*!
    \qmlproperty string Android.sdk::packageType
    \since Qbs 1.17

    Type of the package. Allowed options: "apk" and "aab".
    Type "apk" generates a runnable package whereas "aab" generates a package for Google Play.

    \defaultvalue \c "apk"
*/

/*!
    \qmlproperty stringList Android.sdk::extraResourcePackages
    \since Qbs 2.5

    List of additional Java package names to compile resources for.

    \defaultvalue \c undefined
*/

/*!
    \qmlproperty string Android.sdk::dexCompilerName
    \since Qbs 1.20

    Name of the dex compiler binary. Allowed options: "dx" and "d8".

    \defaultvalue \c "d8"
*/

/*!
    \qmlproperty bool Android.sdk::d8Desugaring
    \since Qbs 2.5

    Whether desugaring is enabled for "d8" dex compiler.

    \defaultvalue \c false
*/

/*!
    \qmlproperty string Android.sdk::minimumVersion
    \since Qbs 1.17

    Minimum API Level required for the application to run.

    \defaultvalue \c "21"
*/

/*!
    \qmlproperty string Android.sdk::targetVersion
    \since Qbs 1.17

    API Level that the application targets.

    \defaultvalue \c platformVersion
*/
qbs-src-3.2.0/doc/reference/modules/qt-declarative-module.qdoc0000644000175100017510000000370115154533055023716 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Qt.declarative
    \inqmlmodule QbsModules
    \brief Provides Qt Quick 1 support.

    The Qt.declarative module provides support for Qt Quick 1.

    \sa Qt.quick, Qt.qml
*/

/*!
    \qmlproperty bool Qt.declarative::qmlDebugging

    Whether QML debugging support is compiled into your binaries.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty string Qt.declarative::qmlImportsPath

    The absolute path to the directory where Qt's QML imports are installed.

    \defaultvalue Determined by \l{setup-qt}.
*/

/*!
    \qmlproperty string Qt.declarative::qmlPath

    The absolute path to the directory where Qt's QML files are installed.
    This property is left undefined for Qt 4.

    \defaultvalue Determined by \l{setup-qt}.
*/
qbs-src-3.2.0/doc/reference/modules/cpufeatures-module.qdoc0000644000175100017510000001214415154533055023340 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype cpufeatures
    \inqmlmodule QbsModules
    \since Qbs 1.10

    \brief Provides support for fine-tuning CPU features.

    The \c cpufeatures module offers properties for enabling or disabling specific CPU features.
    Use it if you want to override the compiler defaults for a given platform.

    The compiler rules in the \l{cpp} module evaluate this module's properties
    and generate matching compiler flags.
    All properties in this module are of type \c bool and have the following semantics:
    \list
    \li The default value \c undefined has no effect on the compiler command line.
    \li If the value is \c true and the compiler has a flag to enable the feature, that flag
        is added to the command line if it is applicable to the current architecture.
        For example, enabling the property \c x86_sse2 would result in the GCC option \c{-msse2}.
    \li If the value is \c false and the compiler has a flag to disable the feature,
        that flag is added to the command line if it is applicable to the current architecture.
        For example, disabling the property \c x86_sse2 would result in the GCC option
        \c{-no-msse2}.
    \endlist
*/

/*!
    \qmlproperty bool cpufeatures::arm_neon

    Whether to use NEON instructions in ARM binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::arm_vfpv4

    Whether to use VFPv4 instructions in ARM binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::mips_dsp

    Whether to use DSP instructions in MIPS binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::mips_dspr2

    Whether to use DSPr2 instructions in MIPS binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_avx

    Whether to use AVX instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_avx2

    Whether to use AVX2 instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_avx512bw

    Whether to use AVX-512-BW instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_avx512cd

    Whether to use AVX-512-CD instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_avx512dq

    Whether to use AVX-512-DQ instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_avx512er

    Whether to use AVX-512-ER instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_avx512f

    Whether to use AVX-512 instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_avx512ifma

    Whether to use AVX-512-IFMA instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_avx512pf

    Whether to use AVX-512-PF instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_avx512vbmi

    Whether to use AVX-512-VBMI instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_avx512vl

    Whether to use AVX-512-VL instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_f16c

    Whether to use F16C instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_sse2

    Whether to use SSE2 instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_sse3

    Whether to use SSE3 instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_ssse3

    Whether to use SSSE3 instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_sse4_1

    Whether to use SSE4.1 instructions in x86 binaries.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool cpufeatures::x86_sse4_2

    Whether to use SSE4.2 instructions in x86 binaries.

    \nodefaultvalue
*/
qbs-src-3.2.0/doc/reference/modules/qt-gui-module.qdoc0000644000175100017510000000372415154533055022224 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Qt.gui
    \inqmlmodule QbsModules
    \brief Provides Qt GUI support.

    The Qt.gui module provides support for the Qt GUI module, which contains
    base classes for graphical user interface (GUI) components.

    \section2 Relevant File Tags
    \target filetags-gui

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"ui"}
        \li \c{*.ui}
        \li 1.0
        \li Source files with this tag serve as inputs to the rule running the
            \c uic tool.
    \endtable
*/

/*!
    \qmlproperty string Qt.gui::uicName

    The base name of the \c uic tool.

    Set this property if your system uses a name such as \c uic-qt4.

    \defaultvalue \c{"uic"}
*/
qbs-src-3.2.0/doc/reference/modules/vcs-module.qdoc0000644000175100017510000001456415154533055021615 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype vcs
    \inqmlmodule QbsModules
    \since Qbs 1.10

    \brief Provides support for version control systems (Git, SVN, Mercurial).

    The \c vcs module provides information about the current state of the project's repository.
    This is useful for embedding version information directly into your binaries, such as the
    latest tag, number of commits since the tag, and current commit hash.

    By default, a C header file is generated, which defines macros representing the repository
    state. This allows C/C++ code to access this information at run time.

    Supported version control systems:
    \list
        \li Git
        \li Subversion (SVN)
        \li Mercurial (hg)
    \endlist

    For example:

    \code
    #include 
    #include 

    int main()
    {
        std::cout << "I was built from " << VCS_REPO_STATE << std::endl;
        std::cout << "Latest tag: " << VCS_REPO_LATEST_TAG << std::endl;
        std::cout << "Commits since tag: " << VCS_REPO_COMMITS_SINCE_TAG << std::endl;
        std::cout << "Commit SHA: " << VCS_REPO_COMMIT_SHA << std::endl;
    }
    \endcode

    Above, a header file called \c{vcs-repo-state.h} is created, defining a
    macro called \c VCS_REPO_STATE, which expands to a character constant
    describing the current state of the repository. For Git, this would be the
    current HEAD's commit hash.

    Example:

    \code
    VCS_REPO_STATE = "v1.2.3-5-gabcdef0"
    VCS_REPO_LATEST_TAG = "v1.2.3"
    VCS_REPO_COMMITS_SINCE_TAG = "5"
    VCS_REPO_COMMIT_SHA = "gabcdef0"
    \endcode

    For Git repositories without any tags, the commit hash will be used instead.
    For Mercurial repositories, the full repository state is always shown.
    For SVN, only \l{vcs::}{repoState} is currently available.
*/

/*!
    \qmlproperty string vcs::headerFileName

    The name of the C header file to be generated. This header file defines the following macros:

    \list
        \li \c VCS_REPO_STATE — Full repository state string
        \li \c VCS_REPO_LATEST_TAG — Latest tag reachable from HEAD (or "none")
        \li \c VCS_REPO_COMMITS_SINCE_TAG — Number of commits since latest tag (or "none")
        \li \c VCS_REPO_COMMIT_SHA — Current commit SHA (or "none")
    \endlist

    Set this to \c undefined to disable header file generation.

    \defaultvalue \c{"vcs-repo-state.h"}
*/

/*!
    \qmlproperty string vcs::repoDir

    The root directory of the repository.

    \defaultvalue The top-level project directory (\l{Project::sourceDirectory}
    {project.sourceDirectory}).
*/

/*!
    \qmlproperty string vcs::repoState

    The full repository state string.

    For Git, this corresponds to the output of:
    \c {git describe --tags --always --long HEAD}

    Example values:
    \list
        \li \c abc1234 (no tags)
        \li \c abc1234-0-gabc1234 (at tag)
        \li \c v1.0.0-3-gabc1234 (3 commits after tag)
    \endlist

    For Mercurial, this corresponds to the output of:
    \c {hg log -r . --template "{latesttag}-{latesttagdistance}-m{node|short}"}

    Example values:
    \list
        \li \c null-0-m000000000000 (empty repo)
        \li \c null-1-mabc1234 (no tags)
        \li \c null-3-mabc1234 (4 commits, no tags)
        \li \c v1.0.0-1-mabc1234 (at tag)
        \li \c v1.0.0-3-mabc1234 (4 commits after tag)
    \endlist

    For SVN, this is the current revision number.

    \nodefaultvalue
*/

/*!
    \qmlproperty string vcs::repoLatestTag

    The latest reachable tag in the repository.

    For Git, this is the \c TAG component from \c git describe output.
    If no tags are present, this will be set to \c "none".

    For Mercurial, this is the \c {latesttag} component from the template.

    For SVN, this property is currently not set and will be \c "none".

    \nodefaultvalue
    \since Qbs 3.1.0
*/

/*!
    \qmlproperty string vcs::repoCommitsSinceTag

    The number of commits since the latest tag.

    For Git, this is the \c N component from \c git describe output.
    If no tags are present, this will be set to \c "none".

    For Mercurial, this is the \c {latesttagdistance} component from the template.

    For SVN, this property is currently not set and will be \c "none".

    \nodefaultvalue
    \since Qbs 3.1.0
*/

/*!
    \qmlproperty string vcs::repoCommitSha

    The abbreviated commit hash of HEAD.

    For Git, this is the \c gSHA component from \c git describe output.
    If no tags are present, this will be set to the commit hash prefixed with \c g.

    For Mercurial, this is the \c m{node|short} component from the template.

    For SVN, this property is currently not set and will be \c "none".

    \nodefaultvalue
    \since Qbs 3.1.0
*/

/*!
    \qmlproperty string vcs::toolFilePath

    Set this property if the tool has an unusual name in your local
    installation, or if it is located in a directory that is not in the build
    environment's \c PATH.

    \defaultvalue The file name of the version control tool corresponding to
    \l{vcs::type}{type}.
*/

/*!
    \qmlproperty string vcs::type

    The version control system used in the project.

    Currently, the supported values are \c{"git"}, \c{"hg"} and \c{"svn"}.

    \defaultvalue auto-detected
*/
qbs-src-3.2.0/doc/reference/modules/qbs-module.qdoc0000644000175100017510000006050715154533055021605 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype qbs
    \inqmlmodule QbsModules
    \since Qbs 1.0

    \brief Comprises general properties.

    The \c qbs module is implicitly loaded in every product. It contains properties of the current
    build environment, independent of the used programming languages and toolchains.

    \section2 Installation Properties

    Typically, you use \l{Group} items to specify the target directories for
    installing files. To install a group of files, set the \l{qbs::install}
    {qbs.install} property of the Group to \c true. The value of
    \l{qbs::installDir}{qbs.installDir} specifies the path to the directory
    where the files will be installed. You can specify a base directory for all
    installation directories as the value of \l{qbs::installPrefix}
    {qbs.installPrefix}.

    For example, the following properties specify where a set of QML files and
    an application executable are installed on Windows and Linux:

    \badcode
    Application {
        name: "myapp"
        Group {
            name: "Runtime resources"
            files: "*.qml"
            qbs.install: true
            qbs.installDir: condition: qbs.targetOS.includes("unix")
                ? "share/myapp" : "resources"
        }
        Group {
            name: "The App itself"
            fileTagsFilter: "application"
            qbs.install: true
            qbs.installDir: "bin"
        }
        qbs.installPrefix: condition: qbs.targetOS.includes("unix")
            ? "usr/local" : "MyApp"
    }
    \endcode

    On Windows, the QML files will ultimately get installed in
    \c{MyApp\resources} and the application executable in \c MyApp\bin,
    for instance under \c{C:\Program Files}. On Linux, the QML files will be
    installed in \c /usr/local/share/myapp and the executable in
    \c /usr/local/bin.

    By default, \l{qbs::installRoot}{qbs.installRoot} creates the
    \c install-root directory in the build directory for packaging the binaries
    before installation. It is a temporary directory that is usually not
    available when the application is run, and it should therefore not be set in
    the project files. You can override the default value from the command line,
    as described in \l{Installing Files}.

    \section2 Multiplexing Properties

    The following properties are specific to \l{Multiplexing}
    {product multiplexing}:

    \list
        \li \l{qbs::}{architectures}
        \li \l{qbs::}{buildVariants}
        \li \l{qbs::}{profiles}
    \endlist
*/

/*!
    \qmlproperty string qbs::configurationName
    \since Qbs 1.6
    \readonly

    The name of the current build configuration.

    The build configuration is set via the command line parameter \c
    config. For more information, see \l{build}{build}.

    \defaultvalue \c{"default"}
*/

/*!
    \qmlproperty string qbs::buildVariant

    The name of the build variant for the current build.

    Possible values are \c{"debug"}, \c{"release"} and \c{"profiling"}.
    A debug build usually contains additional debug symbols that are needed for
    debugging the application and has optimizations turned off. A profiling
    build usually contains debug symbols and has optimizations turned on. This
    is useful for profiling tools or when you need to retain debug symbols
    in a release build. A release build is a build without debug information and
    with optimizations enabled.

    \defaultvalue \c{"release"} if
    \l{qbs::configurationName}{qbs.configurationName} is \c{"release"}. Otherwise
    \c{"debug"}
*/

/*!
    \qmlproperty bool qbs::debugInformation

    Whether to generate debug information.

    \defaultvalue \c{true} if \l{qbs::buildVariant}{qbs.buildVariant} is \c{"debug"} or
    \c{"profiling"}. Otherwise \c{false}.
*/

/*!
    \qmlproperty bool qbs::enableDebugCode

    Whether to enable debug functionality in the product. Not to be confused
    with generation of debug symbols or the code optimization level.

    The property changes the following things when enabled:
    \list
         \li Passes a flag to the Windows linker to link against a debug
             Windows CRT (common runtime) library
             (for example /MTd instead of /MT)
    \endlist

    The property changes the following things when disabled:
    \list
         \li Passes the \c{NDEBUG} define to the compiler
    \endlist

    Typically, this property is enabled for debug builds and disabled for
    release or profiling builds.

    \defaultvalue \c{true} for debug builds, \c{false} otherwise.
*/

/*!
    \qmlproperty string qbs::optimization

    The general type of optimization that should be performed by all toolchains.

    Allowed values are:

    \list
        \li \c{"fast"}
        \li \c{"none"}
        \li \c{"small"}
    \endlist

    \defaultvalue \c{"none"} if \l{qbs::buildVariant}{qbs.buildVariant} is \c{"debug"}.
    Otherwise \c{"fast"}.
*/

/*!
    \qmlproperty string qbs::targetPlatform
    \since 1.11

    The OS you want to build the project for.

    This property is typically set in a profile or for a particular product
    where the target OS is always known (such as an Apple Watch app written in
    native code).

    For example, a profile used for building for the iOS Simulator platform will have this
    property set to the \c ios-simulator value:
    \code
        profiles.xcode-iphonesimulator.qbs.targetPlatform: "ios-simulator"
    \endcode

    You should generally treat this property as \e{write-only} and avoid using
    it to test for the current target OS. Instead, use the \l{qbs::}{targetOS}
    property for conditionals.

    \section2 Relation between targetPlatform and targetOS

    This table describes the possible values and matching between the \c targetPlatform
    and the \l{qbs::}{targetOS} properties:
    \table
    \header
        \li Target Platform
        \li Target OS
    \row
        \li \c{"aix"}
        \li \c{["aix", "unix"]}
    \row
        \li \c{"android"}
        \li \c{["android", "linux", "unix"]}
    \row
        \li \c{"dos"}
        \li \c{["dos"]}
    \row
        \li \c{"freebsd"}
        \li \c{["freebsd", "bsd", "unix"]}
    \row
        \li \c{"haiku"}
        \li \c{["haiku"]}
    \row
        \li \c{"hpux"}
        \li \c{["hpux", "unix"]}
    \row
        \li \c{"hurd"}
        \li \c{["hurd", "unix"]}
    \row
        \li \c{"integrity"}
        \li \c{["integrity", "unix"]}
    \row
        \li \c{"ios"}
        \li \c{["ios", "darwin", "bsd", "unix"]}
    \row
        \li \c{"ios-simulator"}
        \li \c{["ios-simulator", "ios", "darwin", "bsd", "unix"]}
    \row
        \li \c{"linux"}
        \li \c{["linux", "unix"]}
    \row
        \li \c{"lynx"}
        \li \c{["lynx"]}
    \row
        \li \c{"macos"}
        \li \c{["macos", "darwin", "bsd", "unix"]}
    \row
        \li \c{"netbsd"}
        \li \c{["netbsd", "bsd", "unix"]}
    \row
        \li \c{"openbsd"}
        \li \c{["openbsd", "bsd", "unix"]}
    \row
        \li \c{"os2"}
        \li \c{["os2"]}
    \row
        \li \c{"qnx"}
        \li \c{["qnx", "unix"]}
    \row
        \li \c{"solaris"}
        \li \c{["solaris", "unix"]}
    \row
        \li \c{"tvos"}
        \li \c{["tvos", "darwin", "bsd", "unix"]}
    \row
        \li \c{"tvos-simulator"}
        \li \c{["tvos-simulator", "tvos", "darwin", "bsd", "unix"]}
    \row
        \li \c{"unix"}
        \li \c{["unix"]}
    \row
        \li \c{"vxworks"}
        \li \c{["vxworks"]}
    \row
        \li \c{"watchos"}
        \li \c{["watchos", "darwin", "bsd", "unix"]}
    \row
        \li \c{"watchos-simulator"}
        \li \c{["watchos-simulator", "watchos", "darwin", "bsd", "unix"]}
    \row
        \li \c{"windows"}
        \li \c{["windows"]}
    \row
        \li \c{"none"}
        \li \c{["none"]}
    \row
        \li \c{undefined}
        \li \c{[]}
    \endtable

    \note The "none" value is usually used for a bare-metal platforms.

    \sa {Target Platforms}

    \defaultvalue \l{platform}{Host.platform()}
*/

/*!
    \qmlproperty string qbs::architecture

    The target platform's processor architecture.

    \c{undefined} indicates that the target platform is architecture-independent
    (for example the CLR or JVM).

    This property is typically set in a profile.

    Commonly used values are: \c{"x86"}, \c{"x86_64"}, and \c{"arm"}.

    \section2 Supported Processor Architectures

    This table describes the possible values of the \l{qbs::}{architecture} property:
    \table
    \header
        \li Architecture
        \li Description
    \row
        \li \c{"78k"}
        \li 16- and 8-bit accumulator-based register-bank CISC architecture
            microcontroller family manufactured by Renesas Electronics
    \row
        \li \c{"alpha"}
        \li 64-bit ISA architecture of the Alpha family processors
            developed by DEC
    \row
        \li \c{"arm"}
        \li 32-bit RISC architecture for computer processors
            developed by Acorn RISC Machine
            \note There are a lot of sub-variants of the ARM architecture.
                  Some specialized \QBS modules differentiate between them,
                  making use of values such as \c "armv7a". Please consult the
                  respective module-specific documentation for information
                  on what kind of value to use.
    \row
        \li \c{"arm64"}
        \li 64-bit RISC architecture for computer processors
            developed by Acorn RISC Machine
    \row
        \li \c{"avr"}
        \li 8-bit modified Harvard RISC architecture microcontroller
            family manufactured by Microchip Technology
    \row
        \li \c{"avr32"}
        \li 32-bit RISC architecture microcontroller family developed by Atmel
    \row
        \li \c{"c166"}
        \li 16-bit architecture microcontroller family developed by Infineon
    \row
        \li \c{"cr16"}
        \li 16-bit compact RISC architecture microcontroller family
            developed by National Semiconductor
    \row
        \li \c{"e2k"}
        \li 512-bit Russian wide VLIW microprocessor developed by Moscow Center
            of SPARC Technologies (MCST) and fabricated by TSMC
    \row
        \li \c{"hcs8"}
        \li 8-bit HC08 and S08 microcontroller family from Freescale Semiconductor
    \row
        \li \c{"hcs12"}
        \li 16-bit HC12 and S12 microcontroller family from Freescale Semiconductor
    \row
        \li \c{"hppa"}
        \li 64-bit PA-RISC processor architecture developed by Hewlett-Packard
    \row
        \li \c{"ia64"}
        \li 64-bit ISA architecture of the Itanium family processors
            developed by Intel
    \row
        \li \c{"m16c"}
        \li 16-bit CISC microcontrollers featuring high ROM code
            efficiency manufactured by Renesas Electronics
    \row
        \li \c{"m32c"}
        \li 32- and 16-bit CISC microcontrollers featuring high ROM code
            efficiency manufactured by Renesas Electronics
    \row
        \li \c{"m32r"}
        \li 32-bit RISC microcontrollers for general industrial and
            car-mounted systems, digital AV equipment, digital imaging
            equipment manufactured by Renesas Electronics
    \row
        \li \c{"m68k"}
        \li 16- and 32-bit CISC microprocessor, developed by Motorola
            Semiconductor Products Sector, and further improved as ColdFire
            architecture developed by NXP
    \row
        \li \c{"mcs251"}
        \li 8-, 16-, and 32-bit microcontroller family which is a next binary
        compatible generation for the \c "mcs51" family
    \row
        \li \c{"mcs51"}
        \li 8-bit Harvard architecture microcontroller family developed by Intel
    \row
        \li \c{"mips"}
        \li 32-bit RISC microprocessor without interlocked pipelined stages
            architecture developed by MIPS Computer Systems
    \row
        \li \c{"mips64"}
        \li 64-bit RISC microprocessor without interlocked pipelined stages
            architecture developed by MIPS Computer Systems
    \row
        \li \c{"msp430"}
        \li 16-bit mixed-signal microcontroller family manufactured
            by Texas Instruments
    \row
        \li \c{"ppc"}
        \li 32-bit RISC architecture processor family developed by
            Apple–IBM–Motorola alliance
    \row
        \li \c{"ppc64"}
        \li 64-bit RISC architecture processor family developed by
            Apple–IBM–Motorola alliance
    \row
        \li \c{"r32c"}
        \li 32-bit CISC microcontrollers with improved code efficiency
            and processing performance manufactured by Renesas Electronics
    \row
        \li \c{"rh850"}
        \li 32-bit automotive microcontroller family manufactured
            by Renesas Electronics
    \row
        \li \c{"riscv"}
        \li Open and free standard instruction set architecture based on established
            RISC principles
    \row
        \li \c{"rl78"}
        \li 16- and 8-bit accumulator-based register-bank CISC architecture
            with 3-stage instruction pipelining microcontroller family manufactured
            by Renesas Electronics
    \row
        \li \c{"rx"}
        \li High performance 32-bit CISC microcontroller family manufactured
            by Renesas Electronics
    \row
        \li \c{"s390x"}
        \li 64- and 32-bit System/390 processor architecture developed by IBM
    \row
        \li \c{"sh"}
        \li 32-bit RISC architecture processor family developed by Hitachi and
            currently manufactured by Renesas Electronics
    \row
        \li \c{"sparc"}
        \li 32-bit RISC architecture processor family developed by
            Sun Microsystems and Fujitsu
    \row
        \li \c{"sparc64"}
        \li 64-bit RISC architecture processor family developed by
            Sun Microsystems and Fujitsu
    \row
        \li \c{"stm8"}
        \li 8-bit microcontroller family manufactured by STMicroelectronics
    \row
        \li \c{"v850"}
        \li 32-bit RISC microcontroller family manufactured by Renesas Electronics
    \row
        \li \c{"x86"}
        \li 32-bit ISA architecture processor family developed by Intel
    \row
        \li \c{"x86_16"}
        \li 16-bit ISA architecture processor family developed by Intel
    \row
        \li \c{"x86_64"}
        \li 64-bit ISA architecture processor family developed by AMD
    \row
        \li \c{"xtensa"}
        \li 32-bit architecture with a compact 16- and 24-bit instruction set
            developed by Tensilica
    \endtable

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList qbs::toolchain

    Contains the list of string values describing the toolchain and toolchain
    family that is used to build a project.

    This property is deduced from the \l{qbs::}{toolchainType} property and is typically
    used to test for a particular toolchain or toolchain family in conditionals:

    \code
        Properties {
            // flags for GCC
            condition: qbs.toolchain.includes("gcc")
            cpp.commonCompilerFlags: ...
        }
        Properties {
            // flags for MSVC
            condition: qbs.toolchain.includes("msvc")
            cpp.commonCompilerFlags: ...
        }
    \endcode

    Unlike \l{qbs::}{toolchainType}, which contains a single value, \c qbs.toolchain
    is a string list which also contains the toolchain family. This allows to make
    conditions and checks simpler. For example, instead of:

    \code
    (qbs.toolchainType === "xcode" || qbs.toolchainType === "clang" || qbs.toolchainType === "gcc")
    \endcode

    use:

    \code
    qbs.toolchain.includes("gcc")
    \endcode

    since XCode, GCC and Clang belong to the \c "gcc" family.

    \section2 Relation between toolchainType and toolchain

    This table describes the possible values and matching between the \l{qbs::}{toolchainType}
    and the \c toolchain properties:
    \table
    \header
        \li Toolchain Type
        \li Toolchain
    \row
        \li \c{"clang"}
        \li \c{["clang", "llvm", "gcc"]}
    \row
        \li \c{"clang-cl"}
        \li \c{["clang-cl", "msvc"]}
    \row
        \li \c{"cosmic"}
        \li \c{["cosmic"]}
    \row
        \li \c{"dmc"}
        \li \c{["dmc"]}
    \row
        \li \c{"gcc"}
        \li \c{["gcc"]}
    \row
        \li \c{"iar"}
        \li \c{["iar"]}
    \row
        \li \c{"keil"}
        \li \c{["keil"]}
    \row
        \li \c{"llvm"}
        \li \c{["llvm", "gcc"]}
    \row
        \li \c{"mingw"}
        \li \c{["mingw", "gcc"]}
    \row
        \li \c{"msvc"}
        \li \c{["msvc"]}
    \row
        \li \c{"qcc"}
        \li \c{["qcc"]}
    \row
        \li \c{"sdcc"}
        \li \c{["sdcc"]}
    \row
        \li \c{"watcom"}
        \li \c{["watcom"]}
    \row
        \li \c{"xcode"}
        \li \c{["xcode", "clang", "llvm", "gcc"]}
    \endtable

    \nodefaultvalue
*/

/*!
    \qmlproperty string qbs::toolchainType
    \since Qbs 1.11

    The toolchain that is going to be used for this build.

    For example, to build a project using the \c "clang" toolchain, simply do
    \code
    qbs build qbs.toolchainType:clang
    \endcode

    You should generally treat this property as \e{write-only} and avoid using
    it to test for the current toolchain. Instead, use the \l{qbs::}{toolchain}
    property for conditionals.

    Typical values include: \c{"gcc"}, \c{"clang"}, \c{"clang-cl"}, \c{"mingw"},
    \c{"msvc"}, and \c{"xcode"}. Also see \l{Relation between toolchainType and toolchain}.

    By default, \c qbs.toolchainType is automatically detected based on the
    \l{qbs::}{targetOS} property:
    \table
    \header
        \li Target OS
        \li Toolchain
    \row
        \li \c{"darwin"}
        \li \c{"xcode"}
    \row
        \li \c{"freebsd"}
        \li \c{"clang"}
    \row
        \li \c{"haiku"}
        \li \c{"gcc"}
    \row
        \li \c{"qnx"}
        \li \c{"qcc"}
    \row
        \li \c{"unix"}
        \li \c{"gcc"}
    \row
        \li \c{"vxworks"}
        \li \c{"gcc"}
    \row
        \li \c{"windows"}
        \li \c{"msvc"}
    \endtable

    \defaultvalue Determined automatically.
*/

/*!
    \qmlproperty string qbs::sysroot

    The \c sysroot of the target platform.

    This property is typically set in a profile for cross-compiling.

    \nodefaultvalue
*/

/*!
    \qmlproperty path qbs::shellPath
    \since Qbs 1.5

    The platform-specific file path corresponding to the command line
    interpreter.

    On Windows, this is the path to \c{cmd.exe}, which is held in the
    \c{COMSPEC} environment variable (typically,
    \c{C:/Windows/System32/cmd.exe}),
    On Unix-like platforms, this is \c{/bin/sh}.

    \defaultvalue \c{"%COMSPEC%"} on Windows, \c{"/bin/sh"} on Unix
*/

/*!
    \qmlproperty stringList qbs::targetOS
    \readonly

    Contains the list of string values describing the OS and OS family that is
    used to build a project.

    This property is calculated based on the \l{qbs::}{targetPlatform} property and is typically
    used to test for a particular OS or OS family in conditionals:
    \code
        Group {
            // Includes all Unix-like platforms, such as: Linux, BSD, Apple platforms and others.
            condition: qbs.targetOS.includes("unix")
            files: ...
        }
        Group {
            // Includes all Apple platforms, such as macOS, iOS, and iOS Simulator.
            condition: qbs.targetOS.includes("darwin")
            files: ...
        }
        Group {
            // Includes only macOS
            condition: qbs.targetOS.includes("macos")
            files: ...
        }
    \endcode
    Avoid using \l{qbs::}{targetPlatform} for this purpose. For example, instead of:

    \code
    qbs.targetPlatform === "macos" || qbs.targetPlatform === "ios" || qbs.targetPlatform === "tvos" || qbs.targetPlatform === "watchos"
    \endcode

    use

    \code
    qbs.targetOS.includes("darwin")

    \endcode

    However, in some cases using \l{qbs::}{targetPlatform} would be acceptable, such as
    when the resulting condition would be simpler while still being correct:

    \code
    qbs.targetPlatform === "linux"
    \endcode

    versus
    \code
    qbs.targetOS.includes("linux") && !qbs.targetOS.includes("android")
    \endcode

    For the complete list of possible values, see
    \l{Relation between targetPlatform and targetOS}.

    \nodefaultvalue
*/

/*!
    \qmlproperty string qbs::version
    \readonly
    \since Qbs 1.4.1

    The version number of \QBS as a string. For example, \c "1.4.1".
*/

/*!
    \qmlproperty int qbs::versionMajor
    \readonly
    \since Qbs 1.4.1

    The major version number of \QBS.
*/

/*!
    \qmlproperty int qbs::versionMinor
    \readonly
    \since Qbs 1.4.1

    The minor version number of \QBS.
*/

/*!
    \qmlproperty int qbs::versionPatch
    \readonly
    \since Qbs 1.4.1

    The patch version number of \QBS.
*/

/*!
    \qmlproperty bool qbs::install

    Whether to install a certain set of files.

    This property is typically set in a \l{Group} item to mark a number of files
    as installable.

    \note Artifacts for which this property is enabled automatically receive the
    file tag \c "installable". This is useful for writing packaging-related
    rules.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty string qbs::installSourceBase
    \since Qbs 1.4

    The base directory of the local files that are going to be installed. The
    source base directory is omitted from the target directory path specified in
    \l{qbs::}{installDir}.

    \defaultvalue The directory of the current file to be installed, relative to
    the product's source directory.
*/

/*!
    \qmlproperty string qbs::installDir

    The installation directory for the files of a \l{Product}{product} or a
    \l{Group}.

    The value of this property is a path that is relative to \l{qbs::}
    {installPrefix}.

    \nodefaultvalue
*/

/*!
    \qmlproperty string qbs::installPrefix
    \since Qbs 1.1

    The global installation prefix. It is implicitly prepended to all values of
    \l{qbs::}{installDir}.

    The value of this property itself is relative to the \l{qbs::}{installRoot}
    in the context of installation.

    \defaultvalue \c "/usr/local" on Unix, \c "" otherwise
*/

/*!
    \qmlproperty string qbs::installRoot
    \since Qbs 1.4

    The global installation root. It is implicitly prepended to all values
    of \l{qbs::}{installPrefix} in the context of installation.

    \note This property is fundamentally different from \l{qbs::}{installDir}
    and \l{qbs::}{installPrefix} in that it must not be visible to the code
    being built. In fact, the install root is often just a temporary location
    used to package the binaries, which should therefore not assume they will be
    in that location at run-time. For the same reason, this property
    is usually not set from within project files.

    \defaultvalue \c{/install-root}
*/

/*!
    \qmlproperty stringList qbs::architectures
    \since Qbs 1.9

    The architectures the product will be built for.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList qbs::buildVariants
    \since Qbs 1.9

    The build variants the product will be built for.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList qbs::profiles
    \since Qbs 1.9

    The profiles for which the product should be built.

    For each profile listed here, one instance of the product will be built
    according to the properties set in the respective profile.

    \defaultvalue \l{Project::profile}{[project.profile]}
*/
qbs-src-3.2.0/doc/reference/modules/nsis-module.qdoc0000644000175100017510000001315015154533055021764 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype nsis
    \inqmlmodule QbsModules
    \since Qbs 1.2

    \brief Provides Nullsoft Scriptable Install System support.

    The \c nsis module contains properties and rules for building EXE installers
    for Windows using the Nullsoft Scriptable Install System (NSIS).

    This module is available on all platforms.

    \note A typical NSIS script includes an \c OutFile command to set the
    filename of the generated installer executable. However, \QBS overrides any
    \c OutFile commands found in the script, and therefore, you must use the
    \l{Product::targetName}{product.targetName} property to set the filename.

    \section2 Relevant File Tags
    \target filetags-nsis

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"nsh"}
        \li \c{*.nsh}
        \li 1.2
        \li This tag is attached to NSIS header files.
    \row
        \li \c{"nsi"}
        \li \c{*.nsi}
        \li 1.2
        \li This tag is attached to NSIS script files.
    \row
        \li \c{"nsissetup"}
        \li -
        \li 1.2
        \li The rule that creates the NSIS setup executable attaches this tag to its output
            artifact.
    \endtable
*/

/*!
    \qmlproperty stringList nsis::defines

    A list of preprocessor macros that get passed to the compiler.

    To set macro values, use the following syntax:

    \badcode
    cpp.defines: ["USE_COLORS=1", 'COLOR_STR="blanched almond"']
    \endcode

    \nodefaultvalue
*/

/*!
    \qmlproperty bool nsis::disableConfig

    Whether to exclude \c nsisconf.nsh.

    Generally, you do not need to set this property.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty bool nsis::enableQbsDefines

    Whether to define preprocessor macros corresponding to the values from the
    \l{Project}{project} and \l{Product}{product} objects.

    When building a 64-bit package, the preprocessor variable \c{Win64} will
    also be defined.

    \defaultvalue \c{true}
*/

/*!
    \qmlproperty string nsis::warningLevel

    The severity of the warnings to emit. The higher the level, the more
    warnings will be shown.

    The levels \c{none}, \c{errors}, \c{warnings}, \c{info}, and \c{all}
    correspond to the NSIS verbosity levels 0 through 4, inclusive. \c{normal}
    corresponds to the default level.

    \defaultvalue \c{"normal"}
*/

/*!
    \qmlproperty stringList nsis::compilerFlags

    A list of additional flags for the NSIS compiler.

    \nodefaultvalue
*/

/*!
    \qmlproperty string nsis::compressor

    The compression algorithm used to compress files and data in the installer.

    Setting this property overrides any \c SetCompressor command in the NSI file
    being compiled.

    Possible values include: \c{"default"}, \c{"zlib"}, \c{"zlib-solid"},
    \c{"bzip2"}, \c{"bzip2-solid"}, \c{"lzma"}, \c{"lzma-solid"}.

    \defaultvalue \c{"default"}
*/

/*!
    \qmlproperty string nsis::version

    The NSIS version. Consists of four numbers separated by dots. For example,
    \c "2.46.0.0".

    \nodefaultvalue
*/

/*!
    \qmlproperty int nsis::versionMajor

    The NSIS major version.

    \defaultvalue \c{versionParts[0]}
*/

/*!
    \qmlproperty int nsis::versionMinor

    The NSIS minor version.

    \defaultvalue \c{versionParts[1]}
*/

/*!
    \qmlproperty list nsis::versionParts

    The NSIS version as a list.

    For example, the NSIS version 2.46.0.0 would correspond to a value of
    \c[2, 46, 0, 0].

    \defaultvalue \c []
*/

/*!
    \qmlproperty int nsis::versionPatch

    The NSIS patch level.

    \defaultvalue \c{versionParts[2]}
*/

/*!
    \qmlproperty int nsis::versionBuild

    The fourth NSIS version number component.

    \defaultvalue \c{versionParts[3]}
*/

/*!
    \qmlproperty path nsis::toolchainInstallPath

    The NSIS installation directory.

    Determined by searching from the known registry keys and known installation
    paths until a match is found.

    This property should not normally need to be changed.

    \defaultvalue Determined automatically.
*/

/*!
    \qmlproperty string nsis::compilerName

    The name of the compiler binary.

    This property should not normally need to be changed.

    \defaultvalue \c{"makensis"}
*/

/*!
    \qmlproperty string nsis::compilerPath

    The directory where the compiler binary is located.

    This property should not normally need to be changed.

    \defaultvalue \l{nsis::}{compilerName}
*/
qbs-src-3.2.0/doc/reference/modules/exporter-cmake.qdoc0000644000175100017510000001113515154533055022454 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2024 Raphael Cotty (raphael.cotty@gmail.com)
** 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$
**
****************************************************************************/

/*!
    \qmltype Exporter.cmake
    \inqmlmodule QbsModules
    \since Qbs 2.3

    \brief Provides support for generating \CMAKE packages from dynamic, static and header library
    products.

    The Exporter.cmake module contains the properties and rules to create a \CMAKE config
    \l{https://cmake.org/cmake/help/v3.29/manual/cmake-packages.7.html#config-file-packages}{files}
    from the \l Export item of a \l Product.

    For instance, suppose you are creating a library. To allow exporting to \CMAKE, you would write
    something like the following:
    \code
    DynamicLibrary {
        name: "mylibrary"
        qbs.installPrefix: "/opt/mylibrary"
        Depends { name: "Exporter.cmake" }
        Exporter.cmake.packageName: "MyLibrary"
        property string headersInstallDir: "include"
        // ...
        Group {
            name: "API headers"
            files: ["mylib.h"]
            qbs.install: true
            qbs.installDir: headersInstallDir
        }
        Group {
            fileTagsFilter: ["Exporter.cmake.package"]
            qbs.installDir: "lib/cmake/MyLibrary"
        }
        Export {
            Depends { name: "cpp" }
            cpp.includePaths: FileInfo.joinPaths(
                exportingProduct.qbs.installRoot,
                exportingProduct.qbs.installPrefix,
                exportingProduct.headersInstallDir)
        }
    }
    \endcode
    To build against this library, from within your \CMAKE project, you simply
    use \l{https://cmake.org/cmake/help/v3.29/command/find_package.html}{find_package}:
    \code
        find_package(MyLibrary PATHS REQUIRED)
        add_executable(Consumer main.cpp)
        target_link_libraries(Consumer MyLibrary)
    \endcode

    \section2 Relevant File Tags
    \target filetags-exporter-qbs

    \table
    \header
        \li Tag
        \li Since
        \li Description
    \row
        \li \c{"Exporter.cmake.package"}
        \li 2.3.0
        \li This tag is attached to all generated module files.
    \row
        \li \c{"Exporter.cmake.configFile"}
        \li 2.3.0
        \li This tag is attached to the generated config file.
    \row
        \li \c{"Exporter.cmake.versionFile"}
        \li 2.3.0
        \li This tag is attached to the generated version file.
    \endtable
*/

/*!
    \qmlproperty string Exporter.cmake::configFileName

    The name of the generated config file.

    \defaultvalue \c{packageName + "Config.cmake"}
*/

/*!
    \qmlproperty string Exporter.cmake::versionFileName

    The name of the generated version file.

    \defaultvalue \c{packageName + "ConfigVersion.cmake"}
*/

/*!
    \qmlproperty string Exporter.cmake::packageName

    The name of the \CMAKE package.

    \defaultvalue \l{Product::targetName}{Product.targetName}
*/

qbs-src-3.2.0/doc/reference/modules/protobufcpp-module.qdoc0000644000175100017510000001313515154533055023356 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype protobuf.cpp
    \inqmlmodule QbsModules
    \since Qbs 1.13

    \brief Provides support for protocol buffers for the C++ language.

    The \c protobuf.cpp module provides support for generating C++ headers
    and sources from proto definition files using the \l protoc tool.

    A simple qbs file that uses protobuf can be written as follows:
    \code
    CppApplication {
        Depends { name: "protobuf.cpp" }
        files: ["foo.proto", "main.cpp"]
    }
    \endcode
    A generated header now can be included in the C++ sources:
    \code
        #include 

        int main(int argc, char* argv[]) {
            Foo bar;
            bar.set_answer(42);
            google::protobuf::ShutdownProtobufLibrary();
            return 0;
        }
    \endcode

    \section2 Relevant File Tags

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"protobuf.input"}
        \li \c{*.proto}
        \li 1.13.0
        \li Source files with this tag are considered inputs to the \c protoc compiler.
    \row
        \li \c{"protobuf.grpc"}
        \li
        \li 1.14.0
        \li Source files with this tag are considered as gRPC files.
    \row
        \li \c{"protobuf.hpp"}
        \li
        \li 1.18.0
        \li This tag is attached to the header files generated by \c protoc compiler.
    \endtable

    \section2 Dependencies

    The \l protobuf.cpp module requires runtime libraries to be operational. It depends on the
    \c "protobuflib" module which can be created by the \l qbspkgconfig or fallback module
    providers (the corresponding packages are \c protobuf or \c protobuf-lite). If \l useGrpc is
    set to true, the \l protobuf.cpp module also depends on the \c "grpc++" module.
*/

/*!
    \qmlproperty string protobuf.cpp::compilerName

    The name of the protoc binary.

    \since Qbs 1.17
    \defaultvalue \c "protoc"
*/

/*!
    \qmlproperty string protobuf.cpp::compilerPath

    The path to the protoc binary.

    Use this property to override the auto-detected location.

    \since Qbs 1.17
    \defaultvalue \c auto-detected
*/

/*!
    \qmlproperty pathList protobuf.cpp::importPaths

    The list of imports that are passed to the \c protoc tool via the \c --proto_path option.
    These imports should contain the proto files. They are used to determine
    the relative structure of the generated files.
    \note The paths are passed to \c protoc in the same order as specified in this property and
    \c protoc output may differ depending on that order.

    \defaultvalue \c []
*/

/*!
    \qmlproperty string protobuf.cpp::outputDir
    \readonly

    The directory where the \c protoc compiler generated files are placed.

    The value of this property is automatically set by \QBS and cannot be
    changed by the user.
*/

/*!
    \qmlproperty bool protobuf.cpp::useGrpc

    Whether to use gRPC framework.

    Use this property to enable support for the modern open source high performance RPC
    framework by Google, gRPC (\l{https://www.grpc.io}).

    A simple qbs file that uses grpc can be written as follows:
    \code
    CppApplication {
        Depends { name: "protobuf.cpp" }
        protobuf.cpp.useGrpc: true
        files: ["main.cpp"]
        Group {
            files: "grpc.proto"
            fileTags: "protobuf.grpc"
        }
    }
    \endcode

    \note that \c protobuf.grpc tag should be assigned manually because gRPC uses same \c *.proto
    files and \QBS can't detect whether to generate gRPC or \c protobuf.

    The following \c grpc.proto file...
    \code
        syntax = "proto3";

        package Qbs;

        message Request {
            string name = 1;
        }

        message Response {
            string name = 1;
        }

        service Grpc {
            rpc doWork(Request) returns (Response) {}
        }
    \endcode

    ...can be used in the C++ sources as follows:
    \code
        #include 

        class Service final : public Qbs::Grpc::Service
        {
            grpc::Status doWork(
                    grpc::ServerContext* context,
                    const Qbs::Request* request,
                    Qbs::Response* reply) override
            {
                (void)context;
                reply->set_name(request->name());
                return grpc::Status::OK;
            }
        };
    \endcode

    \defaultvalue \c false
*/
qbs-src-3.2.0/doc/reference/modules/ico-module.qdoc0000644000175100017510000000734015154533055021566 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype ico
    \inqmlmodule QbsModules
    \since Qbs 1.11

    \brief Provides support for building ICO (.ico) and CUR (.cur) files.

    The \c ico module contains properties and rules for building
    Microsoft Windows Icon (.ico) and Microsoft Windows Cursor (.cur) files.

    \note This module relies on the \c icotool command-line tool from the
    \c icotools package, which must be installed separately and found in the
    \c PATH or an appropriate system binaries directory for your system (for
    example, \c /usr/bin or \c /usr/local/bin).

    \section2 Relevant File Tags
    \target filetags-ico

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"cur"}
        \li n/a
        \li 1.11
        \li The rule that creates cursor (.cur) files
            attaches this tag to its output artifact.
    \row
        \li \c{"ico"}
        \li n/a
        \li 1.11
        \li The rule that creates icon (.ico) files
            attaches this tag to its output artifact.
    \row
        \li \c{"png"}
        \li \c{"*.png"}
        \li 1.11
        \li Source files with this tag indicate PNG files
            which are used as inputs to create icon or cursor files.
    \endtable
*/

/*!
    \qmlproperty int ico::cursorHotspotX

    The cursor hotspot x coordinate. Only relevant when building .cur files.

    This property must be set individually for each input PNG file.

    \note \c icoutils version 0.32 or greater is required to set the
    hotspot in cursor files with multiple images.

    \nodefaultvalue
*/

/*!
    \qmlproperty int ico::cursorHotspotY

    The cursor hotspot y coordinate. Only relevant when building .cur files.

    This property must be set individually for each input PNG file.

    \note \c icoutils version 0.32 or greater is required to set the
    hotspot in cursor files with multiple images.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool ico::raw

    Whether to store the input file as a raw PNG, as supported in Windows Vista.

    Only relevant when building .ico files.

    This property must be set individually for each input PNG file.

    It is recommended to set this value only for icon sizes larger than or equal
    to 256x256.

    \defaultvalue \c{false}
*/

/*!
    \qmlproperty string ico::icotoolFilePath

    The full path of the \c icotool binary.

    This property should not normally need to be changed if \QBS was able to
    automatically detect it.

    \defaultvalue Determined automatically.
*/
qbs-src-3.2.0/doc/reference/modules/qt-modules.qdoc0000644000175100017510000001172415154533055021624 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page qt-modules.html
    \inmodule qbs-modules

    \title Qt Modules

    \brief Provides Qt support.

    The \c{Qt.*} modules contain properties and rules for Qt.

    Qt modules are generated by the \l[QML]{Qt} module provider.

    \section1 Creating Dependencies to Qt Modules

    The Qt modules are grouped using the prefix \c Qt. If your product depends
    on the Qt.core and Qt.network modules, you could write:

    \code
    Depends { name: "Qt.core" }
    Depends { name: "Qt.network" }
    \endcode

    Or, alternatively:

    \code
    Depends { name: "Qt"; submodules: [ "core", "network" ] }
    \endcode

    The Qt modules that have properties and relevant file tags are described in
    separate topics.

    \section1 List of Submodules

    \table
    \header
        \li Submodule Name
        \li Qt Module Name
        \li Notes
    \row
        \li axcontainer
        \li QAxContainer
        \li This module is only available on Windows.
    \row
        \li axserver
        \li QAxServer
        \li This module is only available on Windows.
    \row
        \li concurrent
        \li Qt Concurrent
        \li
    \row
        \li \l{Qt.core}{core}
        \li Qt Core
        \li For more information, see \l{Qt.core}.
    \row
        \li \l{Qt.dbus}{dbus}
        \li Qt D-Bus
        \li For more information, see \l{Qt.dbus}.
    \row
        \li \l{Qt.declarative}{declarative}
        \li Qt Quick 1
        \li Provides the \c{Qt Quick 1} module. For more information, see
            \l{Qt.declarative}.
    \row
        \li designer
        \li Qt Designer
        \li
    \row
        \li enginio
        \li Qt Enginio
        \li
    \row
        \li \l{Qt.gui}{gui}
        \li Qt GUI
        \li For more information, see \l {Qt.gui}.
    \row
        \li help
        \li Qt Help
        \li You do not need this module for building \c qdoc documentation,
            because that functionality is part of the Qt.core module. This
            module is for using Qt classes such as \c QHelpEngine.
    \row
        \li multimedia
        \li Qt Multimedia
        \li
    \row
        \li multimediawidgets
        \li Qt Multimedia Widgets
        \li
    \row
        \li network
        \li Qt Network
        \li
    \row
        \li opengl
        \li Qt OpenGL
        \li
    \row
        \li phonon
        \li Phonon (Qt 4 only)
        \li
    \row
        \li printsupport
        \li Qt Print Support
        \li
    \row
        \li \l{Qt.quick}{quick}
        \li Qt Quick 2
        \li Provides the \c{Qt Quick} module (Qt Quick 2). For more information,
            see \l{Qt.quick}.
    \row
        \li quickcontrols2
        \li Qt Quick Controls 2
    \row
        \li \l{Qt.qml}{qml}
        \li Qt QML
        \li For more information, see \l{Qt.qml}.
    \row
        \li qmltest
        \li Qt Quick Test
        \li
    \row
        \li script
        \li Qt Script
        \li
    \row
        \li \l{Qt.scxml}{scxml}
        \li Qt Scxml
        \li For more information, see \l {Qt.scxml}.
    \row
        \li sql
        \li Qt SQL
        \li
    \row
        \li svg
        \li Qt SVG
        \li
    \row
        \li testlib
        \li Qt Test
        \li
    \row
        \li webkit
        \li Qt WebKit
        \li
    \row
        \li webkitwidgets
        \li Qt WebKit Widgets
        \li
    \row
        \li widgets
        \li Qt Widgets
        \li
    \row
        \li xml
        \li Qt XML
        \li You do not need this module for the \c QXmlStreamReader and
            \c QXmlStreamWriter classes, because those classes are a part of the
            \c Qt.core module. This module provides the deprecated DOM and SAX
            classes.
    \row
        \li xmlpatterns
        \li Qt XML Patterns
        \li
        \li
    \endtable
*/
qbs-src-3.2.0/doc/reference/modules/exporter-qbs-module.qdoc0000644000175100017510000001100015154533055023433 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Exporter.qbs
    \inqmlmodule QbsModules
    \since Qbs 1.12

    \brief Provides support for generating \QBS modules from products.

    The Exporter.qbs module contains the properties and rules to create a \QBS module from
    the \l Export item of a \l Product.

    Such a module acts as your product's interface to other projects written in \QBS.
    For instance, suppose you are creating a library. To allow other products both within
    and outside of your project to make use of it, you would write something like the following:
    \code
    DynamicLibrary {
        name: "mylibrary"
        qbs.installPrefix: "/opt/mylibrary"
        Depends { name: "Exporter.qbs" }
        property string headersInstallDir: "include"
        // ...
        Group {
            name: "API headers"
            files: ["mylib.h"]
            qbs.install: true
            qbs.installDir: headersInstallDir
        }
        Group {
            fileTagsFilter: ["Exporter.qbs.module"]
            qbs.installDir: "qbs/modules/mylibrary"
        }
        Export {
            Depends { name: "cpp" }
            cpp.includePaths: [exportingProduct.sourceDirectory]
            prefixMapping: [{
                    prefix: exportingProduct.sourceDirectory,
                    replacement: FileInfo.joinPaths(exportingProduct.qbs.installPrefix,
                                                    exportingProduct.headersInstallDir)
                }]
        }
    }
    \endcode
    To build against this library, from within your project or any other one, you simply
    declare a \l{Depends}{dependency}:
    \code
    Depends { name: "mylibrary" }
    \endcode

    \section2 Relevant File Tags
    \target filetags-exporter-qbs

    \table
    \header
        \li Tag
        \li Since
        \li Description
    \row
        \li \c{"Exporter.qbs.module"}
        \li 1.12.0
        \li This tag is attached to the generated module file.
    \endtable
*/

/*!
    \qmlproperty stringList Exporter.qbs::artifactTypes

    Artifacts that match these tags will become \l{Group::filesAreTargets}{target artifacts}
    of the generated module, so they can get picked up by the rules of depending products.

    If you do not specify anything here, all installed artifacts of the product are considered.
    \note You can only limit the default set of artifacts by setting this property, but you
          cannot extend it, because only artifacts that are to be installed are considered.

    \defaultvalue \c undefined
*/

/*!
    \qmlproperty string Exporter.qbs::additionalContent

    The value of this property will be copied verbatim into the generated module.

    \defaultvalue \c undefined
*/

/*!
    \qmlproperty stringList Exporter.qbs::excludedDependencies

    Normally, all \l Depends items in the \l Export item are copied into the generated
    module. However, if there are any exported dependencies that only make sense for
    products in the same project, then you can enter their names into this array, and they
    will get filtered out.
    \note You should strive to structure your projects in such a way that you do not need to set
          this property.

    \defaultvalue \c undefined
*/

/*!
    \qmlproperty string Exporter.qbs::fileName

    The name of the generated module file.

    \defaultvalue \c {product.targetName + ".qbs"}
*/
qbs-src-3.2.0/doc/reference/modules/java-module.qdoc0000644000175100017510000001364615154533055021743 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype java
    \inqmlmodule QbsModules
    \since Qbs 1.4

    \brief Provides Java support.

    The \c java module contains the properties and rules for building Java projects.

    \section2 Relevant File Tags
    \target filetags-java

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"java.class"}
        \li -
        \li 1.4
        \li This tag is attached to the output artifacts of the rule that runs the
            \c javac tool.
    \row
        \li \c{"java.jar"}
        \li -
        \li 1.4
        \li This tag is attached to the output artifacts of the rule that runs the
            \c jar tool.
    \row
        \li \c{"java.java"}
        \li \c{*.java}
        \li 1.4
        \li Source files with this tag serve as inputs to the rule running the \c javac tool.
    \row
        \li \c{"java.manifest"}
        \li \c{*.mf}
        \li 1.8
        \li The contents of files with this tag will be aggregated with the
            values in \l{java::}{manifest}.
    \endtable
*/

/*!
    \qmlproperty stringList java::additionalClassPaths

    The locations beside this product's class output path to consider when
    compiling.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList java::additionalCompilerFlags

    A list of compiler flags not covered by any of the properties in this
    module.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList java::additionalJarFlags

    A list of archiver flags not covered by any of the properties in this
    module.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList java::bootClassPaths

    A list of non-standard bootstrap class files.

    \nodefaultvalue
*/

/*!
    \qmlproperty string java::compilerFilePath

    The command to invoke when compiling Java sources.

    \defaultvalue \l compilerName, prefixed by \l jdkPath if it is defined.
*/

/*!
    \qmlproperty string java::compilerName

    The file name of the Java compiler.

    \defaultvalue \c{"javac"}
*/

/*!
    \qmlproperty bool java::enableWarnings

    Whether warnings are emitted when compiling Java sources.

    \defaultvalue \c true
*/

/*!
    \qmlproperty string java::interpreterFilePath

    The command to invoke when executing Java code.

    \defaultvalue \l interpreterName, prefixed by \l jdkPath if it is defined.
*/

/*!
    \qmlproperty string java::interpreterName

    The file name of the Java interpreter.

    \defaultvalue \c{"java"}
*/

/*!
    \qmlproperty string java::jarFilePath

    The command to run when creating or extracting \c jar files.

    \defaultvalue \l jarName, prefixed by \l jdkPath if it is defined.
*/

/*!
    \qmlproperty string java::jarName

    The file name of the \c jar tool.

    \defaultvalue \c{"jar"}
*/

/*!
    \qmlproperty pathList java::jdkIncludePaths
    \since Qbs 1.4.1

    A list of include paths for native header files.

    Applications using JNI to interface with native code should add these paths
    to \l{cpp::includePaths}{cpp.includePaths}.

    \defaultvalue Determined automatically.
*/

/*!
    \qmlproperty string java::jdkPath

    The base path of the Java Development Kit (JDK).

    This is equivalent to the \c JAVA_HOME environment variable, and by default
    will be determined automatically from one of the following:

    \list
        \li \c JAVA_HOME environment variable (all platforms)
        \li Registry (Windows)
        \li \c java_home tool (macOS)
        \li Known JDK paths (other Unix platforms)
    \endlist

    \defaultvalue Determined automatically.
*/

/*!
    \qmlproperty string java::languageVersion

    The Java language version to interpret source code as.

    If left undefined, the compiler will use its default.

    \nodefaultvalue
*/

/*!
    \qmlproperty string java::runtimeVersion

    The version of the Java runtime to generate compatible bytecode for.

    If left undefined, the compiler will use its default.

    \nodefaultvalue
*/

/*!
    \qmlproperty var java::manifest
    \since Qbs 1.4.2

    The properties to add to the manifest file when building a JAR.

    The contents of this property will be aggregated with the values from any
    files tagged \l{filetags-java}{"java.manifest"}.

    If this property and a manifest file contain the same key, this property
    will take precedence. If left undefined, this property will not be taken
    into account.

    \nodefaultvalue
*/

/*!
    \qmlproperty stringList java::manifestClassPath

    A list of entries to add to the manifest's Class-Path when building a JAR.

    \nodefaultvalue
*/

/*!
    \qmlproperty bool java::warningsAsErrors

    If this property is \c true, the compiler will abort where it would normally
    emit a warning.

    \defaultvalue \c false
*/
qbs-src-3.2.0/doc/reference/modules/capnprotocpp-module.qdoc0000644000175100017510000000706315154533055023526 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype capnproto.cpp
    \inqmlmodule QbsModules
    \since Qbs 1.17

    \brief Provides support for Cap'n Proto for the C++ language.

    The \c capnproto.cpp module provides support for generating C++ headers
    and sources from proto definition files using the \c capnpc tool.

    A simple qbs file that uses Cap'n Proto can be written as follows:
    \code
    CppApplication {
        Depends { name: "capnproto.cpp" }
        files: ["foo.capnp", "main.cpp"]
    }
    \endcode
    A generated header now can be included in the C++ sources:
    \code
        #include 

        int main(int argc, char* argv[]) {
            ::capnp::MallocMessageBuilder message;

            auto foo = message.initRoot();
            foo.setAnswer(42);
            return 0;
        }
    \endcode

    \section2 Relevant File Tags

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"capnproto.input"}
        \li \c{*.capnp}
        \li 1.17.0
        \li Source files with this tag are considered inputs to the \c capnpc compiler.
    \endtable

    \section2 Dependencies
    This module depends on the \c capnp module and on the \c capnp-rpc module if
    \l{capnproto.cpp::useRpc}{useRpc} property is \c true. These modules are created by the
    \l{Module Providers} via the \c pkg-config tool.
*/

/*!
    \qmlproperty string capnproto.cpp::compilerName

    The name of the capnp binary.

    \defaultvalue \c "capnpc"
*/

/*!
    \qmlproperty string capnproto.cpp::compilerPath

    The path to the protoc binary.

    Use this property to override the auto-detected location.

    \defaultvalue \c auto-detected
*/

/*!
    \qmlproperty pathList capnproto.cpp::importPaths

    The list of import paths that are passed to the \c capnpc tool via the \c --import-path option.

    \defaultvalue \c []
*/

/*!
    \qmlproperty string capnproto.cpp::outputDir

    The directory where the \c capnpc compiler generated files are placed.

    \defaultvalue \c product.buildDirectory + "/capnp"
*/

/*!
    \qmlproperty bool capnproto.cpp::useRpc

    Use this property to enable support for the RPC framework.

    A simple qbs file that uses rpc can be written as follows:

    \quotefile ../examples/capnproto/calculator_cpp/calculator_cpp.qbs

    \defaultvalue \c false
*/
qbs-src-3.2.0/doc/reference/modules/qt-plugin_support-module.qdoc0000644000175100017510000000565715154533055024541 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Qt.plugin_support
    \inqmlmodule QbsModules
    \since Qbs 1.13.0
    \brief Allows to fine-tune which Qt plugins get pulled in.

    The \c Qt.plugin_support module provides properties that allow users to control
    which Qt plugins to pull into a product.
    This is mostly relevant if Qt was built statically, in which case the respective
    plugins are static libraries that get linked into your application or library.
*/

/*!
    \qmlproperty varList Qt.plugin_support::pluginsByType

    Set this property if you want to override the set of plugins for a certain
    plugin type. For instance, to disable all image plugins except the JPEG
    one:
    \code
    Qt.plugin_support.pluginsByType: ({imageformats: "qjpeg"})
    \endcode
    For plugin types that are not specifically overridden like this, the value in
    defaultPluginsByType is used.

    \nodefaultvalue
*/

/*!
    \qmlproperty var Qt.plugin_support::allPluginsByType

    Provides the complete set of plugins in a statically built Qt.
    The value is a map. The keys are the plugin types, and the values
    are lists of plugin names.

    \readonly
*/

/*!
    \qmlproperty var Qt.plugin_support::defaultPluginsByType

    Provides the set of plugins that your application or library will
    link to if you do not set pluginsByType.
    The value is a map. The keys are the plugin types, and the values
    are lists of plugin names.
    The value depends on the Qt modules your product pulls in.

    \readonly
*/

/*!
    \qmlproperty bool Qt.plugin_support::linkPlugins

    Controls whether plugins of a statically built Qt should be linked into the product.

    \defaultvalue \c true if the product is an application or shared library, \c false otherwise.

*/
qbs-src-3.2.0/doc/reference/modules/qnx-module.qdoc0000644000175100017510000000512115154533055021615 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype qnx
    \inqmlmodule QbsModules
    \since Qbs 1.8

    \brief Provides support for building QNX applications using the QNX SDK.

    The \c qnx module contains properties and rules for QNX development.
    It has been tested with the QNX 6.5, 6.6, and 7.0 SDKs.
*/

/*!
    \qmlproperty string qnx::sdkDir

    The SDK base directory.

    \defaultvalue Determined automatically if the QNX SDK is installed at one of
    the standard locations, such as \c ~/qnx700, \c /opt/qnx700, or
    \c C:\\qnx700.
*/

/*!
    \qmlproperty string qnx::configurationDir

    The QNX configuration directory.

    Equivalent to the \c{QNX_CONFIGURATION} environment variable.

    \defaultvalue \c{~/.qnx}
*/

/*!
    \qmlproperty string qnx::hostDir

    The QNX host directory.

    Equivalent to the \c{QNX_HOST} environment variable.

    You should not normally need to set this property as it will be set to an
    appropriate value based on your host operating system and the installed
    QNX SDK in \l{qnx::}{sdkDir}.

    \defaultvalue Determined automatically.
*/

/*!
    \qmlproperty string qnx::targetDir

    The QNX target directory.

    Equivalent to the \c{QNX_TARGET} environment variable.

    You should not normally need to set this property as it will be set to an
    appropriate value based on the installed QNX SDK in \l{qnx::}{sdkDir}.

    \defaultvalue Determined automatically.
*/
qbs-src-3.2.0/doc/reference/modules/qt-dbus-module.qdoc0000644000175100017510000000522515154533055022373 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \qmltype Qt.dbus
    \inqmlmodule QbsModules
    \brief Provides Qt D-Bus support.

    The Qt.dbus module provides support for the Qt D-Bus module, which contains
    classes for inter-process communication over the D-Bus protocol.

    \section2 Relevant File Tags
    \target filetags-debus

    \table
    \header
        \li Tag
        \li Auto-tagged File Names
        \li Since
        \li Description
    \row
        \li \c{"qt.dbus.adaptor"}
        \li -
        \li 1.5
        \li Source files with this tag serve as inputs to the rule running the
            \c qdbusxml2cpp tool, which will create an adaptor class.
    \row
        \li \c{"qt.dbus.interface"}
        \li -
        \li 1.5
        \li Source files with this tag serve as inputs to the rule running the
            \c qdbusxml2cpp tool, which will create an interface class.
    \endtable
*/

/*!
    \qmlproperty string Qt.dbus::xml2cppName

    The base name of the \c qdbusxml2cpp tool.

    Set this property if your system uses a name different from the default
    value.

    \defaultvalue \c{"qdbusxml2cpp"}
*/

/*!
    \qmlproperty stringList Qt.dbus::xml2CppHeaderFlags

    A list of additional flags when running the \c qdbusxml2cpp tool to create
    header files.

    \defaultvalue \c []
*/

/*!
    \qmlproperty stringList Qt.dbus::xml2CppSourceFlags

    A list of additional flags when running the \c qdbusxml2cpp tool to create
    source files.

    \defaultvalue \c []
*/
qbs-src-3.2.0/doc/external-resources.qdoc0000644000175100017510000000655515154533055017764 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \externalpage https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html#//apple_ref/doc/uid/TP40012302-CH7-SW28
    \title Adopt the @2x Naming Convention
*/

/*!
    \externalpage https://login.qt.io/
    \title Qt Account
*/

/*!
    \externalpage https://www.qt.io/ide/
    \title Qt Creator
*/

/*!
    \externalpage https://www.qt.io/download/
    \title Qt SDK
*/

/*!
    \externalpage https://doc.qt.io/qt-5/licensing.html
    \title Qt Licensing
*/

/*!
    \externalpage https://www.gnu.org/licenses/gpl-2.0.html
    \title GNU General Public License, version 2
*/

/*!
    \externalpage http://www.linfo.org/bsdlicense.html
    \title BSD
*/

/*!
    \externalpage https://chocolatey.org/packages/qbs
    \title Chocolatey
*/

/*!
    \externalpage https://www.macports.org/ports.php?by=name&substr=qbs
    \title MacPorts
*/

/*!
    \externalpage https://brew.sh/
    \title Homebrew
*/

/*!
    \externalpage  http://www.typescriptlang.org
    \title TypeScript
*/

/*!
    \externalpage http://www.typescriptlang.org/docs/handbook/compiler-options.html
    \title Compiler Options
*/

/*!
    \externalpage https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dyld.1.html
    \title DYLD documentation
*/

/*!
    \externalpage https://dmgbuild.readthedocs.io/en/latest/settings.html#background
    \title dmgbuild - Settings
*/

/*!
    \externalpage http://www.jrsoftware.org/isinfo.php
    \title Inno Setup
*/

/*!
    \externalpage http://nodejs.org
    \title Node.js
*/

/*!
    \externalpage http://wixtoolset.org
    \title Windows Installer XML Toolset
*/

/*!
    \externalpage https://clang.llvm.org/docs/JSONCompilationDatabase.html
    \title JSON Compilation Database Format Specification
*/

/*!
    \externalpage https://github.com/protocolbuffers/protobuf
    \title protoc
*/

/*!
    \externalpage https://github.com/nanopb/nanopb
    \title nanopb
*/

/*!
    \externalpage https://ccache.samba.org/
    \title ccache
*/

/*!
    \externalpage https://ccache.samba.org/manual.html#_precompiled_headers
    \title ccache documentation about precompiled headers
*/
qbs-src-3.2.0/doc/images/0000755000175100017510000000000015154533055014514 5ustar  runnerrunnerqbs-src-3.2.0/doc/images/qbs-settings-gui.png0000644000175100017510000007520415154533055020437 0ustar  runnerrunnerPNG


IHDRe?zKIDATx{|eTpw=w^V=pg邲PuPhWV.MkX#(K(
)efY;d4iS(tty<_SYYYii'JJJw
'iBZfTuv\#K+/9ɼYM((׵+MN%_X,[e2(3oqm.P2,˃Z`XJypamg}KdX[)VGI+\q*ϑ_<4pI[>.)S6<vݻa&?cOgn[e*ڼ&Ѱ-;{{kc͕E((ŗ;w]Z|#G),$M>RR(
rgyH
+,Y9hX(uXR,:K*D?
1ҭMÇ
KsFzҏ7_{v%ʟ.:7;|دw~|^Yeܜ:c҆9p
NM>
{ܜ3wVm詪3EKf:qU;s	Lhʙv%l_ojk/es{ly_<B4_8!jǗǗǗEAhC&9gZ^*;vlOUU%mxd{t平Jl7Pӣ	-:+2oRosN{Qeì?UW#Ho3O.?y((riǎ9jciX^,]BmGI=V-
JSox)3VV*?yrOUV<}~GP_Nud;sřy;+N੊J}cl+?;3O[ggޔ|Iɏ9oFϯBmQPxˏo笥'}漗?hYMh/U=u̙>rĈ>KKvƢO<^_>:iVvg((ri֭P%
dϴ*Oo{m?_Uҟ:Uz|xb/x&/Ι*G>3hY/dsO<*m;tm_rVR};_j?u͖Yf*ufLOznwS;]wB4mٲ.3tZTVrPվyX8
-KgۏK39A[B*:.
Jwee'8q۵:r_P6ҲMP/v*ˆ[<$W—/=a3gҥKKҥK	a_~%%%4NѣG$WV+|	\p᪶//"C*TU_+MK,
_W%|P]vt{Mݗ	9zvb3ͬ`*Kr2Ӄ|0(]|tSraC¶M/^ZW*;_}y-̗p5Ͽ~3xЫ;KriW1zp)S:觋|_^2}ϭh>zVk	z/J[ڐv*;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runnerrunner/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \previouspage porting-to-qbs.html
    \nextpage attributions.html
    \page json-api.html

    \title Appendix C: The JSON API

    This API is the recommended way to provide \QBS support to an IDE.
    It is accessible via the \l{session} command.

    \section1 Packet Format

    All information is exchanged via \e packets, which have the following
    structure:
    \code
    packet = "qbsmsg:"  []  
    \endcode
    First comes a fixed string indentifying the start of a packet, followed
    by the size of the actual data in bytes. After that, further meta data
    might follow. There is none currently, but future extensions might add
    some. A line feed character marks the end of the meta data section
    and is followed immediately by the payload, which is a single JSON object
    encoded in Base64 format. We call this object a \e message.

    \section1 Messages

    The message data is UTF8-encoded.

    Most messages are either \e requests or \e replies. Requests are messages
    sent to \QBS via the session's standard input channel. Replies are messages
    sent by \QBS via the session's standard output channel. A reply always
    corresponds to one specific request. Every request (with the exception
    of the \l{quit-message}{quit request}) expects exactly one reply. A reply implies
    that the requested operation has finished. At the very least, it carries
    information about whether the operation succeeded, and often contains
    additional data specific to the respective request.

    Every message object has a \c type property, which is a string that uniquely
    identifies the message type.

    All requests block the session for other requests, including those of the
    same type. For instance, if client code wishes to restart building the
    project with different parameters, it first has to send a
    \l{cancel-message}{cancel} request, wait for the current build job's reply,
    and only then can it request another build. The only other message beside
    \l{cancel-message}{cancel} that can legally be sent while a request
    is currently being handled is the \l{quit-message}{quit} message.

    A reply object may carry an \c error property, indicating that the respective
    operation has failed. If this property is not present, the request was successful.
    The format of the \c error property is described \l{ErrorInfo}{here}.

    In the remainder of this page, we describe the structure of all messages
    that can be sent to and received from \QBS, respectively. The property
    tables may have a column titled \e Mandatory, whose values indicate whether
    the respective message property is always present. If this column is missing,
    all properties of the respective message are mandatory, unless otherwise
    noted.

    \section1 The \c hello Message

    This message is sent by \QBS exactly once, right after the session was started.
    It is the only message from \QBS that is not a response to a request.
    The value of the \c type property is \c "hello", the other properties are
    as follows:
    \table
    \header \li Property          \li Type
    \row    \li api-level         \li int
    \row    \li api-compat-level  \li int
    \row    \li lsp-socket        \li string
    \endtable

    The value of \c api-level is increased whenever the API is extended, for instance
    by adding new messages or properties.

    The value of \c api-compat-level is increased whenever incompatible changes
    are being done to this API. A tool written for API level \c n should refuse
    to work with a \QBS version with an API compatibility level greater than \c n,
    because it cannot guarantee proper behavior. This value will not change unless
    it is absolutely necessary.

    The value of \c api-compat-level is always less than or equal to the
    value of \c api-level.

    The value of \c lsp-socket is a path to a local domain socket (on Unix) or
    a named pipe (on Windows). It provides a server implementing the
    \l{https://microsoft.github.io/language-server-protocol}{Language Server Protocol}.

    \section1 Resolving a Project

    To instruct \QBS to load a project from disk, a request of type
    \c resolve-project is sent. The other properties are:
    \table
    \header \li Property                     \li Type                \li Mandatory
    \row    \li build-root                   \li \l FilePath         \li yes
    \row    \li configuration-name           \li string              \li no
    \row    \li data-mode                    \li \l DataMode         \li no
    \row    \li deprecation-warning-mode     \li string              \li no
    \row    \li dry-run                      \li bool                \li no
    \row    \li environment                  \li \l Environment      \li no
    \row    \li error-handling-mode          \li string              \li no
    \row    \li force-probe-execution        \li bool                \li no
    \row    \li log-time                     \li bool                \li no
    \row    \li log-level                    \li \l LogLevel         \li no
    \row    \li max-job-count                \li int                 \li no
    \row    \li module-properties            \li list of strings     \li no
    \row    \li overridden-properties        \li object              \li no
    \row    \li project-file-path            \li FilePath            \li if resolving from scratch
    \row    \li restore-behavior             \li string              \li no
    \row    \li settings-directory           \li string              \li no
    \row    \li top-level-profile            \li string              \li no
    \row    \li wait-lock-build-graph        \li bool                \li no
    \endtable

    The \c environment property defines the environment to be used for resolving
    the project, as well as for all subsequent \QBS operations on this project.

    The \c error-handling-mode specifies how \QBS should deal with issues
    in project files, such as assigning to an unknown property. The possible
    values are \c "strict" and \c "relaxed". In strict mode, \QBS will
    immediately abort and set the reply's \c error property accordingly.
    In relaxed mode, \QBS will continue to resolve the project if possible.
    A \l{warning-message}{warning message} will be emitted for every error that
    was encountered, and the reply's \c error property will \e not be set.
    The default error handling mode is \c "strict".

    If the \c log-time property is \c true, then \QBS will emit \l log-data messages
    containing information about which part of the operation took how much time.

    The \c module-properties property lists the names of the module properties
    which should be contained in the \l{ProductData}{product data} that
    will be sent in the reply message. For instance, if the project to be resolved
    is C++-based and the client code is interested in which C++ version the
    code uses, then \c module-properties would contain \c{"cpp.cxxLanguageVersion"}.
    Properties that have the value \c undefined will not be sent.

    The \c overridden-properties property is used to override the values of
    module, product or project properties. The possible ways to specify
    keys are described \l{Overriding Property Values from the Command Line}{here}.

    The \c restore-behavior property specifies if and how to make use of
    an existing build graph. The value \c "restore-only" indicates that
    a build graph should be loaded from disk and used as-is. In this mode,
    it is an error if the build graph file does not exist.
    The value \c "resolve-only" indicates that the project should be resolved
    from scratch and that an existing build graph should be ignored. In this mode,
    it is an error if the \c "project-file-path" property is not present.
    The default value is \c "restore-and-track-changes", which uses an
    existing build graph if possible and re-resolves the project if no
    build graph was found, if the parameters are different from the ones
    used when the project was last resolved, or if other relevant changes are
    detected, such as updated time stamps in a project file.
    The \c "restore-and-resolve" value is similar to \c "restore-and-track-changes",
    but also re-resolves the project if no changes were detected.

    The \c top-level-profile property specifies which \QBS profile to use
    for resolving the project. It corresponds to the \c profile key when
    using the \l resolve command.

    All other properties correspond to command line options of the \l resolve
    command, and their semantics are described there.

    When the project has been resolved, \QBS will reply with a \c project-resolved
    message. The possible properties are:
    \table
    \header \li Property      \li Type                    \li Mandatory
    \row    \li error         \li \l ErrorInfo            \li no
    \row    \li project-data  \li \l TopLevelProjectData  \li no
    \endtable

    The \c error-info property is present if and only if the operation
    failed. The \c project-data property is present if and only if
    the conditions stated by the request's \c data-mode property
    are fulfilled.

    All other project-related requests need a resolved project to operate on.
    If there is none, they will fail.

    There is at most one resolved project per session. If client code wants to
    open several projects or one project in different configurations, it needs
    to start additional sessions.

    \section1 Building a Project

    To build a project, a request of type \c build-project is sent. The other properties,
    none of which are mandatory, are listed below:
    \table
    \header \li Property                     \li Type
    \row    \li active-file-tags             \li string list
    \row    \li changed-files                \li \l FilePath list
    \row    \li check-outputs                \li bool
    \row    \li check-timestamps             \li bool
    \row    \li clean-install-root           \li bool
    \row    \li data-mode                    \li \l DataMode
    \row    \li dry-run                      \li bool
    \row    \li command-echo-mode            \li string
    \row    \li enforce-project-job-limits   \li bool
    \row    \li files-to-consider            \li \l FilePath list
    \row    \li install                      \li bool
    \row    \li job-limits                   \li list of objects
    \row    \li keep-going                   \li bool
    \row    \li log-level                    \li \l LogLevel
    \row    \li log-time                     \li bool
    \row    \li max-job-count                \li int
    \row    \li module-properties            \li list of strings
    \row    \li products                     \li list of strings or \c "all"
    \endtable

    All boolean properties except \c install default to \c false.

    The \c active-file-tags and \c files-to-consider are used to limit the
    build to certain output tags and/or source files.
    For instance, if only C/C++ object files should get built, then
    \c active-file-tags would be set to \c "obj".

    The objects in a \c job-limits array consist of a string property \c pool
    and an int property \c limit.

    If the \c log-time property is \c true, then \QBS will emit \l log-data messages
    containing information about which part of the operation took how much time.

    If \c products is an array, the elements must correspond to the
    \c full-display-name property of previously retrieved \l ProductData,
    and only these products will get built.
    If \c products is the string \c "all", then all products in the project will
    get built.
    If \c products is not present, then products whose
    \l{Product::builtByDefault}{builtByDefault} property is \c false will
    be skipped.

    The \c module-properties property has the same meaning as in the
    \l{Resolving a Project}{resolve-project} request.

    All other properties correspond to options of the \l build command.

    When the build has finished, \QBS will reply with a \c project-built
    message. The possible properties are:
    \table
    \header \li Property      \li Type                    \li Mandatory
    \row    \li error         \li \l ErrorInfo            \li no
    \row    \li project-data  \li \l TopLevelProjectData  \li no
    \endtable

    The \c error-info property is present if and only if the operation
    failed. The \c project-data property is present if and only if
    the conditions stated by the request's \c data-mode property
    are fulfilled.

    Unless the \c command-echo-mode value is \c "silent", a message of type
    \c command-description is emitted for every command to be executed.
    It consists of two string properties \c highlight and \c message,
    where \c message is the message to present to the user and \c highlight
    is a hint on how to display the message. It corresponds to the
    \l{Command and JavaScriptCommand}{Command} property of the same name.

    For finished process commands, a message of type \c process-result
    might be emitted. The other properties are:
    \table
    \header \li Property               \li Type
    \row    \li arguments              \li list of strings
    \row    \li error                  \li string
    \row    \li executable-file-path   \li \l FilePath
    \row    \li exit-code              \li int
    \row    \li stderr                 \li list of strings
    \row    \li stdout                 \li list of strings
    \row    \li success                \li bool
    \row    \li working-directory      \li \l FilePath
    \endtable

    The \c error string is one of \c "failed-to-start", \c "crashed", \c "timed-out",
    \c "write-error", \c "read-error" and \c "unknown-error".
    Its value is not meaningful unless \c success is \c false.

    The \c stdout and \c stderr properties describe the process's standard
    output and standard error output, respectively, split into lines.

    The \c success property is \c true if the process finished without errors
    and an exit code of zero.

    The other properties describe the exact command that was executed.

    This message is only emitted if the process failed or it has printed data
    to one of the output channels.

    \section1 Cleaning a Project

    To remove a project's build artifacts, a request of type \c clean-project
    is sent. The other properties are:
    \table
    \header \li Property     \li Type
    \row    \li dry-run      \li bool
    \row    \li keep-going   \li bool
    \row    \li log-level    \li \l LogLevel
    \row    \li log-time     \li bool
    \row    \li products     \li list of strings
    \endtable

    The elements of the \c products array correspond to a \c full-display-name
    of a \l ProductData. If this property is present, only the respective
    products' artifacts are removed.

    If the \c log-time property is \c true, then \QBS will emit \l log-data messages
    containing information about which part of the operation took how much time.

    All other properties correspond to options of the \l clean command.

    None of these properties are mandatory.

    After all artifacts have been removed, \QBS replies with a
    \c project-cleaned message. If the operation was successful, this message
    has no properties. Otherwise, a property \c error of type \l ErrorInfo
    indicates what went wrong.

    \section1 Installing a Project

    Installing is normally part of the \l{Building a Project}{build}
    process. To do it in a separate step, the \c install property
    is set to \c false when building and a dedicated \c install-project
    message is sent. The other properties are:
    \table
    \header \li Property             \li Type
    \row    \li clean-install-root   \li bool
    \row    \li dry-run              \li bool
    \row    \li install-root         \li \l FilePath
    \row    \li keep-going           \li bool
    \row    \li log-level            \li \l LogLevel
    \row    \li log-time             \li bool
    \row    \li products             \li list of strings
    \row    \li use-sysroot          \li bool
    \endtable

    The elements of the \c products array correspond to a \c full-display-name
    of a \l ProductData. If this property is present, only the respective
    products' artifacts are installed.

    If the \c log-time property is \c true, then \QBS will emit \l log-data messages
    containing information about which part of the operation took how much time.

    If the \c use-sysroot property is \c true and \c install-root is not present,
    then the install root will be \l{qbs::sysroot}{qbs.sysroot}.

    All other properties correspond to options of the \l install command.

    None of these properties are mandatory.

    \target cancel-message
    \section1 Canceling an Operation

    Potentially long-running operations can be aborted using the \c cancel-job
    request. This message does not have any properties. There is no dedicated
    reply message; instead, the usual reply for the request associated with
    the currently running operation will be sent, with the \c error property
    set to indicate that it was canceled.

    If there is no operation in progress, this request will have no effect.
    In particular, if it arrives after the operation that it was supposed to
    cancel has already finished (i.e. there is a race condition), the reply
    received by client code will not contain a cancellation-related error.

    \section1 Adding, Removing and Renaming Source Files

    Source files can be added to, removed from and renamed in \QBS project files with
    the \c add-files, \c remove-files and \c rename-files messages, respectively. These three
    requests have the same set of properties:
    \table
    \header \li Property  \li Type
    \row    \li files     \li see below
    \row    \li group     \li string
    \row    \li product   \li string
    \endtable

    The \c files property specifies which files should be added, removed or renamed.
    For the \c add-files and \c remove-files messages, this is a \c FilePath list.
    For the \c rename-files message, this is a list of objects with two properties
    \c source-path and \c target-path, each of which is a \c FilePath.

    The \c product property corresponds to the \c full-display-name of
    a \l ProductData and specifies to which product to apply the operation.

    The \c group property corresponds to the \c name of a \l GroupData
    and specifies to which group in the product to apply the operation.

    After the operation has finished, \QBS replies with a \c files-added,
    \c files-removed and \c files-renamed message, respectively. Again, the properties are
    the same:
    \table
    \header \li Property       \li Type                     \li Mandatory
    \row    \li error          \li \l ErrorInfo             \li no
    \row    \li failed-files   \li \l FilePath list         \li no
    \endtable

    If the \c error property is present, the operation has at least
    partially failed and \c failed-files will list the files
    that could not be added or removed.

    \section1 Adding Dependencies

    Dependencies can be added to a product with the \c add-dependencies message.
    The properties are:
    \table
    \header \li Property     \li Type
    \row    \li dependencies \li list of strings
    \row    \li group        \li string
    \row    \li product      \li string
    \endtable

    The \c dependencies property specifies which modules and/or products should be added.

    The \c product property corresponds to the \c full-display-name of
    a \l ProductData and specifies which product to add the dependencies to.

    The \c group property corresponds to the \c name of a \l GroupData
    and specifies in which group the resulting \c Depends items should appear.

    After the operation has finished, \QBS replies with a \c dependencies-added message.
    If and only if the operation failed, it will carry a property \c error of type \c ErrorInfo.

    \section1 The \c get-run-environment Message

    This request retrieves the full run environment for a specific
    executable product, taking into account the
    \l{Module::setupRunEnvironment}{setupRunEnvironment} scripts
    of all modules pulled in by the product. The properties are as follows:
    \table
    \header \li Property           \li Type              \li Mandatory
    \row    \li base-environment   \li \l Environment    \li no
    \row    \li config             \li list of strings   \li no
    \row    \li product            \li string            \li yes
    \endtable

    The \c base-environment property defines the environment into which
    the \QBS-specific values should be merged.

    The \c config property corresponds to the \l{--setup-run-env-config}
    option of the \l run command.

    The \c product property specifies the product whose environment to
    retrieve. The value must correspond to the \c full-display-name
    of some \l ProductData in the project.

    \QBS will reply with a \c run-environment message. In case of failure,
    it will contain a property \c error of type \l ErrorInfo, otherwise
    it will contain a property \c full-environment of type \l Environment.

    \section1 The \c get-generated-files-for-sources Message

    This request allows client code to retrieve information about
    which artifacts are generated from a given source file.
    Its sole property is a list \c products, whose elements are objects
    with the two properties \c full-display-name and \c requests.
    The first identifies the product to which the requests apply, and
    it must match the property of the same name in a \l ProductData
    in the project.
    The latter is a list of objects with the following properties:
    \table
    \header \li Property      \li Type              \li Mandatory
    \row    \li source-file   \li \l FilePath       \li yes
    \row    \li tags          \li list of strings   \li no
    \row    \li recursive     \li bool              \li no
    \endtable

    The \c source-file property specifies a source file in the respective
    product.

    The \c tags property constrains the possible file tags of the generated
    files to be matched. This is relevant if a source files serves as input
    to more than one rule or the rule generates more than one type of output.

    If the \c recursive property is \c true, files indirectly generated
    from the source file will also be returned. The default is \c false.
    For instance, íf this property is enabled for a C++ source file,
    the final link target (e.g. a library or an application executable)
    will be returned in addition to the object file.

    \QBS will reply with a \c generated-files-for-sources message, whose
    structure is similar to the request. It also has a single object list
    property \c products, whose elements consist of a string property
    \c full-display-name and an object list property \c results.
    The properties of these objects are:
    \table
    \header \li Property          \li Type
    \row    \li source-file       \li \l FilePath
    \row    \li generated-files   \li \l FilePath list
    \endtable

    The \c source-file property corresponds to an entry of the same name
    in the request, and the \c generated-files are the files which are
    generated by \QBS rules that take the source file as an input,
    taking the constraints specified in the request into account.

    Source files for which the list would be empty are not listed.
    Similarly, products for which the \c results list would be empty
    are also omitted.

    \note The results may be incomplete if the project has not been fully built.

    \section1 Closing a Project

    A project is closed with a \c release-project message. This request has
    no properties.

    \QBS will reply with a \c project-released message. If no project was open,
    the reply will contain an \c error property of type \l ErrorInfo.

    \target quit-message
    \section1 Closing the Session

    To close the session, a \c quit message is sent. This request has no
    properties.

    \QBS will cancel all currently running operations and then close itself.
    No reply will be sent.

    \section1 Progress Messages

    While a request is being handled, \QBS may emit progress information in order
    to enable client code to display a progress bar.

    \target task-started
    \section2 The \c task-started Message

    This is always the first progress-related message for a specific request.
    It appears at most once per request.
    It consists of a string property \c description, whose value can be displayed
    to users, and an integer property \c max-progress that indicates which
    progress value corresponds to 100 per cent.

    \target task-progress
    \section2 The \c task-progress Message

    This message updates the progress via an integer property \c progress.

    \target new-max-progress
    \section2 The \c new-max-progress Message

    This message is emitted if the original estimated maximum progress has
    to be corrected. Its integer property \c max-progress updates the
    value from a preceding \l task-started message.

    \section1 Messages for Users

    There are two types of messages that purely contain information to be
    presented to users.

    \target log-data
    \section2 The \c log-data Message

    This object has a string property \c message, which is the text to be
    shown to the user.

    \target warning-message
    \section2 The \c warning Message

    This message has a single property of type \l ErrorInfo.
    The name of the property is either \c warning or \c error,
    depending on how the client should display it.

    \section1 The \c protocol-error Message

    \QBS sends this message as a reply to a request with an unknown \c type.
    It contains an \c error property of type \l ErrorInfo.

    \section1 Project Data

    If a request can alter the build graph data, the associated reply may contain
    a \c project-data property whose value is of type \l TopLevelProjectData.

    \section2 TopLevelProjectData

    This data type represents the entire project. It has the same properties
    as \l PlainProjectData. If it is part of a \c project-resolved message,
    these additional properties are also present:
    \table
    \header \li Property                \li Type
    \row    \li build-directory         \li \l FilePath
    \row    \li build-graph-file-path   \li \l FilePath
    \row    \li build-system-files      \li \l FilePath list
    \row    \li overridden-properties   \li object
    \row    \li profile-data            \li object
    \endtable

    The value of \c build-directory is the top-level build directory.

    The \c build-graph-file-path value is the path to the build graph file.

    The \c build-system-files value contains all \QBS project files, including
    modules and JavaScript helper files.

    The value of \c overridden-properties is the one that was passed in when
    the project was last \l{Resolving a Project}{resolved}.

    The \c profile-data property maps the names of the profiles used in the project
    to the respective property maps. Unless profile multiplexing is used, this
    object will contain exactly one property.

    \section2 PlainProjectData

    This data type describes a \l Project item. The properties are as follows:
    \table
    \header \li Property         \li Type
    \row    \li is-enabled       \li bool
    \row    \li location         \li \l FilePath
    \row    \li name             \li string
    \row    \li products         \li \l ProductData list
    \row    \li sub-projects     \li \l PlainProjectData list
    \endtable

    The \c is-enabled property corresponds to the project's
    \l{Project::condition}{condition}.

    The \c location property is the exact position in a \QBS project file
    where the corresponding \l Project item was defined.

    The \c products and \c sub-projects are what the project has pulled in via
    its \l{Project::references}{references} property.

    \section2 ProductData

    This data type describes a \l Product item. The properties are as follows:
    \table
    \header \li Property                     \li Type
    \row    \li build-directory              \li \l FilePath
    \row    \li dependencies                 \li list of strings
    \row    \li full-display-name            \li string
    \row    \li generated-artifacts          \li \l ArtifactData list
    \row    \li groups                       \li \l GroupData list
    \row    \li is-enabled                   \li bool
    \row    \li is-multiplexed               \li bool
    \row    \li is-runnable                  \li bool
    \row    \li location                     \li \l Location
    \row    \li module-properties            \li \l ModulePropertiesData
    \row    \li multiplex-configuration-id   \li string
    \row    \li name                         \li string
    \row    \li properties                   \li object
    \row    \li target-executable            \li \l FilePath
    \row    \li target-name                  \li string
    \row    \li type                         \li list of strings
    \row    \li version                      \li string
    \endtable

    The elements of the \c dependencies array correspond to the full-display-name
    properties of the products that this product has pulled in via \l Depends items.

    The \c generated-artifacts are files that are created by the \l{Rule}{rules}
    in this product.

    The \c groups list corresponds to the \l Group items in this product.
    In addition, a "pseudo-group" is created for the \l{Product::files}{files}
    property of the product itself. Its name is the same as the product's.

    The \c is-enabled property corresponds to the product's
    \l{Product::condition}{condition}. A product may also get disabled
    if it contains errors and \QBS was was instructed to operate in relaxed mode
    when the project was \l{Resolving a Project}{resolved}.

    The \c is-multiplexed property is true if and only if the product is
    \l{Multiplexing}{multiplexed} over one ore more properties.

    The \c is-runnable property indicates whether one of the product's
    target artifacts is an executable file.
    In that case, the file is available via the \c target-executable property.

    The \c location property is the exact position in a \QBS project file
    where the corresponding \l Product item was defined.

    The \c module-properties object provides the values of the module properties
    that were requested when the project was \l{Resolving a Project}{resolved}.

    The \c name property is the value given in the \l{Product::name}{Product item},
    whereas \c full-display-name is a name that uniquely identifies the
    product in the entire project, even in the presence of multiplexing.
    In the absence of multiplexing, it is the same as \c name. In either case,
    it is suitable for being presented to users.

    See the \l Product item documentation for a description of the other
    properties.

    \section2 GroupData

    This data type describes a \l Group item. The properties are:
    \table
    \header \li Property                          \li Type
    \row    \li is-enabled                        \li bool
    \row    \li location                          \li \l Location
    \row    \li module-properties                 \li \l ModulePropertiesData
    \row    \li name                              \li string
    \row    \li prefix                            \li string
    \row    \li source-artifacts                  \li \l ArtifactData list
    \row    \li source-artifacts-from-wildcards   \li \l ArtifactData list
    \endtable

    The \c is-enabled property corresponds to the groups's
    \l{Group::condition}{condition}. However, if the group's product
    is disabled, this property will always be \c false.

    The \c location property is the exact position in a \QBS project file
    where the corresponding \l Group item occurs.

    The \c module-properties object provides the values of the module properties
    that were requested when the project was \l{Resolving a Project}{resolved}.
    If no module properties are set on the Group level and the value would therefore
    be the same as in the group's product, then this property is omitted.

    The \c source-artifacts list corresponds the the files listed verbatim
    in the group's \l{Group::files}{files} property.

    The \c source-artifacts-from-wildcards list represents the the files
    expanded from wildcard entries in the group's \l{Group::files}{files} property.

    See the \l Group item documentation for a description of the other
    properties.

    \section2 ArtifactData

    This data type represents files that occur in the project, either as sources
    or as outputs of a rules. \QBS project files, on the other hand, are not
    artifacts. The properties are:
    \table
    \header \li Property            \li Type
    \row    \li file-path           \li \l FilePath
    \row    \li file-tags           \li list of strings
    \row    \li install-data        \li object
    \row    \li is-executable       \li bool
    \row    \li is-generated        \li bool
    \row    \li is-target           \li bool
    \row    \li module-properties   \li \l ModulePropertiesData
    \endtable

    The \c install-data property is an object whose \c is-installable property
    indicates whether the artifact gets installed. If so, then the \l FilePath
    properties \c install-file-path and \c install-root provide further
    information.

    The \c is-target property is true if the artifact is a target artifact
    of its product, that is, \c is-generated is true and \c file-tags
    intersects with the \l{Product::type}{product type}.

    The \c module-properties object provides the values of the module properties
    that were requested when the project was \l{Resolving a Project}{resolved}.
    This property is only present for generated artifacts. For source artifacts,
    the value can be retrieved from their \l{GroupData}{group}.

    The other properties should be self-explanatory.

    \section2 ModulePropertiesData

    This data type maps fully qualified module property names to their
    respective values.

    \section1 Other Custom Data Types

    There are a number of custom data types that serve as building blocks in
    various messages. They are described below.

    \section2 FilePath

    A \e FilePath is a string that describes a file or directory. FilePaths are
    always absolute and use forward slashes for separators, regardless of
    the host operating system.

    \section2 Location

    A \e Location is an object representing a file path and possibly also a position
    within the respective file. It consists of the following properties:
    \table
    \header \li Property      \li Type           \li Mandatory
    \row    \li file-path     \li \l FilePath    \li yes
    \row    \li line          \li int            \li no
    \row    \li column        \li int            \li no
    \endtable

    \section2 ErrorInfo

    An \e ErrorInfo is an object representing error information. Its sole property
    \c items is an array of objects with the following structure:
    \table
    \header \li Property      \li Type           \li Mandatory
    \row    \li description   \li string         \li yes
    \row    \li location      \li \l Location    \li no
    \endtable

    \section2 DataMode

    This is the type of the \c data-mode property in a
    \l{Resolving a project}{resolve} or \l{Building a project}{build}
    request. It is used to indicate under which circumstances
    the reply message should include the project data. The possible
    values have string type and are as follows:
    \list
        \li \c "never": Do not attach project data to the reply.
        \li \c "always": Do attach project data to the reply.
        \li \c "only-if-changed": Attach project data to the reply only
                                  if it is different from the current
                                  project data.
    \endlist
    The default value is \c "never".

    \section2 LogLevel

    This is the type of the \c log-level property that can occur
    in various requests. It is used to indicate whether the client would like
    to receive \l log-data and/or \l{warning-message}{warning} messages.
    The possible values have string type and are as follows:
    \list
        \li "error": Do not log anything.
        \li "warning": \QBS may emit \l{warning-message}{warnings}, but no
                       \l log-data messages.
        \li "info": In addition to warnings, \QBS may emit informational
                    \l log-data messages.
        \li "debug": \QBS may emit debug output. No messages will be generated;
                     instead, the standard error output channel will be used.
    \endlist
    The default value is \c "info".

    \section2 Environment

    This data type describes a set of environment variables. It is an object
    whose keys are names of environment variables and whose values are
    the values of these environment variables.

*/
qbs-src-3.2.0/doc/appendix/qbs-porting.qdoc0000644000175100017510000003454515154533055020207 0ustar  runnerrunner/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \previouspage building-qbs.html
    \page porting-to-qbs.html
    \nextpage json-api.html

    \title Appendix B: Migrating from Other Build Systems

    You can use the \l{create-project}{qbs create-project} command to
    automatically generate \QBS project files from an arbitrary directory
    structure. This is a useful starting point when migrating from other
    build tools, such as qmake or CMake.

    To use the tool, switch to the project directory and run the
    \c {qbs create-project} command, which is located in the \c bin directory of
    the \QBS installation directory (or the Qt Creator installation directory).

    After generating the initial .qbs file, add the missing configuration
    variables and functions to it, as described in the following sections.

    \section1 Migrating from qmake

    The following sections describe the \QBS equivalents of qmake variable
    values.

    \section2 CONFIG

    Specify project configuration and compiler options.

    \section3 console

    Set the \l{Product::consoleApplication}{Product.consoleApplication} property
    to \c true for the \l{Application}, \l{CppApplication},or \l{QtApplication}
    item. For example:

    \code
    Application {
        name: "helloworld"
        files: "main.cpp"
        Depends { name: "cpp" }
        consoleApplication: true
    }
    \endcode

    \section3 ordered

    This qmake variable has no direct equivalent in \QBS. Instead, the build
    order is determined by implicit and explicit dependencies between products.
    To add an explicit dependency, add a \l{Depends} item to a
    \l{Product}{product}:

    \code
    CppApplication {
        name: "myapp"
        Depends { name: "mylib" }
    }
    \endcode

    The \c myapp product depends on and links to the \c mylib product, and is
    therefore built after it.

    \section3 qt

    In qmake, the Qt dependency is implicit, whereas in \QBS it is not.
    If \c {CONFIG -= qt}, add a \l{Depends} item to specify that
    the \l{Product}{product} depends on the \l{cpp} module:

    \code
    Product {
        Depends { name: "cpp" }
    }
    \endcode

    \section2 DEFINES

    Set the \l{cpp::defines}{cpp.defines} property for the \l{Product}{product}.

    \note To reference \c cpp.defines, you must specify a dependency on the
    \l{cpp} module.

    \code
    Product {
        Depends { name: "cpp" }
        cpp.defines: ["SUPPORT_MY_FEATURES"]
    }
    \endcode

    \section2 DESTDIR

    We recommend that you use the \l{Installing Files}{installation mechanism}
    to specify the location of the target file:

    \code
    Application {
        Group {
            name: "Runtime resources"
            files: "*.qml"
            qbs.install: true
            qbs.installDir: "share/myproject"
        }
        Group {
            name: "The App itself"
            fileTagsFilter: "application"
            qbs.install: true
            qbs.installDir: "bin"
        }
    }
    \endcode

    If that is not possible, you can use the \l{Product::}{destinationDirectory}
    property:

    \code
    DynamicLibrary {
        name: "mydll"
        destinationDirectory: "libDir"
    }
    \endcode

    \section2 HEADERS, SOURCES, FORMS, RESOURCES, OTHER_FILES

    Include header, source, form, and resource files as well as any
    other files as values of a \l{Product::files}{Product.files}
    or \l{Group::files}{Group.files}  property:

    \code
    QtApplication {
        name: "myapp"
        files: ["myapp.h", "myapp.cpp", "myapp.ui", "myapp.qrc", "readme.txt"]
    }
    \endcode

    \QBS uses \l{FileTagger}{file taggers} to figure out what kind of file
    it is dealing with.

    \section2 ICON

    There is no direct equivalent in \QBS. If you add a \l{Depends} {dependency}
    to the \l{ib} module and add the \c .xcassets directory as a value of the
    \l{Product::files}{Product.files} property, \QBS takes care of setting the
    application icon automatically when building for Apple platforms:

    \code
    Application {
        name: "myapp"
        files [".xcassets"]
        Depends { name: "ib" }
    }
    \endcode

    Alternatively, you can set the icon name as the value of the
    \l{bundle::infoPlist}{bundle.infoPlist} parameter, specify a dependency to
    the \l{ib} module, and add the application \c .icns file as a value of the
    \l{Product::}{files} property:

    \code
    Application {
        name: "myapp"
        files ["myapp.icns"]
        Depends { name: "ib" }
        bundle.infoPlist: ({"CFBundleIconFile": "myapp"})
    \endcode

    \section2 INCLUDEPATH

    Add the paths to the include files as values of the \l{cpp::includePaths}
    {cpp.includePaths} property:

    \code
    CppApplication {
        cpp.includePaths: ["..", "some/other/dir"]
    }
    \endcode

    \section2 LIBS

    For libraries that are part of the project, use \l{Depends} items.

    To pull in external libraries, use the \l{cpp::libraryPaths}
    {cpp.libraryPaths} property for the Unix \c -L (library path) flags and the
    \l{cpp::dynamicLibraries}{cpp.dynamicLibraries} and \l{cpp::staticLibraries}
    {cpp.staticLibraries} properties for the
    \c -l (library) flags.

    For example, \c {LIBS += -L/usr/local/lib -lm} would become:

    \code
    CppApplication {
        cpp.libraryPaths: ["/usr/local/lib"]
        cpp.dynamicLibraries: ["m"]
    }
    \endcode

    \section2 OUT_PWD

    Use the \l{Product::buildDirectory}{Product.buildDirectory} property
    to refer to the base output directory of the generated artifacts.

    \section2 PWD

    Corresponds to the the file-scope variable \c path.

    \section2 _PRO_FILE_

    Corresponds to the file-scope variable \c filePath when used in a
    \l{Project}{project} or \l{Product}{product}.

    \section2 _PRO_FILE_PWD_

    Corresponds to the \l{Project::sourceDirectory}{Project.sourceDirectory} or
    \l{Product::sourceDirectory}{Product.sourceDirectory} property.

    \section2 QMAKE_ASSET_CATALOGS

    Add a \l{Depends}{dependency} to the \l{ib} module and add the \c .xcassets
    directory as a value of the \l{Product::}{files} property:

    \code
    Application {
        name: "myapp"
        files [".xcassets"]
        Depends { name: "ib" }
    }
    \endcode

    \section2 QMAKE_BUNDLE_DATA

    For the time being, you can manually place files in the appropriate location
    using the \l{Installing Files}{installation mechanism}. Better solutions are
    under development.

    \section2 QMAKE_BUNDLE_EXTENSION

    Set the \l{bundle::extension}{bundle.extension} property.

    \note Unlike qmake, \QBS automatically prepends a period (.) to the property
    value.

    \section2 QMAKE_{C,CXX,OBJECTIVE}_CFLAGS{_DEBUG,_RELEASE}

    Use the \l{cpp::commonCompilerFlags}{cpp.commonCompilerFlags} property or
    the properties corresponding to each compiler flags variable:

    \table
        \header
            \li qmake Variable
            \li cpp Module Property
        \row
            \li \c QMAKE_CFLAGS_DEBUG

                \c QMAKE_CFLAGS_RELEASE
            \li \l{cpp::cFlags}{cpp.cFlags}
        \row
            \li \c QMAKE_CXXFLAGS_DEBUG

                \c QMAKE_CXXFLAGS_RELEASE
            \li \l{cpp::cxxFlags}{cpp.cxxFlags}
        \row
            \li \c QMAKE_OBJECTIVE_CFLAGS
            \li \l{cpp::objcFlags}{cpp.objcFlags}

                \l{cpp::objcxxFlags}{cpp.objcxxFlags}
    \endtable

    Use \l{Properties} items or simple conditionals as values of the
    \l{qbs::buildVariant}{qbs.buildVariant} property to simulate the \c _DEBUG
    and \c _RELEASE variants of the qmake variables.

    \section2 QMAKE_FRAMEWORK_BUNDLE_NAME

    Set the \l{bundle::bundleName}{bundle.bundleName} property (which is derived
    from \l{Product::targetName}{Product.targetName}) combined with
    \l{bundle::extension}{bundle.extension}.

    \section2 QMAKE_FRAMEWORK_VERSION

    Set the \l{bundle::frameworkVersion}{bundle.frameworkVersion} property.

    \section2 QMAKE_INFO_PLIST

    Include the \c info.plist file as a value of \l{Product::}{files} property
    and specify a dependency to the \l{bundle} module:

    \code
    Application {
        name: "myapp"
        files ["info.plist"]
        Depends { name: "bundle" }
    }
    \endcode

    \QBS will automatically add any necessary properties to your \c Info.plist
    file. Typically, it determines the appropriate values from the other
    properties in the project, and therefore you do not need to use the
    \c {Info.plist.in > Info.plist} configuration mechanism. Further, you almost
    never need to embed placeholders into the source \c Info.plist file. Set the
    \l{bundle::processInfoPlist}{bundle.processInfoPlist} property to \c false
    to disable this behavior:

    \code
    \\ ...
        bundle.processInfoPlist: false
    \endcode

    In addition to, or instead of, using an actual \c Info.plist file, you can
    add \c Info.plist properties using the \l{bundle::infoPlist}
    {bundle.infoPlist} property. For example:

    \code
    \\ ...
        bundle.infoPlist: ({
            "NSHumanReadableCopyright": "Copyright (c) 2017 Bob Inc",
            "Some other key", "Some other value, & XML special characters are no problem! >;) 非凡!"
        })
    \endcode

    \section2 QMAKE_LFLAGS

    Set the \l{cpp::linkerFlags}{cpp.linkerFlags} property for the \l{Product}
    {product}.

    \section2 QMAKE_{MACOSX,IOS,TVOS,WATCHOS}_DEPLOYMENT_TARGET

    For each qmake deployment target variable, use the corresponding property of
    the \l{cpp} module:

    \table
        \header
            \li qmake Variable
            \li cpp Module Property
        \row
            \li \c QMAKE_MACOSX_DEPLOYMENT_TARGET
            \li \l{cpp::minimumMacosVersion}{cpp.minimumMacosVersion}
        \row
            \li \c QMAKE_IOS_DEPLOYMENT_TARGET
            \li \l{cpp::minimumIosVersion}{cpp.minimumIosVersion}
        \row
            \li \c QMAKE_TVOS_DEPLOYMENT_TARGET
            \li \l{cpp::minimumTvosVersion}{cpp.minimumTvosVersion}
        \row
            \li \c QMAKE_WATCHOS_DEPLOYMENT_TARGET
            \li \l{cpp::minimumWatchosVersion}{cpp.minimumWatchosVersion}
    \endtable

    \section2 QMAKE_RPATHDIR

    Set the \l{cpp::rpaths}{cpp.rpaths} property for the \l{Product}{product}.

    \section2 QMAKE_SONAME_PREFIX

    Use the \l{cpp::sonamePrefix}{cpp.sonamePrefix} property for the \l{Product}
    {product}.

    \section2 QML_IMPORT_PATH

    Used only for Qt Creator QML syntax highlighting. Inside a \l{Product},
    \l{Application}, \l{CppApplication}, or \l{QtApplication}, create a
    \c qmlImportPaths property:

    \code
    Product {
        name: "myProduct"
        property stringList qmlImportPaths: [sourceDirectory + "/path/to/qml/"]
    }
    \endcode

    \section2 QT

    Add a \l{Depends} item to the \l{Product}{product} that specifies the
    dependencies to \l{Qt} modules. For example:

    \code
    QtApplication {
        Depends { name: "Qt.widgets" }
    }
    \endcode

    You could also use the following form that is equivalent to the previous
    one:

    \code
    QtApplication {
        Depends { name: "Qt"; submodules: "widgets" }
    }
    \endcode

    \section2 QTPLUGIN

    Building static applications often requires linking to static QPA plugins,
    such as \c qminimal. You can use the following syntax to enable \QBS to
    link to the required plugins:

    \code
    QtApplication {
        name: "myapp"
        Depends { name: "Qt"; submodules: ["core", "gui", "widgets"] }
        Depends { name: "Qt.qminimal"; condition: Qt.core.staticBuild }
    }
    \endcode

    \section2 RC_FILE

    Add Windows resource files to the value of the \l{Product::files}
    {Product.files} property.

    \section2 TARGET

    Use the \l{Product::targetName}{Product.targetName} property to specify the
    base file name of target artifacts.

    \section2 TEMPLATE

    \section3 app

    Use \l{Application} or \l{CppApplication} as the \l{Product}{product}:

    \code
    CppApplication {
        name: "helloworld"
        files: "main.cpp"
    }
    \endcode

    This is roughly equivalent to:

    \code
    Product {
        name: "helloworld"
        type: "application"
        files: "main.cpp"
        Depends { name: "cpp" }
    }
    \endcode

    \section3 lib

    Use either \l{DynamicLibrary} or \l{StaticLibrary} as the \l{Product}
    {product}, depending on whether the value of \c CONFIG in the .pro file is
    \c shared or \c static. For example, if the value is \c shared:

    \code
    DynamicLibrary {
        name: "mydll"
        files: ["mySourceFile.cpp"]
        Depends { name: "cpp" }
    }
    \endcode

    \section3 subdirs

    In a \l{Project} item, specify subdirectories as values of the
    \l{Project::}{references} property:

    \code
    Project {
        references: [
            "app/app.qbs",
            "lib/lib.qbs"
        ]
    }
    \endcode

    \section2 message(), warning(), error(), log()

    You can use the \l{Console API} to print info, warning, error, and log messages to the console.

    \code
    Product {
        name: {
            console.info("--> now evaluating the product name");
            return "theName";
        }
        Depends { name: "cpp" }
        cpp.includePath: { throw "An error occurred." }
    }
    \endcode
*/
qbs-src-3.2.0/doc/qbs-online.qdocconf0000644000175100017510000000170715154533055017041 0ustar  runnerrunnerinclude(config/qbs-project.qdocconf)

HTML.footer = \
    "   
\n" \ "

\n" \ " © 2022 The Qt Company Ltd.\n" \ " Documentation contributions included herein are the copyrights of\n" \ " their respective owners. " \ " The documentation provided herein is licensed under the terms of the" \ " GNU Free Documentation" \ " License version 1.3 as published by the Free Software Foundation. " \ " Qt and respective logos are trademarks of The Qt Company Ltd " \ " in Finland and/or other countries worldwide. All other trademarks are property\n" \ " of their respective owners.

\n" include($QT_INSTALL_DOCS/global/qt-html-templates-online.qdocconf) # Add an .html file with sidebar content, used in the online style HTML.stylesheets += config/style/qt5-sidebar.html qbs-src-3.2.0/doc/fixnavi.pl0000644000175100017510000001473615154533055015263 0ustar runnerrunner#! /usr/bin/perl -w ############################################################################# ## ## Copyright (C) 2016 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$ ## ############################################################################# use strict; my @files = (); my %defines = (); for (@ARGV) { if (/^-D(.*)$/) { $defines{$1} = 1; } elsif (/^-/) { printf STDERR "Unknown option '".$_."'\n"; exit 1; } else { push @files, $_; } } int(@files) or die "usage: $0 [-D]... \n"; my @toc = (); my %title2page = (); my $doctitle = ""; my $curpage = ""; my $intoc = 0; my %prev_skips = (); my %next_skips = (); my %define_skips = (); my %polarity_skips = (); my $prev_skip = ""; my $next_skip = ""; my $define_skip = ""; my $polarity_skip = 0; for my $file (@files) { my $skipping = 0; # no nested ifs! open FILE, $file or die "File $file cannot be opened.\n"; while () { if (/^\h*\\if\h+defined\h*\(\h*(\H+)\h*\)/) { $skipping = !defined($defines{$1}); if (!$intoc) { $define_skip = $1; $polarity_skip = $skipping; } } elsif (/^\h*\\else/) { $skipping = 1 - $skipping; } elsif (/^\h*\\endif/) { $skipping = 0; } elsif (keys(%title2page) == 1 && /^\h*\\list/) { $intoc++; } elsif (!$intoc) { if ($skipping && /^\h*\\previouspage\h+(\H+)/) { $prev_skip = $1; } elsif ($skipping && /^\h*\\nextpage\h+(\H+)/) { $next_skip = $1; } elsif (/^\h*\\page\h+(\H+)/) { $curpage = $1; } elsif (/^\h*\\title\h+(.+)$/) { if ($curpage eq "") { die "Title '$1' appears in no \\page.\n"; } if (length($define_skip)) { $define_skips{$1} = $define_skip; $polarity_skips{$1} = $polarity_skip; $prev_skips{$1} = $prev_skip; $next_skips{$1} = $next_skip; $define_skip = $prev_skip = $next_skip = ""; } $title2page{$1} = $curpage; $doctitle = $1 if (!$doctitle); $curpage = ""; } } else { if (/^\h*\\endlist/) { $intoc--; } elsif (!$skipping && /^\h*\\(?:o|li)\h+\\l\h*{(.*)}$/) { push @toc, $1; } } } close FILE; } my %prev = (); my %next = (); my $last = $doctitle; for my $title (@toc) { $next{$last} = $title2page{$title}; $prev{$title} = $title2page{$last}; $last = $title; } for my $file (@files) { open IN, $file or die "File $file cannot be opened a second time?!\n"; open OUT, '>'.$file.".out" or die "File $file.out cannot be created.\n"; my $cutting = 0; while () { if (!$cutting) { if (/^\h*\\contentspage/) { $cutting = 1; } } else { if (/^\h*\\title\h+(.+)$/) { if (defined($define_skips{$1})) { print OUT " \\if defined(".$define_skips{$1}.")\n"; if ($polarity_skips{$1}) { print OUT " \\previouspage ".$prev_skips{$1} if ($prev_skips{$1}); print OUT " \\else\n"; } } print OUT " \\previouspage ".$prev{$1} if ($prev{$1}); if (defined($define_skips{$1})) { if (!$polarity_skips{$1}) { print OUT " \\else\n"; print OUT " \\previouspage ".$prev_skips{$1} if ($prev_skips{$1}); } print OUT " \\endif\n"; } print OUT " \\page ".$title2page{$1}; if (defined($define_skips{$1})) { print OUT " \\if defined(".$define_skips{$1}.")\n"; if ($polarity_skips{$1}) { print OUT " \\nextpage ".$next_skips{$1} if ($next_skips{$1}); print OUT " \\else\n"; } } print OUT " \\nextpage ".$next{$1} if ($next{$1}); if (defined($define_skips{$1})) { if (!$polarity_skips{$1}) { print OUT " \\else\n"; print OUT " \\nextpage ".$next_skips{$1} if ($next_skips{$1}); } print OUT " \\endif\n"; } print OUT "\n"; $cutting = 0; } else { next; } } print OUT $_; } close OUT; close IN; rename($file.".out", $file) or die "Cannot replace $file with new version.\n"; } qbs-src-3.2.0/doc/howtos.qdoc0000644000175100017510000007314615154533055015455 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \previouspage tutorial-8.html \nextpage reference.html \page howtos.html \title How-tos This page provides concrete instructions for common scenarios. \list \li \l{How do I build a Qt-based project?} \li \l{How do I make my app build against my library?} \li \l{How do I build release with debug information?} \li \l{How do I separate and install debugging symbols?} \li \l{How do I use precompiled headers?} \li \l{How do I make use of rpaths?} \li \l{How do I make sure my generated sources are getting compiled?} \li \l{How do I run my autotests?} \li \l{How do I use ccache?} \li \l{How do I create a module for a third-party library?} \li \l{How do I build against libraries that provide pkg-config files?} \li \l{How do I create application bundles and frameworks on iOS, macOS, tvOS, and watchOS?} \li \l{How do I apply C/C++ preprocessor macros to only a subset of the files in my product?} \li \l{How do I disable a compiler warning?} \li \l{How do I make the state of my Git repository available to my source files?} \li \l{How do I limit the number of concurrent jobs for the linker only?} \li \l{How do I add QML files to a project?} \li \l{How do I define a reusable Group of files that can be included in other \QBS files?} \li \l{How do I access properties of a base type?} \li \l{How do I print the value of a property?} \li \l{How do I debug \QBS scripts?} \li \l{How do I sign an application for an Apple platform?} \endlist \section1 How do I build a Qt-based project? First of all, your project files need to declare \l{Depends}{dependencies} on \l{Qt} modules. To build the project, you need a matching \e profile. The following commands set up and use a Qt-specific profile: \code $ qbs setup-qt /usr/bin/qmake qt $ cd my_project $ qbs profile:qt \endcode If you plan to use this profile a lot, consider making it the default one: \code $ qbs config defaultProfile qt $ cd my_project $ qbs \endcode See \l{Managing Qt Versions} for more details. \note These instructions are only relevant for building from the command line. If you use Qt Creator, profiles are set up automatically from the information in the Kit. \section1 How do I make my app build against my library? This is achieved by introducing a \e dependency between the two products using the \l{Depends} item. Here is a simple, but complete example: \code Project { CppApplication { name : "the-app" files : [ "main.cpp" ] Depends { name: "the-lib" } } DynamicLibrary { name: "the-lib" Depends { name: "cpp" } files: [ "lib.cpp", "lib.h", ] Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory] } } } \endcode The product \c the-lib is a dynamic library. It expects other products to build against it, and for that purpose, it exports an include path (via an \l{Export} item), so that the source files in these products can include the library's header file. The product \c the-app is an application that expresses its intent to link against \c the-lib by declaring a dependency on it. Now \c main.cpp can include \c lib.h (because of the exported include path) and the application binary will link against the library (because the linker \l{Rule}{rule} in the \l{cpp} module considers library dependencies as inputs). \note In a non-trivial project, the two products would not be defined in the same file. Instead, you would put them into files of their own and use the \l{Project::references}{Project.references} property to pull them into the project. The product definitions would stay exactly the same. In particular, their location in the project tree is irrelevant to the relationship between them. \section2 Choosing Between Dynamic and Statically-built Qt Projects To build \c "the-lib" as either a dynamic or static library, depending on how Qt was built, you can use the following code: \code Product { name: "the-lib" type: Qt.core.staticBuild ? "staticlibrary" : "dynamiclibrary" Depends { name: "Qt.core" } // ... } \endcode \section1 How do I build release with debug information? You can simply use the \c{"profiling"} \l{qbs::buildVariant}{qbs.buildVariant}: \code qbs build qbs.buildVariant:profiling \endcode \section1 How do I separate and install debugging symbols? First, you need to set the \l{cpp::debugInformation}{cpp.debugInformation} and \l{cpp::separateDebugInformation}{cpp.separateDebugInformation} properties to \c true or use some conditional expression in your product: \code CppApplication { // ... cpp.debugInformation: qbs.buildVariant !== "release" cpp.separateDebugInformation: true } \endcode Now, you can install your \l{Application}{application}, \l{DynamicLibrary}{dynamic library} or \l{LoadableModule}{loadable module} among with its debugging symbols as follows: \code CppApplication { // ... install: true installDir: "bin" installDebugInformation: true debugInformationInstallDir: "bin" } \endcode If you are not using \l{List of Convenience Items}{convenience items}, you can install debug symbols manually using the \l{Group} item. If the \l{cpp::separateDebugInformation}{cpp.separateDebugInformation} property is set to \c true, \QBS will create debugging symbols with the corresponding file tags \c "debuginfo_app" (for an application), \c "debuginfo_dll" (for a dynamic library), or \c "debuginfo_loadablemodule" (for a macOS plugin). \code Product { type: "application" Depends { name: "cpp" } cpp.debugInformation: qbs.buildVariant !== "release" cpp.separateDebugInformation: true Group { fileTagsFilter: cpp.separateDebugInformation ? ["debuginfo_app"] : [] qbs.install: true qbs.installDir: "bin" qbs.installSourceBase: buildDirectory } } \endcode If you're building a shared library, you need to use the \c "debuginfo_dll" tag instead: \code Product { type: "dynamic_library" // ... Group { fileTagsFilter: cpp.separateDebugInformation ? ["debuginfo_dll"] : [] qbs.install: true qbs.installDir: "lib" qbs.installSourceBase: buildDirectory } } \endcode If you're building a macOS plugin, you need to use the \c "debuginfo_loadablemodule" tag instead: \code Product { type: "loadablemodule" // ... Group { fileTagsFilter: cpp.separateDebugInformation ? ["debuginfo_loadablemodule"] : [] qbs.install: true qbs.installDir: "PlugIns" qbs.installSourceBase: buildDirectory } } \endcode \section1 How do I use precompiled headers? If you use a \l Group item to add a precompiled header file to a product and mark it with the \l{filetags-cpp}{relevant file tag} (\c c_pch_src, \c cpp_pch_src, \c objc_pch_src, or \c objcpp_pch_src), it is used automatically. Only one precompiled header is allowed per product and language. For example: \code CppApplication { name: "the-app" files: ["main.cpp"] Group { files: ["precompiled-header.pch"] fileTags: ["cpp_pch_src"] } } \endcode \section1 How do I make use of rpaths? rpath designates the run-time search path used by the dynamic linker when loading libraries on UNIX platforms. This concept does not apply to Windows. Suppose you have a project with two dynamic library products \c LibraryA and \c LibraryB and one dependent application product. Also, \c LibraryB depends on \c LibraryA. The application is installed to the \c bin folder and the libraries are installed to the \c lib folder next to the \c bin folder. You want the application to be able to find the dependent libraries relative to its own location. This can be achieved by usage of the \l{cpp::rpaths}{cpp.rpaths} property. First, you need to set \l{cpp::rpaths}{cpp.rpaths} in your libraries so they can find dependent libraries in the same folder where they are located. This can be done as follows: \snippet ../examples/rpaths/rpaths.qbs 0 We are setting \l{cpp::rpaths}{cpp.rpaths} to \l{cpp::rpathOrigin}{cpp.rpathOrigin} which expands to \c "$ORIGIN" on Linux and to \c "@loader_path" on macOS. On macOS you also need to set \l{cpp::sonamePrefix}{cpp.sonamePrefix} to \c "@rpath" to tell the dynamic linker to use RPATHs when loading this library. \c LibraryB looks exactly the same: \snippet ../examples/rpaths/rpaths.qbs 1 In a real project, it might be a good idea to move common properties to some base item and inherit it in library items. The application item is a bit different. It sets \l{cpp::rpaths}{cpp.rpaths} to the \c "lib" folder which is located one level up from the \c bin folder: \snippet ../examples/rpaths/rpaths.qbs 2 \section1 How do I make sure my generated sources are getting compiled? The rules in a \QBS project do not care whether its inputs are actual source files listed on the right-hand side of a \l{Product::files}{files} property or artifacts that were generated by another rule. For instance, the C++ compiler rule considers all input files of type "cpp", no matter how they got into the product. The following example project demonstrates this. One of its source files exists in the repository, the other one is generated at build time. Both are getting compiled the same way. \note Do not try to add the generated files to a \c files property. Declaring them as rule outputs is all that is needed to make \QBS know about them. \code import qbs.TextFile CppApplication { files: ["impl.cpp", "impl.h"] cpp.includePaths: sourceDirectory Rule { multiplex: true Artifact { filePath: "main.cpp"; fileTags: "cpp" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); f.writeLine("#include "); f.writeLine("int main()"); f.writeLine("{"); f.writeLine(" return functionFromImpl();"); f.writeLine("}"); f.close(); }; return cmd; } } } \endcode \section1 How do I run my autotests? There are two simple things you need to do in your project. Firstly, you mark your test executables as such. This is done by adding the tag \c{"autotest"} to the product type: \code CppApplication { name: "test1" type: base.concat("autotest") // ... } \endcode The second step is to instantiate an \l AutotestRunner product in your project: \code Project { // ... AutotestRunner { name: "run_my_tests" } } \endcode Building an AutotestRunner product does not produce artifacts, but triggers execution of all applications whose products are tagged as autotests: \code $ qbs -p run_my_tests test1: PASS test2: PASS test3: FAIL ... \endcode See the \l{AutotestRunner}{AutotestRunner documentation} for how to fine-tune the behavior. \section1 How do I use ccache? \l ccache is a popular C/C++ compiler cache on Unix to speed up compiling the same content multiple times. \QBS excels at tracking dependencies and avoiding needless recompilations, so for linear development of one project and configuration using ccache has little benefit. But if you switch between revisions of a project, or build the same project with different configurations, a global cache like ccache can speed up compilations significantly. ccache can be used by setting up symbolic links to compiler executables (such as \c g++, \c gcc) in the file system. In this setup, the use of ccache is transparent to \QBS. If you prefer to call ccache explicitly, you should set \l{cpp::compilerWrapper}{cpp.compilerWrapper} to \c ccache. \note Using precompiled headers might prevent ccache from actually using cached results. To work around this, you can set \c{sloppiness=pch_defines,time_macros} in your local ccache options. See the \l{ccache documentation about precompiled headers} for further details. \section1 How do I create a module for a third-party library? If you have pre-built binary files in your source tree, you can create modules for them and then introduce dependencies between your project and the modules to pull in the functionality of a third-party library. Create the following folder structure to store the module files: \code $projectroot/modules/ThirdParty \endcode Then create a file in the directory that specifies the module properties for each supported toolchain. The filename must have the \c .qbs extension. The module will be pulled in if a product declares a dependency on it. In the following example, \c lib1.dylib is a multi-architecture library containing both 32-bit and 64-bit code. \code ---ThirdParty.qbs--- Module { Depends { name: "cpp" } cpp.includePaths: ["/somewhere/include"] Properties { condition: qbs.targetOS.includes("android") cpp.dynamicLibraries: ["/somewhere/android/" + Android.ndk.abi + "/lib1.so"] } Properties { condition: qbs.targetOS.includes("macos") cpp.dynamicLibraries: ["/somewhere/macos/lib1.dylib"] } Properties { condition: qbs.targetOS.includes("windows") && qbs.architecture === "x86" cpp.dynamicLibraries: ["/somewhere/windows_x86/lib1.lib"] } Properties { condition: qbs.targetOS.includes("windows") && qbs.architecture === "x86_64" cpp.dynamicLibraries: ["/somewhere/windows_x86_64/lib1.lib"] } } \endcode Finally, declare dependencies on \c ThirdParty in your project: \code CppApplication { name: "the-app" files: ["main.cpp"] Depends { name: "ThirdParty" } } \endcode \section1 How do I create application bundles and frameworks on iOS, macOS, tvOS, and watchOS? Creating an application bundle or framework is achieved by introducing a dependency on the \l{bundle} module and setting the \l{bundle::isBundle} {bundle.isBundle} property to \c true. Here is a simple example for an application: \code Application { Depends { name: "cpp" } Depends { name: "bundle" } bundle.isBundle: true name: "the-app" files: ["main.cpp"] } \endcode and for a framework: \code DynamicLibrary { Depends { name: "cpp" } Depends { name: "bundle" } bundle.isBundle: true name: "the-lib" files: ["lib.cpp", "lib.h"] } \endcode \QBS also supports building static frameworks. You can create one by replacing the \l{DynamicLibrary} item with a \l{StaticLibrary} item in the example above. \note When using the \l{Application} item (or convenience items, such as \l{CppApplication}, \l{DynamicLibrary}, and \l{StaticLibrary}), your products will be built as bundles on Apple platforms by default (this behavior is subject to change in a future release). To explicitly control whether your product is built as a bundle, set the \c bundle.isBundle property. Setting the \l{Product::}{consoleApplication} property of your product will also influence whether your product is built as a bundle. Building your application against your framework is the same as linking a normal dynamic or static library; see the \l{How do I make my app build against my library?} section for an example. \section1 How do I build against libraries that provide pkg-config files? Just add a \l Depends item that matches the name of the pkg-config module, set the \l Product::qbsModuleProviders property to \c "qbspkgconfig", and \QBS will employ \l{https://www.freedesktop.org/wiki/Software/pkg-config}{pkg-config} to find the headers and libraries if no matching \QBS module can be found. For instance, to build against the OpenSSL library, you would write this: \code qbsModuleProviders: "qbspkgconfig" Depends { name: "openssl" } \endcode That's it. The pkg-config behavior can be fine-tuned via the \l qbspkgconfig provider. Internally, this functionality is implemented via \l {Module Providers} \section1 How do I apply C/C++ preprocessor macros to only a subset of the files in my product? Use a \l{Group} item to define a subset of project files. To add macros within the group, you need to use the \c outer.concat property, because you are adding macros to those specified in the outer scope. In the following example, \c MACRO_EVERYWHERE is defined for all files in the \l{Product} unless a Group overrides the macro, whereas \c MACRO_GROUP is only defined for \c groupFile.cpp. \code Product { Depends { name: "cpp" } cpp.defines: ["MACRO_EVERYWHERE"] Group { cpp.defines: outer.concat("MACRO_GROUP") files: "groupFile.cpp" } } \endcode The \c cpp.defines statements inside a \c Group only apply to the files in that \c Group, and therefore you cannot use a \c Group to include a bunch of files and globally visible macros. The macros must be specified in a \l{Properties} item at the same level as the \c Group if they need to be visible to files outside the \c Group: \code Product { Depends { name: "cpp" } Group { condition: project.supportMyFeature files: "myFile.cpp" } property stringList commonDefines: ["ONE", "TWO"] Properties { condition: project.supportMyFeature cpp.defines: commonDefines.concat("MYFEATURE_SUPPORTED") } } \endcode \section1 How do I disable a compiler warning? You can use the \l {cpp::commonCompilerFlags}{cpp.commonCompilerFlags} property to pass flags to the compiler. For example, to disable deprecation warnings: \code CppApplication { // ... readonly property bool isMsvc: qbs.toolchain.includes("msvc") cpp.commonCompilerFlags: isMsvc ? "/wd4996" : "-Wno-deprecated-declarations" } \endcode It is also possible to disable all warnings at once by setting the \l {cpp::commonCompilerFlags}{cpp.warningLevel} property to \c "none". Usually this approach is discouraged, but it can be useful in some cases, such as when compiling third party code: \code Group { cpp.warningLevel: "none" files: [ "3rdparty.h", "3rdparty.cpp" ] } \endcode \section1 How do I make the state of my Git repository available to my source files? Add a dependency to the \l{vcs} module to your product: \code CppApplication { // ... Depends { name: "vcs" } // ... } \endcode Your source files will now have access to a macro whose value is a string representing the current Git or Subversion HEAD: \code #include #include int main() { std::cout << "I was built from " << VCS_REPO_STATE << std::endl; } \endcode This value is also available via the \l{vcs::repoState}{vcs.repoState} property. \section1 How do I limit the number of concurrent jobs for the linker only? \target job-pool-howto While it is usually desirable to run as many compiler jobs as there are CPU cores, the same is not true for linker jobs. The reason is that linkers are typically I/O bound rather than CPU bound. When building large libraries, they also tend to use up enormous amounts of memory. Therefore, we'd like to make sure that only a few linkers are running at the same time without limiting other types of jobs. In \QBS, this is achieved via \e{job pools}. There are several ways to make use of them. Firstly, you can provide a limit via the command line: \code $ qbs --job-limits linker:4 \endcode The above call instructs \QBS to run at most four linker instances at the same time, while leaving the general number of concurrent jobs at the default value, which is derived from the number of CPU cores. The \c linker string on the command line refers to the job pool of the same name, which the \l{cpp-job-pools}{cpp module} assigns to all its commands that invoke a linker. Secondly, you can set a limit via the settings, either generally or for a specific profile: \code $ qbs config preferences.jobLimit.linker 4 $ qbs config profiles.myprofile.preferences.jobLimit.linker 2 \endcode And finally, you can also set the limit per project or per product, using a \l JobLimit item: \code Product { name: "my_huge_library" JobLimit { jobPool: "linker" jobCount: 1 } // ... } \endcode The above construct ensures that this specific library is never linked at the same time as any other binary in the project. Job limits set on the command line override those from the settings, which in turn override the ones defined within a project. Use the \c{--enforce-project-job-limits} option to give the job limits defined via \c JobLimit items maximum precedence. \section1 How do I add QML files to a project? The simplest way to add QML files to a project is to add them to a \l {https://doc.qt.io/qt/resources.html}{Qt resource file}: \code QtGuiApplication { // ... files: "main.cpp" Group { prefix: "qml/" files: ["main.qml", "HomePage.qml"] fileTags: ["qt.qml.qml", "qt.core.resource_data"] } } \endcode In the example above, we declare each QML file as having the \l {filetags-qtcore}{"qt.core.resource_data"} file tag. This ensures that it is added to a generated resource file. \section1 How do I define a reusable Group of files that can be included in other \QBS files? Suppose you have an application and tests for that application, and that the project is structured in the following way: \badcode ├── app │ ├── app.qbs │ ├── ... │ └── qml │ └── ui │ ├── AboutPopup.qml │ └── ... ├── my-project.qbs └── tests ├── tst_app.cpp ├── ... └── tests.qbs \endcode Both projects need access to the QML files used by the application. To demonstrate how this can be done, we'll create a file named \c qml-ui.qbs and put it in the \c app/qml/ui directory: \code Group { prefix: path + "/" fileTags: ["qt.qml.qml", "qt.core.resource_data"] files: [ "AboutPopup.qml", // ... ] } \endcode This Group is a variation of the one in the \l {How do I add QML files to a project?}{section above}. If no prefix is specified, the file names listed in the \c files property are resolved relative to the \e importing product's (e.g. \c app.qbs) directory. For that reason, we set the prefix to inform \QBS that the file names should be resolved relative to the \e imported item instead: \c qml-ui.qbs. Conveniently, this also means that we don't need to specify the path prefix for each file. The application can then import the file like so: \code import "qml/ui/qml-ui.qbs" as QmlUiFiles QtGuiApplication { // ... files: "main.cpp" QmlUiFiles {} } \endcode The tests can use a relative path to import the file: \code import "../app/qml/ui/qml-ui.qbs" as QmlUiFiles QtGuiApplication { // ... files: "tst_app.cpp" QmlUiFiles {} } \endcode \section1 How do I access properties of a base type? You can use the \l base property. For example, to append to a list of files that come from the base type, you can use \c {base.concat()}: \code // TestBase.qbs QtGuiApplication { files: [ "TestCaseBase.h", "TestCaseBase.cpp" ] } \endcode \code // tst_stuff.qbs TestBase { files: base.concat(["tst_stuff.cpp"]) } \endcode See \l {Special Property Values} for more details. \section1 How do I print the value of a property? Use the \l {Console API}{console API}. For example, suppose your project is not built the way you expect it to be, and you suspect that \c qbs.targetOS has the wrong value: \code readonly property bool unix: qbs.targetOS.includes("unix") \endcode To find out the value of \c qbs.targetOS, use \c {console.info()}: \code readonly property bool unix: { console.info("qbs.targetOS: " + qbs.targetOS) return qbs.targetOS.includes("unix") } \endcode It is also possible to throw an exception with the text saying what is wrong - this might be useful if the property contains invalid or unsupported value: \code readonly property bool unix: { if (qbs.targetOS.includes("darwin")) throw "Apple platforms are not supported"; return qbs.targetOS.includes("unix") } \endcode \section1 How do I debug \QBS scripts? To debug the value of a specific property, see the \l{How do I print the value of a property} section. Similar debugging techniques could be used within \l{Rule}{Rules} or \c .js files. It is also possible to increase \QBS' logging level using the \c --more-verbose (\c -v) option of the \c{qbs build} command: \code qbs build -v config:release \endcode \QBS uses the Qt Categorized Logging system which allows to configure logging categories in \l{https://doc.qt.io/qt-5/qloggingcategory.html#configuring-categories}{multiple ways}. For example, to enable debug logging for the \c moduleloader category, use the following command: \code QT_LOGGING_RULES="qbs.moduleloader.debug=true" qbs resolve \endcode To list all the files in the project directory and show whether they are known to qbs in the respective configuration, use the \c{qbs status} command: \code qbs status config:release \endcode \section1 How do I sign an application for an Apple platform? To sign an application for an Apple platform, you need to use the \l{codesign} module. \code Depends { name: "codesign" } \endcode Several properties should be set to do signing as shown below. Make sure that bundle and team indentifiers match the one used for signing: \code bundle.identifierPrefix: "com.johndoe" codesign.teamIdentifier: "John Doe" \endcode It is also possible to use an ID of the team identifier instead of a name: \code codesign.teamIdentifier: "1234ABCDEF" \endcode \QBS will then try to find the matching signing identity and provisioning profile based on \l{codesign::signingType}{codesign.signingType}. It is also possible to specify \l{codesign::signingIdentity}{codesign.signingIdentity} manually: \code codesign.signingIdentity: "Apple Development: johndoe@apple.com (ABCDEF1234)" \endcode It is also possible to use an ID of the signing identity instead of a name: \code codesign.signingIdentity: "ABCDEF1234567890ABCDEF1234567890ABCDEF12" \endcode If \QBS cannot find the suitable provisioning profile, you can specify it manually as well: \code codesign.provisioningProfile: "abcdef12-1234-5678-1111-abcdef123456" \endcode */ qbs-src-3.2.0/doc/qbs.qdocconf0000644000175100017510000000015115154533055015547 0ustar runnerrunnerinclude(config/qbs-project.qdocconf) include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf) qbs-src-3.2.0/doc/doc.qbs0000644000175100017510000000737615154533055014540 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.Probes Project { references: ["man/man.qbs"] Product { name: "qbs documentation" builtByDefault: false type: Qt.core.config.contains("cross_compile") ? ["qbsdoc.qdoc-html-fixed"] : [ "qbsdoc.qdoc-html-fixed", "qch"] property string fixedHtmlDir: FileInfo.joinPaths(buildDirectory, "qdoc-html-fixed") Depends { name: "Qt.core" } Depends { name: "qbsbuildconfig" } Depends { name: "qbsversion" } Probes.BinaryProbe { id: pythonProbe names: ["python3", "python"] // on Windows, there's no python3 } property string pythonPath: pythonProbe.found ? pythonProbe.filePath : undefined files: [ "../README.md", "../CONTRIBUTING.md", "classic.css", "external-resources.qdoc", "fixnavi.pl", "howtos.qdoc", "qbs.qdoc", "tutorial.qdoc", "qbs-online.qdocconf", "config/*.qdocconf", "config/style/qt5-sidebar.html", "appendix/**/*", "reference/**/*", "templates/**/*", "images/**", "targets/**", ] Group { name: "main qdocconf file" files: "qbs.qdocconf" fileTags: "qdocconf-main" } Group { name: "fix-imports script" files: ["fix-qmlimports.py"] fileTags: ["qbsdoc.fiximports"] } property string versionTag: qbsversion.version.replace(/\.|-/g, "") Qt.core.qdocEnvironment: [ "QBS_VERSION=" + qbsversion.version, "SRCDIR=" + path, "QT_INSTALL_DOCS=" + Qt.core.docPath, "QBS_VERSION_TAG=" + versionTag ] Rule { inputs: ["qdoc-png"] explicitlyDependsOn: ["qbsdoc.fiximports"] multiplex: true outputFileTags: ["qdoc-html", "qbsdoc.dummy"] // TODO: Hack. Rule injection to the rescue? outputArtifacts: [{filePath: "dummy", fileTags: ["qbsdoc.dummy"]}] prepare: { if (!product.pythonPath) throw "Python executable was not found"; var scriptPath = explicitlyDependsOn["qbsdoc.fiximports"][0].filePath; var htmlDir = FileInfo.path(FileInfo.path(inputs["qdoc-png"][0].filePath)); var fixCmd = new Command(product.pythonPath, [scriptPath, htmlDir]); fixCmd.description = "fixing bogus QML import statements"; return [fixCmd]; } } Rule { inputs: ["qdoc-html"] Artifact { filePath: FileInfo.joinPaths(product.fixedHtmlDir, input.fileName) fileTags: ["qbsdoc.qdoc-html-fixed"] } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } return [cmd]; } } Group { fileTagsFilter: ["qbsdoc.qdoc-html-fixed"] qbs.install: qbsbuildconfig.installHtml qbs.installDir: qbsbuildconfig.docInstallDir qbs.installSourceBase: product.fixedHtmlDir } Group { fileTagsFilter: ["qdoc-css", "qdoc-png"] qbs.install: qbsbuildconfig.installHtml qbs.installDir: qbsbuildconfig.docInstallDir qbs.installSourceBase: Qt.core.qdocOutputDir } Group { fileTagsFilter: ["qch"] qbs.install: qbsbuildconfig.installQch qbs.installDir: qbsbuildconfig.docInstallDir } } } qbs-src-3.2.0/doc/classic.css0000644000175100017510000001032015154533055015376 0ustar runnerrunnerBODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { font-family: Arial, Geneva, Helvetica, sans-serif; } H1 { text-align: center; font-size: 160%; } H2 { font-size: 120%; } H3 { font-size: 100%; } h3.fn,span.fn { background-color: #eee; border-width: 1px; border-style: solid; border-color: #ddd; font-weight: bold; padding: 6px 0px 6px 10px; margin: 42px 0px 0px 0px; } hr { border: 0; color: #a0a0a0; background-color: #ccc; height: 1px; width: 100%; text-align: left; margin: 34px 0px 34px 0px; } table.valuelist { border-width: 1px 1px 1px 1px; border-style: solid; border-color: #dddddd; border-collapse: collapse; background-color: #f0f0f0; } table.indextable { border-width: 1px 1px 1px 1px; border-collapse: collapse; background-color: #f0f0f0; border-color:#555; font-size: 110%; } table td.largeindex { border-width: 1px 1px 1px 1px; border-collapse: collapse; background-color: #f0f0f0; border-color:#555; font-size: 120%; } table.valuelist th { border-width: 1px 1px 1px 2px; padding: 4px; border-style: solid; border-color: #666; color:white; background-color:#666; } th.titleheader { border-width: 1px 0px 1px 0px; padding: 4px; border-style: solid; border-color: #444; color:white; background-color:#555555; font-size: 110%; } th.largeheader { border-width: 1px 0px 1px 0px; padding: 4px; border-style: solid; border-color: #444; color:white; background-color:#555555; font-size: 120%; } p { margin-left: 4px; margin-top: 8px; margin-bottom: 8px; } a:link { color: #0046ad; text-decoration: none } a:visited { color: #672967; text-decoration: none } a.obsolete { color: #661100; text-decoration: none } a.compat { color: #661100; text-decoration: none } a.obsolete:visited { color: #995500; text-decoration: none } a.compat:visited { color: #995500; text-decoration: none } body { background: #ffffff; color: black } table.generic, table.annotated { border-width: 1px; border-color:#bbb; border-style:solid; border-collapse:collapse; } table td.memItemLeft { width: 180px; padding: 2px 0px 0px 8px; margin: 4px; border-width: 1px; border-color: #E0E0E0; border-style: none; font-size: 100%; white-space: nowrap } table td.memItemRight { padding: 2px 8px 0px 8px; margin: 4px; border-width: 1px; border-color: #E0E0E0; border-style: none; font-size: 100%; } table tr.odd { background: #f0f0f0; color: black; } table tr.even { background: #e4e4e4; color: black; } table.annotated th { padding: 3px; text-align: left } table.annotated td { padding: 3px; } table tr pre { padding-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; border: none; background: none } tr.qt-style { background: #96E066; color: black } body pre { padding: 0.2em; border: #e7e7e7 1px solid; background: #f1f1f1; color: black } table tr.qt-code pre { padding: 0.2em; border: #e7e7e7 1px solid; background: #f1f1f1; color: black } span.preprocessor, span.preprocessor a { color: darkblue; } span.comment { color: darkred; font-style: italic } span.string,span.char { color: darkgreen; } .title { text-align: center } .subtitle { font-size: 0.8em } .small-subtitle { font-size: 0.65em } .qmlitem { padding: 0; } .qmlname { white-space: nowrap; font-weight: bold; font-size: 125%; } .qmltype { font-weight: bold; font-size: 125%; } .qmlproto, .qmldoc { // border-top: 1px solid #84b0c7; } .qmlproto { padding: 0; //background-color: #e4e4e4;//#d5e1e8; //font-weight: bold; //-webkit-border-top-left-radius: 8px; //-webkit-border-top-right-radius: 8px; //-moz-border-radius-topleft: 8px; //-moz-border-radius-topright: 8px; } .qmldoc { border-top: 1px solid #e4e4e4; //padding: 2px 5px; //background-color: #eef3f5; //border-top-width: 0; //-webkit-border-bottom-left-radius: 8px; //-webkit-border-bottom-right-radius: 8px; //-moz-border-radius-bottomleft: 8px; //-moz-border-radius-bottomright: 8px; } .qmldoc p, .qmldoc dl, .qmldoc ul { //margin: 6px 0; } *.qmlitem p { //margin-top: 0px; //margin-bottom: 0px; } qbs-src-3.2.0/tutorial/0000755000175100017510000000000015154533055014345 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-8/0000755000175100017510000000000015154533055016140 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-8/lib/0000755000175100017510000000000015154533055016706 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-8/lib/lib.qbs0000644000175100017510000000022715154533055020164 0ustar runnerrunnerMyLibrary { name: "mylib" files: [ "lib.c" ] publicHeaders: [ "lib.h" ] Depends { name: 'cpp' } cpp.defines: ['CRUCIAL_DEFINE'] } qbs-src-3.2.0/tutorial/chapter-8/lib/lib_global.h0000644000175100017510000000107415154533055021147 0ustar runnerrunner#ifndef LIB_GLOBAL_H #define LIB_GLOBAL_H #if defined(_WIN32) || defined(WIN32) #define MY_LIB_DECL_EXPORT __declspec(dllexport) #define MY_LIB_DECL_IMPORT __declspec(dllimport) #else #define MY_LIB_DECL_EXPORT __attribute__((visibility("default"))) #define MY_LIB_DECL_IMPORT __attribute__((visibility("default"))) #endif // ![0] // lib/lib_global.h #if defined(MYLIB_STATIC_LIBRARY) #define MYLIB_EXPORT #else #if defined(MYLIB_LIBRARY) #define MYLIB_EXPORT MY_LIB_DECL_EXPORT #else #define MYLIB_EXPORT MY_LIB_DECL_IMPORT #endif #endif // ![0] #endif // LIB_GLOBAL_Hqbs-src-3.2.0/tutorial/chapter-8/lib/lib.h0000644000175100017510000000015615154533055017627 0ustar runnerrunner#ifndef LIB_H #define LIB_H #include "lib_global.h" MYLIB_EXPORT const char *get_string(); #endif // LIB_H qbs-src-3.2.0/tutorial/chapter-8/lib/lib.c0000644000175100017510000000022415154533055017616 0ustar runnerrunner#include "lib.h" #ifndef CRUCIAL_DEFINE # error CRUCIAL_DEFINE not defined #endif const char *get_string() { return "Hello from library"; } qbs-src-3.2.0/tutorial/chapter-8/qbs/0000755000175100017510000000000015154533055016725 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-8/qbs/imports/0000755000175100017510000000000015154533055020422 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-8/qbs/imports/MyAutoTest.qbs0000644000175100017510000000007015154533055023204 0ustar runnerrunnerMyApplication { type: ["application", "autotest"] } qbs-src-3.2.0/tutorial/chapter-8/qbs/imports/MyLibrary.qbs0000644000175100017510000000220715154533055023044 0ustar runnerrunner// ![0] Library { version: project.version property pathList publicHeaders Depends { name: "cpp" } Depends { name: "config.myproject" } Depends { name: "installpaths" } Group { condition: publicHeaders.length > 0 name: "Public Headers" prefix: product.sourceDirectory + "/" files: publicHeaders qbs.install: config.myproject.installPublicHeaders qbs.installDir: installpaths.include } readonly property string _nameUpper : name.replace(" ", "_").toUpperCase() property string libraryMacro: _nameUpper + "_LIBRARY" property string staticLibraryMacro: _nameUpper + "_STATIC_LIBRARY" cpp.defines: config.build.libraryType === "static" ? [staticLibraryMacro] : [libraryMacro] cpp.sonamePrefix: qbs.targetOS.contains("darwin") ? "@rpath" : undefined Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory] cpp.defines: exportingProduct.config.build.libraryType === "static" ? [exportingProduct.staticLibraryMacro] : [] } Depends { name: "bundle" } bundle.isBundle: false } // ![0] qbs-src-3.2.0/tutorial/chapter-8/qbs/imports/MyApplication.qbs0000644000175100017510000000015615154533055023704 0ustar runnerrunnerCppApplication { Depends { name: "config.myproject" } version: "1.0.0" consoleApplication: true } qbs-src-3.2.0/tutorial/chapter-8/qbs/imports/ConfigMyProject.qbs0000644000175100017510000000133215154533055024172 0ustar runnerrunnerimport qbs.FileInfo Module { property bool enableAddressSanitizer: false Depends { name: "Sanitizers.address"; condition: enableAddressSanitizer } Depends { name: "cpp" } Depends { name: "config.install" } property bool enableRPath: true property stringList libRPaths: { if (enableRPath && cpp.rpathOrigin && product.installDir) { return [ FileInfo.joinPaths( cpp.rpathOrigin, FileInfo.relativePath( FileInfo.joinPaths('/', product.installDir), FileInfo.joinPaths('/', config.install.dynamicLibrariesDirectory)))]; } return []; } cpp.rpaths: libRPaths } qbs-src-3.2.0/tutorial/chapter-8/qbs/modules/0000755000175100017510000000000015154533055020375 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-8/qbs/modules/config/0000755000175100017510000000000015154533055021642 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-8/qbs/modules/config/install/0000755000175100017510000000000015154533055023310 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-8/qbs/modules/config/install/module.qbs0000644000175100017510000000005415154533055025303 0ustar runnerrunnerConfigInstall { importLibraries: true } qbs-src-3.2.0/tutorial/chapter-8/qbs/modules/config/myproject/0000755000175100017510000000000015154533055023656 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-8/qbs/modules/config/myproject/module.qbs0000644000175100017510000000002415154533055025646 0ustar runnerrunnerConfigMyProject { } qbs-src-3.2.0/tutorial/chapter-8/app/0000755000175100017510000000000015154533055016720 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-8/app/app.qbs0000644000175100017510000000016715154533055020213 0ustar runnerrunnerMyApplication { Depends { name: "mylib" } name: "My Application" targetName: "myapp" files: "main.c" } qbs-src-3.2.0/tutorial/chapter-8/app/main.c0000644000175100017510000000020315154533055020003 0ustar runnerrunner#include #include "lib.h" int main() { printf("Hello, world\n"); printf("%s\n", get_string()); return 0; } qbs-src-3.2.0/tutorial/chapter-8/myproject.qbs0000644000175100017510000000106215154533055020662 0ustar runnerrunnerProject { property bool withTests: true property stringList autotestArguments: [] property stringList autotestWrapper: [] name: "My Project" minimumQbsVersion: "2.0" references: [ "app/app.qbs", "lib/lib.qbs", ] qbsSearchPaths: "qbs" SubProject { filePath: "test/test.qbs" Properties { condition: parent.withTests } } AutotestRunner { condition: parent.withTests arguments: parent.autotestArguments wrapper: parent.autotestWrapper } } qbs-src-3.2.0/tutorial/chapter-8/test/0000755000175100017510000000000015154533055017117 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-8/test/test.c0000644000175100017510000000056215154533055020245 0ustar runnerrunner#include "lib.h" #include #include int main(int argc, char *argv[]) { if (argc > 2) { printf("usage: test [value]\n"); return 1; } const char *expected = argc == 2 ? argv[1] : "Hello from library"; if (strcmp(get_string(), expected) != 0) { printf("text differs\n"); return 1; } return 0; } qbs-src-3.2.0/tutorial/chapter-8/test/test.qbs0000644000175100017510000000012415154533055020602 0ustar runnerrunnerMyAutoTest { Depends { name: "mylib" } name: "mytest" files: "test.c" } qbs-src-3.2.0/tutorial/tutorial.qbs0000644000175100017510000000005715154533055016721 0ustar runnerrunnerProduct { files: [ "*/**", ] } qbs-src-3.2.0/tutorial/chapter-3/0000755000175100017510000000000015154533055016133 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-3/lib/0000755000175100017510000000000015154533055016701 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-3/lib/lib.qbs0000644000175100017510000000074715154533055020166 0ustar runnerrunner//! [0] // lib/lib.qbs DynamicLibrary { name: "mylib" files: ["lib.c"] publicHeaders: ["lib.h", "lib_global.h"] version: "1.0.0" Depends { name: "cpp" } cpp.defines: ["MYLIB_LIBRARY", "CRUCIAL_DEFINE"] cpp.sonamePrefix: qbs.targetOS.contains("darwin") ? "@rpath" : undefined Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory] } Depends { name: "bundle" } bundle.isBundle: false } //! [0] qbs-src-3.2.0/tutorial/chapter-3/lib/lib_global.h0000644000175100017510000000076515154533055021150 0ustar runnerrunner//! [0] // lib/lib_global.h #ifndef LIB_GLOBAL_H #define LIB_GLOBAL_H #if defined(_WIN32) || defined(WIN32) #define MYLIB_DECL_EXPORT __declspec(dllexport) #define MYLIB_DECL_IMPORT __declspec(dllimport) #else #define MYLIB_DECL_EXPORT __attribute__((visibility("default"))) #define MYLIB_DECL_IMPORT __attribute__((visibility("default"))) #endif #if defined(MYLIB_LIBRARY) #define MYLIB_EXPORT MYLIB_DECL_EXPORT #else #define MYLIB_EXPORT MYLIB_DECL_IMPORT #endif #endif // LIB_GLOBAL_H //! [0] qbs-src-3.2.0/tutorial/chapter-3/lib/lib.h0000644000175100017510000000021315154533055017614 0ustar runnerrunner#ifndef LIB_H #define LIB_H //! [0] // lib/lib.h #include "lib_global.h" MYLIB_EXPORT const char *get_string(); //! [0] #endif // LIB_H qbs-src-3.2.0/tutorial/chapter-3/lib/lib.c0000644000175100017510000000026615154533055017617 0ustar runnerrunner //! [0] // lib/lib.cpp #include "lib.h" #ifndef CRUCIAL_DEFINE # error CRUCIAL_DEFINE not defined #endif const char *get_string() { return "Hello from library"; } //! [0] qbs-src-3.2.0/tutorial/chapter-3/app/0000755000175100017510000000000015154533055016713 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-3/app/app.qbs0000644000175100017510000000107715154533055020207 0ustar runnerrunner//! [1] // app/app.qbs import qbs.FileInfo CppApplication { Depends { name: "mylib" } name: "My Application" targetName: "myapp" files: "main.c" version: "1.0.0" consoleApplication: true //! [0] cpp.rpaths: { if (!cpp.rpathOrigin) return []; return [ FileInfo.joinPaths( cpp.rpathOrigin, FileInfo.relativePath( FileInfo.joinPaths("/", product.installDir), FileInfo.joinPaths("/", "lib"))) ]; } //! [0] } //! [1] qbs-src-3.2.0/tutorial/chapter-3/app/main.c0000644000175100017510000000020315154533055017776 0ustar runnerrunner#include #include "lib.h" int main() { printf("Hello, world\n"); printf("%s\n", get_string()); return 0; } qbs-src-3.2.0/tutorial/chapter-3/myproject.qbs0000644000175100017510000000017715154533055020663 0ustar runnerrunnerProject { name: "My Project" minimumQbsVersion: "2.0" references: [ "app/app.qbs", "lib/lib.qbs" ] } qbs-src-3.2.0/tutorial/LICENSE0000644000175100017510000000465715154533055015366 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 Ivan Komissarov (abbapoh@gmail.com) ** Contact: https://www.qt.io/licensing/ ** ** Files in this directory are part of the Qbs tutorial. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use these files 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. ** ** BSD License Usage ** Alternatively, you may use this these files under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/qbs-src-3.2.0/tutorial/chapter-2/0000755000175100017510000000000015154533055016132 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-2/lib/0000755000175100017510000000000015154533055016700 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-2/lib/lib.qbs0000644000175100017510000000062715154533055020162 0ustar runnerrunner//! [0] StaticLibrary { name: "mylib" files: [ "lib.c", "lib.h", ] version: "1.0.0" //! [1] cpp.defines: ['CRUCIAL_DEFINE'] //! [1] //! [2] Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory] } //! [2] //! [3] Depends { name: 'bundle' } bundle.isBundle: false //! [3] } //! [0] qbs-src-3.2.0/tutorial/chapter-2/lib/lib.h0000644000175100017510000000014715154533055017621 0ustar runnerrunner//! [0] // lib/lib.h #ifndef LIB_H #define LIB_H const char *get_string(); #endif // LIB_H //! [0] qbs-src-3.2.0/tutorial/chapter-2/lib/lib.c0000644000175100017510000000026515154533055017615 0ustar runnerrunner//! [0] // lib/lib.cpp #include "lib.h" #ifndef CRUCIAL_DEFINE # error CRUCIAL_DEFINE not defined #endif const char *get_string() { return "Hello from library"; } //! [0] qbs-src-3.2.0/tutorial/chapter-2/app/0000755000175100017510000000000015154533055016712 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-2/app/app.qbs0000644000175100017510000000025315154533055020201 0ustar runnerrunnerCppApplication { Depends { name: "mylib" } name: "My Application" targetName: "myapp" files: "main.c" version: "1.0.0" consoleApplication: true } qbs-src-3.2.0/tutorial/chapter-2/app/main.c0000644000175100017510000000020315154533055017775 0ustar runnerrunner#include #include "lib.h" int main() { printf("Hello, world\n"); printf("%s\n", get_string()); return 0; } qbs-src-3.2.0/tutorial/chapter-2/myproject.qbs0000644000175100017510000000021715154533055020655 0ustar runnerrunner//! [0] Project { name: "My Project" minimumQbsVersion: "2.0" references: [ "app/app.qbs", "lib/lib.qbs" ] } //! [0] qbs-src-3.2.0/tutorial/chapter-9/0000755000175100017510000000000015154533055016141 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-9/lib/0000755000175100017510000000000015154533055016707 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-9/lib/lib.qbs0000644000175100017510000000022615154533055020164 0ustar runnerrunnerMyLibrary { name: "mylib" files: [ "lib.c", "lib.h", ] Depends { name: 'cpp' } cpp.defines: ['CRUCIAL_DEFINE'] } qbs-src-3.2.0/tutorial/chapter-9/lib/lib_global.h0000644000175100017510000000107515154533055021151 0ustar runnerrunner#ifndef LIB_GLOBAL_H #define LIB_GLOBAL_H #if defined(_WIN32) || defined(WIN32) #define MY_LIB_DECL_EXPORT __declspec(dllexport) #define MY_LIB_DECL_IMPORT __declspec(dllimport) #else #define MY_LIB_DECL_EXPORT __attribute__((visibility("default"))) #define MY_LIB_DECL_IMPORT __attribute__((visibility("default"))) #endif // ![0] // lib/lib_global.h #if defined(MYLIB_STATIC_LIBRARY) #define MYLIB_EXPORT #else #if defined(MYLIB_LIBRARY) #define MYLIB_EXPORT MY_LIB_DECL_EXPORT #else #define MYLIB_EXPORT MY_LIB_DECL_IMPORT #endif #endif // ![0] #endif // LIB_GLOBAL_H qbs-src-3.2.0/tutorial/chapter-9/lib/lib.h0000644000175100017510000000015615154533055017630 0ustar runnerrunner#ifndef LIB_H #define LIB_H #include "lib_global.h" MYLIB_EXPORT const char *get_string(); #endif // LIB_H qbs-src-3.2.0/tutorial/chapter-9/lib/lib.c0000644000175100017510000000022415154533055017617 0ustar runnerrunner#include "lib.h" #ifndef CRUCIAL_DEFINE # error CRUCIAL_DEFINE not defined #endif const char *get_string() { return "Hello from library"; } qbs-src-3.2.0/tutorial/chapter-9/qbs/0000755000175100017510000000000015154533055016726 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-9/qbs/imports/0000755000175100017510000000000015154533055020423 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-9/qbs/imports/MyAutoTest.qbs0000644000175100017510000000007015154533055023205 0ustar runnerrunnerMyApplication { type: ["application", "autotest"] } qbs-src-3.2.0/tutorial/chapter-9/qbs/imports/MyLibrary.qbs0000644000175100017510000000144315154533055023046 0ustar runnerrunner// ![0] CppLibrary { Depends { name: "config.myproject" } version: config.myproject.productVersion readonly property string _nameUpper : name.replace(" ", "_").toUpperCase() property string libraryMacro: _nameUpper + "_LIBRARY" property string staticLibraryMacro: _nameUpper + "_STATIC_LIBRARY" cpp.defines: config.build.libraryType === "static" ? [staticLibraryMacro] : [libraryMacro] cpp.sonamePrefix: qbs.targetOS.contains("darwin") ? "@rpath" : undefined Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory] cpp.defines: exportingProduct.config.build.libraryType === "static" ? [exportingProduct.staticLibraryMacro] : [] } Depends { name: "bundle" } bundle.isBundle: false } // ![0] qbs-src-3.2.0/tutorial/chapter-9/qbs/imports/MyApplication.qbs0000644000175100017510000000020715154533055023702 0ustar runnerrunnerCppApplication { Depends { name: "config.myproject" } version: config.myproject.productVersion consoleApplication: true } qbs-src-3.2.0/tutorial/chapter-9/qbs/imports/ConfigMyProject.qbs0000644000175100017510000000151115154533055024172 0ustar runnerrunnerimport qbs.FileInfo //! [0] // qbs/imports/ConfigMyProject.qbs Module { property string productVersion: "1.0.0" // ... //! [0] property bool enableAddressSanitizer: false Depends { name: "Sanitizers.address"; condition: enableAddressSanitizer } Depends { name: "cpp" } Depends { name: "config.install" } property bool enableRPath: true property stringList libRPaths: { if (enableRPath && cpp.rpathOrigin && product.installDir) { return [ FileInfo.joinPaths( cpp.rpathOrigin, FileInfo.relativePath( FileInfo.joinPaths('/', product.installDir), FileInfo.joinPaths('/', config.install.dynamicLibrariesDirectory)))]; } return []; } cpp.rpaths: libRPaths } qbs-src-3.2.0/tutorial/chapter-9/qbs/modules/0000755000175100017510000000000015154533055020376 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-9/qbs/modules/config/0000755000175100017510000000000015154533055021643 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-9/qbs/modules/config/install/0000755000175100017510000000000015154533055023311 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-9/qbs/modules/config/install/module.qbs0000644000175100017510000000005415154533055025304 0ustar runnerrunnerConfigInstall { importLibraries: true } qbs-src-3.2.0/tutorial/chapter-9/qbs/modules/config/myproject/0000755000175100017510000000000015154533055023657 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-9/qbs/modules/config/myproject/module.qbs0000644000175100017510000000002415154533055025647 0ustar runnerrunnerConfigMyProject { } qbs-src-3.2.0/tutorial/chapter-9/version-header/0000755000175100017510000000000015154533055021054 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-9/version-header/version-header.qbs0000644000175100017510000000235315154533055024501 0ustar runnerrunner//! [5] // version-header/version-header.qbs //! [0] import qbs.TextFile Product { name: "version_header" type: "hpp" Depends { name: "config.myproject" } //! [0] //! [1] Group { files: ["version.h.in"] fileTags: ["version_h_in"] } //! [1] //! [2] Rule { inputs: ["version_h_in"] Artifact { filePath: "version.h" fileTags: "hpp" } //! [2] //! [3] prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.highlight = "codegen"; cmd.sourceCode = function() { var file = new TextFile(input.filePath, TextFile.ReadOnly); var content = file.readAll(); content = content.replace( "${PRODUCT_VERSION}", product.config.myproject.productVersion); file = new TextFile(output.filePath, TextFile.WriteOnly); file.write(content); file.close(); } return cmd; } //! [3] } //! [4] Export { Depends { name: "cpp" } cpp.includePaths: exportingProduct.buildDirectory } //! [4] } //! [5] qbs-src-3.2.0/tutorial/chapter-9/version-header/version.h.in0000644000175100017510000000023615154533055023320 0ustar runnerrunner//! [0] // version-header/version.h.in #ifndef VERSION_H #define VERSION_H const char kProductVersion[] = "${PRODUCT_VERSION}"; #endif // VERSION_H //! [0] qbs-src-3.2.0/tutorial/chapter-9/app/0000755000175100017510000000000015154533055016721 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-9/app/app.qbs0000644000175100017510000000025615154533055020213 0ustar runnerrunner//! [0] MyApplication { Depends { name: "mylib" } Depends { name: "version_header" } name: "My Application" targetName: "myapp" files: "main.c" } //! [0] qbs-src-3.2.0/tutorial/chapter-9/app/main.c0000644000175100017510000000033415154533055020011 0ustar runnerrunner//![0] #include #include #include int main() { printf("Hello, world\n"); printf("%s\n", get_string()); printf("ProductVersion = %s\n", kProductVersion); return 0; } //![0] qbs-src-3.2.0/tutorial/chapter-9/myproject.qbs0000644000175100017510000000126115154533055020664 0ustar runnerrunnerProject { property string version: "1.0.0" property bool withTests: true property stringList autotestArguments: [] property stringList autotestWrapper: [] name: "My Project" minimumQbsVersion: "2.0" //! [0] // myproject.qbs references: [ "app/app.qbs", "lib/lib.qbs", "version-header/version-header.qbs", ] //! [0] qbsSearchPaths: "qbs" SubProject { filePath: "test/test.qbs" Properties { condition: parent.withTests } } AutotestRunner { condition: parent.withTests arguments: parent.autotestArguments wrapper: parent.autotestWrapper } } qbs-src-3.2.0/tutorial/chapter-9/test/0000755000175100017510000000000015154533055017120 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-9/test/test.c0000644000175100017510000000056215154533055020246 0ustar runnerrunner#include "lib.h" #include #include int main(int argc, char *argv[]) { if (argc > 2) { printf("usage: test [value]\n"); return 1; } const char *expected = argc == 2 ? argv[1] : "Hello from library"; if (strcmp(get_string(), expected) != 0) { printf("text differs\n"); return 1; } return 0; } qbs-src-3.2.0/tutorial/chapter-9/test/test.qbs0000644000175100017510000000012415154533055020603 0ustar runnerrunnerMyAutoTest { Depends { name: "mylib" } name: "mytest" files: "test.c" } qbs-src-3.2.0/tutorial/chapter-6/0000755000175100017510000000000015154533055016136 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-6/lib/0000755000175100017510000000000015154533055016704 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-6/lib/lib.qbs0000644000175100017510000000025215154533055020160 0ustar runnerrunnerMyLibrary { name: "mylib" files: ["lib.c"] publicHeaders: [ "lib.h", "lib_global.h", ] cpp.defines: base.concat(['CRUCIAL_DEFINE']) } qbs-src-3.2.0/tutorial/chapter-6/lib/lib_global.h0000644000175100017510000000071715154533055021150 0ustar runnerrunner#ifndef LIB_GLOBAL_H #define LIB_GLOBAL_H #if defined(_WIN32) || defined(WIN32) #define MYLIB_DECL_EXPORT __declspec(dllexport) #define MYLIB_DECL_IMPORT __declspec(dllimport) #else #define MYLIB_DECL_EXPORT __attribute__((visibility("default"))) #define MYLIB_DECL_IMPORT __attribute__((visibility("default"))) #endif #if defined(MYLIB_LIBRARY) #define MYLIB_EXPORT MYLIB_DECL_EXPORT #else #define MYLIB_EXPORT MYLIB_DECL_IMPORT #endif #endif // LIB_GLOBAL_H qbs-src-3.2.0/tutorial/chapter-6/lib/lib.h0000644000175100017510000000015615154533055017625 0ustar runnerrunner#ifndef LIB_H #define LIB_H #include "lib_global.h" MYLIB_EXPORT const char *get_string(); #endif // LIB_H qbs-src-3.2.0/tutorial/chapter-6/lib/lib.c0000644000175100017510000000022415154533055017614 0ustar runnerrunner#include "lib.h" #ifndef CRUCIAL_DEFINE # error CRUCIAL_DEFINE not defined #endif const char *get_string() { return "Hello from library"; } qbs-src-3.2.0/tutorial/chapter-6/qbs/0000755000175100017510000000000015154533055016723 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-6/qbs/imports/0000755000175100017510000000000015154533055020420 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-6/qbs/imports/MyAutoTest.qbs0000644000175100017510000000006615154533055023207 0ustar runnerrunnerMyApplication { type: base.concat(["autotest"]) } qbs-src-3.2.0/tutorial/chapter-6/qbs/imports/MyLibrary.qbs0000644000175100017510000000067215154533055023046 0ustar runnerrunnerDynamicLibrary { version: project.version Depends { name: 'cpp' } property string libraryMacro: name.replace(" ", "_").toUpperCase() + "_LIBRARY" cpp.defines: [libraryMacro] cpp.sonamePrefix: qbs.targetOS.contains("darwin") ? "@rpath" : undefined Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory] } Depends { name: 'bundle' } bundle.isBundle: false } qbs-src-3.2.0/tutorial/chapter-6/qbs/imports/MyApplication.qbs0000644000175100017510000000071115154533055023677 0ustar runnerrunnerimport qbs.FileInfo //! [0] CppApplication { version: project.version consoleApplication: true // ... //! [0] cpp.rpaths: { if (!cpp.rpathOrigin) return []; return [ FileInfo.joinPaths( cpp.rpathOrigin, FileInfo.relativePath( FileInfo.joinPaths("/", product.installDir), FileInfo.joinPaths("/", "lib"))) ]; } } qbs-src-3.2.0/tutorial/chapter-6/app/0000755000175100017510000000000015154533055016716 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-6/app/app.qbs0000644000175100017510000000016715154533055020211 0ustar runnerrunnerMyApplication { Depends { name: "mylib" } name: "My Application" targetName: "myapp" files: "main.c" } qbs-src-3.2.0/tutorial/chapter-6/app/main.c0000644000175100017510000000020315154533055020001 0ustar runnerrunner#include #include "lib.h" int main() { printf("Hello, world\n"); printf("%s\n", get_string()); return 0; } qbs-src-3.2.0/tutorial/chapter-6/myproject.qbs0000644000175100017510000000124715154533055020665 0ustar runnerrunner//! [0] Project { property string version: "1.0.0" property bool withTests: false property stringList autotestArguments: [] property stringList autotestWrapper: [] name: "My Project" minimumQbsVersion: "2.0" // ... //! [0] references: [ "app/app.qbs", "lib/lib.qbs", ] qbsSearchPaths: "qbs" //! [1] SubProject { filePath: "test/test.qbs" Properties { condition: parent.withTests } } //! [1] //! [2] AutotestRunner { condition: parent.withTests arguments: parent.autotestArguments wrapper: parent.autotestWrapper } //! [2] } qbs-src-3.2.0/tutorial/chapter-6/test/0000755000175100017510000000000015154533055017115 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-6/test/test.c0000644000175100017510000000056215154533055020243 0ustar runnerrunner#include "lib.h" #include #include int main(int argc, char *argv[]) { if (argc > 2) { printf("usage: test [value]\n"); return 1; } const char *expected = argc == 2 ? argv[1] : "Hello from library"; if (strcmp(get_string(), expected) != 0) { printf("text differs\n"); return 1; } return 0; } qbs-src-3.2.0/tutorial/chapter-6/test/test.qbs0000644000175100017510000000012415154533055020600 0ustar runnerrunnerMyAutoTest { Depends { name: "mylib" } name: "mytest" files: "test.c" } qbs-src-3.2.0/tutorial/chapter-1/0000755000175100017510000000000015154533055016131 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-1/app/0000755000175100017510000000000015154533055016711 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-1/app/app.qbs0000644000175100017510000000023515154533055020200 0ustar runnerrunner//! [0] CppApplication { name: "My Application" targetName: "myapp" files: "main.c" version: "1.0.0" consoleApplication: true } //! [0] qbs-src-3.2.0/tutorial/chapter-1/app/main.c0000644000175100017510000000013715154533055020002 0ustar runnerrunner//! [0] #include int main() { printf("Hello, world\n"); return 0; } //! [0] qbs-src-3.2.0/tutorial/chapter-1/myproject.qbs0000644000175100017510000000017115154533055020653 0ustar runnerrunner//! [0] Project { name: "My Project" minimumQbsVersion: "2.0" references: [ "app/app.qbs" ] } //! [0] qbs-src-3.2.0/tutorial/chapter-7/0000755000175100017510000000000015154533055016137 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-7/lib/0000755000175100017510000000000015154533055016705 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-7/lib/lib.qbs0000644000175100017510000000510115154533055020157 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of Qbs. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ //! [0] // lib/lib.qbs MyLibrary { name: "mylib" files: [ "lib.c" ] publicHeaders: [ "lib.h" ] Depends { name: 'cpp' } cpp.defines: ['CRUCIAL_DEFINE'] } //! [0] qbs-src-3.2.0/tutorial/chapter-7/lib/lib_global.h0000644000175100017510000000071715154533055021151 0ustar runnerrunner#ifndef LIB_GLOBAL_H #define LIB_GLOBAL_H #if defined(_WIN32) || defined(WIN32) #define MYLIB_DECL_EXPORT __declspec(dllexport) #define MYLIB_DECL_IMPORT __declspec(dllimport) #else #define MYLIB_DECL_EXPORT __attribute__((visibility("default"))) #define MYLIB_DECL_IMPORT __attribute__((visibility("default"))) #endif #if defined(MYLIB_LIBRARY) #define MYLIB_EXPORT MYLIB_DECL_EXPORT #else #define MYLIB_EXPORT MYLIB_DECL_IMPORT #endif #endif // LIB_GLOBAL_H qbs-src-3.2.0/tutorial/chapter-7/lib/lib.h0000644000175100017510000000015615154533055017626 0ustar runnerrunner#ifndef LIB_H #define LIB_H #include "lib_global.h" MYLIB_EXPORT const char *get_string(); #endif // LIB_H qbs-src-3.2.0/tutorial/chapter-7/lib/lib.c0000644000175100017510000000022415154533055017615 0ustar runnerrunner#include "lib.h" #ifndef CRUCIAL_DEFINE # error CRUCIAL_DEFINE not defined #endif const char *get_string() { return "Hello from library"; } qbs-src-3.2.0/tutorial/chapter-7/qbs/0000755000175100017510000000000015154533055016724 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-7/qbs/imports/0000755000175100017510000000000015154533055020421 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-7/qbs/imports/MyAutoTest.qbs0000644000175100017510000000007015154533055023203 0ustar runnerrunnerMyApplication { type: ["application", "autotest"] } qbs-src-3.2.0/tutorial/chapter-7/qbs/imports/MyLibrary.qbs0000644000175100017510000000103315154533055023037 0ustar runnerrunner//! [0] // qbs/imports/MyLibrary.qbs DynamicLibrary { version: project.version Depends { name: "config.myproject" } // ... //! [0] Depends { name: "cpp" } property string libraryMacro: name.replace(" ", "_").toUpperCase() + "_LIBRARY" cpp.defines: [libraryMacro] cpp.sonamePrefix: qbs.targetOS.contains("darwin") ? "@rpath" : undefined Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory] } Depends { name: 'bundle' } bundle.isBundle: false } qbs-src-3.2.0/tutorial/chapter-7/qbs/imports/MyApplication.qbs0000644000175100017510000000023715154533055023703 0ustar runnerrunner//! [0] // qbs/imports/MyApplication.qbs CppApplication { Depends { name: "config.myproject" } version: "1.0.0" consoleApplication: true } //! [0] qbs-src-3.2.0/tutorial/chapter-7/qbs/imports/ConfigMyProject.qbs0000644000175100017510000000210015154533055024163 0ustar runnerrunner//! [1] import qbs.FileInfo //! [0] // qbs/imports/ConfigMyProject.qbs Module { property bool enableAddressSanitizer: false Depends { name: "Sanitizers.address"; condition: enableAddressSanitizer } //! [0] Depends { name: "cpp" } Depends { name: "config.install" } property bool enableRPath: true property stringList libRPaths: { if (enableRPath && cpp.rpathOrigin && product.installDir) { console.info(FileInfo.joinPaths( cpp.rpathOrigin, FileInfo.relativePath( FileInfo.joinPaths('/', product.installDir), FileInfo.joinPaths('/', config.install.dynamicLibrariesDirectory)))); return [ FileInfo.joinPaths( cpp.rpathOrigin, FileInfo.relativePath( FileInfo.joinPaths('/', product.installDir), FileInfo.joinPaths('/', config.install.dynamicLibrariesDirectory)))]; } return []; } cpp.rpaths: libRPaths } //! [1] qbs-src-3.2.0/tutorial/chapter-7/qbs/modules/0000755000175100017510000000000015154533055020374 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-7/qbs/modules/config/0000755000175100017510000000000015154533055021641 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-7/qbs/modules/config/install/0000755000175100017510000000000015154533055023307 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-7/qbs/modules/config/install/module.qbs0000644000175100017510000000016215154533055025302 0ustar runnerrunnerimport qbs.FileInfo //! [0] // qbs/modules/config/install/module.qbs ConfigInstall { importLibraries: true } qbs-src-3.2.0/tutorial/chapter-7/qbs/modules/config/myproject/0000755000175100017510000000000015154533055023655 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-7/qbs/modules/config/myproject/module.qbs0000644000175100017510000000011715154533055025650 0ustar runnerrunner//! [0] // qbs/modules/config/myproject/module.qbs ConfigMyProject { } //! [0] qbs-src-3.2.0/tutorial/chapter-7/app/0000755000175100017510000000000015154533055016717 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-7/app/app.qbs0000644000175100017510000000016715154533055020212 0ustar runnerrunnerMyApplication { Depends { name: "mylib" } name: "My Application" targetName: "myapp" files: "main.c" } qbs-src-3.2.0/tutorial/chapter-7/app/main.c0000644000175100017510000000020315154533055020002 0ustar runnerrunner#include #include "lib.h" int main() { printf("Hello, world\n"); printf("%s\n", get_string()); return 0; } qbs-src-3.2.0/tutorial/chapter-7/myproject.qbs0000644000175100017510000000106215154533055020661 0ustar runnerrunnerProject { property bool withTests: true property stringList autotestArguments: [] property stringList autotestWrapper: [] name: "My Project" minimumQbsVersion: "2.0" references: [ "app/app.qbs", "lib/lib.qbs", ] qbsSearchPaths: "qbs" SubProject { filePath: "test/test.qbs" Properties { condition: parent.withTests } } AutotestRunner { condition: parent.withTests arguments: parent.autotestArguments wrapper: parent.autotestWrapper } } qbs-src-3.2.0/tutorial/chapter-7/test/0000755000175100017510000000000015154533055017116 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-7/test/test.c0000644000175100017510000000056215154533055020244 0ustar runnerrunner#include "lib.h" #include #include int main(int argc, char *argv[]) { if (argc > 2) { printf("usage: test [value]\n"); return 1; } const char *expected = argc == 2 ? argv[1] : "Hello from library"; if (strcmp(get_string(), expected) != 0) { printf("text differs\n"); return 1; } return 0; } qbs-src-3.2.0/tutorial/chapter-7/test/test.qbs0000644000175100017510000000012415154533055020601 0ustar runnerrunnerMyAutoTest { Depends { name: "mylib" } name: "mytest" files: "test.c" } qbs-src-3.2.0/tutorial/chapter-10-2/0000755000175100017510000000000015154533055016350 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-10-2/lib/0000755000175100017510000000000015154533055017116 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-10-2/lib/lib.qbs0000644000175100017510000000147315154533055020400 0ustar runnerrunner//! [0] // lib/lib.qbs DynamicLibrary { condition: { if (qbs.toolchainType === "msvc" || (qbs.toolchainType === "gcc" && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "mingw" && cpp.compilerVersionMajor >= 13) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } name: "mylib" files: ["hello.cppm", "lib_global.h"] version: "1.0.0" Depends { name: "cpp" } cpp.defines: "MYLIB_LIBRARY" cpp.sonamePrefix: qbs.targetOS.contains("darwin") ? "@rpath" : undefined cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true Depends { name: "bundle" } bundle.isBundle: false } qbs-src-3.2.0/tutorial/chapter-10-2/lib/hello.cppm0000644000175100017510000000044215154533055021102 0ustar runnerrunner//![0] // lib/hello.cppm module; #include "lib_global.h" #include #include export module hello; export namespace Hello { void MYLIB_EXPORT printHello(std::string_view name) { std::cout << "Hello, " << name << '!' << std::endl; } } // namespace Hello //![0]qbs-src-3.2.0/tutorial/chapter-10-2/lib/lib_global.h0000644000175100017510000000076515154533055021365 0ustar runnerrunner//! [0] // lib/lib_global.h #ifndef LIB_GLOBAL_H #define LIB_GLOBAL_H #if defined(_WIN32) || defined(WIN32) #define MYLIB_DECL_EXPORT __declspec(dllexport) #define MYLIB_DECL_IMPORT __declspec(dllimport) #else #define MYLIB_DECL_EXPORT __attribute__((visibility("default"))) #define MYLIB_DECL_IMPORT __attribute__((visibility("default"))) #endif #if defined(MYLIB_LIBRARY) #define MYLIB_EXPORT MYLIB_DECL_EXPORT #else #define MYLIB_EXPORT MYLIB_DECL_IMPORT #endif #endif // LIB_GLOBAL_H //! [0] qbs-src-3.2.0/tutorial/chapter-10-2/app/0000755000175100017510000000000015154533055017130 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-10-2/app/main.cpp0000644000175100017510000000007615154533055020563 0ustar runnerrunnerimport hello; int main() { Hello::printHello("world"); } qbs-src-3.2.0/tutorial/chapter-10-2/app/app.qbs0000644000175100017510000000104115154533055020413 0ustar runnerrunnerCppApplication { condition: qbs.toolchainType === "msvc" || (qbs.toolchainType === "gcc" && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "mingw" && cpp.compilerVersionMajor >= 13) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16) consoleApplication: true name: "app" files: ["main.cpp"] cpp.rpaths: [cpp.rpathOrigin + "/../lib"] cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true cpp.treatWarningsAsErrors: true Depends { name: "mylib" } } qbs-src-3.2.0/tutorial/chapter-10-2/myproject.qbs0000644000175100017510000000017715154533055021100 0ustar runnerrunnerProject { name: "My Project" minimumQbsVersion: "2.5" references: [ "app/app.qbs", "lib/lib.qbs" ] } qbs-src-3.2.0/tutorial/chapter-4/0000755000175100017510000000000015154533055016134 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-4/lib/0000755000175100017510000000000015154533055016702 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-4/lib/lib.qbs0000644000175100017510000000031215154533055020153 0ustar runnerrunner//! [0] // lib/lib.qbs MyLibrary { name: "mylib" files: ["lib.c"] publicHeaders: [ "lib.h", "lib_global.h", ] cpp.defines: base.concat(["CRUCIAL_DEFINE"]) } //! [0] qbs-src-3.2.0/tutorial/chapter-4/lib/lib_global.h0000644000175100017510000000071715154533055021146 0ustar runnerrunner#ifndef LIB_GLOBAL_H #define LIB_GLOBAL_H #if defined(_WIN32) || defined(WIN32) #define MYLIB_DECL_EXPORT __declspec(dllexport) #define MYLIB_DECL_IMPORT __declspec(dllimport) #else #define MYLIB_DECL_EXPORT __attribute__((visibility("default"))) #define MYLIB_DECL_IMPORT __attribute__((visibility("default"))) #endif #if defined(MYLIB_LIBRARY) #define MYLIB_EXPORT MYLIB_DECL_EXPORT #else #define MYLIB_EXPORT MYLIB_DECL_IMPORT #endif #endif // LIB_GLOBAL_H qbs-src-3.2.0/tutorial/chapter-4/lib/lib.h0000644000175100017510000000015615154533055017623 0ustar runnerrunner#ifndef LIB_H #define LIB_H #include "lib_global.h" MYLIB_EXPORT const char *get_string(); #endif // LIB_H qbs-src-3.2.0/tutorial/chapter-4/lib/lib.c0000644000175100017510000000022415154533055017612 0ustar runnerrunner#include "lib.h" #ifndef CRUCIAL_DEFINE # error CRUCIAL_DEFINE not defined #endif const char *get_string() { return "Hello from library"; } qbs-src-3.2.0/tutorial/chapter-4/qbs/0000755000175100017510000000000015154533055016721 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-4/qbs/imports/0000755000175100017510000000000015154533055020416 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-4/qbs/imports/MyLibrary.qbs0000644000175100017510000000074015154533055023040 0ustar runnerrunner//! [0] // qbs/imports/MyLibrary.qbs DynamicLibrary { version: "1.0.0" Depends { name: 'cpp' } property string libraryMacro: name.replace(" ", "_").toUpperCase() + "_LIBRARY" cpp.defines: [libraryMacro] cpp.sonamePrefix: qbs.targetOS.contains("darwin") ? "@rpath" : undefined Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory] } Depends { name: 'bundle' } bundle.isBundle: false } //! [0] qbs-src-3.2.0/tutorial/chapter-4/qbs/imports/MyApplication.qbs0000644000175100017510000000072415154533055023701 0ustar runnerrunner//! [0] // qbs/imports/MyApplication.qbs import qbs.FileInfo CppApplication { version: "1.0.0" consoleApplication: true cpp.rpaths: { if (!cpp.rpathOrigin) return []; return [ FileInfo.joinPaths( cpp.rpathOrigin, FileInfo.relativePath( FileInfo.joinPaths("/", product.installDir), FileInfo.joinPaths("/", "lib"))) ]; } } //! [0] qbs-src-3.2.0/tutorial/chapter-4/app/0000755000175100017510000000000015154533055016714 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-4/app/app.qbs0000644000175100017510000000022715154533055020204 0ustar runnerrunner//! [0] // app/app.qbs MyApplication { Depends { name: "mylib" } name: "My Application" targetName: "myapp" files: "main.c" } //! [0] qbs-src-3.2.0/tutorial/chapter-4/app/main.c0000644000175100017510000000020315154533055017777 0ustar runnerrunner#include #include "lib.h" int main() { printf("Hello, world\n"); printf("%s\n", get_string()); return 0; } qbs-src-3.2.0/tutorial/chapter-4/myproject.qbs0000644000175100017510000000025015154533055020654 0ustar runnerrunner//! [0] Project { name: "My Project" minimumQbsVersion: "2.0" references: [ "app/app.qbs", "lib/lib.qbs" ] qbsSearchPaths: "qbs" } //! [0] qbs-src-3.2.0/tutorial/chapter-10-1/0000755000175100017510000000000015154533055016347 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-10-1/main.cpp0000644000175100017510000000013015154533055017771 0ustar runnerrunner//![0] // main.cpp import hello; int main() { Hello::printHello("World"); } //![0]qbs-src-3.2.0/tutorial/chapter-10-1/hello.cppm0000644000175100017510000000037115154533055020334 0ustar runnerrunner//![0] // hello.cppm module; #include #include export module hello; export namespace Hello { void printHello(std::string_view name) { std::cout << "Hello, " << name << '!' << std::endl; } } // namespace Hello //![0]qbs-src-3.2.0/tutorial/chapter-10-1/myproject.qbs0000644000175100017510000000110415154533055021066 0ustar runnerrunner// myproject.qbs CppApplication { condition: { if (qbs.toolchainType === "msvc" || ((qbs.toolchainType === "gcc" || qbs.toolchainType === "mingw") && cpp.compilerVersionMajor >= 11) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 16)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } consoleApplication: true files: ["hello.cppm", "main.cpp" ] cpp.cxxLanguageVersion: "c++20" cpp.forceUseCxxModules: true } qbs-src-3.2.0/tutorial/chapter-5/0000755000175100017510000000000015154533055016135 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-5/lib/0000755000175100017510000000000015154533055016703 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-5/lib/lib.qbs0000644000175100017510000000025215154533055020157 0ustar runnerrunnerMyLibrary { name: "mylib" files: ["lib.c"] publicHeaders: [ "lib.h", "lib_global.h", ] cpp.defines: base.concat(['CRUCIAL_DEFINE']) } qbs-src-3.2.0/tutorial/chapter-5/lib/lib_global.h0000644000175100017510000000071715154533055021147 0ustar runnerrunner#ifndef LIB_GLOBAL_H #define LIB_GLOBAL_H #if defined(_WIN32) || defined(WIN32) #define MYLIB_DECL_EXPORT __declspec(dllexport) #define MYLIB_DECL_IMPORT __declspec(dllimport) #else #define MYLIB_DECL_EXPORT __attribute__((visibility("default"))) #define MYLIB_DECL_IMPORT __attribute__((visibility("default"))) #endif #if defined(MYLIB_LIBRARY) #define MYLIB_EXPORT MYLIB_DECL_EXPORT #else #define MYLIB_EXPORT MYLIB_DECL_IMPORT #endif #endif // LIB_GLOBAL_H qbs-src-3.2.0/tutorial/chapter-5/lib/lib.h0000644000175100017510000000015615154533055017624 0ustar runnerrunner#ifndef LIB_H #define LIB_H #include "lib_global.h" MYLIB_EXPORT const char *get_string(); #endif // LIB_H qbs-src-3.2.0/tutorial/chapter-5/lib/lib.c0000644000175100017510000000022415154533055017613 0ustar runnerrunner#include "lib.h" #ifndef CRUCIAL_DEFINE # error CRUCIAL_DEFINE not defined #endif const char *get_string() { return "Hello from library"; } qbs-src-3.2.0/tutorial/chapter-5/qbs/0000755000175100017510000000000015154533055016722 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-5/qbs/imports/0000755000175100017510000000000015154533055020417 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-5/qbs/imports/MyAutoTest.qbs0000644000175100017510000000014515154533055023204 0ustar runnerrunner//! [0] // qbs/imports/MyAutoTest.qbs MyApplication { type: base.concat(["autotest"]) } //! [0] qbs-src-3.2.0/tutorial/chapter-5/qbs/imports/MyLibrary.qbs0000644000175100017510000000066215154533055023044 0ustar runnerrunnerDynamicLibrary { version: "1.0.0" Depends { name: 'cpp' } property string libraryMacro: name.replace(" ", "_").toUpperCase() + "_LIBRARY" cpp.defines: [libraryMacro] cpp.sonamePrefix: qbs.targetOS.contains("darwin") ? "@rpath" : undefined Export { Depends { name: "cpp" } cpp.includePaths: [exportingProduct.sourceDirectory] } Depends { name: 'bundle' } bundle.isBundle: false } qbs-src-3.2.0/tutorial/chapter-5/qbs/imports/MyApplication.qbs0000644000175100017510000000064215154533055023701 0ustar runnerrunnerimport qbs.FileInfo CppApplication { version: "1.0.0" consoleApplication: true cpp.rpaths: { if (!cpp.rpathOrigin) return []; return [ FileInfo.joinPaths( cpp.rpathOrigin, FileInfo.relativePath( FileInfo.joinPaths("/", product.installDir), FileInfo.joinPaths("/", "lib"))) ]; } } qbs-src-3.2.0/tutorial/chapter-5/app/0000755000175100017510000000000015154533055016715 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-5/app/app.qbs0000644000175100017510000000016715154533055020210 0ustar runnerrunnerMyApplication { Depends { name: "mylib" } name: "My Application" targetName: "myapp" files: "main.c" } qbs-src-3.2.0/tutorial/chapter-5/app/main.c0000644000175100017510000000020315154533055020000 0ustar runnerrunner#include #include "lib.h" int main() { printf("Hello, world\n"); printf("%s\n", get_string()); return 0; } qbs-src-3.2.0/tutorial/chapter-5/myproject.qbs0000644000175100017510000000040015154533055020652 0ustar runnerrunnerProject { name: "My Project" minimumQbsVersion: "2.0" // ![0] references: [ "app/app.qbs", "lib/lib.qbs", "test/test.qbs", ] // ![0] qbsSearchPaths: "qbs" AutotestRunner { timeout: 60 } } qbs-src-3.2.0/tutorial/chapter-5/test/0000755000175100017510000000000015154533055017114 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-5/test/test.c0000644000175100017510000000062115154533055020236 0ustar runnerrunner//! [0] // test/test.c #include "lib.h" #include #include int main(int argc, char *argv[]) { if (argc > 2) { printf("usage: test [value]\n"); return 1; } const char *expected = argc == 2 ? argv[1] : "Hello from library"; if (strcmp(get_string(), expected) != 0) { printf("text differs\n"); return 1; } return 0; } //! [0]qbs-src-3.2.0/tutorial/chapter-5/test/test.qbs0000644000175100017510000000016615154533055020605 0ustar runnerrunner//! [0] // test/test.qbs MyAutoTest { Depends { name: "mylib" } name: "mytest" files: "test.c" } //! [0] qbs-src-3.2.0/tutorial/chapter-10-3/0000755000175100017510000000000015154533055016351 5ustar runnerrunnerqbs-src-3.2.0/tutorial/chapter-10-3/main.cpp0000644000175100017510000000033315154533055020000 0ustar runnerrunner//![0] // main.cpp import std; int main() { std::vector numbers = {1, 2, 3, 4, 5}; std::ranges::for_each(numbers, [](int n) { std::cout << n << ' '; }); std::cout << std::endl; return 0; } //![0] qbs-src-3.2.0/tutorial/chapter-10-3/myproject.qbs0000644000175100017510000000165215154533055021100 0ustar runnerrunner//![1] // myproject.qbs Project { CppStd {} CppApplication { name: "myapp" Depends { name: "CppStd" } condition: { if (qbs.toolchainType === "msvc" || ((qbs.toolchainType === "gcc") && cpp.compilerVersionMajor >= 15) || (qbs.toolchainType === "clang" && cpp.compilerVersionMajor >= 18)) { return true; } console.info("Unsupported toolchainType " + qbs.toolchainType); return false; } consoleApplication: true install: true files: ["main.cpp" ] //![0] cpp.forceUseCxxModules: true cpp.cxxLanguageVersion: "c++23" //![0] Properties { condition: qbs.toolchainType === "clang" cpp.cxxFlags: ["-Wno-reserved-module-identifier"] cpp.cxxStandardLibrary: "libc++" } } } //![1] qbs-src-3.2.0/LICENSE.GPL3-EXCEPT0000644000175100017510000010701315154533055015203 0ustar runnerrunnerThis is the GNU General Public License version 3, annotated with The Qt Company GPL Exception 1.0: ------------------------------------------------------------------------- The Qt Company GPL Exception 1.0 Exception 1: As a special exception you may create a larger work which contains the output of this application and distribute that work under terms of your choice, so long as the work is not otherwise derived from or based on this application and so long as the work does not in itself generate output that contains the output from this application in its original or modified form. Exception 2: As a special exception, you have permission to combine this application with Plugins licensed under the terms of your choice, to produce an executable, and to copy and distribute the resulting executable under the terms of your choice. However, the executable must be accompanied by a prominent notice offering all users of the executable the entire source code to this application, excluding the source code of the independent modules, but including any changes you have made to this application, under the terms of this license. ------------------------------------------------------------------------- GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . qbs-src-3.2.0/.mailmap0000644000175100017510000000266015154533055014127 0ustar runnerrunner qbs-src-3.2.0/src/0000755000175100017510000000000015154533055013271 5ustar runnerrunnerqbs-src-3.2.0/src/libexec/0000755000175100017510000000000015154533055014704 5ustar runnerrunnerqbs-src-3.2.0/src/libexec/CMakeLists.txt0000644000175100017510000000004615154533055017444 0ustar runnerrunneradd_subdirectory(qbs_processlauncher) qbs-src-3.2.0/src/libexec/qbs_processlauncher/0000755000175100017510000000000015154533055020751 5ustar runnerrunnerqbs-src-3.2.0/src/libexec/qbs_processlauncher/launchersockethandler.h0000644000175100017510000000573215154533055025501 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_LAUNCHERSOCKETHANDLER_H #define QBS_LAUNCHERSOCKETHANDLER_H #include #include #include #include QT_BEGIN_NAMESPACE class QLocalSocket; QT_END_NAMESPACE namespace qbs { namespace Internal { class Process; class LauncherSocketHandler : public QObject { Q_OBJECT public: explicit LauncherSocketHandler(QString socketPath, QObject *parent = nullptr); ~LauncherSocketHandler() override; void start(); private: void handleSocketData(); void handleSocketError(); void handleSocketClosed(); void handleProcessError(); void handleProcessFinished(); void handleStopFailure(); void handleStartPacket(); void handleStopPacket(); void handleShutdownPacket(); void sendPacket(const LauncherPacket &packet); Process *setupProcess(quintptr token); Process *senderProcess() const; const QString m_serverPath; QLocalSocket * const m_socket; PacketParser m_packetParser; QHash m_processes; }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/libexec/qbs_processlauncher/processlauncher-main.cpp0000644000175100017510000000520015154533055025574 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "launcherlogging.h" #include "launchersockethandler.h" #include #include #ifdef Q_OS_WIN #include BOOL WINAPI consoleCtrlHandler(DWORD) { // Ignore Ctrl-C / Ctrl-Break. Qbs will tell us to exit gracefully. return TRUE; } #endif int main(int argc, char *argv[]) { #ifdef Q_OS_WIN SetConsoleCtrlHandler(consoleCtrlHandler, TRUE); #endif QCoreApplication app(argc, argv); if (app.arguments().size() != 2) { qbs::Internal::logError("Need exactly one argument (path to socket)"); return 1; } qbs::Internal::LauncherSocketHandler launcher(app.arguments().constLast()); QTimer::singleShot(0, &launcher, &qbs::Internal::LauncherSocketHandler::start); return app.exec(); } qbs-src-3.2.0/src/libexec/qbs_processlauncher/launcherlogging.h0000644000175100017510000000450115154533055024272 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_LAUCHERLOGGING_H #define QBS_LAUCHERLOGGING_H #include #include namespace qbs { namespace Internal { Q_DECLARE_LOGGING_CATEGORY(launcherLog) template void logDebug(const T &msg) { qCDebug(launcherLog) << msg; } template void logWarn(const T &msg) { qCWarning(launcherLog) << msg; } template void logError(const T &msg) { qCCritical(launcherLog) << msg; } } } #endif // Include guard qbs-src-3.2.0/src/libexec/qbs_processlauncher/CMakeLists.txt0000644000175100017510000000136315154533055023514 0ustar runnerrunnerset(SOURCES launcherlogging.cpp launcherlogging.h launchersockethandler.cpp launchersockethandler.h processlauncher-main.cpp ) set(PATH_TO_PROTOCOL_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../lib/corelib/tools") set(PROTOCOL_SOURCES launcherpackets.cpp launcherpackets.h ) list_transform_prepend(PROTOCOL_SOURCES ${PATH_TO_PROTOCOL_SOURCES}/) add_qbs_app(qbs_processlauncher DESTINATION ${QBS_LIBEXEC_INSTALL_DIR} DEPENDS Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network INCLUDES ${PATH_TO_PROTOCOL_SOURCES} SOURCES ${SOURCES} ${PROTOCOL_SOURCES} ) set_target_properties(qbs_processlauncher PROPERTIES BUILD_RPATH "${QBS_LIBEXEC_RPATH}" INSTALL_RPATH "${QBS_LIBEXEC_RPATH}" ) qbs-src-3.2.0/src/libexec/qbs_processlauncher/qbs_processlauncher.qbs0000644000175100017510000000172515154533055025532 0ustar runnerrunnerimport qbs.FileInfo QbsProduct { type: "application" name: "qbs_processlauncher" consoleApplication: true Depends { name: "Qt.network" } cpp.includePaths: base.concat(pathToProtocolSources) files: [ "launcherlogging.cpp", "launcherlogging.h", "launchersockethandler.cpp", "launchersockethandler.h", "processlauncher-main.cpp", ] property string pathToProtocolSources: sourceDirectory + "/../../lib/corelib/tools" Group { name: "protocol sources" prefix: pathToProtocolSources + '/' files: [ "launcherpackets.cpp", "launcherpackets.h", ] } Group { fileTagsFilter: product.type .concat(qbs.buildVariant === "debug" ? ["debuginfo_app"] : []) qbs.install: true qbs.installDir: targetInstallDir qbs.installSourceBase: buildDirectory } targetInstallDir: qbsbuildconfig.libexecInstallDir } qbs-src-3.2.0/src/libexec/qbs_processlauncher/launchersockethandler.cpp0000644000175100017510000002246215154533055026033 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "launchersockethandler.h" #include "launcherlogging.h" #include #include #include #include namespace qbs { namespace Internal { class Process : public QProcess { Q_OBJECT public: Process(quintptr token, QObject *parent = nullptr) : QProcess(parent), m_token(token), m_stopTimer(new QTimer(this)) { m_stopTimer->setSingleShot(true); connect(m_stopTimer, &QTimer::timeout, this, &Process::cancel); } void cancel() { switch (m_stopState) { case StopState::Inactive: m_stopState = StopState::Terminating; m_stopTimer->start(3000); terminate(); break; case StopState::Terminating: m_stopState = StopState::Killing; m_stopTimer->start(3000); kill(); break; case StopState::Killing: m_stopState = StopState::Inactive; emit failedToStop(); break; } } void stopStopProcedure() { m_stopState = StopState::Inactive; m_stopTimer->stop(); } quintptr token() const { return m_token; } signals: void failedToStop(); private: const quintptr m_token; QTimer * const m_stopTimer; enum class StopState { Inactive, Terminating, Killing } m_stopState = StopState::Inactive; }; LauncherSocketHandler::LauncherSocketHandler(QString serverPath, QObject *parent) : QObject(parent), m_serverPath(std::move(serverPath)), m_socket(new QLocalSocket(this)) { m_packetParser.setDevice(m_socket); } LauncherSocketHandler::~LauncherSocketHandler() { m_socket->disconnect(); if (m_socket->state() != QLocalSocket::UnconnectedState) { logWarn("socket handler destroyed while connection was active"); m_socket->close(); } for (auto it = m_processes.cbegin(); it != m_processes.cend(); ++it) it.value()->disconnect(); } void LauncherSocketHandler::start() { connect(m_socket, &QLocalSocket::disconnected, this, &LauncherSocketHandler::handleSocketClosed); connect(m_socket, &QLocalSocket::readyRead, this, &LauncherSocketHandler::handleSocketData); connect(m_socket, &QLocalSocket::errorOccurred, this, &LauncherSocketHandler::handleSocketError); m_socket->connectToServer(m_serverPath); } void LauncherSocketHandler::handleSocketData() { try { if (!m_packetParser.parse()) return; } catch (const PacketParser::InvalidPacketSizeException &e) { logWarn(QStringLiteral("Internal protocol error: invalid packet size %1.") .arg(e.size)); return; } switch (m_packetParser.type()) { case LauncherPacketType::StartProcess: handleStartPacket(); break; case LauncherPacketType::StopProcess: handleStopPacket(); break; case LauncherPacketType::Shutdown: handleShutdownPacket(); return; default: logWarn(QStringLiteral("Internal protocol error: invalid packet type %1.") .arg(static_cast(m_packetParser.type()))); return; } handleSocketData(); } void LauncherSocketHandler::handleSocketError() { if (m_socket->error() != QLocalSocket::PeerClosedError) { logError(QStringLiteral("socket error: %1").arg(m_socket->errorString())); m_socket->disconnect(); qApp->quit(); } } void LauncherSocketHandler::handleSocketClosed() { for (auto it = m_processes.cbegin(); it != m_processes.cend(); ++it) { if (it.value()->state() != QProcess::NotRunning) { logWarn("client closed connection while process still running"); break; } } m_socket->disconnect(); qApp->quit(); } void LauncherSocketHandler::handleProcessError() { Process * proc = senderProcess(); if (proc->error() != QProcess::FailedToStart) return; proc->stopStopProcedure(); ProcessErrorPacket packet(proc->token()); packet.error = proc->error(); packet.errorString = proc->errorString(); sendPacket(packet); } void LauncherSocketHandler::handleProcessFinished() { Process * proc = senderProcess(); proc->stopStopProcedure(); ProcessFinishedPacket packet(proc->token()); packet.error = proc->error(); packet.errorString = proc->errorString(); packet.exitCode = proc->exitCode(); packet.exitStatus = proc->exitStatus(); packet.stdErr = proc->readAllStandardError(); packet.stdOut = proc->readAllStandardOutput(); sendPacket(packet); } void LauncherSocketHandler::handleStopFailure() { // Process did not react to a kill signal. Rare, but not unheard of. // Forget about the associated Process object and report process exit to the client. Process * proc = senderProcess(); proc->disconnect(); m_processes.remove(proc->token()); ProcessFinishedPacket packet(proc->token()); packet.error = QProcess::Crashed; packet.exitCode = -1; packet.exitStatus = QProcess::CrashExit; packet.stdErr = proc->readAllStandardError(); packet.stdOut = proc->readAllStandardOutput(); sendPacket(packet); } void LauncherSocketHandler::handleStartPacket() { Process *& process = m_processes[m_packetParser.token()]; if (!process) process = setupProcess(m_packetParser.token()); if (process->state() != QProcess::NotRunning) { logWarn("got start request while process was running"); return; } const auto packet = LauncherPacket::extractPacket( m_packetParser.token(), m_packetParser.packetData()); process->setEnvironment(packet.env); process->setWorkingDirectory(packet.workingDir); process->start(packet.command, packet.arguments); } void LauncherSocketHandler::handleStopPacket() { Process * const process = m_processes.value(m_packetParser.token()); if (!process) { logWarn("got stop request for unknown process"); return; } if (process->state() == QProcess::NotRunning) { // This can happen if the process finishes on its own at about the same time the client // sends the request. logDebug("got stop request when process was not running"); return; } process->cancel(); } void LauncherSocketHandler::handleShutdownPacket() { logDebug("got shutdown request, closing down"); for (auto it = m_processes.cbegin(); it != m_processes.cend(); ++it) { it.value()->disconnect(); if (it.value()->state() != QProcess::NotRunning) { logWarn("got shutdown request while process was running"); it.value()->terminate(); } } m_socket->disconnect(); qApp->quit(); } void LauncherSocketHandler::sendPacket(const LauncherPacket &packet) { m_socket->write(packet.serialize()); } Process *LauncherSocketHandler::setupProcess(quintptr token) { const auto p = new Process(token, this); connect(p, &QProcess::errorOccurred, this, &LauncherSocketHandler::handleProcessError); connect(p, static_cast(&QProcess::finished), this, &LauncherSocketHandler::handleProcessFinished); connect(p, &Process::failedToStop, this, &LauncherSocketHandler::handleStopFailure); return p; } Process *LauncherSocketHandler::senderProcess() const { return static_cast(sender()); } } // namespace Internal } // namespace qbs #include qbs-src-3.2.0/src/libexec/qbs_processlauncher/launcherlogging.cpp0000644000175100017510000000374615154533055024637 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "launcherlogging.h" namespace qbs { namespace Internal { Q_LOGGING_CATEGORY(launcherLog, "qbs.launcher", QtWarningMsg) } } qbs-src-3.2.0/src/libexec/libexec.qbs0000644000175100017510000000013315154533055017023 0ustar runnerrunnerProject { references: [ "qbs_processlauncher/qbs_processlauncher.qbs", ] } qbs-src-3.2.0/src/lib/0000755000175100017510000000000015154533055014037 5ustar runnerrunnerqbs-src-3.2.0/src/lib/libs.qbs0000644000175100017510000000020515154533055015474 0ustar runnerrunnerProject { references: [ "corelib/corelib.qbs", "msbuild/msbuild.qbs", "pkgconfig/pkgconfig.qbs", ] } qbs-src-3.2.0/src/lib/msbuild/0000755000175100017510000000000015154533055015476 5ustar runnerrunnerqbs-src-3.2.0/src/lib/msbuild/msbuild/0000755000175100017510000000000015154533055017135 5ustar runnerrunnerqbs-src-3.2.0/src/lib/msbuild/msbuild/msbuildproperty.cpp0000644000175100017510000000363015154533055023107 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildproperty.h" #include "imsbuildnodevisitor.h" #include "msbuildpropertygroup.h" namespace qbs { MSBuildProperty::MSBuildProperty() = default; MSBuildProperty::MSBuildProperty(const QString &name, const QVariant &value) { setName(name); setValue(value); } void MSBuildProperty::accept(IMSBuildNodeVisitor *visitor) const { visitor->visitStart(this); visitor->visitEnd(this); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuilditemgroupbase.h0000644000175100017510000000474415154533055023545 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef IMSBUILDGROUP_H #define IMSBUILDGROUP_H #include "imsbuildnode.h" #include #include namespace qbs { class MSBuildClInclude; class MSBuildClCompile; class MSBuildItem; class MSBuildFileItem; class MSBuildFilter; class MSBuildLink; class MSBuildNone; class MSBuildProject; class MSBuildProperty; class IMSBuildItemGroupPrivate; class MSBuildItemGroupBase : public MSBuildNode< MSBuildClInclude, MSBuildClCompile, MSBuildItem, MSBuildFileItem, MSBuildFilter, MSBuildLink, MSBuildNone> { public: MSBuildItemGroupBase(); ~MSBuildItemGroupBase() override; QString condition() const; void setCondition(const QString &condition); private: std::unique_ptr d; }; } // namespace qbs #endif // IMSBUILDGROUP_H qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuilditem.cpp0000644000175100017510000000473315154533055022166 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuilditem.h" #include "imsbuildnodevisitor.h" #include "msbuilditemdefinitiongroup.h" #include "msbuilditemgroup.h" #include "msbuilditemmetadata.h" namespace qbs { class MSBuildItemPrivate { public: QString name = QStringLiteral("Item"); QString include; }; MSBuildItem::MSBuildItem(const QString &name) : d(new MSBuildItemPrivate) { setName(name); } MSBuildItem::~MSBuildItem() = default; QString MSBuildItem::name() const { return d->name; } void MSBuildItem::setName(const QString &name) { d->name = name; } QString MSBuildItem::include() const { return d->include; } void MSBuildItem::setInclude(const QString &include) { d->include = include; } void MSBuildItem::appendProperty(const QString &name, const QVariant &value) { makeChild(name, value); } void MSBuildItem::accept(IMSBuildNodeVisitor *visitor) const { visitor->visitStart(this); acceptChildren(visitor); visitor->visitEnd(this); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuildimport.cpp0000644000175100017510000000441215154533055022534 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildimport.h" #include "imsbuildnodevisitor.h" #include "msbuildimportgroup.h" #include "msbuildproject.h" namespace qbs { class MSBuildImportPrivate { public: QString project; QString condition; }; MSBuildImport::MSBuildImport() : d(new MSBuildImportPrivate) { } MSBuildImport::~MSBuildImport() = default; QString MSBuildImport::project() const { return d->project; } void MSBuildImport::setProject(const QString &project) { d->project = project; } QString MSBuildImport::condition() const { return d->condition; } void MSBuildImport::setCondition(const QString &condition) { d->condition = condition; } void MSBuildImport::accept(IMSBuildNodeVisitor *visitor) const { visitor->visitStart(this); visitor->visitEnd(this); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuilditemgroup.cpp0000644000175100017510000000415515154533055023241 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuilditemgroup.h" #include "imsbuildnodevisitor.h" #include "msbuilditem.h" #include namespace qbs { class MSBuildItemGroupPrivate { public: QString label; }; MSBuildItemGroup::MSBuildItemGroup() : d(new MSBuildItemGroupPrivate) { } MSBuildItemGroup::~MSBuildItemGroup() = default; QString MSBuildItemGroup::label() const { return d->label; } void MSBuildItemGroup::setLabel(const QString &label) { d->label = label; } void MSBuildItemGroup::accept(IMSBuildNodeVisitor *visitor) const { visitor->visitStart(this); acceptChildren(visitor); visitor->visitEnd(this); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuildimportgroup.cpp0000644000175100017510000000446615154533055023622 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildimportgroup.h" #include "imsbuildnodevisitor.h" #include "msbuildimport.h" namespace qbs { class MSBuildImportGroupPrivate { public: QString condition; QString label; }; MSBuildImportGroup::MSBuildImportGroup() : d(new MSBuildImportGroupPrivate) { } QString MSBuildImportGroup::condition() const { return d->condition; } void MSBuildImportGroup::setCondition(const QString &condition) { d->condition = condition; } MSBuildImportGroup::~MSBuildImportGroup() = default; QString MSBuildImportGroup::label() const { return d->label; } void MSBuildImportGroup::setLabel(const QString &label) { d->label = label; } void MSBuildImportGroup::accept(IMSBuildNodeVisitor *visitor) const { visitor->visitStart(this); acceptChildren(visitor); visitor->visitEnd(this); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuilditemgroup.h0000644000175100017510000000426415154533055022707 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDITEMGROUP_H #define MSBUILDITEMGROUP_H #include "imsbuildnode.h" #include "msbuilditemgroupbase.h" #include namespace qbs { class MSBuildProject; class MSBuildItemGroupPrivate; /*! * \brief The MSBuildItemGroup class represents an MSBuild ItemGroup element. * * https://msdn.microsoft.com/en-us/library/646dk05y.aspx */ class MSBuildItemGroup : public MSBuildItemGroupBase { public: MSBuildItemGroup(); ~MSBuildItemGroup() override; QString label() const; void setLabel(const QString &label); void accept(IMSBuildNodeVisitor *visitor) const override; private: std::unique_ptr d; }; } // namespace qbs #endif // MSBUILDITEMGROUP_H qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuildpropertybase.h0000644000175100017510000000422515154533055023410 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDPROPERTYBASE_H #define MSBUILDPROPERTYBASE_H #include "imsbuildnode.h" #include #include #include namespace qbs { class MSBuildPropertyBasePrivate; class MSBuildPropertyBase : public IMSBuildNode { protected: MSBuildPropertyBase(); public: ~MSBuildPropertyBase() override; QString condition() const; void setCondition(const QString &condition); QString name() const; void setName(const QString &name); QVariant value() const; void setValue(const QVariant &value); private: std::unique_ptr d; }; } // namespace qbs #endif // MSBUILDPROPERTYBASE_H qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuilditemgroupbase.cpp0000644000175100017510000000372315154533055024074 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuilditemgroupbase.h" #include "msbuildproject.h" namespace qbs { class IMSBuildItemGroupPrivate { public: QString condition; }; MSBuildItemGroupBase::MSBuildItemGroupBase() : d(new IMSBuildItemGroupPrivate) { } MSBuildItemGroupBase::~MSBuildItemGroupBase() = default; QString MSBuildItemGroupBase::condition() const { return d->condition; } void MSBuildItemGroupBase::setCondition(const QString &condition) { d->condition = condition; } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/imsbuildnode.cpp0000644000175100017510000000312015154533055022313 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "imsbuildnode.h" namespace qbs { IMSBuildNode::~IMSBuildNode() = default; } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuilditemdefinitiongroup.h0000644000175100017510000000417415154533055024760 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDITEMDEFINITIONGROUP_H #define MSBUILDITEMDEFINITIONGROUP_H #include "imsbuildnode.h" #include "msbuilditemgroupbase.h" namespace qbs { class MSBuildProject; class MSBuildItemDefinitionGroupPrivate; /*! * \brief The MSBuildItemDefinitionGroup class represents an MSBuild ItemDefinitionGroup element. * * https://msdn.microsoft.com/en-us/library/bb629392.aspx */ class MSBuildItemDefinitionGroup : public MSBuildItemGroupBase { public: MSBuildItemDefinitionGroup(); ~MSBuildItemDefinitionGroup() override; void accept(IMSBuildNodeVisitor *visitor) const override; }; } // namespace qbs #endif // MSBUILDITEMDEFINITIONGROUP_H qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuilditemmetadata.cpp0000644000175100017510000000364715154533055023672 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuilditemmetadata.h" #include "imsbuildnodevisitor.h" #include "msbuilditem.h" namespace qbs { MSBuildItemMetadata::MSBuildItemMetadata() = default; MSBuildItemMetadata::MSBuildItemMetadata(const QString &name, const QVariant &value) { setName(name); setValue(value); } void MSBuildItemMetadata::accept(IMSBuildNodeVisitor *visitor) const { visitor->visitStart(this); visitor->visitEnd(this); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuilditem.h0000644000175100017510000000461515154533055021632 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDITEM_H #define MSBUILDITEM_H #include #include "imsbuildnode.h" #include namespace qbs { class MSBuildItemMetadata; class MSBuildItemGroupBase; class MSBuildItemDefinitionGroup; class MSBuildItemGroup; class MSBuildItemPrivate; /*! * \brief The MSBuildItem class represents an MSBuild Item element. * * https://msdn.microsoft.com/en-us/library/ms164283.aspx */ class MSBuildItem : public MSBuildNode { public: explicit MSBuildItem(const QString &name); ~MSBuildItem() override; QString name() const; void setName(const QString &name); QString include() const; void setInclude(const QString &include); void appendProperty(const QString &name, const QVariant &value); void accept(IMSBuildNodeVisitor *visitor) const override; private: std::unique_ptr d; }; } // namespace qbs #endif // MSBUILDITEM_H qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuildproject.cpp0000644000175100017510000000474215154533055022676 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildproject.h" #include "imsbuildnodevisitor.h" #include "msbuildimport.h" #include "msbuildimportgroup.h" #include "msbuilditemdefinitiongroup.h" #include "msbuilditemgroup.h" #include "msbuildpropertygroup.h" namespace qbs { class MSBuildProjectPrivate { public: QString defaultTargets; QString toolsVersion; }; MSBuildProject::MSBuildProject() : d(new MSBuildProjectPrivate) { } MSBuildProject::~MSBuildProject() = default; QString MSBuildProject::defaultTargets() const { return d->defaultTargets; } void MSBuildProject::setDefaultTargets(const QString &defaultTargets) { d->defaultTargets = defaultTargets; } QString MSBuildProject::toolsVersion() const { return d->toolsVersion; } void MSBuildProject::setToolsVersion(const QString &toolsVersion) { d->toolsVersion = toolsVersion; } void MSBuildProject::accept(IMSBuildNodeVisitor *visitor) const { visitor->visitStart(this); acceptChildren(visitor); visitor->visitEnd(this); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuildimportgroup.h0000644000175100017510000000443415154533055023262 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDIMPORTGROUP_H #define MSBUILDIMPORTGROUP_H #include "imsbuildnode.h" #include namespace qbs { class MSBuildImport; class MSBuildProject; class MSBuildImportGroupPrivate; /*! * \brief The MSBuildImportGroup class represents an MSBuild ImportGroup element. * * https://msdn.microsoft.com/en-us/library/ff606262.aspx */ class MSBuildImportGroup : public MSBuildNode { public: MSBuildImportGroup(); ~MSBuildImportGroup() override; QString condition() const; void setCondition(const QString &condition); QString label() const; void setLabel(const QString &label); void accept(IMSBuildNodeVisitor *visitor) const override; private: std::unique_ptr d; }; } // namespace qbs #endif // MSBUILDIMPORTGROUP_H qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuildpropertygroup.cpp0000644000175100017510000000473015154533055024166 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildpropertygroup.h" #include "imsbuildnodevisitor.h" #include "msbuildproperty.h" namespace qbs { class MSBuildPropertyGroupPrivate { public: QString condition; QString label; }; MSBuildPropertyGroup::MSBuildPropertyGroup() : d(new MSBuildPropertyGroupPrivate) { } QString MSBuildPropertyGroup::condition() const { return d->condition; } void MSBuildPropertyGroup::setCondition(const QString &condition) { d->condition = condition; } MSBuildPropertyGroup::~MSBuildPropertyGroup() = default; QString MSBuildPropertyGroup::label() const { return d->label; } void MSBuildPropertyGroup::setLabel(const QString &label) { d->label = label; } void MSBuildPropertyGroup::appendProperty(const QString &name, const QVariant &value) { makeChild(name, value); } void MSBuildPropertyGroup::accept(IMSBuildNodeVisitor *visitor) const { visitor->visitStart(this); acceptChildren(visitor); visitor->visitEnd(this); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuilditemdefinitiongroup.cpp0000644000175100017510000000364515154533055025315 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuilditemdefinitiongroup.h" #include "imsbuildnodevisitor.h" #include "msbuilditem.h" namespace qbs { MSBuildItemDefinitionGroup::MSBuildItemDefinitionGroup() = default; MSBuildItemDefinitionGroup::~MSBuildItemDefinitionGroup() = default; void MSBuildItemDefinitionGroup::accept(IMSBuildNodeVisitor *visitor) const { visitor->visitStart(this); acceptChildren(visitor); visitor->visitEnd(this); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuildproperty.h0000644000175100017510000000402215154533055022550 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDPROPERTY_H #define MSBUILDPROPERTY_H #include "msbuildpropertybase.h" namespace qbs { class MSBuildPropertyGroup; /*! * \brief The MSBuildProperty class represents an MSBuild Property element. * * https://msdn.microsoft.com/en-us/library/ms164288.aspx */ class MSBuildProperty : public MSBuildPropertyBase { public: MSBuildProperty(); MSBuildProperty(const QString &name, const QVariant &value = QVariant()); void accept(IMSBuildNodeVisitor *visitor) const override; }; } // namespace qbs #endif // MSBUILDPROPERTY_H qbs-src-3.2.0/src/lib/msbuild/msbuild/items/0000755000175100017510000000000015154533055020256 5ustar runnerrunnerqbs-src-3.2.0/src/lib/msbuild/msbuild/items/msbuildlink.cpp0000644000175100017510000000326015154533055023300 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildlink.h" namespace qbs { static const QString MSBuildLinkItemName = QStringLiteral("Link"); MSBuildLink::MSBuildLink() : MSBuildItem(MSBuildLinkItemName) { } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/items/msbuildclinclude.h0000644000175100017510000000333515154533055023755 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDCLINCLUDE_H #define MSBUILDCLINCLUDE_H #include "msbuildfileitem.h" namespace qbs { class MSBuildClInclude : public MSBuildFileItem { public: explicit MSBuildClInclude(); }; } // namespace qbs #endif // MSBUILDCLINCLUDE_H qbs-src-3.2.0/src/lib/msbuild/msbuild/items/msbuildnone.h0000644000175100017510000000330415154533055022746 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDNONE_H #define MSBUILDNONE_H #include "msbuildfileitem.h" namespace qbs { class MSBuildNone : public MSBuildFileItem { public: explicit MSBuildNone(); }; } // namespace qbs #endif // MSBUILDNONE_H qbs-src-3.2.0/src/lib/msbuild/msbuild/items/msbuildfilter.h0000644000175100017510000000433615154533055023302 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDFILTER_H #define MSBUILDFILTER_H #include "../msbuilditem.h" namespace qbs { class MSBuildFilterPrivate; class MSBuildFilter : public MSBuildItem { public: explicit MSBuildFilter(); MSBuildFilter(const QString &name, const QList &extensions); ~MSBuildFilter() override; QUuid identifier() const; void setIdentifier(const QUuid &identifier); QList extensions() const; void setExtensions(const QList &extensions); bool parseFiles() const; void setParseFiles(bool parseFiles); bool sourceControlFiles() const; void setSourceControlFiles(bool sourceControlFiles); private: std::unique_ptr d; }; } // namespace qbs #endif // MSBUILDFILTER_H qbs-src-3.2.0/src/lib/msbuild/msbuild/items/msbuildfileitem.h0000644000175100017510000000401515154533055023605 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDFILEITEM_H #define MSBUILDFILEITEM_H #include "../msbuilditem.h" namespace qbs { class MSBuildFileItemPrivate; class MSBuildFileItem : public MSBuildItem { public: ~MSBuildFileItem() override; QString filePath() const; void setFilePath(const QString &filePath); QString filterName() const; void setFilterName(const QString &filterName); protected: explicit MSBuildFileItem(const QString &name); private: std::unique_ptr d; }; } // namespace qbs #endif // MSBUILDFILEITEM_H qbs-src-3.2.0/src/lib/msbuild/msbuild/items/msbuildclcompile.h0000644000175100017510000000333515154533055023762 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDCLCOMPILE_H #define MSBUILDCLCOMPILE_H #include "msbuildfileitem.h" namespace qbs { class MSBuildClCompile : public MSBuildFileItem { public: explicit MSBuildClCompile(); }; } // namespace qbs #endif // MSBUILDCLCOMPILE_H qbs-src-3.2.0/src/lib/msbuild/msbuild/items/msbuildnone.cpp0000644000175100017510000000316315154533055023304 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildnone.h" namespace qbs { MSBuildNone::MSBuildNone() : MSBuildFileItem(QStringLiteral("None")) { } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/items/msbuildclcompile.cpp0000644000175100017510000000332215154533055024311 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildclcompile.h" namespace qbs { static const QString MSBuildClCompileItemName = QStringLiteral("ClCompile"); MSBuildClCompile::MSBuildClCompile() : MSBuildFileItem(MSBuildClCompileItemName) { } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/items/msbuildfileitem.cpp0000644000175100017510000000460715154533055024147 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildfileitem.h" #include #include "../msbuilditemmetadata.h" namespace qbs { class MSBuildFileItemPrivate { public: MSBuildItemMetadata *filter{nullptr}; }; MSBuildFileItem::MSBuildFileItem(const QString &name) : MSBuildItem(name) , d(new MSBuildFileItemPrivate) {} MSBuildFileItem::~MSBuildFileItem() = default; QString MSBuildFileItem::filePath() const { return include(); } void MSBuildFileItem::setFilePath(const QString &filePath) { setInclude(filePath); } QString MSBuildFileItem::filterName() const { return d->filter ? d->filter->value().toString() : QString(); } void MSBuildFileItem::setFilterName(const QString &filterName) { if (d->filter) { (void) takeChild(d->filter); d->filter = nullptr; } if (!filterName.isEmpty()) d->filter = makeChild(QStringLiteral("Filter"), filterName); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/items/msbuildfilter.cpp0000644000175100017510000000702115154533055023627 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildfilter.h" #include "../msbuilditemmetadata.h" #include #include namespace qbs { static const QString MSBuildFilterItemName = QStringLiteral("Filter"); class MSBuildFilterPrivate { public: QUuid identifier; QList extensions; bool parseFiles = true; bool sourceControlFiles = true; MSBuildItemMetadata *identifierMetadata = nullptr; MSBuildItemMetadata *extensionsMetadata = nullptr; }; MSBuildFilter::MSBuildFilter() : MSBuildItem(MSBuildFilterItemName) , d(new MSBuildFilterPrivate) { d->identifierMetadata = makeChild( QStringLiteral("UniqueIdentifier"), QVariant()); d->extensionsMetadata = makeChild( QStringLiteral("Extensions"), QVariant()); setIdentifier(QUuid::createUuid()); } MSBuildFilter::MSBuildFilter(const QString &name, const QList &extensions) : MSBuildFilter() { setInclude(name); setExtensions(extensions); } MSBuildFilter::~MSBuildFilter() = default; QUuid MSBuildFilter::identifier() const { return d->identifier; } void MSBuildFilter::setIdentifier(const QUuid &identifier) { d->identifier = identifier; d->identifierMetadata->setValue(identifier.toString()); } QList MSBuildFilter::extensions() const { return d->extensions; } void MSBuildFilter::setExtensions(const QList &extensions) { d->extensions = extensions; d->extensionsMetadata->setValue(QStringList(extensions).join( Internal::HostOsInfo::pathListSeparator( Internal::HostOsInfo::HostOsWindows))); } bool MSBuildFilter::parseFiles() const { return d->parseFiles; } void MSBuildFilter::setParseFiles(bool parseFiles) { d->parseFiles = parseFiles; } bool MSBuildFilter::sourceControlFiles() const { return d->sourceControlFiles; } void MSBuildFilter::setSourceControlFiles(bool sourceControlFiles) { d->sourceControlFiles = sourceControlFiles; } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/items/msbuildclinclude.cpp0000644000175100017510000000332215154533055024304 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildclinclude.h" namespace qbs { static const QString MSBuildClIncludeItemName = QStringLiteral("ClInclude"); MSBuildClInclude::MSBuildClInclude() : MSBuildFileItem(MSBuildClIncludeItemName) { } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/items/msbuildlink.h0000644000175100017510000000327715154533055022755 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDLINK_H #define MSBUILDLINK_H #include "../msbuilditem.h" namespace qbs { class MSBuildLink : public MSBuildItem { public: explicit MSBuildLink(); }; } // namespace qbs #endif // MSBUILDLINK_H qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuildproject.h0000644000175100017510000000514415154533055022340 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDPROJECT_H #define MSBUILDPROJECT_H #include #include "imsbuildnode.h" #include namespace qbs { class MSBuildImport; class MSBuildImportGroup; class MSBuildItemGroup; class MSBuildItemDefinitionGroup; class MSBuildPropertyGroup; class MSBuildProjectPrivate; /*! * \brief The MSBuildProject class represents an MSBuild Project element. * * https://msdn.microsoft.com/en-us/library/bcxfsh87.aspx */ class MSBuildProject : public MSBuildNode< MSBuildImport, MSBuildImportGroup, MSBuildItemGroup, MSBuildItemDefinitionGroup, MSBuildPropertyGroup> { public: MSBuildProject(); ~MSBuildProject() override; QString defaultTargets() const; void setDefaultTargets(const QString &defaultTargets); QString toolsVersion() const; void setToolsVersion(const QString &toolsVersion); void accept(IMSBuildNodeVisitor *visitor) const override; private: std::unique_ptr d; }; } // namespace qbs #endif // MSBUILDPROJECT_H qbs-src-3.2.0/src/lib/msbuild/msbuild/imsbuildnode.h0000644000175100017510000000635215154533055021772 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef IMSBUILDNODE_H #define IMSBUILDNODE_H #include #include #include namespace qbs { class IMSBuildNodeVisitor; class IMSBuildNode { public: virtual ~IMSBuildNode(); virtual void accept(IMSBuildNodeVisitor *visitor) const = 0; }; template class MSBuildNode : public IMSBuildNode { public: template T *appendChild(std::unique_ptr child) { static_assert(Internal::is_any_of_types, "Type is not in the allowed list"); const auto p = child.get(); m_children.push_back(std::move(child)); return p; } template T *makeChild(Args &&...args) { static_assert(Internal::is_any_of_types, "Type is not in the allowed list"); return appendChild(std::make_unique(std::forward(args)...)); } template std::unique_ptr takeChild(T *ptr) { static_assert(Internal::is_any_of_types, "Type is not in the allowed list"); const auto pred = [ptr](const auto &node) { return node.get() == ptr; }; const auto it = std::find_if(m_children.begin(), m_children.end(), pred); if (it == m_children.end()) return {}; std::unique_ptr result(static_cast(it->release())); m_children.erase(it); return result; } protected: const std::vector> &children() const { return m_children; } void acceptChildren(IMSBuildNodeVisitor *visitor) const { for (const auto &child : m_children) child->accept(visitor); } private: std::vector> m_children; }; } // namespace qbs #endif // IMSBUILDNODE_H qbs-src-3.2.0/src/lib/msbuild/msbuild/imsbuildnodevisitor.h0000644000175100017510000000617715154533055023417 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef IMSBUILDNODEVISITOR_H #define IMSBUILDNODEVISITOR_H namespace qbs { class MSBuildImport; class MSBuildImportGroup; class MSBuildItem; class MSBuildItemDefinitionGroup; class MSBuildItemGroup; class MSBuildItemMetadata; class MSBuildProject; class MSBuildProperty; class MSBuildPropertyGroup; class IMSBuildNodeVisitor { public: virtual ~IMSBuildNodeVisitor() = default; virtual void visitStart(const MSBuildImport *import) = 0; virtual void visitEnd(const MSBuildImport *import) = 0; virtual void visitStart(const MSBuildImportGroup *importGroup) = 0; virtual void visitEnd(const MSBuildImportGroup *importGroup) = 0; virtual void visitStart(const MSBuildItem *item) = 0; virtual void visitEnd(const MSBuildItem *item) = 0; virtual void visitStart(const MSBuildItemDefinitionGroup *itemDefinitionGroup) = 0; virtual void visitEnd(const MSBuildItemDefinitionGroup *itemDefinitionGroup) = 0; virtual void visitStart(const MSBuildItemGroup *itemGroup) = 0; virtual void visitEnd(const MSBuildItemGroup *itemGroup) = 0; virtual void visitStart(const MSBuildItemMetadata *itemMetadata) = 0; virtual void visitEnd(const MSBuildItemMetadata *itemMetadata) = 0; virtual void visitStart(const MSBuildProject *project) = 0; virtual void visitEnd(const MSBuildProject *project) = 0; virtual void visitStart(const MSBuildProperty *property) = 0; virtual void visitEnd(const MSBuildProperty *property) = 0; virtual void visitStart(const MSBuildPropertyGroup *propertyGroup) = 0; virtual void visitEnd(const MSBuildPropertyGroup *propertyGroup) = 0; }; } // namespace qbs #endif // IMSBUILDNODEVISITOR_H qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuildpropertybase.cpp0000644000175100017510000000441015154533055023737 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildpropertybase.h" namespace qbs { class MSBuildPropertyBasePrivate { public: QString condition; QString name; QVariant value; }; MSBuildPropertyBase::MSBuildPropertyBase() : d(new MSBuildPropertyBasePrivate) { } MSBuildPropertyBase::~MSBuildPropertyBase() = default; QString MSBuildPropertyBase::condition() const { return d->condition; } void MSBuildPropertyBase::setCondition(const QString &condition) { d->condition = condition; } QString MSBuildPropertyBase::name() const { return d->name; } void MSBuildPropertyBase::setName(const QString &name) { d->name = name; } QVariant MSBuildPropertyBase::value() const { return d->value; } void MSBuildPropertyBase::setValue(const QVariant &value) { d->value = value; } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuilditemmetadata.h0000644000175100017510000000405115154533055023325 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDITEMMETADATA_H #define MSBUILDITEMMETADATA_H #include "msbuildpropertybase.h" namespace qbs { class MSBuildItem; /*! * \brief The MSBuildItemMetadata class represents an MSBuild ItemMetadata element. * * https://msdn.microsoft.com/en-us/library/ms164284.aspx */ class MSBuildItemMetadata : public MSBuildPropertyBase { public: MSBuildItemMetadata(); MSBuildItemMetadata(const QString &name, const QVariant &value = QVariant()); void accept(IMSBuildNodeVisitor *visitor) const override; }; } // namespace qbs #endif // MSBUILDITEMMETADATA_H qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuildpropertygroup.h0000644000175100017510000000457315154533055023640 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDPROPERTYGROUP_H #define MSBUILDPROPERTYGROUP_H #include "imsbuildnode.h" #include namespace qbs { class MSBuildProperty; class MSBuildProject; class MSBuildPropertyGroupPrivate; /*! * \brief The MSBuildPropertyGroup class represents an MSBuild PropertyGroup element. * * https://msdn.microsoft.com/en-us/library/t4w159bs.aspx */ class MSBuildPropertyGroup : public MSBuildNode { public: MSBuildPropertyGroup(); ~MSBuildPropertyGroup() override; QString condition() const; void setCondition(const QString &condition); QString label() const; void setLabel(const QString &label); void appendProperty(const QString &name, const QVariant &value); void accept(IMSBuildNodeVisitor *visitor) const override; private: std::unique_ptr d; }; } // namespace qbs #endif // MSBUILDPROPERTYGROUP_H qbs-src-3.2.0/src/lib/msbuild/msbuild/msbuildimport.h0000644000175100017510000000437015154533055022204 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDIMPORT_H #define MSBUILDIMPORT_H #include #include "imsbuildnode.h" #include namespace qbs { class MSBuildImportGroup; class MSBuildImportPrivate; class MSBuildProject; /*! * \brief The MSBuildImport class represents an MSBuild Import element. * * https://msdn.microsoft.com/en-us/library/92x05xfs.aspx */ class MSBuildImport : public IMSBuildNode { public: MSBuildImport(); ~MSBuildImport() override; QString project() const; void setProject(const QString &project); QString condition() const; void setCondition(const QString &condition); void accept(IMSBuildNodeVisitor *visitor) const override; private: std::unique_ptr d; }; } // namespace qbs #endif // MSBUILDIMPORT_H qbs-src-3.2.0/src/lib/msbuild/CMakeLists.txt0000644000175100017510000000346215154533055020243 0ustar runnerrunnerset(SOLUTION_SOURCES ivisualstudiosolutionproject.cpp ivisualstudiosolutionproject.h visualstudiosolutionfileproject.cpp visualstudiosolutionfileproject.h visualstudiosolutionfolderproject.cpp visualstudiosolutionfolderproject.h visualstudiosolution.cpp visualstudiosolution.h visualstudiosolutionglobalsection.cpp visualstudiosolutionglobalsection.h ) list_transform_prepend(SOLUTION_SOURCES solution/) set(MSBUILD_SOURCES imsbuildnode.cpp imsbuildnode.h imsbuildnodevisitor.h msbuildimport.cpp msbuildimport.h msbuildimportgroup.cpp msbuildimportgroup.h msbuilditem.cpp msbuilditem.h msbuilditemgroupbase.cpp msbuilditemgroupbase.h msbuilditemdefinitiongroup.cpp msbuilditemdefinitiongroup.h msbuilditemgroup.cpp msbuilditemgroup.h msbuilditemmetadata.cpp msbuilditemmetadata.h msbuildproject.cpp msbuildproject.h msbuildproperty.cpp msbuildproperty.h msbuildpropertybase.cpp msbuildpropertybase.h msbuildpropertygroup.cpp msbuildpropertygroup.h ) list_transform_prepend(MSBUILD_SOURCES msbuild/) set(MSBUILD_ITEMS_SOURCES msbuildclcompile.cpp msbuildclcompile.h msbuildclinclude.cpp msbuildclinclude.h msbuildfileitem.cpp msbuildfileitem.h msbuildfilter.cpp msbuildfilter.h msbuildlink.cpp msbuildlink.h msbuildnone.cpp msbuildnone.h ) list_transform_prepend(MSBUILD_ITEMS_SOURCES msbuild/items/) set(IO_SOURCES msbuildprojectwriter.cpp msbuildprojectwriter.h visualstudiosolutionwriter.cpp visualstudiosolutionwriter.h ) list_transform_prepend(IO_SOURCES io/) add_qbs_library(qbsmsbuild STATIC DEPENDS qbscore SOURCES ${SOLUTION_SOURCES} ${MSBUILD_SOURCES} ${MSBUILD_ITEMS_SOURCES} ${IO_SOURCES} ) qbs-src-3.2.0/src/lib/msbuild/solution/0000755000175100017510000000000015154533055017352 5ustar runnerrunnerqbs-src-3.2.0/src/lib/msbuild/solution/visualstudiosolutionfolderproject.h0000644000175100017510000000366115154533055026644 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef VISUALSTUDIOSOLUTIONFOLDERPROJECT_H #define VISUALSTUDIOSOLUTIONFOLDERPROJECT_H #include #include "ivisualstudiosolutionproject.h" namespace qbs { class VisualStudioSolutionFolderProject : public IVisualStudioSolutionProject { Q_OBJECT public: explicit VisualStudioSolutionFolderProject(QObject *parent); QUuid projectTypeGuid() const override; }; } // namespace qbs #endif // VISUALSTUDIOSOLUTIONFOLDERPROJECT_H qbs-src-3.2.0/src/lib/msbuild/solution/visualstudiosolutionfileproject.h0000644000175100017510000000437015154533055026306 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef VISUALSTUDIOSOLUTIONFILEPROJECT_H #define VISUALSTUDIOSOLUTIONFILEPROJECT_H #include #include "ivisualstudiosolutionproject.h" #include namespace qbs { class VisualStudioSolutionFileProjectPrivate; class VisualStudioSolutionFileProject : public IVisualStudioSolutionProject { Q_OBJECT public: explicit VisualStudioSolutionFileProject(const QString &filePath, QObject *parent = nullptr); ~VisualStudioSolutionFileProject() override; QString name() const override; QString filePath() const; void setFilePath(const QString &filePath); QUuid projectTypeGuid() const override; private: std::unique_ptr d; }; } // namespace qbs #endif // VISUALSTUDIOSOLUTIONFILEPROJECT_H qbs-src-3.2.0/src/lib/msbuild/solution/ivisualstudiosolutionproject.cpp0000644000175100017510000000434415154533055026153 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "ivisualstudiosolutionproject.h" namespace qbs { class IVisualStudioSolutionProjectPrivate { public: QUuid guid = QUuid::createUuid(); QString name; QString filePath; }; IVisualStudioSolutionProject::IVisualStudioSolutionProject(QObject *parent) : QObject(parent) , d(new IVisualStudioSolutionProjectPrivate) { } IVisualStudioSolutionProject::~IVisualStudioSolutionProject() = default; QUuid IVisualStudioSolutionProject::guid() const { return d->guid; } void IVisualStudioSolutionProject::setGuid(const QUuid &guid) { d->guid = guid; } QString IVisualStudioSolutionProject::name() const { return d->name; } void IVisualStudioSolutionProject::setName(const QString &name) { d->name = name; } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/solution/visualstudiosolutionfileproject.cpp0000644000175100017510000000515215154533055026640 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "visualstudiosolutionfileproject.h" #include namespace qbs { class VisualStudioSolutionFileProjectPrivate { public: QString filePath; }; VisualStudioSolutionFileProject::VisualStudioSolutionFileProject(const QString &filePath, QObject *parent) : IVisualStudioSolutionProject(parent) , d(new VisualStudioSolutionFileProjectPrivate) { setFilePath(filePath); } VisualStudioSolutionFileProject::~VisualStudioSolutionFileProject() = default; QString VisualStudioSolutionFileProject::name() const { auto projectName = IVisualStudioSolutionProject::name(); if (projectName.isEmpty()) return QFileInfo(filePath()).baseName(); return projectName; } QUuid VisualStudioSolutionFileProject::projectTypeGuid() const { return QUuid::fromString(QStringLiteral("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}")); // C++ } QString VisualStudioSolutionFileProject::filePath() const { return d->filePath; } void VisualStudioSolutionFileProject::setFilePath(const QString &filePath) { d->filePath = filePath; } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/solution/ivisualstudiosolutionproject.h0000644000175100017510000000434315154533055025617 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef IVISUALSTUDIOSOLUTIONPROJECT_H #define IVISUALSTUDIOSOLUTIONPROJECT_H #include #include #include #include namespace qbs { class IVisualStudioSolutionProjectPrivate; class IVisualStudioSolutionProject : public QObject { Q_OBJECT protected: explicit IVisualStudioSolutionProject(QObject *parent = nullptr); public: ~IVisualStudioSolutionProject() override; virtual QUuid projectTypeGuid() const = 0; QUuid guid() const; void setGuid(const QUuid &guid); virtual QString name() const; void setName(const QString &name); private: std::unique_ptr d; }; } // namespace qbs #endif // IVISUALSTUDIOSOLUTIONPROJECT_H qbs-src-3.2.0/src/lib/msbuild/solution/visualstudiosolutionglobalsection.h0000644000175100017510000000453315154533055026626 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef VISUALSTUDIOSOLUTIONGLOBALSECTION_H #define VISUALSTUDIOSOLUTIONGLOBALSECTION_H #include #include namespace qbs { class VisualStudioSolutionGlobalSectionPrivate; class VisualStudioSolutionGlobalSection : public QObject { Q_OBJECT Q_DISABLE_COPY(VisualStudioSolutionGlobalSection) public: explicit VisualStudioSolutionGlobalSection(const QString &name, QObject *parent = nullptr); ~VisualStudioSolutionGlobalSection() override; QString name() const; void setName(const QString &name); bool isPost() const; void setPost(bool post); std::vector > properties() const; void appendProperty(const QString &key, const QString &value); private: std::unique_ptr d; }; } // namespace qbs #endif // VISUALSTUDIOSOLUTIONGLOBALSECTION_H qbs-src-3.2.0/src/lib/msbuild/solution/visualstudiosolutionglobalsection.cpp0000644000175100017510000000531415154533055027157 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "visualstudiosolutionglobalsection.h" #include #include namespace qbs { class VisualStudioSolutionGlobalSectionPrivate { public: QString name; std::vector> properties; bool post = false; }; VisualStudioSolutionGlobalSection::VisualStudioSolutionGlobalSection(const QString &name, QObject *parent) : QObject(parent) , d(new VisualStudioSolutionGlobalSectionPrivate) { setName(name); } VisualStudioSolutionGlobalSection::~VisualStudioSolutionGlobalSection() = default; QString VisualStudioSolutionGlobalSection::name() const { return d->name; } void VisualStudioSolutionGlobalSection::setName(const QString &name) { d->name = name; } bool VisualStudioSolutionGlobalSection::isPost() const { return d->post; } void VisualStudioSolutionGlobalSection::setPost(bool post) { d->post = post; } std::vector > VisualStudioSolutionGlobalSection::properties() const { return d->properties; } void VisualStudioSolutionGlobalSection::appendProperty(const QString &key, const QString &value) { d->properties.emplace_back(key, value); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/solution/visualstudiosolutionfolderproject.cpp0000644000175100017510000000357615154533055027204 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "visualstudiosolutionfolderproject.h" #include namespace qbs { VisualStudioSolutionFolderProject::VisualStudioSolutionFolderProject(QObject *parent) : IVisualStudioSolutionProject(parent) { } QUuid VisualStudioSolutionFolderProject::projectTypeGuid() const { return QUuid::fromString(QStringLiteral("{2150E333-8FDC-42A3-9474-1A3956D46DE8}")); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/solution/visualstudiosolution.cpp0000644000175100017510000001015515154533055024410 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "visualstudiosolution.h" #include "visualstudiosolutionfileproject.h" #include "visualstudiosolutionfolderproject.h" #include #include namespace qbs { class VisualStudioSolutionPrivate { public: VisualStudioSolutionPrivate(const Internal::VisualStudioVersionInfo &versionInfo) : versionInfo(versionInfo) { } const Internal::VisualStudioVersionInfo versionInfo; QList projects; QMap> dependencies; QList globalSections; }; VisualStudioSolution::VisualStudioSolution(const Internal::VisualStudioVersionInfo &versionInfo, QObject *parent) : QObject(parent) , d(new VisualStudioSolutionPrivate(versionInfo)) { } VisualStudioSolution::~VisualStudioSolution() = default; Internal::VisualStudioVersionInfo VisualStudioSolution::versionInfo() const { return d->versionInfo; } QList VisualStudioSolution::projects() const { return d->projects; } QList VisualStudioSolution::fileProjects() const { QList list; for (const auto &project : std::as_const(d->projects)) if (auto fileProject = qobject_cast(project)) list.push_back(fileProject); return list; } QList VisualStudioSolution::folderProjects() const { QList list; for (const auto &project : std::as_const(d->projects)) if (auto folderProject = qobject_cast(project)) list.push_back(folderProject); return list; } void VisualStudioSolution::appendProject(IVisualStudioSolutionProject *project) { d->projects.push_back(project); } QList VisualStudioSolution::dependencies( VisualStudioSolutionFileProject *project) const { return d->dependencies.value(project); } void VisualStudioSolution::addDependency(VisualStudioSolutionFileProject *project, VisualStudioSolutionFileProject *dependency) { d->dependencies[project].push_back(dependency); } QList VisualStudioSolution::globalSections() const { return d->globalSections; } void VisualStudioSolution::appendGlobalSection(VisualStudioSolutionGlobalSection *globalSection) { d->globalSections.push_back(globalSection); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/solution/visualstudiosolution.h0000644000175100017510000000616415154533055024062 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef VISUALSTUDIOSOLUTION_H #define VISUALSTUDIOSOLUTION_H #include #include namespace qbs { namespace Internal { class VisualStudioVersionInfo; } class MSBuildProject; class IVisualStudioSolutionProject; class VisualStudioSolutionFileProject; class VisualStudioSolutionFolderProject; class VisualStudioSolutionGlobalSection; class VisualStudioSolutionPrivate; class VisualStudioSolution : public QObject { Q_OBJECT Q_DISABLE_COPY(VisualStudioSolution) public: explicit VisualStudioSolution(const Internal::VisualStudioVersionInfo &versionInfo, QObject *parent = nullptr); ~VisualStudioSolution() override; Internal::VisualStudioVersionInfo versionInfo() const; QList projects() const; QList fileProjects() const; QList folderProjects() const; void appendProject(IVisualStudioSolutionProject *project); void removeProject(const IVisualStudioSolutionProject *project); void clearProjects(); QList dependencies( VisualStudioSolutionFileProject *project) const; void addDependency(VisualStudioSolutionFileProject *project, VisualStudioSolutionFileProject *dependency); QList globalSections() const; void appendGlobalSection(VisualStudioSolutionGlobalSection *globalSection); private: void addDefaultGlobalSections(); std::unique_ptr d; }; } // namespace qbs #endif // VISUALSTUDIOSOLUTION_H qbs-src-3.2.0/src/lib/msbuild/io/0000755000175100017510000000000015154533055016105 5ustar runnerrunnerqbs-src-3.2.0/src/lib/msbuild/io/visualstudiosolutionwriter.cpp0000644000175100017510000001214315154533055024377 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "visualstudiosolutionwriter.h" #include "../solution/visualstudiosolutionfileproject.h" #include "../solution/visualstudiosolutionfolderproject.h" #include "../solution/visualstudiosolutionglobalsection.h" #include "../solution/visualstudiosolution.h" #include #include #include #include #include #include #include #include #include namespace qbs { using namespace Internal; class VisualStudioSolutionWriterPrivate { public: std::ostream *device = nullptr; std::string baseDir; }; VisualStudioSolutionWriter::VisualStudioSolutionWriter(std::ostream *device) : d(new VisualStudioSolutionWriterPrivate) { d->device = device; } VisualStudioSolutionWriter::~VisualStudioSolutionWriter() = default; std::string VisualStudioSolutionWriter::projectBaseDirectory() const { return d->baseDir; } void VisualStudioSolutionWriter::setProjectBaseDirectory(const std::string &dir) { d->baseDir = dir; } bool VisualStudioSolutionWriter::write(const VisualStudioSolution *solution) { auto &out = *d->device; out << "Microsoft Visual Studio Solution File, Format Version " << solution->versionInfo().solutionVersion().toStdString() << "\n# Visual Studio " << solution->versionInfo().version().majorVersion() << "\n"; const auto fileProjects = solution->fileProjects(); for (const auto &project : fileProjects) { auto projectFilePath = project->filePath().toStdString(); // Try to make the project file path relative to the // solution file path if we're writing to a file device if (!d->baseDir.empty()) { const QDir solutionDir(QString::fromStdString(d->baseDir)); projectFilePath = Internal::PathUtils::toNativeSeparators( solutionDir.relativeFilePath(QString::fromStdString(projectFilePath)), Internal::HostOsInfo::HostOsWindows).toStdString(); } out << "Project(\"" << project->projectTypeGuid().toString().toStdString() << "\") = \"" << QFileInfo(QString::fromStdString(projectFilePath)).baseName().toStdString() << "\", \"" << projectFilePath << "\", \"" << project->guid().toString().toStdString() << "\"\n"; out << "EndProject\n"; } const auto folderProjects = solution->folderProjects(); for (const auto &project : folderProjects) { out << "Project(\"" << project->projectTypeGuid().toString().toStdString() << "\") = \"" << project->name().toStdString() << "\", \"" << project->name().toStdString() << "\", \"" << project->guid().toString().toStdString() << "\"\n"; out << "EndProject\n"; } out << "Global\n"; const auto globalSections = solution->globalSections(); for (const auto &globalSection : globalSections) { out << "\tGlobalSection(" << globalSection->name().toStdString() << ") = " << (globalSection->isPost() ? "postSolution" : "preSolution") << "\n"; for (const auto &property : globalSection->properties()) out << "\t\t" << property.first.toStdString() << " = " << property.second.toStdString() << "\n"; out << "\tEndGlobalSection\n"; } out << "EndGlobal\n"; return out.good(); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/io/msbuildprojectwriter.cpp0000644000175100017510000002051015154533055023072 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildprojectwriter.h" #include "../msbuild/imsbuildnodevisitor.h" #include "../msbuild/msbuildimport.h" #include "../msbuild/msbuildimportgroup.h" #include "../msbuild/msbuilditem.h" #include "../msbuild/msbuilditemdefinitiongroup.h" #include "../msbuild/msbuilditemgroup.h" #include "../msbuild/msbuilditemmetadata.h" #include "../msbuild/msbuildproject.h" #include "../msbuild/msbuildproperty.h" #include "../msbuild/msbuildpropertygroup.h" #include #include namespace qbs { static const QString kMSBuildSchemaURI = QStringLiteral("http://schemas.microsoft.com/developer/msbuild/2003"); class MSBuildProjectWriterPrivate : public IMSBuildNodeVisitor { public: std::ostream *device = nullptr; QByteArray buffer; std::unique_ptr writer; void visitStart(const MSBuildImport *import) override; void visitEnd(const MSBuildImport *import) override; void visitStart(const MSBuildImportGroup *importGroup) override; void visitEnd(const MSBuildImportGroup *importGroup) override; void visitStart(const MSBuildItem *item) override; void visitEnd(const MSBuildItem *item) override; void visitStart(const MSBuildItemDefinitionGroup *itemDefinitionGroup) override; void visitEnd(const MSBuildItemDefinitionGroup *itemDefinitionGroup) override; void visitStart(const MSBuildItemGroup *itemGroup) override; void visitEnd(const MSBuildItemGroup *itemGroup) override; void visitStart(const MSBuildItemMetadata *itemMetadata) override; void visitEnd(const MSBuildItemMetadata *itemMetadata) override; void visitStart(const MSBuildProject *project) override; void visitEnd(const MSBuildProject *project) override; void visitStart(const MSBuildProperty *property) override; void visitEnd(const MSBuildProperty *property) override; void visitStart(const MSBuildPropertyGroup *propertyGroup) override; void visitEnd(const MSBuildPropertyGroup *propertyGroup) override; }; MSBuildProjectWriter::MSBuildProjectWriter(std::ostream *device) : d(std::make_unique()) { d->device = device; d->writer = std::make_unique(&d->buffer); d->writer->setAutoFormatting(true); } MSBuildProjectWriter::~MSBuildProjectWriter() = default; bool MSBuildProjectWriter::write(const MSBuildProject *project) { d->buffer.clear(); d->writer->writeStartDocument(); project->accept(d.get()); d->writer->writeEndDocument(); if (d->writer->hasError()) return false; d->device->write(&*std::begin(d->buffer), d->buffer.size()); return d->device->good(); } void MSBuildProjectWriterPrivate::visitStart(const MSBuildImport *import) { writer->writeStartElement(QStringLiteral("Import")); writer->writeAttribute(QStringLiteral("Project"), import->project()); if (!import->condition().isEmpty()) writer->writeAttribute(QStringLiteral("Condition"), import->condition()); } void MSBuildProjectWriterPrivate::visitEnd(const MSBuildImport *) { writer->writeEndElement(); } void MSBuildProjectWriterPrivate::visitStart(const MSBuildImportGroup *importGroup) { writer->writeStartElement(QStringLiteral("ImportGroup")); if (!importGroup->condition().isEmpty()) writer->writeAttribute(QStringLiteral("Condition"), importGroup->condition()); if (!importGroup->label().isEmpty()) writer->writeAttribute(QStringLiteral("Label"), importGroup->label()); } void MSBuildProjectWriterPrivate::visitEnd(const MSBuildImportGroup *) { writer->writeEndElement(); } void MSBuildProjectWriterPrivate::visitStart(const MSBuildItem *item) { writer->writeStartElement(item->name()); if (!item->include().isEmpty()) writer->writeAttribute(QStringLiteral("Include"), item->include()); } void MSBuildProjectWriterPrivate::visitEnd(const MSBuildItem *) { writer->writeEndElement(); } void MSBuildProjectWriterPrivate::visitStart(const MSBuildItemDefinitionGroup *itemDefinitionGroup) { writer->writeStartElement(QStringLiteral("ItemDefinitionGroup")); if (!itemDefinitionGroup->condition().isEmpty()) writer->writeAttribute(QStringLiteral("Condition"), itemDefinitionGroup->condition()); } void MSBuildProjectWriterPrivate::visitEnd(const MSBuildItemDefinitionGroup *) { writer->writeEndElement(); } void MSBuildProjectWriterPrivate::visitStart(const MSBuildItemGroup *itemGroup) { writer->writeStartElement(QStringLiteral("ItemGroup")); if (!itemGroup->condition().isEmpty()) writer->writeAttribute(QStringLiteral("Condition"), itemGroup->condition()); if (!itemGroup->label().isEmpty()) writer->writeAttribute(QStringLiteral("Label"), itemGroup->label()); } void MSBuildProjectWriterPrivate::visitEnd(const MSBuildItemGroup *) { writer->writeEndElement(); } void MSBuildProjectWriterPrivate::visitStart(const MSBuildItemMetadata *itemMetadata) { QString stringValue; if (itemMetadata->value().userType() == QMetaType::Bool) { stringValue = itemMetadata->value().toBool() ? QStringLiteral("True") : QStringLiteral("False"); } else { stringValue = itemMetadata->value().toString(); } writer->writeTextElement(itemMetadata->name(), stringValue); } void MSBuildProjectWriterPrivate::visitEnd(const MSBuildItemMetadata *) { } void MSBuildProjectWriterPrivate::visitStart(const MSBuildProject *project) { writer->writeStartElement(QStringLiteral("Project")); if (!project->defaultTargets().isEmpty()) writer->writeAttribute(QStringLiteral("DefaultTargets"), project->defaultTargets()); if (!project->toolsVersion().isEmpty()) writer->writeAttribute(QStringLiteral("ToolsVersion"), project->toolsVersion()); writer->writeAttribute(QStringLiteral("xmlns"), kMSBuildSchemaURI); } void MSBuildProjectWriterPrivate::visitEnd(const MSBuildProject *) { writer->writeEndElement(); } void MSBuildProjectWriterPrivate::visitStart(const MSBuildProperty *property) { QString stringValue; if (property->value().userType() == QMetaType::Bool) stringValue = property->value().toBool() ? QStringLiteral("True") : QStringLiteral("False"); else stringValue = property->value().toString(); writer->writeTextElement(property->name(), stringValue); } void MSBuildProjectWriterPrivate::visitEnd(const MSBuildProperty *) { } void MSBuildProjectWriterPrivate::visitStart(const MSBuildPropertyGroup *propertyGroup) { writer->writeStartElement(QStringLiteral("PropertyGroup")); if (!propertyGroup->condition().isEmpty()) writer->writeAttribute(QStringLiteral("Condition"), propertyGroup->condition()); if (!propertyGroup->label().isEmpty()) writer->writeAttribute(QStringLiteral("Label"), propertyGroup->label()); } void MSBuildProjectWriterPrivate::visitEnd(const MSBuildPropertyGroup *) { writer->writeEndElement(); } } // namespace qbs qbs-src-3.2.0/src/lib/msbuild/io/msbuildprojectwriter.h0000644000175100017510000000400615154533055022541 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDPROJECTWRITER_H #define MSBUILDPROJECTWRITER_H #include #include #include namespace qbs { class MSBuildProject; class MSBuildProjectWriterPrivate; class MSBuildProjectWriter { Q_DISABLE_COPY(MSBuildProjectWriter) public: explicit MSBuildProjectWriter(std::ostream *device); ~MSBuildProjectWriter(); bool write(const MSBuildProject *project); private: const std::unique_ptr d; }; } // namespace qbs #endif // MSBUILDPROJECTWRITER_H qbs-src-3.2.0/src/lib/msbuild/io/visualstudiosolutionwriter.h0000644000175100017510000000443215154533055024046 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef VISUALSTUDIOSOLUTIONWRITER_H #define VISUALSTUDIOSOLUTIONWRITER_H #include #include #include #include namespace qbs { namespace Internal { class VisualStudioVersionInfo; } class VisualStudioSolution; class VisualStudioSolutionWriterPrivate; class VisualStudioSolutionWriter { Q_DISABLE_COPY(VisualStudioSolutionWriter) public: explicit VisualStudioSolutionWriter(std::ostream *device); ~VisualStudioSolutionWriter(); std::string projectBaseDirectory() const; void setProjectBaseDirectory(const std::string &dir); bool write(const VisualStudioSolution *solution); private: void addDefaultGlobalSections(); std::unique_ptr d; }; } // namespace qbs #endif // VISUALSTUDIOSOLUTIONWRITER_H qbs-src-3.2.0/src/lib/msbuild/msbuild.qbs0000644000175100017510000000513215154533055017645 0ustar runnerrunnerQbsStaticLibrary { Depends { name: "cpp" } Depends { name: "qbscore" } name: "qbsmsbuild" cpp.visibility: "default" cpp.includePaths: base.concat([ ".", "../corelib", // for some header-only functions in tools ]) Group { name: "Solution Object Model" prefix: "solution/" files: [ "ivisualstudiosolutionproject.cpp", "ivisualstudiosolutionproject.h", "visualstudiosolutionfileproject.cpp", "visualstudiosolutionfileproject.h", "visualstudiosolutionfolderproject.cpp", "visualstudiosolutionfolderproject.h", "visualstudiosolution.cpp", "visualstudiosolution.h", "visualstudiosolutionglobalsection.cpp", "visualstudiosolutionglobalsection.h", ] } Group { name: "MSBuild Object Model" prefix: "msbuild/" files: [ "imsbuildnode.cpp", "imsbuildnode.h", "imsbuildnodevisitor.h", "msbuildimport.cpp", "msbuildimport.h", "msbuildimportgroup.cpp", "msbuildimportgroup.h", "msbuilditem.cpp", "msbuilditem.h", "msbuilditemgroupbase.cpp", "msbuilditemgroupbase.h", "msbuilditemdefinitiongroup.cpp", "msbuilditemdefinitiongroup.h", "msbuilditemgroup.cpp", "msbuilditemgroup.h", "msbuilditemmetadata.cpp", "msbuilditemmetadata.h", "msbuildproject.cpp", "msbuildproject.h", "msbuildproperty.cpp", "msbuildproperty.h", "msbuildpropertybase.cpp", "msbuildpropertybase.h", "msbuildpropertygroup.cpp", "msbuildpropertygroup.h", ] } Group { name: "MSBuild Object Model Items" prefix: "msbuild/items/" files: [ "msbuildclcompile.cpp", "msbuildclcompile.h", "msbuildclinclude.cpp", "msbuildclinclude.h", "msbuildfileitem.cpp", "msbuildfileitem.h", "msbuildfilter.cpp", "msbuildfilter.h", "msbuildlink.cpp", "msbuildlink.h", "msbuildnone.cpp", "msbuildnone.h", ] } Group { name: "Visual Studio Object Model I/O" prefix: "io/" files: [ "msbuildprojectwriter.cpp", "msbuildprojectwriter.h", "visualstudiosolutionwriter.cpp", "visualstudiosolutionwriter.h", ] } } qbs-src-3.2.0/src/lib/pkgconfig/0000755000175100017510000000000015154533055016006 5ustar runnerrunnerqbs-src-3.2.0/src/lib/pkgconfig/pcparser.cpp0000644000175100017510000005452415154533055020343 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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$ ** ****************************************************************************/ #include "pcparser.h" #include "pkgconfig.h" #include #include #include #include #include namespace qbs { using Internal::completeBaseName; using Internal::parentPath; using Internal::startsWith; using Internal::endsWith; namespace { // workaround for a missing ctor before c++20 template std::string_view makeStringView(It begin, It end) { if (begin == end) return {}; return std::string_view(&*begin, std::distance(begin, end)); } bool readOneLine(std::ifstream &file, std::string &line) { bool quoted = false; bool comment = false; int n_read = 0; line = {}; while (true) { char c; file.get(c); const bool ok = file.good(); if (!ok) { if (quoted) line += '\\'; return n_read > 0; } n_read++; if (c == '\r') { n_read--; continue; } if (quoted) { quoted = false; switch (c) { case '#': line += '#'; break; case '\n': break; default: line += '\\'; line += c; break; } } else { switch (c) { case '#': comment = true; break; case '\\': if (!comment) quoted = true; break; case '\n': return n_read > 0; default: if (!comment) line += c; break; } } } return n_read > 0; } std::string_view trimmed(std::string_view str) { const auto predicate = [](int c){ return std::isspace(c); }; const auto left = std::find_if_not(str.begin(), str.end(), predicate); const auto right = std::find_if_not(str.rbegin(), str.rend(), predicate).base(); if (right <= left) return {}; return makeStringView(left, right); } // based on https://opensource.apple.com/source/distcc/distcc-31.0.81/popt/poptparse.c.auto.html std::optional> splitCommand(std::string_view s) { std::vector result; std::string arg; char quote = '\0'; for (auto it = s.begin(), end = s.end(); it != end; ++it) { if (quote == *it) { quote = '\0'; } else if (quote != '\0') { if (*it == '\\') { ++it; if (it == s.end()) return std::nullopt; if (*it != quote) arg += '\\'; } arg += *it; } else if (isspace(*it)) { if (!arg.empty()) { result.push_back(arg); arg.clear(); } } else { switch (*it) { case '"': case '\'': quote = *it; break; case '\\': ++it; if (it == s.end()) return std::nullopt; [[fallthrough]]; default: arg += *it; break; } } } if (!arg.empty()) result.push_back(arg); return result; } [[noreturn]] void raizeUnknownComparisonException(const PcPackage &pkg, std::string_view verName, std::string_view comp) { std::string message; message += "Unknown version comparison operator '"; message += comp; message += "' after package name '"; message += verName; message += "' in file '"; message += pkg.filePath; message += "'"; throw PcException(message); } [[noreturn]] void raiseDuplicateFieldException(std::string_view fieldName, std::string_view path) { std::string message; message += fieldName; message += " field occurs twice in '"; message += path; message += "'"; throw PcException(message); } [[noreturn]] void raizeEmptyPackageNameException(const PcPackage &pkg) { std::string message; message += "Empty package name in Requires or Conflicts in file '"; message += pkg.filePath; message += "'"; throw PcException(message); } [[noreturn]] void raizeNoVersionException(const PcPackage &pkg, std::string_view verName) { std::string message; message += "Comparison operator but no version after package name '"; message += verName; message += "' in file '"; message += pkg.filePath; message += "'"; throw PcException(message); } [[noreturn]] void raizeDuplicateVariableException(const PcPackage &pkg, std::string_view variable) { std::string message; message += "Duplicate definition of variable '"; message += variable; message += "' in '"; message += pkg.filePath; throw PcException(message); } [[noreturn]] void raizeUndefinedVariableException(const PcPackage &pkg, std::string_view variable) { std::string message; message += "Variable '"; message += variable; message += "' not defined in '"; message += pkg.filePath; throw PcException(message); } bool isModuleSeparator(char c) { return c == ',' || std::isspace(c); } bool isModuleOperator(char c) { return c == '<' || c == '>' || c == '!' || c == '='; } // A module list is a list of modules with optional version specification, // separated by commas and/or spaces. Commas are treated just like whitespace, // in order to allow stuff like: Requires: @FRIBIDI_PC@, glib, gmodule // where @FRIBIDI_PC@ gets substituted to nothing or to 'fribidi' std::vector splitModuleList(std::string_view str) { enum class State { // put numbers to help interpret lame debug spew ;-) OutsideModule = 0, InModuleName = 1, BeforeOperator = 2, InOperator = 3, AfterOperator = 4, InModuleVersion = 5 }; std::vector result; State state = State::OutsideModule; State last_state = State::OutsideModule; auto start = str.begin(); const auto end = str.end(); auto p = start; while (p != end) { switch (state) { case State::OutsideModule: if (!isModuleSeparator(*p)) state = State::InModuleName; break; case State::InModuleName: if (std::isspace(*p)) { // Need to look ahead to determine next state auto s = p; while (s != end && std::isspace (*s)) ++s; state = State::OutsideModule; if (s != end && isModuleOperator(*s)) state = State::BeforeOperator; } else if (isModuleSeparator(*p)) state = State::OutsideModule; // comma precludes any operators break; case State::BeforeOperator: // We know an operator is coming up here due to lookahead from // IN_MODULE_NAME if (std::isspace(*p)) ; // no change else if (isModuleOperator(*p)) state = State::InOperator; break; case State::InOperator: if (!isModuleOperator(*p)) state = State::AfterOperator; break; case State::AfterOperator: if (!std::isspace(*p)) state = State::InModuleVersion; break; case State::InModuleVersion: if (isModuleSeparator(*p)) state = State::OutsideModule; break; default: break; } if (state == State::OutsideModule && last_state != State::OutsideModule) { // We left a module while (start != end && isModuleSeparator(*start)) ++start; std::string module(&*start, p - start); result.push_back(module); // reset start start = p; } last_state = state; ++p; } if (p != start) { // get the last module while (start != end && isModuleSeparator(*start)) ++start; std::string module(&*start, p - start); result.push_back(module); } return result; } PcPackage::RequiredVersion::ComparisonType comparisonFromString( const PcPackage &pkg, std::string_view verName, std::string_view comp) { using ComparisonType = PcPackage::RequiredVersion::ComparisonType; if (comp.empty()) return ComparisonType::AlwaysMatch; if (comp == "=") return ComparisonType::Equal; if (comp == ">=") return ComparisonType::GreaterThanEqual; if (comp == "<=") return ComparisonType::LessThanEqual; if (comp == ">") return ComparisonType::GreaterThan; if (comp == "<") return ComparisonType::LessThan; if (comp == "!=") return ComparisonType::NotEqual; raizeUnknownComparisonException(pkg, verName, comp); } } // namespace PcParser::PcParser(const PkgConfig &pkgConfig) : m_pkgConfig(pkgConfig) { } PcPackageVariant PcParser::parsePackageFile(const std::string &path) try { PcPackage package; if (path.empty()) return package; std::ifstream file(path); if (!file.is_open()) throw PcException(std::string("Can't open file ") + path); package.baseFileName = std::string{completeBaseName(path)}; const auto fsPath = std::filesystem::path(path); package.filePath = fsPath.generic_string(); package.variables["pcfiledir"] = fsPath.parent_path().generic_string(); std::string line; while (readOneLine(file, line)) parseLine(package, line); return package; } catch(const PcException &ex) { return PcBrokenPackage{path, std::string{completeBaseName(path)}, ex.what()}; } std::string PcParser::trimAndSubstitute(const PcPackage &pkg, std::string_view str) const { str = trimmed(str); std::string result; while (!str.empty()) { if (startsWith(str, "$$")) { // escaped $ result += '$'; str.remove_prefix(2); // cut "$$" } else if (startsWith(str, "${")) { // variable str.remove_prefix(2); // cut "${" const auto it = std::find(str.begin(), str.end(), '}'); // funny, original pkg-config simply reads all available memory here if (it == str.end()) throw PcException("Missing closing '}'"); const std::string_view varname = str.substr(0, std::distance(str.begin(), it)); // past brace str.remove_prefix(varname.size()); str.remove_prefix(1); const auto varval = m_pkgConfig.packageGetVariable(pkg, varname); if (!varval) raizeUndefinedVariableException(pkg, varname); result += *varval; } else { result += str.front(); str.remove_prefix(1); } } return result; } std::string PcParser::evaluateVariable( PcPackage &pkg, std::string_view tag, std::string_view str) const { static constexpr std::string_view prefixVariable = "prefix"; if (m_pkgConfig.options().definePrefix) { if (tag == prefixVariable) { std::string_view prefix = pkg.filePath; prefix = parentPath(prefix); if (completeBaseName(prefix) == "pkgconfig") { prefix = parentPath(prefix); prefix = parentPath(prefix); } pkg.oldPrefix = std::string(str); if (!prefix.empty()) str = prefix; return std::string(str); } else if (pkg.oldPrefix && str.size() > pkg.oldPrefix->size() && str.substr(0, pkg.oldPrefix->size()) == *pkg.oldPrefix && str[pkg.oldPrefix->size()] == '/') { auto result = pkg.variables["prefix"]; result += str.substr(pkg.oldPrefix->size()); return trimAndSubstitute(pkg, result); } } return trimAndSubstitute(pkg, str); } void PcParser::parseStringField( PcPackage &pkg, std::string &field, std::string_view fieldName, std::string_view str) { if (!field.empty()) raiseDuplicateFieldException(fieldName, pkg.filePath); field = trimAndSubstitute(pkg, str); } void PcParser::parseLibs( PcPackage &pkg, std::vector &libs, std::string_view fieldName, std::string_view str) { // Strip out -l and -L flags, put them in a separate list. if (!libs.empty()) raiseDuplicateFieldException(fieldName, pkg.filePath); const auto trimmed = trimAndSubstitute(pkg, str); if (trimmed.empty()) return; const auto argv = splitCommand(trimmed); if (!argv) throw PcException("Couldn't parse Libs field into an argument vector"); libs = doParseLibs(*argv); } std::vector PcParser::doParseLibs(const std::vector &argv) { std::vector libs; libs.reserve(argv.size()); for (auto it = argv.begin(), end = argv.end(); it != end; ++it) { PcPackage::Flag flag; const auto escapedArgument = trimmed(*it); std::string_view arg(escapedArgument); // -lib: is used by the C# compiler for libs; it's not an -l flag. if (startsWith(arg, "-l") && !startsWith(arg, "-lib:")) { arg.remove_prefix(2); arg = trimmed(arg); flag.type = PcPackage::Flag::Type::LibraryName; flag.value += arg; } else if (startsWith(arg, "-L")) { arg.remove_prefix(2); arg = trimmed(arg); flag.type = PcPackage::Flag::Type::LibraryPath; flag.value += arg; } else if ((arg == "-framework" /*|| arg == "-Wl,-framework"*/) && it + 1 != end) { // macOS has a -framework Foo which is really one option, // so we join those to avoid having -framework Foo // -framework Bar being changed into -framework Foo Bar // later const auto framework = trimmed(*(it + 1)); flag.type = PcPackage::Flag::Type::Framework; flag.value += framework; ++it; } else if (startsWith(arg, "-F")) { arg.remove_prefix(2); arg = trimmed(arg); flag.type = PcPackage::Flag::Type::FrameworkPath; flag.value += arg; } else if (!startsWith(arg, "-") && (endsWith(arg, ".a") || endsWith(arg, ".lib"))) { flag.type = PcPackage::Flag::Type::StaticLibraryName; flag.value += arg; } else if (!arg.empty()) { flag.type = PcPackage::Flag::Type::LinkerFlag; flag.value += arg; } else { continue; } libs.push_back(flag); } return libs; } void PcParser::parseCFlags(PcPackage &pkg, std::string_view str) { // Strip out -I, -D, -isystem and idirafter flags, put them in a separate lists. if (!pkg.cflags.empty()) raiseDuplicateFieldException("Cflags", pkg.filePath); const auto command = trimAndSubstitute(pkg, str); if (command.empty()) return; const auto argv = splitCommand(command); if (!argv) throw PcException("Couldn't parse Cflags field into an argument vector"); std::vector cflags; cflags.reserve(argv->size()); for (auto it = argv->begin(), end = argv->end(); it != end; ++it) { PcPackage::Flag flag; const auto escapedArgument = trimmed(*it); std::string_view arg(escapedArgument); if (startsWith(arg, "-I")) { arg.remove_prefix(2); arg = trimmed(arg); flag.type = PcPackage::Flag::Type::IncludePath; flag.value += arg; } else if (startsWith(arg, "-D")) { arg.remove_prefix(2); arg = trimmed(arg); flag.type = PcPackage::Flag::Type::Define; flag.value += arg; } else if (arg == "-isystem" && it + 1 != end) { flag.type = PcPackage::Flag::Type::SystemIncludePath; flag.value = trimmed(*(it + 1)); ++it; } else if (arg == "-idirafter" && it + 1 != end) { flag.type = PcPackage::Flag::Type::DirAfterIncludePath; flag.value = trimmed(*(it + 1)); ++it; } else if (!arg.empty()) { flag.type = PcPackage::Flag::Type::CompilerFlag; flag.value += arg; } else { continue; } cflags.push_back(flag); } pkg.cflags = std::move(cflags); } std::vector PcParser::parseModuleList(PcPackage &pkg, std::string_view str) { using ComparisonType = PcPackage::RequiredVersion::ComparisonType; std::vector result; auto split = splitModuleList(str); for (auto &module: split) { PcPackage::RequiredVersion ver; auto p = module.begin(); const auto end = module.end(); ver.comparison = ComparisonType::AlwaysMatch; auto start = p; while (p != end && !std::isspace(*p)) ++p; const auto name = makeStringView(start, p); if (name.empty()) raizeEmptyPackageNameException(pkg); ver.name = std::string(name); while (p != end && std::isspace(*p)) ++p; start = p; while (p != end && !std::isspace(*p)) ++p; const auto comp = makeStringView(start, p); ver.comparison = comparisonFromString(pkg, ver.name, comp); while (p != end && std::isspace(*p)) ++p; start = p; while (p != end && !std::isspace(*p)) ++p; const auto version = makeStringView(start, p); while (p != end && std::isspace(*p)) ++p; if (ver.comparison != ComparisonType::AlwaysMatch && version.empty()) raizeNoVersionException(pkg, ver.name); ver.version = std::string(version); result.push_back(ver); } return result; } void PcParser::parseVersionsField( PcPackage &pkg, std::vector &modules, std::string_view fieldName, std::string_view str) { if (!modules.empty()) raiseDuplicateFieldException(fieldName, pkg.filePath); const auto trimmed = trimAndSubstitute(pkg, str); modules = parseModuleList(pkg, trimmed.c_str()); } void PcParser::parseLine(PcPackage &pkg, std::string_view str) { str = trimmed(str); if (str.empty()) return; auto getFirstWord = [](std::string_view s) { size_t pos = 0; for (; pos < s.size(); ++pos) { auto p = s.data() + pos; if ((*p < 'A' || *p > 'Z') && (*p < 'a' || *p > 'z') && (*p < '0' || *p > '9') && *p != '_' && *p != '.') { break; } } return s.substr(0, pos); }; const auto tag = getFirstWord(str); str.remove_prefix(tag.size()); // cut tag str = trimmed(str); if (str.empty()) return; if (str.front() == ':') { // keyword str.remove_prefix(1); // cut ':' str = trimmed(str); if (tag == "Name") parseStringField(pkg, pkg.name, tag, str); else if (tag == "Description") parseStringField(pkg, pkg.description, tag, str); else if (tag == "Version") parseStringField(pkg, pkg.version, tag, str); else if (tag == "Requires.private") parseVersionsField(pkg, pkg.requiresPrivate, tag, str); else if (tag == "Requires") parseVersionsField(pkg, pkg.requiresPublic, tag, str); else if (tag == "Libs.private") parseLibs(pkg, pkg.libsPrivate, "Libs.private", str); else if (tag == "Libs") parseLibs(pkg, pkg.libs, "Libs", str); else if (tag == "Cflags" || tag == "CFlags") parseCFlags(pkg, str); else if (tag == "Conflicts") parseVersionsField(pkg, pkg.conflicts, tag, str); else if (tag == "URL") parseStringField(pkg, pkg.url, tag, str); else { // we don't error out on unknown keywords because they may // represent additions to the .pc file format from future // versions of pkg-config. return; } } else if (str.front() == '=') { // variable str.remove_prefix(1); // cut '=' str = trimmed(str); const auto value = evaluateVariable(pkg, tag, str); if (!pkg.variables.insert({std::string(tag), value}).second) raizeDuplicateVariableException(pkg, tag); } } } // namespace qbs qbs-src-3.2.0/src/lib/pkgconfig/pkgconfig.h0000644000175100017510000000647115154533055020136 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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 PKGCONFIG_H #define PKGCONFIG_H #include "pcpackage.h" namespace qbs { class PkgConfig { public: struct Options { using VariablesMap = PcPackage::VariablesMap; std::vector libDirs; // PKG_CONFIG_LIBDIR std::vector extraPaths; // PKG_CONFIG_PATH std::string sysroot; // PKG_CONFIG_SYSROOT_DIR std::string topBuildDir; // PKG_CONFIG_TOP_BUILD_DIR bool allowSystemLibraryPaths{false}; // PKG_CONFIG_ALLOW_SYSTEM_LIBS std::vector systemLibraryPaths; // PKG_CONFIG_SYSTEM_LIBRARY_PATH bool disableUninstalled{true}; // PKG_CONFIG_DISABLE_UNINSTALLED bool staticMode{false}; bool definePrefix{false}; VariablesMap globalVariables; VariablesMap systemVariables; }; using Packages = std::vector; explicit PkgConfig(); explicit PkgConfig(Options options); const Options &options() const { return m_options; } const Packages &packages() const { return m_packages; } const PcPackageVariant &getPackage(std::string_view baseFileName) const; std::optional packageGetVariable( const PcPackage &pkg, std::string_view var) const; private: Packages findPackages() const; private: Options m_options; Packages m_packages; }; } // namespace qbs #endif // PKGCONFIG_H qbs-src-3.2.0/src/lib/pkgconfig/pkgconfig.qbs0000644000175100017510000000366115154533055020472 0ustar runnerrunnerimport qbs.FileInfo import qbs.Utilities QbsProduct { type: "staticlibrary" Depends { name: "cpp" } Depends { name: "qbsbuildconfig" } property stringList pcPaths: { var result = []; result.push(FileInfo.joinPaths(qbs.installPrefix, qbsbuildconfig.libDirName, "pkgconfig")); result.push(FileInfo.joinPaths(qbs.installPrefix, "share", "pkgconfig")); if (qbs.hostOS.contains("freebsd")) { result.push("/usr/local/libdata/pkgconfig/"); result.push("/usr/libdata/pkgconfig/"); result.push("/usr/local/share/pkgconfig/"); } else if (qbs.hostOS.contains("unix")) { result.push("/usr/lib/pkgconfig/") result.push("/usr/share/pkgconfig/") } return result } readonly property stringList pcPathsString: pcPaths.join(qbs.pathListSeparator) property bool withQtSupport: true readonly property stringList publicDefines: { var result = []; if (withQtSupport) result.push("QBS_PC_WITH_QT_SUPPORT=1") else result.push("QBS_PC_WITH_QT_SUPPORT=0") return result; } name: "qbspkgconfig" files: [ "pcpackage.cpp", "pcpackage.h", "pcparser.cpp", "pcparser.h", "pkgconfig.cpp", "pkgconfig.h", ] cpp.defines: { var result = [ "PKG_CONFIG_PC_PATH=\"" + pcPathsString + "\"", "PKG_CONFIG_SYSTEM_LIBRARY_PATH=\"/usr/" + qbsbuildconfig.libDirName + "\"", ] result = result.concat(publicDefines); return result } Export { Depends { name: "cpp" } cpp.defines: exportingProduct.publicDefines cpp.includePaths: [exportingProduct.sourceDirectory] cpp.staticLibraries: { if (qbs.toolchainType === "gcc" && cpp.compilerVersionMajor < 9) return ["stdc++fs"]; return []; } } } qbs-src-3.2.0/src/lib/pkgconfig/CMakeLists.txt0000644000175100017510000000211615154533055020546 0ustar runnerrunnerset(SOURCES pcpackage.cpp pcpackage.h pcparser.cpp pcparser.h pkgconfig.cpp pkgconfig.h ) list_transform_prepend(SOLUTION_SOURCES solution/) set(QBS_PKGCONFIG_PUBLIC_DEPENDS "") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) set(QBS_PKGCONFIG_PUBLIC_DEPENDS "stdc++fs") endif() set(PKG_CONFIG_PC_PATH "${CMAKE_INSTALL_PREFIX}/${QBS_LIBDIR_NAME}/pkgconfig:${CMAKE_INSTALL_PREFIX}/share/pkgconfig") if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") set(PKG_CONFIG_PC_PATH "${PKG_CONFIG_PC_PATH}:/usr/local/libdata/pkgconfig/:/usr/libdata/pkgconfig/:/usr/local/share/pkgconfig/") elseif (UNIX) set(PKG_CONFIG_PC_PATH "${PKG_CONFIG_PC_PATH}:/usr/lib/pkgconfig/:/usr/share/pkgconfig/") endif() message(${PKG_CONFIG_PC_PATH}) add_qbs_library(qbspkgconfig STATIC DEFINES "PKG_CONFIG_PC_PATH=\"${PKG_CONFIG_PC_PATH}\"" "PKG_CONFIG_SYSTEM_LIBRARY_PATH=\"/usr/${QBS_LIBDIR_NAME}\"" PUBLIC_DEFINES "QBS_PC_WITH_QT_SUPPORT=1" PUBLIC_DEPENDS ${QBS_PKGCONFIG_PUBLIC_DEPENDS} SOURCES ${SOURCES} ) qbs-src-3.2.0/src/lib/pkgconfig/pcparser.h0000644000175100017510000000627315154533055020006 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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 PC_PARSER_H #define PC_PARSER_H #include "pcpackage.h" namespace qbs { class PkgConfig; class PcParser { public: explicit PcParser(const PkgConfig &pkgConfig); PcPackageVariant parsePackageFile(const std::string &path); private: std::string trimAndSubstitute(const PcPackage &pkg, std::string_view str) const; std::string evaluateVariable(PcPackage &pkg, std::string_view tag, std::string_view str) const; void parseStringField( PcPackage &pkg, std::string &field, std::string_view fieldName, std::string_view str); void parseLibs( PcPackage &pkg, std::vector &libs, std::string_view fieldName, std::string_view str); std::vector doParseLibs(const std::vector &argv); void parseCFlags(PcPackage &pkg, std::string_view str); std::vector parseModuleList(PcPackage &pkg, std::string_view str); void parseVersionsField( PcPackage &pkg, std::vector &modules, std::string_view fieldName, std::string_view str); void parseLine(PcPackage &pkg, std::string_view str); private: const PkgConfig &m_pkgConfig; }; } // namespace qbs #endif // PC_PARSER_H qbs-src-3.2.0/src/lib/pkgconfig/pcpackage.cpp0000644000175100017510000001767315154533055020446 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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$ ** ****************************************************************************/ #include "pcpackage.h" #include namespace qbs { using Internal::startsWith; using ComparisonType = PcPackage::RequiredVersion::ComparisonType; std::string_view PcPackage::Flag::typeToString(Type t) { switch (t) { case Type::LibraryName: return "LibraryName"; case Type::StaticLibraryName: return "StaticLibraryName"; case Type::LibraryPath: return "LibraryPath"; case Type::Framework: return "Framework"; case Type::FrameworkPath: return "FrameworkPath"; case Type::LinkerFlag: return "LinkerFlag"; case Type::IncludePath: return "IncludePath"; case Type::SystemIncludePath: return "SystemIncludePath"; case Type::DirAfterIncludePath: return "DirAfterIncludePath"; case Type::Define: return "Define"; case Type::CompilerFlag: return "CompilerFlag"; } return {}; } std::optional PcPackage::Flag::typeFromString(std::string_view s) { if (s == "LibraryName") return Type::LibraryName; if (s == "StaticLibraryName") return Type::StaticLibraryName; if (s == "LibraryPath") return Type::LibraryPath; if (s == "Framework") return Type::Framework; if (s == "FrameworkPath") return Type::FrameworkPath; if (s == "LinkerFlag") return Type::LinkerFlag; if (s == "IncludePath") return Type::IncludePath; if (s == "SystemIncludePath") return Type::SystemIncludePath; if (s == "DirAfterIncludePath") return Type::DirAfterIncludePath; if (s == "Define") return Type::Define; if (s == "CompilerFlag") return Type::CompilerFlag; return std::nullopt; } std::string_view PcPackage::RequiredVersion::comparisonToString(ComparisonType t) { switch (t) { case ComparisonType::LessThan: return "LessThan"; case ComparisonType::GreaterThan: return "GreaterThan"; case ComparisonType::LessThanEqual: return "LessThanEqual"; case ComparisonType::GreaterThanEqual: return "GreaterThanEqual"; case ComparisonType::Equal: return "Equal"; case ComparisonType::NotEqual: return "NotEqual"; case ComparisonType::AlwaysMatch: return "AlwaysMatch"; } return {}; } std::optional PcPackage::RequiredVersion::comparisonFromString(std::string_view s) { if (s == "LessThan") return ComparisonType::LessThan; if (s == "GreaterThan") return ComparisonType::GreaterThan; if (s == "LessThanEqual") return ComparisonType::LessThanEqual; if (s == "GreaterThanEqual") return ComparisonType::GreaterThanEqual; if (s == "Equal") return ComparisonType::Equal; if (s == "NotEqual") return ComparisonType::NotEqual; if (s == "AlwaysMatch") return ComparisonType::AlwaysMatch; return std::nullopt; } // see https://github.com/pkgconf/pkgconf/blob/pkgconf-2.1.0/libpkgconf/tuple.c#L194 bool PcPackage::shouldRewriteSysroot(std::string_view sysroot, std::string_view value) { if (sysroot.empty() || value.empty()) return false; if (value.front() != '/') return false; if (sysroot == "/") return false; if (startsWith(value, sysroot)) return false; return true; } // TODO: pkg-config only prepends sysroot to flags; while pkgconf does this as a part of the // variable substitution and thus this affects all variables, not only flags PcPackage PcPackage::prependSysroot(std::string_view sysroot) && { PcPackage package(std::move(*this)); const auto doAppend = [](std::vector flags, std::string_view sysroot) { if (sysroot.empty()) return flags; for (auto &flag : flags) { if (!shouldRewriteSysroot(sysroot, flag.value)) continue; if (flag.type == Flag::Type::IncludePath || flag.type == Flag::Type::SystemIncludePath || flag.type == Flag::Type::DirAfterIncludePath || flag.type == Flag::Type::LibraryPath) { flag.value = std::string(sysroot) + std::move(flag.value); } } return flags; }; package.libs = doAppend(std::move(package.libs), sysroot); package.libsPrivate = doAppend(std::move(package.libsPrivate), sysroot); package.cflags = doAppend(std::move(package.cflags), sysroot); return package; } PcPackage PcPackage::removeSystemLibraryPaths( const std::unordered_set &libraryPaths) && { PcPackage package(std::move(*this)); if (libraryPaths.empty()) return package; const auto doRemove = [&libraryPaths](std::vector flags) { const auto predicate = [&libraryPaths](const Flag &flag) { return flag.type == Flag::Type::LibraryPath && libraryPaths.count(flag.value); }; flags.erase(std::remove_if(flags.begin(), flags.end(), predicate), flags.end()); return flags; }; package.libs = doRemove(package.libs); package.libsPrivate = doRemove(package.libsPrivate); return package; } namespace Internal { std::string_view fileName(std::string_view filePath) { const auto pos = filePath.rfind('/'); if (pos == std::string_view::npos) { #if defined(WIN32) if (filePath.size() >= 2 && filePath[1] == ':') return filePath.substr(2); #endif return filePath; } return filePath.substr(pos + 1); } std::string_view completeBaseName(std::string_view filePath) { filePath = fileName(filePath); const auto pos = filePath.rfind('.'); return pos == std::string_view::npos ? filePath : filePath.substr(0, pos); } std::string_view parentPath(std::string_view path) { if (path.empty()) return {}; auto pos = path.rfind('/'); if (pos == std::string_view::npos) { #if defined(WIN32) if (path.size() >= 2 && path[1] == ':') return path.substr(0, 2); #endif return "."; } if (pos == 0) return "/"; #if defined(WIN32) if (pos == 2 && path[1] == ':') return path.substr(0, pos + 1); #endif return path.substr(0, pos); }; } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/pkgconfig/pcpackage.h0000644000175100017510000001520115154533055020074 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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 PC_PACKAGE_H #define PC_PACKAGE_H #include #include #include #include #include #include #include #include #include namespace qbs { class PcPackage { public: struct Flag { enum class Type { LibraryName = (1 << 0), StaticLibraryName = (1 << 1), LibraryPath = (1 << 2), Framework = (1 << 3), FrameworkPath = (1 << 4), LinkerFlag = (1 << 5), // this is a lie, this is DriverLinkerFlags IncludePath = (1 << 6), SystemIncludePath = (1 << 7), DirAfterIncludePath = (1 << 8), Define = (1 << 9), CompilerFlag = (1 << 10), }; Type type{Type::CompilerFlag}; std::string value; static std::string_view typeToString(Type t); static std::optional typeFromString(std::string_view s); }; struct RequiredVersion { enum class ComparisonType { LessThan, GreaterThan, LessThanEqual, GreaterThanEqual, Equal, NotEqual, AlwaysMatch }; std::string name; ComparisonType comparison{ComparisonType::GreaterThanEqual}; std::string version; static std::string_view comparisonToString(ComparisonType t); static std::optional comparisonFromString(std::string_view s); }; std::string filePath; std::string baseFileName; std::string name; std::string version; std::string description; std::string url; std::vector libs; std::vector libsPrivate; std::vector cflags; std::vector requiresPublic; std::vector requiresPrivate; std::vector conflicts; std::optional oldPrefix; using VariablesMap = std::map>; VariablesMap variables; bool uninstalled{false}; static bool shouldRewriteSysroot(std::string_view sysroot, std::string_view value); PcPackage prependSysroot(std::string_view sysroot) &&; PcPackage removeSystemLibraryPaths(const std::unordered_set &libraryPaths) &&; }; class PcBrokenPackage { public: std::string filePath; std::string baseFileName; std::string errorText; }; class PcPackageVariant : public std::variant { public: using Base = std::variant; using Base::Base; bool isValid() const noexcept { return index() == 0; } bool isBroken() const noexcept { return index() == 1; } const PcPackage &asPackage() const { return std::get(*this); } PcPackage &asPackage() { return std::get(*this); } const PcBrokenPackage &asBrokenPackage() const { return std::get(*this); } PcBrokenPackage &asBrokenPackage() { return std::get(*this); } template decltype(auto) visit(F &&f) const { return std::visit(std::forward(f), static_cast(*this)); } template decltype(auto) visit(F &&f) { return std::visit(std::forward(f), static_cast(*this)); } const std::string &getBaseFileName() const { return visit([](auto &&value) noexcept -> const std::string & { return value.baseFileName; }); } }; class PcException: public std::runtime_error { public: explicit PcException(const std::string &message) : std::runtime_error(message) {} }; inline bool operator==(const PcPackage::Flag &lhs, const PcPackage::Flag &rhs) { return lhs.type == rhs.type && lhs.value == rhs.value; } inline bool operator!=(const PcPackage::Flag &lhs, const PcPackage::Flag &rhs) { return !(lhs == rhs); } namespace Internal { // fast versions (no allocations) of the QFileInfo methods std::string_view fileName(std::string_view filePath); std::string_view completeBaseName(std::string_view filePath); std::string_view parentPath(std::string_view path); inline bool startsWith(std::string_view haystack, std::string_view needle) { return haystack.size() >= needle.size() && haystack.compare(0, needle.size(), needle) == 0; } inline bool endsWith(std::string_view haystack, std::string_view needle) { return haystack.size() >= needle.size() && haystack.compare(haystack.size() - needle.size(), needle.size(), needle) == 0; } } // Internal } // namespace qbs namespace std { template<> struct hash { size_t operator()(const qbs::PcPackage::Flag &v) const noexcept { return hash()(v.value) + size_t(v.type); } }; } // namespace std #endif // PC_PACKAGE_H qbs-src-3.2.0/src/lib/pkgconfig/pkgconfig.cpp0000644000175100017510000002341015154533055020461 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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$ ** ****************************************************************************/ #include "pkgconfig.h" #include "pcparser.h" #include #include #include namespace qbs { namespace { std::string varToEnvVar(std::string_view pkg, std::string_view var) { auto result = std::string("PKG_CONFIG_"); result += pkg; result += '_'; result += var; for (char &p : result) { int c = std::toupper(p); if (!std::isalnum(c)) c = '_'; p = char(c); } return result; } std::vector split(std::string_view str, const char delim) { std::vector result; size_t prev = 0; size_t pos = 0; do { pos = str.find(delim, prev); if (pos == std::string::npos) pos = str.length(); std::string token(str.substr(prev, pos - prev)); if (!token.empty()) result.push_back(token); prev = pos + 1; } while (pos < str.length() && prev < str.length()); return result; } constexpr inline char listSeparator() noexcept { #if defined(WIN32) return ';'; #else return ':'; #endif } [[noreturn]] void raizeUnknownPackageException(std::string_view package) { std::string message; message += "Can't find package '"; message += package; message += "'"; throw PcException(message); } template C &operator<<(C &container, const C &other) { container.insert(container.end(), other.cbegin(), other.cend()); return container; } } // namespace PkgConfig::PkgConfig() : PkgConfig(Options()) { } PkgConfig::PkgConfig(Options options) : m_options(std::move(options)) { if (m_options.libDirs.empty()) m_options.libDirs = split(PKG_CONFIG_PC_PATH, listSeparator()); if (m_options.topBuildDir.empty()) m_options.topBuildDir = "$(top_builddir)"; // pkg-config sets this for automake =) if (m_options.systemLibraryPaths.empty()) m_options.systemLibraryPaths = split(PKG_CONFIG_SYSTEM_LIBRARY_PATH, ':'); // this is weird on Windows, but that's what pkg-config does if (m_options.sysroot.empty()) m_options.globalVariables["pc_sysrootdir"] = "/"; else m_options.globalVariables["pc_sysrootdir"] = m_options.sysroot; m_options.globalVariables["pc_top_builddir"] = m_options.topBuildDir; m_packages = findPackages(); } const PcPackageVariant &PkgConfig::getPackage(std::string_view baseFileName) const { // heterogeneous comparator so we can search the package using string_view const auto lessThan = [](const PcPackageVariant &package, const std::string_view &name) { return package.visit([name](auto &&value) noexcept { return value.baseFileName < name; }); }; const auto testPackage = [baseFileName](const PcPackageVariant &package) { return package.visit([baseFileName](auto &&value) noexcept { return baseFileName != value.baseFileName; }); }; const auto it = std::lower_bound(m_packages.begin(), m_packages.end(), baseFileName, lessThan); if (it == m_packages.end() || testPackage(*it)) raizeUnknownPackageException(baseFileName); return *it; } std::optional PkgConfig::packageGetVariable( const PcPackage &pkg, std::string_view var) const { std::optional result; if (var.empty()) return result; const auto &globals = m_options.globalVariables; if (auto it = globals.find(var); it != globals.end()) result = it->second; // Allow overriding specific variables using an environment variable of the // form PKG_CONFIG_$PACKAGENAME_$VARIABLE if (!pkg.baseFileName.empty()) { const std::string envVariable = varToEnvVar(pkg.baseFileName, var); const auto it = m_options.systemVariables.find(envVariable); if (it != m_options.systemVariables.end()) result = it->second; } if (!result) { if (const auto it = pkg.variables.find(var); it != pkg.variables.end()) result = it->second; } return result; } std::vector getPcFilePaths(const std::vector &searchPaths) { std::vector paths; for (const auto &searchPath : searchPaths) { if (!std::filesystem::exists(std::filesystem::directory_entry(searchPath).status())) continue; const auto dir = std::filesystem::directory_iterator(searchPath); std::copy_if( std::filesystem::begin(dir), std::filesystem::end(dir), std::back_inserter(paths), [](const auto &entry) { return entry.path().extension() == ".pc"; } ); } std::vector result; std::transform( std::begin(paths), std::end(paths), std::back_inserter(result), [](const auto &path) { return path.generic_string(); } ); return result; } PcBrokenPackage makeMissingDependency( const PcPackage &package, const PcPackage::RequiredVersion &depVersion) { std::string message; message += "Package "; message += package.name; message += " requires package "; message += depVersion.name; message += " but it is not found"; return PcBrokenPackage{ package.filePath, package.baseFileName, std::move(message)}; } PcBrokenPackage makeBrokenDependency( const PcPackage &package, const PcPackage::RequiredVersion &depVersion) { std::string message; message += "Package "; message += package.name; message += " requires package "; message += depVersion.name; message += " but it is broken"; return PcBrokenPackage{ package.filePath, package.baseFileName, std::move(message)}; } PcBrokenPackage makeVersionMismatchDependency( const PcPackage &package, const PcPackage &depPackage, const PcPackage::RequiredVersion &depVersion) { std::string message; message += "Package "; message += package.name; message += " requires version "; message += PcPackage::RequiredVersion::comparisonToString( depVersion.comparison); message += depVersion.version; message += " but "; message += depPackage.version; message += " is present"; return PcBrokenPackage{ package.filePath, package.baseFileName, std::move(message)}; } PkgConfig::Packages PkgConfig::findPackages() const { Packages result; PcParser parser(*this); const auto systemLibraryPaths = !m_options.allowSystemLibraryPaths ? std::unordered_set( m_options.systemLibraryPaths.begin(), m_options.systemLibraryPaths.end()) : std::unordered_set(); auto allSearchPaths = m_options.extraPaths; allSearchPaths.insert( allSearchPaths.end(), m_options.libDirs.begin(), m_options.libDirs.end()); const auto pcFilePaths = getPcFilePaths(allSearchPaths); for (const auto &pcFilePath : pcFilePaths) { if (m_options.disableUninstalled) { if (pcFilePath.find("-uninstalled.pc") != std::string::npos) continue; } auto pkg = parser.parsePackageFile(pcFilePath); pkg.visit([&](auto &value) { using T = std::decay_t; if constexpr (std::is_same_v) { // NOLINT value = std::move(value) // Weird, but pkg-config removes libs first and only then appends // sysroot. Looks like sysroot has to be used with // allowSystemLibraryPaths: true .removeSystemLibraryPaths(systemLibraryPaths) .prependSysroot(m_options.sysroot); } }); result.emplace_back(std::move(pkg)); } const auto lessThanPackage = [](const PcPackageVariant &lhs, const PcPackageVariant &rhs) { return lhs.getBaseFileName() < rhs.getBaseFileName(); }; std::sort(result.begin(), result.end(), lessThanPackage); return result; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/0000755000175100017510000000000015154533055015456 5ustar runnerrunnerqbs-src-3.2.0/src/lib/corelib/generators/0000755000175100017510000000000015154533055017627 5ustar runnerrunnerqbs-src-3.2.0/src/lib/corelib/generators/xmlworkspace.h0000644000175100017510000000466315154533055022530 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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 GENERATORS_XML_WWORKSPACE_H #define GENERATORS_XML_WWORKSPACE_H #include "xmlproperty.h" #include #include namespace qbs { namespace gen { namespace xml { class QBS_EXPORT Workspace : public Property { public: explicit Workspace(const QString &workspacePath); void accept(INodeVisitor *visitor) const final; virtual void addProject(const QString &projectPath) = 0; protected: const QDir m_baseDirectory; }; } // namespace xml } // namespace gen } // namespace qbs #endif // GENERATORS_XML_WWORKSPACE_H qbs-src-3.2.0/src/lib/corelib/generators/generatorutils.h0000644000175100017510000001065215154533055023053 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef GENERATORS_UTILS_H #define GENERATORS_UTILS_H #include #include #include namespace qbs { namespace gen { namespace utils { enum class Architecture { Unknown = 0, Arm = 1 << 1, Avr = 1 << 2, Mcs51 = 1 << 3, Stm8 = 1 << 4, Msp430 = 1 << 5 }; Q_DECLARE_FLAGS(ArchitectureFlags, Architecture) Q_DECLARE_OPERATORS_FOR_FLAGS(ArchitectureFlags) QBS_EXPORT QString architectureName(Architecture arch); QBS_EXPORT Architecture architecture(const Project &qbsProject); QBS_EXPORT QString buildConfigurationName(const Project &qbsProject); QBS_EXPORT int debugInformation(const ProductData &qbsProduct); QBS_EXPORT QString buildRootPath(const Project &qbsProject); QBS_EXPORT QString relativeFilePath(const QString &baseDirectory, const QString &fullFilePath); QBS_EXPORT QString binaryOutputDirectory(const QString &baseDirectory, const ProductData &qbsProduct); QBS_EXPORT QString objectsOutputDirectory(const QString &baseDirectory, const ProductData &qbsProduct); QBS_EXPORT QString listingOutputDirectory(const QString &baseDirectory, const ProductData &qbsProduct); QBS_EXPORT std::vector dependenciesOf(const ProductData &qbsProduct, const GeneratableProject &genProject, const QString &configurationName); QBS_EXPORT QString targetBinary(const ProductData &qbsProduct); QBS_EXPORT QString targetBinaryPath(const QString &baseDirectory, const ProductData &qbsProduct); QBS_EXPORT QString cppStringModuleProperty(const PropertyMap &qbsProps, const QString &propertyName); QBS_EXPORT bool cppBooleanModuleProperty(const PropertyMap &qbsProps, const QString &propertyName); QBS_EXPORT int cppIntegerModuleProperty(const PropertyMap &qbsProps, const QString &propertyName); QBS_EXPORT QStringList cppStringModuleProperties(const PropertyMap &qbsProps, const QStringList &propertyNames); QBS_EXPORT QVariantList cppVariantModuleProperties(const PropertyMap &qbsProps, const QStringList &propertyNames); QBS_EXPORT QString firstFlagValue(const QStringList &flags, const QString &flagKey); QBS_EXPORT QStringList allFlagValues(const QStringList &flags, const QString &flagKey); template bool inBounds(const T &value, const T &low, const T &high) { return !(value < low) && !(high < value); } } // namespace utils } // namespace gen } // namespace qbs #endif // GENERATORS_UTILS_H qbs-src-3.2.0/src/lib/corelib/generators/generatorversioninfo.cpp0000644000175100017510000000406515154533055024610 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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$ ** ****************************************************************************/ #include "generatorversioninfo.h" namespace qbs { namespace gen { int VersionInfo::marketingVersion() const { return m_version.majorVersion(); } } // namespace gen } // namespace qbs qbs-src-3.2.0/src/lib/corelib/generators/igeneratableprojectvisitor.h0000644000175100017510000000772215154533055025441 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 IGENERATABLEPROJECTVISITOR_H #define IGENERATABLEPROJECTVISITOR_H #include "generatordata.h" namespace qbs { class IGeneratableProjectVisitor { public: virtual ~IGeneratableProjectVisitor() = default; // Collapsed configurations virtual void visitProject(const GeneratableProject &project) { Q_UNUSED(project); } virtual void visitProjectData(const GeneratableProject &project, const GeneratableProjectData &parentProjectData, const GeneratableProjectData &projectData) { Q_UNUSED(project); Q_UNUSED(parentProjectData); Q_UNUSED(projectData); } virtual void visitProjectData(const GeneratableProject &project, const GeneratableProjectData &projectData) { Q_UNUSED(project); Q_UNUSED(projectData); } virtual void visitProduct(const GeneratableProject &project, const GeneratableProjectData &projectData, const GeneratableProductData &productData) { Q_UNUSED(project); Q_UNUSED(projectData); Q_UNUSED(productData); } // Expanded configurations virtual void visitProject(const Project &project, const QString &configuration) { Q_UNUSED(project); Q_UNUSED(configuration); } virtual void visitProjectData(const ProjectData &parentProjectData, const ProjectData &projectData, const QString &configuration) { Q_UNUSED(parentProjectData); Q_UNUSED(projectData); Q_UNUSED(configuration); } virtual void visitProjectData(const ProjectData &projectData, const QString &configuration) { Q_UNUSED(projectData); Q_UNUSED(configuration); } virtual void visitProduct(const ProductData &productData, const QString &configuration) { Q_UNUSED(productData); Q_UNUSED(configuration); } }; } // namespace qbs #endif // IGENERATABLEPROJECTVISITOR_H qbs-src-3.2.0/src/lib/corelib/generators/generatorversioninfo.h0000644000175100017510000000565015154533055024256 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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 GENERATORS_VERSION_INFO_H #define GENERATORS_VERSION_INFO_H #include "generatorutils.h" #include #include #include namespace qbs { namespace gen { class QBS_EXPORT VersionInfo { public: constexpr VersionInfo(const Version &version, utils::ArchitectureFlags archs) : m_version(version), m_archs(archs) { } constexpr bool operator<(const VersionInfo &other) const { return m_version < other.m_version; } constexpr bool operator==(const VersionInfo &other) const { return m_version == other.m_version && m_archs == other.m_archs; } constexpr Version version() const { return m_version; } constexpr bool containsArchitecture(utils::Architecture arch) const { return m_archs & arch; } int marketingVersion() const; private: Version m_version; utils::ArchitectureFlags m_archs; }; inline auto qHash(const VersionInfo &info) { return qHash(info.version().toString()); } } // namespace gen } // namespace qbs #endif // GENERATORS_VERSION_INFO_H qbs-src-3.2.0/src/lib/corelib/generators/xmlprojectwriter.cpp0000644000175100017510000000570615154533055023767 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "xmlproject.h" #include "xmlprojectwriter.h" #include "xmlproperty.h" #include "xmlpropertygroup.h" #include #include namespace qbs { namespace gen { namespace xml { ProjectWriter::ProjectWriter(std::ostream *device) : m_device(device) { m_writer = std::make_unique(&m_buffer); m_writer->setAutoFormatting(true); } bool ProjectWriter::write(const Project *project) { m_buffer.clear(); m_writer->writeStartDocument(); project->accept(this); m_writer->writeEndDocument(); if (m_writer->hasError()) return false; m_device->write(&*std::begin(m_buffer), m_buffer.size()); return m_device->good(); } void ProjectWriter::visitPropertyStart(const Property *property) { const auto value = property->value().toString(); const auto name = QString::fromUtf8(property->name()); m_writer->writeTextElement(name, value); } void ProjectWriter::visitPropertyEnd(const Property *property) { Q_UNUSED(property) } void ProjectWriter::visitPropertyGroupStart(const PropertyGroup *propertyGroup) { const auto name = QString::fromUtf8(propertyGroup->name()); m_writer->writeStartElement(name); } void ProjectWriter::visitPropertyGroupEnd(const PropertyGroup *propertyGroup) { Q_UNUSED(propertyGroup) m_writer->writeEndElement(); } QXmlStreamWriter *ProjectWriter::writer() const { return m_writer.get(); } } // namespace xml } // namespace gen } // namespace qbs qbs-src-3.2.0/src/lib/corelib/generators/xmlworkspace.cpp0000644000175100017510000000463015154533055023055 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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$ ** ****************************************************************************/ #include "ixmlnodevisitor.h" #include "xmlproperty.h" #include "xmlpropertygroup.h" #include "xmlworkspace.h" namespace qbs { namespace gen { namespace xml { Workspace::Workspace(const QString &workspacePath) : m_baseDirectory(QFileInfo(workspacePath).absoluteDir()) { } void Workspace::accept(INodeVisitor *visitor) const { visitor->visitWorkspaceStart(this); for (const auto &child : children()) child->accept(visitor); visitor->visitWorkspaceEnd(this); } } // namespace xml } // namespace gen } // namespace qbs qbs-src-3.2.0/src/lib/corelib/generators/generator.cpp0000644000175100017510000002015115154533055022320 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "generator.h" #include #include #include #include #include #include #include #include namespace qbs { class ProjectGeneratorPrivate { public: QList projects; QList buildConfigurations; InstallOptions installOptions; QString qbsSettingsDir; Internal::Logger logger = Internal::Logger(nullptr); }; ProjectGenerator::ProjectGenerator() : d(std::make_unique()) { } ProjectGenerator::~ProjectGenerator() = default; static QString _configurationName(const Project &project) { return project.projectConfiguration() .value(Internal::StringConstants::qbsModule()).toMap() .value(Internal::StringConstants::configurationNameProperty()).toString(); } static QString _configurationName(const QVariantMap &buildConfiguration) { return buildConfiguration.value(QStringLiteral("qbs.configurationName")).toString(); } ErrorInfo ProjectGenerator::generate(const QList &projects, const QList &buildConfigurations, const InstallOptions &installOptions, const QString &qbsSettingsDir, const Internal::Logger &logger) { d->projects = Internal::sorted(projects, [](const Project &lhs, const Project &rhs) { return _configurationName(lhs) < _configurationName(rhs); }); d->buildConfigurations = Internal::sorted( buildConfigurations, [](const QVariantMap &lhs, const QVariantMap &rhs) { return _configurationName(lhs) < _configurationName(rhs); }); d->installOptions = installOptions; d->qbsSettingsDir = qbsSettingsDir; d->logger = logger; try { generate(); } catch (const ErrorInfo &e) { return e; } return {}; } QList ProjectGenerator::projects() const { return d->projects; } QList ProjectGenerator::buildConfigurations() const { return d->buildConfigurations; } QVariantMap ProjectGenerator::buildConfiguration(const Project &project) const { int idx = d->projects.indexOf(project); if (idx < 0) return {}; return d->buildConfigurations.at(idx); } QStringList ProjectGenerator::buildConfigurationCommandLine(const Project &project) const { QVariantMap config = buildConfiguration(project); const QString name = config.take(QStringLiteral("qbs.configurationName")).toString(); if (name.isEmpty()) throw ErrorInfo(QStringLiteral("Can't find configuration name for project")); QStringList commandLineParameters; commandLineParameters += QStringLiteral("config:") + name; for (auto it = config.cbegin(), end = config.cend(); it != end; ++it) commandLineParameters += it.key() + QStringLiteral(":") + it.value().toString(); return commandLineParameters; } // Count the number of products in the project (singular) // Precondition: each project data (i.e. per-configuration project data) // has the same number of products. static int _productCount(const QList &projects) { int count = -1; for (const auto &project : projects) { int oldCount = count; count = project.products().size(); QBS_CHECK(oldCount == -1 || oldCount == count); } return count; } static int _subprojectCount(const QList &projects) { int count = -1; for (const auto &project : projects) { int oldCount = count; count = project.subProjects().size(); QBS_CHECK(oldCount == -1 || oldCount == count); } return count; } static GeneratableProjectData _reduceProjectConfigurations( const QMap &map) { GeneratableProjectData gproject; // Add the project's project data for each configuration for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) gproject.data.insert(it.key(), it.value()); // Add the project's products... for (int i = 0; i < _productCount(map.values()); ++i) { GeneratableProductData prod; // once for each configuration for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) prod.data.insert(it.key(), it.value().products().at(i)); gproject.products.push_back(prod); } // Add the project's subprojects... for (int i = 0; i < _subprojectCount(map.values()); ++i) { QMap subprojectMap; // once for each configuration for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) subprojectMap.insert(it.key(), it.value().subProjects().at(i)); gproject.subProjects.push_back(_reduceProjectConfigurations(subprojectMap)); } return gproject; } const GeneratableProject ProjectGenerator::project() const { QMap rootProjects; GeneratableProject proj; for (const auto &project : std::as_const(d->projects)) { const QString configurationName = _configurationName(project); rootProjects.insert(configurationName, project.projectData()); proj.projects.insert(configurationName, project); proj.buildConfigurations.insert(configurationName, buildConfiguration(project)); proj.commandLines.insert(configurationName, buildConfigurationCommandLine(project)); } auto p = _reduceProjectConfigurations(rootProjects); proj.data = p.data; proj.products = p.products; proj.subProjects = p.subProjects; proj.installOptions = d->installOptions; return proj; } QFileInfo ProjectGenerator::qbsExecutableFilePath() const { const QString qbsInstallDir = QString::fromLocal8Bit(qgetenv("QBS_INSTALL_DIR")); auto file = QFileInfo(Internal::HostOsInfo::appendExecutableSuffix( !qbsInstallDir.isEmpty() ? QString(qbsInstallDir + QStringLiteral("/bin/qbs")) : QString(qbsApplicationDirPath() + QStringLiteral("/qbs")))); QBS_CHECK(file.isAbsolute() && file.exists()); return file; } QString ProjectGenerator::qbsSettingsDir() const { return d->qbsSettingsDir; } const Internal::Logger &ProjectGenerator::logger() const { return d->logger; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/generators/xmlpropertygroup.h0000644000175100017510000000517715154533055023474 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef GENERATORS_XML_PROPERTY_GROUP_H #define GENERATORS_XML_PROPERTY_GROUP_H #include "generatorversioninfo.h" #include "xmlproperty.h" #include #include namespace qbs { class ProductData; class Project; namespace gen { namespace xml { class QBS_EXPORT PropertyGroup : public Property { public: explicit PropertyGroup(QByteArray name); void appendProperty(QByteArray name, QVariant value); void appendMultiLineProperty(QByteArray key, const QStringList &values, QChar sep = QLatin1Char(',')); void accept(INodeVisitor *visitor) const final; }; class PropertyGroupFactory { public: virtual ~PropertyGroupFactory() = default; virtual bool canCreate(utils::Architecture arch, const Version &version) const = 0; virtual std::unique_ptr create( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps) const = 0; }; } // namespace xml } // namespace gen } // namespace qbs #endif // GENERATORS_XML_PROPERTY_GROUP_H qbs-src-3.2.0/src/lib/corelib/generators/xmlprojectwriter.h0000644000175100017510000000465515154533055023436 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef GENERATORS_XML_PROJECT_WRITER_H #define GENERATORS_XML_PROJECT_WRITER_H #include "ixmlnodevisitor.h" #include #include namespace qbs { namespace gen { namespace xml { class QBS_EXPORT ProjectWriter : public INodeVisitor { Q_DISABLE_COPY(ProjectWriter) public: explicit ProjectWriter(std::ostream *device); bool write(const Project *project); protected: QXmlStreamWriter *writer() const; private: void visitPropertyStart(const Property *property) final; void visitPropertyEnd(const Property *property) final; void visitPropertyGroupStart(const PropertyGroup *propertyGroup) final; void visitPropertyGroupEnd(const PropertyGroup *propertyGroup) final; std::ostream *m_device = nullptr; QByteArray m_buffer; std::unique_ptr m_writer; }; } // namespace xml } // namespace gen } // namespace qbs #endif // GENERATORS_XML_PROJECT_WRITER_H qbs-src-3.2.0/src/lib/corelib/generators/generatorutils.cpp0000644000175100017510000002203515154533055023404 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "generatorutils.h" #include namespace qbs { namespace gen { namespace utils { QString architectureName(Architecture arch) { switch (arch) { case Architecture::Arm: return QStringLiteral("arm"); case Architecture::Avr: return QStringLiteral("avr"); case Architecture::Mcs51: return QStringLiteral("mcs51"); default: return QStringLiteral("unknown"); } } Architecture architecture(const Project &qbsProject) { const auto qbsArch = qbsProject.projectConfiguration() .value(Internal::StringConstants::qbsModule()).toMap() .value(QStringLiteral("architecture")).toString(); if (qbsArch == QLatin1String("arm")) return Architecture::Arm; if (qbsArch == QLatin1String("avr")) return Architecture::Avr; if (qbsArch == QLatin1String("mcs51")) return Architecture::Mcs51; if (qbsArch == QLatin1String("stm8")) return Architecture::Stm8; if (qbsArch == QLatin1String("msp430")) return Architecture::Msp430; return Architecture::Unknown; } QString buildConfigurationName(const Project &qbsProject) { return qbsProject.projectConfiguration() .value(Internal::StringConstants::qbsModule()).toMap() .value(QStringLiteral("configurationName")).toString(); } int debugInformation(const ProductData &qbsProduct) { return qbsProduct.moduleProperties().getModuleProperty( Internal::StringConstants::qbsModule(), QStringLiteral("debugInformation")) .toInt(); } QString buildRootPath(const Project &qbsProject) { QDir dir(qbsProject.projectData().buildDirectory()); dir.cdUp(); return dir.absolutePath(); } QString relativeFilePath(const QString &baseDirectory, const QString &fullFilePath) { return QDir(baseDirectory).relativeFilePath(fullFilePath); } QString binaryOutputDirectory(const QString &baseDirectory, const ProductData &qbsProduct) { return QDir(baseDirectory).relativeFilePath( qbsProduct.buildDirectory()) + QLatin1String("/bin"); } QString objectsOutputDirectory(const QString &baseDirectory, const ProductData &qbsProduct) { return QDir(baseDirectory).relativeFilePath( qbsProduct.buildDirectory()) + QLatin1String("/obj"); } QString listingOutputDirectory(const QString &baseDirectory, const ProductData &qbsProduct) { return QDir(baseDirectory).relativeFilePath( qbsProduct.buildDirectory()) + QLatin1String("/lst"); } std::vector dependenciesOf(const ProductData &qbsProduct, const GeneratableProject &genProject, const QString &configurationName) { std::vector result; const auto &depsNames = qbsProduct.dependencies(); for (const auto &product : std::as_const(genProject.products)) { const auto pt = product.type(); if (!pt.contains(QLatin1String("staticlibrary"))) continue; const auto pn = product.name(); if (!depsNames.contains(pn)) continue; result.push_back(product.data.value(configurationName)); } return result; } QString targetBinary(const ProductData &qbsProduct) { const auto &type = qbsProduct.type(); if (type.contains(QLatin1String("application"))) { return QFileInfo(qbsProduct.targetExecutable()).fileName(); } if (type.contains(QLatin1String("staticlibrary"))) { for (const auto &artifact : qbsProduct.targetArtifacts()) { if (artifact.fileTags().contains(QLatin1String("staticlibrary"))) return QFileInfo(artifact.filePath()).fileName(); } } return {}; } QString targetBinaryPath(const QString &baseDirectory, const ProductData &qbsProduct) { return binaryOutputDirectory(baseDirectory, qbsProduct) + QLatin1Char('/') + targetBinary(qbsProduct); } QString cppStringModuleProperty(const PropertyMap &qbsProps, const QString &propertyName) { return qbsProps.getModuleProperty( Internal::StringConstants::cppModule(), propertyName).toString().trimmed(); } bool cppBooleanModuleProperty(const PropertyMap &qbsProps, const QString &propertyName) { return qbsProps.getModuleProperty( Internal::StringConstants::cppModule(), propertyName).toBool(); } int cppIntegerModuleProperty(const PropertyMap &qbsProps, const QString &propertyName) { return qbsProps.getModuleProperty( Internal::StringConstants::cppModule(), propertyName).toInt(); } QStringList cppStringModuleProperties(const PropertyMap &qbsProps, const QStringList &propertyNames) { QStringList properties; for (const auto &propertyName : propertyNames) { const auto entries = qbsProps.getModuleProperty(Internal::StringConstants::cppModule(), propertyName).toStringList(); Internal::transform(entries, properties, [](const auto &entry) { return entry.trimmed(); }); } return properties; } QVariantList cppVariantModuleProperties(const PropertyMap &qbsProps, const QStringList &propertyNames) { QVariantList properties; for (const auto &propertyName : propertyNames) { properties << qbsProps.getModuleProperty( Internal::StringConstants::cppModule(), propertyName).toList(); } return properties; } static QString parseFlagValue(const QString &flagKey, QStringList::const_iterator &flagIt, const QStringList::const_iterator &flagEnd) { if (flagIt->contains(QLatin1Char('='))) { // In this case an option is in form of 'flagKey='. const auto parts = flagIt->split(QLatin1Char('=')); if (parts.count() == 2) return parts.at(1).trimmed(); } else if (flagKey < *flagIt) { // In this case an option is in form of 'flagKey'. return flagIt->mid(flagKey.size()).trimmed(); } else { // In this case an option is in form of 'flagKey '. ++flagIt; if (flagIt < flagEnd && !flagIt->startsWith(QLatin1Char('-'))) return (*flagIt).trimmed(); } return {}; } QString firstFlagValue(const QStringList &flags, const QString &flagKey) { const auto flagBegin = flags.cbegin(); const auto flagEnd = flags.cend(); auto flagIt = std::find_if(flagBegin, flagEnd, [flagKey](const QString &flag) { return flag == flagKey || flag.startsWith(flagKey); }); if (flagIt == flagEnd) return {}; return parseFlagValue(flagKey, flagIt, flagEnd); } QStringList allFlagValues(const QStringList &flags, const QString &flagKey) { QStringList values; const auto flagEnd = flags.cend(); for (auto flagIt = flags.cbegin(); flagIt < flagEnd; ++flagIt) { if (*flagIt == flagKey || flagIt->startsWith(flagKey)) { const QString value = parseFlagValue(flagKey, flagIt, flagEnd); if (!value.isEmpty()) values.push_back(value); } } return values; } } // namespace utils } // namespace gen } // namespace qbs qbs-src-3.2.0/src/lib/corelib/generators/generatordata.h0000644000175100017510000001374215154533055022627 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 GENERATORDATA_H #define GENERATORDATA_H #include #include #include #include #include #include #include namespace qbs { using GeneratableProjectMap = QMap; template struct IMultiplexableContainer { QMap data; template T uniqueValue(const std::function &func, const QString &errorMessage) const { if (data.empty()) return T(); auto it = data.begin(), end = data.end(); auto value = func(*it++); for (; it != end; ++it) { if (value != func(*it)) throw ErrorInfo(errorMessage); } return value; } void forEach(const std::function &func) const { for (auto it = data.cbegin(), end = data.cend(); it != end; ++it) func(it.key(), it.value()); } void forEach(const std::function &func) const { for (auto it = data.cbegin(), end = data.cend(); it != end; ++it) func(it.key().toStdString(), it.value()); } const U operator[](const QString &configurationName) const { return data[configurationName]; } const U operator[](const std::string &configurationName) const { return data[QString::fromStdString(configurationName)]; } bool isValid() const { return !data.empty(); } protected: IMultiplexableContainer() = default; }; struct QBS_EXPORT GeneratableProductData : public IMultiplexableContainer { QString name() const; CodeLocation location() const; QStringList dependencies() const; QStringList type() const; QString buildDirectory() const; }; struct QBS_EXPORT GeneratableProjectData : public IMultiplexableContainer { struct Id { private: friend struct GeneratableProjectData; Id() = default; QString value; public: bool operator<(const Id &id) const { return value < id.value; } }; QList subProjects; QList products; QString name() const; CodeLocation location() const; Id uniqueName() const; }; struct QBS_EXPORT GeneratableProject : public GeneratableProjectData { GeneratableProjectMap projects; QMap buildConfigurations; QMap commandLines; InstallOptions installOptions; QDir baseBuildDirectory() const; QFileInfo filePath() const; bool hasMultipleConfigurations() const; QStringList commandLine() const; void forEach(const std::function &func) const { for (auto it = projects.cbegin(), end = projects.cend(); it != end; ++it) func(it.key(), it.value()); } void forEach(const std::function &func) const { for (auto it = projects.cbegin(), end = projects.cend(); it != end; ++it) func(it.key().toStdString(), it.value()); } const Project operator[](const QString &configurationName) const { return projects[configurationName]; } const Project operator[](const std::string &configurationName) const { return projects[QString::fromStdString(configurationName)]; } bool isValid() const { return !data.empty() && !projects.empty(); } const ProjectData projectData(const QString &configurationName) const { return data[configurationName]; } const ProjectData projectData(const std::string &configurationName) const { return data[QString::fromStdString(configurationName)]; } }; } // namespace qbs #endif // GENERATORDATA_H qbs-src-3.2.0/src/lib/corelib/generators/generatableprojectiterator.h0000644000175100017510000000475015154533055025420 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 GENERATABLEPROJECTITERATOR_H #define GENERATABLEPROJECTITERATOR_H #include "generatordata.h" #include "igeneratableprojectvisitor.h" namespace qbs { class QBS_EXPORT GeneratableProjectIterator { GeneratableProject project; public: GeneratableProjectIterator(GeneratableProject project); void accept(IGeneratableProjectVisitor *visitor); private: void accept(const GeneratableProject &project, const GeneratableProjectData &parentProjectData, const GeneratableProjectData &projectData, IGeneratableProjectVisitor *visitor); }; } // namespace qbs #endif // GENERATABLEPROJECTITERATOR_H qbs-src-3.2.0/src/lib/corelib/generators/ixmlnodevisitor.h0000644000175100017510000000506215154533055023242 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef GENERATORS_XML_INODE_VISITOR_H #define GENERATORS_XML_INODE_VISITOR_H #include #include namespace qbs { namespace gen { namespace xml { class Project; class Property; class PropertyGroup; class Workspace; class QBS_EXPORT INodeVisitor { public: virtual ~INodeVisitor() = default; virtual void visitWorkspaceStart(const Workspace *workspace) { Q_UNUSED(workspace) } virtual void visitWorkspaceEnd(const Workspace *workspace) { Q_UNUSED(workspace) } virtual void visitProjectStart(const Project *project) { Q_UNUSED(project) } virtual void visitProjectEnd(const Project *project) { Q_UNUSED(project) } virtual void visitPropertyStart(const Property *property) = 0; virtual void visitPropertyEnd(const Property *property) = 0; virtual void visitPropertyGroupStart(const PropertyGroup *propertyGroup) = 0; virtual void visitPropertyGroupEnd(const PropertyGroup *propertyGroup) = 0; }; } // namespace xml } // namespace gen } // namespace qbs #endif // GENERATORS_XML_INODE_VISITOR_H qbs-src-3.2.0/src/lib/corelib/generators/xmlpropertygroup.cpp0000644000175100017510000000444715154533055024026 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "ixmlnodevisitor.h" #include "xmlpropertygroup.h" namespace qbs { namespace gen { namespace xml { PropertyGroup::PropertyGroup(QByteArray name) { setName(std::move(name)); } void PropertyGroup::appendProperty(QByteArray name, QVariant value) { appendChild(std::move(name), std::move(value)); } void PropertyGroup::appendMultiLineProperty(QByteArray key, const QStringList &values, QChar sep) { const auto line = values.join(sep); appendProperty(std::move(key), QVariant::fromValue(line)); } void PropertyGroup::accept(INodeVisitor *visitor) const { visitor->visitPropertyGroupStart(this); for (const auto &child : children()) child->accept(visitor); visitor->visitPropertyGroupEnd(this); } } // namespace xml } // namespace gen } // namespace qbs qbs-src-3.2.0/src/lib/corelib/generators/generator.h0000644000175100017510000000665215154533055021777 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** 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 GENERATORPLUGIN_H #define GENERATORPLUGIN_H #include "generatordata.h" #include #include #include namespace qbs { class ProjectGeneratorPrivate; /*! * \class ProjectGenerator * \brief The \c ProjectGenerator class is an abstract base class for generators which generate * arbitrary output given a resolved Qbs project. */ class QBS_EXPORT ProjectGenerator : public QObject { Q_OBJECT Q_DISABLE_COPY(ProjectGenerator) public: ~ProjectGenerator() override; /*! * Returns the name of the generator used to create the external build system files. */ virtual QString generatorName() const = 0; ErrorInfo generate(const QList &projects, const QList &buildConfigurations, const InstallOptions &installOptions, const QString &qbsSettingsDir, const Internal::Logger &logger); const GeneratableProject project() const; QFileInfo qbsExecutableFilePath() const; QString qbsSettingsDir() const; protected: ProjectGenerator(); const Internal::Logger &logger() const; private: virtual void generate() = 0; QList projects() const; QList buildConfigurations() const; QVariantMap buildConfiguration(const Project &project) const; QStringList buildConfigurationCommandLine(const Project &project) const; const std::unique_ptr d; }; } // namespace qbs #endif // GENERATORPLUGIN_H qbs-src-3.2.0/src/lib/corelib/generators/xmlworkspacewriter.cpp0000644000175100017510000000574015154533055024315 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "xmlproperty.h" #include "xmlpropertygroup.h" #include "xmlworkspace.h" #include "xmlworkspacewriter.h" #include #include namespace qbs { namespace gen { namespace xml { WorkspaceWriter::WorkspaceWriter(std::ostream *device) : m_device(device) { m_writer = std::make_unique(&m_buffer); m_writer->setAutoFormatting(true); } bool WorkspaceWriter::write(const Workspace *workspace) { m_buffer.clear(); m_writer->writeStartDocument(); workspace->accept(this); m_writer->writeEndDocument(); if (m_writer->hasError()) return false; m_device->write(&*std::begin(m_buffer), m_buffer.size()); return m_device->good(); } void WorkspaceWriter::visitPropertyStart(const Property *property) { const auto value = property->value().toString(); const auto name = QString::fromUtf8(property->name()); m_writer->writeTextElement(name, value); } void WorkspaceWriter::visitPropertyEnd(const Property *property) { Q_UNUSED(property) } void WorkspaceWriter::visitPropertyGroupStart(const PropertyGroup *propertyGroup) { const auto name = QString::fromUtf8(propertyGroup->name()); m_writer->writeStartElement(name); } void WorkspaceWriter::visitPropertyGroupEnd(const PropertyGroup *propertyGroup) { Q_UNUSED(propertyGroup) m_writer->writeEndElement(); } QXmlStreamWriter *WorkspaceWriter::writer() const { return m_writer.get(); } } // namespace xml } // namespace gen } // namespace qbs qbs-src-3.2.0/src/lib/corelib/generators/xmlproperty.h0000644000175100017510000000546215154533055022414 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef GENERATORS_XML_PROPERTY_H #define GENERATORS_XML_PROPERTY_H #include #include #include namespace qbs { namespace gen { namespace xml { class INodeVisitor; class QBS_EXPORT Property { Q_DISABLE_COPY(Property) public: Property() = default; explicit Property(QByteArray name, QVariant value); virtual ~Property() = default; QByteArray name() const { return m_name; } void setName(QByteArray name) { m_name = std::move(name); } QVariant value() const { return m_value; } void setValue(QVariant value) { m_value = std::move(value); } template T *appendChild(std::unique_ptr child) { const auto p = child.get(); m_children.push_back(std::move(child)); return p; } template T *appendChild(Args&&... args) { return appendChild(std::make_unique(std::forward(args)...)); } virtual void accept(INodeVisitor *visitor) const; protected: const std::vector> &children() const { return m_children; } private: QByteArray m_name; QVariant m_value; std::vector> m_children; }; } // namespace xml } // namespace gen } // namespace qbs #endif // GENERATORS_XML_PROPERTY_H qbs-src-3.2.0/src/lib/corelib/generators/xmlproject.h0000644000175100017510000000360715154533055022175 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef GENERATORS_XML_PROJECT_H #define GENERATORS_XML_PROJECT_H #include "xmlproperty.h" #include #include namespace qbs { namespace gen { namespace xml { class QBS_EXPORT Project : public Property { public: void accept(INodeVisitor *visitor) const final; }; } // namespace xml } // namespace gen } // namespace qbs #endif // GENERATORS_XML_PROJECT_H qbs-src-3.2.0/src/lib/corelib/generators/xmlproject.cpp0000644000175100017510000000355115154533055022526 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "xmlproject.h" #include "ixmlnodevisitor.h" namespace qbs { namespace gen { namespace xml { void Project::accept(INodeVisitor *visitor) const { visitor->visitProjectStart(this); for (const auto &child : children()) child->accept(visitor); visitor->visitProjectEnd(this); } } // namespace xml } // namespace gen } // namespace qbs qbs-src-3.2.0/src/lib/corelib/generators/xmlworkspacewriter.h0000644000175100017510000000467515154533055023770 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef GENERATORS_XML_WORKSPACE_WRITER_H #define GENERATORS_XML_WORKSPACE_WRITER_H #include "ixmlnodevisitor.h" #include #include namespace qbs { namespace gen { namespace xml { class QBS_EXPORT WorkspaceWriter : public INodeVisitor { Q_DISABLE_COPY(WorkspaceWriter) public: explicit WorkspaceWriter(std::ostream *device); bool write(const Workspace *workspace); protected: QXmlStreamWriter *writer() const; private: void visitPropertyStart(const Property *property) final; void visitPropertyEnd(const Property *property) final; void visitPropertyGroupStart(const PropertyGroup *propertyGroup) final; void visitPropertyGroupEnd(const PropertyGroup *propertyGroup) final; std::ostream *m_device = nullptr; QByteArray m_buffer; std::unique_ptr m_writer; }; } // namespace xml } // namespace gen } // namespace qbs #endif // GENERATORS_XML_WORKSPACE_WRITER_H qbs-src-3.2.0/src/lib/corelib/generators/xmlproperty.cpp0000644000175100017510000000374415154533055022750 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "ixmlnodevisitor.h" #include "xmlproperty.h" namespace qbs { namespace gen { namespace xml { Property::Property(QByteArray name, QVariant value) { setName(std::move(name)); setValue(std::move(value)); } void Property::accept(INodeVisitor *visitor) const { visitor->visitPropertyStart(this); for (const auto &child : children()) child->accept(visitor); visitor->visitPropertyEnd(this); } } // namespace xml } // namespace gen } // namespace qbs qbs-src-3.2.0/src/lib/corelib/generators/generatordata.cpp0000644000175100017510000001241015154533055023151 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "generatordata.h" #include #include #include namespace qbs { QString GeneratableProductData::name() const { return uniqueValue(&ProductData::name, QStringLiteral("Products with different names per configuration are not " "compatible with this generator. " "Consider using the targetName property instead.")); } CodeLocation GeneratableProductData::location() const { return uniqueValue(&ProductData::location, QStringLiteral("GeneratableProductData::location: internal bug; this should not happen.")); } QStringList GeneratableProductData::dependencies() const { return uniqueValue(&ProductData::dependencies, QStringLiteral("Products with different dependency lists per configuration are not " "compatible with this generator.")); } QStringList GeneratableProductData::type() const { return uniqueValue(&ProductData::type, QStringLiteral("Products with different types per configuration are not " "compatible with this generator.")); } QString GeneratableProductData::buildDirectory() const { return uniqueValue(&ProductData::buildDirectory, QStringLiteral("GeneratableProductData::buildDirectory: " "internal bug; this should not happen.")); } QString GeneratableProjectData::name() const { return uniqueValue(&ProjectData::name, QStringLiteral("Projects with different names per configuration are not " "compatible with this generator.")); } CodeLocation GeneratableProjectData::location() const { CodeLocation location; for (auto it = data.cbegin(), end = data.cend(); it != end; ++it) { CodeLocation oldLocation = location; location = it.value().location(); if (oldLocation.isValid() && oldLocation != location) throw ErrorInfo(QStringLiteral("Projects with different code locations " "per configuration are not compatible with this " "generator.")); } return location; } GeneratableProjectData::Id GeneratableProjectData::uniqueName() const { GeneratableProjectData::Id id; id.value = name() + QLatin1Char('-') + location().toString(); return id; } QDir GeneratableProject::baseBuildDirectory() const { Internal::Set baseBuildDirectory; for (auto it = data.cbegin(), end = data.cend(); it != end; ++it) { QDir dir(it.value().buildDirectory()); dir.cdUp(); baseBuildDirectory.insert(dir.absolutePath()); } Q_ASSERT(baseBuildDirectory.size() == 1); return *baseBuildDirectory.begin(); } QFileInfo GeneratableProject::filePath() const { Internal::Set filePath; for (auto it = data.cbegin(), end = data.cend(); it != end; ++it) filePath.insert(it.value().location().filePath()); Q_ASSERT(filePath.size() == 1); return QFileInfo(*filePath.begin()); } bool GeneratableProject::hasMultipleConfigurations() const { return projects.size() > 1; } QStringList GeneratableProject::commandLine() const { QStringList combinedCommandLine; for (auto it = commandLines.cbegin(), end = commandLines.cend(); it != end; ++it) combinedCommandLine << it.value(); return combinedCommandLine; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/generators/generatableprojectiterator.cpp0000644000175100017510000000677415154533055025763 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "generatableprojectiterator.h" namespace qbs { GeneratableProjectIterator::GeneratableProjectIterator(GeneratableProject project) : project(std::move(project)) { } void GeneratableProjectIterator::accept(IGeneratableProjectVisitor *visitor) { visitor->visitProject(project); for (auto it = project.projects.cbegin(), end = project.projects.cend(); it != end; ++it) visitor->visitProject(it.value(), it.key()); accept(project, GeneratableProjectData(), project, visitor); } void GeneratableProjectIterator::accept(const GeneratableProject &project, const GeneratableProjectData &parentProjectData, const GeneratableProjectData &projectData, IGeneratableProjectVisitor *visitor) { visitor->visitProjectData(project, parentProjectData, projectData); visitor->visitProjectData(project, projectData); for (auto it = projectData.data.cbegin(), end = projectData.data.cend(); it != end; ++it) { visitor->visitProjectData(parentProjectData.data.value(it.key()), it.value(), it.key()); visitor->visitProjectData(it.value(), it.key()); } for (const auto &subProject : projectData.subProjects) { accept(project, projectData, subProject, visitor); } for (const auto &productDataMap : projectData.products) { visitor->visitProduct(project, projectData, productDataMap); for (auto it = productDataMap.data.cbegin(), end = productDataMap.data.cend(); it != end; ++it) { visitor->visitProduct(it.value(), it.key()); } } } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/parser/0000755000175100017510000000000015154533055016752 5ustar runnerrunnerqbs-src-3.2.0/src/lib/corelib/parser/qmlerror.cpp0000644000175100017510000001642715154533055021333 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "qmlerror.h" #include #include #include #include #include namespace QbsQmlJS { /*! \class QmlError \since 5.0 \inmodule QtQml \brief The QmlError class encapsulates a QML error. QmlError includes a textual description of the error, as well as location information (the file, line, and column). The toString() method creates a single-line, human-readable string containing all of this information, for example: \code file:///home/user/test.qml:7:8: Invalid property assignment: double expected \endcode You can use qDebug() or qWarning() to output errors to the console. This method will attempt to open the file indicated by the error and include additional contextual information. \code file:///home/user/test.qml:7:8: Invalid property assignment: double expected y: "hello" ^ \endcode Note that the QtQuick 1 version is named QDeclarativeError \sa QQuickView::errors(), QmlComponent::errors() */ class QmlErrorPrivate { public: QmlErrorPrivate(); QUrl url; QString description; int line; int column; }; QmlErrorPrivate::QmlErrorPrivate() : line(-1), column(-1) { } /*! Creates an empty error object. */ QmlError::QmlError() = default; /*! Creates a copy of \a other. */ QmlError::QmlError(const QmlError &other) { *this = other; } /*! Assigns \a other to this error object. */ QmlError &QmlError::operator=(const QmlError &other) { if (this == &other) // Self assignment guard. return *this; if (!other.d) { d = nullptr; } else { if (!d) d = qbs::Internal::makePimpl(); d->url = other.d->url; d->description = other.d->description; d->line = other.d->line; d->column = other.d->column; } return *this; } /*! \internal */ QmlError::~QmlError() = default; /*! Returns true if this error is valid, otherwise false. */ bool QmlError::isValid() const { return d != nullptr; } /*! Returns the url for the file that caused this error. */ QUrl QmlError::url() const { if (d) return d->url; return {}; } /*! Sets the \a url for the file that caused this error. */ void QmlError::setUrl(const QUrl &url) { if (!d) d = qbs::Internal::makePimpl(); d->url = url; } /*! Returns the error description. */ QString QmlError::description() const { if (d) return d->description; return {}; } /*! Sets the error \a description. */ void QmlError::setDescription(const QString &description) { if (!d) d = qbs::Internal::makePimpl(); d->description = description; } /*! Returns the error line number. */ int QmlError::line() const { if (d) return d->line; return -1; } /*! Sets the error \a line number. */ void QmlError::setLine(int line) { if (!d) qbs::Internal::makePimpl(); d->line = line; } /*! Returns the error column number. */ int QmlError::column() const { if (d) return d->column; return -1; } /*! Sets the error \a column number. */ void QmlError::setColumn(int column) { if (!d) qbs::Internal::makePimpl(); d->column = column; } /*! Returns the error as a human readable string. */ QString QmlError::toString() const { QString rv; if (url().isEmpty()) { rv = QStringLiteral(""); } else if (line() != -1) { rv = url().toString() + QLatin1Char(':') + QString::number(line()); if (column() != -1) rv += QLatin1Char(':') + QString::number(column()); } else { rv = url().toString(); } rv += QLatin1String(": ") + description(); return rv; } } // namespace QbsQmlJS QT_BEGIN_NAMESPACE using namespace QbsQmlJS; /*! \relates QmlError \fn QDebug operator<<(QDebug debug, const QmlError &error) Outputs a human readable version of \a error to \a debug. */ QDebug operator<<(QDebug debug, const QmlError &error) { debug << qPrintable(error.toString()); QUrl url = error.url(); if (error.line() > 0 && url.scheme() == QLatin1String("file")) { QString file = url.toLocalFile(); QFile f(file); if (f.open(QIODevice::ReadOnly)) { QByteArray data = f.readAll(); QTextStream stream(data, QIODevice::ReadOnly); qbs::setupDefaultCodec(stream); const QString code = stream.readAll(); const QStringList lines = code.split(QLatin1Char('\n')); if (lines.size() >= error.line()) { const QString &line = lines.at(error.line() - 1); debug << "\n " << qPrintable(line); if (error.column() > 0) { int column = std::max(0, error.column() - 1); column = std::min(column, line.length()); QByteArray ind; ind.reserve(column); for (int i = 0; i < column; ++i) { const QChar ch = line.at(i); if (ch.isSpace()) ind.append(ch.unicode()); else ind.append(' '); } ind.append('^'); debug << "\n " << ind.constData(); } } } } return debug; } QT_END_NAMESPACE qbs-src-3.2.0/src/lib/corelib/parser/qmljsastvisitor_p.h0000644000175100017510000002742115154533055022726 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 QMLJSASTVISITOR_P_H #define QMLJSASTVISITOR_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include "qmljsastfwd_p.h" #include "qmljsglobal_p.h" #include namespace QbsQmlJS { namespace AST { class QML_PARSER_EXPORT Visitor { public: Visitor(); virtual ~Visitor(); virtual bool preVisit(Node *) { return true; } virtual void postVisit(Node *) {} // Ui virtual bool visit(UiProgram *) { return true; } virtual bool visit(UiImportList *) { return true; } virtual bool visit(UiImport *) { return true; } virtual bool visit(UiPublicMember *) { return true; } virtual bool visit(UiSourceElement *) { return true; } virtual bool visit(UiObjectDefinition *) { return true; } virtual bool visit(UiObjectInitializer *) { return true; } virtual bool visit(UiObjectBinding *) { return true; } virtual bool visit(UiScriptBinding *) { return true; } virtual bool visit(UiArrayBinding *) { return true; } virtual bool visit(UiObjectMemberList *) { return true; } virtual bool visit(UiArrayMemberList *) { return true; } virtual bool visit(UiQualifiedId *) { return true; } virtual void endVisit(UiProgram *) {} virtual void endVisit(UiImportList *) {} virtual void endVisit(UiImport *) {} virtual void endVisit(UiPublicMember *) {} virtual void endVisit(UiSourceElement *) {} virtual void endVisit(UiObjectDefinition *) {} virtual void endVisit(UiObjectInitializer *) {} virtual void endVisit(UiObjectBinding *) {} virtual void endVisit(UiScriptBinding *) {} virtual void endVisit(UiArrayBinding *) {} virtual void endVisit(UiObjectMemberList *) {} virtual void endVisit(UiArrayMemberList *) {} virtual void endVisit(UiQualifiedId *) {} // QbsQmlJS virtual bool visit(ThisExpression *) { return true; } virtual void endVisit(ThisExpression *) {} virtual bool visit(IdentifierExpression *) { return true; } virtual void endVisit(IdentifierExpression *) {} virtual bool visit(NullExpression *) { return true; } virtual void endVisit(NullExpression *) {} virtual bool visit(TrueLiteral *) { return true; } virtual void endVisit(TrueLiteral *) {} virtual bool visit(FalseLiteral *) { return true; } virtual void endVisit(FalseLiteral *) {} virtual bool visit(StringLiteral *) { return true; } virtual void endVisit(StringLiteral *) {} virtual bool visit(NumericLiteral *) { return true; } virtual void endVisit(NumericLiteral *) {} virtual bool visit(RegExpLiteral *) { return true; } virtual void endVisit(RegExpLiteral *) {} virtual bool visit(ArrayLiteral *) { return true; } virtual void endVisit(ArrayLiteral *) {} virtual bool visit(ObjectLiteral *) { return true; } virtual void endVisit(ObjectLiteral *) {} virtual bool visit(ElementList *) { return true; } virtual void endVisit(ElementList *) {} virtual bool visit(Elision *) { return true; } virtual void endVisit(Elision *) {} virtual bool visit(PropertyNameAndValueList *) { return true; } virtual void endVisit(PropertyNameAndValueList *) {} virtual bool visit(NestedExpression *) { return true; } virtual void endVisit(NestedExpression *) {} virtual bool visit(IdentifierPropertyName *) { return true; } virtual void endVisit(IdentifierPropertyName *) {} virtual bool visit(StringLiteralPropertyName *) { return true; } virtual void endVisit(StringLiteralPropertyName *) {} virtual bool visit(NumericLiteralPropertyName *) { return true; } virtual void endVisit(NumericLiteralPropertyName *) {} virtual bool visit(ArrayMemberExpression *) { return true; } virtual void endVisit(ArrayMemberExpression *) {} virtual bool visit(FieldMemberExpression *) { return true; } virtual void endVisit(FieldMemberExpression *) {} virtual bool visit(NewMemberExpression *) { return true; } virtual void endVisit(NewMemberExpression *) {} virtual bool visit(NewExpression *) { return true; } virtual void endVisit(NewExpression *) {} virtual bool visit(CallExpression *) { return true; } virtual void endVisit(CallExpression *) {} virtual bool visit(ArgumentList *) { return true; } virtual void endVisit(ArgumentList *) {} virtual bool visit(PostIncrementExpression *) { return true; } virtual void endVisit(PostIncrementExpression *) {} virtual bool visit(PostDecrementExpression *) { return true; } virtual void endVisit(PostDecrementExpression *) {} virtual bool visit(DeleteExpression *) { return true; } virtual void endVisit(DeleteExpression *) {} virtual bool visit(VoidExpression *) { return true; } virtual void endVisit(VoidExpression *) {} virtual bool visit(TypeOfExpression *) { return true; } virtual void endVisit(TypeOfExpression *) {} virtual bool visit(PreIncrementExpression *) { return true; } virtual void endVisit(PreIncrementExpression *) {} virtual bool visit(PreDecrementExpression *) { return true; } virtual void endVisit(PreDecrementExpression *) {} virtual bool visit(UnaryPlusExpression *) { return true; } virtual void endVisit(UnaryPlusExpression *) {} virtual bool visit(UnaryMinusExpression *) { return true; } virtual void endVisit(UnaryMinusExpression *) {} virtual bool visit(TildeExpression *) { return true; } virtual void endVisit(TildeExpression *) {} virtual bool visit(NotExpression *) { return true; } virtual void endVisit(NotExpression *) {} virtual bool visit(BinaryExpression *) { return true; } virtual void endVisit(BinaryExpression *) {} virtual bool visit(ConditionalExpression *) { return true; } virtual void endVisit(ConditionalExpression *) {} virtual bool visit(Expression *) { return true; } virtual void endVisit(Expression *) {} virtual bool visit(Block *) { return true; } virtual void endVisit(Block *) {} virtual bool visit(StatementList *) { return true; } virtual void endVisit(StatementList *) {} virtual bool visit(VariableStatement *) { return true; } virtual void endVisit(VariableStatement *) {} virtual bool visit(VariableDeclarationList *) { return true; } virtual void endVisit(VariableDeclarationList *) {} virtual bool visit(VariableDeclaration *) { return true; } virtual void endVisit(VariableDeclaration *) {} virtual bool visit(EmptyStatement *) { return true; } virtual void endVisit(EmptyStatement *) {} virtual bool visit(ExpressionStatement *) { return true; } virtual void endVisit(ExpressionStatement *) {} virtual bool visit(IfStatement *) { return true; } virtual void endVisit(IfStatement *) {} virtual bool visit(DoWhileStatement *) { return true; } virtual void endVisit(DoWhileStatement *) {} virtual bool visit(WhileStatement *) { return true; } virtual void endVisit(WhileStatement *) {} virtual bool visit(ForStatement *) { return true; } virtual void endVisit(ForStatement *) {} virtual bool visit(LocalForStatement *) { return true; } virtual void endVisit(LocalForStatement *) {} virtual bool visit(ForEachStatement *) { return true; } virtual void endVisit(ForEachStatement *) {} virtual bool visit(LocalForEachStatement *) { return true; } virtual void endVisit(LocalForEachStatement *) {} virtual bool visit(ContinueStatement *) { return true; } virtual void endVisit(ContinueStatement *) {} virtual bool visit(BreakStatement *) { return true; } virtual void endVisit(BreakStatement *) {} virtual bool visit(ReturnStatement *) { return true; } virtual void endVisit(ReturnStatement *) {} virtual bool visit(WithStatement *) { return true; } virtual void endVisit(WithStatement *) {} virtual bool visit(SwitchStatement *) { return true; } virtual void endVisit(SwitchStatement *) {} virtual bool visit(CaseBlock *) { return true; } virtual void endVisit(CaseBlock *) {} virtual bool visit(CaseClauses *) { return true; } virtual void endVisit(CaseClauses *) {} virtual bool visit(CaseClause *) { return true; } virtual void endVisit(CaseClause *) {} virtual bool visit(DefaultClause *) { return true; } virtual void endVisit(DefaultClause *) {} virtual bool visit(LabelledStatement *) { return true; } virtual void endVisit(LabelledStatement *) {} virtual bool visit(ThrowStatement *) { return true; } virtual void endVisit(ThrowStatement *) {} virtual bool visit(TryStatement *) { return true; } virtual void endVisit(TryStatement *) {} virtual bool visit(Catch *) { return true; } virtual void endVisit(Catch *) {} virtual bool visit(Finally *) { return true; } virtual void endVisit(Finally *) {} virtual bool visit(FunctionDeclaration *) { return true; } virtual void endVisit(FunctionDeclaration *) {} virtual bool visit(FunctionExpression *) { return true; } virtual void endVisit(FunctionExpression *) {} virtual bool visit(FormalParameterList *) { return true; } virtual void endVisit(FormalParameterList *) {} virtual bool visit(FunctionBody *) { return true; } virtual void endVisit(FunctionBody *) {} virtual bool visit(Program *) { return true; } virtual void endVisit(Program *) {} virtual bool visit(SourceElements *) { return true; } virtual void endVisit(SourceElements *) {} virtual bool visit(FunctionSourceElement *) { return true; } virtual void endVisit(FunctionSourceElement *) {} virtual bool visit(StatementSourceElement *) { return true; } virtual void endVisit(StatementSourceElement *) {} virtual bool visit(DebuggerStatement *) { return true; } virtual void endVisit(DebuggerStatement *) {} }; } // namespace AST } // namespace QbsQmlJS #endif // QMLJSASTVISITOR_P_H qbs-src-3.2.0/src/lib/corelib/parser/qmljsparser.cpp0000644000175100017510000014031015154533055022020 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include #include #include #include "qmljsengine_p.h" #include "qmljslexer_p.h" #include "qmljsast_p.h" #include "qmljsmemorypool_p.h" #include "qmljsparser_p.h" #include // // This file is automatically generated from qmljs.g. // Changes will be lost. // namespace QbsQmlJS { void Parser::reallocateStack() { if (! stack_size) stack_size = 128; else stack_size <<= 1; sym_stack = reinterpret_cast (realloc(sym_stack, stack_size * sizeof(Value))); state_stack = reinterpret_cast (realloc(state_stack, stack_size * sizeof(int))); location_stack = reinterpret_cast (realloc(location_stack, stack_size * sizeof(AST::SourceLocation))); string_stack = reinterpret_cast (realloc( static_cast(string_stack), stack_size * sizeof(QStringRef))); } Parser::Parser(Engine *engine): driver(engine), pool(engine->pool()), tos(0), stack_size(0), sym_stack(nullptr), state_stack(nullptr), location_stack(nullptr), string_stack(nullptr), program(nullptr), first_token(nullptr), last_token(nullptr) { } Parser::~Parser() { if (stack_size) { free(sym_stack); free(state_stack); free(location_stack); free(string_stack); } } static inline AST::SourceLocation location(Lexer *lexer) { AST::SourceLocation loc; loc.offset = lexer->tokenOffset(); loc.length = lexer->tokenLength(); loc.startLine = lexer->tokenStartLine(); loc.startColumn = lexer->tokenStartColumn(); return loc; } AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) { QVarLengthArray nameIds; QVarLengthArray locations; AST::ExpressionNode *it = expr; while (const auto m = AST::cast(it)) { nameIds.append(m->name); locations.append(m->identifierToken); it = m->base; } if (const auto idExpr = AST::cast(it)) { const auto q = new (pool) AST::UiQualifiedId(idExpr->name); q->identifierToken = idExpr->identifierToken; AST::UiQualifiedId *currentId = q; for (int i = nameIds.size() - 1; i != -1; --i) { currentId = new (pool) AST::UiQualifiedId(currentId, nameIds[i]); currentId->identifierToken = locations[i]; } return currentId->finish(); } return nullptr; } bool Parser::parse(int startToken) { Lexer *lexer = driver->lexer(); bool hadErrors = false; int yytoken = -1; int action = 0; token_buffer[0].token = startToken; first_token = &token_buffer[0]; if (startToken == T_FEED_JS_PROGRAM) { Directives ignoreDirectives; Directives *directives = driver->directives(); if (!directives) directives = &ignoreDirectives; lexer->scanDirectives(directives); token_buffer[1].token = lexer->tokenKind(); token_buffer[1].dval = lexer->tokenValue(); token_buffer[1].loc = location(lexer); token_buffer[1].spell = lexer->tokenSpell(); last_token = &token_buffer[2]; } else { last_token = &token_buffer[1]; } tos = -1; program = nullptr; do { if (++tos == stack_size) reallocateStack(); state_stack[tos] = action; _Lcheck_token: if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) { yyprevlloc = yylloc; if (first_token == last_token) { yytoken = lexer->lex(); yylval = lexer->tokenValue(); yytokenspell = lexer->tokenSpell(); yylloc = location(lexer); } else { yytoken = first_token->token; yylval = first_token->dval; yytokenspell = first_token->spell; yylloc = first_token->loc; ++first_token; } } action = t_action(action, yytoken); if (action > 0) { if (action != ACCEPT_STATE) { yytoken = -1; sym(1).dval = yylval; stringRef(1) = yytokenspell; loc(1) = yylloc; } else { --tos; return ! hadErrors; } } else if (action < 0) { const int r = -action - 1; tos -= rhs[r]; switch (r) { case 0: { sym(1).Node = sym(2).Node; program = sym(1).Node; } break; case 1: { sym(1).Node = sym(2).Node; program = sym(1).Node; } break; case 2: { sym(1).Node = sym(2).Node; program = sym(1).Node; } break; case 3: { sym(1).Node = sym(2).Node; program = sym(1).Node; } break; case 4: { sym(1).Node = sym(2).Node; program = sym(1).Node; } break; case 5: { sym(1).Node = sym(2).Node; program = sym(1).Node; } break; case 6: { sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiImportList, sym(2).UiObjectMemberList->finish()); } break; case 8: { sym(1).Node = sym(1).UiImportList->finish(); } break; case 9: { sym(1).Node = new (pool) AST::UiImportList(sym(1).UiImport); } break; case 10: { sym(1).Node = new (pool) AST::UiImportList(sym(1).UiImportList, sym(2).UiImport); } break; case 13: { sym(1).UiImport->semicolonToken = loc(2); } break; case 15: { sym(1).UiImport->versionToken = loc(2); sym(1).UiImport->semicolonToken = loc(3); } break; case 17: { sym(1).UiImport->versionToken = loc(2); sym(1).UiImport->asToken = loc(3); sym(1).UiImport->importIdToken = loc(4); sym(1).UiImport->importId = stringRef(4); sym(1).UiImport->semicolonToken = loc(5); } break; case 19: { sym(1).UiImport->asToken = loc(2); sym(1).UiImport->importIdToken = loc(3); sym(1).UiImport->importId = stringRef(3); sym(1).UiImport->semicolonToken = loc(4); } break; case 20: { AST::UiImport *node = nullptr; if (const auto importIdLiteral = AST::cast(sym(2).Expression)) { node = new (pool) AST::UiImport(importIdLiteral->value); node->fileNameToken = loc(2); } else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) { node = new (pool) AST::UiImport(qualifiedId); node->fileNameToken = loc(2); } sym(1).Node = node; if (node) { node->importToken = loc(1); } else { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1), QStringLiteral("Expected a qualified name id or a string literal"))); return false; // ### remove me } } break; case 21: { sym(1).Node = nullptr; } break; case 22: { sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); } break; case 23: { sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); } break; case 24: { const auto node = new (pool) AST:: UiObjectMemberList( sym(1).UiObjectMemberList, sym(2).UiObjectMember); sym(1).Node = node; } break; case 25: { sym(1).Node = new (pool) AST::UiArrayMemberList(sym(1).UiObjectMember); } break; case 26: { const auto node = new (pool) AST::UiArrayMemberList( sym(1).UiArrayMemberList, sym(3).UiObjectMember); node->commaToken = loc(2); sym(1).Node = node; } break; case 27: { const auto node = new (pool) AST::UiObjectInitializer(nullptr); node->lbraceToken = loc(1); node->rbraceToken = loc(2); sym(1).Node = node; } break; case 28: { const auto node = new (pool) AST::UiObjectInitializer(sym(2).UiObjectMemberList->finish()); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; case 29: { const auto node = new (pool) AST::UiObjectDefinition(sym(1).UiQualifiedId, sym(2).UiObjectInitializer); sym(1).Node = node; } break; case 31: { const auto node = new (pool) AST::UiArrayBinding( sym(1).UiQualifiedId, sym(4).UiArrayMemberList->finish()); node->colonToken = loc(2); node->lbracketToken = loc(3); node->rbracketToken = loc(5); sym(1).Node = node; } break; case 32: { const auto node = new (pool) AST::UiObjectBinding( sym(1).UiQualifiedId, sym(3).UiQualifiedId, sym(4).UiObjectInitializer); node->colonToken = loc(2); sym(1).Node = node; } break; case 33: { const auto node = new (pool) AST::UiObjectBinding( sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer); node->colonToken = loc(2); node->hasOnToken = true; sym(1).Node = node; } break; case 41: { const auto node = new (pool) AST::UiScriptBinding( sym(1).UiQualifiedId, sym(3).Statement); node->colonToken = loc(2); sym(1).Node = node; } break; case 45: { sym(1).Node = nullptr; } break; case 46: { sym(1).Node = sym(1).UiParameterList->finish (); } break; case 47: { const auto node = new (pool) AST::UiParameterList(stringRef(1), stringRef(2)); node->propertyTypeToken = loc(1); node->identifierToken = loc(2); sym(1).Node = node; } break; case 48: { const auto node = new (pool) AST::UiParameterList(sym(1).UiParameterList, stringRef(3), stringRef(4)); node->commaToken = loc(2); node->identifierToken = loc(4); sym(1).Node = node; } break; case 50: { const auto node = new (pool) AST::UiPublicMember(QStringRef(), stringRef(2)); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); node->typeToken = loc(2); node->identifierToken = loc(2); node->parameters = sym(4).UiParameterList; node->semicolonToken = loc(6); sym(1).Node = node; } break; case 52: { const auto node = new (pool) AST::UiPublicMember(QStringRef(), stringRef(2)); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); node->typeToken = loc(2); node->identifierToken = loc(2); node->semicolonToken = loc(3); sym(1).Node = node; } break; case 54: { const auto node = new (pool) AST::UiPublicMember(stringRef(4), stringRef(6)); node->typeModifier = stringRef(2); node->propertyToken = loc(1); node->typeModifierToken = loc(2); node->typeToken = loc(4); node->identifierToken = loc(6); node->semicolonToken = loc(7); sym(1).Node = node; } break; case 56: { const auto node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3)); node->propertyToken = loc(1); node->typeToken = loc(2); node->identifierToken = loc(3); node->semicolonToken = loc(4); sym(1).Node = node; } break; case 58: { const auto node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4)); node->isDefaultMember = true; node->defaultToken = loc(1); node->propertyToken = loc(2); node->typeToken = loc(3); node->identifierToken = loc(4); node->semicolonToken = loc(5); sym(1).Node = node; } break; case 59: { const auto node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3), sym(5).Statement); node->propertyToken = loc(1); node->typeToken = loc(2); node->identifierToken = loc(3); node->colonToken = loc(4); sym(1).Node = node; } break; case 60: { const auto node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4), sym(6).Statement); node->isReadonlyMember = true; node->readonlyToken = loc(1); node->propertyToken = loc(2); node->typeToken = loc(3); node->identifierToken = loc(4); node->colonToken = loc(5); sym(1).Node = node; } break; case 61: { const auto node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4), sym(6).Statement); node->isDefaultMember = true; node->defaultToken = loc(1); node->propertyToken = loc(2); node->typeToken = loc(3); node->identifierToken = loc(4); node->colonToken = loc(5); sym(1).Node = node; } break; case 62: { const auto node = new (pool) AST::UiPublicMember(stringRef(4), stringRef(6)); node->typeModifier = stringRef(2); node->propertyToken = loc(1); node->typeModifierToken = loc(2); node->typeToken = loc(4); node->identifierToken = loc(6); node->semicolonToken = loc(7); // insert a fake ';' before ':' const auto propertyName = new (pool) AST::UiQualifiedId(stringRef(6)); propertyName->identifierToken = loc(6); propertyName->next = nullptr; const auto binding = new (pool) AST::UiArrayBinding( propertyName, sym(9).UiArrayMemberList->finish()); binding->colonToken = loc(7); binding->lbracketToken = loc(8); binding->rbracketToken = loc(10); node->binding = binding; sym(1).Node = node; } break; case 63: { const auto node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3)); node->propertyToken = loc(1); node->typeToken = loc(2); node->identifierToken = loc(3); node->semicolonToken = loc(4); // insert a fake ';' before ':' const auto propertyName = new (pool) AST::UiQualifiedId(stringRef(3)); propertyName->identifierToken = loc(3); propertyName->next = nullptr; const auto binding = new (pool) AST::UiObjectBinding( propertyName, sym(5).UiQualifiedId, sym(6).UiObjectInitializer); binding->colonToken = loc(4); node->binding = binding; sym(1).Node = node; } break; case 64: { sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); } break; case 65: { sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); } break; case 71: { const auto node = new (pool) AST::ThisExpression(); node->thisToken = loc(1); sym(1).Node = node; } break; case 72: { const auto node = new (pool) AST::IdentifierExpression(stringRef(1)); node->identifierToken = loc(1); sym(1).Node = node; } break; case 73: { const auto node = new (pool) AST::NullExpression(); node->nullToken = loc(1); sym(1).Node = node; } break; case 74: { const auto node = new (pool) AST::TrueLiteral(); node->trueToken = loc(1); sym(1).Node = node; } break; case 75: { const auto node = new (pool) AST::FalseLiteral(); node->falseToken = loc(1); sym(1).Node = node; } break; case 76: { const auto node = new (pool) AST::NumericLiteral(sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; case 77: case 78: { const auto node = new (pool) AST::StringLiteral(stringRef(1)); node->literalToken = loc(1); sym(1).Node = node; } break; case 79: { bool rx = lexer->scanRegExp(Lexer::NoPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); return false; // ### remove me } loc(1).length = lexer->tokenLength(); yylloc = loc(1); // adjust the location of the current token const auto node = new (pool) AST::RegExpLiteral( driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags()); node->literalToken = loc(1); sym(1).Node = node; } break; case 80: { bool rx = lexer->scanRegExp(Lexer::EqualPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); return false; } loc(1).length = lexer->tokenLength(); yylloc = loc(1); // adjust the location of the current token const auto node = new (pool) AST::RegExpLiteral( driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags()); node->literalToken = loc(1); sym(1).Node = node; } break; case 81: { const auto node = new (pool) AST::ArrayLiteral(static_cast(nullptr)); node->lbracketToken = loc(1); node->rbracketToken = loc(2); sym(1).Node = node; } break; case 82: { const auto node = new (pool) AST::ArrayLiteral(sym(2).Elision->finish()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; case 83: { const auto node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish ()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; case 84: { const auto node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (), nullptr); node->lbracketToken = loc(1); node->commaToken = loc(3); node->rbracketToken = loc(4); sym(1).Node = node; } break; case 85: { const auto node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (), sym(4).Elision->finish()); node->lbracketToken = loc(1); node->commaToken = loc(3); node->rbracketToken = loc(5); sym(1).Node = node; } break; case 86: { AST::ObjectLiteral *node = nullptr; if (sym(2).Node) node = new (pool) AST::ObjectLiteral( sym(2).PropertyNameAndValueList->finish ()); else node = new (pool) AST::ObjectLiteral(); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; case 87: { const auto node = new (pool) AST::ObjectLiteral( sym(2).PropertyNameAndValueList->finish ()); node->lbraceToken = loc(1); node->rbraceToken = loc(4); sym(1).Node = node; } break; case 88: { const auto node = new (pool) AST::NestedExpression(sym(2).Expression); node->lparenToken = loc(1); node->rparenToken = loc(3); sym(1).Node = node; } break; case 89: { if (const auto *mem = AST::cast(sym(1).Expression)) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken, QStringLiteral("Ignored annotation"))); sym(1).Expression = mem->base; } if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(1).Expression)) { sym(1).UiQualifiedId = qualifiedId; } else { sym(1).UiQualifiedId = nullptr; diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1), QStringLiteral("Expected a qualified name id"))); return false; // ### recover } } break; case 90: { sym(1).Node = new (pool) AST::ElementList(nullptr, sym(1).Expression); } break; case 91: { sym(1).Node = new (pool) AST::ElementList(sym(1).Elision->finish(), sym(2).Expression); } break; case 92: { const auto node = new (pool) AST::ElementList(sym(1).ElementList, nullptr, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; case 93: { const auto node = new (pool) AST::ElementList(sym(1).ElementList, sym(3).Elision->finish(), sym(4).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; case 94: { const auto node = new (pool) AST::Elision(); node->commaToken = loc(1); sym(1).Node = node; } break; case 95: { const auto node = new (pool) AST::Elision(sym(1).Elision); node->commaToken = loc(2); sym(1).Node = node; } break; case 96: { const auto node = new (pool) AST::PropertyNameAndValueList( sym(1).PropertyName, sym(3).Expression); node->colonToken = loc(2); sym(1).Node = node; } break; case 97: { const auto node = new (pool) AST::PropertyNameAndValueList( sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); node->colonToken = loc(4); sym(1).Node = node; } break; case 98: { const auto node = new (pool) AST::IdentifierPropertyName(stringRef(1)); node->propertyNameToken = loc(1); sym(1).Node = node; } break; case 99: case 100: { const auto node = new (pool) AST::IdentifierPropertyName(stringRef(1)); node->propertyNameToken = loc(1); sym(1).Node = node; } break; case 101: { const auto node = new (pool) AST::StringLiteralPropertyName(stringRef(1)); node->propertyNameToken = loc(1); sym(1).Node = node; } break; case 102: { const auto node = new (pool) AST::NumericLiteralPropertyName(sym(1).dval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; case 103: { const auto node = new (pool) AST::IdentifierPropertyName(stringRef(1)); node->propertyNameToken = loc(1); sym(1).Node = node; } break; case 139: { const auto node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; case 140: { const auto node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; case 141: { const auto node = new (pool) AST::NewMemberExpression(sym(2).Expression, sym(4).ArgumentList); node->newToken = loc(1); node->lparenToken = loc(3); node->rparenToken = loc(5); sym(1).Node = node; } break; case 143: { const auto node = new (pool) AST::NewExpression(sym(2).Expression); node->newToken = loc(1); sym(1).Node = node; } break; case 144: { const auto node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; case 145: { const auto node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; case 146: { const auto node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; case 147: { const auto node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; case 148: { sym(1).Node = nullptr; } break; case 149: { sym(1).Node = sym(1).ArgumentList->finish(); } break; case 150: { sym(1).Node = new (pool) AST::ArgumentList(sym(1).Expression); } break; case 151: { const auto node = new (pool) AST::ArgumentList(sym(1).ArgumentList, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; case 155: { const auto node = new (pool) AST::PostIncrementExpression(sym(1).Expression); node->incrementToken = loc(2); sym(1).Node = node; } break; case 156: { const auto node = new (pool) AST::PostDecrementExpression(sym(1).Expression); node->decrementToken = loc(2); sym(1).Node = node; } break; case 158: { const auto node = new (pool) AST::DeleteExpression(sym(2).Expression); node->deleteToken = loc(1); sym(1).Node = node; } break; case 159: { const auto node = new (pool) AST::VoidExpression(sym(2).Expression); node->voidToken = loc(1); sym(1).Node = node; } break; case 160: { const auto node = new (pool) AST::TypeOfExpression(sym(2).Expression); node->typeofToken = loc(1); sym(1).Node = node; } break; case 161: { const auto node = new (pool) AST::PreIncrementExpression(sym(2).Expression); node->incrementToken = loc(1); sym(1).Node = node; } break; case 162: { const auto node = new (pool) AST::PreDecrementExpression(sym(2).Expression); node->decrementToken = loc(1); sym(1).Node = node; } break; case 163: { const auto node = new (pool) AST::UnaryPlusExpression(sym(2).Expression); node->plusToken = loc(1); sym(1).Node = node; } break; case 164: { const auto node = new (pool) AST::UnaryMinusExpression(sym(2).Expression); node->minusToken = loc(1); sym(1).Node = node; } break; case 165: { const auto node = new (pool) AST::TildeExpression(sym(2).Expression); node->tildeToken = loc(1); sym(1).Node = node; } break; case 166: { const auto node = new (pool) AST::NotExpression(sym(2).Expression); node->notToken = loc(1); sym(1).Node = node; } break; case 168: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Mul, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 169: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Div, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 170: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Mod, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 172: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Add, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 173: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Sub, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 175: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::LShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 176: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::RShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 177: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::URShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 179: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 180: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 181: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 182: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 183: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 184: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::In, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 186: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 187: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 188: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 189: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 190: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 192: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 193: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 194: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 195: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 197: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 198: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 199: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 200: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 202: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 204: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 206: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 208: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 210: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 212: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 214: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 216: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 218: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 220: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 222: { const auto node = new (pool) AST::ConditionalExpression(sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); node->colonToken = loc(4); sym(1).Node = node; } break; case 224: { const auto node = new (pool) AST::ConditionalExpression(sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); node->colonToken = loc(4); sym(1).Node = node; } break; case 226: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 228: { const auto node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; case 229: { sym(1).ival = QSOperator::Assign; } break; case 230: { sym(1).ival = QSOperator::InplaceMul; } break; case 231: { sym(1).ival = QSOperator::InplaceDiv; } break; case 232: { sym(1).ival = QSOperator::InplaceMod; } break; case 233: { sym(1).ival = QSOperator::InplaceAdd; } break; case 234: { sym(1).ival = QSOperator::InplaceSub; } break; case 235: { sym(1).ival = QSOperator::InplaceLeftShift; } break; case 236: { sym(1).ival = QSOperator::InplaceRightShift; } break; case 237: { sym(1).ival = QSOperator::InplaceURightShift; } break; case 238: { sym(1).ival = QSOperator::InplaceAnd; } break; case 239: { sym(1).ival = QSOperator::InplaceXor; } break; case 240: { sym(1).ival = QSOperator::InplaceOr; } break; case 242: { const auto node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; case 243: { sym(1).Node = nullptr; } break; case 246: { const auto node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; case 247: { sym(1).Node = nullptr; } break; case 264: { const auto node = new (pool) AST::Block(sym(2).StatementList); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; case 265: { sym(1).Node = new (pool) AST::StatementList(sym(1).Statement); } break; case 266: { sym(1).Node = new (pool) AST::StatementList(sym(1).StatementList, sym(2).Statement); } break; case 267: { sym(1).Node = nullptr; } break; case 268: { sym(1).Node = sym(1).StatementList->finish (); } break; case 270: { const auto node = new (pool) AST::VariableStatement( sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); node->declarationKindToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; case 271: { sym(1).ival = T_CONST; } break; case 272: { sym(1).ival = T_VAR; } break; case 273: { sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclaration); } break; case 274: { const auto node = new (pool) AST::VariableDeclarationList( sym(1).VariableDeclarationList, sym(3).VariableDeclaration); node->commaToken = loc(2); sym(1).Node = node; } break; case 275: { sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclaration); } break; case 276: { sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclarationList, sym(3).VariableDeclaration); } break; case 277: { const auto node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; case 278: { const auto node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; case 279: { // ### TODO: AST for initializer sym(1) = sym(2); } break; case 280: { sym(1).Node = nullptr; } break; case 282: { // ### TODO: AST for initializer sym(1) = sym(2); } break; case 283: { sym(1).Node = nullptr; } break; case 285: { const auto node = new (pool) AST::EmptyStatement(); node->semicolonToken = loc(1); sym(1).Node = node; } break; case 287: { const auto node = new (pool) AST::ExpressionStatement(sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; case 288: { const auto node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement, sym(7).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); node->rparenToken = loc(4); node->elseToken = loc(6); sym(1).Node = node; } break; case 289: { const auto node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; case 291: { const auto node = new (pool) AST::DoWhileStatement(sym(2).Statement, sym(5).Expression); node->doToken = loc(1); node->whileToken = loc(3); node->lparenToken = loc(4); node->rparenToken = loc(6); node->semicolonToken = loc(7); sym(1).Node = node; } break; case 292: { const auto node = new (pool) AST::WhileStatement(sym(3).Expression, sym(5).Statement); node->whileToken = loc(1); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; case 293: { const auto node = new (pool) AST::ForStatement(sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); node->forToken = loc(1); node->lparenToken = loc(2); node->firstSemicolonToken = loc(4); node->secondSemicolonToken = loc(6); node->rparenToken = loc(8); sym(1).Node = node; } break; case 294: { const auto node = new (pool) AST::LocalForStatement( sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); node->forToken = loc(1); node->lparenToken = loc(2); node->varToken = loc(3); node->firstSemicolonToken = loc(5); node->secondSemicolonToken = loc(7); node->rparenToken = loc(9); sym(1).Node = node; } break; case 295: { const auto node = new (pool) AST::ForEachStatement(sym(3).Expression, sym(5).Expression, sym(7).Statement); node->forToken = loc(1); node->lparenToken = loc(2); node->inToken = loc(4); node->rparenToken = loc(6); sym(1).Node = node; } break; case 296: { const auto node = new (pool) AST::LocalForEachStatement( sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); node->forToken = loc(1); node->lparenToken = loc(2); node->varToken = loc(3); node->inToken = loc(5); node->rparenToken = loc(7); sym(1).Node = node; } break; case 298: { const auto node = new (pool) AST::ContinueStatement(); node->continueToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; case 300: { const auto node = new (pool) AST::ContinueStatement(stringRef(2)); node->continueToken = loc(1); node->identifierToken = loc(2); node->semicolonToken = loc(3); sym(1).Node = node; } break; case 302: { const auto node = new (pool) AST::BreakStatement(QStringRef()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; case 304: { const auto node = new (pool) AST::BreakStatement(stringRef(2)); node->breakToken = loc(1); node->identifierToken = loc(2); node->semicolonToken = loc(3); sym(1).Node = node; } break; case 306: { const auto node = new (pool) AST::ReturnStatement(sym(2).Expression); node->returnToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; case 307: { const auto node = new (pool) AST::WithStatement(sym(3).Expression, sym(5).Statement); node->withToken = loc(1); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; case 308: { const auto node = new (pool) AST::SwitchStatement(sym(3).Expression, sym(5).CaseBlock); node->switchToken = loc(1); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; case 309: { const auto node = new (pool) AST::CaseBlock(sym(2).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; case 310: { const auto node = new (pool) AST::CaseBlock(sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(5); sym(1).Node = node; } break; case 311: { sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClause); } break; case 312: { sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClauses, sym(2).CaseClause); } break; case 313: { sym(1).Node = nullptr; } break; case 314: { sym(1).Node = sym(1).CaseClauses->finish (); } break; case 315: { const auto node = new (pool) AST::CaseClause(sym(2).Expression, sym(4).StatementList); node->caseToken = loc(1); node->colonToken = loc(3); sym(1).Node = node; } break; case 316: { const auto node = new (pool) AST::DefaultClause(sym(3).StatementList); node->defaultToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; case 317: case 318: { const auto node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; case 319: { const auto node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; case 321: { const auto node = new (pool) AST::ThrowStatement(sym(2).Expression); node->throwToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; case 322: { const auto node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch); node->tryToken = loc(1); sym(1).Node = node; } break; case 323: { const auto node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; case 324: { const auto node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch, sym(4).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; case 325: { const auto node = new (pool) AST::Catch(stringRef(3), sym(5).Block); node->catchToken = loc(1); node->lparenToken = loc(2); node->identifierToken = loc(3); node->rparenToken = loc(4); sym(1).Node = node; } break; case 326: { const auto node = new (pool) AST::Finally(sym(2).Block); node->finallyToken = loc(1); sym(1).Node = node; } break; case 328: { const auto node = new (pool) AST::DebuggerStatement(); node->debuggerToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; case 329: { const auto node = new (pool) AST::FunctionDeclaration(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); node->identifierToken = loc(2); node->lparenToken = loc(3); node->rparenToken = loc(5); node->lbraceToken = loc(6); node->rbraceToken = loc(8); sym(1).Node = node; } break; case 330: { const auto node = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); if (! stringRef(2).isNull()) node->identifierToken = loc(2); node->lparenToken = loc(3); node->rparenToken = loc(5); node->lbraceToken = loc(6); node->rbraceToken = loc(8); sym(1).Node = node; } break; case 331: { const auto node = new (pool) AST::FormalParameterList(stringRef(1)); node->identifierToken = loc(1); sym(1).Node = node; } break; case 332: { const auto node = new (pool) AST::FormalParameterList(sym(1).FormalParameterList, stringRef(3)); node->commaToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; case 333: { sym(1).Node = nullptr; } break; case 334: { sym(1).Node = sym(1).FormalParameterList->finish (); } break; case 335: { sym(1).Node = nullptr; } break; case 337: { sym(1).Node = new (pool) AST::FunctionBody(sym(1).SourceElements->finish ()); } break; case 339: { sym(1).Node = new (pool) AST::Program(sym(1).SourceElements->finish ()); } break; case 340: { sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElement); } break; case 341: { sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElements, sym(2).SourceElement); } break; case 342: { sym(1).Node = new (pool) AST::StatementSourceElement(sym(1).Statement); } break; case 343: { sym(1).Node = new (pool) AST::FunctionSourceElement(sym(1).FunctionDeclaration); } break; case 344: { stringRef(1) = QStringRef(); } break; case 346: { sym(1).Node = nullptr; } break; } // switch action = nt_action(state_stack[tos], lhs[r] - TERMINAL_COUNT); } // if } while (action != 0); if (first_token == last_token) { const int errorState = state_stack[tos]; // automatic insertion of `;' if (yytoken != -1 && t_action(errorState, T_AUTOMATIC_SEMICOLON) && lexer->canInsertAutomaticSemicolon(yytoken)) { SavedToken &tk = token_buffer[0]; tk.token = yytoken; tk.dval = yylval; tk.spell = yytokenspell; tk.loc = yylloc; yylloc = yyprevlloc; yylloc.offset += yylloc.length; yylloc.startColumn += yylloc.length; yylloc.length = 0; //const QString msg = qApp->translate("QmlParser", "Missing `;'"); //diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg)); first_token = &token_buffer[0]; last_token = &token_buffer[1]; yytoken = T_SEMICOLON; yylval = 0; action = errorState; goto _Lcheck_token; } hadErrors = true; token_buffer[0].token = yytoken; token_buffer[0].dval = yylval; token_buffer[0].spell = yytokenspell; token_buffer[0].loc = yylloc; token_buffer[1].token = yytoken = lexer->lex(); token_buffer[1].dval = yylval = lexer->tokenValue(); token_buffer[1].spell = yytokenspell = lexer->tokenSpell(); token_buffer[1].loc = yylloc = location(lexer); if (t_action(errorState, yytoken)) { QString msg; int token = token_buffer[0].token; if (token < 0 || token >= TERMINAL_COUNT) msg = qApp->translate("QmlParser", "Syntax error"); else msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); action = errorState; goto _Lcheck_token; } static int tokens[] = { T_PLUS, T_EQ, T_COMMA, T_COLON, T_SEMICOLON, T_RPAREN, T_RBRACKET, T_RBRACE, T_NUMERIC_LITERAL, T_IDENTIFIER, T_LPAREN, T_LBRACKET, T_LBRACE, EOF_SYMBOL }; for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) { int a = t_action(errorState, *tk); if (a > 0 && t_action(a, yytoken)) { const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); yytoken = *tk; yylval = 0; yylloc = token_buffer[0].loc; yylloc.length = 0; first_token = &token_buffer[0]; last_token = &token_buffer[2]; action = errorState; goto _Lcheck_token; } } for (int tk = 1; tk < TERMINAL_COUNT; ++tk) { if (tk == T_AUTOMATIC_SEMICOLON || tk == T_FEED_UI_PROGRAM || tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION || tk == T_FEED_JS_SOURCE_ELEMENT) continue; int a = t_action(errorState, tk); if (a > 0 && t_action(a, yytoken)) { const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); yytoken = tk; yylval = 0; yylloc = token_buffer[0].loc; yylloc.length = 0; action = errorState; goto _Lcheck_token; } } const QString msg = qApp->translate("QmlParser", "Syntax error"); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); } return false; } } // namespace QbsQmlJS qbs-src-3.2.0/src/lib/corelib/parser/qmljsgrammar.cpp0000644000175100017510000013031115154533055022152 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ // This file was generated by qlalr - DO NOT EDIT! #include "qmljsgrammar_p.h" namespace QbsQmlJS { const char *const QmlJSGrammar::spell [] = { "end of file", "&", "&&", "&=", "break", "case", "catch", ":", ",", "continue", "default", "delete", "/", "/=", "do", ".", "else", "=", "==", "===", "finally", "for", "function", ">=", ">", ">>", ">>=", ">>>", ">>>=", "identifier", "if", "in", "instanceof", "{", "[", "<=", "(", "<", "<<", "<<=", "-", "-=", "--", "new", "!", "!=", "!==", "numeric literal", "|", "|=", "||", "+", "+=", "++", "?", "}", "]", "%", "%=", "return", ")", ";", 0, "*", "*=", "string literal", "property", "signal", "readonly", "switch", "this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^", "^=", "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "comment", "public", "import", "as", "on", 0, 0, 0, 0, 0, 0, 0, 0, 0 }; const short QmlJSGrammar::lhs [] = { 102, 102, 102, 102, 102, 102, 103, 109, 109, 112, 112, 114, 113, 113, 113, 113, 113, 113, 113, 113, 116, 111, 110, 119, 119, 120, 120, 121, 121, 118, 107, 107, 107, 107, 123, 123, 123, 123, 123, 123, 123, 107, 131, 131, 131, 132, 132, 133, 133, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 117, 117, 117, 117, 117, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 122, 138, 138, 138, 138, 137, 137, 140, 140, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 144, 144, 115, 115, 115, 115, 115, 147, 147, 148, 148, 148, 148, 146, 146, 149, 149, 150, 150, 151, 151, 151, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 153, 153, 153, 153, 154, 154, 154, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, 160, 160, 161, 161, 162, 162, 163, 163, 164, 164, 165, 165, 166, 166, 167, 167, 168, 168, 169, 169, 170, 170, 171, 171, 141, 141, 172, 172, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 105, 105, 174, 174, 175, 175, 176, 176, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 124, 185, 185, 184, 184, 135, 135, 186, 186, 187, 187, 189, 189, 188, 190, 193, 191, 191, 194, 192, 192, 125, 126, 126, 127, 127, 177, 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, 179, 179, 179, 179, 180, 180, 128, 129, 195, 195, 198, 198, 196, 196, 199, 197, 181, 181, 181, 182, 182, 130, 130, 130, 200, 201, 183, 183, 134, 145, 205, 205, 202, 202, 203, 203, 206, 108, 108, 207, 207, 106, 106, 204, 204, 139, 139, 208 }; const short QmlJSGrammar::rhs [] = {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2, 1, 1, 0, 1, 0, 1, 2 }; const short QmlJSGrammar::action_default [] = { 0, 0, 22, 0, 0, 0, 22, 0, 175, 242, 206, 214, 210, 154, 226, 202, 3, 139, 73, 155, 218, 222, 143, 172, 153, 158, 138, 192, 179, 0, 80, 81, 76, 345, 67, 347, 0, 0, 0, 0, 78, 0, 0, 74, 77, 71, 0, 0, 68, 70, 69, 79, 72, 0, 75, 0, 0, 168, 0, 0, 155, 174, 157, 156, 0, 0, 0, 170, 171, 169, 173, 0, 203, 0, 0, 0, 0, 193, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 177, 178, 176, 181, 185, 184, 182, 180, 195, 194, 196, 0, 211, 0, 207, 0, 0, 149, 136, 148, 137, 105, 106, 107, 132, 108, 133, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 134, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 135, 0, 0, 147, 243, 150, 0, 151, 0, 152, 146, 0, 239, 232, 230, 237, 238, 236, 235, 241, 234, 233, 231, 240, 227, 0, 215, 0, 0, 219, 0, 0, 223, 0, 0, 149, 141, 0, 140, 0, 145, 159, 0, 346, 334, 335, 0, 332, 0, 333, 0, 336, 250, 257, 256, 264, 252, 0, 253, 337, 0, 344, 254, 255, 260, 258, 341, 338, 343, 261, 0, 272, 0, 0, 0, 0, 345, 67, 0, 347, 68, 244, 286, 69, 0, 0, 0, 273, 0, 0, 262, 263, 0, 251, 259, 287, 288, 331, 342, 0, 302, 303, 304, 305, 0, 298, 299, 300, 301, 328, 329, 0, 0, 0, 0, 0, 291, 292, 248, 246, 208, 216, 212, 228, 204, 249, 0, 155, 220, 224, 197, 186, 0, 0, 205, 0, 0, 0, 0, 198, 0, 0, 0, 0, 0, 190, 188, 191, 189, 187, 200, 199, 201, 0, 213, 0, 209, 0, 247, 155, 0, 229, 244, 245, 0, 244, 0, 0, 294, 0, 0, 0, 296, 0, 217, 0, 0, 221, 0, 0, 225, 284, 0, 276, 285, 279, 0, 283, 0, 244, 277, 0, 244, 0, 0, 295, 0, 0, 0, 297, 346, 334, 0, 0, 336, 0, 330, 0, 320, 0, 0, 0, 290, 0, 289, 0, 348, 0, 104, 266, 269, 0, 105, 272, 108, 133, 110, 111, 76, 115, 116, 67, 117, 120, 74, 77, 68, 244, 69, 79, 123, 72, 125, 75, 127, 128, 273, 130, 131, 135, 0, 97, 0, 0, 99, 103, 101, 88, 100, 102, 0, 98, 87, 267, 265, 143, 144, 149, 0, 142, 0, 319, 0, 306, 307, 0, 318, 0, 0, 0, 309, 314, 312, 315, 0, 0, 313, 314, 0, 310, 0, 311, 268, 317, 0, 268, 316, 0, 321, 322, 0, 268, 323, 324, 0, 0, 325, 0, 0, 0, 326, 327, 161, 160, 0, 0, 0, 293, 0, 0, 0, 308, 281, 274, 0, 282, 278, 0, 280, 270, 0, 271, 275, 91, 0, 0, 95, 82, 0, 84, 93, 0, 85, 94, 96, 86, 92, 83, 0, 89, 165, 163, 167, 164, 162, 166, 339, 6, 340, 4, 2, 65, 90, 0, 0, 68, 70, 69, 31, 5, 0, 66, 0, 45, 44, 43, 0, 0, 58, 0, 59, 35, 36, 37, 38, 40, 41, 62, 39, 0, 45, 0, 0, 0, 0, 0, 54, 0, 55, 0, 0, 26, 0, 0, 63, 27, 0, 30, 28, 24, 0, 29, 25, 0, 56, 0, 57, 143, 0, 60, 64, 0, 0, 0, 0, 61, 0, 52, 46, 53, 47, 0, 0, 0, 0, 49, 0, 50, 51, 48, 0, 0, 143, 268, 0, 0, 42, 105, 272, 108, 133, 110, 111, 76, 115, 116, 67, 117, 120, 74, 77, 68, 244, 69, 79, 123, 72, 125, 75, 127, 128, 273, 130, 131, 135, 0, 32, 33, 0, 34, 8, 0, 10, 0, 9, 0, 1, 21, 12, 0, 13, 0, 14, 0, 19, 20, 0, 15, 16, 0, 17, 18, 11, 23, 7, 349 }; const short QmlJSGrammar::goto_default [] = { 7, 625, 207, 196, 205, 508, 496, 624, 643, 495, 623, 621, 626, 22, 622, 18, 507, 549, 539, 546, 541, 526, 191, 195, 197, 201, 233, 208, 230, 530, 570, 569, 200, 232, 26, 474, 473, 356, 355, 9, 354, 357, 107, 17, 145, 24, 13, 144, 19, 25, 57, 23, 8, 28, 27, 269, 15, 263, 10, 259, 12, 261, 11, 260, 20, 267, 21, 268, 14, 262, 258, 299, 411, 264, 265, 202, 193, 192, 204, 203, 229, 194, 360, 359, 231, 463, 462, 321, 322, 465, 324, 464, 323, 419, 423, 426, 422, 421, 441, 442, 185, 199, 181, 184, 198, 206, 0 }; const short QmlJSGrammar::action_index [] = { 360, 1257, 2491, 2491, 2393, 982, 78, 84, 145, -102, 81, 64, 68, 210, -102, 306, 54, -102, -102, 620, 59, 128, 268, 244, -102, -102, -102, 521, 205, 1257, -102, -102, -102, 442, -102, 2197, 1819, 1257, 1257, 1257, -102, 682, 1257, -102, -102, -102, 1257, 1257, -102, -102, -102, -102, -102, 1257, -102, 1257, 1257, -102, 1257, 1257, 95, 188, -102, -102, 1257, 1257, 1257, -102, -102, -102, 191, 1257, 313, 1257, 1257, 1257, 1257, 521, 1257, 1257, 1257, 1257, 1257, 1257, 196, 1257, 1257, 1257, 151, 146, 116, 167, 174, 182, 186, 189, 521, 429, 521, 1257, 45, 1257, 41, 2099, 1257, 1257, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, 125, 1257, -102, -102, 58, 46, -102, 1257, -102, -102, 1257, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, 1257, 17, 1257, 1257, 75, 71, 1257, -102, 2099, 1257, 1257, -102, 154, -102, 51, -102, -102, 55, -102, 288, 72, 57, -102, 297, -102, 62, 2491, -102, -102, -102, -102, -102, 232, -102, -102, 60, -102, -102, -102, -102, -102, -102, 2491, -102, -102, 458, -102, 470, 89, 2393, 49, 442, 69, 47, 2687, 65, 1257, -102, 61, 43, 1257, 40, -102, 39, 82, -102, -102, 442, -102, -102, -102, -102, -102, -102, 102, -102, -102, -102, -102, 98, -102, -102, -102, -102, -102, -102, 76, 63, 1257, 92, 93, -102, -102, 1348, -102, 88, 66, 48, -102, 304, 80, 77, 560, 187, 86, 400, 271, 442, 1257, 302, 1257, 1257, 1257, 1257, 407, 1257, 1257, 1257, 1257, 1257, 253, 257, 272, 281, 278, 362, 358, 337, 1257, 48, 1257, 73, 1257, -102, 620, 1257, -102, 1257, 56, 44, 1257, 42, 2393, -102, 1257, 117, 2393, -102, 1257, 38, 1257, 1257, 187, 74, 1257, -102, 70, 118, 22, -102, -102, 1257, -102, 442, 1257, -102, 67, 1257, 79, 2393, -102, 1257, 112, 2393, -102, -25, 442, -48, -20, 2491, -41, -102, 2393, -102, 1257, 113, 2393, 2, 2393, -102, 3, 11, -34, -102, -102, 2393, -30, 504, 19, 450, 114, 1257, 2393, 20, -16, 414, -1, -31, 772, -3, -4, -102, 1443, -102, 87, -35, -5, 1257, 0, 30, 1257, 33, 1257, 14, 15, 1257, -102, 2295, 1, -102, -102, -102, -102, -102, -102, 1257, -102, -102, -102, -102, 226, -102, 1257, -6, -102, 2393, -102, 96, -102, -102, 2393, -102, 1257, 101, 36, -102, 53, -102, 29, 91, 1257, -102, 24, 23, -102, -24, -102, 2393, -102, 100, 2393, -102, 250, -102, -102, 90, 2393, 16, -102, 10, 12, -102, 442, -12, 4, -102, -102, -102, -102, 1257, 111, 2393, -102, 1257, 105, 2393, -102, 6, -102, 214, -102, -102, 1257, -102, -102, 354, -102, -102, -102, 85, 1537, -102, -102, 1631, -102, -102, 1725, -102, -102, -102, -102, -102, -102, 135, -102, -102, -102, -102, -102, -102, -102, -102, -102, 2491, -102, -102, -102, 159, -10, 890, 202, -11, 18, -102, -102, 222, -102, 199, -102, -102, -102, 359, 211, -102, 1910, -102, -102, -102, -102, -102, -102, -102, -102, -102, 183, -13, 349, 175, -2, 344, 282, -102, -17, -102, 800, 124, -102, -18, 890, -102, -102, 1074, -102, -102, -102, 1166, -102, -102, 208, -102, 1910, -102, 369, -18, -102, -102, 204, 341, 9, 1910, -102, 203, -102, 177, -102, -8, -51, 309, 206, 442, -102, 83, -102, -102, -102, 2001, 800, 369, 2589, 1819, 34, -102, 436, 25, 493, 108, 1257, 2393, 26, 7, 409, 28, 8, 598, 32, 31, -102, 1443, -102, 87, 5, 21, 1257, 52, 37, 1257, 50, 1257, 35, 13, 134, -102, -102, 27, -102, -102, 710, -102, 266, -38, 890, -102, -102, 115, 300, -102, 176, -102, 122, -102, -102, 442, -102, -102, 126, -102, -102, -102, -102, -102, -102, -107, -3, -98, 4, 7, 280, 3, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -35, -107, -107, -107, -107, -107, -107, -107, -107, -107, 78, -107, -107, -107, 20, -107, -107, -22, 15, 86, 72, -107, 193, 175, -107, -107, -107, 174, 170, -107, -107, -107, -107, -107, 118, -107, 144, 145, -107, 127, 156, -107, -107, -107, -107, 162, 165, 166, -107, -107, -107, -107, 149, -107, 137, 136, 135, 134, -107, 181, 180, 179, 173, 53, 117, -107, 81, 95, 90, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, 103, -107, 101, -107, 194, 92, 58, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, 32, -107, -107, -107, -107, -107, 16, -107, -107, 49, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, 70, -107, 109, 34, -107, -107, 45, -107, 216, 60, 100, -107, -107, -107, -107, -107, -107, -107, -107, 44, -107, -107, -107, 47, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, 48, -107, -107, 35, -107, 39, -107, 56, -107, 79, -107, -107, 83, -107, 76, -107, -107, -107, 89, 69, -107, -107, -107, -107, -107, -2, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, 19, -107, -107, -107, -107, 105, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -13, 195, -107, 218, 212, 215, 228, -107, 114, 87, 121, 124, 107, -107, -107, -107, -107, -107, -107, -107, -107, 198, -107, 221, -107, 236, -107, -107, 237, -107, 128, -107, -107, 184, -107, 36, -107, 24, -107, 102, -107, 192, -107, 234, 238, -107, -107, 224, -107, -107, -107, -107, -107, -107, 191, -107, 93, 99, -107, -107, 108, -107, 88, -107, 84, -107, 91, -107, -107, 141, -107, -107, -23, -107, -107, 59, -107, 57, -107, 55, -107, 54, -107, -107, -107, -107, -107, -107, 46, -107, 31, -107, 30, -107, 169, 37, -107, -107, 68, -107, -107, 85, -107, -107, -107, 73, -107, -107, -107, -107, 66, -107, 52, 98, -107, 104, -107, -107, 43, -107, 40, -107, -107, -107, -107, -107, -107, -107, 42, -107, -107, -107, -107, -107, -107, 106, -107, -107, 62, -107, -107, -107, -107, 63, -107, 65, -107, -107, -107, -107, -107, -30, -107, 67, -107, -19, -107, -107, -107, -107, 94, -107, -107, 97, -107, -107, -107, -107, -107, 75, -50, -107, -107, 25, -107, 28, -107, 29, -107, -107, -107, -107, 41, -107, 64, -107, 38, -107, 51, -107, -107, -107, -107, -107, -107, 33, -107, -107, 122, -107, -107, -107, -107, 61, -107, -107, 163, -107, -107, 50, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, 82, -107, -107, -107, -107, -107, -12, -107, -107, -107, -107, -107, -107, -107, -15, -107, -107, -107, -5, -107, -107, 297, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -9, -26, -107, -11, -107, -107, -107, -107, 183, -107, -107, -107, 288, -107, -107, 283, -107, -107, -107, 390, -107, -107, -107, -107, 321, -107, -107, -8, -107, -107, 11, 18, -107, 305, -107, -107, -107, 1, -107, -107, -107, 14, -4, 0, -107, -107, -107, -107, -107, 337, 217, -107, 22, 279, 9, -107, 8, -107, 6, -107, 153, 17, -107, -107, 5, -107, -107, 96, -107, -107, -107, 13, -107, -107, -107, -107, 23, -107, 10, 77, -107, 71, -107, -107, -107, -107, -107, 12, -107, -107, 21, -107, -107, 26, 148, -107, -107, -107, 27, -107, -107, -107, -107, -107, -107, -10, -107, -107, -107, -107, -107, -107, -107, -107, -107 }; const short QmlJSGrammar::action_info [] = { 572, 416, -124, -103, -121, 348, 346, -126, 399, 575, 389, 340, 342, 343, 345, 545, 563, 538, 352, 391, 257, 401, 533, 466, 531, 403, -132, -113, -124, 424, 431, 430, -132, -113, 424, 346, 444, 440, -103, -121, -129, 416, 71, 257, 348, 440, 446, 565, 448, 457, 453, 457, 620, 335, 408, 560, 511, -129, 424, -126, 545, 164, 141, 440, 141, 99, 147, 545, 414, 420, 440, 453, 409, 440, 272, 453, 346, 164, 170, 416, 187, 318, 71, 348, 644, 257, 292, 325, 296, 272, 0, 183, 0, 477, -102, 190, 443, 0, 0, 252, 141, 427, 306, 0, 0, 304, 149, 434, 141, 141, 444, 179, 99, 141, 292, 236, 0, 189, 457, 141, 141, 141, 0, 0, 101, 141, 327, 294, 331, 0, 172, 0, 542, 141, 0, 0, 314, 62, 301, 333, 315, 478, 542, 141, 577, 576, 428, 101, 63, 173, 249, 248, 254, 251, 256, 255, 58, 413, 412, 247, 246, 418, 141, 242, 241, 459, 0, 59, 620, 249, 248, 455, 337, 350, 172, 249, 248, 310, 166, 328, 543, 142, 167, 634, 633, 58, 58, 640, 639, 312, 615, 58, 85, 173, 86, 488, 59, 59, 172, 85, 64, 86, 59, 64, 512, 87, 512, 85, 0, 86, 177, 85, 87, 86, 85, 554, 86, 173, 518, 406, 87, 85, 469, 86, 87, 103, 0, 87, 512, 579, 85, 529, 86, 512, 87, 512, 0, 637, 636, 567, 141, 172, 0, 87, 104, 65, 105, 0, 65, 0, 514, 66, 514, 0, 66, 545, 64, 0, 141, 0, 173, 513, 406, 513, 568, 566, 0, 635, 0, 555, 553, 0, 519, 517, 514, 470, 468, 514, 85, 514, 86, 514, 85, 172, 86, 513, 0, 0, 513, 536, 513, 87, 513, 235, 234, 87, 85, 85, 86, 86, 0, 65, 173, 85, 174, 86, 85, 66, 86, 87, 87, 438, 437, 630, 580, 0, 87, 34, 0, 87, 274, 275, 274, 275, 73, 74, 34, 631, 629, 34, 0, 73, 74, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 537, 535, 0, 0, 276, 277, 276, 277, 75, 76, 0, 48, 50, 49, 628, 75, 76, 279, 280, 0, 48, 50, 49, 48, 50, 49, 281, 34, 0, 282, 34, 283, 48, 50, 49, 34, 0, 45, 279, 280, 34, 172, 279, 280, 0, 34, 45, 281, 0, 45, 282, 281, 283, 0, 282, 0, 283, 0, 45, -90, 173, 0, 174, 0, 48, 50, 49, 48, 50, 49, 0, 0, 48, 50, 49, 0, 0, 48, 50, 49, 279, 280, 48, 50, 49, 0, 0, 279, 280, 281, 45, 0, 282, 45, 283, 34, 281, 0, 45, 282, 34, 283, -345, 45, 0, 0, 0, -345, 45, 78, 79, 6, 5, 4, 1, 3, 2, 80, 81, 0, 0, 82, 34, 83, 0, 0, 0, 0, 34, 0, 0, 0, 48, 50, 49, 0, 34, 48, 50, 49, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 239, 34, 0, 45, 48, 50, 49, 0, 45, 0, 48, 50, 49, 245, 244, 0, 0, 0, 48, 50, 49, 240, 239, 0, 34, 0, 48, 50, 49, 0, 45, 0, 0, 245, 244, 34, 45, 0, 48, 50, 49, 0, 0, 0, 45, 0, 78, 79, 0, 0, 0, 0, 45, 0, 80, 81, 245, 244, 82, 0, 83, 48, 50, 49, 45, 151, 0, 240, 239, 0, 0, 0, 48, 50, 49, 152, 0, 0, 0, 153, 0, 0, 0, 0, 0, 0, 0, 45, 154, 0, 155, 0, 0, 308, 0, 0, 0, 0, 45, 0, 0, 156, 0, 157, 62, 0, 0, 0, 0, 0, 0, 158, 30, 31, 159, 63, 0, 0, 0, 0, 160, 0, 33, 0, 0, 151, 161, 0, 0, 34, 0, 0, 0, 35, 36, 152, 37, 0, 0, 153, 0, 0, 162, 41, 0, 0, 0, 44, 154, 0, 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 157, 62, 51, 48, 50, 49, 0, 52, 158, 0, 0, 159, 63, 0, 0, 0, 0, 160, 43, 54, 32, 0, 0, 161, 40, 0, 0, 0, 0, 45, 0, 0, 0, 30, 31, 0, 0, 0, 0, 162, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 30, 31, 0, 41, 0, 0, 0, 44, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 51, 48, 50, 49, 0, 52, 503, 0, 0, 0, 44, 0, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 51, 48, 50, 49, 0, 52, 0, 0, 0, 30, 31, 0, 0, 0, 0, 0, 43, 54, 32, 33, 0, 0, 40, 0, 0, 0, 34, 45, 0, 0, 35, 36, 0, 37, 0, 0, 0, 30, 31, 0, 41, 0, 0, 0, 44, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 51, 48, 50, 49, 0, 52, 503, 0, 0, 0, 44, 0, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 51, 48, 50, 49, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, 503, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, 50, 49, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 502, 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 215, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, 503, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 504, 506, 505, 0, 52, 0, 0, 0, 0, 226, 0, 0, 0, 0, 0, 43, 54, 32, 210, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 502, 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 215, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, 503, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 547, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 504, 506, 505, 0, 52, 0, 0, 0, 0, 226, 0, 0, 0, 0, 0, 43, 54, 32, 210, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 502, 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 215, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, 503, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 550, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 504, 506, 505, 0, 52, 0, 0, 0, 0, 226, 0, 0, 0, 0, 0, 43, 54, 32, 210, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, 50, 49, 0, 52, 0, 53, 0, 55, 0, 56, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, 50, 49, 0, 52, 0, 53, 0, 55, 271, 56, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, -122, 0, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, 50, 49, 0, 52, 0, 53, 0, 55, 0, 56, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 483, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, 486, 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, 50, 49, 0, 52, 0, 53, 0, 55, 0, 56, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 475, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, 481, 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, 50, 49, 0, 52, 0, 53, 0, 55, 0, 56, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 483, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, 484, 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, 50, 49, 0, 52, 0, 53, 0, 55, 0, 56, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 475, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, 476, 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, 50, 49, 0, 52, 0, 53, 0, 55, 0, 56, 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 217, 0, 0, 218, 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, 0, 0, 0, 0, 0, 221, 0, 0, 0, 51, 48, 50, 49, 223, 52, 0, 53, 225, 55, 0, 56, 0, 228, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 217, 0, 0, 582, 583, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, 0, 0, 0, 0, 0, 221, 0, 0, 0, 51, 48, 50, 49, 223, 52, 0, 53, 225, 55, 0, 56, 0, 228, 0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 110, 111, 0, 0, 113, 115, 116, 0, 0, 117, 0, 118, 0, 0, 0, 120, 121, 122, 0, 0, 0, 0, 0, 0, 34, 123, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 0, 0, 0, 0, 0, 0, 48, 50, 49, 130, 131, 132, 0, 134, 135, 136, 137, 138, 139, 0, 0, 127, 133, 119, 112, 114, 128, 0, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 110, 111, 0, 0, 113, 115, 116, 0, 0, 117, 0, 118, 0, 0, 0, 120, 121, 122, 0, 0, 0, 0, 0, 0, 393, 123, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, 0, 0, 394, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 0, 0, 0, 0, 0, 398, 395, 397, 0, 130, 131, 132, 0, 134, 135, 136, 137, 138, 139, 0, 0, 127, 133, 119, 112, 114, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 110, 111, 0, 0, 113, 115, 116, 0, 0, 117, 0, 118, 0, 0, 0, 120, 121, 122, 0, 0, 0, 0, 0, 0, 393, 123, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, 0, 0, 394, 0, 0, 0, 0, 0, 0, 0, 396, 0, 0, 0, 129, 0, 0, 0, 0, 0, 398, 395, 397, 0, 130, 131, 132, 0, 134, 135, 136, 137, 138, 139, 0, 0, 127, 133, 119, 112, 114, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 209, 0, 0, 0, 0, 211, 0, 29, 30, 31, 213, 0, 0, 0, 0, 0, 0, 214, 33, 0, 0, 0, 0, 0, 0, 216, 217, 0, 0, 218, 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, 0, 0, 0, 220, 0, 221, 0, 0, 0, 51, 219, 222, 49, 223, 52, 224, 53, 225, 55, 226, 56, 227, 228, 0, 0, 43, 54, 32, 210, 212, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 209, 0, 0, 0, 0, 211, 0, 29, 30, 31, 213, 0, 0, 0, 0, 0, 0, 214, 215, 0, 0, 0, 0, 0, 0, 216, 217, 0, 0, 218, 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, 0, 0, 0, 220, 0, 221, 0, 0, 0, 51, 219, 222, 49, 223, 52, 224, 53, 225, 55, 226, 56, 227, 228, 0, 0, 43, 54, 32, 210, 212, 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 586, 110, 111, 0, 0, 588, 115, 590, 30, 31, 591, 0, 118, 0, 0, 0, 120, 593, 594, 0, 0, 0, 0, 0, 0, 595, 596, 124, 125, 218, 36, 0, 37, 0, 0, 0, 38, 0, 39, 597, 42, 0, 0, 599, 0, 0, 0, 46, 0, 47, 0, 0, 0, 0, 0, 601, 0, 221, 0, 0, 0, 603, 600, 602, 49, 604, 605, 606, 53, 608, 609, 610, 611, 612, 613, 0, 0, 598, 607, 592, 587, 589, 128, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 361, 110, 111, 0, 0, 363, 115, 365, 30, 31, 366, 0, 118, 0, 0, 0, 120, 368, 369, 0, 0, 0, 0, 0, 0, 370, 371, 124, 125, 218, 36, 0, 37, 0, 0, 0, 38, 0, 39, 372, 42, 0, 0, 374, 0, 0, 0, 46, 0, 47, 0, -268, 0, 0, 0, 376, 0, 221, 0, 0, 0, 378, 375, 377, 49, 379, 380, 381, 53, 383, 384, 385, 386, 387, 388, 0, 0, 373, 382, 367, 362, 364, 128, 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 528, 320, 532, 534, 638, 552, 497, 498, 499, 516, 559, 619, 461, 515, 574, 302, 472, 487, 250, 182, 243, 253, 238, 358, 573, 436, 309, 616, 578, 571, 618, 439, 562, 627, 182, 150, 641, 307, 250, 561, 458, 632, 447, 454, 243, 238, 450, 402, 445, 238, 449, 237, 460, 243, 148, 353, 351, 250, 186, 349, 347, 188, 176, 410, 415, 456, 425, 417, 436, 433, 143, 467, 169, 439, 429, 302, 358, 344, 302, 392, 400, 390, 182, 171, 358, 237, 336, 163, 482, 334, 439, 436, 338, 339, 140, 358, 146, 404, 358, 485, 60, 302, 0, 311, 0, 94, 0, 320, 404, 0, 302, 0, 0, 0, 0, 0, 0, 60, 60, 60, 452, 490, 0, 0, 60, 60, 451, 180, 60, 405, 302, 165, 88, 60, 60, 489, 461, 60, 146, 285, 405, 90, 60, 178, 146, 60, 89, 451, 60, 407, 60, 60, 266, 452, 60, 186, 60, 270, 102, 288, 501, 60, 100, 642, 60, 60, 284, 494, 60, 95, 330, 60, 168, 286, 60, 432, 287, 61, 435, 332, 329, 60, 60, 60, 60, 0, 302, 98, 97, 96, 77, 60, 60, 451, 452, 501, 60, 480, 540, 303, 60, 479, 180, 60, 72, 404, 70, 471, 106, 60, 0, 67, 60, 60, 68, 69, 60, 60, 180, 493, 60, 60, 60, 492, 491, 93, 60, 60, 60, 501, 106, 92, 91, 84, 108, 0, 617, 405, 298, 60, 341, 0, 60, 270, 270, 60, 0, 270, 0, 0, 270, 273, 0, 0, 313, 305, 108, 175, 293, 60, 326, 0, 60, 0, 270, 60, 289, 270, 60, 290, 270, 298, 278, 270, 0, 60, 270, 0, 0, 295, 270, 60, 291, 298, 298, 298, 270, 548, 270, 270, 270, 556, 501, 319, 540, 501, 614, 0, 316, 509, 501, 0, 509, 544, 0, 297, 300, 317, 0, 0, 0, 500, 510, 0, 500, 510, 0, 472, 520, 521, 522, 523, 527, 524, 525, 564, 520, 521, 522, 523, 527, 524, 525, 556, 0, 0, 0, 0, 0, 0, 557, 558, 520, 521, 522, 523, 527, 524, 525, 581, 0, 0, 0, 0, 0, 0, 584, 585, 520, 521, 522, 523, 527, 524, 525, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 551, 0, 0, 0, 0, 0, 0, 0, 501, 0, 0, 0, 0, 0, 0, 509, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 510, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; const short QmlJSGrammar::action_check [] = { 8, 36, 7, 7, 7, 36, 7, 7, 7, 60, 7, 36, 60, 33, 55, 33, 7, 34, 16, 8, 36, 55, 24, 17, 37, 55, 7, 7, 7, 5, 7, 55, 7, 7, 5, 7, 20, 33, 7, 7, 7, 36, 1, 36, 36, 33, 36, 29, 60, 36, 36, 36, 90, 31, 60, 66, 66, 7, 5, 7, 33, 2, 8, 33, 8, 48, 8, 33, 7, 33, 33, 36, 7, 33, 1, 36, 7, 2, 7, 36, 8, 7, 1, 36, 0, 36, 48, 17, 8, 1, -1, 36, -1, 8, 7, 33, 6, -1, -1, 36, 8, 10, 60, -1, -1, 61, 60, 7, 8, 8, 20, 60, 48, 8, 48, 55, -1, 60, 36, 8, 8, 8, -1, -1, 79, 8, 8, 79, 61, -1, 15, -1, 8, 8, -1, -1, 50, 42, 61, 60, 54, 56, 8, 8, 61, 62, 55, 79, 53, 34, 61, 62, 60, 77, 61, 62, 40, 61, 62, 61, 62, 60, 8, 61, 62, 60, -1, 51, 90, 61, 62, 60, 60, 60, 15, 61, 62, 60, 50, 61, 56, 56, 54, 61, 62, 40, 40, 61, 62, 2, 56, 40, 25, 34, 27, 60, 51, 51, 15, 25, 12, 27, 51, 12, 29, 38, 29, 25, -1, 27, 56, 25, 38, 27, 25, 7, 27, 34, 7, 36, 38, 25, 8, 27, 38, 15, -1, 38, 29, 7, 25, 29, 27, 29, 38, 29, -1, 61, 62, 36, 8, 15, -1, 38, 34, 57, 36, -1, 57, -1, 75, 63, 75, -1, 63, 33, 12, -1, 8, -1, 34, 86, 36, 86, 61, 62, -1, 91, -1, 61, 62, -1, 61, 62, 75, 61, 62, 75, 25, 75, 27, 75, 25, 15, 27, 86, -1, -1, 86, 7, 86, 38, 86, 61, 62, 38, 25, 25, 27, 27, -1, 57, 34, 25, 36, 27, 25, 63, 27, 38, 38, 61, 62, 47, 92, -1, 38, 29, -1, 38, 18, 19, 18, 19, 18, 19, 29, 61, 62, 29, -1, 18, 19, -1, -1, -1, -1, -1, 29, -1, -1, -1, -1, 61, 62, -1, -1, 45, 46, 45, 46, 45, 46, -1, 66, 67, 68, 91, 45, 46, 23, 24, -1, 66, 67, 68, 66, 67, 68, 32, 29, -1, 35, 29, 37, 66, 67, 68, 29, -1, 92, 23, 24, 29, 15, 23, 24, -1, 29, 92, 32, -1, 92, 35, 32, 37, -1, 35, -1, 37, -1, 92, 33, 34, -1, 36, -1, 66, 67, 68, 66, 67, 68, -1, -1, 66, 67, 68, -1, -1, 66, 67, 68, 23, 24, 66, 67, 68, -1, -1, 23, 24, 32, 92, -1, 35, 92, 37, 29, 32, -1, 92, 35, 29, 37, 36, 92, -1, -1, -1, 36, 92, 23, 24, 94, 95, 96, 97, 98, 99, 31, 32, -1, -1, 35, 29, 37, -1, -1, -1, -1, 29, -1, -1, -1, 66, 67, 68, -1, 29, 66, 67, 68, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 29, -1, 92, 66, 67, 68, -1, 92, -1, 66, 67, 68, 61, 62, -1, -1, -1, 66, 67, 68, 61, 62, -1, 29, -1, 66, 67, 68, -1, 92, -1, -1, 61, 62, 29, 92, -1, 66, 67, 68, -1, -1, -1, 92, -1, 23, 24, -1, -1, -1, -1, 92, -1, 31, 32, 61, 62, 35, -1, 37, 66, 67, 68, 92, 3, -1, 61, 62, -1, -1, -1, 66, 67, 68, 13, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, 92, 26, -1, 28, -1, -1, 31, -1, -1, -1, -1, 92, -1, -1, 39, -1, 41, 42, -1, -1, -1, -1, -1, -1, 49, 12, 13, 52, 53, -1, -1, -1, -1, 58, -1, 22, -1, -1, 3, 64, -1, -1, 29, -1, -1, -1, 33, 34, 13, 36, -1, -1, 17, -1, -1, 80, 43, -1, -1, -1, 47, 26, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 41, 42, 65, 66, 67, 68, -1, 70, 49, -1, -1, 52, 53, -1, -1, -1, -1, 58, 81, 82, 83, -1, -1, 64, 87, -1, -1, -1, -1, 92, -1, -1, -1, 12, 13, -1, -1, -1, -1, 80, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 12, 13, -1, 43, -1, -1, -1, 47, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, 65, 66, 67, 68, -1, 70, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, 65, 66, 67, 68, -1, 70, -1, -1, -1, 12, 13, -1, -1, -1, -1, -1, 81, 82, 83, 22, -1, -1, 87, -1, -1, -1, 29, 92, -1, -1, 33, 34, -1, 36, -1, -1, -1, 12, 13, -1, 43, -1, -1, -1, 47, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, 65, 66, 67, 68, -1, 70, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, 65, 66, 67, 68, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, 81, 82, 83, 84, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, 81, 82, 83, 84, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, 81, 82, 83, 84, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, 75, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, -1, 72, 73, 74, -1, 76, -1, 78, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, -1, 72, 73, 74, -1, 76, -1, 78, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, 66, 67, 68, 69, 70, 71, -1, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, -1, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, 65, 66, 67, -1, 69, 70, 71, -1, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, 59, -1, -1, -1, -1, -1, 65, 66, 67, -1, 69, 70, 71, -1, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, 12, 13, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, 12, 13, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, 55, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 13, 15, 29, 15, 15, 15, 105, 4, 2, 15, 19, 9, 15, 29, 15, 3, 39, 3, 2, 15, 15, 3, 15, 2, 29, 3, 3, 19, 15, 29, 19, 22, 15, 13, 15, 71, 11, 2, 2, 29, 3, 15, 15, 3, 15, 15, 22, 2, 99, 15, 22, 4, 2, 15, 39, 2, 2, 2, 15, 3, 2, 15, 3, 2, 2, 2, 97, 3, 3, 3, 39, 39, 39, 22, 94, 3, 2, 101, 3, 40, 39, 39, 15, 39, 2, 4, 3, 39, 39, 2, 22, 3, 2, 15, 3, 2, 39, 13, 2, 39, 48, 3, -1, 2, -1, 53, -1, 15, 13, -1, 3, -1, -1, -1, -1, -1, -1, 48, 48, 48, 50, 50, -1, -1, 48, 48, 50, 50, 48, 45, 3, 62, 52, 48, 48, 50, 15, 48, 39, 53, 45, 52, 48, 44, 39, 48, 52, 50, 48, 44, 48, 48, 48, 50, 48, 15, 48, 53, 58, 53, 13, 48, 60, 16, 48, 48, 53, 50, 48, 53, 72, 48, 64, 53, 48, 82, 53, 51, 82, 72, 88, 48, 48, 48, 48, -1, 3, 54, 54, 54, 54, 48, 48, 50, 50, 13, 48, 35, 16, 72, 48, 39, 50, 48, 56, 13, 51, 86, 15, 48, -1, 50, 48, 48, 50, 50, 48, 48, 50, 50, 48, 48, 48, 50, 50, 53, 48, 48, 48, 13, 15, 53, 53, 53, 41, -1, 20, 45, 48, 48, 100, -1, 48, 53, 53, 48, -1, 53, -1, -1, 53, 57, -1, -1, 63, 72, 41, 42, 61, 48, 70, -1, 48, -1, 53, 48, 55, 53, 48, 55, 53, 48, 55, 53, -1, 48, 53, -1, -1, 59, 53, 48, 55, 48, 48, 48, 53, 5, 53, 53, 53, 13, 13, 70, 16, 13, 18, -1, 65, 20, 13, -1, 20, 16, -1, 70, 70, 70, -1, -1, -1, 32, 33, -1, 32, 33, -1, 39, 22, 23, 24, 25, 26, 27, 28, 21, 22, 23, 24, 25, 26, 27, 28, 13, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 13, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; } // end of namespace QbsQmlJS qbs-src-3.2.0/src/lib/corelib/parser/qmljslexer.cpp0000644000175100017510000010073615154533055021653 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "qmljslexer_p.h" #include "qmljsengine_p.h" #include "qmljsmemorypool_p.h" #include #include #include QT_BEGIN_NAMESPACE #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) Q_CORE_EXPORT double qstrntod(const char *s00, int len, char const **se, bool *ok); #else Q_CORE_EXPORT double qstrntod(const char *s00, qsizetype len, char const **se, bool *ok); #endif QT_END_NAMESPACE namespace QbsQmlJS { static int regExpFlagFromChar(const QChar &ch) { switch (ch.unicode()) { case 'g': return Lexer::RegExp_Global; case 'i': return Lexer::RegExp_IgnoreCase; case 'm': return Lexer::RegExp_Multiline; } return 0; } static unsigned char convertHex(ushort c) { if (c >= '0' && c <= '9') return (c - '0'); if (c >= 'a' && c <= 'f') return (c - 'a' + 10); return (c - 'A' + 10); } static QChar convertHex(QChar c1, QChar c2) { return QChar{(convertHex(c1.unicode()) << 4) + convertHex(c2.unicode())}; } static QChar convertUnicode(QChar c1, QChar c2, QChar c3, QChar c4) { return QChar{uchar((convertHex(c3.unicode()) << 4) + convertHex(c4.unicode())), uchar((convertHex(c1.unicode()) << 4) + convertHex(c2.unicode()))}; } Lexer::Lexer(Engine *engine) : _engine(engine) , _codePtr(nullptr) , _lastLinePtr(nullptr) , _tokenLinePtr(nullptr) , _tokenStartPtr(nullptr) , _char(QLatin1Char('\n')) , _errorCode(NoError) , _currentLineNumber(0) , _tokenValue(0) , _parenthesesState(IgnoreParentheses) , _parenthesesCount(0) , _stackToken(-1) , _patternFlags(0) , _tokenKind(0) , _tokenLength(0) , _tokenLine(0) , _validTokenText(false) , _prohibitAutomaticSemicolon(false) , _restrictedKeyword(false) , _terminator(false) , _followsClosingBrace(false) , _delimited(true) , _qmlMode(true) { if (engine) engine->setLexer(this); } bool Lexer::qmlMode() const { return _qmlMode; } QString Lexer::code() const { return _code; } void Lexer::setCode(const QString &code, int lineno, bool qmlMode) { if (_engine) _engine->setCode(code); _qmlMode = qmlMode; _code = code; _tokenText.clear(); _tokenText.reserve(1024); _errorMessage.clear(); _tokenSpell = QStringRef(); _codePtr = code.unicode(); _lastLinePtr = _codePtr; _tokenLinePtr = _codePtr; _tokenStartPtr = _codePtr; _char = QLatin1Char('\n'); _errorCode = NoError; _currentLineNumber = lineno; _tokenValue = 0; // parentheses state _parenthesesState = IgnoreParentheses; _parenthesesCount = 0; _stackToken = -1; _patternFlags = 0; _tokenLength = 0; _tokenLine = lineno; _validTokenText = false; _prohibitAutomaticSemicolon = false; _restrictedKeyword = false; _terminator = false; _followsClosingBrace = false; _delimited = true; } void Lexer::scanChar() { _char = *_codePtr++; if (_char == QLatin1Char('\n')) { _lastLinePtr = _codePtr; // points to the first character after the newline ++_currentLineNumber; } } int Lexer::lex() { const int previousTokenKind = _tokenKind; _tokenSpell = QStringRef(); _tokenKind = scanToken(); _tokenLength = int(_codePtr - _tokenStartPtr - 1); _delimited = false; _restrictedKeyword = false; _followsClosingBrace = (previousTokenKind == T_RBRACE); // update the flags switch (_tokenKind) { case T_LBRACE: case T_SEMICOLON: case T_COLON: _delimited = true; break; case T_IF: case T_FOR: case T_WHILE: case T_WITH: _parenthesesState = CountParentheses; _parenthesesCount = 0; break; case T_DO: _parenthesesState = BalancedParentheses; break; case T_CONTINUE: case T_BREAK: case T_RETURN: case T_THROW: _restrictedKeyword = true; break; } // switch // update the parentheses state switch (_parenthesesState) { case IgnoreParentheses: break; case CountParentheses: if (_tokenKind == T_RPAREN) { --_parenthesesCount; if (_parenthesesCount == 0) _parenthesesState = BalancedParentheses; } else if (_tokenKind == T_LPAREN) { ++_parenthesesCount; } break; case BalancedParentheses: _parenthesesState = IgnoreParentheses; break; } // switch return _tokenKind; } bool Lexer::isUnicodeEscapeSequence(const QChar *chars) { return isHexDigit(chars[0]) && isHexDigit(chars[1]) && isHexDigit(chars[2]) && isHexDigit(chars[3]); } QChar Lexer::decodeUnicodeEscapeCharacter(bool *ok) { if (_char == QLatin1Char('u') && isUnicodeEscapeSequence(&_codePtr[0])) { scanChar(); // skip u const QChar c1 = _char; scanChar(); const QChar c2 = _char; scanChar(); const QChar c3 = _char; scanChar(); const QChar c4 = _char; scanChar(); if (ok) *ok = true; return convertUnicode(c1, c2, c3, c4); } *ok = false; return {}; } int Lexer::scanToken() { if (_stackToken != -1) { int tk = _stackToken; _stackToken = -1; return tk; } _terminator = false; again: _validTokenText = false; _tokenLinePtr = _lastLinePtr; while (_char.isSpace()) { if (_char == QLatin1Char('\n')) { _tokenLinePtr = _codePtr; if (_restrictedKeyword) { // automatic semicolon insertion _tokenLine = _currentLineNumber; _tokenStartPtr = _codePtr - 1; // ### TODO: insert it before the optional \r sequence. return T_SEMICOLON; } _terminator = true; syncProhibitAutomaticSemicolon(); } scanChar(); } _tokenStartPtr = _codePtr - 1; _tokenLine = _currentLineNumber; if (_char.isNull()) return EOF_SYMBOL; const QChar ch = _char; scanChar(); switch (ch.unicode()) { case '~': return T_TILDE; case '}': return T_RBRACE; case '|': if (_char == QLatin1Char('|')) { scanChar(); return T_OR_OR; } else if (_char == QLatin1Char('=')) { scanChar(); return T_OR_EQ; } return T_OR; case '{': return T_LBRACE; case '^': if (_char == QLatin1Char('=')) { scanChar(); return T_XOR_EQ; } return T_XOR; case ']': return T_RBRACKET; case '[': return T_LBRACKET; case '?': return T_QUESTION; case '>': if (_char == QLatin1Char('>')) { scanChar(); if (_char == QLatin1Char('>')) { scanChar(); if (_char == QLatin1Char('=')) { scanChar(); return T_GT_GT_GT_EQ; } return T_GT_GT_GT; } if (_char == QLatin1Char('=')) { scanChar(); return T_GT_GT_EQ; } return T_GT_GT; } else if (_char == QLatin1Char('=')) { scanChar(); return T_GE; } return T_GT; case '=': if (_char == QLatin1Char('=')) { scanChar(); if (_char == QLatin1Char('=')) { scanChar(); return T_EQ_EQ_EQ; } return T_EQ_EQ; } return T_EQ; case '<': if (_char == QLatin1Char('=')) { scanChar(); return T_LE; } else if (_char == QLatin1Char('<')) { scanChar(); if (_char == QLatin1Char('=')) { scanChar(); return T_LT_LT_EQ; } return T_LT_LT; } return T_LT; case ';': return T_SEMICOLON; case ':': return T_COLON; case '/': if (_char == QLatin1Char('*')) { scanChar(); while (!_char.isNull()) { if (_char == QLatin1Char('*')) { scanChar(); if (_char == QLatin1Char('/')) { scanChar(); if (_engine) { _engine->addComment(tokenOffset() + 2, int(_codePtr - _tokenStartPtr - 1 - 4), tokenStartLine(), tokenStartColumn() + 2); } goto again; } } else { scanChar(); } } } else if (_char == QLatin1Char('/')) { while (!_char.isNull() && _char != QLatin1Char('\n')) { scanChar(); } if (_engine) { _engine->addComment(tokenOffset() + 2, int(_codePtr - _tokenStartPtr - 1 - 2), tokenStartLine(), tokenStartColumn() + 2); } goto again; } if (_char == QLatin1Char('=')) { scanChar(); return T_DIVIDE_EQ; } return T_DIVIDE_; case '.': if (_char.isDigit()) { QVarLengthArray chars; chars.append(ch.unicode()); // append the `.' while (_char.isDigit()) { chars.append(_char.unicode()); scanChar(); } if (_char == QLatin1Char('e') || _char == QLatin1Char('E')) { if (_codePtr[0].isDigit() || ((_codePtr[0] == QLatin1Char('+') || _codePtr[0] == QLatin1Char('-')) && _codePtr[1].isDigit())) { chars.append(_char.unicode()); scanChar(); // consume `e' if (_char == QLatin1Char('+') || _char == QLatin1Char('-')) { chars.append(_char.unicode()); scanChar(); // consume the sign } while (_char.isDigit()) { chars.append(_char.unicode()); scanChar(); } } } const char *begin = chars.constData(); const char *end = nullptr; bool ok = false; _tokenValue = qstrntod(begin, chars.size(), &end, &ok); if (end - begin != chars.size()) { _errorCode = IllegalExponentIndicator; _errorMessage = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number"); return T_ERROR; } return T_NUMERIC_LITERAL; } return T_DOT; case '-': if (_char == QLatin1Char('=')) { scanChar(); return T_MINUS_EQ; } else if (_char == QLatin1Char('-')) { scanChar(); if (_terminator && !_delimited && !_prohibitAutomaticSemicolon) { _stackToken = T_MINUS_MINUS; return T_SEMICOLON; } return T_MINUS_MINUS; } return T_MINUS; case ',': return T_COMMA; case '+': if (_char == QLatin1Char('=')) { scanChar(); return T_PLUS_EQ; } else if (_char == QLatin1Char('+')) { scanChar(); if (_terminator && !_delimited && !_prohibitAutomaticSemicolon) { _stackToken = T_PLUS_PLUS; return T_SEMICOLON; } return T_PLUS_PLUS; } return T_PLUS; case '*': if (_char == QLatin1Char('=')) { scanChar(); return T_STAR_EQ; } return T_STAR; case ')': return T_RPAREN; case '(': return T_LPAREN; case '&': if (_char == QLatin1Char('=')) { scanChar(); return T_AND_EQ; } else if (_char == QLatin1Char('&')) { scanChar(); return T_AND_AND; } return T_AND; case '%': if (_char == QLatin1Char('=')) { scanChar(); return T_REMAINDER_EQ; } return T_REMAINDER; case '!': if (_char == QLatin1Char('=')) { scanChar(); if (_char == QLatin1Char('=')) { scanChar(); return T_NOT_EQ_EQ; } return T_NOT_EQ; } return T_NOT; case '\'': case '"': { const QChar quote = ch; bool multilineStringLiteral = false; const QChar *startCode = _codePtr; if (_engine) { while (!_char.isNull()) { if (_char == QLatin1Char('\n') || _char == QLatin1Char('\\')) { break; } if (_char == quote) { _tokenSpell = _engine->midRef( int(startCode - _code.unicode() - 1), int(_codePtr - startCode)); scanChar(); return T_STRING_LITERAL; } scanChar(); } } _validTokenText = true; _tokenText.resize(0); startCode--; while (startCode != _codePtr - 1) _tokenText += *startCode++; while (! _char.isNull()) { if (_char == QLatin1Char('\n')) { multilineStringLiteral = true; _tokenText += _char; scanChar(); } else if (_char == quote) { scanChar(); if (_engine) _tokenSpell = _engine->newStringRef(_tokenText); return multilineStringLiteral ? T_MULTILINE_STRING_LITERAL : T_STRING_LITERAL; } else if (_char == QLatin1Char('\\')) { scanChar(); QChar u; bool ok = false; switch (_char.unicode()) { // unicode escape sequence case 'u': u = decodeUnicodeEscapeCharacter(&ok); if (! ok) u = _char; break; // hex escape sequence case 'x': case 'X': if (isHexDigit(_codePtr[0]) && isHexDigit(_codePtr[1])) { scanChar(); const QChar c1 = _char; scanChar(); const QChar c2 = _char; scanChar(); u = convertHex(c1, c2); } else { u = _char; } break; // single character escape sequence case '\\': u = QLatin1Char('\\'); scanChar(); break; case '\'': u = QLatin1Char('\''); scanChar(); break; case '\"': u = QLatin1Char('\"'); scanChar(); break; case 'b': u = QLatin1Char('\b'); scanChar(); break; case 'f': u = QLatin1Char('\f'); scanChar(); break; case 'n': u = QLatin1Char('\n'); scanChar(); break; case 'r': u = QLatin1Char('\r'); scanChar(); break; case 't': u = QLatin1Char('\t'); scanChar(); break; case 'v': u = QLatin1Char('\v'); scanChar(); break; case '0': if (! _codePtr[1].isDigit()) { scanChar(); u = QLatin1Char('\0'); } else { // ### parse deprecated octal escape sequence ? u = _char; } break; case '\r': while (_char == QLatin1Char('\r')) scanChar(); if (_char == QLatin1Char('\n')) { u = _char; scanChar(); } else { u = QLatin1Char('\n'); } break; case '\n': u = _char; scanChar(); break; default: // non escape character u = _char; scanChar(); } _tokenText += u; } else { _tokenText += _char; scanChar(); } } _errorCode = UnclosedStringLiteral; _errorMessage = QCoreApplication::translate("QmlParser", "Unclosed string at end of line"); return T_ERROR; } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return scanNumber(ch); default: if (ch.isLetter() || ch == QLatin1Char('$') || ch == QLatin1Char('_') || (ch == QLatin1Char('\\') && _char == QLatin1Char('u'))) { bool identifierWithEscapeChars = false; if (ch == QLatin1Char('\\')) { identifierWithEscapeChars = true; _tokenText.resize(0); bool ok = false; _tokenText += decodeUnicodeEscapeCharacter(&ok); _validTokenText = true; if (! ok) { _errorCode = IllegalUnicodeEscapeSequence; _errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence"); return T_ERROR; } } while (true) { if (_char.isLetterOrNumber() || _char == QLatin1Char('$') || _char == QLatin1Char('_')) { if (identifierWithEscapeChars) _tokenText += _char; scanChar(); } else if (_char == QLatin1Char('\\') && _codePtr[0] == QLatin1Char('u')) { if (! identifierWithEscapeChars) { identifierWithEscapeChars = true; _tokenText.resize(0); _tokenText.insert(0, _tokenStartPtr, int(_codePtr - _tokenStartPtr - 1)); _validTokenText = true; } scanChar(); // skip '\\' bool ok = false; _tokenText += decodeUnicodeEscapeCharacter(&ok); if (! ok) { _errorCode = IllegalUnicodeEscapeSequence; _errorMessage = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence"); return T_ERROR; } } else { _tokenLength = int(_codePtr - _tokenStartPtr - 1); int kind = T_IDENTIFIER; if (! identifierWithEscapeChars) kind = classify(_tokenStartPtr, _tokenLength, _qmlMode); if (_engine) { if (kind == T_IDENTIFIER && identifierWithEscapeChars) { _tokenSpell = _engine->newStringRef(_tokenText); } else { _tokenSpell = _engine->midRef( int(_tokenStartPtr - _code.unicode()), _tokenLength); } } return kind; } } } break; } return T_ERROR; } int Lexer::scanNumber(QChar ch) { if (ch != QLatin1Char('0')) { double integer = ch.unicode() - '0'; QChar n = _char; const QChar *code = _codePtr; while (n.isDigit()) { integer = integer * 10 + (n.unicode() - '0'); n = *code++; } if (n != QLatin1Char('.') && n != QLatin1Char('e') && n != QLatin1Char('E')) { if (code != _codePtr) { _codePtr = code - 1; scanChar(); } _tokenValue = integer; return T_NUMERIC_LITERAL; } } QVarLengthArray chars; chars.append(ch.unicode()); if (ch == QLatin1Char('0') && (_char == QLatin1Char('x') || _char == QLatin1Char('X'))) { // parse hex integer literal chars.append(_char.unicode()); scanChar(); // consume `x' while (isHexDigit(_char)) { chars.append(_char.unicode()); scanChar(); } _tokenValue = integerFromString(chars.constData(), chars.size(), 16); return T_NUMERIC_LITERAL; } // decimal integer literal while (_char.isDigit()) { chars.append(_char.unicode()); scanChar(); // consume the digit } if (_char == QLatin1Char('.')) { chars.append(_char.unicode()); scanChar(); // consume `.' while (_char.isDigit()) { chars.append(_char.unicode()); scanChar(); } if (_char == QLatin1Char('e') || _char == QLatin1Char('E')) { if (_codePtr[0].isDigit() || ((_codePtr[0] == QLatin1Char('+') || _codePtr[0] == QLatin1Char('-')) && _codePtr[1].isDigit())) { chars.append(_char.unicode()); scanChar(); // consume `e' if (_char == QLatin1Char('+') || _char == QLatin1Char('-')) { chars.append(_char.unicode()); scanChar(); // consume the sign } while (_char.isDigit()) { chars.append(_char.unicode()); scanChar(); } } } } else if (_char == QLatin1Char('e') || _char == QLatin1Char('E')) { if (_codePtr[0].isDigit() || ((_codePtr[0] == QLatin1Char('+') || _codePtr[0] == QLatin1Char('-')) && _codePtr[1].isDigit())) { chars.append(_char.unicode()); scanChar(); // consume `e' if (_char == QLatin1Char('+') || _char == QLatin1Char('-')) { chars.append(_char.unicode()); scanChar(); // consume the sign } while (_char.isDigit()) { chars.append(_char.unicode()); scanChar(); } } } if (chars.size() == 1) { // if we ended up with a single digit, then it was a '0' _tokenValue = 0; return T_NUMERIC_LITERAL; } const char *begin = chars.constData(); const char *end = nullptr; bool ok = false; _tokenValue = qstrntod(begin, chars.size(), &end, &ok); if (end - begin != chars.size()) { _errorCode = IllegalExponentIndicator; _errorMessage = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number"); return T_ERROR; } return T_NUMERIC_LITERAL; } bool Lexer::scanRegExp(RegExpBodyPrefix prefix) { _tokenText.resize(0); _validTokenText = true; _patternFlags = 0; if (prefix == EqualPrefix) _tokenText += QLatin1Char('='); while (true) { switch (_char.unicode()) { case 0: // eof case '\n': case '\r': // line terminator _errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression literal"); return false; case '/': scanChar(); // scan the flags _patternFlags = 0; while (isIdentLetter(_char)) { int flag = regExpFlagFromChar(_char); if (flag == 0) { _errorMessage = QCoreApplication::translate("QmlParser", "Invalid regular expression flag '%0'") .arg(QChar(_char)); return false; } _patternFlags |= flag; scanChar(); } _tokenLength = int(_codePtr - _tokenStartPtr - 1); return true; case '\\': // regular expression backslash sequence _tokenText += _char; scanChar(); if (_char.isNull() || isLineTerminator()) { _errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression backslash sequence"); return false; } _tokenText += _char; scanChar(); break; case '[': // regular expression class _tokenText += _char; scanChar(); while (! _char.isNull() && ! isLineTerminator()) { if (_char == QLatin1Char(']')) break; if (_char == QLatin1Char('\\')) { // regular expression backslash sequence _tokenText += _char; scanChar(); if (_char.isNull() || isLineTerminator()) { _errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression backslash sequence"); return false; } _tokenText += _char; scanChar(); } else { _tokenText += _char; scanChar(); } } if (_char != QLatin1Char(']')) { _errorMessage = QCoreApplication::translate("QmlParser", "Unterminated regular expression class"); return false; } _tokenText += _char; scanChar(); // skip ] break; default: _tokenText += _char; scanChar(); } // switch } // while return false; } bool Lexer::isLineTerminator() const { return (_char == QLatin1Char('\n') || _char == QLatin1Char('\r')); } bool Lexer::isIdentLetter(QChar ch) { // ASCII-biased, since all reserved words are ASCII, aand hence the // bulk of content to be parsed. if ((ch >= QLatin1Char('a') && ch <= QLatin1Char('z')) || (ch >= QLatin1Char('A') && ch <= QLatin1Char('Z')) || ch == QLatin1Char('$') || ch == QLatin1Char('_')) return true; if (ch.unicode() < 128) return false; return ch.isLetterOrNumber(); } bool Lexer::isDecimalDigit(ushort c) { return (c >= '0' && c <= '9'); } bool Lexer::isHexDigit(QChar c) { return ((c >= QLatin1Char('0') && c <= QLatin1Char('9')) || (c >= QLatin1Char('a') && c <= QLatin1Char('f')) || (c >= QLatin1Char('A') && c <= QLatin1Char('F'))); } bool Lexer::isOctalDigit(ushort c) { return (c >= '0' && c <= '7'); } int Lexer::tokenEndLine() const { return _currentLineNumber; } int Lexer::tokenEndColumn() const { return int(_codePtr - _lastLinePtr); } QString Lexer::tokenText() const { if (_validTokenText) return _tokenText; if (_tokenKind == T_STRING_LITERAL) return QString(_tokenStartPtr + 1, _tokenLength - 2); return QString(_tokenStartPtr, _tokenLength); } Lexer::Error Lexer::errorCode() const { return _errorCode; } QString Lexer::errorMessage() const { return _errorMessage; } void Lexer::syncProhibitAutomaticSemicolon() { if (_parenthesesState == BalancedParentheses) { // we have seen something like "if (foo)", which means we should // never insert an automatic semicolon at this point, since it would // then be expanded into an empty statement (ECMA-262 7.9.1) _prohibitAutomaticSemicolon = true; _parenthesesState = IgnoreParentheses; } else { _prohibitAutomaticSemicolon = false; } } bool Lexer::prevTerminator() const { return _terminator; } bool Lexer::followsClosingBrace() const { return _followsClosingBrace; } bool Lexer::canInsertAutomaticSemicolon(int token) const { return token == T_RBRACE || token == EOF_SYMBOL || _terminator || _followsClosingBrace; } bool Lexer::scanDirectives(Directives *directives) { if (_qmlMode) { // the directives are a Javascript-only extension. return false; } lex(); // fetch the first token if (_tokenKind != T_DOT) return true; do { lex(); // skip T_DOT const int lineNumber = tokenStartLine(); if (_tokenKind != T_IDENTIFIER && _tokenKind != T_RESERVED_WORD) return false; // expected a valid QML/JS directive const QString directiveName = tokenText(); if (! (directiveName == QLatin1String("pragma") || directiveName == QLatin1String("import"))) return false; // not a valid directive name // it must be a pragma or an import directive. if (directiveName == QLatin1String("pragma")) { // .pragma library if (lex() != T_IDENTIFIER || tokenText() != QLatin1String("library")) return false; // expected `library // we found a .pragma library directive directives->pragmaLibrary(); } else { Q_ASSERT(directiveName == QLatin1String("import")); lex(); // skip .import QString pathOrUri; QString version; bool fileImport = false; // file or uri import if (_tokenKind == T_STRING_LITERAL) { // .import T_STRING_LITERAL as T_IDENTIFIER fileImport = true; pathOrUri = tokenText(); } else if (_tokenKind == T_IDENTIFIER) { // .import T_IDENTIFIER (. T_IDENTIFIER)* T_NUMERIC_LITERAL as T_IDENTIFIER pathOrUri = tokenText(); lex(); // skip the first T_IDENTIFIER for (; _tokenKind == T_DOT; lex()) { if (lex() != T_IDENTIFIER) return false; pathOrUri += QLatin1Char('.'); pathOrUri += tokenText(); } if (_tokenKind != T_NUMERIC_LITERAL) return false; // expected the module version number version = tokenText(); } // // recognize the mandatory `as' followed by the module name // if (lex() != T_RESERVED_WORD || tokenText() != QLatin1String("as")) return false; // expected `as' if (lex() != T_IDENTIFIER) return false; // expected module name const QString module = tokenText(); if (fileImport) directives->importFile(pathOrUri, module); else directives->importModule(pathOrUri, version, module); } if (tokenStartLine() != lineNumber) return false; // the directives cannot span over multiple lines // fetch the first token after the .pragma/.import directive lex(); } while (_tokenKind == T_DOT); return true; } } // namespace QbsQmlJS #include "qmljskeywords_p.h" qbs-src-3.2.0/src/lib/corelib/parser/qmljsastfwd_p.h0000644000175100017510000001164415154533055022007 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 QMLJSAST_FWD_P_H #define QMLJSAST_FWD_P_H #include "qmljsglobal_p.h" #include // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // namespace QbsQmlJS { namespace AST { class SourceLocation { public: SourceLocation(quint32 offset = 0, quint32 length = 0, quint32 line = 0, quint32 column = 0) : offset(offset), length(length), startLine(line), startColumn(column) { } bool isValid() const { return length != 0; } quint32 begin() const { return offset; } quint32 end() const { return offset + length; } // attributes // ### encode quint32 offset; quint32 length; quint32 startLine; quint32 startColumn; }; class Visitor; class Node; class ExpressionNode; class Statement; class ThisExpression; class IdentifierExpression; class NullExpression; class TrueLiteral; class FalseLiteral; class NumericLiteral; class StringLiteral; class RegExpLiteral; class ArrayLiteral; class ObjectLiteral; class ElementList; class Elision; class PropertyNameAndValueList; class PropertyName; class IdentifierPropertyName; class StringLiteralPropertyName; class NumericLiteralPropertyName; class ArrayMemberExpression; class FieldMemberExpression; class NewMemberExpression; class NewExpression; class CallExpression; class ArgumentList; class PostIncrementExpression; class PostDecrementExpression; class DeleteExpression; class VoidExpression; class TypeOfExpression; class PreIncrementExpression; class PreDecrementExpression; class UnaryPlusExpression; class UnaryMinusExpression; class TildeExpression; class NotExpression; class BinaryExpression; class ConditionalExpression; class Expression; // ### rename class Block; class StatementList; class VariableStatement; class VariableDeclarationList; class VariableDeclaration; class EmptyStatement; class ExpressionStatement; class IfStatement; class DoWhileStatement; class WhileStatement; class ForStatement; class LocalForStatement; class ForEachStatement; class LocalForEachStatement; class ContinueStatement; class BreakStatement; class ReturnStatement; class WithStatement; class SwitchStatement; class CaseBlock; class CaseClauses; class CaseClause; class DefaultClause; class LabelledStatement; class ThrowStatement; class TryStatement; class Catch; class Finally; class FunctionDeclaration; class FunctionExpression; class FormalParameterList; class FunctionBody; class Program; class SourceElements; class SourceElement; class FunctionSourceElement; class StatementSourceElement; class DebuggerStatement; class NestedExpression; // ui elements class UiProgram; class UiImportList; class UiImport; class UiPublicMember; class UiObjectDefinition; class UiObjectInitializer; class UiObjectBinding; class UiScriptBinding; class UiSourceElement; class UiArrayBinding; class UiObjectMember; class UiObjectMemberList; class UiArrayMemberList; class UiQualifiedId; } // namespace AST } // namespace QbsQmlJS #endif qbs-src-3.2.0/src/lib/corelib/parser/qmljsgrammar_p.h0000644000175100017510000001355015154533055022143 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of other Qt classes. This header file may change from version to // version without notice, or even be removed. // // We mean it. // // This file was generated by qlalr - DO NOT EDIT! #ifndef QMLJSGRAMMAR_P_H #define QMLJSGRAMMAR_P_H #include namespace QbsQmlJS { class QmlJSGrammar { public: enum VariousConstants { EOF_SYMBOL = 0, REDUCE_HERE = 101, SHIFT_THERE = 100, T_AND = 1, T_AND_AND = 2, T_AND_EQ = 3, T_AS = 91, T_AUTOMATIC_SEMICOLON = 62, T_BREAK = 4, T_CASE = 5, T_CATCH = 6, T_COLON = 7, T_COMMA = 8, T_COMMENT = 88, T_CONST = 84, T_CONTINUE = 9, T_DEBUGGER = 85, T_DEFAULT = 10, T_DELETE = 11, T_DIVIDE_ = 12, T_DIVIDE_EQ = 13, T_DO = 14, T_DOT = 15, T_ELSE = 16, T_EQ = 17, T_EQ_EQ = 18, T_EQ_EQ_EQ = 19, T_ERROR = 93, T_FALSE = 83, T_FEED_JS_EXPRESSION = 97, T_FEED_JS_PROGRAM = 99, T_FEED_JS_SOURCE_ELEMENT = 98, T_FEED_JS_STATEMENT = 96, T_FEED_UI_OBJECT_MEMBER = 95, T_FEED_UI_PROGRAM = 94, T_FINALLY = 20, T_FOR = 21, T_FUNCTION = 22, T_GE = 23, T_GT = 24, T_GT_GT = 25, T_GT_GT_EQ = 26, T_GT_GT_GT = 27, T_GT_GT_GT_EQ = 28, T_IDENTIFIER = 29, T_IF = 30, T_IMPORT = 90, T_IN = 31, T_INSTANCEOF = 32, T_LBRACE = 33, T_LBRACKET = 34, T_LE = 35, T_LPAREN = 36, T_LT = 37, T_LT_LT = 38, T_LT_LT_EQ = 39, T_MINUS = 40, T_MINUS_EQ = 41, T_MINUS_MINUS = 42, T_MULTILINE_STRING_LITERAL = 87, T_NEW = 43, T_NOT = 44, T_NOT_EQ = 45, T_NOT_EQ_EQ = 46, T_NULL = 81, T_NUMERIC_LITERAL = 47, T_ON = 92, T_OR = 48, T_OR_EQ = 49, T_OR_OR = 50, T_PLUS = 51, T_PLUS_EQ = 52, T_PLUS_PLUS = 53, T_PROPERTY = 66, T_PUBLIC = 89, T_QUESTION = 54, T_RBRACE = 55, T_RBRACKET = 56, T_READONLY = 68, T_REMAINDER = 57, T_REMAINDER_EQ = 58, T_RESERVED_WORD = 86, T_RETURN = 59, T_RPAREN = 60, T_SEMICOLON = 61, T_SIGNAL = 67, T_STAR = 63, T_STAR_EQ = 64, T_STRING_LITERAL = 65, T_SWITCH = 69, T_THIS = 70, T_THROW = 71, T_TILDE = 72, T_TRUE = 82, T_TRY = 73, T_TYPEOF = 74, T_VAR = 75, T_VOID = 76, T_WHILE = 77, T_WITH = 78, T_XOR = 79, T_XOR_EQ = 80, ACCEPT_STATE = 644, RULE_COUNT = 349, STATE_COUNT = 645, TERMINAL_COUNT = 102, NON_TERMINAL_COUNT = 107, GOTO_INDEX_OFFSET = 645, GOTO_INFO_OFFSET = 2789, GOTO_CHECK_OFFSET = 2789 }; static const char *const spell[]; static const short lhs[]; static const short rhs[]; static const short goto_default[]; static const short action_default[]; static const short action_index[]; static const short action_info[]; static const short action_check[]; static inline int nt_action (int state, int nt) { const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt; if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt) return goto_default [nt]; return action_info [GOTO_INFO_OFFSET + yyn]; } static inline int t_action (int state, int token) { const int yyn = action_index [state] + token; if (yyn < 0 || action_check [yyn] != token) return - action_default [state]; return action_info [yyn]; } }; } // namespace QbsQmlJS #endif // QMLJSGRAMMAR_P_H qbs-src-3.2.0/src/lib/corelib/parser/qmlerror.h0000644000175100017510000000534015154533055020770 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 QQMLERROR_H #define QQMLERROR_H #include #include #include QT_BEGIN_NAMESPACE class QDebug; QT_END_NAMESPACE namespace QbsQmlJS { class QmlErrorPrivate; class QmlError { public: QmlError(); QmlError(const QmlError &); QmlError &operator=(const QmlError &); ~QmlError(); bool isValid() const; QUrl url() const; void setUrl(const QUrl &); QString description() const; void setDescription(const QString &); int line() const; void setLine(int); int column() const; void setColumn(int); QString toString() const; private: qbs::Internal::Pimpl d; }; } // namespace QbsQmlJS QT_BEGIN_NAMESPACE QDebug operator<<(QDebug debug, const QbsQmlJS::QmlError &error); Q_DECLARE_TYPEINFO(QbsQmlJS::QmlError, Q_MOVABLE_TYPE); QT_END_NAMESPACE #endif // QQMLERROR_H qbs-src-3.2.0/src/lib/corelib/parser/qmljsengine_p.cpp0000644000175100017510000001100715154533055022310 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "qmljsengine_p.h" #include "qmljsglobal_p.h" #include #include #include namespace QbsQmlJS { static int toDigit(char c) { if ((c >= '0') && (c <= '9')) return c - '0'; if ((c >= 'a') && (c <= 'z')) return 10 + c - 'a'; if ((c >= 'A') && (c <= 'Z')) return 10 + c - 'A'; return -1; } double integerFromString(const char *buf, int size, int radix) { if (size == 0) return qSNaN(); double sign = 1.0; int i = 0; if (buf[0] == '+') { ++i; } else if (buf[0] == '-') { sign = -1.0; ++i; } if (((size-i) >= 2) && (buf[i] == '0')) { if (((buf[i+1] == 'x') || (buf[i+1] == 'X')) && (radix < 34)) { if ((radix != 0) && (radix != 16)) return 0; radix = 16; i += 2; } else { if (radix == 0) { radix = 8; ++i; } } } else if (radix == 0) { radix = 10; } int j = i; for ( ; i < size; ++i) { int d = toDigit(buf[i]); if ((d == -1) || (d >= radix)) break; } double result; if (j == i) { if (!qstrcmp(buf, "Infinity")) result = qInf(); else result = qSNaN(); } else { result = 0; double multiplier = 1; for (--i ; i >= j; --i, multiplier *= radix) result += toDigit(buf[i]) * multiplier; } result *= sign; return result; } double integerFromString(const QString &str, int radix) { QByteArray ba = str.trimmed().toLatin1(); return integerFromString(ba.constData(), ba.size(), radix); } Engine::Engine() = default; Engine::~Engine() = default; void Engine::setCode(const QString &code) { _code = code; } void Engine::addComment(int pos, int len, int line, int col) { if (len > 0) _comments.append(QbsQmlJS::AST::SourceLocation(pos, len, line, col)); } QList Engine::comments() const { return _comments; } Lexer *Engine::lexer() const { return _lexer; } void Engine::setLexer(Lexer *lexer) { _lexer = lexer; } void Engine::setDirectives(Directives *directives) { _directives = directives; } Directives *Engine::directives() const { return _directives; } MemoryPool *Engine::pool() { return &_pool; } QStringRef Engine::newStringRef(const QString &text) { const int pos = _extraCode.length(); _extraCode += text; return QStringRef(&_extraCode).mid(pos, text.length()); } QStringRef Engine::newStringRef(const QChar *chars, int size) { return newStringRef(QString(chars, size)); } } // end of namespace QbsQmlJS qbs-src-3.2.0/src/lib/corelib/parser/qmljsast.cpp0000644000175100017510000004317715154533055021330 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "qmljsast_p.h" #include "qmljsastvisitor_p.h" namespace QbsQmlJS { namespace AST { void Node::accept(Visitor *visitor) { if (visitor->preVisit(this)) { accept0(visitor); } visitor->postVisit(this); } void Node::accept(Node *node, Visitor *visitor) { if (node) node->accept(visitor); } ExpressionNode *Node::expressionCast() { return nullptr; } BinaryExpression *Node::binaryExpressionCast() { return nullptr; } Statement *Node::statementCast() { return nullptr; } UiObjectMember *Node::uiObjectMemberCast() { return nullptr; } ExpressionNode *ExpressionNode::expressionCast() { return this; } BinaryExpression *BinaryExpression::binaryExpressionCast() { return this; } Statement *Statement::statementCast() { return this; } UiObjectMember *UiObjectMember::uiObjectMemberCast() { return this; } void NestedExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void ThisExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void IdentifierExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void NullExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void TrueLiteral::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void FalseLiteral::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void StringLiteral::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void NumericLiteral::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void RegExpLiteral::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void ArrayLiteral::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(elements, visitor); accept(elision, visitor); } visitor->endVisit(this); } void ObjectLiteral::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(properties, visitor); } visitor->endVisit(this); } void ElementList::accept0(Visitor *visitor) { if (visitor->visit(this)) { for (ElementList *it = this; it; it = it->next) { accept(it->elision, visitor); accept(it->expression, visitor); } } visitor->endVisit(this); } void Elision::accept0(Visitor *visitor) { if (visitor->visit(this)) { // ### } visitor->endVisit(this); } void PropertyNameAndValueList::accept0(Visitor *visitor) { if (visitor->visit(this)) { for (PropertyNameAndValueList *it = this; it; it = it->next) { accept(it->name, visitor); accept(it->value, visitor); } } visitor->endVisit(this); } void IdentifierPropertyName::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void StringLiteralPropertyName::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void NumericLiteralPropertyName::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void ArrayMemberExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(base, visitor); accept(expression, visitor); } visitor->endVisit(this); } void FieldMemberExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(base, visitor); } visitor->endVisit(this); } void NewMemberExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(base, visitor); accept(arguments, visitor); } visitor->endVisit(this); } void NewExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void CallExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(base, visitor); accept(arguments, visitor); } visitor->endVisit(this); } void ArgumentList::accept0(Visitor *visitor) { if (visitor->visit(this)) { for (ArgumentList *it = this; it; it = it->next) { accept(it->expression, visitor); } } visitor->endVisit(this); } void PostIncrementExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(base, visitor); } visitor->endVisit(this); } void PostDecrementExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(base, visitor); } visitor->endVisit(this); } void DeleteExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void VoidExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void TypeOfExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void PreIncrementExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void PreDecrementExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void UnaryPlusExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void UnaryMinusExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void TildeExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void NotExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void BinaryExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(left, visitor); accept(right, visitor); } visitor->endVisit(this); } void ConditionalExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); accept(ok, visitor); accept(ko, visitor); } visitor->endVisit(this); } void Expression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(left, visitor); accept(right, visitor); } visitor->endVisit(this); } void Block::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(statements, visitor); } visitor->endVisit(this); } void StatementList::accept0(Visitor *visitor) { if (visitor->visit(this)) { for (StatementList *it = this; it; it = it->next) { accept(it->statement, visitor); } } visitor->endVisit(this); } void VariableStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(declarations, visitor); } visitor->endVisit(this); } void VariableDeclarationList::accept0(Visitor *visitor) { if (visitor->visit(this)) { for (VariableDeclarationList *it = this; it; it = it->next) { accept(it->declaration, visitor); } } visitor->endVisit(this); } void VariableDeclaration::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void EmptyStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void ExpressionStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void IfStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); accept(ok, visitor); accept(ko, visitor); } visitor->endVisit(this); } void DoWhileStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(statement, visitor); accept(expression, visitor); } visitor->endVisit(this); } void WhileStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); accept(statement, visitor); } visitor->endVisit(this); } void ForStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(initialiser, visitor); accept(condition, visitor); accept(expression, visitor); accept(statement, visitor); } visitor->endVisit(this); } void LocalForStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(declarations, visitor); accept(condition, visitor); accept(expression, visitor); accept(statement, visitor); } visitor->endVisit(this); } void ForEachStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(initialiser, visitor); accept(expression, visitor); accept(statement, visitor); } visitor->endVisit(this); } void LocalForEachStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(declaration, visitor); accept(expression, visitor); accept(statement, visitor); } visitor->endVisit(this); } void ContinueStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void BreakStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void ReturnStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void WithStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); accept(statement, visitor); } visitor->endVisit(this); } void SwitchStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); accept(block, visitor); } visitor->endVisit(this); } void CaseBlock::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(clauses, visitor); accept(defaultClause, visitor); accept(moreClauses, visitor); } visitor->endVisit(this); } void CaseClauses::accept0(Visitor *visitor) { if (visitor->visit(this)) { for (CaseClauses *it = this; it; it = it->next) { accept(it->clause, visitor); } } visitor->endVisit(this); } void CaseClause::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); accept(statements, visitor); } visitor->endVisit(this); } void DefaultClause::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(statements, visitor); } visitor->endVisit(this); } void LabelledStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(statement, visitor); } visitor->endVisit(this); } void ThrowStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expression, visitor); } visitor->endVisit(this); } void TryStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(statement, visitor); accept(catchExpression, visitor); accept(finallyExpression, visitor); } visitor->endVisit(this); } void Catch::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(statement, visitor); } visitor->endVisit(this); } void Finally::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(statement, visitor); } visitor->endVisit(this); } void FunctionDeclaration::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(formals, visitor); accept(body, visitor); } visitor->endVisit(this); } void FunctionExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(formals, visitor); accept(body, visitor); } visitor->endVisit(this); } void FormalParameterList::accept0(Visitor *visitor) { if (visitor->visit(this)) { // ### } visitor->endVisit(this); } void FunctionBody::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(elements, visitor); } visitor->endVisit(this); } void Program::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(elements, visitor); } visitor->endVisit(this); } void SourceElements::accept0(Visitor *visitor) { if (visitor->visit(this)) { for (SourceElements *it = this; it; it = it->next) { accept(it->element, visitor); } } visitor->endVisit(this); } void FunctionSourceElement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(declaration, visitor); } visitor->endVisit(this); } void StatementSourceElement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(statement, visitor); } visitor->endVisit(this); } void DebuggerStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void UiProgram::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(imports, visitor); accept(members, visitor); } visitor->endVisit(this); } void UiPublicMember::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(statement, visitor); accept(binding, visitor); } visitor->endVisit(this); } void UiObjectDefinition::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(qualifiedTypeNameId, visitor); accept(initializer, visitor); } visitor->endVisit(this); } void UiObjectInitializer::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(members, visitor); } visitor->endVisit(this); } void UiObjectBinding::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(qualifiedId, visitor); accept(qualifiedTypeNameId, visitor); accept(initializer, visitor); } visitor->endVisit(this); } void UiScriptBinding::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(qualifiedId, visitor); accept(statement, visitor); } visitor->endVisit(this); } void UiArrayBinding::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(qualifiedId, visitor); accept(members, visitor); } visitor->endVisit(this); } void UiObjectMemberList::accept0(Visitor *visitor) { if (visitor->visit(this)) { for (UiObjectMemberList *it = this; it; it = it->next) accept(it->member, visitor); } visitor->endVisit(this); } void UiArrayMemberList::accept0(Visitor *visitor) { if (visitor->visit(this)) { for (UiArrayMemberList *it = this; it; it = it->next) accept(it->member, visitor); } visitor->endVisit(this); } void UiQualifiedId::accept0(Visitor *visitor) { if (visitor->visit(this)) { } visitor->endVisit(this); } void UiImport::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(importUri, visitor); } visitor->endVisit(this); } void UiImportList::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(import, visitor); accept(next, visitor); } visitor->endVisit(this); } void UiSourceElement::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(sourceElement, visitor); } visitor->endVisit(this); } } // namespace AST } // namespace QbsQmlJS qbs-src-3.2.0/src/lib/corelib/parser/qmljslexer_p.h0000644000175100017510000001551215154533055021634 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 QMLJSLEXER_P_H #define QMLJSLEXER_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include "qmljsglobal_p.h" #include "qmljsgrammar_p.h" #include #include #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #include #endif namespace QbsQmlJS { class Engine; class QML_PARSER_EXPORT Directives { public: virtual ~Directives() = default; virtual void pragmaLibrary() { } virtual void importFile(const QString &jsfile, const QString &module) { Q_UNUSED(jsfile); Q_UNUSED(module); } virtual void importModule(const QString &uri, const QString &version, const QString &module) { Q_UNUSED(uri); Q_UNUSED(version); Q_UNUSED(module); } }; class QML_PARSER_EXPORT Lexer : public QmlJSGrammar { public: enum { T_ABSTRACT = T_RESERVED_WORD, T_BOOLEAN = T_RESERVED_WORD, T_BYTE = T_RESERVED_WORD, T_CHAR = T_RESERVED_WORD, T_CLASS = T_RESERVED_WORD, T_DOUBLE = T_RESERVED_WORD, T_ENUM = T_RESERVED_WORD, T_EXPORT = T_RESERVED_WORD, T_EXTENDS = T_RESERVED_WORD, T_FINAL = T_RESERVED_WORD, T_FLOAT = T_RESERVED_WORD, T_GOTO = T_RESERVED_WORD, T_IMPLEMENTS = T_RESERVED_WORD, T_INT = T_RESERVED_WORD, T_INTERFACE = T_RESERVED_WORD, T_LET = T_RESERVED_WORD, T_LONG = T_RESERVED_WORD, T_NATIVE = T_RESERVED_WORD, T_PACKAGE = T_RESERVED_WORD, T_PRIVATE = T_RESERVED_WORD, T_PROTECTED = T_RESERVED_WORD, T_SHORT = T_RESERVED_WORD, T_STATIC = T_RESERVED_WORD, T_SUPER = T_RESERVED_WORD, T_SYNCHRONIZED = T_RESERVED_WORD, T_THROWS = T_RESERVED_WORD, T_TRANSIENT = T_RESERVED_WORD, T_VOLATILE = T_RESERVED_WORD, T_YIELD = T_RESERVED_WORD }; enum Error { NoError, IllegalCharacter, UnclosedStringLiteral, IllegalEscapeSequence, IllegalUnicodeEscapeSequence, UnclosedComment, IllegalExponentIndicator, IllegalIdentifier }; enum RegExpBodyPrefix { NoPrefix, EqualPrefix }; enum RegExpFlag { RegExp_Global = 0x01, RegExp_IgnoreCase = 0x02, RegExp_Multiline = 0x04 }; public: Lexer(Engine *engine); bool qmlMode() const; QString code() const; void setCode(const QString &code, int lineno, bool qmlMode = true); int lex(); bool scanRegExp(RegExpBodyPrefix prefix = NoPrefix); bool scanDirectives(Directives *directives); int regExpFlags() const { return _patternFlags; } QString regExpPattern() const { return _tokenText; } int tokenKind() const { return _tokenKind; } int tokenOffset() const { return _tokenStartPtr - _code.unicode(); } int tokenLength() const { return _tokenLength; } int tokenStartLine() const { return _tokenLine; } int tokenStartColumn() const { return _tokenStartPtr - _tokenLinePtr + 1; } int tokenEndLine() const; int tokenEndColumn() const; inline QStringRef tokenSpell() const { return _tokenSpell; } double tokenValue() const { return _tokenValue; } QString tokenText() const; Error errorCode() const; QString errorMessage() const; bool prevTerminator() const; bool followsClosingBrace() const; bool canInsertAutomaticSemicolon(int token) const; enum ParenthesesState { IgnoreParentheses, CountParentheses, BalancedParentheses }; protected: int classify(const QChar *s, int n, bool qmlMode); private: inline void scanChar(); int scanToken(); int scanNumber(QChar ch); bool isLineTerminator() const; static bool isIdentLetter(QChar c); static bool isDecimalDigit(ushort c); static bool isHexDigit(QChar c); static bool isOctalDigit(ushort c); static bool isUnicodeEscapeSequence(const QChar *chars); void syncProhibitAutomaticSemicolon(); QChar decodeUnicodeEscapeCharacter(bool *ok); private: Engine *_engine; QString _code; QString _tokenText; QString _errorMessage; QStringRef _tokenSpell; const QChar *_codePtr; const QChar *_lastLinePtr; const QChar *_tokenLinePtr; const QChar *_tokenStartPtr; QChar _char; Error _errorCode; int _currentLineNumber; double _tokenValue; // parentheses state ParenthesesState _parenthesesState; int _parenthesesCount; int _stackToken; int _patternFlags; int _tokenKind; int _tokenLength; int _tokenLine; bool _validTokenText; bool _prohibitAutomaticSemicolon; bool _restrictedKeyword; bool _terminator; bool _followsClosingBrace; bool _delimited; bool _qmlMode; }; } // namespace QbsQmlJS #endif // LEXER_H qbs-src-3.2.0/src/lib/corelib/parser/qmljskeywords_p.h0000644000175100017510000005357115154533055022373 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 QMLJSKEYWORDS_P_H #define QMLJSKEYWORDS_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // namespace QbsQmlJS { static inline int classify2(const QChar *s, bool qmlMode) { if (s[0].unicode() == 'a') { if (s[1].unicode() == 's') { return qmlMode ? Lexer::T_AS : Lexer::T_RESERVED_WORD; } } else if (s[0].unicode() == 'd') { if (s[1].unicode() == 'o') { return Lexer::T_DO; } } else if (s[0].unicode() == 'i') { if (s[1].unicode() == 'f') { return Lexer::T_IF; } else if (s[1].unicode() == 'n') { return Lexer::T_IN; } } else if (qmlMode && s[0].unicode() == 'o') { if (s[1].unicode() == 'n') { return Lexer::T_ON; } } return Lexer::T_IDENTIFIER; } static inline int classify3(const QChar *s, bool /*qmlMode*/) { if (s[0].unicode() == 'f') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 'r') { return Lexer::T_FOR; } } } else if (s[0].unicode() == 'i') { if (s[1].unicode() == 'n') { if (s[2].unicode() == 't') { return Lexer::T_INT; } } } else if (s[0].unicode() == 'n') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 'w') { return Lexer::T_NEW; } } } else if (s[0].unicode() == 't') { if (s[1].unicode() == 'r') { if (s[2].unicode() == 'y') { return Lexer::T_TRY; } } } else if (s[0].unicode() == 'v') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'r') { return Lexer::T_VAR; } } } return Lexer::T_IDENTIFIER; } static inline int classify4(const QChar *s, bool /*qmlMode*/) { if (s[0].unicode() == 'b') { if (s[1].unicode() == 'y') { if (s[2].unicode() == 't') { if (s[3].unicode() == 'e') { return Lexer::T_BYTE; } } } } else if (s[0].unicode() == 'c') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 's') { if (s[3].unicode() == 'e') { return Lexer::T_CASE; } } } else if (s[1].unicode() == 'h') { if (s[2].unicode() == 'a') { if (s[3].unicode() == 'r') { return Lexer::T_CHAR; } } } } else if (s[0].unicode() == 'e') { if (s[1].unicode() == 'l') { if (s[2].unicode() == 's') { if (s[3].unicode() == 'e') { return Lexer::T_ELSE; } } } else if (s[1].unicode() == 'n') { if (s[2].unicode() == 'u') { if (s[3].unicode() == 'm') { return Lexer::T_ENUM; } } } } else if (s[0].unicode() == 'g') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 't') { if (s[3].unicode() == 'o') { return Lexer::T_GOTO; } } } } else if (s[0].unicode() == 'l') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 'n') { if (s[3].unicode() == 'g') { return Lexer::T_LONG; } } } } else if (s[0].unicode() == 'n') { if (s[1].unicode() == 'u') { if (s[2].unicode() == 'l') { if (s[3].unicode() == 'l') { return Lexer::T_NULL; } } } } else if (s[0].unicode() == 't') { if (s[1].unicode() == 'h') { if (s[2].unicode() == 'i') { if (s[3].unicode() == 's') { return Lexer::T_THIS; } } } else if (s[1].unicode() == 'r') { if (s[2].unicode() == 'u') { if (s[3].unicode() == 'e') { return Lexer::T_TRUE; } } } } else if (s[0].unicode() == 'v') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 'i') { if (s[3].unicode() == 'd') { return Lexer::T_VOID; } } } } else if (s[0].unicode() == 'w') { if (s[1].unicode() == 'i') { if (s[2].unicode() == 't') { if (s[3].unicode() == 'h') { return Lexer::T_WITH; } } } } return Lexer::T_IDENTIFIER; } static inline int classify5(const QChar *s, bool /*qmlMode*/) { if (s[0].unicode() == 'b') { if (s[1].unicode() == 'r') { if (s[2].unicode() == 'e') { if (s[3].unicode() == 'a') { if (s[4].unicode() == 'k') { return Lexer::T_BREAK; } } } } } else if (s[0].unicode() == 'c') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 't') { if (s[3].unicode() == 'c') { if (s[4].unicode() == 'h') { return Lexer::T_CATCH; } } } } else if (s[1].unicode() == 'l') { if (s[2].unicode() == 'a') { if (s[3].unicode() == 's') { if (s[4].unicode() == 's') { return Lexer::T_CLASS; } } } } else if (s[1].unicode() == 'o') { if (s[2].unicode() == 'n') { if (s[3].unicode() == 's') { if (s[4].unicode() == 't') { return Lexer::T_CONST; } } } } } else if (s[0].unicode() == 'f') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'l') { if (s[3].unicode() == 's') { if (s[4].unicode() == 'e') { return Lexer::T_FALSE; } } } } else if (s[1].unicode() == 'i') { if (s[2].unicode() == 'n') { if (s[3].unicode() == 'a') { if (s[4].unicode() == 'l') { return Lexer::T_FINAL; } } } } else if (s[1].unicode() == 'l') { if (s[2].unicode() == 'o') { if (s[3].unicode() == 'a') { if (s[4].unicode() == 't') { return Lexer::T_FLOAT; } } } } } else if (s[0].unicode() == 's') { if (s[1].unicode() == 'h') { if (s[2].unicode() == 'o') { if (s[3].unicode() == 'r') { if (s[4].unicode() == 't') { return Lexer::T_SHORT; } } } } else if (s[1].unicode() == 'u') { if (s[2].unicode() == 'p') { if (s[3].unicode() == 'e') { if (s[4].unicode() == 'r') { return Lexer::T_SUPER; } } } } } else if (s[0].unicode() == 't') { if (s[1].unicode() == 'h') { if (s[2].unicode() == 'r') { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'w') { return Lexer::T_THROW; } } } } } else if (s[0].unicode() == 'w') { if (s[1].unicode() == 'h') { if (s[2].unicode() == 'i') { if (s[3].unicode() == 'l') { if (s[4].unicode() == 'e') { return Lexer::T_WHILE; } } } } } return Lexer::T_IDENTIFIER; } static inline int classify6(const QChar *s, bool qmlMode) { if (s[0].unicode() == 'd') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 'l') { if (s[3].unicode() == 'e') { if (s[4].unicode() == 't') { if (s[5].unicode() == 'e') { return Lexer::T_DELETE; } } } } } else if (s[1].unicode() == 'o') { if (s[2].unicode() == 'u') { if (s[3].unicode() == 'b') { if (s[4].unicode() == 'l') { if (s[5].unicode() == 'e') { return Lexer::T_DOUBLE; } } } } } } else if (s[0].unicode() == 'e') { if (s[1].unicode() == 'x') { if (s[2].unicode() == 'p') { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'r') { if (s[5].unicode() == 't') { return Lexer::T_EXPORT; } } } } } } else if (s[0].unicode() == 'i') { if (s[1].unicode() == 'm') { if (s[2].unicode() == 'p') { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'r') { if (s[5].unicode() == 't') { return qmlMode ? Lexer::T_IMPORT : Lexer::T_RESERVED_WORD; } } } } } } else if (s[0].unicode() == 'n') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 't') { if (s[3].unicode() == 'i') { if (s[4].unicode() == 'v') { if (s[5].unicode() == 'e') { return Lexer::T_NATIVE; } } } } } } else if (s[0].unicode() == 'p') { if (s[1].unicode() == 'u') { if (s[2].unicode() == 'b') { if (s[3].unicode() == 'l') { if (s[4].unicode() == 'i') { if (s[5].unicode() == 'c') { return qmlMode ? Lexer::T_PUBLIC : Lexer::T_RESERVED_WORD; } } } } } } else if (s[0].unicode() == 'r') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 't') { if (s[3].unicode() == 'u') { if (s[4].unicode() == 'r') { if (s[5].unicode() == 'n') { return Lexer::T_RETURN; } } } } } } else if (s[0].unicode() == 's') { if (qmlMode && s[1].unicode() == 'i') { if (s[2].unicode() == 'g') { if (s[3].unicode() == 'n') { if (s[4].unicode() == 'a') { if (s[5].unicode() == 'l') { return Lexer::T_SIGNAL; } } } } } else if (s[1].unicode() == 't') { if (s[2].unicode() == 'a') { if (s[3].unicode() == 't') { if (s[4].unicode() == 'i') { if (s[5].unicode() == 'c') { return Lexer::T_STATIC; } } } } } else if (s[1].unicode() == 'w') { if (s[2].unicode() == 'i') { if (s[3].unicode() == 't') { if (s[4].unicode() == 'c') { if (s[5].unicode() == 'h') { return Lexer::T_SWITCH; } } } } } } else if (s[0].unicode() == 't') { if (s[1].unicode() == 'h') { if (s[2].unicode() == 'r') { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'w') { if (s[5].unicode() == 's') { return Lexer::T_THROWS; } } } } } else if (s[1].unicode() == 'y') { if (s[2].unicode() == 'p') { if (s[3].unicode() == 'e') { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'f') { return Lexer::T_TYPEOF; } } } } } } return Lexer::T_IDENTIFIER; } static inline int classify7(const QChar *s, bool /*qmlMode*/) { if (s[0].unicode() == 'b') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 'o') { if (s[3].unicode() == 'l') { if (s[4].unicode() == 'e') { if (s[5].unicode() == 'a') { if (s[6].unicode() == 'n') { return Lexer::T_BOOLEAN; } } } } } } } else if (s[0].unicode() == 'd') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 'f') { if (s[3].unicode() == 'a') { if (s[4].unicode() == 'u') { if (s[5].unicode() == 'l') { if (s[6].unicode() == 't') { return Lexer::T_DEFAULT; } } } } } } } else if (s[0].unicode() == 'e') { if (s[1].unicode() == 'x') { if (s[2].unicode() == 't') { if (s[3].unicode() == 'e') { if (s[4].unicode() == 'n') { if (s[5].unicode() == 'd') { if (s[6].unicode() == 's') { return Lexer::T_EXTENDS; } } } } } } } else if (s[0].unicode() == 'f') { if (s[1].unicode() == 'i') { if (s[2].unicode() == 'n') { if (s[3].unicode() == 'a') { if (s[4].unicode() == 'l') { if (s[5].unicode() == 'l') { if (s[6].unicode() == 'y') { return Lexer::T_FINALLY; } } } } } } } else if (s[0].unicode() == 'p') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'c') { if (s[3].unicode() == 'k') { if (s[4].unicode() == 'a') { if (s[5].unicode() == 'g') { if (s[6].unicode() == 'e') { return Lexer::T_PACKAGE; } } } } } } else if (s[1].unicode() == 'r') { if (s[2].unicode() == 'i') { if (s[3].unicode() == 'v') { if (s[4].unicode() == 'a') { if (s[5].unicode() == 't') { if (s[6].unicode() == 'e') { return Lexer::T_PRIVATE; } } } } } } } return Lexer::T_IDENTIFIER; } static inline int classify8(const QChar *s, bool qmlMode) { if (s[0].unicode() == 'a') { if (s[1].unicode() == 'b') { if (s[2].unicode() == 's') { if (s[3].unicode() == 't') { if (s[4].unicode() == 'r') { if (s[5].unicode() == 'a') { if (s[6].unicode() == 'c') { if (s[7].unicode() == 't') { return Lexer::T_ABSTRACT; } } } } } } } } else if (s[0].unicode() == 'c') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 'n') { if (s[3].unicode() == 't') { if (s[4].unicode() == 'i') { if (s[5].unicode() == 'n') { if (s[6].unicode() == 'u') { if (s[7].unicode() == 'e') { return Lexer::T_CONTINUE; } } } } } } } } else if (s[0].unicode() == 'd') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 'b') { if (s[3].unicode() == 'u') { if (s[4].unicode() == 'g') { if (s[5].unicode() == 'g') { if (s[6].unicode() == 'e') { if (s[7].unicode() == 'r') { return Lexer::T_DEBUGGER; } } } } } } } } else if (s[0].unicode() == 'f') { if (s[1].unicode() == 'u') { if (s[2].unicode() == 'n') { if (s[3].unicode() == 'c') { if (s[4].unicode() == 't') { if (s[5].unicode() == 'i') { if (s[6].unicode() == 'o') { if (s[7].unicode() == 'n') { return Lexer::T_FUNCTION; } } } } } } } } else if (qmlMode && s[0].unicode() == 'p') { if (s[1].unicode() == 'r') { if (s[2].unicode() == 'o') { if (s[3].unicode() == 'p') { if (s[4].unicode() == 'e') { if (s[5].unicode() == 'r') { if (s[6].unicode() == 't') { if (s[7].unicode() == 'y') { return Lexer::T_PROPERTY; } } } } } } } } else if (qmlMode && s[0].unicode() == 'r') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 'a') { if (s[3].unicode() == 'd') { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'n') { if (s[6].unicode() == 'l') { if (s[7].unicode() == 'y') { return Lexer::T_READONLY; } } } } } } } } else if (s[0].unicode() == 'v') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 'l') { if (s[3].unicode() == 'a') { if (s[4].unicode() == 't') { if (s[5].unicode() == 'i') { if (s[6].unicode() == 'l') { if (s[7].unicode() == 'e') { return Lexer::T_VOLATILE; } } } } } } } } return Lexer::T_IDENTIFIER; } static inline int classify9(const QChar *s, bool /*qmlMode*/) { if (s[0].unicode() == 'i') { if (s[1].unicode() == 'n') { if (s[2].unicode() == 't') { if (s[3].unicode() == 'e') { if (s[4].unicode() == 'r') { if (s[5].unicode() == 'f') { if (s[6].unicode() == 'a') { if (s[7].unicode() == 'c') { if (s[8].unicode() == 'e') { return Lexer::T_INTERFACE; } } } } } } } } } else if (s[0].unicode() == 'p') { if (s[1].unicode() == 'r') { if (s[2].unicode() == 'o') { if (s[3].unicode() == 't') { if (s[4].unicode() == 'e') { if (s[5].unicode() == 'c') { if (s[6].unicode() == 't') { if (s[7].unicode() == 'e') { if (s[8].unicode() == 'd') { return Lexer::T_PROTECTED; } } } } } } } } } else if (s[0].unicode() == 't') { if (s[1].unicode() == 'r') { if (s[2].unicode() == 'a') { if (s[3].unicode() == 'n') { if (s[4].unicode() == 's') { if (s[5].unicode() == 'i') { if (s[6].unicode() == 'e') { if (s[7].unicode() == 'n') { if (s[8].unicode() == 't') { return Lexer::T_TRANSIENT; } } } } } } } } } return Lexer::T_IDENTIFIER; } static inline int classify10(const QChar *s, bool /*qmlMode*/) { if (s[0].unicode() == 'i') { if (s[1].unicode() == 'm') { if (s[2].unicode() == 'p') { if (s[3].unicode() == 'l') { if (s[4].unicode() == 'e') { if (s[5].unicode() == 'm') { if (s[6].unicode() == 'e') { if (s[7].unicode() == 'n') { if (s[8].unicode() == 't') { if (s[9].unicode() == 's') { return Lexer::T_IMPLEMENTS; } } } } } } } } } else if (s[1].unicode() == 'n') { if (s[2].unicode() == 's') { if (s[3].unicode() == 't') { if (s[4].unicode() == 'a') { if (s[5].unicode() == 'n') { if (s[6].unicode() == 'c') { if (s[7].unicode() == 'e') { if (s[8].unicode() == 'o') { if (s[9].unicode() == 'f') { return Lexer::T_INSTANCEOF; } } } } } } } } } } return Lexer::T_IDENTIFIER; } static inline int classify12(const QChar *s, bool /*qmlMode*/) { if (s[0].unicode() == 's') { if (s[1].unicode() == 'y') { if (s[2].unicode() == 'n') { if (s[3].unicode() == 'c') { if (s[4].unicode() == 'h') { if (s[5].unicode() == 'r') { if (s[6].unicode() == 'o') { if (s[7].unicode() == 'n') { if (s[8].unicode() == 'i') { if (s[9].unicode() == 'z') { if (s[10].unicode() == 'e') { if (s[11].unicode() == 'd') { return Lexer::T_SYNCHRONIZED; } } } } } } } } } } } } return Lexer::T_IDENTIFIER; } int Lexer::classify(const QChar *s, int n, bool qmlMode) { switch (n) { case 2: return classify2(s, qmlMode); case 3: return classify3(s, qmlMode); case 4: return classify4(s, qmlMode); case 5: return classify5(s, qmlMode); case 6: return classify6(s, qmlMode); case 7: return classify7(s, qmlMode); case 8: return classify8(s, qmlMode); case 9: return classify9(s, qmlMode); case 10: return classify10(s, qmlMode); case 12: return classify12(s, qmlMode); default: return Lexer::T_IDENTIFIER; } // switch } } // namespace QbsQmlJS #endif // QMLJSKEYWORDS_P_H qbs-src-3.2.0/src/lib/corelib/parser/qmljsastvisitor.cpp0000644000175100017510000000402115154533055022731 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "qmljsastvisitor_p.h" namespace QbsQmlJS { namespace AST { Visitor::Visitor() = default; Visitor::~Visitor() = default; } // namespace AST } // namespace QbsQmlJS qbs-src-3.2.0/src/lib/corelib/parser/qmljs.g0000644000175100017510000024423515154533055020262 0ustar runnerrunner----------------------------------------------------------------------------- -- -- Copyright (C) 2016 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$ -- ----------------------------------------------------------------------------- %parser QmlJSGrammar %decl qmljsparser_p.h %impl qdeclarativejsparser.cpp %expect 2 %expect-rr 2 %token T_AND "&" T_AND_AND "&&" T_AND_EQ "&=" %token T_BREAK "break" T_CASE "case" T_CATCH "catch" %token T_COLON ":" T_COMMA "," T_CONTINUE "continue" %token T_DEFAULT "default" T_DELETE "delete" T_DIVIDE_ "/" %token T_DIVIDE_EQ "/=" T_DO "do" T_DOT "." %token T_ELSE "else" T_EQ "=" T_EQ_EQ "==" %token T_EQ_EQ_EQ "===" T_FINALLY "finally" T_FOR "for" %token T_FUNCTION "function" T_GE ">=" T_GT ">" %token T_GT_GT ">>" T_GT_GT_EQ ">>=" T_GT_GT_GT ">>>" %token T_GT_GT_GT_EQ ">>>=" T_IDENTIFIER "identifier" T_IF "if" %token T_IN "in" T_INSTANCEOF "instanceof" T_LBRACE "{" %token T_LBRACKET "[" T_LE "<=" T_LPAREN "(" %token T_LT "<" T_LT_LT "<<" T_LT_LT_EQ "<<=" %token T_MINUS "-" T_MINUS_EQ "-=" T_MINUS_MINUS "--" %token T_NEW "new" T_NOT "!" T_NOT_EQ "!=" %token T_NOT_EQ_EQ "!==" T_NUMERIC_LITERAL "numeric literal" T_OR "|" %token T_OR_EQ "|=" T_OR_OR "||" T_PLUS "+" %token T_PLUS_EQ "+=" T_PLUS_PLUS "++" T_QUESTION "?" %token T_RBRACE "}" T_RBRACKET "]" T_REMAINDER "%" %token T_REMAINDER_EQ "%=" T_RETURN "return" T_RPAREN ")" %token T_SEMICOLON ";" T_AUTOMATIC_SEMICOLON T_STAR "*" %token T_STAR_EQ "*=" T_STRING_LITERAL "string literal" %token T_PROPERTY "property" T_SIGNAL "signal" T_READONLY "readonly" %token T_SWITCH "switch" T_THIS "this" T_THROW "throw" %token T_TILDE "~" T_TRY "try" T_TYPEOF "typeof" %token T_VAR "var" T_VOID "void" T_WHILE "while" %token T_WITH "with" T_XOR "^" T_XOR_EQ "^=" %token T_NULL "null" T_TRUE "true" T_FALSE "false" %token T_CONST "const" %token T_DEBUGGER "debugger" %token T_RESERVED_WORD "reserved word" %token T_MULTILINE_STRING_LITERAL "multiline string literal" %token T_COMMENT "comment" --- context keywords. %token T_PUBLIC "public" %token T_IMPORT "import" %token T_AS "as" %token T_ON "on" %token T_ERROR --- feed tokens %token T_FEED_UI_PROGRAM %token T_FEED_UI_OBJECT_MEMBER %token T_FEED_JS_STATEMENT %token T_FEED_JS_EXPRESSION %token T_FEED_JS_SOURCE_ELEMENT %token T_FEED_JS_PROGRAM %nonassoc SHIFT_THERE %nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY T_READONLY %nonassoc REDUCE_HERE %start TopLevel /./**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include #include #include #include "qmljsengine_p.h" #include "qmljslexer_p.h" #include "qmljsast_p.h" #include "qmljsmemorypool_p.h" ./ /:/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // // // This file is automatically generated from qmljs.g. // Changes will be lost. // #ifndef QMLJSPARSER_P_H #define QMLJSPARSER_P_H #include "qmljsglobal_p.h" #include "qmljsgrammar_p.h" #include "qmljsast_p.h" #include "qmljsengine_p.h" #include #include #include namespace QbsQmlJS { class Engine; class QBS_AUTOTEST_EXPORT Parser: protected $table { public: union Value { int ival; double dval; AST::ArgumentList *ArgumentList; AST::CaseBlock *CaseBlock; AST::CaseClause *CaseClause; AST::CaseClauses *CaseClauses; AST::Catch *Catch; AST::DefaultClause *DefaultClause; AST::ElementList *ElementList; AST::Elision *Elision; AST::ExpressionNode *Expression; AST::Finally *Finally; AST::FormalParameterList *FormalParameterList; AST::FunctionBody *FunctionBody; AST::FunctionDeclaration *FunctionDeclaration; AST::Node *Node; AST::PropertyName *PropertyName; AST::PropertyNameAndValueList *PropertyNameAndValueList; AST::SourceElement *SourceElement; AST::SourceElements *SourceElements; AST::Statement *Statement; AST::StatementList *StatementList; AST::Block *Block; AST::VariableDeclaration *VariableDeclaration; AST::VariableDeclarationList *VariableDeclarationList; AST::UiProgram *UiProgram; AST::UiImportList *UiImportList; AST::UiImport *UiImport; AST::UiParameterList *UiParameterList; AST::UiPublicMember *UiPublicMember; AST::UiObjectDefinition *UiObjectDefinition; AST::UiObjectInitializer *UiObjectInitializer; AST::UiObjectBinding *UiObjectBinding; AST::UiScriptBinding *UiScriptBinding; AST::UiArrayBinding *UiArrayBinding; AST::UiObjectMember *UiObjectMember; AST::UiObjectMemberList *UiObjectMemberList; AST::UiArrayMemberList *UiArrayMemberList; AST::UiQualifiedId *UiQualifiedId; }; public: Parser(Engine *engine); ~Parser(); // parse a UI program bool parse() { return parse(T_FEED_UI_PROGRAM); } bool parseStatement() { return parse(T_FEED_JS_STATEMENT); } bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); } bool parseSourceElement() { return parse(T_FEED_JS_SOURCE_ELEMENT); } bool parseUiObjectMember() { return parse(T_FEED_UI_OBJECT_MEMBER); } bool parseProgram() { return parse(T_FEED_JS_PROGRAM); } AST::UiProgram *ast() const { return AST::cast(program); } AST::Statement *statement() const { if (! program) return nullptr; return program->statementCast(); } AST::ExpressionNode *expression() const { if (! program) return nullptr; return program->expressionCast(); } AST::UiObjectMember *uiObjectMember() const { if (! program) return nullptr; return program->uiObjectMemberCast(); } AST::Node *rootNode() const { return program; } QList diagnosticMessages() const { return diagnostic_messages; } inline DiagnosticMessage diagnosticMessage() const { foreach (const DiagnosticMessage &d, diagnostic_messages) { if (d.kind != DiagnosticMessage::Warning) return d; } return DiagnosticMessage(); } inline QString errorMessage() const { return diagnosticMessage().message; } inline int errorLineNumber() const { return diagnosticMessage().loc.startLine; } inline int errorColumnNumber() const { return diagnosticMessage().loc.startColumn; } protected: bool parse(int startToken); void reallocateStack(); inline Value &sym(int index) { return sym_stack [tos + index - 1]; } inline QStringRef &stringRef(int index) { return string_stack [tos + index - 1]; } inline AST::SourceLocation &loc(int index) { return location_stack [tos + index - 1]; } AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr); protected: Engine *driver; MemoryPool *pool; int tos; int stack_size; Value *sym_stack; int *state_stack; AST::SourceLocation *location_stack; QStringRef *string_stack; AST::Node *program; // error recovery enum { TOKEN_BUFFER_SIZE = 3 }; struct SavedToken { int token = 0; double dval = 0.0; AST::SourceLocation loc; QStringRef spell; }; double yylval = 0.0; QStringRef yytokenspell; AST::SourceLocation yylloc; AST::SourceLocation yyprevlloc; SavedToken token_buffer[TOKEN_BUFFER_SIZE]; SavedToken *first_token; SavedToken *last_token; QList diagnostic_messages; }; } // end of namespace QbsQmlJS :/ /. #include "qmljsparser_p.h" #include // // This file is automatically generated from qmljs.g. // Changes will be lost. // using namespace QmlJS; QT_QML_BEGIN_NAMESPACE void Parser::reallocateStack() { if (! stack_size) stack_size = 128; else stack_size <<= 1; sym_stack = reinterpret_cast (realloc(sym_stack, stack_size * sizeof(Value))); state_stack = reinterpret_cast (realloc(state_stack, stack_size * sizeof(int))); location_stack = reinterpret_cast (realloc(location_stack, stack_size * sizeof(AST::SourceLocation))); string_stack = reinterpret_cast (realloc(string_stack, stack_size * sizeof(QStringRef))); } Parser::Parser(Engine *engine): driver(engine), pool(engine->pool()), tos(0), stack_size(0), sym_stack(0), state_stack(0), location_stack(0), string_stack(0), first_token(0), last_token(0) { } Parser::~Parser() { if (stack_size) { free(sym_stack); free(state_stack); free(location_stack); free(string_stack); } } static inline AST::SourceLocation location(Lexer *lexer) { AST::SourceLocation loc; loc.offset = lexer->tokenOffset(); loc.length = lexer->tokenLength(); loc.startLine = lexer->tokenStartLine(); loc.startColumn = lexer->tokenStartColumn(); return loc; } AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) { QVarLengthArray nameIds; QVarLengthArray locations; AST::ExpressionNode *it = expr; while (AST::FieldMemberExpression *m = AST::cast(it)) { nameIds.append(m->name); locations.append(m->identifierToken); it = m->base; } if (AST::IdentifierExpression *idExpr = AST::cast(it)) { AST::UiQualifiedId *q = new (pool) AST::UiQualifiedId(idExpr->name); q->identifierToken = idExpr->identifierToken; AST::UiQualifiedId *currentId = q; for (int i = nameIds.size() - 1; i != -1; --i) { currentId = new (pool) AST::UiQualifiedId(currentId, nameIds[i]); currentId->identifierToken = locations[i]; } return currentId->finish(); } return nullptr; } bool Parser::parse(int startToken) { Lexer *lexer = driver->lexer(); bool hadErrors = false; int yytoken = -1; int action = 0; token_buffer[0].token = startToken; first_token = &token_buffer[0]; last_token = &token_buffer[1]; tos = -1; program = 0; do { if (++tos == stack_size) reallocateStack(); state_stack[tos] = action; _Lcheck_token: if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) { yyprevlloc = yylloc; if (first_token == last_token) { yytoken = lexer->lex(); yylval = lexer->tokenValue(); yytokenspell = lexer->tokenSpell(); yylloc = location(lexer); } else { yytoken = first_token->token; yylval = first_token->dval; yytokenspell = first_token->spell; yylloc = first_token->loc; ++first_token; } } action = t_action(action, yytoken); if (action > 0) { if (action != ACCEPT_STATE) { yytoken = -1; sym(1).dval = yylval; stringRef(1) = yytokenspell; loc(1) = yylloc; } else { --tos; return ! hadErrors; } } else if (action < 0) { const int r = -action - 1; tos -= rhs[r]; switch (r) { ./ -------------------------------------------------------------------------------------------------------- -- Declarative UI -------------------------------------------------------------------------------------------------------- TopLevel: T_FEED_UI_PROGRAM UiProgram ; /. case $rule_number: { sym(1).Node = sym(2).Node; program = sym(1).Node; } break; ./ TopLevel: T_FEED_JS_STATEMENT Statement ; /. case $rule_number: { sym(1).Node = sym(2).Node; program = sym(1).Node; } break; ./ TopLevel: T_FEED_JS_EXPRESSION Expression ; /. case $rule_number: { sym(1).Node = sym(2).Node; program = sym(1).Node; } break; ./ TopLevel: T_FEED_JS_SOURCE_ELEMENT SourceElement ; /. case $rule_number: { sym(1).Node = sym(2).Node; program = sym(1).Node; } break; ./ TopLevel: T_FEED_UI_OBJECT_MEMBER UiObjectMember ; /. case $rule_number: { sym(1).Node = sym(2).Node; program = sym(1).Node; } break; ./ TopLevel: T_FEED_JS_PROGRAM Program ; /. case $rule_number: { sym(1).Node = sym(2).Node; program = sym(1).Node; } break; ./ UiProgram: UiImportListOpt UiRootMember ; /. case $rule_number: { sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiImportList, sym(2).UiObjectMemberList->finish()); } break; ./ UiImportListOpt: Empty ; UiImportListOpt: UiImportList ; /. case $rule_number: { sym(1).Node = sym(1).UiImportList->finish(); } break; ./ UiImportList: UiImport ; /. case $rule_number: { sym(1).Node = new (pool) AST::UiImportList(sym(1).UiImport); } break; ./ UiImportList: UiImportList UiImport ; /. case $rule_number: { sym(1).Node = new (pool) AST::UiImportList(sym(1).UiImportList, sym(2).UiImport); } break; ./ ImportId: MemberExpression ; UiImport: UiImportHead T_AUTOMATIC_SEMICOLON ; UiImport: UiImportHead T_SEMICOLON ; /. case $rule_number: { sym(1).UiImport->semicolonToken = loc(2); } break; ./ UiImport: UiImportHead T_NUMERIC_LITERAL T_AUTOMATIC_SEMICOLON ; UiImport: UiImportHead T_NUMERIC_LITERAL T_SEMICOLON ; /. case $rule_number: { sym(1).UiImport->versionToken = loc(2); sym(1).UiImport->semicolonToken = loc(3); } break; ./ UiImport: UiImportHead T_NUMERIC_LITERAL T_AS JsIdentifier T_AUTOMATIC_SEMICOLON ; UiImport: UiImportHead T_NUMERIC_LITERAL T_AS JsIdentifier T_SEMICOLON ; /. case $rule_number: { sym(1).UiImport->versionToken = loc(2); sym(1).UiImport->asToken = loc(3); sym(1).UiImport->importIdToken = loc(4); sym(1).UiImport->importId = stringRef(4); sym(1).UiImport->semicolonToken = loc(5); } break; ./ UiImport: UiImportHead T_AS JsIdentifier T_AUTOMATIC_SEMICOLON ; UiImport: UiImportHead T_AS JsIdentifier T_SEMICOLON ; /. case $rule_number: { sym(1).UiImport->asToken = loc(2); sym(1).UiImport->importIdToken = loc(3); sym(1).UiImport->importId = stringRef(3); sym(1).UiImport->semicolonToken = loc(4); } break; ./ UiImportHead: T_IMPORT ImportId ; /. case $rule_number: { AST::UiImport *node = 0; if (AST::StringLiteral *importIdLiteral = AST::cast(sym(2).Expression)) { node = new (pool) AST::UiImport(importIdLiteral->value); node->fileNameToken = loc(2); } else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) { node = new (pool) AST::UiImport(qualifiedId); node->fileNameToken = loc(2); } sym(1).Node = node; if (node) { node->importToken = loc(1); } else { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1), QLatin1String("Expected a qualified name id or a string literal"))); return false; // ### remove me } } break; ./ Empty: ; /. case $rule_number: { sym(1).Node = 0; } break; ./ UiRootMember: UiObjectDefinition ; /. case $rule_number: { sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); } break; ./ UiObjectMemberList: UiObjectMember ; /. case $rule_number: { sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember); } break; ./ UiObjectMemberList: UiObjectMemberList UiObjectMember ; /. case $rule_number: { AST::UiObjectMemberList *node = new (pool) AST:: UiObjectMemberList( sym(1).UiObjectMemberList, sym(2).UiObjectMember); sym(1).Node = node; } break; ./ UiArrayMemberList: UiObjectDefinition ; /. case $rule_number: { sym(1).Node = new (pool) AST::UiArrayMemberList(sym(1).UiObjectMember); } break; ./ UiArrayMemberList: UiArrayMemberList T_COMMA UiObjectDefinition ; /. case $rule_number: { AST::UiArrayMemberList *node = new (pool) AST::UiArrayMemberList( sym(1).UiArrayMemberList, sym(3).UiObjectMember); node->commaToken = loc(2); sym(1).Node = node; } break; ./ UiObjectInitializer: T_LBRACE T_RBRACE ; /. case $rule_number: { AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer((AST::UiObjectMemberList*)0); node->lbraceToken = loc(1); node->rbraceToken = loc(2); sym(1).Node = node; } break; ./ UiObjectInitializer: T_LBRACE UiObjectMemberList T_RBRACE ; /. case $rule_number: { AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer(sym(2).UiObjectMemberList->finish()); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; ./ UiObjectDefinition: UiQualifiedId UiObjectInitializer ; /. case $rule_number: { AST::UiObjectDefinition *node = new (pool) AST::UiObjectDefinition(sym(1).UiQualifiedId, sym(2).UiObjectInitializer); sym(1).Node = node; } break; ./ UiObjectMember: UiObjectDefinition ; UiObjectMember: UiQualifiedId T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET ; /. case $rule_number: { AST::UiArrayBinding *node = new (pool) AST::UiArrayBinding( sym(1).UiQualifiedId, sym(4).UiArrayMemberList->finish()); node->colonToken = loc(2); node->lbracketToken = loc(3); node->rbracketToken = loc(5); sym(1).Node = node; } break; ./ UiObjectMember: UiQualifiedId T_COLON UiQualifiedId UiObjectInitializer ; /. case $rule_number: { AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding( sym(1).UiQualifiedId, sym(3).UiQualifiedId, sym(4).UiObjectInitializer); node->colonToken = loc(2); sym(1).Node = node; } break; ./ UiObjectMember: UiQualifiedId T_ON UiQualifiedId UiObjectInitializer ; /. case $rule_number: { AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding( sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer); node->colonToken = loc(2); node->hasOnToken = true; sym(1).Node = node; } break; ./ UiScriptStatement: Block ; UiScriptStatement: EmptyStatement ; UiScriptStatement: ExpressionStatement ; UiScriptStatement: IfStatement ; UiScriptStatement: WithStatement ; UiScriptStatement: SwitchStatement ; UiScriptStatement: TryStatement ; UiObjectMember: UiQualifiedId T_COLON UiScriptStatement ; /. case $rule_number: { AST::UiScriptBinding *node = new (pool) AST::UiScriptBinding( sym(1).UiQualifiedId, sym(3).Statement); node->colonToken = loc(2); sym(1).Node = node; } break; ./ UiPropertyType: T_VAR ; UiPropertyType: T_RESERVED_WORD ; UiPropertyType: T_IDENTIFIER ; UiParameterListOpt: ; /. case $rule_number: { sym(1).Node = 0; } break; ./ UiParameterListOpt: UiParameterList ; /. case $rule_number: { sym(1).Node = sym(1).UiParameterList->finish (); } break; ./ UiParameterList: UiPropertyType JsIdentifier ; /. case $rule_number: { AST::UiParameterList *node = new (pool) AST::UiParameterList(stringRef(1), stringRef(2)); node->propertyTypeToken = loc(1); node->identifierToken = loc(2); sym(1).Node = node; } break; ./ UiParameterList: UiParameterList T_COMMA UiPropertyType JsIdentifier ; /. case $rule_number: { AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiParameterList, stringRef(3), stringRef(4)); node->commaToken = loc(2); node->identifierToken = loc(4); sym(1).Node = node; } break; ./ UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_AUTOMATIC_SEMICOLON ; UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_SEMICOLON ; /. case $rule_number: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(QStringRef(), stringRef(2)); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); node->typeToken = loc(2); node->identifierToken = loc(2); node->parameters = sym(4).UiParameterList; node->semicolonToken = loc(6); sym(1).Node = node; } break; ./ UiObjectMember: T_SIGNAL T_IDENTIFIER T_AUTOMATIC_SEMICOLON ; UiObjectMember: T_SIGNAL T_IDENTIFIER T_SEMICOLON ; /. case $rule_number: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(QStringRef(), stringRef(2)); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); node->typeToken = loc(2); node->identifierToken = loc(2); node->semicolonToken = loc(3); sym(1).Node = node; } break; ./ UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_AUTOMATIC_SEMICOLON ; UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_SEMICOLON ; /. case $rule_number: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(4), stringRef(6)); node->typeModifier = stringRef(2); node->propertyToken = loc(1); node->typeModifierToken = loc(2); node->typeToken = loc(4); node->identifierToken = loc(6); node->semicolonToken = loc(7); sym(1).Node = node; } break; ./ UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEMICOLON ; UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ; /. case $rule_number: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3)); node->propertyToken = loc(1); node->typeToken = loc(2); node->identifierToken = loc(3); node->semicolonToken = loc(4); sym(1).Node = node; } break; ./ UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEMICOLON ; UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ; /. case $rule_number: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4)); node->isDefaultMember = true; node->defaultToken = loc(1); node->propertyToken = loc(2); node->typeToken = loc(3); node->identifierToken = loc(4); node->semicolonToken = loc(5); sym(1).Node = node; } break; ./ UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ; /. case $rule_number: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3), sym(5).Statement); node->propertyToken = loc(1); node->typeToken = loc(2); node->identifierToken = loc(3); node->colonToken = loc(4); sym(1).Node = node; } break; ./ UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ; /. case $rule_number: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4), sym(6).Statement); node->isReadonlyMember = true; node->readonlyToken = loc(1); node->propertyToken = loc(2); node->typeToken = loc(3); node->identifierToken = loc(4); node->colonToken = loc(5); sym(1).Node = node; } break; ./ UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ; /. case $rule_number: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4), sym(6).Statement); node->isDefaultMember = true; node->defaultToken = loc(1); node->propertyToken = loc(2); node->typeToken = loc(3); node->identifierToken = loc(4); node->colonToken = loc(5); sym(1).Node = node; } break; ./ UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET ; /. case $rule_number: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(4), stringRef(6)); node->typeModifier = stringRef(2); node->propertyToken = loc(1); node->typeModifierToken = loc(2); node->typeToken = loc(4); node->identifierToken = loc(6); node->semicolonToken = loc(7); // insert a fake ';' before ':' AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(6)); propertyName->identifierToken = loc(6); propertyName->next = 0; AST::UiArrayBinding *binding = new (pool) AST::UiArrayBinding( propertyName, sym(9).UiArrayMemberList->finish()); binding->colonToken = loc(7); binding->lbracketToken = loc(8); binding->rbracketToken = loc(10); node->binding = binding; sym(1).Node = node; } break; ./ UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiQualifiedId UiObjectInitializer ; /. case $rule_number: { AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3)); node->propertyToken = loc(1); node->typeToken = loc(2); node->identifierToken = loc(3); node->semicolonToken = loc(4); // insert a fake ';' before ':' AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(3)); propertyName->identifierToken = loc(3); propertyName->next = 0; AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding( propertyName, sym(5).UiQualifiedId, sym(6).UiObjectInitializer); binding->colonToken = loc(4); node->binding = binding; sym(1).Node = node; } break; ./ UiObjectMember: FunctionDeclaration ; /. case $rule_number: { sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); } break; ./ UiObjectMember: VariableStatement ; /. case $rule_number: { sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node); } break; ./ JsIdentifier: T_IDENTIFIER; JsIdentifier: T_PROPERTY ; JsIdentifier: T_SIGNAL ; JsIdentifier: T_READONLY ; JsIdentifier: T_ON ; -------------------------------------------------------------------------------------------------------- -- Expressions -------------------------------------------------------------------------------------------------------- PrimaryExpression: T_THIS ; /. case $rule_number: { AST::ThisExpression *node = new (pool) AST::ThisExpression(); node->thisToken = loc(1); sym(1).Node = node; } break; ./ PrimaryExpression: JsIdentifier ; /. case $rule_number: { AST::IdentifierExpression *node = new (pool) AST::IdentifierExpression(stringRef(1)); node->identifierToken = loc(1); sym(1).Node = node; } break; ./ PrimaryExpression: T_NULL ; /. case $rule_number: { AST::NullExpression *node = new (pool) AST::NullExpression(); node->nullToken = loc(1); sym(1).Node = node; } break; ./ PrimaryExpression: T_TRUE ; /. case $rule_number: { AST::TrueLiteral *node = new (pool) AST::TrueLiteral(); node->trueToken = loc(1); sym(1).Node = node; } break; ./ PrimaryExpression: T_FALSE ; /. case $rule_number: { AST::FalseLiteral *node = new (pool) AST::FalseLiteral(); node->falseToken = loc(1); sym(1).Node = node; } break; ./ PrimaryExpression: T_NUMERIC_LITERAL ; /. case $rule_number: { AST::NumericLiteral *node = new (pool) AST::NumericLiteral(sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; ./ PrimaryExpression: T_MULTILINE_STRING_LITERAL ; /.case $rule_number:./ PrimaryExpression: T_STRING_LITERAL ; /. case $rule_number: { AST::StringLiteral *node = new (pool) AST::StringLiteral(stringRef(1)); node->literalToken = loc(1); sym(1).Node = node; } break; ./ PrimaryExpression: T_DIVIDE_ ; /: #define J_SCRIPT_REGEXPLITERAL_RULE1 $rule_number :/ /. case $rule_number: { bool rx = lexer->scanRegExp(Lexer::NoPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); return false; // ### remove me } loc(1).length = lexer->tokenLength(); yylloc = loc(1); // adjust the location of the current token AST::RegExpLiteral *node = new (pool) AST::RegExpLiteral( driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags()); node->literalToken = loc(1); sym(1).Node = node; } break; ./ PrimaryExpression: T_DIVIDE_EQ ; /: #define J_SCRIPT_REGEXPLITERAL_RULE2 $rule_number :/ /. case $rule_number: { bool rx = lexer->scanRegExp(Lexer::EqualPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); return false; } loc(1).length = lexer->tokenLength(); yylloc = loc(1); // adjust the location of the current token AST::RegExpLiteral *node = new (pool) AST::RegExpLiteral( driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags()); node->literalToken = loc(1); sym(1).Node = node; } break; ./ PrimaryExpression: T_LBRACKET T_RBRACKET ; /. case $rule_number: { AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral((AST::Elision *) 0); node->lbracketToken = loc(1); node->rbracketToken = loc(2); sym(1).Node = node; } break; ./ PrimaryExpression: T_LBRACKET Elision T_RBRACKET ; /. case $rule_number: { AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).Elision->finish()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; ./ PrimaryExpression: T_LBRACKET ElementList T_RBRACKET ; /. case $rule_number: { AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish ()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; ./ PrimaryExpression: T_LBRACKET ElementList T_COMMA T_RBRACKET ; /. case $rule_number: { AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (), (AST::Elision *) 0); node->lbracketToken = loc(1); node->commaToken = loc(3); node->rbracketToken = loc(4); sym(1).Node = node; } break; ./ PrimaryExpression: T_LBRACKET ElementList T_COMMA Elision T_RBRACKET ; /. case $rule_number: { AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (), sym(4).Elision->finish()); node->lbracketToken = loc(1); node->commaToken = loc(3); node->rbracketToken = loc(5); sym(1).Node = node; } break; ./ -- PrimaryExpression: T_LBRACE T_RBRACE ; -- /. -- case $rule_number: { -- sym(1).Node = new (pool) AST::ObjectLiteral(); -- } break; -- ./ PrimaryExpression: T_LBRACE PropertyNameAndValueListOpt T_RBRACE ; /. case $rule_number: { AST::ObjectLiteral *node = 0; if (sym(2).Node) node = new (pool) AST::ObjectLiteral( sym(2).PropertyNameAndValueList->finish ()); else node = new (pool) AST::ObjectLiteral(); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; ./ PrimaryExpression: T_LBRACE PropertyNameAndValueList T_COMMA T_RBRACE ; /. case $rule_number: { AST::ObjectLiteral *node = new (pool) AST::ObjectLiteral( sym(2).PropertyNameAndValueList->finish ()); node->lbraceToken = loc(1); node->rbraceToken = loc(4); sym(1).Node = node; } break; ./ PrimaryExpression: T_LPAREN Expression T_RPAREN ; /. case $rule_number: { AST::NestedExpression *node = new (pool) AST::NestedExpression(sym(2).Expression); node->lparenToken = loc(1); node->rparenToken = loc(3); sym(1).Node = node; } break; ./ UiQualifiedId: MemberExpression ; /. case $rule_number: { if (AST::ArrayMemberExpression *mem = AST::cast(sym(1).Expression)) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken, QLatin1String("Ignored annotation"))); sym(1).Expression = mem->base; } if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(1).Expression)) { sym(1).UiQualifiedId = qualifiedId; } else { sym(1).UiQualifiedId = 0; diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1), QLatin1String("Expected a qualified name id"))); return false; // ### recover } } break; ./ ElementList: AssignmentExpression ; /. case $rule_number: { sym(1).Node = new (pool) AST::ElementList((AST::Elision *) 0, sym(1).Expression); } break; ./ ElementList: Elision AssignmentExpression ; /. case $rule_number: { sym(1).Node = new (pool) AST::ElementList(sym(1).Elision->finish(), sym(2).Expression); } break; ./ ElementList: ElementList T_COMMA AssignmentExpression ; /. case $rule_number: { AST::ElementList *node = new (pool) AST::ElementList(sym(1).ElementList, (AST::Elision *) 0, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; ./ ElementList: ElementList T_COMMA Elision AssignmentExpression ; /. case $rule_number: { AST::ElementList *node = new (pool) AST::ElementList(sym(1).ElementList, sym(3).Elision->finish(), sym(4).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; ./ Elision: T_COMMA ; /. case $rule_number: { AST::Elision *node = new (pool) AST::Elision(); node->commaToken = loc(1); sym(1).Node = node; } break; ./ Elision: Elision T_COMMA ; /. case $rule_number: { AST::Elision *node = new (pool) AST::Elision(sym(1).Elision); node->commaToken = loc(2); sym(1).Node = node; } break; ./ PropertyNameAndValueList: PropertyName T_COLON AssignmentExpression ; /. case $rule_number: { AST::PropertyNameAndValueList *node = new (pool) AST::PropertyNameAndValueList( sym(1).PropertyName, sym(3).Expression); node->colonToken = loc(2); sym(1).Node = node; } break; ./ PropertyNameAndValueList: PropertyNameAndValueList T_COMMA PropertyName T_COLON AssignmentExpression ; /. case $rule_number: { AST::PropertyNameAndValueList *node = new (pool) AST::PropertyNameAndValueList( sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); node->colonToken = loc(4); sym(1).Node = node; } break; ./ PropertyName: T_IDENTIFIER %prec SHIFT_THERE ; /. case $rule_number: { AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1)); node->propertyNameToken = loc(1); sym(1).Node = node; } break; ./ PropertyName: T_SIGNAL ; /.case $rule_number:./ PropertyName: T_PROPERTY ; /. case $rule_number: { AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1)); node->propertyNameToken = loc(1); sym(1).Node = node; } break; ./ PropertyName: T_STRING_LITERAL ; /. case $rule_number: { AST::StringLiteralPropertyName *node = new (pool) AST::StringLiteralPropertyName(stringRef(1)); node->propertyNameToken = loc(1); sym(1).Node = node; } break; ./ PropertyName: T_NUMERIC_LITERAL ; /. case $rule_number: { AST::NumericLiteralPropertyName *node = new (pool) AST::NumericLiteralPropertyName(sym(1).dval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; ./ PropertyName: ReservedIdentifier ; /. case $rule_number: { AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1)); node->propertyNameToken = loc(1); sym(1).Node = node; } break; ./ ReservedIdentifier: T_BREAK ; ReservedIdentifier: T_CASE ; ReservedIdentifier: T_CATCH ; ReservedIdentifier: T_CONTINUE ; ReservedIdentifier: T_DEFAULT ; ReservedIdentifier: T_DELETE ; ReservedIdentifier: T_DO ; ReservedIdentifier: T_ELSE ; ReservedIdentifier: T_FALSE ; ReservedIdentifier: T_FINALLY ; ReservedIdentifier: T_FOR ; ReservedIdentifier: T_FUNCTION ; ReservedIdentifier: T_IF ; ReservedIdentifier: T_IN ; ReservedIdentifier: T_INSTANCEOF ; ReservedIdentifier: T_NEW ; ReservedIdentifier: T_NULL ; ReservedIdentifier: T_RETURN ; ReservedIdentifier: T_SWITCH ; ReservedIdentifier: T_THIS ; ReservedIdentifier: T_THROW ; ReservedIdentifier: T_TRUE ; ReservedIdentifier: T_TRY ; ReservedIdentifier: T_TYPEOF ; ReservedIdentifier: T_VAR ; ReservedIdentifier: T_VOID ; ReservedIdentifier: T_WHILE ; ReservedIdentifier: T_CONST ; ReservedIdentifier: T_DEBUGGER ; ReservedIdentifier: T_RESERVED_WORD ; ReservedIdentifier: T_WITH ; PropertyIdentifier: JsIdentifier ; PropertyIdentifier: ReservedIdentifier ; MemberExpression: PrimaryExpression ; MemberExpression: FunctionExpression ; MemberExpression: MemberExpression T_LBRACKET Expression T_RBRACKET ; /. case $rule_number: { AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; ./ MemberExpression: MemberExpression T_DOT PropertyIdentifier ; /. case $rule_number: { AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; ./ MemberExpression: T_NEW MemberExpression T_LPAREN ArgumentListOpt T_RPAREN ; /. case $rule_number: { AST::NewMemberExpression *node = new (pool) AST::NewMemberExpression(sym(2).Expression, sym(4).ArgumentList); node->newToken = loc(1); node->lparenToken = loc(3); node->rparenToken = loc(5); sym(1).Node = node; } break; ./ NewExpression: MemberExpression ; NewExpression: T_NEW NewExpression ; /. case $rule_number: { AST::NewExpression *node = new (pool) AST::NewExpression(sym(2).Expression); node->newToken = loc(1); sym(1).Node = node; } break; ./ CallExpression: MemberExpression T_LPAREN ArgumentListOpt T_RPAREN ; /. case $rule_number: { AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; ./ CallExpression: CallExpression T_LPAREN ArgumentListOpt T_RPAREN ; /. case $rule_number: { AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; ./ CallExpression: CallExpression T_LBRACKET Expression T_RBRACKET ; /. case $rule_number: { AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; ./ CallExpression: CallExpression T_DOT PropertyIdentifier ; /. case $rule_number: { AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3)); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; ./ ArgumentListOpt: ; /. case $rule_number: { sym(1).Node = 0; } break; ./ ArgumentListOpt: ArgumentList ; /. case $rule_number: { sym(1).Node = sym(1).ArgumentList->finish(); } break; ./ ArgumentList: AssignmentExpression ; /. case $rule_number: { sym(1).Node = new (pool) AST::ArgumentList(sym(1).Expression); } break; ./ ArgumentList: ArgumentList T_COMMA AssignmentExpression ; /. case $rule_number: { AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(1).ArgumentList, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; ./ LeftHandSideExpression: NewExpression ; LeftHandSideExpression: CallExpression ; PostfixExpression: LeftHandSideExpression ; PostfixExpression: LeftHandSideExpression T_PLUS_PLUS ; /. case $rule_number: { AST::PostIncrementExpression *node = new (pool) AST::PostIncrementExpression(sym(1).Expression); node->incrementToken = loc(2); sym(1).Node = node; } break; ./ PostfixExpression: LeftHandSideExpression T_MINUS_MINUS ; /. case $rule_number: { AST::PostDecrementExpression *node = new (pool) AST::PostDecrementExpression(sym(1).Expression); node->decrementToken = loc(2); sym(1).Node = node; } break; ./ UnaryExpression: PostfixExpression ; UnaryExpression: T_DELETE UnaryExpression ; /. case $rule_number: { AST::DeleteExpression *node = new (pool) AST::DeleteExpression(sym(2).Expression); node->deleteToken = loc(1); sym(1).Node = node; } break; ./ UnaryExpression: T_VOID UnaryExpression ; /. case $rule_number: { AST::VoidExpression *node = new (pool) AST::VoidExpression(sym(2).Expression); node->voidToken = loc(1); sym(1).Node = node; } break; ./ UnaryExpression: T_TYPEOF UnaryExpression ; /. case $rule_number: { AST::TypeOfExpression *node = new (pool) AST::TypeOfExpression(sym(2).Expression); node->typeofToken = loc(1); sym(1).Node = node; } break; ./ UnaryExpression: T_PLUS_PLUS UnaryExpression ; /. case $rule_number: { AST::PreIncrementExpression *node = new (pool) AST::PreIncrementExpression(sym(2).Expression); node->incrementToken = loc(1); sym(1).Node = node; } break; ./ UnaryExpression: T_MINUS_MINUS UnaryExpression ; /. case $rule_number: { AST::PreDecrementExpression *node = new (pool) AST::PreDecrementExpression(sym(2).Expression); node->decrementToken = loc(1); sym(1).Node = node; } break; ./ UnaryExpression: T_PLUS UnaryExpression ; /. case $rule_number: { AST::UnaryPlusExpression *node = new (pool) AST::UnaryPlusExpression(sym(2).Expression); node->plusToken = loc(1); sym(1).Node = node; } break; ./ UnaryExpression: T_MINUS UnaryExpression ; /. case $rule_number: { AST::UnaryMinusExpression *node = new (pool) AST::UnaryMinusExpression(sym(2).Expression); node->minusToken = loc(1); sym(1).Node = node; } break; ./ UnaryExpression: T_TILDE UnaryExpression ; /. case $rule_number: { AST::TildeExpression *node = new (pool) AST::TildeExpression(sym(2).Expression); node->tildeToken = loc(1); sym(1).Node = node; } break; ./ UnaryExpression: T_NOT UnaryExpression ; /. case $rule_number: { AST::NotExpression *node = new (pool) AST::NotExpression(sym(2).Expression); node->notToken = loc(1); sym(1).Node = node; } break; ./ MultiplicativeExpression: UnaryExpression ; MultiplicativeExpression: MultiplicativeExpression T_STAR UnaryExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Mul, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ MultiplicativeExpression: MultiplicativeExpression T_DIVIDE_ UnaryExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Div, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ MultiplicativeExpression: MultiplicativeExpression T_REMAINDER UnaryExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Mod, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ AdditiveExpression: MultiplicativeExpression ; AdditiveExpression: AdditiveExpression T_PLUS MultiplicativeExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Add, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ AdditiveExpression: AdditiveExpression T_MINUS MultiplicativeExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Sub, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ ShiftExpression: AdditiveExpression ; ShiftExpression: ShiftExpression T_LT_LT AdditiveExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::LShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ ShiftExpression: ShiftExpression T_GT_GT AdditiveExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::RShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ ShiftExpression: ShiftExpression T_GT_GT_GT AdditiveExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::URShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ RelationalExpression: ShiftExpression ; RelationalExpression: RelationalExpression T_LT ShiftExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ RelationalExpression: RelationalExpression T_GT ShiftExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ RelationalExpression: RelationalExpression T_LE ShiftExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ RelationalExpression: RelationalExpression T_GE ShiftExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ RelationalExpression: RelationalExpression T_INSTANCEOF ShiftExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ RelationalExpression: RelationalExpression T_IN ShiftExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::In, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ RelationalExpressionNotIn: ShiftExpression ; RelationalExpressionNotIn: RelationalExpressionNotIn T_LT ShiftExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ RelationalExpressionNotIn: RelationalExpressionNotIn T_GT ShiftExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ RelationalExpressionNotIn: RelationalExpressionNotIn T_LE ShiftExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ RelationalExpressionNotIn: RelationalExpressionNotIn T_GE ShiftExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ RelationalExpressionNotIn: RelationalExpressionNotIn T_INSTANCEOF ShiftExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ EqualityExpression: RelationalExpression ; EqualityExpression: EqualityExpression T_EQ_EQ RelationalExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ EqualityExpression: EqualityExpression T_NOT_EQ RelationalExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ EqualityExpression: EqualityExpression T_EQ_EQ_EQ RelationalExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ EqualityExpression: EqualityExpression T_NOT_EQ_EQ RelationalExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ EqualityExpressionNotIn: RelationalExpressionNotIn ; EqualityExpressionNotIn: EqualityExpressionNotIn T_EQ_EQ RelationalExpressionNotIn ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ EqualityExpressionNotIn: EqualityExpressionNotIn T_NOT_EQ RelationalExpressionNotIn; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ EqualityExpressionNotIn: EqualityExpressionNotIn T_EQ_EQ_EQ RelationalExpressionNotIn ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ EqualityExpressionNotIn: EqualityExpressionNotIn T_NOT_EQ_EQ RelationalExpressionNotIn ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ BitwiseANDExpression: EqualityExpression ; BitwiseANDExpression: BitwiseANDExpression T_AND EqualityExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ BitwiseANDExpressionNotIn: EqualityExpressionNotIn ; BitwiseANDExpressionNotIn: BitwiseANDExpressionNotIn T_AND EqualityExpressionNotIn ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ BitwiseXORExpression: BitwiseANDExpression ; BitwiseXORExpression: BitwiseXORExpression T_XOR BitwiseANDExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ BitwiseXORExpressionNotIn: BitwiseANDExpressionNotIn ; BitwiseXORExpressionNotIn: BitwiseXORExpressionNotIn T_XOR BitwiseANDExpressionNotIn ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ BitwiseORExpression: BitwiseXORExpression ; BitwiseORExpression: BitwiseORExpression T_OR BitwiseXORExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ BitwiseORExpressionNotIn: BitwiseXORExpressionNotIn ; BitwiseORExpressionNotIn: BitwiseORExpressionNotIn T_OR BitwiseXORExpressionNotIn ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ LogicalANDExpression: BitwiseORExpression ; LogicalANDExpression: LogicalANDExpression T_AND_AND BitwiseORExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ LogicalANDExpressionNotIn: BitwiseORExpressionNotIn ; LogicalANDExpressionNotIn: LogicalANDExpressionNotIn T_AND_AND BitwiseORExpressionNotIn ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ LogicalORExpression: LogicalANDExpression ; LogicalORExpression: LogicalORExpression T_OR_OR LogicalANDExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ LogicalORExpressionNotIn: LogicalANDExpressionNotIn ; LogicalORExpressionNotIn: LogicalORExpressionNotIn T_OR_OR LogicalANDExpressionNotIn ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ ConditionalExpression: LogicalORExpression ; ConditionalExpression: LogicalORExpression T_QUESTION AssignmentExpression T_COLON AssignmentExpression ; /. case $rule_number: { AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); node->colonToken = loc(4); sym(1).Node = node; } break; ./ ConditionalExpressionNotIn: LogicalORExpressionNotIn ; ConditionalExpressionNotIn: LogicalORExpressionNotIn T_QUESTION AssignmentExpressionNotIn T_COLON AssignmentExpressionNotIn ; /. case $rule_number: { AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); node->colonToken = loc(4); sym(1).Node = node; } break; ./ AssignmentExpression: ConditionalExpression ; AssignmentExpression: LeftHandSideExpression AssignmentOperator AssignmentExpression ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ AssignmentExpressionNotIn: ConditionalExpressionNotIn ; AssignmentExpressionNotIn: LeftHandSideExpression AssignmentOperator AssignmentExpressionNotIn ; /. case $rule_number: { AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; ./ AssignmentOperator: T_EQ ; /. case $rule_number: { sym(1).ival = QSOperator::Assign; } break; ./ AssignmentOperator: T_STAR_EQ ; /. case $rule_number: { sym(1).ival = QSOperator::InplaceMul; } break; ./ AssignmentOperator: T_DIVIDE_EQ ; /. case $rule_number: { sym(1).ival = QSOperator::InplaceDiv; } break; ./ AssignmentOperator: T_REMAINDER_EQ ; /. case $rule_number: { sym(1).ival = QSOperator::InplaceMod; } break; ./ AssignmentOperator: T_PLUS_EQ ; /. case $rule_number: { sym(1).ival = QSOperator::InplaceAdd; } break; ./ AssignmentOperator: T_MINUS_EQ ; /. case $rule_number: { sym(1).ival = QSOperator::InplaceSub; } break; ./ AssignmentOperator: T_LT_LT_EQ ; /. case $rule_number: { sym(1).ival = QSOperator::InplaceLeftShift; } break; ./ AssignmentOperator: T_GT_GT_EQ ; /. case $rule_number: { sym(1).ival = QSOperator::InplaceRightShift; } break; ./ AssignmentOperator: T_GT_GT_GT_EQ ; /. case $rule_number: { sym(1).ival = QSOperator::InplaceURightShift; } break; ./ AssignmentOperator: T_AND_EQ ; /. case $rule_number: { sym(1).ival = QSOperator::InplaceAnd; } break; ./ AssignmentOperator: T_XOR_EQ ; /. case $rule_number: { sym(1).ival = QSOperator::InplaceXor; } break; ./ AssignmentOperator: T_OR_EQ ; /. case $rule_number: { sym(1).ival = QSOperator::InplaceOr; } break; ./ Expression: AssignmentExpression ; Expression: Expression T_COMMA AssignmentExpression ; /. case $rule_number: { AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; ./ ExpressionOpt: ; /. case $rule_number: { sym(1).Node = 0; } break; ./ ExpressionOpt: Expression ; ExpressionNotIn: AssignmentExpressionNotIn ; ExpressionNotIn: ExpressionNotIn T_COMMA AssignmentExpressionNotIn ; /. case $rule_number: { AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; ./ ExpressionNotInOpt: ; /. case $rule_number: { sym(1).Node = 0; } break; ./ ExpressionNotInOpt: ExpressionNotIn ; Statement: Block ; Statement: VariableStatement ; Statement: EmptyStatement ; Statement: ExpressionStatement ; Statement: IfStatement ; Statement: IterationStatement ; Statement: ContinueStatement ; Statement: BreakStatement ; Statement: ReturnStatement ; Statement: WithStatement ; Statement: LabelledStatement ; Statement: SwitchStatement ; Statement: ThrowStatement ; Statement: TryStatement ; Statement: DebuggerStatement ; Block: T_LBRACE StatementListOpt T_RBRACE ; /. case $rule_number: { AST::Block *node = new (pool) AST::Block(sym(2).StatementList); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; ./ StatementList: Statement ; /. case $rule_number: { sym(1).Node = new (pool) AST::StatementList(sym(1).Statement); } break; ./ StatementList: StatementList Statement ; /. case $rule_number: { sym(1).Node = new (pool) AST::StatementList(sym(1).StatementList, sym(2).Statement); } break; ./ StatementListOpt: ; /. case $rule_number: { sym(1).Node = 0; } break; ./ StatementListOpt: StatementList ; /. case $rule_number: { sym(1).Node = sym(1).StatementList->finish (); } break; ./ VariableStatement: VariableDeclarationKind VariableDeclarationList T_AUTOMATIC_SEMICOLON ; -- automatic semicolon VariableStatement: VariableDeclarationKind VariableDeclarationList T_SEMICOLON ; /. case $rule_number: { AST::VariableStatement *node = new (pool) AST::VariableStatement( sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); node->declarationKindToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; ./ VariableDeclarationKind: T_CONST ; /. case $rule_number: { sym(1).ival = T_CONST; } break; ./ VariableDeclarationKind: T_VAR ; /. case $rule_number: { sym(1).ival = T_VAR; } break; ./ VariableDeclarationList: VariableDeclaration ; /. case $rule_number: { sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclaration); } break; ./ VariableDeclarationList: VariableDeclarationList T_COMMA VariableDeclaration ; /. case $rule_number: { AST::VariableDeclarationList *node = new (pool) AST::VariableDeclarationList( sym(1).VariableDeclarationList, sym(3).VariableDeclaration); node->commaToken = loc(2); sym(1).Node = node; } break; ./ VariableDeclarationListNotIn: VariableDeclarationNotIn ; /. case $rule_number: { sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclaration); } break; ./ VariableDeclarationListNotIn: VariableDeclarationListNotIn T_COMMA VariableDeclarationNotIn ; /. case $rule_number: { sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclarationList, sym(3).VariableDeclaration); } break; ./ VariableDeclaration: JsIdentifier InitialiserOpt ; /. case $rule_number: { AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; ./ VariableDeclarationNotIn: JsIdentifier InitialiserNotInOpt ; /. case $rule_number: { AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; ./ Initialiser: T_EQ AssignmentExpression ; /. case $rule_number: { // ### TODO: AST for initializer sym(1) = sym(2); } break; ./ InitialiserOpt: ; /. case $rule_number: { sym(1).Node = 0; } break; ./ InitialiserOpt: Initialiser ; InitialiserNotIn: T_EQ AssignmentExpressionNotIn ; /. case $rule_number: { // ### TODO: AST for initializer sym(1) = sym(2); } break; ./ InitialiserNotInOpt: ; /. case $rule_number: { sym(1).Node = 0; } break; ./ InitialiserNotInOpt: InitialiserNotIn ; EmptyStatement: T_SEMICOLON ; /. case $rule_number: { AST::EmptyStatement *node = new (pool) AST::EmptyStatement(); node->semicolonToken = loc(1); sym(1).Node = node; } break; ./ ExpressionStatement: Expression T_AUTOMATIC_SEMICOLON ; -- automatic semicolon ExpressionStatement: Expression T_SEMICOLON ; /. case $rule_number: { AST::ExpressionStatement *node = new (pool) AST::ExpressionStatement(sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; ./ IfStatement: T_IF T_LPAREN Expression T_RPAREN Statement T_ELSE Statement ; /. case $rule_number: { AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement, sym(7).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); node->rparenToken = loc(4); node->elseToken = loc(6); sym(1).Node = node; } break; ./ IfStatement: T_IF T_LPAREN Expression T_RPAREN Statement ; /. case $rule_number: { AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; ./ IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression T_RPAREN T_AUTOMATIC_SEMICOLON ; -- automatic semicolon IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression T_RPAREN T_SEMICOLON ; /. case $rule_number: { AST::DoWhileStatement *node = new (pool) AST::DoWhileStatement(sym(2).Statement, sym(5).Expression); node->doToken = loc(1); node->whileToken = loc(3); node->lparenToken = loc(4); node->rparenToken = loc(6); node->semicolonToken = loc(7); sym(1).Node = node; } break; ./ IterationStatement: T_WHILE T_LPAREN Expression T_RPAREN Statement ; /. case $rule_number: { AST::WhileStatement *node = new (pool) AST::WhileStatement(sym(3).Expression, sym(5).Statement); node->whileToken = loc(1); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; ./ IterationStatement: T_FOR T_LPAREN ExpressionNotInOpt T_SEMICOLON ExpressionOpt T_SEMICOLON ExpressionOpt T_RPAREN Statement ; /. case $rule_number: { AST::ForStatement *node = new (pool) AST::ForStatement(sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); node->forToken = loc(1); node->lparenToken = loc(2); node->firstSemicolonToken = loc(4); node->secondSemicolonToken = loc(6); node->rparenToken = loc(8); sym(1).Node = node; } break; ./ IterationStatement: T_FOR T_LPAREN T_VAR VariableDeclarationListNotIn T_SEMICOLON ExpressionOpt T_SEMICOLON ExpressionOpt T_RPAREN Statement ; /. case $rule_number: { AST::LocalForStatement *node = new (pool) AST::LocalForStatement( sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); node->forToken = loc(1); node->lparenToken = loc(2); node->varToken = loc(3); node->firstSemicolonToken = loc(5); node->secondSemicolonToken = loc(7); node->rparenToken = loc(9); sym(1).Node = node; } break; ./ IterationStatement: T_FOR T_LPAREN LeftHandSideExpression T_IN Expression T_RPAREN Statement ; /. case $rule_number: { AST:: ForEachStatement *node = new (pool) AST::ForEachStatement(sym(3).Expression, sym(5).Expression, sym(7).Statement); node->forToken = loc(1); node->lparenToken = loc(2); node->inToken = loc(4); node->rparenToken = loc(6); sym(1).Node = node; } break; ./ IterationStatement: T_FOR T_LPAREN T_VAR VariableDeclarationNotIn T_IN Expression T_RPAREN Statement ; /. case $rule_number: { AST::LocalForEachStatement *node = new (pool) AST::LocalForEachStatement( sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); node->forToken = loc(1); node->lparenToken = loc(2); node->varToken = loc(3); node->inToken = loc(5); node->rparenToken = loc(7); sym(1).Node = node; } break; ./ ContinueStatement: T_CONTINUE T_AUTOMATIC_SEMICOLON ; -- automatic semicolon ContinueStatement: T_CONTINUE T_SEMICOLON ; /. case $rule_number: { AST::ContinueStatement *node = new (pool) AST::ContinueStatement(); node->continueToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; ./ ContinueStatement: T_CONTINUE JsIdentifier T_AUTOMATIC_SEMICOLON ; -- automatic semicolon ContinueStatement: T_CONTINUE JsIdentifier T_SEMICOLON ; /. case $rule_number: { AST::ContinueStatement *node = new (pool) AST::ContinueStatement(stringRef(2)); node->continueToken = loc(1); node->identifierToken = loc(2); node->semicolonToken = loc(3); sym(1).Node = node; } break; ./ BreakStatement: T_BREAK T_AUTOMATIC_SEMICOLON ; -- automatic semicolon BreakStatement: T_BREAK T_SEMICOLON ; /. case $rule_number: { AST::BreakStatement *node = new (pool) AST::BreakStatement(QStringRef()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; ./ BreakStatement: T_BREAK JsIdentifier T_AUTOMATIC_SEMICOLON ; -- automatic semicolon BreakStatement: T_BREAK JsIdentifier T_SEMICOLON ; /. case $rule_number: { AST::BreakStatement *node = new (pool) AST::BreakStatement(stringRef(2)); node->breakToken = loc(1); node->identifierToken = loc(2); node->semicolonToken = loc(3); sym(1).Node = node; } break; ./ ReturnStatement: T_RETURN ExpressionOpt T_AUTOMATIC_SEMICOLON ; -- automatic semicolon ReturnStatement: T_RETURN ExpressionOpt T_SEMICOLON ; /. case $rule_number: { AST::ReturnStatement *node = new (pool) AST::ReturnStatement(sym(2).Expression); node->returnToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; ./ WithStatement: T_WITH T_LPAREN Expression T_RPAREN Statement ; /. case $rule_number: { AST::WithStatement *node = new (pool) AST::WithStatement(sym(3).Expression, sym(5).Statement); node->withToken = loc(1); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; ./ SwitchStatement: T_SWITCH T_LPAREN Expression T_RPAREN CaseBlock ; /. case $rule_number: { AST::SwitchStatement *node = new (pool) AST::SwitchStatement(sym(3).Expression, sym(5).CaseBlock); node->switchToken = loc(1); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; ./ CaseBlock: T_LBRACE CaseClausesOpt T_RBRACE ; /. case $rule_number: { AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; ./ CaseBlock: T_LBRACE CaseClausesOpt DefaultClause CaseClausesOpt T_RBRACE ; /. case $rule_number: { AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(5); sym(1).Node = node; } break; ./ CaseClauses: CaseClause ; /. case $rule_number: { sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClause); } break; ./ CaseClauses: CaseClauses CaseClause ; /. case $rule_number: { sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClauses, sym(2).CaseClause); } break; ./ CaseClausesOpt: ; /. case $rule_number: { sym(1).Node = 0; } break; ./ CaseClausesOpt: CaseClauses ; /. case $rule_number: { sym(1).Node = sym(1).CaseClauses->finish (); } break; ./ CaseClause: T_CASE Expression T_COLON StatementListOpt ; /. case $rule_number: { AST::CaseClause *node = new (pool) AST::CaseClause(sym(2).Expression, sym(4).StatementList); node->caseToken = loc(1); node->colonToken = loc(3); sym(1).Node = node; } break; ./ DefaultClause: T_DEFAULT T_COLON StatementListOpt ; /. case $rule_number: { AST::DefaultClause *node = new (pool) AST::DefaultClause(sym(3).StatementList); node->defaultToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; ./ LabelledStatement: T_SIGNAL T_COLON Statement ; /.case $rule_number:./ LabelledStatement: T_PROPERTY T_COLON Statement ; /. case $rule_number: { AST::LabelledStatement *node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; ./ LabelledStatement: T_IDENTIFIER T_COLON Statement ; /. case $rule_number: { AST::LabelledStatement *node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; ./ ThrowStatement: T_THROW Expression T_AUTOMATIC_SEMICOLON ; -- automatic semicolon ThrowStatement: T_THROW Expression T_SEMICOLON ; /. case $rule_number: { AST::ThrowStatement *node = new (pool) AST::ThrowStatement(sym(2).Expression); node->throwToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; ./ TryStatement: T_TRY Block Catch ; /. case $rule_number: { AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch); node->tryToken = loc(1); sym(1).Node = node; } break; ./ TryStatement: T_TRY Block Finally ; /. case $rule_number: { AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; ./ TryStatement: T_TRY Block Catch Finally ; /. case $rule_number: { AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch, sym(4).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; ./ Catch: T_CATCH T_LPAREN JsIdentifier T_RPAREN Block ; /. case $rule_number: { AST::Catch *node = new (pool) AST::Catch(stringRef(3), sym(5).Block); node->catchToken = loc(1); node->lparenToken = loc(2); node->identifierToken = loc(3); node->rparenToken = loc(4); sym(1).Node = node; } break; ./ Finally: T_FINALLY Block ; /. case $rule_number: { AST::Finally *node = new (pool) AST::Finally(sym(2).Block); node->finallyToken = loc(1); sym(1).Node = node; } break; ./ DebuggerStatement: T_DEBUGGER T_AUTOMATIC_SEMICOLON ; -- automatic semicolon DebuggerStatement: T_DEBUGGER T_SEMICOLON ; /. case $rule_number: { AST::DebuggerStatement *node = new (pool) AST::DebuggerStatement(); node->debuggerToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; ./ FunctionDeclaration: T_FUNCTION JsIdentifier T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ; /. case $rule_number: { AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); node->identifierToken = loc(2); node->lparenToken = loc(3); node->rparenToken = loc(5); node->lbraceToken = loc(6); node->rbraceToken = loc(8); sym(1).Node = node; } break; ./ FunctionExpression: T_FUNCTION IdentifierOpt T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ; /. case $rule_number: { AST::FunctionExpression *node = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); if (! stringRef(2).isNull()) node->identifierToken = loc(2); node->lparenToken = loc(3); node->rparenToken = loc(5); node->lbraceToken = loc(6); node->rbraceToken = loc(8); sym(1).Node = node; } break; ./ FormalParameterList: JsIdentifier ; /. case $rule_number: { AST::FormalParameterList *node = new (pool) AST::FormalParameterList(stringRef(1)); node->identifierToken = loc(1); sym(1).Node = node; } break; ./ FormalParameterList: FormalParameterList T_COMMA JsIdentifier ; /. case $rule_number: { AST::FormalParameterList *node = new (pool) AST::FormalParameterList(sym(1).FormalParameterList, stringRef(3)); node->commaToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; ./ FormalParameterListOpt: ; /. case $rule_number: { sym(1).Node = 0; } break; ./ FormalParameterListOpt: FormalParameterList ; /. case $rule_number: { sym(1).Node = sym(1).FormalParameterList->finish (); } break; ./ FunctionBodyOpt: ; /. case $rule_number: { sym(1).Node = 0; } break; ./ FunctionBodyOpt: FunctionBody ; FunctionBody: SourceElements ; /. case $rule_number: { sym(1).Node = new (pool) AST::FunctionBody(sym(1).SourceElements->finish ()); } break; ./ Program: Empty ; Program: SourceElements ; /. case $rule_number: { sym(1).Node = new (pool) AST::Program(sym(1).SourceElements->finish ()); } break; ./ SourceElements: SourceElement ; /. case $rule_number: { sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElement); } break; ./ SourceElements: SourceElements SourceElement ; /. case $rule_number: { sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElements, sym(2).SourceElement); } break; ./ SourceElement: Statement ; /. case $rule_number: { sym(1).Node = new (pool) AST::StatementSourceElement(sym(1).Statement); } break; ./ SourceElement: FunctionDeclaration ; /. case $rule_number: { sym(1).Node = new (pool) AST::FunctionSourceElement(sym(1).FunctionDeclaration); } break; ./ IdentifierOpt: ; /. case $rule_number: { stringRef(1) = QStringRef(); } break; ./ IdentifierOpt: JsIdentifier ; PropertyNameAndValueListOpt: ; /. case $rule_number: { sym(1).Node = 0; } break; ./ PropertyNameAndValueListOpt: PropertyNameAndValueList ; /. } // switch action = nt_action(state_stack[tos], lhs[r] - TERMINAL_COUNT); } // if } while (action != 0); if (first_token == last_token) { const int errorState = state_stack[tos]; // automatic insertion of `;' if (yytoken != -1 && t_action(errorState, T_AUTOMATIC_SEMICOLON) && lexer->canInsertAutomaticSemicolon(yytoken)) { SavedToken &tk = token_buffer[0]; tk.token = yytoken; tk.dval = yylval; tk.spell = yytokenspell; tk.loc = yylloc; yylloc = yyprevlloc; yylloc.offset += yylloc.length; yylloc.startColumn += yylloc.length; yylloc.length = 0; //const QString msg = qApp->translate("QmlParser", "Missing `;'"); //diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg)); first_token = &token_buffer[0]; last_token = &token_buffer[1]; yytoken = T_SEMICOLON; yylval = 0; action = errorState; goto _Lcheck_token; } hadErrors = true; token_buffer[0].token = yytoken; token_buffer[0].dval = yylval; token_buffer[0].spell = yytokenspell; token_buffer[0].loc = yylloc; token_buffer[1].token = yytoken = lexer->lex(); token_buffer[1].dval = yylval = lexer->tokenValue(); token_buffer[1].spell = yytokenspell = lexer->tokenSpell(); token_buffer[1].loc = yylloc = location(lexer); if (t_action(errorState, yytoken)) { QString msg; int token = token_buffer[0].token; if (token < 0 || token >= TERMINAL_COUNT) msg = qApp->translate("QmlParser", "Syntax error"); else msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); action = errorState; goto _Lcheck_token; } static int tokens[] = { T_PLUS, T_EQ, T_COMMA, T_COLON, T_SEMICOLON, T_RPAREN, T_RBRACKET, T_RBRACE, T_NUMERIC_LITERAL, T_IDENTIFIER, T_LPAREN, T_LBRACKET, T_LBRACE, EOF_SYMBOL }; for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) { int a = t_action(errorState, *tk); if (a > 0 && t_action(a, yytoken)) { const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); yytoken = *tk; yylval = 0; yylloc = token_buffer[0].loc; yylloc.length = 0; first_token = &token_buffer[0]; last_token = &token_buffer[2]; action = errorState; goto _Lcheck_token; } } for (int tk = 1; tk < TERMINAL_COUNT; ++tk) { if (tk == T_AUTOMATIC_SEMICOLON || tk == T_FEED_UI_PROGRAM || tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION || tk == T_FEED_JS_SOURCE_ELEMENT) continue; int a = t_action(errorState, tk); if (a > 0 && t_action(a, yytoken)) { const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); yytoken = tk; yylval = 0; yylloc = token_buffer[0].loc; yylloc.length = 0; action = errorState; goto _Lcheck_token; } } const QString msg = qApp->translate("QmlParser", "Syntax error"); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); } return false; } QT_QML_END_NAMESPACE ./ /: #endif // QMLJSPARSER_P_H :/ qbs-src-3.2.0/src/lib/corelib/parser/qmljsengine_p.h0000644000175100017510000000751115154533055021762 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 QMLJSENGINE_P_H #define QMLJSENGINE_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include "qmljsglobal_p.h" #include "qmljsastfwd_p.h" #include "qmljsmemorypool_p.h" #include #include #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #include #endif #include #include namespace QbsQmlJS { class Lexer; class Directives; class MemoryPool; class QML_PARSER_EXPORT DiagnosticMessage { public: enum Kind { Warning, Error }; DiagnosticMessage() : kind(Error) {} DiagnosticMessage(Kind kind, const AST::SourceLocation &loc, QString message) : kind(kind), loc(loc), message(std::move(message)) {} bool isWarning() const { return kind == Warning; } bool isError() const { return kind == Error; } Kind kind; AST::SourceLocation loc; QString message; }; class QML_PARSER_EXPORT Engine { Lexer *_lexer{nullptr}; Directives *_directives{nullptr}; MemoryPool _pool; QList _comments; QString _extraCode; QString _code; public: Engine(); ~Engine(); void setCode(const QString &code); void addComment(int pos, int len, int line, int col); QList comments() const; Lexer *lexer() const; void setLexer(Lexer *lexer); void setDirectives(Directives *directives); Directives *directives() const; MemoryPool *pool(); inline QStringRef midRef(int position, int size) { return QStringRef(&_code).mid(position, size); } QStringRef newStringRef(const QString &s); QStringRef newStringRef(const QChar *chars, int size); }; double integerFromString(const char *buf, int size, int radix); } // end of namespace QbsQmlJS #endif // QMLJSENGINE_P_H qbs-src-3.2.0/src/lib/corelib/parser/qmljsast_p.h0000644000175100017510000020116415154533055021304 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 QMLJSAST_P_H #define QMLJSAST_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include "qmljsastvisitor_p.h" #include "qmljsglobal_p.h" #include "qmljsmemorypool_p.h" #include #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #include #endif namespace QbsQmlJS { #define QMLJS_DECLARE_AST_NODE(name) \ enum { K = Kind_##name }; namespace QSOperator // ### rename { enum Op { Add, And, InplaceAnd, Assign, BitAnd, BitOr, BitXor, InplaceSub, Div, InplaceDiv, Equal, Ge, Gt, In, InplaceAdd, InstanceOf, Le, LShift, InplaceLeftShift, Lt, Mod, InplaceMod, Mul, InplaceMul, NotEqual, Or, InplaceOr, RShift, InplaceRightShift, StrictEqual, StrictNotEqual, Sub, URShift, InplaceURightShift, InplaceXor }; } // namespace QSOperator namespace AST { template _T1 cast(_T2 *ast) { if (ast && ast->kind == static_cast<_T1>(nullptr)->K) return static_cast<_T1>(ast); return nullptr; } class QML_PARSER_EXPORT Node: public Managed { public: enum Kind { Kind_Undefined, Kind_ArgumentList, Kind_ArrayLiteral, Kind_ArrayMemberExpression, Kind_BinaryExpression, Kind_Block, Kind_BreakStatement, Kind_CallExpression, Kind_CaseBlock, Kind_CaseClause, Kind_CaseClauses, Kind_Catch, Kind_ConditionalExpression, Kind_ContinueStatement, Kind_DebuggerStatement, Kind_DefaultClause, Kind_DeleteExpression, Kind_DoWhileStatement, Kind_ElementList, Kind_Elision, Kind_EmptyStatement, Kind_Expression, Kind_ExpressionStatement, Kind_FalseLiteral, Kind_FieldMemberExpression, Kind_Finally, Kind_ForEachStatement, Kind_ForStatement, Kind_FormalParameterList, Kind_FunctionBody, Kind_FunctionDeclaration, Kind_FunctionExpression, Kind_FunctionSourceElement, Kind_IdentifierExpression, Kind_IdentifierPropertyName, Kind_IfStatement, Kind_LabelledStatement, Kind_LocalForEachStatement, Kind_LocalForStatement, Kind_NewExpression, Kind_NewMemberExpression, Kind_NotExpression, Kind_NullExpression, Kind_NumericLiteral, Kind_NumericLiteralPropertyName, Kind_ObjectLiteral, Kind_PostDecrementExpression, Kind_PostIncrementExpression, Kind_PreDecrementExpression, Kind_PreIncrementExpression, Kind_Program, Kind_PropertyName, Kind_PropertyNameAndValueList, Kind_RegExpLiteral, Kind_ReturnStatement, Kind_SourceElement, Kind_SourceElements, Kind_StatementList, Kind_StatementSourceElement, Kind_StringLiteral, Kind_StringLiteralPropertyName, Kind_SwitchStatement, Kind_ThisExpression, Kind_ThrowStatement, Kind_TildeExpression, Kind_TrueLiteral, Kind_TryStatement, Kind_TypeOfExpression, Kind_UnaryMinusExpression, Kind_UnaryPlusExpression, Kind_VariableDeclaration, Kind_VariableDeclarationList, Kind_VariableStatement, Kind_VoidExpression, Kind_WhileStatement, Kind_WithStatement, Kind_NestedExpression, Kind_UiArrayBinding, Kind_UiImport, Kind_UiImportList, Kind_UiObjectBinding, Kind_UiObjectDefinition, Kind_UiObjectInitializer, Kind_UiObjectMemberList, Kind_UiArrayMemberList, Kind_UiProgram, Kind_UiParameterList, Kind_UiPublicMember, Kind_UiQualifiedId, Kind_UiScriptBinding, Kind_UiSourceElement }; inline Node() : kind(Kind_Undefined) {} // NOTE: node destructors are never called, // instead we block free the memory // (see the NodePool class) virtual ~Node() = default; virtual ExpressionNode *expressionCast(); virtual BinaryExpression *binaryExpressionCast(); virtual Statement *statementCast(); virtual UiObjectMember *uiObjectMemberCast(); void accept(Visitor *visitor); static void accept(Node *node, Visitor *visitor); inline static void acceptChild(Node *node, Visitor *visitor) { return accept(node, visitor); } // ### remove virtual void accept0(Visitor *visitor) = 0; virtual SourceLocation firstSourceLocation() const = 0; virtual SourceLocation lastSourceLocation() const = 0; // attributes int kind; }; class QML_PARSER_EXPORT ExpressionNode: public Node { public: ExpressionNode() = default; ExpressionNode *expressionCast() override; }; class QML_PARSER_EXPORT Statement: public Node { public: Statement() = default; Statement *statementCast() override; }; class QML_PARSER_EXPORT NestedExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(NestedExpression) NestedExpression(ExpressionNode *expression) : expression(expression) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return lparenToken; } SourceLocation lastSourceLocation() const override { return rparenToken; } // attributes ExpressionNode *expression; SourceLocation lparenToken; SourceLocation rparenToken; }; class QML_PARSER_EXPORT ThisExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(ThisExpression) ThisExpression() { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return thisToken; } SourceLocation lastSourceLocation() const override { return thisToken; } // attributes SourceLocation thisToken; }; class QML_PARSER_EXPORT IdentifierExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(IdentifierExpression) IdentifierExpression(const QStringRef &n): name (n) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return identifierToken; } SourceLocation lastSourceLocation() const override { return identifierToken; } // attributes QStringRef name; SourceLocation identifierToken; }; class QML_PARSER_EXPORT NullExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(NullExpression) NullExpression() { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return nullToken; } SourceLocation lastSourceLocation() const override { return nullToken; } // attributes SourceLocation nullToken; }; class QML_PARSER_EXPORT TrueLiteral: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(TrueLiteral) TrueLiteral() { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return trueToken; } SourceLocation lastSourceLocation() const override { return trueToken; } // attributes SourceLocation trueToken; }; class QML_PARSER_EXPORT FalseLiteral: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(FalseLiteral) FalseLiteral() { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return falseToken; } SourceLocation lastSourceLocation() const override { return falseToken; } // attributes SourceLocation falseToken; }; class QML_PARSER_EXPORT NumericLiteral: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(NumericLiteral) NumericLiteral(double v): value(v) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return literalToken; } SourceLocation lastSourceLocation() const override { return literalToken; } // attributes: double value; SourceLocation literalToken; }; class QML_PARSER_EXPORT StringLiteral: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(StringLiteral) StringLiteral(const QStringRef &v): value (v) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return literalToken; } SourceLocation lastSourceLocation() const override { return literalToken; } // attributes: QStringRef value; SourceLocation literalToken; }; class QML_PARSER_EXPORT RegExpLiteral: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(RegExpLiteral) RegExpLiteral(const QStringRef &p, int f): pattern (p), flags (f) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return literalToken; } SourceLocation lastSourceLocation() const override { return literalToken; } // attributes: QStringRef pattern; int flags; SourceLocation literalToken; }; class QML_PARSER_EXPORT ArrayLiteral: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(ArrayLiteral) ArrayLiteral(Elision *e): elements (nullptr), elision (e) { kind = K; } ArrayLiteral(ElementList *elts): elements (elts), elision (nullptr) { kind = K; } ArrayLiteral(ElementList *elts, Elision *e): elements (elts), elision (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return lbracketToken; } SourceLocation lastSourceLocation() const override { return rbracketToken; } // attributes ElementList *elements; Elision *elision; SourceLocation lbracketToken; SourceLocation commaToken; SourceLocation rbracketToken; }; class QML_PARSER_EXPORT ObjectLiteral: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(ObjectLiteral) ObjectLiteral(): properties (nullptr) { kind = K; } ObjectLiteral(PropertyNameAndValueList *plist): properties (plist) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return lbraceToken; } SourceLocation lastSourceLocation() const override { return rbraceToken; } // attributes PropertyNameAndValueList *properties; SourceLocation lbraceToken; SourceLocation rbraceToken; }; class QML_PARSER_EXPORT Elision: public Node { public: QMLJS_DECLARE_AST_NODE(Elision) Elision(): next (this) { kind = K; } Elision(Elision *previous) { kind = K; next = previous->next; previous->next = this; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return commaToken; } SourceLocation lastSourceLocation() const override { return next ? next->lastSourceLocation() : commaToken; } inline Elision *finish () { Elision *front = next; next = nullptr; return front; } // attributes Elision *next; SourceLocation commaToken; }; class QML_PARSER_EXPORT ElementList: public Node { public: QMLJS_DECLARE_AST_NODE(ElementList) ElementList(Elision *e, ExpressionNode *expr): elision (e), expression (expr), next (this) { kind = K; } ElementList(ElementList *previous, Elision *e, ExpressionNode *expr): elision (e), expression (expr) { kind = K; next = previous->next; previous->next = this; } inline ElementList *finish () { ElementList *front = next; next = nullptr; return front; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { if (elision) return elision->firstSourceLocation(); return expression->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { if (next) return next->lastSourceLocation(); return expression->lastSourceLocation(); } // attributes Elision *elision; ExpressionNode *expression; ElementList *next; SourceLocation commaToken; }; class QML_PARSER_EXPORT PropertyName: public Node { public: QMLJS_DECLARE_AST_NODE(PropertyName) PropertyName() { kind = K; } SourceLocation firstSourceLocation() const override { return propertyNameToken; } SourceLocation lastSourceLocation() const override { return propertyNameToken; } // attributes SourceLocation propertyNameToken; }; class QML_PARSER_EXPORT PropertyNameAndValueList: public Node { public: QMLJS_DECLARE_AST_NODE(PropertyNameAndValueList) PropertyNameAndValueList(PropertyName *n, ExpressionNode *v): name (n), value (v), next (this) { kind = K; } PropertyNameAndValueList(PropertyNameAndValueList *previous, PropertyName *n, ExpressionNode *v): name (n), value (v) { kind = K; next = previous->next; previous->next = this; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return name->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { if (next) return next->lastSourceLocation(); return value->lastSourceLocation(); } inline PropertyNameAndValueList *finish () { PropertyNameAndValueList *front = next; next = nullptr; return front; } // attributes PropertyName *name; ExpressionNode *value; PropertyNameAndValueList *next; SourceLocation colonToken; SourceLocation commaToken; }; class QML_PARSER_EXPORT IdentifierPropertyName: public PropertyName { public: QMLJS_DECLARE_AST_NODE(IdentifierPropertyName) IdentifierPropertyName(const QStringRef &n): id (n) { kind = K; } void accept0(Visitor *visitor) override; // attributes QStringRef id; }; class QML_PARSER_EXPORT StringLiteralPropertyName: public PropertyName { public: QMLJS_DECLARE_AST_NODE(StringLiteralPropertyName) StringLiteralPropertyName(const QStringRef &n): id (n) { kind = K; } void accept0(Visitor *visitor) override; // attributes QStringRef id; }; class QML_PARSER_EXPORT NumericLiteralPropertyName: public PropertyName { public: QMLJS_DECLARE_AST_NODE(NumericLiteralPropertyName) NumericLiteralPropertyName(double n): id (n) { kind = K; } void accept0(Visitor *visitor) override; // attributes double id; }; class QML_PARSER_EXPORT ArrayMemberExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(ArrayMemberExpression) ArrayMemberExpression(ExpressionNode *b, ExpressionNode *e): base (b), expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return base->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return rbracketToken; } // attributes ExpressionNode *base; ExpressionNode *expression; SourceLocation lbracketToken; SourceLocation rbracketToken; }; class QML_PARSER_EXPORT FieldMemberExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(FieldMemberExpression) FieldMemberExpression(ExpressionNode *b, const QStringRef &n): base (b), name (n) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return base->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return identifierToken; } // attributes ExpressionNode *base; QStringRef name; SourceLocation dotToken; SourceLocation identifierToken; }; class QML_PARSER_EXPORT NewMemberExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(NewMemberExpression) NewMemberExpression(ExpressionNode *b, ArgumentList *a): base (b), arguments (a) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return newToken; } SourceLocation lastSourceLocation() const override { return rparenToken; } // attributes ExpressionNode *base; ArgumentList *arguments; SourceLocation newToken; SourceLocation lparenToken; SourceLocation rparenToken; }; class QML_PARSER_EXPORT NewExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(NewExpression) NewExpression(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return newToken; } SourceLocation lastSourceLocation() const override { return expression->lastSourceLocation(); } // attributes ExpressionNode *expression; SourceLocation newToken; }; class QML_PARSER_EXPORT CallExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(CallExpression) CallExpression(ExpressionNode *b, ArgumentList *a): base (b), arguments (a) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return base->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return rparenToken; } // attributes ExpressionNode *base; ArgumentList *arguments; SourceLocation lparenToken; SourceLocation rparenToken; }; class QML_PARSER_EXPORT ArgumentList: public Node { public: QMLJS_DECLARE_AST_NODE(ArgumentList) ArgumentList(ExpressionNode *e): expression (e), next (this) { kind = K; } ArgumentList(ArgumentList *previous, ExpressionNode *e): expression (e) { kind = K; next = previous->next; previous->next = this; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return expression->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { if (next) return next->lastSourceLocation(); return expression->lastSourceLocation(); } inline ArgumentList *finish () { ArgumentList *front = next; next = nullptr; return front; } // attributes ExpressionNode *expression; ArgumentList *next; SourceLocation commaToken; }; class QML_PARSER_EXPORT PostIncrementExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(PostIncrementExpression) PostIncrementExpression(ExpressionNode *b): base (b) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return base->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return incrementToken; } // attributes ExpressionNode *base; SourceLocation incrementToken; }; class QML_PARSER_EXPORT PostDecrementExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(PostDecrementExpression) PostDecrementExpression(ExpressionNode *b): base (b) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return base->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return decrementToken; } // attributes ExpressionNode *base; SourceLocation decrementToken; }; class QML_PARSER_EXPORT DeleteExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(DeleteExpression) DeleteExpression(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return deleteToken; } SourceLocation lastSourceLocation() const override { return expression->lastSourceLocation(); } // attributes ExpressionNode *expression; SourceLocation deleteToken; }; class QML_PARSER_EXPORT VoidExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(VoidExpression) VoidExpression(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return voidToken; } SourceLocation lastSourceLocation() const override { return expression->lastSourceLocation(); } // attributes ExpressionNode *expression; SourceLocation voidToken; }; class QML_PARSER_EXPORT TypeOfExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(TypeOfExpression) TypeOfExpression(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return typeofToken; } SourceLocation lastSourceLocation() const override { return expression->lastSourceLocation(); } // attributes ExpressionNode *expression; SourceLocation typeofToken; }; class QML_PARSER_EXPORT PreIncrementExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(PreIncrementExpression) PreIncrementExpression(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return incrementToken; } SourceLocation lastSourceLocation() const override { return expression->lastSourceLocation(); } // attributes ExpressionNode *expression; SourceLocation incrementToken; }; class QML_PARSER_EXPORT PreDecrementExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(PreDecrementExpression) PreDecrementExpression(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return decrementToken; } SourceLocation lastSourceLocation() const override { return expression->lastSourceLocation(); } // attributes ExpressionNode *expression; SourceLocation decrementToken; }; class QML_PARSER_EXPORT UnaryPlusExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(UnaryPlusExpression) UnaryPlusExpression(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return plusToken; } SourceLocation lastSourceLocation() const override { return expression->lastSourceLocation(); } // attributes ExpressionNode *expression; SourceLocation plusToken; }; class QML_PARSER_EXPORT UnaryMinusExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(UnaryMinusExpression) UnaryMinusExpression(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return minusToken; } SourceLocation lastSourceLocation() const override { return expression->lastSourceLocation(); } // attributes ExpressionNode *expression; SourceLocation minusToken; }; class QML_PARSER_EXPORT TildeExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(TildeExpression) TildeExpression(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return tildeToken; } SourceLocation lastSourceLocation() const override { return expression->lastSourceLocation(); } // attributes ExpressionNode *expression; SourceLocation tildeToken; }; class QML_PARSER_EXPORT NotExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(NotExpression) NotExpression(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return notToken; } SourceLocation lastSourceLocation() const override { return expression->lastSourceLocation(); } // attributes ExpressionNode *expression; SourceLocation notToken; }; class QML_PARSER_EXPORT BinaryExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(BinaryExpression) BinaryExpression(ExpressionNode *l, int o, ExpressionNode *r): left (l), op (o), right (r) { kind = K; } BinaryExpression *binaryExpressionCast() override; void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return left->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return right->lastSourceLocation(); } // attributes ExpressionNode *left; int op; ExpressionNode *right; SourceLocation operatorToken; }; class QML_PARSER_EXPORT ConditionalExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(ConditionalExpression) ConditionalExpression(ExpressionNode *e, ExpressionNode *t, ExpressionNode *f): expression (e), ok (t), ko (f) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return expression->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return ko->lastSourceLocation(); } // attributes ExpressionNode *expression; ExpressionNode *ok; ExpressionNode *ko; SourceLocation questionToken; SourceLocation colonToken; }; class QML_PARSER_EXPORT Expression: public ExpressionNode // ### rename { public: QMLJS_DECLARE_AST_NODE(Expression) Expression(ExpressionNode *l, ExpressionNode *r): left (l), right (r) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return left->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return right->lastSourceLocation(); } // attributes ExpressionNode *left; ExpressionNode *right; SourceLocation commaToken; }; class QML_PARSER_EXPORT Block: public Statement { public: QMLJS_DECLARE_AST_NODE(Block) Block(StatementList *slist): statements (slist) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return lbraceToken; } SourceLocation lastSourceLocation() const override { return rbraceToken; } // attributes StatementList *statements; SourceLocation lbraceToken; SourceLocation rbraceToken; }; class QML_PARSER_EXPORT StatementList: public Node { public: QMLJS_DECLARE_AST_NODE(StatementList) StatementList(Statement *stmt): statement (stmt), next (this) { kind = K; } StatementList(StatementList *previous, Statement *stmt): statement (stmt) { kind = K; next = previous->next; previous->next = this; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return statement->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return next ? next->lastSourceLocation() : statement->lastSourceLocation(); } inline StatementList *finish () { StatementList *front = next; next = nullptr; return front; } // attributes Statement *statement; StatementList *next; }; class QML_PARSER_EXPORT VariableStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(VariableStatement) VariableStatement(VariableDeclarationList *vlist): declarations (vlist) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return declarationKindToken; } SourceLocation lastSourceLocation() const override { return semicolonToken; } // attributes VariableDeclarationList *declarations; SourceLocation declarationKindToken; SourceLocation semicolonToken; }; class QML_PARSER_EXPORT VariableDeclaration: public Node { public: QMLJS_DECLARE_AST_NODE(VariableDeclaration) VariableDeclaration(const QStringRef &n, ExpressionNode *e): name (n), expression (e), readOnly(false) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return identifierToken; } SourceLocation lastSourceLocation() const override { return expression ? expression->lastSourceLocation() : identifierToken; } // attributes QStringRef name; ExpressionNode *expression; bool readOnly; SourceLocation identifierToken; }; class QML_PARSER_EXPORT VariableDeclarationList: public Node { public: QMLJS_DECLARE_AST_NODE(VariableDeclarationList) VariableDeclarationList(VariableDeclaration *decl): declaration (decl), next (this) { kind = K; } VariableDeclarationList(VariableDeclarationList *previous, VariableDeclaration *decl): declaration (decl) { kind = K; next = previous->next; previous->next = this; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return declaration->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { if (next) return next->lastSourceLocation(); return declaration->lastSourceLocation(); } inline VariableDeclarationList *finish (bool readOnly) { VariableDeclarationList *front = next; next = nullptr; if (readOnly) { VariableDeclarationList *vdl; for (vdl = front; vdl != nullptr; vdl = vdl->next) vdl->declaration->readOnly = true; } return front; } // attributes VariableDeclaration *declaration; VariableDeclarationList *next; SourceLocation commaToken; }; class QML_PARSER_EXPORT EmptyStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(EmptyStatement) EmptyStatement() { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return semicolonToken; } SourceLocation lastSourceLocation() const override { return semicolonToken; } // attributes SourceLocation semicolonToken; }; class QML_PARSER_EXPORT ExpressionStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(ExpressionStatement) ExpressionStatement(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return expression->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return semicolonToken; } // attributes ExpressionNode *expression; SourceLocation semicolonToken; }; class QML_PARSER_EXPORT IfStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(IfStatement) IfStatement(ExpressionNode *e, Statement *t, Statement *f = 0): expression (e), ok (t), ko (f) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return ifToken; } SourceLocation lastSourceLocation() const override { if (ko) return ko->lastSourceLocation(); return ok->lastSourceLocation(); } // attributes ExpressionNode *expression; Statement *ok; Statement *ko; SourceLocation ifToken; SourceLocation lparenToken; SourceLocation rparenToken; SourceLocation elseToken; }; class QML_PARSER_EXPORT DoWhileStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(DoWhileStatement) DoWhileStatement(Statement *stmt, ExpressionNode *e): statement (stmt), expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return doToken; } SourceLocation lastSourceLocation() const override { return semicolonToken; } // attributes Statement *statement; ExpressionNode *expression; SourceLocation doToken; SourceLocation whileToken; SourceLocation lparenToken; SourceLocation rparenToken; SourceLocation semicolonToken; }; class QML_PARSER_EXPORT WhileStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(WhileStatement) WhileStatement(ExpressionNode *e, Statement *stmt): expression (e), statement (stmt) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return whileToken; } SourceLocation lastSourceLocation() const override { return statement->lastSourceLocation(); } // attributes ExpressionNode *expression; Statement *statement; SourceLocation whileToken; SourceLocation lparenToken; SourceLocation rparenToken; }; class QML_PARSER_EXPORT ForStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(ForStatement) ForStatement(ExpressionNode *i, ExpressionNode *c, ExpressionNode *e, Statement *stmt): initialiser (i), condition (c), expression (e), statement (stmt) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return forToken; } SourceLocation lastSourceLocation() const override { return statement->lastSourceLocation(); } // attributes ExpressionNode *initialiser; ExpressionNode *condition; ExpressionNode *expression; Statement *statement; SourceLocation forToken; SourceLocation lparenToken; SourceLocation firstSemicolonToken; SourceLocation secondSemicolonToken; SourceLocation rparenToken; }; class QML_PARSER_EXPORT LocalForStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(LocalForStatement) LocalForStatement(VariableDeclarationList *vlist, ExpressionNode *c, ExpressionNode *e, Statement *stmt): declarations (vlist), condition (c), expression (e), statement (stmt) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return forToken; } SourceLocation lastSourceLocation() const override { return statement->lastSourceLocation(); } // attributes VariableDeclarationList *declarations; ExpressionNode *condition; ExpressionNode *expression; Statement *statement; SourceLocation forToken; SourceLocation lparenToken; SourceLocation varToken; SourceLocation firstSemicolonToken; SourceLocation secondSemicolonToken; SourceLocation rparenToken; }; class QML_PARSER_EXPORT ForEachStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(ForEachStatement) ForEachStatement(ExpressionNode *i, ExpressionNode *e, Statement *stmt): initialiser (i), expression (e), statement (stmt) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return forToken; } SourceLocation lastSourceLocation() const override { return statement->lastSourceLocation(); } // attributes ExpressionNode *initialiser; ExpressionNode *expression; Statement *statement; SourceLocation forToken; SourceLocation lparenToken; SourceLocation inToken; SourceLocation rparenToken; }; class QML_PARSER_EXPORT LocalForEachStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(LocalForEachStatement) LocalForEachStatement(VariableDeclaration *v, ExpressionNode *e, Statement *stmt): declaration (v), expression (e), statement (stmt) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return forToken; } SourceLocation lastSourceLocation() const override { return statement->lastSourceLocation(); } // attributes VariableDeclaration *declaration; ExpressionNode *expression; Statement *statement; SourceLocation forToken; SourceLocation lparenToken; SourceLocation varToken; SourceLocation inToken; SourceLocation rparenToken; }; class QML_PARSER_EXPORT ContinueStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(ContinueStatement) ContinueStatement(const QStringRef &l = QStringRef()): label (l) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return continueToken; } SourceLocation lastSourceLocation() const override { return semicolonToken; } // attributes QStringRef label; SourceLocation continueToken; SourceLocation identifierToken; SourceLocation semicolonToken; }; class QML_PARSER_EXPORT BreakStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(BreakStatement) BreakStatement(const QStringRef &l): label (l) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return breakToken; } SourceLocation lastSourceLocation() const override { return semicolonToken; } // attributes QStringRef label; SourceLocation breakToken; SourceLocation identifierToken; SourceLocation semicolonToken; }; class QML_PARSER_EXPORT ReturnStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(ReturnStatement) ReturnStatement(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return returnToken; } SourceLocation lastSourceLocation() const override { return semicolonToken; } // attributes ExpressionNode *expression; SourceLocation returnToken; SourceLocation semicolonToken; }; class QML_PARSER_EXPORT WithStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(WithStatement) WithStatement(ExpressionNode *e, Statement *stmt): expression (e), statement (stmt) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return withToken; } SourceLocation lastSourceLocation() const override { return statement->lastSourceLocation(); } // attributes ExpressionNode *expression; Statement *statement; SourceLocation withToken; SourceLocation lparenToken; SourceLocation rparenToken; }; class QML_PARSER_EXPORT CaseBlock: public Node { public: QMLJS_DECLARE_AST_NODE(CaseBlock) CaseBlock(CaseClauses *c, DefaultClause *d = 0, CaseClauses *r = 0): clauses (c), defaultClause (d), moreClauses (r) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return lbraceToken; } SourceLocation lastSourceLocation() const override { return rbraceToken; } // attributes CaseClauses *clauses; DefaultClause *defaultClause; CaseClauses *moreClauses; SourceLocation lbraceToken; SourceLocation rbraceToken; }; class QML_PARSER_EXPORT SwitchStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(SwitchStatement) SwitchStatement(ExpressionNode *e, CaseBlock *b): expression (e), block (b) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return switchToken; } SourceLocation lastSourceLocation() const override { return block->rbraceToken; } // attributes ExpressionNode *expression; CaseBlock *block; SourceLocation switchToken; SourceLocation lparenToken; SourceLocation rparenToken; }; class QML_PARSER_EXPORT CaseClause: public Node { public: QMLJS_DECLARE_AST_NODE(CaseClause) CaseClause(ExpressionNode *e, StatementList *slist): expression (e), statements (slist) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return caseToken; } SourceLocation lastSourceLocation() const override { return statements ? statements->lastSourceLocation() : colonToken; } // attributes ExpressionNode *expression; StatementList *statements; SourceLocation caseToken; SourceLocation colonToken; }; class QML_PARSER_EXPORT CaseClauses: public Node { public: QMLJS_DECLARE_AST_NODE(CaseClauses) CaseClauses(CaseClause *c): clause (c), next (this) { kind = K; } CaseClauses(CaseClauses *previous, CaseClause *c): clause (c) { kind = K; next = previous->next; previous->next = this; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return clause->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return next ? next->lastSourceLocation() : clause->lastSourceLocation(); } inline CaseClauses *finish () { CaseClauses *front = next; next = nullptr; return front; } //attributes CaseClause *clause; CaseClauses *next; }; class QML_PARSER_EXPORT DefaultClause: public Node { public: QMLJS_DECLARE_AST_NODE(DefaultClause) DefaultClause(StatementList *slist): statements (slist) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return defaultToken; } SourceLocation lastSourceLocation() const override { return statements ? statements->lastSourceLocation() : colonToken; } // attributes StatementList *statements; SourceLocation defaultToken; SourceLocation colonToken; }; class QML_PARSER_EXPORT LabelledStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(LabelledStatement) LabelledStatement(const QStringRef &l, Statement *stmt): label (l), statement (stmt) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return identifierToken; } SourceLocation lastSourceLocation() const override { return statement->lastSourceLocation(); } // attributes QStringRef label; Statement *statement; SourceLocation identifierToken; SourceLocation colonToken; }; class QML_PARSER_EXPORT ThrowStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(ThrowStatement) ThrowStatement(ExpressionNode *e): expression (e) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return throwToken; } SourceLocation lastSourceLocation() const override { return semicolonToken; } // attributes ExpressionNode *expression; SourceLocation throwToken; SourceLocation semicolonToken; }; class QML_PARSER_EXPORT Catch: public Node { public: QMLJS_DECLARE_AST_NODE(Catch) Catch(const QStringRef &n, Block *stmt): name (n), statement (stmt) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return catchToken; } SourceLocation lastSourceLocation() const override { return statement->lastSourceLocation(); } // attributes QStringRef name; Block *statement; SourceLocation catchToken; SourceLocation lparenToken; SourceLocation identifierToken; SourceLocation rparenToken; }; class QML_PARSER_EXPORT Finally: public Node { public: QMLJS_DECLARE_AST_NODE(Finally) Finally(Block *stmt): statement (stmt) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return finallyToken; } SourceLocation lastSourceLocation() const override { return statement ? statement->lastSourceLocation() : finallyToken; } // attributes Block *statement; SourceLocation finallyToken; }; class QML_PARSER_EXPORT TryStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(TryStatement) TryStatement(Statement *stmt, Catch *c, Finally *f): statement (stmt), catchExpression (c), finallyExpression (f) { kind = K; } TryStatement(Statement *stmt, Finally *f): statement (stmt), catchExpression (nullptr), finallyExpression (f) { kind = K; } TryStatement(Statement *stmt, Catch *c): statement (stmt), catchExpression (c), finallyExpression (nullptr) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return tryToken; } SourceLocation lastSourceLocation() const override { if (finallyExpression) return finallyExpression->statement->rbraceToken; else if (catchExpression) return catchExpression->statement->rbraceToken; return statement->lastSourceLocation(); } // attributes Statement *statement; Catch *catchExpression; Finally *finallyExpression; SourceLocation tryToken; }; class QML_PARSER_EXPORT FunctionExpression: public ExpressionNode { public: QMLJS_DECLARE_AST_NODE(FunctionExpression) FunctionExpression(const QStringRef &n, FormalParameterList *f, FunctionBody *b): name (n), formals (f), body (b) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return functionToken; } SourceLocation lastSourceLocation() const override { return rbraceToken; } // attributes QStringRef name; FormalParameterList *formals; FunctionBody *body; SourceLocation functionToken; SourceLocation identifierToken; SourceLocation lparenToken; SourceLocation rparenToken; SourceLocation lbraceToken; SourceLocation rbraceToken; }; class QML_PARSER_EXPORT FunctionDeclaration: public FunctionExpression { public: QMLJS_DECLARE_AST_NODE(FunctionDeclaration) FunctionDeclaration(const QStringRef &n, FormalParameterList *f, FunctionBody *b): FunctionExpression(n, f, b) { kind = K; } void accept0(Visitor *visitor) override; }; class QML_PARSER_EXPORT FormalParameterList: public Node { public: QMLJS_DECLARE_AST_NODE(FormalParameterList) FormalParameterList(const QStringRef &n): name (n), next (this) { kind = K; } FormalParameterList(FormalParameterList *previous, const QStringRef &n): name (n) { kind = K; next = previous->next; previous->next = this; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return identifierToken; } SourceLocation lastSourceLocation() const override { return next ? next->lastSourceLocation() : identifierToken; } inline FormalParameterList *finish () { FormalParameterList *front = next; next = nullptr; return front; } // attributes QStringRef name; FormalParameterList *next; SourceLocation commaToken; SourceLocation identifierToken; }; class QML_PARSER_EXPORT SourceElement: public Node { public: QMLJS_DECLARE_AST_NODE(SourceElement) inline SourceElement() { kind = K; } }; class QML_PARSER_EXPORT SourceElements: public Node { public: QMLJS_DECLARE_AST_NODE(SourceElements) SourceElements(SourceElement *elt): element (elt), next (this) { kind = K; } SourceElements(SourceElements *previous, SourceElement *elt): element (elt) { kind = K; next = previous->next; previous->next = this; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return element->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return next ? next->lastSourceLocation() : element->lastSourceLocation(); } inline SourceElements *finish () { SourceElements *front = next; next = nullptr; return front; } // attributes SourceElement *element; SourceElements *next; }; class QML_PARSER_EXPORT FunctionBody: public Node { public: QMLJS_DECLARE_AST_NODE(FunctionBody) FunctionBody(SourceElements *elts): elements (elts) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return elements ? elements->firstSourceLocation() : SourceLocation(); } SourceLocation lastSourceLocation() const override { return elements ? elements->lastSourceLocation() : SourceLocation(); } // attributes SourceElements *elements; }; class QML_PARSER_EXPORT Program: public Node { public: QMLJS_DECLARE_AST_NODE(Program) Program(SourceElements *elts): elements (elts) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return elements ? elements->firstSourceLocation() : SourceLocation(); } SourceLocation lastSourceLocation() const override { return elements ? elements->lastSourceLocation() : SourceLocation(); } // attributes SourceElements *elements; }; class QML_PARSER_EXPORT FunctionSourceElement: public SourceElement { public: QMLJS_DECLARE_AST_NODE(FunctionSourceElement) FunctionSourceElement(FunctionDeclaration *f): declaration (f) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return declaration->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return declaration->lastSourceLocation(); } // attributes FunctionDeclaration *declaration; }; class QML_PARSER_EXPORT StatementSourceElement: public SourceElement { public: QMLJS_DECLARE_AST_NODE(StatementSourceElement) StatementSourceElement(Statement *stmt): statement (stmt) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return statement->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return statement->lastSourceLocation(); } // attributes Statement *statement; }; class QML_PARSER_EXPORT DebuggerStatement: public Statement { public: QMLJS_DECLARE_AST_NODE(DebuggerStatement) DebuggerStatement() { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return debuggerToken; } SourceLocation lastSourceLocation() const override { return semicolonToken; } // attributes SourceLocation debuggerToken; SourceLocation semicolonToken; }; class QML_PARSER_EXPORT UiQualifiedId: public Node { public: QMLJS_DECLARE_AST_NODE(UiQualifiedId) UiQualifiedId(const QStringRef &name) : next(this), name(name) { kind = K; } UiQualifiedId(UiQualifiedId *previous, const QStringRef &name) : name(name) { kind = K; next = previous->next; previous->next = this; } UiQualifiedId *finish() { UiQualifiedId *head = next; next = nullptr; return head; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return identifierToken; } SourceLocation lastSourceLocation() const override { return next ? next->lastSourceLocation() : identifierToken; } // attributes UiQualifiedId *next; QStringRef name; SourceLocation identifierToken; }; class QML_PARSER_EXPORT UiImport: public Node { public: QMLJS_DECLARE_AST_NODE(UiImport) UiImport(const QStringRef &fileName) : fileName(fileName), importUri(nullptr) { kind = K; } UiImport(UiQualifiedId *uri) : importUri(uri) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return importToken; } SourceLocation lastSourceLocation() const override { return semicolonToken; } // attributes QStringRef fileName; UiQualifiedId *importUri; QStringRef importId; SourceLocation importToken; SourceLocation fileNameToken; SourceLocation versionToken; SourceLocation asToken; SourceLocation importIdToken; SourceLocation semicolonToken; }; class QML_PARSER_EXPORT UiImportList: public Node { public: QMLJS_DECLARE_AST_NODE(UiImportList) UiImportList(UiImport *import) : import(import), next(this) { kind = K; } UiImportList(UiImportList *previous, UiImport *import) : import(import) { kind = K; next = previous->next; previous->next = this; } UiImportList *finish() { UiImportList *head = next; next = nullptr; return head; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return import->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return next ? next->lastSourceLocation() : import->lastSourceLocation(); } // attributes UiImport *import; UiImportList *next; }; class QML_PARSER_EXPORT UiObjectMember: public Node { public: SourceLocation firstSourceLocation() const override = 0; SourceLocation lastSourceLocation() const override = 0; UiObjectMember *uiObjectMemberCast() override; }; class QML_PARSER_EXPORT UiObjectMemberList: public Node { public: QMLJS_DECLARE_AST_NODE(UiObjectMemberList) UiObjectMemberList(UiObjectMember *member) : next(this), member(member) { kind = K; } UiObjectMemberList(UiObjectMemberList *previous, UiObjectMember *member) : member(member) { kind = K; next = previous->next; previous->next = this; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return member->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return next ? next->lastSourceLocation() : member->lastSourceLocation(); } UiObjectMemberList *finish() { UiObjectMemberList *head = next; next = nullptr; return head; } // attributes UiObjectMemberList *next; UiObjectMember *member; }; class QML_PARSER_EXPORT UiProgram: public Node { public: QMLJS_DECLARE_AST_NODE(UiProgram) UiProgram(UiImportList *imports, UiObjectMemberList *members) : imports(imports), members(members) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { if (imports) return imports->firstSourceLocation(); else if (members) return members->firstSourceLocation(); return {}; } SourceLocation lastSourceLocation() const override { if (members) return members->lastSourceLocation(); else if (imports) return imports->lastSourceLocation(); return {}; } // attributes UiImportList *imports; UiObjectMemberList *members; }; class QML_PARSER_EXPORT UiArrayMemberList: public Node { public: QMLJS_DECLARE_AST_NODE(UiArrayMemberList) UiArrayMemberList(UiObjectMember *member) : next(this), member(member) { kind = K; } UiArrayMemberList(UiArrayMemberList *previous, UiObjectMember *member) : member(member) { kind = K; next = previous->next; previous->next = this; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return member->firstSourceLocation(); } SourceLocation lastSourceLocation() const override { return next ? next->lastSourceLocation() : member->lastSourceLocation(); } UiArrayMemberList *finish() { UiArrayMemberList *head = next; next = nullptr; return head; } // attributes UiArrayMemberList *next; UiObjectMember *member; SourceLocation commaToken; }; class QML_PARSER_EXPORT UiObjectInitializer: public Node { public: QMLJS_DECLARE_AST_NODE(UiObjectInitializer) UiObjectInitializer(UiObjectMemberList *members) : members(members) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return lbraceToken; } SourceLocation lastSourceLocation() const override { return rbraceToken; } // attributes SourceLocation lbraceToken; UiObjectMemberList *members; SourceLocation rbraceToken; }; class QML_PARSER_EXPORT UiParameterList: public Node { public: QMLJS_DECLARE_AST_NODE(UiParameterList) UiParameterList(const QStringRef &t, const QStringRef &n): type (t), name (n), next (this) { kind = K; } UiParameterList(UiParameterList *previous, const QStringRef &t, const QStringRef &n): type (t), name (n) { kind = K; next = previous->next; previous->next = this; } void accept0(Visitor *) override {} SourceLocation firstSourceLocation() const override { return propertyTypeToken; } SourceLocation lastSourceLocation() const override { return next ? next->lastSourceLocation() : identifierToken; } inline UiParameterList *finish () { UiParameterList *front = next; next = nullptr; return front; } // attributes QStringRef type; QStringRef name; UiParameterList *next; SourceLocation commaToken; SourceLocation propertyTypeToken; SourceLocation identifierToken; }; class QML_PARSER_EXPORT UiPublicMember: public UiObjectMember { public: QMLJS_DECLARE_AST_NODE(UiPublicMember) UiPublicMember(const QStringRef &memberType, const QStringRef &name) : type(Property), memberType(memberType), name(name), statement(nullptr), binding(nullptr), isDefaultMember(false), isReadonlyMember(false), parameters(nullptr) { kind = K; } UiPublicMember(const QStringRef &memberType, const QStringRef &name, Statement *statement) : type(Property), memberType(memberType), name(name), statement(statement), binding(nullptr), isDefaultMember(false), isReadonlyMember(false), parameters(nullptr) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { if (defaultToken.isValid()) return defaultToken; else if (readonlyToken.isValid()) return readonlyToken; return propertyToken; } SourceLocation lastSourceLocation() const override { if (binding) return binding->lastSourceLocation(); if (statement) return statement->lastSourceLocation(); return semicolonToken; } // attributes enum { Signal, Property } type; QStringRef typeModifier; QStringRef memberType; QStringRef name; Statement *statement; // initialized with a JS expression UiObjectMember *binding; // initialized with a QML object or array. bool isDefaultMember; bool isReadonlyMember; UiParameterList *parameters; SourceLocation defaultToken; SourceLocation readonlyToken; SourceLocation propertyToken; SourceLocation typeModifierToken; SourceLocation typeToken; SourceLocation identifierToken; SourceLocation colonToken; SourceLocation semicolonToken; }; class QML_PARSER_EXPORT UiObjectDefinition: public UiObjectMember { public: QMLJS_DECLARE_AST_NODE(UiObjectDefinition) UiObjectDefinition(UiQualifiedId *qualifiedTypeNameId, UiObjectInitializer *initializer) : qualifiedTypeNameId(qualifiedTypeNameId), initializer(initializer) { kind = K; } void accept0(Visitor *visitor) override; SourceLocation firstSourceLocation() const override { return qualifiedTypeNameId->identifierToken; } SourceLocation lastSourceLocation() const override { return initializer->rbraceToken; } // attributes UiQualifiedId *qualifiedTypeNameId; UiObjectInitializer *initializer; }; class QML_PARSER_EXPORT UiSourceElement: public UiObjectMember { public: QMLJS_DECLARE_AST_NODE(UiSourceElement) UiSourceElement(Node *sourceElement) : sourceElement(sourceElement) { kind = K; } SourceLocation firstSourceLocation() const override { if (const auto funDecl = cast(sourceElement)) return funDecl->firstSourceLocation(); else if (const auto varStmt = cast(sourceElement)) return varStmt->firstSourceLocation(); return {}; } SourceLocation lastSourceLocation() const override { if (const auto funDecl = cast(sourceElement)) return funDecl->lastSourceLocation(); else if (const auto varStmt = cast(sourceElement)) return varStmt->lastSourceLocation(); return {}; } void accept0(Visitor *visitor) override; // attributes Node *sourceElement; }; class QML_PARSER_EXPORT UiObjectBinding: public UiObjectMember { public: QMLJS_DECLARE_AST_NODE(UiObjectBinding) UiObjectBinding(UiQualifiedId *qualifiedId, UiQualifiedId *qualifiedTypeNameId, UiObjectInitializer *initializer) : qualifiedId(qualifiedId), qualifiedTypeNameId(qualifiedTypeNameId), initializer(initializer), hasOnToken(false) { kind = K; } SourceLocation firstSourceLocation() const override { if (hasOnToken && qualifiedTypeNameId) return qualifiedTypeNameId->identifierToken; return qualifiedId->identifierToken; } SourceLocation lastSourceLocation() const override { return initializer->rbraceToken; } void accept0(Visitor *visitor) override; // attributes UiQualifiedId *qualifiedId; UiQualifiedId *qualifiedTypeNameId; UiObjectInitializer *initializer; SourceLocation colonToken; bool hasOnToken; }; class QML_PARSER_EXPORT UiScriptBinding: public UiObjectMember { public: QMLJS_DECLARE_AST_NODE(UiScriptBinding) UiScriptBinding(UiQualifiedId *qualifiedId, Statement *statement) : qualifiedId(qualifiedId), statement(statement) { kind = K; } SourceLocation firstSourceLocation() const override { return qualifiedId->identifierToken; } SourceLocation lastSourceLocation() const override { return statement->lastSourceLocation(); } void accept0(Visitor *visitor) override; // attributes UiQualifiedId *qualifiedId; Statement *statement; SourceLocation colonToken; }; class QML_PARSER_EXPORT UiArrayBinding: public UiObjectMember { public: QMLJS_DECLARE_AST_NODE(UiArrayBinding) UiArrayBinding(UiQualifiedId *qualifiedId, UiArrayMemberList *members) : qualifiedId(qualifiedId), members(members) { kind = K; } SourceLocation firstSourceLocation() const override { return qualifiedId->identifierToken; } SourceLocation lastSourceLocation() const override { return rbracketToken; } void accept0(Visitor *visitor) override; // attributes UiQualifiedId *qualifiedId; UiArrayMemberList *members; SourceLocation colonToken; SourceLocation lbracketToken; SourceLocation rbracketToken; }; } // namespace AST } // namespace QbsQmlJS #endif qbs-src-3.2.0/src/lib/corelib/parser/qmljsparser_p.h0000644000175100017510000001570515154533055022015 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // // // This file is automatically generated from qmljs.g. // Changes will be lost. // #ifndef QMLJSPARSER_P_H #define QMLJSPARSER_P_H #include "qmljsglobal_p.h" #include "qmljsgrammar_p.h" #include "qmljsast_p.h" #include "qmljsengine_p.h" #include #include #include namespace QbsQmlJS { class Engine; class QML_PARSER_EXPORT Parser : protected QmlJSGrammar { public: union Value { int ival; double dval; AST::ArgumentList *ArgumentList; AST::CaseBlock *CaseBlock; AST::CaseClause *CaseClause; AST::CaseClauses *CaseClauses; AST::Catch *Catch; AST::DefaultClause *DefaultClause; AST::ElementList *ElementList; AST::Elision *Elision; AST::ExpressionNode *Expression; AST::Finally *Finally; AST::FormalParameterList *FormalParameterList; AST::FunctionBody *FunctionBody; AST::FunctionDeclaration *FunctionDeclaration; AST::Node *Node; AST::PropertyName *PropertyName; AST::PropertyNameAndValueList *PropertyNameAndValueList; AST::SourceElement *SourceElement; AST::SourceElements *SourceElements; AST::Statement *Statement; AST::StatementList *StatementList; AST::Block *Block; AST::VariableDeclaration *VariableDeclaration; AST::VariableDeclarationList *VariableDeclarationList; AST::UiProgram *UiProgram; AST::UiImportList *UiImportList; AST::UiImport *UiImport; AST::UiParameterList *UiParameterList; AST::UiPublicMember *UiPublicMember; AST::UiObjectDefinition *UiObjectDefinition; AST::UiObjectInitializer *UiObjectInitializer; AST::UiObjectBinding *UiObjectBinding; AST::UiScriptBinding *UiScriptBinding; AST::UiArrayBinding *UiArrayBinding; AST::UiObjectMember *UiObjectMember; AST::UiObjectMemberList *UiObjectMemberList; AST::UiArrayMemberList *UiArrayMemberList; AST::UiQualifiedId *UiQualifiedId; }; public: Parser(Engine *engine); ~Parser(); // parse a UI program bool parse() { return parse(T_FEED_UI_PROGRAM); } bool parseStatement() { return parse(T_FEED_JS_STATEMENT); } bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); } bool parseSourceElement() { return parse(T_FEED_JS_SOURCE_ELEMENT); } bool parseUiObjectMember() { return parse(T_FEED_UI_OBJECT_MEMBER); } bool parseProgram() { return parse(T_FEED_JS_PROGRAM); } AST::UiProgram *ast() const { return AST::cast(program); } AST::Statement *statement() const { if (! program) return nullptr; return program->statementCast(); } AST::ExpressionNode *expression() const { if (! program) return nullptr; return program->expressionCast(); } AST::UiObjectMember *uiObjectMember() const { if (! program) return nullptr; return program->uiObjectMemberCast(); } AST::Node *rootNode() const { return program; } QList diagnosticMessages() const { return diagnostic_messages; } inline DiagnosticMessage diagnosticMessage() const { foreach (const DiagnosticMessage &d, diagnostic_messages) { if (d.kind != DiagnosticMessage::Warning) return d; } return DiagnosticMessage(); } inline QString errorMessage() const { return diagnosticMessage().message; } inline int errorLineNumber() const { return diagnosticMessage().loc.startLine; } inline int errorColumnNumber() const { return diagnosticMessage().loc.startColumn; } protected: bool parse(int startToken); void reallocateStack(); inline Value &sym(int index) { return sym_stack [tos + index - 1]; } inline QStringRef &stringRef(int index) { return string_stack [tos + index - 1]; } inline AST::SourceLocation &loc(int index) { return location_stack [tos + index - 1]; } AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr); protected: Engine *driver; MemoryPool *pool; int tos; int stack_size; Value *sym_stack; int *state_stack; AST::SourceLocation *location_stack; QStringRef *string_stack; AST::Node *program; // error recovery enum { TOKEN_BUFFER_SIZE = 3 }; struct SavedToken { int token = 0; double dval = 0.0; AST::SourceLocation loc; QStringRef spell; }; double yylval = 0.0; QStringRef yytokenspell; AST::SourceLocation yylloc; AST::SourceLocation yyprevlloc; SavedToken token_buffer[TOKEN_BUFFER_SIZE]; SavedToken *first_token; SavedToken *last_token; QList diagnostic_messages; }; } // end of namespace QbsQmlJS #define J_SCRIPT_REGEXPLITERAL_RULE1 79 #define J_SCRIPT_REGEXPLITERAL_RULE2 80 #endif // QMLJSPARSER_P_H qbs-src-3.2.0/src/lib/corelib/parser/qmljsglobal_p.h0000644000175100017510000000422715154533055021756 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 QMLJSGLOBAL_P_H #define QMLJSGLOBAL_P_H #include #ifdef QBS_STATIC_LIB #define QML_PARSER_EXPORT #else #ifdef QBS_LIBRARY #define QML_PARSER_EXPORT Q_DECL_EXPORT #else #define QML_PARSER_EXPORT Q_DECL_IMPORT #endif // QBS_LIBRARY #endif // QBS_STATIC_LIB #endif // QMLJSGLOBAL_P_H qbs-src-3.2.0/src/lib/corelib/parser/qmljsmemorypool_p.h0000644000175100017510000001074615154533055022723 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 QMLJSMEMORYPOOL_P_H #define QMLJSMEMORYPOOL_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include "qmljsglobal_p.h" #include #include #include #include namespace QbsQmlJS { class QML_PARSER_EXPORT MemoryPool : public QSharedData { MemoryPool(const MemoryPool &other); void operator =(const MemoryPool &other); public: MemoryPool() : _blocks(nullptr), _allocatedBlocks(0), _blockCount(-1), _ptr(nullptr), _end(nullptr) { } ~MemoryPool() { if (_blocks) { for (int i = 0; i < _allocatedBlocks; ++i) { if (char *b = _blocks[i]) free(b); } free(_blocks); } } inline void *allocate(size_t size) { size = (size + 7) & ~7; if (_ptr && (_ptr + size < _end)) { void *addr = _ptr; _ptr += size; return addr; } return allocate_helper(size); } void reset() { _blockCount = -1; _ptr = _end = nullptr; } private: void *allocate_helper(size_t size) { Q_ASSERT(size < BLOCK_SIZE); if (++_blockCount == _allocatedBlocks) { if (! _allocatedBlocks) _allocatedBlocks = DEFAULT_BLOCK_COUNT; else _allocatedBlocks *= 2; _blocks = (char **) realloc(_blocks, sizeof(char *) * _allocatedBlocks); for (int index = _blockCount; index < _allocatedBlocks; ++index) _blocks[index] = nullptr; } char *&block = _blocks[_blockCount]; if (! block) block = (char *) malloc(BLOCK_SIZE); _ptr = block; _end = _ptr + BLOCK_SIZE; void *addr = _ptr; _ptr += size; return addr; } private: char **_blocks; int _allocatedBlocks; int _blockCount; char *_ptr; char *_end; enum { BLOCK_SIZE = 8 * 1024, DEFAULT_BLOCK_COUNT = 8 }; }; class QML_PARSER_EXPORT Managed { Managed(const Managed &other); void operator = (const Managed &other); public: Managed() = default; ~Managed() = default; void *operator new(size_t size, MemoryPool *pool) { return pool->allocate(size); } void operator delete(void *) {} void operator delete(void *, MemoryPool *) {} }; } // namespace QbsQmlJS #endif qbs-src-3.2.0/src/lib/corelib/jsextensions/0000755000175100017510000000000015154533055020212 5ustar runnerrunnerqbs-src-3.2.0/src/lib/corelib/jsextensions/moduleproperties.cpp0000644000175100017510000003441115154533055024323 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "moduleproperties.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { JSValue createDataForModuleScriptValue(ScriptEngine *engine, const Artifact *artifact) { JSValue data = JS_NewObjectClass(engine->context(), engine->dataWithPtrClass()); attachPointerTo(data, artifact); return data; } static JSValue getModuleProperty(const ResolvedProduct *product, const Artifact *artifact, ScriptEngine *engine, const QString &moduleName, const QString &propertyName, bool *isPresent = nullptr) { const PropertyMapConstPtr &properties = artifact ? artifact->properties : product->moduleProperties; QVariant value; if (engine->isPropertyCacheEnabled()) value = engine->retrieveFromPropertyCache(moduleName, propertyName, properties); if (!value.isValid()) { value = properties->moduleProperty(moduleName, propertyName, isPresent); // Cache the variant value. We must not cache the script value here, because it's a // reference and the user might change the actual object. if (engine->isPropertyCacheEnabled()) engine->addToPropertyCache(moduleName, propertyName, properties, value); } else if (isPresent) { *isPresent = true; } const Property p(product->uniqueName(), moduleName, propertyName, value, Property::PropertyInModule); if (artifact) engine->addPropertyRequestedFromArtifact(artifact, p); else engine->addPropertyRequestedInScript(p); return engine->toScriptValue(value); } struct ModuleData { JSValue dependencyParameters = JS_UNDEFINED; const Artifact *artifact = nullptr; }; ModuleData getModuleData(JSContext *ctx, JSValue obj) { const ScopedJsValue jsData(ctx, getJsProperty(ctx, obj, StringConstants::dataPropertyInternal())); ModuleData data; data.dependencyParameters = JS_GetPropertyUint32(ctx, jsData, DependencyParametersKey); data.artifact = attachedPointer( jsData, ScriptEngine::engineForContext(ctx)->dataWithPtrClass()); return data; } static int getModulePropertyNames(JSContext *ctx, JSPropertyEnum **ptab, uint32_t *plen, JSValueConst obj) { const auto engine = ScriptEngine::engineForContext(ctx); const ModuleData data = getModuleData(ctx, obj); const auto module = attachedPointer(obj, engine->modulePropertyScriptClass()); QBS_ASSERT(module, return -1); const PropertyMapInternal *propertyMap; QStringList additionalProperties; if (data.artifact) { propertyMap = data.artifact->properties.get(); } else { propertyMap = module->product->moduleProperties.get(); if (JS_IsObject(data.dependencyParameters)) additionalProperties.push_back(StringConstants::parametersProperty()); } JS_FreeValue(ctx, data.dependencyParameters); getPropertyNames(ctx, ptab, plen, propertyMap->value().value(module->name).toMap(), additionalProperties, engine->baseModuleScriptValue(module)); return 0; } static int getModuleProperty(JSContext *ctx, JSPropertyDescriptor *desc, JSValueConst obj, JSAtom prop) { if (desc) { desc->getter = desc->setter = desc->value = JS_UNDEFINED; desc->flags = JS_PROP_ENUMERABLE; } const auto engine = ScriptEngine::engineForContext(ctx); const QString name = getJsString(ctx, prop); const ModuleData data = getModuleData(ctx, obj); const auto module = attachedPointer(obj, engine->modulePropertyScriptClass()); QBS_ASSERT(module, return -1); ScopedJsValue parametersMgr(ctx, data.dependencyParameters); if (name == StringConstants::parametersProperty()) { if (desc) desc->value = parametersMgr.release(); return 1; } bool isPresent; JSValue value = getModuleProperty( module->product, data.artifact, ScriptEngine::engineForContext(ctx), module->name, name, &isPresent); if (isPresent) { if (desc) desc->value = value; return 1; } ScopedJsValue v(ctx, JS_GetProperty(ctx, engine->baseModuleScriptValue(module), prop)); const int ret = JS_IsUndefined(v) ? 0 : 1; if (desc) desc->value = v.release(); return ret; } static JSValue js_moduleDependencies(JSContext *ctx, JSValueConst this_val, int , JSValueConst *) { ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const auto module = attachedPointer(this_val, engine->dataWithPtrClass()); JSValue result = JS_NewArray(engine->context()); quint32 idx = 0; for (const QString &depName : std::as_const(module->moduleDependencies)) { for (const auto &dep : module->product->modules) { if (dep->name != depName) continue; JSValue obj = JS_NewObjectClass(ctx, engine->modulePropertyScriptClass()); attachPointerTo(obj, dep.get()); JSValue data = createDataForModuleScriptValue(engine, nullptr); const QVariantMap ¶ms = module->product->moduleParameters.value(dep); JS_SetPropertyUint32(ctx, data, DependencyParametersKey, dependencyParametersValue(module->product->uniqueName(), dep->name, params, engine)); defineJsProperty(ctx, obj, StringConstants::dataPropertyInternal(), data); JS_SetPropertyUint32(ctx, result, idx++, obj); break; } } QBS_ASSERT(idx == quint32(module->moduleDependencies.size()),;); return result; } template static JSValue moduleProperty(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) { if (Q_UNLIKELY(argc < 2)) return throwError(ctx, Tr::tr("Function moduleProperty() expects 2 arguments")); ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const ResolvedProduct *product = nullptr; const Artifact *artifact = nullptr; if constexpr (std::is_same_v) { product = attachedPointer(this_val, engine->productPropertyScriptClass()); } else { artifact = attachedPointer(this_val, engine->dataWithPtrClass()); product = artifact->product; } const QString moduleName = getJsString(ctx, argv[0]); const QString propertyName = getJsString(ctx, argv[1]); return getModuleProperty(product, artifact, engine, moduleName, propertyName); } template static JSValue js_moduleProperty(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) { try { return moduleProperty(ctx, this_val, argc, argv); } catch (const ErrorInfo &e) { return throwError(ctx, e.toString()); } } template static void initModuleProperties(ScriptEngine *engine, JSValue objectWithProperties) { JSContext * const ctx = engine->context(); JSValue func = JS_NewCFunction(ctx, js_moduleProperty, "moduleProperty", 2); setJsProperty(ctx, objectWithProperties, std::string_view("moduleProperty"), func); } static JSValue setupBaseModuleScriptValue(ScriptEngine *engine, const ResolvedModule *module) { JSValue &moduleScriptValue = engine->baseModuleScriptValue(module); if (JS_IsObject(moduleScriptValue)) return moduleScriptValue; const ScopedJsValue proto(engine->context(), JS_NewObject(engine->context())); moduleScriptValue = JS_NewObjectProtoClass(engine->context(), proto, engine->dataWithPtrClass()); attachPointerTo(moduleScriptValue, module); QByteArray name = StringConstants::dependenciesProperty().toUtf8(); const ScopedJsValue depfunc( engine->context(), JS_NewCFunction(engine->context(), js_moduleDependencies, name.constData(), 0)); const ScopedJsAtom depAtom(engine->context(), name); JS_DefineProperty(engine->context(), moduleScriptValue, depAtom, JS_UNDEFINED, depfunc, JS_UNDEFINED, JS_PROP_HAS_GET | JS_PROP_ENUMERABLE); name = StringConstants::artifactsProperty().toUtf8(); const ScopedJsValue artifactsFunc( engine->context(), JS_NewCFunction(engine->context(), &artifactsScriptValueForModule, name.constData(), 0)); const ScopedJsAtom artifactsAtom(engine->context(), name); JS_DefineProperty(engine->context(), moduleScriptValue, artifactsAtom, JS_UNDEFINED, artifactsFunc, JS_UNDEFINED, JS_PROP_HAS_GET | JS_PROP_ENUMERABLE); return moduleScriptValue; } void ModuleProperties::init(ScriptEngine *engine, JSValue productObject, const ResolvedProduct *product) { initModuleProperties(engine, productObject); setupModules(engine, productObject, product, nullptr); } void ModuleProperties::init(ScriptEngine *engine, JSValue artifactObject, const Artifact *artifact) { initModuleProperties(engine, artifactObject); const auto product = artifact->product; const QVariantMap productProperties { {StringConstants::buildDirectoryProperty(), product->buildDirectory()}, {StringConstants::destinationDirProperty(), product->destinationDirectory}, {StringConstants::nameProperty(), product->name}, {StringConstants::sourceDirectoryProperty(), product->sourceDirectory}, {StringConstants::targetNameProperty(), product->targetName}, {StringConstants::typeProperty(), sorted(product->fileTags.toStringList())} }; setJsProperty(engine->context(), artifactObject, StringConstants::productVar(), engine->toScriptValue(productProperties)); setupModules(engine, artifactObject, artifact->product.get(), artifact); } void ModuleProperties::setModuleScriptValue(ScriptEngine *engine, JSValue targetObject, const JSValue &moduleObject, const QString &moduleName) { const QualifiedId name = QualifiedId::fromString(moduleName); JSValue obj = targetObject; for (int i = 0; i < name.size() - 1; ++i) { JSValue tmp = getJsProperty(engine->context(), obj, name.at(i)); if (!JS_IsObject(tmp)) { tmp = engine->newObject(); setJsProperty(engine->context(), obj, name.at(i), tmp); } else { JS_FreeValue(engine->context(), tmp); } obj = tmp; } setJsProperty(engine->context(), obj, name.last(), moduleObject); if (name.size() > 1) { setJsProperty(engine->context(), targetObject, moduleName, JS_DupValue(engine->context(), moduleObject)); } } void ModuleProperties::setupModules(ScriptEngine *engine, JSValue &object, const ResolvedProduct *product, const Artifact *artifact) { JSClassID modulePropertyScriptClass = engine->modulePropertyScriptClass(); if (modulePropertyScriptClass == 0) { modulePropertyScriptClass = engine->registerClass("ModulePropertyScriptClass", nullptr, nullptr, JS_UNDEFINED, &getModulePropertyNames, &getModuleProperty); engine->setModulePropertyScriptClass(modulePropertyScriptClass); } for (const auto &module : product->modules) { setupBaseModuleScriptValue(engine, module.get()); JSValue moduleObject = JS_NewObjectClass(engine->context(), modulePropertyScriptClass); attachPointerTo(moduleObject, module.get()); defineJsProperty(engine->context(), moduleObject, StringConstants::dataPropertyInternal(), createDataForModuleScriptValue(engine, artifact)); setModuleScriptValue(engine, object, moduleObject, module->name); } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/jsextensions/moduleproperties.h0000644000175100017510000000566615154533055024002 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_MODULEPROPERTIES_H #define QBS_MODULEPROPERTIES_H #include #include #include namespace qbs { namespace Internal { class ScriptEngine; enum ModulePropertiesScriptValueCommonPropertyKeys : quint32 { ModuleNameKey, DependencyParametersKey, }; JSValue createDataForModuleScriptValue(ScriptEngine *engine, const Artifact *artifact); class ModuleProperties { public: static void init(ScriptEngine *engine, JSValue productObject, const ResolvedProduct *product); static void init(ScriptEngine *engine, JSValue artifactObject, const Artifact *artifact); static void setModuleScriptValue(ScriptEngine *engine, JSValue targetObject, const JSValue &moduleObject, const QString &moduleName); private: static void setupModules(ScriptEngine *engine, JSValue &object, const ResolvedProduct *product, const Artifact *artifact); }; } // namespace Internal } // namespace qbs #endif // QBS_MODULEPROPERTIES_H qbs-src-3.2.0/src/lib/corelib/jsextensions/propertylistutils.mm0000644000175100017510000001724715154533055024421 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Petroules Corporation. ** Copyright (C) 2016 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$ ** ****************************************************************************/ #import #include "propertylistutils.h" #include #include #include #include static QVariant fromObject(id obj, bool isPlist); static QVariantMap fromDictionary(NSDictionary *dict, bool isPlist); static QVariantList fromArray(NSArray *array, bool isPlist); static QVariant fromObject(id obj, bool isPlist) { QVariant value; if (!obj) { return value; } else if ([obj isKindOfClass:[NSDictionary class]]) { value = fromDictionary(obj, isPlist); } else if ([obj isKindOfClass:[NSArray class]]) { value = fromArray(obj, isPlist); } else if ([obj isKindOfClass:[NSString class]]) { value = QString::fromNSString(obj); } else if ([obj isKindOfClass:[NSData class]]) { value = QByteArray::fromNSData(obj); } else if ([obj isKindOfClass:[NSDate class]]) { value = QDateTime::fromNSDate(obj); } else if ([obj isKindOfClass:[NSNumber class]]) { if (strcmp([(NSNumber *)obj objCType], @encode(BOOL)) == 0) { value = static_cast([obj boolValue]); } else if (strcmp([(NSNumber *)obj objCType], @encode(signed char)) == 0) { if (isPlist) { value = static_cast([obj boolValue]); } else { value = [obj charValue]; } } else if (strcmp([(NSNumber *)obj objCType], @encode(unsigned char)) == 0) { if (isPlist) { value = static_cast([obj boolValue]); } else { value = [obj unsignedCharValue]; } } else if (strcmp([(NSNumber *)obj objCType], @encode(signed short)) == 0) { value = [obj shortValue]; } else if (strcmp([(NSNumber *)obj objCType], @encode(unsigned short)) == 0) { value = [obj unsignedShortValue]; } else if (strcmp([(NSNumber *)obj objCType], @encode(signed int)) == 0) { value = [obj intValue]; } else if (strcmp([(NSNumber *)obj objCType], @encode(unsigned int)) == 0) { value = [obj unsignedIntValue]; } else if (strcmp([(NSNumber *)obj objCType], @encode(signed long long)) == 0) { value = [obj longLongValue]; } else if (strcmp([(NSNumber *)obj objCType], @encode(unsigned long long)) == 0) { value = [obj unsignedLongLongValue]; } else if (strcmp([(NSNumber *)obj objCType], @encode(float)) == 0) { value = [obj floatValue]; } else if (strcmp([(NSNumber *)obj objCType], @encode(double)) == 0) { value = [obj doubleValue]; } else { // NSDecimal or unknown value = [obj doubleValue]; } } else if ([obj isKindOfClass:[NSNull class]]) { // A null variant, close enough... } else { // unknown } return value; } static QVariantMap fromDictionary(NSDictionary *dict, bool isPlist) { QVariantMap map; for (NSString *key in dict) map[QString::fromNSString(key)] = fromObject([dict objectForKey:key], isPlist); return map; } static QVariantList fromArray(NSArray *array, bool isPlist) { QVariantList list; for (id obj in array) list.push_back(fromObject(obj, isPlist)); return list; } QVariant QPropertyListUtils::fromPropertyList(id plist) { return fromObject(plist, true); } static id toObject(const QVariant &variant); static NSDictionary *toDictionary(const QVariantMap &map); static NSArray *toArray(const QVariantList &list); static id toObject(const QVariant &variant) { if (variant.userType() == QMetaType::QVariantHash) { return toDictionary(qHashToMap(variant.toHash())); } else if (variant.userType() == QMetaType::QVariantMap) { return toDictionary(variant.toMap()); } else if (variant.userType() == QMetaType::QVariantList) { return toArray(variant.toList()); } else if (variant.userType() == QMetaType::QString) { return variant.toString().toNSString(); } else if (variant.userType() == QMetaType::QByteArray) { return variant.toByteArray().toNSData(); } else if (variant.userType() == QMetaType::QDate || variant.userType() == QMetaType::QDateTime) { return variant.toDateTime().toNSDate(); } else if (variant.userType() == QMetaType::Bool) { return variant.toBool() ? [NSNumber numberWithBool:YES] : [NSNumber numberWithBool:NO]; } else if (variant.userType() == QMetaType::Char || variant.userType() == QMetaType::Int) { return [NSNumber numberWithInt:variant.toInt()]; } else if (variant.userType() == QMetaType::UInt) { return [NSNumber numberWithUnsignedInt:variant.toUInt()]; } else if (variant.userType() == QMetaType::LongLong) { return [NSNumber numberWithLongLong:variant.toLongLong()]; } else if (variant.userType() == QMetaType::ULongLong) { return [NSNumber numberWithUnsignedLongLong:variant.toULongLong()]; } else if (variant.userType() == QMetaType::Double) { return [NSNumber numberWithDouble:variant.toDouble()]; } else { return [NSNull null]; } } static NSDictionary *toDictionary(const QVariantMap &map) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) [dict setObject:toObject(i.value()) forKey:i.key().toNSString()]; return [NSDictionary dictionaryWithDictionary:dict]; } static NSArray *toArray(const QVariantList &list) { NSMutableArray *array = [NSMutableArray array]; for (const QVariant &variant : list) [array addObject:toObject(variant)]; return [NSArray arrayWithArray:array]; } id QPropertyListUtils::toPropertyList(const QVariant &variant) { return toObject(variant); } qbs-src-3.2.0/src/lib/corelib/jsextensions/propertylist_darwin.mm0000644000175100017510000003054615154533055024701 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2015 Petroules Corporation. ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "jsextension.h" #include "propertylistutils.h" #include #include #include #include #include #include #include namespace qbs { namespace Internal { class PropertyList : public JsExtension { public: static const char *name() { return "PropertyList"; } static JSValue ctor(JSContext *ctx, JSValueConst, JSValueConst, int, JSValueConst *, int); PropertyList(JSContext *) {} static void setupMethods(JSContext *ctx, JSValue obj); DEFINE_JS_FORWARDER(jsIsEmpty, &PropertyList::isEmpty, "PropertyList.isEmpty"); DEFINE_JS_FORWARDER(jsClear, &PropertyList::clear, "PropertyList.clear"); DEFINE_JS_FORWARDER(jsReadFromObject, &PropertyList::readFromObject, "PropertyList.readFromObject"); DEFINE_JS_FORWARDER(jsReadFromString, &PropertyList::readFromString, "PropertyList.readFromString"); DEFINE_JS_FORWARDER(jsReadFromFile, &PropertyList::readFromFile, "PropertyList.readFromFile"); DEFINE_JS_FORWARDER(jsReadFromData, &PropertyList::readFromData, "PropertyList.readFromData"); DEFINE_JS_FORWARDER(jsWriteToFile, &PropertyList::writeToFile, "PropertyList.writeToFile"); DEFINE_JS_FORWARDER(jsFormat, &PropertyList::format, "PropertyList.format"); DEFINE_JS_FORWARDER(jsToObject, &PropertyList::toObject, "PropertyList.toObject"); DEFINE_JS_FORWARDER(jsToString, &PropertyList::toString, "PropertyList.toString"); DEFINE_JS_FORWARDER(jsToXmlString, &PropertyList::toXMLString, "PropertyList.toXMLString"); static JSValue jsToJson(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { try { QString style; if (argc > 0) style = fromArg(ctx, "Process.exec", 1, argv[0]); return toJsValue(ctx, fromJsObject(ctx, this_val)->toJSON(style)); } catch (const QString &error) { return throwError(ctx, error); } } private: bool isEmpty() const { return m_propertyListObject.isNull(); } void clear(); void readFromObject(const QVariant &value); void readFromString(const QString &input); void readFromFile(const QString &filePath); void readFromData(const QByteArray &data); void writeToFile(const QString &filePath, const QString &plistFormat); std::optional format() const; QVariant toObject() const { return m_propertyListObject.isNull() ? QVariantMap() : m_propertyListObject; } QString toString(const QString &plistFormat) const; QString toXMLString() const; QString toJSON(const QString &style = QString()) const; QByteArray writeToData(const QString &format) const; QVariant m_propertyListObject; int m_propertyListFormat = 0; }; // Same values as CoreFoundation and Foundation APIs enum { QPropertyListOpenStepFormat = 1, QPropertyListXMLFormat_v1_0 = 100, QPropertyListBinaryFormat_v1_0 = 200, QPropertyListJSONFormat = 1000 // If this conflicts someday, just change it :) }; JSValue PropertyList::ctor(JSContext *ctx, JSValueConst, JSValueConst, int, JSValueConst *, int) { try { JSValue obj = createObject(ctx); const auto se = ScriptEngine::engineForContext(ctx); const DubiousContextList dubiousContexts{ DubiousContext(EvalContext::PropertyEvaluation, DubiousContext::SuggestMoving) }; se->checkContext(QStringLiteral("qbs.PropertyList"), dubiousContexts); return obj; } catch (const QString &error) { return throwError(ctx, error); } } void PropertyList::setupMethods(JSContext *ctx, JSValue obj) { setupMethod(ctx, obj, "isEmpty", &jsIsEmpty, 0); setupMethod(ctx, obj, "clear", &jsClear, 0); setupMethod(ctx, obj, "readFromObject", &jsReadFromObject, 1); setupMethod(ctx, obj, "readFromString", &jsReadFromString, 1); setupMethod(ctx, obj, "readFromFile", &jsReadFromFile, 1); setupMethod(ctx, obj, "readFromData", &jsReadFromData, 1); setupMethod(ctx, obj, "writeToFile", &jsWriteToFile, 1); setupMethod(ctx, obj, "format", &jsFormat, 0); setupMethod(ctx, obj, "toObject", &jsToObject, 0); setupMethod(ctx, obj, "toString", &jsToString, 1); setupMethod(ctx, obj, "toXMLString", &jsToXmlString, 1); setupMethod(ctx, obj, "toJSON", &jsToJson, 1); } void PropertyList::clear() { m_propertyListObject = QVariant(); m_propertyListFormat = 0; } void PropertyList::readFromObject(const QVariant &value) { m_propertyListObject = value; m_propertyListFormat = 0; // wasn't deserialized from any external format } void PropertyList::readFromString(const QString &input) { readFromData(input.toUtf8()); } void PropertyList::readFromFile(const QString &filePath) { QFile file(filePath); if (file.open(QIODevice::ReadOnly)) { const QByteArray data = file.readAll(); if (file.error() == QFile::NoError) { readFromData(data); return; } } throw QStringLiteral("%1: %2").arg(filePath).arg(file.errorString()); } void PropertyList::readFromData(const QByteArray &data) { @autoreleasepool { NSPropertyListFormat format; int internalFormat = 0; NSString *errorString = nil; id plist = [NSPropertyListSerialization propertyListWithData:data.toNSData() options:0 format:&format error:nil]; if (plist) { internalFormat = format; } else { NSError *error = nil; plist = [NSJSONSerialization JSONObjectWithData:data.toNSData() options:0 error:&error]; if (Q_UNLIKELY(!plist)) { errorString = [error localizedDescription]; } else { internalFormat = QPropertyListJSONFormat; } } if (Q_UNLIKELY(!plist)) throw QString::fromNSString(errorString); QVariant obj = QPropertyListUtils::fromPropertyList(plist); if (!obj.isNull()) { m_propertyListObject = obj; m_propertyListFormat = internalFormat; } else { throw Tr::tr("error converting property list"); } } } void PropertyList::writeToFile(const QString &filePath, const QString &plistFormat) { QFile file(filePath); QByteArray data = writeToData(plistFormat); if (Q_LIKELY(!data.isEmpty())) { if (file.open(QIODevice::WriteOnly) && file.write(data) == data.size()) { return; } } throw QStringLiteral("%1: %2").arg(filePath).arg(file.errorString()); } std::optional PropertyList::format() const { switch (m_propertyListFormat) { case QPropertyListOpenStepFormat: return QStringLiteral("openstep"); case QPropertyListXMLFormat_v1_0: return QStringLiteral("xml1"); case QPropertyListBinaryFormat_v1_0: return QStringLiteral("binary1"); case QPropertyListJSONFormat: return QStringLiteral("json"); default: return {}; } } QString PropertyList::toString(const QString &plistFormat) const { if (plistFormat == QLatin1String("binary1")) { throw Tr::tr("Property list object cannot be converted to a " "string in the binary1 format; this format can only " "be written directly to a file"); } if (!isEmpty()) return QString::fromUtf8(writeToData(plistFormat)); return {}; } QString PropertyList::toXMLString() const { return toString(QStringLiteral("xml1")); } QString PropertyList::toJSON(const QString &style) const { QString format = QLatin1String("json"); if (!style.isEmpty()) format += QLatin1String("-") + style; return toString(format); } QByteArray PropertyList::writeToData(const QString &format) const { @autoreleasepool { NSError *error = nil; NSString *errorString = nil; NSData *data = nil; id obj = QPropertyListUtils::toPropertyList(m_propertyListObject); if (!obj) throw Tr::tr("error converting property list"); if (format == QLatin1String("json") || format == QLatin1String("json-pretty") || format == QLatin1String("json-compact")) { if ([NSJSONSerialization isValidJSONObject:obj]) { error = nil; errorString = nil; const NSJSONWritingOptions options = format == QLatin1String("json-pretty") ? NSJSONWritingPrettyPrinted : 0; data = [NSJSONSerialization dataWithJSONObject:obj options:options error:&error]; if (Q_UNLIKELY(!data)) { errorString = [error localizedDescription]; } } else { errorString = @"Property list object cannot be converted to JSON data"; } } else if (format == QLatin1String("xml1") || format == QLatin1String("binary1")) { const NSPropertyListFormat plistFormat = format == QLatin1String("xml1") ? NSPropertyListXMLFormat_v1_0 : NSPropertyListBinaryFormat_v1_0; error = nil; errorString = nil; data = [NSPropertyListSerialization dataWithPropertyList:obj format:plistFormat options:0 error:&error]; if (Q_UNLIKELY(!data)) { errorString = [error localizedDescription]; } } else { errorString = [NSString stringWithFormat:@"Property lists cannot be written in the '%s' " @"format", format.toUtf8().constData()]; } if (Q_UNLIKELY(!data)) throw QString::fromNSString(errorString); return QByteArray::fromNSData(data); } } } // namespace Internal } // namespace qbs void initializeJsExtensionPropertyList(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { qbs::Internal::PropertyList::registerClass(engine, extensionObject); } qbs-src-3.2.0/src/lib/corelib/jsextensions/fileinfoextension.cpp0000644000175100017510000003454415154533055024460 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "jsextension.h" #include #include #include #include #include #include #include namespace qbs { namespace Internal { // removes duplicate separators from the path static QString uniqueSeparators(QString path) { const auto it = std::unique(path.begin(), path.end(), [](QChar c1, QChar c2) { return c1 == c2 && c1 == QLatin1Char('/'); }); path.resize(int(it - path.begin())); return path; } class FileInfoExtension : public JsExtension { public: static const char *name() { return "FileInfo"; } static void setupStaticMethods(JSContext *ctx, JSValue classObj); static JSValue jsPath(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsFileName(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsBaseName(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsSuffix(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsCompleteSuffix(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsCanonicalPath(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsCleanPath(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsCompleteBaseName(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsRelativePath(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsResolvePath(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsIsAbsolutePath(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsToWindowsSeparators(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsFromWindowsSeparators(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsToNativeSeparators(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsFromNativeSeparators(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsJoinPaths(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsPathListSeparator(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue jsPathSeparator(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue jsExecutableSuffix(JSContext *ctx, JSValueConst, int, JSValueConst *); }; void FileInfoExtension::setupStaticMethods(JSContext *ctx, JSValue classObj) { setupMethod(ctx, classObj, StringConstants::fileInfoPath(), &FileInfoExtension::jsPath, 1); setupMethod(ctx, classObj, StringConstants::fileInfoFileName(), &FileInfoExtension::jsFileName, 1); setupMethod(ctx, classObj, StringConstants::baseNameProperty(), &FileInfoExtension::jsBaseName, 1); setupMethod(ctx, classObj, "suffix", &FileInfoExtension::jsSuffix, 1); setupMethod(ctx, classObj, "completeSuffix", &FileInfoExtension::jsCompleteSuffix, 1); setupMethod(ctx, classObj, "canonicalPath", &FileInfoExtension::jsCanonicalPath, 1); setupMethod(ctx, classObj, "cleanPath", &FileInfoExtension::jsCleanPath, 1); setupMethod(ctx, classObj, StringConstants::completeBaseNameProperty(), &FileInfoExtension::jsCompleteBaseName, 1); setupMethod(ctx, classObj, "relativePath", &FileInfoExtension::jsRelativePath, 1); setupMethod(ctx, classObj, "resolvePath", &FileInfoExtension::jsResolvePath, 1); setupMethod(ctx, classObj, "isAbsolutePath", &FileInfoExtension::jsIsAbsolutePath, 1); setupMethod(ctx, classObj, "toWindowsSeparators", &FileInfoExtension::jsToWindowsSeparators, 1); setupMethod(ctx, classObj, "fromWindowsSeparators", &FileInfoExtension::jsFromWindowsSeparators, 1); setupMethod(ctx, classObj, "toNativeSeparators", &FileInfoExtension::jsToNativeSeparators, 1); setupMethod(ctx, classObj, "fromNativeSeparators", &FileInfoExtension::jsFromNativeSeparators, 1); setupMethod(ctx, classObj, "joinPaths", &FileInfoExtension::jsJoinPaths, 0); setupMethod(ctx, classObj, "pathListSeparator", &FileInfoExtension::jsPathListSeparator, 0); setupMethod(ctx, classObj, "pathSeparator", &FileInfoExtension::jsPathSeparator, 0); setupMethod(ctx, classObj, "executableSuffix", &FileInfoExtension::jsExecutableSuffix, 0); } JSValue FileInfoExtension::jsPath(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "FileInfo.path", argc, argv); HostOsInfo::HostOs hostOs = HostOsInfo::hostOs(); if (argc > 1) { const auto osList = fromArg(ctx, "FileInfo.path", 2, argv[1]); hostOs = osList.contains(QLatin1String("windows")) ? HostOsInfo::HostOsWindows : HostOsInfo::HostOsOtherUnix; } return makeJsString(ctx, FileInfo::path(filePath, hostOs)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsFileName(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "FileInfo.fileName", argc, argv); return makeJsString(ctx, FileInfo::fileName(filePath)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsBaseName(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "FileInfo.baseName", argc, argv); return makeJsString(ctx, FileInfo::baseName(filePath)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsSuffix(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "FileInfo.suffix", argc, argv); return makeJsString(ctx, FileInfo::suffix(filePath)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsCompleteSuffix(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "FileInfo.completeSuffix", argc, argv); return makeJsString(ctx, FileInfo::completeSuffix(filePath)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsCanonicalPath(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "FileInfo.canonicalPath", argc, argv); return makeJsString(ctx, QFileInfo(filePath).canonicalFilePath()); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsCleanPath(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "FileInfo.cleanPath", argc, argv); return makeJsString(ctx, QDir::cleanPath(filePath)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsCompleteBaseName(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "FileInfo.completeBaseName", argc, argv); return makeJsString(ctx, FileInfo::completeBaseName(filePath)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsRelativePath(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto args = getArguments(ctx, "File.relativePath", argc, argv); const QString baseDir = std::get<0>(args); const QString filePath = std::get<1>(args); if (!FileInfo::isAbsolute(baseDir)) { throw Tr::tr("FileInfo.relativePath() expects an absolute path as " "its first argument, but it is '%1'.").arg(baseDir); } if (!FileInfo::isAbsolute(filePath)) { throw Tr::tr("FileInfo.relativePath() expects an absolute path as " "its second argument, but it is '%1'.").arg(filePath); } return makeJsString(ctx, QDir(baseDir).relativeFilePath(filePath)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsResolvePath(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto args = getArguments(ctx, "File.resolvePath", argc, argv); const QString base = std::get<0>(args); const QString rel = std::get<1>(args); return makeJsString(ctx, FileInfo::resolvePath(base, rel)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsIsAbsolutePath(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "FileInfo.isAbsolutePath", argc, argv); HostOsInfo::HostOs hostOs = HostOsInfo::hostOs(); if (argc > 1) { const auto osList = fromArg(ctx, "FileInfo.isAbsolutePath", 2, argv[1]); hostOs = osList.contains(QLatin1String("windows")) ? HostOsInfo::HostOsWindows : HostOsInfo::HostOsOtherUnix; } return JS_NewBool(ctx, FileInfo::isAbsolute(filePath, hostOs)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsToWindowsSeparators(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { auto filePath = getArgument(ctx, "FileInfo.toWindowsSeparators", argc, argv); return makeJsString(ctx, filePath.replace(QLatin1Char('/'), QLatin1Char('\\'))); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsFromWindowsSeparators(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { auto filePath = getArgument(ctx, "FileInfo.fromWindowsSeparators", argc, argv); return makeJsString(ctx, filePath.replace(QLatin1Char('\\'), QLatin1Char('/'))); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsToNativeSeparators(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "FileInfo.toWindowsSeparators", argc, argv); return makeJsString(ctx, QDir::toNativeSeparators(filePath)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsFromNativeSeparators(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "FileInfo.fromWindowsSeparators", argc, argv); return makeJsString(ctx, QDir::fromNativeSeparators(filePath)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsJoinPaths(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { QStringList paths; for (int i = 0; i < argc; ++i) { const auto value = fromArg(ctx, "FileInfo.joinPaths", i + 1, argv[i]); if (!value.isEmpty()) paths.push_back(value); } return makeJsString(ctx, uniqueSeparators(paths.join(QLatin1Char('/')))); } catch (const QString &error) { return throwError(ctx, error); } } JSValue FileInfoExtension::jsPathListSeparator(JSContext *ctx, JSValue, int, JSValue *) { return makeJsString(ctx, QString(HostOsInfo::pathListSeparator())); } JSValue FileInfoExtension::jsPathSeparator(JSContext *ctx, JSValue, int, JSValue *) { return makeJsString(ctx, QString(HostOsInfo::pathSeparator())); } JSValue FileInfoExtension::jsExecutableSuffix(JSContext *ctx, JSValue, int, JSValue *) { static QString executableSuffix = HostOsInfo::isWindowsHost() ? QLatin1String(QBS_HOST_EXE_SUFFIX) : QString(); return makeJsString(ctx, executableSuffix); } } // namespace Internal } // namespace qbs void initializeJsExtensionFileInfo(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { qbs::Internal::FileInfoExtension::registerClass(engine, extensionObject); } qbs-src-3.2.0/src/lib/corelib/jsextensions/process.cpp0000644000175100017510000003200715154533055022376 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "jsextension.h" #include #include #include #include #include #include #include #include #include #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #include #else #include #endif namespace qbs { namespace Internal { class Process : public JsExtension { friend class JsExtension; public: static const char *name() { return "Process"; } static JSValue ctor(JSContext *ctx, JSValueConst, JSValueConst, int, JSValueConst *, int); static void setupStaticMethods(JSContext *ctx, JSValue classObj); static void setupMethods(JSContext *ctx, JSValue obj); Process(JSContext *context); DEFINE_JS_FORWARDER(jsGetEnv, &Process::getEnv, "Process.getEnv") DEFINE_JS_FORWARDER(jsSetEnv, &Process::setEnv, "Process.setEnv") DEFINE_JS_FORWARDER(jsSetCodec, &Process::setCodec, "Process.setCodec") DEFINE_JS_FORWARDER(jsWorkingDir, &Process::workingDirectory, "Process.workingDirectory") DEFINE_JS_FORWARDER(jsSetWorkingDir, &Process::setWorkingDirectory, "Process.setWorkingDirectory") DEFINE_JS_FORWARDER(jsStart, &Process::start, "Process.start") DEFINE_JS_FORWARDER(jsClose, &Process::close, "Process.close") DEFINE_JS_FORWARDER(jsTerminate, &Process::terminate, "Process.terminate") DEFINE_JS_FORWARDER(jsKill, &Process::kill, "Process.kill") DEFINE_JS_FORWARDER(jsReadLine, &Process::readLine, "Process.readLine") DEFINE_JS_FORWARDER(jsAtEnd, &Process::atEnd, "Process.atEnd") DEFINE_JS_FORWARDER(jsReadStdOut, &Process::readStdOut, "Process.readStdOut") DEFINE_JS_FORWARDER(jsReadStdErr, &Process::readStdErr, "Process.readStdErr") DEFINE_JS_FORWARDER(jsCloseWriteChannel, &Process::closeWriteChannel, "Process.closeWriteChannel") DEFINE_JS_FORWARDER(jsWrite, &Process::write, "Process.write") DEFINE_JS_FORWARDER(jsWriteLine, &Process::writeLine, "Process.writeLine") DEFINE_JS_FORWARDER(jsExitCode, &Process::exitCode, "Process.exitCode") DEFINE_JS_FORWARDER(jsErrorString, &Process::errorString, "Process.errorString") static JSValue jsExec(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { try { const auto args = getArguments(ctx, "Process.exec", argc, argv); bool throwOnError = false; if (argc > 2) throwOnError = fromArg(ctx, "Process.exec", 3, argv[2]); return JS_NewInt32(ctx, fromJsObject(ctx, this_val) ->exec(std::get<0>(args), std::get<1>(args), throwOnError)); } catch (const QString &error) { return throwError(ctx, error); } } static JSValue jsWaitForFinished(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { try { int msecs = 30000; if (argc > 0) msecs = getArgument(ctx, "Process.waitForFinished", argc, argv); return JS_NewBool(ctx, fromJsObject(ctx, this_val)->waitForFinished(msecs)); } catch (const QString &error) { return throwError(ctx, error); } } QString getEnv(const QString &name) const { return m_environment.value(name); } void setEnv(const QString &name, const QString &value) { m_environment.insert(name, value); } void setCodec(const QString &codec); QString workingDirectory() const { return m_workingDirectory; } void setWorkingDirectory(const QString &dir) { m_workingDirectory = dir; } bool start(const QString &program, const QStringList &arguments); int exec(const QString &program, const QStringList &arguments, bool throwOnError); void close(); bool waitForFinished(int msecs); void terminate() { m_qProcess->terminate(); } void kill() { m_qProcess->kill(); } QString readLine(); bool atEnd() const { return m_qProcess->atEnd(); } QString readStdOut() { return m_codec->toUnicode(m_qProcess->readAllStandardOutput()); } QString readStdErr() { return m_codec->toUnicode(m_qProcess->readAllStandardError()); } void closeWriteChannel() { m_qProcess->closeWriteChannel(); } void write(const QString &str) { m_qProcess->write(m_codec->fromUnicode(str)); } void writeLine(const QString &str); int exitCode() const { return m_qProcess->exitCode(); } QString errorString() const { return m_qProcess->errorString(); } static JSValue jsShellQuote(JSContext *ctx, JSValue, int argc, JSValue *argv); private: QString findExecutable(const QString &filePath) const; std::unique_ptr m_qProcess; QProcessEnvironment m_environment; QString m_workingDirectory; QTextCodec *m_codec = nullptr; }; JSValue Process::ctor(JSContext *ctx, JSValueConst, JSValueConst, int, JSValueConst *, int) { try { JSValue obj = createObject(ctx); Process * const process = fromJsObject(ctx, obj); const auto se = ScriptEngine::engineForContext(ctx); const DubiousContextList dubiousContexts{ DubiousContext(EvalContext::PropertyEvaluation, DubiousContext::SuggestMoving) }; se->checkContext(QStringLiteral("qbs.Process"), dubiousContexts); // Get environment QVariant v = se->property(StringConstants::qbsProcEnvVarInternal()); if (v.isNull()) { // The build environment is not initialized yet. // This can happen if one uses Process on the RHS of a binding like Group.name. process->m_environment = se->environment(); } else { process->m_environment = QProcessEnvironment(*reinterpret_cast(v.value())); } se->setUsesIo(); return obj; } catch (const QString &error) { return throwError(ctx, error); } } void Process::setupStaticMethods(JSContext *ctx, JSValue classObj) { setupMethod(ctx, classObj, "shellQuote", &Process::jsShellQuote, 3); } void Process::setupMethods(JSContext *ctx, JSValue obj) { setupMethod(ctx, obj, "getEnv", &jsGetEnv, 1); setupMethod(ctx, obj, "setEnv", &jsSetEnv, 2); setupMethod(ctx, obj, "setCodec", &jsSetCodec, 1); setupMethod(ctx, obj, "workingDirectory", &jsWorkingDir, 0); setupMethod(ctx, obj, "setWorkingDirectory", &jsSetWorkingDir, 1); setupMethod(ctx, obj, "start", &jsStart, 2); setupMethod(ctx, obj, "exec", &jsExec, 3); setupMethod(ctx, obj, "close", &jsClose, 0); setupMethod(ctx, obj, "waitForFinished", &jsWaitForFinished, 1); setupMethod(ctx, obj, "terminate", &jsTerminate, 0); setupMethod(ctx, obj, "kill", &jsKill, 0); setupMethod(ctx, obj, "readLine", &jsReadLine, 0); setupMethod(ctx, obj, "atEnd", &jsAtEnd, 0); setupMethod(ctx, obj, "readStdOut", &jsReadStdOut, 0); setupMethod(ctx, obj, "readStdErr", &jsReadStdErr, 0); setupMethod(ctx, obj, "closeWriteChannel", &jsCloseWriteChannel, 0); setupMethod(ctx, obj, "write", &jsWrite, 1); setupMethod(ctx, obj, "writeLine", &jsWriteLine, 1); setupMethod(ctx, obj, "exitCode", &jsExitCode, 0); setupMethod(ctx, obj, "errorString", &jsErrorString, 0); } Process::Process(JSContext *) { m_qProcess = std::make_unique(); m_codec = QTextCodec::codecForName("UTF-8"); } bool Process::start(const QString &program, const QStringList &arguments) { if (!m_workingDirectory.isEmpty()) m_qProcess->setWorkingDirectory(m_workingDirectory); m_qProcess->setProcessEnvironment(m_environment); m_qProcess->start(findExecutable(program), arguments, QIODevice::ReadWrite | QIODevice::Text); return m_qProcess->waitForStarted(); } int Process::exec(const QString &program, const QStringList &arguments, bool throwOnError) { if (!start(findExecutable(program), arguments)) { if (throwOnError) throw Tr::tr("Error running '%1': %2").arg(program, m_qProcess->errorString()); return -1; } m_qProcess->closeWriteChannel(); m_qProcess->waitForFinished(-1); if (throwOnError) { if (m_qProcess->error() != QProcess::UnknownError && m_qProcess->error() != QProcess::Crashed) { throw Tr::tr("Error running '%1': %2").arg(program, m_qProcess->errorString()); } else if (m_qProcess->exitStatus() == QProcess::CrashExit || m_qProcess->exitCode() != 0) { QString errorMessage = m_qProcess->error() == QProcess::Crashed ? Tr::tr("Error running '%1': %2").arg(program, m_qProcess->errorString()) : Tr::tr("Process '%1 %2' finished with exit code %3.") .arg(program, arguments.join(QStringLiteral(" "))) .arg(m_qProcess->exitCode()); const QString stdOut = readStdOut(); if (!stdOut.isEmpty()) errorMessage.append(Tr::tr(" The standard output was:\n")).append(stdOut); const QString stdErr = readStdErr(); if (!stdErr.isEmpty()) errorMessage.append(Tr::tr(" The standard error output was:\n")).append(stdErr); throw errorMessage; } } if (m_qProcess->error() != QProcess::UnknownError) return -1; return m_qProcess->exitCode(); } void Process::close() { if (!m_qProcess) return; m_qProcess.reset(); } bool Process::waitForFinished(int msecs) { if (m_qProcess->state() == QProcess::NotRunning) return true; return m_qProcess->waitForFinished(msecs); } void Process::setCodec(const QString &codec) { const auto newCodec = QTextCodec::codecForName(qPrintable(codec)); if (newCodec) m_codec = newCodec; } QString Process::readLine() { auto result = m_codec->toUnicode(m_qProcess->readLine()); if (!result.isEmpty() && result.back() == QLatin1Char('\n')) result.chop(1); return result; } QString Process::findExecutable(const QString &filePath) const { ExecutableFinder exeFinder(ResolvedProductPtr(), m_environment); return exeFinder.findExecutable(filePath, m_workingDirectory); } void Process::writeLine(const QString &str) { m_qProcess->write(m_codec->fromUnicode(str)); m_qProcess->putChar('\n'); } JSValue Process::jsShellQuote(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const auto args = getArguments(ctx, "Process.shellQuote", argc, argv); HostOsInfo::HostOs hostOs = HostOsInfo::hostOs(); if (argc > 2) { const auto osList = fromArg(ctx, "Process.shellQuote", 3, argv[2]); hostOs = osList.contains(QLatin1String("windows")) ? HostOsInfo::HostOsWindows : HostOsInfo::HostOsOtherUnix; } return makeJsString(ctx, shellQuote(std::get<0>(args), std::get<1>(args), hostOs)); } catch (const QString &error) { return throwError(ctx, error); } } } // namespace Internal } // namespace qbs void initializeJsExtensionProcess(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { qbs::Internal::Process::registerClass(engine, extensionObject); } qbs-src-3.2.0/src/lib/corelib/jsextensions/textfile.cpp0000644000175100017510000001750115154533055022546 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "jsextension.h" #include #include #include #include #include #include #include #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #include #else #include #endif namespace qbs { namespace Internal { class TextFile : public JsExtension { friend class JsExtension; public: enum OpenMode { ReadOnly = 1, WriteOnly = 2, ReadWrite = ReadOnly | WriteOnly, Append = 4 }; static const char *name() { return "TextFile"; } static void declareEnums(JSContext *ctx, JSValue classObj); static JSValue ctor(JSContext *ctx, JSValueConst, JSValueConst, int argc, JSValueConst *argv, int); static void setupMethods(JSContext *ctx, JSValue obj); private: DEFINE_JS_FORWARDER(jsClose, &TextFile::close, "TextFile.close") DEFINE_JS_FORWARDER(jsFilePath, &TextFile::filePath, "TextFile.filePath") DEFINE_JS_FORWARDER(jsSetCodec, &TextFile::setCodec, "TextFile.setCodec") DEFINE_JS_FORWARDER(jsReadLine, &TextFile::readLine, "TextFile.readLine") DEFINE_JS_FORWARDER(jsReadAll, &TextFile::readAll, "TextFile.readAll") DEFINE_JS_FORWARDER(jsAtEof, &TextFile::atEof, "TextFile.atEof") DEFINE_JS_FORWARDER(jsTruncate, &TextFile::truncate, "TextFile.truncate") DEFINE_JS_FORWARDER(jsWrite, &TextFile::write, "TextFile.write") DEFINE_JS_FORWARDER(jsWriteLine, &TextFile::writeLine, "TextFile.writeLine") void close(); QString filePath(); void setCodec(const QString &codec); QString readLine(); QString readAll(); bool atEof() const; void truncate(); void write(const QString &str); void writeLine(const QString &str); TextFile(JSContext *, const QString &filePath, OpenMode mode, const QString &codec); void checkForClosed() const; std::unique_ptr m_file; QTextCodec *m_codec = nullptr; }; void TextFile::declareEnums(JSContext *ctx, JSValue classObj) { DECLARE_ENUM(ctx, classObj, ReadOnly); DECLARE_ENUM(ctx, classObj, WriteOnly); DECLARE_ENUM(ctx, classObj, ReadWrite); DECLARE_ENUM(ctx, classObj, Append); } JSValue TextFile::ctor(JSContext *ctx, JSValueConst, JSValueConst, int argc, JSValueConst *argv, int) { try { const auto filePath = getArgument(ctx, "TextFile constructor", argc, argv); OpenMode mode = ReadOnly; QString codec = QLatin1String("UTF-8"); if (argc > 1) { mode = static_cast (fromArg(ctx, "TextFile constructor", 2, argv[1])); } if (argc > 2) { codec = fromArg(ctx, "TextFile constructor", 3, argv[2]); } ScopedJsValue obj(ctx, createObject(ctx, filePath, mode, codec)); const auto se = ScriptEngine::engineForContext(ctx); const DubiousContextList dubiousContexts { DubiousContext(EvalContext::PropertyEvaluation, DubiousContext::SuggestMoving) }; se->checkContext(QStringLiteral("qbs.TextFile"), dubiousContexts); se->setUsesIo(); return obj.release(); } catch (const QString &error) { return throwError(ctx, error); } } void TextFile::setupMethods(JSContext *ctx, JSValue obj) { setupMethod(ctx, obj, "close", &jsClose, 0); setupMethod(ctx, obj, "filePath", &jsFilePath, 0); setupMethod(ctx, obj, "atEof", &jsAtEof, 0); setupMethod(ctx, obj, "setCodec", &jsSetCodec, 1); setupMethod(ctx, obj, "readLine", &jsReadLine, 0); setupMethod(ctx, obj, "readAll", &jsReadAll, 0); setupMethod(ctx, obj, "truncate", &jsTruncate, 0); setupMethod(ctx, obj, "write", &jsWrite, 1); setupMethod(ctx, obj, "writeLine", &jsWriteLine, 1); } TextFile::TextFile(JSContext *, const QString &filePath, OpenMode mode, const QString &codec) { auto file = std::make_unique(filePath); const auto newCodec = QTextCodec::codecForName(qPrintable(codec)); m_codec = newCodec ? newCodec : QTextCodec::codecForName("UTF-8"); QIODevice::OpenMode m = QIODevice::NotOpen; if (mode & ReadOnly) m |= QIODevice::ReadOnly; if (mode & WriteOnly) m |= QIODevice::WriteOnly; if (mode & Append) m |= QIODevice::Append; m |= QIODevice::Text; if (Q_UNLIKELY(!file->open(m))) throw Tr::tr("Unable to open file '%1': %2").arg(filePath, file->errorString()); m_file = std::move(file); } void TextFile::close() { checkForClosed(); m_file->close(); m_file.reset(); } QString TextFile::filePath() { checkForClosed(); return QFileInfo(*m_file).absoluteFilePath(); } void TextFile::setCodec(const QString &codec) { checkForClosed(); const auto newCodec = QTextCodec::codecForName(qPrintable(codec)); if (newCodec) m_codec = newCodec; } QString TextFile::readLine() { checkForClosed(); auto result = m_codec->toUnicode(m_file->readLine()); if (!result.isEmpty() && result.back() == QLatin1Char('\n')) result.chop(1); return result; } QString TextFile::readAll() { checkForClosed(); return m_codec->toUnicode(m_file->readAll()); } bool TextFile::atEof() const { checkForClosed(); return m_file->atEnd(); } void TextFile::truncate() { checkForClosed(); m_file->resize(0); } void TextFile::write(const QString &str) { checkForClosed(); m_file->write(m_codec->fromUnicode(str)); } void TextFile::writeLine(const QString &str) { checkForClosed(); m_file->write(m_codec->fromUnicode(str)); m_file->putChar('\n'); } void TextFile::checkForClosed() const { if (!m_file) throw Tr::tr("Access to TextFile object that was already closed."); } } // namespace Internal } // namespace qbs void initializeJsExtensionTextFile(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { qbs::Internal::TextFile::registerClass(engine, extensionObject); } qbs-src-3.2.0/src/lib/corelib/jsextensions/propertylistutils.h0000644000175100017510000000513215154533055024225 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2014 Petroules Corporation. ** 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 QPROPERTYLISTUTILS_H #define QPROPERTYLISTUTILS_H #include #import #if !defined(__OBJC__) || !defined(__cplusplus) #error "This file must be included from Objective-C++" #endif class QPropertyListUtils { Q_DISABLE_COPY(QPropertyListUtils) public: static QVariant fromPropertyList(id plist); static id toPropertyList(const QVariant &map); private: QPropertyListUtils(); }; template QMap qHashToMap(const QHash &hash) { QMap map; for (auto i = hash.cbegin(), end = hash.cend(); i != end; ++i) map.insert(i.key(), i.value()); return map; } #endif // QPROPERTYLISTUTILS_H qbs-src-3.2.0/src/lib/corelib/jsextensions/jsextension.h0000644000175100017510000003266415154533055022747 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2022 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$ ** ****************************************************************************/ #pragma once #include #include #include #include #include namespace qbs::Internal { template struct PackHelper {}; template struct FromArgHelper; template struct FunctionTrait; #define DECLARE_ENUM(ctx, obj, enumVal) \ JS_SetPropertyStr((ctx), (obj), #enumVal, JS_NewInt32((ctx), (enumVal))) template class JsExtension { #define DEFINE_JS_FORWARDER(name, func, text) \ static JSValue name(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) \ { \ return jsForward(func, text, ctx, this_val, argc, argv); \ } #define DEFINE_JS_FORWARDER_QUAL(klass, name, func, text) \ static JSValue name(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) \ { \ return klass::jsForward(func, text, ctx, this_val, argc, argv); \ } public: virtual ~JsExtension() = default; template static JSValue createObject(JSContext *ctx, Args... args) { ScopedJsValue obj(ctx, JS_NewObjectClass(ctx, classId(ctx))); JS_SetOpaque(obj, new Derived(ctx, args...)); Derived::setupMethods(ctx, obj); return obj.release(); } static JSValue createObjectDirect(JSContext *ctx, void *obj) { JSValue jsObj = JS_NewObjectClass(ctx, classId(ctx)); attachPointerTo(jsObj, obj); Derived::setupMethods(ctx, jsObj); return jsObj; } static Derived *fromJsObject(JSContext *ctx, JSValue obj) { return attachedPointer(obj, classId(ctx)); } static void registerClass(ScriptEngine *engine, JSValue extensionObject) { if (const JSValue cachedValue = engine->getInternalExtension(Derived::name()); !JS_IsUndefined(cachedValue)) { JS_SetPropertyStr(engine->context(), extensionObject, Derived::name(), cachedValue); return; } engine->registerClass(Derived::name(), &Derived::ctor, &finalizer, extensionObject); const ScopedJsValue classObj( engine->context(), JS_GetPropertyStr(engine->context(), extensionObject, Derived::name())); Derived::setupStaticMethods(engine->context(), classObj); Derived::declareEnums(engine->context(), classObj); } // obj is either class (for "static" methods) or class instance template static void setupMethod(JSContext *ctx, JSValue obj, const char *name, Func func, int argc) { JS_DefinePropertyValueStr(ctx, obj, name, JS_NewCFunction(ctx, func, name, argc), 0); } template static void setupMethod(JSContext *ctx, JSValue obj, const QString &name, Func func, int argc) { setupMethod(ctx, obj, name.toUtf8().constData(), func, argc); } template static T fromArg(JSContext *ctx, const char *funcName, int pos, JSValue v) { return FromArgHelper::fromArg(ctx, funcName, pos, v); } template static void assignToTuple(Tuple &tuple, std::index_sequence, JSContext *ctx, const char *funcName, JSValueConst *argv) { Q_UNUSED(ctx) Q_UNUSED(funcName) Q_UNUSED(argv) ((std::get(tuple) = fromArg>(ctx, funcName, I + 1, argv[I])), ...); } template static std::tuple getArguments(JSContext *ctx, const char *funcName, int argc, JSValueConst *argv) { constexpr int expectedArgc = sizeof ...(Args); if (argc < expectedArgc) { throw Tr::tr("%1 requires %d arguments.") .arg(QLatin1String(funcName)).arg(expectedArgc); } std::tuple>...> values; assignToTuple(values, std::make_index_sequence::value>(), ctx, funcName, argv); return values; } template static std::tuple getArgumentsHelper(PackHelper, JSContext *ctx, const char *funcName, int argc, JSValueConst *argv) { return getArguments(ctx, funcName, argc, argv); } template static T getArgument(JSContext *ctx, const char *funcName, int argc, JSValueConst *argv) { return std::get<0>(getArguments(ctx, funcName, argc, argv)); } template static void jsForwardHelperVoid(Derived *obj, Func func, const Tuple &tuple, std::index_sequence) { (obj->*func)(std::get(tuple)...); } template static Ret jsForwardHelperRet(Derived *obj, Func &func, Tuple const& tuple, std::index_sequence) { return (obj->*func)(std::get(tuple)...); } static JSValue toJsValue(JSContext *ctx, const QString &s) { return makeJsString(ctx, s); } static JSValue toJsValue(JSContext *ctx, bool v) { return JS_NewBool(ctx, v); } static JSValue toJsValue(JSContext *ctx, qint32 v) { return JS_NewInt32(ctx, v); } static JSValue toJsValue(JSContext *ctx, qint64 v) { return JS_NewInt64(ctx, v); } static JSValue toJsValue(JSContext *ctx, const QVariant &v) { return makeJsVariant(ctx, v); } static JSValue toJsValue(JSContext *ctx, const QByteArray &data) { const JSValue array = JS_NewArray(ctx); for (int i = 0; i < data.size(); ++i) { JS_SetPropertyUint32(ctx, array, i, JS_NewUint32(ctx, static_cast(data.at(i)))); } return array; } static JSValue toJsValue(JSContext *ctx, const QVariantMap &m) { return makeJsVariantMap(ctx, m); } template static JSValue toJsValue(JSContext *ctx, const std::optional &v) { if (!v) return JS_UNDEFINED; return makeJsString(ctx, *v); } template static JSValue jsForward(Func func, const char *name, JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { try { using Ret = typename FunctionTrait::Ret; using Args = typename FunctionTrait::Args; const auto args = getArgumentsHelper(Args(), ctx, name, argc, argv); const auto obj = fromJsObject(ctx, this_val); if constexpr (std::is_same_v) { jsForwardHelperVoid(obj, func, args, std::make_index_sequence::value>()); return JS_UNDEFINED; } else { return toJsValue(ctx, jsForwardHelperRet(obj, func, args, std::make_index_sequence>())); } } catch (const QString &error) { return throwError(ctx, error); } } static void setupMethods(JSContext *, JSValue) {} static void setupStaticMethods(JSContext *, JSValue) {} static void declareEnums(JSContext *, JSValue) {} private: static void finalizer(JSRuntime *rt, JSValue val) { delete attachedPointer(val, classId(rt)); } static JSClassID classId(JSContext *ctx) { return ScriptEngine::engineForContext(ctx)->getClassId(Derived::name()); } static JSClassID classId(JSRuntime *rt) { return ScriptEngine::engineForRuntime(rt)->getClassId(Derived::name()); } static JSValue ctor(JSContext *ctx, JSValueConst, JSValueConst, int, JSValueConst *, int) { return throwError(ctx, Tr::tr("'%1' cannot be instantiated.") .arg(QLatin1String(Derived::name()))); } }; template<> struct FromArgHelper { static bool fromArg(JSContext *ctx, const char *, int, JSValue v) { return JS_ToBool(ctx, v); } }; template<> struct FromArgHelper { static qint32 fromArg(JSContext *ctx, const char *funcName, int pos, JSValue v) { int32_t val; if (JS_ToInt32(ctx, &val, v) < 0) { throw Tr::tr("%1 requires an integer as argument %2") .arg(QLatin1String(funcName)).arg(pos); } return val; } }; template<> struct FromArgHelper { static qint64 fromArg(JSContext *ctx, const char *funcName, int pos, JSValue v) { int64_t val; if (JS_ToInt64(ctx, &val, v) < 0) { throw Tr::tr("%1 requires an integer as argument %2") .arg(QLatin1String(funcName)).arg(pos); } return val; } }; template<> struct FromArgHelper { static QByteArray fromArg(JSContext *ctx, const char *funcName, int pos, JSValue v) { const auto throwError = [&] { throw Tr::tr("%1 requires an array of bytes as argument %2") .arg(QLatin1String(funcName)).arg(pos); }; if (!JS_IsArray(v)) throwError(); QByteArray data; data.resize(getJsIntProperty(ctx, v, QLatin1String("length"))); for (int i = 0; i < data.size(); ++i) { const JSValue jsNumber = JS_GetPropertyUint32(ctx, v, i); if (JS_VALUE_GET_TAG(jsNumber) != JS_TAG_INT) throwError(); uint32_t n; JS_ToUint32(ctx, &n, jsNumber); if (n > 0xff) throwError(); data[i] = n; } return data; } }; template<> struct FromArgHelper { static QString fromArg(JSContext *ctx, const char *funcName, int pos, JSValue v) { if (JS_IsUndefined(v)) return {}; const ScopedJsValue stringified(ctx, JS_ToString(ctx, v)); if (!JS_IsString(stringified)) { throw Tr::tr("%1 requires a string as argument %2") .arg(QLatin1String(funcName)).arg(pos); } return getJsString(ctx, stringified); } }; template<> struct FromArgHelper { static QStringList fromArg(JSContext *ctx, const char *funcName, int pos, JSValue v) { if (!JS_IsArray(v)) { throw Tr::tr("%1 requires an array of strings as argument %2") .arg(QLatin1String(funcName)).arg(pos); } return getJsStringList(ctx, v); } }; template<> struct FromArgHelper { static QVariant fromArg(JSContext *ctx, const char *, int, JSValue v) { return getJsVariant(ctx, v); } }; template struct FromArgHelper { static C *fromArg(JSContext *ctx, const char *funcName, int pos, JSValue v) { C * const obj = JsExtension::fromJsObject(ctx, v); if (!obj) { throw Tr::tr("Argument %2 has wrong type in call to %1") .arg(QLatin1String(funcName)).arg(pos); } return obj; } }; template struct FunctionTrait { using Ret = R; using Args = PackHelper...>; }; template struct FunctionTrait { using Ret = R; using Args = PackHelper...>; }; } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/jsextensions/environmentextension.cpp0000644000175100017510000001420215154533055025216 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "jsextension.h" #include #include #include #include #include namespace qbs { namespace Internal { class EnvironmentExtension : public JsExtension { public: static const char *name() { return "Environment"; } static void setupStaticMethods(JSContext *ctx, JSValue classObj); static JSValue jsGetEnv(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsPutEnv(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsUnsetEnv(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsCurrentEnv(JSContext *ctx, JSValueConst, int, JSValueConst *); }; void EnvironmentExtension::setupStaticMethods(JSContext *ctx, JSValue classObj) { setupMethod(ctx, classObj, "getEnv", &EnvironmentExtension::jsGetEnv, 1); setupMethod(ctx, classObj, "putEnv", &EnvironmentExtension::jsPutEnv, 2); setupMethod(ctx, classObj, "unsetEnv", &EnvironmentExtension::jsUnsetEnv, 1); setupMethod(ctx, classObj, "currentEnv", &EnvironmentExtension::jsCurrentEnv, 0); } static QProcessEnvironment *getProcessEnvironment(ScriptEngine *engine, const QString &func, bool doThrow = true) { QVariant v = engine->property(StringConstants::qbsProcEnvVarInternal()); auto procenv = reinterpret_cast(v.value()); if (!procenv && doThrow) { throw QStringLiteral("%1 can only be called from " "Module.setupBuildEnvironment and " "Module.setupRunEnvironment").arg(func); } return procenv; } JSValue EnvironmentExtension::jsGetEnv(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const auto name = getArgument(ctx, "Environment.getEnv", argc, argv); ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const QProcessEnvironment env = engine->environment(); const QProcessEnvironment *procenv = getProcessEnvironment(engine, QStringLiteral("getEnv"), false); if (!procenv) procenv = &env; const QString value = procenv->value(name); return value.isNull() ? engine->undefinedValue() : makeJsString(ctx, value); } catch (const QString &error) { return throwError(ctx, error); } } JSValue EnvironmentExtension::jsPutEnv(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto args = getArguments(ctx, "Environment.putEnv", argc, argv); getProcessEnvironment(ScriptEngine::engineForContext(ctx), QStringLiteral("putEnv")) ->insert(std::get<0>(args), std::get<1>(args)); return JS_UNDEFINED; } catch (const QString &error) { return throwError(ctx, error); } } JSValue EnvironmentExtension::jsUnsetEnv(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto name = getArgument(ctx, "Environment.unsetEnv", argc, argv); getProcessEnvironment(ScriptEngine::engineForContext(ctx), QStringLiteral("unsetEnv")) ->remove(name); return JS_UNDEFINED; } catch (const QString &error) { return throwError(ctx, error); } } JSValue EnvironmentExtension::jsCurrentEnv(JSContext *ctx, JSValue, int, JSValue *) { ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const QProcessEnvironment env = engine->environment(); const QProcessEnvironment *procenv = getProcessEnvironment(engine, QStringLiteral("currentEnv"), false); if (!procenv) procenv = &env; JSValue envObject = engine->newObject(); const auto keys = procenv->keys(); for (const QString &key : keys) { const QString keyName = HostOsInfo::isWindowsHost() ? key.toUpper() : key; setJsProperty(ctx, envObject, keyName, procenv->value(key)); } return envObject; } } // namespace Internal } // namespace qbs void initializeJsExtensionEnvironment(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { qbs::Internal::EnvironmentExtension::registerClass(engine, extensionObject); } qbs-src-3.2.0/src/lib/corelib/jsextensions/jsextensions.h0000644000175100017510000000463715154533055023131 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_JSEXTENSIONS_H #define QBS_JSEXTENSIONS_H #include #include namespace qbs { namespace Internal { class ScriptEngine; class JsExtensions { public: static void setupExtensions(ScriptEngine *engine, const QStringList &names, const JSValue &scope); static JSValue loadExtension(ScriptEngine *engine, const QString &name); static bool hasExtension(const QString &name); static QStringList extensionNames(); }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/jsextensions/file.cpp0000644000175100017510000002663715154533055021653 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "jsextension.h" #include #include #include #include #include namespace qbs { namespace Internal { class File : public JsExtension { public: enum Filter { Dirs = 0x001, Files = 0x002, Drives = 0x004, NoSymLinks = 0x008, AllEntries = Dirs | Files | Drives, TypeMask = 0x00f, Readable = 0x010, Writable = 0x020, Executable = 0x040, PermissionMask = 0x070, Modified = 0x080, Hidden = 0x100, System = 0x200, AccessMask = 0x3F0, AllDirs = 0x400, CaseSensitive = 0x800, NoDot = 0x2000, NoDotDot = 0x4000, NoDotAndDotDot = NoDot | NoDotDot, NoFilter = -1 }; Q_DECLARE_FLAGS(Filters, Filter) static const char *name() { return "File"; } static void setupStaticMethods(JSContext *ctx, JSValue classObj); static void declareEnums(JSContext *ctx, JSValue classObj); static JSValue jsCopy(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsExists(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsDirectoryEntries(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsLastModified(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsMakePath(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsMove(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsRemove(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue jsCanonicalFilePath(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); }; void File::setupStaticMethods(JSContext *ctx, JSValue classObj) { setupMethod(ctx, classObj, "copy", &File::jsCopy, 2); setupMethod(ctx, classObj, "exists", &File::jsExists, 1); setupMethod(ctx, classObj, "directoryEntries", File::jsDirectoryEntries, 2); setupMethod(ctx, classObj, "lastModified", File::jsLastModified, 1); setupMethod(ctx, classObj, "makePath", &File::jsMakePath, 1); setupMethod(ctx, classObj, "move", &File::jsMove, 3); setupMethod(ctx, classObj, "remove", &File::jsRemove, 1); setupMethod(ctx, classObj, "canonicalFilePath", &File::jsCanonicalFilePath, 1); } void File::declareEnums(JSContext *ctx, JSValue classObj) { DECLARE_ENUM(ctx, classObj, Dirs); DECLARE_ENUM(ctx, classObj, Files); DECLARE_ENUM(ctx, classObj, Drives); DECLARE_ENUM(ctx, classObj, NoSymLinks); DECLARE_ENUM(ctx, classObj, AllEntries); DECLARE_ENUM(ctx, classObj, TypeMask); DECLARE_ENUM(ctx, classObj, Readable); DECLARE_ENUM(ctx, classObj, Writable); DECLARE_ENUM(ctx, classObj, Executable); DECLARE_ENUM(ctx, classObj, PermissionMask); DECLARE_ENUM(ctx, classObj, Modified); DECLARE_ENUM(ctx, classObj, Hidden); DECLARE_ENUM(ctx, classObj, System); DECLARE_ENUM(ctx, classObj, AccessMask); DECLARE_ENUM(ctx, classObj, AllDirs); DECLARE_ENUM(ctx, classObj, CaseSensitive); DECLARE_ENUM(ctx, classObj, NoDot); DECLARE_ENUM(ctx, classObj, NoDotDot); DECLARE_ENUM(ctx, classObj, NoDotAndDotDot); DECLARE_ENUM(ctx, classObj, NoFilter); } JSValue File::jsCopy(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto se = ScriptEngine::engineForContext(ctx); const DubiousContextList dubiousContexts({ DubiousContext(EvalContext::PropertyEvaluation), DubiousContext(EvalContext::RuleExecution, DubiousContext::SuggestMoving) }); se->checkContext(QStringLiteral("File.copy()"), dubiousContexts); const auto args = getArguments(ctx, "File.copy", argc, argv); QString errorMessage; if (Q_UNLIKELY(!copyFileRecursion(std::get<0>(args), std::get<1>(args), true, true, &errorMessage))) { throw errorMessage; } return JS_TRUE; } catch (const QString &error) { return throwError(ctx, error); } } JSValue File::jsExists(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "File.exists", argc, argv); const bool exists = FileInfo::exists(filePath); ScriptEngine::engineForContext(ctx)->addFileExistsResult(filePath, exists); return JS_NewBool(ctx, exists); } catch (const QString &error) { return throwError(ctx, error); } } JSValue File::jsDirectoryEntries(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto se = ScriptEngine::engineForContext(ctx); const DubiousContextList dubiousContexts({ DubiousContext(EvalContext::PropertyEvaluation, DubiousContext::SuggestMoving) }); se->checkContext(QStringLiteral("File.directoryEntries()"), dubiousContexts); const auto args = getArguments(ctx, "Environment.directoryEntries", argc, argv); const QString path = std::get<0>(args); const QDir dir(path); const auto filters = static_cast(std::get<1>(args)); const QStringList entries = dir.entryList(filters, QDir::Name); se->addDirectoryEntriesResult(path, filters, entries); return makeJsStringList(ctx, entries); } catch (const QString &error) { return throwError(ctx, error); } } JSValue File::jsRemove(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto se = ScriptEngine::engineForContext(ctx); const DubiousContextList dubiousContexts{DubiousContext(EvalContext::PropertyEvaluation)}; se->checkContext(QStringLiteral("File.remove()"), dubiousContexts); const auto fileName = getArgument(ctx, "Environment.remove", argc, argv); QString errorMessage; if (Q_UNLIKELY(!removeFileRecursion(QFileInfo(fileName), &errorMessage))) throw errorMessage; return JS_TRUE; } catch (const QString &error) { return throwError(ctx, error); } } JSValue File::jsLastModified(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "Environment.lastModified", argc, argv); const FileTime timestamp = FileInfo(filePath).lastModified(); const auto se = ScriptEngine::engineForContext(ctx); se->addFileLastModifiedResult(filePath, timestamp); return JS_NewFloat64(ctx, timestamp.asDouble()); } catch (const QString &error) { return throwError(ctx, error); } } JSValue File::jsMakePath(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto se = ScriptEngine::engineForContext(ctx); const DubiousContextList dubiousContexts{DubiousContext(EvalContext::PropertyEvaluation)}; se->checkContext(QStringLiteral("File.makePath()"), dubiousContexts); const auto path = getArgument(ctx, "File.makePath", argc, argv); return JS_NewBool(ctx, QDir::root().mkpath(path)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue File::jsMove(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto se = ScriptEngine::engineForContext(ctx); const DubiousContextList dubiousContexts{DubiousContext(EvalContext::PropertyEvaluation)}; se->checkContext(QStringLiteral("File.move()"), dubiousContexts); const auto args = getArguments(ctx, "File.move", argc, argv); const QString sourceFile = std::get<0>(args); const QString targetFile = std::get<1>(args); const auto overwrite = argc > 2 ? fromArg(ctx, "File.move", 3, argv[2]) : true; if (Q_UNLIKELY(QFileInfo(sourceFile).isDir())) { throw QStringLiteral("Could not move '%1' to '%2': " "Source file path is a directory.").arg(sourceFile, targetFile); } if (Q_UNLIKELY(QFileInfo(targetFile).isDir())) { throw QStringLiteral("Could not move '%1' to '%2': " "Destination file path is a directory.") .arg(sourceFile, targetFile); } QFile f(targetFile); if (overwrite && f.exists() && !f.remove()) { throw QStringLiteral("Could not move '%1' to '%2': %3") .arg(sourceFile, targetFile, f.errorString()); } if (QFile::exists(targetFile)) { throw QStringLiteral("Could not move '%1' to '%2': " "Destination file exists.").arg(sourceFile, targetFile); } QFile f2(sourceFile); if (Q_UNLIKELY(!f2.rename(targetFile))) { throw QStringLiteral("Could not move '%1' to '%2': %3") .arg(sourceFile, targetFile, f2.errorString()); } return JS_TRUE; } catch (const QString &error) { return throwError(ctx, error); } } JSValue File::jsCanonicalFilePath(JSContext *ctx, JSValue, int argc, JSValue *argv) { try { const auto path = getArgument(ctx, "File.canonicalFilePath", argc, argv); return makeJsString(ctx, QFileInfo(path).canonicalFilePath()); } catch (const QString &error) { return throwError(ctx, error); } } } // namespace Internal } // namespace qbs void initializeJsExtensionFile(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { qbs::Internal::File::registerClass(engine, extensionObject); } qbs-src-3.2.0/src/lib/corelib/jsextensions/pkgconfigjs.cpp0000644000175100017510000002441515154533055023230 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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$ ** ****************************************************************************/ #include "pkgconfigjs.h" #include #include #include #include namespace qbs { namespace Internal { namespace { template QVariantList convert(const C &c, F &&f) { QVariantList result; result.reserve(int(c.size())); std::transform(c.begin(), c.end(), std::back_inserter(result), f); return result; } QVariantMap variablesMapToMap(const PcPackage::VariablesMap &variables) { QVariantMap result; for (const auto &item: variables) result.insert(QString::fromStdString(item.first), QString::fromStdString(item.second)); return result; } QVariantMap packageToMap(const PcPackage &package) { QVariantMap result; result[QStringLiteral("isBroken")] = false; result[QStringLiteral("filePath")] = QString::fromStdString(package.filePath); result[QStringLiteral("baseFileName")] = QString::fromStdString(package.baseFileName); result[QStringLiteral("name")] = QString::fromStdString(package.name); result[QStringLiteral("version")] = QString::fromStdString(package.version); result[QStringLiteral("description")] = QString::fromStdString(package.description); result[QStringLiteral("url")] = QString::fromStdString(package.url); const auto flagToMap = [](const PcPackage::Flag &flag) { QVariantMap result; const auto value = QString::fromStdString(flag.value); result[QStringLiteral("type")] = QVariant::fromValue(qint32(flag.type)); result[QStringLiteral("value")] = value; return result; }; const auto requiredVersionToMap = [](const PcPackage::RequiredVersion &version) { using Type = PcPackage::RequiredVersion::ComparisonType; QVariantMap result; result[QStringLiteral("name")] = QString::fromStdString(version.name); const auto versionString = QString::fromStdString(version.version); const auto qbsVersion = Version::fromString(QString::fromStdString(version.version)); const auto nextQbsVersion = Version( qbsVersion.majorVersion(), qbsVersion.minorVersion(), qbsVersion.patchLevel() + 1); switch (version.comparison) { case Type::LessThan: result[QStringLiteral("versionBelow")] = versionString; break; case Type::GreaterThan: result[QStringLiteral("versionAtLeast")] = nextQbsVersion.toString(); break; case Type::LessThanEqual: result[QStringLiteral("versionBelow")] = nextQbsVersion.toString(); break; case Type::GreaterThanEqual: result[QStringLiteral("versionAtLeast")] = versionString; break; case Type::Equal: result[QStringLiteral("version")] = versionString; break; case Type::NotEqual: result[QStringLiteral("versionBelow")] = versionString; result[QStringLiteral("versionAtLeast")] = nextQbsVersion.toString(); break; case Type::AlwaysMatch: break; } return result; }; result[QStringLiteral("libs")] = convert(package.libs, flagToMap); result[QStringLiteral("libsPrivate")] = convert(package.libsPrivate, flagToMap); result[QStringLiteral("cflags")] = convert(package.cflags, flagToMap); result[QStringLiteral("requires")] = convert(package.requiresPublic, requiredVersionToMap); result[QStringLiteral("requiresPrivate")] = convert(package.requiresPrivate, requiredVersionToMap); result[QStringLiteral("conflicts")] = convert(package.conflicts, requiredVersionToMap); result[QStringLiteral("variables")] = variablesMapToMap(package.variables); return result; }; QVariantMap brokenPackageToMap(const PcBrokenPackage &package) { QVariantMap result; result[QStringLiteral("isBroken")] = true; result[QStringLiteral("filePath")] = QString::fromStdString(package.filePath); result[QStringLiteral("baseFileName")] = QString::fromStdString(package.baseFileName); result[QStringLiteral("errorText")] = QString::fromStdString(package.errorText); return result; } QVariantMap packageVariantToMap(const PcPackageVariant &package) { return package.visit([](const auto &value) { using T = std::decay_t; if constexpr (std::is_same_v) return packageToMap(value); else return brokenPackageToMap(value); }); } PcPackage::VariablesMap envToVariablesMap(const QProcessEnvironment &env) { PcPackage::VariablesMap result; const auto keys = env.keys(); for (const auto &key : keys) result[key.toStdString()] = env.value(key).toStdString(); return result; } PcPackage::VariablesMap variablesFromQVariantMap(const QVariantMap &map) { PcPackage::VariablesMap result; for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) result[it.key().toStdString()] = it.value().toString().toStdString(); return result; } std::vector stringListToStdVector(const QStringList &list) { return transformed>(list, [](const auto &s) { return s.toStdString(); }); } } // namespace void PkgConfigJs::declareEnums(JSContext *ctx, JSValue classObj) { DECLARE_ENUM(ctx, classObj, LibraryName); DECLARE_ENUM(ctx, classObj, LibraryPath); DECLARE_ENUM(ctx, classObj, StaticLibraryName); DECLARE_ENUM(ctx, classObj, Framework); DECLARE_ENUM(ctx, classObj, FrameworkPath); DECLARE_ENUM(ctx, classObj, LinkerFlag); DECLARE_ENUM(ctx, classObj, IncludePath); DECLARE_ENUM(ctx, classObj, SystemIncludePath); DECLARE_ENUM(ctx, classObj, Define); DECLARE_ENUM(ctx, classObj, CompilerFlag); } JSValue PkgConfigJs::ctor(JSContext *ctx, JSValue, JSValue, int argc, JSValue *argv, int) { try { QVariantMap options; if (argc > 0) options = fromArg(ctx, "PkgConfig constructor", 1, argv[0]).toMap(); JSValue obj = createObject(ctx, options); return obj; } catch (const PcException &e) { return throwError(ctx, QString::fromUtf8(e.what())); } catch (const QString &error) { return throwError(ctx, error); } } PkgConfigJs::PkgConfigJs(JSContext *ctx, const QVariantMap &options) : m_pkgConfig(std::make_unique( convertOptions(ScriptEngine::engineForContext(ctx)->environment(), options))) { for (const auto &package : m_pkgConfig->packages()) { m_packages.insert( QString::fromStdString(package.getBaseFileName()), packageVariantToMap(package)); } } PkgConfig::Options PkgConfigJs::convertOptions(const QProcessEnvironment &env, const QVariantMap &map) { PkgConfig::Options result; result.libDirs = stringListToStdVector(map.value(QStringLiteral("libDirs")).toStringList()); result.extraPaths = stringListToStdVector(map.value(QStringLiteral("extraPaths")).toStringList()); result.sysroot = map.value(QStringLiteral("sysroot")).toString().toStdString(); result.topBuildDir = map.value(QStringLiteral("topBuildDir")).toString().toStdString(); result.allowSystemLibraryPaths = map.value(QStringLiteral("allowSystemLibraryPaths"), false).toBool(); const auto systemLibraryPaths = map.value(QStringLiteral("systemLibraryPaths")).toStringList(); result.systemLibraryPaths.reserve(systemLibraryPaths.size()); std::transform( systemLibraryPaths.begin(), systemLibraryPaths.end(), std::back_inserter(result.systemLibraryPaths), [](const QString &str){ return str.toStdString(); }); result.disableUninstalled = map.value(QStringLiteral("disableUninstalled"), true).toBool(); result.staticMode = map.value(QStringLiteral("staticMode"), false).toBool(); result.definePrefix = map.value(QStringLiteral("definePrefix"), false).toBool(); result.globalVariables = variablesFromQVariantMap(map.value(QStringLiteral("globalVariables")).toMap()); result.systemVariables = envToVariablesMap(env); return result; } void PkgConfigJs::setupMethods(JSContext *ctx, JSValue obj) { setupMethod(ctx, obj, "packages", &PkgConfigJs::jsPackages, 0); } } // namespace Internal } // namespace qbs void initializeJsExtensionPkgConfig(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { qbs::Internal::PkgConfigJs::registerClass(engine, extensionObject); } qbs-src-3.2.0/src/lib/corelib/jsextensions/utilitiesextension.cpp0000644000175100017510000010705415154533055024675 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "jsextension.h" #include "jsextensions.h" #include #include #include #include #include #include #include #include #include #if defined(Q_OS_MACOS) #include #endif #ifdef __APPLE__ #include #include #include #include #ifndef FAT_MAGIC_64 #define FAT_MAGIC_64 0xcafebabf #define FAT_CIGAM_64 0xbfbafeca struct fat_arch_64 { cpu_type_t cputype; cpu_subtype_t cpusubtype; uint64_t offset; uint64_t size; uint32_t align; uint32_t reserved; }; #endif #endif #ifdef Q_OS_WIN #include #include #include #endif #include #include #include #include #include namespace qbs { namespace Internal { class DummyLogSink : public ILogSink { void doPrintMessage(LoggerLevel, const QString &, const QString &) override { } }; class UtilitiesExtension : public JsExtension { public: static const char *name() { return "Utilities"; } static void setupStaticMethods(JSContext *ctx, JSValue classObj); static JSValue js_canonicalArchitecture(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_canonicalPlatform(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue js_canonicalTargetArchitecture(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_canonicalToolchain(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_cStringQuote(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue js_getHash(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue js_getNativeSetting(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue js_kernelVersion(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_nativeSettingGroups(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_rfc1034identifier(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_smimeMessageContent(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_certificateInfo(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_signingIdentities(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_msvcCompilerInfo(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue js_clangClCompilerInfo(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue js_installedMSVCs(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_installedClangCls(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_versionCompare(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue js_qmlTypeInfo(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_builtinExtensionNames(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue js_isSharedLibrary(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv); static JSValue js_getArchitecturesFromBinary(JSContext *ctx, JSValueConst, int, JSValueConst *); }; JSValue UtilitiesExtension::js_canonicalPlatform(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const auto platform = getArgument(ctx, "Utilities.canonicalPlatform", argc, argv); if (platform.isEmpty()) return makeJsStringList(ctx, {}); std::vector platforms = HostOsInfo::canonicalOSIdentifiers(platform); return makeJsStringList(ctx, QStringList(std::move_iterator(platforms.begin()), std::move_iterator(platforms.end()))); } catch (const QString &error) { return throwError(ctx, error); } } JSValue UtilitiesExtension::js_canonicalTargetArchitecture(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const auto arch = getArgument(ctx, "Utilities.canonicalTargetArchitecture", argc, argv); QString endianness, vendor, system, abi; if (argc > 1) endianness = fromArg(ctx, "Utilities.canonicalTargetArchitecture", 2, argv[1]); if (argc > 2) vendor = fromArg(ctx, "Utilities.canonicalTargetArchitecture", 3, argv[2]); if (argc > 3) system = fromArg(ctx, "Utilities.canonicalTargetArchitecture", 4, argv[3]); if (argc > 4) abi = fromArg(ctx, "Utilities.canonicalTargetArchitecture", 5, argv[4]); return makeJsString(ctx, canonicalTargetArchitecture(arch, endianness, vendor, system, abi)); } catch (const QString &error) { return throwError(ctx, error); } } void UtilitiesExtension::setupStaticMethods(JSContext *ctx, JSValue classObj) { setupMethod(ctx, classObj, "canonicalArchitecture", &UtilitiesExtension::js_canonicalArchitecture, 1); setupMethod(ctx, classObj, "canonicalPlatform", &UtilitiesExtension::js_canonicalPlatform, 1); setupMethod(ctx, classObj, "canonicalTargetArchitecture", &UtilitiesExtension::js_canonicalTargetArchitecture, 1); setupMethod(ctx, classObj, "canonicalToolchain", &UtilitiesExtension::js_canonicalToolchain, 1); setupMethod(ctx, classObj, "cStringQuote", &UtilitiesExtension::js_cStringQuote, 1); setupMethod(ctx, classObj, "getHash", &UtilitiesExtension::js_getHash, 1); setupMethod(ctx, classObj, "getNativeSetting", &UtilitiesExtension::js_getNativeSetting, 3); setupMethod(ctx, classObj, "kernelVersion", &UtilitiesExtension::js_kernelVersion, 0); setupMethod(ctx, classObj, "nativeSettingGroups", &UtilitiesExtension::js_nativeSettingGroups, 1); setupMethod(ctx, classObj, "rfc1034Identifier", &UtilitiesExtension::js_rfc1034identifier, 1); setupMethod(ctx, classObj, "smimeMessageContent", &UtilitiesExtension::js_smimeMessageContent, 1); setupMethod(ctx, classObj, "certificateInfo", &UtilitiesExtension::js_certificateInfo, 1); setupMethod(ctx, classObj, "signingIdentities", &UtilitiesExtension::js_signingIdentities, 1); setupMethod(ctx, classObj, "msvcCompilerInfo", &UtilitiesExtension::js_msvcCompilerInfo, 1); setupMethod(ctx, classObj, "clangClCompilerInfo", &UtilitiesExtension::js_clangClCompilerInfo, 1); setupMethod(ctx, classObj, "installedMSVCs", &UtilitiesExtension::js_installedMSVCs, 1); setupMethod(ctx, classObj, "installedClangCls", &UtilitiesExtension::js_installedClangCls, 1); setupMethod(ctx, classObj, "versionCompare", &UtilitiesExtension::js_versionCompare, 2); setupMethod(ctx, classObj, "qmlTypeInfo", &UtilitiesExtension::js_qmlTypeInfo, 0); setupMethod(ctx, classObj, "builtinExtensionNames", &UtilitiesExtension::js_builtinExtensionNames, 0); setupMethod(ctx, classObj, "isSharedLibrary", &UtilitiesExtension::js_isSharedLibrary, 1); setupMethod(ctx, classObj, "getArchitecturesFromBinary", &UtilitiesExtension::js_getArchitecturesFromBinary, 1); } JSValue UtilitiesExtension::js_canonicalArchitecture(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const auto arch = getArgument(ctx, "Utilities.canonicalArchitecture", argc, argv); if (arch.isEmpty()) return makeJsString(ctx, {}); return makeJsString(ctx, canonicalArchitecture(arch)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue UtilitiesExtension::js_canonicalToolchain(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { QStringList toolchain; for (int i = 0; i < argc; ++i) toolchain << fromArg(ctx, "Utilities.canonicalToolchain", i + 1, argv[i]); return makeJsStringList(ctx, canonicalToolchain(toolchain)); } catch (const QString &error) { return throwError(ctx, error); } } // copied from src/corelib/tools/qtools_p.h Q_DECL_CONSTEXPR inline uchar toHexUpper(uint value) Q_DECL_NOTHROW { return "0123456789ABCDEF"[value & 0xF]; } Q_DECL_CONSTEXPR inline int fromHex(uint c) Q_DECL_NOTHROW { return ((c >= '0') && (c <= '9')) ? int(c - '0') : ((c >= 'A') && (c <= 'F')) ? int(c - 'A' + 10) : ((c >= 'a') && (c <= 'f')) ? int(c - 'a' + 10) : /* otherwise */ -1; } // copied from src/corelib/io/qdebug.cpp static inline bool isPrintable(uchar c) { return c >= ' ' && c < 0x7f; } // modified template static inline QString escapedString(const Char *begin, int length, bool isUnicode = true) { QChar quote(QLatin1Char('"')); QString out = quote; bool lastWasHexEscape = false; const Char *end = begin + length; for (const Char *p = begin; p != end; ++p) { // check if we need to insert "" to break an hex escape sequence if (Q_UNLIKELY(lastWasHexEscape)) { if (fromHex(*p) != -1) { // yes, insert it out += QLatin1Char('"'); out += QLatin1Char('"'); } lastWasHexEscape = false; } if (sizeof(Char) == sizeof(QChar)) { // Surrogate characters are category Cs (Other_Surrogate), so isPrintable = false for them int runLength = 0; while (p + runLength != end && QChar::isPrint(p[runLength]) && p[runLength] != '\\' && p[runLength] != '"') ++runLength; if (runLength) { out += QString(reinterpret_cast(p), runLength); p += runLength - 1; continue; } } else if (isPrintable(*p) && *p != '\\' && *p != '"') { QChar c = QLatin1Char(*p); out += c; continue; } // print as an escape sequence (maybe, see below for surrogate pairs) int buflen = 2; ushort buf[sizeof "\\U12345678" - 1]; buf[0] = '\\'; switch (*p) { case '"': case '\\': buf[1] = *p; break; case '\b': buf[1] = 'b'; break; case '\f': buf[1] = 'f'; break; case '\n': buf[1] = 'n'; break; case '\r': buf[1] = 'r'; break; case '\t': buf[1] = 't'; break; default: if (!isUnicode) { // print as hex escape buf[1] = 'x'; buf[2] = toHexUpper(uchar(*p) >> 4); buf[3] = toHexUpper(uchar(*p)); buflen = 4; lastWasHexEscape = true; break; } if (QChar::isHighSurrogate(*p)) { if ((p + 1) != end && QChar::isLowSurrogate(p[1])) { // properly-paired surrogates uint ucs4 = QChar::surrogateToUcs4(*p, p[1]); if (QChar::isPrint(ucs4)) { buf[0] = *p; buf[1] = p[1]; buflen = 2; } else { buf[1] = 'U'; buf[2] = '0'; // toHexUpper(ucs4 >> 32); buf[3] = '0'; // toHexUpper(ucs4 >> 28); buf[4] = toHexUpper(ucs4 >> 20); buf[5] = toHexUpper(ucs4 >> 16); buf[6] = toHexUpper(ucs4 >> 12); buf[7] = toHexUpper(ucs4 >> 8); buf[8] = toHexUpper(ucs4 >> 4); buf[9] = toHexUpper(ucs4); buflen = 10; } ++p; break; } // improperly-paired surrogates, fall through } buf[1] = 'u'; buf[2] = toHexUpper(ushort(*p) >> 12); buf[3] = toHexUpper(ushort(*p) >> 8); buf[4] = toHexUpper(*p >> 4); buf[5] = toHexUpper(*p); buflen = 6; } out += QString(reinterpret_cast(buf), buflen); } out += quote; return out; } JSValue UtilitiesExtension::js_cStringQuote(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const auto str = getArgument(ctx, "Utilities.cStringQuote", argc, argv); return makeJsString(ctx, escapedString( reinterpret_cast(str.constData()), str.size())); } catch (const QString &error) { return throwError(ctx, error); } } JSValue UtilitiesExtension::js_getHash(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const QByteArray input = getArgument(ctx, "Utilities.getHash", argc, argv) .toLatin1(); const QByteArray hash = QCryptographicHash::hash(input, QCryptographicHash::Sha1) .toHex().left(16); return makeJsString(ctx, QString::fromLatin1(hash)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue UtilitiesExtension::js_getNativeSetting(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const auto path = getArgument(ctx, "Utilities.getNativeSetting", argc, argv); QString key; if (argc > 1) key = fromArg(ctx, "Utilities.getNativeSetting", 2, argv[1]); // QSettings will ignore the default value if an empty key is passed. if (key.isEmpty()) { key = HostOsInfo::isWindowsHost() ? StringConstants::dot() // default registry value : QLatin1String("__dummy"); } QVariant defaultValue; if (argc > 2) defaultValue = fromArg(ctx, "Utilities.getNativeSetting", 3, argv[2]); const QSettings settings(path, QSettings::NativeFormat); const QVariant v = settings.value(key, defaultValue); return v.isNull() ? JS_UNDEFINED : makeJsVariant(ctx, v); } catch (const QString &error) { return throwError(ctx, error); } } JSValue UtilitiesExtension::js_kernelVersion(JSContext *ctx, JSValueConst, int, JSValueConst *) { return makeJsString(ctx, QSysInfo::kernelVersion()); } JSValue UtilitiesExtension::js_nativeSettingGroups(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const auto path = getArgument(ctx, "Utilities.nativeSettingGroups", argc, argv); QSettings settings(path, QSettings::NativeFormat); return makeJsStringList(ctx, settings.childGroups()); } catch (const QString &error) { return throwError(ctx, error); } } JSValue UtilitiesExtension::js_rfc1034identifier(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const auto identifier = getArgument(ctx, "Utilities.rfc1034identifier", argc, argv); return makeJsString(ctx, HostOsInfo::rfc1034Identifier(identifier)); } catch (const QString &error) { return throwError(ctx, error); } } /** * Reads the contents of the S/MIME message located at \p filePath. * An equivalent command line would be: * \code security cms -D -i -o \endcode * or: * \code openssl smime -verify -noverify -inform DER -in -out \endcode * * \note A provisioning profile is an S/MIME message whose contents are an XML property list, * so this method can be used to read such files. */ JSValue UtilitiesExtension::js_smimeMessageContent(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { #if !defined(Q_OS_MACOS) Q_UNUSED(argc) Q_UNUSED(argv) return throwError(ctx, QStringLiteral("smimeMessageContent is not available on this platform")); #else try { const QString filePath = getArgument(ctx, "Utilities.smimeMessageContent", argc, argv); QFile file(filePath); if (!file.open(QIODevice::ReadOnly)) return JS_UNDEFINED; QByteArray content = smimeMessageContent(file.readAll()); if (content.isEmpty()) return JS_UNDEFINED; return toJsValue(ctx, content); } catch (const QString &error) { return throwError(ctx, error); } #endif } JSValue UtilitiesExtension::js_certificateInfo(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { #if !defined(Q_OS_MACOS) Q_UNUSED(argc) Q_UNUSED(argv) return throwError(ctx, QStringLiteral("certificateInfo is not available on this platform")); #else try { const QVariant arg = getArgument(ctx, "Utilities.certificateInfo", argc, argv); return toJsValue(ctx, certificateInfo(arg.toByteArray())); } catch (const QString &error) { return throwError(ctx, error); } #endif } // Rough command line equivalent: security find-identity -p codesigning -v JSValue UtilitiesExtension::js_signingIdentities(JSContext *ctx, JSValueConst, int, JSValueConst *) { #if !defined(Q_OS_MACOS) return throwError(ctx, QStringLiteral("signingIdentities is not available on this platform")); #else return makeJsVariantMap(ctx, identitiesProperties()); #endif } #ifdef Q_OS_WIN // Try to detect the cross-architecture from the compiler path; prepend the host architecture // if it is differ than the target architecture (e.g. something like x64_x86 and so forth). static QString detectArchitecture(const QString &compilerFilePath, const QString &targetArch) { const auto startIndex = compilerFilePath.lastIndexOf(QLatin1String("Host")); if (startIndex == -1) return targetArch; const auto endIndex = compilerFilePath.indexOf(QLatin1Char('/'), startIndex); if (endIndex == -1) return targetArch; const auto hostArch = compilerFilePath.mid(startIndex + 4, endIndex - startIndex - 4).toLower(); if (hostArch.isEmpty() || (hostArch == targetArch)) return targetArch; return hostArch + QLatin1Char('_') + targetArch; } static std::pair msvcCompilerInfoHelper( const QString &compilerFilePath, MSVC::CompilerLanguage language, const QString &vcvarsallPath, const QString &arch, const QString &sdkVersion) { QString detailedArch = detectArchitecture(compilerFilePath, arch); MSVC msvc(compilerFilePath, std::move(detailedArch), sdkVersion); VsEnvironmentDetector envdetector(vcvarsallPath); if (!envdetector.start(&msvc)) return { {}, QStringLiteral("Detecting the MSVC build environment failed: ") + envdetector.errorString() }; try { QVariantMap envMap; const auto keys = msvc.environment.keys(); for (const QString &key : keys) envMap.insert(key, msvc.environment.value(key)); return { QVariantMap { {QStringLiteral("buildEnvironment"), envMap}, {QStringLiteral("macros"), msvc.compilerDefines(compilerFilePath, language)}, }, {} }; } catch (const qbs::ErrorInfo &info) { return { {}, info.toString() }; } } #endif JSValue UtilitiesExtension::js_msvcCompilerInfo(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { #ifndef Q_OS_WIN Q_UNUSED(argc) Q_UNUSED(argv) return throwError(ctx, QStringLiteral("msvcCompilerInfo is not available on this platform")); #else try { const auto args = getArguments(ctx, "Utilities.msvcCompilerInfo", argc, argv); const QString compilerFilePath = std::get<0>(args); const QString compilerLanguage = std::get<1>(args); const QString sdkVersion = std::get<2>(args); MSVC::CompilerLanguage language; if (compilerLanguage == QStringLiteral("c")) language = MSVC::CLanguage; else if (compilerLanguage == StringConstants::cppLang()) language = MSVC::CPlusPlusLanguage; else throw Tr::tr("Utilities.msvcCompilerInfo expects \"c\" or \"cpp\" as its second argument"); const auto result = msvcCompilerInfoHelper( compilerFilePath, language, {}, MSVC::architectureFromClPath(compilerFilePath), sdkVersion); if (result.first.isEmpty()) throw result.second; return toJsValue(ctx, result.first); } catch (const QString &error) { return throwError(ctx, error); } #endif } JSValue UtilitiesExtension::js_clangClCompilerInfo(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { #ifndef Q_OS_WIN Q_UNUSED(argc) Q_UNUSED(argv) return throwError(ctx, QStringLiteral("clangClCompilerInfo is not available on this platform")); #else try { const auto args = getArguments(ctx, "Utilities.clangClCompilerInfo", argc, argv); const QString compilerFilePath = std::get<0>(args); // architecture cannot be empty as vcvarsall.bat requires at least 1 arg, so fallback // to host architecture if none is present QString arch = std::get<1>(args); if (arch.isEmpty()) arch = HostOsInfo::hostOSArchitecture(); const QString vcvarsallPath = std::get<2>(args); const QString compilerLanguage = std::get<3>(args); const QString sdkVersion = std::get<4>(args); MSVC::CompilerLanguage language; if (compilerLanguage == QStringLiteral("c")) language = MSVC::CLanguage; else if (compilerLanguage == StringConstants::cppLang()) language = MSVC::CPlusPlusLanguage; else throw Tr::tr("Utilities.clangClCompilerInfo expects \"c\" or \"cpp\" as its fourth argument"); const auto result = msvcCompilerInfoHelper( compilerFilePath, language, vcvarsallPath, arch, sdkVersion); if (result.first.isEmpty()) throw result.second; return toJsValue(ctx, result.first); } catch (const QString &error) { return throwError(ctx, error); } #endif } JSValue UtilitiesExtension::js_installedMSVCs(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { #ifndef Q_OS_WIN return throwError(ctx, QStringLiteral("Utilities.installedMSVCs is not available on this platform")); Q_UNUSED(argc) Q_UNUSED(argv) #else try { const QString hostArch = HostOsInfo::hostOSArchitecture(); QString preferredArch = getArgument(ctx, "Utilities.installedMSVCs", argc, argv); if (preferredArch.isEmpty()) preferredArch = hostArch; DummyLogSink dummySink; Logger dummyLogger(&dummySink); auto msvcs = MSVC::installedCompilers(dummyLogger); const auto predicate = [&preferredArch, &hostArch](const MSVC &msvc) { auto archPair = MSVC::getHostTargetArchPair(msvc.architecture); return archPair.first != hostArch || preferredArch != archPair.second; }; Internal::removeIf(msvcs, predicate); QVariantList result; for (const auto &msvc: msvcs) result.append(msvc.toVariantMap()); return makeJsVariantList(ctx, result); } catch (const QString &error) { return throwError(ctx, error); } #endif } JSValue UtilitiesExtension::js_installedClangCls(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { #ifndef Q_OS_WIN Q_UNUSED(argc) Q_UNUSED(argv) return throwError(ctx, QStringLiteral("Utilities.installedClangCls is not available on this platform")); #else try { const QString path = getArgument(ctx, "Utilities.installedClangCls", argc, argv); DummyLogSink dummySink; Logger dummyLogger(&dummySink); auto compilers = ClangClInfo::installedCompilers({path}, dummyLogger); QVariantList result; for (const auto &compiler: compilers) result.append(compiler.toVariantMap()); return makeJsVariantList(ctx, result); } catch (const QString &error) { return throwError(ctx, error); } #endif } JSValue UtilitiesExtension::js_versionCompare(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const auto args = getArguments(ctx, "Utilities.versionCompare", argc, argv); const auto a = Version::fromString(std::get<0>(args), true); const auto b = Version::fromString(std::get<1>(args), true); return JS_NewInt32(ctx, compare(a, b)); } catch (const QString &error) { return throwError(ctx, error); } } JSValue UtilitiesExtension::js_qmlTypeInfo(JSContext *ctx, JSValueConst, int, JSValueConst *) { return makeJsString(ctx, QString::fromStdString(qbs::LanguageInfo::qmlTypeInfo())); } JSValue UtilitiesExtension::js_builtinExtensionNames(JSContext *ctx, JSValueConst, int, JSValueConst *) { return makeJsStringList(ctx, JsExtensions::extensionNames()); } JSValue UtilitiesExtension::js_isSharedLibrary(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const auto fileName = getArgument(ctx, "Utilities.isSharedLibrary", argc, argv); return JS_NewBool(ctx, QLibrary::isLibrary(fileName)); } catch (const QString &error) { return throwError(ctx, error); } } #ifdef __APPLE__ template T readInt(QIODevice *ioDevice, bool *ok, bool swap, bool peek = false) { const auto bytes = peek ? ioDevice->peek(sizeof(T)) : ioDevice->read(sizeof(T)); if (bytes.size() != sizeof(T)) { if (ok) *ok = false; return T(); } if (ok) *ok = true; T n = *reinterpret_cast(bytes.constData()); return swap ? qbswap(n) : n; } static QString archName(cpu_type_t cputype, cpu_subtype_t cpusubtype) { switch (cputype) { case CPU_TYPE_X86: switch (cpusubtype) { case CPU_SUBTYPE_X86_ALL: return QStringLiteral("i386"); default: return {}; } case CPU_TYPE_X86_64: switch (cpusubtype) { case CPU_SUBTYPE_X86_64_ALL: return QStringLiteral("x86_64"); case CPU_SUBTYPE_X86_64_H: return QStringLiteral("x86_64h"); default: return {}; } case CPU_TYPE_ARM: switch (cpusubtype) { case CPU_SUBTYPE_ARM_V7: return QStringLiteral("armv7a"); case CPU_SUBTYPE_ARM_V7S: return QStringLiteral("armv7s"); case CPU_SUBTYPE_ARM_V7K: return QStringLiteral("armv7k"); default: return {}; } case CPU_TYPE_ARM64: switch (cpusubtype) { case CPU_SUBTYPE_ARM64_ALL: return QStringLiteral("arm64"); default: return {}; } default: return {}; } } static QStringList detectMachOArchs(QIODevice *device) { bool ok; bool foundMachO = false; qint64 pos = device->pos(); char ar_header[SARMAG]; if (device->read(ar_header, SARMAG) == SARMAG) { if (strncmp(ar_header, ARMAG, SARMAG) == 0) { while (!device->atEnd()) { static_assert(sizeof(ar_hdr) == 60, "sizeof(ar_hdr) != 60"); ar_hdr header{}; if (device->read(reinterpret_cast(&header), sizeof(ar_hdr)) != sizeof(ar_hdr)) return {}; // If the file name is stored in the "extended format" manner, // the real filename is prepended to the data section, so skip that many bytes int filenameLength = 0; if (strncmp(header.ar_name, AR_EFMT1, sizeof(AR_EFMT1) - 1) == 0) { char arName[sizeof(header.ar_name)] = { 0 }; memcpy(arName, header.ar_name + sizeof(AR_EFMT1) - 1, sizeof(header.ar_name) - (sizeof(AR_EFMT1) - 1) - 1); filenameLength = strtoul(arName, nullptr, 10); if (device->read(filenameLength).size() != filenameLength) return {}; } switch (readInt(device, nullptr, false, true)) { case MH_CIGAM: case MH_CIGAM_64: case MH_MAGIC: case MH_MAGIC_64: foundMachO = true; break; default: { // Skip the data and go to the next archive member... char szBuf[sizeof(header.ar_size) + 1] = { 0 }; memcpy(szBuf, header.ar_size, sizeof(header.ar_size)); int sz = static_cast(strtoul(szBuf, nullptr, 10)); if (sz % 2 != 0) ++sz; sz -= filenameLength; const auto data = device->read(sz); if (data.size() != sz) return {}; } } if (foundMachO) break; } } } // Wasn't an archive file, so try a fat file if (!foundMachO && !device->seek(pos)) return {}; pos = device->pos(); fat_header fatheader{}; fatheader.magic = readInt(device, nullptr, false); if (fatheader.magic == FAT_MAGIC || fatheader.magic == FAT_CIGAM || fatheader.magic == FAT_MAGIC_64 || fatheader.magic == FAT_CIGAM_64) { const bool swap = fatheader.magic == FAT_CIGAM || fatheader.magic == FAT_CIGAM_64; const bool is64bit = fatheader.magic == FAT_MAGIC_64 || fatheader.magic == FAT_CIGAM_64; fatheader.nfat_arch = readInt(device, &ok, swap); if (!ok) return {}; QStringList archs; for (uint32_t n = 0; n < fatheader.nfat_arch; ++n) { fat_arch_64 fatarch{}; static_assert(sizeof(fat_arch_64) == 32, "sizeof(fat_arch_64) != 32"); static_assert(sizeof(fat_arch) == 20, "sizeof(fat_arch) != 20"); const qint64 expectedBytes = is64bit ? sizeof(fat_arch_64) : sizeof(fat_arch); if (device->read(reinterpret_cast(&fatarch), expectedBytes) != expectedBytes) return {}; if (swap) { fatarch.cputype = qbswap(fatarch.cputype); fatarch.cpusubtype = qbswap(fatarch.cpusubtype); } const QString name = archName(fatarch.cputype, fatarch.cpusubtype); if (name.isEmpty()) { qWarning("Unknown cputype %d and cpusubtype %d", fatarch.cputype, fatarch.cpusubtype); return {}; } archs.push_back(name); } std::sort(archs.begin(), archs.end()); return archs; } // Wasn't a fat file, so we just read a thin Mach-O from the original offset if (!device->seek(pos)) return {}; bool swap = false; mach_header header{}; header.magic = readInt(device, nullptr, swap); switch (header.magic) { case MH_CIGAM: case MH_CIGAM_64: swap = true; break; case MH_MAGIC: case MH_MAGIC_64: break; default: return {}; } header.cputype = static_cast(readInt(device, &ok, swap)); if (!ok) return {}; header.cpusubtype = static_cast(readInt(device, &ok, swap)); if (!ok) return {}; const QString name = archName(header.cputype, header.cpusubtype); if (name.isEmpty()) { qWarning("Unknown cputype %d and cpusubtype %d", header.cputype, header.cpusubtype); return {}; } return {name}; } #endif JSValue UtilitiesExtension::js_getArchitecturesFromBinary(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv) { try { const auto path = getArgument(ctx, "Utilities.getArchitecturesFromBinary", argc, argv); QStringList archs; #ifdef __APPLE__ QFile file(path); if (!file.open(QIODevice::ReadOnly)) { throw Tr::tr("In Utilities.getArchitecturesFromBinary: " "Failed to open file '%1': %2") .arg(file.fileName(), file.errorString()); } archs = detectMachOArchs(&file); #else Q_UNUSED(path) #endif // __APPLE__ return makeJsStringList(ctx, archs); } catch (const QString &error) { return throwError(ctx, error); } } } // namespace Internal } // namespace qbs void initializeJsExtensionUtilities(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { qbs::Internal::UtilitiesExtension::registerClass(engine, extensionObject); } qbs-src-3.2.0/src/lib/corelib/jsextensions/domxml.cpp0000644000175100017510000005704415154533055022230 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 BogDan Vatra ** 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$ ** ****************************************************************************/ #include "jsextension.h" #include #include #include #include namespace qbs { namespace Internal { template class XmlDomNode : public JsExtension> { public: static const char *name(); XmlDomNode(const C &value) : m_value(value) {} XmlDomNode(JSContext *, const QString &name); XmlDomNode(JSContext *) {} static JSValue ctor(JSContext *ctx, JSValueConst, JSValueConst, int argc, JSValueConst *argv, int); static void setupMethods(JSContext *ctx, JSValue obj); C value() const { return m_value; } private: #define XML_JS_FWD(name, func, text) DEFINE_JS_FORWARDER_QUAL(XmlDomNode, name, func, text) XML_JS_FWD(jsIsElement, &XmlDomNode::isElement, "DomNode.isElement"); XML_JS_FWD(jsIsCDATASection, &XmlDomNode::isCDATASection, "DomNode.isCDATASection"); XML_JS_FWD(jsIsText, &XmlDomNode::isText, "DomNode.isText"); XML_JS_FWD(jsHasAttribute, &XmlDomNode::hasAttribute, "DomNode.hasAttribute"); XML_JS_FWD(jsTagName, &XmlDomNode::tagName, "DomNode.tagName"); XML_JS_FWD(jsSetTagName, &XmlDomNode::setTagName, "DomNode.setTagName"); XML_JS_FWD(jsText, &XmlDomNode::text, "DomNode.text"); XML_JS_FWD(jsData, &XmlDomNode::data, "DomNode.data"); XML_JS_FWD(jsSetData, &XmlDomNode::setData, "DomNode.setData"); XML_JS_FWD(jsClear, &XmlDomNode::clear, "DomNode.clear"); XML_JS_FWD(jsHasAttributes, &XmlDomNode::hasAttributes, "DomNode.hasAttributes"); XML_JS_FWD(jsHasChildNodes, &XmlDomNode::hasChildNodes, "DomNode.hasChildNodes"); XML_JS_FWD(jsSetAttribute, &XmlDomNode::setAttribute, "DomNode.setAttribute"); XML_JS_FWD(jsAppendChild, &XmlDomNode::appendChild, "DomNode.appendChild"); XML_JS_FWD(jsInsertBefore, &XmlDomNode::insertBefore, "DomNode.insertBefore"); XML_JS_FWD(jsInsertAfter, &XmlDomNode::insertAfter, "DomNode.insertAfter"); XML_JS_FWD(jsReplaceChild, &XmlDomNode::replaceChild, "DomNode.replaceChild"); XML_JS_FWD(jsRemoveChild, &XmlDomNode::removeChild, "DomNode.removeChild"); static JSValue jsAttribute(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { try { const auto name = JsExtension::template getArgument (ctx, "DomNode.attribute", argc, argv); QString defaultValue; if (argc > 1) defaultValue = JsExtension::template fromArg (ctx, "DomNode.attribute", 2, argv[1]); return makeJsString(ctx, JsExtension::fromJsObject (ctx, this_val)->attribute(name, defaultValue)); } catch (const QString &error) { return throwError(ctx, error); } } static JSValue jsParentNode(JSContext *ctx, JSValueConst this_val, int, JSValueConst *) { return JsExtension>::createObjectDirect( ctx, JsExtension::fromJsObject(ctx, this_val)->parentNode()); } static JSValue jsFirstChild(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { try { QString tagName; if (argc > 0) tagName = JsExtension::template getArgument (ctx, "DomNode.firstChild", argc, argv); return JsExtension>::createObjectDirect (ctx, JsExtension::fromJsObject(ctx, this_val)->firstChild(tagName)); } catch (const QString &error) { return throwError(ctx, error); } } static JSValue jsLastChild(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { try { QString tagName; if (argc > 0) tagName = JsExtension::template getArgument (ctx, "DomNode.lastChild", argc, argv); return JsExtension>::createObjectDirect (ctx, JsExtension::fromJsObject(ctx, this_val)->lastChild(tagName)); } catch (const QString &error) { return throwError(ctx, error); } } static JSValue jsPreviousSibling(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { try { QString tagName; if (argc > 0) tagName = JsExtension::template getArgument (ctx, "DomNode.previousSibling", argc, argv); return JsExtension>::createObjectDirect(ctx, JsExtension::fromJsObject (ctx, this_val)->previousSibling(tagName)); } catch (const QString &error) { return throwError(ctx, error); } } static JSValue jsNextSibling(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { try { QString tagName; if (argc > 0) tagName = JsExtension::template getArgument (ctx, "Xml.DomElement.nextSibling", argc, argv); return JsExtension>::createObjectDirect (ctx, JsExtension::fromJsObject(ctx, this_val)->nextSibling(tagName)); } catch (const QString &error) { return throwError(ctx, error); } } // Implemented for QDomDocument only. static JSValue jsDocumentElement(JSContext *ctx, JSValueConst this_val, int, JSValueConst *); static JSValue jsCreateElement(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv); static JSValue jsCreateCDATASection(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv); static JSValue jsCreateTextNode(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv); static JSValue jsSetContent(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv); static JSValue jsToString(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv); static JSValue jsSave(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv); static JSValue jsLoad(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv); bool isElement() const { return m_value.isElement(); } bool isCDATASection() const { return m_value.isCDATASection(); } bool isText() const { return m_value.isText(); } QString attribute(const QString &name, const QString &defaultValue) { QDomElement el = m_value.toElement(); if (el.isNull()) throw QStringLiteral("Node '%1' is not an element node").arg(m_value.nodeName()); return el.attribute(name, defaultValue); } void setAttribute(const QString &name, const QString &value) { QDomElement el = m_value.toElement(); if (el.isNull()) throw QStringLiteral("Node '%1' is not an element node").arg(m_value.nodeName()); el.setAttribute(name, value); } bool hasAttribute(const QString &name) const { QDomElement el = m_value.toElement(); if (el.isNull()) throw QStringLiteral("Node '%1' is not an element node").arg(m_value.nodeName()); return el.hasAttribute(name); } QString tagName() const { QDomElement el = m_value.toElement(); if (el.isNull()) throw QStringLiteral("Node '%1' is not an element node").arg(m_value.nodeName()); return el.tagName(); } void setTagName(const QString &name) { QDomElement el = m_value.toElement(); if (el.isNull()) throw QStringLiteral("Node '%1' is not an element node").arg(m_value.nodeName()); el.setTagName(name); } QString text() const { QDomElement el = m_value.toElement(); if (el.isNull()) throw QStringLiteral("Node '%1' is not an element node").arg(m_value.nodeName()); return el.text(); } QString data() const { if (m_value.isText()) return m_value.toText().data(); if (m_value.isCDATASection()) return m_value.toCDATASection().data(); if (m_value.isCharacterData()) return m_value.toCharacterData().data(); throw QStringLiteral("Node '%1' is not a character data node").arg(m_value.nodeName()); } void setData(const QString &v) const { if (m_value.isText()) return m_value.toText().setData(v); if (m_value.isCDATASection()) return m_value.toCDATASection().setData(v); if (m_value.isCharacterData()) return m_value.toCharacterData().setData(v); throw QStringLiteral("Node '%1' is not a character data node").arg(m_value.nodeName()); } void clear() { m_value.clear(); } bool hasAttributes() const { return m_value.hasAttributes(); } bool hasChildNodes() const { return m_value.hasChildNodes(); } XmlDomNode *parentNode() const { return new XmlDomNode(m_value.parentNode()); } XmlDomNode *firstChild(const QString &tagName) { if (tagName.isEmpty()) return new XmlDomNode(m_value.firstChild()); return new XmlDomNode(m_value.firstChildElement(tagName)); } XmlDomNode *lastChild(const QString &tagName) const { if (tagName.isEmpty()) return new XmlDomNode(m_value.lastChild()); return new XmlDomNode(m_value.lastChildElement(tagName)); } XmlDomNode *previousSibling(const QString &tagName) const { if (tagName.isEmpty()) return new XmlDomNode(m_value.previousSibling()); return new XmlDomNode(m_value.previousSiblingElement(tagName)); } XmlDomNode *nextSibling(const QString &tagName) const { if (tagName.isEmpty()) return new XmlDomNode(m_value.nextSibling()); return new XmlDomNode(m_value.nextSiblingElement(tagName)); } void appendChild(const XmlDomNode *newChild) { m_value.appendChild(newChild->value()); } void insertBefore(const XmlDomNode *newChild, const XmlDomNode *refChild) { m_value.insertBefore(newChild->value(), refChild->value()); } void insertAfter(const XmlDomNode *newChild, const XmlDomNode *refChild) { m_value.insertAfter(newChild->value(), refChild->value()); } void replaceChild(const XmlDomNode *newChild, const XmlDomNode *oldChild) { m_value.replaceChild(newChild->value(), oldChild->value()); } void removeChild(const XmlDomNode *oldChild) { m_value.removeChild(oldChild->value()); } // Implemented for QDomDocument only. XmlDomNode *documentElement(); XmlDomNode *createElement(const QString &tagName); XmlDomNode *createCDATASection(const QString &value); XmlDomNode *createTextNode(const QString &value); bool setContent(const QString &content); QString toString(int indent = 1); void save(const QString &filePath, int indent = 1); void load(const QString &filePath); C m_value; }; template<> const char *XmlDomNode::name() { return "DomNode"; } template<> const char *XmlDomNode::name() { return "DomDocument"; } template<> JSValue XmlDomNode::ctor(JSContext *ctx, JSValue, JSValue, int , JSValue *, int) { const JSValue obj = createObject(ctx); const auto se = ScriptEngine::engineForContext(ctx); const DubiousContextList dubiousContexts{ DubiousContext(EvalContext::PropertyEvaluation, DubiousContext::SuggestMoving) }; se->checkContext(QStringLiteral("qbs.Xml.DomNode"), dubiousContexts); se->setUsesIo(); return obj; } template<> JSValue XmlDomNode::ctor(JSContext *ctx, JSValue, JSValue, int argc, JSValue *argv, int) { try { JSValue obj; if (argc == 0) { obj = createObject(ctx); } else { const auto name = getArgument(ctx, "XmlDomDocument constructor", argc, argv); obj = createObject(ctx, name); } const auto se = ScriptEngine::engineForContext(ctx); const DubiousContextList dubiousContexts{ DubiousContext(EvalContext::PropertyEvaluation, DubiousContext::SuggestMoving) }; se->checkContext(QStringLiteral("qbs.Xml.DomDocument"), dubiousContexts); se->setUsesIo(); return obj; } catch (const QString &error) { return throwError(ctx, error); } } template<> XmlDomNode *XmlDomNode::documentElement() { return new XmlDomNode(m_value.documentElement()); } template<> XmlDomNode *XmlDomNode::createElement(const QString &tagName) { return new XmlDomNode(m_value.createElement(tagName)); } template<> XmlDomNode *XmlDomNode::createCDATASection(const QString &value) { return new XmlDomNode(m_value.createCDATASection(value)); } template<> XmlDomNode *XmlDomNode::createTextNode(const QString &value) { return new XmlDomNode(m_value.createTextNode(value)); } template<> bool XmlDomNode::setContent(const QString &content) { return static_cast(m_value.setContent(content)); } template<> QString XmlDomNode::toString(int indent) { return m_value.toString(indent); } template<> JSValue XmlDomNode::jsDocumentElement(JSContext *ctx, JSValue this_val, int, JSValue *) { return XmlDomNode::createObjectDirect( ctx, fromJsObject(ctx, this_val)->documentElement()); } template<> JSValue XmlDomNode::jsCreateElement(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) { try { const auto tagName = getArgument(ctx, "DomDocument.createElement", argc, argv); const JSValue obj = XmlDomNode::createObjectDirect( ctx, fromJsObject(ctx, this_val)->createElement(tagName)); return obj; } catch (const QString &error) { return throwError(ctx, error); } } template<> JSValue XmlDomNode::jsCreateCDATASection(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) { try { const auto value = getArgument(ctx, "DomDocument.createCDATASection", argc, argv); return XmlDomNode::createObjectDirect( ctx, fromJsObject(ctx, this_val)->createCDATASection(value)); } catch (const QString &error) { return throwError(ctx, error); } } template<> JSValue XmlDomNode::jsCreateTextNode(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) { try { const auto value = getArgument(ctx, "DomDocument.createTextNode", argc, argv); return XmlDomNode::createObjectDirect( ctx, fromJsObject(ctx, this_val)->createTextNode(value)); } catch (const QString &error) { return throwError(ctx, error); } } template<> JSValue XmlDomNode::jsSetContent(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) { try { const auto content = getArgument(ctx, "DomDocument.setContent", argc, argv); return JS_NewBool(ctx, fromJsObject(ctx, this_val)->setContent(content)); } catch (const QString &error) { return throwError(ctx, error); } } template<> JSValue XmlDomNode::jsToString(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) { try { qint32 indent = 1; if (argc > 0) indent = getArgument(ctx, "DomDocument.toString", argc, argv); return makeJsString(ctx, fromJsObject(ctx, this_val)->toString(indent)); } catch (const QString &error) { return throwError(ctx, error); } } template<> void XmlDomNode::save(const QString &filePath, int indent) { QFile f(filePath); if (!f.open(QIODevice::WriteOnly)) throw QStringLiteral("unable to open '%1'").arg(filePath); QByteArray buff(m_value.toByteArray(indent)); if (buff.size() != f.write(buff)) throw f.errorString(); f.close(); if (f.error() != QFile::NoError) throw f.errorString(); } template<> JSValue XmlDomNode::jsSave(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "DomDocument.save", argc, argv); qint32 indent = 1; if (argc > 1) indent = fromArg(ctx, "toString", 2, argv[1]); fromJsObject(ctx, this_val)->save(filePath, indent); return JS_UNDEFINED; } catch (const QString &error) { return throwError(ctx, error); } } template<> void XmlDomNode::load(const QString &filePath) { QFile f(filePath); if (!f.open(QIODevice::ReadOnly)) throw QStringLiteral("unable to open '%1'").arg(filePath); QString errorMsg; if (!m_value.setContent(&f, &errorMsg)) throw errorMsg; } template<> JSValue XmlDomNode::jsLoad(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) { try { const auto filePath = getArgument(ctx, "DomDocument.load", argc, argv); fromJsObject(ctx, this_val)->load(filePath); return JS_UNDEFINED; } catch (const QString &error) { return throwError(ctx, error); } } template<> XmlDomNode::XmlDomNode(JSContext *, const QString &name) : m_value(name) {} template void XmlDomNode::setupMethods(JSContext *ctx, JSValue obj) { JsExtension::setupMethod(ctx, obj, "appendChild", &jsAppendChild, 1); JsExtension::setupMethod(ctx, obj, "attribute", &jsAttribute, 2); JsExtension::setupMethod(ctx, obj, "clear", &jsClear, 0); JsExtension::setupMethod(ctx, obj, "data", &jsData, 0); JsExtension::setupMethod(ctx, obj, "firstChild", &jsFirstChild, 1); JsExtension::setupMethod(ctx, obj, "hasAttribute", &jsHasAttribute, 1); JsExtension::setupMethod(ctx, obj, "hasAttributes", &jsHasAttributes, 0); JsExtension::setupMethod(ctx, obj, "hasChildNodes", &jsHasChildNodes, 0); JsExtension::setupMethod(ctx, obj, "insertAfter", &jsInsertAfter, 2); JsExtension::setupMethod(ctx, obj, "insertBefore", &jsInsertBefore, 2); JsExtension::setupMethod(ctx, obj, "isCDATASection", &jsIsCDATASection, 0); JsExtension::setupMethod(ctx, obj, "isElement", &jsIsElement, 0); JsExtension::setupMethod(ctx, obj, "isText", &jsIsText, 0); JsExtension::setupMethod(ctx, obj, "lastChild", &jsLastChild, 1); JsExtension::setupMethod(ctx, obj, "nextSibling", &jsNextSibling, 1); JsExtension::setupMethod(ctx, obj, "parentNode", &jsParentNode, 0); JsExtension::setupMethod(ctx, obj, "previousSibling", &jsPreviousSibling, 1); JsExtension::setupMethod(ctx, obj, "removeChild", &jsRemoveChild, 1); JsExtension::setupMethod(ctx, obj, "replaceChild", &jsReplaceChild, 2); JsExtension::setupMethod(ctx, obj, "setAttribute", &jsSetAttribute, 2); JsExtension::setupMethod(ctx, obj, "setData", &jsSetData, 1); JsExtension::setupMethod(ctx, obj, "setTagName", &jsSetTagName, 1); JsExtension::setupMethod(ctx, obj, "tagName", &jsTagName, 0); JsExtension::setupMethod(ctx, obj, "text", &jsText, 0); if constexpr (std::is_same_v) { JsExtension::setupMethod(ctx, obj, "documentElement", &jsDocumentElement, 0); JsExtension::setupMethod(ctx, obj, "createElement", &jsCreateElement, 1); JsExtension::setupMethod(ctx, obj, "createCDATASection", &jsCreateCDATASection, 1); JsExtension::setupMethod(ctx, obj, "createTextNode", &jsCreateTextNode, 1); JsExtension::setupMethod(ctx, obj, "setContent", &jsSetContent, 1); JsExtension::setupMethod(ctx, obj, "toString", &jsToString, 1); JsExtension::setupMethod(ctx, obj, "save", &jsSave, 2); JsExtension::setupMethod(ctx, obj, "load", &jsLoad, 1); } } } // namespace Internal } // namespace qbs void initializeJsExtensionXml(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { using namespace qbs::Internal; JSValue contextObject = engine->newObject(); XmlDomNode::registerClass(engine, contextObject); XmlDomNode::registerClass(engine, contextObject); setJsProperty(engine->context(), extensionObject, std::string_view("Xml"), contextObject); } qbs-src-3.2.0/src/lib/corelib/jsextensions/temporarydir.cpp0000644000175100017510000000762115154533055023445 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** 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$ ** ****************************************************************************/ #include "jsextension.h" #include #include #include #include namespace qbs { namespace Internal { static bool tempDirIsCanonical() { #if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0) return false; #endif #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) return true; #endif return false; } class TemporaryDir : public JsExtension { friend class JsExtension; public: static const char *name() { return "TemporaryDir"; } static JSValue ctor(JSContext *ctx, JSValueConst, JSValueConst, int, JSValueConst *, int) { const auto se = ScriptEngine::engineForContext(ctx); const DubiousContextList dubiousContexts{DubiousContext(EvalContext::PropertyEvaluation, DubiousContext::SuggestMoving)}; se->checkContext(QStringLiteral("qbs.TemporaryDir"), dubiousContexts); return createObject(ctx); } static void setupMethods(JSContext *ctx, JSValue obj) { setupMethod(ctx, obj, "isValid", &jsIsValid, 0); setupMethod(ctx, obj, "path", &jsPath, 0); setupMethod(ctx, obj, "remove", &jsRemove, 0); } private: TemporaryDir(JSContext *) { m_dir.setAutoRemove(false); } DEFINE_JS_FORWARDER(jsIsValid, &TemporaryDir::isValid, "TemporaryDir.isValid") DEFINE_JS_FORWARDER(jsPath, &TemporaryDir::path, "TemporaryDir.path") DEFINE_JS_FORWARDER(jsRemove, &TemporaryDir::remove, "TemporaryDir.remove") bool isValid() const { return m_dir.isValid(); } QString path() const { return tempDirIsCanonical() ? m_dir.path() : QFileInfo(m_dir.path()).canonicalFilePath(); } bool remove() { return m_dir.remove(); } QTemporaryDir m_dir; }; } // namespace Internal } // namespace qbs void initializeJsExtensionTemporaryDir(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { qbs::Internal::TemporaryDir::registerClass(engine, extensionObject); } qbs-src-3.2.0/src/lib/corelib/jsextensions/binaryfile.cpp0000644000175100017510000001742715154533055023055 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 Sergey Belyashov ** Copyright (C) 2017 Denis Shienkov ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "jsextension.h" #include #include #include #include #include #include namespace qbs { namespace Internal { class BinaryFile : public JsExtension { friend class JsExtension; public: enum OpenMode { ReadOnly = 1, WriteOnly = 2, ReadWrite = ReadOnly | WriteOnly }; static const char *name() { return "BinaryFile"; } static void declareEnums(JSContext *ctx, JSValue classObj); static JSValue ctor(JSContext *ctx, JSValueConst, JSValueConst, int argc, JSValueConst *argv, int); private: static void setupMethods(JSContext *ctx, JSValue obj); DEFINE_JS_FORWARDER(jsClose, &BinaryFile::close, "BinaryFile.close") DEFINE_JS_FORWARDER(jsFilePath, &BinaryFile::filePath, "BinaryFile.filePath") DEFINE_JS_FORWARDER(jsAtEof, &BinaryFile::atEof, "BinaryFile.atEof") DEFINE_JS_FORWARDER(jsSize, &BinaryFile::size, "BinaryFile.size") DEFINE_JS_FORWARDER(jsResize, &BinaryFile::resize, "BinaryFile.resize") DEFINE_JS_FORWARDER(jsPos, &BinaryFile::pos, "BinaryFile.pos") DEFINE_JS_FORWARDER(jsSeek, &BinaryFile::seek, "BinaryFile.seek") DEFINE_JS_FORWARDER(jsRead, &BinaryFile::read, "BinaryFile.read") DEFINE_JS_FORWARDER(jsWrite, &BinaryFile::write, "BinaryFile.write") void close(); QString filePath(); bool atEof() const; qint64 size() const; void resize(qint64 size); qint64 pos() const; void seek(qint64 pos); QByteArray read(qint64 size); void write(const QByteArray &data); explicit BinaryFile(JSContext *, const QString &filePath, OpenMode mode); void checkForClosed() const; std::unique_ptr m_file; }; void BinaryFile::declareEnums(JSContext *ctx, JSValue classObj) { DECLARE_ENUM(ctx, classObj, ReadOnly); DECLARE_ENUM(ctx, classObj, WriteOnly); DECLARE_ENUM(ctx, classObj, ReadWrite); } void BinaryFile::setupMethods(JSContext *ctx, JSValue obj) { setupMethod(ctx, obj, "close", &jsClose, 0); setupMethod(ctx, obj, "filePath", &jsFilePath, 0); setupMethod(ctx, obj, "atEof", &jsAtEof, 0); setupMethod(ctx, obj, "size", &jsSize, 0); setupMethod(ctx, obj, "resize", &jsResize, 0); setupMethod(ctx, obj, "pos", &jsPos, 0); setupMethod(ctx, obj, "seek", &jsSeek, 0); setupMethod(ctx, obj, "read", &jsRead, 0); setupMethod(ctx, obj, "write", &jsWrite, 0); } JSValue BinaryFile::ctor(JSContext *ctx, JSValueConst, JSValueConst, int argc, JSValueConst *argv, int) { try { const auto filePath = getArgument(ctx, "BinaryFile constructor", argc, argv); OpenMode mode = ReadOnly; if (argc > 1) { mode = static_cast (fromArg(ctx, "BinaryFile constructor", 2, argv[1])); } const JSValue obj = createObject(ctx, filePath, mode); const auto se = ScriptEngine::engineForContext(ctx); const DubiousContextList dubiousContexts { DubiousContext(EvalContext::PropertyEvaluation, DubiousContext::SuggestMoving) }; se->checkContext(QStringLiteral("qbs.BinaryFile"), dubiousContexts); se->setUsesIo(); return obj; } catch (const QString &error) { return throwError(ctx, error); } } BinaryFile::BinaryFile(JSContext *, const QString &filePath, OpenMode mode) { QIODevice::OpenMode m = QIODevice::NotOpen; switch (mode) { case ReadWrite: m = QIODevice::ReadWrite; break; case ReadOnly: m = QIODevice::ReadOnly; break; case WriteOnly: m = QIODevice::WriteOnly; break; default: throw Tr::tr("Unable to open file '%1': Undefined mode '%2'").arg(filePath).arg(mode); } auto file = std::make_unique(filePath); if (Q_UNLIKELY(!file->open(m))) throw Tr::tr("Unable to open file '%1': %2").arg(filePath, file->errorString()); m_file = std::move(file); } void BinaryFile::close() { checkForClosed(); m_file->close(); m_file.reset(); } QString BinaryFile::filePath() { checkForClosed(); return QFileInfo(*m_file).absoluteFilePath(); } bool BinaryFile::atEof() const { checkForClosed(); return m_file->atEnd(); } qint64 BinaryFile::size() const { checkForClosed(); return m_file->size(); } void BinaryFile::resize(qint64 size) { checkForClosed(); if (Q_UNLIKELY(!m_file->resize(size))) throw Tr::tr("Could not resize '%1': %2").arg(m_file->fileName(), m_file->errorString()); } qint64 BinaryFile::pos() const { checkForClosed(); return m_file->pos(); } void BinaryFile::seek(qint64 pos) { checkForClosed(); if (Q_UNLIKELY(!m_file->seek(pos))) throw Tr::tr("Could not seek '%1': %2").arg(m_file->fileName(), m_file->errorString()); } QByteArray BinaryFile::read(qint64 size) { checkForClosed(); QByteArray bytes = m_file->read(size); if (Q_UNLIKELY(bytes.size() == 0 && m_file->error() != QFile::NoError)) { throw (Tr::tr("Could not read from '%1': %2") .arg(m_file->fileName(), m_file->errorString())); } return bytes; } void BinaryFile::write(const QByteArray &data) { checkForClosed(); const qint64 size = m_file->write(data); if (Q_UNLIKELY(size == -1)) { throw Tr::tr("Could not write to '%1': %2") .arg(m_file->fileName(), m_file->errorString()); } } void BinaryFile::checkForClosed() const { if (!m_file) throw Tr::tr("Access to BinaryFile object that was already closed."); } } // namespace Internal } // namespace qbs void initializeJsExtensionBinaryFile(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { qbs::Internal::BinaryFile::registerClass(engine, extensionObject); } qbs-src-3.2.0/src/lib/corelib/jsextensions/jsextensions.cpp0000644000175100017510000000723515154533055023461 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "jsextensions.h" #include #include #include #include using InitializerMap = QMap; static InitializerMap setupMap() { #define INITIALIZER_NAME(name) initializeJsExtension##name #define ADD_JS_EXTENSION(name) \ void INITIALIZER_NAME(name)(qbs::Internal::ScriptEngine *, JSValue); \ map.insert(QStringLiteral(#name), &INITIALIZER_NAME(name)) InitializerMap map; ADD_JS_EXTENSION(BinaryFile); ADD_JS_EXTENSION(Environment); ADD_JS_EXTENSION(File); ADD_JS_EXTENSION(FileInfo); ADD_JS_EXTENSION(Host); ADD_JS_EXTENSION(PkgConfig); ADD_JS_EXTENSION(Process); ADD_JS_EXTENSION(PropertyList); ADD_JS_EXTENSION(TemporaryDir); ADD_JS_EXTENSION(TextFile); ADD_JS_EXTENSION(Utilities); ADD_JS_EXTENSION(Xml); return map; } namespace qbs { namespace Internal { static InitializerMap &initializers() { static InitializerMap theMap = setupMap(); return theMap; } void JsExtensions::setupExtensions(ScriptEngine *engine, const QStringList &names, const JSValue &scope) { for (const QString &name : names) initializers().value(name)(engine, scope); } JSValue JsExtensions::loadExtension(ScriptEngine *engine, const QString &name) { if (!hasExtension(name)) return {}; ScopedJsValue extensionObj(engine->context(), engine->newObject()); initializers().value(name)(engine, extensionObj); return getJsProperty(engine->context(), extensionObj, name); } bool JsExtensions::hasExtension(const QString &name) { return initializers().contains(name); } QStringList JsExtensions::extensionNames() { return initializers().keys(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/jsextensions/host.cpp0000644000175100017510000001411315154533055021673 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2022 Raphaël Cotty ** 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$ ** ****************************************************************************/ #include "jsextension.h" #include #include #include #include #include namespace qbs { namespace Internal { class Host : public JsExtension { public: static const char *name() { return "Host"; } static void setupStaticMethods(JSContext *ctx, JSValue classObj); static JSValue jsArchitecture(JSContext *ctx, JSValueConst, int, JSValueConst *) { return makeJsString(ctx, HostOsInfo::hostOSArchitecture()); } static JSValue jsOs(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue jsPlatform(JSContext *ctx, JSValueConst, int, JSValueConst *) { return makeJsString(ctx, HostOsInfo::hostOSIdentifier()); } static JSValue jsOsVersion(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue jsOsBuildVersion(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue jsOsVersionParts(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue jsOsVersionMajor(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue jsOsVersionMinor(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue jsOsVersionPatch(JSContext *ctx, JSValueConst, int, JSValueConst *); static JSValue jsNullDevice(JSContext *ctx, JSValueConst, int, JSValueConst *); }; static QStringList osList() { QStringList list; for (const auto &s : HostOsInfo::canonicalOSIdentifiers(HostOsInfo::hostOSIdentifier())) list.push_back(s); return list; } void Host::setupStaticMethods(JSContext *ctx, JSValue classObj) { setupMethod(ctx, classObj, "architecture", &Host::jsArchitecture, 0); setupMethod(ctx, classObj, "os", &Host::jsOs, 0); setupMethod(ctx, classObj, "platform", &Host::jsPlatform, 0); setupMethod(ctx, classObj, "osVersion", &Host::jsOsVersion, 0); setupMethod(ctx, classObj, "osBuildVersion", &Host::jsOsBuildVersion, 0); setupMethod(ctx, classObj, "osVersionParts", &Host::jsOsVersionParts, 0); setupMethod(ctx, classObj, "osVersionMajor", &Host::jsOsVersionMajor, 0); setupMethod(ctx, classObj, "osVersionMinor", &Host::jsOsVersionMinor, 0); setupMethod(ctx, classObj, "osVersionPatch", &Host::jsOsVersionPatch, 0); setupMethod(ctx, classObj, "nullDevice", &Host::jsNullDevice, 0); } JSValue Host::jsOs(JSContext *ctx, JSValue, int, JSValue *) { static QStringList host = osList(); return makeJsStringList(ctx, host); } JSValue Host::jsOsVersion(JSContext *ctx, JSValue, int, JSValue *) { static QString osVersion = HostOsInfo::hostOsVersion().toString(); return osVersion.isNull() ? JS_UNDEFINED : makeJsString(ctx, osVersion); } JSValue Host::jsOsBuildVersion(JSContext *ctx, JSValue, int, JSValue *) { static QString osBuildVersion = HostOsInfo::hostOsBuildVersion(); return osBuildVersion.isNull() ? JS_UNDEFINED : makeJsString(ctx, osBuildVersion); } JSValue Host::jsOsVersionParts(JSContext *ctx, JSValue, int, JSValue *) { static QStringList osVersionParts = HostOsInfo::hostOsVersion().toString().split( QStringLiteral(".")); return makeJsStringList(ctx, osVersionParts); } JSValue Host::jsOsVersionMajor(JSContext *ctx, JSValue, int, JSValue *) { static int osVersionMajor = HostOsInfo::hostOsVersion().majorVersion(); return JS_NewInt32(ctx, osVersionMajor); } JSValue Host::jsOsVersionMinor(JSContext *ctx, JSValue, int, JSValue *) { static int osVersionMinor = HostOsInfo::hostOsVersion().minorVersion(); return JS_NewInt32(ctx, osVersionMinor); } JSValue Host::jsOsVersionPatch(JSContext *ctx, JSValue, int, JSValue *) { static int osVersionPatch = HostOsInfo::hostOsVersion().patchLevel(); return JS_NewInt32(ctx, osVersionPatch); } JSValue Host::jsNullDevice(JSContext *ctx, JSValue, int, JSValue *) { static QString nullDevice = HostOsInfo::isWindowsHost() ? QStringLiteral("NUL") : QStringLiteral("/dev/null"); return makeJsString(ctx, nullDevice); } } // namespace Internal } // namespace qbs void initializeJsExtensionHost(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { qbs::Internal::Host::registerClass(engine, extensionObject); } qbs-src-3.2.0/src/lib/corelib/jsextensions/propertylist.cpp0000644000175100017510000000434715154533055023506 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Petroules Corporation. ** 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$ ** ****************************************************************************/ #include void initializeJsExtensionPropertyList(qbs::Internal::ScriptEngine *engine, JSValue extensionObject) { JSValue obj = engine->newObject(); // provide a fake object qbs::Internal::setJsProperty(engine->context(), extensionObject, QStringLiteral("PropertyList"), obj); } qbs-src-3.2.0/src/lib/corelib/jsextensions/pkgconfigjs.h0000644000175100017510000000753515154533055022701 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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$ ** ****************************************************************************/ #include "jsextension.h" #include "tools/qbs_export.h" #include #include #include #include class QProcessEnvironment; namespace qbs { namespace Internal { class QBS_AUTOTEST_EXPORT PkgConfigJs : public JsExtension { public: enum FlagType { LibraryName = toUnderlying(PcPackage::Flag::Type::LibraryName), LibraryPath = toUnderlying(PcPackage::Flag::Type::LibraryPath), StaticLibraryName = toUnderlying(PcPackage::Flag::Type::StaticLibraryName), Framework = toUnderlying(PcPackage::Flag::Type::Framework), FrameworkPath = toUnderlying(PcPackage::Flag::Type::FrameworkPath), LinkerFlag = toUnderlying(PcPackage::Flag::Type::LinkerFlag), IncludePath = toUnderlying(PcPackage::Flag::Type::IncludePath), SystemIncludePath = toUnderlying(PcPackage::Flag::Type::SystemIncludePath), Define = toUnderlying(PcPackage::Flag::Type::Define), CompilerFlag = toUnderlying(PcPackage::Flag::Type::CompilerFlag), }; enum class ComparisonType { LessThan, GreaterThan, LessThanEqual, GreaterThanEqual, Equal, NotEqual, AlwaysMatch }; static const char *name() { return "PkgConfig"; } static void declareEnums(JSContext *ctx, JSValue classObj); static JSValue ctor(JSContext *ctx, JSValueConst, JSValueConst, int argc, JSValueConst *argv, int); explicit PkgConfigJs(JSContext *ctx, const QVariantMap &options = {}); DEFINE_JS_FORWARDER(jsPackages, &PkgConfigJs::packages, "PkgConfig.packages") QVariantMap packages() const { return m_packages; } // also used in tests static PkgConfig::Options convertOptions(const QProcessEnvironment &env, const QVariantMap &map); static void setupMethods(JSContext *ctx, JSValue obj); private: std::unique_ptr m_pkgConfig; QVariantMap m_packages; }; } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/loader/0000755000175100017510000000000015154533055016724 5ustar runnerrunnerqbs-src-3.2.0/src/lib/corelib/loader/moduleinstantiator.cpp0000644000175100017510000004154715154533055023370 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #include "moduleinstantiator.h" #include "loaderutils.h" #include "modulepropertymerger.h" #include #include #include #include #include #include #include #include #include #include namespace qbs::Internal { static std::pair getOrSetModuleInstanceItem( Item *container, Item *moduleItem, const QualifiedId &moduleName, const QString &id, bool replace, LoaderState &loaderState, ProductContext *product); class ModuleInstantiator { public: ModuleInstantiator(const InstantiationContext &context, LoaderState &loaderState) : context(context), loaderState(loaderState) {} void instantiate(); private: void overrideProperties(); void setupScope(); void exchangePlaceholderItem(Item *loadingItem, Item *moduleItemForItemValues); const InstantiationContext &context; LoaderState &loaderState; }; void ModuleInstantiator::instantiate() { AccumulatingTimer timer(loaderState.parameters().logElapsedTime() ? &context.product.timingData.moduleInstantiation : nullptr); // This part needs to be done only once per module and product, and only if the module // was successfully loaded. if (context.module && !context.alreadyLoaded) { context.module->setType(ItemType::ModuleInstance); overrideProperties(); setupScope(); } // This strange-looking code deals with the fact that our syntax cannot properly handle // dependencies on several multiplexed variants of the same product. // See getOrSetModuleInstanceItem() below for details. Item * const moduleItemForItemValues = context.moduleWithSameName ? context.moduleWithSameName : context.module; // Now attach the module instance as an item value to the loading item, potentially // evicting a previously attached placeholder item and merging its values into the instance. // Note that we potentially do this twice, once for the actual loading item and once // for the product item, if the two are different. The reason is this: // For convenience, in the product item we allow attaching to properties from indirectly // loaded modules. For instance: // Product { // Depends { name: "Qt.core" } // cpp.cxxLanguageVersion: "c++20" // Works even though there is no Depends item for cpp // } // It's debatable whether that's a good feature, but it has been working (accidentally?) // for a long time, and removing it now would break a lot of existing projects. // Note that we omit this extra step if the Depends item has an id, as those should not // spread outside the loading item. exchangePlaceholderItem(context.loadingItem, moduleItemForItemValues); if (!context.alreadyLoaded && context.product.item && context.product.item != context.loadingItem && context.id.isEmpty()) { exchangePlaceholderItem(context.product.item, moduleItemForItemValues); } } void ModuleInstantiator::exchangePlaceholderItem(Item *loadingItem, Item *moduleItemForItemValues) { // If we have a module item, set an item value pointing to it as a property on the loading item. // Evict a possibly existing placeholder item, and return it to us, so we can merge its values // into the instance. const auto &[oldItem, newItem] = getOrSetModuleInstanceItem( loadingItem, moduleItemForItemValues, context.moduleName, context.id, true, loaderState, &context.product); // The new item always exists, even if we don't have a module item. In that case, the // function created a placeholder item for us, which we then have to turn into a // non-present module. QBS_CHECK(newItem); if (!moduleItemForItemValues) { createNonPresentModule(loaderState.itemPool(), context.moduleName.toString(), QLatin1String("not found"), newItem); return; } if (!moduleItemForItemValues->isPresentModule()) return; // If the old and the new items are the same, it means the existing item value already // pointed to a module instance (rather than a placeholder). // This can happen in two cases: // a) Multiple identical Depends items on the same level (easily possible with inheritance). // b) Dependencies to multiplexed variants of the same product // (see getOrSetModuleInstanceItem() below for details). if (oldItem == newItem) { QBS_CHECK(oldItem->type() == ItemType::ModuleInstance); QBS_CHECK(context.alreadyLoaded || context.exportingProduct); return; } // In all other cases, our request to set the module instance item must have been honored. QBS_CHECK(newItem == moduleItemForItemValues); // If there was no placeholder item, we don't have to merge any values and are done. if (!oldItem) return; // If an item was replaced, then it must have been a placeholder. QBS_CHECK(oldItem->type() == ItemType::ModuleInstancePlaceholder); // Prevent setting read-only properties. for (auto it = oldItem->properties().cbegin(); it != oldItem->properties().cend(); ++it) { const PropertyDeclaration &pd = moduleItemForItemValues->propertyDeclaration(it.key()); if (pd.flags().testFlag(PropertyDeclaration::ReadOnlyFlag)) { throw ErrorInfo(Tr::tr("Cannot set read-only property '%1'.").arg(pd.name()), it.value()->location()); } } // Now merge the locally attached values into the actual module instance. mergeFromLocalInstance(context.product, loadingItem, context.loadingName, oldItem, moduleItemForItemValues, loaderState); // TODO: We'd like to delete the placeholder item here, because it's not // being referenced anymore and there's a lot of them. However, this // is not supported by ItemPool. Investigate the use of std::pmr. } Item *retrieveModuleInstanceItem(Item *containerItem, const QualifiedId &name, LoaderState &loaderState) { return getOrSetModuleInstanceItem(containerItem, nullptr, name, {}, false, loaderState, nullptr) .second; } Item *retrieveQbsItem(Item *containerItem, LoaderState &loaderState) { return retrieveModuleInstanceItem(containerItem, StringConstants::qbsModule(), loaderState); } void ModuleInstantiator::overrideProperties() { // Users can override module properties on the command line with the // modules..: syntax. // For simplicity and backwards compatibility, qbs properties can also be given without // the "modules." prefix, i.e. just qbs.:. // In addition, users can override module properties just for certain products // using the products...: syntax. // Such product-specific overrides have higher precedence. const QString fullName = context.moduleName.toString(); const QString generalOverrideKey = QStringLiteral("modules.") + fullName; const QString perProductOverrideKey = StringConstants::productsOverridePrefix() + context.product.name + QLatin1Char('.') + fullName; const SetupProjectParameters ¶meters = loaderState.parameters(); Logger &logger = loaderState.logger(); context.module->overrideProperties(parameters.overriddenValuesTree(), generalOverrideKey, parameters, logger); if (fullName == StringConstants::qbsModule()) { context.module->overrideProperties(parameters.overriddenValuesTree(), fullName, parameters, logger); } context.module->overrideProperties(parameters.overriddenValuesTree(), perProductOverrideKey, parameters, logger); } void ModuleInstantiator::setupScope() { Item * const scope = Item::create(&loaderState.itemPool(), ItemType::Scope); QBS_CHECK(context.module->file()); scope->setFile(context.module->file()); QBS_CHECK(context.product.project->scope); context.product.project->scope->copyProperty(StringConstants::projectVar(), scope); if (context.product.scope) context.product.scope->copyProperty(StringConstants::productVar(), scope); else QBS_CHECK(context.moduleName.toString() == StringConstants::qbsModule()); // Dummy product. const ItemValuePtr moduleItemValue = ItemValue::create(context.module); scope->setProperty(StringConstants::moduleVar(), moduleItemValue); if (!context.module->id().isEmpty()) scope->setProperty(context.module->id(), moduleItemValue); setScopeForDescendants(context.module, scope, true); context.module->setScope(scope); if (context.exportingProduct) { QBS_CHECK(context.exportingProduct->type() == ItemType::Product); const auto exportingProductItemValue = ItemValue::create(context.exportingProduct); scope->setProperty(QStringLiteral("exportingProduct"), exportingProductItemValue); const auto importingProductItemValue = ItemValue::create(context.product.item); scope->setProperty(QStringLiteral("importingProduct"), importingProductItemValue); // FIXME: This looks wrong. Introduce exportingProject variable? scope->setProperty( StringConstants::projectVar(), ItemValue::create(context.exportingProduct->parent())); } } void instantiateModule(const InstantiationContext &context, LoaderState &loaderState) { ModuleInstantiator(context, loaderState).instantiate(); } // This important function deals with retrieving and setting (pseudo-)module instances from/on // items. // Use case 1: Suppose we resolve the dependency cpp in module Qt.core, which also contains // property bindings for cpp such as "cpp.defines: [...]". // The "cpp" part of this binding is represented by an ItemValue whose // item is of type ModuleInstancePlaceholder, originally set up by ItemReaderASTVisitor. // This function will be called with the actual cpp module item and will // replace the placeholder item in the item value. It will also return // the placeholder item for subsequent merging of its properties with the // ones of the actual module (in ModulePropertyMerger::mergeFromLocalInstance()). // If there were no cpp property bindings defined in Qt.core, then we'd still // have to replace the placeholder item, because references to "cpp" on the // right-hand-side of other properties must refer to the module item. // This is the common use of this function as employed by resolveProdsucDependencies(). // Note that if a product has dependencies on more than one variant of a multiplexed // product, these dependencies are competing for the item value property name, // i.e. this case is not properly supported by the syntax. You must therefore not // export properties from multiplexed products that will be different between the // variants. In this function, the condition manifests itself by a module instance // being encountered instead of a module instance placeholder, in which case // nothing is done at all. // Use case 2: We inject a fake qbs module into a project item, so qbs properties set in profiles // can be accessed in the project level. Doing this is discouraged, and the // functionality is kept mostly for backwards compatibility. The moduleItem // parameter is null in this case, and the item will be created by the function itself. // Use case 3: A temporary qbs module is attached to a product during low-level setup, namely // in product multiplexing and setting qbs.profile. // Use case 4: Module propagation to the the Group level. // In all cases, the first returned item is the existing one, and the second returned item // is the new one. Depending on the use case, they might be null and might also be the same item. std::pair getOrSetModuleInstanceItem( Item *container, Item *moduleItem, const QualifiedId &moduleName, const QString &id, bool replace, LoaderState &loaderState, ProductContext *product) { Item *instance = container; const QualifiedId itemValueName = !id.isEmpty() ? QualifiedId::fromString(id) : moduleName; for (int i = 0; i < itemValueName.size(); ++i) { const QString &moduleNameSegment = itemValueName.at(i); const ValuePtr v = instance->ownProperty(itemValueName.at(i)); if (v && v->type() == Value::ItemValueType) { ItemValue * const itemValue = std::static_pointer_cast(v).get(); instance = itemValue->item(); if (i == itemValueName.size() - 1) { if (replace && instance != moduleItem && instance->type() == ItemType::ModuleInstancePlaceholder) { if (!moduleItem) { moduleItem = Item::create(&loaderState.itemPool(), ItemType::ModuleInstancePlaceholder); } itemValue->setItem(moduleItem); } return {instance, itemValue->item()}; } } else { Item *newItem = i < itemValueName.size() - 1 ? Item::create(&loaderState.itemPool(), ItemType::ModulePrefix) : moduleItem ? moduleItem : Item::create(&loaderState.itemPool(), ItemType::ModuleInstancePlaceholder); instance->setProperty(moduleNameSegment, ItemValue::create(newItem)); instance = newItem; } } // If the Depends item has an id, make sure it now points to the module. Otherwise nested // child items will still get the Depends item when referring to it. if (!id.isEmpty() && (container->type() == ItemType::Product || container->type() == ItemType::ModuleInstance)) { Item * const scope = container->type() == ItemType::Product ? product->scope : container->scope(); QBS_CHECK(scope); const ValuePtr idValue = scope->property(id); QBS_CHECK(idValue); QBS_CHECK(idValue->type() == Value::ItemValueType); const auto idIv = static_cast(idValue.get()); if (idIv->item()->type() != ItemType::ModuleInstance) { QBS_CHECK(idIv->item()->type() == ItemType::Depends); scope->setProperty(id, ItemValue::create(moduleItem)); } } return {nullptr, instance}; } } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/projectresolver.h0000644000175100017510000000574715154533055022342 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 PROJECTRESOLVER_H #define PROJECTRESOLVER_H #include #include #include #include #include #include #include namespace qbs { class SetupProjectParameters; namespace Internal { class FileTime; class Logger; class ProgressObserver; class ScriptEngine; class StoredModuleProviderInfo; class QBS_AUTOTEST_EXPORT ProjectResolver { public: ProjectResolver(const SetupProjectParameters ¶meters, ScriptEngine *engine, Logger logger); ~ProjectResolver(); void setProgressObserver(ProgressObserver *observer); void setOldProjectProbes(const std::vector &oldProbes); void setOldProductProbes(const QHash> &oldProbes); void setLastResolveTime(const FileTime &time); void setStoredProfiles(const QVariantMap &profiles); void setStoredModuleProviderInfo(const StoredModuleProviderInfo &providerInfo); TopLevelProjectPtr resolve(); private: class Private; Pimpl d; }; } // namespace Internal } // namespace qbs #endif // PROJECTRESOLVER_H qbs-src-3.2.0/src/lib/corelib/loader/moduleinstantiator.h0000644000175100017510000000643215154533055023027 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once #include QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE namespace qbs::Internal { class Item; class LoaderState; class ProductContext; class QualifiedId; class InstantiationContext { public: ProductContext &product; Item * const loadingItem; const QString &loadingName; Item * const module; Item * const moduleWithSameName; Item * const exportingProduct; const QualifiedId &moduleName; const QString &id; const bool alreadyLoaded; }; // This function is responsible for setting up a proper module instance from a bunch of items: // - Set the item type to ItemType::ModuleInstance (from Module or Export). // - Apply possible command-line overrides for module properties. // - Replace a possible module instance placeholder in the loading item with the actual instance // and merge their values employing the ModulePropertyMerger. // - Setting up the module instance scope. void instantiateModule(const InstantiationContext &context, LoaderState &loaderState); // Helper functions for retrieving/setting module instance items for special purposes. // Note that these will also create the respective item value if it does not exist yet. Item *retrieveModuleInstanceItem(Item *containerItem, const QualifiedId &name, LoaderState &loaderState); Item *retrieveQbsItem(Item *containerItem, LoaderState &loaderState); } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/probesresolver.cpp0000644000175100017510000003162415154533055022512 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2022 The Qt Company Ltd. ** Copyright (C) 2022 Raphaël Cotty ** 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$ ** ****************************************************************************/ #include "probesresolver.h" #include "itemreader.h" #include "loaderutils.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { static QString probeGlobalId(Item *probe) { QString id; for (Item *obj = probe; obj; obj = obj->prototype()) { if (!obj->id().isEmpty()) { id = obj->id(); break; } } if (id.isEmpty()) return {}; QBS_CHECK(probe->file()); return id + QLatin1Char('_') + probe->file()->filePath(); } ProbesResolver::ProbesResolver(LoaderState &loaderState) : m_loaderState(loaderState) {} void ProbesResolver::resolveProbes(ProductContext &productContext, Item *item) { AccumulatingTimer probesTimer(m_loaderState.parameters().logElapsedTime() ? &productContext.timingData.probes : nullptr); EvalContextSwitcher evalContextSwitcher(m_loaderState.evaluator().engine(), EvalContext::ProbeExecution); for (Item * const child : item->children()) { if (child->type() == ItemType::Probe) resolveProbe(productContext, item, child); } } void ProbesResolver::resolveProbe(ProductContext &productContext, Item *parent, Item *probe) { qCDebug(lcModuleLoader) << "Resolving Probe at " << probe->location().toString(); const QString &probeId = probeGlobalId(probe); if (Q_UNLIKELY(probeId.isEmpty())) throw ErrorInfo(Tr::tr("Probe.id must be set."), probe->location()); const bool isProjectLevelProbe = parent->type() == ItemType::Project || productContext.name.startsWith(StringConstants::shadowProductPrefix()); const JSSourceValueConstPtr configureScript = probe->sourceProperty(StringConstants::configureProperty()); QBS_CHECK(configureScript); if (Q_UNLIKELY(configureScript->sourceCode() == StringConstants::undefinedValue())) throw ErrorInfo(Tr::tr("Probe.configure must be set."), probe->location()); using ProbeProperty = std::pair; std::vector probeBindings; Evaluator &evaluator = m_loaderState.evaluator(); ScriptEngine * const engine = evaluator.engine(); JSContext * const ctx = engine->context(); QVariantMap initialProperties; for (Item *obj = probe; obj; obj = obj->prototype()) { const Item::PropertyMap &props = obj->properties(); for (auto it = props.cbegin(); it != props.cend(); ++it) { const QString &name = it.key(); if (name == StringConstants::configureProperty()) continue; const JSValue value = evaluator.value(probe, name); probeBindings.emplace_back(name, ScopedJsValue(ctx, value)); if (name != StringConstants::conditionProperty()) initialProperties.insert(name, getJsVariant(ctx, value)); } } const bool condition = evaluator.boolValue(probe, StringConstants::conditionProperty()); const QString &sourceCode = configureScript->sourceCode().toString(); ProbeConstPtr resolvedProbe; std::lock_guard lock(m_loaderState.topLevelProject().probesCacheLock()); m_loaderState.topLevelProject().incrementProbesCount(); if (isProjectLevelProbe) { resolvedProbe = findOldProjectProbe(probeId, condition, initialProperties, sourceCode); } else { resolvedProbe = findOldProductProbe(productContext.uniqueName(), condition, initialProperties, sourceCode); } if (!resolvedProbe) { resolvedProbe = findCurrentProbe(probe->location(), condition, initialProperties); if (resolvedProbe) { qCDebug(lcModuleLoader) << "probe results cached from current run"; m_loaderState.topLevelProject().incrementReusedCurrentProbesCount(); } } else { qCDebug(lcModuleLoader) << "probe results cached from earlier run"; m_loaderState.topLevelProject().incrementReusedOldProbesCount(); } ScopedJsValue configureScope(ctx, JS_UNDEFINED); std::vector importedFilesUsedInConfigure; if (!condition) { qCDebug(lcModuleLoader) << "Probe disabled; skipping"; } else if (!resolvedProbe) { m_loaderState.topLevelProject().incrementRunProbesCount(); qCDebug(lcModuleLoader) << "configure script needs to run"; const Evaluator::FileContextScopes fileCtxScopes = evaluator.fileContextScopes(configureScript->file()); configureScope.setValue(engine->newObject()); for (const ProbeProperty &b : probeBindings) setJsProperty(ctx, configureScope, b.first, JS_DupValue(ctx, b.second)); engine->clearRequestedProperties(); const JSValue scopes[] = { fileCtxScopes.fileScope, fileCtxScopes.importScope, configureScope}; ScopedJsValue sv( ctx, engine->evaluate( JsValueOwner::Caller, configureScript->sourceCodeForEvaluation(), {}, 1, scopes)); engine->throwOnJsError(configureScript->location()); importedFilesUsedInConfigure = engine->importedFilesUsedInScript(); } else { importedFilesUsedInConfigure = resolvedProbe->importedFilesUsed(); } QMap storedValues; for (const ProbeProperty &b : probeBindings) { if (b.first == StringConstants::conditionProperty() || b.first == StringConstants::configureProperty()) continue; VariantValuePtr storedValue; QVariant newValue; if (resolvedProbe) { storedValue = resolvedProbe->values().value(b.first); } else { if (condition) { JSValue v = getJsProperty(ctx, configureScope, b.first); const JSValue saved = v; ScopedJsValue valueMgr(ctx, saved); const PropertyDeclaration decl = probe->propertyDeclaration(b.first); evaluator.convertToPropertyType(decl, probe->location(), v); // If the value was converted from scalar to array as per our convenience // functionality, then the original value is now the only element of a // newly allocated array and thus gets deleted via that array. // The array itself is owned by the script engine, so we must stay out of // memory management here. if (v != saved) valueMgr.setValue(JS_UNDEFINED); engine->throwOnJsError({}); newValue = getJsVariant(ctx, v); // Special case, string and path lists are represented as js arrays but we don't // want to make them const as we do for object lists. Converting to QStringList // allows to distinguish between these two cases in ScriptEngine::asJsValue if (newValue.userType() == QMetaType::QVariantList && (decl.type() == PropertyDeclaration::StringList || decl.type() == PropertyDeclaration::PathList)) { #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) newValue.convert(QMetaType(QMetaType::QStringList)); #else newValue.convert(QMetaType::QStringList); #endif } } else { newValue = initialProperties.value(b.first); } storedValue = VariantValue::createStored(newValue); } if (storedValue) { // It would be simplier and faster to do this unconditionally, but setting invalid // VariantValue for "undefined" (e.g. unchanged) properties leads to undesired // convertion of lists properties from "undefined" to []. // See convertToPropertyType in evaluator.cpp and QTBUG-51237 if (!qVariantsEqual(storedValue->value(), getJsVariant(ctx, b.second))) { probe->setProperty(b.first, storedValue); } if (!resolvedProbe) storedValues[b.first] = storedValue; } } if (!resolvedProbe) { resolvedProbe = Probe::create( probeId, probe->location(), condition, sourceCode, initialProperties, storedValues, importedFilesUsedInConfigure); m_loaderState.topLevelProject().addNewlyResolvedProbe(resolvedProbe); } if (isProjectLevelProbe) m_loaderState.topLevelProject().addProjectLevelProbe(resolvedProbe); else productContext.probes << resolvedProbe; } ProbeConstPtr ProbesResolver::findOldProjectProbe( const QString &globalId, bool condition, const QVariantMap &initialProperties, const QString &sourceCode) const { if (m_loaderState.parameters().forceProbeExecution()) return {}; return m_loaderState.topLevelProject().findOldProjectProbe(globalId, [&](const ProbeConstPtr &oldProbe) { return probeMatches(oldProbe, condition, initialProperties, sourceCode, CompareScript::Yes); }); } ProbeConstPtr ProbesResolver::findOldProductProbe( const QString &productName, bool condition, const QVariantMap &initialProperties, const QString &sourceCode) const { if (m_loaderState.parameters().forceProbeExecution()) return {}; return m_loaderState.topLevelProject().findOldProductProbe(productName, [&](const ProbeConstPtr &oldProbe) { return probeMatches(oldProbe, condition, initialProperties, sourceCode, CompareScript::Yes); }); } ProbeConstPtr ProbesResolver::findCurrentProbe( const CodeLocation &location, bool condition, const QVariantMap &initialProperties) const { return m_loaderState.topLevelProject().findCurrentProbe(location, [&](const ProbeConstPtr &probe) { return probeMatches(probe, condition, initialProperties, QString(), CompareScript::No); }); } bool ProbesResolver::probeMatches(const ProbeConstPtr &probe, bool condition, const QVariantMap &initialProperties, const QString &configureScript, CompareScript compareScript) const { return probe->condition() == condition && qVariantMapsEqual(probe->initialProperties(), initialProperties) && (compareScript == CompareScript::No || (probe->configureScript() == configureScript && !probe->needsReconfigure(m_loaderState.topLevelProject().lastResolveTime()))); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/loader/itemreadervisitorstate.h0000644000175100017510000000564715154533055023713 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ITEMREADERVISITORSTATE_H #define QBS_ITEMREADERVISITORSTATE_H #include #include #include namespace qbs { namespace Internal { class Item; class ItemPool; class ItemReaderCache; class LoaderState; class Logger; class ItemReaderVisitorState { public: ItemReaderVisitorState(LoaderState &loaderState); Logger &logger() const { return m_logger; } Item *readFile(const QString &filePath, const QStringList &searchPaths, ItemPool *itemPool); void findDirectoryEntries(const QString &dirPath, QStringList *entries) const; Item *mostDerivingItem() const; void setMostDerivingItem(Item *item); DeprecationWarningMode deprecationWarningMode() const; void addCodeLink( const QString &sourceFile, const CodeRange &sourceRange, const CodeLocation &targetLoc); private: LoaderState &m_loaderState; ItemReaderCache &m_cache; Logger &m_logger; Item *m_mostDerivingItem = nullptr; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/loader/productresolver.h0000644000175100017510000000472715154533055022351 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once namespace qbs::Internal { enum class Deferral; class LoaderState; class ProductContext; // Responsibilities: // - Resolving dependencies to modules and other products (via DependenciesResolver). // - Module validation. // - Running probes (via ProbesResolver) in Product and Module items. // - Evaluating product and module properties. // - Handling all Product child items, such as FileTaggers, Rules and so on. void resolveProduct(ProductContext &product, Deferral deferral, LoaderState &loaderState); void setupExports(ProductContext &product, LoaderState &loaderState); } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/productsresolver.h0000644000175100017510000000375315154533055022532 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once namespace qbs::Internal { class LoaderState; void resolveProducts(LoaderState &loaderState); } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/itemreader.cpp0000644000175100017510000002266315154533055021562 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "itemreader.h" #include "itemreadervisitorstate.h" #include "loaderutils.h" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { static void makePathsCanonical(QStringList &paths) { Internal::removeIf(paths, [](QString &p) { p = QFileInfo(p).canonicalFilePath(); return p.isEmpty(); }); } ItemReader::ItemReader(LoaderState &loaderState) : m_loaderState(loaderState) {} void ItemReader::init() { m_visitorState = std::make_unique(m_loaderState); m_projectFilePath = m_loaderState.parameters().projectFilePath(); setSearchPaths(m_loaderState.parameters().searchPaths()); m_elapsedTime = m_loaderState.parameters().logElapsedTime() ? 0 : -1; } ItemReader::~ItemReader() = default; void ItemReader::setSearchPaths(const QStringList &searchPaths) { qCDebug(lcModuleLoader) << "initial search paths:" << searchPaths; m_searchPaths = searchPaths; makePathsCanonical(m_searchPaths); m_allSearchPaths.clear(); } void ItemReader::pushExtraSearchPaths(const QStringList &extraSearchPaths) { m_extraSearchPaths.push_back(extraSearchPaths); makePathsCanonical(m_extraSearchPaths.back()); m_allSearchPaths.clear(); } void ItemReader::popExtraSearchPaths() { m_extraSearchPaths.pop_back(); m_allSearchPaths.clear(); } const std::vector &ItemReader::extraSearchPathsStack() const { return m_extraSearchPaths; } void ItemReader::setExtraSearchPathsStack(const std::vector &s) { m_extraSearchPaths = s; m_allSearchPaths.clear(); } void ItemReader::clearExtraSearchPathsStack() { m_extraSearchPaths.clear(); m_allSearchPaths.clear(); } const QStringList &ItemReader::allSearchPaths() const { if (m_allSearchPaths.empty()) { std::for_each(m_extraSearchPaths.crbegin(), m_extraSearchPaths.crend(), [this] (const QStringList &paths) { m_allSearchPaths += paths; }); m_allSearchPaths += m_searchPaths; m_allSearchPaths.removeDuplicates(); } return m_allSearchPaths; } Item *ItemReader::readFile(const QString &filePath) { AccumulatingTimer readFileTimer(m_elapsedTime != -1 ? &m_elapsedTime : nullptr); return m_visitorState->readFile(filePath, allSearchPaths(), &m_loaderState.itemPool()); } Item *ItemReader::readFile(const QString &filePath, const CodeLocation &referencingLocation) { try { return readFile(filePath); } catch (const ErrorInfo &e) { if (e.hasLocation()) throw; throw ErrorInfo(e.toString(), referencingLocation); } } void ItemReader::handlePropertyOptions(Item *optionsItem) { Evaluator &evaluator = m_loaderState.evaluator(); const QString name = evaluator.stringValue(optionsItem, StringConstants::nameProperty()); if (name.isEmpty()) { throw ErrorInfo(Tr::tr("PropertyOptions item needs a name property"), optionsItem->location()); } const QString description = evaluator.stringValue( optionsItem, StringConstants::descriptionProperty()); const auto removalVersion = Version::fromString( evaluator.stringValue(optionsItem, StringConstants::removalVersionProperty())); const auto allowedValues = evaluator.stringListValue( optionsItem, StringConstants::allowedValuesProperty()); PropertyDeclaration decl = optionsItem->parent()->propertyDeclaration(name); if (!decl.isValid()) { decl.setName(name); decl.setType(PropertyDeclaration::Variant); } decl.setDescription(description); if (removalVersion.isValid()) { DeprecationInfo di(removalVersion, description); decl.setDeprecationInfo(di); } decl.setAllowedValues(allowedValues); const ValuePtr property = optionsItem->parent()->property(name); if (!property && !decl.isExpired()) { throw ErrorInfo(Tr::tr("PropertyOptions item refers to non-existing property '%1'") .arg(name), optionsItem->location()); } if (property && decl.isExpired()) { ErrorInfo e(Tr::tr("Property '%1' was scheduled for removal in version %2, but " "is still present.") .arg(name, removalVersion.toString()), property->location()); e.append(Tr::tr("Removal version for '%1' specified here.").arg(name), optionsItem->location()); m_visitorState->logger().printWarning(e); } optionsItem->parent()->setPropertyDeclaration(name, decl); } void ItemReader::handleAllPropertyOptionsItems(Item *item) { QList childItems = item->children(); auto childIt = childItems.begin(); while (childIt != childItems.end()) { Item * const child = *childIt; if (child->type() == ItemType::PropertyOptions) { handlePropertyOptions(child); childIt = childItems.erase(childIt); } else { handleAllPropertyOptionsItems(child); ++childIt; } } item->setChildren(childItems); } Item *ItemReader::setupItemFromFile(const QString &filePath, const CodeLocation &referencingLocation) { Item *item = readFile(filePath, referencingLocation); // This is technically not needed, because files are only set up once and then served // from a cache. But it simplifies the checks in item.cpp if we require the locking invariant // to always hold. std::unique_ptr locker; if (item->type() == ItemType::Module) locker = std::make_unique(*item); handleAllPropertyOptionsItems(item); return item; } Item *ItemReader::wrapInProjectIfNecessary(Item *item) { if (item->type() == ItemType::Project) return item; Item *prj = Item::create(&m_loaderState.itemPool(), ItemType::Project); Item::addChild(prj, item); prj->setFile(item->file()); prj->setLocation(item->location()); prj->setupForBuiltinType(m_loaderState.parameters().deprecationWarningMode(), m_visitorState->logger()); return prj; } QStringList ItemReader::readExtraSearchPaths(Item *item, bool *wasSet) { QStringList result; const QStringList paths = m_loaderState.evaluator().stringListValue( item, StringConstants::qbsSearchPathsProperty(), wasSet); const JSSourceValueConstPtr prop = item->sourceProperty( StringConstants::qbsSearchPathsProperty()); // Value can come from within a project file or as an overridden value from the user // (e.g command line). const QString basePath = FileInfo::path(prop ? prop->file()->filePath() : m_projectFilePath); for (const QString &path : paths) result += FileInfo::resolvePath(basePath, path); return result; } SearchPathsManager::SearchPathsManager(ItemReader &itemReader, const QStringList &extraSearchPaths) : m_itemReader(itemReader), m_oldSize(itemReader.extraSearchPathsStack().size()) { if (!extraSearchPaths.isEmpty()) m_itemReader.pushExtraSearchPaths(extraSearchPaths); } SearchPathsManager::~SearchPathsManager() { while (m_itemReader.extraSearchPathsStack().size() > m_oldSize) m_itemReader.popExtraSearchPaths(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/loader/moduleloader.h0000644000175100017510000000440615154533055021555 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once namespace qbs { class CodeLocation; class VersionRange; namespace Internal { class Item; class LoaderState; class ProductContext; class QualifiedId; Item *searchAndLoadModuleFile( LoaderState &loaderState, ProductContext &product, const CodeLocation &dependsItemLocation, const QualifiedId &moduleName, const VersionRange &requiredVersion); } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/loader/astpropertiesitemhandler.h0000644000175100017510000000466515154533055024231 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ASTPROPERTIESITEMHANDLER_H #define QBS_ASTPROPERTIESITEMHANDLER_H namespace qbs { namespace Internal { class Item; class ItemPool; class Logger; class ASTPropertiesItemHandler { public: ASTPropertiesItemHandler(Item *parentItem, ItemPool &itemPool, Logger &logger); void handlePropertiesItems(); private: void prepareGroup(); void setupAlternatives(); void handlePropertiesBlock(const Item *propertiesItem); Item * const m_parentItem; ItemPool &m_itemPool; Logger &m_logger; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/loader/groupshandler.cpp0000644000175100017510000002671215154533055022315 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #include "groupshandler.h" #include "loaderutils.h" #include "moduleinstantiator.h" #include #include #include #include #include #include #include namespace qbs::Internal { class GroupsHandler { public: GroupsHandler(ProductContext &product, LoaderState &loaderState) : m_product(product), m_loaderState(loaderState) {} void run(); private: void gatherAssignedProperties(ItemValue *iv, const QualifiedId &prefix, QualifiedIdSet &properties); void markModuleTargetGroups(Item *group, const Item::Module &module); void propagateModulesFromParent(Item *group); void handleGroup(Item *group); void adjustScopesInGroupModuleInstances(Item *groupItem, const Item::Module &module); QualifiedIdSet gatherModulePropertiesSetInGroup(const Item *group); ProductContext &m_product; LoaderState &m_loaderState; }; void setupGroups(ProductContext &product, LoaderState &loaderState) { GroupsHandler(product, loaderState).run(); } void GroupsHandler::run() { AccumulatingTimer timer( m_loaderState.parameters().logElapsedTime() ? &m_product.timingData.groupsSetup : nullptr); for (Item * const child : m_product.item->children()) { if (child->type() == ItemType::Group) handleGroup(child); } for (const Item::Module &module : m_product.item->modules()) { if (!module.item->isPresentModule()) continue; for (Item * const child : module.item->children()) { if (child->type() == ItemType::Group) { markModuleTargetGroups(child, module); handleGroup(child); } } } } void GroupsHandler::gatherAssignedProperties(ItemValue *iv, const QualifiedId &prefix, QualifiedIdSet &properties) { const Item::PropertyMap &props = iv->item()->properties(); for (auto it = props.cbegin(); it != props.cend(); ++it) { switch (it.value()->type()) { case Value::JSSourceValueType: properties << (QualifiedId(prefix) << it.key()); break; case Value::ItemValueType: if (iv->item()->type() == ItemType::ModulePrefix) { gatherAssignedProperties(std::static_pointer_cast(it.value()).get(), QualifiedId(prefix) << it.key(), properties); } break; default: break; } } } void GroupsHandler::markModuleTargetGroups(Item *group, const Item::Module &module) { if (group->type() != ItemType::Group) return; if (m_loaderState.evaluator().boolValue(group, StringConstants::filesAreTargetsProperty())) { group->setProperty(StringConstants::modulePropertyInternal(), VariantValue::create(module.name.toString())); } for (Item * const child : group->children()) markModuleTargetGroups(child, module); } // TODO: I don't completely understand this function, and I suspect we do both too much // and too little here. In particular, I'm not sure why we should even have to do anything // with groups that don't attach properties. // Set aside a day or two at some point to fully grasp all the details and rewrite accordingly. void GroupsHandler::propagateModulesFromParent(Item *group) { QBS_CHECK(group->type() == ItemType::Group); QHash moduleInstancesForGroup; // Step 1: "Instantiate" the product's modules for the group. Item * const parentGroupOrProduct = group->parent()->type() == ItemType::ModuleInstance ? m_product.item : group->parent(); for (Item::Module m : parentGroupOrProduct->modules()) { Item * const targetItem = retrieveModuleInstanceItem(group, m.name, m_loaderState); QBS_CHECK(targetItem->type() == ItemType::ModuleInstancePlaceholder); targetItem->setPrototype(m.item); Item * const moduleScope = Item::create(&m_loaderState.itemPool(), ItemType::Scope); moduleScope->setFile(group->file()); moduleScope->setProperties(m.item->scope()->properties()); // "project", "product", ids moduleScope->setScope(group); targetItem->setScope(moduleScope); targetItem->setFile(m.item->file()); // "parent" should point to the group/artifact parent targetItem->setParent(group->parent()); targetItem->setOuterItem(m.item); m.item = targetItem; group->addModule(m); moduleInstancesForGroup.insert(m.name, targetItem); } // Step 2: Make the inter-module references point to the instances created in step 1. for (const Item::Module &module : group->modules()) { Item::Modules adaptedModules; const Item::Modules &oldModules = module.item->prototype()->modules(); for (Item::Module depMod : oldModules) { depMod.item = moduleInstancesForGroup.value(depMod.name); adaptedModules << depMod; if (depMod.name.front() == module.name.front()) continue; const ItemValuePtr &modulePrefix = group->itemProperty(depMod.name.front(), m_loaderState.itemPool()); QBS_CHECK(modulePrefix); module.item->setProperty(depMod.name.front(), modulePrefix); } module.item->setModules(adaptedModules); } const QualifiedIdSet &propsSetInGroup = gatherModulePropertiesSetInGroup(group); if (propsSetInGroup.empty()) return; m_product.modulePropertiesSetInGroups.insert(std::make_pair(group, propsSetInGroup)); // Step 3: Adapt scopes in values. This is potentially necessary if module properties // get assigned on the group level. for (const Item::Module &module : group->modules()) adjustScopesInGroupModuleInstances(group, module); } void GroupsHandler::handleGroup(Item *group) { propagateModulesFromParent(group); m_loaderState.topLevelProject().checkItemCondition(group, m_loaderState.evaluator()); for (Item * const child : group->children()) { if (child->type() == ItemType::Group) handleGroup(child); } } void GroupsHandler::adjustScopesInGroupModuleInstances(Item *groupItem, const Item::Module &module) { if (!module.item->isPresentModule()) return; Item *modulePrototype = module.item->rootPrototype(); QBS_CHECK(modulePrototype->type() == ItemType::Module || modulePrototype->type() == ItemType::Export); const Item::PropertyDeclarationMap &propDecls = modulePrototype->propertyDeclarations(); for (const auto &decl : propDecls) { const QString &propName = decl.name(); // Nothing gets inherited for module properties assigned directly in the group. // In particular, setting a list property overwrites the value from the product's // (or parent group's) instance completely, rather than appending to it // (concatenation happens via outer.concat()). ValuePtr propValue = module.item->ownProperty(propName); if (propValue) { propValue->setScope(module.item->scope(), {}); continue; } // Find the nearest prototype instance that has the value assigned. // The result is either an instance of a parent group (or the parent group's // parent group and so on) or the instance of the product or the module prototype. // In the latter case, we don't have to do anything. const Item *instanceWithProperty = module.item; do { instanceWithProperty = instanceWithProperty->prototype(); QBS_CHECK(instanceWithProperty); propValue = instanceWithProperty->ownProperty(propName); } while (!propValue); QBS_CHECK(propValue); if (propValue->type() != Value::JSSourceValueType) continue; if (propValue->scope()) module.item->setProperty(propName, propValue->clone(m_loaderState.itemPool())); } for (const ValuePtr &prop : module.item->properties()) { if (prop->type() != Value::JSSourceValueType) continue; const auto adjust = [groupItem](const ValuePtr &v) { if (!v->scope()) return; for (const Item::Module &module : groupItem->modules()) { if (v->scope() == module.item->prototype()) { v->setScope(module.item, {}); break; } } }; adjust(prop); const auto candidates = transformed>( prop->candidates(), [this](const ValuePtr &v) { return v->clone(m_loaderState.itemPool()); }); for (const ValuePtr &c : candidates) { adjust(c); } prop->setCandidates(candidates); } } QualifiedIdSet GroupsHandler::gatherModulePropertiesSetInGroup(const Item *group) { QualifiedIdSet propsSetInGroup; const Item::PropertyMap &props = group->properties(); for (auto it = props.cbegin(); it != props.cend(); ++it) { if (it.value()->type() == Value::ItemValueType) { gatherAssignedProperties(std::static_pointer_cast(it.value()).get(), QualifiedId(it.key()), propsSetInGroup); } } return propsSetInGroup; } } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/itemreader.h0000644000175100017510000001005315154533055021215 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ITEMREADER_H #define QBS_ITEMREADER_H #include #include #include namespace qbs::Internal { class Item; class ItemReaderVisitorState; class LoaderState; class Logger; /* * Reads a qbs file and creates a tree of Item objects. * * In this stage the following steps are performed: * - The QML/JS parser creates the AST. * - The AST is converted to a tree of Item objects. * * This class is also responsible for the QMLish inheritance semantics. */ class ItemReader { public: ItemReader(LoaderState &loaderState); ~ItemReader(); void init(); void pushExtraSearchPaths(const QStringList &extraSearchPaths); void popExtraSearchPaths(); const std::vector &extraSearchPathsStack() const; void setExtraSearchPathsStack(const std::vector &s); void clearExtraSearchPathsStack(); const QStringList &allSearchPaths() const; // Parses a file, creates an item for it, generates PropertyDeclarations from // PropertyOptions items and removes said items from the item tree. Item *setupItemFromFile(const QString &filePath, const CodeLocation &referencingLocation); Item *wrapInProjectIfNecessary(Item *item); QStringList readExtraSearchPaths(Item *item, bool *wasSet = nullptr); qint64 elapsedTime() const { return m_elapsedTime; } private: void setSearchPaths(const QStringList &searchPaths); Item *readFile(const QString &filePath); Item *readFile(const QString &filePath, const CodeLocation &referencingLocation); void handlePropertyOptions(Item *optionsItem); void handleAllPropertyOptionsItems(Item *item); LoaderState &m_loaderState; QStringList m_searchPaths; std::vector m_extraSearchPaths; mutable QStringList m_allSearchPaths; std::unique_ptr m_visitorState; QString m_projectFilePath; qint64 m_elapsedTime = -1; }; class SearchPathsManager { public: SearchPathsManager(ItemReader &itemReader, const QStringList &extraSearchPaths = {}); ~SearchPathsManager(); private: ItemReader &m_itemReader; size_t m_oldSize{0}; }; } // namespace qbs::Internal #endif // QBS_ITEMREADER_H qbs-src-3.2.0/src/lib/corelib/loader/moduleproviderloader.cpp0000644000175100017510000004346115154533055023667 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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$ ** ****************************************************************************/ #include "moduleproviderloader.h" #include "itemreader.h" #include "probesresolver.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { static QString getConfigHash(const QVariantMap& config) { QJsonDocument doc; doc.setObject(QJsonObject::fromVariantMap(config)); return QString::fromLatin1( QCryptographicHash::hash(doc.toJson(), QCryptographicHash::Sha1).toHex().left(16)); } ModuleProviderLoader::ModuleProviderLoader(LoaderState &loaderState) : m_loaderState(loaderState) {} ModuleProviderLoader::ModuleProviderResult ModuleProviderLoader::executeModuleProviders( ProductContext &productContext, const CodeLocation &dependsItemLocation, const QualifiedId &moduleName) { ModuleProviderLoader::ModuleProviderResult result; try { std::vector providersToRun; qCDebug(lcModuleLoader) << "Module" << moduleName.toString() << "not found, checking for module providers"; const auto providerNames = getModuleProviders(productContext.item); if (providerNames) { providersToRun = transformed>(*providerNames, [](const auto &name) { return Provider{name, ModuleProviderLookup::Named}; }); } else { for (QualifiedId providerName = moduleName; !providerName.empty(); providerName.pop_back()) { providersToRun.push_back({providerName, ModuleProviderLookup::Scoped}); } } result = executeModuleProvidersHelper( productContext, dependsItemLocation, moduleName, providersToRun); } catch (const ErrorInfo &error) { auto ei = error; ei.prepend( Tr::tr("Error executing provider for module '%1':").arg(moduleName.toString()), dependsItemLocation); productContext.handleError(ei); } return result; } ModuleProviderLoader::ModuleProviderResult ModuleProviderLoader::executeModuleProvidersHelper( ProductContext &product, const CodeLocation &dependsItemLocation, const QualifiedId &moduleName, const std::vector &providers) { if (providers.empty()) return {}; QStringList allSearchPaths; ModuleProviderResult result; setupModuleProviderConfig(product); const auto qbsModule = evaluateQbsModule(product); for (const auto &[name, lookupType] : providers) { const auto &[info, fromCache] = findOrCreateProviderInfo( product, dependsItemLocation, moduleName, name, lookupType, qbsModule); if (info.providerFile.isEmpty()) { if (lookupType == ModuleProviderLookup::Named) throw ErrorInfo(Tr::tr("Unknown provider '%1'").arg(name.toString())); continue; } if (fromCache) qCDebug(lcModuleLoader) << "Re-using provider" << name.toString() << "from cache"; result.providerFound = true; if (info.searchPaths.empty()) { qCDebug(lcModuleLoader) << "Module provider did run, but did not set up any modules."; continue; } qCDebug(lcModuleLoader) << "Module provider added" << info.searchPaths.size() << "new search path(s)"; allSearchPaths << info.searchPaths; } if (allSearchPaths.isEmpty()) return result; result.searchPaths = std::move(allSearchPaths); return result; } std::pair ModuleProviderLoader::findOrCreateProviderInfo( ProductContext &product, const CodeLocation &dependsItemLocation, const QualifiedId &moduleName, const QualifiedId &name, ModuleProviderLookup lookupType, const QVariantMap &qbsModule) { QBS_CHECK(product.providerConfig); const QVariantMap config = product.providerConfig->value(name.toString()).toMap(); std::lock_guard lock(m_loaderState.topLevelProject().moduleProvidersCacheLock()); ModuleProvidersCacheKey cacheKey{name.toString(), {}, config, qbsModule, int(lookupType)}; // TODO: get rid of non-eager providers and eliminate following if-logic // first, try to find eager provider (stored with an empty module name) if (ModuleProviderInfo *provider = m_loaderState.topLevelProject().moduleProvider(cacheKey)) return {*provider, true}; // second, try to find non-eager provider for a specific module name std::get<1>(cacheKey) = moduleName.toString(); // override moduleName if (ModuleProviderInfo *provider = m_loaderState.topLevelProject().moduleProvider(cacheKey)) return {*provider, true}; bool isEager = false; ModuleProviderInfo info; info.name = name; info.config = config; info.providerFile = findModuleProviderFile(name, lookupType); if (!info.providerFile.isEmpty()) { qCDebug(lcModuleLoader) << "Running provider" << name << "at" << info.providerFile; std::tie(info.searchPaths, isEager) = evaluateModuleProvider( product, dependsItemLocation, moduleName, name, info.providerFile, config, qbsModule); info.transientOutput = m_loaderState.parameters().dryRun(); } std::get<1>(cacheKey) = isEager ? QString() : moduleName.toString(); return {m_loaderState.topLevelProject().addModuleProvider(cacheKey, info), false}; } void ModuleProviderLoader::setupModuleProviderConfig(ProductContext &product) { if (product.providerConfig) return; QVariantMap providerConfig; const ItemValueConstPtr configItemValue = product.item->itemProperty(StringConstants::moduleProviders(), m_loaderState.itemPool()); if (configItemValue) { const std::function collectMap = [this, &providerConfig, &collectMap](const Item *item, const QualifiedId &name) { const Item::PropertyMap &props = item->properties(); for (auto it = props.begin(); it != props.end(); ++it) { QVariant value; switch (it.value()->type()) { case Value::ItemValueType: { const auto childItem = static_cast(it.value().get())->item(); childItem->setScope(item->scope()); collectMap(childItem, QualifiedId(name) << it.key()); continue; } case Value::JSSourceValueType: { it.value()->setScope(item->scope(), {}); const ScopedJsValue sv(m_loaderState.evaluator().engine()->context(), m_loaderState.evaluator().value(item, it.key())); value = getJsVariant(m_loaderState.evaluator().engine()->context(), sv); break; } case Value::VariantValueType: value = static_cast(it.value().get())->value(); break; } QVariantMap m = providerConfig.value(name.toString()).toMap(); m.insert(it.key(), value); providerConfig.insert(name.toString(), m); } }; configItemValue->item()->setScope(product.item); collectMap(configItemValue->item(), QualifiedId()); } for (auto it = product.moduleProperties.begin(); it != product.moduleProperties.end(); ++it) { if (!it.key().startsWith(QStringLiteral("moduleProviders."))) continue; const QString provider = it.key().mid(QStringLiteral("moduleProviders.").size()); const QVariantMap providerConfigFromBuildConfig = it.value().toMap(); if (providerConfigFromBuildConfig.empty()) continue; QVariantMap currentMapForProvider = providerConfig.value(provider).toMap(); for (auto propIt = providerConfigFromBuildConfig.begin(); propIt != providerConfigFromBuildConfig.end(); ++propIt) { currentMapForProvider.insert(propIt.key(), propIt.value()); } providerConfig.insert(provider, currentMapForProvider); } product.providerConfig = providerConfig; } std::optional> ModuleProviderLoader::getModuleProviders(Item *item) { while (item) { const auto providers = m_loaderState.evaluator().optionalStringListValue( item, StringConstants::qbsModuleProviders()); if (providers) { return transformed>(*providers, [](const auto &provider) { return QualifiedId::fromString(provider); }); } item = item->parent(); } return std::nullopt; } QString ModuleProviderLoader::findModuleProviderFile( const QualifiedId &name, ModuleProviderLookup lookupType) { for (const QString &path : m_loaderState.itemReader().allSearchPaths()) { QString fullPath = FileInfo::resolvePath(path, QStringLiteral("module-providers")); switch (lookupType) { case ModuleProviderLookup::Named: { const auto result = FileInfo::resolvePath(fullPath, name.toString() + QStringLiteral(".qbs")); if (FileInfo::exists(result)) { fullPath = result; break; } [[fallthrough]]; } case ModuleProviderLookup::Scoped: for (const QString &component : name) fullPath = FileInfo::resolvePath(fullPath, component); fullPath = FileInfo::resolvePath(fullPath, QStringLiteral("provider.qbs")); break; } if (!FileInfo::exists(fullPath)) { qCDebug(lcModuleLoader) << "No module provider found at" << fullPath; continue; } return fullPath; } return {}; } QVariantMap ModuleProviderLoader::evaluateQbsModule(ProductContext &product) const { if (product.providerQbsModule) return *product.providerQbsModule; const QString properties[] = { QStringLiteral("sysroot"), QStringLiteral("toolchain"), }; const auto qbsItemValue = std::static_pointer_cast( product.item->property(StringConstants::qbsModule())); QVariantMap result; for (const auto &property : properties) { const ScopedJsValue val(m_loaderState.evaluator().engine()->context(), m_loaderState.evaluator().value(qbsItemValue->item(), property)); auto value = getJsVariant(m_loaderState.evaluator().engine()->context(), val); if (!value.isValid()) continue; // The xcode module sets qbs.sysroot; the resulting value is bogus before the probes // have run. if (property == QLatin1String("sysroot") && !FileInfo::isAbsolute(value.toString())) continue; result[property] = std::move(value); } return *(product.providerQbsModule = result); } Item *ModuleProviderLoader::createProviderScope( const ProductContext &product, const QVariantMap &qbsModule) { const auto qbsItemValue = std::static_pointer_cast( product.item->property(StringConstants::qbsModule())); Item *fakeQbsModule = Item::create(&m_loaderState.itemPool(), ItemType::Scope); for (auto it = qbsModule.begin(), end = qbsModule.end(); it != end; ++it) { fakeQbsModule->setProperty(it.key(), VariantValue::create(it.value())); } Item *scope = Item::create(&m_loaderState.itemPool(), ItemType::Scope); scope->setFile(qbsItemValue->item()->file()); scope->setProperty(StringConstants::qbsModule(), ItemValue::create(fakeQbsModule)); return scope; } ModuleProviderLoader::EvaluationResult ModuleProviderLoader::evaluateModuleProvider( ProductContext &product, const CodeLocation &dependsItemLocation, const QualifiedId &moduleName, const QualifiedId &name, const QString &providerFile, const QVariantMap &moduleConfig, const QVariantMap &qbsModule) { qCDebug(lcModuleLoader) << "Instantiating module provider at" << providerFile; const QString projectBuildDir = product.project->item->variantProperty( StringConstants::buildDirectoryProperty())->value().toString(); const QString searchPathBaseDir = ModuleProviderInfo::outputDirPath(projectBuildDir, name); // include qbs module into hash auto jsConfig = moduleConfig; jsConfig[StringConstants::qbsModule()] = qbsModule; QString outputBaseDir = searchPathBaseDir + QLatin1Char('/') + getConfigHash(jsConfig); Item * const providerItem = m_loaderState.itemReader().setupItemFromFile( providerFile, dependsItemLocation); if (providerItem->type() != ItemType::ModuleProvider) { throw ErrorInfo(Tr::tr("File '%1' declares an item of type '%2', " "but '%3' was expected.") .arg(providerFile, providerItem->typeName(), BuiltinDeclarations::instance().nameForType(ItemType::ModuleProvider))); } Item * const scope = createProviderScope(product, qbsModule); for (auto it = providerItem->properties().begin(); it != providerItem->properties().end(); ++it) it.value()->setScope(scope, {}); providerItem->setProperty( StringConstants::nameProperty(), VariantValue::create(name.toString())); providerItem->setProperty( QStringLiteral("outputBaseDir"), VariantValue::create(outputBaseDir)); providerItem->overrideProperties(moduleConfig, name, m_loaderState.parameters(), m_loaderState.logger()); const bool isEager = m_loaderState.evaluator().boolValue( providerItem, StringConstants::isEagerProperty()); if (!isEager) { providerItem->setProperty( StringConstants::moduleNameProperty(), VariantValue::create(moduleName.toString())); } ProbesResolver(m_loaderState).resolveProbes(product, providerItem); const bool condition = m_loaderState.evaluator().boolValue( providerItem, StringConstants::conditionProperty()); if (!condition) { qCDebug(lcModuleLoader) << "Provider condition is false, skipping"; return {{}, isEager}; } EvalContextSwitcher contextSwitcher( m_loaderState.evaluator().engine(), EvalContext::ModuleProvider); checkPropertyDeclarations(providerItem, m_loaderState); checkAllowedValues(providerItem); auto searchPaths = m_loaderState.evaluator().stringListValue( providerItem, QStringLiteral("relativeSearchPaths")); auto prependBaseDir = [&outputBaseDir](const auto &path) { return QString(outputBaseDir + QLatin1Char('/') + path); }; std::transform(searchPaths.begin(), searchPaths.end(), searchPaths.begin(), prependBaseDir); return {searchPaths, isEager}; } void ModuleProviderLoader::checkAllowedValues(Item *providerItem) { for (const auto &propertyDeclaration : providerItem->propertyDeclarations()) { if (!propertyDeclaration.shouldCheckAllowedValues()) continue; const auto &name = propertyDeclaration.name(); if (name == QStringLiteral("relativeSearchPaths")) continue; const auto value = m_loaderState.evaluator().variantValue(providerItem, name); const auto propertyValue = providerItem->property(name); propertyDeclaration.checkAllowedValues( value, propertyValue->location(), name, m_loaderState); } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/loader/probesresolver.h0000644000175100017510000000647415154533055022164 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2022 The Qt Company Ltd. ** Copyright (C) 2022 Raphaël Cotty ** 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 PROBESRESOLVER_H #define PROBESRESOLVER_H #include #include #include namespace qbs::Internal { class Item; class LoaderState; class ProductContext; class ProbesResolver { public: explicit ProbesResolver(LoaderState &loaderState); void resolveProbes(ProductContext &productContext, Item *item); private: ProbeConstPtr findOldProjectProbe(const QString &globalId, bool condition, const QVariantMap &initialProperties, const QString &sourceCode) const; ProbeConstPtr findOldProductProbe(const QString &productName, bool condition, const QVariantMap &initialProperties, const QString &sourceCode) const; ProbeConstPtr findCurrentProbe(const CodeLocation &location, bool condition, const QVariantMap &initialProperties) const; enum class CompareScript { No, Yes }; bool probeMatches(const ProbeConstPtr &probe, bool condition, const QVariantMap &initialProperties, const QString &configureScript, CompareScript compareScript) const; void resolveProbe(ProductContext &productContext, Item *parent, Item *probe); LoaderState &m_loaderState; }; } // namespace qbs::Internal #endif // PROBESRESOLVER_H qbs-src-3.2.0/src/lib/corelib/loader/productsresolver.cpp0000644000175100017510000006355715154533055023075 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #include "productsresolver.h" #include "itemreader.h" #include "loaderutils.h" #include "productresolver.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs::Internal { namespace { struct ThreadInfo { ThreadInfo(std::future &&future, LoaderState &loaderState) : future(std::move(future)), loaderState(loaderState) {} std::future future; LoaderState &loaderState; bool done = false; }; struct ProductWithLoaderState { ProductWithLoaderState(ProductContext &product, LoaderState *loaderState) : product(&product), loaderState(loaderState) {} ProductContext * const product; LoaderState *loaderState; }; class ThreadsLocker { public: ThreadsLocker(std::launch mode, std::mutex &mutex) { if (mode == std::launch::async) lock = std::make_unique>(mutex); } std::unique_ptr> lock; }; } // namespace class ProductsResolver { public: ProductsResolver(LoaderState &loaderState) : m_loaderState(loaderState) {} void resolve(); private: void initialize(); void initializeProductQueue(); void initializeLoaderStatePool(); void runScheduler(); void scheduleNext(); bool tryToReserveLoaderState(ProductWithLoaderState &product, Deferral deferral); std::optional> unblockProductWaitingForLoaderState(LoaderState &loaderState); void startJob(const ProductWithLoaderState &product, Deferral deferral); void checkForCancelation(); void handleFinishedThreads(); void queueProductForScheduling(const ProductWithLoaderState &product, Deferral deferral); void waitForSingleDependency(const ProductWithLoaderState &product, ProductContext &dependency); void waitForBulkDependency(const ProductWithLoaderState &product); void unblockProductsWaitingForDependency(ProductContext &finishedProduct); void postProcess(); void checkForMissedBulkDependencies(const ProductContext &product); static int dependsItemCount(const Item *item); static int dependsItemCount(ProductContext &product); LoaderState &m_loaderState; std::queue> m_productsToSchedule; std::vector m_finishedProducts; std::unordered_map> m_waitingForSingleDependency; std::vector m_waitingForBulkDependency; std::unordered_map>> m_waitingForLoaderState; std::unordered_map m_runningThreads; std::mutex m_threadsMutex; std::condition_variable m_threadsNotifier; std::vector> m_enginePool; std::vector> m_loaderStatePool; std::vector m_availableLoaderStates; std::mutex m_cancelingMutex; std::launch m_asyncMode = std::launch::async; int m_maxJobCount = m_loaderState.parameters().maxJobCount(); bool m_canceling = false; }; void resolveProducts(LoaderState &loaderState) { ProductsResolver(loaderState).resolve(); } void ProductsResolver::resolve() { initialize(); try { runScheduler(); } catch (const ErrorInfo &e) { for (auto &thread : m_runningThreads) thread.second.future.wait(); throw e; } postProcess(); } void ProductsResolver::initialize() { initializeProductQueue(); initializeLoaderStatePool(); } void ProductsResolver::initializeProductQueue() { TopLevelProjectContext &topLevelProject = m_loaderState.topLevelProject(); std::vector sortedProducts; for (ProjectContext * const projectContext : topLevelProject.projects()) { for (ProductContext &product : projectContext->products) { topLevelProject.addProductToHandle(product); const auto it = std::lower_bound(sortedProducts.begin(), sortedProducts.end(), product, [&product](ProductContext *p1, const ProductContext &) { return dependsItemCount(*p1) < dependsItemCount(product); }); sortedProducts.insert(it, &product); } } for (ProductContext * const product : sortedProducts) { queueProductForScheduling(ProductWithLoaderState(*product, nullptr), Deferral::Allowed); if (product->shadowProduct) { topLevelProject.addProductToHandle(*product->shadowProduct); queueProductForScheduling(ProductWithLoaderState(*product->shadowProduct, nullptr), Deferral::Allowed); } } } void ProductsResolver::initializeLoaderStatePool() { TopLevelProjectContext &topLevelProject = m_loaderState.topLevelProject(); // Adapt max job count: It makes no sense to have it be higher than the number of products // or what can actually be run concurrently. In both cases, we would simply waste resources. const int maxConcurrency = std::thread::hardware_concurrency(); if (maxConcurrency > 0 && maxConcurrency < m_maxJobCount) m_maxJobCount = maxConcurrency; if (m_maxJobCount > topLevelProject.productsToHandleCount()) m_maxJobCount = topLevelProject.productsToHandleCount(); // The number of engines and loader states we need to allocate here is one less than the // total number of concurrent jobs, as we already have one loader state that we can re-use. if (m_maxJobCount > 1) m_enginePool.reserve(m_maxJobCount - 1); m_loaderStatePool.reserve(m_enginePool.size()); m_availableLoaderStates.reserve(m_enginePool.size() + 1); m_availableLoaderStates.push_back(&m_loaderState); m_loaderState.evaluator().engine()->setSetupProjectParameters(m_loaderState.parameters()); for (std::size_t i = 0; i < m_enginePool.capacity(); ++i) { ScriptEngine &engine = *m_enginePool.emplace_back( ScriptEngine::create(m_loaderState.logger(), EvalContext::PropertyEvaluation)); ItemPool &itemPool = topLevelProject.createItemPool(); engine.setEnvironment(m_loaderState.parameters().adjustedEnvironment()); auto loaderState = std::make_unique( m_loaderState.parameters(), topLevelProject, itemPool, engine, m_loaderState.logger()); loaderState->evaluator().engine()->setSetupProjectParameters(m_loaderState.parameters()); m_loaderStatePool.push_back(std::move(loaderState)); m_availableLoaderStates.push_back(m_loaderStatePool.back().get()); if (topLevelProject.progressObserver()) topLevelProject.progressObserver()->addScriptEngine(m_enginePool.back().get()); } qCDebug(lcLoaderScheduling) << "using" << m_availableLoaderStates.size() << "loader states"; if (int(m_availableLoaderStates.size()) == 1) m_asyncMode = std::launch::deferred; } void ProductsResolver::runScheduler() { AccumulatingTimer timer(m_loaderState.parameters().logElapsedTime() ? &m_loaderState.topLevelProject().timingData().resolvingProducts : nullptr); ThreadsLocker threadsLock(m_asyncMode, m_threadsMutex); while (true) { scheduleNext(); if (m_runningThreads.empty()) break; if (m_asyncMode == std::launch::async) { qCDebug(lcLoaderScheduling()) << "scheduling paused, waiting for threads to finish"; m_threadsNotifier.wait(*threadsLock.lock); } checkForCancelation(); handleFinishedThreads(); } QBS_CHECK(m_productsToSchedule.empty()); QBS_CHECK(m_loaderState.topLevelProject().productsToHandleCount() == 0); QBS_CHECK(m_runningThreads.empty()); QBS_CHECK(m_waitingForSingleDependency.empty()); QBS_CHECK(m_waitingForBulkDependency.empty()); } void ProductsResolver::scheduleNext() { TopLevelProjectContext &topLevelProject = m_loaderState.topLevelProject(); AccumulatingTimer timer(m_loaderState.parameters().logElapsedTime() ? &topLevelProject.timingData().schedulingProducts : nullptr); while (m_maxJobCount > int(m_runningThreads.size()) && !m_productsToSchedule.empty()) { auto [product, toHandleCountOnInsert] = m_productsToSchedule.front(); m_productsToSchedule.pop(); qCDebug(lcLoaderScheduling) << "potentially scheduling product" << product.product->displayName() << "unhandled product count on queue insertion" << toHandleCountOnInsert << "current unhandled product count" << topLevelProject.productsToHandleCount(); // If the number of unfinished products has shrunk since the last time we tried handling // this product, there has been forward progress and we can allow a deferral. const Deferral deferral = toHandleCountOnInsert == -1 || toHandleCountOnInsert > topLevelProject.productsToHandleCount() ? Deferral::Allowed : Deferral::NotAllowed; if (!tryToReserveLoaderState(product, deferral)) continue; startJob(product, deferral); } // There are jobs running, so forward progress is still possible. if (!m_runningThreads.empty()) return; QBS_CHECK(m_productsToSchedule.empty()); // If we end up here, nothing was scheduled in the loop above, which means that either ... // a) ... we are done or // b) ... we finally need to schedule our bulk dependencies or // c) ... we need to schedule products waiting for an unhandled dependency. // In the latter case, the project has at least one dependency cycle, and the // DependencyResolver will emit an error. // a) if (m_waitingForBulkDependency.empty() && m_waitingForSingleDependency.empty()) return; // b) for (const ProductWithLoaderState &product : m_waitingForBulkDependency) queueProductForScheduling(product, Deferral::NotAllowed); if (!m_productsToSchedule.empty()) { m_waitingForBulkDependency.clear(); scheduleNext(); return; } // c) for (const auto &e : m_waitingForSingleDependency) { for (const ProductWithLoaderState &p : e.second) queueProductForScheduling(p, Deferral::NotAllowed); } QBS_CHECK(!m_productsToSchedule.empty()); scheduleNext(); } bool ProductsResolver::tryToReserveLoaderState(ProductWithLoaderState &product, Deferral deferral) { QBS_CHECK(!m_availableLoaderStates.empty()); if (!product.loaderState) { product.loaderState = m_availableLoaderStates.back(); m_availableLoaderStates.pop_back(); return true; } if (const auto it = std::find(m_availableLoaderStates.begin(), m_availableLoaderStates.end(), product.loaderState); it != m_availableLoaderStates.end()) { m_availableLoaderStates.erase(it); return true; } qCDebug(lcLoaderScheduling) << "loader state" << product.loaderState << " for product" << product.product->displayName() << "not available, adding product to wait queue"; m_waitingForLoaderState[product.loaderState].push({product.product, deferral}); return false; } std::optional> ProductsResolver::unblockProductWaitingForLoaderState(LoaderState &loaderState) { auto &waitingForLoaderState = m_waitingForLoaderState[&loaderState]; if (waitingForLoaderState.empty()) return {}; const auto product = waitingForLoaderState.front(); waitingForLoaderState.pop(); qCDebug(lcLoaderScheduling) << "loader state" << &loaderState << "now available for product" << product.first->displayName(); return product; } void ProductsResolver::startJob(const ProductWithLoaderState &product, Deferral deferral) { QBS_CHECK(product.loaderState); qCDebug(lcLoaderScheduling) << "scheduling product" << product.product->displayName() << "with loader state" << product.loaderState << "and deferral mode" << int(deferral); try { const auto it = m_runningThreads.emplace(product.product, ThreadInfo(std::async(m_asyncMode, [this, product, deferral] { product.loaderState->itemReader().setExtraSearchPathsStack( product.product->project->searchPathsStack); resolveProduct(*product.product, deferral, *product.loaderState); // The search paths stack can change during dependency resolution // (due to module providers); check that we've rolled back all the changes QBS_CHECK(product.loaderState->itemReader().extraSearchPathsStack() == product.product->project->searchPathsStack); std::lock_guard cancelingLock(m_cancelingMutex); if (m_canceling) return; ThreadsLocker threadsLock(m_asyncMode, m_threadsMutex); if (const auto it = m_runningThreads.find(product.product); it != m_runningThreads.end()) { it->second.done = true; qCDebug(lcLoaderScheduling) << "thread for product" << product.product->displayName() << "finished, waking up scheduler"; m_threadsNotifier.notify_one(); } }), *product.loaderState)); // With just one worker thread, the notify/wait overhead would be excessive, so // we run the task synchronously. if (m_asyncMode == std::launch::deferred) { qCDebug(lcLoaderScheduling) << "blocking on product thread immediately"; it.first->second.future.wait(); } } catch (const std::system_error &e) { if (e.code() != std::errc::resource_unavailable_try_again) throw e; qCWarning(lcLoaderScheduling) << "failed to create thread"; if (m_maxJobCount >= 2) { m_maxJobCount /= 2; qCWarning(lcLoaderScheduling) << "throttling down to" << m_maxJobCount << "jobs"; } queueProductForScheduling(product, deferral); m_availableLoaderStates.push_back(product.loaderState); } } void ProductsResolver::checkForCancelation() { if (m_loaderState.topLevelProject().isCanceled()) { m_cancelingMutex.lock(); m_canceling = true; m_cancelingMutex.unlock(); for (auto &thread : m_runningThreads) thread.second.future.wait(); throw CancelException(); } } void ProductsResolver::handleFinishedThreads() { TopLevelProjectContext &topLevelProject = m_loaderState.topLevelProject(); AccumulatingTimer timer(m_loaderState.parameters().logElapsedTime() ? &topLevelProject.timingData().schedulingProducts : nullptr); std::vector> productsToScheduleDirectly; for (auto it = m_runningThreads.begin(); it != m_runningThreads.end();) { ThreadInfo &ti = it->second; if (!ti.done) { ++it; continue; } ti.future.wait(); ProductContext &product = *it->first; LoaderState &loaderState = ti.loaderState; it = m_runningThreads.erase(it); qCDebug(lcLoaderScheduling) << "handling finished thread for product" << product.displayName() << "current unhandled product count is" << topLevelProject.productsToHandleCount(); // If there are products waiting for the loader state used in the finished thread, // we can start a job for one of them right away (but not in the loop, // because startJob() modifies the thread list we are currently iterating over). if (const auto productInfo = unblockProductWaitingForLoaderState(loaderState)) { productsToScheduleDirectly.emplace_back( ProductWithLoaderState(*productInfo->first, &loaderState), productInfo->second); } else { qCDebug(lcLoaderScheduling) << "making loader state" << &loaderState << "available again"; m_availableLoaderStates.push_back(&loaderState); } // If we encountered a dependency to an in-progress product or to a bulk dependency, // we defer handling this product. if (product.dependenciesResolvingPending()) { qCDebug(lcLoaderScheduling) << "dependencies resolving not finished for product" << product.displayName(); const auto pending = product.pendingDependency(); switch (pending.first) { case ProductDependencyType::Single: waitForSingleDependency(ProductWithLoaderState(product, &loaderState), *pending.second); break; case ProductDependencyType::Bulk: waitForBulkDependency(ProductWithLoaderState(product, &loaderState)); break; case ProductDependencyType::None: // This can happen if the dependency has finished in between the check in // DependencyResolver and the one here. QBS_CHECK(pending.second); queueProductForScheduling(ProductWithLoaderState(product, &loaderState), Deferral::Allowed); break; } topLevelProject.incProductDeferrals(); } else { qCDebug(lcLoaderScheduling) << "product" << product.displayName() << "finished"; topLevelProject.removeProductToHandle(product); if (!product.name.startsWith(StringConstants::shadowProductPrefix())) m_finishedProducts.push_back(&product); topLevelProject.timingData() += product.timingData; checkForMissedBulkDependencies(product); topLevelProject.registerBulkDependencies(product); unblockProductsWaitingForDependency(product); } } for (const auto &productInfo : productsToScheduleDirectly) startJob(productInfo.first, productInfo.second); } void ProductsResolver::queueProductForScheduling(const ProductWithLoaderState &product, Deferral deferral) { qCDebug(lcLoaderScheduling) << "queueing product" << product.product->displayName() << "with deferral mode" << int(deferral); m_productsToSchedule.emplace(product, deferral == Deferral::Allowed ? -1 : m_loaderState.topLevelProject().productsToHandleCount()); } void ProductsResolver::waitForSingleDependency(const ProductWithLoaderState &product, ProductContext &dependency) { qCDebug(lcLoaderScheduling) << "product" << product.product->displayName() << "now waiting for single dependency" << dependency.displayName(); m_waitingForSingleDependency[&dependency].push_back(product); } void ProductsResolver::waitForBulkDependency(const ProductWithLoaderState &product) { qCDebug(lcLoaderScheduling) << "product" << product.product->displayName() << "now waiting for bulk dependency"; m_waitingForBulkDependency.push_back(product); } void ProductsResolver::unblockProductsWaitingForDependency(ProductContext &finishedProduct) { const auto it = m_waitingForSingleDependency.find(&finishedProduct); if (it == m_waitingForSingleDependency.end()) return; qCDebug(lcLoaderScheduling) << "unblocking all products waiting for now-finished product" << finishedProduct.displayName(); for (const ProductWithLoaderState &p : it->second) { qCDebug(lcLoaderScheduling) << " unblocking product" << p.product->displayName(); queueProductForScheduling(p, Deferral::Allowed); } m_waitingForSingleDependency.erase(it); } void ProductsResolver::postProcess() { for (ProductContext * const product : m_finishedProducts) { if (product->product) product->product->project->products.push_back(product->product); // This has to be done in post-processing, because we need both product and shadow product // to be ready, and contrary to what one might assume, there is no proper ordering // between them regarding dependency resolving. setupExports(*product, m_loaderState); } for (const auto &engine : m_enginePool) m_loaderState.topLevelProject().collectDataFromEngine(*engine); QBS_CHECK(!m_loaderState.topLevelProject().projects().empty()); const auto project = std::dynamic_pointer_cast( m_loaderState.topLevelProject().projects().front()->project); QBS_CHECK(project); for (LoaderState * const loaderState : m_availableLoaderStates) { project->warningsEncountered << loaderState->logger().warnings(); project->errorsEncountered << loaderState->logger().errors(); if (loaderState == &m_loaderState) { project->warningsEncountered << loaderState->evaluator().engine()->logger().warnings(); project->errorsEncountered << loaderState->evaluator().engine()->logger().errors(); } } } void ProductsResolver::checkForMissedBulkDependencies(const ProductContext &product) { if (!product.product || !product.product->enabled || !product.bulkDependencies.empty()) return; for (const FileTag &tag : product.product->fileTags) { for (const auto &[p, location] : m_loaderState.topLevelProject().finishedProductsWithBulkDependency(tag)) { if (!p->product->enabled) continue; if (p->name == product.name) continue; ErrorInfo e; e.append(Tr::tr("Cyclic dependencies detected:")); e.append(Tr::tr("First product is '%1'.") .arg(product.displayName()), product.item->location()); e.append(Tr::tr("Second product is '%1'.") .arg(p->displayName()), p->item->location()); e.append(Tr::tr("Dependency from %1 to %2 was established via Depends.productTypes.") .arg(p->displayName(), product.displayName()), location); if (m_loaderState.parameters().productErrorMode() == ErrorHandlingMode::Strict) throw e; m_loaderState.logger().printError(e); m_loaderState.logger().printError(ErrorInfo( Tr::tr("Product '%1' had errors and was disabled.").arg(product.displayName()), product.item->location())); m_loaderState.logger().printError(ErrorInfo( Tr::tr("Product '%1' had errors and was disabled.").arg(p->displayName()), p->item->location())); product.product->enabled = false; p->product->enabled = false; } } } int ProductsResolver::dependsItemCount(const Item *item) { int count = 0; for (const Item * const child : item->children()) { if (child->type() == ItemType::Depends) ++count; } return count; } int ProductsResolver::dependsItemCount(ProductContext &product) { if (product.dependsItemCount == -1) product.dependsItemCount = dependsItemCount(product.item); return product.dependsItemCount; } } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/dependenciesresolver.h0000644000175100017510000000507215154533055023311 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once namespace qbs::Internal { class Item; class LoaderState; class ProductContext; enum class Deferral; // Collects the products' dependencies and builds the list of modules from them. // Actual loading of module files is offloaded to ModuleLoader. void resolveDependencies(ProductContext &product, Deferral deferral, LoaderState &loaderState); // Note: This function is never called for regular loading of the base module into a product, // but only for the special cases of loading the dummy base module into a project // and temporarily providing a base module for product multiplexing. Item *loadBaseModule(ProductContext &product, Item *item, LoaderState &loaderState); } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/modulepropertymerger.h0000644000175100017510000001034115154533055023370 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once #include QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE namespace qbs::Internal { class Item; class LoaderState; class ProductContext; // This module comprises functions for collecting values attached to module properties // in different contexts. // For example, in the Qt.core module you will find a property binding such as this: // cpp.defines: "QT_CORE_LIB" // while in the Qt.widgets module, it will look like this: // cpp.defines: "QT_WIDGETS_LIB" // A product with a dependency on both these modules will end up with a value of // ["QT_WIDGETS_LIB", "QT_CORE_LIB"], plus potentially other defines set elsewhere. // Each of these values is assigned a priority that roughly corresponds to the "level" at which // the module containing the property binding resides in the dependency hierarchy. // For list properties, the priorities determine the order of the respecive values in the // final array, for scalar values they determine which one survives. Different scalar values // with the same priority trigger a warning message. // Since the right-hand side of a binding can refer to properties of the surrounding context, // each such value gets its own scope. // This function is called when a module is loaded via a Depends item. // loadingItem is the product or module containing the Depends item. // loadingName is the name of that module. It is used as a tie-breaker for list property values // with equal priority. // localInstance is the module instance placeholder in the ItemValue of a property binding, // i.e. the "cpp" in "cpp.defines". // globalInstance is the actual module into which the properties from localInstance get merged. void mergeFromLocalInstance(ProductContext &product, Item *loadingItem, const QString &loadingName, const Item *localInstance, Item *globalInstance, LoaderState &loaderState); // This function is called after all dependencies have been resolved. It uses its global // knowledge of module priorities to potentially adjust the order of list values or // favor different scalar values. It can also remove previously merged-in values again; // this can happen if a module fails to load after it already merged some values, or // if it fails validation in the end. void doFinalMerge(ProductContext &product, LoaderState &loaderState); } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/modulepropertymerger.cpp0000644000175100017510000002753515154533055023740 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #include "modulepropertymerger.h" #include "loaderutils.h" #include #include #include #include #include #include #include #include #include namespace qbs::Internal { class ModulePropertyMerger { public: ModulePropertyMerger(ProductContext &product, LoaderState &loaderState) : m_product(product), m_loaderState(loaderState) {} void mergeFromLocalInstance(Item *loadingItem, const QString &loadingName, const Item *localInstance, Item *globalInstance); void doFinalMerge(); private: int compareValuePriorities(const ValueConstPtr &v1, const ValueConstPtr &v2); void mergePropertyFromLocalInstance(Item *loadingItem, const QString &loadingName, Item *globalInstance, const QString &name, const ValuePtr &value); bool doFinalMerge(Item *moduleItem); bool doFinalMerge(const PropertyDeclaration &propertyDecl, ValuePtr &propertyValue); void finalizeCandidates(const ValuePtr &value); ProductContext & m_product; LoaderState &m_loaderState; }; void mergeFromLocalInstance(ProductContext &product, Item *loadingItem, const QString &loadingName, const Item *localInstance, Item *globalInstance, LoaderState &loaderState) { ModulePropertyMerger(product, loaderState).mergeFromLocalInstance( loadingItem, loadingName, localInstance, globalInstance); } void doFinalMerge(ProductContext &product, LoaderState &loaderState) { ModulePropertyMerger(product, loaderState).doFinalMerge(); } void ModulePropertyMerger::mergeFromLocalInstance(Item *loadingItem, const QString &loadingName, const Item *localInstance, Item *globalInstance) { AccumulatingTimer t(m_loaderState.parameters().logElapsedTime() ? &m_product.timingData.propertyMerging : nullptr); for (auto it = localInstance->properties().constBegin(); it != localInstance->properties().constEnd(); ++it) { mergePropertyFromLocalInstance(loadingItem, loadingName, globalInstance, it.key(), it.value()); } } void ModulePropertyMerger::doFinalMerge() { AccumulatingTimer t(m_loaderState.parameters().logElapsedTime() ? &m_product.timingData.propertyMerging : nullptr); std::unordered_set itemsToInvalidate; for (const Item::Module &module : m_product.item->modules()) { if (doFinalMerge(module.item)) itemsToInvalidate.insert(module.item); } // For each module item, if it requires invalidation, we also add modules that depend on // that module item, all the way up to the Product item. std::unordered_set visitedItems; const auto collectDependentItems = [&itemsToInvalidate, &visitedItems](const Item *item, const auto &collect) -> bool { const bool alreadyInSet = itemsToInvalidate.count(item); if (!visitedItems.insert(item).second) // item handled already return alreadyInSet; bool addItem = false; for (const Item::Module &m : item->modules()) { if (collect(m.item, collect)) addItem = true; } if (addItem && !alreadyInSet) itemsToInvalidate.insert(item); return addItem || alreadyInSet; }; collectDependentItems(m_product.item, collectDependentItems); for (const Item * const item : itemsToInvalidate) m_loaderState.evaluator().clearCache(item); } int ModulePropertyMerger::compareValuePriorities(const ValueConstPtr &v1, const ValueConstPtr &v2) { QBS_CHECK(v1); QBS_CHECK(v2); QBS_CHECK(v1 != v2); QBS_CHECK(v1->scope() != v2->scope()); QBS_CHECK(v1->type() == Value::JSSourceValueType || v2->type() == Value::JSSourceValueType); const int prio1 = v1->priority(m_product.item); const int prio2 = v2->priority(m_product.item); if (prio1 != prio2) return prio1 - prio2; const int prioDiff = v1->scopeName().compare(v2->scopeName()); // Sic! See 8ff1dd0044 QBS_CHECK(prioDiff != 0); return prioDiff; } void ModulePropertyMerger::mergePropertyFromLocalInstance( Item *loadingItem, const QString &loadingName, Item *globalInstance, const QString &name, const ValuePtr &value) { if (loadingItem->type() == ItemType::Project) { throw ErrorInfo(Tr::tr("Module properties cannot be set in Project items."), value->location()); } const PropertyDeclaration decl = globalInstance->propertyDeclaration(name); if (!decl.isValid()) { if (value->type() == Value::ItemValueType || value->createdByPropertiesBlock()) return; throw ErrorInfo(Tr::tr("Property '%1' is not declared.") .arg(name), value->location()); } if (const ErrorInfo error = decl.checkForDeprecation( m_loaderState.parameters().deprecationWarningMode(), value->location(), m_loaderState.logger()); error.hasError()) { handlePropertyError(error, m_loaderState.parameters(), m_loaderState.logger()); return; } if (value->setInternally()) { // E.g. qbs.architecture after multiplexing. globalInstance->setProperty(decl.name(), value); return; } QBS_CHECK(value->type() != Value::ItemValueType); const ValuePtr globalVal = globalInstance->ownProperty(decl.name()); value->setScope(loadingItem, loadingName); QBS_CHECK(globalVal); // Values set internally cannot be overridden by JS values. // The same goes for values set on the command line. // Note that in both cases, there is no merging for list properties: The override is absolute. if (globalVal->setInternally() || globalVal->setByCommandLine()) return; QBS_CHECK(value->type() == Value::JSSourceValueType); QBS_CHECK(!globalVal->expired(m_product.item)); QBS_CHECK(!value->expired(m_product.item)); if (compareValuePriorities(globalVal, value) < 0) { value->setCandidates(globalVal->candidates()); globalVal->setCandidates({}); value->addCandidate(globalVal); globalInstance->setProperty(decl.name(), value); } else { globalVal->addCandidate(value); } } bool ModulePropertyMerger::doFinalMerge(Item *moduleItem) { if (!moduleItem->isPresentModule()) return false; bool mustInvalidateCache = false; for (auto it = moduleItem->properties().begin(); it != moduleItem->properties().end(); ++it) { if (doFinalMerge(moduleItem->propertyDeclaration(it.key()), it.value())) mustInvalidateCache = true; } return mustInvalidateCache; } bool ModulePropertyMerger::doFinalMerge(const PropertyDeclaration &propertyDecl, ValuePtr &propertyValue) { if (propertyValue->type() == Value::VariantValueType) return false; if (!propertyDecl.isValid()) return false; // Caught later by dedicated checker. propertyValue->resetPriority(); if (propertyValue->candidates().empty()) return false; std::pair> candidatesWithHighestPrio; candidatesWithHighestPrio.first = propertyValue->priority(m_product.item); candidatesWithHighestPrio.second.push_back(propertyValue); for (const ValuePtr &v : propertyValue->candidates()) { const int prio = v->priority(m_product.item); if (prio < candidatesWithHighestPrio.first) continue; if (prio > candidatesWithHighestPrio.first) { candidatesWithHighestPrio.first = prio; candidatesWithHighestPrio.second = {v}; continue; } candidatesWithHighestPrio.second.push_back(v); } ValuePtr chosenValue = candidatesWithHighestPrio.second.front(); if (propertyDecl.isScalar() && int(candidatesWithHighestPrio.second.size()) > 1) { ErrorInfo error( Tr::tr("Conflicting scalar values for property '%1'.").arg(propertyDecl.name())); error.append({}, chosenValue->location()); QBS_CHECK(chosenValue->type() == Value::JSSourceValueType); QStringView sourcCode = static_cast(chosenValue.get())->sourceCode(); for (int i = 1; i < int(candidatesWithHighestPrio.second.size()); ++i) { const ValuePtr &v = candidatesWithHighestPrio.second.at(i); QBS_CHECK(v->type() == Value::JSSourceValueType); // Note that this is a bit silly: The source code could still evaluate to // different values in the end. if (static_cast(v.get())->sourceCode() != sourcCode) error.append({}, v->location()); } if (error.items().size() > 2) m_loaderState.logger().printWarning(error); } if (propertyValue == chosenValue) { const std::vector oldCandidates = propertyValue->candidates(); finalizeCandidates(propertyValue); return oldCandidates != propertyValue->candidates(); } std::vector candidates = propertyValue->candidates(); candidates.erase(std::find(candidates.begin(), candidates.end(), chosenValue)); chosenValue->setCandidates(candidates); chosenValue->addCandidate(propertyValue); propertyValue->setCandidates({}); propertyValue = chosenValue; finalizeCandidates(propertyValue); return true; } void ModulePropertyMerger::finalizeCandidates(const ValuePtr &value) { value->removeExpiredCandidates(m_product.item); value->sortCandidates([this](const ValuePtr &v1, const ValuePtr &v2) { // https://stackoverflow.com/questions/38966516/should-sorting-algorithm-pass-same-element-in-the-comparison-function if (v1 == v2) return false; return compareValuePriorities(v1, v2) > 0; }); } } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/moduleloader.cpp0000644000175100017510000004355315154533055022116 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #include "moduleloader.h" #include "itemreader.h" #include "loaderutils.h" #include "moduleproviderloader.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs::Internal { class ModuleLoader { public: ModuleLoader( LoaderState &loaderState, ProductContext &product, const CodeLocation &dependsItemLocation, const QualifiedId &moduleName, const VersionRange &requiredVersion) : m_loaderState(loaderState) , m_product(product) , m_dependsItemLocation(dependsItemLocation) , m_moduleName(moduleName) , m_requiredVersion(requiredVersion) {} Item *load(); private: std::pair loadModuleFile(const QString &moduleName, const QString &filePath); Item *getModulePrototype(const QString &moduleName, const QString &filePath); Item *createAndInitModuleItem(const QString &moduleName, const QString &filePath); bool evaluateModuleCondition(Item *module, const QString &fullModuleName); void checkForUnknownProfileProperties(const Item *module); QString findModuleDirectory(const QString &searchPath); QStringList findModuleDirectories(); QStringList getModuleFilePaths(const QString &dir); LoaderState &m_loaderState; ProductContext &m_product; const CodeLocation &m_dependsItemLocation; const QualifiedId &m_moduleName; const VersionRange &m_requiredVersion; }; struct PrioritizedItem { PrioritizedItem(Item *item, int priority, int searchPathIndex) : item(item), priority(priority), searchPathIndex(searchPathIndex) { } Item * const item; int priority = 0; const int searchPathIndex; bool fulfillsVersionRequirement = true; }; static Item *chooseModuleCandidate(const std::vector &candidates, const QString &moduleName) { auto maxIt = std::max_element( candidates.begin(), candidates.end(), [](const PrioritizedItem &a, const PrioritizedItem &b) { if (a.fulfillsVersionRequirement != b.fulfillsVersionRequirement) return b.fulfillsVersionRequirement; if (a.priority < b.priority) return true; if (a.priority > b.priority) return false; return a.searchPathIndex > b.searchPathIndex; }); size_t nmax = std::count_if( candidates.begin(), candidates.end(), [maxIt](const PrioritizedItem &i) { return i.priority == maxIt->priority && i.searchPathIndex == maxIt->searchPathIndex && i.fulfillsVersionRequirement == maxIt->fulfillsVersionRequirement; }); if (nmax > 1) { ErrorInfo e(Tr::tr("There is more than one equally prioritized candidate for module '%1'.") .arg(moduleName)); for (size_t i = 0; i < candidates.size(); ++i) { const auto candidate = candidates.at(i); if (candidate.priority == maxIt->priority) { //: The %1 denotes the number of the candidate. e.append(Tr::tr("candidate %1").arg(i + 1), candidates.at(i).item->location()); } } throw e; } return maxIt->item; } Item *searchAndLoadModuleFile( LoaderState &loaderState, ProductContext &product, const CodeLocation &dependsItemLocation, const QualifiedId &moduleName, const VersionRange &requiredVersion) { return ModuleLoader(loaderState, product, dependsItemLocation, moduleName, requiredVersion) .load(); } Item *ModuleLoader::load() { SearchPathsManager searchPathsManager(m_loaderState.itemReader()); QStringList existingPaths = findModuleDirectories(); if (existingPaths.isEmpty()) { // no suitable names found, try to use providers AccumulatingTimer providersTimer(m_loaderState.parameters().logElapsedTime() ? &m_product.timingData.moduleProviders : nullptr); auto result = ModuleProviderLoader(m_loaderState) .executeModuleProviders(m_product, m_dependsItemLocation, m_moduleName); if (result.searchPaths) { qCDebug(lcModuleLoader) << "Re-checking for module" << m_moduleName.toString() << "with newly added search paths from module provider"; m_loaderState.itemReader().pushExtraSearchPaths(*result.searchPaths); existingPaths = findModuleDirectories(); } } const QString fullName = m_moduleName.toString(); bool triedToLoadModule = false; std::vector candidates; candidates.reserve(size_t(existingPaths.size())); for (int i = 0; i < existingPaths.size(); ++i) { const QStringList &moduleFileNames = getModuleFilePaths(existingPaths.at(i)); for (const QString &filePath : moduleFileNames) { const auto [module, triedToLoad] = loadModuleFile(fullName, filePath); if (module) candidates.emplace_back(module, 0, i); if (!triedToLoad) m_loaderState.topLevelProject().removeModuleFileFromDirectoryCache(filePath); triedToLoadModule = triedToLoadModule || triedToLoad; } } if (candidates.empty()) return nullptr; Item *moduleItem = nullptr; if (candidates.size() == 1) { moduleItem = candidates.at(0).item; } else { const bool needsVersionCheck = m_requiredVersion.minimum.isValid() || m_requiredVersion.maximum.isValid(); for (auto &candidate : candidates) { ModuleItemLocker lock(*candidate.item); candidate.priority = m_loaderState.evaluator() .intValue(candidate.item, StringConstants::priorityProperty(), candidate.priority); if (needsVersionCheck) { const auto version = Version::fromString(m_loaderState.evaluator().stringValue( candidate.item, StringConstants::versionProperty())); candidate.fulfillsVersionRequirement = (!m_requiredVersion.minimum.isValid() || version >= m_requiredVersion.minimum) && (!m_requiredVersion.maximum.isValid() || version < m_requiredVersion.maximum); } } moduleItem = chooseModuleCandidate(candidates, fullName); } checkForUnknownProfileProperties(moduleItem); return moduleItem; } std::pair ModuleLoader::loadModuleFile(const QString &moduleName, const QString &filePath) { qCDebug(lcModuleLoader) << "loadModuleFile" << moduleName << "from" << filePath; Item * const module = getModulePrototype(moduleName, filePath); if (!module) return {nullptr, false}; const auto it = m_product.modulePrototypeEnabledInfo.find(module); if (it != m_product.modulePrototypeEnabledInfo.end()) { qCDebug(lcModuleLoader) << "prototype cache hit (level 2)"; return {it->second ? module : nullptr, true}; } if (!evaluateModuleCondition(module, moduleName)) { qCDebug(lcModuleLoader) << "condition of module" << moduleName << "is false"; m_product.modulePrototypeEnabledInfo.insert({module, false}); return {nullptr, true}; } m_product.modulePrototypeEnabledInfo.insert({module, true}); return {module, true}; } Item * ModuleLoader::getModulePrototype(const QString &moduleName, const QString &filePath) { bool fromCache = true; Item * const module = m_loaderState.topLevelProject().getModulePrototype( filePath, m_product.profileName, [&] { fromCache = false; return createAndInitModuleItem(moduleName, filePath); }); if (fromCache) qCDebug(lcModuleLoader) << "prototype cache hit (level 1)"; return module; } Item *ModuleLoader::createAndInitModuleItem(const QString &moduleName, const QString &filePath) { Item * const module = m_loaderState.itemReader().setupItemFromFile(filePath, {}); if (module->type() != ItemType::Module) { qCDebug(lcModuleLoader).nospace() << "Alleged module " << moduleName << " has type '" << module->typeName() << "', so it's not a module after all."; return nullptr; } // Not technically needed, but we want to keep the invariant in item.cpp. ModuleItemLocker locker(*module); module->setProperty(StringConstants::nameProperty(), VariantValue::create(moduleName)); if (moduleName == StringConstants::qbsModule()) { module->setProperty(QStringLiteral("hostPlatform"), VariantValue::create(HostOsInfo::hostOSIdentifier())); module->setProperty(QStringLiteral("hostArchitecture"), VariantValue::create(HostOsInfo::hostOSArchitecture())); module->setProperty(QStringLiteral("libexecPath"), VariantValue::create(m_loaderState.parameters().libexecPath())); const Version qbsVersion = LanguageInfo::qbsVersion(); module->setProperty(QStringLiteral("versionMajor"), VariantValue::create(qbsVersion.majorVersion())); module->setProperty(QStringLiteral("versionMinor"), VariantValue::create(qbsVersion.minorVersion())); module->setProperty(QStringLiteral("versionPatch"), VariantValue::create(qbsVersion.patchLevel())); } else { Item::PropertyDeclarationMap decls; const auto &moduleChildren = module->children(); for (Item *param : moduleChildren) { if (param->type() == ItemType::Parameter) { const auto ¶mDecls = param->propertyDeclarations(); for (auto it = paramDecls.begin(); it != paramDecls.end(); ++it) decls.insert(it.key(), it.value()); } else if (param->type() == ItemType::Parameters) { adjustParametersScopes(param, param); Evaluator &evaluator = m_loaderState.evaluator(); QVariantMap parameters = getJsVariant(evaluator.engine()->context(), evaluator.scriptValue(param)).toMap(); m_loaderState.topLevelProject().setParameters(module, parameters); } } m_loaderState.topLevelProject().addParameterDeclarations(module, decls); } // Module properties that are defined in the profile are used as default values. // This is the reason we need to have different items per profile. const QVariantMap profileModuleProperties = m_product.profileModuleProperties.value(moduleName).toMap(); for (auto it = profileModuleProperties.cbegin(); it != profileModuleProperties.cend(); ++it) { if (Q_UNLIKELY(!module->hasProperty(it.key()))) { m_loaderState.topLevelProject().addUnknownProfilePropertyError( module, {Tr::tr("Unknown property: %1.%2").arg(moduleName, it.key())}); continue; } const PropertyDeclaration decl = module->propertyDeclaration(it.key()); VariantValuePtr v = VariantValue::create( PropertyDeclaration::convertToPropertyType(it.value(), decl.type(), QStringList(moduleName), it.key())); v->markAsSetByProfile(); module->setProperty(it.key(), v); } // This is a limited version of ModuleInstantiator::overrideProperties() that does not // take per-product overrides into account (doing that would break our prototype caching). // Non-existing properties are ignored, because they might apply to specific module back-ends. const QString overrideKey = QStringLiteral("modules.") + moduleName; const SetupProjectParameters ¶meters = m_loaderState.parameters(); module->overrideProperties( parameters.overriddenValuesTree(), overrideKey, parameters, m_loaderState.logger(), true); return module; } bool ModuleLoader::evaluateModuleCondition(Item *module, const QString &fullModuleName) { ModuleItemLocker locker(*module); // Temporarily make the product's qbs module instance available, so the condition // can use qbs.targetOS etc. class TempQbsModuleProvider { public: TempQbsModuleProvider(const ProductContext &product, Item *module, const QString &moduleName) : m_module(module), m_needsQbsItem(moduleName != StringConstants::qbsModule()) { if (m_needsQbsItem) { m_prevQbsItemValue = module->property(StringConstants::qbsModule()); module->setProperty(StringConstants::qbsModule(), product.item->property(StringConstants::qbsModule())); } } ~TempQbsModuleProvider() { if (!m_needsQbsItem) return; if (m_prevQbsItemValue) m_module->setProperty(StringConstants::qbsModule(), m_prevQbsItemValue); else m_module->removeProperty(StringConstants::qbsModule()); } private: Item * const m_module; ValuePtr m_prevQbsItemValue; const bool m_needsQbsItem; }; const TempQbsModuleProvider tempQbs(m_product, module, fullModuleName); return m_loaderState.evaluator().boolValue(module, StringConstants::conditionProperty()); } void ModuleLoader::checkForUnknownProfileProperties(const Item *module) { const std::vector &errors = m_loaderState.topLevelProject().unknownProfilePropertyErrors(module); if (errors.empty()) return; ErrorInfo error(Tr::tr("Loading module '%1' for product '%2' failed due to invalid values " "in profile '%3':") .arg(m_moduleName.toString(), m_product.displayName(), m_product.profileName)); for (const ErrorInfo &e : errors) error.append(e.toString()); handlePropertyError(error, m_loaderState.parameters(), m_loaderState.logger()); } QString ModuleLoader::findModuleDirectory(const QString &searchPath) { // isFileCaseCorrect is a very expensive call on macOS, so we cache the value for the // modules and search paths we've already processed return m_loaderState.topLevelProject().findModuleDirectory(m_moduleName, searchPath, [&] { QString dirPath = searchPath + QStringLiteral("/modules"); for (const QString &moduleNamePart : m_moduleName) { dirPath = FileInfo::resolvePath(dirPath, moduleNamePart); if (!FileInfo::exists(dirPath) || !FileInfo::isFileCaseCorrect(dirPath)) return QString(); } return dirPath; }); } QStringList ModuleLoader::findModuleDirectories() { const QStringList &searchPaths = m_loaderState.itemReader().allSearchPaths(); QStringList result; result.reserve(searchPaths.size()); for (const auto &path: searchPaths) { const QString dirPath = findModuleDirectory(path); if (!dirPath.isEmpty()) result.append(dirPath); } return result; } QStringList ModuleLoader::getModuleFilePaths(const QString &dir) { return m_loaderState.topLevelProject().getModuleFilesForDirectory(dir, [&] { QStringList moduleFiles; QDirIterator dirIter(dir, StringConstants::qbsFileWildcards()); while (dirIter.hasNext()) moduleFiles += dirIter.next(); return moduleFiles; }); } } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/localprofiles.cpp0000644000175100017510000001413215154533055022267 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #include "localprofiles.h" #include "loaderutils.h" #include #include #include #include #include #include #include #include #include namespace qbs::Internal { class LocalProfiles { public: LocalProfiles(LoaderState &loaderState) : m_loaderState(loaderState) {} void collectProfiles(Item *productOrProject, Item *projectScope); private: void handleProfile(Item *profileItem); void evaluateProfileValues(const QualifiedId &namePrefix, Item *item, Item *profileItem, QVariantMap &values); LoaderState &m_loaderState; }; void collectProfilesFromItems(Item *productOrProject, Item *projectScope, LoaderState &loaderState) { LocalProfiles(loaderState).collectProfiles(productOrProject, projectScope); } void LocalProfiles::handleProfile(Item *profileItem) { QVariantMap values; evaluateProfileValues(QualifiedId(), profileItem, profileItem, values); const bool condition = values.take(StringConstants::conditionProperty()).toBool(); if (!condition) return; const QString profileName = values.take(StringConstants::nameProperty()).toString(); if (profileName.isEmpty()) throw ErrorInfo(Tr::tr("Every Profile item must have a name"), profileItem->location()); if (profileName == Profile::fallbackName()) { throw ErrorInfo(Tr::tr("Reserved name '%1' cannot be used for an actual profile.") .arg(profileName), profileItem->location()); } m_loaderState.topLevelProject().addLocalProfile(profileName, values, profileItem->location()); } void LocalProfiles::evaluateProfileValues(const QualifiedId &namePrefix, Item *item, Item *profileItem, QVariantMap &values) { const Item::PropertyMap &props = item->properties(); for (auto it = props.begin(); it != props.end(); ++it) { QualifiedId name = namePrefix; name << it.key(); switch (it.value()->type()) { case Value::ItemValueType: evaluateProfileValues(name, std::static_pointer_cast(it.value())->item(), profileItem, values); break; case Value::VariantValueType: values.insert(name.join(QLatin1Char('.')), std::static_pointer_cast(it.value())->value()); break; case Value::JSSourceValueType: if (item != profileItem) item->setScope(profileItem); const ScopedJsValue sv(m_loaderState.evaluator().engine()->context(), m_loaderState.evaluator().value(item, it.key())); values.insert(name.join(QLatin1Char('.')), getJsVariant(m_loaderState.evaluator().engine()->context(), sv)); break; } } } void LocalProfiles::collectProfiles(Item *productOrProject, Item *projectScope) { Item * scope = productOrProject->type() == ItemType::Project ? projectScope : nullptr; for (auto it = productOrProject->children().begin(); it != productOrProject->children().end();) { Item * const childItem = *it; if (childItem->type() == ItemType::Profile) { if (!scope) { const ItemValuePtr itemValue = ItemValue::create(productOrProject); scope = Item::create(&m_loaderState.itemPool(), ItemType::Scope); scope->setProperty(StringConstants::productVar(), itemValue); scope->setFile(productOrProject->file()); scope->setScope(projectScope); } childItem->setScope(scope); try { handleProfile(childItem); } catch (const ErrorInfo &e) { handlePropertyError(e, m_loaderState.parameters(), m_loaderState.logger()); } it = productOrProject->children().erase(it); // TODO: delete item and scope } else { if (childItem->type() == ItemType::Product) collectProfiles(childItem, projectScope); ++it; } } } } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/localprofiles.h0000644000175100017510000000405515154533055021737 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once namespace qbs::Internal { class Item; class LoaderState; void collectProfilesFromItems(Item *productOrProject, Item *projectScope, LoaderState &loaderState); } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/productscollector.h0000644000175100017510000000452315154533055022653 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once #include namespace qbs::Internal { class Item; class LoaderState; // Traverses the root project item and fills the TopLevelProjectContext with all the // product and sub-project information, including those coming from referenced files. class ProductsCollector { public: ProductsCollector(LoaderState &loaderState); ~ProductsCollector(); void run(Item *rootProject); private: class Private; Pimpl d; }; } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/productitemmultiplexer.h0000644000175100017510000000461515154533055023735 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once #include #include QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE namespace qbs::Internal { class Item; class LoaderState; // Checks whether the product item is to be multiplexed and returns the list of additional // product items. In the normal, non-multiplex case, this list is empty. QList multiplex( const QString &productName, Item *productItem, Item *tempQbsModuleItem, const std::function &dropTempQbsModule, LoaderState &loaderState ); } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/dependenciesresolver.cpp0000644000175100017510000014400115154533055023640 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #include "dependenciesresolver.h" #include "itemreader.h" #include "loaderutils.h" #include "moduleinstantiator.h" #include "moduleloader.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs::Internal { namespace { enum class HandleDependency { Use, Ignore, Defer }; class LoadModuleResult { public: Item *moduleItem = nullptr; ProductContext *product = nullptr; HandleDependency handleDependency = HandleDependency::Use; }; // Corresponds completely to a Depends item. // May result in more than one module, due to "multiplexing" properties such as subModules etc. // May also result in no module at all, e.g. if productTypes does not match anything. class EvaluatedDependsItem { public: Item *item = nullptr; QualifiedId name; QStringList subModules; FileTags productTypes; QStringList multiplexIds; std::optional profiles; VersionRange versionRange; QVariantMap parameters; bool limitToSubProject = false; bool minimal = false; bool requiredLocally = true; bool requiredGlobally = true; }; // As opposed to EvaluatedDependsItem, one of these corresponds exactly to one module // to be loaded. Such an attempt might still fail, though, which may or may not result // in an error, depending on the value of Depends.required and other circumstances. class FullyResolvedDependsItem { public: FullyResolvedDependsItem(ProductContext *product, const EvaluatedDependsItem &dependency); FullyResolvedDependsItem(const EvaluatedDependsItem &dependency, QualifiedId name, QString profile, QString multiplexId); FullyResolvedDependsItem() = default; static FullyResolvedDependsItem makeBaseDependency(); QString id() const; CodeLocation location() const; QString displayName() const; // If product is non-null, we already know which product the dependency targets. // This happens either if Depends.productTypes was set, or if we tried to load the // dependency before and already identified the product, but could not complete the // procedure because said product had itself not been handled yet. ProductContext *product = nullptr; Item *item = nullptr; QualifiedId name; QString profile; QString multiplexId; VersionRange versionRange; QVariantMap parameters; bool limitToSubProject = false; bool minimal = false; bool requiredLocally = true; bool requiredGlobally = true; bool checkProduct = true; }; class DependenciesResolvingState { public: Item *loadingItem = nullptr; FullyResolvedDependsItem loadingItemOrigin; std::queue pendingDependsItems; std::optional currentDependsItem; std::queue pendingResolvedDependencies; bool requiredByLoadingItem = true; }; class DependenciesContextImpl : public DependenciesContext { public: DependenciesContextImpl(ProductContext &product, LoaderState &loaderState); std::list stateStack; private: std::pair pendingDependency() const override; void setSearchPathsForProduct(LoaderState &loaderState); ProductContext &m_product; }; class DependenciesResolver { public: DependenciesResolver(LoaderState &loaderState, ProductContext &product, Deferral deferral) : m_loaderState(loaderState), m_product(product), m_deferral(deferral) {} void resolve(); LoadModuleResult loadModule(Item *loadingItem, const FullyResolvedDependsItem &dependency); private: void evaluateNextDependsItem(); HandleDependency handleResolvedDependencies(); std::pair findExistingModule(const FullyResolvedDependsItem &dependency, Item *item); void updateModule(Item::Module &module, const FullyResolvedDependsItem &dependency); int dependsChainLength(); ProductContext *findMatchingProduct(const FullyResolvedDependsItem &dependency); Item *findMatchingModule(const FullyResolvedDependsItem &dependency); std::pair checkProductDependency( const FullyResolvedDependsItem &depSpec, const ProductContext &dep); void checkModule(const FullyResolvedDependsItem &dependency, Item *moduleItem, ProductContext *productDep); void checkForModuleNamePrefixCollision(const FullyResolvedDependsItem &dependency); Item::Module createModule(const FullyResolvedDependsItem &dependency, Item *item, ProductContext *productDep); void adjustDependsItemForMultiplexing(Item *dependsItem); std::optional evaluateDependsItem(Item *item); std::queue multiplexDependency( const EvaluatedDependsItem &dependency); QVariantMap extractParameters(Item *dependsItem) const; void forwardParameterDeclarations(const Item *dependsItem, const Item::Modules &modules); void forwardParameterDeclarations(const QualifiedId &moduleName, Item *item, const Item::Modules &modules); std::list &stateStack(); LoaderState &m_loaderState; ProductContext &m_product; Deferral m_deferral; }; static bool haveSameSubProject(const ProductContext &p1, const ProductContext &p2); static QVariantMap safeToVariant(JSContext *ctx, const JSValue &v); static void collectDependsItems(Item *parent, std::queue &dependsItems); } // namespace void resolveDependencies(ProductContext &product, Deferral deferral, LoaderState &loaderState) { DependenciesResolver(loaderState, product, deferral).resolve(); } Item *loadBaseModule(ProductContext &product, Item *item, LoaderState &loaderState) { const auto baseDependency = FullyResolvedDependsItem::makeBaseDependency(); Item * const moduleItem = DependenciesResolver(loaderState, product, Deferral::NotAllowed) .loadModule(item, baseDependency).moduleItem; if (Q_UNLIKELY(!moduleItem)) throw ErrorInfo(Tr::tr("Cannot load base qbs module.")); return moduleItem; } namespace { void DependenciesResolver::resolve() { AccumulatingTimer timer(m_loaderState.parameters().logElapsedTime() ? &m_product.timingData.dependenciesResolving : nullptr); if (!m_product.dependenciesContext) { m_product.dependenciesContext = std::make_unique( m_product, m_loaderState); } else { QBS_CHECK(!m_product.dependenciesContext->dependenciesResolved); } SearchPathsManager searchPathsMgr(m_loaderState.itemReader(), m_product.searchPaths); while (!stateStack().empty()) { auto &state = stateStack().front(); // If we have pending FullyResolvedDependsItems, then these are handled first. if (handleResolvedDependencies() == HandleDependency::Defer) return; // The above procedure might have pushed another state to the stack due to recursive // dependencies (i.e. Depends items in the newly loaded module), in which case we // continue with that one. if (&state != &stateStack().front()) continue; // If we have a pending EvaluatedDependsItem, we multiplex it and then handle // the resulting FullyResolvedDependsItems, if there were any. if (state.currentDependsItem) { QBS_CHECK(state.pendingResolvedDependencies.empty()); // We postpone handling Depends.productTypes for as long as possible, because // the full type of a product becomes available only after its modules have been loaded. if (!state.currentDependsItem->productTypes.empty() && m_deferral == Deferral::Allowed) return; state.pendingResolvedDependencies = multiplexDependency(*state.currentDependsItem); state.currentDependsItem.reset(); m_deferral = Deferral::Allowed; // We made progress. continue; } // Here we have no resolved/evaluated Depends items of any kind, so we evaluate the next // pending Depends item. evaluateNextDependsItem(); if (state.currentDependsItem) continue; // No resolved or unresolved Depends items are left, so we're done with the current state. QBS_CHECK(!state.currentDependsItem); QBS_CHECK(state.pendingResolvedDependencies.empty()); QBS_CHECK(state.pendingDependsItems.empty()); // This ensures our invariant: A sorted module list in the product // (dependers after dependencies). if (stateStack().size() > 1) { QBS_CHECK(state.loadingItem->type() == ItemType::ModuleInstance); Item::Modules &modules = m_product.item->modules(); const auto loadingItemModule = std::find_if(modules.begin(), modules.end(), [&](const Item::Module &m) { return m.item == state.loadingItem; }); QBS_CHECK(loadingItemModule != modules.end()); const Item::Module tempModule = *loadingItemModule; modules.erase(loadingItemModule); modules.push_back(tempModule); } stateStack().pop_front(); } m_product.dependenciesContext->dependenciesResolved = true; } void DependenciesResolver::evaluateNextDependsItem() { auto &state = stateStack().front(); while (!state.pendingDependsItems.empty()) { QBS_CHECK(!state.currentDependsItem); QBS_CHECK(state.pendingResolvedDependencies.empty()); Item * const dependsItem = state.pendingDependsItems.front(); state.pendingDependsItems.pop(); adjustDependsItemForMultiplexing(dependsItem); if (auto evaluated = evaluateDependsItem(dependsItem)) { evaluated->requiredGlobally = evaluated->requiredLocally && state.loadingItemOrigin.requiredGlobally; state.currentDependsItem = evaluated; return; } } } HandleDependency DependenciesResolver::handleResolvedDependencies() { DependenciesResolvingState &state = stateStack().front(); while (!state.pendingResolvedDependencies.empty()) { QBS_CHECK(!state.currentDependsItem); const FullyResolvedDependsItem dependency = state.pendingResolvedDependencies.front(); try { const LoadModuleResult res = loadModule(state.loadingItem, dependency); switch (res.handleDependency) { case HandleDependency::Defer: QBS_CHECK(m_deferral == Deferral::Allowed); // Optimization: We already looked up the product, so let's not do that again // next time. if (res.product) state.pendingResolvedDependencies.front().product = res.product; return HandleDependency::Defer; case HandleDependency::Ignore: // This happens if the dependency was not required or the module was already // loaded via another path. state.pendingResolvedDependencies.pop(); continue; case HandleDependency::Use: if (dependency.name.toString() == StringConstants::qbsModule()) { // Shortcut: No need to look for recursive dependencies in the base module. state.pendingResolvedDependencies.pop(); continue; } m_deferral = Deferral::Allowed; // We made progress. break; } QBS_CHECK(res.moduleItem); // Now continue with the dependencies of the just-loaded module. std::queue moduleDependsItems; collectDependsItems(res.moduleItem, moduleDependsItems); state.pendingResolvedDependencies.pop(); stateStack().push_front( {res.moduleItem, dependency, moduleDependsItems, {}, {}, dependency.requiredGlobally || state.requiredByLoadingItem}); stateStack().front().pendingResolvedDependencies.push( FullyResolvedDependsItem::makeBaseDependency()); break; } catch (const ErrorInfo &e) { if (dependency.name.toString() == StringConstants::qbsModule()) throw e; // See QBS-1338 for why we do not abort handling the product. state.pendingResolvedDependencies.pop(); Item::Modules &modules = m_product.item->modules(); // Unwind. bool unwound = false; while (stateStack().size() > 1) { const auto loadingItemModule = std::find_if( modules.begin(), modules.end(), [&](const Item::Module &m) { return m.item == stateStack().front().loadingItem; }); for (auto it = loadingItemModule; it != modules.end(); ++it) { createNonPresentModule(m_loaderState.itemPool(), it->name.toString(), QLatin1String("error in Depends chain"), it->item); } modules.erase(loadingItemModule, modules.end()); stateStack().pop_front(); unwound = true; } m_product.handleError(e); if (unwound) return HandleDependency::Ignore; continue; } } return HandleDependency::Ignore; } // Produces an item of type ModuleInstance corresponding to the specified dependency. // The instance's prototype item is either of type Export (if the dependency is a product) // or of type Module (for an actual module). // The loadingItem parameter is either the depending product or another module. The newly // created module is added to the module list of the product item and additionally to the // loading item's one, if it is not the product. Its name is also injected into the respective // scopes. LoadModuleResult DependenciesResolver::loadModule( Item *loadingItem, const FullyResolvedDependsItem &dependency) { qCDebug(lcModuleLoader) << "loadModule name:" << dependency.name.toString() << "id:" << dependency.id(); QBS_CHECK(loadingItem); ProductContext *productDep = nullptr; Item *moduleItem = nullptr; const auto addLoadContext = [&](Item::Module &module) { module.loadContexts.emplace_back(dependency.item, std::make_pair(dependency.parameters, INT_MAX - dependsChainLength())); }; // The module might already have been loaded for this product (directly or indirectly). const auto &[existingModule, moduleWithSameName] = findExistingModule(dependency, m_product.item); if (existingModule) { // Merge version range and required property. These will be checked again // after probes resolving. if (existingModule->name.toString() != StringConstants::qbsModule()) updateModule(*existingModule, dependency); QBS_CHECK(existingModule->item); moduleItem = existingModule->item; const auto matcher = [loadingItem](const Item::Module::LoadContext &context) { return context.loadingItem() == loadingItem; }; const auto it = std::find_if(existingModule->loadContexts.begin(), existingModule->loadContexts.end(), matcher); if (it == existingModule->loadContexts.end()) addLoadContext(*existingModule); else it->parameters.first = mergeDependencyParameters(it->parameters.first, dependency.parameters); } else if (dependency.product) { productDep = dependency.product; // We have already done the look-up. } else if (productDep = findMatchingProduct(dependency); !productDep) { moduleItem = findMatchingModule(dependency); } if (productDep) { const auto checkResult = checkProductDependency(dependency, *productDep); // We found a product dependency, but that product has not been handled yet, // so stop dependency resolving for the current product and resume it later, when the // dependency is ready. if (checkResult.second == HandleDependency::Defer) return {nullptr, productDep, HandleDependency::Defer}; if (checkResult.first) { QBS_CHECK(productDep->mergedExportItem); moduleItem = productDep->mergedExportItem->clone(m_loaderState.itemPool()); moduleItem->setParent(nullptr); // Needed for isolated Export item evaluation. moduleItem->setPrototype(productDep->mergedExportItem); } else { // The product dependency is faulty, but Depends.reqired was false. productDep = nullptr; } } if (moduleItem) checkModule(dependency, moduleItem, productDep); // Can only happen with multiplexing. if (moduleWithSameName && moduleWithSameName != moduleItem) QBS_CHECK(productDep); // The loading name is only used to ensure consistent sorting in case of equal // value priorities; see ModulePropertyMerger. QString loadingName; if (loadingItem == m_product.item) { loadingName = m_product.name; } else if (m_product.dependenciesContext && !stateStack().empty()) { const auto &loadingItemOrigin = stateStack().front().loadingItemOrigin; loadingName = loadingItemOrigin.name.toString() + loadingItemOrigin.multiplexId + loadingItemOrigin.profile; } instantiateModule({m_product, loadingItem, loadingName, moduleItem, moduleWithSameName, productDep ? productDep->item : nullptr, dependency.name, dependency.id(), bool(existingModule)}, m_loaderState); // At this point, a null module item is only possible for a non-required dependency. // Note that we still needed to to the instantiation above, as that injects the module // name into the surrounding item for the ".present" check. if (!moduleItem) { QBS_CHECK(!dependency.requiredGlobally); return {nullptr, nullptr, HandleDependency::Ignore}; } const auto addLocalModule = [&] { if (loadingItem->type() == ItemType::ModuleInstance && !findExistingModule(dependency, loadingItem).first) { loadingItem->addModule(createModule(dependency, moduleItem, productDep)); } }; // The module has already been loaded, so we don't need to add it to the product's list of // modules, nor do we need to handle its dependencies. The only thing we might need to // do is to add it to the "local" list of modules of the loading item, if it isn't in there yet. if (existingModule) { addLocalModule(); return {nullptr, nullptr, HandleDependency::Ignore}; } qCDebug(lcModuleLoader) << "module loaded:" << dependency.name.toString(); if (m_product.item) { Item::Module module = createModule(dependency, moduleItem, productDep); module.required = dependency.requiredGlobally; module.minimal = dependency.minimal; addLoadContext(module); module.maxDependsChainLength = dependsChainLength(); m_product.item->addModule(module); addLocalModule(); } return {moduleItem, nullptr, HandleDependency::Use}; } std::pair DependenciesResolver::findExistingModule( const FullyResolvedDependsItem &dependency, Item *item) { if (!item) // Happens if and only if called via loadBaseModule(). return {}; Item *moduleWithSameName = nullptr; for (Item::Module &m : item->modules()) { if (m.name != dependency.name) continue; if (!m.product) { QBS_CHECK(!dependency.product); return {&m, m.item}; } if ((dependency.profile.isEmpty() || (m.product->profileName == dependency.profile)) && m.product->multiplexConfigurationId == dependency.multiplexId) { return {&m, m.item}; } // This can happen if there are dependencies to several variants of a multiplexed // product. moduleWithSameName = m.item; } return {nullptr, moduleWithSameName}; } void DependenciesResolver::updateModule( Item::Module &module, const FullyResolvedDependsItem &dependency) { forwardParameterDeclarations(dependency.item, m_product.item->modules()); module.versionRange.narrowDown(dependency.versionRange); module.required |= dependency.requiredGlobally; module.minimal &= dependency.minimal; if (dependsChainLength() > module.maxDependsChainLength) module.maxDependsChainLength = dependsChainLength(); } int DependenciesResolver::dependsChainLength() { return m_product.dependenciesContext ? stateStack().size() : 1; } ProductContext *DependenciesResolver::findMatchingProduct( const FullyResolvedDependsItem &dependency) { const auto constraint = [this, &dependency](ProductContext &product) { if (product.multiplexConfigurationId != dependency.multiplexId) return false; if (!dependency.profile.isEmpty() && dependency.profile != product.profileName) return false; if (dependency.limitToSubProject && !haveSameSubProject(m_product, product)) return false; return true; }; return m_product.project->topLevelProject->productWithNameAndConstraint( dependency.name.toString(), constraint); } Item *DependenciesResolver::findMatchingModule( const FullyResolvedDependsItem &dependency) { // If we can tell that this is supposed to be a product dependency, we can skip // the module look-up. if (!dependency.profile.isEmpty() || !dependency.multiplexId.isEmpty()) { if (dependency.requiredGlobally) { if (!dependency.profile.isEmpty()) { throw ErrorInfo(Tr::tr("Product '%1' depends on '%2', which does not exist " "for the requested profile '%3'.") .arg(m_product.displayName(), dependency.displayName(), dependency.profile), m_product.item->location()); } throw ErrorInfo(Tr::tr("Product '%1' depends on '%2', which does not exist.") .arg(m_product.displayName(), dependency.displayName()), m_product.item->location()); } return nullptr; } if (Item *moduleItem = searchAndLoadModuleFile( m_loaderState, m_product, dependency.location(), dependency.name, dependency.versionRange)) { QBS_CHECK(moduleItem->type() == ItemType::Module); Item * const proto = moduleItem; ModuleItemLocker locker(*moduleItem); moduleItem = moduleItem->clone(m_loaderState.itemPool()); moduleItem->setPrototype(proto); // For parameter declarations. return moduleItem; } if (!dependency.requiredGlobally) { return createNonPresentModule(m_loaderState.itemPool(), dependency.name.toString(), QStringLiteral("not found"), nullptr); } throw ErrorInfo(Tr::tr("Dependency '%1' not found for product '%2'.") .arg(dependency.name.toString(), m_product.displayName()), dependency.location()); } std::pair DependenciesResolver::checkProductDependency( const FullyResolvedDependsItem &depSpec, const ProductContext &dep) { // Optimization: If we already checked the product earlier and then deferred, we don't // need to check it again. if (!depSpec.checkProduct) return {true, HandleDependency::Use}; if (&dep == &m_product) { throw ErrorInfo(Tr::tr("Dependency '%1' refers to itself.").arg(depSpec.name.toString()), depSpec.location()); } if (m_product.project->topLevelProject->isProductQueuedForHandling(dep)) { if (m_deferral == Deferral::Allowed) return {false, HandleDependency::Defer}; ErrorInfo e; e.append(Tr::tr("Cyclic dependencies detected:")); e.append(Tr::tr("First product is '%1'.") .arg(m_product.displayName()), m_product.item->location()); e.append(Tr::tr("Second product is '%1'.") .arg(dep.displayName()), dep.item->location()); e.append(Tr::tr("Requested here."), depSpec.location()); throw e; } // This covers both the case of user-disabled products and products with errors. // The latter are force-disabled in ProductContext::handleError(). if (m_product.project->topLevelProject->isDisabledItem(dep.item)) { if (depSpec.requiredGlobally) { ErrorInfo e; e.append(Tr::tr("Product '%1' depends on '%2',") .arg(m_product.displayName(), dep.displayName()), m_product.item->location()); e.append(Tr::tr("but product '%1' is disabled.").arg(dep.displayName()), dep.item->location()); throw e; } return {false, HandleDependency::Ignore}; } return {true, HandleDependency::Use}; } void DependenciesResolver::checkModule( const FullyResolvedDependsItem &dependency, Item *moduleItem, ProductContext *productDep) { // When loading a pseudo or temporary qbs module in early setup via loadBaseModule(), // there is no proper state yet. if (!m_product.dependenciesContext) return; for (auto it = stateStack().begin(); it != stateStack().end(); ++it) { Item *itemToCheck = moduleItem; if (it->loadingItem != itemToCheck) { if (!productDep) continue; itemToCheck = productDep->item; } if (it->loadingItem != itemToCheck) continue; ErrorInfo e; e.append(Tr::tr("Cyclic dependencies detected:")); while (true) { e.append(it->loadingItemOrigin.name.toString(), it->loadingItemOrigin.location()); if (it->loadingItem->type() == ItemType::ModuleInstance) { createNonPresentModule(m_loaderState.itemPool(), it->loadingItemOrigin.name.toString(), QLatin1String("cyclic dependency"), it->loadingItem); } if (it == stateStack().begin()) break; --it; } e.append(dependency.name.toString(), dependency.location()); throw e; } checkForModuleNamePrefixCollision(dependency); } void DependenciesResolver::adjustDependsItemForMultiplexing(Item *dependsItem) { if (m_product.name.startsWith(StringConstants::shadowProductPrefix())) return; Evaluator &evaluator = m_loaderState.evaluator(); const QString name = evaluator.stringValue(dependsItem, StringConstants::nameProperty()); const bool productIsMultiplexed = !m_product.multiplexConfigurationId.isEmpty(); if (name == m_product.name) { QBS_CHECK(!productIsMultiplexed); // This product must be an aggregator. return; } bool hasNonMultiplexedDependency = false; const std::vector multiplexedDependencies = m_product.project ->topLevelProject->productsWithNameAndConstraint(name, [&hasNonMultiplexedDependency] (const ProductContext &product) { if (product.multiplexConfigurationId.isEmpty()) { hasNonMultiplexedDependency = true; return false; } return true; }); const bool hasMultiplexedDependencies = !multiplexedDependencies.empty(); // These are the allowed cases: // (1) Normal dependency with no multiplexing whatsoever. // (2) Both product and dependency are multiplexed. // (2a) The profiles property is not set, we want to depend on the best // matching variant. // (2b) The profiles property is set, we want to depend on all variants // with a matching profile. // (3) The product is not multiplexed, but the dependency is. // (3a) The profiles property is not set, the dependency has an aggregator. // We want to depend on the aggregator. // (3b) The profiles property is not set, the dependency does not have an // aggregator. We want to depend on all the multiplexed variants. // (3c) The profiles property is set, we want to depend on all variants // with a matching profile regardless of whether an aggregator exists or not. // (4) The product is multiplexed, but the dependency is not. We don't have to adapt // any Depends items. // (1) and (4) if (!hasMultiplexedDependencies) return; bool profilesPropertyIsSet; const QStringList profiles = evaluator.stringListValue( dependsItem, StringConstants::profilesProperty(), &profilesPropertyIsSet); // (3a) if (!productIsMultiplexed && hasNonMultiplexedDependency && !profilesPropertyIsSet) return; static const auto multiplexConfigurationIntersects = [](const QVariantMap &lhs, const QVariantMap &rhs) { QBS_CHECK(!lhs.isEmpty() && !rhs.isEmpty()); for (auto lhsProperty = lhs.constBegin(); lhsProperty != lhs.constEnd(); lhsProperty++) { const auto rhsProperty = rhs.find(lhsProperty.key()); const bool isCommonProperty = rhsProperty != rhs.constEnd(); if (isCommonProperty && !qVariantsEqual(lhsProperty.value(), rhsProperty.value())) return false; } return true; }; QStringList multiplexIds; const auto productMultiplexConfig = m_loaderState.topLevelProject().multiplexConfiguration( m_product.multiplexConfigurationId); for (const ProductContext *dependency : multiplexedDependencies) { if (productIsMultiplexed && !profilesPropertyIsSet) { // 2a if (dependency->multiplexConfigurationId == m_product.multiplexConfigurationId) { const ValuePtr &multiplexId = m_product.item->property( StringConstants::multiplexConfigurationIdProperty()); dependsItem->setProperty(StringConstants::multiplexConfigurationIdsProperty(), multiplexId); return; } // Otherwise collect partial matches and decide later const auto dependencyMultiplexConfig = m_loaderState.topLevelProject() .multiplexConfiguration(dependency->multiplexConfigurationId); if (multiplexConfigurationIntersects(dependencyMultiplexConfig, productMultiplexConfig)) multiplexIds << dependency->multiplexConfigurationId; } else { // (2b), (3b) or (3c) const bool profileMatch = !profilesPropertyIsSet || profiles.empty() || profiles.contains(dependency->profileName); if (profileMatch) multiplexIds << dependency->multiplexConfigurationId; } } if (multiplexIds.empty()) { const QString productName = m_product.displayName(); throw ErrorInfo(Tr::tr("Dependency from product '%1' to product '%2' not fulfilled. " "There are no eligible multiplex candidates.").arg(productName, name), dependsItem->location()); } // In case of (2a), at most 1 match is allowed if (productIsMultiplexed && !profilesPropertyIsSet && multiplexIds.size() > 1) { QStringList candidateNames; for (const auto &id : std::as_const(multiplexIds)) candidateNames << fullProductDisplayName(name, id); throw ErrorInfo( Tr::tr("Dependency from product '%1' to product '%2' is ambiguous. " "Eligible multiplex candidates: %3.").arg( m_product.displayName(), name, candidateNames.join(QLatin1String(", "))), dependsItem->location()); } dependsItem->setProperty(StringConstants::multiplexConfigurationIdsProperty(), VariantValue::create(multiplexIds)); } std::optional DependenciesResolver::evaluateDependsItem(Item *item) { Evaluator &evaluator = m_loaderState.evaluator(); for (Item *current = item; current->type() == ItemType::Depends || current->type() == ItemType::Group; current = current->parent()) { if (!m_loaderState.topLevelProject().checkItemCondition( current, m_loaderState.evaluator())) { qCDebug(lcModuleLoader) << "Depends item disabled, ignoring."; return {}; } } const QString name = evaluator.stringValue(item, StringConstants::nameProperty()); if (name == StringConstants::qbsModule()) // Redundant return {}; bool submodulesPropertySet; const QStringList submodules = evaluator.stringListValue( item, StringConstants::submodulesProperty(), &submodulesPropertySet); if (submodules.empty() && submodulesPropertySet) { qCDebug(lcModuleLoader) << "Ignoring Depends item with empty submodules list."; return {}; } if (Q_UNLIKELY(submodules.size() > 1 && !item->id().isEmpty())) { QString msg = Tr::tr("A Depends item with more than one module cannot have an id."); throw ErrorInfo(msg, item->location()); } bool productTypesWasSet; const QStringList productTypes = evaluator.stringListValue( item, StringConstants::productTypesProperty(), &productTypesWasSet); if (!name.isEmpty() && !productTypes.isEmpty()) { throw ErrorInfo(Tr::tr("The name and productTypes are mutually exclusive " "in a Depends item."), item->location()); } if (productTypes.isEmpty() && productTypesWasSet) { qCDebug(lcModuleLoader) << "Ignoring Depends item with empty productTypes list."; return {}; } if (name.isEmpty() && !productTypesWasSet) { throw ErrorInfo(Tr::tr("Either name or productTypes must be set in a Depends item"), item->location()); } bool profilesPropertyWasSet = false; std::optional profiles; bool required = true; if (productTypes.isEmpty()) { const QStringList profileList = evaluator.stringListValue( item, StringConstants::profilesProperty(), &profilesPropertyWasSet); if (profilesPropertyWasSet) profiles.emplace(profileList); required = evaluator.boolValue(item, StringConstants::requiredProperty()); } const Version minVersion = Version::fromString( evaluator.stringValue(item, StringConstants::versionAtLeastProperty())); const Version maxVersion = Version::fromString( evaluator.stringValue(item, StringConstants::versionBelowProperty())); const bool limitToSubProject = evaluator.boolValue( item, StringConstants::limitToSubProjectProperty()); const QStringList multiplexIds = evaluator.stringListValue( item, StringConstants::multiplexConfigurationIdsProperty()); adjustParametersScopes(item, item); forwardParameterDeclarations(item, m_product.item->modules()); const QVariantMap parameters = extractParameters(item); const bool minimal = evaluator.boolValue(item, StringConstants::minimalProperty()); const FileTags productTypeTags = FileTags::fromStringList(productTypes); if (!productTypeTags.empty()) m_product.bulkDependencies.emplace_back(productTypeTags, item->location()); return EvaluatedDependsItem{ .item = item, .name = QualifiedId::fromString(name), .subModules = submodules, .productTypes = productTypeTags, .multiplexIds = multiplexIds, .profiles = profiles, .versionRange{minVersion, maxVersion}, .parameters = parameters, .limitToSubProject = limitToSubProject, .minimal = minimal, .requiredLocally = required}; } // Potentially multiplexes a dependency along Depends.productTypes, Depends.subModules and // Depends.profiles, as well as internally set up multiplexing axes. // Each entry in the resulting queue corresponds to exactly one product or module to pull in. std::queue DependenciesResolver::multiplexDependency(const EvaluatedDependsItem &dependency) { std::queue dependencies; if (!dependency.productTypes.empty()) { const auto constraint = [&](const ProductContext &product) { return &product != &m_product && product.name != m_product.name && (!dependency.limitToSubProject || haveSameSubProject(m_product, product)); }; const std::vector matchingProducts = m_product.project->topLevelProject ->productsWithTypeAndConstraint(dependency.productTypes, constraint); if (matchingProducts.empty()) { qCDebug(lcModuleLoader) << "Depends.productTypes does not match anything." << dependency.item->location(); return {}; } for (ProductContext * const match : matchingProducts) dependencies.emplace(match, dependency); return dependencies; } const QStringList profiles = dependency.profiles && !dependency.profiles->isEmpty() ? *dependency.profiles : QStringList(QString()); const QStringList multiplexIds = !dependency.multiplexIds.isEmpty() ? dependency.multiplexIds : QStringList(QString()); const QStringList subModules = !dependency.subModules.isEmpty() ? dependency.subModules : QStringList(QString()); for (const QString &profile : profiles) { for (const QString &multiplexId : multiplexIds) { for (const QString &subModule : subModules) { QualifiedId name = dependency.name; if (!subModule.isEmpty()) name << subModule.split(QLatin1Char('.')); dependencies.emplace(dependency, name, profile, multiplexId); } } } return dependencies; } QVariantMap DependenciesResolver::extractParameters(Item *dependsItem) const { try { QVariantMap result; const auto &properties = dependsItem->properties(); Evaluator &evaluator = m_loaderState.evaluator(); for (auto it = properties.begin(); it != properties.end(); ++it) { if (it.value()->type() != Value::ItemValueType) continue; const JSValue sv = evaluator.scriptValue( std::static_pointer_cast(it.value())->item()); result.insert(it.key(), safeToVariant(evaluator.engine()->context(), sv)); } return result; } catch (const ErrorInfo &exception) { auto ei = exception; ei.prepend(Tr::tr("Error in dependency parameter."), dependsItem->location()); throw ei; } } void DependenciesResolver::forwardParameterDeclarations(const Item *dependsItem, const Item::Modules &modules) { for (auto it = dependsItem->properties().begin(); it != dependsItem->properties().end(); ++it) { if (it.value()->type() != Value::ItemValueType) continue; forwardParameterDeclarations(it.key(), std::static_pointer_cast(it.value())->item(), modules); } } void DependenciesResolver::forwardParameterDeclarations( const QualifiedId &moduleName, Item *item, const Item::Modules &modules) { auto it = std::find_if(modules.begin(), modules.end(), [&moduleName] (const Item::Module &m) { return m.name == moduleName; }); if (it != modules.end()) { item->setPropertyDeclarations(m_loaderState.topLevelProject().parameterDeclarations( it->item->rootPrototype())); } else { for (auto it = item->properties().begin(); it != item->properties().end(); ++it) { if (it.value()->type() != Value::ItemValueType) continue; forwardParameterDeclarations(QualifiedId(moduleName) << it.key(), std::static_pointer_cast(it.value())->item(), modules); } } } std::list &DependenciesResolver::stateStack() { QBS_CHECK(m_product.dependenciesContext); return static_cast(m_product.dependenciesContext.get())->stateStack; } void DependenciesResolver::checkForModuleNamePrefixCollision( const FullyResolvedDependsItem &dependency) { if (!m_product.item) return; for (const Item::Module &m : m_product.item->modules()) { if (m.name.length() == dependency.name.length()) continue; QualifiedId shortName; QualifiedId longName; if (m.name.length() < dependency.name.length()) { shortName = m.name; longName = dependency.name; } else { shortName = dependency.name; longName = m.name; } const auto isPrefix = [&] { for (int i = 0; i < shortName.length(); ++i) { if (shortName.at(i) != longName.at(i)) return false; } return true; }; if (!isPrefix()) continue; throw ErrorInfo(Tr::tr("The name of module '%1' is a prefix of the name of module '%2', " "which is not allowed") .arg(shortName.toString(), longName.toString()), dependency.location()); } } Item::Module DependenciesResolver::createModule( const FullyResolvedDependsItem &dependency, Item *item, ProductContext *productDep) { Item::Module m; m.item = item; m.product = productDep; m.name = dependency.name; m.minimal = dependency.minimal; m.required = dependency.requiredLocally; m.versionRange = dependency.versionRange; return m; } FullyResolvedDependsItem::FullyResolvedDependsItem( ProductContext *product, const EvaluatedDependsItem &dependency) : product(product) , item(dependency.item) , name(product->name) , versionRange(dependency.versionRange) , parameters(dependency.parameters) , minimal(dependency.minimal) , checkProduct(false) {} FullyResolvedDependsItem FullyResolvedDependsItem::makeBaseDependency() { FullyResolvedDependsItem item; item.name = StringConstants::qbsModule(); return item; } FullyResolvedDependsItem::FullyResolvedDependsItem( const EvaluatedDependsItem &dependency, QualifiedId name, QString profile, QString multiplexId) : item(dependency.item) , name(std::move(name)) , profile(std::move(profile)) , multiplexId(std::move(multiplexId)) , versionRange(dependency.versionRange) , parameters(dependency.parameters) , limitToSubProject(dependency.limitToSubProject) , minimal(dependency.minimal) , requiredLocally(dependency.requiredLocally) , requiredGlobally(dependency.requiredGlobally) {} QString FullyResolvedDependsItem::id() const { if (!item) { QBS_CHECK(name.toString() == StringConstants::qbsModule()); return {}; } return item->id(); } CodeLocation FullyResolvedDependsItem::location() const { if (!item) { QBS_CHECK(name.toString() == StringConstants::qbsModule()); return {}; } return item->location(); } QString FullyResolvedDependsItem::displayName() const { return fullProductDisplayName(name.toString(), multiplexId); } bool haveSameSubProject(const ProductContext &p1, const ProductContext &p2) { for (const Item *otherParent = p2.item->parent(); otherParent; otherParent = otherParent->parent()) { if (otherParent == p1.item->parent()) return true; } return false; } QVariantMap safeToVariant(JSContext *ctx, const JSValue &v) { QVariantMap result; handleJsProperties(ctx, v, [&](const JSAtom &prop, const JSPropertyDescriptor &desc) { const JSValue u = desc.value; if (JS_IsError(u)) throw ErrorInfo(getJsString(ctx, u)); const QString name = getJsString(ctx, prop); result[name] = (JS_IsObject(u) && !JS_IsArray(u) && !JS_IsRegExp(u)) ? safeToVariant(ctx, u) : getJsVariant(ctx, u); }); return result; } void collectDependsItems(Item *parent, std::queue &dependsItems) { for (Item * const child : parent->children()) { if (child->type() == ItemType::Depends) dependsItems.push(child); else if (child->type() == ItemType::Group) collectDependsItems(child, dependsItems); } } DependenciesContextImpl::DependenciesContextImpl(ProductContext &product, LoaderState &loaderState) : m_product(product) { setSearchPathsForProduct(loaderState); // Initialize the state with the direct Depends items of the product item. DependenciesResolvingState newState{product.item,}; collectDependsItems(product.item, newState.pendingDependsItems); stateStack.push_front(std::move(newState)); stateStack.front().pendingResolvedDependencies.push( FullyResolvedDependsItem::makeBaseDependency()); } std::pair DependenciesContextImpl::pendingDependency() const { QBS_CHECK(!stateStack.empty()); if (const auto ¤tDependsItem = stateStack.front().currentDependsItem; currentDependsItem && !currentDependsItem->productTypes.empty()) { qCDebug(lcLoaderScheduling) << "product" << m_product.displayName() << "to be delayed because of bulk dependency"; return {ProductDependencyType::Bulk, nullptr}; } if (!stateStack.front().pendingResolvedDependencies.empty()) { if (ProductContext * const dep = stateStack.front().pendingResolvedDependencies .front().product) { if (m_product.project->topLevelProject->isProductQueuedForHandling(*dep)) { qCDebug(lcLoaderScheduling) << "product" << m_product.displayName() << "to be delayed because of dependency " "to unfinished product" << dep->displayName(); return {ProductDependencyType::Single, dep}; } else { qCDebug(lcLoaderScheduling) << "product" << m_product.displayName() << "to be re-scheduled, as dependency " << dep->displayName() << "appears to have finished in the meantime"; return {ProductDependencyType::None, dep}; } } } return {ProductDependencyType::None, nullptr}; } void DependenciesContextImpl::setSearchPathsForProduct(LoaderState &loaderState) { QBS_CHECK(m_product.searchPaths.isEmpty()); m_product.searchPaths = loaderState.itemReader().readExtraSearchPaths(m_product.item); Settings settings(loaderState.parameters().settingsDirectory()); const QStringList prefsSearchPaths = Preferences(&settings, m_product.profileModuleProperties) .searchPaths(); const QStringList ¤tSearchPaths = loaderState.itemReader().allSearchPaths(); for (const QString &p : prefsSearchPaths) { if (!currentSearchPaths.contains(p) && FileInfo(p).exists()) m_product.searchPaths << p; } } } // namespace } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/groupshandler.h0000644000175100017510000000514015154533055021752 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once namespace qbs::Internal { class LoaderState; class ProductContext; // Sets up Group items for the actual resolving stage. Responsibilities: // - Moving Group items located in modules over to the product. // - Identifying groups declaring target artifacts and marking them accordingly. // - Setting up group-level module instances to ensure proper resolving of per-group module // properties. // - As a side effect of the above point, collecting all properties set on the Group level // to help the ProjectResolver decide which properties need to be re-evaluated at all, // which is an important optimization (see commit 9cd8653eef). void setupGroups(ProductContext &product, LoaderState &loaderState); } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/astimportshandler.cpp0000644000175100017510000003072415154533055023201 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "astimportshandler.h" #include "itemreadervisitorstate.h" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { ASTImportsHandler::ASTImportsHandler(ItemReaderVisitorState &visitorState, Logger &logger, const FileContextPtr &file) : m_visitorState(visitorState) , m_logger(logger) , m_file(file) , m_directory(FileInfo::path(m_file->filePath())) { } void ASTImportsHandler::handleImports(const QbsQmlJS::AST::UiImportList *uiImportList) { const auto searchPaths = m_file->searchPaths(); for (const QString &searchPath : searchPaths) collectPrototypes(searchPath + QStringLiteral("/imports"), QString()); // files in the same directory are available as prototypes collectPrototypes(m_directory, QString()); bool baseImported = false; for (const auto *it = uiImportList; it; it = it->next) handleImport(it->import, &baseImported); if (!baseImported) { QStringRef qbsref(&StringConstants::qbsModule()); QbsQmlJS::AST::UiQualifiedId qbsURI(qbsref); qbsURI.finish(); QbsQmlJS::AST::UiImport imp(&qbsURI); handleImport(&imp, &baseImported); } for (auto it = m_jsImports.constBegin(); it != m_jsImports.constEnd(); ++it) m_file->addJsImport(it.value()); } void ASTImportsHandler::handleImport(const QbsQmlJS::AST::UiImport *import, bool *baseImported) { QStringList importUri; bool isBase = false; if (import->importUri) { importUri = toStringList(import->importUri); isBase = (importUri.size() == 1 && importUri.front() == StringConstants::qbsModule()) || (importUri.size() == 2 && importUri.front() == StringConstants::qbsModule() && importUri.last() == StringConstants::baseVar()); if (isBase) { *baseImported = true; checkImportVersion(import->versionToken); } else if (import->versionToken.length) { m_logger.printWarning(ErrorInfo(Tr::tr("Superfluous version specification."), toCodeLocation(m_file->filePath(), import->versionToken))); } } QString as; if (isBase) { if (Q_UNLIKELY(!import->importId.isNull())) { throw ErrorInfo(Tr::tr("Import of qbs.base must have no 'as '"), toCodeLocation(m_file->filePath(), import->importIdToken)); } } else { if (importUri.size() == 2 && importUri.front() == StringConstants::qbsModule()) { const QString extensionName = importUri.last(); if (JsExtensions::hasExtension(extensionName)) { if (Q_UNLIKELY(!import->importId.isNull())) { throw ErrorInfo(Tr::tr("Import of built-in extension '%1' " "must not have 'as' specifier.").arg(extensionName), toCodeLocation(m_file->filePath(), import->asToken)); } if (Q_UNLIKELY(m_file->jsExtensions().contains(extensionName))) { m_logger.printWarning(ErrorInfo(Tr::tr("Built-in extension '%1' already " "imported.").arg(extensionName), toCodeLocation(m_file->filePath(), import->importToken))); } else { m_file->addJsExtension(extensionName); } return; } } if (import->importId.isNull()) { if (!import->fileName.isNull()) { throw ErrorInfo(Tr::tr("File imports require 'as '"), toCodeLocation(m_file->filePath(), import->importToken)); } if (importUri.empty()) { throw ErrorInfo(Tr::tr("Invalid import URI."), toCodeLocation(m_file->filePath(), import->importToken)); } as = importUri.last(); } else { as = import->importId.toString(); } if (Q_UNLIKELY(JsExtensions::hasExtension(as))) throw ErrorInfo(Tr::tr("Cannot reuse the name of built-in extension '%1'.").arg(as), toCodeLocation(m_file->filePath(), import->importIdToken)); if (Q_UNLIKELY(!m_importAsNames.insert(as).second)) { throw ErrorInfo(Tr::tr("Cannot import into the same name more than once."), toCodeLocation(m_file->filePath(), import->importIdToken)); } } if (!import->fileName.isNull()) { QString filePath = FileInfo::resolvePath(m_directory, import->fileName.toString()); QFileInfo fi(filePath); if (Q_UNLIKELY(!fi.exists())) throw ErrorInfo(Tr::tr("Cannot find imported file %0.") .arg(QDir::toNativeSeparators(filePath)), CodeLocation(m_file->filePath(), import->fileNameToken.startLine, import->fileNameToken.startColumn)); filePath = fi.canonicalFilePath(); if (fi.isDir()) { collectPrototypesAndJsCollections(filePath, as, toCodeLocation(m_file->filePath(), import->fileNameToken)); } else { if (filePath.endsWith(QStringLiteral(".js"), Qt::CaseInsensitive)) { JsImport &jsImport = m_jsImports[as]; jsImport.scopeName = as; jsImport.filePaths.push_back(filePath); jsImport.location = toCodeLocation(m_file->filePath(), import->firstSourceLocation()); } else if (filePath.endsWith(QStringLiteral(".qbs"), Qt::CaseInsensitive)) { m_typeNameToFile.insert(QStringList(as), filePath); } else { throw ErrorInfo(Tr::tr("Can only import .qbs and .js files"), CodeLocation(m_file->filePath(), import->fileNameToken.startLine, import->fileNameToken.startColumn)); } } } else if (!importUri.empty()) { const QString importPath = isBase ? QStringLiteral("qbs/base") : importUri.join(QDir::separator()); bool found = m_typeNameToFile.contains(importUri); if (!found) { const auto searchPaths = m_file->searchPaths(); for (const QString &searchPath : searchPaths) { const QFileInfo fi(FileInfo::resolvePath( FileInfo::resolvePath(searchPath, StringConstants::importsDir()), importPath)); if (fi.isDir()) { // ### versioning, qbsdir file, etc. const QString &resultPath = fi.absoluteFilePath(); collectPrototypesAndJsCollections(resultPath, as, toCodeLocation(m_file->filePath(), import->fileNameToken)); found = true; break; } } } if (Q_UNLIKELY(!found)) { throw ErrorInfo(Tr::tr("import %1 not found") .arg(importUri.join(QLatin1Char('.'))), toCodeLocation(m_file->filePath(), import->fileNameToken)); } } } Version ASTImportsHandler::readImportVersion(const QString &str, const CodeLocation &location) { const Version v = Version::fromString(str); if (Q_UNLIKELY(!v.isValid())) throw ErrorInfo(Tr::tr("Cannot parse version number in import statement."), location); if (Q_UNLIKELY(v.patchLevel() != 0)) { throw ErrorInfo(Tr::tr("Version number in import statement cannot have more than " "two components."), location); } return v; } bool ASTImportsHandler::addPrototype(const QString &fileName, const QString &filePath, const QString &as, bool needsCheck) { if (needsCheck && fileName.size() <= 4) return false; const QString componentName = fileName.left(fileName.size() - 4); // ### validate componentName if (needsCheck && !componentName.at(0).isUpper()) return false; QStringList prototypeName; if (!as.isEmpty()) prototypeName.push_back(as); prototypeName.push_back(componentName); if (!m_typeNameToFile.contains(prototypeName)) m_typeNameToFile.insert(prototypeName, filePath); return true; } void ASTImportsHandler::checkImportVersion(const QbsQmlJS::AST::SourceLocation &versionToken) const { if (!versionToken.length) return; const QString importVersionString = m_file->content().mid(versionToken.offset, versionToken.length); const Version importVersion = readImportVersion(importVersionString, toCodeLocation(m_file->filePath(), versionToken)); if (Q_UNLIKELY(importVersion != BuiltinDeclarations::instance().languageVersion())) throw ErrorInfo(Tr::tr("Incompatible qbs language version %1. This is version %2.").arg( importVersionString, BuiltinDeclarations::instance().languageVersion().toString()), toCodeLocation(m_file->filePath(), versionToken)); } void ASTImportsHandler::collectPrototypes(const QString &path, const QString &as) { QStringList fileNames; // Yes, file *names*. m_visitorState.findDirectoryEntries(path, &fileNames); for (const QString &fileName : std::as_const(fileNames)) addPrototype(fileName, path + QLatin1Char('/') + fileName, as, false); } void ASTImportsHandler::collectPrototypesAndJsCollections(const QString &path, const QString &as, const CodeLocation &location) { collectPrototypes(path, as); QDirIterator dirIter(path, StringConstants::jsFileWildcards()); while (dirIter.hasNext()) { dirIter.next(); JsImport &jsImport = m_jsImports[as]; if (jsImport.scopeName.isNull()) { jsImport.scopeName = as; jsImport.location = location; } jsImport.filePaths.push_back(dirIter.filePath()); } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/loader/itemreaderastvisitor.cpp0000644000175100017510000004167115154533055023712 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "itemreaderastvisitor.h" #include "astimportshandler.h" #include "astpropertiesitemhandler.h" #include "itemreadervisitorstate.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace QbsQmlJS; namespace qbs { namespace Internal { ItemReaderASTVisitor::ItemReaderASTVisitor(ItemReaderVisitorState &visitorState, FileContextPtr file, ItemPool *itemPool, Logger &logger) : m_visitorState(visitorState) , m_file(std::move(file)) , m_itemPool(itemPool) , m_logger(logger) { } ItemReaderASTVisitor::~ItemReaderASTVisitor() = default; bool ItemReaderASTVisitor::visit(AST::UiProgram *uiProgram) { ASTImportsHandler importsHandler(m_visitorState, m_logger, m_file); importsHandler.handleImports(uiProgram->imports); m_typeNameToFile = importsHandler.typeNameFileMap(); return true; } static ItemValuePtr findItemProperty(const Item *container, const Item *item) { ItemValuePtr itemValue; const auto &srcprops = container->properties(); auto it = std::find_if(srcprops.begin(), srcprops.end(), [item] (const ValuePtr &v) { return v->type() == Value::ItemValueType && std::static_pointer_cast(v)->item() == item; }); if (it != srcprops.end()) itemValue = std::static_pointer_cast(it.value()); return itemValue; } bool ItemReaderASTVisitor::visit(AST::UiObjectDefinition *ast) { const QString typeName = ast->qualifiedTypeNameId->name.toString(); const CodeLocation itemLocation = toCodeLocation(ast->qualifiedTypeNameId->identifierToken); const Item *baseItem = nullptr; Item *mostDerivingItem = nullptr; Item *item = Item::create(m_itemPool, ItemType::Unknown); item->setFile(m_file); item->setLocation(itemLocation); const AST::SourceLocation &endLoc = ast->lastSourceLocation(); item->setEndPosition(CodePosition(endLoc.startLine, endLoc.startColumn)); // Inheritance resolving, part 1: Find out our actual type name (needed for setting // up children and alternatives). const QStringList fullTypeName = toStringList(ast->qualifiedTypeNameId); const QString baseTypeFileName = m_typeNameToFile.value(fullTypeName); ItemType itemType; if (!baseTypeFileName.isEmpty()) { const bool isMostDerivingItem = (m_visitorState.mostDerivingItem() == nullptr); if (isMostDerivingItem) m_visitorState.setMostDerivingItem(item); mostDerivingItem = m_visitorState.mostDerivingItem(); baseItem = m_visitorState.readFile(baseTypeFileName, m_file->searchPaths(), m_itemPool); if (isMostDerivingItem) m_visitorState.setMostDerivingItem(nullptr); QBS_CHECK(baseItem->type() <= ItemType::LastActualItem); itemType = baseItem->type(); const AST::SourceLocation startLoc = ast->qualifiedTypeNameId->firstSourceLocation(); const AST::SourceLocation endLoc = ast->qualifiedTypeNameId->lastSourceLocation(); const CodeRange sourceRange( CodePosition(startLoc.startLine, startLoc.startColumn), CodePosition(endLoc.startLine, endLoc.startColumn + endLoc.length)); m_visitorState.addCodeLink(m_file->filePath(), sourceRange, baseItem->location()); } else { if (fullTypeName.size() > 1) { throw ErrorInfo(Tr::tr("Invalid item '%1'. Did you mean to set a module property?") .arg(fullTypeName.join(QLatin1Char('.'))), itemLocation); } itemType = BuiltinDeclarations::instance().typeForName(typeName, itemLocation); checkDeprecationStatus(itemType, typeName, itemLocation); if (itemType == ItemType::Properties && m_item && m_item->type() == ItemType::SubProject) itemType = ItemType::PropertiesInSubProject; } item->m_type = itemType; if (m_item) { Item::addChild(m_item, item); // Add this item to the children of the parent item. } else { m_item = item; // This is the root item. if (itemType == ItemType::Module) { QBS_CHECK(!m_moduleItemLocker); m_moduleItemLocker = std::make_unique(*m_item); } } if (ast->initializer) { Item *mdi = m_visitorState.mostDerivingItem(); m_visitorState.setMostDerivingItem(nullptr); qSwap(m_item, item); const ItemType oldInstanceItemType = m_instanceItemType; if (itemType == ItemType::Parameters || itemType == ItemType::Depends) m_instanceItemType = ItemType::ModuleParameters; ast->initializer->accept(this); m_instanceItemType = oldInstanceItemType; qSwap(m_item, item); m_visitorState.setMostDerivingItem(mdi); } ASTPropertiesItemHandler(item, *m_itemPool, m_logger).handlePropertiesItems(); // Inheritance resolving, part 2 (depends on alternatives having been set up). if (baseItem) { inheritItem(item, baseItem); if (baseItem->file()->idScope()) { // Make ids from the derived file visible in the base file. // ### Do we want to turn off this feature? It's QMLish but kind of strange. item->file()->ensureIdScope(m_itemPool); baseItem->file()->idScope()->setPrototype(item->file()->idScope()); // Replace the base item with the most deriving item. ItemValuePtr baseItemIdValue = findItemProperty(baseItem->file()->idScope(), baseItem); if (baseItemIdValue) baseItemIdValue->setItem(mostDerivingItem); } } else { // Only the item at the top of the inheritance chain is a built-in item. // We cannot do this in "part 1", because then the visitor would complain about duplicate // bindings. item->setupForBuiltinType(m_visitorState.deprecationWarningMode(), m_logger); } return false; } void ItemReaderASTVisitor::checkDuplicateBinding(Item *item, const QStringList &bindingName, const AST::SourceLocation &sourceLocation) { if (Q_UNLIKELY(item->hasOwnProperty(bindingName.last()))) { QString msg = Tr::tr("Duplicate binding for '%1'"); throw ErrorInfo(msg.arg(bindingName.join(QLatin1Char('.'))), toCodeLocation(sourceLocation)); } } bool ItemReaderASTVisitor::visit(AST::UiPublicMember *ast) { PropertyDeclaration p; if (Q_UNLIKELY(ast->name.isEmpty())) throw ErrorInfo(Tr::tr("public member without name")); if (Q_UNLIKELY(ast->memberType.isEmpty())) throw ErrorInfo(Tr::tr("public member without type")); if (Q_UNLIKELY(ast->type == AST::UiPublicMember::Signal)) throw ErrorInfo(Tr::tr("public member with signal type not supported")); p.setName(ast->name.toString()); p.setLocation(toCodeLocation(ast->identifierToken)); p.setType(PropertyDeclaration::propertyTypeFromString(ast->memberType.toString())); if (p.type() == PropertyDeclaration::UnknownType) { throw ErrorInfo(Tr::tr("Unknown type '%1' in property declaration.") .arg(ast->memberType.toString()), toCodeLocation(ast->typeToken)); } if (Q_UNLIKELY(!ast->typeModifier.isEmpty())) { throw ErrorInfo(Tr::tr("public member with type modifier '%1' not supported").arg( ast->typeModifier.toString())); } if (ast->isReadonlyMember) p.setFlags(PropertyDeclaration::ReadOnlyFlag); m_item->m_propertyDeclarations.insert(p.name(), p); const JSSourceValuePtr value = JSSourceValue::create(); value->setFile(m_file); if (ast->statement) { handleBindingRhs(ast->statement, value); const QStringList bindingName(p.name()); checkDuplicateBinding(m_item, bindingName, ast->colonToken); } m_item->setProperty(p.name(), value); return false; } bool ItemReaderASTVisitor::visit(AST::UiScriptBinding *ast) { QBS_CHECK(ast->qualifiedId); QBS_CHECK(!ast->qualifiedId->name.isEmpty()); const QStringList bindingName = toStringList(ast->qualifiedId); if (bindingName.length() == 1 && bindingName.front() == QStringLiteral("id")) { const auto * const expStmt = AST::cast(ast->statement); if (Q_UNLIKELY(!expStmt)) throw ErrorInfo(Tr::tr("id: must be followed by identifier")); const auto * const idExp = AST::cast(expStmt->expression); if (Q_UNLIKELY(!idExp || idExp->name.isEmpty())) throw ErrorInfo(Tr::tr("id: must be followed by identifier")); if (m_item->type() == ItemType::Module) throw ErrorInfo(Tr::tr("Module items cannot have an id property.")); m_item->m_id = idExp->name.toString(); m_file->ensureIdScope(m_itemPool); ItemValueConstPtr existingId = m_file->idScope()->itemProperty(m_item->id(), *m_itemPool); if (existingId) { ErrorInfo e(Tr::tr("The id '%1' is not unique.").arg(m_item->id())); e.append(Tr::tr("First occurrence is here."), existingId->item()->location()); e.append(Tr::tr("Next occurrence is here."), m_item->location()); throw e; } m_file->idScope()->setProperty(m_item->id(), ItemValue::create(m_item)); return false; } const JSSourceValuePtr value = JSSourceValue::create(); handleBindingRhs(ast->statement, value); Item * const targetItem = targetItemForBinding(bindingName, value); checkDuplicateBinding(targetItem, bindingName, ast->qualifiedId->identifierToken); targetItem->setProperty(bindingName.last(), value); return false; } bool ItemReaderASTVisitor::handleBindingRhs(AST::Statement *statement, const JSSourceValuePtr &value) { QBS_CHECK(statement); QBS_CHECK(value); if (AST::cast(statement)) value->setHasFunctionForm(); value->setFile(m_file); value->setSourceCode(textViewOf(m_file->content(), statement)); value->setLocation(statement->firstSourceLocation().startLine, statement->firstSourceLocation().startColumn); bool usesBase, usesOuter, usesOriginal; IdentifierSearch idsearch; idsearch.add(StringConstants::baseVar(), &usesBase); idsearch.add(StringConstants::outerVar(), &usesOuter); idsearch.add(StringConstants::originalVar(), &usesOriginal); idsearch.start(statement); if (usesBase) value->setSourceUsesBase(); if (usesOuter) value->setSourceUsesOuter(); if (usesOriginal) value->setSourceUsesOriginal(); return false; } CodeLocation ItemReaderASTVisitor::toCodeLocation(const AST::SourceLocation &location) const { return CodeLocation(m_file->filePath(), location.startLine, location.startColumn); } Item *ItemReaderASTVisitor::targetItemForBinding(const QStringList &bindingName, const JSSourceValueConstPtr &value) { Item *targetItem = m_item; const int c = bindingName.size() - 1; for (int i = 0; i < c; ++i) { ValuePtr v = targetItem->ownProperty(bindingName.at(i)); if (!v) { const ItemType itemType = i < c - 1 ? ItemType::ModulePrefix : m_instanceItemType; Item *newItem = Item::create(m_itemPool, itemType); newItem->setLocation(value->location()); v = ItemValue::create(newItem); targetItem->setProperty(bindingName.at(i), v); } if (Q_UNLIKELY(v->type() != Value::ItemValueType)) { QString msg = Tr::tr("Binding to non-item property."); throw ErrorInfo(msg, value->location()); } targetItem = std::static_pointer_cast(v)->item(); } return targetItem; } void ItemReaderASTVisitor::inheritItem(Item *dst, const Item *src) { int insertPos = 0; for (Item *child : std::as_const(src->m_children)) { dst->m_children.insert(insertPos++, child); child->m_parent = dst; } for (const PropertyDeclaration &pd : src->propertyDeclarations()) { if (pd.flags().testFlag(PropertyDeclaration::ReadOnlyFlag) && dst->hasOwnProperty(pd.name())) { throw ErrorInfo(Tr::tr("Cannot set read-only property '%1'.").arg(pd.name()), dst->property(pd.name())->location()); } dst->setPropertyDeclaration(pd.name(), pd); } std::unique_ptr locker; if (src->type() == ItemType::Module) locker = std::make_unique(*src); for (auto it = src->properties().constBegin(); it != src->properties().constEnd(); ++it) { ValuePtr &v = dst->m_properties[it.key()]; if (!v) { v = it.value(); continue; } if (v->type() == Value::ItemValueType && it.value()->type() != Value::ItemValueType) throw ErrorInfo(Tr::tr("Binding to non-item property."), v->location()); if (v->type() != it.value()->type()) continue; switch (v->type()) { case Value::JSSourceValueType: { JSSourceValuePtr sv = std::static_pointer_cast(v); QBS_CHECK(!sv->baseValue()); const JSSourceValuePtr baseValue = std::static_pointer_cast(it.value()); sv->setBaseValue(baseValue); for (const JSSourceValue::Alternative &alt : sv->m_alternatives) alt.value->setBaseValue(baseValue); break; } case Value::ItemValueType: inheritItem(std::static_pointer_cast(v)->item(), std::static_pointer_cast(it.value())->item()); break; default: QBS_CHECK(!"unexpected value type"); } } } void ItemReaderASTVisitor::checkDeprecationStatus(ItemType itemType, const QString &itemName, const CodeLocation &itemLocation) { const ItemDeclaration itemDecl = BuiltinDeclarations::instance().declarationsForType(itemType); const ErrorInfo error = itemDecl.checkForDeprecation(m_visitorState.deprecationWarningMode(), itemName, itemLocation, m_logger); if (error.hasError()) throw error; } void ItemReaderASTVisitor::doCheckItemTypes(const Item *item) { const ItemDeclaration decl = BuiltinDeclarations::instance().declarationsForType(item->type()); for (const Item * const child : item->children()) { if (!decl.isChildTypeAllowed(child->type())) { throw ErrorInfo(Tr::tr("Items of type '%1' cannot contain items of type '%2'.") .arg(item->typeName(), child->typeName()), child->location()); } doCheckItemTypes(child); } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/loader/productscollector.cpp0000644000175100017510000010623015154533055023204 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #include "productscollector.h" #include "dependenciesresolver.h" #include "itemreader.h" #include "loaderutils.h" #include "localprofiles.h" #include "productitemmultiplexer.h" #include "probesresolver.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs::Internal { class ProductsCollector::Private { public: Private(LoaderState &loaderState) : loaderState(loaderState) {} void handleProject(Item *projectItem, ProjectContext *parentProject, const Set &referencedFilePaths); QList multiplexProductItem(ProductContext &dummyContext, Item *productItem); void prepareProduct(ProjectContext &projectContext, Item *productItem, ProductContext *mainProduct = nullptr); void handleSubProject(ProjectContext &projectContext, Item *projectItem, const Set &referencedFilePaths); enum class PropertyFilter { All, BuiltIns }; void copyProperties(const Item *sourceProject, Item *targetProject, PropertyFilter filter); QList loadReferencedFile( const QString &relativePath, const CodeLocation &referencingLocation, const Set &referencedFilePaths, ProductContext &dummyContext); bool mergeExportItems(ProductContext &productContext); bool checkExportItemCondition(Item *exportItem, const ProductContext &product); void initProductProperties(const ProductContext &product); void checkProjectNamesInOverrides(); void collectProductsByNameAndItem(); void checkProductNamesInOverrides(); void mergeProperty(Item *dst, const QString &name, const ValuePtr &value); LoaderState &loaderState; Settings settings{loaderState.parameters().settingsDirectory()}; Set disabledProjects; Version qbsVersion; Item *tempScopeItem = nullptr; private: // TODO: Put this in loaderutils class TempBaseModuleAttacher { public: TempBaseModuleAttacher(Private *d, ProductContext &product); ~TempBaseModuleAttacher() { drop(); } void drop(); Item *tempBaseModuleItem() const { return m_tempBaseModule; } private: Item * const m_productItem; ValuePtr m_origQbsValue; Item *m_tempBaseModule = nullptr; }; }; ProductsCollector::ProductsCollector(LoaderState &loaderState) : d(makePimpl(loaderState)) {} ProductsCollector::~ProductsCollector() = default; void ProductsCollector::run(Item *rootProject) { d->handleProject(rootProject, nullptr, {rootProject->file()->filePath()}); d->checkProjectNamesInOverrides(); d->collectProductsByNameAndItem(); d->checkProductNamesInOverrides(); d->loaderState.topLevelProject().checkForLocalProfileAsTopLevelProfile( d->loaderState.parameters().topLevelProfile()); } void ProductsCollector::Private::handleProject(Item *projectItem, ProjectContext *parentProject, const Set &referencedFilePaths) { const SetupProjectParameters ¶meters = loaderState.parameters(); Evaluator &evaluator = loaderState.evaluator(); Logger &logger = loaderState.logger(); ItemReader &itemReader = loaderState.itemReader(); TopLevelProjectContext &topLevelProject = loaderState.topLevelProject(); auto p = std::make_unique(); auto &projectContext = *p; projectContext.item = projectItem; projectContext.parent = parentProject; projectContext.topLevelProject = &topLevelProject; ItemValuePtr itemValue = ItemValue::create(projectItem); projectContext.scope = Item::create(&loaderState.itemPool(), ItemType::Scope); projectContext.scope->setFile(projectItem->file()); projectContext.scope->setProperty(StringConstants::projectVar(), itemValue); ProductContext dummyProduct; dummyProduct.project = &projectContext; dummyProduct.moduleProperties = parameters.finalBuildConfigurationTree(); dummyProduct.profileModuleProperties = dummyProduct.moduleProperties; dummyProduct.profileName = parameters.topLevelProfile(); loadBaseModule(dummyProduct, projectItem, loaderState); projectItem->overrideProperties(parameters.overriddenValuesTree(), StringConstants::projectPrefix(), parameters, logger); projectContext.name = evaluator.stringValue(projectItem, StringConstants::nameProperty()); if (projectContext.name.isEmpty()) { projectContext.name = FileInfo::baseName(projectItem->location().filePath()); projectItem->setProperty(StringConstants::nameProperty(), VariantValue::create(projectContext.name)); } if (parentProject) parentProject->children.push_back(p.get()); topLevelProject.addProject(p.release()); projectItem->overrideProperties(parameters.overriddenValuesTree(), StringConstants::projectsOverridePrefix() + projectContext.name, parameters, logger); if (!topLevelProject.checkItemCondition(projectItem, evaluator)) { disabledProjects.insert(projectContext.name); return; } SearchPathsManager searchPathsManager(itemReader, itemReader.readExtraSearchPaths(projectItem) << projectItem->file()->dirPath()); projectContext.searchPathsStack = itemReader.extraSearchPathsStack(); const QString minVersionStr = evaluator.stringValue(projectItem, StringConstants::minimumQbsVersionProperty(), QStringLiteral("1.3.0")); const Version minVersion = Version::fromString(minVersionStr); if (!minVersion.isValid()) { throw ErrorInfo(Tr::tr("The value '%1' of Project.minimumQbsVersion " "is not a valid version string.") .arg(minVersionStr), projectItem->location()); } if (!qbsVersion.isValid()) qbsVersion = Version::fromString(QLatin1String(QBS_VERSION)); if (qbsVersion < minVersion) { throw ErrorInfo(Tr::tr("The project requires at least qbs version %1, but " "this is qbs version %2.").arg(minVersion.toString(), qbsVersion.toString())); } for (Item * const child : projectItem->children()) child->setScope(projectContext.scope); ProbesResolver(loaderState).resolveProbes(dummyProduct, projectItem); collectProfilesFromItems(projectItem, projectContext.scope, loaderState); QList multiplexedProducts; for (Item * const child : projectItem->children()) { if (child->type() == ItemType::Product) multiplexedProducts << multiplexProductItem(dummyProduct, child); } for (Item * const additionalProductItem : std::as_const(multiplexedProducts)) Item::addChild(projectItem, additionalProductItem); const QList originalChildren = projectItem->children(); for (Item * const child : originalChildren) { switch (child->type()) { case ItemType::Product: prepareProduct(projectContext, child); break; case ItemType::SubProject: handleSubProject(projectContext, child, referencedFilePaths); break; case ItemType::Project: copyProperties(projectItem, child, PropertyFilter::All); handleProject(child, &projectContext, referencedFilePaths); break; default: break; } } const QStringList refs = evaluator.stringListValue( projectItem, StringConstants::referencesProperty()); const CodeLocation referencingLocation = projectItem->property(StringConstants::referencesProperty())->location(); QList additionalProjectChildren; for (const QString &filePath : refs) { try { additionalProjectChildren << loadReferencedFile( filePath, referencingLocation, referencedFilePaths, dummyProduct); } catch (const ErrorInfo &error) { if (parameters.productErrorMode() == ErrorHandlingMode::Strict) throw; logger.printError(error); } } for (Item * const subItem : std::as_const(additionalProjectChildren)) { Item::addChild(projectContext.item, subItem); switch (subItem->type()) { case ItemType::Product: prepareProduct(projectContext, subItem); break; case ItemType::Project: copyProperties(projectItem, subItem, PropertyFilter::All); handleProject(subItem, &projectContext, Set(referencedFilePaths) << subItem->file()->filePath()); break; default: break; } } } QList ProductsCollector::Private::multiplexProductItem(ProductContext &dummyContext, Item *productItem) { // Overriding the product item properties must be done here already, because multiplexing // properties might depend on product properties. const QString &nameKey = StringConstants::nameProperty(); QString productName = loaderState.evaluator().stringValue(productItem, nameKey); if (productName.isEmpty()) { productName = FileInfo::completeBaseName(productItem->file()->filePath()); productItem->setProperty(nameKey, VariantValue::create(productName)); } productItem->overrideProperties(loaderState.parameters().overriddenValuesTree(), StringConstants::productsOverridePrefix() + productName, loaderState.parameters(), loaderState.logger()); dummyContext.item = productItem; TempBaseModuleAttacher tbma(this, dummyContext); return multiplex(productName, productItem, tbma.tempBaseModuleItem(), [&] { tbma.drop(); }, loaderState); } void ProductsCollector::Private::prepareProduct(ProjectContext &projectContext, Item *productItem, ProductContext *mainProduct) { const SetupProjectParameters ¶meters = loaderState.parameters(); Evaluator &evaluator = loaderState.evaluator(); TopLevelProjectContext &topLevelProject = loaderState.topLevelProject(); AccumulatingTimer timer(parameters.logElapsedTime() ? &topLevelProject.timingData().preparingProducts : nullptr); topLevelProject.checkCancelation(); qCDebug(lcModuleLoader) << "prepareProduct" << productItem->file()->filePath(); if (mainProduct) mainProduct->shadowProduct = std::make_unique(); else projectContext.products.emplace_back(); ProductContext &productContext = mainProduct ? *mainProduct->shadowProduct : projectContext.products.back(); productContext.item = productItem; productContext.project = &projectContext; // Retrieve name, profile and multiplex id. productContext.name = evaluator.stringValue(productItem, StringConstants::nameProperty()); QBS_CHECK(!productContext.name.isEmpty()); const ItemValueConstPtr qbsItemValue = productItem->itemProperty(StringConstants::qbsModule(), loaderState.itemPool()); if (qbsItemValue && qbsItemValue->item()->hasProperty(StringConstants::profileProperty())) { TempBaseModuleAttacher tbma(this, productContext); productContext.profileName = evaluator.stringValue( tbma.tempBaseModuleItem(), StringConstants::profileProperty(), QString()); } else { productContext.profileName = parameters.topLevelProfile(); } productContext.multiplexConfigurationId = evaluator.stringValue( productItem, StringConstants::multiplexConfigurationIdProperty()); QBS_CHECK(!productContext.profileName.isEmpty()); // Set up full module property map based on the profile. std::optional flatConfig = topLevelProject.profileConfig(productContext.profileName); if (!flatConfig) { const Profile profile(productContext.profileName, &settings, loaderState.topLevelProject().localProfiles()); if (!profile.exists()) { ErrorInfo error(Tr::tr("Profile '%1' does not exist.").arg(profile.name()), productItem->location()); productContext.handleError(error); return; } flatConfig = SetupProjectParameters::expandedBuildConfiguration( profile, parameters.configurationName()); topLevelProject.addProfileConfig(productContext.profileName, *flatConfig); } productContext.profileModuleProperties = SetupProjectParameters::finalBuildConfigurationTree( *flatConfig, {}); productContext.moduleProperties = SetupProjectParameters::finalBuildConfigurationTree( *flatConfig, parameters.overriddenValues()); initProductProperties(productContext); // Set up product scope. This is mainly for using the "product" and "project" // variables in some contexts. ItemValuePtr itemValue = ItemValue::create(productItem); productContext.scope = Item::create(&loaderState.itemPool(), ItemType::Scope); productContext.scope->setProperty(StringConstants::productVar(), itemValue); productContext.scope->setFile(productItem->file()); productContext.scope->setScope(productContext.project->scope); // If there are any child items with an id, set up a scope for them. This is mostly // relevant for Probe items. While we might get away with using the file's id scope // in the absence of multiplexing, having a proper per-product scope seems cleaner. QBS_CHECK(productItem->scope()); QBS_CHECK(productItem->scope() == productContext.project->scope); for (Item * const child : productItem->children()) { if (child->id().isEmpty()) continue; if (productItem->scope() == productContext.project->scope) { productItem->setScope(Item::create(&loaderState.itemPool(), ItemType::Scope)); productItem->scope()->setScope(productContext.project->scope); } const ItemValuePtr childValue = ItemValue::create(child); productItem->scope()->setProperty(child->id(), childValue); productContext.scope->setProperty(child->id(), childValue); } const bool hasExportItems = mergeExportItems(productContext); setScopeForDescendants(productItem, productContext.scope, false); if (!hasExportItems) return; // This "shadow product" exists only to pull in a dependency on the actual product // and nothing else, thus providing us with the pure environment that we need to // evaluate the product's exported properties in isolation in the project resolver. Item * const importer = Item::create(&loaderState.itemPool(), ItemType::Product); importer->setProperty( QStringLiteral("name"), VariantValue::create( QString(StringConstants::shadowProductPrefix() + productContext.name))); importer->setFile(productItem->file()); importer->setLocation(productItem->location()); importer->setScope(projectContext.scope); importer->setupForBuiltinType(parameters.deprecationWarningMode(), loaderState.logger()); Item * const dependsItem = Item::create(&loaderState.itemPool(), ItemType::Depends); dependsItem->setProperty(QStringLiteral("name"), VariantValue::create(productContext.name)); dependsItem->setProperty(QStringLiteral("required"), VariantValue::create(false)); dependsItem->setFile(importer->file()); dependsItem->setLocation(importer->location()); dependsItem->setupForBuiltinType(parameters.deprecationWarningMode(), loaderState.logger()); dependsItem->setProperty(StringConstants::multiplexConfigurationIdsProperty(), VariantValue::create(productContext.multiplexConfigurationId)); Item::addChild(importer, dependsItem); prepareProduct(projectContext, importer, &productContext); } void ProductsCollector::Private::handleSubProject( ProjectContext &projectContext, Item *projectItem, const Set &referencedFilePaths) { const SetupProjectParameters ¶meters = loaderState.parameters(); Evaluator &evaluator = loaderState.evaluator(); Logger &logger = loaderState.logger(); ItemReader &itemReader = loaderState.itemReader(); TopLevelProjectContext &topLevelProject = loaderState.topLevelProject(); qCDebug(lcModuleLoader) << "handleSubProject" << projectItem->file()->filePath(); Item * const propertiesItem = projectItem->child(ItemType::PropertiesInSubProject); if (!topLevelProject.checkItemCondition(projectItem, evaluator)) return; if (propertiesItem) { propertiesItem->setScope(projectItem); if (!topLevelProject.checkItemCondition(propertiesItem, evaluator)) return; } Item *loadedItem = nullptr; QString subProjectFilePath; try { const QString projectFileDirPath = FileInfo::path(projectItem->file()->filePath()); const QString relativeFilePath = evaluator.stringValue(projectItem, StringConstants::filePathProperty()); subProjectFilePath = FileInfo::resolvePath(projectFileDirPath, relativeFilePath); if (referencedFilePaths.contains(subProjectFilePath)) throw ErrorInfo(Tr::tr("Cycle detected while loading subproject file '%1'.") .arg(relativeFilePath), projectItem->location()); loadedItem = itemReader.setupItemFromFile(subProjectFilePath, projectItem->location()); } catch (const ErrorInfo &error) { if (parameters.productErrorMode() == ErrorHandlingMode::Strict) throw; logger.printError(error); return; } Item * const loadedProjectItem = itemReader.wrapInProjectIfNecessary(loadedItem); const bool inheritProperties = evaluator.boolValue( projectItem, StringConstants::inheritPropertiesProperty()); copyProperties( projectItem->parent(), loadedProjectItem, inheritProperties ? PropertyFilter::All : PropertyFilter::BuiltIns); if (propertiesItem) { const Item::PropertyMap &overriddenProperties = propertiesItem->properties(); for (auto it = overriddenProperties.begin(); it != overriddenProperties.end(); ++it) loadedItem->setProperty(it.key(), it.value()); } Item::addChild(projectItem, loadedProjectItem); projectItem->setScope(projectContext.scope); handleProject( loadedProjectItem, &projectContext, Set(referencedFilePaths) << subProjectFilePath); } void ProductsCollector::Private::copyProperties( const Item *sourceProject, Item *targetProject, PropertyFilter filter) { if (!sourceProject) return; const QList builtinProjectProperties = BuiltinDeclarations::instance().declarationsForType(ItemType::Project).properties(); Set builtinProjectPropertyNames; for (const PropertyDeclaration &p : builtinProjectProperties) builtinProjectPropertyNames << p.name(); for (auto it = sourceProject->propertyDeclarations().begin(); it != sourceProject->propertyDeclarations().end(); ++it) { // We must not inherit built-in properties such as "name", // but there are exceptions. if (it.key() == StringConstants::qbsSearchPathsProperty() || it.key() == StringConstants::profileProperty() || it.key() == StringConstants::buildDirectoryProperty() || it.key() == StringConstants::sourceDirectoryProperty() || it.key() == StringConstants::minimumQbsVersionProperty()) { const JSSourceValueConstPtr &v = targetProject->sourceProperty(it.key()); QBS_ASSERT(v, continue); if (v->sourceCode() == StringConstants::undefinedValue()) sourceProject->copyProperty(it.key(), targetProject); continue; } if (filter == PropertyFilter::BuiltIns) continue; if (builtinProjectPropertyNames.contains(it.key())) continue; if (targetProject->hasOwnProperty(it.key())) continue; // Ignore stuff the target project already has. targetProject->setPropertyDeclaration(it.key(), it.value()); sourceProject->copyProperty(it.key(), targetProject); } } QList ProductsCollector::Private::loadReferencedFile( const QString &relativePath, const CodeLocation &referencingLocation, const Set &referencedFilePaths, ProductContext &dummyContext) { QString absReferencePath = FileInfo::resolvePath(FileInfo::path(referencingLocation.filePath()), relativePath); if (FileInfo(absReferencePath).isDir()) { QString qbsFilePath; QDirIterator dit(absReferencePath, StringConstants::qbsFileWildcards()); while (dit.hasNext()) { if (!qbsFilePath.isEmpty()) { throw ErrorInfo(Tr::tr("Referenced directory '%1' contains more than one " "qbs file.").arg(absReferencePath), referencingLocation); } qbsFilePath = dit.next(); } if (qbsFilePath.isEmpty()) { throw ErrorInfo(Tr::tr("Referenced directory '%1' does not contain a qbs file.") .arg(absReferencePath), referencingLocation); } absReferencePath = qbsFilePath; } if (referencedFilePaths.contains(absReferencePath)) throw ErrorInfo(Tr::tr("Cycle detected while referencing file '%1'.").arg(relativePath), referencingLocation); Item * const subItem = loaderState.itemReader().setupItemFromFile( absReferencePath, referencingLocation); if (subItem->type() != ItemType::Project && subItem->type() != ItemType::Product) { ErrorInfo error(Tr::tr("Item type should be 'Product' or 'Project', but is '%1'.") .arg(subItem->typeName())); error.append(Tr::tr("Item is defined here."), subItem->location()); error.append(Tr::tr("File is referenced here."), referencingLocation); throw error; } subItem->setScope(dummyContext.project->scope); subItem->setParent(dummyContext.project->item); QList loadedItems; loadedItems << subItem; if (subItem->type() == ItemType::Product) { collectProfilesFromItems(subItem, dummyContext.project->scope, loaderState); loadedItems << multiplexProductItem(dummyContext, subItem); } return loadedItems; } void ProductsCollector::Private::mergeProperty(Item *dst, const QString &name, const ValuePtr &value) { if (value->type() == Value::ItemValueType) { const ItemValueConstPtr itemValue = std::static_pointer_cast(value); const Item * const valueItem = itemValue->item(); Item * const subItem = dst->itemProperty(name, itemValue, loaderState.itemPool())->item(); for (auto it = valueItem->properties().begin(); it != valueItem->properties().end(); ++it) mergeProperty(subItem, it.key(), it.value()); return; } // If the property already exists, set up the base value. if (value->type() == Value::JSSourceValueType) { const auto jsValue = static_cast(value.get()); if (jsValue->isBuiltinDefaultValue()) return; const ValuePtr baseValue = dst->property(name); if (baseValue) { QBS_CHECK(baseValue->type() == Value::JSSourceValueType); const JSSourceValuePtr jsBaseValue = std::static_pointer_cast( baseValue->clone(loaderState.itemPool())); jsValue->setBaseValue(jsBaseValue); std::vector alternatives = jsValue->alternatives(); jsValue->clearAlternatives(); for (JSSourceValue::Alternative &a : alternatives) { a.value->setBaseValue(jsBaseValue); jsValue->addAlternative(a); } } } dst->setProperty(name, value); } bool ProductsCollector::Private::mergeExportItems(ProductContext &productContext) { const SetupProjectParameters ¶meters = loaderState.parameters(); Evaluator &evaluator = loaderState.evaluator(); Logger &logger = loaderState.logger(); TopLevelProjectContext &topLevelProject = loaderState.topLevelProject(); std::vector exportItems; QList children = productContext.item->children(); const auto isExport = [](Item *item) { return item->type() == ItemType::Export; }; std::copy_if(children.cbegin(), children.cend(), std::back_inserter(exportItems), isExport); qbs::Internal::removeIf(children, isExport); // Note that we do not return if there are no Export items: The "merged" item becomes the // "product module", which always needs to exist, regardless of whether the product sources // actually contain an Export item or not. if (!exportItems.empty()) productContext.item->setChildren(children); Item *merged = Item::create(&loaderState.itemPool(), ItemType::Export); const QString &nameKey = StringConstants::nameProperty(); const ValuePtr nameValue = VariantValue::create(productContext.name); merged->setProperty(nameKey, nameValue); Set filesWithExportItem; QVariantMap defaultParameters; for (Item * const exportItem : exportItems) { topLevelProject.checkCancelation(); if (Q_UNLIKELY(filesWithExportItem.contains(exportItem->file()))) throw ErrorInfo(Tr::tr("Multiple Export items in one product are prohibited."), exportItem->location()); exportItem->setProperty(nameKey, nameValue); if (!checkExportItemCondition(exportItem, productContext)) continue; filesWithExportItem += exportItem->file(); for (Item * const child : exportItem->children()) { if (child->type() == ItemType::Parameters) { adjustParametersScopes(child, child); defaultParameters = mergeDependencyParameters(defaultParameters, getJsVariant(evaluator.engine()->context(), evaluator.scriptValue(child)).toMap()); } else { Item::addChild(merged, child); } } const Item::PropertyDeclarationMap &decls = exportItem->propertyDeclarations(); for (auto it = decls.constBegin(); it != decls.constEnd(); ++it) { const PropertyDeclaration &newDecl = it.value(); const PropertyDeclaration &existingDecl = merged->propertyDeclaration(it.key()); if (existingDecl.isValid() && existingDecl.type() != newDecl.type()) { ErrorInfo error(Tr::tr("Export item in inherited item redeclares property " "'%1' with different type.").arg(it.key()), exportItem->location()); handlePropertyError(error, parameters, logger); } merged->setPropertyDeclaration(newDecl.name(), newDecl); } for (QMap::const_iterator it = exportItem->properties().constBegin(); it != exportItem->properties().constEnd(); ++it) { mergeProperty(merged, it.key(), it.value()); } } merged->setFile(exportItems.empty() ? productContext.item->file() : exportItems.back()->file()); merged->setLocation(exportItems.empty() ? productContext.item->location() : exportItems.back()->location()); Item::addChild(productContext.item, merged); merged->setupForBuiltinType(parameters.deprecationWarningMode(), logger); productContext.mergedExportItem = merged; productContext.defaultParameters = defaultParameters; return !exportItems.empty(); } // TODO: This seems dubious. Can we merge the conditions instead? bool ProductsCollector::Private::checkExportItemCondition(Item *exportItem, const ProductContext &product) { class ScopeHandler { public: ScopeHandler(Item *exportItem, const ProductContext &productContext, Item **cachedScopeItem, ItemPool &itemPool) : m_exportItem(exportItem), m_itemPool(itemPool) { if (!*cachedScopeItem) *cachedScopeItem = Item::create(&m_itemPool, ItemType::Scope); Item * const scope = *cachedScopeItem; QBS_CHECK(productContext.item->file()); scope->setFile(productContext.item->file()); scope->setScope(productContext.item); productContext.project->scope->copyProperty(StringConstants::projectVar(), scope); productContext.scope->copyProperty(StringConstants::productVar(), scope); QBS_CHECK(!exportItem->scope()); exportItem->setScope(scope); } ~ScopeHandler() { m_exportItem->setScope(nullptr); } private: Item * const m_exportItem; ItemPool &m_itemPool; } scopeHandler(exportItem, product, &tempScopeItem, loaderState.itemPool()); return loaderState.topLevelProject().checkItemCondition(exportItem, loaderState.evaluator()); } void ProductsCollector::Private::initProductProperties(const ProductContext &product) { QString buildDir = ResolvedProduct::deriveBuildDirectoryName(product.name, product.multiplexConfigurationId); buildDir = FileInfo::resolvePath(product.project->topLevelProject->buildDirectory(), buildDir); product.item->setProperty(StringConstants::buildDirectoryProperty(), VariantValue::create(buildDir)); const QString sourceDir = QFileInfo(product.item->file()->filePath()).absolutePath(); product.item->setProperty(StringConstants::sourceDirectoryProperty(), VariantValue::create(sourceDir)); } void ProductsCollector::Private::checkProjectNamesInOverrides() { for (const QString &projectNameInOverride : loaderState.topLevelProject().projectNamesUsedInOverrides()) { if (disabledProjects.contains(projectNameInOverride)) continue; if (!any_of(loaderState.topLevelProject().projects(), [&projectNameInOverride](const ProjectContext *p) { return p->name == projectNameInOverride; })) { handlePropertyError(Tr::tr("Unknown project '%1' in property override.") .arg(projectNameInOverride), loaderState.parameters(), loaderState.logger()); } } } void ProductsCollector::Private::collectProductsByNameAndItem() { TopLevelProjectContext &topLevelProject = loaderState.topLevelProject(); for (ProjectContext * const project : topLevelProject.projects()) { for (ProductContext &product : project->products) topLevelProject.addProduct(product); } } void ProductsCollector::Private::checkProductNamesInOverrides() { TopLevelProjectContext &topLevelProject = loaderState.topLevelProject(); for (const QString &productNameInOverride : topLevelProject.productNamesUsedInOverrides()) { if (!topLevelProject.productWithNameAndConstraint( productNameInOverride, [&productNameInOverride](const ProductContext &product) { // In an override string such as "a.b.c:d, we cannot tell whether we have a product // "a" and a module "b.c" or a product "a.b" and a module "c", so we need to take // care not to emit false positives here. return product.name == productNameInOverride || product.name.startsWith(productNameInOverride + StringConstants::dot()); })) { handlePropertyError(Tr::tr("Unknown product '%1' in property override.") .arg(productNameInOverride), loaderState.parameters(), loaderState.logger()); } } } ProductsCollector::Private::TempBaseModuleAttacher::TempBaseModuleAttacher( ProductsCollector::Private *d, ProductContext &product) : m_productItem(product.item) { const ValuePtr qbsValue = m_productItem->property(StringConstants::qbsModule()); // Cloning is necessary because the original value will get "instantiated" now. if (qbsValue) m_origQbsValue = qbsValue->clone(d->loaderState.itemPool()); m_tempBaseModule = loadBaseModule(product, m_productItem, d->loaderState); } void ProductsCollector::Private::TempBaseModuleAttacher::drop() { if (!m_tempBaseModule) return; // "Unload" the qbs module again. if (m_origQbsValue) m_productItem->setProperty(StringConstants::qbsModule(), m_origQbsValue); else m_productItem->removeProperty(StringConstants::qbsModule()); m_productItem->removeModules(); m_tempBaseModule = nullptr; } } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/itemreadervisitorstate.cpp0000644000175100017510000001345115154533055024236 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "itemreadervisitorstate.h" #include "itemreaderastvisitor.h" #include "loaderutils.h" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { ItemReaderVisitorState::ItemReaderVisitorState(LoaderState &loaderState) : m_loaderState(loaderState) , m_cache(loaderState.topLevelProject().itemReaderCache()) , m_logger(m_loaderState.logger()) {} Item *ItemReaderVisitorState::readFile(const QString &filePath, const QStringList &searchPaths, ItemPool *itemPool) { const auto setupCacheEntry = [&](ItemReaderCache::AstCacheEntry &entry) { QFile file(filePath); if (Q_UNLIKELY(!file.open(QFile::ReadOnly))) throw ErrorInfo(Tr::tr("Cannot open '%1'.").arg(filePath)); QTextStream stream(&file); setupDefaultCodec(stream); const QString &code = stream.readAll(); QbsQmlJS::Lexer lexer(&entry.engine); lexer.setCode(code, 1); QbsQmlJS::Parser parser(&entry.engine); file.close(); if (!parser.parse()) { const QList &parserMessages = parser.diagnosticMessages(); if (Q_UNLIKELY(!parserMessages.empty())) { ErrorInfo err; for (const QbsQmlJS::DiagnosticMessage &msg : parserMessages) err.append(msg.message, toCodeLocation(filePath, msg.loc)); throw err; } } entry.code = code; entry.ast = parser.ast(); }; ItemReaderCache::AstCacheEntry &cacheEntry = m_cache.retrieveOrSetupCacheEntry( filePath, setupCacheEntry); const FileContextPtr file = FileContext::create(); file->setFilePath(QFileInfo(filePath).absoluteFilePath()); file->setContent(cacheEntry.code); file->setSearchPaths(searchPaths); ItemReaderASTVisitor astVisitor(*this, file, itemPool, m_logger); { class ProcessingFlagManager { public: ProcessingFlagManager(ItemReaderCache::AstCacheEntry &e, const QString &filePath) : m_cacheEntry(e) { if (!e.addProcessingThread()) throw ErrorInfo(Tr::tr("Loop detected when importing '%1'.").arg(filePath)); } ~ProcessingFlagManager() { m_cacheEntry.removeProcessingThread(); } private: ItemReaderCache::AstCacheEntry &m_cacheEntry; } processingFlagManager(cacheEntry, filePath); cacheEntry.ast->accept(&astVisitor); } astVisitor.checkItemTypes(); return astVisitor.rootItem(); } void ItemReaderVisitorState::findDirectoryEntries(const QString &dirPath, QStringList *entries) const { *entries = m_cache.retrieveOrSetDirectoryEntries(dirPath, [&dirPath] { QStringList fileNames; QDirIterator dirIter(dirPath, StringConstants::qbsFileWildcards()); while (dirIter.hasNext()) { dirIter.next(); fileNames << dirIter.fileName(); } return fileNames; }); } Item *ItemReaderVisitorState::mostDerivingItem() const { return m_mostDerivingItem; } void ItemReaderVisitorState::setMostDerivingItem(Item *item) { m_mostDerivingItem = item; } DeprecationWarningMode ItemReaderVisitorState::deprecationWarningMode() const { return m_loaderState.parameters().deprecationWarningMode(); } void ItemReaderVisitorState::addCodeLink( const QString &sourceFile, const CodeRange &sourceRange, const CodeLocation &targetLoc) { m_loaderState.topLevelProject().addCodeLink(sourceFile, sourceRange, targetLoc); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/loader/loaderutils.cpp0000644000175100017510000010770215154533055021766 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #include "loaderutils.h" #include "itemreader.h" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs::Internal { QString fullProductDisplayName(const QString &name, const QString &multiplexId) { static const auto multiplexIdToString =[](const QString &id) { return QString::fromUtf8(QByteArray::fromBase64(id.toUtf8())); }; QString result = name; if (!multiplexId.isEmpty()) result.append(QLatin1Char(' ')).append(multiplexIdToString(multiplexId)); return result; } void adjustParametersScopes(Item *item, Item *scope) { if (item->type() == ItemType::ModuleParameters) { item->setScope(scope); return; } for (const auto &value : item->properties()) { if (value->type() == Value::ItemValueType) adjustParametersScopes(std::static_pointer_cast(value)->item(), scope); } } QString ProductContext::uniqueName() const { return ResolvedProduct::uniqueName(name, multiplexConfigurationId); } QString ProductContext::displayName() const { return fullProductDisplayName(name, multiplexConfigurationId); } void ProductContext::handleError(const ErrorInfo &error) { const bool alreadyHadError = delayedError.hasError(); if (!alreadyHadError) { delayedError.append(Tr::tr("Error while handling product '%1':") .arg(name), item->location()); } if (error.isInternalError()) { if (alreadyHadError) { qCDebug(lcModuleLoader()) << "ignoring subsequent internal error" << error.toString() << "in product" << name; return; } } const auto errorItems = error.items(); for (const ErrorItem &ei : errorItems) delayedError.append(ei.description(), ei.codeLocation()); project->topLevelProject->addDisabledItem(item); } TopLevelProjectContext::~TopLevelProjectContext() { qDeleteAll(m_projects); } bool TopLevelProjectContext::checkItemCondition(Item *item, Evaluator &evaluator) { if (evaluator.boolValue(item, StringConstants::conditionProperty())) return true; addDisabledItem(item); return false; } void TopLevelProjectContext::checkCancelation() { if (m_progressObserver && m_progressObserver->canceled()) m_canceled = true; if (m_canceled) throw CancelException(); } QString TopLevelProjectContext::sourceCodeForEvaluation(const JSSourceValueConstPtr &value) { const auto sourceCodeGuard = m_sourceCode.lock(); QString &code = sourceCodeGuard.get()[value->sourceCode()]; if (!code.isNull()) return code; code = value->sourceCodeForEvaluation(); return code; } ScriptFunctionPtr TopLevelProjectContext::scriptFunctionValue(Item *item, const QString &name) { const JSSourceValuePtr value = item->sourceProperty(name); QBS_CHECK(value); const auto scriptFunctionMapGuard = m_scriptFunctionMap.lock(); ScriptFunctionPtr &script = scriptFunctionMapGuard.get()[value->location()]; if (!script.get()) { script = ScriptFunction::create(); const PropertyDeclaration decl = item->propertyDeclaration(name); script->sourceCode = sourceCodeAsFunction(value, decl); script->location = value->location(); script->fileContext = resolvedFileContext(value->file()); } return script; } QString TopLevelProjectContext::sourceCodeAsFunction(const JSSourceValueConstPtr &value, const PropertyDeclaration &decl) { const auto scriptFunctionMapGuard = m_scriptFunctions.lock(); QString &scriptFunction = scriptFunctionMapGuard.get()[std::make_pair(value->sourceCode(), decl.functionArgumentNames())]; if (!scriptFunction.isNull()) return scriptFunction; const QString args = decl.functionArgumentNames().join(QLatin1Char(',')); if (value->hasFunctionForm()) { // Insert the argument list. scriptFunction = value->sourceCodeForEvaluation(); scriptFunction.insert(10, args); // Remove the function application "()" that has been // added in ItemReaderASTVisitor::visitStatement. scriptFunction.chop(2); } else { scriptFunction = QLatin1String("(function(") + args + QLatin1String("){return ") + value->sourceCode().toString() + QLatin1String(";})"); } return scriptFunction; } const ResolvedFileContextPtr &TopLevelProjectContext::resolvedFileContext( const FileContextConstPtr &ctx) { ResolvedFileContextPtr &result = m_fileContextMap[ctx]; if (!result) result = ResolvedFileContext::create(*ctx); return result; } void TopLevelProjectContext::removeProductToHandle(const ProductContext &product) { std::unique_lock lock(m_productsToHandle.mutex); m_productsToHandle.data.remove(&product); } bool TopLevelProjectContext::isProductQueuedForHandling(const ProductContext &product) const { std::shared_lock lock(m_productsToHandle.mutex); return m_productsToHandle.data.contains(&product); } void TopLevelProjectContext::addDisabledItem(Item *item) { m_disabledItems.lock().get() << item; } bool TopLevelProjectContext::isDisabledItem(const Item *item) const { return m_disabledItems.lock_shared().get().contains(item); } void TopLevelProjectContext::setProgressObserver(ProgressObserver *observer) { m_progressObserver = observer; } ProgressObserver *TopLevelProjectContext::progressObserver() const { return m_progressObserver; } void TopLevelProjectContext::addQueuedError(const ErrorInfo &error) { m_queuedErrors.lock().get() << error; } void TopLevelProjectContext::addProfileConfig(const QString &profileName, const QVariantMap &profileConfig) { m_profileConfigs.insert(profileName, profileConfig); } std::optional TopLevelProjectContext::profileConfig(const QString &profileName) const { const auto it = m_profileConfigs.constFind(profileName); if (it == m_profileConfigs.constEnd()) return {}; return it.value().toMap(); } void TopLevelProjectContext::addProjectLevelProbe(const ProbeConstPtr &probe) { m_probesInfo.projectLevelProbes << probe; } const std::vector TopLevelProjectContext::projectLevelProbes() const { return m_probesInfo.projectLevelProbes; } void TopLevelProjectContext::addProduct(ProductContext &product) { m_productsByName.insert({product.name, &product}); } void TopLevelProjectContext::addProductByType(ProductContext &product, const FileTags &tags) { const auto productsByTypeGuard = m_productsByType.lock(); for (const FileTag &tag : tags) productsByTypeGuard.get().insert({tag, &product}); } ProductContext *TopLevelProjectContext::productWithNameAndConstraint( const QString &name, const std::function &constraint) { const auto candidates = m_productsByName.equal_range(name); for (auto it = candidates.first; it != candidates.second; ++it) { ProductContext * const candidate = it->second; if (constraint(*candidate)) return candidate; } return nullptr; } std::vector TopLevelProjectContext::productsWithNameAndConstraint( const QString &name, const std::function &constraint) { std::vector result; const auto candidates = m_productsByName.equal_range(name); for (auto it = candidates.first; it != candidates.second; ++it) { ProductContext * const candidate = it->second; if (constraint(*candidate)) result << candidate; } return result; } std::vector TopLevelProjectContext::productsWithTypeAndConstraint( const FileTags &tags, const std::function &constraint) { const auto productsByTypeGuard = m_productsByType.lock_shared(); std::vector matchingProducts; for (const FileTag &typeTag : tags) { const auto range = productsByTypeGuard.get().equal_range(typeTag); for (auto it = range.first; it != range.second; ++it) { if (constraint(*it->second)) matchingProducts.push_back(it->second); } } return matchingProducts; } std::vector> TopLevelProjectContext::finishedProductsWithBulkDependency(const FileTag &tag) const { return m_reverseBulkDependencies.value(tag); } void TopLevelProjectContext::registerBulkDependencies(ProductContext &product) { for (const auto &tagAndLoc : product.bulkDependencies) { for (const FileTag &tag : tagAndLoc.first) m_reverseBulkDependencies[tag].emplace_back(&product, tagAndLoc.second); } } void TopLevelProjectContext::addProjectNameUsedInOverrides(const QString &name) { m_projectNamesUsedInOverrides << name; } const Set &TopLevelProjectContext::projectNamesUsedInOverrides() const { return m_projectNamesUsedInOverrides; } void TopLevelProjectContext::addProductNameUsedInOverrides(const QString &name) { m_productNamesUsedInOverrides << name; } const Set &TopLevelProjectContext::productNamesUsedInOverrides() const { return m_productNamesUsedInOverrides; } void TopLevelProjectContext::addMultiplexConfiguration(const QString &id, const QVariantMap &config) { m_multiplexConfigsById.insert(std::make_pair(id, config)); } QVariantMap TopLevelProjectContext::multiplexConfiguration(const QString &id) const { if (id.isEmpty()) return {}; const auto it = m_multiplexConfigsById.find(id); QBS_CHECK(it != m_multiplexConfigsById.end() && !it->second.isEmpty()); return it->second; } std::lock_guard TopLevelProjectContext::moduleProvidersCacheLock() { return std::lock_guard(m_moduleProvidersCacheMutex); } void TopLevelProjectContext::setModuleProvidersCache(const ModuleProvidersCache &cache) { m_moduleProvidersCache = cache; } ModuleProviderInfo *TopLevelProjectContext::moduleProvider(const ModuleProvidersCacheKey &key) { if (const auto it = m_moduleProvidersCache.find(key); it != m_moduleProvidersCache.end()) return &it->second; return nullptr; } ModuleProviderInfo &TopLevelProjectContext::addModuleProvider(const ModuleProvidersCacheKey &key, const ModuleProviderInfo &provider) { return m_moduleProvidersCache[key] = provider; } void TopLevelProjectContext::addParameterDeclarations(const Item *moduleProto, const Item::PropertyDeclarationMap &decls) { m_parameterDeclarations.lock().get().insert({moduleProto, decls}); } Item::PropertyDeclarationMap TopLevelProjectContext::parameterDeclarations(Item *moduleProto) const { const auto parameterDeclarationsGuard = m_parameterDeclarations.lock_shared(); const auto &declarations = parameterDeclarationsGuard.get(); if (const auto it = declarations.find(moduleProto); it != declarations.end()) { return it->second; } return {}; } void TopLevelProjectContext::setParameters(const Item *moduleProto, const QVariantMap ¶meters) { m_parameters.lock().get().insert({moduleProto, parameters}); } QVariantMap TopLevelProjectContext::parameters(Item *moduleProto) const { const auto parametersGuard = m_parameters.lock_shared(); const auto ¶meters = parametersGuard.get(); if (const auto it = parameters.find(moduleProto); it != parameters.end()) { return it->second; } return {}; } void TopLevelProjectContext::addCodeLink(const QString &sourceFile, const CodeRange &sourceRange, const CodeLocation &target) { const auto codeLinksGuard = m_codeLinks.lock(); QList &links = codeLinksGuard.get()[sourceFile][sourceRange]; if (!links.contains(target)) links << target; } QString TopLevelProjectContext::findModuleDirectory( const QualifiedId &module, const QString &searchPath, const std::function &findOnDisk) { const auto modulePathCacheGuard = m_modulePathCache.lock(); auto &path = modulePathCacheGuard.get()[{searchPath, module}]; if (!path) path = findOnDisk(); return *path; } QStringList TopLevelProjectContext::getModuleFilesForDirectory( const QString &dir, const std::function &findOnDisk) { const auto moduleFilesGuard = m_moduleFilesPerDirectory.lock(); auto &list = moduleFilesGuard.get()[dir]; if (!list) list = findOnDisk(); return *list; } void TopLevelProjectContext::removeModuleFileFromDirectoryCache(const QString &filePath) { const auto moduleFilesGuard = m_moduleFilesPerDirectory.lock(); auto &moduleFiles = moduleFilesGuard.get(); const auto it = moduleFiles.find(FileInfo::path(filePath)); QBS_CHECK(it != moduleFiles.end()); auto &files = it->second; QBS_CHECK(files); files->removeOne(filePath); } void TopLevelProjectContext::addUnknownProfilePropertyError(const Item *moduleProto, const ErrorInfo &error) { m_unknownProfilePropertyErrors.lock().get()[moduleProto].push_back(error); } const std::vector &TopLevelProjectContext::unknownProfilePropertyErrors( const Item *moduleProto) const { const auto errorsGuard = m_unknownProfilePropertyErrors.lock_shared(); const auto &errors = errorsGuard.get(); if (const auto it = errors.find(moduleProto); it != errors.end()) { return it->second; } static const std::vector empty; return empty; } Item *TopLevelProjectContext::getModulePrototype(const QString &filePath, const QString &profile, const std::function &produce) { const auto modulePrototypesGuard = m_modulePrototypes.lock(); auto &prototypeList = modulePrototypesGuard.get()[filePath]; for (const auto &prototype : prototypeList) { if (prototype.second == profile) return prototype.first; } Item * const module = produce(); if (module) prototypeList.emplace_back(module, profile); return module; } void TopLevelProjectContext::addLocalProfile(const QString &name, const QVariantMap &values, const CodeLocation &location) { if (m_localProfiles.contains(name)) throw ErrorInfo(Tr::tr("Local profile '%1' redefined.").arg(name), location); m_localProfiles.insert(name, values); } void TopLevelProjectContext::checkForLocalProfileAsTopLevelProfile(const QString &topLevelProfile) { for (auto it = m_localProfiles.cbegin(); it != m_localProfiles.cend(); ++it) { if (it.key() != topLevelProfile) continue; // This covers the edge case that a locally defined profile was specified as the // top-level profile, in which case we must invalidate the qbs module prototype that was // created in early setup before local profiles were handled. const auto prototypesGuard = m_modulePrototypes.lock(); auto &modulePrototypes = prototypesGuard.get(); QBS_CHECK(modulePrototypes.size() == 1); modulePrototypes.clear(); break; } } std::lock_guard TopLevelProjectContext::probesCacheLock() { return std::lock_guard(m_probesMutex); } void TopLevelProjectContext::setOldProjectProbes(const std::vector &oldProbes) { for (const ProbeConstPtr& probe : oldProbes) m_probesInfo.oldProjectProbes[probe->globalId()] << probe; } ProbeConstPtr TopLevelProjectContext::findOldProjectProbe(const QString &id, const ProbeFilter &filter) const { for (const ProbeConstPtr &oldProbe : m_probesInfo.oldProjectProbes.value(id)) { if (filter(oldProbe)) return oldProbe; } return {}; } void TopLevelProjectContext::setOldProductProbes( const QHash> &oldProbes) { m_probesInfo.oldProductProbes = oldProbes; } ProbeConstPtr TopLevelProjectContext::findOldProductProbe(const QString &productName, const ProbeFilter &filter) const { for (const ProbeConstPtr &oldProbe : m_probesInfo.oldProductProbes.value(productName)) { if (filter(oldProbe)) return oldProbe; } return {}; } void TopLevelProjectContext::addNewlyResolvedProbe(const ProbeConstPtr &probe) { m_probesInfo.currentProbes[probe->location()] << probe; } ProbeConstPtr TopLevelProjectContext::findCurrentProbe(const CodeLocation &location, const ProbeFilter &filter) const { for (const ProbeConstPtr &probe : m_probesInfo.currentProbes.value(location)) { if (filter(probe)) return probe; } return {}; } void TopLevelProjectContext::collectDataFromEngine(const ScriptEngine &engine) { const auto project = dynamic_cast(m_projects.front()->project.get()); QBS_CHECK(project); project->canonicalFilePathResults.insert(engine.canonicalFilePathResults()); project->fileExistsResults.insert(engine.fileExistsResults()); project->directoryEntriesResults.insert(engine.directoryEntriesResults()); project->fileLastModifiedResults.insert(engine.fileLastModifiedResults()); project->environment.insert(engine.environment()); project->buildSystemFiles.unite(engine.imports()); } ItemPool &TopLevelProjectContext::createItemPool() { m_itemPools.push_back(std::make_unique()); return *m_itemPools.back(); } class LoaderState::Private { public: Private(LoaderState &q, const SetupProjectParameters ¶meters, TopLevelProjectContext &topLevelProject, ItemPool &itemPool, ScriptEngine &engine, Logger &&logger) : parameters(parameters), topLevelProject(topLevelProject), itemPool(itemPool), logger(std::move(logger)), itemReader(q), evaluator(&engine) { this->logger.clearWarnings(); this->logger.storeWarnings(); } const SetupProjectParameters ¶meters; TopLevelProjectContext &topLevelProject; ItemPool &itemPool; Logger logger; ItemReader itemReader; Evaluator evaluator; }; LoaderState::LoaderState(const SetupProjectParameters ¶meters, TopLevelProjectContext &topLevelProject, ItemPool &itemPool, ScriptEngine &engine, Logger logger) : d(makePimpl(*this, parameters, topLevelProject, itemPool, engine, std::move(logger))) { d->itemReader.init(); } LoaderState::~LoaderState() = default; const SetupProjectParameters &LoaderState::parameters() const { return d->parameters; } ItemPool &LoaderState::itemPool() { return d->itemPool; } Evaluator &LoaderState::evaluator() { return d->evaluator; } Logger &LoaderState::logger() { return d->logger; } ItemReader &LoaderState::itemReader() { return d->itemReader; } TopLevelProjectContext &LoaderState::topLevelProject() { return d->topLevelProject; } static QString verbatimValue(LoaderState &state, const ValueConstPtr &value) { QString result; if (value && value->type() == Value::JSSourceValueType) { const JSSourceValueConstPtr sourceValue = std::static_pointer_cast( value); result = state.topLevelProject().sourceCodeForEvaluation(sourceValue); } return result; } static void resolveRuleArtifactBinding( LoaderState &state, const RuleArtifactPtr &ruleArtifact, Item *item, const QStringList &namePrefix, QualifiedIdSet *seenBindings) { for (auto it = item->properties().constBegin(); it != item->properties().constEnd(); ++it) { const QStringList name = QStringList(namePrefix) << it.key(); if (it.value()->type() == Value::ItemValueType) { resolveRuleArtifactBinding(state, ruleArtifact, std::static_pointer_cast(it.value())->item(), name, seenBindings); } else if (it.value()->type() == Value::JSSourceValueType) { const auto insertResult = seenBindings->insert(name); if (!insertResult.second) continue; JSSourceValuePtr sourceValue = std::static_pointer_cast(it.value()); RuleArtifact::Binding rab; rab.name = name; rab.code = state.topLevelProject().sourceCodeForEvaluation(sourceValue); rab.location = sourceValue->location(); ruleArtifact->bindings.push_back(rab); } else { QBS_ASSERT(!"unexpected value type", continue); } } } static void resolveRuleArtifact(LoaderState &state, const RulePtr &rule, Item *item) { RuleArtifactPtr artifact = RuleArtifact::create(); rule->artifacts.push_back(artifact); artifact->location = item->location(); if (const auto sourceProperty = item->sourceProperty(StringConstants::filePathProperty())) artifact->filePathLocation = sourceProperty->location(); artifact->filePath = verbatimValue(state, item->property(StringConstants::filePathProperty())); artifact->fileTags = state.evaluator().fileTagsValue(item, StringConstants::fileTagsProperty()); artifact->alwaysUpdated = state.evaluator().boolValue( item, StringConstants::alwaysUpdatedProperty()); QualifiedIdSet seenBindings; for (Item *obj = item; obj; obj = obj->prototype()) { for (QMap::const_iterator it = obj->properties().constBegin(); it != obj->properties().constEnd(); ++it) { if (it.value()->type() != Value::ItemValueType) continue; resolveRuleArtifactBinding( state, artifact, std::static_pointer_cast(it.value())->item(), QStringList(it.key()), &seenBindings); } } } void resolveRule(LoaderState &state, Item *item, ProjectContext *projectContext, ProductContext *productContext, ModuleContext *moduleContext) { Evaluator &evaluator = state.evaluator(); if (!evaluator.boolValue(item, StringConstants::conditionProperty())) return; RulePtr rule = Rule::create(); // read artifacts bool hasArtifactChildren = false; for (Item * const child : item->children()) { if (Q_UNLIKELY(child->type() != ItemType::Artifact)) { throw ErrorInfo(Tr::tr("'Rule' can only have children of type 'Artifact'."), child->location()); } hasArtifactChildren = true; resolveRuleArtifact(state, rule, child); } rule->name = evaluator.stringValue(item, StringConstants::nameProperty()); rule->prepareScript.initialize(state.topLevelProject().scriptFunctionValue( item, StringConstants::prepareProperty())); rule->outputArtifactsScript.initialize(state.topLevelProject().scriptFunctionValue( item, StringConstants::outputArtifactsProperty())); rule->outputFileTags = evaluator.fileTagsValue(item, StringConstants::outputFileTagsProperty()); if (rule->outputArtifactsScript.isValid()) { if (hasArtifactChildren) throw ErrorInfo(Tr::tr("The Rule.outputArtifacts script is not allowed in rules " "that contain Artifact items."), item->location()); } if (!hasArtifactChildren && rule->outputFileTags.empty()) { throw ErrorInfo(Tr::tr("A rule needs to have Artifact items or a non-empty " "outputFileTags property."), item->location()); } rule->multiplex = evaluator.boolValue(item, StringConstants::multiplexProperty()); rule->alwaysRun = evaluator.boolValue(item, StringConstants::alwaysRunProperty()); rule->inputs = evaluator.fileTagsValue(item, StringConstants::inputsProperty()); rule->inputsFromDependencies = evaluator.fileTagsValue(item, StringConstants::inputsFromDependenciesProperty()); bool requiresInputsSet = false; rule->requiresInputs = evaluator.boolValue(item, StringConstants::requiresInputsProperty(), &requiresInputsSet); if (!requiresInputsSet) rule->requiresInputs = rule->declaresInputs(); rule->auxiliaryInputs = evaluator.fileTagsValue(item, StringConstants::auxiliaryInputsProperty()); rule->auxiliaryInputsFromDependencies = evaluator.fileTagsValue( item, StringConstants::auxiliaryInputsFromDependenciesProperty()); rule->excludedInputs = evaluator.fileTagsValue(item, StringConstants::excludedInputsProperty()); if (rule->excludedInputs.empty()) { rule->excludedInputs = evaluator.fileTagsValue( item, StringConstants::excludedAuxiliaryInputsProperty()); } rule->explicitlyDependsOn = evaluator.fileTagsValue(item, StringConstants::explicitlyDependsOnProperty()); rule->explicitlyDependsOnFromDependencies = evaluator.fileTagsValue( item, StringConstants::explicitlyDependsOnFromDependenciesProperty()); rule->module = moduleContext ? moduleContext->module : projectContext->dummyModule; if (!rule->multiplex && !rule->declaresInputs()) { throw ErrorInfo(Tr::tr("Rule has no inputs, but is not a multiplex rule."), item->location()); } if (!rule->multiplex && !rule->requiresInputs) { throw ErrorInfo(Tr::tr("Rule.requiresInputs is false for non-multiplex rule."), item->location()); } if (!rule->declaresInputs() && rule->requiresInputs) { throw ErrorInfo(Tr::tr("Rule.requiresInputs is true, but the rule " "does not declare any input tags."), item->location()); } if (productContext) { rule->product = productContext->product.get(); productContext->product->rules.push_back(rule); } else { projectContext->rules.push_back(rule); } } void resolveFileTagger(LoaderState &state, Item *item, ProjectContext *projectContext, ProductContext *productContext) { Evaluator &evaluator = state.evaluator(); if (!evaluator.boolValue(item, StringConstants::conditionProperty())) return; std::vector &fileTaggers = productContext ? productContext->product->fileTaggers : projectContext->fileTaggers; const QStringList patterns = evaluator.stringListValue(item, StringConstants::patternsProperty()); if (patterns.empty()) throw ErrorInfo(Tr::tr("FileTagger.patterns must be a non-empty list."), item->location()); const FileTags fileTags = evaluator.fileTagsValue(item, StringConstants::fileTagsProperty()); if (fileTags.empty()) throw ErrorInfo(Tr::tr("FileTagger.fileTags must not be empty."), item->location()); for (const QString &pattern : patterns) { if (pattern.isEmpty()) throw ErrorInfo(Tr::tr("A FileTagger pattern must not be empty."), item->location()); } const int priority = evaluator.intValue(item, StringConstants::priorityProperty()); fileTaggers.push_back(FileTagger::create(patterns, fileTags, priority)); } void resolveJobLimit(LoaderState &state, Item *item, ProjectContext *projectContext, ProductContext *productContext, ModuleContext *moduleContext) { Evaluator &evaluator = state.evaluator(); if (!evaluator.boolValue(item, StringConstants::conditionProperty())) return; const QString jobPool = evaluator.stringValue(item, StringConstants::jobPoolProperty()); if (jobPool.isEmpty()) throw ErrorInfo(Tr::tr("A JobLimit item needs to have a non-empty '%1' property.") .arg(StringConstants::jobPoolProperty()), item->location()); bool jobCountWasSet; const int jobCount = evaluator.intValue(item, StringConstants::jobCountProperty(), -1, &jobCountWasSet); if (!jobCountWasSet) { throw ErrorInfo(Tr::tr("A JobLimit item needs to have a '%1' property.") .arg(StringConstants::jobCountProperty()), item->location()); } if (jobCount < 0) { throw ErrorInfo(Tr::tr("A JobLimit item must have a non-negative '%1' property.") .arg(StringConstants::jobCountProperty()), item->location()); } JobLimits &jobLimits = moduleContext ? moduleContext->jobLimits : productContext ? productContext->product->jobLimits : projectContext->jobLimits; JobLimit jobLimit(jobPool, jobCount); const int oldLimit = jobLimits.getLimit(jobPool); if (oldLimit == -1 || oldLimit > jobCount) jobLimits.setJobLimit(jobLimit); } const FileTag unknownFileTag() { static const FileTag tag("unknown-file-tag"); return tag; } bool ProductContext::dependenciesResolvingPending() const { return (!dependenciesContext || !dependenciesContext->dependenciesResolved) && !product && !delayedError.hasError(); } std::pair ProductContext::pendingDependency() const { return dependenciesContext ? dependenciesContext->pendingDependency() : std::make_pair(ProductDependencyType::None, nullptr); } TimingData &TimingData::operator+=(const TimingData &other) { dependenciesResolving += other.dependenciesResolving; moduleProviders += other.moduleProviders; moduleInstantiation += other.moduleInstantiation; propertyMerging += other.propertyMerging; groupsSetup += other.groupsSetup; groupsResolving += other.groupsResolving; preparingProducts += other.preparingProducts; resolvingProducts += other.resolvingProducts; probes += other.probes; propertyEvaluation += other.propertyEvaluation; propertyChecking += other.propertyChecking; return *this; } DependenciesContext::~DependenciesContext() = default; ItemReaderCache::AstCacheEntry &ItemReaderCache::retrieveOrSetupCacheEntry( const QString &filePath, const std::function &setup) { const auto astCacheGuard = m_astCache.lock(); AstCacheEntry &entry = astCacheGuard.get()[filePath]; if (!entry.ast) { setup(entry); m_filesRead << filePath; } return entry; } const QStringList &ItemReaderCache::retrieveOrSetDirectoryEntries( const QString &dir, const std::function &findOnDisk) { const auto directoryEntriesGuard = m_directoryEntries.lock(); auto &entries = directoryEntriesGuard.get()[dir]; if (!entries) entries = findOnDisk(); return *entries; } bool ItemReaderCache::AstCacheEntry::addProcessingThread() { return m_processingThreads.lock().get().insert(std::this_thread::get_id()).second; } void ItemReaderCache::AstCacheEntry::removeProcessingThread() { m_processingThreads.lock().get().remove(std::this_thread::get_id()); } class DependencyParametersMerger { public: DependencyParametersMerger(std::vector &&candidates) : m_candidates(std::move(candidates)) { } QVariantMap merge(); private: void merge(QVariantMap ¤t, const QVariantMap &next, int nextPrio); const std::vector m_candidates; struct Conflict { Conflict(QStringList path, QVariant val1, QVariant val2, int prio) : path(std::move(path)), val1(std::move(val1)), val2(std::move(val2)), priority(prio) {} QStringList path; QVariant val1; QVariant val2; int priority; }; std::vector m_conflicts; QVariantMap m_currentValue; int m_currentPrio = INT_MIN; QStringList m_path; }; QVariantMap mergeDependencyParameters(std::vector &&candidates) { return DependencyParametersMerger(std::move(candidates)).merge(); } QVariantMap mergeDependencyParameters(const QVariantMap &m1, const QVariantMap &m2) { return mergeDependencyParameters({std::make_pair(m1, 0), std::make_pair(m2, 0)}); } QVariantMap DependencyParametersMerger::merge() { for (const auto &next : m_candidates) { merge(m_currentValue, next.first, next.second); m_currentPrio = next.second; } if (!m_conflicts.empty()) { ErrorInfo error(Tr::tr("Conflicting parameter values encountered:")); for (const Conflict &conflict : m_conflicts) { // TODO: Location would be nice ... error.append(Tr::tr(" Parameter '%1' cannot be both '%2' and '%3'.") .arg(conflict.path.join(QLatin1Char('.')), conflict.val1.toString(), conflict.val2.toString())); } throw error; } return m_currentValue; } void DependencyParametersMerger::merge(QVariantMap ¤t, const QVariantMap &next, int nextPrio) { for (auto it = next.begin(); it != next.end(); ++it) { m_path << it.key(); const QVariant &newValue = it.value(); QVariant ¤tValue = current[it.key()]; if (newValue.userType() == QMetaType::QVariantMap) { QVariantMap mdst = currentValue.toMap(); merge(mdst, it.value().toMap(), nextPrio); currentValue = mdst; } else { if (m_currentPrio == nextPrio) { if (currentValue.isValid() && !qVariantsEqual(currentValue, newValue)) m_conflicts.emplace_back(m_path, currentValue, newValue, m_currentPrio); } else { removeIf(m_conflicts, [this](const Conflict &conflict) { return m_path == conflict.path; }); } currentValue = newValue; } m_path.removeLast(); } } } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/loaderutils.h0000644000175100017510000004527415154533055021440 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { class SetupProjectParameters; namespace Internal { class Evaluator; class ItemPool; class ItemReader; class Logger; class ProductContext; class ProgressObserver; class ProjectContext; class ScriptEngine; using ModulePropertiesPerGroup = std::unordered_map; using FileLocations = QHash, CodeLocation>; enum class Deferral { Allowed, NotAllowed }; enum class ProductDependencyType { None, Single, Bulk }; class CancelException { }; template struct GuardedData { DataType data; mutable MutexType mutex; }; class TimingData { public: TimingData &operator+=(const TimingData &other); qint64 dependenciesResolving = 0; qint64 moduleProviders = 0; qint64 moduleInstantiation = 0; qint64 propertyMerging = 0; qint64 groupsSetup = 0; qint64 groupsResolving = 0; qint64 preparingProducts = 0; qint64 resolvingProducts = 0; qint64 schedulingProducts = 0; qint64 probes = 0; qint64 propertyEvaluation = 0; qint64 propertyChecking = 0; }; class ItemReaderCache { public: class AstCacheEntry { public: QString code; QbsQmlJS::Engine engine; QbsQmlJS::AST::UiProgram *ast = nullptr; bool addProcessingThread(); void removeProcessingThread(); private: MutexData, std::recursive_mutex> m_processingThreads; }; const Set &filesRead() const { return m_filesRead; } AstCacheEntry &retrieveOrSetupCacheEntry(const QString &filePath, const std::function &setup); const QStringList &retrieveOrSetDirectoryEntries( const QString &dir, const std::function &findOnDisk); private: Set m_filesRead; MutexData>, std::mutex> m_directoryEntries; // TODO: Merge with module dir entries cache? MutexData, std::mutex> m_astCache; }; class DependenciesContext { public: virtual ~DependenciesContext(); virtual std::pair pendingDependency() const = 0; bool dependenciesResolved = false; }; class ProductContext { public: QString uniqueName() const; QString displayName() const; void handleError(const ErrorInfo &error); bool dependenciesResolvingPending() const; std::pair pendingDependency() const; QString name; QString buildDirectory; Item *item = nullptr; Item *scope = nullptr; ProjectContext *project = nullptr; std::unique_ptr shadowProduct; Item *mergedExportItem = nullptr; std::vector probes; ModulePropertiesPerGroup modulePropertiesSetInGroups; ErrorInfo delayedError; QString profileName; QString multiplexConfigurationId; QVariantMap profileModuleProperties; // Tree-ified module properties from profile. QVariantMap moduleProperties; // Tree-ified module properties from profile + overridden values. std::optional providerConfig; std::optional providerQbsModule; QVariantMap defaultParameters; // In Export item. QStringList searchPaths; ResolvedProductPtr product; TimingData timingData; std::unique_ptr dependenciesContext; // This is needed because complex cyclic dependencies that involve Depends.productTypes // may only be detected after a product has already been fully resolved. std::vector> bulkDependencies; // The keys are module prototypes, the values specify whether the module's // condition is true for this product. std::unordered_map modulePrototypeEnabledInfo; int dependsItemCount = -1; }; class TopLevelProjectContext { public: TopLevelProjectContext() = default; TopLevelProjectContext(const TopLevelProjectContext &) = delete; TopLevelProjectContext &operator=(const TopLevelProjectContext &) = delete; ~TopLevelProjectContext(); bool checkItemCondition(Item *item, Evaluator &evaluator); QString sourceCodeForEvaluation(const JSSourceValueConstPtr &value); ScriptFunctionPtr scriptFunctionValue(Item *item, const QString &name); QString sourceCodeAsFunction(const JSSourceValueConstPtr &value, const PropertyDeclaration &decl); void setCanceled() { m_canceled = true; } void checkCancelation(); bool isCanceled() const { return m_canceled; } int productCount() const { return m_productsByName.size(); } void addProductToHandle(const ProductContext &product) { m_productsToHandle.data << &product; } void removeProductToHandle(const ProductContext &product); bool isProductQueuedForHandling(const ProductContext &product) const; int productsToHandleCount() const { return m_productsToHandle.data.size(); } void addDisabledItem(Item *item); bool isDisabledItem(const Item *item) const; void setProgressObserver(ProgressObserver *observer); ProgressObserver *progressObserver() const; void addProject(ProjectContext *project) { m_projects.push_back(project); } const std::vector &projects() const { return m_projects; } using QueuedErrors = MutexData, std::mutex>; void addQueuedError(const ErrorInfo &error); QueuedErrors::UniqueConstGuard queuedErrors() const { return m_queuedErrors.lock(); } void setProfileConfigs(const QVariantMap &profileConfigs) { m_profileConfigs = profileConfigs; } void addProfileConfig(const QString &profileName, const QVariantMap &profileConfig); const QVariantMap &profileConfigs() const { return m_profileConfigs; } std::optional profileConfig(const QString &profileName) const; void addProduct(ProductContext &product); void addProductByType(ProductContext &product, const FileTags &tags); ProductContext *productWithNameAndConstraint( const QString &name, const std::function &constraint); std::vector productsWithNameAndConstraint( const QString &name, const std::function &constraint); std::vector productsWithTypeAndConstraint( const FileTags &tags, const std::function &constraint); std::vector> finishedProductsWithBulkDependency(const FileTag &tag) const; void registerBulkDependencies(ProductContext &product); void addProjectNameUsedInOverrides(const QString &name); const Set &projectNamesUsedInOverrides() const; void addProductNameUsedInOverrides(const QString &name); const Set &productNamesUsedInOverrides() const; void setBuildDirectory(const QString &buildDir) { m_buildDirectory = buildDir; } const QString &buildDirectory() const { return m_buildDirectory; } void addMultiplexConfiguration(const QString &id, const QVariantMap &config); QVariantMap multiplexConfiguration(const QString &id) const; void setLastResolveTime(const FileTime &time) { m_lastResolveTime = time; } const FileTime &lastResolveTime() const { return m_lastResolveTime; } Set buildSystemFiles() const { return m_itemReaderCache.filesRead(); } std::lock_guard moduleProvidersCacheLock(); void setModuleProvidersCache(const ModuleProvidersCache &cache); const ModuleProvidersCache &moduleProvidersCache() const { return m_moduleProvidersCache; } ModuleProviderInfo *moduleProvider(const ModuleProvidersCacheKey &key); ModuleProviderInfo &addModuleProvider(const ModuleProvidersCacheKey &key, const ModuleProviderInfo &provider); void addParameterDeclarations(const Item *moduleProto, const Item::PropertyDeclarationMap &decls); Item::PropertyDeclarationMap parameterDeclarations(Item *moduleProto) const; void setParameters(const Item *moduleProto, const QVariantMap ¶meters); QVariantMap parameters(Item *moduleProto) const; void addCodeLink(const QString &sourceFile, const CodeRange &sourceRange, const CodeLocation &target); CodeLinks codeLinks() const { return m_codeLinks.lock().get(); } // An empty string means no matching module directory was found. QString findModuleDirectory(const QualifiedId &module, const QString &searchPath, const std::function &findOnDisk); QStringList getModuleFilesForDirectory(const QString &dir, const std::function &findOnDisk); void removeModuleFileFromDirectoryCache(const QString &filePath); void addUnknownProfilePropertyError(const Item *moduleProto, const ErrorInfo &error); const std::vector &unknownProfilePropertyErrors(const Item *moduleProto) const; Item *getModulePrototype(const QString &filePath, const QString &profile, const std::function &produce); void addLocalProfile(const QString &name, const QVariantMap &values, const CodeLocation &location); const QVariantMap localProfiles() { return m_localProfiles; } void checkForLocalProfileAsTopLevelProfile(const QString &topLevelProfile); using ProbeFilter = std::function; std::lock_guard probesCacheLock(); void setOldProjectProbes(const std::vector &oldProbes); void setOldProductProbes(const QHash> &oldProbes); void addNewlyResolvedProbe(const ProbeConstPtr &probe); void addProjectLevelProbe(const ProbeConstPtr &probe); const std::vector projectLevelProbes() const; ProbeConstPtr findOldProjectProbe(const QString &id, const ProbeFilter &filter) const; ProbeConstPtr findOldProductProbe(const QString &productName, const ProbeFilter &filter) const; ProbeConstPtr findCurrentProbe(const CodeLocation &location, const ProbeFilter &filter) const; void incrementProbesCount() { ++m_probesInfo.probesEncountered; } void incrementReusedCurrentProbesCount() { ++m_probesInfo.probesCachedCurrent; } void incrementReusedOldProbesCount() { ++m_probesInfo.probesCachedOld; } void incrementRunProbesCount() { ++m_probesInfo.probesRun; } int probesEncounteredCount() const { return m_probesInfo.probesEncountered; } int probesRunCount() const { return m_probesInfo.probesRun; } int reusedOldProbesCount() const { return m_probesInfo.probesCachedOld; } int reusedCurrentProbesCount() const { return m_probesInfo.probesCachedCurrent; } TimingData &timingData() { return m_timingData; } ItemReaderCache &itemReaderCache() { return m_itemReaderCache; } void incProductDeferrals() { ++m_productDeferrals; } int productDeferrals() const { return m_productDeferrals; } void collectDataFromEngine(const ScriptEngine &engine); ItemPool &createItemPool(); private: const ResolvedFileContextPtr &resolvedFileContext(const FileContextConstPtr &ctx); std::vector m_projects; GuardedData> m_productsToHandle; std::multimap m_productsByName; MutexData, std::mutex> m_sourceCode; std::unordered_map m_multiplexConfigsById; MutexData, std::mutex> m_scriptFunctionMap; MutexData, QString>, std::mutex> m_scriptFunctions; std::unordered_map m_fileContextMap; Set m_projectNamesUsedInOverrides; Set m_productNamesUsedInOverrides; MutexData> m_disabledItems; QueuedErrors m_queuedErrors; QString m_buildDirectory; QVariantMap m_profileConfigs; ProgressObserver *m_progressObserver = nullptr; TimingData m_timingData; ModuleProvidersCache m_moduleProvidersCache; std::mutex m_moduleProvidersCacheMutex; QVariantMap m_localProfiles; ItemReaderCache m_itemReaderCache; QHash>> m_reverseBulkDependencies; // For fast look-up when resolving Depends.productTypes. // The contract is that it contains fully handled, error-free, enabled products. MutexData> m_productsByType; // The keys are module prototypes. MutexData> m_parameterDeclarations; MutexData> m_parameters; MutexData>> m_unknownProfilePropertyErrors; // The keys are search path + module name, the values are directories. MutexData, std::optional>, std::mutex> m_modulePathCache; // The keys are file paths, the values are module prototype items accompanied by a profile. MutexData>>, std::mutex> m_modulePrototypes; MutexData>, std::mutex> m_moduleFilesPerDirectory; MutexData m_codeLinks; struct { QHash> oldProjectProbes; QHash> oldProductProbes; QHash> currentProbes; std::vector projectLevelProbes; quint64 probesEncountered = 0; quint64 probesRun = 0; quint64 probesCachedCurrent = 0; quint64 probesCachedOld = 0; } m_probesInfo; std::mutex m_probesMutex; std::vector> m_itemPools; FileTime m_lastResolveTime; std::atomic_bool m_canceled = false; int m_productDeferrals = 0; }; class ProjectContext { public: QString name; Item *item = nullptr; Item *scope = nullptr; TopLevelProjectContext *topLevelProject = nullptr; ProjectContext *parent = nullptr; std::vector children; std::vector products; std::vector searchPathsStack; ResolvedProjectPtr project; std::vector fileTaggers; std::vector rules; JobLimits jobLimits; ResolvedModulePtr dummyModule; }; class ModuleContext { public: ResolvedModulePtr module; JobLimits jobLimits; }; class LoaderState { public: LoaderState(const SetupProjectParameters ¶meters, TopLevelProjectContext &topLevelProject, ItemPool &itemPool, ScriptEngine &engine, Logger logger); ~LoaderState(); Evaluator &evaluator(); ItemPool &itemPool(); ItemReader &itemReader(); Logger &logger(); const SetupProjectParameters ¶meters() const; TopLevelProjectContext &topLevelProject(); private: class Private; Pimpl d; }; // List must be sorted by priority in ascending order. [[nodiscard]] QVariantMap mergeDependencyParameters( std::vector &&candidates); [[nodiscard]] QVariantMap mergeDependencyParameters(const QVariantMap &m1, const QVariantMap &m2); QString fullProductDisplayName(const QString &name, const QString &multiplexId); void adjustParametersScopes(Item *item, Item *scope); void resolveRule(LoaderState &state, Item *item, ProjectContext *projectContext, ProductContext *productContext, ModuleContext *moduleContext); void resolveJobLimit(LoaderState &state, Item *item, ProjectContext *projectContext, ProductContext *productContext, ModuleContext *moduleContext); void resolveFileTagger(LoaderState &state, Item *item, ProjectContext *projectContext, ProductContext *productContext); const FileTag unknownFileTag(); } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/loader/productresolver.cpp0000644000175100017510000021122215154533055022672 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #include "productresolver.h" #include "dependenciesresolver.h" #include "groupshandler.h" #include "loaderutils.h" #include "modulepropertymerger.h" #include "probesresolver.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs::Internal { class PropertiesEvaluator { public: PropertiesEvaluator(ProductContext &product, LoaderState &loaderState) : m_product(product), m_loaderState(loaderState) {} QVariantMap evaluateProperties(Item *item, bool lookupPrototype, bool checkErrors); QVariantMap evaluateProperties(const Item *item, const Item *propertiesContainer, const QVariantMap &tmplt, bool lookupPrototype, bool checkErrors); void evaluateProperty(const Item *item, const QString &propName, const ValuePtr &propValue, QVariantMap &result, bool checkErrors); private: ProductContext &m_product; LoaderState &m_loaderState; }; // Dependency resolving, Probe execution. // Run for real products and shadow products. class ProductResolverStage1 { public: ProductResolverStage1(ProductContext &product, Deferral deferral, LoaderState &loaderState) : m_product(product), m_loaderState(loaderState), m_deferral(deferral) {} void start(); private: void resolveProbes(); void resolveProbes(Item *item); void runModuleProbes(const Item::Module &module); void updateModulePresentState(const Item::Module &module); bool validateModule(const Item::Module &module); void handleModuleSetupError(const Item::Module &module, const ErrorInfo &error); void checkPropertyDeclarations(); void mergeDependencyParameters(); void checkDependencyParameterDeclarations(const Item *productItem, const QString &productName) const; void collectCodeLinks(); ProductContext &m_product; LoaderState &m_loaderState; const Deferral m_deferral; }; // Setting up ResolvedProduct, incuding property evaluation and handling Product child items. // Run only for real products. class ProductResolverStage2 { public: ProductResolverStage2(ProductContext &product, LoaderState &loaderState) : m_product(product), m_loaderState(loaderState) {} void start(); private: void resolveProductFully(); void createProductConfig(); void resolveGroup(Item *item, ModuleContext *moduleContext); void resolveGroupFully(Item *item, bool isEnabled, ModuleContext *moduleContext); QVariantMap resolveAdditionalModuleProperties(const Item *group, const QVariantMap ¤tValues); SourceArtifactPtr createSourceArtifact(const QString &fileName, const GroupPtr &group, bool wildcard, const CodeLocation &filesLocation, ErrorInfo *errorInfo); void resolveExport(Item *exportItem); std::unique_ptr resolveExportChild(const Item *item, const ExportedModule &module); void setupExportedProperties(const Item *item, const QString &namePrefix, std::vector &properties); QVariantMap evaluateModuleValues(Item *item, bool lookupPrototype = true); void resolveScanner(Item *item, ModuleContext *moduleContext); void resolveModules(); void resolveModule(const QualifiedId &moduleName, Item *item, bool isProduct, const QVariantMap ¶meters, JobLimits &jobLimits); void applyFileTaggers(); void finalizeArtifactProperties(); void collectProductDependencies(); ProductContext &m_product; LoaderState &m_loaderState; GroupConstPtr m_currentGroup; FileLocations m_sourceArtifactLocations; PropertiesEvaluator m_propertiesEvaluator{m_product, m_loaderState}; using ArtifactPropertiesInfo = std::pair>; QHash m_artifactPropertiesPerFilter; }; class ExportsResolver { public: ExportsResolver(ProductContext &product, LoaderState &loaderState) : m_product(product), m_loaderState(loaderState) {} void start(); private: void resolveShadowProduct(); void collectPropertiesForExportItem(Item *productModuleInstance); void collectPropertiesForExportItem(const QualifiedId &moduleName, const ValuePtr &value, Item *moduleInstance, QVariantMap &moduleProps); void collectPropertiesForModuleInExportItem(const Item::Module &module); void adaptExportedPropertyValues(); void collectExportedProductDependencies(); ProductContext &m_product; LoaderState &m_loaderState; PropertiesEvaluator m_propertiesEvaluator{m_product, m_loaderState}; }; void resolveProduct(ProductContext &product, Deferral deferral, LoaderState &loaderState) { try { ProductResolverStage1(product, deferral, loaderState).start(); } catch (const ErrorInfo &err) { if (err.isCancelException()) { loaderState.topLevelProject().setCanceled(); return; } product.handleError(err); } if (product.dependenciesResolvingPending()) return; if (product.name.startsWith(StringConstants::shadowProductPrefix())) return; // TODO: The weird double-forwarded error handling can hopefully be simplified now. try { ProductResolverStage2(product, loaderState).start(); } catch (const ErrorInfo &err) { if (err.isCancelException()) { loaderState.topLevelProject().setCanceled(); return; } loaderState.topLevelProject().addQueuedError(err); } } void setupExports(ProductContext &product, LoaderState &loaderState) { ExportsResolver(product, loaderState).start(); } void ProductResolverStage1::start() { TopLevelProjectContext &topLevelProject = m_loaderState.topLevelProject(); topLevelProject.checkCancelation(); if (m_product.delayedError.hasError()) return; resolveDependencies(m_product, m_deferral, m_loaderState); QBS_CHECK(m_product.dependenciesContext); if (!m_product.dependenciesContext->dependenciesResolved) return; if (m_product.delayedError.hasError()) return; // Run probes for modules and product. resolveProbes(); // After the probes have run, we can switch on the evaluator cache. Evaluator &evaluator = m_loaderState.evaluator(); FileTags fileTags = evaluator.fileTagsValue(m_product.item, StringConstants::typeProperty()); EvalCacheEnabler cacheEnabler(&evaluator, evaluator.stringValue( m_product.item, StringConstants::sourceDirectoryProperty())); // Run module validation scripts. for (const Item::Module &module : m_product.item->modules()) { if (!validateModule(module)) return; fileTags += evaluator.fileTagsValue( module.item, StringConstants::additionalProductTypesProperty()); } // Disable modules that have been pulled in only by now-disabled modules. // Note that this has to happen in the reverse order compared to the other loops, // with the leaves checked last. for (auto it = m_product.item->modules().rbegin(); it != m_product.item->modules().rend(); ++it) updateModulePresentState(*it); // Now do the canonical module property values merge. Note that this will remove // previously attached values from modules that failed validation. // Evaluator cache entries that could potentially change due to this will be purged. doFinalMerge(m_product, m_loaderState); const bool enabled = topLevelProject.checkItemCondition(m_product.item, evaluator); collectCodeLinks(); mergeDependencyParameters(); checkDependencyParameterDeclarations(m_product.item, m_product.name); setupGroups(m_product, m_loaderState); // Collect the full list of fileTags, including the values contributed by modules. if (!m_product.delayedError.hasError() && enabled && !m_product.name.startsWith(StringConstants::shadowProductPrefix())) { topLevelProject.addProductByType(m_product, fileTags); m_product.item->setProperty(StringConstants::typeProperty(), VariantValue::create(sorted(fileTags.toStringList()))); } checkPropertyDeclarations(); } void ProductResolverStage1::resolveProbes() { for (const Item::Module &module : m_product.item->modules()) { runModuleProbes(module); if (m_product.delayedError.hasError()) return; } resolveProbes(m_product.item); } void ProductResolverStage1::resolveProbes(Item *item) { ProbesResolver(m_loaderState).resolveProbes(m_product, item); } void ProductResolverStage1::runModuleProbes(const Item::Module &module) { if (!module.item->isPresentModule()) return; if (module.product && m_loaderState.topLevelProject().isDisabledItem(module.product->item)) { createNonPresentModule(m_loaderState.itemPool(), module.name.toString(), QLatin1String("module's exporting product is disabled"), module.item); return; } try { resolveProbes(module.item); if (module.versionRange.minimum.isValid() || module.versionRange.maximum.isValid()) { if (module.versionRange.maximum.isValid() && module.versionRange.minimum >= module.versionRange.maximum) { throw ErrorInfo(Tr::tr("Impossible version constraint [%1,%2) set for module " "'%3'").arg(module.versionRange.minimum.toString(), module.versionRange.maximum.toString(), module.name.toString())); } const Version moduleVersion = Version::fromString( m_loaderState.evaluator().stringValue(module.item, StringConstants::versionProperty())); if (moduleVersion < module.versionRange.minimum) { throw ErrorInfo(Tr::tr("Module '%1' has version %2, but it needs to be " "at least %3.").arg(module.name.toString(), moduleVersion.toString(), module.versionRange.minimum.toString())); } if (module.versionRange.maximum.isValid() && moduleVersion >= module.versionRange.maximum) { throw ErrorInfo(Tr::tr("Module '%1' has version %2, but it needs to be " "lower than %3.").arg(module.name.toString(), moduleVersion.toString(), module.versionRange.maximum.toString())); } } } catch (const ErrorInfo &error) { handleModuleSetupError(module, error); } } void ProductResolverStage1::updateModulePresentState(const Item::Module &module) { if (!module.item->isPresentModule()) return; if (module.name.first() == StringConstants::qbsModule()) return; bool hasPresentLoadingItem = false; for (const Item::Module::LoadContext &loadContext : module.loadContexts) { const Item * const loadingItem = loadContext.loadingItem(); if (loadingItem == m_product.item) { hasPresentLoadingItem = true; break; } if (!loadingItem->isPresentModule()) continue; if (loadingItem->prototype() && loadingItem->prototype()->type() == ItemType::Export) { QBS_CHECK(loadingItem->prototype()->parent()->type() == ItemType::Product); if (m_loaderState.topLevelProject().isDisabledItem(loadingItem->prototype()->parent())) continue; } hasPresentLoadingItem = true; break; } if (!hasPresentLoadingItem) { createNonPresentModule(m_loaderState.itemPool(), module.name.toString(), QLatin1String("imported only by disabled module(s)"), module.item); } } bool ProductResolverStage1::validateModule(const Item::Module &module) { if (!module.item->isPresentModule()) return true; try { m_loaderState.evaluator().boolValue(module.item, StringConstants::validateProperty()); for (const auto &dep : module.item->modules()) { if (dep.required && !dep.item->isPresentModule()) { throw ErrorInfo(Tr::tr("Module '%1' depends on module '%2', which was not " "loaded successfully") .arg(module.name.toString(), dep.name.toString())); } } } catch (const ErrorInfo &error) { handleModuleSetupError(module, error); if (m_product.delayedError.hasError()) return false; } return true; } void ProductResolverStage1::handleModuleSetupError(const Item::Module &module, const ErrorInfo &error) { if (module.required) { m_product.handleError(error); } else { qCDebug(lcModuleLoader()) << "non-required module" << module.name.toString() << "found, but not usable in product" << m_product.name << error.toString(); createNonPresentModule(m_loaderState.itemPool(), module.name.toString(), QStringLiteral("failed validation"), module.item); } } void ProductResolverStage1::checkPropertyDeclarations() { AccumulatingTimer timer(m_loaderState.parameters().logElapsedTime() ? &m_product.timingData.propertyChecking : nullptr); qbs::Internal::checkPropertyDeclarations(m_product.item, m_loaderState); } void ProductResolverStage1::mergeDependencyParameters() { if (m_loaderState.topLevelProject().isDisabledItem(m_product.item)) return; for (Item::Module &module : m_product.item->modules()) { if (module.name.toString() == StringConstants::qbsModule()) continue; if (!module.item->isPresentModule()) continue; using PP = Item::Module::ParametersWithPriority; std::vector priorityList; const QVariantMap defaultParameters = module.product ? module.product->defaultParameters : m_loaderState.topLevelProject().parameters(module.item->prototype()); priorityList.emplace_back(defaultParameters, INT_MIN); for (const Item::Module::LoadContext &context : module.loadContexts) { const QVariantMap ¶meters = context.parameters.first; // Empty parameter maps and inactive loading modules do not contribute to the // final parameter map. if (parameters.isEmpty()) continue; if (context.loadingItem()->type() == ItemType::ModuleInstance && !context.loadingItem()->isPresentModule()) { continue; } // Build a list sorted by priority. static const auto cmp = [](const PP &elem, int prio) { return elem.second < prio; }; const auto it = std::lower_bound(priorityList.begin(), priorityList.end(), context.parameters.second, cmp); priorityList.insert(it, context.parameters); } module.parameters = qbs::Internal::mergeDependencyParameters(std::move(priorityList)); } } class DependencyParameterDeclarationCheck { public: DependencyParameterDeclarationCheck(const QString &productName, const Item *productItem, const TopLevelProjectContext &topLevelProject) : m_productName(productName), m_productItem(productItem), m_topLevelProject(topLevelProject) {} void operator()(const QVariantMap ¶meters) const { check(parameters, QualifiedId()); } private: void check(const QVariantMap ¶meters, const QualifiedId &moduleName) const { for (auto it = parameters.begin(); it != parameters.end(); ++it) { if (it.value().userType() == QMetaType::QVariantMap) { check(it.value().toMap(), QualifiedId(moduleName) << it.key()); } else { const auto &deps = m_productItem->modules(); auto m = std::find_if(deps.begin(), deps.end(), [&moduleName] (const Item::Module &module) { return module.name == moduleName; }); if (m == deps.end()) { const QualifiedId fullName = QualifiedId(moduleName) << it.key(); throw ErrorInfo(Tr::tr("Cannot set parameter '%1', " "because '%2' does not have a dependency on '%3'.") .arg(fullName.toString(), m_productName, moduleName.toString()), m_productItem->location()); } const auto decls = m_topLevelProject.parameterDeclarations( m->item->rootPrototype()); if (!decls.contains(it.key())) { const QualifiedId fullName = QualifiedId(moduleName) << it.key(); throw ErrorInfo(Tr::tr("Parameter '%1' is not declared.") .arg(fullName.toString()), m_productItem->location()); } } } } bool moduleExists(const QualifiedId &name) const { const auto &deps = m_productItem->modules(); return any_of(deps, [&name](const Item::Module &module) { return module.name == name; }); } const QString &m_productName; const Item * const m_productItem; const TopLevelProjectContext &m_topLevelProject; }; void ProductResolverStage1::checkDependencyParameterDeclarations(const Item *productItem, const QString &productName) const { DependencyParameterDeclarationCheck dpdc(productName, productItem, m_loaderState.topLevelProject()); for (const Item::Module &dep : productItem->modules()) { if (!dep.parameters.empty()) dpdc(dep.parameters); } } void ProductResolverStage1::collectCodeLinks() { for (const Item::Module &module : m_product.item->modules()) { if (module.name.first() == StringConstants::qbsModule()) continue; for (const Item::Module::LoadContext &context : module.loadContexts) { m_loaderState.topLevelProject().addCodeLink( context.dependsItem->location().filePath(), context.dependsItem->codeRange(), module.product ? module.product->item->location() : module.item->location()); } } } void ProductResolverStage2::start() { m_loaderState.evaluator().clearPropertyDependencies(); ResolvedProductPtr product = ResolvedProduct::create(); product->enabled = m_product.project->project->enabled; product->moduleProperties = PropertyMapInternal::create(); product->project = m_product.project->project; m_product.product = product; product->location = m_product.item->location(); const auto errorFromDelayedError = [&] { if (m_product.delayedError.hasError()) { ErrorInfo errorInfo; // First item is "main error", gets prepended again in the catch clause. const QList &items = m_product.delayedError.items(); for (int i = 1; i < items.size(); ++i) errorInfo.append(items.at(i)); m_product.delayedError.clear(); return errorInfo; } return ErrorInfo(); }; // Even if we previously encountered an error, try to continue for as long as possible // to provide IDEs with useful data (e.g. the list of files). // If we encounter a follow-up error, suppress it and report the original one instead. try { resolveProductFully(); if (const ErrorInfo error = errorFromDelayedError(); error.hasError()) throw error; } catch (ErrorInfo e) { if (const ErrorInfo error = errorFromDelayedError(); error.hasError()) e = error; QString mainErrorString = !product->name.isEmpty() ? Tr::tr("Error while handling product '%1':").arg(product->name) : Tr::tr("Error while handling product:"); ErrorInfo fullError(mainErrorString, product->location); appendError(fullError, e); if (!product->enabled) { qCDebug(lcProjectResolver) << fullError.toString(); return; } if (m_loaderState.parameters().productErrorMode() == ErrorHandlingMode::Strict) throw fullError; m_loaderState.logger().printError(fullError); m_loaderState.logger().printError(ErrorInfo( Tr::tr("Product '%1' had errors and was disabled.").arg(product->name), product->location)); product->enabled = false; } } void ProductResolverStage2::resolveProductFully() { Item * const item = m_product.item; const ResolvedProductPtr product = m_product.product; Evaluator &evaluator = m_loaderState.evaluator(); product->name = evaluator.stringValue(item, StringConstants::nameProperty()); // product->buildDirectory() isn't valid yet, because the productProperties map is not ready. m_product.buildDirectory = evaluator.stringValue( item, StringConstants::buildDirectoryProperty()); product->multiplexConfigurationId = evaluator.stringValue( item, StringConstants::multiplexConfigurationIdProperty()); qCDebug(lcProjectResolver) << "resolveProduct" << product->uniqueName(); product->enabled = product->enabled && evaluator.boolValue(item, StringConstants::conditionProperty()); const VariantValuePtr type = item->variantProperty(StringConstants::typeProperty()); if (type) product->fileTags = FileTags::fromStringList(type->value().toStringList()); product->targetName = evaluator.stringValue(item, StringConstants::targetNameProperty()); product->sourceDirectory = evaluator.stringValue( item, StringConstants::sourceDirectoryProperty()); product->destinationDirectory = evaluator.stringValue( item, StringConstants::destinationDirProperty()); if (product->destinationDirectory.isEmpty()) { product->destinationDirectory = m_product.buildDirectory; } else { product->destinationDirectory = FileInfo::resolvePath( product->topLevelProject()->buildDirectory, product->destinationDirectory); } product->probes = m_product.probes; createProductConfig(); product->productProperties.insert(StringConstants::destinationDirProperty(), product->destinationDirectory); ModuleProperties::init(evaluator.engine(), evaluator.scriptValue(item), product.get()); QList subItems = item->children(); const ValuePtr filesProperty = item->property(StringConstants::filesProperty()); if (filesProperty) { Item *fakeGroup = Item::create(&m_loaderState.itemPool(), ItemType::Group); fakeGroup->setFile(item->file()); fakeGroup->setLocation(item->location()); fakeGroup->setScope(item); fakeGroup->setProperty(StringConstants::nameProperty(), VariantValue::create(product->name)); fakeGroup->setProperty(StringConstants::filesProperty(), filesProperty); fakeGroup->setProperty(StringConstants::excludeFilesProperty(), item->property(StringConstants::excludeFilesProperty())); fakeGroup->setProperty(StringConstants::overrideTagsProperty(), VariantValue::falseValue()); fakeGroup->setupForBuiltinType(m_loaderState.parameters().deprecationWarningMode(), m_loaderState.logger()); subItems.prepend(fakeGroup); } for (Item * const child : std::as_const(subItems)) { switch (child->type()) { case ItemType::Rule: resolveRule(m_loaderState, child, m_product.project, &m_product, nullptr); break; case ItemType::Scanner: resolveScanner(child, nullptr); break; case ItemType::FileTagger: resolveFileTagger(m_loaderState, child, nullptr, &m_product); break; case ItemType::JobLimit: resolveJobLimit(m_loaderState, child, nullptr, &m_product, nullptr); break; case ItemType::Group: resolveGroup(child, nullptr); break; case ItemType::Export: resolveExport(child); break; default: break; } } for (const ProjectContext *p = m_product.project; p; p = p->parent) { JobLimits tempLimits = p->jobLimits; product->jobLimits = tempLimits.update(product->jobLimits); } resolveModules(); applyFileTaggers(); finalizeArtifactProperties(); for (const RulePtr &rule : m_product.project->rules) { RulePtr clonedRule = rule->clone(); clonedRule->product = product.get(); product->rules.push_back(clonedRule); } collectProductDependencies(); } void ProductResolverStage2::createProductConfig() { EvalCacheEnabler cachingEnabler(&m_loaderState.evaluator(), m_product.product->sourceDirectory); m_product.product->moduleProperties->setValue(evaluateModuleValues(m_product.item)); m_product.product->productProperties = m_propertiesEvaluator.evaluateProperties( m_product.item, m_product.item, QVariantMap(), true, true); } void ProductResolverStage2::resolveGroup(Item *item, ModuleContext *moduleContext) { const bool parentEnabled = m_currentGroup ? m_currentGroup->enabled : m_product.product->enabled; const bool isEnabled = parentEnabled && m_loaderState.evaluator().boolValue(item, StringConstants::conditionProperty()); try { resolveGroupFully(item, isEnabled, moduleContext); } catch (const ErrorInfo &error) { if (!isEnabled) { qCDebug(lcProjectResolver) << "error resolving group at" << item->location() << error.toString(); return; } if (m_loaderState.parameters().productErrorMode() == ErrorHandlingMode::Strict) throw; m_loaderState.logger().printError(error); } } void ProductResolverStage2::resolveGroupFully( Item *item, bool isEnabled, ModuleContext *moduleContext) { AccumulatingTimer groupTimer(m_loaderState.parameters().logElapsedTime() ? &m_product.timingData.groupsResolving : nullptr); const auto getGroupPropertyMap = [&](const ArtifactProperties *existingProps) { PropertyMapPtr moduleProperties; bool newPropertyMapRequired = false; if (existingProps) moduleProperties = existingProps->propertyMap(); if (!moduleProperties) { newPropertyMapRequired = true; moduleProperties = m_currentGroup ? m_currentGroup->properties : m_product.product->moduleProperties; } const QVariantMap newModuleProperties = resolveAdditionalModuleProperties( item, moduleProperties->value()); if (!newModuleProperties.empty()) { if (newPropertyMapRequired) moduleProperties = PropertyMapInternal::create(); moduleProperties->setValue(newModuleProperties); } return moduleProperties; }; Evaluator &evaluator = m_loaderState.evaluator(); QStringList files = evaluator.stringListValue(item, StringConstants::filesProperty()); bool fileTagsSet; const FileTags fileTags = evaluator.fileTagsValue(item, StringConstants::fileTagsProperty(), &fileTagsSet); const QStringList fileTagsFilter = evaluator.stringListValue(item, StringConstants::fileTagsFilterProperty()); if (!fileTagsFilter.empty()) { if (Q_UNLIKELY(!files.empty())) throw ErrorInfo(Tr::tr("Group.files and Group.fileTagsFilters are exclusive."), item->location()); if (!isEnabled) return; ArtifactPropertiesInfo &apinfo = m_artifactPropertiesPerFilter[fileTagsFilter]; if (apinfo.first) { const auto it = std::find_if(apinfo.second.cbegin(), apinfo.second.cend(), [item](const CodeLocation &loc) { return item->location().filePath() == loc.filePath(); }); if (it != apinfo.second.cend()) { ErrorInfo error(Tr::tr("Conflicting fileTagsFilter in Group items.")); error.append(Tr::tr("First item"), *it); error.append(Tr::tr("Second item"), item->location()); throw error; } } else { apinfo.first = ArtifactProperties::create(); apinfo.first->setFileTagsFilter(FileTags::fromStringList(fileTagsFilter)); m_product.product->artifactProperties.push_back(apinfo.first); } apinfo.second.push_back(item->location()); apinfo.first->setPropertyMapInternal(getGroupPropertyMap(apinfo.first.get())); apinfo.first->addExtraFileTags(fileTags); return; } QStringList patterns; for (int i = files.size(); --i >= 0;) { if (FileInfo::isPattern(files[i])) patterns.push_back(files.takeAt(i)); } GroupPtr group = ResolvedGroup::create(); bool prefixWasSet = false; group->prefix = evaluator.stringValue(item, StringConstants::prefixProperty(), QString(), &prefixWasSet); if (!prefixWasSet && m_currentGroup) group->prefix = m_currentGroup->prefix; if (!group->prefix.isEmpty()) { for (auto it = files.rbegin(), end = files.rend(); it != end; ++it) it->prepend(group->prefix); } group->location = item->location(); group->enabled = isEnabled; group->properties = getGroupPropertyMap(nullptr); group->fileTags = fileTags; group->overrideTags = evaluator.boolValue(item, StringConstants::overrideTagsProperty()); if (group->overrideTags && fileTagsSet) { if (group->fileTags.empty() ) group->fileTags.insert(unknownFileTag()); } else if (m_currentGroup) { group->fileTags.unite(m_currentGroup->fileTags); } const CodeLocation filesLocation = item->property(StringConstants::filesProperty())->location(); if (filesLocation.line() > 0 || item->location() == m_product.item->location()) group->files.emplace(); const VariantValueConstPtr moduleProp = item->variantProperty( StringConstants::modulePropertyInternal()); if (moduleProp) group->targetOfModule = moduleProp->value().toString(); ErrorInfo fileError; if (!patterns.empty()) { group->wildcards = std::make_unique(); SourceWildCards *wildcards = group->wildcards.get(); wildcards->excludePatterns = evaluator.stringListValue( item, StringConstants::excludeFilesProperty()); wildcards->patterns = patterns; wildcards->prefix = group->prefix; wildcards->baseDir = FileInfo::path(item->file()->filePath()); wildcards->buildDir = m_product.project->project->topLevelProject()->buildDirectory; wildcards->expandPatterns(); for (const QString &fileName : wildcards->expandedFiles) createSourceArtifact(fileName, group, true, filesLocation, &fileError); } for (const QString &fileName : std::as_const(files)) createSourceArtifact(fileName, group, false, filesLocation, &fileError); if (fileError.hasError()) { if (group->enabled) { if (m_loaderState.parameters().productErrorMode() == ErrorHandlingMode::Strict) throw ErrorInfo(fileError); m_loaderState.logger().printError(fileError); } else { qCDebug(lcProjectResolver) << "error for disabled group:" << fileError.toString(); } } group->name = evaluator.stringValue(item, StringConstants::nameProperty()); if (group->name.isEmpty()) group->name = Tr::tr("Group %1").arg(m_product.product->groups.size()); m_product.product->groups.push_back(group); class GroupContextSwitcher { public: GroupContextSwitcher(ProductResolverStage2 &resolver, const GroupConstPtr &newGroup) : m_resolver(resolver), m_oldGroup(resolver.m_currentGroup) { resolver.m_currentGroup = newGroup; } ~GroupContextSwitcher() { m_resolver.m_currentGroup = m_oldGroup; } private: ProductResolverStage2 &m_resolver; const GroupConstPtr m_oldGroup; }; GroupContextSwitcher groupSwitcher(*this, group); for (Item * const childItem : item->children()) { switch (childItem->type()) { case ItemType::FileTagger: if (isEnabled) resolveFileTagger(m_loaderState, childItem, nullptr, &m_product); break; case ItemType::Group: resolveGroup(childItem, moduleContext); break; case ItemType::Rule: if (isEnabled) resolveRule(m_loaderState, childItem, m_product.project, &m_product, moduleContext); break; case ItemType::Scanner: if (isEnabled) resolveScanner(childItem, moduleContext); break; default: break; } } } SourceArtifactPtr ProductResolverStage2::createSourceArtifact( const QString &fileName, const GroupPtr &group, bool wildcard, const CodeLocation &filesLocation, ErrorInfo *errorInfo) { const QString &baseDir = FileInfo::path(group->location.filePath()); const QString absFilePath = QDir::cleanPath(FileInfo::resolvePath(baseDir, fileName)); if (!wildcard && !FileInfo(absFilePath).exists()) { if (errorInfo) errorInfo->append(Tr::tr("File '%1' does not exist.").arg(absFilePath), filesLocation); m_product.product->missingSourceFiles << absFilePath; return {}; } if (group->enabled) { CodeLocation &loc = m_sourceArtifactLocations[ std::make_pair(group->targetOfModule, absFilePath)]; if (loc.isValid()) { if (errorInfo) { errorInfo->append(Tr::tr("Duplicate source file '%1'.").arg(absFilePath)); errorInfo->append(Tr::tr("First occurrence is here."), loc); errorInfo->append(Tr::tr("Next occurrence is here."), filesLocation); } return {}; } loc = filesLocation; } SourceArtifactPtr artifact = SourceArtifactInternal::create(); artifact->absoluteFilePath = absFilePath; artifact->fileTags = group->fileTags; artifact->overrideFileTags = group->overrideTags; artifact->properties = group->properties; artifact->targetOfModule = group->targetOfModule; artifact->fromWildcard = wildcard; QBS_CHECK(group->files); group->files->push_back(artifact); return artifact; } static QualifiedIdSet propertiesToEvaluate(std::deque initialProps, const PropertyDependencies &deps) { std::deque remainingProps = std::move(initialProps); QualifiedIdSet allProperties; while (!remainingProps.empty()) { const QualifiedId prop = remainingProps.front(); remainingProps.pop_front(); const auto insertResult = allProperties.insert(prop); if (!insertResult.second) continue; transform(deps.value(prop), remainingProps, [](const QualifiedId &id) { return id; }); } return allProperties; } QVariantMap ProductResolverStage2::resolveAdditionalModuleProperties( const Item *group, const QVariantMap ¤tValues) { // Step 1: Retrieve the properties directly set in the group const ModulePropertiesPerGroup &mp = m_product.modulePropertiesSetInGroups; const auto it = mp.find(group); if (it == mp.end()) return {}; const QualifiedIdSet &propsSetInGroup = it->second; // Step 2: Gather all properties that depend on these properties. const QualifiedIdSet &propsToEval = propertiesToEvaluate( rangeTo>(propsSetInGroup), m_loaderState.evaluator().propertyDependencies()); // Step 3: Evaluate all these properties and replace their values in the map QVariantMap modulesMap = currentValues; QHash propsPerModule; for (auto fullPropName : propsToEval) { const QString moduleName = QualifiedId(fullPropName.mid(0, fullPropName.size() - 1)).toString(); propsPerModule[moduleName] << fullPropName.last(); } EvalCacheEnabler cachingEnabler(&m_loaderState.evaluator(), m_product.product->sourceDirectory); for (const Item::Module &module : group->modules()) { const QString &fullModName = module.name.toString(); const QStringList propsForModule = propsPerModule.take(fullModName); if (propsForModule.empty()) continue; QVariantMap reusableValues = modulesMap.value(fullModName).toMap(); for (const QString &prop : std::as_const(propsForModule)) reusableValues.remove(prop); modulesMap.insert(fullModName, m_propertiesEvaluator.evaluateProperties( module.item, module.item, reusableValues, true, true)); } return modulesMap; } static QString getLineAtLocation(const CodeLocation &loc, const QString &content) { int pos = 0; int currentLine = 1; while (currentLine < loc.line()) { while (content.at(pos++) != QLatin1Char('\n')) ; ++currentLine; } const int eolPos = content.indexOf(QLatin1Char('\n'), pos); return content.mid(pos, eolPos - pos); } static bool usesImport(const ExportedProperty &prop, const QRegularExpression ®ex) { return prop.sourceCode.indexOf(regex) != -1; } static bool usesImport(const ExportedItem &item, const QRegularExpression ®ex) { return any_of(item.properties, [regex](const ExportedProperty &p) { return usesImport(p, regex); }) || any_of(item.children, [regex](const ExportedItemPtr &child) { return usesImport(*child, regex); }); } static bool usesImport(const ExportedModule &module, const QString &name) { // Imports are used in three ways: // (1) var f = new TextFile(...); // (2) var path = FileInfo.joinPaths(...) // (3) var obj = DataCollection; const QString pattern = QStringLiteral("\\b%1\\b"); const QRegularExpression regex(pattern.arg(name)); // std::regex is much slower return any_of(module.m_properties, [regex](const ExportedProperty &p) { return usesImport(p, regex); }) || any_of(module.children, [regex](const ExportedItemPtr &child) { return usesImport(*child, regex); }); } void ProductResolverStage2::resolveExport(Item *exportItem) { ExportedModule &exportedModule = m_product.product->exportedModule; setupExportedProperties(exportItem, QString(), exportedModule.m_properties); static const auto cmpFunc = [](const ExportedProperty &p1, const ExportedProperty &p2) { return p1.fullName < p2.fullName; }; std::sort(exportedModule.m_properties.begin(), exportedModule.m_properties.end(), cmpFunc); transform(exportItem->children(), exportedModule.children, [&exportedModule, this](const auto &child) { return resolveExportChild(child, exportedModule); }); for (const JsImport &jsImport : exportItem->file()->jsImports()) { if (usesImport(exportedModule, jsImport.scopeName)) { exportedModule.importStatements << getLineAtLocation(jsImport.location, exportItem->file()->content()); } } const auto builtInImports = JsExtensions::extensionNames(); for (const QString &builtinImport: builtInImports) { if (usesImport(exportedModule, builtinImport)) exportedModule.importStatements << QStringLiteral("import qbs.") + builtinImport; } exportedModule.importStatements.sort(); } // TODO: This probably wouldn't be necessary if we had item serialization. std::unique_ptr ProductResolverStage2::resolveExportChild( const Item *item, const ExportedModule &module) { std::unique_ptr exportedItem(new ExportedItem); // This is the type of the built-in base item. It may turn out that we need to support // derived items under Export. In that case, we probably need a new Item member holding // the original type name. exportedItem->name = item->typeName(); transform(item->children(), exportedItem->children, [&module, this](const auto &child) { return resolveExportChild(child, module); }); setupExportedProperties(item, QString(), exportedItem->properties); return exportedItem; } void ProductResolverStage2::setupExportedProperties(const Item *item, const QString &namePrefix, std::vector &properties) { const auto &props = item->properties(); for (auto it = props.cbegin(); it != props.cend(); ++it) { const QString qualifiedName = namePrefix.isEmpty() ? it.key() : namePrefix + QLatin1Char('.') + it.key(); if ((item->type() == ItemType::Export || item->type() == ItemType::Properties) && qualifiedName == StringConstants::prefixMappingProperty()) { continue; } const ValuePtr &v = it.value(); if (v->type() == Value::ItemValueType) { setupExportedProperties(std::static_pointer_cast(v)->item(), qualifiedName, properties); continue; } ExportedProperty exportedProperty; exportedProperty.fullName = qualifiedName; exportedProperty.type = item->propertyDeclaration(it.key()).type(); if (v->type() == Value::VariantValueType) { exportedProperty.sourceCode = toJSLiteral( std::static_pointer_cast(v)->value()); } else { QBS_CHECK(v->type() == Value::JSSourceValueType); const JSSourceValue * const sv = static_cast(v.get()); exportedProperty.sourceCode = sv->sourceCode().toString(); } const ItemDeclaration itemDecl = BuiltinDeclarations::instance().declarationsForType(item->type()); PropertyDeclaration propertyDecl; const auto itemProperties = itemDecl.properties(); for (const PropertyDeclaration &decl : itemProperties) { if (decl.name() == it.key()) { propertyDecl = decl; exportedProperty.isBuiltin = true; break; } } // Do not add built-in properties that were left at their default value. if (!exportedProperty.isBuiltin || m_loaderState.evaluator().isNonDefaultValue(item, it.key())) { properties.push_back(exportedProperty); } } // Order the list of properties, so the output won't look so random. static const auto less = [](const ExportedProperty &p1, const ExportedProperty &p2) -> bool { const int p1ComponentCount = p1.fullName.count(QLatin1Char('.')); const int p2ComponentCount = p2.fullName.count(QLatin1Char('.')); if (p1.isBuiltin && !p2.isBuiltin) return true; if (!p1.isBuiltin && p2.isBuiltin) return false; if (p1ComponentCount < p2ComponentCount) return true; if (p1ComponentCount > p2ComponentCount) return false; return p1.fullName < p2.fullName; }; std::sort(properties.begin(), properties.end(), less); } QVariantMap ProductResolverStage2::evaluateModuleValues(Item *item, bool lookupPrototype) { QVariantMap moduleValues; for (const Item::Module &module : item->modules()) { if (!module.item->isPresentModule()) continue; const QString fullName = module.name.toString(); moduleValues[fullName] = m_propertiesEvaluator.evaluateProperties( module.item, lookupPrototype, true); } return moduleValues; } void ProductResolverStage2::resolveScanner(Item *item, ModuleContext *moduleContext) { Evaluator &evaluator = m_loaderState.evaluator(); if (!evaluator.boolValue(item, StringConstants::conditionProperty())) { qCDebug(lcProjectResolver) << "scanner condition is false"; return; } ResolvedScannerPtr scanner = ResolvedScanner::create(); scanner->module = moduleContext ? moduleContext->module : m_product.project->dummyModule; scanner->inputs = evaluator.fileTagsValue(item, StringConstants::inputsProperty()); scanner->recursive = evaluator.boolValue(item, StringConstants::recursiveProperty()); scanner->searchPathsScript.initialize(m_loaderState.topLevelProject().scriptFunctionValue( item, StringConstants::searchPathsProperty())); scanner->scanScript.initialize(m_loaderState.topLevelProject().scriptFunctionValue( item, StringConstants::scanProperty())); m_product.product->scanners.push_back(scanner); } void ProductResolverStage2::resolveModules() { JobLimits jobLimits; for (const Item::Module &m : m_product.item->modules()) resolveModule(m.name, m.item, m.product, m.parameters, jobLimits); for (int i = 0; i < jobLimits.count(); ++i) { const JobLimit &moduleJobLimit = jobLimits.jobLimitAt(i); if (m_product.product->jobLimits.getLimit(moduleJobLimit.pool()) == -1) m_product.product->jobLimits.setJobLimit(moduleJobLimit); } } void ProductResolverStage2::resolveModule(const QualifiedId &moduleName, Item *item, bool isProduct, const QVariantMap ¶meters, JobLimits &jobLimits) { if (!item->isPresentModule()) return; ModuleContext moduleContext; moduleContext.module = ResolvedModule::create(); const ResolvedModulePtr &module = moduleContext.module; module->name = moduleName.toString(); module->location = item->location(); for (const PropertyDeclaration &propDecl : item->propertyDeclarations()) module->properties << std::make_pair(propDecl.name(), propDecl.location()); module->isProduct = isProduct; module->product = m_product.product.get(); module->setupBuildEnvironmentScript.initialize(m_loaderState.topLevelProject() .scriptFunctionValue(item, StringConstants::setupBuildEnvironmentProperty())); module->setupRunEnvironmentScript.initialize(m_loaderState.topLevelProject() .scriptFunctionValue(item, StringConstants::setupRunEnvironmentProperty())); for (const Item::Module &m : item->modules()) { if (m.item->isPresentModule()) module->moduleDependencies += m.name.toString(); } m_product.product->modules.push_back(module); if (!parameters.empty()) m_product.product->moduleParameters[module] = parameters; for (Item *child : item->children()) { switch (child->type()) { case ItemType::Rule: resolveRule(m_loaderState, child, nullptr, &m_product, &moduleContext); break; case ItemType::FileTagger: resolveFileTagger(m_loaderState, child, nullptr, &m_product); break; case ItemType::JobLimit: resolveJobLimit(m_loaderState, child, nullptr, nullptr, &moduleContext); break; case ItemType::Scanner: resolveScanner(child, &moduleContext); break; case ItemType::Group: resolveGroup(child, &moduleContext); break; default: break; } } for (int i = 0; i < moduleContext.jobLimits.count(); ++i) { const JobLimit &newJobLimit = moduleContext.jobLimits.jobLimitAt(i); const int oldLimit = jobLimits.getLimit(newJobLimit.pool()); if (oldLimit == -1 || oldLimit > newJobLimit.limit()) jobLimits.setJobLimit(newJobLimit); } } void ProductResolverStage2::applyFileTaggers() { m_product.product->fileTaggers << m_product.project->fileTaggers; m_product.product->fileTaggers = sorted(m_product.product->fileTaggers, [] (const FileTaggerConstPtr &a, const FileTaggerConstPtr &b) { return a->priority() > b->priority(); }); for (const SourceArtifactPtr &artifact : m_product.product->allEnabledFiles()) { if (!artifact->overrideFileTags || artifact->fileTags.empty()) { const QString fileName = FileInfo::fileName(artifact->absoluteFilePath); const FileTags fileTags = m_product.product->fileTagsForFileName(fileName); artifact->fileTags.unite(fileTags); if (artifact->fileTags.empty()) artifact->fileTags.insert(unknownFileTag()); qCDebug(lcProjectResolver) << "adding file tags" << artifact->fileTags << "to" << fileName; } } } void ProductResolverStage2::finalizeArtifactProperties() { for (const SourceArtifactPtr &artifact : m_product.product->allEnabledFiles()) { for (const auto &artifactProperties : m_product.product->artifactProperties) { if (!artifact->isTargetOfModule() && artifact->fileTags.intersects(artifactProperties->fileTagsFilter())) { // FIXME: Should be merged, not overwritten. artifact->properties = artifactProperties->propertyMap(); } } // Let a positive value of qbs.install imply the file tag "installable". if (artifact->properties->qbsPropertyValue(StringConstants::installProperty()).toBool()) artifact->fileTags += "installable"; } } void ProductResolverStage2::collectProductDependencies() { const ResolvedProductPtr &product = m_product.product; if (!product) return; for (const Item::Module &module : m_product.item->modules()) { if (!module.product) continue; const ResolvedProductPtr &dep = module.product->product; QBS_CHECK(dep); QBS_CHECK(dep != product); product->dependencies.emplace_back(dep, module.minimal); product->dependencyParameters.insert(dep, module.parameters); // TODO: Streamline this with normal module dependencies? } // TODO: We might want to keep the topological sorting and get rid of "module module dependencies". std::sort( product->dependencies.begin(), product->dependencies.end(), [](const ProductDependency &p1, const ProductDependency &p2) { return p1.product->fullDisplayName() < p2.product->fullDisplayName(); }); } void ExportsResolver::start() { resolveShadowProduct(); collectExportedProductDependencies(); } void ExportsResolver::resolveShadowProduct() { if (!m_product.product->enabled) return; if (!m_product.shadowProduct) return; for (const auto &m : m_product.shadowProduct->item->modules()) { if (m.name.toString() != m_product.product->name) continue; collectPropertiesForExportItem(m.item); for (const auto &dep : m.item->modules()) collectPropertiesForModuleInExportItem(dep); break; } try { adaptExportedPropertyValues(); } catch (const ErrorInfo &) {} } class TempScopeSetter { public: TempScopeSetter(const ValuePtr &value, Item *newScope) : m_value(value), m_oldScope(value->scope()) { value->setScope(newScope, {}); } ~TempScopeSetter() { if (m_value) m_value->setScope(m_oldScope, {}); } TempScopeSetter(const TempScopeSetter &) = delete; TempScopeSetter &operator=(const TempScopeSetter &) = delete; TempScopeSetter &operator=(TempScopeSetter &&) = delete; TempScopeSetter(TempScopeSetter &&other) noexcept : m_value(std::move(other.m_value)), m_oldScope(other.m_oldScope) { other.m_value.reset(); other.m_oldScope = nullptr; } private: ValuePtr m_value; Item *m_oldScope; }; void ExportsResolver::collectPropertiesForExportItem( const QualifiedId &moduleName, const ValuePtr &value, Item *moduleInstance, QVariantMap &moduleProps) { QBS_CHECK(value->type() == Value::ItemValueType); Item * const itemValueItem = std::static_pointer_cast(value)->item(); if (itemValueItem->propertyDeclarations().isEmpty()) { for (const Item::Module &module : moduleInstance->modules()) { if (module.name == moduleName) { itemValueItem->setPropertyDeclarations(module.item->propertyDeclarations()); break; } } } if (itemValueItem->type() == ItemType::ModuleInstancePlaceholder) { struct EvalPreparer { EvalPreparer(Item *valueItem, const QualifiedId &moduleName) : valueItem(valueItem), hadName(!!valueItem->variantProperty(StringConstants::nameProperty())) { if (!hadName) { // Evaluator expects a name here. valueItem->setProperty(StringConstants::nameProperty(), VariantValue::create(moduleName.toString())); } } ~EvalPreparer() { if (!hadName) valueItem->removeProperty(StringConstants::nameProperty()); } Item * const valueItem; const bool hadName; }; EvalPreparer ep(itemValueItem, moduleName); std::vector tss; for (const ValuePtr &v : itemValueItem->properties()) tss.emplace_back(v, moduleInstance); moduleProps.insert(moduleName.toString(), m_propertiesEvaluator.evaluateProperties( itemValueItem, false, false)); return; } QBS_CHECK(itemValueItem->type() == ItemType::ModulePrefix); const Item::PropertyMap &props = itemValueItem->properties(); for (auto it = props.begin(); it != props.end(); ++it) { QualifiedId fullModuleName = moduleName; fullModuleName << it.key(); collectPropertiesForExportItem(fullModuleName, it.value(), moduleInstance, moduleProps); } } void ExportsResolver::collectPropertiesForExportItem(Item *productModuleInstance) { if (!productModuleInstance->isPresentModule()) return; Item * const exportItem = productModuleInstance->prototype(); QBS_CHECK(exportItem); QBS_CHECK(exportItem->type() == ItemType::Export); const ItemDeclaration::Properties exportDecls = BuiltinDeclarations::instance() .declarationsForType(ItemType::Export).properties(); ExportedModule &exportedModule = m_product.product->exportedModule; const auto &props = exportItem->properties(); for (auto it = props.begin(); it != props.end(); ++it) { const auto match = [it](const PropertyDeclaration &decl) { return decl.name() == it.key(); }; if (it.key() != StringConstants::prefixMappingProperty() && std::find_if(exportDecls.begin(), exportDecls.end(), match) != exportDecls.end()) { continue; } if (it.value()->type() == Value::ItemValueType) { collectPropertiesForExportItem(it.key(), it.value(), productModuleInstance, exportedModule.modulePropertyValues); } else { TempScopeSetter tss(it.value(), productModuleInstance); m_propertiesEvaluator.evaluateProperty( exportItem, it.key(), it.value(), exportedModule.propertyValues, false); } } } // Collects module properties assigned to in other (higher-level) modules. void ExportsResolver::collectPropertiesForModuleInExportItem(const Item::Module &module) { if (!module.item->isPresentModule()) return; ExportedModule &exportedModule = m_product.product->exportedModule; if (module.product || module.name.first() == StringConstants::qbsModule()) return; const auto checkName = [module](const ExportedModuleDependency &d) { return module.name.toString() == d.name; }; if (any_of(exportedModule.moduleDependencies, checkName)) return; Item *modulePrototype = module.item->prototype(); while (modulePrototype && modulePrototype->type() != ItemType::Module) modulePrototype = modulePrototype->prototype(); if (!modulePrototype) // Can happen for broken products in relaxed mode. return; ModuleItemLocker locker(*modulePrototype); const Item::PropertyMap &props = modulePrototype->properties(); ExportedModuleDependency dep; dep.name = module.name.toString(); for (auto it = props.begin(); it != props.end(); ++it) { if (it.value()->type() == Value::ItemValueType) collectPropertiesForExportItem(it.key(), it.value(), module.item, dep.moduleProperties); } exportedModule.moduleDependencies.push_back(dep); for (const auto &dep : module.item->modules()) collectPropertiesForModuleInExportItem(dep); } void ExportsResolver::adaptExportedPropertyValues() { QBS_CHECK(m_product.shadowProduct); ExportedModule &m = m_product.product->exportedModule; const QVariantList prefixList = m.propertyValues.take( StringConstants::prefixMappingProperty()).toList(); const QString shadowProductName = m_loaderState.evaluator().stringValue( m_product.shadowProduct->item, StringConstants::nameProperty()); const QString shadowProductBuildDir = m_loaderState.evaluator().stringValue( m_product.shadowProduct->item, StringConstants::buildDirectoryProperty()); QVariantMap prefixMap; for (const QVariant &v : prefixList) { const QVariantMap o = v.toMap(); prefixMap.insert(o.value(QStringLiteral("prefix")).toString(), o.value(QStringLiteral("replacement")).toString()); } const auto valueRefersToImportingProduct = [shadowProductName, shadowProductBuildDir](const QString &value) { return value.toLower().contains(shadowProductName.toLower()) || value.contains(shadowProductBuildDir); }; static const auto stringMapper = [](const QVariantMap &mappings, const QString &value) -> QString { for (auto it = mappings.cbegin(); it != mappings.cend(); ++it) { if (value.startsWith(it.key())) return it.value().toString() + value.mid(it.key().size()); } return value; }; const auto stringListMapper = [&valueRefersToImportingProduct]( const QVariantMap &mappings, const QStringList &value) -> QStringList { QStringList result; result.reserve(value.size()); for (const QString &s : value) { if (!valueRefersToImportingProduct(s)) result.push_back(stringMapper(mappings, s)); } return result; }; const std::function mapper = [&stringListMapper, &mapper]( const QVariantMap &mappings, const QVariant &value) -> QVariant { switch (static_cast(value.userType())) { case QMetaType::QString: return stringMapper(mappings, value.toString()); case QMetaType::QStringList: return stringListMapper(mappings, value.toStringList()); case QMetaType::QVariantMap: { QVariantMap m = value.toMap(); for (auto it = m.begin(); it != m.end(); ++it) it.value() = mapper(mappings, it.value()); return m; } default: return value; } }; for (auto it = m.propertyValues.begin(); it != m.propertyValues.end(); ++it) it.value() = mapper(prefixMap, it.value()); for (auto it = m.modulePropertyValues.begin(); it != m.modulePropertyValues.end(); ++it) it.value() = mapper(prefixMap, it.value()); for (ExportedModuleDependency &dep : m.moduleDependencies) { for (auto it = dep.moduleProperties.begin(); it != dep.moduleProperties.end(); ++it) it.value() = mapper(prefixMap, it.value()); } } void ExportsResolver::collectExportedProductDependencies() { if (!m_product.shadowProduct) return; const ResolvedProductPtr exportingProduct = m_product.product; if (!exportingProduct || !exportingProduct->enabled) return; Item * const importingProductItem = m_product.shadowProduct->item; std::vector> directDeps; for (const Item::Module &m : importingProductItem->modules()) { if (m.name.toString() != exportingProduct->name) continue; for (const Item::Module &dep : m.item->modules()) { if (dep.product) directDeps.emplace_back(dep.product->product, m.parameters); } } for (const auto &dep : directDeps) { if (!contains(exportingProduct->exportedModule.productDependencies, dep.first->uniqueName())) { exportingProduct->exportedModule.productDependencies.push_back( dep.first->uniqueName()); } if (!dep.second.isEmpty()) { exportingProduct->exportedModule.dependencyParameters.insert(dep.first, dep.second); } } auto &productDeps = exportingProduct->exportedModule.productDependencies; std::sort(productDeps.begin(), productDeps.end()); } QVariantMap PropertiesEvaluator::evaluateProperties( const Item *item, const Item *propertiesContainer, const QVariantMap &tmplt, bool lookupPrototype, bool checkErrors) { AccumulatingTimer propEvalTimer(m_loaderState.parameters().logElapsedTime() ? &m_product.timingData.propertyEvaluation : nullptr); QVariantMap result = tmplt; for (auto it = propertiesContainer->properties().begin(); it != propertiesContainer->properties().end(); ++it) { evaluateProperty(item, it.key(), it.value(), result, checkErrors); } return lookupPrototype && propertiesContainer->prototype() && propertiesContainer->prototype()->type() != ItemType::Module ? evaluateProperties(item, propertiesContainer->prototype(), result, true, checkErrors) : result; } QVariantMap PropertiesEvaluator::evaluateProperties(Item *item, bool lookupPrototype, bool checkErrors) { const QVariantMap tmplt; return evaluateProperties(item, item, tmplt, lookupPrototype, checkErrors); } void PropertiesEvaluator::evaluateProperty( const Item *item, const QString &propName, const ValuePtr &propValue, QVariantMap &result, bool checkErrors) { JSContext * const ctx = m_loaderState.evaluator().engine()->context(); switch (propValue->type()) { case Value::ItemValueType: { // Ignore items. Those point to module instances // and are handled in evaluateModuleValues(). break; } case Value::JSSourceValueType: { if (result.contains(propName)) break; const PropertyDeclaration pd = item->propertyDeclaration(propName); if (pd.flags().testFlag(PropertyDeclaration::PropertyNotAvailableInConfig)) { break; } const ScopedJsValue scriptValue(ctx, m_loaderState.evaluator().property(item, propName)); if (m_loaderState.evaluator().engine()->checkForJsError(propValue->location())) { const ErrorInfo e = m_loaderState.evaluator().engine()->getAndClearJsError(); if (checkErrors) throw e; } // NOTE: Loses type information if scriptValue.isUndefined == true, // as such QScriptValues become invalid QVariants. QVariant v; if (JS_IsFunction(ctx, scriptValue)) { v = getJsString(ctx, scriptValue); } else { v = getJsVariant(ctx, scriptValue); QVariantMap m = v.toMap(); if (m.contains(StringConstants::importScopeNamePropertyInternal())) { QVariantMap tmp = m; const ScopedJsValue proto(ctx, JS_GetPrototype(ctx, scriptValue)); m = getJsVariant(ctx, proto).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 || pd.type() == PropertyDeclaration::StringList) { v = v.toStringList(); } else if (pd.type() == PropertyDeclaration::VariantList) { v = v.toList(); } // Enforce proper type for undefined values (note that path degrades to string). if (!v.isValid()) v = pd.typedNullValue(); pd.checkAllowedValues(v, propValue->location(), propName, m_loaderState); result[propName] = v; break; } case Value::VariantValueType: { if (result.contains(propName)) break; VariantValuePtr vvp = std::static_pointer_cast(propValue); QVariant v = vvp->value(); const PropertyDeclaration pd = item->propertyDeclaration(propName); if (v.isNull() && !pd.isScalar()) // QTBUG-51237 v = QStringList(); pd.checkAllowedValues(v, propValue->location(), propName, m_loaderState); result[propName] = v; break; } } } } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/loader/astimportshandler.h0000644000175100017510000000674515154533055022654 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ASTIMPORTSHANDLER_H #define QBS_ASTIMPORTSHANDLER_H #include #include #include #include #include namespace qbs { class CodeLocation; class Version; namespace Internal { class ItemReaderVisitorState; class JsImport; class Logger; class ASTImportsHandler { public: ASTImportsHandler(ItemReaderVisitorState &visitorState, Logger &logger, const FileContextPtr &file); void handleImports(const QbsQmlJS::AST::UiImportList *uiImportList); QHash typeNameFileMap() const { return m_typeNameToFile; } private: static Version readImportVersion(const QString &str, const CodeLocation &location); bool addPrototype(const QString &fileName, const QString &filePath, const QString &as, bool needsCheck); void checkImportVersion(const QbsQmlJS::AST::SourceLocation &versionToken) const; void collectPrototypes(const QString &path, const QString &as); void collectPrototypesAndJsCollections(const QString &path, const QString &as, const CodeLocation &location); void handleImport(const QbsQmlJS::AST::UiImport *import, bool *baseImported); ItemReaderVisitorState &m_visitorState; Logger &m_logger; const FileContextPtr &m_file; const QString m_directory; QHash m_typeNameToFile; Set m_importAsNames; using JsImportsHash = QHash; JsImportsHash m_jsImports; }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/loader/astpropertiesitemhandler.cpp0000644000175100017510000002575715154533055024571 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "astpropertiesitemhandler.h" #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { static const QString &autoGeneratedId() { static const QString autoGenerated = QLatin1String("__autoGenerated"); return autoGenerated; } ASTPropertiesItemHandler::ASTPropertiesItemHandler( Item *parentItem, ItemPool &itemPool, Logger &logger) : m_parentItem(parentItem) , m_itemPool(itemPool) , m_logger(logger) { prepareGroup(); } void ASTPropertiesItemHandler::handlePropertiesItems() { // TODO: Simply forbid Properties items to have child items and get rid of this check. if (m_parentItem->type() != ItemType::Properties) setupAlternatives(); } void ASTPropertiesItemHandler::prepareGroup() { if (m_parentItem->type() != ItemType::Group) return; // Syntactic sugar: If we encounter property bindings of the form "product.x.y: z" // (or "module.x.y: z" for groups in modules), we transform them into "x.y: z" // and put them in a newly created Properties item, thus making sure they will be // applied "globally". Item::PropertyMap &props = m_parentItem->properties(); for (auto it = props.begin(); it != props.end(); ++it) { if (it.value()->type() != Value::ItemValueType) continue; const bool hasProductPrefix = it.key() == StringConstants::productVar(); const bool hasModulePrefix = !hasProductPrefix && it.key() == StringConstants::moduleVar(); if (!hasProductPrefix && !hasModulePrefix) continue; Item * const valueItem = static_cast(it.value().get())->item(); Item * const propertiesItem = m_itemPool.allocateItem(ItemType::Properties); propertiesItem->setFile(m_parentItem->file()); propertiesItem->setProperties(valueItem->properties()); propertiesItem->setupForBuiltinType(DeprecationWarningMode::Off, m_logger); propertiesItem->setId(autoGeneratedId()); Item::addChild(m_parentItem, propertiesItem); if (hasModulePrefix) { Item *moduleItem = m_parentItem; while (moduleItem->type() == ItemType::Group) moduleItem = moduleItem->parent(); if (moduleItem->type() != ItemType::Module) { const QString errMsg = Tr::tr("Use of '%1' is only allowed in %2 items.") .arg( it.key(), BuiltinDeclarations::instance().nameForType( ItemType::Module)); const CodeLocation loc = valueItem->properties().first()->location(); throw ErrorInfo(errMsg, loc); } } props.erase(it); break; } } void ASTPropertiesItemHandler::setupAlternatives() { auto it = m_parentItem->m_children.begin(); while (it != m_parentItem->m_children.end()) { Item * const child = *it; bool remove = false; if (child->type() == ItemType::Properties) { handlePropertiesBlock(child); remove = m_parentItem->type() != ItemType::Export; } if (remove) it = m_parentItem->m_children.erase(it); else ++it; } } class PropertiesBlockConverter { public: PropertiesBlockConverter( const JSSourceValue::AltProperty &condition, const JSSourceValue::AltProperty &overrideListProperties, Item *propertiesBlockContainer, const Item *propertiesBlock, ItemPool &pool) : m_propertiesBlockContainer(propertiesBlockContainer) , m_propertiesBlock(propertiesBlock) , m_itemPool(pool) , m_autoGenerated(propertiesBlock->id() == autoGeneratedId()) { m_alternative.condition = condition; m_alternative.overrideListProperties = overrideListProperties; while (m_targetItem->type() == ItemType::Group) m_targetItem = m_targetItem->parent(); } void apply() { doApply(m_propertiesBlockContainer, m_propertiesBlock); } private: JSSourceValue::Alternative m_alternative; Item * const m_propertiesBlockContainer; Item *m_targetItem = m_propertiesBlockContainer; const Item * const m_propertiesBlock; ItemPool &m_itemPool; const bool m_autoGenerated; void doApply(Item *outer, const Item *inner) { for (auto it = inner->properties().constBegin(); it != inner->properties().constEnd(); ++it) { if (inner == m_propertiesBlock && (it.key() == StringConstants::conditionProperty() || it.key() == StringConstants::overrideListPropertiesProperty())) { continue; } if (it.value()->type() == Value::ItemValueType) { Item * const innerVal = std::static_pointer_cast(it.value())->item(); Item * const targetItem = outer == m_propertiesBlockContainer ? m_targetItem : outer; ItemValuePtr outerVal = targetItem->itemProperty(it.key(), m_itemPool); if (!outerVal) { outerVal = ItemValue::create(Item::create(&m_itemPool, innerVal->type()), true); targetItem->setProperty(it.key(), outerVal); } doApply(outerVal->item(), innerVal); } else if (it.value()->type() == Value::JSSourceValueType) { Item * const targetItem = outer == m_propertiesBlockContainer && m_autoGenerated ? m_targetItem : outer; const ValuePtr outerVal = targetItem->property(it.key()); if (Q_UNLIKELY(outerVal && outerVal->type() != Value::JSSourceValueType)) { throw ErrorInfo(Tr::tr("Incompatible value type in unconditional value at %1.") .arg(outerVal->location().toString())); } const JSSourceValuePtr value = std::static_pointer_cast(it.value()); doApply( it.key(), targetItem, std::static_pointer_cast(outerVal), value); if ((outer != m_propertiesBlockContainer || m_autoGenerated) && m_targetItem != m_propertiesBlockContainer) { QBS_CHECK(m_propertiesBlockContainer->type() == ItemType::Group); value->setScope(m_propertiesBlockContainer, {}); } } else { QBS_CHECK(!"Unexpected value type in conditional value."); } } } void doApply(const QString &propertyName, Item *item, JSSourceValuePtr value, const JSSourceValuePtr &conditionalValue) { if (!value) { value = JSSourceValue::create(true); value->setFile(conditionalValue->file()); item->setProperty(propertyName, value); value->setSourceCode(StringConstants::baseVar()); value->setSourceUsesBase(); } m_alternative.value = conditionalValue; if (m_alternative.condition.value == QLatin1String("undefined")) conditionalValue->setFallback(); value->addAlternative(m_alternative); } }; static JSSourceValue::AltProperty getPropertyData(const Item *propertiesItem, const QString &name) { const ValuePtr value = propertiesItem->property(name); if (!value) return {StringConstants::falseValue(), propertiesItem->location()}; if (Q_UNLIKELY(value->type() != Value::JSSourceValueType)) { throw ErrorInfo(Tr::tr("Properties.%1 must be a value binding.").arg(name), propertiesItem->location()); } if (name == StringConstants::overrideListPropertiesProperty()) { const Item *parent = propertiesItem->parent(); while (parent) { if (parent->type() == ItemType::Product) break; parent = parent->parent(); } if (!parent) { throw ErrorInfo(Tr::tr("Properties.overrideListProperties can only be set " "in a Product item.")); } } const JSSourceValuePtr srcval = std::static_pointer_cast(value); return {srcval->sourceCodeForEvaluation(), srcval->location()}; } void ASTPropertiesItemHandler::handlePropertiesBlock(const Item *propertiesItem) { const auto condition = getPropertyData(propertiesItem, StringConstants::conditionProperty()); const auto overrideListProperties = getPropertyData(propertiesItem, StringConstants::overrideListPropertiesProperty()); PropertiesBlockConverter(condition, overrideListProperties, m_parentItem, propertiesItem, m_itemPool).apply(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/loader/itemreaderastvisitor.h0000644000175100017510000000766115154533055023360 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ITEMREADERASTVISITOR_H #define QBS_ITEMREADERASTVISITOR_H #include #include #include #include #include #include #include namespace qbs { class CodeLocation; namespace Internal { class Item; class ItemPool; class ItemReaderVisitorState; class ModuleItemLocker; class ItemReaderASTVisitor : public QbsQmlJS::AST::Visitor { public: ItemReaderASTVisitor(ItemReaderVisitorState &visitorState, FileContextPtr file, ItemPool *itemPool, Logger &logger); ~ItemReaderASTVisitor(); void checkItemTypes() { doCheckItemTypes(rootItem()); } Item *rootItem() const { return m_item; } private: bool visit(QbsQmlJS::AST::UiProgram *uiProgram) override; bool visit(QbsQmlJS::AST::UiObjectDefinition *ast) override; bool visit(QbsQmlJS::AST::UiPublicMember *ast) override; bool visit(QbsQmlJS::AST::UiScriptBinding *ast) override; bool handleBindingRhs(QbsQmlJS::AST::Statement *statement, const JSSourceValuePtr &value); CodeLocation toCodeLocation(const QbsQmlJS::AST::SourceLocation &location) const; void checkDuplicateBinding(Item *item, const QStringList &bindingName, const QbsQmlJS::AST::SourceLocation &sourceLocation); Item *targetItemForBinding(const QStringList &binding, const JSSourceValueConstPtr &value); static void inheritItem(Item *dst, const Item *src); void checkDeprecationStatus(ItemType itemType, const QString &itemName, const CodeLocation &itemLocation); void doCheckItemTypes(const Item *item); ItemReaderVisitorState &m_visitorState; const FileContextPtr m_file; ItemPool * const m_itemPool; Logger &m_logger; QHash m_typeNameToFile; Item *m_item = nullptr; std::unique_ptr m_moduleItemLocker; ItemType m_instanceItemType = ItemType::ModuleInstancePlaceholder; }; } // namespace Internal } // namespace qbs #endif // QBS_ITEMREADERASTVISITOR_H qbs-src-3.2.0/src/lib/corelib/loader/moduleproviderloader.h0000644000175100017510000001040615154533055023325 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com) ** 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 MODULEPROVIDERLOADER_H #define MODULEPROVIDERLOADER_H #include "loaderutils.h" #include #include #include #include #include #include namespace qbs::Internal { class Item; class LoaderState; class ProductContext; class ModuleProviderLoader { public: explicit ModuleProviderLoader(LoaderState &loaderState); struct ModuleProviderResult { bool providerFound = false; std::optional searchPaths; }; ModuleProviderResult executeModuleProviders( ProductContext &productContext, const CodeLocation &dependsItemLocation, const QualifiedId &moduleName); private: enum class ModuleProviderLookup { Scoped, Named }; struct Provider { QualifiedId name; ModuleProviderLookup lookup; }; ModuleProviderResult executeModuleProvidersHelper( ProductContext &product, const CodeLocation &dependsItemLocation, const QualifiedId &moduleName, const std::vector &providers); std::pair findOrCreateProviderInfo(ProductContext &product, const CodeLocation &dependsItemLocation, const QualifiedId &moduleName, const QualifiedId &name, ModuleProviderLookup lookupType, const QVariantMap &qbsModule); void setupModuleProviderConfig(ProductContext &product); std::optional> getModuleProviders(Item *item); QString findModuleProviderFile(const QualifiedId &name, ModuleProviderLookup lookupType); QVariantMap evaluateQbsModule(ProductContext &product) const; Item *createProviderScope(const ProductContext &product, const QVariantMap &qbsModule); using EvaluationResult = std::pair; EvaluationResult evaluateModuleProvider( ProductContext &product, const CodeLocation &dependsItemLocation, const QualifiedId &moduleName, const QualifiedId &name, const QString &providerFile, const QVariantMap &moduleConfig, const QVariantMap &qbsModule); void checkAllowedValues(Item *providerItem); LoaderState &m_loaderState; }; } // namespace qbs::Internal #endif // MODULEPROVIDERLOADER_H qbs-src-3.2.0/src/lib/corelib/loader/projectresolver.cpp0000644000175100017510000005751615154533055022676 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "projectresolver.h" #include "itemreader.h" #include "loaderutils.h" #include "productscollector.h" #include "productsresolver.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { static SetupProjectParameters finalizedProjectParameters(const SetupProjectParameters &in, Logger &logger) { SetupProjectParameters params = in; if (params.topLevelProfile().isEmpty()) { Settings settings(params.settingsDirectory()); QString profileName = settings.defaultProfile(); if (profileName.isEmpty()) { logger.qbsDebug() << Tr::tr("No profile specified and no default profile exists. " "Using default property values."); profileName = Profile::fallbackName(); } params.setTopLevelProfile(profileName); params.expandBuildConfiguration(); } params.finalizeProjectFilePath(); QBS_CHECK(QFileInfo(params.projectFilePath()).isAbsolute()); QBS_CHECK(FileInfo::isAbsolute(params.buildRoot())); return params; } class ProjectResolver::Private { public: Private(const SetupProjectParameters ¶meters, ScriptEngine *engine, Logger &&logger) : setupParams(finalizedProjectParameters(parameters, logger)), engine(engine), logger(std::move(logger)) {} TopLevelProjectPtr resolveTopLevelProject(); void resolveProject(ProjectContext *projectContext); void resolveProjectFully(ProjectContext *projectContext); void resolveSubProject(Item *item, ProjectContext *projectContext); void checkOverriddenValues(); void collectNameFromOverride(const QString &overrideString); void loadTopLevelProjectItem(); void buildProjectTree(); void printProfilingInfo(); const SetupProjectParameters setupParams; ScriptEngine * const engine; mutable Logger logger; ItemPool itemPool; TopLevelProjectContext topLevelProject; LoaderState state{setupParams, topLevelProject, itemPool, *engine, logger}; Item *rootProjectItem = nullptr; }; ProjectResolver::ProjectResolver(const SetupProjectParameters ¶meters, ScriptEngine *engine, Logger logger) : d(makePimpl(parameters, engine, std::move(logger))) { d->logger.storeWarnings(); } ProjectResolver::~ProjectResolver() = default; void ProjectResolver::setProgressObserver(ProgressObserver *observer) { d->state.topLevelProject().setProgressObserver(observer); } void ProjectResolver::setOldProjectProbes(const std::vector &oldProbes) { d->state.topLevelProject().setOldProjectProbes(oldProbes); } void ProjectResolver::setOldProductProbes( const QHash> &oldProbes) { d->state.topLevelProject().setOldProductProbes(oldProbes); } void ProjectResolver::setLastResolveTime(const FileTime &time) { d->state.topLevelProject().setLastResolveTime(time); } void ProjectResolver::setStoredProfiles(const QVariantMap &profiles) { d->state.topLevelProject().setProfileConfigs(profiles); } void ProjectResolver::setStoredModuleProviderInfo(const StoredModuleProviderInfo &providerInfo) { d->state.topLevelProject().setModuleProvidersCache(providerInfo.providers); } static void checkForDuplicateProductNames(const TopLevelProjectConstPtr &project) { const std::vector allProducts = project->allProducts(); for (size_t i = 0; i < allProducts.size(); ++i) { const ResolvedProductConstPtr product1 = allProducts.at(i); const QString productName = product1->uniqueName(); for (size_t j = i + 1; j < allProducts.size(); ++j) { const ResolvedProductConstPtr product2 = allProducts.at(j); if (product2->uniqueName() == productName) { ErrorInfo error; error.append(Tr::tr("Duplicate product name '%1'.").arg(product1->name)); error.append(Tr::tr("First product defined here."), product1->location); error.append(Tr::tr("Second product defined here."), product2->location); throw error; } } } } TopLevelProjectPtr ProjectResolver::resolve() { qCDebug(lcProjectResolver) << "resolving" << d->setupParams.projectFilePath(); d->engine->setEnvironment(d->setupParams.adjustedEnvironment()); if (d->engine->checkForJsError({})) d->engine->getAndClearJsError(); d->engine->clearImportsCache(); d->engine->clearRequestedProperties(); d->engine->enableProfiling(d->setupParams.logElapsedTime()); d->logger.clearWarnings(); EvalContextSwitcher evalContextSwitcher(d->engine, EvalContext::PropertyEvaluation); // At this point, we cannot set a sensible total effort, because we know nothing about // the project yet. That's why we use a placeholder here, so the user at least // sees that an operation is starting. The real total effort will be set later when // we have enough information. if (ProgressObserver * const observer = d->state.topLevelProject().progressObserver()) { observer->initialize(Tr::tr("Resolving project for configuration %1") .arg(TopLevelProject::deriveId(d->setupParams.finalBuildConfigurationTree())), 1); observer->addScriptEngine(d->engine); } const FileTime resolveTime = FileTime::currentTime(); TopLevelProjectPtr tlp; try { d->checkOverriddenValues(); d->loadTopLevelProjectItem(); d->buildProjectTree(); tlp = d->resolveTopLevelProject(); } catch (const CancelException &) { throw ErrorInfo(Tr::tr("Project resolving canceled for configuration '%1'.") .arg(TopLevelProject::deriveId( d->setupParams.finalBuildConfigurationTree()))); } tlp->lastStartResolveTime = resolveTime; tlp->lastEndResolveTime = FileTime::currentTime(); // E.g. if the top-level project is disabled. if (ProgressObserver * const observer = d->state.topLevelProject().progressObserver()) { observer->setFinished(); d->printProfilingInfo(); } return tlp; } static void makeSubProjectNamesUniqe(const ResolvedProjectPtr &parentProject) { Set subProjectNames; Set projectsInNeedOfNameChange; for (const ResolvedProjectPtr &p : std::as_const(parentProject->subProjects)) { if (!subProjectNames.insert(p->name).second) projectsInNeedOfNameChange << p; makeSubProjectNamesUniqe(p); } while (!projectsInNeedOfNameChange.empty()) { auto it = projectsInNeedOfNameChange.begin(); while (it != projectsInNeedOfNameChange.end()) { const ResolvedProjectPtr p = *it; p->name += QLatin1Char('_'); if (subProjectNames.insert(p->name).second) { it = projectsInNeedOfNameChange.erase(it); } else { ++it; } } } } TopLevelProjectPtr ProjectResolver::Private::resolveTopLevelProject() { if (ProgressObserver * const observer = state.topLevelProject().progressObserver()) observer->setMaximum(state.topLevelProject().productCount()); TopLevelProjectPtr project = TopLevelProject::create(); project->buildDirectory = TopLevelProject::deriveBuildDirectory( setupParams.buildRoot(), TopLevelProject::deriveId(setupParams.finalBuildConfigurationTree())); if (!state.topLevelProject().projects().empty()) { ProjectContext * const projectContext = state.topLevelProject().projects().front(); QBS_CHECK(projectContext->item == rootProjectItem); projectContext->project = project; resolveProject(projectContext); } resolveProducts(state); ErrorInfo accumulatedErrors; { const auto queuedErrors = state.topLevelProject().queuedErrors(); for (const ErrorInfo &e : queuedErrors.get()) appendError(accumulatedErrors, e); } if (accumulatedErrors.hasError()) throw accumulatedErrors; project->buildSystemFiles.unite(state.topLevelProject().buildSystemFiles()); project->profileConfigs = state.topLevelProject().profileConfigs(); project->codeLinks = state.topLevelProject().codeLinks(); const QVariantMap &profiles = state.topLevelProject().localProfiles(); for (auto it = profiles.begin(); it != profiles.end(); ++it) project->profileConfigs.remove(it.key()); project->probes = state.topLevelProject().projectLevelProbes(); project->moduleProviderInfo.providers = state.topLevelProject().moduleProvidersCache(); project->setBuildConfiguration(setupParams.finalBuildConfigurationTree()); project->overriddenValues = setupParams.overriddenValues(); state.topLevelProject().collectDataFromEngine(*engine); makeSubProjectNamesUniqe(project); checkForDuplicateProductNames(project); project->warningsEncountered << logger.warnings(); project->errorsEncountered << logger.errors(); return project; } void ProjectResolver::Private::resolveProject(ProjectContext *projectContext) { state.topLevelProject().checkCancelation(); if (projectContext->parent) { projectContext->project = ResolvedProject::create(); projectContext->parent->project->subProjects.push_back(projectContext->project); projectContext->project->parentProject = projectContext->parent->project; projectContext->project->enabled = projectContext->parent->project->enabled; } projectContext->project->location = projectContext->item->location(); try { resolveProjectFully(projectContext); } catch (const ErrorInfo &error) { if (!projectContext->project->enabled) { qCDebug(lcProjectResolver) << "error resolving project" << projectContext->project->location << error.toString(); return; } if (setupParams.productErrorMode() == ErrorHandlingMode::Strict) throw; logger.printError(error); } } void ProjectResolver::Private::resolveProjectFully(ProjectContext *projectContext) { Item * const item = projectContext->item; projectContext->project->enabled = projectContext->project->enabled && state.evaluator().boolValue(item, StringConstants::conditionProperty()); projectContext->project->name = state.evaluator().stringValue( item, StringConstants::nameProperty()); if (projectContext->project->name.isEmpty()) projectContext->project->name = FileInfo::baseName(item->location().filePath()); // FIXME: Must also be changed in item? QVariantMap projectProperties; if (!projectContext->project->enabled) { projectProperties.insert(StringConstants::profileProperty(), state.evaluator().stringValue( item, StringConstants::profileProperty())); projectContext->project->setProjectProperties(projectProperties); return; } projectContext->dummyModule = ResolvedModule::create(); for (Item::PropertyDeclarationMap::const_iterator it = item->propertyDeclarations().constBegin(); it != item->propertyDeclarations().constEnd(); ++it) { if (it.value().flags().testFlag(PropertyDeclaration::PropertyNotAvailableInConfig)) continue; const ValueConstPtr v = item->property(it.key()); QBS_ASSERT(v && v->type() != Value::ItemValueType, continue); const ScopedJsValue sv(engine->context(), state.evaluator().value(item, it.key())); projectProperties.insert(it.key(), getJsVariant(engine->context(), sv)); } projectContext->project->setProjectProperties(projectProperties); for (Item * const child : item->children()) { state.topLevelProject().checkCancelation(); try { switch (child->type()) { case ItemType::SubProject: resolveSubProject(child, projectContext); break; case ItemType::FileTagger: resolveFileTagger(state, child, projectContext, nullptr); break; case ItemType::JobLimit: resolveJobLimit(state, child, projectContext, nullptr, nullptr); break; case ItemType::Rule: resolveRule(state, child, projectContext, nullptr, nullptr); break; default: break; } } catch (const ErrorInfo &e) { state.topLevelProject().addQueuedError(e); } } for (ProjectContext * const childContext : projectContext->children) resolveProject(childContext); } void ProjectResolver::Private::resolveSubProject(Item *item, ProjectContext *projectContext) { // If we added a Project child item in ProductsCollector, then the sub-project will be // resolved normally via resolveProject(). Otherwise, it was not loaded, for instance // because its Properties condition was false, and special handling applies. if (item->child(ItemType::Project)) return; ResolvedProjectPtr project = ResolvedProject::create(); project->enabled = false; project->parentProject = projectContext->project; projectContext->project->subProjects << project; if (Item * const propertiesItem = item->child(ItemType::PropertiesInSubProject)) { project->name = state.evaluator().stringValue(propertiesItem, StringConstants::nameProperty()); } } void ProjectResolver::Private::checkOverriddenValues() { static const auto matchesPrefix = [](const QString &key) { static const QStringList prefixes({StringConstants::projectPrefix(), QStringLiteral("projects"), QStringLiteral("products"), QStringLiteral("modules"), StringConstants::moduleProviders(), StringConstants::qbsModule()}); return any_of(prefixes, [&key](const QString &prefix) { return key.startsWith(prefix + QLatin1Char('.')); }); }; const QVariantMap &overriddenValues = state.parameters().overriddenValues(); for (auto it = overriddenValues.begin(); it != overriddenValues.end(); ++it) { if (matchesPrefix(it.key())) { collectNameFromOverride(it.key()); continue; } ErrorInfo e(Tr::tr("Property override key '%1' not understood.").arg(it.key())); e.append(Tr::tr("Please use one of the following:")); e.append(QLatin1Char('\t') + Tr::tr("projects..:value")); e.append(QLatin1Char('\t') + Tr::tr("products..:value")); e.append(QLatin1Char('\t') + Tr::tr("modules..:value")); e.append(QLatin1Char('\t') + Tr::tr("products..." ":value")); e.append(QLatin1Char('\t') + Tr::tr("moduleProviders.." ":value")); handlePropertyError(e, state.parameters(), state.logger()); } } void ProjectResolver::Private::collectNameFromOverride(const QString &overrideString) { const auto extract = [&overrideString](const QString &prefix) { if (!overrideString.startsWith(prefix)) return QString(); const int startPos = prefix.length(); const int endPos = overrideString.lastIndexOf(StringConstants::dot()); if (endPos == -1) return QString(); return overrideString.mid(startPos, endPos - startPos); }; const QString &projectName = extract(StringConstants::projectsOverridePrefix()); if (!projectName.isEmpty()) { state.topLevelProject().addProjectNameUsedInOverrides(projectName); return; } const QString &productName = extract(StringConstants::productsOverridePrefix()); if (!productName.isEmpty()) { state.topLevelProject().addProductNameUsedInOverrides(productName.left( productName.indexOf(StringConstants::dot()))); return; } } void ProjectResolver::Private::loadTopLevelProjectItem() { const QStringList topLevelSearchPaths = state.parameters().finalBuildConfigurationTree() .value(StringConstants::projectPrefix()).toMap() .value(StringConstants::qbsSearchPathsProperty()).toStringList(); SearchPathsManager searchPathsManager(state.itemReader(), topLevelSearchPaths); Item * const root = state.itemReader().setupItemFromFile( state.parameters().projectFilePath(), {}); if (!root) return; switch (root->type()) { case ItemType::Product: rootProjectItem = state.itemReader().wrapInProjectIfNecessary(root); break; case ItemType::Project: rootProjectItem = root; break; default: throw ErrorInfo(Tr::tr("The top-level item must be of type 'Project' or 'Product', but it" " is of type '%1'.").arg(root->typeName()), root->location()); } } void ProjectResolver::Private::buildProjectTree() { state.topLevelProject().setBuildDirectory(TopLevelProject::deriveBuildDirectory( state.parameters().buildRoot(), TopLevelProject::deriveId(state.parameters().finalBuildConfigurationTree()))); rootProjectItem->setProperty(StringConstants::sourceDirectoryProperty(), VariantValue::create(QFileInfo(rootProjectItem->file()->filePath()) .absolutePath())); rootProjectItem->setProperty(StringConstants::buildDirectoryProperty(), VariantValue::create(state.topLevelProject().buildDirectory())); rootProjectItem->setProperty(StringConstants::profileProperty(), VariantValue::create(state.parameters().topLevelProfile())); ProductsCollector(state).run(rootProjectItem); AccumulatingTimer timer(state.parameters().logElapsedTime() ? &state.topLevelProject().timingData().propertyChecking : nullptr); checkPropertyDeclarations(rootProjectItem, state); } void ProjectResolver::Private::printProfilingInfo() { if (!setupParams.logElapsedTime()) return; const auto print = [this](int indent, const QString &pattern, qint64 time) { logger.qbsLog(LoggerInfo, true) << QByteArray(indent, ' ') << pattern.arg(elapsedTimeString(time)); }; print(2, Tr::tr("Project file loading and parsing took %1."), state.itemReader().elapsedTime()); print(2, Tr::tr("Preparing products took %1."), state.topLevelProject().timingData().preparingProducts); print(2, Tr::tr("Setting up Groups took %1."), state.topLevelProject().timingData().groupsSetup); print(2, Tr::tr("Scheduling products took %1."), state.topLevelProject().timingData().schedulingProducts); print(2, Tr::tr("Resolving products took %1."), state.topLevelProject().timingData().resolvingProducts); print(4, Tr::tr("Property evaluation took %1."), state.topLevelProject().timingData().propertyEvaluation); print(4, Tr::tr("Resolving groups (without module property evaluation) took %1."), state.topLevelProject().timingData().groupsResolving); print(4, Tr::tr("Setting up product dependencies took %1."), state.topLevelProject().timingData().dependenciesResolving); print(6, Tr::tr("Running module providers took %1."), state.topLevelProject().timingData().moduleProviders); print(6, Tr::tr("Instantiating modules took %1."), state.topLevelProject().timingData().moduleInstantiation); print(6, Tr::tr("Merging module property values took %1."), state.topLevelProject().timingData().propertyMerging); logger.qbsLog(LoggerInfo, true) << QByteArray(4, ' ') << "There were " << state.topLevelProject().productDeferrals() << " product deferrals with a total of " << state.topLevelProject().productCount() << " products."; print(2, Tr::tr("Running Probes took %1."), state.topLevelProject().timingData().probes); state.logger().qbsLog(LoggerInfo, true) << " " << Tr::tr("%1 probes encountered, %2 configure scripts executed, " "%3 re-used from current run, %4 re-used from earlier run.") .arg(state.topLevelProject().probesEncounteredCount()) .arg(state.topLevelProject().probesRunCount()) .arg(state.topLevelProject().reusedCurrentProbesCount()) .arg(state.topLevelProject().reusedOldProbesCount()); print(2, Tr::tr("Property checking took %1."), state.topLevelProject().timingData().propertyChecking); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/loader/productitemmultiplexer.cpp0000644000175100017510000002513015154533055024263 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #include "productitemmultiplexer.h" #include "loaderutils.h" #include "moduleinstantiator.h" #include #include #include #include #include #include #include #include #include #include // This module deals with product multiplexing over the various defined axes. // For instance, a product with qbs.architectures: ["x86", "arm"] will get multiplexed into // two products with qbs.architecture: "x86" and qbs.architecture: "arm", respectively. namespace qbs::Internal { namespace { using MultiplexRow = std::vector; using MultiplexTable = std::vector; class MultiplexInfo { public: std::vector properties; MultiplexTable table; bool aggregate = false; VariantValuePtr multiplexedType; QString toIdString(size_t row, LoaderState &loaderState) const; }; } // namespace class ProductItemMultiplexer { public: ProductItemMultiplexer(const QString &productName, Item *productItem, Item *tempQbsModuleItem, const std::function &dropTempQbsModule, LoaderState &loaderState) : m_loaderState(loaderState), m_productName(productName), m_productItem(productItem), m_tempQbsModuleItem(tempQbsModuleItem), m_dropTempQbsModule(dropTempQbsModule) {} QList multiplex(); private: MultiplexInfo extractMultiplexInfo(); MultiplexTable combine(const MultiplexTable &table, const MultiplexRow &values); LoaderState &m_loaderState; const QString &m_productName; Item * const m_productItem; Item * const m_tempQbsModuleItem; const std::function &m_dropTempQbsModule; }; QList ProductItemMultiplexer::multiplex() { const auto multiplexInfo = extractMultiplexInfo(); m_dropTempQbsModule(); if (multiplexInfo.table.size() > 1) m_productItem->setProperty(StringConstants::multiplexedProperty(), VariantValue::trueValue()); VariantValuePtr productNameValue = VariantValue::create(m_productName); Item *aggregator = multiplexInfo.aggregate ? m_productItem->clone(m_loaderState.itemPool()) : nullptr; QList additionalProductItems; std::vector multiplexConfigurationIdValues; for (size_t row = 0; row < multiplexInfo.table.size(); ++row) { Item *item = m_productItem; const auto &mprow = multiplexInfo.table.at(row); QBS_CHECK(mprow.size() == multiplexInfo.properties.size()); if (row > 0) { item = m_productItem->clone(m_loaderState.itemPool()); additionalProductItems.push_back(item); } const QString multiplexConfigurationId = multiplexInfo.toIdString(row, m_loaderState); const VariantValuePtr multiplexConfigurationIdValue = VariantValue::create(multiplexConfigurationId); if (multiplexInfo.table.size() > 1 || aggregator) { multiplexConfigurationIdValues.push_back(multiplexConfigurationIdValue); item->setProperty(StringConstants::multiplexConfigurationIdProperty(), multiplexConfigurationIdValue); } if (multiplexInfo.multiplexedType) item->setProperty(StringConstants::typeProperty(), multiplexInfo.multiplexedType); for (size_t column = 0; column < mprow.size(); ++column) { Item * const qbsItem = retrieveQbsItem(item, m_loaderState); const QString &propertyName = multiplexInfo.properties.at(column); const VariantValuePtr &mpvalue = mprow.at(column); qbsItem->setProperty(propertyName, mpvalue); } } if (aggregator) { additionalProductItems << aggregator; // Add dependencies to all multiplexed instances. for (const auto &v : multiplexConfigurationIdValues) { Item *dependsItem = Item::create(&m_loaderState.itemPool(), ItemType::Depends); dependsItem->setProperty(StringConstants::nameProperty(), productNameValue); dependsItem->setProperty(StringConstants::multiplexConfigurationIdsProperty(), v); dependsItem->setProperty(StringConstants::profilesProperty(), VariantValue::create(QStringList())); dependsItem->setFile(aggregator->file()); dependsItem->setupForBuiltinType(m_loaderState.parameters().deprecationWarningMode(), m_loaderState.logger()); Item::addChild(aggregator, dependsItem); } } return additionalProductItems; } MultiplexInfo ProductItemMultiplexer::extractMultiplexInfo() { static const QString mpmKey = QStringLiteral("multiplexMap"); Evaluator &evaluator = m_loaderState.evaluator(); JSContext * const ctx = evaluator.engine()->context(); const ScopedJsValue multiplexMap(ctx, evaluator.value(m_tempQbsModuleItem, mpmKey)); const QStringList multiplexByQbsProperties = evaluator.stringListValue( m_productItem, StringConstants::multiplexByQbsPropertiesProperty()); MultiplexInfo multiplexInfo; multiplexInfo.aggregate = evaluator.boolValue( m_productItem, StringConstants::aggregateProperty()); const QString multiplexedType = evaluator.stringValue( m_productItem, StringConstants::multiplexedTypeProperty()); if (!multiplexedType.isEmpty()) multiplexInfo.multiplexedType = VariantValue::create(multiplexedType); Set uniqueMultiplexByQbsProperties; for (const QString &key : multiplexByQbsProperties) { const QString mappedKey = getJsStringProperty(ctx, multiplexMap, key); if (mappedKey.isEmpty()) throw ErrorInfo(Tr::tr("There is no entry for '%1' in 'qbs.multiplexMap'.").arg(key)); if (!uniqueMultiplexByQbsProperties.insert(mappedKey).second) continue; const ScopedJsValue arr(ctx, evaluator.value(m_tempQbsModuleItem, key)); if (JS_IsUndefined(arr)) continue; if (!JS_IsArray(arr)) throw ErrorInfo(Tr::tr("Property '%1' must be an array.").arg(key)); const quint32 arrlen = getJsIntProperty(ctx, arr, StringConstants::lengthProperty()); if (arrlen == 0) continue; MultiplexRow mprow; mprow.reserve(arrlen); QVariantList entriesForKey; for (quint32 i = 0; i < arrlen; ++i) { const ScopedJsValue sv(ctx, JS_GetPropertyUint32(ctx, arr, i)); const QVariant value = getJsVariant(ctx, sv); if (entriesForKey.contains(value)) continue; entriesForKey << value; mprow.push_back(VariantValue::create(value)); } multiplexInfo.table = combine(multiplexInfo.table, mprow); multiplexInfo.properties.push_back(mappedKey); } return multiplexInfo; } MultiplexTable ProductItemMultiplexer::combine(const MultiplexTable &table, const MultiplexRow &values) { MultiplexTable result; if (table.empty()) { result.resize(values.size()); for (size_t i = 0; i < values.size(); ++i) { MultiplexRow row; row.resize(1); row[0] = values.at(i); result[i] = row; } } else { for (const auto &row : table) { for (const auto &value : values) { MultiplexRow newRow = row; newRow.push_back(value); result.push_back(newRow); } } } return result; } QString MultiplexInfo::toIdString(size_t row, LoaderState &loaderState) const { const auto &mprow = table.at(row); QVariantMap multiplexConfiguration; for (size_t column = 0; column < mprow.size(); ++column) { const QString &propertyName = properties.at(column); const VariantValuePtr &mpvalue = mprow.at(column); multiplexConfiguration.insert(propertyName, mpvalue->value()); } QString id = QString::fromUtf8(QJsonDocument::fromVariant(multiplexConfiguration) .toJson(QJsonDocument::Compact) .toBase64()); // Cache for later use in multiplexIdToVariantMap() loaderState.topLevelProject().addMultiplexConfiguration(id, multiplexConfiguration); return id; } QList multiplex(const QString &productName, Item *productItem, Item *tempQbsModuleItem, const std::function &dropTempQbsModule, LoaderState &loaderState) { return ProductItemMultiplexer(productName, productItem, tempQbsModuleItem, dropTempQbsModule, loaderState).multiplex(); } } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/buildgraph/0000755000175100017510000000000015154533055017577 5ustar runnerrunnerqbs-src-3.2.0/src/lib/corelib/buildgraph/rawscanresults.cpp0000644000175100017510000000622715154533055023372 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "rawscanresults.h" #include "filedependency.h" #include "depscanner.h" #include namespace qbs { namespace Internal { RawScanResults::ScanData &RawScanResults::findScanData( const FileResourceBase *file, const QString &scannerId, const PropertyMapConstPtr &moduleProperties, const FilterFunction &filter) { std::vector &scanDataForFile = m_rawScanData[file->filePath()]; for (auto &scanData : scanDataForFile) { if (scannerId != scanData.scannerId) continue; if (!filter(moduleProperties, scanData.moduleProperties)) continue; return scanData; } ScanData newScanData; newScanData.scannerId = scannerId; newScanData.moduleProperties = moduleProperties; scanDataForFile.push_back(std::move(newScanData)); return scanDataForFile.back(); } RawScanResults::ScanData &RawScanResults::findScanData( const FileResourceBase *file, const DependencyScanner *scanner, const PropertyMapConstPtr &moduleProperties) { auto predicate = [scanner](const PropertyMapConstPtr &lhs, const PropertyMapConstPtr &rhs) { return scanner->areModulePropertiesCompatible(lhs, rhs); }; return findScanData(file, scanner->id(), moduleProperties, predicate); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/transformerchangetracking.h0000644000175100017510000000406115154533055025204 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 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 QBS_TRANSFORMERCHANGETRACKING_H #define QBS_TRANSFORMERCHANGETRACKING_H #include "forward_decls.h" #include #include namespace qbs { namespace Internal { bool prepareScriptNeedsRerun( Transformer *transformer, const ResolvedProduct *product, const std::unordered_map &productsByName, const std::unordered_map &projectsByName); bool commandsNeedRerun(Transformer *transformer, const ResolvedProduct *product, const std::unordered_map &productsByName, const std::unordered_map &projectsByName); } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/buildgraph/dependencyparametersscriptvalue.cpp0000644000175100017510000000727615154533055027003 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #include "dependencyparametersscriptvalue.h" #include #include #include #include namespace qbs { namespace Internal { static JSValue toScriptValue(ScriptEngine *engine, const QString &productName, const QVariantMap &v, const QString &depName, const QualifiedId &moduleName) { JSValue obj = engine->newObject(); bool objIdAddedToObserver = false; for (auto it = v.begin(); it != v.end(); ++it) { if (it.value().userType() == QMetaType::QVariantMap) { setJsProperty(engine->context(), obj, it.key(), toScriptValue(engine, productName, it.value().toMap(), depName, QualifiedId(moduleName) << it.key())); } else { if (!objIdAddedToObserver) { objIdAddedToObserver = true; engine->observer()->addParameterObjectId(jsObjectId(obj), productName, depName, moduleName); } const ScopedJsValue val(engine->context(), engine->toScriptValue(it.value())); engine->setObservedProperty(obj, it.key(), val); } } return obj; } static JSValue toScriptValue(ScriptEngine *scriptEngine, const QString &productName, const QVariantMap &v, const QString &depName) { return toScriptValue(scriptEngine, productName, v, depName, {}); } JSValue dependencyParametersValue(const QString &productName, const QString &dependencyName, const QVariantMap ¶metersMap, ScriptEngine *engine) { return toScriptValue(engine, productName, parametersMap, dependencyName); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/qtmocscanner.h0000644000175100017510000000553215154533055022452 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_QTMOCSCANNER_H #define QBS_QTMOCSCANNER_H #include #include #include #include QT_BEGIN_NAMESPACE class QScriptContext; QT_END_NAMESPACE class ScannerPlugin; namespace qbs { namespace Internal { class ScriptEngine; class Artifact; struct CommonFileTags; class QtMocScanner { public: explicit QtMocScanner(const ResolvedProductPtr &product, ScriptEngine *engine, JSValue targetScriptValue); ~QtMocScanner(); private: void findIncludedMocCppFiles(); static JSValue js_apply(JSContext *ctx, JSValue this_val, int argc, JSValue *argv); JSValue apply(ScriptEngine *engine, const Artifact *artifact); ScriptEngine * const m_engine; const CommonFileTags &m_tags; const ResolvedProductPtr &m_product; JSValue m_targetScriptValue; std::optional> m_includedMocCppFiles; }; } // namespace Internal } // namespace qbs #endif // QBS_QTMOCSCANNER_H qbs-src-3.2.0/src/lib/corelib/buildgraph/rulesapplicator.cpp0000644000175100017510000007627115154533055023531 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "rulesapplicator.h" #include "buildgraph.h" #include "cppmodulesscanner.h" #include "productbuilddata.h" #include "projectbuilddata.h" #include "qtmocscanner.h" #include "rulecommands.h" #include "rulenode.h" #include "rulesevaluationcontext.h" #include "transformer.h" #include "transformerchangetracking.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { RulesApplicator::RulesApplicator( ResolvedProductPtr product, const std::unordered_map &productsByName, const std::unordered_map &projectsByName, Logger logger) : m_product(std::move(product)) // m_productsByName and m_projectsByName are references, cannot move-construct , m_productsByName(productsByName) , m_projectsByName(projectsByName) , m_logger(std::move(logger)) {} RulesApplicator::~RulesApplicator() { delete m_mocScanner; delete m_cxxModulesScanner; } void RulesApplicator::applyRule(RuleNode *ruleNode, const ArtifactSet &inputArtifacts, const ArtifactSet &explicitlyDependsOn) { m_ruleNode = ruleNode; m_rule = ruleNode->rule(); QBS_CHECK(!inputArtifacts.empty() || !m_rule->declaresInputs() || !m_rule->requiresInputs); m_product->topLevelProject()->buildData->setDirty(); m_createdArtifacts.clear(); m_invalidatedArtifacts.clear(); m_removedArtifacts.clear(); m_explicitlyDependsOn = explicitlyDependsOn; RulesEvaluationContext::Scope s(evalContext().get()); m_completeInputSet = inputArtifacts; if (m_rule->name.startsWith(QLatin1String("QtCoreMocRule"))) { delete m_mocScanner; m_mocScanner = new QtMocScanner(m_product, engine(), scope()); } if (m_rule->name.startsWith(QLatin1String("cpp_compiler"))) { delete m_cxxModulesScanner; m_cxxModulesScanner = new CppModulesScanner(engine(), scope()); } ScopedJsValue prepareScriptContext(jsContext(), engine()->newObject()); JS_SetPrototype(jsContext(), prepareScriptContext, engine()->globalObject()); setupScriptEngineForFile(engine(), m_rule->prepareScript.fileContext(), scope(), ObserveMode::Enabled); setupScriptEngineForProduct(engine(), m_product.get(), m_rule->module.get(), prepareScriptContext, true); engine()->clearUsesIo(); if (m_rule->multiplex) { // apply the rule once for a set of inputs doApply(inputArtifacts, prepareScriptContext); } else { // apply the rule once for each input for (Artifact * const inputArtifact : inputArtifacts) { ArtifactSet lst; lst += inputArtifact; doApply(lst, prepareScriptContext); } } if (engine()->usesIo()) m_ruleUsesIo = true; engine()->releaseInputArtifactScriptValues(ruleNode); } void RulesApplicator::handleRemovedRuleOutputs(const ArtifactSet &inputArtifacts, const ArtifactSet &outputArtifactsToRemove, QStringList &removedArtifacts, const Logger &logger) { ArtifactSet artifactsToRemove; const TopLevelProject *project = nullptr; for (Artifact * const removedArtifact : outputArtifactsToRemove) { qCDebug(lcBuildGraph).noquote() << "dynamic rule removed output artifact" << removedArtifact->toString(); if (!project) project = removedArtifact->product->topLevelProject(); project->buildData->removeArtifactAndExclusiveDependents(removedArtifact, logger, true, &artifactsToRemove); } for (Artifact * const artifact : std::as_const(artifactsToRemove)) { QBS_CHECK(!inputArtifacts.contains(artifact)); removedArtifacts << artifact->filePath(); delete artifact; } } static void copyProperty(JSContext *ctx, const QString &name, const JSValue &src, JSValue dst) { setJsProperty(ctx, dst, name, getJsProperty(ctx, src, name)); } static QStringList toStringList(const ArtifactSet &artifacts) { QStringList lst; for (const Artifact * const artifact : artifacts) { const QString str = artifact->filePath() + QLatin1String(" [") + artifact->fileTags().toStringList().join(QLatin1String(", ")) + QLatin1Char(']'); lst << str; } return lst; } void RulesApplicator::doApply(const ArtifactSet &inputArtifacts, JSValue prepareScriptContext) { evalContext()->checkForCancelation(); for (const Artifact *inputArtifact : inputArtifacts) QBS_CHECK(!inputArtifact->fileTags().intersects(m_rule->excludedInputs)); qCDebug(lcBuildGraph) << "apply rule" << m_rule->toString() << toStringList(inputArtifacts).join(QLatin1String(",\n ")); std::vector> ruleArtifactArtifactMap; QList outputArtifacts; TransformerContext context; context.transformer = Transformer::create(); context.transformer->rule = m_rule; context.transformer->inputs = inputArtifacts; context.transformer->explicitlyDependsOn = m_explicitlyDependsOn; context.transformer->alwaysRun = m_rule->alwaysRun; engine()->clearRequestedProperties(); // create the output artifacts from the set of input artifacts context.transformer->setupInputs(engine(), prepareScriptContext); context.transformer->setupExplicitlyDependsOn(engine(), prepareScriptContext); copyProperty(jsContext(), StringConstants::inputsVar(), prepareScriptContext, scope()); copyProperty(jsContext(), StringConstants::inputVar(), prepareScriptContext, scope()); copyProperty(jsContext(), StringConstants::explicitlyDependsOnVar(), prepareScriptContext, scope()); copyProperty(jsContext(), StringConstants::productVar(), prepareScriptContext, scope()); copyProperty(jsContext(), StringConstants::projectVar(), prepareScriptContext, scope()); if (m_rule->isDynamic()) { const ScopedJsValueList argList = engine()->argumentList(Rule::argumentNamesForOutputArtifacts(), scope()); outputArtifacts = runOutputArtifactsScript(inputArtifacts, argList, context); } else { Set outputFilePaths; for (const auto &ruleArtifact : m_rule->artifacts) { const OutputArtifactInfo &outputInfo = createOutputArtifactFromRuleArtifact( ruleArtifact, inputArtifacts, &outputFilePaths, context); if (!outputInfo.artifact) continue; outputArtifacts.push_back(outputInfo.artifact); ruleArtifactArtifactMap.emplace_back(ruleArtifact.get(), outputInfo); } if (m_rule->artifacts.empty()) { outputArtifacts.push_back(createOutputArtifactFromRuleArtifact( nullptr, inputArtifacts, &outputFilePaths, context) .artifact); } } const auto newOutputs = rangeTo(outputArtifacts); const ArtifactSet oldOutputs = collectOldOutputArtifacts(inputArtifacts); handleRemovedRuleOutputs(m_completeInputSet, oldOutputs - newOutputs, m_removedArtifacts, m_logger); // The inputs become children of the rule node. Generated artifacts in the same product // already are children, because output artifacts become children of the producing // rule node's parent rule node. for (Artifact * const input : inputArtifacts) { if (input->artifactType == Artifact::SourceFile || input->product != m_ruleNode->product || input->producer()->rule()->collectedOutputFileTags().intersects( m_ruleNode->rule()->excludedInputs)) { connect(m_ruleNode, input); } else { QBS_CHECK(m_ruleNode->children.contains(input)); } } if (outputArtifacts.empty()) return; for (Artifact * const outputArtifact : std::as_const(outputArtifacts)) { for (Artifact * const dependency : std::as_const(context.transformer->explicitlyDependsOn)) connect(outputArtifact, dependency); } if (inputArtifacts != context.transformer->inputs) context.transformer->setupInputs(engine(), prepareScriptContext); // change the transformer outputs according to the bindings in Artifact if (!ruleArtifactArtifactMap.empty()) { const TemporaryGlobalObjectSetter gos(engine(), prepareScriptContext); for (auto it = ruleArtifactArtifactMap.crbegin(), end = ruleArtifactArtifactMap.crend(); it != end; ++it) { const RuleArtifact *ra = it->first; if (ra->bindings.empty()) continue; // expose attributes of this artifact const OutputArtifactInfo &outputInfo = it->second; Artifact *outputArtifact = outputInfo.artifact; outputArtifact->properties = outputArtifact->properties->clone(); setJsProperty(jsContext(), scope(), StringConstants::fileNameProperty(), engine()->toScriptValue(outputArtifact->filePath())); setJsProperty(jsContext(), scope(), StringConstants::fileTagsProperty(), makeJsStringList(engine()->context(), outputArtifact->fileTags().toStringList())); QVariantMap artifactModulesCfg = outputArtifact->properties->value(); for (const auto &binding : ra->bindings) { const ScopedJsValue scriptValue(jsContext(), engine()->evaluate( JsValueOwner::Caller, binding.code, binding.location.filePath(), binding.location.line())); if (engine()->checkForJsError(binding.location)) { ErrorInfo err = engine()->getAndClearJsError(); err.prepend(QStringLiteral("evaluating rule binding '%1'") .arg(binding.name.join(QLatin1Char('.')))); throw err; } const QVariant value = getJsVariant(jsContext(), scriptValue); setConfigProperty(artifactModulesCfg, binding.name, value); outputArtifact->pureProperties.emplace_back(binding.name, value); } outputArtifact->properties->setValue(artifactModulesCfg); if (!outputInfo.newlyCreated && (outputArtifact->fileTags() != outputInfo.oldFileTags || !qVariantMapsEqual( outputArtifact->properties->value(), outputInfo.oldProperties))) { invalidateArtifactAsRuleInputIfNecessary(outputArtifact); } } } context.transformer->setupOutputs(engine(), prepareScriptContext); const ScopedJsValueList argList = engine()->argumentList( Rule::argumentNamesForPrepare(), prepareScriptContext); context.transformer->createCommands(engine(), m_rule->prepareScript, argList); if (Q_UNLIKELY(context.transformer->commands.empty())) throw ErrorInfo(Tr::tr("There is a rule without commands: %1.") .arg(m_rule->toString()), m_rule->prepareScript.location()); if (!context.oldTransformer || context.oldTransformer->outputs != context.transformer->outputs || context.oldTransformer->inputs != context.transformer->inputs || context.oldTransformer->explicitlyDependsOn != context.transformer->explicitlyDependsOn || context.oldTransformer->commands != context.transformer->commands || commandsNeedRerun( context.transformer.get(), m_product.get(), m_productsByName, m_projectsByName)) { for (Artifact * const output : std::as_const(outputArtifacts)) { output->clearTimestamp(); m_invalidatedArtifacts += output; } } context.transformer->commandsNeedChangeTracking = false; } ArtifactSet RulesApplicator::collectOldOutputArtifacts(const ArtifactSet &inputArtifacts) const { ArtifactSet result; for (Artifact * const a : inputArtifacts) { for (Artifact *p : a->parentArtifacts()) { QBS_CHECK(p->transformer); if (p->transformer->rule == m_rule && p->transformer->inputs.contains(a)) result += p; } } return result; } ArtifactSet RulesApplicator::collectAdditionalInputs(const FileTags &tags, const Rule *rule, const ResolvedProduct *product, InputsSources inputsSources) { ArtifactSet artifacts; for (const FileTag &fileTag : tags) { for (Artifact *dependency : product->lookupArtifactsByFileTag(fileTag)) { // Skip excluded inputs. if (dependency->fileTags().intersects(rule->excludedInputs)) continue; // Two cases are considered: // 1) An artifact is considered a dependency when it's part of the current product. // 2) An artifact marked with filesAreTargets: true inside a Group inside of a // Module also ends up in the results returned by product->lookupArtifactsByFileTag, // so it should be considered conceptually as a "dependent product artifact". if ((inputsSources == CurrentProduct && !dependency->isTargetOfModule()) || (inputsSources == Dependencies && dependency->isTargetOfModule())) { artifacts << dependency; } } if (inputsSources == Dependencies) { for (const auto &depProduct : product->dependencies) { for (Artifact * const ta : filterByType(depProduct.product->buildData->allNodes())) { if (ta->fileTags().contains(fileTag) && !ta->fileTags().intersects(rule->excludedInputs)) { artifacts << ta; } } } } } return artifacts; } ArtifactSet RulesApplicator::collectExplicitlyDependsOn(const Rule *rule, const ResolvedProduct *product) { ArtifactSet first = collectAdditionalInputs( rule->explicitlyDependsOn, rule, product, CurrentProduct); ArtifactSet second = collectAdditionalInputs( rule->explicitlyDependsOnFromDependencies, rule, product, Dependencies); return first.unite(second); } RulesApplicator::OutputArtifactInfo RulesApplicator::createOutputArtifactFromRuleArtifact( const RuleArtifactConstPtr &ruleArtifact, const ArtifactSet &inputArtifacts, Set *outputFilePaths, TransformerContext &context) { QString outputPath; FileTags fileTags; bool alwaysUpdated; if (ruleArtifact) { const ScopedJsValue scriptValue( jsContext(), engine()->evaluate(JsValueOwner::Caller, ruleArtifact->filePath, ruleArtifact->filePathLocation.filePath(), ruleArtifact->filePathLocation.line())); engine()->throwOnJsError(ruleArtifact->filePathLocation); outputPath = getJsString(jsContext(), scriptValue); fileTags = ruleArtifact->fileTags; alwaysUpdated = ruleArtifact->alwaysUpdated; } else { outputPath = QStringLiteral("__dummyoutput__"); QByteArray hashInput = m_rule->toString().toLatin1(); for (const Artifact * const input : inputArtifacts) hashInput += input->filePath().toLatin1(); outputPath += QLatin1String(QCryptographicHash::hash(hashInput, QCryptographicHash::Sha1) .toHex().left(16)); fileTags = m_rule->outputFileTags; alwaysUpdated = false; } outputPath = FileInfo::resolvePath(m_product->buildDirectory(), outputPath); if (Q_UNLIKELY(!outputFilePaths->insert(outputPath).second)) { throw ErrorInfo(Tr::tr("Rule %1 already created '%2'.") .arg(m_rule->toString(), outputPath)); } return createOutputArtifact(outputPath, fileTags, alwaysUpdated, inputArtifacts, context); } RulesApplicator::OutputArtifactInfo RulesApplicator::createOutputArtifact( const QString &filePath, const FileTags &fileTags, bool alwaysUpdated, const ArtifactSet &inputArtifacts, TransformerContext &context) { const QString outputPath = resolveOutPath(filePath); if (m_rule->isDynamic()) { const Set undeclaredTags = fileTags - m_rule->collectedOutputFileTags(); if (!undeclaredTags.empty()) { throw ErrorInfo(Tr::tr("Artifact '%1' has undeclared file tags [\"%2\"].") .arg(outputPath, undeclaredTags.toStringList() .join(QLatin1String("\",\""))), m_rule->prepareScript.location()); } } OutputArtifactInfo outputInfo; Artifact *& outputArtifact = outputInfo.artifact; outputArtifact = lookupArtifact(m_product, outputPath); outputInfo.newlyCreated = !outputArtifact; if (outputArtifact) { const Transformer * const transformer = outputArtifact->transformer.get(); if (transformer && transformer->rule != m_rule) { QString e = Tr::tr("Conflicting rules for producing %1 %2 \n") .arg(outputArtifact->filePath(), QLatin1Char('[') + outputArtifact->fileTags().toStringList().join(QLatin1String(", ")) + QLatin1Char(']')); QString str = QLatin1Char('[') + m_rule->inputs.toStringList().join(QLatin1String(", ")) + QLatin1String("] -> [") + outputArtifact->fileTags().toStringList() .join(QLatin1String(", ")) + QLatin1Char(']'); e += QStringLiteral(" while trying to apply: %1:%2:%3 %4\n") .arg(m_rule->prepareScript.location().filePath()) .arg(m_rule->prepareScript.location().line()) .arg(m_rule->prepareScript.location().column()) .arg(str); e += QStringLiteral(" was already defined in: %1:%2:%3 %4\n") .arg(transformer->rule->prepareScript.location().filePath()) .arg(transformer->rule->prepareScript.location().line()) .arg(transformer->rule->prepareScript.location().column()) .arg(str); throw ErrorInfo(e); } if (transformer && !m_rule->multiplex && transformer->inputs != inputArtifacts) { QBS_CHECK(inputArtifacts.size() == 1); QBS_CHECK(transformer->inputs.size() == 1); ErrorInfo error(Tr::tr("Conflicting instances of rule '%1':").arg(m_rule->toString()), m_rule->prepareScript.location()); error.append(Tr::tr("Output artifact '%1' is to be produced from input " "artifacts '%2' and '%3', but the rule is not a multiplex rule.") .arg(outputArtifact->filePath(), (*transformer->inputs.cbegin())->filePath(), (*inputArtifacts.cbegin())->filePath())); throw error; } context.transformer->rescueChangeTrackingData(outputArtifact->transformer); context.oldTransformer = outputArtifact->transformer; outputInfo.oldFileTags = outputArtifact->fileTags(); outputInfo.oldProperties = outputArtifact->properties->value(); } else { std::unique_ptr newArtifact(new Artifact); newArtifact->artifactType = Artifact::Generated; newArtifact->setFilePath(outputPath); insertArtifact(m_product, newArtifact.get()); m_createdArtifacts += newArtifact.get(); outputArtifact = newArtifact.release(); qCDebug(lcExec).noquote() << "rule created" << outputArtifact->toString(); connect(outputArtifact, m_ruleNode); } outputArtifact->alwaysUpdated = alwaysUpdated; outputArtifact->pureFileTags = fileTags; provideFullFileTagsAndProperties(outputArtifact); if (outputInfo.newlyCreated || outputInfo.oldFileTags != outputArtifact->fileTags()) { for (RuleNode * const parentRule : filterByType(m_ruleNode->parents)) connect(parentRule, outputArtifact); } for (Artifact * const inputArtifact : inputArtifacts) { QBS_CHECK(outputArtifact != inputArtifact); connect(outputArtifact, inputArtifact); } outputArtifact->transformer = context.transformer; context.transformer->outputs.insert(outputArtifact); QBS_CHECK(m_rule->multiplex || context.transformer->inputs.size() == 1); return outputInfo; } class RuleOutputArtifactsException : public ErrorInfo { public: using ErrorInfo::ErrorInfo; }; QList RulesApplicator::runOutputArtifactsScript( const ArtifactSet &inputArtifacts, const JSValueList &args, TransformerContext &context) { QList lst; const ScopedJsValue fun(jsContext(), engine()->evaluate(JsValueOwner::Caller, m_rule->outputArtifactsScript.sourceCode(), m_rule->outputArtifactsScript.location().filePath(), m_rule->outputArtifactsScript.location().line())); if (!JS_IsFunction(jsContext(), fun)) throw ErrorInfo(QStringLiteral("Function expected."), m_rule->outputArtifactsScript.location()); JSValueList argv(args.begin(), args.end()); const ScopedJsValue res( jsContext(), JS_Call(jsContext(), fun, engine()->globalObject(), int(args.size()), argv.data())); engine()->throwOnJsError(m_rule->outputArtifactsScript.location()); if (!JS_IsArray(res)) throw ErrorInfo(Tr::tr("Rule.outputArtifacts must return an array of objects."), m_rule->outputArtifactsScript.location()); const quint32 c = getJsIntProperty(jsContext(), res, StringConstants::lengthProperty()); for (quint32 i = 0; i < c; ++i) { try { ScopedJsValue val(engine()->context(), JS_GetPropertyUint32(jsContext(), res, i)); lst.push_back(createOutputArtifactFromScriptValue(val, inputArtifacts, context)); } catch (const RuleOutputArtifactsException &roae) { ErrorInfo ei = roae; ei.prepend(Tr::tr("Error in Rule.outputArtifacts[%1]").arg(i), m_rule->outputArtifactsScript.location()); throw ei; } } return lst; } class ArtifactBindingsExtractor { struct Entry { Entry(QString module, QString name, QVariant value) : module(std::move(module)), name(std::move(name)), value(std::move(value)) {} QString module; QString name; QVariant value; }; ScriptEngine *m_engine = nullptr; JSContext *m_ctx = nullptr; std::vector m_propertyValues; static Set getArtifactItemPropertyNames() { Set s; const auto properties = BuiltinDeclarations::instance().declarationsForType( ItemType::Artifact).properties(); for (const PropertyDeclaration &pd : properties) { s.insert(pd.name()); } s.insert(StringConstants::explicitlyDependsOnProperty()); return s; } void extractPropertyValues(const JSValue &obj, const QString &moduleName = QString()) { handleJsProperties(m_ctx, obj, [&](const JSAtom &prop, const JSPropertyDescriptor &desc) { const QString name = getJsString(m_ctx, prop); if (moduleName.isEmpty()) { // Ignore property names that are part of the Artifact item. static const Set artifactItemPropertyNames = getArtifactItemPropertyNames(); if (artifactItemPropertyNames.contains(name)) return; } const JSValue value = desc.value; if (JS_IsObject(value) && !JS_IsArray(value) && !JS_IsError(value) && !JS_IsRegExp(value)) { QString newModuleName; if (!moduleName.isEmpty()) newModuleName.append(moduleName + QLatin1Char('.')); newModuleName.append(name); extractPropertyValues(value, newModuleName); } else { m_propertyValues.emplace_back(moduleName, name, getJsVariant(m_ctx, value)); } }); } public: void apply(ScriptEngine *engine, Artifact *outputArtifact, const JSValue &obj) { m_engine = engine; m_ctx = m_engine->context(); extractPropertyValues(obj); if (m_propertyValues.empty()) return; outputArtifact->properties = outputArtifact->properties->clone(); QVariantMap artifactCfg = outputArtifact->properties->value(); for (const auto &e : m_propertyValues) { const QStringList key{e.module, e.name}; setConfigProperty(artifactCfg, key, e.value); outputArtifact->pureProperties.emplace_back(key, e.value); } outputArtifact->properties->setValue(artifactCfg); } }; Artifact *RulesApplicator::createOutputArtifactFromScriptValue( const JSValue &obj, const ArtifactSet &inputArtifacts, TransformerContext &context) { if (!JS_IsObject(obj)) { throw ErrorInfo(Tr::tr("Elements of the Rule.outputArtifacts array must be " "of Object type."), m_rule->outputArtifactsScript.location()); } QString unresolvedFilePath; const ScopedJsValue jsFilePath(jsContext(), getJsProperty(jsContext(), obj, StringConstants::filePathProperty())); if (JS_IsString(jsFilePath)) unresolvedFilePath = getJsString(jsContext(), jsFilePath); if (unresolvedFilePath.isEmpty()) { throw RuleOutputArtifactsException( Tr::tr("Property filePath must be a non-empty string.")); } const QString filePath = FileInfo::resolvePath(m_product->buildDirectory(), unresolvedFilePath); const FileTags fileTags = FileTags::fromStringList( getJsStringListProperty(jsContext(), obj, StringConstants::fileTagsProperty())); const QVariant alwaysUpdatedVar = getJsVariantProperty(jsContext(), obj, StringConstants::alwaysUpdatedProperty()); const bool alwaysUpdated = alwaysUpdatedVar.isValid() ? alwaysUpdatedVar.toBool() : true; OutputArtifactInfo outputInfo = createOutputArtifact( filePath, fileTags, alwaysUpdated, inputArtifacts, context); if (outputInfo.artifact->fileTags().empty()) { // Check the file tags after file taggers were run. throw RuleOutputArtifactsException( Tr::tr("Property fileTags for artifact '%1' must be a non-empty string list. " "Alternatively, a FileTagger can be provided.") .arg(unresolvedFilePath)); } const FileTags explicitlyDependsOn = FileTags::fromStringList(getJsStringListProperty( jsContext(), obj, StringConstants::explicitlyDependsOnProperty())); for (const FileTag &tag : explicitlyDependsOn) { for (Artifact * const dependency : m_product->lookupArtifactsByFileTag(tag)) connect(outputInfo.artifact, dependency); } ArtifactBindingsExtractor().apply(engine(), outputInfo.artifact, obj); if (!outputInfo.newlyCreated && (outputInfo.artifact->fileTags() != outputInfo.oldFileTags || !qVariantMapsEqual( outputInfo.artifact->properties->value(), outputInfo.oldProperties))) { invalidateArtifactAsRuleInputIfNecessary(outputInfo.artifact); } return outputInfo.artifact; } QString RulesApplicator::resolveOutPath(const QString &path) const { const QString buildDir = m_product->topLevelProject()->buildDirectory; QString result = QDir::cleanPath(FileInfo::resolvePath(buildDir, path)); if (!result.startsWith(buildDir + QLatin1Char('/'))) { throw ErrorInfo( Tr::tr("Refusing to create artifact '%1' outside of build directory '%2'.") .arg(QDir::toNativeSeparators(result), QDir::toNativeSeparators(buildDir)), m_rule->prepareScript.location()); } return result; } const RulesEvaluationContextPtr &RulesApplicator::evalContext() const { return m_product->topLevelProject()->buildData->evaluationContext; } ScriptEngine *RulesApplicator::engine() const { return evalContext()->engine(); } JSContext *RulesApplicator::jsContext() const { return engine()->context(); } JSValue RulesApplicator::scope() const { return evalContext()->scope(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/artifactsscriptvalue.h0000644000175100017510000000445015154533055024215 0ustar runnerrunner/**************************************************************************** ** ** 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_ARTIFACTSSCRIPTVALUE_H #define QBS_ARTIFACTSSCRIPTVALUE_H #include #include namespace qbs { namespace Internal { class ScriptEngine; JSValue artifactsScriptValueForProduct(JSContext *ctx, JSValueConst this_val, int, JSValueConst *); JSValue artifactsScriptValueForModule(JSContext *ctx, JSValueConst this_val, int, JSValueConst *); } // namespace Internal } // namespace qbs #endif // include guard qbs-src-3.2.0/src/lib/corelib/buildgraph/productinstaller.cpp0000644000175100017510000002663715154533055023717 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "productinstaller.h" #include "artifact.h" #include "productbuilddata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { ProductInstaller::ProductInstaller( TopLevelProjectPtr project, QVector products, InstallOptions options, ProgressObserver *observer, Logger logger, Reporter &&reporter) : m_project(std::move(project)) , m_products(std::move(products)) , m_options(std::move(options)) , m_observer(observer) , m_logger(std::move(logger)) , m_reporter(std::move(reporter)) { if (!m_options.installRoot().isEmpty()) { QFileInfo installRootFileInfo(m_options.installRoot()); QBS_ASSERT(installRootFileInfo.isAbsolute(), /* just complain */); if (m_options.removeExistingInstallation()) { const QString cfp = installRootFileInfo.canonicalFilePath(); if (cfp == QFileInfo(QDir::rootPath()).canonicalFilePath()) throw ErrorInfo(Tr::tr("Refusing to remove root directory.")); if (cfp == QFileInfo(QDir::homePath()).canonicalFilePath()) throw ErrorInfo(Tr::tr("Refusing to remove home directory.")); } return; } if (m_options.installIntoSysroot()) { if (m_options.removeExistingInstallation()) throw ErrorInfo(Tr::tr("Refusing to remove sysroot.")); } initInstallRoot(m_project.get(), m_options); } void ProductInstaller::install() { m_targetFilePathsMap.clear(); if (m_options.removeExistingInstallation()) removeInstallRoot(); QList artifactsToInstall; for (const auto &product : std::as_const(m_products)) { QBS_CHECK(product->buildData); for (const Artifact *artifact : filterByType(product->buildData->allNodes())) { if (artifact->properties->qbsPropertyValue(StringConstants::installProperty()).toBool()) artifactsToInstall.push_back(artifact); } } m_observer->initialize(Tr::tr("Installing"), artifactsToInstall.size()); for (const Artifact * const a : std::as_const(artifactsToInstall)) { copyFile(a); m_observer->incrementProgressValue(); } } QString ProductInstaller::targetFilePath(const TopLevelProject *project, const QString &productSourceDir, const QString &sourceFilePath, const PropertyMapConstPtr &properties, InstallOptions &options) { if (!properties->qbsPropertyValue(StringConstants::installProperty()).toBool()) return {}; const QString relativeInstallDir = properties->qbsPropertyValue(StringConstants::installDirProperty()).toString(); const QString installPrefix = properties->qbsPropertyValue(StringConstants::installPrefixProperty()).toString(); const QString installSourceBase = properties->qbsPropertyValue(StringConstants::installSourceBaseProperty()).toString(); initInstallRoot(project, options); QString targetDir = options.installRoot(); if (targetDir.isEmpty()) targetDir = properties->qbsPropertyValue(StringConstants::installRootProperty()).toString(); targetDir.append(QLatin1Char('/')).append(installPrefix) .append(QLatin1Char('/')).append(relativeInstallDir); targetDir = QDir::cleanPath(targetDir); QString targetFilePath; if (installSourceBase.isEmpty()) { if (!targetDir.startsWith(options.installRoot())) { throw ErrorInfo(Tr::tr("Cannot install '%1', because target directory '%2' " "is outside of install root '%3'") .arg(sourceFilePath, targetDir, options.installRoot())); } // This has the same effect as if installSourceBase would equal the directory of the file. targetFilePath = FileInfo::fileName(sourceFilePath); } else { const QString localAbsBasePath = FileInfo::resolvePath(QDir::cleanPath(productSourceDir), QDir::cleanPath(installSourceBase)); targetFilePath = sourceFilePath; if (!targetFilePath.startsWith(localAbsBasePath)) { throw ErrorInfo(Tr::tr("Cannot install '%1', because it doesn't start with the" " value of qbs.installSourceBase '%2'.").arg(sourceFilePath, localAbsBasePath)); } // Since there is a difference between X: and X:\\ on Windows, absolute paths can sometimes // end with a slash, so only remove an extra character if there is no ending slash targetFilePath.remove(0, localAbsBasePath.length() + (localAbsBasePath.endsWith(QLatin1Char('/')) ? 0 : 1)); } targetFilePath.prepend(targetDir + QLatin1Char('/')); return QDir::cleanPath(targetFilePath); } void ProductInstaller::initInstallRoot(const TopLevelProject *project, InstallOptions &options) { if (!options.installRoot().isEmpty()) return; options.setInstallRoot(effectiveInstallRoot(options, project)); } void ProductInstaller::removeInstallRoot() { const QString nativeInstallRoot = QDir::toNativeSeparators(m_options.installRoot()); if (m_options.dryRun()) { m_logger.qbsInfo() << Tr::tr("Would remove install root '%1'.").arg(nativeInstallRoot); return; } m_logger.qbsDebug() << QStringLiteral("Removing install root '%1'.") .arg(nativeInstallRoot); QString errorMessage; if (!removeDirectoryWithContents(m_options.installRoot(), &errorMessage)) { const QString fullErrorMessage = Tr::tr("Cannot remove install root '%1': %2") .arg(QDir::toNativeSeparators(m_options.installRoot()), errorMessage); handleError(fullErrorMessage); } } void ProductInstaller::copyFile(const Artifact *artifact) { if (m_observer->canceled()) { throw ErrorInfo(Tr::tr("Installation canceled for configuration '%1'.") .arg(m_products.front()->project->topLevelProject()->id())); } const QString targetFilePath = this->targetFilePath(m_project.get(), artifact->product->sourceDirectory, artifact->filePath(), artifact->properties, m_options); const QString targetDir = FileInfo::path(targetFilePath); const QString nativeFilePath = QDir::toNativeSeparators(artifact->filePath()); const QString nativeTargetDir = QDir::toNativeSeparators(targetDir); if (m_options.dryRun()) { m_logger.qbsDebug() << Tr::tr("Would copy file '%1' into target directory '%2'.") .arg(nativeFilePath, nativeTargetDir); return; } if (!QDir::root().mkpath(targetDir)) { handleError(Tr::tr("Directory '%1' could not be created.").arg(nativeTargetDir)); return; } QFileInfo fi(artifact->filePath()); if (fi.isDir() && !(HostOsInfo::isAnyUnixHost() && fi.isSymLink())) { m_logger.qbsWarning() << Tr::tr("Not recursively copying directory '%1' into target " "directory '%2'. Install the individual file artifacts " "instead.") .arg(nativeFilePath, nativeTargetDir); } if (m_targetFilePathsMap.contains(targetFilePath)) { // We only want this error message when installing artifacts pointing to different file // paths, to the same location. We do NOT want it when installing different artifacts // pointing to the same file, to the same location. This reduces unnecessary noise: for // example, when installing headers from a multiplexed product, the user does not need to // do extra work to ensure the files are installed by only one of the instances. if (artifact->filePath() != m_targetFilePathsMap[targetFilePath]) { handleError(Tr::tr("Cannot install files '%1' and '%2' to the same location '%3'. " "If you are attempting to install a directory hierarchy, consider " "using the qbs.installSourceBase property.") .arg(artifact->filePath(), m_targetFilePathsMap[targetFilePath], targetFilePath)); } } m_targetFilePathsMap.insert(targetFilePath, artifact->filePath()); QString errorMessage; bool skipped = false; if (!copyFileRecursion( artifact->filePath(), targetFilePath, true, false, &errorMessage, &skipped)) { handleError(Tr::tr("Installation error: %1").arg(errorMessage)); } else if (skipped) { m_logger.qbsDebug() << "skipping installation of" << nativeFilePath << "is up to date in" << nativeTargetDir; } else { m_reporter( QString::fromLatin1("[%1] %2").arg( artifact->product->fullDisplayName(), Tr::tr("installing %1 into %2") .arg(FileInfo::fileName(targetFilePath), nativeTargetDir))); } } void ProductInstaller::handleError(const QString &message) { if (!m_options.keepGoing()) throw ErrorInfo(message); m_logger.qbsWarning() << message; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/filedependency.cpp0000644000175100017510000000555615154533055023274 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "filedependency.h" #include namespace qbs { namespace Internal { FileResourceBase::FileResourceBase() = default; FileResourceBase::~FileResourceBase() = default; void FileResourceBase::setTimestamp(const FileTime &t) { m_timestamp = t; } const FileTime &FileResourceBase::timestamp() const { return m_timestamp; } void FileResourceBase::setFilePath(const QString &filePath) { m_filePath = filePath; FileInfo::splitIntoDirectoryAndFileName(m_filePath, &m_dirPath, &m_fileName); } const QString &FileResourceBase::filePath() const { return m_filePath; } void FileResourceBase::load(PersistentPool &pool) { serializationOp(pool); FileInfo::splitIntoDirectoryAndFileName(m_filePath, &m_dirPath, &m_fileName); } void FileResourceBase::store(PersistentPool &pool) { serializationOp(pool); } FileDependency::FileDependency() = default; FileDependency::~FileDependency() = default; } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/rescuableartifactdata.h0000644000175100017510000001301615154533055024266 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_RESCUABLEARTIFACTDATA_H #define QBS_RESCUABLEARTIFACTDATA_H #include "forward_decls.h" #include "requestedartifacts.h" #include "requesteddependencies.h" #include "rulecommands.h" #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class QBS_AUTOTEST_EXPORT RescuableArtifactData { public: template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(timeStamp, children, fileDependencies, knownOutOfDate, propertiesRequestedInPrepareScript, propertiesRequestedInCommands, propertiesRequestedFromArtifactInPrepareScript, propertiesRequestedFromArtifactInCommands, importedFilesUsedInPrepareScript, importedFilesUsedInCommands, depsRequestedInPrepareScript, depsRequestedInCommands, commands, artifactsMapRequestedInPrepareScript, artifactsMapRequestedInCommands, exportedModulesAccessedInPrepareScript, exportedModulesAccessedInCommands, lastPrepareScriptExecutionTime, lastCommandExecutionTime, fileTags, properties); } bool isValid() const { return !!properties; } struct ChildData { ChildData(QString n = QString(), QString m = QString(), QString c = QString(), bool byScanner = false) : productName(std::move(n)) , productMultiplexId(std::move(m)) , childFilePath(std::move(c)) , addedByScanner(byScanner) {} template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(productName, productMultiplexId, childFilePath, addedByScanner); } QString productName; QString productMultiplexId; QString childFilePath; bool addedByScanner; }; FileTime timeStamp; std::vector children; std::vector fileDependencies; // Per-Transformer data CommandList commands; PropertySet propertiesRequestedInPrepareScript; PropertySet propertiesRequestedInCommands; PropertyHash propertiesRequestedFromArtifactInPrepareScript; PropertyHash propertiesRequestedFromArtifactInCommands; std::vector importedFilesUsedInPrepareScript; std::vector importedFilesUsedInCommands; RequestedDependencies depsRequestedInPrepareScript; RequestedDependencies depsRequestedInCommands; RequestedArtifacts artifactsMapRequestedInPrepareScript; RequestedArtifacts artifactsMapRequestedInCommands; FileTime lastPrepareScriptExecutionTime; FileTime lastCommandExecutionTime; std::unordered_map exportedModulesAccessedInPrepareScript; std::unordered_map exportedModulesAccessedInCommands; bool knownOutOfDate = false; // Only needed for API purposes FileTags fileTags; PropertyMapPtr properties; }; using AllRescuableArtifactData = QHash; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/buildgraph/rawscanneddependency.cpp0000644000175100017510000000560515154533055024475 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "rawscanneddependency.h" #include namespace qbs { namespace Internal { RawScannedDependency::RawScannedDependency() : m_isClean(true) {} RawScannedDependency::RawScannedDependency(const QString &filePath) { FileInfo::splitIntoDirectoryAndFileName(filePath, &m_dirPath, &m_fileName); setClean(); } QString RawScannedDependency::filePath() const { return m_dirPath.isEmpty() ? m_fileName : m_dirPath + QLatin1Char('/') + m_fileName; } void RawScannedDependency::setClean() { m_isClean = !m_dirPath.contains(QLatin1Char('.')) && !m_dirPath.contains(QStringLiteral("//")); } void RawScannedDependency::load(PersistentPool &pool) { serializationOp(pool); setClean(); } void RawScannedDependency::store(PersistentPool &pool) { serializationOp(pool); } bool operator==(const RawScannedDependency &d1, const RawScannedDependency &d2) { return d1.dirPath() == d2.dirPath() && d1.fileName() == d2.fileName(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/rulenode.h0000644000175100017510000001035615154533055021572 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_RULENODE_H #define QBS_RULENODE_H #include "artifact.h" #include "buildgraphnode.h" #include "forward_decls.h" #include #include #include #include namespace qbs { namespace Internal { class Logger; class RuleNode : public BuildGraphNode { public: RuleNode(); ~RuleNode() override; void setRule(const RuleConstPtr &rule) { m_rule = rule; } const RuleConstPtr &rule() const { return m_rule; } Type type() const override { return RuleNodeType; } void accept(BuildGraphVisitor *visitor) override; QString toString() const override; struct ApplicationResult { NodeSet createdArtifacts; NodeSet invalidatedArtifacts; QStringList removedArtifacts; }; ApplicationResult apply( const Logger &logger, const std::unordered_map &productsByName, const std::unordered_map &projectsByName); void removeOldInputArtifact(Artifact *artifact); void load(PersistentPool &pool) override; void store(PersistentPool &pool) override; int transformerCount() const; private: template void serializationOp(PersistentPool &pool) { pool.serializationOp( m_rule, m_oldInputArtifacts, m_oldExplicitlyDependsOn, m_lastApplicationTime, m_needsToConsiderChangedInputs); } ArtifactSet currentInputArtifacts() const; ArtifactSet changedInputArtifacts( const ArtifactSet &allCompatibleInputs, const ArtifactSet &explicitlyDependsOn) const; RuleConstPtr m_rule; // These two can contain null pointers, which represent a "dummy artifact" encoding // the information that an artifact that used to be in here has ceased to exist. // This is okay, because no code outside this class has access to these sets, so // we cannot break any assumptions about non-nullness. ArtifactSet m_oldInputArtifacts; ArtifactSet m_oldExplicitlyDependsOn; FileTime m_lastApplicationTime; bool m_needsToConsiderChangedInputs = false; }; template<> inline bool hasDynamicType(const BuildGraphNode *n) { return n->type() == BuildGraphNode::RuleNodeType; } } // namespace Internal } // namespace qbs #endif // QBS_RULENODE_H qbs-src-3.2.0/src/lib/corelib/buildgraph/transformer.h0000644000175100017510000001440415154533055022315 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_TRANSFORMER_H #define QBS_TRANSFORMER_H #include "artifact.h" #include "forward_decls.h" #include "requestedartifacts.h" #include "requesteddependencies.h" #include "rulecommands.h" #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class AbstractCommand; class Artifact; class RescuableArtifactData; class Rule; class Transformer { public: static TransformerPtr create() { return TransformerPtr(new Transformer); } ~Transformer(); ArtifactSet inputs; // Subset of "children of all outputs". ArtifactSet outputs; ArtifactSet explicitlyDependsOn; RuleConstPtr rule; CommandList commands; PropertySet propertiesRequestedInPrepareScript; PropertySet propertiesRequestedInCommands; QHash propertiesRequestedFromArtifactInPrepareScript; QHash propertiesRequestedFromArtifactInCommands; std::vector importedFilesUsedInPrepareScript; std::vector importedFilesUsedInCommands; RequestedDependencies depsRequestedInPrepareScript; RequestedDependencies depsRequestedInCommands; RequestedArtifacts artifactsMapRequestedInPrepareScript; RequestedArtifacts artifactsMapRequestedInCommands; FileTime lastPrepareScriptExecutionTime; FileTime lastCommandExecutionTime; std::unordered_map exportedModulesAccessedInPrepareScript; std::unordered_map exportedModulesAccessedInCommands; bool alwaysRun; bool prepareScriptNeedsChangeTracking = false; bool commandsNeedChangeTracking = false; bool markedForRerun = false; static JSValue translateFileConfig(ScriptEngine *engine, Artifact *artifact, const QString &defaultModuleName); ResolvedProductPtr product() const; void setupInputs(ScriptEngine *engine, const JSValue &targetScriptValue); void setupOutputs(ScriptEngine *engine, JSValue targetScriptValue); void setupExplicitlyDependsOn(ScriptEngine *engine, JSValue targetScriptValue); void createCommands(ScriptEngine *engine, const PrivateScriptFunction &script, const JSValueList &args); void rescueChangeTrackingData(const TransformerConstPtr &other); void rescueFromArtifactData(RescuableArtifactData &&rad); RescuableArtifactData rescueToArtifactData() const; Set jobPools() const; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(rule, inputs, outputs, explicitlyDependsOn, propertiesRequestedInPrepareScript, propertiesRequestedInCommands, propertiesRequestedFromArtifactInPrepareScript, propertiesRequestedFromArtifactInCommands, importedFilesUsedInPrepareScript, importedFilesUsedInCommands, depsRequestedInPrepareScript, depsRequestedInCommands, commands, artifactsMapRequestedInPrepareScript, artifactsMapRequestedInCommands, lastPrepareScriptExecutionTime, lastCommandExecutionTime, exportedModulesAccessedInPrepareScript, exportedModulesAccessedInCommands, alwaysRun, prepareScriptNeedsChangeTracking, commandsNeedChangeTracking, markedForRerun); } private: Transformer(); AbstractCommandPtr createCommandFromScriptValue(ScriptEngine *engine, const JSValue &scriptValue, const CodeLocation &codeLocation); static void setupInputs(ScriptEngine *engine, JSValue targetScriptValue, const ArtifactSet &inputs, const QString &defaultModuleName); static JSValue translateInOutputs(ScriptEngine *engine, const ArtifactSet &artifacts, const QString &defaultModuleName); }; } // namespace Internal } // namespace qbs #endif // QBS_TRANSFORMER_H qbs-src-3.2.0/src/lib/corelib/buildgraph/rawscanresults.h0000644000175100017510000000762615154533055023043 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_RAWSCANRESULTS_H #define QBS_RAWSCANRESULTS_H #include "rawscanneddependency.h" #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class DependencyScanner; class FileResourceBase; class RawScanResult { public: std::vector deps; FileTags additionalFileTags; // TODO: does this belong here? QString providesModule; bool isInterfaceModule{false}; QStringList requiresModules; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp( deps, additionalFileTags, providesModule, isInterfaceModule, requiresModules); } }; class RawScanResults { public: struct ScanData { QString scannerId; PropertyMapConstPtr moduleProperties; FileTime lastScanTime; RawScanResult rawScanResult; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(scannerId, moduleProperties, lastScanTime, rawScanResult); } }; using FilterFunction = std::function; ScanData &findScanData( const FileResourceBase *file, const QString &scannerId, const PropertyMapConstPtr &moduleProperties, const FilterFunction &filter); ScanData &findScanData( const FileResourceBase *file, const DependencyScanner *scanner, const PropertyMapConstPtr &moduleProperties); template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(m_rawScanData); } private: QHash> m_rawScanData; }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/buildgraph/artifactvisitor.h0000644000175100017510000000504415154533055023170 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ARTIFACTVISITOR_H #define QBS_ARTIFACTVISITOR_H #include "forward_decls.h" #include "buildgraphvisitor.h" #include #include namespace qbs { namespace Internal { class ArtifactVisitor : public BuildGraphVisitor { public: ArtifactVisitor(int artifactType); void visitProduct(const ResolvedProductConstPtr &product); void visitProject(const ResolvedProjectConstPtr &project); bool visit(RuleNode *ruleNode) override; bool visit(Artifact *artifact) override; private: virtual void doVisit(Artifact *artifact) = 0; const int m_artifactType; }; } // namespace Internal } // namespace qbs #endif // QBS_ARTIFACTVISITOR_H qbs-src-3.2.0/src/lib/corelib/buildgraph/artifactsscriptvalue.cpp0000644000175100017510000002164515154533055024555 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #include "artifactsscriptvalue.h" #include "artifact.h" #include "productbuilddata.h" #include "transformer.h" #include #include #include #include namespace qbs { namespace Internal { template static bool isRelevantArtifact(const ProductOrModule *productOrModule, const Artifact *artifact) { if constexpr (std::is_same_v) { Q_UNUSED(productOrModule) return !artifact->isTargetOfModule(); } else { return artifact->targetOfModule == productOrModule->name; } } template static ArtifactSetByFileTag artifactsMap(const ProductOrModule *productOrModule) { if constexpr (std::is_same_v) return productOrModule->buildData->artifactsByFileTag(); else return artifactsMap(productOrModule->product); } template static int scriptClassIndex() { if constexpr (std::is_same_v) return 0; return 1; } template std::unique_lock getArtifactsMapLock(ProductOrModule *productOrModule) { if constexpr (std::is_same_v) return productOrModule->buildData->getArtifactsMapLock(); else return getArtifactsMapLock(productOrModule->product); } template static bool checkAndSetArtifactsMapUpToDateFlag(const ProductOrModule *productOrModule) { if constexpr (std::is_same_v) return productOrModule->buildData->checkAndSetJsArtifactsMapUpToDateFlag(); else return checkAndSetArtifactsMapUpToDateFlag(productOrModule->product); } // Must be called with artifacts map lock held! template void registerArtifactsMapAccess(ScriptEngine *engine, ProductOrModule *productOrModule) { if constexpr (std::is_same_v) { if (!checkAndSetArtifactsMapUpToDateFlag(productOrModule)) engine->setArtifactsMapRequested(productOrModule, true); else engine->setArtifactsMapRequested(productOrModule, false); } else { registerArtifactsMapAccess(engine, productOrModule->product); } } template static int getArtifactsPropertyNames(JSContext *ctx, JSPropertyEnum **ptab, uint32_t *plen, JSValueConst obj) { ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const auto productOrModule = attachedPointer( obj, engine->artifactsScriptClass(scriptClassIndex())); const std::unique_lock lock = getArtifactsMapLock(productOrModule); registerArtifactsMapAccess(engine, productOrModule); if constexpr (std::is_same_v) engine->setArtifactsEnumerated(productOrModule); const auto &map = artifactsMap(productOrModule); const auto filter = [productOrModule](const Artifact *a) { return isRelevantArtifact(productOrModule, a); }; QStringList tags; for (auto it = map.cbegin(); it != map.cend(); ++it) { if (any_of(it.value(), filter)) { tags << it.key().toString(); } } *plen = tags.size(); if (!tags.isEmpty()) { *ptab = reinterpret_cast(js_malloc(ctx, *plen * sizeof **ptab)); JSPropertyEnum *entry = *ptab; for (const QString &tag : std::as_const(tags)) { entry->atom = JS_NewAtom(ctx, tag.toUtf8().constData()); entry->is_enumerable = 1; ++entry; } } else { *ptab = nullptr; } return 0; } template static int getArtifactsProperty(JSContext *ctx, JSPropertyDescriptor *desc, JSValueConst obj, JSAtom prop) { if (!desc) return 1; desc->flags = JS_PROP_ENUMERABLE; desc->value = desc->getter = desc->setter = JS_UNDEFINED; ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const auto productOrModule = attachedPointer( obj, engine->artifactsScriptClass(scriptClassIndex())); const std::unique_lock lock = getArtifactsMapLock(productOrModule); registerArtifactsMapAccess(engine, productOrModule); const QString tagString = getJsString(ctx, prop); const FileTag fileTag(tagString.toUtf8()); const auto &map = artifactsMap(productOrModule); const auto it = map.constFind(fileTag); if (it == map.constEnd()) { if constexpr (std::is_same_v) engine->setNonExistingArtifactSetRequested(productOrModule, tagString); return 1; } if constexpr (std::is_same_v) engine->setArtifactSetRequestedForTag(productOrModule, fileTag); ArtifactSet artifacts = it.value(); removeIf(artifacts, [productOrModule](const Artifact *a) { return !isRelevantArtifact(productOrModule, a); }); if (!artifacts.empty()) { desc->value = JS_NewArray(ctx); // TODO: Also cache this list? int k = 0; for (Artifact * const artifact : artifacts) { JS_SetPropertyUint32(ctx, desc->value, k++, Transformer::translateFileConfig(engine, artifact, QString())); } } return 1; } template static JSValue js_artifacts(JSContext *ctx, JSValue jsProductOrModule) { ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const auto productOrModule = attachedPointer(jsProductOrModule, engine->dataWithPtrClass()); JSValue artifactsObj = engine->artifactsMapScriptValue(productOrModule); if (!JS_IsUndefined(artifactsObj)) return artifactsObj; const int classIndex = scriptClassIndex(); JSClassID scriptClass = engine->artifactsScriptClass(classIndex); if (scriptClass == 0) { const QByteArray className = "ArtifactsScriptClass" + QByteArray::number(classIndex); scriptClass = engine->registerClass(className.constData(), nullptr, nullptr, JS_UNDEFINED, &getArtifactsPropertyNames, &getArtifactsProperty); engine->setArtifactsScriptClass(classIndex, scriptClass); } artifactsObj = JS_NewObjectClass(engine->context(), scriptClass); attachPointerTo(artifactsObj, productOrModule); return artifactsObj; } JSValue artifactsScriptValueForProduct(JSContext *ctx, JSValue this_val, int, JSValue *) { return js_artifacts(ctx, this_val); } JSValue artifactsScriptValueForModule(JSContext *ctx, JSValueConst this_val, int, JSValueConst *) { return js_artifacts(ctx, this_val); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/artifactcleaner.h0000644000175100017510000000520415154533055023100 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ARTIFACTCLEANER_H #define QBS_ARTIFACTCLEANER_H #include #include #include namespace qbs { class CleanOptions; namespace Internal { class ProgressObserver; class ArtifactCleaner { public: ArtifactCleaner(Logger logger, ProgressObserver *observer); void cleanup(const TopLevelProjectPtr &project, const QVector &products, const CleanOptions &options); private: void removeEmptyDirectories(const QString &rootDir, const CleanOptions &options, bool *isEmpty = nullptr); Logger m_logger; bool m_hasError = false; ProgressObserver *m_observer = nullptr; }; } // namespace Internal } // namespace qbs #endif // QBS_ARTIFACTCLEANER_H qbs-src-3.2.0/src/lib/corelib/buildgraph/nodeset.h0000644000175100017510000000776215154533055021425 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_NODESET_H #define QBS_NODESET_H #include #include namespace qbs { namespace Internal { class BuildGraphNode; BuildGraphNode *loadBuildGraphNode(PersistentPool &pool); void storeBuildGraphNode(PersistentPool &pool, const BuildGraphNode *node); using NodeSet = Set; template<> inline BuildGraphNode *NodeSet::loadElem(PersistentPool &pool) { return loadBuildGraphNode(pool); } template<> inline void NodeSet::storeElem(PersistentPool &pool, BuildGraphNode * const &node) const { storeBuildGraphNode(pool, node); } template class TypeFilter { const NodeSet &m_nodes; public: TypeFilter(const NodeSet &nodes) : m_nodes(nodes) { } class const_iterator { const NodeSet &m_nodes; NodeSet::const_iterator m_it; public: using value_type = T*; using difference_type = ptrdiff_t; using pointer = value_type*; using reference = value_type&; using iterator_category = std::forward_iterator_tag; const_iterator(const NodeSet &nodes, const NodeSet::const_iterator &it) : m_nodes(nodes), m_it(it) { while (m_it != m_nodes.constEnd() && !hasDynamicType(*m_it)) ++m_it; } bool operator==(const const_iterator &rhs) const { return m_it == rhs.m_it; } bool operator!=(const const_iterator &rhs) const { return !(*this == rhs); } const_iterator &operator++() { for (;;) { ++m_it; if (m_it == m_nodes.constEnd() || hasDynamicType(*m_it)) return *this; } } T *operator*() const { return static_cast(*m_it); } }; const_iterator begin() const { return const_iterator(m_nodes, m_nodes.constBegin()); } const_iterator end() const { return const_iterator(m_nodes, m_nodes.constEnd()); } }; template const TypeFilter filterByType(const NodeSet &nodes) { return TypeFilter(nodes); } } // namespace Internal } // namespace qbs #endif // QBS_NODESET_H qbs-src-3.2.0/src/lib/corelib/buildgraph/requesteddependencies.cpp0000644000175100017510000000654715154533055024667 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #include "requesteddependencies.h" #include #include #include namespace qbs { namespace Internal { static Set depNamesForProduct(const ResolvedProduct *p) { Set names; for (const auto &dep : p->dependencies) names.insert(dep.product->uniqueName()); for (const auto &m : p->modules) { if (!m->isProduct) names.insert(m->name); } return names; } void RequestedDependencies::set(const Set &products) { m_depsPerProduct.clear(); add(products); } void RequestedDependencies::add(const Set &products) { for (const ResolvedProduct * const p : products) m_depsPerProduct[p->uniqueName()] = depNamesForProduct(p); } bool RequestedDependencies::isUpToDate(const TopLevelProject *project) const { if (m_depsPerProduct.empty()) return true; for (const auto &product : project->allProducts()) { const auto it = m_depsPerProduct.find(product->uniqueName()); if (it == m_depsPerProduct.cend()) continue; const Set newDepNames = depNamesForProduct(product.get()); if (newDepNames != it->second) { qCDebug(lcBuildGraph) << "dependencies list was accessed for product" << product->fullDisplayName() << "and dependencies have changed."; return false; } } return true; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/rulegraph.cpp0000644000175100017510000001261715154533055022303 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "rulegraph.h" #include #include #include #include namespace qbs { namespace Internal { RuleGraph::RuleGraph() = default; void RuleGraph::build(const std::vector &rules, const FileTags &productFileTags) { QMap > inputFileTagToRule; m_rules.reserve(rules.size()); for (const RulePtr &rule : rules) { for (const FileTag &fileTag : rule->collectedOutputFileTags()) m_outputFileTagToRule[fileTag].push_back(rule.get()); insert(rule); } m_parents.resize(rules.size()); m_children.resize(rules.size()); for (const auto &rule : std::as_const(m_rules)) { FileTags inFileTags = rule->inputs; inFileTags += rule->auxiliaryInputs; inFileTags += rule->explicitlyDependsOn; for (const FileTag &fileTag : std::as_const(inFileTags)) { inputFileTagToRule[fileTag].push_back(rule.get()); for (const Rule * const producingRule : m_outputFileTagToRule.value(fileTag)) { if (!producingRule->collectedOutputFileTags().intersects( rule->excludedInputs)) { connect(rule.get(), producingRule); } } } } QList productRules; for (const FileTag &productFileTag : productFileTags) { QList rules = m_outputFileTagToRule.value(productFileTag); productRules << rules; //### check: the rule graph must be a in valid shape! } for (const Rule *r : std::as_const(productRules)) m_rootRules += r->ruleGraphId; } void RuleGraph::accept(RuleGraphVisitor *visitor) const { const RuleConstPtr nullParent; for (int rootIndex : std::as_const(m_rootRules)) traverse(visitor, nullParent, m_rules.at(rootIndex)); } void RuleGraph::dump() const { QByteArray indent; std::printf("---rule graph dump:\n"); Set rootRules; for (const auto &rule : std::as_const(m_rules)) if (m_parents[rule->ruleGraphId].empty()) rootRules += rule->ruleGraphId; for (int idx : std::as_const(rootRules)) dump_impl(indent, idx); } void RuleGraph::dump_impl(QByteArray &indent, int rootIndex) const { const RuleConstPtr r = m_rules[rootIndex]; std::printf("%s", indent.constData()); std::printf("%s", qPrintable(r->toString())); std::printf("\n"); indent.append(" "); for (int childIndex : std::as_const(m_children[rootIndex])) dump_impl(indent, childIndex); indent.chop(2); } int RuleGraph::insert(const RulePtr &rule) { rule->ruleGraphId = int(m_rules.size()); m_rules.push_back(rule); return rule->ruleGraphId; } void RuleGraph::connect(const Rule *creatingRule, const Rule *consumingRule) { int maxIndex = std::max(creatingRule->ruleGraphId, consumingRule->ruleGraphId); if (static_cast(m_parents.size()) <= maxIndex) { const int c = maxIndex + 1; m_parents.resize(c); m_children.resize(c); } m_parents[consumingRule->ruleGraphId].push_back(creatingRule->ruleGraphId); m_children[creatingRule->ruleGraphId].push_back(consumingRule->ruleGraphId); } void RuleGraph::traverse(RuleGraphVisitor *visitor, const RuleConstPtr &parentRule, const RuleConstPtr &rule) const { visitor->visit(parentRule, rule); for (int childIndex : m_children.at(rule->ruleGraphId)) traverse(visitor, rule, m_rules.at(childIndex)); visitor->endVisit(rule); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/executorjob.cpp0000644000175100017510000001361515154533055022642 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "executorjob.h" #include "artifact.h" #include "jscommandexecutor.h" #include "processcommandexecutor.h" #include "rulecommands.h" #include "transformer.h" #include #include #include #include namespace qbs { namespace Internal { ExecutorJob::ExecutorJob(const Logger &logger, QObject *parent) : QObject(parent) , m_processCommandExecutor(new ProcessCommandExecutor(logger, this)) , m_jsCommandExecutor(new JsCommandExecutor(logger, this)) { connect(m_processCommandExecutor, &AbstractCommandExecutor::reportCommandDescription, this, &ExecutorJob::reportCommandDescription); connect(m_processCommandExecutor, &ProcessCommandExecutor::reportProcessResult, this, &ExecutorJob::reportProcessResult); connect(m_processCommandExecutor, &AbstractCommandExecutor::finished, this, &ExecutorJob::onCommandFinished); connect(m_jsCommandExecutor, &AbstractCommandExecutor::reportCommandDescription, this, &ExecutorJob::reportCommandDescription); connect(m_jsCommandExecutor, &AbstractCommandExecutor::finished, this, &ExecutorJob::onCommandFinished); reset(); } ExecutorJob::~ExecutorJob() = default; void ExecutorJob::setMainThreadScriptEngine(ScriptEngine *engine) { m_processCommandExecutor->setMainThreadScriptEngine(engine); m_jsCommandExecutor->setMainThreadScriptEngine(engine); } void ExecutorJob::setDryRun(bool enabled) { m_processCommandExecutor->setDryRunEnabled(enabled); m_jsCommandExecutor->setDryRunEnabled(enabled); } void ExecutorJob::setEchoMode(CommandEchoMode echoMode) { m_processCommandExecutor->setEchoMode(echoMode); m_jsCommandExecutor->setEchoMode(echoMode); } void ExecutorJob::run(Transformer *t) { QBS_ASSERT(m_currentCommandIdx == -1, return); if (t->commands.empty()) { setFinished(); return; } t->propertiesRequestedInCommands.clear(); t->propertiesRequestedFromArtifactInCommands.clear(); t->importedFilesUsedInCommands.clear(); t->depsRequestedInCommands.clear(); t->artifactsMapRequestedInCommands.clear(); t->exportedModulesAccessedInCommands.clear(); t->lastCommandExecutionTime = FileTime::currentTime(); QBS_CHECK(!t->outputs.empty()); m_processCommandExecutor->setProcessEnvironment( (*t->outputs.cbegin())->product->buildEnvironment); m_transformer = t; m_jobPools = t->jobPools(); runNextCommand(); } void ExecutorJob::cancel() { if (!m_currentCommandExecutor) return; m_error = ErrorInfo(tr("Transformer execution canceled.")); m_currentCommandExecutor->cancel(); } void ExecutorJob::runNextCommand() { QBS_ASSERT(m_currentCommandIdx <= m_transformer->commands.size(), return); ++m_currentCommandIdx; if (m_currentCommandIdx >= m_transformer->commands.size()) { setFinished(); return; } const AbstractCommandPtr &command = m_transformer->commands.commandAt(m_currentCommandIdx); switch (command->type()) { case AbstractCommand::ProcessCommandType: m_currentCommandExecutor = m_processCommandExecutor; break; case AbstractCommand::JavaScriptCommandType: m_currentCommandExecutor = m_jsCommandExecutor; break; default: qFatal("Missing implementation for command type %d", command->type()); } m_currentCommandExecutor->start(m_transformer, command.get()); } void ExecutorJob::onCommandFinished(const ErrorInfo &err) { QBS_ASSERT(m_transformer, return); if (m_error.hasError()) { // Canceled? setFinished(); } else if (err.hasError()) { m_error = err; setFinished(); } else { runNextCommand(); } } void ExecutorJob::setFinished() { const ErrorInfo err = m_error; reset(); emit finished(err); } void ExecutorJob::reset() { m_transformer = nullptr; m_jobPools.clear(); m_currentCommandExecutor = nullptr; m_currentCommandIdx = -1; m_error.clear(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/rulesapplicator.h0000644000175100017510000001331115154533055023160 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_RULESAPPLICATOR_H #define QBS_RULESAPPLICATOR_H #include "artifact.h" #include "forward_decls.h" #include "nodeset.h" #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class CppModulesScanner; class BuildGraphNode; class QtMocScanner; class ScriptEngine; class RulesApplicator { public: RulesApplicator(ResolvedProductPtr product, const std::unordered_map &productsByName, const std::unordered_map &projectsByName, Logger logger); ~RulesApplicator(); const NodeSet &createdArtifacts() const { return m_createdArtifacts; } const NodeSet &invalidatedArtifacts() const { return m_invalidatedArtifacts; } QStringList removedArtifacts() const { return m_removedArtifacts; } bool ruleUsesIo() const { return m_ruleUsesIo; } void applyRule(RuleNode *ruleNode, const ArtifactSet &inputArtifacts, const ArtifactSet &explicitlyDependsOn); static void handleRemovedRuleOutputs( const ArtifactSet &inputArtifacts, const ArtifactSet &artifactsToRemove, QStringList &removedArtifacts, const Logger &logger); static ArtifactSet collectExplicitlyDependsOn(const Rule *rule, const ResolvedProduct *product); private: enum InputsSources { CurrentProduct, Dependencies }; void doApply(const ArtifactSet &inputArtifacts, JSValue prepareScriptContext); ArtifactSet collectOldOutputArtifacts(const ArtifactSet &inputArtifacts) const; struct TransformerContext { TransformerPtr transformer; TransformerConstPtr oldTransformer; }; struct OutputArtifactInfo { Artifact *artifact = nullptr; bool newlyCreated = false; FileTags oldFileTags; QVariantMap oldProperties; }; OutputArtifactInfo createOutputArtifactFromRuleArtifact( const RuleArtifactConstPtr &ruleArtifact, const ArtifactSet &inputArtifacts, Set *outputFilePaths, TransformerContext &context); OutputArtifactInfo createOutputArtifact( const QString &filePath, const FileTags &fileTags, bool alwaysUpdated, const ArtifactSet &inputArtifacts, TransformerContext &context); QList runOutputArtifactsScript( const ArtifactSet &inputArtifacts, const JSValueList &args, TransformerContext &context); Artifact *createOutputArtifactFromScriptValue( const JSValue &obj, const ArtifactSet &inputArtifacts, TransformerContext &context); QString resolveOutPath(const QString &path) const; const RulesEvaluationContextPtr &evalContext() const; ScriptEngine *engine() const; JSContext *jsContext() const; JSValue scope() const; static ArtifactSet collectAdditionalInputs(const FileTags &tags, const Rule *rule, const ResolvedProduct *product, InputsSources inputsSources); const ResolvedProductPtr m_product; const std::unordered_map &m_productsByName; const std::unordered_map &m_projectsByName; ArtifactSet m_explicitlyDependsOn; NodeSet m_createdArtifacts; NodeSet m_invalidatedArtifacts; QStringList m_removedArtifacts; RuleNode *m_ruleNode = nullptr; RuleConstPtr m_rule; ArtifactSet m_completeInputSet; QtMocScanner *m_mocScanner = nullptr; CppModulesScanner *m_cxxModulesScanner = nullptr; Logger m_logger; bool m_ruleUsesIo = false; }; } // namespace Internal } // namespace qbs #endif // QBS_RULESAPPLICATOR_H qbs-src-3.2.0/src/lib/corelib/buildgraph/buildgraph.h0000644000175100017510000001200715154533055022071 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_BUILDGRAPH_H #define QBS_BUILDGRAPH_H #include "forward_decls.h" #include #include #include #include #include namespace qbs { namespace Internal { class BuildGraphNode; class Logger; class ScriptEngine; class PrepareScriptObserver; Artifact *lookupArtifact(const ResolvedProductConstPtr &product, const ProjectBuildData *projectBuildData, const QString &dirPath, const QString &fileName, bool compareByName = false); Artifact *lookupArtifact(const ResolvedProductConstPtr &product, const QString &dirPath, const QString &fileName, bool compareByName = false); Artifact *lookupArtifact(const ResolvedProductConstPtr &product, const ProjectBuildData *buildData, const QString &filePath, bool compareByName = false); Artifact *lookupArtifact(const ResolvedProductConstPtr &product, const QString &filePath, bool compareByName = false); Artifact *lookupArtifact(const ResolvedProductConstPtr &product, const Artifact *artifact, bool compareByName); Artifact *createArtifact(const ResolvedProductPtr &product, const SourceArtifactConstPtr &sourceArtifact); void setArtifactData(Artifact *artifact, const SourceArtifactConstPtr &sourceArtifact); void updateArtifactFromSourceArtifact(const ResolvedProductPtr &product, const SourceArtifactConstPtr &sourceArtifact); void insertArtifact(const ResolvedProductPtr &product, Artifact *artifact); void dumpProductBuildData(const ResolvedProductConstPtr &product); void provideFullFileTagsAndProperties(Artifact *artifact); void applyPerArtifactProperties(Artifact *artifact); void updateGeneratedArtifacts(ResolvedProduct *product); void invalidateArtifactAsRuleInputIfNecessary(Artifact *artifact); bool findPath(BuildGraphNode *u, BuildGraphNode *v, QList &path); void QBS_AUTOTEST_EXPORT connect(BuildGraphNode *p, BuildGraphNode *c); bool safeConnect(Artifact *u, Artifact *v); void removeGeneratedArtifactFromDisk(Artifact *artifact, const Logger &logger); void removeGeneratedArtifactFromDisk(const QString &filePath, const Logger &logger); void disconnect(BuildGraphNode *u, BuildGraphNode *v); void setupScriptEngineForFile(ScriptEngine *engine, const FileContextBaseConstPtr &fileContext, JSValue targetObject, const ObserveMode &observeMode); void setupScriptEngineForProduct(ScriptEngine *engine, ResolvedProduct *product, const ResolvedModule *module, JSValue targetObject, bool setBuildEnvironment); QString relativeArtifactFileName(const Artifact *artifact); // Debugging helpers void doSanityChecks(const ResolvedProjectPtr &project, const Logger &logger); void getPropertyNames(JSContext *ctx, JSPropertyEnum **ptab, uint32_t *plen, const QVariantMap &properties, const QStringList &extraPropertyNames, JSValueConst extraObject); } // namespace Internal } // namespace qbs #endif // QBS_BUILDGRAPH_H qbs-src-3.2.0/src/lib/corelib/buildgraph/rulecommands.cpp0000644000175100017510000005156415154533055023007 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** 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$ ** ****************************************************************************/ #include "rulecommands.h" #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { static QString argumentsProperty() { return QStringLiteral("arguments"); } static QString environmentProperty() { return QStringLiteral("environment"); } static QString extendedDescriptionProperty() { return QStringLiteral("extendedDescription"); } static QString highlightProperty() { return QStringLiteral("highlight"); } static QString ignoreDryRunProperty() { return QStringLiteral("ignoreDryRun"); } static QString maxExitCodeProperty() { return QStringLiteral("maxExitCode"); } static QString programProperty() { return QStringLiteral("program"); } static QString responseFileArgumentIndexProperty() { return QStringLiteral("responseFileArgumentIndex"); } static QString responseFileThresholdProperty() { return QStringLiteral("responseFileThreshold"); } static QString responseFileUsagePrefixProperty() { return QStringLiteral("responseFileUsagePrefix"); } static QString responseFileSeparatorProperty() { return QStringLiteral("responseFileSeparator"); } static QString silentProperty() { return QStringLiteral("silent"); } static QString stderrFilePathProperty() { return QStringLiteral("stderrFilePath"); } static QString stderrFilterFunctionProperty() { return QStringLiteral("stderrFilterFunction"); } static QString stdoutFilePathProperty() { return QStringLiteral("stdoutFilePath"); } static QString stdoutFilterFunctionProperty() { return QStringLiteral("stdoutFilterFunction"); } static QString timeoutProperty() { return QStringLiteral("timeout"); } static QString workingDirProperty() { return QStringLiteral("workingDirectory"); } static QString invokedSourceCode(JSContext *ctx, const JSValue &codeOrFunction) { const QString &code = getJsString(ctx, codeOrFunction); return JS_IsFunction(ctx, codeOrFunction) ? QStringLiteral("(") + code + QStringLiteral(")()") : code; } AbstractCommand::AbstractCommand() : m_description(defaultDescription()), m_extendedDescription(defaultExtendedDescription()), m_highlight(defaultHighLight()), m_ignoreDryRun(defaultIgnoreDryRun()), m_silent(defaultIsSilent()), m_timeout(defaultTimeout()) { } AbstractCommand::~AbstractCommand() = default; bool AbstractCommand::equals(const AbstractCommand *other) const { return type() == other->type() && m_description == other->m_description && m_extendedDescription == other->m_extendedDescription && m_highlight == other->m_highlight && m_ignoreDryRun == other->m_ignoreDryRun && m_silent == other->m_silent && m_jobPool == other->m_jobPool && m_timeout == other->m_timeout && qVariantMapsEqual(m_properties, other->m_properties); } void AbstractCommand::fillFromScriptValue(JSContext *ctx, const JSValue *scriptValue, const CodeLocation &codeLocation) { m_description = getJsStringProperty(ctx, *scriptValue, StringConstants::descriptionProperty()); m_extendedDescription = getJsStringProperty(ctx, *scriptValue, extendedDescriptionProperty()); m_highlight = getJsStringProperty(ctx, *scriptValue, highlightProperty()); m_ignoreDryRun = getJsBoolProperty(ctx, *scriptValue, ignoreDryRunProperty()); m_silent = getJsBoolProperty(ctx, *scriptValue, silentProperty()); m_jobPool = getJsStringProperty(ctx, *scriptValue, StringConstants::jobPoolProperty()); const auto timeoutScriptValue = getJsProperty(ctx, *scriptValue, timeoutProperty()); if (!JS_IsUndefined(timeoutScriptValue) && !JS_IsNull(timeoutScriptValue)) m_timeout = JS_VALUE_GET_INT(timeoutScriptValue); m_codeLocation = codeLocation; m_predefinedProperties << StringConstants::descriptionProperty() << extendedDescriptionProperty() << highlightProperty() << ignoreDryRunProperty() << StringConstants::jobPoolProperty() << silentProperty() << timeoutProperty(); } QString AbstractCommand::fullDescription(const QString &productName) const { return QLatin1Char('[') + productName + QLatin1String("] ") + description(); } QString AbstractCommand::descriptionForCancelMessage(const QString &productName) const { return fullDescription(productName); } void AbstractCommand::load(PersistentPool &pool) { serializationOp(pool); } void AbstractCommand::store(PersistentPool &pool) { serializationOp(pool); } void AbstractCommand::applyCommandProperties(JSContext *ctx, const JSValue *scriptValue) { handleJsProperties(ctx, *scriptValue, [this, ctx](const JSAtom &prop, const JSPropertyDescriptor &desc) { const QString name = getJsString(ctx, prop); if (m_predefinedProperties.contains(name)) return; // TODO: Use script class for command objects, don't allow setting random properties if (!JS_IsSimpleValue(ctx, desc.value)) { throw ErrorInfo(Tr::tr("Property '%1' has a type unsuitable for storing in a command " "object.").arg(name), m_codeLocation); } m_properties.insert(name, getJsVariant(ctx, desc.value)); }); } static JSValue js_CommandBase(JSContext *ctx) { const JSValue cmd = JS_NewObject(ctx); setJsProperty(ctx, cmd, StringConstants::descriptionProperty(), makeJsString(ctx, AbstractCommand::defaultDescription())); setJsProperty(ctx, cmd, extendedDescriptionProperty(), makeJsString(ctx, AbstractCommand::defaultExtendedDescription())); setJsProperty(ctx, cmd, highlightProperty(), makeJsString(ctx, AbstractCommand::defaultHighLight())); setJsProperty(ctx, cmd, ignoreDryRunProperty(), JS_NewBool(ctx, AbstractCommand::defaultIgnoreDryRun())); setJsProperty(ctx, cmd, silentProperty(), JS_NewBool(ctx, AbstractCommand::defaultIsSilent())); setJsProperty(ctx, cmd, timeoutProperty(), JS_NewInt32(ctx, AbstractCommand::defaultTimeout())); return cmd; } static JSValue js_Command(JSContext *ctx, JSValueConst, JSValueConst, int argc, JSValueConst *argv, int) { static ProcessCommandPtr commandPrototype = ProcessCommand::create(); JSValue program = JS_UNDEFINED; if (argc > 0) program = JS_DupValue(ctx, argv[0]); if (JS_IsUndefined(program)) program = makeJsString(ctx, commandPrototype->program()); JSValue arguments = JS_UNDEFINED; if (argc > 1) arguments = JS_DupValue(ctx, argv[1]); if (JS_IsUndefined(arguments)) arguments = makeJsStringList(ctx, commandPrototype->arguments()); if (JS_IsString(arguments)) { JSValue args = JS_NewArray(ctx); JS_SetPropertyUint32(ctx, args, 0, arguments); arguments = args; } JSValue cmd = js_CommandBase(ctx); setJsProperty(ctx, cmd, StringConstants::classNameProperty(), makeJsString(ctx, StringConstants::commandType())); setJsProperty(ctx, cmd, programProperty(), program); setJsProperty(ctx, cmd, argumentsProperty(), arguments); setJsProperty(ctx, cmd, workingDirProperty(), makeJsString(ctx, commandPrototype->workingDir())); setJsProperty(ctx, cmd, maxExitCodeProperty(), JS_NewInt32(ctx, commandPrototype->maxExitCode())); setJsProperty(ctx, cmd, stdoutFilterFunctionProperty(), makeJsString(ctx, commandPrototype->stdoutFilterFunction())); setJsProperty(ctx, cmd, stderrFilterFunctionProperty(), makeJsString(ctx, commandPrototype->stderrFilterFunction())); setJsProperty(ctx, cmd, responseFileThresholdProperty(), JS_NewInt32(ctx, commandPrototype->responseFileThreshold())); setJsProperty(ctx, cmd, responseFileArgumentIndexProperty(), JS_NewInt32(ctx, commandPrototype->responseFileArgumentIndex())); setJsProperty(ctx, cmd, responseFileUsagePrefixProperty(), makeJsString(ctx, commandPrototype->responseFileUsagePrefix())); setJsProperty(ctx, cmd, responseFileSeparatorProperty(), makeJsString(ctx, commandPrototype->responseFileSeparator())); setJsProperty(ctx, cmd, stdoutFilePathProperty(), makeJsString(ctx, commandPrototype->stdoutFilePath())); setJsProperty(ctx, cmd, stderrFilePathProperty(), makeJsString(ctx, commandPrototype->stderrFilePath())); setJsProperty(ctx, cmd, environmentProperty(), makeJsStringList(ctx, commandPrototype->environment().toStringList())); setJsProperty(ctx, cmd, ignoreDryRunProperty(), JS_NewBool(ctx, commandPrototype->ignoreDryRun())); return cmd; } void ProcessCommand::setupForJavaScript(ScriptEngine *engine, JSValue targetObject) { engine->registerClass(StringConstants::commandType().toUtf8().constData(), js_Command, nullptr, targetObject); } ProcessCommand::ProcessCommand() : m_maxExitCode(0) , m_responseFileThreshold(defaultResponseFileThreshold()) , m_responseFileArgumentIndex(0) , m_responseFileSeparator(QStringLiteral("\n")) { } int ProcessCommand::defaultResponseFileThreshold() const { // TODO: Non-Windows platforms likely have their own limits. Investigate. return HostOsInfo::isWindowsHost() ? 31000 // 32000 minus "safety offset" : -1; } void ProcessCommand::getEnvironmentFromList(const QStringList &envList) { m_environment.clear(); for (const QString &env : envList) { const int equalsIndex = env.indexOf(QLatin1Char('=')); if (equalsIndex <= 0 || equalsIndex == env.size() - 1) continue; const QString &var = env.left(equalsIndex); const QString &value = env.mid(equalsIndex + 1); m_environment.insert(var, value); } } bool ProcessCommand::equals(const AbstractCommand *otherAbstractCommand) const { if (!AbstractCommand::equals(otherAbstractCommand)) return false; const auto other = static_cast(otherAbstractCommand); return m_program == other->m_program && m_arguments == other->m_arguments && m_workingDir == other->m_workingDir && m_maxExitCode == other->m_maxExitCode && m_stdoutFilterFunction == other->m_stdoutFilterFunction && m_stderrFilterFunction == other->m_stderrFilterFunction && m_responseFileThreshold == other->m_responseFileThreshold && m_responseFileArgumentIndex == other->m_responseFileArgumentIndex && m_responseFileUsagePrefix == other->m_responseFileUsagePrefix && m_responseFileSeparator == other->m_responseFileSeparator && m_stdoutFilePath == other->m_stdoutFilePath && m_stderrFilePath == other->m_stderrFilePath && m_relevantEnvVars == other->m_relevantEnvVars && m_relevantEnvValues == other->m_relevantEnvValues && m_environment == other->m_environment; } void ProcessCommand::fillFromScriptValue(JSContext *ctx, const JSValue *scriptValue, const CodeLocation &codeLocation) { AbstractCommand::fillFromScriptValue(ctx, scriptValue, codeLocation); m_program = getJsStringProperty(ctx, *scriptValue, programProperty()); m_arguments = getJsStringListProperty(ctx, *scriptValue, argumentsProperty()); m_workingDir = getJsStringProperty(ctx, *scriptValue, workingDirProperty()); m_maxExitCode = getJsIntProperty(ctx, *scriptValue, maxExitCodeProperty()); const ScopedJsValue stdoutFilterFunction(ctx, getJsProperty(ctx, *scriptValue, stdoutFilterFunctionProperty())); if (JS_IsFunction(ctx, stdoutFilterFunction)) m_stdoutFilterFunction = QLatin1Char('(') + getJsString(ctx, stdoutFilterFunction) + QLatin1Char(')'); const ScopedJsValue stderrFilterFunction(ctx, getJsProperty(ctx, *scriptValue, stderrFilterFunctionProperty())); if (JS_IsFunction(ctx, stderrFilterFunction)) m_stderrFilterFunction = QLatin1Char('(') + getJsString(ctx, stderrFilterFunction) + QLatin1Char(')'); m_relevantEnvVars = getJsStringListProperty(ctx, *scriptValue, QStringLiteral("relevantEnvironmentVariables")); m_responseFileThreshold = getJsIntProperty(ctx, *scriptValue, responseFileThresholdProperty()); m_responseFileArgumentIndex = getJsIntProperty(ctx, *scriptValue, responseFileArgumentIndexProperty()); m_responseFileUsagePrefix = getJsStringProperty(ctx, *scriptValue, responseFileUsagePrefixProperty()); m_responseFileSeparator = getJsStringProperty(ctx, *scriptValue, responseFileSeparatorProperty()); QStringList envList = getJsStringListProperty(ctx, *scriptValue, environmentProperty()); getEnvironmentFromList(envList); m_stdoutFilePath = getJsStringProperty(ctx, *scriptValue, stdoutFilePathProperty()); m_stderrFilePath = getJsStringProperty(ctx, *scriptValue, stderrFilePathProperty()); m_predefinedProperties << programProperty() << argumentsProperty() << workingDirProperty() << maxExitCodeProperty() << stdoutFilterFunctionProperty() << stderrFilterFunctionProperty() << responseFileThresholdProperty() << responseFileArgumentIndexProperty() << responseFileUsagePrefixProperty() << environmentProperty() << stdoutFilePathProperty() << stderrFilePathProperty(); applyCommandProperties(ctx, scriptValue); } QString ProcessCommand::descriptionForCancelMessage(const QString &productName) const { return description() + QLatin1String(" (") + QDir::toNativeSeparators(m_program) + QLatin1String(") [") + productName + QLatin1Char(']'); } QStringList ProcessCommand::relevantEnvVars() const { QStringList vars = m_relevantEnvVars; if (!FileInfo::isAbsolute(program())) vars << StringConstants::pathEnvVar(); return vars; } void ProcessCommand::addRelevantEnvValue(const QString &key, const QString &value) { m_relevantEnvValues.insert(key, value); } void ProcessCommand::load(PersistentPool &pool) { AbstractCommand::load(pool); serializationOp(pool); } void ProcessCommand::store(PersistentPool &pool) { AbstractCommand::store(pool); serializationOp(pool); } static QString currentImportScopeName(JSContext *ctx) { const ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const JSValueList &contextStack = engine->contextStack(); for (auto it = contextStack.rbegin(); it != contextStack.rend(); ++it) { if (!JS_IsObject(*it)) continue; const ScopedJsValue v(ctx, getJsProperty(ctx, *it, StringConstants::importScopeNamePropertyInternal())); if (JS_IsString(v)) return getJsString(ctx, v); } return {}; } static JSValue js_JavaScriptCommand(JSContext *ctx, JSValueConst, JSValueConst, int argc, JSValueConst *, int) { if (argc > 0) return throwError(ctx, Tr::tr("JavaScriptCommand c'tor doesn't take arguments.")); static JavaScriptCommandPtr commandPrototype = JavaScriptCommand::create(); JSValue cmd = js_CommandBase(ctx); setJsProperty(ctx, cmd, StringConstants::classNameProperty(), makeJsString(ctx, StringConstants::javaScriptCommandType())); setJsProperty(ctx, cmd, StringConstants::sourceCodeProperty(), makeJsString(ctx, commandPrototype->sourceCode())); setJsProperty(ctx, cmd, StringConstants::importScopeNamePropertyInternal(), makeJsString(ctx, currentImportScopeName(ctx))); return cmd; } void JavaScriptCommand::setupForJavaScript(ScriptEngine *engine, JSValue targetObject) { engine->registerClass(StringConstants::javaScriptCommandType().toUtf8().constData(), js_JavaScriptCommand, nullptr, targetObject); } JavaScriptCommand::JavaScriptCommand() = default; bool JavaScriptCommand::equals(const AbstractCommand *otherAbstractCommand) const { if (!AbstractCommand::equals(otherAbstractCommand)) return false; auto const other = static_cast(otherAbstractCommand); return m_sourceCode == other->m_sourceCode; } void JavaScriptCommand::fillFromScriptValue(JSContext *ctx, const JSValue *scriptValue, const CodeLocation &codeLocation) { AbstractCommand::fillFromScriptValue(ctx, scriptValue, codeLocation); const ScopedJsValue importScope(ctx, getJsProperty(ctx, *scriptValue, StringConstants::importScopeNamePropertyInternal())); if (JS_IsString(importScope)) m_scopeName = getJsString(ctx, importScope); const ScopedJsValue sourceCode(ctx, getJsProperty(ctx, *scriptValue, StringConstants::sourceCodeProperty())); m_sourceCode = invokedSourceCode(ctx, sourceCode); m_predefinedProperties << StringConstants::classNameProperty() << StringConstants::sourceCodeProperty() << StringConstants::importScopeNamePropertyInternal(); applyCommandProperties(ctx, scriptValue); } void JavaScriptCommand::load(PersistentPool &pool) { AbstractCommand::load(pool); serializationOp(pool); } void JavaScriptCommand::store(PersistentPool &pool) { AbstractCommand::store(pool); serializationOp(pool); } void CommandList::load(PersistentPool &pool) { m_commands.clear(); int count = pool.load(); m_commands.reserve(count); while (--count >= 0) { const auto cmdType = pool.load(); AbstractCommandPtr cmd; switch (cmdType) { case AbstractCommand::JavaScriptCommandType: cmd = pool.load(); break; case AbstractCommand::ProcessCommandType: cmd = pool.load(); break; default: QBS_CHECK(false); } addCommand(cmd); } } void CommandList::store(PersistentPool &pool) const { pool.store(int(m_commands.size())); for (const AbstractCommandPtr &cmd : m_commands) { pool.store(static_cast(cmd->type())); pool.store(cmd); } } bool operator==(const CommandList &l1, const CommandList &l2) { if (l1.size() != l2.size()) return false; for (int i = 0; i < l1.size(); ++i) if (!l1.commandAt(i)->equals(l2.commandAt(i).get())) return false; return true; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/productbuilddata.cpp0000644000175100017510000001060215154533055023634 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "productbuilddata.h" #include "artifact.h" #include "projectbuilddata.h" #include "rulecommands.h" #include #include #include #include namespace qbs { namespace Internal { ProductBuildData::~ProductBuildData() { qDeleteAll(m_nodes); } const TypeFilter ProductBuildData::rootArtifacts() const { return TypeFilter(m_roots); } void ProductBuildData::addArtifact(Artifact *artifact) { QBS_CHECK(m_nodes.insert(artifact).second); addArtifactToSet(artifact); } void ProductBuildData::addArtifactToSet(Artifact *artifact) { std::lock_guard l(m_artifactsMapMutex); for (const FileTag &tag : artifact->fileTags()) { m_artifactsByFileTag[tag] += artifact; m_jsArtifactsMapUpToDate = false; } } void ProductBuildData::removeArtifact(Artifact *artifact) { m_roots.remove(artifact); m_nodes.remove(artifact); removeArtifactFromSet(artifact); } void ProductBuildData::removeArtifactFromSetByFileTag(Artifact *artifact, const FileTag &fileTag) { std::lock_guard l(m_artifactsMapMutex); const auto it = m_artifactsByFileTag.find(fileTag); if (it == m_artifactsByFileTag.end()) return; it->remove(artifact); if (it->empty()) m_artifactsByFileTag.erase(it); m_jsArtifactsMapUpToDate = false; } void ProductBuildData::addFileTagToArtifact(Artifact *artifact, const FileTag &tag) { std::lock_guard l(m_artifactsMapMutex); m_artifactsByFileTag[tag] += artifact; m_jsArtifactsMapUpToDate = false; } ArtifactSetByFileTag ProductBuildData::artifactsByFileTag() const { return m_artifactsByFileTag; } void ProductBuildData::setRescuableArtifactData(const AllRescuableArtifactData &rad) { m_rescuableArtifactData = rad; } RescuableArtifactData ProductBuildData::removeFromRescuableArtifactData(const QString &filePath) { return m_rescuableArtifactData.take(filePath); } void ProductBuildData::addRescuableArtifactData( const QString &filePath, RescuableArtifactData &&rad) { m_rescuableArtifactData[filePath] = std::move(rad); } bool ProductBuildData::checkAndSetJsArtifactsMapUpToDateFlag() { if (!m_jsArtifactsMapUpToDate) { m_jsArtifactsMapUpToDate = true; return false; } return true; } void ProductBuildData::removeArtifactFromSet(Artifact *artifact) { for (const FileTag &t : artifact->fileTags()) removeArtifactFromSetByFileTag(artifact, t); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/rulesevaluationcontext.h0000644000175100017510000000624015154533055024601 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_RULESEVALUATIONCONTEXT_H #define QBS_RULESEVALUATIONCONTEXT_H #include #include #include #include #include namespace qbs { namespace Internal { class ProgressObserver; class ScriptEngine; class RulesEvaluationContext { public: RulesEvaluationContext(Logger logger); ~RulesEvaluationContext(); class Scope { public: Scope(RulesEvaluationContext *evalContext); ~Scope(); private: RulesEvaluationContext * const m_evalContext; }; ScriptEngine *engine() const { return m_engine.get(); } JSValue scope() const { return m_scope; } void setObserver(ProgressObserver *observer) { m_observer = observer; } ProgressObserver *observer() const { return m_observer; } void initializeObserver(const QString &description, int maximumProgress); void incrementProgressValue(); void checkForCancelation(); private: void initScope(); void cleanupScope(); Logger m_logger; const std::unique_ptr m_engine; ProgressObserver *m_observer; unsigned int m_initScopeCalls; JSValue m_scope = JS_UNDEFINED; const JSValue m_prepareScriptScope; }; } // namespace Internal } // namespace qbs #endif // QBS_RULESEVALUATIONCONTEXT_H qbs-src-3.2.0/src/lib/corelib/buildgraph/nodetreedumper.cpp0000644000175100017510000000714715154533055023336 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "nodetreedumper.h" #include "artifact.h" #include "productbuilddata.h" #include "rulenode.h" #include #include #include namespace qbs { namespace Internal { static int indentWidth() { return 4; } NodeTreeDumper::NodeTreeDumper(QIODevice &outDevice) : m_outDevice(outDevice) { } void NodeTreeDumper::start(const QVector &products) { m_indentation = 0; for (const ResolvedProductPtr &p : products) { if (!p->buildData) continue; m_currentProduct = p; for (Artifact * const root : p->buildData->rootArtifacts()) root->accept(this); m_visited.clear(); QBS_CHECK(m_indentation == 0); } } bool NodeTreeDumper::visit(Artifact *artifact) { return doVisit(artifact, artifact->fileName()); } void NodeTreeDumper::endVisit(Artifact *artifact) { Q_UNUSED(artifact); doEndVisit(); } bool NodeTreeDumper::visit(RuleNode *rule) { return doVisit(rule, rule->toString()); } void NodeTreeDumper::endVisit(RuleNode *rule) { Q_UNUSED(rule); doEndVisit(); } void NodeTreeDumper::doEndVisit() { unindent(); } void NodeTreeDumper::indent() { m_outDevice.write("\n"); m_indentation += indentWidth(); } void NodeTreeDumper::unindent() { m_indentation -= indentWidth(); } bool NodeTreeDumper::doVisit(BuildGraphNode *node, const QString &nodeRepr) { m_outDevice.write(indentation()); m_outDevice.write(nodeRepr.toLocal8Bit()); indent(); const bool wasVisited = !m_visited.insert(node).second; return !wasVisited && node->product == m_currentProduct; } QByteArray NodeTreeDumper::indentation() const { return {m_indentation, ' '}; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/productinstaller.h0000644000175100017510000000641115154533055023350 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PRODUCT_INSTALLER_H #define QBS_PRODUCT_INSTALLER_H #include "forward_decls.h" #include #include #include #include #include #include namespace qbs { namespace Internal { class ProgressObserver; class ProductInstaller { public: using Reporter = std::function; ProductInstaller( TopLevelProjectPtr project, QVector products, InstallOptions options, ProgressObserver *observer, Logger logger, Reporter &&reporter); void install(); static QString targetFilePath(const TopLevelProject *project, const QString &productSourceDir, const QString &sourceFilePath, const PropertyMapConstPtr &properties, InstallOptions &options); static void initInstallRoot(const TopLevelProject *project, InstallOptions &options); void removeInstallRoot(); void copyFile(const Artifact *artifact); private: void handleError(const QString &message); const TopLevelProjectConstPtr m_project; const QVector m_products; InstallOptions m_options; ProgressObserver * const m_observer; Logger m_logger; const Reporter m_reporter; QHash m_targetFilePathsMap; }; } // namespace Internal } // namespace qbs #endif // Header guard qbs-src-3.2.0/src/lib/corelib/buildgraph/timestampsupdater.cpp0000644000175100017510000000674315154533055024070 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "timestampsupdater.h" #include "artifact.h" #include "artifactvisitor.h" #include "productbuilddata.h" #include "projectbuilddata.h" #include #include #include #include #include namespace qbs { namespace Internal { class TimestampsUpdateVisitor : public ArtifactVisitor { public: TimestampsUpdateVisitor() : ArtifactVisitor(Artifact::Generated), m_now(FileTime::currentTime()) {} void visitProduct(const ResolvedProductConstPtr &product) { QBS_CHECK(product->buildData); ArtifactVisitor::visitProduct(product); // For target artifacts, we have to update the on-disk timestamp, because // the executor will look at it. for (Artifact * const targetArtifact : product->targetArtifacts()) { if (FileInfo(targetArtifact->filePath()).exists()) (void) QFile(targetArtifact->filePath()) .open(QIODevice::WriteOnly | QIODevice::Append); } } private: void doVisit(Artifact *artifact) override { if (FileInfo(artifact->filePath()).exists()) artifact->setTimestamp(m_now); } FileTime m_now; }; void TimestampsUpdater::updateTimestamps(const TopLevelProjectPtr &project, const QVector &products, const Logger &logger) { TimestampsUpdateVisitor v; for (const ResolvedProductPtr &product : products) v.visitProduct(product); if (!products.empty()) project->buildData->setDirty(); project->store(logger); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/executor.cpp0000644000175100017510000014406115154533055022147 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "executor.h" #include "buildgraph.h" #include "emptydirectoriesremover.h" #include "environmentscriptrunner.h" #include "productbuilddata.h" #include "projectbuilddata.h" #include "cycledetector.h" #include "executorjob.h" #include "inputartifactscanner.h" #include "productinstaller.h" #include "rescuableartifactdata.h" #include "rulecommands.h" #include "rulenode.h" #include "rulesevaluationcontext.h" #include "transformerchangetracking.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { bool Executor::ComparePriority::operator() (const BuildGraphNode *x, const BuildGraphNode *y) const { return x->product->buildData->buildPriority() < y->product->buildData->buildPriority(); } Executor::Executor(Logger logger, QObject *parent) : QObject(parent) , m_productInstaller(nullptr) , m_logger(std::move(logger)) , m_progressObserver(nullptr) , m_state(ExecutorIdle) , m_cancelationTimer(new QTimer(this)) { m_inputArtifactScanContext = new InputArtifactScannerContext; m_cancelationTimer->setSingleShot(false); m_cancelationTimer->setInterval(1000); connect(m_cancelationTimer, &QTimer::timeout, this, &Executor::checkForCancellation); } Executor::~Executor() { // jobs must be destroyed before deleting the m_inputArtifactScanContext m_allJobs.clear(); delete m_inputArtifactScanContext; delete m_productInstaller; } FileTime Executor::recursiveFileTime(const QString &filePath) const { FileTime newest; FileInfo fileInfo(filePath); if (!fileInfo.exists()) { const QString nativeFilePath = QDir::toNativeSeparators(filePath); m_logger.qbsWarning() << Tr::tr("File '%1' not found.").arg(nativeFilePath); return newest; } newest = std::max(fileInfo.lastModified(), fileInfo.lastStatusChange()); if (!fileInfo.isDir()) return newest; const QStringList dirContents = QDir(filePath) .entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); for (const QString &curFileName : dirContents) { const FileTime ft = recursiveFileTime(filePath + QLatin1Char('/') + curFileName); if (ft > newest) newest = ft; } return newest; } void Executor::retrieveSourceFileTimestamp(Artifact *artifact) const { QBS_CHECK(artifact->artifactType == Artifact::SourceFile); if (m_buildOptions.changedFiles().contains(artifact->filePath())) artifact->setTimestamp(FileTime::currentTime()); else if (m_buildOptions.changedFiles().empty() || !artifact->timestamp().isValid()) artifact->setTimestamp(recursiveFileTime(artifact->filePath())); artifact->timestampRetrieved = true; if (!artifact->timestamp().isValid()) throw ErrorInfo(Tr::tr("Source file '%1' has disappeared.").arg(artifact->filePath())); } void Executor::build() { try { m_partialBuild = size_t(m_primaryProducts.size()) != m_allProducts.size(); doBuild(); } catch (const ErrorInfo &e) { handleError(e); } } void Executor::setProject(const TopLevelProjectPtr &project) { m_project = project; m_allProducts = project->allProducts(); m_projectsByName.clear(); m_projectsByName.insert(std::make_pair(project->name, project.get())); for (const ResolvedProjectPtr &p : project->allSubProjects()) m_projectsByName.insert(std::make_pair(p->name, p.get())); } void Executor::setProducts(const QVector &productsToBuild) { m_primaryProducts = productsToBuild; setupAuxiliaryProducts(); m_productsByName.clear(); for (const ResolvedProductPtr &p : m_buildableProducts) m_productsByName.insert(std::make_pair(p->uniqueName(), p.get())); } void Executor::setupAuxiliaryProducts() { m_buildableProducts = m_primaryProducts; if (int(m_primaryProducts.size()) == int(m_allProducts.size())) return; // Collect dependencies. Products that are not minimal dependencies via *all* dependency chains // become primary products, i.e. they will get fully built. QHash dependencies; const std::function addDependency = [&](const ResolvedProductPtr &p, bool minimal) { auto &buildFully = dependencies[p]; if (!minimal) buildFully = true; for (const ProductDependency &dep : std::as_const(p->dependencies)) addDependency(dep.product, minimal || dep.minimal); }; for (const ResolvedProductPtr &primary : std::as_const(m_primaryProducts)) { for (const ProductDependency &dep : std::as_const(primary->dependencies)) addDependency(dep.product, dep.minimal); } for (auto it = dependencies.cbegin(); it != dependencies.cend(); ++it) { m_buildableProducts << it.key(); if (it.value()) m_primaryProducts << it.key(); } } class ProductPrioritySetter { const std::vector &m_allProducts; unsigned int m_priority = 0; Set m_seenProducts; public: ProductPrioritySetter(const std::vector &allProducts) // TODO: Use only products to build? : m_allProducts(allProducts) { } void apply() { Set allDependencies; for (const ResolvedProductPtr &product : m_allProducts) { for (const ProductDependency &dep : product->dependencies) allDependencies += dep.product; } const Set rootProducts = rangeTo>(m_allProducts) - allDependencies; m_priority = UINT_MAX; m_seenProducts.clear(); for (const ResolvedProductPtr &rootProduct : rootProducts) traverse(rootProduct); } private: void traverse(const ResolvedProductPtr &product) { if (!m_seenProducts.insert(product).second) return; for (const ProductDependency &dependency : std::as_const(product->dependencies)) traverse(dependency.product); if (!product->buildData) return; product->buildData->setBuildPriority(m_priority--); } }; void Executor::doBuild() { if (m_buildOptions.maxJobCount() <= 0) { m_buildOptions.setMaxJobCount(BuildOptions::defaultMaxJobCount()); qCDebug(lcExec) << "max job count not explicitly set, using value of" << m_buildOptions.maxJobCount(); } QBS_CHECK(m_state == ExecutorIdle); m_leaves = Leaves(); m_error.clear(); m_explicitlyCanceled = false; m_activeFileTags = FileTags::fromStringList(m_buildOptions.activeFileTags()); m_tagsOfFilesToConsider.clear(); m_tagsNeededForFilesToConsider.clear(); m_productsOfFilesToConsider.clear(); m_artifactsRemovedFromDisk.clear(); m_jobCountPerPool.clear(); setupJobLimits(); // TODO: The "filesToConsider" thing is badly designed; we should know exactly which artifact // it is. Remove this from the BuildOptions class and introduce Project::buildSomeFiles() // instead. const QStringList &filesToConsider = m_buildOptions.filesToConsider(); if (!filesToConsider.empty()) { for (const QString &fileToConsider : filesToConsider) { const auto &files = m_project->buildData->lookupFiles(fileToConsider); for (const FileResourceBase * const file : files) { if (file->fileType() != FileResourceBase::FileTypeArtifact) continue; auto const artifact = static_cast(file); if (contains(m_buildableProducts, artifact->product.lock())) { m_tagsOfFilesToConsider.unite(artifact->fileTags()); m_productsOfFilesToConsider << artifact->product.lock(); } } } } setState(ExecutorRunning); if (m_primaryProducts.empty()) { qCDebug(lcExec) << "No products to build, finishing."; QTimer::singleShot(0, this, &Executor::finish); // Don't call back on the caller. return; } doSanityChecks(); QBS_CHECK(!m_project->buildData->evaluationContext); m_project->buildData->evaluationContext = std::make_shared(m_logger); m_evalContext = m_project->buildData->evaluationContext; m_progressObserver->addScriptEngine(m_evalContext->engine()); m_elapsedTimeRules = m_elapsedTimeScanners = m_elapsedTimeInstalling = 0; m_evalContext->engine()->enableProfiling(m_buildOptions.logElapsedTime()); InstallOptions installOptions; installOptions.setDryRun(m_buildOptions.dryRun()); installOptions.setInstallRoot( m_buildableProducts.front() ->moduleProperties->qbsPropertyValue(StringConstants::installRootProperty()) .toString()); installOptions.setKeepGoing(m_buildOptions.keepGoing()); auto installReporter = [this](const QString &desc) { emit reportCommandDescription(QStringLiteral("filegen"), desc); }; m_productInstaller = new ProductInstaller( m_project, m_buildableProducts, installOptions, m_progressObserver, m_logger, std::move(installReporter)); if (m_buildOptions.removeExistingInstallation()) m_productInstaller->removeInstallRoot(); addExecutorJobs(); syncFileDependencies(); prepareAllNodes(); prepareProducts(); setupRootNodes(); prepareReachableNodes(); setupProgressObserver(); initLeaves(); if (!scheduleJobs()) { qCDebug(lcExec) << "Nothing to do at all, finishing."; QTimer::singleShot(0, this, &Executor::finish); // Don't call back on the caller. } if (m_progressObserver) m_cancelationTimer->start(); } void Executor::setBuildOptions(const BuildOptions &buildOptions) { m_buildOptions = buildOptions; } void Executor::initLeaves() { updateLeaves(m_roots); } void Executor::updateLeaves(const NodeSet &nodes) { NodeSet seenNodes; for (BuildGraphNode * const node : nodes) updateLeaves(node, seenNodes); } void Executor::updateLeaves(BuildGraphNode *node, NodeSet &seenNodes) { if (!seenNodes.insert(node).second) return; // Artifacts that appear in the build graph after // prepareBuildGraph() has been called, must be initialized. if (node->buildState == BuildGraphNode::Untouched) { node->buildState = BuildGraphNode::Buildable; if (node->type() == BuildGraphNode::ArtifactNodeType) { auto const artifact = static_cast(node); if (artifact->artifactType == Artifact::SourceFile) retrieveSourceFileTimestamp(artifact); } } bool isLeaf = true; for (BuildGraphNode *child : std::as_const(node->children)) { if (child->buildState != BuildGraphNode::Built) { isLeaf = false; updateLeaves(child, seenNodes); } } if (isLeaf) { qCDebug(lcExec).noquote() << "adding leaf" << node->toString(); m_leaves.push(node); } } // Returns true if some artifacts are still waiting to be built or currently building. bool Executor::scheduleJobs() { QBS_CHECK(m_state == ExecutorRunning); std::vector delayedLeaves; while (!m_leaves.empty() && !m_availableJobs.empty()) { BuildGraphNode * const nodeToBuild = m_leaves.top(); m_leaves.pop(); switch (nodeToBuild->buildState) { case BuildGraphNode::Untouched: QBS_ASSERT(!"untouched node in leaves list", qDebug("%s", qPrintable(nodeToBuild->toString()))); break; case BuildGraphNode::Buildable: // This is the only state in which we want to build a node. // TODO: It's a bit annoying that we have to check this here already, when we // don't know whether the transformer needs to run at all. Investigate // moving the whole job allocation logic to runTransformer(). if (schedulingBlockedByJobLimit(nodeToBuild)) { qCDebug(lcExec).noquote() << "node delayed due to occupied job pool:" << nodeToBuild->toString(); delayedLeaves.push_back(nodeToBuild); } else { nodeToBuild->accept(this); } break; case BuildGraphNode::Building: qCDebug(lcExec).noquote() << nodeToBuild->toString(); qCDebug(lcExec) << "node is currently being built. Skipping."; break; case BuildGraphNode::Built: qCDebug(lcExec).noquote() << nodeToBuild->toString(); qCDebug(lcExec) << "node already built. Skipping."; break; } } for (BuildGraphNode * const delayedLeaf : delayedLeaves) m_leaves.push(delayedLeaf); return !m_leaves.empty() || !m_processingJobs.empty(); } bool Executor::schedulingBlockedByJobLimit(const BuildGraphNode *node) { if (node->type() != BuildGraphNode::ArtifactNodeType) return false; const auto artifact = static_cast(node); if (artifact->artifactType == Artifact::SourceFile) return false; const Transformer * const transformer = artifact->transformer.get(); for (const QString &jobPool : transformer->jobPools()) { const int currentJobCount = m_jobCountPerPool[jobPool]; if (currentJobCount == 0) continue; const auto jobLimitIsExceeded = [currentJobCount, jobPool, this](const Transformer *t) { const auto it = m_jobLimitsPerProduct.find(t->product().get()); if (it == m_jobLimitsPerProduct.cend()) return false; // See checkNodeProduct() for why this is possible const int maxJobCount = it->second.getLimit(jobPool); return maxJobCount > 0 && currentJobCount >= maxJobCount; }; // Different products can set different limits. The effective limit is the minimum of what // is set in this transformer's product and in the products of all currently // running transformers. if (jobLimitIsExceeded(transformer)) return true; const auto runningJobs = m_processingJobs.keys(); for (const ExecutorJob * const runningJob : runningJobs) { if (!runningJob->jobPools().contains(jobPool)) continue; const Transformer * const runningTransformer = runningJob->transformer(); if (!runningTransformer) continue; // This can happen if the ExecutorJob has already finished. if (runningTransformer->product() == transformer->product()) continue; // We have already checked this product's job limit. if (jobLimitIsExceeded(runningTransformer)) return true; } } return false; } bool Executor::isUpToDate(Artifact *artifact) const { QBS_CHECK(artifact->artifactType == Artifact::Generated); qCDebug(lcUpToDateCheck) << "check" << artifact->filePath() << artifact->timestamp().toString(); if (m_buildOptions.forceTimestampCheck()) { artifact->setTimestamp(FileInfo(artifact->filePath()).lastModified()); qCDebug(lcUpToDateCheck) << "timestamp retrieved from filesystem:" << artifact->timestamp().toString(); } if (!artifact->timestamp().isValid()) { qCDebug(lcUpToDateCheck) << "invalid timestamp. Out of date."; return false; } for (Artifact *childArtifact : filterByType(artifact->children)) { QBS_CHECK(!childArtifact->alwaysUpdated || childArtifact->timestamp().isValid()); qCDebug(lcUpToDateCheck) << "child timestamp" << childArtifact->timestamp().toString() << childArtifact->filePath(); if (artifact->timestamp() < childArtifact->timestamp()) return false; } for (FileDependency *fileDependency : std::as_const(artifact->fileDependencies)) { if (!fileDependency->timestamp().isValid()) { qCDebug(lcUpToDateCheck) << "file dependency doesn't exist" << fileDependency->filePath(); return false; } qCDebug(lcUpToDateCheck) << "file dependency timestamp" << fileDependency->timestamp().toString() << fileDependency->filePath(); if (artifact->timestamp() < fileDependency->timestamp()) return false; } return true; } bool Executor::mustExecuteTransformer(const TransformerPtr &transformer) const { if (transformer->alwaysRun) return true; if (transformer->markedForRerun) { qCDebug(lcUpToDateCheck) << "explicitly marked for re-run."; return true; } bool hasAlwaysUpdatedArtifacts = false; bool hasUpToDateNotAlwaysUpdatedArtifacts = false; for (Artifact *artifact : std::as_const(transformer->outputs)) { if (isUpToDate(artifact)) { if (artifact->alwaysUpdated) hasAlwaysUpdatedArtifacts = true; else hasUpToDateNotAlwaysUpdatedArtifacts = true; } else if (artifact->alwaysUpdated || m_buildOptions.forceTimestampCheck()) { return true; } } if (commandsNeedRerun(transformer.get(), transformer->product().get(), m_productsByName, m_projectsByName)) { return true; } // If all artifacts in a transformer have "alwaysUpdated" set to false, that transformer is // run if and only if *all* of them are out of date. return !hasAlwaysUpdatedArtifacts && !hasUpToDateNotAlwaysUpdatedArtifacts; } void Executor::buildArtifact(Artifact *artifact) { qCDebug(lcExec) << relativeArtifactFileName(artifact); QBS_CHECK(artifact->buildState == BuildGraphNode::Buildable); if (artifact->artifactType != Artifact::SourceFile && !checkNodeProduct(artifact)) return; // skip artifacts without transformer if (artifact->artifactType != Artifact::Generated) { // For source artifacts, that were not reachable when initializing the build, we must // retrieve timestamps. This can happen, if a dependency that's added during the build // makes the source artifact reachable. if (artifact->artifactType == Artifact::SourceFile && !artifact->timestampRetrieved) retrieveSourceFileTimestamp(artifact); qCDebug(lcExec) << "artifact type" << toString(artifact->artifactType) << "Skipping."; finishArtifact(artifact); return; } // Every generated artifact must have a transformer. QBS_CHECK(artifact->transformer); potentiallyRunTransformer(artifact->transformer); } void Executor::executeRuleNode(RuleNode *ruleNode) { AccumulatingTimer rulesTimer(m_buildOptions.logElapsedTime() ? &m_elapsedTimeRules : nullptr); if (!checkNodeProduct(ruleNode)) return; QBS_CHECK(!m_evalContext->engine()->isActive()); const RuleNode::ApplicationResult result = ruleNode->apply( m_logger, m_productsByName, m_projectsByName); updateLeaves(result.createdArtifacts); updateLeaves(result.invalidatedArtifacts); m_artifactsRemovedFromDisk << result.removedArtifacts; if (m_progressObserver) { const int transformerCount = ruleNode->transformerCount(); if (transformerCount == 0) { m_progressObserver->incrementProgressValue(); } else { m_pendingTransformersPerRule.insert(std::make_pair(ruleNode->rule().get(), transformerCount)); } } finishNode(ruleNode); } void Executor::finishJob(ExecutorJob *job, bool success) { QBS_CHECK(job); QBS_CHECK(m_state != ExecutorIdle); const JobMap::Iterator it = m_processingJobs.find(job); QBS_CHECK(it != m_processingJobs.end()); const TransformerPtr transformer = it.value(); m_processingJobs.erase(it); m_availableJobs.push_back(job); updateJobCounts(transformer.get(), -1); if (success) { m_project->buildData->setDirty(); for (Artifact * const artifact : std::as_const(transformer->outputs)) { if (artifact->alwaysUpdated) { artifact->setTimestamp(FileTime::currentTime()); for (Artifact * const parent : artifact->parentArtifacts()) parent->transformer->markedForRerun = true; if (m_buildOptions.forceOutputCheck() && !m_buildOptions.dryRun() && !FileInfo(artifact->filePath()).exists()) { if (transformer->rule) { if (!transformer->rule->name.isEmpty()) { throw ErrorInfo(tr("Rule '%1' declares artifact '%2', " "but the artifact was not produced.") .arg(transformer->rule->name, artifact->filePath())); } throw ErrorInfo(tr("Rule declares artifact '%1', " "but the artifact was not produced.") .arg(artifact->filePath())); } throw ErrorInfo(tr("Transformer declares artifact '%1', " "but the artifact was not produced.") .arg(artifact->filePath())); } } else { artifact->setTimestamp(FileInfo(artifact->filePath()).lastModified()); } } finishTransformer(transformer); } if (!success && !m_buildOptions.keepGoing()) cancelJobs(); if (m_state == ExecutorRunning && m_progressObserver && m_progressObserver->canceled()) { qCDebug(lcExec) << "Received cancel request; canceling build."; m_explicitlyCanceled = true; cancelJobs(); } if (m_state == ExecutorCanceling) { if (m_processingJobs.empty()) { qCDebug(lcExec) << "All pending jobs are done, finishing."; finish(); } return; } if (!scheduleJobs()) { qCDebug(lcExec) << "Nothing left to build; finishing."; finish(); } } static bool allChildrenBuilt(BuildGraphNode *node) { return Internal::all_of(node->children, std::mem_fn(&BuildGraphNode::isBuilt)); } void Executor::finishNode(BuildGraphNode *leaf) { leaf->buildState = BuildGraphNode::Built; for (BuildGraphNode * const parent : std::as_const(leaf->parents)) { if (parent->buildState != BuildGraphNode::Buildable) { qCDebug(lcExec).noquote() << "parent" << parent->toString() << "build state:" << toString(parent->buildState); continue; } if (allChildrenBuilt(parent)) { m_leaves.push(parent); qCDebug(lcExec).noquote() << "finishNode adds leaf" << parent->toString() << toString(parent->buildState); } else { qCDebug(lcExec).noquote() << "parent" << parent->toString() << "build state:" << toString(parent->buildState); } } } void Executor::finishArtifact(Artifact *leaf) { QBS_CHECK(leaf); qCDebug(lcExec) << "finishArtifact" << relativeArtifactFileName(leaf); finishNode(leaf); } QString Executor::configString() const { return tr(" for configuration %1").arg(m_project->id()); } bool Executor::transformerHasMatchingOutputTags(const TransformerConstPtr &transformer) const { if (m_activeFileTags.empty()) return true; // No filtering requested. return Internal::any_of(transformer->outputs, [this](const Artifact *a) { return artifactHasMatchingOutputTags(a); }); } bool Executor::artifactHasMatchingOutputTags(const Artifact *artifact) const { return m_activeFileTags.intersects(artifact->fileTags()) || m_tagsNeededForFilesToConsider.intersects(artifact->fileTags()); } bool Executor::transformerHasMatchingInputFiles(const TransformerConstPtr &transformer) const { if (m_buildOptions.filesToConsider().empty()) return true; // No filtering requested. if (!m_productsOfFilesToConsider.contains(transformer->product())) return false; if (transformer->inputs.empty()) return true; for (const Artifact * const input : std::as_const(transformer->inputs)) { const auto files = m_buildOptions.filesToConsider(); for (const QString &filePath : files) { if (input->filePath() == filePath || input->fileTags().intersects(m_tagsNeededForFilesToConsider)) { return true; } } } return false; } void Executor::setupJobLimits() { Settings settings(m_buildOptions.settingsDirectory()); for (const auto &p : std::as_const(m_buildableProducts)) { const Preferences prefs(&settings, p->profile()); const JobLimits &jobLimitsFromSettings = prefs.jobLimits(); JobLimits effectiveJobLimits; if (m_buildOptions.projectJobLimitsTakePrecedence()) { effectiveJobLimits.update(jobLimitsFromSettings).update(m_buildOptions.jobLimits()) .update(p->jobLimits); } else { effectiveJobLimits.update(p->jobLimits).update(jobLimitsFromSettings) .update(m_buildOptions.jobLimits()); } m_jobLimitsPerProduct.insert(std::make_pair(p.get(), effectiveJobLimits)); } } void Executor::updateJobCounts(const Transformer *transformer, int diff) { for (const QString &jobPool : transformer->jobPools()) m_jobCountPerPool[jobPool] += diff; } void Executor::cancelJobs() { if (m_state == ExecutorCanceling) return; qCDebug(lcExec) << "Canceling all jobs."; setState(ExecutorCanceling); const auto jobs = m_processingJobs.keys(); for (ExecutorJob *job : jobs) job->cancel(); } void Executor::setupProgressObserver() { if (!m_progressObserver) return; int totalEffort = 1; // For the effort after the last rule application; for (const auto &product : std::as_const(m_buildableProducts)) { QBS_CHECK(product->buildData); const auto filtered = filterByType(product->buildData->allNodes()); totalEffort += std::distance(filtered.begin(), filtered.end()); } m_progressObserver->initialize(tr("Building%1").arg(configString()), totalEffort); } void Executor::doSanityChecks() { QBS_CHECK(m_project); QBS_CHECK(!m_primaryProducts.empty()); QBS_CHECK(m_buildableProducts.size() >= m_primaryProducts.size()); for (const auto &product : std::as_const(m_buildableProducts)) { QBS_CHECK(product->buildData); QBS_CHECK(product->topLevelProject() == m_project.get()); } } void Executor::handleError(const ErrorInfo &error) { const auto items = error.items(); for (const ErrorItem &ei : items) m_error.append(ei); if (m_processingJobs.empty()) finish(); else cancelJobs(); } void Executor::addExecutorJobs() { const int count = m_buildOptions.maxJobCount(); qCDebug(lcExec) << "preparing executor for" << count << "jobs in parallel"; m_allJobs.reserve(count); m_availableJobs.reserve(count); for (int i = 1; i <= count; i++) { m_allJobs.push_back(std::make_unique(m_logger)); const auto job = m_allJobs.back().get(); job->setMainThreadScriptEngine(m_evalContext->engine()); job->setObjectName(QStringLiteral("J%1").arg(i)); job->setDryRun(m_buildOptions.dryRun()); job->setEchoMode(m_buildOptions.echoMode()); m_availableJobs.push_back(job); connect(job, &ExecutorJob::reportCommandDescription, this, &Executor::reportCommandDescription); connect(job, &ExecutorJob::reportProcessResult, this, &Executor::reportProcessResult); connect(job, &ExecutorJob::finished, this, &Executor::onJobFinished, Qt::QueuedConnection); } } /* Returns true if children were added to the artifact, delaying the execution. */ bool Executor::rescueOldBuildData(Artifact *artifact) { bool childrenAdded = false; if (!artifact->oldDataPossiblyPresent) return childrenAdded; artifact->oldDataPossiblyPresent = false; if (artifact->artifactType != Artifact::Generated) return childrenAdded; ResolvedProduct * const product = artifact->product.get(); RescuableArtifactData rad = product->buildData->removeFromRescuableArtifactData( artifact->filePath()); if (!rad.isValid()) return childrenAdded; qCDebug(lcBuildGraph) << "Attempting to rescue data of artifact" << artifact->fileName(); std::vector childrenToConnect; bool canRescue = artifact->transformer->commands == rad.commands; if (canRescue) { ResolvedProductPtr pseudoProduct = ResolvedProduct::create(); for (const RescuableArtifactData::ChildData &cd : rad.children) { pseudoProduct->name = cd.productName; pseudoProduct->multiplexConfigurationId = cd.productMultiplexId; Artifact * const child = lookupArtifact(pseudoProduct, m_project->buildData.get(), cd.childFilePath, true); if (artifact->children.contains(child)) continue; if (!child) { // If a child has disappeared, we must re-build even if the commands // are the same. Example: Header file included in cpp file does not exist anymore. canRescue = false; qCDebug(lcBuildGraph) << "Former child artifact" << cd.childFilePath << "does not exist anymore."; const RescuableArtifactData childRad = product->buildData->removeFromRescuableArtifactData(cd.childFilePath); if (childRad.isValid()) { m_artifactsRemovedFromDisk << artifact->filePath(); removeGeneratedArtifactFromDisk(cd.childFilePath, m_logger); } } 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); } for (const QString &depPath : rad.fileDependencies) { const auto &depList = m_project->buildData->lookupFiles(depPath); if (depList.empty()) { canRescue = false; qCDebug(lcBuildGraph) << "File dependency" << depPath << "not in the project's list of dependencies anymore."; break; } const auto depFinder = [](const FileResourceBase *f) { return f->fileType() == FileResourceBase::FileTypeDependency; }; const auto depIt = std::find_if(depList.cbegin(), depList.cend(), depFinder); if (depIt == depList.cend()) { canRescue = false; qCDebug(lcBuildGraph) << "File dependency" << depPath << "not in the project's list of dependencies anymore."; break; } artifact->fileDependencies.insert(static_cast(*depIt)); } if (canRescue) { const TypeFilter childArtifacts(artifact->children); const size_t newChildCount = childrenToConnect.size() + std::distance(childArtifacts.begin(), childArtifacts.end()); QBS_CHECK(newChildCount >= rad.children.size()); if (newChildCount > rad.children.size()) { canRescue = false; qCDebug(lcBuildGraph) << "Artifact has children not present in rescue data."; } } } else { qCDebug(lcBuildGraph) << "Transformer commands changed."; } if (canRescue) { artifact->setTimestamp(rad.timeStamp); artifact->transformer->rescueFromArtifactData(std::move(rad)); childrenAdded = !childrenToConnect.empty(); for (Artifact * const child : childrenToConnect) { if (safeConnect(artifact, child)) artifact->childrenAddedByScanner << child; } qCDebug(lcBuildGraph) << "Data was rescued."; } else { removeGeneratedArtifactFromDisk(artifact, m_logger); m_artifactsRemovedFromDisk << artifact->filePath(); qCDebug(lcBuildGraph) << "Data not rescued."; } return childrenAdded; } bool Executor::checkForUnbuiltDependencies(Artifact *artifact) { bool buildingDependenciesFound = false; NodeSet unbuiltDependencies; for (BuildGraphNode * const dependency : std::as_const(artifact->children)) { switch (dependency->buildState) { case BuildGraphNode::Untouched: case BuildGraphNode::Buildable: qCDebug(lcExec).noquote() << "unbuilt dependency:" << dependency->toString(); unbuiltDependencies += dependency; break; case BuildGraphNode::Building: { qCDebug(lcExec).noquote() << "dependency in state 'Building':" << dependency->toString(); buildingDependenciesFound = true; break; } case BuildGraphNode::Built: // do nothing break; } } if (!unbuiltDependencies.empty()) { artifact->inputsScanned = false; updateLeaves(unbuiltDependencies); return true; } if (buildingDependenciesFound) { artifact->inputsScanned = false; return true; } return false; } void Executor::potentiallyRunTransformer(const TransformerPtr &transformer) { for (Artifact * const output : std::as_const(transformer->outputs)) { // Rescuing build data can introduce new dependencies, potentially delaying execution of // this transformer. const bool childrenAddedDueToRescue = rescueOldBuildData(output); if (childrenAddedDueToRescue && checkForUnbuiltDependencies(output)) return; } if (!transformerHasMatchingOutputTags(transformer)) { qCDebug(lcExec) << "file tags do not match. Skipping."; finishTransformer(transformer); return; } if (!transformerHasMatchingInputFiles(transformer)) { qCDebug(lcExec) << "input files do not match. Skipping."; finishTransformer(transformer); return; } const bool mustExecute = mustExecuteTransformer(transformer); if (mustExecute || m_buildOptions.forceTimestampCheck()) { for (Artifact * const output : std::as_const(transformer->outputs)) { // Scan all input artifacts. If new dependencies were found during scanning, delay // execution of this transformer. InputArtifactScanner scanner(output, m_inputArtifactScanContext, m_logger); AccumulatingTimer scanTimer(m_buildOptions.logElapsedTime() ? &m_elapsedTimeScanners : nullptr); scanner.scan(); scanTimer.stop(); if (scanner.newDependencyAdded() && checkForUnbuiltDependencies(output)) return; } } if (!mustExecute) { qCDebug(lcExec) << "Up to date. Skipping."; finishTransformer(transformer); return; } if (m_buildOptions.executeRulesOnly()) finishTransformer(transformer); else runTransformer(transformer); } void Executor::runTransformer(const TransformerPtr &transformer) { QBS_CHECK(transformer); // create the output directories if (!m_buildOptions.dryRun()) { for (Artifact * const output : std::as_const(transformer->outputs)) { QDir outDir = QFileInfo(output->filePath()).absoluteDir(); if (!outDir.exists() && !outDir.mkpath(StringConstants::dot())) { throw ErrorInfo(tr("Failed to create directory '%1'.") .arg(QDir::toNativeSeparators(outDir.absolutePath()))); } } } QBS_CHECK(!m_availableJobs.empty()); ExecutorJob *job = m_availableJobs.takeFirst(); for (Artifact * const artifact : std::as_const(transformer->outputs)) artifact->buildState = BuildGraphNode::Building; m_processingJobs.insert(job, transformer); updateJobCounts(transformer.get(), 1); job->run(transformer.get()); } void Executor::finishTransformer(const TransformerPtr &transformer) { transformer->markedForRerun = false; for (Artifact * const artifact : std::as_const(transformer->outputs)) { possiblyInstallArtifact(artifact); finishArtifact(artifact); } if (m_progressObserver) { const auto it = m_pendingTransformersPerRule.find(transformer->rule.get()); QBS_CHECK(it != m_pendingTransformersPerRule.cend()); if (--it->second == 0) { m_progressObserver->incrementProgressValue(); m_pendingTransformersPerRule.erase(it); } } } void Executor::possiblyInstallArtifact(const Artifact *artifact) { AccumulatingTimer installTimer(m_buildOptions.logElapsedTime() ? &m_elapsedTimeInstalling : nullptr); if (m_buildOptions.install() && !m_buildOptions.executeRulesOnly() && (m_activeFileTags.empty() || artifactHasMatchingOutputTags(artifact)) && artifact->properties->qbsPropertyValue(StringConstants::installProperty()) .toBool()) { m_productInstaller->copyFile(artifact); } } void Executor::onJobFinished(const qbs::ErrorInfo &err) { try { auto const job = qobject_cast(sender()); QBS_CHECK(job); if (m_evalContext->engine()->isActive()) { qCDebug(lcExec) << "Executor job finished while rule execution is pausing. " "Delaying slot execution."; QTimer::singleShot(0, job, [job, err] { emit job->finished(err); }); return; } if (err.hasError()) { if (m_buildOptions.keepGoing()) { ErrorInfo fullWarning(err); fullWarning.prepend(Tr::tr("Ignoring the following errors on user request:")); m_logger.printError(fullWarning); } else { if (!m_error.hasError()) m_error = err; // All but the first one could be due to canceling. } } finishJob(job, !err.hasError()); } catch (const ErrorInfo &error) { handleError(error); } } void Executor::checkForUnbuiltProducts() { if (m_buildOptions.executeRulesOnly()) return; std::vector unbuiltProducts; for (const ResolvedProductPtr &product : std::as_const(m_primaryProducts)) { bool productBuilt = true; for (BuildGraphNode *rootNode : std::as_const(product->buildData->rootNodes())) { if (rootNode->buildState != BuildGraphNode::Built) { productBuilt = false; unbuiltProducts.push_back(product); break; } } if (productBuilt) { // Any element still left after a successful build has not been re-created // by any rule and therefore does not exist anymore as an artifact. const AllRescuableArtifactData rad = product->buildData->rescuableArtifactData(); for (auto it = rad.cbegin(); it != rad.cend(); ++it) { removeGeneratedArtifactFromDisk(it.key(), m_logger); product->buildData->removeFromRescuableArtifactData(it.key()); m_artifactsRemovedFromDisk << it.key(); } } } if (unbuiltProducts.empty()) { m_logger.qbsInfo() << Tr::tr("Build done%1.").arg(configString()); } else { m_error.append(Tr::tr("The following products could not be built%1:").arg(configString())); auto productNames = transformed(unbuiltProducts, [](const auto &p) { return p->fullDisplayName(); }); std::sort(productNames.begin(), productNames.end()); m_error.append(productNames.join(QLatin1String(", "))); } } bool Executor::checkNodeProduct(BuildGraphNode *node) { if (!m_partialBuild || contains(m_buildableProducts, node->product.lock())) return true; // TODO: Turn this into a warning once we have a reliable C++ scanner. qCDebug(lcExec).noquote() << "Ignoring node " << node->toString() << ", which belongs to a " "product that is not part of the list of products to build. " "Possible reasons are an erroneous project design or a false " "positive from a dependency scanner."; finishNode(node); return false; } void Executor::finish() { QBS_ASSERT(m_state != ExecutorIdle, /* ignore */); QBS_ASSERT(!m_evalContext || !m_evalContext->engine()->isActive(), /* ignore */); checkForUnbuiltProducts(); if (m_explicitlyCanceled) { QString message = Tr::tr(m_buildOptions.executeRulesOnly() ? "Rule execution canceled" : "Build canceled"); m_error.append(Tr::tr("%1%2.").arg(message, configString())); } setState(ExecutorIdle); if (m_progressObserver) { m_progressObserver->setFinished(); m_cancelationTimer->stop(); } EmptyDirectoriesRemover(m_project.get(), m_logger) .removeEmptyParentDirectories(m_artifactsRemovedFromDisk); if (m_buildOptions.logElapsedTime()) { m_logger.qbsLog(LoggerInfo, true) << "\t" << Tr::tr("Rule execution took %1.") .arg(elapsedTimeString(m_elapsedTimeRules)); m_logger.qbsLog(LoggerInfo, true) << "\t" << Tr::tr("Artifact scanning took %1.") .arg(elapsedTimeString(m_elapsedTimeScanners)); m_logger.qbsLog(LoggerInfo, true) << "\t" << Tr::tr("Installing artifacts took %1.") .arg(elapsedTimeString(m_elapsedTimeInstalling)); } emit finished(); } void Executor::checkForCancellation() { QBS_ASSERT(m_progressObserver, return); if (m_state == ExecutorRunning && m_progressObserver->canceled()) { cancelJobs(); if (m_evalContext->engine()->isActive()) m_evalContext->engine()->cancel(); } } bool Executor::visit(Artifact *artifact) { QBS_CHECK(artifact->buildState != BuildGraphNode::Untouched); buildArtifact(artifact); return false; } bool Executor::visit(RuleNode *ruleNode) { QBS_CHECK(ruleNode->buildState != BuildGraphNode::Untouched); executeRuleNode(ruleNode); return false; } /** * Sets the state of all artifacts in the graph to "untouched". * This must be done before doing a build. * * Retrieves the timestamps of source artifacts. * * This function also fills the list of changed source files. */ void Executor::prepareAllNodes() { for (const ResolvedProductPtr &product : m_allProducts) { if (product->enabled) { QBS_CHECK(product->buildData); for (BuildGraphNode * const node : std::as_const(product->buildData->allNodes())) node->buildState = BuildGraphNode::Untouched; } } for (const ResolvedProductPtr &product : std::as_const(m_buildableProducts)) { QBS_CHECK(product->buildData); for (Artifact * const artifact : filterByType(product->buildData->allNodes())) prepareArtifact(artifact); } } void Executor::syncFileDependencies() { Set &globalFileDepList = m_project->buildData->fileDependencies; for (auto it = globalFileDepList.begin(); it != globalFileDepList.end(); ) { FileDependency * const dep = *it; FileInfo fi(dep->filePath()); if (fi.exists()) { dep->setTimestamp(fi.lastModified()); ++it; continue; } qCDebug(lcBuildGraph()) << "file dependency" << dep->filePath() << "no longer exists; " "removing from lookup table"; m_project->buildData->removeFromLookupTable(dep); bool isReferencedByArtifact = false; for (const auto &product : m_allProducts) { if (!product->buildData) continue; const auto artifactList = filterByType(product->buildData->allNodes()); isReferencedByArtifact = Internal::any_of(artifactList, [dep](const Artifact *a) { return a->fileDependencies.contains(dep); }); // TODO: Would it be safe to mark the artifact as "not up to date" here and clear // its list of file dependencies, rather than doing the check again in // isUpToDate()? if (isReferencedByArtifact) break; } if (!isReferencedByArtifact) { qCDebug(lcBuildGraph()) << "dependency is not referenced by any artifact, deleting"; it = globalFileDepList.erase(it); delete dep; } else { dep->clearTimestamp(); ++it; } } } void Executor::prepareArtifact(Artifact *artifact) { artifact->inputsScanned = false; artifact->timestampRetrieved = false; if (artifact->artifactType == Artifact::SourceFile) { retrieveSourceFileTimestamp(artifact); possiblyInstallArtifact(artifact); } } void Executor::setupForBuildingSelectedFiles(const BuildGraphNode *node) { if (node->type() != BuildGraphNode::RuleNodeType) return; if (m_buildOptions.filesToConsider().empty()) return; if (!m_productsOfFilesToConsider.contains(node->product.lock())) return; const auto ruleNode = static_cast(node); const Rule * const rule = ruleNode->rule().get(); if (rule->inputs.intersects(m_tagsOfFilesToConsider)) { FileTags otherInputs = rule->auxiliaryInputs; otherInputs.unite(rule->explicitlyDependsOn).subtract(rule->excludedInputs); m_tagsNeededForFilesToConsider.unite(otherInputs); } else if (rule->collectedOutputFileTags().intersects(m_tagsNeededForFilesToConsider)) { FileTags allInputs = rule->inputs; allInputs.unite(rule->auxiliaryInputs).unite(rule->explicitlyDependsOn) .subtract(rule->excludedInputs); m_tagsNeededForFilesToConsider.unite(allInputs); } } /** * Walk the build graph top-down from the roots and for each reachable node N * - mark N as buildable. */ void Executor::prepareReachableNodes() { for (BuildGraphNode * const root : std::as_const(m_roots)) prepareReachableNodes_impl(root); } void Executor::prepareReachableNodes_impl(BuildGraphNode *node) { setupForBuildingSelectedFiles(node); if (node->buildState != BuildGraphNode::Untouched) return; node->buildState = BuildGraphNode::Buildable; for (BuildGraphNode *child : std::as_const(node->children)) prepareReachableNodes_impl(child); } void Executor::prepareProducts() { ProductPrioritySetter prioritySetter(m_allProducts); prioritySetter.apply(); for (const ResolvedProductPtr &product : std::as_const(m_buildableProducts)) { EnvironmentScriptRunner(product.get(), m_evalContext.get(), m_project->environment) .setupForBuild(); } } void Executor::setupRootNodes() { m_roots.clear(); for (const ResolvedProductPtr &product : std::as_const(m_primaryProducts)) m_roots += product->buildData->rootNodes(); } void Executor::setState(ExecutorState s) { if (m_state == s) return; m_state = s; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/processcommandexecutor.cpp0000644000175100017510000004210515154533055025101 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** 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$ ** ****************************************************************************/ #include "processcommandexecutor.h" #include "artifact.h" #include "rulecommands.h" #include "transformer.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { ProcessCommandExecutor::ProcessCommandExecutor(const Logger &logger, QObject *parent) : AbstractCommandExecutor(logger, parent) { connect(&m_process, &QbsProcess::errorOccurred, this, &ProcessCommandExecutor::onProcessError); connect(&m_process, static_cast(&QbsProcess::finished), this, &ProcessCommandExecutor::onProcessFinished); } static QProcessEnvironment mergeEnvironments(const QProcessEnvironment &baseEnv, const QProcessEnvironment &additionalEnv) { QProcessEnvironment env = baseEnv; static const QStringList pathListVariables{ StringConstants::pathEnvVar(), QStringLiteral("LD_LIBRARY_PATH"), QStringLiteral("DYLD_LIBRARY_PATH"), QStringLiteral("DYLD_FRAMEWORK_PATH"), }; const auto keys = additionalEnv.keys(); for (const QString &key : keys) { QString newValue = additionalEnv.value(key); if (pathListVariables.contains(key, HostOsInfo::fileNameCaseSensitivity())) { const QString &oldValue = baseEnv.value(key); if (!oldValue.isEmpty()) newValue.append(HostOsInfo::pathListSeparator()).append(oldValue); } env.insert(key, newValue); } return env; } void ProcessCommandExecutor::doSetup() { ProcessCommand * const cmd = processCommand(); const QString program = ExecutableFinder(transformer()->product(), transformer()->product()->buildEnvironment) .findExecutable(cmd->program(), cmd->workingDir()); cmd->clearRelevantEnvValues(); const auto keys = cmd->relevantEnvVars(); for (const QString &key : keys) cmd->addRelevantEnvValue(key, transformer()->product()->buildEnvironment.value(key)); m_commandEnvironment = mergeEnvironments(m_buildEnvironment, cmd->environment()); m_program = program; m_arguments = cmd->arguments(); m_shellInvocation = shellQuote(QDir::toNativeSeparators(m_program), m_arguments); } bool ProcessCommandExecutor::doStart() { QBS_ASSERT(m_process.state() == QProcess::NotRunning, return false); const ProcessCommand * const cmd = processCommand(); m_process.setProcessEnvironment(m_commandEnvironment); QStringList arguments = m_arguments; if (dryRun() && !cmd->ignoreDryRun()) { QTimer::singleShot(0, this, [this] { emit finished(); }); // Don't call back on the caller. return false; } const QString workingDir = QDir::fromNativeSeparators(cmd->workingDir()); if (!workingDir.isEmpty()) { FileInfo fi(workingDir); if (!fi.exists() || !fi.isDir()) { emit finished(ErrorInfo(Tr::tr("The working directory '%1' for process '%2' " "is invalid.").arg(QDir::toNativeSeparators(workingDir), QDir::toNativeSeparators(m_program)), cmd->codeLocation())); return false; } } // Automatically use response files, if the command line gets to long. if (!cmd->responseFileUsagePrefix().isEmpty()) { const int commandLineLength = m_shellInvocation.length(); if (cmd->responseFileThreshold() >= 0 && commandLineLength > cmd->responseFileThreshold()) { qCDebug(lcExec) << QString::fromUtf8("Using response file. " "Threshold is %1. Command line length %2.") .arg(cmd->responseFileThreshold()).arg(commandLineLength); // The QTemporaryFile keeps a handle on the file, even if closed. // On Windows, some commands (e.g. msvc link.exe) won't accept that. // We need to delete the file manually, later. QTemporaryFile responseFile; responseFile.setAutoRemove(false); responseFile.setFileTemplate(QDir::tempPath() + QLatin1String("/qbsresp")); if (!responseFile.open()) { emit finished(ErrorInfo(Tr::tr("Cannot create response file '%1'.") .arg(responseFile.fileName()))); return false; } const auto separator = cmd->responseFileSeparator().toUtf8(); for (int i = cmd->responseFileArgumentIndex(); i < cmd->arguments().size(); ++i) { const QString arg = cmd->arguments().at(i); if (arg.startsWith(cmd->responseFileUsagePrefix())) { QFile f(arg.mid(cmd->responseFileUsagePrefix().size())); if (!f.open(QIODevice::ReadOnly)) { emit finished(ErrorInfo(Tr::tr("Cannot open command file '%1'.") .arg(QDir::toNativeSeparators(f.fileName())))); return false; } responseFile.write(f.readAll()); } else { responseFile.write(qbs::Internal::shellQuote(arg).toLocal8Bit()); } responseFile.write(separator); } responseFile.close(); m_responseFileName = responseFile.fileName(); arguments = arguments.mid(0, std::min(cmd->responseFileArgumentIndex(), arguments.size())); arguments += QDir::toNativeSeparators(cmd->responseFileUsagePrefix() + responseFile.fileName()); } } qCDebug(lcExec) << "Running external process; full command line is:" << m_shellInvocation; const QProcessEnvironment &additionalVariables = cmd->environment(); qCDebug(lcExec) << "Additional environment:" << additionalVariables.toStringList(); m_process.setWorkingDirectory(workingDir); m_process.start(m_program, arguments); return true; } void ProcessCommandExecutor::cancel(const qbs::ErrorInfo &reason) { // We don't want this command to be reported as failing, since we explicitly terminated it. disconnect(this, &ProcessCommandExecutor::reportProcessResult, nullptr, nullptr); m_cancelReason = reason; m_process.cancel(); } QString ProcessCommandExecutor::filterProcessOutput(const QByteArray &_output, const QString &filterFunctionSource) { QString output = !_output.isNull() ? QString::fromLocal8Bit(_output) : QStringLiteral(""); if (filterFunctionSource.isEmpty()) return output; JSContext * const ctx = scriptEngine()->context(); const ScopedJsValue scope(ctx, JS_NewObjectProto(ctx, scriptEngine()->globalObject())); for (auto it = command()->properties().constBegin(); it != command()->properties().constEnd(); ++it) { setJsProperty(ctx, scope, it.key(), scriptEngine()->toScriptValue(it.value())); } TemporaryGlobalObjectSetter tgos(scriptEngine(), scope); const ScopedJsValue filterFunction( ctx, scriptEngine()->evaluate(JsValueOwner::Caller, QLatin1String("var f = ") + filterFunctionSource + QLatin1String("; f"))); if (!JS_IsFunction(scriptEngine()->context(), filterFunction)) { logger().printError(ErrorInfo( Tr::tr("Error in filter function: %1.\n%2") .arg( filterFunctionSource, getJsString(scriptEngine()->context(), filterFunction)))); return output; } const ScopedJsValue outputArg(ctx, scriptEngine()->toScriptValue(output)); JSValue outputArgForCall = outputArg; const ScopedJsValue filteredOutput( ctx, JS_Call(ctx, filterFunction, JS_UNDEFINED, 1, &outputArgForCall)); if (scriptEngine()->checkForJsError({})) { ErrorInfo err = scriptEngine()->getAndClearJsError(); err.prepend(Tr::tr("Error when calling output filter function")); logger().printError(err); return output; } return getJsString(ctx, filteredOutput); } static QProcess::ProcessError saveToFile(const QString &filePath, const QByteArray &content) { QBS_ASSERT(!filePath.isEmpty(), return QProcess::WriteError); QFile f(filePath); if (!f.open(QIODevice::WriteOnly)) return QProcess::WriteError; if (f.write(content) != content.size()) return QProcess::WriteError; f.close(); return f.error() == QFileDevice::NoError ? QProcess::UnknownError : QProcess::WriteError; } void ProcessCommandExecutor::getProcessOutput(bool stdOut, ProcessResult &result) { QByteArray content; QString filterFunction; QString redirectPath; QStringList *target; if (stdOut) { content = m_process.readAllStandardOutput(); filterFunction = processCommand()->stdoutFilterFunction(); redirectPath = processCommand()->stdoutFilePath(); target = &result.d->stdOut; } else { content = m_process.readAllStandardError(); filterFunction = processCommand()->stderrFilterFunction(); redirectPath = processCommand()->stderrFilePath(); target = &result.d->stdErr; } QString contentString = filterProcessOutput(content, filterFunction); if (!redirectPath.isEmpty()) { const QByteArray dataToWrite = filterFunction.isEmpty() ? content : contentString.toLocal8Bit(); const QProcess::ProcessError error = saveToFile(redirectPath, dataToWrite); if (result.error() == QProcess::UnknownError && error != QProcess::UnknownError) result.d->error = error; } else { if (!contentString.isEmpty() && contentString.endsWith(QLatin1Char('\n'))) contentString.chop(1); *target = contentString.split(QLatin1Char('\n'), Qt::SkipEmptyParts); } } void ProcessCommandExecutor::sendProcessOutput() { ProcessResult result; result.d->executableFilePath = m_program; result.d->arguments = m_arguments; result.d->workingDirectory = m_process.workingDirectory(); if (result.workingDirectory().isEmpty()) result.d->workingDirectory = QDir::currentPath(); result.d->exitCode = m_process.exitCode(); result.d->error = m_process.error(); QString errorString = m_process.errorString(); getProcessOutput(true, result); getProcessOutput(false, result); const bool processError = result.error() != QProcess::UnknownError; const bool failureExit = quint32(m_process.exitCode()) > quint32(processCommand()->maxExitCode()); const bool cancelledWithError = m_cancelReason.hasError(); result.d->success = !processError && !failureExit && !cancelledWithError; emit reportProcessResult(result); if (Q_UNLIKELY(cancelledWithError)) { emit finished(m_cancelReason); } else if (Q_UNLIKELY(processError)) { emit finished(ErrorInfo(errorString)); } else if (Q_UNLIKELY(failureExit)) { emit finished(ErrorInfo(Tr::tr("Process failed with exit code %1.") .arg(m_process.exitCode()))); } else { emit finished(); } } void ProcessCommandExecutor::onProcessError() { if (scriptEngine()->isActive()) { qCDebug(lcExec) << "Command error while rule execution is pausing. " "Delaying slot execution."; QTimer::singleShot(0, this, &ProcessCommandExecutor::onProcessError); return; } if (m_cancelReason.hasError()) return; // Ignore. Cancel reasons will be handled by on ProcessFinished(). switch (m_process.error()) { case QProcess::FailedToStart: { removeResponseFile(); const QString binary = QDir::toNativeSeparators(processCommand()->program()); QString errorPrefixString; #ifdef Q_OS_UNIX if (QFileInfo(binary).isExecutable()) { const QString interpreter(shellInterpreter(binary)); if (!interpreter.isEmpty()) { errorPrefixString = Tr::tr("%1: bad interpreter: ").arg(interpreter); } } #endif emit finished(ErrorInfo(Tr::tr("The process '%1' could not be started: %2. " "The full command line invocation was: %3") .arg(binary, errorPrefixString + m_process.errorString(), m_shellInvocation))); break; } case QProcess::Crashed: break; // Ignore. Will be handled by onProcessFinished(). default: logger().qbsWarning() << "QProcess error: " << m_process.errorString(); } } void ProcessCommandExecutor::onProcessFinished() { if (scriptEngine()->isActive()) { qCDebug(lcExec) << "Command finished while rule execution is pausing. " "Delaying slot execution."; QTimer::singleShot(0, this, &ProcessCommandExecutor::onProcessFinished); return; } removeResponseFile(); sendProcessOutput(); } static QString environmentVariableString(const QString &key, const QString &value) { QString str; if (HostOsInfo::isWindowsHost()) str += QStringLiteral("set "); str += shellQuote(key + QLatin1Char('=') + value); if (HostOsInfo::isWindowsHost()) str += QLatin1Char('\n'); else str += QLatin1Char(' '); return str; } void ProcessCommandExecutor::doReportCommandDescription(const QString &productName) { if (m_echoMode == CommandEchoModeCommandLine || m_echoMode == CommandEchoModeCommandLineWithEnvironment) { QString fullInvocation; if (m_echoMode == CommandEchoModeCommandLineWithEnvironment) { QStringList keys = m_commandEnvironment.keys(); keys.sort(); for (const QString &key : std::as_const(keys)) fullInvocation += environmentVariableString(key, m_commandEnvironment.value(key)); } fullInvocation += m_shellInvocation; emit reportCommandDescription(command()->highlight(), !command()->extendedDescription().isEmpty() ? command()->extendedDescription() : fullInvocation); return; } AbstractCommandExecutor::doReportCommandDescription(productName); } void ProcessCommandExecutor::removeResponseFile() { if (m_responseFileName.isEmpty()) return; QFile::remove(m_responseFileName); m_responseFileName.clear(); } ProcessCommand *ProcessCommandExecutor::processCommand() const { return static_cast(command()); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/rawscanneddependency.h0000644000175100017510000000576215154533055024146 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_RAWSCANNEDDEPENDENCY_H #define QBS_RAWSCANNEDDEPENDENCY_H #include #include namespace qbs { namespace Internal { class PersistentPool; class RawScannedDependency { public: RawScannedDependency(); RawScannedDependency(const QString &filePath); QString filePath() const; const QString &dirPath() const { return m_dirPath; } const QString &fileName() const { return m_fileName; } bool isClean() const { return m_isClean; } bool isValid() const { return !m_fileName.isEmpty(); } void load(PersistentPool &pool); void store(PersistentPool &pool); private: void setClean(); template void serializationOp(PersistentPool &pool) { pool.serializationOp(m_dirPath, m_fileName); } QString m_dirPath; QString m_fileName; bool m_isClean = 0; }; bool operator==(const RawScannedDependency &d1, const RawScannedDependency &d2); inline bool operator!=(const RawScannedDependency &d1, const RawScannedDependency &d2) { return !(d1 == d2); } } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/buildgraph/timestampsupdater.h0000644000175100017510000000443015154533055023524 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 TIMESTAMPSUPDATER_H #define TIMESTAMPSUPDATER_H #include #include namespace qbs { namespace Internal { class Logger; class TimestampsUpdater { public: void updateTimestamps(const TopLevelProjectPtr &project, const QVector &products, const Logger &logger); }; } // namespace Internal } // namespace qbs #endif // TIMESTAMPSUPDATER_H qbs-src-3.2.0/src/lib/corelib/buildgraph/filedependency.h0000644000175100017510000000623515154533055022734 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_FILEDEPENDENCY_H #define QBS_FILEDEPENDENCY_H #include #include namespace qbs { namespace Internal { class FileResourceBase { protected: FileResourceBase(); public: virtual ~FileResourceBase(); enum FileType { FileTypeDependency, FileTypeArtifact }; virtual FileType fileType() const = 0; void setTimestamp(const FileTime &t); const FileTime ×tamp() const; void clearTimestamp() { m_timestamp.clear(); } void setFilePath(const QString &filePath); const QString &filePath() const; QString dirPath() const { return m_dirPath.toString(); } QString fileName() const { return m_fileName.toString(); } virtual void load(PersistentPool &pool); virtual void store(PersistentPool &pool); private: template void serializationOp(PersistentPool &pool) { pool.serializationOp(m_filePath, m_timestamp); } FileTime m_timestamp; QString m_filePath; QStringView m_dirPath; QStringView m_fileName; }; class FileDependency : public FileResourceBase { public: FileDependency(); ~FileDependency() override; FileType fileType() const override { return FileTypeDependency; } }; } // namespace Internal } // namespace qbs #endif // QBS_FILEDEPENDENCY_H qbs-src-3.2.0/src/lib/corelib/buildgraph/jscommandexecutor.h0000644000175100017510000000561715154533055023513 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** 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_JSCOMMANDEXECUTOR_H #define QBS_JSCOMMANDEXECUTOR_H #include "abstractcommandexecutor.h" #include namespace qbs { class CodeLocation; namespace Internal { class JavaScriptCommand; class JsCommandExecutorThreadObject; class JsCommandExecutor : public AbstractCommandExecutor { Q_OBJECT public: explicit JsCommandExecutor(const Logger &logger, QObject *parent = nullptr); ~JsCommandExecutor() override; signals: void startRequested(const JavaScriptCommand *cmd, Transformer *transformer); private: void onJavaScriptCommandFinished(); void doReportCommandDescription(const QString &productName) override; bool doStart() override; void cancel(const qbs::ErrorInfo &reason) override; void waitForFinished(); const JavaScriptCommand *jsCommand() const; QThread *m_thread; JsCommandExecutorThreadObject *m_objectInThread; bool m_running; }; } // namespace Internal } // namespace qbs #endif // QBS_JSCOMMANDEXECUTOR_H qbs-src-3.2.0/src/lib/corelib/buildgraph/abstractcommandexecutor.cpp0000644000175100017510000000766215154533055025237 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** 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$ ** ****************************************************************************/ #include "abstractcommandexecutor.h" #include "rulecommands.h" #include "transformer.h" #include #include #include namespace qbs { namespace Internal { AbstractCommandExecutor::AbstractCommandExecutor(Logger logger, QObject *parent) : QObject(parent) , m_echoMode(defaultCommandEchoMode()) , m_command(nullptr) , m_transformer(nullptr) , m_mainThreadScriptEngine(nullptr) , m_dryRun(false) , m_logger(std::move(logger)) { m_watchdog.setSingleShot(true); connect(&m_watchdog, &QTimer::timeout, this, [this]() { cancel(ErrorInfo{Tr::tr("Command cancelled because it exceeded the timeout: %1") .arg(m_command->descriptionForCancelMessage( m_transformer->product()->fullDisplayName()))}); }); connect(this, &AbstractCommandExecutor::finished, &m_watchdog, &QTimer::stop); } void AbstractCommandExecutor::start(Transformer *transformer, AbstractCommand *cmd) { m_transformer = transformer; m_command = cmd; doSetup(); doReportCommandDescription(transformer->product()->fullDisplayName()); if (doStart()) startTimeout(); } void AbstractCommandExecutor::doReportCommandDescription(const QString &productName) { if (m_command->isSilent() || m_echoMode == CommandEchoModeSilent) return; if (m_command->description().isEmpty()) { m_logger.printWarning( ErrorInfo(Tr::tr("Command is not marked silent, but has no description."), m_command->codeLocation())); } else { emit reportCommandDescription(m_command->highlight(), m_command->fullDescription(productName)); } } void AbstractCommandExecutor::startTimeout() { if (!m_dryRun || m_command->ignoreDryRun()) { const auto timeout = m_command->timeout(); if (timeout > 0) m_watchdog.start(timeout * 1000); } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/jscommandexecutor.cpp0000644000175100017510000002436515154533055024047 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** 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$ ** ****************************************************************************/ #include "jscommandexecutor.h" #include "buildgraph.h" #include "rulecommands.h" #include "transformer.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { struct JavaScriptCommandResult { bool success = false; QString errorMessage; CodeLocation errorLocation; }; class JsCommandExecutorThreadObject : public QObject { Q_OBJECT public: JsCommandExecutorThreadObject(Logger logger) : m_logger(std::move(logger)) , m_scriptEngine(nullptr) { } const JavaScriptCommandResult &result() const { return m_result; } void cancel(const qbs::ErrorInfo &reason) { QMutexLocker locker(&m_resultMutex); m_result.success = !reason.hasError(); m_result.errorMessage = reason.toString(); if (m_scriptEngine) m_scriptEngine->cancel(); m_cancelled = true; } signals: void finished(); public: void start(const JavaScriptCommand *cmd, Transformer *transformer) { if (m_cancelled) { emit finished(); return; } m_running = true; try { doStart(cmd, transformer); } catch (const qbs::ErrorInfo &error) { setError(error.toString(), cmd->codeLocation()); } m_running = false; emit finished(); } private: void doStart(const JavaScriptCommand *cmd, Transformer *transformer) { m_result.success = true; m_result.errorMessage.clear(); ScriptEngine * const scriptEngine = provideScriptEngine(); JSContext * const ctx = scriptEngine->context(); const ScopedJsValue scope(ctx, JS_NewObject(scriptEngine->context())); setupScriptEngineForFile(scriptEngine, transformer->rule->prepareScript.fileContext(), scope, ObserveMode::Enabled); ScopedJsValue importScopeForSourceCode(ctx, JS_UNDEFINED); if (!cmd->scopeName().isEmpty()) importScopeForSourceCode.setValue(getJsProperty(ctx, scope, cmd->scopeName())); setupScriptEngineForProduct(scriptEngine, transformer->product().get(), transformer->rule->module.get(), scope, true); transformer->setupInputs(scriptEngine, scope); transformer->setupOutputs(scriptEngine, scope); transformer->setupExplicitlyDependsOn(scriptEngine, scope); for (auto it = cmd->properties().constBegin(); it != cmd->properties().constEnd(); ++it) setJsProperty(ctx, scope, it.key(), scriptEngine->toScriptValue(it.value())); const TemporaryGlobalObjectSetter gos(scriptEngine, scope); JSValueList scopeChain; if (JS_IsObject(importScopeForSourceCode)) scopeChain << importScopeForSourceCode; const ScopedJsValue res(ctx, scriptEngine->evaluate(JsValueOwner::Caller, cmd->sourceCode(), {}, 1, scopeChain)); transformer->propertiesRequestedInCommands += scriptEngine->propertiesRequestedInScript(); unite(transformer->propertiesRequestedFromArtifactInCommands, scriptEngine->propertiesRequestedFromArtifact()); const std::vector &importFilesUsedInCommand = scriptEngine->importedFilesUsedInScript(); transformer->importedFilesUsedInCommands.insert( transformer->importedFilesUsedInCommands.cend(), importFilesUsedInCommand.cbegin(), importFilesUsedInCommand.cend()); transformer->depsRequestedInCommands.add(scriptEngine->productsWithRequestedDependencies()); transformer->artifactsMapRequestedInCommands.unite(scriptEngine->requestedArtifacts()); for (const ResolvedProduct * const p : scriptEngine->requestedExports()) { transformer->exportedModulesAccessedInCommands.insert( std::make_pair(p->uniqueName(), p->exportedModule)); } scriptEngine->clearRequestedProperties(); if (scriptEngine->checkForJsError(cmd->codeLocation())) { // ### We don't know the line number of the command's sourceCode property assignment. const ErrorInfo e = scriptEngine->getAndClearJsError(); setError(e.toString(), cmd->codeLocation()); } } void setError(const QString &errorMessage, const CodeLocation &codeLocation) { QMutexLocker locker(&m_resultMutex); if (m_cancelled) return; m_result.success = false; m_result.errorMessage = errorMessage; m_result.errorLocation = codeLocation; } ScriptEngine *provideScriptEngine() { if (!m_scriptEngine) m_scriptEngine = ScriptEngine::create(m_logger, EvalContext::JsCommand); else m_scriptEngine->reset(); return m_scriptEngine.get(); } Logger m_logger; std::unique_ptr m_scriptEngine; JavaScriptCommandResult m_result; QMutex m_resultMutex; bool m_running = false; bool m_cancelled = false; }; JsCommandExecutor::JsCommandExecutor(const Logger &logger, QObject *parent) : AbstractCommandExecutor(logger, parent) , m_thread(new QThread(this)) , m_objectInThread(new JsCommandExecutorThreadObject(logger)) , m_running(false) { qRegisterMetaType("Transformer *"); qRegisterMetaType("const JavaScriptCommand *"); m_objectInThread->moveToThread(m_thread); connect(m_objectInThread, &JsCommandExecutorThreadObject::finished, this, &JsCommandExecutor::onJavaScriptCommandFinished); connect(this, &JsCommandExecutor::startRequested, m_objectInThread, &JsCommandExecutorThreadObject::start); } JsCommandExecutor::~JsCommandExecutor() { waitForFinished(); m_thread->quit(); m_thread->wait(); delete m_objectInThread; } void JsCommandExecutor::doReportCommandDescription(const QString &productName) { if ((m_echoMode == CommandEchoModeCommandLine || m_echoMode == CommandEchoModeCommandLineWithEnvironment) && !command()->extendedDescription().isEmpty()) { emit reportCommandDescription(command()->highlight(), command()->extendedDescription()); return; } AbstractCommandExecutor::doReportCommandDescription(productName); } void JsCommandExecutor::waitForFinished() { if (!m_running) return; QEventLoop loop; connect(this, &AbstractCommandExecutor::finished, &loop, &QEventLoop::quit); loop.exec(); } bool JsCommandExecutor::doStart() { QBS_ASSERT(!m_running, return false); if (dryRun() && !command()->ignoreDryRun()) { QTimer::singleShot(0, this, [this] { emit finished(); }); // Don't call back on the caller. return false; } m_thread->start(); m_running = true; emit startRequested(jsCommand(), transformer()); return true; } void JsCommandExecutor::cancel(const qbs::ErrorInfo &reason) { if (m_running && (!dryRun() || command()->ignoreDryRun()) && m_objectInThread) m_objectInThread->cancel(reason); } void JsCommandExecutor::onJavaScriptCommandFinished() { m_running = false; const JavaScriptCommandResult &result = m_objectInThread->result(); ErrorInfo err; if (!result.success) { logger().qbsDebug() << "JS context:\n" << jsCommand()->properties(); logger().qbsDebug() << "JS code:\n" << jsCommand()->sourceCode(); err.append(result.errorMessage); // ### We don't know the line number of the command's sourceCode property assignment. err.appendBacktrace(QStringLiteral("JavaScriptCommand.sourceCode")); err.appendBacktrace(QStringLiteral("Rule.prepare"), result.errorLocation); } emit finished(err); } const JavaScriptCommand *JsCommandExecutor::jsCommand() const { return static_cast(command()); } } // namespace Internal } // namespace qbs #include "jscommandexecutor.moc" qbs-src-3.2.0/src/lib/corelib/buildgraph/depscanner.h0000644000175100017510000001111615154533055022072 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_DEPENDENCY_SCANNER_H #define QBS_DEPENDENCY_SCANNER_H #include #include #include #include #include #include class ScannerPlugin; namespace qbs { namespace Internal { class Artifact; class FileResourceBase; class Logger; class ScriptEngine; class DependencyScanner { public: virtual ~DependencyScanner() = default; QString id() const; virtual QStringList collectSearchPaths(Artifact *artifact) = 0; virtual QStringList collectDependencies(Artifact *artifact, FileResourceBase *file, const char *fileTags) = 0; virtual bool recursive() const = 0; virtual bool areModulePropertiesCompatible(const PropertyMapConstPtr &m1, const PropertyMapConstPtr &m2) const = 0; virtual bool cacheIsPerFile() const = 0; private: virtual QString createId() const = 0; mutable QString m_id; }; class PluginDependencyScanner : public DependencyScanner { public: PluginDependencyScanner(ScannerPlugin *plugin); private: QStringList collectModulesPaths(const ResolvedProduct *product); QStringList collectSearchPaths(Artifact *artifact) override; QStringList collectDependencies(Artifact *artifact, FileResourceBase *file, const char *fileTags) override; bool recursive() const override; QString createId() const override; bool areModulePropertiesCompatible(const PropertyMapConstPtr &m1, const PropertyMapConstPtr &m2) const override; bool cacheIsPerFile() const override { return false; } ScannerPlugin* m_plugin; }; class UserDependencyScanner : public DependencyScanner { public: UserDependencyScanner(ResolvedScannerConstPtr scanner, ScriptEngine *engine); private: QStringList collectSearchPaths(Artifact *artifact) override; QStringList collectDependencies(Artifact *artifact, FileResourceBase *file, const char *fileTags) override; bool recursive() const override; QString createId() const override; bool areModulePropertiesCompatible(const PropertyMapConstPtr &m1, const PropertyMapConstPtr &m2) const override; bool cacheIsPerFile() const override { return true; } QStringList evaluate(Artifact *artifact, const FileResourceBase *fileToScan, const PrivateScriptFunction &script); ResolvedScannerConstPtr m_scanner; ScriptEngine *m_engine; ScopedJsValue m_global; ResolvedProduct *m_product; }; } // namespace Internal } // namespace qbs #endif // QBS_DEPENDENCY_SCANNER_H qbs-src-3.2.0/src/lib/corelib/buildgraph/transformerchangetracking.cpp0000644000175100017510000003603415154533055025544 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2018 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 "transformerchangetracking.h" #include "projectbuilddata.h" #include "requesteddependencies.h" #include "rulecommands.h" #include "transformer.h" #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class TrafoChangeTracker { public: TrafoChangeTracker(const Transformer *transformer, const ResolvedProduct *product, const std::unordered_map &productsByName, const std::unordered_map &projectsByName) : m_transformer(transformer), m_product(product), m_productsByName(productsByName), m_projectsByName(projectsByName) { } bool prepareScriptNeedsRerun() const; bool commandsNeedRerun() const; private: QVariantMap propertyMapByKind(const Property &property) const; bool checkForPropertyChange(const Property &restoredProperty, const QVariantMap &newProperties) const; bool checkForImportFileChange(const std::vector &importedFiles, const FileTime &referenceTime, const char *context) const; bool isExportedModuleUpToDate(const QString &productName, const ExportedModule &module) const; bool areExportedModulesUpToDate( const std::unordered_map &exportedModules) const; const Artifact *getArtifact(const QString &filePath, const QString &productName) const; const ResolvedProduct *getProduct(const QString &name) const; const Transformer * const m_transformer; const ResolvedProduct * const m_product; const std::unordered_map &m_productsByName; const std::unordered_map &m_projectsByName; mutable const ResolvedProduct * m_lastProduct = nullptr; mutable const Artifact *m_lastArtifact = nullptr; }; template static QVariantMap getParameterValue( const QHash ¶meters, const QString &depName) { for (auto it = parameters.cbegin(); it != parameters.cend(); ++it) { if (it.key()->name == depName) return it.value(); } return {}; } QVariantMap TrafoChangeTracker::propertyMapByKind(const Property &property) const { switch (property.kind) { case Property::PropertyInModule: { const ResolvedProduct * const p = getProduct(property.productName); return p ? p->moduleProperties->value() : QVariantMap(); } case Property::PropertyInProduct: { const ResolvedProduct * const p = getProduct(property.productName); return p ? p->productProperties : QVariantMap(); } case Property::PropertyInProject: { if (property.productName == m_product->project->name) return m_product->project->projectProperties(); const auto it = m_projectsByName.find(property.productName); if (it != m_projectsByName.cend()) return it->second->projectProperties(); return {}; } case Property::PropertyInParameters: { const int sepIndex = property.moduleName.indexOf(QLatin1Char(':')); const QString depName = property.moduleName.left(sepIndex); const ResolvedProduct * const p = getProduct(property.productName); if (!p) return {}; QVariantMap v = getParameterValue(p->dependencyParameters, depName); if (!v.empty()) return v; return getParameterValue(p->moduleParameters, depName); } case Property::PropertyInArtifact: default: QBS_CHECK(false); } return {}; } bool TrafoChangeTracker::checkForPropertyChange(const Property &restoredProperty, const QVariantMap &newProperties) const { QVariant v; switch (restoredProperty.kind) { case Property::PropertyInProduct: case Property::PropertyInProject: v = newProperties.value(restoredProperty.propertyName); break; case Property::PropertyInModule: v = moduleProperty(newProperties, restoredProperty.moduleName, restoredProperty.propertyName); break; case Property::PropertyInParameters: { const int sepIndex = restoredProperty.moduleName.indexOf(QLatin1Char(':')); QualifiedId moduleName = QualifiedId::fromString(restoredProperty.moduleName.mid(sepIndex + 1)); QVariantMap map = newProperties; while (!moduleName.empty()) map = map.value(moduleName.takeFirst()).toMap(); v = map.value(restoredProperty.propertyName); break; } case Property::PropertyInArtifact: QBS_CHECK(false); } if (!qVariantsEqual(restoredProperty.value, v)) { qCDebug(lcBuildGraph).noquote().nospace() << "Value for property '" << restoredProperty.moduleName << "." << restoredProperty.propertyName << "' has changed.\n" << "Old value was '" << restoredProperty.value << "'.\n" << "New value is '" << v << "'."; return true; } return false; } bool TrafoChangeTracker::checkForImportFileChange(const std::vector &importedFiles, const FileTime &referenceTime, const char *context) const { for (const QString &importedFile : importedFiles) { const FileInfo fi(importedFile); if (!fi.exists()) { qCDebug(lcBuildGraph) << context << "imported file" << importedFile << "is gone, need to re-run"; return true; } if (fi.lastModified() > referenceTime) { qCDebug(lcBuildGraph) << context << "imported file" << importedFile << "has been updated, need to re-run" << fi.lastModified() << referenceTime; return true; } } return false; } bool TrafoChangeTracker::isExportedModuleUpToDate(const QString &productName, const ExportedModule &module) const { const ResolvedProduct * const product = getProduct(productName); if (!product) { qCDebug(lcBuildGraph) << "product" << productName << "does not exist anymore, need to re-run"; return false; } if (product->exportedModule != module) { qCDebug(lcBuildGraph) << "exported module has changed for product" << productName << ", need to re-run"; return false; } return true; } bool TrafoChangeTracker::areExportedModulesUpToDate( const std::unordered_map &exportedModules) const { return Internal::all_of(exportedModules, [this](const auto &kv) { return isExportedModuleUpToDate(kv.first, kv.second); }); } const Artifact *TrafoChangeTracker::getArtifact(const QString &filePath, const QString &productName) const { if (m_lastArtifact && m_lastArtifact->filePath() == filePath && m_lastArtifact->product.get()->uniqueName() == productName) { return m_lastArtifact; } const ResolvedProduct * const product = getProduct(productName); if (!product) return nullptr; const auto &candidates = product->topLevelProject()->buildData->lookupFiles(filePath); const Artifact *artifact = nullptr; for (const FileResourceBase * const candidate : candidates) { if (candidate->fileType() == FileResourceBase::FileTypeArtifact) { auto const a = static_cast(candidate); if (a->product.get() == product) { m_lastArtifact = artifact = a; break; } } } return artifact; } const ResolvedProduct *TrafoChangeTracker::getProduct(const QString &name) const { if (m_lastProduct && name == m_lastProduct->uniqueName()) return m_lastProduct; if (name == m_product->uniqueName()) { m_lastProduct = m_product; return m_product; } const auto it = m_productsByName.find(name); if (it != m_productsByName.cend()) { m_lastProduct = it->second; return it->second; } return nullptr; } bool TrafoChangeTracker::prepareScriptNeedsRerun() const { for (const Property &property : std::as_const(m_transformer->propertiesRequestedInPrepareScript)) { if (checkForPropertyChange(property, propertyMapByKind(property))) return true; } if (checkForImportFileChange(m_transformer->importedFilesUsedInPrepareScript, m_transformer->lastPrepareScriptExecutionTime, "prepare script")) { return true; } for (auto it = m_transformer->propertiesRequestedFromArtifactInPrepareScript.constBegin(); it != m_transformer->propertiesRequestedFromArtifactInPrepareScript.constEnd(); ++it) { for (const Property &property : std::as_const(it.value())) { const Artifact * const artifact = getArtifact(it.key(), property.productName); if (!artifact) return true; if (property.kind == Property::PropertyInArtifact) { if (sorted(artifact->fileTags().toStringList()) != property.value.toStringList()) return true; continue; } if (checkForPropertyChange(property, artifact->properties->value())) return true; } } if (!m_transformer->depsRequestedInPrepareScript.isUpToDate(m_product->topLevelProject())) return true; if (!m_transformer->artifactsMapRequestedInPrepareScript.isUpToDate( m_product->topLevelProject())) { return true; } if (!areExportedModulesUpToDate(m_transformer->exportedModulesAccessedInPrepareScript)) return true; return false; } bool TrafoChangeTracker::commandsNeedRerun() const { for (const Property &property : std::as_const(m_transformer->propertiesRequestedInCommands)) { if (checkForPropertyChange(property, propertyMapByKind(property))) return true; } for (auto it = m_transformer->propertiesRequestedFromArtifactInCommands.cbegin(); it != m_transformer->propertiesRequestedFromArtifactInCommands.cend(); ++it) { for (const Property &property : std::as_const(it.value())) { const Artifact * const artifact = getArtifact(it.key(), property.productName); if (!artifact) return true; if (property.kind == Property::PropertyInArtifact) { if (sorted(artifact->fileTags().toStringList()) != property.value.toStringList()) return true; continue; } if (checkForPropertyChange(property, artifact->properties->value())) return true; } } if (checkForImportFileChange(m_transformer->importedFilesUsedInCommands, m_transformer->lastCommandExecutionTime, "command")) { return true; } if (!m_transformer->depsRequestedInCommands.isUpToDate(m_product->topLevelProject())) return true; if (!m_transformer->artifactsMapRequestedInCommands.isUpToDate(m_product->topLevelProject())) return true; if (!areExportedModulesUpToDate(m_transformer->exportedModulesAccessedInCommands)) return true; // TODO: Also track env access in JS commands and prepare scripts for (const AbstractCommandPtr &c : std::as_const(m_transformer->commands.commands())) { if (c->type() != AbstractCommand::ProcessCommandType) continue; const ProcessCommandPtr &processCmd = std::static_pointer_cast(c); const auto envVars = processCmd->relevantEnvVars(); for (const QString &var : envVars) { const QString &oldValue = processCmd->relevantEnvValue(var); const QString &newValue = m_product->buildEnvironment.value(var); if (oldValue != newValue) { qCDebug(lcBuildGraph) << "need to re-run command: value of environment variable" << var << "changed from" << oldValue << "to" << newValue << "for command" << processCmd->program() << "in rule" << m_transformer->rule->toString(); return true; } } } return false; } bool prepareScriptNeedsRerun( Transformer *transformer, const ResolvedProduct *product, const std::unordered_map &productsByName, const std::unordered_map &projectsByName) { if (!transformer->prepareScriptNeedsChangeTracking) return false; transformer->prepareScriptNeedsChangeTracking = false; return TrafoChangeTracker(transformer, product, productsByName, projectsByName) .prepareScriptNeedsRerun(); } bool commandsNeedRerun(Transformer *transformer, const ResolvedProduct *product, const std::unordered_map &productsByName, const std::unordered_map &projectsByName) { if (!transformer->commandsNeedChangeTracking) return false; transformer->commandsNeedChangeTracking = false; return TrafoChangeTracker(transformer, product, productsByName, projectsByName) .commandsNeedRerun(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/inputartifactscanner.cpp0000644000175100017510000004206315154533055024537 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "inputartifactscanner.h" #include "artifact.h" #include "buildgraph.h" #include "productbuilddata.h" #include "projectbuilddata.h" #include "transformer.h" #include "depscanner.h" #include "rulesevaluationcontext.h" #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { static void resolveDepencency(const RawScannedDependency &dependency, const ResolvedProduct *product, ResolvedDependency *result, const QString &baseDir = QString()) { QString absDirPath = baseDir.isEmpty() ? dependency.dirPath() : dependency.dirPath().isEmpty() ? baseDir : FileInfo::resolvePath(baseDir, dependency.dirPath()); if (!dependency.isClean()) absDirPath = QDir::cleanPath(absDirPath); ResolvedProject *project = product->project.get(); FileDependency *fileDependencyArtifact = nullptr; Artifact *dependencyInProduct = nullptr; Artifact *dependencyInOtherProduct = nullptr; bool productOfDependencyIsDependency = false; const auto files = project->topLevelProject() ->buildData->lookupFiles(absDirPath, dependency.fileName()); for (FileResourceBase *lookupResult : files) { switch (lookupResult->fileType()) { case FileResourceBase::FileTypeDependency: fileDependencyArtifact = static_cast(lookupResult); break; case FileResourceBase::FileTypeArtifact: { auto const foundArtifact = static_cast(lookupResult); if (foundArtifact->product == product) { dependencyInProduct = foundArtifact; } else if (!productOfDependencyIsDependency) { dependencyInOtherProduct = foundArtifact; productOfDependencyIsDependency = product->hasDependency( dependencyInOtherProduct->product.lock()); } break; } } if (dependencyInProduct) break; } // prioritize found artifacts if (dependencyInProduct) result->file = dependencyInProduct; else if (dependencyInOtherProduct) result->file = dependencyInOtherProduct; else result->file = fileDependencyArtifact; if (result->file) { result->filePath = result->file->filePath(); if (result->file == dependencyInOtherProduct && !productOfDependencyIsDependency) { qCDebug(lcDepScan) << "product" << dependencyInOtherProduct->product->fullDisplayName() << "of scanned dependency" << result->filePath << "is not a dependency of product" << product->fullDisplayName() << ". The file dependency might get lost during change tracking."; } return; } const QString &absFilePath = baseDir.isEmpty() ? dependency.filePath() : absDirPath + QLatin1Char('/') + dependency.fileName(); // TODO: We probably need a flag that tells us whether directories are allowed. const FileInfo fi(absFilePath); if (fi.exists(absFilePath) && !fi.isDir()) result->filePath = absFilePath; } InputArtifactScanner::InputArtifactScanner(Artifact *artifact, InputArtifactScannerContext *ctx, Logger logger) : m_artifact(artifact), m_rawScanResults(artifact->product->topLevelProject()->buildData->rawScanResults), m_context(ctx), m_newDependencyAdded(false), m_logger(std::move(logger)) { } void InputArtifactScanner::scan() { if (m_artifact->inputsScanned) return; qCDebug(lcDepScan) << "scan inputs for" << m_artifact->filePath() << m_artifact->fileTags() << "in product" << m_artifact->product->name; m_artifact->inputsScanned = true; // clear file dependencies; they will be regenerated m_artifact->fileDependencies.clear(); // Remove all connections to children that were added by the dependency scanner. // They will be regenerated. const Set childrenAddedByScanner = m_artifact->childrenAddedByScanner; m_artifact->childrenAddedByScanner.clear(); for (Artifact * const dependency : childrenAddedByScanner) disconnect(m_artifact, dependency); for (Artifact * const inputArtifact : std::as_const(m_artifact->transformer->inputs)) scanForFileDependencies(inputArtifact); } void InputArtifactScanner::scanForFileDependencies(Artifact *inputArtifact) { qCDebug(lcDepScan) << "input artifact" << inputArtifact->filePath() << inputArtifact->fileTags(); Set visitedFilePaths; QList filesToScan; filesToScan.push_back(inputArtifact); const Set scanners = scannersForArtifact(inputArtifact); if (scanners.empty()) return; m_fileTagsForScanner = inputArtifact->fileTags().toStringList().join(QLatin1Char(',')).toLatin1(); InputArtifactScannerContext::ScannerKeyCache *lastPerFileCacheItem = nullptr; InputArtifactScannerContext::ScannerKeyCache *lastPerPropsCacheItem = nullptr; while (!filesToScan.empty()) { FileResourceBase *fileToBeScanned = filesToScan.takeFirst(); const QString &filePathToBeScanned = fileToBeScanned->filePath(); if (!visitedFilePaths.insert(filePathToBeScanned).second) continue; for (DependencyScanner * const scanner : scanners) { InputArtifactScannerContext::ScannerKeyCache *cacheItem; if (scanner->cacheIsPerFile()) { if (!lastPerFileCacheItem) lastPerFileCacheItem = &m_context->cachePerFile[inputArtifact]; cacheItem = lastPerFileCacheItem; } else { if (!lastPerPropsCacheItem) { lastPerPropsCacheItem = &m_context->cachePerProperties [inputArtifact->properties]; } cacheItem = lastPerPropsCacheItem; } scanForScannerFileDependencies( scanner, inputArtifact, fileToBeScanned, scanner->recursive() ? &filesToScan : nullptr, (*cacheItem)[scanner->id()]); } } } Set InputArtifactScanner::scannersForArtifact(const Artifact *artifact) const { Set scanners; ResolvedProduct *product = artifact->product.get(); ScriptEngine *engine = product->topLevelProject()->buildData->evaluationContext->engine(); QHash &scannerCache = m_context->scannersCache[product]; for (const FileTag &fileTag : artifact->fileTags()) { InputArtifactScannerContext::DependencyScannerCacheItem &cache = scannerCache[fileTag]; if (!cache) { QList cacheScanners; const auto scanners = ScannerPluginManager::scannersForFileTag(fileTag); transform(scanners, cacheScanners, [](const auto &scanner) { return std::make_shared(scanner); }); for (const ResolvedScannerConstPtr &scanner : product->scanners) { if (scanner->inputs.contains(fileTag)) { cacheScanners.push_back( std::make_shared(scanner, engine)); break; } } cache = std::move(cacheScanners); } for (const DependencyScannerPtr &scanner : std::as_const(*cache)) scanners += scanner.get(); } return scanners; } void InputArtifactScanner::scanForScannerFileDependencies( DependencyScanner *scanner, Artifact *inputArtifact, FileResourceBase *fileToBeScanned, QList *filesToScan, InputArtifactScannerContext::ScannerKeyCacheItem &cache) { qCDebug(lcDepScan) << "file" << fileToBeScanned->filePath(); const bool cacheHit = !!cache; if (!cacheHit) { cache.emplace(); cache->searchPaths = scanner->collectSearchPaths(inputArtifact); } qCDebug(lcDepScan) << "include paths (cache" << (cacheHit ? "hit)" : "miss)"); for (const QString &s : std::as_const(cache->searchPaths)) qCDebug(lcDepScan) << " " << s; const QString &filePathToBeScanned = fileToBeScanned->filePath(); RawScanResults::ScanData &scanData = m_rawScanResults.findScanData(fileToBeScanned, scanner, m_artifact->properties); if (scanData.lastScanTime < fileToBeScanned->timestamp()) { qCDebug(lcDepScan) << "scanning" << FileInfo::fileName(filePathToBeScanned); scanWithScannerPlugin(scanner, inputArtifact, fileToBeScanned, &scanData.rawScanResult); scanData.lastScanTime = FileTime::currentTime(); } resolveScanResultDependencies(inputArtifact, scanData.rawScanResult, filesToScan, *cache); } void InputArtifactScanner::resolveScanResultDependencies( const Artifact *inputArtifact, const RawScanResult &scanResult, QList *artifactsToScan, InputArtifactScannerContext::ScannerKeyCacheData &cache) { auto getResolvedDependency = [inputArtifact, &cache](const RawScannedDependency &dependency) -> ResolvedDependency* { const QString &dependencyFilePath = dependency.filePath(); InputArtifactScannerContext::ResolvedDependencyCacheItem &cachedResolvedDependencyItem = cache.resolvedDependenciesCache[dependency.dirPath()][dependency.fileName()]; if (cachedResolvedDependencyItem) { ResolvedDependency &resolvedDependency = *cachedResolvedDependencyItem; if (resolvedDependency.filePath.isEmpty()) return nullptr; return &resolvedDependency; } ResolvedDependency &resolvedDependency = cachedResolvedDependencyItem.emplace(); if (FileInfo::isAbsolute(dependencyFilePath)) { resolveDepencency(dependency, inputArtifact->product.get(), &resolvedDependency); if (resolvedDependency.filePath.isEmpty()) return nullptr; return &resolvedDependency; } // try include paths for (const QString &includePath : std::as_const(cache.searchPaths)) { resolveDepencency(dependency, inputArtifact->product.get(), &resolvedDependency, includePath); if (resolvedDependency.isValid()) return &resolvedDependency; } return nullptr; }; for (const RawScannedDependency &dependency : scanResult.deps) { const auto maybeResolvedDependency = getResolvedDependency(dependency); if (!maybeResolvedDependency) { qCWarning(lcDepScan) << "unresolved dependency " << dependency.filePath(); continue; } auto &resolvedDependency = *maybeResolvedDependency; handleDependency(resolvedDependency); if (artifactsToScan && resolvedDependency.file) { if (resolvedDependency.file->fileType() == FileResourceBase::FileTypeArtifact) { // Do not scan an artifact that is not built yet: Its contents might still change. auto const artifactDependency = static_cast(resolvedDependency.file); if (artifactDependency->artifactType == Artifact::SourceFile || artifactDependency->buildState == BuildGraphNode::Built) { artifactsToScan->push_back(artifactDependency); } } else { // Add file dependency to the next round of scanning. artifactsToScan->push_back(resolvedDependency.file); } } } } void InputArtifactScanner::handleDependency(ResolvedDependency &dependency) { const ResolvedProductPtr product = m_artifact->product.lock(); QBS_CHECK(m_artifact->artifactType == Artifact::Generated); QBS_CHECK(product); Artifact *artifactDependency = nullptr; FileDependency *fileDependency = nullptr; if (dependency.file) { switch (dependency.file->fileType()) { case FileResourceBase::FileTypeArtifact: artifactDependency = static_cast(dependency.file); break; case FileResourceBase::FileTypeDependency: fileDependency = static_cast(dependency.file); break; } } QBS_CHECK(!dependency.file || artifactDependency || fileDependency); if (!dependency.file) { // The dependency is an existing file but does not exist in the build graph. qCDebug(lcDepScan) << "add new file dependency" << dependency.filePath; fileDependency = new FileDependency(); dependency.file = fileDependency; fileDependency->setFilePath(dependency.filePath); product->topLevelProject()->buildData->insertFileDependency(fileDependency); } else if (fileDependency) { // The dependency exists in the project's list of file dependencies. qCDebug(lcDepScan) << "add existing file dependency" << dependency.filePath; } else if (artifactDependency->product == product) { // The dependency is in our product. qCDebug(lcDepScan) << "add artifact dependency" << dependency.filePath << "(from this product)"; } else { // The dependency is in some other product. ResolvedProduct * const otherProduct = artifactDependency->product; qCDebug(lcDepScan) << "add artifact dependency" << dependency.filePath << " (from product" << otherProduct->uniqueName() << ')'; } if (m_artifact == dependency.file) return; if (artifactDependency && artifactDependency->transformer == m_artifact->transformer) return; if (fileDependency) { m_artifact->fileDependencies << fileDependency; if (!fileDependency->timestamp().isValid()) fileDependency->setTimestamp(FileInfo(fileDependency->filePath()).lastModified()); } else { if (m_artifact->children.contains(artifactDependency)) return; if (safeConnect(m_artifact, artifactDependency)) m_artifact->childrenAddedByScanner += artifactDependency; m_newDependencyAdded = true; } } void InputArtifactScanner::scanWithScannerPlugin(DependencyScanner *scanner, Artifact *inputArtifact, FileResourceBase *fileToBeScanned, RawScanResult *scanResult) { scanResult->deps.clear(); const QStringList &dependencies = scanner->collectDependencies( inputArtifact, fileToBeScanned, m_fileTagsForScanner.constData()); for (const QString &s : dependencies) scanResult->deps.emplace_back(s); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/artifactvisitor.cpp0000644000175100017510000000551315154533055023524 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "artifactvisitor.h" #include "artifact.h" #include "productbuilddata.h" #include #include #include namespace qbs { namespace Internal { ArtifactVisitor::ArtifactVisitor(int artifactType) : m_artifactType(artifactType) { } void ArtifactVisitor::visitProduct(const ResolvedProductConstPtr &product) { if (!product->buildData) return; for (BuildGraphNode *node : std::as_const(product->buildData->allNodes())) node->accept(this); } void ArtifactVisitor::visitProject(const ResolvedProjectConstPtr &project) { for (const auto &product : project->allProducts()) visitProduct(product); } bool ArtifactVisitor::visit(RuleNode *ruleNode) { Q_UNUSED(ruleNode); return false; } bool ArtifactVisitor::visit(Artifact *artifact) { QBS_CHECK(artifact); if (m_artifactType & artifact->artifactType) doVisit(artifact); return false; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/qtmocscanner.cpp0000644000175100017510000002376415154533055023014 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "qtmocscanner.h" #include "artifact.h" #include "depscanner.h" #include "productbuilddata.h" #include "projectbuilddata.h" #include "rawscanresults.h" #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { struct CommonFileTags { const FileTag cpp = "cpp"; const FileTag cppCombine = "cpp.combine"; const FileTag hpp = "hpp"; const FileTag moc_cpp = "moc_cpp"; const FileTag moc_cpp_plugin = "moc_cpp_plugin"; const FileTag moc_hpp_plugin = "moc_hpp_plugin"; const FileTag moc_hpp = "moc_hpp"; const FileTag objcpp = "objcpp"; const FileTag objcppCombine = "objcpp.combine"; }; Q_GLOBAL_STATIC(CommonFileTags, commonFileTags) static QString qtMocScannerJsName() { return QStringLiteral("QtMocScanner"); } QtMocScanner::QtMocScanner(const ResolvedProductPtr &product, ScriptEngine *engine, JSValue targetScriptValue) : m_engine(engine) , m_tags(*commonFileTags()) , m_product(product) , m_targetScriptValue(JS_DupValue(engine->context(), targetScriptValue)) { JSValue scannerObj = JS_NewObjectClass(engine->context(), engine->dataWithPtrClass()); attachPointerTo(scannerObj, this); setJsProperty(engine->context(), targetScriptValue, qtMocScannerJsName(), scannerObj); JSValue applyFunction = JS_NewCFunction(engine->context(), &js_apply, "QtMocScanner", 1); setJsProperty(engine->context(), scannerObj, std::string_view("apply"), applyFunction); } QtMocScanner::~QtMocScanner() { setJsProperty(m_engine->context(), m_targetScriptValue, qtMocScannerJsName(), JS_UNDEFINED); JS_FreeValue(m_engine->context(), m_targetScriptValue); } static RawScanResult runScannerForArtifact(const Artifact *artifact) { const QString &filepath = artifact->filePath(); RawScanResults &rawScanResults = artifact->product->topLevelProject()->buildData->rawScanResults; auto predicate = [](const PropertyMapConstPtr &, const PropertyMapConstPtr &) { return true; }; RawScanResults::ScanData &scanData = rawScanResults.findScanData( artifact, qtMocScannerJsName(), artifact->properties, predicate); if (scanData.lastScanTime < artifact->timestamp()) { FileTags tags = artifact->fileTags(); if (tags.contains(commonFileTags->cppCombine)) { tags.remove(commonFileTags->cppCombine); tags.insert(commonFileTags->cpp); } if (tags.contains(commonFileTags->objcppCombine)) { tags.remove(commonFileTags->objcppCombine); tags.insert(commonFileTags->objcpp); } const QByteArray tagsForScanner = tags.toStringList().join(QLatin1Char(',')).toLatin1(); CppScannerContext context; const bool ok = scanCppFile( context, filepath, {tagsForScanner.data(), size_t(tagsForScanner.size())}, true, true); if (!ok) return scanData.rawScanResult; scanData.rawScanResult.additionalFileTags.clear(); scanData.rawScanResult.deps.clear(); for (const auto tag : additionalFileTags(context)) scanData.rawScanResult.additionalFileTags += FileTag(tag.data()); QString baseDirOfInFilePath = artifact->dirPath(); for (const auto &scanResult : context.includedFiles) { int flags = scanResult.flags; QString includedFilePath = QString::fromLocal8Bit( scanResult.fileName.data(), scanResult.fileName.size()); if (includedFilePath.isEmpty()) continue; bool isLocalInclude = (flags & SC_LOCAL_INCLUDE_FLAG); if (isLocalInclude) { QString localFilePath = FileInfo::resolvePath(baseDirOfInFilePath, includedFilePath); if (FileInfo::exists(localFilePath)) includedFilePath = localFilePath; } scanData.rawScanResult.deps.emplace_back(includedFilePath); } scanData.lastScanTime = FileTime::currentTime(); } return scanData.rawScanResult; } void QtMocScanner::findIncludedMocCppFiles() { if (m_includedMocCppFiles.has_value()) return; m_includedMocCppFiles = QHash(); qCDebug(lcMocScan) << "looking for included moc_XXX.cpp files in" << m_product->name; static const FileTags mocCppTags = {m_tags.cpp, m_tags.objcpp}; for (Artifact *artifact : m_product->lookupArtifactsByFileTags(mocCppTags)) { const RawScanResult scanResult = runScannerForArtifact(artifact); for (const RawScannedDependency &dependency : scanResult.deps) { QString includedFileName = dependency.fileName(); if (includedFileName.startsWith(QLatin1String("moc_")) && includedFileName.endsWith(QLatin1String(".cpp"))) { qCDebug(lcMocScan) << artifact->fileName() << "includes" << includedFileName; includedFileName.remove(0, 4); includedFileName.chop(4); m_includedMocCppFiles->insert(includedFileName, artifact->fileName()); } } } } JSValue QtMocScanner::js_apply(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) { if (argc < 1) return throwError(ctx, Tr::tr("QtMocScanner.apply() requires an argument.")); ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const auto scanner = attachedPointer(this_val, engine->dataWithPtrClass()); return scanner->apply(engine, attachedPointer(argv[0], engine->dataWithPtrClass())); } JSValue QtMocScanner::apply(ScriptEngine *engine, const Artifact *artifact) { qCDebug(lcMocScan).noquote() << "scanning" << artifact->toString(); bool hasQObjectMacro = false; bool mustCompile = false; bool hasPluginMetaDataMacro = false; const bool isHeaderFile = artifact->fileTags().contains(m_tags.hpp); RawScanResult scanResult = runScannerForArtifact(artifact); if (scanResult.additionalFileTags.empty() && artifact->fileTags().contains("mocable")) { if (isHeaderFile) { scanResult.additionalFileTags.insert(m_tags.moc_hpp); } else if (artifact->fileTags().contains(m_tags.cpp) || artifact->fileTags().contains(m_tags.cppCombine) || artifact->fileTags().contains(m_tags.objcpp) || artifact->fileTags().contains(m_tags.objcppCombine)) { scanResult.additionalFileTags.insert(m_tags.moc_cpp); } } if (!scanResult.additionalFileTags.empty()) { if (isHeaderFile) { if (scanResult.additionalFileTags.contains(m_tags.moc_hpp)) hasQObjectMacro = true; if (scanResult.additionalFileTags.contains(m_tags.moc_hpp_plugin)) { hasQObjectMacro = true; hasPluginMetaDataMacro = true; } findIncludedMocCppFiles(); if (!m_includedMocCppFiles->contains(FileInfo::completeBaseName(artifact->fileName()))) mustCompile = true; } else { if (scanResult.additionalFileTags.contains(m_tags.moc_cpp)) hasQObjectMacro = true; if (scanResult.additionalFileTags.contains(m_tags.moc_cpp_plugin)) { hasQObjectMacro = true; hasPluginMetaDataMacro = true; } } } qCDebug(lcMocScan) << "hasQObjectMacro:" << hasQObjectMacro << "mustCompile:" << mustCompile << "hasPluginMetaDataMacro:" << hasPluginMetaDataMacro; JSValue obj = engine->newObject(); JSContext * const ctx = m_engine->context(); setJsProperty(ctx, obj, std::string_view("hasQObjectMacro"), JS_NewBool(ctx, hasQObjectMacro)); setJsProperty(ctx, obj, std::string_view("mustCompile"), JS_NewBool(ctx, mustCompile)); setJsProperty( ctx, obj, std::string_view("hasPluginMetaDataMacro"), JS_NewBool(ctx, hasPluginMetaDataMacro)); engine->setUsesIo(); return obj; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/nodeset.cpp0000644000175100017510000000516415154533055021752 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "nodeset.h" #include "artifact.h" #include "rulenode.h" #include #include namespace qbs { namespace Internal { BuildGraphNode *loadBuildGraphNode(PersistentPool &pool) { const auto t = pool.load(); BuildGraphNode *node = nullptr; switch (static_cast(t)) { case BuildGraphNode::ArtifactNodeType: node = pool.load(); break; case BuildGraphNode::RuleNodeType: node = pool.load(); break; } QBS_CHECK(node); return node; } void storeBuildGraphNode(PersistentPool &pool, const BuildGraphNode *node) { pool.store(static_cast(node->type())); pool.store(node); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/cycledetector.h0000644000175100017510000000530615154533055022605 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_CYCLEDETECTOR_H #define QBS_CYCLEDETECTOR_H #include "buildgraphvisitor.h" #include "nodeset.h" #include #include namespace qbs { namespace Internal { class BuildGraphNode; class QBS_AUTOTEST_EXPORT CycleDetector : private BuildGraphVisitor { public: CycleDetector(Logger logger); void visitProject(const TopLevelProjectConstPtr &project); void visitProduct(const ResolvedProductConstPtr &product); private: bool visit(Artifact *artifact) override; bool visit(RuleNode *ruleNode) override; bool visitNode(BuildGraphNode *node); QList cycle(BuildGraphNode *doubleEntry); NodeSet m_allNodes; NodeSet m_nodesInCurrentPath; BuildGraphNode *m_parent; Logger m_logger; }; } // namespace Internal } // namespace qbs #endif // QBS_CYCLEDETECTOR_H qbs-src-3.2.0/src/lib/corelib/buildgraph/requesteddependencies.h0000644000175100017510000000561715154533055024331 0ustar runnerrunner/**************************************************************************** ** ** 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_REQUESTEDDEPENDENCIES_H #define QBS_REQUESTEDDEPENDENCIES_H #include #include #include #include #include namespace qbs { namespace Internal { class RequestedDependencies { public: RequestedDependencies() = default; RequestedDependencies(const Set &products) { set(products); } void set(const Set &products); void add(const Set &products); void clear() { m_depsPerProduct.clear(); } bool isUpToDate(const TopLevelProject *project) const; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(m_depsPerProduct); } private: struct QStringHash { std::size_t operator()(const QString &s) const { return qHash(s); } }; std::unordered_map, QStringHash> m_depsPerProduct; }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/buildgraph/dependencyparametersscriptvalue.h0000644000175100017510000000445015154533055026437 0ustar runnerrunner/**************************************************************************** ** ** 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_DEPENDENCYPARAMETERSSCRIPTVALUE_H #define QBS_DEPENDENCYPARAMETERSSCRIPTVALUE_H #include #include namespace qbs { namespace Internal { class ScriptEngine; JSValue dependencyParametersValue(const QString &productName, const QString &dependencyName, const QVariantMap ¶metersMap, ScriptEngine *engine); } // namespace Internal } // namespace qbs #endif // include guard qbs-src-3.2.0/src/lib/corelib/buildgraph/rulegraph.h0000644000175100017510000000620715154533055021746 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_RULEGRAPH_H #define QBS_RULEGRAPH_H #include #include #include #include #include #include #include namespace qbs { namespace Internal { class RuleGraphVisitor { public: virtual ~RuleGraphVisitor() = default; virtual void visit(const RuleConstPtr &parentRule, const RuleConstPtr &rule) = 0; virtual void endVisit(const RuleConstPtr &rule) { Q_UNUSED(rule); } }; class RuleGraph { public: RuleGraph(); void build(const std::vector &rules, const FileTags &productFileTag); void accept(RuleGraphVisitor *visitor) const; void dump() const; private: void dump_impl(QByteArray &indent, int rootIndex) const; int insert(const RulePtr &rule); void connect(const Rule *creatingRule, const Rule *consumingRule); void traverse(RuleGraphVisitor *visitor, const RuleConstPtr &parentRule, const RuleConstPtr &rule) const; private: QMap > m_outputFileTagToRule; std::vector m_rules; std::vector< std::vector > m_parents; std::vector< std::vector > m_children; Set m_rootRules; }; } // namespace Internal } // namespace qbs #endif // QBS_RULEGRAPH_H qbs-src-3.2.0/src/lib/corelib/buildgraph/buildgraph.cpp0000644000175100017510000012116615154533055022433 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "buildgraph.h" #include "artifact.h" #include "artifactsscriptvalue.h" #include "cycledetector.h" #include "dependencyparametersscriptvalue.h" #include "projectbuilddata.h" #include "productbuilddata.h" #include "rulenode.h" #include "transformer.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { static QString childItemsProperty() { return QStringLiteral("childItems"); } static QString exportsProperty() { return QStringLiteral("exports"); } // TODO: Introduce productscriptvalue.{h,cpp}. static JSValue getDataObject(JSContext *ctx, JSValue obj) { return getJsProperty(ctx, obj, StringConstants::dataPropertyInternal()); } static JSValue getValueFromData(JSContext *ctx, JSValue data, ModulePropertiesScriptValueCommonPropertyKeys key) { return JS_GetPropertyUint32(ctx, data, key); } static JSValue getValueFromObject(JSContext *ctx, JSValue obj, ModulePropertiesScriptValueCommonPropertyKeys key) { const ScopedJsValue data(ctx, getDataObject(ctx, obj)); return getValueFromData(ctx, data, key); } void getPropertyNames(JSContext *ctx, JSPropertyEnum **ptab, uint32_t *plen, const QVariantMap &properties, const QStringList &extraPropertyNames, JSValue extraObject) { JSPropertyEnum *basePTab = nullptr; uint32_t basePlen = 0; JS_GetOwnPropertyNames(ctx, &basePTab, &basePlen, extraObject, JS_GPN_STRING_MASK | JS_GPN_ENUM_ONLY); *plen = uint32_t(extraPropertyNames.size() + properties.size() + basePlen); *ptab = reinterpret_cast(js_malloc(ctx, *plen * sizeof **ptab)); JSPropertyEnum *entry = *ptab; for (auto it = properties.begin(); it != properties.end(); ++it, ++entry) { entry->atom = JS_NewAtom(ctx, it.key().toUtf8().constData()); entry->is_enumerable = 1; } for (const QString &prop : extraPropertyNames) { entry->atom = JS_NewAtom(ctx, prop.toUtf8().constData()); entry->is_enumerable = 1; ++entry; } for (uint32_t i = 0; i < basePlen; ++i, ++entry) { entry->atom = basePTab[i].atom; entry->is_enumerable = 1; } js_free(ctx, basePTab); } static int getProductPropertyNames(JSContext *ctx, JSPropertyEnum **ptab, uint32_t *plen, JSValueConst obj) { ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const ScopedJsValue data(ctx, getDataObject(engine->context(), obj)); const auto product = attachedPointer( obj, engine->productPropertyScriptClass()); QBS_ASSERT(product, return -1); // The "moduleName" convenience property is only available for the "main product" in a rule, // and the "parameters" property exists only for elements of the "dependencies" array for // which dependency parameters are present. const auto hasModuleName = [&] { const ScopedJsValue v(ctx, getValueFromData(ctx, data, ModuleNameKey)); return JS_IsString(v); }; const auto hasDependencyParams = [&] { const ScopedJsValue v(ctx, getValueFromData(ctx, data, DependencyParametersKey)); return JS_IsObject(v); }; QStringList additionalProperties; if (hasModuleName()) additionalProperties.push_back(StringConstants::moduleNameProperty()); else if (hasDependencyParams()) additionalProperties.push_back(StringConstants::parametersProperty()); getPropertyNames(ctx, ptab, plen, product->productProperties, additionalProperties, engine->baseProductScriptValue(product)); return 0; } static int getProductProperty(JSContext *ctx, JSPropertyDescriptor *desc, JSValueConst obj, JSAtom prop) { if (desc) { desc->getter = desc->setter = desc->value = JS_UNDEFINED; desc->flags = JS_PROP_ENUMERABLE; } const QString name = getJsString(ctx, prop); if (name == StringConstants::parametersProperty()) { if (desc) desc->value = getValueFromObject(ctx, obj, DependencyParametersKey); return 1; } if (name == StringConstants::moduleNameProperty()) { if (desc) desc->value = getValueFromObject(ctx, obj, ModuleNameKey); return 1; } ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const auto product = attachedPointer( obj, engine->productPropertyScriptClass()); QBS_ASSERT(product, return -1); const JSValue baseProductValue = engine->baseProductScriptValue(product); if (name == exportsProperty()) { if (desc) desc->value = getJsProperty(ctx, baseProductValue, name); engine->addRequestedExport(product); return 1; } const auto it = product->productProperties.constFind(name); if (it == product->productProperties.cend()) { ScopedJsValue v(ctx, JS_GetProperty(ctx, baseProductValue, prop)); const int ret = JS_IsUndefined(v) ? 0 : 1; if (desc) desc->value = v.release(); return ret; } engine->addPropertyRequestedInScript(Property(product->uniqueName(), QString(), name, it.value(), Property::PropertyInProduct)); if (desc) desc->value = engine->toScriptValue(it.value()); return 1; } static JSValue setupProjectScriptValue(ScriptEngine *engine, const ResolvedProjectConstPtr &project) { JSValue &obj = engine->projectScriptValue(project.get()); if (JS_IsObject(obj)) return JS_DupValue(engine->context(), obj); obj = engine->newObject(); setJsProperty(engine->context(), obj, StringConstants::filePathProperty(), project->location.filePath()); setJsProperty(engine->context(), obj, StringConstants::pathProperty(), FileInfo::path(project->location.filePath())); const QVariantMap &projectProperties = project->projectProperties(); for (QVariantMap::const_iterator it = projectProperties.begin(); it != projectProperties.end(); ++it) { const ScopedJsValue val(engine->context(), engine->toScriptValue(it.value())); engine->setObservedProperty(obj, it.key(), val); } engine->observer()->addProjectObjectId(jsObjectId(obj), project->name); return JS_DupValue(engine->context(), obj); } static void setupBaseProductScriptValue(ScriptEngine *engine, const ResolvedProduct *product); class DependenciesFunction { public: DependenciesFunction(ScriptEngine *engine) : m_engine(engine) { } void init(JSValue &productScriptValue, JSValue exportsScriptValue) { const QByteArray name = StringConstants::dependenciesProperty().toUtf8(); const ScopedJsValue depfunc( m_engine->context(), JS_NewCFunction(m_engine->context(), &js_internalProductDependencies, name.constData(), 0)); const ScopedJsAtom depAtom(m_engine->context(), name); JS_DefineProperty(m_engine->context(), productScriptValue, depAtom, JS_UNDEFINED, depfunc, JS_UNDEFINED, JS_PROP_HAS_GET | JS_PROP_ENUMERABLE); const ScopedJsValue exportedDepfunc( m_engine->context(), JS_NewCFunction(m_engine->context(), &js_exportedProductDependencies, name.constData(), 0)); JS_DefineProperty(m_engine->context(), exportsScriptValue, depAtom, JS_UNDEFINED, exportedDepfunc, JS_UNDEFINED, JS_PROP_HAS_GET | JS_PROP_ENUMERABLE); } private: enum class DependencyType { Internal, Exported }; static JSValue js_productDependencies(const ResolvedProduct *product, JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, DependencyType depType) { Q_UNUSED(this_val) Q_UNUSED(argc) Q_UNUSED(argv) ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); JSValue result = JS_NewArray(ctx); quint32 idx = 0; const bool exportCase = depType == DependencyType::Exported; std::vector productDeps; if (exportCase) { if (!product->exportedModule.productDependencies.empty()) { const auto allProducts = product->topLevelProject()->allProducts(); const auto getProductForName = [&allProducts](const QString &name) { const auto cmp = [name](const ResolvedProductConstPtr &p) { return p->uniqueName() == name; }; const auto it = std::find_if(allProducts.cbegin(), allProducts.cend(), cmp); QBS_ASSERT(it != allProducts.cend(), return ResolvedProductPtr()); return *it; }; std::transform(product->exportedModule.productDependencies.cbegin(), product->exportedModule.productDependencies.cend(), std::back_inserter(productDeps), getProductForName); } } else { productDeps = product->depsAsProductList(); } for (const ResolvedProductPtr &dependency : std::as_const(productDeps)) { setupBaseProductScriptValue(engine, dependency.get()); JSValue obj = JS_NewObjectClass(engine->context(), engine->productPropertyScriptClass()); attachPointerTo(obj, dependency.get()); const QVariantMap ¶ms = (exportCase ? product->exportedModule.dependencyParameters.value(dependency) : product->dependencyParameters.value(dependency)); JSValue data = JS_NewObjectClass(engine->context(), engine->dataWithPtrClass()); JS_SetPropertyUint32(ctx, data, DependencyParametersKey, dependencyParametersValue( product->uniqueName(), dependency->name, params, engine)); defineJsProperty(ctx, obj, StringConstants::dataPropertyInternal(), data); JS_SetPropertyUint32(ctx, result, idx++, obj); } if (exportCase) { for (const ExportedModuleDependency &m : product->exportedModule.moduleDependencies) { JSValue obj = engine->newObject(); setJsProperty(ctx, obj, StringConstants::nameProperty(), m.name); JSValue exportsValue = engine->newObject(); setJsProperty(ctx, obj, exportsProperty(), exportsValue); setJsProperty(ctx, exportsValue, StringConstants::dependenciesProperty(), JS_NewArray(ctx)); for (auto modIt = m.moduleProperties.begin(); modIt != m.moduleProperties.end(); ++modIt) { const QVariantMap entries = modIt.value().toMap(); if (entries.empty()) continue; JSValue moduleObj = engine->newObject(); ModuleProperties::setModuleScriptValue(engine, exportsValue, moduleObj, modIt.key()); for (auto valIt = entries.begin(); valIt != entries.end(); ++valIt) { setJsProperty(ctx, moduleObj, valIt.key(), engine->toScriptValue(valIt.value())); } } JS_SetPropertyUint32(ctx, result, idx++, obj); } return result; } for (const auto &dependency : product->modules) { if (dependency->isProduct) continue; JSValue obj = JS_NewObjectClass(ctx, engine->modulePropertyScriptClass()); attachPointerTo(obj, dependency.get()); const QVariantMap ¶ms = product->moduleParameters.value(dependency); JSValue data = createDataForModuleScriptValue(engine, nullptr); JS_SetPropertyUint32(ctx, data, DependencyParametersKey, dependencyParametersValue( product->uniqueName(), dependency->name, params, engine)); defineJsProperty(ctx, obj, StringConstants::dataPropertyInternal(), data); JS_SetPropertyUint32(ctx, result, idx++, obj); } return result; } static JSValue js_internalProductDependencies(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const auto product = attachedPointer(this_val, engine->dataWithPtrClass()); engine->addDependenciesArrayRequested(product); return js_productDependencies(product, ctx, this_val, argc, argv, DependencyType::Internal); } static JSValue js_exportedProductDependencies(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { const auto product = attachedPointer( this_val, ScriptEngine::engineForContext(ctx)->dataWithPtrClass()); return js_productDependencies(product, ctx, this_val, argc, argv, DependencyType::Exported); } ScriptEngine *m_engine; }; static JSValue setupExportedPropertyScriptValue(const ExportedProperty &property, ScriptEngine *engine) { JSValue propertyScriptValue = engine->newObject(); setJsProperty(engine->context(), propertyScriptValue, StringConstants::nameProperty(), property.fullName); setJsProperty(engine->context(), propertyScriptValue, StringConstants::typeProperty(), PropertyDeclaration::typeString(property.type)); setJsProperty(engine->context(), propertyScriptValue, StringConstants::sourceCodeProperty(), property.sourceCode); JS_SetPropertyStr(engine->context(), propertyScriptValue, "isBuiltin", JS_NewBool(engine->context(), property.isBuiltin)); return propertyScriptValue; } static void setupExportedPropertiesScriptValue(JSValue &parentObject, const std::vector &properties, ScriptEngine *engine) { JSValue propertiesScriptValue = JS_NewArray(engine->context()); quint32 arrayIndex = 0; for (const ExportedProperty &p : properties) { JS_SetPropertyUint32(engine->context(), propertiesScriptValue, arrayIndex++, setupExportedPropertyScriptValue(p, engine)); } JS_SetPropertyStr(engine->context(), parentObject, "properties", propertiesScriptValue); } static JSValue setupExportedItemScriptValue(const ExportedItem *item, ScriptEngine *engine) { JSValue itemScriptValue = engine->newObject(); setJsProperty(engine->context(), itemScriptValue, StringConstants::nameProperty(), item->name); setupExportedPropertiesScriptValue(itemScriptValue, item->properties, engine); JSValue childrenScriptValue = JS_NewArray(engine->context()); quint32 arrayIndex = 0; for (const auto &childItem : item->children) { JS_SetPropertyUint32(engine->context(), childrenScriptValue, arrayIndex++, setupExportedItemScriptValue(childItem.get(), engine)); } setJsProperty(engine->context(), itemScriptValue, childItemsProperty(), childrenScriptValue); return itemScriptValue; } static JSValue setupExportsScriptValue(const ResolvedProduct *product, ScriptEngine *engine) { const ExportedModule &module = product->exportedModule; JSValue exportsScriptValue = JS_NewObjectClass(engine->context(), engine->dataWithPtrClass()); attachPointerTo(exportsScriptValue, product); for (auto it = module.propertyValues.cbegin(); it != module.propertyValues.cend(); ++it) { setJsProperty(engine->context(), exportsScriptValue, it.key(), engine->toScriptValue(it.value())); } setupExportedPropertiesScriptValue(exportsScriptValue, module.m_properties, engine); JSValue childrenScriptValue = JS_NewArray(engine->context()); quint32 arrayIndex = 0; for (const auto &exportedItem : module.children) { JS_SetPropertyUint32(engine->context(), childrenScriptValue, arrayIndex++, setupExportedItemScriptValue(exportedItem.get(), engine)); } setJsProperty(engine->context(), exportsScriptValue, childItemsProperty(), childrenScriptValue); JSValue importsScriptValue = JS_NewArray(engine->context()); arrayIndex = 0; for (const QString &importStatement : module.importStatements) { JS_SetPropertyUint32(engine->context(), importsScriptValue, arrayIndex++, makeJsString(engine->context(), importStatement)); } setJsProperty(engine->context(), exportsScriptValue, StringConstants::importsProperty(), importsScriptValue); for (auto it = module.modulePropertyValues.cbegin(); it != module.modulePropertyValues.cend(); ++it) { const QVariantMap entries = it.value().toMap(); if (entries.empty()) continue; JSValue moduleObject = engine->newObject(); ModuleProperties::setModuleScriptValue(engine, exportsScriptValue, moduleObject, it.key()); for (auto valIt = entries.begin(); valIt != entries.end(); ++valIt) { setJsProperty(engine->context(), moduleObject, valIt.key(), engine->toScriptValue(valIt.value())); } } return exportsScriptValue; } static void setupBaseProductScriptValue(ScriptEngine *engine, const ResolvedProduct *product) { JSValue &productScriptValue = engine->baseProductScriptValue(product); if (JS_IsObject(productScriptValue)) return; const ScopedJsValue proto(engine->context(), JS_NewObject(engine->context())); productScriptValue = JS_NewObjectProtoClass(engine->context(), proto, engine->dataWithPtrClass()); attachPointerTo(productScriptValue, product); ModuleProperties::init(engine, productScriptValue, product); const QByteArray funcName = StringConstants::artifactsProperty().toUtf8(); const ScopedJsValue artifactsFunc( engine->context(), JS_NewCFunction(engine->context(), &artifactsScriptValueForProduct, funcName.constData(), 0)); const ScopedJsAtom artifactsAtom(engine->context(), funcName); JS_DefineProperty(engine->context(), productScriptValue, artifactsAtom, JS_UNDEFINED, artifactsFunc, JS_UNDEFINED, JS_PROP_HAS_GET | JS_PROP_ENUMERABLE); // FIXME: Proper un-observe rather than ref count decrease here. ScopedJsValue exportsScriptValue(engine->context(), setupExportsScriptValue(product, engine)); DependenciesFunction(engine).init(productScriptValue, exportsScriptValue); // TODO: Why are these necessary? We catch accesses to product.exports in getProductProperty(). // But the exportsQbs() and exportsPkgConfig() tests fail without them. engine->setObservedProperty(productScriptValue, exportsProperty(), exportsScriptValue); engine->observer()->addExportsObjectId(jsObjectId(exportsScriptValue), product); } void setupScriptEngineForFile(ScriptEngine *engine, const FileContextBaseConstPtr &fileContext, JSValue targetObject, const ObserveMode &observeMode) { engine->import(fileContext, targetObject, observeMode); JsExtensions::setupExtensions(engine, fileContext->jsExtensions(), targetObject); } void setupScriptEngineForProduct(ScriptEngine *engine, ResolvedProduct *product, const ResolvedModule *module, JSValue targetObject, bool setBuildEnvironment) { JSValue projectScriptValue = setupProjectScriptValue(engine, product->project.lock()); setJsProperty(engine->context(), targetObject, StringConstants::projectVar(), projectScriptValue); if (setBuildEnvironment) { QVariant v; v.setValue(&product->buildEnvironment); engine->setProperty(StringConstants::qbsProcEnvVarInternal(), v); } JSClassID scriptClass = engine->productPropertyScriptClass(); if (scriptClass == 0) { engine->setProductPropertyScriptClass(engine->registerClass("ProductProperties", nullptr, nullptr, JS_UNDEFINED, &getProductPropertyNames, &getProductProperty)); scriptClass = engine->productPropertyScriptClass(); } setupBaseProductScriptValue(engine, product); JSValue productScriptValue = JS_NewObjectClass(engine->context(), scriptClass); attachPointerTo(productScriptValue, product); setJsProperty(engine->context(), targetObject, StringConstants::productVar(), productScriptValue); JSValue data = JS_NewObjectClass(engine->context(), engine->dataWithPtrClass()); // If the Rule is in a Module, set up the 'moduleName' property if (!module->name.isEmpty()) { JS_SetPropertyUint32(engine->context(), data, ModuleNameKey, makeJsString(engine->context(), module->name)); } defineJsProperty(engine->context(), productScriptValue, StringConstants::dataPropertyInternal(), data); } bool findPath(BuildGraphNode *u, BuildGraphNode *v, QList &path) { if (u == v) { path.push_back(v); return true; } for (BuildGraphNode * const childNode : std::as_const(u->children)) { if (findPath(childNode, v, path)) { path.prepend(u); return true; } } return false; } /* * Creates the build graph edge p -> c, which represents the dependency "c must be built before p". */ void connect(BuildGraphNode *p, BuildGraphNode *c) { qCDebug(lcBuildGraph).noquote() << "connect" << p->toString() << "->" << c->toString(); QBS_CHECK(p != c); if (c->type() == BuildGraphNode::ArtifactNodeType) { auto const ac = static_cast(c); for (const Artifact *child : filterByType(p->children)) { if (child == ac) return; const bool filePathsMustBeDifferent = child->artifactType == Artifact::Generated || child->product == ac->product || child->artifactType != ac->artifactType; if (filePathsMustBeDifferent && child->filePath() == ac->filePath()) { throw ErrorInfo(QStringLiteral("%1 already has a child artifact %2 as " "different object.").arg(p->toString(), ac->filePath()), CodeLocation(), true); } } } p->children.insert(c); c->parents.insert(p); p->product->topLevelProject()->buildData->setDirty(); } static bool existsPath_impl(BuildGraphNode *u, BuildGraphNode *v, NodeSet *seen) { if (u == v) return true; if (!seen->insert(u).second) return false; return Internal::any_of(u->children, [v, seen](const auto &child) { return existsPath_impl(child, v, seen); }); } static bool existsPath(BuildGraphNode *u, BuildGraphNode *v) { NodeSet seen; return existsPath_impl(u, v, &seen); } static QStringList toStringList(const QList &path) { QStringList lst; for (BuildGraphNode *node : path) lst << node->toString(); return lst; } bool safeConnect(Artifact *u, Artifact *v) { QBS_CHECK(u != v); qCDebug(lcBuildGraph) << "safeConnect:" << relativeArtifactFileName(u) << "->" << relativeArtifactFileName(v); if (existsPath(v, u)) { QList circle; findPath(v, u, circle); qCDebug(lcBuildGraph) << "safeConnect: circle detected " << toStringList(circle); return false; } connect(u, v); return true; } void disconnect(BuildGraphNode *u, BuildGraphNode *v) { qCDebug(lcBuildGraph).noquote() << "disconnect:" << u->toString() << v->toString(); u->children.remove(v); v->parents.remove(u); u->onChildDisconnected(v); } void removeGeneratedArtifactFromDisk(Artifact *artifact, const Logger &logger) { if (artifact->artifactType != Artifact::Generated) return; removeGeneratedArtifactFromDisk(artifact->filePath(), logger); } void removeGeneratedArtifactFromDisk(const QString &filePath, const Logger &logger) { QFile file(filePath); if (!file.exists()) return; logger.qbsDebug() << "removing " << filePath; if (!file.remove()) logger.qbsWarning() << QStringLiteral("Cannot remove '%1'.").arg(filePath); } QString relativeArtifactFileName(const Artifact *artifact) { const QString &buildDir = artifact->product->topLevelProject()->buildDirectory; QString str = artifact->filePath(); if (str.startsWith(buildDir)) str.remove(0, buildDir.size()); if (str.startsWith(QLatin1Char('/'))) str.remove(0, 1); return str; } Artifact *lookupArtifact(const ResolvedProductConstPtr &product, const ProjectBuildData *projectBuildData, const QString &dirPath, const QString &fileName, bool compareByName) { for (const auto &fileResource : projectBuildData->lookupFiles(dirPath, fileName)) { if (fileResource->fileType() != FileResourceBase::FileTypeArtifact) continue; const auto artifact = static_cast(fileResource); if (compareByName ? artifact->product->uniqueName() == product->uniqueName() : artifact->product == product) { return artifact; } } return nullptr; } Artifact *lookupArtifact(const ResolvedProductConstPtr &product, const QString &dirPath, const QString &fileName, bool compareByName) { return lookupArtifact(product, product->topLevelProject()->buildData.get(), dirPath, fileName, compareByName); } Artifact *lookupArtifact(const ResolvedProductConstPtr &product, const QString &filePath, bool compareByName) { QString dirPath, fileName; FileInfo::splitIntoDirectoryAndFileName(filePath, &dirPath, &fileName); return lookupArtifact(product, dirPath, fileName, compareByName); } Artifact *lookupArtifact(const ResolvedProductConstPtr &product, const ProjectBuildData *buildData, const QString &filePath, bool compareByName) { QString dirPath, fileName; FileInfo::splitIntoDirectoryAndFileName(filePath, &dirPath, &fileName); return lookupArtifact(product, buildData, dirPath, fileName, compareByName); } Artifact *lookupArtifact(const ResolvedProductConstPtr &product, const Artifact *artifact, bool compareByName) { return lookupArtifact(product, artifact->dirPath(), artifact->fileName(), compareByName); } Artifact *createArtifact(const ResolvedProductPtr &product, const SourceArtifactConstPtr &sourceArtifact) { const auto artifact = new Artifact; artifact->artifactType = Artifact::SourceFile; setArtifactData(artifact, sourceArtifact); insertArtifact(product, artifact); return artifact; } void setArtifactData(Artifact *artifact, const SourceArtifactConstPtr &sourceArtifact) { artifact->targetOfModule = sourceArtifact->targetOfModule; artifact->setFilePath(sourceArtifact->absoluteFilePath); artifact->setFileTags(sourceArtifact->fileTags); artifact->properties = sourceArtifact->properties; } void updateArtifactFromSourceArtifact(const ResolvedProductPtr &product, const SourceArtifactConstPtr &sourceArtifact) { Artifact * const artifact = lookupArtifact(product, sourceArtifact->absoluteFilePath, false); QBS_CHECK(artifact); const FileTags oldFileTags = artifact->fileTags(); const QVariantMap oldModuleProperties = artifact->properties->value(); setArtifactData(artifact, sourceArtifact); if (oldFileTags != artifact->fileTags() || !qVariantMapsEqual(oldModuleProperties, artifact->properties->value())) { invalidateArtifactAsRuleInputIfNecessary(artifact); } } void insertArtifact(const ResolvedProductPtr &product, Artifact *artifact) { qCDebug(lcBuildGraph) << "insert artifact" << artifact->filePath(); QBS_CHECK(!artifact->product); QBS_CHECK(!artifact->filePath().isEmpty()); artifact->product = product; product->topLevelProject()->buildData->insertIntoLookupTable(artifact); product->buildData->addArtifact(artifact); } void provideFullFileTagsAndProperties(Artifact *artifact) { artifact->properties = artifact->product->moduleProperties; FileTags allTags = artifact->pureFileTags.empty() ? artifact->product->fileTagsForFileName(artifact->fileName()) : artifact->pureFileTags; for (const auto &props : artifact->product->artifactProperties) { if (allTags.intersects(props->fileTagsFilter())) { artifact->properties = props->propertyMap(); allTags += props->extraFileTags(); break; } } artifact->setFileTags(allTags); // Let a positive value of qbs.install imply the file tag "installable". if (artifact->properties->qbsPropertyValue(StringConstants::installProperty()).toBool()) artifact->addFileTag("installable"); } void applyPerArtifactProperties(Artifact *artifact) { if (artifact->pureProperties.empty()) return; QVariantMap props = artifact->properties->value(); for (const auto &property : artifact->pureProperties) setConfigProperty(props, property.first, property.second); artifact->properties = artifact->properties->clone(); artifact->properties->setValue(props); } void updateGeneratedArtifacts(ResolvedProduct *product) { if (!product->buildData) return; for (Artifact * const artifact : filterByType(product->buildData->allNodes())) { if (artifact->artifactType == Artifact::Generated) { const FileTags oldFileTags = artifact->fileTags(); const QVariantMap oldModuleProperties = artifact->properties->value(); provideFullFileTagsAndProperties(artifact); applyPerArtifactProperties(artifact); if (oldFileTags != artifact->fileTags() || !qVariantMapsEqual(oldModuleProperties, artifact->properties->value())) { invalidateArtifactAsRuleInputIfNecessary(artifact); } } } } // This is needed for artifacts which are inputs to rules whose outputArtifacts script // returned an empty array for this input. Since there is no transformer, our usual change // tracking procedure will not notice if the artifact's file tags or module properties have // changed, so we need to force a re-run of the outputArtifacts script. void invalidateArtifactAsRuleInputIfNecessary(Artifact *artifact) { for (RuleNode * const parentRuleNode : filterByType(artifact->parents)) { if (!parentRuleNode->rule()->isDynamic()) continue; bool artifactNeedsExplicitInvalidation = true; for (Artifact * const output : filterByType(parentRuleNode->parents)) { if (output->children.contains(artifact) && !output->childrenAddedByScanner.contains(artifact)) { artifactNeedsExplicitInvalidation = false; break; } } if (artifactNeedsExplicitInvalidation) parentRuleNode->removeOldInputArtifact(artifact); } } static void doSanityChecksForProduct(const ResolvedProductConstPtr &product, const Set &allProducts, const Logger &logger) { qCDebug(lcBuildGraph) << "Sanity checking product" << product->uniqueName(); CycleDetector cycleDetector(logger); cycleDetector.visitProduct(product); const ProductBuildData * const buildData = product->buildData.get(); for (const auto &m : product->modules) QBS_CHECK(m->product == product.get()); qCDebug(lcBuildGraph) << "enabled:" << product->enabled << "build data:" << buildData; if (product->enabled) QBS_CHECK(buildData); if (!product->buildData) return; for (BuildGraphNode * const node : std::as_const(buildData->rootNodes())) { qCDebug(lcBuildGraph).noquote() << "Checking root node" << node->toString(); QBS_CHECK(buildData->allNodes().contains(node)); } Set filePaths; for (BuildGraphNode * const node : std::as_const(buildData->allNodes())) { qCDebug(lcBuildGraph).noquote() << "Sanity checking node" << node->toString(); QBS_CHECK(node->product == product); for (const BuildGraphNode * const parent : std::as_const(node->parents)) QBS_CHECK(parent->children.contains(node)); for (BuildGraphNode * const child : std::as_const(node->children)) { QBS_CHECK(child->parents.contains(node)); QBS_CHECK(!child->product.expired()); QBS_CHECK(child->product->buildData); QBS_CHECK(child->product->buildData->allNodes().contains(child)); QBS_CHECK(allProducts.contains(child->product.lock())); } Artifact * const artifact = node->type() == BuildGraphNode::ArtifactNodeType ? static_cast(node) : nullptr; if (!artifact) { QBS_CHECK(node->type() == BuildGraphNode::RuleNodeType); auto const ruleNode = static_cast(node); QBS_CHECK(ruleNode->rule()); QBS_CHECK(ruleNode->rule()->product); QBS_CHECK(ruleNode->rule()->product == ruleNode->product.get()); QBS_CHECK(ruleNode->rule()->product == product.get()); QBS_CHECK(contains(product->rules, std::const_pointer_cast(ruleNode->rule()))); continue; } QBS_CHECK(product->topLevelProject()->buildData->fileDependencies.contains( artifact->fileDependencies)); QBS_CHECK(artifact->artifactType == Artifact::SourceFile || !filePaths.contains(artifact->filePath())); filePaths << artifact->filePath(); for (Artifact * const child : std::as_const(artifact->childrenAddedByScanner)) QBS_CHECK(artifact->children.contains(child)); const TransformerConstPtr transformer = artifact->transformer; if (artifact->artifactType == Artifact::SourceFile) continue; const auto parentRuleNodes = filterByType(artifact->children); QBS_CHECK(std::distance(parentRuleNodes.begin(), parentRuleNodes.end()) == 1); QBS_CHECK(transformer); QBS_CHECK(transformer->rule); QBS_CHECK(transformer->rule->product); QBS_CHECK(transformer->rule->product == artifact->product.get()); QBS_CHECK(transformer->rule->product == product.get()); QBS_CHECK(transformer->outputs.contains(artifact)); QBS_CHECK(contains(product->rules, std::const_pointer_cast(transformer->rule))); qCDebug(lcBuildGraph) << "The transformer has" << transformer->outputs.size() << "outputs."; ArtifactSet transformerOutputChildren; for (const Artifact * const output : std::as_const(transformer->outputs)) { QBS_CHECK(output->transformer == transformer); transformerOutputChildren.unite(ArtifactSet::filtered(output->children)); for (const Artifact *a : filterByType(output->children)) { for (const Artifact *other : filterByType(output->children)) { if (other != a && other->filePath() == a->filePath() && (other->artifactType != Artifact::SourceFile || a->artifactType != Artifact::SourceFile || other->product == a->product)) { throw ErrorInfo(QStringLiteral("There is more than one artifact for " "file '%1' in the child list for output '%2'.") .arg(a->filePath(), output->filePath()), CodeLocation(), true); } } } } if (lcBuildGraph().isDebugEnabled()) { qCDebug(lcBuildGraph) << "The transformer output children are:"; for (const Artifact * const a : std::as_const(transformerOutputChildren)) qCDebug(lcBuildGraph) << "\t" << a->fileName(); qCDebug(lcBuildGraph) << "The transformer inputs are:"; for (const Artifact * const a : std::as_const(transformer->inputs)) qCDebug(lcBuildGraph) << "\t" << a->fileName(); } QBS_CHECK(transformer->inputs.size() <= transformerOutputChildren.size()); for (Artifact * const transformerInput : std::as_const(transformer->inputs)) QBS_CHECK(transformerOutputChildren.contains(transformerInput)); transformer->artifactsMapRequestedInPrepareScript.doSanityChecks(); transformer->artifactsMapRequestedInCommands.doSanityChecks(); } } static void doSanityChecks(const ResolvedProjectPtr &project, const Set &allProducts, Set &productNames, const Logger &logger) { logger.qbsDebug() << "Sanity checking project '" << project->name << "'"; for (const ResolvedProjectPtr &subProject : std::as_const(project->subProjects)) doSanityChecks(subProject, allProducts, productNames, logger); for (const auto &product : project->products) { QBS_CHECK(product->project == project); QBS_CHECK(product->topLevelProject() == project->topLevelProject()); doSanityChecksForProduct(product, allProducts, logger); QBS_CHECK(!productNames.contains(product->uniqueName())); productNames << product->uniqueName(); } } void doSanityChecks(const ResolvedProjectPtr &project, const Logger &logger) { if (qEnvironmentVariableIsEmpty("QBS_SANITY_CHECKS")) return; Set productNames; const auto allProducts = rangeTo>(project->allProducts()); doSanityChecks(project, allProducts, productNames, logger); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/forward_decls.h0000644000175100017510000000535615154533055022577 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_BG_FORWARD_DECLS_H #define QBS_BG_FORWARD_DECLS_H #include namespace qbs { namespace Internal { class Artifact; class BuildGraphNode; class ProjectBuildData; class ProductBuildData; class RuleNode; class Transformer; using TransformerPtr = std::shared_ptr; using TransformerConstPtr = std::shared_ptr; class RulesEvaluationContext; using RulesEvaluationContextPtr = std::shared_ptr; class AbstractCommand; using AbstractCommandPtr = std::shared_ptr; class ProcessCommand; using ProcessCommandPtr = std::shared_ptr; class JavaScriptCommand; using JavaScriptCommandPtr = std::shared_ptr; template class Set; using ArtifactSet = Set; using NodeSet = Set; } // namespace Internal } // namespace qbs #endif // QBS_BG_FORWARD_DECLS_H qbs-src-3.2.0/src/lib/corelib/buildgraph/emptydirectoriesremover.h0000644000175100017510000000520215154533055024742 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_EMPTYDIRECTORIESREMOVER_H #define QBS_EMPTYDIRECTORIESREMOVER_H #include "forward_decls.h" #include #include #include namespace qbs { namespace Internal { class TopLevelProject; class EmptyDirectoriesRemover { public: EmptyDirectoriesRemover(const TopLevelProject *project, Logger logger); void removeEmptyParentDirectories(const QStringList &artifactFilePaths); void removeEmptyParentDirectories(const ArtifactSet &artifacts); private: void insertSorted(const QString &dirPath); void removeDirIfEmpty(); const TopLevelProject * const m_project; Logger m_logger; QStringList m_dirsToRemove; Set m_handledDirs; }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/buildgraph/buildgraphloader.h0000644000175100017510000001601615154533055023264 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_BUILDGRAPHLOADER_H #define QBS_BUILDGRAPHLOADER_H #include "forward_decls.h" #include "artifact.h" #include "rescuableartifactdata.h" #include #include #include #include #include #include #include namespace qbs { namespace Internal { class FileDependency; class FileResourceBase; class FileTime; class Property; class BuildGraphLoadResult { public: TopLevelProjectPtr newlyResolvedProject; TopLevelProjectPtr loadedProject; }; class BuildGraphLoader { public: BuildGraphLoader(Logger logger); ~BuildGraphLoader(); BuildGraphLoadResult load(const TopLevelProjectPtr &existingProject, const SetupProjectParameters ¶meters, const RulesEvaluationContextPtr &evalContext); static TopLevelProjectConstPtr loadProject(const QString &bgFilePath); private: void loadBuildGraphFromDisk(); bool checkBuildGraphCompatibility(const TopLevelProjectConstPtr &project); void trackProjectChanges(); bool probeExecutionForced(const TopLevelProjectConstPtr &restoredProject, const std::vector &restoredProducts) const; bool hasEnvironmentChanged(const TopLevelProjectConstPtr &restoredProject) const; bool hasCanonicalFilePathResultChanged(const TopLevelProjectConstPtr &restoredProject) const; bool hasFileExistsResultChanged(const TopLevelProjectConstPtr &restoredProject) const; bool hasDirectoryEntriesResultChanged(const TopLevelProjectConstPtr &restoredProject) const; bool hasFileLastModifiedResultChanged(const TopLevelProjectConstPtr &restoredProject) const; bool hasProductFileChanged(const std::vector &restoredProducts, const FileTime &referenceTime, Set &remainingBuildSystemFiles, std::vector &productsWithChangedFiles); bool hasBuildSystemFileChanged(const Set &buildSystemFiles, const TopLevelProject *restoredProject); void markTransformersForChangeTracking(const std::vector &restoredProducts); void checkAllProductsForChanges(const std::vector &restoredProducts, std::vector &changedProducts); bool checkProductForChanges(const ResolvedProductPtr &restoredProduct, const ResolvedProductPtr &newlyResolvedProduct); bool checkProductForChangesInSourceFiles(const ResolvedProductPtr &restoredProduct, const ResolvedProductPtr &newlyResolvedProduct); bool checkProductForInstallInfoChanges(const ResolvedProductPtr &restoredProduct, const ResolvedProductPtr &newlyResolvedProduct); bool checkForPropertyChanges(const ResolvedProductPtr &restoredProduct, const ResolvedProductPtr &newlyResolvedProduct); QVariantMap propertyMapByKind(const ResolvedProductConstPtr &product, const Property &property); void onProductRemoved(const ResolvedProductPtr &product, ProjectBuildData *projectBuildData, bool removeArtifactsFromDisk = true); bool checkForPropertyChanges(const TransformerPtr &restoredTrafo, const ResolvedProductPtr &freshProduct); bool checkForPropertyChange(const Property &restoredProperty, const QVariantMap &newProperties); void replaceFileDependencyWithArtifact(const ResolvedProductPtr &fileDepProduct, FileDependency *filedep, Artifact *artifact); bool checkConfigCompatibility(); struct ChildrenInfo { ChildrenInfo() = default; ChildrenInfo(ArtifactSet c1, ArtifactSet c2) : children(std::move(c1)), childrenAddedByScanner(std::move(c2)) {} ArtifactSet children; ArtifactSet childrenAddedByScanner; }; using ChildListHash = QHash; void rescueOldBuildData(const ResolvedProductConstPtr &restoredProduct, const ResolvedProductPtr &newlyResolvedProduct, const ChildListHash &childLists, const AllRescuableArtifactData &existingRad); QMap m_freshProductsByName; RulesEvaluationContextPtr m_evalContext; SetupProjectParameters m_parameters; BuildGraphLoadResult m_result; Logger m_logger; QStringList m_artifactsRemovedFromDisk; std::unordered_map> m_changedSourcesByProduct; Set m_changedProjectFiles; Set m_removedProjectFiles; Set m_productsWhoseArtifactsNeedUpdate; qint64 m_wildcardExpansionEffort = 0; qint64 m_propertyComparisonEffort = 0; // These must only be deleted at the end so we can still peek into the old look-up table. QList m_objectsToDelete; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/buildgraph/rulecommands.h0000644000175100017510000002254015154533055022444 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** 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_BUILDGRAPH_COMMAND_H #define QBS_BUILDGRAPH_COMMAND_H #include "forward_decls.h" #include #include #include #include #include #include #include namespace qbs { namespace Internal { class ScriptEngine; class AbstractCommand { public: virtual ~AbstractCommand(); enum CommandType { ProcessCommandType, JavaScriptCommandType }; static QString defaultDescription() { return {}; } static QString defaultExtendedDescription() { return {}; } static QString defaultHighLight() { return {}; } static bool defaultIgnoreDryRun() { return false; } static bool defaultIsSilent() { return false; } static int defaultTimeout() { return -1; } virtual CommandType type() const = 0; virtual bool equals(const AbstractCommand *other) const; virtual void fillFromScriptValue(JSContext *ctx, const JSValue *scriptValue, const CodeLocation &codeLocation); virtual QString descriptionForCancelMessage(const QString &productName) const; QString fullDescription(const QString &productName) const; const QString description() const { return m_description; } const QString extendedDescription() const { return m_extendedDescription; } const QString highlight() const { return m_highlight; } bool ignoreDryRun() const { return m_ignoreDryRun; } bool isSilent() const { return m_silent; } QString jobPool() const { return m_jobPool; } CodeLocation codeLocation() const { return m_codeLocation; } int timeout() const { return m_timeout; } const QVariantMap &properties() const { return m_properties; } virtual void load(PersistentPool &pool); virtual void store(PersistentPool &pool); protected: AbstractCommand(); void applyCommandProperties(JSContext *ctx, const JSValue *scriptValue); Set m_predefinedProperties; private: template void serializationOp(PersistentPool &pool) { pool.serializationOp(m_description, m_extendedDescription, m_highlight, m_ignoreDryRun, m_silent, m_codeLocation, m_jobPool, m_timeout, m_properties); } QString m_description; QString m_extendedDescription; QString m_highlight; bool m_ignoreDryRun; bool m_silent; CodeLocation m_codeLocation; QString m_jobPool; int m_timeout; QVariantMap m_properties; }; class ProcessCommand : public AbstractCommand { public: static ProcessCommandPtr create() { return ProcessCommandPtr(new ProcessCommand); } static void setupForJavaScript(ScriptEngine *engine, JSValue targetObject); CommandType type() const override { return ProcessCommandType; } bool equals(const AbstractCommand *otherAbstractCommand) const override; void fillFromScriptValue(JSContext *ctx, const JSValue *scriptValue, const CodeLocation &codeLocation) override; QString descriptionForCancelMessage(const QString &productName) const override; const QString program() const { return m_program; } const QStringList arguments() const { return m_arguments; } const QString workingDir() const { return m_workingDir; } int maxExitCode() const { return m_maxExitCode; } QString stdoutFilterFunction() const { return m_stdoutFilterFunction; } QString stderrFilterFunction() const { return m_stderrFilterFunction; } int responseFileThreshold() const { return m_responseFileThreshold; } int responseFileArgumentIndex() const { return m_responseFileArgumentIndex; } QString responseFileUsagePrefix() const { return m_responseFileUsagePrefix; } QString responseFileSeparator() const { return m_responseFileSeparator; } QProcessEnvironment environment() const { return m_environment; } QStringList relevantEnvVars() const; void clearRelevantEnvValues() { m_relevantEnvValues.clear(); } void addRelevantEnvValue(const QString &key, const QString &value); QString relevantEnvValue(const QString &key) const { return m_relevantEnvValues.value(key); } QString stdoutFilePath() const { return m_stdoutFilePath; } QString stderrFilePath() const { return m_stderrFilePath; } void load(PersistentPool &pool) override; void store(PersistentPool &pool) override; private: ProcessCommand(); int defaultResponseFileThreshold() const; void getEnvironmentFromList(const QStringList &envList); template void serializationOp(PersistentPool &pool) { pool.serializationOp(m_program, m_arguments, m_environment, m_workingDir, m_stdoutFilterFunction, m_stderrFilterFunction, m_responseFileUsagePrefix, m_responseFileSeparator, m_maxExitCode, m_responseFileThreshold, m_responseFileArgumentIndex, m_relevantEnvVars, m_relevantEnvValues, m_stdoutFilePath, m_stderrFilePath); } QString m_program; QStringList m_arguments; QString m_workingDir; int m_maxExitCode; QString m_stdoutFilterFunction; QString m_stderrFilterFunction; int m_responseFileThreshold; // When to use response files? In bytes of (program name + arguments). int m_responseFileArgumentIndex; QString m_responseFileUsagePrefix; QString m_responseFileSeparator; QProcessEnvironment m_environment; QStringList m_relevantEnvVars; QProcessEnvironment m_relevantEnvValues; QString m_stdoutFilePath; QString m_stderrFilePath; }; class JavaScriptCommand : public AbstractCommand { public: static JavaScriptCommandPtr create() { return JavaScriptCommandPtr(new JavaScriptCommand); } static void setupForJavaScript(ScriptEngine *engine, JSValue targetObject); CommandType type() const override { return JavaScriptCommandType; } bool equals(const AbstractCommand *otherAbstractCommand) const override; void fillFromScriptValue(JSContext *ctx, const JSValue *scriptValue, const CodeLocation &codeLocation) override; const QString &scopeName() const { return m_scopeName; } const QString &sourceCode() const { return m_sourceCode; } void load(PersistentPool &pool) override; void store(PersistentPool &pool) override; private: JavaScriptCommand(); template void serializationOp(PersistentPool &pool) { pool.serializationOp(m_scopeName, m_sourceCode); } QString m_scopeName; QString m_sourceCode; }; class CommandList { public: bool empty() const { return m_commands.empty(); } int size() const { return m_commands.size(); } AbstractCommandPtr commandAt(int i) const { return m_commands.at(i); } const QList &commands() const { return m_commands; } void clear() { m_commands.clear(); } void addCommand(const AbstractCommandPtr &cmd) { m_commands.push_back(cmd); } void load(PersistentPool &pool); void store(PersistentPool &pool) const; private: QList m_commands; }; bool operator==(const CommandList &cl1, const CommandList &cl2); inline bool operator!=(const CommandList &cl1, const CommandList &cl2) { return !(cl1 == cl2); } } // namespace Internal } // namespace qbs #endif // QBS_BUILDGRAPH_COMMAND_H qbs-src-3.2.0/src/lib/corelib/buildgraph/abstractcommandexecutor.h0000644000175100017510000000733615154533055024702 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** 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_ABSTRACTCOMMANDEXECUTOR_H #define QBS_ABSTRACTCOMMANDEXECUTOR_H #include #include #include #include #include namespace qbs { class ErrorInfo; namespace Internal { class AbstractCommand; class ScriptEngine; class Transformer; class AbstractCommandExecutor : public QObject { Q_OBJECT public: explicit AbstractCommandExecutor(Internal::Logger logger, QObject *parent = nullptr); void setMainThreadScriptEngine(ScriptEngine *engine) { m_mainThreadScriptEngine = engine; } void setDryRunEnabled(bool enabled) { m_dryRun = enabled; } void setEchoMode(CommandEchoMode echoMode) { m_echoMode = echoMode; } virtual void cancel(const qbs::ErrorInfo &reason = {}) = 0; void start(Transformer *transformer, AbstractCommand *cmd); signals: void reportCommandDescription(const QString &highlight, const QString &message); void finished(const qbs::ErrorInfo &err = ErrorInfo()); // !hasError() <=> command successful protected: virtual void doReportCommandDescription(const QString &productName); AbstractCommand *command() const { return m_command; } Transformer *transformer() const { return m_transformer; } ScriptEngine *scriptEngine() const { return m_mainThreadScriptEngine; } bool dryRun() const { return m_dryRun; } Internal::Logger logger() const { return m_logger; } CommandEchoMode m_echoMode; private: virtual void doSetup() { }; virtual bool doStart() = 0; void startTimeout(); private: AbstractCommand *m_command; Transformer *m_transformer; ScriptEngine *m_mainThreadScriptEngine; bool m_dryRun; Internal::Logger m_logger; QTimer m_watchdog; }; } // namespace Internal } // namespace qbs #endif // QBS_ABSTRACTCOMMANDEXECUTOR_H qbs-src-3.2.0/src/lib/corelib/buildgraph/cppmodulesscanner.h0000644000175100017510000000434215154533055023500 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Janet Black. ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com). ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_CXXMODULESSCANNER_H #define QBS_CXXMODULESSCANNER_H #include #include #include #include class ScannerPlugin; namespace qbs::Internal { class Artifact; struct CommonFileTags; class CppModulesScanner { public: explicit CppModulesScanner(ScriptEngine *engine, JSValue targetScriptValue); ~CppModulesScanner(); private: static JSValue js_apply(JSContext *ctx, JSValue this_val, int argc, JSValue *argv); JSValue apply(ScriptEngine *engine, const Artifact *artifact); ScriptEngine * const m_engine; const JSValue m_targetScriptValue; }; } // namespace qbs::Internal #endif // QBS_CXXMODULESSCANNER_H qbs-src-3.2.0/src/lib/corelib/buildgraph/artifactcleaner.cpp0000644000175100017510000002003215154533055023427 0ustar runnerrunner#include /**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "artifactcleaner.h" #include "artifact.h" #include "artifactvisitor.h" #include "productbuilddata.h" #include "projectbuilddata.h" #include "transformer.h" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { static void printRemovalMessage(const QString &path, bool dryRun, const Logger &logger) { if (dryRun) logger.qbsInfo() << Tr::tr("Would remove '%1'.").arg(path); else logger.qbsDebug() << "Removing '" << path << "'."; } static void invalidateArtifactTimestamp(Artifact *artifact) { if (artifact->timestamp().isValid()) { artifact->clearTimestamp(); artifact->product->topLevelProject()->buildData->setDirty(); } } static void removeArtifactFromDisk(Artifact *artifact, bool dryRun, const Logger &logger) { QFileInfo fileInfo(artifact->filePath()); if (!FileInfo::fileExists(fileInfo)) { if (!dryRun) invalidateArtifactTimestamp(artifact); return; } printRemovalMessage(fileInfo.filePath(), dryRun, logger); if (dryRun) return; invalidateArtifactTimestamp(artifact); QString errorMessage; if (!removeFileRecursion(fileInfo, &errorMessage)) throw ErrorInfo(errorMessage); } class CleanupVisitor : public ArtifactVisitor { public: CleanupVisitor(CleanOptions options, const ProgressObserver *observer, Logger logger) : ArtifactVisitor(Artifact::Generated) , m_options(std::move(options)) , m_observer(observer) , m_logger(std::move(logger)) , m_hasError(false) { } void visitProduct(const ResolvedProductPtr &product) { m_product = product; ArtifactVisitor::visitProduct(product); const AllRescuableArtifactData rescuableArtifactData = product->buildData->rescuableArtifactData(); for (auto it = rescuableArtifactData.begin(); it != rescuableArtifactData.end(); ++it) { Artifact tmp; tmp.product = product; tmp.setFilePath(it.key()); tmp.setTimestamp(it.value().timeStamp); removeArtifactFromDisk(&tmp, m_options.dryRun(), m_logger); product->buildData->removeFromRescuableArtifactData(it.key()); } } const Set &directories() const { return m_directories; } bool hasError() const { return m_hasError; } private: void doVisit(Artifact *artifact) override { if (m_observer->canceled()) throw ErrorInfo(Tr::tr("Cleaning up was canceled.")); if (artifact->product != m_product) return; try { removeArtifactFromDisk(artifact, m_options.dryRun(), m_logger); } catch (const ErrorInfo &error) { if (!m_options.keepGoing()) throw; m_logger.printError(error); m_hasError = true; } m_directories << artifact->dirPath(); } const CleanOptions m_options; const ProgressObserver * const m_observer; Logger m_logger; bool m_hasError; ResolvedProductConstPtr m_product; Set m_directories; }; ArtifactCleaner::ArtifactCleaner(Logger logger, ProgressObserver *observer) : m_logger(std::move(logger)), m_observer(observer) { } void ArtifactCleaner::cleanup(const TopLevelProjectPtr &project, const QVector &products, const CleanOptions &options) { m_hasError = false; const QString configString = Tr::tr(" for configuration %1").arg(project->id()); m_observer->initialize(Tr::tr("Cleaning up%1").arg(configString), products.size() + 1); Set directories; for (const ResolvedProductPtr &product : products) { CleanupVisitor visitor(options, m_observer, m_logger); visitor.visitProduct(product); directories.unite(visitor.directories()); if (visitor.hasError()) m_hasError = true; m_observer->incrementProgressValue(); } // Directories created during the build are not artifacts (TODO: should they be?), // so we have to clean them up manually. auto dirList = rangeTo(directories); for (int i = 0; i < dirList.size(); ++i) { const QString &dir = dirList.at(i); if (!dir.startsWith(project->buildDirectory)) continue; if (FileInfo(dir).exists()) removeEmptyDirectories(dir, options); if (dir != project->buildDirectory) { const QString parentDir = QDir::cleanPath(dir + StringConstants::slashDotDot()); if (parentDir != project->buildDirectory && !dirList.contains(parentDir)) dirList.push_back(parentDir); } } m_observer->incrementProgressValue(); if (m_hasError) throw ErrorInfo(Tr::tr("Failed to remove some files.")); m_observer->setFinished(); } void ArtifactCleaner::removeEmptyDirectories(const QString &rootDir, const CleanOptions &options, bool *isEmpty) { bool subTreeIsEmpty = true; QDirIterator it(rootDir, QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoDotAndDotDot); while (it.hasNext()) { it.next(); if (!it.fileInfo().isSymLink() && it.fileInfo().isDir()) removeEmptyDirectories(it.filePath(), options, &subTreeIsEmpty); else subTreeIsEmpty = false; } if (subTreeIsEmpty) { printRemovalMessage(rootDir, options.dryRun(), m_logger); if (!QDir::root().rmdir(rootDir)) { ErrorInfo error(Tr::tr("Failure to remove empty directory '%1'.").arg(rootDir)); if (!options.keepGoing()) throw error; m_logger.printError(error); m_hasError = true; subTreeIsEmpty = false; } } if (!subTreeIsEmpty && isEmpty) *isEmpty = false; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/nodetreedumper.h0000644000175100017510000000546015154533055022777 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_NODETREEDUMPER_H #define QBS_NODETREEDUMPER_H #include "artifact.h" #include "buildgraphvisitor.h" #include #include QT_BEGIN_NAMESPACE class QIODevice; QT_END_NAMESPACE namespace qbs { namespace Internal { class NodeTreeDumper : public BuildGraphVisitor { public: NodeTreeDumper(QIODevice &outDevice); void start(const QVector &products); private: bool visit(Artifact *artifact) override; void endVisit(Artifact *artifact) override; bool visit(RuleNode *rule) override; void endVisit(RuleNode *rule) override; void doEndVisit(); void indent(); void unindent(); bool doVisit(BuildGraphNode *node, const QString &nodeRepr); QByteArray indentation() const; QIODevice &m_outDevice; ResolvedProductPtr m_currentProduct; NodeSet m_visited; int m_indentation = 0; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/buildgraph/cycledetector.cpp0000644000175100017510000000671215154533055023142 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "cycledetector.h" #include "artifact.h" #include "buildgraph.h" #include "projectbuilddata.h" #include "rulenode.h" #include #include #include #include namespace qbs { namespace Internal { CycleDetector::CycleDetector(Logger logger) : m_parent(nullptr), m_logger(std::move(logger)) { } void CycleDetector::visitProject(const TopLevelProjectConstPtr &project) { project->accept(this); } void CycleDetector::visitProduct(const ResolvedProductConstPtr &product) { product->accept(this); } bool CycleDetector::visit(Artifact *artifact) { return visitNode(artifact); } bool CycleDetector::visit(RuleNode *ruleNode) { return visitNode(ruleNode); } bool CycleDetector::visitNode(BuildGraphNode *node) { if (Q_UNLIKELY(m_nodesInCurrentPath.contains(node))) { ErrorInfo error(Tr::tr("Cycle in build graph detected.")); const auto nodes = cycle(node); for (const BuildGraphNode * const n : nodes) error.append(n->toString()); throw error; } if (m_allNodes.contains(node)) return false; m_nodesInCurrentPath += node; m_parent = node; for (BuildGraphNode * const child : std::as_const(node->children)) child->accept(this); m_nodesInCurrentPath -= node; m_allNodes += node; return false; } QList CycleDetector::cycle(BuildGraphNode *doubleEntry) { QList path; findPath(doubleEntry, m_parent, path); path.push_back(doubleEntry); return path; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/buildgraphnode.cpp0000644000175100017510000000556715154533055023307 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "buildgraphnode.h" #include "buildgraphvisitor.h" #include "projectbuilddata.h" #include #include #include #include #include namespace qbs { namespace Internal { BuildGraphNode::BuildGraphNode() : buildState(Untouched) { } BuildGraphNode::~BuildGraphNode() { for (BuildGraphNode *p : std::as_const(parents)) p->children.remove(this); for (BuildGraphNode *c : std::as_const(children)) c->parents.remove(this); } void BuildGraphNode::onChildDisconnected(BuildGraphNode *child) { Q_UNUSED(child); } void BuildGraphNode::acceptChildren(BuildGraphVisitor *visitor) { for (BuildGraphNode *child : std::as_const(children)) child->accept(visitor); } void BuildGraphNode::load(PersistentPool &pool) { serializationOp(pool); } void BuildGraphNode::store(PersistentPool &pool) { serializationOp(pool); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/projectbuilddata.h0000644000175100017510000001175615154533055023302 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROJECTBUILDDATA_H #define QBS_PROJECTBUILDDATA_H #include "forward_decls.h" #include "rawscanresults.h" #include #include #include #include #include #include #include namespace qbs { namespace Internal { class BuildGraphNode; class FileDependency; class FileResourceBase; class ScriptEngine; class QBS_AUTOTEST_EXPORT ProjectBuildData { public: ProjectBuildData(const ProjectBuildData *other = nullptr); ~ProjectBuildData(); static QString deriveBuildGraphFilePath(const QString &buildDir, const QString &projectId); void insertIntoLookupTable(FileResourceBase *fileres); void removeFromLookupTable(FileResourceBase *fileres); const std::vector &lookupFiles(const QString &filePath) const; const std::vector &lookupFiles(const QString &dirPath, const QString &fileName) const; const std::vector &lookupFiles(const Artifact *artifact) const; void insertFileDependency(FileDependency *dependency); void removeArtifactAndExclusiveDependents(Artifact *artifact, const Logger &logger, bool removeFromProduct = true, ArtifactSet *removedArtifacts = nullptr); void removeArtifact(Artifact *artifact, const Logger &logger, bool removeFromDisk = true, bool removeFromProduct = true); void setDirty(); void setClean(); bool isDirty() const { return m_isDirty; } Set fileDependencies; RawScanResults rawScanResults; // do not serialize: RulesEvaluationContextPtr evaluationContext; void load(PersistentPool &pool); void store(PersistentPool &pool); private: template void serializationOp(PersistentPool &pool) { pool.serializationOp(fileDependencies, rawScanResults); } using ArtifactKey = std::pair; using ArtifactLookupTable = std::unordered_map>; ArtifactLookupTable m_artifactLookupTable; bool m_doCleanupInDestructor = true; bool m_isDirty = true; }; class BuildDataResolver { public: BuildDataResolver(Logger logger, const SetupProjectParameters ¶meters); void resolveBuildData(const TopLevelProjectPtr &resolvedProject, const RulesEvaluationContextPtr &evalContext); void resolveProductBuildDataForExistingProject(const TopLevelProjectPtr &project, const std::vector &freshProducts); private: void resolveProductBuildData(const ResolvedProductPtr &product); void connectRulesToDependencies(const ResolvedProductPtr &product, const std::vector &dependencies); RulesEvaluationContextPtr evalContext() const; ScriptEngine *engine() const; JSValue scope() const; TopLevelProjectPtr m_project; Logger m_logger; const SetupProjectParameters &m_parameters; }; } // namespace Internal } // namespace qbs #endif // QBS_PROJECTBUILDDATA_H qbs-src-3.2.0/src/lib/corelib/buildgraph/requestedartifacts.cpp0000644000175100017510000001701215154533055024206 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #include "requestedartifacts.h" #include "productbuilddata.h" #include #include #include #include #include #include namespace qbs { namespace Internal { bool RequestedArtifacts::isUpToDate(const TopLevelProject *project) const { if (m_requestedArtifactsPerProduct.empty()) return true; const std::vector &allProducts = project->allProducts(); for (const auto &kv : m_requestedArtifactsPerProduct) { const QString &productName = kv.first; const auto findProduct = [productName](const ResolvedProductConstPtr &p) { return p->uniqueName() == productName; }; const auto productIt = std::find_if(allProducts.begin(), allProducts.end(), findProduct); if (productIt == allProducts.end()) { qCDebug(lcBuildGraph) << "artifacts map not up to date: product" << productName << "does not exist anymore"; return false; } if (!kv.second.isUpToDate(productIt->get())) return false; } return true; } void RequestedArtifacts::setAllArtifactTags(const ResolvedProduct *product, bool forceUpdate) { RequestedArtifactsPerProduct &ra = m_requestedArtifactsPerProduct[product->uniqueName()]; if (!ra.allTags.empty() && !forceUpdate) return; ra.allTags.clear(); const ArtifactSetByFileTag artifactsMap = product->buildData->artifactsByFileTag(); for (auto it = artifactsMap.begin(); it != artifactsMap.end(); ++it) ra.allTags.insert(it.key().toString()); } void RequestedArtifacts::setArtifactsForTag(const ResolvedProduct *product, const FileTag &tag) { RequestedArtifactsPerProduct &ra = m_requestedArtifactsPerProduct[product->uniqueName()]; QBS_ASSERT(!ra.allTags.empty(), ;); Set &filePaths = ra.requestedTags[tag.toString()]; for (const Artifact * const a : product->buildData->artifactsByFileTag().value(tag)) filePaths.insert(a->filePath()); } void RequestedArtifacts::setNonExistingTagRequested(const ResolvedProduct *product, const QString &tag) { RequestedArtifactsPerProduct &ra = m_requestedArtifactsPerProduct[product->uniqueName()]; QBS_ASSERT(!ra.allTags.empty(), ;); Set &filePaths = ra.requestedTags[tag]; QBS_CHECK(filePaths.empty()); } void RequestedArtifacts::setArtifactsEnumerated(const ResolvedProduct *product) { m_requestedArtifactsPerProduct[product->uniqueName()].artifactsEnumerated = true; } void RequestedArtifacts::unite(const RequestedArtifacts &other) { for (const auto &kv : other.m_requestedArtifactsPerProduct) m_requestedArtifactsPerProduct[kv.first].unite(kv.second); } void RequestedArtifacts::doSanityChecks() const { for (const auto &kv : m_requestedArtifactsPerProduct) kv.second.doSanityChecks(); } void RequestedArtifacts::load(PersistentPool &pool) { serializationOp(pool); } void RequestedArtifacts::store(PersistentPool &pool) { serializationOp(pool); } bool RequestedArtifacts::RequestedArtifactsPerProduct::isUpToDate( const ResolvedProduct *product) const { if (!product->buildData) { qCDebug(lcBuildGraph) << "artifacts map not up to date: product" << product->uniqueName() << "is now disabled"; return false; } if (!artifactsEnumerated && requestedTags.empty()) return true; const ArtifactSetByFileTag currentArtifacts = product->buildData->artifactsByFileTag(); for (const auto &kv : requestedTags) { const FileTag tag = FileTag(kv.first.toUtf8()); const auto currentIt = currentArtifacts.constFind(tag); Set currentFilePathsForTag; if (currentIt != currentArtifacts.constEnd()) { for (const Artifact * const a : currentIt.value()) currentFilePathsForTag.insert(a->filePath()); } if (currentFilePathsForTag != kv.second) { qCDebug(lcBuildGraph) << "artifacts map not up to date: requested artifact set for " "file tag" << kv.first << "in product" << product->uniqueName() << "differs from the current one"; return false; } } if (!artifactsEnumerated) return true; Set currentTags; for (auto it = currentArtifacts.begin(); it != currentArtifacts.end(); ++it) currentTags.insert(it.key().toString()); if (currentTags != allTags) { qCDebug(lcBuildGraph) << "artifacts map not up to date: overall file tags differ for " << "product" << product->uniqueName(); return false; } return true; } void RequestedArtifacts::RequestedArtifactsPerProduct::unite( const RequestedArtifactsPerProduct &other) { if (allTags.empty()) { *this = other; return; } allTags = other.allTags; for (const auto &kv : other.requestedTags) requestedTags[kv.first] = kv.second; } void RequestedArtifacts::RequestedArtifactsPerProduct::doSanityChecks() const { for (const auto &kv : requestedTags) QBS_CHECK(allTags.contains(kv.first) || kv.second.empty()); } void RequestedArtifacts::RequestedArtifactsPerProduct::load(PersistentPool &pool) { serializationOp(pool); } void RequestedArtifacts::RequestedArtifactsPerProduct::store(PersistentPool &pool) { serializationOp(pool); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/buildgraphvisitor.h0000644000175100017510000000475215154533055023521 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_BUILDGRAPHVISITOR_H #define QBS_BUILDGRAPHVISITOR_H namespace qbs { namespace Internal { class Artifact; class RuleNode; /*! * \brief The BuildGraphVisitor class * * The return value of a visit method indicates whether the children of the current node * are to be visited next. */ class BuildGraphVisitor { public: virtual ~BuildGraphVisitor() = default; virtual bool visit(Artifact *) { return true; } virtual void endVisit(Artifact *) { } virtual bool visit(RuleNode *) { return true; } virtual void endVisit(RuleNode *) { } }; } // namespace Internal } // namespace qbs #endif // QBS_BUILDGRAPHVISITOR_H qbs-src-3.2.0/src/lib/corelib/buildgraph/artifact.h0000644000175100017510000001340115154533055021544 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ARTIFACT_H #define QBS_ARTIFACT_H #include "filedependency.h" #include "buildgraphnode.h" #include "forward_decls.h" #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class Logger; class Artifact; using ArtifactSet = Set; /** * The Artifact class * * Let artifact P be the parent of artifact C. Thus C is child of P. * C produces P using the transformer P.transformer. * * */ class QBS_AUTOTEST_EXPORT Artifact : public FileResourceBase, public BuildGraphNode { public: Artifact(); ~Artifact() override; Type type() const override { return ArtifactNodeType; } FileType fileType() const override { return FileTypeArtifact; } void accept(BuildGraphVisitor *visitor) override; QString toString() const override; void addFileTag(const FileTag &t); void removeFileTag(const FileTag &t); void setFileTags(const FileTags &newFileTags); const FileTags &fileTags() const { return m_fileTags; } RuleNode *producer() const; ArtifactSet childrenAddedByScanner; Set fileDependencies; TransformerPtr transformer; PropertyMapPtr properties; QString targetOfModule; // The tags set directly via an Artifact item or an outputArtifacts script, // not the result of file taggers or fileTagsFilter groups, nor the ones inherited from // the product. FileTags pureFileTags; // The properties attached directly to an artifact in an Artifact item or outputArtifacts // script. std::vector> pureProperties; enum ArtifactType { Unknown = 1, SourceFile = 2, Generated = 4 }; ArtifactType artifactType; bool inputsScanned : 1; // Do not serialize. Will be refreshed for every build. bool timestampRetrieved : 1; // Do not serialize. Will be refreshed for every build. bool alwaysUpdated : 1; bool oldDataPossiblyPresent : 1; const TypeFilter parentArtifacts() const; const TypeFilter childArtifacts() const; void onChildDisconnected(BuildGraphNode *child) override; bool isTargetOfModule() const { return !targetOfModule.isEmpty(); } void load(PersistentPool &pool) override; void store(PersistentPool &pool) override; using Deregister = std::function; void setDeregister(const Deregister &deregister) { m_deregister = deregister; } private: FileTags m_fileTags; Deregister m_deregister; }; template<> inline QString Set::toString(Artifact * const &artifact) const { return artifact ? artifact->filePath() : QStringLiteral(""); } template<> inline const void *uniqueAddress(const Artifact *a) { return static_cast(a); } template<> inline bool hasDynamicType(const BuildGraphNode *n) { return n->type() == BuildGraphNode::ArtifactNodeType; } // debugging helper inline QString toString(Artifact::ArtifactType t) { switch (t) { case Artifact::SourceFile: return QStringLiteral("SourceFile"); case Artifact::Generated: return QStringLiteral("Generated"); case Artifact::Unknown: default: return QStringLiteral("Unknown"); } } // debugging helper inline QString toString(BuildGraphNode::BuildState s) { switch (s) { case BuildGraphNode::Untouched: return QStringLiteral("Untouched"); case BuildGraphNode::Buildable: return QStringLiteral("Buildable"); case BuildGraphNode::Building: return QStringLiteral("Building"); case BuildGraphNode::Built: return QStringLiteral("Built"); default: return QStringLiteral("Unknown"); } } } // namespace Internal } // namespace qbs #endif // QBS_ARTIFACT_H qbs-src-3.2.0/src/lib/corelib/buildgraph/rulesevaluationcontext.cpp0000644000175100017510000001030715154533055025133 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "rulesevaluationcontext.h" #include "rulecommands.h" #include #include #include #include #include #include #include namespace qbs { namespace Internal { RulesEvaluationContext::RulesEvaluationContext(Logger logger) : m_logger(std::move(logger)), m_engine(ScriptEngine::create(m_logger, EvalContext::RuleExecution)), m_observer(nullptr), m_initScopeCalls(0), m_prepareScriptScope(m_engine->newObject()) { JS_SetPrototype(m_engine->context(), m_prepareScriptScope, m_engine->globalObject()); ProcessCommand::setupForJavaScript(m_engine.get(), m_prepareScriptScope); JavaScriptCommand::setupForJavaScript(m_engine.get(), m_prepareScriptScope); } RulesEvaluationContext::~RulesEvaluationContext() { JS_FreeValue(m_engine->context(), m_prepareScriptScope); } void RulesEvaluationContext::initializeObserver(const QString &description, int maximumProgress) { if (m_observer) m_observer->initialize(description, maximumProgress); } void RulesEvaluationContext::incrementProgressValue() { if (m_observer) m_observer->incrementProgressValue(); } void RulesEvaluationContext::checkForCancelation() { if (Q_UNLIKELY(m_observer && m_observer->canceled())) throw ErrorInfo(Tr::tr("Build canceled.")); } void RulesEvaluationContext::initScope() { if (m_initScopeCalls++ > 0) return; m_engine->setActive(true); m_scope = m_engine->newObject(); JS_SetPrototype(m_engine->context(), m_scope, m_prepareScriptScope); m_engine->setGlobalObject(m_scope); } void RulesEvaluationContext::cleanupScope() { QBS_CHECK(m_initScopeCalls > 0); if (--m_initScopeCalls > 0) return; JS_FreeValue(m_engine->context(), m_scope); m_scope = JS_UNDEFINED; const ScopedJsValue proto(engine()->context(), JS_GetPrototype(m_engine->context(), m_prepareScriptScope)); m_engine->setGlobalObject(proto); m_engine->setActive(false); } RulesEvaluationContext::Scope::Scope(RulesEvaluationContext *evalContext) : m_evalContext(evalContext) { evalContext->initScope(); } RulesEvaluationContext::Scope::~Scope() { m_evalContext->cleanupScope(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/projectbuilddata.cpp0000644000175100017510000004300215154533055023622 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "projectbuilddata.h" #include "artifact.h" #include "buildgraph.h" #include "buildgraphvisitor.h" #include "productbuilddata.h" #include "rulecommands.h" #include "rulegraph.h" #include "rulenode.h" #include "rulesevaluationcontext.h" #include "transformer.h" #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { static Set findDependentProducts(const ResolvedProductPtr &product) { Set result; for (const ResolvedProductPtr &parent : product->topLevelProject()->allProducts()) { if (parent->hasDependency(product)) result += parent; } return result; } ProjectBuildData::ProjectBuildData(const ProjectBuildData *other) { // This is needed for temporary duplication of build data when doing change tracking. if (other) { *this = *other; m_doCleanupInDestructor = false; } } ProjectBuildData::~ProjectBuildData() { if (!m_doCleanupInDestructor) return; qDeleteAll(fileDependencies); } QString ProjectBuildData::deriveBuildGraphFilePath(const QString &buildDir, const QString &projectId) { return buildDir + QLatin1Char('/') + projectId + QStringLiteral(".bg"); } void ProjectBuildData::insertIntoLookupTable(FileResourceBase *fileres) { auto &lst = m_artifactLookupTable[{fileres->fileName(), fileres->dirPath()}]; const auto * const artifact = fileres->fileType() == FileResourceBase::FileTypeArtifact ? static_cast(fileres) : nullptr; if (artifact && artifact->artifactType == Artifact::Generated) { for (const auto *file : lst) { if (file->fileType() != FileResourceBase::FileTypeArtifact) continue; const auto * const otherArtifact = static_cast(file); ErrorInfo error; error.append(Tr::tr("Conflicting artifacts for file path '%1'.") .arg(artifact->filePath())); error.append(Tr::tr("The first artifact comes from product '%1'.") .arg(otherArtifact->product->fullDisplayName()), otherArtifact->product->location); error.append(Tr::tr("The second artifact comes from product '%1'.") .arg(artifact->product->fullDisplayName()), artifact->product->location); throw error; } } QBS_CHECK(!contains(lst, fileres)); lst.push_back(fileres); m_isDirty = true; } void ProjectBuildData::removeFromLookupTable(FileResourceBase *fileres) { removeOne(m_artifactLookupTable[{fileres->fileName(), fileres->dirPath()}], fileres); } const std::vector &ProjectBuildData::lookupFiles(const QString &filePath) const { QString dirPath, fileName; FileInfo::splitIntoDirectoryAndFileName(filePath, &dirPath, &fileName); return lookupFiles(dirPath, fileName); } const std::vector &ProjectBuildData::lookupFiles(const QString &dirPath, const QString &fileName) const { static const std::vector emptyResult; const auto it = m_artifactLookupTable.find({fileName, dirPath}); return it != m_artifactLookupTable.end() ? it->second : emptyResult; } const std::vector &ProjectBuildData::lookupFiles(const Artifact *artifact) const { return lookupFiles(artifact->dirPath(), artifact->fileName()); } void ProjectBuildData::insertFileDependency(FileDependency *dependency) { fileDependencies += dependency; insertIntoLookupTable(dependency); } static void disconnectArtifactChildren(Artifact *artifact) { qCDebug(lcBuildGraph) << "disconnect children of" << relativeArtifactFileName(artifact); for (BuildGraphNode * const child : std::as_const(artifact->children)) child->parents.remove(artifact); artifact->children.clear(); artifact->childrenAddedByScanner.clear(); } static void disconnectArtifactParents(Artifact *artifact) { qCDebug(lcBuildGraph) << "disconnect parents of" << relativeArtifactFileName(artifact); for (BuildGraphNode * const parent : std::as_const(artifact->parents)) { parent->children.remove(artifact); if (parent->type() != BuildGraphNode::ArtifactNodeType) continue; auto const parentArtifact = static_cast(parent); QBS_CHECK(parentArtifact->transformer); parentArtifact->childrenAddedByScanner.remove(artifact); parentArtifact->transformer->inputs.remove(artifact); parentArtifact->transformer->explicitlyDependsOn.remove(artifact); } artifact->parents.clear(); } static void disconnectArtifact(Artifact *artifact) { disconnectArtifactChildren(artifact); disconnectArtifactParents(artifact); } /*! * Removes the artifact and all the artifacts that depend exclusively on it. * Example: if you remove a cpp artifact then the obj artifact is removed but * not the resulting application (if there's more then one cpp artifact). */ void ProjectBuildData::removeArtifactAndExclusiveDependents(Artifact *artifact, const Logger &logger, bool removeFromProduct, ArtifactSet *removedArtifacts) { if (removedArtifacts) removedArtifacts->insert(artifact); // Iterate over a copy of the artifact's parents, because we'll change // artifact->parents with the disconnect call. const NodeSet parentsCopy = artifact->parents; for (Artifact *parent : filterByType(parentsCopy)) { bool removeParent = false; disconnect(parent, artifact); if (parent->children.empty()) { removeParent = true; } else if (parent->transformer) { parent->transformer->inputs.remove(artifact); removeParent = parent->transformer->inputs.empty(); } if (removeParent) { removeArtifactAndExclusiveDependents(parent, logger, removeFromProduct, removedArtifacts); } else { parent->clearTimestamp(); } } const bool removeFromDisk = artifact->artifactType == Artifact::Generated; removeArtifact(artifact, logger, removeFromDisk, removeFromProduct); } static void removeFromRuleNodes(Artifact *artifact) { for (RuleNode * const ruleNode : filterByType(artifact->parents)) ruleNode->removeOldInputArtifact(artifact); } void ProjectBuildData::removeArtifact(Artifact *artifact, const Logger &logger, bool removeFromDisk, bool removeFromProduct) { qCDebug(lcBuildGraph) << "remove artifact" << relativeArtifactFileName(artifact); if (removeFromDisk) removeGeneratedArtifactFromDisk(artifact, logger); removeFromLookupTable(artifact); removeFromRuleNodes(artifact); disconnectArtifact(artifact); if (artifact->transformer) artifact->transformer->outputs.remove(artifact); if (removeFromProduct) artifact->product->buildData->removeArtifact(artifact); } void ProjectBuildData::setDirty() { qCDebug(lcBuildGraph) << "Marking build graph as dirty"; m_isDirty = true; } void ProjectBuildData::setClean() { qCDebug(lcBuildGraph) << "Marking build graph as clean"; m_isDirty = false; } void ProjectBuildData::load(PersistentPool &pool) { serializationOp(pool); for (FileDependency * const dep : std::as_const(fileDependencies)) insertIntoLookupTable(dep); m_isDirty = false; } void ProjectBuildData::store(PersistentPool &pool) { serializationOp(pool); } BuildDataResolver::BuildDataResolver(Logger logger, const SetupProjectParameters ¶meters) : m_logger(std::move(logger)) , m_parameters(parameters) { } void BuildDataResolver::resolveBuildData(const TopLevelProjectPtr &resolvedProject, const RulesEvaluationContextPtr &evalContext) { QBS_CHECK(!resolvedProject->buildData); m_project = resolvedProject; resolvedProject->buildData = std::make_unique(); resolvedProject->buildData->evaluationContext = evalContext; const std::vector &allProducts = resolvedProject->allProducts(); evalContext->initializeObserver(Tr::tr("Setting up build graph for configuration %1") .arg(resolvedProject->id()), int(allProducts.size()) + 1); for (const auto &rProduct : allProducts) { if (rProduct->enabled) resolveProductBuildData(rProduct); evalContext->incrementProgressValue(); } evalContext->incrementProgressValue(); doSanityChecks(resolvedProject, m_logger); } void BuildDataResolver::resolveProductBuildDataForExistingProject(const TopLevelProjectPtr &project, const std::vector &freshProducts) { m_project = project; for (const ResolvedProductPtr &product : freshProducts) { if (product->enabled) resolveProductBuildData(product); } QHash> dependencyMap; for (const ResolvedProductPtr &product : freshProducts) { if (!product->enabled) continue; QBS_CHECK(product->buildData); const Set dependents = findDependentProducts(product); for (const ResolvedProductPtr &dependentProduct : dependents) { if (!dependentProduct->enabled) continue; if (!contains(dependencyMap[dependentProduct], product)) dependencyMap[dependentProduct].push_back(product); } } for (auto it = dependencyMap.cbegin(); it != dependencyMap.cend(); ++it) { if (!contains(freshProducts, it.key())) connectRulesToDependencies(it.key(), it.value()); } } class CreateRuleNodes : public RuleGraphVisitor { public: CreateRuleNodes(const ResolvedProductPtr &product) : m_product(product) { } private: const ResolvedProductPtr &m_product; QHash m_nodePerRule; Set m_rulesOnPath; QList m_rulePath; void visit(const RuleConstPtr &parentRule, const RuleConstPtr &rule) override { if (!m_rulesOnPath.insert(rule.get()).second) { QString pathstr; for (const Rule *r : std::as_const(m_rulePath)) { pathstr += QLatin1Char('\n') + r->toString() + QLatin1Char('\t') + r->prepareScript.location().toString(); } throw ErrorInfo(Tr::tr("Cycle detected in rule dependencies: %1").arg(pathstr)); } m_rulePath.push_back(rule.get()); RuleNode *node = m_nodePerRule.value(rule); if (!node) { node = new RuleNode; m_nodePerRule.insert(rule, node); node->product = m_product; node->setRule(rule); m_product->buildData->addNode(node); qCDebug(lcBuildGraph).noquote() << "create" << node->toString() << "for product" << m_product->uniqueName(); } if (parentRule) { RuleNode *parent = m_nodePerRule.value(parentRule); QBS_CHECK(parent); connect(parent, node); } else { m_product->buildData->addRootNode(node); } } void endVisit(const RuleConstPtr &rule) override { m_rulesOnPath.remove(rule.get()); m_rulePath.removeLast(); } }; static bool areRulesCompatible(const RuleNode *ruleNode, const RuleNode *dependencyRule) { const FileTags outTags = dependencyRule->rule()->collectedOutputFileTags(); if (ruleNode->rule()->excludedInputs.intersects(outTags)) return false; if (ruleNode->rule()->inputsFromDependencies.intersects(outTags)) return true; if (ruleNode->rule()->explicitlyDependsOnFromDependencies.intersects(outTags)) return true; return ruleNode->rule()->auxiliaryInputsFromDependencies.intersects(outTags); } void BuildDataResolver::resolveProductBuildData(const ResolvedProductPtr &product) { if (product->buildData) return; evalContext()->checkForCancelation(); product->buildData = std::make_unique(); ArtifactSetByFileTag artifactsPerFileTag; for (const auto &dependency : std::as_const(product->dependencies)) { if (!dependency.product->enabled) { QBS_CHECK(m_parameters.productErrorMode() == ErrorHandlingMode::Relaxed); continue; } resolveProductBuildData(dependency.product); } //add qbsFile artifact Artifact *qbsFileArtifact = lookupArtifact(product, product->location.filePath()); if (!qbsFileArtifact) { qbsFileArtifact = new Artifact; qbsFileArtifact->artifactType = Artifact::SourceFile; qbsFileArtifact->setFilePath(product->location.filePath()); qbsFileArtifact->properties = product->moduleProperties; insertArtifact(product, qbsFileArtifact); } qbsFileArtifact->addFileTag("qbs"); artifactsPerFileTag["qbs"].insert(qbsFileArtifact); // read sources for (const auto &sourceArtifact : product->allEnabledFiles()) { QString filePath = sourceArtifact->absoluteFilePath; if (lookupArtifact(product, filePath)) continue; // ignore duplicate artifacts Artifact *artifact = createArtifact(product, sourceArtifact); for (const FileTag &fileTag : artifact->fileTags()) artifactsPerFileTag[fileTag].insert(artifact); } RuleGraph ruleGraph; ruleGraph.build(product->rules, product->fileTags); CreateRuleNodes crn(product); ruleGraph.accept(&crn); connectRulesToDependencies(product, product->depsAsProductList()); } static bool isRootRuleNode(RuleNode *ruleNode) { return ruleNode->product->buildData->rootNodes().contains(ruleNode); } void BuildDataResolver::connectRulesToDependencies(const ResolvedProductPtr &product, const std::vector &dependencies) { // Connect the rules of this product to the compatible rules of all product dependencies. // Rules that take "installable" artifacts are connected to all root rules of product // dependencies. std::vector ruleNodes; for (RuleNode *ruleNode : filterByType(product->buildData->allNodes())) ruleNodes.push_back(ruleNode); for (const auto &dep : dependencies) { if (!dep->buildData) continue; for (RuleNode *depRuleNode : filterByType(dep->buildData->allNodes())) { for (RuleNode *ruleNode : ruleNodes) { static const FileTag installableTag("installable"); if (areRulesCompatible(ruleNode, depRuleNode) || ((ruleNode->rule()->inputsFromDependencies.contains(installableTag) || ruleNode->rule()->auxiliaryInputsFromDependencies.contains( installableTag) || ruleNode->rule()->explicitlyDependsOnFromDependencies.contains( installableTag)) && isRootRuleNode(depRuleNode))) { connect(ruleNode, depRuleNode); } } } } } RulesEvaluationContextPtr BuildDataResolver::evalContext() const { return m_project->buildData->evaluationContext; } ScriptEngine *BuildDataResolver::engine() const { return evalContext()->engine(); } JSValue BuildDataResolver::scope() const { return evalContext()->scope(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/executor.h0000644000175100017510000001651115154533055021612 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_BUILDGRAPHEXECUTOR_H #define QBS_BUILDGRAPHEXECUTOR_H #include "forward_decls.h" #include "buildgraphvisitor.h" #include #include #include #include #include #include #include #include #include QT_BEGIN_NAMESPACE class QTimer; QT_END_NAMESPACE namespace qbs { class ProcessResult; namespace Internal { class ExecutorJob; class FileTime; class InputArtifactScannerContext; class ProductInstaller; class ProgressObserver; class RuleNode; class Executor : public QObject, private BuildGraphVisitor { Q_OBJECT public: void build(); Executor(Logger logger, QObject *parent = nullptr); ~Executor() override; void setProject(const TopLevelProjectPtr &project); void setProducts(const QVector &productsToBuild); void setBuildOptions(const BuildOptions &buildOptions); void setProgressObserver(ProgressObserver *observer) { m_progressObserver = observer; } ErrorInfo error() const { return m_error; } signals: void reportCommandDescription(const QString &highlight, const QString &message); void reportProcessResult(const qbs::ProcessResult &result); void finished(); private: void setupAuxiliaryProducts(); void onJobFinished(const qbs::ErrorInfo &err); void finish(); void checkForCancellation(); // BuildGraphVisitor implementation bool visit(Artifact *artifact) override; bool visit(RuleNode *ruleNode) override; enum ExecutorState { ExecutorIdle, ExecutorRunning, ExecutorCanceling }; struct ComparePriority { bool operator() (const BuildGraphNode *x, const BuildGraphNode *y) const; }; using Leaves = std::priority_queue, ComparePriority>; void doBuild(); void prepareAllNodes(); void syncFileDependencies(); void prepareArtifact(Artifact *artifact); void setupForBuildingSelectedFiles(const BuildGraphNode *node); void prepareReachableNodes(); void prepareReachableNodes_impl(BuildGraphNode *node); void prepareProducts(); void setupRootNodes(); void initLeaves(); void updateLeaves(const NodeSet &nodes); void updateLeaves(BuildGraphNode *node, NodeSet &seenNodes); bool scheduleJobs(); void buildArtifact(Artifact *artifact); void executeRuleNode(RuleNode *ruleNode); void finishJob(ExecutorJob *job, bool success); void finishNode(BuildGraphNode *leaf); void finishArtifact(Artifact *artifact); void setState(ExecutorState); void addExecutorJobs(); void cancelJobs(); void setupProgressObserver(); void doSanityChecks(); void handleError(const ErrorInfo &error); bool rescueOldBuildData(Artifact *artifact); bool checkForUnbuiltDependencies(Artifact *artifact); void potentiallyRunTransformer(const TransformerPtr &transformer); void runTransformer(const TransformerPtr &transformer); void finishTransformer(const TransformerPtr &transformer); void possiblyInstallArtifact(const Artifact *artifact); void checkForUnbuiltProducts(); bool checkNodeProduct(BuildGraphNode *node); bool mustExecuteTransformer(const TransformerPtr &transformer) const; bool isUpToDate(Artifact *artifact) const; void retrieveSourceFileTimestamp(Artifact *artifact) const; FileTime recursiveFileTime(const QString &filePath) const; QString configString() const; bool transformerHasMatchingOutputTags(const TransformerConstPtr &transformer) const; bool artifactHasMatchingOutputTags(const Artifact *artifact) const; bool transformerHasMatchingInputFiles(const TransformerConstPtr &transformer) const; void setupJobLimits(); void updateJobCounts(const Transformer *transformer, int diff); bool schedulingBlockedByJobLimit(const BuildGraphNode *node); using JobMap = QHash; JobMap m_processingJobs; ProductInstaller *m_productInstaller; RulesEvaluationContextPtr m_evalContext; BuildOptions m_buildOptions; Logger m_logger; ProgressObserver *m_progressObserver; std::vector> m_allJobs; QList m_availableJobs; ExecutorState m_state; TopLevelProjectPtr m_project; QVector m_primaryProducts; QVector m_buildableProducts; std::vector m_allProducts; std::unordered_map m_productsByName; std::unordered_map m_projectsByName; std::unordered_map m_jobCountPerPool; std::unordered_map m_jobLimitsPerProduct; std::unordered_map m_pendingTransformersPerRule; NodeSet m_roots; Leaves m_leaves; InputArtifactScannerContext *m_inputArtifactScanContext; ErrorInfo m_error; bool m_explicitlyCanceled = false; FileTags m_activeFileTags; FileTags m_tagsOfFilesToConsider; FileTags m_tagsNeededForFilesToConsider; QList m_productsOfFilesToConsider; QTimer * const m_cancelationTimer; QStringList m_artifactsRemovedFromDisk; bool m_partialBuild = false; qint64 m_elapsedTimeRules = 0; qint64 m_elapsedTimeScanners = 0; qint64 m_elapsedTimeInstalling = 0; }; } // namespace Internal } // namespace qbs #endif // QBS_BUILDGRAPHEXECUTOR_H qbs-src-3.2.0/src/lib/corelib/buildgraph/cppmodulesscanner.cpp0000644000175100017510000001314315154533055024032 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2024 Janet Black. ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com). ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "cppmodulesscanner.h" #include "artifact.h" #include "depscanner.h" #include "productbuilddata.h" #include "projectbuilddata.h" #include "rawscanresults.h" #include #include #include #include #include #include #include namespace qbs::Internal { static QString cppModulesScannerJsName() { return QStringLiteral("CppModulesScanner"); } CppModulesScanner::CppModulesScanner(ScriptEngine *engine, JSValue targetScriptValue) : m_engine(engine) , m_targetScriptValue(JS_DupValue(engine->context(), targetScriptValue)) { JSValue scannerObj = JS_NewObjectClass(engine->context(), engine->dataWithPtrClass()); attachPointerTo(scannerObj, this); setJsProperty(engine->context(), targetScriptValue, cppModulesScannerJsName(), scannerObj); JSValue applyFunction = JS_NewCFunction( engine->context(), &js_apply, qPrintable(cppModulesScannerJsName()), 1); setJsProperty(engine->context(), scannerObj, QStringLiteral("apply"), applyFunction); } CppModulesScanner::~CppModulesScanner() { setJsProperty( m_engine->context(), m_targetScriptValue, cppModulesScannerJsName(), JS_UNDEFINED); JS_FreeValue(m_engine->context(), m_targetScriptValue); } static RawScanResult runScannerForArtifact(const Artifact *artifact) { const QString &filepath = artifact->filePath(); RawScanResults &rawScanResults = artifact->product->topLevelProject()->buildData->rawScanResults; // TODO: use the same id for all c++ scanners? auto predicate = [](const PropertyMapConstPtr &, const PropertyMapConstPtr &) { return true; }; RawScanResults::ScanData &scanData = rawScanResults.findScanData( artifact, cppModulesScannerJsName(), artifact->properties, predicate); if (scanData.lastScanTime < artifact->timestamp()) { FileTags tags = artifact->fileTags(); if (tags.contains("cpp.combine")) { tags.remove("cpp.combine"); tags.insert("cpp"); } const QByteArray tagsForScanner = tags.toStringList().join(QLatin1Char(',')).toLatin1(); CppScannerContext context; const bool ok = scanCppFile( context, filepath, {tagsForScanner.data(), size_t(tagsForScanner.size())}, true, true); if (!ok) return scanData.rawScanResult; scanData.rawScanResult.providesModule = QString::fromUtf8(context.providesModule); scanData.rawScanResult.isInterfaceModule = context.isInterface; scanData.rawScanResult.requiresModules.clear(); for (const auto &module : context.requiresModules) scanData.rawScanResult.requiresModules += QString::fromUtf8(module); scanData.lastScanTime = FileTime::currentTime(); } return scanData.rawScanResult; } JSValue CppModulesScanner::js_apply(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) { if (argc < 1) return throwError(ctx, Tr::tr("CppModulesScanner.apply() requires an argument.")); ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const auto scanner = attachedPointer(this_val, engine->dataWithPtrClass()); return scanner->apply(engine, attachedPointer(argv[0], engine->dataWithPtrClass())); } JSValue CppModulesScanner::apply(ScriptEngine *engine, const Artifact *artifact) { JSContext * const ctx = m_engine->context(); if (!artifact) return JSValue{}; RawScanResult scanResult = runScannerForArtifact(artifact); JSValue obj = engine->newObject(); setJsProperty( ctx, obj, QStringLiteral("providesModule"), makeJsString(ctx, scanResult.providesModule)); setJsProperty( ctx, obj, QStringLiteral("isInterfaceModule"), JS_NewBool(ctx, scanResult.isInterfaceModule)); setJsProperty( ctx, obj, QStringLiteral("requiresModules"), makeJsStringList(ctx, scanResult.requiresModules)); engine->setUsesIo(); return obj; } } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/buildgraph/inputartifactscanner.h0000644000175100017510000001140515154533055024200 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_INPUTARTIFACTSCANNER_H #define QBS_INPUTARTIFACTSCANNER_H #include #include #include #include #include #include #include class ScannerPlugin; namespace qbs { namespace Internal { class Artifact; class FileResourceBase; class RawScanResult; class RawScanResults; class PropertyMapInternal; class DependencyScanner; using DependencyScannerPtr = std::shared_ptr; class ResolvedDependency { public: bool isValid() const { return !filePath.isNull(); } QString filePath; FileResourceBase *file = nullptr; }; class InputArtifactScannerContext { using ResolvedDependencyCacheItem = std::optional; using ResolvedDependenciesCache = QHash>; struct ScannerKeyCacheData { QStringList searchPaths; ResolvedDependenciesCache resolvedDependenciesCache; }; using ScannerKeyCacheItem = std::optional; using ScannerKeyCache = QHash; QHash cachePerProperties; QHash cachePerFile; using DependencyScannerCacheItem = std::optional>; QHash> scannersCache; friend class InputArtifactScanner; }; class InputArtifactScanner { public: InputArtifactScanner(Artifact *artifact, InputArtifactScannerContext *ctx, Logger logger); void scan(); bool newDependencyAdded() const { return m_newDependencyAdded; } private: void scanForFileDependencies(Artifact *inputArtifact); Set scannersForArtifact(const Artifact *artifact) const; void scanForScannerFileDependencies( DependencyScanner *scanner, Artifact *inputArtifact, FileResourceBase *fileToBeScanned, QList *filesToScan, InputArtifactScannerContext::ScannerKeyCacheItem &cache); void resolveScanResultDependencies( const Artifact *inputArtifact, const RawScanResult &scanResult, QList *artifactsToScan, InputArtifactScannerContext::ScannerKeyCacheData &cache); void handleDependency(ResolvedDependency &dependency); void scanWithScannerPlugin(DependencyScanner *scanner, Artifact *inputArtifact, FileResourceBase *fileToBeScanned, RawScanResult *scanResult); Artifact * const m_artifact; RawScanResults &m_rawScanResults; InputArtifactScannerContext *const m_context; QByteArray m_fileTagsForScanner; bool m_newDependencyAdded; Logger m_logger; }; } // namespace Internal } // namespace qbs #endif // QBS_INPUTARTIFACTSCANNER_H qbs-src-3.2.0/src/lib/corelib/buildgraph/rulenode.cpp0000644000175100017510000002767715154533055022143 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "rulenode.h" #include "buildgraph.h" #include "buildgraphvisitor.h" #include "productbuilddata.h" #include "projectbuilddata.h" #include "rulesapplicator.h" #include "transformer.h" #include "transformerchangetracking.h" #include #include #include #include #include namespace qbs { namespace Internal { RuleNode::RuleNode() = default; RuleNode::~RuleNode() = default; void RuleNode::accept(BuildGraphVisitor *visitor) { if (visitor->visit(this)) acceptChildren(visitor); visitor->endVisit(this); } QString RuleNode::toString() const { return QLatin1String("RULE ") + m_rule->toString() + QLatin1String(" [") + (!product.expired() ? product->name : QLatin1String("")) + QLatin1Char(']') + QLatin1String(" located at ") + m_rule->prepareScript.location().toString(); } RuleNode::ApplicationResult RuleNode::apply( const Logger &logger, const std::unordered_map &productsByName, const std::unordered_map &projectsByName) { ApplicationResult result; ArtifactSet allCompatibleInputs = currentInputArtifacts(); const ArtifactSet explicitlyDependsOn = RulesApplicator::collectExplicitlyDependsOn( m_rule.get(), product.get()); const ArtifactSet addedInputs = allCompatibleInputs - m_oldInputArtifacts; const ArtifactSet removedInputs = m_oldInputArtifacts - allCompatibleInputs; const ArtifactSet changedInputs = changedInputArtifacts( allCompatibleInputs, explicitlyDependsOn); bool upToDate = changedInputs.empty() && addedInputs.empty() && removedInputs.empty(); qCDebug(lcBuildGraph).noquote().nospace() << "consider " << (m_rule->isDynamic() ? "dynamic " : "") << (m_rule->multiplex ? "multiplex " : "") << "rule node " << m_rule->toString() << "\n\tchanged: " << changedInputs.toString() << "\n\tcompatible: " << allCompatibleInputs.toString() << "\n\tadded: " << addedInputs.toString() << "\n\tremoved: " << removedInputs.toString(); ArtifactSet inputs = changedInputs; if (m_rule->multiplex) inputs = allCompatibleInputs; else inputs += addedInputs; for (Artifact * const input : allCompatibleInputs) { for (const Artifact * const output : input->parentArtifacts()) { if (output->transformer->rule != m_rule) continue; if (prepareScriptNeedsRerun(output->transformer.get(), output->transformer->product().get(), productsByName, projectsByName)) { upToDate = false; inputs += input; } break; } if (m_rule->multiplex) break; } // Handle rules without inputs: We want to run such a rule if and only if it has not run yet // or its transformer is not up to date regarding the prepare script. if (upToDate && (!m_rule->declaresInputs() || !m_rule->requiresInputs) && inputs.empty()) { bool hasOutputs = false; for (const Artifact * const output : filterByType(parents)) { if (output->transformer->rule != m_rule) continue; hasOutputs = true; if (prepareScriptNeedsRerun(output->transformer.get(), output->transformer->product().get(), productsByName, projectsByName)) { upToDate = false; break; } if (m_rule->multiplex) break; } if (!hasOutputs) upToDate = false; } if (upToDate) { qCDebug(lcExec) << "rule is up to date. Skipping."; return result; } const bool mustApplyRule = !inputs.empty() || !m_rule->declaresInputs() || !m_rule->requiresInputs; // For a non-multiplex rule, the removal of an input always implies that the // corresponding outputs disappear. // For a multiplex rule, the outputs disappear only if *all* inputs are gone *and* // the rule requires inputs. This is exactly the opposite condition of whether to // re-apply the rule. const bool removedInputForcesOutputRemoval = !m_rule->multiplex || !mustApplyRule; ArtifactSet outputArtifactsToRemove; std::vector> connectionsToBreak; for (Artifact * const artifact : removedInputs) { if (!artifact) // dummy artifact continue; for (Artifact *parent : filterByType(artifact->parents)) { if (parent->transformer->rule != m_rule) { // parent was not created by our rule. continue; } // parent must always have a transformer, because it's generated. QBS_CHECK(parent->transformer); // Artifact is a former input of m_rule and parent was created by m_rule. // The inputs of the transformer must contain artifact, or it is a scanned dependency, // in which case it is not relevant here. if (!parent->transformer->inputs.contains(artifact)) { QBS_CHECK(parent->childrenAddedByScanner.contains(artifact)); continue; } if (removedInputForcesOutputRemoval) outputArtifactsToRemove += parent; else connectionsToBreak.emplace_back(parent, artifact); } disconnect(this, artifact); } for (const auto &connection : connectionsToBreak) disconnect(connection.first, connection.second); if (!outputArtifactsToRemove.empty()) { RulesApplicator::handleRemovedRuleOutputs( inputs, outputArtifactsToRemove, result.removedArtifacts, logger); } if (mustApplyRule) { RulesApplicator applicator(product.lock(), productsByName, projectsByName, logger); applicator.applyRule(this, inputs, explicitlyDependsOn); result.createdArtifacts = applicator.createdArtifacts(); result.invalidatedArtifacts = applicator.invalidatedArtifacts(); m_lastApplicationTime = FileTime::currentTime(); if (applicator.ruleUsesIo()) m_needsToConsiderChangedInputs = true; } else { qCDebug(lcExec).noquote() << "prepare script does not need to run"; } m_oldInputArtifacts = allCompatibleInputs; m_oldExplicitlyDependsOn = explicitlyDependsOn; product->topLevelProject()->buildData->setDirty(); return result; } void RuleNode::load(PersistentPool &pool) { BuildGraphNode::load(pool); serializationOp(pool); } void RuleNode::store(PersistentPool &pool) { BuildGraphNode::store(pool); serializationOp(pool); } int RuleNode::transformerCount() const { Set transformers; for (const Artifact * const output : filterByType(parents)) transformers.insert(output->transformer.get()); return int(transformers.size()); } ArtifactSet RuleNode::currentInputArtifacts() const { ArtifactSet s; for (const FileTag &t : std::as_const(m_rule->inputs)) { for (Artifact *artifact : product->lookupArtifactsByFileTag(t)) { if (artifact->isTargetOfModule()) continue; if (artifact->transformer && artifact->transformer->rule == m_rule) { // Do not add compatible artifacts as inputs that were created by this rule. // This can e.g. happen for the ["cpp", "hpp"] -> ["hpp", "cpp", "unmocable"] rule. continue; } if (artifact->fileTags().intersects(m_rule->excludedInputs)) continue; s += artifact; } } if (m_rule->inputsFromDependencies.empty()) return s; for (const FileTag &t : std::as_const(m_rule->inputsFromDependencies)) { for (Artifact *artifact : product->lookupArtifactsByFileTag(t)) { if (!artifact->isTargetOfModule()) continue; if (artifact->transformer && artifact->transformer->rule == m_rule) continue; if (artifact->fileTags().intersects(m_rule->excludedInputs)) continue; s += artifact; } } for (const auto &dep : std::as_const(product->dependencies)) { if (!dep.product->buildData) continue; for (Artifact * const a : filterByType(dep.product->buildData->allNodes())) { if (a->fileTags().intersects(m_rule->inputsFromDependencies) && !a->fileTags().intersects(m_rule->excludedInputs)) s += a; } } return s; } ArtifactSet RuleNode::changedInputArtifacts( const ArtifactSet &allCompatibleInputs, const ArtifactSet &explicitlyDependsOn) const { ArtifactSet changedInputArtifacts; if (explicitlyDependsOn != m_oldExplicitlyDependsOn) return allCompatibleInputs; if (!m_needsToConsiderChangedInputs) return changedInputArtifacts; for (Artifact * const artifact : explicitlyDependsOn) { if (artifact->timestamp() > m_lastApplicationTime) return allCompatibleInputs; } for (Artifact * const artifact : allCompatibleInputs) { if (artifact->timestamp() > m_lastApplicationTime) changedInputArtifacts.insert(artifact); } return changedInputArtifacts; } void RuleNode::removeOldInputArtifact(Artifact *artifact) { if (m_oldInputArtifacts.remove(artifact)) { qCDebug(lcBuildGraph) << "remove old input" << artifact->filePath() << "from rule" << rule()->toString(); m_oldInputArtifacts.insert(nullptr); } if (m_oldExplicitlyDependsOn.remove(artifact)) { qCDebug(lcBuildGraph) << "remove old explicitlyDependsOn" << artifact->filePath() << "from rule" << rule()->toString(); m_oldExplicitlyDependsOn.insert(nullptr); } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/processcommandexecutor.h0000644000175100017510000000667415154533055024561 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2019 Jochen Ulrich ** 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_PROCESSCOMMANDEXECUTOR_H #define QBS_PROCESSCOMMANDEXECUTOR_H #include "abstractcommandexecutor.h" #include #include namespace qbs { class ProcessResult; namespace Internal { class ProcessCommand; class ProcessCommandExecutor : public AbstractCommandExecutor { Q_OBJECT public: explicit ProcessCommandExecutor(const Internal::Logger &logger, QObject *parent = nullptr); void setProcessEnvironment(const QProcessEnvironment &processEnvironment) { m_buildEnvironment = processEnvironment; } signals: void reportProcessResult(const qbs::ProcessResult &result); private: void onProcessError(); void onProcessFinished(); void doSetup() override; void doReportCommandDescription(const QString &productName) override; bool doStart() override; void cancel(const qbs::ErrorInfo &reason) override; void startProcessCommand(); QString filterProcessOutput(const QByteArray &output, const QString &filterFunctionSource); void getProcessOutput(bool stdOut, ProcessResult &result); void sendProcessOutput(); void removeResponseFile(); ProcessCommand *processCommand() const; private: QString m_program; QStringList m_arguments; QString m_shellInvocation; QbsProcess m_process; QProcessEnvironment m_buildEnvironment; QProcessEnvironment m_commandEnvironment; QString m_responseFileName; qbs::ErrorInfo m_cancelReason; }; } // namespace Internal } // namespace qbs #endif // QBS_PROCESSCOMMANDEXECUTOR_H qbs-src-3.2.0/src/lib/corelib/buildgraph/environmentscriptrunner.cpp0000644000175100017510000002211015154533055025322 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "environmentscriptrunner.h" #include "buildgraph.h" #include "rulesevaluationcontext.h" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class EnvProvider { public: EnvProvider(ScriptEngine *engine, const QProcessEnvironment &originalEnv) : m_engine(engine), m_env(originalEnv) { QVariant v; v.setValue(&m_env); m_engine->setProperty(StringConstants::qbsProcEnvVarInternal(), v); } ~EnvProvider() { m_engine->setProperty(StringConstants::qbsProcEnvVarInternal(), QVariant()); } QProcessEnvironment alteredEnvironment() const { return m_env; } private: ScriptEngine * const m_engine; QProcessEnvironment m_env; }; static QList topSortModules(const QHash > &moduleChildren, const QList &modules, Set &seenModuleNames) { QList result; for (const ResolvedModule * const m : modules) { if (m->name.isNull()) continue; result << topSortModules(moduleChildren, moduleChildren.value(m), seenModuleNames); if (seenModuleNames.insert(m->name).second) result.push_back(m); } return result; } EnvironmentScriptRunner::EnvironmentScriptRunner(ResolvedProduct *product, RulesEvaluationContext *evalContext, const QProcessEnvironment &env) : m_product(product), m_evalContext(evalContext), m_env(env) { } void EnvironmentScriptRunner::setupForBuild() { // TODO: Won't this fail to take changed properties into account? We probably need // change tracking here as well. if (!m_product->buildEnvironment.isEmpty()) return; m_envType = BuildEnv; setupEnvironment(); } void EnvironmentScriptRunner::setupForRun(const QStringList &config) { m_envType = RunEnv; m_runEnvConfig = config; setupEnvironment(); } void EnvironmentScriptRunner::setupEnvironment() { const auto hasScript = [this](const ResolvedModuleConstPtr &m) { return !getScript(m.get()).sourceCode().isEmpty(); }; const bool hasAnyScripts = Internal::any_of(m_product->modules, hasScript); if (!hasAnyScripts) return; QMap moduleMap; for (const auto &module : m_product->modules) moduleMap.insert(module->name, module.get()); QHash > moduleParents; QHash > moduleChildren; for (const auto &module : m_product->modules) { for (const QString &moduleName : std::as_const(module->moduleDependencies)) { const ResolvedModule * const depmod = moduleMap.value(moduleName); QBS_ASSERT(depmod, return); moduleParents[depmod].push_back(module.get()); moduleChildren[module.get()].push_back(depmod); } } QList rootModules; for (const auto &module : m_product->modules) { if (moduleParents.value(module.get()).isEmpty()) { QBS_ASSERT(module, return); rootModules.push_back(module.get()); } } EnvProvider envProvider(engine(), m_env); Set seenModuleNames; const QList &topSortedModules = topSortModules(moduleChildren, rootModules, seenModuleNames); const QStringList scriptFunctionArgs = m_envType == BuildEnv ? ResolvedModule::argumentNamesForSetupBuildEnv() : ResolvedModule::argumentNamesForSetupRunEnv(); for (const ResolvedModule * const module : topSortedModules) { const PrivateScriptFunction &setupScript = getScript(module); if (setupScript.sourceCode().isEmpty()) continue; RulesEvaluationContext::Scope s(m_evalContext); JSContext * const ctx = engine()->context(); ScopedJsValue envScriptContext(ctx, JS_NewObjectProto(ctx, engine()->globalObject())); setupScriptEngineForProduct(engine(), m_product, module, envScriptContext, false); const QString &productKey = StringConstants::productVar(); const QString &projectKey = StringConstants::projectVar(); setJsProperty(ctx, m_evalContext->scope(), productKey, getJsProperty(ctx, envScriptContext, productKey)); setJsProperty(ctx, m_evalContext->scope(), projectKey, getJsProperty(ctx, envScriptContext, projectKey)); if (m_envType == RunEnv) { JSValue configArray = JS_NewArray(ctx); for (int i = 0; i < m_runEnvConfig.size(); ++i) JS_SetPropertyUint32(ctx, configArray, i, makeJsString(ctx, m_runEnvConfig.at(i))); JS_SetPropertyStr(ctx, m_evalContext->scope(), "config", configArray); } setupScriptEngineForFile(engine(), setupScript.fileContext(), m_evalContext->scope(), ObserveMode::Disabled); // TODO: Cache evaluate result ScopedJsValue fun(ctx, engine()->evaluate(JsValueOwner::Caller, setupScript.sourceCode(), setupScript.location().filePath(), setupScript.location().line())); QBS_CHECK(JS_IsFunction(ctx, fun)); const ScopedJsValueList svArgs = engine()->argumentList(scriptFunctionArgs, m_evalContext->scope()); JSValueList argsForFun = svArgs; JS_Call(ctx, fun, engine()->globalObject(), int(argsForFun.size()), argsForFun.data()); if (engine()->checkForJsError(setupScript.location())) { const QString scriptName = m_envType == BuildEnv ? StringConstants::setupBuildEnvironmentProperty() : StringConstants::setupRunEnvironmentProperty(); ErrorInfo err = engine()->getAndClearJsError(); err.prepend(Tr::tr("Error running %1 script for product '%2'") .arg(scriptName, m_product->fullDisplayName())); throw err; } } const QProcessEnvironment &newEnv = envProvider.alteredEnvironment(); if (m_envType == BuildEnv) m_product->buildEnvironment = newEnv; else m_product->runEnvironment = newEnv; } ScriptEngine *EnvironmentScriptRunner::engine() const { return m_evalContext->engine(); } const PrivateScriptFunction &EnvironmentScriptRunner::getScript(const ResolvedModule *module) const { return m_envType == BuildEnv ? module->setupBuildEnvironmentScript : module->setupRunEnvironmentScript; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/buildgraphnode.h0000644000175100017510000000643515154533055022747 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_BUILDGRAPHNODE_H #define QBS_BUILDGRAPHNODE_H #include "nodeset.h" #include #include #include namespace qbs { namespace Internal { class BuildGraphVisitor; class BuildGraphNode { friend NodeSet; public: virtual ~BuildGraphNode(); NodeSet parents; NodeSet children; WeakPointer product; enum BuildState { Untouched = 0, Buildable, Building, Built }; BuildState buildState; // Do not serialize. Will be refreshed for every build. enum Type { ArtifactNodeType, RuleNodeType }; virtual Type type() const = 0; virtual void accept(BuildGraphVisitor *visitor) = 0; virtual QString toString() const = 0; virtual void onChildDisconnected(BuildGraphNode *child); bool isBuilt() const { return buildState == Built; } virtual void load(PersistentPool &pool); virtual void store(PersistentPool &pool); protected: explicit BuildGraphNode(); void acceptChildren(BuildGraphVisitor *visitor); // Do not store parents to avoid recursion. // Parents must be updated after loading all nodes. template void serializationOp(PersistentPool &pool) { pool.serializationOp(children); } }; } // namespace Internal } // namespace qbs #endif // QBS_BUILDGRAPHNODE_H qbs-src-3.2.0/src/lib/corelib/buildgraph/artifact.cpp0000644000175100017510000001352515154533055022106 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "artifact.h" #include "transformer.h" #include "buildgraphvisitor.h" #include "productbuilddata.h" #include "rulenode.h" #include #include #include #include namespace qbs { namespace Internal { Artifact::Artifact() : artifactType(ArtifactType::Unknown), inputsScanned(false), timestampRetrieved(false), alwaysUpdated(false), oldDataPossiblyPresent(true) { } Artifact::~Artifact() { for (Artifact *p : parentArtifacts()) p->childrenAddedByScanner.remove(this); if (m_deregister) m_deregister(this); } void Artifact::accept(BuildGraphVisitor *visitor) { if (visitor->visit(this)) acceptChildren(visitor); visitor->endVisit(this); } QString Artifact::toString() const { return QLatin1String("ARTIFACT ") + filePath() + QLatin1String(" [") + (!product.expired() ? product->name : QLatin1String("")) + QLatin1Char(']'); } void Artifact::addFileTag(const FileTag &t) { m_fileTags += t; if (!product.expired() && product->buildData) { product->buildData->addFileTagToArtifact(this, t); if (product->fileTags.contains(t)) product->buildData->addRootNode(this); } } void Artifact::removeFileTag(const FileTag &t) { m_fileTags -= t; if (!product.expired() && product->buildData) { product->buildData->removeArtifactFromSetByFileTag(this, t); if (product->fileTags.contains(t) && !product->fileTags.intersects(m_fileTags)) product->buildData->removeFromRootNodes(this); } } void Artifact::setFileTags(const FileTags &newFileTags) { if (product.expired() || !product->buildData) { m_fileTags = newFileTags; return; } if (m_fileTags == newFileTags) return; const Set addedTags = newFileTags - m_fileTags; for (const FileTag &t : addedTags) addFileTag(t); const Set removedTags = m_fileTags - newFileTags; for (const FileTag &t : removedTags) removeFileTag(t); } RuleNode *Artifact::producer() const { if (artifactType == SourceFile) return nullptr; const auto ruleNodes = filterByType(children); QBS_CHECK(ruleNodes.begin() != ruleNodes.end()); return *ruleNodes.begin(); } const TypeFilter Artifact::parentArtifacts() const { return TypeFilter(parents); } const TypeFilter Artifact::childArtifacts() const { return TypeFilter(children); } void Artifact::onChildDisconnected(BuildGraphNode *child) { if (child->type() != BuildGraphNode::ArtifactNodeType) return; childrenAddedByScanner.remove(static_cast(child)); } void Artifact::load(PersistentPool &pool) { FileResourceBase::load(pool); BuildGraphNode::load(pool); children.load(pool); // restore parents of the loaded children for (auto it = children.constBegin(); it != children.constEnd(); ++it) (*it)->parents.insert(this); pool.load(childrenAddedByScanner); pool.load(fileDependencies); pool.load(properties); pool.load(targetOfModule); pool.load(transformer); pool.load(m_fileTags); pool.load(pureFileTags); pool.load(pureProperties); artifactType = static_cast(pool.load()); alwaysUpdated = pool.load(); oldDataPossiblyPresent = pool.load(); } void Artifact::store(PersistentPool &pool) { FileResourceBase::store(pool); BuildGraphNode::store(pool); // Do not store parents to avoid recursion. children.store(pool); pool.store(childrenAddedByScanner); pool.store(fileDependencies); pool.store(properties); pool.store(targetOfModule); pool.store(transformer); pool.store(m_fileTags); pool.store(pureFileTags); pool.store(pureProperties); pool.store(static_cast(artifactType)); pool.store(alwaysUpdated); pool.store(oldDataPossiblyPresent); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/requestedartifacts.h0000644000175100017510000000731415154533055023657 0ustar runnerrunner/**************************************************************************** ** ** 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_REQUESTEDARTIFACTS_H #define QBS_REQUESTEDARTIFACTS_H #include #include #include #include #include namespace qbs { namespace Internal { class FileTag; class PersistentPool; class RequestedArtifacts { public: bool isUpToDate(const TopLevelProject *project) const; void clear() { m_requestedArtifactsPerProduct.clear(); } void setAllArtifactTags(const ResolvedProduct *product, bool forceUpdate); void setArtifactsForTag(const ResolvedProduct *product, const FileTag &tag); void setNonExistingTagRequested(const ResolvedProduct *product, const QString &tag); void setArtifactsEnumerated(const ResolvedProduct *product); void unite(const RequestedArtifacts &other); void doSanityChecks() const; void load(PersistentPool &pool); void store(PersistentPool &pool); template void serializationOp(PersistentPool &pool) { pool.serializationOp(m_requestedArtifactsPerProduct); } private: struct RequestedArtifactsPerProduct { Set allTags; std::unordered_map> requestedTags; bool artifactsEnumerated = false; bool isUpToDate(const ResolvedProduct *product) const; void unite(const RequestedArtifactsPerProduct &other); void doSanityChecks() const; template void serializationOp(PersistentPool &pool) { pool.serializationOp(allTags, requestedTags, artifactsEnumerated); } void load(PersistentPool &pool); void store(PersistentPool &pool); }; std::unordered_map m_requestedArtifactsPerProduct; }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/buildgraph/environmentscriptrunner.h0000644000175100017510000000547415154533055025005 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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_ENVIRONMENTSCRIPTRUNNER_H #define QBS_ENVIRONMENTSCRIPTRUNNER_H #include #include #include namespace qbs { namespace Internal { class RulesEvaluationContext; class ScriptEngine; class EnvironmentScriptRunner { public: EnvironmentScriptRunner(ResolvedProduct *product, RulesEvaluationContext *evalContext, const QProcessEnvironment &env); void setupForBuild(); void setupForRun(const QStringList &config); private: void setupEnvironment(); ScriptEngine *engine() const; const PrivateScriptFunction &getScript(const ResolvedModule *module) const; ResolvedProduct * const m_product; RulesEvaluationContext * const m_evalContext; const QProcessEnvironment m_env; QStringList m_runEnvConfig; enum EnvType { BuildEnv, RunEnv } m_envType = EnvType::BuildEnv; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/buildgraph/buildgraphloader.cpp0000644000175100017510000012465215154533055023625 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "buildgraphloader.h" #include "buildgraph.h" #include "emptydirectoriesremover.h" #include "productbuilddata.h" #include "projectbuilddata.h" #include "rulecommands.h" #include "rulenode.h" #include "rulesevaluationcontext.h" #include "transformer.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { BuildGraphLoader::BuildGraphLoader(Logger logger) : m_logger(std::move(logger)) { } BuildGraphLoader::~BuildGraphLoader() { qDeleteAll(m_objectsToDelete); } static void restoreBackPointers(const ResolvedProjectPtr &project) { for (const ResolvedProductPtr &product : project->products) { product->project = project; if (!product->buildData) continue; for (BuildGraphNode * const n : std::as_const(product->buildData->allNodes())) { if (n->type() == BuildGraphNode::ArtifactNodeType) { project->topLevelProject()->buildData ->insertIntoLookupTable(static_cast(n)); } } } for (const ResolvedProjectPtr &subProject : std::as_const(project->subProjects)) { subProject->parentProject = project; restoreBackPointers(subProject); } } BuildGraphLoadResult BuildGraphLoader::load(const TopLevelProjectPtr &existingProject, const SetupProjectParameters ¶meters, const RulesEvaluationContextPtr &evalContext) { m_parameters = parameters; m_result = BuildGraphLoadResult(); m_evalContext = evalContext; if (existingProject) { QBS_CHECK(existingProject->buildData); existingProject->buildData->evaluationContext = evalContext; if (!checkBuildGraphCompatibility(existingProject)) return m_result; m_result.loadedProject = existingProject; } else { loadBuildGraphFromDisk(); } if (!m_result.loadedProject) return m_result; if (parameters.restoreBehavior() == SetupProjectParameters::RestoreOnly) { for (const ErrorInfo &e : std::as_const(m_result.loadedProject->errorsEncountered)) m_logger.printError(e); for (const ErrorInfo &e : std::as_const(m_result.loadedProject->warningsEncountered)) m_logger.printWarning(e); return m_result; } QBS_CHECK( parameters.restoreBehavior() == SetupProjectParameters::RestoreAndTrackChanges || parameters.restoreBehavior() == SetupProjectParameters::RestoreAndResolve); if (m_parameters.logElapsedTime()) { m_wildcardExpansionEffort = 0; m_propertyComparisonEffort = 0; } trackProjectChanges(); if (m_parameters.logElapsedTime()) { m_logger.qbsLog(LoggerInfo, true) << "\t" << Tr::tr("Wildcard expansion took %1.") .arg(elapsedTimeString(m_wildcardExpansionEffort)); m_logger.qbsLog(LoggerInfo, true) << "\t" << Tr::tr("Comparing property values took %1.") .arg(elapsedTimeString(m_propertyComparisonEffort)); } return m_result; } TopLevelProjectConstPtr BuildGraphLoader::loadProject(const QString &bgFilePath) { class LogSink : public ILogSink { void doPrintMessage(LoggerLevel, const QString &, const QString &) override { } } dummySink; Logger dummyLogger(&dummySink); BuildGraphLocker bgLocker(bgFilePath, dummyLogger, false, nullptr); PersistentPool pool(dummyLogger); pool.load(bgFilePath); const TopLevelProjectPtr project = TopLevelProject::create(); project->load(pool); project->setBuildConfiguration(pool.headData().projectConfig); return project; } void BuildGraphLoader::loadBuildGraphFromDisk() { const QString projectId = TopLevelProject::deriveId(m_parameters.finalBuildConfigurationTree()); const QString buildDir = TopLevelProject::deriveBuildDirectory(m_parameters.buildRoot(), projectId); const QString buildGraphFilePath = ProjectBuildData::deriveBuildGraphFilePath(buildDir, projectId); PersistentPool pool(m_logger); qCDebug(lcBuildGraph) << "trying to load:" << buildGraphFilePath; try { pool.load(buildGraphFilePath); } catch (const NoBuildGraphError &) { if (m_parameters.restoreBehavior() == SetupProjectParameters::RestoreOnly) throw; m_logger.qbsInfo() << Tr::tr("Build graph does not yet exist for configuration '%1'. " "Starting from scratch.").arg(m_parameters.configurationName()); return; } catch (const ErrorInfo &loadError) { if (!m_parameters.overrideBuildGraphData()) { ErrorInfo fullError = loadError; fullError.append(Tr::tr("Use the 'resolve' command to set up a new build graph.")); throw fullError; } m_logger.qbsWarning() << loadError.toString(); return; } const TopLevelProjectPtr project = TopLevelProject::create(); // TODO: Store some meta data that will enable us to show actual progress (e.g. number of products). m_evalContext->initializeObserver(Tr::tr("Restoring build graph from disk"), 1); project->load(pool); project->buildData->evaluationContext = m_evalContext; project->setBuildConfiguration(pool.headData().projectConfig); project->buildDirectory = buildDir; if (!checkBuildGraphCompatibility(project)) return; restoreBackPointers(project); project->buildData->setClean(); project->location = CodeLocation(m_parameters.projectFilePath(), project->location.line(), project->location.column()); m_result.loadedProject = project; m_evalContext->incrementProgressValue(); doSanityChecks(project, m_logger); } bool BuildGraphLoader::checkBuildGraphCompatibility(const TopLevelProjectConstPtr &project) { if (m_parameters.projectFilePath().isEmpty()) m_parameters.setProjectFilePath(project->location.filePath()); else m_parameters.finalizeProjectFilePath(); if (QFileInfo(project->location.filePath()) == QFileInfo(m_parameters.projectFilePath())) return true; QString message = Tr::tr("Stored build graph at '%1' is for project file '%2', but " "input file is '%3'.") .arg(QDir::toNativeSeparators(project->buildGraphFilePath()), QDir::toNativeSeparators(project->location.filePath()), QDir::toNativeSeparators(m_parameters.projectFilePath())); if (m_parameters.overrideBuildGraphData()) { m_logger.qbsInfo() << message; return false; } message.append(QLatin1Char('\n')).append(Tr::tr("Use the 'resolve' command to enforce " "using a different project file.")); throw ErrorInfo(message); } static bool checkProductForChangedDependency(std::vector &changedProducts, Set &seenProducts, const ResolvedProductPtr &product) { if (seenProducts.contains(product)) return false; if (contains(changedProducts, product)) return true; for (const ProductDependency &dep : std::as_const(product->dependencies)) { if (checkProductForChangedDependency(changedProducts, seenProducts, dep.product)) { changedProducts << product; return true; } } seenProducts << product; return false; } // All products depending on changed products also become changed. Otherwise the output // artifacts of the rules taking the artifacts from the dependency as inputs will be // rebuilt due to their rule getting re-applied (as the rescued input artifacts will show // up as newly added) and no rescue data being available. static void makeChangedProductsListComplete(std::vector &changedProducts, const std::vector &allRestoredProducts) { Set seenProducts; for (const ResolvedProductPtr &p : allRestoredProducts) checkProductForChangedDependency(changedProducts, seenProducts, p); } static void updateProductAndRulePointers(const ResolvedProductPtr &newProduct) { std::unordered_map ruleMap; for (BuildGraphNode *node : std::as_const(newProduct->buildData->allNodes())) { node->product = newProduct; const auto findNewRule = [&ruleMap, &newProduct] (const RuleConstPtr &oldRule) -> RuleConstPtr { const auto it = ruleMap.find(oldRule); if (it != ruleMap.cend()) return it->second; for (const auto &r : std::as_const(newProduct->rules)) { if (*r == *oldRule) { ruleMap.insert(std::make_pair(oldRule, r)); return r; } } QBS_CHECK(false); return {}; }; if (node->type() == BuildGraphNode::RuleNodeType) { const auto ruleNode = static_cast(node); ruleNode->setRule(findNewRule(ruleNode->rule())); } else { QBS_CHECK(node->type() == BuildGraphNode::ArtifactNodeType); const auto artifact = static_cast(node); if (artifact->artifactType == Artifact::Generated) { QBS_CHECK(artifact->transformer); artifact->transformer->rule = findNewRule(artifact->transformer->rule); } } } } void BuildGraphLoader::trackProjectChanges() { TimedActivityLogger trackingTimer(m_logger, Tr::tr("Change tracking"), m_parameters.logElapsedTime()); const TopLevelProjectPtr &restoredProject = m_result.loadedProject; Set buildSystemFiles = restoredProject->buildSystemFiles; std::vector allRestoredProducts = restoredProject->allProducts(); std::vector changedProducts; bool reResolvingNecessary = false; if (!checkConfigCompatibility()) { m_logger.qbsInfo() << Tr::tr("One or more properties have changed."); reResolvingNecessary = true; } if (hasProductFileChanged(allRestoredProducts, restoredProject->lastStartResolveTime, buildSystemFiles, changedProducts)) { reResolvingNecessary = true; } // "External" changes, e.g. in the environment or in a JavaScript file, // can make the list of source files in a product change without the respective file // having been touched. In such a case, the build data for that product will have to be set up // anew. if (probeExecutionForced(restoredProject, allRestoredProducts) || hasBuildSystemFileChanged(buildSystemFiles, restoredProject.get()) || hasEnvironmentChanged(restoredProject) || hasCanonicalFilePathResultChanged(restoredProject) || hasFileExistsResultChanged(restoredProject) || hasDirectoryEntriesResultChanged(restoredProject) || hasFileLastModifiedResultChanged(restoredProject)) { reResolvingNecessary = true; } if (!reResolvingNecessary && m_parameters.restoreBehavior() == SetupProjectParameters::RestoreAndResolve) { m_logger.qbsInfo() << Tr::tr("No changes detected, but re-resolve was forced."); reResolvingNecessary = true; } if (!reResolvingNecessary) { for (const ErrorInfo &e : std::as_const(restoredProject->errorsEncountered)) m_logger.printError(e); for (const ErrorInfo &e : std::as_const(restoredProject->warningsEncountered)) m_logger.printWarning(e); return; } for (const QString &file : m_changedProjectFiles) { m_logger.qbsInfo() << Tr::tr("Project file '%1' has changed.") .arg(QDir::toNativeSeparators(file)); } for (const QString &file : m_removedProjectFiles) { m_logger.qbsInfo() << Tr::tr("Project file '%1' was removed.") .arg(QDir::toNativeSeparators(file)); } restoredProject->buildData->setDirty(); markTransformersForChangeTracking(allRestoredProducts); if (!m_parameters.overrideBuildGraphData()) m_parameters.setEnvironment(restoredProject->environment); ProjectResolver resolver(m_parameters, m_evalContext->engine(), m_logger); resolver.setProgressObserver(m_evalContext->observer()); resolver.setOldProjectProbes(restoredProject->probes); if (!m_parameters.forceProbeExecution()) resolver.setStoredModuleProviderInfo(restoredProject->moduleProviderInfo); resolver.setLastResolveTime(restoredProject->lastStartResolveTime); QHash> restoredProbes; for (const auto &restoredProduct : std::as_const(allRestoredProducts)) restoredProbes.insert(restoredProduct->uniqueName(), restoredProduct->probes); resolver.setOldProductProbes(restoredProbes); if (!m_parameters.overrideBuildGraphData()) resolver.setStoredProfiles(restoredProject->profileConfigs); m_result.newlyResolvedProject = resolver.resolve(); std::vector allNewlyResolvedProducts = m_result.newlyResolvedProject->allProducts(); for (const ResolvedProductPtr &cp : std::as_const(allNewlyResolvedProducts)) m_freshProductsByName.insert(cp->uniqueName(), cp); checkAllProductsForChanges(allRestoredProducts, changedProducts); ChildListHash childLists; if (!changedProducts.empty()) { for (const auto &product : std::as_const(allRestoredProducts)) { if (!product->buildData) continue; // If the product gets temporarily removed, its artifacts will get disconnected // and this structural information will no longer be directly available from them. for (const Artifact *a : filterByType(product->buildData->allNodes())) { childLists.insert(a, ChildrenInfo(ArtifactSet::filtered(a->children), a->childrenAddedByScanner)); } } } makeChangedProductsListComplete(changedProducts, allRestoredProducts); // Set up build data from scratch for all changed products. This does not necessarily // mean that artifacts will have to get rebuilt; whether this is necesessary will be decided // an a per-artifact basis by the Executor on the next build. QHash rescuableArtifactData; for (const ResolvedProductPtr &product : std::as_const(changedProducts)) { const QString name = product->uniqueName(); m_changedSourcesByProduct.erase(name); m_productsWhoseArtifactsNeedUpdate.remove(name); ResolvedProductPtr freshProduct = m_freshProductsByName.value(name); if (!freshProduct) continue; onProductRemoved(product, product->topLevelProject()->buildData.get(), false); if (product->buildData) { rescuableArtifactData.insert(product->uniqueName(), product->buildData->rescuableArtifactData()); } removeOne(allRestoredProducts, product); } // Move over restored build data to newly resolved project. m_result.newlyResolvedProject->buildData.swap(restoredProject->buildData); QBS_CHECK(m_result.newlyResolvedProject->buildData); m_result.newlyResolvedProject->buildData->setDirty(); for (auto it = allNewlyResolvedProducts.begin(); it != allNewlyResolvedProducts.end();) { const ResolvedProductPtr &newlyResolvedProduct = *it; auto k = std::find_if(allRestoredProducts.begin(), allRestoredProducts.end(), [&newlyResolvedProduct](const ResolvedProductPtr &restoredProduct) { return newlyResolvedProduct->uniqueName() == restoredProduct->uniqueName(); }); if (k == allRestoredProducts.end()) { ++it; } else { const ResolvedProductPtr &restoredProduct = *k; if (newlyResolvedProduct->enabled) newlyResolvedProduct->buildData.swap(restoredProduct->buildData); if (newlyResolvedProduct->buildData) updateProductAndRulePointers(newlyResolvedProduct); // Keep in list if build data still needs to be resolved. if (!newlyResolvedProduct->enabled || newlyResolvedProduct->buildData) it = allNewlyResolvedProducts.erase(it); allRestoredProducts.erase(k); } } // Products still left in the list do not exist anymore. for (const ResolvedProductPtr &removedProduct : std::as_const(allRestoredProducts)) { removeOne(changedProducts, removedProduct); onProductRemoved(removedProduct, m_result.newlyResolvedProject->buildData.get()); } // Products still left in the list need resolving, either because they are new // or because they are newly enabled. if (!allNewlyResolvedProducts.empty()) { BuildDataResolver bpr(m_logger, m_parameters); bpr.resolveProductBuildDataForExistingProject(m_result.newlyResolvedProject, allNewlyResolvedProducts); } for (const auto &kv : m_changedSourcesByProduct) { const ResolvedProductPtr product = m_freshProductsByName.value(kv.first); QBS_CHECK(!!product); for (const SourceArtifactConstPtr &sa : kv.second) updateArtifactFromSourceArtifact(product, sa); } for (const QString &productName : m_productsWhoseArtifactsNeedUpdate) { const ResolvedProductPtr product = m_freshProductsByName.value(productName); QBS_CHECK(!!product); updateGeneratedArtifacts(product.get()); } for (const auto &changedProduct : std::as_const(changedProducts)) { rescueOldBuildData(changedProduct, m_freshProductsByName.value(changedProduct->uniqueName()), childLists, rescuableArtifactData.value(changedProduct->uniqueName())); } EmptyDirectoriesRemover(m_result.newlyResolvedProject.get(), m_logger) .removeEmptyParentDirectories(m_artifactsRemovedFromDisk); for (FileResourceBase * const f : std::as_const(m_objectsToDelete)) { if (f->fileType() == FileResourceBase::FileTypeArtifact) static_cast(f)->product.reset(); // To help with the sanity checks. } doSanityChecks(m_result.newlyResolvedProject, m_logger); } bool BuildGraphLoader::probeExecutionForced( const TopLevelProjectConstPtr &restoredProject, const std::vector &restoredProducts) const { if (!m_parameters.forceProbeExecution()) return false; if (!restoredProject->probes.empty()) return true; return Internal::any_of(restoredProducts, [](const auto &p) { return !p->probes.empty(); }); } bool BuildGraphLoader::hasEnvironmentChanged(const TopLevelProjectConstPtr &restoredProject) const { if (!m_parameters.overrideBuildGraphData()) return false; QProcessEnvironment oldEnv = restoredProject->environment; QProcessEnvironment newEnv = m_parameters.adjustedEnvironment(); static const QString ldPreloadEnvVar = QStringLiteral("LD_PRELOAD"); // HACK. Valgrind screws up our null-build benchmarker otherwise. // TODO: Think about a (module-provided) whitelist. oldEnv.remove(ldPreloadEnvVar); newEnv.remove(ldPreloadEnvVar); if (oldEnv != newEnv) { m_logger.qbsInfo() << Tr::tr("Environment changed."); m_logger.qbsDebug() << Tr::tr("old: %1").arg( restoredProject->environment.toStringList().join(QLatin1Char('\n'))); m_logger.qbsDebug() << Tr::tr("new: %2").arg( m_parameters.adjustedEnvironment().toStringList().join(QLatin1Char('\n'))); return true; } return false; } bool BuildGraphLoader::hasCanonicalFilePathResultChanged(const TopLevelProjectConstPtr &restoredProject) const { for (auto it = restoredProject->canonicalFilePathResults.constBegin(); it != restoredProject->canonicalFilePathResults.constEnd(); ++it) { if (QFileInfo(it.key()).canonicalFilePath() != it.value()) { m_logger.qbsInfo() << Tr::tr("Canonical file path for file '%1' changed.") .arg(QDir::toNativeSeparators(it.key())); return true; } } return false; } bool BuildGraphLoader::hasFileExistsResultChanged(const TopLevelProjectConstPtr &restoredProject) const { for (QHash::ConstIterator it = restoredProject->fileExistsResults.constBegin(); it != restoredProject->fileExistsResults.constEnd(); ++it) { if (FileInfo(it.key()).exists() != it.value()) { m_logger.qbsInfo() << Tr::tr("Existence check for file '%1' changed.") .arg(QDir::toNativeSeparators(it.key())); return true; } } return false; } bool BuildGraphLoader::hasDirectoryEntriesResultChanged(const TopLevelProjectConstPtr &restoredProject) const { for (auto it = restoredProject->directoryEntriesResults.constBegin(); it != restoredProject->directoryEntriesResults.constEnd(); ++it) { if (QDir(it.key().first).entryList(static_cast(it.key().second), QDir::Name) != it.value()) { m_logger.qbsInfo() << Tr::tr("Entry list for directory '%1' changed.") .arg(QDir::toNativeSeparators(it.key().first)); return true; } } return false; } bool BuildGraphLoader::hasFileLastModifiedResultChanged(const TopLevelProjectConstPtr &restoredProject) const { for (QHash::ConstIterator it = restoredProject->fileLastModifiedResults.constBegin(); it != restoredProject->fileLastModifiedResults.constEnd(); ++it) { if (FileInfo(it.key()).lastModified() != it.value()) { m_logger.qbsInfo() << Tr::tr("Timestamp for file '%1' has changed.") .arg(QDir::toNativeSeparators(it.key())); return true; } } return false; } bool BuildGraphLoader::hasProductFileChanged(const std::vector &restoredProducts, const FileTime &referenceTime, Set &remainingBuildSystemFiles, std::vector &changedProducts) { bool hasChanged = false; for (const ResolvedProductPtr &product : restoredProducts) { const QString filePath = product->location.filePath(); const FileInfo pfi(filePath); remainingBuildSystemFiles.remove(filePath); if (!pfi.exists()) { m_removedProjectFiles << filePath; hasChanged = true; } else if (referenceTime < pfi.lastModified()) { m_changedProjectFiles << filePath; hasChanged = true; } else if (!contains(changedProducts, product)) { bool foundMissingSourceFile = false; for (const QString &file : std::as_const(product->missingSourceFiles)) { if (FileInfo(file).exists()) { m_logger.qbsInfo() << Tr::tr("Formerly missing file '%1' in product '%2' exists now.") .arg(QDir::toNativeSeparators(filePath), product->fullDisplayName()); foundMissingSourceFile = true; break; } } if (foundMissingSourceFile) { hasChanged = true; changedProducts.push_back(product); continue; } AccumulatingTimer wildcardTimer(m_parameters.logElapsedTime() ? &m_wildcardExpansionEffort : nullptr); for (const GroupPtr &group : product->groups) { if (group->wildcards && group->wildcards->hasChangedSinceExpansion()) { m_logger.qbsInfo() << Tr::tr("Must re-expand wildcards for group '%1' in product '%2'.") .arg(group->name, product->fullDisplayName()); hasChanged = true; changedProducts.push_back(product); break; } } } } return hasChanged; } bool BuildGraphLoader::hasBuildSystemFileChanged(const Set &buildSystemFiles, const TopLevelProject *restoredProject) { for (const QString &file : buildSystemFiles) { const FileInfo fi(file); if (!fi.exists()) { m_removedProjectFiles << file; return true; } const auto generatedChecker = [&file, restoredProject](const auto &item) { const ModuleProviderInfo &mpi = item.second; return file.startsWith(mpi.outputDirPath(restoredProject->buildDirectory)); }; const bool fileWasCreatedByModuleProvider = any_of(restoredProject->moduleProviderInfo.providers, generatedChecker); const FileTime referenceTime = fileWasCreatedByModuleProvider ? restoredProject->lastEndResolveTime : restoredProject->lastStartResolveTime; if (referenceTime < fi.lastModified()) { m_changedProjectFiles << file; return true; } } return false; } void BuildGraphLoader::markTransformersForChangeTracking( const std::vector &restoredProducts) { for (const ResolvedProductPtr &product : restoredProducts) { if (!product->buildData) continue; for (Artifact * const artifact : filterByType(product->buildData->allNodes())) { if (artifact->transformer) { artifact->transformer->prepareScriptNeedsChangeTracking = true; artifact->transformer->commandsNeedChangeTracking = true; } } } } void BuildGraphLoader::checkAllProductsForChanges( const std::vector &restoredProducts, std::vector &changedProducts) { for (const ResolvedProductPtr &restoredProduct : restoredProducts) { const ResolvedProductPtr newlyResolvedProduct = m_freshProductsByName.value(restoredProduct->uniqueName()); if (!newlyResolvedProduct) continue; if (newlyResolvedProduct->enabled != restoredProduct->enabled) { qCDebug(lcBuildGraph) << "Condition of product" << restoredProduct->uniqueName() << "was changed, must set up build data from scratch"; if (!contains(changedProducts, restoredProduct)) changedProducts << restoredProduct; continue; } if (checkProductForChanges(restoredProduct, newlyResolvedProduct)) { qCDebug(lcBuildGraph) << "Product" << restoredProduct->uniqueName() << "was changed, must set up build data from scratch"; if (!contains(changedProducts, restoredProduct)) changedProducts << restoredProduct; continue; } if (checkProductForChangesInSourceFiles(restoredProduct, newlyResolvedProduct)) { qCDebug(lcBuildGraph) << "File list of product" << restoredProduct->uniqueName() << "was changed."; if (!contains(changedProducts, restoredProduct)) changedProducts << restoredProduct; } } } bool BuildGraphLoader::checkProductForChangesInSourceFiles( const ResolvedProductPtr &restoredProduct, const ResolvedProductPtr &newlyResolvedProduct) { std::vector oldFiles = restoredProduct->allEnabledFiles(); std::vector newFiles = newlyResolvedProduct->allEnabledFiles(); // TODO: Also handle added and removed files in a fine-grained manner. if (oldFiles.size() != newFiles.size()) return true; static const auto cmp = [](const SourceArtifactConstPtr &a1, const SourceArtifactConstPtr &a2) { return a1->absoluteFilePath < a2->absoluteFilePath; }; std::sort(oldFiles.begin(), oldFiles.end(), cmp); std::sort(newFiles.begin(), newFiles.end(), cmp); std::vector changedFiles; for (int i = 0; i < int(oldFiles.size()); ++i) { const SourceArtifactConstPtr &oldFile = oldFiles.at(i); const SourceArtifactConstPtr &newFile = newFiles.at(i); if (oldFile->absoluteFilePath != newFile->absoluteFilePath) return true; if (*oldFile != *newFile) { qCDebug(lcBuildGraph) << "source artifact" << oldFile->absoluteFilePath << "changed"; changedFiles.push_back(newFile); } } if (!changedFiles.empty()) { m_changedSourcesByProduct.insert(std::make_pair(restoredProduct->uniqueName(), changedFiles)); } return false; } static bool dependenciesAreEqual(const ResolvedProductConstPtr &p1, const ResolvedProductConstPtr &p2) { if (p1->dependencies.size() != p2->dependencies.size()) return false; Set> deps1; Set> deps2; for (const auto &dep : std::as_const(p1->dependencies)) deps1 << std::make_pair(dep.product->uniqueName(), dep.minimal); for (const auto &dep : std::as_const(p2->dependencies)) deps2 << std::make_pair(dep.product->uniqueName(), dep.minimal); return deps1 == deps2; } bool BuildGraphLoader::checkProductForChanges(const ResolvedProductPtr &restoredProduct, const ResolvedProductPtr &newlyResolvedProduct) { // This check must come first, as it can prevent build data rescuing as a side effect. // TODO: Similar special checks must be done for Environment.getEnv() and File.exists() in // commands (or possibly it could be reasonable to just forbid such "dynamic" constructs // within commands). if (checkForPropertyChanges(restoredProduct, newlyResolvedProduct)) return true; if (!ruleListsAreEqual(restoredProduct->rules, newlyResolvedProduct->rules)) return true; if (!dependenciesAreEqual(restoredProduct, newlyResolvedProduct)) return true; return false; } bool BuildGraphLoader::checkProductForInstallInfoChanges(const ResolvedProductPtr &restoredProduct, const ResolvedProductPtr &newlyResolvedProduct) { // These are not requested from rules at build time, but we still need to take // them into account. const QStringList specialProperties = QStringList() << StringConstants::installProperty() << StringConstants::installDirProperty() << StringConstants::installPrefixProperty() << StringConstants::installRootProperty(); for (const QString &key : specialProperties) { if (!qVariantsEqual( restoredProduct->moduleProperties->qbsPropertyValue(key), newlyResolvedProduct->moduleProperties->qbsPropertyValue(key))) { qCDebug(lcBuildGraph).noquote().nospace() << "Product property 'qbs." << key << "' changed."; return true; } } return false; } bool BuildGraphLoader::checkForPropertyChanges(const ResolvedProductPtr &restoredProduct, const ResolvedProductPtr &newlyResolvedProduct) { AccumulatingTimer propertyComparisonTimer(m_parameters.logElapsedTime() ? &m_propertyComparisonEffort: nullptr); qCDebug(lcBuildGraph) << "Checking for changes in properties requested in prepare scripts for " "product" << restoredProduct->uniqueName(); if (!restoredProduct->buildData) return false; if (restoredProduct->fileTags != newlyResolvedProduct->fileTags) { qCDebug(lcBuildGraph) << "Product type changed from" << restoredProduct->fileTags << "to" << newlyResolvedProduct->fileTags; return true; } if (checkProductForInstallInfoChanges(restoredProduct, newlyResolvedProduct)) return true; if (!artifactPropertyListsAreEqual(restoredProduct->artifactProperties, newlyResolvedProduct->artifactProperties)) { qCDebug(lcBuildGraph) << "a fileTagFilter group changed for product" << restoredProduct->uniqueName(); m_productsWhoseArtifactsNeedUpdate << restoredProduct->uniqueName(); } if (*restoredProduct->moduleProperties != *newlyResolvedProduct->moduleProperties) { qCDebug(lcBuildGraph) << "module properties changed for product" << restoredProduct->uniqueName(); m_productsWhoseArtifactsNeedUpdate << restoredProduct->uniqueName(); } return false; } void BuildGraphLoader::onProductRemoved(const ResolvedProductPtr &product, ProjectBuildData *projectBuildData, bool removeArtifactsFromDisk) { qCDebug(lcBuildGraph) << "product" << product->uniqueName() << "removed."; removeOne(product->project->products, product); if (product->buildData) { for (BuildGraphNode * const node : std::as_const(product->buildData->allNodes())) { if (node->type() == BuildGraphNode::ArtifactNodeType) { const auto artifact = static_cast(node); projectBuildData->removeArtifact(artifact, m_logger, removeArtifactsFromDisk, false); if (removeArtifactsFromDisk && artifact->artifactType == Artifact::Generated) m_artifactsRemovedFromDisk << artifact->filePath(); } else { for (BuildGraphNode * const parent : std::as_const(node->parents)) parent->children.remove(node); node->parents.clear(); for (BuildGraphNode * const child : std::as_const(node->children)) child->parents.remove(node); node->children.clear(); } } } } void BuildGraphLoader::replaceFileDependencyWithArtifact(const ResolvedProductPtr &fileDepProduct, FileDependency *filedep, Artifact *artifact) { qCDebug(lcBuildGraph) << "replace file dependency" << filedep->filePath() << "with artifact of type" << toString(artifact->artifactType); for (const ResolvedProductPtr &product : fileDepProduct->topLevelProject()->allProducts()) { if (!product->buildData) continue; for (Artifact *artifactInProduct : filterByType(product->buildData->allNodes())) { if (artifactInProduct->fileDependencies.remove(filedep)) connect(artifactInProduct, artifact); } } fileDepProduct->topLevelProject()->buildData->fileDependencies.remove(filedep); fileDepProduct->topLevelProject()->buildData->removeFromLookupTable(filedep); m_objectsToDelete << filedep; } bool BuildGraphLoader::checkConfigCompatibility() { const TopLevelProjectConstPtr restoredProject = m_result.loadedProject; if (m_parameters.topLevelProfile().isEmpty()) { m_parameters.setTopLevelProfile(restoredProject->profile()); m_parameters.expandBuildConfiguration(); } if (!m_parameters.overrideBuildGraphData()) { if (!m_parameters.overriddenValues().empty() && !qVariantMapsEqual( m_parameters.overriddenValues(), restoredProject->overriddenValues)) { const auto toUserOutput = [](const QVariantMap &propMap) { QString o; for (auto it = propMap.begin(); it != propMap.end(); ++it) { if (!o.isEmpty()) o += QLatin1Char(' '); o.append(it.key()).append(QLatin1Char(':')).append(toJSLiteral(it.value())); } return o; }; throw ErrorInfo(Tr::tr("Property values set on the command line differ from the " "ones used for the previous build.\n" "Old property values: %1\n" "New property values: %2\n" "Use the 'resolve' command if " "you really want to rebuild with the new properties.") .arg(toUserOutput(restoredProject->overriddenValues), toUserOutput(m_parameters.overriddenValues()))); } m_parameters.setOverriddenValues(restoredProject->overriddenValues); if (m_parameters.topLevelProfile() != restoredProject->profile()) { throw ErrorInfo(Tr::tr("The current profile is '%1', but profile '%2' was used " "when last building for configuration '%3'. Use the " "'resolve' command if you really want to rebuild with a " "different profile.") .arg(m_parameters.topLevelProfile(), restoredProject->profile(), m_parameters.configurationName())); } m_parameters.setTopLevelProfile(restoredProject->profile()); m_parameters.expandBuildConfiguration(); } if (!m_parameters.overrideBuildGraphData()) return true; if (!qVariantMapsEqual( m_parameters.finalBuildConfigurationTree(), restoredProject->buildConfiguration())) return false; Settings settings(m_parameters.settingsDirectory()); const QVariantMap profileConfigsTree = restoredProject->fullProfileConfigsTree(); for (auto it = profileConfigsTree.begin(); it != profileConfigsTree.end(); ++it) { const Profile profile(it.key(), &settings); const QVariantMap buildConfig = SetupProjectParameters::expandedBuildConfiguration( profile, m_parameters.configurationName()); const QVariantMap newConfig = SetupProjectParameters::finalBuildConfigurationTree( buildConfig, m_parameters.overriddenValues()); if (newConfig != it.value()) return false; } return true; } void BuildGraphLoader::rescueOldBuildData(const ResolvedProductConstPtr &restoredProduct, const ResolvedProductPtr &newlyResolvedProduct, const ChildListHash &childLists, const AllRescuableArtifactData &existingRad) { QBS_CHECK(newlyResolvedProduct); if (!restoredProduct->buildData) return; if (!newlyResolvedProduct->buildData) newlyResolvedProduct->buildData = std::make_unique(); qCDebug(lcBuildGraph) << "rescue data of product" << restoredProduct->uniqueName(); QBS_CHECK(newlyResolvedProduct->buildData); QBS_CHECK(newlyResolvedProduct->buildData->rescuableArtifactData().empty()); newlyResolvedProduct->buildData->setRescuableArtifactData(existingRad); // This is needed for artifacts created by rules, which happens later in the executor. for (Artifact * const oldArtifact : filterByType(restoredProduct->buildData->allNodes())) { if (!oldArtifact->transformer) continue; Artifact * const newArtifact = lookupArtifact(newlyResolvedProduct, oldArtifact, false); if (!newArtifact) { RescuableArtifactData rad = oldArtifact->transformer->rescueToArtifactData(); rad.timeStamp = oldArtifact->timestamp(); rad.fileTags = oldArtifact->fileTags(); rad.properties = oldArtifact->properties; const ChildrenInfo &childrenInfo = childLists.value(oldArtifact); for (Artifact * const child : std::as_const(childrenInfo.children)) { rad.children.emplace_back(child->product->name, child->product->multiplexConfigurationId, child->filePath(), childrenInfo.childrenAddedByScanner.contains(child)); transform(oldArtifact->fileDependencies, rad.fileDependencies, std::mem_fn(&FileDependency::filePath)); } newlyResolvedProduct->buildData->addRescuableArtifactData( oldArtifact->filePath(), std::move(rad)); } } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/transformer.cpp0000644000175100017510000004332615154533055022655 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "transformer.h" #include "artifact.h" #include "productbuilddata.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { Transformer::Transformer() : alwaysRun(false) { } Transformer::~Transformer() = default; static JSValue js_baseName(JSContext *ctx, JSValueConst this_val, int, JSValueConst *) { return ScriptEngine::engineForContext(ctx)->getArtifactProperty(this_val, [ctx](const Artifact *a) { return makeJsString(ctx, FileInfo::baseName(a->filePath())); }); } static JSValue js_completeBaseName(JSContext *ctx, JSValueConst this_val, int, JSValueConst *) { return ScriptEngine::engineForContext(ctx)->getArtifactProperty(this_val, [ctx](const Artifact *a) { return makeJsString(ctx, FileInfo::completeBaseName(a->filePath())); }); } static JSValue js_baseDir(JSContext *ctx, JSValueConst this_val, int, JSValueConst *) { return ScriptEngine::engineForContext(ctx)->getArtifactProperty(this_val, [ctx](const Artifact *artifact) { QString basedir; if (artifact->artifactType == Artifact::SourceFile) { QDir sourceDir(artifact->product->sourceDirectory); basedir = FileInfo::path(sourceDir.relativeFilePath(artifact->filePath())); } else { QDir buildDir(artifact->product->buildDirectory()); basedir = FileInfo::path(buildDir.relativeFilePath(artifact->filePath())); } return makeJsString(ctx, basedir); }); } static JSValue js_children(JSContext *ctx, JSValueConst this_val, int, JSValueConst *) { return ScriptEngine::engineForContext(ctx)->getArtifactProperty(this_val, [ctx](const Artifact *artifact) { JSValue sv = JS_NewArray(ctx); uint idx = 0; // FIXME: childArtifacts() is not guarded by any mutex ... for (Artifact *child : artifact->childArtifacts()) { JS_SetPropertyUint32(ctx, sv, idx++, Transformer::translateFileConfig( ScriptEngine::engineForContext(ctx), child, QString())); } return sv; }); } static void setArtifactProperty(JSContext *ctx, JSValue &obj, const QString &name, JSCFunction *func) { const QByteArray nameBa = name.toUtf8(); const JSValue jsFunc = JS_NewCFunction(ctx, func, nameBa.constData(), 0); const ScopedJsAtom nameAtom(ctx, nameBa); JS_DefinePropertyGetSet(ctx, obj, nameAtom, jsFunc, JS_UNDEFINED, JS_PROP_HAS_GET); } JSValue Transformer::translateFileConfig(ScriptEngine *engine, Artifact *artifact, const QString &defaultModuleName) { return engine->getArtifactScriptValue(artifact, defaultModuleName, [&](JSValue obj) { ModuleProperties::init(engine, obj, artifact); JSContext * const ctx = engine->context(); setJsProperty(ctx, obj, StringConstants::fileNameProperty(), artifact->fileName()); setJsProperty(ctx, obj, StringConstants::filePathProperty(), artifact->filePath()); setArtifactProperty(ctx, obj, StringConstants::baseNameProperty(), js_baseName); setArtifactProperty(ctx, obj, StringConstants::completeBaseNameProperty(), js_completeBaseName); setArtifactProperty(ctx, obj, QStringLiteral("baseDir"), js_baseDir); setArtifactProperty(ctx, obj, QStringLiteral("children"), js_children); const QStringList fileTags = sorted(artifact->fileTags().toStringList()); const ScopedJsValue jsFileTags(ctx, engine->toScriptValue(fileTags)); engine->setObservedProperty(obj, StringConstants::fileTagsProperty(), jsFileTags); engine->observer()->addArtifactId(jsObjectId(obj)); if (!defaultModuleName.isEmpty()) setJsProperty(ctx, obj, StringConstants::moduleNameProperty(), defaultModuleName); }); } static bool compareByFilePath(const Artifact *a1, const Artifact *a2) { return a1->filePath() < a2->filePath(); } JSValue Transformer::translateInOutputs(ScriptEngine *engine, const ArtifactSet &artifacts, const QString &defaultModuleName) { using TagArtifactsMap = QMap>; TagArtifactsMap tagArtifactsMap; for (Artifact *artifact : artifacts) for (const FileTag &fileTag : artifact->fileTags()) tagArtifactsMap[fileTag.toString()].push_back(artifact); for (TagArtifactsMap::Iterator it = tagArtifactsMap.begin(); it != tagArtifactsMap.end(); ++it) std::sort(it.value().begin(), it.value().end(), compareByFilePath); JSValue jsTagFiles = engine->newObject(); for (auto tag = tagArtifactsMap.constBegin(); tag != tagArtifactsMap.constEnd(); ++tag) { const QList &artifacts = tag.value(); JSValue jsFileConfig = JS_NewArray(engine->context()); int i = 0; for (Artifact * const artifact : artifacts) { JS_SetPropertyUint32(engine->context(), jsFileConfig, i++, translateFileConfig(engine, artifact, defaultModuleName)); } setJsProperty(engine->context(), jsTagFiles, tag.key(), jsFileConfig); } return jsTagFiles; } ResolvedProductPtr Transformer::product() const { if (outputs.empty()) return {}; return (*outputs.cbegin())->product.lock(); } void Transformer::setupInputs(ScriptEngine *engine, JSValue targetScriptValue, const ArtifactSet &inputs, const QString &defaultModuleName) { JSValue scriptValue = translateInOutputs(engine, inputs, defaultModuleName); setJsProperty(engine->context(), targetScriptValue, StringConstants::inputsVar(), scriptValue); JSValue inputScriptValue = JS_UNDEFINED; if (inputs.size() == 1) { Artifact *input = *inputs.cbegin(); const FileTags &fileTags = input->fileTags(); QBS_ASSERT(!fileTags.empty(), return); const ScopedJsValue inputsForFileTag( engine->context(), getJsProperty(engine->context(), scriptValue, fileTags.cbegin()->toString())); inputScriptValue = JS_GetPropertyUint32(engine->context(), inputsForFileTag, 0); } setJsProperty(engine->context(), targetScriptValue, StringConstants::inputVar(), inputScriptValue); } void Transformer::setupInputs(ScriptEngine *engine, const JSValue &targetScriptValue) { setupInputs(engine, targetScriptValue, inputs, rule->module->name); } void Transformer::setupOutputs(ScriptEngine *engine, JSValue targetScriptValue) { const QString &defaultModuleName = rule->module->name; JSValue scriptValue = translateInOutputs(engine, outputs, defaultModuleName); setJsProperty(engine->context(), targetScriptValue, StringConstants::outputsVar(), scriptValue); JSValue outputScriptValue = JS_UNDEFINED; if (outputs.size() == 1) { Artifact *output = *outputs.cbegin(); const FileTags &fileTags = output->fileTags(); QBS_ASSERT(!fileTags.empty(), return); const ScopedJsValue outputsForFileTag( engine->context(), getJsProperty(engine->context(), scriptValue, fileTags.cbegin()->toString())); outputScriptValue = JS_GetPropertyUint32(engine->context(), outputsForFileTag, 0); } setJsProperty(engine->context(), targetScriptValue, StringConstants::outputVar(), outputScriptValue); } void Transformer::setupExplicitlyDependsOn(ScriptEngine *engine, JSValue targetScriptValue) { JSValue scriptValue = translateInOutputs(engine, explicitlyDependsOn, rule->module->name); setJsProperty(engine->context(), targetScriptValue, StringConstants::explicitlyDependsOnVar(), scriptValue); } AbstractCommandPtr Transformer::createCommandFromScriptValue( ScriptEngine *engine, const JSValue &scriptValue, const CodeLocation &codeLocation) { AbstractCommandPtr cmdBase; if (JS_IsUndefined(scriptValue) || JS_IsUninitialized(scriptValue)) return cmdBase; QString className = getJsStringProperty(engine->context(), scriptValue, StringConstants::classNameProperty()); if (className == StringConstants::commandType()) cmdBase = ProcessCommand::create(); else if (className == StringConstants::javaScriptCommandType()) cmdBase = JavaScriptCommand::create(); if (cmdBase) cmdBase->fillFromScriptValue(engine->context(), &scriptValue, codeLocation); if (className == StringConstants::commandType()) { auto procCmd = static_cast(cmdBase.get()); procCmd->clearRelevantEnvValues(); const auto envVars = procCmd->relevantEnvVars(); for (const QString &key : envVars) procCmd->addRelevantEnvValue(key, product()->buildEnvironment.value(key)); } return cmdBase; } void Transformer::createCommands(ScriptEngine *engine, const PrivateScriptFunction &script, const JSValueList &args) { JSValueList argv(args.cbegin(), args.cend()); const JSValue function = script.getFunction(engine, Tr::tr("Invalid prepare script.")); const ScopedJsValue scriptValue( engine->context(), JS_Call(engine->context(), function, engine->globalObject(), int(argv.size()), argv.data())); propertiesRequestedInPrepareScript = engine->propertiesRequestedInScript(); propertiesRequestedFromArtifactInPrepareScript = engine->propertiesRequestedFromArtifact(); importedFilesUsedInPrepareScript = engine->importedFilesUsedInScript(); depsRequestedInPrepareScript = engine->requestedDependencies(); artifactsMapRequestedInPrepareScript = engine->requestedArtifacts(); lastPrepareScriptExecutionTime = FileTime::currentTime(); for (const ResolvedProduct * const p : engine->requestedExports()) { exportedModulesAccessedInPrepareScript.insert(std::make_pair(p->uniqueName(), p->exportedModule)); } engine->clearRequestedProperties(); engine->throwOnJsError(script.location()); commands.clear(); if (JS_IsArray(scriptValue)) { const int count = JS_VALUE_GET_INT(getJsProperty(engine->context(), scriptValue, StringConstants::lengthProperty())); for (qint32 i = 0; i < count; ++i) { ScopedJsValue item(engine->context(), JS_GetPropertyUint32(engine->context(), scriptValue, i)); if (!JS_IsUninitialized(item) && !JS_IsUndefined(item)) { const AbstractCommandPtr cmd = createCommandFromScriptValue(engine, item, script.location()); if (cmd) commands.addCommand(cmd); } } } else { const AbstractCommandPtr cmd = createCommandFromScriptValue(engine, scriptValue, script.location()); if (cmd) commands.addCommand(cmd); } } void Transformer::rescueChangeTrackingData(const TransformerConstPtr &other) { if (!other) return; propertiesRequestedInPrepareScript = other->propertiesRequestedInPrepareScript; propertiesRequestedInCommands = other->propertiesRequestedInCommands; propertiesRequestedFromArtifactInPrepareScript = other->propertiesRequestedFromArtifactInPrepareScript; propertiesRequestedFromArtifactInCommands = other->propertiesRequestedFromArtifactInCommands; importedFilesUsedInPrepareScript = other->importedFilesUsedInPrepareScript; importedFilesUsedInCommands = other->importedFilesUsedInCommands; depsRequestedInPrepareScript = other->depsRequestedInPrepareScript; depsRequestedInCommands = other->depsRequestedInCommands; artifactsMapRequestedInPrepareScript = other->artifactsMapRequestedInPrepareScript; artifactsMapRequestedInCommands = other->artifactsMapRequestedInCommands; lastCommandExecutionTime = other->lastCommandExecutionTime; lastPrepareScriptExecutionTime = other->lastPrepareScriptExecutionTime; prepareScriptNeedsChangeTracking = other->prepareScriptNeedsChangeTracking; commandsNeedChangeTracking = other->commandsNeedChangeTracking; markedForRerun = other->markedForRerun; exportedModulesAccessedInPrepareScript = other->exportedModulesAccessedInPrepareScript; exportedModulesAccessedInCommands = other->exportedModulesAccessedInCommands; } void Transformer::rescueFromArtifactData(RescuableArtifactData &&rad) { if (rad.lastPrepareScriptExecutionTime >= lastPrepareScriptExecutionTime) { propertiesRequestedInPrepareScript = std::move(rad.propertiesRequestedInPrepareScript); propertiesRequestedFromArtifactInPrepareScript = std::move( rad.propertiesRequestedFromArtifactInPrepareScript); importedFilesUsedInPrepareScript = std::move(rad.importedFilesUsedInPrepareScript); depsRequestedInPrepareScript = std::move(rad.depsRequestedInPrepareScript); artifactsMapRequestedInPrepareScript = std::move(rad.artifactsMapRequestedInPrepareScript); exportedModulesAccessedInPrepareScript = std::move( rad.exportedModulesAccessedInPrepareScript); lastPrepareScriptExecutionTime = rad.lastPrepareScriptExecutionTime; } propertiesRequestedInCommands = std::move(rad.propertiesRequestedInCommands); propertiesRequestedFromArtifactInCommands = std::move( rad.propertiesRequestedFromArtifactInCommands); importedFilesUsedInCommands = std::move(rad.importedFilesUsedInCommands); depsRequestedInCommands = std::move(rad.depsRequestedInCommands); artifactsMapRequestedInCommands = std::move(rad.artifactsMapRequestedInCommands); exportedModulesAccessedInCommands = std::move(rad.exportedModulesAccessedInCommands); lastCommandExecutionTime = rad.lastCommandExecutionTime; commandsNeedChangeTracking = true; markedForRerun = markedForRerun || rad.knownOutOfDate; } RescuableArtifactData Transformer::rescueToArtifactData() const { RescuableArtifactData result; result.propertiesRequestedInPrepareScript = propertiesRequestedInPrepareScript; result.propertiesRequestedInCommands = propertiesRequestedInCommands; result.propertiesRequestedFromArtifactInPrepareScript = propertiesRequestedFromArtifactInPrepareScript; result.propertiesRequestedFromArtifactInCommands = propertiesRequestedFromArtifactInCommands; result.importedFilesUsedInPrepareScript = importedFilesUsedInPrepareScript; result.importedFilesUsedInCommands = importedFilesUsedInCommands; result.depsRequestedInPrepareScript = depsRequestedInPrepareScript; result.depsRequestedInCommands = depsRequestedInCommands; result.artifactsMapRequestedInPrepareScript = artifactsMapRequestedInPrepareScript; result.artifactsMapRequestedInCommands = artifactsMapRequestedInCommands; result.exportedModulesAccessedInPrepareScript = exportedModulesAccessedInPrepareScript; result.exportedModulesAccessedInCommands = exportedModulesAccessedInCommands; result.lastCommandExecutionTime = lastCommandExecutionTime; result.lastPrepareScriptExecutionTime = lastPrepareScriptExecutionTime; result.knownOutOfDate = markedForRerun; result.commands = commands; return result; } Set Transformer::jobPools() const { Set pools; for (const AbstractCommandPtr &c : commands.commands()) { if (!c->jobPool().isEmpty()) pools.insert(c->jobPool()); } return pools; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/executorjob.h0000644000175100017510000000704515154533055022307 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_EXECUTORJOB_H #define QBS_EXECUTORJOB_H #include #include #include #include #include #include namespace qbs { class CodeLocation; class ProcessResult; namespace Internal { class AbstractCommandExecutor; class ProductBuildData; class JsCommandExecutor; class Logger; class ProcessCommandExecutor; class ScriptEngine; class Transformer; class ExecutorJob : public QObject { Q_OBJECT public: explicit ExecutorJob(const Logger &logger, QObject *parent = nullptr); ~ExecutorJob() override; void setMainThreadScriptEngine(ScriptEngine *engine); void setDryRun(bool enabled); void setEchoMode(CommandEchoMode echoMode); void run(Transformer *t); void cancel(); const Transformer *transformer() const { return m_transformer; } Set jobPools() const { return m_jobPools; } signals: void reportCommandDescription(const QString &highlight, const QString &message); void reportProcessResult(const qbs::ProcessResult &result); void finished(const qbs::ErrorInfo &error = ErrorInfo()); // !hasError() <=> command successful private: void runNextCommand(); void onCommandFinished(const qbs::ErrorInfo &err); void setFinished(); void reset(); AbstractCommandExecutor *m_currentCommandExecutor = nullptr; ProcessCommandExecutor *m_processCommandExecutor = nullptr; JsCommandExecutor *m_jsCommandExecutor = nullptr; Transformer *m_transformer = nullptr; Set m_jobPools; int m_currentCommandIdx = 0; ErrorInfo m_error; }; } // namespace Internal } // namespace qbs #endif // QBS_EXECUTORJOB_H qbs-src-3.2.0/src/lib/corelib/buildgraph/productbuilddata.h0000644000175100017510000001125315154533055023304 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PRODUCTBUILDDATA_H #define QBS_PRODUCTBUILDDATA_H #include "artifact.h" #include "nodeset.h" #include "rescuableartifactdata.h" #include #include #include #include #include namespace qbs { namespace Internal { class Logger; using ArtifactSetByFileTag = QHash; class QBS_AUTOTEST_EXPORT ProductBuildData { public: ~ProductBuildData(); const TypeFilter rootArtifacts() const; const NodeSet &allNodes() const { return m_nodes; } const NodeSet &rootNodes() const { return m_roots; } void addNode(BuildGraphNode *node) { m_nodes.insert(node); } void addRootNode(BuildGraphNode *node) { m_roots.insert(node); } void removeFromRootNodes(BuildGraphNode *node) { m_roots.remove(node); } void addArtifact(Artifact *artifact); void addArtifactToSet(Artifact *artifact); void removeArtifact(Artifact *artifact); void removeArtifactFromSetByFileTag(Artifact *artifact, const FileTag &fileTag); void addFileTagToArtifact(Artifact *artifact, const FileTag &tag); ArtifactSetByFileTag artifactsByFileTag() const; AllRescuableArtifactData rescuableArtifactData() const { return m_rescuableArtifactData; } void setRescuableArtifactData(const AllRescuableArtifactData &rad); RescuableArtifactData removeFromRescuableArtifactData(const QString &filePath); void addRescuableArtifactData(const QString &filePath, RescuableArtifactData &&rad); unsigned int buildPriority() const { return m_buildPriority; } void setBuildPriority(unsigned int prio) { m_buildPriority = prio; } bool checkAndSetJsArtifactsMapUpToDateFlag(); std::unique_lock getArtifactsMapLock() { return std::unique_lock(m_artifactsMapMutex); } template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(m_nodes, m_roots, m_rescuableArtifactData, m_artifactsByFileTag); } private: void removeArtifactFromSet(Artifact *artifact); NodeSet m_nodes; NodeSet m_roots; // After change tracking, this is the relevant data of artifacts that were in the build data // of the restored product, and will potentially be re-created by our rules. // If and when that happens, the relevant data will be copied over to the newly created // artifact. AllRescuableArtifactData m_rescuableArtifactData; // Do not store, initialized in executor. Higher prioritized artifacts are built first. unsigned int m_buildPriority = 0; ArtifactSetByFileTag m_artifactsByFileTag; mutable std::mutex m_artifactsMapMutex; bool m_jsArtifactsMapUpToDate = true; }; } // namespace Internal } // namespace qbs #endif // QBS_PRODUCTBUILDDATA_H qbs-src-3.2.0/src/lib/corelib/buildgraph/emptydirectoriesremover.cpp0000644000175100017510000001014415154533055025276 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "emptydirectoriesremover.h" #include "artifact.h" #include #include #include namespace qbs { namespace Internal { EmptyDirectoriesRemover::EmptyDirectoriesRemover(const TopLevelProject *project, Logger logger) : m_project(project), m_logger(std::move(logger)) { } void EmptyDirectoriesRemover::removeEmptyParentDirectories(const QStringList &artifactFilePaths) { m_dirsToRemove.clear(); m_handledDirs.clear(); for (const QString &filePath : artifactFilePaths) insertSorted(QFileInfo(filePath).absolutePath()); while (!m_dirsToRemove.empty()) removeDirIfEmpty(); } void EmptyDirectoriesRemover::removeEmptyParentDirectories(const ArtifactSet &artifacts) { QStringList filePaths; for (const Artifact * const a : artifacts) { if (a->artifactType == Artifact::Generated) filePaths << a->filePath(); } removeEmptyParentDirectories(filePaths); } // List is sorted so that "deeper" directories come first. void EmptyDirectoriesRemover::insertSorted(const QString &dirPath) { int i; for (i = 0; i < m_dirsToRemove.size(); ++i) { const QString &cur = m_dirsToRemove.at(i); if (dirPath == cur) return; if (dirPath.count(QLatin1Char('/')) > cur.count(QLatin1Char('/'))) break; } m_dirsToRemove.insert(i, dirPath); } void EmptyDirectoriesRemover::removeDirIfEmpty() { const QString dirPath = m_dirsToRemove.takeFirst(); m_handledDirs.insert(dirPath); QFileInfo fi(dirPath); if (fi.isSymLink() || !fi.exists() || !dirPath.startsWith(m_project->buildDirectory) || fi.filePath() == m_project->buildDirectory) { return; } QDir dir(dirPath); dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot); if (dir.count() != 0) return; dir.cdUp(); if (!dir.rmdir(fi.fileName())) { m_logger.qbsWarning() << QStringLiteral("Cannot remove empty directory '%1'.") .arg(dirPath); return; } const QString parentDir = dir.path(); if (!m_handledDirs.contains(parentDir)) insertSorted(parentDir); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/buildgraph/depscanner.cpp0000644000175100017510000002521215154533055022427 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "depscanner.h" #include "artifact.h" #include "projectbuilddata.h" #include "buildgraph.h" #include "transformer.h" #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { QString DependencyScanner::id() const { if (m_id.isEmpty()) m_id = createId(); return m_id; } static QStringList collectCppIncludePaths(const QVariantMap &modules) { QStringList result; const QVariantMap cpp = modules.value(StringConstants::cppModule()).toMap(); if (cpp.empty()) return result; result << cpp.value(QStringLiteral("includePaths")).toStringList(); const bool useSystemHeaders = cpp.value(QStringLiteral("treatSystemHeadersAsDependencies")).toBool(); if (useSystemHeaders) { result << cpp.value(QStringLiteral("systemIncludePaths")).toStringList() << cpp.value(QStringLiteral("distributionIncludePaths")).toStringList() << cpp.value(QStringLiteral("compilerIncludePaths")).toStringList(); } result.removeDuplicates(); return result; } static bool modulesEnabled(const QVariantMap &properties) { const QVariantMap cpp = properties.value(StringConstants::cppModule()).toMap(); if (cpp.empty()) return false; return cpp.value(QStringLiteral("forceUseCxxModules")).toBool(); } static QString getCompiledModuleSuffix(const QVariantMap &modules) { const QVariantMap cpp = modules.value(StringConstants::cppModule()).toMap(); if (cpp.empty()) return {}; return cpp.value(QStringLiteral("compiledModuleSuffix")).toString(); } PluginDependencyScanner::PluginDependencyScanner(ScannerPlugin *plugin) : m_plugin(plugin) { } QStringList PluginDependencyScanner::collectModulesPaths(const ResolvedProduct *product) { QStringList result; if (!product) return result; const auto getModulesPath = [](const ResolvedProduct *product) -> QString { return product->buildDirectory() + QStringLiteral("/cxx-modules"); }; result << getModulesPath(product); // a module can also be in the dependent product for (const auto &dep : product->dependencies) { const auto depProduct = dep.product.get(); if (depProduct) result << getModulesPath(depProduct); } return result; } QStringList PluginDependencyScanner::collectSearchPaths(Artifact *artifact) { if (m_plugin->flags & ScannerUsesCppIncludePaths) { auto result = collectCppIncludePaths(artifact->properties->value()); if (modulesEnabled(artifact->properties->value()) && artifact->product) { result << collectModulesPaths(artifact->product.get()); } return result; } return {}; } QStringList PluginDependencyScanner::collectDependencies(Artifact *artifact, FileResourceBase *file, const char *fileTags) { Q_UNUSED(artifact); Set result; QString baseDirOfInFilePath = file->dirPath(); const QString &filepath = file->filePath(); void *scannerHandle = m_plugin->open(filepath.utf16(), fileTags, ScanForDependenciesFlag); if (!scannerHandle) return {}; for (;;) { int flags = 0; int length = 0; const char *szOutFilePath = m_plugin->next(scannerHandle, &length, &flags); if (szOutFilePath == nullptr) break; QString outFilePath = QString::fromLocal8Bit(szOutFilePath, length); if (outFilePath.isEmpty()) continue; if (flags & SC_LOCAL_INCLUDE_FLAG) { QString localFilePath = FileInfo::resolvePath(baseDirOfInFilePath, outFilePath); if (FileInfo::exists(localFilePath)) outFilePath = localFilePath; } if (flags & SC_MODULE_FLAG) { outFilePath = outFilePath.replace(QLatin1Char(':'), QLatin1Char('-')) + getCompiledModuleSuffix(artifact->properties->value()); } result += outFilePath; } m_plugin->close(scannerHandle); return rangeTo(result); } bool PluginDependencyScanner::recursive() const { return m_plugin->flags & ScannerRecursiveDependencies; } QString PluginDependencyScanner::createId() const { return QString::fromLatin1(m_plugin->name); } bool PluginDependencyScanner::areModulePropertiesCompatible(const PropertyMapConstPtr &m1, const PropertyMapConstPtr &m2) const { // This changes when our C++ scanner starts taking defines into account. Q_UNUSED(m1); Q_UNUSED(m2); return true; } UserDependencyScanner::UserDependencyScanner(ResolvedScannerConstPtr scanner, ScriptEngine *engine) : m_scanner(std::move(scanner)), m_engine(engine), m_global(engine->context(), JS_NewObjectProto(engine->context(), m_engine->globalObject())), m_product(nullptr) { setupScriptEngineForFile(m_engine, m_scanner->scanScript.fileContext(), m_global, ObserveMode::Disabled); // TODO: QBS-1092 } QStringList UserDependencyScanner::collectSearchPaths(Artifact *artifact) { return evaluate(artifact, nullptr, m_scanner->searchPathsScript); } QStringList UserDependencyScanner::collectDependencies(Artifact *artifact, FileResourceBase *file, const char *fileTags) { Q_UNUSED(fileTags); return evaluate(artifact, file, m_scanner->scanScript); } bool UserDependencyScanner::recursive() const { return m_scanner->recursive; } QString UserDependencyScanner::createId() const { return m_scanner->scanScript.sourceCode(); } bool UserDependencyScanner::areModulePropertiesCompatible(const PropertyMapConstPtr &m1, const PropertyMapConstPtr &m2) const { // TODO: This should probably be made more fine-grained. Perhaps the Scanner item // could declare the relevant properties, or we could figure them out automatically // somehow. return m1 == m2 || *m1 == *m2; } class ScriptEngineActiveFlagGuard { ScriptEngine *m_engine; public: ScriptEngineActiveFlagGuard(ScriptEngine *engine) : m_engine(engine) { m_engine->setActive(true); } ~ScriptEngineActiveFlagGuard() { m_engine->setActive(false); } }; QStringList UserDependencyScanner::evaluate(Artifact *artifact, const FileResourceBase *fileToScan, const PrivateScriptFunction &script) { ScriptEngineActiveFlagGuard guard(m_engine); if (artifact->product.get() != m_product) { m_product = artifact->product.get(); setupScriptEngineForProduct(m_engine, artifact->product.get(), m_scanner->module.get(), m_global, true); } JSValueList args; args.reserve(fileToScan ? 4 : 3); args.push_back(getJsProperty(m_engine->context(), m_global, StringConstants::projectVar())); args.push_back(getJsProperty(m_engine->context(), m_global, StringConstants::productVar())); args.push_back(Transformer::translateFileConfig(m_engine, artifact, m_scanner->module->name)); if (fileToScan) args.push_back(makeJsString(m_engine->context(), fileToScan->filePath())); const ScopedJsValueList argsMgr(m_engine->context(), args); const TemporaryGlobalObjectSetter gos(m_engine, m_global); const JSValue function = script.getFunction(m_engine, Tr::tr("Invalid scan script.")); const ScopedJsValue result( m_engine->context(), JS_Call(m_engine->context(), function, m_engine->globalObject(), int(args.size()), args.data())); m_engine->clearRequestedProperties(); if (m_engine->checkForJsError(script.location())) { ErrorInfo err = m_engine->getAndClearJsError(); err.prepend(Tr::tr("Error evaluating scan script")); throw err; } QStringList list; if (JS_IsArray(result)) { const int count = getJsIntProperty(m_engine->context(), result, StringConstants::lengthProperty()); list.reserve(count); for (qint32 i = 0; i < count; ++i) { JSValue item = JS_GetPropertyUint32(m_engine->context(), result, i); if (!JS_IsUninitialized(item) && !JS_IsUndefined(item)) list.push_back(getJsString(m_engine->context(), item)); JS_FreeValue(m_engine->context(), item); } } return list; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/corelib.qbs0000644000175100017510000004103015154533055017602 0ustar runnerrunnerimport qbs.Utilities QbsLibrary { Depends { name: "cpp" } Depends { name: "Qt"; submodules: ["core-private", "network", "xml"] } Depends { name: "Qt.core5compat"; condition: Utilities.versionCompare(Qt.core.version, "6.0.0") >= 0 } Depends { name: "quickjs" } Depends { name: "qbspkgconfig" } name: "qbscore" cpp.includePaths: base.concat([ ".", "../.." // for the plugin headers ]) cpp.defines: { var defines = base.concat([ "QBS_RELATIVE_LIBEXEC_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativeLibexecPath), "QBS_VERSION=" + Utilities.cStringQuote(version), ]); if (project.withTests) defines.push("QBS_WITH_TESTS"); if (qbsbuildconfig.enableUnitTests) defines.push("QBS_ENABLE_UNIT_TESTS"); if (qbsbuildconfig.systemSettingsDir) defines.push('QBS_SYSTEM_SETTINGS_DIR="' + qbsbuildconfig.systemSettingsDir + '"'); defines.push("CPLUSPLUS_NO_PARSER"); return defines; } Properties { condition: qbs.targetOS.contains("windows") cpp.dynamicLibraries: ["psapi", "shell32"] } Properties { condition: qbs.toolchain.contains("mingw") cpp.cxxFlags: "-Wa,-mbig-obj" } Properties { cpp.dynamicLibraries: base } Properties { condition: qbs.targetOS.contains("darwin") cpp.frameworks: ["Foundation", "Security"] } Group { name: product.name files: ["qbs.h"] qbs.install: qbsbuildconfig.installApiHeaders qbs.installDir: headerInstallPrefix } Group { name: "project file updating" prefix: "api/" files: [ "changeset.cpp", "changeset.h", "projectfileupdater.cpp", "projectfileupdater.h", "qmljsrewriter.cpp", "qmljsrewriter.h", ] } Group { name: "api" prefix: name + '/' files: [ "internaljobs.cpp", "internaljobs.h", "jobs.cpp", "languageinfo.cpp", "project.cpp", "project_p.h", "projectdata.cpp", "projectdata_p.h", "propertymap_p.h", "rulecommand.cpp", "rulecommand_p.h", "runenvironment.cpp", "transformerdata.cpp", "transformerdata_p.h", ] } Group { name: "public api headers" qbs.install: qbsbuildconfig.installApiHeaders qbs.installDir: headerInstallPrefix + "/api" prefix: "api/" files: [ "jobs.h", "languageinfo.h", "project.h", "projectdata.h", "rulecommand.h", "runenvironment.h", "transformerdata.h", ] } Group { name: "buildgraph" prefix: name + '/' files: [ "abstractcommandexecutor.cpp", "abstractcommandexecutor.h", "artifact.cpp", "artifact.h", "artifactcleaner.cpp", "artifactcleaner.h", "artifactsscriptvalue.cpp", "artifactsscriptvalue.h", "artifactvisitor.cpp", "artifactvisitor.h", "buildgraph.cpp", "buildgraph.h", "buildgraphnode.cpp", "buildgraphnode.h", "buildgraphloader.cpp", "buildgraphloader.h", "buildgraphvisitor.h", "cppmodulesscanner.cpp", "cppmodulesscanner.h", "cycledetector.cpp", "cycledetector.h", "dependencyparametersscriptvalue.cpp", "dependencyparametersscriptvalue.h", "depscanner.cpp", "depscanner.h", "emptydirectoriesremover.cpp", "emptydirectoriesremover.h", "environmentscriptrunner.cpp", "environmentscriptrunner.h", "executor.cpp", "executor.h", "executorjob.cpp", "executorjob.h", "filedependency.cpp", "filedependency.h", "inputartifactscanner.cpp", "inputartifactscanner.h", "jscommandexecutor.cpp", "jscommandexecutor.h", "nodeset.cpp", "nodeset.h", "nodetreedumper.cpp", "nodetreedumper.h", "processcommandexecutor.cpp", "processcommandexecutor.h", "productbuilddata.cpp", "productbuilddata.h", "productinstaller.cpp", "productinstaller.h", "projectbuilddata.cpp", "projectbuilddata.h", "qtmocscanner.cpp", "qtmocscanner.h", "rawscanneddependency.cpp", "rawscanneddependency.h", "rawscanresults.cpp", "rawscanresults.h", "requestedartifacts.cpp", "requestedartifacts.h", "requesteddependencies.cpp", "requesteddependencies.h", "rescuableartifactdata.h", "rulecommands.cpp", "rulecommands.h", "rulegraph.cpp", "rulegraph.h", "rulenode.cpp", "rulenode.h", "rulesapplicator.cpp", "rulesapplicator.h", "rulesevaluationcontext.cpp", "rulesevaluationcontext.h", "timestampsupdater.cpp", "timestampsupdater.h", "transformer.cpp", "transformer.h", "transformerchangetracking.cpp", "transformerchangetracking.h", ] } Group { name: "public buildgraph headers" qbs.install: qbsbuildconfig.installApiHeaders qbs.installDir: headerInstallPrefix + "/buildgraph" files: "buildgraph/forward_decls.h" } Group { name: "generators" prefix: "generators/" files: [ "generatableprojectiterator.cpp", "generatableprojectiterator.h", "generator.cpp", "generatordata.cpp", "generatorutils.cpp", "generatorutils.h", "generatorversioninfo.cpp", "generatorversioninfo.h", "igeneratableprojectvisitor.h", "ixmlnodevisitor.h", "xmlproject.cpp", "xmlproject.h", "xmlprojectwriter.cpp", "xmlprojectwriter.h", "xmlproperty.cpp", "xmlproperty.h", "xmlpropertygroup.cpp", "xmlpropertygroup.h", "xmlworkspace.cpp", "xmlworkspace.h", "xmlworkspacewriter.cpp", "xmlworkspacewriter.h", ] } Group { name: "public generator headers" prefix: "generators/" qbs.install: qbsbuildconfig.installApiHeaders qbs.installDir: headerInstallPrefix + "/generators" files: [ "generator.h", "generatordata.h", ] } Group { name: "jsextensions" prefix: name + '/' files: [ "environmentextension.cpp", "file.cpp", "fileinfoextension.cpp", "host.cpp", "jsextension.h", "jsextensions.cpp", "jsextensions.h", "moduleproperties.cpp", "moduleproperties.h", "pkgconfigjs.cpp", "pkgconfigjs.h", "process.cpp", "temporarydir.cpp", "textfile.cpp", "binaryfile.cpp", "utilitiesextension.cpp", "domxml.cpp", ] } Group { name: "jsextensions (Non-Darwin-specific)" prefix: "jsextensions/" condition: !qbs.targetOS.contains("darwin") files: [ "propertylist.cpp", ] } Group { name: "jsextensions (Darwin-specific)" prefix: "jsextensions/" condition: qbs.targetOS.contains("darwin") files: [ "propertylist_darwin.mm", "propertylistutils.h", "propertylistutils.mm", ] } Group { name: "language" prefix: name + '/' files: [ "artifactproperties.cpp", "artifactproperties.h", "asttools.cpp", "asttools.h", "builtindeclarations.cpp", "builtindeclarations.h", "deprecationinfo.h", "evaluator.cpp", "evaluator.h", "filecontext.cpp", "filecontext.h", "filecontextbase.cpp", "filecontextbase.h", "filetags.cpp", "filetags.h", "identifiersearch.cpp", "identifiersearch.h", "item.cpp", "item.h", "itemdeclaration.cpp", "itemdeclaration.h", "itemobserver.h", "itempool.cpp", "itempool.h", "itemtype.h", "jsimports.h", "language.cpp", "language.h", "moduleproviderinfo.h", "preparescriptobserver.cpp", "preparescriptobserver.h", "property.cpp", "property.h", "propertydeclaration.cpp", "propertydeclaration.h", "propertymapinternal.cpp", "propertymapinternal.h", "qualifiedid.cpp", "qualifiedid.h", "resolvedfilecontext.cpp", "resolvedfilecontext.h", "scriptengine.cpp", "scriptengine.h", "scriptimporter.cpp", "scriptimporter.h", "scriptpropertyobserver.cpp", "scriptpropertyobserver.h", "value.cpp", "value.h", ] } Group { name: "public language headers" qbs.install: qbsbuildconfig.installApiHeaders qbs.installDir: headerInstallPrefix + "/language" files: "language/forward_decls.h" } Group { name: "loader" prefix: name + '/' files: [ "astimportshandler.cpp", "astimportshandler.h", "astpropertiesitemhandler.cpp", "astpropertiesitemhandler.h", "dependenciesresolver.cpp", "dependenciesresolver.h", "groupshandler.cpp", "groupshandler.h", "itemreader.cpp", "itemreader.h", "itemreaderastvisitor.cpp", "itemreaderastvisitor.h", "itemreadervisitorstate.cpp", "itemreadervisitorstate.h", "loaderutils.cpp", "loaderutils.h", "localprofiles.cpp", "localprofiles.h", "moduleinstantiator.cpp", "moduleinstantiator.h", "moduleloader.cpp", "moduleloader.h", "modulepropertymerger.cpp", "modulepropertymerger.h", "moduleproviderloader.cpp", "moduleproviderloader.h", "probesresolver.cpp", "probesresolver.h", "productitemmultiplexer.cpp", "productitemmultiplexer.h", "productresolver.cpp", "productresolver.h", "productscollector.cpp", "productscollector.h", "productsresolver.cpp", "productsresolver.h", "projectresolver.cpp", "projectresolver.h", ] } Group { name: "logging" prefix: name + '/' files: [ "categories.cpp", "categories.h", "ilogsink.cpp", "logger.cpp", "logger.h", "translator.h" ] } Group { name: "public logging headers" qbs.install: qbsbuildconfig.installApiHeaders qbs.installDir: headerInstallPrefix + "/logging" files: "logging/ilogsink.h" } Group { name: "parser" prefix: name + '/' files: [ "qmlerror.cpp", "qmlerror.h", "qmljs.g", "qmljsast.cpp", "qmljsast_p.h", "qmljsastfwd_p.h", "qmljsastvisitor.cpp", "qmljsastvisitor_p.h", "qmljsengine_p.cpp", "qmljsengine_p.h", "qmljsglobal_p.h", "qmljsgrammar.cpp", "qmljsgrammar_p.h", "qmljskeywords_p.h", "qmljslexer.cpp", "qmljslexer_p.h", "qmljsmemorypool_p.h", "qmljsparser.cpp", "qmljsparser_p.h" ] } Group { name: "tools" prefix: name + '/' files: [ "architectures.cpp", "buildgraphlocker.cpp", "buildgraphlocker.h", "buildoptions.cpp", "clangclinfo.cpp", "clangclinfo.h", "cleanoptions.cpp", "codelocation.cpp", "commandechomode.cpp", "deprecationwarningmode.cpp", "dynamictypecheck.h", "error.cpp", "executablefinder.cpp", "executablefinder.h", "fileinfo.cpp", "fileinfo.h", "filesaver.cpp", "filesaver.h", "filetime.cpp", "filetime.h", "generateoptions.cpp", "hostosinfo.h", "id.cpp", "id.h", "iosutils.h", "joblimits.cpp", "jsliterals.cpp", "jsliterals.h", "jsonhelper.h", "installoptions.cpp", "launcherinterface.cpp", "launcherinterface.h", "launcherpackets.cpp", "launcherpackets.h", "launchersocket.cpp", "launchersocket.h", "msvcinfo.cpp", "msvcinfo.h", "pathutils.h", "pimpl.h", "persistence.cpp", "persistence.h", "porting.h", "preferences.cpp", "processresult.cpp", "processresult_p.h", "processutils.cpp", "processutils.h", "profile.cpp", "profiling.cpp", "profiling.h", "progressobserver.cpp", "progressobserver.h", "projectgeneratormanager.cpp", "propagate_const.h", "qbsassert.cpp", "qbsassert.h", "qbspluginmanager.cpp", "qbspluginmanager.h", "qbsprocess.cpp", "qbsprocess.h", "qttools.cpp", "qttools.h", "scannerpluginmanager.cpp", "scannerpluginmanager.h", "scripttools.cpp", "scripttools.h", "set.h", "settings.cpp", "settingscreator.cpp", "settingscreator.h", "settingsmodel.cpp", "settingsrepresentation.cpp", "setupprojectparameters.cpp", "shellutils.cpp", "shellutils.h", "stlutils.h", "stringconstants.h", "stringutils.h", "toolchains.cpp", "version.cpp", "visualstudioversioninfo.cpp", "visualstudioversioninfo.h", "vsenvironmentdetector.cpp", "vsenvironmentdetector.h", "weakpointer.h", ] } Group { name: "public tools headers" prefix: "tools/" files: [ "architectures.h", "buildoptions.h", "cleanoptions.h", "codelocation.h", "commandechomode.h", "deprecationwarningmode.h", "error.h", "generateoptions.h", "installoptions.h", "joblimits.h", "mutexdata.h", "preferences.h", "processresult.h", "profile.h", "projectgeneratormanager.h", "qbs_export.h", "settings.h", "settingsmodel.h", "settingsrepresentation.h", "setupprojectparameters.h", "toolchains.h", "version.h", ] qbs.install: qbsbuildconfig.installApiHeaders qbs.installDir: headerInstallPrefix + "/tools" } Group { condition: qbs.targetOS.contains("macos") name: "tools (macOS)" prefix: "tools/" files: [ "applecodesignutils.cpp", "applecodesignutils.h", "fileinfo.mm" ] } Group { name: "Cpp Scanner" prefix: "cppscanner/" files: [ "CPlusPlusForwardDeclarations.h", "Lexer.cpp", "Lexer.h", "Token.cpp", "Token.h", "cppscanner.cpp", "cppscanner.h", ] } } qbs-src-3.2.0/src/lib/corelib/CMakeLists.txt0000644000175100017510000002675315154533055020233 0ustar runnerrunnerset(QBS_HEADERS qbs.h) set(FILE_UPDATE_SOURCES changeset.cpp changeset.h projectfileupdater.cpp projectfileupdater.h qmljsrewriter.cpp qmljsrewriter.h ) list_transform_prepend(FILE_UPDATE_SOURCES api/) set(API_SOURCES internaljobs.cpp internaljobs.h jobs.cpp languageinfo.cpp project.cpp project_p.h projectdata.cpp projectdata_p.h propertymap_p.h rulecommand.cpp rulecommand_p.h runenvironment.cpp transformerdata.cpp transformerdata_p.h ) list_transform_prepend(API_SOURCES api/) set(API_HEADERS jobs.h languageinfo.h project.h projectdata.h rulecommand.h runenvironment.h transformerdata.h ) list_transform_prepend(API_HEADERS api/) set(BUILD_GRAPH_SOURCES abstractcommandexecutor.cpp abstractcommandexecutor.h artifact.cpp artifact.h artifactcleaner.cpp artifactcleaner.h artifactsscriptvalue.cpp artifactsscriptvalue.h artifactvisitor.cpp artifactvisitor.h buildgraph.cpp buildgraph.h buildgraphnode.cpp buildgraphnode.h buildgraphloader.cpp buildgraphloader.h buildgraphvisitor.h cppmodulesscanner.cpp cppmodulesscanner.h cycledetector.cpp cycledetector.h dependencyparametersscriptvalue.cpp dependencyparametersscriptvalue.h depscanner.cpp depscanner.h emptydirectoriesremover.cpp emptydirectoriesremover.h environmentscriptrunner.cpp environmentscriptrunner.h executor.cpp executor.h executorjob.cpp executorjob.h filedependency.cpp filedependency.h inputartifactscanner.cpp inputartifactscanner.h jscommandexecutor.cpp jscommandexecutor.h nodeset.cpp nodeset.h nodetreedumper.cpp nodetreedumper.h processcommandexecutor.cpp processcommandexecutor.h productbuilddata.cpp productbuilddata.h productinstaller.cpp productinstaller.h projectbuilddata.cpp projectbuilddata.h qtmocscanner.cpp qtmocscanner.h rawscanneddependency.cpp rawscanneddependency.h rawscanresults.cpp rawscanresults.h requestedartifacts.cpp requestedartifacts.h requesteddependencies.cpp requesteddependencies.h rescuableartifactdata.h rulecommands.cpp rulecommands.h rulegraph.cpp rulegraph.h rulenode.cpp rulenode.h rulesapplicator.cpp rulesapplicator.h rulesevaluationcontext.cpp rulesevaluationcontext.h timestampsupdater.cpp timestampsupdater.h transformer.cpp transformer.h transformerchangetracking.cpp transformerchangetracking.h ) list_transform_prepend(BUILD_GRAPH_SOURCES buildgraph/) set(BUILD_GRAPH_HEADERS buildgraph/forward_decls.h) set(GENERATORS_SOURCES generatableprojectiterator.cpp generatableprojectiterator.h generator.cpp generatordata.cpp generatorutils.cpp generatorutils.h generatorversioninfo.cpp generatorversioninfo.h igeneratableprojectvisitor.h ixmlnodevisitor.h xmlproject.cpp xmlproject.h xmlprojectwriter.cpp xmlprojectwriter.h xmlproperty.cpp xmlproperty.h xmlpropertygroup.cpp xmlpropertygroup.h xmlworkspace.cpp xmlworkspace.h xmlworkspacewriter.cpp xmlworkspacewriter.h ) list_transform_prepend(GENERATORS_SOURCES generators/) set(GENERATORS_HEADERS generators/generator.h generators/generatordata.h) set(JS_EXTENSIONS_SOURCES environmentextension.cpp file.cpp fileinfoextension.cpp host.cpp jsextensions.cpp jsextensions.h moduleproperties.cpp moduleproperties.h pkgconfigjs.cpp pkgconfigjs.h process.cpp temporarydir.cpp textfile.cpp binaryfile.cpp utilitiesextension.cpp domxml.cpp ) list_transform_prepend(JS_EXTENSIONS_SOURCES jsextensions/) if(APPLE) set(JS_EXTENSIONS_MACOS_SOURCES propertylist_darwin.mm propertylistutils.h propertylistutils.mm ) else() set(JS_EXTENSIONS_MACOS_SOURCES propertylist.cpp) endif() list_transform_prepend(JS_EXTENSIONS_MACOS_SOURCES jsextensions/) set(LANGUAGE_SOURCES artifactproperties.cpp artifactproperties.h asttools.cpp asttools.h builtindeclarations.cpp builtindeclarations.h deprecationinfo.h evaluator.cpp evaluator.h filecontext.cpp filecontext.h filecontextbase.cpp filecontextbase.h filetags.cpp filetags.h identifiersearch.cpp identifiersearch.h item.cpp item.h itemdeclaration.cpp itemdeclaration.h itemobserver.h itempool.cpp itempool.h itemtype.h jsimports.h language.cpp language.h moduleproviderinfo.h preparescriptobserver.cpp preparescriptobserver.h property.cpp property.h propertydeclaration.cpp propertydeclaration.h propertymapinternal.cpp propertymapinternal.h qualifiedid.cpp qualifiedid.h resolvedfilecontext.cpp resolvedfilecontext.h scriptengine.cpp scriptengine.h scriptimporter.cpp scriptimporter.h scriptpropertyobserver.cpp scriptpropertyobserver.h value.cpp value.h ) list_transform_prepend(LANGUAGE_SOURCES language/) set(LANGUAGE_HEADERS language/forward_decls.h) set(LOADER_SOURCES astimportshandler.cpp astimportshandler.h astpropertiesitemhandler.cpp astpropertiesitemhandler.h dependenciesresolver.cpp dependenciesresolver.h groupshandler.cpp groupshandler.h itemreader.cpp itemreader.h itemreaderastvisitor.cpp itemreaderastvisitor.h itemreadervisitorstate.cpp itemreadervisitorstate.h loaderutils.cpp loaderutils.h localprofiles.cpp localprofiles.h moduleinstantiator.cpp moduleinstantiator.h moduleloader.cpp moduleloader.h modulepropertymerger.cpp modulepropertymerger.h moduleproviderloader.cpp moduleproviderloader.h probesresolver.cpp probesresolver.h productitemmultiplexer.cpp productitemmultiplexer.h productresolver.cpp productresolver.h productscollector.cpp productscollector.h productsresolver.cpp productsresolver.h projectresolver.cpp projectresolver.h ) list_transform_prepend(LOADER_SOURCES loader/) set(LOGGING_SOURCES categories.cpp categories.h ilogsink.cpp logger.cpp logger.h translator.h ) list_transform_prepend(LOGGING_SOURCES logging/) set(LOGGING_HEADERS logging/ilogsink.h) set(PARSER_SOURCES qmlerror.cpp qmlerror.h qmljsast.cpp qmljsast_p.h qmljsastfwd_p.h qmljsastvisitor.cpp qmljsastvisitor_p.h qmljsengine_p.cpp qmljsengine_p.h qmljsglobal_p.h qmljsgrammar.cpp qmljsgrammar_p.h qmljskeywords_p.h qmljslexer.cpp qmljslexer_p.h qmljsmemorypool_p.h qmljsparser.cpp qmljsparser_p.h ) list_transform_prepend(PARSER_SOURCES parser/) set(TOOLS_SOURCES architectures.cpp buildgraphlocker.cpp buildgraphlocker.h buildoptions.cpp clangclinfo.cpp clangclinfo.h cleanoptions.cpp codelocation.cpp commandechomode.cpp deprecationwarningmode.cpp dynamictypecheck.h error.cpp executablefinder.cpp executablefinder.h fileinfo.cpp fileinfo.h filesaver.cpp filesaver.h filetime.cpp filetime.h generateoptions.cpp hostosinfo.h id.cpp id.h iosutils.h joblimits.cpp jsliterals.cpp jsliterals.h jsonhelper.h installoptions.cpp launcherinterface.cpp launcherinterface.h launcherpackets.cpp launcherpackets.h launchersocket.cpp launchersocket.h msvcinfo.cpp msvcinfo.h pathutils.h pimpl.h persistence.cpp persistence.h porting.h preferences.cpp processresult.cpp processresult_p.h processutils.cpp processutils.h profile.cpp profiling.cpp profiling.h progressobserver.cpp progressobserver.h projectgeneratormanager.cpp propagate_const.h qbsassert.cpp qbsassert.h qbspluginmanager.cpp qbspluginmanager.h qbsprocess.cpp qbsprocess.h qttools.cpp qttools.h scannerpluginmanager.cpp scannerpluginmanager.h scripttools.cpp scripttools.h set.h settings.cpp settingscreator.cpp settingscreator.h settingsmodel.cpp settingsrepresentation.cpp setupprojectparameters.cpp shellutils.cpp shellutils.h stlutils.h stringconstants.h stringutils.h toolchains.cpp version.cpp visualstudioversioninfo.cpp visualstudioversioninfo.h vsenvironmentdetector.cpp vsenvironmentdetector.h weakpointer.h ) list_transform_prepend(TOOLS_SOURCES tools/) set(TOOLS_HEADERS architectures.h buildoptions.h cleanoptions.h codelocation.h commandechomode.h deprecationwarningmode.h error.h generateoptions.h installoptions.h joblimits.h mutexdata.h preferences.h processresult.h profile.h projectgeneratormanager.h qbs_export.h settings.h settingsmodel.h settingsrepresentation.h setupprojectparameters.h toolchains.h version.h ) list_transform_prepend(TOOLS_HEADERS tools/) set(CPPSCANNER_SOURCES Lexer.cpp Token.cpp cppscanner.cpp ) list_transform_prepend(CPPSCANNER_SOURCES cppscanner/) set(CPPSCANNER_HEADERS Lexer.h Token.h cppscanner.h ) list_transform_prepend(CPPSCANNER_HEADERS cppscanner/) set(EXTERNAL_DEPENDS "") if(APPLE) set(TOOLS_MACOS_SOURCES applecodesignutils.cpp applecodesignutils.h fileinfo.mm ) list_transform_prepend(TOOLS_MACOS_SOURCES tools/) set(EXTERNAL_DEPENDS "-framework Foundation" "-framework Security") endif() if(WIN32) set(EXTERNAL_DEPENDS "psapi" "shell32") endif() add_qbs_library(qbscore DEFINES "QBS_VERSION=\"${QBS_VERSION}\"" "QBS_RELATIVE_LIBEXEC_PATH=\"${QBS_RELATIVE_LIBEXEC_PATH}\"" "QBS_LIBRARY" "CPLUSPLUS_NO_PARSER" ${QBS_UNIT_TESTS_DEFINES} DEPENDS Qt${QT_VERSION_MAJOR}::CorePrivate Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Xml Qt6Core5Compat qbspkgconfig qbsquickjs PUBLIC_DEPENDS Qt${QT_VERSION_MAJOR}::Core span ${EXTERNAL_DEPENDS} INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/../.." SOURCES ${QBS_HEADERS} ${FILE_UPDATE_SOURCES} ${API_SOURCES} ${API_HEADERS} ${BUILD_GRAPH_SOURCES} ${BUILD_GRAPH_HEADERS} ${GENERATORS_SOURCES} ${GENERATORS_HEADERS} ${JS_EXTENSIONS_SOURCES} ${JS_EXTENSIONS_MACOS_SOURCES} ${LANGUAGE_SOURCES} ${LANGUAGE_HEADERS} ${LOADER_SOURCES} ${LOGGING_SOURCES} ${LOGGING_HEADERS} ${PARSER_SOURCES} ${TOOLS_SOURCES} ${TOOLS_HEADERS} ${CPPSCANNER_SOURCES} ${CPPSCANNER_HEADERS} ${TOOLS_MACOS_SOURCES} ) # not sure if there's a better way to do this if(INSTALL_PUBLIC_HEADERS) install(FILES ${QBS_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}) install(FILES ${API_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}/api) install(FILES ${BUILD_GRAPH_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}/buildgraph) install(FILES ${GENERATORS_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}/generators) install(FILES ${LOGGING_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}/logging) install(FILES ${LANGUAGE_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}/language) install(FILES ${TOOLS_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}/tools) endif() qbs-src-3.2.0/src/lib/corelib/api/0000755000175100017510000000000015154533055016227 5ustar runnerrunnerqbs-src-3.2.0/src/lib/corelib/api/transformerdata.h0000644000175100017510000000537315154533055021604 0ustar runnerrunner/**************************************************************************** ** ** 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_TRANSFORMERDATA_H #define QBS_TRANSFORMERDATA_H #include "projectdata.h" #include "rulecommand.h" #include #include #include namespace qbs { namespace Internal { class ProjectPrivate; class TransformerDataPrivate; } class QBS_EXPORT TransformerData { friend class Internal::ProjectPrivate; public: TransformerData(); TransformerData(const TransformerData &other); ~TransformerData(); TransformerData &operator=(const TransformerData &other); QList inputs() const; QList outputs() const; RuleCommandList commands() const; private: QExplicitlySharedDataPointer d; }; using ProductTransformerData = QList; using ProjectTransformerData = QList>; } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/api/projectfileupdater.cpp0000644000175100017510000005636215154533055022642 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "projectfileupdater.h" #include "projectdata.h" #include "qmljsrewriter.h" #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace QbsQmlJS; using namespace AST; namespace qbs { namespace Internal { class ItemFinder : public Visitor { public: ItemFinder(CodeLocation cl) : m_cl(std::move(cl)), m_item(nullptr) { } UiObjectDefinition *item() const { return m_item; } private: bool visit(UiObjectDefinition *ast) override { if (toCodeLocation(m_cl.filePath(), ast->firstSourceLocation()) == m_cl) { m_item = ast; return false; } return true; } const CodeLocation m_cl; UiObjectDefinition *m_item; }; class FilesBindingFinder : public Visitor { public: FilesBindingFinder(const UiObjectDefinition *startItem) : m_startItem(startItem), m_binding(nullptr) { } UiScriptBinding *binding() const { return m_binding; } private: bool visit(UiObjectDefinition *ast) override { // We start with the direct parent of the binding, so do not descend into any // other item. return ast == m_startItem; } bool visit(UiScriptBinding *ast) override { if (ast->qualifiedId->name.toString() != StringConstants::filesProperty()) return true; m_binding = ast; return false; } const UiObjectDefinition * const m_startItem; UiScriptBinding *m_binding; }; ProjectFileUpdater::ProjectFileUpdater(QString projectFile) : m_projectFile(std::move(projectFile)) { } ProjectFileUpdater::~ProjectFileUpdater() = default; ProjectFileUpdater::LineEndingType ProjectFileUpdater::guessLineEndingType(const QByteArray &text) { char before = 0; int lfCount = 0; int crlfCount = 0; int i = text.indexOf('\n'); while (i != -1) { if (i > 0) before = text.at(i - 1); if (before == '\r') ++crlfCount; else ++lfCount; i = text.indexOf('\n', i + 1); } if (lfCount == 0 && crlfCount == 0) return UnknownLineEndings; if (crlfCount == 0) return UnixLineEndings; if (lfCount == 0) return WindowsLineEndings; return MixedLineEndings; } void ProjectFileUpdater::convertToUnixLineEndings(QByteArray *text, LineEndingType oldLineEndings) { if (oldLineEndings == UnixLineEndings) return; text->replace("\r\n", "\n"); } void ProjectFileUpdater::convertFromUnixLineEndings(QByteArray *text, LineEndingType newLineEndings) { if (newLineEndings == WindowsLineEndings || (newLineEndings != UnixLineEndings && HostOsInfo::isWindowsHost())) { text->replace('\n', "\r\n"); } } void ProjectFileUpdater::apply() { QFile file(m_projectFile); if (!file.open(QFile::ReadOnly)) { throw ErrorInfo(Tr::tr("File '%1' cannot be opened for reading: %2") .arg(m_projectFile, file.errorString())); } QByteArray rawContent = file.readAll(); const LineEndingType origLineEndingType = guessLineEndingType(rawContent); convertToUnixLineEndings(&rawContent, origLineEndingType); QString content = QString::fromUtf8(rawContent); file.close(); Engine engine; Lexer lexer(&engine); lexer.setCode(content, 1); Parser parser(&engine); if (!parser.parse()) { QList parserMessages = parser.diagnosticMessages(); if (!parserMessages.empty()) { ErrorInfo errorInfo; errorInfo.append(Tr::tr("Failure parsing project file.")); for (const DiagnosticMessage &msg : std::as_const(parserMessages)) errorInfo.append(msg.message, toCodeLocation(file.fileName(), msg.loc)); throw errorInfo; } } doApply(content, parser.ast()); if (!file.open(QFile::WriteOnly)) { throw ErrorInfo(Tr::tr("File '%1' cannot be opened for writing: %2") .arg(m_projectFile, file.errorString())); } file.resize(0); rawContent = content.toUtf8(); convertFromUnixLineEndings(&rawContent, origLineEndingType); file.write(rawContent); } ProjectFileGroupInserter::ProjectFileGroupInserter(ProductData product, QString groupName) : ProjectFileUpdater(product.location().filePath()) , m_product(std::move(product)) , m_groupName(std::move(groupName)) { } static int extractLine(const QString &fileContent, int pos) { return QStringView{fileContent}.left(pos).count(QLatin1Char('\n')); } void ProjectFileGroupInserter::doApply(QString &fileContent, UiProgram *ast) { ItemFinder itemFinder(m_product.location()); ast->accept(&itemFinder); if (!itemFinder.item()) { throw ErrorInfo(Tr::tr("The project file parser failed to find the product item."), CodeLocation(projectFile())); } ChangeSet changeSet; Rewriter rewriter(fileContent, &changeSet, QStringList()); QString groupItemString; const int productItemIndentation = int(itemFinder.item()->qualifiedTypeNameId->firstSourceLocation().startColumn - 1); const int groupItemIndentation = productItemIndentation + 4; const QString groupItemIndentationString = QString(groupItemIndentation, QLatin1Char(' ')); groupItemString += groupItemIndentationString + QLatin1String("Group {\n"); groupItemString += groupItemIndentationString + groupItemIndentationString + QLatin1String("name: \"") + m_groupName + QLatin1String("\"\n"); groupItemString += groupItemIndentationString + groupItemIndentationString + QLatin1String("files: []\n"); groupItemString += groupItemIndentationString + QLatin1Char('}'); rewriter.addObject(itemFinder.item()->initializer, groupItemString); int lineOffset = 3 + 1; // Our text + a leading newline that is always added by the rewriter. const QList &editOps = changeSet.operationList(); QBS_CHECK(editOps.size() == 1); const ChangeSet::EditOp &insertOp = editOps.front(); setLineOffset(lineOffset); int insertionLine = extractLine(fileContent, insertOp.pos1); for (int i = 0; i < insertOp.text.size() && insertOp.text.at(i) == QLatin1Char('\n'); ++i) ++insertionLine; // To account for newlines prepended by the rewriter. ++insertionLine; // To account for zero-based indexing. setItemPosition(CodeLocation(projectFile(), insertionLine, groupItemIndentation + 1)); changeSet.apply(&fileContent); } static QString getNodeRepresentation(const QString &fileContent, const QbsQmlJS::AST::Node *node) { const quint32 start = node->firstSourceLocation().offset; const quint32 end = node->lastSourceLocation().end(); return fileContent.mid(start, int(end - start)); } static const ChangeSet::EditOp &getEditOp(const ChangeSet &changeSet) { const QList &editOps = changeSet.operationList(); QBS_CHECK(editOps.size() == 1); return editOps.front(); } static int getLineOffsetForChangedBinding(const ChangeSet &changeSet, const QString &oldRhs) { return getEditOp(changeSet).text.count(QLatin1Char('\n')) - oldRhs.count(QLatin1Char('\n')); } static int getBindingLine(const ChangeSet &changeSet, const QString &fileContent) { return extractLine(fileContent, getEditOp(changeSet).pos1 + 1) + 1; } ProjectFileFilesAdder::ProjectFileFilesAdder(ProductData product, GroupData group, QStringList files) : ProjectFileUpdater(product.location().filePath()) , m_product(std::move(product)) , m_group(std::move(group)) , m_files(std::move(files)) { } static QString &addToFilesRepr(QString &filesRepr, const QString &fileRepr, int indentation) { filesRepr += QString(indentation, QLatin1Char(' ')); filesRepr += fileRepr; filesRepr += QLatin1String(",\n"); return filesRepr; } static QString &addToFilesRepr(QString &filesRepr, const QStringList &filePaths, int indentation) { for (const QString &f : filePaths) addToFilesRepr(filesRepr, toJSLiteral(f), indentation); return filesRepr; } static QString &completeFilesRepr(QString &filesRepr, int indentation) { return filesRepr.prepend(QLatin1String("[\n")).append(QString(indentation, QLatin1Char(' '))) .append(QLatin1Char(']')); } void ProjectFileFilesAdder::doApply(QString &fileContent, UiProgram *ast) { if (m_files.empty()) return; QStringList sortedFiles = m_files; sortedFiles.sort(); // Find the item containing the "files" binding. ItemFinder itemFinder(m_group.isValid() ? m_group.location() : m_product.location()); ast->accept(&itemFinder); if (!itemFinder.item()) { throw ErrorInfo(Tr::tr("The project file parser failed to find the item."), CodeLocation(projectFile())); } const int itemIndentation = int(itemFinder.item()->qualifiedTypeNameId->firstSourceLocation().startColumn - 1); const int bindingIndentation = itemIndentation + 4; const int arrayElemIndentation = bindingIndentation + 4; // Now get the binding itself. FilesBindingFinder bindingFinder(itemFinder.item()); itemFinder.item()->accept(&bindingFinder); ChangeSet changeSet; Rewriter rewriter(fileContent, &changeSet, QStringList()); UiScriptBinding * const filesBinding = bindingFinder.binding(); if (filesBinding) { QString filesRepresentation; if (filesBinding->statement->kind != QbsQmlJS::AST::Node::Kind_ExpressionStatement) throw ErrorInfo(Tr::tr("JavaScript construct in source file is too complex.")); // TODO: rename, add new and concat. const auto exprStatement = static_cast(filesBinding->statement); switch (exprStatement->expression->kind) { case QbsQmlJS::AST::Node::Kind_ArrayLiteral: { auto elem = static_cast(exprStatement->expression)->elements; QStringList oldFileReprs; while (elem) { oldFileReprs << getNodeRepresentation(fileContent, elem->expression); elem = elem->next; } // Insert new files "sorted", but do not change the order of existing files. const QString firstNewFileRepr = toJSLiteral(sortedFiles.front()); while (!oldFileReprs.empty()) { if (oldFileReprs.front() > firstNewFileRepr) break; addToFilesRepr(filesRepresentation, oldFileReprs.takeFirst(), arrayElemIndentation); } addToFilesRepr(filesRepresentation, sortedFiles, arrayElemIndentation); while (!oldFileReprs.empty()) addToFilesRepr(filesRepresentation, oldFileReprs.takeFirst(), arrayElemIndentation); completeFilesRepr(filesRepresentation, bindingIndentation); break; } case QbsQmlJS::AST::Node::Kind_StringLiteral: { const auto existingElement = static_cast(exprStatement->expression)->value.toString(); sortedFiles << existingElement; sortedFiles.sort(); addToFilesRepr(filesRepresentation, sortedFiles, arrayElemIndentation); completeFilesRepr(filesRepresentation, bindingIndentation); break; } default: { // Note that we can often do better than simply concatenating: For instance, // in the case where the existing list is of the form ["a", "b"].concat(myProperty), // we could keep on parsing until we find the array literal and then merge it with // the new files, preventing cascading concat() calls. // But this is not essential and can be implemented when we have some downtime. const QString rhsRepr = getNodeRepresentation(fileContent, exprStatement->expression); addToFilesRepr(filesRepresentation, sortedFiles, arrayElemIndentation); completeFilesRepr(filesRepresentation, bindingIndentation); // It cannot be the other way around, since the existing right-hand side could // have string type. filesRepresentation += QStringLiteral(".concat(%1)").arg(rhsRepr); } } rewriter.changeBinding(itemFinder.item()->initializer, StringConstants::filesProperty(), filesRepresentation, Rewriter::ScriptBinding); } else { // Can happen for the product itself, for which the "files" binding is not mandatory. QString filesRepresentation; addToFilesRepr(filesRepresentation, sortedFiles, arrayElemIndentation); completeFilesRepr(filesRepresentation, bindingIndentation); const QString bindingString = QString(bindingIndentation, QLatin1Char(' ')) + StringConstants::filesProperty(); rewriter.addBinding(itemFinder.item()->initializer, bindingString, filesRepresentation, Rewriter::ScriptBinding); } setLineOffset(getLineOffsetForChangedBinding(changeSet, filesBinding ? getNodeRepresentation(fileContent, filesBinding->statement) : QString())); const int insertionLine = getBindingLine(changeSet, fileContent); const int insertionColumn = (filesBinding ? arrayElemIndentation : bindingIndentation) + 1; setItemPosition(CodeLocation(projectFile(), insertionLine, insertionColumn)); changeSet.apply(&fileContent); } ProjectFileFilesRemover::ProjectFileFilesRemover(ProductData product, GroupData group, QStringList files) : ProjectFileUpdater(product.location().filePath()) , m_product(std::move(product)) , m_group(std::move(group)) , m_files(std::move(files)) { } void ProjectFileFilesRemover::doApply(QString &fileContent, UiProgram *ast) { if (m_files.empty()) return; // Find the item containing the "files" binding. ItemFinder itemFinder(m_group.isValid() ? m_group.location() : m_product.location()); ast->accept(&itemFinder); if (!itemFinder.item()) { throw ErrorInfo(Tr::tr("The project file parser failed to find the item."), CodeLocation(projectFile())); } // Now get the binding itself. FilesBindingFinder bindingFinder(itemFinder.item()); itemFinder.item()->accept(&bindingFinder); if (!bindingFinder.binding()) { throw ErrorInfo(Tr::tr("Could not find the 'files' binding in the project file."), m_product.location()); } if (bindingFinder.binding()->statement->kind != QbsQmlJS::AST::Node::Kind_ExpressionStatement) throw ErrorInfo(Tr::tr("JavaScript construct in source file is too complex.")); const CodeLocation bindingLocation = toCodeLocation(projectFile(), bindingFinder.binding()->firstSourceLocation()); ChangeSet changeSet; Rewriter rewriter(fileContent, &changeSet, QStringList()); const int itemIndentation = int(itemFinder.item()->qualifiedTypeNameId->firstSourceLocation().startColumn - 1); const int bindingIndentation = itemIndentation + 4; const int arrayElemIndentation = bindingIndentation + 4; const auto exprStatement = static_cast(bindingFinder.binding()->statement); switch (exprStatement->expression->kind) { case QbsQmlJS::AST::Node::Kind_ArrayLiteral: { QStringList filesToRemove = m_files; QStringList newFilesList; auto elem = static_cast(exprStatement->expression)->elements; while (elem) { if (elem->expression->kind != QbsQmlJS::AST::Node::Kind_StringLiteral) { throw ErrorInfo(Tr::tr("JavaScript construct in source file is too complex."), bindingLocation); } const auto existingFile = static_cast(elem->expression)->value.toString(); if (!filesToRemove.removeOne(existingFile)) newFilesList << existingFile; elem = elem->next; } if (!filesToRemove.empty()) { throw ErrorInfo(Tr::tr("The following files were not found in the 'files' list: %1") .arg(filesToRemove.join(QLatin1String(", "))), bindingLocation); } QString filesString; filesString += QLatin1String("[\n"); for (const QString &file : std::as_const(newFilesList)) { filesString += QString(arrayElemIndentation, QLatin1Char(' ')); filesString += QStringLiteral("\"%1\",\n").arg(file); } filesString += QString(bindingIndentation, QLatin1Char(' ')); filesString += QLatin1Char(']'); rewriter.changeBinding(itemFinder.item()->initializer, StringConstants::filesProperty(), filesString, Rewriter::ScriptBinding); break; } case QbsQmlJS::AST::Node::Kind_StringLiteral: { if (m_files.size() != 1) { throw ErrorInfo(Tr::tr("Was requested to remove %1 files, but there is only " "one in the list.").arg(m_files.size()), bindingLocation); } const auto existingFile = static_cast(exprStatement->expression)->value.toString(); if (existingFile != m_files.front()) { throw ErrorInfo(Tr::tr("File '%1' could not be found in the 'files' list.") .arg(m_files.front()), bindingLocation); } rewriter.changeBinding(itemFinder.item()->initializer, StringConstants::filesProperty(), StringConstants::emptyArrayValue(), Rewriter::ScriptBinding); break; } default: throw ErrorInfo(Tr::tr("JavaScript construct in source file is too complex."), bindingLocation); } setLineOffset(getLineOffsetForChangedBinding(changeSet, getNodeRepresentation(fileContent, exprStatement->expression))); const int bindingLine = getBindingLine(changeSet, fileContent); const int bindingColumn = (bindingFinder.binding() ? arrayElemIndentation : bindingIndentation) + 1; setItemPosition(CodeLocation(projectFile(), bindingLine, bindingColumn)); changeSet.apply(&fileContent); } ProjectFileGroupRemover::ProjectFileGroupRemover(ProductData product, GroupData group) : ProjectFileUpdater(product.location().filePath()) , m_product(std::move(product)) , m_group(std::move(group)) { } void ProjectFileGroupRemover::doApply(QString &fileContent, UiProgram *ast) { ItemFinder productFinder(m_product.location()); ast->accept(&productFinder); if (!productFinder.item()) { throw ErrorInfo(Tr::tr("The project file parser failed to find the product item."), CodeLocation(projectFile())); } ItemFinder groupFinder(m_group.location()); productFinder.item()->accept(&groupFinder); if (!groupFinder.item()) { throw ErrorInfo(Tr::tr("The project file parser failed to find the group item."), m_product.location()); } ChangeSet changeSet; Rewriter rewriter(fileContent, &changeSet, QStringList()); rewriter.removeObjectMember(groupFinder.item(), productFinder.item()); setItemPosition(m_group.location()); const QList &editOps = changeSet.operationList(); QBS_CHECK(editOps.size() == 1); const ChangeSet::EditOp &op = editOps.front(); const QString removedText = fileContent.mid(op.pos1, op.length1); setLineOffset(-removedText.count(QLatin1Char('\n'))); changeSet.apply(&fileContent); } ProjectFileDependenciesAdder::ProjectFileDependenciesAdder( ProductData product, GroupData group, QStringList dependencies) : ProjectFileUpdater(product.location().filePath()) , m_product(std::move(product)) , m_group(std::move(group)) , m_dependencies(std::move(dependencies)) {} void ProjectFileDependenciesAdder::doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast) { if (m_dependencies.empty()) return; ItemFinder itemFinder(m_group.isValid() ? m_group.location() : m_product.location()); ast->accept(&itemFinder); if (!itemFinder.item()) { throw ErrorInfo( Tr::tr("The project file parser failed to find the item."), CodeLocation(projectFile())); } QStringList sortedDeps = m_dependencies; sortedDeps.sort(); ChangeSet changeSet; Rewriter rewriter(fileContent, &changeSet, QStringList()); const int parentItemIndentation = int( itemFinder.item()->qualifiedTypeNameId->firstSourceLocation().startColumn - 1); const int dependsItemIndentation = parentItemIndentation + 4; const QString dependsItemIndentationString = QString(dependsItemIndentation, QLatin1Char(' ')); for (const QString &dep : std::as_const(sortedDeps)) { const QString dependsItemString = dependsItemIndentationString + QString::fromLatin1("Depends { name: \"%1\" }").arg(dep); rewriter.addObject(itemFinder.item()->initializer, dependsItemString); } changeSet.apply(&fileContent); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/api/changeset.h0000644000175100017510000001011115154533055020333 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_CHANGESET_H #define QBS_CHANGESET_H #include #include namespace QbsQmlJS { class ChangeSet { public: struct EditOp { enum Type { Unset, Replace, Move, Insert, Remove, Flip, Copy }; EditOp(): type(Unset), pos1(0), pos2(0), length1(0), length2(0) {} EditOp(Type t): type(t), pos1(0), pos2(0), length1(0), length2(0) {} Type type; int pos1; int pos2; int length1; int length2; QString text; }; struct Range { Range() : start(0), end(0) {} Range(int start, int end) : start(start), end(end) {} int start; int end; }; public: ChangeSet(); ChangeSet(QList operations); bool empty() const; QList operationList() const; void clear(); bool replace(const Range &range, const QString &replacement); bool remove(const Range &range); bool move(const Range &range, int to); bool flip(const Range &range1, const Range &range2); bool copy(const Range &range, int to); bool replace(int start, int end, const QString &replacement); bool remove(int start, int end); bool move(int start, int end, int to); bool flip(int start1, int end1, int start2, int end2); bool copy(int start, int end, int to); bool insert(int pos, const QString &text); bool hadErrors(); void apply(QString *s); private: // length-based API. bool replace_helper(int pos, int length, const QString &replacement); bool move_helper(int pos, int length, int to); bool remove_helper(int pos, int length); bool flip_helper(int pos1, int length1, int pos2, int length2); bool copy_helper(int pos, int length, int to); bool hasOverlap(int pos, int length); QString textAt(int pos, int length); void doReplace(const EditOp &replace, QList *replaceList); void convertToReplace(const EditOp &op, QList *replaceList); void apply_helper(); private: QString *m_string; QList m_operationList; bool m_error; }; } // namespace QbsQmlJS #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/api/internaljobs.cpp0000644000175100017510000003524515154533055021436 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "internaljobs.h" #include "jobs.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class JobObserver : public ProgressObserver { public: JobObserver(InternalJob *job) : m_job(job) { } ~JobObserver() override { delete m_timedLogger; } void cancel() { std::lock_guard lock(m_cancelMutex); m_canceled = true; for (ScriptEngine * const engine : scriptEngines()) engine->cancel(); } private: void initialize(const QString &task, int maximum) override { QBS_ASSERT(!m_timedLogger, delete m_timedLogger); if (m_job->timed()) m_timedLogger = new TimedActivityLogger(m_job->logger(), task, true); m_value = 0; m_maximum = maximum; emit m_job->newTaskStarted(task, maximum, m_job); } void setMaximum(int maximum) override { m_maximum = maximum; emit m_job->totalEffortChanged(maximum, m_job); } void setProgressValue(int value) override { //QBS_ASSERT(value >= m_value, qDebug("old value = %d, new value = %d", m_value, value)); //QBS_ASSERT(value <= m_maximum, qDebug("value = %d, maximum = %d", value, m_maximum)); m_value = value; if (value == m_maximum) { delete m_timedLogger; m_timedLogger = nullptr; } emit m_job->taskProgress(value, m_job); } int progressValue() override { return m_value; } int maximum() const override { return m_maximum; } bool canceled() const override { std::lock_guard lock(m_cancelMutex); return m_canceled; } int m_value = 0; int m_maximum = 0; mutable std::mutex m_cancelMutex; bool m_canceled = false; InternalJob * const m_job; TimedActivityLogger *m_timedLogger = nullptr; }; InternalJob::InternalJob(Logger logger, QObject *parent) : QObject(parent) , m_observer(new JobObserver(this)) , m_ownsObserver(true) , m_logger(std::move(logger)) , m_timed(false) { } InternalJob::~InternalJob() { if (m_ownsObserver) delete m_observer; } void InternalJob::cancel() { m_observer->cancel(); } void InternalJob::shareObserverWith(InternalJob *otherJob) { if (m_ownsObserver) { delete m_observer; m_ownsObserver = false; } m_observer = otherJob->m_observer; } void InternalJob::storeBuildGraph(const TopLevelProjectPtr &project) { try { doSanityChecks(project, logger()); TimedActivityLogger storeTimer(m_logger, Tr::tr("Storing build graph"), timed()); project->store(logger()); } catch (const ErrorInfo &error) { ErrorInfo fullError = this->error(); const auto items = error.items(); for (const ErrorItem &item : items) fullError.append(item); setError(fullError); } } /** * Construct a new thread wrapper for a synchronous job. * This object takes over ownership of the synchronous job. */ InternalJobThreadWrapper::InternalJobThreadWrapper(InternalJob *synchronousJob, QObject *parent) : InternalJob(synchronousJob->logger(), parent) , m_job(synchronousJob) , m_running(false) { synchronousJob->shareObserverWith(this); m_job->moveToThread(&m_thread); connect(m_job, &InternalJob::finished, this, &InternalJobThreadWrapper::handleFinished); connect(m_job, &InternalJob::newTaskStarted, this, &InternalJob::newTaskStarted); connect(m_job, &InternalJob::taskProgress, this, &InternalJob::taskProgress); connect(m_job, &InternalJob::totalEffortChanged, this, &InternalJob::totalEffortChanged); connect(this, &InternalJobThreadWrapper::startRequested, m_job, &InternalJob::start); } InternalJobThreadWrapper::~InternalJobThreadWrapper() { if (m_running) { cancel(); while (m_running) QCoreApplication::processEvents(); } m_thread.quit(); m_thread.wait(); delete m_job; m_job = nullptr; } void InternalJobThreadWrapper::start() { setTimed(m_job->timed()); m_thread.start(); m_running = true; QTimer::singleShot(0, this, &InternalJobThreadWrapper::startRequested); } void InternalJobThreadWrapper::handleFinished() { m_running = false; setError(m_job->error()); emit finished(this); } InternalSetupProjectJob::InternalSetupProjectJob(const Logger &logger) : InternalJob(logger) { } InternalSetupProjectJob::~InternalSetupProjectJob() = default; void InternalSetupProjectJob::init(const TopLevelProjectPtr &existingProject, const SetupProjectParameters ¶meters) { m_existingProject = existingProject; m_parameters = parameters; setTimed(parameters.logElapsedTime()); } void InternalSetupProjectJob::reportError(const ErrorInfo &error) { setError(error); emit finished(this); } TopLevelProjectPtr InternalSetupProjectJob::project() const { return m_newProject; } void InternalSetupProjectJob::start() { BuildGraphLocker *bgLocker = m_existingProject ? m_existingProject->bgLocker : nullptr; bool deleteLocker = false; try { const ErrorInfo err = m_parameters.expandBuildConfiguration(); if (err.hasError()) throw err; const QString projectId = TopLevelProject::deriveId( m_parameters.finalBuildConfigurationTree()); const QString buildDir = TopLevelProject::deriveBuildDirectory(m_parameters.buildRoot(), projectId); if (m_existingProject && m_existingProject->buildDirectory != buildDir) m_existingProject.reset(); if (!m_existingProject) { bgLocker = new BuildGraphLocker(ProjectBuildData::deriveBuildGraphFilePath(buildDir, projectId), logger(), m_parameters.waitLockBuildGraph(), observer()); deleteLocker = true; } execute(); if (m_existingProject) { if (m_existingProject != m_newProject) m_existingProject->makeModuleProvidersNonTransient(); m_existingProject->bgLocker = nullptr; } m_newProject->bgLocker = bgLocker; deleteLocker = false; } catch (const ErrorInfo &error) { m_newProject.reset(); setError(error); // Delete the build graph locker if and only if we allocated it here. if (deleteLocker) delete bgLocker; } emit finished(this); } void InternalSetupProjectJob::execute() { RulesEvaluationContextPtr evalContext(new RulesEvaluationContext(logger())); evalContext->setObserver(observer()); switch (m_parameters.restoreBehavior()) { case SetupProjectParameters::ResolveOnly: resolveProjectFromScratch(evalContext->engine()); resolveBuildDataFromScratch(evalContext); break; case SetupProjectParameters::RestoreOnly: m_newProject = restoreProject(evalContext).loadedProject; break; case SetupProjectParameters::RestoreAndTrackChanges: case SetupProjectParameters::RestoreAndResolve: { const BuildGraphLoadResult loadResult = restoreProject(evalContext); m_newProject = loadResult.newlyResolvedProject; if (!m_newProject) m_newProject = loadResult.loadedProject; if (!m_newProject) { resolveProjectFromScratch(evalContext->engine()); resolveBuildDataFromScratch(evalContext); } else { QBS_CHECK(m_newProject->buildData); } break; } } if (!m_parameters.dryRun()) storeBuildGraph(m_newProject); // The evalutation context cannot be re-used for building, which runs in a different thread. m_newProject->buildData->evaluationContext.reset(); } void InternalSetupProjectJob::resolveProjectFromScratch(ScriptEngine *engine) { ProjectResolver resolver(m_parameters, engine, logger()); resolver.setProgressObserver(observer()); m_newProject = resolver.resolve(); QBS_CHECK(m_newProject); } void InternalSetupProjectJob::resolveBuildDataFromScratch(const RulesEvaluationContextPtr &evalContext) { BuildDataResolver(logger(), m_parameters).resolveBuildData(m_newProject, evalContext); } BuildGraphLoadResult InternalSetupProjectJob::restoreProject(const RulesEvaluationContextPtr &evalContext) { BuildGraphLoader bgLoader(logger()); BuildGraphLoadResult loadResult = bgLoader.load(m_existingProject, m_parameters, evalContext); return loadResult; } BuildGraphTouchingJob::BuildGraphTouchingJob(const Logger &logger, QObject *parent) : InternalJob(logger, parent), m_dryRun(false) { } BuildGraphTouchingJob::~BuildGraphTouchingJob() = default; void BuildGraphTouchingJob::setup(const TopLevelProjectPtr &project, const QVector &products, bool dryRun) { m_project = project; m_products = products; m_dryRun = dryRun; } void BuildGraphTouchingJob::storeBuildGraph() { if (!m_dryRun && !error().isInternalError()) InternalJob::storeBuildGraph(m_project); } InternalBuildJob::InternalBuildJob(const Logger &logger, QObject *parent) : BuildGraphTouchingJob(logger, parent), m_executor(nullptr) { } void InternalBuildJob::build(const TopLevelProjectPtr &project, const QVector &products, const BuildOptions &buildOptions) { setup(project, products, buildOptions.dryRun()); setTimed(buildOptions.logElapsedTime()); m_executor = new Executor(logger()); m_executor->setProject(project); m_executor->setProducts(products); m_executor->setBuildOptions(buildOptions); m_executor->setProgressObserver(observer()); const auto executorThread = new QThread(this); m_executor->moveToThread(executorThread); connect(m_executor, &Executor::reportCommandDescription, this, &BuildGraphTouchingJob::reportCommandDescription); connect(m_executor, &Executor::reportProcessResult, this, &BuildGraphTouchingJob::reportProcessResult); connect(executorThread, &QThread::started, m_executor, &Executor::build); connect(m_executor, &Executor::finished, this, &InternalBuildJob::handleFinished); connect(m_executor, &QObject::destroyed, executorThread, &QThread::quit); connect(executorThread, &QThread::finished, this, &InternalBuildJob::emitFinished); executorThread->start(); } void InternalBuildJob::handleFinished() { setError(m_executor->error()); project()->buildData->evaluationContext.reset(); storeBuildGraph(); m_executor->deleteLater(); } void InternalBuildJob::emitFinished() { emit finished(this); } InternalCleanJob::InternalCleanJob(const Logger &logger, QObject *parent) : BuildGraphTouchingJob(logger, parent) { } void InternalCleanJob::init(const TopLevelProjectPtr &project, const QVector &products, const CleanOptions &options) { setup(project, products, options.dryRun()); setTimed(options.logElapsedTime()); m_options = options; } void InternalCleanJob::start() { try { ArtifactCleaner cleaner(logger(), observer()); cleaner.cleanup(project(), products(), m_options); } catch (const ErrorInfo &error) { setError(error); } storeBuildGraph(); emit finished(this); } InternalInstallJob::InternalInstallJob(const Logger &logger) : InternalJob(logger) { } InternalInstallJob::~InternalInstallJob() = default; void InternalInstallJob::init(const TopLevelProjectPtr &project, const QVector &products, const InstallOptions &options) { m_project = project; m_products = products; m_options = options; setTimed(options.logElapsedTime()); } void InternalInstallJob::start() { try { auto reporter = [this](const QString &desc) { emit reportCommandDescription(QStringLiteral("filegen"), desc); }; ProductInstaller( m_project, m_products, m_options, observer(), logger(), std::move(reporter)) .install(); } catch (const ErrorInfo &error) { setError(error); } emit finished(this); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/api/rulecommand_p.h0000644000175100017510000000466415154533055021237 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_RULECOMMAND_P_H #define QBS_RULECOMMAND_P_H #include "rulecommand.h" #include #include namespace qbs { namespace Internal { class RuleCommandPrivate : public QSharedData { public: RuleCommandPrivate(): type(RuleCommand::InvalidType) {} RuleCommand::Type type; QString description; QString extendedDescription; QString sourceCode; QString executable; QStringList arguments; QString workingDir; QProcessEnvironment environment; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/api/jobs.cpp0000644000175100017510000003272615154533055017702 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "jobs.h" #include "internaljobs.h" #include "project_p.h" #include #include #include #include #include namespace qbs { using namespace Internal; /*! * \class AbstractJob * \brief The \c AbstractJob class represents an operation relating to a \c Project. * Concrete child classes of \c AbstractJob are created by factory functions in the \c Project * class. The respective objects represent an operation that is started automatically * and is considered "running" until the \c finished() signal has been emitted. Afterwards, * callers can find out whether the operation was successful by calling \c hasError(). While * the operation is going on, progress information is being provided via \c taskStarted() and * \c taskProgress. * Note that though a job is being started automatically by its factory function, you are guaranteed * to recevieve all signals it emits if you connect to it right after getting the object from the * creating function. * \sa Project */ /*! * \enum AbstractJob::State * This enum type specifies which states a job can be in. * \value StateRunning The respective operation is ongoing. * \value StateCanceling The job has been requested to cancel via \c AbstractJob::cancel(), * but the \c AbstractJob::finished() signal has not been emitted yet. * \value StateFinished The operation has finished and the \c AbstractJob::finished() signal * has been emitted. */ /*! * \fn AbstractJob::State AbstractJob::state() const * \brief Returns the current state of the operation. */ /*! * \fn bool AbstractJob::hasError() const * \brief Returns true if the operation has finished with an error, otherwise returns false. * This function should not be called before the \c finished() signal has been emitted. */ /*! * \fn void AbstractJob::taskStarted(const QString &description, int maximumProgressValue, qbs::AbstractJob *job) * \brief Indicates that a new task has been started. * The \a description parameter is a string intended for presentation to a user. * The \a maximumProgressValue parameter indicates the maximum value to which subsequent values of * \c taskProgress() will go. * This signal is typically emitted exactly once for a job that finishes successfully. However, * operations might emit it several times if they are made up of subtasks whose overall effort * cannot be determined in advance. * \sa AbstractJob::taskProgress() */ /*! * \fn void taskProgress(int newProgressValue, qbs::AbstractJob *job) * \brief Indicates progress in executing the operation. * The \a newProgressValue parameter represents the current progress. It is always greater than * zero, strictly increasing and goes up to the \c maximumProgressValue argument of the last * call to \c taskStarted(). * \sa AbstractJob::taskStarted() */ /*! * \fn void finished(bool success, qbs::AbstractJob *job) * \brief Indicates that the operation has finished. * Check the \a success parameter to find out whether everything went fine or an error occurred. */ AbstractJob::AbstractJob(InternalJob *internalJob, QObject *parent) : QObject(parent), m_internalJob(internalJob) { m_internalJob->setParent(this); connect(m_internalJob, &InternalJob::newTaskStarted, this, &AbstractJob::handleTaskStarted, Qt::QueuedConnection); connect(m_internalJob, &InternalJob::totalEffortChanged, this, &AbstractJob::handleTotalEffortChanged); connect(m_internalJob, &InternalJob::taskProgress, this, &AbstractJob::handleTaskProgress, Qt::QueuedConnection); connect(m_internalJob, &InternalJob::finished, this, &AbstractJob::handleFinished); m_state = StateRunning; } bool AbstractJob::lockProject(const TopLevelProjectPtr &project) { // The API is not thread-safe, so we don't need a mutex here, as the API requests come in // synchronously. if (project->locked) { internalJob()->setError(tr("Cannot start a job while another one is in progress.")); QTimer::singleShot(0, this, [this] { emit finished(false, this); }); return false; } project->locked = true; m_project = project; return true; } void AbstractJob::unlockProject() { if (!m_project) return; QBS_ASSERT(m_project->locked, return); m_project->locked = false; } /*! * \brief Destroys the object, canceling the operation if necessary. */ AbstractJob::~AbstractJob() { m_internalJob->disconnect(this); cancel(); } /*! * \brief Returns the error which caused this operation to fail, if it did fail. */ ErrorInfo AbstractJob::error() const { if (m_error.hasError()) return m_error; return internalJob()->error(); } /*! * \brief Cancels this job. * Note that the job might not finish immediately. If you need to make sure it has actually * finished, wait for the \c finished() signal. * \sa AbstractJob::finished(AbstractJob *); */ void AbstractJob::cancel() { if (m_state != StateRunning) return; m_state = StateCanceling; internalJob()->cancel(); } void AbstractJob::handleTaskStarted(const QString &description, int maximumProgressValue) { emit taskStarted(description, maximumProgressValue, this); } void AbstractJob::handleTotalEffortChanged(int totalEffort) { emit totalEffortChanged(totalEffort, this); } void AbstractJob::handleTaskProgress(int newProgressValue) { emit taskProgress(newProgressValue, this); } void AbstractJob::handleFinished() { QBS_ASSERT(m_state != StateFinished, return); finish(); m_state = StateFinished; unlockProject(); emit finished(!error().hasError(), this); } /*! * \class SetupProjectJob * \brief The \c SetupProjectJob class represents an operation that reads a qbs project file and * creates a \c Project object from it. * Note that this job can emit the \c taskStarted() signal more than once. * \sa AbstractJob::taskStarted() */ SetupProjectJob::SetupProjectJob(const Logger &logger, QObject *parent) : AbstractJob(new InternalJobThreadWrapper(new InternalSetupProjectJob(logger)), parent) { if (logger.logSink()->logLevel() == LoggerDebug || logger.logSink()->logLevel() == LoggerTrace) QLoggingCategory::setFilterRules(QStringLiteral("qbs.*.debug=true")); } /*! * \brief Returns the project resulting from this operation. * Note that the result is undefined if the job did not finish successfully. * \sa AbstractJob::hasError() */ Project SetupProjectJob::project() const { auto const wrapper = qobject_cast(internalJob()); auto const job = qobject_cast(wrapper->synchronousJob()); return {job->project(), job->logger()}; } void SetupProjectJob::resolve(const Project &existingProject, const SetupProjectParameters ¶meters) { m_existingProject = existingProject; const TopLevelProjectPtr &existingInternalProject = existingProject.d ? existingProject.d->internalProject : TopLevelProjectPtr(); if (existingInternalProject && !lockProject(existingInternalProject)) return; auto const wrapper = qobject_cast(internalJob()); auto const job = qobject_cast(wrapper->synchronousJob()); job->init(existingInternalProject, parameters); wrapper->start(); } void SetupProjectJob::reportError(const ErrorInfo &error) { auto const wrapper = qobject_cast(internalJob()); auto const job = qobject_cast(wrapper->synchronousJob()); job->reportError(error); } void SetupProjectJob::finish() { // If the new project was successfully created, invalidate the existing one. // The invariant is that there must always be at most one valid Project object // for the same build directory, so that exclusive ownership of the build graph lock // is ensured. // We also need to invalidate the project if an error has occurred after the build data was // already transferred. if (m_existingProject.isValid() && (!error().hasError() || !m_existingProject.d->internalProject->buildData)) { m_existingProject.d->internalProject.reset(); } } /*! * \class ProcessResult * \brief The \c ProcessResult class represents the result of one external program run by Qbs. * * The \c ProcessResult class represents all the information on one external program that was * run by Qbs. It includes the command line used to start the program, the working directory * as well as output and exit codes. */ /*! * \class BuildJob * \brief The \c BuildJob class represents a build operation. */ /*! * \fn void BuildJob::reportCommandDescription(const QString &highlight, const QString &message) * \brief Signals that a new command is being worked on. * The \a highlight parameter is used to decide on the colors and font styles to be used to * print the message. * The \a message parameter is the localized message to print. */ /*! * \fn void BuildJob::reportProcessResult(const qbs::ProcessResult &result) * \brief Signals that an external command has finished. * The \a result parameter contains all details on the process that was run by Qbs. */ BuildJob::BuildJob(const Logger &logger, QObject *parent) : AbstractJob(new InternalBuildJob(logger), parent) { connect(&LauncherInterface::instance(), &LauncherInterface::errorOccurred, this, &BuildJob::handleLauncherError); auto job = static_cast(internalJob()); connect(job, &BuildGraphTouchingJob::reportCommandDescription, this, &BuildJob::reportCommandDescription); connect(job, &BuildGraphTouchingJob::reportProcessResult, this, &BuildJob::reportProcessResult); } void BuildJob::build(const TopLevelProjectPtr &project, const QVector &products, const BuildOptions &options) { if (!lockProject(project)) return; LauncherInterface::startLauncher(); qobject_cast(internalJob())->build(project, products, options); } void BuildJob::handleLauncherError(const ErrorInfo &error) { setError(error); cancel(); } void BuildJob::finish() { LauncherInterface::stopLauncher(); } /*! * \class CleanJob * \brief The \c CleanJob class represents an operation removing build artifacts. */ CleanJob::CleanJob(const Logger &logger, QObject *parent) : AbstractJob(new InternalJobThreadWrapper(new InternalCleanJob(logger)), parent) { } void CleanJob::clean(const TopLevelProjectPtr &project, const QVector &products, const qbs::CleanOptions &options) { if (!lockProject(project)) return; auto wrapper = qobject_cast(internalJob()); qobject_cast(wrapper->synchronousJob())->init(project, products, options); wrapper->start(); } /*! * \class InstallJob * \brief The \c InstallJob class represents an operation installing files. */ InstallJob::InstallJob(const Logger &logger, QObject *parent) : AbstractJob(new InternalJobThreadWrapper(new InternalInstallJob(logger)), parent) { } void InstallJob::install(const TopLevelProjectPtr &project, const QVector &products, const InstallOptions &options) { if (!lockProject(project)) return; auto wrapper = qobject_cast(internalJob()); auto installJob = qobject_cast(wrapper->synchronousJob()); installJob->init(project, products, options); wrapper->start(); } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/api/changeset.cpp0000644000175100017510000002342215154533055020677 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "changeset.h" namespace QbsQmlJS { ChangeSet::ChangeSet() : m_string(nullptr), m_error(false) { } ChangeSet::ChangeSet(QList operations) : m_string(nullptr), m_operationList(std::move(operations)), m_error(false) { } static bool overlaps(int posA, int lengthA, int posB, int lengthB) { if (lengthB > 0) { return // right edge of B contained in A (posA < posB + lengthB && posA + lengthA >= posB + lengthB) // left edge of B contained in A || (posA <= posB && posA + lengthA > posB) // A contained in B || (posB < posA && posB + lengthB > posA + lengthA); } return (posB > posA && posB < posA + lengthA); } bool ChangeSet::hasOverlap(int pos, int length) { for (const EditOp &cmd : m_operationList) { switch (cmd.type) { case EditOp::Replace: if (overlaps(pos, length, cmd.pos1, cmd.length1)) return true; break; case EditOp::Move: if (overlaps(pos, length, cmd.pos1, cmd.length1)) return true; if (cmd.pos2 > pos && cmd.pos2 < pos + length) return true; break; case EditOp::Insert: if (cmd.pos1 > pos && cmd.pos1 < pos + length) return true; break; case EditOp::Remove: if (overlaps(pos, length, cmd.pos1, cmd.length1)) return true; break; case EditOp::Flip: if (overlaps(pos, length, cmd.pos1, cmd.length1)) return true; if (overlaps(pos, length, cmd.pos2, cmd.length2)) return true; break; case EditOp::Copy: if (overlaps(pos, length, cmd.pos1, cmd.length1)) return true; if (cmd.pos2 > pos && cmd.pos2 < pos + length) return true; break; case EditOp::Unset: break; } } return false; } bool ChangeSet::empty() const { return m_operationList.empty(); } QList ChangeSet::operationList() const { return m_operationList; } void ChangeSet::clear() { m_string = nullptr; m_operationList.clear(); m_error = false; } bool ChangeSet::replace_helper(int pos, int length, const QString &replacement) { if (hasOverlap(pos, length)) m_error = true; EditOp cmd(EditOp::Replace); cmd.pos1 = pos; cmd.length1 = length; cmd.text = replacement; m_operationList.push_back(cmd); return !m_error; } bool ChangeSet::move_helper(int pos, int length, int to) { if (hasOverlap(pos, length) || hasOverlap(to, 0) || overlaps(pos, length, to, 0)) m_error = true; EditOp cmd(EditOp::Move); cmd.pos1 = pos; cmd.length1 = length; cmd.pos2 = to; m_operationList.push_back(cmd); return !m_error; } bool ChangeSet::insert(int pos, const QString &text) { Q_ASSERT(pos >= 0); if (hasOverlap(pos, 0)) m_error = true; EditOp cmd(EditOp::Insert); cmd.pos1 = pos; cmd.text = text; m_operationList.push_back(cmd); return !m_error; } bool ChangeSet::replace(const Range &range, const QString &replacement) { return replace(range.start, range.end, replacement); } bool ChangeSet::remove(const Range &range) { return remove(range.start, range.end); } bool ChangeSet::move(const Range &range, int to) { return move(range.start, range.end, to); } bool ChangeSet::flip(const Range &range1, const Range &range2) { return flip(range1.start, range1.end, range2.start, range2.end); } bool ChangeSet::copy(const Range &range, int to) { return copy(range.start, range.end, to); } bool ChangeSet::replace(int start, int end, const QString &replacement) { return replace_helper(start, end - start, replacement); } bool ChangeSet::remove(int start, int end) { return remove_helper(start, end - start); } bool ChangeSet::move(int start, int end, int to) { return move_helper(start, end - start, to); } bool ChangeSet::flip(int start1, int end1, int start2, int end2) { return flip_helper(start1, end1 - start1, start2, end2 - start2); } bool ChangeSet::copy(int start, int end, int to) { return copy_helper(start, end - start, to); } bool ChangeSet::remove_helper(int pos, int length) { if (hasOverlap(pos, length)) m_error = true; EditOp cmd(EditOp::Remove); cmd.pos1 = pos; cmd.length1 = length; m_operationList.push_back(cmd); return !m_error; } bool ChangeSet::flip_helper(int pos1, int length1, int pos2, int length2) { if (hasOverlap(pos1, length1) || hasOverlap(pos2, length2) || overlaps(pos1, length1, pos2, length2)) m_error = true; EditOp cmd(EditOp::Flip); cmd.pos1 = pos1; cmd.length1 = length1; cmd.pos2 = pos2; cmd.length2 = length2; m_operationList.push_back(cmd); return !m_error; } bool ChangeSet::copy_helper(int pos, int length, int to) { if (hasOverlap(pos, length) || hasOverlap(to, 0) || overlaps(pos, length, to, 0)) m_error = true; EditOp cmd(EditOp::Copy); cmd.pos1 = pos; cmd.length1 = length; cmd.pos2 = to; m_operationList.push_back(cmd); return !m_error; } void ChangeSet::doReplace(const EditOp &replace_helper, QList *replaceList) { Q_ASSERT(replace_helper.type == EditOp::Replace); { for (EditOp &c : *replaceList) { if (replace_helper.pos1 <= c.pos1) c.pos1 += replace_helper.text.size(); if (replace_helper.pos1 < c.pos1) c.pos1 -= replace_helper.length1; } } if (m_string) { m_string->replace(replace_helper.pos1, replace_helper.length1, replace_helper.text); } } void ChangeSet::convertToReplace(const EditOp &op, QList *replaceList) { EditOp replace1(EditOp::Replace); EditOp replace2(EditOp::Replace); switch (op.type) { case EditOp::Replace: replaceList->push_back(op); break; case EditOp::Move: replace1.pos1 = op.pos1; replace1.length1 = op.length1; replaceList->push_back(replace1); replace2.pos1 = op.pos2; replace2.text = textAt(op.pos1, op.length1); replaceList->push_back(replace2); break; case EditOp::Insert: replace1.pos1 = op.pos1; replace1.text = op.text; replaceList->push_back(replace1); break; case EditOp::Remove: replace1.pos1 = op.pos1; replace1.length1 = op.length1; replaceList->push_back(replace1); break; case EditOp::Flip: replace1.pos1 = op.pos1; replace1.length1 = op.length1; replace1.text = textAt(op.pos2, op.length2); replaceList->push_back(replace1); replace2.pos1 = op.pos2; replace2.length1 = op.length2; replace2.text = textAt(op.pos1, op.length1); replaceList->push_back(replace2); break; case EditOp::Copy: replace1.pos1 = op.pos2; replace1.text = textAt(op.pos1, op.length1); replaceList->push_back(replace1); break; case EditOp::Unset: break; } } bool ChangeSet::hadErrors() { return m_error; } void ChangeSet::apply(QString *s) { m_string = s; apply_helper(); m_string = nullptr; } QString ChangeSet::textAt(int pos, int length) { if (m_string) { return m_string->mid(pos, length); } return {}; } void ChangeSet::apply_helper() { // convert all ops to replace QList replaceList; { while (!m_operationList.empty()) { const EditOp cmd(m_operationList.front()); m_operationList.removeFirst(); convertToReplace(cmd, &replaceList); } } // execute replaces while (!replaceList.empty()) { const EditOp cmd(replaceList.front()); replaceList.removeFirst(); doReplace(cmd, &replaceList); } } } // namespace QbsQmlJS qbs-src-3.2.0/src/lib/corelib/api/rulecommand.cpp0000644000175100017510000001206315154533055021243 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "rulecommand.h" #include "rulecommand_p.h" #include namespace qbs { /*! * \class RuleCommand * \brief The \c RuleCommand class corresponds to a \c ProcessCommand or \c JavaScriptCommand * in \QBS. */ /*! * \enum RuleCommand::Type * This enum type represents the different kinds of commands. * \value ProcessCommandType For the \QBS type \c ProcessCommand, which represents a command * whose execution involves calling an executable. * \value JavaScriptCommandType For the \QBS type \c JavaScriptCommand, which represents a command * whose execution involves running a piece of JavaScript code inside \QBS. * \value InvalidType Used to mark \c RuleCommand objects as invalid. */ RuleCommand::RuleCommand() : d(new Internal::RuleCommandPrivate) { } RuleCommand::RuleCommand(const RuleCommand &other) = default; RuleCommand::~RuleCommand() = default; RuleCommand& RuleCommand::operator=(const RuleCommand &other) = default; /*! * Returns the type of this object. If the value is \c InvalidType, the object is invalid. */ RuleCommand::Type RuleCommand::type() const { return d->type; } /*! * Returns the human-readable description of this command that \QBS will print when * the command executed. */ QString RuleCommand::description() const { return d->description; } /*! * Returns the detailed description of this command that \QBS will print when * the command is executed. */ QString RuleCommand::extendedDescription() const { return d->extendedDescription; } /*! * Returns the source of the command if \c type() is \c JavaScriptCommandType. * If \c type() is anything else, the behavior of this function is undefined. */ QString RuleCommand::sourceCode() const { QBS_ASSERT(type() == JavaScriptCommandType, return {}); return d->sourceCode; } /*! * Returns the executable that will be called when the corresponding \c ProcessCommand * is executed. * If \c type() is not \c ProcessCommandType, the behavior of this function is undefined. */ QString RuleCommand::executable() const { QBS_ASSERT(type() == ProcessCommandType, return {}); return d->executable; } /*! * Returns the command-line arguments of the executable that will be called when the * corresponding \c ProcessCommand is executed. * If \c type() is not \c ProcessCommandType, the behavior of this function is undefined. */ QStringList RuleCommand::arguments() const { QBS_ASSERT(type() == ProcessCommandType, return {}); return d->arguments; } /*! * Returns the working directory of the executable that will be called when the * corresponding \c ProcessCommand is executed. * If \c type() is not \c ProcessCommandType, the behavior of this function is undefined. */ QString RuleCommand::workingDirectory() const { QBS_ASSERT(type() == ProcessCommandType, return {}); return d->workingDir; } /*! * Returns the environment of the executable that will be called when the * corresponding \c ProcessCommand is executed. * If \c type() is not \c ProcessCommandType, the behavior of this function is undefined. */ QProcessEnvironment RuleCommand::environment() const { QBS_ASSERT(type() == ProcessCommandType, return {}); return d->environment; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/api/projectdata.h0000644000175100017510000002363515154533055020711 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROJECTDATA_H #define QBS_PROJECTDATA_H #include "../tools/codelocation.h" #include "../tools/qbs_export.h" #include #include #include #include #include #include #include namespace qbs { namespace Internal { class ArtifactDataPrivate; class GroupDataPrivate; class InstallDataPrivate; class ModuleDataPrivate; class ProductDataPrivate; class ProjectPrivate; class ProjectDataPrivate; class PropertyMapPrivate; } // namespace Internal class PropertyMap; QBS_EXPORT bool operator==(const PropertyMap &pm1, const PropertyMap &pm2); QBS_EXPORT bool operator!=(const PropertyMap &pm1, const PropertyMap &pm2); class QBS_EXPORT PropertyMap { friend class Internal::ProjectPrivate; friend QBS_EXPORT bool operator==(const PropertyMap &, const PropertyMap &); friend QBS_EXPORT bool operator!=(const PropertyMap &, const PropertyMap &); public: struct PropertyInfo { QString name; QString type; QVariant value; bool isBuiltin = false; }; PropertyMap(); PropertyMap(const PropertyMap &other); PropertyMap(PropertyMap &&other) Q_DECL_NOEXCEPT; ~PropertyMap(); PropertyMap &operator =(const PropertyMap &other); PropertyMap &operator =(PropertyMap &&other) Q_DECL_NOEXCEPT; QStringList allProperties() const; QStringList allModules() const; QList allPropertiesForModule(const QString &module) const; QVariant getProperty(const QString &name) const; QStringList getModulePropertiesAsStringList(const QString &moduleName, const QString &propertyName) const; QVariant getModuleProperty(const QString &moduleName, const QString &propertyName) const; // For debugging. QString toString() const; private: std::unique_ptr d; }; class InstallData; class QBS_EXPORT ArtifactData { friend class Internal::ProjectPrivate; public: ArtifactData(); ArtifactData(const ArtifactData &other); ArtifactData(ArtifactData &&) Q_DECL_NOEXCEPT; ArtifactData &operator=(const ArtifactData &other); ArtifactData &operator=(ArtifactData &&) Q_DECL_NOEXCEPT; ~ArtifactData(); bool isValid() const; QJsonObject toJson(const QStringList &moduleProperties = {}) const; QString filePath() const; QStringList fileTags() const; bool isGenerated() const; bool isExecutable() const; bool isTargetArtifact() const; PropertyMap properties() const; InstallData installData() const; QStringList childPaths() const; private: QExplicitlySharedDataPointer d; }; class QBS_EXPORT InstallData { friend class Internal::ProjectPrivate; public: InstallData(); InstallData(const InstallData &other); InstallData(InstallData &&) Q_DECL_NOEXCEPT; InstallData &operator=(const InstallData &other); InstallData &operator=(InstallData &&) Q_DECL_NOEXCEPT; ~InstallData(); bool isValid() const; QJsonObject toJson() const; bool isInstallable() const; QString installDir() const; QString installFilePath() const; QString installRoot() const; QString localInstallDir() const; QString localInstallFilePath() const; private: QExplicitlySharedDataPointer d; }; QBS_EXPORT bool operator==(const ArtifactData &ta1, const ArtifactData &ta2); QBS_EXPORT bool operator!=(const ArtifactData &ta1, const ArtifactData &ta2); QBS_EXPORT bool operator<(const ArtifactData &ta1, const ArtifactData &ta2); class QBS_EXPORT GroupData { friend class Internal::ProjectPrivate; public: GroupData(); GroupData(const GroupData &other); GroupData(GroupData &&) Q_DECL_NOEXCEPT; GroupData &operator=(const GroupData &other); GroupData &operator=(GroupData &&) Q_DECL_NOEXCEPT; ~GroupData(); bool isValid() const; QJsonObject toJson(const QStringList &moduleProperties = {}) const; CodeLocation location() const; QString name() const; QString prefix() const; QList sourceArtifacts() const; QList sourceArtifactsFromWildcards() const; QList allSourceArtifacts() const; PropertyMap properties() const; bool isEnabled() const; QStringList allFilePaths() const; private: QExplicitlySharedDataPointer d; }; QBS_EXPORT bool operator==(const GroupData &lhs, const GroupData &rhs); QBS_EXPORT bool operator!=(const GroupData &lhs, const GroupData &rhs); QBS_EXPORT bool operator<(const GroupData &lhs, const GroupData &rhs); class QBS_EXPORT ModuleData { friend class Internal::ProjectPrivate; public: ModuleData(); ModuleData(const ModuleData &other); ModuleData(ModuleData &&) noexcept; ModuleData &operator=(const ModuleData &other); ModuleData &operator=(ModuleData &&) noexcept; ~ModuleData(); bool isValid() const; CodeLocation location() const; QString name() const; const QList> &properties() const; private: QExplicitlySharedDataPointer d; }; QBS_EXPORT bool operator==(const ModuleData &lhs, const ModuleData &rhs); QBS_EXPORT bool operator!=(const ModuleData &lhs, const ModuleData &rhs); QBS_EXPORT bool operator<(const ModuleData &lhs, const ModuleData &rhs); class QBS_EXPORT ProductData { friend class Internal::ProjectPrivate; public: ProductData(); ProductData(const ProductData &other); ProductData(ProductData &&) Q_DECL_NOEXCEPT; ProductData &operator=(const ProductData &other); ProductData &operator=(ProductData &&) Q_DECL_NOEXCEPT; ~ProductData(); bool isValid() const; QJsonObject toJson(const QStringList &propertyNames = {}) const; const QStringList &type() const; const QStringList &dependencies() const; const QString &name() const; QString fullDisplayName() const; const QString &targetName() const; const QString &version() const; QString profile() const; const QString &multiplexConfigurationId() const; const CodeLocation &location() const; const QString &buildDirectory() const; const QList &generatedArtifacts() const; const QList targetArtifacts() const; const QList installableArtifacts() const; QString targetExecutable() const; const QList &groups() const; const QVariantMap &properties() const; const PropertyMap &moduleProperties() const; const QList &modules() const; bool isEnabled() const; bool isRunnable() const; bool isMultiplexed() const; private: QExplicitlySharedDataPointer d; }; QBS_EXPORT bool operator==(const ProductData &lhs, const ProductData &rhs); QBS_EXPORT bool operator!=(const ProductData &lhs, const ProductData &rhs); QBS_EXPORT bool operator<(const ProductData &lhs, const ProductData &rhs); class QBS_EXPORT ProjectData { friend class Internal::ProjectPrivate; public: ProjectData(); ProjectData(const ProjectData &other); ProjectData(ProjectData &&) Q_DECL_NOEXCEPT; ProjectData &operator=(const ProjectData &other); ProjectData &operator=(ProjectData &&) Q_DECL_NOEXCEPT; ~ProjectData(); bool isValid() const; QJsonObject toJson(const QStringList &moduleProperties = {}) const; const QString &name() const; const CodeLocation &location() const; bool isEnabled() const; const QString &buildDirectory() const; const QList &products() const; const QList &subProjects() const; const QList allProducts() const; const QList installableArtifacts() const; private: QExplicitlySharedDataPointer d; }; QBS_EXPORT bool operator==(const ProjectData &lhs, const ProjectData &rhs); QBS_EXPORT bool operator!=(const ProjectData &lhs, const ProjectData &rhs); QBS_EXPORT bool operator<(const ProjectData &lhs, const ProjectData &rhs); } // namespace qbs #endif // QBS_PROJECTDATA_H qbs-src-3.2.0/src/lib/corelib/api/project.cpp0000644000175100017510000013732415154533055020413 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "project.h" #include "project_p.h" #include "internaljobs.h" #include "jobs.h" #include "projectdata_p.h" #include "projectfileupdater.h" #include "propertymap_p.h" #include "rulecommand_p.h" #include "runenvironment.h" #include "transformerdata_p.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { static bool pluginsLoaded = false; static std::mutex pluginsLoadedMutex; static void loadPlugins(const QStringList &_pluginPaths, const Logger &logger) { std::lock_guard locker(pluginsLoadedMutex); if (pluginsLoaded) return; std::vector pluginPaths; for (const QString &pluginPath : _pluginPaths) { if (!FileInfo::exists(pluginPath)) { #ifndef QBS_STATIC_LIB logger.qbsWarning() << Tr::tr("Plugin path '%1' does not exist.") .arg(QDir::toNativeSeparators(pluginPath)); #endif } else { pluginPaths.push_back(pluginPath.toStdString()); } } auto pluginManager = QbsPluginManager::instance(); pluginManager->loadStaticPlugins(); pluginManager->loadPlugins(pluginPaths, logger); qRegisterMetaType("qbs::ErrorInfo"); qRegisterMetaType("qbs::ProcessResult"); qRegisterMetaType("Internal::InternalJob *"); qRegisterMetaType("qbs::AbstractJob *"); pluginsLoaded = true; } ProjectData ProjectPrivate::projectData() { m_projectData = ProjectData(); retrieveProjectData(m_projectData, internalProject); m_projectData.d->buildDir = internalProject->buildDirectory; return m_projectData; } BuildJob *ProjectPrivate::buildProducts( const QVector &products, const BuildOptions &options, QObject *jobOwner) { const auto job = new BuildJob(logger, jobOwner); job->build(internalProject, products, options); QBS_ASSERT(job->state() == AbstractJob::StateRunning,); return job; } CleanJob *ProjectPrivate::cleanProducts(const QVector &products, const CleanOptions &options, QObject *jobOwner) { const auto job = new CleanJob(logger, jobOwner); job->clean(internalProject, products, options); QBS_ASSERT(job->state() == AbstractJob::StateRunning,); return job; } InstallJob *ProjectPrivate::installProducts( const QVector &products, const InstallOptions &options, QObject *jobOwner) { const auto job = new InstallJob(logger, jobOwner); job->install(internalProject, products, options); QBS_ASSERT(job->state() == AbstractJob::StateRunning,); return job; } QVector ProjectPrivate::internalProducts(const QList &products) const { QVector internalProducts; for (const ProductData &product : products) { if (product.isEnabled()) internalProducts.push_back(internalProduct(product)); } return internalProducts; } static QVector enabledInternalProducts(const ResolvedProjectConstPtr &project, bool includingNonDefault) { QVector products; for (const ResolvedProductPtr &p : project->products) { if (p->enabled && (includingNonDefault || p->builtByDefault())) products.push_back(p); } for (const auto &subProject : std::as_const(project->subProjects)) products << enabledInternalProducts(subProject, includingNonDefault); return products; } QVector ProjectPrivate::allEnabledInternalProducts( bool includingNonDefault) const { return enabledInternalProducts(internalProject, includingNonDefault); } static bool matches(const ProductData &product, const ResolvedProductConstPtr &rproduct) { return product.name() == rproduct->name && product.multiplexConfigurationId() == rproduct->multiplexConfigurationId; } static ResolvedProductPtr internalProductForProject(const ResolvedProjectConstPtr &project, const ProductData &product) { for (const ResolvedProductPtr &resolvedProduct : project->products) { if (matches(product, resolvedProduct)) return resolvedProduct; } for (const auto &subProject : std::as_const(project->subProjects)) { const ResolvedProductPtr &p = internalProductForProject(subProject, product); if (p) return p; } return {}; } ResolvedProductPtr ProjectPrivate::internalProduct(const ProductData &product) const { return internalProductForProject(internalProject, product); } ProductData ProjectPrivate::findProductData(const ProductData &product) const { for (const ProductData &p : m_projectData.allProducts()) { if (p.name() == product.name() && p.profile() == product.profile() && p.multiplexConfigurationId() == product.multiplexConfigurationId()) { return p; } } return {}; } QList ProjectPrivate::findProductsByName(const QString &name) const { QList list; for (const ProductData &p : m_projectData.allProducts()) { if (p.name() == name) list.push_back(p); } return list; } GroupData ProjectPrivate::findGroupData(const ProductData &product, const QString &groupName) const { for (const GroupData &g : product.groups()) { if (g.name() == groupName) return g; } return {}; } GroupData ProjectPrivate::createGroupDataFromGroup(const GroupPtr &resolvedGroup, const ResolvedProductConstPtr &product) { GroupData group; group.d->name = resolvedGroup->name; group.d->prefix = resolvedGroup->prefix; group.d->location = resolvedGroup->location; QBS_ASSERT(resolvedGroup->files, return group); for (const auto &sa : *resolvedGroup->files) { ArtifactData artifact = createApiSourceArtifact(sa); setupInstallData(artifact, product); if (sa->fromWildcard) group.d->sourceArtifactsFromWildcards.push_back(artifact); else group.d->sourceArtifacts.push_back(artifact); } std::sort(group.d->sourceArtifacts.begin(), group.d->sourceArtifacts.end()); std::sort(group.d->sourceArtifactsFromWildcards.begin(), group.d->sourceArtifactsFromWildcards.end()); group.d->properties.d->m_map = resolvedGroup->properties; group.d->isEnabled = resolvedGroup->enabled; group.d->isValid = true; return group; } ArtifactData ProjectPrivate::createApiSourceArtifact(const SourceArtifactConstPtr &sa) { ArtifactData saApi; saApi.d->isValid = true; saApi.d->filePath = sa->absoluteFilePath; saApi.d->fileTags = sa->fileTags.toStringList(); saApi.d->isGenerated = false; saApi.d->isTargetArtifact = false; saApi.d->properties.d->m_map = sa->properties; return saApi; } ArtifactData ProjectPrivate::createArtifactData(const Artifact *artifact, const ResolvedProductConstPtr &product, const ArtifactSet &targetArtifacts) { ArtifactData ta; ta.d->filePath = artifact->filePath(); ta.d->fileTags = artifact->fileTags().toStringList(); ta.d->properties.d->m_map = artifact->properties; for (const Artifact *a : filterByType(artifact->children)) { ta.d->childPaths << a->filePath(); for (const auto *f : a->fileDependencies) ta.d->childPaths << f->filePath(); } ta.d->isGenerated = artifact->artifactType == Artifact::Generated; ta.d->isTargetArtifact = targetArtifacts.contains(const_cast(artifact)); ta.d->isValid = true; setupInstallData(ta, product); return ta; } void ProjectPrivate::setupInstallData(ArtifactData &artifact, const ResolvedProductConstPtr &product) { artifact.d->installData.d->isValid = true; artifact.d->installData.d->isInstallable = artifact.properties().getModuleProperty( StringConstants::qbsModule(), StringConstants::installProperty()).toBool(); if (!artifact.d->installData.d->isInstallable) return; const QString installRoot = artifact.properties().getModuleProperty( StringConstants::qbsModule(), StringConstants::installRootProperty()).toString(); InstallOptions options; options.setInstallRoot(installRoot); artifact.d->installData.d->installRoot = installRoot; try { QString installFilePath = ProductInstaller::targetFilePath(product->topLevelProject(), product->sourceDirectory, artifact.filePath(), artifact.properties().d->m_map, options); if (!installRoot.isEmpty()) installFilePath.remove(0, installRoot.size()); artifact.d->installData.d->installFilePath = installFilePath; } catch (const ErrorInfo &e) { logger.printWarning(e); } } void ProjectPrivate::addGroup(const ProductData &product, const QString &groupName) { if (groupName.isEmpty()) throw ErrorInfo(Tr::tr("Group has an empty name.")); if (!product.isValid()) throw ErrorInfo(Tr::tr("Product is invalid.")); QList products = findProductsByName(product.name()); if (products.empty()) throw ErrorInfo(Tr::tr("Product '%1' does not exist.").arg(product.name())); const auto resolvedProducts = internalProducts(products); QBS_CHECK(products.size() == resolvedProducts.size()); for (const GroupPtr &resolvedGroup : resolvedProducts.front()->groups) { if (resolvedGroup->name == groupName) { throw ErrorInfo(Tr::tr("Group '%1' already exists in product '%2'.") .arg(groupName, product.name()), resolvedGroup->location); } } ProjectFileGroupInserter groupInserter(products.front(), groupName); groupInserter.apply(); } ProjectPrivate::GroupUpdateContext ProjectPrivate::getGroupContext(const ProductData &product, const GroupData &group) { GroupUpdateContext context; if (!product.isValid()) throw ErrorInfo(Tr::tr("Product is invalid.")); context.products = findProductsByName(product.name()); if (context.products.empty()) throw ErrorInfo(Tr::tr("Product '%1' does not exist.").arg(product.name())); context.resolvedProducts = internalProducts(context.products); const QString groupName = group.isValid() ? group.name() : product.name(); for (const ResolvedProductPtr &p : std::as_const(context.resolvedProducts)) { for (const GroupPtr &g : p->groups) { if (g->name == groupName) { context.resolvedGroups << g; break; } } } if (context.resolvedGroups.empty()) throw ErrorInfo(Tr::tr("Group '%1' does not exist.").arg(groupName)); for (const ProductData &p : std::as_const(context.products)) { const GroupData &g = findGroupData(p, groupName); QBS_CHECK(p.isValid()); context.groups << g; } QBS_CHECK(context.resolvedProducts.size() == context.products.size()); QBS_CHECK(context.resolvedProducts.size() == context.resolvedGroups.size()); QBS_CHECK(context.products.size() == context.groups.size()); return context; } static bool matchesWildcard(const QString &filePath, const GroupConstPtr &group) { if (!group->wildcards) return false; for (const QString &pattern : std::as_const(group->wildcards->patterns)) { QString fullPattern; if (QFileInfo(group->prefix).isAbsolute()) { fullPattern = group->prefix; } else { fullPattern = QFileInfo(group->location.filePath()).absolutePath() + QLatin1Char('/') + group->prefix; } fullPattern.append(QLatin1Char('/')).append(pattern); fullPattern = QDir::cleanPath(fullPattern); if (QRegularExpression(QRegularExpression::wildcardToRegularExpression(fullPattern)).match(filePath).hasMatch()) return true; } return false; } ProjectPrivate::FileListUpdateContext ProjectPrivate::getFileListContext(const ProductData &product, const GroupData &group, const QStringList &filePaths, bool forAdding) { FileListUpdateContext filesContext; GroupUpdateContext &groupContext = filesContext.groupContext; groupContext = getGroupContext(product, group); if (filePaths.empty()) throw ErrorInfo(Tr::tr("No files supplied.")); QString prefix; for (int i = 0; i < groupContext.resolvedGroups.size(); ++i) { const GroupPtr &g = groupContext.resolvedGroups.at(i); if (!g->prefix.isEmpty() && !g->prefix.endsWith(QLatin1Char('/'))) throw ErrorInfo(Tr::tr("Group has non-directory prefix.")); if (i == 0) prefix = g->prefix; else if (prefix != g->prefix) throw ErrorInfo(Tr::tr("Cannot update: Group prefix depends on properties.")); } QString baseDirPath = QFileInfo(product.location().filePath()).dir().absolutePath() + QLatin1Char('/') + prefix; QDir baseDir(baseDirPath); for (const QString &filePath : filePaths) { const QString absPath = QDir::cleanPath(FileInfo::resolvePath(baseDirPath, filePath)); if (filesContext.absoluteFilePaths.contains(absPath)) throw ErrorInfo(Tr::tr("File '%1' appears more than once.").arg(absPath)); if (forAdding && !FileInfo(absPath).exists()) throw ErrorInfo(Tr::tr("File '%1' does not exist.").arg(absPath)); if (matchesWildcard(absPath, groupContext.resolvedGroups.front())) { filesContext.absoluteFilePathsFromWildcards << absPath; } else { filesContext.absoluteFilePaths << absPath; filesContext.relativeFilePaths << baseDir.relativeFilePath(absPath); } } return filesContext; } void ProjectPrivate::addFiles(const ProductData &product, const GroupData &group, const QStringList &filePaths) { FileListUpdateContext filesContext = getFileListContext(product, group, filePaths, true); GroupUpdateContext &groupContext = filesContext.groupContext; // We do not check for entries in other groups, because such doublettes might be legitimate // due to conditions. for (const GroupPtr &group : std::as_const(groupContext.resolvedGroups)) { for (const QString &filePath : std::as_const(filesContext.absoluteFilePaths)) { if (group->files) { for (const auto &sa : *group->files) { if (sa->absoluteFilePath == filePath) { throw ErrorInfo(Tr::tr("File '%1' already exists in group '%2'.") .arg(filePath, group->name)); } } } } } ProjectFileFilesAdder adder(groupContext.products.front(), group.isValid() ? groupContext.groups.front() : GroupData(), filesContext.relativeFilePaths); adder.apply(); } void ProjectPrivate::addDependencies( const ProductData &product, const GroupData &group, const QStringList &dependencies) { GroupUpdateContext groupContext = getGroupContext(product, group); QStringList depsToInsert = dependencies; for (auto it = depsToInsert.begin(); it != depsToInsert.end();) { if (product.dependencies().contains(*it)) it = depsToInsert.erase(it); else ++it; } ProjectFileDependenciesAdder adder( groupContext.products.front(), group.isValid() ? groupContext.groups.front() : GroupData(), depsToInsert); adder.apply(); } void ProjectPrivate::removeFiles(const ProductData &product, const GroupData &group, const QStringList &filePaths) { FileListUpdateContext filesContext = getFileListContext(product, group, filePaths, false); GroupUpdateContext &groupContext = filesContext.groupContext; if (!filesContext.absoluteFilePathsFromWildcards.empty()) { throw ErrorInfo(Tr::tr("The following files cannot be removed from the project file, " "because they match wildcard patterns: %1") .arg(filesContext.absoluteFilePathsFromWildcards.join(QLatin1String(", ")))); } QStringList filesNotFound = filesContext.absoluteFilePaths; std::vector sourceArtifacts; QBS_ASSERT(groupContext.resolvedGroups.front()->files, return); for (const SourceArtifactPtr &sa : *groupContext.resolvedGroups.front()->files) { if (filesNotFound.removeOne(sa->absoluteFilePath)) sourceArtifacts << sa; } if (!filesNotFound.empty()) { throw ErrorInfo(Tr::tr("The following files are not known to qbs: %1") .arg(filesNotFound.join(QLatin1String(", ")))); } ProjectFileFilesRemover remover(groupContext.products.front(), group.isValid() ? groupContext.groups.front() : GroupData(), filesContext.relativeFilePaths); remover.apply(); } void ProjectPrivate::removeGroup(const ProductData &product, const GroupData &group) { GroupUpdateContext context = getGroupContext(product, group); ProjectFileGroupRemover remover(context.products.front(), context.groups.front()); remover.apply(); } void ProjectPrivate::prepareChangeToProject() { if (internalProject->locked) throw ErrorInfo(Tr::tr("A job is currently in progress.")); if (!m_projectData.isValid()) retrieveProjectData(m_projectData, internalProject); } RuleCommandList ProjectPrivate::ruleCommandListForTransformer(const Transformer *transformer) { RuleCommandList list; for (const AbstractCommandPtr &internalCommand : std::as_const(transformer->commands.commands())) { RuleCommand externalCommand; externalCommand.d->description = internalCommand->description(); externalCommand.d->extendedDescription = internalCommand->extendedDescription(); switch (internalCommand->type()) { case AbstractCommand::JavaScriptCommandType: { externalCommand.d->type = RuleCommand::JavaScriptCommandType; const JavaScriptCommandPtr &jsCmd = std::static_pointer_cast(internalCommand); externalCommand.d->sourceCode = jsCmd->sourceCode(); break; } case AbstractCommand::ProcessCommandType: { externalCommand.d->type = RuleCommand::ProcessCommandType; const ProcessCommandPtr &procCmd = std::static_pointer_cast(internalCommand); externalCommand.d->executable = procCmd->program(); externalCommand.d->arguments = procCmd->arguments(); externalCommand.d->workingDir = procCmd->workingDir(); externalCommand.d->environment = procCmd->environment(); break; } } list << externalCommand; } return list; } RuleCommandList ProjectPrivate::ruleCommands(const ProductData &product, const QString &inputFilePath, const QString &outputFileTag) { if (internalProject->locked) throw ErrorInfo(Tr::tr("A job is currently in progress.")); const ResolvedProductConstPtr resolvedProduct = internalProduct(product); if (!resolvedProduct) throw ErrorInfo(Tr::tr("No such product '%1'.").arg(product.name())); if (!resolvedProduct->enabled) throw ErrorInfo(Tr::tr("Product '%1' is disabled.").arg(product.name())); QBS_CHECK(resolvedProduct->buildData); const ArtifactSet &outputArtifacts = resolvedProduct->buildData->artifactsByFileTag() .value(FileTag(outputFileTag.toLocal8Bit())); for (const Artifact * const outputArtifact : std::as_const(outputArtifacts)) { const TransformerConstPtr transformer = outputArtifact->transformer; if (!transformer) continue; for (const Artifact * const inputArtifact : std::as_const(transformer->inputs)) { if (inputArtifact->filePath() == inputFilePath) return ruleCommandListForTransformer(transformer.get()); } } throw ErrorInfo(Tr::tr("No rule was found that produces an artifact tagged '%1' " "from input file '%2'.").arg(outputFileTag, inputFilePath)); } ProjectTransformerData ProjectPrivate::transformerData() { if (!m_projectData.isValid()) retrieveProjectData(m_projectData, internalProject); ProjectTransformerData projectTransformerData; for (const ProductData &productData : m_projectData.allProducts()) { if (!productData.isEnabled()) continue; const ResolvedProductConstPtr product = internalProduct(productData); QBS_ASSERT(!!product, continue); QBS_ASSERT(!!product->buildData, continue); const ArtifactSet targetArtifacts = product->targetArtifacts(); Set allTransformers; for (const Artifact * const a : TypeFilter(product->buildData->allNodes())) { if (a->artifactType == Artifact::Generated) allTransformers.insert(a->transformer.get()); } if (allTransformers.empty()) continue; ProductTransformerData productTransformerData; for (const Transformer * const t : allTransformers) { TransformerData tData; Set allInputs; for (Artifact * const a : t->outputs) { tData.d->outputs << createArtifactData(a, product, targetArtifacts); for (const Artifact * const child : filterByType(a->children)) allInputs << child; } for (const Artifact * const input : allInputs) tData.d->inputs << createArtifactData(input, product, targetArtifacts); tData.d->commands = ruleCommandListForTransformer(t); productTransformerData << tData; } projectTransformerData << qMakePair(productData, productTransformerData); } return projectTransformerData; } static bool productIsRunnable(const ResolvedProductConstPtr &product) { const bool isBundle = product->moduleProperties->moduleProperty( QStringLiteral("bundle"), QStringLiteral("isBundle")).toBool(); const QString androidSdkPackageType = product->moduleProperties->moduleProperty( QStringLiteral("Android.sdk"), QStringLiteral("packageType")).toString(); const bool isAndroidApk = androidSdkPackageType == QStringLiteral("apk"); return isRunnableArtifact(product->fileTags, isBundle, isAndroidApk); } static bool productIsMultiplexed(const ResolvedProductConstPtr &product) { return product->productProperties.value(StringConstants::multiplexedProperty()).toBool(); } void ProjectPrivate::retrieveProjectData(ProjectData &projectData, const ResolvedProjectConstPtr &internalProject) { projectData.d->name = internalProject->name; projectData.d->location = internalProject->location; projectData.d->enabled = internalProject->enabled; for (const auto &resolvedProduct : internalProject->products) { ProductData product; product.d->type = resolvedProduct->fileTags.toStringList(); product.d->name = resolvedProduct->name; product.d->targetName = resolvedProduct->targetName; product.d->version = resolvedProduct ->productProperties.value(StringConstants::versionProperty()).toString(); product.d->multiplexConfigurationId = resolvedProduct->multiplexConfigurationId; product.d->location = resolvedProduct->location; product.d->buildDirectory = resolvedProduct->buildDirectory(); product.d->isEnabled = resolvedProduct->enabled; product.d->isRunnable = productIsRunnable(resolvedProduct); product.d->isMultiplexed = productIsMultiplexed(resolvedProduct); product.d->properties = resolvedProduct->productProperties; product.d->moduleProperties.d->m_map = resolvedProduct->moduleProperties; for (const ResolvedModulePtr &m : std::as_const(resolvedProduct->modules)) { ModuleData module; module.d->name = m->name; module.d->location = m->location; module.d->properties = m->properties; product.d->modules << module; } for (const GroupPtr &resolvedGroup : resolvedProduct->groups) { if (resolvedGroup->targetOfModule.isEmpty() && resolvedGroup->files) { product.d->groups << createGroupDataFromGroup(resolvedGroup, resolvedProduct); } } if (resolvedProduct->enabled) { QBS_CHECK(resolvedProduct->buildData); const ArtifactSet targetArtifacts = resolvedProduct->targetArtifacts(); for (Artifact * const a : filterByType(resolvedProduct->buildData->allNodes())) { if (a->artifactType != Artifact::Generated) continue; product.d->generatedArtifacts << createArtifactData(a, resolvedProduct, targetArtifacts); } const AllRescuableArtifactData &rad = resolvedProduct->buildData->rescuableArtifactData(); for (auto it = rad.begin(); it != rad.end(); ++it) { ArtifactData ta; ta.d->filePath = it.key(); ta.d->fileTags = it.value().fileTags.toStringList(); ta.d->properties.d->m_map = it.value().properties; Artifact * const child = lookupArtifact(resolvedProduct, it.key(), true); if (child) { for (const Artifact *a : filterByType(child->children)) { ta.d->childPaths << a->filePath(); for (const auto *f : a->fileDependencies) ta.d->childPaths << f->filePath(); } } ta.d->isGenerated = true; ta.d->isTargetArtifact = resolvedProduct->fileTags.intersects(it.value().fileTags); ta.d->isValid = true; setupInstallData(ta, resolvedProduct); product.d->generatedArtifacts << ta; } } for (const ProductDependency &dep : std::as_const(resolvedProduct->dependencies)) product.d->dependencies << dep.product->fullDisplayName(); std::sort(product.d->type.begin(), product.d->type.end()); std::sort(product.d->groups.begin(), product.d->groups.end()); std::sort(product.d->generatedArtifacts.begin(), product.d->generatedArtifacts.end()); product.d->isValid = true; projectData.d->products << product; } for (const auto &internalSubProject : std::as_const(internalProject->subProjects)) { if (!internalSubProject->enabled) continue; ProjectData subProject; retrieveProjectData(subProject, internalSubProject); projectData.d->subProjects << subProject; } projectData.d->isValid = true; std::sort(projectData.d->products.begin(), projectData.d->products.end()); std::sort(projectData.d->subProjects.begin(), projectData.d->subProjects.end()); } } // namespace Internal using namespace Internal; /*! * \class Project * \brief The \c Project class provides services related to a qbs project. */ Project::Project(const TopLevelProjectPtr &internalProject, const Logger &logger) : d(new ProjectPrivate(internalProject, logger)) { } Project::Project(const Project &other) = default; Project::~Project() = default; /*! * \brief Returns true if and only if this object was retrieved from a successful \c SetupProjectJob. * \sa SetupProjectJob */ bool Project::isValid() const { return d && d->internalProject; } /*! * \brief The top-level profile for building this project. */ QString Project::profile() const { QBS_ASSERT(isValid(), return {}); return d->internalProject->profile(); } Project &Project::operator=(const Project &other) = default; /*! * \brief Sets up a \c Project from a source file, possibly re-using previously stored information. * The function will finish immediately, returning a \c SetupProjectJob which can be used to * track the results of the operation. * If the function is called on a valid \c Project object, the build graph will not be loaded * from a file, but will be taken from the existing project. In that case, if resolving * finishes successfully, the existing project will be invalidated. If resolving fails, qbs will * try to keep the existing project valid. However, under certain circumstances, resolving the new * project will fail at a time where existing project data has already been touched, in which case * the existing project has to be invalidated (this could be avoided, but it would hurt performance). * So after an unsuccessful re-resolve job, the existing project may or may not be valid anymore. * \note The qbs plugins will only be loaded once. As a result, the value of * \c parameters.pluginPaths will only have an effect the first time this function is called. * Similarly, the value of \c parameters.searchPaths will not have an effect if * a stored build graph is available. */ SetupProjectJob *Project::setupProject(const SetupProjectParameters ¶meters, ILogSink *logSink, QObject *jobOwner) { Logger logger(logSink); const auto job = new SetupProjectJob(logger, jobOwner); try { loadPlugins(parameters.pluginPaths(), logger); job->resolve(*this, parameters); QBS_ASSERT(job->state() == AbstractJob::StateRunning,); } catch (const ErrorInfo &error) { // Throwing from here would complicate the API, so let's report the error the same way // as all others, via AbstractJob::error(). job->reportError(error); } return job; } Project::Project() = default; /*! * \brief Retrieves information for this project. * Call this function if you need insight into the project structure, e.g. because you want to know * which products or files are in it. */ ProjectData Project::projectData() const { QBS_ASSERT(isValid(), return {}); return d->projectData(); } RunEnvironment Project::getRunEnvironment(const ProductData &product, const InstallOptions &installOptions, const QProcessEnvironment &environment, const QStringList &setupRunEnvConfig, Settings *settings) const { const ResolvedProductPtr resolvedProduct = d->internalProduct(product); return { resolvedProduct, d->internalProject, installOptions, environment, setupRunEnvConfig, settings, d->logger}; } /*! * \enum Project::ProductSelection * This enum type specifies which products to include if "all" products are to be built. * \value Project::ProdProductSelectionDefaultOnly Indicates that only those products should be * built whose \c builtByDefault property * is \c true. * \value Project::ProdProductSelectionWithNonDefault Indicates that products whose * \c builtByDefault property is \c false should * also be built. */ /*! * \brief Causes all products of this project to be built, if necessary. * If and only if \c producSelection is \c Project::ProductSelectionWithNonDefault, products with * the \c builtByDefault property set to \c false will be built too. * The function will finish immediately, returning a \c BuildJob identifiying the operation. */ BuildJob *Project::buildAllProducts(const BuildOptions &options, ProductSelection productSelection, QObject *jobOwner) const { QBS_ASSERT(isValid(), return nullptr); const bool includingNonDefault = productSelection == ProductSelectionWithNonDefault; return d->buildProducts(d->allEnabledInternalProducts(includingNonDefault), options, jobOwner); } /*! * \brief Causes the specified list of products to be built. * Use this function if you only want to build some products, not the whole project. If any of * the products in \a products depend on other products, those will also be built to the extent * that it is necessary. * The function will finish immediately, returning a \c BuildJob identifiying the operation. */ BuildJob *Project::buildSomeProducts(const QList &products, const BuildOptions &options, QObject *jobOwner) const { QBS_ASSERT(isValid(), return nullptr); return d->buildProducts(d->internalProducts(products), options, jobOwner); } /*! * \brief Convenience function for \c buildSomeProducts(). * \sa Project::buildSomeProducts(). */ BuildJob *Project::buildOneProduct(const ProductData &product, const BuildOptions &options, QObject *jobOwner) const { return buildSomeProducts(QList() << product, options, jobOwner); } /*! * \brief Removes the build artifacts of all products in the project. * The function will finish immediately, returning a \c CleanJob identifiying this operation. * \sa Project::cleanSomeProducts() */ CleanJob *Project::cleanAllProducts(const CleanOptions &options, QObject *jobOwner) const { QBS_ASSERT(isValid(), return nullptr); return d->cleanProducts(d->allEnabledInternalProducts(true), options, jobOwner); } /*! * \brief Removes the build artifacts of the given products. * The function will finish immediately, returning a \c CleanJob identifiying this operation. */ CleanJob *Project::cleanSomeProducts(const QList &products, const CleanOptions &options, QObject *jobOwner) const { QBS_ASSERT(isValid(), return nullptr); return d->cleanProducts(d->internalProducts(products), options, jobOwner); } /*! * \brief Convenience function for \c cleanSomeProducts(). * \sa Project::cleanSomeProducts(). */ CleanJob *Project::cleanOneProduct(const ProductData &product, const CleanOptions &options, QObject *jobOwner) const { return cleanSomeProducts(QList() << product, options, jobOwner); } /*! * \brief Installs the installable files of all products in the project. * If and only if \c producSelection is \c Project::ProductSelectionWithNonDefault, products with * the \c builtByDefault property set to \c false will be installed too. * The function will finish immediately, returning an \c InstallJob identifiying this operation. */ InstallJob *Project::installAllProducts(const InstallOptions &options, ProductSelection productSelection, QObject *jobOwner) const { QBS_ASSERT(isValid(), return nullptr); const bool includingNonDefault = productSelection == ProductSelectionWithNonDefault; return d->installProducts( d->allEnabledInternalProducts(includingNonDefault), options, jobOwner); } /*! * \brief Installs the installable files of the given products. * The function will finish immediately, returning an \c InstallJob identifiying this operation. */ InstallJob *Project::installSomeProducts(const QList &products, const InstallOptions &options, QObject *jobOwner) const { QBS_ASSERT(isValid(), return nullptr); return d->installProducts(d->internalProducts(products), options, jobOwner); } /*! * \brief Convenience function for \c installSomeProducts(). * \sa Project::installSomeProducts(). */ InstallJob *Project::installOneProduct(const ProductData &product, const InstallOptions &options, QObject *jobOwner) const { return installSomeProducts(QList() << product, options, jobOwner); } /*! * \brief Updates the timestamps of all build artifacts in the given products. * Afterwards, the build graph will have the same state as if a successful build had been done. */ void Project::updateTimestamps(const QList &products) { QBS_ASSERT(isValid(), return); TimestampsUpdater().updateTimestamps(d->internalProject, d->internalProducts(products), d->logger); } /*! * \brief Finds files generated from the given file in the given product. * If \a recursive is \c false, only files generated directly from \a file will be considered, * otherwise the generated files are collected recursively. * If \a tags is not empty, only generated files matching at least one of these tags will * be considered. */ QStringList Project::generatedFiles(const ProductData &product, const QString &file, bool recursive, const QStringList &tags) const { QBS_ASSERT(isValid(), return {}); const ResolvedProductConstPtr internalProduct = d->internalProduct(product); return internalProduct->generatedFiles(file, recursive, FileTags::fromStringList(tags)); } QVariantMap Project::projectConfiguration() const { QBS_ASSERT(isValid(), return {}); return d->internalProject->buildConfiguration(); } std::set Project::buildSystemFiles() const { QBS_ASSERT(isValid(), return {}); return rangeTo>(d->internalProject->buildSystemFiles); } CodeLinks Project::codeLinks() const { QBS_ASSERT(isValid(), return {}); return d->internalProject->codeLinks; } RuleCommandList Project::ruleCommands(const ProductData &product, const QString &inputFilePath, const QString &outputFileTag, ErrorInfo *error) const { QBS_ASSERT(isValid(), return {}); QBS_ASSERT(product.isValid(), return {}); try { return d->ruleCommands(product, inputFilePath, outputFileTag); } catch (const ErrorInfo &e) { if (error) *error = e; return {}; } } ProjectTransformerData Project::transformerData(ErrorInfo *error) const { QBS_ASSERT(isValid(), return {}); try { return d->transformerData(); } catch (const ErrorInfo &e) { if (error) *error = e; return {}; } } ErrorInfo Project::dumpNodesTree(QIODevice &outDevice, const QList &products) { try { NodeTreeDumper(outDevice).start(d->internalProducts(products)); } catch (const ErrorInfo &e) { return e; } return {}; } Project::BuildGraphInfo Project::getBuildGraphInfo(const QString &bgFilePath, const QStringList &requestedProperties) { BuildGraphInfo info; try { const Internal::TopLevelProjectConstPtr project = BuildGraphLoader::loadProject(bgFilePath); info.bgFilePath = bgFilePath; info.overriddenProperties = project->overriddenValues; info.profileData = project->fullProfileConfigsTree(); std::vector> props; for (const QString &prop : requestedProperties) { QStringList components = prop.split(QLatin1Char('.')); const QString propName = components.takeLast(); props.emplace_back(components.join(QLatin1Char('.')), propName); } for (const auto &product : project->allProducts()) { if (props.empty()) break; if (product->profile() != project->profile()) continue; for (auto it = props.begin(); it != props.end();) { const QVariant value = product->moduleProperties->moduleProperty(it->first, it->second); if (value.isValid()) { info.requestedProperties.insert(it->first + QLatin1Char('.') + it->second, value); it = props.erase(it); } else { ++it; } } } } catch (const ErrorInfo &e) { info.error = e; } return info; } Project::BuildGraphInfo Project::getBuildGraphInfo() const { QBS_ASSERT(isValid(), return {}); BuildGraphInfo info; try { if (d->internalProject->locked) throw ErrorInfo(Tr::tr("A job is currently in progress.")); info.bgFilePath = d->internalProject->buildGraphFilePath(); info.overriddenProperties = d->internalProject->overriddenValues; info.profileData = d->internalProject->fullProfileConfigsTree(); } catch (const ErrorInfo &e) { info.error = e; } return info; } /*! * \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 * and true otherwise. In the latter case, the object will have a sensible description. * After calling this function, it is recommended to re-fetch the project data, as other * items can be affected. * \sa qbs::Project::projectData() */ ErrorInfo Project::addGroup(const ProductData &product, const QString &groupName) { try { QBS_CHECK(isValid()); d->prepareChangeToProject(); d->addGroup(product, groupName); d->internalProject->store(d->logger); return {}; } catch (const ErrorInfo &exception) { auto errorInfo = exception; errorInfo.prepend(Tr::tr("Failure adding group '%1' to product '%2'.") .arg(groupName, product.name())); return errorInfo; } } /*! * \brief Adds the given files to the given product. * If \c group is a default-constructed object, the files will be added to the product's * "files" property, otherwise to the one of \c group. * The file paths can be absolute or relative to the location of \c product (including a possible * prefix in the group). The project file will always contain relative paths. * After calling this function, it is recommended to re-fetch the project data, as other * items can be affected. * \sa qbs::Project::projectData() */ ErrorInfo Project::addFiles(const ProductData &product, const GroupData &group, const QStringList &filePaths) { try { QBS_CHECK(isValid()); d->prepareChangeToProject(); d->addFiles(product, group, filePaths); d->internalProject->store(d->logger); return {}; } catch (const ErrorInfo &exception) { auto errorInfo = exception; errorInfo.prepend(Tr::tr("Failure adding files to product.")); return errorInfo; } } /*! * \brief Adds \c Depends items for the given dependencies to the given product. * If \c group is a default-constructed object, the items will be added at the top level, * otherwise to \c group. * After calling this function, it is recommended to re-fetch the project data, as other * items can be affected. * \sa qbs::Project::projectData() */ ErrorInfo Project::addDependencies( const ProductData &product, const GroupData &group, const QStringList &dependencies) { try { QBS_CHECK(isValid()); d->prepareChangeToProject(); d->addDependencies(product, group, dependencies); d->internalProject->store(d->logger); return {}; } catch (const ErrorInfo &exception) { auto errorInfo = exception; errorInfo.prepend( Tr::tr("Failure adding depencencies to product '%1'.").arg(product.name())); return errorInfo; } } /*! * \brief Removes the given files from the given product. * If \c group is a default-constructed object, the files will be removed from the product's * "files" property, otherwise from the one of \c group. * The file paths can be absolute or relative to the location of \c product (including a possible * prefix in the group). * After calling this function, it is recommended to re-fetch the project data, as other * items can be affected. * \sa qbs::Project::projectData() */ ErrorInfo Project::removeFiles(const ProductData &product, const GroupData &group, const QStringList &filePaths) { try { QBS_CHECK(isValid()); d->prepareChangeToProject(); d->removeFiles(product, group, filePaths); d->internalProject->store(d->logger); return {}; } catch (const ErrorInfo &exception) { auto errorInfo = exception; errorInfo.prepend(Tr::tr("Failure removing files from product '%1'.").arg(product.name())); return errorInfo; } } /*! * \brief Removes the given group from the given product. * After calling this function, it is recommended to re-fetch the project data, as other * items can be affected. * \sa qbs::Project::projectData() */ ErrorInfo Project::removeGroup(const ProductData &product, const GroupData &group) { try { QBS_CHECK(isValid()); d->prepareChangeToProject(); d->removeGroup(product, group); d->internalProject->store(d->logger); return {}; } catch (const ErrorInfo &exception) { auto errorInfo = exception; errorInfo.prepend(Tr::tr("Failure removing group '%1' from product '%2'.") .arg(group.name(), product.name())); return errorInfo; } } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/api/transformerdata.cpp0000644000175100017510000000470515154533055022135 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #include "transformerdata_p.h" #include namespace qbs { TransformerData::TransformerData() : d(new Internal::TransformerDataPrivate) { } TransformerData::TransformerData(const TransformerData &other) = default; TransformerData::~TransformerData() = default; TransformerData& TransformerData::operator=(const TransformerData &other) = default; QList TransformerData::inputs() const { return d->inputs; } QList TransformerData::outputs() const { return d->outputs; } RuleCommandList TransformerData::commands() const { return d->commands; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/api/project.h0000644000175100017510000001632715154533055020057 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROJECT_H #define QBS_PROJECT_H #include "rulecommand.h" #include "transformerdata.h" #include "../language/forward_decls.h" #include "../tools/error.h" #include "../tools/porting.h" #include "../tools/qbs_export.h" #include #include #include #include #include #include QT_BEGIN_NAMESPACE class QIODevice; class QObject; class QProcessEnvironment; QT_END_NAMESPACE namespace qbs { class BuildJob; class BuildOptions; class CleanJob; class CleanOptions; class GroupData; class ILogSink; class InstallJob; class InstallOptions; class ProductData; class ProjectData; class RunEnvironment; class Settings; class SetupProjectJob; class SetupProjectParameters; namespace Internal { class Logger; class ProjectPrivate; } // namespace Internal; class QBS_EXPORT Project { friend class SetupProjectJob; friend QHashValueType qHash(const Project &p); public: SetupProjectJob *setupProject(const SetupProjectParameters ¶meters, ILogSink *logSink, QObject *jobOwner); Project(); Project(const Project &other); Project &operator=(const Project &other); ~Project(); bool isValid() const; QString profile() const; ProjectData projectData() const; RunEnvironment getRunEnvironment(const ProductData &product, const InstallOptions &installOptions, const QProcessEnvironment &environment, const QStringList &setupRunEnvConfig, Settings *settings) const; enum ProductSelection { ProductSelectionDefaultOnly, ProductSelectionWithNonDefault }; BuildJob *buildAllProducts(const BuildOptions &options, ProductSelection productSelection = ProductSelectionDefaultOnly, QObject *jobOwner = nullptr) const; BuildJob *buildSomeProducts(const QList &products, const BuildOptions &options, QObject *jobOwner = nullptr) const; BuildJob *buildOneProduct(const ProductData &product, const BuildOptions &options, QObject *jobOwner = nullptr) const; CleanJob *cleanAllProducts(const CleanOptions &options, QObject *jobOwner = nullptr) const; CleanJob *cleanSomeProducts(const QList &products, const CleanOptions &options, QObject *jobOwner = nullptr) const; CleanJob *cleanOneProduct(const ProductData &product, const CleanOptions &options, QObject *jobOwner = nullptr) const; InstallJob *installAllProducts(const InstallOptions &options, ProductSelection productSelection = ProductSelectionDefaultOnly, QObject *jobOwner = nullptr) const; InstallJob *installSomeProducts(const QList &products, const InstallOptions &options, QObject *jobOwner = nullptr) const; InstallJob *installOneProduct(const ProductData &product, const InstallOptions &options, QObject *jobOwner = nullptr) const; void updateTimestamps(const QList &products); bool operator==(const Project &other) const { return d.data() == other.d.data(); } QStringList generatedFiles(const ProductData &product, const QString &file, bool recursive, const QStringList &tags = QStringList()) const; QVariantMap projectConfiguration() const; std::set buildSystemFiles() const; CodeLinks codeLinks() const; RuleCommandList ruleCommands(const ProductData &product, const QString &inputFilePath, const QString &outputFileTag, ErrorInfo *error = nullptr) const; ProjectTransformerData transformerData(ErrorInfo *error = nullptr) const; ErrorInfo dumpNodesTree(QIODevice &outDevice, const QList &products); class BuildGraphInfo { public: QString bgFilePath; QVariantMap overriddenProperties; QVariantMap profileData; QVariantMap requestedProperties; ErrorInfo error; }; static BuildGraphInfo getBuildGraphInfo(const QString &bgFilePath, const QStringList &requestedProperties); // Use with loaded project. Does not set requestedProperties. BuildGraphInfo getBuildGraphInfo() const; ErrorInfo addGroup(const ProductData &product, const QString &groupName); ErrorInfo addFiles(const ProductData &product, const GroupData &group, const QStringList &filePaths); ErrorInfo addDependencies( const ProductData &product, const GroupData &group, const QStringList &dependencies); ErrorInfo removeFiles(const ProductData &product, const GroupData &group, const QStringList &filePaths); ErrorInfo removeGroup(const ProductData &product, const GroupData &group); private: Project(const Internal::TopLevelProjectPtr &internalProject, const Internal::Logger &logger); QExplicitlySharedDataPointer d; }; inline bool operator!=(const Project &p1, const Project &p2) { return !(p1 == p2); } inline QHashValueType qHash(const Project &p) { return QT_PREPEND_NAMESPACE(qHash)(p.d.data()); } } // namespace qbs #endif // QBS_PROJECT_H qbs-src-3.2.0/src/lib/corelib/api/rulecommand.h0000644000175100017510000000562115154533055020712 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_RULECOMMAND_H #define QBS_RULECOMMAND_H #include #include #include #include QT_BEGIN_NAMESPACE class QProcessEnvironment; QT_END_NAMESPACE namespace qbs { namespace Internal { class ProjectPrivate; class RuleCommandPrivate; } class QBS_EXPORT RuleCommand { friend class Internal::ProjectPrivate; public: RuleCommand(); RuleCommand(const RuleCommand &other); ~RuleCommand(); RuleCommand &operator=(const RuleCommand &other); enum Type { ProcessCommandType, JavaScriptCommandType, InvalidType }; Type type() const; QString description() const; QString extendedDescription() const; QString sourceCode() const; QString executable() const; QStringList arguments() const; QString workingDirectory() const; QProcessEnvironment environment() const; private: QExplicitlySharedDataPointer d; }; using RuleCommandList = QList; } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/api/project_p.h0000644000175100017510000001332015154533055020364 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROJECT_P_H #define QBS_PROJECT_P_H #include "projectdata.h" #include "rulecommand.h" #include "transformerdata.h" #include #include #include #include namespace qbs { class BuildJob; class BuildOptions; class CleanJob; class CleanOptions; class InstallJob; class InstallOptions; namespace Internal { class ProjectPrivate : public QSharedData { public: ProjectPrivate(TopLevelProjectPtr internalProject, Logger logger) : internalProject(std::move(internalProject)), logger(std::move(logger)) { } ProjectData projectData(); BuildJob *buildProducts( const QVector &products, const BuildOptions &options, QObject *jobOwner); CleanJob *cleanProducts(const QVector &products, const CleanOptions &options, QObject *jobOwner); InstallJob *installProducts( const QVector &products, const InstallOptions &options, QObject *jobOwner); QVector internalProducts(const QList &products) const; QVector allEnabledInternalProducts(bool includingNonDefault) const; ResolvedProductPtr internalProduct(const ProductData &product) const; ProductData findProductData(const ProductData &product) const; QList findProductsByName(const QString &name) const; GroupData findGroupData(const ProductData &product, const QString &groupName) const; GroupData createGroupDataFromGroup(const GroupPtr &resolvedGroup, const ResolvedProductConstPtr &product); ArtifactData createApiSourceArtifact(const SourceArtifactConstPtr &sa); ArtifactData createArtifactData(const Artifact *artifact, const ResolvedProductConstPtr &product, const ArtifactSet &targetArtifacts); void setupInstallData(ArtifactData &artifact, const ResolvedProductConstPtr &product); struct GroupUpdateContext { QVector resolvedProducts; QList resolvedGroups; QList products; QList groups; }; struct FileListUpdateContext { GroupUpdateContext groupContext; QStringList absoluteFilePaths; QStringList relativeFilePaths; QStringList absoluteFilePathsFromWildcards; // Not included in the other two lists. }; GroupUpdateContext getGroupContext(const ProductData &product, const GroupData &group); FileListUpdateContext getFileListContext(const ProductData &product, const GroupData &group, const QStringList &filePaths, bool forAdding); void addGroup(const ProductData &product, const QString &groupName); void addFiles(const ProductData &product, const GroupData &group, const QStringList &filePaths); void addDependencies( const ProductData &product, const GroupData &group, const QStringList &dependencies); void removeFiles(const ProductData &product, const GroupData &group, const QStringList &filePaths); void removeGroup(const ProductData &product, const GroupData &group); void prepareChangeToProject(); RuleCommandList ruleCommandListForTransformer(const Transformer *transformer); RuleCommandList ruleCommands(const ProductData &product, const QString &inputFilePath, const QString &outputFileTag); ProjectTransformerData transformerData(); TopLevelProjectPtr internalProject; Logger logger; private: void retrieveProjectData(ProjectData &projectData, const ResolvedProjectConstPtr &internalProject); ProjectData m_projectData; }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/api/languageinfo.cpp0000644000175100017510000001243115154533055021373 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "languageinfo.h" #include #include #include #include namespace qbs { std::string LanguageInfo::qmlTypeInfo() { const Internal::BuiltinDeclarations &builtins = Internal::BuiltinDeclarations::instance(); // Header: std::string result; result.append("import QtQuick.tooling 1.0\n\n"); result.append("// This file describes the plugin-supplied types contained in the library.\n"); result.append("// It is used for QML tooling purposes only.\n\n"); result.append("Module {\n"); // Individual Components: auto typeNames = builtins.allTypeNames(); typeNames.sort(); for (const QString &typeName : std::as_const(typeNames)) { const auto typeNameString = typeName.toStdString(); result.append(" Component {\n"); result.append(" name: \"" + typeNameString + "\"\n"); result.append(" exports: [ \"qbs/"); result.append(typeNameString); result.append(" "); const auto v = builtins.languageVersion(); result.append(QStringLiteral("%1.%2") .arg(v.majorVersion()).arg(v.minorVersion()).toUtf8().data()); result.append("\" ]\n"); result.append(" prototype: \"QQuickItem\"\n"); Internal::ItemDeclaration itemDecl = builtins.declarationsForType(builtins.typeForName(typeName)); const auto properties = Internal::sorted( itemDecl.properties(), [](const auto &lhs, const auto &rhs) { return lhs.name() < rhs.name(); }); for (const Internal::PropertyDeclaration &property : properties) { result.append(" Property { name: \""); result.append(property.name().toUtf8().data()); result.append("\"; "); switch (property.type()) { case qbs::Internal::PropertyDeclaration::UnknownType: result.append("type: \"unknown\""); break; case qbs::Internal::PropertyDeclaration::Boolean: result.append("type: \"bool\""); break; case qbs::Internal::PropertyDeclaration::Integer: result.append("type: \"int\""); break; case qbs::Internal::PropertyDeclaration::Path: result.append("type: \"string\""); break; case qbs::Internal::PropertyDeclaration::PathList: result.append("type: \"string\"; isList: true"); break; case qbs::Internal::PropertyDeclaration::String: result.append("type: \"string\""); break; case qbs::Internal::PropertyDeclaration::StringList: result.append("type: \"string\"; isList: true"); break; case qbs::Internal::PropertyDeclaration::Variant: result.append("type: \"QVariant\""); break; case qbs::Internal::PropertyDeclaration::VariantList: result.append("type: \"QVariantList\""); break; } result.append(" }\n"); // Property } result.append(" }\n"); // Component } // Footer: result.append("}\n"); // Module return result; } Version LanguageInfo::qbsVersion() { static const auto v = Version::fromString(QLatin1String(QBS_VERSION)); return v; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/api/internaljobs.h0000644000175100017510000001522615154533055021100 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_INTERNALJOBS_H #define QBS_INTERNALJOBS_H #include #include #include #include #include #include #include #include #include #include #include namespace qbs { class ProcessResult; class Settings; namespace Internal { class BuildGraphLoadResult; class BuildGraphLocker; class Executor; class JobObserver; class ScriptEngine; class InternalJob : public QObject { Q_OBJECT friend class JobObserver; public: ~InternalJob() override; void cancel(); virtual void start() {} ErrorInfo error() const { return m_error; } void setError(const ErrorInfo &error) { m_error = error; } Logger logger() const { return m_logger; } bool timed() const { return m_timed; } void shareObserverWith(InternalJob *otherJob); protected: explicit InternalJob(Logger logger, QObject *parent = nullptr); JobObserver *observer() const { return m_observer; } void setTimed(bool timed) { m_timed = timed; } void storeBuildGraph(const TopLevelProjectPtr &project); signals: void finished(Internal::InternalJob *job); void newTaskStarted(const QString &description, int totalEffort, Internal::InternalJob *job); void totalEffortChanged(int totalEffort, Internal::InternalJob *job); void taskProgress(int value, Internal::InternalJob *job); void reportCommandDescription(const QString &highlight, const QString &message); private: ErrorInfo m_error; JobObserver *m_observer; bool m_ownsObserver; Logger m_logger; bool m_timed; }; class InternalJobThreadWrapper : public InternalJob { Q_OBJECT public: InternalJobThreadWrapper(InternalJob *synchronousJob, QObject *parent = nullptr); ~InternalJobThreadWrapper() override; void start() override; InternalJob *synchronousJob() const { return m_job; } signals: void startRequested(); private: void handleFinished(); QThread m_thread; InternalJob *m_job; bool m_running; }; class InternalSetupProjectJob : public InternalJob { Q_OBJECT public: InternalSetupProjectJob(const Logger &logger); ~InternalSetupProjectJob() override; void init(const TopLevelProjectPtr &existingProject, const SetupProjectParameters ¶meters); void reportError(const ErrorInfo &error); TopLevelProjectPtr project() const; private: void start() override; void resolveProjectFromScratch(Internal::ScriptEngine *engine); void resolveBuildDataFromScratch(const RulesEvaluationContextPtr &evalContext); BuildGraphLoadResult restoreProject(const RulesEvaluationContextPtr &evalContext); void execute(); TopLevelProjectPtr m_existingProject; TopLevelProjectPtr m_newProject; SetupProjectParameters m_parameters; }; class BuildGraphTouchingJob : public InternalJob { Q_OBJECT public: const QVector &products() const { return m_products; } const TopLevelProjectPtr &project() const { return m_project; } signals: void reportProcessResult(const qbs::ProcessResult &result); protected: BuildGraphTouchingJob(const Logger &logger, QObject *parent = nullptr); ~BuildGraphTouchingJob() override; void setup(const TopLevelProjectPtr &project, const QVector &products, bool dryRun); void storeBuildGraph(); private: TopLevelProjectPtr m_project; QVector m_products; bool m_dryRun; }; class InternalBuildJob : public BuildGraphTouchingJob { Q_OBJECT public: InternalBuildJob(const Logger &logger, QObject *parent = nullptr); void build(const TopLevelProjectPtr &project, const QVector &products, const BuildOptions &buildOptions); private: void handleFinished(); void emitFinished(); Executor *m_executor; }; class InternalCleanJob : public BuildGraphTouchingJob { Q_OBJECT public: InternalCleanJob(const Logger &logger, QObject *parent = nullptr); void init(const TopLevelProjectPtr &project, const QVector &products, const CleanOptions &options); private: void start() override; CleanOptions m_options; }; class InternalInstallJob : public InternalJob { Q_OBJECT public: InternalInstallJob(const Logger &logger); ~InternalInstallJob() override; void init(const TopLevelProjectPtr &project, const QVector &products, const InstallOptions &options); private: void start() override; TopLevelProjectPtr m_project; QVector m_products; InstallOptions m_options; }; } // namespace Internal } // namespace qbs #endif // QBS_INTERNALJOBS_H qbs-src-3.2.0/src/lib/corelib/api/projectdata.cpp0000644000175100017510000010114115154533055021231 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "projectdata.h" #include "projectdata_p.h" #include "propertymap_p.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { using namespace Internal; template static QJsonArray toJsonArray(const QList &list, const QStringList &moduleProperties) { // We can't use transformed from stlutils.h here as QJsonArray has not the reserve() method. QJsonArray jsonArray; transform(list, jsonArray, [&moduleProperties](const T &v) { return v.toJson(moduleProperties);}); return jsonArray; } static QVariant getModuleProperty(const PropertyMap &properties, const QString &fullPropertyName) { const int lastDotIndex = fullPropertyName.lastIndexOf(QLatin1Char('.')); if (lastDotIndex == -1) return {}; return properties.getModuleProperty(fullPropertyName.left(lastDotIndex), fullPropertyName.mid(lastDotIndex + 1)); } static void addModuleProperties(QJsonObject &obj, const PropertyMap &properties, const QStringList &propertyNames) { QJsonObject propertyValues; for (const QString &prop : propertyNames) { const QVariant v = getModuleProperty(properties, prop); if (v.isValid() && !v.isNull()) propertyValues.insert(prop, QJsonValue::fromVariant(v)); } if (!propertyValues.isEmpty()) obj.insert(StringConstants::modulePropertiesKey(), propertyValues); } /*! * \class GroupData * \brief The \c GroupData class corresponds to a Group item in a qbs source file that has its * \c files property set. */ GroupData::GroupData() : d(new GroupDataPrivate) { } GroupData::GroupData(const GroupData &other) = default; GroupData::GroupData(GroupData &&) Q_DECL_NOEXCEPT = default; GroupData &GroupData::operator=(const GroupData &other) = default; GroupData &GroupData::operator=(GroupData &&) Q_DECL_NOEXCEPT = default; GroupData::~GroupData() = default; /*! * \brief Returns true if and only if the Group holds data that was initialized by Qbs. */ bool GroupData::isValid() const { return d->isValid; } QJsonObject GroupData::toJson(const QStringList &moduleProperties) const { QJsonObject obj; if (isValid()) { obj.insert(StringConstants::locationKey(), location().toJson()); obj.insert(StringConstants::nameProperty(), name()); obj.insert(StringConstants::prefixProperty(), prefix()); obj.insert(StringConstants::isEnabledKey(), isEnabled()); obj.insert(QStringLiteral("source-artifacts"), toJsonArray(sourceArtifacts(), {})); obj.insert(QStringLiteral("source-artifacts-from-wildcards"), toJsonArray(sourceArtifactsFromWildcards(), {})); addModuleProperties(obj, properties(), moduleProperties); } return obj; } /*! * \brief The location at which the group is defined in the respective source file. */ CodeLocation GroupData::location() const { return d->location; } /*! * \brief The name of the group. */ QString GroupData::name() const { return d->name; } /*! * \brief The prefix of the group. */ QString GroupData::prefix() const { return d->prefix; } /*! * \brief The files listed in the group item's "files" binding. * \note These do not include expanded wildcards. * \sa GroupData::sourceArtifactsFromWildcards */ QList GroupData::sourceArtifacts() const { return d->sourceArtifacts; } /*! * \brief The list of files resulting from expanding all wildcard patterns in the group. */ QList GroupData::sourceArtifactsFromWildcards() const { return d->sourceArtifactsFromWildcards; } /*! * \brief All files in this group, regardless of how whether they were given explicitly * or via wildcards. * \sa GroupData::sourceArtifacts * \sa GroupData::sourceArtifactsFromWildcards */ QList GroupData::allSourceArtifacts() const { return sourceArtifacts() + sourceArtifactsFromWildcards(); } /*! * \brief The set of properties valid in this group. * Typically, most of them are inherited from the respective \c Product. */ PropertyMap GroupData::properties() const { return d->properties; } /*! * \brief Returns true if this group is enabled in Qbs * This method returns the "condition" property of the \c Group definition. If the group is enabled * then the files in this group will be processed, provided the product it belongs to is also * enabled. * * Note that a group can be enabled, even if the product it belongs to is not. In this case * the files in the group will not be processed. * \sa ProductData::isEnabled() */ bool GroupData::isEnabled() const { QBS_ASSERT(isValid(), return false); return d->isEnabled; } /*! * \brief The paths of all files in this group. * \sa GroupData::allSourceArtifacts */ QStringList GroupData::allFilePaths() const { const QList &artifacts = allSourceArtifacts(); return transformed(artifacts, [](const auto &sa) { return sa.filePath(); }); } bool operator!=(const GroupData &lhs, const GroupData &rhs) { return !(lhs == rhs); } bool operator==(const GroupData &lhs, const GroupData &rhs) { if (!lhs.isValid() && !rhs.isValid()) return true; return lhs.isValid() == rhs.isValid() && lhs.name() == rhs.name() && lhs.location() == rhs.location() && lhs.sourceArtifactsFromWildcards() == rhs.sourceArtifactsFromWildcards() && lhs.sourceArtifacts() == rhs.sourceArtifacts() && lhs.properties() == rhs.properties() && lhs.isEnabled() == rhs.isEnabled(); } bool operator<(const GroupData &lhs, const GroupData &rhs) { return lhs.name() < rhs.name(); } /*! * \class ModuleData * \brief The \c ModuleData class represents the instance of a module pulled in by a product. */ ModuleData::ModuleData() : d(new ModuleDataPrivate) {} ModuleData::ModuleData(const ModuleData &other) = default; ModuleData::ModuleData(ModuleData &&) noexcept = default; ModuleData &ModuleData::operator=(const ModuleData &other) = default; ModuleData &ModuleData::operator=(ModuleData &&) noexcept = default; ModuleData::~ModuleData() = default; /*! * \brief Returns true if and only if this object holds data that was initialized by Qbs. */ bool ModuleData::isValid() const { return d->isValid; } /*! * \brief Returns the location of the \c Module item corresponding to this module. */ CodeLocation ModuleData::location() const { return d->location; } /*! * \brief Returns the name of this module. */ QString ModuleData::name() const { return d->name; } /*! * \brief Returns the names of this module's properties along with the locations * where they are declared at. */ const QList> &ModuleData::properties() const { return d->properties; } bool operator!=(const ModuleData &lhs, const ModuleData &rhs) { return !(lhs == rhs); } bool operator==(const ModuleData &lhs, const ModuleData &rhs) { if (!lhs.isValid() && !rhs.isValid()) return true; return lhs.isValid() == rhs.isValid() && lhs.name() == rhs.name() && lhs.location() == rhs.location() && lhs.properties() == rhs.properties(); } bool operator<(const ModuleData &lhs, const ModuleData &rhs) { return lhs.name() < rhs.name(); } /*! * \class ArtifactData * The \c ArtifactData class describes a file in a product. It is either a source file * or it gets generated during the build process. */ ArtifactData::ArtifactData() : d(new ArtifactDataPrivate) { } ArtifactData::ArtifactData(const ArtifactData &other) = default; ArtifactData::ArtifactData(ArtifactData &&) Q_DECL_NOEXCEPT = default; ArtifactData &ArtifactData::operator=(const ArtifactData &other) = default; ArtifactData &ArtifactData::operator=(ArtifactData &&) Q_DECL_NOEXCEPT = default; ArtifactData::~ArtifactData() = default; /*! * \brief Returns true if and only if this object holds data that was initialized by Qbs. */ bool ArtifactData::isValid() const { return d->isValid; } QJsonObject ArtifactData::toJson(const QStringList &moduleProperties) const { QJsonObject obj; if (isValid()) { obj.insert(StringConstants::filePathKey(), filePath()); obj.insert(QStringLiteral("file-tags"), QJsonArray::fromStringList(fileTags())); obj.insert(QStringLiteral("is-generated"), isGenerated()); obj.insert(QStringLiteral("is-executable"), isExecutable()); obj.insert(QStringLiteral("is-target"), isTargetArtifact()); obj.insert(QStringLiteral("install-data"), installData().toJson()); addModuleProperties(obj, properties(), moduleProperties); } return obj; } /*! * \brief The full path of this file. */ QString ArtifactData::filePath() const { return d->filePath; } /*! * \brief The tags of this file. * Typically, this list will contain just one element. */ QStringList ArtifactData::fileTags() const { return d->fileTags; } bool ArtifactData::isGenerated() const { return d->isGenerated; } /*! * \brief True if and only if this file is executable, * either natively or through an interpreter or shell. */ bool ArtifactData::isExecutable() const { const bool isBundle = d->properties.getModuleProperty( QStringLiteral("bundle"), QStringLiteral("isBundle")).toBool(); const QString androidSdkPackageType = d->properties.getModuleProperty( QStringLiteral("Android.sdk"), QStringLiteral("packageType")).toString(); const bool isAndroidApk = androidSdkPackageType == QStringLiteral("apk"); return isRunnableArtifact(FileTags::fromStringList(d->fileTags), isBundle, isAndroidApk); } /*! * \brief True if and only if this artifact is a target artifact of its product. */ bool ArtifactData::isTargetArtifact() const { QBS_ASSERT(isValid(), return false); return d->isTargetArtifact; } /*! * \brief The properties of this file. */ PropertyMap ArtifactData::properties() const { return d->properties; } /*! \brief The installation-related data of this artifact. */ InstallData ArtifactData::installData() const { return d->installData; } QStringList ArtifactData::childPaths() const { return d->childPaths; } bool operator==(const ArtifactData &ad1, const ArtifactData &ad2) { return ad1.filePath() == ad2.filePath() && ad1.fileTags() == ad2.fileTags() && ad1.isGenerated() == ad2.isGenerated() && ad1.properties() == ad2.properties(); } bool operator!=(const ArtifactData &ta1, const ArtifactData &ta2) { return !(ta1 == ta2); } bool operator<(const ArtifactData &ta1, const ArtifactData &ta2) { return ta1.filePath() < ta2.filePath(); } /*! * \class InstallData * \brief The \c InstallData class provides the installation-related data of an artifact. */ InstallData::InstallData() : d(new InstallDataPrivate) { } InstallData::InstallData(const InstallData &other) = default; InstallData::InstallData(InstallData &&) Q_DECL_NOEXCEPT = default; InstallData &InstallData::operator=(const InstallData &other) = default; InstallData &InstallData::operator=(InstallData &&) Q_DECL_NOEXCEPT = default; InstallData::~InstallData() = default; /*! * \brief Returns true if and only if this object holds data that was initialized by Qbs. */ bool InstallData::isValid() const { return d->isValid; } QJsonObject InstallData::toJson() const { QJsonObject obj; if (isValid()) { obj.insert(QStringLiteral("is-installable"), isInstallable()); if (isInstallable()) { obj.insert(QStringLiteral("install-file-path"), installFilePath()); obj.insert(QStringLiteral("install-root"), installRoot()); } } return obj; } /*! \brief Returns true if and only if \c{qbs.install} is \c true for the artifact. */ bool InstallData::isInstallable() const { QBS_ASSERT(isValid(), return false); return d->isInstallable; } /*! \brief Returns the directory into which the artifact will be installed. \note This is not necessarily the same as \c{qbs.installDir}, because \c{qbs.installSourceBase} might have been used. */ QString InstallData::installDir() const { QBS_ASSERT(isValid(), return {}); return FileInfo::path(installFilePath()); } /*! \brief Returns the installed file path of the artifact. */ QString InstallData::installFilePath() const { QBS_ASSERT(isValid(), return {}); return d->installFilePath; } /*! \brief Returns the value of \c{qbs.installRoot} for the artifact. */ QString InstallData::installRoot() const { QBS_ASSERT(isValid(), return {}); return d->installRoot; } /*! \brief Returns the local installation directory of the artifact, that is \c installDir() prepended by \c installRoot(). */ QString InstallData::localInstallDir() const { return QDir::cleanPath(installRoot() + QLatin1Char('/') + installDir()); } /*! \brief Returns the local installed file path of the artifact, that is \c installFilePath() prepended by \c installRoot(). */ QString InstallData::localInstallFilePath() const { return QDir::cleanPath(installRoot() + QLatin1Char('/') + installFilePath()); } /*! * \class ProductData * \brief The \c ProductData class corresponds to the Product item in a qbs source file. */ ProductData::ProductData() : d(new ProductDataPrivate) { } ProductData::ProductData(const ProductData &other) = default; ProductData::ProductData(ProductData &&) Q_DECL_NOEXCEPT = default; ProductData &ProductData::operator=(const ProductData &other) = default; ProductData &ProductData::operator=(ProductData &&) Q_DECL_NOEXCEPT = default; ProductData::~ProductData() = default; /*! * \brief Returns true if and only if the Product holds data that was initialized by Qbs. */ bool ProductData::isValid() const { return d->isValid; } QJsonObject ProductData::toJson(const QStringList &propertyNames) const { QJsonObject obj; if (!isValid()) return obj; obj.insert(StringConstants::typeProperty(), QJsonArray::fromStringList(type())); obj.insert(StringConstants::dependenciesProperty(), QJsonArray::fromStringList(dependencies())); obj.insert(StringConstants::nameProperty(), name()); obj.insert(StringConstants::fullDisplayNameKey(), fullDisplayName()); obj.insert(QStringLiteral("target-name"), targetName()); obj.insert(StringConstants::versionProperty(), version()); obj.insert(QStringLiteral("multiplex-configuration-id"), multiplexConfigurationId()); obj.insert(StringConstants::locationKey(), location().toJson()); obj.insert(StringConstants::buildDirectoryKey(), buildDirectory()); obj.insert(QStringLiteral("generated-artifacts"), toJsonArray(generatedArtifacts(), propertyNames)); obj.insert(QStringLiteral("target-executable"), targetExecutable()); QJsonArray groupArray; for (const GroupData &g : groups()) { const QStringList groupPropNames = g.properties() == moduleProperties() ? QStringList() : propertyNames; groupArray << g.toJson(groupPropNames); } obj.insert(QStringLiteral("groups"), groupArray); obj.insert(QStringLiteral("properties"), QJsonObject::fromVariantMap(properties())); obj.insert(StringConstants::isEnabledKey(), isEnabled()); obj.insert(QStringLiteral("is-runnable"), isRunnable()); obj.insert(QStringLiteral("is-multiplexed"), isMultiplexed()); addModuleProperties(obj, moduleProperties(), propertyNames); return obj; } /*! * \brief The product type, which is the list of file tags matching the product's target artifacts. */ const QStringList &ProductData::type() const { return d->type; } /*! * \brief The names of dependent products. */ const QStringList &ProductData::dependencies() const { return d->dependencies; } /*! * \brief The name of the product as given in the qbs source file. */ const QString &ProductData::name() const { return d->name; } /*! The name of the product as given in the qbs source file, plus information about which properties it was multiplexed on and the values of these properties. If the product was not multiplexed, the returned value is the same as \c name(). */ QString ProductData::fullDisplayName() const { return fullProductDisplayName(name(), multiplexConfigurationId()); } /*! * \brief The base name of the product's target file as given in the qbs source file. */ const QString &ProductData::targetName() const { return d->targetName; } /*! * \brief The version number of the product. */ const QString &ProductData::version() const { return d->version; } /*! * \brief The profile this product will be built for. */ QString ProductData::profile() const { return d->moduleProperties.getModuleProperty( StringConstants::qbsModule(), StringConstants::profileProperty()).toString(); } const QString &ProductData::multiplexConfigurationId() const { return d->multiplexConfigurationId; } /*! * \brief The location at which the product is defined in the source file. */ const CodeLocation &ProductData::location() const { return d->location; } /*! * \brief The directory under which the product's generated artifacts are located. */ const QString &ProductData::buildDirectory() const { return d->buildDirectory; } /*! * \brief All artifacts that are generated when building this product. */ const QList &ProductData::generatedArtifacts() const { return d->generatedArtifacts; } /*! \brief This product's target artifacts. This is a subset of \c generatedArtifacts() */ const QList ProductData::targetArtifacts() const { QList list; std::copy_if(d->generatedArtifacts.cbegin(), d->generatedArtifacts.cend(), std::back_inserter(list), [](const ArtifactData &a) { return a.isTargetArtifact(); }); return list; } /*! * \brief The list of artifacts in this product that are to be installed. */ const QList ProductData::installableArtifacts() const { QList artifacts; for (const GroupData &g : std::as_const(d->groups)) { const auto sourceArtifacts = g.allSourceArtifacts(); for (const ArtifactData &a : sourceArtifacts) { if (a.installData().isInstallable()) artifacts << a; } } for (const ArtifactData &a : std::as_const(d->generatedArtifacts)) { if (a.installData().isInstallable()) artifacts << a; } return artifacts; } /*! * \brief Returns the file path of the executable associated with this product. * If the product is not an application, an empty string is returned. */ QString ProductData::targetExecutable() const { QBS_ASSERT(isValid(), return {}); if (d->moduleProperties.getModuleProperty(QStringLiteral("bundle"), QStringLiteral("isBundle")).toBool()) { const auto artifacts = targetArtifacts(); for (const ArtifactData &ta : artifacts) { if (ta.fileTags().contains(QLatin1String("bundle.application-executable"))) { if (ta.installData().isInstallable()) return ta.installData().localInstallFilePath(); return ta.filePath(); } } } const auto artifacts = targetArtifacts(); for (const ArtifactData &ta : artifacts) { if (ta.isExecutable()) { if (ta.installData().isInstallable()) return ta.installData().localInstallFilePath(); return ta.filePath(); } } return {}; } /*! * \brief The list of \c GroupData in this product. */ const QList &ProductData::groups() const { return d->groups; } /*! * \brief The product properties. */ const QVariantMap &ProductData::properties() const { return d->properties; } /*! * \brief The set of properties inherited from dependent products and modules. */ const PropertyMap &ProductData::moduleProperties() const { return d->moduleProperties; } /*! * \brief The module dependencies of this product. */ const QList &ProductData::modules() const { return d->modules; } /*! * \brief Returns true if this Product is enabled in Qbs. * This method returns the \c condition property of the \c Product definition. If a product is * enabled, then it will be built in the current configuration. * \sa GroupData::isEnabled() */ bool ProductData::isEnabled() const { QBS_ASSERT(isValid(), return false); return d->isEnabled; } bool ProductData::isRunnable() const { QBS_ASSERT(isValid(), return false); return d->isRunnable; } bool ProductData::isMultiplexed() const { QBS_ASSERT(isValid(), return false); return d->isMultiplexed; } bool operator==(const ProductData &lhs, const ProductData &rhs) { if (!lhs.isValid() && !rhs.isValid()) return true; return lhs.isValid() == rhs.isValid() && lhs.name() == rhs.name() && lhs.targetName() == rhs.targetName() && lhs.type() == rhs.type() && lhs.version() == rhs.version() && lhs.dependencies() == rhs.dependencies() && lhs.profile() == rhs.profile() && lhs.multiplexConfigurationId() == rhs.multiplexConfigurationId() && lhs.location() == rhs.location() && lhs.groups() == rhs.groups() && lhs.generatedArtifacts() == rhs.generatedArtifacts() && qVariantMapsEqual(lhs.properties(), rhs.properties()) && lhs.moduleProperties() == rhs.moduleProperties() && lhs.isEnabled() == rhs.isEnabled() && lhs.isMultiplexed() == rhs.isMultiplexed(); } bool operator!=(const ProductData &lhs, const ProductData &rhs) { return !(lhs == rhs); } bool operator<(const ProductData &lhs, const ProductData &rhs) { const int nameCmp = lhs.name().compare(rhs.name()); if (nameCmp < 0) return true; if (nameCmp > 0) return false; return lhs.profile() < rhs.profile() && lhs.multiplexConfigurationId() < rhs.multiplexConfigurationId(); } /*! * \class ProjectData * \brief The \c ProjectData class corresponds to the \c Project item in a qbs source file. */ /*! * \fn QList ProjectData::products() const * \brief The products in this project. */ ProjectData::ProjectData() : d(new ProjectDataPrivate) { } ProjectData::ProjectData(const ProjectData &other) = default; ProjectData::ProjectData(ProjectData &&) Q_DECL_NOEXCEPT = default; ProjectData &ProjectData::operator =(const ProjectData &other) = default; ProjectData &ProjectData::operator=(ProjectData &&) Q_DECL_NOEXCEPT = default; ProjectData::~ProjectData() = default; /*! * \brief Returns true if and only if the Project holds data that was initialized by Qbs. */ bool ProjectData::isValid() const { return d->isValid; } QJsonObject ProjectData::toJson(const QStringList &moduleProperties) const { QJsonObject obj; if (!isValid()) return obj; obj.insert(StringConstants::nameProperty(), name()); obj.insert(StringConstants::locationKey(), location().toJson()); obj.insert(StringConstants::isEnabledKey(), isEnabled()); obj.insert(StringConstants::productsKey(), toJsonArray(products(), moduleProperties)); obj.insert(QStringLiteral("sub-projects"), toJsonArray(subProjects(), moduleProperties)); return obj; } /*! * \brief The name of this project. */ const QString &ProjectData::name() const { return d->name; } /*! * \brief The location at which the project is defined in a qbs source file. */ const CodeLocation &ProjectData::location() const { return d->location; } /*! * \brief Whether the project is enabled. * \note Disabled projects never have any products or sub-projects. */ bool ProjectData::isEnabled() const { QBS_ASSERT(isValid(), return false); return d->enabled; } /*! * \brief The base directory under which the build artifacts of this project will be created. * This is only valid for the top-level project. */ const QString &ProjectData::buildDirectory() const { return d->buildDir; } /*! * The products in this project. * \note This also includes disabled products. */ const QList &ProjectData::products() const { return d->products; } /*! * The sub-projects of this project. */ const QList &ProjectData::subProjects() const { return d->subProjects; } /*! * All products in this projects and its direct and indirect sub-projects. */ const QList ProjectData::allProducts() const { QList productList = products(); for (const ProjectData &pd : std::as_const(d->subProjects)) productList << pd.allProducts(); return productList; } /*! * The artifacts of all products in this project that are to be installed. */ const QList ProjectData::installableArtifacts() const { QList artifacts; const auto products = allProducts(); for (const ProductData &p : products) artifacts << p.installableArtifacts(); return artifacts; } bool operator==(const ProjectData &lhs, const ProjectData &rhs) { if (!lhs.isValid() && !rhs.isValid()) return true; return lhs.isValid() == rhs.isValid() && lhs.isEnabled() == rhs.isEnabled() && lhs.name() == rhs.name() && lhs.buildDirectory() == rhs.buildDirectory() && lhs.location() == rhs.location() && lhs.subProjects() == rhs.subProjects() && lhs.products() == rhs.products(); } bool operator!=(const ProjectData &lhs, const ProjectData &rhs) { return !(lhs == rhs); } bool operator<(const ProjectData &lhs, const ProjectData &rhs) { return lhs.name() < rhs.name(); } /*! * \class PropertyMap * \brief The \c PropertyMap class represents the properties of a group or a product. */ PropertyMap::PropertyMap() : d(std::make_unique()) { static PropertyMapPtr defaultInternalMap = PropertyMapInternal::create(); d->m_map = defaultInternalMap; } PropertyMap::PropertyMap(const PropertyMap &other) : d(std::make_unique(*other.d)) { } PropertyMap::PropertyMap(PropertyMap &&other) Q_DECL_NOEXCEPT = default; PropertyMap::~PropertyMap() = default; PropertyMap &PropertyMap::operator =(const PropertyMap &other) { if (this != &other) d = std::make_unique(*other.d); return *this; } PropertyMap &PropertyMap::operator =(PropertyMap &&other) Q_DECL_NOEXCEPT = default; /*! * \brief Returns the names of all properties. */ QStringList PropertyMap::allProperties() const { QStringList properties; for (QVariantMap::ConstIterator it = d->m_map->value().constBegin(); it != d->m_map->value().constEnd(); ++it) { if (!it.value().canConvert()) properties << it.key(); } return properties; } /*! * \brief Returns the names of all modules whose properties can be requested. */ QStringList PropertyMap::allModules() const { QStringList modules; for (auto it = d->m_map->value().constBegin(); it != d->m_map->value().constEnd(); ++it) { if (it.value().canConvert()) modules << it.key(); } return modules; } /*! * \brief Returns information about all properties of the given module. */ QList PropertyMap::allPropertiesForModule(const QString &module) const { const QVariantMap moduleProps = d->m_map->value().value(module).toMap(); QList properties; const auto builtinProps = transformed( BuiltinDeclarations::instance().declarationsForType(ItemType::Module).properties(), [](const PropertyDeclaration &decl) { return decl.name(); }); for (auto it = moduleProps.begin(); it != moduleProps.end(); ++it) { static const auto getType = [](const QVariant &v) -> QString { switch (qVariantType(v)) { case QMetaType::Bool: return PropertyDeclaration::typeString(PropertyDeclaration::Boolean); case QMetaType::Int: return PropertyDeclaration::typeString(PropertyDeclaration::Integer); case QMetaType::QVariantList: return PropertyDeclaration::typeString(PropertyDeclaration::VariantList); case QMetaType::QString: return PropertyDeclaration::typeString(PropertyDeclaration::String); case QMetaType::QStringList: return PropertyDeclaration::typeString(PropertyDeclaration::StringList); default: return PropertyDeclaration::typeString(PropertyDeclaration::Variant); } }; properties << PropertyInfo{ it.key(), getType(it.value()), it.value(), builtinProps.contains(it.key())}; } return properties; } /*! * \brief Returns the value of the given property of a product or group. */ QVariant PropertyMap::getProperty(const QString &name) const { return d->m_map->value().value(name); } /*! * \brief Convenience wrapper around \c PropertyMap::getModuleProperty for properties of list type. * */ QStringList PropertyMap::getModulePropertiesAsStringList(const QString &moduleName, const QString &propertyName) const { const QVariantList &vl = d->m_map->moduleProperty(moduleName, propertyName).toList(); QStringList sl; for (const QVariant &v : vl) { QBS_ASSERT(v.canConvert(), continue); sl << v.toString(); } return sl; } /*! * \brief Returns the value of the given module property. */ QVariant PropertyMap::getModuleProperty(const QString &moduleName, const QString &propertyName) const { return d->m_map->moduleProperty(moduleName, propertyName); } static QString mapToString(const QVariantMap &map, const QString &prefix) { QString stringRep; for (auto it = map.cbegin(), end = map.cend(); it != end; ++it) { const QString &key = it.key(); const QVariant &val = it.value(); if (val.userType() == QMetaType::QVariantMap) { stringRep += mapToString(val.value(), prefix + key + QLatin1Char('.')); } else { stringRep += QStringLiteral("%1%2: %3\n") .arg(prefix, key, toJSLiteral(val)); } } return stringRep; } QString PropertyMap::toString() const { return mapToString(d->m_map->value(), QString()); } bool operator==(const PropertyMap &pm1, const PropertyMap &pm2) { return *pm1.d->m_map == *pm2.d->m_map; } bool operator!=(const PropertyMap &pm1, const PropertyMap &pm2) { return !(*pm1.d->m_map == *pm2.d->m_map); } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/api/runenvironment.cpp0000644000175100017510000004760015154533055022033 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "runenvironment.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { using namespace Internal; class RunEnvironment::RunEnvironmentPrivate { public: RunEnvironmentPrivate(ResolvedProductPtr product, TopLevelProjectConstPtr project, InstallOptions installOptions, const QProcessEnvironment &environment, QStringList setupRunEnvConfig, Settings *settings, Logger logger) : resolvedProduct(std::move(product)) , project(std::move(project)) , installOptions(std::move(installOptions)) , environment(environment) , setupRunEnvConfig(std::move(setupRunEnvConfig)) , settings(settings) , logger(std::move(logger)) , evalContext(this->logger) { } void checkProduct() { if (!resolvedProduct) throw ErrorInfo(Tr::tr("Cannot run: No such product.")); if (!resolvedProduct->enabled) { throw ErrorInfo(Tr::tr("Cannot run disabled product '%1'.") .arg(resolvedProduct->fullDisplayName())); } } const ResolvedProductPtr resolvedProduct; const TopLevelProjectConstPtr project; InstallOptions installOptions; const QProcessEnvironment environment; const QStringList setupRunEnvConfig; Settings * const settings; Logger logger; RulesEvaluationContext evalContext; }; RunEnvironment::RunEnvironment(const ResolvedProductPtr &product, const TopLevelProjectConstPtr &project, const InstallOptions &installOptions, const QProcessEnvironment &environment, const QStringList &setupRunEnvConfig, Settings *settings, const Logger &logger) : d(std::make_unique(product, project, installOptions, environment, setupRunEnvConfig, settings, logger)) { } RunEnvironment::~RunEnvironment() = default; int RunEnvironment::runShell(ErrorInfo *error) { try { return doRunShell(); } catch (const ErrorInfo &e) { if (error) *error = e; return -1; } } int RunEnvironment::runTarget(const QString &targetBin, const QStringList &arguments, bool dryRun, ErrorInfo *error) { try { return doRunTarget(targetBin, arguments, dryRun); } catch (const ErrorInfo &e) { if (error) *error = e; return -1; } } const QProcessEnvironment RunEnvironment::runEnvironment(ErrorInfo *error) const { try { return getRunEnvironment(); } catch (const ErrorInfo &e) { if (error) *error = e; return {}; } } const QProcessEnvironment RunEnvironment::buildEnvironment(ErrorInfo *error) const { try { return getBuildEnvironment(); } catch (const ErrorInfo &e) { if (error) *error = e; return {}; } } int RunEnvironment::doRunShell() { if (d->resolvedProduct) { EnvironmentScriptRunner(d->resolvedProduct.get(), &d->evalContext, d->project->environment).setupForBuild(); } const QString productId = d->resolvedProduct ? d->resolvedProduct->name : QString(); const QString configName = d->project->id(); if (productId.isEmpty()) { d->logger.qbsInfo() << Tr::tr("Starting shell for configuration '%1'.").arg(configName); } else { d->logger.qbsInfo() << Tr::tr("Starting shell for product '%1' in configuration '%2'.") .arg(productId, configName); } const QProcessEnvironment environment = d->resolvedProduct ? d->resolvedProduct->buildEnvironment : d->project->environment; #if defined(Q_OS_LINUX) || defined(__GLIBC__) clearenv(); #endif const auto keys = environment.keys(); for (const QString &key : keys) qputenv(key.toLocal8Bit().constData(), environment.value(key).toLocal8Bit()); QString command; if (HostOsInfo::isWindowsHost()) { command = environment.value(QStringLiteral("COMSPEC")); if (command.isEmpty()) command = QStringLiteral("cmd"); const QString prompt = environment.value(QStringLiteral("PROMPT")); command += QLatin1String(" /k prompt [qbs] ") + prompt; } else { const QVariantMap qbsProps = (d->resolvedProduct ? d->resolvedProduct->moduleProperties->value() : d->project->buildConfiguration()) .value(StringConstants::qbsModule()).toMap(); const QString profileName = qbsProps.value(StringConstants::profileProperty()).toString(); command = Preferences(d->settings, profileName).shell(); if (command.isEmpty()) command = environment.value(QStringLiteral("SHELL"), QStringLiteral("/bin/sh")); // Yes, we have to use this procedure. PS1 is not inherited from the environment. const QString prompt = QLatin1String("qbs ") + configName + (!productId.isEmpty() ? QLatin1Char(' ') + productId : QString()) + QLatin1String(" $ "); QTemporaryFile envFile; if (envFile.open()) { if (command.endsWith(QLatin1String("bash"))) command += QLatin1String(" --posix"); // Teach bash some manners. const QString promptLine = QLatin1String("PS1='") + prompt + QLatin1String("'\n"); envFile.write(promptLine.toLocal8Bit()); envFile.close(); qputenv("ENV", envFile.fileName().toLocal8Bit()); } else { d->logger.qbsWarning() << Tr::tr("Setting custom shell prompt failed."); } } // We cannot use QProcess, since it does not do stdin forwarding. return system(command.toLocal8Bit().constData()); } static QString findExecutable(const QStringList &fileNames) { const QStringList path = QString::fromLocal8Bit(qgetenv("PATH")) .split(HostOsInfo::pathListSeparator(), Qt::SkipEmptyParts); for (const QString &fileName : fileNames) { const QString exeFileName = HostOsInfo::appendExecutableSuffix(fileName); for (const QString &ppath : path) { const QString fullPath = ppath + QLatin1Char('/') + exeFileName; QFileInfo fi(fullPath); if (fi.exists() && fi.isFile() && fi.isExecutable()) return QDir::cleanPath(fullPath); } } return {}; } static std::string readAaptBadgingAttribute(const std::string &line) { std::regex re("^[A-Za-z\\-]+:\\s+name='(.+?)'.*$"); std::smatch match; if (std::regex_match(line, match, re)) return match[1]; return {}; } static QString findMainIntent(const QString &aapt, const QString &apkFilePath) { QString packageId; QString activity; QProcess aaptProcess; aaptProcess.start(aapt, QStringList() << QStringLiteral("dump") << QStringLiteral("badging") << apkFilePath); if (aaptProcess.waitForFinished(-1)) { const auto lines = aaptProcess.readAllStandardOutput().split('\n'); for (const auto &line : lines) { if (line.startsWith(QByteArrayLiteral("package:"))) packageId = QString::fromStdString(readAaptBadgingAttribute(line.toStdString())); else if (line.startsWith(QByteArrayLiteral("launchable-activity:"))) activity = QString::fromStdString(readAaptBadgingAttribute(line.toStdString())); } } if (!packageId.isEmpty() && !activity.isEmpty()) return packageId + QStringLiteral("/") + activity; return {}; } void RunEnvironment::printStartInfo(const QProcess &proc, bool dryRun) { QString message = dryRun ? Tr::tr("Would start target.") : Tr::tr("Starting target."); message.append(QLatin1Char(' ')).append(Tr::tr("Full command line: %1") .arg(shellQuote(QStringList(QDir::toNativeSeparators(proc.program())) << proc.arguments()))); d->logger.qbsInfo() << message; } int RunEnvironment::doRunTarget(const QString &targetBin, const QStringList &arguments, bool dryRun) { d->checkProduct(); const QStringList targetOS = d->resolvedProduct->moduleProperties->qbsPropertyValue( QStringLiteral("targetOS")).toStringList(); const QStringList toolchain = d->resolvedProduct->moduleProperties->qbsPropertyValue( QStringLiteral("toolchain")).toStringList(); QString targetExecutable = targetBin; QStringList targetArguments = arguments; const QString completeSuffix = QFileInfo(targetBin).completeSuffix(); if (targetOS.contains(QLatin1String("android"))) { const auto aapt = d->resolvedProduct->moduleProperties->moduleProperty( QStringLiteral("Android.sdk"), QStringLiteral("aaptFilePath")).toString(); const auto intent = findMainIntent(aapt, targetBin); const auto sdkDir = d->resolvedProduct->moduleProperties->moduleProperty( QStringLiteral("Android.sdk"), QStringLiteral("sdkDir")).toString(); targetExecutable = sdkDir + QStringLiteral("/platform-tools/adb"); if (!dryRun) { QProcess process; process.setProcessChannelMode(QProcess::ForwardedChannels); process.start(targetExecutable, QStringList() << StringConstants::androidInstallCommand() << QStringLiteral("-r") // replace existing application << QStringLiteral("-t") // allow test packages << QStringLiteral("-d") // allow version code downgrade << targetBin); if (!process.waitForFinished(-1)) { if (process.error() == QProcess::FailedToStart) { throw ErrorInfo(Tr::tr("The process '%1' could not be started: %2") .arg(targetExecutable, process.errorString())); } d->logger.qbsWarning() << "QProcess error: " << process.errorString(); return EXIT_FAILURE; } targetArguments << QStringList() << QStringLiteral("shell") << QStringLiteral("am") << QStringLiteral("start") << QStringLiteral("-W") // wait for launch to complete << QStringLiteral("-n") << intent; } } else if (targetOS.contains(QLatin1String("ios")) || targetOS.contains(QLatin1String("tvos"))) { const QString bundlePath = targetBin + StringConstants::slashDotDot(); if (targetOS.contains(QStringLiteral("ios-simulator")) || targetOS.contains(QStringLiteral("tvos-simulator"))) { const auto developerDir = d->resolvedProduct->moduleProperties->moduleProperty( StringConstants::xcode(), QStringLiteral("developerPath")).toString(); targetExecutable = developerDir + QStringLiteral("/usr/bin/simctl"); const auto simulatorId = QStringLiteral("booted"); // TODO: parameterize const auto bundleId = d->resolvedProduct->moduleProperties->moduleProperty( QStringLiteral("bundle"), QStringLiteral("identifier")).toString(); if (!dryRun) { QProcess process; process.setProcessChannelMode(QProcess::ForwardedChannels); process.start(targetExecutable, QStringList() << StringConstants::simctlInstallCommand() << simulatorId << QDir::cleanPath(bundlePath)); if (!process.waitForFinished(-1)) { if (process.error() == QProcess::FailedToStart) { throw ErrorInfo(Tr::tr("The process '%1' could not be started: %2") .arg(targetExecutable, process.errorString())); } return EXIT_FAILURE; } targetArguments << QStringList() << QStringLiteral("launch") << QStringLiteral("--console") << simulatorId << bundleId << arguments; } } else { if (targetExecutable = findExecutable(QStringList{QStringLiteral("iostool")}); QFileInfo(targetExecutable).isExecutable()) { targetArguments = QStringList() << QStringLiteral("-run") << QStringLiteral("-bundle") << QDir::cleanPath(bundlePath); if (!arguments.empty()) targetArguments << QStringLiteral("-extra-args") << arguments; } else if (targetExecutable = findExecutable(QStringList{QStringLiteral("ios-deploy")}); QFileInfo(targetExecutable).isExecutable()) { targetArguments = QStringList() << QStringLiteral("--no-wifi") << QStringLiteral("--noninteractive") << QStringLiteral("--bundle") << QDir::cleanPath(bundlePath); if (!arguments.empty()) targetArguments << QStringLiteral("--args") << arguments; } else { d->logger.qbsLog(LoggerError) << Tr::tr("No suitable deployment tools were found in the environment. " "Consider installing ios-deploy."); return EXIT_FAILURE; } } } else if (targetOS.contains(QLatin1String("windows"))) { if (completeSuffix == QLatin1String("msi")) { targetExecutable = QLatin1String("msiexec"); targetArguments.prepend(QDir::toNativeSeparators(targetBin)); targetArguments.prepend(QLatin1String("/package")); } // Run Windows executables through Wine when not on Windows if (!HostOsInfo::isWindowsHost()) { targetArguments.prepend(targetExecutable); targetExecutable = QStringLiteral("wine"); } } if (toolchain.contains(QLatin1String("mono"))) { targetArguments.prepend(targetExecutable); targetExecutable = QStringLiteral("mono"); } if (completeSuffix == QLatin1String("js")) { targetExecutable = d->resolvedProduct->moduleProperties->moduleProperty( QStringLiteral("nodejs"), QStringLiteral("interpreterFilePath")).toString(); if (targetExecutable.isEmpty()) // The Node.js binary is called nodejs on Debian/Ubuntu-family operating systems due to // conflict with another package containing a binary named node targetExecutable = findExecutable(QStringList() << QStringLiteral("nodejs") << QStringLiteral("node")); targetArguments.prepend(targetBin); } // Only check if the target is executable if we're not running it through another // known application such as msiexec or wine, as we can't check in this case anyways QFileInfo fi(targetExecutable); if (!dryRun && targetBin == targetExecutable && (!fi.isFile() || !fi.isExecutable())) { d->logger.qbsLog(LoggerError) << Tr::tr("File '%1' is not an executable.") .arg(QDir::toNativeSeparators(targetExecutable)); return EXIT_FAILURE; } QProcessEnvironment env = d->environment; env.insert(QStringLiteral("QBS_RUN_FILE_PATH"), targetBin); EnvironmentScriptRunner(d->resolvedProduct.get(), &d->evalContext, env) .setupForRun(d->setupRunEnvConfig); QProcess process; process.setProcessEnvironment(d->resolvedProduct->runEnvironment); process.setProcessChannelMode(QProcess::ForwardedChannels); process.setProgram(targetExecutable); process.setArguments(targetArguments); printStartInfo(process, dryRun); if (dryRun) return EXIT_SUCCESS; process.start(); if (!process.waitForFinished(-1)) { if (process.error() == QProcess::FailedToStart) { QString errorPrefixString; #ifdef Q_OS_UNIX if (QFileInfo(targetExecutable).isExecutable()) { const QString interpreter(shellInterpreter(targetExecutable)); if (!interpreter.isEmpty()) { errorPrefixString = Tr::tr("%1: bad interpreter: ").arg(interpreter); } } #endif throw ErrorInfo(Tr::tr("The process '%1' could not be started: %2") .arg(targetExecutable, errorPrefixString + process.errorString())); } d->logger.qbsWarning() << "QProcess error: " << process.errorString(); return EXIT_FAILURE; } return process.exitCode(); } const QProcessEnvironment RunEnvironment::getRunEnvironment() const { d->checkProduct(); EnvironmentScriptRunner(d->resolvedProduct.get(), &d->evalContext, d->environment) .setupForRun(d->setupRunEnvConfig); return d->resolvedProduct->runEnvironment; } const QProcessEnvironment RunEnvironment::getBuildEnvironment() const { if (!d->resolvedProduct) return d->environment; EnvironmentScriptRunner(d->resolvedProduct.get(), &d->evalContext, d->environment) .setupForBuild(); return d->resolvedProduct->buildEnvironment; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/api/jobs.h0000644000175100017510000001246715154533055017347 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_JOBS_H #define QBS_JOBS_H #include "project.h" #include "../language/forward_decls.h" #include "../tools/error.h" #include "../tools/qbs_export.h" #include #include #include namespace qbs { class BuildOptions; class CleanOptions; class InstallOptions; class ProcessResult; class SetupProjectParameters; namespace Internal { class InternalJob; class Logger; class ProjectPrivate; } // namespace Internal class Project; class QBS_EXPORT AbstractJob : public QObject { Q_OBJECT public: ~AbstractJob() override; enum State { StateRunning, StateCanceling, StateFinished }; State state() const { return m_state; } ErrorInfo error() const; public slots: void cancel(); protected: AbstractJob(Internal::InternalJob *internalJob, QObject *parent); Internal::InternalJob *internalJob() const { return m_internalJob; } bool lockProject(const Internal::TopLevelProjectPtr &project); void setError(const ErrorInfo &error) { m_error = error; } signals: void taskStarted(const QString &description, int maximumProgressValue, qbs::AbstractJob *job); void totalEffortChanged(int totalEffort, qbs::AbstractJob *job); void taskProgress(int newProgressValue, qbs::AbstractJob *job); void finished(bool success, qbs::AbstractJob *job); private: void handleTaskStarted(const QString &description, int maximumProgressValue); void handleTotalEffortChanged(int totalEffort); void handleTaskProgress(int newProgressValue); void handleFinished(); void unlockProject(); virtual void finish() { } Internal::InternalJob * const m_internalJob; Internal::TopLevelProjectPtr m_project; ErrorInfo m_error; State m_state; }; class QBS_EXPORT SetupProjectJob : public AbstractJob { Q_OBJECT friend class Project; public: Project project() const; private: SetupProjectJob(const Internal::Logger &logger, QObject *parent); void resolve(const Project &existingProject, const SetupProjectParameters ¶meters); void reportError(const ErrorInfo &error); void finish() override; Project m_existingProject; }; class QBS_EXPORT BuildJob : public AbstractJob { Q_OBJECT friend class Internal::ProjectPrivate; signals: void reportCommandDescription(const QString &highlight, const QString &message); void reportProcessResult(const qbs::ProcessResult &result); private: BuildJob(const Internal::Logger &logger, QObject *parent); void build(const Internal::TopLevelProjectPtr &project, const QVector &products, const BuildOptions &options); void handleLauncherError(const ErrorInfo &error); void finish() override; }; class QBS_EXPORT CleanJob : public AbstractJob { Q_OBJECT friend class Internal::ProjectPrivate; private: CleanJob(const Internal::Logger &logger, QObject *parent); void clean(const Internal::TopLevelProjectPtr &project, const QVector &products, const CleanOptions &options); }; class QBS_EXPORT InstallJob : public AbstractJob { Q_OBJECT friend class Internal::ProjectPrivate; private: InstallJob(const Internal::Logger &logger, QObject *parent); void install(const Internal::TopLevelProjectPtr &project, const QVector &products, const InstallOptions &options); }; } // namespace qbs #endif // QBS_JOBS_H qbs-src-3.2.0/src/lib/corelib/api/projectdata_p.h0000644000175100017510000001051215154533055021216 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROJECTDATA_P_H #define QBS_PROJECTDATA_P_H #include "projectdata.h" #include #include namespace qbs { namespace Internal { class InstallDataPrivate : public QSharedData { public: QString installFilePath; QString installRoot; bool isValid = false; bool isInstallable = false; }; class ArtifactDataPrivate : public QSharedData { public: QString filePath; QStringList fileTags; PropertyMap properties; InstallData installData; QStringList childPaths; bool isValid = false; bool isGenerated = false; bool isTargetArtifact = false; }; class GroupDataPrivate : public QSharedData { public: QString name; QString prefix; CodeLocation location; QList sourceArtifacts; QList sourceArtifactsFromWildcards; PropertyMap properties; bool isEnabled = false; bool isValid = false; }; class ModuleDataPrivate : public QSharedData { public: QString name; CodeLocation location; QList> properties; bool isValid = false; }; class InstallableFilePrivate: public QSharedData { public: QString sourceFilePath; QString targetFilePath; QStringList fileTags; bool isValid = false; }; class ProductDataPrivate : public QSharedData { public: QStringList type; QStringList dependencies; QString name; QString targetName; QString version; QString multiplexConfigurationId; CodeLocation location; QString buildDirectory; QList groups; QVariantMap properties; PropertyMap moduleProperties; QList modules; QList generatedArtifacts; bool isEnabled = false; bool isRunnable = false; bool isMultiplexed = false; bool isValid = false; }; class ProjectDataPrivate : public QSharedData { public: QString name; CodeLocation location; bool enabled = false; bool isValid = false; QList products; QList subProjects; QString buildDir; }; inline bool isRunnableArtifact(const FileTags &fileTags, bool isBundle, bool isAndroidApk) { return (fileTags.contains("application") && (!isBundle || fileTags.contains("bundle.content"))) || fileTags.contains("bundle.application-executable") || (fileTags.contains("android.package") && isAndroidApk) || fileTags.contains("msi"); } } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/api/qmljsrewriter.h0000644000175100017510000001251615154533055021317 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 QMLJSREWRITER_H #define QMLJSREWRITER_H #include "changeset.h" #include #include namespace QbsQmlJS { class Rewriter { public: enum BindingType { ScriptBinding, ObjectBinding, ArrayBinding }; using Range = ChangeSet::Range; public: Rewriter(QString originalText, ChangeSet *changeSet, QStringList propertyOrder); Range addBinding(AST::UiObjectInitializer *ast, const QString &propertyName, const QString &propertyValue, BindingType bindingType); Range addBinding(AST::UiObjectInitializer *ast, const QString &propertyName, const QString &propertyValue, BindingType bindingType, AST::UiObjectMemberList *insertAfter); void changeBinding(AST::UiObjectInitializer *ast, const QString &propertyName, const QString &newValue, BindingType binding); void removeBindingByName(AST::UiObjectInitializer *ast, const QString &propertyName); void appendToArrayBinding(AST::UiArrayBinding *arrayBinding, const QString &content); Range addObject(AST::UiObjectInitializer *ast, const QString &content); Range addObject(AST::UiObjectInitializer *ast, const QString &content, AST::UiObjectMemberList *insertAfter); Range addObject(AST::UiArrayBinding *ast, const QString &content); Range addObject(AST::UiArrayBinding *ast, const QString &content, AST::UiArrayMemberList *insertAfter); void removeObjectMember(AST::UiObjectMember *member, AST::UiObjectMember *parent); static AST::UiObjectMemberList *searchMemberToInsertAfter(AST::UiObjectMemberList *members, const QStringList &propertyOrder); static AST::UiArrayMemberList *searchMemberToInsertAfter(AST::UiArrayMemberList *members, const QStringList &propertyOrder); static AST::UiObjectMemberList *searchMemberToInsertAfter(AST::UiObjectMemberList *members, const QString &propertyName, const QStringList &propertyOrder); static bool includeSurroundingWhitespace(const QString &source, int &start, int &end); static void includeLeadingEmptyLine(QStringView source, int &start); static void includeEmptyGroupedProperty(AST::UiObjectDefinition *groupedProperty, AST::UiObjectMember *memberToBeRemoved, int &start, int &end); private: void replaceMemberValue(AST::UiObjectMember *propertyMember, const QString &newValue, bool needsSemicolon); static bool isMatchingPropertyMember(const QString &propertyName, AST::UiObjectMember *member); static bool nextMemberOnSameLine(AST::UiObjectMemberList *members); void insertIntoArray(AST::UiArrayBinding* ast, const QString &newValue); void removeMember(AST::UiObjectMember *member); void removeGroupedProperty(AST::UiObjectDefinition *ast, const QString &propertyName); void extendToLeadingOrTrailingComma(AST::UiArrayBinding *parentArray, AST::UiObjectMember *member, int &start, int &end) const; private: QString m_originalText; ChangeSet *m_changeSet; const QStringList m_propertyOrder; }; } // namespace QbsQmlJS #endif // QMLJSREWRITER_H qbs-src-3.2.0/src/lib/corelib/api/runenvironment.h0000644000175100017510000000714515154533055021500 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_RUNENVIRONMENT_H #define QBS_RUNENVIRONMENT_H #include #include #include #include #include QT_BEGIN_NAMESPACE class QProcess; class QProcessEnvironment; QT_END_NAMESPACE class TestApi; namespace qbs { class ErrorInfo; class InstallOptions; class Settings; namespace Internal { class Logger; class ResolvedProduct; } // namespace Internal class QBS_EXPORT RunEnvironment { friend class CommandLineFrontend; friend class Project; friend class ::TestApi; public: ~RunEnvironment(); int runShell(ErrorInfo *error = nullptr); int runTarget(const QString &targetBin, const QStringList &arguments, bool dryRun, ErrorInfo *error = nullptr); const QProcessEnvironment runEnvironment(ErrorInfo *error = nullptr) const; const QProcessEnvironment buildEnvironment(ErrorInfo *error = nullptr) const; private: RunEnvironment(const Internal::ResolvedProductPtr &product, const Internal::TopLevelProjectConstPtr &project, const InstallOptions &installOptions, const QProcessEnvironment &environment, const QStringList &setupRunEnvConfig, Settings *settings, const Internal::Logger &logger); int doRunShell(); int doRunTarget(const QString &targetBin, const QStringList &arguments, bool dryRun); void printStartInfo(const QProcess &proc, bool dryRun); const QProcessEnvironment getRunEnvironment() const; const QProcessEnvironment getBuildEnvironment() const; class RunEnvironmentPrivate; const std::unique_ptr d; }; } // namespace qbs #endif // QBS_RUNENVIRONMENT_H qbs-src-3.2.0/src/lib/corelib/api/languageinfo.h0000644000175100017510000000426015154533055021041 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_LANGUAGEINFO_H #define QBS_LANGUAGEINFO_H #include "../tools/qbs_export.h" #include namespace qbs { class Version; class QBS_EXPORT LanguageInfo { LanguageInfo() = delete; public: static std::string qmlTypeInfo(); static Version qbsVersion(); }; } // namespace qbs #endif // QBS_LANGUAGEINFO_H qbs-src-3.2.0/src/lib/corelib/api/propertymap_p.h0000644000175100017510000000415315154533055021304 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROPERTYMAP_P_H #define QBS_PROPERTYMAP_P_H #include namespace qbs { namespace Internal { class PropertyMapPrivate { public: PropertyMapPtr m_map; }; } // namespace Internal } // namespace qbs #endif // QBS_PROPERTYMAP_P_H qbs-src-3.2.0/src/lib/corelib/api/transformerdata_p.h0000644000175100017510000000431215154533055022113 0ustar runnerrunner/**************************************************************************** ** ** 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_TRANSFORMERDATA_P_H #define QBS_TRANSFORMERDATA_P_H #include "transformerdata.h" namespace qbs { namespace Internal { class TransformerDataPrivate : public QSharedData { public: QList inputs; QList outputs; RuleCommandList commands; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/api/qmljsrewriter.cpp0000644000175100017510000006311115154533055021647 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "qmljsrewriter.h" #include namespace QbsQmlJS { using namespace AST; static QString toString(UiQualifiedId *qualifiedId, QChar delimiter = QLatin1Char('.')) { QString result; for (UiQualifiedId *iter = qualifiedId; iter; iter = iter->next) { if (iter != qualifiedId) result += delimiter; result += iter->name; } return result; } Rewriter::Rewriter(QString originalText, ChangeSet *changeSet, QStringList propertyOrder) : m_originalText(std::move(originalText)) , m_changeSet(changeSet) , m_propertyOrder(std::move(propertyOrder)) { Q_ASSERT(changeSet); } Rewriter::Range Rewriter::addBinding(AST::UiObjectInitializer *ast, const QString &propertyName, const QString &propertyValue, BindingType bindingType) { UiObjectMemberList *insertAfter = searchMemberToInsertAfter(ast->members, propertyName, m_propertyOrder); return addBinding(ast, propertyName, propertyValue, bindingType, insertAfter); } Rewriter::Range Rewriter::addBinding(AST::UiObjectInitializer *ast, const QString &propertyName, const QString &propertyValue, BindingType bindingType, UiObjectMemberList *insertAfter) { SourceLocation endOfPreviousMember; SourceLocation startOfNextMember; if (insertAfter == nullptr || insertAfter->member == nullptr) { // insert as first member endOfPreviousMember = ast->lbraceToken; if (ast->members && ast->members->member) startOfNextMember = ast->members->member->firstSourceLocation(); else startOfNextMember = ast->rbraceToken; } else { endOfPreviousMember = insertAfter->member->lastSourceLocation(); if (insertAfter->next && insertAfter->next->member) startOfNextMember = insertAfter->next->member->firstSourceLocation(); else startOfNextMember = ast->rbraceToken; } const bool isOneLiner = endOfPreviousMember.startLine == startOfNextMember.startLine; bool needsPreceedingSemicolon = false; bool needsTrailingSemicolon = false; if (isOneLiner) { if (insertAfter == nullptr) { // we're inserting after an lbrace if (ast->members) { // we're inserting before a member (and not the rbrace) needsTrailingSemicolon = bindingType == ScriptBinding; } } else { // we're inserting after a member, not after the lbrace if (endOfPreviousMember.isValid()) { // there already is a semicolon after the previous member if (insertAfter->next && insertAfter->next->member) { // and the after us there is a member, not an rbrace, so: needsTrailingSemicolon = bindingType == ScriptBinding; } } else { // there is no semicolon after the previous member (probably because there is an rbrace after us/it, so: needsPreceedingSemicolon = true; } } } QString newPropertyTemplate; switch (bindingType) { case ArrayBinding: newPropertyTemplate = QStringLiteral("%1: [\n%2\n]"); break; case ObjectBinding: Q_FALLTHROUGH(); case ScriptBinding: newPropertyTemplate = QStringLiteral("%1: %2"); break; default: Q_ASSERT(!"unknown property type"); } if (isOneLiner) { if (needsPreceedingSemicolon) newPropertyTemplate.prepend(QLatin1Char(';')); newPropertyTemplate.prepend(QLatin1Char(' ')); if (needsTrailingSemicolon) newPropertyTemplate.append(QLatin1Char(';')); } else { newPropertyTemplate.prepend(QLatin1Char('\n')); } m_changeSet->insert(endOfPreviousMember.end(), newPropertyTemplate.arg(propertyName, propertyValue)); return {int(endOfPreviousMember.end()), int(endOfPreviousMember.end())}; } UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *members, const QStringList &propertyOrder) { const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString()); UiObjectMemberList *lastObjectDef = nullptr; UiObjectMemberList *lastNonObjectDef = nullptr; for (UiObjectMemberList *iter = members; iter; iter = iter->next) { UiObjectMember *member = iter->member; int idx = -1; if (cast(member)) lastObjectDef = iter; else if (auto arrayBinding = cast(member)) idx = propertyOrder.indexOf(toString(arrayBinding->qualifiedId)); else if (auto objectBinding = cast(member)) idx = propertyOrder.indexOf(toString(objectBinding->qualifiedId)); else if (auto scriptBinding = cast(member)) idx = propertyOrder.indexOf(toString(scriptBinding->qualifiedId)); else if (cast(member)) idx = propertyOrder.indexOf(QLatin1String("property")); if (idx < objectDefinitionInsertionPoint) lastNonObjectDef = iter; } if (lastObjectDef) return lastObjectDef; return lastNonObjectDef; } UiArrayMemberList *Rewriter::searchMemberToInsertAfter(UiArrayMemberList *members, const QStringList &propertyOrder) { const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString()); UiArrayMemberList *lastObjectDef = nullptr; UiArrayMemberList *lastNonObjectDef = nullptr; for (UiArrayMemberList *iter = members; iter; iter = iter->next) { UiObjectMember *member = iter->member; int idx = -1; if (cast(member)) lastObjectDef = iter; else if (auto arrayBinding = cast(member)) idx = propertyOrder.indexOf(toString(arrayBinding->qualifiedId)); else if (auto objectBinding = cast(member)) idx = propertyOrder.indexOf(toString(objectBinding->qualifiedId)); else if (auto scriptBinding = cast(member)) idx = propertyOrder.indexOf(toString(scriptBinding->qualifiedId)); else if (cast(member)) idx = propertyOrder.indexOf(QLatin1String("property")); if (idx < objectDefinitionInsertionPoint) lastNonObjectDef = iter; } if (lastObjectDef) return lastObjectDef; return lastNonObjectDef; } UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *members, const QString &propertyName, const QStringList &propertyOrder) { if (!members) return nullptr; // empty members QHash orderedMembers; for (UiObjectMemberList *iter = members; iter; iter = iter->next) { UiObjectMember *member = iter->member; if (auto arrayBinding = cast(member)) orderedMembers[toString(arrayBinding->qualifiedId)] = iter; else if (auto objectBinding = cast(member)) orderedMembers[toString(objectBinding->qualifiedId)] = iter; else if (cast(member)) orderedMembers[QString()] = iter; else if (auto scriptBinding = cast(member)) orderedMembers[toString(scriptBinding->qualifiedId)] = iter; else if (cast(member)) orderedMembers[QStringLiteral("property")] = iter; } int idx = propertyOrder.indexOf(propertyName); if (idx == -1) idx = propertyOrder.indexOf(QString()); if (idx == -1) idx = propertyOrder.size() - 1; for (; idx > 0; --idx) { const QString &prop = propertyOrder.at(idx - 1); UiObjectMemberList *candidate = orderedMembers.value(prop, 0); if (candidate != nullptr) return candidate; } return nullptr; } void Rewriter::changeBinding(UiObjectInitializer *ast, const QString &propertyName, const QString &newValue, BindingType binding) { QString prefix, suffix; int dotIdx = propertyName.indexOf(QLatin1Char('.')); if (dotIdx != -1) { prefix = propertyName.left(dotIdx); suffix = propertyName.mid(dotIdx + 1); } for (UiObjectMemberList *members = ast->members; members; members = members->next) { UiObjectMember *member = members->member; // for non-grouped properties: if (isMatchingPropertyMember(propertyName, member)) { switch (binding) { case ArrayBinding: insertIntoArray(cast(member), newValue); break; case ObjectBinding: replaceMemberValue(member, newValue, false); break; case ScriptBinding: replaceMemberValue(member, newValue, nextMemberOnSameLine(members)); break; default: Q_ASSERT(!"Unhandled QmlRefactoring::PropertyType"); } break; // for grouped properties: } if (!prefix.isEmpty()) { if (auto def = cast(member)) { if (toString(def->qualifiedTypeNameId) == prefix) changeBinding(def->initializer, suffix, newValue, binding); } } } } void Rewriter::replaceMemberValue(UiObjectMember *propertyMember, const QString &newValue, bool needsSemicolon) { QString replacement = newValue; int startOffset = -1; int endOffset = -1; if (auto objectBinding = AST::cast(propertyMember)) { startOffset = objectBinding->qualifiedTypeNameId->identifierToken.offset; endOffset = objectBinding->initializer->rbraceToken.end(); } else if (auto scriptBinding = AST::cast(propertyMember)) { startOffset = scriptBinding->statement->firstSourceLocation().offset; endOffset = scriptBinding->statement->lastSourceLocation().end(); } else if (auto arrayBinding = AST::cast(propertyMember)) { startOffset = arrayBinding->lbracketToken.offset; endOffset = arrayBinding->rbracketToken.end(); } else if (auto publicMember = AST::cast(propertyMember)) { if (publicMember->statement) { startOffset = publicMember->statement->firstSourceLocation().offset; if (publicMember->semicolonToken.isValid()) endOffset = publicMember->semicolonToken.end(); else endOffset = publicMember->statement->lastSourceLocation().offset; } else { startOffset = publicMember->lastSourceLocation().end(); endOffset = startOffset; if (publicMember->semicolonToken.isValid()) startOffset = publicMember->semicolonToken.offset; replacement.prepend(QStringLiteral(": ")); } } else { return; } if (needsSemicolon) replacement += QLatin1Char(';'); m_changeSet->replace(startOffset, endOffset, replacement); } bool Rewriter::isMatchingPropertyMember(const QString &propertyName, UiObjectMember *member) { if (auto publicMember = cast(member)) return publicMember->name == propertyName; if (auto objectBinding = cast(member)) return toString(objectBinding->qualifiedId) == propertyName; if (auto scriptBinding = cast(member)) return toString(scriptBinding->qualifiedId) == propertyName; if (auto arrayBinding = cast(member)) return toString(arrayBinding->qualifiedId) == propertyName; return false; } bool Rewriter::nextMemberOnSameLine(UiObjectMemberList *members) { if (members && members->next && members->next->member) return members->next->member->firstSourceLocation().startLine == members->member->lastSourceLocation().startLine; return false; } void Rewriter::insertIntoArray(UiArrayBinding *ast, const QString &newValue) { if (!ast) return; UiObjectMember *lastMember = nullptr; for (UiArrayMemberList *iter = ast->members; iter; iter = iter->next) { lastMember = iter->member; } if (!lastMember) return; const int insertionPoint = lastMember->lastSourceLocation().end(); m_changeSet->insert(insertionPoint, QLatin1String(",\n") + newValue); } void Rewriter::removeBindingByName(UiObjectInitializer *ast, const QString &propertyName) { QString prefix; int dotIdx = propertyName.indexOf(QLatin1Char('.')); if (dotIdx != -1) prefix = propertyName.left(dotIdx); for (UiObjectMemberList *it = ast->members; it; it = it->next) { UiObjectMember *member = it->member; // run full name match (for ungrouped properties): if (isMatchingPropertyMember(propertyName, member)) { removeMember(member); // check for grouped properties: } else if (!prefix.isEmpty()) { if (auto def = cast(member)) { if (toString(def->qualifiedTypeNameId) == prefix) removeGroupedProperty(def, propertyName); } } } } void Rewriter::removeGroupedProperty(UiObjectDefinition *ast, const QString &propertyName) { int dotIdx = propertyName.indexOf(QLatin1Char('.')); if (dotIdx == -1) return; const QString propName = propertyName.mid(dotIdx + 1); UiObjectMember *wanted = nullptr; unsigned memberCount = 0; for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) { ++memberCount; UiObjectMember *member = it->member; if (!wanted && isMatchingPropertyMember(propName, member)) wanted = member; } if (!wanted) return; if (memberCount == 1) removeMember(ast); else removeMember(wanted); } void Rewriter::removeMember(UiObjectMember *member) { int start = member->firstSourceLocation().offset; int end = member->lastSourceLocation().end(); includeSurroundingWhitespace(m_originalText, start, end); m_changeSet->remove(start, end); } bool Rewriter::includeSurroundingWhitespace(const QString &source, int &start, int &end) { bool includeStartingWhitespace = true; bool paragraphFound = false; bool paragraphSkipped = false; if (end >= 0) { QChar c = source.at(end); while (c.isSpace()) { ++end; if (c.unicode() == 10) { paragraphFound = true; paragraphSkipped = true; break; } if (end == source.length()) { break; } c = source.at(end); } includeStartingWhitespace = paragraphFound; } paragraphFound = false; if (includeStartingWhitespace) { while (start > 0) { const QChar c = source.at(start - 1); if (c.unicode() == 10) { paragraphFound = true; break; } if (!c.isSpace()) break; --start; } } if (!paragraphFound && paragraphSkipped) //keep the line ending --end; return paragraphFound; } void Rewriter::includeLeadingEmptyLine(QStringView source, int &start) { if (start == 0) return; const qsizetype lineEnd = source.lastIndexOf(QChar::LineFeed, start); if (lineEnd <= 0) return; const qsizetype lineStart = source.lastIndexOf(QChar::LineFeed, lineEnd - 1) + 1; const auto line = source.mid(lineStart, lineEnd - lineStart); if (!line.trimmed().isEmpty()) return; start = lineStart; } void Rewriter::includeEmptyGroupedProperty(UiObjectDefinition *groupedProperty, UiObjectMember *memberToBeRemoved, int &start, int &end) { if (groupedProperty->qualifiedTypeNameId && !groupedProperty->qualifiedTypeNameId->name.isEmpty() && groupedProperty->qualifiedTypeNameId->name.at(0).isLower()) { // grouped property UiObjectMemberList *memberIter = groupedProperty->initializer->members; while (memberIter) { if (memberIter->member != memberToBeRemoved) return; memberIter = memberIter->next; } start = groupedProperty->firstSourceLocation().begin(); end = groupedProperty->lastSourceLocation().end(); } } #if 0 UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *members, const QStringList &propertyOrder) { const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString()); UiObjectMemberList *lastObjectDef = nullptr; UiObjectMemberList *lastNonObjectDef = nullptr; for (UiObjectMemberList *iter = members; iter; iter = iter->next) { UiObjectMember *member = iter->member; int idx = -1; if (cast(member)) lastObjectDef = iter; else if (UiArrayBinding *arrayBinding = cast(member)) idx = propertyOrder.indexOf(toString(arrayBinding->qualifiedId)); else if (UiObjectBinding *objectBinding = cast(member)) idx = propertyOrder.indexOf(toString(objectBinding->qualifiedId)); else if (UiScriptBinding *scriptBinding = cast(member)) idx = propertyOrder.indexOf(toString(scriptBinding->qualifiedId)); else if (cast(member)) idx = propertyOrder.indexOf(QLatin1String("property")); if (idx < objectDefinitionInsertionPoint) lastNonObjectDef = iter; } if (lastObjectDef) return lastObjectDef; else return lastNonObjectDef; } UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *members, const QString &propertyName, const QStringList &propertyOrder) { if (!members) return nullptr; // empty members QHash orderedMembers; for (UiObjectMemberList *iter = members; iter; iter = iter->next) { UiObjectMember *member = iter->member; if (UiArrayBinding *arrayBinding = cast(member)) orderedMembers[toString(arrayBinding->qualifiedId)] = iter; else if (UiObjectBinding *objectBinding = cast(member)) orderedMembers[toString(objectBinding->qualifiedId)] = iter; else if (cast(member)) orderedMembers[QString()] = iter; else if (UiScriptBinding *scriptBinding = cast(member)) orderedMembers[toString(scriptBinding->qualifiedId)] = iter; else if (cast(member)) orderedMembers[QStringLiteral("property")] = iter; } int idx = propertyOrder.indexOf(propertyName); if (idx == -1) idx = propertyOrder.indexOf(QString()); if (idx == -1) idx = propertyOrder.size() - 1; for (; idx > 0; --idx) { const QString prop = propertyOrder.at(idx - 1); UiObjectMemberList *candidate = orderedMembers.value(prop, 0); if (candidate != 0) return candidate; } return nullptr; } #endif void Rewriter::appendToArrayBinding(UiArrayBinding *arrayBinding, const QString &content) { UiObjectMember *lastMember = nullptr; for (UiArrayMemberList *iter = arrayBinding->members; iter; iter = iter->next) if (iter->member) lastMember = iter->member; if (!lastMember) return; // an array binding cannot be empty, so there will (or should) always be a last member. const int insertionPoint = lastMember->lastSourceLocation().end(); m_changeSet->insert(insertionPoint, QLatin1String(",\n") + content); } Rewriter::Range Rewriter::addObject(UiObjectInitializer *ast, const QString &content) { UiObjectMemberList *insertAfter = searchMemberToInsertAfter(ast->members, m_propertyOrder); return addObject(ast, content, insertAfter); } Rewriter::Range Rewriter::addObject(UiObjectInitializer *ast, const QString &content, UiObjectMemberList *insertAfter) { int insertionPoint; QString textToInsert; if (insertAfter && insertAfter->member) { insertionPoint = insertAfter->member->lastSourceLocation().end(); textToInsert += QLatin1String("\n"); } else { insertionPoint = ast->lbraceToken.end(); } textToInsert += content; m_changeSet->insert(insertionPoint, QLatin1String("\n") + textToInsert); return {insertionPoint, insertionPoint}; } Rewriter::Range Rewriter::addObject(UiArrayBinding *ast, const QString &content) { UiArrayMemberList *insertAfter = searchMemberToInsertAfter(ast->members, m_propertyOrder); return addObject(ast, content, insertAfter); } Rewriter::Range Rewriter::addObject(UiArrayBinding *ast, const QString &content, UiArrayMemberList *insertAfter) { int insertionPoint; QString textToInsert; if (insertAfter && insertAfter->member) { insertionPoint = insertAfter->member->lastSourceLocation().end(); textToInsert = QLatin1String(",\n") + content; } else { insertionPoint = ast->lbracketToken.end(); textToInsert += QLatin1String("\n") + content + QLatin1Char(','); } m_changeSet->insert(insertionPoint, textToInsert); return {insertionPoint, insertionPoint}; } void Rewriter::removeObjectMember(UiObjectMember *member, UiObjectMember *parent) { int start = member->firstSourceLocation().offset; int end = member->lastSourceLocation().end(); if (auto parentArray = cast(parent)) { extendToLeadingOrTrailingComma(parentArray, member, start, end); } else { if (auto parentObjectDefinition = cast(parent)) includeEmptyGroupedProperty(parentObjectDefinition, member, start, end); includeSurroundingWhitespace(m_originalText, start, end); } includeLeadingEmptyLine(m_originalText, start); m_changeSet->remove(start, end); } void Rewriter::extendToLeadingOrTrailingComma(UiArrayBinding *parentArray, UiObjectMember *member, int &start, int &end) const { UiArrayMemberList *currentMember = nullptr; for (UiArrayMemberList *it = parentArray->members; it; it = it->next) { if (it->member == member) { currentMember = it; break; } } if (!currentMember) return; if (currentMember->commaToken.isValid()) { // leading comma start = currentMember->commaToken.offset; if (includeSurroundingWhitespace(m_originalText, start, end)) --end; } else if (currentMember->next && currentMember->next->commaToken.isValid()) { // trailing comma end = currentMember->next->commaToken.end(); includeSurroundingWhitespace(m_originalText, start, end); } else { // array with 1 element, so remove the complete binding start = parentArray->firstSourceLocation().offset; end = parentArray->lastSourceLocation().end(); includeSurroundingWhitespace(m_originalText, start, end); } } } // namespace QbsQmlJS qbs-src-3.2.0/src/lib/corelib/api/projectfileupdater.h0000644000175100017510000001153115154533055022274 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROJECTFILEUPDATER_H #define QBS_PROJECTFILEUPDATER_H #include "projectdata.h" #include #include #include namespace QbsQmlJS { namespace AST { class UiProgram; } } namespace qbs { namespace Internal { class ProjectFileUpdater { public: virtual ~ProjectFileUpdater(); void apply(); CodeLocation itemPosition() const { return m_itemPosition; } int lineOffset() const { return m_lineOffset; } protected: ProjectFileUpdater(QString projectFile); QString projectFile() const { return m_projectFile; } void setLineOffset(int offset) { m_lineOffset = offset; } void setItemPosition(const CodeLocation &cl) { m_itemPosition = cl; } private: virtual void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast) = 0; enum LineEndingType { UnknownLineEndings, UnixLineEndings, WindowsLineEndings, MixedLineEndings }; static LineEndingType guessLineEndingType(const QByteArray &text); static void convertToUnixLineEndings(QByteArray *text, LineEndingType oldLineEndings); static void convertFromUnixLineEndings(QByteArray *text, LineEndingType newLineEndings); const QString m_projectFile; CodeLocation m_itemPosition; int m_lineOffset = 0; }; class ProjectFileGroupInserter : public ProjectFileUpdater { public: ProjectFileGroupInserter(ProductData product, QString groupName); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast) override; const ProductData m_product; const QString m_groupName; }; class ProjectFileFilesAdder : public ProjectFileUpdater { public: ProjectFileFilesAdder(ProductData product, GroupData group, QStringList files); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast) override; const ProductData m_product; const GroupData m_group; const QStringList m_files; }; class ProjectFileDependenciesAdder : public ProjectFileUpdater { public: ProjectFileDependenciesAdder(ProductData product, GroupData group, QStringList dependencies); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast) override; const ProductData m_product; const GroupData m_group; const QStringList m_dependencies; }; class ProjectFileFilesRemover : public ProjectFileUpdater { public: ProjectFileFilesRemover(ProductData product, GroupData group, QStringList files); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast) override; const ProductData m_product; const GroupData m_group; const QStringList m_files; }; class ProjectFileGroupRemover : public ProjectFileUpdater { public: ProjectFileGroupRemover(ProductData product, GroupData group); private: void doApply(QString &fileContent, QbsQmlJS::AST::UiProgram *ast) override; const ProductData m_product; const GroupData m_group; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/cppscanner/0000755000175100017510000000000015154533055017612 5ustar runnerrunnerqbs-src-3.2.0/src/lib/corelib/cppscanner/CPlusPlusForwardDeclarations.h0000644000175100017510000001130715154533055025535 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ // Copyright (c) 2008 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #ifndef CPLUSPLUS_CPLUSPLUSFORWARDDECLARATIONS_H #define CPLUSPLUS_CPLUSPLUSFORWARDDECLARATIONS_H #include #include #ifndef CPLUSPLUS_WITHOUT_QT # include //# if defined(CPLUSPLUS_BUILD_LIB) //# define CPLUSPLUS_EXPORT Q_DECL_EXPORT //# elif defined(CPLUSPLUS_BUILD_STATIC_LIB) //# define CPLUSPLUS_EXPORT //# else //# define CPLUSPLUS_EXPORT Q_DECL_IMPORT //# endif //#else # define CPLUSPLUS_EXPORT #endif namespace CPlusPlus { class TranslationUnit; class Control; class MemoryPool; class DiagnosticClient; class Identifier; class Literal; class StringLiteral; class NumericLiteral; class SymbolTable; // names class NameVisitor; class Name; class Identifier; class TemplateNameId; class DestructorNameId; class OperatorNameId; class ConversionNameId; class QualifiedNameId; class SelectorNameId; // types class TypeMatcher; class FullySpecifiedType; class TypeVisitor; class Type; class UndefinedType; class VoidType; class IntegerType; class FloatType; class PointerToMemberType; class PointerType; class ReferenceType; class ArrayType; class NamedType; // symbols class SymbolVisitor; class Symbol; class Scope; class UsingNamespaceDirective; class UsingDeclaration; class Declaration; class Argument; class TypenameArgument; class Function; class Namespace; class NamespaceAlias; class Template; class BaseClass; class Block; class Class; class Enum; class ForwardClassDeclaration; class Token; // Objective-C symbols class ObjCBaseClass; class ObjCBaseProtocol; class ObjCClass; class ObjCForwardClassDeclaration; class ObjCProtocol; class ObjCForwardProtocolDeclaration; class ObjCMethod; class ObjCPropertyDeclaration; } // end of namespace CPlusPlus #endif // CPLUSPLUS_CPLUSPLUSFORWARDDECLARATIONS_H qbs-src-3.2.0/src/lib/corelib/cppscanner/Lexer.h0000644000175100017510000001251315154533055021044 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ // Copyright (c) 2008 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #ifndef CPLUSPLUS_LEXER_H #define CPLUSPLUS_LEXER_H #include "CPlusPlusForwardDeclarations.h" #include "Token.h" namespace CPlusPlus { class CPLUSPLUS_EXPORT Lexer { Lexer(const Lexer &other); void operator =(const Lexer &other); public: enum State { State_Default, State_MultiLineComment, State_MultiLineDoxyComment }; Lexer(const char *firstChar, const char *lastChar); bool qtMocRunEnabled() const; void setQtMocRunEnabled(bool onoff); bool cxx0xEnabled() const; void setCxxOxEnabled(bool onoff); bool objCEnabled() const; void setObjCEnabled(bool onoff); void scan(Token *tok); inline void operator()(Token *tok) { scan(tok); } unsigned tokenOffset() const; unsigned tokenLength() const; const char *tokenBegin() const; const char *tokenEnd() const; unsigned currentLine() const; bool scanCommentTokens() const; void setScanCommentTokens(bool onoff); bool scanAngleStringLiteralTokens() const; void setScanAngleStringLiteralTokens(bool onoff); void setStartWithNewline(bool enabled); int state() const; void setState(int state); bool isIncremental() const; void setIncremental(bool isIncremental); private: void scan_helper(Token *tok); void setSource(const char *firstChar, const char *lastChar); static int classify(const char *string, int length, bool q, bool cxx0x); static int classifyObjCAtKeyword(const char *s, int n); static int classifyOperator(const char *string, int length); inline void yyinp() { if (++_currentChar == _lastChar) _yychar = 0; else { _yychar = *_currentChar; if (_yychar == '\n') pushLineStartOffset(); } } void pushLineStartOffset(); private: struct Flags { unsigned _isIncremental: 1; unsigned _scanCommentTokens: 1; unsigned _scanAngleStringLiteralTokens: 1; unsigned _qtMocRunEnabled: 1; unsigned _cxx0xEnabled: 1; unsigned _objCEnabled: 1; }; const char *_firstChar = nullptr; const char *_currentChar = nullptr; const char *_lastChar = nullptr; const char *_tokenStart = nullptr; unsigned char _yychar = 0; int _state = 0; Flags f{}; unsigned _currentLine = 0; }; } // end of namespace CPlusPlus #endif // CPLUSPLUS_LEXER_H qbs-src-3.2.0/src/lib/corelib/cppscanner/cppscanner.h0000644000175100017510000000712215154533055022121 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com). ** 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$ ** ****************************************************************************/ #include #include #include #include #include #ifdef Q_OS_UNIX #include #include #include #include #include #else #include #endif namespace qbs::Internal { struct QBS_EXPORT ScanResult { std::string_view fileName; int flags = 0; }; struct QBS_EXPORT CppScannerContext { enum FileType { FT_UNKNOWN, FT_HPP, FT_CPP, FT_CPPM, FT_C, FT_OBJC, FT_OBJCPP, FT_RC }; CppScannerContext() = default; CppScannerContext(const CppScannerContext &other) = delete; CppScannerContext(CppScannerContext &&other) = delete; CppScannerContext &operator=(const CppScannerContext &other) = delete; CppScannerContext &operator=(CppScannerContext &&other) = delete; ~CppScannerContext() { #ifdef Q_OS_UNIX if (vmap) munmap(vmap, mapl); if (fd) close(fd); #endif } #ifdef Q_OS_WIN QFile file; #endif #ifdef Q_OS_UNIX int fd{0}; void *vmap{nullptr}; size_t mapl{0}; #endif QString fileName; std::string_view fileContent; FileType fileType{FT_UNKNOWN}; QList includedFiles; QByteArray providesModule; bool isInterface{false}; QList requiresModules; bool hasQObjectMacro{false}; bool hasPluginMetaDataMacro{false}; }; QBS_EXPORT bool scanCppFile( CppScannerContext &context, QStringView filePath, std::string_view fileTags, bool scanForFileTags, bool scanForDependencies); span additionalFileTags(const CppScannerContext &context); } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/cppscanner/Token.h0000644000175100017510000002171415154533055021050 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ // Copyright (c) 2008 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #ifndef CPLUSPLUS_TOKEN_H #define CPLUSPLUS_TOKEN_H #include "CPlusPlusForwardDeclarations.h" namespace CPlusPlus { enum Kind { T_EOF_SYMBOL = 0, T_ERROR, T_CPP_COMMENT, T_CPP_DOXY_COMMENT, T_COMMENT, T_DOXY_COMMENT, T_IDENTIFIER, T_FIRST_LITERAL, T_NUMERIC_LITERAL = T_FIRST_LITERAL, T_CHAR_LITERAL, T_WIDE_CHAR_LITERAL, T_STRING_LITERAL, T_WIDE_STRING_LITERAL, T_AT_STRING_LITERAL, T_ANGLE_STRING_LITERAL, T_LAST_LITERAL = T_ANGLE_STRING_LITERAL, T_FIRST_OPERATOR, T_AMPER = T_FIRST_OPERATOR, T_AMPER_AMPER, T_AMPER_EQUAL, T_ARROW, T_ARROW_STAR, T_CARET, T_CARET_EQUAL, T_COLON, T_COLON_COLON, T_COMMA, T_SLASH, T_SLASH_EQUAL, T_DOT, T_DOT_DOT_DOT, T_DOT_STAR, T_EQUAL, T_EQUAL_EQUAL, T_EXCLAIM, T_EXCLAIM_EQUAL, T_GREATER, T_GREATER_EQUAL, T_GREATER_GREATER, T_GREATER_GREATER_EQUAL, T_LBRACE, T_LBRACKET, T_LESS, T_LESS_EQUAL, T_LESS_LESS, T_LESS_LESS_EQUAL, T_LPAREN, T_MINUS, T_MINUS_EQUAL, T_MINUS_MINUS, T_PERCENT, T_PERCENT_EQUAL, T_PIPE, T_PIPE_EQUAL, T_PIPE_PIPE, T_PLUS, T_PLUS_EQUAL, T_PLUS_PLUS, T_POUND, T_POUND_POUND, T_QUESTION, T_RBRACE, T_RBRACKET, T_RPAREN, T_SEMICOLON, T_STAR, T_STAR_EQUAL, T_TILDE, T_TILDE_EQUAL, T_LAST_OPERATOR = T_TILDE_EQUAL, T_FIRST_KEYWORD, T_ASM = T_FIRST_KEYWORD, T_AUTO, T_BOOL, T_BREAK, T_CASE, T_CATCH, T_CHAR, T_CLASS, T_CONST, T_CONST_CAST, T_CONTINUE, T_DEFAULT, T_DELETE, T_DO, T_DOUBLE, T_DYNAMIC_CAST, T_ELSE, T_ENUM, T_EXPLICIT, T_EXPORT, T_EXTERN, T_FALSE, T_FLOAT, T_FOR, T_FRIEND, T_GOTO, T_IF, T_INLINE, T_INT, T_LONG, T_MUTABLE, T_NAMESPACE, T_NEW, T_OPERATOR, T_PRIVATE, T_PROTECTED, T_PUBLIC, T_REGISTER, T_REINTERPRET_CAST, T_RETURN, T_SHORT, T_SIGNED, T_SIZEOF, T_STATIC, T_STATIC_CAST, T_STRUCT, T_SWITCH, T_TEMPLATE, T_THIS, T_THROW, T_TRUE, T_TRY, T_TYPEDEF, T_TYPEID, T_TYPENAME, T_UNION, T_UNSIGNED, T_USING, T_VIRTUAL, T_VOID, T_VOLATILE, T_WCHAR_T, T_WHILE, T___ATTRIBUTE__, T___TYPEOF__, // obj c++ @ keywords T_FIRST_OBJC_AT_KEYWORD, T_AT_CATCH = T_FIRST_OBJC_AT_KEYWORD, T_AT_CLASS, T_AT_COMPATIBILITY_ALIAS, T_AT_DEFS, T_AT_DYNAMIC, T_AT_ENCODE, T_AT_END, T_AT_FINALLY, T_AT_IMPLEMENTATION, T_AT_INTERFACE, T_AT_NOT_KEYWORD, T_AT_OPTIONAL, T_AT_PACKAGE, T_AT_PRIVATE, T_AT_PROPERTY, T_AT_PROTECTED, T_AT_PROTOCOL, T_AT_PUBLIC, T_AT_REQUIRED, T_AT_SELECTOR, T_AT_SYNCHRONIZED, T_AT_SYNTHESIZE, T_AT_THROW, T_AT_TRY, T_LAST_OBJC_AT_KEYWORD = T_AT_TRY, T_FIRST_QT_KEYWORD, // Qt keywords T_SIGNAL = T_FIRST_QT_KEYWORD, T_SLOT, T_Q_SIGNAL, T_Q_SLOT, T_Q_SIGNALS, T_Q_SLOTS, T_Q_FOREACH, T_Q_D, T_Q_Q, T_Q_INVOKABLE, T_Q_PROPERTY, T_Q_INTERFACES, T_Q_ENUMS, T_Q_FLAGS, T_Q_PRIVATE_SLOT, T_Q_DECLARE_INTERFACE, T_Q_OBJECT, T_Q_GADGET, T_Q_NAMESPACE, T_LAST_KEYWORD = T_Q_NAMESPACE, // aliases T_OR = T_PIPE_PIPE, T_AND = T_AMPER_AMPER, T_NOT = T_EXCLAIM, T_XOR = T_CARET, T_BITOR = T_PIPE, T_COMPL = T_TILDE, T_OR_EQ = T_PIPE_EQUAL, T_AND_EQ = T_AMPER_EQUAL, T_BITAND = T_AMPER, T_NOT_EQ = T_EXCLAIM_EQUAL, T_XOR_EQ = T_CARET_EQUAL, T___ASM = T_ASM, T___ASM__ = T_ASM, T_TYPEOF = T___TYPEOF__, T___TYPEOF = T___TYPEOF__, T___INLINE = T_INLINE, T___INLINE__ = T_INLINE, T___CONST = T_CONST, T___CONST__ = T_CONST, T___VOLATILE = T_VOLATILE, T___VOLATILE__ = T_VOLATILE, T___ATTRIBUTE = T___ATTRIBUTE__ }; class CPLUSPLUS_EXPORT Token { public: inline bool is(unsigned k) const { return f.kind == k; } inline bool isNot(unsigned k) const { return f.kind != k; } #ifndef CPLUSPLUS_NO_PARSER const char *spell() const; #endif void reset(); inline unsigned kind() const { return f.kind; } inline bool newline() const { return f.newline; } inline bool whitespace() const { return f.whitespace; } inline bool joined() const { return f.joined; } inline bool expanded() const { return f.expanded; } inline bool generated() const { return f.generated; } inline unsigned length() const { return f.length; } inline unsigned begin() const { return offset; } inline unsigned end() const { return offset + f.length; } inline bool isLiteral() const { return f.kind >= T_FIRST_LITERAL && f.kind <= T_LAST_LITERAL; } inline bool isOperator() const { return f.kind >= T_FIRST_OPERATOR && f.kind <= T_LAST_OPERATOR; } inline bool isKeyword() const { return f.kind >= T_FIRST_KEYWORD && f.kind < T_FIRST_QT_KEYWORD; } inline bool isComment() const { return f.kind == T_COMMENT || f.kind == T_DOXY_COMMENT || f.kind == T_CPP_COMMENT || f.kind == T_CPP_DOXY_COMMENT; } inline bool isObjCAtKeyword() const { return f.kind >= T_FIRST_OBJC_AT_KEYWORD && f.kind <= T_LAST_OBJC_AT_KEYWORD; } static const char *name(int kind); public: struct Flags { unsigned kind : 8; unsigned newline : 1; unsigned whitespace : 1; unsigned joined : 1; unsigned expanded : 1; unsigned generated : 1; unsigned pad : 3; unsigned length : 16; }; Flags f{}; unsigned offset = 0; union { void *ptr = nullptr; #ifndef CPLUSPLUS_NO_PARSER const Literal *literal; const NumericLiteral *number; const StringLiteral *string; const Identifier *identifier; #endif unsigned close_brace; unsigned lineno; }; }; } // end of namespace CPlusPlus #endif // CPLUSPLUS_TOKEN_H qbs-src-3.2.0/src/lib/corelib/cppscanner/Token.cpp0000644000175100017510000001366115154533055021405 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ // Copyright (c) 2008 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #include "Token.h" #ifndef CPLUSPLUS_NO_PARSER # include "Literals.h" #endif using namespace CPlusPlus; static const char *token_names[] = { (""), (""), (""), (""), (""), (""), (""), (""), (""), (""), (""), (""), ("<@string literal>"), (""), ("&"), ("&&"), ("&="), ("->"), ("->*"), ("^"), ("^="), (":"), ("::"), (","), ("/"), ("/="), ("."), ("..."), (".*"), ("="), ("=="), ("!"), ("!="), (">"), (">="), (">>"), (">>="), ("{"), ("["), ("<"), ("<="), ("<<"), ("<<="), ("("), ("-"), ("-="), ("--"), ("%"), ("%="), ("|"), ("|="), ("||"), ("+"), ("+="), ("++"), ("#"), ("##"), ("?"), ("}"), ("]"), (")"), (";"), ("*"), ("*="), ("~"), ("~="), ("asm"), ("auto"), ("bool"), ("break"), ("case"), ("catch"), ("char"), ("class"), ("const"), ("const_cast"), ("continue"), ("default"), ("delete"), ("do"), ("double"), ("dynamic_cast"), ("else"), ("enum"), ("explicit"), ("export"), ("extern"), ("false"), ("float"), ("for"), ("friend"), ("goto"), ("if"), ("inline"), ("int"), ("long"), ("mutable"), ("namespace"), ("new"), ("operator"), ("private"), ("protected"), ("public"), ("register"), ("reinterpret_cast"), ("return"), ("short"), ("signed"), ("sizeof"), ("static"), ("static_cast"), ("struct"), ("switch"), ("template"), ("this"), ("throw"), ("true"), ("try"), ("typedef"), ("typeid"), ("typename"), ("union"), ("unsigned"), ("using"), ("virtual"), ("void"), ("volatile"), ("wchar_t"), ("while"), // gnu ("__attribute__"), ("__typeof__"), // objc @keywords ("@catch"), ("@class"), ("@compatibility_alias"), ("@defs"), ("@dynamic"), ("@encode"), ("@end"), ("@finally"), ("@implementation"), ("@interface"), ("@not_keyword"), ("@optional"), ("@package"), ("@private"), ("@property"), ("@protected"), ("@protocol"), ("@public"), ("@required"), ("@selector"), ("@synchronized"), ("@synthesize"), ("@throw"), ("@try"), // Qt keywords ("SIGNAL"), ("SLOT"), ("Q_SIGNAL"), ("Q_SLOT"), ("signals"), ("slots"), ("Q_FOREACH"), ("Q_D"), ("Q_Q"), ("Q_INVOKABLE"), ("Q_PROPERTY"), ("Q_INTERFACES"), ("Q_ENUMS"), ("Q_FLAGS"), ("Q_PRIVATE_SLOT"), ("Q_DECLARE_INTERFACE"), ("Q_OBJECT"), ("Q_GADGET"), ("Q_NAMESPACE"), }; void Token::reset() { f = {}; offset = 0; ptr = nullptr; } const char *Token::name(int kind) { return token_names[kind]; } #ifndef CPLUSPLUS_NO_PARSER const char *Token::spell() const { switch (f.kind) { case T_IDENTIFIER: return identifier->chars(); case T_NUMERIC_LITERAL: case T_CHAR_LITERAL: case T_STRING_LITERAL: case T_AT_STRING_LITERAL: case T_ANGLE_STRING_LITERAL: case T_WIDE_CHAR_LITERAL: case T_WIDE_STRING_LITERAL: return literal->chars(); default: return token_names[f.kind]; } // switch } #endif qbs-src-3.2.0/src/lib/corelib/cppscanner/Lexer.cpp0000644000175100017510000004275115154533055021406 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ // Copyright (c) 2008 Roberto Raggi // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #include "Lexer.h" #include namespace CPlusPlus { Lexer::Lexer(const char *firstChar, const char *lastChar) : _state(State_Default), _currentLine(1) { setSource(firstChar, lastChar); } void Lexer::setSource(const char *firstChar, const char *lastChar) { _firstChar = firstChar; _lastChar = lastChar; _currentChar = _firstChar - 1; _tokenStart = _currentChar; _yychar = '\n'; } void Lexer::setStartWithNewline(bool enabled) { if (enabled) _yychar = '\n'; else _yychar = ' '; } int Lexer::state() const { return _state; } void Lexer::setState(int state) { _state = state; } bool Lexer::qtMocRunEnabled() const { return f._qtMocRunEnabled; } void Lexer::setQtMocRunEnabled(bool onoff) { f._qtMocRunEnabled = onoff; } bool Lexer::cxx0xEnabled() const { return f._cxx0xEnabled; } void Lexer::setCxxOxEnabled(bool onoff) { f._cxx0xEnabled = onoff; } bool Lexer::objCEnabled() const { return f._objCEnabled; } void Lexer::setObjCEnabled(bool onoff) { f._objCEnabled = onoff; } bool Lexer::isIncremental() const { return f._isIncremental; } void Lexer::setIncremental(bool isIncremental) { f._isIncremental = isIncremental; } bool Lexer::scanCommentTokens() const { return f._scanCommentTokens; } void Lexer::setScanCommentTokens(bool onoff) { f._scanCommentTokens = onoff; } void Lexer::setScanAngleStringLiteralTokens(bool onoff) { f._scanAngleStringLiteralTokens = onoff; } void Lexer::pushLineStartOffset() { ++_currentLine; } unsigned Lexer::tokenOffset() const { return _tokenStart - _firstChar; } unsigned Lexer::tokenLength() const { return _currentChar - _tokenStart; } const char *Lexer::tokenBegin() const { return _tokenStart; } const char *Lexer::tokenEnd() const { return _currentChar; } unsigned Lexer::currentLine() const { return _currentLine; } void Lexer::scan(Token *tok) { tok->reset(); scan_helper(tok); tok->f.length = _currentChar - _tokenStart; } void Lexer::scan_helper(Token *tok) { _Lagain: while (_yychar && std::isspace(_yychar)) { if (_yychar == '\n') { tok->f.joined = false; tok->f.newline = true; } else { tok->f.whitespace = true; } yyinp(); } tok->lineno = _currentLine; _tokenStart = _currentChar; tok->offset = _currentChar - _firstChar; if (_state == State_MultiLineComment || _state == State_MultiLineDoxyComment) { const int originalState = _state; if (! _yychar) { tok->f.kind = T_EOF_SYMBOL; return; } while (_yychar) { if (_yychar != '*') yyinp(); else { yyinp(); if (_yychar == '/') { yyinp(); _state = State_Default; break; } } } if (! f._scanCommentTokens) goto _Lagain; else if (originalState == State_MultiLineComment) tok->f.kind = T_COMMENT; else tok->f.kind = T_DOXY_COMMENT; return; // done } if (! _yychar) { tok->f.kind = T_EOF_SYMBOL; return; } unsigned char ch = _yychar; yyinp(); switch (ch) { case '\\': while (_yychar != '\n' && std::isspace(_yychar)) yyinp(); // ### assert(! _yychar || _yychar == '\n'); if (_yychar == '\n') { tok->f.joined = true; tok->f.newline = false; yyinp(); } goto _Lagain; case '"': case '\'': { const unsigned char quote = ch; tok->f.kind = quote == '"' ? T_STRING_LITERAL : T_CHAR_LITERAL; while (_yychar && _yychar != quote) { if (_yychar == '\n') break; if (_yychar != '\\') yyinp(); else { yyinp(); // skip `\\' if (_yychar) yyinp(); } } // assert(_yychar == quote); if (_yychar == quote) yyinp(); } break; case '{': tok->f.kind = T_LBRACE; break; case '}': tok->f.kind = T_RBRACE; break; case '[': tok->f.kind = T_LBRACKET; break; case ']': tok->f.kind = T_RBRACKET; break; case '#': if (_yychar == '#') { tok->f.kind = T_POUND_POUND; yyinp(); } else { tok->f.kind = T_POUND; } break; case '(': tok->f.kind = T_LPAREN; break; case ')': tok->f.kind = T_RPAREN; break; case ';': tok->f.kind = T_SEMICOLON; break; case ':': if (_yychar == ':') { yyinp(); tok->f.kind = T_COLON_COLON; } else { tok->f.kind = T_COLON; } break; case '.': if (_yychar == '*') { yyinp(); tok->f.kind = T_DOT_STAR; } else if (_yychar == '.') { yyinp(); // ### assert(_yychar); if (_yychar == '.') { yyinp(); tok->f.kind = T_DOT_DOT_DOT; } else { tok->f.kind = T_ERROR; } } else if (std::isdigit(_yychar)) { do { if (_yychar == 'e' || _yychar == 'E') { yyinp(); if (_yychar == '-' || _yychar == '+') { yyinp(); // ### assert(std::isdigit(_yychar)); } } else if (std::isalnum(_yychar) || _yychar == '.') { yyinp(); } else { break; } } while (_yychar); tok->f.kind = T_NUMERIC_LITERAL; } else { tok->f.kind = T_DOT; } break; case '?': tok->f.kind = T_QUESTION; break; case '+': if (_yychar == '+') { yyinp(); tok->f.kind = T_PLUS_PLUS; } else if (_yychar == '=') { yyinp(); tok->f.kind = T_PLUS_EQUAL; } else { tok->f.kind = T_PLUS; } break; case '-': if (_yychar == '-') { yyinp(); tok->f.kind = T_MINUS_MINUS; } else if (_yychar == '=') { yyinp(); tok->f.kind = T_MINUS_EQUAL; } else if (_yychar == '>') { yyinp(); if (_yychar == '*') { yyinp(); tok->f.kind = T_ARROW_STAR; } else { tok->f.kind = T_ARROW; } } else { tok->f.kind = T_MINUS; } break; case '*': if (_yychar == '=') { yyinp(); tok->f.kind = T_STAR_EQUAL; } else { tok->f.kind = T_STAR; } break; case '/': if (_yychar == '/') { yyinp(); bool doxy = false; if (_yychar == '/' || _yychar == '!') { yyinp(); if (_yychar == '<') yyinp(); if (_yychar != '\n' && std::isspace(_yychar)) doxy = true; } while (_yychar && _yychar != '\n') yyinp(); if (! f._scanCommentTokens) goto _Lagain; tok->f.kind = doxy ? T_CPP_DOXY_COMMENT : T_CPP_COMMENT; } else if (_yychar == '*') { yyinp(); bool doxy = false; if (_yychar == '*' || _yychar == '!') { const unsigned char ch = _yychar; yyinp(); if (ch == '*' && _yychar == '/') goto _Ldone; if (_yychar == '<') yyinp(); if (! _yychar || std::isspace(_yychar)) doxy = true; } while (_yychar) { if (_yychar != '*') { yyinp(); } else { yyinp(); if (_yychar == '/') break; } } _Ldone: if (_yychar) yyinp(); else _state = doxy ? State_MultiLineDoxyComment : State_MultiLineComment; if (! f._scanCommentTokens) goto _Lagain; tok->f.kind = doxy ? T_DOXY_COMMENT : T_COMMENT; } else if (_yychar == '=') { yyinp(); tok->f.kind = T_SLASH_EQUAL; } else { tok->f.kind = T_SLASH; } break; case '%': if (_yychar == '=') { yyinp(); tok->f.kind = T_PERCENT_EQUAL; } else { tok->f.kind = T_PERCENT; } break; case '^': if (_yychar == '=') { yyinp(); tok->f.kind = T_CARET_EQUAL; } else { tok->f.kind = T_CARET; } break; case '&': if (_yychar == '&') { yyinp(); tok->f.kind = T_AMPER_AMPER; } else if (_yychar == '=') { yyinp(); tok->f.kind = T_AMPER_EQUAL; } else { tok->f.kind = T_AMPER; } break; case '|': if (_yychar == '|') { yyinp(); tok->f.kind = T_PIPE_PIPE; } else if (_yychar == '=') { yyinp(); tok->f.kind = T_PIPE_EQUAL; } else { tok->f.kind = T_PIPE; } break; case '~': if (_yychar == '=') { yyinp(); tok->f.kind = T_TILDE_EQUAL; } else { tok->f.kind = T_TILDE; } break; case '!': if (_yychar == '=') { yyinp(); tok->f.kind = T_EXCLAIM_EQUAL; } else { tok->f.kind = T_EXCLAIM; } break; case '=': if (_yychar == '=') { yyinp(); tok->f.kind = T_EQUAL_EQUAL; } else { tok->f.kind = T_EQUAL; } break; case '<': if (f._scanAngleStringLiteralTokens) { //const char *yytext = _currentChar; while (_yychar && _yychar != '>') yyinp(); //int yylen = _currentChar - yytext; // ### assert(_yychar == '>'); if (_yychar == '>') yyinp(); tok->f.kind = T_ANGLE_STRING_LITERAL; } else if (_yychar == '<') { yyinp(); if (_yychar == '=') { yyinp(); tok->f.kind = T_LESS_LESS_EQUAL; } else tok->f.kind = T_LESS_LESS; } else if (_yychar == '=') { yyinp(); tok->f.kind = T_LESS_EQUAL; } else { tok->f.kind = T_LESS; } break; case '>': if (_yychar == '>') { yyinp(); if (_yychar == '=') { yyinp(); tok->f.kind = T_GREATER_GREATER_EQUAL; } else tok->f.kind = T_LESS_LESS; tok->f.kind = T_GREATER_GREATER; } else if (_yychar == '=') { yyinp(); tok->f.kind = T_GREATER_EQUAL; } else { tok->f.kind = T_GREATER; } break; case ',': tok->f.kind = T_COMMA; break; default: { if (f._objCEnabled) { if (ch == '@' && _yychar >= 'a' && _yychar <= 'z') { //const char *yytext = _currentChar; do { yyinp(); if (!isalnum(_yychar) && _yychar != '_' && _yychar != '$') break; } while (_yychar); // const int yylen = _currentChar - yytext; //tok->f.kind = classifyObjCAtKeyword(yytext, yylen); /// ### FIXME break; } if (ch == '@' && _yychar == '"') { // objc @string literals ch = _yychar; yyinp(); tok->f.kind = T_AT_STRING_LITERAL; //const char *yytext = _currentChar; while (_yychar && _yychar != '"') { if (_yychar != '\\') yyinp(); else { yyinp(); // skip `\\' if (_yychar) yyinp(); } } // assert(_yychar == '"'); //int yylen = _currentChar - yytext; if (_yychar == '"') yyinp(); break; } } if (ch == 'L' && (_yychar == '"' || _yychar == '\'')) { // wide char/string literals ch = _yychar; yyinp(); const unsigned char quote = ch; tok->f.kind = quote == '"' ? T_WIDE_STRING_LITERAL : T_WIDE_CHAR_LITERAL; //const char *yytext = _currentChar; while (_yychar && _yychar != quote) { if (_yychar != '\\') yyinp(); else { yyinp(); // skip `\\' if (_yychar) yyinp(); } } // assert(_yychar == quote); //int yylen = _currentChar - yytext; if (_yychar == quote) yyinp(); } else if (std::isalpha(ch) || ch == '_' || ch == '$') { //const char *yytext = _currentChar - 1; while (std::isalnum(_yychar) || _yychar == '_' || _yychar == '$') yyinp(); //int yylen = _currentChar - yytext; tok->f.kind = T_IDENTIFIER; break; } else if (std::isdigit(ch)) { //const char *yytext = _currentChar - 1; while (_yychar) { if (_yychar == 'e' || _yychar == 'E') { yyinp(); if (_yychar == '-' || _yychar == '+') { yyinp(); // ### assert(std::isdigit(_yychar)); } } else if (std::isalnum(_yychar) || _yychar == '.') { yyinp(); } else { break; } } //int yylen = _currentChar - yytext; tok->f.kind = T_NUMERIC_LITERAL; break; } else { tok->f.kind = T_ERROR; break; } } // default } // switch } } // namespace CPlusPlus qbs-src-3.2.0/src/lib/corelib/cppscanner/cppscanner.cpp0000644000175100017510000002622015154533055022454 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com). ** 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$ ** ****************************************************************************/ #include "cppscanner.h" #include "../../plugins/scanner/scanner.h" #include "Lexer.h" #include #include namespace qbs::Internal { using namespace CPlusPlus; class TokenComparator { const char * const m_fileContent; public: TokenComparator(const char *fileContent) : m_fileContent(fileContent) {} bool equals(const Token &tk, const QLatin1String &literal) const { return static_cast(tk.length()) == literal.size() && memcmp(m_fileContent + tk.begin(), literal.data(), literal.size()) == 0; } QByteArray toByteArray(const Token &tk) const { const auto ptr = m_fileContent + tk.begin(); const auto len = tk.length(); return {ptr, int(len)}; } }; static void doScanCppFile( CppScannerContext &context, CPlusPlus::Lexer &yylex, bool scanForFileTags, bool scanForDependencies) { const QLatin1String includeLiteral("include"); const QLatin1String importLiteral("import"); const QLatin1String exportLiteral("export"); const QLatin1String moduleLiteral("module"); const QLatin1String defineLiteral("define"); const QLatin1String qobjectLiteral("Q_OBJECT"); const QLatin1String qgadgetLiteral("Q_GADGET"); const QLatin1String qnamespaceLiteral("Q_NAMESPACE"); const QLatin1String pluginMetaDataLiteral("Q_PLUGIN_METADATA"); const TokenComparator tc(context.fileContent.data()); Token tk; Token oldTk; ScanResult scanResult; yylex(&tk); auto stepLexer = [&]() mutable { oldTk = tk; yylex(&tk); }; auto parseModule = [&]() mutable { auto mod = tc.toByteArray(tk); while (tk.isNot(T_EOF_SYMBOL) && tk.isNot(T_SEMICOLON)) { stepLexer(); if (tk.is(T_DOT)) { stepLexer(); mod += '.'; mod += tc.toByteArray(tk); } else if (tk.is(T_COLON)) { stepLexer(); mod += ':'; mod += tc.toByteArray(tk); break; } } if (context.fileType == CppScannerContext::FileType::FT_CPPM) context.providesModule = mod; else context.requiresModules << mod; }; auto parseImport = [&]() mutable { if (tk.is(T_COLON)) { stepLexer(); if (!context.providesModule.isEmpty()) { const auto getModuleName = [](const QByteArray &moduleOrPartition) -> QByteArray { const auto index = moduleOrPartition.indexOf(':'); if (index == -1) return moduleOrPartition; return moduleOrPartition.mid(0, index); }; context.requiresModules << getModuleName(context.providesModule) + ':' + tc.toByteArray(tk); } return; } bool isGlobal = false; if (tk.is(T_LESS)) { stepLexer(); isGlobal = true; } auto mod = tc.toByteArray(tk); while (tk.isNot(T_EOF_SYMBOL) && tk.isNot(T_SEMICOLON) && tk.isNot(T_GREATER)) { stepLexer(); if (tk.is(T_DOT)) { stepLexer(); mod += '.'; mod += tc.toByteArray(tk); } } if (isGlobal) { mod = '<' + mod + '>'; } context.requiresModules << mod; }; while (tk.isNot(T_EOF_SYMBOL)) { if (scanForDependencies && tk.newline() && tk.is(T_IDENTIFIER)) { if (tc.equals(tk, moduleLiteral)) { stepLexer(); if (tk.isNot(T_SEMICOLON)) parseModule(); continue; } else if (tc.equals(tk, importLiteral)) { stepLexer(); parseImport(); continue; } else if (tc.equals(tk, exportLiteral)) { stepLexer(); if (tc.equals(tk, moduleLiteral)) { stepLexer(); parseModule(); context.isInterface = true; continue; } else if (tc.equals(tk, importLiteral)) { stepLexer(); parseImport(); continue; } } } if (tk.newline() && tk.is(T_POUND)) { yylex(&tk); if (scanForDependencies && !tk.newline() && tk.is(T_IDENTIFIER)) { if (tc.equals(tk, includeLiteral) || tc.equals(tk, importLiteral)) { yylex.setScanAngleStringLiteralTokens(true); yylex(&tk); yylex.setScanAngleStringLiteralTokens(false); if (!tk.newline() && (tk.is(T_STRING_LITERAL) || tk.is(T_ANGLE_STRING_LITERAL))) { if (tk.is(T_STRING_LITERAL)) scanResult.flags = SC_LOCAL_INCLUDE_FLAG; else scanResult.flags = SC_GLOBAL_INCLUDE_FLAG; scanResult.fileName = context.fileContent.substr( tk.begin() + 1, size_t(tk.length() - 2)); context.includedFiles.push_back(scanResult); } } } } else if (tk.is(T_IDENTIFIER)) { if (scanForFileTags) { if (oldTk.is(T_IDENTIFIER) && tc.equals(oldTk, defineLiteral)) { // Someone was clever and redefined Q_OBJECT or Q_PLUGIN_METADATA. // Example: iplugin.h in Qt Creator. } else { if (tc.equals(tk, qobjectLiteral) || tc.equals(tk, qgadgetLiteral) || tc.equals(tk, qnamespaceLiteral)) { context.hasQObjectMacro = true; } else if (tc.equals(tk, pluginMetaDataLiteral)) { context.hasPluginMetaDataMacro = true; } if (!scanForDependencies && context.hasQObjectMacro && (context.hasPluginMetaDataMacro || context.fileType == CppScannerContext::FT_CPP || context.fileType == CppScannerContext::FT_OBJCPP)) break; } } } stepLexer(); } } bool scanCppFile( CppScannerContext &context, QStringView filePath, std::string_view fileTags, bool scanForFileTags, bool scanForDependencies) { context.fileName = filePath.toString(); const QList &tagList = QByteArray::fromRawData(fileTags.data(), fileTags.size()).split(','); if (tagList.contains("hpp")) context.fileType = CppScannerContext::FT_HPP; else if (tagList.contains("cpp")) context.fileType = CppScannerContext::FT_CPP; else if (tagList.contains("cppm")) context.fileType = CppScannerContext::FT_CPPM; else if (tagList.contains("objcpp")) context.fileType = CppScannerContext::FT_OBJCPP; else context.fileType = CppScannerContext::FT_UNKNOWN; size_t mapl = 0; #ifdef Q_OS_UNIX QString filePathS = context.fileName; context.fd = ::open(qPrintable(filePathS), O_RDONLY); if (context.fd == -1) { context.fd = 0; return false; } struct stat s {}; int r = fstat(context.fd, &s); if (r != 0) return false; mapl = s.st_size; context.mapl = mapl; void *vmap = mmap(nullptr, s.st_size, PROT_READ, MAP_PRIVATE, context.fd, 0); if (vmap == MAP_FAILED) // NOLINT(cppcoreguidelines-pro-type-cstyle-cast) return false; context.vmap = vmap; #else context.file.setFileName(context.fileName); if (!context.file.open(QFile::ReadOnly)) return false; uchar *vmap = context.file.map(0, context.file.size()); mapl = context.file.size(); #endif if (!vmap) return false; std::string_view fileContent{reinterpret_cast(vmap), mapl}; // Check for UTF-8 Byte Order Mark (BOM). Skip if found. if (fileContent.size() >= 3 && fileContent[0] == char(0xef) && fileContent[1] == char(0xbb) && fileContent[2] == char(0xbf)) { fileContent = fileContent.substr(3); } context.fileContent = fileContent; CPlusPlus::Lexer lex(fileContent.data(), fileContent.data() + fileContent.size()); doScanCppFile(context, lex, scanForFileTags, scanForDependencies); return true; } span additionalFileTags(const CppScannerContext &context) { static const std::string_view thMocCpp[] = {"moc_cpp"}; static const std::string_view thMocHpp[] = {"moc_hpp"}; static const std::string_view thMocPluginHpp[] = {"moc_hpp_plugin"}; static const std::string_view thMocPluginCpp[] = {"moc_cpp_plugin"}; if (context.hasQObjectMacro) { switch (context.fileType) { case CppScannerContext::FT_CPP: case CppScannerContext::FT_OBJCPP: return {context.hasPluginMetaDataMacro ? thMocPluginCpp : thMocCpp, 1}; case CppScannerContext::FT_HPP: return {context.hasPluginMetaDataMacro ? thMocPluginHpp : thMocHpp, 1}; default: break; } } return {}; } } // namespace qbs::Internal qbs-src-3.2.0/src/lib/corelib/language/0000755000175100017510000000000015154533055017241 5ustar runnerrunnerqbs-src-3.2.0/src/lib/corelib/language/identifiersearch.h0000644000175100017510000000512615154533055022726 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_IDENTIFIERSEARCHVISITOR_H #define QBS_IDENTIFIERSEARCHVISITOR_H #include #include #include #include #include namespace qbs { namespace Internal { class QBS_AUTOTEST_EXPORT IdentifierSearch : private QbsQmlJS::AST::Visitor { public: IdentifierSearch(); void start(QbsQmlJS::AST::Node *node); void add(const QString &name, bool *found); private: bool preVisit(QbsQmlJS::AST::Node *) override; bool visit(QbsQmlJS::AST::IdentifierExpression *e) override; QMap m_requests; int m_numberOfFoundIds = 0; }; } // namespace Internal } // namespace qbs #endif // QBS_IDENTIFIERSEARCHVISITOR_H qbs-src-3.2.0/src/lib/corelib/language/propertydeclaration.cpp0000644000175100017510000004150415154533055024043 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "propertydeclaration.h" #include "deprecationinfo.h" #include "filecontext.h" #include "item.h" #include "qualifiedid.h" #include "value.h" #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { // returns QMetaType::UnknownType for types that do not need conversion static QMetaType::Type variantType(PropertyDeclaration::Type t) { switch (t) { case PropertyDeclaration::UnknownType: break; case PropertyDeclaration::Boolean: return QMetaType::Bool; case PropertyDeclaration::Integer: return QMetaType::Int; case PropertyDeclaration::Path: return QMetaType::QString; case PropertyDeclaration::PathList: return QMetaType::QStringList; case PropertyDeclaration::String: return QMetaType::QString; case PropertyDeclaration::StringList: return QMetaType::QStringList; case PropertyDeclaration::VariantList: return QMetaType::QVariantList; case PropertyDeclaration::Variant: break; } return QMetaType::UnknownType; } class PropertyDeclarationData : public QSharedData { public: PropertyDeclarationData() : type(PropertyDeclaration::UnknownType) , flags(PropertyDeclaration::DefaultFlags) { } QString name; PropertyDeclaration::Type type; PropertyDeclaration::Flags flags; QStringList allowedValues; QString description; QString initialValueSource; QStringList functionArgumentNames; DeprecationInfo deprecationInfo; CodeLocation location; }; PropertyDeclaration::PropertyDeclaration() : d(new PropertyDeclarationData) { } PropertyDeclaration::PropertyDeclaration(const QString &name, Type type, const QString &initialValue, Flags flags) : d(new PropertyDeclarationData) { d->name = name; d->type = type; d->initialValueSource = initialValue; d->flags = flags; } PropertyDeclaration::PropertyDeclaration(const PropertyDeclaration &other) = default; PropertyDeclaration::~PropertyDeclaration() = default; PropertyDeclaration &PropertyDeclaration::operator=(const PropertyDeclaration &other) = default; bool PropertyDeclaration::isValid() const { return d && d->type != UnknownType; } bool PropertyDeclaration::isScalar() const { // ### Should be determined by a PropertyOption in the future. return d->type != PathList && d->type != StringList && d->type != VariantList; } static QString boolString() { return QStringLiteral("bool"); } static QString intString() { return QStringLiteral("int"); } static QString pathListString() { return QStringLiteral("pathList"); } static QString stringString() { return QStringLiteral("string"); } static QString stringListString() { return QStringLiteral("stringList"); } static QString varString() { return QStringLiteral("var"); } static QString variantString() { return QStringLiteral("variant"); } static QString varListString() { return QStringLiteral("varList"); } PropertyDeclaration::Type PropertyDeclaration::propertyTypeFromString(const QString &typeName) { if (typeName == boolString()) return PropertyDeclaration::Boolean; if (typeName == intString()) return PropertyDeclaration::Integer; if (typeName == StringConstants::pathType()) return PropertyDeclaration::Path; if (typeName == pathListString()) return PropertyDeclaration::PathList; if (typeName == stringString()) return PropertyDeclaration::String; if (typeName == stringListString()) return PropertyDeclaration::StringList; if (typeName == varString() || typeName == variantString()) return PropertyDeclaration::Variant; if (typeName == varListString()) return PropertyDeclaration::VariantList; return PropertyDeclaration::UnknownType; } QString PropertyDeclaration::typeString() const { return typeString(type()); } QString PropertyDeclaration::typeString(PropertyDeclaration::Type t) { switch (t) { case Boolean: return boolString(); case Integer: return intString(); case Path: return StringConstants::pathType(); case PathList: return pathListString(); case String: return stringString(); case StringList: return stringListString(); case Variant: return variantString(); case VariantList: return varListString(); case UnknownType: return QStringLiteral("unknown"); } Q_UNREACHABLE(); // For stupid compilers. } const QString &PropertyDeclaration::name() const { return d->name; } void PropertyDeclaration::setName(const QString &name) { d->name = name; } PropertyDeclaration::Type PropertyDeclaration::type() const { return d->type; } void PropertyDeclaration::setType(PropertyDeclaration::Type t) { d->type = t; } PropertyDeclaration::Flags PropertyDeclaration::flags() const { return d->flags; } void PropertyDeclaration::setFlags(Flags f) { d->flags = f; } CodeLocation PropertyDeclaration::location() const { return d->location; } void PropertyDeclaration::setLocation(const CodeLocation &loc) { d->location = loc; } const QStringList &PropertyDeclaration::allowedValues() const { return d->allowedValues; } void PropertyDeclaration::setAllowedValues(const QStringList &v) { d->allowedValues = v; } const QString &PropertyDeclaration::description() const { return d->description; } void PropertyDeclaration::setDescription(const QString &str) { d->description = str; } const QString &PropertyDeclaration::initialValueSource() const { return d->initialValueSource; } void PropertyDeclaration::setInitialValueSource(const QString &str) { d->initialValueSource = str; } const QStringList &PropertyDeclaration::functionArgumentNames() const { return d->functionArgumentNames; } void PropertyDeclaration::setFunctionArgumentNames(const QStringList &lst) { d->functionArgumentNames = lst; } bool PropertyDeclaration::isDeprecated() const { return d->deprecationInfo.isValid(); } bool PropertyDeclaration::isExpired() const { return isDeprecated() && deprecationInfo().removalVersion() <= LanguageInfo::qbsVersion(); } const DeprecationInfo &PropertyDeclaration::deprecationInfo() const { return d->deprecationInfo; } void PropertyDeclaration::setDeprecationInfo(const DeprecationInfo &deprecationInfo) { d->deprecationInfo = deprecationInfo; } ErrorInfo PropertyDeclaration::checkForDeprecation(DeprecationWarningMode mode, const CodeLocation &loc, Logger &logger) const { return deprecationInfo().checkForDeprecation(mode, name(), loc, false, logger); } QVariant PropertyDeclaration::convertToPropertyType(const QVariant &v, Type t, const QStringList &namePrefix, const QString &key) { if (v.isNull() || !v.isValid()) return v; const auto vt = variantType(t); if (vt == QMetaType::UnknownType) return v; // Handle the foo,bar,bla stringlist syntax. if (t == PropertyDeclaration::StringList && v.userType() == QMetaType::QString) return v.toString().split(QLatin1Char(',')); QVariant c = v; if (!qVariantConvert(c, vt)) { QStringList name = namePrefix; name << key; throw ErrorInfo(Tr::tr("Value '%1' of property '%2' has incompatible type.") .arg(v.toString(), name.join(QLatin1Char('.')))); } return c; } QVariant PropertyDeclaration::typedNullValue() const { switch (type()) { case PropertyDeclaration::Boolean: return typedNullVariant(); case PropertyDeclaration::Integer: return typedNullVariant(); case PropertyDeclaration::VariantList: return typedNullVariant(); case PropertyDeclaration::String: case PropertyDeclaration::Path: return typedNullVariant(); case PropertyDeclaration::StringList: case PropertyDeclaration::PathList: return typedNullVariant(); default: return {}; } } bool PropertyDeclaration::shouldCheckAllowedValues() const { return isValid() && (d->type == PropertyDeclaration::String || d->type == PropertyDeclaration::StringList) && !d->allowedValues.empty(); } void PropertyDeclaration::checkAllowedValues( const QVariant &value, const CodeLocation &loc, const QString &key, LoaderState &loaderState) const { const auto type = d->type; if (!shouldCheckAllowedValues()) return; if (value.isNull()) return; const auto &allowedValues = d->allowedValues; const auto checkValue = [&loc, &allowedValues, &key, &loaderState](const QString &value) { if (!allowedValues.contains(value)) { const auto message = Tr::tr("Value '%1' is not allowed for property '%2'.") .arg(value, key); ErrorInfo error(message, loc); handlePropertyError(error, loaderState.parameters(), loaderState.logger()); } }; if (type == PropertyDeclaration::StringList) { const auto strings = value.toStringList(); for (const auto &string: strings) { checkValue(string); } } else if (type == PropertyDeclaration::String) { checkValue(value.toString()); } } namespace { class PropertyDeclarationCheck : public ValueHandler { public: PropertyDeclarationCheck(LoaderState &loaderState) : m_loaderState(loaderState) {} void operator()(Item *item) { m_checkingProject = item->type() == ItemType::Project; handleItem(item); } private: void doHandle(JSSourceValue *value) override { if (!value->createdByPropertiesBlock()) { const ErrorInfo error(Tr::tr("Property '%1' is not declared.") .arg(m_currentName), value->location()); handlePropertyError(error, m_loaderState.parameters(), m_loaderState.logger()); } } void doHandle(ItemValue *value) override { if (checkItemValue(value)) handleItem(value->item()); } bool checkItemValue(ItemValue *value) { // TODO: Remove once QBS-1030 is fixed. if (parentItem()->type() == ItemType::Artifact) return false; if (parentItem()->type() == ItemType::Properties) return false; // TODO: Check where the in-between module instances come from. if (value->item()->type() == ItemType::ModuleInstancePlaceholder) { for (auto it = m_parentItems.rbegin(); it != m_parentItems.rend(); ++it) { if ((*it)->type() == ItemType::Group) return false; if ((*it)->type() == ItemType::ModulePrefix) continue; break; } } if (value->item()->type() != ItemType::ModuleInstance && value->item()->type() != ItemType::ModulePrefix && (!parentItem()->file() || !parentItem()->file()->idScope() || !parentItem()->file()->idScope()->hasProperty(m_currentName)) && !value->createdByPropertiesBlock()) { CodeLocation location = value->location(); for (int i = int(m_parentItems.size() - 1); !location.isValid() && i >= 0; --i) location = m_parentItems.at(i)->location(); const ErrorInfo error(Tr::tr("Item '%1' is not declared. " "Did you forget to add a Depends item?") .arg(m_currentModuleName.toString()), location); handlePropertyError(error, m_loaderState.parameters(), m_loaderState.logger()); return false; } return true; } void handleItem(Item *item) { if (m_checkingProject && item->type() == ItemType::Product) return; if (!m_handledItems.insert(item).second) return; if (item->type() == ItemType::Module || item->type() == ItemType::Export || (item->type() == ItemType::ModuleInstance && !item->isPresentModule()) || item->type() == ItemType::Properties // The Properties child of a SubProject item is not a regular item. || item->type() == ItemType::PropertiesInSubProject || m_loaderState.topLevelProject().isDisabledItem(item)) { return; } m_parentItems.push_back(item); for (Item::PropertyMap::const_iterator it = item->properties().constBegin(); it != item->properties().constEnd(); ++it) { if (item->type() == ItemType::Product && it.key() == StringConstants::moduleProviders() && it.value()->type() == Value::ItemValueType) continue; const PropertyDeclaration decl = item->propertyDeclaration(it.key()); if (decl.isValid()) { const ErrorInfo deprecationError = decl.checkForDeprecation( m_loaderState.parameters().deprecationWarningMode(), it.value()->location(), m_loaderState.logger()); if (deprecationError.hasError()) { handlePropertyError(deprecationError, m_loaderState.parameters(), m_loaderState.logger()); } continue; } m_currentName = it.key(); const QualifiedId oldModuleName = m_currentModuleName; if (parentItem()->type() != ItemType::ModulePrefix) m_currentModuleName.clear(); m_currentModuleName.push_back(m_currentName); it.value()->apply(this); m_currentModuleName = oldModuleName; } m_parentItems.pop_back(); for (Item * const child : item->children()) { switch (child->type()) { case ItemType::Export: case ItemType::Depends: case ItemType::Parameter: case ItemType::Parameters: break; case ItemType::Group: if (item->type() == ItemType::Module || item->type() == ItemType::ModuleInstance) break; Q_FALLTHROUGH(); default: handleItem(child); } } } void doHandle(VariantValue *) override { /* only created internally - no need to check */ } Item *parentItem() const { return m_parentItems.back(); } LoaderState &m_loaderState; Set m_handledItems; std::vector m_parentItems; QualifiedId m_currentModuleName; QString m_currentName; bool m_checkingProject = false; }; } // namespace void checkPropertyDeclarations(Item *topLevelItem, LoaderState &loaderState) { (PropertyDeclarationCheck(loaderState))(topLevelItem); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/value.cpp0000644000175100017510000001777715154533055021104 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "value.h" #include "filecontext.h" #include "item.h" #include #include #include namespace qbs { namespace Internal { Value::Value(Type t, bool createdByPropertiesBlock) : m_type(t) { if (createdByPropertiesBlock) m_flags |= OriginPropertiesBlock; } Value::~Value() = default; void Value::setScope(Item *scope, const QString &scopeName) { m_scope = scope; m_scopeName = scopeName; } int Value::priority(const Item *productItem) const { if (m_priority == -1) m_priority = calculatePriority(productItem); return m_priority; } int Value::calculatePriority(const Item *productItem) const { if (setInternally()) return INT_MAX; if (setByCommandLine()) return INT_MAX - 1; if (setByProfile()) return 2; if (!scope()) return 1; if (scope()->type() == ItemType::Product) return INT_MAX - 2; if (!scope()->isPresentModule()) return 0; const auto it = std::find_if( productItem->modules().begin(), productItem->modules().end(), [this](const Item::Module &m) { return m.item == scope(); }); QBS_CHECK(it != productItem->modules().end()); return INT_MAX - 3 - it->maxDependsChainLength; } void Value::resetPriority() { m_priority = -1; for (const ValuePtr &v : m_candidates) v->resetPriority(); } void Value::removeExpiredCandidates(const Item *productItem) { removeIf(m_candidates, [productItem](const ValuePtr &v) { return v->expired(productItem); }); } void Value::sortCandidates(const std::function &less) { m_candidates = sorted(m_candidates, less); } bool Value::setInternally() const { return type() == VariantValueType && !setByProfile() && !setByCommandLine(); } JSSourceValue::JSSourceValue(bool createdByPropertiesBlock) : Value(JSSourceValueType, createdByPropertiesBlock) , m_line(-1) , m_column(-1) { } JSSourceValue::JSSourceValue(const JSSourceValue &other, ItemPool &pool) : Value(other) { m_sourceCode = other.m_sourceCode; m_line = other.m_line; m_column = other.m_column; m_file = other.m_file; m_baseValue = other.m_baseValue ? std::static_pointer_cast(other.m_baseValue->clone(pool)) : JSSourceValuePtr(); m_alternatives = transformed>( other.m_alternatives, [&pool](const auto &alternative) { return alternative.clone(pool); }); } JSSourceValuePtr JSSourceValue::create(bool createdByPropertiesBlock) { return std::make_shared(createdByPropertiesBlock); } JSSourceValue::~JSSourceValue() = default; ValuePtr JSSourceValue::clone(ItemPool &pool) const { return std::make_shared(*this, pool); } QString JSSourceValue::sourceCodeForEvaluation() const { if (!hasFunctionForm()) return m_sourceCode.toString(); // rewrite blocks to be able to use return statements in property assignments static const QString prefix = QStringLiteral("(function()"); static const QString suffix = QStringLiteral(")()"); return prefix + m_sourceCode.toString() + suffix; } void JSSourceValue::setLocation(int line, int column) { m_line = line; m_column = column; } CodeLocation JSSourceValue::location() const { return CodeLocation(m_file->filePath(), m_line, m_column); } void JSSourceValue::addAlternative(const Alternative &alternative) { if (!m_alternatives.empty() && m_alternatives.back().value->isFallback()) { QBS_CHECK(!alternative.value->isFallback()); m_alternatives.insert(std::prev(m_alternatives.end()), alternative); } else { m_alternatives.push_back(alternative); } } void JSSourceValue::clearAlternatives() { m_alternatives.clear(); } void JSSourceValue::setScope(Item *scope, const QString &scopeName) { Value::setScope(scope, scopeName); if (m_baseValue) m_baseValue->setScope(scope, scopeName); for (const JSSourceValue::Alternative &a : m_alternatives) { if (!a.value->scope()) a.value->setScope(scope, scopeName); } } void JSSourceValue::resetPriority() { Value::resetPriority(); if (m_baseValue) m_baseValue->resetPriority(); for (const JSSourceValue::Alternative &a : m_alternatives) a.value->resetPriority(); } ItemValue::ItemValue(Item *item, bool createdByPropertiesBlock) : Value(ItemValueType, createdByPropertiesBlock) , m_item(item) { QBS_CHECK(m_item); } ItemValuePtr ItemValue::create(Item *item, bool createdByPropertiesBlock) { return std::make_shared(item, createdByPropertiesBlock); } ValuePtr ItemValue::clone(ItemPool &pool) const { return create(m_item->clone(pool), createdByPropertiesBlock()); } class StoredVariantValue : public VariantValue { public: explicit StoredVariantValue(QVariant v) : VariantValue(std::move(v)) {} quintptr id() const override { return quintptr(this); } }; VariantValue::VariantValue(QVariant v) : Value(VariantValueType, false) , m_value(std::move(v)) { } template VariantValuePtr createImpl(const QVariant &v) { if (!v.isValid()) return VariantValue::invalidValue(); if (static_cast(v.userType()) == QMetaType::Bool) return v.toBool() ? VariantValue::trueValue() : VariantValue::falseValue(); return std::make_shared(v); } VariantValuePtr VariantValue::create(const QVariant &v) { return createImpl(v); } VariantValuePtr VariantValue::createStored(const QVariant &v) { return createImpl(v); } ValuePtr VariantValue::clone(ItemPool &) const { return std::make_shared(*this); } const VariantValuePtr &VariantValue::falseValue() { static const VariantValuePtr v = std::make_shared(false); return v; } const VariantValuePtr &VariantValue::trueValue() { static const VariantValuePtr v = std::make_shared(true); return v; } const VariantValuePtr &VariantValue::invalidValue() { static const VariantValuePtr v = std::make_shared(QVariant()); return v; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/qualifiedid.cpp0000644000175100017510000000456615154533055022240 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "qualifiedid.h" #include namespace qbs { namespace Internal { QualifiedId::QualifiedId() = default; QualifiedId::QualifiedId(const QString &singlePartName) : QStringList(singlePartName) { } QualifiedId::QualifiedId(const QStringList &nameParts) : QStringList(nameParts) { } QualifiedId QualifiedId::fromString(const QString &str) { return {str.split(QLatin1Char('.'))}; } QString QualifiedId::toString() const { return join(QLatin1Char('.')); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/property.cpp0000644000175100017510000000455315154533055021640 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "property.h" namespace qbs { namespace Internal { bool operator<(const Property &p1, const Property &p2) { int cmpResult = QString::compare(p1.productName, p2.productName); if (cmpResult < 0) return true; if (cmpResult > 0) return false; cmpResult = QString::compare(p1.moduleName, p2.moduleName); if (cmpResult < 0) return true; if (cmpResult > 0) return false; return p1.propertyName < p2.propertyName; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/filecontext.h0000644000175100017510000000501515154533055021737 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_FILECONTEXT_H #define QBS_FILECONTEXT_H #include "filecontextbase.h" #include "forward_decls.h" #include namespace qbs { namespace Internal { class Item; class ItemPool; class FileContext : public FileContextBase { public: static FileContextPtr QBS_AUTOTEST_EXPORT create(); void setContent(const QString &content) { m_content = content; } const QString &content() const { return m_content; } Item *idScope() const { return m_idScope; } void ensureIdScope(ItemPool *itemPool); private: FileContext(); QString m_content; Item *m_idScope; }; } // namespace Internal } // namespace qbs #endif // QBS_FILECONTEXT_H qbs-src-3.2.0/src/lib/corelib/language/itempool.h0000644000175100017510000000453715154533055021253 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ITEMPOOL_H #define QBS_ITEMPOOL_H #include #include #include namespace qbs { namespace Internal { class Item; enum class ItemType; class QBS_AUTOTEST_EXPORT ItemPool { Q_DISABLE_COPY(ItemPool) public: ItemPool(); ~ItemPool(); Item *allocateItem(const ItemType &type); private: QbsQmlJS::MemoryPool m_pool; std::vector m_items; }; } // namespace Internal } // namespace qbs #endif // QBS_ITEMPOOL_H qbs-src-3.2.0/src/lib/corelib/language/resolvedfilecontext.cpp0000644000175100017510000000454715154533055024047 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "resolvedfilecontext.h" #include "jsimports.h" #include namespace qbs { namespace Internal { ResolvedFileContext::ResolvedFileContext(const FileContextBase &ctx) : FileContextBase(ctx) { } bool operator==(const ResolvedFileContext &a, const ResolvedFileContext &b) { return a.filePath() == b.filePath() && toSet(a.jsExtensions()) == toSet(b.jsExtensions()) && sorted(a.jsImports()) == sorted(b.jsImports()); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/jsimports.h0000644000175100017510000000600315154533055021443 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_JSIMPORTS_H #define QBS_JSIMPORTS_H #include #include #include #include #include #include namespace qbs { namespace Internal { /** * Represents JavaScript import of the form * import 'fileOrDirectory' as scopeName * * There can be several filenames per scope * if we import a whole directory. */ class JsImport { public: QString scopeName; QStringList filePaths; CodeLocation location; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(scopeName, filePaths, location); } }; inline auto qHash(const JsImport &jsi) { return qHash(jsi.scopeName); } inline bool operator<(const JsImport &lhs, const JsImport &rhs) { return lhs.scopeName < rhs.scopeName; } inline bool operator==(const JsImport &jsi1, const JsImport &jsi2) { return jsi1.scopeName == jsi2.scopeName && toSet(jsi1.filePaths) == toSet(jsi2.filePaths); } using JsImports = std::vector; } // namespace Internal } // namespace qbs #endif // QBS_JSIMPORTS_H qbs-src-3.2.0/src/lib/corelib/language/preparescriptobserver.h0000644000175100017510000000725215154533055024053 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PREPARESCRIPTOBSERVER_H #define QBS_PREPARESCRIPTOBSERVER_H #include "qualifiedid.h" #include "scriptpropertyobserver.h" #include #include #include #include namespace qbs { namespace Internal { class ResolvedProduct; class ScriptEngine; class PrepareScriptObserver : public ScriptPropertyObserver { public: PrepareScriptObserver(ScriptEngine *engine, UnobserveMode unobserveMode); void addProjectObjectId(qint64 projectId, const QString &projectName) { m_projectObjectIds.insert(std::make_pair(projectId, projectName)); } void addExportsObjectId(qint64 exportsId, const ResolvedProduct *product) { m_exportsObjectIds.insert(std::make_pair(exportsId, product)); } void addArtifactId(qint64 artifactId) { m_artifactIds.insert(artifactId); } bool addImportId(quintptr importId) { return m_importIds.insert(importId).second; } void clearImportIds() { m_importIds.clear(); } void addParameterObjectId(qint64 id, const QString &productName, const QString &depName, const QualifiedId &moduleName) { const QString depAndModuleName = depName + QLatin1Char(':') + moduleName.toString(); const auto value = std::make_pair(productName, depAndModuleName); m_parameterObjects.insert(std::make_pair(id, value)); } void onPropertyRead(const JSValue &object, const QString &name, const JSValue &value) override; private: std::unordered_map m_projectObjectIds; std::unordered_map> m_parameterObjects; std::unordered_map m_exportsObjectIds; Set m_importIds; Set m_artifactIds; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/language/itempool.cpp0000644000175100017510000000434315154533055021601 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "itempool.h" #include "item.h" namespace qbs { namespace Internal { ItemPool::ItemPool() = default; ItemPool::~ItemPool() { for (Item *item : m_items) item->~Item(); } Item *ItemPool::allocateItem(const ItemType &type) { const auto item = new (&m_pool) Item(type); m_items.push_back(item); return item; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/scriptimporter.h0000644000175100017510000000471015154533055022502 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 SCRIPTIMPORTER_H #define SCRIPTIMPORTER_H #include #include namespace qbs { namespace Internal { class ScriptEngine; class ScriptImporter { public: ScriptImporter(ScriptEngine *scriptEngine); JSValue importSourceCode(const QString &sourceCode, const QString &filePath, JSValue &targetObject); static void copyProperties(JSContext *ctx, const JSValue &src, JSValue &dst); private: ScriptEngine *m_engine; QHash m_sourceCodeCache; }; } // namespace Internal } // namespace qbs #endif // SCRIPTIMPORTER_H qbs-src-3.2.0/src/lib/corelib/language/item.h0000644000175100017510000002526715154533055020364 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ITEM_H #define QBS_ITEM_H #include "forward_decls.h" #include "itemtype.h" #include "propertydeclaration.h" #include "qualifiedid.h" #include #include #include #include #include #include #include #include #include #include #include namespace qbs { class SetupProjectParameters; namespace Internal { class ItemObserver; class ItemPool; class Logger; class ModuleItemLocker; class ProductContext; class QBS_AUTOTEST_EXPORT Item : public QbsQmlJS::Managed { friend class ASTPropertiesItemHandler; friend class ItemPool; friend class ItemReaderASTVisitor; friend class ModuleItemLocker; Q_DISABLE_COPY(Item) Item(ItemType type) : m_type(type) {} public: struct Module { QualifiedId name; Item *item = nullptr; ProductContext *product = nullptr; // Set if and only if the dep is a product. // All the sites that declared an explicit dependency on this module. Can contain any // number of module instances and at most one product. using ParametersWithPriority = std::pair; struct LoadContext { LoadContext(Item *dependsItem, const ParametersWithPriority ¶meters) : dependsItem(dependsItem), parameters(parameters) {} LoadContext(Item *dependsItem, ParametersWithPriority &¶meters) : dependsItem(dependsItem), parameters(std::move(parameters)) {} LoadContext(const LoadContext &) = default; LoadContext(LoadContext &&) = default; LoadContext &operator=(const LoadContext &) = default; LoadContext &operator=(LoadContext &&) = default; Item *loadingItem() const { if (!dependsItem) return nullptr; Item *loadingItem = dependsItem->parent(); while (loadingItem->type() == ItemType::Group) loadingItem = loadingItem->parent(); QBS_CHECK( loadingItem->type() == ItemType::ModuleInstance || loadingItem->type() == ItemType::Product); return loadingItem; } Item *dependsItem; ParametersWithPriority parameters; }; std::vector loadContexts; QVariantMap parameters; VersionRange versionRange; // The shorter this value, the "closer to the product" we consider the module, // and the higher its precedence is when merging property values. int maxDependsChainLength = 0; bool required = true; bool minimal = false; }; using Modules = std::vector; using PropertyDeclarationMap = QMap; using PropertyMap = QMap; static Item *create(ItemPool *pool, ItemType type); Item *clone(ItemPool &pool) const; const QString &id() const { return m_id; } const CodeLocation &location() const { return m_location; } CodeRange codeRange() const; Item *prototype() const { return m_prototype; } Item *rootPrototype(); Item *scope() const { return m_scope; } Item *outerItem() const { return m_outerItem; } Item *parent() const { return m_parent; } const FileContextPtr &file() const { return m_file; } const QList &children() const { return m_children; } QList &children() { return m_children; } Item *child(ItemType type, bool checkForMultiple = true) const; const PropertyMap &properties() const { assertModuleLocked(); return m_properties; } PropertyMap &properties() { assertModuleLocked(); return m_properties; } const PropertyDeclarationMap &propertyDeclarations() const { return m_propertyDeclarations; } PropertyDeclaration propertyDeclaration(const QString &name, bool allowExpired = true) const; // The list of modules is ordered such that dependencies appear before the modules // depending on them. const Modules &modules() const { return m_modules; } Modules &modules() { return m_modules; } void addModule(const Module &module); void removeModules() { m_modules.clear(); } void setModules(const Modules &modules); ItemType type() const { return m_type; } void setType(ItemType type) { m_type = type; } QString typeName() const; bool hasProperty(const QString &name) const; bool hasOwnProperty(const QString &name) const; ValuePtr property(const QString &name) const; ValuePtr ownProperty(const QString &name) const; ItemValuePtr itemProperty(const QString &name, ItemPool &pool, const Item *itemTemplate = nullptr); ItemValuePtr itemProperty(const QString &name, const ItemValueConstPtr &value, ItemPool &pool); JSSourceValuePtr sourceProperty(const QString &name) const; VariantValuePtr variantProperty(const QString &name) const; bool isOfTypeOrhasParentOfType(ItemType type) const; void addObserver(ItemObserver *observer) const; void removeObserver(ItemObserver *observer) const; void setProperty(const QString &name, const ValuePtr &value); void setProperties(const PropertyMap &props) { assertModuleLocked(); m_properties = props; } void removeProperty(const QString &name); void setPropertyDeclaration(const QString &name, const PropertyDeclaration &declaration); void setPropertyDeclarations(const PropertyDeclarationMap &decls); void setLocation(const CodeLocation &location) { m_location = location; } void setEndPosition(const CodePosition &position) { m_endPosition = position; } void setPrototype(Item *prototype) { m_prototype = prototype; } void setFile(const FileContextPtr &file) { m_file = file; } void setId(const QString &id) { m_id = id; } void setScope(Item *item) { m_scope = item; } void setOuterItem(Item *item) { m_outerItem = item; } void setChildren(const QList &children) { m_children = children; } void setParent(Item *item) { m_parent = item; } void childrenReserve(int size) { m_children.reserve(size); } static void addChild(Item *parent, Item *child); static void removeChild(Item *parent, Item *child); void dump() const; bool isPresentModule() const; void setupForBuiltinType(DeprecationWarningMode deprecationMode, Logger &logger); void copyProperty(const QString &propertyName, Item *target) const; void overrideProperties( const QVariantMap &config, const QString &key, const SetupProjectParameters ¶meters, Logger &logger, bool ignoreNonExisting = false); void overrideProperties( const QVariantMap &config, const QualifiedId &namePrefix, const SetupProjectParameters ¶meters, Logger &logger, bool ignoreNonExisting = false); private: ItemValuePtr itemProperty(const QString &name, const Item *itemTemplate, const ItemValueConstPtr &itemValue, ItemPool &pool); void adaptScopesOfClonedAlternatives(Item *clone) const; void dump(int indentation) const; void lockModule() const; void unlockModule() const; void assertModuleLocked() const; mutable std::vector m_observers; mutable std::mutex m_observersMutex; QString m_id; CodeLocation m_location; CodePosition m_endPosition; Item *m_prototype = nullptr; Item *m_scope = nullptr; Item *m_outerItem = nullptr; Item *m_parent = nullptr; QList m_children; FileContextPtr m_file; PropertyMap m_properties; PropertyDeclarationMap m_propertyDeclarations; PropertyDeclarationMap m_expiredPropertyDeclarations; Modules m_modules; ItemType m_type; mutable std::mutex m_moduleMutex; #ifndef NDEBUG mutable std::atomic_bool m_moduleLocked = false; #endif }; inline bool operator<(const Item::Module &m1, const Item::Module &m2) { return m1.name < m2.name; } Item *createNonPresentModule(ItemPool &pool, const QString &name, const QString &reason, Item *module); void setScopeForDescendants(Item *item, Item *scope, bool insertIds); // This mechanism is needed because Module items are shared between products (not doing so // would be prohibitively expensive). // The competing accesses are between // - Attaching a temporary qbs module for evaluating the Module condition. // - Cloning the module when creating an instance. // - Directly accessing Module properties, which happens rarely (as opposed to properties of // an instance). class ModuleItemLocker { public: ModuleItemLocker(const Item &item) : m_item(item) { item.lockModule(); } ~ModuleItemLocker() { m_item.unlockModule(); } private: const Item &m_item; }; } // namespace Internal } // namespace qbs #endif // QBS_ITEM_H qbs-src-3.2.0/src/lib/corelib/language/itemobserver.h0000644000175100017510000000422415154533055022122 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ITEMOBSERVER_H #define QBS_ITEMOBSERVER_H namespace qbs { namespace Internal { class Item; class ItemObserver { public: virtual ~ItemObserver() = default; virtual void onItemPropertyChanged(Item *item) = 0; }; } // namespace Internal } // namespace qbs #endif // QBS_ITEMOBSERVER_H qbs-src-3.2.0/src/lib/corelib/language/itemtype.h0000644000175100017510000000535515154533055021262 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ITEMTYPE_H #define QBS_ITEMTYPE_H #include namespace qbs { namespace Internal { enum class ItemType { // Actual user-visible items. FirstActualItem, Artifact = FirstActualItem, Depends, Export, FileTagger, Group, JobLimit, Module, ModuleProvider, Parameter, Parameters, Probe, Product, Profile, Project, Properties, PropertiesInSubProject, PropertyOptions, Rule, Scanner, SubProject, Transformer, LastActualItem = Transformer, // Internal items created mainly by the module loader. IdScope, ModuleInstance, ModuleInstancePlaceholder, ModuleParameters, ModulePrefix, Outer, Scope, Unknown }; inline auto qHash(ItemType t) { return QT_PREPEND_NAMESPACE(qHash)(uint(t)); } } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/language/asttools.cpp0000644000175100017510000000553015154533055021620 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "asttools.h" #include namespace qbs { namespace Internal { QStringList toStringList(QbsQmlJS::AST::UiQualifiedId *qid) { QStringList result; for (; qid; qid = qid->next) result.push_back(qid->name.toString()); return result; } CodeLocation toCodeLocation(const QString &filePath, const QbsQmlJS::AST::SourceLocation &location) { return CodeLocation(filePath, location.startLine, location.startColumn); } QString textOf(const QString &source, QbsQmlJS::AST::Node *node) { if (!node) return {}; return source.mid(node->firstSourceLocation().begin(), int(node->lastSourceLocation().end() - node->firstSourceLocation().begin())); } QStringView textViewOf(const QString &source, QbsQmlJS::AST::Node *node) { const quint32 firstBegin = node->firstSourceLocation().begin(); return QStringView(source).mid(firstBegin, int(node->lastSourceLocation().end() - firstBegin)); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/scriptpropertyobserver.cpp0000644000175100017510000000420515154533055024627 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "scriptpropertyobserver.h" #include "scriptengine.h" namespace qbs { namespace Internal { ScriptPropertyObserver::~ScriptPropertyObserver() { if (m_unobserveMode == UnobserveMode::Enabled) m_engine->unobserveProperties(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/propertydeclaration.h0000644000175100017510000001137115154533055023507 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROPERTYDECLARATION_H #define QBS_PROPERTYDECLARATION_H #include #include #include QT_BEGIN_NAMESPACE class QVariant; QT_END_NAMESPACE namespace qbs { class CodeLocation; class ErrorInfo; namespace Internal { class DeprecationInfo; class PropertyDeclarationData; class Item; class LoaderState; class Logger; class PropertyDeclaration { public: enum Type { UnknownType, Boolean, Integer, Path, PathList, String, StringList, Variant, VariantList, }; enum Flag { DefaultFlags = 0, ReadOnlyFlag = 0x1, PropertyNotAvailableInConfig = 0x2 // Is this property part of a project, product or file configuration? }; Q_DECLARE_FLAGS(Flags, Flag) PropertyDeclaration(); PropertyDeclaration(const QString &name, Type type, const QString &initialValue = QString(), Flags flags = DefaultFlags); PropertyDeclaration(const PropertyDeclaration &other); ~PropertyDeclaration(); PropertyDeclaration &operator=(const PropertyDeclaration &other); bool isValid() const; bool isScalar() const; static Type propertyTypeFromString(const QString &typeName); QString typeString() const; static QString typeString(Type t); const QString &name() const; void setName(const QString &name); Type type() const; void setType(Type t); Flags flags() const; void setFlags(Flags f); CodeLocation location() const; void setLocation(const CodeLocation &loc); const QStringList &allowedValues() const; void setAllowedValues(const QStringList &v); const QString &description() const; void setDescription(const QString &str); const QString &initialValueSource() const; void setInitialValueSource(const QString &str); const QStringList &functionArgumentNames() const; void setFunctionArgumentNames(const QStringList &lst); bool isDeprecated() const; bool isExpired() const; const DeprecationInfo &deprecationInfo() const; void setDeprecationInfo(const DeprecationInfo &deprecationInfo); ErrorInfo checkForDeprecation(DeprecationWarningMode mode, const CodeLocation &loc, Logger &logger) const; static QVariant convertToPropertyType( const QVariant &v, Type t, const QStringList &namePrefix, const QString &key); QVariant typedNullValue() const; bool shouldCheckAllowedValues() const; void checkAllowedValues( const QVariant &value, const CodeLocation &loc, const QString &key, LoaderState &loaderState) const; private: QSharedDataPointer d; }; void checkPropertyDeclarations(Item *topLevelItem, LoaderState &loaderState); } // namespace Internal } // namespace qbs #endif // QBS_PROPERTYDECLARATION_H qbs-src-3.2.0/src/lib/corelib/language/language.cpp0000644000175100017510000010026515154533055021534 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "language.h" #include "artifactproperties.h" #include "builtindeclarations.h" #include "propertymapinternal.h" #include "scriptengine.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { template bool equals(const T *v1, const T *v2) { if (v1 == v2) return true; if (!v1 != !v2) return false; return *v1 == *v2; } /*! * \class FileTagger * \brief The \c FileTagger class maps 1:1 to the respective item in a qbs source file. */ FileTagger::FileTagger(const QStringList &patterns, FileTags fileTags, int priority) : m_fileTags(std::move(fileTags)), m_priority(priority) { setPatterns(patterns); } void FileTagger::setPatterns(const QStringList &patterns) { m_patterns.clear(); for (const QString &pattern : patterns) { QBS_CHECK(!pattern.isEmpty()); m_patterns << QRegularExpression(QRegularExpression::wildcardToRegularExpression(pattern)); } } bool Probe::needsReconfigure(const FileTime &referenceTime) const { const auto criterion = [referenceTime](const QString &filePath) { FileInfo fi(filePath); return !fi.exists() || fi.lastModified() > referenceTime; }; return Internal::any_of(m_importedFilesUsed, criterion); } void Probe::restoreValues(const QVariantMap &properties) { for (auto it = properties.begin(), end = properties.end(); it != end; ++it) { m_values[it.key()] = VariantValue::createStored(it.value()); } } QVariantMap Probe::storeValues() const { QVariantMap result; for (auto it = m_values.begin(), end = m_values.end(); it != end; ++it) { result[it.key()] = it.value()->value(); } return result; } /*! * \class SourceArtifact * \brief The \c SourceArtifact class represents a source file. * Everything except the file path is inherited from the surrounding \c ResolvedGroup. * (TODO: Not quite true. Artifacts in transformers will be generated by the transformer, but are * still represented as source artifacts. We may or may not want to change this; if we do, * SourceArtifact could simply have a back pointer to the group in addition to the file path.) * \sa ResolvedGroup */ /*! * \class ResolvedGroup * \brief The \c ResolvedGroup class corresponds to the Group item in a qbs source file. */ /*! * \variable ResolvedGroup::files * \brief The files listed in the group item's "files" binding. */ /*! * \variable ResolvedGroup::wildcards * \brief Represents the wildcard patterns in this group's "files" binding. * If no wildcards are specified there, this variable is null. * \sa SourceWildCards */ /*! * \class RuleArtifact * \brief The \c RuleArtifact class represents an Artifact item encountered in the context * of a Rule item. * When applying the rule, one \c Artifact object will be constructed from each \c RuleArtifact * object. During that process, the \c RuleArtifact's bindings are evaluated and the results * are inserted into the corresponding \c Artifact's properties. * \sa Rule */ /*! * \class ScriptFunction * \brief The \c ScriptFunction class represents the JavaScript code found in the "prepare" binding * of a \c Rule item in a qbs file. * \sa Rule */ ScriptFunction::ScriptFunction() = default; ScriptFunction::~ScriptFunction() = default; /*! * \variable ScriptFunction::script * \brief The actual Javascript code, taken verbatim from the qbs source file. */ /*! * \variable ScriptFunction::location * \brief The exact location of the script in the qbs source file. * This is mostly needed for diagnostics. */ bool ScriptFunction::isValid() const { return location.line() != -1; } bool operator==(const ScriptFunction &a, const ScriptFunction &b) { return a.sourceCode == b.sourceCode && a.location == b.location && equals(a.fileContext.get(), b.fileContext.get()); } QStringList ResolvedModule::argumentNamesForSetupBuildEnv() { static const QStringList argNames = BuiltinDeclarations::instance() .argumentNamesForScriptFunction(ItemType::Module, StringConstants::setupBuildEnvironmentProperty()); return argNames; } QStringList ResolvedModule::argumentNamesForSetupRunEnv() { static const QStringList argNames = BuiltinDeclarations::instance() .argumentNamesForScriptFunction(ItemType::Module, StringConstants::setupRunEnvironmentProperty()); return argNames; } bool operator==(const ResolvedModule &m1, const ResolvedModule &m2) { return m1.name == m2.name && m1.isProduct == m2.isProduct && toSet(m1.moduleDependencies) == toSet(m2.moduleDependencies) && m1.setupBuildEnvironmentScript == m2.setupBuildEnvironmentScript && m1.setupRunEnvironmentScript == m2.setupRunEnvironmentScript; } RulePtr Rule::clone() const { return std::make_shared(*this); } QStringList Rule::argumentNamesForOutputArtifacts() { static const QStringList argNames = BuiltinDeclarations::instance() .argumentNamesForScriptFunction(ItemType::Rule, StringConstants::outputArtifactsProperty()); return argNames; } QStringList Rule::argumentNamesForPrepare() { static const QStringList argNames = BuiltinDeclarations::instance() .argumentNamesForScriptFunction(ItemType::Rule, StringConstants::prepareProperty()); return argNames; } QString Rule::toString() const { QStringList outputTagsSorted = collectedOutputFileTags().toStringList(); outputTagsSorted.sort(); FileTags inputTags = inputs; inputTags.unite(inputsFromDependencies); QStringList inputTagsSorted = inputTags.toStringList(); inputTagsSorted.sort(); return QLatin1Char('[') + outputTagsSorted.join(QLatin1Char(',')) + QLatin1String("][") + inputTagsSorted.join(QLatin1Char(',')) + QLatin1Char(']'); } FileTags Rule::staticOutputFileTags() const { FileTags result; for (const auto &artifact : artifacts) result.unite(artifact->fileTags); return result; } FileTags Rule::collectedOutputFileTags() const { FileTags result = outputFileTags.empty() ? staticOutputFileTags() : outputFileTags; for (const auto &ap : product->artifactProperties) { if (ap->fileTagsFilter().intersects(result)) result += ap->extraFileTags(); } return result; } bool Rule::isDynamic() const { return outputArtifactsScript.isValid(); } bool Rule::declaresInputs() const { return !inputs.empty() || !inputsFromDependencies.empty(); } ResolvedProduct::ResolvedProduct() : enabled(true) { } ResolvedProduct::~ResolvedProduct() = default; void ResolvedProduct::accept(BuildGraphVisitor *visitor) const { if (!buildData) return; for (BuildGraphNode * const node : std::as_const(buildData->rootNodes())) node->accept(visitor); } /*! * \brief Returns all files of all groups as source artifacts. * This includes the expanded list of wildcards. */ std::vector ResolvedProduct::allFiles() const { std::vector lst; for (const auto &group : groups) { if (group->files) lst << *group->files; } return lst; } /*! * \brief Returns all files of all enabled groups as source artifacts. * \sa ResolvedProduct::allFiles() */ std::vector ResolvedProduct::allEnabledFiles() const { std::vector lst; for (const auto &group : groups) { if (group->enabled && group->files) lst << *group->files; } return lst; } FileTags ResolvedProduct::fileTagsForFileName(const QString &fileName) const { FileTags result; std::unique_ptr priority; for (const FileTaggerConstPtr &tagger : std::as_const(fileTaggers)) { for (const QRegularExpression &pattern : tagger->patterns()) { if (pattern.match(fileName).hasMatch()) { if (priority) { if (*priority != tagger->priority()) { // The taggers are expected to be sorted by priority. QBS_ASSERT(*priority > tagger->priority(), return result); return result; } } else { priority = std::make_unique(tagger->priority()); } result.unite(tagger->fileTags()); break; } } } return result; } void ResolvedProduct::load(PersistentPool &pool) { serializationOp(pool); for (const RulePtr &rule : rules) rule->product = this; for (const ResolvedModulePtr &module : modules) module->product = this; for (const auto &group: groups) group->restoreWildcards(buildDirectory()); } void ResolvedProduct::store(PersistentPool &pool) { serializationOp(pool); } ArtifactSet ResolvedProduct::lookupArtifactsByFileTag(const FileTag &tag) const { QBS_CHECK(buildData); return buildData->artifactsByFileTag().value(tag); } ArtifactSet ResolvedProduct::lookupArtifactsByFileTags(const FileTags &tags) const { QBS_CHECK(buildData); ArtifactSet set; for (const FileTag &tag : tags) set = set.unite(buildData->artifactsByFileTag().value(tag)); return set; } ArtifactSet ResolvedProduct::targetArtifacts() const { QBS_CHECK(buildData); ArtifactSet taSet; for (Artifact * const a : buildData->rootArtifacts()) { QBS_CHECK(a->fileTags().intersects(fileTags)); taSet << a; } return taSet; } TopLevelProject *ResolvedProduct::topLevelProject() const { return project->topLevelProject(); } QString ResolvedProduct::uniqueName(const QString &name, const QString &multiplexConfigurationId) { QString result = name; if (!multiplexConfigurationId.isEmpty()) result.append(QLatin1Char('.')).append(multiplexConfigurationId); return result; } QString ResolvedProduct::uniqueName() const { return uniqueName(name, multiplexConfigurationId); } QString ResolvedProduct::fullDisplayName() const { return fullProductDisplayName(name, multiplexConfigurationId); } QString ResolvedProduct::profile() const { return moduleProperties->qbsPropertyValue(StringConstants::profileProperty()).toString(); } static QStringList findGeneratedFiles(const Artifact *base, bool recursive, const FileTags &tags) { QStringList result; for (const Artifact *parent : base->parentArtifacts()) { if (tags.empty() || parent->fileTags().intersects(tags)) result << parent->filePath(); if (recursive) result << findGeneratedFiles(parent, true, tags); } return result; } QStringList ResolvedProduct::generatedFiles(const QString &baseFile, bool recursive, const FileTags &tags) const { ProductBuildData *data = buildData.get(); if (!data) return {}; for (const Artifact *art : filterByType(data->allNodes())) { if (art->filePath() == baseFile) return findGeneratedFiles(art, recursive, tags); } return {}; } QString ResolvedProduct::deriveBuildDirectoryName(const QString &name, const QString &multiplexConfigurationId) { QString dirName = uniqueName(name, multiplexConfigurationId); const QByteArray hash = QCryptographicHash::hash(dirName.toUtf8(), QCryptographicHash::Sha1); return HostOsInfo::rfc1034Identifier(dirName) .append(QLatin1Char('.')) .append(QString::fromLatin1(hash.toHex().left(8))); } QString ResolvedProduct::buildDirectory() const { return productProperties.value(StringConstants::buildDirectoryProperty()).toString(); } bool ResolvedProduct::isInParentProject(const ResolvedProductConstPtr &other) const { for (const ResolvedProject *otherParent = other->project.get(); otherParent; otherParent = otherParent->parentProject.get()) { if (otherParent == project.get()) return true; } return false; } bool ResolvedProduct::builtByDefault() const { return productProperties.value(StringConstants::builtByDefaultProperty(), true).toBool(); } void ResolvedProduct::cacheExecutablePath(const QString &origFilePath, const QString &fullFilePath) { std::lock_guard locker(m_executablePathCacheLock); m_executablePathCache.insert(origFilePath, fullFilePath); } QString ResolvedProduct::cachedExecutablePath(const QString &origFilePath) const { std::lock_guard locker(m_executablePathCacheLock); return m_executablePathCache.value(origFilePath); } std::vector ResolvedProduct::depsAsProductList() const { return transformed>( dependencies, [](const ProductDependency &dep) { return dep.product; }); } bool ResolvedProduct::hasDependency(const ResolvedProductPtr &p) const { return any_of(dependencies, [&p](const ProductDependency &dep) { return dep.product == p; }); } void ResolvedGroup::restoreWildcards(const QString &buildDir) { if (!files) return; if (wildcards) { wildcards->buildDir = buildDir; wildcards->prefix = prefix; wildcards->baseDir = FileInfo::path(location.filePath()); for (const auto &sourceArtifact : *files) { if (sourceArtifact->fromWildcard) wildcards->expandedFiles += sourceArtifact->absoluteFilePath; } } } ResolvedProject::ResolvedProject() : enabled(true), m_topLevelProject(nullptr) { } ResolvedProject::~ResolvedProject() = default; void ResolvedProject::accept(BuildGraphVisitor *visitor) const { for (const ResolvedProductPtr &product : products) product->accept(visitor); for (const ResolvedProjectPtr &subProject : std::as_const(subProjects)) subProject->accept(visitor); } TopLevelProject *ResolvedProject::topLevelProject() { if (m_topLevelProject) return m_topLevelProject; if (parentProject.expired()) { m_topLevelProject = static_cast(this); return m_topLevelProject; } m_topLevelProject = parentProject->topLevelProject(); return m_topLevelProject; } std::vector ResolvedProject::allSubProjects() const { std::vector projectList = subProjects; for (const auto &subProject : subProjects) projectList << subProject->allSubProjects(); return projectList; } std::vector ResolvedProject::allProducts() const { std::vector productList = products; for (const auto &subProject : std::as_const(subProjects)) productList << subProject->allProducts(); return productList; } void ResolvedProject::load(PersistentPool &pool) { serializationOp(pool); std::for_each(products.cbegin(), products.cend(), [](const ResolvedProductPtr &p) { if (!p->buildData) return; for (BuildGraphNode * const node : std::as_const(p->buildData->allNodes())) { node->product = p; // restore parent links for (BuildGraphNode * const child : std::as_const(node->children)) child->parents.insert(node); } }); } void ResolvedProject::store(PersistentPool &pool) { serializationOp(pool); } TopLevelProject::TopLevelProject() : bgLocker(nullptr), locked(false), lastStartResolveTime(FileTime::oldestTime()) { } TopLevelProject::~TopLevelProject() { cleanupModuleProviderOutput(); delete bgLocker; } QString TopLevelProject::deriveId(const QVariantMap &config) { const QVariantMap qbsProperties = config.value(StringConstants::qbsModule()).toMap(); QString configurationName = qbsProperties.value( StringConstants::configurationNameProperty()).toString(); return configurationName; } QString TopLevelProject::deriveBuildDirectory(const QString &buildRoot, const QString &id) { return buildRoot + QLatin1Char('/') + id; } void TopLevelProject::setBuildConfiguration(const QVariantMap &config) { m_buildConfiguration = config; m_id = deriveId(config); } QString TopLevelProject::profile() const { return projectProperties().value(StringConstants::profileProperty()).toString(); } void TopLevelProject::makeModuleProvidersNonTransient() { for (auto &item : moduleProviderInfo.providers) item.second.transientOutput = false; } QVariantMap TopLevelProject::fullProfileConfigsTree() const { QVariantMap tree; for (auto it = profileConfigs.cbegin(); it != profileConfigs.cend(); ++it) { tree.insert(it.key(), SetupProjectParameters::finalBuildConfigurationTree( it.value().toMap(), overriddenValues)); } return tree; } QString TopLevelProject::buildGraphFilePath() const { return ProjectBuildData::deriveBuildGraphFilePath(buildDirectory, id()); } void TopLevelProject::store(Logger logger) { // TODO: Use progress observer here. if (!buildData) return; if (!buildData->isDirty()) { qCDebug(lcBuildGraph) << "build graph is unchanged in project" << id(); return; } makeModuleProvidersNonTransient(); const QString fileName = buildGraphFilePath(); qCDebug(lcBuildGraph) << "storing:" << fileName; PersistentPool pool(logger); PersistentPool::HeadData headData; headData.projectConfig = buildConfiguration(); pool.setHeadData(headData); pool.setupWriteStream(fileName); store(pool); pool.finalizeWriteStream(); buildData->setClean(); } void TopLevelProject::load(PersistentPool &pool) { ResolvedProject::load(pool); serializationOp(pool); QBS_CHECK(buildData); } void TopLevelProject::store(PersistentPool &pool) { ResolvedProject::store(pool); serializationOp(pool); } void TopLevelProject::cleanupModuleProviderOutput() { QString error; for (const auto &item : std::as_const(moduleProviderInfo.providers)) { const ModuleProviderInfo &m = item.second; if (m.transientOutput) { if (!removeDirectoryWithContents(m.outputDirPath(buildDirectory), &error)) qCWarning(lcBuildGraph) << "Error removing module provider output:" << error; } } QDir moduleProviderBaseDir(buildDirectory + QLatin1Char('/') + ModuleProviderInfo::outputBaseDirName()); if (moduleProviderBaseDir.exists() && moduleProviderBaseDir.isEmpty() && !removeDirectoryWithContents(moduleProviderBaseDir.path(), &error)) { qCWarning(lcBuildGraph) << "Error removing module provider output:" << error; } } /*! * \class SourceWildCards * \brief Objects of the \c SourceWildCards class result from giving wildcards in a * \c ResolvedGroup's "files" binding. * \sa ResolvedGroup */ /*! * \variable SourceWildCards::prefix * \brief Inherited from the \c ResolvedGroup * \sa ResolvedGroup */ /*! * \variable SourceWildCards::patterns * \brief All elements of the \c ResolvedGroup's "files" binding that contain wildcards. * \sa ResolvedGroup */ /*! * \variable SourceWildCards::excludePatterns * \brief Corresponds to the \c ResolvedGroup's "excludeFiles" binding. * \sa ResolvedGroup */ /*! * \variable SourceWildCards::files * \brief The \c SourceArtifacts resulting from the expanded list of matching files. */ void SourceWildCards::expandPatterns() { dirTimeStamps.clear(); expandedFiles = expandPatterns(patterns) - expandPatterns(excludePatterns); } Set SourceWildCards::expandPatterns(const QStringList &patterns) { Set files; QString expandedPrefix = prefix; if (expandedPrefix.startsWith(StringConstants::tildeSlash())) expandedPrefix.replace(0, 1, QDir::homePath()); for (QString pattern : patterns) { pattern.prepend(expandedPrefix); pattern.replace(QLatin1Char('\\'), QLatin1Char('/')); QStringList parts = pattern.split(QLatin1Char('/'), Qt::SkipEmptyParts); if (FileInfo::isAbsolute(pattern)) { QString rootDir; if (HostOsInfo::isWindowsHost() && pattern.at(0) != QLatin1Char('/')) { rootDir = parts.takeFirst(); if (!rootDir.endsWith(QLatin1Char('/'))) rootDir.append(QLatin1Char('/')); } else { rootDir = QLatin1Char('/'); } expandPatterns(files, parts, rootDir); } else { expandPatterns(files, parts, baseDir); } } return files; } void SourceWildCards::expandPatterns(Set &result, const QStringList &parts, const QString &baseDir) { // People might build directly in the project source directory. This is okay, since // we keep the build data in a "container" directory. However, we must make sure we don't // match any generated files therein as source files. if (baseDir.startsWith(buildDir)) return; QStringList changed_parts = parts; bool recursive = false; QString part = changed_parts.takeFirst(); while (part == QStringLiteral("**")) { recursive = true; if (changed_parts.empty()) { part = StringConstants::star(); break; } part = changed_parts.takeFirst(); } const bool isDir = !changed_parts.empty(); const QString &filePattern = part; const QDirIterator::IteratorFlags itFlags = recursive ? QDirIterator::Subdirectories : QDirIterator::NoIteratorFlags; QDir::Filters itFilters = isDir ? QDir::Dirs : QDir::Files | QDir::System | QDir::Dirs; // This one is needed to get symbolic links to directories if (FileInfo::isPattern(filePattern)) { if (!recursive) dirTimeStamps.emplace_back(baseDir, FileInfo(baseDir).lastModified()); } else if (isDir) { itFilters |= QDir::Hidden; } if (filePattern != StringConstants::dotDot() && filePattern != StringConstants::dot()) itFilters |= QDir::NoDotAndDotDot; if (HostOsInfo::fileNameCaseSensitivity() == Qt::CaseSensitive) itFilters |= QDir::CaseSensitive; QDirIterator it(baseDir, QStringList(filePattern), itFilters, itFlags); while (it.hasNext()) { const QString filePath = it.next(); const QString parentDir = it.fileInfo().dir().path(); if (parentDir.startsWith(buildDir)) continue; // See above. if (!isDir && it.fileInfo().isDir() && !it.fileInfo().isSymLink()) continue; if (isDir) expandPatterns(result, changed_parts, filePath); else result += QDir::cleanPath(filePath); } } bool SourceWildCards::hasChangedSinceExpansion() const { const bool reExpansionRequired = Internal::any_of(dirTimeStamps, [](const std::pair &pair) { return FileInfo(pair.first).lastModified() > pair.second; }); if (reExpansionRequired) return true; auto wc = *this; wc.expandPatterns(); return this->expandedFiles != wc.expandedFiles; } template QMap listToMap(const L &list) { using V = typename L::value_type; QMap map; for (const V &elem : list) map.insert(keyFromElem(elem), elem); return map; } template bool listsAreEqual(const L &l1, const L &l2) { if (l1.size() != l2.size()) return false; using V = typename L::value_type; const QMap map1 = listToMap(l1); const QMap map2 = listToMap(l2); const auto keys = map1.keys(); return Internal::all_of(keys, [&map1, &map2](const auto &key) { const V &value2 = map2.value(key); if (!value2) return false; return equals(map1.value(key).get(), value2.get()); }); } QString keyFromElem(const SourceArtifactPtr &sa) { return sa->absoluteFilePath; } QString keyFromElem(const RulePtr &r) { QString key = r->toString() + r->prepareScript.sourceCode(); if (r->outputArtifactsScript.isValid()) key += r->outputArtifactsScript.sourceCode(); for (const auto &a : r->artifacts) key += a->filePath; return key; } QString keyFromElem(const ArtifactPropertiesPtr &ap) { QStringList lst = ap->fileTagsFilter().toStringList(); lst.sort(); return lst.join(QLatin1Char(',')); } bool operator==(const SourceArtifactInternal &sa1, const SourceArtifactInternal &sa2) { return sa1.absoluteFilePath == sa2.absoluteFilePath && sa1.fileTags == sa2.fileTags && sa1.overrideFileTags == sa2.overrideFileTags && sa1.targetOfModule == sa2.targetOfModule && !sa1.properties == !sa2.properties && *sa1.properties == *sa2.properties; } bool operator==(const Rule &r1, const Rule &r2) { if (r1.artifacts.size() != r2.artifacts.size()) return false; for (size_t i = 0; i < r1.artifacts.size(); ++i) { if (!equals(r1.artifacts.at(i).get(), r2.artifacts.at(i).get())) return false; } return r1.module->name == r2.module->name && r1.prepareScript == r2.prepareScript && r1.outputArtifactsScript == r2.outputArtifactsScript && r1.inputs == r2.inputs && r1.outputFileTags == r2.outputFileTags && r1.auxiliaryInputs == r2.auxiliaryInputs && r1.auxiliaryInputsFromDependencies == r2.auxiliaryInputsFromDependencies && r1.excludedInputs == r2.excludedInputs && r1.inputsFromDependencies == r2.inputsFromDependencies && r1.explicitlyDependsOn == r2.explicitlyDependsOn && r1.explicitlyDependsOnFromDependencies == r2.explicitlyDependsOnFromDependencies && r1.multiplex == r2.multiplex && r1.requiresInputs == r2.requiresInputs && r1.alwaysRun == r2.alwaysRun; } bool ruleListsAreEqual(const std::vector &l1, const std::vector &l2) { return listsAreEqual(l1, l2); } bool operator==(const RuleArtifact &a1, const RuleArtifact &a2) { return a1.filePath == a2.filePath && a1.fileTags == a2.fileTags && a1.alwaysUpdated == a2.alwaysUpdated && rangeTo>(a1.bindings) == rangeTo>(a2.bindings); } bool operator==(const RuleArtifact::Binding &b1, const RuleArtifact::Binding &b2) { return b1.code == b2.code && b1.name == b2.name; } QHashValueType qHash(const RuleArtifact::Binding &b) { return qHash(std::make_pair(b.code, b.name.join(QLatin1Char(',')))); } bool artifactPropertyListsAreEqual(const std::vector &l1, const std::vector &l2) { return listsAreEqual(l1, l2); } bool operator==(const PrivateScriptFunction &a, const PrivateScriptFunction &b) { return equals(a.m_sharedData.get(), b.m_sharedData.get()); } bool operator==(const ExportedProperty &p1, const ExportedProperty &p2) { return p1.fullName == p2.fullName && p1.type == p2.type && p1.sourceCode == p2.sourceCode && p1.isBuiltin == p2.isBuiltin; } bool operator==(const ExportedModuleDependency &d1, const ExportedModuleDependency &d2) { return d1.name == d2.name && qVariantMapsEqual(d1.moduleProperties, d2.moduleProperties); } bool equals(const std::vector &l1, const std::vector &l2) { static const auto cmp = [](const ExportedItemPtr &p1, const ExportedItemPtr &p2) { return *p1 == *p2; }; return l1.size() == l2.size() && std::equal(l1.cbegin(), l1.cend(), l2.cbegin(), cmp); } bool operator==(const ExportedItem &i1, const ExportedItem &i2) { return i1.name == i2.name && i1.properties == i2.properties && equals(i1.children, i2.children); } bool operator==(const ExportedModule &m1, const ExportedModule &m2) { static const auto depMapsEqual = [](const QMap &m1, const QMap &m2) { if (m1.size() != m2.size()) return false; for (auto it1 = m1.cbegin(), it2 = m2.cbegin(); it1 != m1.cend(); ++it1, ++it2) { if (it1.key()->name != it2.key()->name) return false; if (!qVariantMapsEqual(it1.value(), it2.value())) return false; } return true; }; return qVariantMapsEqual(m1.propertyValues, m2.propertyValues) && qVariantMapsEqual(m1.modulePropertyValues, m2.modulePropertyValues) && equals(m1.children, m2.children) && m1.m_properties == m2.m_properties && m1.importStatements == m2.importStatements && m1.productDependencies.size() == m2.productDependencies.size() && m1.productDependencies == m2.productDependencies && depMapsEqual(m1.dependencyParameters, m2.dependencyParameters); } JSValue PrivateScriptFunction::getFunction(ScriptEngine *engine, const QString &errorMessage) const { if (JS_IsUndefined(scriptFunction)) { ScopedJsValue val(engine->context(), engine->evaluate(JsValueOwner::Caller, sourceCode(), location().filePath(), location().line())); if (Q_UNLIKELY(!JS_IsFunction(engine->context(), val))) throw ErrorInfo(errorMessage, location()); scriptFunction = val.release(); engine->addExternallyCachedValue(&scriptFunction); } else { QBS_CHECK(JS_IsFunction(engine->context(), scriptFunction)); } return scriptFunction; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/scriptengine.cpp0000644000175100017510000012335315154533055022446 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "scriptengine.h" #include "deprecationinfo.h" #include "filecontextbase.h" #include "jsimports.h" #include "preparescriptobserver.h" #include "scriptimporter.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { const bool debugJSImports = false; bool operator==(const ScriptEngine::PropertyCacheKey &lhs, const ScriptEngine::PropertyCacheKey &rhs) { return lhs.m_propertyMap == rhs.m_propertyMap && lhs.m_moduleName == rhs.m_moduleName && lhs.m_propertyName == rhs.m_propertyName; } static QHashValueType combineHash(QHashValueType h1, QHashValueType h2, QHashValueType seed) { // stolen from qHash(QPair) return ((h1 << 16) | (h1 >> 16)) ^ h2 ^ seed; } QHashValueType qHash(const ScriptEngine::PropertyCacheKey &k, QHashValueType seed = 0) { return combineHash(qHash(k.m_moduleName), combineHash(qHash(k.m_propertyName), qHash(k.m_propertyMap), seed), seed); } ScriptEngine::ScriptEngine(Logger &logger, EvalContext evalContext, PrivateTag) : m_scriptImporter(new ScriptImporter(this)), m_logger(logger), m_evalContext(evalContext), m_observer(new PrepareScriptObserver(this, UnobserveMode::Disabled)) { setMaxStackSize(); JS_SetRuntimeOpaque(m_jsRuntime, this); JS_SetInterruptHandler(m_jsRuntime, interruptor, this); setScopeLookup(m_context, &ScriptEngine::doExtraScopeLookup); setFoundUndefinedHandler(m_context, &ScriptEngine::handleUndefinedFound); setFunctionEnteredHandler(m_context, &ScriptEngine::handleFunctionEntered); setFunctionExitedHandler(m_context, &ScriptEngine::handleFunctionExited); m_dataWithPtrClass = registerClass("__data", nullptr, nullptr, JS_UNDEFINED); installQbsBuiltins(); extendJavaScriptBuiltins(); } std::unique_ptr ScriptEngine::create(Logger &logger, EvalContext evalContext) { return std::make_unique(logger, evalContext, PrivateTag()); } ScriptEngine *ScriptEngine::engineForRuntime(const JSRuntime *runtime) { return static_cast(JS_GetRuntimeOpaque(const_cast(runtime))); } ScriptEngine *ScriptEngine::engineForContext(const JSContext *ctx) { return engineForRuntime(JS_GetRuntime(const_cast(ctx))); } LookupResult ScriptEngine::doExtraScopeLookup(JSContext *ctx, JSAtom prop) { static const LookupResult fail{JS_UNDEFINED, JS_UNDEFINED, false}; ScriptEngine * const engine = engineForContext(ctx); engine->m_lastLookupWasSuccess = false; auto handleScope = [ctx, prop, engine](const JSValue &scope) -> LookupResult { const JSValue v = JS_GetProperty(ctx, scope, prop); if (!JS_IsUndefined(v) || engine->m_lastLookupWasSuccess) { engine->m_lastLookupWasSuccess = false; return {v, scope, true}; } return fail; }; if (!engine->m_scopeChains.empty()) { const auto scopes = engine->m_scopeChains.back(); for (auto it = scopes.rbegin(); it != scopes.rend(); ++it) { const auto res = handleScope(*it); if (res.useResult) return res; } } if (JS_IsObject(engine->m_globalObject)) return handleScope(engine->m_globalObject); return fail; } void ScriptEngine::handleUndefinedFound(JSContext *ctx) { engineForContext(ctx)->setLastLookupStatus(true); } void ScriptEngine::handleFunctionEntered(JSContext *ctx, JSValue this_obj) { ScriptEngine::engineForContext(ctx)->m_contextStack.push_back(this_obj); } void ScriptEngine::handleFunctionExited(JSContext *ctx) { ScriptEngine::engineForContext(ctx)->m_contextStack.pop_back(); } ScriptEngine::~ScriptEngine() { reset(); delete m_scriptImporter; if (m_elapsedTimeImporting != -1) { m_logger.qbsLog(LoggerInfo, true) << Tr::tr("Setting up imports took %1.") .arg(elapsedTimeString(m_elapsedTimeImporting)); } for (const auto &ext : std::as_const(m_internalExtensions)) JS_FreeValue(m_context, ext); for (const JSValue &s : std::as_const(m_stringCache)) JS_FreeValue(m_context, s); for (JSValue * const externalRef : std::as_const(m_externallyCachedValues)) { JS_FreeValue(m_context, *externalRef); *externalRef = JS_UNDEFINED; } setPropertyOnGlobalObject(QLatin1String("console"), JS_UNDEFINED); JS_FreeContext(m_context); JS_FreeRuntime(m_jsRuntime); } void ScriptEngine::reset() { // TODO: Check whether we can keep file and imports cache. // We'd have to find a solution for the scope name problem then. clearImportsCache(); for (const auto &e : std::as_const(m_jsFileCache)) JS_FreeValue(m_context, e.second); m_jsFileCache.clear(); for (const JSValue &s : std::as_const(m_jsValueCache)) JS_FreeValue(m_context, s); m_jsValueCache.clear(); for (auto it = m_evalResults.cbegin(); it != m_evalResults.cend(); ++it) { for (int i = 0; i < it.value(); ++i) JS_FreeValue(m_context, it.key()); } m_evalResults.clear(); for (const auto &e : std::as_const(m_projectScriptValues)) JS_FreeValue(m_context, e.second); m_projectScriptValues.clear(); for (const auto &e : std::as_const(m_baseProductScriptValues)) JS_FreeValue(m_context, e.second); m_baseProductScriptValues.clear(); for (const auto &e : std::as_const(m_productArtifactsMapScriptValues)) JS_FreeValue(m_context, e.second); m_productArtifactsMapScriptValues.clear(); for (const auto &e : std::as_const(m_moduleArtifactsMapScriptValues)) JS_FreeValue(m_context, e.second); m_moduleArtifactsMapScriptValues.clear(); for (const auto &e : std::as_const(m_baseModuleScriptValues)) JS_FreeValue(m_context, e.second); m_baseModuleScriptValues.clear(); { auto guard = m_artifactsScriptValues.lock(); auto &artifactsScriptValues = guard.get(); for (auto it = artifactsScriptValues.cbegin(); it != artifactsScriptValues.cend(); ++it) { it.key().first->setDeregister({}); JS_FreeValue(m_context, it.value()); } artifactsScriptValues.clear(); } m_logger.clearWarnings(); } void ScriptEngine::import(const FileContextBaseConstPtr &fileCtx, JSValue &targetObject, ObserveMode observeMode) { Importer(*this, fileCtx, targetObject, observeMode).run(); } void ScriptEngine::import(const JsImport &jsImport, JSValue &targetObject) { QBS_ASSERT(JS_IsObject(targetObject), return); if (debugJSImports) qDebug() << "[ENGINE] import into " << jsImport.scopeName; JSValue jsImportValue = m_jsImportCache.value(jsImport); if (JS_IsObject(jsImportValue)) { if (debugJSImports) qDebug() << "[ENGINE] " << jsImport.filePaths << " (cache hit)"; } else { if (debugJSImports) qDebug() << "[ENGINE] " << jsImport.filePaths << " (cache miss)"; ScopedJsValue scopedImportValue(m_context, JS_NewObject(m_context)); for (const QString &filePath : jsImport.filePaths) importFile(filePath, scopedImportValue); jsImportValue = scopedImportValue.release(); m_jsImportCache.insert(jsImport, jsImportValue); std::vector &filePathsForScriptValue = m_filePathsPerImport[jsObjectId(jsImportValue)]; transform(jsImport.filePaths, filePathsForScriptValue, [](const auto &fp) { return fp; }); } JSValue sv = JS_NewObjectProto(m_context, jsImportValue); setJsProperty(m_context, sv, StringConstants::importScopeNamePropertyInternal(), jsImport.scopeName); setJsProperty(m_context, targetObject, jsImport.scopeName, sv); if (m_observeMode == ObserveMode::Enabled) observeImport(jsImportValue); } void ScriptEngine::observeImport(JSValue &jsImport) { if (!m_observer->addImportId(quintptr((JS_VALUE_GET_OBJ(jsImport))))) return; handleJsProperties(jsImport, [this, &jsImport](const JSAtom &name, const JSPropertyDescriptor &desc) { if (!JS_IsFunction(m_context, desc.value)) return; const char *const nameStr = JS_AtomToCString(m_context, name); setObservedProperty(jsImport, QString::fromUtf8(nameStr, std::strlen(nameStr)), desc.value); JS_FreeCString(m_context, nameStr); }); } void ScriptEngine::clearImportsCache() { for (const auto &jsImport : std::as_const(m_jsImportCache)) JS_FreeValue(m_context, jsImport); m_jsImportCache.clear(); m_filePathsPerImport.clear(); m_observer->clearImportIds(); } void ScriptEngine::registerEvaluator(Evaluator *evaluator) { QBS_ASSERT(!m_evaluator, return); m_evaluator = evaluator; } void ScriptEngine::unregisterEvaluator(const Evaluator *evaluator) { QBS_ASSERT(m_evaluator == evaluator, return); m_evaluator = nullptr; } void ScriptEngine::checkContext(const QString &operation, const DubiousContextList &dubiousContexts) { for (const DubiousContext &info : dubiousContexts) { if (info.context != evalContext()) continue; QString warning; switch (info.context) { case EvalContext::PropertyEvaluation: warning = Tr::tr("Suspicious use of %1 during property evaluation.").arg(operation); if (info.suggestion == DubiousContext::SuggestMoving) warning += QLatin1Char(' ') + Tr::tr("Should this call be in a Probe instead?"); break; case EvalContext::RuleExecution: warning = Tr::tr("Suspicious use of %1 during rule execution.").arg(operation); if (info.suggestion == DubiousContext::SuggestMoving) { warning += QLatin1Char(' ') + Tr::tr("Should this call be in a JavaScriptCommand instead?"); } break; case EvalContext::ModuleProvider: case EvalContext::ProbeExecution: case EvalContext::JsCommand: QBS_ASSERT(false, continue); break; } const JSValue exVal = JS_NewError(m_context); const JsException ex(m_context, exVal, JS_GetBacktrace(m_context), {}); m_logger.printWarning(ErrorInfo(warning, ex.stackTrace())); return; } } void ScriptEngine::handleDeprecation( const Version &removalVersion, const QString &message, const CodeLocation &loc) { if (!m_setupParams) return; switch (m_setupParams->deprecationWarningMode()) { case DeprecationWarningMode::Error: throw ErrorInfo(message, loc); case DeprecationWarningMode::BeforeRemoval: if (!DeprecationInfo::isLastVersionBeforeRemoval(removalVersion)) break; [[fallthrough]]; case DeprecationWarningMode::On: m_logger.printWarning(ErrorInfo(message, loc)); break; case DeprecationWarningMode::Off: break; } } void ScriptEngine::addPropertyRequestedFromArtifact(const Artifact *artifact, const Property &property) { m_propertiesRequestedFromArtifact[artifact->filePath()] << property; } void ScriptEngine::addImportRequestedInScript(quintptr importValueId) { // Import list is assumed to be small, so let's not use a set. if (!contains(m_importsRequestedInScript, importValueId)) m_importsRequestedInScript.push_back(importValueId); } std::vector ScriptEngine::importedFilesUsedInScript() const { std::vector files; for (qint64 usedImport : m_importsRequestedInScript) { const auto it = m_filePathsPerImport.find(usedImport); QBS_CHECK(it != m_filePathsPerImport.cend()); const std::vector &filePathsForImport = it->second; for (const QString &fp : filePathsForImport) if (!contains(files, fp)) files.push_back(fp); } return files; } void ScriptEngine::enableProfiling(bool enable) { m_elapsedTimeImporting = enable ? 0 : -1; } void ScriptEngine::addToPropertyCache(const QString &moduleName, const QString &propertyName, const PropertyMapConstPtr &propertyMap, const QVariant &value) { m_propertyCache.insert(PropertyCacheKey(moduleName, propertyName, propertyMap), value); } QVariant ScriptEngine::retrieveFromPropertyCache(const QString &moduleName, const QString &propertyName, const PropertyMapConstPtr &propertyMap) { return m_propertyCache.value(PropertyCacheKey(moduleName, propertyName, propertyMap)); } static JSValue js_observedGet(JSContext *ctx, JSValueConst, int, JSValueConst *, int, JSValue *data) { ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); engine->observer()->onPropertyRead(data[0], getJsString(ctx, data[1]), data[2]); return JS_DupValue(engine->context(), data[2]); } void ScriptEngine::setObservedProperty(JSValue &object, const QString &name, const JSValue &value) { ScopedJsValue jsName(m_context, makeJsString(m_context, name)); JSValueList funcData{object, jsName, value}; JSValue getterFunc = JS_NewCFunctionData(m_context, &js_observedGet, 0, 0, 3, funcData.data()); const ScopedJsAtom nameAtom(m_context, name); JS_DefinePropertyGetSet(m_context, object, nameAtom, getterFunc, JS_UNDEFINED, JS_PROP_HAS_GET | JS_PROP_ENUMERABLE); if (m_observer->unobserveMode() == UnobserveMode::Enabled) m_observedProperties.emplace_back(object, name, value); } void ScriptEngine::unobserveProperties() { for (auto &elem : m_observedProperties) { JSValue &object = std::get<0>(elem); const QString &name = std::get<1>(elem); const JSValue &value = std::get<2>(elem); const ScopedJsAtom jsName(m_context, name); JS_DefineProperty(m_context, object, jsName, value, JS_UNDEFINED, JS_UNDEFINED, JS_PROP_HAS_VALUE); } m_observedProperties.clear(); } QProcessEnvironment ScriptEngine::environment() const { return m_environment; } void ScriptEngine::setEnvironment(const QProcessEnvironment &env) { m_environment = env; } void ScriptEngine::importFile(const QString &filePath, JSValue targetObject) { AccumulatingTimer importTimer(m_elapsedTimeImporting != -1 ? &m_elapsedTimeImporting : nullptr); JSValue &evaluationResult = m_jsFileCache[filePath]; if (JS_IsObject(evaluationResult)) { ScriptImporter::copyProperties(m_context, evaluationResult, targetObject); return; } QFile file(filePath); if (Q_UNLIKELY(!file.open(QFile::ReadOnly))) throw ErrorInfo(Tr::tr("Cannot open '%1'.").arg(filePath)); QTextStream stream(&file); setupDefaultCodec(stream); const QString sourceCode = stream.readAll(); file.close(); m_currentDirPathStack.push(FileInfo::path(filePath)); evaluationResult = m_scriptImporter->importSourceCode(sourceCode, filePath, targetObject); m_currentDirPathStack.pop(); } static QString findExtensionDir(const QStringList &searchPaths, const QString &extensionPath) { for (const QString &searchPath : searchPaths) { QString dirPath = searchPath + QStringLiteral("/imports/") + extensionPath; QFileInfo fi(dirPath); if (fi.exists() && fi.isDir()) return dirPath; } return {}; } JSValue ScriptEngine::mergeExtensionObjects(const JSValueList &lst) { JSValue result = JS_UNDEFINED; for (const JSValue &v : lst) { if (!JS_IsObject(result)) { result = v; continue; } ScriptImporter::copyProperties(m_context, v, result); JS_FreeValue(m_context, v); } return result; } JSValue ScriptEngine::getInternalExtension(const char *name) const { const auto cached = m_internalExtensions.constFind(QLatin1String(name)); if (cached != m_internalExtensions.constEnd()) return JS_DupValue(m_context, cached.value()); return JS_UNDEFINED; } void ScriptEngine::addInternalExtension(const char *name, JSValue ext) { m_internalExtensions.insert(QLatin1String(name), JS_DupValue(m_context, ext)); } JSValue ScriptEngine::asJsValue(const QVariant &v, quintptr id, bool frozen) { if (v.isNull()) return JS_UNDEFINED; switch (static_cast(v.userType())) { case QMetaType::QByteArray: return asJsValue(v.toByteArray()); case QMetaType::QString: return asJsValue(v.toString()); case QMetaType::QStringList: return asJsValue(v.toStringList()); case QMetaType::QVariantList: return asJsValue(v.toList(), id, frozen); case QMetaType::Int: case QMetaType::UInt: return JS_NewInt32(m_context, v.toInt()); case QMetaType::Long: case QMetaType::ULong: case QMetaType::LongLong: case QMetaType::ULongLong: return JS_NewInt64(m_context, v.toInt()); case QMetaType::Bool: return JS_NewBool(m_context, v.toBool()); case QMetaType::QDateTime: return JS_NewDate(m_context, v.toDateTime().toMSecsSinceEpoch()); case QMetaType::QVariantMap: return asJsValue(v.toMap(), id, frozen); default: return JS_UNDEFINED; } } JSValue ScriptEngine::asJsValue(const QByteArray &s) { return JS_NewArrayBufferCopy( m_context, reinterpret_cast(s.constData()), s.size()); } JSValue ScriptEngine::asJsValue(const QString &s) { const auto it = m_stringCache.constFind(s); if (it != m_stringCache.constEnd()) return JS_DupValue(m_context, it.value()); const JSValue sv = JS_NewString(m_context, s.toUtf8().constData()); m_stringCache.insert(s, sv); return JS_DupValue(m_context, sv); } JSValue ScriptEngine::asJsValue(const QStringList &l) { JSValue array = JS_NewArray(m_context); setJsProperty(m_context, array, std::string_view("length"), JS_NewInt32(m_context, l.size())); for (int i = 0; i < l.size(); ++i) JS_SetPropertyUint32(m_context, array, i, asJsValue(l.at(i))); return array; } JSValue ScriptEngine::asJsValue(const QVariantMap &m, quintptr id, bool frozen) { const auto it = id ? m_jsValueCache.constFind(id) : m_jsValueCache.constEnd(); if (it != m_jsValueCache.constEnd()) return JS_DupValue(m_context, it.value()); frozen = id || frozen; JSValue obj = JS_NewObject(m_context); for (auto it = m.begin(); it != m.end(); ++it) setJsProperty(m_context, obj, it.key(), asJsValue(it.value(), 0, frozen)); if (frozen) JS_FreezeObject(m_context, obj); if (!id) return obj; m_jsValueCache[id] = obj; return JS_DupValue(m_context, obj); } void ScriptEngine::setPropertyOnGlobalObject(const QString &property, JSValue value) { const ScopedJsValue globalObject(m_context, JS_GetGlobalObject(m_context)); setJsProperty(m_context, globalObject, property, value); } JSValue ScriptEngine::asJsValue(const QVariantList &l, quintptr id, bool frozen) { const auto it = id ? m_jsValueCache.constFind(id) : m_jsValueCache.constEnd(); if (it != m_jsValueCache.constEnd()) return JS_DupValue(m_context, it.value()); frozen = id || frozen; JSValue array = JS_NewArray(m_context); setJsProperty(m_context, array, std::string_view("length"), JS_NewInt32(m_context, l.size())); for (int i = 0; i < l.size(); ++i) JS_SetPropertyUint32(m_context, array, i, asJsValue(l.at(i), 0, frozen)); if (frozen) JS_FreezeObject(m_context, array); if (!id) return array; m_jsValueCache[id] = array; return JS_DupValue(m_context, array); } JSValue ScriptEngine::loadInternalExtension(const QString &uri) { const QString name = uri.mid(4); // remove the "qbs." part const auto cached = m_internalExtensions.constFind(name); if (cached != m_internalExtensions.constEnd()) return cached.value(); JSValue extensionObj = JsExtensions::loadExtension(this, name); if (!JS_IsObject(extensionObj)) return throwError(Tr::tr("loadExtension: cannot load extension '%1'.").arg(uri)); m_internalExtensions.insert(name, extensionObj); return extensionObj; } JSValue ScriptEngine::js_require(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int, JSValue *func_data) { Q_UNUSED(this_val) ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); QBS_ASSERT(engine, return JS_EXCEPTION); if (argc < 1) return engine->throwError(Tr::tr("The require function requires a module name or path.")); const QString moduleName = getJsString(ctx, argv[0]); // First try to load a named module if the argument doesn't look like a file path if (!moduleName.contains(QLatin1Char('/'))) { if (engine->m_extensionSearchPathsStack.empty()) return engine->throwError(Tr::tr("require: internal error. No search paths.")); if (engine->m_logger.debugEnabled()) { engine->m_logger.qbsDebug() << "[require] loading extension " << moduleName; } QString moduleNameAsPath = moduleName; moduleNameAsPath.replace(QLatin1Char('.'), QLatin1Char('/')); const QStringList searchPaths = engine->m_extensionSearchPathsStack.top(); const QString dirPath = findExtensionDir(searchPaths, moduleNameAsPath); if (dirPath.isEmpty()) { if (moduleName.startsWith(QStringLiteral("qbs."))) return JS_DupValue(ctx, engine->loadInternalExtension(moduleName)); } else { QDirIterator dit(dirPath, StringConstants::jsFileWildcards(), QDir::Files | QDir::Readable); JSValueList values; std::vector filePaths; try { while (dit.hasNext()) { const QString filePath = dit.next(); if (engine->m_logger.debugEnabled()) { engine->m_logger.qbsDebug() << "[require] importing file " << filePath; } ScopedJsValue obj(engine->context(), engine->newObject()); engine->importFile(filePath, obj); values << obj.release(); filePaths.push_back(filePath); } } catch (const ErrorInfo &e) { return engine->throwError(e.toString()); } if (!values.empty()) { const JSValue mergedValue = engine->mergeExtensionObjects(values); engine->m_requireResults.push_back(mergedValue); engine->m_filePathsPerImport[jsObjectId(mergedValue)] = filePaths; return mergedValue; } } // The module name might be a file name component, which is assumed to be to a JavaScript // file located in the current directory search path; try that next } if (engine->m_currentDirPathStack.empty()) return engine->throwError(Tr::tr("require: internal error. No current directory.")); JSValue result; try { const QString filePath = FileInfo::resolvePath(engine->m_currentDirPathStack.top(), moduleName); static const QString scopeNamePrefix = QStringLiteral("_qbs_scope_"); const QString scopeName = scopeNamePrefix + QString::number(qHash(filePath), 16); result = getJsProperty(ctx, func_data[0], scopeName); if (JS_IsObject(result)) return result; // Same JS file imported from same qbs file via different JS files (e.g. codesign.js from DarwinGCC.qbs via gcc.js and darwin.js). ScopedJsValue scopedResult(engine->context(), engine->newObject()); engine->importFile(filePath, scopedResult); result = scopedResult.release(); setJsProperty(ctx, result, StringConstants::importScopeNamePropertyInternal(), scopeName); setJsProperty(ctx, func_data[0], scopeName, result); engine->m_requireResults.push_back(result); engine->m_filePathsPerImport[jsObjectId(JS_DupValue(ctx, result))] = { filePath }; } catch (const ErrorInfo &e) { result = engine->throwError(e.toString()); } return result; } JSClassID ScriptEngine::modulePropertyScriptClass() const { return m_modulePropertyScriptClass; } void ScriptEngine::setModulePropertyScriptClass(JSClassID modulePropertyScriptClass) { m_modulePropertyScriptClass = modulePropertyScriptClass; } template JSValue getScriptValue(JSContext *ctx, const T *t, const std::unordered_map &map) { const auto it = map.find(t); return it == map.end() ? JS_UNDEFINED : JS_DupValue(ctx, it->second); } template void setScriptValue(JSContext *ctx, const T *t, JSValue value, std::unordered_map &map) { value = JS_DupValue(ctx, value); const auto it = map.find(t); if (it == map.end()) { map.insert(std::make_pair(t, value)); return; } JS_FreeValue(ctx, it->second); it->second = value; } JSValue ScriptEngine::artifactsMapScriptValue(const ResolvedProduct *product) { return getScriptValue(m_context, product, m_productArtifactsMapScriptValues); } void ScriptEngine::setArtifactsMapScriptValue(const ResolvedProduct *product, JSValue value) { setScriptValue(m_context, product, value, m_productArtifactsMapScriptValues); } JSValue ScriptEngine::artifactsMapScriptValue(const ResolvedModule *module) { return getScriptValue(m_context, module, m_moduleArtifactsMapScriptValues); } void ScriptEngine::setArtifactsMapScriptValue(const ResolvedModule *module, JSValue value) { setScriptValue(m_context, module, value, m_moduleArtifactsMapScriptValues); } JSValue ScriptEngine::getArtifactProperty(JSValue obj, const std::function &propGetter) { auto guard = m_artifactsScriptValues.lock(); const Artifact * const a = attachedPointer(obj, dataWithPtrClass()); return a ? propGetter(a) : JS_EXCEPTION; } void ScriptEngine::addCanonicalFilePathResult(const QString &filePath, const QString &resultFilePath) { if (gatherFileResults()) m_canonicalFilePathResult.insert(filePath, resultFilePath); } void ScriptEngine::addFileExistsResult(const QString &filePath, bool exists) { if (gatherFileResults()) m_fileExistsResult.insert(filePath, exists); } void ScriptEngine::addDirectoryEntriesResult(const QString &path, QDir::Filters filters, const QStringList &entries) { if (gatherFileResults()) { m_directoryEntriesResult.insert( std::pair(path, static_cast(filters)), entries); } } void ScriptEngine::addFileLastModifiedResult(const QString &filePath, const FileTime &fileTime) { if (gatherFileResults()) m_fileLastModifiedResult.insert(filePath, fileTime); } Set ScriptEngine::imports() const { Set filePaths; for (auto it = m_jsImportCache.cbegin(); it != m_jsImportCache.cend(); ++it) { const JsImport &jsImport = it.key(); for (const QString &filePath : jsImport.filePaths) filePaths << filePath; } for (const auto &kv : m_filePathsPerImport) { for (const QString &fp : kv.second) filePaths << fp; } return filePaths; } JSValue ScriptEngine::newObject() const { return JS_NewObject(m_context); } JSValue ScriptEngine::newArray(int length, JsValueOwner owner) { JSValue arr = JS_NewArray(m_context); JS_SetPropertyStr(m_context, arr, "length", JS_NewInt32(m_context, length)); if (owner == JsValueOwner::ScriptEngine) ++m_evalResults[arr]; return arr; } JSValue ScriptEngine::evaluate( JsValueOwner resultOwner, const QString &code, const QString &filePath, int line, qbs::Internal::span scopeChain) { m_scopeChains.emplace_back(scopeChain); const QByteArray &codeStr = code.toUtf8(); const QByteArray &filePathStr = filePath.toUtf8(); m_evalPositions.emplace(filePath, line); JSEvalOptions evalOptions{1, JS_EVAL_TYPE_GLOBAL, filePathStr.constData(), line}; const JSValue v = JS_EvalThis2( m_context, globalObject(), codeStr.constData(), codeStr.length(), &evalOptions); m_evalPositions.pop(); m_scopeChains.pop_back(); if (resultOwner == JsValueOwner::ScriptEngine && JS_VALUE_HAS_REF_COUNT(v)) ++m_evalResults[v]; return v; } void ScriptEngine::handleJsProperties(JSValue obj, const PropertyHandler &handler) { qbs::Internal::handleJsProperties(m_context, obj, handler); } ScopedJsValueList ScriptEngine::argumentList(const QStringList &argumentNames, const JSValue &context) const { JSValueList result; for (const auto &name : argumentNames) result.push_back(getJsProperty(m_context, context, name)); return {m_context, result}; } JSClassID ScriptEngine::registerClass(const char *name, JSClassCall *constructor, JSClassFinalizer *finalizer, JSValue scope, GetPropertyNames getPropertyNames, GetProperty getProperty) { JSClassID id = 0; const auto classIt = m_classes.constFind(QLatin1String(name)); if (classIt == m_classes.constEnd()) { JS_NewClassID(m_jsRuntime, &id); const auto it = getProperty ? m_exoticMethods.insert(id, JSClassExoticMethods{getProperty, getPropertyNames}) : m_exoticMethods.end(); JSClassDef jsClass{name, finalizer, nullptr, constructor, it != m_exoticMethods.end() ? &it.value() : nullptr}; const int status = JS_NewClass(m_jsRuntime, id, &jsClass); QBS_ASSERT(status == 0, return 0); m_classes.insert(QLatin1String(name), id); } else { id = classIt.value(); } if (!JS_IsUndefined(scope)) { const JSValue classObj = JS_NewObjectClass(m_context, id); JS_SetConstructorBit(m_context, classObj, constructor != nullptr); JS_SetPropertyStr(m_context, scope, name, classObj); } return id; } JSClassID ScriptEngine::getClassId(const char *name) const { return m_classes.value(QLatin1String(name)); } bool ScriptEngine::checkForJsError(const CodeLocation ¤tLocation) { if (m_jsError.hasError()) { m_jsError.addOrPrependLocation(currentLocation); return true; } if (const JsException ex = checkAndClearException(currentLocation)) { m_jsError = ex.toErrorInfo(); return true; } return false; } ErrorInfo ScriptEngine::getAndClearJsError() { const ErrorInfo e = m_jsError; QBS_CHECK(e.hasError()); m_jsError.clear(); return e; } void ScriptEngine::throwOnJsError(const CodeLocation &fallbackLocation) { if (checkForJsError(fallbackLocation)) throwAndClearJsError(); } JSValue ScriptEngine::throwError(const QString &message) const { return qbs::Internal::throwError(m_context, message); } void ScriptEngine::cancel() { m_canceling = true; } int ScriptEngine::interruptor(JSRuntime *, void *opaqueEngine) { const auto engine = reinterpret_cast(opaqueEngine); if (engine->m_canceling) { engine->m_canceling = false; return 1; } return 0; } bool ScriptEngine::gatherFileResults() const { return evalContext() == EvalContext::PropertyEvaluation || evalContext() == EvalContext::ProbeExecution; } void ScriptEngine::setMaxStackSize() { size_t stackSize = 0; // Turn check off by default. bool ok; const int stackSizeFromEnv = qEnvironmentVariableIntValue("QBS_MAX_JS_STACK_SIZE", &ok); if (ok && stackSizeFromEnv >= 0) stackSize = stackSizeFromEnv; JS_SetMaxStackSize(m_jsRuntime, stackSize); } JSValue ScriptEngine::getArtifactScriptValue(Artifact *a, const QString &moduleName, const std::function &setup) { auto guard = m_artifactsScriptValues.lock(); auto &scriptValues = guard.get(); const auto it = scriptValues.constFind(qMakePair(a, moduleName)); if (it != scriptValues.constEnd()) return JS_DupValue(m_context, *it); a->setDeregister([this](const Artifact *a) { auto guard = m_artifactsScriptValues.lock(); auto &scriptValues = guard.get(); for (auto it = scriptValues.begin(); it != scriptValues.end();) { if (it.key().first == a) { JS_SetOpaque(it.value(), nullptr); JS_FreeValue(m_context, it.value()); it = scriptValues.erase(it); } else { ++it; } } }); JSValue obj = JS_NewObjectClass(context(), dataWithPtrClass()); attachPointerTo(obj, a); setup(obj); scriptValues.insert(qMakePair(a, moduleName), JS_DupValue(m_context, obj)); return obj; } void ScriptEngine::releaseInputArtifactScriptValues(const RuleNode *ruleNode) { auto guard = m_artifactsScriptValues.lock(); auto &scriptValues = guard.get(); for (auto it = scriptValues.begin(); it != scriptValues.end();) { Artifact * const a = it.key().first; if (ruleNode->children.contains(a)) { a->setDeregister({}); JS_FreeValue(m_context, it.value()); it = scriptValues.erase(it); } else { ++it; } } } class JSTypeExtender { public: JSTypeExtender(ScriptEngine *engine, const QString &typeName) : m_engine(engine) { const ScopedJsValue globalObject(engine->context(), JS_GetGlobalObject(engine->context())); const ScopedJsValue type(engine->context(), getJsProperty(engine->context(), globalObject, typeName)); m_proto = getJsProperty(engine->context(), type, QStringLiteral("prototype")); QBS_ASSERT(JS_IsObject(m_proto), return); } ~JSTypeExtender() { JS_FreeValue(m_engine->context(), m_proto); } void addFunction(const QString &name, const QString &code) { const JSValue f = m_engine->evaluate(JsValueOwner::Caller, code); QBS_ASSERT(JS_IsFunction(m_engine->context(), f), return); JS_DefinePropertyValueStr(m_engine->context(), m_proto, name.toUtf8().constData(), f, 0); } private: ScriptEngine * const m_engine; JSValue m_proto = JS_UNDEFINED; }; static JSValue js_consoleFunc(JSContext *ctx, JSValueConst, int argc, JSValueConst *argv, int level) { ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); QBS_ASSERT(engine, return JS_EXCEPTION); if (Q_UNLIKELY(argc != 1)) return engine->throwError(Tr::tr("The console functions expect 1 argument.")); engine->logger().qbsLog(static_cast(level)) << getJsString(ctx, argv[0]); return engine->undefinedValue(); } void ScriptEngine::installQbsBuiltins() { const JSValue consoleObj = newObject(); setPropertyOnGlobalObject(QLatin1String("console"), consoleObj); installConsoleFunction(consoleObj, QStringLiteral("debug"), LoggerDebug); installConsoleFunction(consoleObj, QStringLiteral("error"), LoggerError); installConsoleFunction(consoleObj, QStringLiteral("info"), LoggerInfo); installConsoleFunction(consoleObj, QStringLiteral("log"), LoggerDebug); installConsoleFunction(consoleObj, QStringLiteral("warn"), LoggerWarning); } void ScriptEngine::extendJavaScriptBuiltins() { JSTypeExtender arrayExtender(this, QStringLiteral("Array")); arrayExtender.addFunction(QStringLiteral("contains"), QStringLiteral("(function(e){return this.indexOf(e) !== -1;})")); arrayExtender.addFunction(QStringLiteral("containsAll"), QStringLiteral("(function(e){var $this = this;" "return e.every(function (v) { return $this.contains(v) });})")); arrayExtender.addFunction(QStringLiteral("containsAny"), QStringLiteral("(function(e){var $this = this;" "return e.some(function (v) { return $this.contains(v) });})")); arrayExtender.addFunction(QStringLiteral("uniqueConcat"), QStringLiteral("(function(other){" "var r = this.concat();" "var s = {};" "r.forEach(function(x){ s[x] = true; });" "other.forEach(function(x){" "if (!s[x]) {" "s[x] = true;" "r.push(x);" "}" "});" "return r;})")); JSTypeExtender stringExtender(this, QStringLiteral("String")); stringExtender.addFunction(QStringLiteral("contains"), QStringLiteral("(function(e){return this.indexOf(e) !== -1;})")); } void ScriptEngine::installConsoleFunction(JSValue consoleObj, const QString &name, LoggerLevel level) { JS_SetPropertyStr(m_context, consoleObj, name.toUtf8().constData(), JS_NewCFunctionMagic(m_context, js_consoleFunc, name.toUtf8().constData(), 1, JS_CFUNC_generic_magic, level)); } static QString requireString() { return QStringLiteral("require"); } void ScriptEngine::installImportFunctions(JSValue importScope) { const JSValue require = JS_NewCFunctionData(m_context, js_require, 1, 0, 1, &importScope); setPropertyOnGlobalObject(requireString(), require); } void ScriptEngine::uninstallImportFunctions() { setPropertyOnGlobalObject(requireString(), JS_UNDEFINED); } ScriptEngine::PropertyCacheKey::PropertyCacheKey(QString moduleName, QString propertyName, PropertyMapConstPtr propertyMap) : m_moduleName(std::move(moduleName)) , m_propertyName(std::move(propertyName)) , m_propertyMap(std::move(propertyMap)) { } JsException ScriptEngine::checkAndClearException(const CodeLocation &fallbackLocation) const { return {m_context, JS_GetException(m_context), JS_GetBacktrace(m_context), fallbackLocation}; } void ScriptEngine::clearRequestedProperties() { m_propertiesRequestedInScript.clear(); m_propertiesRequestedFromArtifact.clear(); m_importsRequestedInScript.clear(); m_productsWithRequestedDependencies.clear(); m_requestedArtifacts.clear(); m_requestedExports.clear(); }; void ScriptEngine::takeOwnership(JSValue v) { ++m_evalResults[v]; } ScriptEngine::Importer::Importer( ScriptEngine &engine, const FileContextBaseConstPtr &fileCtx, JSValue &targetObject, ObserveMode observeMode) : m_engine(engine), m_fileCtx(fileCtx), m_targetObject(targetObject) { m_engine.installImportFunctions(targetObject); m_engine.m_currentDirPathStack.push(FileInfo::path(fileCtx->filePath())); m_engine.m_extensionSearchPathsStack.push(fileCtx->searchPaths()); m_engine.m_observeMode = observeMode; } ScriptEngine::Importer::~Importer() { m_engine.m_requireResults.clear(); m_engine.m_currentDirPathStack.pop(); m_engine.m_extensionSearchPathsStack.pop(); m_engine.uninstallImportFunctions(); } void ScriptEngine::Importer::run() { for (const JsImport &jsImport : m_fileCtx->jsImports()) m_engine.import(jsImport, m_targetObject); if (m_engine.m_observeMode == ObserveMode::Enabled) { for (JSValue &sv : m_engine.m_requireResults) m_engine.observeImport(sv); } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/itemdeclaration.cpp0000644000175100017510000000521115154533055023110 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "itemdeclaration.h" namespace qbs { namespace Internal { ItemDeclaration::ItemDeclaration(ItemType type) : m_type(type) { } ItemDeclaration &ItemDeclaration::operator<<(const PropertyDeclaration &decl) { m_properties.push_back(decl); return *this; } bool ItemDeclaration::isChildTypeAllowed(ItemType type) const { if (m_type > ItemType::LastActualItem || type > ItemType::LastActualItem) return true; return m_allowedChildTypes.contains(type); } ErrorInfo ItemDeclaration::checkForDeprecation(DeprecationWarningMode mode, const QString &name, const CodeLocation &loc, Logger &logger) const { return deprecationInfo().checkForDeprecation(mode, name, loc, true, logger); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/asttools.h0000644000175100017510000000461515154533055021270 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ASTTOOLS_H #define QBS_ASTTOOLS_H #include #include #include namespace qbs { namespace Internal { QStringList toStringList(QbsQmlJS::AST::UiQualifiedId *qid); CodeLocation toCodeLocation(const QString &filePath, const QbsQmlJS::AST::SourceLocation &location); QString textOf(const QString &source, QbsQmlJS::AST::Node *node); QStringView textViewOf(const QString &source, QbsQmlJS::AST::Node *node); } // namespace Internal } // namespace qbs #endif // QBS_ASTTOOLS_H qbs-src-3.2.0/src/lib/corelib/language/item.cpp0000644000175100017510000004577615154533055020726 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "item.h" #include "builtindeclarations.h" #include "filecontext.h" #include "itemobserver.h" #include "itempool.h" #include "value.h" #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { Item *Item::create(ItemPool *pool, ItemType type) { return pool->allocateItem(type); } Item *Item::clone(ItemPool &pool) const { assertModuleLocked(); Item *dup = create(&pool, type()); dup->m_id = m_id; dup->m_location = m_location; dup->m_endPosition = m_endPosition; dup->m_prototype = m_prototype; dup->m_scope = m_scope; dup->m_outerItem = m_outerItem; dup->m_parent = m_parent; dup->m_file = m_file; dup->m_propertyDeclarations = m_propertyDeclarations; dup->m_modules = m_modules; dup->m_children.reserve(m_children.size()); for (const Item * const child : std::as_const(m_children)) { Item *clonedChild = child->clone(pool); clonedChild->m_parent = dup; dup->m_children.push_back(clonedChild); } for (PropertyMap::const_iterator it = m_properties.constBegin(); it != m_properties.constEnd(); ++it) { dup->m_properties.insert(it.key(), it.value()->clone(pool)); } adaptScopesOfClonedAlternatives(dup); return dup; } Item *Item::rootPrototype() { Item *proto = this; while (proto->prototype()) proto = proto->prototype(); return proto; } QString Item::typeName() const { switch (type()) { case ItemType::IdScope: return QStringLiteral("[IdScope]"); case ItemType::ModuleInstance: return QStringLiteral("[ModuleInstance]"); case ItemType::ModuleInstancePlaceholder: return QStringLiteral("[ModuleInstancePlaceholder]"); case ItemType::ModuleParameters: return QStringLiteral("[ModuleParametersInstance]"); case ItemType::ModulePrefix: return QStringLiteral("[ModulePrefix]"); case ItemType::Outer: return QStringLiteral("[Outer]"); case ItemType::Scope: return QStringLiteral("[Scope]"); default: return BuiltinDeclarations::instance().nameForType(type()); } } bool Item::hasProperty(const QString &name) const { assertModuleLocked(); const Item *item = this; do { if (item->m_properties.contains(name)) return true; item = item->m_prototype; } while (item); return false; } bool Item::hasOwnProperty(const QString &name) const { assertModuleLocked(); return m_properties.contains(name); } ValuePtr Item::property(const QString &name) const { assertModuleLocked(); ValuePtr value; const Item *item = this; do { value = item->m_properties.value(name); if (value) break; item = item->m_prototype; } while (item); return value; } ValuePtr Item::ownProperty(const QString &name) const { assertModuleLocked(); return m_properties.value(name); } ItemValuePtr Item::itemProperty(const QString &name, ItemPool &pool, const Item *itemTemplate) { return itemProperty(name, itemTemplate, ItemValueConstPtr(), pool); } ItemValuePtr Item::itemProperty(const QString &name, const ItemValueConstPtr &value, ItemPool &pool) { return itemProperty(name, value->item(), value, pool); } ItemValuePtr Item::itemProperty(const QString &name, const Item *itemTemplate, const ItemValueConstPtr &itemValue, ItemPool &pool) { const ValuePtr v = property(name); if (v && v->type() == Value::ItemValueType) return std::static_pointer_cast(v); if (!itemTemplate) return {}; const bool createdByPropertiesBlock = itemValue && itemValue->createdByPropertiesBlock(); ItemValuePtr result = ItemValue::create(Item::create(&pool, itemTemplate->type()), createdByPropertiesBlock); setProperty(name, result); return result; } // Such scopes were potentially set up in PropertiesBlockConverter. void Item::adaptScopesOfClonedAlternatives(Item *clone) const { if (m_type != ItemType::Module && m_type != ItemType::Product) return; std::unordered_map> valuesPerGroupScope; const std::function collectScopedValues = [&](const PropertyMap &props) { for (const auto &prop : props) { switch (prop->type()) { case Value::VariantValueType: break; case Value::ItemValueType: collectScopedValues(static_cast(prop.get())->item()->properties()); break; case Value::JSSourceValueType: for (const JSSourceValue::Alternative &alt : static_cast(prop.get())->alternatives()) { if (alt.value->scope() && alt.value->scope()->type() == ItemType::Group) valuesPerGroupScope[alt.value->scope()].push_back(alt.value.get()); } break; } } }; const std::function getClonedGroup = [&](Item *group, const Item *parent, const Item *clonedParent) -> Item * { for (int i = 0; i < int(parent->m_children.size()); ++i) { Item * const child = parent->m_children.at(i); Item * const clonedChild = clonedParent->m_children.at(i); QBS_CHECK(child->type() == clonedChild->type()); if (child == group) return clonedChild; if (child->type() == ItemType::Group) { if (Item * const clonedGroup = getClonedGroup(group, child, clonedChild)) return clonedGroup; } } return nullptr; }; collectScopedValues(clone->m_properties); for (const auto &[group, values] : valuesPerGroupScope) { Item * const clonedGroup = getClonedGroup(group, this, clone); QBS_CHECK(clonedGroup); for (JSSourceValue * const v : values) { QBS_CHECK(v->scope() == group); v->setScope(clonedGroup, {}); } } } JSSourceValuePtr Item::sourceProperty(const QString &name) const { ValuePtr v = property(name); if (!v || v->type() != Value::JSSourceValueType) return {}; return std::static_pointer_cast(v); } VariantValuePtr Item::variantProperty(const QString &name) const { ValuePtr v = property(name); if (!v || v->type() != Value::VariantValueType) return {}; return std::static_pointer_cast(v); } bool Item::isOfTypeOrhasParentOfType(ItemType type) const { const Item *item = this; do { if (item->type() == type) return true; item = item->parent(); } while (item); return false; } void Item::addObserver(ItemObserver *observer) const { // Cached Module properties never change. if (m_type == ItemType::Module) return; std::lock_guard lock(m_observersMutex); if (!qEnvironmentVariableIsEmpty("QBS_SANITY_CHECKS")) QBS_CHECK(!contains(m_observers, observer)); m_observers << observer; } void Item::removeObserver(ItemObserver *observer) const { if (m_type == ItemType::Module) return; std::lock_guard lock(m_observersMutex); const auto it = std::find(m_observers.begin(), m_observers.end(), observer); QBS_CHECK(it != m_observers.end()); m_observers.erase(it); } PropertyDeclaration Item::propertyDeclaration(const QString &name, bool allowExpired) const { auto it = m_propertyDeclarations.find(name); if (it != m_propertyDeclarations.end()) return it.value(); if (allowExpired) { it = m_expiredPropertyDeclarations.find(name); if (it != m_expiredPropertyDeclarations.end()) return it.value(); } return m_prototype ? m_prototype->propertyDeclaration(name) : PropertyDeclaration(); } void Item::addModule(const Item::Module &module) { if (!qEnvironmentVariableIsEmpty("QBS_SANITY_CHECKS")) { QBS_CHECK(none_of(m_modules, [&](const Module &m) { if (m.name != module.name) return false; if (!!module.product != !!m.product) return true; if (!module.product) return true; if (module.product->multiplexConfigurationId == m.product->multiplexConfigurationId && module.product->profileName == m.product->profileName) { return true; } return false; })); } m_modules.push_back(module); } void Item::setProperty(const QString &name, const ValuePtr &value) { assertModuleLocked(); m_properties.insert(name, value); std::lock_guard lock(m_observersMutex); for (ItemObserver * const observer : m_observers) observer->onItemPropertyChanged(this); } void Item::dump() const { dump(0); } bool Item::isPresentModule() const { // Initial value is "true" as JS source, overwritten one is always QVariant(false). const ValueConstPtr v = property(StringConstants::presentProperty()); return v && v->type() == Value::JSSourceValueType; } void Item::setupForBuiltinType(DeprecationWarningMode deprecationMode, Logger &logger) { assertModuleLocked(); const BuiltinDeclarations &builtins = BuiltinDeclarations::instance(); const auto properties = builtins.declarationsForType(type()).properties(); for (const PropertyDeclaration &pd : properties) { m_propertyDeclarations.insert(pd.name(), pd); const ValuePtr value = m_properties.value(pd.name()); if (!value) { if (pd.isDeprecated()) continue; JSSourceValuePtr sourceValue = JSSourceValue::create(); sourceValue->setIsBuiltinDefaultValue(); sourceValue->setFile(file()); sourceValue->setSourceCode(pd.initialValueSource().isEmpty() ? StringConstants::undefinedValue() : pd.initialValueSource()); m_properties.insert(pd.name(), sourceValue); } else if (ErrorInfo error = pd.checkForDeprecation(deprecationMode, value->location(), logger); error.hasError()) { throw error; } } } void Item::copyProperty(const QString &propertyName, Item *target) const { target->setProperty(propertyName, property(propertyName)); } void Item::overrideProperties( const QVariantMap &config, const QString &key, const SetupProjectParameters ¶meters, Logger &logger, bool ignoreNonExisting) { const QVariant configMap = config.value(key); if (configMap.isNull()) return; overrideProperties(configMap.toMap(), QualifiedId(key), parameters, logger, ignoreNonExisting); } static const char *valueType(const Value *v) { switch (v->type()) { case Value::JSSourceValueType: return "JS source"; case Value::ItemValueType: return "Item"; case Value::VariantValueType: return "Variant"; } return ""; // For dumb compilers. } void Item::dump(int indentation) const { const QByteArray indent(indentation, ' '); qDebug("%stype: %s, pointer value: %p", indent.constData(), qPrintable(typeName()), this); if (!m_properties.empty()) qDebug("%sproperties:", indent.constData()); for (auto it = m_properties.constBegin(); it != m_properties.constEnd(); ++it) { const QByteArray nextIndent(indentation + 4, ' '); qDebug("%skey: %s, value type: %s", nextIndent.constData(), qPrintable(it.key()), valueType(it.value().get())); switch (it.value()->type()) { case Value::JSSourceValueType: qDebug("%svalue: %s", nextIndent.constData(), qPrintable(std::static_pointer_cast(it.value())->sourceCodeForEvaluation())); break; case Value::ItemValueType: qDebug("%svalue:", nextIndent.constData()); std::static_pointer_cast(it.value())->item()->dump(indentation + 8); break; case Value::VariantValueType: qDebug("%svalue: %s", nextIndent.constData(), qPrintable(std::static_pointer_cast(it.value())->value().toString())); break; } } if (!m_children.empty()) qDebug("%schildren:", indent.constData()); for (const Item * const child : std::as_const(m_children)) child->dump(indentation + 4); if (prototype()) { qDebug("%sprototype:", indent.constData()); prototype()->dump(indentation + 4); } } void Item::lockModule() const { QBS_CHECK(m_type == ItemType::Module); m_moduleMutex.lock(); #ifndef NDEBUG QBS_CHECK(!m_moduleLocked); m_moduleLocked = true; #endif } void Item::unlockModule() const { QBS_CHECK(m_type == ItemType::Module); #ifndef NDEBUG QBS_CHECK(m_moduleLocked); m_moduleLocked = false; #endif m_moduleMutex.unlock(); } // This safeguard verifies that all contexts which access Module properties have really // acquired the lock via ModuleItemLocker, as they must. void Item::assertModuleLocked() const { #ifndef NDEBUG if (m_type == ItemType::Module) QBS_CHECK(m_moduleLocked); #endif } void Item::removeProperty(const QString &name) { assertModuleLocked(); m_properties.remove(name); } Item *Item::child(ItemType type, bool checkForMultiple) const { Item *child = nullptr; for (Item * const currentChild : children()) { if (currentChild->type() == type) { if (!checkForMultiple) return currentChild; if (child) { ErrorInfo error(Tr::tr("Multiple instances of item '%1' found where at most one " "is allowed.") .arg(BuiltinDeclarations::instance().nameForType(type))); error.append(Tr::tr("First item"), child->location()); error.append(Tr::tr("Second item"), currentChild->location()); throw error; } child = currentChild; } } return child; } void Item::addChild(Item *parent, Item *child) { parent->m_children.push_back(child); child->setParent(parent); } void Item::removeChild(Item *parent, Item *child) { parent->m_children.removeOne(child); child->setParent(nullptr); } void Item::setPropertyDeclaration(const QString &name, const PropertyDeclaration &declaration) { if (declaration.isExpired()) { m_propertyDeclarations.remove(name); m_expiredPropertyDeclarations.insert(name, declaration); } else { m_propertyDeclarations.insert(name, declaration); } } void Item::setPropertyDeclarations(const Item::PropertyDeclarationMap &decls) { m_propertyDeclarations = decls; } void Item::overrideProperties( const QVariantMap &overridden, const QualifiedId &namePrefix, const SetupProjectParameters ¶meters, Logger &logger, bool ignoreNonExisting) { if (overridden.isEmpty()) return; for (QVariantMap::const_iterator it = overridden.constBegin(); it != overridden.constEnd(); ++it) { const PropertyDeclaration decl = propertyDeclaration(it.key()); if (!decl.isValid()) { if (!ignoreNonExisting) { ErrorInfo error( Tr::tr("Unknown property: %1.%2").arg(namePrefix.toString(), it.key())); handlePropertyError(error, parameters, logger); } continue; } const auto overridenValue = VariantValue::create(PropertyDeclaration::convertToPropertyType( it.value(), decl.type(), namePrefix, it.key())); overridenValue->markAsSetByCommandLine(); setProperty(it.key(), overridenValue); } } void Item::setModules(const Modules &modules) { m_modules = modules; } Item *createNonPresentModule(ItemPool &pool, const QString &name, const QString &reason, Item *module) { qCDebug(lcModuleLoader) << "Non-required module '" << name << "' not loaded (" << reason << ")." << "Creating dummy module for presence check."; if (!module) { module = Item::create(&pool, ItemType::ModuleInstance); module->setFile(FileContext::create()); module->setProperty(StringConstants::nameProperty(), VariantValue::create(name)); } module->setType(ItemType::ModuleInstance); module->setProperty(StringConstants::presentProperty(), VariantValue::falseValue()); return module; } void setScopeForDescendants(Item *item, Item *scope, bool insertIds) { for (Item * const child : item->children()) { child->setScope(scope); if (insertIds && !child->id().isEmpty()) scope->setProperty(child->id(), ItemValue::create(child)); setScopeForDescendants(child, scope, insertIds); } } CodeRange Item::codeRange() const { return {{m_location.line(), m_location.column()}, m_endPosition}; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/scriptengine.h0000644000175100017510000004506015154533055022111 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SCRIPTENGINE_H #define QBS_SCRIPTENGINE_H #include "forward_decls.h" #include "property.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { class Version; namespace Internal { class Artifact; class Evaluator; class JsImport; class PrepareScriptObserver; class RuleNode; class ScriptImporter; class ScriptPropertyObserver; enum class EvalContext { PropertyEvaluation, ProbeExecution, ModuleProvider, RuleExecution, JsCommand }; class DubiousContext { public: enum Suggestion { NoSuggestion, SuggestMoving }; DubiousContext(EvalContext c, Suggestion s = NoSuggestion) : context(c), suggestion(s) { } EvalContext context; Suggestion suggestion; }; using DubiousContextList = std::vector; enum class JsValueOwner { Caller, ScriptEngine }; // TODO: This smells like cheating. Should always be Caller. enum class ObserveMode { Enabled, Disabled }; class QBS_AUTOTEST_EXPORT ScriptEngine { struct PrivateTag {}; public: ScriptEngine(Logger &logger, EvalContext evalContext, PrivateTag); ~ScriptEngine(); static std::unique_ptr create(Logger &logger, EvalContext evalContext); static ScriptEngine *engineForRuntime(const JSRuntime *runtime); static ScriptEngine *engineForContext(const JSContext *ctx); static LookupResult doExtraScopeLookup(JSContext *ctx, JSAtom prop); void reset(); Logger &logger() const { return m_logger; } void import(const FileContextBaseConstPtr &fileCtx, JSValue &targetObject, ObserveMode observeMode); void clearImportsCache(); void registerEvaluator(Evaluator *evaluator); void unregisterEvaluator(const Evaluator *evaluator); Evaluator *evaluator() const { return m_evaluator; } void setEvalContext(EvalContext c) { m_evalContext = c; } EvalContext evalContext() const { return m_evalContext; } void checkContext(const QString &operation, const DubiousContextList &dubiousContexts); void setSetupProjectParameters(const SetupProjectParameters ¶ms) { m_setupParams = params; } void handleDeprecation( const Version &removalVersion, const QString &message, const CodeLocation &loc); void addPropertyRequestedInScript(const Property &property) { m_propertiesRequestedInScript += property; } void addDependenciesArrayRequested(const ResolvedProduct *p) { m_productsWithRequestedDependencies.insert(p); } void setArtifactsMapRequested(const ResolvedProduct *product, bool forceUpdate) { m_requestedArtifacts.setAllArtifactTags(product, forceUpdate); } void setArtifactSetRequestedForTag(const ResolvedProduct *product, const FileTag &tag) { m_requestedArtifacts.setArtifactsForTag(product, tag); } void setNonExistingArtifactSetRequested(const ResolvedProduct *product, const QString &tag) { m_requestedArtifacts.setNonExistingTagRequested(product, tag); } void setArtifactsEnumerated(const ResolvedProduct *product) { m_requestedArtifacts.setArtifactsEnumerated(product); } void addPropertyRequestedFromArtifact(const Artifact *artifact, const Property &property); void addRequestedExport(const ResolvedProduct *product) { m_requestedExports.insert(product); } void clearRequestedProperties(); PropertySet propertiesRequestedInScript() const { return m_propertiesRequestedInScript; } QHash propertiesRequestedFromArtifact() const { return m_propertiesRequestedFromArtifact; } Set productsWithRequestedDependencies() const { return m_productsWithRequestedDependencies; } RequestedDependencies requestedDependencies() const { return RequestedDependencies(m_productsWithRequestedDependencies); } RequestedArtifacts requestedArtifacts() const { return m_requestedArtifacts; } Set requestedExports() const { return m_requestedExports; } void addImportRequestedInScript(quintptr importValueId); std::vector importedFilesUsedInScript() const; void addExternallyCachedValue(JSValue *v) { m_externallyCachedValues.push_back(v); } void setUsesIo() { m_usesIo = true; } void clearUsesIo() { m_usesIo = false; } bool usesIo() const { return m_usesIo; } void enableProfiling(bool enable); void setPropertyCacheEnabled(bool enable) { m_propertyCacheEnabled = enable; } bool isPropertyCacheEnabled() const { return m_propertyCacheEnabled; } void addToPropertyCache(const QString &moduleName, const QString &propertyName, const PropertyMapConstPtr &propertyMap, const QVariant &value); QVariant retrieveFromPropertyCache(const QString &moduleName, const QString &propertyName, const PropertyMapConstPtr &propertyMap); void setObservedProperty(JSValue &object, const QString &name, const JSValue &value); void unobserveProperties(); PrepareScriptObserver *observer() const { return m_observer.get(); } QProcessEnvironment environment() const; void setEnvironment(const QProcessEnvironment &env); void addCanonicalFilePathResult(const QString &filePath, const QString &resultFilePath); void addFileExistsResult(const QString &filePath, bool exists); void addDirectoryEntriesResult(const QString &path, QDir::Filters filters, const QStringList &entries); void addFileLastModifiedResult(const QString &filePath, const FileTime &fileTime); QHash canonicalFilePathResults() const { return m_canonicalFilePathResult; } QHash fileExistsResults() const { return m_fileExistsResult; } QHash, QStringList> directoryEntriesResults() const { return m_directoryEntriesResult; } QHash fileLastModifiedResults() const { return m_fileLastModifiedResult; } Set imports() const; JSValue newObject() const; JSValue newArray(int length, JsValueOwner owner); void takeOwnership(JSValue v); JSValue undefinedValue() const { return JS_UNDEFINED; } JSValue toScriptValue(const QVariant &v, quintptr id = 0) { return asJsValue(v, id); } JSValue evaluate( JsValueOwner resultOwner, const QString &code, const QString &filePath = QString(), int line = 1, qbs::Internal::span scopeChain = {}); void setLastLookupStatus(bool success) { m_lastLookupWasSuccess = success; } JSContext *context() const { return m_context; } JSValue globalObject() const { return m_globalObject; } void setGlobalObject(JSValue obj) { m_globalObject = obj; } void handleJsProperties(JSValueConst obj, const PropertyHandler &handler); ScopedJsValueList argumentList(const QStringList &argumentNames, const JSValue &context) const; using GetProperty = int (*)(JSContext *ctx, JSPropertyDescriptor *desc, JSValueConst obj, JSAtom prop); using GetPropertyNames = int (*)(JSContext *ctx, JSPropertyEnum **ptab, uint32_t *plen, JSValueConst obj); JSClassID registerClass(const char *name, JSClassCall *constructor, JSClassFinalizer *finalizer, JSValue scope, GetPropertyNames getPropertyNames = nullptr, GetProperty getProperty = nullptr); JSClassID getClassId(const char *name) const; bool checkForJsError(const CodeLocation ¤tLocation); ErrorInfo getAndClearJsError(); void throwAndClearJsError() { throw getAndClearJsError(); } void throwOnJsError(const CodeLocation &fallbackLocation); void setJsError(const ErrorInfo &jsError) { m_jsError = jsError; } JSValue throwError(const QString &message) const; void cancel(); // The active flag is different from QScriptEngine::isEvaluating. // It is set and cleared externally for example by the rule execution code. bool isActive() const { return m_active; } void setActive(bool on) { m_active = on; } JSClassID modulePropertyScriptClass() const; void setModulePropertyScriptClass(JSClassID modulePropertyScriptClass); JSClassID productPropertyScriptClass() const { return m_productPropertyScriptClass; } void setProductPropertyScriptClass(JSClassID productPropertyScriptClass) { m_productPropertyScriptClass = productPropertyScriptClass; } JSClassID artifactsScriptClass(int index) const { return m_artifactsScriptClass[index]; } void setArtifactsScriptClass(int index, JSClassID artifactsScriptClass) { m_artifactsScriptClass[index] = artifactsScriptClass; } JSValue artifactsMapScriptValue(const ResolvedProduct *product); void setArtifactsMapScriptValue(const ResolvedProduct *product, JSValue value); JSValue artifactsMapScriptValue(const ResolvedModule *module); void setArtifactsMapScriptValue(const ResolvedModule *module, JSValue value); JSValue getArtifactProperty(JSValue obj, const std::function &propGetter); JSValue& baseProductScriptValue(const ResolvedProduct *product) { return m_baseProductScriptValues[product]; } JSValue &projectScriptValue(const ResolvedProject *project) { return m_projectScriptValues[project]; } JSValue &baseModuleScriptValue(const ResolvedModule *module) { return m_baseModuleScriptValues[module]; } JSValue getArtifactScriptValue(Artifact *a, const QString &moduleName, const std::function &setup); void releaseInputArtifactScriptValues(const RuleNode *ruleNode); const JSValueList &contextStack() const { return m_contextStack; } JSClassID dataWithPtrClass() const { return m_dataWithPtrClass; } JSValue getInternalExtension(const char *name) const; void addInternalExtension(const char *name, JSValue ext); JSValue asJsValue(const QVariant &v, quintptr id = 0, bool frozen = false); JSValue asJsValue(const QByteArray &s); JSValue asJsValue(const QString &s); JSValue asJsValue(const QStringList &l); JSValue asJsValue(const QVariantList &l, quintptr id = 0, bool frozen = false); JSValue asJsValue(const QVariantMap &m, quintptr id = 0, bool frozen = false); QVariant property(const char *name) const { return m_properties.value(QLatin1String(name)); } void setProperty(const char *k, const QVariant &v) { m_properties.insert(QLatin1String(k), v); } private: class Importer { public: Importer(ScriptEngine &engine, const FileContextBaseConstPtr &fileCtx, JSValue &targetObject, ObserveMode observeMode); ~Importer(); void run(); private: ScriptEngine &m_engine; const FileContextBaseConstPtr &m_fileCtx; JSValue &m_targetObject; }; static int interruptor(JSRuntime *rt, void *opaqueEngine); JsException checkAndClearException(const CodeLocation &fallbackLocation) const; bool gatherFileResults() const; void setMaxStackSize(); void setPropertyOnGlobalObject(const QString &property, JSValue value); void installQbsBuiltins(); void extendJavaScriptBuiltins(); void installConsoleFunction(JSValue consoleObj, const QString &name, LoggerLevel level); void installImportFunctions(JSValue importScope); void uninstallImportFunctions(); void import(const JsImport &jsImport, JSValue &targetObject); void observeImport(JSValue &jsImport); void importFile(const QString &filePath, JSValue targetObject); static JSValue js_require(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int magic, JSValue *func_data); JSValue mergeExtensionObjects(const JSValueList &lst); JSValue loadInternalExtension(const QString &uri); static void handleUndefinedFound(JSContext *ctx); static void handleFunctionEntered(JSContext *ctx, JSValue this_obj); static void handleFunctionExited(JSContext *ctx); class PropertyCacheKey { public: PropertyCacheKey(QString moduleName, QString propertyName, PropertyMapConstPtr propertyMap); private: const QString m_moduleName; const QString m_propertyName; const PropertyMapConstPtr m_propertyMap; friend bool operator==(const PropertyCacheKey &lhs, const PropertyCacheKey &rhs); friend QHashValueType qHash(const ScriptEngine::PropertyCacheKey &k, QHashValueType seed); }; friend bool operator==(const PropertyCacheKey &lhs, const PropertyCacheKey &rhs); friend QHashValueType qHash(const ScriptEngine::PropertyCacheKey &k, QHashValueType seed); JSRuntime * const m_jsRuntime = JS_NewRuntime(); JSContext * const m_context = JS_NewContext(m_jsRuntime); JSValue m_globalObject = JS_NULL; ScriptImporter *m_scriptImporter; JSClassID m_modulePropertyScriptClass = 0; JSClassID m_productPropertyScriptClass = 0; JSClassID m_artifactsScriptClass[2] = {0, 0}; JSClassID m_dataWithPtrClass = 0; Evaluator *m_evaluator = nullptr; QHash m_jsImportCache; std::unordered_map m_jsFileCache; bool m_propertyCacheEnabled = true; bool m_active = false; std::atomic_bool m_canceling = false; QHash m_propertyCache; PropertySet m_propertiesRequestedInScript; QHash m_propertiesRequestedFromArtifact; Logger &m_logger; QProcessEnvironment m_environment; QHash m_canonicalFilePathResult; QHash m_fileExistsResult; QHash, QStringList> m_directoryEntriesResult; QHash m_fileLastModifiedResult; std::stack m_currentDirPathStack; std::stack m_extensionSearchPathsStack; std::stack> m_evalPositions; JSValue m_qbsObject = JS_UNDEFINED; qint64 m_elapsedTimeImporting = -1; bool m_usesIo = false; EvalContext m_evalContext; const std::unique_ptr m_observer; std::vector> m_observedProperties; JSValueList m_requireResults; std::unordered_map> m_filePathsPerImport; std::vector m_importsRequestedInScript; Set m_productsWithRequestedDependencies; RequestedArtifacts m_requestedArtifacts; Set m_requestedExports; ObserveMode m_observeMode = ObserveMode::Disabled; std::unordered_map m_baseProductScriptValues; std::unordered_map m_productArtifactsMapScriptValues; std::unordered_map m_moduleArtifactsMapScriptValues; std::unordered_map m_projectScriptValues; std::unordered_map m_baseModuleScriptValues; std::vector> m_scopeChains; JSValueList m_contextStack; QHash m_exoticMethods; QHash m_classes; QHash m_internalExtensions; QHash m_stringCache; QHash m_jsValueCache; QHash m_evalResults; std::vector m_externallyCachedValues; MutexData, JSValue>, std::recursive_mutex> m_artifactsScriptValues; QVariantMap m_properties; std::optional m_setupParams; ErrorInfo m_jsError; bool m_lastLookupWasSuccess = false; }; class EvalContextSwitcher { public: EvalContextSwitcher(ScriptEngine *engine, EvalContext newContext) : m_engine(engine), m_oldContext(engine->evalContext()) { engine->setEvalContext(newContext); } ~EvalContextSwitcher() { m_engine->setEvalContext(m_oldContext); } private: ScriptEngine * const m_engine; const EvalContext m_oldContext; }; } // namespace Internal } // namespace qbs #endif // QBS_SCRIPTENGINE_H qbs-src-3.2.0/src/lib/corelib/language/identifiersearch.cpp0000644000175100017510000000532715154533055023264 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "identifiersearch.h" #include namespace qbs { namespace Internal { IdentifierSearch::IdentifierSearch() = default; void IdentifierSearch::start(QbsQmlJS::AST::Node *node) { for (auto it = m_requests.cbegin(); it != m_requests.cend(); ++it) *it.value() = false; m_numberOfFoundIds = 0; node->accept(this); } void IdentifierSearch::add(const QString &name, bool *found) { m_requests.insert(name, found); } bool IdentifierSearch::preVisit(QbsQmlJS::AST::Node *) { return m_numberOfFoundIds < m_requests.size(); } bool IdentifierSearch::visit(QbsQmlJS::AST::IdentifierExpression *e) { bool *found = m_requests.value(e->name.toString()); if (found && !*found) { *found = true; m_numberOfFoundIds++; } return m_numberOfFoundIds < m_requests.size(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/artifactproperties.cpp0000644000175100017510000000524615154533055023666 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "artifactproperties.h" #include namespace qbs { namespace Internal { ArtifactPropertiesPtr ArtifactProperties::create() { return ArtifactPropertiesPtr(new ArtifactProperties); } ArtifactProperties::ArtifactProperties() = default; FileTags ArtifactProperties::extraFileTags() const { return m_extraFileTags; } void ArtifactProperties::addExtraFileTags(const FileTags &extraFileTags) { m_extraFileTags.unite(extraFileTags); } bool operator==(const ArtifactProperties &ap1, const ArtifactProperties &ap2) { return ap1.fileTagsFilter() == ap2.fileTagsFilter() && ap1.extraFileTags() == ap2.extraFileTags() && !ap1.propertyMap() == !ap2.propertyMap() && *ap1.propertyMap() == *ap2.propertyMap(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/property.h0000644000175100017510000000672115154533055021304 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROPERTY_H #define QBS_PROPERTY_H #include #include #include #include namespace qbs { namespace Internal { class Property { public: enum Kind { PropertyInModule, PropertyInProduct, PropertyInProject, PropertyInParameters, PropertyInArtifact, }; Property() : kind(PropertyInModule) { } Property(QString product, QString module, QString property, QVariant v, Kind k) : productName(std::move(product)) , moduleName(std::move(module)) , propertyName(std::move(property)) , value(std::move(v)) , kind(k) { } template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(productName, moduleName, propertyName, value, kind); } QString productName; // In case of kind == PropertyInProject, this is the project name. QString moduleName; QString propertyName; QVariant value; Kind kind; }; inline bool operator==(const Property &p1, const Property &p2) { return p1.productName == p2.productName && p1.moduleName == p2.moduleName && p1.propertyName == p2.propertyName; } bool operator<(const Property &p1, const Property &p2); inline auto qHash(const Property &p) { return QT_PREPEND_NAMESPACE(qHash)(p.productName + p.moduleName + p.propertyName); } using PropertySet = Set; using PropertyHash = QHash; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/language/forward_decls.h0000644000175100017510000001306715154533055022237 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_LANG_FORWARD_DECLS_H #define QBS_LANG_FORWARD_DECLS_H #include namespace qbs { namespace Internal { enum class ObserveMode; class Value; using ValuePtr = std::shared_ptr; using ValueConstPtr = std::shared_ptr; class ItemValue; using ItemValuePtr = std::shared_ptr; using ItemValueConstPtr = std::shared_ptr; class JSSourceValue; using JSSourceValuePtr = std::shared_ptr; using JSSourceValueConstPtr = std::shared_ptr; class VariantValue; using VariantValuePtr = std::shared_ptr; using VariantValueConstPtr = std::shared_ptr; class FileContext; using FileContextPtr = std::shared_ptr; using FileContextConstPtr = std::shared_ptr; class FileContextBase; using FileContextBasePtr = std::shared_ptr; using FileContextBaseConstPtr = std::shared_ptr; class Probe; using ProbePtr = std::shared_ptr; using ProbeConstPtr = std::shared_ptr; class PropertyMapInternal; using PropertyMapPtr = std::shared_ptr; using PropertyMapConstPtr = std::shared_ptr; class FileTagger; using FileTaggerPtr = std::shared_ptr; using FileTaggerConstPtr = std::shared_ptr; class ResolvedProduct; using ResolvedProductPtr = std::shared_ptr; using ResolvedProductConstPtr = std::shared_ptr; class ResolvedProject; using ResolvedProjectPtr = std::shared_ptr; using ResolvedProjectConstPtr = std::shared_ptr; class TopLevelProject; using TopLevelProjectPtr = std::shared_ptr; using TopLevelProjectConstPtr = std::shared_ptr; class ResolvedFileContext; using ResolvedFileContextPtr = std::shared_ptr; using ResolvedFileContextConstPtr = std::shared_ptr; class Rule; using RulePtr = std::shared_ptr; using RuleConstPtr = std::shared_ptr; class ResolvedScanner; using ResolvedScannerPtr = std::shared_ptr; using ResolvedScannerConstPtr = std::shared_ptr; class SourceArtifactInternal; using SourceArtifactPtr = std::shared_ptr; using SourceArtifactConstPtr = std::shared_ptr; class ScriptFunction; using ScriptFunctionPtr = std::shared_ptr; using ScriptFunctionConstPtr = std::shared_ptr; class PrivateScriptFunction; class RuleArtifact; using RuleArtifactPtr = std::shared_ptr; using RuleArtifactConstPtr = std::shared_ptr; class ResolvedModule; using ResolvedModulePtr = std::shared_ptr; using ResolvedModuleConstPtr = std::shared_ptr; class ResolvedGroup; using GroupPtr = std::shared_ptr; using GroupConstPtr = std::shared_ptr; class ArtifactProperties; using ArtifactPropertiesPtr = std::shared_ptr; using ArtifactPropertiesConstPtr = std::shared_ptr; class ExportedItem; using ExportedItemPtr = std::shared_ptr; class ExportedModule; class ExportedModuleDependency; class ExportedProperty; class PersistentPool; } // namespace Internal } // namespace qbs #ifdef QT_CORE_LIB #include "../tools/porting.h" #include namespace qbs { namespace Internal { template inline static QHashValueType qHash(const std::shared_ptr &p, QHashValueType seed = 0) { return ::qHash(p.get(), seed); } } // namespace Internal } // namespace qbs #endif #endif // QBS_LANG_FORWARD_DECLS_H qbs-src-3.2.0/src/lib/corelib/language/value.h0000644000175100017510000002245515154533055020536 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_VALUE_H #define QBS_VALUE_H #include "forward_decls.h" #include #include #include #include #include namespace qbs { namespace Internal { class Item; class ItemPool; class ItemValue; class JSSourceValue; class VariantValue; template class ValueHandler { public: T handle(Value *v); private: virtual T doHandle(JSSourceValue *value) = 0; virtual T doHandle(ItemValue *value) = 0; virtual T doHandle(VariantValue *value) = 0; }; class Value { public: enum Type { JSSourceValueType, ItemValueType, VariantValueType }; enum Flag { NoFlags = 0x00, SourceUsesBase = 0x01, SourceUsesOuter = 0x02, SourceUsesOriginal = 0x04, HasFunctionForm = 0x08, ExclusiveListValue = 0x10, BuiltinDefaultValue = 0x20, OriginPropertiesBlock = 0x40, OriginProfile = 0x80, OriginCommandLine = 0x100, Fallback = 0x200, }; Q_DECLARE_FLAGS(Flags, Flag) Value(Type t, bool createdByPropertiesBlock); Value(const Value &other) = default; virtual ~Value(); Type type() const { return m_type; } template T apply(ValueHandler *handler) { return handler->handle(this); }; virtual ValuePtr clone(ItemPool &) const = 0; virtual CodeLocation location() const { return {}; } Item *scope() const { return m_scope; } virtual void setScope(Item *scope, const QString &scopeName); QString scopeName() const { return m_scopeName; } int priority(const Item *productItem) const; virtual void resetPriority(); void addCandidate(const ValuePtr &v) { m_candidates.push_back(v); } const std::vector &candidates() const { return m_candidates; } void setCandidates(const std::vector &candidates) { m_candidates = candidates; } void removeExpiredCandidates(const Item *productItem); void sortCandidates(const std::function &less); bool createdByPropertiesBlock() const { return m_flags & OriginPropertiesBlock; } void setFallback() { m_flags |= Fallback; } bool isFallback() const { return m_flags & Fallback; } void markAsSetByProfile() { m_flags |= OriginProfile; } bool setByProfile() const { return m_flags & OriginProfile; } void markAsSetByCommandLine() { m_flags |= OriginCommandLine; } bool setByCommandLine() const { return m_flags & OriginCommandLine; } bool setInternally() const; bool expired(const Item *productItem) const { return priority(productItem) == 0; } void setSourceUsesBase() { m_flags |= SourceUsesBase; } bool sourceUsesBase() const { return m_flags.testFlag(SourceUsesBase); } void setSourceUsesOuter() { m_flags |= SourceUsesOuter; } bool sourceUsesOuter() const { return m_flags.testFlag(SourceUsesOuter); } void setSourceUsesOriginal() { m_flags |= SourceUsesOriginal; } bool sourceUsesOriginal() const { return m_flags.testFlag(SourceUsesOriginal); } void setHasFunctionForm() { m_flags |= HasFunctionForm; } bool hasFunctionForm() const { return m_flags.testFlag(HasFunctionForm); } void setIsExclusiveListValue() { m_flags |= ExclusiveListValue; } bool isExclusiveListValue() { return m_flags.testFlag(ExclusiveListValue); } void setIsBuiltinDefaultValue() { m_flags |= BuiltinDefaultValue; } bool isBuiltinDefaultValue() const { return m_flags.testFlag(BuiltinDefaultValue); } private: int calculatePriority(const Item *productItem) const; const Type m_type; Item *m_scope = nullptr; QString m_scopeName; std::vector m_candidates; Flags m_flags; mutable int m_priority = -1; }; class JSSourceValue : public Value { friend class ItemReaderASTVisitor; public: explicit JSSourceValue(bool createdByPropertiesBlock); JSSourceValue(const JSSourceValue &other, ItemPool &pool); static JSSourceValuePtr QBS_AUTOTEST_EXPORT create(bool createdByPropertiesBlock = false); ~JSSourceValue() override; ValuePtr clone(ItemPool &pool) const override; void setSourceCode(QStringView sourceCode) { m_sourceCode = sourceCode; } QStringView sourceCode() const { return m_sourceCode; } QString sourceCodeForEvaluation() const; void setLocation(int line, int column); int line() const { return m_line; } int column() const { return m_column; } CodeLocation location() const override; void setFile(const FileContextPtr &file) { m_file = file; } const FileContextPtr &file() const { return m_file; } const JSSourceValuePtr &baseValue() const { return m_baseValue; } void setBaseValue(const JSSourceValuePtr &v) { m_baseValue = v; } struct Alternative { struct PropertyData { PropertyData() = default; PropertyData(QString v, const CodeLocation &l) : value(std::move(v)), location(l) {} QString value; CodeLocation location; }; Alternative() = default; Alternative(PropertyData c, PropertyData o, JSSourceValuePtr v) : condition(std::move(c)), overrideListProperties(std::move(o)), value(std::move(v)) {} Alternative clone(ItemPool &pool) const { return Alternative(condition, overrideListProperties, std::static_pointer_cast(value->clone(pool))); } PropertyData condition; PropertyData overrideListProperties; JSSourceValuePtr value; }; using AltProperty = Alternative::PropertyData; const std::vector &alternatives() const { return m_alternatives; } void addAlternative(const Alternative &alternative); void clearAlternatives(); void setScope(Item *scope, const QString &scopeName) override; void resetPriority() override; private: QStringView m_sourceCode; int m_line; int m_column; FileContextPtr m_file; JSSourceValuePtr m_baseValue; std::vector m_alternatives; }; class ItemValue : public Value { public: ItemValue(Item *item, bool createdByPropertiesBlock); static ItemValuePtr create(Item *item, bool createdByPropertiesBlock = false); Item *item() const { return m_item; } void setItem(Item *item) { m_item = item; } private: ValuePtr clone(ItemPool &pool) const override; Item *m_item; }; class VariantValue : public Value { public: explicit VariantValue(QVariant v); VariantValue(const VariantValue &v) = default; static VariantValuePtr create(const QVariant &v = QVariant()); static VariantValuePtr createStored(const QVariant &v = QVariant()); ValuePtr clone(ItemPool &) const override; const QVariant &value() const { return m_value; } virtual quintptr id() const { return 0; } static const VariantValuePtr &falseValue(); static const VariantValuePtr &trueValue(); static const VariantValuePtr &invalidValue(); private: QVariant m_value; }; template inline T ValueHandler::handle(Value *v) { switch (v->type()) { case Value::JSSourceValueType: return doHandle(static_cast(v)); case Value::ItemValueType: return doHandle(static_cast(v)); case Value::VariantValueType: return doHandle(static_cast(v)); } if constexpr (!std::is_same_v) return {}; } } // namespace Internal } // namespace qbs #endif // QBS_VALUE_H qbs-src-3.2.0/src/lib/corelib/language/preparescriptobserver.cpp0000644000175100017510000001002715154533055024400 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "preparescriptobserver.h" #include "property.h" #include "scriptengine.h" #include #include #include #include #include namespace qbs { namespace Internal { PrepareScriptObserver::PrepareScriptObserver(ScriptEngine *engine, UnobserveMode unobserveMode) : ScriptPropertyObserver(engine, unobserveMode) { } void PrepareScriptObserver::onPropertyRead(const JSValue &object, const QString &name, const JSValue &value) { JSContext * const ctx = engine()->context(); const auto objectId = jsObjectId(object); const auto projectIt = m_projectObjectIds.find(objectId); if (projectIt != m_projectObjectIds.cend()) { engine()->addPropertyRequestedInScript( Property(projectIt->second, QString(), name, getJsVariant(ctx, value), Property::PropertyInProject)); return; } if (m_importIds.contains(objectId)) { engine()->addImportRequestedInScript(jsObjectId(object)); return; } const auto exportsIt = m_exportsObjectIds.find(jsObjectId(object)); if (exportsIt != m_exportsObjectIds.cend()) { engine()->addRequestedExport(exportsIt->second); return; } const auto it = m_parameterObjects.find(objectId); if (it != m_parameterObjects.cend()) { engine()->addPropertyRequestedInScript( Property(it->second.first, it->second.second, name, getJsVariant(ctx, value), Property::PropertyInParameters)); } if (name == StringConstants::fileTagsProperty() && m_artifactIds.contains(objectId)) { const Artifact * const artifact = attachedPointer(object, engine()->dataWithPtrClass()); QBS_CHECK(artifact); const Property p(artifact->product->uniqueName(), QString(), name, getJsVariant(ctx, value), Property::PropertyInArtifact); engine()->addPropertyRequestedFromArtifact(artifact, p); } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/evaluator.h0000644000175100017510000001447215154533055021424 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_EVALUATOR_H #define QBS_EVALUATOR_H #include "forward_decls.h" #include "itemobserver.h" #include "qualifiedid.h" #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class EvaluationData; class FileTags; class Logger; class PropertyDeclaration; class ScriptEngine; class QBS_AUTOTEST_EXPORT Evaluator : private ItemObserver { friend class SVConverter; public: Evaluator(ScriptEngine *scriptEngine); ~Evaluator() override; ScriptEngine *engine() const { return m_scriptEngine; } JSClassID classId() const { return m_scriptClass; } JSValue property(const Item *item, const QString &name); JSValue value(const Item *item, const QString &name, bool *propertySet = nullptr); bool boolValue(const Item *item, const QString &name, bool *propertyWasSet = nullptr); int intValue(const Item *item, const QString &name, int defaultValue = 0, bool *propertyWasSet = nullptr); FileTags fileTagsValue(const Item *item, const QString &name, bool *propertySet = nullptr); QString stringValue(const Item *item, const QString &name, const QString &defaultValue = QString(), bool *propertyWasSet = nullptr); QStringList stringListValue(const Item *item, const QString &name, bool *propertyWasSet = nullptr); std::optional optionalStringListValue(const Item *item, const QString &name, bool *propertyWasSet = nullptr); QVariant variantValue(const Item *item, const QString &name, bool *propertySet = nullptr); void convertToPropertyType(const PropertyDeclaration& decl, const CodeLocation &loc, JSValue &v); JSValue scriptValue(const Item *item); struct FileContextScopes { JSValue fileScope = JS_UNDEFINED; JSValue importScope = JS_UNDEFINED; }; FileContextScopes fileContextScopes(const FileContextConstPtr &file); void setCachingEnabled(bool enabled) { m_valueCacheEnabled = enabled; } bool cachingEnabled() const { return m_valueCacheEnabled; } void clearCache(const Item *item); void invalidateCache(const Item *item); void clearCacheIfInvalidated(EvaluationData &edata); PropertyDependencies &propertyDependencies() { return m_propertyDependencies; } void clearPropertyDependencies() { m_propertyDependencies.clear(); } std::stack &requestedProperties() { return m_requestedProperties; } using EvalStack = std::deque>; EvalStack &evalStack() { return m_evalStack; } void handleEvaluationError(const Item *item, const QString &name); QString pathPropertiesBaseDir() const { return m_pathPropertiesBaseDir; } void setPathPropertiesBaseDir(const QString &dirPath) { m_pathPropertiesBaseDir = dirPath; } void clearPathPropertiesBaseDir() { m_pathPropertiesBaseDir.clear(); } bool isNonDefaultValue(const Item *item, const QString &name) const; private: void onItemPropertyChanged(Item *item) override { invalidateCache(item); } JSValue evaluateProperty(const Item *item, const QString &name, bool *propertyWasSet); void clearCache(EvaluationData &edata); ScriptEngine * const m_scriptEngine; const JSClassID m_scriptClass; mutable QHash m_scriptValueMap; mutable QHash m_fileContextScopesMap; QString m_pathPropertiesBaseDir; PropertyDependencies m_propertyDependencies; std::stack m_requestedProperties; EvalStack m_evalStack; std::mutex m_cacheInvalidationMutex; Set m_invalidatedCaches; bool m_valueCacheEnabled = false; }; void throwOnEvaluationError(ScriptEngine *engine, const std::function &provideFallbackCodeLocation); class EvalCacheEnabler { public: EvalCacheEnabler(Evaluator *evaluator, const QString &baseDir) : m_evaluator(evaluator) { m_evaluator->setCachingEnabled(true); m_evaluator->setPathPropertiesBaseDir(baseDir); } ~EvalCacheEnabler() { reset(); } void reset() { m_evaluator->setCachingEnabled(false); m_evaluator->clearPathPropertiesBaseDir(); } private: Evaluator * const m_evaluator; }; } // namespace Internal } // namespace qbs #endif // QBS_EVALUATOR_H qbs-src-3.2.0/src/lib/corelib/language/artifactproperties.h0000644000175100017510000000612215154533055023325 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ARTIFACTPROPERTIES_H #define QBS_ARTIFACTPROPERTIES_H #include "filetags.h" #include "forward_decls.h" #include namespace qbs { namespace Internal { class ArtifactProperties { public: static ArtifactPropertiesPtr create(); void setFileTagsFilter(const FileTags &filter) { m_fileTagsFilter = filter; } FileTags fileTagsFilter() const { return m_fileTagsFilter; } PropertyMapPtr propertyMap() const { return m_propertyMap; } void setPropertyMapInternal(const PropertyMapPtr &pmap) { m_propertyMap = pmap; } FileTags extraFileTags() const; void addExtraFileTags(const FileTags &extraFileTags); template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(m_fileTagsFilter, m_extraFileTags, m_propertyMap); } private: ArtifactProperties(); FileTags m_fileTagsFilter; FileTags m_extraFileTags; PropertyMapPtr m_propertyMap; }; bool operator==(const ArtifactProperties &ap1, const ArtifactProperties &ap2); inline bool operator!=(const ArtifactProperties &ap1, const ArtifactProperties &ap2) { return !(ap1 == ap2); } } // namespace Internal } // namespace qbs #endif // QBS_ARTIFACTPROPERTIES_H qbs-src-3.2.0/src/lib/corelib/language/moduleproviderinfo.h0000644000175100017510000000766715154533055023346 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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_MODULEPROVIDERINFO_H #define QBS_MODULEPROVIDERINFO_H #include "qualifiedid.h" #include #include #include #include #include namespace qbs { namespace Internal { class ModuleProviderInfo { public: ModuleProviderInfo() = default; ModuleProviderInfo(QualifiedId name, QVariantMap config, QStringList searchPaths, bool transientOutput) : name(std::move(name)) , config(std::move(config)) , searchPaths(std::move(searchPaths)) , transientOutput(transientOutput) {} static QString outputBaseDirName() { return QStringLiteral("genmodules"); } static QString outputDirPath(const QString &baseDir, const QualifiedId &name) { return baseDir + QLatin1Char('/') + outputBaseDirName() + QLatin1Char('/') + name.toString(); } QString outputDirPath(const QString &baseDir) const { return outputDirPath(baseDir, name); } template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp( reinterpret_cast(name), config, providerFile, searchPaths); } QualifiedId name; QVariantMap config; QString providerFile; bool isEager{true}; QStringList searchPaths; QHash searchPathsByModule; bool transientOutput = false; // Not to be serialized. }; using ModuleProvidersCacheKey = std::tuple< QString /*name*/, QString /*moduleName*/, QVariantMap /*config*/, QVariantMap /*qbsModule*/, int /*lookup*/ >; using ModuleProvidersCache = std::unordered_map; // Persistent info stored between sessions class StoredModuleProviderInfo { public: ModuleProvidersCache providers; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(providers); } }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/language/qualifiedid.h0000644000175100017510000000514515154533055021677 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_QUALIFIEDID_H #define QBS_QUALIFIEDID_H #include #include #include namespace qbs { namespace Internal { class QBS_AUTOTEST_EXPORT QualifiedId : public QStringList { public: QualifiedId(); QualifiedId(const QString &singlePartName); QualifiedId(const QStringList &nameParts); static QualifiedId fromString(const QString &str); QString toString() const; }; inline auto qHash(const QualifiedId &qid) { return qHash(qid.toString()); } using QualifiedIdSet = Set; // Values are the properties with a dependency on the key property using PropertyDependencies = QHash; } // namespace Internal } // namespace qbs #endif // QBS_QUALIFIEDID_H qbs-src-3.2.0/src/lib/corelib/language/filecontextbase.cpp0000644000175100017510000000410215154533055023121 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "filecontextbase.h" #include namespace qbs { namespace Internal { QString FileContextBase::dirPath() const { return FileInfo::path(m_filePath); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/filetags.h0000644000175100017510000000570515154533055021217 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_FILETAGS_H #define QBS_FILETAGS_H #include #include #include #include namespace qbs { namespace Internal { class PersistentPool; class FileTag : public Id { public: FileTag() : Id() {} FileTag(const Id &other) : Id(other) {} FileTag(const char *str) : Id(str) {} explicit FileTag(const QByteArray &ba) : Id(ba) {} void clear(); void store(PersistentPool &pool) const; void load(PersistentPool &pool); }; template<> inline bool Set::sortAfterLoadRequired() const { return true; } QDebug operator<<(QDebug debug, const FileTag &tag); class FileTags : public Set { public: FileTags() : Set() {} FileTags(const std::initializer_list &list) : Set(list) {} static FileTags fromStringList(const QStringList &strings); }; LogWriter operator <<(LogWriter w, const FileTags &tags); QDebug operator<<(QDebug debug, const FileTags &tags); } // namespace Internal } // namespace qbs #endif // QBS_FILETAGS_H qbs-src-3.2.0/src/lib/corelib/language/filecontext.cpp0000644000175100017510000000437215154533055022277 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "filecontext.h" #include "item.h" namespace qbs { namespace Internal { FileContext::FileContext() : m_idScope(nullptr) { } FileContextPtr FileContext::create() { return FileContextPtr(new FileContext); } void FileContext::ensureIdScope(ItemPool *itemPool) { if (!m_idScope) m_idScope = Item::create(itemPool, ItemType::IdScope); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/deprecationinfo.h0000644000175100017510000001123115154533055022561 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_DEPRECATIONINFO_H #define QBS_DEPRECATIONINFO_H #include #include #include #include #include #include #include namespace qbs { namespace Internal { class DeprecationInfo { public: explicit DeprecationInfo(const Version &removalVersion, QString additionalUserInfo = QString()) : m_removalVersion(removalVersion) , m_additionalUserInfo(std::move(additionalUserInfo)) {} DeprecationInfo() = default; static bool isLastVersionBeforeRemoval(const Version &removalVersion) { const Version next( LanguageInfo::qbsVersion().majorVersion(), LanguageInfo::qbsVersion().minorVersion() + 1); return removalVersion == next || removalVersion.minorVersion() == 0; } bool isValid() const { return m_removalVersion.isValid(); } Version removalVersion() const { return m_removalVersion; } ErrorInfo checkForDeprecation(DeprecationWarningMode mode, const QString &name, const CodeLocation &loc, bool isItem, Logger &logger) const { if (!isValid()) return {}; const Version qbsVersion = LanguageInfo::qbsVersion(); if (removalVersion() <= qbsVersion) { const QString msgTemplate = isItem ? Tr::tr("The item '%1' can no longer be used. It was removed in Qbs %2.") : Tr::tr("The property '%1' can no longer be used. It was removed in Qbs %2."); ErrorInfo error(msgTemplate.arg(name, removalVersion().toString()), loc); if (!m_additionalUserInfo.isEmpty()) error.append(m_additionalUserInfo); return error; } const QString msgTemplate = isItem ? Tr::tr("The item '%1' is deprecated and will be removed in Qbs %2.") : Tr::tr("The property '%1' is deprecated and will be removed in Qbs %2."); ErrorInfo error(msgTemplate.arg(name, removalVersion().toString()), loc); if (!m_additionalUserInfo.isEmpty()) error.append(m_additionalUserInfo); switch (mode) { case DeprecationWarningMode::Error: return error; case DeprecationWarningMode::On: logger.printWarning(error); break; case DeprecationWarningMode::BeforeRemoval: if (isLastVersionBeforeRemoval(removalVersion())) logger.printWarning(error); break; case DeprecationWarningMode::Off: break; } return {}; } private: Version m_removalVersion; QString m_additionalUserInfo; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/language/itemdeclaration.h0000644000175100017510000000636015154533055022563 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ITEMDECLARATION_H #define QBS_ITEMDECLARATION_H #include "deprecationinfo.h" #include "itemtype.h" #include "propertydeclaration.h" #include #include namespace qbs { namespace Internal { class ItemDeclaration { public: ItemDeclaration(ItemType type = ItemType::Unknown); ItemType type() const { return m_type; } using Properties = QList; void setProperties(const Properties &props) { m_properties = props; } Properties properties() const { return m_properties; } void setDeprecationInfo(const DeprecationInfo &di) { m_deprecationInfo = di; } DeprecationInfo deprecationInfo() const { return m_deprecationInfo; } ItemDeclaration &operator<<(const PropertyDeclaration &decl); using TypeNames = Set; void setAllowedChildTypes(const TypeNames &typeNames) { m_allowedChildTypes = typeNames; } const TypeNames &allowedChildTypes() const { return m_allowedChildTypes; } bool isChildTypeAllowed(ItemType type) const; ErrorInfo checkForDeprecation(DeprecationWarningMode mode, const QString &name, const CodeLocation &loc, Logger &logger) const; private: ItemType m_type; Properties m_properties; TypeNames m_allowedChildTypes; DeprecationInfo m_deprecationInfo; }; } // namespace Internal } // namespace qbs #endif // QBS_ITEMDECLARATION_H qbs-src-3.2.0/src/lib/corelib/language/scriptimporter.cpp0000644000175100017510000001253215154533055023036 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "scriptimporter.h" #include "evaluator.h" #include "scriptengine.h" #include #include #include #include #include namespace qbs { namespace Internal { class IdentifierExtractor : private QbsQmlJS::AST::Visitor { public: void start(QbsQmlJS::AST::Node *node) { m_first = true; m_barrier = false; m_suffix += QLatin1String("\nreturn {"); if (node) node->accept(this); m_suffix += QLatin1String("}})()"); } const QString &suffix() const { return m_suffix; } private: bool visit(QbsQmlJS::AST::SourceElements *) override { // Only consider the top level of source elements. if (m_barrier) return false; m_barrier = true; return true; } void endVisit(QbsQmlJS::AST::SourceElements *) override { m_barrier = false; } bool visit(QbsQmlJS::AST::FunctionSourceElement *fse) override { add(fse->declaration->name); return false; } bool visit(QbsQmlJS::AST::VariableDeclaration *vd) override { add(vd->name); return false; } void add(QStringView name) { if (m_first) { m_first = false; m_suffix.reserve(m_suffix.length() + name.length() * 2 + 1); } else { m_suffix.reserve(m_suffix.length() + name.length() * 2 + 2); m_suffix += QLatin1Char(','); } // ugly, but qt5 does not have append overload for QStringView m_suffix.append(name.data(), name.size()); m_suffix.append(QLatin1Char(':')); m_suffix.append(name.data(), name.size()); } bool m_first = false; bool m_barrier = false; QString m_suffix; }; ScriptImporter::ScriptImporter(ScriptEngine *scriptEngine) : m_engine(scriptEngine) { } JSValue ScriptImporter::importSourceCode(const QString &sourceCode, const QString &filePath, JSValue &targetObject) { Q_ASSERT(JS_IsObject(targetObject)); // The targetObject doesn't get overwritten but enhanced by the contents of the .js file. // This is necessary for library imports that consist of multiple js files. QString &code = m_sourceCodeCache[filePath]; if (code.isEmpty()) { QbsQmlJS::Engine engine; QbsQmlJS::Lexer lexer(&engine); lexer.setCode(sourceCode, 1, false); QbsQmlJS::Parser parser(&engine); if (!parser.parseProgram()) { throw ErrorInfo(parser.errorMessage(), CodeLocation(filePath, parser.errorLineNumber(), parser.errorColumnNumber())); } IdentifierExtractor extractor; extractor.start(parser.rootNode()); code = QLatin1String("(function(){\n") + sourceCode + extractor.suffix(); } ScopedJsValue result(m_engine->context(), m_engine->evaluate(JsValueOwner::Caller, code, filePath, 0)); throwOnEvaluationError(m_engine, [&filePath] () { return CodeLocation(filePath, 0); }); copyProperties(m_engine->context(), result, targetObject); return result.release(); } void ScriptImporter::copyProperties(JSContext *ctx, const JSValue &src, JSValue &dst) { handleJsProperties(ctx, src, [ctx, &dst](const JSAtom &name, const JSPropertyDescriptor &desc) { JS_SetProperty(ctx, dst, name, JS_DupValue(ctx, desc.value)); }); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/propertymapinternal.h0000644000175100017510000000675315154533055023544 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROPERTYMAPINTERNAL_H #define QBS_PROPERTYMAPINTERNAL_H #include "forward_decls.h" #include #include #include namespace qbs { namespace Internal { class QBS_AUTOTEST_EXPORT PropertyMapInternal { public: static PropertyMapPtr create() { return PropertyMapPtr(new PropertyMapInternal); } PropertyMapPtr clone() const { return PropertyMapPtr(new PropertyMapInternal(*this)); } const QVariantMap &value() const { return m_value; } QVariant moduleProperty(const QString &moduleName, const QString &key, bool *isPresent = nullptr) const; QVariant qbsPropertyValue(const QString &key) const; // Convenience function. QVariant property(const QStringList &name) const; void setValue(const QVariantMap &value); template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(m_value); } private: friend bool operator==(const PropertyMapInternal &lhs, const PropertyMapInternal &rhs); PropertyMapInternal(); PropertyMapInternal(const PropertyMapInternal &other); QVariantMap m_value; }; inline bool operator==(const PropertyMapInternal &lhs, const PropertyMapInternal &rhs) { return qVariantsEqual(lhs.m_value, rhs.m_value); } QVariant QBS_AUTOTEST_EXPORT moduleProperty(const QVariantMap &properties, const QString &moduleName, const QString &key, bool *isPresent = nullptr); } // namespace Internal } // namespace qbs #endif // QBS_PROPERTYMAPINTERNAL_H qbs-src-3.2.0/src/lib/corelib/language/resolvedfilecontext.h0000644000175100017510000000566715154533055023520 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_RESOLVEDFILECONTEXT_H #define QBS_RESOLVEDFILECONTEXT_H #include "forward_decls.h" #include "filecontextbase.h" #include namespace qbs { namespace Internal { class ResolvedFileContext : public FileContextBase { public: static ResolvedFileContextPtr create() { return ResolvedFileContextPtr(new ResolvedFileContext); } static ResolvedFileContextPtr create(const FileContextBase &baseContext) { return ResolvedFileContextPtr(new ResolvedFileContext(baseContext)); } template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(m_filePath, m_jsExtensions, m_searchPaths, m_jsImports); } private: ResolvedFileContext() = default; ResolvedFileContext(const FileContextBase &ctx); }; bool operator==(const ResolvedFileContext &a, const ResolvedFileContext &b); inline bool operator!=(const ResolvedFileContext &a, const ResolvedFileContext &b) { return !(a == b); } } // namespace Internal } // namespace qbs #endif // QBS_RESOLVEDFILECONTEXT_H qbs-src-3.2.0/src/lib/corelib/language/filetags.cpp0000644000175100017510000000605015154533055021544 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "filetags.h" #include #include namespace qbs { namespace Internal { void FileTag::clear() { Id::operator=(Id()); } void FileTag::store(PersistentPool &pool) const { pool.store(toString()); } void FileTag::load(PersistentPool &pool) { *this = FileTag(pool.load().toUtf8()); } QDebug operator<<(QDebug debug, const FileTag &tag) { QDebugStateSaver saver(debug); return debug.resetFormat().noquote() << tag.toString(); } FileTags FileTags::fromStringList(const QStringList &strings) { FileTags result; for (const QString &str : strings) result += FileTag(str.toUtf8()); return result; } LogWriter operator <<(LogWriter w, const FileTags &tags) { bool firstLoop = true; w.write('('); for (const FileTag &tag : tags) { if (firstLoop) firstLoop = false; else w.write(QStringLiteral(", ")); w.write(tag.toString()); } w.write(')'); return w; } QDebug operator<<(QDebug debug, const FileTags &tags) { QDebugStateSaver saver(debug); return debug.resetFormat().noquote() << tags.toStringList(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/scriptpropertyobserver.h0000644000175100017510000000543215154533055024277 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SCRIPTPROPERTYOBSERVER_H #define QBS_SCRIPTPROPERTYOBSERVER_H #include #include QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE namespace qbs { namespace Internal { class ScriptEngine; enum class UnobserveMode { Enabled, Disabled }; class ScriptPropertyObserver { public: ScriptPropertyObserver(ScriptEngine *engine, UnobserveMode unobserveMode) : m_engine(engine), m_unobserveMode(unobserveMode) {} UnobserveMode unobserveMode() const { return m_unobserveMode; } virtual ~ScriptPropertyObserver(); virtual void onPropertyRead(const JSValue &object, const QString &name, const JSValue &value) = 0; protected: ScriptEngine * engine() const { return m_engine; } private: ScriptEngine * const m_engine; const UnobserveMode m_unobserveMode; }; } // namespace Internal } // namespace qbs #endif // QBS_SCRIPTPROPERTYOBSERVER_H qbs-src-3.2.0/src/lib/corelib/language/language.h0000644000175100017510000006572715154533055021216 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_LANGUAGE_H #define QBS_LANGUAGE_H #include "filetags.h" #include "forward_decls.h" #include "jsimports.h" #include "moduleproviderinfo.h" #include "propertydeclaration.h" #include "resolvedfilecontext.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class BuildGraphLocker; class BuildGraphLoader; class BuildGraphVisitor; class ScriptEngine; class FileTagger { public: static FileTaggerPtr create() { return FileTaggerPtr(new FileTagger); } static FileTaggerPtr create(const QStringList &patterns, const FileTags &fileTags, int priority) { return FileTaggerPtr(new FileTagger(patterns, fileTags, priority)); } const QList &patterns() const { return m_patterns; } const FileTags &fileTags() const { return m_fileTags; } int priority() const { return m_priority; } template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(m_patterns, m_fileTags, m_priority); } private: FileTagger(const QStringList &patterns, FileTags fileTags, int priority); FileTagger() = default; void setPatterns(const QStringList &patterns); QList m_patterns; FileTags m_fileTags; int m_priority = 0; }; class Probe { public: static ProbePtr create() { return ProbePtr(new Probe); } static ProbeConstPtr create( const QString &globalId, const CodeLocation &location, bool condition, const QString &configureScript, const QVariantMap &initialProperties, const QMap &values, const std::vector &importedFilesUsed) { return ProbeConstPtr(new Probe( globalId, location, condition, configureScript, initialProperties, values, importedFilesUsed)); } const QString &globalId() const { return m_globalId; } bool condition() const { return m_condition; } const CodeLocation &location() const { return m_location; } const QString &configureScript() const { return m_configureScript; } const QVariantMap &initialProperties() const { return m_initialProperties; } const QMap &values() const { return m_values; } const std::vector &importedFilesUsed() const { return m_importedFilesUsed; } bool needsReconfigure(const FileTime &referenceTime) const; template void completeSerializationOp(PersistentPool &pool) { QVariantMap properties; if constexpr (opType == PersistentPool::OpType::Store) properties = storeValues(); pool.serializationOp( m_globalId, m_location, m_condition, m_configureScript, properties, m_initialProperties, m_importedFilesUsed); if constexpr (opType == PersistentPool::OpType::Load) restoreValues(properties); } private: Probe() = default; Probe( QString globalId, const CodeLocation &location, bool condition, QString configureScript, QVariantMap initialProperties, QMap values, std::vector importedFilesUsed) : m_globalId(std::move(globalId)) , m_location(location) , m_configureScript(std::move(configureScript)) , m_initialProperties(std::move(initialProperties)) , m_values(std::move(values)) , m_importedFilesUsed(std::move(importedFilesUsed)) , m_condition(condition) {} void restoreValues(const QVariantMap &properties); QVariantMap storeValues() const; QString m_globalId; CodeLocation m_location; QString m_configureScript; QVariantMap m_initialProperties; QMap m_values; std::vector m_importedFilesUsed; bool m_condition = false; }; class RuleArtifact { public: static RuleArtifactPtr create() { return RuleArtifactPtr(new RuleArtifact); } QString filePath; FileTags fileTags; bool alwaysUpdated; CodeLocation location; CodeLocation filePathLocation; class Binding { public: QStringList name; QString code; CodeLocation location; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(name, code, location); } bool operator<(const Binding &other) const { if (name == other.name) { if (code == other.code) return location < other.location; return code < other.code; } return name < other.name; } }; std::vector bindings; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(filePath, fileTags, alwaysUpdated, location, filePathLocation, bindings); } private: RuleArtifact() : alwaysUpdated(true) {} }; QHashValueType qHash(const RuleArtifact::Binding &b); bool operator==(const RuleArtifact::Binding &b1, const RuleArtifact::Binding &b2); inline bool operator!=(const RuleArtifact::Binding &b1, const RuleArtifact::Binding &b2) { return !(b1 == b2); } bool operator==(const RuleArtifact &a1, const RuleArtifact &a2); inline bool operator!=(const RuleArtifact &a1, const RuleArtifact &a2) { return !(a1 == a2); } class SourceArtifactInternal { public: static SourceArtifactPtr create() { return SourceArtifactPtr(new SourceArtifactInternal); } bool isTargetOfModule() const { return !targetOfModule.isEmpty(); } QString absoluteFilePath; FileTags fileTags; bool overrideFileTags; QString targetOfModule; PropertyMapPtr properties; bool fromWildcard; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(absoluteFilePath, fileTags, overrideFileTags, properties, targetOfModule, fromWildcard); } private: SourceArtifactInternal() : overrideFileTags(true) {} }; bool operator==(const SourceArtifactInternal &sa1, const SourceArtifactInternal &sa2); inline bool operator!=(const SourceArtifactInternal &sa1, const SourceArtifactInternal &sa2) { return !(sa1 == sa2); } class SourceWildCards { public: void expandPatterns(); bool hasChangedSinceExpansion() const; // to be restored by the owning class QString prefix; QString baseDir; QString buildDir; Set expandedFiles; // stored QStringList patterns; QStringList excludePatterns; std::vector> dirTimeStamps; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(patterns, excludePatterns, dirTimeStamps); } private: Set expandPatterns(const QStringList &patterns); void expandPatterns(Set &result, const QStringList &parts, const QString &baseDir); }; class QBS_AUTOTEST_EXPORT ResolvedGroup { public: static GroupPtr create() { return GroupPtr(new ResolvedGroup); } CodeLocation location; QString name; bool enabled = true; QString prefix; std::optional> files; std::unique_ptr wildcards; PropertyMapPtr properties; FileTags fileTags; QString targetOfModule; bool overrideTags = false; void restoreWildcards(const QString &buildDir); template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(name, enabled, location, prefix, files, wildcards, properties, fileTags, targetOfModule, overrideTags); } }; class ScriptFunction { public: static ScriptFunctionPtr create() { return ScriptFunctionPtr(new ScriptFunction); } ~ScriptFunction(); QString sourceCode; CodeLocation location; ResolvedFileContextConstPtr fileContext; bool isValid() const; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(sourceCode, location, fileContext); } private: ScriptFunction(); }; bool operator==(const ScriptFunction &a, const ScriptFunction &b); inline bool operator!=(const ScriptFunction &a, const ScriptFunction &b) { return !(a == b); } bool operator==(const PrivateScriptFunction &a, const PrivateScriptFunction &b); class PrivateScriptFunction { friend bool operator==(const PrivateScriptFunction &a, const PrivateScriptFunction &b); public: void initialize(const ScriptFunctionPtr &sharedData) { m_sharedData = sharedData; } JSValue getFunction(ScriptEngine *engine, const QString &errorMessage) const; QString &sourceCode() const { return m_sharedData->sourceCode; } CodeLocation &location() const { return m_sharedData->location; } ResolvedFileContextConstPtr &fileContext() const { return m_sharedData->fileContext; } bool isValid() const { return m_sharedData->isValid(); } template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(m_sharedData); } private: ScriptFunctionPtr m_sharedData; mutable JSValue scriptFunction = JS_UNDEFINED; // not stored }; bool operator==(const PrivateScriptFunction &a, const PrivateScriptFunction &b); inline bool operator!=(const PrivateScriptFunction &a, const PrivateScriptFunction &b) { return !(a == b); } class ResolvedModule { public: static ResolvedModulePtr create() { return ResolvedModulePtr(new ResolvedModule); } QString name; CodeLocation location; QList> properties; QStringList moduleDependencies; // TODO: Still needed? PrivateScriptFunction setupBuildEnvironmentScript; PrivateScriptFunction setupRunEnvironmentScript; ResolvedProduct *product = nullptr; bool isProduct = false; static QStringList argumentNamesForSetupBuildEnv(); static QStringList argumentNamesForSetupRunEnv(); template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp( name, location, properties, moduleDependencies, setupBuildEnvironmentScript, setupRunEnvironmentScript, isProduct); } private: ResolvedModule() = default; }; bool operator==(const ResolvedModule &m1, const ResolvedModule &m2); inline bool operator!=(const ResolvedModule &m1, const ResolvedModule &m2) { return !(m1 == m2); } /** * Per default each rule is a "non-multiplex rule". * * A "multiplex rule" creates one transformer that takes all * input artifacts with the matching input file tag and creates * one or more artifacts. (e.g. linker rule) * * A "non-multiplex rule" creates one transformer per matching input file. */ class Rule { public: static RulePtr create() { return RulePtr(new Rule); } RulePtr clone() const; ResolvedProduct *product = nullptr; // The owning product. ResolvedModuleConstPtr module; QString name; PrivateScriptFunction prepareScript; FileTags outputFileTags; // unused, if artifacts is non-empty PrivateScriptFunction outputArtifactsScript; // unused, if artifacts is non-empty FileTags inputs; FileTags auxiliaryInputs; FileTags auxiliaryInputsFromDependencies; FileTags excludedInputs; FileTags inputsFromDependencies; FileTags explicitlyDependsOn; FileTags explicitlyDependsOnFromDependencies; bool multiplex = false; bool requiresInputs = false; std::vector artifacts; // unused, if outputFileTags/outputArtifactsScript is non-empty bool alwaysRun = false; // members that we don't need to save int ruleGraphId = -1; static QStringList argumentNamesForOutputArtifacts(); static QStringList argumentNamesForPrepare(); QString toString() const; FileTags staticOutputFileTags() const; FileTags collectedOutputFileTags() const; bool isDynamic() const; bool declaresInputs() const; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp( name, prepareScript, outputArtifactsScript, module, inputs, outputFileTags, auxiliaryInputs, auxiliaryInputsFromDependencies, excludedInputs, inputsFromDependencies, explicitlyDependsOn, explicitlyDependsOnFromDependencies, multiplex, requiresInputs, alwaysRun, artifacts); } private: Rule() = default; }; bool operator==(const Rule &r1, const Rule &r2); inline bool operator!=(const Rule &r1, const Rule &r2) { return !(r1 == r2); } bool ruleListsAreEqual(const std::vector &l1, const std::vector &l2); class ResolvedScanner { public: static ResolvedScannerPtr create() { return ResolvedScannerPtr(new ResolvedScanner); } ResolvedModuleConstPtr module; FileTags inputs; bool recursive; PrivateScriptFunction searchPathsScript; PrivateScriptFunction scanScript; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(module, inputs, recursive, searchPathsScript, scanScript); } private: ResolvedScanner() : recursive(false) {} }; class ExportedProperty { public: template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(fullName, type, sourceCode, isBuiltin); } QString fullName; PropertyDeclaration::Type type = PropertyDeclaration::Type::UnknownType; QString sourceCode; bool isBuiltin = false; }; bool operator==(const ExportedProperty &p1, const ExportedProperty &p2); inline bool operator!=(const ExportedProperty &p1, const ExportedProperty &p2) { return !(p1 == p2); } class ExportedItem { public: template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(name, properties, children); } static ExportedItemPtr create() { return std::make_shared(); } QString name; std::vector properties; std::vector children; }; bool equals(const std::vector &l1, const std::vector &l2); bool operator==(const ExportedItem &i1, const ExportedItem &i2); inline bool operator!=(const ExportedItem &i1, const ExportedItem &i2) { return !(i1 == i2); } class ExportedModuleDependency { public: template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(name, moduleProperties); }; QString name; QVariantMap moduleProperties; }; bool operator==(const ExportedModuleDependency &d1, const ExportedModuleDependency &d2); inline bool operator!=(const ExportedModuleDependency &d1, const ExportedModuleDependency &d2) { return !(d1 == d2); } class ExportedModule { public: template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(propertyValues, modulePropertyValues, children, productDependencies, moduleDependencies, m_properties, dependencyParameters, importStatements); }; QVariantMap propertyValues; QVariantMap modulePropertyValues; std::vector children; std::vector productDependencies; std::vector moduleDependencies; std::vector m_properties; QMap dependencyParameters; QStringList importStatements; }; bool operator==(const ExportedModule &m1, const ExportedModule &m2); inline bool operator!=(const ExportedModule &m1, const ExportedModule &m2) { return !(m1 == m2); } class TopLevelProject; class ScriptEngine; struct ProductDependency { ProductDependency(const ResolvedProductPtr &p, bool minimal) : product(p) , minimal(minimal) {} ProductDependency() = default; template void completeSerializationOp(PersistentPool &pool) { pool.serializationOp(product, minimal); } ResolvedProductPtr product; bool minimal = false; }; inline bool operator==(const ProductDependency &dep1, const ProductDependency &dep2) { return dep1.product == dep2.product && dep1.minimal == dep2.minimal; } class QBS_AUTOTEST_EXPORT ResolvedProduct { public: static ResolvedProductPtr create() { return ResolvedProductPtr(new ResolvedProduct); } ~ResolvedProduct(); bool enabled; FileTags fileTags; QString name; QString targetName; QString multiplexConfigurationId; QString sourceDirectory; QString destinationDirectory; CodeLocation location; WeakPointer project; QVariantMap productProperties; PropertyMapPtr moduleProperties; std::vector rules; std::vector dependencies; QHash dependencyParameters; std::vector fileTaggers; JobLimits jobLimits; std::vector modules; QHash moduleParameters; std::vector scanners; std::vector groups; std::vector probes; std::vector artifactProperties; QStringList missingSourceFiles; std::unique_ptr buildData; ExportedModule exportedModule; QProcessEnvironment buildEnvironment; // must not be saved QProcessEnvironment runEnvironment; // must not be saved void accept(BuildGraphVisitor *visitor) const; std::vector allFiles() const; std::vector allEnabledFiles() const; FileTags fileTagsForFileName(const QString &fileName) const; ArtifactSet lookupArtifactsByFileTag(const FileTag &tag) const; ArtifactSet lookupArtifactsByFileTags(const FileTags &tags) const; ArtifactSet targetArtifacts() const; TopLevelProject *topLevelProject() const; static QString uniqueName(const QString &name, const QString &multiplexConfigurationId); QString uniqueName() const; QString fullDisplayName() const; QString profile() const; QStringList generatedFiles(const QString &baseFile, bool recursive, const FileTags &tags) const; static QString deriveBuildDirectoryName(const QString &name, const QString &multiplexConfigurationId); QString buildDirectory() const; bool isInParentProject(const ResolvedProductConstPtr &other) const; bool builtByDefault() const; void cacheExecutablePath(const QString &origFilePath, const QString &fullFilePath); QString cachedExecutablePath(const QString &origFilePath) const; std::vector depsAsProductList() const; bool hasDependency(const ResolvedProductPtr &p) const; void load(PersistentPool &pool); void store(PersistentPool &pool); private: ResolvedProduct(); template void serializationOp(PersistentPool &pool) { pool.serializationOp(enabled, fileTags, name, multiplexConfigurationId, targetName, sourceDirectory, destinationDirectory, missingSourceFiles, location, productProperties, moduleProperties, rules, dependencies, dependencyParameters, fileTaggers, modules, moduleParameters, scanners, groups, artifactProperties, probes, exportedModule, buildData, jobLimits); } QHash m_executablePathCache; mutable std::mutex m_executablePathCacheLock; }; class QBS_AUTOTEST_EXPORT ResolvedProject { public: virtual ~ResolvedProject(); static ResolvedProjectPtr create() { return ResolvedProjectPtr(new ResolvedProject); } QString name; CodeLocation location; bool enabled; std::vector products; std::vector subProjects; WeakPointer parentProject; void accept(BuildGraphVisitor *visitor) const; void setProjectProperties(const QVariantMap &config) { m_projectProperties = config; } const QVariantMap &projectProperties() const { return m_projectProperties; } TopLevelProject *topLevelProject(); std::vector allSubProjects() const; std::vector allProducts() const; virtual void load(PersistentPool &pool); virtual void store(PersistentPool &pool); protected: ResolvedProject(); private: template void serializationOp(PersistentPool &pool) { pool.serializationOp(name, location, enabled, products, subProjects, m_projectProperties); } QVariantMap m_projectProperties; TopLevelProject *m_topLevelProject; }; class QBS_AUTOTEST_EXPORT TopLevelProject : public ResolvedProject { friend class BuildGraphLoader; public: ~TopLevelProject() override; static TopLevelProjectPtr create() { return TopLevelProjectPtr(new TopLevelProject); } static QString deriveId(const QVariantMap &config); static QString deriveBuildDirectory(const QString &buildRoot, const QString &id); QString buildDirectory; // Not saved QProcessEnvironment environment; std::vector probes; StoredModuleProviderInfo moduleProviderInfo; QHash canonicalFilePathResults; // Results of calls to "File.canonicalFilePath()." QHash fileExistsResults; // Results of calls to "File.exists()". QHash, QStringList> directoryEntriesResults; // Results of calls to "File.directoryEntries()". QHash fileLastModifiedResults; // Results of calls to "File.lastModified()". CodeLinks codeLinks; std::unique_ptr buildData; BuildGraphLocker *bgLocker; // This holds the system-wide build graph file lock. bool locked; // This is the API-level lock for the project instance. Set buildSystemFiles; FileTime lastStartResolveTime; FileTime lastEndResolveTime; QList warningsEncountered; QList errorsEncountered; void setBuildConfiguration(const QVariantMap &config); const QVariantMap &buildConfiguration() const { return m_buildConfiguration; } QString id() const { return m_id; } QString profile() const; void makeModuleProvidersNonTransient(); QVariantMap fullProfileConfigsTree() const; // Tree-ified + overridden values QVariantMap profileConfigs; QVariantMap overriddenValues; QString buildGraphFilePath() const; void store(Logger logger); private: TopLevelProject(); template void serializationOp(PersistentPool &pool) { pool.serializationOp( m_id, canonicalFilePathResults, fileExistsResults, directoryEntriesResults, fileLastModifiedResults, environment, probes, profileConfigs, overriddenValues, buildSystemFiles, lastStartResolveTime, lastEndResolveTime, warningsEncountered, errorsEncountered, buildData, moduleProviderInfo, codeLinks); } void load(PersistentPool &pool) override; void store(PersistentPool &pool) override; void cleanupModuleProviderOutput(); QString m_id; QVariantMap m_buildConfiguration; }; bool artifactPropertyListsAreEqual(const std::vector &l1, const std::vector &l2); } // namespace Internal } // namespace qbs QT_BEGIN_NAMESPACE Q_DECLARE_TYPEINFO(qbs::Internal::JsImport, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(qbs::Internal::RuleArtifact::Binding, Q_MOVABLE_TYPE); QT_END_NAMESPACE #endif // QBS_LANGUAGE_H qbs-src-3.2.0/src/lib/corelib/language/evaluator.cpp0000644000175100017510000012154115154533055021753 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "evaluator.h" #include "builtindeclarations.h" #include "filecontext.h" #include "filetags.h" #include "item.h" #include "scriptengine.h" #include "value.h" #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class EvaluationData { public: const Item *item = nullptr; mutable QHash valueCache; }; enum class ConversionType { Full, ElementsOnly }; static void convertToPropertyType_impl( ScriptEngine *engine, const QString &pathPropertiesBaseDir, const Item *item, const PropertyDeclaration &decl, const Value *value, const CodeLocation &location, ConversionType conversionType, JSValue &v); static int getEvalPropertyNames(JSContext *ctx, JSPropertyEnum **ptab, uint32_t *plen, JSValueConst obj); static int getEvalProperty(JSContext *ctx, JSPropertyDescriptor *desc, JSValueConst obj, JSAtom prop); static int getEvalPropertySafe(JSContext *ctx, JSPropertyDescriptor *desc, JSValueConst obj, JSAtom prop); static bool debugProperties = false; Evaluator::Evaluator(ScriptEngine *scriptEngine) : m_scriptEngine(scriptEngine) , m_scriptClass(scriptEngine->registerClass("Evaluator", nullptr, nullptr, JS_UNDEFINED, getEvalPropertyNames, getEvalPropertySafe)) { scriptEngine->registerEvaluator(this); scriptEngine->logger().storeWarnings(); } Evaluator::~Evaluator() { Set valuesToFree; for (const auto &data : std::as_const(m_scriptValueMap)) { const auto evalData = attachedPointer(data, m_scriptClass); valuesToFree << data; for (const JSValue cachedValue : evalData->valueCache) JS_FreeValue(m_scriptEngine->context(), cachedValue); evalData->item->removeObserver(this); delete evalData; } for (const auto &scopes : std::as_const(m_fileContextScopesMap)) { valuesToFree << scopes.fileScope; valuesToFree << scopes.importScope; } for (const JSValue v : std::as_const(valuesToFree)) { JS_FreeValue(m_scriptEngine->context(), v); } m_scriptEngine->unregisterEvaluator(this); } JSValue Evaluator::property(const Item *item, const QString &name) { return getJsProperty(m_scriptEngine->context(), scriptValue(item), name); } JSValue Evaluator::value(const Item *item, const QString &name, bool *propertyWasSet) { return evaluateProperty(item, name, propertyWasSet); } bool Evaluator::boolValue(const Item *item, const QString &name, bool *propertyWasSet) { const ScopedJsValue sv(m_scriptEngine->context(), value(item, name, propertyWasSet)); return JS_ToBool(m_scriptEngine->context(), sv); } int Evaluator::intValue(const Item *item, const QString &name, int defaultValue, bool *propertyWasSet) { const JSValue v = evaluateProperty(item, name, propertyWasSet); if (JS_IsUndefined(v)) return defaultValue; qint32 n; JS_ToInt32(m_scriptEngine->context(), &n, v); return n; } FileTags Evaluator::fileTagsValue(const Item *item, const QString &name, bool *propertySet) { return FileTags::fromStringList(stringListValue(item, name, propertySet)); } QString Evaluator::stringValue(const Item *item, const QString &name, const QString &defaultValue, bool *propertyWasSet) { const ScopedJsValue v(m_scriptEngine->context(), evaluateProperty(item, name, propertyWasSet)); return JS_IsUndefined(v) ? defaultValue : getJsString(m_scriptEngine->context(), v); } static QStringList toStringList(ScriptEngine *engine, const JSValue &scriptValue) { if (JS_IsString(scriptValue)) return {getJsString(engine->context(), scriptValue)}; if (JS_IsArray(scriptValue)) { QStringList lst; int i = 0; for (;;) { JSValue elem = JS_GetPropertyUint32(engine->context(), scriptValue, i++); if (JS_IsUndefined(elem)) break; lst.push_back(getJsString(engine->context(), elem)); JS_FreeValue(engine->context(), elem); } return lst; } return {}; } QStringList Evaluator::stringListValue(const Item *item, const QString &name, bool *propertyWasSet) { const auto result = optionalStringListValue(item, name, propertyWasSet); return result ? *result : QStringList(); } std::optional Evaluator::optionalStringListValue( const Item *item, const QString &name, bool *propertyWasSet) { const ScopedJsValue v(m_scriptEngine->context(), property(item, name)); handleEvaluationError(item, name); if (propertyWasSet) *propertyWasSet = isNonDefaultValue(item, name); if (JS_IsUndefined(v)) return std::nullopt; return toStringList(m_scriptEngine, v); } QVariant Evaluator::variantValue(const Item *item, const QString &name, bool *propertySet) { const ScopedJsValue jsValue(m_scriptEngine->context(), property(item, name)); handleEvaluationError(item, name); if (propertySet) *propertySet = isNonDefaultValue(item, name); return getJsVariant(m_scriptEngine->context(), jsValue); } bool Evaluator::isNonDefaultValue(const Item *item, const QString &name) const { const ValueConstPtr v = item->property(name); return v && (v->type() != Value::JSSourceValueType || !static_cast(v.get())->isBuiltinDefaultValue()); } void Evaluator::convertToPropertyType(const PropertyDeclaration &decl, const CodeLocation &loc, JSValue &v) { convertToPropertyType_impl( engine(), QString(), nullptr, decl, nullptr, loc, ConversionType::Full, v); } JSValue Evaluator::scriptValue(const Item *item) { JSValue &scriptValue = m_scriptValueMap[item]; if (JS_IsObject(scriptValue)) { // already initialized return scriptValue; } const auto edata = new EvaluationData; edata->item = item; edata->item->addObserver(this); scriptValue = JS_NewObjectClass(m_scriptEngine->context(), m_scriptClass); attachPointerTo(scriptValue, edata); return scriptValue; } void Evaluator::handleEvaluationError(const Item *item, const QString &name) { throwOnEvaluationError(m_scriptEngine, [&item, &name] () { const ValueConstPtr &value = item->property(name); return value ? value->location() : CodeLocation(); }); } JSValue Evaluator::evaluateProperty(const Item *item, const QString &name, bool *propertyWasSet) { const JSValue result = property(item, name); ScopedJsValue valMgr(m_scriptEngine->context(), result); handleEvaluationError(item, name); valMgr.release(); if (propertyWasSet) *propertyWasSet = isNonDefaultValue(item, name); return result; } Evaluator::FileContextScopes Evaluator::fileContextScopes(const FileContextConstPtr &file) { FileContextScopes &result = m_fileContextScopesMap[file]; if (!JS_IsObject(result.fileScope)) { if (file->idScope()) result.fileScope = scriptValue(file->idScope()); else result.fileScope = m_scriptEngine->newObject(); setJsProperty(m_scriptEngine->context(), result.fileScope, StringConstants::filePathGlobalVar(), file->filePath()); setJsProperty(m_scriptEngine->context(), result.fileScope, StringConstants::pathGlobalVar(), file->dirPath()); } if (!JS_IsObject(result.importScope)) { try { ScopedJsValue importScope(m_scriptEngine->context(), m_scriptEngine->newObject()); setupScriptEngineForFile(m_scriptEngine, file, importScope, ObserveMode::Enabled); result.importScope = importScope.release(); } catch (const ErrorInfo &e) { m_scriptEngine->setJsError(e); result.importScope = JS_UNINITIALIZED; } } return result; } // This is the only function in this class that can be called from a thread that is not // the evaluating one. For this reason, we do not clear the cache here, as that would // incur enourmous synchronization overhead. Instead, we mark the item's cache as invalidated // and do the actual clearing only at the very few places where the cache is actually accessed. void Evaluator::invalidateCache(const Item *item) { std::lock_guard lock(m_cacheInvalidationMutex); m_invalidatedCaches << item; } void Evaluator::clearCache(const Item *item) { std::lock_guard lock(m_cacheInvalidationMutex); if (const auto data = attachedPointer(m_scriptValueMap.value(item), m_scriptEngine->dataWithPtrClass())) { clearCache(*data); m_invalidatedCaches.remove(data->item); } } void Evaluator::clearCacheIfInvalidated(EvaluationData &edata) { std::lock_guard lock(m_cacheInvalidationMutex); if (const auto it = m_invalidatedCaches.find(edata.item); it != m_invalidatedCaches.end()) { clearCache(edata); m_invalidatedCaches.erase(it); } } void Evaluator::clearCache(EvaluationData &edata) { for (const auto value : std::as_const(edata.valueCache)) JS_FreeValue(m_scriptEngine->context(), value); edata.valueCache.clear(); } void throwOnEvaluationError(ScriptEngine *engine, const std::function &provideFallbackCodeLocation) { if (engine->checkForJsError(provideFallbackCodeLocation())) engine->throwAndClearJsError(); } static void makeTypeError(ScriptEngine *engine, const ErrorInfo &error, JSValue &v) { engine->setJsError(error); v = JS_UNINITIALIZED; } static void makeTypeError(ScriptEngine *engine, const PropertyDeclaration &decl, const CodeLocation &location, JSValue &v) { const ErrorInfo error(Tr::tr("Value assigned to property '%1' does not have type '%2'.") .arg(decl.name(), decl.typeString()), location); makeTypeError(engine, error, v); } static void convertToPropertyType_impl( ScriptEngine *engine, const QString &pathPropertiesBaseDir, const Item *item, const PropertyDeclaration &decl, const Value *value, const CodeLocation &location, ConversionType conversionType, JSValue &v) { JSContext * const ctx = engine->context(); if (JS_IsUninitialized(v) || JS_IsUndefined(v) || engine->checkForJsError({})) return; if (!decl.isScalar() && !JS_IsArray(v) && conversionType == ConversionType::ElementsOnly) { const auto correspondingType = [](const PropertyDeclaration &decl) { switch (decl.type()) { case PropertyDeclaration::StringList: return PropertyDeclaration::String; case PropertyDeclaration::PathList: return PropertyDeclaration::Path; case PropertyDeclaration::VariantList: return PropertyDeclaration::Variant; default: QBS_CHECK(false); }; }; PropertyDeclaration elemDecl = decl; elemDecl.setType(correspondingType(decl)); convertToPropertyType_impl( engine, pathPropertiesBaseDir, item, elemDecl, value, location, conversionType, v); } QString actualBaseDir; if (decl.type() == PropertyDeclaration::Path || decl.type() == PropertyDeclaration::PathList) { actualBaseDir = pathPropertiesBaseDir; if (const Item * const baseDirItem = value && value->scope() ? value->scope() : item) { if (actualBaseDir.isEmpty() && baseDirItem->type() == ItemType::Product) { if (const VariantValueConstPtr itemSourceDir = baseDirItem->variantProperty( StringConstants::sourceDirectoryProperty())) { actualBaseDir = itemSourceDir->value().toString(); } } } } switch (decl.type()) { case PropertyDeclaration::UnknownType: case PropertyDeclaration::Variant: break; case PropertyDeclaration::Boolean: if (!JS_IsBool(v)) v = JS_NewBool(ctx, JS_ToBool(ctx, v)); break; case PropertyDeclaration::Integer: if (!JS_IsNumber(v)) makeTypeError(engine, decl, location, v); break; case PropertyDeclaration::Path: if (!JS_IsString(v)) { makeTypeError(engine, decl, location, v); break; } if (!actualBaseDir.isEmpty()) { const QString rawPath = getJsString(ctx, v); v = engine->toScriptValue( QDir::cleanPath(FileInfo::resolvePath(actualBaseDir, rawPath))); JS_FreeValue(ctx, v); } break; case PropertyDeclaration::String: if (!JS_IsString(v)) makeTypeError(engine, decl, location, v); break; case PropertyDeclaration::PathList: case PropertyDeclaration::StringList: { if (!JS_IsArray(v)) { JSValue x = engine->newArray(1, JsValueOwner::ScriptEngine); JS_SetPropertyUint32(ctx, x, 0, JS_DupValue(ctx, v)); v = x; } const quint32 c = getJsIntProperty(ctx, v, StringConstants::lengthProperty()); for (quint32 i = 0; i < c; ++i) { const ScopedJsValue elem(ctx, JS_GetPropertyUint32(ctx, v, i)); if (JS_IsUndefined(elem)) { ErrorInfo error(Tr::tr("Element at index %1 of list property '%2' is undefined. " "String expected.").arg(i).arg(decl.name()), location); makeTypeError(engine, error, v); break; } if (JS_IsNull(elem)) { ErrorInfo error(Tr::tr("Element at index %1 of list property '%2' is null. " "String expected.").arg(i).arg(decl.name()), location); makeTypeError(engine, error, v); break; } if (!JS_IsString(elem)) { ErrorInfo error(Tr::tr("Element at index %1 of list property '%2' does not have " "string type.").arg(i).arg(decl.name()), location); makeTypeError(engine, error, v); break; } if (actualBaseDir.isEmpty()) continue; const QString rawPath = getJsString(ctx, elem); const JSValue newElem = engine->toScriptValue( QDir::cleanPath(FileInfo::resolvePath(actualBaseDir, rawPath))); JS_SetPropertyUint32(ctx, v, i, newElem); } break; } case PropertyDeclaration::VariantList: if (!JS_IsArray(v)) { JSValue x = engine->newArray(1, JsValueOwner::ScriptEngine); JS_SetPropertyUint32(ctx, x, 0, JS_DupValue(ctx, v)); v = x; } break; } } static int getEvalPropertyNames(JSContext *ctx, JSPropertyEnum **ptab, uint32_t *plen, JSValue obj) { ScriptEngine * const engine = ScriptEngine::engineForContext(ctx); const Evaluator * const evaluator = engine->evaluator(); const auto data = attachedPointer(obj, evaluator->classId()); if (!data) return -1; const Item::PropertyMap &map = data->item->properties(); *plen = map.size(); if (!map.isEmpty()) { *ptab = reinterpret_cast(js_malloc(ctx, *plen * sizeof **ptab)); JSPropertyEnum *entry = *ptab; for (auto it = map.cbegin(); it != map.cend(); ++it, ++entry) { entry->atom = JS_NewAtom(ctx, it.key().toUtf8().constData()); entry->is_enumerable = 1; } } else { *ptab = nullptr; } return 0; } static void convertToPropertyType( ScriptEngine *engine, const Item *item, const PropertyDeclaration &decl, const Value *value, ConversionType conversionType, JSValue &v) { if (value->type() == Value::VariantValueType && JS_IsUndefined(v) && !decl.isScalar()) { v = engine->newArray(0, JsValueOwner::ScriptEngine); // QTBUG-51237 return; } convertToPropertyType_impl( engine, engine->evaluator()->pathPropertiesBaseDir(), item, decl, value, value->location(), conversionType, v); } class PropertyStackManager { public: PropertyStackManager( const Item *itemOfProperty, const QString &name, const Value *value, std::stack &requestedProperties, PropertyDependencies &propertyDependencies, Evaluator::EvalStack &evalStack) : m_requestedProperties(requestedProperties) , m_evalStack(evalStack) { if (value->type() == Value::JSSourceValueType && (itemOfProperty->type() == ItemType::ModuleInstance || itemOfProperty->type() == ItemType::Module || itemOfProperty->type() == ItemType::Export)) { const VariantValueConstPtr varValue = itemOfProperty->variantProperty(StringConstants::nameProperty()); if (!varValue) return; m_stackUpdate = true; const QualifiedId fullPropName = QualifiedId::fromString(varValue->value().toString()) << name; if (!requestedProperties.empty()) propertyDependencies[fullPropName].insert(requestedProperties.top()); m_requestedProperties.push(fullPropName); } const auto matcher = [&](const std::tuple &prop) { return std::get<1>(prop) == itemOfProperty && std::get<2>(prop) == value; }; if (auto it = std::find_if(m_evalStack.cbegin(), m_evalStack.cend(), matcher); it != m_evalStack.cend()) { ErrorInfo error(Tr::tr("Property '%1' refers to itself.").arg(name), value->location()); for (auto it2 = std::next(it); it2 != m_evalStack.cend(); ++it2) { error.append( QString::fromLatin1(" via '%1'").arg(std::get<0>(*it2)), std::get<2>(*it2)->location()); } throw ErrorInfo(error); } m_evalStack.emplace_back(name, itemOfProperty, value); } ~PropertyStackManager() { if (m_stackUpdate) m_requestedProperties.pop(); m_evalStack.pop_back(); } private: std::stack &m_requestedProperties; Evaluator::EvalStack &m_evalStack; bool m_stackUpdate = false; }; class ValueEvaluator : ValueHandler { public: ValueEvaluator( Evaluator &evaluator, JSValue obj, const ValuePtr &v, const Item &item, const Item &itemOfProperty, const PropertyDeclaration &decl) : m_evaluator(evaluator) , m_engine(*evaluator.engine()) , m_object(obj) , m_value(*v) , m_item(item) , m_itemOfProperty(itemOfProperty) , m_decl(decl) { } JSValue eval() { JSValue result = m_value.apply(this); if (m_engine.checkForJsError(m_value.location())) return JS_UNDEFINED; if (JS_IsUninitialized(result)) result = JS_UNDEFINED; convertToPropertyType(&m_engine, &m_item, m_decl, &m_value, ConversionType::Full, result); return result; } private: class ScopeChain { public: ScopeChain(Evaluator &evaluator) : m_evaluator(evaluator) {} void pushScope(const JSValue &scope) { if (JS_IsObject(scope)) m_chain << scope; } void pushScopeRecursively(const Item *scope) { if (scope) { pushScopeRecursively(scope->scope()); pushScope(m_evaluator.scriptValue(scope)); } } qbs::Internal::span chain() const { return m_chain; } private: Evaluator &m_evaluator; QVarLengthArray m_chain; }; void setupConvenienceProperty(const QString &conveniencePropertyName, JSValue *extraScope, const JSValue &scriptValue) { if (!JS_IsObject(*extraScope)) *extraScope = m_engine.newObject(); const PropertyDeclaration::Type type = m_decl.type(); const bool isArray = type == PropertyDeclaration::StringList || type == PropertyDeclaration::PathList || type == PropertyDeclaration::Variant // TODO: Why? || type == PropertyDeclaration::VariantList; JSValue valueToSet = JS_DupValue(m_engine.context(), scriptValue); if (isArray && (JS_IsUninitialized(valueToSet) || JS_IsUndefined(valueToSet))) valueToSet = m_engine.newArray(0, JsValueOwner::Caller); setJsProperty(m_engine.context(), *extraScope, conveniencePropertyName, valueToSet); } JSValue createExtraScope(const JSSourceValue *value, Item *outerItem, JSValue *outerScriptValue) { JSValue extraScope = JS_UNINITIALIZED; if (value->sourceUsesBase()) { JSValue baseValue = JS_UNINITIALIZED; if (value->baseValue()) { baseValue = ValueEvaluator( m_evaluator, m_object, value->baseValue(), m_item, m_itemOfProperty, m_decl) .eval(); } setupConvenienceProperty(StringConstants::baseVar(), &extraScope, baseValue); } if (value->sourceUsesOuter()) { JSValue v = JS_UNINITIALIZED; bool doSetup = false; if (outerItem) { v = m_evaluator.property(outerItem, m_decl.name()); if (m_engine.checkForJsError(value->location())) return JS_UNINITIALIZED; doSetup = true; JS_FreeValue(m_engine.context(), v); } else if (outerScriptValue) { doSetup = true; v = *outerScriptValue; } if (doSetup) setupConvenienceProperty(StringConstants::outerVar(), &extraScope, v); } if (value->sourceUsesOriginal()) { JSValue originalJs = JS_UNINITIALIZED; ScopedJsValue originalMgr(m_engine.context(), JS_UNDEFINED); if (m_decl.isScalar()) { const Item *item = &m_itemOfProperty; if (item->type() != ItemType::ModuleInstance && item->type() != ItemType::ModuleInstancePlaceholder) { const QString errorMessage = Tr::tr("The special value 'original' can only " "be used with module properties."); m_engine.setJsError({errorMessage, value->location()}); return JS_UNINITIALIZED; } if (!value->scope()) { const QString errorMessage = Tr::tr("The special value 'original' cannot " "be used on the right-hand side of a property declaration."); m_engine.setJsError({errorMessage, value->location()}); return JS_UNINITIALIZED; } ValuePtr original; for (const ValuePtr &v : m_value.candidates()) { if (!v->scope()) { original = v; break; } } // This can happen when resolving shadow products. The error will be ignored // in that case. if (!original) { const QString errorMessage = Tr::tr("Error setting up 'original'."); m_engine.setJsError({errorMessage, value->location()}); return JS_UNINITIALIZED; } originalJs = ValueEvaluator(m_evaluator, m_object, original, m_item, *item, m_decl).eval(); } else { originalJs = m_engine.newArray(0, JsValueOwner::Caller); originalMgr.setValue(originalJs); } setupConvenienceProperty(StringConstants::originalVar(), &extraScope, originalJs); } return extraScope; } JSValue mergeValues(const JSValueList &lst) { JSValue result = m_engine.newArray(int(lst.size()), JsValueOwner::ScriptEngine); quint32 k = 0; JSContext * const ctx = m_engine.context(); for (const JSValue &v : std::as_const(lst)) { QBS_ASSERT(!JS_IsError(v), continue); if (JS_IsArray(v)) { const quint32 vlen = getJsIntProperty(ctx, v, StringConstants::lengthProperty()); for (quint32 j = 0; j < vlen; ++j) JS_SetPropertyUint32(ctx, result, k++, JS_GetPropertyUint32(ctx, v, j)); JS_FreeValue(ctx, v); } else { JS_SetPropertyUint32(ctx, result, k++, v); } } setJsProperty(ctx, result, StringConstants::lengthProperty(), JS_NewInt32(ctx, k)); return result; } JSValue handleAlternatives(JSSourceValue *value) { JSValue outerScriptValue = JS_UNDEFINED; JSValueList lst; for (const JSSourceValue::Alternative &alternative : value->alternatives()) { if (alternative.value->isFallback() && !lst.empty()) break; if (alternative.value->sourceUsesOuter() && !m_itemOfProperty.outerItem() && JS_IsUndefined(outerScriptValue)) { outerScriptValue = evaluateJSSourceValue(value, nullptr); if (m_engine.checkForJsError(alternative.value->location())) { const ScopedJsValueList l(m_engine.context(), lst); return JS_UNINITIALIZED; } } const JSValue v = evaluateJSSourceValue( alternative.value.get(), m_itemOfProperty.outerItem(), &alternative, value, &outerScriptValue); if (m_engine.checkForJsError(value->location())) return JS_UNINITIALIZED; if (JS_IsUninitialized(v)) continue; if (m_decl.isScalar()) return v; if (!JS_IsUndefined(v)) lst << JS_DupValue(m_engine.context(), v); } // If no Properties item matches, the unconditional value is always considered, // otherwise only if the property is a list property and the top-level value // was not created programmatically as a fallback. if (lst.empty() || !value->createdByPropertiesBlock()) { const JSValue v = evaluateJSSourceValue(value, m_itemOfProperty.outerItem()); if (m_engine.checkForJsError(value->location())) return JS_UNINITIALIZED; if (m_decl.isScalar()) return v; if (!JS_IsUninitialized(v) && !JS_IsUndefined(v)) lst << JS_DupValue(m_engine.context(), v); } return lst.empty() ? JS_UNINITIALIZED : mergeValues(lst); } JSValue mergeWithCandidates(const JSSourceValue *value, JSValue result) { if (value->candidates().empty()) return result; JSValueList lst; if (!JS_IsUninitialized(result) && !JS_IsUndefined(result)) lst << JS_DupValue(m_engine.context(), result); for (const ValuePtr &next : value->candidates()) { JSValue v = next->apply(this); if (m_engine.checkForJsError(next->location())) { const ScopedJsValueList l(m_engine.context(), lst); return JS_UNINITIALIZED; } if (JS_IsUninitialized(v) || JS_IsUndefined(v)) continue; convertToPropertyType( &m_engine, &m_item, m_decl, next.get(), ConversionType::ElementsOnly, v); lst.push_back(JS_DupValue(m_engine.context(), v)); } return lst.empty() ? result : mergeValues(lst); } JSValue doHandle(JSSourceValue *value) override { const JSValue result = handleAlternatives(value); if (m_engine.checkForJsError(value->location())) return JS_UNINITIALIZED; if (!JS_IsUninitialized(result) && value->isExclusiveListValue()) return result; if (m_decl.isScalar()) { if (!JS_IsUninitialized(result) || !value->createdByPropertiesBlock()) return result; for (const ValuePtr &candidate : value->candidates()) { const JSValue v = candidate->apply(this); if (!JS_IsUninitialized(v)) return v; } return JS_UNINITIALIZED; } return mergeWithCandidates(value, result); } JSValue evaluateJSSourceValue( const JSSourceValue *value, Item *outerItem, const JSSourceValue::Alternative *alternative = nullptr, JSSourceValue *elseCaseValue = nullptr, JSValue *outerScriptValue = nullptr) { QBS_ASSERT(!alternative || value == alternative->value.get(), return JS_UNINITIALIZED); for (Item *group = alternative ? alternative->value->scope() : nullptr; group && group->type() == ItemType::Group; group = group->parent()) { if (!m_evaluator.boolValue(group, StringConstants::conditionProperty())) return JS_UNINITIALIZED; } ScopeChain scopeChain(m_evaluator); const ScopedJsValue maybeExtraScope( m_engine.context(), createExtraScope(value, outerItem, outerScriptValue)); if (m_engine.checkForJsError(value->location())) return JS_UNINITIALIZED; const Evaluator::FileContextScopes fileCtxScopes = m_evaluator.fileContextScopes( value->file()); if (m_engine.checkForJsError(value->location())) return JS_UNINITIALIZED; scopeChain.pushScope(fileCtxScopes.fileScope); scopeChain.pushScopeRecursively(m_item.scope()); if ((m_itemOfProperty.type() != ItemType::ModuleInstance && m_itemOfProperty.type() != ItemType::ModuleInstancePlaceholder) || !value->scope()) { scopeChain.pushScope(m_object); } scopeChain.pushScopeRecursively(value->scope()); scopeChain.pushScope(maybeExtraScope); scopeChain.pushScope(fileCtxScopes.importScope); if (alternative) { ScopedJsValue sv( m_engine.context(), alternative->value->isFallback() ? JS_NewBool(m_engine.context(), 1) : m_engine.evaluate( JsValueOwner::Caller, alternative->condition.value, {}, 1, scopeChain.chain())); if (m_engine.checkForJsError(alternative->condition.location)) { // This handles cases like the following: // Depends { name: "cpp" } // Properties { // condition: qbs.targetOS.contains("darwin") // bundle.isBundle: false // } // On non-Darwin platforms, bundle never gets instantiated, and thus bundle.isBundle // has no scope, so the qbs item in the condition is not found. // TODO: Ideally, we would never evaluate values in placeholder items, but // there are currently several contexts where we do that, e.g. Export // and Group items. Perhaps change that, or try to collect all such // exceptions and don't try to evaluate other cases. if (m_itemOfProperty.type() == ItemType::ModuleInstancePlaceholder) { m_engine.getAndClearJsError(); return JS_UNDEFINED; } return JS_UNINITIALIZED; } // The condition is false. Try the next alternative or the else value. if (!JS_ToBool(m_engine.context(), sv)) return JS_UNINITIALIZED; sv.reset(m_engine.evaluate( JsValueOwner::Caller, alternative->overrideListProperties.value, {}, 1, scopeChain.chain())); if (m_engine.checkForJsError(alternative->overrideListProperties.location)) { return JS_UNINITIALIZED; } if (JS_ToBool(m_engine.context(), sv)) elseCaseValue->setIsExclusiveListValue(); } return m_engine.evaluate( JsValueOwner::ScriptEngine, value->sourceCodeForEvaluation(), value->file()->filePath(), value->line(), scopeChain.chain()); } JSValue doHandle(ItemValue *value) override { const JSValue result = m_evaluator.scriptValue(value->item()); if (JS_IsUninitialized(result)) qDebug() << "SVConverter returned invalid script value."; return result; } JSValue doHandle(VariantValue *variantValue) override { const JSValue result = m_engine.toScriptValue(variantValue->value(), variantValue->id()); m_engine.takeOwnership(result); return result; } Evaluator &m_evaluator; ScriptEngine &m_engine; const JSValue m_object; Value &m_value; const Item &m_item; const Item &m_itemOfProperty; const PropertyDeclaration m_decl; }; static QString resultToString(JSContext *ctx, const JSValue &scriptValue) { if (JS_IsUndefined(scriptValue)) return QLatin1String("undefined"); if (JS_IsArray(scriptValue)) return getJsStringList(ctx, scriptValue).join(QLatin1Char(',')); if (JS_IsObject(scriptValue)) { return QStringLiteral("[Object: ") + QString::number(jsObjectId(scriptValue)) + QLatin1Char(']'); } return getJsVariant(ctx, scriptValue).toString(); } struct EvalResult { JSValue v = JS_UNDEFINED; bool found = false; }; static EvalResult getEvalProperty( Evaluator &evaluator, JSValue obj, const Item *item, const QString &name, EvaluationData *data) { ScriptEngine &engine = *evaluator.engine(); const bool isModuleInstance = item->type() == ItemType::ModuleInstance || item->type() == ItemType::ModuleInstancePlaceholder; for (; item; item = item->prototype()) { if (isModuleInstance && (item->type() == ItemType::Module || item->type() == ItemType::Export)) { break; // There's no property in a prototype that's not also in the instance. } const ValuePtr value = item->ownProperty(name); if (!value) continue; const Item * const itemOfProperty = item; // The item that owns the property. PropertyStackManager propStackmanager( itemOfProperty, name, value.get(), evaluator.requestedProperties(), evaluator.propertyDependencies(), evaluator.evalStack()); if (evaluator.cachingEnabled()) { evaluator.clearCacheIfInvalidated(*data); const auto result = data->valueCache.constFind(name); if (result != data->valueCache.constEnd()) { if (debugProperties) qDebug() << "[SC] cache hit " << name << ": " << resultToString(engine.context(), *result); return {*result, true}; } } const JSValue result = ValueEvaluator( evaluator, obj, value, *data->item, *itemOfProperty, itemOfProperty->propertyDeclaration(name)) .eval(); if (debugProperties) qDebug() << "[SC] cache miss " << name << ": " << resultToString(engine.context(), result); if (evaluator.cachingEnabled()) { evaluator.clearCacheIfInvalidated(*data); const auto it = data->valueCache.find(name); if (it != data->valueCache.end()) { JS_FreeValue(engine.context(), it.value()); it.value() = JS_DupValue(engine.context(), result); } else { data->valueCache.insert(name, JS_DupValue(engine.context(), result)); } } return {result, true}; } return {JS_UNDEFINED, false}; } static int getEvalProperty(JSContext *ctx, JSPropertyDescriptor *desc, JSValue obj, JSAtom prop) { if (desc) { desc->getter = desc->setter = desc->value = JS_UNDEFINED; desc->flags = JS_PROP_ENUMERABLE; } ScriptEngine &engine = *ScriptEngine::engineForContext(ctx); Evaluator &evaluator = *engine.evaluator(); const auto data = attachedPointer(obj, evaluator.classId()); const QString name = getJsString(ctx, prop); if (debugProperties) qDebug() << "[SC] queryProperty " << jsObjectId(obj) << " " << name; if (name == QStringLiteral("parent")) { if (desc) { Item * const parent = data->item->parent(); desc->value = parent ? JS_DupValue(ctx, evaluator.scriptValue(data->item->parent())) : JS_UNDEFINED; } return 1; } if (!data) { if (debugProperties) qDebug() << "[SC] queryProperty: no data attached"; engine.setLastLookupStatus(false); return -1; } EvalResult result = getEvalProperty(evaluator, obj, data->item, name, data); if (!result.found && data->item->parent()) { if (debugProperties) qDebug() << "[SC] queryProperty: query parent"; const Item * const parentItem = data->item->parent(); result = getEvalProperty( evaluator, evaluator.scriptValue(parentItem), parentItem, name, data); } if (result.found) { if (desc) desc->value = JS_DupValue(ctx, result.v); engine.setLastLookupStatus(true); return 1; } if (debugProperties) qDebug() << "[SC] queryProperty: no such property"; engine.setLastLookupStatus(false); return 0; } static int getEvalPropertySafe(JSContext *ctx, JSPropertyDescriptor *desc, JSValue obj, JSAtom prop) { try { return getEvalProperty(ctx, desc, obj, prop); } catch (const ErrorInfo &e) { ScopedJsValue error(ctx, throwError(ctx, e.toString())); return -1; } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/builtindeclarations.h0000644000175100017510000000675715154533055023470 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_BUILTINDECLARATIONS_H #define QBS_BUILTINDECLARATIONS_H #include "itemdeclaration.h" #include "itemtype.h" #include #include #include #include #include namespace qbs { namespace Internal { class BuiltinDeclarations { public: static const BuiltinDeclarations &instance(); Version languageVersion() const; QStringList allTypeNames() const; ItemDeclaration declarationsForType(ItemType type) const; ItemType typeForName(const QString &typeName, const CodeLocation &location = CodeLocation()) const; QString nameForType(ItemType itemType) const; QStringList argumentNamesForScriptFunction(ItemType itemType, const QString &scriptName) const; protected: BuiltinDeclarations(); private: void insert(const ItemDeclaration &decl); void addArtifactItem(); void addDependsItem(); void addExportItem(); void addFileTaggerItem(); void addGroupItem(); void addJobLimitItem(); void addModuleItem(); void addModuleProviderItem(); static ItemDeclaration moduleLikeItem(ItemType type); void addProbeItem(); void addProductItem(); void addProfileItem(); void addProjectItem(); void addPropertiesItem(); void addPropertyOptionsItem(); void addRuleItem(); void addSubprojectItem(); void addTransformerItem(); void addScannerItem(); const Version m_languageVersion; QMap m_builtins; const QHash m_typeMap; }; } // namespace Internal } // namespace qbs #endif // QBS_BUILTINDECLARATIONS_H qbs-src-3.2.0/src/lib/corelib/language/builtindeclarations.cpp0000644000175100017510000007021115154533055024005 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "builtindeclarations.h" #include "deprecationinfo.h" #include #include #include #include #include #include #include namespace qbs { namespace Internal { class AClassWithPublicConstructor : public BuiltinDeclarations { }; Q_GLOBAL_STATIC(AClassWithPublicConstructor, theInstance) const char QBS_LANGUAGE_VERSION[] = "1.0"; BuiltinDeclarations::BuiltinDeclarations() : m_languageVersion(Version::fromString(QLatin1String(QBS_LANGUAGE_VERSION))) , m_typeMap(std::initializer_list>({ { QStringLiteral("Artifact"), ItemType::Artifact }, { QStringLiteral("Depends"), ItemType::Depends }, { QStringLiteral("Export"), ItemType::Export }, { QStringLiteral("FileTagger"), ItemType::FileTagger }, { QStringLiteral("Group"), ItemType::Group }, { QStringLiteral("JobLimit"), ItemType::JobLimit }, { QStringLiteral("Module"), ItemType::Module }, { QStringLiteral("ModuleProvider"), ItemType::ModuleProvider }, { QStringLiteral("Parameter"), ItemType::Parameter }, { QStringLiteral("Parameters"), ItemType::Parameters }, { QStringLiteral("Probe"), ItemType::Probe }, { QStringLiteral("Product"), ItemType::Product }, { QStringLiteral("Profile"), ItemType::Profile }, { QStringLiteral("Project"), ItemType::Project }, { QStringLiteral("Properties"), ItemType::Properties }, // Callers have to handle the SubProject case. { QStringLiteral("PropertyOptions"), ItemType::PropertyOptions }, { QStringLiteral("Rule"), ItemType::Rule }, { QStringLiteral("Scanner"), ItemType::Scanner }, { QStringLiteral("SubProject"), ItemType::SubProject }, { QStringLiteral("Transformer"), ItemType::Transformer } })) { addArtifactItem(); addDependsItem(); addExportItem(); addFileTaggerItem(); addGroupItem(); addJobLimitItem(); addModuleItem(); addModuleProviderItem(); addProbeItem(); addProductItem(); addProfileItem(); addProjectItem(); addPropertiesItem(); addPropertyOptionsItem(); addRuleItem(); addSubprojectItem(); addTransformerItem(); addScannerItem(); } const BuiltinDeclarations &BuiltinDeclarations::instance() { return *theInstance; } Version BuiltinDeclarations::languageVersion() const { return m_languageVersion; } QStringList BuiltinDeclarations::allTypeNames() const { return m_typeMap.keys(); } ItemDeclaration BuiltinDeclarations::declarationsForType(ItemType type) const { return m_builtins.value(type); } ItemType BuiltinDeclarations::typeForName(const QString &typeName, const CodeLocation &location) const { const auto it = m_typeMap.constFind(typeName); if (it == m_typeMap.constEnd()) throw ErrorInfo(Tr::tr("Unexpected item type '%1'.").arg(typeName), location); return it.value(); } QString BuiltinDeclarations::nameForType(ItemType itemType) const { // Iterating is okay here, as this mapping is not used in hot code paths. if (itemType == ItemType::PropertiesInSubProject) return QStringLiteral("Properties"); for (auto it = m_typeMap.constBegin(); it != m_typeMap.constEnd(); ++it) { if (it.value() == itemType) return it.key(); } QBS_CHECK(false); return {}; } QStringList BuiltinDeclarations::argumentNamesForScriptFunction(ItemType itemType, const QString &scriptName) const { const ItemDeclaration itemDecl = declarationsForType(itemType); const auto properties = itemDecl.properties(); for (const PropertyDeclaration &propDecl : properties) { if (propDecl.name() == scriptName) return propDecl.functionArgumentNames(); } QBS_CHECK(false); return {}; } void BuiltinDeclarations::insert(const ItemDeclaration &decl) { m_builtins.insert(decl.type(), decl); } static PropertyDeclaration conditionProperty() { return { StringConstants::conditionProperty(), PropertyDeclaration::Boolean, StringConstants::trueValue()}; } static PropertyDeclaration alwaysRunProperty() { return { StringConstants::alwaysRunProperty(), PropertyDeclaration::Boolean, StringConstants::falseValue()}; } static PropertyDeclaration nameProperty() { return {StringConstants::nameProperty(), PropertyDeclaration::String}; } static PropertyDeclaration buildDirProperty() { return {StringConstants::buildDirectoryProperty(), PropertyDeclaration::Path}; } static PropertyDeclaration prepareScriptProperty() { PropertyDeclaration decl(StringConstants::prepareProperty(), PropertyDeclaration::Variant, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); decl.setFunctionArgumentNames( QStringList() << StringConstants::projectVar() << StringConstants::productValue() << StringConstants::inputsVar() << StringConstants::outputsVar() << StringConstants::inputVar() << StringConstants::outputVar() << StringConstants::explicitlyDependsOnVar()); return decl; } static PropertyDeclaration priorityProperty() { return {StringConstants::priorityProperty(), PropertyDeclaration::Integer}; } void BuiltinDeclarations::addArtifactItem() { ItemDeclaration item(ItemType::Artifact); PropertyDeclaration conditionDecl = conditionProperty(); conditionDecl.setDeprecationInfo(DeprecationInfo(Version(1, 4), Tr::tr("If you need " "dynamic artifacts, use the Rule.outputArtifacts script instead of Artifact items."))); item << conditionDecl; PropertyDeclaration fileNameDecl(StringConstants::fileNameProperty(), PropertyDeclaration::String); fileNameDecl.setDeprecationInfo(DeprecationInfo(Version(1, 4), Tr::tr("Please use 'filePath' instead."))); item << fileNameDecl; item << PropertyDeclaration(StringConstants::filePathProperty(), PropertyDeclaration::String); item << PropertyDeclaration(StringConstants::fileTagsProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration(StringConstants::alwaysUpdatedProperty(), PropertyDeclaration::Boolean, StringConstants::trueValue()); insert(item); } void BuiltinDeclarations::addDependsItem() { ItemDeclaration item(ItemType::Depends); item << conditionProperty(); item << nameProperty(); item << PropertyDeclaration(StringConstants::submodulesProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration( StringConstants::minimalProperty(), PropertyDeclaration::Boolean, StringConstants::falseValue()); item << PropertyDeclaration(StringConstants::requiredProperty(), PropertyDeclaration::Boolean, StringConstants::trueValue()); item << PropertyDeclaration(StringConstants::versionAtLeastProperty(), PropertyDeclaration::String); item << PropertyDeclaration(StringConstants::versionBelowProperty(), PropertyDeclaration::String); item << PropertyDeclaration(StringConstants::profilesProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration(StringConstants::productTypesProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration(StringConstants::limitToSubProjectProperty(), PropertyDeclaration::Boolean, StringConstants::falseValue()); item << PropertyDeclaration( StringConstants::multiplexConfigurationIdsProperty(), PropertyDeclaration::StringList, QString(), PropertyDeclaration::ReadOnlyFlag); insert(item); } void BuiltinDeclarations::addExportItem() { ItemDeclaration item = moduleLikeItem(ItemType::Export); item << PropertyDeclaration(StringConstants::prefixMappingProperty(), PropertyDeclaration::Variant); auto allowedChildTypes = item.allowedChildTypes(); allowedChildTypes.insert(ItemType::Properties); item.setAllowedChildTypes(allowedChildTypes); insert(item); } void BuiltinDeclarations::addFileTaggerItem() { ItemDeclaration item(ItemType::FileTagger); item << conditionProperty(); item << PropertyDeclaration(StringConstants::patternsProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration(StringConstants::fileTagsProperty(), PropertyDeclaration::StringList); item << priorityProperty(); insert(item); } void BuiltinDeclarations::addGroupItem() { ItemDeclaration item(ItemType::Group); item.setAllowedChildTypes( {ItemType::Depends, ItemType::FileTagger, ItemType::Group, ItemType::Rule, ItemType::Scanner}); item << conditionProperty(); item << PropertyDeclaration(StringConstants::nameProperty(), PropertyDeclaration::String, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); item << PropertyDeclaration(StringConstants::filesProperty(), PropertyDeclaration::PathList, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); item << PropertyDeclaration(StringConstants::fileTagsFilterProperty(), PropertyDeclaration::StringList, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); item << PropertyDeclaration(StringConstants::excludeFilesProperty(), PropertyDeclaration::PathList, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); item << PropertyDeclaration(StringConstants::fileTagsProperty(), PropertyDeclaration::StringList, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); item << PropertyDeclaration(StringConstants::prefixProperty(), PropertyDeclaration::String, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); item << PropertyDeclaration(StringConstants::overrideTagsProperty(), PropertyDeclaration::Boolean, StringConstants::trueValue(), PropertyDeclaration::PropertyNotAvailableInConfig); item << PropertyDeclaration(StringConstants::filesAreTargetsProperty(), PropertyDeclaration::Boolean, StringConstants::falseValue(), PropertyDeclaration::PropertyNotAvailableInConfig); insert(item); } void BuiltinDeclarations::addJobLimitItem() { ItemDeclaration item(ItemType::JobLimit); item << conditionProperty(); item << PropertyDeclaration(StringConstants::jobPoolProperty(), PropertyDeclaration::String); item << PropertyDeclaration(StringConstants::jobCountProperty(), PropertyDeclaration::Integer); insert(item); } void BuiltinDeclarations::addModuleItem() { ItemDeclaration item = moduleLikeItem(ItemType::Module); item << priorityProperty(); insert(item); } void BuiltinDeclarations::addModuleProviderItem() { ItemDeclaration item(ItemType::ModuleProvider); item << nameProperty() << conditionProperty() << PropertyDeclaration(QStringLiteral("outputBaseDir"), PropertyDeclaration::String) << PropertyDeclaration(StringConstants::isEagerProperty(), PropertyDeclaration::Boolean, StringConstants::trueValue()) << PropertyDeclaration(StringConstants::moduleNameProperty(), PropertyDeclaration::String) << PropertyDeclaration(QStringLiteral("relativeSearchPaths"), PropertyDeclaration::StringList); item.setAllowedChildTypes({ItemType::PropertyOptions, ItemType::Probe}); insert(item); } ItemDeclaration BuiltinDeclarations::moduleLikeItem(ItemType type) { ItemDeclaration item(type); item.setAllowedChildTypes({ItemType::Depends, ItemType::FileTagger, ItemType::Group, ItemType::JobLimit, ItemType::Parameter, ItemType::Parameters, ItemType::Probe, ItemType::PropertyOptions, ItemType::Rule, ItemType::Scanner}); PropertyDeclaration nameDecl = nameProperty(); PropertyDeclaration::Flags nameFlags = nameDecl.flags(); nameFlags |= PropertyDeclaration::ReadOnlyFlag; nameDecl.setFlags(nameFlags); item << nameDecl; item << conditionProperty(); PropertyDeclaration setupBuildEnvDecl(StringConstants::setupBuildEnvironmentProperty(), PropertyDeclaration::Variant, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); setupBuildEnvDecl.setFunctionArgumentNames(QStringList{StringConstants::projectVar(), StringConstants::productVar()}); item << setupBuildEnvDecl; PropertyDeclaration setupRunEnvDecl(StringConstants::setupRunEnvironmentProperty(), PropertyDeclaration::Variant, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); setupRunEnvDecl.setFunctionArgumentNames(QStringList{StringConstants::projectVar(), StringConstants::productVar()}); item << setupRunEnvDecl; item << PropertyDeclaration(StringConstants::validateProperty(), PropertyDeclaration::Boolean, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); item << PropertyDeclaration(StringConstants::additionalProductTypesProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration(StringConstants::versionProperty(), PropertyDeclaration::String); item << PropertyDeclaration(StringConstants::presentProperty(), PropertyDeclaration::Boolean, StringConstants::trueValue()); return item; } void BuiltinDeclarations::addProbeItem() { ItemDeclaration item(ItemType::Probe); item << conditionProperty(); item << PropertyDeclaration(StringConstants::foundProperty(), PropertyDeclaration::Boolean, StringConstants::falseValue()); item << PropertyDeclaration(StringConstants::configureProperty(), PropertyDeclaration::Variant, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); insert(item); } void BuiltinDeclarations::addProductItem() { ItemDeclaration item(ItemType::Product); item.setAllowedChildTypes( {ItemType::Depends, ItemType::Export, ItemType::FileTagger, ItemType::Group, ItemType::JobLimit, ItemType::Probe, ItemType::Profile, ItemType::PropertyOptions, ItemType::Rule, ItemType::Scanner}); item << conditionProperty(); item << PropertyDeclaration(StringConstants::typeProperty(), PropertyDeclaration::StringList, StringConstants::emptyArrayValue()); item << nameProperty(); item << PropertyDeclaration(StringConstants::builtByDefaultProperty(), PropertyDeclaration::Boolean, StringConstants::trueValue()); PropertyDeclaration profilesDecl(StringConstants::profilesProperty(), PropertyDeclaration::StringList); profilesDecl.setDeprecationInfo(DeprecationInfo(Version::fromString(QStringLiteral("1.9.0")), Tr::tr("Use qbs.profiles instead."))); item << profilesDecl; item << PropertyDeclaration(StringConstants::targetNameProperty(), PropertyDeclaration::String, QStringLiteral("new String(name)" ".replace(/[/\\\\?%*:|\"<>]/g, '_').valueOf()")); item << buildDirProperty(); item << PropertyDeclaration(StringConstants::destinationDirProperty(), PropertyDeclaration::String, StringConstants::buildDirectoryProperty()); item << PropertyDeclaration(StringConstants::consoleApplicationProperty(), PropertyDeclaration::Boolean); item << PropertyDeclaration(StringConstants::filesProperty(), PropertyDeclaration::PathList, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); item << PropertyDeclaration(StringConstants::excludeFilesProperty(), PropertyDeclaration::PathList, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); item << PropertyDeclaration(StringConstants::qbsSearchPathsProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration(StringConstants::versionProperty(), PropertyDeclaration::String); item << PropertyDeclaration(StringConstants::multiplexByQbsPropertiesProperty(), PropertyDeclaration::StringList, QStringLiteral("[\"profiles\"]")); item << PropertyDeclaration(StringConstants::multiplexedTypeProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration(StringConstants::aggregateProperty(), PropertyDeclaration::Boolean); item << PropertyDeclaration(StringConstants::multiplexedProperty(), PropertyDeclaration::Boolean, QString(), PropertyDeclaration::ReadOnlyFlag); item << PropertyDeclaration(StringConstants::multiplexConfigurationIdProperty(), PropertyDeclaration::String, QString(), PropertyDeclaration::ReadOnlyFlag); item << PropertyDeclaration(StringConstants::qbsModuleProviders(), PropertyDeclaration::StringList); insert(item); } void BuiltinDeclarations::addProfileItem() { ItemDeclaration item(ItemType::Profile); item << conditionProperty(); item << nameProperty(); item << PropertyDeclaration(StringConstants::baseProfileProperty(), PropertyDeclaration::String); insert(item); } void BuiltinDeclarations::addProjectItem() { ItemDeclaration item(ItemType::Project); item.setAllowedChildTypes(ItemDeclaration::TypeNames() << ItemType::Project << ItemType::PropertyOptions << ItemType::SubProject << ItemType::Product << ItemType::Profile << ItemType::Probe << ItemType::FileTagger << ItemType::JobLimit << ItemType::Rule); item << nameProperty(); item << conditionProperty(); item << buildDirProperty(); item << PropertyDeclaration(StringConstants::minimumQbsVersionProperty(), PropertyDeclaration::String); item << PropertyDeclaration(StringConstants::sourceDirectoryProperty(), PropertyDeclaration::Path); item << PropertyDeclaration(StringConstants::profileProperty(), PropertyDeclaration::String); item << PropertyDeclaration(StringConstants::referencesProperty(), PropertyDeclaration::PathList, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); item << PropertyDeclaration(StringConstants::qbsSearchPathsProperty(), PropertyDeclaration::StringList, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); item << PropertyDeclaration(StringConstants::qbsModuleProviders(), PropertyDeclaration::StringList); insert(item); } void BuiltinDeclarations::addPropertiesItem() { ItemDeclaration item(ItemType::Properties); item << conditionProperty(); insert(item); } void BuiltinDeclarations::addPropertyOptionsItem() { ItemDeclaration item(ItemType::PropertyOptions); item << nameProperty(); item << PropertyDeclaration(StringConstants::allowedValuesProperty(), PropertyDeclaration::Variant); item << PropertyDeclaration(StringConstants::descriptionProperty(), PropertyDeclaration::String); item << PropertyDeclaration(StringConstants::removalVersionProperty(), PropertyDeclaration::String); insert(item); } void BuiltinDeclarations::addRuleItem() { ItemDeclaration item(ItemType::Rule); item.setAllowedChildTypes(ItemDeclaration::TypeNames() << ItemType::Artifact); item << conditionProperty(); item << alwaysRunProperty(); item << PropertyDeclaration(StringConstants::multiplexProperty(), PropertyDeclaration::Boolean, StringConstants::falseValue()); item << PropertyDeclaration(StringConstants::requiresInputsProperty(), PropertyDeclaration::Boolean); item << nameProperty(); item << PropertyDeclaration(StringConstants::inputsProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration(StringConstants::outputFileTagsProperty(), PropertyDeclaration::StringList); PropertyDeclaration outputArtifactsDecl(StringConstants::outputArtifactsProperty(), PropertyDeclaration::Variant, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); outputArtifactsDecl.setFunctionArgumentNames( QStringList() << StringConstants::projectVar() << StringConstants::productVar() << StringConstants::inputsVar() << StringConstants::inputVar()); item << outputArtifactsDecl; PropertyDeclaration usingsDecl(QStringLiteral("usings"), PropertyDeclaration::StringList); usingsDecl.setDeprecationInfo(DeprecationInfo(Version(1, 5), Tr::tr("Use 'inputsFromDependencies' instead"))); item << usingsDecl; item << PropertyDeclaration(StringConstants::inputsFromDependenciesProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration(StringConstants::auxiliaryInputsProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration( StringConstants::auxiliaryInputsFromDependenciesProperty(), PropertyDeclaration::StringList); PropertyDeclaration excludedAuxInputs(StringConstants::excludedAuxiliaryInputsProperty(), PropertyDeclaration::StringList); excludedAuxInputs.setDeprecationInfo(DeprecationInfo(Version(1, 14), Tr::tr("Use 'excludedInputs' instead"))); item << excludedAuxInputs; item << PropertyDeclaration(StringConstants::excludedInputsProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration(StringConstants::explicitlyDependsOnProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration(StringConstants::explicitlyDependsOnFromDependenciesProperty(), PropertyDeclaration::StringList); item << prepareScriptProperty(); insert(item); } void BuiltinDeclarations::addSubprojectItem() { ItemDeclaration item(ItemType::SubProject); item.setAllowedChildTypes(ItemDeclaration::TypeNames() << ItemType::Project // needed, because we're adding this internally << ItemType::PropertiesInSubProject << ItemType::PropertyOptions); item << conditionProperty(); item << PropertyDeclaration(StringConstants::filePathProperty(), PropertyDeclaration::Path); item << PropertyDeclaration(StringConstants::inheritPropertiesProperty(), PropertyDeclaration::Boolean, StringConstants::trueValue()); insert(item); } void BuiltinDeclarations::addTransformerItem() { ItemDeclaration item(ItemType::Transformer); item.setDeprecationInfo(DeprecationInfo(Version(1, 7), Tr::tr("Use the 'Rule' item instead."))); item.setAllowedChildTypes(ItemDeclaration::TypeNames() << ItemType::Artifact); item << conditionProperty(); item << alwaysRunProperty(); item << PropertyDeclaration(StringConstants::inputsProperty(), PropertyDeclaration::PathList); item << prepareScriptProperty(); item << PropertyDeclaration(StringConstants::explicitlyDependsOnProperty(), PropertyDeclaration::StringList); insert(item); } void BuiltinDeclarations::addScannerItem() { ItemDeclaration item(ItemType::Scanner); item << conditionProperty(); item << PropertyDeclaration(StringConstants::inputsProperty(), PropertyDeclaration::StringList); item << PropertyDeclaration(StringConstants::recursiveProperty(), PropertyDeclaration::Boolean, StringConstants::falseValue()); PropertyDeclaration searchPaths(StringConstants::searchPathsProperty(), PropertyDeclaration::StringList); searchPaths.setFunctionArgumentNames( QStringList() << StringConstants::projectVar() << StringConstants::productVar() << StringConstants::inputVar()); item << searchPaths; PropertyDeclaration scan(StringConstants::scanProperty(), PropertyDeclaration::Variant, QString(), PropertyDeclaration::PropertyNotAvailableInConfig); scan.setFunctionArgumentNames( QStringList() << StringConstants::projectVar() << StringConstants::productVar() << StringConstants::inputVar() << StringConstants::filePathVar()); item << scan; insert(item); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/language/filecontextbase.h0000644000175100017510000000566015154533055022600 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_FILECONTEXTBASE_H #define QBS_FILECONTEXTBASE_H #include "jsimports.h" namespace qbs { namespace Internal { class FileContextBase { public: void setFilePath(const QString &filePath) { m_filePath = filePath; } QString filePath() const { return m_filePath; } void addJsImport(const JsImport &jsImport) { m_jsImports.push_back(jsImport); } const JsImports &jsImports() const { return m_jsImports; } void addJsExtension(const QString &extension) { m_jsExtensions << extension; } QStringList jsExtensions() const { return m_jsExtensions; } void setSearchPaths(const QStringList &paths) { m_searchPaths = paths; } QStringList searchPaths() const { return m_searchPaths; } QString dirPath() const; protected: FileContextBase() = default; FileContextBase(const FileContextBase &other) = default; FileContextBase(FileContextBase &&other) = default; QString m_filePath; JsImports m_jsImports; QStringList m_jsExtensions; QStringList m_searchPaths; }; } // namespace Internal } // namespace qbs #endif // QBS_FILECONTEXTBASE_H qbs-src-3.2.0/src/lib/corelib/language/propertymapinternal.cpp0000644000175100017510000001001215154533055024056 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "propertymapinternal.h" #include #include #include namespace qbs { namespace Internal { /*! * \class PropertyMapInternal * \brief The \c PropertyMapInternal class contains a set of properties and their values. * An instance of this class is attached to every \c ResolvedProduct. * \c ResolvedGroups inherit their properties from the respective \c ResolvedProduct, \c SourceArtifacts * inherit theirs from the respective \c ResolvedGroup. \c ResolvedGroups can override the value of an * inherited property, \c SourceArtifacts cannot. If a property value is overridden, a new * \c PropertyMapInternal object is allocated, otherwise the pointer is shared. * \sa ResolvedGroup * \sa ResolvedProduct * \sa SourceArtifact */ PropertyMapInternal::PropertyMapInternal() = default; PropertyMapInternal::PropertyMapInternal(const PropertyMapInternal &other) = default; QVariant PropertyMapInternal::moduleProperty(const QString &moduleName, const QString &key, bool *isPresent) const { return ::qbs::Internal::moduleProperty(m_value, moduleName, key, isPresent); } QVariant PropertyMapInternal::qbsPropertyValue(const QString &key) const { return moduleProperty(StringConstants::qbsModule(), key); } QVariant PropertyMapInternal::property(const QStringList &name) const { return getConfigProperty(m_value, name); } void PropertyMapInternal::setValue(const QVariantMap &map) { m_value = map; } QVariant moduleProperty(const QVariantMap &properties, const QString &moduleName, const QString &key, bool *isPresent) { const auto moduleIt = properties.find(moduleName); if (moduleIt == properties.end()) { if (isPresent) *isPresent = false; return {}; } const QVariantMap &moduleMap = moduleIt.value().toMap(); const auto propertyIt = moduleMap.find(key); if (propertyIt == moduleMap.end()) { if (isPresent) *isPresent = false; return {}; } if (isPresent) *isPresent = true; return propertyIt.value(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/qbs.h0000644000175100017510000000524515154533055016422 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_H #define QBS_H #include "api/jobs.h" #include "api/languageinfo.h" #include "api/project.h" #include "api/projectdata.h" #include "api/rulecommand.h" #include "api/runenvironment.h" #include "logging/ilogsink.h" #include "tools/architectures.h" #include "tools/buildoptions.h" #include "tools/cleanoptions.h" #include "tools/codelocation.h" #include "tools/commandechomode.h" #include "tools/error.h" #include "tools/generateoptions.h" #include "tools/installoptions.h" #include "tools/preferences.h" #include "tools/processresult.h" #include "tools/profile.h" #include "tools/projectgeneratormanager.h" #include "tools/settings.h" #include "tools/settingsmodel.h" #include "tools/settingsrepresentation.h" #include "tools/setupprojectparameters.h" #include "tools/toolchains.h" #include "tools/version.h" #endif // QBS_H qbs-src-3.2.0/src/lib/corelib/logging/0000755000175100017510000000000015154533055017104 5ustar runnerrunnerqbs-src-3.2.0/src/lib/corelib/logging/logger.cpp0000644000175100017510000001373115154533055021074 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #if defined(_MSC_VER) && _MSC_VER > 0 #define _CRT_SECURE_NO_WARNINGS #endif #include "logger.h" #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { LogWriter::LogWriter(ILogSink *logSink, LoggerLevel level, bool force) : m_logSink(logSink), m_level(level), m_force(force) {} LogWriter::LogWriter(const LogWriter &other) : m_logSink(other.m_logSink) , m_level(other.m_level) , m_message(other.m_message) , m_tag(other.m_tag) , m_force(other.m_force) { other.m_message.clear(); } LogWriter::~LogWriter() { if (!m_message.isEmpty()) m_logSink->printMessage(m_level, m_message, m_tag, m_force); } const LogWriter &LogWriter::operator=(const LogWriter &other) { if (this == &other) // Self assignment guard. return *this; m_logSink = other.m_logSink; m_level = other.m_level; m_message = other.m_message; m_tag = other.m_tag; m_force = other.m_force; other.m_message.clear(); return *this; } void LogWriter::write(char c) { write(QLatin1Char(c)); } void LogWriter::write(const char *str) { write(QLatin1String(str)); } void LogWriter::write(const QChar &c) { if (m_force || m_logSink->logLevel() >= m_level) m_message.append(c); } void LogWriter::write(const QString &message) { if (m_force || m_logSink->logLevel() >= m_level) m_message += message; } void LogWriter::setMessageTag(const QString &tag) { m_tag = tag; } LogWriter operator<<(LogWriter w, const char *str) { w.write(str); return w; } LogWriter operator<<(LogWriter w, const QByteArray &byteArray) { w.write(byteArray.data()); return w; } LogWriter operator<<(LogWriter w, const QString &str) { w.write(str); return w; } LogWriter operator<<(LogWriter w, const QStringList &strList) { w.write('['); for (int i = 0; i < strList.size(); ++i) { w.write(strList.at(i)); if (i != strList.size() - 1) w.write(QStringLiteral(", ")); } w.write(']'); return w; } LogWriter operator<<(LogWriter w, const Internal::Set &strSet) { bool firstLoop = true; w.write('('); for (const QString &str : strSet) { if (firstLoop) firstLoop = false; else w.write(QStringLiteral(", ")); w.write(str); } w.write(')'); return w; } LogWriter operator<<(LogWriter w, const QVariant &variant) { QString str = QLatin1String(variant.typeName()) + QLatin1Char('('); if (variant.userType() == QMetaType::QVariantList) { bool firstLoop = true; const auto list = variant.toList(); for (const QVariant &item : list) { str += item.toString(); if (firstLoop) firstLoop = false; else str += QLatin1String(", "); } } else { str += variant.toString(); } str += QLatin1Char(')'); w.write(str); return w; } LogWriter operator<<(LogWriter w, int n) { w.write(QString::number(n)); return w; } LogWriter operator<<(LogWriter w, qint64 n) { w.write(QString::number(n)); return w; } LogWriter operator<<(LogWriter w, bool b) { w.write(QString::fromLatin1(b ? "true" : "false")); return w; } LogWriter operator<<(LogWriter w, const MessageTag &tag) { w.setMessageTag(tag.tag()); return w; } Logger::Logger(ILogSink *logger) : m_logSink(logger) { } bool Logger::debugEnabled() const { return m_logSink->willPrint(LoggerDebug); } bool Logger::traceEnabled() const { return m_logSink->willPrint(LoggerTrace); } void Logger::printWarning(const ErrorInfo &warning) { if (m_storeWarnings) m_warnings.push_back(warning); logSink()->printWarning(warning); } void Logger::printError(const ErrorInfo &error) { if (m_storeWarnings) m_errors.push_back(error); logSink()->printError(error); } LogWriter Logger::qbsLog(LoggerLevel level, bool force) const { return {m_logSink, level, force}; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/logging/categories.cpp0000644000175100017510000000505015154533055021735 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "categories.h" namespace qbs { namespace Internal { Q_LOGGING_CATEGORY(lcBuildGraph, "qbs.buildgraph", QtCriticalMsg) Q_LOGGING_CATEGORY(lcDepScan, "qbs.depscan", QtCriticalMsg) Q_LOGGING_CATEGORY(lcExec, "qbs.exec", QtCriticalMsg) Q_LOGGING_CATEGORY(lcMocScan, "qbs.mocscan", QtCriticalMsg) Q_LOGGING_CATEGORY(lcModuleLoader, "qbs.moduleloader", QtCriticalMsg) Q_LOGGING_CATEGORY(lcPluginManager, "qbs.pluginmanager", QtCriticalMsg) Q_LOGGING_CATEGORY(lcProjectResolver, "qbs.projectresolver", QtCriticalMsg) Q_LOGGING_CATEGORY(lcUpToDateCheck, "qbs.uptodate", QtCriticalMsg) Q_LOGGING_CATEGORY(lcLoaderScheduling, "qbs.loader.scheduling", QtCriticalMsg) } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/logging/translator.h0000644000175100017510000000430515154533055021450 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_TRANSLATOR_H #define QBS_TRANSLATOR_H #include #include namespace qbs { namespace Internal { class QBS_EXPORT Tr // Name intended to be short. Exported for use by command line tools. { Q_DECLARE_TR_FUNCTIONS(Qbs) }; } // namespace Internal } // namespace qbs #endif // QBS_TRANSLATOR_H qbs-src-3.2.0/src/lib/corelib/logging/ilogsink.cpp0000644000175100017510000000746015154533055021436 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "ilogsink.h" #include #include #include namespace qbs { QString logLevelTag(LoggerLevel level) { if (level == LoggerInfo) return {}; QString str = logLevelName(level).toUpper(); if (!str.isEmpty()) str.append(QLatin1String(": ")); return str; } QString logLevelName(LoggerLevel level) { switch (level) { case qbs::LoggerError: return QStringLiteral("error"); case qbs::LoggerWarning: return QStringLiteral("warning"); case qbs::LoggerInfo: return QStringLiteral("info"); case qbs::LoggerDebug: return QStringLiteral("debug"); case qbs::LoggerTrace: return QStringLiteral("trace"); default: break; } return {}; } class ILogSink::ILogSinkPrivate { public: LoggerLevel logLevel = defaultLogLevel(); std::mutex mutex; }; ILogSink::ILogSink() : d(std::make_unique()) { } ILogSink::~ILogSink() = default; void ILogSink::setLogLevel(LoggerLevel level) { d->logLevel = level; } LoggerLevel ILogSink::logLevel() const { return d->logLevel; } void ILogSink::printWarning(const ErrorInfo &warning) { if (willPrint(LoggerWarning)) { d->mutex.lock(); doPrintWarning(warning); d->mutex.unlock(); } } void ILogSink::printError(const ErrorInfo &error) { d->mutex.lock(); doPrintError(error); d->mutex.unlock(); } void ILogSink::printMessage(LoggerLevel level, const QString &message, const QString &tag, bool force) { if (force || willPrint(level)) { d->mutex.lock(); doPrintMessage(level, message, tag); d->mutex.unlock(); } } void ILogSink::doPrintWarning(const ErrorInfo &warning) { doPrintMessage(LoggerWarning, warning.toString(), QString()); } void ILogSink::doPrintError(const ErrorInfo &error) { doPrintMessage(LoggerError, error.toString(), QString()); } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/logging/logger.h0000644000175100017510000001154415154533055020541 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_LOGGER_H #define QBS_LOGGER_H #include "ilogsink.h" #include #include #include #include #include QT_BEGIN_NAMESPACE class QVariant; QT_END_NAMESPACE namespace qbs { namespace Internal { template class Set; // Note that while these classes are not part of the API, we export some stuff for use by // our command line tools for the sake of a uniform logging approach. class QBS_EXPORT LogWriter { public: LogWriter(ILogSink *logSink, LoggerLevel level, bool force = false); // log writer has move semantics and the last instance of // a << chain prints the accumulated data LogWriter(const LogWriter &other); ~LogWriter(); const LogWriter &operator=(const LogWriter &other); // NOLINT void write(char c); void write(const char *str); void write(const QChar &c); void write(const QString &message); void setMessageTag(const QString &tag); private: ILogSink *m_logSink; LoggerLevel m_level; mutable QString m_message; QString m_tag; bool m_force; }; class QBS_EXPORT MessageTag { public: explicit MessageTag(QString tag) : m_tag(std::move(tag)) {} const QString &tag() const { return m_tag; } private: QString m_tag; }; QBS_EXPORT LogWriter operator<<(LogWriter w, const char *str); QBS_EXPORT LogWriter operator<<(LogWriter w, const QByteArray &byteArray); QBS_EXPORT LogWriter operator<<(LogWriter w, const QString &str); QBS_EXPORT LogWriter operator<<(LogWriter w, const QStringList &strList); QBS_EXPORT LogWriter operator<<(LogWriter w, const Internal::Set &strSet); QBS_EXPORT LogWriter operator<<(LogWriter w, const QVariant &variant); QBS_EXPORT LogWriter operator<<(LogWriter w, int n); QBS_EXPORT LogWriter operator<<(LogWriter w, qint64 n); QBS_EXPORT LogWriter operator<<(LogWriter w, bool b); QBS_EXPORT LogWriter operator<<(LogWriter w, const MessageTag &tag); class QBS_EXPORT Logger { public: Logger(ILogSink *logSink = 0); ILogSink *logSink() const { return m_logSink; } bool debugEnabled() const; bool traceEnabled() const; void printWarning(const ErrorInfo &warning); void printError(const ErrorInfo &error); QList warnings() const { return m_warnings; } QList errors() const { return m_errors; } void clearWarnings() { m_warnings.clear(); m_errors.clear(); } void storeWarnings() { m_storeWarnings = true; } LogWriter qbsLog(LoggerLevel level, bool force = false) const; LogWriter qbsWarning() const { return qbsLog(LoggerWarning); } LogWriter qbsInfo() const { return qbsLog(LoggerInfo); } LogWriter qbsDebug() const { return qbsLog(LoggerDebug); } LogWriter qbsTrace() const { return qbsLog(LoggerTrace); } private: ILogSink *m_logSink; QList m_warnings; QList m_errors; bool m_storeWarnings = false; }; } // namespace Internal } // namespace qbs #endif // QBS_LOGGER_H qbs-src-3.2.0/src/lib/corelib/logging/ilogsink.h0000644000175100017510000000630215154533055021075 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ILOGSINK_H #define QBS_ILOGSINK_H #include "../tools/qbs_export.h" #include #include namespace qbs { class ErrorInfo; enum LoggerLevel { LoggerMinLevel, LoggerError = LoggerMinLevel, LoggerWarning, LoggerInfo, LoggerDebug, LoggerTrace, LoggerMaxLevel = LoggerTrace }; inline LoggerLevel defaultLogLevel() { return LoggerInfo; } QBS_EXPORT QString logLevelTag(LoggerLevel level); QBS_EXPORT QString logLevelName(LoggerLevel level); class QBS_EXPORT ILogSink { Q_DISABLE_COPY(ILogSink) public: ILogSink(); virtual ~ILogSink(); void setLogLevel(LoggerLevel level); LoggerLevel logLevel() const; bool willPrint(LoggerLevel level) const { return level <= logLevel(); } void printWarning(const ErrorInfo &warning); void printError(const ErrorInfo &error); void printMessage(LoggerLevel level, const QString &message, const QString &tag = QString(), bool force = false); private: virtual void doPrintWarning(const ErrorInfo &warning); virtual void doPrintError(const ErrorInfo &error); virtual void doPrintMessage(LoggerLevel level, const QString &message, const QString &tag) = 0; class ILogSinkPrivate; const std::unique_ptr d; }; } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/logging/categories.h0000644000175100017510000000462415154533055021410 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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 CATEGORIES_H #define CATEGORIES_H #include namespace qbs { namespace Internal { Q_DECLARE_LOGGING_CATEGORY(lcBuildGraph) Q_DECLARE_LOGGING_CATEGORY(lcDepScan) Q_DECLARE_LOGGING_CATEGORY(lcExec) Q_DECLARE_LOGGING_CATEGORY(lcMocScan) Q_DECLARE_LOGGING_CATEGORY(lcModuleLoader) Q_DECLARE_LOGGING_CATEGORY(lcPluginManager) Q_DECLARE_LOGGING_CATEGORY(lcProjectResolver) Q_DECLARE_LOGGING_CATEGORY(lcUpToDateCheck) Q_DECLARE_LOGGING_CATEGORY(lcLoaderScheduling) } // namespace Internal } // namespace qbs #endif // CATEGORIES_H qbs-src-3.2.0/src/lib/corelib/tools/0000755000175100017510000000000015154533055016616 5ustar runnerrunnerqbs-src-3.2.0/src/lib/corelib/tools/weakpointer.h0000644000175100017510000000667715154533055021337 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_WEAKPOINTER_H #define QBS_WEAKPOINTER_H #include namespace qbs { namespace Internal { template class WeakPointer : public std::weak_ptr { public: WeakPointer() : std::weak_ptr() {} WeakPointer(const std::shared_ptr &sharedPointer) : std::weak_ptr(sharedPointer) {} template WeakPointer(const std::shared_ptr &sp) : std::weak_ptr(sp) { } T *get() const { auto p = std::weak_ptr::lock(); return p.get(); } operator bool() const { return !std::weak_ptr::expired(); } bool operator!() const { return std::weak_ptr::expired(); } operator T*() const { return checkedData(); } T *operator->() const { return checkedData(); } T operator*() const { return *checkedData(); } private: T *checkedData() const { T * const d = get(); Q_ASSERT(d); // Calling code is not expecting this situation. return d; } }; template bool operator==(const WeakPointer &a, const WeakPointer &b) { return a.get() == b.get(); } template bool operator!=(const WeakPointer &a, const WeakPointer &b) { return a.get() != b.get(); } template bool operator==(const WeakPointer &a, const std::shared_ptr &b) { return a.lock() == b; } template bool operator!=(const WeakPointer &a, const std::shared_ptr &b) { return a.lock() != b; } } // namespace Internal } // namespace qbs #endif // QBS_WEAKPOINTER_H qbs-src-3.2.0/src/lib/corelib/tools/settingsmodel.cpp0000644000175100017510000003027115154533055022206 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "settingsmodel.h" #include "settingsrepresentation.h" #include #include #include #include #include #include #include #ifdef QT_GUI_LIB #include #endif #include namespace qbs { namespace Internal { struct Node { Node() : parent(nullptr), isFromSettings(true) {} ~Node() { qDeleteAll(children); } QString uniqueChildName() const; bool hasDirectChildWithName(const QString &name) const; QString name; QString value; Node *parent; QList children; bool isFromSettings; }; QString Node::uniqueChildName() const { QString newName = QStringLiteral("newkey"); bool unique; do { unique = true; for (const Node *childNode : std::as_const(children)) { if (childNode->name == newName) { unique = false; newName += QLatin1Char('_'); break; } } } while (!unique); return newName; } bool Node::hasDirectChildWithName(const QString &name) const { return Internal::any_of(children, [&name](const auto &child){ return child->name == name; }); } } // namespace Internal using Internal::Node; class SettingsModel::SettingsModelPrivate { public: SettingsModelPrivate() : dirty(false), editable(true) {} void readSettings(); void addNodeFromSettings(Node *parentNode, const QString &fullyQualifiedName); void addNode(Node *parentNode, const QString ¤tNamePart, const QStringList &restOfName, const QVariant &value); void doSave(const Node *node, const QString &prefix); Node *indexToNode(const QModelIndex &index); Settings::Scope scope() const { return settings->scopeForWriting(); } Node rootNode; std::unique_ptr settings; QVariantMap additionalProperties; bool dirty; bool editable; }; SettingsModel::SettingsModel(const QString &settingsDir, Settings::Scope scope, QObject *parent) : QAbstractItemModel(parent), d(std::make_unique()) { d->settings = std::make_unique(settingsDir); d->settings->setScopeForWriting(scope); d->readSettings(); } SettingsModel::~SettingsModel() = default; void SettingsModel::reload() { beginResetModel(); d->readSettings(); endResetModel(); } void SettingsModel::save() { if (!d->dirty) return; d->settings->clear(); d->doSave(&d->rootNode, QString()); d->dirty = false; } void SettingsModel::updateSettingsDir(const QString &settingsDir) { const Settings::Scope scope = d->scope(); beginResetModel(); d->settings = std::make_unique(settingsDir); d->settings->setScopeForWriting(scope); d->readSettings(); endResetModel(); } void SettingsModel::addNewKey(const QModelIndex &parent) { Node *parentNode = d->indexToNode(parent); if (!parentNode) return; const auto newNode = new Node; newNode->parent = parentNode; newNode->name = parentNode->uniqueChildName(); beginInsertRows(parent, parentNode->children.size(), parentNode->children.size()); parentNode->children << newNode; endInsertRows(); d->dirty = true; } void SettingsModel::removeKey(const QModelIndex &index) { Node * const node = d->indexToNode(index); if (!node || node == &d->rootNode) return; const int positionInParent = node->parent->children.indexOf(node); beginRemoveRows(parent(index), positionInParent, positionInParent); node->parent->children.removeAt(positionInParent); delete node; endRemoveRows(); d->dirty = true; } bool SettingsModel::hasUnsavedChanges() const { return d->dirty; } void SettingsModel::setEditable(bool isEditable) { d->editable = isEditable; } void SettingsModel::setAdditionalProperties(const QVariantMap &properties) { d->additionalProperties = properties; reload(); } Qt::ItemFlags SettingsModel::flags(const QModelIndex &index) const { if (!index.isValid()) return Qt::NoItemFlags; const Qt::ItemFlags flags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); if (index.column() == keyColumn()) { if (d->editable) return flags | Qt::ItemIsEditable; return flags; } if (index.column() == valueColumn()) { const Node * const node = d->indexToNode(index); if (!node) return Qt::NoItemFlags; // Only leaf nodes have values. return d->editable && node->children.empty() ? flags | Qt::ItemIsEditable : flags; } return {}; } QVariant SettingsModel::headerData(int section, Qt::Orientation orientation, int role) const { if (orientation != Qt::Horizontal) return {}; if (role != Qt::DisplayRole) return {}; if (section == keyColumn()) return tr("Key"); if (section == valueColumn()) return tr("Value"); return {}; } int SettingsModel::columnCount(const QModelIndex &parent) const { Q_UNUSED(parent); return 2; } int SettingsModel::rowCount(const QModelIndex &parent) const { if (parent.column() > 0) return 0; const Node * const node = d->indexToNode(parent); Q_ASSERT(node); return node->children.size(); } QVariant SettingsModel::data(const QModelIndex &index, int role) const { if (role != Qt::DisplayRole && role != Qt::EditRole && role != Qt::ForegroundRole) return {}; const Node * const node = d->indexToNode(index); if (!node) return {}; if (role == Qt::ForegroundRole) { #ifdef QT_GUI_LIB if (index.column() == valueColumn() && !node->isFromSettings) return QBrush(Qt::red); #endif return {}; } if (index.column() == keyColumn()) return node->name; if (index.column() == valueColumn() && node->children.empty()) return node->value; return {}; } bool SettingsModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (!index.isValid() || role != Qt::EditRole) return false; Node * const node = d->indexToNode(index); if (!node) return false; const QString valueString = value.toString(); QString *toChange = nullptr; if (index.column() == keyColumn() && !valueString.isEmpty() && !node->parent->hasDirectChildWithName(valueString) && (node->parent->parent != &d->rootNode || node->parent->name != Internal::StringConstants::profilesSettingsKey() || valueString != Profile::fallbackName())) { toChange = &node->name; } else if (index.column() == valueColumn() && valueString != node->value) { toChange = &node->value; } if (toChange) { *toChange = valueString; emit dataChanged(index, index); d->dirty = true; } return toChange; } QModelIndex SettingsModel::index(int row, int column, const QModelIndex &parent) const { const Node * const parentNode = d->indexToNode(parent); Q_ASSERT(parentNode); if (parentNode->children.size() <= row) return {}; return createIndex(row, column, parentNode->children.at(row)); } QModelIndex SettingsModel::parent(const QModelIndex &child) const { const auto childNode = static_cast(child.internalPointer()); Q_ASSERT(childNode); Node * const parentNode = childNode->parent; if (parentNode == &d->rootNode) return {}; const Node * const grandParentNode = parentNode->parent; Q_ASSERT(grandParentNode); return createIndex(grandParentNode->children.indexOf(parentNode), 0, parentNode); } void SettingsModel::SettingsModelPrivate::readSettings() { qDeleteAll(rootNode.children); rootNode.children.clear(); const auto topLevelKeys = settings->directChildren(QString(), scope()); for (const QString &topLevelKey : topLevelKeys) addNodeFromSettings(&rootNode, topLevelKey); for (QVariantMap::ConstIterator it = additionalProperties.constBegin(); it != additionalProperties.constEnd(); ++it) { const QStringList nameAsList = it.key().split(QLatin1Char('.'), Qt::SkipEmptyParts); addNode(&rootNode, nameAsList.front(), nameAsList.mid(1), it.value()); } dirty = false; } static Node *createNode(Node *parentNode, const QString &name) { const auto node = new Node; node->name = name; node->parent = parentNode; parentNode->children.push_back(node); return node; } void SettingsModel::SettingsModelPrivate::addNodeFromSettings(Node *parentNode, const QString &fullyQualifiedName) { const QString &nodeName = fullyQualifiedName.mid(fullyQualifiedName.lastIndexOf(QLatin1Char('.')) + 1); Node * const node = createNode(parentNode, nodeName); node->value = settingsValueToRepresentation(settings->value(fullyQualifiedName, scope())); const auto childKeys = settings->directChildren(fullyQualifiedName, scope()); for (const QString &childKey : childKeys) addNodeFromSettings(node, fullyQualifiedName + QLatin1Char('.') + childKey); dirty = true; } void SettingsModel::SettingsModelPrivate::addNode(qbs::Internal::Node *parentNode, const QString ¤tNamePart, const QStringList &restOfName, const QVariant &value) { Node *currentNode = nullptr; for (Node * const n : std::as_const(parentNode->children)) { if (n->name == currentNamePart) { currentNode = n; break; } } if (!currentNode) currentNode = createNode(parentNode, currentNamePart); if (restOfName.empty()) { currentNode->value = settingsValueToRepresentation(value); currentNode->isFromSettings = false; } else { addNode(currentNode, restOfName.front(), restOfName.mid(1), value); } } void SettingsModel::SettingsModelPrivate::doSave(const Node *node, const QString &prefix) { if (node->children.empty()) { settings->setValue(prefix + node->name, representationToSettingsValue(node->value)); return; } const QString newPrefix = prefix + node->name + QLatin1Char('.'); for (const Node * const child : std::as_const(node->children)) doSave(child, newPrefix); } Node *SettingsModel::SettingsModelPrivate::indexToNode(const QModelIndex &index) { return index.isValid() ? static_cast(index.internalPointer()) : &rootNode; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/settingsrepresentation.h0000644000175100017510000000447115154533055023620 0ustar runnerrunner/**************************************************************************** ** ** 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_SETTINGSREPRESENTATION_H #define QBS_SETTINGSREPRESENTATION_H #include #include #include namespace qbs { QBS_EXPORT QString settingsValueToRepresentation(const QVariant &value); QBS_EXPORT QVariant representationToVariant(const QString &representation); QBS_EXPORT QVariant representationToSettingsValue(const QString &representation); } // namespace qbs #endif // QBS_SETTINGSREPRESENTATION_H qbs-src-3.2.0/src/lib/corelib/tools/installoptions.h0000644000175100017510000000640015154533055022051 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_INSTALLOPTIONS_H #define QBS_INSTALLOPTIONS_H #include "qbs_export.h" #include QT_BEGIN_NAMESPACE class QJsonObject; class QString; QT_END_NAMESPACE namespace qbs { class InstallOptions; namespace Internal { class InstallOptionsPrivate; class TopLevelProject; QString effectiveInstallRoot(const InstallOptions &options, const TopLevelProject *project); } class QBS_EXPORT InstallOptions { public: InstallOptions(); InstallOptions(const InstallOptions &other); InstallOptions(InstallOptions &&other) Q_DECL_NOEXCEPT; InstallOptions &operator=(const InstallOptions &other); InstallOptions &operator=(InstallOptions &&other) Q_DECL_NOEXCEPT; ~InstallOptions(); static InstallOptions fromJson(const QJsonObject &data); static QString defaultInstallRoot(); QString installRoot() const; void setInstallRoot(const QString &installRoot); bool installIntoSysroot() const; void setInstallIntoSysroot(bool useSysroot); bool removeExistingInstallation() const; void setRemoveExistingInstallation(bool removeExisting); bool dryRun() const; void setDryRun(bool dryRun); bool keepGoing() const; void setKeepGoing(bool keepGoing); bool logElapsedTime() const; void setLogElapsedTime(bool logElapsedTime); private: QSharedDataPointer d; }; } // namespace qbs #endif // QBS_INSTALLOPTIONS_H qbs-src-3.2.0/src/lib/corelib/tools/qbsprocess.h0000644000175100017510000000763215154533055021163 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_QBSPROCESS_H #define QBS_QBSPROCESS_H #include "launcherpackets.h" #include #include #include #include namespace qbs { namespace Internal { class QbsProcess : public QObject { Q_OBJECT public: explicit QbsProcess(QObject *parent = nullptr); QProcess::ProcessState state() const { return m_state; } void setProcessEnvironment(const QProcessEnvironment &env) { m_environment = env; } void setWorkingDirectory(const QString &workingDir) { m_workingDirectory = workingDir; } QString workingDirectory() const { return m_workingDirectory; } void start(const QString &command, const QStringList &arguments); void cancel(); QByteArray readAllStandardOutput(); QByteArray readAllStandardError(); int exitCode() const { return m_exitCode; } QProcess::ProcessError error() const { return m_error; } QString errorString() const { return m_errorString; } signals: void errorOccurred(QProcess::ProcessError error); void finished(int exitCode); private: void doStart(); void sendPacket(const LauncherPacket &packet); QByteArray readAndClear(QByteArray &data); void handleSocketError(const QString &message); void handlePacket(qbs::Internal::LauncherPacketType type, quintptr token, const QByteArray &payload); void handleErrorPacket(const QByteArray &packetData); void handleFinishedPacket(const QByteArray &packetData); void handleSocketReady(); quintptr token() const { return reinterpret_cast(this); } QString m_command; QStringList m_arguments; QProcessEnvironment m_environment; QString m_workingDirectory; QByteArray m_stdout; QByteArray m_stderr; QString m_errorString; QProcess::ProcessError m_error = QProcess::UnknownError; QProcess::ProcessState m_state = QProcess::NotRunning; int m_exitCode = 0; int m_connectionAttempts = 0; bool m_socketError = false; }; } // namespace Internal } // namespace qbs #endif // QBSPROCESS_H qbs-src-3.2.0/src/lib/corelib/tools/qbsassert.h0000644000175100017510000000557615154533055021013 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_QBSASSERT_H #define QBS_QBSASSERT_H #include "qbs_export.h" namespace qbs { namespace Internal { QBS_EXPORT void writeAssertLocation(const char *condition, const char *file, int line); [[noreturn]] QBS_EXPORT void throwAssertLocation(const char *condition, const char *file, int line); } // namespace Internal } // namespace qbs #define QBS_ASSERT(cond, action)\ if (Q_LIKELY(cond)) {} else {\ ::qbs::Internal::writeAssertLocation(#cond, __FILE__, __LINE__); action;\ } do {} while (0) // The do {} while (0) is here to enforce the use of a semicolon after QBS_ASSERT. // action can also be continue or break. Copied from qtcassert.h in Qt Creator. #define QBS_GUARD(cond) \ (Q_LIKELY(cond) \ ? true \ : (::qbs::Internal::writeAssertLocation(#cond, __FILE__, __LINE__), false)) #define QBS_CHECK(cond)\ do {\ if (Q_LIKELY(cond)) {} else {\ ::qbs::Internal::throwAssertLocation(#cond, __FILE__, __LINE__);\ }\ } while (0) #endif // QBS_QBSASSERT_H qbs-src-3.2.0/src/lib/corelib/tools/launcherpackets.h0000644000175100017510000001176615154533055022156 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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_LAUNCHERPACKETS_H #define QBS_LAUNCHERPACKETS_H #include #include #include QT_BEGIN_NAMESPACE class QByteArray; QT_END_NAMESPACE namespace qbs { namespace Internal { enum class LauncherPacketType { Shutdown, StartProcess, StopProcess, ProcessError, ProcessFinished }; class PacketParser { public: class InvalidPacketSizeException { public: InvalidPacketSizeException(int size) : size(size) { } const int size; }; void setDevice(QIODevice *device); bool parse(); LauncherPacketType type() const { return m_type; } quintptr token() const { return m_token; } const QByteArray &packetData() const { return m_packetData; } private: QDataStream m_stream; LauncherPacketType m_type = LauncherPacketType::Shutdown; quintptr m_token = 0; QByteArray m_packetData; int m_sizeOfNextPacket = -1; }; class LauncherPacket { public: virtual ~LauncherPacket(); template static Packet extractPacket(quintptr token, const QByteArray &data) { Packet p(token); p.deserialize(data); return p; } QByteArray serialize() const; void deserialize(const QByteArray &data); const LauncherPacketType type; const quintptr token = 0; protected: LauncherPacket(LauncherPacketType type, quintptr token) : type(type), token(token) { } private: virtual void doSerialize(QDataStream &stream) const = 0; virtual void doDeserialize(QDataStream &stream) = 0; }; class StartProcessPacket : public LauncherPacket { public: StartProcessPacket(quintptr token); QString command; QStringList arguments; QString workingDir; QStringList env; private: void doSerialize(QDataStream &stream) const override; void doDeserialize(QDataStream &stream) override; }; class StopProcessPacket : public LauncherPacket { public: StopProcessPacket(quintptr token); private: void doSerialize(QDataStream &stream) const override; void doDeserialize(QDataStream &stream) override; }; class ShutdownPacket : public LauncherPacket { public: ShutdownPacket(); private: void doSerialize(QDataStream &stream) const override; void doDeserialize(QDataStream &stream) override; }; class ProcessErrorPacket : public LauncherPacket { public: ProcessErrorPacket(quintptr token); QProcess::ProcessError error = QProcess::UnknownError; QString errorString; private: void doSerialize(QDataStream &stream) const override; void doDeserialize(QDataStream &stream) override; }; class ProcessFinishedPacket : public LauncherPacket { public: ProcessFinishedPacket(quintptr token); QString errorString; QByteArray stdOut; QByteArray stdErr; QProcess::ExitStatus exitStatus = QProcess::ExitStatus::NormalExit; QProcess::ProcessError error = QProcess::ProcessError::UnknownError; int exitCode = 0; private: void doSerialize(QDataStream &stream) const override; void doDeserialize(QDataStream &stream) override; }; } // namespace Internal } // namespace qbs Q_DECLARE_METATYPE(qbs::Internal::LauncherPacketType); #endif // Include guard qbs-src-3.2.0/src/lib/corelib/tools/cleanoptions.h0000644000175100017510000000536315154533055021474 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_CLEANOPTIONS_H #define QBS_CLEANOPTIONS_H #include "qbs_export.h" #include QT_BEGIN_NAMESPACE class QJsonObject; QT_END_NAMESPACE namespace qbs { namespace Internal { class CleanOptionsPrivate; } class QBS_EXPORT CleanOptions { public: CleanOptions(); CleanOptions(const CleanOptions &other); CleanOptions(CleanOptions &&other) Q_DECL_NOEXCEPT; CleanOptions &operator=(const CleanOptions &other); CleanOptions &operator=(CleanOptions &&other) Q_DECL_NOEXCEPT; ~CleanOptions(); static CleanOptions fromJson(const QJsonObject &data); bool dryRun() const; void setDryRun(bool dryRun); bool keepGoing() const; void setKeepGoing(bool keepGoing); bool logElapsedTime() const; void setLogElapsedTime(bool log); private: QSharedDataPointer d; }; } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/tools/fileinfo.cpp0000644000175100017510000005012415154533055021117 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "fileinfo.h" #include #include #include #include #include #include #include #include #include #if defined(Q_OS_UNIX) #include #include #include #elif defined(Q_OS_WIN) #include #endif namespace qbs { namespace Internal { #ifdef Q_OS_DARWIN bool nsCopyFile(const QString &srcFilePath, const QString &tgtFilePath, QString *errorMessage); #endif QString FileInfo::fileName(const QString &fp) { int last = fp.lastIndexOf(QLatin1Char('/')); if (last < 0) return fp; return fp.mid(last + 1); } QString FileInfo::baseName(const QString &fp) { QString fn = fileName(fp); int dot = fn.indexOf(QLatin1Char('.')); if (dot < 0) return fn; return fn.mid(0, dot); } QString FileInfo::completeBaseName(const QString &fp) { QString fn = fileName(fp); int dot = fn.lastIndexOf(QLatin1Char('.')); if (dot < 0) return fn; return fn.mid(0, dot); } QString FileInfo::suffix(const QString &fp) { QString fn = fileName(fp); int dot = fn.lastIndexOf(QLatin1Char('.')); if (dot < 0) return fn; return fn.mid(dot + 1); } QString FileInfo::completeSuffix(const QString &fp) { QString fn = fileName(fp); int dot = fn.indexOf(QLatin1Char('.')); if (dot < 0) return fn; return fn.mid(dot + 1); } QString FileInfo::path(const QString &fp, HostOsInfo::HostOs hostOs) { if (fp.isEmpty()) return {}; int last = fp.lastIndexOf(QLatin1Char('/')); if (last < 0) return StringConstants::dot(); QString p = QDir::cleanPath(fp.mid(0, last)); if (p.isEmpty() || (hostOs == HostOsInfo::HostOsWindows && p.length() == 2 && p.at(0).isLetter() && p.at(1) == QLatin1Char(':'))) { // Make sure we don't return Windows drive roots without an ending slash. // Those paths are considered relative. p.append(QLatin1Char('/')); } return p; } void FileInfo::splitIntoDirectoryAndFileName(const QString &filePath, QString *dirPath, QString *fileName) { int idx = filePath.lastIndexOf(QLatin1Char('/')); if (idx < 0) { dirPath->clear(); *fileName = filePath; return; } *dirPath = filePath.left(idx); *fileName = filePath.mid(idx + 1); } void FileInfo::splitIntoDirectoryAndFileName(const QString &filePath, QStringView *dirPath, QStringView *fileName) { int idx = filePath.lastIndexOf(QLatin1Char('/')); if (idx < 0) { *dirPath = QStringView(); *fileName = QStringView(filePath); return; } *dirPath = QStringView(filePath).left(idx); *fileName = QStringView(filePath).mid(idx + 1); } bool FileInfo::exists(const QString &fp) { return FileInfo(fp).exists(); } // Whether a path is the special "current drive path" path type, // which is neither truly relative nor absolute static bool isCurrentDrivePath(const QString &path, HostOsInfo::HostOs hostOs) { return hostOs == HostOsInfo::HostOsWindows ? path.size() == 2 && path.at(1) == QLatin1Char(':') && path.at(0).isLetter() : false; } // from creator/src/shared/proparser/ioutils.cpp bool FileInfo::isAbsolute(const QString &path, HostOsInfo::HostOs hostOs) { const int n = path.size(); if (n == 0) return false; const QChar at0 = path.at(0); if (at0 == QLatin1Char('/')) return true; if (hostOs == HostOsInfo::HostOsWindows) { if (at0 == QLatin1Char('\\')) return true; // Unlike QFileInfo, this won't accept a relative path with a drive letter. // Such paths result in a royal mess anyway ... if (n >= 3 && path.at(1) == QLatin1Char(':') && at0.isLetter() && (path.at(2) == QLatin1Char('/') || path.at(2) == QLatin1Char('\\'))) return true; } return false; } bool FileInfo::isPattern(QStringView str) { return Internal::any_of(str, [](const auto &ch) { return (ch == QLatin1Char('*') || ch == QLatin1Char('?') || ch == QLatin1Char(']') || ch == QLatin1Char('[')); }); } /** * Concatenates the paths \a base and \a rel. * Base must be an absolute path. * Double dots at the start of \a rel are handled. * This function assumes that both paths are clean, that is they don't contain * double slashes or redundant dot parts. */ QString FileInfo::resolvePath(const QString &base, const QString &rel, HostOsInfo::HostOs hostOs) { QBS_ASSERT(isAbsolute(base, hostOs) && !isCurrentDrivePath(rel, hostOs), qDebug("base: %s, rel: %s", qPrintable(base), qPrintable(rel)); return {}); if (isAbsolute(rel, hostOs)) return rel; if (rel.size() == 1 && rel.at(0) == QLatin1Char('.')) return base; if (rel.size() == 1 && rel.at(0) == QLatin1Char('~')) return QDir::homePath(); if (rel.startsWith(StringConstants::tildeSlash())) return QDir::homePath() + rel.mid(1); QString r = base; if (r.endsWith(QLatin1Char('/'))) r.chop(1); QString s = rel; while (s.startsWith(QStringLiteral("../"))) { s.remove(0, 3); int idx = r.lastIndexOf(QLatin1Char('/')); if (idx >= 0) r.truncate(idx); } if (s == StringConstants::dotDot()) { int idx = r.lastIndexOf(QLatin1Char('/')); if (idx >= 0) r.truncate(idx); s.clear(); } if (!s.isEmpty() || isCurrentDrivePath(r, hostOs)) { r.reserve(r.length() + 1 + s.length()); r += QLatin1Char('/'); r += s; } return r; } #ifdef Q_OS_WIN static QString prependLongPathPrefix(const QString &absolutePath) { QString nativePath = QDir::toNativeSeparators(absolutePath); if (nativePath.startsWith(QStringLiteral("\\\\"))) nativePath.remove(0, 1).prepend(QLatin1String("UNC")); nativePath.prepend(QLatin1String("\\\\?\\")); return nativePath; } #endif bool FileInfo::isFileCaseCorrect(const QString &filePath) { #if defined(Q_OS_WIN) // QFileInfo::canonicalFilePath() does not return the real case of the file path on Windows. QFileInfo fi(filePath); const QString absolute = prependLongPathPrefix(fi.absoluteFilePath()); WIN32_FIND_DATA fd; HANDLE hFindFile = ::FindFirstFile((wchar_t*)absolute.utf16(), &fd); if (hFindFile == INVALID_HANDLE_VALUE) return false; const QString actualFileName = QString::fromWCharArray(fd.cFileName); FindClose(hFindFile); return actualFileName == fi.fileName(); #elif defined(Q_OS_DARWIN) QFileInfo fi(filePath); return fi.fileName() == fileName(fi.canonicalFilePath()); #else Q_UNUSED(filePath) return true; #endif } bool FileInfo::fileExists(const QFileInfo &fi) { return fi.isSymLink() || fi.exists(); } #if defined(Q_OS_WIN) #define z(x) reinterpret_cast(const_cast(&x)) FileInfo::FileInfo(const QString &fileName) { static_assert(sizeof(FileInfo::InternalStatType) == sizeof(WIN32_FILE_ATTRIBUTE_DATA), "FileInfo::InternalStatType has wrong size."); QString filePath = fileName; // The extended-length path prefix cannot be used with a relative path, so make it absolute if (!isAbsolute(filePath)) filePath = QDir::currentPath() + QDir::separator() + filePath; filePath = prependLongPathPrefix(QDir::cleanPath(filePath)); if (!GetFileAttributesEx(reinterpret_cast(filePath.utf16()), GetFileExInfoStandard, &m_stat)) { ZeroMemory(z(m_stat), sizeof(WIN32_FILE_ATTRIBUTE_DATA)); z(m_stat)->dwFileAttributes = INVALID_FILE_ATTRIBUTES; } } bool FileInfo::exists() const { return z(m_stat)->dwFileAttributes != INVALID_FILE_ATTRIBUTES; } FileTime FileInfo::lastModified() const { return fromFileTime(z(m_stat)->ftLastWriteTime); } FileTime FileInfo::lastStatusChange() const { return lastModified(); } bool FileInfo::isDir() const { return exists() && z(m_stat)->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; } static QString resolveSymlinks(const QString &fileName) { QFileInfo fi(fileName); while (fi.isSymLink()) fi.setFile(fi.dir(), fi.symLinkTarget()); return fi.absoluteFilePath(); } #elif defined(Q_OS_UNIX) namespace GetFileTimes { enum TimeType { LastModified, LastStatusChanged }; // SFINAE magic inspired by // https://github.com/qt/qtbase/blob/5.13/src/corelib/io/qfilesystemengine_unix.cpp template< TimeType type, typename T, std::enable_if_t<(&T::st_mtim, &T::st_ctim, true), int> = 0> static inline FileTime get(const T &stat) { if constexpr (type == LastModified) return stat.st_mtim; else if constexpr (type == LastStatusChanged) return stat.st_ctim; } // we are interested in real members, not compatibility macros # if defined(st_mtimespec) # undef st_mtimespec # endif # if defined(st_ctimespec) # undef st_ctimespec # endif template< TimeType type, typename T, std::enable_if_t<(&T::st_mtimespec, &T::st_ctimespec, true), int> = 0> static inline FileTime get(const T &stat) { if constexpr (type == LastModified) return stat.st_mtimespec; else if constexpr (type == LastStatusChanged) return stat.st_ctimespec; } # if defined(st_mtimensec) # undef st_mtimensec # endif # if defined(st_ctimensec) # undef st_ctimensec # endif template< TimeType type, typename T, std::enable_if_t<(&T::st_mtimensec, &T::st_ctimensec, true), int> = 0> static inline FileTime get(const T &stat) { if constexpr (type == LastModified) return FileTime::InternalType{stat.st_mtime, stat.st_mtimensec}; else if constexpr (type == LastStatusChanged) return FileTime::InternalType{stat.st_ctime, stat.st_ctimensec}; } } // namespace GetFileTimes FileInfo::FileInfo(const QString &fileName) { if (stat(fileName.toLocal8Bit().constData(), &m_stat) == -1) { m_stat.st_mtime = 0; m_stat.st_mode = 0; } } bool FileInfo::exists() const { return m_stat.st_mode != 0; } FileTime FileInfo::lastModified() const { return GetFileTimes::get(m_stat); } FileTime FileInfo::lastStatusChange() const { return GetFileTimes::get(m_stat); } bool FileInfo::isDir() const { return S_ISDIR(m_stat.st_mode); } #endif // Q_OS_UNIX // adapted from qtc/plugins/vcsbase/cleandialog.cpp bool removeFileRecursion(const QFileInfo &f, QString *errorMessage) { if (!FileInfo::fileExists(f)) return true; if (f.isDir() && !f.isSymLink()) { const QDir dir(f.absoluteFilePath()); // QDir::System is needed for broken symlinks. const auto fileInfos = dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System); for (const QFileInfo &fi : fileInfos) removeFileRecursion(fi, errorMessage); QDir parent = f.absoluteDir(); if (!parent.rmdir(f.fileName())) { errorMessage->append(Tr::tr("The directory %1 could not be deleted."). arg(QDir::toNativeSeparators(f.absoluteFilePath()))); return false; } } else { QFile file(f.absoluteFilePath()); file.setPermissions(f.permissions() | QFile::WriteUser); if (!file.remove()) { if (!errorMessage->isEmpty()) errorMessage->append(QLatin1Char('\n')); errorMessage->append(Tr::tr("The file %1 could not be deleted."). arg(QDir::toNativeSeparators(f.absoluteFilePath()))); return false; } } return true; } bool removeDirectoryWithContents(const QString &path, QString *errorMessage) { QFileInfo f(path); if (f.exists() && !f.isDir()) { *errorMessage = Tr::tr("%1 is not a directory.").arg(QDir::toNativeSeparators(path)); return false; } return removeFileRecursion(f, errorMessage); } /*! * Returns the stored link target of the symbolic link \a{filePath}. * Unlike QFileInfo::symLinkTarget, this will not make the link target an absolute path. */ static QByteArray storedLinkTarget(const QString &filePath) { // A nasty workaround for GCC13 bug (see QTBUG-103782), it complains about type punning // in Qt5 QByteArray::Data, so we use std::vector as a buffer to readlink below. // See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105709 std::vector result; #ifdef Q_OS_UNIX const QByteArray nativeFilePath = QFile::encodeName(filePath); ssize_t len; while (true) { struct stat sb{}; if (lstat(nativeFilePath.constData(), &sb)) { qWarning("storedLinkTarget: lstat for %s failed with error code %d", nativeFilePath.constData(), errno); return {}; } result.resize(sb.st_size); len = readlink(nativeFilePath.constData(), result.data(), sb.st_size + 1); if (len < 0) { qWarning("storedLinkTarget: readlink for %s failed with error code %d", nativeFilePath.constData(), errno); return {}; } if (len < sb.st_size) { result.resize(len); break; } if (len == sb.st_size) break; } #else Q_UNUSED(filePath); #endif // Q_OS_UNIX return {result.data(), static_cast().size())>(result.size())}; } static bool createSymLink(const QByteArray &path1, const QString &path2, bool *skipped) { #ifdef Q_OS_UNIX const QByteArray newPath = QFile::encodeName(path2); char curTarget[PATH_MAX]; const ssize_t bytesRead = readlink(newPath.constData(), curTarget, sizeof curTarget); if (bytesRead != -1 && path1.size() == bytesRead && path1 == QByteArray(curTarget, bytesRead)) { if (skipped) *skipped = true; return true; } unlink(newPath.constData()); return symlink(path1.constData(), newPath.constData()) == 0; #else Q_UNUSED(path1) Q_UNUSED(path2) Q_UNUSED(skipped) return false; #endif // Q_OS_UNIX } /*! Copies the directory specified by \a srcFilePath recursively to \a tgtFilePath. \a tgtFilePath will contain the target directory, which will be created. Example usage: \code QString error; book ok = Utils::FileUtils::copyRecursively("/foo/bar", "/foo/baz", &error); if (!ok) qDebug() << error; \endcode This will copy the contents of /foo/bar into to the baz directory under /foo, which will be created in the process. \return Whether the operation succeeded. \note Function was adapted from qtc/src/libs/fileutils.cpp */ bool copyFileRecursion( const QString &srcFilePath, const QString &tgtFilePath, bool preserveSymLinks, bool copyDirectoryContents, QString *errorMessage, bool *skipped) { QFileInfo srcFileInfo(srcFilePath); QFileInfo tgtFileInfo(tgtFilePath); const QString targetDirPath = tgtFileInfo.absoluteDir().path(); if (!QDir::root().mkpath(targetDirPath)) { *errorMessage = Tr::tr("The directory '%1' could not be created.") .arg(QDir::toNativeSeparators(targetDirPath)); return false; } if (HostOsInfo::isAnyUnixHost() && preserveSymLinks && srcFileInfo.isSymLink()) { // For now, disable symlink preserving copying on Windows. // MS did a good job to prevent people from using symlinks - even if they are supported. if (!createSymLink(storedLinkTarget(srcFilePath), tgtFilePath, skipped)) { *errorMessage = Tr::tr("The symlink '%1' could not be created.") .arg(tgtFilePath); return false; } } else if (srcFileInfo.isDir()) { if (copyDirectoryContents) { QDir sourceDir(srcFilePath); const QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System); for (const QString &fileName : fileNames) { const QString newSrcFilePath = srcFilePath + QLatin1Char('/') + fileName; const QString newTgtFilePath = tgtFilePath + QLatin1Char('/') + fileName; if (!copyFileRecursion(newSrcFilePath, newTgtFilePath, preserveSymLinks, copyDirectoryContents, errorMessage)) return false; } } else { if (tgtFileInfo.exists() && srcFileInfo.lastModified() <= tgtFileInfo.lastModified()) return true; return QDir::root().mkpath(tgtFilePath); } } else { if (tgtFileInfo.exists() && srcFileInfo.lastModified() <= tgtFileInfo.lastModified()) { if (skipped) *skipped = true; return true; } QFile file(srcFilePath); QFile targetFile(tgtFilePath); if (targetFile.exists()) { targetFile.setPermissions(targetFile.permissions() | QFile::WriteUser); if (!targetFile.remove()) { *errorMessage = Tr::tr("Could not remove file '%1'. %2") .arg(QDir::toNativeSeparators(tgtFilePath), targetFile.errorString()); } } #ifdef Q_OS_DARWIN if (!nsCopyFile(srcFilePath, tgtFilePath, errorMessage)) return false; #else if (!file.copy(tgtFilePath)) { *errorMessage = Tr::tr("Could not copy file '%1' to '%2'. %3") .arg(QDir::toNativeSeparators(srcFilePath), QDir::toNativeSeparators(tgtFilePath), file.errorString()); return false; } #endif } return true; } } // namespace Internal #ifdef Q_OS_WIN QString qbsApplicationDirPath() { // not sure why we need to resolve symlinks on Windows, it that even a case? static const QString appDirPath = Internal::FileInfo::path( Internal::resolveSymlinks(QCoreApplication::applicationFilePath())); return appDirPath; } #else QString qbsApplicationDirPath() { static const QString appDirPath = QFileInfo(QCoreApplication::applicationFilePath()).canonicalPath(); return appDirPath; } #endif } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/profiling.cpp0000644000175100017510000000740215154533055021316 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "profiling.h" #include #include #include namespace qbs { namespace Internal { class TimedActivityLogger::TimedActivityLoggerPrivate { public: Logger logger; QString activity; QElapsedTimer timer; }; TimedActivityLogger::TimedActivityLogger(const Logger &logger, const QString &activity, bool enabled) : d(nullptr) { if (!enabled) return; d = std::make_unique(); d->logger = logger; d->activity = activity; d->logger.qbsLog(LoggerInfo, true) << Tr::tr("Starting activity '%2'.").arg(activity); d->timer.start(); } void TimedActivityLogger::finishActivity() { if (!d) return; const QString timeString = elapsedTimeString(d->timer.nsecsElapsed()); d->logger.qbsLog(LoggerInfo, true) << Tr::tr("Activity '%2' took %3.").arg(d->activity, timeString); d.reset(); } TimedActivityLogger::~TimedActivityLogger() { finishActivity(); } AccumulatingTimer::AccumulatingTimer(qint64 *elapsedTime) : m_elapsedTime(elapsedTime) { if (elapsedTime) m_timer.start(); } AccumulatingTimer::~AccumulatingTimer() { stop(); } void AccumulatingTimer::stop() { if (!m_timer.isValid()) return; *m_elapsedTime += m_timer.nsecsElapsed(); m_timer.invalidate(); } QString elapsedTimeString(qint64 elapsedTimeInNs) { qint64 ms = elapsedTimeInNs / (1000ll * 1000ll); qint64 s = ms/1000; ms -= s*1000; qint64 m = s/60; s -= m*60; const qint64 h = m/60; m -= h*60; QString timeString = QStringLiteral("%1ms").arg(ms); if (h || m || s) timeString.prepend(QStringLiteral("%1s, ").arg(s)); if (h || m) timeString.prepend(QStringLiteral("%1m, ").arg(m)); if (h) timeString.prepend(QStringLiteral("%1h, ").arg(h)); return timeString; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/jsonhelper.h0000644000175100017510000000660715154533055021151 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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_JSON_HELPER_H #define QBS_JSON_HELPER_H #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { template inline T fromJson(const QJsonValue &v); template<> inline bool fromJson(const QJsonValue &v) { return v.toBool(); } template<> inline int fromJson(const QJsonValue &v) { return v.toInt(); } template<> inline QString fromJson(const QJsonValue &v) { return v.toString(); } template<> inline QStringList fromJson(const QJsonValue &v) { const QJsonArray &jsonList = v.toArray(); return transformed(jsonList, [](const auto &v) { return v.toString(); }); } template<> inline QVariantMap fromJson(const QJsonValue &v) { return v.toObject().toVariantMap(); } template<> inline QProcessEnvironment fromJson(const QJsonValue &v) { const QJsonObject obj = v.toObject(); QProcessEnvironment env; for (auto it = obj.begin(); it != obj.end(); ++it) env.insert(it.key(), it.value().toString()); return env; } template inline void setValueFromJson(T &targetValue, const QJsonObject &data, const char *jsonProperty) { const auto it = data.find(QLatin1String(jsonProperty)); if (it != data.end()) targetValue = fromJson(*it); } } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/tools/qbs_export.h0000644000175100017510000000543215154533055021161 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_EXPORT_H #define QBS_EXPORT_H #if defined(_WIN32) || defined(WIN32) # define QBS_DECL_EXPORT __declspec(dllexport) # define QBS_DECL_IMPORT __declspec(dllimport) #else # define QBS_DECL_EXPORT __attribute__((visibility("default"))) # define QBS_DECL_IMPORT __attribute__((visibility("default"))) # endif #ifdef QBS_STATIC_LIB # define QBS_EXPORT # define QBS_AUTOTEST_EXPORT #else # ifdef QBS_LIBRARY # define QBS_EXPORT QBS_DECL_EXPORT # ifdef QBS_WITH_TESTS # define QBS_AUTOTEST_EXPORT QBS_DECL_EXPORT # else # define QBS_AUTOTEST_EXPORT # endif # else # define QBS_EXPORT QBS_DECL_IMPORT # ifdef QBS_WITH_TESTS # define QBS_AUTOTEST_EXPORT QBS_DECL_IMPORT # else # define QBS_AUTOTEST_EXPORT # endif # endif #endif #if defined(_MSC_VER) && !defined(__clang__) #pragma warning(disable: 4251) #endif #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/tools/cleanoptions.cpp0000644000175100017510000001161015154533055022017 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "cleanoptions.h" #include "jsonhelper.h" #include namespace qbs { namespace Internal { class CleanOptionsPrivate : public QSharedData { public: CleanOptionsPrivate() : dryRun(false), keepGoing(false), logElapsedTime(false) { } bool dryRun; bool keepGoing; bool logElapsedTime; }; } // namespace Internal /*! * \class CleanOptions * \brief The \c CleanOptions class comprises parameters that influence the behavior of * cleaning operations. */ /*! * \enum CleanOptions::CleanType * This enum type specifies which kind of build artifacts to remove. * \value CleanupAll Indicates that all files created by the build process should be removed. * \value CleanupTemporaries Indicates that only intermediate build artifacts should be removed. * If, for example, the product to clean up for is a Linux shared library, the .so file * would be left on the disk, but the .o files would be removed. */ CleanOptions::CleanOptions() : d(new Internal::CleanOptionsPrivate) { } CleanOptions::CleanOptions(const CleanOptions &other) = default; CleanOptions::CleanOptions(CleanOptions &&other) Q_DECL_NOEXCEPT = default; CleanOptions &CleanOptions::operator=(const CleanOptions &other) = default; CleanOptions &CleanOptions::operator=(CleanOptions &&other) Q_DECL_NOEXCEPT = default; CleanOptions::~CleanOptions() = default; /*! * \brief Returns true iff qbs will not actually remove any files, but just show what would happen. * The default is false. */ bool CleanOptions::dryRun() const { return d->dryRun; } /*! * \brief Controls whether clean-up will actually take place. * If the argument is true, then qbs will emit information about which files would be removed * instead of actually doing it. */ void CleanOptions::setDryRun(bool dryRun) { d->dryRun = dryRun; } /*! * Returns true iff clean-up will continue if an error occurs. * The default is false. */ bool CleanOptions::keepGoing() const { return d->keepGoing; } /*! * \brief Controls whether to abort on errors. * If the argument is true, then if a file cannot be removed e.g. due to a permission problem, * a warning will be printed and the clean-up will continue. If the argument is false, * then the clean-up will abort immediately in case of an error. */ void CleanOptions::setKeepGoing(bool keepGoing) { d->keepGoing = keepGoing; } /*! * \brief Returns true iff the time the operation takes will be logged. * The default is false. */ bool CleanOptions::logElapsedTime() const { return d->logElapsedTime; } /*! * \brief Controls whether the clean-up time will be measured and logged. */ void CleanOptions::setLogElapsedTime(bool log) { d->logElapsedTime = log; } qbs::CleanOptions qbs::CleanOptions::fromJson(const QJsonObject &data) { CleanOptions opt; using namespace Internal; setValueFromJson(opt.d->dryRun, data, "dry-run"); setValueFromJson(opt.d->keepGoing, data, "keep-going"); setValueFromJson(opt.d->logElapsedTime, data, "log-time"); return opt; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/generateoptions.cpp0000644000175100017510000000603715154533055022536 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** 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$ ** ****************************************************************************/ #include "generateoptions.h" #include #include namespace qbs { namespace Internal { class GenerateOptionsPrivate : public QSharedData { public: GenerateOptionsPrivate() : generatorName() {} QString generatorName; }; } // namespace Internal /*! * \class GenerateOptions * \brief The \c GenerateOptions class comprises parameters that influence the behavior of * generate operations. */ GenerateOptions::GenerateOptions() : d(new Internal::GenerateOptionsPrivate) { } GenerateOptions::GenerateOptions(const GenerateOptions &other) = default; GenerateOptions &GenerateOptions::operator=(const GenerateOptions &other) = default; GenerateOptions::~GenerateOptions() = default; /*! * Returns the name of the generator used to create the external build system files. * The default is empty. */ QString GenerateOptions::generatorName() const { return d->generatorName; } /*! * \brief Sets the name of the generator used to create the external build system files. */ void GenerateOptions::setGeneratorName(const QString &generatorName) { d->generatorName = generatorName; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/projectgeneratormanager.cpp0000644000175100017510000000567315154533055024245 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** 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$ ** ****************************************************************************/ #include "projectgeneratormanager.h" #include #include #include #include #include #include namespace qbs { using namespace Internal; ProjectGeneratorManager::~ProjectGeneratorManager() = default; ProjectGeneratorManager *ProjectGeneratorManager::instance() { static ProjectGeneratorManager generatorPlugin; return &generatorPlugin; } ProjectGeneratorManager::ProjectGeneratorManager() = default; QStringList ProjectGeneratorManager::loadedGeneratorNames() { return instance()->m_generators.keys(); } std::shared_ptr ProjectGeneratorManager::findGenerator(const QString &generatorName) { return instance()->m_generators.value(generatorName); } void ProjectGeneratorManager::registerGenerator(const std::shared_ptr &generator) { if (!findGenerator(generator->generatorName())) instance()->m_generators.insert(generator->generatorName(), generator); } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/profile.cpp0000644000175100017510000001741115154533055020766 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "profile.h" #include "qbsassert.h" #include "settings.h" #include "stringconstants.h" #include #include namespace qbs { /*! * \class Profile * \brief The \c Profile class gives access to the settings of a given profile. */ /*! * \enum Profile::KeySelection * This enum type specifies whether to enumerate keys recursively. * \value KeySelectionRecursive Indicates that key enumeration should happen recursively, i.e. * it should go up the base profile chain. * \value KeySelectionNonRecursive Indicates that only keys directly attached to a profile * should be listed. */ /*! * \brief Creates an object giving access to the settings for profile \c name. */ Profile::Profile(QString name, Settings *settings, QVariantMap profiles) : m_name(std::move(name)), m_settings(settings), m_values(profiles.value(m_name).toMap()), m_profiles(std::move(profiles)) { QBS_ASSERT(m_name == cleanName(m_name), return); } bool Profile::exists() const { return m_name == fallbackName() || !m_values.empty() || !m_settings->allKeysWithPrefix(profileKey(), Settings::allScopes()).empty(); } /*! * \brief Returns the value for property \c key in this profile. */ QVariant Profile::value(const QString &key, const QVariant &defaultValue, ErrorInfo *error) const { try { return possiblyInheritedValue(key, defaultValue, QStringList()); } catch (const ErrorInfo &e) { if (error) *error = e; return {}; } } /*! * \brief Gives value \c value to the property \c key in this profile. */ void Profile::setValue(const QString &key, const QVariant &value) { m_settings->setValue(fullyQualifiedKey(key), value); if (key == baseProfileKey()) { QBS_ASSERT(value.toString() == cleanName(value.toString()), return); } } /*! * \brief Removes a key and the associated value from this profile. */ void Profile::remove(const QString &key) { m_settings->remove(fullyQualifiedKey(key)); } /*! * \brief Returns the name of this profile. */ QString Profile::name() const { return m_name; } /*! * \brief Returns all property keys in this profile. * If and only if selection is Profile::KeySelectionRecursive, this will also list keys defined * in base profiles. */ QStringList Profile::allKeys(KeySelection selection, ErrorInfo *error) const { try { return allKeysInternal(selection, QStringList()); } catch (const ErrorInfo &e) { if (error) *error = e; return {}; } } /*! * \brief Returns the name of this profile's base profile. * The returned value is empty if the profile does not have a base profile. */ QString Profile::baseProfile() const { return localValue(baseProfileKey()).toString(); } /*! * \brief Sets a new base profile for this profile. */ void Profile::setBaseProfile(const QString &baseProfile) { setValue(baseProfileKey(), baseProfile); } /*! * \brief Removes this profile's base profile setting. */ void Profile::removeBaseProfile() { remove(baseProfileKey()); } /*! * \brief Removes this profile from the settings. */ void Profile::removeProfile() { m_settings->remove(profileKey()); } /*! * \brief Returns a string suitiable as a profile name. * Removes all dots and replaces them with hyphens. */ QString Profile::cleanName(const QString &name) { QString newName = name; return newName.replace(QLatin1Char('.'), QLatin1Char('-')); } QString Profile::profileKey() const { return Internal::StringConstants::profilesSettingsPrefix() + m_name; } QString Profile::baseProfileKey() { return Internal::StringConstants::baseProfileProperty(); } void Profile::checkBaseProfileExistence(const Profile &baseProfile) const { if (!baseProfile.exists()) throw ErrorInfo(Internal::Tr::tr("Profile \"%1\" has a non-existent base profile \"%2\".").arg( name(), baseProfile.name())); } QVariant Profile::localValue(const QString &key) const { QVariant val = m_values.value(key); if (!val.isValid()) val = m_settings->value(fullyQualifiedKey(key), Settings::allScopes()); return val; } QString Profile::fullyQualifiedKey(const QString &key) const { return profileKey() + QLatin1Char('.') + key; } QVariant Profile::possiblyInheritedValue(const QString &key, const QVariant &defaultValue, QStringList profileChain) const { extendAndCheckProfileChain(profileChain); QVariant v = localValue(key); if (v.isValid()) return v; const QString baseProfileName = baseProfile(); if (baseProfileName.isEmpty()) return defaultValue; Profile parentProfile(baseProfileName, m_settings, m_profiles); checkBaseProfileExistence(parentProfile); return parentProfile.possiblyInheritedValue(key, defaultValue, profileChain); } QStringList Profile::allKeysInternal(Profile::KeySelection selection, QStringList profileChain) const { extendAndCheckProfileChain(profileChain); QStringList keys = m_values.keys(); if (keys.empty()) keys = m_settings->allKeysWithPrefix(profileKey(), Settings::allScopes()); if (selection == KeySelectionNonRecursive) return keys; const QString baseProfileName = baseProfile(); if (baseProfileName.isEmpty()) return keys; Profile parentProfile(baseProfileName, m_settings, m_profiles); checkBaseProfileExistence(parentProfile); keys += parentProfile.allKeysInternal(KeySelectionRecursive, profileChain); keys.removeDuplicates(); keys.removeOne(baseProfileKey()); keys.sort(); return keys; } void Profile::extendAndCheckProfileChain(QStringList &chain) const { chain << m_name; if (Q_UNLIKELY(chain.count(m_name) > 1)) { throw ErrorInfo(Internal::Tr::tr("Circular profile inheritance. Cycle is '%1'.") .arg(chain.join(QLatin1String(" -> ")))); } } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/progressobserver.cpp0000644000175100017510000001012515154533055022735 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "progressobserver.h" namespace qbs { namespace Internal { /*! * \class ProgressObserver * The \c ProgressObserver class is used in long running qbs operations. It serves two purposes: * Firstly, it allows operations to indicate progress to a client. Secondly, a client can * signal to an operation that is should exit prematurely. * Clients of the qbs library are supposed to subclass this class and implement the virtual * functions in a way that lets users know about the current operation and its progress. */ /*! * \fn virtual void initialize(const QString &task, int maximum) = 0 * \brief Indicates that a new operation is starting. * Library code calls this function to indicate that it is starting a new task. * The \a task parameter is a textual description of that task suitable for presentation to a user. * The \a maximum parameter is an estimate of the maximum effort the operation is going to take. * This is helpful if the client wants to set up some sort of progress bar showing the * percentage of the work already done. */ /*! * \fn virtual void setProgressValue(int value) = 0 * \brief Sets the new progress value. * Library code calls this function to indicate that the current operation has progressed. * It will try hard to ensure that \a value will not exceed \c maximum(). * \sa ProgressObserver::maximum(). */ /*! * \fn virtual int progressValue() = 0 * \brief The current progress value. * Will typically reflect the \a value from the last call to \c setProgressValue() and should not * exceed \c maximum(). * \sa setProgressvalue() * \sa maximum() */ void ProgressObserver::incrementProgressValue(int increment) { setProgressValue(progressValue() + increment); } /*! * \fn virtual bool canceled() const = 0 * \brief Indicates whether the current operation should be canceled. * Library code will periodically call this function and abort the current operation * if it returns true. */ /*! * \fn virtual int maximum() const = 0 * \brief The expected maximum progress value. * This will typically be the value of \c maximum passed to \c initialize(). * \sa ProgressObserver::initialize() */ void ProgressObserver::setFinished() { setProgressValue(maximum()); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/filesaver.h0000644000175100017510000000507415154533055020755 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 FILESAVER_H #define FILESAVER_H #include "qbs_export.h" #include #include #include #include namespace qbs { namespace Internal { /*! * QSaveFile wrapper which doesn't update the target file if the contents are unchanged. */ class QBS_EXPORT FileSaver { public: FileSaver(std::string filePath, bool overwriteIfUnchanged = false); std::ostream *device(); bool open(); bool commit(); bool write(std::string_view data); private: std::string m_oldFileContents; std::shared_ptr m_memoryDevice; const std::string m_filePath; const bool m_overwriteIfUnchanged; }; } // namespace Internal } // namespace qbs #endif // FILESAVER_H qbs-src-3.2.0/src/lib/corelib/tools/vsenvironmentdetector.cpp0000644000175100017510000002414315154533055023775 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "vsenvironmentdetector.h" #include #include #include #include #include #include #include #include #include #include #ifdef Q_OS_WIN #include #include #endif namespace qbs { namespace Internal { static QString windowsSystem32Path() { #ifdef Q_OS_WIN wchar_t str[UNICODE_STRING_MAX_CHARS]; if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_SYSTEM, NULL, 0, str))) return QString::fromUtf16(reinterpret_cast(str)); #endif return {}; } VsEnvironmentDetector::VsEnvironmentDetector(QString vcvarsallPath) : m_windowsSystemDirPath(windowsSystem32Path()) , m_vcvarsallPath(std::move(vcvarsallPath)) { } bool VsEnvironmentDetector::start(MSVC *msvc) { return start(std::vector{ msvc }); } bool VsEnvironmentDetector::start(std::vector msvcs) { std::sort(msvcs.begin(), msvcs.end(), [] (const MSVC *a, const MSVC *b) -> bool { return a->vcInstallPath < b->vcInstallPath; }); std::vector compatibleMSVCs; QString lastVcInstallPath; bool someMSVCDetected = false; for (MSVC * const msvc : msvcs) { if (lastVcInstallPath != msvc->vcInstallPath) { lastVcInstallPath = msvc->vcInstallPath; if (!compatibleMSVCs.empty()) { if (startDetection(compatibleMSVCs)) someMSVCDetected = true; compatibleMSVCs.clear(); } } compatibleMSVCs.push_back(msvc); } if (startDetection(compatibleMSVCs)) someMSVCDetected = true; return someMSVCDetected; } QString VsEnvironmentDetector::findVcVarsAllBat(const MSVC &msvc, std::vector &searchedPaths) const { // ### We can only rely on MSVC.vcInstallPath being set // when this is called from utilitiesextension.cpp :-( // If we knew the vsInstallPath at this point we could just use that // instead of searching for vcvarsall.bat candidates. QDir dir(msvc.vcInstallPath); for (;;) { if (!dir.cdUp()) return {}; if (dir.dirName() == QLatin1String("VC")) break; } const QString vcvarsallbat = QStringLiteral("vcvarsall.bat"); QString path = vcvarsallbat; QString fullPath = dir.absoluteFilePath(path); if (dir.exists(path)) return fullPath; searchedPaths.push_back(fullPath); path = QStringLiteral("Auxiliary/Build/") + vcvarsallbat; fullPath = dir.absoluteFilePath(path); if (dir.exists(path)) return fullPath; searchedPaths.push_back(fullPath); return {}; } bool VsEnvironmentDetector::startDetection(const std::vector &compatibleMSVCs) { std::vector searchedPaths; if (!m_vcvarsallPath.isEmpty() && !QFileInfo::exists(m_vcvarsallPath)) { m_errorString = Tr::tr("%1 does not exist.").arg(m_vcvarsallPath); return false; } const auto vcvarsallbat = !m_vcvarsallPath.isEmpty() ? m_vcvarsallPath : findVcVarsAllBat(**compatibleMSVCs.begin(), searchedPaths); if (vcvarsallbat.isEmpty()) { if (!searchedPaths.empty()) { m_errorString = Tr::tr( "Cannot find 'vcvarsall.bat' at any of the following locations:\n\t") + join(searchedPaths, QStringLiteral("\n\t")); } else { m_errorString = Tr::tr("Cannot find 'vcvarsall.bat'."); } return false; } QTemporaryFile tmpFile(QDir::tempPath() + QLatin1Char('/') + QStringLiteral("XXXXXX.bat")); if (!tmpFile.open()) { m_errorString = Tr::tr("Cannot open temporary file '%1' for writing.").arg( tmpFile.fileName()); return false; } writeBatchFile(&tmpFile, vcvarsallbat, compatibleMSVCs); tmpFile.flush(); QProcess process; static const QString shellFilePath = QStringLiteral("cmd.exe"); process.start(shellFilePath, QStringList() << QStringLiteral("/C") << tmpFile.fileName()); if (!process.waitForStarted()) { m_errorString = Tr::tr("Failed to start '%1'.").arg(shellFilePath); return false; } process.waitForFinished(-1); if (process.exitStatus() != QProcess::NormalExit) { m_errorString = Tr::tr("Process '%1' did not exit normally.").arg(shellFilePath); return false; } if (process.exitCode() != 0) { m_errorString = Tr::tr("Failed to detect Visual Studio environment."); return false; } parseBatOutput(process.readAllStandardOutput(), compatibleMSVCs); return true; } static void batClearVars(QTextStream &s, const QStringList &varnames) { for (const QString &varname : varnames) s << "set " << varname << '=' << Qt::endl; } static void batPrintVars(QTextStream &s, const QStringList &varnames) { for (const QString &varname : varnames) s << "echo " << varname << "=%" << varname << '%' << Qt::endl; } static QString vcArchitecture(const MSVC *msvc) { QString vcArch = msvc->architecture; if (msvc->architecture == StringConstants::armv7Arch()) vcArch = StringConstants::armArch(); if (msvc->architecture == StringConstants::x86_64Arch()) vcArch = StringConstants::amd64Arch(); const QString hostPrefixes[] = { StringConstants::x86Arch(), QStringLiteral("amd64_"), QStringLiteral("x86_") }; for (const QString &hostPrefix : hostPrefixes) { if (QFile::exists(msvc->clPathForArchitecture(hostPrefix + vcArch))) { vcArch.prepend(hostPrefix); break; } } return vcArch; } void VsEnvironmentDetector::writeBatchFile(QIODevice *device, const QString &vcvarsallbat, const std::vector &msvcs) const { const QStringList varnames = QStringList() << StringConstants::pathEnvVar() << QStringLiteral("INCLUDE") << QStringLiteral("LIB") << QStringLiteral("WindowsSdkDir") << QStringLiteral("WindowsSDKVersion") << QStringLiteral("VSINSTALLDIR"); QTextStream s(device); using Qt::endl; s << "@echo off" << endl; // Avoid execution of powershell (in vsdevcmd.bat), which is not in the cleared PATH s << "set VSCMD_SKIP_SENDTELEMETRY=1" << endl; for (const MSVC *msvc : msvcs) { s << "echo --" << msvc->architecture << "--" << endl << "setlocal" << endl; batClearVars(s, varnames); s << "set PATH=" << m_windowsSystemDirPath << endl; // vcvarsall.bat needs tools from here s << "call \"" << vcvarsallbat << "\" " << vcArchitecture(msvc); if (!msvc->sdkVersion.isEmpty()) s << " " << msvc->sdkVersion; const auto vcVarsVer = MSVC::vcVariablesVersionFromBinPath(msvc->binPath); if (!vcVarsVer.isEmpty()) s << " -vcvars_ver=" << vcVarsVer; s << " || exit /b 1" << endl; batPrintVars(s, varnames); s << "endlocal" << endl; } } void VsEnvironmentDetector::parseBatOutput(const QByteArray &output, std::vector msvcs) { QString arch; QProcessEnvironment *targetEnv = nullptr; const auto lines = output.split('\n'); for (QByteArray line : lines) { line = line.trimmed(); if (line.isEmpty()) continue; if (line.startsWith("--") && line.endsWith("--")) { line.remove(0, 2); line.chop(2); arch = QString::fromLocal8Bit(line); targetEnv = &msvcs.front()->environment; msvcs.erase(msvcs.begin()); } else { int idx = line.indexOf('='); if (idx < 0) continue; QBS_CHECK(targetEnv); const QString name = QString::fromLocal8Bit(line.left(idx)); QString value = QString::fromLocal8Bit(line.mid(idx + 1)); if (name.compare(StringConstants::pathEnvVar(), Qt::CaseInsensitive) == 0) value.remove(m_windowsSystemDirPath); if (value.endsWith(QLatin1Char(';'))) value.chop(1); targetEnv->insert(name, value); } } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/clangclinfo.cpp0000644000175100017510000001473615154533055021614 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "clangclinfo.h" #include "hostosinfo.h" #include "msvcinfo.h" #include "stlutils.h" namespace qbs { namespace Internal { static std::vector compatibleMsvcs(Logger &logger) { auto msvcs = MSVCInstallInfo::installedMSVCs(logger); auto filter = [](const MSVCInstallInfo &info) { const auto versions = info.version.split(QLatin1Char('.')); if (versions.empty()) return true; bool ok = false; const int major = versions.at(0).toInt(&ok); return !ok || major < 15; // support MSVC2017 and above }; Internal::removeIf(msvcs, filter); for (const auto &msvc: msvcs) { auto vcvarsallPath = msvc.findVcvarsallBat(); if (vcvarsallPath.isEmpty()) continue; } return msvcs; } static QString findCompatibleVcsarsallBat(const std::vector &msvcs) { for (const auto &msvc: msvcs) { auto vcvarsallPath = msvc.findVcvarsallBat(); if (!vcvarsallPath.isEmpty()) return vcvarsallPath; } return {}; } static QString wow6432Key() { #ifdef Q_OS_WIN64 return QStringLiteral("\\Wow6432Node"); #else return {}; #endif } static QString getToolchainInstallPath(const QFileInfo &compiler) { return compiler.path(); // 1 level up } QVariantMap ClangClInfo::toVariantMap() const { return { {QStringLiteral("toolchainInstallPath"), toolchainInstallPath}, {QStringLiteral("vcvarsallPath"), vcvarsallPath}, }; } ClangClInfo ClangClInfo::fromCompilerFilePath(const QString &path, Logger &logger) { const auto compilerName = QStringLiteral("clang-cl"); const auto vcvarsallPath = findCompatibleVcsarsallBat(compatibleMsvcs(logger)); if (vcvarsallPath.isEmpty()) { logger.qbsWarning() << Tr::tr("%1 requires installed Visual Studio 2017 or newer, but none was found.") .arg(compilerName); return {}; } return {getToolchainInstallPath(QFileInfo(path)), vcvarsallPath}; } std::vector ClangClInfo::installedCompilers( const std::vector &extraPaths, Logger &logger) { std::vector compilerPaths; compilerPaths.reserve(extraPaths.size()); std::copy_if(extraPaths.begin(), extraPaths.end(), std::back_inserter(compilerPaths), [](const QString &path){ return !path.isEmpty(); }); const auto compilerName = HostOsInfo::appendExecutableSuffix(QStringLiteral("clang-cl")); const QSettings registry( QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\LLVM\\LLVM").arg(wow6432Key()), QSettings::NativeFormat); const auto key = QStringLiteral("."); if (registry.contains(key)) { const auto compilerPath = QDir::fromNativeSeparators(registry.value(key).toString()) + QStringLiteral("/bin/") + compilerName; if (QFileInfo::exists(compilerPath) && !contains(compilerPaths, compilerPath)) compilerPaths.push_back(compilerPath); } // this branch can be useful in case user had two LLVM installations (e.g. 32bit & 64bit) // but uninstalled one - in that case, registry will be empty static const char * const envVarCandidates[] = {"ProgramFiles", "ProgramFiles(x86)"}; for (const auto &envVar : envVarCandidates) { const auto value = QDir::fromNativeSeparators(QString::fromLocal8Bit(qgetenv(envVar))); const auto compilerPath = value + QStringLiteral("/LLVM/bin/") + compilerName; if (QFileInfo::exists(compilerPath) && !contains(compilerPaths, compilerPath)) compilerPaths.push_back(compilerPath); } const auto msvcs = compatibleMsvcs(logger); const auto vcvarsallPath = findCompatibleVcsarsallBat(msvcs); if (vcvarsallPath.isEmpty()) { logger.qbsWarning() << Tr::tr("%1 requires installed Visual Studio 2017 or newer, but none was found.") .arg(compilerName); return {}; } std::vector result; result.reserve(compilerPaths.size() + msvcs.size()); transform(compilerPaths, result, [&vcvarsallPath](const auto &path) { return ClangClInfo{getToolchainInstallPath(QFileInfo(path)), vcvarsallPath}; }); // If we didn't find custom LLVM installation, try to find if it's installed with Visual Studio for (const auto &msvc : msvcs) { const auto compilerPath = QStringLiteral("%1/VC/Tools/Llvm/bin/%2") .arg(msvc.installDir, compilerName); if (QFileInfo::exists(compilerPath)) { const auto vcvarsallPath = msvc.findVcvarsallBat(); if (vcvarsallPath.isEmpty()) { logger.qbsWarning() << Tr::tr("Found LLVM in %1, but vcvarsall.bat is missing.") .arg(msvc.installDir); } result.push_back({getToolchainInstallPath(QFileInfo(compilerPath)), vcvarsallPath}); } } return result; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/buildgraphlocker.cpp0000644000175100017510000001420615154533055022646 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "buildgraphlocker.h" #include "error.h" #include "hostosinfo.h" #include "processutils.h" #include "progressobserver.h" #include "stringconstants.h" #include #include #include #include #include namespace qbs { namespace Internal { DirectoryManager::DirectoryManager(QString dir, Logger logger) : m_dir(std::move(dir)), m_logger(std::move(logger)) { rememberCreatedDirectories(); } DirectoryManager::~DirectoryManager() { removeEmptyCreatedDirectories(); } void DirectoryManager::rememberCreatedDirectories() { QString parentDir = m_dir; while (!QFileInfo::exists(parentDir)) { m_createdParentDirs.push(parentDir); parentDir = QDir::cleanPath(parentDir + StringConstants::slashDotDot()); } } void DirectoryManager::removeEmptyCreatedDirectories() { QDir root = QDir::root(); while (!m_createdParentDirs.empty()) { const QString parentDir = m_createdParentDirs.front(); m_createdParentDirs.pop(); QDirIterator it(parentDir, QDir::AllEntries | QDir::NoDotAndDotDot | QDir::System, QDirIterator::Subdirectories); if (it.hasNext()) break; if (!root.rmdir(parentDir) && m_logger.logSink()) { m_logger.printWarning(ErrorInfo(Tr::tr("Failed to remove empty directory '%1'.") .arg(parentDir))); } } } static void tryCreateBuildDirectory(const QString &buildDir, const QString &buildGraphFilePath) { if (!QDir::root().mkpath(buildDir)) { throw ErrorInfo(Tr::tr("Cannot lock build graph file '%1': Failed to create directory.") .arg(buildGraphFilePath)); } } static bool appNamesAreEqual(const QString &app1, const QString &app2) { return QString::compare(app1, app2, HostOsInfo::fileNameCaseSensitivity()) == 0; } BuildGraphLocker::BuildGraphLocker(const QString &buildGraphFilePath, const Logger &logger, bool waitIndefinitely, ProgressObserver *observer) : m_lockFile(buildGraphFilePath + QStringLiteral(".lock")) , m_logger(logger) , m_dirManager(QFileInfo(buildGraphFilePath).absolutePath(), logger) { if (waitIndefinitely) m_logger.qbsDebug() << "Waiting to acquire lock file..."; m_lockFile.setStaleLockTime(0); int attemptsToGetInfo = 0; do { if (observer && observer->canceled()) break; tryCreateBuildDirectory(m_dirManager.dir(), buildGraphFilePath); if (m_lockFile.tryLock(250)) return; switch (m_lockFile.error()) { case QLockFile::LockFailedError: { if (waitIndefinitely) continue; qint64 pid; QString hostName; QString appName; if (m_lockFile.getLockInfo(&pid, &hostName, &appName)) { if (appNamesAreEqual(appName, processNameByPid(pid))) { throw ErrorInfo(Tr::tr("Cannot lock build graph file '%1': " "Already locked by '%2' (PID %3).") .arg(buildGraphFilePath, appName).arg(pid)); } // The process id was reused by some other process. m_logger.qbsInfo() << Tr::tr("Removing stale lock file."); m_lockFile.removeStaleLockFile(); } break; } case QLockFile::PermissionError: throw ErrorInfo(Tr::tr("Cannot lock build graph file '%1': Permission denied.") .arg(buildGraphFilePath)); case QLockFile::UnknownError: case QLockFile::NoError: throw ErrorInfo(Tr::tr("Cannot lock build graph file '%1' (reason unknown).") .arg(buildGraphFilePath)); } } while (++attemptsToGetInfo < 10 || waitIndefinitely); // This very unlikely case arises if tryLock() repeatedly returns LockFailedError // with the subsequent getLockInfo() failing as well. throw ErrorInfo(Tr::tr("Cannot lock build graph file '%1' (reason unknown).") .arg(buildGraphFilePath)); } BuildGraphLocker::~BuildGraphLocker() { m_lockFile.unlock(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/scannerpluginmanager.h0000644000175100017510000000476615154533055023207 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PLUGINS_SCANNER_H #define QBS_PLUGINS_SCANNER_H #include "qbs_export.h" #include #include class ScannerPlugin; namespace qbs { namespace Internal { class FileTag; class ScannerPluginManagerPrivate; class QBS_EXPORT ScannerPluginManager { public: ~ScannerPluginManager(); static ScannerPluginManager *instance(); static std::vector scannersForFileTag(const FileTag &fileTag); void registerPlugins(ScannerPlugin **plugins); private: ScannerPluginManager(); std::unique_ptr d; }; } // namespace Internal } // namespace qbs #endif // QBS_PLUGINS_SCANNER_H qbs-src-3.2.0/src/lib/corelib/tools/processresult_p.h0000644000175100017510000000464715154533055022236 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROCESSRESULT_P_H #define QBS_PROCESSRESULT_P_H #include #include #include namespace qbs { namespace Internal { class ProcessResultPrivate : public QSharedData { public: bool success = false; QString executableFilePath; QStringList arguments; QString workingDirectory; QProcess::ProcessError error = QProcess::ProcessError::UnknownError; int exitCode = 0; QStringList stdOut; QStringList stdErr; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/tools/visualstudioversioninfo.cpp0000644000175100017510000001347715154533055024353 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** 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$ ** ****************************************************************************/ #include "visualstudioversioninfo.h" #include #include #include namespace qbs { namespace Internal { VisualStudioVersionInfo::VisualStudioVersionInfo() = default; VisualStudioVersionInfo::VisualStudioVersionInfo(const Version &version) : m_version(version) { QBS_CHECK(version.minorVersion() == 0 || version == Version(7, 1) || version.majorVersion() >= 15); } std::set VisualStudioVersionInfo::knownVersions() { static const std::set known = { Version(17), Version(16), Version(15), Version(14), Version(12), Version(11), Version(10), Version(9), Version(8), Version(7, 1), Version(7), Version(6) }; return known; } bool VisualStudioVersionInfo::operator<(const VisualStudioVersionInfo &other) const { return m_version < other.m_version; } bool VisualStudioVersionInfo::operator==(const VisualStudioVersionInfo &other) const { return m_version == other.m_version; } bool VisualStudioVersionInfo::usesMsBuild() const { return m_version.majorVersion() >= 10; } bool VisualStudioVersionInfo::usesVcBuild() const { return m_version.majorVersion() <= 9; } bool VisualStudioVersionInfo::usesSolutions() const { return m_version.majorVersion() >= 7; } Version VisualStudioVersionInfo::version() const { return m_version; } int VisualStudioVersionInfo::marketingVersion() const { switch (m_version.majorVersion()) { case 6: return 6; case 7: switch (m_version.minorVersion()) { case 0: return 2002; case 1: return 2003; default: Q_UNREACHABLE(); } break; case 8: return 2005; case 9: return 2008; case 10: return 2010; case 11: return 2012; case 12: return 2013; case 14: return 2015; case 15: return 2017; case 16: return 2019; case 17: return 2022; default: qWarning() << QStringLiteral("unrecognized Visual Studio version: ") << m_version.toString(); return 0; } } QString VisualStudioVersionInfo::solutionVersion() const { // Visual Studio 2012 finally stabilized the solution version if (m_version >= Version(11)) return QStringLiteral("12.00"); if (m_version >= Version(8)) return QStringLiteral("%1.00").arg(m_version.majorVersion() + 1); if (m_version >= Version(7, 1)) return QStringLiteral("8.00"); if (m_version >= Version(7)) return QStringLiteral("7.00"); // these versions do not use solution files // Visual Studio 6 uses .dsw files which are format version 6.00 but these are different Q_ASSERT(!usesSolutions()); Q_UNREACHABLE(); } QString VisualStudioVersionInfo::toolsVersion() const { // "https://msdn.microsoft.com/en-us/library/bb383796.aspx" // Starting in Visual Studio 2013, the MSBuild Toolset version is the same as the Visual Studio // version number"... again if (m_version >= Version(12)) return QStringLiteral("%1.0").arg(m_version.majorVersion()); if (m_version >= Version(10)) return QStringLiteral("4.0"); // pre-MSBuild return QStringLiteral("%1,00").arg(m_version.majorVersion()); } QString VisualStudioVersionInfo::platformToolsetVersion() const { static std::pair table[] = { {17, QStringLiteral("v143")}, // VS 2022 {16, QStringLiteral("v142")}, // VS 2019 {15, QStringLiteral("v141")} // VS 2017 }; for (const auto &p : table) { if (p.first == m_version.majorVersion()) return p.second; } return QStringLiteral("v%1").arg(m_version.majorVersion() * 10); } QHashValueType qHash(const VisualStudioVersionInfo &info) { return qHash(info.version().toString()); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/qbspluginmanager.h0000644000175100017510000000607415154533055022335 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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_PLUGINS_H #define QBS_PLUGINS_H #include "qbs_export.h" #include #include #include namespace qbs { namespace Internal { class Logger; typedef void (*QbsPluginLoadFunction)(); typedef void (*QbsPluginUnloadFunction)(); class QbsPluginManagerPrivate; class QBS_EXPORT QbsPluginManager { public: ~QbsPluginManager(); static QbsPluginManager *instance(); void registerStaticPlugin(QbsPluginLoadFunction, QbsPluginUnloadFunction); void loadStaticPlugins(); void unloadStaticPlugins(); void loadPlugins(const std::vector &paths, const Logger &logger); protected: QbsPluginManager(); private: std::unique_ptr d; }; } // namespace Internal } // namespace qbs #ifdef QBS_STATIC_LIB #define QBS_REGISTER_STATIC_PLUGIN(exportmacro, name, load, unload) \ extern "C" bool qbs_static_plugin_register_##name = [] { \ qbs::Internal::QbsPluginManager::instance()->registerStaticPlugin(load, unload); \ return true; \ }(); #else #define QBS_REGISTER_STATIC_PLUGIN(exportmacro, name, load, unload) \ exportmacro void QbsPluginLoad() { load(); } \ exportmacro void QbsPluginUnload() { unload(); } #endif #endif qbs-src-3.2.0/src/lib/corelib/tools/joblimits.h0000644000175100017510000000634115154533055020767 0ustar runnerrunner/**************************************************************************** ** ** 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_JOB_LIMITS_H #define QBS_JOB_LIMITS_H #include "qbs_export.h" #include QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE namespace qbs { namespace Internal { class JobLimitPrivate; class JobLimitsPrivate; class PersistentPool; } class QBS_EXPORT JobLimit { public: JobLimit(); JobLimit(const QString &pool, int limit); JobLimit(const JobLimit &other); JobLimit &operator=(const JobLimit &other); ~JobLimit(); QString pool() const; int limit() const; void load(Internal::PersistentPool &pool); void store(Internal::PersistentPool &pool); private: QSharedDataPointer d; }; class QBS_EXPORT JobLimits { public: JobLimits(); JobLimits(const JobLimits &other); JobLimits &operator=(const JobLimits &other); ~JobLimits(); void setJobLimit(const JobLimit &limit); void setJobLimit(const QString &pool, int limit); int getLimit(const QString &pool) const; bool hasLimit(const QString &pool) const { return getLimit(pool) != -1; } bool isEmpty() const; int count() const; JobLimit jobLimitAt(int i) const; JobLimits &update(const JobLimits &other); void load(Internal::PersistentPool &pool); void store(Internal::PersistentPool &pool); private: QSharedDataPointer d; }; } // namespace qbs #endif // include guard qbs-src-3.2.0/src/lib/corelib/tools/processresult.h0000644000175100017510000000563215154533055021712 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROCESSRESULT_H #define QBS_PROCESSRESULT_H #include "qbs_export.h" #include #include #include #include QT_BEGIN_NAMESPACE class QJsonObject; QT_END_NAMESPACE namespace qbs { namespace Internal { class ProcessCommandExecutor; class ProcessResultPrivate; } class QBS_EXPORT ProcessResult { friend class qbs::Internal::ProcessCommandExecutor; public: ProcessResult(); ProcessResult(const ProcessResult &other); ProcessResult &operator=(const ProcessResult &other); ~ProcessResult(); QJsonObject toJson() const; bool success() const; QString executableFilePath() const; QStringList arguments() const; QString workingDirectory() const; QProcess::ProcessError error() const; int exitCode() const; QStringList stdOut() const; QStringList stdErr() const; private: QExplicitlySharedDataPointer d; }; } // namespace qbs Q_DECLARE_METATYPE(qbs::ProcessResult) #endif // QBS_PROCESSRESULT_H qbs-src-3.2.0/src/lib/corelib/tools/filesaver.cpp0000644000175100017510000000736215154533055021312 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "filesaver.h" #include "stlutils.h" #include #include #include namespace qbs { namespace Internal { FileSaver::FileSaver(std::string filePath, bool overwriteIfUnchanged) : m_filePath(std::move(filePath)), m_overwriteIfUnchanged(overwriteIfUnchanged) { } std::ostream *FileSaver::device() { return m_memoryDevice.get(); } bool FileSaver::open() { if (!m_overwriteIfUnchanged) { std::ifstream file(utf8_to_native_path(m_filePath)); if (file.is_open()) m_oldFileContents.assign(std::istreambuf_iterator(file), std::istreambuf_iterator()); else m_oldFileContents.clear(); } m_memoryDevice = std::make_shared(); return true; } bool FileSaver::commit() { if (!device()) return false; device()->flush(); if (!device()->good()) return false; const std::string newFileContents = m_memoryDevice->str(); if (!m_overwriteIfUnchanged && m_oldFileContents == newFileContents) return true; // no need to write unchanged data const std::string tempFilePath = m_filePath + "~"; std::ofstream tempFile(utf8_to_native_path(tempFilePath)); if (!tempFile.is_open()) return false; tempFile.write(newFileContents.data(), newFileContents.size()); tempFile.close(); if (!tempFile.good()) return false; if (Internal::rename(tempFilePath, m_filePath) != 0) { if (errno != EEXIST) return false; if (Internal::unlink(m_filePath) != 0) return false; return Internal::rename(tempFilePath, m_filePath) == 0; } return true; } bool FileSaver::write(std::string_view data) { return Internal::fwrite(data.data(), data.size(), device()); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/hostosinfo.h0000644000175100017510000002411215154533055021162 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_HOSTOSINFO_H #define QBS_HOSTOSINFO_H #include "qbs_export.h" #include "stlutils.h" #include "version.h" #include #include #include #include #include #if defined(Q_OS_WIN) #define QBS_HOST_EXE_SUFFIX ".exe" #define QBS_HOST_DYNAMICLIB_PREFIX "" #define QBS_HOST_DYNAMICLIB_SUFFIX ".dll" #elif defined(Q_OS_DARWIN) #define QBS_HOST_EXE_SUFFIX "" #define QBS_HOST_DYNAMICLIB_PREFIX "lib" #define QBS_HOST_DYNAMICLIB_SUFFIX ".dylib" #else #define QBS_HOST_EXE_SUFFIX "" #define QBS_HOST_DYNAMICLIB_PREFIX "lib" #define QBS_HOST_DYNAMICLIB_SUFFIX ".so" #endif // Q_OS_WIN namespace qbs { namespace Internal { class HostOsInfo { public: // Add more as needed. enum HostOs { HostOsWindows, HostOsLinux, HostOsMacos, HostOsOtherUnix, HostOsOther }; static inline QString hostOSIdentifier(); static inline QString hostOSArchitecture(); static inline std::vector hostOSIdentifiers(); static inline std::vector canonicalOSIdentifiers(const QString &os); static inline HostOs hostOs(); static inline Version hostOsVersion() { Version v; if (HostOsInfo::isWindowsHost()) { QSettings settings(QStringLiteral("HKEY_LOCAL_MACHINE\\Software\\" "Microsoft\\Windows NT\\CurrentVersion"), QSettings::NativeFormat); v = v.fromString(settings.value(QStringLiteral("CurrentVersion")).toString() + QLatin1Char('.') + settings.value(QStringLiteral("CurrentBuildNumber")).toString()); Q_ASSERT(v.isValid()); } else if (HostOsInfo::isMacosHost()) { QSettings settings(QStringLiteral("/System/Library/CoreServices/SystemVersion.plist"), QSettings::NativeFormat); v = v.fromString(settings.value(QStringLiteral("ProductVersion")).toString()); Q_ASSERT(v.isValid()); } return v; } static QString hostOsBuildVersion() { QString v; if (HostOsInfo::isWindowsHost()) { QSettings settings(QStringLiteral("HKEY_LOCAL_MACHINE\\Software\\" "Microsoft\\Windows NT\\CurrentVersion"), QSettings::NativeFormat); v = settings.value(QStringLiteral("CurrentBuildNumber")).toString(); } else if (HostOsInfo::isMacosHost()) { QSettings serverSettings(QStringLiteral( "/System/Library/CoreServices/ServerVersion.plist"), QSettings::NativeFormat); v = serverSettings.value(QStringLiteral("ProductBuildVersion")).toString(); if (v.isNull()) { QSettings systemSettings(QStringLiteral( "/System/Library/CoreServices/SystemVersion.plist"), QSettings::NativeFormat); v = systemSettings.value(QStringLiteral("ProductBuildVersion")).toString(); } } return v; } static bool isWindowsHost() { return hostOs() == HostOsWindows; } static bool isLinuxHost() { return hostOs() == HostOsLinux; } static bool isMacosHost() { return hostOs() == HostOsMacos; } static inline bool isAnyUnixHost(); static inline QString rfc1034Identifier(const QString &str); static QString appendExecutableSuffix(const QString &executable) { QString finalName = executable; if (isWindowsHost()) finalName += QLatin1String(QBS_HOST_EXE_SUFFIX); return finalName; } static QString stripExecutableSuffix(const QString &executable) { constexpr QLatin1String suffix(QBS_HOST_EXE_SUFFIX, sizeof(QBS_HOST_EXE_SUFFIX) - 1); return !suffix.isEmpty() && executable.endsWith(suffix) ? executable.chopped(suffix.size()) : executable; } static QString dynamicLibraryName(const QString &libraryBaseName) { return QLatin1String(QBS_HOST_DYNAMICLIB_PREFIX) + libraryBaseName + QLatin1String(QBS_HOST_DYNAMICLIB_SUFFIX); } static Qt::CaseSensitivity fileNameCaseSensitivity() { return isWindowsHost() ? Qt::CaseInsensitive: Qt::CaseSensitive; } static QString libraryPathEnvironmentVariable() { if (isWindowsHost()) return QStringLiteral("PATH"); if (isMacosHost()) return QStringLiteral("DYLD_LIBRARY_PATH"); return QStringLiteral("LD_LIBRARY_PATH"); } static QChar pathListSeparator(HostOsInfo::HostOs hostOs = HostOsInfo::hostOs()) { return hostOs == HostOsWindows ? QLatin1Char(';') : QLatin1Char(':'); } static QChar pathSeparator(HostOsInfo::HostOs hostOs = HostOsInfo::hostOs()) { return hostOs == HostOsWindows ? QLatin1Char('\\') : QLatin1Char('/'); } static Qt::KeyboardModifier controlModifier() { return isMacosHost() ? Qt::MetaModifier : Qt::ControlModifier; } }; QString HostOsInfo::hostOSIdentifier() { #if defined(__APPLE__) return QStringLiteral("macos"); #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) return QStringLiteral("windows"); #elif defined(_AIX) return QStringLiteral("aix"); #elif defined(hpux) || defined(__hpux) return QStringLiteral("hpux"); #elif defined(__sun) || defined(sun) return QStringLiteral("solaris"); #elif defined(__linux__) || defined(__linux) return QStringLiteral("linux"); #elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) return QStringLiteral("freebsd"); #elif defined(__NetBSD__) return QStringLiteral("netbsd"); #elif defined(__OpenBSD__) return QStringLiteral("openbsd"); #elif defined(__GNU__) return QStringLiteral("hurd"); #elif defined(__HAIKU__) return QStringLiteral("haiku"); #else #warning "Qbs has not been ported to this OS - see http://qbs.io/" return {}; #endif } QString HostOsInfo::hostOSArchitecture() { const auto cpuArch = QSysInfo::currentCpuArchitecture(); if (cpuArch == QLatin1String("i386")) return QStringLiteral("x86"); return cpuArch; } std::vector HostOsInfo::hostOSIdentifiers() { return canonicalOSIdentifiers(hostOSIdentifier()); } std::vector HostOsInfo::canonicalOSIdentifiers(const QString &name) { std::vector list { name }; if (contains({u"ios-simulator"}, name)) list << canonicalOSIdentifiers(QStringLiteral("ios")); if (contains({u"tvos-simulator"}, name)) list << canonicalOSIdentifiers(QStringLiteral("tvos")); if (contains({u"watchos-simulator"}, name)) list << canonicalOSIdentifiers(QStringLiteral("watchos")); if (contains({u"macos", u"ios", u"tvos", u"watchos"}, name)) list << canonicalOSIdentifiers(QStringLiteral("darwin")); if (contains({u"darwin", u"freebsd", u"netbsd", u"openbsd"}, name)) list << canonicalOSIdentifiers(QStringLiteral("bsd")); if (contains({u"android"}, name)) list << canonicalOSIdentifiers(QStringLiteral("linux")); // Note: recognized non-Unix platforms include: windows, haiku, vxworks if (contains({u"bsd", u"aix", u"hpux", u"solaris", u"linux", u"hurd", u"qnx", u"integrity"}, name)) list << canonicalOSIdentifiers(QStringLiteral("unix")); return list; } HostOsInfo::HostOs HostOsInfo::hostOs() { #if defined(Q_OS_WIN) return HostOsWindows; #elif defined(Q_OS_LINUX) return HostOsLinux; #elif defined(Q_OS_DARWIN) return HostOsMacos; #elif defined(Q_OS_UNIX) return HostOsOtherUnix; #else return HostOsOther; #endif } bool HostOsInfo::isAnyUnixHost() { #ifdef Q_OS_UNIX return true; #else return false; #endif } QString HostOsInfo::rfc1034Identifier(const QString &str) { QString s = str; for (QChar &ch : s) { const char c = ch.toLatin1(); const bool okChar = (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '-' || c == '.'; if (!okChar) ch = QChar::fromLatin1('-'); } return s; } } // namespace Internal } // namespace qbs #endif // QBS_HOSTOSINFO_H qbs-src-3.2.0/src/lib/corelib/tools/qttools.cpp0000644000175100017510000000610615154533055021032 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "qttools.h" #include "porting.h" #include namespace std { size_t hash::operator()(const QVariant &v) const noexcept { switch (v.userType()) { case QMetaType::UnknownType: return 0; case QMetaType::Bool: return std::hash()(v.toBool()); case QMetaType::Int: return std::hash()(v.toInt()); case QMetaType::UInt: return std::hash()(v.toUInt()); case QMetaType::QString: return std::hash()(v.toString()); case QMetaType::QStringList: return std::hash()(v.toStringList()); case QMetaType::QVariantList: return std::hash()(v.toList()); case QMetaType::QVariantMap: return std::hash()(v.toMap()); case QMetaType::QVariantHash: return std::hash()(v.toHash()); default: QBS_ASSERT("Unsupported variant type" && false, return 0); } } } // namespace std QT_BEGIN_NAMESPACE qbs::QHashValueType qHash(const QStringList &list) { qbs::QHashValueType s = 0; for (const QString &n : list) s ^= qHash(n) + 0x9e3779b9 + (s << 6) + (s >> 2); return s; } qbs::QHashValueType qHash(const QProcessEnvironment &env) { return qHash(env.toStringList()); } QT_END_NAMESPACE qbs-src-3.2.0/src/lib/corelib/tools/applecodesignutils.h0000644000175100017510000000434115154533055022667 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_APPLECODESIGNUTILS_H #define QBS_APPLECODESIGNUTILS_H #include "qbs_export.h" #include namespace qbs { namespace Internal { QByteArray smimeMessageContent(const QByteArray &data); QVariantMap certificateInfo(const QByteArray &data); QVariantMap identitiesProperties(); } // namespace Internal } // namespace qbs #endif // QBS_APPLECODESIGNUTILS_H qbs-src-3.2.0/src/lib/corelib/tools/launcherinterface.cpp0000644000175100017510000001313115154533055023003 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "launcherinterface.h" #include "launcherpackets.h" #include "launchersocket.h" #include "qbsassert.h" #include #include #include #include #include #include #include #include #ifdef Q_OS_UNIX #include #endif namespace qbs { namespace Internal { class LauncherProcess : public QProcess { public: LauncherProcess(QObject *parent) : QProcess(parent) { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && defined(Q_OS_UNIX) setChildProcessModifier([this] { setupChildProcess_impl(); }); #endif } private: #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) void setupChildProcess() override { setupChildProcess_impl(); } #endif void setupChildProcess_impl() { #ifdef Q_OS_UNIX const auto pid = static_cast(processId()); setpgid(pid, pid); #endif } }; static QString launcherSocketName() { return QStringLiteral("qbs_processlauncher-%1") .arg(QString::number(qApp->applicationPid())); } LauncherInterface::LauncherInterface() : m_server(new QLocalServer(this)), m_socket(new LauncherSocket(this)) { QObject::connect(m_server, &QLocalServer::newConnection, this, &LauncherInterface::handleNewConnection); } LauncherInterface &LauncherInterface::instance() { static LauncherInterface p; return p; } LauncherInterface::~LauncherInterface() { m_server->disconnect(); } void LauncherInterface::doStart() { if (++m_startRequests > 1) return; const QString &socketName = launcherSocketName(); QLocalServer::removeServer(socketName); if (!m_server->listen(socketName)) { emit errorOccurred(ErrorInfo(m_server->errorString())); return; } m_process = new LauncherProcess(this); connect(m_process, &QProcess::errorOccurred, this, &LauncherInterface::handleProcessError); connect(m_process, static_cast(&QProcess::finished), this, &LauncherInterface::handleProcessFinished); connect(m_process, &QProcess::readyReadStandardError, this, &LauncherInterface::handleProcessStderr); m_process->start( qbsApplicationDirPath() + QLatin1Char('/') + QLatin1String(QBS_RELATIVE_LIBEXEC_PATH) + QLatin1String("/qbs_processlauncher"), QStringList(m_server->fullServerName())); } void LauncherInterface::doStop() { if (--m_startRequests > 0) return; m_server->close(); if (!m_process) return; m_process->disconnect(); m_socket->shutdown(); m_process->waitForFinished(3000); m_process->deleteLater(); m_process = nullptr; } void LauncherInterface::handleNewConnection() { QLocalSocket * const socket = m_server->nextPendingConnection(); if (!socket) return; m_server->close(); m_socket->setSocket(socket); } void LauncherInterface::handleProcessError() { if (m_process->error() == QProcess::FailedToStart) { const QString launcherPathForUser = QDir::toNativeSeparators(QDir::cleanPath(m_process->program())); emit errorOccurred(ErrorInfo(Tr::tr("Failed to start process launcher at '%1': %2") .arg(launcherPathForUser, m_process->errorString()))); } } void LauncherInterface::handleProcessFinished() { emit errorOccurred(ErrorInfo(Tr::tr("Process launcher closed unexpectedly: %1") .arg(m_process->errorString()))); } void LauncherInterface::handleProcessStderr() { qDebug() << "[launcher]" << m_process->readAllStandardError(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/qbspluginmanager.cpp0000644000175100017510000001255215154533055022666 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "qbspluginmanager.h" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { struct QbsPlugin { QbsPluginLoadFunction load; QbsPluginUnloadFunction unload; bool loaded; }; class QbsPluginManagerPrivate { public: std::vector staticPlugins; std::vector libs; }; QbsPluginManager::QbsPluginManager() : d(new QbsPluginManagerPrivate) { } QbsPluginManager::~QbsPluginManager() { unloadStaticPlugins(); for (QLibrary * const lib : std::as_const(d->libs)) { auto unload = reinterpret_cast(lib->resolve("QbsPluginUnload")); if (unload) unload(); lib->unload(); delete lib; } } QbsPluginManager *QbsPluginManager::instance() { static QbsPluginManager instance; return &instance; } void QbsPluginManager::registerStaticPlugin(QbsPluginLoadFunction load, QbsPluginUnloadFunction unload) { if (none_of(d->staticPlugins, [&load](const QbsPlugin &p) { return p.load == load; })) d->staticPlugins.push_back(QbsPlugin { load, unload, false }); } void QbsPluginManager::loadStaticPlugins() { for (const auto &plugin : d->staticPlugins) { if (!plugin.loaded && plugin.load) plugin.load(); } } void QbsPluginManager::unloadStaticPlugins() { for (auto &plugin : d->staticPlugins) { if (plugin.loaded && plugin.unload) plugin.unload(); } d->staticPlugins.clear(); } void QbsPluginManager::loadPlugins(const std::vector &pluginPaths, const Logger &logger) { QStringList filters; if (HostOsInfo::isWindowsHost()) { filters << QStringLiteral("*.dll"); } else if (HostOsInfo::isMacosHost()) { filters << QStringLiteral("*.bundle") << QStringLiteral("*.dylib") << QStringLiteral("*.so"); } else { filters << QStringLiteral("*.so"); } for (const std::string &pluginPath : pluginPaths) { const QString qtPluginPath = QString::fromStdString(pluginPath); qCDebug(lcPluginManager) << "loading plugins from" << QDir::toNativeSeparators(qtPluginPath); QDirIterator it(qtPluginPath, filters, QDir::Files); while (it.hasNext()) { const QString fileName = it.next(); std::unique_ptr lib(new QLibrary(fileName)); if (!lib->load()) { logger.qbsWarning() << Tr::tr("plugin manager: Cannot load plugin '%1': %2") .arg(QDir::toNativeSeparators(fileName), lib->errorString()); continue; } auto load = reinterpret_cast(lib->resolve("QbsPluginLoad")); if (load) { load(); qCDebug(lcPluginManager) << "plugin" << QDir::toNativeSeparators(fileName) << "loaded."; d->libs.push_back(lib.release()); } else { logger.qbsWarning() << Tr::tr("plugin manager: not a qbs plugin"); } } } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/settingscreator.cpp0000644000175100017510000001166515154533055022553 0ustar runnerrunner#include #include /**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "settingscreator.h" #include "fileinfo.h" #include "hostosinfo.h" #include #include #include #include namespace qbs { namespace Internal { namespace { QString getBaseDir(QString baseDir) { if (!baseDir.isEmpty()) return baseDir; const char key[] = "QBS_SETTINGS_DIR"; if (qEnvironmentVariableIsSet(key)) return QLatin1String(qgetenv(key)); return {}; } } // namespace static QSettings::Format format() { return HostOsInfo::isWindowsHost() ? QSettings::IniFormat : QSettings::NativeFormat; } SettingsCreator::SettingsCreator(QString baseDir) : m_settingsBaseDir(getBaseDir(std::move(baseDir))) , m_qbsVersion(Version::fromString(QLatin1String(QBS_VERSION))) { } std::unique_ptr SettingsCreator::getQSettings() { createQSettings(); migrate(); return std::move(m_settings); } void SettingsCreator::migrate() { if (!m_settings->allKeys().empty()) // We already have settings for this qbs version. return; m_settings.reset(); // Find settings from highest qbs version lower than this one and copy all settings data. const Version thePredecessor = predecessor(); QString oldSettingsDir = m_settingsBaseDir; if (thePredecessor.isValid()) oldSettingsDir.append(QLatin1String("/qbs/")).append(thePredecessor.toString()); const QString oldSettingsFilePath = oldSettingsDir + QLatin1Char('/') + m_settingsFileName; if (QFileInfo::exists(oldSettingsFilePath) && (!QDir::root().mkpath(m_newSettingsDir) || !QFile::copy(oldSettingsFilePath, m_newSettingsFilePath))) { qWarning() << "Error in settings migration: Could not copy" << oldSettingsFilePath << "to" << m_newSettingsFilePath; } m_settings = std::make_unique(m_newSettingsFilePath, format()); } void SettingsCreator::createQSettings() { std::unique_ptr tmp(m_settingsBaseDir.isEmpty() ? new QSettings(format(), QSettings::UserScope, QStringLiteral("QtProject"), QStringLiteral("qbs")) : new QSettings(m_settingsBaseDir + QLatin1String("/qbs.conf"), format())); const QFileInfo fi(tmp->fileName()); m_settingsBaseDir = fi.path(); m_newSettingsDir = m_settingsBaseDir + QLatin1String("/qbs/") + m_qbsVersion.toString(); m_settingsFileName = fi.fileName(); m_newSettingsFilePath = m_newSettingsDir + QLatin1Char('/') + m_settingsFileName; m_settings = std::make_unique(m_newSettingsFilePath, tmp->format()); } Version SettingsCreator::predecessor() const { QDirIterator dit(m_settingsBaseDir + QLatin1String("/qbs")); Version thePredecessor; while (dit.hasNext()) { dit.next(); const auto currentVersion = Version::fromString(dit.fileName()); if (currentVersion > thePredecessor && currentVersion < m_qbsVersion) thePredecessor = currentVersion; } return thePredecessor; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/architectures.h0000644000175100017510000000467415154533055021647 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ARCHITECTURES_H #define QBS_ARCHITECTURES_H #include "qbs_export.h" #include namespace qbs { QBS_EXPORT QString canonicalTargetArchitecture(const QString &architecture, const QString &endianness, const QString &vendor, const QString &system, const QString &abi); QBS_EXPORT QString canonicalArchitecture(const QString &architecture); } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/tools/qbsassert.cpp0000644000175100017510000000460315154533055021334 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "qbsassert.h" #include "error.h" #include namespace qbs { namespace Internal { void writeAssertLocation(const char *condition, const char *file, int line) { qDebug("SOFT ASSERT: %s in %s:%d", condition, file, line); } void throwAssertLocation(const char *condition, const char *file, int line) { throw ErrorInfo(QStringLiteral("ASSERT: %1").arg(QLatin1String(condition)), CodeLocation(QString::fromLocal8Bit(file), line, -1, false), true); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/stlutils.h0000644000175100017510000002013515154533055020653 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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_STLUTILS_H #define QBS_STLUTILS_H #include #include namespace qbs { namespace Internal { template auto sorted(C &&container) { using R = std::remove_cv_t>; R result(std::forward(container)); std::sort(std::begin(result), std::end(result)); return result; } template auto sorted(C &&container, Pred &&pred) { using R = std::remove_cv_t>; R result(std::forward(container)); std::sort(std::begin(result), std::end(result), std::forward(pred)); return result; } template To transformed(const From &from, Op op) { To to; to.reserve(int(from.size())); std::transform(std::cbegin(from), std::cend(from), std::back_inserter(to), std::move(op)); return to; } template void transform(C &&container, Op op) { std::transform(std::begin(container), std::end(container), std::begin(container), std::move(op)); } template void transform(const From &from, To &&to, Op op) { std::transform(std::cbegin(from), std::cend(from), std::back_inserter(to), std::move(op)); } template bool contains(const C &container, const T &v) { const auto &end = std::cend(container); return std::find(std::cbegin(container), end, v) != end; } template bool contains(const T (&container)[N], const U &v) { const auto &end = std::cend(container); return std::find(std::cbegin(container), end, v) != end; } template bool containsKey(const C &container, const typename C::key_type &v) { const auto &end = container.cend(); return container.find(v) != end; } template typename C::mapped_type mapValue( const C &container, const typename C::key_type &key, const typename C::mapped_type &value = typename C::mapped_type()) { const auto end = container.cend(); const auto it = container.find(key); return it != end ? it->second : value; } template bool removeOne(C &container, const typename C::value_type &v) { auto end = std::end(container); auto it = std::find(std::begin(container), end, v); if (it == end) return false; container.erase(it); return true; } template void removeAll(C &container, const typename C::value_type &v) { container.erase(std::remove(std::begin(container), std::end(container), v), std::end(container)); } template void removeIf(C &container, const Pred &pred) { container.erase(std::remove_if(std::begin(container), std::end(container), pred), std::end(container)); } template bool any_of(const Container &container, const UnaryPredicate &predicate) { return std::any_of(std::begin(container), std::end(container), predicate); } template bool all_of(const Container &container, const UnaryPredicate &predicate) { return std::all_of(std::begin(container), std::end(container), predicate); } template bool none_of(const Container &container, const UnaryPredicate &predicate) { return std::none_of(std::begin(container), std::end(container), predicate); } template It binaryFind(It begin, It end, const T &value, Compare comp) { const auto it = std::lower_bound(begin, end, value, comp); if (it == end || comp(value, *it)) return end; return it; } template It binaryFind(It begin, It end, const T &value) { return binaryFind(begin, end, value, std::less()); } template C &operator<<(C &container, const typename C::value_type &v) { container.push_back(v); return container; } template C &operator<<(C &container, const C &other) { container.insert(container.end(), other.cbegin(), other.cend()); return container; } // based on http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0814r0.pdf template void hashCombineHelper(size_t &seed, const T &val) { seed ^= std::hash()(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2); } template size_t hashCombine(const Types &... args) { size_t seed = 0; (hashCombineHelper(seed, args), ...); // create hash value with seed over all args return seed; return seed; } template size_t hashRange(It first, It last) { size_t seed = 0; for (; first != last; ++first) hashCombineHelper(seed, *first); return seed; } template size_t hashRange(R &&range) { return hashRange(std::begin(range), std::end(range)); } // based on qcontainertools_impl.h template using IfIsForwardIterator_t = typename std::enable_if_t< std::is_convertible_v< typename std::iterator_traits::iterator_category, std::forward_iterator_tag>, bool>; template using IfIsNotForwardIterator = typename std::enable_if_t< !std::is_convertible_v< typename std::iterator_traits::iterator_category, std::forward_iterator_tag>, bool>; template = true> void reserveIfForwardIterator(Container *, InputIterator, InputIterator) { } template = true> void reserveIfForwardIterator(Container *c, ForwardIterator f, ForwardIterator l) { c->reserve(static_cast(std::distance(f, l))); } // similar to ranges::to proposal // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1206r1.pdf template C rangeTo(R &&r) { return C(std::begin(r), std::end(r)); } template constexpr std::underlying_type_t toUnderlying(Enum e) noexcept { return static_cast>(e); } template constexpr bool is_any_of_types = std::disjunction_v...>; } // namespace Internal } // namespace qbs #endif // QBS_STLUTILS_H qbs-src-3.2.0/src/lib/corelib/tools/settings.cpp0000644000175100017510000002103415154533055021162 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "settings.h" #include "error.h" #include "profile.h" #include "settingscreator.h" #include #include #include #include #include namespace qbs { using namespace Internal; QString Settings::defaultSystemSettingsBaseDir() { switch (HostOsInfo::hostOs()) { case HostOsInfo::HostOsWindows: { const char key[] = "ALLUSERSAPPDATA"; if (qEnvironmentVariableIsSet(key)) return QLatin1String(key); return QStringLiteral("C:/ProgramData"); } case HostOsInfo::HostOsMacos: return QStringLiteral("/Library/Application Support"); case HostOsInfo::HostOsLinux: case HostOsInfo::HostOsOtherUnix: return QStringLiteral("/etc/xdg"); default: return {}; } } static QString systemSettingsBaseDir() { #ifdef QBS_ENABLE_UNIT_TESTS const char key[] = "QBS_AUTOTEST_SYSTEM_SETTINGS_DIR"; if (qEnvironmentVariableIsSet(key)) return QLatin1String(qgetenv(key)); #endif #ifdef QBS_SYSTEM_SETTINGS_DIR return QLatin1String(QBS_SYSTEM_SETTINGS_DIR); #else return Settings::defaultSystemSettingsBaseDir() + QStringLiteral("/qbs"); #endif } Settings::Settings(const QString &baseDir) : Settings(baseDir, systemSettingsBaseDir()) { } Settings::Settings(const QString &baseDir, const QString &systemBaseDir) : m_settings(SettingsCreator(baseDir).getQSettings()), m_systemSettings(std::make_unique(systemBaseDir + QStringLiteral("/qbs.conf"), QSettings::IniFormat)), m_baseDir(baseDir) { // Actual qbs settings are stored transparently within a group, because QSettings // can see non-qbs fallback settings e.g. from QtProject that we're not interested in. m_settings->beginGroup(QStringLiteral("org/qt-project/qbs")); } Settings::~Settings() = default; QVariant Settings::value(const QString &key, Scopes scopes, const QVariant &defaultValue) const { QVariant userValue; if (scopes & UserScope) userValue = m_settings->value(internalRepresentation(key)); QVariant systemValue; if (scopes & SystemScope) systemValue = m_systemSettings->value(internalRepresentation(key)); if (!userValue.isValid()) { if (systemValue.isValid()) return systemValue; return defaultValue; } if (!systemValue.isValid()) return userValue; if (static_cast(userValue.userType()) == QMetaType::QStringList) return userValue.toStringList() + systemValue.toStringList(); if (static_cast(userValue.userType()) == QMetaType::QVariantList) return userValue.toList() + systemValue.toList(); return userValue; } QStringList Settings::allKeys(Scopes scopes) const { QStringList keys; if (scopes & UserScope) keys = m_settings->allKeys(); if (scopes & SystemScope) keys += m_systemSettings->allKeys(); fixupKeys(keys); return keys; } QStringList Settings::directChildren(const QString &parentGroup, Scopes scopes) const { auto helper = [this, &parentGroup](const Scope scope) { QSettings * const settings = settingsForScope(scope); settings->beginGroup(internalRepresentation(parentGroup)); QStringList children = settings->childGroups(); children << settings->childKeys(); settings->endGroup(); return children; }; QStringList children; if (scopes & UserScope) children += helper(UserScope); if (scopes & SystemScope) children += helper(SystemScope); fixupKeys(children); return children; } QStringList Settings::allKeysWithPrefix(const QString &group, Scopes scopes) const { QStringList keys; if (scopes & UserScope) { m_settings->beginGroup(internalRepresentation(group)); keys = m_settings->allKeys(); m_settings->endGroup(); } if (scopes & SystemScope) { m_systemSettings->beginGroup(internalRepresentation(group)); keys += m_systemSettings->allKeys(); m_systemSettings->endGroup(); } fixupKeys(keys); return keys; } void Settings::setValue(const QString &key, const QVariant &value) { if (key.startsWith(StringConstants::profilesSettingsPrefix() + Profile::fallbackName())) { throw ErrorInfo(Tr::tr("Invalid use of special profile name '%1'.") .arg(Profile::fallbackName())); } targetForWriting()->setValue(internalRepresentation(key), value); checkForWriteError(); } void Settings::remove(const QString &key) { targetForWriting()->remove(internalRepresentation(key)); checkForWriteError(); } void Settings::clear() { targetForWriting()->clear(); checkForWriteError(); } void Settings::sync() { targetForWriting()->sync(); } QString Settings::defaultProfile() const { return value(QStringLiteral("defaultProfile"), allScopes()).toString(); } QStringList Settings::profiles() const { QStringList result; if (m_scopeForWriting == UserScope) { m_settings->beginGroup(StringConstants::profilesSettingsKey()); result = m_settings->childGroups(); m_settings->endGroup(); } m_systemSettings->beginGroup(StringConstants::profilesSettingsKey()); result += m_systemSettings->childGroups(); m_systemSettings->endGroup(); result.removeDuplicates(); return result; } QString Settings::fileName() const { return targetForWriting()->fileName(); } QString Settings::internalRepresentation(const QString &externalKey) const { QString internalKey = externalKey; return internalKey.replace(QLatin1Char('.'), QLatin1Char('/')); } QString Settings::externalRepresentation(const QString &internalKey) const { QString externalKey = internalKey; return externalKey.replace(QLatin1Char('/'), QLatin1Char('.')); } void Settings::fixupKeys(QStringList &keys) const { keys.sort(); keys.removeDuplicates(); for (auto &key : keys) key = externalRepresentation(key); } QSettings *Settings::settingsForScope(Settings::Scope scope) const { return scope == UserScope ? m_settings.get() : m_systemSettings.get(); } QSettings *Settings::targetForWriting() const { return settingsForScope(m_scopeForWriting); } void Settings::checkForWriteError() { if (m_scopeForWriting == SystemScope && m_systemSettings->status() == QSettings::NoError) { sync(); if (m_systemSettings->status() == QSettings::AccessError) throw ErrorInfo(Tr::tr("Failure writing system settings file '%1': " "You do not have permission to write to that location.") .arg(fileName())); } } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/qbsprocess.cpp0000644000175100017510000001315015154533055021506 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "qbsprocess.h" #include "launcherinterface.h" #include "launchersocket.h" #include "qbsassert.h" #include #include #include namespace qbs { namespace Internal { QbsProcess::QbsProcess(QObject *parent) : QObject(parent) { connect(LauncherInterface::socket(), &LauncherSocket::ready, this, &QbsProcess::handleSocketReady); connect(LauncherInterface::socket(), &LauncherSocket::errorOccurred, this, &QbsProcess::handleSocketError); connect(LauncherInterface::socket(), &LauncherSocket::packetArrived, this, &QbsProcess::handlePacket); } void QbsProcess::start(const QString &command, const QStringList &arguments) { if (m_socketError) { m_error = QProcess::FailedToStart; emit errorOccurred(m_error); return; } m_command = command; m_arguments = arguments; m_state = QProcess::Starting; if (LauncherInterface::socket()->isReady()) doStart(); } void QbsProcess::doStart() { m_state = QProcess::Running; StartProcessPacket p(token()); p.command = m_command; p.arguments = m_arguments; p.env = m_environment.toStringList(); p.workingDir = m_workingDirectory; sendPacket(p); } void QbsProcess::cancel() { switch (m_state) { case QProcess::NotRunning: break; case QProcess::Starting: m_errorString = Tr::tr("Process canceled before it was started."); m_error = QProcess::FailedToStart; m_state = QProcess::NotRunning; emit errorOccurred(m_error); break; case QProcess::Running: sendPacket(StopProcessPacket(token())); break; } } QByteArray QbsProcess::readAllStandardOutput() { return readAndClear(m_stdout); } QByteArray QbsProcess::readAllStandardError() { return readAndClear(m_stderr); } void QbsProcess::sendPacket(const LauncherPacket &packet) { LauncherInterface::socket()->sendData(packet.serialize()); } QByteArray QbsProcess::readAndClear(QByteArray &data) { QByteArray tmp = data; data.clear(); return tmp; } void QbsProcess::handlePacket(LauncherPacketType type, quintptr token, const QByteArray &payload) { if (token != this->token()) return; switch (type) { case LauncherPacketType::ProcessError: handleErrorPacket(payload); break; case LauncherPacketType::ProcessFinished: handleFinishedPacket(payload); break; default: QBS_ASSERT(false, break); } } void QbsProcess::handleSocketReady() { m_socketError = false; if (m_state == QProcess::Starting) doStart(); } void QbsProcess::handleSocketError(const QString &message) { m_socketError = true; m_errorString = Tr::tr("Internal socket error: %1").arg(message); if (m_state != QProcess::NotRunning) { m_state = QProcess::NotRunning; m_error = QProcess::FailedToStart; emit errorOccurred(m_error); } } void QbsProcess::handleErrorPacket(const QByteArray &packetData) { QBS_ASSERT(m_state != QProcess::NotRunning, return); const auto packet = LauncherPacket::extractPacket(token(), packetData); m_error = packet.error; m_errorString = packet.errorString; m_state = QProcess::NotRunning; emit errorOccurred(m_error); } void QbsProcess::handleFinishedPacket(const QByteArray &packetData) { QBS_ASSERT(m_state == QProcess::Running, return); m_state = QProcess::NotRunning; const auto packet = LauncherPacket::extractPacket(token(), packetData); m_exitCode = packet.exitCode; m_stdout = packet.stdOut; m_stderr = packet.stdErr; m_errorString = packet.errorString; emit finished(m_exitCode); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/pimpl.h0000644000175100017510000000442615154533055020116 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 Ivan Komissarov (abbapoh@gmail.com) ** 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 PIMPL_H #define PIMPL_H #include #include namespace qbs { namespace Internal { template using Pimpl = KDToolBox::propagate_const>; template Pimpl makePimpl(Args&&... args) { return Pimpl(std::make_unique(std::forward(args)...)); } } // namespace Internal } // namespace qbs #endif // PIMPL_H qbs-src-3.2.0/src/lib/corelib/tools/error.cpp0000644000175100017510000002447415154533055020466 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "error.h" #include "persistence.h" #include "setupprojectparameters.h" #include "stringconstants.h" #include #include #include #include #include #include #include #include namespace qbs { class ErrorItem::ErrorItemPrivate : public QSharedData { public: template void serializationOp(Internal::PersistentPool &pool) { pool.serializationOp(description, codeLocation, isBacktraceItem); } void load(Internal::PersistentPool &pool) { serializationOp(pool); } void store(Internal::PersistentPool &pool) { serializationOp(pool); } QString description; CodeLocation codeLocation; bool isBacktraceItem = false; }; /*! * \class ErrorData * \brief The \c ErrorData class describes (part of) an error resulting from a qbs operation. * It is always delivered as part of an \c Error. * \sa Error */ ErrorItem::ErrorItem() : d(new ErrorItemPrivate) { } ErrorItem::ErrorItem(ErrorItem &&rhs) noexcept = default; ErrorItem::ErrorItem(const QString &description, const CodeLocation &codeLocation, bool isBacktraceItem) : d(new ErrorItemPrivate) { d->description = description; d->codeLocation = codeLocation; d->isBacktraceItem = isBacktraceItem; } ErrorItem::ErrorItem(const ErrorItem &rhs) = default; ErrorItem &ErrorItem::operator=(const ErrorItem &other) = default; ErrorItem &ErrorItem::operator=(ErrorItem &&other) noexcept = default; ErrorItem::~ErrorItem() = default; QString ErrorItem::description() const { return d->description; } CodeLocation ErrorItem::codeLocation() const { return d->codeLocation; } bool ErrorItem::isBacktraceItem() const { return d->isBacktraceItem; } void ErrorItem::load(Internal::PersistentPool &pool) { pool.load(*d); } void ErrorItem::store(Internal::PersistentPool &pool) const { pool.store(*d); } /*! * \fn const QString &ErrorData::description() const * \brief A general description of the error. */ /*! * \fn const QString &ErrorData::codeLocation() const * \brief The location at which file in which the error occurred. * \note This information might not be applicable, in which case location().isValid() returns false */ /*! * \brief A full textual description of the error using all available information. */ QString ErrorItem::toString() const { QString str = codeLocation().toString(); if (!str.isEmpty()) str += QLatin1Char(' '); return str += description(); } QJsonObject ErrorItem::toJson() const { QJsonObject data; data.insert(Internal::StringConstants::descriptionProperty(), description()); data.insert(Internal::StringConstants::locationKey(), codeLocation().toJson()); return data; } class ErrorInfo::ErrorInfoPrivate : public QSharedData { public: ErrorInfoPrivate() : internalError(false) { } template void completeSerializationOp(Internal::PersistentPool &pool) { pool.serializationOp(items, internalError); } QList items; bool internalError; }; /*! * \class Error * \brief Represents an error resulting from a qbs operation. * It is made up of one or more \c ErrorData objects. * \sa ErrorData */ ErrorInfo::ErrorInfo() : d(new ErrorInfoPrivate) { } ErrorInfo::ErrorInfo(const ErrorInfo &rhs) = default; ErrorInfo::ErrorInfo(ErrorInfo &&rhs) noexcept = default; ErrorInfo::ErrorInfo(const QString &description, const CodeLocation &location, bool internalError) : d(new ErrorInfoPrivate) { append(description, location); d->internalError = internalError; } ErrorInfo::ErrorInfo(const QString &description, const QStringList &backtrace) : d(new ErrorInfoPrivate) { append(description); for (const QString &traceLine : backtrace) { if (traceLine.contains(QStringLiteral(""))) continue; static const std::regex regexpWithFunc( "^(.+) at [^(]*\\((.+):(\\-?[0-9]+):(\\-?[0-9]+)\\)$"); static const std::regex regexpWithoutFunc("^(.+) at (.+):(\\-?[0-9]+):(\\-?[0-9]+)$"); std::smatch match; const std::string tl = traceLine.toStdString(); bool hasMatch = std::regex_match(tl, match, regexpWithFunc); if (!hasMatch) hasMatch = std::regex_match(tl, match, regexpWithoutFunc); if (hasMatch) { const QString message = QString::fromStdString(match[1]).trimmed(); const QString file = QString::fromStdString(match[2]); const QString line = QString::fromStdString(match[3]); const CodeLocation location(file, line.toInt()); appendBacktrace(message, CodeLocation(file, line.toInt())); } } } ErrorInfo &ErrorInfo::operator=(ErrorInfo &&other) noexcept = default; ErrorInfo &ErrorInfo::operator =(const ErrorInfo &other) = default; ErrorInfo::~ErrorInfo() = default; void ErrorInfo::appendBacktrace(const QString &description, const CodeLocation &location) { d->items.push_back(ErrorItem(description, location, true)); } void ErrorInfo::append(const ErrorItem &item) { d->items.push_back(item); } void ErrorInfo::append(const QString &description, const CodeLocation &location) { d->items.push_back(ErrorItem(description, location)); } void ErrorInfo::prepend(const QString &description, const CodeLocation &location) { d->items.prepend(ErrorItem(description, location)); } void ErrorInfo::addOrPrependLocation(const CodeLocation &loc) { QBS_CHECK(hasError()); if (!loc.isValid()) return; if (d->items.first().codeLocation() == loc) return; if (d->items.first().codeLocation().isValid()) prepend(Internal::Tr::tr("While evaluating here"), loc); else d->items[0] = ErrorItem(d->items.first().description(), loc); } /*! * \brief A list of concrete error description. * Most often, there will be one element in this list, but there can be more e.g. to illustrate * how an error condition propagates through several source files. */ const QList ErrorInfo::items() const { return d->items; } void ErrorInfo::clear() { d->items.clear(); } /*! * \brief A complete textual description of the error. * All "sub-errors" will be represented. * \sa Error::entries() */ QString ErrorInfo::toString() const { QStringList lines; for (const ErrorItem &e : std::as_const(d->items)) { if (e.isBacktraceItem()) { QString line; if (!e.description().isEmpty()) line.append(QStringLiteral(" at %1").arg(e.description())); if (e.codeLocation().isValid()) line.append(QStringLiteral(" in %1").arg(e.codeLocation().toString())); if (!line.isEmpty()) lines.push_back(QLatin1Char('\t') + line); } else { lines.push_back(e.toString()); } } return lines.join(QLatin1Char('\n')); } QJsonObject ErrorInfo::toJson() const { QJsonObject data; data.insert(QLatin1String("is-internal"), isInternalError()); QJsonArray itemsArray; for (const ErrorItem &item : items()) itemsArray.append(item.toJson()); data.insert(QLatin1String("items"), itemsArray); return data; } /*! * \brief Returns true if this error represents a bug in qbs, false otherwise. */ bool ErrorInfo::isInternalError() const { return d->internalError; } bool ErrorInfo::hasLocation() const { return Internal::any_of(d->items, [](const ErrorItem &ei) { return ei.codeLocation().isValid(); }); } bool ErrorInfo::isCancelException() const { return Internal::any_of(d->items, [](const ErrorItem &ei) { return ei.description() == QLatin1String("interrupted"); }); } void ErrorInfo::load(Internal::PersistentPool &pool) { pool.load(*d); } void ErrorInfo::store(Internal::PersistentPool &pool) const { pool.store(*d); } void appendError(ErrorInfo &dst, const ErrorInfo &src) { const QList &sourceItems = src.items(); for (const ErrorItem &item : sourceItems) dst.append(item); } void handlePropertyError( const ErrorInfo &error, const SetupProjectParameters ¶ms, Internal::Logger &logger) { if (params.propertyCheckingMode() == ErrorHandlingMode::Strict) throw error; logger.printError(error); } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/error.h0000644000175100017510000001127515154533055020126 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_ERROR #define QBS_ERROR #include "codelocation.h" #include #include #include #include QT_BEGIN_NAMESPACE class QJsonObject; QT_END_NAMESPACE namespace qbs { namespace Internal { class PersistentPool; class Logger; } // namespace Internal class CodeLocation; class SetupProjectParameters; class QBS_EXPORT ErrorItem { friend class ErrorInfo; public: ErrorItem(); ErrorItem(const ErrorItem &rhs); ErrorItem(ErrorItem &&rhs) noexcept; ErrorItem &operator=(const ErrorItem &other); ErrorItem &operator=(ErrorItem &&other) noexcept; ~ErrorItem(); QString description() const; CodeLocation codeLocation() const; QString toString() const; QJsonObject toJson() const; bool isBacktraceItem() const; void load(Internal::PersistentPool &pool); void store(Internal::PersistentPool &pool) const; private: ErrorItem(const QString &description, const CodeLocation &codeLocation, bool isBacktraceItem = false); class ErrorItemPrivate; QExplicitlySharedDataPointer d; }; class QBS_EXPORT ErrorInfo { public: ErrorInfo(); ErrorInfo(const ErrorInfo &rhs); ErrorInfo(ErrorInfo &&rhs) noexcept; ErrorInfo(const QString &description, const CodeLocation &location = CodeLocation(), bool internalError = false); ErrorInfo(const QString &description, const QStringList &backtrace); ErrorInfo &operator=(const ErrorInfo &other); ErrorInfo &operator=(ErrorInfo &&other) noexcept; ~ErrorInfo(); void appendBacktrace(const QString &description, const CodeLocation &location = CodeLocation()); void append(const ErrorItem &item); void append(const QString &description, const CodeLocation &location = CodeLocation()); void prepend(const QString &description, const CodeLocation &location = CodeLocation()); void addOrPrependLocation(const CodeLocation &loc); const QList items() const; bool hasError() const { return !items().empty(); } void clear(); QString toString() const; QJsonObject toJson() const; bool isInternalError() const; bool hasLocation() const; bool isCancelException() const; void load(Internal::PersistentPool &pool); void store(Internal::PersistentPool &pool) const; private: class ErrorInfoPrivate; QSharedDataPointer d; }; void appendError(ErrorInfo &dst, const ErrorInfo &src); void handlePropertyError( const ErrorInfo &error, const SetupProjectParameters ¶ms, Internal::Logger &logger); inline auto qHash(const ErrorInfo &e) { return qHash(e.toString()); } inline bool operator==(const ErrorInfo &e1, const ErrorInfo &e2) { return e1.toString() == e2.toString(); } } // namespace qbs Q_DECLARE_METATYPE(qbs::ErrorInfo) #endif // QBS_ERROR qbs-src-3.2.0/src/lib/corelib/tools/msvcinfo.cpp0000644000175100017510000006601015154533055021151 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "msvcinfo.h" #include "visualstudioversioninfo.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef Q_OS_WIN #include #endif #include #include #include using namespace qbs; using namespace qbs::Internal; static std::recursive_mutex envMutex; static QString mkStr(const char *s) { return QString::fromLocal8Bit(s); } static QString mkStr(const QByteArray &ba) { return mkStr(ba.constData()); } class TemporaryEnvChanger { public: TemporaryEnvChanger(const QProcessEnvironment &envChanges) : m_locker(envMutex) { QProcessEnvironment currentEnv = QProcessEnvironment::systemEnvironment(); const auto keys = envChanges.keys(); for (const QString &key : keys) { m_changesToRestore.insert(key, currentEnv.value(key)); qputenv(qPrintable(key), qPrintable(envChanges.value(key))); } } ~TemporaryEnvChanger() { const auto keys = m_changesToRestore.keys(); for (const QString &key : keys) qputenv(qPrintable(key), qPrintable(m_changesToRestore.value(key))); } private: QProcessEnvironment m_changesToRestore; std::lock_guard m_locker; }; static QByteArray runProcess(const QString &exeFilePath, const QStringList &args, const QProcessEnvironment &env = QProcessEnvironment(), bool allowFailure = false, const QByteArray &pipeData = QByteArray()) { TemporaryEnvChanger envChanger(env); QProcess process; process.start(exeFilePath, args); if (!process.waitForStarted()) throw ErrorInfo(mkStr("Could not start %1 (%2)").arg(exeFilePath, process.errorString())); if (!pipeData.isEmpty()) { process.write(pipeData); process.closeWriteChannel(); } if (!process.waitForFinished(-1) || process.exitStatus() != QProcess::NormalExit) throw ErrorInfo(mkStr("Could not run %1 (%2)").arg(exeFilePath, process.errorString())); if (process.exitCode() != 0 && !allowFailure) { ErrorInfo e(mkStr("Process '%1' failed with exit code %2.") .arg(exeFilePath).arg(process.exitCode())); const QByteArray stdErr = process.readAllStandardError(); if (!stdErr.isEmpty()) e.append(mkStr("stderr was: %1").arg(mkStr(stdErr))); const QByteArray stdOut = process.readAllStandardOutput(); if (!stdOut.isEmpty()) e.append(mkStr("stdout was: %1").arg(mkStr(stdOut))); throw e; } return process.readAllStandardOutput().trimmed(); } class DummyFile { public: DummyFile(QString fp) : filePath(std::move(fp)) { } ~DummyFile() { QFile::remove(filePath); } const QString filePath; }; #ifdef Q_OS_WIN static QStringList parseCommandLine(const QString &commandLine) { const auto buf = std::make_unique(size_t(commandLine.size()) + 1); buf[size_t(commandLine.toWCharArray(buf.get()))] = 0; int argCount = 0; const auto argsDeleter = [](LPWSTR *p){ LocalFree(p); }; const auto args = std::unique_ptr( CommandLineToArgvW(buf.get(), &argCount), argsDeleter); if (!args) throw ErrorInfo(mkStr("Could not parse command line arguments: ") + commandLine); QStringList list; list.reserve(argCount); for (int i = 0; i < argCount; ++i) list.push_back(QString::fromWCharArray(args[size_t(i)])); return list; } #endif static QVariantMap getMsvcDefines(const QString &compilerFilePath, const QProcessEnvironment &compilerEnv, MSVC::CompilerLanguage language) { #ifdef Q_OS_WIN QString backendSwitch, languageSwitch; switch (language) { case MSVC::CLanguage: backendSwitch = QStringLiteral("/B1"); languageSwitch = QStringLiteral("/TC"); break; case MSVC::CPlusPlusLanguage: backendSwitch = QStringLiteral("/Bx"); languageSwitch = QStringLiteral("/TP"); break; } const QByteArray commands("set MSC_CMD_FLAGS\n"); QStringList out = QString::fromLocal8Bit(runProcess(compilerFilePath, QStringList() << QStringLiteral("/nologo") << backendSwitch << qEnvironmentVariable("COMSPEC") << QStringLiteral("/c") << languageSwitch << QStringLiteral("/Zs") << QStringLiteral("NUL"), compilerEnv, true, commands)).split(QLatin1Char('\n')); auto findResult = std::find_if(out.cbegin(), out.cend(), [] (const QString &line) { return line.startsWith(QLatin1String("MSC_CMD_FLAGS=")); }); if (findResult == out.cend()) { throw ErrorInfo(QStringLiteral("Unexpected compiler frontend output: ") + out.join(QLatin1Char('\n'))); } QVariantMap map; const QStringList args = parseCommandLine(findResult->trimmed()); for (const QString &arg : args) { if (!arg.startsWith(QStringLiteral("-D"))) continue; int idx = arg.indexOf(QLatin1Char('='), 2); if (idx > 2) map.insert(arg.mid(2, idx - 2), arg.mid(idx + 1)); else map.insert(arg.mid(2), QVariant()); } return map; #else Q_UNUSED(compilerFilePath); Q_UNUSED(compilerEnv); Q_UNUSED(language); return {}; #endif } /*! \internal clang-cl does not support gcc and msvc ways to dump a macros, so we have to use original clang.exe directly */ static QVariantMap getClangClDefines( const QString &compilerFilePath, const QProcessEnvironment &compilerEnv, MSVC::CompilerLanguage language, const QString &arch) { #ifdef Q_OS_WIN QFileInfo clInfo(compilerFilePath); QFileInfo clangInfo(clInfo.absolutePath() + QLatin1String("/clang-cl.exe")); if (!clangInfo.exists()) throw ErrorInfo(QStringLiteral("%1 does not exist").arg(clangInfo.absoluteFilePath())); QStringList args = { QStringLiteral("/d1PP"), // dump macros QStringLiteral("/E") // preprocess to stdout }; if (language == MSVC::CLanguage) args.append(QStringLiteral("/TC")); else if (language == MSVC::CPlusPlusLanguage) args.append(QStringLiteral("/TP")); if (arch == QLatin1String("x86")) args.append(QStringLiteral("-m32")); else if (arch == QLatin1String("x86_64")) args.append(QStringLiteral("-m64")); args.append(QStringLiteral("NUL")); // filename const auto lines = QString::fromLocal8Bit( runProcess( clangInfo.absoluteFilePath(), args, compilerEnv, true)).split(QLatin1Char('\n')); QVariantMap result; for (const auto &line: lines) { static const auto defineString = QLatin1String("#define "); if (!line.startsWith(defineString)) continue; QStringView view(line.data() + defineString.size()); const auto it = std::find(view.begin(), view.end(), QLatin1Char(' ')); if (it == view.end()) { throw ErrorInfo(QStringLiteral("Unexpected compiler frontend output: ") + lines.join(QLatin1Char('\n'))); } QStringView key(view.begin(), it); QStringView value(it + 1, view.end()); result.insert(key.toString(), value.isEmpty() ? QVariant() : QVariant(value.toString())); } if (result.isEmpty()) { throw ErrorInfo(QStringLiteral("Cannot determine macroses from compiler frontend output: ") + lines.join(QLatin1Char('\n'))); } return result; #else Q_UNUSED(compilerFilePath); Q_UNUSED(compilerEnv); Q_UNUSED(language); Q_UNUSED(arch); return {}; #endif } static QString formatVswhereOutput(const QString &out, const QString &err) { QString ret; if (!out.isEmpty()) { ret.append(Tr::tr("stdout")).append(QLatin1String(":\n")); const auto lines = out.split(QLatin1Char('\n')); for (const QString &line : lines) ret.append(QLatin1Char('\t')).append(line).append(QLatin1Char('\n')); } if (!err.isEmpty()) { ret.append(Tr::tr("stderr")).append(QLatin1String(":\n")); const auto lines = err.split(QLatin1Char('\n')); for (const QString &line : lines) ret.append(QLatin1Char('\t')).append(line).append(QLatin1Char('\n')); } return ret; } static QString wow6432Key() { #ifdef Q_OS_WIN64 return QStringLiteral("\\Wow6432Node"); #else return {}; #endif } static QString vswhereFilePath() { static const std::vector envVarCandidates{"ProgramFiles", "ProgramFiles(x86)"}; for (const char * const envVar : envVarCandidates) { const QString value = QDir::fromNativeSeparators(QString::fromLocal8Bit(qgetenv(envVar))); QString cmd = value + QStringLiteral("/Microsoft Visual Studio/Installer/vswhere.exe"); if (QFileInfo(cmd).exists()) return cmd; } return {}; } enum class ProductType { VisualStudio, BuildTools }; static std::vector retrieveInstancesFromVSWhere( ProductType productType, Logger &logger) { std::vector result; const QString cmd = vswhereFilePath(); if (cmd.isEmpty()) return result; QProcess vsWhere; QStringList args = productType == ProductType::VisualStudio ? QStringList({QStringLiteral("-all"), QStringLiteral("-legacy"), QStringLiteral("-prerelease")}) : QStringList({QStringLiteral("-products"), QStringLiteral("Microsoft.VisualStudio.Product.BuildTools")}); args << QStringLiteral("-format") << QStringLiteral("json") << QStringLiteral("-utf8"); vsWhere.start(cmd, args); if (!vsWhere.waitForStarted(-1)) return result; if (!vsWhere.waitForFinished(-1)) { logger.qbsWarning() << Tr::tr("The vswhere tool failed to run").append(QLatin1String(": ")) .append(vsWhere.errorString()); return result; } if (vsWhere.exitCode() != 0) { const QString stdOut = QString::fromLocal8Bit(vsWhere.readAllStandardOutput()); const QString stdErr = QString::fromLocal8Bit(vsWhere.readAllStandardError()); logger.qbsWarning() << Tr::tr("The vswhere tool failed to run").append(QLatin1String(".\n")) .append(formatVswhereOutput(stdOut, stdErr)); return result; } QJsonParseError parseError{}; QJsonDocument jsonOutput = QJsonDocument::fromJson(vsWhere.readAllStandardOutput(), &parseError); if (parseError.error != QJsonParseError::NoError) { logger.qbsWarning() << Tr::tr("The vswhere tool produced invalid JSON output: %1") .arg(parseError.errorString()); return result; } const auto jsonArray = jsonOutput.array(); for (const auto &value : jsonArray) { const QJsonObject o = value.toObject(); MSVCInstallInfo info; info.version = o.value(QStringLiteral("installationVersion")).toString(); if (productType == ProductType::BuildTools) { // For build tools, the version is e.g. "15.8.28010.2036", rather than "15.0". const int dotIndex = info.version.indexOf(QLatin1Char('.')); if (dotIndex != -1) info.version = info.version.left(dotIndex); } info.installDir = o.value(QStringLiteral("installationPath")).toString(); if (!info.version.isEmpty() && !info.installDir.isEmpty()) result.push_back(info); } return result; } static std::vector installedMSVCsFromVsWhere(Logger &logger) { const std::vector vsInstallations = retrieveInstancesFromVSWhere(ProductType::VisualStudio, logger); const std::vector buildToolInstallations = retrieveInstancesFromVSWhere(ProductType::BuildTools, logger); std::vector all; std::copy(vsInstallations.begin(), vsInstallations.end(), std::back_inserter(all)); std::copy(buildToolInstallations.begin(), buildToolInstallations.end(), std::back_inserter(all)); return all; } static std::vector installedMSVCsFromRegistry() { std::vector result; // Detect Visual Studio const QSettings vsRegistry( QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE") + wow6432Key() + QStringLiteral("\\Microsoft\\VisualStudio\\SxS\\VS7"), QSettings::NativeFormat); const auto vsNames = vsRegistry.childKeys(); for (const QString &vsName : vsNames) { MSVCInstallInfo entry; entry.version = vsName; entry.installDir = vsRegistry.value(vsName).toString(); result.push_back(entry); } // Detect Visual C++ Build Tools QSettings vcbtRegistry( QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE") + wow6432Key() + QStringLiteral("\\Microsoft\\VisualCppBuildTools"), QSettings::NativeFormat); const QStringList &vcbtRegistryChildGroups = vcbtRegistry.childGroups(); for (const QString &childGroup : vcbtRegistryChildGroups) { vcbtRegistry.beginGroup(childGroup); bool ok; int installed = vcbtRegistry.value(QStringLiteral("Installed")).toInt(&ok); if (ok && installed) { MSVCInstallInfo entry; entry.version = childGroup; const QSettings vsRegistry( QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE") + wow6432Key() + QStringLiteral("\\Microsoft\\VisualStudio\\") + childGroup + QStringLiteral("\\Setup\\VC"), QSettings::NativeFormat); entry.installDir = vsRegistry.value(QStringLiteral("ProductDir")).toString(); result.push_back(entry); } vcbtRegistry.endGroup(); } return result; } /* Returns the list of compilers present in all MSVC installations (Visual Studios or Build Tools) without the architecture, e.g. [VC\Tools\MSVC\14.16.27023, VC\Tools\MSVC\14.14.26428, ...] */ static std::vector installedCompilersHelper(Logger &logger) { std::vector msvcs; std::vector installInfos = installedMSVCsFromVsWhere(logger); if (installInfos.empty()) installInfos = installedMSVCsFromRegistry(); for (const MSVCInstallInfo &installInfo : installInfos) { MSVC msvc; msvc.internalVsVersion = Version::fromString(installInfo.version, true); if (!msvc.internalVsVersion.isValid()) continue; QDir vsInstallDir(installInfo.installDir); msvc.vsInstallPath = vsInstallDir.absolutePath(); if (vsInstallDir.dirName() != QStringLiteral("VC") && !vsInstallDir.cd(QStringLiteral("VC"))) { continue; } msvc.version = QString::number(Internal::VisualStudioVersionInfo( msvc.internalVsVersion).marketingVersion()); if (msvc.version.isEmpty()) { logger.qbsWarning() << Tr::tr("Unknown MSVC version %1 found.").arg(installInfo.version); continue; } if (msvc.internalVsVersion.majorVersion() < 15) { QDir vcInstallDir = vsInstallDir; if (!vcInstallDir.cd(QStringLiteral("bin"))) continue; msvc.vcInstallPath = vcInstallDir.absolutePath(); msvcs.push_back(msvc); } else { QDir vcInstallDir = vsInstallDir; vcInstallDir.cd(QStringLiteral("Tools/MSVC")); const auto vcVersionStrs = vcInstallDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); std::vector vcVersions; vcVersions.reserve(vcVersionStrs.size()); for (const QString &vcVersionStr : vcVersionStrs) { const Version vcVersion = Version::fromString(vcVersionStr); if (!vcVersion.isValid()) continue; vcVersions.push_back(vcVersion); } // sort the versions so the new one comes first std::sort(vcVersions.begin(), vcVersions.end(), std::greater<>()); for (const Version &vcVersion : vcVersions) { QDir specificVcInstallDir = vcInstallDir; if (!specificVcInstallDir.cd(vcVersion.toString()) || !specificVcInstallDir.cd(QStringLiteral("bin"))) { continue; } msvc.vcInstallPath = specificVcInstallDir.absolutePath(); msvcs.push_back(msvc); } } } return msvcs; } void MSVC::init() { determineCompilerVersion(); } /*! \internal Returns the architecture detected from the compiler path. */ QString MSVC::architectureFromClPath(const QString &clPath) { const auto parentDir = QFileInfo(clPath).absolutePath(); auto parentDirName = QFileInfo(parentDir).fileName().toLower(); // can be the case when cl.exe is present within the Windows SDK installation... but can it? if (parentDirName == QLatin1String("bin")) return QStringLiteral("x86"); return parentDirName; } QString MSVC::vcVariablesVersionFromBinPath(const QString &binPath) { const auto binDirName = QFileInfo(binPath).fileName().toLower(); // the case when cl.exe is present within the Windows SDK installation if (binDirName == QLatin1String("bin")) return {}; // binPath is something like // Microsoft Visual Studio 14.0/VC/bin/amd64_x86 // or // Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64 QDir dir(binPath); dir.cdUp(); // older Visual Studios do not support multiple compiler versions if (dir.dirName().toLower() == QLatin1String("bin")) return {}; dir.cdUp(); dir.cdUp(); return dir.dirName(); } QString MSVC::canonicalArchitecture(const QString &arch) { if (arch == QLatin1String("x64") || arch == QLatin1String("amd64")) return QStringLiteral("x86_64"); return arch; } std::pair MSVC::getHostTargetArchPair(const QString &arch) { QString hostArch; QString targetArch; const int index = arch.indexOf(QLatin1Char('_')); if (index != -1) { hostArch = arch.mid(0, index); targetArch = arch.mid(index); } else { hostArch = arch; targetArch = arch; } return {canonicalArchitecture(hostArch), canonicalArchitecture(targetArch)}; } QString MSVC::binPathForArchitecture(const QString &arch) const { QString archSubDir; if (arch != StringConstants::x86Arch()) archSubDir = arch; return QDir::cleanPath(vcInstallPath + QLatin1Char('/') + pathPrefix + QLatin1Char('/') + archSubDir); } static QString clExeSuffix() { return QStringLiteral("/cl.exe"); } QString MSVC::clPathForArchitecture(const QString &arch) const { return binPathForArchitecture(arch) + clExeSuffix(); } QVariantMap MSVC::compilerDefines(const QString &compilerFilePath, MSVC::CompilerLanguage language) const { const auto compilerName = QFileInfo(compilerFilePath).fileName().toLower(); if (compilerName == QLatin1String("clang-cl.exe")) return getClangClDefines(compilerFilePath, environment, language, architecture); return getMsvcDefines(compilerFilePath, environment, language); } std::vector MSVC::findSupportedArchitectures(const MSVC &msvc) { std::vector result; auto addResult = [&result](const MSVCArchInfo &ai) { if (QFile::exists(ai.binPath + QLatin1String("/cl.exe"))) result.push_back(ai); }; if (msvc.internalVsVersion.majorVersion() < 15) { static const QStringList knownArchitectures = QStringList() << QStringLiteral("x86") << QStringLiteral("amd64_x86") << QStringLiteral("amd64") << QStringLiteral("x86_amd64") << QStringLiteral("ia64") << QStringLiteral("x86_ia64") << QStringLiteral("x86_arm") << QStringLiteral("amd64_arm"); for (const QString &knownArchitecture : knownArchitectures) { MSVCArchInfo ai; ai.arch = knownArchitecture; ai.binPath = msvc.binPathForArchitecture(knownArchitecture); addResult(ai); } } else { QDir vcInstallDir(msvc.vcInstallPath); const auto hostArchs = vcInstallDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); for (const QString &hostArch : hostArchs) { QDir subdir = vcInstallDir; if (!subdir.cd(hostArch)) continue; const QString shortHostArch = hostArch.mid(4).toLower(); const auto archs = subdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); for (const QString &arch : archs) { MSVCArchInfo ai; ai.binPath = subdir.absoluteFilePath(arch); if (shortHostArch == arch) ai.arch = arch; else ai.arch = shortHostArch + QLatin1Char('_') + arch; addResult(ai); } } } return result; } QVariantMap MSVC::toVariantMap() const { return { {QStringLiteral("version"), version}, {QStringLiteral("internalVsVersion"), internalVsVersion.toString()}, {QStringLiteral("vsInstallPath"), vsInstallPath}, {QStringLiteral("vcInstallPath"), vcInstallPath}, {QStringLiteral("binPath"), binPath}, {QStringLiteral("architecture"), architecture}, }; } /*! \internal Returns the list of all compilers present in all MSVC installations separated by host/target arch, e.g. [ VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64, VC\Tools\MSVC\14.16.27023\bin\Hostx64\x86, VC\Tools\MSVC\14.16.27023\bin\Hostx64\arm, VC\Tools\MSVC\14.16.27023\bin\Hostx64\arm64, VC\Tools\MSVC\14.16.27023\bin\Hostx86\x64, ... ] \note that MSVC.architecture can be either "x64" or "amd64" (depending on the MSVC version) in case of 64-bit platform (but we use the "x86_64" name...) */ std::vector MSVC::installedCompilers(Logger &logger) { std::vector msvcs; const auto instMsvcs = installedCompilersHelper(logger); for (const MSVC &msvc : instMsvcs) { if (msvc.internalVsVersion.majorVersion() < 15) { // Check existence of various install scripts const QString vcvars32bat = msvc.vcInstallPath + QLatin1String("/vcvars32.bat"); if (!QFileInfo(vcvars32bat).isFile()) continue; } const auto ais = findSupportedArchitectures(msvc); transform(ais, msvcs, [&msvc](const auto &ai) { MSVC specificMSVC = msvc; specificMSVC.architecture = ai.arch; specificMSVC.binPath = ai.binPath; return specificMSVC; }); } return msvcs; } void MSVC::determineCompilerVersion() { QString cppFilePath; { QTemporaryFile cppFile(QDir::tempPath() + QLatin1String("/qbsXXXXXX.cpp")); cppFile.setAutoRemove(false); if (!cppFile.open()) { throw ErrorInfo(mkStr("Could not create temporary file (%1)") .arg(cppFile.errorString())); } cppFilePath = cppFile.fileName(); cppFile.write("_MSC_FULL_VER"); cppFile.close(); } DummyFile fileDeleter(cppFilePath); std::lock_guard locker(envMutex); const QByteArray origPath = qgetenv("PATH"); QByteArray tempPath = environment.value(StringConstants::pathEnvVar()).toLatin1() + ';' + origPath; qputenv("PATH", tempPath); QByteArray versionStr = runProcess( binPath + clExeSuffix(), QStringList() << QStringLiteral("/nologo") << QStringLiteral("/EP") << QDir::toNativeSeparators(cppFilePath)); qputenv("PATH", origPath); compilerVersion = Version(versionStr.mid(0, 2).toInt(), versionStr.mid(2, 2).toInt(), versionStr.mid(4).toInt()); } QString MSVCInstallInfo::findVcvarsallBat() const { static const auto vcvarsall2017 = QStringLiteral("VC/Auxiliary/Build/vcvarsall.bat"); // 2015, 2013 and 2012 static const auto vcvarsallOld = QStringLiteral("VC/vcvarsall.bat"); QDir dir(installDir); if (dir.exists(vcvarsall2017)) return dir.absoluteFilePath(vcvarsall2017); if (dir.exists(vcvarsallOld)) return dir.absoluteFilePath(vcvarsallOld); return {}; } std::vector MSVCInstallInfo::installedMSVCs(Logger &logger) { auto installInfos = installedMSVCsFromVsWhere(logger); if (installInfos.empty()) return installedMSVCsFromRegistry(); return installInfos; } qbs-src-3.2.0/src/lib/corelib/tools/visualstudioversioninfo.h0000644000175100017510000000560515154533055024012 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** 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_VISUALSTUDIOVERSIONINFO_H #define QBS_VISUALSTUDIOVERSIONINFO_H #include "qbs_export.h" #include #include #include #include namespace qbs { namespace Internal { class QBS_EXPORT VisualStudioVersionInfo { public: VisualStudioVersionInfo(); VisualStudioVersionInfo(const Version &version); static std::set knownVersions(); bool operator<(const VisualStudioVersionInfo &other) const; bool operator==(const VisualStudioVersionInfo &other) const; bool usesMsBuild() const; bool usesVcBuild() const; bool usesSolutions() const; Version version() const; int marketingVersion() const; QString solutionVersion() const; QString toolsVersion() const; QString platformToolsetVersion() const; private: Version m_version; }; QHashValueType qHash(const VisualStudioVersionInfo &info); } // namespace Internal } // namespace qbs #endif // QBS_VISUALSTUDIOVERSIONINFO_H qbs-src-3.2.0/src/lib/corelib/tools/jsliterals.h0000644000175100017510000000457315154533055021154 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_JSLITERALS_H #define QBS_JSLITERALS_H #include "qbs_export.h" #include #include #include namespace qbs { QBS_EXPORT QString toJSLiteral(const bool b); QBS_EXPORT QString toJSLiteral(unsigned long long l); QBS_EXPORT QString toJSLiteral(long long l); QBS_EXPORT QString toJSLiteral(const QString &str); QBS_EXPORT QString toJSLiteral(const QStringList &strs); QBS_EXPORT QString toJSLiteral(const QVariant &val); } // namespace qbs #endif // QBS_JSLITERALS_H qbs-src-3.2.0/src/lib/corelib/tools/filetime.h0000644000175100017510000000763215154533055020575 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_FILETIME_H #define QBS_FILETIME_H #include "persistence.h" #include #include #if defined(Q_OS_UNIX) #include #endif // Q_OS_UNIX namespace qbs { namespace Internal { #if defined(Q_OS_WIN) template T toFileTime(quint64 fileTime) { T result; result.dwLowDateTime = fileTime; result.dwHighDateTime = fileTime >> 32; return result; } template quint64 fromFileTime(T fileTime) { return static_cast(fileTime.dwLowDateTime) | (static_cast(fileTime.dwHighDateTime) << 32); } #endif class QBS_AUTOTEST_EXPORT FileTime { public: #if defined(Q_OS_UNIX) using InternalType = timespec; #elif defined(Q_OS_WIN) using InternalType = quint64; #else # error unknown platform #endif FileTime(); FileTime(const InternalType &ft); bool operator<(const FileTime &rhs) const { return compare(rhs) < 0; } bool operator>(const FileTime &rhs) const { return compare(rhs) > 0; } bool operator<=(const FileTime &rhs) const { return !operator>(rhs); } bool operator>=(const FileTime &rhs) const { return !operator<(rhs); } bool operator==(const FileTime &rhs) const { return compare(rhs) == 0; } bool operator!= (const FileTime &rhs) const { return !operator==(rhs); } int compare(const FileTime &other) const; void clear(); bool isValid() const; QString toString() const; static FileTime currentTime(); static FileTime oldestTime(); double asDouble() const; template void completeSerializationOp(PersistentPool &pool) { #if !defined(Q_OS_WIN) pool.serializationOp(m_fileTime.tv_sec, m_fileTime.tv_nsec); #else pool.serializationOp(m_fileTime); #endif } private: InternalType m_fileTime{}; }; } // namespace Internal } // namespace qbs QT_BEGIN_NAMESPACE inline QDebug operator<<(QDebug dbg, const qbs::Internal::FileTime &t) { dbg.nospace() << t.toString(); return dbg.space(); } QT_END_NAMESPACE #endif // QBS_FILETIME_H qbs-src-3.2.0/src/lib/corelib/tools/mutexdata.h0000644000175100017510000000754715154533055021000 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 Ivan Komissarov (abbapoh@gmail.com) ** 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$ ** ****************************************************************************/ #pragma once #include #include namespace qbs { namespace Internal { // adapted version of https://github.com/dragazo/rustex/blob/master/rustex.h // a data with a mutually exclusive access template class MutexData { public: template typename LockType> class ReferenceGuard { friend class MutexData; template ReferenceGuard(U &&data) noexcept : m_ptr(std::addressof(data.m_data)) , m_lock(data.m_mutex) {} public: ReferenceGuard(const ReferenceGuard &) = delete; ReferenceGuard(ReferenceGuard &&) = default; ReferenceGuard &operator=(const ReferenceGuard &) = delete; ReferenceGuard &operator=(ReferenceGuard &&) = default; T &get() const noexcept { return *m_ptr; } T &data() const noexcept { return *m_ptr; } operator T &() const noexcept { return *m_ptr; } private: T *m_ptr; LockType m_lock; }; using UniqueMutableGuard = ReferenceGuard; using UniqueConstGuard = ReferenceGuard; using SharedGuard = ReferenceGuard; template< typename ...Args, std::enable_if_t, int> = 0 > explicit MutexData(Args &&...args) : m_data(std::forward(args)...) {} [[nodiscard]] UniqueMutableGuard lock() noexcept { return UniqueMutableGuard{*this}; } [[nodiscard]] UniqueConstGuard lock() const noexcept { return UniqueConstGuard{*this}; } template< typename U = MutexType, std::enable_if_t, int> = 0 > [[nodiscard]] SharedGuard lock_shared() const noexcept { return SharedGuard{*this}; } private: DataType m_data; mutable MutexType m_mutex; }; } // namespace qbs } // namespace Internal qbs-src-3.2.0/src/lib/corelib/tools/shellutils.h0000644000175100017510000000731015154533055021160 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Petroules Corporation. ** 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_SHELLUTILS_H #define QBS_SHELLUTILS_H #include "qbs_export.h" #include "hostosinfo.h" #include #include namespace qbs { namespace Internal { QBS_EXPORT QString shellInterpreter(const QString &filePath); QBS_EXPORT std::string shellQuote(const std::string &arg, HostOsInfo::HostOs os = HostOsInfo::hostOs()); QBS_EXPORT QString shellQuote(const QString &arg, HostOsInfo::HostOs os = HostOsInfo::hostOs()); QBS_EXPORT QString shellQuote(const QStringList &args, HostOsInfo::HostOs os = HostOsInfo::hostOs()); QBS_EXPORT std::string shellQuote(const std::vector &args, HostOsInfo::HostOs os = HostOsInfo::hostOs()); QBS_EXPORT QString shellQuote(const QString &program, const QStringList &args, HostOsInfo::HostOs os = HostOsInfo::hostOs()); class QBS_EXPORT CommandLine { public: void setProgram(const QString &program, bool raw = false); void setProgram(const std::string &program, bool raw = false); void appendArgument(const QString &value); void appendArgument(const std::string &value); void appendArguments(const QList &args); void appendRawArgument(const QString &value); void appendRawArgument(const std::string &value); void appendPathArgument(const QString &value); void clearArguments(); QString toCommandLine(HostOsInfo::HostOs os = HostOsInfo::hostOs()) const; private: struct Argument { Argument(QString value = QString()) : value(std::move(value)) { } QString value; bool isFilePath = false; bool shouldQuote = true; }; bool m_isRawProgram = false; QString m_program; std::vector m_arguments; }; } // namespace Internal } // namespace qbs #endif // QBS_SHELLUTILS_H qbs-src-3.2.0/src/lib/corelib/tools/toolchains.cpp0000644000175100017510000001147315154533055021473 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "toolchains.h" #include "stringconstants.h" #include namespace qbs { namespace Internal { static const QString clangToolchain() { return QStringLiteral("clang"); } static const QString clangClToolchain() { return QStringLiteral("clang-cl"); } static const QString gccToolchain() { return QStringLiteral("gcc"); } static const QString llvmToolchain() { return QStringLiteral("llvm"); } static const QString mingwToolchain() { return QStringLiteral("mingw"); } static const QString msvcToolchain() { return QStringLiteral("msvc"); } static const QString emscriptenToolchain() { return QStringLiteral("emscripten"); } } // namespace Internal using namespace Internal; QStringList canonicalToolchain(const QStringList &toolchain) { static const QStringList knownToolchains{ StringConstants::xcode(), clangToolchain(), llvmToolchain(), mingwToolchain(), gccToolchain(), clangClToolchain(), msvcToolchain(), emscriptenToolchain()}; // Canonicalize each toolchain in the toolchain list, // which gets us the aggregate canonicalized (unsorted) list QStringList toolchains; for (const QString &toolchainName : toolchain) toolchains << canonicalToolchain(toolchainName); toolchains.removeDuplicates(); // Find all known toolchains in the canonicalized list, // removing them from the main list as we go. QStringList usedKnownToolchains; for (int i = 0; i < toolchains.size(); ++i) { if (knownToolchains.contains(toolchains[i])) { usedKnownToolchains << toolchains[i]; toolchains.removeAt(i--); } } // Sort the list of known toolchains into their canonical order. std::sort(usedKnownToolchains.begin(), usedKnownToolchains.end(), []( const QString &a, const QString &b) { return knownToolchains.indexOf(a) < knownToolchains.indexOf(b); }); // Re-add the known toolchains to the main list (the custom ones go first). toolchains << usedKnownToolchains; // The toolchain list still needs further validation as it may contain mututally exclusive // toolchain types (for example, llvm and msvc). return toolchains; } QStringList canonicalToolchain(const QString &name) { const QString &toolchainName = name.toLower(); QStringList toolchains(toolchainName); if (toolchainName == StringConstants::xcode()) { toolchains << canonicalToolchain(clangToolchain()); } else if (toolchainName == clangToolchain()) { toolchains << canonicalToolchain(llvmToolchain()); } else if (toolchainName == llvmToolchain() || toolchainName == mingwToolchain() || toolchainName == emscriptenToolchain()) { toolchains << canonicalToolchain(QStringLiteral("gcc")); } else if (toolchainName == clangClToolchain()) { toolchains << canonicalToolchain(msvcToolchain()); } return toolchains; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/joblimits.cpp0000644000175100017510000001202615154533055021317 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #include "joblimits.h" #include #include #include namespace qbs { namespace Internal { static int transformLimit(int limitFromUser) { return limitFromUser == 0 ? std::numeric_limits::max() : limitFromUser < -1 ? -1 : limitFromUser; } class JobLimitPrivate : public QSharedData { public: JobLimitPrivate(const QString &pool, int limit) : jobLimit(std::make_pair(pool, transformLimit(limit))) { } template void serializationOp(PersistentPool &pool) { pool.serializationOp(jobLimit); } std::pair jobLimit; }; class JobLimitsPrivate : public QSharedData { public: template void serializationOp(PersistentPool &pool) { pool.serializationOp(jobLimits); } std::vector jobLimits; }; } // namespace Internal JobLimit::JobLimit() : JobLimit(QString(), -1) { } JobLimit::JobLimit(const QString &pool, int limit) : d(new Internal::JobLimitPrivate(pool, limit)) { } JobLimit::JobLimit(const JobLimit &other) = default; JobLimit &JobLimit::operator=(const JobLimit &other) = default; JobLimit::~JobLimit() = default; QString JobLimit::pool() const { return d->jobLimit.first; } int JobLimit::limit() const { return d->jobLimit.second; } void JobLimit::load(Internal::PersistentPool &pool) { d->serializationOp(pool); } void JobLimit::store(Internal::PersistentPool &pool) { d->serializationOp(pool); } JobLimits::JobLimits() : d(new Internal::JobLimitsPrivate) { } JobLimits::JobLimits(const JobLimits &other) = default; JobLimits &JobLimits::operator=(const JobLimits &other) = default; JobLimits::~JobLimits() = default; void JobLimits::setJobLimit(const JobLimit &limit) { for (auto ¤tLimit : d->jobLimits) { if (currentLimit.pool() == limit.pool()) { if (currentLimit.limit() != limit.limit()) currentLimit = limit; return; } } d->jobLimits.push_back(limit); } void JobLimits::setJobLimit(const QString &pool, int limit) { setJobLimit(JobLimit(pool, limit)); } int JobLimits::getLimit(const QString &pool) const { for (const JobLimit &l : d->jobLimits) { if (l.pool() == pool) return l.limit(); } return -1; } bool JobLimits::isEmpty() const { return d->jobLimits.empty(); } int JobLimits::count() const { return int(d->jobLimits.size()); } JobLimit JobLimits::jobLimitAt(int i) const { return d->jobLimits.at(i); } JobLimits &JobLimits::update(const JobLimits &other) { if (isEmpty()) { *this = other; } else { for (int i = 0; i < other.count(); ++i) { const JobLimit &l = other.jobLimitAt(i); if (l.limit() != -1) setJobLimit(l); } } return *this; } void JobLimits::load(Internal::PersistentPool &pool) { d->serializationOp(pool); } void JobLimits::store(Internal::PersistentPool &pool) { d->serializationOp(pool); } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/launcherpackets.cpp0000644000175100017510000001247515154533055022507 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "launcherpackets.h" #include #include namespace qbs { namespace Internal { LauncherPacket::~LauncherPacket() = default; QByteArray LauncherPacket::serialize() const { QByteArray data; QDataStream stream(&data, QIODevice::WriteOnly); stream << static_cast(0) << static_cast(type) << token; doSerialize(stream); stream.device()->reset(); stream << static_cast(data.size() - sizeof(int)); return data; } void LauncherPacket::deserialize(const QByteArray &data) { QDataStream stream(data); doDeserialize(stream); } StartProcessPacket::StartProcessPacket(quintptr token) : LauncherPacket(LauncherPacketType::StartProcess, token) { } void StartProcessPacket::doSerialize(QDataStream &stream) const { stream << command << arguments << workingDir << env; } void StartProcessPacket::doDeserialize(QDataStream &stream) { stream >> command >> arguments >> workingDir >> env; } StopProcessPacket::StopProcessPacket(quintptr token) : LauncherPacket(LauncherPacketType::StopProcess, token) { } void StopProcessPacket::doSerialize(QDataStream &stream) const { Q_UNUSED(stream); } void StopProcessPacket::doDeserialize(QDataStream &stream) { Q_UNUSED(stream); } ProcessErrorPacket::ProcessErrorPacket(quintptr token) : LauncherPacket(LauncherPacketType::ProcessError, token) { } void ProcessErrorPacket::doSerialize(QDataStream &stream) const { stream << static_cast(error) << errorString; } void ProcessErrorPacket::doDeserialize(QDataStream &stream) { quint8 e; stream >> e; error = static_cast(e); stream >> errorString; } ProcessFinishedPacket::ProcessFinishedPacket(quintptr token) : LauncherPacket(LauncherPacketType::ProcessFinished, token) { } void ProcessFinishedPacket::doSerialize(QDataStream &stream) const { stream << errorString << stdOut << stdErr << static_cast(exitStatus) << static_cast(error) << exitCode; } void ProcessFinishedPacket::doDeserialize(QDataStream &stream) { stream >> errorString >> stdOut >> stdErr; quint8 val; stream >> val; exitStatus = static_cast(val); stream >> val; error = static_cast(val); stream >> exitCode; } ShutdownPacket::ShutdownPacket() : LauncherPacket(LauncherPacketType::Shutdown, 0) { } void ShutdownPacket::doSerialize(QDataStream &stream) const { Q_UNUSED(stream); } void ShutdownPacket::doDeserialize(QDataStream &stream) { Q_UNUSED(stream); } void PacketParser::setDevice(QIODevice *device) { m_stream.setDevice(device); m_sizeOfNextPacket = -1; } bool PacketParser::parse() { static const int commonPayloadSize = static_cast(1 + sizeof(quintptr)); if (m_sizeOfNextPacket == -1) { if (m_stream.device()->bytesAvailable() < static_cast(sizeof m_sizeOfNextPacket)) return false; m_stream >> m_sizeOfNextPacket; if (m_sizeOfNextPacket < commonPayloadSize) throw InvalidPacketSizeException(m_sizeOfNextPacket); } if (m_stream.device()->bytesAvailable() < m_sizeOfNextPacket) return false; quint8 type; m_stream >> type; m_type = static_cast(type); m_stream >> m_token; m_packetData = m_stream.device()->read(m_sizeOfNextPacket - commonPayloadSize); m_sizeOfNextPacket = -1; return true; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/setupprojectparameters.cpp0000644000175100017510000006133715154533055024147 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "setupprojectparameters.h" #include "buildoptions.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { /*! * \class SetupProjectParameters * \brief The \c SetupProjectParameters class comprises data required to set up a qbs project. */ class SetupProjectParametersPrivate : public QSharedData { public: SetupProjectParametersPrivate() : overrideBuildGraphData(false) , dryRun(false) , logElapsedTime(false) , forceProbeExecution(false) , waitLockBuildGraph(false) , restoreBehavior(SetupProjectParameters::RestoreAndTrackChanges) , propertyCheckingMode(ErrorHandlingMode::Strict) , productErrorMode(ErrorHandlingMode::Strict) { } QString projectFilePath; QString topLevelProfile; QString configurationName = QLatin1String("default"); QString buildRoot; QStringList searchPaths; QStringList pluginPaths; QString libexecPath; QString settingsBaseDir; QVariantMap overriddenValues; QVariantMap buildConfiguration; mutable QVariantMap buildConfigurationTree; mutable QVariantMap overriddenValuesTree; mutable QVariantMap finalBuildConfigTree; int maxJobCount = 0; bool overrideBuildGraphData; bool dryRun; bool logElapsedTime; bool forceProbeExecution; bool waitLockBuildGraph; SetupProjectParameters::RestoreBehavior restoreBehavior; ErrorHandlingMode propertyCheckingMode; ErrorHandlingMode productErrorMode; DeprecationWarningMode deprecationWarningMode = defaultDeprecationWarningMode(); QProcessEnvironment environment; }; } // namespace Internal using namespace Internal; SetupProjectParameters::SetupProjectParameters() : d(new SetupProjectParametersPrivate) { } SetupProjectParameters::SetupProjectParameters(const SetupProjectParameters &other) = default; SetupProjectParameters::SetupProjectParameters( SetupProjectParameters &&other) Q_DECL_NOEXCEPT = default; SetupProjectParameters::~SetupProjectParameters() = default; SetupProjectParameters &SetupProjectParameters::operator=( const SetupProjectParameters &other) = default; namespace Internal { template<> ErrorHandlingMode fromJson(const QJsonValue &v) { if (v.toString() == QLatin1String("relaxed")) return ErrorHandlingMode::Relaxed; return ErrorHandlingMode::Strict; } template<> DeprecationWarningMode fromJson(const QJsonValue &v) { return deprecationWarningModeFromName(v.toString()); } template<> SetupProjectParameters::RestoreBehavior fromJson(const QJsonValue &v) { const QString value = v.toString(); if (value == QLatin1String("restore-only")) return SetupProjectParameters::RestoreOnly; if (value == QLatin1String("resolve-only")) return SetupProjectParameters::ResolveOnly; if (value == QLatin1String("restore-and-resolve")) return SetupProjectParameters::RestoreAndResolve; return SetupProjectParameters::RestoreAndTrackChanges; } } // namespace Internal SetupProjectParameters SetupProjectParameters::fromJson(const QJsonObject &data) { using namespace Internal; SetupProjectParameters params; setValueFromJson(params.d->topLevelProfile, data, "top-level-profile"); setValueFromJson(params.d->configurationName, data, "configuration-name"); setValueFromJson(params.d->projectFilePath, data, "project-file-path"); setValueFromJson(params.d->buildRoot, data, "build-root"); setValueFromJson(params.d->settingsBaseDir, data, "settings-directory"); setValueFromJson(params.d->maxJobCount, data, "max-job-count"); if (params.maxJobCount() <= 0) params.setMaxJobCount(BuildOptions::defaultMaxJobCount()); setValueFromJson(params.d->overriddenValues, data, "overridden-properties"); setValueFromJson(params.d->dryRun, data, "dry-run"); setValueFromJson(params.d->logElapsedTime, data, "log-time"); setValueFromJson(params.d->forceProbeExecution, data, "force-probe-execution"); setValueFromJson(params.d->waitLockBuildGraph, data, "wait-lock-build-graph"); setValueFromJson(params.d->environment, data, "environment"); setValueFromJson(params.d->restoreBehavior, data, "restore-behavior"); setValueFromJson(params.d->propertyCheckingMode, data, "error-handling-mode"); setValueFromJson(params.d->deprecationWarningMode, data, "deprecation-warning-mode"); params.d->productErrorMode = params.d->propertyCheckingMode; return params; } SetupProjectParameters &SetupProjectParameters::operator=(SetupProjectParameters &&other) Q_DECL_NOEXCEPT = default; /*! * \brief Returns the name of the top-level profile for building the project. */ QString SetupProjectParameters::topLevelProfile() const { return d->topLevelProfile; } /*! * \brief Sets the top-level profile for building the project. */ void SetupProjectParameters::setTopLevelProfile(const QString &profile) { d->buildConfigurationTree.clear(); d->finalBuildConfigTree.clear(); d->topLevelProfile = profile; } /*! * Returns the name of the current project build configuration. */ QString SetupProjectParameters::configurationName() const { return d->configurationName; } /*! * Sets the name of the current project build configuration to an arbitrary user-specified name, * \a configurationName. */ void SetupProjectParameters::setConfigurationName(const QString &configurationName) { d->buildConfigurationTree.clear(); d->finalBuildConfigTree.clear(); d->configurationName = configurationName; } /*! * \brief Returns the absolute path to the qbs project file. * This file typically has a ".qbs" suffix. */ QString SetupProjectParameters::projectFilePath() const { return d->projectFilePath; } /*! * \brief Sets the path to the main project file. * \note The argument must be an absolute file path. */ void SetupProjectParameters::setProjectFilePath(const QString &projectFilePath) { d->projectFilePath = projectFilePath; const QString canonicalProjectFilePath = QFileInfo(d->projectFilePath).canonicalFilePath(); if (!canonicalProjectFilePath.isEmpty()) d->projectFilePath = canonicalProjectFilePath; } void SetupProjectParameters::finalizeProjectFilePath() { QString filePath = projectFilePath(); if (filePath.isEmpty()) filePath = QDir::currentPath(); const QFileInfo projectFileInfo(filePath); if (!projectFileInfo.exists()) throw ErrorInfo(Tr::tr("Project file '%1' cannot be found.").arg(filePath)); if (projectFileInfo.isRelative()) filePath = projectFileInfo.absoluteFilePath(); if (projectFileInfo.isFile()) { setProjectFilePath(filePath); return; } if (!projectFileInfo.isDir()) throw ErrorInfo(Tr::tr("Project file '%1' has invalid type.").arg(filePath)); const QStringList &actualFileNames = QDir(filePath).entryList(StringConstants::qbsFileWildcards(), QDir::Files); if (actualFileNames.empty()) { QString error; if (projectFilePath().isEmpty()) error = Tr::tr("No project file given and none found in current directory.\n"); else error = Tr::tr("No project file found in directory '%1'.").arg(filePath); throw ErrorInfo(error); } if (actualFileNames.size() > 1) { throw ErrorInfo(Tr::tr("More than one project file found in directory '%1'.") .arg(filePath)); } filePath.append(QLatin1Char('/')).append(actualFileNames.front()); filePath = QDir::current().filePath(filePath); filePath = QDir::cleanPath(filePath); setProjectFilePath(filePath); } /*! * \brief Returns the base path of where to put the build artifacts and store the build graph. */ QString SetupProjectParameters::buildRoot() const { return d->buildRoot; } /*! * \brief Sets the base path of where to put the build artifacts and store the build graph. * The same base path can be used for several build profiles of the same project without them * interfering with each other. * It might look as if this parameter would not be needed at the time of setting up the project, * but keep in mind that the project information could already exist on disk, in which case * loading it will be much faster than setting up the project from scratch. * \note The argument must be an absolute path to a directory. */ void SetupProjectParameters::setBuildRoot(const QString &buildRoot) { d->buildRoot = buildRoot; // Calling mkpath() may be necessary to get the canonical build root, but if we do it, // it must be reverted immediately afterwards as not to create directories needlessly, // e.g in the case of a dry run build. DirectoryManager dirManager(buildRoot, Logger()); // We don't do error checking here, as this is not a convenient place to report an error. // If creation of the build directory is not possible, we will get sensible error messages // later, e.g. from the code that attempts to store the build graph. QDir::root().mkpath(buildRoot); const QString canonicalBuildRoot = QFileInfo(d->buildRoot).canonicalFilePath(); if (!canonicalBuildRoot.isEmpty()) d->buildRoot = canonicalBuildRoot; } /*! * \brief Where to look for modules and items to import. */ QStringList SetupProjectParameters::searchPaths() const { return d->searchPaths; } /*! * \brief Sets the information about where to look for modules and items to import. * \note The elements of the list must be absolute paths to directories. */ void SetupProjectParameters::setSearchPaths(const QStringList &searchPaths) { d->searchPaths = searchPaths; } /*! * \brief Where to look for plugins. */ QStringList SetupProjectParameters::pluginPaths() const { return d->pluginPaths; } /*! * \brief Sets the information about where to look for plugins. * \note The elements of the list must be absolute paths to directories. */ void SetupProjectParameters::setPluginPaths(const QStringList &pluginPaths) { d->pluginPaths = pluginPaths; } /*! * \brief Where to look for internal binaries. */ QString SetupProjectParameters::libexecPath() const { return d->libexecPath; } /*! * \brief Sets the information about where to look for internal binaries. * \note \p libexecPath must be an absolute path. */ void SetupProjectParameters::setLibexecPath(const QString &libexecPath) { d->libexecPath = libexecPath; } /*! * \brief The base directory for qbs settings. * This value is used to locate profiles and preferences. */ QString SetupProjectParameters::settingsDirectory() const { return d->settingsBaseDir; } /*! * \brief Sets the base directory for qbs settings. * \param settingsBaseDir Will be used to locate profiles and preferences. */ void SetupProjectParameters::setSettingsDirectory(const QString &settingsBaseDir) { d->settingsBaseDir = settingsBaseDir; } /*! * \brief Returns the maximum number of threads to employ when resolving the project. * If the value is not valid (i.e. <= 0), a sensible one will be derived from the number of * available processor cores. * The default is 0. * \sa BuildOptions::defaultMaxJobCount */ int SetupProjectParameters::maxJobCount() const { return d->maxJobCount; } /*! * \brief Controls how many threads to employ when resolving the project. * A value <= 0 leaves the decision to qbs. */ void SetupProjectParameters::setMaxJobCount(int jobCount) { d->maxJobCount = jobCount; } /*! * Returns the overridden values of the build configuration. */ QVariantMap SetupProjectParameters::overriddenValues() const { return d->overriddenValues; } /*! * Set the overridden values of the build configuration. */ void SetupProjectParameters::setOverriddenValues(const QVariantMap &values) { d->overriddenValues = values; d->overriddenValuesTree.clear(); d->finalBuildConfigTree.clear(); } static void provideValuesTree(const QVariantMap &values, QVariantMap *valueTree) { if (!valueTree->empty() || values.empty()) return; valueTree->clear(); for (QVariantMap::const_iterator it = values.constBegin(); it != values.constEnd(); ++it) { const QString &name = it.key(); int idx = name.lastIndexOf(QLatin1Char('.')); const QStringList nameElements = (idx == -1) ? QStringList() << name : QStringList() << name.left(idx) << name.mid(idx + 1); setConfigProperty(*valueTree, nameElements, it.value()); } } QVariantMap SetupProjectParameters::overriddenValuesTree() const { provideValuesTree(d->overriddenValues, &d->overriddenValuesTree); return d->overriddenValuesTree; } /*! * \brief Returns the build configuration. * Overridden values are not taken into account. */ QVariantMap SetupProjectParameters::buildConfiguration() const { return d->buildConfiguration; } /*! * \brief Returns the build configuration in tree form. * Overridden values are not taken into account. */ QVariantMap SetupProjectParameters::buildConfigurationTree() const { provideValuesTree(d->buildConfiguration, &d->buildConfigurationTree); return d->buildConfigurationTree; } static QVariantMap expandedBuildConfigurationInternal(const Profile &profile, const QString &configurationName) { QVariantMap buildConfig; // (1) Values from profile, if given. if (profile.exists() && profile.name() != Profile::fallbackName()) { ErrorInfo err; const QStringList profileKeys = profile.allKeys(Profile::KeySelectionRecursive, &err); if (err.hasError()) throw err; if (profileKeys.empty()) throw ErrorInfo(Tr::tr("Unknown or empty profile '%1'.").arg(profile.name())); for (const QString &profileKey : profileKeys) { buildConfig.insert(profileKey, profile.value(profileKey, QVariant(), &err)); if (err.hasError()) throw err; } } // (2) Build configuration name. if (configurationName.isEmpty()) throw ErrorInfo(Tr::tr("No build configuration name set.")); buildConfig.insert(QStringLiteral("qbs.configurationName"), configurationName); return buildConfig; } QVariantMap SetupProjectParameters::expandedBuildConfiguration(const Profile &profile, const QString &configurationName, ErrorInfo *errorInfo) { try { return expandedBuildConfigurationInternal(profile, configurationName); } catch (const ErrorInfo &err) { if (errorInfo) *errorInfo = err; return {}; } } /*! * \brief Expands the build configuration. * * Expansion is the process by which the build configuration is completed based on the settings * in \c settingsDirectory(). E.g. the information configured in a profile is filled into the build * configuration by this step. * * This method returns an Error. The list of entries in this error will be empty is the * expansion was successful. */ ErrorInfo SetupProjectParameters::expandBuildConfiguration() { ErrorInfo err; Settings settings(d->settingsBaseDir); Profile profile(topLevelProfile(), &settings); QVariantMap expandedConfig = expandedBuildConfiguration(profile, configurationName(), &err); if (err.hasError()) return err; if (!qVariantMapsEqual(d->buildConfiguration, expandedConfig)) { d->buildConfigurationTree.clear(); d->buildConfiguration = expandedConfig; } return err; } QVariantMap SetupProjectParameters::finalBuildConfigurationTree(const QVariantMap &buildConfig, const QVariantMap &overriddenValues) { QVariantMap flatBuildConfig = buildConfig; for (QVariantMap::ConstIterator it = overriddenValues.constBegin(); it != overriddenValues.constEnd(); ++it) { flatBuildConfig.insert(it.key(), it.value()); } QVariantMap buildConfigTree; provideValuesTree(flatBuildConfig, &buildConfigTree); return buildConfigTree; } /*! * \brief Returns the build configuration in tree form, with overridden values taken into account. */ QVariantMap SetupProjectParameters::finalBuildConfigurationTree() const { if (d->finalBuildConfigTree.empty()) { d->finalBuildConfigTree = finalBuildConfigurationTree(buildConfiguration(), overriddenValues()); } return d->finalBuildConfigTree; } /*! * \brief if true, qbs will not store the build graph of the resolved project. */ bool SetupProjectParameters::dryRun() const { return d->dryRun; } /*! * \brief Controls whether the build graph will be stored. * If the argument is true, qbs will not store the build graph after resolving the project. * The default is false. */ void SetupProjectParameters::setDryRun(bool dryRun) { d->dryRun = dryRun; } /*! * \brief Returns true iff the time the operation takes should be logged */ bool SetupProjectParameters::logElapsedTime() const { return d->logElapsedTime; } /*! * Controls whether to log the time taken up for resolving the project. * The default is false. */ void SetupProjectParameters::setLogElapsedTime(bool logElapsedTime) { d->logElapsedTime = logElapsedTime; } /*! * \brief Returns true iff probes should be re-run. */ bool SetupProjectParameters::forceProbeExecution() const { return d->forceProbeExecution; } /*! * Controls whether to re-run probes even if they do not appear to be outdated. * This option only has an effect if \c restoreBehavior() is \c RestoreAndTrackChanges. */ void SetupProjectParameters::setForceProbeExecution(bool force) { d->forceProbeExecution = force; } /*! * \brief Returns true if qbs should wait for the build graph lock to become available, * otherwise qbs will exit immediately if the lock cannot be acquired. */ bool SetupProjectParameters::waitLockBuildGraph() const { return d->waitLockBuildGraph; } /*! * Controls whether to wait indefinitely for the build graph lock to be released. * This allows multiple conflicting qbs processes to be spawned simultaneously. */ void SetupProjectParameters::setWaitLockBuildGraph(bool wait) { d->waitLockBuildGraph = wait; } /*! * \brief Gets the environment used while resolving the project. */ QProcessEnvironment SetupProjectParameters::environment() const { return d->environment; } /*! * \brief Sets the environment used while resolving the project. */ void SetupProjectParameters::setEnvironment(const QProcessEnvironment &env) { d->environment = env; } QProcessEnvironment SetupProjectParameters::adjustedEnvironment() const { QProcessEnvironment result = environment(); const QVariantMap environmentFromProfile = buildConfigurationTree().value(QStringLiteral("buildEnvironment")).toMap(); for (QVariantMap::const_iterator it = environmentFromProfile.begin(); it != environmentFromProfile.end(); ++it) { result.insert(it.key(), it.value().toString()); } return result; } /*! * \enum SetupProjectParamaters::RestoreBehavior * This enum type specifies how to deal with existing on-disk build information. * \value RestoreOnly Indicates that a stored build graph is to be loaded and the information * therein assumed to be up to date. It is then considered an error if no * such build graph exists. * \value ResolveOnly Indicates that no attempt should be made to restore an existing build graph. * Instead, the project is to be resolved from scratch. * \value RestoreAndTrackChanges Indicates that the build graph should be restored from disk * if possible and otherwise set up from scratch. In the first case, * (parts of) the project might still be re-resolved if certain * parameters have changed (e.g. environment variables used in the * project files). */ /*! * Returns information about how restored build data will be handled. */ SetupProjectParameters::RestoreBehavior SetupProjectParameters::restoreBehavior() const { return d->restoreBehavior; } /*! * Controls how restored build data will be handled. */ void SetupProjectParameters::setRestoreBehavior(SetupProjectParameters::RestoreBehavior behavior) { d->restoreBehavior = behavior; } /*! * Returns true if and only if environment, project file path and overridden property values * should be taken from this object even if a build graph already exists. * If this function returns \c false and a build graph exists, then it is an error to provide a * project file path or overridden property values that differ from the respective values * in the build graph. */ bool SetupProjectParameters::overrideBuildGraphData() const { return d->overrideBuildGraphData; } /*! * If \c doOverride is true, then environment, project file path and overridden property values * are taken from this object rather than from the build graph. * The default is \c false. */ void SetupProjectParameters::setOverrideBuildGraphData(bool doOverride) { d->overrideBuildGraphData = doOverride; } /*! * \enum ErrorHandlingMode * This enum type specifies how \QBS should behave if errors occur during project resolving. * \value ErrorHandlingMode::Strict Project resolving will stop with an error message. * \value ErrorHandlingMode::Relaxed Project resolving will continue (if possible), and a warning * will be printed. */ /*! * Indicates how to handle unknown properties. */ ErrorHandlingMode SetupProjectParameters::propertyCheckingMode() const { return d->propertyCheckingMode; } /*! * Controls how to handle unknown properties. * The default is \c PropertyCheckingRelaxed. */ void SetupProjectParameters::setPropertyCheckingMode(ErrorHandlingMode mode) { d->propertyCheckingMode = mode; } /*! * \brief Indicates how errors occurring during product resolving are handled. */ ErrorHandlingMode SetupProjectParameters::productErrorMode() const { return d->productErrorMode; } /*! * \brief Specifies whether an error occurring during product resolving should be fatal or not. * \note Not all errors can be ignored; this setting is mainly intended for things such as * missing dependencies or references to non-existing source files. */ void SetupProjectParameters::setProductErrorMode(ErrorHandlingMode mode) { d->productErrorMode = mode; } /*! * \brief Indicates how deprecated constructs are handled. */ DeprecationWarningMode SetupProjectParameters::deprecationWarningMode() const { return d->deprecationWarningMode; } /*! * \brief Specifies the behavior on encountering deprecated constructs. */ void SetupProjectParameters::setDeprecationWarningMode(DeprecationWarningMode mode) { d->deprecationWarningMode = mode; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/installoptions.cpp0000644000175100017510000001653115154533055022412 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "installoptions.h" #include "jsonhelper.h" #include "stringconstants.h" #include #include #include namespace qbs { namespace Internal { class InstallOptionsPrivate : public QSharedData { public: InstallOptionsPrivate() : useSysroot(false), removeExisting(false), dryRun(false), keepGoing(false), logElapsedTime(false) {} QString installRoot; bool useSysroot; bool removeExisting; bool dryRun; bool keepGoing; bool logElapsedTime; }; QString effectiveInstallRoot(const InstallOptions &options, const TopLevelProject *project) { QString installRoot = options.installRoot(); if (!installRoot.isEmpty()) return installRoot; if (options.installIntoSysroot()) { return project->buildConfiguration().value(StringConstants::qbsModule()).toMap() .value(QStringLiteral("sysroot")).toString(); } return project->buildConfiguration().value(StringConstants::qbsModule()).toMap() .value(StringConstants::installRootProperty()).toString(); } } // namespace Internal /*! * \class InstallOptions * \brief The \c InstallOptions class comprises parameters that influence the behavior of * install operations. */ InstallOptions::InstallOptions() : d(new Internal::InstallOptionsPrivate) { } InstallOptions::InstallOptions(const InstallOptions &other) = default; InstallOptions::InstallOptions(InstallOptions &&other) Q_DECL_NOEXCEPT = default; InstallOptions &InstallOptions::operator=(const InstallOptions &other) = default; InstallOptions &InstallOptions::operator=(InstallOptions &&other) Q_DECL_NOEXCEPT = default; InstallOptions::~InstallOptions() = default; /*! * \brief The default install root, relative to the build directory. */ QString InstallOptions::defaultInstallRoot() { return QStringLiteral("install-root"); } /*! * Returns the base directory for the installation. * The \c qbs.installPrefix path is relative to this root. If the string is empty, either the value of * qbs.sysroot or "/install-root" will be used, depending on what \c installIntoSysroot() * returns. * The default is empty. */ QString InstallOptions::installRoot() const { return d->installRoot; } /*! * \brief Sets the base directory for the installation. * \note The argument must either be an empty string or an absolute path to a directory * (which might not yet exist, in which case it will be created). */ void InstallOptions::setInstallRoot(const QString &installRoot) { d->installRoot = QDir::cleanPath(installRoot); if (!QDir(installRoot).isRoot()) { while (d->installRoot.endsWith(QLatin1Char('/'))) d->installRoot.chop(1); } } /*! * Returns whether to use the sysroot as the default install root. * The default is false. */ bool InstallOptions::installIntoSysroot() const { return d->useSysroot; } void InstallOptions::setInstallIntoSysroot(bool useSysroot) { d->useSysroot = useSysroot; } /*! * \brief Returns true iff an existing installation will be removed prior to installing. * The default is false. */ bool InstallOptions::removeExistingInstallation() const { return d->removeExisting; } /*! * Controls whether to remove an existing installation before installing. * \note qbs may do some safety checks and refuse to remove certain directories such as * a user's home directory. You should still be careful with this option, since it * deletes recursively. */ void InstallOptions::setRemoveExistingInstallation(bool removeExisting) { d->removeExisting = removeExisting; } /*! * \brief Returns true iff qbs will not actually copy any files, but just show what would happen. * The default is false. */ bool InstallOptions::dryRun() const { return d->dryRun; } /*! * \brief Controls whether installation will actually take place. * If the argument is true, then qbs will emit information about which files would be copied * instead of actually doing it. */ void InstallOptions::setDryRun(bool dryRun) { d->dryRun = dryRun; } /*! * Returns true iff installation will continue if an error occurs. * The default is false. */ bool InstallOptions::keepGoing() const { return d->keepGoing; } /*! * \brief Controls whether to abort on errors. * If the argument is true, then if a file cannot be copied e.g. due to a permission problem, * a warning will be printed and the installation will continue. If the argument is false, * then the installation will abort immediately in case of an error. */ void InstallOptions::setKeepGoing(bool keepGoing) { d->keepGoing = keepGoing; } /*! * \brief Returns true iff the time the operation takes will be logged. * The default is false. */ bool InstallOptions::logElapsedTime() const { return d->logElapsedTime; } /*! * \brief Controls whether the installation time will be measured and logged. */ void InstallOptions::setLogElapsedTime(bool logElapsedTime) { d->logElapsedTime = logElapsedTime; } qbs::InstallOptions qbs::InstallOptions::fromJson(const QJsonObject &data) { using namespace Internal; InstallOptions opt; setValueFromJson(opt.d->installRoot, data, "install-root"); setValueFromJson(opt.d->useSysroot, data, "use-sysroot"); setValueFromJson(opt.d->removeExisting, data, "clean-install-root"); setValueFromJson(opt.d->dryRun, data, "dry-run"); setValueFromJson(opt.d->keepGoing, data, "keep-going"); setValueFromJson(opt.d->logElapsedTime, data, "log-time"); return opt; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/settingsrepresentation.cpp0000644000175100017510000001007315154533055024146 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #include "settingsrepresentation.h" #include "jsliterals.h" #include #include namespace qbs { QString settingsValueToRepresentation(const QVariant &value) { return toJSLiteral(value); } static QVariant variantFromString(const QString &str, bool &ok) { // ### use Qt5's JSON reader at some point. class DummyLogSink : public ILogSink { void doPrintMessage(LoggerLevel, const QString &, const QString &) override { } } logSink; Internal::Logger logger(&logSink); const auto engine = Internal::ScriptEngine::create(logger, {}); Internal::ScopedJsValue sv( engine->context(), engine->evaluate(Internal::JsValueOwner::Caller, QLatin1String("(function(){return ") + str + QLatin1String(";})()"))); ok = !engine->checkForJsError({}); return Internal::getJsVariant(engine->context(), sv); } QVariant representationToSettingsValue(const QString &representation) { const QVariant v = representationToVariant(representation); switch (static_cast(v.userType())) { // Work around QSettings losing type information when storing integer types. case QMetaType::Bool: case QMetaType::Char: case QMetaType::Int: case QMetaType::Long: case QMetaType::LongLong: case QMetaType::UChar: case QMetaType::UInt: case QMetaType::ULong: case QMetaType::ULongLong: return QVariantHash({std::make_pair(QString(), v)}); default: break; } return v; } QVariant representationToVariant(const QString &representation) { bool ok; QVariant variant = variantFromString(representation, ok); // We have no floating-point properties, so this is most likely intended to be a string. if (static_cast(variant.userType()) == QMetaType::Float || static_cast(variant.userType()) == QMetaType::Double) { variant = variantFromString(QLatin1Char('"') + representation + QLatin1Char('"'), ok); } if (ok) return variant; // If it's not valid JavaScript, interpret the value as a string. return representation; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/scannerpluginmanager.cpp0000644000175100017510000000604215154533055023527 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "scannerpluginmanager.h" #include #include namespace qbs { namespace Internal { class ScannerPluginManagerPrivate { public: std::map> scannerPlugins; }; ScannerPluginManager::~ScannerPluginManager() = default; ScannerPluginManager *ScannerPluginManager::instance() { static ScannerPluginManager scannerPlugin; return &scannerPlugin; } ScannerPluginManager::ScannerPluginManager() : d(new ScannerPluginManagerPrivate) { } std::vector ScannerPluginManager::scannersForFileTag(const FileTag &fileTag) { auto it = instance()->d->scannerPlugins.find(fileTag); if (it != instance()->d->scannerPlugins.cend()) return it->second; return {}; } void ScannerPluginManager::registerPlugins(ScannerPlugin **plugins) { for (int i = 0; plugins[i] != nullptr; ++i) { const FileTags &fileTags = FileTags::fromStringList( QString::fromLatin1(plugins[i]->fileTags).split(QLatin1Char(','))); for (const FileTag &tag : fileTags) d->scannerPlugins[tag].push_back(plugins[i]); } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/launcherinterface.h0000644000175100017510000000557715154533055022467 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_LAUNCHERINTERFACE_H #define QBS_LAUNCHERINTERFACE_H #include QT_BEGIN_NAMESPACE class QLocalServer; QT_END_NAMESPACE namespace qbs { class ErrorInfo; namespace Internal { class LauncherProcess; class LauncherSocket; class LauncherInterface : public QObject { Q_OBJECT public: static LauncherInterface &instance(); ~LauncherInterface() override; static void startLauncher() { instance().doStart(); } static void stopLauncher() { instance().doStop(); } static LauncherSocket *socket() { return instance().m_socket; } signals: void errorOccurred(const ErrorInfo &error); private: LauncherInterface(); void doStart(); void doStop(); void handleNewConnection(); void handleProcessError(); void handleProcessFinished(); void handleProcessStderr(); QLocalServer * const m_server; LauncherSocket * const m_socket; LauncherProcess * m_process = nullptr; int m_startRequests = 0; }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/tools/processutils.cpp0000644000175100017510000001110215154533055022054 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "processutils.h" #if defined(Q_OS_WIN) # define PSAPI_VERSION 1 // To use GetModuleFileNameEx from Psapi.lib on all Win versions. # include # include #elif defined(Q_OS_DARWIN) # include #elif defined(Q_OS_LINUX) || defined(Q_OS_HURD) # include "fileinfo.h" # include # include #elif defined(Q_OS_BSD4) # include # include # include # include # if !defined(Q_OS_NETBSD) # include # endif #else # error Missing implementation of processNameByPid for this platform. #endif namespace qbs { namespace Internal { QString processNameByPid(qint64 pid) { #if defined(Q_OS_WIN) HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, DWORD(pid)); if (!hProcess) return {}; wchar_t buf[UNICODE_STRING_MAX_CHARS]; const DWORD length = GetModuleFileNameEx(hProcess, NULL, buf, sizeof(buf) / sizeof(wchar_t)); CloseHandle(hProcess); if (!length) return {}; QString name = QString::fromWCharArray(buf, length); int i = name.lastIndexOf(QLatin1Char('\\')); if (i >= 0) name.remove(0, i + 1); i = name.lastIndexOf(QLatin1Char('.')); if (i >= 0) name.truncate(i); return name; #elif defined(Q_OS_DARWIN) char name[1024]; proc_name(pid, name, sizeof(name) / sizeof(char)); return QString::fromUtf8(name); #elif defined(Q_OS_LINUX) || defined(Q_OS_HURD) char exePath[64]; #ifdef PATH_MAX char buf[PATH_MAX]; #else char buf[4096]; #endif memset(buf, 0, sizeof(buf)); std::sprintf(exePath, "/proc/%lld/exe", pid); if (readlink(exePath, buf, sizeof(buf)) < 0) return {}; return FileInfo::fileName(QString::fromUtf8(buf)); #elif defined(Q_OS_BSD4) # if defined(Q_OS_NETBSD) struct kinfo_proc2 kp; int mib[6] = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, (int)pid, sizeof(struct kinfo_proc2), 1 }; # elif defined(Q_OS_OPENBSD) struct kinfo_proc kp; int mib[6] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid, sizeof(struct kinfo_proc), 1 }; # else struct kinfo_proc kp; int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid }; # endif size_t len = sizeof(kp); u_int mib_len = sizeof(mib)/sizeof(u_int); if (sysctl(mib, mib_len, &kp, &len, NULL, 0) < 0) return {}; # if defined(Q_OS_OPENBSD) || defined(Q_OS_NETBSD) if (kp.p_pid != pid) return {}; QString name = QFile::decodeName(kp.p_comm); # else if (kp.ki_pid != pid) return {}; QString name = QFile::decodeName(kp.ki_comm); # endif return name; #else Q_UNUSED(pid); return {}; #endif } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/progressobserver.h0000644000175100017510000000557215154533055022414 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROGRESSOBSERVER_H #define QBS_PROGRESSOBSERVER_H #include #include QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE namespace qbs { namespace Internal { class ScriptEngine; class ProgressObserver { public: virtual ~ProgressObserver() = default; virtual void initialize(const QString &task, int maximum) = 0; virtual void setProgressValue(int value) = 0; virtual int progressValue() = 0; virtual bool canceled() const = 0; virtual void setMaximum(int maximum) = 0; virtual int maximum() const = 0; void incrementProgressValue(int increment = 1); // Call this to ensure that the progress bar always goes to 100%. void setFinished(); void addScriptEngine(ScriptEngine *engine) { m_scriptEngines.push_back(engine); } protected: const std::vector &scriptEngines() const { return m_scriptEngines; } private: std::vector m_scriptEngines; }; } // namespace Internal } // namespace qbs #endif // QBS_PROGRESSOBSERVER_H qbs-src-3.2.0/src/lib/corelib/tools/profile.h0000644000175100017510000000751015154533055020432 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROFILE_H #define QBS_PROFILE_H #include "qbs_export.h" #include #include #include namespace qbs { class ErrorInfo; class Settings; class QBS_EXPORT Profile { public: Profile(QString name, Settings *settings, QVariantMap profiles = QVariantMap()); bool exists() const; QVariant value(const QString &key, const QVariant &defaultValue = QVariant(), ErrorInfo *error = nullptr) const; void setValue(const QString &key, const QVariant &value); void remove(const QString &key); QString name() const; QString baseProfile() const; void setBaseProfile(const QString &baseProfile); void removeBaseProfile(); void removeProfile(); enum KeySelection { KeySelectionRecursive, KeySelectionNonRecursive }; QStringList allKeys(KeySelection selection, ErrorInfo *error = nullptr) const; static QString cleanName(const QString &name); static QString fallbackName() { return QStringLiteral("none"); } private: static QString baseProfileKey(); void checkBaseProfileExistence(const Profile &baseProfile) const; QString profileKey() const; QVariant localValue(const QString &key) const; QString fullyQualifiedKey(const QString &key) const; QVariant possiblyInheritedValue(const QString &key, const QVariant &defaultValue, QStringList profileChain) const; QStringList allKeysInternal(KeySelection selection, QStringList profileChain) const; void extendAndCheckProfileChain(QStringList &chain) const; QString m_name; Settings *m_settings; QVariantMap m_values; QVariantMap m_profiles; }; namespace Internal { // Exported for autotests. class QBS_EXPORT TemporaryProfile { public: TemporaryProfile(const QString &name, Settings *settings) : p(name, settings) {} ~TemporaryProfile() { p.removeProfile(); } Profile p; }; } // namespace Internal } // namespace qbs #endif // Header guard qbs-src-3.2.0/src/lib/corelib/tools/stringconstants.h0000644000175100017510000003127515154533055022242 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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_STRINGCONSTANTS_H #define QBS_STRINGCONSTANTS_H #include #define QBS_CONSTANT(type, name, value) \ static const type &name() { \ static const type var{QLatin1String(value)}; \ return var; \ } #define QBS_STRING_CONSTANT(name, value) QBS_CONSTANT(QString, name, value) #define QBS_STRINGLIST_CONSTANT(name, value) QBS_CONSTANT(QStringList, name, value) namespace qbs { namespace Internal { class StringConstants { public: static const QString &cppModule() { return cpp(); } static const QString &qbsModule() { return qbs(); } QBS_STRING_CONSTANT(aggregateProperty, "aggregate") QBS_STRING_CONSTANT(additionalProductTypesProperty, "additionalProductTypes") QBS_STRING_CONSTANT(allowedValuesProperty, "allowedValues") QBS_STRING_CONSTANT(alwaysUpdatedProperty, "alwaysUpdated") QBS_STRING_CONSTANT(alwaysRunProperty, "alwaysRun") QBS_STRING_CONSTANT(artifactsProperty, "artifacts") QBS_STRING_CONSTANT(auxiliaryInputsProperty, "auxiliaryInputs") QBS_STRING_CONSTANT(auxiliaryInputsFromDependenciesProperty, "auxiliaryInputsFromDependencies") QBS_STRING_CONSTANT(baseNameProperty, "baseName") QBS_STRING_CONSTANT(baseProfileProperty, "baseProfile") QBS_STRING_CONSTANT(buildDirectoryProperty, "buildDirectory") QBS_STRING_CONSTANT(buildDirectoryKey, "build-directory") QBS_STRING_CONSTANT(builtByDefaultProperty, "builtByDefault") QBS_STRING_CONSTANT(classNameProperty, "className") QBS_STRING_CONSTANT(completeBaseNameProperty, "completeBaseName") QBS_STRING_CONSTANT(conditionProperty, "condition") QBS_STRING_CONSTANT(configurationNameProperty, "configurationName") QBS_STRING_CONSTANT(configureProperty, "configure") QBS_STRING_CONSTANT(consoleApplicationProperty, "consoleApplication") QBS_STRING_CONSTANT(dependenciesProperty, "dependencies") QBS_STRING_CONSTANT(descriptionProperty, "description") QBS_STRING_CONSTANT(destinationDirProperty, "destinationDirectory") QBS_STRING_CONSTANT(excludeFilesProperty, "excludeFiles") QBS_STRING_CONSTANT(excludedAuxiliaryInputsProperty, "excludedAuxiliaryInputs") QBS_STRING_CONSTANT(excludedInputsProperty, "excludedInputs") static const QString &explicitlyDependsOnProperty() { return explicitlyDependsOn(); } static const QString &explicitlyDependsOnFromDependenciesProperty() { return explicitlyDependsOnFromDependencies(); } static const QString &fileNameProperty() { return fileName(); } static const QString &filePathProperty() { return filePath(); } static const QString &filePathVar() { return filePath(); } QBS_STRING_CONSTANT(filePathKey, "file-path") QBS_STRING_CONSTANT(fileTagsFilterProperty, "fileTagsFilter") QBS_STRING_CONSTANT(fileTagsProperty, "fileTags") QBS_STRING_CONSTANT(filesProperty, "files") QBS_STRING_CONSTANT(filesAreTargetsProperty, "filesAreTargets") QBS_STRING_CONSTANT(foundProperty, "found") QBS_STRING_CONSTANT(fullDisplayNameKey, "full-display-name") QBS_STRING_CONSTANT(imports, "imports") static const QString &importsDir() { return imports(); } static const QString &importsProperty() { return imports(); } QBS_STRING_CONSTANT(inheritPropertiesProperty, "inheritProperties") static const QString &inputsProperty() { return inputs(); } QBS_STRING_CONSTANT(inputsFromDependenciesProperty, "inputsFromDependencies") static const QString &installProperty() { return install(); } QBS_STRING_CONSTANT(installRootProperty, "installRoot") QBS_STRING_CONSTANT(installPrefixProperty, "installPrefix") QBS_STRING_CONSTANT(installDirProperty, "installDir") QBS_STRING_CONSTANT(installSourceBaseProperty, "installSourceBase") QBS_STRING_CONSTANT(isEnabledKey, "is-enabled") QBS_STRING_CONSTANT(isEagerProperty, "isEager") QBS_STRING_CONSTANT(jobCountProperty, "jobCount") QBS_STRING_CONSTANT(jobPoolProperty, "jobPool") QBS_STRING_CONSTANT(lengthProperty, "length") QBS_STRING_CONSTANT(limitToSubProjectProperty, "limitToSubProject") QBS_STRING_CONSTANT(locationKey, "location") QBS_STRING_CONSTANT(messageKey, "message") QBS_STRING_CONSTANT(minimalProperty, "minimal") QBS_STRING_CONSTANT(minimumQbsVersionProperty, "minimumQbsVersion") QBS_STRING_CONSTANT(moduleVar, "module") QBS_STRING_CONSTANT(moduleNameProperty, "moduleName") QBS_STRING_CONSTANT(modulePropertiesKey, "module-properties") QBS_STRING_CONSTANT(moduleProviders, "moduleProviders") QBS_STRING_CONSTANT(multiplexByQbsPropertiesProperty, "multiplexByQbsProperties") QBS_STRING_CONSTANT(multiplexConfigurationIdProperty, "multiplexConfigurationId") QBS_STRING_CONSTANT(multiplexConfigurationIdsProperty, "multiplexConfigurationIds") QBS_STRING_CONSTANT(multiplexProperty, "multiplex") QBS_STRING_CONSTANT(multiplexedProperty, "multiplexed") QBS_STRING_CONSTANT(multiplexedTypeProperty, "multiplexedType") QBS_STRING_CONSTANT(nameProperty, "name") QBS_STRING_CONSTANT(outputArtifactsProperty, "outputArtifacts") QBS_STRING_CONSTANT(outputFileTagsProperty, "outputFileTags") QBS_STRING_CONSTANT(overrideTagsProperty, "overrideTags") QBS_STRING_CONSTANT(overrideListPropertiesProperty, "overrideListProperties") QBS_STRING_CONSTANT(parametersProperty, "parameters") static const QString &pathProperty() { return path(); } QBS_STRING_CONSTANT(patternsProperty, "patterns") QBS_STRING_CONSTANT(prefixMappingProperty, "prefixMapping") QBS_STRING_CONSTANT(prefixProperty, "prefix") QBS_STRING_CONSTANT(prepareProperty, "prepare") QBS_STRING_CONSTANT(presentProperty, "present") QBS_STRING_CONSTANT(priorityProperty, "priority") QBS_STRING_CONSTANT(profileProperty, "profile") static const QString &profilesProperty() { return profiles(); } QBS_STRING_CONSTANT(productTypesProperty, "productTypes") QBS_STRING_CONSTANT(productsKey, "products") QBS_STRING_CONSTANT(qbsModuleProviders, "qbsModuleProviders") QBS_STRING_CONSTANT(qbsSearchPathsProperty, "qbsSearchPaths") QBS_STRING_CONSTANT(referencesProperty, "references") QBS_STRING_CONSTANT(recursiveProperty, "recursive") QBS_STRING_CONSTANT(requiredProperty, "required") QBS_STRING_CONSTANT(requiresInputsProperty, "requiresInputs") QBS_STRING_CONSTANT(removalVersionProperty, "removalVersion") QBS_STRING_CONSTANT(scanProperty, "scan") QBS_STRING_CONSTANT(searchPathsProperty, "searchPaths") QBS_STRING_CONSTANT(setupBuildEnvironmentProperty, "setupBuildEnvironment") QBS_STRING_CONSTANT(setupRunEnvironmentProperty, "setupRunEnvironment") QBS_STRING_CONSTANT(shadowProductPrefix, "__shadow__") QBS_STRING_CONSTANT(sourceCodeProperty, "sourceCode") QBS_STRING_CONSTANT(sourceDirectoryProperty, "sourceDirectory") QBS_STRING_CONSTANT(submodulesProperty, "submodules") QBS_STRING_CONSTANT(targetNameProperty, "targetName") static const QString &typeProperty() { return type(); } QBS_STRING_CONSTANT(type, "type") QBS_STRING_CONSTANT(validateProperty, "validate") QBS_STRING_CONSTANT(versionProperty, "version") QBS_STRING_CONSTANT(versionAtLeastProperty, "versionAtLeast") QBS_STRING_CONSTANT(versionBelowProperty, "versionBelow") QBS_STRING_CONSTANT(importScopeNamePropertyInternal, "_qbs_importScopeName") QBS_STRING_CONSTANT(modulePropertyInternal, "__module") QBS_STRING_CONSTANT(dataPropertyInternal, "_qbs_data") static const char *qbsProcEnvVarInternal() { return "_qbs_procenv"; } static const QString &projectPrefix() { return project(); } static const QString &productValue() { return product(); } QBS_STRING_CONSTANT(projectsOverridePrefix, "projects.") QBS_STRING_CONSTANT(productsOverridePrefix, "products.") QBS_STRING_CONSTANT(baseVar, "base") static const QString &explicitlyDependsOnVar() { return explicitlyDependsOn(); } QBS_STRING_CONSTANT(inputVar, "input") static const QString &inputsVar() { return inputs(); } QBS_STRING_CONSTANT(originalVar, "original") QBS_STRING_CONSTANT(outerVar, "outer") QBS_STRING_CONSTANT(outputVar, "output") QBS_STRING_CONSTANT(outputsVar, "outputs") static const QString &productVar() { return product(); } static const QString &projectVar() { return project(); } static const QString &filePathGlobalVar() { return filePath(); } static const QString &pathGlobalVar() { return path(); } static const QString &pathType() { return path(); } static const QString &fileInfoFileName() { return fileName(); } static const QString &fileInfoPath() { return path(); } static const QString &androidInstallCommand() { return install(); } static const QString &simctlInstallCommand() { return install(); } static const QString &profilesSettingsKey() { return profiles(); } QBS_STRING_CONSTANT(emptyArrayValue, "[]") QBS_STRING_CONSTANT(falseValue, "false") QBS_STRING_CONSTANT(trueValue, "true") QBS_STRING_CONSTANT(undefinedValue, "undefined") QBS_STRING_CONSTANT(javaScriptCommandType, "JavaScriptCommand") QBS_STRING_CONSTANT(commandType, "Command") QBS_STRING_CONSTANT(pathEnvVar, "PATH") QBS_STRING_CONSTANT(dot, ".") QBS_STRING_CONSTANT(dotDot, "..") QBS_STRING_CONSTANT(slashDotDot, "/..") QBS_STRING_CONSTANT(star, "*") QBS_STRING_CONSTANT(tildeSlash, "~/") QBS_STRINGLIST_CONSTANT(qbsFileWildcards, "*.qbs") QBS_STRINGLIST_CONSTANT(jsFileWildcards, "*.js") static const QString &cppLang() { return cpp(); } QBS_STRING_CONSTANT(xcode, "xcode") QBS_STRING_CONSTANT(aarch64Arch, "aarch64") QBS_STRING_CONSTANT(amd64Arch, "amd64") QBS_STRING_CONSTANT(armArch, "arm") QBS_STRING_CONSTANT(arm64Arch, "arm64") QBS_STRING_CONSTANT(armv7Arch, "armv7") QBS_STRING_CONSTANT(i386Arch, "i386") QBS_STRING_CONSTANT(i586Arch, "i586") QBS_STRING_CONSTANT(mipsArch, "mips") QBS_STRING_CONSTANT(mips64Arch, "mips64") QBS_STRING_CONSTANT(powerPcArch, "powerpc") QBS_STRING_CONSTANT(ppcArch, "ppc") QBS_STRING_CONSTANT(ppc64Arch, "ppc64") QBS_STRING_CONSTANT(x86Arch, "x86") QBS_STRING_CONSTANT(x86_64Arch, "x86_64") QBS_STRING_CONSTANT(profilesSettingsPrefix, "profiles.") private: QBS_STRING_CONSTANT(cpp, "cpp") QBS_STRING_CONSTANT(explicitlyDependsOn, "explicitlyDependsOn") QBS_STRING_CONSTANT(explicitlyDependsOnFromDependencies, "explicitlyDependsOnFromDependencies") QBS_STRING_CONSTANT(fileName, "fileName") QBS_STRING_CONSTANT(filePath, "filePath") QBS_STRING_CONSTANT(inputs, "inputs") QBS_STRING_CONSTANT(install, "install") QBS_STRING_CONSTANT(path, "path") QBS_STRING_CONSTANT(product, "product") QBS_STRING_CONSTANT(profiles, "profiles") QBS_STRING_CONSTANT(project, "project") QBS_STRING_CONSTANT(qbs, "qbs") }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/tools/shellutils.cpp0000644000175100017510000002071515154533055021517 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Petroules Corporation. ** 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$ ** ****************************************************************************/ #include "shellutils.h" #include "pathutils.h" #include "qttools.h" #include #include #include namespace qbs { namespace Internal { QString shellInterpreter(const QString &filePath) { QFile file(filePath); if (file.open(QIODevice::ReadOnly)) { QTextStream ts(&file); const QString shebang = ts.readLine(); if (shebang.startsWith(QLatin1String("#!"))) { return (shebang.mid(2).split(QRegularExpression(QStringLiteral("\\s")), Qt::SkipEmptyParts) << QString()).front(); } } return {}; } // isSpecialChar, hasSpecialChars, shellQuoteUnix, shellQuoteWin: // all from qtbase/qmake/library/ioutils.cpp inline static bool isSpecialChar(ushort c, const uchar (&iqm)[16]) { return (c < sizeof(iqm) * 8) && (iqm[c / 8] & (1 << (c & 7))); } inline static bool hasSpecialChars(const QString &arg, const uchar (&iqm)[16]) { for (auto it = arg.crbegin(), end = arg.crend(); it != end; ++it) { if (isSpecialChar(it->unicode(), iqm)) return true; } return false; } static QString shellQuoteUnix(const QString &arg) { // Chars that should be quoted (TM). This includes: static const uchar iqm[] = { 0xff, 0xff, 0xff, 0xff, 0xdf, 0x07, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x78 }; // 0-32 \'"$`<>|;&(){}*?#!~[] if (!arg.length()) return QStringLiteral("''"); QString ret(arg); if (hasSpecialChars(ret, iqm)) { ret.replace(QLatin1Char('\''), QLatin1String("'\\''")); ret.prepend(QLatin1Char('\'')); ret.append(QLatin1Char('\'')); } return ret; } static QString shellQuoteWin(const QString &arg) { // Chars that should be quoted (TM). This includes: // - control chars & space // - the shell meta chars "&()<>^| // - the potential separators ,;= static const uchar iqm[] = { 0xff, 0xff, 0xff, 0xff, 0x45, 0x13, 0x00, 0x78, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10 }; // Shell meta chars that need escaping. static const uchar ism[] = { 0x00, 0x00, 0x00, 0x00, 0x40, 0x03, 0x00, 0x50, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10 }; // &()<>^| if (!arg.length()) return QStringLiteral("\"\""); QString ret(arg); if (hasSpecialChars(ret, iqm)) { // The process-level standard quoting allows escaping quotes with backslashes (note // that backslashes don't escape themselves, unless they are followed by a quote). // Consequently, quotes are escaped and their preceding backslashes are doubled. ret.replace(QRegularExpression(QLatin1String("(\\\\*)\"")), QLatin1String("\\1\\1\\\"")); // Trailing backslashes must be doubled as well, as they are followed by a quote. ret.replace(QRegularExpression(QLatin1String("(\\\\+)$")), QLatin1String("\\1\\1")); // However, the shell also interprets the command, and no backslash-escaping exists // there - a quote always toggles the quoting state, but is nonetheless passed down // to the called process verbatim. In the unquoted state, the circumflex escapes // meta chars (including itself and quotes), and is removed from the command. bool quoted = true; for (int i = 0; i < ret.length(); i++) { QChar c = ret.unicode()[i]; if (c.unicode() == '"') quoted = !quoted; else if (!quoted && isSpecialChar(c.unicode(), ism)) ret.insert(i++, QLatin1Char('^')); } if (!quoted) ret.append(QLatin1Char('^')); ret.append(QLatin1Char('"')); ret.prepend(QLatin1Char('"')); } return ret; } QString shellQuote(const QString &arg, HostOsInfo::HostOs os) { return os == HostOsInfo::HostOsWindows ? shellQuoteWin(arg) : shellQuoteUnix(arg); } std::string shellQuote(const std::string &arg, HostOsInfo::HostOs os) { return shellQuote(QString::fromStdString(arg), os).toStdString(); } QString shellQuote(const QStringList &args, HostOsInfo::HostOs os) { QString result; if (!args.empty()) { result += shellQuote(args.at(0), os); for (int i = 1; i < args.size(); ++i) result += QLatin1Char(' ') + shellQuote(args.at(i), os); } return result; } std::string shellQuote(const std::vector &args, HostOsInfo::HostOs os) { std::string result; if (!args.empty()) { auto it = args.cbegin(); const auto end = args.cend(); result += shellQuote(*it++, os); for (; it != end; ++it) { result.push_back(' '); result.append(shellQuote(*it, os)); } } return result; } QString shellQuote(const QString &program, const QStringList &args, HostOsInfo::HostOs os) { QString result = shellQuote(program, os); if (!args.empty()) result += QLatin1Char(' ') + shellQuote(args, os); return result; } void CommandLine::setProgram(const QString &program, bool raw) { m_program = program; m_isRawProgram = raw; } void CommandLine::setProgram(const std::string &program, bool raw) { m_program = QString::fromStdString(program); m_isRawProgram = raw; } void CommandLine::appendArgument(const QString &value) { m_arguments.emplace_back(value); } void CommandLine::appendArgument(const std::string &value) { m_arguments.emplace_back(QString::fromStdString(value)); } void CommandLine::appendArguments(const QList &args) { for (const QString &arg : args) appendArgument(arg); } void CommandLine::appendRawArgument(const QString &value) { Argument arg(value); arg.shouldQuote = false; m_arguments.push_back(arg); } void CommandLine::appendRawArgument(const std::string &value) { appendRawArgument(QString::fromStdString(value)); } void CommandLine::appendPathArgument(const QString &value) { Argument arg(value); arg.isFilePath = true; m_arguments.push_back(arg); } void CommandLine::clearArguments() { m_arguments.clear(); } QString CommandLine::toCommandLine(HostOsInfo::HostOs os) const { QString result = PathUtils::toNativeSeparators(m_program, os); if (!m_isRawProgram) result = shellQuote(result, os); for (const Argument &arg : m_arguments) { const QString value = arg.isFilePath ? PathUtils::toNativeSeparators(arg.value, os) : arg.value; result += QLatin1Char(' ') + (arg.shouldQuote ? shellQuote(value, os) : value); } return result; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/set.h0000644000175100017510000003211015154533055017557 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SET_H #define QBS_SET_H #include #include #include #ifdef QT_CORE_LIB #include #include #endif #include #include #include #include #include #include namespace qbs { namespace Internal { template class Set; template Set operator&(const Set &set1, const Set &set2); template Set operator-(const Set &set1, const Set &set2); namespace helper { template struct SortAfterLoad { static const bool required = false; }; template struct SortAfterLoad { static const bool required = true; }; template struct SortAfterLoad> { static const bool required = true; }; } template class Set { public: using const_iterator = typename std::vector::const_iterator; using iterator = typename std::vector::iterator; using reverse_iterator = typename std::vector::reverse_iterator; using const_reverse_iterator = typename std::vector::const_reverse_iterator; using size_type = typename std::vector::size_type; using value_type = T; using difference_type = typename std::vector::difference_type; using pointer = typename std::vector::pointer; using const_pointer = typename std::vector::const_pointer; using reference = typename std::vector::reference; using const_reference = typename std::vector::const_reference; iterator begin() { return m_data.begin(); } iterator end() { return m_data.end(); } reverse_iterator rbegin() { return m_data.rbegin(); } reverse_iterator rend() { return m_data.rend(); } const_reverse_iterator rbegin() const { return m_data.rbegin(); } const_reverse_iterator rend() const { return m_data.rend(); } const_reverse_iterator crbegin() const { return m_data.crbegin(); } const_reverse_iterator crend() const { return m_data.crend(); } const_iterator begin() const { return m_data.begin(); } const_iterator end() const { return m_data.end(); } const_iterator cbegin() const { return m_data.cbegin(); } const_iterator cend() const { return m_data.cend(); } const_iterator constBegin() const { return m_data.cbegin(); } const_iterator constEnd() const { return m_data.cend(); } Set() = default; Set(const std::initializer_list &list); template Set(InputIterator first, InputIterator last); Set &unite(const Set &other); Set &operator+=(const Set &other) { return unite(other); } Set &operator|=(const Set &other) { return unite(other); } Set &subtract(const Set &other); Set &operator-=(const Set &other) { return subtract(other); } Set &intersect(const Set &other); Set &operator&=(const Set &other) { return intersect(other); } Set &operator&=(const T &v) { return intersect(Set{ v }); } iterator find(const T &v) { return binaryFind(m_data.begin(), m_data.end(), v); } const_iterator find(const T &v) const { return binaryFind(m_data.cbegin(), m_data.cend(), v); } std::pair insert(const T &v); Set &operator+=(const T &v) { insert(v); return *this; } Set &operator|=(const T &v) { return operator+=(v); } Set &operator<<(const T &v) { return operator+=(v); } bool contains(const T &v) const { return std::binary_search(cbegin(), cend(), v); } bool contains(const Set &other) const; bool empty() const { return m_data.empty(); } size_type size() const { return m_data.size(); } size_type capacity() const { return m_data.capacity(); } bool intersects(const Set &other) const; bool remove(const T &v); void operator-=(const T &v) { remove(v); } iterator erase(iterator it) { return m_data.erase(it); } iterator erase(iterator first, iterator last) { return m_data.erase(first, last); } void clear() { m_data.clear(); } void reserve(size_type size) { m_data.reserve(size); } void swap(Set &other) { m_data.swap(other.m_data); } void load(PersistentPool &pool); void store(PersistentPool &pool) const; #ifdef QT_CORE_LIB QStringList toStringList() const; QString toString(const T& value) const { return value.toString(); } QString toString() const; #endif template static Set filtered(const Set &s); bool operator==(const Set &other) const { return m_data == other.m_data; } bool operator!=(const Set &other) const { return m_data != other.m_data; } private: friend Set operator&<>(const Set &set1, const Set &set2); friend Set operator-<>(const Set &set1, const Set &set2); void sort() { std::sort(m_data.begin(), m_data.end()); } T loadElem(PersistentPool &pool) { return pool.load(); } void storeElem(PersistentPool &pool, const T &v) const { pool.store(v); } bool sortAfterLoadRequired() const { return helper::SortAfterLoad::required; } iterator asMutableIterator(const_iterator cit); std::vector m_data; }; template Set::Set(const std::initializer_list &list) : m_data(list) { sort(); const auto last = std::unique(m_data.begin(), m_data.end()); m_data.erase(last, m_data.end()); } template template Set::Set(InputIterator first, InputIterator last) { reserveIfForwardIterator(&m_data, first, last); std::copy(first, last, std::back_inserter(m_data)); sort(); } template Set &Set::intersect(const Set &other) { auto it = begin(); auto otherIt = other.cbegin(); while (it != end()) { if (otherIt == other.cend()) { m_data.erase(it, end()); break; } if (*it < *otherIt) { it = erase(it); continue; } if (!(*otherIt < *it)) ++it; ++otherIt; } return *this; } template std::pair::iterator, bool> Set::insert(const T &v) { const auto it = std::lower_bound(m_data.begin(), m_data.end(), v); if (it == m_data.end() || v < *it) return std::make_pair(m_data.insert(it, v), true); return std::make_pair(it, false); } template bool Set::contains(const Set &other) const { auto it = cbegin(); auto otherIt = other.cbegin(); while (otherIt != other.cend()) { if (it == cend() || *otherIt < *it) return false; if (!(*it < *otherIt)) ++otherIt; ++it; } return true; } template bool Set::intersects(const Set &other) const { auto it = cbegin(); auto itOther = other.cbegin(); while (it != cend() && itOther != other.cend()) { if (*it < *itOther) ++it; else if (*itOther < *it) ++itOther; else return true; } return false; } template Set &Set::unite(const Set &other) { if (other.empty()) return *this; if (empty()) { m_data = other.m_data; return *this; } auto lowerBound = m_data.begin(); for (auto otherIt = other.cbegin(); otherIt != other.cend(); ++otherIt) { lowerBound = std::lower_bound(lowerBound, m_data.end(), *otherIt); if (lowerBound == m_data.end()) { m_data.reserve(size() + std::distance(otherIt, other.cend())); std::copy(otherIt, other.cend(), std::back_inserter(m_data)); return *this; } if (*otherIt < *lowerBound) lowerBound = m_data.insert(lowerBound, *otherIt); } return *this; } template bool Set::remove(const T &v) { const auto it = std::lower_bound(m_data.cbegin(), m_data.cend(), v); if (it != m_data.cend() && !(v < *it)) { m_data.erase(asMutableIterator(it)); return true; } return false; } template void Set::load(PersistentPool &pool) { clear(); int i = pool.load(); reserve(i); for (; --i >= 0;) m_data.push_back(loadElem(pool)); if (sortAfterLoadRequired()) sort(); } template void Set::store(PersistentPool &pool) const { pool.store(static_cast(size())); std::for_each(m_data.cbegin(), m_data.cend(), std::bind(&Set::storeElem, this, std::ref(pool), std::placeholders::_1)); } #ifdef QT_CORE_LIB template QStringList Set::toStringList() const { return transformed(*this, [this](const T &e) { return toString(e); }); } template QString Set::toString() const { return QLatin1Char('[') + toStringList().join(QLatin1String(", ")) + QLatin1Char(']'); } template<> inline QString Set::toString(const QString &value) const { return value; } #endif template typename Set::iterator Set::asMutableIterator(typename Set::const_iterator cit) { const auto offset = std::distance(cbegin(), cit); return begin() + offset; } template template Set Set::filtered(const Set &s) { static_assert(std::is_pointer_v, "Set::filtered() assumes pointer types"); static_assert(std::is_pointer_v, "Set::filtered() assumes pointer types"); Set filteredSet; for (auto &u : s) { if (hasDynamicType>(u)) filteredSet.m_data.push_back(static_cast(u)); } return filteredSet; } template Set &Set::subtract(const Set &other) { if (empty() || other.empty()) return *this; auto lowerBound = m_data.begin(); for (auto otherIt = other.cbegin(); otherIt != other.cend(); ++otherIt) { lowerBound = std::lower_bound(lowerBound, m_data.end(), *otherIt); if (lowerBound == m_data.end()) return *this; if (!(*otherIt < *lowerBound)) lowerBound = m_data.erase(lowerBound); } return *this; } template Set operator+(const Set &set1, const Set &set2) { Set result = set1; return result += set2; } template Set operator|(const Set &set1, const Set &set2) { return set1 + set2; } template Set operator-(const Set &set1, const Set &set2) { if (set1.empty() || set2.empty()) return set1; Set result; auto it1 = set1.cbegin(); auto it2 = set2.cbegin(); while (it1 != set1.cend()) { if (it2 == set2.cend()) { std::copy(it1, set1.cend(), std::back_inserter(result.m_data)); break; } if (*it1 < *it2) { result.m_data.push_back(*it1++); } else if (*it2 < *it1) { ++it2; } else { ++it1; ++it2; } } return result; } template Set operator&(const Set &set1, const Set &set2) { Set result; auto it1 = set1.cbegin(); auto it2 = set2.cbegin(); while (it1 != set1.cend() && it2 != set2.cend()) { if (*it1 < *it2) { ++it1; continue; } if (*it2 < *it1) { ++it2; continue; } result.m_data.push_back(*it1); ++it1; ++it2; } return result; } } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/tools/projectgeneratormanager.h0000644000175100017510000000515715154533055023707 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** 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_PROJECTGENERATORMANAGER_H #define QBS_PROJECTGENERATORMANAGER_H #include #include #include #include namespace qbs { class ProjectGenerator; class QBS_EXPORT ProjectGeneratorManager { public: ~ProjectGeneratorManager(); static ProjectGeneratorManager *instance(); static QStringList loadedGeneratorNames(); static std::shared_ptr findGenerator(const QString &generatorName); static void registerGenerator(const std::shared_ptr &generator); private: ProjectGeneratorManager(); private: QMap > m_generators; }; } // namespace qbs #endif qbs-src-3.2.0/src/lib/corelib/tools/codelocation.h0000644000175100017510000001346015154533055021436 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SOURCELOCATION_H #define QBS_SOURCELOCATION_H #include "qbs_export.h" #include #include QT_BEGIN_NAMESPACE class QDataStream; class QJsonObject; class QString; QT_END_NAMESPACE namespace qbs { namespace Internal { class PersistentPool; } class QBS_EXPORT CodeLocation { friend QBS_EXPORT bool operator==(const CodeLocation &cl1, const CodeLocation &cl2); public: CodeLocation() = default; explicit CodeLocation( const QString &aFilePath, int aLine = -1, int aColumn = -1, bool checkPath = true); const QString &filePath() const noexcept { return m_filePath; } int line() const noexcept { return m_line; } int column() const noexcept { return m_column; } bool isValid() const noexcept { return !m_filePath.isEmpty(); } QString toString() const; QJsonObject toJson() const; void load(Internal::PersistentPool &pool); void store(Internal::PersistentPool &pool) const; private: QString m_filePath; int m_line = 0; int m_column = 0; }; QBS_EXPORT bool operator==(const CodeLocation &cl1, const CodeLocation &cl2); QBS_EXPORT bool operator!=(const CodeLocation &cl1, const CodeLocation &cl2); QBS_EXPORT bool operator<(const CodeLocation &cl1, const CodeLocation &cl2); inline auto qHash(const CodeLocation &cl) { return qHash(cl.toString()); } QDebug operator<<(QDebug debug, const CodeLocation &location); class QBS_EXPORT CodePosition { public: CodePosition(int line, int column) : m_line(line), m_column(column) {} CodePosition() = default; CodePosition(const CodePosition &other) = default; CodePosition(CodePosition &&other) = default; CodePosition &operator=(const CodePosition &other) = default; CodePosition &operator=(CodePosition &&other) = default; int line() const { return m_line; } void setLine(int newLine) { m_line = newLine; } int column() const { return m_column; } void setColumn(int newColumn) { m_column = newColumn; } void load(Internal::PersistentPool &pool); void store(Internal::PersistentPool &pool) const; private: int m_line = 0; int m_column = 0; }; QBS_EXPORT bool operator==(const CodePosition &pos1, const CodePosition &pos2); QBS_EXPORT bool operator!=(const CodePosition &pos1, const CodePosition &pos2); QBS_EXPORT bool operator<(const CodePosition &pos1, const CodePosition &pos2); QBS_EXPORT bool operator>(const CodePosition &pos1, const CodePosition &pos2); QBS_EXPORT bool operator<=(const CodePosition &pos1, const CodePosition &pos2); QBS_EXPORT bool operator>=(const CodePosition &pos1, const CodePosition &pos2); inline auto qHash(const CodePosition &pos) { return QT_PREPEND_NAMESPACE(qHash)(pos.line()) ^ QT_PREPEND_NAMESPACE(qHash)(pos.column()); } class QBS_EXPORT CodeRange { public: CodeRange(const CodePosition &start, const CodePosition &end); CodeRange() = default; CodeRange(const CodeRange &other) = default; CodeRange(CodeRange &&other) = default; CodeRange &operator=(const CodeRange &other) = default; CodeRange &operator=(CodeRange &&other) = default; const CodePosition &start() const & { return m_start; } const CodePosition &end() const & { return m_end; } CodePosition start() && { return std::move(m_start); } CodePosition end() && { return std::move(m_end); } bool contains(const CodePosition &pos) const; void load(Internal::PersistentPool &pool); void store(Internal::PersistentPool &pool) const; private: CodePosition m_start; CodePosition m_end; }; QBS_EXPORT bool operator==(const CodeRange &r1, const CodeRange &r2); QBS_EXPORT bool operator!=(const CodeRange &r1, const CodeRange &r2); QBS_EXPORT bool operator<(const CodeRange &r1, const CodeRange &r2); inline auto qHash(const CodeRange &range) { return qHash(range.start()) ^ qHash(range.end()); } using CodeLinksInFile = QHash>; using CodeLinks = QHash; } // namespace qbs #endif // QBS_SOURCELOCATION_H qbs-src-3.2.0/src/lib/corelib/tools/clangclinfo.h0000644000175100017510000000431315154533055021247 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_CLANGCLINFO_H #define QBS_CLANGCLINFO_H #include "logging/logger.h" #include #include namespace qbs { namespace Internal { class ClangClInfo { public: QString toolchainInstallPath; QString vcvarsallPath; bool isEmpty() const { return toolchainInstallPath.isEmpty() && vcvarsallPath.isEmpty(); } QBS_EXPORT QVariantMap toVariantMap() const; QBS_EXPORT static ClangClInfo fromCompilerFilePath(const QString &path, Logger &logger); QBS_EXPORT static std::vector installedCompilers( const std::vector &extraPaths, qbs::Internal::Logger &logger); }; } // namespace Internal } // namespace qbs #endif // QBS_CLANGCLINFO_H qbs-src-3.2.0/src/lib/corelib/tools/buildoptions.cpp0000644000175100017510000003324315154533055022042 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "buildoptions.h" #include "jsonhelper.h" #include #include #include namespace qbs { namespace Internal { class BuildOptionsPrivate : public QSharedData { public: BuildOptionsPrivate() : maxJobCount(0), dryRun(false), keepGoing(false), forceTimestampCheck(false), forceOutputCheck(false), logElapsedTime(false), echoMode(defaultCommandEchoMode()), install(true), removeExistingInstallation(false), onlyExecuteRules(false) { } QStringList changedFiles; QStringList filesToConsider; QStringList activeFileTags; JobLimits jobLimits; QString settingsDir; int maxJobCount; bool dryRun; bool keepGoing; bool forceTimestampCheck; bool forceOutputCheck; bool logElapsedTime; CommandEchoMode echoMode; bool install; bool removeExistingInstallation; bool onlyExecuteRules; bool jobLimitsFromProjectTakePrecedence = false; }; } // namespace Internal /*! * \class BuildOptions * \brief The \c BuildOptions class comprises parameters that influence the behavior of * build and clean operations. */ /*! * \brief Creates a \c BuildOptions object and initializes its members to sensible default values. */ BuildOptions::BuildOptions() : d(new Internal::BuildOptionsPrivate) { } BuildOptions::BuildOptions(const BuildOptions &other) = default; BuildOptions &BuildOptions::operator=(const BuildOptions &other) = default; BuildOptions::~BuildOptions() = default; /*! * \brief If non-empty, qbs pretends that only these files have changed. * By default, this list is empty. */ QStringList BuildOptions::changedFiles() const { return d->changedFiles; } /*! * \brief If the given list is empty, qbs will pretend only the listed files are changed. * \note The list elements must be absolute file paths. */ void BuildOptions::setChangedFiles(const QStringList &changedFiles) { d->changedFiles = changedFiles; } /*! * \brief The list of files to consider. * \sa setFilesToConsider. * By default, this list is empty. */ QStringList BuildOptions::filesToConsider() const { return d->filesToConsider; } /*! * \brief If the given list is non-empty, qbs will run only commands whose rule has at least one * of these files as an input. * \note The list elements must be absolute file paths. */ void BuildOptions::setFilesToConsider(const QStringList &files) { d->filesToConsider = files; } /*! * \brief The list of active file tags. * \sa setActiveFileTags */ QStringList BuildOptions::activeFileTags() const { return d->activeFileTags; } /*! * \brief Set the list of active file tags. * If this list is non-empty, then every transformer with non-matching output file tags is skipped. * E.g. call \c setFilesToConsider() with "foo.cpp" and \c setActiveFileTags() with "obj" to * run the compiler on foo.cpp without further processing like linking. * \sa activeFileTags */ void BuildOptions::setActiveFileTags(const QStringList &fileTags) { d->activeFileTags = fileTags; } /*! * \brief Returns the default value for \c maxJobCount. * This value will be used when \c maxJobCount has not been set explicitly. */ int BuildOptions::defaultMaxJobCount() { return QThread::idealThreadCount(); } /*! * \brief Returns the maximum number of build commands to run concurrently. * If the value is not valid (i.e. <= 0), a sensible one will be derived at build time * from the number of available processor cores at build time. * The default is 0. * \sa BuildOptions::defaultMaxJobCount */ int BuildOptions::maxJobCount() const { return d->maxJobCount; } /*! * \brief Controls how many build commands can be run in parallel. * A value <= 0 leaves the decision to qbs. */ void BuildOptions::setMaxJobCount(int jobCount) { d->maxJobCount = jobCount; } /*! * \brief The base directory for qbs settings. * This value is used to locate profiles and preferences. */ QString BuildOptions::settingsDirectory() const { return d->settingsDir; } /*! * \brief Sets the base directory for qbs settings. * \param settingsBaseDir Will be used to locate profiles and preferences. */ void BuildOptions::setSettingsDirectory(const QString &settingsBaseDir) { d->settingsDir = settingsBaseDir; } JobLimits BuildOptions::jobLimits() const { return d->jobLimits; } void BuildOptions::setJobLimits(const JobLimits &jobLimits) { d->jobLimits = jobLimits; } bool BuildOptions::projectJobLimitsTakePrecedence() const { return d->jobLimitsFromProjectTakePrecedence; } void BuildOptions::setProjectJobLimitsTakePrecedence(bool toggle) { d->jobLimitsFromProjectTakePrecedence = toggle; } /*! * \brief Returns true iff qbs will not actually execute any commands, but just show what * would happen. * The default is false. */ bool BuildOptions::dryRun() const { return d->dryRun; } /*! * \brief Controls whether qbs will actually build something. * If the argument is true, qbs will just emit information about what it would do. Otherwise, * the build is actually done. * \note After you build with this setting enabled, the next call to \c build() on the same * \c Project object will do nothing, since the internal state needs to be updated the same way * as if an actual build had happened. You'll need to create a new \c Project object to do * a real build afterwards. */ void BuildOptions::setDryRun(bool dryRun) { d->dryRun = dryRun; } /*! * \brief Returns true iff a build will continue after an error. * E.g. a failed compile command will result in a warning message being printed, instead of * stopping the build process right away. However, there might still be fatal errors after which the * build process cannot continue. * The default is \c false. */ bool BuildOptions::keepGoing() const { return d->keepGoing; } /*! * \brief Controls whether a qbs will try to continue building after an error has occurred. */ void BuildOptions::setKeepGoing(bool keepGoing) { d->keepGoing = keepGoing; } /*! * \brief Returns true if qbs is to use physical timestamps instead of the timestamps stored in the * build graph. * The default is \c false. */ bool BuildOptions::forceTimestampCheck() const { return d->forceTimestampCheck; } /*! * \brief Controls whether qbs should use physical timestamps for up-to-date checks. */ void BuildOptions::setForceTimestampCheck(bool enabled) { d->forceTimestampCheck = enabled; } /*! * \brief Returns true if qbs will test whether rules actually create their * declared output artifacts. * The default is \c false. */ bool BuildOptions::forceOutputCheck() const { return d->forceOutputCheck; } /*! * \brief Controls whether qbs should test whether rules actually create their * declared output artifacts. Enabling this may introduce some small I/O overhead during the build. */ void BuildOptions::setForceOutputCheck(bool enabled) { d->forceOutputCheck = enabled; } /*! * \brief Returns true iff the time the operation takes will be logged. * The default is \c false. */ bool BuildOptions::logElapsedTime() const { return d->logElapsedTime; } /*! * \brief Controls whether the build time will be measured and logged. */ void BuildOptions::setLogElapsedTime(bool log) { d->logElapsedTime = log; } /*! * \brief The kind of output that is displayed when executing commands. */ CommandEchoMode BuildOptions::echoMode() const { return d->echoMode; } /*! * \brief Controls the kind of output that is displayed when executing commands. */ void BuildOptions::setEchoMode(CommandEchoMode echoMode) { d->echoMode = echoMode; } /*! * \brief Returns true iff installation should happen as part of the build. * The default is \c true. */ bool BuildOptions::install() const { return d->install; } /*! * \brief Controls whether to install artifacts as part of the build process. */ void BuildOptions::setInstall(bool install) { d->install = install; } /*! * \brief Returns true iff an existing installation will be removed prior to building. * The default is false. */ bool BuildOptions::removeExistingInstallation() const { return d->removeExistingInstallation; } /*! * Controls whether to remove an existing installation before installing. * \note qbs may do some safety checks and refuse to remove certain directories such as * a user's home directory. You should still be careful with this option, since it * deletes recursively. */ void BuildOptions::setRemoveExistingInstallation(bool removeExisting) { d->removeExistingInstallation = removeExisting; } /*! * \brief Returns true iff instead of a full build, only the rules of the project will be run. * The default is false. */ bool BuildOptions::executeRulesOnly() const { return d->onlyExecuteRules; } /*! * If \a onlyRules is \c true, then no artifacts are built, but only rules are being executed. * \note If the project contains highly dynamic rules that depend on output artifacts of child * rules being already present, then the associated build job may fail even though * the project is perfectly valid. Callers need to take this into consideration. */ void BuildOptions::setExecuteRulesOnly(bool onlyRules) { d->onlyExecuteRules = onlyRules; } bool operator==(const BuildOptions &bo1, const BuildOptions &bo2) { return bo1.changedFiles() == bo2.changedFiles() && bo1.dryRun() == bo2.dryRun() && bo1.keepGoing() == bo2.keepGoing() && bo1.logElapsedTime() == bo2.logElapsedTime() && bo1.echoMode() == bo2.echoMode() && bo1.maxJobCount() == bo2.maxJobCount() && bo1.install() == bo2.install() && bo1.removeExistingInstallation() == bo2.removeExistingInstallation(); } namespace Internal { template<> JobLimits fromJson(const QJsonValue &limitsData) { JobLimits limits; const QJsonArray &limitsArray = limitsData.toArray(); for (const auto &value : limitsArray) { const QJsonObject limitData = value.toObject(); QString pool; int limit = 0; setValueFromJson(pool, limitData, "pool"); setValueFromJson(limit, limitData, "limit"); if (!pool.isEmpty() && limit > 0) limits.setJobLimit(pool, limit); } return limits; } template<> CommandEchoMode fromJson(const QJsonValue &modeData) { const QString modeString = modeData.toString(); if (modeString == QLatin1String("silent")) return CommandEchoModeSilent; if (modeString == QLatin1String("command-line")) return CommandEchoModeCommandLine; if (modeString == QLatin1String("command-line-with-environment")) return CommandEchoModeCommandLineWithEnvironment; return CommandEchoModeSummary; } } // namespace Internal qbs::BuildOptions qbs::BuildOptions::fromJson(const QJsonObject &data) { using namespace Internal; BuildOptions opt; setValueFromJson(opt.d->changedFiles, data, "changed-files"); setValueFromJson(opt.d->filesToConsider, data, "files-to-consider"); setValueFromJson(opt.d->activeFileTags, data, "active-file-tags"); setValueFromJson(opt.d->jobLimits, data, "job-limits"); setValueFromJson(opt.d->maxJobCount, data, "max-job-count"); setValueFromJson(opt.d->dryRun, data, "dry-run"); setValueFromJson(opt.d->keepGoing, data, "keep-going"); setValueFromJson(opt.d->forceTimestampCheck, data, "check-timestamps"); setValueFromJson(opt.d->forceOutputCheck, data, "check-outputs"); setValueFromJson(opt.d->logElapsedTime, data, "log-time"); setValueFromJson(opt.d->echoMode, data, "command-echo-mode"); setValueFromJson(opt.d->install, data, "install"); setValueFromJson(opt.d->removeExistingInstallation, data, "clean-install-root"); setValueFromJson(opt.d->onlyExecuteRules, data, "only-execute-rules"); setValueFromJson(opt.d->jobLimitsFromProjectTakePrecedence, data, "enforce-project-job-limits"); return opt; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/version.cpp0000644000175100017510000000732315154533055021014 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "version.h" #include #include namespace qbs { Version Version::fromString(const QString &versionString, bool buildNumberAllowed) { QString pattern = QStringLiteral("(\\d+)"); // At least one number. for (int i = 0; i < 2; ++i) pattern += QStringLiteral("(?:\\.(\\d+))?"); // Followed by a dot and a number up to two times. if (buildNumberAllowed) pattern += QStringLiteral("(?:[-.](\\d+))?"); // And possibly a dash or dot followed by the build number. const QRegularExpression rex(QRegularExpression::anchoredPattern(pattern)); const QRegularExpressionMatch match = rex.match(versionString); if (!match.hasMatch()) return Version{}; const int majorNr = match.captured(1).toInt(); const int minorNr = match.lastCapturedIndex() >= 2 ? match.captured(2).toInt() : 0; const int patchNr = match.lastCapturedIndex() >= 3 ? match.captured(3).toInt() : 0; const int buildNr = match.lastCapturedIndex() >= 4 ? match.captured(4).toInt() : 0; return Version{majorNr, minorNr, patchNr, buildNr}; } QString Version::toString(const QChar &separator, const QChar &buildSeparator) const { if (m_build) { return QStringLiteral("%1%5%2%5%3%6%4") .arg(QString::number(m_major), QString::number(m_minor), QString::number(m_patch), QString::number(m_build), separator, buildSeparator); } return QStringLiteral("%1%4%2%4%3") .arg(QString::number(m_major), QString::number(m_minor), QString::number(m_patch), separator); } VersionRange &VersionRange::narrowDown(const VersionRange &other) { if (other.minimum > minimum) minimum = other.minimum; if (other.maximum.isValid() && other.maximum < maximum) maximum = other.maximum; return *this; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/launchersocket.cpp0000644000175100017510000001157215154533055022342 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "launchersocket.h" #include "qbsassert.h" #include "qttools.h" #include #include #include namespace qbs { namespace Internal { LauncherSocket::LauncherSocket(QObject *parent) : QObject(parent) { qRegisterMetaType(); qRegisterMetaType("quintptr"); } void LauncherSocket::sendData(const QByteArray &data) { if (!isReady()) return; std::lock_guard locker(m_requestsMutex); m_requests.push_back(data); if (m_requests.size() == 1) QTimer::singleShot(0, this, &LauncherSocket::handleRequests); } void LauncherSocket::shutdown() { const auto socket = m_socket.exchange(nullptr); if (!socket) return; socket->disconnect(); socket->write(ShutdownPacket().serialize()); socket->waitForBytesWritten(1000); socket->deleteLater(); } void LauncherSocket::setSocket(QLocalSocket *socket) { QBS_ASSERT(!m_socket, return); m_socket.store(socket); m_packetParser.setDevice(m_socket); connect(m_socket, &QLocalSocket::errorOccurred, this, &LauncherSocket::handleSocketError); connect(m_socket, &QLocalSocket::readyRead, this, &LauncherSocket::handleSocketDataAvailable); connect(m_socket, &QLocalSocket::disconnected, this, &LauncherSocket::handleSocketDisconnected); emit ready(); } void LauncherSocket::handleSocketError() { auto socket = m_socket.load(); if (socket->error() != QLocalSocket::PeerClosedError) handleError(Tr::tr("Socket error: %1").arg(socket->errorString())); } void LauncherSocket::handleSocketDataAvailable() { try { if (!m_packetParser.parse()) return; } catch (const PacketParser::InvalidPacketSizeException &e) { handleError(Tr::tr("Internal protocol error: invalid packet size %1.").arg(e.size)); return; } switch (m_packetParser.type()) { case LauncherPacketType::ProcessError: case LauncherPacketType::ProcessFinished: emit packetArrived(m_packetParser.type(), m_packetParser.token(), m_packetParser.packetData()); break; default: handleError(Tr::tr("Internal protocol error: invalid packet type %1.") .arg(static_cast(m_packetParser.type()))); return; } handleSocketDataAvailable(); } void LauncherSocket::handleSocketDisconnected() { handleError(Tr::tr("Launcher socket closed unexpectedly")); } void LauncherSocket::handleError(const QString &error) { const auto socket = m_socket.exchange(nullptr); socket->disconnect(); socket->deleteLater(); emit errorOccurred(error); } void LauncherSocket::handleRequests() { const auto socket = m_socket.load(); QBS_ASSERT(socket, return); std::lock_guard locker(m_requestsMutex); for (const QByteArray &request : std::as_const(m_requests)) socket->write(request); m_requests.clear(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/preferences.cpp0000644000175100017510000001621315154533055021626 0ustar runnerrunner#include /**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "preferences.h" #include "buildoptions.h" #include "hostosinfo.h" #include "profile.h" #include "stringconstants.h" namespace qbs { /*! * \class Preferences * \brief The \c Preferences class gives access to all general qbs preferences. * If a non-empty \c profileName is given, the profile's preferences take precedence over global * ones. Otherwise, the global preferences are used. */ Preferences::Preferences(Settings *settings, QString profileName) : m_settings(settings), m_profile(std::move(profileName)) { } Preferences::Preferences(Settings *settings, QVariantMap profileContents) : m_settings(settings), m_profileContents(std::move(profileContents)) { } /*! * \brief Returns true <=> colored output should be used for printing messages. * This is only relevant for command-line frontends. */ bool Preferences::useColoredOutput() const { return getPreference(QStringLiteral("useColoredOutput"), true).toBool(); } /*! * \brief Returns the number of parallel jobs to use for building. * Uses a sensible default value if there is no such setting. */ int Preferences::jobs() const { return getPreference(QStringLiteral("jobs"), BuildOptions::defaultMaxJobCount()).toInt(); } /*! * \brief Returns the shell to use for the "qbs shell" command. * This is only relevant for command-line frontends. */ QString Preferences::shell() const { return getPreference(QStringLiteral("shell")).toString(); } /*! * \brief Returns the default build directory used by Qbs if none is specified. */ QString Preferences::defaultBuildDirectory() const { return getPreference(QStringLiteral("defaultBuildDirectory")).toString(); } /*! * \brief Returns the default echo mode used by Qbs if none is specified. */ CommandEchoMode Preferences::defaultEchoMode() const { return commandEchoModeFromName(getPreference(QStringLiteral("defaultEchoMode")).toString()); } /*! * \brief Returns the list of paths where qbs looks for modules and imports. * In addition to user-supplied locations, they will also be looked up at \c{baseDir}/share/qbs. */ QStringList Preferences::searchPaths(const QString &baseDir) const { return pathList(Internal::StringConstants::qbsSearchPathsProperty(), baseDir + QLatin1String("/share/qbs")); } /*! * \brief Returns the list of paths where qbs looks for plugins. * In addition to user-supplied locations, they will be looked up at \c{baseDir}/qbs/plugins. */ QStringList Preferences::pluginPaths(const QString &baseDir) const { return pathList(QStringLiteral("pluginsPath"), baseDir + QStringLiteral("/qbs/plugins")); } /*! * \brief Returns the per-pool job limits. */ JobLimits Preferences::jobLimits() const { const QString prefix = QStringLiteral("preferences.jobLimit"); JobLimits limits; const auto keys = m_settings->allKeysWithPrefix(prefix, Settings::allScopes()); for (const QString &key : keys) { limits.setJobLimit(key, m_settings->value(prefix + QLatin1Char('.') + key, Settings::allScopes()).toInt()); } const QString fullPrefix = prefix + QLatin1Char('.'); if (!m_profile.isEmpty()) { Profile p(m_profile, m_settings, m_profileContents); const auto keys = p.allKeys(Profile::KeySelectionRecursive); for (const QString &key : keys) { if (!key.startsWith(fullPrefix)) continue; const QString jobPool = key.mid(fullPrefix.size()); const int limit = p.value(key).toInt(); if (limit >= 0) limits.setJobLimit(jobPool, limit); } } return limits; } QVariant Preferences::getPreference(const QString &key, const QVariant &defaultValue) const { static const QString keyPrefix = QStringLiteral("preferences"); const QString fullKey = keyPrefix + QLatin1Char('.') + key; const bool isSearchPaths = key == Internal::StringConstants::qbsSearchPathsProperty(); if (!m_profile.isEmpty()) { QVariant value = Profile(m_profile, m_settings).value(fullKey); if (value.isValid()) { if (isSearchPaths) { // Merge with top-level value. value = value.toStringList() + m_settings->value( fullKey, scopesForSearchPaths()).toStringList(); } return value; } } QVariant value = m_profileContents.value(keyPrefix).toMap().value(key); if (value.isValid()) { if (isSearchPaths) {// Merge with top-level value value = value.toStringList() + m_settings->value( fullKey, scopesForSearchPaths()).toStringList(); } return value; } return m_settings->value(fullKey, isSearchPaths ? scopesForSearchPaths() : Settings::allScopes(), defaultValue); } QStringList Preferences::pathList(const QString &key, const QString &defaultValue) const { QStringList paths = getPreference(key).toStringList(); paths << defaultValue; return paths; } bool Preferences::ignoreSystemSearchPaths() const { return getPreference(QStringLiteral("ignoreSystemSearchPaths")).toBool(); } Settings::Scopes Preferences::scopesForSearchPaths() const { return ignoreSystemSearchPaths() ? Settings::UserScope : Settings::allScopes(); } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/fileinfo.h0000644000175100017510000001006415154533055020563 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_FILEINFO_H #define QBS_FILEINFO_H #include "filetime.h" #include "hostosinfo.h" #include "qbs_export.h" #if defined(Q_OS_UNIX) #include #endif #include QT_FORWARD_DECLARE_CLASS(QFileInfo) namespace qbs { namespace Internal { class QBS_AUTOTEST_EXPORT FileInfo { public: FileInfo(const QString &fileName); bool exists() const; FileTime lastModified() const; FileTime lastStatusChange() const; bool isDir() const; static QString fileName(const QString &fp); static QString baseName(const QString &fp); static QString completeBaseName(const QString &fp); static QString suffix(const QString &fp); static QString completeSuffix(const QString &fp); static QString path(const QString &fp, HostOsInfo::HostOs hostOs = HostOsInfo::hostOs()); static void splitIntoDirectoryAndFileName(const QString &filePath, QString *dirPath, QString *fileName); static void splitIntoDirectoryAndFileName(const QString &filePath, QStringView *dirPath, QStringView *fileName); static bool exists(const QString &fp); static bool isAbsolute(const QString &fp, HostOsInfo::HostOs hostOs = HostOsInfo::hostOs()); static bool isPattern(QStringView str); static QString resolvePath(const QString &base, const QString &rel, HostOsInfo::HostOs hostOs = HostOsInfo::hostOs()); static bool isFileCaseCorrect(const QString &filePath); // Symlink-correct check. static bool fileExists(const QFileInfo &fi); private: #if defined(Q_OS_WIN) struct InternalStatType { quint8 z[36]; }; #elif defined(Q_OS_UNIX) using InternalStatType = struct stat; #else # error unknown platform #endif InternalStatType m_stat{}; }; bool removeFileRecursion(const QFileInfo &f, QString *errorMessage); bool QBS_AUTOTEST_EXPORT removeDirectoryWithContents(const QString &path, QString *errorMessage); bool QBS_AUTOTEST_EXPORT copyFileRecursion( const QString &sourcePath, const QString &targetPath, bool preserveSymLinks, bool copyDirectoryContents, QString *errorMessage, bool *skipped = nullptr); } // namespace Internal QString QBS_EXPORT qbsApplicationDirPath(); } // namespace qbs #endif qbs-src-3.2.0/src/lib/corelib/tools/buildoptions.h0000644000175100017510000001004715154533055021504 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_BUILDOPTIONS_H #define QBS_BUILDOPTIONS_H #include "qbs_export.h" #include "commandechomode.h" #include "joblimits.h" #include #include QT_BEGIN_NAMESPACE class QJsonObject; QT_END_NAMESPACE namespace qbs { namespace Internal { class BuildOptionsPrivate; } class QBS_EXPORT BuildOptions { public: BuildOptions(); BuildOptions(const BuildOptions &other); BuildOptions &operator=(const BuildOptions &other); ~BuildOptions(); static BuildOptions fromJson(const QJsonObject &data); QStringList filesToConsider() const; void setFilesToConsider(const QStringList &files); QStringList changedFiles() const; void setChangedFiles(const QStringList &changedFiles); QStringList activeFileTags() const; void setActiveFileTags(const QStringList &fileTags); static int defaultMaxJobCount(); int maxJobCount() const; void setMaxJobCount(int jobCount); QString settingsDirectory() const; void setSettingsDirectory(const QString &settingsBaseDir); JobLimits jobLimits() const; void setJobLimits(const JobLimits &jobLimits); bool projectJobLimitsTakePrecedence() const; void setProjectJobLimitsTakePrecedence(bool toggle); bool dryRun() const; void setDryRun(bool dryRun); bool keepGoing() const; void setKeepGoing(bool keepGoing); bool forceTimestampCheck() const; void setForceTimestampCheck(bool enabled); bool forceOutputCheck() const; void setForceOutputCheck(bool enabled); bool logElapsedTime() const; void setLogElapsedTime(bool log); CommandEchoMode echoMode() const; void setEchoMode(CommandEchoMode echoMode); bool install() const; void setInstall(bool install); bool removeExistingInstallation() const; void setRemoveExistingInstallation(bool removeExisting); bool executeRulesOnly() const; void setExecuteRulesOnly(bool onlyRules); private: QSharedDataPointer d; }; bool operator==(const BuildOptions &bo1, const BuildOptions &bo2); inline bool operator!=(const BuildOptions &bo1, const BuildOptions &bo2) { return !(bo1 == bo2); } } // namespace qbs #endif // QBS_BUILDOPTIONS_H qbs-src-3.2.0/src/lib/corelib/tools/persistence.cpp0000644000175100017510000001654315154533055021657 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "persistence.h" #include "fileinfo.h" #include #include #include namespace qbs { namespace Internal { static const char QBS_PERSISTENCE_MAGIC[] = "QBSPERSISTENCE-140"; NoBuildGraphError::NoBuildGraphError(const QString &filePath) : ErrorInfo(Tr::tr("Build graph not found for configuration '%1'. Expected location was '%2'.") .arg(FileInfo::completeBaseName(filePath), QDir::toNativeSeparators(filePath))) { } PersistentPool::PersistentPool(Logger &logger) : m_logger(logger) { Q_UNUSED(m_logger); m_stream.setVersion(QDataStream::Qt_4_8); } PersistentPool::~PersistentPool() = default; void PersistentPool::load(const QString &filePath) { std::unique_ptr file(new QFile(filePath)); if (!file->exists()) throw NoBuildGraphError(filePath); if (!file->open(QFile::ReadOnly)) { throw ErrorInfo(Tr::tr("Could not open open build graph file '%1': %2") .arg(filePath, file->errorString())); } m_stream.setDevice(file.get()); QByteArray magic; m_stream >> magic; if (magic != QBS_PERSISTENCE_MAGIC) { m_stream.setDevice(nullptr); throw ErrorInfo(Tr::tr("Cannot use stored build graph at '%1': Incompatible file format. " "Expected magic token '%2', got '%3'.") .arg(filePath, QLatin1String(QBS_PERSISTENCE_MAGIC), QString::fromLatin1(magic))); } m_stream >> m_headData.projectConfig; m_file = std::move(file); m_loadedRaw.clear(); m_loaded.clear(); m_storageIndices.clear(); m_stringStorage.clear(); m_inverseStringStorage.clear(); } void PersistentPool::setupWriteStream(const QString &filePath) { QString dirPath = FileInfo::path(filePath); if (!FileInfo::exists(dirPath) && !QDir().mkpath(dirPath)) { throw ErrorInfo(Tr::tr("Failure storing build graph: Cannot create directory '%1'.") .arg(dirPath)); } if (QFile::exists(filePath) && !QFile::remove(filePath)) { throw ErrorInfo(Tr::tr("Failure storing build graph: Cannot remove old file '%1'") .arg(filePath)); } QBS_CHECK(!QFile::exists(filePath)); std::unique_ptr file(new QFile(filePath)); if (!file->open(QFile::WriteOnly)) { throw ErrorInfo(Tr::tr("Failure storing build graph: " "Cannot open file '%1' for writing: %2").arg(filePath, file->errorString())); } m_stream.setDevice(file.get()); m_file = std::move(file); m_stream << QByteArray(qstrlen(QBS_PERSISTENCE_MAGIC), 0) << m_headData.projectConfig; m_lastStoredObjectId = 0; m_lastStoredStringId = 0; m_lastStoredEnvId = 0; m_lastStoredStringListId = 0; } void PersistentPool::finalizeWriteStream() { if (m_stream.status() != QDataStream::Ok) throw ErrorInfo(Tr::tr("Failure serializing build graph.")); m_stream.device()->seek(0); m_stream << QByteArray(QBS_PERSISTENCE_MAGIC); if (m_stream.status() != QDataStream::Ok) throw ErrorInfo(Tr::tr("Failure serializing build graph.")); const auto file = static_cast(m_stream.device()); if (!file->flush()) { file->close(); file->remove(); throw ErrorInfo(Tr::tr("Failure serializing build graph: %1").arg(file->errorString())); } } void PersistentPool::storeVariant(const QVariant &variant) { if (variant.isNull()) { m_stream << quint32(QMetaType::User); m_stream << variant; return; } const auto type = static_cast(variant.userType()); m_stream << type; switch (type) { case QMetaType::QString: store(variant.toString()); break; case QMetaType::QStringList: store(variant.toStringList()); break; case QMetaType::QVariantList: store(variant.toList()); break; case QMetaType::QVariantMap: store(variant.toMap()); break; default: m_stream << variant; } } QVariant PersistentPool::loadVariant() { const auto type = load(); QVariant value; switch (type) { case QMetaType::QString: value = load(); break; case QMetaType::QStringList: value = load(); break; case QMetaType::QVariantList: value = load(); break; case QMetaType::QVariantMap: value = load(); break; default: m_stream >> value; } return value; } void PersistentPool::clear() { m_loaded.clear(); m_storageIndices.clear(); m_stringStorage.clear(); m_inverseStringStorage.clear(); } void PersistentPool::doLoadValue(QString &s) { m_stream >> s; } void PersistentPool::doLoadValue(QStringList &l) { int size; m_stream >> size; for (int i = 0; i < size; ++i) l << load(); } void PersistentPool::doLoadValue(QProcessEnvironment &env) { const auto keys = load(); for (const QString &key : keys) env.insert(key, load()); } void PersistentPool::doStoreValue(const QString &s) { m_stream << s; } void PersistentPool::doStoreValue(const QStringList &l) { m_stream << int(l.size()); for (const QString &s : l) store(s); } void PersistentPool::doStoreValue(const QProcessEnvironment &env) { const QStringList &keys = env.keys(); store(keys); for (const QString &key : keys) store(env.value(key)); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/id.cpp0000644000175100017510000001553415154533055017726 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "id.h" #include "qbsassert.h" #include #include #include #include namespace qbs { namespace Internal { /*! \class qbs::Internal::Id \brief The class Id encapsulates an identifier that is unique within a specific running process, using the qbs library. \c{Id} is used as facility to identify objects of interest in a more typesafe and faster manner than a plain \c QString or \c QByteArray would provide. An id is internally represented as a 32 bit integer (its \c UID) and associated with a plain 7-bit-clean ASCII name used for display and persistency. This class is copied from Qt Creator. */ class StringHolder { public: StringHolder() = default; StringHolder(const char *s, int length) : n(length), str(s) { if (!n) length = n = int(qstrlen(s)); h = 0; while (length--) { h = (h << 4) + *s++; h ^= (h & 0xf0000000) >> 23; h &= 0x0fffffff; } } int n = 0; const char *str = nullptr; uint h = 0; }; static bool operator==(const StringHolder &sh1, const StringHolder &sh2) { // sh.n is unlikely to discriminate better than the hash. return sh1.h == sh2.h && sh1.str && sh2.str && strcmp(sh1.str, sh2.str) == 0; } QHashValueType qHash(const StringHolder &sh) { return sh.h; } struct IdCache : public QHash { #ifndef QBS_ALLOW_STATIC_LEAKS ~IdCache() { for (IdCache::iterator it = begin(); it != end(); ++it) delete[](const_cast(it.key().str)); } #endif }; static int firstUnusedId = Id::IdsPerPlugin * Id::ReservedPlugins; static QHash stringFromId; static IdCache idFromString; static std::mutex mutex; static QByteArray getStringFromId(int id) { std::lock_guard lock(mutex); return stringFromId.value(id).str; } static int theId(const char *str, int n = 0) { QBS_ASSERT(str && *str, return 0); StringHolder sh(str, n); std::lock_guard lock(mutex); int res = idFromString.value(sh, 0); if (res == 0) { res = firstUnusedId++; sh.str = qstrdup(sh.str); idFromString[sh] = res; stringFromId[res] = sh; } return res; } static int theId(const QByteArray &ba) { return theId(ba.constData(), ba.size()); } /*! \fn qbs::Internal::Id(int uid) \brief Constructs an id given a UID. The UID is an integer value that is unique within the running process. It is the callers responsibility to ensure the uniqueness of the passed integer. The recommended approach is to use \c{registerId()} with an value taken from the plugin's private range. \sa registerId() */ /*! Constructs an id given its associated name. The internal representation will be unspecified, but consistent within a process. */ Id::Id(const char *name) : m_id(theId(name, 0)) {} /*! \overload */ Id::Id(const QByteArray &name) : m_id(theId(name)) {} /*! Returns an internal representation of the id. */ QByteArray Id::name() const { return getStringFromId(m_id); } /*! Returns a string representation of the id suitable for UI display. This should not be used to create a persistent version of the Id, use \c{toSetting()} instead. \sa fromString(), toSetting() */ QString Id::toString() const { return QString::fromUtf8(getStringFromId(m_id)); } /*! Returns a persistent value representing the id which is suitable to be stored in QSettings. \sa fromSetting() */ QVariant Id::toSetting() const { return QString::fromUtf8(getStringFromId(m_id)); } /*! Reconstructs an id from a persistent value. \sa toSetting() */ Id Id::fromSetting(const QVariant &variant) { const QByteArray ba = variant.toString().toUtf8(); if (ba.isEmpty()) return {}; return {theId(ba)}; } /*! Constructs a derived id. This can be used to construct groups of ids logically belonging together. The associated internal name will be generated by appending \c{suffix}. */ Id Id::withSuffix(int suffix) const { const QByteArray ba = name() + QByteArray::number(suffix); return {ba.constData()}; } /*! \overload */ Id Id::withSuffix(const char *suffix) const { const QByteArray ba = name() + suffix; return {ba.constData()}; } /*! Constructs a derived id. This can be used to construct groups of ids logically belonging together. The associated internal name will be generated by prepending \c{prefix}. */ Id Id::withPrefix(const char *prefix) const { const QByteArray ba = prefix + name(); return {ba.constData()}; } bool Id::operator==(const char *name) const { const auto string = getStringFromId(m_id); if (!string.isNull() && name) return strcmp(string.data(), name) == 0; return false; } bool Id::alphabeticallyBefore(Id other) const { return toString().compare(other.toString(), Qt::CaseInsensitive) < 0; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/qttools.h0000644000175100017510000001455215154533055020503 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 QBSQTTOOLS_H #define QBSQTTOOLS_H #include #include #include #include #include #include #include #include QT_BEGIN_NAMESPACE class QProcessEnvironment; QT_END_NAMESPACE namespace std { template struct hash> { size_t operator()(const pair &x) const { return std::hash()(x.first) ^ std::hash()(x.second); } }; template struct hash> { private: template static size_t helper(std::index_sequence, const std::tuple &tuple) noexcept { size_t seed = 0; (qbs::Internal::hashCombineHelper(seed, std::get(tuple)), ...); return seed; } public: size_t operator()(const std::tuple & tuple) const noexcept { return helper(std::make_index_sequence(), tuple); } }; template<> struct hash { std::size_t operator()(const QStringList &s) const noexcept { return qbs::Internal::hashRange(s); } }; template<> struct hash { size_t operator()(const QVariant &v) const noexcept; }; template<> struct hash { size_t operator()(const QVariantList &v) const noexcept { return qbs::Internal::hashRange(v); } }; template<> struct hash { size_t operator()(const QVariantMap &v) const noexcept { return qbs::Internal::hashRange(v); } }; template<> struct hash { size_t operator()(const QVariantHash &v) const noexcept { return qbs::Internal::hashRange(v); } }; } // namespace std QT_BEGIN_NAMESPACE qbs::QHashValueType qHash(const QStringList &list); qbs::QHashValueType qHash(const QProcessEnvironment &env); template qbs::QHashValueType qHash(const std::tuple &tuple) { return std::hash>()(tuple) % std::numeric_limits::max(); } inline qbs::QHashValueType qHash(const QVariant &v) { return std::hash()(v) % std::numeric_limits::max(); } inline qbs::QHashValueType qHash(const QVariantMap &v) { return std::hash()(v) % std::numeric_limits::max(); } inline qbs::QHashValueType qHash(const QVariantHash &v) { return std::hash()(v) % std::numeric_limits::max(); } QT_END_NAMESPACE namespace qbs { template QSet toSet(const QList &list) { return QSet(list.begin(), list.end()); } template QList toList(const QSet &set) { return QList(set.begin(), set.end()); } template QHash &unite(QHash &h, const QHash &other) { h.insert(other); return h; } inline void setupDefaultCodec(QTextStream &stream) { #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) stream.setCodec("UTF-8"); #else Q_UNUSED(stream); #endif } inline bool qVariantCanConvert(const QVariant &variant, int typeId) { #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) return variant.canConvert(QMetaType(typeId)); #else return variant.canConvert(typeId); // deprecated in Qt6 #endif } inline bool qVariantConvert(QVariant &variant, int typeId) { #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) return variant.convert(QMetaType(typeId)); #else return variant.convert(typeId); // deprecated in Qt6 #endif } inline QMetaType::Type qVariantType(const QVariant &v) { return static_cast( #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) v.metaType().id() #else v.type() #endif ); } template inline QVariant typedNullVariant() { const auto metaType = QMetaType::fromType(); #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) return QVariant(metaType, nullptr); #else return QVariant(static_cast(metaType.id())); #endif } inline bool qVariantsEqual(const QVariant &v1, const QVariant &v2) { return v1.isNull() == v2.isNull() && v1 == v2; } inline bool qVariantMapsEqual(const QVariantMap &m1, const QVariantMap &m2) { if (m1.size() != m2.size()) return false; if (m1.isSharedWith(m2)) return true; auto it1 = m1.cbegin(); auto it2 = m2.cbegin(); while (it1 != m1.cend()) { if (it1.key() != it2.key() || !qVariantsEqual(it1.value(), it2.value())) return false; ++it2; ++it1; } return true; } } // namespace qbs #endif // QBSQTTOOLS_H qbs-src-3.2.0/src/lib/corelib/tools/settings.h0000644000175100017510000000765515154533055020644 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SETTINGS_H #define QBS_SETTINGS_H #include "qbs_export.h" #include #include #include #include QT_BEGIN_NAMESPACE class QSettings; QT_END_NAMESPACE namespace qbs { class QBS_EXPORT Settings { public: // The "pure" base directory without any version scope. Empty string means "system default". Settings(const QString &baseDir); Settings(const QString &baseDir, const QString &systemBaseDir); ~Settings(); enum Scope { UserScope = 0x1, SystemScope = 0x2 }; Q_DECLARE_FLAGS(Scopes, Scope) static Scopes allScopes() { return {UserScope, SystemScope}; } QVariant value(const QString &key, Scopes scopes, const QVariant &defaultValue = QVariant()) const; QStringList allKeys(Scopes scopes) const; QStringList directChildren(const QString &parentGroup, Scopes scopes) const; // Keys and groups. QStringList allKeysWithPrefix(const QString &group, Scopes scopes) const; void setValue(const QString &key, const QVariant &value); void remove(const QString &key); void clear(); void sync(); void setScopeForWriting(Scope scope) { m_scopeForWriting = scope; } Scope scopeForWriting() const { return m_scopeForWriting; } QString defaultProfile() const; QStringList profiles() const; QString fileName() const; QString baseDirectory() const { return m_baseDir; } // As passed into the constructor. static QString defaultSystemSettingsBaseDir(); private: QString internalRepresentation(const QString &externalKey) const; QString externalRepresentation(const QString &internalKey) const; void fixupKeys(QStringList &keys) const; QSettings *settingsForScope(Scope scope) const; QSettings *targetForWriting() const; void checkForWriteError(); const std::unique_ptr m_settings; const std::unique_ptr m_systemSettings; const QString m_baseDir; Scope m_scopeForWriting = UserScope; }; Q_DECLARE_OPERATORS_FOR_FLAGS(Settings::Scopes) } // namespace qbs #endif // QBS_SETTINGS_H qbs-src-3.2.0/src/lib/corelib/tools/executablefinder.cpp0000644000175100017510000001276615154533055022647 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "executablefinder.h" #include "fileinfo.h" #include "hostosinfo.h" #include "qttools.h" #include "stringconstants.h" #include #include namespace qbs { namespace Internal { static QStringList populateExecutableSuffixes() { QStringList result; result << QString(); if (HostOsInfo::isWindowsHost()) { result << QStringLiteral(".com") << QStringLiteral(".exe") << QStringLiteral(".bat") << QStringLiteral(".cmd"); } return result; } QStringList ExecutableFinder::m_executableSuffixes = populateExecutableSuffixes(); ExecutableFinder::ExecutableFinder(ResolvedProductPtr product, const QProcessEnvironment &env) : m_product(std::move(product)) , m_environment(env) // QProcessEnvironment doesn't have move-ctor, copy here { } QString ExecutableFinder::findExecutable(const QString &path, const QString &workingDirPath) { QString filePath = QDir::fromNativeSeparators(path); //if (FileInfo::fileName(filePath) == filePath) if (!FileInfo::isAbsolute(filePath)) return findInPath(filePath, workingDirPath); if (HostOsInfo::isWindowsHost()) return findBySuffix(filePath); return filePath; } QString ExecutableFinder::findBySuffix(const QString &filePath) const { QString fullProgramPath = cachedFilePath(filePath); if (!fullProgramPath.isEmpty()) return fullProgramPath; fullProgramPath = filePath; qCDebug(lcExec) << "looking for executable by suffix" << fullProgramPath; const QString emptyDirectory; candidateCheck(emptyDirectory, fullProgramPath, fullProgramPath); cacheFilePath(filePath, fullProgramPath); return fullProgramPath; } bool ExecutableFinder::candidateCheck(const QString &directory, const QString &program, QString &fullProgramPath) const { for (const QString &suffix : std::as_const(m_executableSuffixes)) { QString candidate = directory + program + suffix; qCDebug(lcExec) << "candidate:" << candidate; QFileInfo fi(candidate); if (fi.isFile() && fi.isExecutable()) { fullProgramPath = candidate; return true; } } return false; } QString ExecutableFinder::findInPath(const QString &filePath, const QString &workingDirPath) const { QString fullProgramPath = cachedFilePath(filePath); if (!fullProgramPath.isEmpty()) return fullProgramPath; fullProgramPath = filePath; qCDebug(lcExec) << "looking for executable in PATH" << fullProgramPath; QStringList pathEnv = m_environment.value(StringConstants::pathEnvVar()) .split(HostOsInfo::pathListSeparator(), Qt::SkipEmptyParts); if (HostOsInfo::isWindowsHost()) pathEnv.prepend(StringConstants::dot()); for (QString directory : std::as_const(pathEnv)) { if (directory == StringConstants::dot()) directory = workingDirPath; if (!directory.isEmpty()) { const QChar lastChar = directory.at(directory.size() - 1); if (lastChar != QLatin1Char('/') && lastChar != QLatin1Char('\\')) directory.append(QLatin1Char('/')); } if (candidateCheck(directory, fullProgramPath, fullProgramPath)) break; } cacheFilePath(filePath, fullProgramPath); return fullProgramPath; } QString ExecutableFinder::cachedFilePath(const QString &filePath) const { return m_product ? m_product->cachedExecutablePath(filePath) : QString(); } void ExecutableFinder::cacheFilePath(const QString &filePath, const QString &fullFilePath) const { if (m_product) m_product->cacheExecutablePath(filePath, fullFilePath); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/commandechomode.cpp0000644000175100017510000000716015154533055022450 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** 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$ ** ****************************************************************************/ #include "commandechomode.h" #include #include /*! * \enum CommandEchoMode * This enum type specifies the kind of output to display when executing commands. * \value CommandEchoModeSilent Indicates that no output will be printed. * \value CommandEchoModeSummary Indicates that descriptions will be printed. * \value CommandEchoModeCommandLine Indidcates that full command line invocations will be printed. * \value CommandEchoModeCommandLineWithEnvironment Indidcates that full command line invocations, * including environment variables, will be printed. */ namespace qbs { CommandEchoMode defaultCommandEchoMode() { return CommandEchoModeSummary; } QString commandEchoModeName(CommandEchoMode mode) { switch (mode) { case CommandEchoModeSilent: return QStringLiteral("silent"); case CommandEchoModeSummary: return QStringLiteral("summary"); case CommandEchoModeCommandLine: return QStringLiteral("command-line"); case CommandEchoModeCommandLineWithEnvironment: return QStringLiteral("command-line-with-environment"); default: break; } return {}; } CommandEchoMode commandEchoModeFromName(const QString &name) { CommandEchoMode mode = defaultCommandEchoMode(); for (int i = 0; i < CommandEchoModeInvalid; ++i) { if (commandEchoModeName(static_cast(i)) == name) { mode = static_cast(i); break; } } return mode; } QStringList allCommandEchoModeStrings() { QStringList result; for (int i = 0; i < CommandEchoModeInvalid; ++i) result << commandEchoModeName(static_cast(i)); return result; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/executablefinder.h0000644000175100017510000000562115154533055022304 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_EXECUTABLEFINDER_H #define QBS_EXECUTABLEFINDER_H #include #include namespace qbs { namespace Internal { /*! * \brief Helper class for finding an executable in the PATH of the build environment. */ class ExecutableFinder { public: ExecutableFinder(ResolvedProductPtr product, const QProcessEnvironment &env); QString findExecutable(const QString &path, const QString &workingDirPath); private: static QStringList m_executableSuffixes; QString findBySuffix(const QString &filePath) const; bool candidateCheck(const QString &directory, const QString &program, QString &fullProgramPath) const; QString findInPath(const QString &filePath, const QString &workingDirPath) const; QString cachedFilePath(const QString &filePath) const; void cacheFilePath(const QString &filePaht, const QString &filePath) const; ResolvedProductPtr m_product; const QProcessEnvironment m_environment; }; } // namespace Internal } // namespace qbs #endif // QBS_EXECUTABLEFINDER_H qbs-src-3.2.0/src/lib/corelib/tools/generateoptions.h0000644000175100017510000000503515154533055022200 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** 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_GENERATEOPTIONS_H #define QBS_GENERATEOPTIONS_H #include "qbs_export.h" #include QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE namespace qbs { namespace Internal { class GenerateOptionsPrivate; } class QBS_EXPORT GenerateOptions { public: GenerateOptions(); GenerateOptions(const GenerateOptions &other); GenerateOptions &operator=(const GenerateOptions &other); ~GenerateOptions(); QString generatorName() const; void setGeneratorName(const QString &generatorName); private: QSharedDataPointer d; }; } // namespace qbs #endif // QBS_GENERATEOPTIONS_H qbs-src-3.2.0/src/lib/corelib/tools/scripttools.cpp0000644000175100017510000002610115154533055021707 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "scripttools.h" #include #include #include #include #include #include #include namespace qbs { namespace Internal { void setConfigProperty(QVariantMap &cfg, const QStringList &name, const QVariant &value) { if (name.length() == 1) { cfg.insert(name.front(), value); } else { QVariant &subCfg = cfg[name.front()]; QVariantMap subCfgMap = subCfg.toMap(); setConfigProperty(subCfgMap, name.mid(1), value); subCfg = subCfgMap; } } QVariant getConfigProperty(const QVariantMap &cfg, const QStringList &name) { if (name.length() == 1) return cfg.value(name.front()); return getConfigProperty(cfg.value(name.front()).toMap(), name.mid(1)); } TemporaryGlobalObjectSetter::TemporaryGlobalObjectSetter( ScriptEngine *engine, const JSValue &object) : m_engine(engine), m_oldGlobalObject(engine->globalObject()) { engine->setGlobalObject(object); } TemporaryGlobalObjectSetter::~TemporaryGlobalObjectSetter() { m_engine->setGlobalObject(m_oldGlobalObject); } JsException::JsException(JsException &&other) noexcept : m_ctx(other.m_ctx) , m_exception(other.m_exception) , m_backtrace(other.m_exception) , m_fallbackLocation(std::move(other.m_fallbackLocation)) { other.m_exception = JS_NULL; other.m_backtrace = JS_NULL; } JsException::~JsException() { JS_FreeValue(m_ctx, m_exception); JS_FreeValue(m_ctx, m_backtrace); } QString JsException::message() const { if (JS_IsError(m_exception)) return getJsStringProperty(m_ctx, m_exception, QStringLiteral("message")); const QVariant v = getJsVariant(m_ctx, m_exception); switch (static_cast(v.userType())) { case QMetaType::QVariantMap: return QString::fromUtf8(QJsonDocument(QJsonObject::fromVariantMap(v.toMap())) .toJson(QJsonDocument::Indented)); case QMetaType::QStringList: return QString::fromUtf8(QJsonDocument(QJsonArray::fromStringList(v.toStringList())) .toJson(QJsonDocument::Indented)); case QMetaType::QVariantList: return QString::fromUtf8(QJsonDocument(QJsonArray::fromVariantList(v.toList())) .toJson(QJsonDocument::Indented)); default: return v.toString(); } } const QStringList JsException::stackTrace() const { return getJsString(m_ctx, m_backtrace).split(QLatin1Char('\n'), Qt::SkipEmptyParts); } ErrorInfo JsException::toErrorInfo() const { const QString msg = message(); ErrorInfo e(msg, stackTrace()); if (e.hasLocation() || !m_fallbackLocation.isValid()) return e; return {msg, m_fallbackLocation}; } void defineJsProperty(JSContext *ctx, JSValueConst obj, const QString &prop, JSValue val) { JS_DefinePropertyValueStr(ctx, obj, prop.toUtf8().constData(), val, 0); } JSValue getJsProperty(JSContext *ctx, JSValue obj, const QString &prop) { return JS_GetPropertyStr(ctx, obj, prop.toUtf8().constData()); } void setJsProperty(JSContext *ctx, JSValueConst obj, std::string_view prop, JSValue val) { JS_SetPropertyStr(ctx, obj, prop.data(), val); } void setJsProperty(JSContext *ctx, JSValue obj, const QString &prop, JSValue val) { const auto propUtf8 = prop.toUtf8(); setJsProperty(ctx, obj, std::string_view{propUtf8.data(), size_t(propUtf8.size())}, val); } void setJsProperty(JSContext *ctx, JSValue obj, const QString &prop, const QString &val) { setJsProperty(ctx, obj, prop, makeJsString(ctx, val)); } void handleJsProperties(JSContext *ctx, JSValue obj, const std::function &handler) { struct PropsHolder { PropsHolder(JSContext *ctx) : ctx(ctx) {} ~PropsHolder() { for (uint32_t i = 0; i < count; ++i) JS_FreeAtom(ctx, props[i].atom); js_free(ctx, props); } JSContext * const ctx; JSPropertyEnum *props = nullptr; uint32_t count = 0; } propsHolder(ctx); JS_GetOwnPropertyNames(ctx, &propsHolder.props, &propsHolder.count, obj, JS_GPN_STRING_MASK); for (uint32_t i = 0; i < propsHolder.count; ++i) { JSPropertyDescriptor desc{0, JS_UNDEFINED, JS_UNDEFINED, JS_UNDEFINED}; JS_GetOwnProperty(ctx, &desc, obj, propsHolder.props[i].atom); const ScopedJsValueList valueHolder(ctx, {desc.value, desc.getter, desc.setter}); handler(propsHolder.props[i].atom, desc); } } QString getJsString(JSContext *ctx, JSValueConst val) { size_t strLen; const char * const str = JS_ToCStringLen(ctx, &strLen, val); QString s = QString::fromUtf8(str, strLen); JS_FreeCString(ctx, str); return s; } QString getJsStringProperty(JSContext *ctx, JSValue obj, const QString &prop) { const ScopedJsValue sv(ctx, getJsProperty(ctx, obj, prop)); return getJsString(ctx, sv); } int getJsIntProperty(JSContext *ctx, JSValue obj, const QString &prop) { return JS_VALUE_GET_INT(getJsProperty(ctx, obj, prop)); } bool getJsBoolProperty(JSContext *ctx, JSValue obj, const QString &prop) { return JS_VALUE_GET_BOOL(getJsProperty(ctx, obj, prop)); } JSValue makeJsArrayBuffer(JSContext *ctx, const QByteArray &s) { return ScriptEngine::engineForContext(ctx)->asJsValue(s); } JSValue makeJsString(JSContext *ctx, const QString &s) { return ScriptEngine::engineForContext(ctx)->asJsValue(s); } JSValue makeJsStringList(JSContext *ctx, const QStringList &l) { return ScriptEngine::engineForContext(ctx)->asJsValue(l); } JSValue throwError(JSContext *ctx, const QString &message) { return JS_Throw(ctx, makeJsString(ctx, message)); } QStringList getJsStringList(JSContext *ctx, JSValue val) { if (JS_IsString(val)) return {getJsString(ctx, val)}; if (!JS_IsArray(val)) return {}; const int size = getJsIntProperty(ctx, val, QLatin1String("length")); QStringList l; for (int i = 0; i < size; ++i) { const ScopedJsValue elem(ctx, JS_GetPropertyUint32(ctx, val, i)); l << getJsString(ctx, elem); } return l; } JSValue makeJsVariant(JSContext *ctx, const QVariant &v, quintptr id) { return ScriptEngine::engineForContext(ctx)->asJsValue(v, id); } JSValue makeJsVariantList(JSContext *ctx, const QVariantList &l, quintptr id) { return ScriptEngine::engineForContext(ctx)->asJsValue(l, id); } JSValue makeJsVariantMap(JSContext *ctx, const QVariantMap &m, quintptr id) { return ScriptEngine::engineForContext(ctx)->asJsValue(m, id); } static QVariant getJsVariantImpl(JSContext *ctx, JSValue val, QList path) { if (JS_IsString(val)) return getJsString(ctx, val); if (JS_IsBool(val)) return bool(JS_VALUE_GET_BOOL(val)); if (JS_IsArrayBuffer(val)) { size_t size = 0; const auto data = JS_GetArrayBuffer(ctx, &size, val); if (!data || !size) return QByteArray(); return QByteArray(reinterpret_cast(data), size); } if (JS_IsArray(val)) { if (path.contains(val)) return {}; path << val; QVariantList l; const int size = getJsIntProperty(ctx, val, QLatin1String("length")); for (int i = 0; i < size; ++i) { const ScopedJsValue sv(ctx, JS_GetPropertyUint32(ctx, val, i)); l << getJsVariantImpl(ctx, sv, path); } return l; } if (JS_IsDate(val)) { ScopedJsValue toString(ctx, getJsProperty(ctx, val, QLatin1String("toISOString"))); if (!JS_IsFunction(ctx, toString)) return {}; ScopedJsValue dateString(ctx, JS_Call(ctx, toString, val, 0, nullptr)); if (!JS_IsString(dateString)) return {}; return QDateTime::fromString(getJsString(ctx, dateString), Qt::ISODateWithMs); } if (JS_IsObject(val)) { if (path.contains(val)) return {}; path << val; QVariantMap map; handleJsProperties(ctx, val, [ctx, &map, path](const JSAtom &prop, const JSPropertyDescriptor &desc) { map.insert(getJsString(ctx, prop), getJsVariantImpl(ctx, desc.value, path)); }); return map; } const auto tag = JS_VALUE_GET_TAG(val); if (tag == JS_TAG_INT) return JS_VALUE_GET_INT(val); else if (JS_TAG_IS_FLOAT64(tag)) return JS_VALUE_GET_FLOAT64(val); return {}; } QVariant getJsVariant(JSContext *ctx, JSValue val) { return getJsVariantImpl(ctx, val, {}); } QStringList getJsStringListProperty(JSContext *ctx, JSValue obj, const QString &prop) { JSValue array = getJsProperty(ctx, obj, prop); QStringList list = getJsStringList(ctx, array); JS_FreeValue(ctx, array); return list; } QVariant getJsVariantProperty(JSContext *ctx, JSValue obj, const QString &prop) { const JSValue vv = getJsProperty(ctx, obj, prop); QVariant v = getJsVariant(ctx, vv); JS_FreeValue(ctx, vv); return v; } QString getJsString(JSContext *ctx, JSAtom atom) { const ScopedJsValue atomString(ctx, JS_AtomToString(ctx, atom)); return getJsString(ctx, atomString); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/deprecationwarningmode.h0000644000175100017510000000465315154533055023527 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2022 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_DEPRECATIONWARNINGMODE_H #define QBS_DEPRECATIONWARNINGMODE_H #include "qbs_export.h" #include namespace qbs { enum class DeprecationWarningMode { Error, On, BeforeRemoval, Off, Sentinel = Off }; QBS_EXPORT DeprecationWarningMode defaultDeprecationWarningMode(); QBS_EXPORT QString deprecationWarningModeName(DeprecationWarningMode mode); QBS_EXPORT DeprecationWarningMode deprecationWarningModeFromName(const QString &name); QBS_EXPORT QStringList allDeprecationWarningModeStrings(); } // namespace qbs #endif // QBS_DEPRECATIONWARNINGMODE_H qbs-src-3.2.0/src/lib/corelib/tools/toolchains.h0000644000175100017510000000423515154533055021136 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_TOOLCHAINS_H #define QBS_TOOLCHAINS_H #include "qbs_export.h" #include namespace qbs { QBS_EXPORT QStringList canonicalToolchain(const QStringList &toolchain); QBS_EXPORT QStringList canonicalToolchain(const QString &toolchainName); } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/tools/msvcinfo.h0000644000175100017510000001101615154533055020612 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_MSVCINFO_H #define QBS_MSVCINFO_H #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class Logger; struct MSVCArchInfo { QString arch; QString binPath; }; /** * Represents one MSVC installation for one specific target architecture. * There are potentially multiple MSVCs in one Visual Studio installation. */ class MSVC { public: enum CompilerLanguage { CLanguage = 0, CPlusPlusLanguage = 1 }; QString version; Version internalVsVersion; Version compilerVersion; QString vsInstallPath; QString vcInstallPath; QString binPath; QString pathPrefix; QString architecture; QString sdkVersion; QProcessEnvironment environment; MSVC() = default; MSVC(const QString &clPath, QString arch, QString sdkVersion = {}): architecture(std::move(arch)), sdkVersion(std::move(sdkVersion)) { QDir parentDir = QFileInfo(clPath).dir(); binPath = parentDir.absolutePath(); QString parentDirName = parentDir.dirName().toLower(); if (parentDirName != QLatin1String("bin")) parentDir.cdUp(); vcInstallPath = parentDir.path(); } QBS_EXPORT void init(); QBS_EXPORT static QString architectureFromClPath(const QString &clPath); QBS_EXPORT static QString vcVariablesVersionFromBinPath(const QString &binPath); QBS_EXPORT static QString canonicalArchitecture(const QString &arch); QBS_EXPORT static std::pair getHostTargetArchPair(const QString &arch); QBS_EXPORT QString binPathForArchitecture(const QString &arch) const; QBS_EXPORT QString clPathForArchitecture(const QString &arch) const; QBS_EXPORT QVariantMap compilerDefines(const QString &compilerFilePath, CompilerLanguage language) const; QBS_EXPORT static std::vector findSupportedArchitectures(const MSVC &msvc); QBS_EXPORT QVariantMap toVariantMap() const; QBS_EXPORT static std::vector installedCompilers(Logger &logger); private: void determineCompilerVersion(); }; class WinSDK : public MSVC { public: bool isDefault = false; WinSDK() { pathPrefix = QStringLiteral("bin"); } }; struct QBS_EXPORT MSVCInstallInfo { QString version; QString installDir; QString findVcvarsallBat() const; static std::vector installedMSVCs(Logger &logger); }; } // namespace Internal } // namespace qbs #endif // QBS_MSVCINFO_H qbs-src-3.2.0/src/lib/corelib/tools/version.h0000644000175100017510000001254315154533055020461 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_VERSION_H #define QBS_VERSION_H #include "qbs_export.h" #include #include #include QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE namespace qbs { class Version { public: constexpr explicit Version( int majorVersion = 0, int minorVersion = 0, int patchLevel = 0, int buildNr = 0) : m_major(majorVersion) , m_minor(minorVersion) , m_patch(patchLevel) , m_build(buildNr) {} constexpr bool isValid() const { return m_major || m_minor || m_patch || m_build; } constexpr int majorVersion() const { return m_major; } constexpr void setMajorVersion(int majorVersion) { m_major = majorVersion; } constexpr int minorVersion() const { return m_minor; } constexpr void setMinorVersion(int minorVersion) { m_minor = minorVersion; } constexpr int patchLevel() const { return m_patch; } constexpr void setPatchLevel(int patchLevel) { m_patch = patchLevel; } constexpr int buildNumber() const { return m_build; } constexpr void setBuildNumber(int nr) { m_build = nr; } static QBS_EXPORT Version fromString(const QString &versionString, bool buildNumberAllowed = false); QString QBS_EXPORT toString( const QChar &separator = QLatin1Char('.'), const QChar &buildSeparator = QLatin1Char('-')) const; private: int m_major; int m_minor; int m_patch; int m_build; }; class VersionRange { public: constexpr VersionRange() = default; constexpr VersionRange(const Version &minVersion, const Version &maxVersion) : minimum(minVersion) , maximum(maxVersion) {} Version minimum; Version maximum; // exclusive VersionRange &narrowDown(const VersionRange &other); }; constexpr inline int compare(const Version &lhs, const Version &rhs) { if (lhs.majorVersion() < rhs.majorVersion()) return -1; if (lhs.majorVersion() > rhs.majorVersion()) return 1; if (lhs.minorVersion() < rhs.minorVersion()) return -1; if (lhs.minorVersion() > rhs.minorVersion()) return 1; if (lhs.patchLevel() < rhs.patchLevel()) return -1; if (lhs.patchLevel() > rhs.patchLevel()) return 1; if (lhs.buildNumber() < rhs.buildNumber()) return -1; if (lhs.buildNumber() > rhs.buildNumber()) return 1; return 0; } constexpr inline bool operator==(const Version &lhs, const Version &rhs) { return compare(lhs, rhs) == 0; } constexpr inline bool operator!=(const Version &lhs, const Version &rhs) { return !operator==(lhs, rhs); } constexpr inline bool operator<(const Version &lhs, const Version &rhs) { return compare(lhs, rhs) < 0; } constexpr inline bool operator>(const Version &lhs, const Version &rhs) { return compare(lhs, rhs) > 0; } constexpr inline bool operator<=(const Version &lhs, const Version &rhs) { return !operator>(lhs, rhs); } constexpr inline bool operator>=(const Version &lhs, const Version &rhs) { return !operator<(lhs, rhs); } } // namespace qbs namespace std { template<> struct hash { std::size_t operator()(const qbs::Version &v) const noexcept { std::size_t seed = 0; qbs::Internal::hashCombineHelper(seed, v.majorVersion()); qbs::Internal::hashCombineHelper(seed, v.minorVersion()); qbs::Internal::hashCombineHelper(seed, v.patchLevel()); qbs::Internal::hashCombineHelper(seed, v.buildNumber()); return seed; } }; } // namespace std #endif // QBS_VERSION_H qbs-src-3.2.0/src/lib/corelib/tools/dynamictypecheck.h0000644000175100017510000000352215154533055022315 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_DYNAMICTYPECHECK_H #define QBS_DYNAMICTYPECHECK_H namespace qbs { namespace Internal { // Generic implementation would use dynamic_cast. Don't implement unless it becomes necessary. template inline bool hasDynamicType(const StaticType *); } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/tools/deprecationwarningmode.cpp0000644000175100017510000000753715154533055024066 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2022 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$ ** ****************************************************************************/ #include "deprecationwarningmode.h" /*! * \enum DeprecationWarningMode * This enum type specifies how \QBS should behave on encountering deprecated items or properties. * \value DeprecationWarningMode::Error Project resolving will stop with an error message. * \value DeprecationWarningMode::On A warning will be printed. * \value DeprecationWarningMode::BeforeRemoval A warning will be printed if and only if this is * the last \QBS version before the removal version. This is the default behavior. * \note If the removal version's minor version number is zero, the behavior is * the same as for ErrorHandlingMode::On. * \value DeprecationWarningMode::Off No warnings will be emitted for deprecated constructs. */ namespace qbs { DeprecationWarningMode defaultDeprecationWarningMode() { return DeprecationWarningMode::BeforeRemoval; } QString deprecationWarningModeName(DeprecationWarningMode mode) { switch (mode) { case DeprecationWarningMode::Error: return QStringLiteral("error"); case DeprecationWarningMode::On: return QStringLiteral("on"); case DeprecationWarningMode::BeforeRemoval: return QStringLiteral("before-removal"); case DeprecationWarningMode::Off: return QStringLiteral("off"); default: break; } return {}; } DeprecationWarningMode deprecationWarningModeFromName(const QString &name) { DeprecationWarningMode mode = defaultDeprecationWarningMode(); for (int i = 0; i <= int(DeprecationWarningMode::Sentinel); ++i) { if (deprecationWarningModeName(static_cast(i)) == name) { mode = static_cast(i); break; } } return mode; } QStringList allDeprecationWarningModeStrings() { QStringList result; for (int i = 0; i <= int(DeprecationWarningMode::Sentinel); ++i) result << deprecationWarningModeName(static_cast(i)); return result; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/propagate_const.h0000644000175100017510000003466215154533055022172 0ustar runnerrunner/**************************************************************************** ** MIT License ** ** Copyright (C) 2022-2023 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com ** Author: Giuseppe D'Angelo ** ** This file is part of KDToolBox (https://github.com/KDAB/KDToolBox). ** ** Permission is hereby granted, free of charge, to any person obtaining a copy ** of this software and associated documentation files (the "Software"), to deal ** in the Software without restriction, including without limitation the rights ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ** copies of the Software, ** and to permit persons to whom the Software is ** furnished to do so, subject to the following conditions: ** ** The above copyright notice and this permission notice (including the next paragraph) ** shall be included in all copies or substantial portions of the Software. ** ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ** LIABILITY, WHETHER IN AN ACTION OF ** CONTRACT, TORT OR OTHERWISE, ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ** DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef KDTOOLBOX_PROPAGATE_CONST #define KDTOOLBOX_PROPAGATE_CONST #include #include #include // Our SFINAE is too noisy and clang-format gets confused. // clang-format off namespace KDToolBox { template class propagate_const; namespace detail { // Type traits to detect propagate_const specializations template struct is_propagate_const : std::false_type { }; template struct is_propagate_const> : std::true_type { }; // Using SFINAE in a base class to constrain the conversion operators. // Otherwise, if we make them function templates and apply SFINAE directly on // them, we would not be able to do certain conversions (cf. // [over.ics.user/3]). template using propagate_const_element_type = std::remove_reference_t())>; // Const conversion. // NON-STANDARD: checks that `const T` is convertible, not `T`. // See https://wg21.link/lwg3812 template , std::is_convertible *> > > struct propagate_const_const_conversion_operator_base { }; template struct propagate_const_const_conversion_operator_base { constexpr operator const propagate_const_element_type *() const; }; // Non-const conversion template , std::is_convertible *> > > struct propagate_const_non_const_conversion_operator_base { }; template struct propagate_const_non_const_conversion_operator_base { constexpr operator propagate_const_element_type *(); }; template struct propagate_const_base : propagate_const_const_conversion_operator_base, propagate_const_non_const_conversion_operator_base {}; } // namespace detail /* TODO: This code could benefit from a C++20 overhaul: * concepts * three-way comparisons * explicit(bool) However we can't depend on C++20 yet... */ template class propagate_const : public detail::propagate_const_base { public: using element_type = detail::propagate_const_element_type; // Special member functions propagate_const() = default; propagate_const(propagate_const &&) = default; propagate_const &operator=(propagate_const &&) = default; propagate_const(const propagate_const &) = delete; propagate_const &operator=(const propagate_const &) = delete; ~propagate_const() = default; // Constructor from values template < typename U, std::enable_if_t< // This constructor is enabled if: std::conjunction_v< std::is_constructible, // 1) we can build a T from a U, std::negation>>, // 2) we are not making a // converting constructor, std::is_convertible // 3) and the conversion from U to T is implicit; >, bool> = true> /* implicit */ // then, this constructor is implicit too. propagate_const(U &&other) : m_t(std::forward(other)) { } template < typename U, std::enable_if_t< // This constructor is enabled if: std::conjunction_v< std::is_constructible, // 1) we can build a T from a U, std::negation>>, // 2) we are not making a // converting constructor, std::negation> // 3) and the conversion from U to T is // explicit; >, bool> = true> explicit // then, this constructor is explicit. propagate_const(U &&other) : m_t(std::forward(other)) { } // Constructors from other propagate_const (converting constructors) template , // 1) we can do the conversion, std::is_convertible // 2) and the conversion is implicit; >, bool> = true> /* implicit */ // then, this constructor is implicit. constexpr propagate_const(propagate_const &&other) : m_t(std::move(get_underlying(other))) { } template , // 1) we can do the conversion, std::negation> // 2) and the // conversion is // explicit; >, bool> = true> explicit // then, this constructor is explicit. constexpr propagate_const(propagate_const &&other) : m_t(std::move(get_underlying(other))) { } // Converting assignment template , // the conversion from U to T is implicit bool> = true> constexpr propagate_const &operator=(propagate_const &&other) { m_t = std::move(get_underlying(other)); return *this; } template , // 1) the conversion from U to T is implicit, std::negation>> // 2) and U is not a // propagate_const >, bool> = true> constexpr propagate_const &operator=(U &&other) { m_t = std::forward(other); return *this; } // Swap constexpr void swap(propagate_const &other) noexcept(std::is_nothrow_swappable_v) { using std::swap; swap(m_t, other.m_t); } // Const observers constexpr explicit operator bool() const { return static_cast(m_t); } constexpr const element_type *get() const { return get_impl(m_t); } constexpr const element_type &operator*() const { return *get(); } constexpr const element_type *operator->() const { return get(); } // Non-const observers constexpr element_type *get() { return get_impl(m_t); } constexpr element_type &operator*() { return *get(); } constexpr element_type *operator->() { return get(); } // Non-member utilities: extract the contained object template friend constexpr auto &get_underlying(propagate_const &p); template friend constexpr const auto &get_underlying(const propagate_const &p); private: // Implementation of get() that works with raw pointers and smart // pointers. Similar to std::to_address, but to_address is C++20, // and propagate_const spec does not match it. template static constexpr element_type *get_impl(U *u) { return u; } template static constexpr element_type *get_impl(U &u) { return u.get(); } template static constexpr const element_type *get_impl(const U *u) { return u; } template static constexpr const element_type *get_impl(const U &u) { return u.get(); } T m_t; }; // Swap template , bool> = true> constexpr void swap(propagate_const &lhs, propagate_const &rhs) noexcept(noexcept(lhs.swap(rhs))) { lhs.swap(rhs); } // Implementation of get_underlying template constexpr auto &get_underlying(propagate_const &p) { return p.m_t; } template constexpr const auto &get_underlying(const propagate_const &p) { return p.m_t; } // Implementation of the conversion operators template constexpr detail::propagate_const_const_conversion_operator_base ::operator const detail::propagate_const_element_type *() const { return static_cast *>(this)->get(); } template constexpr detail::propagate_const_non_const_conversion_operator_base ::operator detail::propagate_const_element_type *() { return static_cast *>(this)->get(); } // Comparisons. As per spec, they're free function templates. // Comparisons against nullptr. template constexpr bool operator==(const propagate_const &p, std::nullptr_t) { return get_underlying(p) == nullptr; } template constexpr bool operator!=(const propagate_const &p, std::nullptr_t) { return get_underlying(p) != nullptr; } template constexpr bool operator==(std::nullptr_t, const propagate_const &p) { return nullptr == get_underlying(p); } template constexpr bool operator!=(std::nullptr_t, const propagate_const &p) { return nullptr == get_underlying(p); } // Comparisons between propagate_const #define DEFINE_PROPAGATE_CONST_COMPARISON_OP(op) \ template \ constexpr bool operator op (const propagate_const &lhs, const propagate_const &rhs) \ { \ return get_underlying(lhs) op get_underlying(rhs); \ } \ DEFINE_PROPAGATE_CONST_COMPARISON_OP(==) DEFINE_PROPAGATE_CONST_COMPARISON_OP(!=) DEFINE_PROPAGATE_CONST_COMPARISON_OP(<) DEFINE_PROPAGATE_CONST_COMPARISON_OP(<=) DEFINE_PROPAGATE_CONST_COMPARISON_OP(>) DEFINE_PROPAGATE_CONST_COMPARISON_OP(>=) #undef DEFINE_PROPAGATE_CONST_COMPARISON_OP // Comparisons against other (smart) pointers #define DEFINE_PROPAGATE_CONST_MIXED_COMPARISON_OP(op) \ template \ constexpr bool operator op (const propagate_const &lhs, const U &rhs) \ { \ return get_underlying(lhs) op rhs; \ } \ template \ constexpr bool operator op (const T &lhs, const propagate_const &rhs) \ { \ return lhs op get_underlying(rhs); \ } \ DEFINE_PROPAGATE_CONST_MIXED_COMPARISON_OP(==) DEFINE_PROPAGATE_CONST_MIXED_COMPARISON_OP(!=) DEFINE_PROPAGATE_CONST_MIXED_COMPARISON_OP(<) DEFINE_PROPAGATE_CONST_MIXED_COMPARISON_OP(<=) DEFINE_PROPAGATE_CONST_MIXED_COMPARISON_OP(>) DEFINE_PROPAGATE_CONST_MIXED_COMPARISON_OP(>=) #undef DEFINE_PROPAGATE_CONST_MIXED_COMPARISON_OP } // namespace KDToolBox // std::hash specialization namespace std { template struct hash> { constexpr size_t operator()(const KDToolBox::propagate_const &t) const noexcept(noexcept(hash{}(get_underlying(t)))) { return hash{}(get_underlying(t)); } }; #define DEFINE_COMP_OBJECT_SPECIALIZATION_FOR_PROPAGATE_CONST(COMP) \ template \ struct COMP> \ { \ constexpr bool operator()(const KDToolBox::propagate_const &lhs, \ const KDToolBox::propagate_const &rhs) \ { \ return COMP{}(get_underlying(lhs), get_underlying(rhs)); \ } \ }; \ DEFINE_COMP_OBJECT_SPECIALIZATION_FOR_PROPAGATE_CONST(equal_to) DEFINE_COMP_OBJECT_SPECIALIZATION_FOR_PROPAGATE_CONST(not_equal_to) DEFINE_COMP_OBJECT_SPECIALIZATION_FOR_PROPAGATE_CONST(less) DEFINE_COMP_OBJECT_SPECIALIZATION_FOR_PROPAGATE_CONST(greater) DEFINE_COMP_OBJECT_SPECIALIZATION_FOR_PROPAGATE_CONST(less_equal) DEFINE_COMP_OBJECT_SPECIALIZATION_FOR_PROPAGATE_CONST(greater_equal) #undef DEFINE_COMP_OBJECT_SPECIALIZATION } // namespace std #endif // KDTOOLBOX_PROPAGATE_CONST qbs-src-3.2.0/src/lib/corelib/tools/processutils.h0000644000175100017510000000423315154533055021530 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROCESSUTILS_H #define QBS_PROCESSUTILS_H #include #include #include namespace qbs { namespace Internal { QString QBS_AUTOTEST_EXPORT processNameByPid(qint64 pid); } // namespace Internal } // namespace qbs #endif // QBS_PROCESSUTILS_H qbs-src-3.2.0/src/lib/corelib/tools/pathutils.h0000644000175100017510000000461715154533055021014 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PATHUTILS_H #define QBS_PATHUTILS_H #include "hostosinfo.h" #include "qbs_export.h" namespace qbs { namespace Internal { class PathUtils { public: static QString toNativeSeparators(const QString &s, HostOsInfo::HostOs os = HostOsInfo::hostOs()) { QString value = s; if (os == HostOsInfo::HostOsWindows) value.replace(QLatin1Char('/'), HostOsInfo::pathSeparator(os)); return value; } }; } // namespace Internal } // namespace qbs #endif // QBS_PATHUTILS_H qbs-src-3.2.0/src/lib/corelib/tools/span.h0000644000175100017510000000542315154533055017734 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2020 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_SPAN_H #define QBS_SPAN_H #include // The (Apple) Clang implementation of span is incomplete until LLVM 15 / Xcode 14.3 / macOS 13 #if __cplusplus >= 202002L \ && !(defined(__apple_build_version__) && __apple_build_version__ < 14030022) #include namespace qbs { namespace Internal { using std::as_bytes; using std::as_writable_bytes; using std::get; using std::span; } // namespace Internal } // namespace qbs #else QT_WARNING_PUSH #if defined(Q_CC_MSVC) #pragma system_header #elif defined(Q_CC_GNU) || defined(Q_CC_CLANG) #pragma GCC system_header #endif // disable automatic usage of std::span in span-lite // since we make that decision ourselves at the top of this header #define span_CONFIG_SELECT_SPAN span_SPAN_NONSTD #include namespace qbs { namespace Internal { using namespace nonstd; } // namespace Internal } // namespace qbs QT_WARNING_POP #endif #endif // QBS_SPAN_Hqbs-src-3.2.0/src/lib/corelib/tools/jsliterals.cpp0000644000175100017510000001107515154533055021502 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "jsliterals.h" #include #include #include namespace qbs { QString toJSLiteral(const bool b) { return b ? Internal::StringConstants::trueValue() : Internal::StringConstants::falseValue(); } QString toJSLiteral(long long l) { return QString::number(l); } QString toJSLiteral(unsigned long long l) { return QString::number(l); } QString toJSLiteral(const QString &str) { QString js = str; js.replace(QRegularExpression(QLatin1String("([\\\\\"])")), QLatin1String("\\\\1")); js.prepend(QLatin1Char('"')); js.append(QLatin1Char('"')); return js; } QString toJSLiteral(const QStringList &strs) { QString js = QStringLiteral("["); for (int i = 0; i < strs.size(); ++i) { if (i != 0) js.append(QLatin1String(", ")); js.append(toJSLiteral(strs.at(i))); } js.append(QLatin1Char(']')); return js; } QString toJSLiteral(const QVariant &val) { if (!val.isValid()) return Internal::StringConstants::undefinedValue(); switch (val.userType()) { case QMetaType::QVariantList: case QMetaType::QStringList: { QString res; const auto list = val.toList(); for (const QVariant &child : list) { if (res.length()) res.append(QLatin1String(", ")); res.append(toJSLiteral(child)); } res.prepend(QLatin1Char('[')); res.append(QLatin1Char(']')); return res; } case QMetaType::QVariantMap: { const QVariantMap &vm = val.toMap(); QString str = QStringLiteral("{"); for (QVariantMap::const_iterator it = vm.begin(); it != vm.end(); ++it) { if (it != vm.begin()) str += QLatin1Char(','); str += toJSLiteral(it.key()) + QLatin1Char(':') + toJSLiteral(it.value()); } str += QLatin1Char('}'); return str; } case QMetaType::Bool: return toJSLiteral(val.toBool()); case QMetaType::Char: case QMetaType::Int: case QMetaType::Long: case QMetaType::LongLong: return toJSLiteral(val.toLongLong()); case QMetaType::UChar: case QMetaType::UInt: case QMetaType::ULong: case QMetaType::ULongLong: return toJSLiteral(val.toULongLong()); case QMetaType::QVariantHash: { const QVariantHash h = val.toHash(); if (h.size() == 1 && h.constBegin().key().isEmpty()) return toJSLiteral(*h.constBegin()); break; } default: break; } if (qVariantCanConvert(val, QMetaType::QString)) return toJSLiteral(val.toString()); return QStringLiteral("Unconvertible type %1").arg(QLatin1String(val.typeName())); } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/porting.h0000644000175100017510000000410715154533055020453 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 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_TOOLS_PORTING_H #define QBS_TOOLS_PORTING_H #include namespace qbs { #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) using QHashValueType = uint; #else using QHashValueType = size_t; #endif } #endif qbs-src-3.2.0/src/lib/corelib/tools/scripttools.h0000644000175100017510000002006015154533055021352 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SCRIPTTOOLS_H #define QBS_SCRIPTTOOLS_H #include "codelocation.h" #include "porting.h" #include "qbs_export.h" #include #include #include #include #include #include #include namespace qbs { class ErrorInfo; namespace Internal { class ScriptEngine; using JSValueList = std::vector; void defineJsProperty(JSContext *ctx, JSValueConst obj, const QString &prop, JSValue val); JSValue getJsProperty(JSContext *ctx, JSValueConst obj, const QString &prop); void setJsProperty(JSContext *ctx, JSValueConst obj, std::string_view prop, JSValue val); void setJsProperty(JSContext *ctx, JSValueConst obj, const QString &prop, JSValue val); void setJsProperty(JSContext *ctx, JSValueConst obj, const QString &prop, const QString &val); QString getJsStringProperty(JSContext *ctx, JSValueConst obj, const QString &prop); QStringList getJsStringListProperty(JSContext *ctx, JSValueConst obj, const QString &prop); int getJsIntProperty(JSContext *ctx, JSValueConst obj, const QString &prop); bool getJsBoolProperty(JSContext *ctx, JSValueConst obj, const QString &prop); QVariant getJsVariantProperty(JSContext *ctx, JSValueConst obj, const QString &prop); QString getJsString(JSContext *ctx, JSValueConst val); QString getJsString(JSContext *ctx, JSAtom atom); QBS_AUTOTEST_EXPORT QVariant getJsVariant(JSContext *ctx, JSValueConst val); JSValue makeJsArrayBuffer(JSContext *ctx, const QByteArray &s); JSValue makeJsString(JSContext *ctx, const QString &s); JSValue makeJsStringList(JSContext *ctx, const QStringList &l); JSValue makeJsVariant(JSContext *ctx, const QVariant &v, quintptr id = 0); JSValue makeJsVariantList(JSContext *ctx, const QVariantList &l, quintptr id = 0); JSValue makeJsVariantMap(JSContext *ctx, const QVariantMap &m, quintptr id = 0); QStringList getJsStringList(JSContext *ctx, JSValueConst val); JSValue throwError(JSContext *ctx, const QString &message); using PropertyHandler = std::function; void handleJsProperties(JSContext *ctx, JSValueConst obj, const PropertyHandler &handler); inline quintptr jsObjectId(const JSValue &val) { return quintptr(JS_VALUE_GET_OBJ(val)); } template void attachPointerTo(JSValue &scriptValue, T *ptr) { JS_SetOpaque(scriptValue, const_cast *>(ptr)); } template T *attachedPointer(const JSValue &scriptValue, JSClassID id) { return reinterpret_cast(JS_GetOpaque(scriptValue, id)); } class TemporaryGlobalObjectSetter { public: TemporaryGlobalObjectSetter(ScriptEngine *engine, const JSValue &object); ~TemporaryGlobalObjectSetter(); private: ScriptEngine * const m_engine; const JSValue m_oldGlobalObject; }; class ScopedJsValue { public: ScopedJsValue(JSContext *ctx, JSValue v) : m_context(ctx), m_value(v) {} void setValue(JSValue v) { JS_FreeValue(m_context, m_value); m_value = v; } ~ScopedJsValue() { JS_FreeValue(m_context, m_value); } operator JSValue() const { return m_value; } JSValue release() { const JSValue v = m_value; m_value = JS_UNDEFINED; return v; } void reset(JSValue v) { JS_FreeValue(m_context, m_value); m_value = v; } ScopedJsValue(const ScopedJsValue &) = delete; ScopedJsValue &operator=(const ScopedJsValue &) = delete; ScopedJsValue(ScopedJsValue && other) : m_context(other.m_context), m_value(other.m_value) { other.m_value = JS_UNDEFINED; } private: JSContext * const m_context; JSValue m_value; }; class ScopedJsValueList { public: ScopedJsValueList(JSContext *ctx, const JSValueList &l) : m_context(ctx), m_list(l) {} ~ScopedJsValueList() { for (const JSValue v : m_list) JS_FreeValue(m_context, v); } operator JSValueList() const { return m_list; } ScopedJsValueList(const ScopedJsValueList &) = delete; ScopedJsValueList &operator=(const ScopedJsValueList &) = delete; ScopedJsValueList(ScopedJsValueList && other) noexcept : m_context(other.m_context), m_list(std::move(other.m_list)) { other.m_list.clear(); } private: JSContext * const m_context; JSValueList m_list; }; class ScopedJsAtom { public: ScopedJsAtom(JSContext *ctx, JSAtom a) : m_context(ctx), m_atom(a) {} ScopedJsAtom(JSContext *ctx, const QByteArray &s) : ScopedJsAtom(ctx, JS_NewAtom(ctx, s.constData())) {} ScopedJsAtom(JSContext *ctx, const QString &s) : ScopedJsAtom(ctx, s.toUtf8()) {} ~ScopedJsAtom() { JS_FreeAtom(m_context, m_atom); } operator JSAtom() const { return m_atom; } ScopedJsAtom(const ScopedJsAtom &) = delete; ScopedJsAtom&operator=(const ScopedJsAtom &) = delete; ScopedJsAtom(ScopedJsAtom &&other) : m_context(other.m_context), m_atom(other.m_atom) { other.m_atom = 0; } private: JSContext * const m_context; JSAtom m_atom; }; class QBS_AUTOTEST_EXPORT JsException { public: JsException(JSContext *ctx, JSValue ex, JSValue bt, const CodeLocation &fallbackLocation) : m_ctx(ctx) , m_exception(ex) , m_backtrace(bt) , m_fallbackLocation(fallbackLocation) {} JsException(JsException && other) noexcept; ~JsException(); JsException(const JsException &) = delete; JsException &operator=(const JsException &) = delete; operator bool() const { return !JS_IsUninitialized(m_exception); } QString message() const; const QStringList stackTrace() const; ErrorInfo toErrorInfo() const; private: JSContext *m_ctx; JSValue m_exception; JSValue m_backtrace; CodeLocation m_fallbackLocation; }; void setConfigProperty(QVariantMap &cfg, const QStringList &name, const QVariant &value); QVariant QBS_AUTOTEST_EXPORT getConfigProperty(const QVariantMap &cfg, const QStringList &name); } // namespace Internal } // namespace qbs // Only to be used for objects! #ifndef JS_NAN_BOXING inline bool operator==(JSValue v1, JSValue v2) { return v1.u.ptr == v2.u.ptr; } inline bool operator!=(JSValue v1, JSValue v2) { return !(v1 == v2); } inline bool operator<(JSValue v1, JSValue v2) { return v1.u.ptr < v2.u.ptr; } inline qbs::QHashValueType qHash(const JSValue &v) { return QT_PREPEND_NAMESPACE(qHash)(v.u.ptr); } #endif #endif // QBS_SCRIPTTOOLS_H qbs-src-3.2.0/src/lib/corelib/tools/persistence.h0000644000175100017510000004247715154533055021331 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PERSISTENCE #define QBS_PERSISTENCE #include "error.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { class NoBuildGraphError : public ErrorInfo { public: NoBuildGraphError(const QString &filePath); }; template struct PPHelper; class PersistentPool { public: PersistentPool(Logger &logger); ~PersistentPool(); class HeadData { public: QVariantMap projectConfig; }; template void store(const Types &...args) { (... , PPHelper::store(args, this)); } template void load(Types &...args) { (... , PPHelper::load(args, this)); } template T load() { T tmp; PPHelper::load(tmp, this); return tmp; } enum OpType { Store, Load }; template void serializationOp(const Types &...args) { static_assert(type == Store); store(args...); } template void serializationOp(Types &...args) { if constexpr(type == Store) store(args...); else load(args...); } void load(const QString &filePath); void setupWriteStream(const QString &filePath); void finalizeWriteStream(); void clear(); const HeadData &headData() const { return m_headData; } void setHeadData(const HeadData &hd) { m_headData = hd; } private: using PersistentObjectId = int; template T *idLoad(); template std::shared_ptr idLoadS(); template T idLoadValue(); void doLoadValue(QString &s); void doLoadValue(QStringList &l); void doLoadValue(QProcessEnvironment &env); template void storeSharedObject(const T *object); void storeVariant(const QVariant &variant); QVariant loadVariant(); template void idStoreValue(const T &value); void doStoreValue(const QString &s); void doStoreValue(const QStringList &l); void doStoreValue(const QProcessEnvironment &env); template std::vector &idStorage(); template QHash &idMap(); template PersistentObjectId &lastStoredId(); static const inline PersistentObjectId ValueNotFoundId = -1; static const inline PersistentObjectId EmptyValueId = -2; static const inline PersistentObjectId NullValueId = -3; std::unique_ptr m_file; QDataStream m_stream; HeadData m_headData; std::vector m_loadedRaw; std::vector> m_loaded; std::unordered_map m_storageIndices; PersistentObjectId m_lastStoredObjectId = 0; std::vector m_stringStorage; QHash m_inverseStringStorage; PersistentObjectId m_lastStoredStringId = 0; std::vector m_envStorage; QHash m_inverseEnvStorage; PersistentObjectId m_lastStoredEnvId = 0; std::vector m_stringListStorage; QHash m_inverseStringListStorage; PersistentObjectId m_lastStoredStringListId = 0; Logger &m_logger; template friend struct PPHelper; }; template inline const void *uniqueAddress(const T *t) { return t; } template inline void PersistentPool::storeSharedObject(const T *object) { if (!object) { m_stream << -1; return; } const void * const addr = uniqueAddress(object); const auto found = m_storageIndices.find(addr); if (found == m_storageIndices.end()) { PersistentObjectId id = m_lastStoredObjectId++; m_storageIndices[addr] = id; m_stream << id; store(*object); } else { m_stream << found->second; } } template inline T *PersistentPool::idLoad() { PersistentObjectId id; m_stream >> id; if (id < 0) return nullptr; if (id < static_cast(m_loadedRaw.size())) return static_cast(m_loadedRaw.at(id)); auto i = m_loadedRaw.size(); m_loadedRaw.resize(id + 1); for (; i < m_loadedRaw.size(); ++i) m_loadedRaw[i] = nullptr; const auto t = new T; m_loadedRaw[id] = t; load(*t); return t; } template<> inline std::vector &PersistentPool::idStorage() { return m_stringStorage; } template<> inline QHash &PersistentPool::idMap() { return m_inverseStringStorage; } template<> inline PersistentPool::PersistentObjectId &PersistentPool::lastStoredId() { return m_lastStoredStringId; } template<> inline std::vector &PersistentPool::idStorage() { return m_stringListStorage; } template<> inline QHash &PersistentPool::idMap() { return m_inverseStringListStorage; } template<> inline PersistentPool::PersistentObjectId &PersistentPool::lastStoredId() { return m_lastStoredStringListId; } template<> inline std::vector &PersistentPool::idStorage() { return m_envStorage; } template<> inline QHash &PersistentPool::idMap() { return m_inverseEnvStorage; } template<> inline PersistentPool::PersistentObjectId &PersistentPool::lastStoredId() { return m_lastStoredEnvId; } template inline std::shared_ptr PersistentPool::idLoadS() { PersistentObjectId id; m_stream >> id; if (id < 0) return std::shared_ptr(); if (id < static_cast(m_loaded.size())) return std::static_pointer_cast(m_loaded.at(id)); m_loaded.resize(id + 1); const std::shared_ptr t = T::create(); m_loaded[id] = t; load(*t); return t; } template inline T PersistentPool::idLoadValue() { int id; m_stream >> id; if (id == NullValueId) return T(); if (id == EmptyValueId) { if constexpr (std::is_same_v) return QString(0, QChar()); return T(); } QBS_CHECK(id >= 0); if (id >= static_cast(idStorage().size())) { T value; doLoadValue(value); idStorage().resize(id + 1); idStorage()[id] = value; return value; } return idStorage().at(id); } template void PersistentPool::idStoreValue(const T &value) { if constexpr (std::is_same_v) { if (value.isNull()) { m_stream << NullValueId; return; } } if (value.isEmpty()) { m_stream << EmptyValueId; return; } int id = idMap().value(value, ValueNotFoundId); if (id < 0) { id = lastStoredId()++; idMap().insert(value, id); m_stream << id; doStoreValue(value); } else { m_stream << id; } } // We need a helper class template, because we require partial specialization for some of // the aggregate types, which is not possible with function templates. // The generic implementation assumes that T is of class type and has load() and store() // member functions. template struct PPHelper { static void store(const T &object, PersistentPool *pool) { const_cast(object).store(*pool); } static void load(T &object, PersistentPool *pool) { object.load(*pool); } }; /***** Specializations of Helper class *****/ template struct PPHelper)>>> { static void store(const T &value, PersistentPool *pool) { const_cast(value).template completeSerializationOp(*pool); } static void load(T &value, PersistentPool *pool) { value.template completeSerializationOp(*pool); } }; template struct PPHelper>> { static void store(const T &value, PersistentPool *pool) { pool->m_stream << value; } static void load(T &value, PersistentPool *pool) { pool->m_stream >> value; } }; template<> struct PPHelper { static void store(long value, PersistentPool *pool) { pool->m_stream << qint64(value); } static void load(long &value, PersistentPool *pool) { qint64 v; pool->m_stream >> v; value = long(v); } }; template struct PPHelper>> { using U = std::underlying_type_t; static void store(const T &value, PersistentPool *pool) { pool->m_stream << static_cast(value); } static void load(T &value, PersistentPool *pool) { pool->m_stream >> reinterpret_cast(value); } }; template struct PPHelper> { static void store(const std::shared_ptr &value, PersistentPool *pool) { pool->store(value.get()); } static void load(std::shared_ptr &value, PersistentPool *pool) { value = pool->idLoadS>(); } }; template struct PPHelper> { static void store(const std::unique_ptr &value, PersistentPool *pool) { pool->store(value.get()); } static void load(std::unique_ptr &ptr, PersistentPool *pool) { ptr.reset(pool->idLoad>()); } }; template struct PPHelper { static void store(const T *value, PersistentPool *pool) { pool->storeSharedObject(value); } static void load(T* &value, PersistentPool *pool) { value = pool->idLoad(); } }; template struct PPHelper || std::is_same_v || std::is_same_v>> { static void store(const T &v, PersistentPool *pool) { pool->idStoreValue(v); } static void load(T &v, PersistentPool *pool) { v = pool->idLoadValue(); } }; template<> struct PPHelper { static void store(const QVariant &v, PersistentPool *pool) { pool->storeVariant(v); } static void load(QVariant &v, PersistentPool *pool) { v = pool->loadVariant(); } }; template<> struct PPHelper { static void store(const QRegularExpression &re, PersistentPool *pool) { pool->store(re.pattern()); } static void load(QRegularExpression &re, PersistentPool *pool) { re.setPattern(pool->load()); } }; template struct PPHelper> { static void store(const std::pair &pair, PersistentPool *pool) { pool->store(pair.first); pool->store(pair.second); } static void load(std::pair &pair, PersistentPool *pool) { pool->load(pair.first); pool->load(pair.second); } }; template struct PPHelper> { template static void storeHelper( std::index_sequence, const std::tuple &tuple, PersistentPool *pool) { (pool->store(std::get(tuple)), ...); } static void store(const std::tuple &tuple, PersistentPool *pool) { storeHelper(std::make_index_sequence(), tuple, pool); } template static void loadHelper( std::index_sequence, std::tuple &tuple, PersistentPool *pool) { (pool->load(std::get(tuple)), ...); } static void load(std::tuple &tuple, PersistentPool * pool) { loadHelper(std::make_index_sequence(), tuple, pool); } }; template struct PPHelper> { using Int = typename QFlags::Int; static void store(const QFlags &flags, PersistentPool *pool) { pool->store(flags); } static void load(QFlags &flags, PersistentPool *pool) { flags = QFlags(pool->load()); } }; template struct IsSimpleContainer : std::false_type { }; template struct IsSimpleContainer> : std::true_type { }; template<> struct IsSimpleContainer : std::false_type { }; template struct IsSimpleContainer> : std::true_type { }; template struct PPHelper::value>> { static void store(const T &container, PersistentPool *pool) { pool->store(int(container.size())); for (auto it = container.cbegin(); it != container.cend(); ++it) pool->store(*it); } static void load(T &container, PersistentPool *pool) { const int count = pool->load(); container.clear(); container.reserve(count); for (int i = count; --i >= 0;) container.push_back(pool->load()); } }; template struct IsKeyValueContainer : std::false_type { }; template struct IsKeyValueContainer> : std::true_type { }; template struct IsKeyValueContainer> : std::true_type { }; template struct PPHelper::value>> { static void store(const T &container, PersistentPool *pool) { pool->store(int(container.size())); for (auto it = container.cbegin(); it != container.cend(); ++it) { pool->store(it.key()); pool->store(it.value()); } } static void load(T &container, PersistentPool *pool) { container.clear(); const int count = pool->load(); for (int i = 0; i < count; ++i) { const auto &key = pool->load(); const auto &value = pool->load(); container.insert(key, value); } } }; template struct PPHelper> { static void store(const std::unordered_map &map, PersistentPool *pool) { pool->store(quint32(map.size())); for (auto it = map.cbegin(); it != map.cend(); ++it) pool->store(*it); } static void load(std::unordered_map &map, PersistentPool *pool) { map.clear(); const auto count = pool->load(); for (std::size_t i = 0; i < count; ++i) map.insert(pool->load>()); } }; template struct PPHelper> { static const inline int ValueMarker = -2; static const inline int NoValueMarker = -1; static void store(const std::optional &v, PersistentPool *pool) { if (v) { pool->store(ValueMarker); pool->store(*v); } else { pool->store(NoValueMarker); } } static void load(std::optional &v, PersistentPool *pool) { const int marker = pool->load(); if (marker == ValueMarker) v = pool->load(); } }; } // namespace Internal } // namespace qbs #endif qbs-src-3.2.0/src/lib/corelib/tools/preferences.h0000644000175100017510000000601315154533055021270 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PREFERENCES_H #define QBS_PREFERENCES_H #include "qbs_export.h" #include "commandechomode.h" #include "joblimits.h" #include "settings.h" #include #include namespace qbs { class Settings; class QBS_EXPORT Preferences { public: explicit Preferences(Settings *settings, QString profileName = QString()); Preferences(Settings *settings, QVariantMap profileContents); bool useColoredOutput() const; int jobs() const; QString shell() const; QString defaultBuildDirectory() const; CommandEchoMode defaultEchoMode() const; QStringList searchPaths(const QString &baseDir = QString()) const; QStringList pluginPaths(const QString &baseDir = QString()) const; JobLimits jobLimits() const; private: QVariant getPreference(const QString &key, const QVariant &defaultValue = QVariant()) const; QStringList pathList(const QString &key, const QString &defaultValue) const; bool ignoreSystemSearchPaths() const; Settings::Scopes scopesForSearchPaths() const; Settings *m_settings; QString m_profile; QVariantMap m_profileContents; }; } // namespace qbs #endif // Header guard qbs-src-3.2.0/src/lib/corelib/tools/processresult.cpp0000644000175100017510000001135315154533055022242 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "processresult.h" #include "processresult_p.h" #include #include /*! * \class SetupProjectParameters * \brief The \c ProcessResult class describes a finished qbs process command. */ namespace qbs { ProcessResult::ProcessResult() : d(new Internal::ProcessResultPrivate) { } ProcessResult::ProcessResult(const ProcessResult &other) = default; ProcessResult &ProcessResult::operator=(const ProcessResult &other) = default; ProcessResult::~ProcessResult() = default; /*! * \brief Returns true iff the command finished successfully. */ bool ProcessResult::success() const { return d->success; } /*! * \brief Returns the file path of the executable that was run. */ QString ProcessResult::executableFilePath() const { return d->executableFilePath; } /*! * \brief Returns the command-line arguments with which the command was invoked. */ QStringList ProcessResult::arguments() const { return d->arguments; } /*! * \brief Returns the working directory of the invoked command. */ QString ProcessResult::workingDirectory() const { return d->workingDirectory; } /*! * \brief Returns the error status of the process. If no error occurred, the value * is \c Process::UnknownError. */ QProcess::ProcessError ProcessResult::error() const { return d->error; } /*! * \brief Returns the exit code of the command. */ int ProcessResult::exitCode() const { return d->exitCode; } /*! * \brief Returns the data the command wrote to the standard output channel. */ QStringList ProcessResult::stdOut() const { return d->stdOut; } /*! * \brief Returns the data the command wrote to the standard error channel. */ QStringList ProcessResult::stdErr() const { return d->stdErr; } static QJsonValue processErrorToJson(QProcess::ProcessError error) { switch (error) { case QProcess::FailedToStart: return QLatin1String("failed-to-start"); case QProcess::Crashed: return QLatin1String("crashed"); case QProcess::Timedout: return QLatin1String("timed-out"); case QProcess::WriteError: return QLatin1String("write-error"); case QProcess::ReadError: return QLatin1String("read-error"); case QProcess::UnknownError: return QStringLiteral("unknown-error"); } return {}; // For dumb compilers. } QJsonObject qbs::ProcessResult::toJson() const { return QJsonObject{ {QStringLiteral("success"), success()}, {QStringLiteral("executable-file-path"), executableFilePath()}, {QStringLiteral("arguments"), QJsonArray::fromStringList(arguments())}, {QStringLiteral("working-directory"), workingDirectory()}, {QStringLiteral("error"), processErrorToJson(error())}, {QStringLiteral("exit-code"), exitCode()}, {QStringLiteral("stdout"), QJsonArray::fromStringList(stdOut())}, {QStringLiteral("stderr"), QJsonArray::fromStringList(stdErr())} }; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/profiling.h0000644000175100017510000000520315154533055020760 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PROFILING_H #define QBS_PROFILING_H #include #include QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE namespace qbs { namespace Internal { class Logger; QString elapsedTimeString(qint64 elapsedTimeInNs); class TimedActivityLogger { public: TimedActivityLogger(const Logger &logger, const QString &activity, bool enabled); void finishActivity(); ~TimedActivityLogger(); private: class TimedActivityLoggerPrivate; std::unique_ptr d; }; class AccumulatingTimer { public: AccumulatingTimer(qint64 *elapsedTime); ~AccumulatingTimer(); void stop(); private: QElapsedTimer m_timer; qint64 * const m_elapsedTime; }; } // namespace Internal } // namespace qbs #endif // Header guard qbs-src-3.2.0/src/lib/corelib/tools/fileinfo.mm0000644000175100017510000000650315154533055020750 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com) ** 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$ ** ****************************************************************************/ #include "fileinfo.h" #include #import #include #include namespace qbs { namespace Internal { // unlike QFile::copy, this function retains HFS+ attributes bool nsCopyFile(const QString &srcFilePath, const QString &tgtFilePath, QString *errorMessage) { @autoreleasepool { NSString *sourcePath = srcFilePath.toNSString(); NSString *destinationPath = tgtFilePath.toNSString(); NSFileManager *fileManager = [NSFileManager defaultManager]; if (![fileManager fileExistsAtPath:sourcePath]) { if (errorMessage) { *errorMessage = Tr::tr("Source file '%1' does not exist") .arg(QDir::toNativeSeparators(srcFilePath)); } return false; } NSError *copyError = nil; BOOL success = [fileManager copyItemAtPath:sourcePath toPath:destinationPath error:©Error]; if (!success) { if (errorMessage) { NSString *errorDesc = copyError.localizedDescription; *errorMessage = Tr::tr("Could not copy file '%1' to '%2'. %3") .arg(QDir::toNativeSeparators(srcFilePath)) .arg(QDir::toNativeSeparators(tgtFilePath)) .arg(QString::fromNSString(errorDesc)); } return false; } return true; } } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/settingsmodel.h0000644000175100017510000000705015154533055021652 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SETTINGSMODEL_H #define QBS_SETTINGSMODEL_H #include #include #include #include #include namespace qbs { class QBS_EXPORT SettingsModel : public QAbstractItemModel { Q_OBJECT public: SettingsModel(const QString &settingsDir, Settings::Scope scope, QObject *parent = nullptr); ~SettingsModel() override; int keyColumn() const { return 0; } int valueColumn() const { return 1; } bool hasUnsavedChanges() const; void setEditable(bool isEditable); void setAdditionalProperties(const QVariantMap &properties); // Flat map. void reload(); void save(); void updateSettingsDir(const QString &settingsDir); void addNewKey(const QModelIndex &parent); void removeKey(const QModelIndex &index); Qt::ItemFlags flags(const QModelIndex &index) const override; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex &child) const override; private: class SettingsModelPrivate; const std::unique_ptr d; }; } // namespace qbs #endif // QBS_SETTINGSMODEL_H qbs-src-3.2.0/src/lib/corelib/tools/stringutils.h0000644000175100017510000000671315154533055021365 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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_STRINGUTILS_H #define QBS_STRINGUTILS_H #include #include #include #include namespace qbs { namespace Internal { template typename C::value_type join(const C &container, const typename C::value_type &separator) { typename C::value_type out; if (!container.empty()) { auto it = container.cbegin(); auto end = container.cend(); out.append(*it++); for (; it != end; ++it) { out.append(separator); out.append(*it); } } return out; } template typename C::value_type join(const C &container, typename C::value_type::value_type separator) { typename C::value_type s; s.push_back(separator); return join(container, s); } static inline std::string trimmed(const std::string &s) { // trim from start static const auto ltrim = [](std::string &s) -> std::string & { s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](char c){ return !std::isspace(c); })); return s; }; // trim from end static const auto rtrim = [](std::string &s) -> std::string & { s.erase(std::find_if(s.rbegin(), s.rend(), [](char c){ return !std::isspace(c); }).base(), s.end()); return s; }; // trim from both ends static const auto trim = [](std::string &s) -> std::string & { return ltrim(rtrim(s)); }; std::string copy = s; return trim(copy); } } // namespace Internal } // namespace qbs #ifdef Q_DECLARE_METATYPE Q_DECLARE_METATYPE(std::string) #endif #endif // QBS_STRINGUTILS_H qbs-src-3.2.0/src/lib/corelib/tools/iosutils.h0000644000175100017510000000717215154533055020651 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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_IOSUTILS_H #define QBS_IOSUTILS_H #include #include #include #if defined(_WIN32) && defined(_MSC_VER) #include #include #define QBS_RENAME_IMPL ::_wrename #define QBS_UNLINK_IMPL ::_wunlink using qbs_filesystem_path_string_type = std::wstring; #else #include #define QBS_RENAME_IMPL ::rename #define QBS_UNLINK_IMPL ::unlink using qbs_filesystem_path_string_type = std::string; #endif namespace qbs { namespace Internal { static inline bool fwrite(const char *values, size_t nitems, std::ostream *stream) { if (!stream) return false; stream->write(values, nitems); return stream->good(); } template bool fwrite(const C &container, std::ostream *stream) { return fwrite(&*(std::begin(container)), container.size(), stream); } static inline bool fwrite(const char *s, std::ostream *stream) { return fwrite(s, strlen(s), stream); } static inline qbs_filesystem_path_string_type utf8_to_native_path(const std::string &str) { #if defined(_WIN32) && defined(_MSC_VER) const int size = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0); std::wstring result(size, 0); MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), result.data(), size); return result; #else return str; #endif } static inline int rename(const std::string &oldName, const std::string &newName) { const auto wOldName = utf8_to_native_path(oldName); const auto wNewName = utf8_to_native_path(newName); return QBS_RENAME_IMPL(wOldName.c_str(), wNewName.c_str()); } static inline int unlink(const std::string &name) { const auto wName = utf8_to_native_path(name); return QBS_UNLINK_IMPL(wName.c_str()); } } // namespace Internal } // namespace qbs #endif // QBS_IOSUTILS_H qbs-src-3.2.0/src/lib/corelib/tools/commandechomode.h0000644000175100017510000000501515154533055022112 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Jake Petroules. ** 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_COMMANDECHOMODE_H #define QBS_COMMANDECHOMODE_H #include "qbs_export.h" #include #include namespace qbs { enum CommandEchoMode { CommandEchoModeSilent, CommandEchoModeSummary, CommandEchoModeCommandLine, CommandEchoModeCommandLineWithEnvironment, CommandEchoModeInvalid, }; QBS_EXPORT CommandEchoMode defaultCommandEchoMode(); QBS_EXPORT QString commandEchoModeName(CommandEchoMode mode); QBS_EXPORT CommandEchoMode commandEchoModeFromName(const QString &name); QBS_EXPORT QStringList allCommandEchoModeStrings(); } // namespace qbs #endif // QBS_COMMANDECHOMODE_H qbs-src-3.2.0/src/lib/corelib/tools/architectures.cpp0000644000175100017510000001336415154533055022176 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2015 Petroules Corporation. ** 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$ ** ****************************************************************************/ #include "architectures.h" #include "stringconstants.h" #include #include namespace qbs { using namespace Internal; QString canonicalTargetArchitecture(const QString &architecture, const QString &endianness, const QString &vendor, const QString &system, const QString &abi) { QString arch = canonicalArchitecture(architecture); const bool isApple = (vendor == QStringLiteral("apple") || system == QStringLiteral("darwin") || system == QStringLiteral("macosx") || system == QStringLiteral("ios") || system == QStringLiteral("tvos") || system == QStringLiteral("watchos") || abi == QStringLiteral("macho")); const bool isQnx = (system == QStringLiteral("nto") || abi.startsWith(QStringLiteral("qnx"))); if (arch == QStringLiteral("armv7a")) { if (isApple) return StringConstants::armv7Arch(); if (isQnx) return StringConstants::armArch(); } if (arch == StringConstants::arm64Arch() && isQnx) return StringConstants::aarch64Arch(); if (arch == StringConstants::x86Arch()) { if (isQnx) return StringConstants::i586Arch(); return StringConstants::i386Arch(); } if (arch == StringConstants::mipsArch() || arch == StringConstants::mips64Arch()) { if (endianness == QStringLiteral("big")) return arch + QStringLiteral("eb"); if (endianness == QStringLiteral("little")) return arch + QStringLiteral("el"); } if (arch == StringConstants::ppcArch()) return StringConstants::powerPcArch(); if (arch == StringConstants::ppc64Arch() && endianness == QStringLiteral("little")) return arch + QStringLiteral("le"); return arch; } QString canonicalArchitecture(const QString &architecture) { QMap archMap; archMap.insert(StringConstants::x86Arch(), QStringList() << StringConstants::i386Arch() << QStringLiteral("i486") << StringConstants::i586Arch() << QStringLiteral("i686") << QStringLiteral("ia32") << QStringLiteral("ia-32") << QStringLiteral("x86_32") << QStringLiteral("x86-32") << QStringLiteral("intel32") << QStringLiteral("mingw32")); archMap.insert(StringConstants::x86_64Arch(), QStringList() << QStringLiteral("x86-64") << QStringLiteral("x64") << StringConstants::amd64Arch() << QStringLiteral("ia32e") << QStringLiteral("em64t") << QStringLiteral("intel64") << QStringLiteral("mingw64")); archMap.insert(StringConstants::arm64Arch(), QStringList() << StringConstants::aarch64Arch()); archMap.insert(QStringLiteral("ia64"), QStringList() << QStringLiteral("ia-64") << QStringLiteral("itanium")); archMap.insert(StringConstants::ppcArch(), QStringList() << StringConstants::powerPcArch()); archMap.insert(StringConstants::ppc64Arch(), QStringList() << QStringLiteral("ppc64le") << QStringLiteral("powerpc64") << QStringLiteral("powerpc64le")); archMap.insert(StringConstants::mipsArch(), QStringList() << QStringLiteral("mipseb") << QStringLiteral("mipsel")); archMap.insert(StringConstants::mips64Arch(), QStringList() << QStringLiteral("mips64eb") << QStringLiteral("mips64el")); for (auto i = archMap.cbegin(), end = archMap.cend(); i != end; ++i) { if (i.value().contains(architecture.toLower())) return i.key(); } return architecture; } } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/setupprojectparameters.h0000644000175100017510000001304415154533055023604 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SETUPPROJECTPARAMETERS_H #define QBS_SETUPPROJECTPARAMETERS_H #include "qbs_export.h" #include #include #include #include QT_BEGIN_NAMESPACE class QProcessEnvironment; using QVariantMap = QMap; QT_END_NAMESPACE namespace qbs { class Profile; class Settings; namespace Internal { class SetupProjectParametersPrivate; } enum class ErrorHandlingMode { Strict, Relaxed }; class QBS_EXPORT SetupProjectParameters { public: SetupProjectParameters(); SetupProjectParameters(const SetupProjectParameters &other); SetupProjectParameters(SetupProjectParameters &&other) Q_DECL_NOEXCEPT; ~SetupProjectParameters(); SetupProjectParameters &operator=(const SetupProjectParameters &other); SetupProjectParameters &operator=(SetupProjectParameters &&other) Q_DECL_NOEXCEPT; static SetupProjectParameters fromJson(const QJsonObject &data); QString topLevelProfile() const; void setTopLevelProfile(const QString &profile); QString configurationName() const; void setConfigurationName(const QString &configurationName); QString projectFilePath() const; void setProjectFilePath(const QString &projectFilePath); void finalizeProjectFilePath(); QString buildRoot() const; void setBuildRoot(const QString &buildRoot); QStringList searchPaths() const; void setSearchPaths(const QStringList &searchPaths); QStringList pluginPaths() const; void setPluginPaths(const QStringList &pluginPaths); QString libexecPath() const; void setLibexecPath(const QString &libexecPath); QString settingsDirectory() const; void setSettingsDirectory(const QString &settingsBaseDir); int maxJobCount() const; void setMaxJobCount(int jobCount); QVariantMap overriddenValues() const; void setOverriddenValues(const QVariantMap &values); QVariantMap overriddenValuesTree() const; static QVariantMap expandedBuildConfiguration(const Profile &profile, const QString &configurationName, ErrorInfo *errorInfo = nullptr); ErrorInfo expandBuildConfiguration(); QVariantMap buildConfiguration() const; QVariantMap buildConfigurationTree() const; static QVariantMap finalBuildConfigurationTree(const QVariantMap &buildConfig, const QVariantMap &overriddenValues); QVariantMap finalBuildConfigurationTree() const; bool overrideBuildGraphData() const; void setOverrideBuildGraphData(bool doOverride); bool dryRun() const; void setDryRun(bool dryRun); bool logElapsedTime() const; void setLogElapsedTime(bool logElapsedTime); bool forceProbeExecution() const; void setForceProbeExecution(bool force); bool waitLockBuildGraph() const; void setWaitLockBuildGraph(bool wait); QProcessEnvironment environment() const; void setEnvironment(const QProcessEnvironment &env); QProcessEnvironment adjustedEnvironment() const; enum RestoreBehavior { RestoreOnly, ResolveOnly, RestoreAndTrackChanges, RestoreAndResolve }; RestoreBehavior restoreBehavior() const; void setRestoreBehavior(RestoreBehavior behavior); ErrorHandlingMode propertyCheckingMode() const; void setPropertyCheckingMode(ErrorHandlingMode mode); ErrorHandlingMode productErrorMode() const; void setProductErrorMode(ErrorHandlingMode mode); DeprecationWarningMode deprecationWarningMode() const; void setDeprecationWarningMode(DeprecationWarningMode mode); private: QSharedDataPointer d; }; } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/tools/settingscreator.h0000644000175100017510000000504715154533055022215 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SETTINGSCREATOR_H #define QBS_SETTINGSCREATOR_H #include "version.h" #include #include QT_BEGIN_NAMESPACE class QSettings; QT_END_NAMESPACE namespace qbs { namespace Internal { class SettingsCreator { public: SettingsCreator(QString baseDir); std::unique_ptr getQSettings(); private: void migrate(); void createQSettings(); Version predecessor() const; QString m_settingsBaseDir; QString m_newSettingsDir; QString m_settingsFileName; QString m_newSettingsFilePath; std::unique_ptr m_settings; const Version m_qbsVersion; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/tools/buildgraphlocker.h0000644000175100017510000000544215154533055022315 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_BUILDGRAPHLOCKER_H #define QBS_BUILDGRAPHLOCKER_H #include #include #include #include namespace qbs { namespace Internal { class ProgressObserver; class DirectoryManager { public: DirectoryManager(QString dir, Logger logger); ~DirectoryManager(); QString dir() const { return m_dir; } private: void rememberCreatedDirectories(); void removeEmptyCreatedDirectories(); std::queue m_createdParentDirs; const QString m_dir; Logger m_logger; }; class BuildGraphLocker { public: explicit BuildGraphLocker(const QString &buildGraphFilePath, const Logger &logger, bool waitIndefinitely, ProgressObserver *observer); ~BuildGraphLocker(); private: QLockFile m_lockFile; Logger m_logger; DirectoryManager m_dirManager; }; } // namespace Internal } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/lib/corelib/tools/launchersocket.h0000644000175100017510000000600515154533055022002 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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_LAUNCHERSOCKET_H #define QBS_LAUNCHERSOCKET_H #include "launcherpackets.h" #include #include #include QT_BEGIN_NAMESPACE class QLocalSocket; QT_END_NAMESPACE namespace qbs { namespace Internal { class LauncherInterface; class LauncherSocket : public QObject { Q_OBJECT friend class LauncherInterface; public: bool isReady() const { return m_socket.load(); } void sendData(const QByteArray &data); signals: void ready(); void errorOccurred(const QString &error); void packetArrived(qbs::Internal::LauncherPacketType type, quintptr token, const QByteArray &payload); private: LauncherSocket(QObject *parent); void setSocket(QLocalSocket *socket); void shutdown(); void handleSocketError(); void handleSocketDataAvailable(); void handleSocketDisconnected(); void handleError(const QString &error); void handleRequests(); std::atomic m_socket{nullptr}; PacketParser m_packetParser; std::vector m_requests; std::mutex m_requestsMutex; }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/lib/corelib/tools/id.h0000644000175100017510000000670715154533055017375 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_TOOLS_ID_H #define QBS_TOOLS_ID_H #include "qbs_export.h" #include #include #include #include namespace qbs { namespace Internal { class QBS_AUTOTEST_EXPORT Id { public: enum { IdsPerPlugin = 10000, ReservedPlugins = 1000 }; Id() : m_id(0) {} Id(int uid) : m_id(uid) {} Id(const char *name); explicit Id(const QByteArray &name); Id withSuffix(int suffix) const; Id withSuffix(const char *name) const; Id withPrefix(const char *name) const; QByteArray name() const; QString toString() const; // Avoid. QVariant toSetting() const; // Good to use. bool isValid() const { return m_id; } bool operator==(Id id) const { return m_id == id.m_id; } bool operator==(const char *name) const; bool operator!=(Id id) const { return m_id != id.m_id; } bool operator!=(const char *name) const { return !operator==(name); } bool operator<(Id id) const { return m_id < id.m_id; } bool operator>(Id id) const { return m_id > id.m_id; } bool alphabeticallyBefore(Id other) const; int uniqueIdentifier() const { return m_id; } static Id fromUniqueIdentifier(int uid) { return {uid}; } static Id fromSetting(const QVariant &variant); // Good to use. private: // Intentionally unimplemented Id(const QLatin1String &); int m_id; }; inline QHashValueType qHash(const Id &id) { return id.uniqueIdentifier(); } } // namespace Internal } // namespace qbs Q_DECLARE_METATYPE(qbs::Internal::Id) Q_DECLARE_METATYPE(QList) #endif // QBS_TOOLS_ID_H qbs-src-3.2.0/src/lib/corelib/tools/vsenvironmentdetector.h0000644000175100017510000000564615154533055023451 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_VSENVIRONMENTDETECTOR_H #define QBS_VSENVIRONMENTDETECTOR_H #include "qbs_export.h" #include "msvcinfo.h" #include QT_BEGIN_NAMESPACE class QIODevice; QT_END_NAMESPACE namespace qbs { namespace Internal { class MSVC; class QBS_EXPORT VsEnvironmentDetector { public: explicit VsEnvironmentDetector(QString vcvarsallPath = {}); bool start(MSVC *msvc); bool start(std::vector msvcs); QString errorString() const { return m_errorString; } private: QString findVcVarsAllBat(const MSVC &msvc, std::vector &searchedPaths) const; bool startDetection(const std::vector &compatibleMSVCs); void writeBatchFile(QIODevice *device, const QString &vcvarsallbat, const std::vector &msvcs) const; void parseBatOutput(const QByteArray &output, std::vector msvcs); const QString m_windowsSystemDirPath; const QString m_vcvarsallPath; const QString m_vcVariablesVersion; QString m_errorString; }; } // namespace Internal } // namespace qbs #endif // QBS_VSENVIRONMENTDETECTOR_H qbs-src-3.2.0/src/lib/corelib/tools/applecodesignutils.cpp0000644000175100017510000001406315154533055023224 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "applecodesignutils.h" #include #include #include #include #include #include #include #include #include namespace qbs { namespace Internal { QByteArray smimeMessageContent(const QByteArray &data) { QCFType decoder = NULL; if (CMSDecoderCreate(&decoder) != noErr) return {}; if (CMSDecoderUpdateMessage(decoder, data.constData(), data.size()) != noErr) return {}; if (CMSDecoderFinalizeMessage(decoder) != noErr) return {}; QCFType content = NULL; if (CMSDecoderCopyContent(decoder, &content) != noErr) return {}; return QByteArray::fromCFData(content); } QVariantMap certificateInfo(const QByteArray &data) { const QSslCertificate cert(data, QSsl::Der); // Also potentially useful, but these are for signing pkgs which aren't used here // 1.2.840.113635.100.4.9 - 3rd Party Mac Developer Installer: // 1.2.840.113635.100.4.13 - Developer ID Installer: const auto extensions = cert.extensions(); for (const auto &extension : extensions) { if (extension.name() == QStringLiteral("extendedKeyUsage")) { if (!extension.value().toStringList().contains(QStringLiteral("Code Signing"))) return {}; } } const auto subjectInfo = [](const QSslCertificate &cert) { QVariantMap map; const auto attributes = cert.subjectInfoAttributes(); for (const auto &attr : attributes) map.insert(QString::fromUtf8(attr), cert.subjectInfo(attr).front()); return map; }; const auto sha1 = QString::fromLatin1(cert.digest(QCryptographicHash::Sha1).toHex().toUpper()); return { {QStringLiteral("SHA1"), sha1}, {QStringLiteral("subjectInfo"), subjectInfo(cert)}, {QStringLiteral("validAfter"), cert.effectiveDate()}, {QStringLiteral("validBefore"), cert.expiryDate()} }; } QVariantMap identitiesProperties() { // Apple documentation states that the Sec* family of functions are not thread-safe on macOS // https://developer.apple.com/library/mac/documentation/Security/Reference/certifkeytrustservices/ static std::mutex securityMutex; std::lock_guard locker(securityMutex); Q_UNUSED(locker); const void *keys[] = {kSecClass, kSecMatchLimit, kSecAttrCanSign}; const void *values[] = {kSecClassIdentity, kSecMatchLimitAll, kCFBooleanTrue}; QCFType query = CFDictionaryCreate(kCFAllocatorDefault, keys, values, sizeof(keys) / sizeof(keys[0]), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); QCFType result = NULL; if (SecItemCopyMatching(query, &result) != errSecSuccess) return {}; QVariantMap items; const auto tryAppend = [&](SecIdentityRef identity) { if (!identity) return; QCFType certificate = NULL; if (SecIdentityCopyCertificate(identity, &certificate) != errSecSuccess) return; QCFType certificateData = SecCertificateCopyData(certificate); if (!certificateData) return; auto props = certificateInfo(QByteArray::fromRawCFData(certificateData)); if (!props.empty()) items.insert(props[QStringLiteral("SHA1")].toString(), props); }; if (CFGetTypeID(result) == SecIdentityGetTypeID()) { tryAppend((SecIdentityRef)result.operator const void *()); } else if (CFGetTypeID(result) == CFArrayGetTypeID()) { for (CFIndex i = 0; i < CFArrayGetCount((CFArrayRef)result.operator const void *()); ++i) tryAppend((SecIdentityRef)CFArrayGetValueAtIndex(result.as(), i)); } return items; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/filetime.cpp0000644000175100017510000001331215154533055021120 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "filetime.h" #include #ifdef Q_OS_WIN #include #else #include #endif namespace qbs { namespace Internal { #if defined(Q_OS_WIN) FileTime::FileTime() { static_assert(sizeof(FileTime::InternalType) == sizeof(FILETIME), "FileTime::InternalType has wrong size."); m_fileTime = 0; } FileTime::FileTime(const FileTime::InternalType &ft) : m_fileTime(ft) { } int FileTime::compare(const FileTime &other) const { auto const t1 = reinterpret_cast(&m_fileTime); auto const t2 = reinterpret_cast(&other.m_fileTime); return CompareFileTime(t1, t2); } void FileTime::clear() { m_fileTime = 0; } bool FileTime::isValid() const { return *this != FileTime(); } FileTime FileTime::currentTime() { SYSTEMTIME st; GetSystemTime(&st); FILETIME ft{}; SystemTimeToFileTime(&st, &ft); return fromFileTime(ft); } FileTime FileTime::oldestTime() { SYSTEMTIME st = { 1601, 1, 5, 2, 0, 0, 0, 0 }; FILETIME ft{}; SystemTimeToFileTime(&st, &ft); return fromFileTime(ft); } double FileTime::asDouble() const { return static_cast(m_fileTime) / 10000000.0; } QString FileTime::toString() const { const auto ft = toFileTime(m_fileTime); SYSTEMTIME stUTC, stLocal; FileTimeToSystemTime(&ft, &stUTC); SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal); const QString result = QStringLiteral("%1.%2.%3 %4:%5:%6") .arg(stLocal.wDay, 2, 10, QLatin1Char('0')).arg(stLocal.wMonth, 2, 10, QLatin1Char('0')).arg(stLocal.wYear) .arg(stLocal.wHour, 2, 10, QLatin1Char('0')).arg(stLocal.wMinute, 2, 10, QLatin1Char('0')).arg(stLocal.wSecond, 2, 10, QLatin1Char('0')); return result; } #else // defined(Q_OS_WIN) // based on https://github.com/qt/qtbase/blob/5.13/src/corelib/kernel/qelapsedtimer_unix.cpp // for details why it is implemented this way, see Qt source code # if !defined(CLOCK_REALTIME) # define CLOCK_REALTIME 0 static inline void qbs_clock_gettime(int, struct timespec *ts) { // support clock_gettime with gettimeofday struct timeval tv; gettimeofday(&tv, 0); ts->tv_sec = tv.tv_sec; ts->tv_nsec = tv.tv_usec * 1000; } # ifdef _POSIX_MONOTONIC_CLOCK # undef _POSIX_MONOTONIC_CLOCK # define _POSIX_MONOTONIC_CLOCK -1 # endif # else static inline void qbs_clock_gettime(clockid_t clock, struct timespec *ts) { clock_gettime(clock, ts); } # endif FileTime::FileTime() { m_fileTime = {0, 0}; } FileTime::FileTime(const FileTime::InternalType &ft) : m_fileTime(ft) { if (m_fileTime.tv_sec == 0) m_fileTime.tv_nsec = 0; // stat() sets only the first member to 0 for non-existing files. } int FileTime::compare(const FileTime &other) const { if (m_fileTime.tv_sec < other.m_fileTime.tv_sec) return -1; if (m_fileTime.tv_sec > other.m_fileTime.tv_sec) return 1; if (m_fileTime.tv_nsec < other.m_fileTime.tv_nsec) return -1; if (m_fileTime.tv_nsec > other.m_fileTime.tv_nsec) return 1; return 0; } void FileTime::clear() { m_fileTime = { 0, 0 }; } bool FileTime::isValid() const { return *this != FileTime(); } FileTime FileTime::currentTime() { InternalType t; qbs_clock_gettime(CLOCK_REALTIME, &t); return t; } FileTime FileTime::oldestTime() { return FileTime({1, 0}); } double FileTime::asDouble() const { return static_cast(m_fileTime.tv_sec) + static_cast(m_fileTime.tv_nsec) / 1000000000.0; } QString FileTime::toString() const { QDateTime dt; dt.setMSecsSinceEpoch(m_fileTime.tv_sec * 1000 + m_fileTime.tv_nsec / 1000000); return dt.toString(Qt::ISODateWithMs); } #endif // defined(Q_OS_WIN) } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/lib/corelib/tools/codelocation.cpp0000644000175100017510000001367615154533055022002 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "codelocation.h" #include #include #include #include #include #include #include #include #include #include #include namespace qbs { CodeLocation::CodeLocation(const QString &aFilePath, int aLine, int aColumn, bool checkPath) { QBS_ASSERT(!checkPath || Internal::FileInfo::isAbsolute(aFilePath), qDebug() << aFilePath); m_filePath = aFilePath; m_line = aLine; m_column = aColumn; } QString CodeLocation::toString() const { QString str; if (isValid()) { str = QDir::toNativeSeparators(filePath()); QString lineAndColumn; if (line() > 0 && !str.contains(QRegularExpression(QStringLiteral(":[0-9]+$")))) lineAndColumn += QLatin1Char(':') + QString::number(line()); if (column() > 0 && !str.contains(QRegularExpression(QStringLiteral(":[0-9]+:[0-9]+$")))) lineAndColumn += QLatin1Char(':') + QString::number(column()); str += lineAndColumn; } return str; } QJsonObject CodeLocation::toJson() const { QJsonObject obj; if (!filePath().isEmpty()) obj.insert(Internal::StringConstants::filePathKey(), filePath()); if (line() != -1) obj.insert(QStringLiteral("line"), line()); if (column() != -1) obj.insert(QStringLiteral("column"), column()); return obj; } void CodeLocation::load(Internal::PersistentPool &pool) { const bool isValid = pool.load(); if (!isValid) return; pool.load(m_filePath); pool.load(m_line); pool.load(m_column); } void CodeLocation::store(Internal::PersistentPool &pool) const { if (isValid()) { pool.store(true); pool.store(m_filePath); pool.store(m_line); pool.store(m_column); } else { pool.store(false); } } bool operator==(const CodeLocation &cl1, const CodeLocation &cl2) { return cl1.filePath() == cl2.filePath() && cl1.line() == cl2.line() && cl1.column() == cl2.column(); } bool operator!=(const CodeLocation &cl1, const CodeLocation &cl2) { return !(cl1 == cl2); } QDebug operator<<(QDebug debug, const CodeLocation &location) { return debug << location.toString(); } bool operator<(const CodeLocation &cl1, const CodeLocation &cl2) { return cl1.toString() < cl2.toString(); } void CodePosition::load(Internal::PersistentPool &pool) { pool.load(m_line, m_column); } void CodePosition::store(Internal::PersistentPool &pool) const { pool.store(m_line, m_column); } bool operator==(const CodePosition &pos1, const CodePosition &pos2) { return pos1.line() == pos2.line() && pos1.column() == pos2.column(); } bool operator!=(const CodePosition &pos1, const CodePosition &pos2) { return !(pos1 == pos2); } bool operator<(const CodePosition &pos1, const CodePosition &pos2) { const int lineDiff = pos1.line() - pos2.line(); if (lineDiff < 0) return true; if (lineDiff > 0) return false; return pos1.column() < pos2.column(); } bool operator>(const CodePosition &pos1, const CodePosition &pos2) { return pos2 < pos1; } bool operator<=(const CodePosition &pos1, const CodePosition &pos2) { return !(pos1 > pos2); } bool operator>=(const CodePosition &pos1, const CodePosition &pos2) { return !(pos1 < pos2); } CodeRange::CodeRange(const CodePosition &start, const CodePosition &end) : m_start(start), m_end(end) {} void CodeRange::load(Internal::PersistentPool &pool) { pool.load(m_start, m_end); } void CodeRange::store(Internal::PersistentPool &pool) const { pool.store(m_start, m_end); } bool CodeRange::contains(const CodePosition &pos) const { return start() <= pos && end() > pos; } bool operator==(const CodeRange &r1, const CodeRange &r2) { return r1.start() == r2.start() && r1.end() == r2.end(); } bool operator!=(const CodeRange &r1, const CodeRange &r2) { return !(r1 == r2); } bool operator<(const CodeRange &r1, const CodeRange &r2) { return r1.start() < r2.start(); } } // namespace qbs qbs-src-3.2.0/src/lib/CMakeLists.txt0000644000175100017510000000012015154533055016570 0ustar runnerrunneradd_subdirectory(pkgconfig) add_subdirectory(corelib) add_subdirectory(msbuild) qbs-src-3.2.0/src/CMakeLists.txt0000644000175100017510000000017115154533055016030 0ustar runnerrunneradd_subdirectory(app) add_subdirectory(lib) add_subdirectory(libexec) add_subdirectory(plugins) add_subdirectory(shared) qbs-src-3.2.0/src/app/0000755000175100017510000000000015154533055014051 5ustar runnerrunnerqbs-src-3.2.0/src/app/config-ui/0000755000175100017510000000000015154533055015731 5ustar runnerrunnerqbs-src-3.2.0/src/app/config-ui/mainwindow.ui0000644000175100017510000000151415154533055020445 0ustar runnerrunner MainWindow 0 0 800 600 Qbs Settings 0 0 800 27 qbs-src-3.2.0/src/app/config-ui/main.cpp0000644000175100017510000000507015154533055017363 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "mainwindow.h" #include "commandlineparser.h" #include #include #include #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); CommandLineParser clParser; try { clParser.parse(app.arguments()); if (clParser.helpRequested()) { std::cout << qPrintable(clParser.usageString()); return EXIT_SUCCESS; } } catch (const qbs::ErrorInfo &error) { std::cerr << qPrintable(error.toString()); return EXIT_FAILURE; } MainWindow mw(clParser.settingsDir(), clParser.settingsScope()); mw.show(); return app.exec(); } qbs-src-3.2.0/src/app/config-ui/fgapp.mm0000644000175100017510000000426115154533055017364 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #import #include extern "C" void qt_macos_forceTransformProcessToForegroundApplicationAndActivate() { [[NSApplication sharedApplication] setActivationPolicy:NSApplicationActivationPolicyRegular]; [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; } qbs-src-3.2.0/src/app/config-ui/CMakeLists.txt0000644000175100017510000000070415154533055020472 0ustar runnerrunnerset(SOURCES commandlineparser.cpp commandlineparser.h main.cpp mainwindow.cpp mainwindow.h mainwindow.ui ) # TODO: support Info.plist if(APPLE) set(MACOS_SOURCES fgapp.mm) set(MACOS_FRAMEWORKS "-framework ApplicationServices" "-framework Cocoa") endif() add_qbs_app(qbs-config-ui DEPENDS qbscore qbsconsolelogger Qt${QT_VERSION_MAJOR}::Widgets ${MACOS_FRAMEWORKS} SOURCES ${SOURCES} ${MACOS_SOURCES} ) qbs-src-3.2.0/src/app/config-ui/config-ui.qbs0000644000175100017510000000126515154533055020324 0ustar runnerrunnerQbsApp { Depends { name: "Qt.widgets" } name: "qbs-config-ui" consoleApplication: false files: [ "commandlineparser.cpp", "commandlineparser.h", "main.cpp", "mainwindow.cpp", "mainwindow.h", "mainwindow.ui", ] Group { condition: qbs.targetOS.contains("macos") files: [ "fgapp.mm", "Info.plist" ] } Properties { condition: qbs.targetOS.contains("macos") cpp.frameworks: ["ApplicationServices", "Cocoa"] bundle.isBundle: false } Properties { condition: qbs.targetOS.contains("darwin") bundle.isBundle: false } } qbs-src-3.2.0/src/app/config-ui/Info.plist0000644000175100017510000000070615154533055017704 0ustar runnerrunner CFBundleIdentifier org.qt-project.qbs-config-ui CFBundleInfoDictionaryVersion 6.0 CFBundleName Qbs Settings LSUIElement 1 qbs-src-3.2.0/src/app/config-ui/commandlineparser.h0000644000175100017510000000527515154533055021616 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_CONFIGUI_COMMANDLINEPARSER_H #define QBS_CONFIGUI_COMMANDLINEPARSER_H #include #include class CommandLineParser { public: void parse(const QStringList &commandLine); bool helpRequested() const { return m_helpRequested; } QString settingsDir() const { return m_settingsDir; } qbs::Settings::Scope settingsScope() const { return m_settingsScope; } QString usageString() const; private: [[noreturn]] void throwError(const QString &message); void assignOptionArgument(const QString &option, QString &argument); [[noreturn]] void complainAboutExtraArguments(); bool m_helpRequested = false; qbs::Settings::Scope m_settingsScope = qbs::Settings::UserScope; QString m_settingsDir; QStringList m_commandLine; QString m_command; }; #endif // Include guard qbs-src-3.2.0/src/app/config-ui/commandlineparser.cpp0000644000175100017510000001047415154533055022146 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "commandlineparser.h" #include #include #include using qbs::Internal::Tr; static QString helpOptionShort() { return QStringLiteral("-h"); } static QString helpOptionLong() { return QStringLiteral("--help"); } static QString settingsDirOption() { return QStringLiteral("--settings-dir"); } static QString systemOption() { return QStringLiteral("--system"); } void CommandLineParser::parse(const QStringList &commandLine) { m_commandLine = commandLine; Q_ASSERT(!m_commandLine.empty()); m_command = QFileInfo(m_commandLine.takeFirst()).fileName(); m_helpRequested = false; m_settingsDir.clear(); if (m_commandLine.empty()) return; const QString &arg = m_commandLine.front(); if (arg == helpOptionShort() || arg == helpOptionLong()) { m_commandLine.removeFirst(); m_helpRequested = true; } else if (arg == systemOption()) { m_commandLine.removeFirst(); m_settingsScope = qbs::Settings::SystemScope; } else if (arg == settingsDirOption()) { m_commandLine.removeFirst(); assignOptionArgument(settingsDirOption(), m_settingsDir); } if (!m_commandLine.empty()) complainAboutExtraArguments(); } void CommandLineParser::throwError(const QString &message) { qbs::ErrorInfo error(Tr::tr("Syntax error: %1").arg(message)); error.append(usageString()); throw error; } QString CommandLineParser::usageString() const { QString s = Tr::tr("This tool displays qbs settings in a GUI.\n" "If you have more than a few settings, this might be preferable to " "plain \"qbs config\", as it presents a hierarchical view.\n"); s += Tr::tr("Usage:\n"); s += Tr::tr(" %1 [%2 ] [%5] [%3|%4]\n") .arg(m_command, settingsDirOption(), helpOptionShort(), helpOptionLong(), systemOption()); return s; } void CommandLineParser::assignOptionArgument(const QString &option, QString &argument) { if (m_commandLine.empty()) throwError(Tr::tr("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) throwError(Tr::tr("Argument for option '%1' must not be empty.").arg(option)); } void CommandLineParser::complainAboutExtraArguments() { throwError(Tr::tr("Extraneous command-line arguments '%1'.") .arg(m_commandLine.join(QLatin1Char(' ')))); } qbs-src-3.2.0/src/app/config-ui/mainwindow.h0000644000175100017510000000520515154533055020260 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 MAINWINDOW_H #define MAINWINDOW_H #include #include namespace qbs { class SettingsModel; } QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } class QPoint; QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(const QString &settingsDir, qbs::Settings::Scope scope, QWidget *parent = nullptr); ~MainWindow() override; bool eventFilter(QObject *watched, QEvent *event) override; private: void adjustColumns(); void expandAll(); void collapseAll(); void reloadSettings(); void saveSettings(); void exit(); void provideContextMenu(const QPoint &pos); Ui::MainWindow *ui; qbs::SettingsModel *m_model; }; #endif // MAINWINDOW_H qbs-src-3.2.0/src/app/config-ui/mainwindow.cpp0000644000175100017510000002163015154533055020613 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "mainwindow.h" #include "ui_mainwindow.h" #include #include #include #include #include #include #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #include #else #include #endif #include #include #include #include #include namespace { class TrimValidator : public QValidator { public: explicit TrimValidator(QObject *parent = nullptr) : QValidator(parent) {} // QValidator interface State validate(QString &input, int &pos) const override { Q_UNUSED(pos); if (input.startsWith(QLatin1Char(' ')) || input.endsWith(QLatin1Char(' '))) return State::Intermediate; return State::Acceptable; } void fixup(QString &input) const override { input = input.trimmed(); } }; class SettingsItemDelegate: public QStyledItemDelegate { public: explicit SettingsItemDelegate(QObject *parent = nullptr) : QStyledItemDelegate(parent) {} QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override { const auto editor = QStyledItemDelegate::createEditor(parent, option, index); const auto lineEdit = qobject_cast(editor); if (lineEdit) lineEdit->setValidator(new TrimValidator(lineEdit)); return editor; } }; } // namespace MainWindow::MainWindow(const QString &settingsDir, qbs::Settings::Scope scope, QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); m_model = new qbs::SettingsModel(settingsDir, scope, this); ui->treeView->setModel(m_model); ui->treeView->setItemDelegate(new SettingsItemDelegate(ui->treeView)); ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->treeView, &QTreeView::expanded, this, &MainWindow::adjustColumns); connect(ui->treeView, &QWidget::customContextMenuRequested, this, &MainWindow::provideContextMenu); adjustColumns(); QMenu * const fileMenu = menuBar()->addMenu(tr("&File")); QMenu * const viewMenu = menuBar()->addMenu(tr("&View")); const auto reloadAction = new QAction(tr("&Reload"), this); reloadAction->setShortcut(QKeySequence::Refresh); connect(reloadAction, &QAction::triggered, this, &MainWindow::reloadSettings); const auto saveAction = new QAction(tr("&Save"), this); saveAction->setShortcut(QKeySequence::Save); connect(saveAction, &QAction::triggered, this, &MainWindow::saveSettings); const auto expandAllAction = new QAction(tr("&Expand All"), this); expandAllAction->setShortcut(int(Qt::CTRL) | int(Qt::Key_E)); connect(expandAllAction, &QAction::triggered, this, &MainWindow::expandAll); const auto collapseAllAction = new QAction(tr("C&ollapse All"), this); collapseAllAction->setShortcut(int(Qt::CTRL) | int(Qt::Key_O)); connect(collapseAllAction, &QAction::triggered, this, &MainWindow::collapseAll); const auto exitAction = new QAction(tr("E&xit"), this); exitAction->setShortcut(QKeySequence::Quit); exitAction->setMenuRole(QAction::QuitRole); connect(exitAction, &QAction::triggered, this, &MainWindow::exit); fileMenu->addAction(reloadAction); fileMenu->addAction(saveAction); fileMenu->addSeparator(); fileMenu->addAction(exitAction); viewMenu->addAction(expandAllAction); viewMenu->addAction(collapseAllAction); ui->treeView->installEventFilter(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::adjustColumns() { for (int column = 0; column < m_model->columnCount(); ++column) ui->treeView->resizeColumnToContents(column); } void MainWindow::expandAll() { ui->treeView->expandAll(); adjustColumns(); } void MainWindow::collapseAll() { ui->treeView->collapseAll(); adjustColumns(); } void MainWindow::reloadSettings() { if (m_model->hasUnsavedChanges()) { const QMessageBox::StandardButton answer = QMessageBox::question(this, tr("Unsaved Changes"), tr("You have unsaved changes. Do you want to discard them?")); if (answer != QMessageBox::Yes) return; } m_model->reload(); } void MainWindow::saveSettings() { m_model->save(); } void MainWindow::exit() { if (m_model->hasUnsavedChanges()) { const QMessageBox::StandardButton answer = QMessageBox::question(this, tr("Unsaved Changes"), tr("You have unsaved changes. Do you want to save them now?")); if (answer == QMessageBox::Yes) m_model->save(); } qApp->quit(); } void MainWindow::provideContextMenu(const QPoint &pos) { const QModelIndex index = ui->treeView->indexAt(pos); if (index.isValid() && index.column() != m_model->keyColumn()) return; const QString settingsKey = m_model->data(index).toString(); QMenu contextMenu; QAction addKeyAction(this); QAction removeKeyAction(this); if (index.isValid()) { addKeyAction.setText(tr("Add new key below '%1'").arg(settingsKey)); removeKeyAction.setText(tr("Remove key '%1' and all its sub-keys").arg(settingsKey)); contextMenu.addAction(&addKeyAction); contextMenu.addAction(&removeKeyAction); } else { addKeyAction.setText(tr("Add new top-level key")); contextMenu.addAction(&addKeyAction); } const QAction *action = contextMenu.exec(ui->treeView->mapToGlobal(pos)); if (action == &addKeyAction) m_model->addNewKey(index); else if (action == &removeKeyAction) m_model->removeKey(index); } extern "C" void qt_macos_forceTransformProcessToForegroundApplicationAndActivate(); bool MainWindow::eventFilter(QObject *watched, QEvent *event) { if (ui->treeView->hasFocus() && event->type() == QEvent::KeyPress) { const auto keyEvent = static_cast(event); if (keyEvent->matches(QKeySequence::Delete)) { const QModelIndexList indexes = ui->treeView->selectionModel()->selectedRows(); if (indexes.size() == 1) { const QModelIndex index = indexes.front(); if (index.isValid()) { m_model->removeKey(index); return true; } } } } if (event->type() == QEvent::WindowActivate) { // Effectively delay the foreground process transformation from QApplication construction to // when the UI is shown - this prevents the application icon from popping up in the Dock // when running `qbs help`, and QCoreApplication::arguments() requires the application // object to be constructed, so it is not easily worked around #if defined(Q_OS_MACOS) qt_macos_forceTransformProcessToForegroundApplicationAndActivate(); #endif } return QMainWindow::eventFilter(watched, event); } qbs-src-3.2.0/src/app/qbs-create-project/0000755000175100017510000000000015154533055017543 5ustar runnerrunnerqbs-src-3.2.0/src/app/qbs-create-project/create-project-main.cpp0000644000175100017510000001051715154533055024104 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "createproject.h" #include #include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { using qbs::ErrorInfo; using qbs::Internal::Tr; QCoreApplication app(argc, argv); const QCommandLineOption flatOpt(QStringLiteral("flat"), Tr::tr("Do not create nested project files, even if there are subdirectories and " "the top-level directory does not contain any files.")); const QCommandLineOption whiteListOpt(QStringLiteral("whitelist"), Tr::tr("Only consider files whose names match these patterns. The list entries " "can contain wildcards and are separated by commas. By default, all files " "are considered."), QStringLiteral("whitelist")); const QCommandLineOption blackListOpt(QStringLiteral("blacklist"), Tr::tr("Ignore files whose names match these patterns. The list entries " "can contain wildcards and are separated by commas. By default, no files " "are ignored."), QStringLiteral("blacklist")); QCommandLineParser parser; parser.setApplicationDescription(Tr::tr("This tool creates a qbs project from an existing " "source tree.\nNote: The resulting project file(s) " "will likely require manual editing.")); parser.addOption(flatOpt); parser.addOption(whiteListOpt); parser.addOption(blackListOpt); parser.addHelpOption(); parser.process(app); const ProjectStructure projectStructure = parser.isSet(flatOpt) ? ProjectStructure::Flat : ProjectStructure::Composite; const QStringList whiteList = parser.value(whiteListOpt).split(QLatin1Char(','), Qt::SkipEmptyParts); const QStringList blackList = parser.value(blackListOpt).split(QLatin1Char(','), Qt::SkipEmptyParts); try { ProjectCreator().run(QDir::currentPath(), projectStructure, whiteList, blackList); } catch (const ErrorInfo &e) { std::cerr << qPrintable(Tr::tr("Error creating project: %1").arg(e.toString())) << std::endl; return 1; } } qbs-src-3.2.0/src/app/qbs-create-project/CMakeLists.txt0000644000175100017510000000027215154533055022304 0ustar runnerrunnerset(SOURCES createproject.cpp createproject.h create-project-main.cpp ) add_qbs_app(qbs-create-project DEPENDS qbscore qbsconsolelogger SOURCES ${SOURCES} ) qbs-src-3.2.0/src/app/qbs-create-project/createproject.h0000644000175100017510000000651615154533055022556 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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_CREATEPROJECT_H #define QBS_CREATEPROJECT_H #include #include #include #include #include #include QT_BEGIN_NAMESPACE class QDir; class QTextStream; QT_END_NAMESPACE enum class ProjectStructure { Flat, Composite }; class ProjectCreator { public: void run(const QString &topLevelDir, ProjectStructure projectStructure, const QStringList &whiteList, const QStringList &blacklist); private: enum ProductFlag { IsApp = 1, NeedsCpp = 2, NeedsQt = 4 }; Q_DECLARE_FLAGS(ProductFlags, ProductFlag) struct Project; void setupProject(Project *project); void serializeProject(const Project &project); void addGroups(QTextStream &stream, const QDir &baseDir, const Project &subProject); bool isSourceFile(const QString &fileName); ProductFlags getFlags(const Project &project); void getFlagsFromFileNames(const Project &project, ProductFlags &flags); void getFlagsFromFileContents(const Project &project, ProductFlags &flags); using ProjectPtr = std::unique_ptr; struct Project { QString dirPath; QString dirName; QStringList fileNames; std::vector subProjects; }; Project m_topLevelProject; ProjectStructure m_projectStructure = ProjectStructure::Flat; QList m_whiteList; QList m_blackList; }; #endif // QBS_CREATEPROJECT_H qbs-src-3.2.0/src/app/qbs-create-project/createproject.cpp0000644000175100017510000002332415154533055023105 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "createproject.h" #include #include #include #include #include #include #include #include #include #include #include using qbs::ErrorInfo; using qbs::Internal::Tr; static const char *indent = " "; void ProjectCreator::run(const QString &topLevelDir, ProjectStructure projectStructure, const QStringList &whiteList, const QStringList &blackList) { m_projectStructure = projectStructure; qbs::Internal::transform(whiteList, m_whiteList, [](const QString &s) { return QRegularExpression(QRegularExpression::wildcardToRegularExpression(s)); }); qbs::Internal::transform(blackList, m_blackList, [](const QString &s) { return QRegularExpression(QRegularExpression::wildcardToRegularExpression(s)); }); m_topLevelProject.dirPath = topLevelDir; setupProject(&m_topLevelProject); serializeProject(m_topLevelProject); } void ProjectCreator::setupProject(Project *project) { QDirIterator dit(project->dirPath, QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); while (dit.hasNext()) { dit.next(); if (dit.fileInfo().isFile()) { if (dit.fileName().endsWith(QLatin1String(".qbs"))) throw ErrorInfo(Tr::tr("Project already contains qbs files, aborting.")); if (isSourceFile(dit.fileName())) project->fileNames << dit.fileName(); } else if (dit.fileInfo().isDir()) { ProjectPtr subProject(new Project); subProject->dirName = dit.fileName(); subProject->dirPath = dit.filePath(); setupProject(subProject.get()); if (!subProject->fileNames.empty() || !subProject->subProjects.empty()) project->subProjects.push_back(std::move(subProject)); } } project->fileNames.sort(); std::sort(project->subProjects.begin(), project->subProjects.end(), [](const ProjectPtr &p1, const ProjectPtr &p2) { return p1->dirName < p2->dirName; }); } void ProjectCreator::serializeProject(const ProjectCreator::Project &project) { const QString fileName = QFileInfo(project.dirPath).baseName() + QLatin1String(".qbs"); QFile projectFile(project.dirPath + QLatin1Char('/') + fileName); if (!projectFile.open(QIODevice::WriteOnly)) { throw ErrorInfo(Tr::tr("Failed to open '%1' for writing: %2") .arg(projectFile.fileName(), projectFile.errorString())); } QTextStream fileContents(&projectFile); qbs::setupDefaultCodec(fileContents); if (!project.fileNames.empty() || m_projectStructure == ProjectStructure::Flat) { fileContents << "Product {\n"; const ProductFlags productFlags = getFlags(project); if (productFlags.testFlag(IsApp)) { fileContents << indent << "type: [\"application\"]\n"; } else { fileContents << indent << "type: [\"unknown\"] // E.g. \"application\", " "\"dynamiclibrary\", \"staticlibrary\"\n"; } if (productFlags.testFlag(NeedsQt)) { fileContents << indent << "Depends {\n"; fileContents << indent << indent << "name: \"Qt\"\n"; fileContents << indent << indent << "submodules: [\"core\"] " "// Add more here if needed\n"; fileContents << indent << "}\n"; } else if (productFlags.testFlag(NeedsCpp)) { fileContents << indent << "Depends { name: \"cpp\" }\n"; } fileContents << indent << "files: [\n"; for (const QString &fileName : std::as_const(project.fileNames)) fileContents << indent << indent << qbs::toJSLiteral(fileName) << ",\n"; fileContents << indent << "]\n"; for (const ProjectPtr &p : project.subProjects) addGroups(fileContents, QDir(project.dirPath), *p); } else { fileContents << "Project {\n"; fileContents << indent << "references: [\n"; for (const ProjectPtr &p : project.subProjects) { serializeProject(*p); fileContents << indent << indent << qbs::toJSLiteral(QFileInfo(p->dirPath).fileName()) << ",\n"; } fileContents << indent << "]\n"; } fileContents << "}\n"; } void ProjectCreator::addGroups(QTextStream &stream, const QDir &baseDir, const ProjectCreator::Project &subProject) { stream << indent << "Group {\n"; stream << indent << indent << "name: " << qbs::toJSLiteral(QFileInfo(subProject.dirPath).fileName()) << "\n"; stream << indent << indent << "prefix: " << qbs::toJSLiteral(baseDir.relativeFilePath(subProject.dirPath) + QLatin1Char('/')) << '\n'; stream << indent << indent << "files: [\n"; for (const QString &fileName : std::as_const(subProject.fileNames)) stream << indent << indent << indent << qbs::toJSLiteral(fileName) << ",\n"; stream << indent << indent << "]\n"; stream << indent << "}\n"; for (const ProjectPtr &p : subProject.subProjects) addGroups(stream, baseDir, *p); } bool ProjectCreator::isSourceFile(const QString &fileName) { const auto isMatch = [fileName](const QRegularExpression &rex) { return rex.match(fileName).hasMatch(); }; return !qbs::Internal::any_of(m_blackList, isMatch) && (m_whiteList.empty() || qbs::Internal::any_of(m_whiteList, isMatch)); } ProjectCreator::ProductFlags ProjectCreator::getFlags(const ProjectCreator::Project &project) { ProductFlags flags; getFlagsFromFileNames(project, flags); if (flags.testFlag(IsApp) && flags.testFlag(NeedsQt)) return flags; if (!flags.testFlag(NeedsCpp)) return flags; getFlagsFromFileContents(project, flags); return flags; } void ProjectCreator::getFlagsFromFileNames(const ProjectCreator::Project &project, ProductFlags &flags) { for (const QString &fileName : std::as_const(project.fileNames)) { if (flags.testFlag(IsApp) && flags.testFlag(NeedsQt)) return; const QFileInfo fi(project.dirPath + QLatin1Char('/') + fileName); const QString &suffix = fi.suffix(); if (suffix == QLatin1String("qrc")) { flags |= NeedsQt; continue; } if (suffix == QLatin1String("cpp") || suffix == QLatin1String("c") || suffix == QLatin1String("m") || suffix == QLatin1String("mm")) { flags |= NeedsCpp; } if (flags.testFlag(NeedsCpp) && fi.completeBaseName() == QLatin1String("main")) flags |= IsApp; } for (const ProjectPtr &p : project.subProjects) { getFlagsFromFileNames(*p, flags); if (flags.testFlag(IsApp) && flags.testFlag(NeedsQt)) return; } } void ProjectCreator::getFlagsFromFileContents(const ProjectCreator::Project &project, ProductFlags &flags) { for (const QString &fileName : std::as_const(project.fileNames)) { QFile f (project.dirPath + QLatin1Char('/') + fileName); if (!f.open(QIODevice::ReadOnly)) { qDebug() << "Ignoring failure to read" << f.fileName(); continue; } while (!f.atEnd()) { const QByteArray &line = f.readLine(); if (line.contains("#include userInterrupt(); } #if defined(Q_OS_WIN) && defined(Q_CC_MSVC) #include static BOOL WINAPI consoleCtrlHandlerRoutine(__in DWORD dwCtrlType) { Q_UNUSED(dwCtrlType); cancel(); return TRUE; } void installCtrlCHandler() { SetConsoleCtrlHandler(&consoleCtrlHandlerRoutine, TRUE); } #else #include static void sigIntHandler(int sig) { Q_UNUSED(sig); cancel(); } void installCtrlCHandler() { signal(SIGINT, sigIntHandler); } #endif qbs-src-3.2.0/src/app/qbs/sessionpacket.h0000644000175100017510000000472315154533055017670 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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_SESSIONPACKET_H #define QBS_SESSIONPACKET_H #include #include namespace qbs { namespace Internal { class SessionPacket { public: enum class Status { Incomplete, Complete, Invalid }; Status parseInput(QByteArray &input); QJsonObject retrievePacket(); static QByteArray createPacket(const QJsonObject &packet); static QJsonObject helloMessage(const QString &lspSocket); private: bool isComplete() const; QByteArray m_payload; int m_expectedPayloadLength = -1; }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/app/qbs/main.cpp0000644000175100017510000000660615154533055016276 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "application.h" #include "commandlinefrontend.h" #include "qbstool.h" #include "parser/commandlineparser.h" #include "../shared/logging/consolelogger.h" #include #include #include using namespace qbs; static bool tryToRunTool(const QStringList &arguments, int &exitCode) { if (arguments.empty()) return false; QStringList toolArgs = arguments; const QString toolName = toolArgs.takeFirst(); if (toolName.startsWith(QLatin1Char('-'))) return false; return QbsTool::tryToRunTool(toolName, toolArgs, &exitCode); } int main(int argc, char *argv[]) { ConsoleLogger::instance(); try { Application app(argc, argv); QStringList arguments = app.arguments(); arguments.removeFirst(); int toolExitCode = 0; if (tryToRunTool(arguments, toolExitCode)) return toolExitCode; CommandLineParser parser; if (!parser.parseCommandLine(arguments)) return EXIT_FAILURE; if (parser.command() == HelpCommandType) { parser.printHelp(); return 0; } Settings settings(parser.settingsDir()); ConsoleLogger::instance().setSettings(&settings); CommandLineFrontend clFrontend(parser, &settings); app.setCommandLineFrontend(&clFrontend); QTimer::singleShot(0, &clFrontend, &CommandLineFrontend::start); return app.exec(); } catch (const ErrorInfo &error) { qbsError() << error.toString(); return EXIT_FAILURE; } } qbs-src-3.2.0/src/app/qbs/application.cpp0000644000175100017510000000535015154533055017650 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "application.h" #include "commandlinefrontend.h" #include "ctrlchandler.h" namespace qbs { Application::Application(int &argc, char **argv) : QCoreApplication(argc, argv), m_clFrontend(nullptr), m_canceled(false) { setApplicationName(QStringLiteral("qbs")); setOrganizationName(QStringLiteral("QtProject")); setOrganizationDomain(QStringLiteral("qt-project.org")); } Application *Application::instance() { return qobject_cast(QCoreApplication::instance()); } void Application::setCommandLineFrontend(CommandLineFrontend *clFrontend) { installCtrlCHandler(); m_clFrontend = clFrontend; } /** * Interrupt the application. This is directly called from a signal handler. */ void Application::userInterrupt() { if (m_canceled) return; Q_ASSERT(m_clFrontend); m_canceled = true; m_clFrontend->cancel(); } } // namespace qbs qbs-src-3.2.0/src/app/qbs/sessionpacketreader.cpp0000644000175100017510000000702315154533055021402 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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$ ** ****************************************************************************/ #include "sessionpacketreader.h" #include "sessionpacket.h" #include "stdinreader.h" #include namespace qbs { namespace Internal { class SessionPacketReader::Private { public: QByteArray incomingData; SessionPacket currentPacket; }; SessionPacketReader::SessionPacketReader(QObject *parent) : QObject(parent) , d(std::make_unique()) { } SessionPacketReader::~SessionPacketReader() = default; void SessionPacketReader::start() { StdinReader * const stdinReader = StdinReader::create(this); connect(stdinReader, &StdinReader::errorOccurred, this, &SessionPacketReader::errorOccurred); connect(stdinReader, &StdinReader::dataAvailable, this, [this](const QByteArray &data) { /* Because this SessionPacketReader can be destroyed in the emit packetReceived, * use a `QPointer self(this)` to check whether this instance still exists. * When self evaluates to false, this instance should no longer be referenced, * so the parent QObject and d should no longer be used in any way. */ QPointer self(this); d->incomingData += data; while (self && !d->incomingData.isEmpty()) { switch (d->currentPacket.parseInput(d->incomingData)) { case SessionPacket::Status::Invalid: emit errorOccurred(tr("Received invalid input.")); return; case SessionPacket::Status::Complete: emit packetReceived(d->currentPacket.retrievePacket()); break; case SessionPacket::Status::Incomplete: return; } } }); stdinReader->start(); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/app/qbs/parser/0000755000175100017510000000000015154533055016132 5ustar runnerrunnerqbs-src-3.2.0/src/app/qbs/parser/parsercommand.cpp0000644000175100017510000005073515154533055021503 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "parsercommand.h" #include "commandlineoption.h" #include "commandlineoptionpool.h" #include #include #include #include #include #include #include namespace qbs { using namespace Internal; Command::~Command() = default; void Command::parse(QStringList &input) { while (!input.empty()) parseNext(input); } bool Command::canResolve() const { return supportedOptions().contains(CommandLineOption::FileOptionType); } void Command::parsePropertyAssignment(const QString &argument) { const auto throwError = [argument](const QString &msgTemplate) { ErrorInfo error(msgTemplate.arg(argument)); error.append(QLatin1String("Expected an assignment of the form :, " "profile: or config:.")); throw error; }; if (argument.startsWith(QLatin1Char('-'))) throwError(Tr::tr("Unexpected option '%1'.")); const int sepPos = argument.indexOf(QLatin1Char(':')); if (sepPos == -1) throwError(Tr::tr("Unexpected command line parameter '%1'.")); if (sepPos == 0) throwError(Tr::tr("Empty key not allowed in assignment '%1'.")); if (!canResolve() && argument.contains(QLatin1Char(':')) && !argument.startsWith(QLatin1String("config:"))) { throw ErrorInfo(Tr::tr("The '%1' command does not support property assignments.") .arg(representation())); } m_additionalArguments << argument; } QList Command::actualSupportedOptions() const { QList options = supportedOptions(); if (type() != HelpCommandType) options.push_back(CommandLineOption::SettingsDirOptionType); // Valid for almost all commands. return options; } void Command::parseOption(QStringList &input) { const QString optionString = input.front(); QBS_CHECK(optionString.startsWith(QLatin1Char('-'))); input.removeFirst(); if (optionString.size() == 1) throwError(Tr::tr("Empty options are not allowed.")); // Split up grouped short options. if (optionString.at(1) != QLatin1Char('-') && optionString.size() > 2) { QString parameter; for (int i = optionString.size(); --i > 0;) { const QChar c = optionString.at(i); if (c.isDigit()) { parameter.prepend(c); } else { if (!parameter.isEmpty()) { input.prepend(parameter); parameter.clear(); } input.prepend(QLatin1Char('-') + c); } } if (!parameter.isEmpty()) throwError(Tr::tr("Unknown numeric option '%1'.").arg(parameter)); return; } bool matchFound = false; const auto optionTypes = actualSupportedOptions(); for (const CommandLineOption::Type optionType : optionTypes) { CommandLineOption * const option = optionPool().getOption(optionType); if (option->shortRepresentation() != optionString && option->longRepresentation() != optionString) { continue; } if (contains(m_usedOptions, option) && !option->canAppearMoreThanOnce()) throwError(Tr::tr("Option '%1' cannot appear more than once.").arg(optionString)); option->parse(type(), optionString, input); m_usedOptions.insert(option); matchFound = true; break; } if (!matchFound) throwError(Tr::tr("Unknown option '%1'.").arg(optionString)); } void Command::parseNext(QStringList &input) { QBS_CHECK(!input.empty()); if (input.front().startsWith(QLatin1Char('-'))) parseOption(input); else parsePropertyAssignment(input.takeFirst()); } QString Command::supportedOptionsDescription() const { // Sorting the options by name is nicer for the user. QMap optionMap; const auto opTypes = actualSupportedOptions(); for (const CommandLineOption::Type opType : opTypes) { const CommandLineOption * const option = optionPool().getOption(opType); optionMap.insert(option->longRepresentation(), option); } QString s = Tr::tr("The possible options are:\n"); for (const CommandLineOption *option : std::as_const(optionMap)) s += option->description(type()); return s; } void Command::throwError(const QString &reason) { ErrorInfo error(Tr::tr("Invalid use of command '%1': %2").arg(representation(), reason)); error.append(Tr::tr("Type 'qbs help %1' to see how to use this command.") .arg(representation())); throw error; } QString ResolveCommand::shortDescription() const { return Tr::tr("Resolve a project without building it."); } QString ResolveCommand::longDescription() const { QString description = Tr::tr( "qbs %1 [options] [[config:] [:] ...] ...\n") .arg(representation()); description += Tr::tr("Resolves a project in one or more configuration(s).\n"); return description += supportedOptionsDescription(); } QString ResolveCommand::representation() const { return QStringLiteral("resolve"); } static QList resolveOptions() { return { CommandLineOption::FileOptionType, CommandLineOption::BuildDirectoryOptionType, CommandLineOption::LogLevelOptionType, CommandLineOption::VerboseOptionType, CommandLineOption::QuietOptionType, CommandLineOption::ShowProgressOptionType, CommandLineOption::DryRunOptionType, CommandLineOption::ForceProbesOptionType, CommandLineOption::LogTimeOptionType, CommandLineOption::DeprecationWarningsOptionType, CommandLineOption::JobsOptionType}; } QList ResolveCommand::supportedOptions() const { return resolveOptions(); } QString GenerateCommand::shortDescription() const { return Tr::tr("Generate project files for another build tool."); } QString GenerateCommand::longDescription() const { QString description = Tr::tr( "qbs %1 [options] [[config:] [:] ...] ...\n") .arg(representation()); description += Tr::tr("Generates files to build the project using another build tool.\n"); return description += supportedOptionsDescription(); } QString GenerateCommand::representation() const { return QStringLiteral("generate"); } QList GenerateCommand::supportedOptions() const { return {CommandLineOption::FileOptionType, CommandLineOption::BuildDirectoryOptionType, CommandLineOption::LogLevelOptionType, CommandLineOption::VerboseOptionType, CommandLineOption::QuietOptionType, CommandLineOption::ShowProgressOptionType, CommandLineOption::InstallRootOptionType, CommandLineOption::LogTimeOptionType, CommandLineOption::GeneratorOptionType}; } QString BuildCommand::shortDescription() const { return Tr::tr("Build (parts of) a project. This is the default command."); } QString BuildCommand::longDescription() const { QString description = Tr::tr( "qbs %1 [options] [[config:] [:] ...] ...\n") .arg(representation()); description += Tr::tr("Builds a project in one or more configuration(s).\n"); return description += supportedOptionsDescription(); } static QString buildCommandRepresentation() { return QStringLiteral("build"); } QString BuildCommand::representation() const { return buildCommandRepresentation(); } static QList buildOptions() { QList options = resolveOptions(); return options << CommandLineOption::KeepGoingOptionType << CommandLineOption::ProductsOptionType << CommandLineOption::ChangedFilesOptionType << CommandLineOption::ForceTimestampCheckOptionType << CommandLineOption::ForceOutputCheckOptionType << CommandLineOption::BuildNonDefaultOptionType << CommandLineOption::CommandEchoModeOptionType << CommandLineOption::NoInstallOptionType << CommandLineOption::RemoveFirstOptionType << CommandLineOption::JobLimitsOptionType << CommandLineOption::RespectProjectJobLimitsOptionType << CommandLineOption::WaitLockOptionType; } QList BuildCommand::supportedOptions() const { return buildOptions(); } QString CleanCommand::shortDescription() const { return Tr::tr("Remove the files generated during a build."); } QString CleanCommand::longDescription() const { QString description = Tr::tr( "qbs %1 [options] [config:] ...\n") .arg(representation()); description += Tr::tr("Removes build artifacts for the given configuration(s).\n"); return description += supportedOptionsDescription(); } QString CleanCommand::representation() const { return QStringLiteral("clean"); } QList CleanCommand::supportedOptions() const { return {CommandLineOption::BuildDirectoryOptionType, CommandLineOption::DryRunOptionType, CommandLineOption::KeepGoingOptionType, CommandLineOption::LogTimeOptionType, CommandLineOption::ProductsOptionType, CommandLineOption::QuietOptionType, CommandLineOption::SettingsDirOptionType, CommandLineOption::ShowProgressOptionType, CommandLineOption::VerboseOptionType}; } QString InstallCommand::shortDescription() const { return Tr::tr("Install (parts of) a project."); } QString InstallCommand::longDescription() const { QString description = Tr::tr( "qbs %1 [options] [[config:] [:] ...]\n") .arg(representation()); description += Tr::tr("Install all files marked as installable " "to their respective destinations.\n" "The project is built first, if necessary, unless the '%1' option " "is given.\n").arg(optionPool().noBuildOption()->longRepresentation()); return description += supportedOptionsDescription(); } QString InstallCommand::representation() const { return QStringLiteral("install"); } QList installOptions() { QList options = buildOptions() << CommandLineOption::InstallRootOptionType << CommandLineOption::NoBuildOptionType; options.removeOne(CommandLineOption::NoInstallOptionType); return options; } QList InstallCommand::supportedOptions() const { return installOptions(); } QString RunCommand::shortDescription() const { return QStringLiteral("Run an executable generated by building a project."); } QString RunCommand::longDescription() const { QString description = Tr::tr( "qbs %1 [options] [config:] [:] ... " "[ -- ]\n").arg(representation()); description += Tr::tr("Run the specified product's executable with the specified arguments.\n"); description += Tr::tr("If the project has only one product, the '%1' option may be omitted.\n") .arg(optionPool().productsOption()->longRepresentation()); description += Tr::tr("The product will be built if it is not up to date; " "see the '%2' command.\n").arg(buildCommandRepresentation()); return description += supportedOptionsDescription(); } QString RunCommand::representation() const { return QStringLiteral("run"); } QList RunCommand::supportedOptions() const { return QList() << installOptions() << CommandLineOption::RunEnvConfigOptionType; } void RunCommand::parseNext(QStringList &input) { QBS_CHECK(!input.empty()); if (input.front() != QLatin1String("--")) { Command::parseNext(input); return; } input.removeFirst(); m_targetParameters = input; input.clear(); } QString ShellCommand::shortDescription() const { return Tr::tr("Open a shell with a product's environment."); } QString ShellCommand::longDescription() const { QString description = Tr::tr( "qbs %1 [options] [config:] [:] ...\n") .arg(representation()); description += Tr::tr("Opens a shell in the same environment that a build with the given " "parameters would use.\n"); return description += supportedOptionsDescription(); } QString ShellCommand::representation() const { return QStringLiteral("shell"); } QList ShellCommand::supportedOptions() const { return {CommandLineOption::FileOptionType, CommandLineOption::BuildDirectoryOptionType, CommandLineOption::ProductsOptionType}; } QString StatusCommand::shortDescription() const { return Tr::tr("Show the status of files in the project directory."); } QString StatusCommand::longDescription() const { QString description = Tr::tr("qbs %1 [options] [config:]\n") .arg(representation()); description += Tr::tr("Lists all the files in the project directory and shows whether " "they are known to qbs in the respective configuration.\n"); return description += supportedOptionsDescription(); } QString StatusCommand::representation() const { return QStringLiteral("status"); } QList StatusCommand::supportedOptions() const { return {CommandLineOption::BuildDirectoryOptionType}; } QString UpdateTimestampsCommand::shortDescription() const { return Tr::tr("Mark the build as up to date."); } QString UpdateTimestampsCommand::longDescription() const { QString description = Tr::tr( "qbs %1 [options] [config:] ...\n") .arg(representation()); description += Tr::tr("Update the timestamps of all build artifacts, causing the next " "builds of the project to do nothing if no updates to source files happen in between.\n" "This functionality is useful if you know that the current changes to source files " "are irrelevant to the build.\n" "NOTE: Doing this causes a discrepancy between the \"real world\" and the information " "in the build graph, so use with care.\n"); return description += supportedOptionsDescription(); } QString UpdateTimestampsCommand::representation() const { return QStringLiteral("update-timestamps"); } QList UpdateTimestampsCommand::supportedOptions() const { return {CommandLineOption::BuildDirectoryOptionType, CommandLineOption::LogLevelOptionType, CommandLineOption::VerboseOptionType, CommandLineOption::QuietOptionType, CommandLineOption::ProductsOptionType}; } QString DumpNodesTreeCommand::shortDescription() const { return Tr::tr("Dumps the nodes in the build graph to stdout."); } QString DumpNodesTreeCommand::longDescription() const { QString description = Tr::tr("qbs %1 [options] [config:] ...\n") .arg(representation()); description += Tr::tr("Internal command; for debugging purposes only.\n"); return description += supportedOptionsDescription(); } QString DumpNodesTreeCommand::representation() const { return QStringLiteral("dump-nodes-tree"); } QList DumpNodesTreeCommand::supportedOptions() const { return {CommandLineOption::BuildDirectoryOptionType, CommandLineOption::ProductsOptionType}; } QString ListProductsCommand::shortDescription() const { return Tr::tr("Lists all products in the project, including sub-projects."); } QString ListProductsCommand::longDescription() const { QString description = Tr::tr("qbs %1 [options] [[config:] " "[:] ...] ...\n").arg(representation()); return description += supportedOptionsDescription(); } QString ListProductsCommand::representation() const { return QStringLiteral("list-products"); } QList ListProductsCommand::supportedOptions() const { return {CommandLineOption::FileOptionType, CommandLineOption::BuildDirectoryOptionType}; } QString HelpCommand::shortDescription() const { return Tr::tr("Show general or command-specific help."); } QString HelpCommand::longDescription() const { QString description = Tr::tr("qbs %1 []\n").arg(representation()); return description += Tr::tr("Shows either the general help or a description of " "the given command.\n"); } QString HelpCommand::representation() const { return QStringLiteral("help"); } QList HelpCommand::supportedOptions() const { return {}; } void HelpCommand::parseNext(QStringList &input) { if (input.empty()) return; if (input.size() > 1) throwError(Tr::tr("Cannot describe more than one command.")); m_command = input.takeFirst(); QBS_CHECK(input.empty()); } QString VersionCommand::shortDescription() const { return Tr::tr("Print the Qbs version number to stdout."); } QString VersionCommand::longDescription() const { QString description = Tr::tr("qbs %1\n").arg(representation()); return description += Tr::tr("%1\n").arg(shortDescription()); } QString VersionCommand::representation() const { return QStringLiteral("show-version"); } QList VersionCommand::supportedOptions() const { return {}; } void VersionCommand::parseNext(QStringList &input) { QBS_CHECK(!input.empty()); throwError(Tr::tr("This command takes no arguments.")); } QString SessionCommand::shortDescription() const { return Tr::tr("Starts a session for an IDE."); } QString SessionCommand::longDescription() const { QString description = Tr::tr("qbs %1\n").arg(representation()); return description += Tr::tr("Communicates on stdin and stdout via a JSON-based API.\n" "Intended for use with other tools, such as IDEs.\n"); } QString SessionCommand::representation() const { return QLatin1String("session"); } void SessionCommand::parseNext(QStringList &input) { QBS_CHECK(!input.empty()); throwError(Tr::tr("This command takes no arguments.")); } } // namespace qbs qbs-src-3.2.0/src/app/qbs/parser/commandlineoptionpool.h0000644000175100017510000000717515154533055022726 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_COMMANDLINEOPTIONPOOL_H #define QBS_COMMANDLINEOPTIONPOOL_H #include "commandlineoption.h" #include namespace qbs { class CommandLineOptionPool { public: ~CommandLineOptionPool(); CommandLineOption *getOption(CommandLineOption::Type type) const; FileOption *fileOption() const; BuildDirectoryOption *buildDirectoryOption() const; LogLevelOption *logLevelOption() const; VerboseOption *verboseOption() const; QuietOption *quietOption() const; ShowProgressOption *showProgressOption() const; DryRunOption *dryRunOption() const; ForceProbesOption *forceProbesOption() const; ChangedFilesOption *changedFilesOption() const; KeepGoingOption *keepGoingOption() const; JobsOption *jobsOption() const; ProductsOption *productsOption() const; NoInstallOption *noInstallOption() const; InstallRootOption *installRootOption() const; RemoveFirstOption *removeFirstoption() const; NoBuildOption *noBuildOption() const; ForceTimeStampCheckOption *forceTimestampCheckOption() const; ForceOutputCheckOption *forceOutputCheckOption() const; BuildNonDefaultOption *buildNonDefaultOption() const; LogTimeOption *logTimeOption() const; CommandEchoModeOption *commandEchoModeOption() const; SettingsDirOption *settingsDirOption() const; JobLimitsOption *jobLimitsOption() const; RespectProjectJobLimitsOption *respectProjectJobLimitsOption() const; GeneratorOption *generatorOption() const; WaitLockOption *waitLockOption() const; RunEnvConfigOption *runEnvConfigOption() const; DeprecationWarningsOption *deprecationWarningsOption() const; private: mutable QHash m_options; }; } // namespace qbs #endif // QBS_COMMANDLINEOPTIONPOOL_H qbs-src-3.2.0/src/app/qbs/parser/commandtype.h0000644000175100017510000000442015154533055020623 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 COMMANDTYPE_H #define COMMANDTYPE_H namespace qbs { enum CommandType { ResolveCommandType, BuildCommandType, CleanCommandType, RunCommandType, ShellCommandType, StatusCommandType, UpdateTimestampsCommandType, DumpNodesTreeCommandType, InstallCommandType, HelpCommandType, GenerateCommandType, ListProductsCommandType, VersionCommandType, SessionCommandType, }; } // namespace qbs #endif // COMMANDTYPE_H qbs-src-3.2.0/src/app/qbs/parser/parsercommand.h0000644000175100017510000002266215154533055021146 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_PARSER_COMMAND_H #define QBS_PARSER_COMMAND_H #include "commandlineoption.h" #include "commandtype.h" #include namespace qbs { class CommandLineOptionPool; class Command { public: virtual ~Command(); virtual CommandType type() const = 0; virtual QString shortDescription() const = 0; virtual QString longDescription() const = 0; virtual QString representation() const = 0; void parse(QStringList &input); QStringList additionalArguments() const { return m_additionalArguments; } bool canResolve() const; protected: Command(CommandLineOptionPool &optionPool) : m_optionPool(optionPool) {} const CommandLineOptionPool &optionPool() const { return m_optionPool; } QString supportedOptionsDescription() const; [[noreturn]] void throwError(const QString &reason); virtual void parseNext(QStringList &input); private: QList actualSupportedOptions() const; void parseOption(QStringList &input); void parsePropertyAssignment(const QString &argument); virtual QList supportedOptions() const = 0; QStringList m_additionalArguments; std::set m_usedOptions; const CommandLineOptionPool &m_optionPool; }; class ResolveCommand : public Command { public: ResolveCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} private: CommandType type() const override { return ResolveCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; }; class GenerateCommand : public Command { public: GenerateCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} private: CommandType type() const override { return GenerateCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; }; class BuildCommand : public Command { public: BuildCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} private: CommandType type() const override { return BuildCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; }; class CleanCommand : public Command { public: CleanCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} private: CommandType type() const override { return CleanCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; }; class InstallCommand : public Command { public: InstallCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} private: CommandType type() const override { return InstallCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; }; class RunCommand : public Command { public: RunCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} QStringList targetParameters() const { return m_targetParameters; } private: CommandType type() const override { return RunCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; void parseNext(QStringList &input) override; QStringList m_targetParameters; }; class ShellCommand : public Command { public: ShellCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} private: CommandType type() const override { return ShellCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; }; // TODO: It seems wrong that a configuration has to be given here. Ideally, this command would just track *all* files regardless of conditions. Is that possible? class StatusCommand : public Command { public: StatusCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} private: CommandType type() const override { return StatusCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; }; class UpdateTimestampsCommand : public Command { public: UpdateTimestampsCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} private: CommandType type() const override { return UpdateTimestampsCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; }; class DumpNodesTreeCommand : public Command { public: DumpNodesTreeCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} private: CommandType type() const override{ return DumpNodesTreeCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; }; class ListProductsCommand : public Command { public: ListProductsCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} private: CommandType type() const override { return ListProductsCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; }; class HelpCommand : public Command { public: HelpCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} QString commandToDescribe() const { return m_command; } private: CommandType type() const override { return HelpCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; void parseNext(QStringList &input) override; QString m_command; }; class VersionCommand : public Command { public: VersionCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} private: CommandType type() const override { return VersionCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override; void parseNext(QStringList &input) override; }; class SessionCommand : public Command { public: SessionCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {} private: CommandType type() const override { return SessionCommandType; } QString shortDescription() const override; QString longDescription() const override; QString representation() const override; QList supportedOptions() const override { return {}; } void parseNext(QStringList &input) override; }; } // namespace qbs #endif // QBS_PARSER_COMMAND_H qbs-src-3.2.0/src/app/qbs/parser/commandpool.h0000644000175100017510000000453215154533055020617 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_COMMANDPOOL_H #define QBS_COMMANDPOOL_H #include "commandtype.h" #include namespace qbs { class Command; class CommandLineOptionPool; class CommandPool { Q_DISABLE_COPY(CommandPool) public: CommandPool(CommandLineOptionPool &optionPool); ~CommandPool(); Command *getCommand(CommandType type) const; private: CommandLineOptionPool &m_optionPool; mutable QHash m_commands; }; } // namespace qbs #endif // QBS_COMMANDPOOL_H qbs-src-3.2.0/src/app/qbs/parser/commandlineoption.h0000644000175100017510000003145315154533055022030 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_COMMANDLINEOPTION_H #define QBS_COMMANDLINEOPTION_H #include "commandtype.h" #include #include #include #include namespace qbs { class CommandLineOption { public: enum Type { FileOptionType, BuildDirectoryOptionType, LogLevelOptionType, VerboseOptionType, QuietOptionType, JobsOptionType, KeepGoingOptionType, DryRunOptionType, ForceProbesOptionType, ShowProgressOptionType, ChangedFilesOptionType, ProductsOptionType, NoInstallOptionType, InstallRootOptionType, RemoveFirstOptionType, NoBuildOptionType, ForceTimestampCheckOptionType, ForceOutputCheckOptionType, BuildNonDefaultOptionType, LogTimeOptionType, CommandEchoModeOptionType, SettingsDirOptionType, JobLimitsOptionType, RespectProjectJobLimitsOptionType, GeneratorOptionType, WaitLockOptionType, RunEnvConfigOptionType, DeprecationWarningsOptionType, }; virtual ~CommandLineOption(); virtual QString description(CommandType command) const = 0; virtual QString shortRepresentation() const = 0; virtual QString longRepresentation() const = 0; virtual bool canAppearMoreThanOnce() const { return false; } void parse(CommandType command, const QString &representation, QStringList &input); protected: CommandLineOption(); QString getArgument(const QString &representation, QStringList &input); CommandType command() const { return m_command; } private: virtual void doParse(const QString &representation, QStringList &input) = 0; CommandType m_command; }; class FileOption : public CommandLineOption { public: QString projectFilePath() const { return m_projectFilePath; } private: QString description(CommandType command) const override; QString shortRepresentation() const override; QString longRepresentation() const override; void doParse(const QString &representation, QStringList &input) override; private: QString m_projectFilePath; }; class BuildDirectoryOption : public CommandLineOption { public: QString projectBuildDirectory() const { return m_projectBuildDirectory; } static QString magicProjectString(); static QString magicProjectDirString(); private: QString description(CommandType command) const override; QString shortRepresentation() const override; QString longRepresentation() const override; void doParse(const QString &representation, QStringList &input) override; private: QString m_projectBuildDirectory; }; class GeneratorOption : public CommandLineOption { public: QString generatorName() const { return m_generatorName; } private: QString description(CommandType command) const override; QString shortRepresentation() const override; QString longRepresentation() const override; void doParse(const QString &representation, QStringList &input) override; private: QString m_generatorName; }; class CountingOption : public CommandLineOption { public: int count() const { return m_count; } protected: CountingOption() : m_count(0) {} private: bool canAppearMoreThanOnce() const override{ return true; } void doParse(const QString &, QStringList &) override { ++m_count; } int m_count; }; class VerboseOption : public CountingOption { QString description(CommandType command) const override; QString shortRepresentation() const override; QString longRepresentation() const override; }; class QuietOption : public CountingOption { QString description(CommandType command) const override; QString shortRepresentation() const override; QString longRepresentation() const override; }; class JobsOption : public CommandLineOption { public: JobsOption() : m_jobCount(0) {} int jobCount() const { return m_jobCount; } private: QString description(CommandType command) const override; QString shortRepresentation() const override; QString longRepresentation() const override; void doParse(const QString &representation, QStringList &input) override; int m_jobCount; }; class OnOffOption : public CommandLineOption { public: bool enabled() const { return m_enabled; } protected: OnOffOption() : m_enabled(false) {} private: void doParse(const QString &, QStringList &) override { m_enabled = true; } bool m_enabled; }; class KeepGoingOption : public OnOffOption { QString description(CommandType command) const override; QString shortRepresentation() const override; QString longRepresentation() const override; }; class DryRunOption : public OnOffOption { QString description(CommandType command) const override; QString shortRepresentation() const override; QString longRepresentation() const override; }; class ForceProbesOption : public OnOffOption { QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; }; class NoInstallOption : public OnOffOption { QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; }; class ShowProgressOption : public OnOffOption { public: QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; }; class ForceTimeStampCheckOption : public OnOffOption { QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; }; class ForceOutputCheckOption : public OnOffOption { QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; }; class BuildNonDefaultOption : public OnOffOption { QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; }; class StringListOption : public CommandLineOption { public: QStringList arguments() const { return m_arguments; } private: void doParse(const QString &representation, QStringList &input) override; QStringList m_arguments; }; class ChangedFilesOption : public StringListOption { QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; }; class ProductsOption : public StringListOption { public: QString description(CommandType command) const override; QString shortRepresentation() const override; QString longRepresentation() const override; }; class RunEnvConfigOption : public StringListOption { QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; }; class LogLevelOption : public CommandLineOption { public: LogLevelOption(); int logLevel() const { return m_logLevel; } private: QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; void doParse(const QString &representation, QStringList &input) override; int m_logLevel; }; class InstallRootOption : public CommandLineOption { public: InstallRootOption(); QString installRoot() const { return m_installRoot; } bool useSysroot() const { return m_useSysroot; } QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; private: void doParse(const QString &representation, QStringList &input) override; QString m_installRoot; bool m_useSysroot; }; class RemoveFirstOption : public OnOffOption { public: QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; }; class NoBuildOption : public OnOffOption { public: QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; }; class LogTimeOption : public OnOffOption { public: QString description(CommandType command) const override; QString shortRepresentation() const override; QString longRepresentation() const override; }; class CommandEchoModeOption : public CommandLineOption { public: CommandEchoModeOption(); QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; CommandEchoMode commandEchoMode() const; private: void doParse(const QString &representation, QStringList &input) override; CommandEchoMode m_echoMode = CommandEchoModeInvalid; }; class DeprecationWarningsOption : public CommandLineOption { public: QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; DeprecationWarningMode mode() const { return m_mode; } private: void doParse(const QString &representation, QStringList &input) override; DeprecationWarningMode m_mode = defaultDeprecationWarningMode(); }; class SettingsDirOption : public CommandLineOption { public: SettingsDirOption(); QString settingsDir() const { return m_settingsDir; } QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; private: void doParse(const QString &representation, QStringList &input) override; QString m_settingsDir; }; class JobLimitsOption : public CommandLineOption { public: JobLimits jobLimits() const { return m_jobLimits; } QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; private: void doParse(const QString &representation, QStringList &input) override; JobLimits m_jobLimits; }; class RespectProjectJobLimitsOption : public OnOffOption { public: QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; }; class WaitLockOption : public OnOffOption { public: QString description(CommandType command) const override; QString shortRepresentation() const override { return {}; } QString longRepresentation() const override; }; } // namespace qbs #endif // QBS_COMMANDLINEOPTION_H qbs-src-3.2.0/src/app/qbs/parser/commandlineparser.h0000644000175100017510000000713015154533055022007 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_COMMANDLINEPARSER_H #define QBS_COMMANDLINEPARSER_H #include "commandtype.h" #include #include #include #include namespace qbs { class BuildOptions; class CleanOptions; class GenerateOptions; class InstallOptions; class Settings; class CommandLineParser { Q_DISABLE_COPY(CommandLineParser) public: CommandLineParser(); ~CommandLineParser(); bool parseCommandLine(const QStringList &args); void printHelp() const; CommandType command() const; QString commandName() const; bool commandCanResolve() const; QString commandDescription() const; QString projectFilePath() const; QString projectBuildDirectory() const; BuildOptions buildOptions(const QString &profile) const; CleanOptions cleanOptions(const QString &profile) const; GenerateOptions generateOptions() const; InstallOptions installOptions(const QString &profile) const; int jobCount(const QString &profile) const; bool forceTimestampCheck() const; bool forceOutputCheck() const; bool dryRun() const; bool forceProbesExecution() const; bool waitLockBuildGraph() const; bool logTime() const; bool withNonDefaultProducts() const; bool buildBeforeInstalling() const; QStringList runArgs() const; QStringList products() const; QStringList runEnvConfig() const; QList buildConfigurations() const; bool showProgress() const; bool showVersion() const; QString settingsDir() const; DeprecationWarningMode deprecationWarningMode() const; private: class CommandLineParserPrivate; std::unique_ptr d; }; } // namespace qbs #endif // QBS_COMMANDLINEPARSER_H qbs-src-3.2.0/src/app/qbs/parser/commandlineparser.cpp0000644000175100017510000005517615154533055022357 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "commandlineparser.h" #include "commandlineoption.h" #include "commandlineoptionpool.h" #include "commandpool.h" #include "parsercommand.h" #include "../qbstool.h" #include "../../shared/logging/consolelogger.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef Q_OS_UNIX #include #endif namespace qbs { using Internal::Tr; class CommandLineParser::CommandLineParserPrivate { public: CommandLineParserPrivate(); void doParse(); Command *commandFromString(const QString &commandString) const; QList allCommands() const; QString generalHelp() const; void setupProjectFile(); void setupBuildDirectory(); void setupProgress(); void setupLogLevel(); void setupBuildOptions(); void setupBuildConfigurations(); bool checkForExistingBuildConfiguration(const QList &buildConfigs, const QString &configurationName); bool withNonDefaultProducts() const; bool dryRun() const; QString settingsDir() const { return optionPool.settingsDirOption()->settingsDir(); } CommandEchoMode echoMode() const; QString propertyName(const QString &aCommandLineName) const; QStringList commandLine; Command *command; QString projectFilePath; QString projectBuildDirectory; BuildOptions buildOptions; QList buildConfigurations; CommandLineOptionPool optionPool; CommandPool commandPool; bool showProgress; bool logTime; }; CommandLineParser::CommandLineParser() = default; CommandLineParser::~CommandLineParser() = default; void CommandLineParser::printHelp() const { QTextStream stream(stdout); Q_ASSERT(d->command == d->commandPool.getCommand(HelpCommandType)); const auto helpCommand = static_cast(d->command); if (helpCommand->commandToDescribe().isEmpty()) { stream << "Qbs " QBS_VERSION ", a cross-platform build tool.\n"; stream << d->generalHelp(); } else { const Command * const commandToDescribe = d->commandFromString(helpCommand->commandToDescribe()); if (commandToDescribe) { stream << commandToDescribe->longDescription(); } else if (!QbsTool::tryToRunTool(helpCommand->commandToDescribe(), QStringList(QStringLiteral("--help")))) { throw ErrorInfo(Tr::tr("No such command '%1'.\n%2") .arg(helpCommand->commandToDescribe(), d->generalHelp())); } } } CommandType CommandLineParser::command() const { return d->command->type(); } QString CommandLineParser::projectFilePath() const { return d->projectFilePath; } QString CommandLineParser::projectBuildDirectory() const { return d->projectBuildDirectory; } BuildOptions CommandLineParser::buildOptions(const QString &profile) const { d->buildOptions.setMaxJobCount(jobCount(profile)); if (d->buildOptions.echoMode() < 0) { Settings settings(settingsDir()); d->buildOptions.setEchoMode(Preferences(&settings, profile).defaultEchoMode()); } return d->buildOptions; } CleanOptions CommandLineParser::cleanOptions(const QString &profile) const { CleanOptions options; options.setDryRun(buildOptions(profile).dryRun()); options.setKeepGoing(buildOptions(profile).keepGoing()); options.setLogElapsedTime(logTime()); return options; } GenerateOptions CommandLineParser::generateOptions() const { GenerateOptions options; options.setGeneratorName(d->optionPool.generatorOption()->generatorName()); return options; } InstallOptions CommandLineParser::installOptions(const QString &profile) const { InstallOptions options; options.setRemoveExistingInstallation(d->optionPool.removeFirstoption()->enabled()); options.setInstallRoot(d->optionPool.installRootOption()->installRoot()); options.setInstallIntoSysroot(d->optionPool.installRootOption()->useSysroot()); if (!options.installRoot().isEmpty()) { QFileInfo fi(options.installRoot()); if (!fi.isAbsolute()) options.setInstallRoot(fi.absoluteFilePath()); } options.setDryRun(buildOptions(profile).dryRun()); options.setKeepGoing(buildOptions(profile).keepGoing()); options.setLogElapsedTime(logTime()); return options; } int CommandLineParser::jobCount(const QString &profile) const { if (const int explicitJobCount = d->optionPool.jobsOption()->jobCount(); explicitJobCount > 0) return explicitJobCount; Settings settings(settingsDir()); return Preferences(&settings, profile).jobs(); } bool CommandLineParser::forceTimestampCheck() const { return d->optionPool.forceTimestampCheckOption()->enabled(); } bool CommandLineParser::forceOutputCheck() const { return d->optionPool.forceOutputCheckOption()->enabled(); } bool CommandLineParser::dryRun() const { return d->dryRun(); } bool CommandLineParser::forceProbesExecution() const { return d->optionPool.forceProbesOption()->enabled(); } bool CommandLineParser::waitLockBuildGraph() const { return d->optionPool.waitLockOption()->enabled(); } bool CommandLineParser::logTime() const { return d->logTime; } bool CommandLineParser::withNonDefaultProducts() const { return d->withNonDefaultProducts(); } bool CommandLineParser::buildBeforeInstalling() const { return !d->optionPool.noBuildOption()->enabled(); } QStringList CommandLineParser::runArgs() const { Q_ASSERT(d->command->type() == RunCommandType); return static_cast(d->command)->targetParameters(); } QStringList CommandLineParser::products() const { return d->optionPool.productsOption()->arguments(); } QStringList CommandLineParser::runEnvConfig() const { return d->optionPool.runEnvConfigOption()->arguments(); } bool CommandLineParser::showProgress() const { return d->showProgress; } bool CommandLineParser::showVersion() const { return d->command->type() == VersionCommandType; } QString CommandLineParser::settingsDir() const { return d->settingsDir(); } DeprecationWarningMode CommandLineParser::deprecationWarningMode() const { return d->optionPool.deprecationWarningsOption()->mode(); } QString CommandLineParser::commandName() const { return d->command->representation(); } bool CommandLineParser::commandCanResolve() const { return d->command->canResolve(); } QString CommandLineParser::commandDescription() const { return d->command->longDescription(); } static QString getBuildConfigurationName(const QVariantMap &buildConfig) { return buildConfig.value(QStringLiteral("qbs.configurationName")).toString(); } QList CommandLineParser::buildConfigurations() const { return d->buildConfigurations; } bool CommandLineParser::parseCommandLine(const QStringList &args) { d = std::make_unique(); d->commandLine = args; try { d->doParse(); return true; } catch (const ErrorInfo &error) { qbsError() << error.toString(); return false; } } CommandLineParser::CommandLineParserPrivate::CommandLineParserPrivate() : command(nullptr), commandPool(optionPool), showProgress(false), logTime(false) { } void CommandLineParser::CommandLineParserPrivate::doParse() { if (commandLine.empty()) { // No command given, use default. command = commandPool.getCommand(BuildCommandType); } else { command = commandFromString(commandLine.front()); if (command) { const QString commandName = commandLine.takeFirst(); // if the command line contains a `` with // either `-h` or `--help` switch, we transform // it to corresponding `help ` instead const QStringList helpSwitches = {QStringLiteral("-h"), QStringLiteral("--help")}; if (auto it = std::find_first_of( commandLine.begin(), commandLine.end(), helpSwitches.begin(), helpSwitches.end()); it != commandLine.end()) { command = commandPool.getCommand(HelpCommandType); commandLine = QList{commandName}; // keep only command's name } } else { // No command given. if (commandLine.front() == QLatin1String("-h") || commandLine.front() == QLatin1String("--help")) { command = commandPool.getCommand(HelpCommandType); commandLine.takeFirst(); } else if (commandLine.front() == QLatin1String("-V") || commandLine.front() == QLatin1String("--version")) { command = commandPool.getCommand(VersionCommandType); commandLine.takeFirst(); } else { command = commandPool.getCommand(BuildCommandType); } } } command->parse(commandLine); if (command->type() == HelpCommandType || command->type() == VersionCommandType) return; setupBuildDirectory(); setupBuildConfigurations(); setupProjectFile(); setupProgress(); setupLogLevel(); setupBuildOptions(); } Command *CommandLineParser::CommandLineParserPrivate::commandFromString(const QString &commandString) const { const auto commands = allCommands(); for (Command * const command : commands) { if (command->representation() == commandString) return command; } return nullptr; } QList CommandLineParser::CommandLineParserPrivate::allCommands() const { return {commandPool.getCommand(GenerateCommandType), commandPool.getCommand(ResolveCommandType), commandPool.getCommand(BuildCommandType), commandPool.getCommand(CleanCommandType), commandPool.getCommand(RunCommandType), commandPool.getCommand(ShellCommandType), commandPool.getCommand(StatusCommandType), commandPool.getCommand(UpdateTimestampsCommandType), commandPool.getCommand(InstallCommandType), commandPool.getCommand(DumpNodesTreeCommandType), commandPool.getCommand(ListProductsCommandType), commandPool.getCommand(VersionCommandType), commandPool.getCommand(SessionCommandType), commandPool.getCommand(HelpCommandType)}; } static QString extractToolDescription(const QString &tool, const QString &output) { if (tool == QLatin1String("create-project")) { // This command uses QCommandLineParser, where the description is not in the first line. const int eol1Pos = output.indexOf(QLatin1Char('\n')); const int eol2Pos = output.indexOf(QLatin1Char('\n'), eol1Pos + 1); return output.mid(eol1Pos + 1, eol2Pos - eol1Pos - 1); } return output.left(output.indexOf(QLatin1Char('\n'))); } QString CommandLineParser::CommandLineParserPrivate::generalHelp() const { QString help = Tr::tr("Usage: qbs [command] [command parameters]\n"); help += Tr::tr("Built-in commands:\n"); const int rhsIndentation = 30; // Sorting the commands by name is nicer for the user. QMap commandMap; const auto commands = allCommands(); for (const Command * command : commands) commandMap.insert(command->representation(), command); for (const Command * command : std::as_const(commandMap)) { help.append(QLatin1String(" ")).append(command->representation()); const QString whitespace = QString(rhsIndentation - 2 - command->representation().size(), QLatin1Char(' ')); help.append(whitespace).append(command->shortDescription()).append(QLatin1Char('\n')); } QStringList toolNames = QbsTool::allToolNames(); toolNames.sort(); if (!toolNames.empty()) { help.append(QLatin1Char('\n')).append(Tr::tr("Auxiliary commands:\n")); for (const QString &toolName : std::as_const(toolNames)) { help.append(QLatin1String(" ")).append(toolName); const QString whitespace = QString(rhsIndentation - 2 - toolName.size(), QLatin1Char(' ')); QbsTool tool; tool.runTool(toolName, QStringList(QStringLiteral("--help"))); if (tool.exitCode() != 0) continue; const QString shortDescription = extractToolDescription(toolName, tool.stdOut()); help.append(whitespace).append(shortDescription).append(QLatin1Char('\n')); } } return help; } void CommandLineParser::CommandLineParserPrivate::setupProjectFile() { projectFilePath = optionPool.fileOption()->projectFilePath(); } void CommandLineParser::CommandLineParserPrivate::setupBuildDirectory() { projectBuildDirectory = optionPool.buildDirectoryOption()->projectBuildDirectory(); } void CommandLineParser::CommandLineParserPrivate::setupBuildOptions() { buildOptions.setDryRun(dryRun()); QStringList changedFiles = optionPool.changedFilesOption()->arguments(); QDir currentDir; for (QString &file : changedFiles) file = QDir::fromNativeSeparators(currentDir.absoluteFilePath(file)); buildOptions.setChangedFiles(changedFiles); buildOptions.setKeepGoing(optionPool.keepGoingOption()->enabled()); buildOptions.setForceTimestampCheck(optionPool.forceTimestampCheckOption()->enabled()); buildOptions.setForceOutputCheck(optionPool.forceOutputCheckOption()->enabled()); const JobsOption * jobsOption = optionPool.jobsOption(); buildOptions.setMaxJobCount(jobsOption->jobCount()); buildOptions.setLogElapsedTime(logTime); buildOptions.setEchoMode(echoMode()); buildOptions.setInstall(!optionPool.noInstallOption()->enabled()); buildOptions.setRemoveExistingInstallation(optionPool.removeFirstoption()->enabled()); buildOptions.setJobLimits(optionPool.jobLimitsOption()->jobLimits()); buildOptions.setProjectJobLimitsTakePrecedence( optionPool.respectProjectJobLimitsOption()->enabled()); buildOptions.setSettingsDirectory(settingsDir()); } void CommandLineParser::CommandLineParserPrivate::setupBuildConfigurations() { // first: configuration name, second: properties. // Empty configuration name used for global properties. using PropertyListItem = std::pair; QList propertiesPerConfiguration; const QString configurationNameKey = QStringLiteral("qbs.configurationName"); QString currentConfigurationName; QVariantMap currentProperties; const auto args = command->additionalArguments(); for (const QString &arg : args) { const int sepPos = arg.indexOf(QLatin1Char(':')); QBS_CHECK(sepPos > 0); const QString key = arg.left(sepPos); const QString rawValue = arg.mid(sepPos + 1); if (key == QLatin1String("config") || key == configurationNameKey) { propertiesPerConfiguration.push_back(std::make_pair(currentConfigurationName, currentProperties)); currentConfigurationName = rawValue; currentProperties.clear(); continue; } currentProperties.insert(propertyName(key), representationToVariant(rawValue)); } propertiesPerConfiguration.push_back(std::make_pair(currentConfigurationName, currentProperties)); if (propertiesPerConfiguration.size() == 1) // No configuration name specified on command line. propertiesPerConfiguration.push_back(PropertyListItem(QStringLiteral("default"), QVariantMap())); const QVariantMap globalProperties = propertiesPerConfiguration.takeFirst().second; QList buildConfigs; for (const PropertyListItem &item : std::as_const(propertiesPerConfiguration)) { QVariantMap properties = item.second; for (QVariantMap::ConstIterator globalPropIt = globalProperties.constBegin(); globalPropIt != globalProperties.constEnd(); ++globalPropIt) { if (!properties.contains(globalPropIt.key())) properties.insert(globalPropIt.key(), globalPropIt.value()); } const QString configurationName = item.first; if (checkForExistingBuildConfiguration(buildConfigs, configurationName)) { qbsWarning() << Tr::tr("Ignoring redundant request to build for configuration '%1'.") .arg(configurationName); continue; } properties.insert(configurationNameKey, configurationName); buildConfigs.push_back(properties); } buildConfigurations = buildConfigs; } void CommandLineParser::CommandLineParserPrivate::setupProgress() { const ShowProgressOption * const option = optionPool.showProgressOption(); showProgress = option->enabled(); #ifdef Q_OS_UNIX if (showProgress && !isatty(STDOUT_FILENO)) { showProgress = false; qbsWarning() << Tr::tr("Ignoring option '%1', because standard output is " "not connected to a terminal.").arg(option->longRepresentation()); } #endif } void CommandLineParser::CommandLineParserPrivate::setupLogLevel() { const LogLevelOption * const logLevelOption = optionPool.logLevelOption(); const VerboseOption * const verboseOption = optionPool.verboseOption(); const QuietOption * const quietOption = optionPool.quietOption(); int logLevel = logLevelOption->logLevel(); logLevel += verboseOption->count(); logLevel -= quietOption->count(); if (showProgress && logLevel != LoggerMinLevel) { const bool logLevelWasSetByUser = logLevelOption->logLevel() != defaultLogLevel() || verboseOption->count() > 0 || quietOption->count() > 0; if (logLevelWasSetByUser) { qbsInfo() << Tr::tr("Setting log level to '%1', because option '%2'" " has been given.").arg(logLevelName(LoggerMinLevel), optionPool.showProgressOption()->longRepresentation()); } logLevel = LoggerMinLevel; } if (logLevel < LoggerMinLevel) { qbsWarning() << Tr::tr("Cannot decrease log level as much as specified; using '%1'.") .arg(logLevelName(LoggerMinLevel)); logLevel = LoggerMinLevel; } else if (logLevel > LoggerMaxLevel) { qbsWarning() << Tr::tr("Cannot increase log level as much as specified; using '%1'.") .arg(logLevelName(LoggerMaxLevel)); logLevel = LoggerMaxLevel; } logTime = optionPool.logTimeOption()->enabled(); if (showProgress && logTime) { qbsWarning() << Tr::tr("Options '%1' and '%2' are incompatible. Ignoring '%2'.") .arg(optionPool.showProgressOption()->longRepresentation(), optionPool.logTimeOption()->longRepresentation()); logTime = false; } ConsoleLogger::instance().logSink()->setLogLevel(static_cast(logLevel)); } QString CommandLineParser::CommandLineParserPrivate::propertyName(const QString &aCommandLineName) const { // Make fully-qualified, ie "platform" -> "qbs.platform" if (aCommandLineName.contains(QLatin1Char('.'))) return aCommandLineName; return QLatin1String("qbs.") + aCommandLineName; } bool CommandLineParser::CommandLineParserPrivate::checkForExistingBuildConfiguration( const QList &buildConfigs, const QString &configurationName) { return Internal::any_of(buildConfigs, [&configurationName](const auto &buildConfig) { return configurationName == getBuildConfigurationName(buildConfig); }); } bool CommandLineParser::CommandLineParserPrivate::withNonDefaultProducts() const { if (command->type() == GenerateCommandType) return true; return optionPool.buildNonDefaultOption()->enabled(); } bool CommandLineParser::CommandLineParserPrivate::dryRun() const { if (command->type() == GenerateCommandType || command->type() == ListProductsCommandType) return true; return optionPool.dryRunOption()->enabled(); } CommandEchoMode CommandLineParser::CommandLineParserPrivate::echoMode() const { if (command->type() == GenerateCommandType) return CommandEchoModeSilent; if (optionPool.commandEchoModeOption()->commandEchoMode() < CommandEchoModeInvalid) return optionPool.commandEchoModeOption()->commandEchoMode(); return defaultCommandEchoMode(); } } // namespace qbs qbs-src-3.2.0/src/app/qbs/parser/commandpool.cpp0000644000175100017510000000740715154533055021156 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "commandpool.h" #include "parsercommand.h" namespace qbs { CommandPool::CommandPool(CommandLineOptionPool &optionPool) : m_optionPool(optionPool) { } CommandPool::~CommandPool() { qDeleteAll(m_commands); } qbs::Command *CommandPool::getCommand(CommandType type) const { Command *& command = m_commands[type]; if (!command) { switch (type) { case ResolveCommandType: command = new ResolveCommand(m_optionPool); break; case GenerateCommandType: command = new GenerateCommand(m_optionPool); break; case BuildCommandType: command = new BuildCommand(m_optionPool); break; case CleanCommandType: command = new CleanCommand(m_optionPool); break; case RunCommandType: command = new RunCommand(m_optionPool); break; case ShellCommandType: command = new ShellCommand(m_optionPool); break; case StatusCommandType: command = new StatusCommand(m_optionPool); break; case UpdateTimestampsCommandType: command = new UpdateTimestampsCommand(m_optionPool); break; case InstallCommandType: command = new InstallCommand(m_optionPool); break; case DumpNodesTreeCommandType: command = new DumpNodesTreeCommand(m_optionPool); break; case ListProductsCommandType: command = new ListProductsCommand(m_optionPool); break; case HelpCommandType: command = new HelpCommand(m_optionPool); break; case VersionCommandType: command = new VersionCommand(m_optionPool); break; case SessionCommandType: command = new SessionCommand(m_optionPool); break; } } return command; } } // namespace qbs qbs-src-3.2.0/src/app/qbs/parser/commandlineoptionpool.cpp0000644000175100017510000002435715154533055023262 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "commandlineoptionpool.h" namespace qbs { CommandLineOptionPool::~CommandLineOptionPool() { qDeleteAll(m_options); } CommandLineOption *CommandLineOptionPool::getOption(CommandLineOption::Type type) const { CommandLineOption *& option = m_options[type]; if (!option) { switch (type) { case CommandLineOption::FileOptionType: option = new FileOption; break; case CommandLineOption::BuildDirectoryOptionType: option = new BuildDirectoryOption; break; case CommandLineOption::LogLevelOptionType: option = new LogLevelOption; break; case CommandLineOption::VerboseOptionType: option = new VerboseOption; break; case CommandLineOption::QuietOptionType: option = new QuietOption; break; case CommandLineOption::JobsOptionType: option = new JobsOption; break; case CommandLineOption::KeepGoingOptionType: option = new KeepGoingOption; break; case CommandLineOption::DryRunOptionType: option = new DryRunOption; break; case CommandLineOption::ForceProbesOptionType: option = new ForceProbesOption; break; case CommandLineOption::ShowProgressOptionType: option = new ShowProgressOption; break; case CommandLineOption::ChangedFilesOptionType: option = new ChangedFilesOption; break; case CommandLineOption::ProductsOptionType: option = new ProductsOption; break; case CommandLineOption::NoInstallOptionType: option = new NoInstallOption; break; case CommandLineOption::InstallRootOptionType: option = new InstallRootOption; break; case CommandLineOption::RemoveFirstOptionType: option = new RemoveFirstOption; break; case CommandLineOption::NoBuildOptionType: option = new NoBuildOption; break; case CommandLineOption::ForceTimestampCheckOptionType: option = new ForceTimeStampCheckOption; break; case CommandLineOption::ForceOutputCheckOptionType: option = new ForceOutputCheckOption; break; case CommandLineOption::BuildNonDefaultOptionType: option = new BuildNonDefaultOption; break; case CommandLineOption::LogTimeOptionType: option = new LogTimeOption; break; case CommandLineOption::CommandEchoModeOptionType: option = new CommandEchoModeOption; break; case CommandLineOption::SettingsDirOptionType: option = new SettingsDirOption; break; case CommandLineOption::JobLimitsOptionType: option = new JobLimitsOption; break; case CommandLineOption::RespectProjectJobLimitsOptionType: option = new RespectProjectJobLimitsOption; break; case CommandLineOption::GeneratorOptionType: option = new GeneratorOption; break; case CommandLineOption::WaitLockOptionType: option = new WaitLockOption; break; case CommandLineOption::RunEnvConfigOptionType: option = new RunEnvConfigOption; break; case CommandLineOption::DeprecationWarningsOptionType: option = new DeprecationWarningsOption; break; default: qFatal("Unknown option type %d", type); } } return option; } FileOption *CommandLineOptionPool::fileOption() const { return static_cast(getOption(CommandLineOption::FileOptionType)); } BuildDirectoryOption *CommandLineOptionPool::buildDirectoryOption() const { return static_cast(getOption(CommandLineOption::BuildDirectoryOptionType)); } LogLevelOption *CommandLineOptionPool::logLevelOption() const { return static_cast(getOption(CommandLineOption::LogLevelOptionType)); } VerboseOption *CommandLineOptionPool::verboseOption() const { return static_cast(getOption(CommandLineOption::VerboseOptionType)); } QuietOption *CommandLineOptionPool::quietOption() const { return static_cast(getOption(CommandLineOption::QuietOptionType)); } ShowProgressOption *CommandLineOptionPool::showProgressOption() const { return static_cast(getOption(CommandLineOption::ShowProgressOptionType)); } DryRunOption *CommandLineOptionPool::dryRunOption() const { return static_cast(getOption(CommandLineOption::DryRunOptionType)); } ForceProbesOption *CommandLineOptionPool::forceProbesOption() const { return static_cast(getOption(CommandLineOption::ForceProbesOptionType)); } ChangedFilesOption *CommandLineOptionPool::changedFilesOption() const { return static_cast(getOption(CommandLineOption::ChangedFilesOptionType)); } KeepGoingOption *CommandLineOptionPool::keepGoingOption() const { return static_cast(getOption(CommandLineOption::KeepGoingOptionType)); } JobsOption *CommandLineOptionPool::jobsOption() const { return static_cast(getOption(CommandLineOption::JobsOptionType)); } ProductsOption *CommandLineOptionPool::productsOption() const { return static_cast(getOption(CommandLineOption::ProductsOptionType)); } NoInstallOption *CommandLineOptionPool::noInstallOption() const { return static_cast(getOption(CommandLineOption::NoInstallOptionType)); } InstallRootOption *CommandLineOptionPool::installRootOption() const { return static_cast(getOption(CommandLineOption::InstallRootOptionType)); } RemoveFirstOption *CommandLineOptionPool::removeFirstoption() const { return static_cast(getOption(CommandLineOption::RemoveFirstOptionType)); } NoBuildOption *CommandLineOptionPool::noBuildOption() const { return static_cast(getOption(CommandLineOption::NoBuildOptionType)); } ForceTimeStampCheckOption *CommandLineOptionPool::forceTimestampCheckOption() const { return static_cast( getOption(CommandLineOption::ForceTimestampCheckOptionType)); } ForceOutputCheckOption *CommandLineOptionPool::forceOutputCheckOption() const { return static_cast( getOption(CommandLineOption::ForceOutputCheckOptionType)); } BuildNonDefaultOption *CommandLineOptionPool::buildNonDefaultOption() const { return static_cast( getOption(CommandLineOption::BuildNonDefaultOptionType)); } LogTimeOption *CommandLineOptionPool::logTimeOption() const { return static_cast(getOption(CommandLineOption::LogTimeOptionType)); } CommandEchoModeOption *CommandLineOptionPool::commandEchoModeOption() const { return static_cast( getOption(CommandLineOption::CommandEchoModeOptionType)); } SettingsDirOption *CommandLineOptionPool::settingsDirOption() const { return static_cast(getOption(CommandLineOption::SettingsDirOptionType)); } JobLimitsOption *CommandLineOptionPool::jobLimitsOption() const { return static_cast(getOption(CommandLineOption::JobLimitsOptionType)); } RespectProjectJobLimitsOption *CommandLineOptionPool::respectProjectJobLimitsOption() const { return static_cast( getOption(CommandLineOption::RespectProjectJobLimitsOptionType)); } GeneratorOption *CommandLineOptionPool::generatorOption() const { return static_cast(getOption(CommandLineOption::GeneratorOptionType)); } WaitLockOption *CommandLineOptionPool::waitLockOption() const { return static_cast(getOption(CommandLineOption::WaitLockOptionType)); } RunEnvConfigOption *CommandLineOptionPool::runEnvConfigOption() const { return static_cast(getOption(CommandLineOption::RunEnvConfigOptionType)); } DeprecationWarningsOption *CommandLineOptionPool::deprecationWarningsOption() const { return static_cast (getOption(CommandLineOption::DeprecationWarningsOptionType)); } } // namespace qbs qbs-src-3.2.0/src/app/qbs/parser/commandlineoption.cpp0000644000175100017510000005710515154533055022365 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "commandlineoption.h" #include #include #include #include #include namespace qbs { using namespace Internal; CommandLineOption::~CommandLineOption() = default; void CommandLineOption::parse(CommandType command, const QString &representation, QStringList &input) { m_command = command; doParse(representation, input); } CommandLineOption::CommandLineOption() : m_command(static_cast(-1)) { } QString CommandLineOption::getArgument(const QString &representation, QStringList &input) { if (input.empty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1': Missing argument.\nUsage: %2") .arg(representation, description(command()))); } return input.takeFirst(); } QString FileOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1|%2 \n" "\tUse as the project file.\n" "\tIf is a directory and it contains a single file ending in '.qbs',\n" "\tthat file will be used.\n" "\tIf this option is not given at all, behavior is the same as for '-f .'.\n") .arg(longRepresentation(), shortRepresentation()); } QString FileOption::shortRepresentation() const { return QStringLiteral("-f"); } QString FileOption::longRepresentation() const { return QStringLiteral("--file"); } void FileOption::doParse(const QString &representation, QStringList &input) { m_projectFilePath = getArgument(representation, input); } QString BuildDirectoryOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1|%2 \n" "\tBuild in the given directory. The default value is the current directory\n" "\tunless preferences.defaultBuildDirectory is set.\n" "\tRelative paths will be interpreted relative to the current directory.\n" "\tIf the directory does not exist, it will be created. Use the following\n" "\tspecial values as placeholders:\n" "\t%3: name of the project file excluding the extension\n" "\t%4: directory containing the project file\n") .arg(longRepresentation(), shortRepresentation(), magicProjectString(), magicProjectDirString()); } QString BuildDirectoryOption::shortRepresentation() const { return QStringLiteral("-d"); } QString BuildDirectoryOption::longRepresentation() const { return QStringLiteral("--build-directory"); } QString BuildDirectoryOption::magicProjectString() { return QStringLiteral("@project"); } QString BuildDirectoryOption::magicProjectDirString() { return QStringLiteral("@path"); } void BuildDirectoryOption::doParse(const QString &representation, QStringList &input) { m_projectBuildDirectory = getArgument(representation, input); } QString GeneratorOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1|%2 \n" "\tUse the given build system generator.\n") .arg(longRepresentation(), shortRepresentation()); } QString GeneratorOption::shortRepresentation() const { return QStringLiteral("-g"); } QString GeneratorOption::longRepresentation() const { return QStringLiteral("--generator"); } void GeneratorOption::doParse(const QString &representation, QStringList &input) { m_generatorName = getArgument(representation, input); if (m_generatorName.isEmpty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1': No generator given.\nUsage: %2") .arg(representation, description(command()))); } } static QString loglevelLongRepresentation() { return QStringLiteral("--log-level"); } QString VerboseOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1|%2\n" "\tBe more verbose. Increases the log level by one.\n" "\tThis option can be given more than once.\n" "\tExcessive occurrences have no effect.\n" "\tIf option '%3' appears anywhere on the command line in addition\n" "\tto this option, its value is taken as the base which to increase.\n") .arg(longRepresentation(), shortRepresentation(), loglevelLongRepresentation()); } QString VerboseOption::shortRepresentation() const { return QStringLiteral("-v"); } QString VerboseOption::longRepresentation() const { return QStringLiteral("--more-verbose"); } QString QuietOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1|%2\n" "\tBe more quiet. Decreases the log level by one.\n" "\tThis option can be given more than once.\n" "\tExcessive occurrences have no effect.\n" "\tIf option '%3' appears anywhere on the command line in addition\n" "\tto this option, its value is taken as the base which to decrease.\n") .arg(longRepresentation(), shortRepresentation(), loglevelLongRepresentation()); } QString QuietOption::shortRepresentation() const { return QStringLiteral("-q"); } QString QuietOption::longRepresentation() const { return QStringLiteral("--less-verbose"); } QString JobsOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1|%2 \n" "\tUse concurrent build jobs. must be an integer greater than zero.\n" "\tThe default is the number of cores.\n") .arg(longRepresentation(), shortRepresentation()); } QString JobsOption::shortRepresentation() const { return QStringLiteral("-j"); } QString JobsOption::longRepresentation() const { return QStringLiteral("--jobs"); } void JobsOption::doParse(const QString &representation, QStringList &input) { const QString jobCountString = getArgument(representation, input); bool stringOk; m_jobCount = jobCountString.toInt(&stringOk); if (!stringOk || m_jobCount <= 0) throw ErrorInfo(Tr::tr("Invalid use of option '%1': Illegal job count '%2'.\nUsage: %3") .arg(representation, jobCountString, description(command()))); } QString KeepGoingOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1|%2\n" "\tKeep going when errors occur (if at all possible).\n") .arg(longRepresentation(), shortRepresentation()); } QString KeepGoingOption::shortRepresentation() const { return QStringLiteral("-k"); } QString KeepGoingOption::longRepresentation() const { return QStringLiteral("--keep-going"); } QString DryRunOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1|%2\n" "\tDry run. No commands will be executed and no permanent changes to the\n" "\tbuild graph will be done.\n") .arg(longRepresentation(), shortRepresentation()); } QString DryRunOption::shortRepresentation() const { return QStringLiteral("-n"); } QString DryRunOption::longRepresentation() const { return QStringLiteral("--dry-run"); } QString ForceProbesOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1\n" "\tForce re-execution of all Probe items' configure scripts, rather than using the\n" "\tcached data.\n") .arg(longRepresentation()); } QString ForceProbesOption::longRepresentation() const { return QStringLiteral("--force-probe-execution"); } QString NoInstallOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1\n" "\tDo not install any artifacts as part of the build process.\n") .arg(longRepresentation()); } QString NoInstallOption::longRepresentation() const { return QStringLiteral("--no-install"); } static QString logTimeRepresentation() { return QStringLiteral("--log-time"); } QString ShowProgressOption::description(CommandType command) const { Q_UNUSED(command); QString desc = Tr::tr("%1\n" "\tShow a progress bar. Implies '%2=%3'.\n").arg(longRepresentation(), loglevelLongRepresentation(), logLevelName(LoggerMinLevel)); return desc += Tr::tr("\tThis option is mutually exclusive with '%1'.\n") .arg(logTimeRepresentation()); } static QString showProgressRepresentation() { return QStringLiteral("--show-progress"); } QString ShowProgressOption::longRepresentation() const { return showProgressRepresentation(); } void StringListOption::doParse(const QString &representation, QStringList &input) { m_arguments = getArgument(representation, input).split(QLatin1Char(',')); if (m_arguments.empty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1': Argument list must not be empty.\n" "Usage: %2").arg(representation, description(command()))); } for (const QString &element : std::as_const(m_arguments)) { if (element.isEmpty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1': Argument list must not contain " "empty elements.\nUsage: %2") .arg(representation, description(command()))); } } } QString ChangedFilesOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1 [,...]\n" "\tAssume these and only these files have changed.\n").arg(longRepresentation()); } QString ChangedFilesOption::longRepresentation() const { return QStringLiteral("--changed-files"); } QString ProductsOption::description(CommandType command) const { const QString prefix = Tr::tr("%1|%2").arg(longRepresentation(), shortRepresentation()); switch (command) { case InstallCommandType: case RunCommandType: case ShellCommandType: return Tr::tr("%1 \n\tUse the specified product.\n").arg(prefix); default: return Tr::tr("%1 [,...]\n" "\tTake only the specified products into account.\n").arg(prefix); } } QString ProductsOption::shortRepresentation() const { return QStringLiteral("-p"); } QString ProductsOption::longRepresentation() const { return QStringLiteral("--products"); } static QStringList allLogLevelStrings() { QStringList result; for (int i = static_cast(LoggerMinLevel); i <= static_cast(LoggerMaxLevel); ++i) result << logLevelName(static_cast(i)); return result; } LogLevelOption::LogLevelOption() : m_logLevel(defaultLogLevel()) { } QString LogLevelOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1 \n" "\tUse the specified log level.\n" "\tPossible values are '%2'.\n" "\tThe default is '%3'.\n").arg(longRepresentation(), allLogLevelStrings().join(QLatin1String("', '")), logLevelName(defaultLogLevel())); } QString LogLevelOption::longRepresentation() const { return loglevelLongRepresentation(); } void LogLevelOption::doParse(const QString &representation, QStringList &input) { const QString levelString = getArgument(representation, input); const QList levels = QList() << LoggerError << LoggerWarning << LoggerInfo << LoggerDebug << LoggerTrace; for (const LoggerLevel &l : levels) { if (logLevelName(l) == levelString) { m_logLevel = l; return; } } throw ErrorInfo(Tr::tr("Invalid use of option '%1': Unknown log level '%2'.\nUsage: %3") .arg(representation, levelString, description(command()))); } QString ForceTimeStampCheckOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1\n\tForce timestamp checks.\n" "\tInstead of using the file timestamps that are stored in the build graph,\n" "\tretrieve the timestamps from the file system.\n").arg(longRepresentation()); } QString ForceTimeStampCheckOption::longRepresentation() const { return QStringLiteral("--check-timestamps"); } QString ForceOutputCheckOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1\n\tForce transformer output artifact checks.\n" "\tVerify that the output artifacts declared by rules in the\n" "\tproject are actually created.\n").arg(longRepresentation()); } QString ForceOutputCheckOption::longRepresentation() const { return QStringLiteral("--check-outputs"); } QString BuildNonDefaultOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1\n\tBuild all products, even if their builtByDefault property is false.\n") .arg(longRepresentation()); } QString BuildNonDefaultOption::longRepresentation() const { return QStringLiteral("--all-products"); } InstallRootOption::InstallRootOption() : m_useSysroot(false) { } static QString magicSysrootString() { return QStringLiteral("@sysroot"); } QString InstallRootOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1 \n" "\tInstall into the given directory.\n" "\tThe default value is '/%2'.\n" "\tIf the directory does not exist, it will be created. Use the special\n" "\tvalue '%3' to install into the sysroot (i.e. the value of the\n" "\tproperty qbs.sysroot).\n") .arg(longRepresentation(), InstallOptions::defaultInstallRoot(), magicSysrootString()); } QString InstallRootOption::longRepresentation() const { return QStringLiteral("--install-root"); } void InstallRootOption::doParse(const QString &representation, QStringList &input) { if (input.empty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1: Argument expected.\n" "Usage: %2").arg(representation, description(command()))); } const QString installRoot = input.takeFirst(); if (installRoot == magicSysrootString()) m_useSysroot = true; else m_installRoot = installRoot; } QString RemoveFirstOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1\n\tRemove the installation base directory before installing.\n") .arg(longRepresentation()); } QString RemoveFirstOption::longRepresentation() const { return QStringLiteral("--clean-install-root"); } QString NoBuildOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1\n\tDo not build before installing.\n") .arg(longRepresentation()); } QString NoBuildOption::longRepresentation() const { return QStringLiteral("--no-build"); } QString LogTimeOption::description(CommandType command) const { Q_UNUSED(command); QString desc = Tr::tr("%1\n\tLog the time that the operations involved in this command take.\n") .arg(longRepresentation()); desc += Tr::tr("\tThis option is implied in log levels '%1' and higher.\n") .arg(logLevelName(LoggerDebug)); return desc += Tr::tr("\tThis option is mutually exclusive with '%1'.\n") .arg(showProgressRepresentation()); } QString LogTimeOption::shortRepresentation() const { return QStringLiteral("-t"); } QString LogTimeOption::longRepresentation() const { return logTimeRepresentation(); } SettingsDirOption::SettingsDirOption() = default; QString SettingsDirOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1 \n" "\tRead all settings (such as profile information) from the given directory.\n" "\tThe default value is system-specific (see the QSettings documentation).\n" "\tIf the directory does not exist, it will be created.\n") .arg(longRepresentation()); } QString SettingsDirOption::longRepresentation() const { return QStringLiteral("--settings-dir"); } void SettingsDirOption::doParse(const QString &representation, QStringList &input) { if (input.empty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1: Argument expected.\n" "Usage: %2").arg(representation, description(command()))); } m_settingsDir = input.takeFirst(); } QString JobLimitsOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1 :[,:...]\n" "\tSet pool-specific job limits.\n").arg(longRepresentation()); } QString JobLimitsOption::longRepresentation() const { return QStringLiteral("--job-limits"); } void JobLimitsOption::doParse(const QString &representation, QStringList &input) { if (input.empty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1: Argument expected.\n" "Usage: %2").arg(representation, description(command()))); } const QString jobLimitsSpec = input.takeFirst(); const QStringList jobLimitStrings = jobLimitsSpec.split(QLatin1Char(',')); for (const QString &jobLimitString : jobLimitStrings) { const int sepIndex = jobLimitString.indexOf(QLatin1Char(':')); if (sepIndex <= 0 || sepIndex == jobLimitString.size() - 1) { throw ErrorInfo(Tr::tr("Invalid use of option '%1: " "Invalid job limits specification '%2'.\n" "Usage: %3").arg(representation, jobLimitsSpec, description(command()))); } const QString pool = jobLimitString.left(sepIndex); const QString limitString = jobLimitString.mid(sepIndex + 1); bool isValidNumber; const int limit = limitString.toInt(&isValidNumber); if (!isValidNumber) { throw ErrorInfo(Tr::tr("Invalid use of option '%1: '%2' is not a number.\n" "Usage: %3").arg(representation, limitString, description(command()))); } m_jobLimits.setJobLimit(pool, limit); } } QString RespectProjectJobLimitsOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1\n\tGive maximum priority to job limits defined inside the project.\n") .arg(longRepresentation()); } QString RespectProjectJobLimitsOption::longRepresentation() const { return QStringLiteral("--enforce-project-job-limits"); } CommandEchoModeOption::CommandEchoModeOption() = default; QString CommandEchoModeOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1 \n" "\tKind of output to show when executing commands.\n" "\tPossible values are '%2'.\n" "\tThe default is '%3'.\n") .arg(longRepresentation(), allCommandEchoModeStrings().join(QLatin1String("', '")), commandEchoModeName(defaultCommandEchoMode())); } QString CommandEchoModeOption::longRepresentation() const { return QStringLiteral("--command-echo-mode"); } CommandEchoMode CommandEchoModeOption::commandEchoMode() const { return m_echoMode; } void CommandEchoModeOption::doParse(const QString &representation, QStringList &input) { const QString mode = getArgument(representation, input); if (mode.isEmpty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1': No command echo mode given.\nUsage: %2") .arg(representation, description(command()))); } if (!allCommandEchoModeStrings().contains(mode)) { throw ErrorInfo(Tr::tr("Invalid use of option '%1': " "Invalid command echo mode '%2' given.\nUsage: %3") .arg(representation, mode, description(command()))); } m_echoMode = commandEchoModeFromName(mode); } QString DeprecationWarningsOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1 \n" "\tWhat to do when encountering deprecated items or properties.\n" "\tPossible values are '%2'.\n" "\tThe default is '%3'.\n") .arg(longRepresentation(), allDeprecationWarningModeStrings().join(QLatin1String("', '")), deprecationWarningModeName(defaultDeprecationWarningMode())); } QString DeprecationWarningsOption::longRepresentation() const { return QStringLiteral("--deprecation-warnings"); } void DeprecationWarningsOption::doParse(const QString &representation, QStringList &input) { const QString mode = getArgument(representation, input); if (mode.isEmpty()) { throw ErrorInfo(Tr::tr("Invalid use of option '%1': No deprecation warning mode given.\n" "Usage: %2") .arg(representation, description(command()))); } if (!allDeprecationWarningModeStrings().contains(mode)) { throw ErrorInfo(Tr::tr("Invalid use of option '%1': " "Invalid deprecation warning mode '%2' given.\nUsage: %3") .arg(representation, mode, description(command()))); } m_mode = deprecationWarningModeFromName(mode); } QString WaitLockOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1\n\tWait indefinitely for other processes to release the build graph lock.\n") .arg(longRepresentation()); } QString WaitLockOption::longRepresentation() const { return QStringLiteral("--wait-lock"); } QString RunEnvConfigOption::description(CommandType command) const { Q_UNUSED(command); return Tr::tr("%1\n\tComma-separated list of strings to pass to all modules' " "setupRunEnvironment scripts.\n").arg(longRepresentation()); } QString RunEnvConfigOption::longRepresentation() const { return QStringLiteral("--setup-run-env-config"); } } // namespace qbs qbs-src-3.2.0/src/app/qbs/consoleprogressobserver.cpp0000644000175100017510000001007415154533055022343 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "consoleprogressobserver.h" #include #include #include namespace qbs { void ConsoleProgressObserver::initialize(const QString &task, int max) { m_maximum = max; m_value = 0; m_percentage = 0; m_hashesPrinted = 0; std::cout << task.toLocal8Bit().constData() << ": 0%" << std::flush; setMaximum(max); } void ConsoleProgressObserver::setMaximum(int maximum) { m_maximum = maximum; if (maximum == 0) { m_percentage = 100; updateProgressBarIfNecessary(); writePercentageString(); std::cout << std::endl; } } void ConsoleProgressObserver::setProgressValue(int value) { if (value > m_maximum || value <= m_value) return; // TODO: Should be an assertion, but the executor currently breaks it. m_value = value; const int newPercentage = (100 * m_value) / m_maximum; if (newPercentage == m_percentage) return; eraseCurrentPercentageString(); m_percentage = newPercentage; updateProgressBarIfNecessary(); writePercentageString(); if (m_value == m_maximum) std::cout << std::endl; else std::cout << std::flush; } void ConsoleProgressObserver::eraseCurrentPercentageString() { const int charsToErase = m_percentage == 0 ? 2 : m_percentage < 10 ? 3 : 4; const QByteArray backspaceCommand(charsToErase, '\b'); // Move cursor before the old percentage string. std::cout << backspaceCommand.constData(); // Erase old percentage string. std::cout << QByteArray(charsToErase, ' ').constData(); // Move cursor before the erased string. std::cout << backspaceCommand.constData(); } void ConsoleProgressObserver::updateProgressBarIfNecessary() { static const int TotalHashCount = 50; // Should fit on most terminals without a line break. const int hashesNeeded = (m_percentage * TotalHashCount) / 100; if (m_hashesPrinted < hashesNeeded) { std::cout << QByteArray(hashesNeeded - m_hashesPrinted, '#').constData(); m_hashesPrinted = hashesNeeded; } } void ConsoleProgressObserver::writePercentageString() { std::cout << QStringLiteral(" %1%").arg(m_percentage).toLocal8Bit().constData(); } } // namespace qbs qbs-src-3.2.0/src/app/qbs/qbstool.h0000644000175100017510000000502515154533055016474 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_QBSTOOL_H #define QBS_QBSTOOL_H #include class QbsTool { public: void runTool(const QString &toolName, const QStringList &arguments); bool failedToStart() const { return m_failedToStart; } int exitCode() const { return m_exitCode; } QString stdOut() const { return m_stdout; } QString stdErr() const { return m_stderr; } static QStringList allToolNames(); static bool tryToRunTool(const QString &toolName, const QStringList &arguments, int *exitCode = 0); private: bool m_failedToStart = false; int m_exitCode = 0; QString m_stdout; QString m_stderr; }; #endif // QBS_QBSTOOL_H qbs-src-3.2.0/src/app/qbs/stdinreader.h0000644000175100017510000000451115154533055017314 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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_STDINREADER_H #define QBS_STDINREADER_H #include namespace qbs { namespace Internal { class StdinReader : public QObject { Q_OBJECT public: static StdinReader *create(QObject *parent); virtual void start() = 0; signals: void errorOccurred(const QString &error); void dataAvailable(const QByteArray &data); protected: explicit StdinReader(QObject *parent); }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/app/qbs/application.h0000644000175100017510000000450415154533055017315 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 APPLICATION_H #define APPLICATION_H #include namespace qbs { class CommandLineFrontend; class Application : public QCoreApplication { Q_OBJECT public: Application(int &argc, char **argv); static Application *instance(); void setCommandLineFrontend(CommandLineFrontend *clFrontend); void userInterrupt(); private: CommandLineFrontend *m_clFrontend; bool m_canceled; }; } // namespace qbs #endif // APPLICATION_H qbs-src-3.2.0/src/app/qbs/ctrlchandler.h0000644000175100017510000000370615154533055017462 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 CTRLCHANDLER_H #define CTRLCHANDLER_H void installCtrlCHandler(); #endif // CTRLCHANDLER_H qbs-src-3.2.0/src/app/qbs/CMakeLists.txt0000644000175100017510000000241515154533055017400 0ustar runnerrunnerset(SOURCES application.cpp application.h commandlinefrontend.cpp commandlinefrontend.h consoleprogressobserver.cpp consoleprogressobserver.h ctrlchandler.cpp ctrlchandler.h lspserver.cpp lspserver.h main.cpp qbstool.cpp qbstool.h session.cpp session.h sessionpacket.cpp sessionpacket.h sessionpacketreader.cpp sessionpacketreader.h status.cpp status.h stdinreader.cpp stdinreader.h ) set(PARSER_SOURCES commandlineoption.cpp commandlineoption.h commandlineoptionpool.cpp commandlineoptionpool.h commandlineparser.cpp commandlineparser.h commandpool.cpp commandpool.h commandtype.h parsercommand.cpp parsercommand.h ) list_transform_prepend(PARSER_SOURCES parser/) add_qbs_app(qbs DEFINES "QBS_VERSION=\"${QBS_VERSION}\"" "QBS_RELATIVE_LIBEXEC_PATH=\"${QBS_RELATIVE_LIBEXEC_PATH}\"" "QBS_RELATIVE_SEARCH_PATH=\"${QBS_RELATIVE_SEARCH_PATH}\"" "QBS_RELATIVE_PLUGINS_PATH=\"${QBS_RELATIVE_PLUGINS_PATH}\"" DEPENDS qbscore qbsconsolelogger qtclsp Qt${QT_VERSION_MAJOR}::Network SOURCES ${SOURCES} ${PARSER_SOURCES} ) add_dependencies(qbs qbs_cpp_scanner qbs_qt_scanner) qbs-src-3.2.0/src/app/qbs/qbs.qbs0000644000175100017510000000370215154533055016134 0ustar runnerrunnerimport qbs.Utilities QbsApp { name: "qbs_app" targetName: "qbs" Depends { name: "qbs resources" } Depends { name: "qtclsp" } Depends { name: "Qt.network" } Depends { condition: Qt.core.staticBuild || qbsbuildconfig.staticBuild productTypes: ["qbsplugin"] } cpp.defines: base.concat([ "QBS_VERSION=" + Utilities.cStringQuote(qbsversion.version), "QBS_RELATIVE_LIBEXEC_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativeLibexecPath), "QBS_RELATIVE_SEARCH_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativeSearchPath), "QBS_RELATIVE_PLUGINS_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativePluginsPath), ]) files: [ "application.cpp", "application.h", "commandlinefrontend.cpp", "commandlinefrontend.h", "consoleprogressobserver.cpp", "consoleprogressobserver.h", "ctrlchandler.cpp", "ctrlchandler.h", "main.cpp", "qbstool.cpp", "qbstool.h", "session.cpp", "session.h", "sessionpacket.cpp", "sessionpacket.h", "sessionpacketreader.cpp", "sessionpacketreader.h", "status.cpp", "status.h", "stdinreader.cpp", "stdinreader.h", ] Group { name: "parser" prefix: name + '/' files: [ "commandlineoption.cpp", "commandlineoption.h", "commandlineoptionpool.cpp", "commandlineoptionpool.h", "commandlineparser.cpp", "commandlineparser.h", "commandpool.cpp", "commandpool.h", "commandtype.h", "parsercommand.cpp", "parsercommand.h", ] } Group { name: "lsp" cpp.defines: outer.filter(function(d) { return d !== "QT_NO_CAST_FROM_ASCII"; }) files: [ "lspserver.cpp", "lspserver.h", ] } } qbs-src-3.2.0/src/app/qbs/status.cpp0000644000175100017510000001552115154533055016671 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "status.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include namespace qbs { static QList createIgnoreList(const QString &projectRootPath) { QList ignoreRegularExpressionList { QRegularExpression(QRegularExpression::anchoredPattern(projectRootPath + QLatin1String("/build.*"))), QRegularExpression(QRegularExpression::wildcardToRegularExpression(QStringLiteral("*.qbs"))), QRegularExpression(QRegularExpression::wildcardToRegularExpression(QStringLiteral("*.pro"))), QRegularExpression(QRegularExpression::wildcardToRegularExpression(QStringLiteral("*Makefile"))), QRegularExpression(QRegularExpression::wildcardToRegularExpression(QStringLiteral("*.so*"))), QRegularExpression(QRegularExpression::wildcardToRegularExpression(QStringLiteral("*.o"))) }; QString ignoreFilePath = projectRootPath + QLatin1String("/.qbsignore"); QFile ignoreFile(ignoreFilePath); if (ignoreFile.open(QFile::ReadOnly)) { const QList ignoreTokenList = ignoreFile.readAll().split('\n'); for (const QByteArray &btoken : ignoreTokenList) { const QString token = QString::fromLatin1(btoken); if (token.startsWith(QLatin1String("/"))) ignoreRegularExpressionList.push_back( QRegularExpression(QRegularExpression::anchoredPattern( projectRootPath + token + QLatin1String(".*")))); else if (!token.isEmpty()) ignoreRegularExpressionList.push_back( QRegularExpression(QRegularExpression::anchoredPattern(token))); } } return ignoreRegularExpressionList; } static QStringList allFilesInDirectoryRecursive( const QDir &rootDirecory, const QList &ignoreRegularExpressionList) { QStringList fileList; const auto fileInfos = rootDirecory.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot, QDir::Name); for (const QFileInfo &fileInfo : fileInfos) { QString absoluteFilePath = fileInfo.absoluteFilePath(); bool inIgnoreList = false; for (const QRegularExpression &ignoreRegularExpression : ignoreRegularExpressionList) { if (ignoreRegularExpression.match(absoluteFilePath).hasMatch()) { inIgnoreList = true; break; } } if (!inIgnoreList) { if (fileInfo.isFile()) fileList.push_back(absoluteFilePath); else if (fileInfo.isDir()) fileList << allFilesInDirectoryRecursive(QDir(absoluteFilePath), ignoreRegularExpressionList); } } return fileList; } static QStringList allFilesInProject(const QString &projectRootPath) { QList ignoreRegularExpressionList = createIgnoreList(projectRootPath); return allFilesInDirectoryRecursive(QDir(projectRootPath), ignoreRegularExpressionList); } QStringList allFiles(const ProductData &product) { QStringList files; for (const GroupData &group : product.groups()) files += group.allFilePaths(); return files; } int printStatus(const ProjectData &project) { const QString projectFilePath = project.location().filePath(); QString projectDirectory = QFileInfo(projectFilePath).dir().path(); int projectDirectoryPathLength = projectDirectory.length(); QStringList untrackedFilesInProject = allFilesInProject(projectDirectory); QStringList missingFiles; for (const ProductData &product : project.allProducts()) { qbsInfo() << "\nProduct: " << product.name() << " (" << product.location().filePath() << ":" << product.location().line() << ")"; for (const GroupData &group : product.groups()) { qbsInfo() << " Group: " << group.name() << " (" << group.location().filePath() << ":" << group.location().line() << ")"; const QStringList sourceFiles = Internal::sorted(group.allFilePaths()); for (const QString &sourceFile : sourceFiles) { if (!QFileInfo::exists(sourceFile)) missingFiles.push_back(sourceFile); qbsInfo() << " " << sourceFile.mid(projectDirectoryPathLength + 1); untrackedFilesInProject.removeOne(sourceFile); } } } qbsInfo() << "\nMissing files:"; for (const QString &untrackedFile : std::as_const(missingFiles)) qbsInfo() << " " << untrackedFile.mid(projectDirectoryPathLength + 1); qbsInfo() << "\nUntracked files:"; for (const QString &missingFile : std::as_const(untrackedFilesInProject)) qbsInfo() << " " << missingFile.mid(projectDirectoryPathLength + 1); return 0; } } // namespace qbs qbs-src-3.2.0/src/app/qbs/stdinreader.cpp0000644000175100017510000002475115154533055017657 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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$ ** ****************************************************************************/ #include "stdinreader.h" #include #include #include #include #include #include #include #ifdef Q_OS_WIN32 #include #else #include #endif namespace qbs { namespace Internal { class UnixStdinReader : public StdinReader { public: UnixStdinReader(QObject *parent) : StdinReader(parent), m_notifier(0, QSocketNotifier::Read) {} private: void start() override { if (!m_stdIn.open(stdin, QIODevice::ReadOnly)) { emit errorOccurred(tr("Cannot read from standard input.")); return; } #ifdef Q_OS_UNIX const auto emitError = [this] { emit errorOccurred(tr("Failed to make standard input non-blocking: %1") .arg(QLatin1String(std::strerror(errno)))); }; const int flags = fcntl(0, F_GETFL, 0); if (flags == -1) { emitError(); return; } if (fcntl(0, F_SETFL, flags | O_NONBLOCK)) { emitError(); return; } #endif connect(&m_notifier, &QSocketNotifier::activated, this, [this] { emit dataAvailable(m_stdIn.readAll()); }); // Neither the aboutToClose() nor the readChannelFinished() signals // are triggering, so we need a timer to check whether the controlling // process disappeared. const auto stdinClosedChecker = new QTimer(this); connect(stdinClosedChecker, &QTimer::timeout, this, [this, stdinClosedChecker] { if (m_stdIn.atEnd()) { stdinClosedChecker->stop(); emit errorOccurred(tr("Input channel closed unexpectedly.")); } }); stdinClosedChecker->start(1000); } QFile m_stdIn; QSocketNotifier m_notifier; }; class WindowsStdinReader : public StdinReader { public: WindowsStdinReader(QObject *parent) : StdinReader(parent) {} private: #ifdef Q_OS_WIN32 class FileReaderThread : public QThread { public: FileReaderThread(WindowsStdinReader &parent, HANDLE stdInHandle, HANDLE exitEventHandle) : QThread(&parent), m_stdIn{stdInHandle}, m_exitEvent{exitEventHandle} { } ~FileReaderThread() { wait(); CloseHandle(m_exitEvent); } void run() override { WindowsStdinReader *r = static_cast(parent()); char buf[1024]; while (true) { DWORD bytesRead = 0; if (!ReadFile(m_stdIn, buf, sizeof buf, &bytesRead, nullptr)) { emit r->errorOccurred(tr("Failed to read from input channel.")); break; } if (!bytesRead) break; emit r->dataAvailable(QByteArray(buf, bytesRead)); } } private: HANDLE m_stdIn; HANDLE m_exitEvent; }; class ConsoleReaderThread : public QThread { public: ConsoleReaderThread(WindowsStdinReader &parent, HANDLE stdInHandle, HANDLE exitEventHandle) : QThread(&parent), m_stdIn{stdInHandle}, m_exitEvent{exitEventHandle} { } virtual ~ConsoleReaderThread() override { SetEvent(m_exitEvent); wait(); CloseHandle(m_exitEvent); } void run() override { WindowsStdinReader *r = static_cast(parent()); DWORD origConsoleMode; GetConsoleMode(m_stdIn, &origConsoleMode); DWORD consoleMode = ENABLE_PROCESSED_INPUT; SetConsoleMode(m_stdIn, consoleMode); HANDLE handles[2] = {m_exitEvent, m_stdIn}; char buf[1024]; while (true) { auto result = WaitForMultipleObjects(2, handles, FALSE, INFINITE); if (result == WAIT_OBJECT_0) break; INPUT_RECORD consoleInput; DWORD inputsRead = 0; if (!PeekConsoleInputA(m_stdIn, &consoleInput, 1, &inputsRead)) { emit r->errorOccurred(tr("Failed to read from input channel.")); break; } if (inputsRead) { if (consoleInput.EventType != KEY_EVENT || !consoleInput.Event.KeyEvent.bKeyDown || !consoleInput.Event.KeyEvent.uChar.AsciiChar) { if (!ReadConsoleInputA(m_stdIn, &consoleInput, 1, &inputsRead)) { emit r->errorOccurred(tr("Failed to read console input.")); break; } } else { DWORD bytesRead = 0; if (!ReadConsoleA(m_stdIn, buf, sizeof buf, &bytesRead, nullptr)) { emit r->errorOccurred(tr("Failed to read console.")); break; } emit r->dataAvailable(QByteArray(buf, bytesRead)); } } } SetConsoleMode(m_stdIn, origConsoleMode); } private: HANDLE m_stdIn; HANDLE m_exitEvent; }; class PipeReaderThread : public QThread { public: PipeReaderThread(WindowsStdinReader &parent, HANDLE stdInHandle, HANDLE exitEventHandle) : QThread(&parent), m_stdIn{stdInHandle}, m_exitEvent{exitEventHandle} { } virtual ~PipeReaderThread() override { SetEvent(m_exitEvent); wait(); CloseHandle(m_exitEvent); } void run() override { WindowsStdinReader *r = static_cast(parent()); OVERLAPPED overlapped = {}; overlapped.hEvent = CreateEventA(NULL, TRUE, TRUE, NULL); if (!overlapped.hEvent) { emit r->errorOccurred(StdinReader::tr("Failed to create handle for overlapped event.")); return; } char buf[1024]; DWORD bytesRead; HANDLE handles[2] = {m_exitEvent, overlapped.hEvent}; while (true) { bytesRead = 0; auto readResult = ReadFile(m_stdIn, buf, sizeof buf, NULL, &overlapped); if (!readResult) { if (GetLastError() != ERROR_IO_PENDING) { emit r->errorOccurred(StdinReader::tr("ReadFile Failed.")); break; } auto result = WaitForMultipleObjects(2, handles, FALSE, INFINITE); if (result == WAIT_OBJECT_0) break; } if (!GetOverlappedResult(m_stdIn, &overlapped, &bytesRead, FALSE)) { if (GetLastError() != ERROR_HANDLE_EOF) emit r->errorOccurred(StdinReader::tr("Error GetOverlappedResult.")); break; } emit r->dataAvailable(QByteArray(buf, bytesRead)); } CancelIo(m_stdIn); CloseHandle(overlapped.hEvent); } private: HANDLE m_stdIn; HANDLE m_exitEvent; }; #endif void start() override { #ifdef Q_OS_WIN32 HANDLE stdInHandle = GetStdHandle(STD_INPUT_HANDLE); if (!stdInHandle) { emit errorOccurred(StdinReader::tr("Failed to create handle for standard input.")); return; } HANDLE exitEventHandle = CreateEventA(NULL, TRUE, FALSE, NULL); if (!exitEventHandle) { emit errorOccurred(StdinReader::tr("Failed to create handle for exit event.")); return; } auto result = GetFileType(stdInHandle); switch (result) { case FILE_TYPE_CHAR: (new ConsoleReaderThread(*this, stdInHandle, exitEventHandle))->start(); return; case FILE_TYPE_PIPE: (new PipeReaderThread(*this, stdInHandle, exitEventHandle))->start(); return; case FILE_TYPE_DISK: (new FileReaderThread(*this, stdInHandle, exitEventHandle))->start(); return; default: emit errorOccurred(StdinReader::tr("Unable to handle unknown input type")); return; } #endif } }; StdinReader *StdinReader::create(QObject *parent) { if (HostOsInfo::isWindowsHost()) return new WindowsStdinReader(parent); return new UnixStdinReader(parent); } StdinReader::StdinReader(QObject *parent) : QObject(parent) { } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/app/qbs/lspserver.cpp0000644000175100017510000010233215154533055017370 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #include "lspserver.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef Q_OS_WINDOWS #include #else #include #endif #include namespace qbs::Internal { static int getPid() { #ifdef Q_OS_WINDOWS return _getpid(); #else return getpid(); #endif } using LspErrorResponse = lsp::ResponseError; using LspErrorCode = LspErrorResponse::ErrorCodes; class Document { public: bool isPositionUpToDate(const CodePosition &pos) const; bool isPositionUpToDate(const lsp::Position &pos) const; QString savedContent; QString currentContent; }; static CodePosition posFromLspPos(const lsp::Position &pos) { return {pos.line() + 1, pos.character() + 1}; } static lsp::Position lspPosFromCodeLocation(const CodeLocation &loc) { return {loc.line() - 1, loc.column() - 1}; } static QString uriToString(const lsp::DocumentUri &uri) { return uri.toFilePath([](const lsp::Utils::FilePath &fp) { return fp; }); } static int posToOffset(const CodePosition &pos, const QString &doc); static int posToOffset(const lsp::Position &pos, const QString &doc) { return posToOffset(posFromLspPos(pos), doc); } class AstNodeLocator : public QbsQmlJS::AST::Visitor { public: AstNodeLocator(int position, QbsQmlJS::AST::UiProgram &ast) : m_position(position) { ast.accept(this); } QList path() const { return m_path; } private: bool preVisit(QbsQmlJS::AST::Node *node) override { if (int(node->firstSourceLocation().offset) > m_position) return false; if (int(node->lastSourceLocation().offset) < m_position) return false; m_path << node; return true; } const int m_position; QList m_path; }; static QJsonArray toLspLocations(const QList &locations) { struct JsonArray : public QJsonArray { void reserve(std::size_t) {} }; return transformed(locations, [](const CodeLocation &loc) { const lsp::Position startPos = lspPosFromCodeLocation(loc); const lsp::Position endPos(startPos.line(), startPos.character() + 1); lsp::Location targetLocation; targetLocation.setUri( lsp::DocumentUri::fromProtocol(QUrl::fromLocalFile(loc.filePath()).toString())); targetLocation.setRange({startPos, endPos}); return QJsonObject(targetLocation); }); } class LspServer::Private { public: void setupConnection(); void handleIncomingData(); void discardSocket(); template void sendResponse(const T &msg); void sendErrorResponse(LspErrorCode code, const QString &message); void sendErrorNotification(const QString &message); void sendNoSuchDocumentError(const QString &filePath); void sendMessage(const lsp::JsonObject &msg); void sendMessage(const lsp::JsonRpcMessage &msg); void handleCurrentMessage(); void handleInitializeRequest(); void handleInitializedNotification(); void handleGotoDefinitionRequest(); void handleCompletionRequest(); void handleShutdownRequest(); void handleDidOpenNotification(); void handleDidChangeNotification(); void handleDidSaveNotification(); void handleDidCloseNotification(); bool handleGotoDefViaCodeLinks( const QString &sourceFile, const Document *sourceDoc, const CodePosition &sourcePos); void handleGotoDefForModuleProperties( const QString &sourceFile, const QbsQmlJS::AST::UiQualifiedId *node, int offset); QList getRelevantProducts(const QString &sourceFile); QLocalServer server; QBuffer incomingData; lsp::BaseMessage currentMessage; QJsonObject messageObject; QLocalSocket *socket = nullptr; ProjectData projectData; CodeLinks codeLinks; std::unordered_map documents; enum class State { None, InitRequest, InitNotification, Shutdown }; State state = State::None; }; LspServer::LspServer() : d(new Private) { if (!d->server.listen(QString::fromLatin1("qbs-lsp-%1").arg(getPid()))) { // This is not fatal, qbs main operation can continue. qWarning() << "failed to open lsp socket:" << d->server.errorString(); return; } QObject::connect(&d->server, &QLocalServer::newConnection, [this] { d->socket = d->server.nextPendingConnection(); d->setupConnection(); d->server.close(); }); } LspServer::~LspServer() { delete d; } void LspServer::updateProjectData(const ProjectData &projectData, const CodeLinks &codeLinks) { d->projectData = projectData; d->codeLinks = codeLinks; } QString LspServer::socketPath() const { return d->server.fullServerName(); } void LspServer::Private::setupConnection() { QBS_ASSERT(socket, return); QObject::connect(socket, &QLocalSocket::errorOccurred, [this] { discardSocket(); }); QObject::connect(socket, &QLocalSocket::disconnected, [this] { discardSocket(); }); QObject::connect(socket, &QLocalSocket::readyRead, [this] { handleIncomingData(); }); incomingData.open(QIODevice::ReadWrite | QIODevice::Append); handleIncomingData(); } void LspServer::Private::handleIncomingData() { const int pos = incomingData.pos(); incomingData.write(socket->readAll()); incomingData.seek(pos); QString parseError; lsp::BaseMessage::parse(&incomingData, parseError, currentMessage); if (!parseError.isEmpty()) return sendErrorResponse(LspErrorResponse::ParseError, parseError); if (currentMessage.isComplete()) { incomingData.buffer().remove(0, incomingData.pos()); incomingData.seek(0); handleCurrentMessage(); currentMessage = {}; messageObject = {}; if (socket) handleIncomingData(); } } void LspServer::Private::discardSocket() { socket->disconnect(); socket->deleteLater(); socket = nullptr; } template void LspServer::Private::sendResponse(const T &msg) { lsp::Response response(lsp::MessageId(messageObject.value(lsp::idKey))); response.setResult(msg); sendMessage(response); } void LspServer::Private::sendErrorResponse(LspErrorCode code, const QString &message) { lsp::Response response(lsp::MessageId( messageObject.value(lsp::idKey))); lsp::ResponseError error; error.setCode(code); error.setMessage(message); response.setError(error); sendMessage(response); } void LspServer::Private::sendErrorNotification(const QString &message) { lsp::ShowMessageParams params; params.setType(lsp::Error); params.setMessage(message); sendMessage(lsp::ShowMessageNotification(params)); } void LspServer::Private::sendNoSuchDocumentError(const QString &filePath) { sendErrorNotification(Tr::tr("No such document: '%1'").arg(filePath)); } void LspServer::Private::sendMessage(const lsp::JsonObject &msg) { sendMessage(lsp::JsonRpcMessage(msg)); } void LspServer::Private::sendMessage(const lsp::JsonRpcMessage &msg) { lsp::BaseMessage baseMsg = msg.toBaseMessage(); socket->write(baseMsg.header()); socket->write(baseMsg.content); } void LspServer::Private::handleCurrentMessage() { messageObject = lsp::JsonRpcMessage(currentMessage).toJsonObject(); const QString method = messageObject.value(lsp::methodKey).toString(); if (method == QLatin1String("exit")) return discardSocket(); if (state == State::Shutdown) { return sendErrorResponse(LspErrorResponse::InvalidRequest, Tr::tr("Method '%1' not allowed after shutdown.")); } if (method == "shutdown") return handleShutdownRequest(); if (method == QLatin1String("initialize")) return handleInitializeRequest(); if (state == State::None) { return sendErrorResponse(LspErrorResponse::ServerNotInitialized, Tr::tr("First message must be initialize request.")); } if (method == "initialized") return handleInitializedNotification(); if (method == "textDocument/didOpen") return handleDidOpenNotification(); if (method == "textDocument/didChange") return handleDidChangeNotification(); if (method == "textDocument/didSave") return handleDidSaveNotification(); if (method == "textDocument/didClose") return handleDidCloseNotification(); if (method == "textDocument/definition") return handleGotoDefinitionRequest(); if (method == "textDocument/completion") return handleCompletionRequest(); sendErrorResponse(LspErrorResponse::MethodNotFound, Tr::tr("This server can do very little.")); } void LspServer::Private::handleInitializeRequest() { if (state != State::None) { return sendErrorResponse(LspErrorResponse::InvalidRequest, Tr::tr("Received initialize request in initialized state.")); } state = State::InitRequest; lsp::ServerInfo serverInfo; serverInfo.insert(lsp::nameKey, "qbs"); serverInfo.insert(lsp::versionKey, QBS_VERSION); lsp::InitializeResult result; result.insert(lsp::serverInfoKey, serverInfo); lsp::ServerCapabilities capabilities; // TODO: hover capabilities.setDefinitionProvider(true); capabilities.setTextDocumentSync({int(lsp::TextDocumentSyncKind::Incremental)}); lsp::ServerCapabilities::CompletionOptions completionOptions; completionOptions.setTriggerCharacters({"."}); capabilities.setCompletionProvider(completionOptions); result.setCapabilities(capabilities); sendResponse(result); } void LspServer::Private::handleInitializedNotification() { if (state != State::InitRequest) { return sendErrorResponse(LspErrorResponse::InvalidRequest, Tr::tr("Unexpected initialized notification.")); } state = State::InitNotification; } void LspServer::Private::handleGotoDefinitionRequest() { const lsp::TextDocumentPositionParams params(messageObject.value(lsp::paramsKey)); const QString sourceFile = params.textDocument().uri().toLocalFile(); const CodePosition sourcePos = posFromLspPos(params.position()); const Document *sourceDoc = nullptr; if (const auto it = documents.find(sourceFile); it != documents.end()) sourceDoc = &it->second; // First check the codeLinks, where we map locations of Depends items // to the location of the corresponding product or module. // For a cursor such as this: // Depends { name: "cpp" } // ^ // We return the location of the module file that implements the cpp // backend for that particular product, e.g. GenericGCC.qbs. // In addition, items provided via import paths are looked up here. if (handleGotoDefViaCodeLinks(sourceFile, sourceDoc, sourcePos)) return; if (!sourceDoc) return sendResponse(nullptr); // Now check for // a) elements of the "files" and "references" properties. // b) usages of module properties, e.g. "qbs.toolchain" // For a cursor such as this: // Group { prefix: "sources/"; files: "main.cpp" } // ^ // We return the absolute path of the file, including the // group prefix. // Note that if we recorded the location of all source artifacts, // we would not need to do any parsing here and also we wouldn't // be limited to string literals. But that's probably not worth // the additional overhead. // For case a), the AST path looks as follows: // ... -> UiObjectDefinition -> UiObjectInitializer -> ObjectMemberList // -> UiScriptBinding -> ExpressionStatement [-> ArrayLiteral] // If the project file employs the syntactical sugar of using a single // string for one-element arrays, then there is no ArrayLiteral; instead, // the ExpressionStatement's expression is a StringLiteral that contains // the file path. // Sometimes, the AST path also ends in an ElementList instead of an ArrayLiteral. // This discrepancy is probably a bug in the path() function. // Case b) is simpler: We just check whether the last element of the AST path is a // qualified id or a script binding. Apparently, we get the former if there are three // or more components, and the latter otherwise. Again, this looks like a bug // in the locator. const int offset = posToOffset(params.position(), sourceDoc->currentContent) - 1; if (offset < 0 || offset >= sourceDoc->currentContent.length()) return sendResponse(nullptr); using namespace QbsQmlJS; using namespace QbsQmlJS::AST; Engine engine; Lexer lexer(&engine); lexer.setCode(sourceDoc->currentContent, 1); Parser parser(&engine); parser.parse(); if (!parser.ast()) return sendResponse(nullptr); AstNodeLocator locator(offset, *parser.ast()); const QList &astPath = locator.path(); if (astPath.isEmpty()) return sendResponse(nullptr); const StringLiteral *filePathLiteral = nullptr; const ElementList *elementList = nullptr; int bindingNodeIndex = 0; int objectNodeIndex = 0; const Node * const lastNode = astPath.last(); if (lastNode->kind == Node::Kind_UiQualifiedId) { return handleGotoDefForModuleProperties( sourceFile, static_cast(lastNode), offset); } if (lastNode->kind == Node::Kind_UiScriptBinding) { return handleGotoDefForModuleProperties( sourceFile, static_cast(lastNode)->qualifiedId, offset); } if (lastNode->kind == Node::Kind_ArrayLiteral) { bindingNodeIndex = astPath.size() - 3; objectNodeIndex = astPath.size() - 6; elementList = static_cast(lastNode)->elements; } else if (lastNode->kind == Node::Kind_ElementList) { bindingNodeIndex = astPath.size() - 4; objectNodeIndex = astPath.size() - 7; elementList = static_cast(lastNode); } else if (lastNode->kind == Node::Kind_ExpressionStatement) { bindingNodeIndex = astPath.size() - 2; objectNodeIndex = astPath.size() - 5; const auto filePathExpr = static_cast(lastNode)->expression; if (filePathExpr && filePathExpr->kind == Node::Kind_StringLiteral) filePathLiteral = static_cast(filePathExpr); } if (elementList) { for (const ElementList *l = elementList; l; l = l->next) { if (l->expression->kind != Node::Kind_StringLiteral) continue; const auto s = static_cast(l->expression); if (int(s->firstSourceLocation().offset) > offset) break; if (int(s->lastSourceLocation().offset + s->lastSourceLocation().length) > offset) { filePathLiteral = s; break; } } } if (!filePathLiteral) return sendResponse(nullptr); if (objectNodeIndex < 0) return sendResponse(nullptr); const auto filesNode = astPath.at(bindingNodeIndex); if (filesNode->kind != Node::Kind_UiScriptBinding) return sendResponse(nullptr); const QStringRef bindingName = static_cast(filesNode)->qualifiedId->name; const bool isFilesProperty = bindingName == "files"; const bool isReferencesProperty = bindingName == "references"; if (!isFilesProperty && !isReferencesProperty) return sendResponse(nullptr); const Node * const objectNode = astPath.at(objectNodeIndex); if (objectNode->kind != Node::Kind_UiObjectDefinition) return sendResponse(nullptr); const SourceLocation loc = objectNode->firstSourceLocation(); QString absoluteFilePath = filePathLiteral->value.toString(); const auto sendFilePath = [&] { const lsp::Position startPos(0, 0); const lsp::Position endPos(0, 1); lsp::Location targetLocation; targetLocation.setUri( lsp::DocumentUri::fromProtocol(QUrl::fromLocalFile(absoluteFilePath).toString())); targetLocation.setRange({lsp::Position(0, 0), lsp::Position(0, 1)}); sendResponse(QJsonObject(targetLocation)); }; if (QFileInfo(absoluteFilePath).isAbsolute()) return sendFilePath(); if (isFilesProperty) { using GroupAndProduct = std::optional>; const std::function findGroup = [&](const ProjectData &project) -> GroupAndProduct { for (const ProductData &product : project.products()) { for (const GroupData &group : product.groups()) { if (group.location().filePath() == sourceFile && group.location().line() == int(loc.startLine) && group.location().column() == int(loc.startColumn)) return std::make_pair(group, product); } } for (const ProjectData &subProject : project.subProjects()) { if (const auto &g = findGroup(subProject)) return g; } return {}; }; const auto groupAndProduct = findGroup(projectData); if (!groupAndProduct) return sendResponse(nullptr); absoluteFilePath.prepend(groupAndProduct->first.prefix()); if (QFileInfo(absoluteFilePath).isAbsolute()) return sendFilePath(); } else { const std::function(const ProjectData &)> findProject = [&](const ProjectData &project) -> std::optional { if (project.location().filePath() == sourceFile && project.location().line() == int(loc.startLine) && project.location().column() == int(loc.startColumn)) { return project; } for (const ProjectData &subProject : project.subProjects()) { if (const auto &p = findProject(subProject)) return p; } return {}; }; const auto project = findProject(projectData); if (!project) return sendResponse(nullptr); } absoluteFilePath = QFileInfo(sourceFile).absoluteDir().filePath(absoluteFilePath); sendFilePath(); } // We operate under the assumption that the client has basic QML support. // Therefore, we only provide completion for qbs modules and their properties. // Only a simple prefix match is implemented, with no regard to the contents after the cursor. void LspServer::Private::handleCompletionRequest() { if (!projectData.isValid()) return sendResponse(nullptr); const lsp::CompletionParams params(messageObject.value(lsp::paramsKey)); const QString sourceFile = params.textDocument().uri().toLocalFile(); const Document *sourceDoc = nullptr; if (const auto it = documents.find(sourceFile); it != documents.end()) sourceDoc = &it->second; if (!sourceDoc) return sendResponse(nullptr); const QList relevantProducts = getRelevantProducts(sourceFile); if (relevantProducts.isEmpty()) return sendResponse(nullptr); QString identifierPrefix; QStringList modulePrefixes; const int offset = posToOffset(params.position(), sourceDoc->currentContent) - 1; if (offset < 0 || offset >= sourceDoc->currentContent.length()) return sendResponse(nullptr); const auto collectFromRawString = [&] { int currentPos = offset; const auto constructIdentifier = [&] { QString id; while (currentPos >= 0) { const QChar c = sourceDoc->currentContent.at(currentPos); if (!c.isLetterOrNumber() && c != '_') break; id.prepend(c); --currentPos; } return id; }; identifierPrefix = constructIdentifier(); while (true) { if (currentPos <= 0 || sourceDoc->currentContent.at(currentPos) != '.') return; --currentPos; const QString modulePrefix = constructIdentifier(); if (modulePrefix.isEmpty()) return; modulePrefixes.prepend(modulePrefix); } }; // Parse the current file. Note that completion usually happens on invalid code, which // often confuses the parser so much that it yields unusable results. Therefore, we always // gather our input parameters from the raw string. We only use the parse result to skip // completion in contexts where it is undesirable. QbsQmlJS::Engine engine; QbsQmlJS::Lexer lexer(&engine); lexer.setCode(sourceDoc->currentContent, 1); QbsQmlJS::Parser parser(&engine); parser.parse(); if (parser.ast()) { AstNodeLocator locator(offset, *parser.ast()); const QList &astPath = locator.path(); if (!astPath.isEmpty()) { switch (astPath.last()->kind) { case QbsQmlJS::AST::Node::Kind_FieldMemberExpression: case QbsQmlJS::AST::Node::Kind_UiObjectDefinition: case QbsQmlJS::AST::Node::Kind_UiQualifiedId: case QbsQmlJS::AST::Node::Kind_UiScriptBinding: break; default: return sendResponse(nullptr); } } } collectFromRawString(); if (modulePrefixes.isEmpty() && identifierPrefix.isEmpty()) return sendResponse(nullptr); // We do not want to start completion from nothing. QJsonArray results; QMap namesAndTypes; for (const ProductData &product : relevantProducts) { const PropertyMap &moduleProps = product.moduleProperties(); const QStringList allModules = moduleProps.allModules(); const QString moduleNameOrPrefix = modulePrefixes.join('.'); // Case 1: Prefixes match a module name. Identifier can only expand to the name // of a module property. // Example: "Qt.core.a^" -> "Qt.core.availableBuildVariants" if (!modulePrefixes.isEmpty() && allModules.contains(moduleNameOrPrefix)) { for (const PropertyMap::PropertyInfo &info : moduleProps.allPropertiesForModule(moduleNameOrPrefix)) { if (info.isBuiltin) continue; if (!identifierPrefix.isEmpty() && !info.name.startsWith(identifierPrefix)) continue; namesAndTypes.insert(info.name, info.type); } continue; } // Case 2: Isolated identifier. Can only expand to a module name. // Example: "Q^" -> "Qt.core", "Qt.widgets", ... // Case 3: Prefixes match a module prefix. Identifier can only expand to a module name. // Example: "Qt.c^" -> "Qt.core", "Qt.concurrent", ... QString fullPrefix = identifierPrefix; int nameOffset = 0; if (!modulePrefixes.isEmpty()) { fullPrefix.prepend(moduleNameOrPrefix + '.'); nameOffset = moduleNameOrPrefix.length() + 1; } for (const QString &module : allModules) { if (module.startsWith(fullPrefix)) namesAndTypes.insert(module.mid(nameOffset), {}); } } for (auto it = namesAndTypes.cbegin(); it != namesAndTypes.cend(); ++it) { lsp::CompletionItem item; item.setLabel(it.key()); if (!it.value().isEmpty()) item.setDetail(it.value()); results.append(QJsonObject(item)); }; sendResponse(results); } void LspServer::Private::handleShutdownRequest() { state = State::Shutdown; sendResponse(nullptr); } void LspServer::Private::handleDidOpenNotification() { const lsp::TextDocumentItem docItem = lsp::DidOpenTextDocumentNotification(messageObject) .params().value_or(lsp::DidOpenTextDocumentParams()) .textDocument(); if (!docItem.isValid()) return sendErrorNotification(Tr::tr("Invalid didOpen parameters.")); const QString filePath = uriToString(docItem.uri()); Document &doc = documents[filePath]; doc.savedContent = doc.currentContent = docItem.text(); } void LspServer::Private::handleDidChangeNotification() { const auto params = lsp::DidChangeTextDocumentNotification(messageObject) .params().value_or(lsp::DidChangeTextDocumentParams()); if (!params.isValid()) return sendErrorNotification(Tr::tr("Invalid didChange parameters.")); const QString filePath = uriToString(params.textDocument().uri()); const auto docIt = documents.find(filePath); if (docIt == documents.end()) return sendNoSuchDocumentError(filePath); Document &doc = docIt->second; const auto changes = params.contentChanges(); for (const auto &change : changes) { const auto range = change.range(); if (!range) { doc.currentContent = change.text(); continue; } const int startPos = posToOffset(range->start(), doc.currentContent); const int endPos = posToOffset(range->end(), doc.currentContent); if (startPos == -1 || endPos == -1 || startPos > endPos) return sendErrorResponse(LspErrorResponse::InvalidParams, Tr::tr("Invalid range.")); doc.currentContent.replace(startPos, endPos - startPos, change.text()); } } void LspServer::Private::handleDidSaveNotification() { const QString filePath = uriToString(lsp::DidSaveTextDocumentNotification(messageObject) .params().value_or(lsp::DidSaveTextDocumentParams()) .textDocument().uri()); const auto docIt = documents.find(filePath); if (docIt == documents.end()) return sendNoSuchDocumentError(filePath); docIt->second.savedContent = docIt->second.currentContent; // TODO: Mark the project data as out of date until the next update(),if the document // is in buildSystemFiles(). } void LspServer::Private::handleDidCloseNotification() { const QString filePath = uriToString(lsp::DidCloseTextDocumentNotification(messageObject) .params().value_or(lsp::DidCloseTextDocumentParams()) .textDocument().uri()); const auto docIt = documents.find(filePath); if (docIt == documents.end()) return sendNoSuchDocumentError(filePath); documents.erase(docIt); } bool LspServer::Private::handleGotoDefViaCodeLinks( const QString &sourceFile, const Document *sourceDoc, const CodePosition &sourcePos) { if (sourceDoc && !sourceDoc->isPositionUpToDate(sourcePos)) return false; const auto fileEntry = codeLinks.constFind(sourceFile); if (fileEntry == codeLinks.constEnd()) return false; for (auto it = fileEntry->begin(); it != fileEntry->cend(); ++it) { if (!it.key().contains(sourcePos)) continue; if (sourceDoc && !sourceDoc->isPositionUpToDate(it.key().end())) return false; QList targets = it.value(); QBS_ASSERT(!targets.isEmpty(), return false); for (auto it = targets.begin(); it != targets.end();) { const Document *targetDoc = nullptr; if (it->filePath() == sourceFile) targetDoc = sourceDoc; else if (const auto docIt = documents.find(it->filePath()); docIt != documents.end()) targetDoc = &docIt->second; if (targetDoc && !targetDoc->isPositionUpToDate(CodePosition(it->line(), it->column()))) it = targets.erase(it); else ++it; } const QJsonArray locations = toLspLocations(targets); if (locations.size() == 1) sendResponse(locations.first().toObject()); else sendResponse(locations); return true; } return false; } void LspServer::Private::handleGotoDefForModuleProperties( const QString &sourceFile, const QbsQmlJS::AST::UiQualifiedId *node, int offset) { QStringList qualifiedProperty; bool cursorIsOnProperty = false; for (const QbsQmlJS::AST::UiQualifiedId *qid = node; qid; qid = qid->next) { qualifiedProperty << qid->name.toString(); if (!qid->next && int(qid->firstSourceLocation().offset) <= offset) cursorIsOnProperty = true; } if (qualifiedProperty.size() < 2) return sendResponse(nullptr); const QList relevantProducts = getRelevantProducts(sourceFile); if (relevantProducts.isEmpty()) return sendResponse(nullptr); const QString moduleName = qualifiedProperty.mid(0, qualifiedProperty.size() - 1).join('.'); const QString propertyName = qualifiedProperty.last(); QSet locations; for (const ProductData &p : relevantProducts) { for (const ModuleData &m : p.modules()) { if (m.name() != moduleName) continue; if (cursorIsOnProperty) { for (const auto &prop : m.properties()) { if (prop.first == propertyName) { locations << prop.second; break; } } } else { locations << m.location(); } break; } } if (locations.isEmpty()) return sendResponse(nullptr); const QJsonArray lspLocations = toLspLocations(toList(locations)); if (lspLocations.size() == 1) return sendResponse(lspLocations.first().toObject()); sendResponse(lspLocations); } // If there are products corresponding to the given source file, return only these. // Otherwise, return all products. QList LspServer::Private::getRelevantProducts(const QString &sourceFile) { const QList allProducts = projectData.allProducts(); QList relevantProducts; for (const ProductData &p : allProducts) { if (p.location().filePath() == sourceFile) relevantProducts << p; } if (relevantProducts.isEmpty()) return allProducts; return relevantProducts; } static int posToOffset(const CodePosition &pos, const QString &doc) { int offset = 0; for (int newlines = 0, next = 0; newlines < pos.line() - 1; ++newlines) { offset = doc.indexOf('\n', next); if (offset == -1) return -1; next = offset + 1; } return offset + pos.column(); } bool Document::isPositionUpToDate(const CodePosition &pos) const { const int origOffset = posToOffset(pos, savedContent); if (origOffset > int(currentContent.size())) return false; return QStringView(currentContent).left(origOffset) == QStringView(savedContent).left(origOffset); } bool Document::isPositionUpToDate(const lsp::Position &pos) const { return isPositionUpToDate(posFromLspPos(pos)); } } // namespace qbs::Internal qbs-src-3.2.0/src/app/qbs/session.cpp0000644000175100017510000010306715154533055017034 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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$ ** ****************************************************************************/ #include "session.h" #include "lspserver.h" #include "sessionpacket.h" #include "sessionpacketreader.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef Q_OS_WIN32 #include #include #include #include #include #endif namespace qbs { namespace Internal { using FilePair = std::pair; class SessionLogSink : public QObject, public ILogSink { Q_OBJECT signals: void newMessage(const QJsonObject &msg); private: static const QString &warningString() { static const QString warning(QLatin1String("warning")); return warning; } void doPrintMessage(LoggerLevel, const QString &message, const QString &) override { QJsonObject msg; msg.insert(StringConstants::type(), QLatin1String("log-data")); msg.insert(StringConstants::messageKey(), message); emit newMessage(msg); } void doPrintWarning(const ErrorInfo &warning) override { QJsonObject msg; msg.insert(StringConstants::type(), warningString()); msg.insert(warningString(), warning.toJson()); emit newMessage(msg); } void doPrintError(const ErrorInfo &error) override { QJsonObject msg; msg.insert(StringConstants::type(), warningString()); static const QString errorString(QLatin1String("error")); msg.insert(errorString, error.toJson()); msg.insert(warningString(), error.toJson()); // Backward compatibility emit newMessage(msg); } }; class Session : public QObject { Q_OBJECT public: Session(); private: enum class ProjectDataMode { Never, Always, OnlyIfChanged }; ProjectDataMode dataModeFromRequest(const QJsonObject &request); QStringList modulePropertiesFromRequest(const QJsonObject &request); void insertProjectDataIfNecessary( QJsonObject &reply, ProjectDataMode dataMode, const ProjectData &oldProjectData, bool includeTopLevelData ); void setLogLevelFromRequest(const QJsonObject &request); bool checkNormalRequestPrerequisites(const char *replyType); void sendPacket(const QJsonObject &message); void setupProject(const QJsonObject &request); void buildProject(const QJsonObject &request); void cleanProject(const QJsonObject &request); void installProject(const QJsonObject &request); void addFiles(const QJsonObject &request); void removeFiles(const QJsonObject &request); void renameFiles(const QJsonObject &request); void addDependencies(const QJsonObject &request); void getRunEnvironment(const QJsonObject &request); void getGeneratedFilesForSources(const QJsonObject &request); void releaseProject(); void cancelCurrentJob(); void quitSession(); void sendErrorReply(const char *replyType, const QString &message); void sendErrorReply(const char *replyType, const ErrorInfo &error); void insertErrorInfoIfNecessary(QJsonObject &reply, const ErrorInfo &error); void connectProgressSignals(AbstractJob *job); QList getProductsByName(const QStringList &productNames) const; ProductData getProductByName(const QString &productName) const; struct ProductSelection { ProductSelection(Project::ProductSelection s) : selection(s) {} ProductSelection(QList p) : products(std::move(p)) {} Project::ProductSelection selection = Project::ProductSelectionDefaultOnly; QList products; }; ProductSelection getProductSelection(const QJsonObject &request); template struct FileUpdateData { QJsonObject createErrorReply( const char *type, const QString &mainMessage, bool addFailedFiles) const; ProductData product; GroupData group; QList arguments; ErrorInfo error; }; template FileUpdateData prepareFileUpdate(const QJsonObject &request, const QString ¶mKey); SessionPacketReader m_packetReader; LspServer m_lspServer; SessionLogSink m_logSink; Project m_project; ProjectData m_projectData; std::unique_ptr m_settings; QJsonObject m_resolveRequest; QStringList m_moduleProperties; AbstractJob *m_currentJob = nullptr; }; void startSession() { const auto session = new Session; QObject::connect(qApp, &QCoreApplication::aboutToQuit, session, [session] { delete session; }); } Session::Session() { #ifdef Q_OS_WIN32 // Make sure the line feed character appears as itself. if (_setmode(_fileno(stdout), _O_BINARY) == -1) { constexpr size_t errmsglen = FILENAME_MAX; char errmsg[errmsglen]; strerror_s(errmsg, errmsglen, errno); std::cerr << "Failed to set stdout to binary mode: " << errmsg << std::endl; qApp->exit(EXIT_FAILURE); } #endif sendPacket(SessionPacket::helloMessage(m_lspServer.socketPath())); connect(&m_logSink, &SessionLogSink::newMessage, this, &Session::sendPacket); connect(&m_packetReader, &SessionPacketReader::errorOccurred, this, [](const QString &msg) { std::cerr << qPrintable(tr("Error: %1").arg(msg)); qApp->exit(EXIT_FAILURE); }); connect(&m_packetReader, &SessionPacketReader::packetReceived, this, [this](const QJsonObject &packet) { // qDebug() << "got packet:" << packet; // Uncomment for debugging. const QString type = packet.value(StringConstants::type()).toString(); if (type == QLatin1String("resolve-project")) setupProject(packet); else if (type == QLatin1String("build-project")) buildProject(packet); else if (type == QLatin1String("clean-project")) cleanProject(packet); else if (type == QLatin1String("install-project")) installProject(packet); else if (type == QLatin1String("add-files")) addFiles(packet); else if (type == QLatin1String("remove-files")) removeFiles(packet); else if (type == QLatin1String("rename-files")) renameFiles(packet); else if (type == QLatin1String("add-dependencies")) addDependencies(packet); else if (type == QLatin1String("get-run-environment")) getRunEnvironment(packet); else if (type == QLatin1String("get-generated-files-for-sources")) getGeneratedFilesForSources(packet); else if (type == QLatin1String("release-project")) releaseProject(); else if (type == QLatin1String("quit")) quitSession(); else if (type == QLatin1String("cancel-job")) cancelCurrentJob(); else sendErrorReply("protocol-error", tr("Unknown request type '%1'.").arg(type)); }); m_packetReader.start(); } Session::ProjectDataMode Session::dataModeFromRequest(const QJsonObject &request) { const QString modeString = request.value(QLatin1String("data-mode")).toString(); if (modeString == QLatin1String("only-if-changed")) return ProjectDataMode::OnlyIfChanged; if (modeString == QLatin1String("always")) return ProjectDataMode::Always; return ProjectDataMode::Never; } void Session::sendPacket(const QJsonObject &message) { std::cout << SessionPacket::createPacket(message).constData() << std::flush; } void Session::setupProject(const QJsonObject &request) { if (m_currentJob) { if (qobject_cast(m_currentJob) && m_currentJob->state() == AbstractJob::StateCanceling) { m_resolveRequest = request; return; } sendErrorReply("project-resolved", tr("Cannot start resolving while another job is still running.")); return; } m_moduleProperties = modulePropertiesFromRequest(request); auto params = SetupProjectParameters::fromJson(request); const ProjectDataMode dataMode = dataModeFromRequest(request); m_settings = std::make_unique(params.settingsDirectory()); const Preferences prefs(m_settings.get()); const QString appDir = QDir::cleanPath(qbsApplicationDirPath()); params.setSearchPaths(prefs.searchPaths(appDir + QLatin1String( "/" QBS_RELATIVE_SEARCH_PATH))); params.setPluginPaths(prefs.pluginPaths(appDir + QLatin1String( "/" QBS_RELATIVE_PLUGINS_PATH))); params.setLibexecPath(appDir + QLatin1String("/" QBS_RELATIVE_LIBEXEC_PATH)); params.setOverrideBuildGraphData(true); setLogLevelFromRequest(request); SetupProjectJob * const setupJob = m_project.setupProject(params, &m_logSink, this); m_currentJob = setupJob; connectProgressSignals(setupJob); connect(setupJob, &AbstractJob::finished, this, [this, setupJob, dataMode](bool success) { if (!m_resolveRequest.isEmpty()) { // Canceled job was superseded. const QJsonObject newRequest = std::move(m_resolveRequest); m_resolveRequest = QJsonObject(); m_currentJob->deleteLater(); m_currentJob = nullptr; setupProject(newRequest); return; } const ProjectData oldProjectData = m_projectData; m_project = setupJob->project(); m_projectData = m_project.projectData(); m_lspServer.updateProjectData(m_projectData, m_project.codeLinks()); QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String("project-resolved")); if (success) insertProjectDataIfNecessary(reply, dataMode, oldProjectData, true); else insertErrorInfoIfNecessary(reply, setupJob->error()); sendPacket(reply); m_currentJob->deleteLater(); m_currentJob = nullptr; }); } void Session::buildProject(const QJsonObject &request) { if (!checkNormalRequestPrerequisites("project-built")) return; const ProductSelection productSelection = getProductSelection(request); setLogLevelFromRequest(request); auto options = BuildOptions::fromJson(request); options.setSettingsDirectory(m_settings->baseDirectory()); BuildJob * const buildJob = productSelection.products.empty() ? m_project.buildAllProducts(options, productSelection.selection, this) : m_project.buildSomeProducts(productSelection.products, options, this); m_currentJob = buildJob; m_moduleProperties = modulePropertiesFromRequest(request); const ProjectDataMode dataMode = dataModeFromRequest(request); connectProgressSignals(buildJob); connect(buildJob, &BuildJob::reportCommandDescription, this, [this](const QString &highlight, const QString &message) { QJsonObject descData; descData.insert(StringConstants::type(), QLatin1String("command-description")); descData.insert(QLatin1String("highlight"), highlight); descData.insert(StringConstants::messageKey(), message); sendPacket(descData); }); connect(buildJob, &BuildJob::reportProcessResult, this, [this](const ProcessResult &result) { if (result.success() && result.stdOut().isEmpty() && result.stdErr().isEmpty()) return; QJsonObject resultData = result.toJson(); resultData.insert(StringConstants::type(), QLatin1String("process-result")); sendPacket(resultData); }); connect(buildJob, &BuildJob::finished, this, [this, dataMode](bool success) { QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String("project-built")); const ProjectData oldProjectData = m_projectData; m_projectData = m_project.projectData(); if (success) insertProjectDataIfNecessary(reply, dataMode, oldProjectData, false); else insertErrorInfoIfNecessary(reply, m_currentJob->error()); sendPacket(reply); m_currentJob->deleteLater(); m_currentJob = nullptr; }); } void Session::cleanProject(const QJsonObject &request) { if (!checkNormalRequestPrerequisites("project-cleaned")) return; setLogLevelFromRequest(request); const ProductSelection productSelection = getProductSelection(request); const auto options = CleanOptions::fromJson(request); m_currentJob = productSelection.products.empty() ? m_project.cleanAllProducts(options, this) : m_project.cleanSomeProducts(productSelection.products, options, this); connectProgressSignals(m_currentJob); connect(m_currentJob, &AbstractJob::finished, this, [this](bool success) { QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String("project-cleaned")); if (!success) insertErrorInfoIfNecessary(reply, m_currentJob->error()); sendPacket(reply); m_currentJob->deleteLater(); m_currentJob = nullptr; }); } void Session::installProject(const QJsonObject &request) { if (!checkNormalRequestPrerequisites("install-done")) return; setLogLevelFromRequest(request); const ProductSelection productSelection = getProductSelection(request); const auto options = InstallOptions::fromJson(request); m_currentJob = productSelection.products.empty() ? m_project.installAllProducts(options, productSelection.selection, this) : m_project.installSomeProducts(productSelection.products, options, this); connectProgressSignals(m_currentJob); connect(m_currentJob, &AbstractJob::finished, this, [this](bool success) { QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String("install-done")); if (!success) insertErrorInfoIfNecessary(reply, m_currentJob->error()); sendPacket(reply); m_currentJob->deleteLater(); m_currentJob = nullptr; }); } void Session::addFiles(const QJsonObject &request) { const FileUpdateData data = prepareFileUpdate(request, QLatin1String("files")); if (data.error.hasError()) { sendPacket(data.createErrorReply( "files-added", tr("Failed to add files to project: %1").arg(data.error.toString()), true)); return; } ErrorInfo error; QStringList failedFiles; for (const QString &filePath : data.arguments) { const ErrorInfo e = m_project.addFiles(data.product, data.group, {filePath}); if (e.hasError()) { for (const ErrorItem &ei : e.items()) error.append(ei); failedFiles.push_back(filePath); } } QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String("files-added")); insertErrorInfoIfNecessary(reply, error); if (failedFiles.size() != data.arguments.size()) { // Note that Project::addFiles() directly changes the existing project data object, so // there's no need to retrieve it from m_project. insertProjectDataIfNecessary(reply, ProjectDataMode::Always, {}, false); } if (!failedFiles.isEmpty()) reply.insert(QLatin1String("failed-files"), QJsonArray::fromStringList(failedFiles)); sendPacket(reply); } void Session::removeFiles(const QJsonObject &request) { const FileUpdateData data = prepareFileUpdate(request, QLatin1String("files")); if (data.error.hasError()) { sendPacket(data.createErrorReply( "files-removed", tr("Failed to remove files from project: %1").arg(data.error.toString()), true)); return; } ErrorInfo error; QStringList failedFiles; for (const QString &filePath : data.arguments) { const ErrorInfo e = m_project.removeFiles(data.product, data.group, {filePath}); if (e.hasError()) { for (const ErrorItem &ei : e.items()) error.append(ei); failedFiles.push_back(filePath); } } QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String("files-removed")); insertErrorInfoIfNecessary(reply, error); if (failedFiles.size() != data.arguments.size()) insertProjectDataIfNecessary(reply, ProjectDataMode::Always, {}, false); if (!failedFiles.isEmpty()) reply.insert(QLatin1String("failed-files"), QJsonArray::fromStringList(failedFiles)); sendPacket(reply); } void Session::renameFiles(const QJsonObject &request) { const FileUpdateData data = prepareFileUpdate(request, QLatin1String("files")); if (data.error.hasError()) { sendPacket(data.createErrorReply( "files-renamed", tr("Failed to rename files in project: %1").arg(data.error.toString()), true)); return; } ErrorInfo error; QStringList failedFiles; for (const FilePair &sourceAndTarget : data.arguments) { const ErrorInfo removeError = m_project.removeFiles( data.product, data.group, {sourceAndTarget.first}); if (removeError.hasError()) { for (const ErrorItem &ei : removeError.items()) error.append(ei); failedFiles.push_back(sourceAndTarget.first); } else { const ErrorInfo addError = m_project.addFiles( data.product, data.group, {sourceAndTarget.second}); if (addError.hasError()) { for (const ErrorItem &ei : addError.items()) error.append(ei); failedFiles.push_back(sourceAndTarget.first); } } } QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String("files-renamed")); insertErrorInfoIfNecessary(reply, error); if (failedFiles.size() != data.arguments.size()) insertProjectDataIfNecessary(reply, ProjectDataMode::Always, {}, false); if (!failedFiles.isEmpty()) reply.insert(QLatin1String("failed-files"), QJsonArray::fromStringList(failedFiles)); sendPacket(reply); } void Session::addDependencies(const QJsonObject &request) { const FileUpdateData data = prepareFileUpdate(request, QLatin1String("dependencies")); if (data.error.hasError()) { sendPacket(data.createErrorReply( "dependencies-added", tr("Failed to add dependencies to project: %1").arg(data.error.toString()), false)); return; } ErrorInfo error; const ErrorInfo e = m_project.addDependencies(data.product, data.group, data.arguments); QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String("dependencies-added")); insertErrorInfoIfNecessary(reply, error); insertProjectDataIfNecessary(reply, ProjectDataMode::Always, {}, false); sendPacket(reply); } void Session::connectProgressSignals(AbstractJob *job) { static QString maxProgressString(QLatin1String("max-progress")); connect(job, &AbstractJob::taskStarted, this, [this](const QString &description, int maxProgress) { QJsonObject msg; msg.insert(StringConstants::type(), QLatin1String("task-started")); msg.insert(StringConstants::descriptionProperty(), description); msg.insert(maxProgressString, maxProgress); sendPacket(msg); }); connect(job, &AbstractJob::totalEffortChanged, this, [this](int maxProgress) { QJsonObject msg; msg.insert(StringConstants::type(), QLatin1String("new-max-progress")); msg.insert(maxProgressString, maxProgress); sendPacket(msg); }); connect(job, &AbstractJob::taskProgress, this, [this](int progress) { QJsonObject msg; msg.insert(StringConstants::type(), QLatin1String("task-progress")); msg.insert(QLatin1String("progress"), progress); sendPacket(msg); }); } static QList getProductsByNameForProject(const ProjectData &project, QStringList &productNames) { QList products; if (productNames.empty()) return products; for (const ProductData &p : project.products()) { for (auto it = productNames.begin(); it != productNames.end(); ++it) { if (*it == p.fullDisplayName()) { products << p; productNames.erase(it); if (productNames.empty()) return products; break; } } } for (const ProjectData &p : project.subProjects()) { products << getProductsByNameForProject(p, productNames); if (productNames.empty()) break; } return products; } QList Session::getProductsByName(const QStringList &productNames) const { QStringList remainingNames = productNames; return getProductsByNameForProject(m_projectData, remainingNames); } ProductData Session::getProductByName(const QString &productName) const { const QList products = getProductsByName({productName}); return products.empty() ? ProductData() : products.first(); } void Session::getRunEnvironment(const QJsonObject &request) { const char * const replyType = "run-environment"; if (!checkNormalRequestPrerequisites(replyType)) return; const QString productName = request.value(QLatin1String("product")).toString(); const ProductData product = getProductByName(productName); if (!product.isValid()) { sendErrorReply(replyType, tr("No such product '%1'.").arg(productName)); return; } const auto inEnv = fromJson( request.value(QLatin1String("base-environment"))); const QStringList config = fromJson(request.value(QLatin1String("config"))); const RunEnvironment runEnv = m_project.getRunEnvironment(product, InstallOptions(), inEnv, config, m_settings.get()); ErrorInfo error; const QProcessEnvironment outEnv = runEnv.runEnvironment(&error); if (error.hasError()) { sendErrorReply(replyType, error); return; } QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String(replyType)); QJsonObject outEnvObj; const QStringList keys = outEnv.keys(); for (const QString &key : keys) outEnvObj.insert(key, outEnv.value(key)); reply.insert(QLatin1String("full-environment"), outEnvObj); sendPacket(reply); } void Session::getGeneratedFilesForSources(const QJsonObject &request) { const char * const replyType = "generated-files-for-sources"; if (!checkNormalRequestPrerequisites(replyType)) return; QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String(replyType)); const QJsonArray specs = request.value(StringConstants::productsKey()).toArray(); QJsonArray resultProducts; for (const auto &p : specs) { const QJsonObject productObject = p.toObject(); const ProductData product = getProductByName( productObject.value(StringConstants::fullDisplayNameKey()).toString()); if (!product.isValid()) continue; QJsonObject resultProduct; resultProduct.insert(StringConstants::fullDisplayNameKey(), product.fullDisplayName()); QJsonArray results; const QJsonArray requests = productObject.value(QLatin1String("requests")).toArray(); for (const auto &r : requests) { const QJsonObject request = r.toObject(); const QString filePath = request.value(QLatin1String("source-file")).toString(); const QStringList tags = fromJson(request.value(QLatin1String("tags"))); const bool recursive = request.value(QLatin1String("recursive")).toBool(); const QStringList generatedFiles = m_project.generatedFiles(product, filePath, recursive, tags); if (!generatedFiles.isEmpty()) { QJsonObject result; result.insert(QLatin1String("source-file"), filePath); result.insert(QLatin1String("generated-files"), QJsonArray::fromStringList(generatedFiles)); results << result; } } if (!results.isEmpty()) { resultProduct.insert(QLatin1String("results"), results); resultProducts << resultProduct; } } reply.insert(StringConstants::productsKey(), resultProducts); sendPacket(reply); } void Session::releaseProject() { const char * const replyType = "project-released"; if (!m_project.isValid()) { sendErrorReply(replyType, tr("No open project.")); return; } if (m_currentJob) { m_currentJob->disconnect(this); m_currentJob->cancel(); m_currentJob = nullptr; } m_project = Project(); m_projectData = ProjectData(); m_resolveRequest = QJsonObject(); QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String(replyType)); sendPacket(reply); } void Session::cancelCurrentJob() { if (m_currentJob) { if (!m_resolveRequest.isEmpty()) m_resolveRequest = QJsonObject(); m_currentJob->cancel(); } } Session::ProductSelection Session::getProductSelection(const QJsonObject &request) { const QJsonValue productSelection = request.value(StringConstants::productsKey()); if (productSelection.isArray()) return {getProductsByName(fromJson(productSelection))}; return { productSelection.toString() == QLatin1String("all") ? Project::ProductSelectionWithNonDefault : Project::ProductSelectionDefaultOnly}; } template Session::FileUpdateData Session::prepareFileUpdate( const QJsonObject &request, const QString ¶mKey) { FileUpdateData data; const QString productName = request.value(QLatin1String("product")).toString(); data.product = getProductByName(productName); if (data.product.isValid()) { const QString groupName = request.value(QLatin1String("group")).toString(); for (const GroupData &g : data.product.groups()) { if (g.name() == groupName) { data.group = g; break; } } if (!data.group.isValid()) data.error = tr("Group '%1' not found in product '%2'.").arg(groupName, productName); } else { data.error = tr("Product '%1' not found in project.").arg(productName); } const QJsonArray argsArray = request.value(paramKey).toArray(); for (const auto &v : argsArray) if constexpr (std::is_same_v) { data.arguments << v.toString(); } else if constexpr (std::is_same_v) { const QJsonObject file = v.toObject(); data.arguments << std::make_pair( file.value(QLatin1String("source-path")).toString(), file.value(QLatin1String("target-path")).toString()); } if (m_currentJob) data.error = tr("Cannot update the project while a job is running."); if (!m_project.isValid()) data.error = tr("No valid project. You need to resolve first."); return data; } void Session::insertProjectDataIfNecessary(QJsonObject &reply, ProjectDataMode dataMode, const ProjectData &oldProjectData, bool includeTopLevelData) { const bool sendProjectData = dataMode == ProjectDataMode::Always || (dataMode == ProjectDataMode::OnlyIfChanged && m_projectData != oldProjectData); if (!sendProjectData) return; QJsonObject projectData = m_projectData.toJson(m_moduleProperties); if (includeTopLevelData) { QJsonArray buildSystemFiles; for (const QString &f : m_project.buildSystemFiles()) buildSystemFiles.push_back(f); projectData.insert(StringConstants::buildDirectoryKey(), m_projectData.buildDirectory()); projectData.insert(QLatin1String("build-system-files"), buildSystemFiles); const Project::BuildGraphInfo bgInfo = m_project.getBuildGraphInfo(); projectData.insert(QLatin1String("build-graph-file-path"), bgInfo.bgFilePath); projectData.insert(QLatin1String("profile-data"), QJsonObject::fromVariantMap(bgInfo.profileData)); projectData.insert(QLatin1String("overridden-properties"), QJsonObject::fromVariantMap(bgInfo.overriddenProperties)); } reply.insert(QLatin1String("project-data"), projectData); } void Session::setLogLevelFromRequest(const QJsonObject &request) { const QString logLevelString = request.value(QLatin1String("log-level")).toString(); if (logLevelString.isEmpty()) return; for (const LoggerLevel l : {LoggerError, LoggerWarning, LoggerInfo, LoggerDebug, LoggerTrace}) { if (logLevelString == logLevelName(l)) { m_logSink.setLogLevel(l); return; } } } bool Session::checkNormalRequestPrerequisites(const char *replyType) { if (m_currentJob) { sendErrorReply(replyType, tr("Another job is still running.")); return false; } if (!m_project.isValid()) { sendErrorReply(replyType, tr("No valid project. You need to resolve first.")); return false; } return true; } QStringList Session::modulePropertiesFromRequest(const QJsonObject &request) { return fromJson(request.value(StringConstants::modulePropertiesKey())); } void Session::sendErrorReply(const char *replyType, const ErrorInfo &error) { QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String(replyType)); insertErrorInfoIfNecessary(reply, error); sendPacket(reply); } void Session::sendErrorReply(const char *replyType, const QString &message) { sendErrorReply(replyType, ErrorInfo(message)); } void Session::insertErrorInfoIfNecessary(QJsonObject &reply, const ErrorInfo &error) { if (error.hasError()) reply.insert(QLatin1String("error"), error.toJson()); } void Session::quitSession() { m_logSink.disconnect(this); m_packetReader.disconnect(this); if (m_currentJob) { m_currentJob->disconnect(this); connect(m_currentJob, &AbstractJob::finished, qApp, QCoreApplication::quit); m_currentJob->cancel(); } else { qApp->quit(); } } template QJsonObject Session::FileUpdateData::createErrorReply( const char *type, const QString &mainMessage, bool addFailedFiles) const { QBS_ASSERT(error.hasError(), return QJsonObject()); ErrorInfo error(mainMessage); for (const ErrorItem &ei : error.items()) error.append(ei); QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String(type)); reply.insert(QLatin1String("error"), error.toJson()); if (addFailedFiles) { QStringList failedFiles; if constexpr (std::is_same_v) { failedFiles = arguments; } else if constexpr (std::is_same_v) { failedFiles = transformed(arguments, [](const FilePair &fp) { return fp.first; }); } reply.insert(QLatin1String("failed-files"), QJsonArray::fromStringList(failedFiles)); } return reply; } } // namespace Internal } // namespace qbs #include qbs-src-3.2.0/src/app/qbs/session.h0000644000175100017510000000401615154533055016473 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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_SESSION_H #define QBS_SESSION_H namespace qbs { namespace Internal { void startSession(); } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/app/qbs/consoleprogressobserver.h0000644000175100017510000000477515154533055022023 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 CONSOLEPROGRESSOBSERVER_H #define CONSOLEPROGRESSOBSERVER_H #include QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE namespace qbs { class ConsoleProgressObserver { public: void initialize(const QString &task, int max); void setMaximum(int maximum); void setProgressValue(int value); void incrementProgressValue() { setProgressValue(m_value + 1); } private: void eraseCurrentPercentageString(); void updateProgressBarIfNecessary(); void writePercentageString(); int m_maximum; int m_value; int m_percentage; int m_hashesPrinted; }; } // namespace qbs #endif // CONSOLEPROGRESSOBSERVER_H qbs-src-3.2.0/src/app/qbs/status.h0000644000175100017510000000377515154533055016346 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 STATUS_H #define STATUS_H namespace qbs { class ProjectData; int printStatus(const ProjectData &project); } // namespace qbs #endif // STATUS_H qbs-src-3.2.0/src/app/qbs/lspserver.h0000644000175100017510000000436615154533055017045 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once #include #include namespace qbs { class ProjectData; namespace Internal { class LspServer { public: LspServer(); ~LspServer(); void updateProjectData(const ProjectData &projectData, const CodeLinks &codeLinks); QString socketPath() const; private: class Private; Private * const d; }; } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/app/qbs/commandlinefrontend.h0000644000175100017510000001070415154533055021037 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 COMMANDLINEFRONTEND_H #define COMMANDLINEFRONTEND_H #include "parser/commandlineparser.h" #include #include #include #include #include #include QT_BEGIN_NAMESPACE class QTimer; QT_END_NAMESPACE namespace qbs { class AbstractJob; class ConsoleProgressObserver; class ErrorInfo; class ProcessResult; class ProjectGenerator; class Settings; class CommandLineFrontend : public QObject { Q_OBJECT public: explicit CommandLineFrontend(const CommandLineParser &parser, Settings *settings, QObject *parent = nullptr); ~CommandLineFrontend() override; void cancel(); void start(); private: void handleCommandDescriptionReport(const QString &highlight, const QString &message); void handleJobFinished(bool success, qbs::AbstractJob *job); void handleNewTaskStarted(const QString &description, int totalEffort); void handleTotalEffortChanged(int totalEffort); void handleTaskProgress(int value, qbs::AbstractJob *job); void handleProcessResultReport(const qbs::ProcessResult &result); void checkCancelStatus(); using ProductMap = QHash>; ProductMap productsToUse() const; bool resolvingMultipleProjects() const; bool isResolving() const; bool isBuilding() const; void handleProjectsResolved(); void makeClean(); int runShell(); void build(); void checkGeneratorName(); void generate(); int runTarget(); void updateTimestamps(); void dumpNodesTree(); void listProducts(); void connectBuildJobs(); void connectBuildJob(AbstractJob *job); void connectJob(AbstractJob *job); ProductData getTheOneRunnableProduct(); void install(); BuildOptions buildOptions(const Project &project) const; QString buildDirectory(const QString &profileName) const; const CommandLineParser &m_parser; Settings * const m_settings; QList m_resolveJobs; QList m_buildJobs; QList m_projects; ConsoleProgressObserver *m_observer = nullptr; enum CancelStatus { CancelStatusNone, CancelStatusRequested, CancelStatusCanceling }; CancelStatus m_cancelStatus = CancelStatus::CancelStatusNone; QTimer * const m_cancelTimer; int m_buildEffortsNeeded = 0; int m_buildEffortsRetrieved = 0; int m_totalBuildEffort = 0; int m_currentBuildEffort = 0; QHash m_buildEfforts; std::shared_ptr m_generator; }; } // namespace qbs #endif // COMMANDLINEFRONTEND_H qbs-src-3.2.0/src/app/qbs/qbstool.cpp0000644000175100017510000001023715154533055017030 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "qbstool.h" #include #include #include #include #include #include #include static QString toolPrefix() { return QStringLiteral("qbs-"); } static QString qbsToolFilePath(const QString &toolName) { return qbs::qbsApplicationDirPath() + QLatin1Char('/') + toolPrefix() + qbs::Internal::HostOsInfo::appendExecutableSuffix(toolName); } void QbsTool::runTool(const QString &toolName, const QStringList &arguments) { m_failedToStart = false; m_exitCode = -1; const QString filePath = qbsToolFilePath(toolName); const QFileInfo fi(filePath); if (!fi.exists() || !fi.isFile() || !fi.isExecutable()) { m_failedToStart = true; return; } QProcess toolProc; toolProc.start(filePath, arguments); if (!toolProc.waitForStarted()) m_failedToStart = true; toolProc.waitForFinished(-1); m_exitCode = toolProc.exitCode(); m_stdout = QString::fromLocal8Bit(toolProc.readAllStandardOutput()); m_stderr = QString::fromLocal8Bit(toolProc.readAllStandardError()); } bool QbsTool::tryToRunTool(const QString &toolName, const QStringList &arguments, int *exitCode) { QbsTool tool; tool.runTool(toolName, arguments); if (exitCode) *exitCode = tool.exitCode(); if (tool.failedToStart()) return false; std::cout << qPrintable(tool.stdOut()); std::cerr << qPrintable(tool.stdErr()); return true; } QStringList QbsTool::allToolNames() { const QString suffix = QLatin1String(QBS_HOST_EXE_SUFFIX); const QStringList toolFileNames = QDir(qbs::qbsApplicationDirPath()) .entryList( QStringList( toolPrefix() + QStringLiteral("*%1").arg(suffix)), QDir::Files, QDir::Name); QStringList toolNames; const int prefixLength = toolPrefix().size(); for (const QString &toolFileName : toolFileNames) { toolNames << toolFileName.mid(prefixLength, toolFileName.size() - prefixLength - suffix.size()); } return toolNames; } qbs-src-3.2.0/src/app/qbs/commandlinefrontend.cpp0000644000175100017510000006660415154533055021404 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "commandlinefrontend.h" #include "application.h" #include "consoleprogressobserver.h" #include "session.h" #include "status.h" #include "parser/commandlineoption.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { using namespace Internal; CommandLineFrontend::CommandLineFrontend(const CommandLineParser &parser, Settings *settings, QObject *parent) : QObject(parent) , m_parser(parser) , m_settings(settings) , m_observer(nullptr) , m_cancelStatus(CancelStatusNone) , m_cancelTimer(new QTimer(this)) { } CommandLineFrontend::~CommandLineFrontend() { m_cancelTimer->stop(); delete m_observer; } // Called from interrupt handler. Don't do anything non-trivial here. void CommandLineFrontend::cancel() { m_cancelStatus = CancelStatusRequested; } void CommandLineFrontend::checkCancelStatus() { switch (m_cancelStatus) { case CancelStatusNone: break; case CancelStatusRequested: m_cancelStatus = CancelStatusCanceling; m_cancelTimer->stop(); if (m_resolveJobs.empty() && m_buildJobs.empty()) std::exit(EXIT_FAILURE); for (AbstractJob * const job : std::as_const(m_resolveJobs)) job->cancel(); for (AbstractJob * const job : std::as_const(m_buildJobs)) job->cancel(); break; case CancelStatusCanceling: QBS_ASSERT(false, return); break; } } void CommandLineFrontend::start() { try { switch (m_parser.command()) { case RunCommandType: case ShellCommandType: if (m_parser.products().size() > 1) { throw ErrorInfo(Tr::tr("Invalid use of command '%1': Cannot use more than one " "product.\nUsage: %2") .arg(m_parser.commandName(), m_parser.commandDescription())); } Q_FALLTHROUGH(); case StatusCommandType: case InstallCommandType: case DumpNodesTreeCommandType: case ListProductsCommandType: if (m_parser.buildConfigurations().size() > 1) { QString error = Tr::tr("Invalid use of command '%1': There can be only one " "build configuration.\n").arg(m_parser.commandName()); error += Tr::tr("Usage: %1").arg(m_parser.commandDescription()); throw ErrorInfo(error); } break; case SessionCommandType: { startSession(); return; } default: break; } if (m_parser.showVersion()) { std::puts(QBS_VERSION); qApp->exit(EXIT_SUCCESS); return; } if (m_parser.showProgress()) m_observer = new ConsoleProgressObserver; SetupProjectParameters params; params.setEnvironment(QProcessEnvironment::systemEnvironment()); params.setProjectFilePath(m_parser.projectFilePath()); params.setDryRun(m_parser.dryRun()); params.setForceProbeExecution(m_parser.forceProbesExecution()); params.setWaitLockBuildGraph(m_parser.waitLockBuildGraph()); params.setLogElapsedTime(m_parser.logTime()); params.setSettingsDirectory(m_settings->baseDirectory()); params.setOverrideBuildGraphData(m_parser.command() == ResolveCommandType); params.setPropertyCheckingMode(ErrorHandlingMode::Strict); params.setDeprecationWarningMode(m_parser.deprecationWarningMode()); if (!m_parser.buildBeforeInstalling() || !m_parser.commandCanResolve()) params.setRestoreBehavior(SetupProjectParameters::RestoreOnly); const auto buildConfigs = m_parser.buildConfigurations(); for (const QVariantMap &buildConfig : buildConfigs) { QVariantMap userConfig = buildConfig; const QString configurationKey = QStringLiteral("qbs.configurationName"); const QString profileKey = QStringLiteral("qbs.profile"); const QString installRootKey = QStringLiteral("qbs.installRoot"); QString installRoot = userConfig.value(installRootKey).toString(); if (!installRoot.isEmpty() && QFileInfo(installRoot).isRelative()) { installRoot.prepend(QLatin1Char('/')).prepend(QDir::currentPath()); userConfig.insert(installRootKey, installRoot); } const QString configurationName = userConfig.take(configurationKey).toString(); const QString profileName = userConfig.take(profileKey).toString(); const Preferences prefs(m_settings); params.setSearchPaths(prefs.searchPaths(QDir::cleanPath( qbsApplicationDirPath() + QLatin1String("/" QBS_RELATIVE_SEARCH_PATH)))); params.setPluginPaths(prefs.pluginPaths(QDir::cleanPath( qbsApplicationDirPath() + QLatin1String("/" QBS_RELATIVE_PLUGINS_PATH)))); params.setLibexecPath(QDir::cleanPath( qbsApplicationDirPath() + QLatin1String("/" QBS_RELATIVE_LIBEXEC_PATH))); params.setTopLevelProfile(profileName); params.setConfigurationName(configurationName); params.setBuildRoot(buildDirectory(profileName)); params.setOverriddenValues(userConfig); params.setMaxJobCount(m_parser.jobCount(profileName)); SetupProjectJob * const job = Project().setupProject(params, ConsoleLogger::instance().logSink(), this); connectJob(job); m_resolveJobs.push_back(job); } /* * Progress reporting on the terminal gets a bit tricky when resolving several projects * concurrently, since we cannot show multiple progress bars at the same time. Instead, * we just set the total effort to the number of projects and increase the progress * every time one of them finishes, ignoring the progress reports from the jobs themselves. * (Yes, that does mean it will take disproportionately long for the first progress * notification to arrive.) */ if (m_parser.showProgress() && resolvingMultipleProjects()) m_observer->initialize(tr("Setting up projects"), m_resolveJobs.size()); // Check every two seconds whether we received a cancel request. This value has been // experimentally found to be acceptable. // Note that this polling approach is not problematic here, since we are doing work anyway, // so there's no danger of waking up the processor for no reason. connect(m_cancelTimer, &QTimer::timeout, this, &CommandLineFrontend::checkCancelStatus); m_cancelTimer->start(2000); } catch (const ErrorInfo &error) { qbsError() << error.toString(); if (m_buildJobs.empty() && m_resolveJobs.empty()) { qApp->exit(EXIT_FAILURE); } else { cancel(); checkCancelStatus(); } } } void CommandLineFrontend::handleCommandDescriptionReport(const QString &highlight, const QString &message) { qbsInfo() << MessageTag(highlight) << message; } void CommandLineFrontend::handleJobFinished(bool success, AbstractJob *job) { try { job->deleteLater(); if (!success) { qbsError() << job->error().toString(); m_resolveJobs.removeOne(job); m_buildJobs.removeOne(job); if (m_resolveJobs.empty() && m_buildJobs.empty()) { qApp->exit(EXIT_FAILURE); return; } cancel(); } else if (const auto setupJob = qobject_cast(job)) { m_resolveJobs.removeOne(job); m_projects.push_back(setupJob->project()); if (m_observer && resolvingMultipleProjects()) m_observer->incrementProgressValue(); if (m_resolveJobs.empty()) handleProjectsResolved(); } else if (qobject_cast(job)) { if (m_parser.command() == RunCommandType) qApp->exit(runTarget()); else qApp->quit(); } else { // Build or clean. m_buildJobs.removeOne(job); if (m_buildJobs.empty()) { switch (m_parser.command()) { case RunCommandType: case InstallCommandType: install(); break; case GenerateCommandType: generate(); // fall through case BuildCommandType: case CleanCommandType: qApp->exit(m_cancelStatus == CancelStatusNone ? EXIT_SUCCESS : EXIT_FAILURE); break; default: Q_ASSERT_X(false, Q_FUNC_INFO, "Missing case in switch statement"); } } } } catch (const ErrorInfo &error) { qbsError() << error.toString(); qApp->exit(EXIT_FAILURE); } } void CommandLineFrontend::handleNewTaskStarted(const QString &description, int totalEffort) { // If the user does not want a progress bar, we just print the current activity. if (!m_parser.showProgress()) { if (!m_parser.logTime()) qbsInfo() << description; return; } if (isBuilding()) { m_totalBuildEffort += totalEffort; if (++m_buildEffortsRetrieved == m_buildEffortsNeeded) { m_observer->initialize(tr("Building"), m_totalBuildEffort); if (m_currentBuildEffort > 0) m_observer->setProgressValue(m_currentBuildEffort); } } else if (!resolvingMultipleProjects()) { m_observer->initialize(description, totalEffort); } } void CommandLineFrontend::handleTotalEffortChanged(int totalEffort) { // Can only happen when resolving. if (m_parser.showProgress() && !isBuilding() && !resolvingMultipleProjects()) m_observer->setMaximum(totalEffort); } void CommandLineFrontend::handleTaskProgress(int value, AbstractJob *job) { if (isBuilding()) { int ¤tJobEffort = m_buildEfforts[job]; m_currentBuildEffort += value - currentJobEffort; currentJobEffort = value; if (m_buildEffortsRetrieved == m_buildEffortsNeeded) m_observer->setProgressValue(m_currentBuildEffort); } else if (!resolvingMultipleProjects()) { m_observer->setProgressValue(value); } } void CommandLineFrontend::handleProcessResultReport(const qbs::ProcessResult &result) { bool hasOutput = !result.stdOut().empty() || !result.stdErr().empty(); if (!hasOutput && result.success()) return; LogWriter w = result.success() ? qbsInfo() : qbsError(); w << shellQuote(QDir::toNativeSeparators(result.executableFilePath()), result.arguments()) << (hasOutput ? QStringLiteral("\n") : QString()) << (result.stdOut().empty() ? QString() : result.stdOut().join(QLatin1Char('\n'))); if (!result.stdErr().empty()) w << result.stdErr().join(QLatin1Char('\n')) << MessageTag(QStringLiteral("stdErr")); } bool CommandLineFrontend::resolvingMultipleProjects() const { return isResolving() && m_resolveJobs.size() + m_projects.size() > 1; } bool CommandLineFrontend::isResolving() const { return !m_resolveJobs.empty(); } bool CommandLineFrontend::isBuilding() const { return !m_buildJobs.empty(); } CommandLineFrontend::ProductMap CommandLineFrontend::productsToUse() const { ProductMap products; QStringList productNames; const bool useAll = m_parser.products().empty(); for (const Project &project : std::as_const(m_projects)) { QList &productList = products[project]; const ProjectData projectData = project.projectData(); for (const ProductData &product : projectData.allProducts()) { productNames << product.fullDisplayName(); if (useAll || m_parser.products().contains(product.fullDisplayName())) { productList.push_back(product); } } } const auto parsedProductNames = m_parser.products(); for (const QString &productName : parsedProductNames) { if (!productNames.contains(productName)) { QString msg; if (productNames.size() <= 10) { productNames.sort(); const QString available = productNames.join(QLatin1String("', '")); msg = Tr::tr("No such product '%1'. " "Available products: '%2'").arg(productName, available); } else { msg = Tr::tr("No such product '%1'. Use 'list-products' to see " "all available products.").arg(productName); } throw ErrorInfo(msg); } } return products; } void CommandLineFrontend::handleProjectsResolved() { if (m_cancelStatus != CancelStatusNone) throw ErrorInfo(Tr::tr("Execution canceled.")); switch (m_parser.command()) { case ResolveCommandType: qApp->quit(); break; case CleanCommandType: makeClean(); break; case ShellCommandType: qApp->exit(runShell()); break; case StatusCommandType: qApp->exit(printStatus(m_projects.front().projectData())); break; case GenerateCommandType: checkGeneratorName(); Q_FALLTHROUGH(); case BuildCommandType: build(); break; case InstallCommandType: case RunCommandType: if (m_parser.buildBeforeInstalling()) build(); else install(); break; case UpdateTimestampsCommandType: updateTimestamps(); qApp->quit(); break; case DumpNodesTreeCommandType: dumpNodesTree(); qApp->quit(); break; case ListProductsCommandType: listProducts(); qApp->quit(); break; case HelpCommandType: case VersionCommandType: case SessionCommandType: Q_ASSERT_X(false, Q_FUNC_INFO, "Impossible."); } } void CommandLineFrontend::makeClean() { if (m_parser.products().empty()) { for (const Project &project : std::as_const(m_projects)) { m_buildJobs << project.cleanAllProducts(m_parser.cleanOptions(project.profile()), this); } } else { const ProductMap &products = productsToUse(); for (ProductMap::ConstIterator it = products.begin(); it != products.end(); ++it) { m_buildJobs.push_back(it.key().cleanSomeProducts( it.value(), m_parser.cleanOptions(it.key().profile()), this)); } } connectBuildJobs(); } int CommandLineFrontend::runShell() { ProductData productToRun; switch (m_parser.products().size()) { case 0: // No specific product, use project-global environment. break; case 1: productToRun = productsToUse().values().front().front(); break; default: throw ErrorInfo(Tr::tr("The command '%1' cannot take more than one product.")); } RunEnvironment runEnvironment = m_projects.front().getRunEnvironment(productToRun, m_parser.installOptions(m_projects.front().profile()), QProcessEnvironment::systemEnvironment(), QStringList(), m_settings); return runEnvironment.doRunShell(); } BuildOptions CommandLineFrontend::buildOptions(const Project &project) const { BuildOptions options = m_parser.buildOptions(m_projects.front().profile()); if (options.maxJobCount() <= 0) { const QString profileName = project.profile(); QBS_CHECK(!profileName.isEmpty()); options.setMaxJobCount(Preferences(m_settings, profileName).jobs()); } return options; } QString CommandLineFrontend::buildDirectory(const QString &profileName) const { QString buildDir = m_parser.projectBuildDirectory(); if (buildDir.isEmpty()) { buildDir = Preferences(m_settings, profileName).defaultBuildDirectory(); if (buildDir.isEmpty()) { qbsDebug() << "No project build directory given; using current directory."; buildDir = QDir::currentPath(); } else { qbsDebug() << "No project build directory given; using directory from preferences."; } } QString projectName(QFileInfo(m_parser.projectFilePath()).baseName()); QString originalBuildDir = buildDir; buildDir.replace(BuildDirectoryOption::magicProjectString(), projectName); const QString buildDirPlaceHolderMsgTemplate = Tr::tr( "You must provide the path to the project file when using build directory " "placeholder '%1'."); if (buildDir != originalBuildDir && projectName.isEmpty()) { throw ErrorInfo( buildDirPlaceHolderMsgTemplate.arg(BuildDirectoryOption::magicProjectString())); } QString projectDir(QFileInfo(m_parser.projectFilePath()).path()); originalBuildDir = buildDir; buildDir.replace(BuildDirectoryOption::magicProjectDirString(), projectDir); if (buildDir != originalBuildDir && projectDir.isEmpty()) { throw ErrorInfo( buildDirPlaceHolderMsgTemplate.arg(BuildDirectoryOption::magicProjectDirString())); } if (!QFileInfo(buildDir).isAbsolute()) buildDir = QDir::currentPath() + QLatin1Char('/') + buildDir; buildDir = QDir::cleanPath(buildDir); return buildDir; } void CommandLineFrontend::build() { if (m_parser.products().empty()) { const Project::ProductSelection productSelection = m_parser.withNonDefaultProducts() ? Project::ProductSelectionWithNonDefault : Project::ProductSelectionDefaultOnly; for (const Project &project : std::as_const(m_projects)) m_buildJobs << project.buildAllProducts(buildOptions(project), productSelection, this); } else { const ProductMap &products = productsToUse(); for (ProductMap::ConstIterator it = products.begin(); it != products.end(); ++it) m_buildJobs.push_back(it.key().buildSomeProducts(it.value(), buildOptions(it.key()), this)); } connectBuildJobs(); /* * Progress reporting for the build jobs works as follows: We know that for every job, * the newTaskStarted() signal is emitted exactly once (unless there's an error). So we add up * the respective total efforts as they come in. Once all jobs have reported their total * efforts, we can start the overall progress report. */ m_buildEffortsNeeded = m_buildJobs.size(); m_buildEffortsRetrieved = 0; m_totalBuildEffort = 0; m_currentBuildEffort = 0; } void CommandLineFrontend::checkGeneratorName() { const QString generatorName = m_parser.generateOptions().generatorName(); m_generator = ProjectGeneratorManager::findGenerator(generatorName); if (m_generator) return; const auto generatorNames = ProjectGeneratorManager::loadedGeneratorNames(); if (!generatorNames.empty()) { const QString generatorNamesString = generatorNames.join(QLatin1String("\n\t")); if (!generatorName.isEmpty()) { throw ErrorInfo(Tr::tr("No generator named '%1'. Available generators:\n\t%2") .arg(generatorName, generatorNamesString)); } throw ErrorInfo(Tr::tr("No generator specified. Available generators:\n\t%1") .arg(generatorNamesString)); } throw ErrorInfo(Tr::tr("No generator specified or no generators are available.")); } void CommandLineFrontend::generate() { QBS_CHECK(!!m_generator); const ErrorInfo error = m_generator->generate(m_projects, m_parser.buildConfigurations(), m_parser.installOptions(QString()), m_parser.settingsDir(), ConsoleLogger::instance(m_settings)); if (error.hasError()) throw error; } int CommandLineFrontend::runTarget() { const ProductData productToRun = getTheOneRunnableProduct(); const QString executableFilePath = productToRun.targetExecutable(); if (executableFilePath.isEmpty()) { throw ErrorInfo(Tr::tr("Cannot run: Product '%1' is not an application.") .arg(productToRun.fullDisplayName())); } RunEnvironment runEnvironment = m_projects.front().getRunEnvironment(productToRun, m_parser.installOptions(m_projects.front().profile()), QProcessEnvironment::systemEnvironment(), m_parser.runEnvConfig(), m_settings); return runEnvironment.doRunTarget(executableFilePath, m_parser.runArgs(), m_parser.dryRun()); } void CommandLineFrontend::updateTimestamps() { const ProductMap &products = productsToUse(); for (ProductMap::ConstIterator it = products.constBegin(); it != products.constEnd(); ++it) { Project p = it.key(); p.updateTimestamps(it.value()); } } void CommandLineFrontend::dumpNodesTree() { QFile stdOut; if (!stdOut.open(stdout, QIODevice::WriteOnly)) throw ErrorInfo(Tr::tr("Cannot write to standard output.")); const ErrorInfo error = m_projects.front().dumpNodesTree(stdOut, productsToUse() .value(m_projects.front())); if (error.hasError()) throw error; } void CommandLineFrontend::listProducts() { const QList products = productsToUse().constBegin().value(); QStringList output; for (const ProductData &p : products) { QString productInfo = p.fullDisplayName(); if (!p.isEnabled()) productInfo.append(QLatin1Char(' ')).append(Tr::tr("[disabled]")); else if (!p.properties().value(QStringLiteral("builtByDefault")).toBool()) productInfo.append(QLatin1Char(' ')).append(Tr::tr("[not built by default]")); output += productInfo; } output.sort(); qbsInfo() << output.join(QLatin1Char('\n')); } void CommandLineFrontend::connectBuildJobs() { for (AbstractJob * const job : std::as_const(m_buildJobs)) connectBuildJob(job); } void CommandLineFrontend::connectBuildJob(AbstractJob *job) { connectJob(job); const auto bjob = qobject_cast(job); if (!bjob) return; connect(bjob, &BuildJob::reportCommandDescription, this, &CommandLineFrontend::handleCommandDescriptionReport); connect(bjob, &BuildJob::reportProcessResult, this, &CommandLineFrontend::handleProcessResultReport); } void CommandLineFrontend::connectJob(AbstractJob *job) { connect(job, &AbstractJob::finished, this, &CommandLineFrontend::handleJobFinished); connect(job, &AbstractJob::taskStarted, this, &CommandLineFrontend::handleNewTaskStarted); connect(job, &AbstractJob::totalEffortChanged, this, &CommandLineFrontend::handleTotalEffortChanged); if (m_parser.showProgress()) { connect(job, &AbstractJob::taskProgress, this, &CommandLineFrontend::handleTaskProgress); } } ProductData CommandLineFrontend::getTheOneRunnableProduct() { QBS_CHECK(m_projects.size() == 1); // Has been checked earlier. if (m_parser.products().size() == 1) { for (const ProductData &p : m_projects.front().projectData().allProducts()) { if (p.fullDisplayName() == m_parser.products().constFirst()) return p; } QBS_CHECK(false); } QBS_CHECK(m_parser.products().isEmpty()); QList runnableProducts; for (const ProductData &p : m_projects.front().projectData().allProducts()) { if (p.isRunnable()) runnableProducts.push_back(p); } if (runnableProducts.size() == 1) return runnableProducts.front(); if (runnableProducts.empty()) { throw ErrorInfo(Tr::tr("Cannot execute command '%1': Project has no runnable product.") .arg(m_parser.commandName())); } ErrorInfo error(Tr::tr("Ambiguous use of command '%1': No product given, but project " "has more than one runnable product.").arg(m_parser.commandName())); error.append(Tr::tr("Use the '--products' option with one of the following products:")); for (const ProductData &p : std::as_const(runnableProducts)) error.append(QLatin1String("\t") + p.fullDisplayName()); throw error; } void CommandLineFrontend::install() { Q_ASSERT(m_projects.size() == 1); const Project project = m_projects.front(); InstallJob *installJob; if (m_parser.products().empty()) { const Project::ProductSelection productSelection = m_parser.withNonDefaultProducts() ? Project::ProductSelectionWithNonDefault : Project::ProductSelectionDefaultOnly; installJob = project.installAllProducts(m_parser.installOptions(project.profile()), productSelection); } else { const Project project = m_projects.front(); const ProductMap products = productsToUse(); installJob = project.installSomeProducts(products.value(project), m_parser.installOptions(project.profile())); } connectJob(installJob); } } // namespace qbs qbs-src-3.2.0/src/app/qbs/sessionpacketreader.h0000644000175100017510000000471015154533055021047 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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_SESSIONPACKETREADER_H #define QBS_SESSIONPACKETREADER_H #include #include #include namespace qbs { namespace Internal { class SessionPacketReader : public QObject { Q_OBJECT public: explicit SessionPacketReader(QObject *parent = nullptr); ~SessionPacketReader() override; void start(); signals: void packetReceived(const QJsonObject &packet); void errorOccurred(const QString &msg); private: class Private; const std::unique_ptr d; }; } // namespace Internal } // namespace qbs #endif // Include guard qbs-src-3.2.0/src/app/qbs/sessionpacket.cpp0000644000175100017510000001041115154533055020212 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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$ ** ****************************************************************************/ #include "sessionpacket.h" #include #include #include #include #include #include #include namespace qbs { namespace Internal { const QByteArray packetStart = "qbsmsg:"; SessionPacket::Status SessionPacket::parseInput(QByteArray &input) { //qDebug() << m_expectedPayloadLength << m_payload << input; if (m_expectedPayloadLength == -1) { const int packetStartOffset = input.indexOf(packetStart); if (packetStartOffset == -1) return Status::Incomplete; const int numberOffset = packetStartOffset + packetStart.length(); const int newLineOffset = input.indexOf('\n', numberOffset); if (newLineOffset == -1) return Status::Incomplete; const QByteArray sizeString = input.mid(numberOffset, newLineOffset - numberOffset); bool isNumber; const int payloadLen = sizeString.toInt(&isNumber); if (!isNumber || payloadLen < 0) return Status::Invalid; m_expectedPayloadLength = payloadLen; input.remove(0, newLineOffset + 1); } const int bytesToAdd = m_expectedPayloadLength - m_payload.length(); QBS_ASSERT(bytesToAdd >= 0, return Status::Invalid); m_payload += input.left(bytesToAdd); input.remove(0, bytesToAdd); return isComplete() ? Status::Complete : Status::Incomplete; } QJsonObject SessionPacket::retrievePacket() { QBS_ASSERT(isComplete(), return QJsonObject()); auto packet = QJsonDocument::fromJson(QByteArray::fromBase64(m_payload)).object(); m_payload.clear(); m_expectedPayloadLength = -1; return packet; } QByteArray SessionPacket::createPacket(const QJsonObject &packet) { const QByteArray jsonData = QJsonDocument(packet).toJson(QJsonDocument::Compact).toBase64(); return QByteArray(packetStart).append(QByteArray::number(jsonData.length())).append('\n') .append(jsonData); } QJsonObject SessionPacket::helloMessage(const QString &lspSocket) { return QJsonObject{ {StringConstants::type(), QLatin1String("hello")}, {QLatin1String("api-level"), 9}, {QLatin1String("api-compat-level"), 2}, {QLatin1String("lsp-socket"), lspSocket}}; } bool SessionPacket::isComplete() const { return m_payload.length() == m_expectedPayloadLength; } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/app/qbs-setup-toolchains/0000755000175100017510000000000015154533055020135 5ustar runnerrunnerqbs-src-3.2.0/src/app/qbs-setup-toolchains/main.cpp0000644000175100017510000000571715154533055021577 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "commandlineparser.h" #include "probe.h" #include #include #include #include #include #include using qbs::Settings; static void printUsage(const QString &usageString) { std::cout << qPrintable(usageString) << std::endl; } int main(int argc, char **argv) { QCoreApplication app(argc, argv); CommandLineParser clParser; try { clParser.parse(app.arguments()); if (clParser.helpRequested()) { printUsage(clParser.usageString()); return EXIT_SUCCESS; } Settings settings(clParser.settingsDir()); settings.setScopeForWriting(clParser.settingsScope()); if (clParser.autoDetectionMode()) { probe(&settings); return EXIT_SUCCESS; } createProfile(clParser.profileName(), clParser.toolchainType(), clParser.compilerPath(), &settings); } catch (const qbs::ErrorInfo &e) { std::cerr << qPrintable(e.toString()) << std::endl; return EXIT_FAILURE; } } qbs-src-3.2.0/src/app/qbs-setup-toolchains/msvcprobe.cpp0000644000175100017510000002117715154533055022651 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "msvcprobe.h" #include "probe.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace qbs; using namespace qbs::Internal; using Internal::Tr; QT_BEGIN_NAMESPACE Q_DECLARE_TYPEINFO(WinSDK, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(MSVC, Q_MOVABLE_TYPE); QT_END_NAMESPACE // Not necessary but helps setup-qt automatically associate base profiles static void setQtHelperProperties(Profile &p, const MSVC *msvc) { QString targetArch = msvc->architecture.split(QLatin1Char('_')).last(); if (targetArch.isEmpty()) targetArch = QStringLiteral("x86"); if (targetArch == QStringLiteral("arm")) targetArch = QStringLiteral("armv7"); p.setValue(QStringLiteral("qbs.architecture"), canonicalArchitecture(targetArch)); } static void addMSVCPlatform(Settings *settings, std::vector &profiles, QString name, MSVC *msvc) { qbsInfo() << Tr::tr("Setting up profile '%1'.").arg(name); Profile p(std::move(name), settings); p.removeProfile(); p.setValue(QStringLiteral("qbs.targetPlatform"), QStringLiteral("windows")); p.setValue(QStringLiteral("qbs.toolchainType"), QStringLiteral("msvc")); p.setValue(QStringLiteral("cpp.toolchainInstallPath"), msvc->binPath); setQtHelperProperties(p, msvc); profiles.push_back(p); } static QString wow6432Key() { #ifdef Q_OS_WIN64 return QStringLiteral("\\Wow6432Node"); #else return {}; #endif } void msvcProbe(Settings *settings, std::vector &profiles) { qbsInfo() << Tr::tr("Detecting MSVC toolchains..."); // 1) Installed SDKs preferred over standalone Visual studio std::vector winSDKs; WinSDK defaultWinSDK; const QSettings sdkRegistry(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE") + wow6432Key() + QLatin1String("\\Microsoft\\Microsoft SDKs\\Windows"), QSettings::NativeFormat); const QString defaultSdkPath = sdkRegistry.value(QStringLiteral("CurrentInstallFolder")).toString(); if (!defaultSdkPath.isEmpty()) { const auto sdkKeys = sdkRegistry.childGroups(); for (const QString &sdkKey : sdkKeys) { WinSDK sdk; sdk.version = sdkKey; sdk.vcInstallPath = sdkRegistry.value(sdkKey + QLatin1String("/InstallationFolder")).toString(); sdk.isDefault = (sdk.vcInstallPath == defaultSdkPath); if (sdk.vcInstallPath.isEmpty()) continue; if (sdk.vcInstallPath.endsWith(QLatin1Char('\\'))) sdk.vcInstallPath.chop(1); if (sdk.isDefault) defaultWinSDK = sdk; const auto ais = MSVC::findSupportedArchitectures(sdk); qbs::Internal::transform(ais, winSDKs, [&sdk](const auto &ai) { WinSDK specificSDK = sdk; specificSDK.architecture = ai.arch; specificSDK.binPath = ai.binPath; return specificSDK; }); } } for (const WinSDK &sdk : std::as_const(winSDKs)) { qbsInfo() << Tr::tr(" Windows SDK %1 detected:\n" " installed in %2").arg(sdk.version, sdk.vcInstallPath); if (sdk.isDefault) qbsInfo() << Tr::tr(" This is the default SDK on this machine."); } // 2) Installed MSVCs std::vector msvcs = MSVC::installedCompilers(ConsoleLogger::instance()); for (const MSVC &msvc : std::as_const(msvcs)) { qbsInfo() << Tr::tr(" MSVC %1 (%2) detected in\n" " %3").arg(msvc.version, msvc.architecture, QDir::toNativeSeparators(msvc.binPath)); } if (winSDKs.empty() && msvcs.empty()) { qbsInfo() << Tr::tr("Could not detect an installation of " "the Windows SDK or Visual Studio."); return; } qbsInfo() << Tr::tr("Detecting build environment..."); std::vector msvcPtrs; msvcPtrs.reserve(winSDKs.size() + msvcs.size()); std::transform(winSDKs.begin(), winSDKs.end(), std::back_inserter(msvcPtrs), [] (WinSDK &sdk) -> MSVC * { return &sdk; }); std::transform(msvcs.begin(), msvcs.end(), std::back_inserter(msvcPtrs), [] (MSVC &msvc) -> MSVC * { return &msvc; }); for (WinSDK &sdk : winSDKs) { const QString name = QLatin1String("WinSDK") + sdk.version + QLatin1Char('-') + sdk.architecture; try { addMSVCPlatform(settings, profiles, name, &sdk); } catch (const ErrorInfo &error) { qbsWarning() << Tr::tr("Failed to set up %1: %2").arg(name, error.toString()); } } // we want the same MSVC version share the same suffix in profiles, thus use // a set to know the number of versions processed so far std::map> msvcCounters; for (MSVC &msvc : msvcs) { // each VS needs its own counter auto &msvcVersions = msvcCounters[msvc.version]; // vcInstallPath is "Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.16.27023/bin" // Since msvcs are sorted by version, when the new vcInstallPath is inserted, we start // a new group of compilers of the same version incrementing the set size msvcVersions.insert(msvc.vcInstallPath); // index is the number of specific vcInstallPaths (e.g. compiler versions) seen so far const size_t index = msvcVersions.size() - 1; const QString suffix = index == 0 ? QString() : QStringLiteral("-%1").arg(index); const QString name = QLatin1String("MSVC") + msvc.version + suffix + QLatin1Char('-') + msvc.architecture; try { addMSVCPlatform(settings, profiles, name, &msvc); } catch (const ErrorInfo &error) { qbsWarning() << Tr::tr("Failed to set up %1: %2").arg(name, error.toString()); } } } void createMsvcProfile(const QFileInfo &compiler, Settings *settings, const QString &profileName) { const auto compilerFilePath = compiler.absoluteFilePath(); MSVC msvc(compilerFilePath, MSVC::architectureFromClPath(compilerFilePath)); msvc.init(); std::vector dummy; addMSVCPlatform(settings, dummy, profileName, &msvc); qbsInfo() << Tr::tr("Profile '%1' created for '%2'.") .arg(profileName, QDir::toNativeSeparators(compilerFilePath)); } qbs-src-3.2.0/src/app/qbs-setup-toolchains/iarewprobe.cpp0000644000175100017510000003347515154533055023014 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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$ ** ****************************************************************************/ #include "probe.h" #include "iarewprobe.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include using namespace qbs; using Internal::Tr; using Internal::HostOsInfo; static QStringList knownIarCompilerNames() { return {QStringLiteral("icc8051"), QStringLiteral("iccarm"), QStringLiteral("iccavr"), QStringLiteral("iccstm8"), QStringLiteral("icc430"), QStringLiteral("iccrl78"), QStringLiteral("iccrx"), QStringLiteral("iccrh850"), QStringLiteral("iccv850"), QStringLiteral("icc78k"), QStringLiteral("iccavr32"), QStringLiteral("iccsh"), QStringLiteral("iccriscv"), QStringLiteral("icccf"), QStringLiteral("iccm32c"), QStringLiteral("iccr32c"), QStringLiteral("iccm16c"), QStringLiteral("icccr16c"), QStringLiteral("icchcs12"), QStringLiteral("iccs08")}; } static QString guessIarArchitecture(const QFileInfo &compiler) { const auto baseName = compiler.baseName(); if (baseName == QLatin1String("icc8051")) return QStringLiteral("mcs51"); if (baseName == QLatin1String("iccarm")) return QStringLiteral("arm"); if (baseName == QLatin1String("iccavr")) return QStringLiteral("avr"); if (baseName == QLatin1String("iccstm8")) return QStringLiteral("stm8"); if (baseName == QLatin1String("icc430")) return QStringLiteral("msp430"); if (baseName == QLatin1String("iccrl78")) return QStringLiteral("rl78"); if (baseName == QLatin1String("iccrx")) return QStringLiteral("rx"); if (baseName == QLatin1String("iccrh850")) return QStringLiteral("rh850"); if (baseName == QLatin1String("iccv850")) return QStringLiteral("v850"); if (baseName == QLatin1String("icc78k")) return QStringLiteral("78k"); if (baseName == QLatin1String("iccavr32")) return QStringLiteral("avr32"); if (baseName == QLatin1String("iccsh")) return QStringLiteral("sh"); if (baseName == QLatin1String("iccriscv")) return QStringLiteral("riscv"); if (baseName == QLatin1String("icccf")) return QStringLiteral("m68k"); if (baseName == QLatin1String("iccm32c")) return QStringLiteral("m32c"); if (baseName == QLatin1String("iccr32c")) return QStringLiteral("r32c"); if (baseName == QLatin1String("iccm16c")) return QStringLiteral("m16c"); if (baseName == QLatin1String("icccr16c")) return QStringLiteral("cr16"); if (baseName == QLatin1String("icchcs12")) return QStringLiteral("hcs12"); if (baseName == QLatin1String("iccs08")) return QStringLiteral("hcs8"); return {}; } static Profile createIarProfileHelper(const ToolchainInstallInfo &info, Settings *settings, QString profileName = QString()) { const QFileInfo compiler = info.compilerPath; const QString architecture = guessIarArchitecture(compiler); // In case the profile is auto-detected. if (profileName.isEmpty()) { if (!info.compilerVersion.isValid()) { profileName = QStringLiteral("iar-unknown-%1").arg(architecture); } else { const QString version = info.compilerVersion.toString(QLatin1Char('_'), QLatin1Char('_')); profileName = QStringLiteral("iar-%1-%2").arg( version, architecture); } } Profile profile(profileName, settings); profile.setValue(QLatin1String("cpp.toolchainInstallPath"), compiler.absolutePath()); profile.setValue(QLatin1String("qbs.toolchainType"), QLatin1String("iar")); if (!architecture.isEmpty()) profile.setValue(QLatin1String("qbs.architecture"), architecture); qbsInfo() << Tr::tr("Profile '%1' created for '%2'.").arg( profile.name(), compiler.absoluteFilePath()); return profile; } static Version dumpIarCompilerVersion(const QFileInfo &compiler) { const QString outFilePath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + QLatin1String("/macros.dump"); const QStringList args = {QStringLiteral("."), QStringLiteral("--predef_macros"), outFilePath}; QProcess p; p.start(compiler.absoluteFilePath(), args); p.waitForFinished(3000); const auto es = p.exitStatus(); if (es != QProcess::NormalExit) { const QByteArray out = p.readAll(); qbsWarning() << Tr::tr("Compiler dumping failed:\n%1") .arg(QString::fromUtf8(out)); return Version{}; } QByteArray dump; QFile out(outFilePath); if (out.open(QIODevice::ReadOnly)) dump = out.readAll(); out.remove(); const int verCode = extractVersion(dump, "__VER__ "); if (verCode < 0) { qbsWarning() << Tr::tr("No '__VER__' token was found in a compiler dump:\n%1") .arg(QString::fromUtf8(dump)); return Version{}; } const QString arch = guessIarArchitecture(compiler); if (arch == QLatin1String("arm")) return Version{verCode / 1000000, (verCode / 1000) % 1000, verCode % 1000}; if (arch == QLatin1String("avr") || arch == QLatin1String("mcs51") || arch == QLatin1String("stm8") || arch == QLatin1String("msp430") || arch == QLatin1String("rl78") || arch == QLatin1String("rx") || arch == QLatin1String("rh850") || arch == QLatin1String("v850") || arch == QLatin1String("78k") || arch == QLatin1String("avr32") || arch == QLatin1String("sh") || arch == QLatin1String("riscv") || arch == QLatin1String("m68k") || arch == QLatin1String("m32c") || arch == QLatin1String("r32c") || arch == QLatin1String("m16c") || arch == QLatin1String("rc16") || arch == QLatin1String("hcs12") || arch == QLatin1String("hcs8")) { return Version{verCode / 100, verCode % 100}; } return Version{}; } static std::vector installedIarsFromPath() { std::vector infos; const auto compilerNames = knownIarCompilerNames(); for (const QString &compilerName : compilerNames) { const QFileInfo iarPath( findExecutable( HostOsInfo::appendExecutableSuffix(compilerName))); if (!iarPath.exists()) continue; const Version version = dumpIarCompilerVersion(iarPath); infos.push_back({iarPath, version}); } std::sort(infos.begin(), infos.end()); return infos; } static std::vector installedIarsFromRegistry() { std::vector infos; if (HostOsInfo::isWindowsHost()) { #ifdef Q_OS_WIN64 static const char kRegistryNode[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\IAR Systems\\Embedded Workbench"; #else static const char kRegistryNode[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\IAR Systems\\Embedded Workbench"; #endif // Dictionary for know toolchains. static const struct Entry { QString registryKey; QString subExePath; } knowToolchains[] = { {QStringLiteral("EWARM"), QStringLiteral("/arm/bin/iccarm.exe")}, {QStringLiteral("EWAVR"), QStringLiteral("/avr/bin/iccavr.exe")}, {QStringLiteral("EW8051"), QStringLiteral("/8051/bin/icc8051.exe")}, {QStringLiteral("EWSTM8"), QStringLiteral("/stm8/bin/iccstm8.exe")}, {QStringLiteral("EW430"), QStringLiteral("/430/bin/icc430.exe")}, {QStringLiteral("EWRL78"), QStringLiteral("/rl78/bin/iccrl78.exe")}, {QStringLiteral("EWRX"), QStringLiteral("/rx/bin/iccrx.exe")}, {QStringLiteral("EWRH850"), QStringLiteral("/rh850/bin/iccrh850.exe")}, {QStringLiteral("EWV850"), QStringLiteral("/v850/bin/iccv850.exe")}, {QStringLiteral("EW78K"), QStringLiteral("/78k/bin/icc78k.exe")}, {QStringLiteral("EWAVR32"), QStringLiteral("/avr32/bin/iccavr32.exe")}, {QStringLiteral("EWSH"), QStringLiteral("/sh/bin/iccsh.exe")}, {QStringLiteral("EWRISCV"), QStringLiteral("/riscv/bin/iccriscv.exe")}, {QStringLiteral("EWCF"), QStringLiteral("/cf/bin/icccf.exe")}, {QStringLiteral("EWM32C"), QStringLiteral("/m32c/bin/iccm32c.exe")}, {QStringLiteral("EWR32C"), QStringLiteral("/r32c/bin/iccr32c.exe")}, {QStringLiteral("EWM16C"), QStringLiteral("/m16c/bin/iccm16c.exe")}, {QStringLiteral("EWCR16C"), QStringLiteral("/cr16c/bin/icccr16c.exe")}, {QStringLiteral("EWHCS12"), QStringLiteral("/hcs12/bin/icchcs12.exe")}, {QStringLiteral("EWS08"), QStringLiteral("/s08/bin/iccs08.exe")}, }; QSettings registry(QLatin1String(kRegistryNode), QSettings::NativeFormat); const auto oneLevelGroups = registry.childGroups(); for (const QString &oneLevelKey : oneLevelGroups) { registry.beginGroup(oneLevelKey); const auto twoLevelGroups = registry.childGroups(); for (const Entry &entry : knowToolchains) { if (twoLevelGroups.contains(entry.registryKey)) { registry.beginGroup(entry.registryKey); const auto threeLevelGroups = registry.childGroups(); for (const QString &threeLevelKey : threeLevelGroups) { registry.beginGroup(threeLevelKey); const QString rootPath = registry.value( QStringLiteral("InstallPath")).toString(); if (!rootPath.isEmpty()) { // Build full compiler path. const QFileInfo iarPath(rootPath + entry.subExePath); if (iarPath.exists()) { // Note: threeLevelKey is a guessed toolchain version. infos.push_back({iarPath, Version::fromString(threeLevelKey, true)}); } } registry.endGroup(); } registry.endGroup(); } } registry.endGroup(); } } std::sort(infos.begin(), infos.end()); return infos; } bool isIarCompiler(const QString &compilerName) { return Internal::any_of(knownIarCompilerNames(), [compilerName]( const QString &knownName) { return compilerName.contains(knownName); }); } void createIarProfile(const QFileInfo &compiler, Settings *settings, QString profileName) { const ToolchainInstallInfo info = {compiler, Version{}}; createIarProfileHelper(info, settings, std::move(profileName)); } void iarProbe(Settings *settings, std::vector &profiles) { qbsInfo() << Tr::tr("Trying to detect IAR toolchains..."); // Make sure that a returned infos are sorted before using the std::set_union! const std::vector regInfos = installedIarsFromRegistry(); const std::vector pathInfos = installedIarsFromPath(); std::vector allInfos; allInfos.reserve(regInfos.size() + pathInfos.size()); std::set_union(regInfos.cbegin(), regInfos.cend(), pathInfos.cbegin(), pathInfos.cend(), std::back_inserter(allInfos)); qbs::Internal::transform(allInfos, profiles, [settings](const auto &info) { return createIarProfileHelper(info, settings); }); if (allInfos.empty()) qbsInfo() << Tr::tr("No IAR toolchains found."); } qbs-src-3.2.0/src/app/qbs-setup-toolchains/keilprobe.h0000644000175100017510000000453515154533055022271 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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_SETUPTOOLCHAINS_KEILPROBE_H #define QBS_SETUPTOOLCHAINS_KEILPROBE_H #include QT_BEGIN_NAMESPACE class QFileInfo; QT_END_NAMESPACE namespace qbs { class Profile; class Settings; } bool isKeilCompiler(const QString &compilerName); void createKeilProfile(const QFileInfo &compiler, qbs::Settings *settings, QString profileName); void keilProbe(qbs::Settings *settings, std::vector &profiles); #endif // Header guard qbs-src-3.2.0/src/app/qbs-setup-toolchains/xcodeprobe.h0000644000175100017510000000415015154533055022440 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SETUPTOOLCHAINS_XCODEPROBE_H #define QBS_SETUPTOOLCHAINS_XCODEPROBE_H #include namespace qbs { class Profile; class Settings; } void xcodeProbe(qbs::Settings *settings, std::vector &profiles); #endif // Header guard qbs-src-3.2.0/src/app/qbs-setup-toolchains/clangclprobe.h0000644000175100017510000000450415154533055022744 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://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_SETUPTOOLCHAINS_CLANGCLPROBE_H #define QBS_SETUPTOOLCHAINS_CLANGCLPROBE_H #include #include QT_BEGIN_NAMESPACE class QFileInfo; QT_END_NAMESPACE namespace qbs { class Profile; class Settings; } void createClangClProfile(const QFileInfo &compiler, qbs::Settings *settings, const QString &profileName); void clangClProbe(qbs::Settings *settings, std::vector &profiles); #endif // Header guard qbs-src-3.2.0/src/app/qbs-setup-toolchains/dmcprobe.cpp0000644000175100017510000002462715154533055022447 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** 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$ ** ****************************************************************************/ #include "probe.h" #include "dmcprobe.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include #include #include #include using namespace qbs; using Internal::Tr; using Internal::HostOsInfo; namespace { struct Target { QString platform; QString architecture; QString extender; }; } static QStringList knownDmcCompilerNames() { return {QStringLiteral("dmc")}; } static QStringList dumpOutput(const QFileInfo &compiler, const QStringList &flags, const QStringList &keys) { const QString filePath = QDir(QDir::tempPath()).absoluteFilePath( QLatin1String("dmc-dump.c")); QFile fakeIn(filePath); if (!fakeIn.open(QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Text)) { qbsWarning() << Tr::tr("Unable to open temporary file %1 for output: %2") .arg(fakeIn.fileName(), fakeIn.errorString()); return {}; } fakeIn.write("#define VALUE_TO_STRING(x) #x\n"); fakeIn.write("#define VALUE(x) VALUE_TO_STRING(x)\n"); fakeIn.write("#define VAR_NAME_VALUE(var) \"#define \" #var\" \"VALUE(var)\n"); for (const auto &key : keys) { const auto content = key.toLatin1(); fakeIn.write("#if defined(" + content + ")\n"); fakeIn.write("#pragma message (VAR_NAME_VALUE(" + content + "))\n"); fakeIn.write("#endif\n"); } fakeIn.close(); QStringList args = {QStringLiteral("-e")}; args.reserve(args.size() + int(flags.size())); std::copy(flags.cbegin(), flags.cend(), std::back_inserter(args)); args.push_back(QDir::toNativeSeparators(filePath)); QProcess p; p.start(compiler.absoluteFilePath(), args); p.waitForFinished(3000); fakeIn.remove(); static QRegularExpression re(QLatin1String("\\r?\\n")); return QString::fromUtf8(p.readAllStandardOutput()).split(re); } static std::optional dumpDmcTarget(const QFileInfo &compiler, const QStringList &flags) { const QStringList keys = { QStringLiteral("DOS16RM"), QStringLiteral("DOS386"), QStringLiteral("MSDOS"), QStringLiteral("__NT__"), QStringLiteral("_WINDOWS"), }; const auto macros = dumpMacros([&compiler, &flags, &keys]() { return dumpOutput(compiler, flags, keys); }); if (macros.contains(QLatin1String("__NT__"))) { return Target{QLatin1String("windows"), QLatin1String("x86"), QLatin1String("")}; } else if (macros.contains(QLatin1String("_WINDOWS"))) { return Target{QLatin1String("windows"), QLatin1String("x86_16"), QLatin1String("")}; } else if (macros.contains(QLatin1String("DOS386"))) { if (flags.contains(QLatin1String("-mx"))) return Target{QLatin1String("dos"), QLatin1String("x86"), QLatin1String("dosx")}; else if (flags.contains(QLatin1String("-mp"))) return Target{QLatin1String("dos"), QLatin1String("x86"), QLatin1String("dosp")}; } else if (macros.contains(QLatin1String("DOS16RM"))) { if (flags.contains(QLatin1String("-mz"))) return Target{QLatin1String("dos"), QLatin1String("x86_16"), QLatin1String("dosz")}; else if (flags.contains(QLatin1String("-mr"))) return Target{QLatin1String("dos"), QLatin1String("x86_16"), QLatin1String("dosr")}; } else if (macros.contains(QLatin1String("MSDOS"))) { return Target{QLatin1String("dos"), QLatin1String("x86_16"), QLatin1String("")}; } return {}; } static std::vector createDmcProfileHelper(const ToolchainInstallInfo &info, Settings *settings, QStringView profileName = {}) { const QFileInfo compiler = info.compilerPath; std::vector profiles; const QVector probes = { { QStringLiteral("-mn"), QStringLiteral("-WA") }, // Windows NT 32 bit. { QStringLiteral("-ml"), QStringLiteral("-WA") }, // Windows 3.x 16 bit. { QStringLiteral("-mx") }, // DOS with DOSX extender 32 bit. { QStringLiteral("-mp") }, // DOS with Phar Lap extender 32 bit. { QStringLiteral("-mr") }, // DOS with Rational DOS Extender 16 bit. { QStringLiteral("-mz") }, // DOS with ZPM DOS Extender 16 bit. { QStringLiteral("-mc") }, // DOS 16 bit. }; for (const auto &flags : probes) { const auto target = dumpDmcTarget(compiler, flags); if (!target) continue; QString fullProfilename; QString platform = target->extender.isEmpty() ? target->platform : target->extender; if (profileName.isEmpty()) { // Create a full profile name in case we is in auto-detecting mode. if (!info.compilerVersion.isValid()) { fullProfilename = QStringLiteral("dmc-unknown-%1-%2") .arg(platform, target->architecture); } else { const QString version = info.compilerVersion.toString(QLatin1Char('_'), QLatin1Char('_')); fullProfilename = QStringLiteral("dmc-%1-%2-%3") .arg(version, platform, target->architecture); } } else { // Append the detected actual architecture name to the proposed profile name. fullProfilename = QStringLiteral("%1-%2-%3") .arg(profileName, platform, target->architecture); } Profile profile(fullProfilename, settings); profile.setValue(QStringLiteral("cpp.toolchainInstallPath"), compiler.absolutePath()); profile.setValue(QStringLiteral("qbs.toolchainType"), QStringLiteral("dmc")); profile.setValue(QStringLiteral("qbs.architecture"), target->architecture); profile.setValue(QStringLiteral("qbs.targetPlatform"), target->platform); if (!target->extender.isEmpty()) profile.setValue(QStringLiteral("cpp.extenderName"), target->extender); qbsInfo() << Tr::tr("Profile '%1' created for '%2'.") .arg(profile.name(), compiler.absoluteFilePath()); profiles.push_back(std::move(profile)); } return profiles; } static Version dumpDmcVersion(const QFileInfo &compiler) { const QStringList keys = {QStringLiteral("__DMC__")}; const auto macros = dumpMacros([&compiler, keys]() { return dumpOutput(compiler, {}, keys); }); for (const auto ¯o : macros) { if (!macro.startsWith(QLatin1String("0x"))) continue; const int verCode = macro.mid(2).toInt(); return Version{(verCode / 100), (verCode % 100), 0}; } qbsWarning() << Tr::tr("No __DMC__ token was found in the compiler dump"); return Version{}; } static std::vector installedDmcsFromPath() { std::vector infos; const auto compilerNames = knownDmcCompilerNames(); for (const QString &compilerName : compilerNames) { const QFileInfo dmcPath( findExecutable( HostOsInfo::appendExecutableSuffix(compilerName))); if (!dmcPath.exists()) continue; const Version version = dumpDmcVersion(dmcPath); infos.push_back({dmcPath, version}); } std::sort(infos.begin(), infos.end()); return infos; } bool isDmcCompiler(const QString &compilerName) { return Internal::any_of(knownDmcCompilerNames(), [compilerName](const QString &knownName) { return compilerName.contains(knownName); }); } void createDmcProfile(const QFileInfo &compiler, Settings *settings, QStringView profileName) { const ToolchainInstallInfo info = {compiler, Version{}}; createDmcProfileHelper(info, settings, profileName); } void dmcProbe(Settings *settings, std::vector &profiles) { qbsInfo() << Tr::tr("Trying to detect DMC toolchains..."); const std::vector allInfos = installedDmcsFromPath(); if (allInfos.empty()) { qbsInfo() << Tr::tr("No DMC toolchains found."); return; } for (const ToolchainInstallInfo &info : allInfos) { const auto newProfiles = createDmcProfileHelper(info, settings); profiles.reserve(profiles.size() + int(newProfiles.size())); std::copy(newProfiles.cbegin(), newProfiles.cend(), std::back_inserter(profiles)); } } qbs-src-3.2.0/src/app/qbs-setup-toolchains/msvcprobe.h0000644000175100017510000000445615154533055022317 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SETUPTOOLCHAINS_MSVCPROBE_H #define QBS_SETUPTOOLCHAINS_MSVCPROBE_H #include #include QT_BEGIN_NAMESPACE class QFileInfo; QT_END_NAMESPACE namespace qbs { class Profile; class Settings; } void createMsvcProfile(const QFileInfo &compiler, qbs::Settings *settings, const QString &profileName); void msvcProbe(qbs::Settings *settings, std::vector &profiles); #endif // Header guard qbs-src-3.2.0/src/app/qbs-setup-toolchains/qbs-setup-toolchains.rc0000644000175100017510000000023015154533055024542 0ustar runnerrunner#define RT_MANIFEST 24 #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "qbs-setup-toolchains.exe.manifest" qbs-src-3.2.0/src/app/qbs-setup-toolchains/clangclprobe.cpp0000644000175100017510000001224115154533055023274 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com) ** Contact: http://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$ ** ****************************************************************************/ #include "clangclprobe.h" #include "msvcprobe.h" #include "probe.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include #include #include #include using qbs::Settings; using qbs::Profile; using qbs::Internal::ClangClInfo; using qbs::Internal::HostOsInfo; using qbs::Internal::Tr; namespace { Profile createProfileHelper( Settings *settings, const QString &profileName, const QString &toolchainInstallPath, const QString &vcvarsallPath, const QString &architecture) { Profile profile(profileName, settings); profile.removeProfile(); profile.setValue(QStringLiteral("qbs.architecture"), architecture); profile.setValue(QStringLiteral("qbs.toolchainType"), QStringLiteral("clang-cl")); profile.setValue(QStringLiteral("cpp.toolchainInstallPath"), toolchainInstallPath); profile.setValue(QStringLiteral("cpp.vcvarsallPath"), vcvarsallPath); qbsInfo() << Tr::tr("Profile '%1' created for '%2'.") .arg(profile.name(), QDir::toNativeSeparators(toolchainInstallPath)); return profile; } QString findClangCl() { const auto compilerName = HostOsInfo::appendExecutableSuffix(QStringLiteral("clang-cl")); auto compilerFromPath = findExecutable(compilerName); if (!compilerFromPath.isEmpty()) return compilerFromPath; return {}; } } // namespace void createClangClProfile(const QFileInfo &compiler, Settings *settings, const QString &profileName) { const auto clangCl = ClangClInfo::fromCompilerFilePath( compiler.filePath(), ConsoleLogger::instance()); if (clangCl.isEmpty()) return; const auto hostArch = HostOsInfo::hostOSArchitecture(); createProfileHelper( settings, profileName, clangCl.toolchainInstallPath, clangCl.vcvarsallPath, hostArch); } /*! \brief Creates a clang-cl profile based on auto-detected vsversion. \internal */ void clangClProbe(Settings *settings, std::vector &profiles) { const auto compilerName = QStringLiteral("clang-cl"); qbsInfo() << Tr::tr("Trying to detect %1...").arg(compilerName); const auto clangCls = ClangClInfo::installedCompilers( {findClangCl()}, ConsoleLogger::instance()); if (clangCls.empty()) { qbsInfo() << Tr::tr("%1 was not found.").arg(compilerName); return; } const QString architectures[] = { QStringLiteral("x86_64"), QStringLiteral("x86") }; for (size_t index = 0; index < clangCls.size(); ++index) { const auto &clangCl = clangCls[index]; const QString suffix = index == 0 ? QString() : QStringLiteral("-%1").arg(index); qbs::Internal::transform( architectures, profiles, [settings, clangCl, suffix](const auto &arch) { const auto profileName = QStringLiteral("clang-cl%1-%2").arg(suffix, arch); return createProfileHelper( settings, profileName, clangCl.toolchainInstallPath, clangCl.vcvarsallPath, arch); }); } } qbs-src-3.2.0/src/app/qbs-setup-toolchains/watcomprobe.h0000644000175100017510000000455015154533055022634 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2022 Denis Shienkov ** 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_SETUPTOOLCHAINS_WATCOMPROBE_H #define QBS_SETUPTOOLCHAINS_WATCOMPROBE_H #include QT_BEGIN_NAMESPACE class QFileInfo; QT_END_NAMESPACE namespace qbs { class Profile; class Settings; } // namespace qbs bool isWatcomCompiler(const QString &compilerName); void createWatcomProfile( const QFileInfo &compiler, qbs::Settings *settings, QStringView profileName); void watcomProbe(qbs::Settings *settings, std::vector &profiles); #endif // Header guard qbs-src-3.2.0/src/app/qbs-setup-toolchains/CMakeLists.txt0000644000175100017510000000113715154533055022677 0ustar runnerrunnerset(SOURCES clangclprobe.cpp clangclprobe.h commandlineparser.cpp commandlineparser.h cosmicprobe.cpp cosmicprobe.h dmcprobe.cpp dmcprobe.h emscriptenprobe.cpp emscriptenprobe.h gccprobe.cpp gccprobe.h iarewprobe.cpp iarewprobe.h keilprobe.cpp keilprobe.h main.cpp msvcprobe.cpp msvcprobe.h probe.cpp probe.h sdccprobe.cpp sdccprobe.h watcomprobe.cpp watcomprobe.h xcodeprobe.cpp xcodeprobe.h ) add_qbs_app(qbs-setup-toolchains DEPENDS qbscore qbsconsolelogger SOURCES ${SOURCES} ) qbs-src-3.2.0/src/app/qbs-setup-toolchains/emscriptenprobe.cpp0000644000175100017510000000767315154533055024057 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 Danya Patrushev ** 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$ ** ****************************************************************************/ #include "emscriptenprobe.h" #include "../shared/logging/consolelogger.h" #include "probe.h" #include #include #include #include #include #include #include #include using namespace qbs; using Internal::HostOsInfo; using Internal::Tr; namespace { qbs::Profile writeProfile( const QString &profileName, const QFileInfo &compiler, qbs::Settings *settings) { qbs::Profile profile(profileName, settings); profile.setValue(QStringLiteral("qbs.architecture"), QStringLiteral("wasm")); profile.setValue(QStringLiteral("qbs.toolchainType"), QStringLiteral("emscripten")); profile.setValue(QStringLiteral("qbs.targetPlatform"), QStringLiteral("wasm-emscripten")); profile.setValue(QStringLiteral("cpp.toolchainInstallPath"), compiler.absolutePath()); return profile; } } //namespace bool isEmscriptenCompiler(const QString &compilerName) { return compilerName.startsWith(QLatin1String("emcc")) || compilerName.startsWith(QLatin1String("em++")); } qbs::Profile createEmscriptenProfile( const QFileInfo &compiler, qbs::Settings *settings, const QString &profileName) { qbs::Profile profile = writeProfile(profileName, compiler, settings); qbsInfo() << Tr::tr("Profile '%1' created for '%2'.") .arg(profile.name(), compiler.absoluteFilePath()); return profile; } void emscriptenProbe(qbs::Settings *settings, std::vector &profiles) { qbsInfo() << Tr::tr("Trying to detect emscripten toolchain..."); const QString emcc = HostOsInfo::isWindowsHost() ? QStringLiteral("emcc.bat") : QStringLiteral("emcc"); const QString compilerPath = findExecutable(emcc); if (compilerPath.isEmpty()) { qbsInfo() << Tr::tr("No emscripten toolchain found."); return; } const qbs::Profile profile = createEmscriptenProfile( QFileInfo(compilerPath), settings, QLatin1String("wasm")); profiles.push_back(profile); } qbs-src-3.2.0/src/app/qbs-setup-toolchains/cosmicprobe.cpp0000644000175100017510000001526315154533055023155 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** 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$ ** ****************************************************************************/ #include "probe.h" #include "cosmicprobe.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include using namespace qbs; using Internal::Tr; using Internal::HostOsInfo; static QStringList knownCosmicCompilerNames() { return {QStringLiteral("cxcorm"), QStringLiteral("cxstm8"), QStringLiteral("cx6808"), QStringLiteral("cx6812"), QStringLiteral("cx332")}; } static QString guessCosmicArchitecture(const QFileInfo &compiler) { const auto baseName = compiler.baseName(); if (baseName == QLatin1String("cxcorm")) return QStringLiteral("arm"); if (baseName == QLatin1String("cxstm8")) return QStringLiteral("stm8"); if (baseName == QLatin1String("cx6808")) return QStringLiteral("hcs8"); if (baseName == QLatin1String("cx6812")) return QStringLiteral("hcs12"); if (baseName == QLatin1String("cx332")) return QStringLiteral("m68k"); return {}; } static Profile createCosmicProfileHelper(const ToolchainInstallInfo &info, Settings *settings, QString profileName = QString()) { const QFileInfo compiler = info.compilerPath; const QString architecture = guessCosmicArchitecture(compiler); // In case the profile is auto-detected. if (profileName.isEmpty()) { if (!info.compilerVersion.isValid()) { profileName = QStringLiteral("cosmic-unknown-%1").arg(architecture); } else { const QString version = info.compilerVersion.toString(QLatin1Char('_'), QLatin1Char('_')); profileName = QStringLiteral("cosmic-%1-%2").arg( version, architecture); } } Profile profile(profileName, settings); profile.setValue(QLatin1String("cpp.toolchainInstallPath"), compiler.absolutePath()); profile.setValue(QLatin1String("qbs.toolchainType"), QLatin1String("cosmic")); if (!architecture.isEmpty()) profile.setValue(QLatin1String("qbs.architecture"), architecture); qbsInfo() << Tr::tr("Profile '%1' created for '%2'.").arg( profile.name(), compiler.absoluteFilePath()); return profile; } static Version dumpCosmicCompilerVersion(const QFileInfo &compiler) { QProcess p; QStringList args; p.start(compiler.absoluteFilePath(), args); p.waitForFinished(3000); const auto es = p.exitStatus(); if (es != QProcess::NormalExit) { const QByteArray out = p.readAll(); qbsWarning() << Tr::tr("Compiler dumping failed:\n%1") .arg(QString::fromUtf8(out)); return Version{}; } const QByteArray output = p.readAllStandardError(); const QRegularExpression re(QLatin1String("^COSMIC.+V(\\d+)\\.?(\\d+)\\.?(\\*|\\d+)?")); const QRegularExpressionMatch match = re.match(QString::fromLatin1(output)); if (!match.hasMatch()) return Version{}; const auto major = match.captured(1).toInt(); const auto minor = match.captured(2).toInt(); const auto patch = match.captured(3).toInt(); return Version{major, minor, patch}; } static std::vector installedCosmicsFromPath() { std::vector infos; const auto compilerNames = knownCosmicCompilerNames(); for (const QString &compilerName : compilerNames) { const QFileInfo cosmicPath( findExecutable( HostOsInfo::appendExecutableSuffix(compilerName))); if (!cosmicPath.exists()) continue; const Version version = dumpCosmicCompilerVersion(cosmicPath); infos.push_back({cosmicPath, version}); } std::sort(infos.begin(), infos.end()); return infos; } bool isCosmicCompiler(const QString &compilerName) { return Internal::any_of(knownCosmicCompilerNames(), [compilerName](const QString &knownName) { return compilerName.contains(knownName); }); } void createCosmicProfile(const QFileInfo &compiler, Settings *settings, QString profileName) { const ToolchainInstallInfo info = {compiler, Version{}}; createCosmicProfileHelper(info, settings, std::move(profileName)); } void cosmicProbe(Settings *settings, std::vector &profiles) { qbsInfo() << Tr::tr("Trying to detect COSMIC toolchains..."); const std::vector allInfos = installedCosmicsFromPath(); qbs::Internal::transform(allInfos, profiles, [settings](const auto &info) { return createCosmicProfileHelper(info, settings); }); if (allInfos.empty()) qbsInfo() << Tr::tr("No COSMIC toolchains found."); } qbs-src-3.2.0/src/app/qbs-setup-toolchains/keilprobe.cpp0000644000175100017510000004077515154533055022632 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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$ ** ****************************************************************************/ #include "probe.h" #include "keilprobe.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include using namespace qbs; using Internal::Tr; using Internal::HostOsInfo; static QStringList knownKeilCompilerNames() { return {QStringLiteral("c51"), QStringLiteral("c251"), QStringLiteral("c166"), QStringLiteral("armcc"), QStringLiteral("armclang")}; } static QString guessKeilArchitecture(const QFileInfo &compiler) { const auto baseName = compiler.baseName(); if (baseName == QLatin1String("c51")) return QStringLiteral("mcs51"); if (baseName == QLatin1String("c251")) return QStringLiteral("mcs251"); if (baseName == QLatin1String("c166")) return QStringLiteral("c166"); if (baseName == QLatin1String("armcc")) return QStringLiteral("arm"); if (baseName == QLatin1String("armclang")) return QStringLiteral("arm"); return {}; } static bool isArmClangCompiler(const QFileInfo &compiler) { return compiler.baseName() == QLatin1String("armclang"); } static Profile createKeilProfileHelper(const ToolchainInstallInfo &info, Settings *settings, QString profileName = QString()) { const QFileInfo compiler = info.compilerPath; const QString architecture = guessKeilArchitecture(compiler); // In case the profile is auto-detected. if (profileName.isEmpty()) { if (!info.compilerVersion.isValid()) { profileName = QStringLiteral("keil-unknown-%1").arg(architecture); } else { const QString version = info.compilerVersion.toString(QLatin1Char('_'), QLatin1Char('_')); if (architecture == QLatin1String("arm") && isArmClangCompiler(compiler)) { profileName = QStringLiteral("keil-llvm-%1-%2").arg( version, architecture); } else { profileName = QStringLiteral("keil-%1-%2").arg( version, architecture); } } } Profile profile(profileName, settings); profile.setValue(QStringLiteral("cpp.toolchainInstallPath"), compiler.absolutePath()); profile.setValue(QStringLiteral("cpp.compilerName"), compiler.fileName()); profile.setValue(QStringLiteral("qbs.toolchainType"), QStringLiteral("keil")); if (!architecture.isEmpty()) profile.setValue(QStringLiteral("qbs.architecture"), architecture); qbsInfo() << Tr::tr("Profile '%1' created for '%2'.").arg( profile.name(), compiler.absoluteFilePath()); return profile; } static Version dumpMcsCompilerVersion(const QFileInfo &compiler) { QTemporaryFile fakeIn; if (!fakeIn.open()) { qbsWarning() << Tr::tr("Unable to open temporary file %1 for output: %2") .arg(fakeIn.fileName(), fakeIn.errorString()); return Version{}; } fakeIn.write("#define VALUE_TO_STRING(x) #x\n"); fakeIn.write("#define VALUE(x) VALUE_TO_STRING(x)\n"); // Prepare for C51 compiler. fakeIn.write("#if defined(__C51__) || defined(__CX51__)\n"); fakeIn.write("# define VAR_NAME_VALUE(var) \"(\"\"\"\"|\"#var\"|\"VALUE(var)\"|\"\"\"\")\"\n"); fakeIn.write("# if defined (__C51__)\n"); fakeIn.write("# pragma message (VAR_NAME_VALUE(__C51__))\n"); fakeIn.write("# endif\n"); fakeIn.write("# if defined(__CX51__)\n"); fakeIn.write("# pragma message (VAR_NAME_VALUE(__CX51__))\n"); fakeIn.write("# endif\n"); fakeIn.write("#endif\n"); // Prepare for C251 compiler. fakeIn.write("#if defined(__C251__)\n"); fakeIn.write("# define VAR_NAME_VALUE(var) \"\"|#var|VALUE(var)|\"\"\n"); fakeIn.write("# if defined(__C251__)\n"); fakeIn.write("# warning (VAR_NAME_VALUE(__C251__))\n"); fakeIn.write("# endif\n"); fakeIn.write("#endif\n"); fakeIn.close(); const QStringList args = {fakeIn.fileName()}; QProcess p; p.start(compiler.absoluteFilePath(), args); p.waitForFinished(3000); const QStringList knownKeys = {QStringLiteral("__C51__"), QStringLiteral("__CX51__"), QStringLiteral("__C251__")}; auto extractVersion = [&knownKeys](const QByteArray &output) { QTextStream stream(output); QString line; while (stream.readLineInto(&line)) { if (!line.startsWith(QLatin1String("***"))) continue; enum { KEY_INDEX = 1, VALUE_INDEX = 2, ALL_PARTS = 4 }; const QStringList parts = line.split(QLatin1String("\"|\"")); if (parts.count() != ALL_PARTS) continue; if (!knownKeys.contains(parts.at(KEY_INDEX))) continue; return parts.at(VALUE_INDEX).toInt(); } return -1; }; const QByteArray dump = p.readAllStandardOutput(); const int verCode = extractVersion(dump); if (verCode < 0) { qbsWarning() << Tr::tr("No %1 tokens was found" " in the compiler dump:\n%2") .arg(knownKeys.join(QLatin1Char(',')), QString::fromUtf8(dump)); return Version{}; } return Version{verCode / 100, verCode % 100}; } static Version dumpC166CompilerVersion(const QFileInfo &compiler) { QTemporaryFile fakeIn; if (!fakeIn.open()) { qbsWarning() << Tr::tr("Unable to open temporary file %1 for output: %2") .arg(fakeIn.fileName(), fakeIn.errorString()); return Version{}; } fakeIn.write("#if defined(__C166__)\n"); fakeIn.write("# warning __C166__\n"); fakeIn.write("# pragma __C166__\n"); fakeIn.write("#endif\n"); fakeIn.close(); const QStringList args = {fakeIn.fileName()}; QProcess p; p.start(compiler.absoluteFilePath(), args); p.waitForFinished(3000); // Extract the compiler version pattern in the form, like: // // *** WARNING C320 IN LINE 41 OF c51.c: __C166__ // *** WARNING C2 IN LINE 42 OF c51.c: '757': unknown #pragma/control, line ignored // // where the '__C166__' is a key, and the '757' is a value (aka version). auto extractVersion = [](const QString &output) { const QStringList lines = output.split(QStringLiteral("\r\n")); for (auto it = lines.cbegin(); it != lines.cend();) { if (it->startsWith(QLatin1String("***")) && it->endsWith(QLatin1String("__C166__"))) { ++it; if (it == lines.cend() || !it->startsWith(QLatin1String("***"))) break; const int startIndex = it->indexOf(QLatin1Char('\'')); if (startIndex == -1) break; const int stopIndex = it->indexOf(QLatin1Char('\''), startIndex + 1); if (stopIndex == -1) break; const QString v = it->mid(startIndex + 1, stopIndex - startIndex - 1); return v.toInt(); } ++it; } return -1; }; const QByteArray dump = p.readAllStandardOutput(); const int verCode = extractVersion(QString::fromUtf8(dump)); if (verCode < 0) { qbsWarning() << Tr::tr("No __C166__ token was found" " in the compiler dump:\n%1") .arg(QString::fromUtf8(dump)); return Version{}; } return Version{verCode / 100, verCode % 100}; } static Version dumpArmCCCompilerVersion(const QFileInfo &compiler) { const QStringList args = {QStringLiteral("-E"), QStringLiteral("--list-macros"), QStringLiteral("nul")}; QProcess p; p.start(compiler.absoluteFilePath(), args); p.waitForFinished(3000); const auto es = p.exitStatus(); if (es != QProcess::NormalExit) { const QByteArray out = p.readAll(); qbsWarning() << Tr::tr("Compiler dumping failed:\n%1") .arg(QString::fromUtf8(out)); return Version{}; } const QByteArray dump = p.readAll(); const int verCode = extractVersion(dump, "__ARMCC_VERSION "); if (verCode < 0) { qbsWarning() << Tr::tr("No '__ARMCC_VERSION' token was found " "in the compiler dump:\n%1") .arg(QString::fromUtf8(dump)); return Version{}; } return Version{verCode / 1000000, (verCode / 10000) % 100, verCode % 10000}; } static Version dumpArmClangCompilerVersion(const QFileInfo &compiler) { const QStringList args = {QStringLiteral("-dM"), QStringLiteral("-E"), QStringLiteral("-xc"), QStringLiteral("--target=arm-arm-none-eabi"), QStringLiteral("-mcpu=cortex-m0"), QStringLiteral("nul")}; QProcess p; p.start(compiler.absoluteFilePath(), args); p.waitForFinished(3000); const auto es = p.exitStatus(); if (es != QProcess::NormalExit) { const QByteArray out = p.readAll(); qbsWarning() << Tr::tr("Compiler dumping failed:\n%1") .arg(QString::fromUtf8(out)); return Version{}; } const QByteArray dump = p.readAll(); const int verCode = extractVersion(dump, "__ARMCC_VERSION "); if (verCode < 0) { qbsWarning() << Tr::tr("No '__ARMCC_VERSION' token was found " "in the compiler dump:\n%1") .arg(QString::fromUtf8(dump)); return Version{}; } return Version{verCode / 1000000, (verCode / 10000) % 100, verCode % 10000}; } static Version dumpKeilCompilerVersion(const QFileInfo &compiler) { const QString arch = guessKeilArchitecture(compiler); if (arch == QLatin1String("mcs51") || arch == QLatin1String("mcs251")) return dumpMcsCompilerVersion(compiler); if (arch == QLatin1String("c166")) return dumpC166CompilerVersion(compiler); if (arch == QLatin1String("arm")) { if (isArmClangCompiler(compiler)) return dumpArmClangCompilerVersion(compiler); return dumpArmCCCompilerVersion(compiler); } return Version{}; } static std::vector installedKeilsFromPath() { std::vector infos; const auto compilerNames = knownKeilCompilerNames(); for (const QString &compilerName : compilerNames) { const QFileInfo keilPath( findExecutable( HostOsInfo::appendExecutableSuffix(compilerName))); if (!keilPath.exists()) continue; const Version version = dumpKeilCompilerVersion(keilPath); infos.push_back({keilPath, version}); } std::sort(infos.begin(), infos.end()); return infos; } static std::vector installedKeilsFromRegistry() { std::vector infos; if (HostOsInfo::isWindowsHost()) { #ifdef Q_OS_WIN64 static const char kRegistryNode[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Keil\\Products"; #else static const char kRegistryNode[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Keil\\Products"; #endif QSettings registry(QLatin1String(kRegistryNode), QSettings::NativeFormat); const auto productGroups = registry.childGroups(); for (const QString &productKey : productGroups) { registry.beginGroup(productKey); const QString productPath = registry.value(QStringLiteral("Path")) .toString(); QString productVersion = registry.value(QStringLiteral("Version")) .toString(); if (productVersion.startsWith(QLatin1Char('V'))) productVersion.remove(0, 1); if (productKey == QLatin1String("MDK")) { const QFileInfo ccPath(productPath + QStringLiteral("/ARMCC/bin/armcc.exe")); if (ccPath.exists()) infos.push_back({ccPath, Version::fromString(productVersion)}); const QFileInfo clangPath(productPath + QStringLiteral("/ARMCLANG/bin/armclang.exe")); if (clangPath.exists()) infos.push_back({clangPath, Version::fromString(productVersion)}); } if (productKey == QLatin1String("C51")) { const QFileInfo cPath(productPath + QStringLiteral("/BIN/c51.exe")); if (cPath.exists()) infos.push_back({cPath, Version::fromString(productVersion)}); } if (productKey == QLatin1String("C251")) { const QFileInfo cPath(productPath + QStringLiteral("/BIN/c251.exe")); if (cPath.exists()) infos.push_back({cPath, Version::fromString(productVersion)}); } if (productKey == QLatin1String("C166")) { const QFileInfo cPath(productPath + QStringLiteral("/BIN/c166.exe")); if (cPath.exists()) infos.push_back({cPath, Version::fromString(productVersion)}); } registry.endGroup(); } } std::sort(infos.begin(), infos.end()); return infos; } bool isKeilCompiler(const QString &compilerName) { return Internal::any_of(knownKeilCompilerNames(), [compilerName]( const QString &knownName) { return compilerName.contains(knownName); }); } void createKeilProfile(const QFileInfo &compiler, Settings *settings, QString profileName) { const ToolchainInstallInfo info = {compiler, Version{}}; createKeilProfileHelper(info, settings, std::move(profileName)); } void keilProbe(Settings *settings, std::vector &profiles) { qbsInfo() << Tr::tr("Trying to detect KEIL toolchains..."); // Make sure that a returned infos are sorted before using the std::set_union! const std::vector regInfos = installedKeilsFromRegistry(); const std::vector pathInfos = installedKeilsFromPath(); std::vector allInfos; allInfos.reserve(regInfos.size() + pathInfos.size()); std::set_union(regInfos.cbegin(), regInfos.cend(), pathInfos.cbegin(), pathInfos.cend(), std::back_inserter(allInfos)); qbs::Internal::transform(allInfos, profiles, [settings](const auto &info) { return createKeilProfileHelper(info, settings); }); if (allInfos.empty()) qbsInfo() << Tr::tr("No KEIL toolchains found."); } qbs-src-3.2.0/src/app/qbs-setup-toolchains/qbs-setup-toolchains.exe.manifest0000644000175100017510000000073615154533055026537 0ustar runnerrunner qbs-src-3.2.0/src/app/qbs-setup-toolchains/sdccprobe.h0000644000175100017510000000520115154533055022250 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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_SETUPTOOLCHAINS_SDCCPROBE_H #define QBS_SETUPTOOLCHAINS_SDCCPROBE_H #include #include QT_BEGIN_NAMESPACE class QFileInfo; QT_END_NAMESPACE namespace qbs { class Profile; class Settings; } struct SdccInstallInfo { QString compilerPath; QString version; }; inline bool operator==(const SdccInstallInfo &lhs, const SdccInstallInfo &rhs) { return std::tie(lhs.compilerPath, lhs.version) == std::tie(rhs.compilerPath, rhs.version); } bool isSdccCompiler(const QString &compilerName); void createSdccProfile(const QFileInfo &compiler, qbs::Settings *settings, const QString &profileName); void sdccProbe(qbs::Settings *settings, std::vector &profiles); #endif // Header guard qbs-src-3.2.0/src/app/qbs-setup-toolchains/probe.h0000644000175100017510000000746715154533055021433 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SETUPTOOLCHAINS_PROBE_H #define QBS_SETUPTOOLCHAINS_PROBE_H #include #include #include #include #include #include // for std::function #include // for std::tie namespace qbs { class Settings; } QStringList systemSearchPaths(); QString findExecutable(const QString &fileName); QString toolchainTypeFromCompilerName(const QString &compilerName); void createProfile( const QString &profileName, const QString &toolchainType, const QString &compilerFilePath, qbs::Settings *settings); void probe(qbs::Settings *settings); struct ToolchainInstallInfo { QFileInfo compilerPath; qbs::Version compilerVersion; }; inline bool operator==(const ToolchainInstallInfo &lhs, const ToolchainInstallInfo &rhs) { const auto lp = lhs.compilerPath.absoluteFilePath(); const auto rp = rhs.compilerPath.absoluteFilePath(); return std::tie(lp, lhs.compilerVersion) == std::tie(rp, rhs.compilerVersion); } inline bool operator<(const ToolchainInstallInfo &lhs, const ToolchainInstallInfo &rhs) { const auto lp = lhs.compilerPath.absoluteFilePath(); const auto rp = rhs.compilerPath.absoluteFilePath(); return std::tie(lp, lhs.compilerVersion) < std::tie(rp, rhs.compilerVersion); } int extractVersion(const QByteArray ¯oDump, const QByteArray &keyToken); bool isSameExecutable(const QString &exe1, const QString &exe2); using MacrosMap = QMap; MacrosMap dumpMacros(const std::function &func); namespace std { template<> struct hash { std::size_t operator()(const ToolchainInstallInfo &v) const noexcept { std::size_t seed = 0; qbs::Internal::hashCombineHelper(seed, v.compilerPath.absoluteFilePath()); qbs::Internal::hashCombineHelper(seed, v.compilerVersion); return seed; } }; } // namespace std #endif // Header guard qbs-src-3.2.0/src/app/qbs-setup-toolchains/probe.cpp0000644000175100017510000002763015154533055021760 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "probe.h" #include "clangclprobe.h" #include "cosmicprobe.h" #include "dmcprobe.h" #include "emscriptenprobe.h" #include "gccprobe.h" #include "iarewprobe.h" #include "keilprobe.h" #include "msvcprobe.h" #include "sdccprobe.h" #include "watcomprobe.h" #include "xcodeprobe.h" #include #include #include #include #include #include #include #include #include #include #include #ifdef Q_OS_WIN // We need defines for Windows 8. #undef _WIN32_WINNT #define _WIN32_WINNT _WIN32_WINNT_WIN8 #include #include #else #include #endif // Q_OS_WIN using namespace qbs; using Internal::HostOsInfo; using Internal::Tr; static QTextStream qStdout(stdout); static QTextStream qStderr(stderr); QStringList systemSearchPaths() { return QString::fromLocal8Bit(qgetenv("PATH")).split(HostOsInfo::pathListSeparator()); } QString findExecutable(const QString &fileName) { QStringList suffixList{QString()}; if (HostOsInfo::isWindowsHost()) { if (!fileName.endsWith(QLatin1String(".exe"), Qt::CaseInsensitive) && !fileName.endsWith(QLatin1String(".bat"), Qt::CaseInsensitive)) suffixList = QStringList{QStringLiteral(".exe"), QStringLiteral(".bat")}; } const auto ppaths = systemSearchPaths(); for (const QString &ppath : ppaths) { for (const auto &suffix : suffixList) { const QString fullPath = ppath + QLatin1Char('/') + fileName + suffix; if (QFileInfo::exists(fullPath)) return QDir::cleanPath(fullPath); } } return {}; } QString toolchainTypeFromCompilerName(const QString &compilerName) { if (compilerName == QLatin1String("cl.exe")) return QStringLiteral("msvc"); if (compilerName == QLatin1String("clang-cl.exe")) return QStringLiteral("clang-cl"); const auto types = { QStringLiteral("clang"), QStringLiteral("llvm"), QStringLiteral("mingw"), QStringLiteral("gcc") }; for (const auto &type : types) { if (compilerName.contains(type)) return type; } if (compilerName == QLatin1String("g++")) return QStringLiteral("gcc"); if (isEmscriptenCompiler(compilerName)) return QStringLiteral("emscripten"); if (isIarCompiler(compilerName)) return QStringLiteral("iar"); if (isKeilCompiler(compilerName)) return QStringLiteral("keil"); if (isSdccCompiler(compilerName)) return QStringLiteral("sdcc"); if (isCosmicCompiler(compilerName)) return QStringLiteral("cosmic"); if (isDmcCompiler(compilerName)) return QStringLiteral("dmc"); if (isWatcomCompiler(compilerName)) return QStringLiteral("watcom"); return {}; } void probe(Settings *settings) { std::vector profiles; if (HostOsInfo::isWindowsHost()) { msvcProbe(settings, profiles); clangClProbe(settings, profiles); } else if (HostOsInfo::isMacosHost()) { xcodeProbe(settings, profiles); } gccProbe(settings, profiles, QStringLiteral("gcc")); gccProbe(settings, profiles, QStringLiteral("clang")); iarProbe(settings, profiles); keilProbe(settings, profiles); sdccProbe(settings, profiles); cosmicProbe(settings, profiles); dmcProbe(settings, profiles); watcomProbe(settings, profiles); emscriptenProbe(settings, profiles); if (profiles.empty()) { qStderr << Tr::tr("Could not detect any toolchains. No profile created.") << Qt::endl; } else if (profiles.size() == 1 && settings->defaultProfile().isEmpty()) { const QString profileName = profiles.front().name(); qStdout << Tr::tr("Making profile '%1' the default.").arg(profileName) << Qt::endl; settings->setValue(QStringLiteral("defaultProfile"), profileName); } } void createProfile(const QString &profileName, const QString &toolchainType, const QString &compilerFilePath, Settings *settings) { QFileInfo compiler(compilerFilePath); if (compilerFilePath == compiler.fileName() && !compiler.exists()) compiler = QFileInfo(findExecutable(compilerFilePath)); if (!compiler.exists()) { throw qbs::ErrorInfo(Tr::tr("Compiler '%1' not found") .arg(compilerFilePath)); } const QString realToolchainType = !toolchainType.isEmpty() ? toolchainType : toolchainTypeFromCompilerName(compiler.fileName()); const QStringList toolchain = canonicalToolchain(realToolchainType); if (toolchain.contains(QLatin1String("clang-cl"))) createClangClProfile(compiler, settings, profileName); else if (toolchain.contains(QLatin1String("msvc"))) createMsvcProfile(compiler, settings, profileName); else if (toolchain.contains(QLatin1String("emscripten"))) createEmscriptenProfile(compiler, settings, profileName); else if (toolchain.contains(QLatin1String("gcc"))) createGccProfile(compiler, settings, realToolchainType, profileName); else if (toolchain.contains(QLatin1String("iar"))) createIarProfile(compiler, settings, profileName); else if (toolchain.contains(QLatin1String("keil"))) createKeilProfile(compiler, settings, profileName); else if (toolchain.contains(QLatin1String("sdcc"))) createSdccProfile(compiler, settings, profileName); else if (toolchain.contains(QLatin1String("cosmic"))) createCosmicProfile(compiler, settings, profileName); else if (toolchain.contains(QLatin1String("dmc"))) createDmcProfile(compiler, settings, profileName); else if (toolchain.contains(QLatin1String("watcom"))) createWatcomProfile(compiler, settings, profileName); else throw qbs::ErrorInfo(Tr::tr("Cannot create profile: Unknown toolchain type.")); } int extractVersion(const QByteArray ¯oDump, const QByteArray &keyToken) { const int startIndex = macroDump.indexOf(keyToken); if (startIndex == -1) return -1; const int endIndex = macroDump.indexOf('\n', startIndex); if (endIndex == -1) return -1; const auto keyLength = keyToken.length(); const int version = macroDump.mid(startIndex + keyLength, endIndex - startIndex - keyLength) .toInt(); return version; } static QString resolveSymlinks(const QString &filePath) { QFileInfo fi(filePath); int links = 16; while (links-- && fi.isSymLink()) fi.setFile(fi.dir(), fi.symLinkTarget()); if (links <= 0) return {}; return fi.filePath(); } // Copied from qfilesystemengine_win.cpp. #ifdef Q_OS_WIN // File ID for Windows up to version 7. static inline QByteArray fileIdWin7(HANDLE handle) { BY_HANDLE_FILE_INFORMATION info; if (GetFileInformationByHandle(handle, &info)) { char buffer[sizeof "01234567:0123456701234567\0"]; std::snprintf(buffer, sizeof(buffer), "%lx:%08lx%08lx", info.dwVolumeSerialNumber, info.nFileIndexHigh, info.nFileIndexLow); return QByteArray(buffer); } return {}; } // File ID for Windows starting from version 8. static QByteArray fileIdWin8(HANDLE handle) { QByteArray result; FILE_ID_INFO infoEx = {}; if (::GetFileInformationByHandleEx( handle, static_cast(18), // FileIdInfo in Windows 8 &infoEx, sizeof(FILE_ID_INFO))) { result = QByteArray::number(infoEx.VolumeSerialNumber, 16); result += ':'; // Note: MinGW-64's definition of FILE_ID_128 differs from the MSVC one. result += QByteArray(reinterpret_cast(&infoEx.FileId), int(sizeof(infoEx.FileId))).toHex(); } return result; } static QByteArray fileIdWin(HANDLE fHandle) { return QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8 ? fileIdWin8(HANDLE(fHandle)) : fileIdWin7(HANDLE(fHandle)); } static QByteArray fileId(const QString &filePath) { QByteArray result; const HANDLE handle = ::CreateFile( reinterpret_cast(filePath.utf16()), 0, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); if (handle != INVALID_HANDLE_VALUE) { result = fileIdWin(handle); ::CloseHandle(handle); } return result; } static qint64 fileSize(const QString &filePath) { return QFileInfo(filePath).size(); } #else static QByteArray fileId(const QString &filePath) { QByteArray result; if (Q_UNLIKELY(filePath.isEmpty())) return {}; QT_STATBUF statResult = {}; if (QT_STAT(filePath.toLocal8Bit().constData(), &statResult)) return {}; result = QByteArray::number(quint64(statResult.st_dev), 16); result += ':'; result += QByteArray::number(quint64(statResult.st_ino)); return result; } #endif // Q_OS_WIN bool isSameExecutable(const QString &filePath1, const QString &filePath2) { if (filePath1 == filePath2) return true; if (resolveSymlinks(filePath1) == resolveSymlinks(filePath2)) return true; if (fileId(filePath1) == fileId(filePath2)) return true; #ifdef Q_OS_WIN if (fileSize(filePath1) == fileSize(filePath2)) return true; #endif return false; } MacrosMap dumpMacros(const std::function &func) { MacrosMap macros; const QStringList lines = func(); for (const QString &line : lines) { const QString prefix = QLatin1String("#define "); if (!line.startsWith(prefix)) return macros; const auto index = line.indexOf(QLatin1String(" "), prefix.length()); if (index != -1) { const auto key = line.mid(prefix.length(), index - prefix.length()); const auto value = line.mid(index + 1); macros.insert(key, value); } } return macros; } qbs-src-3.2.0/src/app/qbs-setup-toolchains/sdccprobe.cpp0000644000175100017510000002521215154533055022607 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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$ ** ****************************************************************************/ #include "probe.h" #include "sdccprobe.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include using namespace qbs; using Internal::Tr; using Internal::HostOsInfo; static QStringList knownSdccCompilerNames() { return {QStringLiteral("sdcc")}; } static QStringList dumpOutput(const QFileInfo &compiler, const QString &targetFlag = QString()) { QTemporaryFile fakeIn(QStringLiteral("XXXXXX.c")); if (!fakeIn.open()) { qbsWarning() << Tr::tr("Unable to open temporary file %1 for output: %2") .arg(fakeIn.fileName(), fakeIn.errorString()); return {}; } fakeIn.close(); const QStringList args = {QStringLiteral("-dM"), QStringLiteral("-E"), targetFlag, fakeIn.fileName()}; QProcess p; p.start(compiler.absoluteFilePath(), args); p.waitForFinished(3000); const auto es = p.exitStatus(); if (es != QProcess::NormalExit) { const QByteArray out = p.readAll(); qbsWarning() << Tr::tr("Compiler dumping failed:\n%1").arg(QString::fromUtf8(out)); return {}; } static QRegularExpression re(QStringLiteral("\\r?\\n")); return QString::fromUtf8(p.readAllStandardOutput()).split(re); } static bool supportsSdccArchitecture(const QFileInfo &compiler, QStringView flag) { const auto target = QStringLiteral("-m%1").arg(flag); const auto macros = dumpMacros([&compiler, &target]() { return dumpOutput(compiler, target); }); const auto token = QStringLiteral("__SDCC_%1").arg(flag); return macros.contains(token); } static std::vector createSdccProfileHelper(const ToolchainInstallInfo &info, Settings *settings, const QString &profileName = QString()) { const QFileInfo compiler = info.compilerPath; std::vector profiles; static constexpr struct KnownArch { QStringView architecture; QStringView flag; } knownArchs[] = {{u"mcs51", u"mcs51"}, {u"stm8", u"stm8"}, {u"hcs8", u"hc08"}}; for (const auto &knownArch : knownArchs) { // Don't create a profile in case the compiler does // not support the proposed architecture. if (!supportsSdccArchitecture(compiler, knownArch.flag)) continue; QString fullProfileName; if (profileName.isEmpty()) { // Create a full profile name in case we is // in auto-detecting mode. if (!info.compilerVersion.isValid()) { fullProfileName = QStringLiteral("sdcc-unknown-%1").arg(knownArch.architecture); } else { const QString version = info.compilerVersion.toString( QLatin1Char('_'), QLatin1Char('_')); fullProfileName = QStringLiteral("sdcc-%1-%2").arg( version, knownArch.architecture); } } else { // Append the detected actual architecture name // to the proposed profile name. fullProfileName = QStringLiteral("%1-%2").arg(profileName, knownArch.architecture); } Profile profile(fullProfileName, settings); profile.setValue(QStringLiteral("cpp.toolchainInstallPath"), compiler.absolutePath()); profile.setValue(QStringLiteral("qbs.toolchainType"), QStringLiteral("sdcc")); profile.setValue(QStringLiteral("qbs.architecture"), knownArch.architecture.toString()); qbsInfo() << Tr::tr("Profile '%1' created for '%2'.").arg( profile.name(), compiler.absoluteFilePath()); profiles.push_back(std::move(profile)); } return profiles; } static Version dumpSdccVersion(const QFileInfo &compiler) { const auto macros = dumpMacros([&compiler]() { return dumpOutput(compiler); }); if (!macros.contains(QLatin1String("__SDCC"))) { qbsWarning() << Tr::tr("No __SDCC token was found in the compiler dump"); return Version{}; } auto value = macros.value(QLatin1String("__SDCC")); value.replace(QLatin1Char('_'), QLatin1Char('.')); return Version::fromString(value); } static std::vector installedSdccsFromPath() { std::vector infos; const auto compilerNames = knownSdccCompilerNames(); for (const QString &compilerName : compilerNames) { const QFileInfo sdccPath( findExecutable( HostOsInfo::appendExecutableSuffix(compilerName))); if (!sdccPath.exists()) continue; const Version version = dumpSdccVersion(sdccPath); infos.push_back({sdccPath, version}); } std::sort(infos.begin(), infos.end()); return infos; } static std::vector installedSdccsFromRegistry() { std::vector infos; if (HostOsInfo::isWindowsHost()) { // Tries to detect the candidate from the 32-bit // or 64-bit system registry format. auto probeSdccToolchainInfo = [](QSettings::Format format) { SdccInstallInfo info; QSettings registry(QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\SDCC"), format); const QString rootPath = registry.value(QStringLiteral("Default")) .toString(); if (rootPath.isEmpty()) return info; // Build full compiler path. const QFileInfo sdccPath(rootPath + QLatin1String("\\bin\\sdcc.exe")); if (!sdccPath.exists()) return info; info.compilerPath = sdccPath.filePath(); // Build compiler version. const QString version = QStringLiteral("%1.%2.%3").arg( registry.value(QStringLiteral("VersionMajor")).toString(), registry.value(QStringLiteral("VersionMinor")).toString(), registry.value(QStringLiteral("VersionRevision")).toString()); info.version = version; return info; }; static constexpr QSettings::Format allowedFormats[] = { QSettings::NativeFormat, #ifdef Q_OS_WIN QSettings::Registry32Format, QSettings::Registry64Format, #endif }; for (const QSettings::Format format : allowedFormats) { const SdccInstallInfo candidate = probeSdccToolchainInfo(format); if (candidate.compilerPath.isEmpty()) continue; const auto infosEnd = infos.cend(); const auto infosIt = std::find_if(infos.cbegin(), infosEnd, [candidate](const ToolchainInstallInfo &info) { return candidate == SdccInstallInfo{ info.compilerPath.filePath(), info.compilerVersion.toString()}; }); if (infosIt == infosEnd) { infos.push_back({QFileInfo(candidate.compilerPath), Version::fromString(candidate.version)}); } } } std::sort(infos.begin(), infos.end()); return infos; } bool isSdccCompiler(const QString &compilerName) { return Internal::any_of(knownSdccCompilerNames(), [compilerName]( const QString &knownName) { return compilerName.contains(knownName); }); } void createSdccProfile(const QFileInfo &compiler, Settings *settings, const QString &profileName) { const ToolchainInstallInfo info = {compiler, Version{}}; createSdccProfileHelper(info, settings, profileName); } void sdccProbe(Settings *settings, std::vector &profiles) { qbsInfo() << Tr::tr("Trying to detect SDCC toolchains..."); // Make sure that a returned infos are sorted before using the std::set_union! const std::vector regInfos = installedSdccsFromRegistry(); const std::vector pathInfos = installedSdccsFromPath(); std::vector allInfos; allInfos.reserve(regInfos.size() + pathInfos.size()); std::set_union(regInfos.cbegin(), regInfos.cend(), pathInfos.cbegin(), pathInfos.cend(), std::back_inserter(allInfos)); if (allInfos.empty()) qbsInfo() << Tr::tr("No SDCC toolchains found."); for (const ToolchainInstallInfo &info : allInfos) { const auto newProfiles = createSdccProfileHelper(info, settings); profiles.reserve(profiles.size() + int(newProfiles.size())); std::copy(newProfiles.cbegin(), newProfiles.cend(), std::back_inserter(profiles)); } } qbs-src-3.2.0/src/app/qbs-setup-toolchains/commandlineparser.h0000644000175100017510000000607515154533055024021 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SETUPTOOLCHAINS_COMMANDLINEPARSER_H #define QBS_SETUPTOOLCHAINS_COMMANDLINEPARSER_H #include #include class CommandLineParser { public: void parse(const QStringList &commandLine); bool helpRequested() const { return m_helpRequested; } bool autoDetectionMode() const { return m_autoDetectionMode; } QString compilerPath() const { return m_compilerPath; } QString toolchainType() const { return m_toolchainType; } QString profileName() const { return m_profileName; } QString settingsDir() const { return m_settingsDir; } qbs::Settings::Scope settingsScope() const { return m_settingsScope; } QString usageString() const; private: [[noreturn]] void throwError(const QString &message); void assignOptionArgument(const QString &option, QString &argument); [[noreturn]] void complainAboutExtraArguments(); bool m_helpRequested = false; bool m_autoDetectionMode = false; qbs::Settings::Scope m_settingsScope = qbs::Settings::UserScope; QString m_compilerPath; QString m_toolchainType; QString m_profileName; QString m_settingsDir; QStringList m_commandLine; QString m_command; }; #endif // Header guard qbs-src-3.2.0/src/app/qbs-setup-toolchains/commandlineparser.cpp0000644000175100017510000001342115154533055024345 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "commandlineparser.h" #include #include #include using qbs::Internal::Tr; static QString helpOptionShort() { return QStringLiteral("-h"); } static QString helpOptionLong() { return QStringLiteral("--help"); } static QString detectOption() { return QStringLiteral("--detect"); } static QString typeOption() { return QStringLiteral("--type"); } static QString settingsDirOption() { return QStringLiteral("--settings-dir"); } static QString systemOption() { return QStringLiteral("--system"); } void CommandLineParser::parse(const QStringList &commandLine) { m_commandLine = commandLine; Q_ASSERT(!m_commandLine.empty()); m_command = QFileInfo(m_commandLine.takeFirst()).fileName(); m_helpRequested = false; m_autoDetectionMode = false; m_compilerPath.clear(); m_toolchainType.clear(); m_profileName.clear(); m_settingsDir.clear(); if (m_commandLine.empty()) throwError(Tr::tr("No command-line arguments provided.")); while (!m_commandLine.empty()) { const QString arg = m_commandLine.front(); if (!arg.startsWith(QLatin1Char('-'))) break; m_commandLine.removeFirst(); if (arg == helpOptionShort() || arg == helpOptionLong()) m_helpRequested = true; else if (arg == detectOption()) m_autoDetectionMode = true; else if (arg == systemOption()) m_settingsScope = qbs::Settings::SystemScope; else if (arg == typeOption()) assignOptionArgument(typeOption(), m_toolchainType); else if (arg == settingsDirOption()) assignOptionArgument(settingsDirOption(), m_settingsDir); } if (m_helpRequested || m_autoDetectionMode) { if (!m_commandLine.empty()) complainAboutExtraArguments(); return; } switch (m_commandLine.size()) { case 0: case 1: throwError(Tr::tr("Not enough command-line arguments provided.")); case 2: m_compilerPath = m_commandLine.at(0); m_profileName = m_commandLine.at(1); m_profileName.replace(QLatin1Char('.'), QLatin1Char('-')); break; default: complainAboutExtraArguments(); } } void CommandLineParser::throwError(const QString &message) { qbs::ErrorInfo error(Tr::tr("Syntax error: %1").arg(message)); error.append(usageString()); throw error; } QString CommandLineParser::usageString() const { QString s = Tr::tr("This tool creates qbs profiles from toolchains.\n"); s += Tr::tr("Usage:\n"); s += Tr::tr(" %1 [%2 ] [%4] %3\n") .arg(m_command, settingsDirOption(), detectOption(), systemOption()); s += Tr::tr(" %1 [%3 ] [%4] [%2 ] " " \n") .arg(m_command, typeOption(), settingsDirOption(), systemOption()); s += Tr::tr(" %1 %2|%3\n").arg(m_command, helpOptionShort(), helpOptionLong()); s += Tr::tr("The first form tries to auto-detect all known toolchains, looking them up " "via the PATH environment variable.\n"); s += Tr::tr("The second form creates one profile for one toolchain. It will attempt " "to find out the toolchain type automatically.\nIn case the compiler has " "an unusual file name, you may need to provide the '--type' option."); return s; } void CommandLineParser::assignOptionArgument(const QString &option, QString &argument) { if (m_commandLine.empty()) throwError(Tr::tr("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) throwError(Tr::tr("Argument for option '%1' must not be empty.").arg(option)); } void CommandLineParser::complainAboutExtraArguments() { throwError(Tr::tr("Extraneous command-line arguments '%1'.") .arg(m_commandLine.join(QLatin1Char(' ')))); } qbs-src-3.2.0/src/app/qbs-setup-toolchains/gccprobe.h0000644000175100017510000000466715154533055022107 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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_SETUPTOOLCHAINS_GCCPROBE_H #define QBS_SETUPTOOLCHAINS_GCCPROBE_H #include QT_BEGIN_NAMESPACE class QFileInfo; QT_END_NAMESPACE namespace qbs { class Profile; class Settings; } qbs::Profile createGccProfile(const QFileInfo &compiler, qbs::Settings *settings, const QString &toolchainType, const QString &profileName = QString()); void gccProbe(qbs::Settings *settings, std::vector &profiles, const QString &compilerName); #endif // Header guard qbs-src-3.2.0/src/app/qbs-setup-toolchains/cosmicprobe.h0000644000175100017510000000455115154533055022620 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** 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_SETUPTOOLCHAINS_COSMICPROBE_H #define QBS_SETUPTOOLCHAINS_COSMICPROBE_H #include QT_BEGIN_NAMESPACE class QFileInfo; QT_END_NAMESPACE namespace qbs { class Profile; class Settings; } bool isCosmicCompiler(const QString &compilerName); void createCosmicProfile(const QFileInfo &compiler, qbs::Settings *settings, QString profileName); void cosmicProbe(qbs::Settings *settings, std::vector &profiles); #endif // Header guard qbs-src-3.2.0/src/app/qbs-setup-toolchains/xcodeprobe.cpp0000644000175100017510000002262015154533055022775 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "probe.h" #include "xcodeprobe.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace qbs; using Internal::Tr; static const QString defaultDeveloperPath = QStringLiteral("/Applications/Xcode.app/Contents/Developer"); static const std::regex defaultDeveloperPathRegex( "^/Applications/Xcode([a-zA-Z0-9 ._-]+)\\.app/Contents/Developer$"); static QString targetOS(const QString &applePlatformName) { if (applePlatformName == QStringLiteral("macosx")) return QStringLiteral("macos"); if (applePlatformName == QStringLiteral("iphoneos")) return QStringLiteral("ios"); if (applePlatformName == QStringLiteral("iphonesimulator")) return QStringLiteral("ios-simulator"); if (applePlatformName == QStringLiteral("appletvos")) return QStringLiteral("tvos"); if (applePlatformName == QStringLiteral("appletvsimulator")) return QStringLiteral("tvos-simulator"); if (applePlatformName == QStringLiteral("watchos")) return QStringLiteral("watchos"); if (applePlatformName == QStringLiteral("watchsimulator")) return QStringLiteral("watchos-simulator"); return {}; } static QStringList archList(const QString &applePlatformName) { QStringList archs; if (applePlatformName == QStringLiteral("macosx") || applePlatformName == QStringLiteral("iphonesimulator") || applePlatformName == QStringLiteral("appletvsimulator") || applePlatformName == QStringLiteral("watchsimulator")) { if (applePlatformName != QStringLiteral("appletvsimulator")) archs << QStringLiteral("x86"); if (applePlatformName != QStringLiteral("watchsimulator")) archs << QStringLiteral("x86_64"); if (applePlatformName == QStringLiteral("macosx") || QSysInfo::buildCpuArchitecture() == QStringLiteral("arm64")) { archs << QStringLiteral("arm64"); } } else if (applePlatformName == QStringLiteral("iphoneos") || applePlatformName == QStringLiteral("appletvos")) { if (applePlatformName != QStringLiteral("appletvos")) archs << QStringLiteral("armv7a"); archs << QStringLiteral("arm64"); } else if (applePlatformName == QStringLiteral("watchos")) { archs << QStringLiteral("armv7k"); } return archs; } namespace { class XcodeProbe { public: XcodeProbe(qbs::Settings *settings, std::vector &profiles) : settings(settings), profiles(profiles) { } bool addDeveloperPath(const QString &path); void detectDeveloperPaths(); void setupDefaultToolchains(const QString &devPath, const QString &xCodeName); void detectAll(); private: qbs::Settings *settings; std::vector &profiles; QStringList developerPaths; }; bool XcodeProbe::addDeveloperPath(const QString &path) { if (path.isEmpty()) return false; QFileInfo pInfo(path); if (!pInfo.exists() || !pInfo.isDir()) return false; if (developerPaths.contains(path)) return false; developerPaths.push_back(path); qbsInfo() << Tr::tr("Added developer path %1").arg(path); return true; } void XcodeProbe::detectDeveloperPaths() { QProcess selectedXcode; QString program = QStringLiteral("/usr/bin/xcode-select"); QStringList arguments(QStringLiteral("--print-path")); selectedXcode.start(program, arguments, QProcess::ReadOnly); if (!selectedXcode.waitForFinished(-1) || selectedXcode.exitCode()) { qbsInfo() << Tr::tr("Could not detect selected Xcode with /usr/bin/xcode-select"); } else { QString path = QString::fromLocal8Bit(selectedXcode.readAllStandardOutput().trimmed()); addDeveloperPath(path); } addDeveloperPath(defaultDeveloperPath); QProcess launchServices; program = QStringLiteral("/usr/bin/mdfind"); arguments = QStringList(QStringLiteral("kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'")); launchServices.start(program, arguments, QProcess::ReadOnly); if (!launchServices.waitForFinished(-1) || launchServices.exitCode()) { qbsInfo() << Tr::tr("Could not detect additional Xcode installations with /usr/bin/mdfind"); } else { const auto paths = QString::fromLocal8Bit(launchServices.readAllStandardOutput()) .split(QLatin1Char('\n'), Qt::SkipEmptyParts); for (const QString &path : paths) addDeveloperPath(path + QStringLiteral("/Contents/Developer")); } } void XcodeProbe::setupDefaultToolchains(const QString &devPath, const QString &xcodeName) { qbsInfo() << Tr::tr("Profile '%1' created for '%2'.").arg(xcodeName, devPath); Profile installationProfile(xcodeName, settings); installationProfile.removeProfile(); installationProfile.setValue(QStringLiteral("qbs.toolchainType"), QStringLiteral("xcode")); if (devPath != defaultDeveloperPath) installationProfile.setValue(QStringLiteral("xcode.developerPath"), devPath); profiles.push_back(installationProfile); QStringList platforms; platforms << QStringLiteral("macosx") << QStringLiteral("iphoneos") << QStringLiteral("iphonesimulator") << QStringLiteral("appletvos") << QStringLiteral("appletvsimulator") << QStringLiteral("watchos") << QStringLiteral("watchsimulator"); for (const QString &platform : std::as_const(platforms)) { Profile platformProfile(xcodeName + QLatin1Char('-') + platform, settings); platformProfile.removeProfile(); platformProfile.setBaseProfile(installationProfile.name()); platformProfile.setValue(QStringLiteral("qbs.targetPlatform"), targetOS(platform)); profiles.push_back(platformProfile); const auto architectures = archList(platform); for (const QString &arch : architectures) { Profile archProfile(xcodeName + QLatin1Char('-') + platform + QLatin1Char('-') + arch, settings); archProfile.removeProfile(); archProfile.setBaseProfile(platformProfile.name()); archProfile.setValue(QStringLiteral("qbs.architecture"), qbs::canonicalArchitecture(arch)); profiles.push_back(archProfile); } } } void XcodeProbe::detectAll() { int i = 1; detectDeveloperPaths(); for (const QString &developerPath : std::as_const(developerPaths)) { QString profileName = QStringLiteral("xcode"); if (developerPath != defaultDeveloperPath) { const auto devPath = developerPath.toStdString(); std::smatch match; if (std::regex_match(devPath, match, defaultDeveloperPathRegex)) profileName += QString::fromStdString(match[1]).toLower(). replace(QLatin1Char(' '), QLatin1Char('-')). replace(QLatin1Char('.'), QLatin1Char('_')); else profileName += QString::number(i++); } setupDefaultToolchains(developerPath, profileName); } } } // end anonymous namespace void xcodeProbe(qbs::Settings *settings, std::vector &profiles) { XcodeProbe probe(settings, profiles); probe.detectAll(); } qbs-src-3.2.0/src/app/qbs-setup-toolchains/qbs-setup-toolchains.qbs0000644000175100017510000000223415154533055024731 0ustar runnerrunnerQbsApp { name: "qbs-setup-toolchains" cpp.dynamicLibraries: qbs.targetOS.contains("windows") ? base.concat("shell32") : base files: [ "clangclprobe.cpp", "clangclprobe.h", "commandlineparser.cpp", "commandlineparser.h", "cosmicprobe.cpp", "cosmicprobe.h", "dmcprobe.cpp", "dmcprobe.h", "emscriptenprobe.cpp", "emscriptenprobe.h", "gccprobe.cpp", "gccprobe.h", "iarewprobe.cpp", "iarewprobe.h", "keilprobe.cpp", "keilprobe.h", "main.cpp", "msvcprobe.cpp", "msvcprobe.h", "probe.cpp", "probe.h", "sdccprobe.cpp", "sdccprobe.h", "watcomprobe.cpp", "watcomprobe.h", "xcodeprobe.cpp", "xcodeprobe.h", ] Group { name: "MinGW specific files" condition: qbs.toolchain.contains("mingw") files: "qbs-setup-toolchains.rc" Group { name: "qbs-setup-toolchains manifest" files: "qbs-setup-toolchains.exe.manifest" fileTags: [] // the manifest is referenced by the rc file } } } qbs-src-3.2.0/src/app/qbs-setup-toolchains/dmcprobe.h0000644000175100017510000000453315154533055022106 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2021 Denis Shienkov ** 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_SETUPTOOLCHAINS_DMCPROBE_H #define QBS_SETUPTOOLCHAINS_DMCPROBE_H #include QT_BEGIN_NAMESPACE class QFileInfo; QT_END_NAMESPACE namespace qbs { class Profile; class Settings; } bool isDmcCompiler(const QString &compilerName); void createDmcProfile(const QFileInfo &compiler, qbs::Settings *settings, QStringView profileName); void dmcProbe(qbs::Settings *settings, std::vector &profiles); #endif // Header guard qbs-src-3.2.0/src/app/qbs-setup-toolchains/emscriptenprobe.h0000644000175100017510000000466715154533055023524 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 Danya Patrushev ** 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_SETUPTOOLCHAINS_EMSCRIPTENPROBE_H #define QBS_SETUPTOOLCHAINS_EMSCRIPTENPROBE_H #include QT_BEGIN_NAMESPACE class QFileInfo; class QString; QT_END_NAMESPACE namespace qbs { class Profile; class Settings; } // namespace qbs bool isEmscriptenCompiler(const QString &compilerName); qbs::Profile createEmscriptenProfile( const QFileInfo &compiler, qbs::Settings *settings, const QString &profileName = QString()); void emscriptenProbe(qbs::Settings *settings, std::vector &profiles); #endif // QBS_SETUPTOOLCHAINS_EMSCRIPTENPROBE_H qbs-src-3.2.0/src/app/qbs-setup-toolchains/iarewprobe.h0000644000175100017510000000453315154533055022452 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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_SETUPTOOLCHAINS_IAREWPROBE_H #define QBS_SETUPTOOLCHAINS_IAREWPROBE_H #include QT_BEGIN_NAMESPACE class QFileInfo; QT_END_NAMESPACE namespace qbs { class Profile; class Settings; } bool isIarCompiler(const QString &compilerName); void createIarProfile(const QFileInfo &compiler, qbs::Settings *settings, QString profileName); void iarProbe(qbs::Settings *settings, std::vector &profiles); #endif // Header guard qbs-src-3.2.0/src/app/qbs-setup-toolchains/watcomprobe.cpp0000644000175100017510000002341415154533055023167 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2022 Denis Shienkov ** 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$ ** ****************************************************************************/ #include "watcomprobe.h" #include "probe.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include #include #include using namespace qbs; using Internal::HostOsInfo; using Internal::Tr; namespace { struct Details { QStringView architecture; QStringView platform; }; constexpr struct Platform { QStringView flag; Details keys; Details target; } knownPlatforms[] = { // DOS 16/32 bit. {u"-bdos", {u"__I86__", u"__DOS__"}, {u"x86_16", u"dos"}}, {u"-bdos4g", {u"__386__", u"__DOS__"}, {u"x86", u"dos"}}, // Windows 16/32 bit. {u"-bwindows", {u"__I86__", u"__WINDOWS__"}, {u"x86_16", u"windows"}}, {u"-bnt", {u"__386__", u"__NT__"}, {u"x86", u"windows"}}, // OS/2 16/32 bit. {u"-bos2", {u"__I86__", u"__OS2__"}, {u"x86_16", u"os2"}}, {u"-bos2v2", {u"__386__", u"__OS2__"}, {u"x86", u"os2"}}, // Linux 32 bit. {u"-blinux", {u"__386__", u"__LINUX__"}, {u"x86", u"linux"}}, }; } // namespace static QStringList knownWatcomCompilerNames() { return {QStringLiteral("owcc")}; } static QStringList dumpOutput(const QFileInfo &compiler, QStringView flag, const QList &keys) { const QString filePath = QDir(QDir::tempPath()).absoluteFilePath( QLatin1String("watcom-dump.c")); QFile fakeIn(filePath); if (!fakeIn.open(QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Text)) { qbsWarning() << Tr::tr("Unable to open temporary file %1 for output: %2") .arg(fakeIn.fileName(), fakeIn.errorString()); return {}; } fakeIn.write("#define VALUE_TO_STRING(x) #x\n"); fakeIn.write("#define VALUE(x) VALUE_TO_STRING(x)\n"); fakeIn.write("#define VAR_NAME_VALUE(var) \"#define \" #var\" \"VALUE(var)\n"); for (const auto &key : keys) { fakeIn.write("#if defined(" + key.toLatin1() + ")\n"); fakeIn.write("#pragma message (VAR_NAME_VALUE(" + key.toLatin1() + "))\n"); fakeIn.write("#endif\n"); } fakeIn.close(); QProcess p; QStringList args; if (!flag.isEmpty()) args.push_back(flag.toString()); args.push_back(QDir::toNativeSeparators(filePath)); p.start(compiler.absoluteFilePath(), args); p.waitForFinished(3000); fakeIn.remove(); QStringList lines = QString::fromUtf8(p.readAllStandardOutput()) .split(QRegularExpression(QLatin1String("\\r?\\n"))); return lines; } static bool supportsWatcomPlatform(const QFileInfo &compiler, const Platform &platform) { const auto macros = dumpMacros([&compiler, &platform]() { const QList keys = {platform.keys.architecture, platform.keys.platform}; return dumpOutput(compiler, platform.flag, keys); }); auto matches = [¯os](QStringView key) { const auto k = key.toString(); if (!macros.contains(k)) return false; return macros.value(k) == QLatin1String("1"); }; return matches(platform.keys.architecture) && matches(platform.keys.platform); } static std::vector createWatcomProfileHelper(const ToolchainInstallInfo &info, Settings *settings, QStringView profileName = {}) { const QFileInfo compiler = info.compilerPath; std::vector profiles; for (const auto &knownPlatform : knownPlatforms) { // Don't create a profile in case the compiler does // not support the proposed architecture. if (!supportsWatcomPlatform(compiler, knownPlatform)) continue; QString fullProfilename; if (profileName.isEmpty()) { // Create a full profile name in case we is in auto-detecting mode. if (!info.compilerVersion.isValid()) { fullProfilename = QStringLiteral("watcom-unknown-%1-%2") .arg(knownPlatform.target.platform) .arg(knownPlatform.target.architecture); } else { const QString version= info.compilerVersion.toString(QLatin1Char('_'), QLatin1Char('_')); fullProfilename = QStringLiteral("watcom-%1-%2-%3") .arg(version) .arg(knownPlatform.target.platform) .arg(knownPlatform.target.architecture); } } else { // Append the detected actual architecture name to the proposed profile name. fullProfilename = QStringLiteral("%1-%2-%3") .arg(profileName) .arg(knownPlatform.target.platform) .arg(knownPlatform.target.architecture); } Profile profile(fullProfilename, settings); profile.setValue(QStringLiteral("cpp.toolchainInstallPath"), compiler.absolutePath()); profile.setValue(QStringLiteral("qbs.toolchainType"), QStringLiteral("watcom")); profile.setValue(QStringLiteral("qbs.architecture"), knownPlatform.target.architecture.toString()); profile.setValue(QStringLiteral("qbs.targetPlatform"), knownPlatform.target.platform.toString()); qbsInfo() << Tr::tr("Profile '%1' created for '%2'.") .arg(profile.name(), compiler.absoluteFilePath()); profiles.push_back(std::move(profile)); } return profiles; } static Version dumpWatcomVersion(const QFileInfo &compiler) { const QList keys = {u"__WATCOMC__", u"__WATCOM_CPLUSPLUS__"}; const auto macros = dumpMacros([&compiler, &keys]() { return dumpOutput(compiler, u"", keys); }); for (const auto ¯o : macros) { const int verCode = macro.toInt(); return Version{(verCode - 1100) / 100, (verCode / 10) % 10, ((verCode % 10) > 0) ? (verCode % 10) : 0}; } qbsWarning() << Tr::tr("No __WATCOMC__ or __WATCOM_CPLUSPLUS__ tokens was found" " in the compiler dump"); return Version{}; } static std::vector installedWatcomsFromPath() { std::vector infos; const auto compilerNames = knownWatcomCompilerNames(); for (const QString &compilerName : compilerNames) { const QFileInfo watcomPath(findExecutable( HostOsInfo::appendExecutableSuffix(compilerName))); if (!watcomPath.exists()) continue; const Version version = dumpWatcomVersion(watcomPath); infos.push_back({watcomPath, version}); } std::sort(infos.begin(), infos.end()); return infos; } bool isWatcomCompiler(const QString &compilerName) { return Internal::any_of(knownWatcomCompilerNames(), [compilerName](const QString &knownName) { return compilerName.contains(knownName); }); } void createWatcomProfile(const QFileInfo &compiler, Settings *settings, QStringView profileName) { const ToolchainInstallInfo info = {compiler, Version{}}; createWatcomProfileHelper(info, settings, profileName); } void watcomProbe(Settings *settings, std::vector &profiles) { qbsInfo() << Tr::tr("Trying to detect WATCOM toolchains..."); const std::vector allInfos = installedWatcomsFromPath(); if (allInfos.empty()) { qbsInfo() << Tr::tr("No WATCOM toolchains found."); return; } for (const ToolchainInstallInfo &info : allInfos) { const auto newProfiles = createWatcomProfileHelper(info, settings); profiles.reserve(profiles.size() + int(newProfiles.size())); std::copy(newProfiles.cbegin(), newProfiles.cend(), std::back_inserter(profiles)); } } qbs-src-3.2.0/src/app/qbs-setup-toolchains/gccprobe.cpp0000644000175100017510000005547715154533055022447 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 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$ ** ****************************************************************************/ #include "probe.h" #include "gccprobe.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include #include #include #include using namespace qbs; using Internal::HostOsInfo; using Internal::Tr; constexpr char kUninstallRegistryKey[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" \ "Windows\\CurrentVersion\\Uninstall\\"; static QString qsystem(const QString &exe, const QStringList &args = QStringList()) { QProcess p; p.setProcessChannelMode(QProcess::MergedChannels); p.start(exe, args); if (!p.waitForStarted()) { throw qbs::ErrorInfo(Tr::tr("Failed to start compiler '%1': %2") .arg(exe, p.errorString())); } if (!p.waitForFinished(-1) || p.exitCode() != 0) throw qbs::ErrorInfo(Tr::tr("Failed to run compiler '%1': %2") .arg(exe, p.errorString())); return QString::fromLocal8Bit(p.readAll()); } static QStringList validMinGWMachines() { // List of MinGW machine names (gcc -dumpmachine) recognized by Qbs return {QStringLiteral("mingw32"), QStringLiteral("mingw64"), QStringLiteral("i686-w64-mingw32"), QStringLiteral("x86_64-w64-mingw32"), QStringLiteral("i686-w64-mingw32.shared"), QStringLiteral("x86_64-w64-mingw32.shared"), QStringLiteral("i686-w64-mingw32.static"), QStringLiteral("x86_64-w64-mingw32.static"), QStringLiteral("i586-mingw32msvc"), QStringLiteral("amd64-mingw32msvc")}; } static QString gccMachineName(const QFileInfo &compiler) { return qsystem(compiler.absoluteFilePath(), {QStringLiteral("-dumpmachine")}) .trimmed(); } static QStringList standardCompilerFileNames() { return {HostOsInfo::appendExecutableSuffix(QStringLiteral("gcc")), HostOsInfo::appendExecutableSuffix(QStringLiteral("g++")), HostOsInfo::appendExecutableSuffix(QStringLiteral("clang")), HostOsInfo::appendExecutableSuffix(QStringLiteral("clang++"))}; } class ToolchainDetails { public: explicit ToolchainDetails(const QFileInfo &compiler) { auto baseName = HostOsInfo::stripExecutableSuffix(compiler.fileName()); // Extract the version sub-string if it exists. We assume that a version // sub-string located after the compiler prefix && suffix. E.g. this code // parses a version from the compiler names, like this: // - avr-gcc-4.9.2.exe // - arm-none-eabi-gcc-8.2.1 // - rl78-elf-gcc-4.9.2.201902-GNURL78 const QRegularExpression re(QLatin1String("-(\\d+|\\d+\\.\\d+|" \ "\\d+\\.\\d+\\.\\d+|" \ "\\d+\\.\\d+\\.\\d+\\.\\d+)" \ "[-[0-9a-zA-Z]*]?$")); const QRegularExpressionMatch match = re.match(baseName); if (match.hasMatch()) { version = match.captured(1); baseName = baseName.left(match.capturedStart()); } const auto dashIndex = baseName.lastIndexOf(QLatin1Char('-')); suffix = baseName.mid(dashIndex + 1); prefix = baseName.left(dashIndex + 1); } QString prefix; QString suffix; QString version; }; static void setCommonProperties(Profile &profile, const QFileInfo &compiler, const QString &toolchainType, const ToolchainDetails &details) { if (toolchainType == QStringLiteral("mingw")) profile.setValue(QStringLiteral("qbs.targetPlatform"), QStringLiteral("windows")); if (!details.prefix.isEmpty()) profile.setValue(QStringLiteral("cpp.toolchainPrefix"), details.prefix); profile.setValue(QStringLiteral("cpp.toolchainInstallPath"), compiler.absolutePath()); profile.setValue(QStringLiteral("qbs.toolchainType"), toolchainType); if (!standardCompilerFileNames().contains( HostOsInfo::appendExecutableSuffix(details.suffix))) { qWarning("%s", qPrintable( QStringLiteral("'%1' is not a standard compiler file name; " "you must set the cpp.cCompilerName and " "cpp.cxxCompilerName properties of this profile " "manually").arg(compiler.fileName()))); } } class ToolPathSetup { public: explicit ToolPathSetup(Profile *profile, QString path, ToolchainDetails details) : m_profile(profile), m_compilerDirPath(std::move(path)), m_details(std::move(details)) { } void apply(const QString &toolName, const QString &propertyName) const { // Check for full tool name at first (includes suffix and version). QString filePath = toolFilePath(toolName, UseFullToolName); if (filePath.isEmpty()) { // Check for base tool name at second (without of suffix and version). filePath = toolFilePath(toolName, UseBaseToolName); if (filePath.isEmpty()) { // Check for short tool name at third (only a tool name). filePath = toolFilePath(toolName, UseOnlyShortToolName); } } if (filePath.isEmpty()) { qWarning("%s", qPrintable( QStringLiteral("'%1' not found in '%2'. " "Qbs will try to find it in PATH at build time.") .arg(toolName, m_compilerDirPath))); } else { m_profile->setValue(propertyName, filePath); } } private: enum ToolNameParts : quint8 { UseOnlyShortToolName = 0x0, UseToolPrefix = 0x01, UseToolSuffix = 0x02, UseToolVersion = 0x04, UseFullToolName = UseToolPrefix | UseToolSuffix | UseToolVersion, UseBaseToolName = UseToolPrefix, }; QString toolFilePath(const QString &toolName, int parts) const { QString fileName; if ((parts & UseToolPrefix) && !m_details.prefix.isEmpty()) fileName += m_details.prefix; if ((parts & UseToolSuffix) && !m_details.suffix.isEmpty()) fileName += m_details.suffix + QLatin1Char('-'); fileName += toolName; if ((parts & UseToolVersion) && !m_details.version.isEmpty()) fileName += QLatin1Char('-') + m_details.version; fileName = HostOsInfo::appendExecutableSuffix(fileName); QString filePath = QDir(m_compilerDirPath).absoluteFilePath(fileName); if (QFile::exists(filePath)) return filePath; return {}; } Profile * const m_profile; QString m_compilerDirPath; ToolchainDetails m_details; }; static bool doesProfileTargetOS(const Profile &profile, const QString &os) { const auto target = profile.value(QStringLiteral("qbs.targetPlatform")); if (target.isValid()) return Internal::contains(HostOsInfo::canonicalOSIdentifiers(target.toString()), os); return Internal::contains(HostOsInfo::hostOSIdentifiers(), os); } static QString buildProfileName(const QFileInfo &cfi) { // We need to replace a dot-separated compiler version string // with a underscore-separated string, because the profile // name does not allow a dots. auto result = cfi.completeBaseName(); result.replace(QLatin1Char('.'), QLatin1Char('_')); return result; } static QStringList buildCompilerNameFilters(const QString &compilerName) { QStringList filters = { // "clang", "gcc" compilerName, // "clang-8", "gcc-5" compilerName + QLatin1String("-[1-9]*"), // "avr-gcc" QLatin1String("*-") + compilerName, // "avr-gcc-5.4.0" QLatin1String("*-") + compilerName + QLatin1String("-[1-9]*"), // "arm-none-eabi-gcc" QLatin1String("*-*-*-") + compilerName, // "arm-none-eabi-gcc-9.1.0" QLatin1String("*-*-*-") + compilerName + QLatin1String("-[1-9]*"), // "x86_64-pc-linux-gnu-gcc" QLatin1String("*-*-*-*-") + compilerName, // "x86_64-pc-linux-gnu-gcc-7.4.1" QLatin1String("*-*-*-*-") + compilerName + QLatin1String("-[1-9]*") }; Internal::transform(filters, [](const auto &filter) { return HostOsInfo::appendExecutableSuffix(filter); }); return filters; } static QStringList gnuRegistrySearchPaths() { if (!HostOsInfo::isWindowsHost()) return {}; #ifdef Q_OS_WIN64 static const char kRegistryNode[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\ARM"; #else static const char kRegistryNode[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\ARM"; #endif QStringList searchPaths; QSettings registry(QLatin1String(kRegistryNode), QSettings::NativeFormat); const auto groupKeys = registry.childGroups(); for (const QString &groupKey : groupKeys) { registry.beginGroup(groupKey); const QString rootPath = registry.value(QStringLiteral("InstallFolder")).toString(); if (!rootPath.isEmpty()) { const QFileInfo toolchainPath(rootPath + QLatin1String("/bin")); if (toolchainPath.exists()) { const auto filePath = toolchainPath.absoluteFilePath(); if (!searchPaths.contains(filePath)) searchPaths.push_back(filePath); } } registry.endGroup(); } return searchPaths; } static QStringList atmelRegistrySearchPaths() { if (!HostOsInfo::isWindowsHost()) return {}; // Registry token for the "Atmel" toolchains, e.g. provided by installed // "Atmel Studio" IDE. static const char kRegistryToken[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Atmel\\"; QStringList searchPaths; QSettings registry(QLatin1String(kRegistryToken), QSettings::NativeFormat); // This code enumerate the installed toolchains provided // by the Atmel Studio v6.x. const auto toolchainGroups = registry.childGroups(); for (const QString &toolchainKey : toolchainGroups) { if (!toolchainKey.endsWith(QLatin1String("GCC"))) continue; registry.beginGroup(toolchainKey); const auto entries = registry.childGroups(); for (const auto &entryKey : entries) { registry.beginGroup(entryKey); const QString installDir = registry.value( QStringLiteral("Native/InstallDir")).toString(); const QString version = registry.value( QStringLiteral("Native/Version")).toString(); registry.endGroup(); QString toolchainPath = installDir + QLatin1String("/Atmel Toolchain/") + toolchainKey + QLatin1String("/Native/") + version; if (toolchainKey.startsWith(QLatin1String("ARM"))) toolchainPath += QLatin1String("/arm-gnu-toolchain"); else if (toolchainKey.startsWith(QLatin1String("AVR32"))) toolchainPath += QLatin1String("/avr32-gnu-toolchain"); else if (toolchainKey.startsWith(QLatin1String("AVR8)"))) toolchainPath += QLatin1String("/avr8-gnu-toolchain"); else break; toolchainPath += QLatin1String("/bin"); if (QFileInfo::exists(toolchainPath)) { searchPaths.push_back(toolchainPath); break; } } registry.endGroup(); } // This code enumerate the installed toolchains provided // by the Atmel Studio v7. registry.beginGroup(QStringLiteral("AtmelStudio")); const auto productVersions = registry.childGroups(); for (const auto &productVersionKey : productVersions) { registry.beginGroup(productVersionKey); const QString installDir = registry.value( QStringLiteral("InstallDir")).toString(); registry.endGroup(); const QStringList knownToolchainSubdirs = { QStringLiteral("/toolchain/arm/arm-gnu-toolchain/bin/"), QStringLiteral("/toolchain/avr8/avr8-gnu-toolchain/bin/"), QStringLiteral("/toolchain/avr32/avr32-gnu-toolchain/bin/"), }; for (const auto &subdir : knownToolchainSubdirs) { const QString toolchainPath = installDir + subdir; if (!QFileInfo::exists(toolchainPath)) continue; searchPaths.push_back(toolchainPath); } } registry.endGroup(); return searchPaths; } static QStringList renesasRl78RegistrySearchPaths() { if (!HostOsInfo::isWindowsHost()) return {}; QStringList searchPaths; QSettings registry(QLatin1String(kUninstallRegistryKey), QSettings::NativeFormat); const auto productGroups = registry.childGroups(); for (const QString &productKey : productGroups) { // Registry token for the "Renesas RL78" toolchain. if (!productKey.startsWith( QLatin1String("GCC for Renesas RL78"))) { continue; } registry.beginGroup(productKey); const QString installLocation = registry.value( QLatin1String("InstallLocation")).toString(); registry.endGroup(); if (installLocation.isEmpty()) continue; const QFileInfo toolchainPath(QDir(installLocation).absolutePath() + QLatin1String("/rl78-elf/rl78-elf/bin")); if (!toolchainPath.exists()) continue; searchPaths.push_back(toolchainPath.absoluteFilePath()); } return searchPaths; } static QStringList mplabX32RegistrySearchPaths() { if (!HostOsInfo::isWindowsHost()) return {}; QStringList searchPaths; QSettings registry(QLatin1String(kUninstallRegistryKey), QSettings::NativeFormat); const auto productGroups = registry.childGroups(); for (const QString &productKey : productGroups) { // Registry token for the "MPLAB X32" toolchain. if (!productKey.startsWith( QLatin1String("MPLAB XC32 Compiler"))) { continue; } registry.beginGroup(productKey); const QString installLocation = registry.value( QLatin1String("InstallLocation")).toString(); registry.endGroup(); if (installLocation.isEmpty()) continue; const QFileInfo toolchainPath(QDir(installLocation).absolutePath() + QLatin1String("/bin")); if (!toolchainPath.exists()) continue; searchPaths.push_back(toolchainPath.absoluteFilePath()); } return searchPaths; } Profile createGccProfile(const QFileInfo &compiler, Settings *settings, const QString &toolchainType, const QString &profileName) { const QString machineName = gccMachineName(compiler); if (toolchainType == QLatin1String("mingw")) { if (!validMinGWMachines().contains(machineName)) { throw ErrorInfo(Tr::tr("Detected gcc platform '%1' is not supported.") .arg(machineName)); } } Profile profile(!profileName.isEmpty() ? profileName : machineName, settings); profile.removeProfile(); const ToolchainDetails details(compiler); setCommonProperties(profile, compiler, toolchainType, details); if (HostOsInfo::isWindowsHost() && toolchainType == QLatin1String("clang")) { const QStringList profileNames = settings->profiles(); bool foundMingw = false; for (const QString &profileName : profileNames) { const Profile otherProfile(profileName, settings); if (otherProfile.value(QLatin1String("qbs.toolchainType")).toString() == QLatin1String("mingw") || otherProfile.value(QLatin1String("qbs.toolchain")) .toStringList().contains(QLatin1String("mingw"))) { const QFileInfo tcDir(otherProfile.value(QLatin1String("cpp.toolchainInstallPath")) .toString()); if (!tcDir.fileName().isEmpty() && tcDir.exists()) { profile.setValue(QLatin1String("qbs.sysroot"), tcDir.path()); foundMingw = true; break; } } } if (!foundMingw) { qbsWarning() << Tr::tr("Using clang on Windows requires a mingw installation. " "Please set qbs.sysroot accordingly for profile '%1'.") .arg(profile.name()); } } if (toolchainType != QLatin1String("clang")) { // Check whether auxiliary tools reside within the toolchain's install path. // This might not be the case when using icecc or another compiler wrapper. const QString compilerDirPath = compiler.absolutePath(); const ToolPathSetup toolPathSetup(&profile, compilerDirPath, details); toolPathSetup.apply(QStringLiteral("ar"), QStringLiteral("cpp.archiverPath")); toolPathSetup.apply(QStringLiteral("as"), QStringLiteral("cpp.assemblerPath")); toolPathSetup.apply(QStringLiteral("nm"), QStringLiteral("cpp.nmPath")); if (doesProfileTargetOS(profile, QStringLiteral("darwin"))) toolPathSetup.apply(QStringLiteral("dsymutil"), QStringLiteral("cpp.dsymutilPath")); else toolPathSetup.apply(QStringLiteral("objcopy"), QStringLiteral("cpp.objcopyPath")); toolPathSetup.apply(QStringLiteral("strip"), QStringLiteral("cpp.stripPath")); } qbsInfo() << Tr::tr("Profile '%1' created for '%2'.") .arg(profile.name(), compiler.absoluteFilePath()); return profile; } void gccProbe(Settings *settings, std::vector &profiles, const QString &compilerName) { qbsInfo() << Tr::tr("Trying to detect %1...").arg(compilerName); QStringList searchPaths; searchPaths << systemSearchPaths() << gnuRegistrySearchPaths() << atmelRegistrySearchPaths() << renesasRl78RegistrySearchPaths() << mplabX32RegistrySearchPaths(); std::vector candidates; const auto filters = buildCompilerNameFilters(compilerName); for (const auto &searchPath : std::as_const(searchPaths)) { const QDir dir(searchPath); const QStringList fileNames = dir.entryList( filters, QDir::Files | QDir::Executable); for (const QString &fileName : fileNames) { // Ignore unexpected compiler names. if (fileName.startsWith(QLatin1String("c89-gcc")) || fileName.startsWith(QLatin1String("c99-gcc"))) { continue; } const QFileInfo candidate(dir.filePath(fileName)); // Filter duplicates. const auto existingEnd = candidates.end(); const auto existingIt = std::find_if( candidates.begin(), existingEnd, [candidate](const QFileInfo &existing) { return isSameExecutable(candidate.absoluteFilePath(), existing.absoluteFilePath()); }); if (existingIt == existingEnd) { // No duplicates are found, just add a new candidate. candidates.push_back(candidate); } else { // Replace the existing entry if a candidate name more than // an existing name. const auto candidateName = candidate.completeBaseName(); const auto existingName = existingIt->completeBaseName(); if (candidateName > existingName) *existingIt = candidate; } } } if (candidates.empty()) { qbsInfo() << Tr::tr("No %1 toolchains found.").arg(compilerName); return; } // Sort candidates so that mingw comes first. Information from mingw profiles is potentially // used for setting up clang profiles. if (HostOsInfo::isWindowsHost()) { std::sort(candidates.begin(), candidates.end(), [](const QFileInfo &fi1, const QFileInfo &fi2) { return fi1.absoluteFilePath().contains(QLatin1String("mingw")) && !fi2.absoluteFilePath().contains(QLatin1String("mingw")); }); } for (const auto &candidate : std::as_const(candidates)) { const QString toolchainType = toolchainTypeFromCompilerName( candidate.baseName()); const QString profileName = buildProfileName(candidate); try { auto profile = createGccProfile(candidate, settings, toolchainType, profileName); profiles.push_back(std::move(profile)); } catch (const qbs::ErrorInfo &info) { qbsWarning() << Tr::tr("Skipping %1: %2").arg(profileName, info.toString()); } } } qbs-src-3.2.0/src/app/apps.qbs0000644000175100017510000000054215154533055015524 0ustar runnerrunnerProject { references: [ "config/config.qbs", "config-ui/config-ui.qbs", "qbs/qbs.qbs", "qbs-create-project/qbs-create-project.qbs", "qbs-setup-android/qbs-setup-android.qbs", "qbs-setup-qt/qbs-setup-qt.qbs", "qbs-setup-toolchains/qbs-setup-toolchains.qbs", "shared/shared.qbs", ] } qbs-src-3.2.0/src/app/config/0000755000175100017510000000000015154533055015316 5ustar runnerrunnerqbs-src-3.2.0/src/app/config/config.qbs0000644000175100017510000000037615154533055017300 0ustar runnerrunnerQbsApp { name: "qbs-config" files: [ "configcommand.h", "configcommandexecutor.cpp", "configcommandexecutor.h", "configcommandlineparser.cpp", "configcommandlineparser.h", "configmain.cpp" ] } qbs-src-3.2.0/src/app/config/configcommand.h0000644000175100017510000000441415154533055020276 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 CONFIGCOMMAND_H #define CONFIGCOMMAND_H #include #include #include class ConfigCommand { public: enum Command { CfgSet, CfgUnset, CfgList, CfgExport, CfgImport, CfgAddProfile, CfgNone }; ConfigCommand() : command(CfgNone) {} Command command; QStringList varNames; QString varValue; QString fileName; }; #endif // CONFIGCOMMAND_H qbs-src-3.2.0/src/app/config/configmain.cpp0000644000175100017510000000565415154533055020146 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "configcommandlineparser.h" #include "configcommandexecutor.h" #include #include #include #include #include #include using qbs::Internal::Tr; using qbs::Settings; int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); ConfigCommandLineParser parser; try { parser.parse(app.arguments().mid(1)); if (parser.helpRequested()) { std::cout << qPrintable(Tr::tr("This tool manages qbs settings.")) << std::endl; parser.printUsage(); return EXIT_SUCCESS; } Settings settings(parser.settingsDir()); ConfigCommandExecutor(&settings, parser.scope()).execute(parser.command()); } catch (const ConfigCommandLineParser::Error &e) { std::cerr << qPrintable(e.message()) << std::endl; parser.printUsage(); return EXIT_FAILURE; } catch (const qbs::ErrorInfo &e) { std::cerr << qPrintable(e.toString()) << std::endl; return EXIT_FAILURE; } } qbs-src-3.2.0/src/app/config/CMakeLists.txt0000644000175100017510000000041315154533055020054 0ustar runnerrunnerset(SOURCES configcommand.h configcommandexecutor.cpp configcommandexecutor.h configcommandlineparser.cpp configcommandlineparser.h configmain.cpp ) add_qbs_app(qbs-config DEPENDS qbscore qbsconsolelogger SOURCES ${SOURCES} ) qbs-src-3.2.0/src/app/config/configcommandexecutor.h0000644000175100017510000000512515154533055022055 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 CONFIGCOMMANDEXECUTOR_H #define CONFIGCOMMANDEXECUTOR_H #include #include class ConfigCommand; class ConfigCommandExecutor { Q_DECLARE_TR_FUNCTIONS(ConfigCommandExecutor) public: ConfigCommandExecutor(qbs::Settings *settings, qbs::Settings::Scopes scope); void execute(const ConfigCommand &command); private: void setValue(const QString &key, const QString &rawInput); void printSettings(const ConfigCommand &command); void printOneSetting(const QString &key); void exportSettings(const QString &filename); void importSettings(const QString &filename); qbs::Settings *m_settings; const qbs::Settings::Scopes m_scope; }; #endif // CONFIGCOMMANDEXECUTOR_H qbs-src-3.2.0/src/app/config/configcommandlineparser.cpp0000644000175100017510000001635415154533055022724 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "configcommandlineparser.h" #include #include #include using namespace qbs; using namespace Internal; void ConfigCommandLineParser::parse(const QStringList &commandLine) { m_command = ConfigCommand(); m_helpRequested = false; m_settingsDir.clear(); m_commandLine = commandLine; if (m_commandLine.empty()) throw Error(Tr::tr("No parameters supplied.")); if (m_commandLine.size() == 1 && (m_commandLine.front() == QLatin1String("--help") || m_commandLine.front() == QLatin1String("-h"))) { m_helpRequested = true; return; } while (!m_commandLine.empty() && m_commandLine.front().startsWith(QLatin1String("--"))) { const QString arg = m_commandLine.takeFirst().mid(2); if (arg == QLatin1String("list")) setCommand(ConfigCommand::CfgList); else if (arg == QLatin1String("unset")) setCommand(ConfigCommand::CfgUnset); else if (arg == QLatin1String("export")) setCommand(ConfigCommand::CfgExport); else if (arg == QLatin1String("import")) setCommand(ConfigCommand::CfgImport); else if (arg == QLatin1String("add-profile")) setCommand(ConfigCommand::CfgAddProfile); else if (arg == QLatin1String("settings-dir")) assignOptionArgument(arg, m_settingsDir); else if (arg == QLatin1String("user")) setScope(qbs::Settings::UserScope); else if (arg == QLatin1String("system")) setScope(qbs::Settings::SystemScope); else throw Error(Tr::tr("Unknown option for config command.")); } switch (command().command) { case ConfigCommand::CfgNone: if (m_commandLine.empty()) throw Error(Tr::tr("No parameters supplied.")); if (m_commandLine.size() > 2) throw Error(Tr::tr("Too many arguments.")); m_command.varNames << m_commandLine.front(); if (m_commandLine.size() == 1) { setCommand(ConfigCommand::CfgList); } else { m_command.varValue = m_commandLine.at(1); setCommand(ConfigCommand::CfgSet); } break; case ConfigCommand::CfgUnset: if (m_commandLine.empty()) throw Error(Tr::tr("Need name of variable to unset.")); m_command.varNames = m_commandLine; break; case ConfigCommand::CfgExport: if (m_commandLine.size() != 1) throw Error(Tr::tr("Need name of file to which to export.")); m_command.fileName = m_commandLine.front(); break; case ConfigCommand::CfgImport: if (m_commandLine.size() != 1) throw Error(Tr::tr("Need name of file from which to import.")); m_command.fileName = m_commandLine.front(); break; case ConfigCommand::CfgList: m_command.varNames = m_commandLine; break; case ConfigCommand::CfgAddProfile: if (m_commandLine.empty()) throw Error(Tr::tr("Profile name missing.")); m_command.varValue = m_commandLine.takeFirst(); if (m_command.varValue.isEmpty()) throw Error(Tr::tr("Profile name must not be empty.")); m_command.varNames = m_commandLine; if (m_command.varNames.isEmpty()) throw Error(Tr::tr("Profile properties must be provided.")); if (m_command.varNames.size() % 2 != 0) throw Error(Tr::tr("Profile properties must be key/value pairs.")); for (const auto &varName : std::as_const(m_command.varNames)) { if (varName.isEmpty()) throw Error(Tr::tr("Property names must not be empty.")); } break; default: break; } } void ConfigCommandLineParser::setCommand(ConfigCommand::Command command) { if (m_command.command != ConfigCommand::CfgNone) throw Error(Tr::tr("You cannot specify more than one command.")); m_command.command = command; } void ConfigCommandLineParser::setScope(Settings::Scope scope) { if (m_scope != qbs::Settings::allScopes()) throw Error(Tr::tr("The --user and --system options can only appear once.")); m_scope = scope; } void ConfigCommandLineParser::printUsage() const { std::puts("Usage:\n" " qbs config [--settings-dir \n" " qbs config [--settings-dir \n" " qbs config [--settings-dir " "\n" "Options:\n" " --list [ ...] list keys under key or all keys\n" " --user consider only user-level settings\n" " --system consider only system-level settings\n" " --unset remove key with given name\n" " --add-profile ... add profile with the given name and properties\n" " --import import settings from given file\n" " --export export settings to given file\n"); } void ConfigCommandLineParser::assignOptionArgument(const QString &option, QString &argument) { if (m_commandLine.empty()) throw Error(Tr::tr("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) throw Error(Tr::tr("Argument for option '%1' must not be empty.").arg(option)); } qbs-src-3.2.0/src/app/config/configcommandlineparser.h0000644000175100017510000000566115154533055022370 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 COMMANDLINEPARSER_H #define COMMANDLINEPARSER_H #include "configcommand.h" #include #include class ConfigCommandLineParser { public: void parse(const QStringList &commandLine); ConfigCommand command() const { return m_command; } qbs::Settings::Scopes scope() const { return m_scope; } QString settingsDir() const { return m_settingsDir; } bool helpRequested() const { return m_helpRequested; } void printUsage() const; class Error { public: Error(QString message) : m_message(std::move(message)) { } QString message() const { return m_message; } private: QString m_message; }; private: void assignOptionArgument(const QString &option, QString &argument); void setCommand(ConfigCommand::Command command); void setScope(qbs::Settings::Scope scope); ConfigCommand m_command; qbs::Settings::Scopes m_scope = qbs::Settings::allScopes(); bool m_helpRequested = false; QString m_settingsDir; QStringList m_commandLine; }; #endif // COMMANDLINEPARSER_H qbs-src-3.2.0/src/app/config/configcommandexecutor.cpp0000644000175100017510000002053215154533055022407 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "configcommandexecutor.h" #include "configcommand.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include #include #include #include using namespace qbs; static QJsonObject settingsToJSONObject( Settings &settings, qbs::Settings::Scopes scopes, const QString &parentGroup = {}) { QJsonObject result; const auto allKeys = settings.directChildren(parentGroup, scopes); for (const auto& key : allKeys) { const auto fullKey = parentGroup.isEmpty() ? key : QStringLiteral("%1.%2").arg(parentGroup, key); const auto value = settings.value(fullKey, scopes); if (value.isValid()) { // looks like a real value result[key] = QJsonValue::fromVariant(value); } else { // looks like a group result[key] = settingsToJSONObject(settings, scopes, fullKey); } } return result; } static void settingsFromJSONObject( Settings &settings, const QJsonObject &object, const QString &parentGroup = {}) { for (auto it = object.begin(), end = object.end(); it != end; ++it) { const auto key = it.key(); const auto value = it.value(); const auto fullKey = parentGroup.isEmpty() ? key : QStringLiteral("%1.%2").arg(parentGroup, key); if (value.isObject()) { settingsFromJSONObject(settings, it.value().toObject(), fullKey); } else { settings.setValue(fullKey, value.toVariant()); } } } ConfigCommandExecutor::ConfigCommandExecutor(Settings *settings, Settings::Scopes scope) : m_settings(settings), m_scope(scope) { if (m_scope == qbs::Settings::SystemScope) m_settings->setScopeForWriting(qbs::Settings::SystemScope); } void ConfigCommandExecutor::execute(const ConfigCommand &command) { switch (command.command) { case ConfigCommand::CfgList: printSettings(command); break; case ConfigCommand::CfgSet: setValue(command.varNames.front(), command.varValue); break; case ConfigCommand::CfgUnset: for (const QString &varName : command.varNames) m_settings->remove(varName); break; case ConfigCommand::CfgAddProfile: { Profile profile(command.varValue, m_settings); profile.removeProfile(); Q_ASSERT(command.varNames.size() % 2 == 0); for (int i = 0; i < command.varNames.size(); i += 2) { const QString &key = command.varNames.at(i); const QString &rawValue = command.varNames.at(i + 1); profile.setValue(key, representationToSettingsValue(rawValue)); } break; } case ConfigCommand::CfgExport: exportSettings(command.fileName); break; case ConfigCommand::CfgImport: // Display old and new settings, in case import fails or user accidentally nukes everything std::printf("old "); // Will end up as "old settings:" printSettings(command); importSettings(command.fileName); std::printf("\nnew "); printSettings(command); break; case ConfigCommand::CfgNone: qFatal("%s: Impossible command value.", Q_FUNC_INFO); break; } } void ConfigCommandExecutor::setValue(const QString &key, const QString &rawInput) { m_settings->setValue(key, representationToSettingsValue(rawInput)); } void ConfigCommandExecutor::printSettings(const ConfigCommand &command) { if (command.varNames.empty()) { const auto keys = m_settings->allKeys(m_scope); for (const QString &key : keys) printOneSetting(key); } else { for (const QString &parentKey : command.varNames) { if (m_settings->value(parentKey, m_scope).isValid()) { // Key is a leaf. printOneSetting(parentKey); } else { // Key is a node. const auto keys = m_settings->allKeysWithPrefix(parentKey, m_scope); for (const QString &key : keys) printOneSetting(parentKey + QLatin1Char('.') + key); } } } } void ConfigCommandExecutor::printOneSetting(const QString &key) { std::printf("%s: %s\n", qPrintable(key), qPrintable(qbs::settingsValueToRepresentation(m_settings->value(key, m_scope)))); } void ConfigCommandExecutor::exportSettings(const QString &filename) { QFile file(filename); if (!file.open(QFile::Truncate | QFile::WriteOnly | QFile::Text)) { throw ErrorInfo(tr("Could not open file '%1' for writing: %2") .arg(QDir::toNativeSeparators(filename), file.errorString())); } if (QFileInfo(filename).suffix() == u"json") { QJsonDocument doc; doc.setObject(settingsToJSONObject(*m_settings, m_scope)); file.write(doc.toJson()); } else { QTextStream stream(&file); setupDefaultCodec(stream); const auto keys = m_settings->allKeys(m_scope); for (const QString &key : keys) stream << key << ": " << qbs::settingsValueToRepresentation(m_settings->value(key, m_scope)) << Qt::endl; } } void ConfigCommandExecutor::importSettings(const QString &filename) { QFile file(filename); if (!file.open(QFile::ReadOnly | QFile::Text)) { throw ErrorInfo(tr("Could not open file '%1' for reading: %2") .arg(QDir::toNativeSeparators(filename), file.errorString())); } // Remove all current settings const auto keys = m_settings->allKeys(m_scope); for (const QString &key : keys) m_settings->remove(key); if (QFileInfo(filename).suffix() == u"json") { const auto doc = QJsonDocument::fromJson(file.readAll()); const auto object = doc.object(); settingsFromJSONObject(*m_settings, doc.object()); } else { QTextStream stream(&file); setupDefaultCodec(stream); while (!stream.atEnd()) { QString line = stream.readLine(); int colon = line.indexOf(QLatin1Char(':')); if (colon >= 0 && !line.startsWith(QLatin1Char('#'))) { const QString key = line.left(colon).trimmed(); const QString value = line.mid(colon + 1).trimmed(); m_settings->setValue(key, representationToSettingsValue(value)); } } } } qbs-src-3.2.0/src/app/CMakeLists.txt0000644000175100017510000000036315154533055016613 0ustar runnerrunneradd_subdirectory(config) add_subdirectory(config-ui) add_subdirectory(qbs) add_subdirectory(qbs-create-project) add_subdirectory(qbs-setup-android) add_subdirectory(qbs-setup-qt) add_subdirectory(qbs-setup-toolchains) add_subdirectory(shared) qbs-src-3.2.0/src/app/qbs-setup-qt/0000755000175100017510000000000015154533055016416 5ustar runnerrunnerqbs-src-3.2.0/src/app/qbs-setup-qt/main.cpp0000644000175100017510000001074315154533055020053 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "setupqt.h" #include "commandlineparser.h" #include #include #include #include #include #include #include #include using namespace qbs; using Internal::Tr; int main(int argc, char *argv[]) { QCoreApplication application(argc, argv); try { CommandLineParser clParser; clParser.parse(application.arguments()); if (clParser.helpRequested()) { std::cout << qPrintable(clParser.usageString()) << std::endl; return EXIT_SUCCESS; } Settings settings(clParser.settingsDir()); settings.setScopeForWriting(clParser.settingsScope()); if (clParser.autoDetectionMode()) { // search all Qt's in path and dump their settings const std::vector qtEnvironments = SetupQt::fetchEnvironments(); if (qtEnvironments.empty()) { std::cout << qPrintable(Tr::tr("No Qt installations detected. " "No profiles created.")) << std::endl; } for (const QtEnvironment &qtEnvironment : qtEnvironments) { QString profileName = QLatin1String("qt-") + qtEnvironment.qtVersion.toString(); if (SetupQt::checkIfMoreThanOneQtWithTheSameVersion(qtEnvironment.qtVersion, qtEnvironments)) { QStringList prefixPathParts = QFileInfo(qtEnvironment.qmakeFilePath).path() .split(QLatin1Char('/'), Qt::SkipEmptyParts); if (!prefixPathParts.empty()) profileName += QLatin1String("-") + prefixPathParts.last(); } SetupQt::saveToQbsSettings(profileName, qtEnvironment, &settings); } return EXIT_SUCCESS; } if (!SetupQt::isQMakePathValid(clParser.qmakePath())) { std::cerr << qPrintable(Tr::tr("'%1' does not seem to be a qmake executable.") .arg(clParser.qmakePath())) << std::endl; return EXIT_FAILURE; } const QtEnvironment qtEnvironment = SetupQt::fetchEnvironment(clParser.qmakePath()); QString profileName = clParser.profileName(); profileName.replace(QLatin1Char('.'), QLatin1Char('-')); SetupQt::saveToQbsSettings(profileName, qtEnvironment, &settings); return EXIT_SUCCESS; } catch (const ErrorInfo &e) { std::cerr << qPrintable(e.toString()) << std::endl; return EXIT_FAILURE; } } qbs-src-3.2.0/src/app/qbs-setup-qt/qbs-setup-qt.qbs0000644000175100017510000000077315154533055021501 0ustar runnerrunnerQbsApp { name: "qbs-setup-qt" files: [ "commandlineparser.cpp", "commandlineparser.h", "main.cpp", "setupqt.cpp", "setupqt.h" ] Group { name: "MinGW specific files" condition: qbs.toolchain.contains("mingw") files: "qbs-setup-qt.rc" Group { name: "qbs-setup-qt manifest" files: "qbs-setup-qt.exe.manifest" fileTags: [] // the manifest is referenced by the rc file } } } qbs-src-3.2.0/src/app/qbs-setup-qt/setupqt.cpp0000644000175100017510000003542115154533055020634 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "setupqt.h" #include "../shared/logging/consolelogger.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { using Internal::none_of; using Internal::contains; using Internal::HostOsInfo; using Internal::Tr; using Internal::rangeTo; static QStringList qmakeExecutableNames() { const QString baseName = HostOsInfo::appendExecutableSuffix(QStringLiteral("qmake")); QStringList lst(baseName); if (HostOsInfo::isLinuxHost()) { // Some distributions ship binaries called qmake-qt5 or qmake-qt4. lst << baseName + QLatin1String("-qt5") << baseName + QLatin1String("-qt4"); } return lst; } static QStringList collectQmakePaths() { const QStringList qmakeExeNames = qmakeExecutableNames(); QStringList qmakePaths; QByteArray environmentPath = qgetenv("PATH"); const QList environmentPaths = environmentPath.split(HostOsInfo::pathListSeparator().toLatin1()); for (const QByteArray &path : environmentPaths) { for (const QString &qmakeExecutableName : qmakeExeNames) { QFileInfo pathFileInfo(QDir(QLatin1String(path)), qmakeExecutableName); if (pathFileInfo.exists()) { QString qmakePath = pathFileInfo.absoluteFilePath(); if (!qmakePaths.contains(qmakePath)) qmakePaths.push_back(qmakePath); } } } return qmakePaths; } bool SetupQt::isQMakePathValid(const QString &qmakePath) { QFileInfo qmakeFileInfo(qmakePath); return qmakeFileInfo.exists() && qmakeFileInfo.isFile() && qmakeFileInfo.isExecutable(); } std::vector SetupQt::fetchEnvironments() { std::vector qtEnvironments; const auto qmakePaths = collectQmakePaths(); for (const QString &qmakePath : qmakePaths) { const QtEnvironment env = fetchEnvironment(qmakePath); if (none_of(qtEnvironments, [&env](const QtEnvironment &otherEnv) { return env.qmakeFilePath == otherEnv.qmakeFilePath; })) { qtEnvironments.push_back(env); } } return qtEnvironments; } // These functions work only for Qt from installer. static QStringList qbsToolchainFromDirName(const QString &dir) { if (dir.startsWith(QLatin1String("msvc"))) return {QStringLiteral("msvc")}; if (dir.startsWith(QLatin1String("mingw"))) return {QStringLiteral("mingw"), QStringLiteral("gcc")}; if (dir.startsWith(QLatin1String("clang"))) return {QStringLiteral("clang"), QStringLiteral("llvm"), QStringLiteral("gcc")}; if (dir.startsWith(QLatin1String("gcc"))) return {QStringLiteral("gcc")}; return {}; } static Version vcVersionFromDirName(const QString &dir) { static const std::regex regexp("^msvc(\\d\\d\\d\\d).*$"); std::smatch match; const std::string dirString = dir.toStdString(); if (!std::regex_match(dirString, match, regexp)) return Version{}; // see https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd QMap mapping{ std::make_pair("2005", "8"), std::make_pair("2008", "9"), std::make_pair("2010", "10"), std::make_pair("2012", "11"), std::make_pair("2013", "12"), std::make_pair("2015", "14"), std::make_pair("2017", "14.10"), std::make_pair("2019", "14.20"), std::make_pair("2022", "14.30")}; return Version::fromString(QString::fromStdString(mapping.value(match[1].str()))); } static Version vcVersionFromToolchainInstallPath(const QString &toolchainPath) { // e.g. 14.40.33807\bin\Hostx64\x64 QDir dir(toolchainPath); dir.cdUp(); dir.cdUp(); dir.cdUp(); return Version::fromString(dir.dirName()); } static QString archFromDirName(const QString &dir) { static const std::regex regexp("^[^_]+_(.*).*$"); std::smatch match; const std::string dirString = dir.toStdString(); if (!std::regex_match(dirString, match, regexp)) return {}; QString arch = QString::fromStdString(match[1]); if (arch == QLatin1String("32")) return QStringLiteral("x86"); if (arch == QLatin1String("64")) return QStringLiteral("x86_64"); if (arch.contains(QLatin1String("arm64"))) return QStringLiteral("arm64"); return arch; } static QString platformFromDirName(const QString &dir) { if (dir.startsWith(QLatin1String("android"))) return QStringLiteral("android"); if (dir == QLatin1String("Boot2Qt")) return QStringLiteral("linux"); return HostOsInfo::hostOSIdentifier(); } QtEnvironment SetupQt::fetchEnvironment(const QString &qmakePath) { QtEnvironment env; env.qmakeFilePath = qmakePath; QDir qtDir = QFileInfo(qmakePath).dir(); if (qtDir.dirName() == QLatin1String("bin")) { qtDir.cdUp(); env.qbsToolchain = qbsToolchainFromDirName(qtDir.dirName()); env.vcVersion = vcVersionFromDirName(qtDir.dirName()); env.architecture = archFromDirName(qtDir.dirName()); if (env.vcVersion.isValid() && env.architecture.isEmpty()) env.architecture = QStringLiteral("x86"); env.targetPlatform = platformFromDirName(qtDir.dirName()); qtDir.cdUp(); env.qtVersion = Version::fromString(qtDir.dirName()); } return env; } static bool isToolchainProfile(const Profile &profile) { const auto actual = rangeTo>( profile.allKeys(Profile::KeySelectionRecursive)); Internal::Set expected{ QStringLiteral("qbs.toolchainType") }; if (HostOsInfo::isMacosHost()) expected.insert(QStringLiteral("qbs.targetPlatform")); // match only Xcode profiles return Internal::Set(actual).unite(expected) == actual; } static bool isQtProfile(const Profile &profile) { if (!profile.value(QStringLiteral("moduleProviders.Qt.qmakeFilePaths")).toStringList() .empty()) { return true; } // For Profiles created with setup-qt < 5.13. const QStringList searchPaths = profile.value(QStringLiteral("preferences.qbsSearchPaths")).toStringList(); return Internal::any_of(searchPaths, [] (const QString &path) { return QFileInfo(path + QStringLiteral("/modules/Qt")).isDir(); }); } template bool areProfilePropertiesIncompatible(const T &set1, const T &set2) { // Two objects are only considered incompatible if they are both non empty and compare inequal // This logic is used for comparing target OS, toolchain lists, and architectures return set1.size() > 0 && set2.size() > 0 && set1 != set2; } enum Match { MatchFull, MatchPartial, MatchNone }; static Match compatibility(const QtEnvironment &env, const Profile &toolchainProfile) { Match match = MatchFull; const auto toolchainType = toolchainProfile.value(QStringLiteral("qbs.toolchainType")).toString(); const auto toolchain = !toolchainType.isEmpty() ? canonicalToolchain(toolchainType) : toolchainProfile.value(QStringLiteral("qbs.toolchain")).toStringList(); const auto toolchainNames = rangeTo>(toolchain); const auto qtToolchainNames = rangeTo>(env.qbsToolchain); if (areProfilePropertiesIncompatible(toolchainNames, qtToolchainNames)) { auto intersection = toolchainNames; intersection.intersect(qtToolchainNames); if (!intersection.empty()) match = MatchPartial; else return MatchNone; } const auto targetPlatform = toolchainProfile.value( QStringLiteral("qbs.targetPlatform")).toString(); if (!targetPlatform.isEmpty() && targetPlatform != env.targetPlatform) return MatchNone; const QString toolchainArchitecture = toolchainProfile.value(QStringLiteral("qbs.architecture")) .toString(); if (areProfilePropertiesIncompatible(canonicalArchitecture(env.architecture), canonicalArchitecture(toolchainArchitecture))) return MatchNone; if (toolchainType == QStringLiteral("msvc") && env.vcVersion.isValid()) { // We want to know for sure that MSVC compiler versions match, // because it's especially important for this toolchain const Version compilerVersion = vcVersionFromToolchainInstallPath( toolchainProfile.value(QStringLiteral("cpp.toolchainInstallPath")).toString()); static const Version vs2017Version{14, 10}; if (env.vcVersion >= vs2017Version) { if (env.vcVersion.majorVersion() != compilerVersion.majorVersion() || compilerVersion < vs2017Version) { return MatchNone; } } else if ( env.vcVersion.majorVersion() != compilerVersion.majorVersion() || env.vcVersion.minorVersion() != compilerVersion.minorVersion()) { return MatchNone; } } return match; } QString profileNameWithoutHostArch(const QString &profileName) { QString result; int i = profileName.indexOf(QLatin1Char('-')); if (i == -1) return result; ++i; int j = profileName.indexOf(QLatin1Char('_'), i); if (j == -1) return result; result = profileName.mid(0, i) + profileName.mid(j + 1); return result; } // "Compressing" MSVC profiles means that if MSVC2017-x64 and MSVC2017-x86_x64 fully match, // then we drop the crosscompiling toolchain MSVC2017-x86_x64. static void compressMsvcProfiles(QStringList &profiles) { Internal::removeIf(profiles, [&profiles] (const QString &profileName) { int idx = profileName.indexOf(QLatin1Char('_')); if (idx == -1) return false; return contains(profiles, profileNameWithoutHostArch(profileName)); }); } void SetupQt::saveToQbsSettings(const QString &qtVersionName, const QtEnvironment &qtEnvironment, Settings *settings) { const QString cleanQtVersionName = Profile::cleanName(qtVersionName); QString msg = QCoreApplication::translate("SetupQt", "Creating profile '%1'.") .arg(cleanQtVersionName); std::printf("%s\n", qPrintable(msg)); Profile profile(cleanQtVersionName, settings); profile.removeProfile(); profile.setValue(QStringLiteral("moduleProviders.Qt.qmakeFilePaths"), QStringList(qtEnvironment.qmakeFilePath)); if (!profile.baseProfile().isEmpty()) return; if (isToolchainProfile(profile)) return; QStringList fullMatches; QStringList partialMatches; const auto profileNames = settings->profiles(); for (const QString &profileName : profileNames) { const Profile otherProfile(profileName, settings); if (profileName == profile.name() || !isToolchainProfile(otherProfile) || isQtProfile(otherProfile)) continue; switch (compatibility(qtEnvironment, otherProfile)) { case MatchFull: fullMatches << profileName; break; case MatchPartial: partialMatches << profileName; break; default: break; } } if (fullMatches.size() > 1) compressMsvcProfiles(fullMatches); QString bestMatch; if (fullMatches.size() == 1) bestMatch = fullMatches.front(); else if (fullMatches.empty() && partialMatches.size() == 1) bestMatch = partialMatches.front(); if (bestMatch.isEmpty()) { QString message = Tr::tr("You may want to set up toolchain information " "for the generated Qt profile. "); if (!fullMatches.empty() || !partialMatches.empty()) { message += Tr::tr("Consider setting one of these profiles as this profile's base " "profile: %1.").arg((fullMatches + partialMatches) .join(QLatin1String(", "))); } qbsInfo() << message; } else { profile.setBaseProfile(bestMatch); qbsInfo() << Tr::tr("Setting profile '%1' as the base profile for this profile.") .arg(bestMatch); } } bool SetupQt::checkIfMoreThanOneQtWithTheSameVersion(const Version &qtVersion, const std::vector &qtEnvironments) { bool foundOneVersion = false; for (const QtEnvironment &qtEnvironment : qtEnvironments) { if (qtEnvironment.qtVersion == qtVersion) { if (foundOneVersion) return true; foundOneVersion = true; } } return false; } } // namespace qbs qbs-src-3.2.0/src/app/qbs-setup-qt/qbs-setup-qt.rc0000644000175100017510000000022015154533055021303 0ustar runnerrunner#define RT_MANIFEST 24 #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "qbs-setup-qt.exe.manifest" qbs-src-3.2.0/src/app/qbs-setup-qt/setupqt.h0000644000175100017510000000557315154533055020306 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SETUPQT_H #define QBS_SETUPQT_H #include #include #include #include #include namespace qbs { class Settings; class QtEnvironment { public: QString qmakeFilePath; QStringList qbsToolchain; QString architecture; QString targetPlatform; Version qtVersion; Version vcVersion; }; class SetupQt { Q_DECLARE_TR_FUNCTIONS(SetupQt) public: static bool isQMakePathValid(const QString &qmakePath); static std::vector fetchEnvironments(); static QtEnvironment fetchEnvironment(const QString &qmakePath); static bool checkIfMoreThanOneQtWithTheSameVersion(const Version &qtVersion, const std::vector &qtEnvironments); static void saveToQbsSettings(const QString &qtVersionName, const QtEnvironment &qtEnvironment, Settings *settings); }; } // namespace qbs #endif // QBS_SETUPQT_H qbs-src-3.2.0/src/app/qbs-setup-qt/CMakeLists.txt0000644000175100017510000000031315154533055021153 0ustar runnerrunnerset(SOURCES commandlineparser.cpp commandlineparser.h main.cpp setupqt.cpp setupqt.h ) add_qbs_app(qbs-setup-qt DEPENDS qbscore qbsconsolelogger SOURCES ${SOURCES} ) qbs-src-3.2.0/src/app/qbs-setup-qt/commandlineparser.h0000644000175100017510000000573115154533055022300 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SETUPTOOLCHAINS_COMMANDLINEPARSER_H #define QBS_SETUPTOOLCHAINS_COMMANDLINEPARSER_H #include #include class CommandLineParser { public: void parse(const QStringList &commandLine); bool helpRequested() const { return m_helpRequested; } bool autoDetectionMode() const { return m_autoDetectionMode; } QString qmakePath() const { return m_qmakePath; } QString profileName() const { return m_profileName; } QString settingsDir() const { return m_settingsDir; } qbs::Settings::Scope settingsScope() const { return m_settingsScope; } QString usageString() const; private: [[noreturn]] void throwError(const QString &message); void assignOptionArgument(const QString &option, QString &argument); [[noreturn]] void complainAboutExtraArguments(); bool m_helpRequested = false; bool m_autoDetectionMode = false; qbs::Settings::Scope m_settingsScope = qbs::Settings::UserScope; QString m_qmakePath; QString m_profileName; QString m_settingsDir; QStringList m_commandLine; QString m_command; }; #endif // Include guard qbs-src-3.2.0/src/app/qbs-setup-qt/commandlineparser.cpp0000644000175100017510000001241615154533055022631 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "commandlineparser.h" #include #include #include using qbs::Internal::Tr; static QString helpOptionShort() { return QStringLiteral("-h"); } static QString helpOptionLong() { return QStringLiteral("--help"); } static QString detectOption() { return QStringLiteral("--detect"); } static QString settingsDirOption() { return QStringLiteral("--settings-dir"); } static QString systemOption() { return QStringLiteral("--system"); } void CommandLineParser::parse(const QStringList &commandLine) { m_commandLine = commandLine; Q_ASSERT(!m_commandLine.empty()); m_command = QFileInfo(m_commandLine.takeFirst()).fileName(); m_helpRequested = false; m_autoDetectionMode = false; m_qmakePath.clear(); m_profileName.clear(); m_settingsDir.clear(); if (m_commandLine.empty()) throwError(Tr::tr("No command-line arguments provided.")); while (!m_commandLine.empty()) { const QString arg = m_commandLine.front(); if (!arg.startsWith(QLatin1Char('-'))) break; m_commandLine.removeFirst(); if (arg == helpOptionShort() || arg == helpOptionLong()) m_helpRequested = true; else if (arg == detectOption()) m_autoDetectionMode = true; else if (arg == systemOption()) m_settingsScope = qbs::Settings::SystemScope; else if (arg == settingsDirOption()) assignOptionArgument(settingsDirOption(), m_settingsDir); } if (m_helpRequested || m_autoDetectionMode) { if (!m_commandLine.empty()) complainAboutExtraArguments(); return; } switch (m_commandLine.size()) { case 0: case 1: throwError(Tr::tr("Not enough command-line arguments provided.")); case 2: m_qmakePath = m_commandLine.at(0); m_profileName = m_commandLine.at(1); break; default: complainAboutExtraArguments(); } } void CommandLineParser::throwError(const QString &message) { qbs::ErrorInfo error(Tr::tr("Syntax error: %1").arg(message)); error.append(usageString()); throw error; } QString CommandLineParser::usageString() const { QString s = Tr::tr("This tool creates qbs profiles from Qt versions.\n"); s += Tr::tr("Usage:\n"); s += Tr::tr(" %1 [%2 ] [%4] %3\n") .arg(m_command, settingsDirOption(), detectOption(), systemOption()); s += Tr::tr(" %1 [%2 ] [%4] \n") .arg(m_command, settingsDirOption(), systemOption()); s += Tr::tr(" %1 %2|%3\n").arg(m_command, helpOptionShort(), helpOptionLong()); s += Tr::tr("The first form tries to auto-detect all known Qt versions, looking them up " "via the PATH environment variable.\n"); s += Tr::tr("The second form creates one profile for one Qt version."); return s; } void CommandLineParser::assignOptionArgument(const QString &option, QString &argument) { if (m_commandLine.empty()) throwError(Tr::tr("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) throwError(Tr::tr("Argument for option '%1' must not be empty.").arg(option)); } void CommandLineParser::complainAboutExtraArguments() { throwError(Tr::tr("Extraneous command-line arguments '%1'.") .arg(m_commandLine.join(QLatin1Char(' ')))); } qbs-src-3.2.0/src/app/qbs-setup-qt/qbs-setup-qt.exe.manifest0000644000175100017510000000072615154533055023300 0ustar runnerrunner qbs-src-3.2.0/src/app/qbs-setup-android/0000755000175100017510000000000015154533055017412 5ustar runnerrunnerqbs-src-3.2.0/src/app/qbs-setup-android/qbs-setup-android.exe.manifest0000644000175100017510000000073315154533055025266 0ustar runnerrunner qbs-src-3.2.0/src/app/qbs-setup-android/main.cpp0000644000175100017510000000545215154533055021050 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "commandlineparser.h" #include "android-setup.h" #include #include #include #include #include #include int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); CommandLineParser clParser; try { clParser.parse(app.arguments()); if (clParser.helpRequested()) { std::cout << qPrintable(clParser.usageString()) << std::endl; return EXIT_SUCCESS; } qbs::Settings settings(clParser.settingsDir()); settings.setScopeForWriting(clParser.settingsScope()); setupAndroid(&settings, clParser.profileName(), clParser.sdkDir(), clParser.ndkDir(), clParser.qtSdkDir()); } catch (const qbs::ErrorInfo &e) { std::cerr << qPrintable(qbs::Internal::Tr::tr("Error: %1").arg(e.toString())) << std::endl; return EXIT_FAILURE; } } qbs-src-3.2.0/src/app/qbs-setup-android/CMakeLists.txt0000644000175100017510000000033415154533055022152 0ustar runnerrunnerset(SOURCES android-setup.cpp android-setup.h commandlineparser.cpp commandlineparser.h main.cpp ) add_qbs_app(qbs-setup-android DEPENDS qbscore qbsconsolelogger SOURCES ${SOURCES} ) qbs-src-3.2.0/src/app/qbs-setup-android/qbs-setup-android.qbs0000644000175100017510000000103415154533055023460 0ustar runnerrunnerQbsApp { name: "qbs-setup-android" files: [ "android-setup.cpp", "android-setup.h", "commandlineparser.cpp", "commandlineparser.h", "main.cpp", ] Group { name: "MinGW specific files" condition: qbs.toolchain.contains("mingw") files: "qbs-setup-android.rc" Group { name: "qbs-setup-android manifest" files: "qbs-setup-android.exe.manifest" fileTags: [] // the manifest is referenced by the rc file } } } qbs-src-3.2.0/src/app/qbs-setup-android/android-setup.cpp0000644000175100017510000002313215154533055022675 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "android-setup.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace qbs; using qbs::Internal::Tr; static QString qls(const char *s) { return QLatin1String(s); } static QStringList expectedArchs() { return {QStringLiteral("arm64"), QStringLiteral("armv7a"), QStringLiteral("x86"), QStringLiteral("x86_64")}; } void setupSdk(qbs::Settings *settings, const QString &profileName, const QString &sdkDirPath) { if (!QDir(sdkDirPath).exists()) { throw ErrorInfo(Tr::tr("SDK directory '%1' does not exist.") .arg(QDir::toNativeSeparators(sdkDirPath))); } Profile profile(profileName, settings); profile.removeProfile(); if (!sdkDirPath.isEmpty()) profile.setValue(qls("Android.sdk.sdkDir"), QDir::cleanPath(sdkDirPath)); profile.setValue(qls("qbs.targetPlatform"), qls("android")); } static QString mapArch(const QString &androidName) { if (androidName == qls("arm64-v8a")) return qls("arm64"); if (androidName == qls("armeabi")) return qls("armv5te"); if (androidName == qls("armeabi-v7a")) return qls("armv7a"); return androidName; } struct QtAndroidInfo { bool isValid() const { return !archs.isEmpty(); } QString qmakePath; QStringList archs; QString platform; }; static QtAndroidInfo getInfoForQtDir(const QString &qtDir) { QtAndroidInfo info; info.qmakePath = qbs::Internal::HostOsInfo::appendExecutableSuffix(qtDir + qls("/bin/qmake")); if (!QFile::exists(info.qmakePath)) return info; QFile qdevicepri(qtDir + qls("/mkspecs/qdevice.pri")); if (!qdevicepri.open(QIODevice::ReadOnly)) return info; while (!qdevicepri.atEnd()) { // For Qt < 5.14 use DEFAULT_ANDROID_TARGET_ARCH (which is the abi) to compute // the architecture // DEFAULT_ANDROID_ABIS doesn't exit // For Qt >= 5.14: // DEFAULT_ANDROID_TARGET_ARCH doesn't exist, use DEFAULT_ANDROID_ABIS to compute // the architectures const QByteArray line = qdevicepri.readLine().simplified(); const bool isArchLine = line.startsWith("DEFAULT_ANDROID_TARGET_ARCH"); const bool isAbisLine = line.startsWith("DEFAULT_ANDROID_ABIS"); const bool isPlatformLine = line.startsWith("DEFAULT_ANDROID_PLATFORM"); if (!isArchLine && !isPlatformLine && !isAbisLine) continue; const QList elems = line.split('='); if (elems.size() != 2) continue; const QString rhs = QString::fromLatin1(elems.at(1).trimmed()); if (isArchLine) { info.archs << mapArch(rhs); } else if (isAbisLine) { const auto abis = rhs.split(QLatin1Char(' ')); for (const QString &abi: abis) info.archs << mapArch(abi); } else { info.platform = rhs; } } return info; } using QtInfoPerArch = QHash; static QtInfoPerArch getQtAndroidInfo(const QString &qtSdkDir) { QtInfoPerArch archs; if (qtSdkDir.isEmpty()) return archs; QStringList qtDirs(qtSdkDir); const QStringList nameFilters{QStringLiteral("android_*"), QStringLiteral("android")}; QDirIterator dit(qtSdkDir, nameFilters, QDir::Dirs); while (dit.hasNext()) qtDirs << dit.next(); for (const auto &qtDir : std::as_const(qtDirs)) { const QtAndroidInfo info = getInfoForQtDir(qtDir); if (info.isValid()) { for (const QString &arch: info.archs) archs.insert(arch, info); } } return archs; } static QString maximumPlatform(const QString &platform1, const QString &platform2) { if (platform1.isEmpty()) return platform2; if (platform2.isEmpty()) return platform1; static const QString prefix = qls("android-"); const QString numberString1 = platform1.mid(prefix.size()); const QString numberString2 = platform2.mid(prefix.size()); bool ok; const int value1 = numberString1.toInt(&ok); if (!ok) { qWarning("Ignoring malformed Android platform string '%s'.", qPrintable(platform1)); return platform2; } const int value2 = numberString2.toInt(&ok); if (!ok) { qWarning("Ignoring malformed Android platform string '%s'.", qPrintable(platform2)); return platform1; } return prefix + QString::number(std::max(value1, value2)); } static QString getToolchainType(const QString &ndkDirPath) { QFile sourceProperties(ndkDirPath + qls("/source.properties")); if (!sourceProperties.open(QIODevice::ReadOnly)) return QStringLiteral("gcc"); // <= r10 while (!sourceProperties.atEnd()) { const QByteArray curLine = sourceProperties.readLine().simplified(); static const QByteArray prefix = "Pkg.Revision = "; if (!curLine.startsWith(prefix)) continue; qbs::Version ndkVersion = qbs::Version::fromString( QString::fromLatin1(curLine.mid(prefix.size()))); if (!ndkVersion.isValid()) { qWarning("Unexpected format of NDK revision string in '%s'", qPrintable(sourceProperties.fileName())); return QStringLiteral("clang"); } return qls(ndkVersion.majorVersion() >= 18 ? "clang" : "gcc"); } qWarning("No revision entry found in '%s'", qPrintable(sourceProperties.fileName())); return QStringLiteral("clang"); } static void setupNdk(qbs::Settings *settings, const QString &profileName, const QString &ndkDirPath, const QString &qtSdkDirPath) { if (!QDir(ndkDirPath).exists()) { throw ErrorInfo(Tr::tr("NDK directory '%1' does not exist.") .arg(QDir::toNativeSeparators(ndkDirPath))); } Profile mainProfile(profileName, settings); if (!ndkDirPath.isEmpty()) { mainProfile.setValue(qls("Android.ndk.ndkDir"), QDir::cleanPath(ndkDirPath)); mainProfile.setValue(qls("Android.sdk.ndkDir"), QDir::cleanPath(ndkDirPath)); } mainProfile.setValue(qls("qbs.toolchainType"), getToolchainType(ndkDirPath)); const QStringList archs = expectedArchs(); const QtInfoPerArch infoPerArch = getQtAndroidInfo(qtSdkDirPath); const QStringList archsForProfile = infoPerArch.empty() ? archs : QStringList(infoPerArch.keys()); if (archsForProfile.size() == 1) mainProfile.setValue(qls("qbs.architecture"), archsForProfile.front()); else mainProfile.setValue(qls("qbs.architectures"), archsForProfile); QStringList qmakeFilePaths; QString platform; for (const QString &arch : archs) { const QtAndroidInfo qtAndroidInfo = infoPerArch.value(arch); if (!qtAndroidInfo.isValid()) continue; qmakeFilePaths << qtAndroidInfo.qmakePath; platform = maximumPlatform(platform, qtAndroidInfo.platform); } if (!qmakeFilePaths.empty()) { qmakeFilePaths.removeDuplicates(); mainProfile.setValue(qls("moduleProviders.Qt.qmakeFilePaths"), qmakeFilePaths); } if (!platform.isEmpty()) mainProfile.setValue(qls("Android.ndk.platform"), platform); } void setupAndroid(Settings *settings, const QString &profileName, const QString &sdkDirPath, const QString &ndkDirPath, const QString &qtSdkDirPath) { setupSdk(settings, profileName, sdkDirPath); setupNdk(settings, profileName, ndkDirPath, qtSdkDirPath); } qbs-src-3.2.0/src/app/qbs-setup-android/commandlineparser.h0000644000175100017510000000602015154533055023264 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SETUP_ANDROID_COMMANDLINEPARSER_H #define QBS_SETUP_ANDROID_COMMANDLINEPARSER_H #include #include class CommandLineParser { public: CommandLineParser(); void parse(const QStringList &commandLine); bool helpRequested() const { return m_helpRequested; } QString sdkDir() const { return m_sdkDir; } QString ndkDir() const { return m_ndkDir; } QString qtSdkDir() const { return m_qtSdkDir; } QString profileName() const { return m_profileName; } QString settingsDir() const { return m_settingsDir; } qbs::Settings::Scope settingsScope() const { return m_settingsScope; } QString usageString() const; private: [[noreturn]] void throwError(const QString &message); void assignOptionArgument(const QString &option, QString &argument); [[noreturn]] void complainAboutExtraArguments(); bool m_helpRequested = false; qbs::Settings::Scope m_settingsScope = qbs::Settings::UserScope; QString m_sdkDir; QString m_ndkDir; QString m_qtSdkDir; QString m_profileName; QString m_settingsDir; QStringList m_commandLine; QString m_command; }; #endif // Include guard. qbs-src-3.2.0/src/app/qbs-setup-android/commandlineparser.cpp0000644000175100017510000001336715154533055023633 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "commandlineparser.h" #include #include #include CommandLineParser::CommandLineParser() = default; using qbs::Internal::Tr; static QString helpOptionShort() { return QStringLiteral("-h"); } static QString helpOptionLong() { return QStringLiteral("--help"); } static QString settingsDirOption() { return QStringLiteral("--settings-dir"); } static QString sdkDirOption() { return QStringLiteral("--sdk-dir"); } static QString ndkDirOption() { return QStringLiteral("--ndk-dir"); } static QString qtSdkDirOption() { return QStringLiteral("--qt-dir"); } static QString systemOption() { return QStringLiteral("--system"); } void CommandLineParser::parse(const QStringList &commandLine) { m_commandLine = commandLine; Q_ASSERT(!m_commandLine.empty()); m_command = QFileInfo(m_commandLine.takeFirst()).fileName(); m_helpRequested = false; m_sdkDir.clear(); m_ndkDir.clear(); m_profileName.clear(); m_settingsDir.clear(); if (m_commandLine.empty()) throwError(Tr::tr("No command-line arguments provided.")); while (!m_commandLine.empty()) { const QString arg = m_commandLine.front(); if (!arg.startsWith(QLatin1Char('-'))) break; m_commandLine.removeFirst(); if (arg == helpOptionShort() || arg == helpOptionLong()) m_helpRequested = true; else if (arg == settingsDirOption()) assignOptionArgument(settingsDirOption(), m_settingsDir); else if (arg == systemOption()) m_settingsScope = qbs::Settings::SystemScope; else if (arg == sdkDirOption()) assignOptionArgument(sdkDirOption(), m_sdkDir); else if (arg == ndkDirOption()) assignOptionArgument(ndkDirOption(), m_ndkDir); else if (arg == qtSdkDirOption()) assignOptionArgument(arg, m_qtSdkDir); else throwError(Tr::tr("Unknown option '%1'.").arg(arg)); } if (m_helpRequested) { if (!m_commandLine.empty()) complainAboutExtraArguments(); return; } switch (m_commandLine.size()) { case 0: throwError(Tr::tr("No profile name supplied.")); case 1: m_profileName = m_commandLine.takeFirst(); m_profileName.replace(QLatin1Char('.'), QLatin1Char('-')); break; default: complainAboutExtraArguments(); } } void CommandLineParser::throwError(const QString &message) { qbs::ErrorInfo error(Tr::tr("Syntax error: %1").arg(message)); error.append(usageString()); throw error; } QString CommandLineParser::usageString() const { QString s = Tr::tr("This tool creates qbs profiles from Android SDK and NDK installations.\n"); s += Tr::tr("Usage:\n"); s += Tr::tr(" %1 [%2 ] [%6] [%3 ] [%4 ] [%5 ] " "\n") .arg(m_command, settingsDirOption(), ndkDirOption(), sdkDirOption(), qtSdkDirOption(), systemOption()); s += Tr::tr(" %1 %2|%3\n").arg(m_command, helpOptionShort(), helpOptionLong()); s += Tr::tr("If an NDK path is given, the profile will be suitable for use with Android " "projects that contain native C/C++ code.\n"); s += Tr::tr("If a Qt path is also given, the profile will be suitable for developing " "Qt applications for Android.\n"); return s; } void CommandLineParser::assignOptionArgument(const QString &option, QString &argument) { if (m_commandLine.empty()) throwError(Tr::tr("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) throwError(Tr::tr("Argument for option '%1' must not be empty.").arg(option)); } void CommandLineParser::complainAboutExtraArguments() { throwError(Tr::tr("Extraneous command-line arguments '%1'.") .arg(m_commandLine.join(QLatin1Char(' ')))); } qbs-src-3.2.0/src/app/qbs-setup-android/qbs-setup-android.rc0000644000175100017510000000022515154533055023300 0ustar runnerrunner#define RT_MANIFEST 24 #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "qbs-setup-android.exe.manifest" qbs-src-3.2.0/src/app/qbs-setup-android/android-setup.h0000644000175100017510000000435015154533055022343 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_SETUP_ANDROID_SDKSETUP_H #define QBS_SETUP_ANDROID_SDKSETUP_H #include namespace qbs { class Settings; } QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE void setupAndroid(qbs::Settings *settings, const QString &profileName, const QString &sdkDirPath, const QString &ndkDirPath, const QString &qtSdkDirPath); #endif // Include guard. qbs-src-3.2.0/src/app/shared/0000755000175100017510000000000015154533055015317 5ustar runnerrunnerqbs-src-3.2.0/src/app/shared/CMakeLists.txt0000644000175100017510000000003215154533055020052 0ustar runnerrunneradd_subdirectory(logging) qbs-src-3.2.0/src/app/shared/shared.qbs0000644000175100017510000000010315154533055017266 0ustar runnerrunnerProject { references: [ "logging/logging.qbs", ] } qbs-src-3.2.0/src/app/shared/logging/0000755000175100017510000000000015154533055016745 5ustar runnerrunnerqbs-src-3.2.0/src/app/shared/logging/CMakeLists.txt0000644000175100017510000000030315154533055021501 0ustar runnerrunnerset(SOURCES coloredoutput.cpp coloredoutput.h consolelogger.cpp consolelogger.h ) add_qbs_library(qbsconsolelogger STATIC DEPENDS qbscore SOURCES ${SOURCES} ) qbs-src-3.2.0/src/app/shared/logging/coloredoutput.cpp0000644000175100017510000000741015154533055022363 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "coloredoutput.h" #include #ifdef Q_OS_WIN32 # include #endif #include #ifdef Q_OS_UNIX #include #endif void printfColored(TextColor color, const char *str, va_list vl) { fprintfColored(color, stdout, str, vl); } void printfColored(TextColor color, const char *str, ...) { va_list vl; va_start(vl, str); printfColored(color, str, vl); va_end(vl); } void fprintfColored(TextColor color, std::FILE *file, const char *str, va_list vl) { #if defined(Q_OS_UNIX) if (color != TextColorDefault && isatty(fileno(file))) { unsigned char bright = (color & TextColorBright) >> 3; std::fprintf(file, "\033[%d;%dm", bright, 30 + (color & ~TextColorBright)); std::vfprintf(file, str, vl); std::fprintf(stdout, "\033[0m"); std::fprintf(stderr, "\033[0m"); } else #elif defined(Q_OS_WIN32) HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO csbiInfo; if (color != TextColorDefault && hStdout != INVALID_HANDLE_VALUE && GetConsoleScreenBufferInfo(hStdout, &csbiInfo)) { WORD bgrColor = ((color & 1) << 2) | (color & 2) | ((color & 4) >> 2); // BGR instead of RGB. if (color & TextColorBright) bgrColor += FOREGROUND_INTENSITY; SetConsoleTextAttribute(hStdout, (csbiInfo.wAttributes & 0xf0) | bgrColor); std::vfprintf(file, str, vl); SetConsoleTextAttribute(hStdout, csbiInfo.wAttributes); } else #endif { std::vfprintf(file, str, vl); } } void fprintfColored(TextColor color, std::FILE *file, const char *str, ...) { va_list vl; va_start(vl, str); fprintfColored(color, file, str, vl); va_end(vl); } bool terminalSupportsColor() { #if defined(Q_OS_UNIX) const QByteArray &term = qgetenv("TERM"); return !term.isEmpty() && term != "dumb"; #else return true; #endif } qbs-src-3.2.0/src/app/shared/logging/consolelogger.h0000644000175100017510000000637315154533055021771 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_LOGSINK_H #define QBS_LOGSINK_H #include "coloredoutput.h" #include namespace qbs { class Settings; } class ConsoleLogSink : public qbs::ILogSink { public: ConsoleLogSink(); void setColoredOutputEnabled(bool enabled) { m_coloredOutputEnabled = enabled; } void setEnabled(bool enabled) { m_enabled = enabled; } private: void doPrintMessage(qbs::LoggerLevel level, const QString &message, const QString &tag) override; void fprintfWrapper(TextColor color, FILE *file, const char *str, ...); private: bool m_coloredOutputEnabled; bool m_enabled; }; class ConsoleLogger : public qbs::Internal::Logger { public: static ConsoleLogger &instance(qbs::Settings *settings = 0); ConsoleLogSink *logSink() { return &m_logSink; } void setSettings(qbs::Settings *settings); private: ConsoleLogger(qbs::Settings *settings); ConsoleLogSink m_logSink; }; inline qbs::Internal::LogWriter qbsError() { return ConsoleLogger::instance().qbsLog(qbs::LoggerError); } inline qbs::Internal::LogWriter qbsWarning() { return ConsoleLogger::instance().qbsWarning(); } inline qbs::Internal::LogWriter qbsInfo() { return ConsoleLogger::instance().qbsInfo(); } inline qbs::Internal::LogWriter qbsDebug() { return ConsoleLogger::instance().qbsDebug(); } inline qbs::Internal::LogWriter qbsTrace() { return ConsoleLogger::instance().qbsTrace(); } #endif // QBS_LOGSINK_H qbs-src-3.2.0/src/app/shared/logging/consolelogger.cpp0000644000175100017510000000773215154533055022324 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "consolelogger.h" #include #include #include static QHash setupColorTable() { QHash colorTable; colorTable[QStringLiteral("compiler")] = TextColorDefault; colorTable[QStringLiteral("linker")] = TextColorDarkGreen; colorTable[QStringLiteral("codegen")] = TextColorDarkYellow; colorTable[QStringLiteral("filegen")] = TextColorDarkYellow; return colorTable; } ConsoleLogSink::ConsoleLogSink() : m_coloredOutputEnabled(true), m_enabled(true) { } void ConsoleLogSink::doPrintMessage(qbs::LoggerLevel level, const QString &message, const QString &tag) { if (!m_enabled) return; std::FILE * const file = level == qbs::LoggerInfo && tag != QStringLiteral("stdErr") ? stdout : stderr; const QString levelTag = logLevelTag(level); TextColor color = TextColorDefault; switch (level) { case qbs::LoggerError: color = TextColorRed; break; case qbs::LoggerWarning: color = TextColorYellow; break; default: break; } fprintfWrapper(color, file, levelTag.toLocal8Bit().constData()); static QHash colorTable = setupColorTable(); fprintfWrapper(colorTable.value(tag, TextColorDefault), file, "%s\n", message.toLocal8Bit().constData()); std::fflush(file); } void ConsoleLogSink::fprintfWrapper(TextColor color, std::FILE *file, const char *str, ...) { va_list vl; va_start(vl, str); if (m_coloredOutputEnabled && terminalSupportsColor()) fprintfColored(color, file, str, vl); else std::vfprintf(file, str, vl); va_end(vl); } ConsoleLogger &ConsoleLogger::instance(qbs::Settings *settings) { static ConsoleLogger logger(settings); return logger; } void ConsoleLogger::setSettings(qbs::Settings *settings) { if (settings) m_logSink.setColoredOutputEnabled(qbs::Preferences(settings).useColoredOutput()); } ConsoleLogger::ConsoleLogger(qbs::Settings *settings) : Logger(&m_logSink) { setSettings(settings); } qbs-src-3.2.0/src/app/shared/logging/coloredoutput.h0000644000175100017510000000616315154533055022034 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_COLOREDOUTPUT_H #define QBS_COLOREDOUTPUT_H #include #include // http://en.wikipedia.org/wiki/ANSI_escape_code#Colors enum TextColor { TextColorDefault = -1, TextColorBlack = 0, TextColorDarkRed = 1, TextColorDarkGreen = 2, TextColorDarkBlue = 4, TextColorDarkCyan = TextColorDarkGreen | TextColorDarkBlue, TextColorDarkMagenta = TextColorDarkRed | TextColorDarkBlue, TextColorDarkYellow = TextColorDarkRed | TextColorDarkGreen, TextColorGray = 7, TextColorBright = 8, TextColorRed = TextColorDarkRed | TextColorBright, TextColorGreen = TextColorDarkGreen | TextColorBright, TextColorBlue = TextColorDarkBlue | TextColorBright, TextColorCyan = TextColorDarkCyan | TextColorBright, TextColorMagenta = TextColorDarkMagenta | TextColorBright, TextColorYellow = TextColorDarkYellow | TextColorBright, TextColorWhite = TextColorGray | TextColorBright }; void printfColored(TextColor color, const char *str, va_list vl); void printfColored(TextColor color, const char *str, ...); void fprintfColored(TextColor color, std::FILE *file, const char *str, va_list vl); void fprintfColored(TextColor color, std::FILE *file, const char *str, ...); bool terminalSupportsColor(); #endif // QBS_COLOREDOUTPUT_H qbs-src-3.2.0/src/app/shared/logging/logging.qbs0000644000175100017510000000050215154533055021077 0ustar runnerrunnerQbsStaticLibrary { Depends { name: "qbscore" } name: "qbsconsolelogger" files: [ "coloredoutput.cpp", "coloredoutput.h", "consolelogger.cpp", "consolelogger.h" ] Export { Depends { name: "cpp" } cpp.includePaths: exportingProduct.sourceDirectory } } qbs-src-3.2.0/src/src.qbs0000644000175100017510000000050115154533055014563 0ustar runnerrunnerProject { references: [ "app/apps.qbs", "lib/libs.qbs", "libexec/libexec.qbs", "packages/packages.qbs", "plugins/plugins.qbs", "shared/bundledqt/bundledqt.qbs", "shared/lsp/lsp.qbs", "shared/quickjs/quickjs.qbs", "shared/span/span.qbs", ] } qbs-src-3.2.0/src/packages/0000755000175100017510000000000015154533055015047 5ustar runnerrunnerqbs-src-3.2.0/src/packages/archive/0000755000175100017510000000000015154533055016470 5ustar runnerrunnerqbs-src-3.2.0/src/packages/archive/archive.qbs0000644000175100017510000000534115154533055020623 0ustar runnerrunnerimport qbs.FileInfo import qbs.ModUtils import qbs.Process import qbs.TextFile QbsProduct { Depends { name: "qbs_processlauncher" } Depends { name: "qbscore" } Depends { name: "bundledqt"; required: false } Depends { name: "qbs documentation"; condition: project.withDocumentation } Depends { name: "qbs resources" } Depends { name: "qbs man page" condition: qbs.targetOS.contains("unix") && project.withDocumentation } Depends { productTypes: ["qbsapplication", "qbsplugin"] } Depends { productTypes: ["autotest"]; condition: includeTests } Depends { name: "archiver" } property bool includeTopLevelDir: false property bool includeTests: false builtByDefault: false name: "qbs_archive" type: ["archiver.archive"] targetName: "qbs-" + qbs.targetOS[0] + "-" + qbs.architecture + "-" + qbsversion.version destinationDirectory: project.buildDirectory hasCMakeFile: false archiver.type: qbs.targetOS.contains("windows") ? "zip" : "tar" Properties { condition: includeTopLevelDir archiver.workingDirectory: qbs.installRoot + "/.." } archiver.workingDirectory: qbs.installRoot Group { name: "Licenses" prefix: "../../../" files: [ "LGPL_EXCEPTION.txt", "LICENSE.LGPLv3", "LICENSE.LGPLv21", "LICENSE.GPL3-EXCEPT", ] qbs.install: true qbs.installDir: "share/doc/qbs" } Rule { multiplex: true inputs: ["installable"] inputsFromDependencies: ["installable"] Artifact { filePath: "list.txt" fileTags: ["archiver.input-list"] } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.excludedPathPrefixes = product.excludedPathPrefixes; cmd.inputFilePaths = inputs.installable.map(function(a) { return ModUtils.artifactInstalledFilePath(a); }); cmd.outputFilePath = output.filePath; cmd.baseDirectory = product.moduleProperty("archiver", "workingDirectory"); cmd.sourceCode = function() { inputFilePaths.sort(); var tf; try { tf = new TextFile(outputFilePath, TextFile.WriteOnly); for (var i = 0; i < inputFilePaths.length; ++i) { var relativePath = FileInfo.relativePath(baseDirectory, inputFilePaths[i]); tf.writeLine(relativePath); } } finally { if (tf) tf.close(); } }; return [cmd]; } } } qbs-src-3.2.0/src/packages/packages.qbs0000644000175100017510000000054115154533055017334 0ustar runnerrunnerProject { references: [ "archive/archive.qbs", "chocolatey/chocolatey.qbs", ] // Virtual product for building all possible packagings Product { Depends { name: "qbs_archive"; required: false } Depends { name: "qbs chocolatey"; required: false } name: "dist" builtByDefault: false } } qbs-src-3.2.0/src/packages/chocolatey/0000755000175100017510000000000015154533055017201 5ustar runnerrunnerqbs-src-3.2.0/src/packages/chocolatey/qbs.nuspec0000644000175100017510000000262115154533055021206 0ustar runnerrunner qbs Qbs Qt Project qbs Build tool that helps simplify the build process for developing projects across multiple platforms. Qbs is a tool that helps simplify the build process for developing projects across multiple platforms. https://wiki.qt.io/Qbs https://code.qt.io/cgit/qbs/qbs.git https://code.qt.io/cgit/qbs/qbs.git https://doc.qt.io/qbs/ http://lists.qt-project.org/mailman/listinfo/qbs https://bugreports.qt.io/browse/QBS qbs qt build © 2017 The Qt Company Ltd. http://doc.qt.io/qt-5/licensing.html false https://rawcdn.githack.com/qbs/qbs/v1.17.0/src/packages/chocolatey/icon.png qbs-src-3.2.0/src/packages/chocolatey/icon.png0000644000175100017510000001540315154533055020642 0ustar runnerrunnerPNG  IHDR>asBIT|d pHYsu85tEXtSoftwarewww.inkscape.org<IDATx{\UTDo &I^5gaٙi:X%Z6JxVlEH.!?C׻Zzֳg$3$C]/fXj'Hkӆ!ٓ$t{y{Z6d8v;l$ |kh$H2[sgC $|JTIIILJJ{nڸbaa!)IpΜ9~E(>v;4$IJ7nGrttddd$ܹ#G!u{BҝnjQIr?|4`޽jIHdWkI˗9ao,G T$H>dCR"F2_TŌB-$IXPP GHFTX~qKRTWTb |ԵkW]uuur _ $HFlXzxxLjIdߵkH:$)lgffrƌf|4i$V$kIn$d~lwP3F}II #""hggg1$;;;FDDDg6JvGIfJMlqNܴiU* HkHyȑ#['9rD4k{?nT!ٙd$I!//Ϭ3((H&'IYB& 5[RRRؿ Օqqqrȡo},%'Cҁ-2s455qϞ=7 lFrkn=Ը] /j^նfyU  ҥKM.pYU iUUM봴W lniv4=z4333et*mdww1\6˛FNn&xƅ:k:9m 2歪S+70Yowww 11CEEH~ wO? I۸vkӗ3潫j@lr:.dcc#3Ph .$I*=w,(^ƫ`[QB¿ܢrl;AMJ̤IPZZh(b]~=***3 . &AHSzcPqV=4ۺ @r2TЫwyoÁ }-H⛫7HLASZo;;;DDD K.՚o…ĪUM Kaǡh#6q P54qVjܮ8 =_X{jh4?NՈc2SH-*O>x䑟 R?8z_ވCŝК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kφ $ ih6 Mj4OI"6+|F;ۇ۵ m93ܮM2i|IENDB`qbs-src-3.2.0/src/packages/chocolatey/chocolateyinstall.ps10000644000175100017510000000133415154533055023350 0ustar runnerrunner$ErrorActionPreference = 'Stop' $qbsBaseUrl = "https://download.qt.io/official_releases/qbs/$qbsVersion" $checksumType = 'md5' $checksums = @{} ForEach ($line in (New-Object Net.WebClient).DownloadString("$qbsBaseUrl/${checksumType}sums.txt").Split(` "`n", [System.StringSplitOptions]::RemoveEmptyEntries)) { $items = $line.Split(" ", [System.StringSplitOptions]::RemoveEmptyEntries) $checksums.Add($items[1], $items[0]) } $qbs64 = "qbs-windows-x86_64-$qbsVersion.zip" Install-ChocolateyZipPackage ` -PackageName 'qbs' ` -UnzipLocation "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" ` -Url64bit "$qbsBaseUrl/$qbs64" ` -Checksum64 $checksums[$qbs64] ` -ChecksumType64 $checksumType qbs-src-3.2.0/src/packages/chocolatey/chocolatey.qbs0000644000175100017510000001160615154533055022046 0ustar runnerrunnerimport qbs.Environment import qbs.File import qbs.FileInfo import qbs.Probes import qbs.TextFile import qbs.Utilities import qbs.Xml Product { Depends { name: "qbsversion" } Probes.BinaryProbe { id: choco condition: qbs.targetOS.contains("windows") names: ["choco"] platformSearchPaths: { var chocolateyInstall = Environment.getEnv("ChocolateyInstall"); if (chocolateyInstall) return [FileInfo.joinPaths(chocolateyInstall, "bin")]; else return [FileInfo.joinPaths(Environment.getEnv("PROGRAMDATA"), "chocolatey", "bin")]; } } condition: choco.found builtByDefault: false name: "qbs chocolatey" type: ["chocolatey.nupkg"] targetName: "qbs." + qbsversion.version destinationDirectory: project.buildDirectory property string chocoFilePath: choco.filePath Group { files: ["qbs.nuspec"] fileTags: ["chocolatey.nuspec"] } Group { files: ["chocolateyinstall.ps1"] fileTags: ["powershell.source"] } Group { files: ["../../../changelogs/*"] fileTags: ["changelog"] } Rule { inputs: ["chocolatey.nuspec", "powershell.source", "changelog"] multiplex: true Artifact { filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + ".nupkg") fileTags: ["chocolatey.nupkg"] } prepare: { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.qbsVersion = product.qbsversion.version; cmd.powershellFilePath = inputs["powershell.source"][0].filePath; cmd.nuspecFileName = inputs["chocolatey.nuspec"][0].fileName; cmd.nuspecFilePath = inputs["chocolatey.nuspec"][0].filePath; cmd.chocoBuildDirectory = FileInfo.joinPaths(product.buildDirectory, "choco"); cmd.chocoOutDirectory = FileInfo.path(outputs["chocolatey.nupkg"][0].filePath); cmd.changelogs = (inputs["changelog"] || []).map(function (a) { return { filePath: a.filePath, version: a.fileName.replace(/^changes-([0-9](\.[0-9]+)*)(\.md)?$/, "$1") }; }).sort(function(a, b) { return Utilities.versionCompare(b.version, a.version); }); cmd.sourceCode = function () { File.makePath(chocoBuildDirectory); File.makePath(FileInfo.joinPaths(chocoBuildDirectory, "tools")); var tf = new TextFile(FileInfo.joinPaths( chocoBuildDirectory, "tools", "chocolateyinstall.ps1"), TextFile.WriteOnly); try { tf.writeLine("$qbsVersion = '" + qbsVersion + "'"); tf.writeLine(""); var tf2 = new TextFile(powershellFilePath, TextFile.ReadOnly); try { tf.write(tf2.readAll()); } finally { tf2.close(); } } finally { tf.close(); } var doc = new Xml.DomDocument(); doc.load(nuspecFilePath); var versionNode = doc.createElement("version"); versionNode.appendChild(doc.createTextNode(qbsVersion)); var releaseNotesNode = doc.createElement("releaseNotes"); var releaseNotesText = ""; changelogs.map(function (changelog) { releaseNotesText += "qbs " + changelog.version + "\n\n"; var tf = new TextFile(changelog.filePath, TextFile.ReadOnly); try { releaseNotesText += tf.readAll() + "\n"; } finally { tf.close(); } }); releaseNotesNode.appendChild(doc.createTextNode(releaseNotesText.trim())); var metadataNode = doc.documentElement().firstChild("metadata"); metadataNode.appendChild(versionNode); metadataNode.appendChild(releaseNotesNode); doc.save(FileInfo.joinPaths(chocoBuildDirectory, nuspecFileName)); }; var cmd2 = new Command(product.chocoFilePath, ["pack", FileInfo.joinPaths(cmd.chocoBuildDirectory, cmd.nuspecFileName), "--limitoutput", "--outputdirectory", cmd.chocoOutDirectory]); cmd2.description = "packing choco " + inputs["chocolatey.nuspec"][0].fileName; return [cmd, cmd2]; } } } qbs-src-3.2.0/src/3rdparty/0000755000175100017510000000000015154533055015041 5ustar runnerrunnerqbs-src-3.2.0/src/3rdparty/python/0000755000175100017510000000000015154533055016362 5ustar runnerrunnerqbs-src-3.2.0/src/3rdparty/python/lib/0000755000175100017510000000000015154533055017130 5ustar runnerrunnerqbs-src-3.2.0/src/3rdparty/python/lib/python3.9/0000755000175100017510000000000015154533055020703 5ustar runnerrunnerqbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/0000755000175100017510000000000015154533055023423 5ustar runnerrunnerqbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/ds_store/0000755000175100017510000000000015154533055025245 5ustar runnerrunnerqbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/ds_store/qt_attribution.json0000644000175100017510000000067015154533055031213 0ustar runnerrunner{ "Id": "ds_store", "Name": "ds_store", "QDocModule": "qbs", "QtUsage": "Used in the qbs dmg module for building Apple disk images.", "Description": "Manipulate Finder .DS_Store files from Python", "Homepage": "https://github.com/al45tair/ds_store", "Version": "1.1.2", "License": "MIT License", "LicenseId": "MIT", "LicenseFile": "LICENSE", "Copyright": "Copyright (c) 2014 Alastair Houghton" } qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/ds_store/buddy.py0000644000175100017510000003310715154533055026732 0ustar runnerrunnerimport binascii import bisect import os import struct class BuddyError(Exception): pass class Block: def __init__(self, allocator, offset, size): self._allocator = allocator self._offset = offset self._size = size self._value = bytearray(allocator.read(offset, size)) self._pos = 0 self._dirty = False def __len__(self): return self._size def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): self.close() def close(self): if self._dirty: self.flush() def flush(self): if self._dirty: self._dirty = False self._allocator.write(self._offset, self._value) def invalidate(self): self._dirty = False def zero_fill(self): len = self._size - self._pos zeroes = b"\0" * len self._value[self._pos : self._size] = zeroes self._dirty = True def tell(self): return self._pos def seek(self, pos, whence=os.SEEK_SET): if whence == os.SEEK_CUR: pos += self._pos elif whence == os.SEEK_END: pos = self._size - pos if pos < 0 or pos > self._size: raise ValueError("Seek out of range in Block instance") self._pos = pos def read(self, size_or_format): if isinstance(size_or_format, (str, bytes)): size = struct.calcsize(size_or_format) fmt = size_or_format else: size = size_or_format fmt = None if self._size - self._pos < size: raise BuddyError("Unable to read %lu bytes in block" % size) data = self._value[self._pos : self._pos + size] self._pos += size if fmt is not None: if isinstance(data, bytearray): return struct.unpack_from(fmt, bytes(data)) else: return struct.unpack(fmt, data) else: return data def write(self, data_or_format, *args): if len(args): data = struct.pack(data_or_format, *args) else: data = data_or_format if self._pos + len(data) > self._size: raise ValueError("Attempt to write past end of Block") self._value[self._pos : self._pos + len(data)] = data self._pos += len(data) self._dirty = True def insert(self, data_or_format, *args): if len(args): data = struct.pack(data_or_format, *args) else: data = data_or_format del self._value[-len(data) :] self._value[self._pos : self._pos] = data self._pos += len(data) self._dirty = True def delete(self, size): if self._pos + size > self._size: raise ValueError("Attempt to delete past end of Block") del self._value[self._pos : self._pos + size] self._value += b"\0" * size self._dirty = True def __str__(self): return binascii.b2a_hex(self._value) class Allocator: def __init__(self, the_file): self._file = the_file self._dirty = False self._file.seek(0) # Read the header (magic1, magic2, offset, size, offset2, self._unknown1) = self.read( -4, ">I4sIII16s" ) if magic2 != b"Bud1" or magic1 != 1: raise BuddyError("Not a buddy file") if offset != offset2: raise BuddyError("Root addresses differ") self._root = Block(self, offset, size) # Read the block offsets count, self._unknown2 = self._root.read(">II") self._offsets = [] c = (count + 255) & ~255 while c: self._offsets += self._root.read(">256I") c -= 256 self._offsets = self._offsets[:count] # Read the TOC self._toc = {} count = self._root.read(">I")[0] for n in range(count): nlen = self._root.read("B")[0] name = bytes(self._root.read(nlen)) value = self._root.read(">I")[0] self._toc[name] = value # Read the free lists self._free = [] for n in range(32): count = self._root.read(">I") self._free.append(list(self._root.read(">%uI" % count))) @classmethod def open(cls, file_or_name, mode="r+"): if isinstance(file_or_name, str): if "b" not in mode: mode = mode[:1] + "b" + mode[1:] f = open(file_or_name, mode) else: f = file_or_name if "w" in mode: # Create an empty file in this case f.truncate() # An empty root block needs 1264 bytes: # # 0 4 offset count # 4 4 unknown # 8 4 root block offset (2048) # 12 255 * 4 padding (offsets are in multiples of 256) # 1032 4 toc count (0) # 1036 228 free list # total 1264 # The free list will contain the following: # # 0 5 * 4 no blocks of width less than 5 # 20 6 * 8 1 block each of widths 5 to 10 # 68 4 no blocks of width 11 (allocated for the root) # 72 19 * 8 1 block each of widths 12 to 30 # 224 4 no blocks of width 31 # total 228 # # (The reason for this layout is that we allocate 2**5 bytes for # the header, which splits the initial 2GB region into every size # below 2**31, including *two* blocks of size 2**5, one of which # we take. The root block itself then needs a block of size # 2**11. Conveniently, each of these initial blocks will be # located at offset 2**n where n is its width.) # Write the header header = struct.pack( b">I4sIII16s", 1, b"Bud1", 2048, 1264, 2048, b"\x00\x00\x10\x0c" b"\x00\x00\x00\x87" b"\x00\x00\x20\x0b" b"\x00\x00\x00\x00", ) f.write(header) f.write(b"\0" * 2016) # Write the root block free_list = [struct.pack(b">5I", 0, 0, 0, 0, 0)] for n in range(5, 11): free_list.append(struct.pack(b">II", 1, 2**n)) free_list.append(struct.pack(b">I", 0)) for n in range(12, 31): free_list.append(struct.pack(b">II", 1, 2**n)) free_list.append(struct.pack(b">I", 0)) root = b"".join( [ struct.pack(b">III", 1, 0, 2048 | 5), struct.pack(b">I", 0) * 255, struct.pack(b">I", 0), ] + free_list ) f.write(root) return Allocator(f) def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): self.close() def close(self): self.flush() self._file.close() def flush(self): if self._dirty: size = self._root_block_size() self.allocate(size, 0) with self.get_block(0) as rblk: self._write_root_block_into(rblk) addr = self._offsets[0] offset = addr & ~0x1F size = 1 << (addr & 0x1F) self._file.seek(0, os.SEEK_SET) self._file.write( struct.pack( b">I4sIII16s", 1, b"Bud1", offset, size, offset, self._unknown1 ) ) self._dirty = False self._file.flush() def read(self, offset, size_or_format): """Read data at `offset', or raise an exception. `size_or_format' may either be a byte count, in which case we return raw data, or a format string for `struct.unpack', in which case we work out the size and unpack the data before returning it. """ # N.B. There is a fixed offset of four bytes(!) self._file.seek(offset + 4, os.SEEK_SET) if isinstance(size_or_format, str): size = struct.calcsize(size_or_format) fmt = size_or_format else: size = size_or_format fmt = None ret = self._file.read(size) if len(ret) < size: ret += b"\0" * (size - len(ret)) if fmt is not None: if isinstance(ret, bytearray): ret = struct.unpack_from(fmt, bytes(ret)) else: ret = struct.unpack(fmt, ret) return ret def write(self, offset, data_or_format, *args): """Write data at `offset', or raise an exception. `data_or_format' may either be the data to write, or a format string for `struct.pack', in which case we pack the additional arguments and write the resulting data. """ # N.B. There is a fixed offset of four bytes(!) self._file.seek(offset + 4, os.SEEK_SET) if len(args): data = struct.pack(data_or_format, *args) else: data = data_or_format self._file.write(data) def get_block(self, block): try: addr = self._offsets[block] except IndexError: return None offset = addr & ~0x1F size = 1 << (addr & 0x1F) return Block(self, offset, size) def _root_block_size(self): """Return the number of bytes required by the root block.""" # Offsets size = 8 size += 4 * ((len(self._offsets) + 255) & ~255) # TOC size += 4 size += sum([5 + len(s) for s in self._toc]) # Free list size += sum([4 + 4 * len(fl) for fl in self._free]) return size def _write_root_block_into(self, block): # Offsets block.write(">II", len(self._offsets), self._unknown2) block.write(">%uI" % len(self._offsets), *self._offsets) extra = len(self._offsets) & 255 if extra: block.write(b"\0\0\0\0" * (256 - extra)) # TOC keys = list(self._toc.keys()) keys.sort() block.write(">I", len(keys)) for k in keys: block.write("B", len(k)) block.write(k) block.write(">I", self._toc[k]) # Free list for w, f in enumerate(self._free): block.write(">I", len(f)) if len(f): block.write(">%uI" % len(f), *f) def _buddy(self, offset, width): f = self._free[width] b = offset ^ (1 << width) try: ndx = f.index(b) except ValueError: ndx = None return (f, b, ndx) def _release(self, offset, width): # Coalesce while True: f, b, ndx = self._buddy(offset, width) if ndx is None: break offset &= b width += 1 del f[ndx] # Add to the list bisect.insort(f, offset) # Mark as dirty self._dirty = True def _alloc(self, width): w = width while not self._free[w]: w += 1 while w > width: offset = self._free[w].pop(0) w -= 1 self._free[w] = [offset, offset ^ (1 << w)] self._dirty = True return self._free[width].pop(0) def allocate(self, bytes, block=None): """Allocate or reallocate a block such that it has space for at least `bytes' bytes.""" if block is None: # Find the first unused block try: block = self._offsets.index(0) except ValueError: block = len(self._offsets) self._offsets.append(0) # Compute block width width = max(bytes.bit_length(), 5) addr = self._offsets[block] offset = addr & ~0x1F if addr: blkwidth = addr & 0x1F if blkwidth == width: return block self._release(offset, width) self._offsets[block] = 0 offset = self._alloc(width) self._offsets[block] = offset | width return block def release(self, block): addr = self._offsets[block] if addr: width = addr & 0x1F offset = addr & ~0x1F self._release(offset, width) if block == len(self._offsets): del self._offsets[block] else: self._offsets[block] = 0 def __len__(self): return len(self._toc) def __getitem__(self, key): if not isinstance(key, str): raise TypeError("Keys must be of string type") if not isinstance(key, bytes): key = key.encode("latin_1") return self._toc[key] def __setitem__(self, key, value): if not isinstance(key, str): raise TypeError("Keys must be of string type") if not isinstance(key, bytes): key = key.encode("latin_1") self._toc[key] = value self._dirty = True def __delitem__(self, key): if not isinstance(key, str): raise TypeError("Keys must be of string type") if not isinstance(key, bytes): key = key.encode("latin_1") del self._toc[key] self._dirty = True def iterkeys(self): return self._toc.keys() def keys(self): return self._toc.keys() def __iter__(self): return self._toc.keys() def __contains__(self, key): return key in self._toc qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/ds_store/LICENSE0000644000175100017510000000204515154533055026253 0ustar runnerrunnerCopyright (c) 2014 Alastair Houghton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/ds_store/__init__.py0000644000175100017510000000016615154533055027361 0ustar runnerrunnerfrom .store import DSStore, DSStoreEntry __version__ = "1.3.1" __all__ = ["__version__", "DSStore", "DSStoreEntry"] qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/ds_store/store.py0000644000175100017510000012626715154533055026771 0ustar runnerrunnerimport plistlib import struct import mac_alias from . import buddy class ILocCodec: @staticmethod def encode(point): return struct.pack(b">IIII", point[0], point[1], 0xFFFFFFFF, 0xFFFF0000) @staticmethod def decode(bytesData): if isinstance(bytesData, bytearray): x, y = struct.unpack_from(b">II", bytes(bytesData[:8])) else: x, y = struct.unpack(b">II", bytesData[:8]) return (x, y) class PlistCodec: @staticmethod def encode(plist): return plistlib.dumps(plist, fmt=plistlib.FMT_BINARY) @staticmethod def decode(bytes): return plistlib.loads(bytes) class BookmarkCodec: @staticmethod def encode(bmk): return bmk.to_bytes() @staticmethod def decode(bytes): return mac_alias.Bookmark.from_bytes(bytes) # This list tells the code how to decode particular kinds of entry in the # .DS_Store file. This is really a convenience, and we currently only # support a tiny subset of the possible entry types. codecs = { b"Iloc": ILocCodec, b"bwsp": PlistCodec, b"lsvp": PlistCodec, b"lsvP": PlistCodec, b"icvp": PlistCodec, b"pBBk": BookmarkCodec, } class DSStoreEntry: """Holds the data from an entry in a ``.DS_Store`` file. Note that this is not meant to represent the entry itself---i.e. if you change the type or value, your changes will *not* be reflected in the underlying file. If you want to make a change, you should either use the :class:`DSStore` object's :meth:`DSStore.insert` method (which will replace a key if it already exists), or the mapping access mode for :class:`DSStore` (often simpler anyway). """ def __init__(self, filename, code, typecode, value=None): if str != bytes and type(filename) == bytes: filename = filename.decode("utf-8") if not isinstance(code, bytes): code = code.encode("latin_1") self.filename = filename self.code = code self.type = typecode self.value = value @classmethod def read(cls, block): """Read a ``.DS_Store`` entry from the containing Block.""" # First read the filename nlen = block.read(b">I")[0] filename = block.read(2 * nlen).decode("utf-16be") # Next, read the code and type code, typecode = block.read(b">4s4s") # Finally, read the data if typecode == b"bool": value = block.read(b">?")[0] elif typecode == b"long" or typecode == b"shor": value = block.read(b">I")[0] elif typecode == b"blob": vlen = block.read(b">I")[0] value = block.read(vlen) codec = codecs.get(code, None) if codec: value = codec.decode(value) typecode = codec elif typecode == b"ustr": vlen = block.read(b">I")[0] value = block.read(2 * vlen).decode("utf-16be") elif typecode == b"type": value = block.read(b">4s")[0] elif typecode == b"comp" or typecode == b"dutc": value = block.read(b">Q")[0] else: raise ValueError('Unknown type code "%s"' % typecode) return DSStoreEntry(filename, code, typecode, value) def __lt__(self, other): if not isinstance(other, DSStoreEntry): raise TypeError("Can only compare against other DSStoreEntry objects") sfl = self.filename.lower() ofl = other.filename.lower() return sfl < ofl or (self.filename == other.filename and self.code < other.code) def __le__(self, other): if not isinstance(other, DSStoreEntry): raise TypeError("Can only compare against other DSStoreEntry objects") sfl = self.filename.lower() ofl = other.filename.lower() return sfl < ofl or (sfl == ofl and self.code <= other.code) def __eq__(self, other): if not isinstance(other, DSStoreEntry): raise TypeError("Can only compare against other DSStoreEntry objects") sfl = self.filename.lower() ofl = other.filename.lower() return sfl == ofl and self.code == other.code def __ne__(self, other): if not isinstance(other, DSStoreEntry): raise TypeError("Can only compare against other DSStoreEntry objects") sfl = self.filename.lower() ofl = other.filename.lower() return sfl != ofl or self.code != other.code def __gt__(self, other): if not isinstance(other, DSStoreEntry): raise TypeError("Can only compare against other DSStoreEntry objects") sfl = self.filename.lower() ofl = other.filename.lower() selfCode = self.code if str != bytes and type(selfCode) is bytes: selfCode = selfCode.decode("utf-8") otherCode = other.code if str != bytes and type(otherCode) is bytes: otherCode = otherCode.decode("utf-8") return sfl > ofl or (sfl == ofl and selfCode > otherCode) def __ge__(self, other): if not isinstance(other, DSStoreEntry): raise TypeError("Can only compare against other DSStoreEntry objects") sfl = self.filename.lower() ofl = other.filename.lower() return sfl > ofl or (sfl == ofl and self.code >= other.code) def byte_length(self): """Compute the length of this entry, in bytes.""" utf16 = self.filename.encode("utf-16be") length = 4 + len(utf16) + 8 if isinstance(self.type, str): entry_type = self.type.encode("latin_1") value = self.value elif isinstance(self.type, (bytes, str)): entry_type = self.type value = self.value else: entry_type = b"blob" value = self.type.encode(self.value) if entry_type == b"bool": length += 1 elif entry_type == b"long" or entry_type == b"shor": length += 4 elif entry_type == b"blob": length += 4 + len(value) elif entry_type == b"ustr": utf16 = value.encode("utf-16be") length += 4 + len(utf16) elif entry_type == b"type": length += 4 elif entry_type == b"comp" or entry_type == b"dutc": length += 8 else: raise ValueError('Unknown type code "%s"' % entry_type) return length def write(self, block, insert=False): """Write this entry to the specified Block.""" if insert: w = block.insert else: w = block.write if isinstance(self.type, str): entry_type = self.type.encode("latin_1") value = self.value elif isinstance(self.type, (bytes, str)): entry_type = self.type value = self.value else: entry_type = b"blob" value = self.type.encode(self.value) utf16 = self.filename.encode("utf-16be") w(b">I", len(utf16) // 2) w(utf16) w(b">4s4s", self.code, entry_type) if entry_type == b"bool": w(b">?", value) elif entry_type == b"long" or entry_type == b"shor": w(b">I", value) elif entry_type == b"blob": w(b">I", len(value)) w(value) elif entry_type == b"ustr": utf16 = value.encode("utf-16be") w(b">I", len(utf16) // 2) w(utf16) elif entry_type == b"type": if isinstance(value, str): value = value.encode("latin_1") w(b">4s", value) elif entry_type == b"comp" or entry_type == b"dutc": w(b">Q", value) else: raise ValueError('Unknown type code "%s"' % entry_type) def __repr__(self): return f"<{self.filename} {self.code}>" class DSStore: """Python interface to a ``.DS_Store`` file. Works by manipulating the file on the disk---so this code will work with ``.DS_Store`` files for. *very* large directories. A :class:`DSStore` object can be used as if it was a mapping, e.g.:: d['foobar.dat']['Iloc'] will fetch the "Iloc" record for "foobar.dat", or raise :class:`KeyError` if there is no such record. If used in this manner, the :class:`DSStore` object will return (type, value) tuples, unless the type is "blob" and the module knows how to decode it. Currently, we know how to decode "Iloc", "bwsp", "lsvp", "lsvP" and "icvp" blobs. "Iloc" decodes to an (x, y) tuple, while the others are all decoded using ``biplist`` or ``plistlib`` depending on Python version. Assignment also works, e.g.:: d['foobar.dat']['note'] = ('ustr', u'Hello World!') as does deletion with ``del``:: del d['foobar.dat']['note'] This is usually going to be the most convenient interface, though occasionally (for instance when creating a new ``.DS_Store`` file) you may wish to drop down to using :class:`DSStoreEntry` objects directly. """ def __init__(self, store): self._store = store self._superblk = self._store["DSDB"] with self._get_block(self._superblk) as s: ( self._rootnode, self._levels, self._records, self._nodes, self._page_size, ) = s.read(b">IIIII") self._min_usage = 2 * self._page_size // 3 self._dirty = False @classmethod def open(cls, file_or_name, mode="r+", initial_entries=None): """Open a ``.DS_Store`` file; pass either a Python file object, or a filename in the ``file_or_name`` argument and a file access mode in the ``mode`` argument. If you are creating a new file using the "w" or "w+" modes, you may also specify a list of entries with which to initialise the file. """ store = buddy.Allocator.open(file_or_name, mode) if mode == "w" or mode == "w+": superblk = store.allocate(20) store["DSDB"] = superblk page_size = 4096 if not initial_entries: root = store.allocate(page_size) with store.get_block(root) as rootblk: rootblk.zero_fill() with store.get_block(superblk) as s: s.write(b">IIIII", root, 0, 0, 1, page_size) else: # Make sure they're in sorted order initial_entries = list(initial_entries) initial_entries.sort() # Construct the tree current_level = initial_entries next_level = [] levels = [] ptr_size = 0 node_count = 0 while True: total = 8 nodes = [] node = [] for e in current_level: new_total = total + ptr_size + e.byte_length() if new_total > page_size: nodes.append(node) next_level.append(e) total = 8 node = [] else: total = new_total node.append(e) if node: nodes.append(node) node_count += len(nodes) levels.append(nodes) if len(nodes) == 1: break current_level = next_level next_level = [] ptr_size = 4 # Allocate nodes ptrs = [store.allocate(page_size) for n in range(node_count)] # Generate nodes pointers = [] prev_pointers = None for level in levels: ppndx = 0 lptrs = ptrs[-len(level) :] del ptrs[-len(level) :] for node in level: ndx = lptrs.pop(0) if prev_pointers is None: with store.get_block(ndx) as block: block.write(b">II", 0, len(node)) for e in node: e.write(block) else: next_node = prev_pointers[ppndx + len(node)] node_ptrs = prev_pointers[ppndx : ppndx + len(node)] with store.get_block(ndx) as block: block.write(b">II", next_node, len(node)) for ptr, e in zip(node_ptrs, node): block.write(b">I", ptr) e.write(block) pointers.append(ndx) prev_pointers = pointers pointers = [] root = prev_pointers[0] with store.get_block(superblk) as s: s.write( b">IIIII", root, len(levels), len(initial_entries), node_count, page_size, ) return DSStore(store) def _get_block(self, number): return self._store.get_block(number) def flush(self): """Flush any dirty data back to the file.""" if self._dirty: self._dirty = False with self._get_block(self._superblk) as s: s.write( b">IIIII", self._rootnode, self._levels, self._records, self._nodes, self._page_size, ) self._store.flush() def close(self): """Flush dirty data and close the underlying file.""" self.flush() self._store.close() def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): self.close() # Internal B-Tree nodes look like this: # # [ next | count | (ptr0 | rec0) | (ptr1 | rec1) ... (ptrN | recN) ] # Leaf nodes look like this: # # [ 0 | count | rec0 | rec1 ... recN ] # Iterate over the tree, starting at `node' def _traverse(self, node): if node is None: node = self._rootnode with self._get_block(node) as block: next_node, count = block.read(b">II") if next_node: for n in range(count): ptr = block.read(b">I")[0] for e in self._traverse(ptr): yield e e = DSStoreEntry.read(block) yield e for e in self._traverse(next_node): yield e else: for n in range(count): e = DSStoreEntry.read(block) yield e # Display the data in `node' def _dump_node(self, node): with self._get_block(node) as block: next_node, count = block.read(b">II") print("next: %u\ncount: %u\n" % (next_node, count)) for n in range(count): if next_node: ptr = block.read(b">I")[0] print("%8u " % ptr, end=" ") else: print(" ", end=" ") e = DSStoreEntry.read(block) print(e, " (%u)" % e.byte_length()) print("used: %u" % block.tell()) # Display the data in the super block def _dump_super(self): print( "root: %u\nlevels: %u\nrecords: %u\nnodes: %u\npage-size: %u" % ( self._rootnode, self._levels, self._records, self._nodes, self._page_size, ) ) # Splits entries across two blocks, returning one pivot # # Tries to balance the block usage across the two as best it can def _split2(self, blocks, entries, pointers, before, internal): left_block = blocks[0] right_block = blocks[1] count = len(entries) # Find the feasible splits best_split = None best_diff = None total = before[count] if 8 + total <= self._page_size: # We can use a *single* node for this best_split = count else: # Split into two nodes for n in range(1, count - 1): left_size = 8 + before[n] right_size = 8 + total - before[n + 1] if left_size > self._page_size: break if right_size > self._page_size: continue diff = abs(left_size - right_size) if best_split is None or diff < best_diff: best_split = n best_diff = diff if best_split is None: return None # Write the nodes left_block.seek(0) if internal: next_node = pointers[best_split] else: next_node = 0 left_block.write(b">II", next_node, best_split) for n in range(best_split): if internal: left_block.write(b">I", pointers[n]) entries[n].write(left_block) left_block.zero_fill() if best_split == count: return [] right_block.seek(0) if internal: next_node = pointers[count] else: next_node = 0 right_block.write(b">II", next_node, count - best_split - 1) for n in range(best_split + 1, count): if internal: right_block.write(b">I", pointers[n]) entries[n].write(right_block) right_block.zero_fill() pivot = entries[best_split] return [pivot] def _split(self, node, entry, right_ptr=0): self._nodes += 1 self._dirty = True new_right = self._store.allocate(self._page_size) with self._get_block(node) as block, self._get_block(new_right) as right_block: # First, measure and extract all the elements entry_size = entry.byte_length() # ?? entry_pos = None next_node, count = block.read(b">II") if next_node: entry_size += 4 pointers = [] entries = [] before = [] total = 0 for n in range(count): pos = block.tell() if next_node: ptr = block.read(b">I")[0] pointers.append(ptr) e = DSStoreEntry.read(block) if e > entry: # ?? entry_pos = n entries.append(entry) pointers.append(right_ptr) before.append(total) total += entry_size entries.append(e) before.append(total) total += block.tell() - pos before.append(total) if next_node: pointers.append(next_node) pivot = self._split2( [block, right_block], entries, pointers, before, bool(next_node) )[0] self._records += 1 self._nodes += 1 self._dirty = True return (pivot, new_right) # Allocate a new root node containing the element `pivot' and the pointers # `left' and `right' def _new_root(self, left, pivot, right): new_root = self._store.allocate(self._page_size) with self._get_block(new_root) as block: block.write(b">III", right, 1, left) pivot.write(block) self._rootnode = new_root self._levels += 1 self._nodes += 1 self._dirty = True # Insert an entry into an inner node; `path' is the path from the root # to `node', not including `node' itself. `right_ptr' is the new node # pointer (inserted to the RIGHT of `entry') def _insert_inner(self, path, node, entry, right_ptr): with self._get_block(node) as block: next_node, count = block.read(b">II") insert_pos = None insert_ndx = None n = 0 while n < count: pos = block.tell() ptr = block.read(b">I")[0] e = DSStoreEntry.read(block) if e == entry: if n == count - 1: right_ptr = next_node next_node = ptr block.seek(pos) else: right_ptr = block.read(b">I")[0] block.seek(pos + 4) insert_pos = pos insert_ndx = n block.delete(e.byte_length() + 4) count -= 1 self._records += 1 self._dirty = True continue elif insert_pos is None and e > entry: insert_pos = pos insert_ndx = n n += 1 if insert_pos is None: insert_pos = block.tell() insert_ndx = count remaining = self._page_size - block.tell() if remaining < entry.byte_length() + 4: pivot, new_right = self._split(node, entry, right_ptr) if path: self._insert_inner(path[:-1], path[-1], pivot, new_right) else: self._new_root(node, pivot, new_right) else: if insert_ndx == count: block.seek(insert_pos) block.write(b">I", next_node) entry.write(block) next_node = right_ptr else: block.seek(insert_pos + 4) entry.write(block, True) block.insert(">I", right_ptr) block.seek(0) count += 1 block.write(b">II", next_node, count) self._records += 1 self._dirty = True # Insert `entry' into the leaf node `node' def _insert_leaf(self, path, node, entry): with self._get_block(node) as block: next_node, count = block.read(b">II") insert_pos = None # ?? insert_ndx = None n = 0 while n < count: pos = block.tell() e = DSStoreEntry.read(block) if e == entry: insert_pos = pos # ?? insert_ndx = n block.seek(pos) block.delete(e.byte_length()) count -= 1 self._records += 1 self._dirty = True continue elif insert_pos is None and e > entry: insert_pos = pos # ?? insert_ndx = n n += 1 if insert_pos is None: insert_pos = block.tell() # ?? insert_ndx = count remaining = self._page_size - block.tell() if remaining < entry.byte_length(): pivot, new_right = self._split(node, entry) if path: self._insert_inner(path[:-1], path[-1], pivot, new_right) else: self._new_root(node, pivot, new_right) else: block.seek(insert_pos) entry.write(block, True) block.seek(0) count += 1 block.write(b">II", next_node, count) self._records += 1 self._dirty = True def insert(self, entry): """Insert ``entry`` (which should be a :class:`DSStoreEntry`) into the B-Tree.""" path = [] node = self._rootnode while True: with self._get_block(node) as block: next_node, count = block.read(b">II") if next_node: for n in range(count): ptr = block.read(b">I")[0] e = DSStoreEntry.read(block) if entry < e: next_node = ptr break elif entry == e: # If we find an existing entry the same, replace it self._insert_inner(path, node, entry, None) return path.append(node) node = next_node else: self._insert_leaf(path, node, entry) return # Return usage information for the specified `node' def _block_usage(self, node): with self._get_block(node) as block: next_node, count = block.read(b">II") for n in range(count): if next_node: block.read(b">I")[0] DSStoreEntry.read(block) used = block.tell() return (count, used) # Splits entries across three blocks, returning two pivots def _split3(self, blocks, entries, pointers, before, internal): count = len(entries) # Find the feasible splits best_split = None best_diff = None total = before[count] for n in range(1, count - 3): left_size = 8 + before[n] remaining = 16 + total - before[n + 1] if left_size > self._page_size: break if remaining > 2 * self._page_size: continue for m in range(n + 2, count - 1): mid_size = 8 + before[m] - before[n + 1] right_size = 8 + total - before[m + 1] if mid_size > self._page_size: break if right_size > self._page_size: continue diff = abs(left_size - mid_size) * abs(right_size - mid_size) if best_split is None or diff < best_diff: best_split = (n, m, count) best_diff = diff if best_split is None: return None # Write the nodes prev_split = -1 for block, split in zip(blocks, best_split): block.seek(0) if internal: next_node = pointers[split] else: next_node = 0 block.write(b">II", next_node, split) for n in range(prev_split + 1, split): if internal: block.write(b">I", pointers[n]) entries[n].write(block) block.zero_fill() prev_split = split return (entries[best_split[0]], entries[best_split[1]]) # Extract all of the entries from the specified list of `blocks', # separating them by the specified `pivots'. Also computes the # amount of space used before each entry. def _extract(self, blocks, pivots): pointers = [] entries = [] before = [] total = 0 ppivots = pivots + [None] for b, p in zip(blocks, ppivots): b.seek(0) next_node, count = b.read(b">II") for n in range(count): pos = b.tell() if next_node: ptr = b.read(b">I")[0] pointers.append(ptr) e = DSStoreEntry.read(b) entries.append(e) before.append(total) total += b.tell() - pos if next_node: pointers.append(next_node) if p: entries.append(p) before.append(total) total += p.byte_length() if next_node: total += 4 before.append(total) return (entries, pointers, before) # Rebalance the specified `node', whose path from the root is `path'. def _rebalance(self, path, node): # Can't rebalance the root if not path: return with self._get_block(node) as block: next_node, count = block.read(b">II") with self._get_block(path[-1]) as parent: # Find the left and right siblings and respective pivots parent_next, parent_count = parent.read(b">II") left_pos = None left_node = None left_pivot = None node_pos = None right_pos = None right_node = None right_pivot = None prev_e = prev_ptr = prev_pos = None for n in range(parent_count): pos = parent.tell() ptr = parent.read(b">I")[0] e = DSStoreEntry.read(parent) if ptr == node: node_pos = pos right_pivot = e left_pos = prev_pos left_pivot = prev_e left_node = prev_ptr elif prev_ptr == node: right_node = ptr right_pos = pos break prev_e = e prev_ptr = ptr prev_pos = pos if parent_next == node: node_pos = parent.tell() left_pos = prev_pos left_pivot = prev_e left_node = prev_ptr elif right_node is None: right_node = parent_next right_pos = parent.tell() _ = parent.tell() if left_node and right_node: with self._get_block(left_node) as left, self._get_block( right_node ) as right: blocks = [left, block, right] pivots = [left_pivot, right_pivot] entries, pointers, before = self._extract(blocks, pivots) # If there's a chance that we could use two pages instead # of three, go for it pivots = self._split2( blocks, entries, pointers, before, bool(next_node) ) if pivots is None: ptrs = [left_node, node, right_node] pivots = self._split3( blocks, entries, pointers, before, bool(next_node) ) else: if pivots: ptrs = [left_node, node] else: ptrs = [left_node] self._store.release(node) self._nodes -= 1 node = left_node self._store.release(right_node) self._nodes -= 1 self._dirty = True # Remove the pivots from the parent with self._get_block(path[-1]) as parent: if right_node == parent_next: parent.seek(left_pos) parent.delete(right_pos - left_pos) parent_next = left_node else: parent.seek(left_pos + 4) parent.delete(right_pos - left_pos) parent.seek(0) parent_count -= 2 parent.write(b">II", parent_next, parent_count) self._records -= 2 # Replace with those in pivots for e, rp in zip(pivots, ptrs[1:]): self._insert_inner(path[:-1], path[-1], e, rp) elif left_node: with self._get_block(left_node) as left: blocks = [left, block] pivots = [left_pivot] entries, pointers, before = self._extract(blocks, pivots) pivots = self._split2( blocks, entries, pointers, before, bool(next_node) ) # Remove the pivot from the parent with self._get_block(path[-1]) as parent: if node == parent_next: parent.seek(left_pos) parent.delete(node_pos - left_pos) parent_next = left_node else: parent.seek(left_pos + 4) parent.delete(node_pos - left_pos) parent.seek(0) parent_count -= 1 parent.write(b">II", parent_next, parent_count) self._records -= 1 # Replace the pivot if pivots: self._insert_inner(path[:-1], path[-1], pivots[0], node) elif right_node: with self._get_block(right_node) as right: blocks = [block, right] pivots = [right_pivot] entries, pointers, before = self._extract(blocks, pivots) pivots = self._split2( blocks, entries, pointers, before, bool(next_node) ) # Remove the pivot from the parent with self._get_block(path[-1]) as parent: if right_node == parent_next: parent.seek(pos) parent.delete(right_pos - node_pos) parent_next = node else: parent.seek(pos + 4) parent.delete(right_pos - node_pos) parent.seek(0) parent_count -= 1 parent.write(b">II", parent_next, parent_count) self._records -= 1 # Replace the pivot if pivots: self._insert_inner(path[:-1], path[-1], pivots[0], right_node) if not path and not parent_count: self._store.release(path[-1]) self._nodes -= 1 self._dirty = True self._rootnode = node else: count, used = self._block_usage(path[-1]) if used < self._page_size // 2: self._rebalance(path[:-1], path[-1]) # Delete from the leaf node `node'. `filename_lc' has already been # lower-cased. def _delete_leaf(self, node, filename_lc, code): found = False with self._get_block(node) as block: next_node, count = block.read(b">II") for n in range(count): pos = block.tell() e = DSStoreEntry.read(block) if e.filename.lower() == filename_lc and ( code is None or e.code == code ): block.seek(pos) block.delete(e.byte_length()) found = True # This does not affect the loop; THIS IS NOT A BUG count -= 1 self._records -= 1 self._dirty = True if found: used = block.tell() block.seek(0) block.write(b">II", next_node, count) return used < self._page_size // 2 else: return False # Remove the largest entry from the subtree starting at `node' (with # path from root `path'). Returns a tuple (rebalance, entry) where # rebalance is either None if no rebalancing is required, or a # (path, node) tuple giving the details of the node to rebalance. def _take_largest(self, path, node): path = list(path) rebalance = None while True: with self._get_block(node) as block: next_node, count = block.read(b">II") if next_node: path.append(node) node = next_node continue for n in range(count): pos = block.tell() e = DSStoreEntry.read(block) count -= 1 block.seek(0) block.write(b">II", next_node, count) if pos < self._page_size // 2: rebalance = (path, node) break return rebalance, e # Delete an entry from an inner node, `node' def _delete_inner(self, path, node, filename_lc, code): rebalance = False with self._get_block(node) as block: next_node, count = block.read(b">II") for n in range(count): pos = block.tell() ptr = block.read(b">I")[0] e = DSStoreEntry.read(block) if e.filename.lower() == filename_lc and ( code is None or e.code == code ): # Take the largest from the left subtree rebalance, largest = self._take_largest(path, ptr) # Delete this entry if n == count - 1: right_ptr = next_node next_node = ptr block.seek(pos) else: right_ptr = block.read(b">I")[0] block.seek(pos + 4) block.delete(e.byte_length() + 4) count -= 1 block.seek(0) block.write(b">II", next_node, count) self._records -= 1 self._dirty = True break # Replace the pivot value self._insert_inner(path, node, largest, right_ptr) # Rebalance from the node we stole from if rebalance: self._rebalance(rebalance[0], rebalance[1]) return True return False def delete(self, filename, code): """Delete an item, identified by ``filename`` and ``code`` from the B-Tree.""" if isinstance(filename, DSStoreEntry): code = filename.code filename = filename.filename # If we're deleting *every* node for "filename", we must recurse if code is None: # TODO: Fix this so we can do bulk deletes raise ValueError("You must delete items individually. Sorry") # Otherwise, we're deleting *one* specific node filename_lc = filename.lower() path = [] node = self._rootnode while True: with self._get_block(node) as block: next_node, count = block.read(b">II") if next_node: for n in range(count): ptr = block.read(b">I")[0] e = DSStoreEntry.read(block) e_lc = e.filename.lower() if filename_lc < e_lc or ( filename_lc == e_lc and code < e.code ): next_node = ptr break elif filename_lc == e_lc and code == e.code: self._delete_inner(path, node, filename_lc, code) return path.append(node) node = next_node else: if self._delete_leaf(node, filename_lc, code): self._rebalance(path, node) return # Find implementation def _find(self, node, filename_lc, code=None): if code is not None and not isinstance(code, bytes): code = code.encode("latin_1") with self._get_block(node) as block: next_node, count = block.read(b">II") if next_node: for n in range(count): ptr = block.read(b">I")[0] e = DSStoreEntry.read(block) if filename_lc < e.filename.lower(): for e in self._find(ptr, filename_lc, code): yield e return elif filename_lc == e.filename.lower(): if code is None or (code and code < e.code): for e in self._find(ptr, filename_lc, code): yield e if code is None or code == e.code: yield e elif code < e.code: return for e in self._find(next_node, filename_lc, code): yield e else: for n in range(count): e = DSStoreEntry.read(block) if filename_lc == e.filename.lower(): if code is None or code == e.code: yield e elif code < e.code: return def find(self, filename, code=None): """Returns a generator that will iterate over matching entries in the B-Tree.""" if isinstance(filename, DSStoreEntry): code = filename.code filename = filename.filename filename_lc = filename.lower() return self._find(self._rootnode, filename_lc, code) def __len__(self): return self._records def __iter__(self): return self._traverse(self._rootnode) class Partial: """This is used to implement indexing.""" def __init__(self, store, filename): self._store = store self._filename = filename def __getitem__(self, code): if code is None: raise KeyError("no such key - [%s][None]" % self._filename) if not isinstance(code, bytes): code = code.encode("latin_1") try: item = next(self._store.find(self._filename, code)) except StopIteration: raise KeyError(f"no such key - [{self._filename}][{code}]") if not isinstance(item.type, (bytes, str)): return item.value return (item.type, item.value) def __setitem__(self, code, value): if code is None: raise KeyError("bad key - [%s][None]" % self._filename) if not isinstance(code, bytes): code = code.encode("latin_1") codec = codecs.get(code, None) if codec: entry_type = codec entry_value = value else: entry_type = value[0] entry_value = value[1] self._store.insert( DSStoreEntry(self._filename, code, entry_type, entry_value) ) def __delitem__(self, code): if code is None: raise KeyError("no such key - [%s][None]" % self._filename) self._store.delete(self._filename, code) def __iter__(self): yield from self._store.find(self._filename) def __getitem__(self, filename): return self.Partial(self, filename) qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/ds_store/__main__.py0000644000175100017510000000537315154533055027347 0ustar runnerrunner#!/usr/bin/env python # # ds_store: Examine .DS_Store files. # import argparse import os import os.path import pprint import re import sys from ds_store import DSStore from ds_store.buddy import BuddyError _not_printable_re = re.compile(rb"[\x00-\x1f\x7f-\x9f]") def usage(): print(main.__doc__) sys.exit(0) def chunks(iterable, length): for i in range(0, len(iterable), length): yield i, iterable[i : i + length] def pretty(value): if isinstance(value, dict): return f"{{\n {pprint.pformat(value, indent=4)[1:-1]}\n}}" elif isinstance(value, bytearray): lines = ["["] for offset, chunk in chunks(value, 16): printable_chunk = _not_printable_re.sub(b".", chunk).decode("latin-1") hex_line = " ".join([f"{b:02x}" for b in chunk]) line = f" {offset:08x} {hex_line:<47s} {printable_chunk}" lines.append(line) lines.append("]") return "\n".join(lines) elif isinstance(value, bytes): return value.decode("latin-1") else: return value def main(argv): """Display the contents of the .DS_Store file at the specified path. If you specify just a directory, ds_store will inspect the .DS_Store file in that directory. If no paths are specified, ds_store will display the contents of the .DS_Store file in the current directory. """ parser = argparse.ArgumentParser(description=main.__doc__) parser.add_argument("paths", nargs="*") args = parser.parse_args(argv) if len(args.paths) == 0: args.paths = ["."] failed = False for path in args.paths: if os.path.isdir(path): path = os.path.join(path, ".DS_Store") if not os.path.exists(path) or not os.path.isfile(path): print(f"ds_store: {path} not found", file=sys.stderr) failed = True continue try: with DSStore.open(path, "r") as d: print(path) print("") max_name_len = 0 for entry in d: name_len = len(entry.filename) if name_len > max_name_len: max_name_len = name_len for entry in d: print( "{:<{width}} {} {}".format( entry.filename, entry.code.decode("latin-1"), pretty(entry.value), width=max_name_len, ) ) print("") except BuddyError as e: print(f"ds_store: {path}: {e}") failed = True if failed: sys.exit(1) if __name__ == "__main__": main(sys.argv[1:]) qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/dmgbuild/0000755000175100017510000000000015154533055025212 5ustar runnerrunnerqbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/dmgbuild/qt_attribution.json0000644000175100017510000000067215154533055031162 0ustar runnerrunner{ "Id": "dmgbuild", "Name": "dmgbuild", "QDocModule": "qbs", "QtUsage": "Used in the qbs dmg module for building Apple disk images.", "Description": "macOS command line utility to build disk images", "Homepage": "https://github.com/al45tair/dmgbuild", "Version": "1.3.1", "License": "MIT License", "LicenseId": "MIT", "LicenseFile": "LICENSE", "Copyright": "Copyright (c) 2014 Alastair Houghton" } qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/dmgbuild/core.py0000644000175100017510000007035215154533055026523 0ustar runnerrunnerimport json import os import platform import plistlib import re import shutil import subprocess import tempfile import time import tokenize try: import importlib_resources as resources except ImportError: from importlib import resources from ds_store import DSStore from mac_alias import Alias from . import colors, licensing try: from . import badge except ImportError: badge = None # The first element in the platform.mac_ver() tuple is a string containing the # macOS version (e.g., '10.15.6'). Parse into an integer tuple. MACOS_VERSION = tuple(int(v) for v in platform.mac_ver()[0].split(".")) class DMGError(Exception): def __init__(self, callback, message): self.message = message callback({"type": "error::fatal", "message": message}) def __str__(self): return str(self.message) def quiet_callback(info): pass def hdiutil(cmd, *args, **kwargs): plist = kwargs.get("plist", True) all_args = ["/usr/bin/hdiutil", cmd] all_args.extend(args) if plist: all_args.append("-plist") p = subprocess.Popen( all_args, stdout=subprocess.PIPE, stderr=None if plist else subprocess.STDOUT, close_fds=True, ) output, _ = p.communicate() if plist: results = plistlib.loads(output) else: results = output.decode() retcode = p.wait() return retcode, results def load_settings(filename, settings): encoding = "utf-8" with open(filename, "rb") as fp: try: encoding = tokenize.detect_encoding(fp.readline)[0] except SyntaxError: pass with open(filename, encoding=encoding) as fp: exec(compile(fp.read(), filename, "exec"), settings, settings) def load_json(filename, settings): """Read an appdmg .json spec. Uses the defaults for appdmg, rather than the usual defaults for dmgbuild. """ with open(filename) as fp: json_data = json.load(fp) if "title" not in json_data: raise ValueError("missing 'title' in JSON settings file") if "contents" not in json_data: raise ValueError("missing 'contents' in JSON settings file") settings["volume_name"] = json_data["title"] settings["icon"] = json_data.get("icon", None) settings["badge_icon"] = json_data.get("badge-icon", None) bk = json_data.get("background", None) if bk is None: bk = json_data.get("background-color", None) if bk is not None: settings["background"] = bk settings["icon_size"] = json_data.get("icon-size", 80) tsize = json_data.get("text-size", None) if tsize is not None: settings["text_size"] = tsize wnd = json_data.get( "window", { "position": {"x": 100, "y": 100}, "size": {"width": 640, "height": 480}, }, ) pos = wnd.get("position", {"x": 100, "y": 100}) siz = wnd.get("size", {"width": 640, "height": 480}) settings["window_rect"] = ( (pos.get("x", 100), pos.get("y", 100)), (siz.get("width", 640), siz.get("height", 480)), ) settings["format"] = json_data.get("format", "UDZO") settings["filesystem"] = json_data.get("filesystem", "HFS+") settings["compression_level"] = json_data.get("compression-level", None) settings["license"] = json_data.get("license", None) settings["size"] = json_data.get("size", None) settings["shrink"] = json_data.get("shrink", True) files = [] hide = [] hide_extensions = [] symlinks = {} icon_locations = {} for fileinfo in json_data.get("contents", []): if "path" not in fileinfo: raise ValueError("missing 'path' in contents in JSON settings file") if "x" not in fileinfo: raise ValueError("missing 'x' in contents in JSON settings file") if "y" not in fileinfo: raise ValueError("missing 'y' in contents in JSON settings file") kind = fileinfo.get("type", "file") path = fileinfo["path"] name = fileinfo.get("name", os.path.basename(path.rstrip("/"))) if kind == "file": files.append((path, name)) elif kind == "link": symlinks[name] = path elif kind == "position": pass icon_locations[name] = (fileinfo["x"], fileinfo["y"]) hide_ext = fileinfo.get("hide_extension", False) if hide_ext: hide_extensions.append(name) hidden = fileinfo.get("hidden", False) if hidden: hide.append(name) settings["files"] = files settings["hide_extensions"] = hide_extensions settings["hide"] = hide settings["symlinks"] = symlinks settings["icon_locations"] = icon_locations def build_dmg( # noqa: C901 filename, volume_name, settings_file=None, settings=None, defines=None, lookForHiDPI=True, detach_retries=12, callback=quiet_callback, ): if defines is None: defines = {} if settings is None: settings = {} options = { # Default settings "filename": filename, "volume_name": volume_name, "format": "UDBZ", "filesystem": "HFS+", "compression_level": None, "size": None, "shrink": True, "files": [], "symlinks": {}, "hide": [], "hide_extensions": [], "icon": None, "badge_icon": None, "background": None, "show_status_bar": False, "show_tab_view": False, "show_toolbar": False, "show_pathbar": False, "show_sidebar": False, "sidebar_width": 180, "arrange_by": None, "grid_offset": (0, 0), "grid_spacing": 100.0, "scroll_position": (0.0, 0.0), "show_icon_preview": False, "show_item_info": False, "label_pos": "bottom", "text_size": 16.0, "icon_size": 128.0, "include_icon_view_settings": "auto", "include_list_view_settings": "auto", "list_icon_size": 16.0, "list_text_size": 12.0, "list_scroll_position": (0, 0), "list_sort_by": "name", "list_use_relative_dates": True, "list_calculate_all_sizes": False, "list_columns": ("name", "date-modified", "size", "kind", "date-added"), "list_column_widths": { "name": 300, "date-modified": 181, "date-created": 181, "date-added": 181, "date-last-opened": 181, "size": 97, "kind": 115, "label": 100, "version": 75, "comments": 300, }, "list_column_sort_directions": { "name": "ascending", "date-modified": "descending", "date-created": "descending", "date-added": "descending", "date-last-opened": "descending", "size": "descending", "kind": "ascending", "label": "ascending", "version": "ascending", "comments": "ascending", }, "window_rect": ((100, 100), (640, 280)), "default_view": "icon-view", "icon_locations": {}, "license": None, "defines": defines, } callback({"type": "build::started"}) # Execute the settings file if settings_file: callback( { "type": "operation::start", "operation": "settings::load", } ) # We now support JSON settings files using appdmg's format if settings_file.endswith(".json"): load_json(settings_file, options) else: load_settings(settings_file, options) callback( { "type": "operation::finished", "operation": "settings::load", } ) # Add any overrides options.update(settings) # Set up the finder data bounds = options["window_rect"] bounds_string = ( f"{{{{{bounds[0][0]}, {bounds[0][1]}}}, {{{bounds[1][0]}, {bounds[1][1]}}}}}" ) bwsp = { "ShowStatusBar": options["show_status_bar"], "WindowBounds": bounds_string, "ContainerShowSidebar": False, "PreviewPaneVisibility": False, "SidebarWidth": options["sidebar_width"], "ShowTabView": options["show_tab_view"], "ShowToolbar": options["show_toolbar"], "ShowPathbar": options["show_pathbar"], "ShowSidebar": options["show_sidebar"], } arrange_options = { "name": "name", "date-modified": "dateModified", "date-created": "dateCreated", "date-added": "dateAdded", "date-last-opened": "dateLastOpened", "size": "size", "kind": "kind", "label": "label", } icvp = { "viewOptionsVersion": 1, "backgroundType": 0, "backgroundColorRed": 1.0, "backgroundColorGreen": 1.0, "backgroundColorBlue": 1.0, "gridOffsetX": float(options["grid_offset"][0]), "gridOffsetY": float(options["grid_offset"][1]), "gridSpacing": float(options["grid_spacing"]), "arrangeBy": str(arrange_options.get(options["arrange_by"], "none")), "showIconPreview": bool(options["show_icon_preview"]), "showItemInfo": bool(options["show_item_info"]), "labelOnBottom": options["label_pos"] == "bottom", "textSize": float(options["text_size"]), "iconSize": float(options["icon_size"]), "scrollPositionX": float(options["scroll_position"][0]), "scrollPositionY": float(options["scroll_position"][1]), } background = options["background"] columns = { "name": "name", "date-modified": "dateModified", "date-created": "dateCreated", "date-added": "dateAdded", "date-last-opened": "dateLastOpened", "size": "size", "kind": "kind", "label": "label", "version": "version", "comments": "comments", } default_widths = { "name": 300, "date-modified": 181, "date-created": 181, "date-added": 181, "date-last-opened": 181, "size": 97, "kind": 115, "label": 100, "version": 75, "comments": 300, } default_sort_directions = { "name": "ascending", "date-modified": "descending", "date-created": "descending", "date-added": "descending", "date-last-opened": "descending", "size": "descending", "kind": "ascending", "label": "ascending", "version": "ascending", "comments": "ascending", } lsvp = { "viewOptionsVersion": 1, "sortColumn": columns.get(options["list_sort_by"], "name"), "textSize": float(options["list_text_size"]), "iconSize": float(options["list_icon_size"]), "showIconPreview": options["show_icon_preview"], "scrollPositionX": options["list_scroll_position"][0], "scrollPositionY": options["list_scroll_position"][1], "useRelativeDates": options["list_use_relative_dates"], "calculateAllSizes": options["list_calculate_all_sizes"], } lsvp["columns"] = {} cndx = {} for n, column in enumerate(options["list_columns"]): cndx[column] = n width = options["list_column_widths"].get(column, default_widths[column]) asc = ( options["list_column_sort_directions"].get( column, default_sort_directions[column] ) == "ascending" ) lsvp["columns"][columns[column]] = { "index": n, "width": width, "identifier": columns[column], "visible": True, "ascending": asc, } n = len(options["list_columns"]) for k in columns: if cndx.get(k) is None: cndx[k] = n width = default_widths[k] asc = default_sort_directions[k] == "ascending" lsvp["columns"][columns[column]] = { "index": n, "width": width, "identifier": columns[column], "visible": False, "ascending": asc, } n += 1 default_view = options["default_view"] views = { "icon-view": b"icnv", "column-view": b"clmv", "list-view": b"Nlsv", "coverflow": b"Flwv", } icvl = (b"type", views.get(default_view, "icnv")) include_icon_view_settings = default_view == "icon-view" or options[ "include_icon_view_settings" ] not in ("auto", "no", 0, False, None) include_list_view_settings = default_view in ("list-view", "coverflow") or options[ "include_list_view_settings" ] not in ("auto", "no", 0, False, None) filename = options["filename"] volume_name = options["volume_name"] # Construct a writeable image to start with dirname, basename = os.path.split(os.path.realpath(filename)) if not basename.endswith(".dmg"): basename += ".dmg" writableFile = tempfile.NamedTemporaryFile( dir=dirname, prefix=".temp", suffix=basename ) callback( { "type": "operation::start", "operation": "size::calculate", } ) total_size = options["size"] if total_size is None: # Start with a size of 128MB - this way we don't need to calculate the # size of the background image, volume icon, and .DS_Store file (and # 128 MB should be well sufficient for even the most outlandish image # sizes, like an uncompressed 5K multi-resolution TIFF) total_size = 128 * 1024 * 1024 def roundup(x, n): return x if x % n == 0 else x + n - x % n for path in options["files"]: if isinstance(path, tuple): path = path[0] if not os.path.islink(path) and os.path.isdir(path): for dirpath, _dirnames, filenames in os.walk(path): for f in filenames: fp = os.path.join(dirpath, f) total_size += roundup(os.lstat(fp).st_size, 4096) else: total_size += roundup(os.lstat(path).st_size, 4096) for name, target in options["symlinks"].items(): total_size += 4096 total_size = str(max(total_size / 1000, 1024)) + "K" callback( { "type": "operation::finished", "operation": "size::calculate", "size": total_size, } ) callback( { "type": "command::start", "command": "hdiutil::create", } ) filesystem = options["filesystem"].upper() fs_args = "-c c=64,a=16,e=16" if filesystem != "APFS" else "" ret, output = hdiutil( "create", "-ov", "-volname", volume_name, "-fs", filesystem, "-fsargs", fs_args, "-size", total_size, writableFile.name, ) callback( { "type": "command::finished", "command": "hdiutil::create", "ret": ret, "output": output, } ) if ret: raise DMGError(callback, f"Unable to create disk image: {output}") callback( { "type": "command::start", "command": "hdiutil::attach", } ) # IDME was deprecated in macOS 10.15/Catalina; as a result, use of -noidme # started raising a warning. if MACOS_VERSION >= (10, 15): ret, output = hdiutil( "attach", "-nobrowse", "-owners", "off", writableFile.name ) else: ret, output = hdiutil( "attach", "-nobrowse", "-owners", "off", "-noidme", writableFile.name ) callback( { "type": "command::finished", "command": "hdiutil::attach", "ret": ret, "output": output, } ) if ret: raise DMGError(callback, f"Unable to attach disk image: {output}") callback( { "type": "operation::start", "operation": "dmg::create", } ) try: for info in output["system-entities"]: if info.get("mount-point", None): device = info["dev-entry"] mount_point = info["mount-point"] icon = options["icon"] if badge: badge_icon = options["badge_icon"] else: badge_icon = None icon_target_path = os.path.join(mount_point, ".VolumeIcon.icns") if icon: shutil.copyfile(icon, icon_target_path) elif badge_icon: badge.badge_disk_icon(badge_icon, icon_target_path) if icon or badge_icon: subprocess.call(["/usr/bin/SetFile", "-a", "C", mount_point]) callback( { "type": "operation::start", "operation": "background::create", } ) if not isinstance(background, str): pass elif colors.isAColor(background): c = colors.parseColor(background).to_rgb() icvp["backgroundType"] = 1 icvp["backgroundColorRed"] = float(c.r) icvp["backgroundColorGreen"] = float(c.g) icvp["backgroundColorBlue"] = float(c.b) else: if os.path.isfile(background): # look to see if there are HiDPI resources available if lookForHiDPI is True: name, extension = os.path.splitext(os.path.basename(background)) orderedImages = [background] imageDirectory = os.path.dirname(background) if imageDirectory == "": imageDirectory = "." for candidateName in os.listdir(imageDirectory): hasScale = re.match( r"^(?P.+)@(?P\d+)x(?P\.\w+)$", candidateName, ) if ( hasScale and name == hasScale.group("name") and extension == hasScale.group("extension") ): scale = int(hasScale.group("scale")) if len(orderedImages) < scale: orderedImages += [None] * (scale - len(orderedImages)) orderedImages[scale - 1] = os.path.join( imageDirectory, candidateName ) if len(orderedImages) > 1: # compile the grouped tiff backgroundFile = tempfile.NamedTemporaryFile(suffix=".tiff") background = backgroundFile.name output = tempfile.TemporaryFile(mode="w+") try: subprocess.check_call( ["/usr/bin/tiffutil", "-cathidpicheck"] + list(filter(None, orderedImages)) + ["-out", background], stdout=output, stderr=output, ) except Exception as e: output.seek(0) raise ValueError( f"unable to compile combined HiDPI file {background!r} " f"got error: {str(e)}\noutput: {output.read()}" ) _, kind = os.path.splitext(background) path_in_image = os.path.join(mount_point, ".background" + kind) shutil.copyfile(background, path_in_image) else: dmg_resources = resources.files("dmgbuild") bg_resource = dmg_resources.joinpath( "resources/" + background + ".tiff" ) if bg_resource.is_file(): path_in_image = os.path.join(mount_point, ".background.tiff") with bg_resource.open("rb") as in_file: with open(path_in_image, "wb") as out_file: out_file.write(in_file.read()) else: raise ValueError(f'background file "{background}" not found') alias = Alias.for_file(path_in_image) icvp["backgroundType"] = 2 icvp["backgroundImageAlias"] = alias.to_bytes() callback( { "type": "operation::finished", "operation": "background::create", } ) callback( { "type": "operation::start", "operation": "files::add", "total": len(options["files"]), } ) for f in options["files"]: if isinstance(f, tuple): f_in_image = os.path.join(mount_point, f[1]) f = f[0] else: basename = os.path.basename(f.rstrip("/")) f_in_image = os.path.join(mount_point, basename) callback( { "type": "operation::start", "operation": "file::add", "file": f_in_image, } ) # use system ditto command to preserve code signing, etc. subprocess.call(["/usr/bin/ditto", f, f_in_image]) callback( { "type": "operation::finished", "operation": "file::add", "file": f_in_image, } ) callback( { "type": "operation::finished", "operation": "files::add", } ) callback( { "type": "operation::start", "operation": "symlinks::add", "total": len(options["symlinks"]), } ) for name, target in options["symlinks"].items(): name_in_image = os.path.join(mount_point, name) callback( { "type": "operation::start", "operation": "symlink::add", "file": name_in_image, "target": target, } ) os.symlink(target, name_in_image) callback( { "type": "operation::finished", "operation": "symlink::add", "file": name_in_image, "target": target, } ) callback( { "type": "operation::finished", "operation": "symlinks::add", } ) callback( { "type": "operation::start", "operation": "extensions::hide", } ) to_hide = [] for name in options["hide_extensions"]: name_in_image = os.path.join(mount_point, name) to_hide.append(name_in_image) if to_hide: subprocess.call(["/usr/bin/SetFile", "-a", "E"] + to_hide) to_hide = [] for name in options["hide"]: name_in_image = os.path.join(mount_point, name) to_hide.append(name_in_image) if to_hide: subprocess.call(["/usr/bin/SetFile", "-a", "V"] + to_hide) callback( { "type": "operation::finished", "operation": "extensions::hide", } ) userfn = options.get("create_hook") if callable(userfn): userfn(mount_point, options) callback( { "type": "operation::start", "operation": "dsstore::create", } ) image_dsstore = os.path.join(mount_point, ".DS_Store") with DSStore.open(image_dsstore, "w+") as d: d["."]["vSrn"] = ("long", 1) d["."]["bwsp"] = bwsp if include_icon_view_settings: d["."]["icvp"] = icvp if include_list_view_settings: d["."]["lsvp"] = lsvp d["."]["icvl"] = icvl for k, v in options["icon_locations"].items(): d[k]["Iloc"] = v callback( { "type": "operation::finished", "operation": "dsstore::create", } ) # Delete .Trashes, if it gets created shutil.rmtree(os.path.join(mount_point, ".Trashes"), True) except Exception: # Always try to detach hdiutil("detach", "-force", device, plist=False) raise callback( { "type": "operation::finished", "operation": "dmg::create", } ) # Flush writes before attempting to detach. subprocess.check_call(("sync", "--file-system", mount_point)) retry_time = 1 for _ in range(detach_retries): callback( { "type": "command::start", "command": "hdiutil::detach", } ) ret, output = hdiutil("detach", device, plist=False) callback( { "type": "command::finished", "command": "hdiutil::detach", "ret": ret, "output": output, } ) if not ret: break # Exponentially backoff retries retry_time *= 1.5 time.sleep(retry_time) if ret: hdiutil("detach", "-force", device, plist=False) raise DMGError(callback, f"Unable to detach device cleanly: {output}") # Shrink the output to the minimum possible size if options["shrink"]: callback( { "type": "command::start", "command": "hdiutil::resize", } ) ret, output = hdiutil( "resize", "-quiet", "-sectors", "min", writableFile.name, plist=False ) callback( { "type": "command::finished", "command": "hdiutil::resize", "ret": ret, "output": output, } ) if ret: raise DMGError(callback, f"Unable to shrink: {output}") callback( { "type": "operation::start", "operation": "dmg::shrink", } ) key_prefix = {"UDZO": "zlib", "UDBZ": "bzip2", "ULFO": "lzfse", "ULMO": "lzma"} compression_level = options["compression_level"] if options["format"] in key_prefix and compression_level: compression_args = [ "-imagekey", key_prefix[options["format"]] + "-level=" + str(compression_level), ] else: compression_args = [] callback( { "type": "command::start", "command": "hdiutil::convert", } ) ret, output = hdiutil( "convert", writableFile.name, "-format", options["format"], "-ov", "-o", filename, *compression_args, ) callback( { "type": "command::finished", "command": "hdiutil::convert", "ret": ret, "output": output, } ) if ret: raise DMGError(callback, f"Unable to convert: {output}") callback( { "type": "operation::finished", "operation": "dmg::shrink", } ) if options["license"]: callback( { "type": "operation::start", "command": "dmg::addlicense", } ) licenseDict = licensing.build_license(options["license"]) tempLicenseFile = open(os.path.join(dirname, "license.plist"), "wb") plistlib.dump(licenseDict, tempLicenseFile) tempLicenseFile.close() # see https://developer.apple.com/forums/thread/668084 ret, output = hdiutil( "udifrez", "-xml", tempLicenseFile.name, "", "-quiet", filename, plist=False ) os.remove(tempLicenseFile.name) if ret: raise DMGError(callback, f"Unable to add license: {output}") callback( { "type": "operation::finished", "command": "dmg::addlicense", } ) callback({"type": "build::finished"}) qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/dmgbuild/licensing.py0000644000175100017510000003051615154533055027544 0ustar runnerrunnerimport os # based on https://github.com/argv-minus-one/dmg-license/blob/master/language-info-generator/Languages.tsv # note that this table specifies STR# Resource ID but it seems to have no effect language_info_map = { "da_DK": {"buttons": "Danish", "name": "Danish", "language_id": 9}, "de_AT": {"buttons": "German", "name": "German (Austrian)", "language_id": 92}, "de_CH": {"buttons": "German", "name": "German (Swiss)", "language_id": 19}, "de_DE": {"buttons": "German", "name": "German", "language_id": 3}, "en_AU": {"buttons": "English", "name": "English (Australian)", "language_id": 15}, "en_GB": {"buttons": "English", "name": "English (UK)", "language_id": 2}, "en_IE": {"buttons": "English", "name": "English (Ireland)", "language_id": 108}, "en_SG": { "buttons": "English", "name": "English (Singaporean)", "language_id": 100, }, "en_US": {"buttons": "English", "name": "English", "language_id": 0}, "es_ES": {"buttons": "Spanish", "name": "Spanish", "language_id": 8}, "fi_FI": {"buttons": "Finnish", "name": "Finnish", "language_id": 17}, "fr_BE": {"buttons": "French", "name": "French (Belgian)", "language_id": 98}, "fr_CA": {"buttons": "French", "name": "French (Canadian)", "language_id": 11}, "fr_CH": {"buttons": "French", "name": "French (Swiss)", "language_id": 18}, "fr_FR": {"buttons": "French", "name": "French", "language_id": 1}, "it_IT": {"buttons": "Italian", "name": "Italian", "language_id": 4}, "ja_JP": { "buttons": "Japanese", "name": "Japanese", "language_id": 14, # not sure if this is correct encoding, but seems to be working "encoding": "shift_jis", "multibyte": True, }, "ko_KR": { "buttons": "Korean", "name": "Korean", "language_id": 51, "encoding": "ksx1001", "multibyte": True, }, "nb_NO": {"buttons": "Norwegian", "name": "Norwegian", "language_id": 12}, "nl_BE": {"buttons": "Dutch", "name": "Dutch", "language_id": 6}, "nl_NL": {"buttons": "Dutch", "name": "Dutch", "language_id": 5}, "pt_BR": { "buttons": "Portuguese", "name": "Portuguese (Brazilian)", "language_id": 71, }, "pt_PT": {"buttons": "Portuguese", "name": "Portuguese", "language_id": 10}, "ru_RU": { "buttons": "Russian", "name": "Russian", "language_id": 49, "encoding": "mac_cyrillic", }, "sv_SE": {"buttons": "Swedish", "name": "Swedish", "language_id": 7}, "zh_CN": { "buttons": "Simplified", "name": "Simplified Chinese", "language_id": 52, "encoding": "gb2312", "multibyte": True, }, "zh_TW": { "buttons": "Traditional", "name": "Traditional Chinese", "language_id": 53, "encoding": "big5", "multibyte": True, }, } # Buttons (these come from the SLAResources file which you can find in the SLA # SDK on developer.apple.com) default_buttons = { "English": ( "English", "Agree", "Disagree", "Print", "Save", 'If you agree with the terms of this license, press "Agree" to install the software. If you do not agree, press "Disagree".', # noqa: E501 ), "German": ( "Deutsch", "Akzeptieren", "Ablehnen", "Drucken", "Sichern...", 'Klicken Sie in "Akzeptieren", wenn Sie mit den Bestimmungen des Software-Lizenzvertrags einverstanden sind. Falls nicht, bitte "Ablehnen" anklicken. Sie können die Software nur installieren, wenn Sie "Akzeptieren" angeklickt haben.', # noqa: E501 ), "Spanish": ( "Español", "Aceptar", "No aceptar", "Imprimir", "Guardar...", 'Si está de acuerdo con los términos de esta licencia, pulse "Aceptar" para instalar el software. En el supuesto de que no esté de acuerdo con los términos de esta licencia, pulse "No aceptar."', # noqa: E501 ), "French": ( "Français", "Accepter", "Refuser", "Imprimer", "Enregistrer...", 'Si vous acceptez les termes de la présente licence, cliquez sur "Accepter" afin d\'installer le logiciel. Si vous n\'êtes pas d\'accord avec les termes de la licence, cliquez sur "Refuser".', # noqa: E501 ), "Italian": ( "Italiano", "Accetto", "Rifiuto", "Stampa", "Registra...", 'Se accetti le condizioni di questa licenza, fai clic su "Accetto" per installare il software. Altrimenti fai clic su "Rifiuto".', # noqa: E501 ), "Japanese": ( "日本語", "同意します", "同意しません", "印刷する", "保存...", "本ソフトウエア使用許諾契約の条件に同意される場合には、ソフトウエアをインストールするために「同意します」を押してください。\u3000同意されない場合には、「同意しません」を押してください。", # noqa: E501 ), "Dutch": ( "Nederlands", "Ja", "Nee", "Print", "Bewaar...", "Indien u akkoord gaat met de voorwaarden van deze licentie, kunt u op 'Ja' klikken om de programmatuur te installeren. Indien u niet akkoord gaat, klikt u op 'Nee'.", # noqa: E501 ), "Russian": ( "Русский", "Согласен", "Не согласен", "Распечатать", "Сохранить", "Если вы согласны с условиями данной лицензии, нажмите «Согласен», чтобы установить программное обеспечение. Если вы не согласны, нажмите «Не согласен».", # noqa: E501 ), "Swedish": ( "Svensk", "Godkänns", "Avböjs", "Skriv ut", "Spara...", 'Om Du godkänner licensvillkoren klicka på "Godkänns" för att installera programprodukten. Om Du inte godkänner licensvillkoren, klicka på "Avböjs".', # noqa: E501 ), "Portuguese": ( "Português", "Concordar", "Discordar", "Imprimir", "Salvar...", 'Se está de acordo com os termos desta licença, pressione "Concordar" para instalar o software. Se não está de acordo, pressione "Discordar".', # noqa: E501 ), "Simplified Chinese": ( "汉语", "同意", "不同意", "打印", "存储…", "如果您同意本许可协议的条款,请按“同意”来安装此软件。如果您不同意,请按“不同意”。", # noqa: E501 ), "Traditional Chinese": ( "漢語", "同意", "不同意", "列印", "儲存…", "如果您同意本許可證裡的條款,請按“同意”以安裝軟體。如果不同意,請按“不同意”。", # noqa: E501 ), "Danish": ( "Dansk", "Enig", "Uenig", "Udskriv", "Arkiver...", "Hvis du accepterer betingelserne i licensaftalen, skal du klikke på “Enig” for at installere softwaren. Klik på “Uenig” for at annullere installeringen.", # noqa: E501 ), "Finnish": ( "Suomi", "Hyväksyn", "En hyväksy", "Tulosta", "Tallenna…", 'Hyväksy lisenssisopimuksen ehdot osoittamalla "Hyväksy". Jos et hyväksy sopimuksen ehtoja, osoita "En hyväksy".', # noqa: E501 ), "Korean": ( "한국어", "동의", "동의 안함", "프린트", "저장...", '사용 계약서의 내용에 동의하면, "동의" 단추를 눌러 소프트웨어를 설치하십시오. 동의하지 않는다면, "동의 안함" 단추를 누르십시오.', # noqa: E501 ), "Norwegian": ( "Norsk", "Enig", "Ikke enig", "Skriv ut", "Arkiver...", 'Hvis De er enig i bestemmelsene i denne lisensavtalen, klikker De på "Enig"-knappen for å installere programvaren. Hvis De ikke er enig, klikker De på "Ikke enig".', # noqa: E501 ), } udifrezXMLtemplate = { "STR#": [], # ?? License text would be included in a block like this: # ?? 'TEXT': [ # ?? { # ?? 'Attributes': '0x0000', # ?? 'Data': b'license text', # ?? 'ID': '5000', # ?? 'Name': 'English' # ?? } # ?? ], "TMPL": [ { "Attributes": "0x0000", "Data": b"\x13Default Language IDDWRD\x05CountOCNT\x04****LSTC\x0bsys lang IDDWRD\x1elocal res ID (offset from 5000DWRD\x102-byte language?DWRD\x04****LSTE", # noqa: E501 "ID": "128", "Name": "LPic", } ], } # Another implementation in TS: # https://github.com/argv-minus-one/dmg-license/blob/4268f2e822944fd670c1e197596396f233d6484e/src/makeLicensePlist.ts def build_license(license_info): """Add a license agreement to the specified disk image file, see https://developer.apple.com/forums/thread/668084.""" # Copy the original template xml = dict(udifrezXMLtemplate) licenses = license_info.get( "licenses", {"en_US": default_buttons["English"][5].encode("utf-8")}, ) lpic = b"" # The first field is the default language ID. lpic += (5000).to_bytes(2, "big") # The second field is the count of language ID to license resource mappings. lpic += len(licenses.items()).to_bytes(2, "big") for language, license_data in licenses.items(): if language not in language_info_map: raise Exception( "Unknown language '" + language + "'. Valid languages are: " + ", ".join(sorted(language_info_map.keys())) ) language_info = language_info_map[language] language_buttons = language_info["buttons"] language_name = language_info["name"] language_id = language_info["language_id"] # for simplicity we use the same id for the resource # as system language id + 5000 resource_id = language_id + 5000 language_encoding = language_info.get("encoding", "mac_roman") multibyte_encoding = language_info.get("multibyte_encoding", False) if os.path.isfile(license_data): mode = "rb" if license_data.endswith(".rtf") else "r" with open(license_data, mode=mode) as f: license_data = f.read() if isinstance(license_data, bytes): if license_data.startswith(b"{\\rtf1"): licenseDataFormat = "RTF " else: licenseDataFormat = "TEXT" else: licenseDataFormat = "TEXT" license_data = license_data.encode(language_encoding) if licenseDataFormat not in xml: xml[licenseDataFormat] = [] xml[licenseDataFormat].append( { "Attributes": "0x0000", "Data": license_data, "ID": str(resource_id), "Name": f"{language_name} SLA", } ) language_default_buttons = default_buttons.get( language_buttons, default_buttons["English"] ) buttons = license_info.get("buttons", {}).get( language, language_default_buttons ) assert len(buttons) == 6, "License buttons must have 6 entries." buttons = [b.encode(language_encoding) for b in buttons] buttons = [len(b).to_bytes(1, "big") + b for b in buttons] xml["STR#"].append( { "Attributes": "0x0000", # \x06 is apparently the number of buttons which is always 6 "Data": b"\x00\x06" + b"".join(buttons), "ID": str(resource_id), "Name": language_name, } ) # Finally, the list of resource ID mappings: # Mapping field 1: system language ID lpic += language_id.to_bytes(2, "big") # Mapping field 2: local resource ID minus 5000 lpic += int(resource_id - 5000).to_bytes(2, "big") # Mapping field 3: 2-byte language? lpic += int(1 if multibyte_encoding else 0).to_bytes(2, "big") xml["LPic"] = [ { "Attributes": "0x0000", "Data": lpic, "ID": "5000", "Name": "", } ] return xml qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/dmgbuild/LICENSE0000644000175100017510000000204515154533055026220 0ustar runnerrunnerCopyright (c) 2014 Alastair Houghton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/dmgbuild/badge.py0000644000175100017510000001403615154533055026632 0ustar runnerrunnerimport math from Quartz import ( CFURLCreateWithFileSystemPath, CGBitmapContextCreate, CGBitmapContextCreateImage, CGColorSpaceCreateWithName, CGImageDestinationAddImage, CGImageDestinationCreateWithURL, CGImageDestinationFinalize, CGImageSourceCopyPropertiesAtIndex, CGImageSourceCreateImageAtIndex, CGImageSourceCreateWithURL, CGImageSourceGetCount, CIContext, CIFilter, CIImage, CIVector, NSAffineTransform, kCFURLPOSIXPathStyle, kCGColorSpaceGenericRGB, kCGImageAlphaPremultipliedLast, kCIInputAspectRatioKey, kCIInputBackgroundImageKey, kCIInputImageKey, kCIInputScaleKey, kCIOutputImageKey, ) _REMOVABLE_DISK_PATH = ( "/System/Library/Extensions/IOStorageFamily.kext/Contents/Resources/Removable.icns" ) def badge_disk_icon(badge_file, output_file): # Load the Removable disk icon url = CFURLCreateWithFileSystemPath( None, _REMOVABLE_DISK_PATH, kCFURLPOSIXPathStyle, False ) backdrop = CGImageSourceCreateWithURL(url, None) backdropCount = CGImageSourceGetCount(backdrop) # Load the badge url = CFURLCreateWithFileSystemPath(None, badge_file, kCFURLPOSIXPathStyle, False) badge = CGImageSourceCreateWithURL(url, None) assert badge is not None, f"Unable to process image file: {badge_file}" badgeCount = CGImageSourceGetCount(badge) # Set up a destination for our target url = CFURLCreateWithFileSystemPath(None, output_file, kCFURLPOSIXPathStyle, False) target = CGImageDestinationCreateWithURL(url, "com.apple.icns", backdropCount, None) # Get the RGB colorspace rgbColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB) # Scale scale = 1.0 # Perspective transform corners = ((0.2, 0.95), (0.8, 0.95), (0.85, 0.35), (0.15, 0.35)) # Translation position = (0.5, 0.5) for n in range(backdropCount): props = CGImageSourceCopyPropertiesAtIndex(backdrop, n, None) width = props["PixelWidth"] height = props["PixelHeight"] dpi = props["DPIWidth"] depth = props["Depth"] # Choose the best sized badge image bestWidth = None # ?? bestHeight = None bestBadge = None bestDepth = None # ?? bestDPI = None for m in range(badgeCount): badgeProps = CGImageSourceCopyPropertiesAtIndex(badge, m, None) badgeWidth = badgeProps["PixelWidth"] # ?? badgeHeight = badgeProps['PixelHeight'] badgeDPI = badgeProps["DPIWidth"] badgeDepth = badgeProps["Depth"] if bestBadge is None or ( badgeWidth <= width and ( bestWidth > width or badgeWidth > bestWidth or ( badgeWidth == bestWidth and badgeDPI == dpi and badgeDepth <= depth and (bestDepth is None or badgeDepth > bestDepth) ) ) ): bestBadge = m bestWidth = badgeWidth # ?? bestHeight = badgeHeight # ?? bestDPI = badgeDPI bestDepth = badgeDepth badgeImage = CGImageSourceCreateImageAtIndex(badge, bestBadge, None) badgeCI = CIImage.imageWithCGImage_(badgeImage) backgroundImage = CGImageSourceCreateImageAtIndex(backdrop, n, None) backgroundCI = CIImage.imageWithCGImage_(backgroundImage) compositor = CIFilter.filterWithName_("CISourceOverCompositing") lanczos = CIFilter.filterWithName_("CILanczosScaleTransform") perspective = CIFilter.filterWithName_("CIPerspectiveTransform") transform = CIFilter.filterWithName_("CIAffineTransform") lanczos.setValue_forKey_(badgeCI, kCIInputImageKey) lanczos.setValue_forKey_(scale * float(width) / bestWidth, kCIInputScaleKey) lanczos.setValue_forKey_(1.0, kCIInputAspectRatioKey) topLeft = (width * scale * corners[0][0], width * scale * corners[0][1]) topRight = (width * scale * corners[1][0], width * scale * corners[1][1]) bottomRight = (width * scale * corners[2][0], width * scale * corners[2][1]) bottomLeft = (width * scale * corners[3][0], width * scale * corners[3][1]) out = lanczos.valueForKey_(kCIOutputImageKey) if width >= 16: perspective.setValue_forKey_(out, kCIInputImageKey) perspective.setValue_forKey_( CIVector.vectorWithX_Y_(*topLeft), "inputTopLeft" ) perspective.setValue_forKey_( CIVector.vectorWithX_Y_(*topRight), "inputTopRight" ) perspective.setValue_forKey_( CIVector.vectorWithX_Y_(*bottomRight), "inputBottomRight" ) perspective.setValue_forKey_( CIVector.vectorWithX_Y_(*bottomLeft), "inputBottomLeft" ) out = perspective.valueForKey_(kCIOutputImageKey) tfm = NSAffineTransform.transform() tfm.translateXBy_yBy_( math.floor((position[0] - 0.5 * scale) * width), math.floor((position[1] - 0.5 * scale) * height), ) transform.setValue_forKey_(out, kCIInputImageKey) transform.setValue_forKey_(tfm, "inputTransform") out = transform.valueForKey_(kCIOutputImageKey) compositor.setValue_forKey_(out, kCIInputImageKey) compositor.setValue_forKey_(backgroundCI, kCIInputBackgroundImageKey) result = compositor.valueForKey_(kCIOutputImageKey) cgContext = CGBitmapContextCreate( None, width, height, 8, 0, rgbColorSpace, kCGImageAlphaPremultipliedLast ) context = CIContext.contextWithCGContext_options_(cgContext, None) context.drawImage_inRect_fromRect_( result, ((0, 0), (width, height)), ((0, 0), (width, height)) ) image = CGBitmapContextCreateImage(cgContext) CGImageDestinationAddImage(target, image, props) CGImageDestinationFinalize(target) qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/dmgbuild/__init__.py0000644000175100017510000000013315154533055027320 0ustar runnerrunnerfrom .core import build_dmg __version__ = "1.6.7" __all__ = ["__version__", "build_dmg"] qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/dmgbuild/colors.py0000644000175100017510000003113615154533055027071 0ustar runnerrunnerimport math import re class Color: def to_rgb(self): raise Exception("Must implement to_rgb() in subclasses") class RGB: def __init__(self, r, g, b): self.r = r self.g = g self.b = b def to_rgb(self): return self class HSL(Color): def __init__(self, h, s, l): # noqa: E741 self.h = h self.s = s self.l = l # noqa: E741 @staticmethod def _hue_to_rgb(t1, t2, hue): if hue < 0: hue += 6 elif hue >= 6: hue -= 6 if hue < 1: return (t2 - t1) * hue + t1 elif hue < 3: return t2 elif hue < 4: return (t2 - t1) * (4 - hue) + t1 else: return t1 def to_rgb(self): hue = self.h / 60.0 if self.l <= 0.5: # noqa: E741 t2 = self.l * (self.s + 1) else: t2 = self.l + self.s - (self.l * self.s) t1 = self.l * 2 - t2 r = self._hue_to_rgb(t1, t2, hue + 2) g = self._hue_to_rgb(t1, t2, hue) b = self._hue_to_rgb(t1, t2, hue - 2) return RGB(r, g, b) class HWB(Color): def __init__(self, h, w, b): self.h = h self.w = w self.b = b @staticmethod def _hue_to_rgb(hue): if hue < 0: hue += 6 elif hue >= 6: hue -= 6 if hue < 1: return hue elif hue < 3: return 1 elif hue < 4: return 4 - hue else: return 0 def to_rgb(self): hue = self.h / 60.0 t1 = 1 - self.w - self.b r = self._hue_to_rgb(hue + 2) * t1 + self.w g = self._hue_to_rgb(hue) * t1 + self.w b = self._hue_to_rgb(hue - 2) * t1 + self.w return RGB(r, g, b) class CMYK(Color): def __init__(self, c, m, y, k): self.c = c self.m = m self.y = y self.k = k def to_rgb(self): r = 1.0 - min(1.0, self.c + self.k) g = 1.0 - min(1.0, self.m + self.k) b = 1.0 - min(1.0, self.y + self.k) return RGB(r, g, b) class Gray(Color): def __init__(self, g): self.g = g def to_rgb(self): return RGB(self.g, self.g, self.g) _x11_colors = { "aliceblue": (240, 248, 255), "antiquewhite": (250, 235, 215), "aqua": (0, 255, 255), "aquamarine": (127, 255, 212), "azure": (240, 255, 255), "beige": (245, 245, 220), "bisque": (255, 228, 196), "black": (0, 0, 0), "blanchedalmond": (255, 235, 205), "blue": (0, 0, 255), "blueviolet": (138, 43, 226), "brown": (165, 42, 42), "burlywood": (222, 184, 135), "cadetblue": (95, 158, 160), "chartreuse": (127, 255, 0), "chocolate": (210, 105, 30), "coral": (255, 127, 80), "cornflowerblue": (100, 149, 237), "cornsilk": (255, 248, 220), "crimson": (220, 20, 60), "cyan": (0, 255, 255), "darkblue": (0, 0, 139), "darkcyan": (0, 139, 139), "darkgoldenrod": (184, 134, 11), "darkgray": (169, 169, 169), "darkgreen": (0, 100, 0), "darkgrey": (169, 169, 169), "darkkhaki": (189, 183, 107), "darkmagenta": (139, 0, 139), "darkolivegreen": (85, 107, 47), "darkorange": (255, 140, 0), "darkorchid": (153, 50, 204), "darkred": (139, 0, 0), "darksalmon": (233, 150, 122), "darkseagreen": (143, 188, 143), "darkslateblue": (72, 61, 139), "darkslategray": (47, 79, 79), "darkslategrey": (47, 79, 79), "darkturquoise": (0, 206, 209), "darkviolet": (148, 0, 211), "deeppink": (255, 20, 147), "deepskyblue": (0, 191, 255), "dimgray": (105, 105, 105), "dimgrey": (105, 105, 105), "dodgerblue": (30, 144, 255), "firebrick": (178, 34, 34), "floralwhite": (255, 250, 240), "forestgreen": (34, 139, 34), "fuchsia": (255, 0, 255), "gainsboro": (220, 220, 220), "ghostwhite": (248, 248, 255), "gold": (255, 215, 0), "goldenrod": (218, 165, 32), "gray": (128, 128, 128), "grey": (128, 128, 128), "green": (0, 128, 0), "greenyellow": (173, 255, 47), "honeydew": (240, 255, 240), "hotpink": (255, 105, 180), "indianred": (205, 92, 92), "indigo": (75, 0, 130), "ivory": (255, 255, 240), "khaki": (240, 230, 140), "lavender": (230, 230, 250), "lavenderblush": (255, 240, 245), "lawngreen": (124, 252, 0), "lemonchiffon": (255, 250, 205), "lightblue": (173, 216, 230), "lightcoral": (240, 128, 128), "lightcyan": (224, 255, 255), "lightgoldenrodyellow": (250, 250, 210), "lightgray": (211, 211, 211), "lightgreen": (144, 238, 144), "lightgrey": (211, 211, 211), "lightpink": (255, 182, 193), "lightsalmon": (255, 160, 122), "lightseagreen": (32, 178, 170), "lightskyblue": (135, 206, 250), "lightslategray": (119, 136, 153), "lightslategrey": (119, 136, 153), "lightsteelblue": (176, 196, 222), "lightyellow": (255, 255, 224), "lime": (0, 255, 0), "limegreen": (50, 205, 50), "linen": (250, 240, 230), "magenta": (255, 0, 255), "maroon": (128, 0, 0), "mediumaquamarine": (102, 205, 170), "mediumblue": (0, 0, 205), "mediumorchid": (186, 85, 211), "mediumpurple": (147, 112, 219), "mediumseagreen": (60, 179, 113), "mediumslateblue": (123, 104, 238), "mediumspringgreen": (0, 250, 154), "mediumturquoise": (72, 209, 204), "mediumvioletred": (199, 21, 133), "midnightblue": (25, 25, 112), "mintcream": (245, 255, 250), "mistyrose": (255, 228, 225), "moccasin": (255, 228, 181), "navajowhite": (255, 222, 173), "navy": (0, 0, 128), "oldlace": (253, 245, 230), "olive": (128, 128, 0), "olivedrab": (107, 142, 35), "orange": (255, 165, 0), "orangered": (255, 69, 0), "orchid": (218, 112, 214), "palegoldenrod": (238, 232, 170), "palegreen": (152, 251, 152), "paleturquoise": (175, 238, 238), "palevioletred": (219, 112, 147), "papayawhip": (255, 239, 213), "peachpuff": (255, 218, 185), "peru": (205, 133, 63), "pink": (255, 192, 203), "plum": (221, 160, 221), "powderblue": (176, 224, 230), "purple": (128, 0, 128), "red": (255, 0, 0), "rosybrown": (188, 143, 143), "royalblue": (65, 105, 225), "saddlebrown": (139, 69, 19), "salmon": (250, 128, 114), "sandybrown": (244, 164, 96), "seagreen": (46, 139, 87), "seashell": (255, 245, 238), "sienna": (160, 82, 45), "silver": (192, 192, 192), "skyblue": (135, 206, 235), "slateblue": (106, 90, 205), "slategray": (112, 128, 144), "slategrey": (112, 128, 144), "snow": (255, 250, 250), "springgreen": (0, 255, 127), "steelblue": (70, 130, 180), "tan": (210, 180, 140), "teal": (0, 128, 128), "thistle": (216, 191, 216), "tomato": (255, 99, 71), "turquoise": (64, 224, 208), "violet": (238, 130, 238), "wheat": (245, 222, 179), "white": (255, 255, 255), "whitesmoke": (245, 245, 245), "yellow": (255, 255, 0), "yellowgreen": (154, 205, 50), } _ws_re = re.compile(r"\s+") _token_re = re.compile(r"[A-Za-z_][A-Za-z0-9_]*") _hex_re = re.compile(r"#([0-9a-f]{3}(?:[0-9a-f]{3})?)$", re.IGNORECASE) _number_re = re.compile(r"[0-9]*(\.[0-9]*)") class ColorParser: def __init__(self, s): self._string = s self._pos = 0 def skipws(self): m = _ws_re.match(self._string, self._pos) if m: self._pos = m.end(0) def expect(self, s, context=""): if ( len(self._string) - self._pos < len(s) or self._string[self._pos : self._pos + len(s)] != s ): raise ValueError(f'bad color "{self._string}" - expected "{s}"{context}') self._pos += len(s) def expectEnd(self): if self._pos != len(self._string): raise ValueError(f'junk at end of color "{self._string}"') def getToken(self): m = _token_re.match(self._string, self._pos) if m: token = m.group(0) self._pos = m.end(0) return token return None def parseNumber(self, context=""): m = _number_re.match(self._string, self._pos) if m: self._pos = m.end(0) return float(m.group(0)) raise ValueError(f'bad color "{self._string}" - expected a number{context}') def parseColor(self): self.skipws() token = self.getToken() if token: if token == "rgb": return self.parseRGB() elif token == "hsl": return self.parseHSL() elif token == "hwb": return self.parseHWB() elif token == "cmyk": return self.parseCMYK() elif token == "gray" or token == "grey": return self.parseGray() try: r, g, b = _x11_colors[token] except KeyError: raise ValueError(f'unknown color name "{token}"') self.expectEnd() return RGB(r / 255.0, g / 255.0, b / 255.0) m = _hex_re.match(self._string, self._pos) if m: hrgb = m.group(1) if len(hrgb) == 3: r = int("0x" + 2 * hrgb[0], 16) g = int("0x" + 2 * hrgb[1], 16) b = int("0x" + 2 * hrgb[2], 16) else: r = int("0x" + hrgb[0:2], 16) g = int("0x" + hrgb[2:4], 16) b = int("0x" + hrgb[4:6], 16) self._pos = m.end(0) self.skipws() self.expectEnd() return RGB(r / 255.0, g / 255.0, b / 255.0) raise ValueError(f'bad color syntax "{self._string}"') def parseRGB(self): self.expect("(", 'after "rgb"') self.skipws() r = self.parseValue() self.skipws() self.expect(",", 'in "rgb"') self.skipws() g = self.parseValue() self.skipws() self.expect(",", 'in "rgb"') self.skipws() b = self.parseValue() self.skipws() self.expect(")", 'at end of "rgb"') self.skipws() self.expectEnd() return RGB(r, g, b) def parseHSL(self): self.expect("(", 'after "hsl"') self.skipws() h = self.parseAngle() self.skipws() self.expect(",", 'in "hsl"') self.skipws() s = self.parseValue() self.skipws() self.expect(",", 'in "hsl"') self.skipws() l = self.parseValue() # noqa: E741 self.skipws() self.expect(")", 'at end of "hsl"') self.skipws() self.expectEnd() return HSL(h, s, l) def parseHWB(self): self.expect("(", 'after "hwb"') self.skipws() h = self.parseAngle() self.skipws() self.expect(",", 'in "hwb"') self.skipws() w = self.parseValue() self.skipws() self.expect(",", 'in "hwb"') self.skipws() b = self.parseValue() self.skipws() self.expect(")", 'at end of "hwb"') self.skipws() self.expectEnd() return HWB(h, w, b) def parseCMYK(self): self.expect("(", 'after "cmyk"') self.skipws() c = self.parseValue() self.skipws() self.expect(",", 'in "cmyk"') self.skipws() m = self.parseValue() self.skipws() self.expect(",", 'in "cmyk"') self.skipws() y = self.parseValue() self.skipws() self.expect(",", 'in "cmyk"') self.skipws() k = self.parseValue() self.skipws() self.expect(")", 'at end of "cmyk"') self.skipws() self.expectEnd() return CMYK(c, m, y, k) def parseGray(self): self.expect("(", 'after "gray"') self.skipws() g = self.parseValue() self.skipws() self.expect(")", 'at end of "gray') self.skipws() self.expectEnd() return Gray(g) def parseValue(self): n = self.parseNumber() self.skipws() if self._string[self._pos] == "%": n = n / 100.0 self.pos += 1 return n def parseAngle(self): n = self.parseNumber() self.skipws() tok = self.getToken() if tok == "rad": n = n * 180.0 / math.pi elif tok == "grad" or tok == "gon": n = n * 0.9 elif tok != "deg": raise ValueError(f'bad angle unit "{tok}"') return n _color_re = re.compile( r"\s*(#|rgb|hsl|hwb|cmyk|gray|grey|{})".format("|".join(_x11_colors.keys())) ) def isAColor(s): return _color_re.match(s) def parseColor(s): return ColorParser(s).parseColor() qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/dmgbuild/__main__.py0000644000175100017510000000344215154533055027307 0ustar runnerrunner#! /usr/bin/env python3 import argparse from .core import build_dmg def main(): parser = argparse.ArgumentParser(description="Construct a disk image file.") parser.add_argument( "volume_name", metavar="volume-name", help=( "The name to give to the volume (this will appear in the title " "bar when the user mounts the disk image)." ), ) parser.add_argument( "filename", metavar="output.dmg", help="The filename of the disk image to create.", ) parser.add_argument("-s", "--settings", help="The path of the settings file.") parser.add_argument( "-D", dest="defines", action="append", default=[], help="Define a value for the settings file (e.g. -Dfoo=bar).", ) parser.add_argument( "--no-hidpi", dest="lookForHiDPI", action="store_false", default=True, help="Do not search for HiDPI versions of the background image (if specified)", ) parser.add_argument( "--detach-retries", dest="detachRetries", type=int, default=5, choices=range(1, 31), help="Number of attempts to detach disk volume (1 sec. interval)", ) args = parser.parse_args() defines = {} for d in args.defines: k, v = d.split("=", 1) k = k.strip() v = v.strip() if (v.startswith("'") and v.endswith("'")) or ( v.startswith('"') and v.endswith('"') ): v = v[1:-1] defines[k] = v build_dmg( args.filename, args.volume_name, args.settings, defines=defines, lookForHiDPI=args.lookForHiDPI, detach_retries=args.detachRetries, ) if __name__ == "__main__": main() qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/mac_alias/0000755000175100017510000000000015154533055025334 5ustar runnerrunnerqbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/mac_alias/qt_attribution.json0000644000175100017510000000067515154533055031307 0ustar runnerrunner{ "Id": "mac_alias", "Name": "mac_alias", "QDocModule": "qbs", "QtUsage": "Used in the qbs dmg module for building Apple disk images.", "Description": "Generate/parse Mac OS Alias records from Python", "Homepage": "https://github.com/al45tair/mac_alias", "Version": "2.0.6", "License": "MIT License", "LicenseId": "MIT", "LicenseFile": "LICENSE", "Copyright": "Copyright (c) 2014 Alastair Houghton" } qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/mac_alias/LICENSE0000644000175100017510000000204515154533055026342 0ustar runnerrunnerCopyright (c) 2014 Alastair Houghton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/mac_alias/utils.py0000644000175100017510000000063115154533055027046 0ustar runnerrunnerimport datetime ZERO = datetime.timedelta(0) class UTC(datetime.tzinfo): def utcoffset(self, dt): return ZERO def dst(self, dt): return ZERO def tzname(self, dt): return "UTC" utc = UTC() mac_epoch = datetime.datetime(1904, 1, 1, 0, 0, 0, 0, utc) unix_epoch = datetime.datetime(1970, 1, 1, 0, 0, 0, 0, utc) osx_epoch = datetime.datetime(2001, 1, 1, 0, 0, 0, 0, utc) qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/mac_alias/__init__.py0000644000175100017510000000210215154533055027440 0ustar runnerrunner# flake8: noqa from .alias import * from .bookmark import * __version__ = "2.2.2" __all__ = [ "__version__", "ALIAS_KIND_FILE", "ALIAS_KIND_FOLDER", "ALIAS_HFS_VOLUME_SIGNATURE", "ALIAS_FIXED_DISK", "ALIAS_NETWORK_DISK", "ALIAS_400KB_FLOPPY_DISK", "ALIAS_800KB_FLOPPY_DISK", "ALIAS_1_44MB_FLOPPY_DISK", "ALIAS_EJECTABLE_DISK", "ALIAS_NO_CNID", "kBookmarkPath", "kBookmarkCNIDPath", "kBookmarkFileProperties", "kBookmarkFileName", "kBookmarkFileID", "kBookmarkFileCreationDate", "kBookmarkTOCPath", "kBookmarkVolumePath", "kBookmarkVolumeURL", "kBookmarkVolumeName", "kBookmarkVolumeUUID", "kBookmarkVolumeSize", "kBookmarkVolumeCreationDate", "kBookmarkVolumeProperties", "kBookmarkContainingFolder", "kBookmarkUserName", "kBookmarkUID", "kBookmarkWasFileReference", "kBookmarkCreationOptions", "kBookmarkURLLengths", "kBookmarkSecurityExtension", "AppleShareInfo", "VolumeInfo", "TargetInfo", "Alias", "Bookmark", "Data", "URL", ] qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/mac_alias/bookmark.py0000644000175100017510000005454715154533055027532 0ustar runnerrunner# This file implements the Apple "bookmark" format, which is the replacement # for the old-fashioned alias format. The details of this format were # reverse engineered; some things are still not entirely clear. # import datetime import os import struct import sys import uuid from urllib.parse import urljoin if sys.platform == "darwin": from . import osx from .utils import osx_epoch BMK_DATA_TYPE_MASK = 0xFFFFFF00 BMK_DATA_SUBTYPE_MASK = 0x000000FF BMK_STRING = 0x0100 BMK_DATA = 0x0200 BMK_NUMBER = 0x0300 BMK_DATE = 0x0400 BMK_BOOLEAN = 0x0500 BMK_ARRAY = 0x0600 BMK_DICT = 0x0700 BMK_UUID = 0x0800 BMK_URL = 0x0900 BMK_NULL = 0x0A00 BMK_ST_ZERO = 0x0000 BMK_ST_ONE = 0x0001 BMK_BOOLEAN_ST_FALSE = 0x0000 BMK_BOOLEAN_ST_TRUE = 0x0001 # Subtypes for BMK_NUMBER are really CFNumberType values kCFNumberSInt8Type = 1 kCFNumberSInt16Type = 2 kCFNumberSInt32Type = 3 kCFNumberSInt64Type = 4 kCFNumberFloat32Type = 5 kCFNumberFloat64Type = 6 kCFNumberCharType = 7 kCFNumberShortType = 8 kCFNumberIntType = 9 kCFNumberLongType = 10 kCFNumberLongLongType = 11 kCFNumberFloatType = 12 kCFNumberDoubleType = 13 kCFNumberCFIndexType = 14 kCFNumberNSIntegerType = 15 kCFNumberCGFloatType = 16 # Resource property flags (from CFURLPriv.h) kCFURLResourceIsRegularFile = 0x00000001 kCFURLResourceIsDirectory = 0x00000002 kCFURLResourceIsSymbolicLink = 0x00000004 kCFURLResourceIsVolume = 0x00000008 kCFURLResourceIsPackage = 0x00000010 kCFURLResourceIsSystemImmutable = 0x00000020 kCFURLResourceIsUserImmutable = 0x00000040 kCFURLResourceIsHidden = 0x00000080 kCFURLResourceHasHiddenExtension = 0x00000100 kCFURLResourceIsApplication = 0x00000200 kCFURLResourceIsCompressed = 0x00000400 kCFURLResourceIsSystemCompressed = 0x00000400 kCFURLCanSetHiddenExtension = 0x00000800 kCFURLResourceIsReadable = 0x00001000 kCFURLResourceIsWriteable = 0x00002000 kCFURLResourceIsExecutable = 0x00004000 kCFURLIsAliasFile = 0x00008000 kCFURLIsMountTrigger = 0x00010000 # Volume property flags (from CFURLPriv.h) kCFURLVolumeIsLocal = 0x1 kCFURLVolumeIsAutomount = 0x2 kCFURLVolumeDontBrowse = 0x4 kCFURLVolumeIsReadOnly = 0x8 kCFURLVolumeIsQuarantined = 0x10 kCFURLVolumeIsEjectable = 0x20 kCFURLVolumeIsRemovable = 0x40 kCFURLVolumeIsInternal = 0x80 kCFURLVolumeIsExternal = 0x100 kCFURLVolumeIsDiskImage = 0x200 kCFURLVolumeIsFileVault = 0x400 kCFURLVolumeIsLocaliDiskMirror = 0x800 kCFURLVolumeIsiPod = 0x1000 kCFURLVolumeIsiDisk = 0x2000 kCFURLVolumeIsCD = 0x4000 kCFURLVolumeIsDVD = 0x8000 kCFURLVolumeIsDeviceFileSystem = 0x10000 kCFURLVolumeSupportsPersistentIDs = 0x100000000 kCFURLVolumeSupportsSearchFS = 0x200000000 kCFURLVolumeSupportsExchange = 0x400000000 # reserved 0x800000000 kCFURLVolumeSupportsSymbolicLinks = 0x1000000000 kCFURLVolumeSupportsDenyModes = 0x2000000000 kCFURLVolumeSupportsCopyFile = 0x4000000000 kCFURLVolumeSupportsReadDirAttr = 0x8000000000 kCFURLVolumeSupportsJournaling = 0x10000000000 kCFURLVolumeSupportsRename = 0x20000000000 kCFURLVolumeSupportsFastStatFS = 0x40000000000 kCFURLVolumeSupportsCaseSensitiveNames = 0x80000000000 kCFURLVolumeSupportsCasePreservedNames = 0x100000000000 kCFURLVolumeSupportsFLock = 0x200000000000 kCFURLVolumeHasNoRootDirectoryTimes = 0x400000000000 kCFURLVolumeSupportsExtendedSecurity = 0x800000000000 kCFURLVolumeSupports2TBFileSize = 0x1000000000000 kCFURLVolumeSupportsHardLinks = 0x2000000000000 kCFURLVolumeSupportsMandatoryByteRangeLocks = 0x4000000000000 kCFURLVolumeSupportsPathFromID = 0x8000000000000 # reserved 0x10000000000000 kCFURLVolumeIsJournaling = 0x20000000000000 kCFURLVolumeSupportsSparseFiles = 0x40000000000000 kCFURLVolumeSupportsZeroRuns = 0x80000000000000 kCFURLVolumeSupportsVolumeSizes = 0x100000000000000 kCFURLVolumeSupportsRemoteEvents = 0x200000000000000 kCFURLVolumeSupportsHiddenFiles = 0x400000000000000 kCFURLVolumeSupportsDecmpFSCompression = 0x800000000000000 kCFURLVolumeHas64BitObjectIDs = 0x1000000000000000 kCFURLVolumePropertyFlagsAll = 0xFFFFFFFFFFFFFFFF BMK_URL_ST_ABSOLUTE = 0x0001 BMK_URL_ST_RELATIVE = 0x0002 # Bookmark keys kBookmarkURL = 0x1003 # A URL kBookmarkPath = 0x1004 # Array of path components kBookmarkCNIDPath = 0x1005 # Array of CNIDs kBookmarkFileProperties = ( 0x1010 # (CFURL rp flags, CFURL rp flags asked for, 8 bytes NULL) ) kBookmarkFileName = 0x1020 kBookmarkFileID = 0x1030 kBookmarkFileCreationDate = 0x1040 # = 0x1054 # ? # = 0x1055 # ? # = 0x1056 # ? # = 0x1101 # ? # = 0x1102 # ? kBookmarkTOCPath = 0x2000 # A list of (TOC id, ?) pairs kBookmarkVolumePath = 0x2002 kBookmarkVolumeURL = 0x2005 kBookmarkVolumeName = 0x2010 kBookmarkVolumeUUID = 0x2011 # Stored (perversely) as a string kBookmarkVolumeSize = 0x2012 kBookmarkVolumeCreationDate = 0x2013 kBookmarkVolumeProperties = ( 0x2020 # (CFURL vp flags, CFURL vp flags asked for, 8 bytes NULL) ) kBookmarkVolumeIsRoot = 0x2030 # True if volume is FS root kBookmarkVolumeBookmark = 0x2040 # Embedded bookmark for disk image (TOC id) kBookmarkVolumeMountPoint = 0x2050 # A URL # = 0x2070 kBookmarkContainingFolder = 0xC001 # Index of containing folder in path kBookmarkUserName = 0xC011 # User that created bookmark kBookmarkUID = 0xC012 # UID that created bookmark kBookmarkWasFileReference = 0xD001 # True if the URL was a file reference kBookmarkCreationOptions = 0xD010 kBookmarkURLLengths = 0xE003 # See below kBookmarkDisplayName = 0xF017 kBookmarkIconData = 0xF020 kBookmarkIconRef = 0xF021 kBookmarkTypeBindingData = 0xF022 kBookmarkCreationTime = 0xF030 kBookmarkSandboxRwExtension = 0xF080 kBookmarkSandboxRoExtension = 0xF081 kBookmarkAliasData = 0xFE00 # Alias for backwards compatibility kBookmarkSecurityExtension = kBookmarkSandboxRwExtension # kBookmarkURLLengths is an array that is set if the URL encoded by the # bookmark had a base URL; in that case, each entry is the length of the # base URL in question. Thus a URL # # file:///foo/bar/baz blam/blat.html # # will result in [3, 2], while the URL # # file:///foo bar/baz blam blat.html # # would result in [1, 2, 1, 1] class Data: def __init__(self, bytedata=None): #: The bytes, stored as a byte string self.bytes = bytes(bytedata) def __repr__(self): return "Data(%r)" % self.bytes class URL: def __init__(self, base, rel=None): if rel is not None: #: The base URL, if any (a :class:`URL`) self.base = base #: The rest of the URL (a string) self.relative = rel else: self.base = None self.relative = base @property def absolute(self): """Return an absolute URL.""" if self.base is None: return self.relative else: return urljoin(self.base.absolute, self.relative) def __repr__(self): return "URL(%r)" % self.absolute class Bookmark: def __init__(self, tocs=None): if tocs is None: #: The TOCs for this Bookmark self.tocs = [] else: self.tocs = tocs @classmethod def _get_item(cls, data, hdrsize, offset): offset += hdrsize if offset > len(data) - 8: raise ValueError("Offset out of range") length, typecode = struct.unpack(b"d", databytes)[0]) return osx_epoch + secs elif dtype == BMK_BOOLEAN: if dsubtype == BMK_BOOLEAN_ST_TRUE: return True elif dsubtype == BMK_BOOLEAN_ST_FALSE: return False elif dtype == BMK_UUID: return uuid.UUID(bytes=databytes) elif dtype == BMK_URL: if dsubtype == BMK_URL_ST_ABSOLUTE: return URL(databytes.decode("utf-8")) elif dsubtype == BMK_URL_ST_RELATIVE: baseoff, reloff = struct.unpack(b" size: raise ValueError("Not a bookmark file (header size too large)") if size != len(data): raise ValueError("Not a bookmark file (truncated)") (tocoffset,) = struct.unpack(b" size - hdrsize) or (size - tocbase < 20): raise ValueError("TOC offset out of range") (tocsize, tocmagic, tocid, nexttoc, toccount) = struct.unpack( b" -0x80000000 and item < 0x7FFFFFFF: result = struct.pack(b"d", float(secs.total_seconds()) ) elif isinstance(item, uuid.UUID): result = struct.pack(b"4shh", b.read(8)) if recsize < 150: raise ValueError("Incorrect alias length") if version not in (2, 3): raise ValueError("Unsupported alias version %u" % version) if version == 2: ( kind, # h volname, # 28p voldate, # I fstype, # 2s disktype, # h folder_cnid, # I filename, # 64p cnid, # I crdate, # I creator_code, # 4s type_code, # 4s levels_from, # h levels_to, # h volattrs, # I volfsid, # 2s reserved, # 10s ) = struct.unpack(b">h28pI2shI64pII4s4shhI2s10s", b.read(142)) else: ( kind, # h voldate_hr, # Q fstype, # 4s disktype, # h folder_cnid, # I cnid, # I crdate_hr, # Q volattrs, # I reserved, # 14s ) = struct.unpack(b">hQ4shIIQI14s", b.read(46)) volname = b"" filename = b"" creator_code = None type_code = None voldate = voldate_hr / 65536.0 crdate = crdate_hr / 65536.0 voldate = mac_epoch + datetime.timedelta(seconds=voldate) crdate = mac_epoch + datetime.timedelta(seconds=crdate) alias = Alias() alias.appinfo = appinfo alias.volume = VolumeInfo( volname.decode().replace("/", ":"), voldate, fstype, disktype, volattrs, volfsid, ) alias.target = TargetInfo( kind, filename.decode().replace("/", ":"), folder_cnid, cnid, crdate, creator_code, type_code, ) alias.target.levels_from = levels_from alias.target.levels_to = levels_to tag = struct.unpack(b">h", b.read(2))[0] while tag != -1: length = struct.unpack(b">h", b.read(2))[0] value = b.read(length) if length & 1: b.read(1) if tag == TAG_CARBON_FOLDER_NAME: alias.target.folder_name = value.decode().replace("/", ":") elif tag == TAG_CNID_PATH: alias.target.cnid_path = struct.unpack(">%uI" % (length // 4), value) elif tag == TAG_CARBON_PATH: alias.target.carbon_path = value elif tag == TAG_APPLESHARE_ZONE: if alias.volume.appleshare_info is None: alias.volume.appleshare_info = AppleShareInfo() alias.volume.appleshare_info.zone = value elif tag == TAG_APPLESHARE_SERVER_NAME: if alias.volume.appleshare_info is None: alias.volume.appleshare_info = AppleShareInfo() alias.volume.appleshare_info.server = value elif tag == TAG_APPLESHARE_USERNAME: if alias.volume.appleshare_info is None: alias.volume.appleshare_info = AppleShareInfo() alias.volume.appleshare_info.user = value elif tag == TAG_DRIVER_NAME: alias.volume.driver_name = value elif tag == TAG_NETWORK_MOUNT_INFO: alias.volume.network_mount_info = value elif tag == TAG_DIALUP_INFO: alias.volume.dialup_info = value elif tag == TAG_UNICODE_FILENAME: alias.target.filename = value[2:].decode("utf-16be") elif tag == TAG_UNICODE_VOLUME_NAME: alias.volume.name = value[2:].decode("utf-16be") elif tag == TAG_HIGH_RES_VOLUME_CREATION_DATE: seconds = struct.unpack(b">Q", value)[0] / 65536.0 alias.volume.creation_date = mac_epoch + datetime.timedelta( seconds=seconds ) elif tag == TAG_HIGH_RES_CREATION_DATE: seconds = struct.unpack(b">Q", value)[0] / 65536.0 alias.target.creation_date = mac_epoch + datetime.timedelta( seconds=seconds ) elif tag == TAG_POSIX_PATH: alias.target.posix_path = value.decode() elif tag == TAG_POSIX_PATH_TO_MOUNTPOINT: alias.volume.posix_path = value.decode() elif tag == TAG_RECURSIVE_ALIAS_OF_DISK_IMAGE: alias.volume.disk_image_alias = Alias.from_bytes(value) elif tag == TAG_USER_HOME_LENGTH_PREFIX: alias.target.user_home_prefix_len = struct.unpack(b">h", value)[0] else: alias.extra.append((tag, value)) tag = struct.unpack(b">h", b.read(2))[0] return alias @classmethod def from_bytes(cls, bytes): """Construct an :class:`Alias` object given binary Alias data.""" with io.BytesIO(bytes) as b: return cls._from_fd(b) @classmethod def for_file(cls, path): """Create an :class:`Alias` that points at the specified file.""" if sys.platform != "darwin": raise Exception("Not implemented (requires special support)") path = encode_utf8(path) a = Alias() # Find the filesystem st = osx.statfs(path) vol_path = st.f_mntonname # File and folder names in HFS+ are normalized to a form similar to NFD. # Must be normalized (NFD->NFC) before use to avoid unicode string comparison issues. vol_path = normalize("NFC", vol_path.decode("utf-8")).encode("utf-8") # Grab its attributes attrs = [osx.ATTR_CMN_CRTIME, osx.ATTR_VOL_NAME, 0, 0, 0] volinfo = osx.getattrlist(vol_path, attrs, 0) vol_crtime = volinfo[0] vol_name = encode_utf8(volinfo[1]) # Also grab various attributes of the file attrs = [ osx.ATTR_CMN_OBJTYPE | osx.ATTR_CMN_CRTIME | osx.ATTR_CMN_FNDRINFO | osx.ATTR_CMN_FILEID | osx.ATTR_CMN_PARENTID, 0, 0, 0, 0, ] info = osx.getattrlist(path, attrs, osx.FSOPT_NOFOLLOW) if info[0] == osx.VDIR: kind = ALIAS_KIND_FOLDER else: kind = ALIAS_KIND_FILE cnid = info[3] folder_cnid = info[4] dirname, filename = os.path.split(path) if dirname == b"" or dirname == b".": dirname = os.getcwd() foldername = os.path.basename(dirname) creation_date = info[1] if kind == ALIAS_KIND_FILE: creator_code = struct.pack(b"I", info[2].fileInfo.fileCreator) type_code = struct.pack(b"I", info[2].fileInfo.fileType) else: creator_code = b"\0\0\0\0" type_code = b"\0\0\0\0" a.target = TargetInfo( kind, filename, folder_cnid, cnid, creation_date, creator_code, type_code ) a.volume = VolumeInfo(vol_name, vol_crtime, b"H+", ALIAS_FIXED_DISK, 0, b"\0\0") a.target.folder_name = foldername a.volume.posix_path = vol_path rel_path = os.path.relpath(path, vol_path) # Leave off the initial '/' if vol_path is '/' (no idea why) if vol_path == b"/": a.target.posix_path = rel_path else: a.target.posix_path = b"/" + rel_path # Construct the Carbon and CNID paths carbon_path = [] cnid_path = [] head, tail = os.path.split(rel_path) if not tail: head, tail = os.path.split(head) while head or tail: if head: attrs = [osx.ATTR_CMN_FILEID, 0, 0, 0, 0] info = osx.getattrlist(os.path.join(vol_path, head), attrs, 0) cnid_path.append(info[0]) carbon_tail = tail.replace(b":", b"/") carbon_path.insert(0, carbon_tail) head, tail = os.path.split(head) carbon_path = vol_name + b":" + b":\0".join(carbon_path) a.target.carbon_path = carbon_path a.target.cnid_path = cnid_path return a def _to_fd(self, b): # We'll come back and fix the length when we're done pos = b.tell() b.write(struct.pack(b">4shh", self.appinfo, 0, self.version)) carbon_volname = encode_utf8(self.volume.name).replace(b":", b"/") carbon_filename = encode_utf8(self.target.filename).replace(b":", b"/") voldate = (self.volume.creation_date - mac_epoch).total_seconds() crdate = (self.target.creation_date - mac_epoch).total_seconds() if self.version == 2: # NOTE: crdate should be in local time, but that's system dependent # (so doing so is ridiculous, and nothing could rely on it). b.write( struct.pack( b">h28pI2shI64pII4s4shhI2s10s", self.target.kind, # h carbon_volname, # 28p int(voldate), # I self.volume.fs_type, # 2s self.volume.disk_type, # h self.target.folder_cnid, # I carbon_filename, # 64p self.target.cnid, # I int(crdate), # I self.target.creator_code, # 4s self.target.type_code, # 4s self.target.levels_from, # h self.target.levels_to, # h self.volume.attribute_flags, # I self.volume.fs_id, # 2s b"\0" * 10, # 10s ) ) else: b.write( struct.pack( b">hQ4shIIQI14s", self.target.kind, # h int(voldate * 65536), # Q self.volume.fs_type, # 4s self.volume.disk_type, # h self.target.folder_cnid, # I self.target.cnid, # I int(crdate * 65536), # Q self.volume.attribute_flags, # I b"\0" * 14, # 14s ) ) # Excuse the odd order; we're copying Finder if self.target.folder_name: carbon_foldername = encode_utf8(self.target.folder_name).replace(b":", b"/") b.write(struct.pack(b">hh", TAG_CARBON_FOLDER_NAME, len(carbon_foldername))) b.write(carbon_foldername) if len(carbon_foldername) & 1: b.write(b"\0") b.write( struct.pack( b">hhQhhQ", TAG_HIGH_RES_VOLUME_CREATION_DATE, 8, int(voldate * 65536), TAG_HIGH_RES_CREATION_DATE, 8, int(crdate * 65536), ) ) if self.target.cnid_path: cnid_path = struct.pack( ">%uI" % len(self.target.cnid_path), *self.target.cnid_path ) b.write(struct.pack(b">hh", TAG_CNID_PATH, len(cnid_path))) b.write(cnid_path) if self.target.carbon_path: carbon_path = encode_utf8(self.target.carbon_path) b.write(struct.pack(b">hh", TAG_CARBON_PATH, len(carbon_path))) b.write(carbon_path) if len(carbon_path) & 1: b.write(b"\0") if self.volume.appleshare_info: ai = self.volume.appleshare_info if ai.zone: b.write(struct.pack(b">hh", TAG_APPLESHARE_ZONE, len(ai.zone))) b.write(ai.zone) if len(ai.zone) & 1: b.write(b"\0") if ai.server: b.write(struct.pack(b">hh", TAG_APPLESHARE_SERVER_NAME, len(ai.server))) b.write(ai.server) if len(ai.server) & 1: b.write(b"\0") if ai.username: b.write(struct.pack(b">hh", TAG_APPLESHARE_USERNAME, len(ai.username))) b.write(ai.username) if len(ai.username) & 1: b.write(b"\0") if self.volume.driver_name: driver_name = encode_utf8(self.volume.driver_name) b.write(struct.pack(b">hh", TAG_DRIVER_NAME, len(driver_name))) b.write(driver_name) if len(driver_name) & 1: b.write(b"\0") if self.volume.network_mount_info: b.write( struct.pack( b">hh", TAG_NETWORK_MOUNT_INFO, len(self.volume.network_mount_info) ) ) b.write(self.volume.network_mount_info) if len(self.volume.network_mount_info) & 1: b.write(b"\0") if self.volume.dialup_info: b.write( struct.pack( b">hh", TAG_DIALUP_INFO, len(self.volume.network_mount_info) ) ) b.write(self.volume.network_mount_info) if len(self.volume.network_mount_info) & 1: b.write(b"\0") utf16 = decode_utf8(self.target.filename).replace(":", "/").encode("utf-16-be") b.write( struct.pack(b">hhh", TAG_UNICODE_FILENAME, len(utf16) + 2, len(utf16) // 2) ) b.write(utf16) utf16 = decode_utf8(self.volume.name).replace(":", "/").encode("utf-16-be") b.write( struct.pack( b">hhh", TAG_UNICODE_VOLUME_NAME, len(utf16) + 2, len(utf16) // 2 ) ) b.write(utf16) if self.target.posix_path: posix_path = encode_utf8(self.target.posix_path) b.write(struct.pack(b">hh", TAG_POSIX_PATH, len(posix_path))) b.write(posix_path) if len(posix_path) & 1: b.write(b"\0") if self.volume.posix_path: posix_path = encode_utf8(self.volume.posix_path) b.write(struct.pack(b">hh", TAG_POSIX_PATH_TO_MOUNTPOINT, len(posix_path))) b.write(posix_path) if len(posix_path) & 1: b.write(b"\0") if self.volume.disk_image_alias: d = self.volume.disk_image_alias.to_bytes() b.write(struct.pack(b">hh", TAG_RECURSIVE_ALIAS_OF_DISK_IMAGE, len(d))) b.write(d) if len(d) & 1: b.write(b"\0") if self.target.user_home_prefix_len is not None: b.write( struct.pack( b">hhh", TAG_USER_HOME_LENGTH_PREFIX, 2, self.target.user_home_prefix_len, ) ) for t, v in self.extra: b.write(struct.pack(b">hh", t, len(v))) b.write(v) if len(v) & 1: b.write(b"\0") b.write(struct.pack(b">hh", -1, 0)) blen = b.tell() - pos b.seek(pos + 4, os.SEEK_SET) b.write(struct.pack(b">h", blen)) def to_bytes(self): """Returns the binary representation for this :class:`Alias`.""" with io.BytesIO() as b: self._to_fd(b) return b.getvalue() def __str__(self): return "" % self.target.filename def __repr__(self): values = [] if self.appinfo != b"\0\0\0\0": values.append("appinfo=%r" % self.appinfo) if self.version != 2: values.append("version=%r" % self.version) if self.volume is not None: values.append("volume=%r" % self.volume) if self.target is not None: values.append("target=%r" % self.target) if self.extra: values.append("extra=%r" % self.extra) return "Alias(%s)" % ",".join(values) qbs-src-3.2.0/src/3rdparty/python/lib/python3.9/site-packages/mac_alias/osx.py0000644000175100017510000007723215154533055026532 0ustar runnerrunnerimport datetime import os import uuid from ctypes import ( POINTER, Structure, Union, byref, c_byte, c_char, c_char_p, c_int, c_long, c_longlong, c_short, c_uint, c_ulong, c_ulonglong, c_ushort, c_void_p, cdll, create_string_buffer, sizeof, ) from .utils import unix_epoch libc = cdll.LoadLibrary("/usr/lib/libc.dylib") # Constants FSOPT_NOFOLLOW = 0x00000001 FSOPT_NOINMEMUPDATE = 0x00000002 FSOPT_REPORT_FULLSIZE = 0x00000004 FSOPT_PACK_INVAL_ATTRS = 0x00000008 FSOPT_ATTR_CMN_EXTENDED = 0x00000020 FSOPT_RETURN_REALDEV = 0x00000200 VOL_CAPABILITIES_FORMAT = 0 VOL_CAPABILITIES_INTERFACES = 1 VOL_CAP_FMT_PERSISTENTOBJECTIDS = 0x00000001 VOL_CAP_FMT_SYMBOLICLINKS = 0x00000002 VOL_CAP_FMT_HARDLINKS = 0x00000004 VOL_CAP_FMT_JOURNAL = 0x00000008 VOL_CAP_FMT_JOURNAL_ACTIVE = 0x00000010 VOL_CAP_FMT_NO_ROOT_TIMES = 0x00000020 VOL_CAP_FMT_SPARSE_FILES = 0x00000040 VOL_CAP_FMT_ZERO_RUNS = 0x00000080 VOL_CAP_FMT_CASE_SENSITIVE = 0x00000100 VOL_CAP_FMT_CASE_PRESERVING = 0x00000200 VOL_CAP_FMT_FAST_STATFS = 0x00000400 VOL_CAP_FMT_2TB_FILESIZE = 0x00000800 VOL_CAP_FMT_OPENDENYMODES = 0x00001000 VOL_CAP_FMT_HIDDEN_FILES = 0x00002000 VOL_CAP_FMT_PATH_FROM_ID = 0x00004000 VOL_CAP_FMT_NO_VOLUME_SIZES = 0x00008000 VOL_CAP_FMT_DECMPFS_COMPRESSION = 0x00010000 VOL_CAP_FMT_64BIT_OBJECT_IDS = 0x00020000 VOL_CAP_INT_SEARCHFS = 0x00000001 VOL_CAP_INT_ATTRLIST = 0x00000002 VOL_CAP_INT_NFSEXPORT = 0x00000004 VOL_CAP_INT_READDIRATTR = 0x00000008 VOL_CAP_INT_EXCHANGEDATA = 0x00000010 VOL_CAP_INT_COPYFILE = 0x00000020 VOL_CAP_INT_ALLOCATE = 0x00000040 VOL_CAP_INT_VOL_RENAME = 0x00000080 VOL_CAP_INT_ADVLOCK = 0x00000100 VOL_CAP_INT_FLOCK = 0x00000200 VOL_CAP_INT_EXTENDED_SECURITY = 0x00000400 VOL_CAP_INT_USERACCESS = 0x00000800 VOL_CAP_INT_MANLOCK = 0x00001000 VOL_CAP_INT_NAMEDSTREAMS = 0x00002000 VOL_CAP_INT_EXTENDED_ATTR = 0x00004000 VOL_CAP_INT_CLONE = 0x00010000 VOL_CAP_INT_SNAPSHOT = 0x00020000 VOL_CAP_INT_RENAME_SWAP = 0x00040000 VOL_CAP_INT_RENAME_EXCL = 0x00080000 VOL_CAP_INT_RENAME_OPENFAIL = 0x00100000 ATTR_CMN_NAME = 0x00000001 ATTR_CMN_DEVID = 0x00000002 ATTR_CMN_FSID = 0x00000004 ATTR_CMN_OBJTYPE = 0x00000008 ATTR_CMN_OBJTAG = 0x00000010 ATTR_CMN_OBJID = 0x00000020 ATTR_CMN_OBJPERMANENTID = 0x00000040 ATTR_CMN_PAROBJID = 0x00000080 ATTR_CMN_SCRIPT = 0x00000100 ATTR_CMN_CRTIME = 0x00000200 ATTR_CMN_MODTIME = 0x00000400 ATTR_CMN_CHGTIME = 0x00000800 ATTR_CMN_ACCTIME = 0x00001000 ATTR_CMN_BKUPTIME = 0x00002000 ATTR_CMN_FNDRINFO = 0x00004000 ATTR_CMN_OWNERID = 0x00008000 ATTR_CMN_GRPID = 0x00010000 ATTR_CMN_ACCESSMASK = 0x00020000 ATTR_CMN_FLAGS = 0x00040000 ATTR_CMN_GEN_COUNT = 0x00080000 ATTR_CMN_DOCUMENT_ID = 0x00100000 ATTR_CMN_USERACCESS = 0x00200000 ATTR_CMN_EXTENDED_SECURITY = 0x00400000 ATTR_CMN_UUID = 0x00800000 ATTR_CMN_GRPUUID = 0x01000000 ATTR_CMN_FILEID = 0x02000000 ATTR_CMN_PARENTID = 0x04000000 ATTR_CMN_FULLPATH = 0x08000000 ATTR_CMN_ADDEDTIME = 0x10000000 ATTR_CMN_ERROR = 0x20000000 ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 ATTR_CMN_RETURNED_ATTRS = 0x80000000 ATTR_CMN_ALL_ATTRS = 0xFFFFFFFF ATTR_CMN_VALIDMASK = 0xFFFFFFFF ATTR_CMN_SETMASK = 0x51C7FF00 ATTR_CMN_VOLSETMASK = 0x00006700 ATTR_VOL_FSTYPE = 0x00000001 ATTR_VOL_SIGNATURE = 0x00000002 ATTR_VOL_SIZE = 0x00000004 ATTR_VOL_SPACEFREE = 0x00000008 ATTR_VOL_SPACEAVAIL = 0x00000010 ATTR_VOL_MINALLOCATION = 0x00000020 ATTR_VOL_ALLOCATIONCLUMP = 0x00000040 ATTR_VOL_IOBLOCKSIZE = 0x00000080 ATTR_VOL_OBJCOUNT = 0x00000100 ATTR_VOL_FILECOUNT = 0x00000200 ATTR_VOL_DIRCOUNT = 0x00000400 ATTR_VOL_MAXOBJCOUNT = 0x00000800 ATTR_VOL_MOUNTPOINT = 0x00001000 ATTR_VOL_NAME = 0x00002000 ATTR_VOL_MOUNTFLAGS = 0x00004000 ATTR_VOL_MOUNTEDDEVICE = 0x00008000 ATTR_VOL_ENCODINGSUSED = 0x00010000 ATTR_VOL_CAPABILITIES = 0x00020000 ATTR_VOL_UUID = 0x00040000 ATTR_VOL_QUOTA_SIZE = 0x10000000 ATTR_VOL_RESERVED_SIZE = 0x20000000 ATTR_VOL_ATTRIBUTES = 0x40000000 ATTR_VOL_INFO = 0x80000000 ATTR_VOL_ALL_ATTRS = 0xF007FFFF ATTR_DIR_LINKCOUNT = 0x00000001 ATTR_DIR_ENTRYCOUNT = 0x00000002 ATTR_DIR_MOUNTSTATUS = 0x00000004 DIR_MNTSTATUS_MNTPOINT = 0x00000001 DIR_MNTSTATUS_TRIGGER = 0x00000002 ATTR_DIR_ALLOCSIZE = 0x00000008 ATTR_DIR_IOBLOCKSIZE = 0x00000010 ATTR_DIR_DATALENGTH = 0x00000020 ATTR_DIR_ALL_ATTRS = 0x0000003F ATTR_DIR_VALIDMASK = 0x0000003F ATTR_DIR_SETMASK = 0x00000000 ATTR_FILE_LINKCOUNT = 0x00000001 ATTR_FILE_TOTALSIZE = 0x00000002 ATTR_FILE_ALLOCSIZE = 0x00000004 ATTR_FILE_IOBLOCKSIZE = 0x00000008 ATTR_FILE_DEVTYPE = 0x00000020 ATTR_FILE_FORKCOUNT = 0x00000080 ATTR_FILE_FORKLIST = 0x00000100 ATTR_FILE_DATALENGTH = 0x00000200 ATTR_FILE_DATAALLOCSIZE = 0x00000400 ATTR_FILE_RSRCLENGTH = 0x00001000 ATTR_FILE_RSRCALLOCSIZE = 0x00002000 ATTR_FILE_ALL_ATTRS = 0x000037FF ATTR_FILE_VALIDMASK = 0x000037FF ATTR_FILE_SETMASK = 0x00000020 # These are deprecated ATTR_FORK_TOTALSIZE = 0x00000001 ATTR_FORK_ALLOCSIZE = 0x00000002 ATTR_FORK_ALL_ATTRS = 0x00000003 # These go in the fork attribute field ATTR_CMNEXT_RELPATH = 0x00000004 ATTR_CMNEXT_PRIVATESIZE = 0x00000008 ATTR_CMNEXT_LINKID = 0x0000010 ATTR_CMNEXT_NOFIRMLINKPATH = 0x00000020 ATTR_CMNEXT_REALDEVID = 0x00000040 ATTR_CMNEXT_REALFSID = 0x00000080 ATTR_CMNEXT_CLONEID = 0x00000100 ATTR_CMNEXT_EXT_FLAGS = 0x00000200 ATTR_CMNEXT_RECURSIVE_GENCOUNT = 0x00000400 ATTR_CMNEXT_ALL_ATTRS = 0x000007FC ATTR_CMNEXT_VALIDMASK = 0x000007FC ATTR_CMNEXT_SETMASK = 0x00000000 ATTR_FORK_VALIDMASK = 0x00000003 ATTR_FORK_SETMASK = 0x00000000 # These can't be used ATTR_CMN_NAMEDATTRCOUNT = 0x00080000 ATTR_CMN_NAMEDATTRLIST = 0x00100000 ATTR_FILE_CLUMPSIZE = 0x00000010 ATTR_FILE_FILETYPE = 0x00000040 ATTR_FILE_DATAEXTENTS = 0x00000800 ATTR_FILE_RSRCEXTENTS = 0x00004000 class attrlist(Structure): _fields_ = [ ("bitmapcount", c_ushort), ("reserved", c_ushort), ("commonattr", c_uint), ("volattr", c_uint), ("dirattr", c_uint), ("fileattr", c_uint), ("forkattr", c_uint), ] class attribute_set_t(Structure): _fields_ = [ ("commonattr", c_uint), ("volattr", c_uint), ("dirattr", c_uint), ("fileattr", c_uint), ("forkattr", c_uint), ] class fsobj_id_t(Structure): _fields_ = [ ("fid_objno", c_uint), ("fid_generation", c_uint), ] class timespec(Structure): _fields_ = [ ("tv_sec", c_long), ("tv_nsec", c_long), ] class attrreference_t(Structure): _fields_ = [ ("attr_dataoffset", c_int), ("attr_length", c_uint), ] class fsid_t(Structure): _fields_ = [ ("val", c_uint * 2), ] class guid_t(Structure): _fields_ = [ ("g_guid", c_byte * 16), ] class kauth_ace(Structure): _fields_ = [ ("ace_applicable", guid_t), ("ace_flags", c_uint), ] class kauth_acl(Structure): _fields_ = [ ("acl_entrycount", c_uint), ("acl_flags", c_uint), ("acl_ace", kauth_ace * 128), ] class kauth_filesec(Structure): _fields_ = [ ("fsec_magic", c_uint), ("fsec_owner", guid_t), ("fsec_group", guid_t), ("fsec_acl", kauth_acl), ] class diskextent(Structure): _fields_ = [ ("startblock", c_uint), ("blockcount", c_uint), ] OSType = c_uint UInt16 = c_ushort SInt16 = c_short SInt32 = c_int class Point(Structure): _fields_ = [ ("x", SInt16), ("y", SInt16), ] class Rect(Structure): _fields_ = [ ("x", SInt16), ("y", SInt16), ("w", SInt16), ("h", SInt16), ] class FileInfo(Structure): _fields_ = [ ("fileType", OSType), ("fileCreator", OSType), ("finderFlags", UInt16), ("location", Point), ("reservedField", UInt16), ("reserved1", SInt16 * 4), ("extendedFinderFlags", UInt16), ("reserved2", SInt16), ("putAwayFolderID", SInt32), ] class FolderInfo(Structure): _fields_ = [ ("windowBounds", Rect), ("finderFlags", UInt16), ("location", Point), ("reservedField", UInt16), ("scrollPosition", Point), ("reserved1", SInt32), ("extendedFinderFlags", UInt16), ("reserved2", SInt16), ("putAwayFolderID", SInt32), ] class FinderInfo(Union): _fields_ = [ ("fileInfo", FileInfo), ("folderInfo", FolderInfo), ] extentrecord = diskextent * 8 vol_capabilities_set_t = c_uint * 4 class vol_capabilities_attr_t(Structure): _fields_ = [ ("capabilities", vol_capabilities_set_t), ("valid", vol_capabilities_set_t), ] class vol_attributes_attr_t(Structure): _fields_ = [ ("validattr", attribute_set_t), ("nativeattr", attribute_set_t), ] dev_t = c_uint fsobj_type_t = c_uint VNON = 0 VREG = 1 VDIR = 2 VBLK = 3 VCHR = 4 VLNK = 5 VSOCK = 6 VFIFO = 7 VBAD = 8 VSTR = 9 VCPLX = 10 fsobj_tag_t = c_uint VT_NON = 0 VT_UFS = 1 VT_NFS = 2 VT_MFS = 3 VT_MSDOSFS = 4 VT_LFS = 5 VT_LOFS = 6 VT_FDESC = 7 VT_PORTAL = 8 VT_NULL = 9 VT_UMAP = 10 VT_KERNFS = 11 VT_PROCFS = 12 VT_AFS = 13 VT_ISOFS = 14 VT_UNION = 15 VT_HFS = 16 VT_ZFS = 17 VT_DEVFS = 18 VT_WEBDAV = 19 VT_UDF = 20 VT_AFP = 21 VT_CDDA = 22 VT_CIFS = 23 VT_OTHER = 24 fsfile_type_t = c_uint fsvolid_t = c_uint text_encoding_t = c_uint uid_t = c_uint gid_t = c_uint int32_t = c_int uint32_t = c_uint int64_t = c_longlong uint64_t = c_ulonglong off_t = c_long size_t = c_ulong uuid_t = c_byte * 16 NAME_MAX = 255 PATH_MAX = 1024 FSTYPE_MAX = 16 class struct_statfs(Structure): _fields_ = [ ("f_bsize", uint32_t), ("f_iosize", int32_t), ("f_blocks", uint64_t), ("f_bfree", uint64_t), ("f_bavail", uint64_t), ("f_files", uint64_t), ("f_ffree", uint64_t), ("f_fsid", fsid_t), ("f_owner", uid_t), ("f_type", uint32_t), ("f_flags", uint32_t), ("f_fssubtype", uint32_t), ("f_fstypename", c_char * FSTYPE_MAX), ("f_mntonname", c_char * PATH_MAX), ("f_mntfromname", c_char * PATH_MAX), ("f_flags_ext", uint32_t), ("f_reserved", uint32_t * 7), ] # Calculate the maximum number of bytes required for the attribute buffer _attr_info = ( # Common attributes (0, ATTR_CMN_RETURNED_ATTRS, sizeof(attribute_set_t)), (0, ATTR_CMN_NAME, sizeof(attrreference_t) + NAME_MAX * 3 + 1), (0, ATTR_CMN_DEVID, sizeof(dev_t)), (0, ATTR_CMN_FSID, sizeof(fsid_t)), (0, ATTR_CMN_OBJTYPE, sizeof(fsobj_type_t)), (0, ATTR_CMN_OBJTAG, sizeof(fsobj_tag_t)), (0, ATTR_CMN_OBJID, sizeof(fsobj_id_t)), (0, ATTR_CMN_OBJPERMANENTID, sizeof(fsobj_id_t)), (0, ATTR_CMN_PAROBJID, sizeof(fsobj_id_t)), (0, ATTR_CMN_SCRIPT, sizeof(text_encoding_t)), (0, ATTR_CMN_CRTIME, sizeof(timespec)), (0, ATTR_CMN_MODTIME, sizeof(timespec)), (0, ATTR_CMN_CHGTIME, sizeof(timespec)), (0, ATTR_CMN_ACCTIME, sizeof(timespec)), (0, ATTR_CMN_BKUPTIME, sizeof(timespec)), (0, ATTR_CMN_FNDRINFO, sizeof(FinderInfo)), (0, ATTR_CMN_OWNERID, sizeof(uid_t)), (0, ATTR_CMN_GRPID, sizeof(gid_t)), (0, ATTR_CMN_ACCESSMASK, sizeof(uint32_t)), (0, ATTR_CMN_NAMEDATTRCOUNT, None), (0, ATTR_CMN_NAMEDATTRLIST, None), (0, ATTR_CMN_FLAGS, sizeof(uint32_t)), (0, ATTR_CMN_GEN_COUNT, sizeof(uint32_t)), (0, ATTR_CMN_DOCUMENT_ID, sizeof(uint32_t)), (0, ATTR_CMN_USERACCESS, sizeof(uint32_t)), (0, ATTR_CMN_EXTENDED_SECURITY, sizeof(attrreference_t) + sizeof(kauth_filesec)), (0, ATTR_CMN_UUID, sizeof(guid_t)), (0, ATTR_CMN_GRPUUID, sizeof(guid_t)), (0, ATTR_CMN_FILEID, sizeof(uint64_t)), (0, ATTR_CMN_PARENTID, sizeof(uint64_t)), (0, ATTR_CMN_FULLPATH, sizeof(attrreference_t) + PATH_MAX), (0, ATTR_CMN_ADDEDTIME, sizeof(timespec)), (0, ATTR_CMN_DATA_PROTECT_FLAGS, sizeof(uint32_t)), # Volume attributes (1, ATTR_VOL_FSTYPE, sizeof(uint32_t)), (1, ATTR_VOL_SIGNATURE, sizeof(uint32_t)), (1, ATTR_VOL_SIZE, sizeof(off_t)), (1, ATTR_VOL_SPACEFREE, sizeof(off_t)), (1, ATTR_VOL_SPACEAVAIL, sizeof(off_t)), (1, ATTR_VOL_MINALLOCATION, sizeof(off_t)), (1, ATTR_VOL_ALLOCATIONCLUMP, sizeof(off_t)), (1, ATTR_VOL_IOBLOCKSIZE, sizeof(uint32_t)), (1, ATTR_VOL_OBJCOUNT, sizeof(uint32_t)), (1, ATTR_VOL_FILECOUNT, sizeof(uint32_t)), (1, ATTR_VOL_DIRCOUNT, sizeof(uint32_t)), (1, ATTR_VOL_MAXOBJCOUNT, sizeof(uint32_t)), (1, ATTR_VOL_MOUNTPOINT, sizeof(attrreference_t) + PATH_MAX), (1, ATTR_VOL_NAME, sizeof(attrreference_t) + NAME_MAX + 1), (1, ATTR_VOL_MOUNTFLAGS, sizeof(uint32_t)), (1, ATTR_VOL_MOUNTEDDEVICE, sizeof(attrreference_t) + PATH_MAX), (1, ATTR_VOL_ENCODINGSUSED, sizeof(c_ulonglong)), (1, ATTR_VOL_CAPABILITIES, sizeof(vol_capabilities_attr_t)), (1, ATTR_VOL_UUID, sizeof(uuid_t)), (1, ATTR_VOL_QUOTA_SIZE, sizeof(off_t)), (1, ATTR_VOL_RESERVED_SIZE, sizeof(off_t)), (1, ATTR_VOL_ATTRIBUTES, sizeof(vol_attributes_attr_t)), # Directory attributes (2, ATTR_DIR_LINKCOUNT, sizeof(uint32_t)), (2, ATTR_DIR_ENTRYCOUNT, sizeof(uint32_t)), (2, ATTR_DIR_MOUNTSTATUS, sizeof(uint32_t)), (2, ATTR_DIR_ALLOCSIZE, sizeof(off_t)), (2, ATTR_DIR_IOBLOCKSIZE, sizeof(uint32_t)), (2, ATTR_DIR_DATALENGTH, sizeof(off_t)), # File attributes (3, ATTR_FILE_LINKCOUNT, sizeof(uint32_t)), (3, ATTR_FILE_TOTALSIZE, sizeof(off_t)), (3, ATTR_FILE_ALLOCSIZE, sizeof(off_t)), (3, ATTR_FILE_IOBLOCKSIZE, sizeof(uint32_t)), (3, ATTR_FILE_CLUMPSIZE, sizeof(uint32_t)), (3, ATTR_FILE_DEVTYPE, sizeof(uint32_t)), (3, ATTR_FILE_FILETYPE, sizeof(uint32_t)), (3, ATTR_FILE_FORKCOUNT, sizeof(uint32_t)), (3, ATTR_FILE_FORKLIST, None), (3, ATTR_FILE_DATALENGTH, sizeof(off_t)), (3, ATTR_FILE_DATAALLOCSIZE, sizeof(off_t)), (3, ATTR_FILE_DATAEXTENTS, sizeof(extentrecord)), (3, ATTR_FILE_RSRCLENGTH, sizeof(off_t)), (3, ATTR_FILE_RSRCALLOCSIZE, sizeof(off_t)), (3, ATTR_FILE_RSRCEXTENTS, sizeof(extentrecord)), # Fork attributes (4, ATTR_FORK_TOTALSIZE, sizeof(off_t)), (4, ATTR_FORK_ALLOCSIZE, sizeof(off_t)), # Extended common attributes (4, ATTR_CMNEXT_RELPATH, sizeof(attrreference_t) + PATH_MAX), (4, ATTR_CMNEXT_PRIVATESIZE, sizeof(off_t)), (4, ATTR_CMNEXT_LINKID, sizeof(uint64_t)), (4, ATTR_CMNEXT_NOFIRMLINKPATH, sizeof(attrreference_t) + PATH_MAX), (4, ATTR_CMNEXT_REALDEVID, sizeof(dev_t)), (4, ATTR_CMNEXT_REALFSID, sizeof(fsid_t)), (4, ATTR_CMNEXT_CLONEID, sizeof(uint64_t)), (4, ATTR_CMNEXT_EXT_FLAGS, sizeof(uint64_t)), ) def _attrbuf_size(attrs): size = 4 for entry in _attr_info: if attrs[entry[0]] & entry[1]: if entry[2] is None: raise ValueError( "Unsupported attribute (%u, %x)" % (entry[0], entry[1]) ) size += entry[2] return size _getattrlist = libc.getattrlist _getattrlist.argtypes = [c_char_p, POINTER(attrlist), c_void_p, c_ulong, c_ulong] _getattrlist.restype = c_int _fgetattrlist = libc.fgetattrlist _fgetattrlist.argtypes = [c_int, POINTER(attrlist), c_void_p, c_ulong, c_ulong] _fgetattrlist.restype = c_int try: _statfs = libc["statfs$INODE64"] except (KeyError, AttributeError): _statfs = libc["statfs"] _statfs.argtypes = [ c_char_p, POINTER(struct_statfs), ] _statfs.restype = c_int try: _fstatfs = libc["fstatfs$INODE64"] except (KeyError, AttributeError): _fstatfs = libc["fstatfs"] _fstatfs.argtypes = [ c_int, POINTER(struct_statfs), ] _fstatfs.restype = c_int def _datetime_from_timespec(ts): td = datetime.timedelta(seconds=ts.tv_sec + 1.0e-9 * ts.tv_nsec) return unix_epoch + td def _decode_utf8_nul(sz): nul = sz.find(b"\0") if nul > -1: sz = sz[:nul] return sz.decode("utf-8") def _decode_attrlist_result(buf, attrs, options): result = [] assert len(buf) >= 4 total_size = uint32_t.from_buffer(buf, 0).value assert total_size <= len(buf) offset = 4 # Common attributes if attrs[0] & ATTR_CMN_RETURNED_ATTRS: a = attribute_set_t.from_buffer(buf, offset) result.append(a) offset += sizeof(attribute_set_t) if not (options & FSOPT_PACK_INVAL_ATTRS): attrs = [a.commonattr, a.volattr, a.dirattr, a.fileattr, a.forkattr] if attrs[0] & ATTR_CMN_NAME: a = attrreference_t.from_buffer(buf, offset) ofs = offset + a.attr_dataoffset name = _decode_utf8_nul(buf[ofs : ofs + a.attr_length]) offset += sizeof(attrreference_t) result.append(name) if attrs[0] & ATTR_CMN_DEVID: a = dev_t.from_buffer(buf, offset) offset += sizeof(dev_t) result.append(a.value) if attrs[0] & ATTR_CMN_FSID: a = fsid_t.from_buffer(buf, offset) offset += sizeof(fsid_t) result.append(a) if attrs[0] & ATTR_CMN_OBJTYPE: a = fsobj_type_t.from_buffer(buf, offset) offset += sizeof(fsobj_type_t) result.append(a.value) if attrs[0] & ATTR_CMN_OBJTAG: a = fsobj_tag_t.from_buffer(buf, offset) offset += sizeof(fsobj_tag_t) result.append(a.value) if attrs[0] & ATTR_CMN_OBJID: a = fsobj_id_t.from_buffer(buf, offset) offset += sizeof(fsobj_id_t) result.append(a) if attrs[0] & ATTR_CMN_OBJPERMANENTID: a = fsobj_id_t.from_buffer(buf, offset) offset += sizeof(fsobj_id_t) result.append(a) if attrs[0] & ATTR_CMN_PAROBJID: a = fsobj_id_t.from_buffer(buf, offset) offset += sizeof(fsobj_id_t) result.append(a) if attrs[0] & ATTR_CMN_SCRIPT: a = text_encoding_t.from_buffer(buf, offset) offset += sizeof(text_encoding_t) result.append(a.value) if attrs[0] & ATTR_CMN_CRTIME: a = timespec.from_buffer(buf, offset) offset += sizeof(timespec) result.append(_datetime_from_timespec(a)) if attrs[0] & ATTR_CMN_MODTIME: a = timespec.from_buffer(buf, offset) offset += sizeof(timespec) result.append(_datetime_from_timespec(a)) if attrs[0] & ATTR_CMN_CHGTIME: a = timespec.from_buffer(buf, offset) offset += sizeof(timespec) result.append(_datetime_from_timespec(a)) if attrs[0] & ATTR_CMN_ACCTIME: a = timespec.from_buffer(buf, offset) offset += sizeof(timespec) result.append(_datetime_from_timespec(a)) if attrs[0] & ATTR_CMN_BKUPTIME: a = timespec.from_buffer(buf, offset) offset += sizeof(timespec) result.append(_datetime_from_timespec(a)) if attrs[0] & ATTR_CMN_FNDRINFO: a = FinderInfo.from_buffer(buf, offset) offset += sizeof(FinderInfo) result.append(a) if attrs[0] & ATTR_CMN_OWNERID: a = uid_t.from_buffer(buf, offset) offset += sizeof(uid_t) result.append(a.value) if attrs[0] & ATTR_CMN_GRPID: a = gid_t.from_buffer(buf, offset) offset += sizeof(gid_t) result.append(a.value) if attrs[0] & ATTR_CMN_ACCESSMASK: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[0] & ATTR_CMN_FLAGS: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[0] & ATTR_CMN_GEN_COUNT: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[0] & ATTR_CMN_DOCUMENT_ID: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[0] & ATTR_CMN_USERACCESS: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[0] & ATTR_CMN_EXTENDED_SECURITY: a = attrreference_t.from_buffer(buf, offset) ofs = offset + a.attr_dataoffset offset += sizeof(attrreference_t) ec = uint32_t.from_buffer(buf, ofs + 36).value class kauth_acl(Structure): _fields_ = [ ("acl_entrycount", c_uint), ("acl_flags", c_uint), ("acl_ace", kauth_ace * ec), ] class kauth_filesec(Structure): _fields_ = [ ("fsec_magic", c_uint), ("fsec_owner", guid_t), ("fsec_group", guid_t), ("fsec_acl", kauth_acl), ] a = kauth_filesec.from_buffer(buf, ofs) result.append(a) if attrs[0] & ATTR_CMN_UUID: result.append(uuid.UUID(bytes=buf[offset : offset + 16])) offset += sizeof(guid_t) if attrs[0] & ATTR_CMN_GRPUUID: result.append(uuid.UUID(bytes=buf[offset : offset + 16])) offset += sizeof(guid_t) if attrs[0] & ATTR_CMN_FILEID: a = uint64_t.from_buffer(buf, offset) offset += sizeof(uint64_t) result.append(a.value) if attrs[0] & ATTR_CMN_PARENTID: a = uint64_t.from_buffer(buf, offset) offset += sizeof(uint64_t) result.append(a.value) if attrs[0] & ATTR_CMN_FULLPATH: a = attrreference_t.from_buffer(buf, offset) ofs = offset + a.attr_dataoffset path = _decode_utf8_nul(buf[ofs : ofs + a.attr_length]) offset += sizeof(attrreference_t) result.append(path) if attrs[0] & ATTR_CMN_ADDEDTIME: a = timespec.from_buffer(buf, offset) offset += sizeof(timespec) result.append(_datetime_from_timespec(a)) if attrs[0] & ATTR_CMN_DATA_PROTECT_FLAGS: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) # Volume attributes if attrs[1] & ATTR_VOL_FSTYPE: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[1] & ATTR_VOL_SIGNATURE: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[1] & ATTR_VOL_SIZE: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[1] & ATTR_VOL_SPACEFREE: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[1] & ATTR_VOL_SPACEAVAIL: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[1] & ATTR_VOL_MINALLOCATION: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[1] & ATTR_VOL_ALLOCATIONCLUMP: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[1] & ATTR_VOL_IOBLOCKSIZE: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[1] & ATTR_VOL_OBJCOUNT: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[1] & ATTR_VOL_FILECOUNT: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[1] & ATTR_VOL_DIRCOUNT: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[1] & ATTR_VOL_MAXOBJCOUNT: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[1] & ATTR_VOL_MOUNTPOINT: a = attrreference_t.from_buffer(buf, offset) ofs = offset + a.attr_dataoffset path = _decode_utf8_nul(buf[ofs : ofs + a.attr_length]) offset += sizeof(attrreference_t) result.append(path) if attrs[1] & ATTR_VOL_NAME: a = attrreference_t.from_buffer(buf, offset) ofs = offset + a.attr_dataoffset name = _decode_utf8_nul(buf[ofs : ofs + a.attr_length]) offset += sizeof(attrreference_t) result.append(name) if attrs[1] & ATTR_VOL_MOUNTFLAGS: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[1] & ATTR_VOL_MOUNTEDDEVICE: a = attrreference_t.from_buffer(buf, offset) ofs = offset + a.attr_dataoffset path = _decode_utf8_nul(buf[ofs : ofs + a.attr_length]) offset += sizeof(attrreference_t) result.append(path) if attrs[1] & ATTR_VOL_ENCODINGSUSED: a = c_ulonglong.from_buffer(buf, offset) offset += sizeof(c_ulonglong) result.append(a.value) if attrs[1] & ATTR_VOL_CAPABILITIES: a = vol_capabilities_attr_t.from_buffer(buf, offset) offset += sizeof(vol_capabilities_attr_t) result.append(a) if attrs[1] & ATTR_VOL_UUID: result.append(uuid.UUID(bytes=buf[offset : offset + 16])) offset += sizeof(uuid_t) if attrs[1] & ATTR_VOL_QUOTA_SIZE: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[1] & ATTR_VOL_RESERVED_SIZE: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[1] & ATTR_VOL_ATTRIBUTES: a = vol_attributes_attr_t.from_buffer(buf, offset) offset += sizeof(vol_attributes_attr_t) result.append(a) # Directory attributes if attrs[2] & ATTR_DIR_LINKCOUNT: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[2] & ATTR_DIR_ENTRYCOUNT: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[2] & ATTR_DIR_MOUNTSTATUS: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[2] & ATTR_DIR_ALLOCSIZE: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[2] & ATTR_DIR_IOBLOCKSIZE: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[2] & ATTR_DIR_DATALENGTH: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) # File attributes if attrs[3] & ATTR_FILE_LINKCOUNT: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[3] & ATTR_FILE_TOTALSIZE: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[3] & ATTR_FILE_ALLOCSIZE: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[3] & ATTR_FILE_IOBLOCKSIZE: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[3] & ATTR_FILE_CLUMPSIZE: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[3] & ATTR_FILE_DEVTYPE: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[3] & ATTR_FILE_FILETYPE: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[3] & ATTR_FILE_FORKCOUNT: a = uint32_t.from_buffer(buf, offset) offset += sizeof(uint32_t) result.append(a.value) if attrs[3] & ATTR_FILE_DATALENGTH: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[3] & ATTR_FILE_DATAALLOCSIZE: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[3] & ATTR_FILE_DATAEXTENTS: a = extentrecord.from_buffer(buf, offset) offset += sizeof(extentrecord) result.append(a.value) if attrs[3] & ATTR_FILE_RSRCLENGTH: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[3] & ATTR_FILE_RSRCALLOCSIZE: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[3] & ATTR_FILE_RSRCEXTENTS: a = extentrecord.from_buffer(buf, offset) offset += sizeof(extentrecord) result.append(a.value) # Fork attributes if attrs[4] & ATTR_FORK_TOTALSIZE: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[4] & ATTR_FORK_ALLOCSIZE: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) # Extended common attributes if attrs[4] & ATTR_CMNEXT_RELPATH: a = attrreference_t.from_buffer(buf, offset) ofs = offset + a.attr_dataoffset path = _decode_utf8_nul(buf[ofs : ofs + a.attr_length]) offset += sizeof(attrreference_t) result.append(path) if attrs[4] & ATTR_CMNEXT_PRIVATESIZE: a = off_t.from_buffer(buf, offset) offset += sizeof(off_t) result.append(a.value) if attrs[4] & ATTR_CMNEXT_LINKID: a = uint64_t.from_buffer(buf, offset) offset += sizeof(uint64_t) result.append(a.value) if attrs[4] & ATTR_CMNEXT_NOFIRMLINKPATH: a = attrreference_t.from_buffer(buf, offset) ofs = offset + a.attr_dataoffset path = _decode_utf8_nul(buf[ofs : ofs + a.attr_length]) offset += sizeof(attrreference_t) result.append(path) if attrs[4] & ATTR_CMNEXT_REALDEVID: a = dev_t.from_buffer(buf, offset) offset += sizeof(dev_t) result.append(a.value) if attrs[4] & ATTR_CMNEXT_REALFSID: a = fsid_t.from_buffer(buf, offset) offset += sizeof(fsid_t) result.append(a.value) if attrs[4] & ATTR_CMNEXT_CLONEID: a = uint64_t.from_buffer(buf, offset) offset += sizeof(uint64_t) result.append(a.value) if attrs[4] & ATTR_CMNEXT_EXT_FLAGS: a = uint64_t.from_buffer(buf, offset) offset += sizeof(uint64_t) result.append(a.value) return result # Sadly, ctypes.get_errno() seems not to work __error = libc.__error __error.restype = POINTER(c_int) def _get_errno(): return __error().contents.value def getattrlist(path, attrs, options): if not isinstance(path, bytes): path = path.encode("utf-8") attrs = list(attrs) if attrs[1]: attrs[1] |= ATTR_VOL_INFO alist = attrlist( bitmapcount=5, commonattr=attrs[0], volattr=attrs[1], dirattr=attrs[2], fileattr=attrs[3], forkattr=attrs[4], ) bufsize = _attrbuf_size(attrs) buf = create_string_buffer(bufsize) ret = _getattrlist( path, byref(alist), buf, bufsize, options | FSOPT_REPORT_FULLSIZE ) if ret < 0: err = _get_errno() raise OSError(err, os.strerror(err), path) return _decode_attrlist_result(buf, attrs, options) def fgetattrlist(fd, attrs, options): if hasattr(fd, "fileno"): fd = fd.fileno() attrs = list(attrs) if attrs[1]: attrs[1] |= ATTR_VOL_INFO alist = attrlist( bitmapcount=5, commonattr=attrs[0], volattr=attrs[1], dirattr=attrs[2], fileattr=attrs[3], forkattr=attrs[4], ) bufsize = _attrbuf_size(attrs) buf = create_string_buffer(bufsize) ret = _fgetattrlist(fd, byref(alist), buf, bufsize, options | FSOPT_REPORT_FULLSIZE) if ret < 0: err = _get_errno() raise OSError(err, os.strerror(err)) return _decode_attrlist_result(buf, attrs, options) def statfs(path): if not isinstance(path, bytes): path = path.encode("utf-8") result = struct_statfs() ret = _statfs(path, byref(result)) if ret < 0: err = _get_errno() raise OSError(err, os.strerror(err), path) return result def fstatfs(fd): if hasattr(fd, "fileno"): fd = fd.fileno() result = struct_statfs() ret = _fstatfs(fd, byref(result)) if ret < 0: err = _get_errno() raise OSError(err, os.strerror(err)) return result qbs-src-3.2.0/src/3rdparty/python/.gitignore0000644000175100017510000000003515154533055020350 0ustar runnerrunner*.pyc *.dist-info *.egg-info qbs-src-3.2.0/src/plugins/0000755000175100017510000000000015154533055014752 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/qbsplugin.qbs0000644000175100017510000000326615154533055017474 0ustar runnerrunnerimport qbs.FileInfo QbsProduct { property bool isForDarwin: qbs.targetOS.contains("darwin") property bool staticBuild: Qt.core.staticBuild || qbsbuildconfig.staticBuild Depends { name: "cpp" } Depends { name: "bundle"; condition: isForDarwin } Depends { name: "Qt.core" } Depends { name: "qbsbuildconfig" } Depends { name: "qbscore"; condition: !staticBuild } type: (staticBuild ? ["staticlibrary"] : [isForDarwin ? "loadablemodule" : "dynamiclibrary"]) .concat(["qbsplugin"]) Properties { condition: staticBuild cpp.defines: ["QBS_STATIC_LIB"] } cpp.includePaths: base.concat(["../../../lib/corelib"]) cpp.visibility: "minimal" Group { fileTagsFilter: [isForDarwin ? "loadablemodule" : "dynamiclibrary"] .concat(qbs.buildVariant === "debug" ? [isForDarwin ? "debuginfo_loadablemodule" : "debuginfo_dll"] : []) qbs.install: true qbs.installDir: targetInstallDir qbs.installSourceBase: buildDirectory } targetInstallDir: qbsbuildconfig.pluginsInstallDir Properties { condition: isForDarwin bundle.isBundle: false } Export { Depends { name: "cpp" } Properties { condition: qbs.targetOS.contains("darwin") cpp.linkerFlags: ["-u", "_qbs_static_plugin_register_" + name] } Properties { condition: qbs.toolchain.contains("gcc") cpp.linkerFlags: "--require-defined=qbs_static_plugin_register_" + name } Properties { condition: qbs.toolchain.contains("msvc") cpp.linkerFlags: "/INCLUDE:qbs_static_plugin_register_" + name } } } qbs-src-3.2.0/src/plugins/CMakeLists.txt0000644000175100017510000000006615154533055017514 0ustar runnerrunneradd_subdirectory(generator) add_subdirectory(scanner) qbs-src-3.2.0/src/plugins/scanner/0000755000175100017510000000000015154533055016403 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/scanner/cpp/0000755000175100017510000000000015154533055017165 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/scanner/cpp/cpp_global.h0000644000175100017510000000411015154533055021434 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 CPP_GLOBAL_H #define CPP_GLOBAL_H #if defined(WIN32) || defined(_WIN32) #define CPPSCANNER_EXPORT __declspec(dllexport) #else #define CPPSCANNER_EXPORT __attribute__((visibility("default"))) #endif #endif // CPP_GLOBAL_H qbs-src-3.2.0/src/plugins/scanner/cpp/CMakeLists.txt0000644000175100017510000000030015154533055021716 0ustar runnerrunnerset(SOURCES ../scanner.h cpp_global.h cppscannerplugin.cpp ) add_qbs_plugin(qbs_cpp_scanner DEFINES "CPLUSPLUS_NO_PARSER" DEPENDS qbscore SOURCES ${SOURCES} ) qbs-src-3.2.0/src/plugins/scanner/cpp/cpp.qbs0000644000175100017510000000032715154533055020460 0ustar runnerrunnerimport "../../qbsplugin.qbs" as QbsPlugin QbsPlugin { Depends { name: "qbscore" } name: "qbs_cpp_scanner" files: [ "../scanner.h", "cpp_global.h", "cppscannerplugin.cpp" ] } qbs-src-3.2.0/src/plugins/scanner/cpp/cppscannerplugin.cpp0000644000175100017510000001000615154533055023241 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "../scanner.h" #include "cpp_global.h" #include #include #include struct Opaq : public qbs::Internal::CppScannerContext { int currentIncludeIndex{0}; int currentModuleIndex{0}; }; static void *openScanner(const unsigned short *filePath, const char *fileTags, int flags) { std::unique_ptr opaq(new Opaq); const bool ok = qbs::Internal::scanCppFile( *opaq, QStringView(filePath), std::string_view(fileTags), flags & ScanForFileTagsFlag, flags & ScanForDependenciesFlag); if (!ok) return nullptr; return opaq.release(); } static void closeScanner(void *ptr) { const auto opaque = static_cast(ptr); delete opaque; } static const char *next(void *opaq, int *size, int *flags) { const auto opaque = static_cast(opaq); if (opaque->currentIncludeIndex < opaque->includedFiles.size()) { const auto &result = opaque->includedFiles.at(opaque->currentIncludeIndex); ++opaque->currentIncludeIndex; *size = static_cast(result.fileName.size()); *flags = result.flags; return result.fileName.data(); } if (opaque->currentModuleIndex < opaque->requiresModules.size()) { const auto &result = opaque->requiresModules.at(opaque->currentModuleIndex); ++opaque->currentModuleIndex; *size = result.size(); *flags = SC_MODULE_FLAG; return result.data(); } *size = 0; *flags = 0; return nullptr; } ScannerPlugin includeScanner = { "include_scanner", "cpp,cppm,cpp_pch_src,c,c_pch_src,objcpp,objcpp_pch_src,objc,objc_pch_src,rc", openScanner, closeScanner, next, ScannerUsesCppIncludePaths | ScannerRecursiveDependencies}; ScannerPlugin *cppScanners[] = {&includeScanner, nullptr}; static void QbsCppScannerPluginLoad() { qbs::Internal::ScannerPluginManager::instance()->registerPlugins(cppScanners); } static void QbsCppScannerPluginUnload() {} QBS_REGISTER_STATIC_PLUGIN( extern "C" CPPSCANNER_EXPORT, qbs_cpp_scanner, QbsCppScannerPluginLoad, QbsCppScannerPluginUnload) qbs-src-3.2.0/src/plugins/scanner/scanner.h0000644000175100017510000000572215154533055020213 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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 SCANNER_H #define SCANNER_H #ifdef __cplusplus extern "C" { #endif #define SC_LOCAL_INCLUDE_FLAG 0x1 #define SC_GLOBAL_INCLUDE_FLAG 0x2 #define SC_MODULE_FLAG 0x4 enum OpenScannerFlags { ScanForDependenciesFlag = 0x01, ScanForFileTagsFlag = 0x02 }; /** * Open a file that's going to be scanned. * The file path encoding is UTF-16 on all platforms. * The file tags are in CSV format. * * Returns a scanner handle. */ typedef void *(*scanOpen_f) (const unsigned short *filePath, const char *fileTags, int flags); /** * Closes the given scanner handle. */ typedef void (*scanClose_f) (void *opaq); /** * Return the next result (filename) of the scan. */ typedef const char *(*scanNext_f) (void *opaq, int *size, int *flags); enum ScannerFlags { NoScannerFlags = 0x00, ScannerUsesCppIncludePaths = 0x01, ScannerRecursiveDependencies = 0x02 }; class ScannerPlugin { public: const char *name; const char *fileTags; // CSV scanOpen_f open; scanClose_f close; scanNext_f next; int flags; }; #ifdef __cplusplus } #endif #endif // SCANNER_H qbs-src-3.2.0/src/plugins/scanner/CMakeLists.txt0000644000175100017510000000005315154533055021141 0ustar runnerrunneradd_subdirectory(cpp) add_subdirectory(qt) qbs-src-3.2.0/src/plugins/scanner/qt/0000755000175100017510000000000015154533055017027 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/scanner/qt/CMakeLists.txt0000644000175100017510000000013715154533055021570 0ustar runnerrunneradd_qbs_plugin(qbs_qt_scanner DEPENDS qbscore SOURCES ../scanner.h qtscanner.cpp ) qbs-src-3.2.0/src/plugins/scanner/qt/qtscanner.cpp0000644000175100017510000001257315154533055021541 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #if defined(WIN32) || defined(_WIN32) #define SCANNER_EXPORT __declspec(dllexport) #else #define SCANNER_EXPORT __attribute__((visibility("default"))) #endif #include "../scanner.h" #include #include #include #ifdef Q_OS_UNIX #include #include #include #include #include #else #include #endif #include #include #include struct OpaqQrc { #ifdef Q_OS_UNIX int fd = 0; int mapl = 0; #else std::unique_ptr file; #endif char *map = nullptr; std::unique_ptr xml; QByteArray current; OpaqQrc() = default; ~OpaqQrc() { #ifdef Q_OS_UNIX if (map) munmap (map, mapl); if (fd) close (fd); #endif } }; static void *openScannerQrc(const unsigned short *filePath, const char *fileTags, int flags) { Q_UNUSED(flags); Q_UNUSED(fileTags); std::unique_ptr opaque(new OpaqQrc); #ifdef Q_OS_UNIX QString filePathS = QString::fromUtf16(reinterpret_cast(filePath)); opaque->fd = open(qPrintable(filePathS), O_RDONLY); if (opaque->fd == -1) { opaque->fd = 0; return nullptr; } struct stat s{}; int r = fstat(opaque->fd, &s); if (r != 0) return nullptr; const int fileSize = static_cast(s.st_size); opaque->mapl = fileSize; void *map = mmap(nullptr, s.st_size, PROT_READ, MAP_PRIVATE, opaque->fd, 0); if (map == nullptr) return nullptr; #else opaque->file = std::make_unique( QString::fromUtf16(reinterpret_cast(filePath))); if (!opaque->file->open(QFile::ReadOnly)) return nullptr; const int fileSize = opaque->file->size(); uchar *map = opaque->file->map(0, fileSize); if (!map) return nullptr; #endif opaque->map = reinterpret_cast(map); opaque->xml = std::make_unique( QByteArray::fromRawData(opaque->map, fileSize)); return static_cast(opaque.release()); } static void closeScannerQrc(void *ptr) { const auto opaque = static_cast(ptr); delete opaque; } static const char *nextQrc(void *opaq, int *size, int *flags) { const auto o = static_cast(opaq); while (!o->xml->atEnd()) { o->xml->readNext(); switch (o->xml->tokenType()) { case QXmlStreamReader::StartElement: if (o->xml->name() == QLatin1String("file")) { o->current = o->xml->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement).toUtf8(); *flags = SC_LOCAL_INCLUDE_FLAG; *size = o->current.size(); return o->current.data(); } break; case QXmlStreamReader::EndDocument: return nullptr; default: break; } } return nullptr; } ScannerPlugin qrcScanner = { "qt_qrc_scanner", "qrc", openScannerQrc, closeScannerQrc, nextQrc, NoScannerFlags}; ScannerPlugin *qtScanners[] = {&qrcScanner, nullptr}; static void QbsQtScannerPluginLoad() { qbs::Internal::ScannerPluginManager::instance()->registerPlugins(qtScanners); } static void QbsQtScannerPluginUnload() { } QBS_REGISTER_STATIC_PLUGIN(extern "C" SCANNER_EXPORT, qbs_qt_scanner, QbsQtScannerPluginLoad, QbsQtScannerPluginUnload) qbs-src-3.2.0/src/plugins/scanner/qt/qt.qbs0000644000175100017510000000023015154533055020155 0ustar runnerrunnerimport "../../qbsplugin.qbs" as QbsPlugin QbsPlugin { name: "qbs_qt_scanner" files: [ "../scanner.h", "qtscanner.cpp" ] } qbs-src-3.2.0/src/plugins/plugins.qbs0000644000175100017510000000063515154533055017146 0ustar runnerrunnerProject { name: "qbs plugins" references: [ "generator/graphviz/graphviz.qbs", "generator/clangcompilationdb/clangcompilationdb.qbs", "generator/makefilegenerator/makefilegenerator.qbs", "generator/visualstudio/visualstudio.qbs", "generator/iarew/iarew.qbs", "generator/keiluv/keiluv.qbs", "scanner/cpp/cpp.qbs", "scanner/qt/qt.qbs" ] } qbs-src-3.2.0/src/plugins/generator/0000755000175100017510000000000015154533055016740 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/visualstudio/0000755000175100017510000000000015154533055021473 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildfiltersproject.h0000644000175100017510000000361115154533055026264 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDFILTERSPROJECT_H #define MSBUILDFILTERSPROJECT_H #include "msbuild/msbuildproject.h" #include #include namespace qbs { class MSBuildFilter; class MSBuildFiltersProject : public MSBuildProject { public: explicit MSBuildFiltersProject(const GeneratableProductData &product); }; } // namespace qbs #endif // MSBUILDFILTERSPROJECT_H qbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildqbsproductproject.cpp0000644000175100017510000004757315154533055027354 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildqbsproductproject.h" #include "msbuild/msbuildimport.h" #include "msbuild/msbuildimportgroup.h" #include "msbuild/msbuilditemdefinitiongroup.h" #include "msbuild/msbuilditemgroup.h" #include "msbuild/msbuilditemmetadata.h" #include "msbuild/msbuildproperty.h" #include "msbuild/msbuildpropertygroup.h" #include "msbuild/items/msbuildclcompile.h" #include "msbuild/items/msbuildclinclude.h" #include "msbuild/items/msbuildlink.h" #include "msbuild/items/msbuildnone.h" #include "msbuildutils.h" #include "visualstudiogenerator.h" #include #include #include #include #include #include #include namespace qbs { using namespace Internal; MSBuildQbsProductProject::MSBuildQbsProductProject( const GeneratableProject &project, const GeneratableProductData &product, const Internal::VisualStudioVersionInfo &versionInfo) : MSBuildTargetProject(project, versionInfo) { Q_ASSERT(project.projects.size() == project.commandLines.size()); Q_ASSERT(project.projects.size() == product.data.size()); const int count = std::max(project.projects.size(), product.data.size()); globalsPropertyGroup()->appendProperty(QStringLiteral("QbsProductName"), product.name()); const auto cppDefaultProps = makeChild(); cppDefaultProps->setProject(QStringLiteral("$(VCTargetsPath)\\Microsoft.Cpp.Default.props")); for (int i = 0; i < count; ++i) { addConfiguration( project, project.projects.values().at(i), product.data.values().at(i), project.commandLines.values().at(i)); } const auto cppProps = makeChild(); cppProps->setProject(QStringLiteral("$(VCTargetsPath)\\Microsoft.Cpp.props")); for (int i = 0; i < count; ++i) addItemDefGroup(project.projects.values().at(i), product.data.values().at(i)); addFiles(project, product); } static QString productTargetPath(const qbs::ProductData &productData) { const QString fullPath = productData.targetExecutable(); if (!fullPath.isEmpty()) return QFileInfo(fullPath).absolutePath(); return productData.properties().value(QStringLiteral("buildDirectory")).toString(); } static bool listEnvironmentVariableContainsValue(const QString &environmentVariable, const QString &value) { return environmentVariable.contains(QLatin1Char(';') + value + QLatin1Char(';')) || environmentVariable.startsWith(value + QLatin1Char(';')) || environmentVariable.endsWith(QLatin1Char(';') + value); } void MSBuildQbsProductProject::addConfiguration(const GeneratableProject &project, const Project &buildTask, const ProductData &productData, const QStringList &buildConfigurationCommandLine) { const auto targetDir = Internal::PathUtils::toNativeSeparators( productTargetPath(productData), Internal::HostOsInfo::HostOsWindows); auto configurationDir = Internal::PathUtils::toNativeSeparators( project.baseBuildDirectory().absolutePath() + QLatin1Char('\\') + MSBuildUtils::configurationName(buildTask), Internal::HostOsInfo::HostOsWindows); auto relativeTargetDir = targetDir; if (targetDir.startsWith(configurationDir)) relativeTargetDir = QStringLiteral("$(SolutionDir)$(Configuration)") + relativeTargetDir.mid(configurationDir.size()); const auto &properties = productData.moduleProperties(); const bool debugBuild = properties.getModuleProperty(StringConstants::qbsModule(), QStringLiteral("debugInformation")) .toBool(); const auto includePaths = QStringList() << properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), QStringLiteral("includePaths")) << properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), QStringLiteral("systemIncludePaths")); const auto cppDefines = properties .getModulePropertiesAsStringList(QStringLiteral("cpp"), QStringLiteral("defines")); const auto sep = Internal::HostOsInfo::pathListSeparator(Internal::HostOsInfo::HostOsWindows); const auto propertyGroup1 = makeChild(); propertyGroup1->setCondition(MSBuildUtils::buildTaskCondition(buildTask)); propertyGroup1->setLabel(QStringLiteral("Configuration")); propertyGroup1->appendProperty(QStringLiteral("UseDebugLibraries"), debugBuild ? QStringLiteral("true") : QStringLiteral("false")); // General - General // We need a trailing backslash for $(OutDir); See also the VS documentation: // https://docs.microsoft.com/en-us/cpp/ide/common-macros-for-build-commands-and-properties propertyGroup1->appendProperty( QStringLiteral("OutDir"), QString(relativeTargetDir + QLatin1Char('\\'))); propertyGroup1->appendProperty(QStringLiteral("TargetName"), productData.targetName()); propertyGroup1->appendProperty( QStringLiteral("PlatformToolset"), versionInfo().platformToolsetVersion()); propertyGroup1->appendProperty(QStringLiteral("ConfigurationType"), QStringLiteral("Makefile")); // VS possible values: Unicode|MultiByte|NotSet propertyGroup1->appendProperty(QStringLiteral("CharacterSet"), properties.getModuleProperty(QStringLiteral("cpp"), QStringLiteral("windowsApiCharacterSet")) == QStringLiteral("unicode") ? QStringLiteral("MultiByte") : QStringLiteral("NotSet")); // Debugging propertyGroup1->appendProperty(QStringLiteral("DebuggerFlavor"), QStringLiteral("WindowsLocalDebugger")); propertyGroup1->appendProperty(QStringLiteral("LocalDebuggerCommand"), QStringLiteral("$(OutDir)$(TargetName)$(TargetExt)")); propertyGroup1->appendProperty(QStringLiteral("LocalDebuggerWorkingDirectory"), QStringLiteral("$(OutDir)")); auto env = buildTask.getRunEnvironment(productData, project.installOptions, QProcessEnvironment(), QStringList(), nullptr) .runEnvironment(); if (!env.isEmpty()) { const auto systemEnv = QProcessEnvironment::systemEnvironment(); const auto keys = systemEnv.keys(); for (const auto &key : keys) { if (!env.contains(key)) continue; // Don't duplicate keys from the system environment if (env.value(key) == systemEnv.value(key)) { env.remove(key); continue; } // Cleverly concatenate list variables to avoid duplicating system environment const QString systemValue = systemEnv.value(key); QString overriddenValue = env.value(key); if (listEnvironmentVariableContainsValue(overriddenValue, systemValue)) { env.insert(key, overriddenValue.replace(systemValue, QLatin1Char('%') + key + QLatin1Char('%'))); } QString installRoot = project.installOptions.installRoot(); if (!installRoot.isEmpty()) { if (listEnvironmentVariableContainsValue(overriddenValue, installRoot)) { env.insert(key, overriddenValue.replace(installRoot, QStringLiteral("$(QbsInstallRoot)"))); } } else { installRoot = Internal::PathUtils::toNativeSeparators( QDir(buildTask.projectData().buildDirectory()).absoluteFilePath( project.installOptions.defaultInstallRoot()), Internal::HostOsInfo::HostOsWindows); if (listEnvironmentVariableContainsValue(overriddenValue, installRoot)) { env.insert(key, overriddenValue.replace(installRoot, QStringLiteral("$(SolutionDir)$(Configuration)\\install-root"))); } } } propertyGroup1->appendProperty(QStringLiteral("LocalDebuggerEnvironment"), env.toStringList().join(QLatin1String("\n"))); } // NMake - General // Skip configuration name, that's handled in qbs-shared.props const auto params = Internal::shellQuote( buildConfigurationCommandLine.mid(1), Internal::HostOsInfo::HostOsWindows); propertyGroup1->appendProperty( QStringLiteral("NMakeBuildCommandLine"), QString(QStringLiteral("$(QbsBuildCommandLine) ") + params)); propertyGroup1->appendProperty( QStringLiteral("NMakeReBuildCommandLine"), QString(QStringLiteral("$(QbsReBuildCommandLine) ") + params)); propertyGroup1->appendProperty( QStringLiteral("NMakeCleanCommandLine"), QString(QStringLiteral("$(QbsCleanCommandLine) ") + params)); propertyGroup1->appendProperty( QStringLiteral("NMakeOutput"), QStringLiteral("$(OutDir)$(TargetName)$(TargetExt)")); // NMake - IntelliSense propertyGroup1->appendProperty(QStringLiteral("NMakePreprocessorDefinitions"), cppDefines.join(sep)); propertyGroup1->appendProperty(QStringLiteral("NMakeIncludeSearchPath"), includePaths.join(sep)); } static QString subsystemVersion(const QString &version) { const auto v = Version::fromString(version); return QStringLiteral("%1.%2").arg( QString::number(v.majorVersion()), QString::number(v.minorVersion()).rightJustified(2, QLatin1Char('0'))); } void MSBuildQbsProductProject::addItemDefGroup(const Project &project, const ProductData &productData) { const auto &properties = productData.moduleProperties(); const bool consoleApp = productData.properties().value(QStringLiteral("consoleApplication")) .toBool(); const bool debugBuild = properties.getModuleProperty(StringConstants::qbsModule(), QStringLiteral("debugInformation")) .toBool(); const auto optimizationLevel = properties.getModuleProperty(StringConstants::qbsModule(), QStringLiteral("optimization")) .toString(); const auto warningLevel = properties.getModuleProperty(StringConstants::qbsModule(), QStringLiteral("warningLevel")) .toString(); const auto includePaths = QStringList() << properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), QStringLiteral("includePaths")) << properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), QStringLiteral("systemIncludePaths")); const auto cppDefines = properties.getModulePropertiesAsStringList( QStringLiteral("cpp"), QStringLiteral("defines")); const auto sep = Internal::HostOsInfo::pathListSeparator(Internal::HostOsInfo::HostOsWindows); const auto itemDefGroup = makeChild(); itemDefGroup->setCondition(MSBuildUtils::buildTaskCondition(project)); const auto compile = itemDefGroup->makeChild(); // C++ - General compile->appendProperty( QStringLiteral("AdditionalIncludeDirectories"), QString(includePaths.join(sep) + sep + QStringLiteral("%(AdditionalIncludeDirectories)"))); if (warningLevel == QStringLiteral("none")) compile->appendProperty(QStringLiteral("WarningLevel"), QStringLiteral("TurnOffAllWarnings")); else if (warningLevel == QStringLiteral("all")) compile->appendProperty(QStringLiteral("WarningLevel"), QStringLiteral("EnableAllWarnings")); else compile->appendProperty(QStringLiteral("WarningLevel"), QStringLiteral("Level3")); // this is VS default. // C++ - Optimization compile->appendProperty(QStringLiteral("Optimization"), optimizationLevel == QStringLiteral("none") ? QStringLiteral("Disabled") : QStringLiteral("MaxSpeed")); // C++ - Preprocessor compile->appendProperty( QStringLiteral("PreprocessorDefinitions"), QString(cppDefines.join(sep) + sep + QStringLiteral("%(PreprocessorDefinitions)"))); // C++ - Code Generation compile->appendProperty(QStringLiteral("RuntimeLibrary"), debugBuild ? QStringLiteral("MultiThreadedDebugDLL") : QStringLiteral("MultiThreadedDLL")); const auto link = itemDefGroup->makeChild(); // Linker - General link->appendProperty(QStringLiteral("AdditionalLibraryDirectories"), properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), QStringLiteral("libraryPaths")).join(sep)); // Linker - Input link->appendProperty( QStringLiteral("AdditionalDependencies"), QString( properties .getModulePropertiesAsStringList( QStringLiteral("cpp"), QStringLiteral("staticLibraries")) .join(sep) + sep + QStringLiteral("%(AdditionalDependencies)"))); // Linker - Debugging link->appendProperty(QStringLiteral("GenerateDebugInformation"), debugBuild ? QStringLiteral("true") : QStringLiteral("false")); // Linker - System link->appendProperty(QStringLiteral("SubSystem"), consoleApp ? QStringLiteral("Console") : QStringLiteral("Windows")); const auto subsysVersion = properties.getModuleProperty( QStringLiteral("cpp"), QStringLiteral("minimumWindowsVersion")).toString(); if (!subsysVersion.isEmpty()) link->appendProperty(QStringLiteral("MinimumRequiredVersion"), subsystemVersion(subsysVersion)); // Linker - Optimization link->appendProperty(QStringLiteral("OptimizeReferences"), debugBuild ? QStringLiteral("false") : QStringLiteral("true")); } static MSBuildFileItem *fileItemForFileTags( const QList &fileTags, MSBuildItemGroup *parent) { if (fileTags.contains(QStringLiteral("hpp"))) return parent->makeChild(); if (fileTags.contains(QStringLiteral("c")) || fileTags.contains(QStringLiteral("cpp"))) return parent->makeChild(); return parent->makeChild(); } void MSBuildQbsProductProject::addFiles(const GeneratableProject &project, const GeneratableProductData &product) { const auto itemGroup = makeChild(); addQbsFile(project, product, itemGroup); std::map sourceFileNodes; std::map sourceFileEnabledConfigurations; // Create a ClCompile item for each source file, keeping track of which configurations that // file's containing group is enabled in for (auto productDataIt = product.data.cbegin(), end = product.data.cend(); productDataIt != end; ++productDataIt) { const auto groups = productDataIt.value().groups(); for (const auto &group : groups) { const auto sourceArtifacts = group.allSourceArtifacts(); for (const auto &sourceArtifact : sourceArtifacts) { const auto filePath = sourceArtifact.filePath(); if (sourceFileNodes.find(filePath) == sourceFileNodes.end()) { sourceFileNodes.insert({ filePath, fileItemForFileTags(sourceArtifact.fileTags(), itemGroup) }); } auto fileItem = sourceFileNodes[filePath]; QString path = project.baseBuildDirectory().relativeFilePath(filePath); // The path still might not be relative (for example if the file item is // located on a different drive) if (QFileInfo(path).isRelative()) path = QStringLiteral("$(ProjectDir)") + path; fileItem->setFilePath(path); if (group.isEnabled()) sourceFileEnabledConfigurations[filePath] << productDataIt.key(); } } } // Add ExcludedFromBuild item metadata to each file for each configuration // where that file's containing group is disabled for (const auto &sourceFileNode : sourceFileNodes) { for (auto it = project.projects.cbegin(), end = project.projects.cend(); it != end; ++it) { if (!sourceFileEnabledConfigurations[sourceFileNode.first].contains(it.key())) { const auto metadata = sourceFileNode.second->makeChild( QStringLiteral("ExcludedFromBuild"), QStringLiteral("true")); metadata->setCondition( QStringLiteral("'$(Configuration)|$(Platform)'=='") + MSBuildUtils::fullName(it.value()) + QStringLiteral("'")); } } } const auto import = makeChild(); import->setProject(QStringLiteral("$(VCTargetsPath)\\Microsoft.Cpp.targets")); } void MSBuildQbsProductProject::addQbsFile(const GeneratableProject &project, const GeneratableProductData &product, MSBuildItemGroup *itemGroup) { const auto fileItem = itemGroup->makeChild(); QString path = project.baseBuildDirectory().relativeFilePath(product.location().filePath()); // The path still might not be relative (for example if the file item is // located on a different drive) if (QFileInfo(path).isRelative()) path = QStringLiteral("$(ProjectDir)") + path; fileItem->setFilePath(path); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildtargetproject.cpp0000644000175100017510000001141015154533055026431 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildtargetproject.h" #include "msbuildutils.h" #include "visualstudiogenerator.h" #include "msbuild/msbuildimport.h" #include "msbuild/msbuildimportgroup.h" #include "msbuild/msbuilditem.h" #include "msbuild/msbuilditemgroup.h" #include "msbuild/msbuildproperty.h" #include "msbuild/msbuildpropertygroup.h" namespace qbs { class MSBuildTargetProjectPrivate { public: MSBuildTargetProjectPrivate(const Internal::VisualStudioVersionInfo &versionInfo) : versionInfo(versionInfo) {} MSBuildPropertyGroup *globalsPropertyGroup = nullptr; MSBuildProperty *projectGuidProperty = nullptr; const Internal::VisualStudioVersionInfo &versionInfo; }; MSBuildTargetProject::MSBuildTargetProject( const GeneratableProject &project, const Internal::VisualStudioVersionInfo &versionInfo) : d(new MSBuildTargetProjectPrivate(versionInfo)) { setDefaultTargets(QStringLiteral("Build")); setToolsVersion(versionInfo.toolsVersion()); const auto projectConfigurationsGroup = makeChild(); projectConfigurationsGroup->setLabel(QStringLiteral("ProjectConfigurations")); for (auto it = project.projects.cbegin(), end = project.projects.cend(); it != end; ++it) { const auto item = projectConfigurationsGroup->makeChild( QStringLiteral("ProjectConfiguration")); item->setInclude(MSBuildUtils::fullName(it.value())); item->appendProperty(QStringLiteral("Configuration"), it.key()); item->appendProperty(QStringLiteral("Platform"), MSBuildUtils::platform(it.value())); } d->globalsPropertyGroup = makeChild(); d->globalsPropertyGroup->setLabel(QStringLiteral("Globals")); d->projectGuidProperty = d->globalsPropertyGroup->makeChild( QStringLiteral("ProjectGuid"), QUuid::createUuid().toString()); // Trigger creation of the property sheets ImportGroup propertySheetsImportGroup(); } MSBuildTargetProject::~MSBuildTargetProject() = default; const Internal::VisualStudioVersionInfo &MSBuildTargetProject::versionInfo() const { return d->versionInfo; } QUuid MSBuildTargetProject::guid() const { return QUuid{d->projectGuidProperty->value().toString()}; } void MSBuildTargetProject::setGuid(const QUuid &guid) { d->projectGuidProperty->setValue(guid.toString()); } MSBuildPropertyGroup *MSBuildTargetProject::globalsPropertyGroup() { return d->globalsPropertyGroup; } MSBuildImportGroup *MSBuildTargetProject::propertySheetsImportGroup() { MSBuildImportGroup *importGroup = nullptr; for (const auto &child : children()) { if (auto group = dynamic_cast(child.get())) { if (group->label() == QStringLiteral("PropertySheets")) { importGroup = group; break; } } } if (!importGroup) { importGroup = makeChild(); importGroup->setLabel(QStringLiteral("PropertySheets")); } return importGroup; } void MSBuildTargetProject::appendPropertySheet(const QString &path, bool optional) { const auto import = propertySheetsImportGroup()->makeChild(); import->setProject(path); if (optional) import->setCondition(QStringLiteral("Exists('%1')").arg(path)); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/visualstudio/visualstudio.qbs0000644000175100017510000000174515154533055024744 0ustar runnerrunnerimport "../../qbsplugin.qbs" as QbsPlugin QbsPlugin { Depends { name: "qbsmsbuild" } name: "visualstudiogenerator" files: ["visualstudiogeneratorplugin.cpp"] Group { name: "Visual Studio generator" files: [ "msbuildfiltersproject.cpp", "msbuildfiltersproject.h", "msbuildqbsgenerateproject.cpp", "msbuildqbsgenerateproject.h", "msbuildqbsproductproject.cpp", "msbuildqbsproductproject.h", "msbuildsharedsolutionpropertiesproject.cpp", "msbuildsharedsolutionpropertiesproject.h", "msbuildsolutionpropertiesproject.cpp", "msbuildsolutionpropertiesproject.h", "msbuildtargetproject.cpp", "msbuildtargetproject.h", "msbuildutils.h", "visualstudiogenerator.cpp", "visualstudiogenerator.h", "visualstudioguidpool.cpp", "visualstudioguidpool.h", ] } } qbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildsharedsolutionpropertiesproject.cpp0000644000175100017510000001602215154533055032327 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildsharedsolutionpropertiesproject.h" #include "msbuild/msbuildpropertygroup.h" #include #include #include namespace qbs { static QString qbsCommandLine(const GeneratableProject &project, const QString &subCommand, const QString &qbsSettingsDir, const Internal::VisualStudioVersionInfo &versionInfo) { auto addEnvironmentVariableArgument = [](Internal::CommandLine &cl, const QString &var, const QString &prefix = QString()) { cl.appendRawArgument(QStringLiteral("\"%1$(%2)\"").arg(prefix, var)); }; auto realSubCommand = subCommand; if (subCommand == QStringLiteral("rebuild")) realSubCommand = QStringLiteral("build"); // "path/to/qbs.exe" {build|clean} // --settings-dir "path/to/settings/directory/" // -f "path/to/project.qbs" -d "/build/directory/" // -p product_name [[configuration key:value]...] Internal::CommandLine commandLine; commandLine.setProgram(QStringLiteral("\"$(QbsExecutablePath)\""), true); commandLine.appendArgument(realSubCommand); if (!qbsSettingsDir.isEmpty()) { commandLine.appendArgument(QStringLiteral("--settings-dir")); addEnvironmentVariableArgument(commandLine, QStringLiteral("QbsSettingsDir")); } commandLine.appendArgument(QStringLiteral("-f")); addEnvironmentVariableArgument(commandLine, QStringLiteral("QbsProjectFile")); commandLine.appendArgument(QStringLiteral("-d")); addEnvironmentVariableArgument(commandLine, QStringLiteral("QbsBuildDir")); if (subCommand == QStringLiteral("generate")) { commandLine.appendArgument(QStringLiteral("-g")); commandLine.appendArgument(QStringLiteral("visualstudio%1") .arg(versionInfo.marketingVersion())); } else { commandLine.appendArgument(QStringLiteral("-p")); addEnvironmentVariableArgument(commandLine, QStringLiteral("QbsProductName")); commandLine.appendArgument(QStringLiteral("--wait-lock")); } if (realSubCommand == QStringLiteral("build") && !project.installOptions.installRoot().isEmpty()) { commandLine.appendArgument(QStringLiteral("--install-root")); addEnvironmentVariableArgument(commandLine, QStringLiteral("QbsInstallRoot")); } if (realSubCommand == QStringLiteral("build") && subCommand == QStringLiteral("rebuild")) { commandLine.appendArgument(QStringLiteral("--check-timestamps")); commandLine.appendArgument(QStringLiteral("--force-probe-execution")); } addEnvironmentVariableArgument(commandLine, QStringLiteral("Configuration"), QStringLiteral("config:")); return commandLine.toCommandLine(Internal::HostOsInfo::HostOsWindows); } MSBuildSharedSolutionPropertiesProject::MSBuildSharedSolutionPropertiesProject( const Internal::VisualStudioVersionInfo &versionInfo, const GeneratableProject &project, const QFileInfo &qbsExecutable, const QString &qbsSettingsDir) { setDefaultTargets(QStringLiteral("Build")); setToolsVersion(versionInfo.toolsVersion()); const auto group = makeChild(); group->setLabel(QStringLiteral("UserMacros")); // Order's important here... a variable must be listed before one that uses it group->appendProperty( QStringLiteral("QbsExecutablePath"), QString(QStringLiteral("$(QbsExecutableDir)") + qbsExecutable.fileName())); if (!project.installOptions.installRoot().isEmpty()) { group->appendProperty( QStringLiteral("QbsInstallRoot"), Internal::PathUtils::toNativeSeparators( project.installOptions.installRoot(), Internal::HostOsInfo::HostOsWindows)); } group->appendProperty( QStringLiteral("QbsProjectFile"), QString(QStringLiteral("$(QbsProjectDir)") + project.filePath().fileName())); // Trailing '.' is not a typo. It prevents the trailing slash from combining with the closing // quote to form an escape sequence. Unfortunately, Visual Studio expands variables *before* // passing them to the underlying command shell, so there's not much we can do with regard to // doing it "properly". Setting environment variables through MSBuild and using them in place // of actual arguments does not work either, as Visual Studio apparently expands the environment // variables as well, before passing them to the underlying shell. group->appendProperty(QStringLiteral("QbsBuildDir"), QStringLiteral("$(SolutionDir).")); group->appendProperty(QStringLiteral("QbsBuildCommandLine"), qbsCommandLine(project, QStringLiteral("build"), qbsSettingsDir, versionInfo)); group->appendProperty(QStringLiteral("QbsReBuildCommandLine"), qbsCommandLine(project, QStringLiteral("rebuild"), qbsSettingsDir, versionInfo)); group->appendProperty(QStringLiteral("QbsCleanCommandLine"), qbsCommandLine(project, QStringLiteral("clean"), qbsSettingsDir, versionInfo)); group->appendProperty(QStringLiteral("QbsGenerateCommandLine"), qbsCommandLine(project, QStringLiteral("generate"), qbsSettingsDir, versionInfo)); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildqbsgenerateproject.h0000644000175100017510000000367515154533055027126 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDQBSGENERATEPROJECT_H #define MSBUILDQBSGENERATEPROJECT_H #include "msbuildtargetproject.h" #include #include namespace qbs { class MSBuildQbsGenerateProject : public MSBuildTargetProject { public: MSBuildQbsGenerateProject( const GeneratableProject &project, const Internal::VisualStudioVersionInfo &versionInfo); }; } // namespace qbs #endif // MSBUILDQBSGENERATEPROJECT_H qbs-src-3.2.0/src/plugins/generator/visualstudio/visualstudiogenerator.cpp0000644000175100017510000003651215154533055026650 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildfiltersproject.h" #include "msbuildqbsgenerateproject.h" #include "msbuildsharedsolutionpropertiesproject.h" #include "msbuildsolutionpropertiesproject.h" #include "msbuildqbsproductproject.h" #include "msbuildutils.h" #include "visualstudiogenerator.h" #include "visualstudioguidpool.h" #include "msbuild/msbuildpropertygroup.h" #include "msbuild/msbuildproject.h" #include "solution/visualstudiosolution.h" #include "solution/visualstudiosolutionfileproject.h" #include "solution/visualstudiosolutionglobalsection.h" #include "solution/visualstudiosolutionfolderproject.h" #include "io/msbuildprojectwriter.h" #include "io/visualstudiosolutionwriter.h" #include #include #include #include #include #include #include #include #include #include #include namespace qbs { using namespace Internal; class VisualStudioGeneratorPrivate { friend class SolutionDependenciesVisitor; public: VisualStudioGeneratorPrivate(const Internal::VisualStudioVersionInfo &versionInfo) : versionInfo(versionInfo) {} Internal::VisualStudioVersionInfo versionInfo; std::shared_ptr guidPool; std::shared_ptr solution; QString solutionFilePath; QMap> msbuildProjects; QMap solutionProjects; QMap solutionFolders; QList> propertySheetNames; void reset(); }; void VisualStudioGeneratorPrivate::reset() { guidPool.reset(); solution.reset(); solutionFilePath.clear(); msbuildProjects.clear(); solutionProjects.clear(); solutionFolders.clear(); propertySheetNames.clear(); } class SolutionDependenciesVisitor : public IGeneratableProjectVisitor { public: SolutionDependenciesVisitor(VisualStudioGenerator *generator) : generator(generator) { } void visitProject(const GeneratableProject &project) override { Q_UNUSED(project); nestedProjects = new VisualStudioSolutionGlobalSection( QStringLiteral("NestedProjects"), generator->d->solution.get()); generator->d->solution->appendGlobalSection(nestedProjects); } void visitProjectData(const GeneratableProject &project, const GeneratableProjectData &parentProjectData, const GeneratableProjectData &projectData) override { Q_UNUSED(project); // The root project will have a null GeneratableProjectData // as its parent object (so skip giving it a parent folder) if (!parentProjectData.name().isEmpty()) { nestedProjects->appendProperty( generator->d->solutionFolders.value(projectData.uniqueName())->guid() .toString(), generator->d->solutionFolders.value(parentProjectData.uniqueName())->guid() .toString()); } } void visitProduct(const GeneratableProject &project, const GeneratableProjectData &projectData, const GeneratableProductData &productData) override { Q_UNUSED(project); Q_UNUSED(projectData); const auto dependencies = productData.dependencies(); for (const auto &dep : dependencies) { generator->d->solution->addDependency( generator->d->solutionProjects.value(productData.name()), generator->d->solutionProjects.value(dep)); } nestedProjects->appendProperty( generator->d->solutionProjects.value(productData.name())->guid().toString(), generator->d->solutionFolders.value(projectData.uniqueName())->guid() .toString()); } private: VisualStudioGenerator *generator = nullptr; VisualStudioSolutionGlobalSection *nestedProjects = nullptr; }; VisualStudioGenerator::VisualStudioGenerator(const VisualStudioVersionInfo &versionInfo) : d(new VisualStudioGeneratorPrivate(versionInfo)) { if (d->versionInfo.usesVcBuild()) throw ErrorInfo(Tr::tr("VCBuild (Visual Studio 2008 and below) is not supported")); if (!d->versionInfo.usesMsBuild()) throw ErrorInfo(Tr::tr("Unknown/unsupported build engine")); Q_ASSERT(d->versionInfo.usesSolutions()); } VisualStudioGenerator::~VisualStudioGenerator() = default; QString VisualStudioGenerator::generatorName() const { return QStringLiteral("visualstudio%1").arg(d->versionInfo.marketingVersion()); } void VisualStudioGenerator::addPropertySheets(const GeneratableProject &project) { { const auto fileName = QStringLiteral("qbs.props"); d->propertySheetNames.push_back({ fileName, true }); d->msbuildProjects.insert(project.baseBuildDirectory().absoluteFilePath(fileName), std::make_shared( d->versionInfo, project, qbsExecutableFilePath(), qbsSettingsDir())); } { const auto fileName = QStringLiteral("qbs-shared.props"); d->propertySheetNames.push_back({ fileName, false }); d->msbuildProjects.insert(project.baseBuildDirectory().absoluteFilePath(fileName), std::make_shared( d->versionInfo, project, qbsExecutableFilePath(), qbsSettingsDir())); } } void VisualStudioGenerator::addPropertySheets( const std::shared_ptr &targetProject) { for (const auto &pair : std::as_const(d->propertySheetNames)) { targetProject->appendPropertySheet( QStringLiteral("$(SolutionDir)\\") + pair.first, pair.second); } } static QString targetFilePath(const QString &baseName, const QString &baseBuildDirectory) { return QDir(baseBuildDirectory).absoluteFilePath(baseName + QStringLiteral(".vcxproj")); } static QString targetFilePath(const GeneratableProductData &product, const QString &baseBuildDirectory) { return targetFilePath(product.name(), baseBuildDirectory); } static void addDefaultGlobalSections(const GeneratableProject &topLevelProject, VisualStudioSolution *solution) { const auto configurationPlatformsSection = new VisualStudioSolutionGlobalSection( QStringLiteral("SolutionConfigurationPlatforms"), solution); solution->appendGlobalSection(configurationPlatformsSection); for (const auto &qbsProject : topLevelProject.projects) configurationPlatformsSection->appendProperty(MSBuildUtils::fullName(qbsProject), MSBuildUtils::fullName(qbsProject)); const auto projectConfigurationPlatformsSection = new VisualStudioSolutionGlobalSection( QStringLiteral("ProjectConfigurationPlatforms"), solution); solution->appendGlobalSection(projectConfigurationPlatformsSection); projectConfigurationPlatformsSection->setPost(true); const auto projects = solution->fileProjects(); for (const auto project : projects) { for (const auto &qbsProject : topLevelProject.projects) { projectConfigurationPlatformsSection->appendProperty( QStringLiteral("%1.%2.ActiveCfg").arg(project->guid().toString(), MSBuildUtils::fullDisplayName(qbsProject)), MSBuildUtils::fullName(qbsProject)); projectConfigurationPlatformsSection->appendProperty( QStringLiteral("%1.%2.Build.0").arg(project->guid().toString(), MSBuildUtils::fullDisplayName(qbsProject)), MSBuildUtils::fullName(qbsProject)); } } const auto solutionPropsSection = new VisualStudioSolutionGlobalSection( QStringLiteral("SolutionProperties"), solution); solution->appendGlobalSection(solutionPropsSection); solutionPropsSection->appendProperty(QStringLiteral("HideSolutionNode"), QStringLiteral("FALSE")); } static void writeProjectFiles(const QMap> &projects) { // Write out all the MSBuild project files to disk for (auto it = projects.cbegin(), end = projects.cend(); it != end; ++it) { const auto projectFilePath = it.key(); Internal::FileSaver file(projectFilePath.toStdString()); if (!file.open()) throw ErrorInfo(Tr::tr("Cannot open %s for writing").arg(projectFilePath)); std::shared_ptr project = it.value(); MSBuildProjectWriter writer(file.device()); if (!(writer.write(project.get()) && file.commit())) throw ErrorInfo(Tr::tr("Failed to generate %1").arg(projectFilePath)); } } static void writeSolution(const std::shared_ptr &solution, const QString &solutionFilePath, const Internal::Logger &logger) { Internal::FileSaver file(solutionFilePath.toStdString()); if (!file.open()) throw ErrorInfo(Tr::tr("Cannot open %s for writing").arg(solutionFilePath)); VisualStudioSolutionWriter writer(file.device()); writer.setProjectBaseDirectory(QFileInfo(solutionFilePath).path().toStdString()); if (!(writer.write(solution.get()) && file.commit())) throw ErrorInfo(Tr::tr("Failed to generate %1").arg(solutionFilePath)); logger.qbsInfo() << Tr::tr("Generated %1").arg(QFileInfo(solutionFilePath).fileName()); } void VisualStudioGenerator::generate() { GeneratableProjectIterator it(project()); it.accept(this); addDefaultGlobalSections(project(), d->solution.get()); // Second pass: connection solution project interdependencies and project nesting hierarchy SolutionDependenciesVisitor solutionDependenciesVisitor(this); it.accept(&solutionDependenciesVisitor); writeProjectFiles(d->msbuildProjects); writeSolution(d->solution, d->solutionFilePath, logger()); d->reset(); } void VisualStudioGenerator::visitProject(const GeneratableProject &project) { addPropertySheets(project); const auto buildDir = project.baseBuildDirectory(); d->guidPool = std::make_shared( buildDir.absoluteFilePath(project.name() + QStringLiteral(".guid.txt")).toStdString()); d->solutionFilePath = buildDir.absoluteFilePath(project.name() + QStringLiteral(".sln")); d->solution = std::make_shared(d->versionInfo); // Create a helper project to re-run qbs generate const auto qbsGenerate = QStringLiteral("qbs-generate"); const auto projectFilePath = targetFilePath(qbsGenerate, buildDir.absolutePath()); const auto relativeProjectFilePath = QFileInfo(d->solutionFilePath).dir() .relativeFilePath(projectFilePath); auto targetProject = std::make_shared(project, d->versionInfo); targetProject->setGuid(d->guidPool->drawProductGuid(relativeProjectFilePath.toStdString())); d->msbuildProjects.insert(projectFilePath, targetProject); addPropertySheets(targetProject); const auto solutionProject = new VisualStudioSolutionFileProject( targetFilePath(qbsGenerate, project.baseBuildDirectory().absolutePath()), d->solution.get()); solutionProject->setGuid(targetProject->guid()); d->solution->appendProject(solutionProject); d->solutionProjects.insert(qbsGenerate, solutionProject); } void VisualStudioGenerator::visitProjectData(const GeneratableProject &project, const GeneratableProjectData &projectData) { Q_UNUSED(project); const auto solutionFolder = new VisualStudioSolutionFolderProject(d->solution.get()); solutionFolder->setName(projectData.name()); d->solution->appendProject(solutionFolder); QBS_CHECK(!d->solutionFolders.contains(projectData.uniqueName())); d->solutionFolders.insert(projectData.uniqueName(), solutionFolder); } void VisualStudioGenerator::visitProduct(const GeneratableProject &project, const GeneratableProjectData &projectData, const GeneratableProductData &productData) { Q_UNUSED(projectData); const auto projectFilePath = targetFilePath(productData, project.baseBuildDirectory().absolutePath()); const auto relativeProjectFilePath = QFileInfo(d->solutionFilePath) .dir().relativeFilePath(projectFilePath); auto targetProject = std::make_shared(project, productData, d->versionInfo); targetProject->setGuid(d->guidPool->drawProductGuid(relativeProjectFilePath.toStdString())); addPropertySheets(targetProject); d->msbuildProjects.insert(projectFilePath, targetProject); d->msbuildProjects.insert(projectFilePath + QStringLiteral(".filters"), std::make_shared(productData)); const auto solutionProject = new VisualStudioSolutionFileProject( targetFilePath(productData, project.baseBuildDirectory().absolutePath()), d->solution.get()); solutionProject->setGuid(targetProject->guid()); d->solution->appendProject(solutionProject); d->solutionProjects.insert(productData.name(), solutionProject); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildsolutionpropertiesproject.cpp0000644000175100017510000000564515154533055031151 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildsolutionpropertiesproject.h" #include "msbuild/msbuildpropertygroup.h" #include #include namespace qbs { MSBuildSolutionPropertiesProject::MSBuildSolutionPropertiesProject( const Internal::VisualStudioVersionInfo &versionInfo, const GeneratableProject &project, const QFileInfo &qbsExecutable, const QString &qbsSettingsDir) { setDefaultTargets(QStringLiteral("Build")); setToolsVersion(versionInfo.toolsVersion()); const auto group = makeChild(); group->setLabel(QStringLiteral("UserMacros")); static const auto win = Internal::HostOsInfo::HostOsWindows; group->appendProperty( QStringLiteral("QbsExecutableDir"), QString( Internal::PathUtils::toNativeSeparators(qbsExecutable.path(), win) + Internal::HostOsInfo::pathSeparator(win))); group->appendProperty( QStringLiteral("QbsProjectDir"), QString( Internal::PathUtils::toNativeSeparators(project.filePath().path(), win) + Internal::HostOsInfo::pathSeparator(win))); if (!qbsSettingsDir.isEmpty()) { group->appendProperty( QStringLiteral("QbsSettingsDir"), QString( Internal::PathUtils::toNativeSeparators(qbsSettingsDir, win) + Internal::HostOsInfo::pathSeparator(win) + QLatin1Char('.'))); } } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildtargetproject.h0000644000175100017510000000467215154533055026112 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDTARGETPROJECT_H #define MSBUILDTARGETPROJECT_H #include "msbuild/msbuildproject.h" #include #include namespace qbs { class MSBuildImportGroup; class MSBuildPropertyGroup; class MSBuildTargetProjectPrivate; class VisualStudioGenerator; class MSBuildTargetProject : public MSBuildProject { protected: MSBuildTargetProject( const GeneratableProject &project, const Internal::VisualStudioVersionInfo &versionInfo); public: ~MSBuildTargetProject() override; const Internal::VisualStudioVersionInfo &versionInfo() const; QUuid guid() const; void setGuid(const QUuid &guid); MSBuildPropertyGroup *globalsPropertyGroup(); MSBuildImportGroup *propertySheetsImportGroup(); void appendPropertySheet(const QString &path, bool optional = false); private: std::unique_ptr d; }; } // namespace qbs #endif // MSBUILDTARGETPROJECT_H qbs-src-3.2.0/src/plugins/generator/visualstudio/visualstudiogeneratorplugin.cpp0000644000175100017510000000530115154533055030057 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "visualstudiogenerator.h" #include #include static void QbsVisualStudioGeneratorPluginLoad() { for (const auto &info : qbs::Internal::VisualStudioVersionInfo::knownVersions()) { if (info.usesMsBuild()) qbs::ProjectGeneratorManager::registerGenerator( std::make_shared(info)); } } static void QbsVisualStudioGeneratorPluginUnload() { } #ifndef GENERATOR_EXPORT #if defined(WIN32) || defined(_WIN32) #define GENERATOR_EXPORT __declspec(dllexport) #else #define GENERATOR_EXPORT __attribute__((visibility("default"))) #endif #endif QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, visualstudiogenerator, QbsVisualStudioGeneratorPluginLoad, QbsVisualStudioGeneratorPluginUnload) qbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildfiltersproject.cpp0000644000175100017510000001777715154533055026641 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildfiltersproject.h" #include "msbuild/msbuilditemgroup.h" #include "msbuild/items/msbuildclcompile.h" #include "msbuild/items/msbuildclinclude.h" #include "msbuild/items/msbuildfilter.h" #include "msbuild/items/msbuildnone.h" #include #include #include namespace qbs { namespace { const QStringList & sourceFileExtensions() { static const QStringList EXTENSIONS{ QStringLiteral("c"), QStringLiteral("C"), QStringLiteral("cpp"), QStringLiteral("cxx"), QStringLiteral("c++"), QStringLiteral("cc"), QStringLiteral("cs"), QStringLiteral("def"), QStringLiteral("java"), QStringLiteral("m"), QStringLiteral("mm")}; return EXTENSIONS; } const QStringList & headerFileExtensions() { static const QStringList EXTENSIONS{ QStringLiteral("h"), QStringLiteral("H"), QStringLiteral("hpp"), QStringLiteral("hxx"), QStringLiteral("h++")}; return EXTENSIONS; } struct FilterInfo { QString name; QList extensions; bool parseFiles{ true }; bool sourceControlFiles{ true }; }; const std::vector & getDefaultFilterInfo() { static const std::vector INFOS { {QStringLiteral("Source Files"), sourceFileExtensions()}, {QStringLiteral("Header Files"), headerFileExtensions()}, {QStringLiteral("Form Files"), QStringList() << QStringLiteral("ui")}, {QStringLiteral("Resource Files"), QStringList() << QStringLiteral("qrc") << QStringLiteral("rc") << QStringLiteral("*"), false}, {QStringLiteral("Generated Files"), QStringList() << QStringLiteral("moc"), true, false}, {QStringLiteral("Translation Files"), QStringList() << QStringLiteral("ts"), false}, }; return INFOS; } MSBuildFilter * makeBuildFilter(const FilterInfo &filterInfo, MSBuildItemGroup *itemFiltersGroup) { const auto filter = itemFiltersGroup->makeChild( filterInfo.name, filterInfo.extensions); filter->appendProperty(QStringLiteral("ParseFiles"), filterInfo.parseFiles); filter->appendProperty(QStringLiteral("SourceControlFiles"), filterInfo.sourceControlFiles); return filter; } bool matchesFilter(const FilterInfo &filterInfo, const QString &filePath) { return filterInfo.extensions.contains(QFileInfo(filePath).completeSuffix()); } bool isHeaderFile(const QString &filePath) { return headerFileExtensions().contains(QFileInfo(filePath).completeSuffix()); } bool isSourceFile(const QString &filePath) { return sourceFileExtensions().contains(QFileInfo(filePath).completeSuffix()); } MSBuildFileItem * makeFileItem(const QString& filePath, MSBuildItemGroup *itemGroup) { if (isHeaderFile(filePath)) return itemGroup->makeChild(); if (isSourceFile(filePath)) return itemGroup->makeChild(); return itemGroup->makeChild(); } class ProductProcessor { public: using StringSet = Internal::Set; ProductProcessor(MSBuildProject *parent) : m_parent(parent) , m_itemFiltersGroup(m_parent->makeChild()) { } void operator()(const QList &productDatas) { for (const auto &productData : productDatas) { const auto &productName = productData.name(); for (const auto &groupData : productData.groups()) { if (groupData.name() == productName) { processProductFiles(Internal::rangeTo(groupData.allFilePaths())); } else { processGroup(groupData); } } } } void processProductFiles(const StringSet &files) { for (const auto &filePath : files) { MSBuildFileItem *fileItem = nullptr; for (const auto &filterInfo : getDefaultFilterInfo()) { if (matchesFilter(filterInfo, filePath)) { makeFilter(filterInfo); if (filterInfo.name == QStringLiteral("Header Files")) { if (!m_headerFilesGroup) m_headerFilesGroup = m_parent->makeChild(); fileItem = m_headerFilesGroup->makeChild(); } else if (filterInfo.name == QStringLiteral("Source Files")) { if (!m_sourceFilesGroup) m_sourceFilesGroup = m_parent->makeChild(); fileItem = m_sourceFilesGroup->makeChild(); } if (fileItem) { fileItem->setFilterName(filterInfo.name); break; } } } if (!fileItem) { if (!m_filesGroup) { m_filesGroup = m_parent->makeChild(); } fileItem = m_filesGroup->makeChild(); } fileItem->setFilePath(filePath); } } void processGroup(const GroupData &groupData) { makeFilter({groupData.name(), QStringList() << QStringLiteral("*")}); auto *itemGroup = m_parent->makeChild(); const auto &files = groupData.allFilePaths(); for (const auto &filePath : files) { auto *fileItem = makeFileItem(filePath, itemGroup); fileItem->setFilePath(filePath); fileItem->setFilterName(groupData.name()); } } void makeFilter(const FilterInfo &filterInfo) { if (!m_createdFilters.contains(filterInfo.name)) { makeBuildFilter(filterInfo, m_itemFiltersGroup); m_createdFilters.insert(filterInfo.name); } } private: MSBuildProject *m_parent = nullptr; MSBuildItemGroup *m_itemFiltersGroup = nullptr; MSBuildItemGroup *m_headerFilesGroup = nullptr; MSBuildItemGroup *m_sourceFilesGroup = nullptr; MSBuildItemGroup *m_filesGroup = nullptr; QSet m_createdFilters; }; } // namespace MSBuildFiltersProject::MSBuildFiltersProject(const GeneratableProductData &product) { // Normally this would be versionInfo.toolsVersion() but for some reason it seems // filters projects are always v4.0 setToolsVersion(QStringLiteral("4.0")); ProductProcessor(this)(product.data.values()); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/visualstudio/CMakeLists.txt0000644000175100017510000000127515154533055024240 0ustar runnerrunnerset(SOURCES msbuildfiltersproject.cpp msbuildfiltersproject.h msbuildqbsgenerateproject.cpp msbuildqbsgenerateproject.h msbuildqbsproductproject.cpp msbuildqbsproductproject.h msbuildsharedsolutionpropertiesproject.cpp msbuildsharedsolutionpropertiesproject.h msbuildsolutionpropertiesproject.cpp msbuildsolutionpropertiesproject.h msbuildtargetproject.cpp msbuildtargetproject.h msbuildutils.h visualstudiogenerator.cpp visualstudiogenerator.h visualstudioguidpool.cpp visualstudioguidpool.h visualstudiogeneratorplugin.cpp ) add_qbs_plugin(visualstudiogenerator DEPENDS qbscore qbsmsbuild SOURCES ${SOURCES} ) qbs-src-3.2.0/src/plugins/generator/visualstudio/visualstudioguidpool.h0000644000175100017510000000441515154533055026146 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef VISUALSTUDIOGUIDPOOL_H #define VISUALSTUDIOGUIDPOOL_H #include #include namespace qbs { class VisualStudioGuidPoolPrivate; /*! * Provides persistent storage for GUIDs related to Visual Studio project file nodes. * These are stored on disk separately from project files and so allow projects to be * regenerated while retaining the same GUIDs. This helps avoid unnecessary project * reloads in Visual Studio, and helps ease source control usage. */ class VisualStudioGuidPool { public: explicit VisualStudioGuidPool(const std::string &storeFilePath); ~VisualStudioGuidPool(); QUuid drawProductGuid(const std::string &productName); private: std::shared_ptr d; }; } // namespace qbs #endif // VISUALSTUDIOGUIDPOOL_H qbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildsharedsolutionpropertiesproject.h0000644000175100017510000000420615154533055031775 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDSHAREDSOLUTIONPROPERTIESPROJECT_H #define MSBUILDSHAREDSOLUTIONPROPERTIESPROJECT_H #include "msbuild/msbuildproject.h" #include #include namespace qbs { class MSBuildSharedSolutionPropertiesProject : public MSBuildProject { public: MSBuildSharedSolutionPropertiesProject(const Internal::VisualStudioVersionInfo &versionInfo, const GeneratableProject &project, const QFileInfo &qbsExecutable, const QString &qbsSettingsDir); }; } // namespace qbs #endif // MSBUILDSHAREDSOLUTIONPROPERTIESPROJECT_H qbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildutils.h0000644000175100017510000001016615154533055024370 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDUTILS_H #define MSBUILDUTILS_H #include namespace qbs { class MSBuildUtils { public: static QString _qbsArchitecture(const qbs::Project &project) { return project.projectConfiguration() .value(QStringLiteral("qbs")).toMap() .value(QStringLiteral("architecture")).toString(); } static const QString visualStudioArchitectureName(const QString &qbsArch, bool useDisplayName) { if (qbsArch == QStringLiteral("x86") && useDisplayName) return qbsArch; // map of qbs architecture names to MSBuild architecture names static const QMap map { {QStringLiteral("x86"), QStringLiteral("Win32")}, {QStringLiteral("x86_64"), QStringLiteral("x64")}, {QStringLiteral("ia64"), QStringLiteral("Itanium")}, {QStringLiteral("arm"), QStringLiteral("ARM")}, {QStringLiteral("arm64"), QStringLiteral("ARM64")} }; return map[qbsArch]; } static QString configurationName(const qbs::Project &project) { return project.projectConfiguration() .value(QStringLiteral("qbs")).toMap() .value(QStringLiteral("configurationName")).toString(); } static QString displayPlatform(const qbs::Project &project) { const auto architecture = _qbsArchitecture(project); auto displayPlatform = visualStudioArchitectureName(architecture, true); if (displayPlatform.isEmpty()) displayPlatform = architecture; return displayPlatform; } static QString platform(const qbs::Project &project) { const auto architecture = _qbsArchitecture(project); auto platform = visualStudioArchitectureName(architecture, false); if (platform.isEmpty()) { qWarning() << "WARNING: Unsupported architecture \"" << architecture << "\"; using \"Win32\" platform."; platform = QStringLiteral("Win32"); } return platform; } static QString fullDisplayName(const qbs::Project &project) { return QStringLiteral("%1|%2").arg(configurationName(project), displayPlatform(project)); } static QString fullName(const qbs::Project &project) { return QStringLiteral("%1|%2").arg(configurationName(project), platform(project)); } static QString buildTaskCondition(const Project &buildTask) { return QStringLiteral("'$(Configuration)|$(Platform)'=='") + MSBuildUtils::fullName(buildTask) + QStringLiteral("'"); } }; } // namespace qbs #endif // MSBUILDUTILS_H qbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildqbsproductproject.h0000644000175100017510000000535515154533055027011 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDQBSPRODUCTPROJECT_H #define MSBUILDQBSPRODUCTPROJECT_H #include "msbuildtargetproject.h" #include #include #include namespace qbs { class MSBuildImportGroup; class MSBuildItemGroup; class MSBuildProperty; class VisualStudioGenerator; class MSBuildQbsProductProject : public MSBuildTargetProject { public: MSBuildQbsProductProject( const GeneratableProject &project, const GeneratableProductData &product, const Internal::VisualStudioVersionInfo &versionInfo); private: using ProjectConfigurations = QHash>; void addConfiguration(const GeneratableProject &project, const Project &buildTask, const ProductData &productData, const QStringList &buildConfigurationCommandLine); void addItemDefGroup(const Project &project, const ProductData &productData); void addFiles(const GeneratableProject &project, const GeneratableProductData &product); void addQbsFile(const GeneratableProject &project, const GeneratableProductData &product, MSBuildItemGroup *itemGroup); }; } // namespace qbs #endif // MSBUILDQBSPRODUCTPROJECT_H qbs-src-3.2.0/src/plugins/generator/visualstudio/visualstudioguidpool.cpp0000644000175100017510000000657315154533055026510 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "visualstudioguidpool.h" #include #include #include #include #include #include #include #include #include #include #include namespace qbs { class VisualStudioGuidPoolPrivate { public: std::string storeFilePath; std::map productGuids; }; VisualStudioGuidPool::VisualStudioGuidPool(const std::string &storeFilePath) : d(std::make_shared()) { // Read any existing GUIDs from the on-disk store std::ifstream file(Internal::utf8_to_native_path(d->storeFilePath = storeFilePath)); if (file.is_open()) { const auto data = std::string( std::istreambuf_iterator(file), std::istreambuf_iterator()); const auto json = QJsonDocument::fromJson(QByteArray(data.data(), data.size())).object(); for (auto it = json.begin(), end = json.end(); it != end; ++it) { d->productGuids.insert({it.key().toStdString(), QUuid(it.value().toString())}); } } } VisualStudioGuidPool::~VisualStudioGuidPool() { Internal::FileSaver file(d->storeFilePath); if (file.open()) { QJsonObject productData; for (const auto &it : d->productGuids) productData[QString::fromStdString(it.first)] = it.second.toString(); const auto data = QJsonDocument(productData).toJson(); file.write({data.data(), size_t(data.size())}); file.commit(); } } QUuid VisualStudioGuidPool::drawProductGuid(const std::string &productName) { if (d->productGuids.find(productName) == d->productGuids.cend()) d->productGuids.insert({productName, QUuid::createUuid()}); return d->productGuids.at(productName); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildsolutionpropertiesproject.h0000644000175100017510000000424015154533055030604 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef MSBUILDSOLUTIONPROPERTIESPROJECT_H #define MSBUILDSOLUTIONPROPERTIESPROJECT_H #include "msbuild/msbuildproject.h" #include #include #include namespace qbs { class MSBuildSolutionPropertiesProject : public MSBuildProject { public: MSBuildSolutionPropertiesProject(const Internal::VisualStudioVersionInfo &versionInfo, const GeneratableProject &project, const QFileInfo &qbsExecutable, const QString &qbsSettingsDir); }; } // namespace qbs #endif // MSBUILDSOLUTIONPROPERTIESPROJECT_H qbs-src-3.2.0/src/plugins/generator/visualstudio/visualstudiogenerator.h0000644000175100017510000000611715154533055026313 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_VISUALSTUDIOGENERATOR_H #define QBS_VISUALSTUDIOGENERATOR_H #include #include #include #include "visualstudioguidpool.h" #include #include #include namespace qbs { namespace Internal { class VisualStudioVersionInfo; } class MSBuildProject; class MSBuildTargetProject; class VisualStudioGeneratorPrivate; class VisualStudioSolution; class VisualStudioSolutionFileProject; class VisualStudioSolutionFolderProject; class VisualStudioGenerator : public ProjectGenerator, private IGeneratableProjectVisitor { friend class SolutionDependenciesVisitor; public: explicit VisualStudioGenerator(const Internal::VisualStudioVersionInfo &versionInfo); ~VisualStudioGenerator() override; QString generatorName() const override; void generate() override; private: void visitProject(const GeneratableProject &project) override; void visitProjectData(const GeneratableProject &project, const GeneratableProjectData &projectData) override; void visitProduct(const GeneratableProject &project, const GeneratableProjectData &projectData, const GeneratableProductData &productData) override; void addPropertySheets(const GeneratableProject &project); void addPropertySheets(const std::shared_ptr &targetProject); std::unique_ptr d; }; } // namespace qbs #endif // QBS_VISUALSTUDIOGENERATOR_H qbs-src-3.2.0/src/plugins/generator/visualstudio/msbuildqbsgenerateproject.cpp0000644000175100017510000000601015154533055027443 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msbuildqbsgenerateproject.h" #include "msbuild/msbuildimport.h" #include "msbuild/msbuildproperty.h" #include "msbuild/msbuildpropertygroup.h" #include #include #include namespace qbs { MSBuildQbsGenerateProject::MSBuildQbsGenerateProject( const GeneratableProject &project, const Internal::VisualStudioVersionInfo &versionInfo) : MSBuildTargetProject(project, versionInfo) { const auto cppDefaultProps = makeChild(); cppDefaultProps->setProject(QStringLiteral("$(VCTargetsPath)\\Microsoft.Cpp.Default.props")); const auto group = makeChild(); group->setLabel(QStringLiteral("Configuration")); group->appendProperty(QStringLiteral("PlatformToolset"), versionInfo.platformToolsetVersion()); group->appendProperty(QStringLiteral("ConfigurationType"), QStringLiteral("Makefile")); const auto params = Internal::shellQuote(project.commandLine(), Internal::HostOsInfo::HostOsWindows); group->appendProperty( QStringLiteral("NMakeBuildCommandLine"), QString(QStringLiteral("$(QbsGenerateCommandLine) ") + params)); const auto cppProps = makeChild(); cppProps->setProject(QStringLiteral("$(VCTargetsPath)\\Microsoft.Cpp.props")); const auto import = makeChild(); import->setProject(QStringLiteral("$(VCTargetsPath)\\Microsoft.Cpp.targets")); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/makefilegenerator/0000755000175100017510000000000015154533055022424 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/makefilegenerator/makefilegenerator.cpp0000644000175100017510000004212115154533055026614 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #include "makefilegenerator.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { using namespace Internal; QString qbs::MakefileGenerator::generatorName() const { return QStringLiteral("makefile"); } static QString quote(const QString &s) { QString quoted = shellQuote(s); quoted.replace(QLatin1Char('$'), QLatin1String("$$")); // For make quoted.replace(QLatin1String("$$(SRCDIR)"), QLatin1String("$(SRCDIR)")); quoted.replace(QLatin1String("$$(BUILD_ROOT)"), QLatin1String("$(BUILD_ROOT)")); quoted.replace(QLatin1String("$$(INSTALL_ROOT)"), QLatin1String("$(INSTALL_ROOT)")); return quoted; } enum class TargetType { Product, Path }; static QString makeValidTargetName(const QString &name, TargetType targetType) { QString modifiedName = name; switch (targetType) { case TargetType::Product: { static const QRegularExpression illegalChar(QStringLiteral("[^_.0-9A-Za-z]")); modifiedName.replace(illegalChar, QStringLiteral("_")); break; } case TargetType::Path: if (HostOsInfo::isWindowsHost()) { modifiedName = QDir::toNativeSeparators(modifiedName); modifiedName = quote(modifiedName); } else { modifiedName.replace(QLatin1Char(' '), QStringLiteral("\\ ")); } } return modifiedName; } static QString makeValidTargetName(const ProductData &product) { QString name = makeValidTargetName(product.name(), TargetType::Product); if (!product.multiplexConfigurationId().isEmpty()) name.append(QLatin1Char('_')).append(product.multiplexConfigurationId()); return name; } using PrefixSpec = std::pair; static QString replacePrefix(const QString &path, const std::vector &candidates) { for (const PrefixSpec &prefixSpec : candidates) { if (path.startsWith(prefixSpec.first) && (path.size() == prefixSpec.first.size() || path.at(prefixSpec.first.size()) == QLatin1Char('/'))) { QString p = path; return p.replace(0, prefixSpec.first.size(), QLatin1String("$(") + prefixSpec.second + QLatin1Char(')')); } } return path; } static QString bruteForcePathReplace(const QString &value, const QString &srcDir, const QString &buildDir, const QString &installRoot) { QString transformedValue = value; if (!installRoot.isEmpty()) transformedValue.replace(installRoot, QStringLiteral("$(INSTALL_ROOT)")); transformedValue.replace(buildDir, QStringLiteral("$(BUILD_ROOT)")); transformedValue.replace(srcDir, QStringLiteral("$(SRCDIR)")); return transformedValue; } static QString mkdirCmdLine(const QString &dir) { if (HostOsInfo::isWindowsHost()) return QStringLiteral("if not exist %1 mkdir %1 & if not exist %1 exit 1").arg(dir); return QStringLiteral("mkdir -p ") + dir; } static QString installFileCommand() { return HostOsInfo::isWindowsHost() ? QStringLiteral("copy /Y") : QStringLiteral("install -m 644 -p"); } static QString installProgramCommand() { return HostOsInfo::isWindowsHost() ? installFileCommand() : QStringLiteral("install -m 755 -p"); } static QString removeCommand() { return HostOsInfo::isWindowsHost() ? QStringLiteral("del") : QStringLiteral("rm -f"); } void qbs::MakefileGenerator::generate() { const auto projects = project().projects.values(); for (const Project &theProject : projects) { const QString makefileFilePath = theProject.projectData().buildDirectory() + QLatin1String("/Makefile"); QFile makefile(makefileFilePath); if (!makefile.open(QIODevice::WriteOnly)) { throw ErrorInfo(Tr::tr("Failed to create '%1': %2") .arg(makefileFilePath, makefile.errorString())); } QTextStream stream(&makefile); ErrorInfo error; const ProjectTransformerData projectTransformerData = theProject.transformerData(&error); if (error.hasError()) throw error; stream << "# This file was generated by qbs" << "\n\n"; stream << "INSTALL_FILE = " << installFileCommand() << '\n'; stream << "INSTALL_PROGRAM = " << installProgramCommand() << '\n'; stream << "RM = " << removeCommand() << '\n'; stream << '\n'; const ProjectData projectData = theProject.projectData(); const QString srcDir = QFileInfo(projectData.location().filePath()).path(); if (srcDir.contains(QLatin1Char(' '))) { throw ErrorInfo(Tr::tr("The project directory '%1' contains space characters, which" "is not supported by this generator.").arg(srcDir)); } stream << "SRCDIR = " << QDir::toNativeSeparators(srcDir) << '\n'; const QString &buildDir = projectData.buildDirectory(); if (buildDir.contains(QLatin1Char(' '))) { throw ErrorInfo(Tr::tr("The build directory '%1' contains space characters, which" "is not supported by this generator.").arg(buildDir)); } stream << "BUILD_ROOT = " << QDir::toNativeSeparators(buildDir) << '\n'; QString installRoot; const QList allInstallables = projectData.installableArtifacts(); if (!allInstallables.empty()) { installRoot = allInstallables.first().installData().installRoot(); if (installRoot.contains(QLatin1Char(' '))) { throw ErrorInfo(Tr::tr("The install root '%1' contains space characters, which" "is not supported by this generator.").arg(installRoot)); } stream << "INSTALL_ROOT = " << QDir::toNativeSeparators(installRoot) << '\n'; } stream << "\nall:\n"; const std::vector srcDirPrefixSpecs{std::make_pair(srcDir, QStringLiteral("SRCDIR"))}; const auto prefixifiedSrcDirPath = [&srcDirPrefixSpecs](const QString &path) { return replacePrefix(path, srcDirPrefixSpecs); }; const std::vector buildRootPrefixSpecs{ std::make_pair(buildDir, QStringLiteral("BUILD_ROOT"))}; const auto prefixifiedBuildDirPath = [&buildRootPrefixSpecs](const QString &path) { return replacePrefix(path, buildRootPrefixSpecs); }; const std::vector installRootPrefixSpecs{ std::make_pair(installRoot, QStringLiteral("INSTALL_ROOT"))}; const auto prefixifiedInstallDirPath = [&installRoot, &installRootPrefixSpecs](const QString &path) { if (installRoot.isEmpty()) return path; return replacePrefix(path, installRootPrefixSpecs); }; const auto transformedOutputFilePath = [=](const ArtifactData &output) { return makeValidTargetName(prefixifiedBuildDirPath(output.filePath()), TargetType::Path); }; const auto transformedInputFilePath = [=](const ArtifactData &input) { return makeValidTargetName(prefixifiedSrcDirPath(input.filePath()), TargetType::Path); }; const auto transformedArtifactFilePath = [=](const ArtifactData &artifact) { return artifact.isGenerated() ? transformedOutputFilePath(artifact) : transformedInputFilePath(artifact); }; QStringList allTargets; QStringList allDefaultTargets; QStringList filesCreatedByJsCommands; bool jsCommandsEncountered = false; for (const auto &d : projectTransformerData) { const ProductData productData = d.first; const QString productTarget = makeValidTargetName(productData); const ProductTransformerData productTransformerData = d.second; const bool builtByDefault = productData.properties().value( StringConstants::builtByDefaultProperty()).toBool(); if (builtByDefault) allDefaultTargets.push_back(productTarget); allTargets.push_back(productTarget); stream << productTarget << ':'; const auto targetArtifacts = productData.targetArtifacts(); for (const ArtifactData &ta : targetArtifacts) stream << ' ' << transformedOutputFilePath(ta); stream << '\n'; for (const TransformerData &transformerData : productTransformerData) { stream << transformedOutputFilePath(transformerData.outputs().constFirst()) << ":"; const auto inputs = transformerData.inputs(); for (const ArtifactData &input : inputs) stream << ' ' << transformedArtifactFilePath(input); stream << '\n'; Set createdDirs; const auto outputs = transformerData.outputs(); for (const ArtifactData &output : outputs) { const QString outputDir = QFileInfo(output.filePath()).path(); if (createdDirs.insert(outputDir).second) stream << "\t" << mkdirCmdLine(QDir::toNativeSeparators( prefixifiedBuildDirPath(outputDir))) << '\n'; } bool processCommandEncountered = false; const auto commands = transformerData.commands(); for (const RuleCommand &command : commands) { if (command.type() == RuleCommand::JavaScriptCommandType) { jsCommandsEncountered = true; continue; } processCommandEncountered = true; stream << '\t' << QDir::toNativeSeparators( quote(bruteForcePathReplace(command.executable(), srcDir, buildDir, installRoot))); // TODO: Optionally use environment? const auto args = command.arguments(); for (const QString &arg : args) { stream << ' ' << quote(bruteForcePathReplace(arg, srcDir, buildDir, installRoot)); } stream << '\n'; } for (int i = 1; i < transformerData.outputs().size(); ++i) { stream << transformedOutputFilePath(transformerData.outputs().at(i)) << ": " << transformedOutputFilePath(transformerData.outputs().at(i-1)) << '\n'; } if (!processCommandEncountered && builtByDefault) { const auto outputs = transformerData.outputs(); transform(outputs, filesCreatedByJsCommands, [](const auto &output) { return output.filePath(); }); } } stream << "install-" << productTarget << ": " << productTarget << '\n'; Set createdDirs; const auto installableArtifacts = productData.installableArtifacts(); for (const ArtifactData &artifact : installableArtifacts) { const QString &outputDir = artifact.installData().localInstallDir(); if (outputDir.contains(QLatin1Char(' '))) { logger().qbsWarning() << Tr::tr("Skipping installation of '%1', because " "target directory '%2' contains spaces.") .arg(artifact.filePath(), outputDir); continue; } if (createdDirs.insert(outputDir).second) stream << "\t" << mkdirCmdLine(QDir::toNativeSeparators( prefixifiedInstallDirPath(outputDir))) << '\n'; const QFileInfo fileInfo(artifact.filePath()); const QString transformedInputFilePath = QDir::toNativeSeparators((artifact.isGenerated() ? prefixifiedBuildDirPath(fileInfo.path()) : prefixifiedSrcDirPath(fileInfo.path())) + QLatin1Char('/') + quote(fileInfo.fileName())); const QString transformedOutputDir = QDir::toNativeSeparators(prefixifiedInstallDirPath( artifact.installData().localInstallDir())); stream << "\t" << (artifact.isExecutable() ? "$(INSTALL_PROGRAM) " : "$(INSTALL_FILE) ") << transformedInputFilePath << ' ' << transformedOutputDir << '\n'; } stream << "clean-" << productTarget << ":\n"; for (const ArtifactData &artifact : productData.generatedArtifacts()) { const QFileInfo fileInfo(artifact.filePath()); const QString transformedFilePath = QDir::toNativeSeparators( prefixifiedBuildDirPath(fileInfo.path()) + QLatin1Char('/') + quote(fileInfo.fileName())); stream << '\t'; if (HostOsInfo::isWindowsHost()) stream << '-'; stream << "$(RM) " << transformedFilePath << '\n'; } } stream << "all:"; for (const QString &target : std::as_const(allDefaultTargets)) stream << ' ' << target; stream << '\n'; stream << "install:"; for (const QString &target : std::as_const(allDefaultTargets)) stream << ' ' << "install-" << target; stream << '\n'; stream << "clean:"; for (const QString &target : std::as_const(allTargets)) stream << ' ' << "clean-" << target; stream << '\n'; if (!filesCreatedByJsCommands.empty()) { logger().qbsWarning() << Tr::tr("Some rules used by this project are not " "Makefile-compatible, because they depend entirely on JavaScriptCommands. " "The build is probably not fully functional. " "Affected build artifacts:\n\t%1") .arg(filesCreatedByJsCommands.join(QLatin1String("\n\t"))); } else if (jsCommandsEncountered) { logger().qbsWarning() << Tr::tr("Some rules in this project use JavaScriptCommands, " "which cannot be converted to Makefile-compatible constructs. The build may " "not be fully functional."); } logger().qbsInfo() << Tr::tr("Makefile successfully generated at '%1'.") .arg(makefileFilePath); } } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/makefilegenerator/makefilegenerator.qbs0000644000175100017510000000032115154533055026613 0ustar runnerrunnerimport "../../qbsplugin.qbs" as QbsPlugin QbsPlugin { name: "makefilegenerator" files: [ "makefilegenerator.cpp", "makefilegenerator.h", "makefilegeneratorplugin.cpp", ] } qbs-src-3.2.0/src/plugins/generator/makefilegenerator/CMakeLists.txt0000644000175100017510000000026715154533055025171 0ustar runnerrunnerset(SOURCES makefilegenerator.cpp makefilegenerator.h makefilegeneratorplugin.cpp ) add_qbs_plugin(makefilegenerator DEPENDS qbscore SOURCES ${SOURCES} ) qbs-src-3.2.0/src/plugins/generator/makefilegenerator/makefilegeneratorplugin.cpp0000644000175100017510000000501015154533055030027 0ustar runnerrunner/**************************************************************************** ** ** 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$ ** ****************************************************************************/ #include "makefilegenerator.h" #include #include static void MakefileGeneratorPluginLoad() { qbs::ProjectGeneratorManager::registerGenerator( std::make_shared()); } static void MakefileGeneratorPluginUnload() { } #ifndef GENERATOR_EXPORT #if defined(WIN32) || defined(_WIN32) #define GENERATOR_EXPORT __declspec(dllexport) #else #define GENERATOR_EXPORT __attribute__((visibility("default"))) #endif #endif QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, makefilegenerator, MakefileGeneratorPluginLoad, MakefileGeneratorPluginUnload) qbs-src-3.2.0/src/plugins/generator/makefilegenerator/makefilegenerator.h0000644000175100017510000000420515154533055026262 0ustar runnerrunner/**************************************************************************** ** ** 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_MAKEFILEGENERATOR_H #define QBS_MAKEFILEGENERATOR_H #include namespace qbs { class MakefileGenerator : public ProjectGenerator { QString generatorName() const override; void generate() override; }; } // namespace qbs #endif // Include guard. qbs-src-3.2.0/src/plugins/generator/CMakeLists.txt0000644000175100017510000000026415154533055021502 0ustar runnerrunneradd_subdirectory(clangcompilationdb) add_subdirectory(graphviz) add_subdirectory(iarew) add_subdirectory(keiluv) add_subdirectory(makefilegenerator) add_subdirectory(visualstudio) qbs-src-3.2.0/src/plugins/generator/graphviz/0000755000175100017510000000000015154533055020572 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/graphviz/graphvizgenerator.h0000644000175100017510000000542515154533055024512 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com). ** 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 GRAPHVIZGENERATOR_H #define GRAPHVIZGENERATOR_H #include #include namespace qbs { class GraphvizGenerator : public ProjectGenerator { public: QString generatorName() const override; void generate() override; private: void writeProductsGraph(const ProjectData &projectData); void writeProjectsGraph(const ProjectData &projectData); void writeProductGraph( const ProjectData &projectData, const ProductData &theProject, const std::unordered_map &productMap); void iterateProjects( const ProjectData &projectData, std::function func); void iterateProducts( const ProductData &product, const std::unordered_map &productMap, std::function func); }; } // namespace qbs #endif // GRAPHVIZGENERATOR_H qbs-src-3.2.0/src/plugins/generator/graphviz/CMakeLists.txt0000644000175100017510000000026015154533055023330 0ustar runnerrunnerset(SOURCES dotgraph.cpp graphvizgenerator.cpp graphvizgeneratorplugin.cpp ) add_qbs_plugin(graphvizgenerator DEPENDS qbscore SOURCES ${SOURCES} ) qbs-src-3.2.0/src/plugins/generator/graphviz/graphvizgeneratorplugin.cpp0000644000175100017510000000470415154533055026263 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com). ** 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$ ** ****************************************************************************/ #include "graphvizgenerator.h" #include #include static void GraphvizPluginLoad() { qbs::ProjectGeneratorManager::registerGenerator(std::make_shared()); } static void GraphvizPluginUnload() {} #ifndef GENERATOR_EXPORT #if defined(WIN32) || defined(_WIN32) #define GENERATOR_EXPORT __declspec(dllexport) #else #define GENERATOR_EXPORT __attribute__((visibility("default"))) #endif #endif QBS_REGISTER_STATIC_PLUGIN( extern "C" GENERATOR_EXPORT, graphviz, GraphvizPluginLoad, GraphvizPluginUnload) qbs-src-3.2.0/src/plugins/generator/graphviz/graphviz.qbs0000644000175100017510000000041215154533055023130 0ustar runnerrunnerimport qbs import "../../qbsplugin.qbs" as QbsPlugin QbsPlugin { name: "graphvizgenerator" files: [ "dotgraph.cpp", "dotgraph.h", "graphvizgenerator.cpp", "graphvizgenerator.h", "graphvizgeneratorplugin.cpp", ] } qbs-src-3.2.0/src/plugins/generator/graphviz/graphvizgenerator.cpp0000644000175100017510000002672215154533055025050 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com). ** 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$ ** ****************************************************************************/ #include "graphvizgenerator.h" #include "dotgraph.h" #include #include #include #include namespace qbs { using namespace Internal; static DotGraphNode makeProjectNode(size_t node, const ProjectData &project) { DotGraphNode result; result.id = node; result.label = project.name(); result.enabled = true; result.type = DotGraphNode::Type::Project; return result; } static DotGraphNode makeProductNode(size_t node, const ProductData &product) { DotGraphNode result; result.id = node; result.label = product.name(); result.enabled = product.isEnabled(); result.type = DotGraphNode::Type::Product; return result; } static DotGraphNode makeModuleNode(size_t node, const QString &module) { DotGraphNode result; result.id = node; result.label = module; result.type = DotGraphNode::Type::Module; return result; } static std::unordered_map createProductMap(const QList &products) { std::unordered_map result; for (const auto &product : products) result[product.name()] = product; return result; } static QString getFileName(const ProjectData &projectData, const QString &suffix) { return projectData.buildDirectory() + QStringLiteral("/graphviz/") + projectData.name() + suffix + QStringLiteral(".dot"); } QString GraphvizGenerator::generatorName() const { return QStringLiteral("graphviz"); } void GraphvizGenerator::generate() { const auto projects = project().projects.values(); for (const Project &theProject : projects) { writeProjectsGraph(theProject.projectData()); writeProductsGraph(theProject.projectData()); } } void GraphvizGenerator::writeProjectsGraph(const ProjectData &projectData) { DotGraph dotGraph; std::unordered_map projectToNode; std::unordered_map projectParentMap; iterateProjects(projectData, [&](const ProjectData ¤tProjectData) { projectToNode[currentProjectData.name()] = dotGraph.addNode( makeProjectNode(dotGraph.createNodeId(), currentProjectData)); const auto subProjects = currentProjectData.subProjects(); for (const auto &subProject : subProjects) projectParentMap[subProject.name()] = currentProjectData.name(); }); std::unordered_map productToNode; std::unordered_map productParentMap; iterateProjects(projectData, [&](const ProjectData ¤tProjectData) { const auto &products = currentProjectData.products(); for (const auto &product : products) { productToNode[product.name()] = dotGraph.addNode( makeProductNode(dotGraph.createNodeId(), product)); productParentMap[product.name()] = currentProjectData.name(); } }); for (const auto &item : projectParentMap) { const auto childNode = projectToNode[item.first]; const auto parentNode = projectToNode[item.second]; dotGraph.addRelation({parentNode, childNode}); } for (const auto &item : productParentMap) { const auto childNode = productToNode[item.first]; const auto parentNode = projectToNode[item.second]; dotGraph.addRelation({parentNode, childNode}); } const QString graphFilePath = getFileName(projectData, QLatin1String(".projects")); dotGraph.write(graphFilePath); } void GraphvizGenerator::writeProductsGraph(const ProjectData &projectData) { DotGraph dotGraph; const auto allProducts = projectData.allProducts(); const auto productMap = createProductMap(allProducts); std::unordered_map productToNode; for (const auto &product : allProducts) { productToNode[product.name()] = dotGraph.addNode( makeProductNode(dotGraph.createNodeId(), product)); } for (const auto &product : allProducts) { const auto parentNode = productToNode[product.name()]; for (const auto &dep : product.dependencies()) { const auto it = productMap.find(dep); if (it == productMap.end()) continue; const auto childProduct = it->second; if (product.type().contains(QStringLiteral("autotest-result")) && childProduct.type().contains(QStringLiteral("autotest"))) { continue; } const auto childNode = productToNode[dep]; dotGraph.addRelation({parentNode, childNode}); } } dotGraph.write(getFileName(projectData, QLatin1String(".products"))); for (const auto &product : allProducts) { writeProductGraph(projectData, product, productMap); } } void GraphvizGenerator::writeProductGraph( const ProjectData &projectData, const ProductData &product, const std::unordered_map &productMap) { DotGraph dotGraph; std::unordered_map productToNode; std::set deps; iterateProducts(product, productMap, [&](const ProductData ¤tProduct) { deps.insert(currentProduct.name()); }); for (const auto &dep : deps) { productToNode[dep] = dotGraph.addNode( makeProductNode(dotGraph.createNodeId(), productMap.at(dep))); } for (const auto &productName : deps) { const auto currentProduct = productMap.at(productName); const auto parentNode = productToNode[productName]; for (const auto &dep : currentProduct.dependencies()) { const auto childNode = productToNode[dep]; dotGraph.addRelation({parentNode, childNode}); } } const auto productNode = dotGraph.addNode( makeProductNode(dotGraph.createNodeId(), productMap.at(product.name()))); for (const auto &module : product.moduleProperties().allModules()) { const auto childNode = dotGraph.addNode(makeModuleNode(dotGraph.createNodeId(), module)); dotGraph.addRelation({productNode, childNode}); } const auto fileTagsString = [](const ArtifactData &artifact) { return QStringLiteral("[%1]").arg(artifact.fileTags().join(QLatin1String(", "))); }; const auto productNode2 = dotGraph.addNode( makeProductNode(dotGraph.createNodeId(), productMap.at(product.name()))); std::unordered_map artifactToNode; std::unordered_map artifactMap; for (const auto &group : product.groups()) { for (const auto &artifact : group.allSourceArtifacts()) { artifactMap[artifact.filePath()] = artifact; } } std::deque> artifactQueue; for (const auto &artifact : product.generatedArtifacts()) { artifactMap[artifact.filePath()] = artifact; if (artifact.isTargetArtifact()) artifactQueue.push_back({artifact, productNode2}); } // Traverse artifacts starting from target artifacts down to their dependencies. // This way we create nodes only for artifacts reachable from the top of the graph. // Otherwise, graph becomes too complicated. while (!artifactQueue.empty()) { const auto &[artifact, parentNodeId] = artifactQueue.front(); const auto currentPath = artifact.filePath(); auto &nodeId = artifactToNode[currentPath]; if (nodeId) { dotGraph.addRelation({parentNodeId, nodeId}); artifactQueue.pop_front(); continue; } DotGraphNode node; node.id = dotGraph.createNodeId(); node.label = QFileInfo(currentPath).fileName() + QLatin1String("\n") + fileTagsString(artifact); node.type = artifact.isGenerated() ? DotGraphNode::Type::Artifact : DotGraphNode::Type::File; nodeId = dotGraph.addNode(std::move(node)); dotGraph.addRelation({parentNodeId, nodeId}); for (const auto &childPath : artifact.childPaths()) { auto it = artifactMap.find(childPath); if (it != artifactMap.end()) { artifactQueue.push_back({it->second, nodeId}); } } artifactQueue.pop_front(); } const QString graphFilePath = getFileName( projectData, QLatin1String(".products/") + product.name()); dotGraph.write(graphFilePath); } void GraphvizGenerator::iterateProjects( const ProjectData &projectData, std::function func) { std::deque queue; queue.push_back(projectData); while (!queue.empty()) { const auto size = queue.size(); for (size_t i = 0; i < size; ++i) { const auto ¤tProjectData = queue[i]; func(currentProjectData); const auto subProjects = currentProjectData.subProjects(); std::copy(subProjects.begin(), subProjects.end(), std::back_inserter(queue)); } queue.erase(queue.begin(), queue.begin() + size); } } void GraphvizGenerator::iterateProducts( const ProductData &product, const std::unordered_map &productMap, std::function func) { std::deque productQueue{product}; while (!productQueue.empty()) { const auto ¤tProduct = productQueue.front(); func(currentProduct); for (const auto &dep : currentProduct.dependencies()) { const auto it = productMap.find(dep); if (it != productMap.end()) productQueue.push_back(it->second); } productQueue.pop_front(); } } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/graphviz/dotgraph.h0000644000175100017510000000727015154533055022561 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com). ** 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$ ** ****************************************************************************/ #pragma once #include #include class QFile; namespace qbs { namespace Internal { struct DotGraphNode { size_t id{0}; QString label; bool enabled{true}; enum class Type { Product, Project, Module, Artifact, File }; Type type; static QByteArray typeToString(Type type) { if (type == Type::Project) return QByteArray("ellipse"); if (type == Type::Product) return QByteArray("box"); if (type == Type::Module) return QByteArray("diamond"); if (type == Type::Artifact) return QByteArray("pentagon"); if (type == Type::File) return QByteArray("note"); return QByteArray("box"); } QByteArray toString() const { QByteArray result; result += QByteArray::number(quintptr(id)) + " ["; result += "shape=" + typeToString(type); if (!enabled) { result += " fontcolor=grey"; result += " color=grey"; } result += " label=\"" + label.toUtf8() + "\""; result += "]"; return result; } }; struct Relation { size_t from{0}; size_t to{0}; QByteArray toString() const { return QByteArray::number(quintptr(from)) + " -> " + QByteArray::number(quintptr(to)); } }; class DotGraph { public: void write(QFile &file); void write(const QString &filePath); size_t addNode(DotGraphNode &&node) { m_nodes.push_back(std::move(node)); return m_nodes.back().id; } void addRelation(Relation &&relation) { m_relations.push_back(std::move(relation)); } size_t createNodeId() { return m_nodeIds++; } private: std::vector m_nodes; std::vector m_relations; size_t m_nodeIds = 1; }; } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/plugins/generator/graphviz/dotgraph.cpp0000644000175100017510000000564215154533055023115 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2025 Ivan Komissarov (abbapoh@gmail.com). ** 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$ ** ****************************************************************************/ #include "dotgraph.h" #include #include #include #include #include namespace qbs { namespace Internal { void DotGraph::write(QFile &file) { const auto indent = " "; file.write("digraph G {\n"); file.write(indent); for (const auto &node : m_nodes) { file.write(indent); file.write(node.toString()); file.write("\n"); } for (const auto &relation : m_relations) { file.write(indent); file.write(relation.toString()); file.write("\n"); } file.write("}\n"); } void DotGraph::write(const QString &filePath) { QFileInfo fileInfo(filePath); const auto directory = fileInfo.path(); if (!QDir(fileInfo.path()).exists()) { QDir().mkpath(directory); } QFile file(filePath); if (!file.open(QIODevice::WriteOnly)) { throw ErrorInfo(Tr::tr("Failed to create '%1': %2").arg(filePath, file.errorString())); } write(file); } } // namespace Internal } // namespace qbs qbs-src-3.2.0/src/plugins/generator/clangcompilationdb/0000755000175100017510000000000015154533055022571 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/clangcompilationdb/clangcompilationdbgeneratorplugin.cpp0000644000175100017510000000506415154533055032261 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ #include "clangcompilationdbgenerator.h" #include #include static void QbsClangDbGeneratorPluginLoad() { qbs::ProjectGeneratorManager::registerGenerator( std::make_shared()); } static void QbsClangDbGeneratorPluginUnload() { } #ifndef GENERATOR_EXPORT #if defined(WIN32) || defined(_WIN32) #define GENERATOR_EXPORT __declspec(dllexport) #else #define GENERATOR_EXPORT __attribute__((visibility("default"))) #endif #endif QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, clangcompilationdbgenerator, QbsClangDbGeneratorPluginLoad, QbsClangDbGeneratorPluginUnload) qbs-src-3.2.0/src/plugins/generator/clangcompilationdb/clangcompilationdbgenerator.cpp0000644000175100017510000001375615154533055031051 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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$ ** ****************************************************************************/ #include "clangcompilationdbgenerator.h" #include #include #include #include #include #include #include #include #include #include #include #include namespace qbs { using namespace Internal; const QString ClangCompilationDatabaseGenerator::DefaultDatabaseFileName = QStringLiteral("compile_commands.json"); ClangCompilationDatabaseGenerator::ClangCompilationDatabaseGenerator() = default; QString ClangCompilationDatabaseGenerator::generatorName() const { return QStringLiteral("clangdb"); } void ClangCompilationDatabaseGenerator::generate() { const auto projects = project().projects.values(); for (const Project &theProject : projects) { QJsonArray database; const ProjectData projectData = theProject.projectData(); const QString &buildDir = projectData.buildDirectory(); for (const ProductData &productData : projectData.allProducts()) { for (const GroupData &groupData : productData.groups()) { const auto sourceArtifacts = groupData.allSourceArtifacts(); for (const ArtifactData &sourceArtifact : sourceArtifacts) { if (!hasValidInputFileTag(sourceArtifact.fileTags())) continue; const QString filePath = sourceArtifact.filePath(); ErrorInfo errorInfo; const RuleCommandList rules = theProject.ruleCommands(productData, filePath, QStringLiteral("obj"), &errorInfo); if (errorInfo.hasError()) throw errorInfo; for (const RuleCommand &rule : rules) { if (rule.type() != RuleCommand::ProcessCommandType) continue; database.push_back(createEntry(filePath, buildDir, rule)); } } } } writeProjectDatabase(QDir(buildDir).filePath(DefaultDatabaseFileName), database); } } // See http://clang.llvm.org/docs/JSONCompilationDatabase.html QJsonObject ClangCompilationDatabaseGenerator::createEntry(const QString &filePath, const QString &buildDir, const RuleCommand &ruleCommand) { QString workDir = ruleCommand.workingDirectory(); if (workDir.isEmpty()) workDir = buildDir; const QStringList arguments = QStringList() << ruleCommand.executable() << ruleCommand.arguments(); return QJsonObject{ { QStringLiteral("directory"), QJsonValue(workDir) }, { QStringLiteral("arguments"), QJsonArray::fromStringList(arguments) }, { QStringLiteral("file"), QJsonValue(filePath) } }; } void ClangCompilationDatabaseGenerator::writeProjectDatabase(const QString &filePath, const QJsonArray &entries) { const QJsonDocument database(entries); QFile databaseFile(filePath); if (!databaseFile.open(QFile::WriteOnly)) throw ErrorInfo(Tr::tr("Cannot open '%1' for writing: %2") .arg(filePath, databaseFile.errorString())); if (databaseFile.write(database.toJson()) == -1) throw ErrorInfo(Tr::tr("Error while writing '%1': %2") .arg(filePath, databaseFile.errorString())); } bool ClangCompilationDatabaseGenerator::hasValidInputFileTag(const QStringList &fileTags) const { static const QStringList validFileTags = { QStringLiteral("c"), QStringLiteral("cpp"), QStringLiteral("objc"), QStringLiteral("objcpp") }; return Internal::any_of(fileTags, [](const auto &tag) { return validFileTags.contains(tag); }); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/clangcompilationdb/CMakeLists.txt0000644000175100017510000000033715154533055025334 0ustar runnerrunnerset(SOURCES clangcompilationdbgenerator.cpp clangcompilationdbgenerator.h clangcompilationdbgeneratorplugin.cpp ) add_qbs_plugin(clangcompilationdbgenerator DEPENDS qbscore SOURCES ${SOURCES} ) qbs-src-3.2.0/src/plugins/generator/clangcompilationdb/clangcompilationdb.qbs0000644000175100017510000000037015154533055027131 0ustar runnerrunnerimport "../../qbsplugin.qbs" as QbsPlugin QbsPlugin { name: "clangcompilationdbgenerator" files: [ "clangcompilationdbgenerator.cpp", "clangcompilationdbgenerator.h", "clangcompilationdbgeneratorplugin.cpp" ] } qbs-src-3.2.0/src/plugins/generator/clangcompilationdb/clangcompilationdbgenerator.h0000644000175100017510000000517115154533055030506 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2016 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_CLANGCOMPILATIONDATABASEGENERATOR_H #define QBS_CLANGCOMPILATIONDATABASEGENERATOR_H #include namespace qbs { class SourceArtifact; class ProjectData; class ClangCompilationDatabaseGenerator : public ProjectGenerator { public: ClangCompilationDatabaseGenerator(); private: QString generatorName() const override; void generate() override; static const QString DefaultDatabaseFileName; QJsonObject createEntry(const QString &filePath, const QString &buildDir, const RuleCommand &ruleCommand); void writeProjectDatabase(const QString &filePath, const QJsonArray &entries); bool hasValidInputFileTag(const QStringList &fileTags) const; }; } // namespace qbs #endif // QBS_VISUALSTUDIOGENERATOR_H qbs-src-3.2.0/src/plugins/generator/iarew/0000755000175100017510000000000015154533055020047 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/iarew/iarewgeneratorplugin.cpp0000644000175100017510000000521115154533055025007 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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$ ** ****************************************************************************/ #include "iarewgenerator.h" #include "iarewversioninfo.h" #include #include static void QbsIarewGeneratorPluginLoad() { for (const auto &info : qbs::IarewVersionInfo::knownVersions) { qbs::ProjectGeneratorManager::registerGenerator( std::make_shared(info)); } } static void QbsIarewGeneratorPluginUnload() { } #ifndef GENERATOR_EXPORT #if defined(WIN32) || defined(_WIN32) #define GENERATOR_EXPORT __declspec(dllexport) #else #define GENERATOR_EXPORT __attribute__((visibility("default"))) #endif #endif QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, iarewgenerator, QbsIarewGeneratorPluginLoad, QbsIarewGeneratorPluginUnload) qbs-src-3.2.0/src/plugins/generator/iarew/iarewprojectwriter.cpp0000644000175100017510000000372515154533055024515 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "iarewprojectwriter.h" namespace qbs { IarewProjectWriter::IarewProjectWriter(std::ostream *device) : gen::xml::ProjectWriter(device) { } void IarewProjectWriter::visitProjectStart(const gen::xml::Project *project) { Q_UNUSED(project) writer()->writeStartElement(QStringLiteral("project")); } void IarewProjectWriter::visitProjectEnd(const gen::xml::Project *project) { Q_UNUSED(project) writer()->writeEndElement(); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/iarewsettingspropertygroup.cpp0000644000175100017510000000752115154533055026332 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "iarewoptionpropertygroup.h" #include "iarewsettingspropertygroup.h" namespace qbs { constexpr int kDataWantNonLocalPropertyValue = 1; IarewSettingsPropertyGroup::IarewSettingsPropertyGroup() : gen::xml::PropertyGroup(QByteArrayLiteral("settings")) { // Append name property item. m_nameProperty = appendChild( QByteArrayLiteral("name"), QVariant{}); // Append archive version property item. m_archiveVersionProperty = appendChild( QByteArrayLiteral("archiveVersion"), QVariant{}); // Append data property group item. m_dataPropertyGroup = appendChild( QByteArrayLiteral("data")); // Append data version property item. m_dataVersionProperty = m_dataPropertyGroup->appendChild< gen::xml::Property>( QByteArrayLiteral("version"), QVariant{}); // Append data want non-local property item. m_dataPropertyGroup->appendChild( QByteArrayLiteral("wantNonLocal"), kDataWantNonLocalPropertyValue); // Append data debug property item. m_dataDebugProperty = m_dataPropertyGroup->appendChild< gen::xml::Property>( QByteArrayLiteral("debug"), QVariant{}); } void IarewSettingsPropertyGroup::setName(const QByteArray &name) { // There is no way to move-construct a QVariant from T, thus name is shallow-copied m_nameProperty->setValue(QVariant(name)); } QByteArray IarewSettingsPropertyGroup::name() const { return m_nameProperty->value().toByteArray(); } void IarewSettingsPropertyGroup::setArchiveVersion( int archiveVersion) { m_archiveVersionProperty->setValue(archiveVersion); } int IarewSettingsPropertyGroup::archiveVersion() const { return m_archiveVersionProperty->value().toInt(); } void IarewSettingsPropertyGroup::setDataVersion(int dataVersion) { m_dataVersionProperty->setValue(dataVersion); } void IarewSettingsPropertyGroup::setDataDebugInfo(int debugInfo) { m_dataDebugProperty->setValue(debugInfo); } void IarewSettingsPropertyGroup::addOptionsGroup( const QByteArray &name, QVariantList states, int version) { m_dataPropertyGroup->appendChild(name, std::move(states), version); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/iarewtoolchainpropertygroup.h0000644000175100017510000000360415154533055026115 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWTOOLCHAINPROPERTYGROUP_H #define QBS_IAREWTOOLCHAINPROPERTYGROUP_H #include namespace qbs { class IarewToolchainPropertyGroup final : public gen::xml::PropertyGroup { public: explicit IarewToolchainPropertyGroup( const QByteArray &toolchainName); }; } // namespace qbs #endif // QBS_IAREWTOOLCHAINPROPERTYGROUP_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewtoolchainpropertygroup.cpp0000644000175100017510000000353315154533055026451 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "iarewtoolchainpropertygroup.h" namespace qbs { IarewToolchainPropertyGroup::IarewToolchainPropertyGroup( const QByteArray &toolchainName) : gen::xml::PropertyGroup(QByteArrayLiteral("toolchain")) { // Append toolchain name property item. appendProperty(QByteArrayLiteral("name"), toolchainName); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/iarewfileversionproperty.h0000644000175100017510000000362415154533055025407 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWFILEVERSIONPROPERTY_H #define QBS_IAREWFILEVERSIONPROPERTY_H #include #include namespace qbs { class IarewFileVersionProperty final : public gen::xml::Property { public: explicit IarewFileVersionProperty( const gen::VersionInfo &versionInfo); }; } // namespace qbs #endif // QBS_IAREWFILEVERSIONPROPERTY_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewworkspace.h0000644000175100017510000000435615154533055023256 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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_IAREWWORKSPACE_H #define QBS_IAREWWORKSPACE_H #include #include namespace qbs { class IarewWorkspace final : public gen::xml::Workspace { public: explicit IarewWorkspace(const QString &workspacePath); void addProject(const QString &projectPath) final; }; } // namespace qbs #endif // QBS_IAREWWORKSPACE_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewutils.cpp0000644000175100017510000001265115154533055022750 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "iarewutils.h" #include namespace qbs { namespace IarewUtils { QString toolkitRootPath(const ProductData &qbsProduct) { QDir dir(qbsProduct.moduleProperties() .getModuleProperty(Internal::StringConstants::cppModule(), QStringLiteral("toolchainInstallPath")) .toString()); dir.cdUp(); return dir.absolutePath(); } QString dlibToolkitRootPath(const ProductData &qbsProduct) { return toolkitRootPath(qbsProduct) + QLatin1String("/lib/dlib"); } QString clibToolkitRootPath(const ProductData &qbsProduct) { return toolkitRootPath(qbsProduct) + QLatin1String("/lib/clib"); } QString libToolkitRootPath(const ProductData &qbsProduct) { return toolkitRootPath(qbsProduct) + QLatin1String("/lib"); } QString toolkitRelativeFilePath(const QString &basePath, const QString &fullFilePath) { return QLatin1String("$TOOLKIT_DIR$/") + gen::utils::relativeFilePath(basePath, fullFilePath); } QString projectRelativeFilePath(const QString &basePath, const QString &fullFilePath) { return QLatin1String("$PROJ_DIR$/") + gen::utils::relativeFilePath(basePath, fullFilePath); } OutputBinaryType outputBinaryType(const ProductData &qbsProduct) { const auto &qbsProductType = qbsProduct.type(); if (qbsProductType.contains(QLatin1String("application"))) return ApplicationOutputType; if (qbsProductType.contains(QLatin1String("staticlibrary"))) return LibraryOutputType; return ApplicationOutputType; } QString flagValue(const QStringList &flags, const QString &flagKey) { // Seach for full 'flagKey' option matching. const auto flagBegin = flags.cbegin(); const auto flagEnd = flags.cend(); auto flagIt = std::find_if(flagBegin, flagEnd, [flagKey](const QString &flag) { return flag == flagKey; }); if (flagIt == flagEnd) { // Search for start/end of 'flagKey' matching. flagIt = std::find_if(flagBegin, flagEnd, [flagKey](const QString &flag) { return flag.startsWith(flagKey) || flag.endsWith(flagKey); }); if (flagIt == flagEnd) return {}; } QString value; // Check that option is in form of 'flagKey='. if (flagIt->contains(QLatin1Char('='))) { value = flagIt->split(QLatin1Char('=')).at(1).trimmed(); } else if (flagKey.size() < flagIt->size()) { // In this case an option is in form of 'flagKey'. value = flagIt->mid(flagKey.size()).trimmed(); } else { // In this case an option is in form of 'flagKey '. ++flagIt; if (flagIt < flagEnd) value = (*flagIt).trimmed(); else return {}; } return value; } QVariantList flagValues(const QStringList &flags, const QString &flagKey) { QVariantList values; for (auto flagIt = flags.cbegin(); flagIt < flags.cend(); ++flagIt) { if (*flagIt != flagKey) continue; ++flagIt; values.push_back(*flagIt); } return values; } QStringList cppModuleCompilerFlags(const PropertyMap &qbsProps) { return gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("driverFlags"), QStringLiteral("cFlags"), QStringLiteral("cppFlags"), QStringLiteral("cxxFlags"), QStringLiteral("commonCompilerFlags")}); } QStringList cppModuleAssemblerFlags(const PropertyMap &qbsProps) { return gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("assemblerFlags")}); } QStringList cppModuleLinkerFlags(const PropertyMap &qbsProps) { return gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("driverFlags"), QStringLiteral("driverLinkerFlags")}); } } // namespace IarewUtils } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/iarewsourcefilespropertygroup.cpp0000644000175100017510000000446615154533055027022 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "iarewsourcefilepropertygroup.h" #include "iarewsourcefilespropertygroup.h" #include #include namespace qbs { IarewSourceFilesPropertyGroup::IarewSourceFilesPropertyGroup( const GeneratableProject &genProject, const QString &filesGroupName, const QList &sourceFiles) : gen::xml::PropertyGroup(QByteArrayLiteral("group")) { // Create group name property item. appendChild(QByteArrayLiteral("name"), filesGroupName); // Create file paths property items. for (const auto &sourceFile : sourceFiles) appendChild(genProject, sourceFile); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/iarewworkspacewriter.h0000644000175100017510000000401215154533055024500 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWWORKSPACEWRITER_H #define QBS_IAREWWORKSPACEWRITER_H #include namespace qbs { class IarewWorkspaceWriter final : public gen::xml::WorkspaceWriter { Q_DISABLE_COPY(IarewWorkspaceWriter) public: explicit IarewWorkspaceWriter(std::ostream *device); private: void visitWorkspaceStart(const gen::xml::Workspace *workspace) final; void visitWorkspaceEnd(const gen::xml::Workspace *workspace) final; }; } // namespace qbs #endif // QBS_IAREWWORKSPACEWRITER_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewsourcefilepropertygroup.h0000644000175100017510000000375615154533055026305 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWSOURCEFILEPROPERTYGROUP_H #define QBS_IAREWSOURCEFILEPROPERTYGROUP_H #include namespace qbs { class ArtifactData; struct GeneratableProject; class IarewSourceFilePropertyGroup final : public gen::xml::PropertyGroup { public: explicit IarewSourceFilePropertyGroup( const GeneratableProject &genProject, const ArtifactData &sourceArtifact); }; } // namespace qbs #endif // QBS_IAREWSOURCEFILEPROPERTYGROUP_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewworkspace.cpp0000644000175100017510000000504515154533055023605 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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$ ** ****************************************************************************/ #include "iarewworkspace.h" #include namespace qbs { IarewWorkspace::IarewWorkspace(const QString &workspacePath) : gen::xml::Workspace(workspacePath) { appendChild( QByteArrayLiteral("batchBuild")); } void IarewWorkspace::addProject(const QString &projectFilePath) { const QString relativeProjectPath = QLatin1String("$WS_DIR$/") + m_baseDirectory.relativeFilePath(projectFilePath); const auto projectGroup = appendChild( QByteArrayLiteral("project")); projectGroup->appendProperty("path", relativeProjectPath); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/iarewgenerator.h0000644000175100017510000000516015154533055023240 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWGENERATOR_H #define QBS_IAREWGENERATOR_H #include "iarewversioninfo.h" #include #include namespace qbs { class IarewProject; class IarewWorkspace; class IarewGenerator final : public ProjectGenerator, private IGeneratableProjectVisitor { public: explicit IarewGenerator(const gen::VersionInfo &versionInfo); QString generatorName() const final; void generate() final; private: void reset(); void visitProject(const GeneratableProject &project) final; void visitProjectData(const GeneratableProject &project, const GeneratableProjectData &projectData) final; void visitProduct(const GeneratableProject &project, const GeneratableProjectData &projectData, const GeneratableProductData &productData) final; const gen::VersionInfo m_versionInfo; std::shared_ptr m_workspace; QString m_workspaceFilePath; std::map> m_projects; }; } // namespace qbs #endif // QBS_IAREWGENERATOR_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewsettingspropertygroup.h0000644000175100017510000000500715154533055025774 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWSETTINGSPROPERTYGROUP_H #define QBS_IAREWSETTINGSPROPERTYGROUP_H #include namespace qbs { class IarewSettingsPropertyGroup : public gen::xml::PropertyGroup { public: explicit IarewSettingsPropertyGroup(); void setName(const QByteArray &name); QByteArray name() const; void setArchiveVersion(int archiveVersion); int archiveVersion() const; protected: void setDataVersion(int dataVersion); void setDataDebugInfo(int debugInfo); void addOptionsGroup(const QByteArray &name, QVariantList states, int version = -1); private: // Don't delete all this RAW pointers explicitly! gen::xml::Property *m_nameProperty = nullptr; gen::xml::Property *m_archiveVersionProperty = nullptr; gen::xml::Property *m_dataPropertyGroup = nullptr; gen::xml::Property *m_dataVersionProperty = nullptr; gen::xml::Property *m_dataDebugProperty = nullptr; }; } // namespace qbs #endif // QBS_IAREWSETTINGSPROPERTYGROUP_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewproject.h0000644000175100017510000000413115154533055022715 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWPROJECT_H #define QBS_IAREWPROJECT_H #include #include #include #include namespace qbs { class IarewProject final : public gen::xml::Project { public: explicit IarewProject(const GeneratableProject &genProject, const GeneratableProductData &genProduct, const gen::VersionInfo &versionInfo); private: std::vector> m_factories; }; } // namespace qbs #endif // QBS_IAREWPROJECT_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewutils.h0000644000175100017510000000523515154533055022415 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWUTILS_H #define QBS_IAREWUTILS_H #include #include namespace qbs { namespace IarewUtils { enum OutputBinaryType { ApplicationOutputType, LibraryOutputType }; OutputBinaryType outputBinaryType(const ProductData &qbsProduct); QString toolkitRootPath(const ProductData &qbsProduct); QString dlibToolkitRootPath(const ProductData &qbsProduct); QString clibToolkitRootPath(const ProductData &qbsProduct); QString libToolkitRootPath(const ProductData &qbsProduct); QString toolkitRelativeFilePath(const QString &basePath, const QString &fullFilePath); QString projectRelativeFilePath(const QString &basePath, const QString &fullFilePath); QString flagValue(const QStringList &flags, const QString &flagKey); QVariantList flagValues(const QStringList &flags, const QString &flagKey); QStringList cppModuleCompilerFlags(const PropertyMap &qbsProps); QStringList cppModuleAssemblerFlags(const PropertyMap &qbsProps); QStringList cppModuleLinkerFlags(const PropertyMap &qbsProps); } // namespace IarewUtils } // namespace qbs #endif // QBS_IAREWUTILS_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewworkspacewriter.cpp0000644000175100017510000000376315154533055025047 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "iarewworkspacewriter.h" namespace qbs { IarewWorkspaceWriter::IarewWorkspaceWriter(std::ostream *device) : gen::xml::WorkspaceWriter(device) { } void IarewWorkspaceWriter::visitWorkspaceStart(const gen::xml::Workspace *workspace) { Q_UNUSED(workspace) writer()->writeStartElement(QStringLiteral("workspace")); } void IarewWorkspaceWriter::visitWorkspaceEnd(const gen::xml::Workspace *workspace) { Q_UNUSED(workspace) writer()->writeEndElement(); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/CMakeLists.txt0000644000175100017510000000704315154533055022613 0ustar runnerrunnerset(COMMON_SOURCES iarewfileversionproperty.cpp iarewfileversionproperty.h iarewgenerator.cpp iarewgenerator.h iarewgeneratorplugin.cpp iarewoptionpropertygroup.cpp iarewoptionpropertygroup.h iarewproject.cpp iarewproject.h iarewprojectwriter.cpp iarewprojectwriter.h iarewsettingspropertygroup.cpp iarewsettingspropertygroup.h iarewsourcefilepropertygroup.cpp iarewsourcefilepropertygroup.h iarewsourcefilespropertygroup.cpp iarewsourcefilespropertygroup.h iarewtoolchainpropertygroup.cpp iarewtoolchainpropertygroup.h iarewutils.cpp iarewutils.h iarewversioninfo.h iarewworkspace.cpp iarewworkspace.h iarewworkspacewriter.cpp iarewworkspacewriter.h ) set(ARCHS_ARM_SOURCES armarchiversettingsgroup_v8.cpp armarchiversettingsgroup_v8.h armassemblersettingsgroup_v8.cpp armassemblersettingsgroup_v8.h armbuildconfigurationgroup_v8.cpp armbuildconfigurationgroup_v8.h armcompilersettingsgroup_v8.cpp armcompilersettingsgroup_v8.h armgeneralsettingsgroup_v8.cpp armgeneralsettingsgroup_v8.h armlinkersettingsgroup_v8.cpp armlinkersettingsgroup_v8.h ) list_transform_prepend(ARCHS_ARM_SOURCES archs/arm/) set(ARCHS_AVR_SOURCES avrarchiversettingsgroup_v7.cpp avrarchiversettingsgroup_v7.h avrassemblersettingsgroup_v7.cpp avrassemblersettingsgroup_v7.h avrbuildconfigurationgroup_v7.cpp avrbuildconfigurationgroup_v7.h avrcompilersettingsgroup_v7.cpp avrcompilersettingsgroup_v7.h avrgeneralsettingsgroup_v7.cpp avrgeneralsettingsgroup_v7.h avrlinkersettingsgroup_v7.cpp avrlinkersettingsgroup_v7.h ) list_transform_prepend(ARCHS_AVR_SOURCES archs/avr/) set(ARCHS_MCS51_SOURCES mcs51archiversettingsgroup_v10.cpp mcs51archiversettingsgroup_v10.h mcs51assemblersettingsgroup_v10.cpp mcs51assemblersettingsgroup_v10.h mcs51buildconfigurationgroup_v10.cpp mcs51buildconfigurationgroup_v10.h mcs51compilersettingsgroup_v10.cpp mcs51compilersettingsgroup_v10.h mcs51generalsettingsgroup_v10.cpp mcs51generalsettingsgroup_v10.h mcs51linkersettingsgroup_v10.cpp mcs51linkersettingsgroup_v10.h ) list_transform_prepend(ARCHS_MCS51_SOURCES archs/mcs51/) set(ARCHS_STM8_SOURCES stm8archiversettingsgroup_v3.cpp stm8archiversettingsgroup_v3.h stm8assemblersettingsgroup_v3.cpp stm8assemblersettingsgroup_v3.h stm8buildconfigurationgroup_v3.cpp stm8buildconfigurationgroup_v3.h stm8compilersettingsgroup_v3.cpp stm8compilersettingsgroup_v3.h stm8generalsettingsgroup_v3.cpp stm8generalsettingsgroup_v3.h stm8linkersettingsgroup_v3.cpp stm8linkersettingsgroup_v3.h ) list_transform_prepend(ARCHS_STM8_SOURCES archs/stm8/) set(ARCHS_MSP430_SOURCES msp430archiversettingsgroup_v7.cpp msp430archiversettingsgroup_v7.h msp430assemblersettingsgroup_v7.cpp msp430assemblersettingsgroup_v7.h msp430buildconfigurationgroup_v7.cpp msp430buildconfigurationgroup_v7.h msp430compilersettingsgroup_v7.cpp msp430compilersettingsgroup_v7.h msp430generalsettingsgroup_v7.cpp msp430generalsettingsgroup_v7.h msp430linkersettingsgroup_v7.cpp msp430linkersettingsgroup_v7.h ) list_transform_prepend(ARCHS_MSP430_SOURCES archs/msp430/) add_qbs_plugin(iarewgenerator DEPENDS qbscore SOURCES ${COMMON_SOURCES} ${ARCHS_ARM_SOURCES} ${ARCHS_AVR_SOURCES} ${ARCHS_MCS51_SOURCES} ${ARCHS_STM8_SOURCES} ${ARCHS_MSP430_SOURCES} ) qbs-src-3.2.0/src/plugins/generator/iarew/iarewoptionpropertygroup.h0000644000175100017510000000366215154533055025451 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWOPTIONPROPERTYGROUP_H #define QBS_IAREWOPTIONPROPERTYGROUP_H #include //#include namespace qbs { class IarewOptionPropertyGroup final : public gen::xml::PropertyGroup { public: explicit IarewOptionPropertyGroup(const QByteArray &name, QVariantList states, int version = -1); }; } // namespace qbs #endif // QBS_IAREWOPTIONPROPERTYGROUP_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewsourcefilespropertygroup.h0000644000175100017510000000376215154533055026465 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWSOURCEFILESPROPERTYGROUP_H #define QBS_IAREWSOURCEFILESPROPERTYGROUP_H #include namespace qbs { class IarewSourceFilesPropertyGroup final : public gen::xml::PropertyGroup { public: explicit IarewSourceFilesPropertyGroup( const GeneratableProject &genProject, const QString &filesGroupName, const QList &sourceFiles); }; } // namespace qbs #endif // QBS_IAREWSOURCEFILESPROPERTYGROUP_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewsourcefilepropertygroup.cpp0000644000175100017510000000440515154533055026630 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "iarewsourcefilepropertygroup.h" #include "iarewutils.h" #include #include namespace qbs { IarewSourceFilePropertyGroup::IarewSourceFilePropertyGroup( const GeneratableProject &genProject, const ArtifactData &sourceArtifact) : gen::xml::PropertyGroup(QByteArrayLiteral("file")) { // Create file path property item. const QString fullFilePath = sourceArtifact.filePath(); const QString relativeFilePath = IarewUtils::projectRelativeFilePath( genProject.baseBuildDirectory().absolutePath(), fullFilePath); appendChild(QByteArrayLiteral("name"), relativeFilePath); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/iarewproject.cpp0000644000175100017510000001352515154533055023257 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "iarewfileversionproperty.h" #include "iarewproject.h" #include "iarewsourcefilespropertygroup.h" #include "iarewutils.h" #include "iarewversioninfo.h" #include "archs/arm/armbuildconfigurationgroup_v8.h" #include "archs/avr/avrbuildconfigurationgroup_v7.h" #include "archs/mcs51/mcs51buildconfigurationgroup_v10.h" #include "archs/stm8/stm8buildconfigurationgroup_v3.h" #include "archs/msp430/msp430buildconfigurationgroup_v7.h" #include #include namespace qbs { IarewProject::IarewProject(const GeneratableProject &genProject, const GeneratableProductData &genProduct, const gen::VersionInfo &versionInfo) { Q_ASSERT(genProject.projects.size() == genProject.commandLines.size()); Q_ASSERT(genProject.projects.size() == genProduct.data.size()); // Create available configuration group factories. m_factories.push_back(std::make_unique< iarew::arm::v8::ArmBuildConfigurationGroupFactory>()); m_factories.push_back(std::make_unique< iarew::avr::v7::AvrBuildConfigurationGroupFactory>()); m_factories.push_back(std::make_unique< iarew::mcs51::v10::Mcs51BuildConfigurationGroupFactory>()); m_factories.push_back(std::make_unique< iarew::stm8::v3::Stm8BuildConfigurationGroupFactory>()); m_factories.push_back(std::make_unique< iarew::msp430::v7::Msp430BuildConfigurationGroupFactory>()); // Construct file version item. appendChild(versionInfo); // Construct all build configurations items. const int configsCount = std::max(genProject.projects.size(), genProduct.data.size()); for (auto configIndex = 0; configIndex < configsCount; ++configIndex) { const qbs::Project qbsProject = genProject.projects .values().at(configIndex); const ProductData qbsProduct = genProduct.data.values().at(configIndex); const QString confName = gen::utils::buildConfigurationName(qbsProject); const std::vector qbsProductDeps = gen::utils::dependenciesOf (qbsProduct, genProject, confName); const auto arch = gen::utils::architecture(qbsProject); if (arch == gen::utils::Architecture::Unknown) throw ErrorInfo(Internal::Tr::tr("Target architecture is not set," " please use the 'profile' option")); // Construct the build configuration item, which are depend from // the architecture and the version. const auto factoryEnd = m_factories.cend(); const auto factoryIt = std::find_if( m_factories.cbegin(), factoryEnd, [arch, versionInfo](const auto &factory) { return factory->canCreate(arch, versionInfo.version()); }); if (factoryIt == factoryEnd) { throw ErrorInfo(Internal::Tr::tr("Incompatible target architecture '%1'" " for IAR EW version %2xxx") .arg(gen::utils::architectureName(arch)) .arg(versionInfo.marketingVersion())); } auto configGroup = (*factoryIt)->create( qbsProject, qbsProduct, qbsProductDeps); appendChild(std::move(configGroup)); } // Construct all file groups items. for (auto it = genProduct.data.cbegin(), end = genProduct.data.cend(); it != end; ++it) { const auto groups = it.value().groups(); for (const auto &group : groups) { // Ignore disabled groups (e.g. when its condition property is false). if (!group.isEnabled()) continue; auto sourceArtifacts = group.sourceArtifacts(); // Remove the linker script artifacts. Internal::removeIf(sourceArtifacts, [](const auto &artifact) { const auto tags = artifact.fileTags(); return tags.contains(QLatin1String("linkerscript")); }); if (sourceArtifacts.isEmpty()) continue; appendChild( genProject, group.name(), sourceArtifacts); } } } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/iarewfileversionproperty.cpp0000644000175100017510000000412115154533055025733 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "iarewfileversionproperty.h" #include "iarewversioninfo.h" namespace qbs { static QByteArray buildFileVersion(const gen::VersionInfo &versionInfo) { switch (versionInfo.marketingVersion()) { case 3: case 7: case 8: case 10: return QByteArrayLiteral("3"); default: return {}; } } IarewFileVersionProperty::IarewFileVersionProperty( const gen::VersionInfo &versionInfo) { setName(QByteArrayLiteral("fileVersion")); const QByteArray fileVersion = buildFileVersion(versionInfo); setValue(fileVersion); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/iarewversioninfo.h0000644000175100017510000000470515154533055023617 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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_IAREWVERSIONINFO_H #define QBS_IAREWVERSIONINFO_H #include #include namespace qbs { namespace IarewVersionInfo { constexpr gen::VersionInfo knownVersions[] = { {Version(8), {gen::utils::Architecture::Arm}}, {Version(7), {gen::utils::Architecture::Avr, gen::utils::Architecture::Msp430}}, {Version(10), {gen::utils::Architecture::Mcs51}}, {Version(3), {gen::utils::Architecture::Stm8}}, }; } // namespace IarewVersionInfo } // namespace qbs #endif // QBS_IAREWVERSIONINFO_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewoptionpropertygroup.cpp0000644000175100017510000000447315154533055026005 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "iarewoptionpropertygroup.h" namespace qbs { IarewOptionPropertyGroup::IarewOptionPropertyGroup( const QByteArray &name, QVariantList states, int version) : gen::xml::PropertyGroup(QByteArrayLiteral("option")) { // Append name property item. appendChild(QByteArrayLiteral("name"), name); // Append version property item. if (version >= 0) appendChild(QByteArrayLiteral("version"), version); // Append state property items. for (auto &state : states) { if (state.isNull()) continue; appendChild(QByteArrayLiteral("state"), std::move(state)); } } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/iarewprojectwriter.h0000644000175100017510000000375615154533055024166 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWPROJECTWRITER_H #define QBS_IAREWPROJECTWRITER_H #include namespace qbs { class IarewProjectWriter final : public gen::xml::ProjectWriter { Q_DISABLE_COPY(IarewProjectWriter) public: explicit IarewProjectWriter(std::ostream *device); private: void visitProjectStart(const gen::xml::Project *project) final; void visitProjectEnd(const gen::xml::Project *project) final; }; } // namespace qbs #endif // QBS_IAREWPROJECTWRITER_H qbs-src-3.2.0/src/plugins/generator/iarew/iarewgenerator.cpp0000644000175100017510000001312615154533055023574 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "iarewgenerator.h" #include "iarewproject.h" #include "iarewprojectwriter.h" #include "iarewworkspace.h" #include "iarewworkspacewriter.h" #include #include #include #include namespace qbs { static QString targetFilePath(const QString &baseName, const QString &baseBuildDirectory) { return QDir(baseBuildDirectory).absoluteFilePath( baseName + QStringLiteral(".ewp")); } static QString targetFilePath(const GeneratableProductData &product, const QString &baseBuildDirectory) { return targetFilePath(product.name(), baseBuildDirectory); } static void writeProjectFiles(const std::map> &projects, const Internal::Logger &logger) { for (const auto &item : projects) { const QString projectFilePath = item.first; Internal::FileSaver file(projectFilePath.toStdString()); if (!file.open()) throw ErrorInfo(Internal::Tr::tr("Cannot open %s for writing") .arg(projectFilePath)); std::shared_ptr project = item.second; IarewProjectWriter writer(file.device()); if (!(writer.write(project.get()) && file.commit())) throw ErrorInfo(Internal::Tr::tr("Failed to generate %1") .arg(projectFilePath)); logger.qbsInfo() << Internal::Tr::tr("Generated %1").arg( QFileInfo(projectFilePath).fileName()); } } static void writeWorkspace(const std::shared_ptr &wokspace, const QString &workspaceFilePath, const Internal::Logger &logger) { Internal::FileSaver file(workspaceFilePath.toStdString()); if (!file.open()) throw ErrorInfo(Internal::Tr::tr("Cannot open %s for writing") .arg(workspaceFilePath)); IarewWorkspaceWriter writer(file.device()); if (!(writer.write(wokspace.get()) && file.commit())) throw ErrorInfo(Internal::Tr::tr("Failed to generate %1") .arg(workspaceFilePath)); logger.qbsInfo() << Internal::Tr::tr("Generated %1").arg( QFileInfo(workspaceFilePath).fileName()); } IarewGenerator::IarewGenerator(const gen::VersionInfo &versionInfo) : m_versionInfo(versionInfo) { } QString IarewGenerator::generatorName() const { return QStringLiteral("iarew%1").arg(m_versionInfo.marketingVersion()); } void IarewGenerator::reset() { m_workspace.reset(); m_workspaceFilePath.clear(); m_projects.clear(); } void IarewGenerator::generate() { GeneratableProjectIterator it(project()); it.accept(this); writeProjectFiles(m_projects, logger()); writeWorkspace(m_workspace, m_workspaceFilePath, logger()); reset(); } void IarewGenerator::visitProject(const GeneratableProject &project) { const QDir buildDir = project.baseBuildDirectory(); m_workspaceFilePath = buildDir.absoluteFilePath( project.name() + QStringLiteral(".eww")); m_workspace = std::make_shared(m_workspaceFilePath); } void IarewGenerator::visitProjectData(const GeneratableProject &project, const GeneratableProjectData &projectData) { Q_UNUSED(project) Q_UNUSED(projectData) } void IarewGenerator::visitProduct(const GeneratableProject &project, const GeneratableProjectData &projectData, const GeneratableProductData &productData) { Q_UNUSED(projectData); const QString projectFilePath = targetFilePath( productData, project.baseBuildDirectory().absolutePath()); const auto targetProject = std::make_shared( project, productData, m_versionInfo); m_projects.insert({projectFilePath, targetProject}); m_workspace->addProject(projectFilePath); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/iarew.qbs0000644000175100017510000001102015154533055021657 0ustar runnerrunnerimport "../../qbsplugin.qbs" as QbsPlugin QbsPlugin { name: "iarewgenerator" files: ["iarewgeneratorplugin.cpp"] Group { name: "IAR EW generator common" files: [ "iarewfileversionproperty.cpp", "iarewfileversionproperty.h", "iarewgenerator.cpp", "iarewgenerator.h", "iarewoptionpropertygroup.cpp", "iarewoptionpropertygroup.h", "iarewproject.cpp", "iarewproject.h", "iarewprojectwriter.cpp", "iarewprojectwriter.h", "iarewsettingspropertygroup.cpp", "iarewsettingspropertygroup.h", "iarewsourcefilepropertygroup.cpp", "iarewsourcefilepropertygroup.h", "iarewsourcefilespropertygroup.cpp", "iarewsourcefilespropertygroup.h", "iarewtoolchainpropertygroup.cpp", "iarewtoolchainpropertygroup.h", "iarewutils.cpp", "iarewutils.h", "iarewversioninfo.h", "iarewworkspace.cpp", "iarewworkspace.h", "iarewworkspacewriter.cpp", "iarewworkspacewriter.h", ] } Group { name: "IAR EW generator for ARM" prefix: "archs/arm/" files: [ "armarchiversettingsgroup_v8.cpp", "armarchiversettingsgroup_v8.h", "armassemblersettingsgroup_v8.cpp", "armassemblersettingsgroup_v8.h", "armbuildconfigurationgroup_v8.cpp", "armbuildconfigurationgroup_v8.h", "armcompilersettingsgroup_v8.cpp", "armcompilersettingsgroup_v8.h", "armgeneralsettingsgroup_v8.cpp", "armgeneralsettingsgroup_v8.h", "armlinkersettingsgroup_v8.cpp", "armlinkersettingsgroup_v8.h", ] } Group { name: "IAR EW generator for AVR" prefix: "archs/avr/" files: [ "avrarchiversettingsgroup_v7.cpp", "avrarchiversettingsgroup_v7.h", "avrassemblersettingsgroup_v7.cpp", "avrassemblersettingsgroup_v7.h", "avrbuildconfigurationgroup_v7.cpp", "avrbuildconfigurationgroup_v7.h", "avrcompilersettingsgroup_v7.cpp", "avrcompilersettingsgroup_v7.h", "avrgeneralsettingsgroup_v7.cpp", "avrgeneralsettingsgroup_v7.h", "avrlinkersettingsgroup_v7.cpp", "avrlinkersettingsgroup_v7.h", ] } Group { name: "IAR EW generator for MCS51" prefix: "archs/mcs51/" files: [ "mcs51archiversettingsgroup_v10.cpp", "mcs51archiversettingsgroup_v10.h", "mcs51assemblersettingsgroup_v10.cpp", "mcs51assemblersettingsgroup_v10.h", "mcs51buildconfigurationgroup_v10.cpp", "mcs51buildconfigurationgroup_v10.h", "mcs51compilersettingsgroup_v10.cpp", "mcs51compilersettingsgroup_v10.h", "mcs51generalsettingsgroup_v10.cpp", "mcs51generalsettingsgroup_v10.h", "mcs51linkersettingsgroup_v10.cpp", "mcs51linkersettingsgroup_v10.h", ] } Group { name: "IAR EW generator for STM8" prefix: "archs/stm8/" files: [ "stm8archiversettingsgroup_v3.cpp", "stm8archiversettingsgroup_v3.h", "stm8assemblersettingsgroup_v3.cpp", "stm8assemblersettingsgroup_v3.h", "stm8buildconfigurationgroup_v3.cpp", "stm8buildconfigurationgroup_v3.h", "stm8compilersettingsgroup_v3.cpp", "stm8compilersettingsgroup_v3.h", "stm8generalsettingsgroup_v3.cpp", "stm8generalsettingsgroup_v3.h", "stm8linkersettingsgroup_v3.cpp", "stm8linkersettingsgroup_v3.h", ] } Group { name: "IAR EW generator for MSP430" prefix: "archs/msp430/" files: [ "msp430archiversettingsgroup_v7.cpp", "msp430archiversettingsgroup_v7.h", "msp430assemblersettingsgroup_v7.cpp", "msp430assemblersettingsgroup_v7.h", "msp430buildconfigurationgroup_v7.cpp", "msp430buildconfigurationgroup_v7.h", "msp430compilersettingsgroup_v7.cpp", "msp430compilersettingsgroup_v7.h", "msp430generalsettingsgroup_v7.cpp", "msp430generalsettingsgroup_v7.h", "msp430linkersettingsgroup_v7.cpp", "msp430linkersettingsgroup_v7.h", ] } } qbs-src-3.2.0/src/plugins/generator/iarew/archs/0000755000175100017510000000000015154533055021147 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/0000755000175100017510000000000015154533055021737 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/avrassemblersettingsgroup_v7.cpp0000644000175100017510000002003315154533055030401 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "avrassemblersettingsgroup_v7.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace avr { namespace v7 { constexpr int kAssemblerArchiveVersion = 5; constexpr int kAssemblerDataVersion = 11; namespace { // Language page options. struct LanguagePageOptions final { enum MacroQuoteCharacter { AngleBracketsQuote, RoundBracketsQuote, SquareBracketsQuote, FigureBracketsQuote }; explicit LanguagePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("assemblerFlags")}); enableSymbolsCaseSensitive = flags.contains(QLatin1String("-s+")); enableMultibyteSupport = flags.contains(QLatin1String("-n")); if (flags.contains(QLatin1String("-M<>"))) macroQuoteCharacter = LanguagePageOptions::AngleBracketsQuote; else if (flags.contains(QLatin1String("-M()"))) macroQuoteCharacter = LanguagePageOptions::RoundBracketsQuote; else if (flags.contains(QLatin1String("-M[]"))) macroQuoteCharacter = LanguagePageOptions::SquareBracketsQuote; else if (flags.contains(QLatin1String("-M{}"))) macroQuoteCharacter = LanguagePageOptions::FigureBracketsQuote; } MacroQuoteCharacter macroQuoteCharacter = AngleBracketsQuote; int enableSymbolsCaseSensitive = 0; int enableMultibyteSupport = 0; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { debugInfo = gen::utils::debugInformation(qbsProduct); } int debugInfo = 0; }; // Preprocessor page options. struct PreprocessorPageOptions final { explicit PreprocessorPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); defineSymbols = gen::utils::cppVariantModuleProperties( qbsProps, {QStringLiteral("defines")}); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); const QStringList fullIncludePaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("includePaths"), QStringLiteral("systemIncludePaths")}); for (const auto &fullIncludePath : fullIncludePaths) { const QFileInfo includeFileInfo(fullIncludePath); const QString includeFilePath = includeFileInfo.absoluteFilePath(); if (includeFilePath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, includeFilePath); includePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, includeFilePath); includePaths.push_back(path); } } } QVariantList defineSymbols; QVariantList includePaths; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString warningLevel = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("warningLevel")); if (warningLevel == QLatin1String("all")) { enableWarnings = 0; enableAllWarnings = 0; } else if (warningLevel == QLatin1String("none")) { enableWarnings = 1; enableAllWarnings = 0; } else { enableWarnings = 0; enableAllWarnings = 1; } } int enableWarnings = 0; int enableAllWarnings = 0; }; } // namespace // AvrAssemblerSettingsGroup AvrAssemblerSettingsGroup::AvrAssemblerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("AAVR")); setArchiveVersion(kAssemblerArchiveVersion); setDataVersion(kAssemblerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildLanguagePage(qbsProduct); buildOutputPage(qbsProduct); buildPreprocessorPage(buildRootDirectory, qbsProduct); buildDiagnosticsPage(qbsProduct); } void AvrAssemblerSettingsGroup::buildLanguagePage( const ProductData &qbsProduct) { const LanguagePageOptions opts(qbsProduct); // Add 'ACaseSensitivity' item (User symbols are case sensitive). addOptionsGroup(QByteArrayLiteral("ACaseSensitivity"), {opts.enableSymbolsCaseSensitive}); // Add 'AsmMultiByteSupport' item (Enable multibyte support). addOptionsGroup(QByteArrayLiteral("AsmMultiByteSupport"), {opts.enableMultibyteSupport}); // Add 'MacroChars' item (Macro quote characters: ()/[]/{}/<>). addOptionsGroup(QByteArrayLiteral("MacroChars"), {opts.macroQuoteCharacter}, 0); } void AvrAssemblerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'CDebug' item (Generate debug information). addOptionsGroup(QByteArrayLiteral("CDebug"), {opts.debugInfo}); } void AvrAssemblerSettingsGroup::buildPreprocessorPage( const QString &baseDirectory, const ProductData &qbsProduct) { const PreprocessorPageOptions opts(baseDirectory, qbsProduct); // Add 'ADefines' item (Defined symbols). addOptionsGroup(QByteArrayLiteral("ADefines"), opts.defineSymbols); // Add 'AUserIncludes' item (Additional include directories). addOptionsGroup(QByteArrayLiteral("ANewIncludes"), opts.includePaths); } void AvrAssemblerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'AWarnEnable' item (Enable/disable warnings). addOptionsGroup(QByteArrayLiteral("AWarnEnable"), {opts.enableWarnings}); // Add 'AWarnWhat' item (Enable/disable all warnings). addOptionsGroup(QByteArrayLiteral("AWarnWhat"), {opts.enableAllWarnings}); } } // namespace v7 } // namespace avr } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/avrlinkersettingsgroup_v7.cpp0000644000175100017510000003622515154533055027722 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "avrlinkersettingsgroup_v7.h" #include "../../iarewutils.h" #include namespace qbs { namespace iarew { namespace avr { namespace v7 { constexpr int kLinkerArchiveVersion = 3; constexpr int kLinkerDataVersion = 16; namespace { // Config page options. struct ConfigPageOptions final { explicit ConfigPageOptions(const QString &baseDirectory, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); entryPoint = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("entryPoint")); // Enumerate all product linker config files // (which are set trough 'linkerscript' tag). for (const auto &qbsGroup : qbsProduct.groups()) { const auto qbsArtifacts = qbsGroup.sourceArtifacts(); for (const auto &qbsArtifact : qbsArtifacts) { const auto qbsTags = qbsArtifact.fileTags(); if (!qbsTags.contains(QLatin1String("linkerscript"))) continue; const QString fullConfigPath = qbsArtifact.filePath(); if (fullConfigPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullConfigPath); configFilePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullConfigPath); configFilePaths.push_back(path); } } } // Enumerate all product linker config files // (which are set trough '-f' option). const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); const QVariantList configPathValues = IarewUtils::flagValues( flags, QStringLiteral("-f")); for (const QVariant &configPathValue : configPathValues) { const QString fullConfigPath = configPathValue.toString(); if (fullConfigPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullConfigPath); if (!configFilePaths.contains(path)) configFilePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullConfigPath); if (!configFilePaths.contains(path)) configFilePaths.push_back(path); } } // Add libraries search paths. const QStringList libraryPaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("libraryPaths")}); for (const QString &libraryPath : libraryPaths) { const QFileInfo libraryPathInfo(libraryPath); const QString fullLibrarySearchPath = libraryPathInfo.absoluteFilePath(); if (fullLibrarySearchPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullLibrarySearchPath); librarySearchPaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullLibrarySearchPath); librarySearchPaths.push_back(path); } } // Add static libraries paths. const QStringList staticLibrariesProps = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("staticLibraries")}); for (const QString &staticLibrary : staticLibrariesProps) { const QFileInfo staticLibraryInfo(staticLibrary); if (staticLibraryInfo.isAbsolute()) { const QString fullStaticLibraryPath = staticLibraryInfo.absoluteFilePath(); if (fullStaticLibraryPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullStaticLibraryPath); staticLibraries.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullStaticLibraryPath); staticLibraries.push_back(path); } } else { staticLibraries.push_back(staticLibrary); } } // Add static libraries from product dependencies. for (const ProductData &qbsProductDep : qbsProductDeps) { const QString depBinaryPath = QLatin1String("$PROJ_DIR$/") + gen::utils::targetBinaryPath(baseDirectory, qbsProductDep); staticLibraries.push_back(depBinaryPath); } } QVariantList configFilePaths; QVariantList librarySearchPaths; QVariantList staticLibraries; QString entryPoint; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { outputFile = gen::utils::targetBinary(qbsProduct); } QString outputFile; }; // List page options. struct ListPageOptions final { enum ListingAction { NoListing, GenerateListing }; explicit ListPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); generateMap = gen::utils::cppBooleanModuleProperty( qbsProps, QStringLiteral("generateLinkerMapFile")) ? ListPageOptions::GenerateListing : ListPageOptions::NoListing; } ListingAction generateMap = NoListing; }; // Define page options. struct DefinePageOptions final { explicit DefinePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); // Enumerate all linker defines. for (const QString &flag : flags) { if (!flag.startsWith(QLatin1String("-D"))) continue; const auto symbol = flag.mid(2); // Ignore system-defined macroses. if (symbol.startsWith(QLatin1String("_..X_HEAP_SIZE")) || symbol.startsWith(QLatin1String("_..X_TINY_HEAP_SIZE")) || symbol.startsWith(QLatin1String("_..X_NEAR_HEAP_SIZE")) || symbol.startsWith(QLatin1String("_..X_FAR_HEAP_SIZE")) || symbol.startsWith(QLatin1String("_..X_HUGE_HEAP_SIZE")) || symbol.startsWith(QLatin1String("_..X_CSTACK_SIZE")) || symbol.startsWith(QLatin1String("_..X_RSTACK_SIZE")) || symbol.startsWith(QLatin1String("_..X_FLASH_CODE_END")) || symbol.startsWith(QLatin1String("_..X_FLASH_BASE")) || symbol.startsWith(QLatin1String("_..X_CSTACK_BASE")) || symbol.startsWith(QLatin1String("_..X_CSTACK_END")) || symbol.startsWith(QLatin1String("_..X_RSTACK_BASE")) || symbol.startsWith(QLatin1String("_..X_RSTACK_END")) || symbol.startsWith(QLatin1String("_..X_EXT_SRAM_BASE")) || symbol.startsWith(QLatin1String("_..X_EXT_SRAM_SIZE")) || symbol.startsWith(QLatin1String("_..X_EXT_ROM_BASE")) || symbol.startsWith(QLatin1String("_..X_EXT_ROM_SIZE")) || symbol.startsWith(QLatin1String("_..X_EXT_NV_BASE")) || symbol.startsWith(QLatin1String("_..X_EXT_NV_SIZE")) || symbol.startsWith(QLatin1String("_..X_SRAM_BASE")) || symbol.startsWith(QLatin1String("_..X_SRAM_SIZE")) || symbol.startsWith(QLatin1String("_..X_RSTACK_BASE")) || symbol.startsWith(QLatin1String("_..X_RSTACK_SIZE")) ) { continue; } defineSymbols.push_back(symbol); } } QVariantList defineSymbols; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString warningLevel = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("warningLevel")); suppressAllWarnings = (warningLevel == QLatin1String("none")); } int suppressAllWarnings = 0; }; } // namespace // AvrLinkerSettingsGroup AvrLinkerSettingsGroup::AvrLinkerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { setName(QByteArrayLiteral("XLINK")); setArchiveVersion(kLinkerArchiveVersion); setDataVersion(kLinkerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildConfigPage(buildRootDirectory, qbsProduct, qbsProductDeps); buildOutputPage(qbsProduct); buildListPage(qbsProduct); buildDefinePage(qbsProduct); buildDiagnosticsPage(qbsProduct); // Should be called as latest stage! buildExtraOptionsPage(qbsProduct); } void AvrLinkerSettingsGroup::buildConfigPage( const QString &baseDirectory, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { ConfigPageOptions opts(baseDirectory, qbsProduct, qbsProductDeps); if (opts.configFilePaths.count() > 0) { // Note: IAR IDE does not allow to specify a multiple config files, // although the IAR linker support it. So, we use followig 'trick': // we take a first config file and to add it as usual to required items; // and then an other remainders we forward to the "Extra options page". const QVariant configPath = opts.configFilePaths.takeFirst(); // Add 'XclOverride' item (Override default). addOptionsGroup(QByteArrayLiteral("XclOverride"), {1}); // Add 'XclFile' item (Linke configuration file). addOptionsGroup(QByteArrayLiteral("XclFile"), {configPath}); // Add remainder configuration files to the "Extra options page". if (!opts.configFilePaths.isEmpty()) { for (QVariant &configPath : opts.configFilePaths) configPath = QString(QStringLiteral("-f ") + configPath.toString()); m_extraOptions << opts.configFilePaths; } } if (opts.staticLibraries.count() > 0) m_extraOptions << opts.staticLibraries; if (!opts.entryPoint.isEmpty()) { // Add 'xcProgramEntryLabel' item (Entry symbol). addOptionsGroup(QByteArrayLiteral("xcProgramEntryLabel"), {opts.entryPoint}); // Add 'xcOverrideProgramEntryLabel' item // (Override default program entry). addOptionsGroup(QByteArrayLiteral("xcOverrideProgramEntryLabel"), {1}); // Add 'xcProgramEntryLabelSelect' item. addOptionsGroup(QByteArrayLiteral("xcProgramEntryLabelSelect"), {0}); } // Add 'XIncludes' item (Libraries search paths). addOptionsGroup(QByteArrayLiteral("XIncludes"), opts.librarySearchPaths); } void AvrLinkerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'XOutOverride' item (Override default output file). addOptionsGroup(QByteArrayLiteral("XOutOverride"), {1}); // Add 'OutputFile' item (Output file name). addOptionsGroup(QByteArrayLiteral("OutputFile"), {opts.outputFile}); } void AvrLinkerSettingsGroup::buildListPage( const ProductData &qbsProduct) { const ListPageOptions opts(qbsProduct); // Add 'XList' item (Generate linker listing). addOptionsGroup(QByteArrayLiteral("XList"), {opts.generateMap}); } void AvrLinkerSettingsGroup::buildDefinePage( const ProductData &qbsProduct) { const DefinePageOptions opts(qbsProduct); // Add 'XDefines' item (Defined symbols). addOptionsGroup(QByteArrayLiteral("XDefines"), opts.defineSymbols); } void AvrLinkerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'SuppressAllWarn' item (Suppress all warnings). addOptionsGroup(QByteArrayLiteral("SuppressAllWarn"), {opts.suppressAllWarnings}); } void AvrLinkerSettingsGroup::buildExtraOptionsPage(const ProductData &qbsProduct) { Q_UNUSED(qbsProduct) if (!m_extraOptions.isEmpty()) { // Add 'XExtraOptionsCheck' (Use command line options). addOptionsGroup(QByteArrayLiteral("XExtraOptionsCheck"), {1}); // Add 'XExtraOptions' item (Command line options). addOptionsGroup(QByteArrayLiteral("XExtraOptions"), m_extraOptions); } } } // namespace v7 } // namespace avr } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/avrassemblersettingsgroup_v7.h0000644000175100017510000000467715154533055030066 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWAVRASSEMBLERSETTINGSGROUP_V7_H #define QBS_IAREWAVRASSEMBLERSETTINGSGROUP_V7_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace avr { namespace v7 { class AvrAssemblerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit AvrAssemblerSettingsGroup(const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildLanguagePage(const ProductData &qbsProduct); void buildOutputPage(const ProductData &qbsProduct); void buildPreprocessorPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); }; } // namespace v7 } // namespace avr } // namespace iarew } // namespace qbs #endif // QBS_IAREWAVRASSEMBLERSETTINGSGROUP_V7_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/avrarchiversettingsgroup_v7.h0000644000175100017510000000437215154533055027704 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWAVRARCHIVERSETTINGSGROUP_V7_H #define QBS_IAREWAVRARCHIVERSETTINGSGROUP_V7_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace avr { namespace v7 { class AvrArchiverSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit AvrArchiverSettingsGroup(const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct); }; } // namespace v7 } // namespace avr } // namespace iarew } // namespace qbs #endif // QBS_IAREWAVRARCHIVERSETTINGSGROUP_V7_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/avrbuildconfigurationgroup_v7.h0000644000175100017510000000514715154533055030210 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWAVRBUILDCONFIGURATIONGROUP_V7_H #define QBS_IAREWAVRBUILDCONFIGURATIONGROUP_V7_H #include #include namespace qbs { namespace iarew { namespace avr { namespace v7 { class AvrBuildConfigurationGroup final : public gen::xml::PropertyGroup { private: explicit AvrBuildConfigurationGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); friend class AvrBuildConfigurationGroupFactory; }; class AvrBuildConfigurationGroupFactory final : public gen::xml::PropertyGroupFactory { public: bool canCreate(gen::utils::Architecture arch, const Version &version) const final; std::unique_ptr create( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) const final; }; } // namespace v7 } // namespace avr } // namespace iarew } // namespace qbs #endif // QBS_IAREWAVRBUILDCONFIGURATIONGROUP_V7_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/avrlinkersettingsgroup_v7.h0000644000175100017510000000517515154533055027367 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWAVRLINKERSETTINGSGROUP_V7_H #define QBS_IAREWAVRLINKERSETTINGSGROUP_V7_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace avr { namespace v7 { class AvrLinkerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit AvrLinkerSettingsGroup(const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildConfigPage(const QString &baseDirectory, const ProductData &qbsProduct, const std::vector &qbsProductDeps); void buildOutputPage(const ProductData &qbsProduct); void buildListPage(const ProductData &qbsProduct); void buildDefinePage(const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); void buildExtraOptionsPage(const ProductData &qbsProduct); QVariantList m_extraOptions; }; } // namespace v7 } // namespace avr } // namespace iarew } // namespace qbs #endif // QBS_IAREWAVRLINKERSETTINGSGROUP_V7_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/avrgeneralsettingsgroup_v7.cpp0000644000175100017510000006645515154533055030063 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "avrgeneralsettingsgroup_v7.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace avr { namespace v7 { constexpr int kGeneralArchiveVersion = 12; constexpr int kGeneralDataVersion = 10; namespace { struct TargetMcuEntry final { QByteArray targetName; QByteArray targetFlag; }; // Dictionary of known AVR MCU's and its compiler options. const TargetMcuEntry mcusDict[] = { {"AT43USB320A", "at43usb320a"}, {"AT43USB325", "at43usb325"}, {"AT43USB326", "at43usb326"}, {"AT43USB351M", "at43usb351m"}, {"AT43USB353M", "at43usb353m"}, {"AT43USB355", "at43usb355"}, {"AT76C712", "at76c712"}, {"AT76C713", "at76c713"}, {"AT86RF401", "at86rf401"}, {"AT90CAN128", "can128"}, {"AT90CAN32", "can32"}, {"AT90CAN64", "can64"}, {"AT90PWM1", "pwm1"}, {"AT90PWM161", "pwm161"}, {"AT90PWM2", "pwm2"}, {"AT90PWM216", "pwm216"}, {"AT90PWM2B", "pwm2b"}, {"AT90PWM3", "pwm3"}, {"AT90PWM316", "pwm316"}, {"AT90PWM3B", "pwm3b"}, {"AT90PWM81", "pwm81"}, {"AT90S1200", "1200"}, {"AT90S2313", "2313"}, {"AT90S2323", "2323"}, {"AT90S2333", "2333"}, {"AT90S2343", "2343"}, {"AT90S4414", "4414"}, {"AT90S4433", "4433"}, {"AT90S4434", "4434"}, {"AT90S8515", "8515"}, {"AT90S8534", "8534"}, {"AT90S8535", "8535"}, {"AT90SCR050", "scr050"}, {"AT90SCR075", "scr075"}, {"AT90SCR100", "scr100"}, {"AT90SCR200", "scr200"}, {"AT90SCR400", "scr400"}, {"AT90USB128", "usb128"}, {"AT90USB1286", "usb1286"}, {"AT90USB1287", "usb1287"}, {"AT90USB162", "usb162"}, {"AT90USB64", "usb64"}, {"AT90USB646", "usb646"}, {"AT90USB647", "usb647"}, {"AT90USB82", "usb82"}, {"AT94Kxx", "at94k"}, {"ATA5272", "ata5272"}, {"ATA5505", "ata5505"}, {"ATA5700M322", "ata5700m322"}, {"ATA5702M322", "ata5702m322"}, {"ATA5781", "ata5781"}, {"ATA5782", "ata5782"}, {"ATA5783", "ata5783"}, {"ATA5785", "ata5785"}, {"ATA5787", "ata5787"}, {"ATA5790", "ata5790"}, {"ATA5790N", "ata5790n"}, {"ATA5795", "ata5795"}, {"ATA5830", "ata5830"}, {"ATA5831", "ata5831"}, {"ATA5832", "ata5832"}, {"ATA5833", "ata5833"}, {"ATA5835", "ata5835"}, {"ATA6285", "ata6285"}, {"ATA6286", "ata6286"}, {"ATA6289", "ata6289"}, {"ATA8210", "ata8210"}, {"ATA8215", "ata8215"}, {"ATA8510", "ata8510"}, {"ATA8515", "ata8515"}, {"ATmX224E", "mx224e"}, {"ATmXT112SL", "mxt112sl"}, {"ATmXT224", "mxt224"}, {"ATmXT224E", "mxt224e"}, {"ATmXT336S", "mxt336s"}, {"ATmXT540S", "mxt540s"}, {"ATmXT540S_RevA", "mxt540s_reva"}, {"ATmXTS200", "mxts200"}, {"ATmXTS220", "mxts220"}, {"ATmXTS220E", "mxts220e"}, {"ATmega007", "m007"}, {"ATmega103", "m103"}, {"ATmega128", "m128"}, {"ATmega1280", "m1280"}, {"ATmega1281", "m1281"}, {"ATmega1284", "m1284"}, {"ATmega1284P", "m1284p"}, {"ATmega1284RFR2", "m1284rfr2"}, {"ATmega128A", "m128a"}, {"ATmega128RFA1", "m128rfa1"}, {"ATmega128RFA2", "m128rfa2"}, {"ATmega128RFR2", "m128rfr2"}, {"ATmega16", "m16"}, {"ATmega1608", "m1608"}, {"ATmega1609", "m1609"}, {"ATmega161", "m161"}, {"ATmega162", "m162"}, {"ATmega163", "m163"}, {"ATmega164", "m164"}, {"ATmega164A", "m164a"}, {"ATmega164P", "m164p"}, {"ATmega164PA", "m164pa"}, {"ATmega165", "m165"}, {"ATmega165A", "m165a"}, {"ATmega165P", "m165p"}, {"ATmega165PA", "m165pa"}, {"ATmega168", "m168"}, {"ATmega168A", "m168a"}, {"ATmega168P", "m168p"}, {"ATmega168PA", "m168pa"}, {"ATmega168PB", "m168pb"}, {"ATmega169", "m169"}, {"ATmega169A", "m169a"}, {"ATmega169P", "m169p"}, {"ATmega169PA", "m169pa"}, {"ATmega16A", "m16a"}, {"ATmega16HVA", "m16hva"}, {"ATmega16HVA2", "m16hva2"}, {"ATmega16HVB", "m16hvb"}, {"ATmega16M1", "m16m1"}, {"ATmega16U2", "m16u2"}, {"ATmega16U4", "m16u4"}, {"ATmega2560", "m2560"}, {"ATmega2561", "m2561"}, {"ATmega2564RFR2", "m2564rfr2"}, {"ATmega256RFA2", "m256rfa2"}, {"ATmega256RFR2", "m256rfr2"}, {"ATmega26HVG", "m26hvg"}, {"ATmega32", "m32"}, {"ATmega3208", "m3208"}, {"ATmega3209", "m3209"}, {"ATmega323", "m323"}, {"ATmega324", "m324"}, {"ATmega324A", "m324a"}, {"ATmega324P", "m324p"}, {"ATmega324PA", "m324pa"}, {"ATmega324PB", "m324pb"}, {"ATmega325", "m325"}, {"ATmega3250", "m3250"}, {"ATmega3250A", "m3250a"}, {"ATmega3250P", "m3250p"}, {"ATmega3250PA", "m3250pa"}, {"ATmega325A", "m325a"}, {"ATmega325P", "m325p"}, {"ATmega325PA", "m325pa"}, {"ATmega328", "m328"}, {"ATmega328P", "m328p"}, {"ATmega328PB", "m328pb"}, {"ATmega329", "m329"}, {"ATmega3290", "m3290"}, {"ATmega3290A", "m3290a"}, {"ATmega3290P", "m3290p"}, {"ATmega3290PA", "m3290pa"}, {"ATmega329A", "m329a"}, {"ATmega329P", "m329p"}, {"ATmega329PA", "m329pa"}, {"ATmega32A", "m32a"}, {"ATmega32C1", "m32c1"}, {"ATmega32HVB", "m32hvb"}, {"ATmega32M1", "m32m1"}, {"ATmega32U2", "m32u2"}, {"ATmega32U4", "m32u4"}, {"ATmega32U6", "m32u6"}, {"ATmega406", "m406"}, {"ATmega48", "m48"}, {"ATmega4808", "m4808"}, {"ATmega4809", "m4809"}, {"ATmega48A", "m48a"}, {"ATmega48HVF", "m48hvf"}, {"ATmega48P", "m48p"}, {"ATmega48PA", "m48pa"}, {"ATmega48PB", "m48pb"}, {"ATmega4HVD", "m4hvd"}, {"ATmega603", "m603"}, {"ATmega64", "m64"}, {"ATmega640", "m640"}, {"ATmega644", "m644"}, {"ATmega644A", "m644a"}, {"ATmega644P", "m644p"}, {"ATmega644PA", "m644pa"}, {"ATmega644RFR2", "m644rfr2"}, {"ATmega645", "m645"}, {"ATmega6450", "m6450"}, {"ATmega6450A", "m6450a"}, {"ATmega6450P", "m6450p"}, {"ATmega645A", "m645a"}, {"ATmega645P", "m645p"}, {"ATmega649", "m649"}, {"ATmega6490", "m6490"}, {"ATmega6490A", "m6490a"}, {"ATmega6490P", "m6490p"}, {"ATmega649A", "m649a"}, {"ATmega649P", "m649p"}, {"ATmega64A", "m64a"}, {"ATmega64C1", "m64c1"}, {"ATmega64HVE", "m256rfa2"}, {"ATmega64HVE", "m64hve"}, {"ATmega64HVE2", "m64hve2"}, {"ATmega64M1", "m64m1"}, {"ATmega64RFA2", "m64rfa2"}, {"ATmega64RFR2", "m64rfr2"}, {"ATmega8", "m8"}, {"ATmega808", "m808"}, {"ATmega809", "m809"}, {"ATmega83", "m83"}, {"ATmega8515", "m8515"}, {"ATmega8535", "m8535"}, {"ATmega88", "m88"}, {"ATmega88A", "m88a"}, {"ATmega88P", "m88p"}, {"ATmega88PA", "m88pa"}, {"ATmega88PB", "m88pb"}, {"ATmega8A", "m8a"}, {"ATmega8HVA", "m8hva"}, {"ATmega8HVD", "m8hvd"}, {"ATmega8U2", "m8u2"}, {"ATtiny10", "tiny10"}, {"ATtiny102", "tiny102"}, {"ATtiny104", "tiny104"}, {"ATtiny11", "tiny11"}, {"ATtiny12", "tiny12"}, {"ATtiny13", "tiny13"}, {"ATtiny13A", "tiny13a"}, {"ATtiny15", "tiny15"}, {"ATtiny1604", "tiny1604"}, {"ATtiny1606", "tiny1606"}, {"ATtiny1607", "tiny1607"}, {"ATtiny1614", "tiny1614"}, {"ATtiny1616", "tiny1616"}, {"ATtiny1617", "tiny1617"}, {"ATtiny1634", "tiny1634"}, {"ATtiny167", "tiny167"}, {"ATtiny20", "tiny20"}, {"ATtiny202", "tiny202"}, {"ATtiny204", "tiny204"}, {"ATtiny212", "tiny212"}, {"ATtiny214", "tiny214"}, {"ATtiny22", "tiny22"}, {"ATtiny2313", "tiny2313"}, {"ATtiny2313A", "tiny2313a"}, {"ATtiny23U", "tiny23u"}, {"ATtiny24", "tiny24"}, {"ATtiny24A", "tiny24a"}, {"ATtiny25", "tiny25"}, {"ATtiny26", "tiny26"}, {"ATtiny261", "tiny261"}, {"ATtiny261A", "tiny261a"}, {"ATtiny28", "tiny28"}, {"ATtiny3214", "tiny3214"}, {"ATtiny3216", "tiny3216"}, {"ATtiny3217", "tiny3217"}, {"ATtiny4", "tiny4"}, {"ATtiny40", "tiny40"}, {"ATtiny402", "tiny402"}, {"ATtiny404", "tiny404"}, {"ATtiny406", "tiny406"}, {"ATtiny412", "tiny412"}, {"ATtiny414", "tiny414"}, {"ATtiny416", "tiny416"}, {"ATtiny417", "tiny417"}, {"ATtiny4313", "tiny4313"}, {"ATtiny43U", "tiny43u"}, {"ATtiny44", "tiny44"}, {"ATtiny441", "tiny441"}, {"ATtiny44A", "tiny44a"}, {"ATtiny45", "tiny45"}, {"ATtiny461", "tiny461"}, {"ATtiny461A", "tiny461a"}, {"ATtiny474", "tiny474"}, {"ATtiny48", "tiny48"}, {"ATtiny5", "tiny5"}, {"ATtiny80", "tiny80"}, {"ATtiny804", "tiny804"}, {"ATtiny806", "tiny806"}, {"ATtiny807", "tiny807"}, {"ATtiny80_pre_2015", "tiny80_pre_2015"}, {"ATtiny814", "tiny814"}, {"ATtiny816", "tiny816"}, {"ATtiny817", "tiny817"}, {"ATtiny828", "tiny828"}, {"ATtiny84", "tiny84"}, {"ATtiny840", "tiny840"}, {"ATtiny841", "tiny841"}, {"ATtiny84A", "tiny84a"}, {"ATtiny85", "tiny85"}, {"ATtiny861", "tiny861"}, {"ATtiny861A", "tiny861a"}, {"ATtiny87", "tiny87"}, {"ATtiny88", "tiny88"}, {"ATtiny9", "tiny9"}, {"ATxmega128A1", "xm128a1"}, {"ATxmega128A1U", "xm128a1u"}, {"ATxmega128A3", "xm128a3"}, {"ATxmega128A3U", "xm128a3u"}, {"ATxmega128A4", "xm128a4"}, {"ATxmega128A4U", "xm128a4u"}, {"ATxmega128B1", "xm128b1"}, {"ATxmega128B3", "xm128b3"}, {"ATxmega128C3", "xm128c3"}, {"ATxmega128D3", "xm128d3"}, {"ATxmega128D4", "xm128d4"}, {"ATxmega16A4", "xm16a4"}, {"ATxmega16A4U", "xm16a4u"}, {"ATxmega16C4", "xm16c4"}, {"ATxmega16D4", "xm16d4"}, {"ATxmega16E5", "xm16e5"}, {"ATxmega192A1", "xm192a1"}, {"ATxmega192A3", "xm192a3"}, {"ATxmega192A3U", "xm192a3u"}, {"ATxmega192C3", "xm192c3"}, {"ATxmega192D3", "xm192d3"}, {"ATxmega256A1", "xm256a1"}, {"ATxmega256A3", "xm256a3"}, {"ATxmega256A3B", "xm256a3b"}, {"ATxmega256A3BU", "xm256a3bu"}, {"ATxmega256A3U", "xm256a3u"}, {"ATxmega256B1", "xm256b1"}, {"ATxmega256C3", "xm256c3"}, {"ATxmega256D3", "xm256d3"}, {"ATxmega32A4", "xm32a4"}, {"ATxmega32A4U", "xm32a4u"}, {"ATxmega32C3", "xm32c3"}, {"ATxmega32C4", "xm32c4"}, {"ATxmega32D3", "xm32d3"}, {"ATxmega32D4", "xm32d4"}, {"ATxmega32D4P", "xm32d4p"}, {"ATxmega32E5", "xm32e5"}, {"ATxmega32X1", "xm32x1"}, {"ATxmega384A1", "xm384a1"}, {"ATxmega384C3", "xm384c3"}, {"ATxmega384D3", "xm384d3"}, {"ATxmega64A1", "xm64a1"}, {"ATxmega64A1U", "xm64a1u"}, {"ATxmega64A3", "xm64a3"}, {"ATxmega64A3U", "xm64a3u"}, {"ATxmega64A4", "xm64a4"}, {"ATxmega64A4U", "xm64a4u"}, {"ATxmega64B1", "xm64b1"}, {"ATxmega64B3", "xm64b3"}, {"ATxmega64C3", "xm64c3"}, {"ATxmega64D3", "xm64d3"}, {"ATxmega64D4", "xm64d4"}, {"ATxmega8E5", "xm8e5"}, {"M3000", "m3000"}, {"MaxBSE", "maxbse"}, }; // Target page options. struct TargetPageOptions final { enum MemoryModel { TinyModel, SmallModel, LargeModel, HugeModel }; explicit TargetPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("driverFlags")}); // Detect target MCU record. const QString mcuValue = IarewUtils::flagValue( flags, QStringLiteral("--cpu")).toLower(); targetMcu = mcuStringFromFlagValue(mcuValue); // Detect target memory model. const QString modelValue = IarewUtils::flagValue( flags, QStringLiteral("-m")); if (modelValue == QLatin1Char('t')) memoryModel = TargetPageOptions::TinyModel; else if (modelValue == QLatin1Char('s')) memoryModel = TargetPageOptions::SmallModel; else if (modelValue == QLatin1Char('l')) memoryModel = TargetPageOptions::LargeModel; else if (modelValue == QLatin1Char('h')) memoryModel = TargetPageOptions::HugeModel; // Detect target EEPROM util size. eepromUtilSize = IarewUtils::flagValue( flags, QStringLiteral("--eeprom_size")).toInt(); } static QString mcuStringFromFlagValue(const QString &mcuValue) { const auto targetBegin = std::cbegin(mcusDict); const auto targetEnd = std::cend(mcusDict); const auto targetIt = std::find_if(targetBegin, targetEnd, [mcuValue]( const TargetMcuEntry &entry) { return entry.targetFlag == mcuValue.toLatin1(); }); if (targetIt != targetEnd) { return QStringLiteral("%1\t%2") .arg(QString::fromLatin1(targetIt->targetFlag), QString::fromLatin1(targetIt->targetName)); } return {}; } QString targetMcu; MemoryModel memoryModel = TinyModel; int eepromUtilSize = 0; }; // System page options. struct SystemPageOptions final { explicit SystemPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("driverLinkerFlags"), QStringLiteral("defines")}); cstackSize = IarewUtils::flagValue( flags, QStringLiteral("_..X_CSTACK_SIZE")).toInt(); rstackSize = IarewUtils::flagValue( flags, QStringLiteral("_..X_RSTACK_SIZE")).toInt(); } int cstackSize = 0; int rstackSize = 0; }; // Library options page options. struct LibraryOptionsPageOptions final { enum PrintfFormatter { PrintfAutoFormatter = 0, PrintfFullFormatter = 1, PrintfFullNoMultibytesFormatter = 2, PrintfLargeFormatter = 3, PrintfLargeNoMultibytesFormatter = 4, PrintfSmallFormatter = 6, PrintfSmallNoMultibytesFormatter = 7, PrintfTinyFormatter = 8 }; enum ScanfFormatter { ScanfAutoFormatter = 0, ScanfFullFormatter = 1, ScanfFullNoMultibytesFormatter = 2, ScanfLargeFormatter = 3, ScanfLargeNoMultibytesFormatter = 4, ScanfSmallFormatter = 6, ScanfSmallNoMultibytesFormatter = 7 }; explicit LibraryOptionsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); for (const QString &flag : flags) { if (flag.endsWith(QLatin1String("_printf"), Qt::CaseInsensitive)) { const QString prop = flag.split(QLatin1Char('=')).at(0).toLower(); if (prop == QLatin1String("-e_printffull")) printfFormatter = LibraryOptionsPageOptions::PrintfFullFormatter; else if (prop == QLatin1String("-e_printffullnomb")) printfFormatter = LibraryOptionsPageOptions::PrintfFullNoMultibytesFormatter; else if (prop == QLatin1String("-e_printflarge")) printfFormatter = LibraryOptionsPageOptions::PrintfLargeFormatter; else if (prop == QLatin1String("-e_printflargenomb")) printfFormatter = LibraryOptionsPageOptions::PrintfLargeNoMultibytesFormatter; else if (prop == QLatin1String("-e_printfsmall")) printfFormatter = LibraryOptionsPageOptions::PrintfSmallFormatter; else if (prop == QLatin1String("-e_printfsmallnomb")) printfFormatter = LibraryOptionsPageOptions::PrintfSmallNoMultibytesFormatter; else if (prop == QLatin1String("-printftiny")) printfFormatter = LibraryOptionsPageOptions::PrintfTinyFormatter; } else if (flag.endsWith(QLatin1String("_scanf"), Qt::CaseInsensitive)) { const QString prop = flag.split(QLatin1Char('=')).at(0).toLower(); if (prop == QLatin1String("-e_scanffull")) scanfFormatter = LibraryOptionsPageOptions::ScanfFullFormatter; else if (prop == QLatin1String("-e_scanffullnomb")) scanfFormatter = LibraryOptionsPageOptions::ScanfFullNoMultibytesFormatter; else if (prop == QLatin1String("-e_scanflarge")) scanfFormatter = LibraryOptionsPageOptions::ScanfLargeFormatter; else if (prop == QLatin1String("-e_scanflargenomb")) scanfFormatter = LibraryOptionsPageOptions::ScanfLargeNoMultibytesFormatter; else if (prop == QLatin1String("-e_scanfsmall")) scanfFormatter = LibraryOptionsPageOptions::ScanfSmallFormatter; else if (prop == QLatin1String("-e_scanfsmallnomb")) scanfFormatter = LibraryOptionsPageOptions::ScanfSmallNoMultibytesFormatter; } } } PrintfFormatter printfFormatter = PrintfAutoFormatter; ScanfFormatter scanfFormatter = ScanfAutoFormatter; }; // Library configuration page options. struct LibraryConfigPageOptions final { enum RuntimeLibrary { NoLibrary, NormalDlibLibrary, FullDlibLibrary, CustomDlibLibrary, ClibLibrary, CustomClibLibrary, ThirdPartyLibrary }; explicit LibraryConfigPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); const QStringList libraryPaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("staticLibraries")}); const auto libraryBegin = libraryPaths.cbegin(); const auto libraryEnd = libraryPaths.cend(); if (flags.contains(QLatin1String("--dlib"))) { const QString dlibToolkitPath = IarewUtils::dlibToolkitRootPath(qbsProduct); const QFileInfo configInfo(IarewUtils::flagValue( flags, QStringLiteral("--dlib_config"))); const QString configFilePath = configInfo.absoluteFilePath(); if (configFilePath.startsWith(dlibToolkitPath, Qt::CaseInsensitive)) { if (configFilePath.endsWith(QLatin1String("-n.h"), Qt::CaseInsensitive)) { libraryType = LibraryConfigPageOptions::NormalDlibLibrary; } else if (configFilePath.endsWith(QLatin1String("-f.h"), Qt::CaseInsensitive)) { libraryType = LibraryConfigPageOptions::FullDlibLibrary; } else { libraryType = LibraryConfigPageOptions::CustomDlibLibrary; } configPath = IarewUtils::toolkitRelativeFilePath( baseDirectory, configFilePath); // Find dlib library inside of IAR toolkit directory. const auto libraryIt = std::find_if(libraryBegin, libraryEnd, [dlibToolkitPath]( const QString &libraryPath) { return libraryPath.startsWith(dlibToolkitPath); }); if (libraryIt != libraryEnd) { // This means that dlib library is 'standard' (placed inside // of IAR toolkit directory). libraryPath = IarewUtils::toolkitRelativeFilePath( baseDirectory, *libraryIt); } } else { // This means that dlib library is 'custom' // (but we don't know its path). libraryType = LibraryConfigPageOptions::CustomDlibLibrary; configPath = IarewUtils::projectRelativeFilePath( baseDirectory, configFilePath); } } else if (flags.contains(QLatin1String("--clib"))) { const QString clibToolkitPath = IarewUtils::clibToolkitRootPath(qbsProduct); // Find clib library inside of IAR toolkit directory. const auto libraryIt = std::find_if(libraryBegin, libraryEnd, [clibToolkitPath]( const QString &libraryPath) { return libraryPath.startsWith(clibToolkitPath); }); if (libraryIt != libraryEnd) { // This means that clib library is 'standard' (placed inside // of IAR toolkit directory). libraryType = LibraryConfigPageOptions::ClibLibrary; libraryPath = IarewUtils::toolkitRelativeFilePath( baseDirectory, *libraryIt); } else { // This means that clib library is 'custom' // (but we don't know its path). libraryType = LibraryConfigPageOptions::CustomClibLibrary; } } else { libraryType = LibraryConfigPageOptions::NoLibrary; } } RuntimeLibrary libraryType = NoLibrary; QString configPath; QString libraryPath; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { binaryType = IarewUtils::outputBinaryType(qbsProduct); binaryDirectory = gen::utils::binaryOutputDirectory( baseDirectory, qbsProduct); objectDirectory = gen::utils::objectsOutputDirectory( baseDirectory, qbsProduct); listingDirectory = gen::utils::listingOutputDirectory( baseDirectory, qbsProduct); } IarewUtils::OutputBinaryType binaryType = IarewUtils::ApplicationOutputType; QString binaryDirectory; QString objectDirectory; QString listingDirectory; }; } // namespace // AvrGeneralSettingsGroup AvrGeneralSettingsGroup::AvrGeneralSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("General")); setArchiveVersion(kGeneralArchiveVersion); setDataVersion(kGeneralDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildTargetPage(qbsProduct); buildSystemPage(qbsProduct); buildLibraryOptionsPage(qbsProduct); buildLibraryConfigPage(buildRootDirectory, qbsProduct); buildOutputPage(buildRootDirectory, qbsProduct); } void AvrGeneralSettingsGroup::buildTargetPage( const ProductData &qbsProduct) { const TargetPageOptions opts(qbsProduct); // Add 'GenDeviceSelectMenu' item // (Processor configuration chooser). addOptionsGroup(QByteArrayLiteral("GenDeviceSelectMenu"), {opts.targetMcu}); // Add 'Variant Memory' item // (Memory model: tiny/small/large/huge). addOptionsGroup(QByteArrayLiteral("Variant Memory"), {opts.memoryModel}); // Add 'GGEepromUtilSize' item // (Utilize inbuilt EEPROM size, in bytes). addOptionsGroup(QByteArrayLiteral("GGEepromUtilSize"), {opts.eepromUtilSize}); } void AvrGeneralSettingsGroup::buildSystemPage( const ProductData &qbsProduct) { const SystemPageOptions opts (qbsProduct); // Add 'SCCStackSize' item (Data stack // - CSTACK size in bytes). addOptionsGroup(QByteArrayLiteral("SCCStackSize"), {opts.cstackSize}); // Add 'SCRStackSize' item (Return address stack // - RSTACK depth in bytes). addOptionsGroup(QByteArrayLiteral("SCRStackSize"), {opts.rstackSize}); } void AvrGeneralSettingsGroup::buildLibraryOptionsPage( const ProductData &qbsProduct) { const LibraryOptionsPageOptions opts(qbsProduct); // Add 'Output variant' item (Printf formatter). addOptionsGroup(QByteArrayLiteral("Output variant"), {opts.printfFormatter}); // Add 'Input variant' item (Printf formatter). addOptionsGroup(QByteArrayLiteral("Input variant"), {opts.scanfFormatter}); } void AvrGeneralSettingsGroup::buildLibraryConfigPage( const QString &baseDirectory, const ProductData &qbsProduct) { const LibraryConfigPageOptions opts(baseDirectory, qbsProduct); // Add 'GRuntimeLibSelect' and 'GRuntimeLibSelectSlave' items // (Link with runtime: none/dlib/clib/etc). addOptionsGroup(QByteArrayLiteral("GRuntimeLibSelect"), {opts.libraryType}); addOptionsGroup(QByteArrayLiteral("GRuntimeLibSelectSlave"), {opts.libraryType}); // Add 'RTConfigPath' item (Runtime configuration file). addOptionsGroup(QByteArrayLiteral("RTConfigPath"), {opts.configPath}); // Add 'RTLibraryPath' item (Runtime library file). addOptionsGroup(QByteArrayLiteral("RTLibraryPath"), {opts.libraryPath}); } void AvrGeneralSettingsGroup::buildOutputPage( const QString &baseDirectory, const ProductData &qbsProduct) { const OutputPageOptions opts(baseDirectory, qbsProduct); // Add 'GOutputBinary' item (Output file: executable/library). addOptionsGroup(QByteArrayLiteral("GOutputBinary"), {opts.binaryType}); // Add 'ExePath' item (Executable/binaries output directory). addOptionsGroup(QByteArrayLiteral("ExePath"), {opts.binaryDirectory}); // Add 'ObjPath' item (Object files output directory). addOptionsGroup(QByteArrayLiteral("ObjPath"), {opts.objectDirectory}); // Add 'ListPath' item (List files output directory). addOptionsGroup(QByteArrayLiteral("ListPath"), {opts.listingDirectory}); } } // namespace v7 } // namespace avr } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/avrarchiversettingsgroup_v7.cpp0000644000175100017510000000631615154533055030237 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "avrarchiversettingsgroup_v7.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace avr { namespace v7 { constexpr int kArchiverArchiveVersion = 2; constexpr int kArchiverDataVersion = 0; namespace { // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { outputFile = QLatin1String("$PROJ_DIR$/") + gen::utils::targetBinaryPath(baseDirectory, qbsProduct); } QString outputFile; }; } // namespace // AvrArchiverSettingsGroup AvrArchiverSettingsGroup::AvrArchiverSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("XAR")); setArchiveVersion(kArchiverArchiveVersion); setDataVersion(kArchiverDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildOutputPage(buildRootDirectory, qbsProduct); } void AvrArchiverSettingsGroup::buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct) { const OutputPageOptions opts(baseDirectory, qbsProduct); // Add 'XAROutOverride' item (Override default). addOptionsGroup(QByteArrayLiteral("XAROutOverride"), {1}); // Add 'OutputFile' item (Output filename). addOptionsGroup(QByteArrayLiteral("OutputFile"), {opts.outputFile}); } } // namespace v7 } // namespace avr } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/avrcompilersettingsgroup_v7.cpp0000644000175100017510000004554415154533055030254 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "avrcompilersettingsgroup_v7.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace avr { namespace v7 { constexpr int kCompilerArchiveVersion = 6; constexpr int kCompilerDataVersion = 17; namespace { // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); moduleType = flags.contains(QLatin1String("--library_module")) ? OutputPageOptions::LibraryModule : OutputPageOptions::ProgramModule; debugInfo = gen::utils::debugInformation(qbsProduct); disableErrorMessages = flags.contains( QLatin1String("--no_ubrof_messages")); } int debugInfo = 0; int disableErrorMessages = 0; enum ModuleType { ProgramModule, LibraryModule}; ModuleType moduleType = ProgramModule; }; // Language one page options. struct LanguageOnePageOptions final { enum LanguageExtension { CLanguageExtension, CxxLanguageExtension, AutoLanguageExtension }; enum CLanguageDialect { C89LanguageDialect, C99LanguageDialect }; enum CxxLanguageDialect { EmbeddedCPlusPlus, ExtendedEmbeddedCPlusPlus }; enum LanguageConformance { AllowIarExtension, RelaxedStandard, StrictStandard }; explicit LanguageOnePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); // File extension based by default. languageExtension = LanguageOnePageOptions::AutoLanguageExtension; // C language dialect. const QStringList cLanguageVersion = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("cLanguageVersion")}); if (cLanguageVersion.contains(QLatin1String("c89"))) cLanguageDialect = LanguageOnePageOptions::C89LanguageDialect; else if (cLanguageVersion.contains(QLatin1String("c99"))) cLanguageDialect = LanguageOnePageOptions::C99LanguageDialect; // C++ language dialect. if (flags.contains(QLatin1String("--ec++"))) cxxLanguageDialect = LanguageOnePageOptions::EmbeddedCPlusPlus; else if (flags.contains(QLatin1String("--eec++"))) cxxLanguageDialect = LanguageOnePageOptions::ExtendedEmbeddedCPlusPlus; // Language conformance. if (flags.contains(QLatin1String("-e"))) languageConformance = LanguageOnePageOptions::AllowIarExtension; else if (flags.contains(QLatin1String("--strict"))) languageConformance = LanguageOnePageOptions::StrictStandard; else languageConformance = LanguageOnePageOptions::RelaxedStandard; allowVla = flags.contains(QLatin1String("--vla")); useCppInlineSemantics = flags.contains( QLatin1String("--use_c++_inline")); requirePrototypes = flags.contains( QLatin1String("--require_prototypes")); destroyStaticObjects = !flags.contains( QLatin1String("--no_static_destruction")); } LanguageExtension languageExtension = AutoLanguageExtension; CLanguageDialect cLanguageDialect = C89LanguageDialect; CxxLanguageDialect cxxLanguageDialect = EmbeddedCPlusPlus; LanguageConformance languageConformance = AllowIarExtension; int allowVla = 0; int useCppInlineSemantics = 0; int requirePrototypes = 0; int destroyStaticObjects = 0; }; // Language two page options. struct LanguageTwoPageOptions final { enum PlainCharacter { SignedCharacter, UnsignedCharacter }; enum FloatingPointSemantic { StrictSemantic, RelaxedSemantic }; explicit LanguageTwoPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); plainCharacter = flags.contains(QLatin1String("--char_is_signed")) ? LanguageTwoPageOptions::SignedCharacter : LanguageTwoPageOptions::UnsignedCharacter; floatingPointSemantic = flags.contains(QLatin1String("--relaxed_fp")) ? LanguageTwoPageOptions::RelaxedSemantic : LanguageTwoPageOptions::StrictSemantic; enableMultibyteSupport = flags.contains( QLatin1String("--enable_multibytes")); } PlainCharacter plainCharacter = SignedCharacter; FloatingPointSemantic floatingPointSemantic = StrictSemantic; int enableMultibyteSupport = 0; }; // Optimizations page options. struct OptimizationsPageOptions final { // Optimizations level radio-buttons with // combo-box on "level" widget. enum Strategy { StrategyBalanced, StrategySize, StrategySpeed }; enum Level { LevelNone, LevelLow, LevelMedium, LevelHigh }; enum LevelSlave { LevelSlave0, LevelSlave1, LevelSlave2, LevelSlave3 }; explicit OptimizationsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString optimization = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("optimization")); if (optimization == QLatin1String("none")) { optimizationStrategy = OptimizationsPageOptions::StrategyBalanced; optimizationLevel = OptimizationsPageOptions::LevelNone; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave0; } else if (optimization == QLatin1String("fast")) { optimizationStrategy = OptimizationsPageOptions::StrategySpeed; optimizationLevel = OptimizationsPageOptions::LevelHigh; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave3; } else if (optimization == QLatin1String("small")) { optimizationStrategy = OptimizationsPageOptions::StrategySize; optimizationLevel = OptimizationsPageOptions::LevelHigh; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave3; } const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); enableCommonSubexpressionElimination = !flags.contains( QLatin1String("--no_cse")); enableFunctionInlining = !flags.contains(QLatin1String("--no_inline")); enableCodeMotion = !flags.contains(QLatin1String("--no_code_motion")); enableCrossCall = !flags.contains(QLatin1String("--no_cross_call")); enableVariableClustering = !flags.contains( QLatin1String("--no_clustering")); enableTypeBasedAliasAnalysis = !flags.contains( QLatin1String("--no_tbaa")); enableForceCrossCall = flags.contains( QLatin1String("--do_cross_call")); } Strategy optimizationStrategy = StrategyBalanced; Level optimizationLevel = LevelNone; LevelSlave optimizationLevelSlave = LevelSlave0; // Six bit-field flags on "enabled optimizations" widget. int enableCommonSubexpressionElimination = 0; // Common sub-expression elimination. int enableFunctionInlining = 0; // Function inlining. int enableCodeMotion = 0; // Code motion. int enableCrossCall = 0; // Cross call optimization. int enableVariableClustering = 0; // Variable clustering. int enableTypeBasedAliasAnalysis = 0; // Type based alias analysis. // Force cross-call optimization. int enableForceCrossCall = 0; }; // Preprocessor page options. struct PreprocessorPageOptions final { explicit PreprocessorPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); defineSymbols = gen::utils::cppVariantModuleProperties( qbsProps, {QStringLiteral("defines")}); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); const QStringList fullIncludePaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("includePaths"), QStringLiteral("systemIncludePaths")}); for (const QString &fullIncludePath : fullIncludePaths) { const QFileInfo includeFileInfo(fullIncludePath); const QString includeFilePath = includeFileInfo.absoluteFilePath(); if (includeFilePath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, includeFilePath); includePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, includeFilePath); includePaths.push_back(path); } } } QVariantList defineSymbols; QVariantList includePaths; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); warningsAsErrors = gen::utils::cppIntegerModuleProperty( qbsProps, QStringLiteral("treatWarningsAsErrors")); } int warningsAsErrors = 0; }; // Code page options. struct CodePageOptions final { explicit CodePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); placeConstantsInRam = flags.contains(QLatin1String("-y")); placeInitializiersInFlash = flags.contains( QLatin1String("--initializiers_in_flash")); forceVariablesGeneration = flags.contains( QLatin1String("--root_variables")); useIccA90CallingConvention = flags.contains( QLatin1String("--version1_calls")); lockRegistersCount = IarewUtils::flagValue( flags, QStringLiteral("--lock_regs")).toInt(); } int placeConstantsInRam = 0; int placeInitializiersInFlash = 0; int forceVariablesGeneration = 0; int useIccA90CallingConvention = 0; int lockRegistersCount = 0; }; } // namespace // AvrCompilerSettingsGroup AvrCompilerSettingsGroup::AvrCompilerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("ICCAVR")); setArchiveVersion(kCompilerArchiveVersion); setDataVersion(kCompilerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildOutputPage(qbsProduct); buildLanguageOnePage(qbsProduct); buildLanguageTwoPage(qbsProduct); buildOptimizationsPage(qbsProduct); buildPreprocessorPage(buildRootDirectory, qbsProduct); buildDiagnosticsPage(qbsProduct); buildCodePage(qbsProduct); } void AvrCompilerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'CCDebugInfo' item (Generate debug info). addOptionsGroup(QByteArrayLiteral("CCDebugInfo"), {opts.debugInfo}); // Add 'CCNoErrorMsg' item (No error messages in output files). addOptionsGroup(QByteArrayLiteral("CCNoErrorMsg"), {opts.disableErrorMessages}); // Add 'CCOverrideModuleTypeDefault' item // (Override default module type). addOptionsGroup(QByteArrayLiteral("CCOverrideModuleTypeDefault"), {1}); // Add 'CCRadioModuleType' item (Module type: program/library). addOptionsGroup(QByteArrayLiteral("CCRadioModuleType"), {opts.moduleType}); } void AvrCompilerSettingsGroup::buildLanguageOnePage( const ProductData &qbsProduct) { const LanguageOnePageOptions opts(qbsProduct); // Add 'IccLang' item with 'auto-extension based' // value (Language: C/C++/Auto). addOptionsGroup(QByteArrayLiteral("IccLang"), {opts.languageExtension}); // Add 'IccCDialect' item (C dialect: c89/99/11). addOptionsGroup(QByteArrayLiteral("IccCDialect"), {opts.cLanguageDialect}); // Add 'IccCppDialect' item (C++ dialect: embedded/extended). addOptionsGroup(QByteArrayLiteral("IccCppDialect"), {opts.cxxLanguageDialect}); // Add 'CCExt' item (Language conformance: IAR/relaxed/strict). addOptionsGroup(QByteArrayLiteral("CCExt"), {opts.languageConformance}); // Add 'IccAllowVLA' item (Allow VLA). addOptionsGroup(QByteArrayLiteral("IccAllowVLA"), {opts.allowVla}); // Add 'IccCppInlineSemantics' item (C++ inline semantics). addOptionsGroup(QByteArrayLiteral("IccCppInlineSemantics"), {opts.useCppInlineSemantics}); // Add 'CCRequirePrototypes' item (Require prototypes). addOptionsGroup(QByteArrayLiteral("CCRequirePrototypes"), {opts.requirePrototypes}); // Add 'IccStaticDestr' item (Destroy static objects). addOptionsGroup(QByteArrayLiteral("IccStaticDestr"), {opts.destroyStaticObjects}); } void AvrCompilerSettingsGroup::buildLanguageTwoPage( const ProductData &qbsProduct) { const LanguageTwoPageOptions opts(qbsProduct); // Add 'CCCharIs' item (Plain char is: signed/unsigned). addOptionsGroup(QByteArrayLiteral("CCCharIs"), {opts.plainCharacter}); // Add 'IccFloatSemantics' item (Floatic-point // semantics: strict/relaxed conformance). addOptionsGroup(QByteArrayLiteral("IccFloatSemantics"), {opts.floatingPointSemantic}); // Add 'CCMultibyteSupport' item (Enable multibyte support). addOptionsGroup(QByteArrayLiteral("CCMultibyteSupport"), {opts.enableMultibyteSupport}); } void AvrCompilerSettingsGroup::buildOptimizationsPage( const ProductData &qbsProduct) { const OptimizationsPageOptions opts(qbsProduct); // Add 'CCOptStrategy', 'CCOptLevel' and // 'CCOptLevelSlave' items (Level). addOptionsGroup(QByteArrayLiteral("CCOptStrategy"), {opts.optimizationStrategy}); addOptionsGroup(QByteArrayLiteral("CCOptLevel"), {opts.optimizationLevel}); addOptionsGroup(QByteArrayLiteral("CCOptLevelSlave"), {opts.optimizationLevelSlave}); // Add 'CCAllowList' item // (Enabled optimizations: 6 check boxes). const QString bitflags = QStringLiteral("%1%2%3%4%5%6") .arg(opts.enableCommonSubexpressionElimination) .arg(opts.enableFunctionInlining) .arg(opts.enableCodeMotion) .arg(opts.enableCrossCall) .arg(opts.enableVariableClustering) .arg(opts.enableTypeBasedAliasAnalysis); addOptionsGroup(QByteArrayLiteral("CCAllowList"), {bitflags}); // Add 'CCOptForceCrossCall' item // (Always do cross call optimization). addOptionsGroup(QByteArrayLiteral("CCOptForceCrossCall"), {opts.enableForceCrossCall}); } void AvrCompilerSettingsGroup::buildPreprocessorPage( const QString &baseDirectory, const ProductData &qbsProduct) { const PreprocessorPageOptions opts(baseDirectory, qbsProduct); // Add 'CCDefines' item (Defines symbols). addOptionsGroup(QByteArrayLiteral("CCDefines"), opts.defineSymbols); // Add 'newCCIncludePaths' item // (Additional include directories). addOptionsGroup(QByteArrayLiteral("newCCIncludePaths"), opts.includePaths); } void AvrCompilerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'CCWarnAsError' item (Treat all warnings as errors). addOptionsGroup(QByteArrayLiteral("CCWarnAsError"), {opts.warningsAsErrors}); } void AvrCompilerSettingsGroup::buildCodePage( const ProductData &qbsProduct) { const CodePageOptions opts(qbsProduct); // Add 'CCConstInRAM' item (Place string literals // and constants in initialized RAM). addOptionsGroup(QByteArrayLiteral("CCConstInRAM"), {opts.placeConstantsInRam}); // Add 'CCInitInFlash' item (Place aggregate // initializiers in flash memory). addOptionsGroup(QByteArrayLiteral("CCInitInFlash"), {opts.placeInitializiersInFlash}); // Add 'CCForceVariables' item (Force generation of // all global and static variables). addOptionsGroup(QByteArrayLiteral("CCForceVariables"), {opts.forceVariablesGeneration}); // Add 'CCOldCallConv' item (Use ICCA90 1.x // calling convention). addOptionsGroup(QByteArrayLiteral("CCOldCallConv"), {opts.useIccA90CallingConvention}); // Add 'CCLockRegs' item (Number of registers to // lock for global variables). addOptionsGroup(QByteArrayLiteral("CCLockRegs"), {opts.lockRegistersCount}); } } // namespace v7 } // namespace avr } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/avrcompilersettingsgroup_v7.h0000644000175100017510000000516015154533055027707 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWAVRCOMPILERSETTINGSGROUP_V7_H #define QBS_IAREWAVRCOMPILERSETTINGSGROUP_V7_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace avr { namespace v7 { class AvrCompilerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit AvrCompilerSettingsGroup(const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildOutputPage(const ProductData &qbsProduct); void buildLanguageOnePage(const ProductData &qbsProduct); void buildLanguageTwoPage(const ProductData &qbsProduct); void buildOptimizationsPage(const ProductData &qbsProduct); void buildPreprocessorPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); void buildCodePage(const ProductData &qbsProduct); }; } // namespace v7 } // namespace avr } // namespace iarew } // namespace qbs #endif // QBS_IAREWAVRCOMPILERSETTINGSGROUP_V7_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/avrbuildconfigurationgroup_v7.cpp0000644000175100017510000000731415154533055030541 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "avrarchiversettingsgroup_v7.h" #include "avrassemblersettingsgroup_v7.h" #include "avrbuildconfigurationgroup_v7.h" #include "avrcompilersettingsgroup_v7.h" #include "avrgeneralsettingsgroup_v7.h" #include "avrlinkersettingsgroup_v7.h" #include "../../iarewtoolchainpropertygroup.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace avr { namespace v7 { AvrBuildConfigurationGroup::AvrBuildConfigurationGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) : gen::xml::PropertyGroup("configuration") { // Append configuration name item. const QString cfgName = gen::utils::buildConfigurationName(qbsProject); appendProperty("name", cfgName); // Apend toolchain name group item. appendChild("AVR"); // Append debug info item. const int debugBuild = gen::utils::debugInformation(qbsProduct); appendProperty("debug", debugBuild); // Append settings group items. appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); } bool AvrBuildConfigurationGroupFactory::canCreate( gen::utils::Architecture arch, const Version &version) const { return arch == gen::utils::Architecture::Avr && version.majorVersion() == 7; } std::unique_ptr AvrBuildConfigurationGroupFactory::create( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) const { const auto group = new AvrBuildConfigurationGroup( qbsProject, qbsProduct, qbsProductDeps); return std::unique_ptr(group); } } // namespace v7 } // namespace avr } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/avr/avrgeneralsettingsgroup_v7.h0000644000175100017510000000504415154533055027513 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWAVRGENERALSETTINGSGROUP_V7_H #define QBS_IAREWAVRGENERALSETTINGSGROUP_V7_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace avr { namespace v7 { class AvrGeneralSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit AvrGeneralSettingsGroup(const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildTargetPage(const ProductData &qbsProduct); void buildSystemPage(const ProductData &qbsProduct); void buildLibraryOptionsPage(const ProductData &qbsProduct); void buildLibraryConfigPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct); }; } // namespace v7 } // namespace avr } // namespace iarew } // namespace qbs #endif // QBS_IAREWAVRGENERALSETTINGSGROUP_V7_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/0000755000175100017510000000000015154533055022175 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/msp430buildconfigurationgroup_v7.cpp0000644000175100017510000000741315154533055031235 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msp430archiversettingsgroup_v7.h" #include "msp430assemblersettingsgroup_v7.h" #include "msp430buildconfigurationgroup_v7.h" #include "msp430compilersettingsgroup_v7.h" #include "msp430generalsettingsgroup_v7.h" #include "msp430linkersettingsgroup_v7.h" #include "../../iarewtoolchainpropertygroup.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace msp430 { namespace v7 { Msp430BuildConfigurationGroup::Msp430BuildConfigurationGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) : gen::xml::PropertyGroup("configuration") { // Append configuration name item. const QString cfgName = gen::utils::buildConfigurationName(qbsProject); appendProperty("name", cfgName); // Apend toolchain name group item. appendChild("MSP430"); // Append debug info item. const int debugBuild = gen::utils::debugInformation(qbsProduct); appendProperty("debug", debugBuild); // Append settings group items. appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); } bool Msp430BuildConfigurationGroupFactory::canCreate( gen::utils::Architecture arch, const Version &version) const { return arch == gen::utils::Architecture::Msp430 && version.majorVersion() == 7; } std::unique_ptr Msp430BuildConfigurationGroupFactory::create( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) const { const auto group = new Msp430BuildConfigurationGroup( qbsProject, qbsProduct, qbsProductDeps); return std::unique_ptr(group); } } // namespace v7 } // namespace msp430 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/msp430generalsettingsgroup_v7.cpp0000644000175100017510000004532415154533055030547 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msp430generalsettingsgroup_v7.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace msp430 { namespace v7 { constexpr int kGeneralArchiveVersion = 21; constexpr int kGeneralDataVersion = 34; namespace { // Target page options. struct TargetPageOptions final { enum CodeModel { SmallCodeModel, LargeCodeModel }; enum DataModel { SmallDataModel, MediumDataModel, LargeDataModel }; enum FloatingPointDoubleSize { DoubleSize32Bits, DoubleSize64Bits }; enum HardwareMultiplierType { AllowDirectAccessMultiplier, UseOnlyLibraryCallsMultiplier }; explicit TargetPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("driverFlags")}); // Detect target code model. const QString codeModelValue = IarewUtils::flagValue( flags, QStringLiteral("--code_model")); if (codeModelValue == QLatin1String("small")) codeModel = TargetPageOptions::SmallCodeModel; else if (codeModelValue == QLatin1String("large")) codeModel = TargetPageOptions::LargeCodeModel; // Detect target data model. const QString dataModelValue = IarewUtils::flagValue( flags, QStringLiteral("--data_model")); if (dataModelValue == QLatin1String("small")) dataModel = TargetPageOptions::SmallDataModel; else if (dataModelValue == QLatin1String("medium")) dataModel = TargetPageOptions::MediumDataModel; else if (dataModelValue == QLatin1String("large")) dataModel = TargetPageOptions::LargeDataModel; // Detect floating point double size. const int doubleSize = IarewUtils::flagValue( flags, QStringLiteral("--double")).toInt(); if (doubleSize == 32) floatingPointDoubleSize = DoubleSize32Bits; else if (doubleSize == 64) floatingPointDoubleSize = DoubleSize64Bits; // Detect hardware multiplier. const QString multiplier = IarewUtils::flagValue( flags, QStringLiteral("--multiplier")); enableHardwareMultiplier = (multiplier.compare(QLatin1String("16")) == 0 || multiplier.compare(QLatin1String("16s")) == 0 || multiplier.compare(QLatin1String("32")) == 0); // Detect code and read-only data position-independence. enableRopi = flags.contains(QLatin1String("--ropi")); // No dynamic read-write initialization. disableDynamicReadWriteInitialization = flags.contains( QLatin1String("--no_rw_dynamic_init")); // Detect target device name. detectDeviceMenu(qbsProduct); } void detectDeviceMenu(const ProductData &qbsProduct) { const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); // Enumerate all product linker config files // (which are set trough 'linkerscript' tag). for (const auto &qbsGroup : qbsProduct.groups()) { const auto qbsArtifacts = qbsGroup.sourceArtifacts(); for (const auto &qbsArtifact : qbsArtifacts) { const auto qbsTags = qbsArtifact.fileTags(); if (!qbsTags.contains(QLatin1String("linkerscript"))) continue; const QString fullConfigPath = qbsArtifact.filePath(); if (!fullConfigPath.startsWith(toolkitPath, Qt::CaseInsensitive)) continue; const QFileInfo configInfo(fullConfigPath); const QString configBase = configInfo.baseName(); if (!configBase.startsWith(QLatin1String("lnk"))) continue; // Remove 'lnk' prefix. const QString deviceName = QStringLiteral("MSP%1") .arg(configBase.mid(3).toUpper()); deviceMenu = QStringLiteral("%1\t%1").arg(deviceName); return; } } // Falling back to generic menu. if (deviceMenu.isEmpty()) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); const QString cpuCore = IarewUtils::flagValue(flags, QStringLiteral("--core")); if (cpuCore.isEmpty()) return; deviceMenu = QStringLiteral("MSP%1\tGeneric MSP%1 device").arg(cpuCore); return; } } CodeModel codeModel = LargeCodeModel; DataModel dataModel = SmallDataModel; FloatingPointDoubleSize floatingPointDoubleSize = DoubleSize32Bits; HardwareMultiplierType hardwareMultiplierType = AllowDirectAccessMultiplier; int enableHardwareMultiplier = 0; int enableRopi = 0; int disableDynamicReadWriteInitialization = 0; QString deviceMenu; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { binaryType = IarewUtils::outputBinaryType(qbsProduct); binaryDirectory = gen::utils::binaryOutputDirectory( baseDirectory, qbsProduct); objectDirectory = gen::utils::objectsOutputDirectory( baseDirectory, qbsProduct); listingDirectory = gen::utils::listingOutputDirectory( baseDirectory, qbsProduct); } IarewUtils::OutputBinaryType binaryType = IarewUtils::ApplicationOutputType; QString binaryDirectory; QString objectDirectory; QString listingDirectory; }; // Library configuration page options. struct LibraryConfigPageOptions final { enum RuntimeLibrary { NoLibrary, NormalDLibrary, FullDLibrary, CustomDLibrary, CLibrary, // deprecated CustomCLibrary, // deprecated }; explicit LibraryConfigPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); const QFileInfo configInfo(IarewUtils::flagValue( flags, QStringLiteral("--dlib_config"))); const QString configFilePath = configInfo.absoluteFilePath(); if (!configFilePath.isEmpty()) { const QString libToolkitPath = IarewUtils::libToolkitRootPath(qbsProduct); if (configFilePath.startsWith(libToolkitPath, Qt::CaseInsensitive)) { if (configFilePath.endsWith(QLatin1String("n.h"), Qt::CaseInsensitive)) { libraryType = LibraryConfigPageOptions::NormalDLibrary; } else if (configFilePath.endsWith(QLatin1String("f.h"), Qt::CaseInsensitive)) { libraryType = LibraryConfigPageOptions::FullDLibrary; } else { libraryType = LibraryConfigPageOptions::CustomDLibrary; } configPath = IarewUtils::toolkitRelativeFilePath( baseDirectory, configFilePath); } else { libraryType = LibraryConfigPageOptions::CustomDLibrary; configPath = configFilePath; } } } RuntimeLibrary libraryType = NormalDLibrary; QString libraryPath; QString configPath; }; // Library options page options. struct LibraryOptionsPageOptions final { enum PrintfFormatter { PrintfAutoFormatter = 0, PrintfFullFormatter = 1, PrintfFullNoMultibytesFormatter = 2, PrintfLargeFormatter = 3, PrintfLargeNoMultibytesFormatter = 4, PrintfSmallFormatter = 5, PrintfSmallNoMultibytesFormatter = 6, PrintfTinyFormatter = 7 }; enum ScanfFormatter { ScanfAutoFormatter = 0, ScanfFullFormatter = 1, ScanfFullNoMultibytesFormatter = 2, ScanfLargeFormatter = 3, ScanfLargeNoMultibytesFormatter = 4, ScanfSmallFormatter = 5, ScanfSmallNoMultibytesFormatter = 6 }; explicit LibraryOptionsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); for (auto flagIt = flags.cbegin(); flagIt < flags.cend(); ++flagIt) { if (flagIt->endsWith(QLatin1String("=_printf"), Qt::CaseInsensitive)) { const QString prop = flagIt->split( QLatin1Char('=')).at(0).toLower(); if (prop == QLatin1String("_printffull")) printfFormatter = PrintfFullFormatter; else if (prop == QLatin1String("_printffullnomb")) printfFormatter = PrintfFullNoMultibytesFormatter; else if (prop == QLatin1String("_printflarge")) printfFormatter = PrintfLargeFormatter; else if (prop == QLatin1String("_printflargenomb")) printfFormatter = PrintfLargeNoMultibytesFormatter; else if (prop == QLatin1String("_printfsmall")) printfFormatter = PrintfSmallFormatter; else if (prop == QLatin1String("_printfsmallnomb")) printfFormatter = PrintfSmallNoMultibytesFormatter; else if (prop == QLatin1String("_printftiny")) printfFormatter = PrintfTinyFormatter; } else if (flagIt->endsWith(QLatin1String("=_scanf"), Qt::CaseInsensitive)) { const QString prop = flagIt->split( QLatin1Char('=')).at(0).toLower(); if (prop == QLatin1String("_scanffull")) scanfFormatter = ScanfFullFormatter; else if (prop == QLatin1String("_scanffullnomb")) scanfFormatter = ScanfFullNoMultibytesFormatter; else if (prop == QLatin1String("_scanflarge")) scanfFormatter = ScanfLargeFormatter; else if (prop == QLatin1String("_scanflargenomb")) scanfFormatter = ScanfLargeNoMultibytesFormatter; else if (prop == QLatin1String("_scanfsmall")) scanfFormatter = ScanfSmallFormatter; else if (prop == QLatin1String("_scanfsmallnomb")) scanfFormatter = ScanfSmallNoMultibytesFormatter; } } } PrintfFormatter printfFormatter = PrintfAutoFormatter; ScanfFormatter scanfFormatter = ScanfAutoFormatter; }; // Stack/heap page options. struct StackHeapPageOptions final { explicit StackHeapPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); // Detect stack size. stackSize = IarewUtils::flagValue( flags, QStringLiteral("-D_STACK_SIZE")); if (stackSize.isEmpty()) stackSize = QLatin1String("A0"); // Detect data heap16 size. data16HeapSize = IarewUtils::flagValue( flags, QStringLiteral("-D_DATA16_HEAP_SIZE")); if (data16HeapSize.isEmpty()) stackSize = QLatin1String("A0"); // Detect data heap20 size. data20HeapSize = IarewUtils::flagValue( flags, QStringLiteral("-D_DATA20_HEAP_SIZE")); if (data20HeapSize.isEmpty()) stackSize = QLatin1String("50"); } QString stackSize; QString data16HeapSize; QString data20HeapSize; }; } // namespace //Msp430GeneralSettingsGroup Msp430GeneralSettingsGroup::Msp430GeneralSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("General")); setArchiveVersion(kGeneralArchiveVersion); setDataVersion(kGeneralDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildTargetPage(qbsProduct); buildOutputPage(buildRootDirectory, qbsProduct); buildLibraryConfigPage(buildRootDirectory, qbsProduct); buildLibraryOptionsPage(qbsProduct); buildStackHeapPage(qbsProduct); } void Msp430GeneralSettingsGroup::buildTargetPage( const ProductData &qbsProduct) { const TargetPageOptions opts(qbsProduct); // Add 'OGChipSelectMenu' item // (Device: xxx). addOptionsGroup(QByteArrayLiteral("OGChipSelectMenu"), {opts.deviceMenu}); // Add 'RadioCodeModelType' item // (Code model: small/large). addOptionsGroup(QByteArrayLiteral("RadioCodeModelType"), {opts.codeModel}); // Add 'RadioDataModelType' item // (Data model: small/medium/large). addOptionsGroup(QByteArrayLiteral("RadioDataModelType"), {opts.dataModel}); // Add 'OGDouble' item // (Floating point double size: 32/64 bits). addOptionsGroup(QByteArrayLiteral("OGDouble"), {opts.floatingPointDoubleSize}); // Add 'Hardware Multiplier' item // (Hardware multiplier). addOptionsGroup(QByteArrayLiteral("Hardware Multiplier"), {opts.enableHardwareMultiplier}); if (opts.enableHardwareMultiplier) { // Add 'RadioHardwareMultiplierType' item. addOptionsGroup(QByteArrayLiteral("Hardware RadioHardwareMultiplierType"), {opts.hardwareMultiplierType}); } // Add 'Ropi' item. // (Position independence: Code and read-only data). addOptionsGroup(QByteArrayLiteral("Ropi"), {opts.enableRopi}); // Add 'NoRwDynamicInit' item. // (Position independence: No dynamic read/write initialization). addOptionsGroup(QByteArrayLiteral("NoRwDynamicInit"), {opts.disableDynamicReadWriteInitialization}); } void Msp430GeneralSettingsGroup::buildOutputPage( const QString &baseDirectory, const ProductData &qbsProduct) { const OutputPageOptions opts(baseDirectory, qbsProduct); // Add 'GOutputBinary' item (Output file: executable/library). addOptionsGroup(QByteArrayLiteral("GOutputBinary"), {opts.binaryType}); // Add 'ExePath' item (Executable/binaries output directory). addOptionsGroup(QByteArrayLiteral("ExePath"), {opts.binaryDirectory}); // Add 'ObjPath' item (Object files output directory). addOptionsGroup(QByteArrayLiteral("ObjPath"), {opts.objectDirectory}); // Add 'ListPath' item (List files output directory). addOptionsGroup(QByteArrayLiteral("ListPath"), {opts.listingDirectory}); } void Msp430GeneralSettingsGroup::buildLibraryConfigPage( const QString &baseDirectory, const ProductData &qbsProduct) { const LibraryConfigPageOptions opts(baseDirectory, qbsProduct); // Add 'GRuntimeLibSelect' and 'GRuntimeLibSelectSlave' items // (Link with runtime: none/normal/full/custom). addOptionsGroup(QByteArrayLiteral("GRuntimeLibSelect"), {opts.libraryType}); addOptionsGroup(QByteArrayLiteral("GRuntimeLibSelectSlave"), {opts.libraryType}); // Add 'RTConfigPath' item (Runtime configuration file). addOptionsGroup(QByteArrayLiteral("RTConfigPath"), {opts.configPath}); // Add 'RTLibraryPath' item (Runtime library file). addOptionsGroup(QByteArrayLiteral("RTLibraryPath"), {opts.libraryPath}); } void Msp430GeneralSettingsGroup::buildLibraryOptionsPage( const ProductData &qbsProduct) { const LibraryOptionsPageOptions opts(qbsProduct); // Add 'Output variant' item (Printf formatter). addOptionsGroup(QByteArrayLiteral("Output variant"), {opts.printfFormatter}); // Add 'Input variant' item (Scanf formatter). addOptionsGroup(QByteArrayLiteral("Input variant"), {opts.scanfFormatter}); } void Msp430GeneralSettingsGroup::buildStackHeapPage( const ProductData &qbsProduct) { const StackHeapPageOptions opts(qbsProduct); // Add 'GStackHeapOverride' item (Override default). addOptionsGroup(QByteArrayLiteral("GStackHeapOverride"), {1}); // Add 'GStackSize2' item (Stack size). addOptionsGroup(QByteArrayLiteral("GStackSize2"), {opts.stackSize}); // Add 'GHeapSize2' item (Heap16 size). addOptionsGroup(QByteArrayLiteral("GHeapSize2"), {opts.data16HeapSize}); // Add 'GHeap20Size' item (Heap16 size). addOptionsGroup(QByteArrayLiteral("GHeap20Size"), {opts.data20HeapSize}); } } // namespace v7 } // namespace msp430 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/msp430archiversettingsgroup_v7.h0000644000175100017510000000435015154533055030374 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWMSP430ARCHIVERSETTINGSGROUP_V7_H #define QBS_IAREWMSP430ARCHIVERSETTINGSGROUP_V7_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace msp430 { namespace v7 { class Msp430ArchiverSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Msp430ArchiverSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct); }; } // namespace v7 } // namespace msp430 } // namespace iarew } // namespace qbs #endif // QBS_IAREWMSP430ARCHIVERSETTINGSGROUP_V7_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/msp430compilersettingsgroup_v7.h0000644000175100017510000000513615154533055030406 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWMSP430COMPILERSETTINGSGROUP_V7_H #define QBS_IAREWMSP430COMPILERSETTINGSGROUP_V7_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace msp430 { namespace v7 { class Msp430CompilerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Msp430CompilerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildOutputPage(const ProductData &qbsProduct); void buildLanguageOnePage(const ProductData &qbsProduct); void buildLanguageTwoPage(const ProductData &qbsProduct); void buildCodePage(const ProductData &qbsProduct); void buildOptimizationsPage(const ProductData &qbsProduct); void buildPreprocessorPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); }; } // namespace v7 } // namespace msp430 } // namespace iarew } // namespace qbs #endif // QBS_IAREWMSP430COMPILERSETTINGSGROUP_V7_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/msp430linkersettingsgroup_v7.h0000644000175100017510000000475015154533055030061 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWMSP430LINKERSETTINGSGROUP_V7_H #define QBS_IAREWMSP430LINKERSETTINGSGROUP_V7_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace msp430 { namespace v7 { class Msp430LinkerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Msp430LinkerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildConfigPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildOutputPage(const ProductData &qbsProduct); void buildListPage(const ProductData &qbsProduct); void buildDefinePage(const ProductData &qbsProduct); void buildExtraOptionsPage(const ProductData &qbsProduct); QVariantList m_extraOptions; }; } // namespace v7 } // namespace msp430 } // namespace iarew } // namespace qbs #endif // QBS_IAREWMSP430LINKERSETTINGSGROUP_V7_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/msp430generalsettingsgroup_v7.h0000644000175100017510000000502715154533055030210 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWMSP430GENERALSETTINGSGROUP_V7_H #define QBS_IAREWMSP430GENERALSETTINGSGROUP_V7_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace msp430 { namespace v7 { class Msp430GeneralSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Msp430GeneralSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildTargetPage(const ProductData &qbsProduct); void buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildLibraryConfigPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildLibraryOptionsPage(const ProductData &qbsProduct); void buildStackHeapPage(const ProductData &qbsProduct); }; } // namespace v7 } // namespace msp430 } // namespace iarew } // namespace qbs #endif // QBS_IAREWMSP430GENERALSETTINGSGROUP_V7_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/msp430buildconfigurationgroup_v7.h0000644000175100017510000000520215154533055030674 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWMSP430BUILDCONFIGURATIONGROUP_V7_H #define QBS_IAREWMSP430BUILDCONFIGURATIONGROUP_V7_H #include #include namespace qbs { namespace iarew { namespace msp430 { namespace v7 { class Msp430BuildConfigurationGroup final : public gen::xml::PropertyGroup { private: explicit Msp430BuildConfigurationGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); friend class Msp430BuildConfigurationGroupFactory; }; class Msp430BuildConfigurationGroupFactory final : public gen::xml::PropertyGroupFactory { public: bool canCreate(gen::utils::Architecture arch, const Version &version) const final; std::unique_ptr create( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) const final; }; } // namespace v7 } // namespace msp430 } // namespace iarew } // namespace qbs #endif // QBS_IAREWMSP430BUILDCONFIGURATIONGROUP_V7_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/msp430linkersettingsgroup_v7.cpp0000644000175100017510000002406515154533055030415 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msp430linkersettingsgroup_v7.h" #include "../../iarewutils.h" #include namespace qbs { namespace iarew { namespace msp430 { namespace v7 { constexpr int kLinkerArchiveVersion = 4; constexpr int kLinkerDataVersion = 30; namespace { // Config page options. struct ConfigPageOptions final { explicit ConfigPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); // Enumerate all product linker config files // (which are set trough 'linkerscript' tag). for (const auto &qbsGroup : qbsProduct.groups()) { const auto qbsArtifacts = qbsGroup.sourceArtifacts(); for (const auto &qbsArtifact : qbsArtifacts) { const auto qbsTags = qbsArtifact.fileTags(); if (!qbsTags.contains(QLatin1String("linkerscript"))) continue; const QString fullConfigPath = qbsArtifact.filePath(); if (fullConfigPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullConfigPath); configFilePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullConfigPath); configFilePaths.push_back(path); } } } // Enumerate all product linker config files // (which are set trough '-f' option). const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); const QVariantList configPathValues = IarewUtils::flagValues( flags, QStringLiteral("-f")); for (const QVariant &configPathValue : configPathValues) { const QString fullConfigPath = configPathValue.toString(); if (fullConfigPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullConfigPath); if (!configFilePaths.contains(path)) configFilePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullConfigPath); if (!configFilePaths.contains(path)) configFilePaths.push_back(path); } } // Library search paths. librarySearchPaths = gen::utils::cppVariantModuleProperties( qbsProps, {QStringLiteral("libraryPaths")}); // Entry point. entryPoint = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("entryPoint")); } QVariantList configFilePaths; QVariantList librarySearchPaths; QString entryPoint; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { outputFile = gen::utils::targetBinary(qbsProduct); } QString outputFile; }; // List page options. struct ListPageOptions final { enum ListingAction { NoListing, GenerateListing }; explicit ListPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); generateMap = gen::utils::cppBooleanModuleProperty( qbsProps, QStringLiteral("generateLinkerMapFile")) ? ListPageOptions::GenerateListing : ListPageOptions::NoListing; } ListingAction generateMap = NoListing; }; // Define page options. struct DefinePageOptions final { explicit DefinePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); // Enumerate all linker defines. for (const QString &flag : flags) { if (!flag.startsWith(QLatin1String("-D"))) continue; const QString symbol = flag.mid(2); // Ignore system-defined macroses, because its already // handled in "General Options" page. if (symbol.startsWith(QLatin1Char('?')) || symbol.startsWith(QLatin1Char('_')) ) { continue; } defineSymbols.push_back(symbol); } } QVariantList defineSymbols; }; } // namespace //Msp430LinkerSettingsGroup Msp430LinkerSettingsGroup::Msp430LinkerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("XLINK")); setArchiveVersion(kLinkerArchiveVersion); setDataVersion(kLinkerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildConfigPage(buildRootDirectory, qbsProduct); buildOutputPage(qbsProduct); buildListPage(qbsProduct); buildDefinePage(qbsProduct); // Should be called as latest stage! buildExtraOptionsPage(qbsProduct); } void Msp430LinkerSettingsGroup::buildConfigPage( const QString &baseDirectory, const ProductData &qbsProduct) { ConfigPageOptions opts(baseDirectory, qbsProduct); if (opts.configFilePaths.count() > 0) { // Note: IAR IDE does not allow to specify a multiple config files, // although the IAR linker support it. So, we use followig 'trick': // we take a first config file and to add it as usual to required items; // and then an other remainders we forward to the "Extra options page". const QVariant configPath = opts.configFilePaths.takeFirst(); // Add 'XclOverride' item (Override default). addOptionsGroup(QByteArrayLiteral("XclOverride"), {1}); // Add 'XclFile' item (Linke configuration file). addOptionsGroup(QByteArrayLiteral("XclFile"), {configPath}); // Add remainder configuration files to the "Extra options page". if (!opts.configFilePaths.isEmpty()) { for (QVariant &configPath : opts.configFilePaths) configPath = QString(QStringLiteral("-f ") + configPath.toString()); m_extraOptions << opts.configFilePaths; } } // Add 'xcOverrideProgramEntryLabel' item // (Override default program entry). addOptionsGroup(QByteArrayLiteral("xcOverrideProgramEntryLabel"), {1}); // Add 'xcProgramEntryLabel' item (Entry point name). addOptionsGroup(QByteArrayLiteral("xcProgramEntryLabel"), {opts.entryPoint}); // Add 'XIncludes' item (Entry point name). addOptionsGroup(QByteArrayLiteral("XIncludes"), {opts.librarySearchPaths}); } void Msp430LinkerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'XOutOverride' item (Output file name). addOptionsGroup(QByteArrayLiteral("XOutOverride"), {1}); // Add 'OutputFile' item (Output file name). addOptionsGroup(QByteArrayLiteral("OutputFile"), {opts.outputFile}); } void Msp430LinkerSettingsGroup::buildListPage( const ProductData &qbsProduct) { const ListPageOptions opts(qbsProduct); // Add 'XList' item (Generate linker map file). addOptionsGroup(QByteArrayLiteral("XList"), {opts.generateMap}); } void Msp430LinkerSettingsGroup::buildDefinePage( const ProductData &qbsProduct) { const DefinePageOptions opts(qbsProduct); // Add 'XDefines' item (Defined symbols). addOptionsGroup(QByteArrayLiteral("XDefines"), opts.defineSymbols); } void Msp430LinkerSettingsGroup::buildExtraOptionsPage( const ProductData &qbsProduct) { Q_UNUSED(qbsProduct) if (m_extraOptions.isEmpty()) return; // Add 'XExtraOptionsCheck' (Use command line options). addOptionsGroup(QByteArrayLiteral("XExtraOptionsCheck"), {1}); // Add 'XExtraOptions' item (Command line options). addOptionsGroup(QByteArrayLiteral("XExtraOptions"), m_extraOptions); } } // namespace v7 } // namespace msp430 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/msp430assemblersettingsgroup_v7.h0000644000175100017510000000465315154533055030554 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWMSP430ASSEMBLERSETTINGSGROUP_V7_H #define QBS_IAREWMSP430ASSEMBLERSETTINGSGROUP_V7_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace msp430 { namespace v7 { class Msp430AssemblerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Msp430AssemblerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildLanguagePage(const ProductData &qbsProduct); void buildOutputPage(const ProductData &qbsProduct); void buildPreprocessorPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); }; } // namespace v7 } // namespace msp430 } // namespace iarew } // namespace qbs #endif // QBS_IAREWMSP430ASSEMBLERSETTINGSGROUP_V7_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/msp430compilersettingsgroup_v7.cpp0000644000175100017510000004404515154533055030743 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msp430compilersettingsgroup_v7.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace msp430 { namespace v7 { constexpr int kCompilerArchiveVersion = 4; constexpr int kCompilerDataVersion = 38; namespace { // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { debugInfo = gen::utils::debugInformation(qbsProduct); } int debugInfo = 0; }; // Language one page options. struct LanguageOnePageOptions final { enum LanguageExtension { CLanguageExtension, CxxLanguageExtension, AutoLanguageExtension }; enum CLanguageDialect { C89LanguageDialect, C99LanguageDialect }; enum CxxLanguageDialect { EmbeddedCPlusPlus, ExtendedEmbeddedCPlusPlus }; enum LanguageConformance { AllowIarExtension, RelaxedStandard, StrictStandard }; explicit LanguageOnePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); // File extension based by default. languageExtension = LanguageOnePageOptions::AutoLanguageExtension; // C language dialect. const QStringList cLanguageVersion = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("cLanguageVersion")}); if (cLanguageVersion.contains(QLatin1String("c89"))) cLanguageDialect = LanguageOnePageOptions::C89LanguageDialect; else if (cLanguageVersion.contains(QLatin1String("c99"))) cLanguageDialect = LanguageOnePageOptions::C99LanguageDialect; // C++ language dialect. if (flags.contains(QLatin1String("--ec++"))) cxxLanguageDialect = LanguageOnePageOptions::EmbeddedCPlusPlus; else if (flags.contains(QLatin1String("--eec++"))) cxxLanguageDialect = LanguageOnePageOptions::ExtendedEmbeddedCPlusPlus; // Language conformance. if (flags.contains(QLatin1String("-e"))) languageConformance = LanguageOnePageOptions::AllowIarExtension; else if (flags.contains(QLatin1String("--strict"))) languageConformance = LanguageOnePageOptions::StrictStandard; else languageConformance = LanguageOnePageOptions::RelaxedStandard; allowVla = flags.contains(QLatin1String("--vla")); useCppInlineSemantics = flags.contains( QLatin1String("--use_c++_inline")); requirePrototypes = flags.contains( QLatin1String("--require_prototypes")); destroyStaticObjects = !flags.contains( QLatin1String("--no_static_destruction")); } LanguageExtension languageExtension = AutoLanguageExtension; CLanguageDialect cLanguageDialect = C99LanguageDialect; CxxLanguageDialect cxxLanguageDialect = EmbeddedCPlusPlus; LanguageConformance languageConformance = AllowIarExtension; int allowVla = 0; int useCppInlineSemantics = 0; int requirePrototypes = 0; int destroyStaticObjects = 0; }; // Language two page options. struct LanguageTwoPageOptions final { enum PlainCharacter { SignedCharacter, UnsignedCharacter }; enum FloatingPointSemantic { StrictSemantic, RelaxedSemantic }; explicit LanguageTwoPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); plainCharacter = flags.contains(QLatin1String("--char_is_signed")) ? LanguageTwoPageOptions::SignedCharacter : LanguageTwoPageOptions::UnsignedCharacter; floatingPointSemantic = flags.contains(QLatin1String("--relaxed_fp")) ? LanguageTwoPageOptions::RelaxedSemantic : LanguageTwoPageOptions::StrictSemantic; enableMultibyteSupport = flags.contains( QLatin1String("--enable_multibytes")); guardCalls = flags.contains( QLatin1String("--guard_calls")); } PlainCharacter plainCharacter = UnsignedCharacter; FloatingPointSemantic floatingPointSemantic = StrictSemantic; int enableMultibyteSupport = 0; int guardCalls = 0; }; // Code page options. struct CodePageOptions final { enum Utilization { UtilizationNormalUse, UtilizationRegVarVariables, UtilizationNotUsed }; explicit CodePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); // Detect R4 utilization. if (flags.contains(QLatin1String("--lock_r4"))) r4utilization = UtilizationNotUsed; else if (flags.contains(QLatin1String("--regvar_r4"))) r4utilization = UtilizationRegVarVariables; // Detect R5 utilization. if (flags.contains(QLatin1String("--lock_r5"))) r5utilization = UtilizationNotUsed; else if (flags.contains(QLatin1String("--regvar_r54"))) r5utilization = UtilizationRegVarVariables; // Detect reduce stack usage. reduceStackUsage = flags.contains( QLatin1String("--reduce_stack_usage")); // Detect 20-bit context save on interrupt. save20BitContextOnInterrupt = flags.contains( QLatin1String("--save_reg20")); } Utilization r4utilization = UtilizationNormalUse; Utilization r5utilization = UtilizationNormalUse; int reduceStackUsage = 0; int save20BitContextOnInterrupt = 0; }; // Optimizations page options. struct OptimizationsPageOptions final { // Optimizations level radio-buttons with // combo-box on "level" widget. enum Strategy { StrategyBalanced, StrategySize, StrategySpeed }; enum Level { LevelNone, LevelLow, LevelMedium, LevelHigh }; enum LevelSlave { LevelSlave0, LevelSlave1, LevelSlave2, LevelSlave3 }; explicit OptimizationsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString optimization = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("optimization")); if (optimization == QLatin1String("none")) { optimizationStrategy = OptimizationsPageOptions::StrategyBalanced; optimizationLevel = OptimizationsPageOptions::LevelNone; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave0; } else if (optimization == QLatin1String("fast")) { optimizationStrategy = OptimizationsPageOptions::StrategySpeed; optimizationLevel = OptimizationsPageOptions::LevelHigh; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave3; } else if (optimization == QLatin1String("small")) { optimizationStrategy = OptimizationsPageOptions::StrategySize; optimizationLevel = OptimizationsPageOptions::LevelHigh; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave3; } const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); disableSizeConstraints = flags.contains( QLatin1String("--no_size_constraints")); enableCommonSubexpressionElimination = !flags.contains( QLatin1String("--no_cse")); enableLoopUnroll = !flags.contains(QLatin1String("--no_unroll")); enableFunctionInlining = !flags.contains(QLatin1String("--no_inline")); enableCodeMotion = !flags.contains(QLatin1String("--no_code_motion")); enableTypeBasedAliasAnalysis = !flags.contains( QLatin1String("--no_tbaa")); } Strategy optimizationStrategy = StrategyBalanced; Level optimizationLevel = LevelNone; LevelSlave optimizationLevelSlave = LevelSlave0; // Separate "no size constraints" checkbox. int disableSizeConstraints = 0; // Five bit-field flags on "enabled transformations" widget. int enableCommonSubexpressionElimination = 0; // Common sub-expression elimination. int enableLoopUnroll = 0; // Loop unrolling. int enableFunctionInlining = 0; // Function inlining. int enableCodeMotion = 0; // Code motion. int enableTypeBasedAliasAnalysis = 0; // Type based alias analysis. }; // Preprocessor page options. struct PreprocessorPageOptions final { explicit PreprocessorPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); defineSymbols = gen::utils::cppVariantModuleProperties( qbsProps, {QStringLiteral("defines")}); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); const QStringList fullIncludePaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("includePaths"), QStringLiteral("systemIncludePaths")}); for (const QString &fullIncludePath : fullIncludePaths) { const QFileInfo includeFileInfo(fullIncludePath); const QString includeFilePath = includeFileInfo.absoluteFilePath(); if (includeFilePath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, includeFilePath); includePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, includeFilePath); includePaths.push_back(path); } } } QVariantList defineSymbols; QVariantList includePaths; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); warningsAsErrors = gen::utils::cppIntegerModuleProperty( qbsProps, QStringLiteral("treatWarningsAsErrors")); } int warningsAsErrors = 0; }; } // namespace //Msp430CompilerSettingsGroup Msp430CompilerSettingsGroup::Msp430CompilerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("ICC430")); setArchiveVersion(kCompilerArchiveVersion); setDataVersion(kCompilerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildOutputPage(qbsProduct); buildLanguageOnePage(qbsProduct); buildLanguageTwoPage(qbsProduct); buildOptimizationsPage(qbsProduct); buildPreprocessorPage(buildRootDirectory, qbsProduct); buildDiagnosticsPage(qbsProduct); } void Msp430CompilerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'CCDebugInfo' item (Generate debug info). addOptionsGroup(QByteArrayLiteral("CCDebugInfo"), {opts.debugInfo}); } void Msp430CompilerSettingsGroup::buildLanguageOnePage( const ProductData &qbsProduct) { const LanguageOnePageOptions opts(qbsProduct); // Add 'IccLang' item with 'auto-extension based' // value (Language: C/C++/Auto). addOptionsGroup(QByteArrayLiteral("IccLang"), {opts.languageExtension}); // Add 'IccCDialect' item (C dialect: c89/99/11). addOptionsGroup(QByteArrayLiteral("IccCDialect"), {opts.cLanguageDialect}); // Add 'IccCppDialect' item (C++ dialect: embedded/extended). addOptionsGroup(QByteArrayLiteral("IccCppDialect"), {opts.cxxLanguageDialect}); // Add 'CCExt' item // (Language conformance: IAR/relaxed/strict). addOptionsGroup(QByteArrayLiteral("CCExt"), {opts.languageConformance}); // Add 'IccAllowVLA' item (Allow VLA). addOptionsGroup(QByteArrayLiteral("IccAllowVLA"), {opts.allowVla}); // Add 'IccCppInlineSemantics' item (C++ inline semantics). addOptionsGroup(QByteArrayLiteral("IccCppInlineSemantics"), {opts.useCppInlineSemantics}); // Add 'IccRequirePrototypes' item (Require prototypes). addOptionsGroup(QByteArrayLiteral("CCRequirePrototypes"), {opts.requirePrototypes}); // Add 'IccStaticDestr' item (Destroy static objects). addOptionsGroup(QByteArrayLiteral("IccStaticDestr"), {opts.destroyStaticObjects}); } void Msp430CompilerSettingsGroup::buildLanguageTwoPage( const ProductData &qbsProduct) { const LanguageTwoPageOptions opts(qbsProduct); // Add 'IccCharIs' item (Plain char is: signed/unsigned). addOptionsGroup(QByteArrayLiteral("CCCharIs"), {opts.plainCharacter}); // Add 'IccFloatSemantics' item (Floatic-point // semantics: strict/relaxed conformance). addOptionsGroup(QByteArrayLiteral("IccFloatSemantics"), {opts.floatingPointSemantic}); // Add 'IccMultibyteSupport' item (Enable multibyte support). addOptionsGroup(QByteArrayLiteral("CCMultibyteSupport"), {opts.enableMultibyteSupport}); // Add 'CCGuardCalls' and 'OCGuardCallsSlave' item (Guard calls). addOptionsGroup(QByteArrayLiteral("CCGuardCalls"), {opts.guardCalls}); } void Msp430CompilerSettingsGroup::buildCodePage( const ProductData &qbsProduct) { const CodePageOptions opts(qbsProduct); // Add 'OCCR4Utilize' item // (R4 utilization: normal/regvar/disabled). addOptionsGroup(QByteArrayLiteral("OCCR4Utilize"), {opts.r4utilization}); // Add 'OCCR5Utilize' item // (R5 utilization: normal/regvar/disabled). addOptionsGroup(QByteArrayLiteral("OCCR5Utilize"), {opts.r5utilization}); // Add 'ReduceStack' item // (Reduce stack usage). addOptionsGroup(QByteArrayLiteral("ReduceStack"), {opts.reduceStackUsage}); // Add 'Save20bit' item // (20-bit context save on interrupt). addOptionsGroup(QByteArrayLiteral("Save20bit"), {opts.save20BitContextOnInterrupt}); } void Msp430CompilerSettingsGroup::buildOptimizationsPage( const ProductData &qbsProduct) { const OptimizationsPageOptions opts(qbsProduct); // Add 'CCOptStrategy', 'CCOptLevel' and // 'CCOptLevelSlave' items (Level). addOptionsGroup(QByteArrayLiteral("CCOptStrategy"), {opts.optimizationStrategy}); addOptionsGroup(QByteArrayLiteral("CCOptLevel"), {opts.optimizationLevel}); addOptionsGroup(QByteArrayLiteral("CCOptLevelSlave"), {opts.optimizationLevelSlave}); // Add 'CCOptimizationNoSizeConstraints' item (no size constraints). addOptionsGroup(QByteArrayLiteral("CCOptimizationNoSizeConstraints"), {opts.disableSizeConstraints}); // Add 'CCAllowList' item // (Enabled transformations: 5 check boxes). const QString bitflags = QStringLiteral("%1%2%3%4%5%6") .arg(opts.enableCommonSubexpressionElimination) .arg(opts.enableLoopUnroll) .arg(opts.enableFunctionInlining) .arg(opts.enableCodeMotion) .arg(opts.enableTypeBasedAliasAnalysis); addOptionsGroup(QByteArrayLiteral("CCAllowList"), {bitflags}); } void Msp430CompilerSettingsGroup::buildPreprocessorPage( const QString &baseDirectory, const ProductData &qbsProduct) { const PreprocessorPageOptions opts(baseDirectory, qbsProduct); // Add 'CCDefines' item (Defines symbols). addOptionsGroup(QByteArrayLiteral("CCDefines"), opts.defineSymbols); // Add 'newCCIncludePaths' item // (Additional include directories). addOptionsGroup(QByteArrayLiteral("newCCIncludePaths"), opts.includePaths); } void Msp430CompilerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'CCDiagWarnAreErr' item (Treat all warnings as errors). addOptionsGroup(QByteArrayLiteral("CCDiagWarnAreErr"), {opts.warningsAsErrors}); } } // namespace v7 } // namespace msp430 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/msp430assemblersettingsgroup_v7.cpp0000644000175100017510000002013515154533055031100 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msp430assemblersettingsgroup_v7.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace msp430 { namespace v7 { constexpr int kAssemblerArchiveVersion = 5; constexpr int kAssemblerDataVersion = 14; namespace { // Language page options. struct LanguagePageOptions final { enum MacroQuoteCharacter { AngleBracketsQuote, RoundBracketsQuote, SquareBracketsQuote, FigureBracketsQuote }; explicit LanguagePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("assemblerFlags")}); enableSymbolsCaseSensitive = flags.contains( QLatin1String("-s+")); enableMultibyteSupport = flags.contains( QLatin1String("-n")); if (flags.contains(QLatin1String("-M<>"))) macroQuoteCharacter = LanguagePageOptions::AngleBracketsQuote; else if (flags.contains(QLatin1String("-M()"))) macroQuoteCharacter = LanguagePageOptions::RoundBracketsQuote; else if (flags.contains(QLatin1String("-M[]"))) macroQuoteCharacter = LanguagePageOptions::SquareBracketsQuote; else if (flags.contains(QLatin1String("-M{}"))) macroQuoteCharacter = LanguagePageOptions::FigureBracketsQuote; } int enableSymbolsCaseSensitive = 1; int enableMultibyteSupport = 0; MacroQuoteCharacter macroQuoteCharacter = AngleBracketsQuote; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { debugInfo = gen::utils::debugInformation(qbsProduct); } int debugInfo = 0; }; // Preprocessor page options. struct PreprocessorPageOptions final { explicit PreprocessorPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); defineSymbols = gen::utils::cppVariantModuleProperties( qbsProps, {QStringLiteral("defines")}); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); const QStringList fullIncludePaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("includePaths"), QStringLiteral("systemIncludePaths")}); for (const auto &fullIncludePath : fullIncludePaths) { const QFileInfo includeFileInfo(fullIncludePath); const QString includeFilePath = includeFileInfo.absoluteFilePath(); if (includeFilePath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, includeFilePath); includePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, includeFilePath); includePaths.push_back(path); } } } QVariantList defineSymbols; QVariantList includePaths; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString warningLevel = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("warningLevel")); if (warningLevel == QLatin1String("all")) { enableWarnings = 0; enableAllWarnings = 0; } else if (warningLevel == QLatin1String("none")) { enableWarnings = 1; enableAllWarnings = 0; } else { enableWarnings = 0; enableAllWarnings = 1; } } int enableWarnings = 0; int enableAllWarnings = 0; }; } // namespace //Msp430AssemblerSettingsGroup Msp430AssemblerSettingsGroup::Msp430AssemblerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("A430")); setArchiveVersion(kAssemblerArchiveVersion); setDataVersion(kAssemblerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildLanguagePage(qbsProduct); buildOutputPage(qbsProduct); buildPreprocessorPage(buildRootDirectory, qbsProduct); buildDiagnosticsPage(qbsProduct); } void Msp430AssemblerSettingsGroup::buildLanguagePage( const ProductData &qbsProduct) { const LanguagePageOptions opts(qbsProduct); // Add 'ACaseSensitivity' item (User symbols are case sensitive). addOptionsGroup(QByteArrayLiteral("ACaseSensitivity"), {opts.enableSymbolsCaseSensitive}); // Add 'AMultibyteSupport' item (Enable multibyte support). addOptionsGroup(QByteArrayLiteral("AMultibyteSupport"), {opts.enableMultibyteSupport}); // Add 'MacroChars' item (Macro quote characters: ()/[]/{}/<>). addOptionsGroup(QByteArrayLiteral("MacroChars"), {opts.macroQuoteCharacter}); } void Msp430AssemblerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'ADebug' item (Generate debug information). addOptionsGroup(QByteArrayLiteral("ADebug"), {opts.debugInfo}); } void Msp430AssemblerSettingsGroup::buildPreprocessorPage( const QString &baseDirectory, const ProductData &qbsProduct) { const PreprocessorPageOptions opts(baseDirectory, qbsProduct); // Add 'ADefines' item (Defined symbols). addOptionsGroup(QByteArrayLiteral("ADefines"), opts.defineSymbols); // Add 'AUserIncludes' item (Additional include directories). addOptionsGroup(QByteArrayLiteral("AUserIncludes"), opts.includePaths); } void Msp430AssemblerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'AWarnEnable' item (Enable/disable warnings). addOptionsGroup(QByteArrayLiteral("AWarnEnable"), {opts.enableWarnings}); // Add 'AWarnWhat' item (Enable/disable all warnings). addOptionsGroup(QByteArrayLiteral("AWarnWhat"), {opts.enableAllWarnings}); } } // namespace v7 } // namespace msp430 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/msp430/msp430archiversettingsgroup_v7.cpp0000644000175100017510000000634315154533055030733 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "msp430archiversettingsgroup_v7.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace msp430 { namespace v7 { constexpr int kArchiverArchiveVersion = 4; constexpr int kArchiverDataVersion = 0; namespace { // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { outputFile = QLatin1String("$PROJ_DIR$/") + gen::utils::targetBinaryPath(baseDirectory, qbsProduct); } QString outputFile; }; } // namespace //Msp430ArchiverSettingsGroup Msp430ArchiverSettingsGroup::Msp430ArchiverSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("XAR")); setArchiveVersion(kArchiverArchiveVersion); setDataVersion(kArchiverDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildOutputPage(buildRootDirectory, qbsProduct); } void Msp430ArchiverSettingsGroup::buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct) { const OutputPageOptions opts(baseDirectory, qbsProduct); // Add 'XAROutOverride' item (Override default). addOptionsGroup(QByteArrayLiteral("XAROutOverride"), {1}); // Add 'OutputFile' item (Output filename). addOptionsGroup(QByteArrayLiteral("OutputFile"), {opts.outputFile}); } } // namespace v7 } // namespace msp430 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/0000755000175100017510000000000015154533055022077 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/mcs51archiversettingsgroup_v10.cpp0000644000175100017510000000627315154533055030613 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51archiversettingsgroup_v10.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace mcs51 { namespace v10 { constexpr int kArchiverArchiveVersion = 2; constexpr int kArchiverDataVersion = 1; namespace { // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { outputFile = QLatin1String("$PROJ_DIR$/") + gen::utils::targetBinaryPath(baseDirectory, qbsProduct); } QString outputFile; }; } // namespace // Mcs51ArchiverSettingsGroup Mcs51ArchiverSettingsGroup::Mcs51ArchiverSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("XAR")); setArchiveVersion(kArchiverArchiveVersion); setDataVersion(kArchiverDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildOutputPage(buildRootDirectory, qbsProduct); } void Mcs51ArchiverSettingsGroup::buildOutputPage( const QString &baseDirectory, const ProductData &qbsProduct) { const OutputPageOptions opts(baseDirectory, qbsProduct); // Add 'XAROverride' item (Override default). addOptionsGroup(QByteArrayLiteral("XAROverride"), {1}); // Add 'XAROutput2' item (Output filename). addOptionsGroup(QByteArrayLiteral("XAROutput2"), {opts.outputFile}); } } // namespace v10 } // namespace mcs51 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/mcs51compilersettingsgroup_v10.cpp0000644000175100017510000004421615154533055030621 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51compilersettingsgroup_v10.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace mcs51 { namespace v10 { constexpr int kCompilerArchiveVersion = 7; constexpr int kCompilerDataVersion = 12; namespace { // Output page options. struct OutputPageOptions final { enum ModuleType { ProgramModule, LibraryModule }; explicit OutputPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); moduleType = flags.contains(QLatin1String("--library_module")) ? OutputPageOptions::LibraryModule : OutputPageOptions::ProgramModule; debugInfo = gen::utils::debugInformation(qbsProduct); } int debugInfo = 0; ModuleType moduleType = ProgramModule; }; // Language one page options. struct LanguageOnePageOptions final { enum LanguageExtension { CLanguageExtension, CxxLanguageExtension, AutoLanguageExtension }; enum CLanguageDialect { C89LanguageDialect, C99LanguageDialect }; enum CxxLanguageDialect { EmbeddedCPlusPlus, ExtendedEmbeddedCPlusPlus }; enum LanguageConformance { AllowIarExtension, RelaxedStandard, StrictStandard }; explicit LanguageOnePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); // File extension based by default. languageExtension = LanguageOnePageOptions::AutoLanguageExtension; // C language dialect. const QStringList cLanguageVersion = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("cLanguageVersion")}); cLanguageDialect = cLanguageVersion.contains(QLatin1String("c89")) ? LanguageOnePageOptions::C89LanguageDialect : LanguageOnePageOptions::C99LanguageDialect; // C++ language dialect. if (flags.contains(QLatin1String("--ec++"))) cxxLanguageDialect = LanguageOnePageOptions::EmbeddedCPlusPlus; else if (flags.contains(QLatin1String("--eec++"))) cxxLanguageDialect = LanguageOnePageOptions::ExtendedEmbeddedCPlusPlus; // Language conformance. if (flags.contains(QLatin1String("-e"))) languageConformance = LanguageOnePageOptions::AllowIarExtension; else if (flags.contains(QLatin1String("--strict"))) languageConformance = LanguageOnePageOptions::StrictStandard; else languageConformance = LanguageOnePageOptions::RelaxedStandard; allowVla = flags.contains(QLatin1String("--vla")); useCppInlineSemantics = flags.contains( QLatin1String("--use_c++_inline")); requirePrototypes = flags.contains( QLatin1String("--require_prototypes")); destroyStaticObjects = !flags.contains( QLatin1String("--no_static_destruction")); } LanguageExtension languageExtension = AutoLanguageExtension; CLanguageDialect cLanguageDialect = C89LanguageDialect; CxxLanguageDialect cxxLanguageDialect = EmbeddedCPlusPlus; LanguageConformance languageConformance = AllowIarExtension; int allowVla = 0; int useCppInlineSemantics = 0; int requirePrototypes = 0; int destroyStaticObjects = 0; }; // Language two page options. struct LanguageTwoPageOptions final { enum PlainCharacter { SignedCharacter, UnsignedCharacter }; enum FloatingPointSemantic { StrictSemantic, RelaxedSemantic }; explicit LanguageTwoPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); plainCharacter = flags.contains( QLatin1String("--char_is_signed")) ? LanguageTwoPageOptions::SignedCharacter : LanguageTwoPageOptions::UnsignedCharacter; floatingPointSemantic = flags.contains( QLatin1String("--relaxed_fp")) ? LanguageTwoPageOptions::RelaxedSemantic : LanguageTwoPageOptions::StrictSemantic; enableMultibyteSupport = flags.contains( QLatin1String("--enable_multibytes")); } PlainCharacter plainCharacter = SignedCharacter; FloatingPointSemantic floatingPointSemantic = StrictSemantic; int enableMultibyteSupport = 0; }; // Optimizations page options. struct OptimizationsPageOptions final { // Optimizations level radio-buttons with combo-box // on "level" widget. enum Strategy { StrategyBalanced, StrategySize, StrategySpeed }; enum Level { LevelNone, LevelLow, LevelMedium, LevelHigh }; enum LevelSlave { LevelSlave0, LevelSlave1, LevelSlave2, LevelSlave3 }; explicit OptimizationsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString optimization = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("optimization")); if (optimization == QLatin1String("none")) { optimizationStrategy = OptimizationsPageOptions::StrategyBalanced; optimizationLevel = OptimizationsPageOptions::LevelNone; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave0; } else if (optimization == QLatin1String("fast")) { optimizationStrategy = OptimizationsPageOptions::StrategySpeed; optimizationLevel = OptimizationsPageOptions::LevelHigh; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave3; } else if (optimization == QLatin1String("small")) { optimizationStrategy = OptimizationsPageOptions::StrategySize; optimizationLevel = OptimizationsPageOptions::LevelHigh; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave3; } const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); enableCommonSubexpressionElimination = !flags.contains( QLatin1String("--no_cse")); enableLoopUnroll = !flags.contains(QLatin1String("--no_unroll")); enableFunctionInlining = !flags.contains(QLatin1String("--no_inline")); enableCodeMotion = !flags.contains(QLatin1String("--no_code_motion")); enableTypeBasedAliasAnalysis = !flags.contains( QLatin1String("--no_tbaa")); enableCrossCall = !flags.contains(QLatin1String("--no_cross_call")); disableRegisterBanks = flags.contains( QLatin1String("--disable_register_banks")); disableSizeConstrains = flags.contains( QLatin1String("--no_size_constraints")); } Strategy optimizationStrategy = StrategyBalanced; Level optimizationLevel = LevelNone; LevelSlave optimizationLevelSlave = LevelSlave0; // Seven bit-field flags on "enabled transformations" widget. int enableCommonSubexpressionElimination = 0; // Common sub-expression elimination. int enableLoopUnroll = 0; // Loop unrolling. int enableFunctionInlining = 0; // Function inlining. int enableCodeMotion = 0; // Code motion. int enableTypeBasedAliasAnalysis = 0; // Type based alias analysis. int enableCrossCall = 0; // Cross call optimization. int disableRegisterBanks = 0; // Disabled register banks. int disableSizeConstrains = 0; // No size constraints. }; // Preprocessor page options. struct PreprocessorPageOptions final { explicit PreprocessorPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); // TODO: Need to exclude the pre-defined maroses which are handled // in 'General Options'. defineSymbols = gen::utils::cppVariantModuleProperties( qbsProps, {QStringLiteral("defines")}); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); const QStringList fullIncludePaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("includePaths"), QStringLiteral("systemIncludePaths")}); const QString dlibToolkitPath = IarewUtils::dlibToolkitRootPath(qbsProduct); for (const QString &fullIncludePath : fullIncludePaths) { const QFileInfo includeFileInfo(fullIncludePath); const QString includeFilePath = includeFileInfo.absoluteFilePath(); // Exclude dlib config includes because it already handled in // 'General Options->Library configuration page'. if (includeFilePath.startsWith(dlibToolkitPath)) continue; if (includeFilePath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, includeFilePath); includePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, includeFilePath); includePaths.push_back(path); } } } QVariantList defineSymbols; QVariantList includePaths; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); warningsAsErrors = gen::utils::cppIntegerModuleProperty( qbsProps, QStringLiteral("treatWarningsAsErrors")); } int warningsAsErrors = 0; }; // Code page options. struct CodePageOptions final { explicit CodePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); paddingForRomMonitorBreakpoints = flags.contains( QLatin1String("--rom_mon_bp_padding")); excludeUbrofMessagesInOutput = flags.contains( QLatin1String("--no_ubrof_messages")); } int paddingForRomMonitorBreakpoints = 0; int excludeUbrofMessagesInOutput = 0; }; } // namespace // Mcs51CompilerSettingsGroup Mcs51CompilerSettingsGroup::Mcs51CompilerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProject) Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("ICC8051")); setArchiveVersion(kCompilerArchiveVersion); setDataVersion(kCompilerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildOutputPage(qbsProduct); buildLanguageOnePage(qbsProduct); buildLanguageTwoPage(qbsProduct); buildOptimizationsPage(qbsProduct); buildPreprocessorPage(buildRootDirectory, qbsProduct); buildDiagnosticsPage(qbsProduct); } void Mcs51CompilerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'CCDebugInfo' item (Generate debug info). addOptionsGroup(QByteArrayLiteral("CCDebugInfo"), {opts.debugInfo}); // Add 'CCOverrideModuleTypeDefault' item // (Override default module type). addOptionsGroup(QByteArrayLiteral("CCOverrideModuleTypeDefault"), {1}); // Add 'CCRadioModuleType' item (Module type: program/library). addOptionsGroup(QByteArrayLiteral("CCRadioModuleType"), {opts.moduleType}); } void Mcs51CompilerSettingsGroup::buildLanguageOnePage( const ProductData &qbsProduct) { const LanguageOnePageOptions opts(qbsProduct); // Add 'IccLang' item with 'auto-extension based' // value (Language: C/C++/Auto). addOptionsGroup(QByteArrayLiteral("IccLang"), {opts.languageExtension}); // Add 'IccCDialect' item (C dialect: c89/99/11). addOptionsGroup(QByteArrayLiteral("IccCDialect"), {opts.cLanguageDialect}); // Add 'IccCppDialect' item (C++ dialect: embedded/extended). addOptionsGroup(QByteArrayLiteral("IccCppDialect"), {opts.cxxLanguageDialect}); // Add 'CCExt' item (Language conformance: IAR/relaxed/strict). addOptionsGroup(QByteArrayLiteral("LangConform"), {opts.languageConformance}); // Add 'IccAllowVLA' item (Allow VLA). addOptionsGroup(QByteArrayLiteral("IccAllowVLA"), {opts.allowVla}); // Add 'IccCppInlineSemantics' item (C++ inline semantics). addOptionsGroup(QByteArrayLiteral("IccCppInlineSemantics"), {opts.useCppInlineSemantics}); // Add 'CCRequirePrototypes' item (Require prototypes). addOptionsGroup(QByteArrayLiteral("CCRequirePrototypes"), {opts.requirePrototypes}); // Add 'IccStaticDestr' item (Destroy static objects). addOptionsGroup(QByteArrayLiteral("IccStaticDestr"), {opts.destroyStaticObjects}); } void Mcs51CompilerSettingsGroup::buildLanguageTwoPage( const ProductData &qbsProduct) { const LanguageTwoPageOptions opts(qbsProduct); // Add 'CharIs' item (Plain char is: signed/unsigned). addOptionsGroup(QByteArrayLiteral("CharIs"), {opts.plainCharacter}); // Add 'IccFloatSemantics' item // (Floatic-point semantics: strict/relaxed conformance). addOptionsGroup(QByteArrayLiteral("IccFloatSemantics"), {opts.floatingPointSemantic}); // Add 'CCMultibyteSupport' item (Enable multibyte support). addOptionsGroup(QByteArrayLiteral("CCMultibyteSupport"), {opts.enableMultibyteSupport}); } void Mcs51CompilerSettingsGroup::buildOptimizationsPage( const ProductData &qbsProduct) { const OptimizationsPageOptions opts(qbsProduct); // Add 'CCOptStrategy', 'CCOptLevel' and // 'CCOptLevelSlave' items (Level). addOptionsGroup(QByteArrayLiteral("CCOptStrategy"), {opts.optimizationStrategy}); addOptionsGroup(QByteArrayLiteral("CCOptLevel"), {opts.optimizationLevel}); addOptionsGroup(QByteArrayLiteral("CCOptLevelSlave"), {opts.optimizationLevelSlave}); // Add 'CCAllowList2' item (Enabled transformations: 7 check boxes). const QString transformations = QStringLiteral("%1%2%3%4%5%6%7") .arg(opts.enableCommonSubexpressionElimination) .arg(opts.enableLoopUnroll) .arg(opts.enableFunctionInlining) .arg(opts.enableCodeMotion) .arg(opts.enableTypeBasedAliasAnalysis) .arg(opts.enableCrossCall) .arg(opts.disableRegisterBanks); addOptionsGroup(QByteArrayLiteral("CCAllowList2"), {transformations}); // Add 'NoSizeConstraints' item (No size constraints). addOptionsGroup(QByteArrayLiteral("NoSizeConstraints"), {opts.disableSizeConstrains}); } void Mcs51CompilerSettingsGroup::buildPreprocessorPage( const QString &baseDirectory, const ProductData &qbsProduct) { const PreprocessorPageOptions opts(baseDirectory, qbsProduct); // Add 'CCDefines' item (Defines symbols). addOptionsGroup(QByteArrayLiteral("CCDefines"), opts.defineSymbols); // Add 'CCIncludePath2' item (Additional include directories). addOptionsGroup(QByteArrayLiteral("CCIncludePath2"), opts.includePaths); } void Mcs51CompilerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'CCDiagWarnAreErr' item (Treat all warnings as errors). addOptionsGroup(QByteArrayLiteral("CCDiagWarnAreErr"), {opts.warningsAsErrors}); } void Mcs51CompilerSettingsGroup::buildCodePage( const ProductData &qbsProduct) { const CodePageOptions opts(qbsProduct); // Add 'RomMonBpPadding' item (Padding for ROM-monitor breakpoints). addOptionsGroup(QByteArrayLiteral("RomMonBpPadding"), {opts.paddingForRomMonitorBreakpoints}); // Add 'NoUBROFMessages' item (No UBROF messages in output files). addOptionsGroup(QByteArrayLiteral("NoUBROFMessages"), {opts.excludeUbrofMessagesInOutput}); } } // namespace v10 } // namespace mcs51 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/mcs51generalsettingsgroup_v10.cpp0000644000175100017510000012510115154533055030415 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51generalsettingsgroup_v10.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace mcs51 { namespace v10 { constexpr int kGeneralArchiveVersion = 4; constexpr int kGeneralDataVersion = 9; namespace { // Target page options. struct TargetPageOptions final { enum CpuCore { CorePlain = 1, CoreExtended1, CoreExtended2 }; enum CodeModel { CodeModelNear = 1, CodeModelBanked, CodeModelFar, CodeModelBankedExtended2 }; enum DataModel { DataModelTiny = 0, DataModelSmall, DataModelLarge, DataModelGeneric, DataModelFarGeneric, DataModelFar }; enum ConstantsMemoryPlacement { RamMemoryPlace = 0, RomMemoryPlace, CodeMemoryPlace }; enum CallingConvention { DataOverlayConvention = 0, IDataOverlayConvention, IDataReentrantConvention, PDataReentrantConvention, XDataReentrantConvention, ExtendedStackReentrantConvention }; explicit TargetPageOptions(const ProductData &qbsProduct) { chipInfoPath = detectChipInfoPath(qbsProduct); const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); // Should be parsed before the 'code_model' and // 'data_model' options, as that options are depends on it. const QString core = IarewUtils::flagValue( flags, QStringLiteral("--core")) .toLower(); // If the core variant is not set, then choose the // default value, CorePlain (see the compiler datasheet for // '--core' option). if (core == QLatin1String("plain") || core.isEmpty()) { cpuCore = TargetPageOptions::CorePlain; } else if (core == QLatin1String("extended1")) { cpuCore = TargetPageOptions::CoreExtended1; } else if (core == QLatin1String("extended2")) { cpuCore = TargetPageOptions::CoreExtended2; } const QString cm = IarewUtils::flagValue( flags, QStringLiteral("--code_model")) .toLower(); if (cm == QLatin1String("near")) { codeModel = TargetPageOptions::CodeModelNear; } else if (cm == QLatin1String("banked")) { codeModel = TargetPageOptions::CodeModelBanked; } else if (cm == QLatin1String("far")) { codeModel = TargetPageOptions::CodeModelFar; } else if (cm == QLatin1String("banked_ext2")) { codeModel = TargetPageOptions::CodeModelBankedExtended2; } else if (cm.isEmpty()) { // If the code model is not set, then choose the // default values (see the compiler datasheet for // '--code_model' option). if (cpuCore == TargetPageOptions::CorePlain) codeModel = TargetPageOptions::CodeModelNear; else if (cpuCore == TargetPageOptions::CoreExtended1) codeModel = TargetPageOptions::CodeModelFar; else if (cpuCore == TargetPageOptions::CoreExtended2) codeModel = TargetPageOptions::CodeModelBankedExtended2; } const QString dm = IarewUtils::flagValue( flags, QStringLiteral("--data_model")).toLower(); if (dm == QLatin1String("tiny")) { dataModel = TargetPageOptions::DataModelTiny; } else if (dm == QLatin1String("small")) { dataModel = TargetPageOptions::DataModelSmall; } else if (dm == QLatin1String("large")) { dataModel = TargetPageOptions::DataModelLarge; } else if (dm == QLatin1String("generic")) { dataModel = TargetPageOptions::DataModelGeneric; } else if (dm == QLatin1String("far_generic")) { dataModel = TargetPageOptions::DataModelFarGeneric; } else if (dm == QLatin1String("far")) { dataModel = TargetPageOptions::DataModelFar; } else if (dm.isEmpty()) { // If the data model is not set, then choose the // default values (see the compiler datasheet for // '--data_model' option). if (cpuCore == TargetPageOptions::CorePlain) dataModel = TargetPageOptions::DataModelSmall; else if (cpuCore == TargetPageOptions::CoreExtended1) dataModel = TargetPageOptions::DataModelFar; else if (cpuCore == TargetPageOptions::CoreExtended2) dataModel = TargetPageOptions::DataModelLarge; } useExtendedStack = flags.contains(QLatin1String("--extended_stack")); const int regsCount = IarewUtils::flagValue( flags, QStringLiteral("--nr_virtual_regs")) .toInt(); enum { MinVRegsCount = 8, MaxVRegsCount = 32, VRegsOffset = 8 }; // The registers index starts with 0: 0 - means 8 registers, // 1 - means 9 registers and etc. Any invalid values we interpret // as a default value in 8 registers. virtualRegisters = (regsCount < MinVRegsCount || regsCount > MaxVRegsCount) ? 0 : (regsCount - VRegsOffset); const QString constPlace = IarewUtils::flagValue( flags, QStringLiteral("--place_constants")) .toLower(); // If this option is not set, then choose the // default value (see the compiler datasheet for // '--place_constants' option). if (constPlace == QLatin1String("data") || constPlace.isEmpty()) { constPlacement = TargetPageOptions::RamMemoryPlace; } else if (constPlace == QLatin1String("data_rom")) { constPlacement = TargetPageOptions::RomMemoryPlace; } else if (constPlace == QLatin1String("code")) { constPlacement = TargetPageOptions::CodeMemoryPlace; } const QString cc = IarewUtils::flagValue( flags, QStringLiteral("--calling_convention")).toLower(); if (cc == QLatin1String("data_overlay")) { callingConvention = TargetPageOptions::DataOverlayConvention; } else if (cc == QLatin1String("idata_overlay")) { callingConvention = TargetPageOptions::IDataOverlayConvention; } else if (cc == QLatin1String("idata_reentrant") || cc.isEmpty()) { // If this option is not set, then choose the // default value (see the compiler datasheet for // '--calling_convention' option). callingConvention = TargetPageOptions::IDataReentrantConvention; } else if (cc == QLatin1String("pdata_reentrant")) { callingConvention = TargetPageOptions::PDataReentrantConvention; } else if (cc == QLatin1String("xdata_reentrant")) { callingConvention = TargetPageOptions::XDataReentrantConvention; } else if (cc == QLatin1String("ext_stack_reentrant")) { callingConvention = TargetPageOptions::ExtendedStackReentrantConvention; } } // Trying to indirectly detect and build the chip config path, // which uses to show a device name in "Device information" group box. static QString detectChipInfoPath(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); QVariantList configPaths; // Enumerate all product linker config files // (which are set trough '-f' option). const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); configPaths << IarewUtils::flagValues(flags, QStringLiteral("-f")); // Enumerate all product linker config files // (which are set trough 'linkerscript' tag). for (const auto &qbsGroup : qbsProduct.groups()) { const auto qbsArtifacts = qbsGroup.sourceArtifacts(); for (const auto &qbsArtifact : qbsArtifacts) { const auto qbsTags = qbsArtifact.fileTags(); if (!qbsTags.contains(QLatin1String("linkerscript"))) continue; const auto configPath = qbsArtifact.filePath(); // Skip duplicates. if (configPaths.contains(configPath)) continue; configPaths << qbsArtifact.filePath(); } } const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); for (const QVariant &configPath : std::as_const(configPaths)) { const QString fullConfigPath = configPath.toString(); // We interested only in a config paths shipped inside of a toolkit. if (!fullConfigPath.startsWith(toolkitPath, Qt::CaseInsensitive)) continue; // Extract the chip name from the linker script name. const int underscoreIndex = fullConfigPath.lastIndexOf(QLatin1Char('_')); if (underscoreIndex == -1) continue; const int dotIndex = fullConfigPath.lastIndexOf(QLatin1Char('.')); if (dotIndex == -1) continue; if (dotIndex <= underscoreIndex) continue; const QString chipName = fullConfigPath.mid( underscoreIndex + 1, dotIndex - underscoreIndex - 1); // Construct full chip info path. const QFileInfo fullChipInfoPath(QFileInfo(fullConfigPath).absolutePath() + QLatin1Char('/') + chipName + QLatin1String(".i51")); if (fullChipInfoPath.exists()) return fullChipInfoPath.absoluteFilePath(); } return {}; } QString chipInfoPath; CpuCore cpuCore = CorePlain; CodeModel codeModel = CodeModelNear; DataModel dataModel = DataModelTiny; int useExtendedStack = 0; int virtualRegisters = 0; ConstantsMemoryPlacement constPlacement = RamMemoryPlace; CallingConvention callingConvention = DataOverlayConvention; }; // System page options. struct StackHeapPageOptions final { explicit StackHeapPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList defineSymbols = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("defines")}); const QStringList linkerFlags = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("driverLinkerFlags")}); idataStack = IarewUtils::flagValue( defineSymbols, QStringLiteral("_IDATA_STACK_SIZE")); if (idataStack.isEmpty()) idataStack = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D_IDATA_STACK_SIZE")); if (idataStack.isEmpty()) idataStack = QLatin1String("0x40"); // Default IDATA stack size. pdataStack = IarewUtils::flagValue( defineSymbols, QStringLiteral("_PDATA_STACK_SIZE")); if (pdataStack.isEmpty()) pdataStack = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D_PDATA_STACK_SIZE")); if (pdataStack.isEmpty()) pdataStack = QLatin1String("0x80"); // Default PDATA stack size. xdataStack = IarewUtils::flagValue( defineSymbols, QStringLiteral("_XDATA_STACK_SIZE")); if (xdataStack.isEmpty()) xdataStack = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D_XDATA_STACK_SIZE")); if (xdataStack.isEmpty()) xdataStack = QLatin1String("0xEFF"); // Default XDATA stack size. extendedStack = IarewUtils::flagValue( defineSymbols, QStringLiteral("_EXTENDED_STACK_SIZE")); if (extendedStack.isEmpty()) extendedStack = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D_EXTENDED_STACK_SIZE")); if (extendedStack.isEmpty()) extendedStack = QLatin1String("0x3FF"); // Default EXTENDED stack size. xdataHeap = IarewUtils::flagValue( defineSymbols, QStringLiteral("_XDATA_HEAP_SIZE")); if (xdataHeap.isEmpty()) xdataHeap = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D_XDATA_HEAP_SIZE")); if (xdataHeap.isEmpty()) xdataHeap = QLatin1String("0xFF"); // Default XDATA heap size. farHeap = IarewUtils::flagValue( defineSymbols, QStringLiteral("_FAR_HEAP_SIZE")); if (farHeap.isEmpty()) farHeap = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D_FAR_HEAP_SIZE")); if (farHeap.isEmpty()) farHeap = QLatin1String("0xFFF"); // Default FAR heap size. far22Heap = IarewUtils::flagValue( defineSymbols, QStringLiteral("_FAR22_HEAP_SIZE")); if (far22Heap.isEmpty()) far22Heap = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D_FAR22_HEAP_SIZE")); if (far22Heap.isEmpty()) far22Heap = QLatin1String("0xFFF"); // Default FAR22 heap size. hugeHeap = IarewUtils::flagValue( defineSymbols, QStringLiteral("_HUGE_HEAP_SIZE")); if (hugeHeap.isEmpty()) hugeHeap = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D_HUGE_HEAP_SIZE")); if (hugeHeap.isEmpty()) hugeHeap = QLatin1String("0xFFF"); // Default HUGE heap size. extStackAddress = IarewUtils::flagValue( defineSymbols, QStringLiteral("?ESP")); if (extStackAddress.isEmpty()) extStackAddress = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D?ESP")); if (extStackAddress.isEmpty()) extStackAddress = QLatin1String("0x9B"); // Default extended stack pointer address. extStackMask = IarewUtils::flagValue( defineSymbols, QStringLiteral("?ESP_MASK")); if (extStackMask.isEmpty()) extStackMask = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D?ESP_MASK")); if (extStackMask.isEmpty()) extStackMask = QLatin1String("0x03"); // Default extended stack pointer mask. } // Stack sizes. QString idataStack; QString pdataStack; QString xdataStack; QString extendedStack; // Heap sizes. QString xdataHeap; QString farHeap; QString far22Heap; QString hugeHeap; // Extended stack. QString extStackAddress; QString extStackMask; int extStackOffset = 0; int extStackStartAddress = 0; }; // Data pointer page options. struct DptrPageOptions final { enum DptrSize { Dptr16, Dptr24 }; enum DptrVisibility { DptrShadowed, DptrSeparate }; enum SwitchMethod { DptrIncludeMethod, DptrMaskMethod }; explicit DptrPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); const QString core = IarewUtils::flagValue( flags, QStringLiteral("--core")); const QString dptr = IarewUtils::flagValue( flags, QStringLiteral("--dptr")); enum ValueIndex { SizeIndex, NumbersIndex, VisibilityIndex, SwitchMethodIndex }; const QStringList dptrparts = dptr.split(QLatin1Char(',')); for (auto index = 0; index < dptrparts.count(); ++index) { const QString part = dptrparts.at(index).toLower(); switch (index) { case SizeIndex: if (part == QLatin1String("16")) { dptrSize = DptrPageOptions::Dptr16; } else if (part == QLatin1String("24")) { dptrSize = DptrPageOptions::Dptr24; } else { // If this option is not set, then choose the // default value (see the compiler datasheet for // '--dptr' option). if (core == QLatin1String("extended1")) dptrSize = DptrPageOptions::Dptr24; else dptrSize = DptrPageOptions::Dptr16; } break; case NumbersIndex: { const int count = part.toInt(); if (count < 1 || count > 8) { // If this option is not set, then choose the // default value (see the compiler datasheet for // '--dptr' option). if (core == QLatin1String("extended1")) dptrsCountIndex = 1; // 2 DPTR's else dptrsCountIndex = 0; // 1 DPTR's } else { dptrsCountIndex = (count - 1); // DPTR's count - 1 } } break; case VisibilityIndex: if (part == QLatin1String("shadowed")) dptrVisibility = DptrPageOptions::DptrShadowed; else if (part == QLatin1String("separate") || part.isEmpty()) { // If this option is not set or set to "separate", then choose the // default value (see the compiler datasheet for // '--dptr' option). dptrVisibility = DptrPageOptions::DptrSeparate; } break; case SwitchMethodIndex: if (part == QLatin1String("inc")) { dptrSwitchMethod = DptrPageOptions::DptrIncludeMethod; } else if (part.startsWith(QLatin1String("xor"))) { dptrSwitchMethod = DptrPageOptions::DptrMaskMethod; const int firstIndex = part.indexOf(QLatin1Char('(')); const int lastIndex = part.indexOf(QLatin1Char(')')); dptrMask = part.mid(firstIndex + 1, part.size() - lastIndex); } else { // If this option is not set, then choose the // default value (see the compiler datasheet for // '--dptr' option). if (core == QLatin1String("extended1")) { dptrSwitchMethod = DptrPageOptions::DptrIncludeMethod; } else if (core == QLatin1String("plain")) { dptrSwitchMethod = DptrPageOptions::DptrMaskMethod; dptrMask = QLatin1String("0x01"); } } break; default: break; } } const QStringList defineSymbols = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("defines")}); const QStringList linkerFlags = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("driverLinkerFlags")}); dptrPbank = IarewUtils::flagValue( defineSymbols, QStringLiteral("?PBANK")); if (dptrPbank.isEmpty()) dptrPbank = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D?PBANK")); if (dptrPbank.isEmpty()) dptrPbank = QLatin1String("0x93"); // Default 8-15 regs address. dptrPbankExt = IarewUtils::flagValue( defineSymbols, QStringLiteral("?PBANK_EXT")); if (dptrPbankExt.isEmpty()) dptrPbankExt = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D?PBANK_EXT")); dpsAddress = IarewUtils::flagValue( defineSymbols, QStringLiteral("?DPS")); if (dpsAddress.isEmpty()) dpsAddress = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D?DPS")); dpcAddress = IarewUtils::flagValue( defineSymbols, QStringLiteral("?DPC")); if (dpcAddress.isEmpty()) dpcAddress = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D?DPC")); for (auto index = 0; index < 8; ++index) { if (index == 0) { QString dpxAddress = IarewUtils::flagValue( defineSymbols, QStringLiteral("?DPX")); if (dpxAddress.isEmpty()) dpxAddress = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D?DPX")); if (!dpxAddress.isEmpty()) dpxAddress.prepend(QLatin1String("-D?DPX=")); if (!dptrAddresses.contains(dpxAddress)) dptrAddresses.push_back(dpxAddress); } else { QString dplAddress = IarewUtils::flagValue( defineSymbols, QStringLiteral("?DPL%1").arg(index)); if (dplAddress.isEmpty()) dplAddress = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D?DPL%1").arg(index)); if (!dplAddress.isEmpty()) dplAddress.prepend(QStringLiteral("-D?DPL%1=").arg(index)); if (!dptrAddresses.contains(dplAddress)) dptrAddresses.push_back(dplAddress); QString dphAddress = IarewUtils::flagValue( defineSymbols, QStringLiteral("?DPH%1").arg(index)); if (dphAddress.isEmpty()) dphAddress = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D?DPH%1").arg(index)); if (!dphAddress.isEmpty()) dphAddress.prepend(QStringLiteral("-D?DPH%1=").arg(index)); if (!dptrAddresses.contains(dphAddress)) dptrAddresses.push_back(dphAddress); QString dpxAddress = IarewUtils::flagValue( defineSymbols, QStringLiteral("?DPX%1").arg(index)); if (dpxAddress.isEmpty()) dpxAddress = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D?DPX%1").arg(index)); if (!dpxAddress.isEmpty()) dpxAddress.prepend(QStringLiteral("-D?DPX%1=").arg(index)); if (!dptrAddresses.contains(dpxAddress)) dptrAddresses.push_back(dpxAddress); } } } int dptrsCountIndex = 0; DptrSize dptrSize = Dptr16; DptrVisibility dptrVisibility = DptrShadowed; SwitchMethod dptrSwitchMethod = DptrIncludeMethod; QString dptrMask; QString dptrPbank; QString dptrPbankExt; QString dpsAddress; QString dpcAddress; QStringList dptrAddresses; }; // Code bank page options. struct CodeBankPageOptions final { explicit CodeBankPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList defineSymbols = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("defines")}); const QStringList linkerFlags = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("driverLinkerFlags")}); banksCount = IarewUtils::flagValue( defineSymbols, QStringLiteral("_NR_OF_BANKS")); if (banksCount.isEmpty()) banksCount = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D_NR_OF_BANKS")); if (banksCount.isEmpty()) banksCount = QLatin1String("0x03"); registerAddress = IarewUtils::flagValue( defineSymbols, QStringLiteral("?CBANK")); if (registerAddress.isEmpty()) registerAddress = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D?CBANK")); if (registerAddress.isEmpty()) registerAddress = QLatin1String("0xF0"); registerMask = IarewUtils::flagValue( defineSymbols, QStringLiteral("?CBANK_MASK")); if (registerMask.isEmpty()) registerMask = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D?CBANK_MASK")); if (registerMask.isEmpty()) registerMask = QLatin1String("0xFF"); bankStart = IarewUtils::flagValue( defineSymbols, QStringLiteral("_CODEBANK_START")); if (bankStart.isEmpty()) bankStart = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D_CODEBANK_START")); if (bankStart.isEmpty()) bankStart = QLatin1String("0x8000"); bankEnd = IarewUtils::flagValue( defineSymbols, QStringLiteral("_CODEBANK_END")); if (bankEnd.isEmpty()) bankEnd = IarewUtils::flagValue( linkerFlags, QStringLiteral("-D_CODEBANK_END")); if (bankEnd.isEmpty()) bankEnd = QLatin1String("0xFFFF"); } QString banksCount; QString registerAddress; QString registerMask; QString bankStart; QString bankEnd; }; // Library options page options. struct LibraryOptionsPageOptions final { enum PrintfFormatter { PrintfAutoFormatter = 0, PrintfLargeFormatter = 3, PrintfMediumFormatter = 5, PrintfSmallFormatter = 6 }; enum ScanfFormatter { ScanfAutoFormatter = 0, ScanfLargeFormatter = 3, ScanfMediumFormatter = 5 }; explicit LibraryOptionsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); for (const QString &flag : flags) { if (flag.endsWith(QLatin1String("_formatted_write"), Qt::CaseInsensitive)) { const QString prop = flag.split( QLatin1Char('=')).at(0).toLower(); // see the compiler datasheet for the '_formatted_write' option. if (prop == QLatin1String("-e_large_write")) printfFormatter = LibraryOptionsPageOptions::PrintfLargeFormatter; else if (prop == QLatin1String("-e_medium_write")) printfFormatter = LibraryOptionsPageOptions::PrintfMediumFormatter; else if (prop == QLatin1String("-e_small_write")) printfFormatter = LibraryOptionsPageOptions::PrintfSmallFormatter; } else if (flag.endsWith(QLatin1String("_formatted_read"), Qt::CaseInsensitive)) { const QString prop = flag.split(QLatin1Char('=')) .at(0).toLower(); // see the compiler datasheet for the '_formatted_read' option. if (prop == QLatin1String("-e_large_read")) scanfFormatter = LibraryOptionsPageOptions::ScanfLargeFormatter; else if (prop == QLatin1String("-e_medium_read")) scanfFormatter = LibraryOptionsPageOptions::ScanfMediumFormatter; } } } PrintfFormatter printfFormatter = PrintfAutoFormatter; ScanfFormatter scanfFormatter = ScanfAutoFormatter; }; // Library configuration page options. struct LibraryConfigPageOptions final { enum RuntimeLibrary { NoLibrary, NormalDlibLibrary, CustomDlibLibrary, ClibLibrary, CustomClibLibrary }; explicit LibraryConfigPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); const QStringList libraryPaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("staticLibraries")}); const auto libraryBegin = libraryPaths.cbegin(); const auto libraryEnd = libraryPaths.cend(); const QFileInfo dlibConfigInfo(IarewUtils::flagValue( flags, QStringLiteral("--dlib_config"))); const QString dlibConfigFilePath = dlibConfigInfo.absoluteFilePath(); if (!dlibConfigFilePath.isEmpty()) { const QString dlibToolkitPath = IarewUtils::dlibToolkitRootPath( qbsProduct); if (dlibConfigFilePath.startsWith(dlibToolkitPath, Qt::CaseInsensitive)) { libraryType = LibraryConfigPageOptions::NormalDlibLibrary; configPath = IarewUtils::toolkitRelativeFilePath( baseDirectory, dlibConfigFilePath); // Find dlib library inside of IAR toolkit directory. const auto libraryIt = std::find_if(libraryBegin, libraryEnd, [dlibToolkitPath]( const QString &libraryPath) { return libraryPath.startsWith(dlibToolkitPath); }); if (libraryIt != libraryEnd) { // This means that dlib library is 'standard' (placed inside // of IAR toolkit directory). libraryPath = IarewUtils::toolkitRelativeFilePath( baseDirectory, *libraryIt); } } else { // This means that dlib library is 'custom' // (but we don't know its path). libraryType = LibraryConfigPageOptions::CustomDlibLibrary; configPath = IarewUtils::projectRelativeFilePath( baseDirectory, dlibConfigFilePath); } } else { // Find clib library inside of IAR toolkit directory. const QString clibToolkitPath = IarewUtils::clibToolkitRootPath( qbsProduct); const auto libraryIt = std::find_if(libraryBegin, libraryEnd, [clibToolkitPath]( const QString &libraryPath) { return libraryPath.startsWith(clibToolkitPath); }); if (libraryIt != libraryEnd) { // This means that clib library is 'standard' (placed inside // of IAR toolkit directory). libraryType = LibraryConfigPageOptions::ClibLibrary; libraryPath = IarewUtils::toolkitRelativeFilePath( baseDirectory, *libraryIt); } else { // This means that no any libraries are used . libraryType = LibraryConfigPageOptions::NoLibrary; } } } RuntimeLibrary libraryType = NoLibrary; QString configPath; QString libraryPath; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { binaryType = IarewUtils::outputBinaryType(qbsProduct); binaryDirectory = gen::utils::binaryOutputDirectory( baseDirectory, qbsProduct); objectDirectory = gen::utils::objectsOutputDirectory( baseDirectory, qbsProduct); listingDirectory = gen::utils::listingOutputDirectory( baseDirectory, qbsProduct); } IarewUtils::OutputBinaryType binaryType = IarewUtils::ApplicationOutputType; QString binaryDirectory; QString objectDirectory; QString listingDirectory; }; } // namespace // Mcs51GeneralSettingsGroup Mcs51GeneralSettingsGroup::Mcs51GeneralSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProject) Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("General")); setArchiveVersion(kGeneralArchiveVersion); setDataVersion(kGeneralDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildTargetPage(qbsProduct); buildStackHeapPage(qbsProduct); buildDataPointerPage(qbsProduct); buildCodeBankPage(qbsProduct); buildLibraryOptionsPage(qbsProduct); buildLibraryConfigPage(buildRootDirectory, qbsProduct); buildOutputPage(buildRootDirectory, qbsProduct); } void Mcs51GeneralSettingsGroup::buildTargetPage( const ProductData &qbsProduct) { const TargetPageOptions opts(qbsProduct); // Add 'OGChipConfigPath' item (Device: ). addOptionsGroup(QByteArrayLiteral("OGChipConfigPath"), {opts.chipInfoPath}); // Add 'CPU Core' and 'CPU Core Slave' items // (CPU core: plain/extended{1|2}). addOptionsGroup(QByteArrayLiteral("CPU Core"), {opts.cpuCore}); addOptionsGroup(QByteArrayLiteral("CPU Core Slave"), {opts.cpuCore}); // Add 'Code Memory Model' and 'Code Memory Model slave' items // (Code model: near/banked/far/banked extended). addOptionsGroup(QByteArrayLiteral("Code Memory Model"), {opts.codeModel}); addOptionsGroup(QByteArrayLiteral("Code Memory Model slave"), {opts.codeModel}); // Add 'Data Memory Model' and 'Data Memory Model slave' items // (Data model: tiny/small/large/generic/far). addOptionsGroup(QByteArrayLiteral("Data Memory Model"), {opts.dataModel}); addOptionsGroup(QByteArrayLiteral("Data Memory Model slave"), {opts.dataModel}); // Add 'Use extended stack' and 'Use extended stack slave' items // (Use extended stack). addOptionsGroup(QByteArrayLiteral("Use extended stack"), {opts.useExtendedStack}); addOptionsGroup(QByteArrayLiteral("Use extended stack slave"), {opts.useExtendedStack}); // Add 'Workseg Size' item (Number of virtual registers: 8...32). addOptionsGroup(QByteArrayLiteral("Workseg Size"), {opts.virtualRegisters}); // Add 'Constant Placement' item // (Location of constants and strings: ram/rom/code memories). addOptionsGroup(QByteArrayLiteral("Constant Placement"), {opts.constPlacement}); // Add 'Calling convention' item (Calling convention). addOptionsGroup(QByteArrayLiteral("Calling convention"), {opts.callingConvention}); } void Mcs51GeneralSettingsGroup::buildStackHeapPage( const ProductData &qbsProduct) { const StackHeapPageOptions opts(qbsProduct); // Add 'General Idata Stack Size' item (Stack size: IDATA). addOptionsGroup(QByteArrayLiteral("General Idata Stack Size"), {opts.idataStack}); // Add 'General Pdata Stack Size' item (Stack size: PDATA). addOptionsGroup(QByteArrayLiteral("General Pdata Stack Size"), {opts.pdataStack}); // Add 'General Xdata Stack Size' item (Stack size: XDATA). addOptionsGroup(QByteArrayLiteral("General Xdata Stack Size"), {opts.xdataStack}); // Add 'General Ext Stack Size' item (Stack size: Extended). addOptionsGroup(QByteArrayLiteral("General Ext Stack Size"), {opts.extendedStack}); // Add 'General Xdata Heap Size' item (Heap size: XDATA). addOptionsGroup(QByteArrayLiteral("General Xdata Heap Size"), {opts.xdataHeap}); // Add 'General Far Heap Size' item (Heap size: Far). addOptionsGroup(QByteArrayLiteral("General Far Heap Size"), {opts.farHeap}); // Add 'General Far22 Heap Size' item (Heap size: Far22). addOptionsGroup(QByteArrayLiteral("General Far22 Heap Size"), {opts.far22Heap}); // Add 'General Huge Heap Size' item (Heap size: Huge). addOptionsGroup(QByteArrayLiteral("General Huge Heap Size"), {opts.hugeHeap}); // Add 'Extended stack address' item // (Extended stack pointer address). addOptionsGroup(QByteArrayLiteral("Extended stack address"), {opts.extStackAddress}); // Add 'Extended stack mask' item (Extended stack pointer mask). addOptionsGroup(QByteArrayLiteral("Extended stack mask"), {opts.extStackMask}); // Add 'Extended stack is offset' item // (Extended stack pointer is an offset). addOptionsGroup(QByteArrayLiteral("Extended stack is offset"), {opts.extStackOffset}); } void Mcs51GeneralSettingsGroup::buildDataPointerPage( const ProductData &qbsProduct) { const DptrPageOptions opts(qbsProduct); // Add 'Nr of Datapointers' item (Number of DPTRs: 1...8). addOptionsGroup(QByteArrayLiteral("Nr of Datapointers"), {opts.dptrsCountIndex}); // Add 'Datapointer Size' item (DPTR size: 16/24). addOptionsGroup(QByteArrayLiteral("Datapointer Size"), {opts.dptrSize}); // Add 'Sfr Visibility' item (DPTR address: shadowed/separate). addOptionsGroup(QByteArrayLiteral("Sfr Visibility"), {opts.dptrVisibility}); // Add 'Switch Method' item (Switch method: inc/mask). addOptionsGroup(QByteArrayLiteral("Switch Method"), {opts.dptrSwitchMethod}); // Add 'Mask Value' item (Switch method mask). addOptionsGroup(QByteArrayLiteral("Mask Value"), {opts.dptrMask}); // Add 'PDATA 8-15 register address' item (Page register // address (for bits 8-15). addOptionsGroup(QByteArrayLiteral("PDATA 8-15 register address"), {opts.dptrPbank}); // Add 'PDATA 16-31 register address' item (Page register // address (for bits 16-31). addOptionsGroup(QByteArrayLiteral("PDATA 16-31 register address"), {opts.dptrPbankExt}); // Add 'DPS Address' item (Selected DPTR register). addOptionsGroup(QByteArrayLiteral("DPS Address"), {opts.dpsAddress}); // Add 'DPC Address' item (Separate DPTR control register). addOptionsGroup(QByteArrayLiteral("DPC Address"), {opts.dpcAddress}); // Add 'DPTR Addresses' item (DPTR addresses: Low/High/Ext). const QString dptrAddresses = opts.dptrAddresses.join(QLatin1Char(' ')); addOptionsGroup(QByteArrayLiteral("DPTR Addresses"), {dptrAddresses}); } void Mcs51GeneralSettingsGroup::buildCodeBankPage( const ProductData &qbsProduct) { const CodeBankPageOptions opts(qbsProduct); // Add 'CodeBankReg' item (Register address). addOptionsGroup(QByteArrayLiteral("CodeBankReg"), {opts.registerAddress}); // Add 'CodeBankRegMask' item (Register mask). addOptionsGroup(QByteArrayLiteral("CodeBankRegMask"), {opts.registerMask}); // Add 'CodeBankNrOfs' item (Number of banks). addOptionsGroup(QByteArrayLiteral("CodeBankNrOfs"), {opts.banksCount}); // Add 'CodeBankStart' item (Bank start). addOptionsGroup(QByteArrayLiteral("CodeBankStart"), {opts.bankStart}); // Add 'CodeBankSize' item (Bank end). addOptionsGroup(QByteArrayLiteral("CodeBankSize"), {opts.bankEnd}); } void Mcs51GeneralSettingsGroup::buildLibraryOptionsPage( const ProductData &qbsProduct) { const LibraryOptionsPageOptions opts(qbsProduct); // Add 'Output variant' item (Printf formatter). addOptionsGroup(QByteArrayLiteral("Output variant"), {opts.printfFormatter}); // Add 'Input variant' item (Printf formatter). addOptionsGroup(QByteArrayLiteral("Input variant"), {opts.scanfFormatter}); } void Mcs51GeneralSettingsGroup::buildLibraryConfigPage( const QString &baseDirectory, const ProductData &qbsProduct) { const LibraryConfigPageOptions opts(baseDirectory, qbsProduct); // Add 'GRuntimeLibSelect2' and 'GRuntimeLibSelectSlave2' items // (Link with runtime: none/dlib/clib/etc). addOptionsGroup(QByteArrayLiteral("GRuntimeLibSelect2"), {opts.libraryType}); addOptionsGroup(QByteArrayLiteral("GRuntimeLibSelectSlave2"), {opts.libraryType}); // Add 'RTConfigPath' item (Runtime configuration file). addOptionsGroup(QByteArrayLiteral("RTConfigPath"), {opts.configPath}); // Add 'RTLibraryPath' item (Runtime library file). addOptionsGroup(QByteArrayLiteral("RTLibraryPath"), {opts.libraryPath}); } void Mcs51GeneralSettingsGroup::buildOutputPage( const QString &baseDirectory, const ProductData &qbsProduct) { const OutputPageOptions opts(baseDirectory, qbsProduct); // Add 'GOutputBinary' item (Output file: executable/library). addOptionsGroup(QByteArrayLiteral("GOutputBinary"), {opts.binaryType}); // Add 'ExePath' item (Executable/binaries output directory). addOptionsGroup(QByteArrayLiteral("ExePath"), {opts.binaryDirectory}); // Add 'ObjPath' item (Object files output directory). addOptionsGroup(QByteArrayLiteral("ObjPath"), {opts.objectDirectory}); // Add 'ListPath' item (List files output directory). addOptionsGroup(QByteArrayLiteral("ListPath"), {opts.listingDirectory}); } } // namespace v10 } // namespace mcs51 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/mcs51compilersettingsgroup_v10.h0000644000175100017510000000513415154533055030262 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWMCS51COMPILERSETTINGSGROUP_V10_H #define QBS_IAREWMCS51COMPILERSETTINGSGROUP_V10_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace mcs51 { namespace v10 { class Mcs51CompilerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Mcs51CompilerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildOutputPage(const ProductData &qbsProduct); void buildLanguageOnePage(const ProductData &qbsProduct); void buildLanguageTwoPage(const ProductData &qbsProduct); void buildOptimizationsPage(const ProductData &qbsProduct); void buildPreprocessorPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); void buildCodePage(const ProductData &qbsProduct); }; } // namespace v10 } // namespace mcs51 } // namespace iarew } // namespace qbs #endif // QBS_IAREWMCS51COMPILERSETTINGSGROUP_V10_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/mcs51assemblersettingsgroup_v10.h0000644000175100017510000000465115154533055030430 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWMCS51ASSEMBLERSETTINGSGROUP_V10_H #define QBS_IAREWMCS51ASSEMBLERSETTINGSGROUP_V10_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace mcs51 { namespace v10 { class Mcs51AssemblerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Mcs51AssemblerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildLanguagePage(const ProductData &qbsProduct); void buildOutputPage(const ProductData &qbsProduct); void buildPreprocessorPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); }; } // namespace v10 } // namespace mcs51 } // namespace iarew } // namespace qbs #endif // QBS_IAREWMCS51ASSEMBLERSETTINGSGROUP_V10_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/mcs51assemblersettingsgroup_v10.cpp0000644000175100017510000002017615154533055030763 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51assemblersettingsgroup_v10.h" //#include "../../iarewproperty.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace mcs51 { namespace v10 { constexpr int kAssemblerArchiveVersion = 2; constexpr int kAssemblerDataVersion = 6; namespace { // Language page options. struct LanguagePageOptions final { enum MacroQuoteCharacter { AngleBracketsQuote, RoundBracketsQuote, SquareBracketsQuote, FigureBracketsQuote }; explicit LanguagePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("assemblerFlags")}); enableSymbolsCaseSensitive = flags.contains(QLatin1String("-s+")); enableMultibyteSupport = flags.contains(QLatin1String("-n")); if (flags.contains(QLatin1String("-M<>"))) macroQuoteCharacter = LanguagePageOptions::AngleBracketsQuote; else if (flags.contains(QLatin1String("-M()"))) macroQuoteCharacter = LanguagePageOptions::RoundBracketsQuote; else if (flags.contains(QLatin1String("-M[]"))) macroQuoteCharacter = LanguagePageOptions::SquareBracketsQuote; else if (flags.contains(QLatin1String("-M{}"))) macroQuoteCharacter = LanguagePageOptions::FigureBracketsQuote; } MacroQuoteCharacter macroQuoteCharacter = AngleBracketsQuote; int enableSymbolsCaseSensitive = 0; int enableMultibyteSupport = 0; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { debugInfo = gen::utils::debugInformation(qbsProduct); } int debugInfo = 0; }; // Preprocessor page options. struct PreprocessorPageOptions final { explicit PreprocessorPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); defineSymbols = gen::utils::cppVariantModuleProperties( qbsProps, {QStringLiteral("defines")}); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); const QStringList fullIncludePaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("includePaths"), QStringLiteral("systemIncludePaths")}); for (const auto &fullIncludePath : fullIncludePaths) { const QFileInfo includeFileInfo(fullIncludePath); const QString includeFilePath = includeFileInfo.absoluteFilePath(); if (includeFilePath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, includeFilePath); includePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, includeFilePath); includePaths.push_back(path); } } } QVariantList defineSymbols; QVariantList includePaths; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString warningLevel = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("warningLevel")); if (warningLevel == QLatin1String("all")) { enableWarnings = 0; enableAllWarnings = 0; } else if (warningLevel == QLatin1String("none")) { enableWarnings = 1; enableAllWarnings = 0; } else { enableWarnings = 0; enableAllWarnings = 1; } } int enableWarnings = 0; int enableAllWarnings = 0; }; } // namespace // Mcs51AssemblerSettingsGroup Mcs51AssemblerSettingsGroup::Mcs51AssemblerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProject) Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("A8051")); setArchiveVersion(kAssemblerArchiveVersion); setDataVersion(kAssemblerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildLanguagePage(qbsProduct); buildOutputPage(qbsProduct); buildPreprocessorPage(buildRootDirectory, qbsProduct); buildDiagnosticsPage(qbsProduct); } void Mcs51AssemblerSettingsGroup::buildLanguagePage( const ProductData &qbsProduct) { const LanguagePageOptions opts(qbsProduct); // Add 'ACaseSensitivity' item (User symbols are case sensitive). addOptionsGroup(QByteArrayLiteral("ACaseSensitivity"), {opts.enableSymbolsCaseSensitive}); // Add 'Asm multibyte support' item (Enable multibyte support). addOptionsGroup(QByteArrayLiteral("Asm multibyte support"), {opts.enableMultibyteSupport}); // Add 'MacroChars' item (Macro quote characters: ()/[]/{}/<>). addOptionsGroup(QByteArrayLiteral("MacroChars"), {!opts.macroQuoteCharacter}, 0); } void Mcs51AssemblerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'Debug' item (Generate debug information). addOptionsGroup(QByteArrayLiteral("Debug"), {opts.debugInfo}); } void Mcs51AssemblerSettingsGroup::buildPreprocessorPage( const QString &baseDirectory, const ProductData &qbsProduct) { const PreprocessorPageOptions opts(baseDirectory, qbsProduct); // Add 'ADefines' item (Defined symbols). addOptionsGroup(QByteArrayLiteral("ADefines"), opts.defineSymbols); // Add 'Include directories' item (Additional include directories). addOptionsGroup(QByteArrayLiteral("Include directories"), opts.includePaths); } void Mcs51AssemblerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'AWarnEnable' item (Enable/disable warnings). addOptionsGroup(QByteArrayLiteral("AWarnEnable"), {opts.enableWarnings}); // Add 'AWarnWhat' item (Enable/disable all warnings). addOptionsGroup(QByteArrayLiteral("AWarnWhat"), {opts.enableAllWarnings}); } } // namespace v10 } // namespace mcs51 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/mcs51generalsettingsgroup_v10.h0000644000175100017510000000521615154533055030066 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWMCS51GENERALSETTINGSGROUP_V10_H #define QBS_IAREWMCS51GENERALSETTINGSGROUP_V10_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace mcs51 { namespace v10 { class Mcs51GeneralSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Mcs51GeneralSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildTargetPage(const ProductData &qbsProduct); void buildStackHeapPage(const ProductData &qbsProduct); void buildDataPointerPage(const ProductData &qbsProduct); void buildCodeBankPage(const ProductData &qbsProduct); void buildLibraryOptionsPage(const ProductData &qbsProduct); void buildLibraryConfigPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct); }; } // namespace v10 } // namespace mcs51 } // namespace iarew } // namespace qbs #endif // QBS_IAREWMCS51GENERALSETTINGSGROUP_V10_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/mcs51linkersettingsgroup_v10.h0000644000175100017510000000511415154533055027732 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWMCS51LINKERSETTINGSGROUP_V10_H #define QBS_IAREWMCS51LINKERSETTINGSGROUP_V10_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace mcs51 { namespace v10 { class Mcs51LinkerSettingsGroupPrivate; class Mcs51LinkerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Mcs51LinkerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildConfigPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildOutputPage(const ProductData &qbsProduct); void buildListPage(const ProductData &qbsProduct); void buildDefinePage(const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); void buildExtraOptionsPage(const ProductData &qbsProduct); QVariantList m_extraOptions; }; } // namespace v10 } // namespace mcs51 } // namespace iarew } // namespace qbs #endif // QBS_IAREWMCS51LINKERSETTINGSGROUP_V10_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/mcs51buildconfigurationgroup_v10.cpp0000644000175100017510000000737615154533055031123 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51archiversettingsgroup_v10.h" #include "mcs51assemblersettingsgroup_v10.h" #include "mcs51buildconfigurationgroup_v10.h" #include "mcs51compilersettingsgroup_v10.h" #include "mcs51generalsettingsgroup_v10.h" #include "mcs51linkersettingsgroup_v10.h" #include "../../iarewtoolchainpropertygroup.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace mcs51 { namespace v10 { Mcs51BuildConfigurationGroup::Mcs51BuildConfigurationGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) : gen::xml::PropertyGroup("configuration") { // Append configuration name item. const QString cfgName = gen::utils::buildConfigurationName(qbsProject); appendProperty("name", cfgName); // Apend toolchain name group item. appendChild("8051"); // Append debug info item. const int debugBuild = gen::utils::debugInformation(qbsProduct); appendProperty("debug", debugBuild); // Append settings group items. appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); } bool Mcs51BuildConfigurationGroupFactory::canCreate( gen::utils::Architecture arch, const Version &version) const { return arch == gen::utils::Architecture::Mcs51 && version.majorVersion() == 10; } std::unique_ptr Mcs51BuildConfigurationGroupFactory::create( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) const { const auto group = new Mcs51BuildConfigurationGroup( qbsProject, qbsProduct, qbsProductDeps); return std::unique_ptr(group); } } // namespace v10 } // namespace mcs51 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/mcs51buildconfigurationgroup_v10.h0000644000175100017510000000512715154533055030560 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWMCS51BUILDCONFIGURATIONGROUP_V10_H #define QBS_IAREWMCS51BUILDCONFIGURATIONGROUP_V10_H #include namespace qbs { namespace iarew { namespace mcs51 { namespace v10 { class Mcs51BuildConfigurationGroup final : public gen::xml::PropertyGroup { private: explicit Mcs51BuildConfigurationGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); friend class Mcs51BuildConfigurationGroupFactory; }; class Mcs51BuildConfigurationGroupFactory final : public gen::xml::PropertyGroupFactory { public: bool canCreate(gen::utils::Architecture arch, const Version &version) const final; std::unique_ptr create( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) const final; }; } // namespace v10 } // namespace mcs51 } // namespace iarew } // namespace qbs #endif // QBS_IAREWMCS51BUILDCONFIGURATIONGROUP_V10_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/mcs51archiversettingsgroup_v10.h0000644000175100017510000000434615154533055030257 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWMCS51ARCHIVERSETTINGSGROUP_V10_H #define QBS_IAREWMCS51ARCHIVERSETTINGSGROUP_V10_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace mcs51 { namespace v10 { class Mcs51ArchiverSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Mcs51ArchiverSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct); }; } // namespace v10 } // namespace mcs51 } // namespace iarew } // namespace qbs #endif // QBS_IAREWMCS51ARCHIVERSETTINGSGROUP_V10_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/mcs51/mcs51linkersettingsgroup_v10.cpp0000644000175100017510000003005315154533055030265 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51linkersettingsgroup_v10.h" #include "../../iarewutils.h" #include namespace qbs { namespace iarew { namespace mcs51 { namespace v10 { constexpr int kLinkerArchiveVersion = 4; constexpr int kLinkerDataVersion = 21; namespace { // Config page options. struct ConfigPageOptions final { explicit ConfigPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); entryPoint = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("entryPoint")); // Enumerate all product linker config files // (which are set trough 'linkerscript' tag). for (const auto &qbsGroup : qbsProduct.groups()) { const auto qbsArtifacts = qbsGroup.sourceArtifacts(); for (const auto &qbsArtifact : qbsArtifacts) { const auto qbsTags = qbsArtifact.fileTags(); if (!qbsTags.contains(QLatin1String("linkerscript"))) continue; const QString fullConfigPath = qbsArtifact.filePath(); if (fullConfigPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullConfigPath); configFilePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullConfigPath); configFilePaths.push_back(path); } } } // Enumerate all product linker config files // (which are set trough '-f' option). const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); const QVariantList configPathValues = IarewUtils::flagValues( flags, QStringLiteral("-f")); for (const QVariant &configPathValue : configPathValues) { const QString fullConfigPath = configPathValue.toString(); if (fullConfigPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullConfigPath); if (!configFilePaths.contains(path)) configFilePaths.push_back(path); } else { const QString path =IarewUtils::projectRelativeFilePath( baseDirectory, fullConfigPath); if (!configFilePaths.contains(path)) configFilePaths.push_back(path); } } // Add libraries search paths. const QStringList libraryPaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("libraryPaths")}); for (const QString &libraryPath : libraryPaths) { const QFileInfo libraryPathInfo(libraryPath); const QString fullLibrarySearchPath = libraryPathInfo.absoluteFilePath(); if (fullLibrarySearchPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullLibrarySearchPath); librarySearchPaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullLibrarySearchPath); librarySearchPaths.push_back(path); } } } QVariantList configFilePaths; QVariantList librarySearchPaths; QString entryPoint; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { outputFile = gen::utils::targetBinary(qbsProduct); } QString outputFile; }; // List page options. struct ListPageOptions final { enum ListingAction { NoListing, GenerateListing }; explicit ListPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); generateMap = gen::utils::cppBooleanModuleProperty( qbsProps, QStringLiteral("generateLinkerMapFile")) ? ListPageOptions::GenerateListing : ListPageOptions::NoListing; } ListingAction generateMap = NoListing; }; // Define page options. struct DefinePageOptions final { explicit DefinePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); // Enumerate all linker defines. for (const QString &flag : flags) { if (!flag.startsWith(QLatin1String("-D"))) continue; const QString symbol = flag.mid(2); // Ignore system-defined macroses, because its already // handled in "General Options" page. if (symbol.startsWith(QLatin1Char('?')) || symbol.startsWith(QLatin1Char('_')) ) { continue; } defineSymbols.push_back(symbol); } } QVariantList defineSymbols; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString warningLevel = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("warningLevel")); suppressAllWarnings = (warningLevel == QLatin1String("none")); } int suppressAllWarnings = 0; }; } // namespace // Mcs51LinkerSettingsGroup Mcs51LinkerSettingsGroup::Mcs51LinkerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProject) Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("XLINK")); setArchiveVersion(kLinkerArchiveVersion); setDataVersion(kLinkerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildConfigPage(buildRootDirectory, qbsProduct); buildOutputPage(qbsProduct); buildListPage(qbsProduct); buildDefinePage(qbsProduct); buildDiagnosticsPage(qbsProduct); // Should be called as latest stage! buildExtraOptionsPage(qbsProduct); } void Mcs51LinkerSettingsGroup::buildConfigPage( const QString &baseDirectory, const ProductData &qbsProduct) { ConfigPageOptions opts(baseDirectory, qbsProduct); if (opts.configFilePaths.count() > 0) { // Note: IAR IDE does not allow to specify a multiple config files, // although the IAR linker support it. So, we use followig 'trick': // we take a first config file and to add it as usual to required items; // and then an other remainders we forward to the "Extra options page". const QVariant configPath = opts.configFilePaths.takeFirst(); // Add 'XclOverride' item (Override default). addOptionsGroup(QByteArrayLiteral("XclOverride"), {1}); // Add 'XclFile' item (Linke configuration file). addOptionsGroup(QByteArrayLiteral("XclFile"), {configPath}); // Add remainder configuration files to the "Extra options page". if (!opts.configFilePaths.isEmpty()) { for (QVariant &configPath : opts.configFilePaths) configPath = QString(QStringLiteral("-f ") + configPath.toString()); m_extraOptions << opts.configFilePaths; } } // Add 'xcProgramEntryLabel' item (Entry symbol). addOptionsGroup(QByteArrayLiteral("xcProgramEntryLabel"), {opts.entryPoint}); // Add 'xcOverrideProgramEntryLabel' item // (Override default program entry). addOptionsGroup(QByteArrayLiteral("xcOverrideProgramEntryLabel"), {1}); // Add 'xcProgramEntryLabelSelect' item. addOptionsGroup(QByteArrayLiteral("xcProgramEntryLabelSelect"), {0}); // Add 'XIncludes' item (Libraries search paths). addOptionsGroup(QByteArrayLiteral("XIncludes"), opts.librarySearchPaths); } void Mcs51LinkerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'XOutOverride' item (Override default output file). addOptionsGroup(QByteArrayLiteral("XOutOverride"), {1}); // Add 'OutputFile' item (Output file name). addOptionsGroup(QByteArrayLiteral("OutputFile"), {opts.outputFile}); } void Mcs51LinkerSettingsGroup::buildListPage( const ProductData &qbsProduct) { const ListPageOptions opts(qbsProduct); // Add 'XList' item (Generate linker listing). addOptionsGroup(QByteArrayLiteral("XList"), {opts.generateMap}); } void Mcs51LinkerSettingsGroup::buildDefinePage( const ProductData &qbsProduct) { const DefinePageOptions opts(qbsProduct); // Add 'XDefines' item (Defined symbols). addOptionsGroup(QByteArrayLiteral("XDefines"), opts.defineSymbols); } void Mcs51LinkerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'SuppressAllWarn' item (Suppress all warnings). addOptionsGroup(QByteArrayLiteral("SuppressAllWarn"), {opts.suppressAllWarnings}); } void Mcs51LinkerSettingsGroup::buildExtraOptionsPage( const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); for (const QString &flag : flags) { if (flag.startsWith(QLatin1String("-Z"))) m_extraOptions.push_back(flag); } if (!m_extraOptions.isEmpty()) { // Add 'Linker Extra Options Check' (Use command line options). addOptionsGroup(QByteArrayLiteral("Linker Extra Options Check"), {1}); // Add 'Linker Extra Options Edit' item (Command line options). addOptionsGroup(QByteArrayLiteral("Linker Extra Options Edit"), m_extraOptions); } } } // namespace v10 } // namespace mcs51 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/0000755000175100017510000000000015154533055022042 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/stm8compilersettingsgroup_v3.cpp0000644000175100017510000004044315154533055030447 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "stm8compilersettingsgroup_v3.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace stm8 { namespace v3 { constexpr int kCompilerArchiveVersion = 3; constexpr int kCompilerDataVersion = 9; namespace { // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { debugInfo = gen::utils::debugInformation(qbsProduct); } int debugInfo = 0; }; // Language one page options. struct LanguageOnePageOptions final { enum LanguageExtension { CLanguageExtension, CxxLanguageExtension, AutoLanguageExtension }; enum CLanguageDialect { C89LanguageDialect, C99LanguageDialect }; enum CxxLanguageDialect { EmbeddedCPlusPlus, ExtendedEmbeddedCPlusPlus }; enum LanguageConformance { AllowIarExtension, RelaxedStandard, StrictStandard }; explicit LanguageOnePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); // File extension based by default. languageExtension = LanguageOnePageOptions::AutoLanguageExtension; // C language dialect. const QStringList cLanguageVersion = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("cLanguageVersion")}); if (cLanguageVersion.contains(QLatin1String("c89"))) cLanguageDialect = LanguageOnePageOptions::C89LanguageDialect; else if (cLanguageVersion.contains(QLatin1String("c99"))) cLanguageDialect = LanguageOnePageOptions::C99LanguageDialect; // C++ language dialect. if (flags.contains(QLatin1String("--ec++"))) cxxLanguageDialect = LanguageOnePageOptions::EmbeddedCPlusPlus; else if (flags.contains(QLatin1String("--eec++"))) cxxLanguageDialect = LanguageOnePageOptions::ExtendedEmbeddedCPlusPlus; // Language conformance. if (flags.contains(QLatin1String("-e"))) languageConformance = LanguageOnePageOptions::AllowIarExtension; else if (flags.contains(QLatin1String("--strict"))) languageConformance = LanguageOnePageOptions::StrictStandard; else languageConformance = LanguageOnePageOptions::RelaxedStandard; allowVla = flags.contains(QLatin1String("--vla")); useCppInlineSemantics = flags.contains( QLatin1String("--use_c++_inline")); requirePrototypes = flags.contains( QLatin1String("--require_prototypes")); destroyStaticObjects = !flags.contains( QLatin1String("--no_static_destruction")); } LanguageExtension languageExtension = AutoLanguageExtension; CLanguageDialect cLanguageDialect = C99LanguageDialect; CxxLanguageDialect cxxLanguageDialect = EmbeddedCPlusPlus; LanguageConformance languageConformance = AllowIarExtension; int allowVla = 0; int useCppInlineSemantics = 0; int requirePrototypes = 0; int destroyStaticObjects = 0; }; // Language two page options. struct LanguageTwoPageOptions final { enum PlainCharacter { SignedCharacter, UnsignedCharacter }; enum FloatingPointSemantic { StrictSemantic, RelaxedSemantic }; explicit LanguageTwoPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); plainCharacter = flags.contains(QLatin1String("--char_is_signed")) ? LanguageTwoPageOptions::SignedCharacter : LanguageTwoPageOptions::UnsignedCharacter; floatingPointSemantic = flags.contains(QLatin1String("--relaxed_fp")) ? LanguageTwoPageOptions::RelaxedSemantic : LanguageTwoPageOptions::StrictSemantic; enableMultibyteSupport = flags.contains( QLatin1String("--enable_multibytes")); } PlainCharacter plainCharacter = UnsignedCharacter; FloatingPointSemantic floatingPointSemantic = StrictSemantic; int enableMultibyteSupport = 0; }; // Optimizations page options. struct OptimizationsPageOptions final { // Optimizations level radio-buttons with // combo-box on "level" widget. enum Strategy { StrategyBalanced, StrategySize, StrategySpeed }; enum Level { LevelNone, LevelLow, LevelMedium, LevelHigh }; enum LevelSlave { LevelSlave0, LevelSlave1, LevelSlave2, LevelSlave3 }; enum VRegsNumber { VRegs12, VRegs16 }; explicit OptimizationsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString optimization = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("optimization")); if (optimization == QLatin1String("none")) { optimizationStrategy = OptimizationsPageOptions::StrategyBalanced; optimizationLevel = OptimizationsPageOptions::LevelNone; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave0; } else if (optimization == QLatin1String("fast")) { optimizationStrategy = OptimizationsPageOptions::StrategySpeed; optimizationLevel = OptimizationsPageOptions::LevelHigh; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave3; } else if (optimization == QLatin1String("small")) { optimizationStrategy = OptimizationsPageOptions::StrategySize; optimizationLevel = OptimizationsPageOptions::LevelHigh; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave3; } const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); disableSizeConstraints = flags.contains( QLatin1String("--no_size_constraints")); enableCommonSubexpressionElimination = !flags.contains( QLatin1String("--no_cse")); enableLoopUnroll = !flags.contains(QLatin1String("--no_unroll")); enableFunctionInlining = !flags.contains(QLatin1String("--no_inline")); enableCodeMotion = !flags.contains(QLatin1String("--no_code_motion")); enableTypeBasedAliasAnalysis = !flags.contains( QLatin1String("--no_tbaa")); enableCrossCall = !flags.contains(QLatin1String("--no_cross_call")); const auto vregsCount = IarewUtils::flagValue( flags, QStringLiteral("--vregs")).toInt(); if (vregsCount == 12) vregsNumber = VRegs12; else if (vregsCount == 16) vregsNumber = VRegs16; } Strategy optimizationStrategy = StrategyBalanced; Level optimizationLevel = LevelNone; LevelSlave optimizationLevelSlave = LevelSlave0; // Separate "no size constraints" checkbox. int disableSizeConstraints = 0; // Six bit-field flags on "enabled transformations" widget. int enableCommonSubexpressionElimination = 0; // Common sub-expression elimination. int enableLoopUnroll = 0; // Loop unrolling. int enableFunctionInlining = 0; // Function inlining. int enableCodeMotion = 0; // Code motion. int enableTypeBasedAliasAnalysis = 0; // Type based alias analysis. int enableCrossCall = 0; // Cross call. VRegsNumber vregsNumber = VRegs16; }; // Preprocessor page options. struct PreprocessorPageOptions final { explicit PreprocessorPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); defineSymbols = gen::utils::cppVariantModuleProperties( qbsProps, {QStringLiteral("defines")}); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); const QStringList fullIncludePaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("includePaths"), QStringLiteral("systemIncludePaths")}); for (const QString &fullIncludePath : fullIncludePaths) { const QFileInfo includeFileInfo(fullIncludePath); const QString includeFilePath = includeFileInfo.absoluteFilePath(); if (includeFilePath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, includeFilePath); includePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, includeFilePath); includePaths.push_back(path); } } } QVariantList defineSymbols; QVariantList includePaths; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); warningsAsErrors = gen::utils::cppIntegerModuleProperty( qbsProps, QStringLiteral("treatWarningsAsErrors")); } int warningsAsErrors = 0; }; } // namespace // Stm8CompilerSettingsGroup Stm8CompilerSettingsGroup::Stm8CompilerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("ICCSTM8")); setArchiveVersion(kCompilerArchiveVersion); setDataVersion(kCompilerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildOutputPage(qbsProduct); buildLanguageOnePage(qbsProduct); buildLanguageTwoPage(qbsProduct); buildOptimizationsPage(qbsProduct); buildPreprocessorPage(buildRootDirectory, qbsProduct); buildDiagnosticsPage(qbsProduct); } void Stm8CompilerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'IccGenerateDebugInfo' item (Generate debug info). addOptionsGroup(QByteArrayLiteral("IccGenerateDebugInfo"), {opts.debugInfo}); } void Stm8CompilerSettingsGroup::buildLanguageOnePage( const ProductData &qbsProduct) { const LanguageOnePageOptions opts(qbsProduct); // Add 'IccLang' item with 'auto-extension based' // value (Language: C/C++/Auto). addOptionsGroup(QByteArrayLiteral("IccLang"), {opts.languageExtension}); // Add 'IccCDialect' item (C dialect: c89/99/11). addOptionsGroup(QByteArrayLiteral("IccCDialect"), {opts.cLanguageDialect}); // Add 'IccCppDialect' item (C++ dialect: embedded/extended). addOptionsGroup(QByteArrayLiteral("IccCppDialect"), {opts.cxxLanguageDialect}); // Add 'IccLanguageConformance' item // (Language conformance: IAR/relaxed/strict). addOptionsGroup(QByteArrayLiteral("IccLanguageConformance"), {opts.languageConformance}); // Add 'IccAllowVLA' item (Allow VLA). addOptionsGroup(QByteArrayLiteral("IccAllowVLA"), {opts.allowVla}); // Add 'IccCppInlineSemantics' item (C++ inline semantics). addOptionsGroup(QByteArrayLiteral("IccCppInlineSemantics"), {opts.useCppInlineSemantics}); // Add 'IccRequirePrototypes' item (Require prototypes). addOptionsGroup(QByteArrayLiteral("IccRequirePrototypes"), {opts.requirePrototypes}); // Add 'IccStaticDestr' item (Destroy static objects). addOptionsGroup(QByteArrayLiteral("IccStaticDestr"), {opts.destroyStaticObjects}); } void Stm8CompilerSettingsGroup::buildLanguageTwoPage( const ProductData &qbsProduct) { const LanguageTwoPageOptions opts(qbsProduct); // Add 'IccCharIs' item (Plain char is: signed/unsigned). addOptionsGroup(QByteArrayLiteral("IccCharIs"), {opts.plainCharacter}); // Add 'IccFloatSemantics' item (Floatic-point // semantics: strict/relaxed conformance). addOptionsGroup(QByteArrayLiteral("IccFloatSemantics"), {opts.floatingPointSemantic}); // Add 'IccMultibyteSupport' item (Enable multibyte support). addOptionsGroup(QByteArrayLiteral("IccMultibyteSupport"), {opts.enableMultibyteSupport}); } void Stm8CompilerSettingsGroup::buildOptimizationsPage( const ProductData &qbsProduct) { const OptimizationsPageOptions opts(qbsProduct); // Add 'IccOptStrategy', 'IccOptLevel' and // 'CCOptLevelSlave' items (Level). addOptionsGroup(QByteArrayLiteral("IccOptStrategy"), {opts.optimizationStrategy}); addOptionsGroup(QByteArrayLiteral("IccOptLevel"), {opts.optimizationLevel}); addOptionsGroup(QByteArrayLiteral("IccOptLevelSlave"), {opts.optimizationLevelSlave}); // Add 'IccOptNoSizeConstraints' iten (no size constraints). addOptionsGroup(QByteArrayLiteral("IccOptNoSizeConstraints"), {opts.disableSizeConstraints}); // Add 'IccOptAllowList' item // (Enabled optimizations: 6 check boxes). const QString bitflags = QStringLiteral("%1%2%3%4%5%6") .arg(opts.enableCommonSubexpressionElimination) .arg(opts.enableLoopUnroll) .arg(opts.enableFunctionInlining) .arg(opts.enableCodeMotion) .arg(opts.enableTypeBasedAliasAnalysis) .arg(opts.enableCrossCall); addOptionsGroup(QByteArrayLiteral("IccOptAllowList"), {bitflags}); // Add 'IccNoVregs' item // (Number of virtual registers (12/16). addOptionsGroup(QByteArrayLiteral("IccNoVregs"), {opts.vregsNumber}); } void Stm8CompilerSettingsGroup::buildPreprocessorPage( const QString &baseDirectory, const ProductData &qbsProduct) { const PreprocessorPageOptions opts(baseDirectory, qbsProduct); // Add 'CCDefines' item (Defines symbols). addOptionsGroup(QByteArrayLiteral("CCDefines"), opts.defineSymbols); // Add 'CCIncludePath2' item // (Additional include directories). addOptionsGroup(QByteArrayLiteral("CCIncludePath2"), opts.includePaths); } void Stm8CompilerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'CCDiagWarnAreErr' item (Treat all warnings as errors). addOptionsGroup(QByteArrayLiteral("CCDiagWarnAreErr"), {opts.warningsAsErrors}); } } // namespace v3 } // namespace stm8 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/stm8archiversettingsgroup_v3.cpp0000644000175100017510000000634715154533055030445 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "stm8archiversettingsgroup_v3.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace stm8 { namespace v3 { constexpr int kArchiverArchiveVersion = 3; constexpr int kArchiverDataVersion = 0; namespace { // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { outputFile = QLatin1String("$PROJ_DIR$/") + gen::utils::targetBinaryPath(baseDirectory, qbsProduct); } QString outputFile; }; } // namespace // Stm8ArchiverSettingsGroup Stm8ArchiverSettingsGroup::Stm8ArchiverSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("IARCHIVE")); setArchiveVersion(kArchiverArchiveVersion); setDataVersion(kArchiverDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildOutputPage(buildRootDirectory, qbsProduct); } void Stm8ArchiverSettingsGroup::buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct) { const OutputPageOptions opts(baseDirectory, qbsProduct); // Add 'IarchiveOverride' item (Override default). addOptionsGroup(QByteArrayLiteral("IarchiveOverride"), {1}); // Add 'IarchiveOutput' item (Output filename). addOptionsGroup(QByteArrayLiteral("IarchiveOutput"), {opts.outputFile}); } } // namespace v3 } // namespace stm8 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/stm8generalsettingsgroup_v3.h0000644000175100017510000000501115154533055027707 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWSTM8GENERALSETTINGSGROUP_V3_H #define QBS_IAREWSTM8GENERALSETTINGSGROUP_V3_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace stm8 { namespace v3 { class Stm8GeneralSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Stm8GeneralSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildTargetPage(const ProductData &qbsProduct); void buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildLibraryConfigPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildLibraryOptionsPage(const ProductData &qbsProduct); void buildStackHeapPage(const ProductData &qbsProduct); }; } // namespace v3 } // namespace stm8 } // namespace iarew } // namespace qbs #endif // QBS_IAREWSTM8GENERALSETTINGSGROUP_V3_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/stm8compilersettingsgroup_v3.h0000644000175100017510000000503115154533055030106 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWSTM8COMPILERSETTINGSGROUP_V3_H #define QBS_IAREWSTM8COMPILERSETTINGSGROUP_V3_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace stm8 { namespace v3 { class Stm8CompilerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Stm8CompilerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildOutputPage(const ProductData &qbsProduct); void buildLanguageOnePage(const ProductData &qbsProduct); void buildLanguageTwoPage(const ProductData &qbsProduct); void buildOptimizationsPage(const ProductData &qbsProduct); void buildPreprocessorPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); }; } // namespace v3 } // namespace stm8 } // namespace iarew } // namespace qbs #endif // QBS_IAREWSTM8COMPILERSETTINGSGROUP_V3_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/stm8buildconfigurationgroup_v3.h0000644000175100017510000000516015154533055030405 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWSTM8BUILDCONFIGURATIONGROUP_V3_H #define QBS_IAREWSTM8BUILDCONFIGURATIONGROUP_V3_H #include #include namespace qbs { namespace iarew { namespace stm8 { namespace v3 { class Stm8BuildConfigurationGroup final : public gen::xml::PropertyGroup { private: explicit Stm8BuildConfigurationGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); friend class Stm8BuildConfigurationGroupFactory; }; class Stm8BuildConfigurationGroupFactory final : public gen::xml::PropertyGroupFactory { public: bool canCreate(gen::utils::Architecture arch, const Version &version) const final; std::unique_ptr create( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) const final; }; } // namespace v3 } // namespace stm8 } // namespace iarew } // namespace qbs #endif // QBS_IAREWSTM8BUILDCONFIGURATIONGROUP_V3_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/stm8linkersettingsgroup_v3.h0000644000175100017510000000542515154533055027567 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWSTM8LINKERSETTINGSGROUP_V3_H #define QBS_IAREWSTM8LINKERSETTINGSGROUP_V3_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace stm8 { namespace v3 { class Stm8LinkerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Stm8LinkerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildConfigPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildLibraryPage(const QString &baseDirectory, const ProductData &qbsProduct, const std::vector &qbsProductDeps); void buildOptimizationsPage(const ProductData &qbsProduct); void buildOutputPage(const ProductData &qbsProduct); void buildListPage(const ProductData &qbsProduct); void buildDefinePage(const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); void buildExtraOptionsPage(const ProductData &qbsProduct); QVariantList m_extraOptions; }; } // namespace v3 } // namespace stm8 } // namespace iarew } // namespace qbs #endif // QBS_IAREWSTM8LINKERSETTINGSGROUP_V3_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/stm8generalsettingsgroup_v3.cpp0000644000175100017510000003350715154533055030255 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "stm8generalsettingsgroup_v3.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace stm8 { namespace v3 { constexpr int kGeneralArchiveVersion = 4; constexpr int kGeneralDataVersion = 2; namespace { // Target page options. struct TargetPageOptions final { enum CodeModel { SmallCodeModel, MediumCodeModel, LargeCodeModel }; enum DataModel { SmallDataModel, MediumDataModel, LargeDataModel }; explicit TargetPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("driverFlags")}); // Detect target code model. const QString codeModelValue = IarewUtils::flagValue( flags, QStringLiteral("--code_model")); if (codeModelValue == QLatin1String("small")) codeModel = TargetPageOptions::SmallCodeModel; else if (codeModelValue == QLatin1String("medium")) codeModel = TargetPageOptions::MediumCodeModel; else if (codeModelValue == QLatin1String("large")) codeModel = TargetPageOptions::LargeCodeModel; // Detect target data model. const QString dataModelValue = IarewUtils::flagValue( flags, QStringLiteral("--data_model")); if (dataModelValue == QLatin1String("small")) dataModel = TargetPageOptions::SmallDataModel; else if (dataModelValue == QLatin1String("medium")) dataModel = TargetPageOptions::MediumDataModel; else if (dataModelValue == QLatin1String("large")) dataModel = TargetPageOptions::LargeDataModel; } CodeModel codeModel = MediumCodeModel; DataModel dataModel = MediumDataModel; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { binaryType = IarewUtils::outputBinaryType(qbsProduct); binaryDirectory = gen::utils::binaryOutputDirectory( baseDirectory, qbsProduct); objectDirectory = gen::utils::objectsOutputDirectory( baseDirectory, qbsProduct); listingDirectory = gen::utils::listingOutputDirectory( baseDirectory, qbsProduct); } IarewUtils::OutputBinaryType binaryType = IarewUtils::ApplicationOutputType; QString binaryDirectory; QString objectDirectory; QString listingDirectory; }; // Library configuration page options. struct LibraryConfigPageOptions final { enum RuntimeLibrary { NoLibrary, NormalLibrary, FullLibrary, CustomLibrary }; explicit LibraryConfigPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); const QFileInfo configInfo(IarewUtils::flagValue( flags, QStringLiteral("--dlib_config"))); const QString configFilePath = configInfo.absoluteFilePath(); if (!configFilePath.isEmpty()) { const QString libToolkitPath = IarewUtils::libToolkitRootPath(qbsProduct); if (configFilePath.startsWith(libToolkitPath, Qt::CaseInsensitive)) { if (configFilePath.endsWith(QLatin1String("n.h"), Qt::CaseInsensitive)) { libraryType = LibraryConfigPageOptions::NormalLibrary; } else if (configFilePath.endsWith(QLatin1String("f.h"), Qt::CaseInsensitive)) { libraryType = LibraryConfigPageOptions::FullLibrary; } else { libraryType = LibraryConfigPageOptions::CustomLibrary; } configPath = IarewUtils::toolkitRelativeFilePath( baseDirectory, configFilePath); } else { libraryType = LibraryConfigPageOptions::CustomLibrary; configPath = configFilePath; } } else { libraryType = LibraryConfigPageOptions::NoLibrary; } } RuntimeLibrary libraryType = NoLibrary; QString configPath; }; // Library options page options. struct LibraryOptionsPageOptions final { enum PrintfFormatter { PrintfAutoFormatter = 0, PrintfFullFormatter = 1, PrintfFullNoMultibytesFormatter = 2, PrintfLargeFormatter = 3, PrintfLargeNoMultibytesFormatter = 4, PrintfSmallFormatter = 5, PrintfSmallNoMultibytesFormatter = 6, PrintfTinyFormatter = 7 }; enum ScanfFormatter { ScanfAutoFormatter = 0, ScanfFullFormatter = 1, ScanfFullNoMultibytesFormatter = 2, ScanfLargeFormatter = 3, ScanfLargeNoMultibytesFormatter = 4, ScanfSmallFormatter = 5, ScanfSmallNoMultibytesFormatter = 6 }; explicit LibraryOptionsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); for (auto flagIt = flags.cbegin(); flagIt < flags.cend(); ++flagIt) { if (*flagIt != QLatin1String("--redirect")) continue; ++flagIt; if (flagIt->startsWith(QLatin1String("_printf="), Qt::CaseInsensitive)) { const QString prop = flagIt->split( QLatin1Char('=')).at(1).toLower(); if (prop == QLatin1String("_printffull")) printfFormatter = PrintfFullFormatter; else if (prop == QLatin1String("_printffullnomb")) printfFormatter = PrintfFullNoMultibytesFormatter; else if (prop == QLatin1String("_printflarge")) printfFormatter = PrintfLargeNoMultibytesFormatter; else if (prop == QLatin1String("_printflargenomb")) printfFormatter = PrintfLargeFormatter; else if (prop == QLatin1String("_printfsmall")) printfFormatter = PrintfSmallFormatter; else if (prop == QLatin1String("_printfsmallnomb")) printfFormatter = PrintfSmallNoMultibytesFormatter; else if (prop == QLatin1String("_printftiny")) printfFormatter = PrintfTinyFormatter; } else if (flagIt->startsWith(QLatin1String("_scanf="), Qt::CaseInsensitive)) { const QString prop = flagIt->split( QLatin1Char('=')).at(1).toLower(); if (prop == QLatin1String("_scanffull")) scanfFormatter = ScanfFullFormatter; else if (prop == QLatin1String("_scanffullnomb")) scanfFormatter = ScanfFullNoMultibytesFormatter; else if (prop == QLatin1String("_scanflarge")) scanfFormatter = ScanfLargeNoMultibytesFormatter; else if (prop == QLatin1String("_scanflargenomb")) scanfFormatter = ScanfLargeFormatter; else if (prop == QLatin1String("_scanfsmall")) scanfFormatter = ScanfSmallFormatter; else if (prop == QLatin1String("_scanfsmallnomb")) scanfFormatter = ScanfSmallNoMultibytesFormatter; } } } PrintfFormatter printfFormatter = PrintfAutoFormatter; ScanfFormatter scanfFormatter = ScanfAutoFormatter; }; // Stack/heap page options. struct StackHeapPageOptions final { explicit StackHeapPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); const auto configDefs = IarewUtils::flagValues( flags, QStringLiteral("--config_def")); for (const auto &configDef : configDefs) { const auto def = configDef.toString(); if (def.startsWith(QLatin1String("_CSTACK_SIZE="))) { stackSize = def.split(QLatin1Char('=')).at(1); } else if (def.startsWith(QLatin1String("_HEAP_SIZE="))) { heapSize = def.split(QLatin1Char('=')).at(1); } } } QString stackSize; QString heapSize; }; } // namespace // Stm8GeneralSettingsGroup Stm8GeneralSettingsGroup::Stm8GeneralSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("General")); setArchiveVersion(kGeneralArchiveVersion); setDataVersion(kGeneralDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildTargetPage(qbsProduct); buildOutputPage(buildRootDirectory, qbsProduct); buildLibraryConfigPage(buildRootDirectory, qbsProduct); buildLibraryOptionsPage(qbsProduct); buildStackHeapPage(qbsProduct); } void Stm8GeneralSettingsGroup::buildTargetPage( const ProductData &qbsProduct) { const TargetPageOptions opts(qbsProduct); // Add 'GenCodeModel' item // (Code model: small/medium/large). addOptionsGroup(QByteArrayLiteral("GenCodeModel"), {opts.codeModel}); // Add 'GenDataModel' item // (Data model: small/medium/large). addOptionsGroup(QByteArrayLiteral("GenDataModel"), {opts.dataModel}); } void Stm8GeneralSettingsGroup::buildOutputPage( const QString &baseDirectory, const ProductData &qbsProduct) { const OutputPageOptions opts(baseDirectory, qbsProduct); // Add 'GOutputBinary' item (Output file: executable/library). addOptionsGroup(QByteArrayLiteral("GOutputBinary"), {opts.binaryType}); // Add 'ExePath' item (Executable/binaries output directory). addOptionsGroup(QByteArrayLiteral("ExePath"), {opts.binaryDirectory}); // Add 'ObjPath' item (Object files output directory). addOptionsGroup(QByteArrayLiteral("ObjPath"), {opts.objectDirectory}); // Add 'ListPath' item (List files output directory). addOptionsGroup(QByteArrayLiteral("ListPath"), {opts.listingDirectory}); } void Stm8GeneralSettingsGroup::buildLibraryConfigPage( const QString &baseDirectory, const ProductData &qbsProduct) { const LibraryConfigPageOptions opts(baseDirectory, qbsProduct); // Add 'GenRuntimeLibSelect' and 'GenRuntimeLibSelectSlave' items // (Link with runtime: none/normal/full/custom). addOptionsGroup(QByteArrayLiteral("GenRuntimeLibSelect"), {opts.libraryType}); addOptionsGroup(QByteArrayLiteral("GenRuntimeLibSelectSlave"), {opts.libraryType}); // Add 'GenRTConfigPath' item (Runtime configuration file). addOptionsGroup(QByteArrayLiteral("GenRTConfigPath"), {opts.configPath}); } void Stm8GeneralSettingsGroup::buildLibraryOptionsPage( const ProductData &qbsProduct) { const LibraryOptionsPageOptions opts(qbsProduct); // Add 'GenLibOutFormatter' item (Printf formatter). addOptionsGroup(QByteArrayLiteral("GenLibOutFormatter"), {opts.printfFormatter}); // Add 'GenLibInFormatter' item (Scanf formatter). addOptionsGroup(QByteArrayLiteral("GenLibInFormatter"), {opts.scanfFormatter}); } void Stm8GeneralSettingsGroup::buildStackHeapPage( const ProductData &qbsProduct) { const StackHeapPageOptions opts(qbsProduct); // Add 'GenStackSize' item (Stack size). addOptionsGroup(QByteArrayLiteral("GenStackSize"), {opts.stackSize}); // Add 'GenHeapSize' item (Heap size). addOptionsGroup(QByteArrayLiteral("GenHeapSize"), {opts.heapSize}); } } // namespace v3 } // namespace stm8 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/stm8archiversettingsgroup_v3.h0000644000175100017510000000433215154533055030102 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWSTM8ARCHIVERSETTINGSGROUP_V3_H #define QBS_IAREWSTM8ARCHIVERSETTINGSGROUP_V3_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace stm8 { namespace v3 { class Stm8ArchiverSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Stm8ArchiverSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct); }; } // namespace v3 } // namespace stm8 } // namespace iarew } // namespace qbs #endif // QBS_IAREWSTM8ARCHIVERSETTINGSGROUP_V3_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/stm8buildconfigurationgroup_v3.cpp0000644000175100017510000000734115154533055030743 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "stm8archiversettingsgroup_v3.h" #include "stm8assemblersettingsgroup_v3.h" #include "stm8buildconfigurationgroup_v3.h" #include "stm8compilersettingsgroup_v3.h" #include "stm8generalsettingsgroup_v3.h" #include "stm8linkersettingsgroup_v3.h" #include "../../iarewtoolchainpropertygroup.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace stm8 { namespace v3 { Stm8BuildConfigurationGroup::Stm8BuildConfigurationGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) : gen::xml::PropertyGroup("configuration") { // Append configuration name item. const QString cfgName = gen::utils::buildConfigurationName(qbsProject); appendProperty("name", cfgName); // Apend toolchain name group item. appendChild("STM8"); // Append debug info item. const int debugBuild = gen::utils::debugInformation(qbsProduct); appendProperty("debug", debugBuild); // Append settings group items. appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); } bool Stm8BuildConfigurationGroupFactory::canCreate( gen::utils::Architecture arch, const Version &version) const { return arch == gen::utils::Architecture::Stm8 && version.majorVersion() == 3; } std::unique_ptr Stm8BuildConfigurationGroupFactory::create( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) const { const auto group = new Stm8BuildConfigurationGroup( qbsProject, qbsProduct, qbsProductDeps); return std::unique_ptr(group); } } // namespace v3 } // namespace stm8 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/stm8assemblersettingsgroup_v3.cpp0000644000175100017510000002051315154533055030606 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "stm8assemblersettingsgroup_v3.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace stm8 { namespace v3 { constexpr int kAssemblerArchiveVersion = 3; constexpr int kAssemblerDataVersion = 2; namespace { // Language page options. struct LanguagePageOptions final { enum MacroQuoteCharacter { AngleBracketsQuote, RoundBracketsQuote, SquareBracketsQuote, FigureBracketsQuote }; explicit LanguagePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("assemblerFlags")}); enableSymbolsCaseSensitive = !flags.contains( QLatin1String("--case_insensitive")); enableMultibyteSupport = flags.contains( QLatin1String("--enable_multibytes")); allowFirstColumnMnemonics = flags.contains( QLatin1String("--mnem_first")); allowFirstColumnDirectives = flags.contains( QLatin1String("--dir_first")); if (flags.contains(QLatin1String("-M<>"))) macroQuoteCharacter = LanguagePageOptions::AngleBracketsQuote; else if (flags.contains(QLatin1String("-M()"))) macroQuoteCharacter = LanguagePageOptions::RoundBracketsQuote; else if (flags.contains(QLatin1String("-M[]"))) macroQuoteCharacter = LanguagePageOptions::SquareBracketsQuote; else if (flags.contains(QLatin1String("-M{}"))) macroQuoteCharacter = LanguagePageOptions::FigureBracketsQuote; } int enableSymbolsCaseSensitive = 1; int enableMultibyteSupport = 0; int allowFirstColumnMnemonics = 0; int allowFirstColumnDirectives = 0; MacroQuoteCharacter macroQuoteCharacter = AngleBracketsQuote; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { debugInfo = gen::utils::debugInformation(qbsProduct); } int debugInfo = 0; }; // Preprocessor page options. struct PreprocessorPageOptions final { explicit PreprocessorPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); defineSymbols = gen::utils::cppVariantModuleProperties( qbsProps, {QStringLiteral("defines")}); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); const QStringList fullIncludePaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("includePaths"), QStringLiteral("systemIncludePaths")}); for (const auto &fullIncludePath : fullIncludePaths) { const QFileInfo includeFileInfo(fullIncludePath); const QString includeFilePath = includeFileInfo.absoluteFilePath(); if (includeFilePath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, includeFilePath); includePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, includeFilePath); includePaths.push_back(path); } } } QVariantList defineSymbols; QVariantList includePaths; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); warningsAsErrors = gen::utils::cppIntegerModuleProperty( qbsProps, QStringLiteral("treatWarningsAsErrors")); } int warningsAsErrors = 0; }; } // namespace // Stm8AssemblerSettingsGroup Stm8AssemblerSettingsGroup::Stm8AssemblerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("ASTM8")); setArchiveVersion(kAssemblerArchiveVersion); setDataVersion(kAssemblerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildLanguagePage(qbsProduct); buildOutputPage(qbsProduct); buildPreprocessorPage(buildRootDirectory, qbsProduct); buildDiagnosticsPage(qbsProduct); } void Stm8AssemblerSettingsGroup::buildLanguagePage( const ProductData &qbsProduct) { const LanguagePageOptions opts(qbsProduct); // Add 'AsmCaseSensitivity' item (User symbols are case sensitive). addOptionsGroup(QByteArrayLiteral("AsmCaseSensitivity"), {opts.enableSymbolsCaseSensitive}); // Add 'AsmMultibyteSupport' item (Enable multibyte support). addOptionsGroup(QByteArrayLiteral("AsmMultibyteSupport"), {opts.enableMultibyteSupport}); // Add 'AsmAllowMnemonics' item (Allow mnemonics in first column). addOptionsGroup(QByteArrayLiteral("AsmAllowMnemonics"), {opts.allowFirstColumnMnemonics}); // Add 'AsmAllowDirectives' item (Allow directives in first column). addOptionsGroup(QByteArrayLiteral("AsmAllowDirectives"), {opts.allowFirstColumnDirectives}); // Add 'AsmMacroChars' item (Macro quote characters: ()/[]/{}/<>). addOptionsGroup(QByteArrayLiteral("AsmMacroChars"), {opts.macroQuoteCharacter}); } void Stm8AssemblerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'AsmDebugInfo' item (Generate debug information). addOptionsGroup(QByteArrayLiteral("AsmDebugInfo"), {opts.debugInfo}); } void Stm8AssemblerSettingsGroup::buildPreprocessorPage( const QString &baseDirectory, const ProductData &qbsProduct) { const PreprocessorPageOptions opts(baseDirectory, qbsProduct); // Add 'AsmDefines' item (Defined symbols). addOptionsGroup(QByteArrayLiteral("AsmDefines"), opts.defineSymbols); // Add 'AsmIncludePath' item (Additional include directories). addOptionsGroup(QByteArrayLiteral("AsmIncludePath"), opts.includePaths); } void Stm8AssemblerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'AsmDiagnosticsWarningsAreErrors' item. // (Treat all warnings as errors). addOptionsGroup(QByteArrayLiteral("AsmDiagnosticsWarningsAreErrors"), {opts.warningsAsErrors}); } } // namespace v3 } // namespace stm8 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/stm8assemblersettingsgroup_v3.h0000644000175100017510000000463515154533055030262 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWSTM8ASSEMBLERSETTINGSGROUP_V3_H #define QBS_IAREWSTM8ASSEMBLERSETTINGSGROUP_V3_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace stm8 { namespace v3 { class Stm8AssemblerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit Stm8AssemblerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildLanguagePage(const ProductData &qbsProduct); void buildOutputPage(const ProductData &qbsProduct); void buildPreprocessorPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); }; } // namespace v3 } // namespace stm8 } // namespace iarew } // namespace qbs #endif // QBS_IAREWSTM8ASSEMBLERSETTINGSGROUP_V3_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/stm8/stm8linkersettingsgroup_v3.cpp0000644000175100017510000003514615154533055030125 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "stm8linkersettingsgroup_v3.h" #include "../../iarewutils.h" #include #include namespace qbs { namespace iarew { namespace stm8 { namespace v3 { constexpr int kLinkerArchiveVersion = 5; constexpr int kLinkerDataVersion = 4; namespace { // Config page options. struct ConfigPageOptions final { explicit ConfigPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); // Enumerate all product linker config files // (which are set trough 'linkerscript' tag). for (const auto &qbsGroup : qbsProduct.groups()) { const auto qbsArtifacts = qbsGroup.sourceArtifacts(); for (const auto &qbsArtifact : qbsArtifacts) { const auto qbsTags = qbsArtifact.fileTags(); if (!qbsTags.contains(QLatin1String("linkerscript"))) continue; const QString fullConfigPath = qbsArtifact.filePath(); if (fullConfigPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullConfigPath); configFilePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullConfigPath); configFilePaths.push_back(path); } } } // Enumerate all product linker config files // (which are set trough '-config' option). const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); const QVariantList configPathValues = IarewUtils::flagValues( flags, QStringLiteral("--config")); for (const QVariant &configPathValue : configPathValues) { const QString fullConfigPath = configPathValue.toString(); if (fullConfigPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullConfigPath); if (!configFilePaths.contains(path)) configFilePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullConfigPath); if (!configFilePaths.contains(path)) configFilePaths.push_back(path); } } // Enumerate all config definition symbols (except // the CSTACK_SIZE and HEAP_SIZE which are handles // on the general page). configDefinitions = IarewUtils::flagValues( flags, QStringLiteral("--config_def")); Internal::removeIf(configDefinitions, [](const auto &definition){ const auto def = definition.toString(); return def.startsWith(QLatin1String("_CSTACK_SIZE")) || def.startsWith(QLatin1String("_HEAP_SIZE")); }); } QVariantList configFilePaths; QVariantList configDefinitions; }; struct LibraryPageOptions final { explicit LibraryPageOptions(const QString &baseDirectory, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); entryPoint = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("entryPoint")); // Add static libraries paths. const QStringList staticLibrariesProps = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("staticLibraries")}); for (const QString &staticLibrary : staticLibrariesProps) { const QFileInfo staticLibraryInfo(staticLibrary); if (staticLibraryInfo.isAbsolute()) { const QString fullStaticLibraryPath = staticLibraryInfo.absoluteFilePath(); if (fullStaticLibraryPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullStaticLibraryPath); staticLibraries.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullStaticLibraryPath); staticLibraries.push_back(path); } } else { staticLibraries.push_back(staticLibrary); } } // Add static libraries from product dependencies. for (const ProductData &qbsProductDep : qbsProductDeps) { const QString depBinaryPath = QLatin1String("$PROJ_DIR$/") + gen::utils::targetBinaryPath(baseDirectory, qbsProductDep); staticLibraries.push_back(depBinaryPath); } } QString entryPoint; QVariantList staticLibraries; }; struct OptimizationsPageOptions final { explicit OptimizationsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); mergeDuplicateSections = flags.contains( QLatin1String("--merge_duplicate_sections")); } bool mergeDuplicateSections = true; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { outputFile = gen::utils::targetBinary(qbsProduct); const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); enableDebugInfo = !flags.contains(QLatin1String("--strip")); } QString outputFile; bool enableDebugInfo = true; }; // List page options. struct ListPageOptions final { enum ListingAction { NoListing, GenerateListing }; explicit ListPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); generateMap = gen::utils::cppBooleanModuleProperty( qbsProps, QStringLiteral("generateLinkerMapFile")) ? ListPageOptions::GenerateListing : ListPageOptions::NoListing; } ListingAction generateMap = NoListing; }; // Define page options. struct DefinePageOptions final { explicit DefinePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); defineSymbols = IarewUtils::flagValues( flags, QStringLiteral("--define_symbol")); } QVariantList defineSymbols; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); warningsAsErrors = gen::utils::cppIntegerModuleProperty( qbsProps, QStringLiteral("treatWarningsAsErrors")); } int warningsAsErrors = 0; }; } // namespace // Stm8LinkerSettingsGroup Stm8LinkerSettingsGroup::Stm8LinkerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { setName(QByteArrayLiteral("ILINK")); setArchiveVersion(kLinkerArchiveVersion); setDataVersion(kLinkerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildConfigPage(buildRootDirectory, qbsProduct); buildLibraryPage(buildRootDirectory, qbsProduct, qbsProductDeps); buildOptimizationsPage(qbsProduct); buildOutputPage(qbsProduct); buildListPage(qbsProduct); buildDefinePage(qbsProduct); buildDiagnosticsPage(qbsProduct); // Should be called as latest stage! buildExtraOptionsPage(qbsProduct); } void Stm8LinkerSettingsGroup::buildConfigPage( const QString &baseDirectory, const ProductData &qbsProduct) { ConfigPageOptions opts(baseDirectory, qbsProduct); if (opts.configFilePaths.count() > 0) { // Note: IAR IDE does not allow to specify a multiple config files, // although the IAR linker support it. So, we use followig 'trick': // we take a first config file and to add it as usual to required items; // and then an other remainders we forward to the "Extra options page". const QVariant configPath = opts.configFilePaths.takeFirst(); // Add 'IlinkIcfOverride' item (Override default). addOptionsGroup(QByteArrayLiteral("IlinkIcfOverride"), {1}); // Add 'IlinkIcfFile' item (Linke configuration file). addOptionsGroup(QByteArrayLiteral("IlinkIcfFile"), {configPath}); // Add remainder configuration files to the "Extra options page". if (!opts.configFilePaths.isEmpty()) { for (QVariant &configPath : opts.configFilePaths) configPath = QString(QStringLiteral("--config ") + configPath.toString()); m_extraOptions << opts.configFilePaths; } } // Add 'IlinkConfigDefines' item (Configuration file // symbol definitions). addOptionsGroup(QByteArrayLiteral("IlinkConfigDefines"), opts.configDefinitions); } void Stm8LinkerSettingsGroup::buildLibraryPage( const QString &baseDirectory, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { LibraryPageOptions opts(baseDirectory, qbsProduct, qbsProductDeps); // Add 'IlinkOverrideProgramEntryLabel' item // (Override default program entry). addOptionsGroup(QByteArrayLiteral("IlinkOverrideProgramEntryLabel"), {1}); if (opts.entryPoint.isEmpty()) { // Add 'IlinkProgramEntryLabelSelect' item // (Defined by application). addOptionsGroup(QByteArrayLiteral("IlinkProgramEntryLabelSelect"), {1}); } else { // Add 'IlinkProgramEntryLabel' item // (Entry symbol). addOptionsGroup(QByteArrayLiteral("IlinkProgramEntryLabel"), {opts.entryPoint}); } // Add 'IlinkAdditionalLibs' item (Additional libraries). addOptionsGroup(QByteArrayLiteral("IlinkAdditionalLibs"), {opts.staticLibraries}); } void Stm8LinkerSettingsGroup::buildOptimizationsPage( const ProductData &qbsProduct) { OptimizationsPageOptions opts(qbsProduct); // Add 'IlinkOptMergeDuplSections' item // (Merge duplicate sections). addOptionsGroup(QByteArrayLiteral("IlinkOptMergeDuplSections"), {opts.mergeDuplicateSections}); } void Stm8LinkerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'IlinkOutputFile' item (Output file name). addOptionsGroup(QByteArrayLiteral("IlinkOutputFile"), {opts.outputFile}); // Add 'IlinkDebugInfoEnable' item // (Include debug information in output). addOptionsGroup(QByteArrayLiteral("IlinkDebugInfoEnable"), {opts.enableDebugInfo}); } void Stm8LinkerSettingsGroup::buildListPage( const ProductData &qbsProduct) { const ListPageOptions opts(qbsProduct); // Add 'IlinkMapFile' item (Generate linker map file). addOptionsGroup(QByteArrayLiteral("IlinkMapFile"), {opts.generateMap}); } void Stm8LinkerSettingsGroup::buildDefinePage( const ProductData &qbsProduct) { const DefinePageOptions opts(qbsProduct); // Add 'IlinkDefines' item (Defined symbols). addOptionsGroup(QByteArrayLiteral("IlinkDefines"), opts.defineSymbols); } void Stm8LinkerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'IlinkWarningsAreErrors' item (Treat all warnings as errors). addOptionsGroup(QByteArrayLiteral("IlinkWarningsAreErrors"), {opts.warningsAsErrors}); } void Stm8LinkerSettingsGroup::buildExtraOptionsPage( const ProductData &qbsProduct) { Q_UNUSED(qbsProduct) if (m_extraOptions.isEmpty()) return; // Add 'IlinkUseExtraOptions' (Use command line options). addOptionsGroup(QByteArrayLiteral("IlinkUseExtraOptions"), {1}); // Add 'IlinkExtraOptions' item (Command line options). addOptionsGroup(QByteArrayLiteral("IlinkExtraOptions"), m_extraOptions); } } // namespace v3 } // namespace stm8 } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/0000755000175100017510000000000015154533055021726 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/armarchiversettingsgroup_v8.cpp0000644000175100017510000000630115154533055030210 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armarchiversettingsgroup_v8.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace arm { namespace v8 { constexpr int kArchiverArchiveVersion = 0; constexpr int kArchiverDataVersion = 0; namespace { // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { outputFile = QLatin1String("$PROJ_DIR$/") + gen::utils::targetBinaryPath(baseDirectory, qbsProduct); } QString outputFile; }; } // namespace // ArmArchiverSettingsGroup ArmArchiverSettingsGroup::ArmArchiverSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("IARCHIVE")); setArchiveVersion(kArchiverArchiveVersion); setDataVersion(kArchiverDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildOutputPage(buildRootDirectory, qbsProduct); } void ArmArchiverSettingsGroup::buildOutputPage( const QString &baseDirectory, const ProductData &qbsProduct) { const OutputPageOptions opts(baseDirectory, qbsProduct); // Add 'IarchiveOverride' item (Override default). addOptionsGroup(QByteArrayLiteral("IarchiveOverride"), {1}); // Add 'IarchiveOutput' item (Output filename). addOptionsGroup(QByteArrayLiteral("IarchiveOutput"), {opts.outputFile}); } } // namespace v8 } // namespace arm } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/armbuildconfigurationgroup_v8.cpp0000644000175100017510000000734015154533055030517 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armarchiversettingsgroup_v8.h" #include "armassemblersettingsgroup_v8.h" #include "armbuildconfigurationgroup_v8.h" #include "armcompilersettingsgroup_v8.h" #include "armgeneralsettingsgroup_v8.h" #include "armlinkersettingsgroup_v8.h" #include "../../iarewtoolchainpropertygroup.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace arm { namespace v8 { ArmBuildConfigurationGroup::ArmBuildConfigurationGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps) : gen::xml::PropertyGroup("configuration") { // Append configuration name item. const QString cfgName = gen::utils::buildConfigurationName(qbsProject); appendProperty("name", cfgName); // Apend toolchain name group item. appendChild("ARM"); // Append debug info item. const int debugBuild = gen::utils::debugInformation(qbsProduct); appendProperty("debug", debugBuild); // Append settings group items. appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); appendChild( qbsProject, qbsProduct, qbsProductDeps); } bool ArmBuildConfigurationGroupFactory::canCreate( gen::utils::Architecture arch, const Version &version) const { return arch == gen::utils::Architecture::Arm && version.majorVersion() == 8; } std::unique_ptr ArmBuildConfigurationGroupFactory::create( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps) const { const auto group = new ArmBuildConfigurationGroup( qbsProject, qbsProduct, qbsProductDeps); return std::unique_ptr(group); } } // namespace v8 } // namespace arm } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/armgeneralsettingsgroup_v8.cpp0000644000175100017510000004703715154533055030035 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armgeneralsettingsgroup_v8.h" #include "../../iarewutils.h" #include namespace qbs { namespace iarew { namespace arm { namespace v8 { constexpr int kGeneralArchiveVersion = 3; constexpr int kGeneralDataVersion = 30; namespace { struct CpuCoreEntry final { enum CpuCoreCode { Arm7tdmi = 0, Arm7tdmis = 1, Arm710t = 2, Arm720t = 3, Arm740t = 4, Arm7ejs = 5, Arm9tdmi = 6, Arm920t = 7, Arm922t = 8, Arm940t = 9, Arm9e = 10, Arm9es = 11, Arm926ejs = 12, Arm946es = 13, Arm966es = 14, Arm968es = 15, Arm10e = 16, Arm1020e = 17, Arm1022e = 18, Arm1026ejs = 19, Arm1136j = 20, Arm1136js = 21, Arm1176j = 24, Arm1176js = 25, Xscale = 32, XscaleIr7 = 33, CortexM0 = 34, CortexM0Plus = 35, CortexM1 = 36, CortexMs1 = 37, CortexM3 = 38, CortexM4 = 39, CortexM7 = 41, CortexR4 = 42, CortexR5 = 44, CortexR7 = 46, CortexR8 = 48, CortexR52 = 49, CortexA5 = 50, CortexA7 = 52, CortexA8 = 53, CortexA9 = 54, CortexA15 = 55, CortexA17 = 56, CortexM23 = 58, CortexM33 = 59 }; // Required to compile in MSVC2015. CpuCoreEntry(CpuCoreCode cc, QByteArray tf) : coreCode(cc), targetFlag(std::move(tf)) {} CpuCoreCode coreCode = Arm7tdmi; QByteArray targetFlag; }; // Dictionary of known ARM CPU cores and its compiler options. const CpuCoreEntry cpusDict[] = { {CpuCoreEntry::Arm7tdmi, "arm7tdmi"}, // same as 'sc100' {CpuCoreEntry::Arm7tdmis, "arm7tdmi-s"}, {CpuCoreEntry::Arm710t, "arm710t"}, {CpuCoreEntry::Arm720t, "arm720t"}, {CpuCoreEntry::Arm740t, "arm740t"}, {CpuCoreEntry::Arm7ejs, "arm7ej-s"}, {CpuCoreEntry::Arm9tdmi, "arm9tdmi"}, {CpuCoreEntry::Arm920t, "arm920t"}, {CpuCoreEntry::Arm922t, "arm922t"}, {CpuCoreEntry::Arm940t, "arm940t"}, {CpuCoreEntry::Arm9e, "arm9e"}, {CpuCoreEntry::Arm9es, "arm9e-s"}, {CpuCoreEntry::Arm926ejs, "arm926ej-s"}, {CpuCoreEntry::Arm946es, "arm946e-s"}, {CpuCoreEntry::Arm966es, "arm966e-s"}, {CpuCoreEntry::Arm968es, "arm968e-s"}, {CpuCoreEntry::Arm10e, "arm10e"}, {CpuCoreEntry::Arm1020e, "arm1020e"}, {CpuCoreEntry::Arm1022e, "arm1022e"}, {CpuCoreEntry::Arm1026ejs, "arm1026ej-s"}, {CpuCoreEntry::Arm1136j, "arm1136j"}, {CpuCoreEntry::Arm1136js, "arm1136j-s"}, {CpuCoreEntry::Arm1176j, "arm1176j"}, {CpuCoreEntry::Arm1176js, "arm1176j-s"}, {CpuCoreEntry::Xscale, "xscale"}, {CpuCoreEntry::XscaleIr7, "xscale-ir7"}, {CpuCoreEntry::CortexM0, "cortex-m0"}, {CpuCoreEntry::CortexM0Plus, "cortex-m0+"}, // same as 'sc000' {CpuCoreEntry::CortexM1, "cortex-m1"}, {CpuCoreEntry::CortexMs1, "cortex-ms1"}, {CpuCoreEntry::CortexM3, "cortex-m3"}, // same as 'sc300' {CpuCoreEntry::CortexM4, "cortex-m4"}, {CpuCoreEntry::CortexM7, "cortex-m7"}, {CpuCoreEntry::CortexR4, "cortex-r4"}, {CpuCoreEntry::CortexR5, "cortex-r5"}, {CpuCoreEntry::CortexR7, "cortex-r7"}, {CpuCoreEntry::CortexR8, "cortex-r8"}, {CpuCoreEntry::CortexR52, "cortex-r52"}, {CpuCoreEntry::CortexA5, "cortex-a5"}, {CpuCoreEntry::CortexA7, "cortex-a7"}, {CpuCoreEntry::CortexA8, "cortex-a8"}, {CpuCoreEntry::CortexA9, "cortex-a9"}, {CpuCoreEntry::CortexA15, "cortex-a15"}, {CpuCoreEntry::CortexA17, "cortex-a17"}, {CpuCoreEntry::CortexM23, "cortex-m23"}, {CpuCoreEntry::CortexM33, "cortex-m33"}, }; struct FpuCoreEntry final { enum FpuRegistersCount { NoFpuRegisters, Fpu16Registers, Fpu32Registers }; enum FpuCoreCode { NoVfp = 0, Vfp2 = 2, Vfp3d16 = 3, Vfp3 = 3, Vfp4sp = 4, Vfp4d16 = 5, Vfp4 = 5, Vfp5sp = 6, Vfp5d16 = 7, Vfp9s = 8 }; // Required to compile in MSVC2015. FpuCoreEntry(FpuCoreCode cc, FpuRegistersCount rc, QByteArray tf) : coreCode(cc), regsCount(rc), targetFlag(std::move(tf)) {} FpuCoreCode coreCode = NoVfp; FpuRegistersCount regsCount = NoFpuRegisters; QByteArray targetFlag; }; // Dictionary of known ARM FPU cores and its compiler options. const FpuCoreEntry fpusDict[] = { {FpuCoreEntry::Vfp2, FpuCoreEntry::NoFpuRegisters, "vfpv2"}, {FpuCoreEntry::Vfp3d16, FpuCoreEntry::Fpu16Registers, "vfpv3_d16"}, {FpuCoreEntry::Vfp3, FpuCoreEntry::Fpu32Registers, "vfpv3"}, {FpuCoreEntry::Vfp4sp, FpuCoreEntry::Fpu16Registers, "vfpv4_sp"}, {FpuCoreEntry::Vfp4d16, FpuCoreEntry::Fpu16Registers, "vfpv4_d16"}, {FpuCoreEntry::Vfp4, FpuCoreEntry::Fpu32Registers, "vfpv4"}, {FpuCoreEntry::Vfp5sp, FpuCoreEntry::Fpu16Registers, "vfpv5_sp"}, {FpuCoreEntry::Vfp5d16, FpuCoreEntry::Fpu16Registers, "vfpv5_d16"}, {FpuCoreEntry::Vfp9s, FpuCoreEntry::NoFpuRegisters, "vfp9-s"}, }; // Target page options. struct TargetPageOptions final { enum Endianness { LittleEndian, BigEndian }; explicit TargetPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("driverFlags")}); // Detect target CPU code. const QString cpuValue = IarewUtils::flagValue( flags, QStringLiteral("--cpu")) .toLower(); const auto cpuEnd = std::cend(cpusDict); const auto cpuIt = std::find_if(std::cbegin(cpusDict), cpuEnd, [cpuValue]( const CpuCoreEntry &entry) { return entry.targetFlag == cpuValue.toLatin1(); }); if (cpuIt != cpuEnd) targetCpu = cpuIt->coreCode; // Detect target FPU code. const QString fpuValue = IarewUtils::flagValue( flags, QStringLiteral("--fpu")) .toLower(); const auto fpuEnd = std::cend(fpusDict); const auto fpuIt = std::find_if(std::cbegin(fpusDict), fpuEnd, [fpuValue]( const FpuCoreEntry &entry) { return entry.targetFlag == fpuValue.toLatin1(); }); if (fpuIt != fpuEnd) { targetFpu = fpuIt->coreCode; targetFpuRegs = fpuIt->regsCount; } // Detect endian. const QString prop = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("endianness")); if (prop == QLatin1String("big")) endianness = TargetPageOptions::BigEndian; else if (prop == QLatin1String("little")) endianness = TargetPageOptions::LittleEndian; } CpuCoreEntry::CpuCoreCode targetCpu = CpuCoreEntry::Arm7tdmi; FpuCoreEntry::FpuCoreCode targetFpu = FpuCoreEntry::NoVfp; FpuCoreEntry::FpuRegistersCount targetFpuRegs = FpuCoreEntry::NoFpuRegisters; Endianness endianness = LittleEndian; }; // Library 1 page options. struct LibraryOnePageOptions final { enum PrintfFormatter { PrintfAutoFormatter, PrintfFullFormatter, PrintfLargeFormatter, PrintfSmallFormatter, PrintfTinyFormatter }; enum ScanfFormatter { ScanfAutoFormatter, ScanfFullFormatter, ScanfLargeFormatter, ScanfSmallFormatter }; explicit LibraryOnePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); for (auto flagIt = flags.cbegin(); flagIt < flags.cend(); ++flagIt) { if (*flagIt != QLatin1String("--redirect")) continue; ++flagIt; if (flagIt->startsWith(QLatin1String("_printf="), Qt::CaseInsensitive)) { const QString prop = flagIt->split( QLatin1Char('=')).at(1).toLower(); if (prop == QLatin1String("_printffullnomb")) printfFormatter = LibraryOnePageOptions::PrintfFullFormatter; else if (prop == QLatin1String("_printflargenomb")) printfFormatter = LibraryOnePageOptions::PrintfLargeFormatter; else if (prop == QLatin1String("_printfsmallnomb")) printfFormatter = LibraryOnePageOptions::PrintfSmallFormatter; else if (prop == QLatin1String("_printftiny")) printfFormatter = LibraryOnePageOptions::PrintfTinyFormatter; } else if (flagIt->startsWith(QLatin1String("_scanf="), Qt::CaseInsensitive)) { const QString prop = flagIt->split( QLatin1Char('=')).at(1).toLower();; if (prop == QLatin1String("_scanffullnomb")) scanfFormatter = LibraryOnePageOptions::ScanfFullFormatter; else if (prop == QLatin1String("_scanflargenomb")) scanfFormatter = LibraryOnePageOptions::ScanfLargeFormatter; else if (prop == QLatin1String("_scanfsmallnomb")) scanfFormatter = LibraryOnePageOptions::ScanfSmallFormatter; } } } PrintfFormatter printfFormatter = PrintfAutoFormatter; ScanfFormatter scanfFormatter = ScanfAutoFormatter; }; // Library 2 page options. struct LibraryTwoPageOptions final { enum HeapType { AutomaticHeap, AdvancedHeap, BasicHeap, NoFreeHeap }; explicit LibraryTwoPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); if (flags.contains(QLatin1String("--advanced_heap"))) heapType = LibraryTwoPageOptions::AdvancedHeap; else if (flags.contains(QLatin1String("--basic_heap"))) heapType = LibraryTwoPageOptions::BasicHeap; else if (flags.contains(QLatin1String("--no_free_heap"))) heapType = LibraryTwoPageOptions::NoFreeHeap; else heapType = LibraryTwoPageOptions::AutomaticHeap; } HeapType heapType = AutomaticHeap; }; // Library configuration page options. struct LibraryConfigPageOptions final { enum RuntimeLibrary { NoLibrary, NormalLibrary, FullLibrary, CustomLibrary }; enum ThreadSupport { NoThread, EnableThread }; enum LowLevelInterface { NoInterface, SemihostedInterface }; explicit LibraryConfigPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); const QFileInfo dlibFileInfo(IarewUtils::flagValue( flags, QStringLiteral("--dlib_config"))); if (!dlibFileInfo.exists()) { dlibType = LibraryConfigPageOptions::NoLibrary; } else { const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); const QString dlibFilePath = dlibFileInfo.absoluteFilePath(); if (dlibFilePath.startsWith(toolkitPath, Qt::CaseInsensitive)) { if (dlibFilePath.endsWith(QLatin1String("dlib_config_normal.h"), Qt::CaseInsensitive)) { dlibType = LibraryConfigPageOptions::NormalLibrary; } else if (dlibFilePath.endsWith( QLatin1String("dlib_config_full.h"), Qt::CaseInsensitive)) { dlibType = LibraryConfigPageOptions::FullLibrary; } else { dlibType = LibraryConfigPageOptions::CustomLibrary; } dlibConfigPath = IarewUtils::toolkitRelativeFilePath( toolkitPath, dlibFilePath); } else { dlibType = LibraryConfigPageOptions::CustomLibrary; dlibConfigPath = IarewUtils::projectRelativeFilePath( baseDirectory, dlibFilePath); } } threadSupport = flags.contains(QLatin1String("--threaded_lib")) ? LibraryConfigPageOptions::EnableThread : LibraryConfigPageOptions::NoThread; lowLevelInterface = flags.contains(QLatin1String("--semihosting")) ? LibraryConfigPageOptions::SemihostedInterface : LibraryConfigPageOptions::NoInterface; } RuntimeLibrary dlibType = NoLibrary; QString dlibConfigPath; ThreadSupport threadSupport = NoThread; LowLevelInterface lowLevelInterface = NoInterface; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { binaryType = IarewUtils::outputBinaryType(qbsProduct); binaryDirectory = gen::utils::binaryOutputDirectory( baseDirectory, qbsProduct); objectDirectory = gen::utils::objectsOutputDirectory( baseDirectory, qbsProduct); listingDirectory = gen::utils::listingOutputDirectory( baseDirectory, qbsProduct); } IarewUtils::OutputBinaryType binaryType = IarewUtils::ApplicationOutputType; QString binaryDirectory; QString objectDirectory; QString listingDirectory; }; } // namespace // ArmGeneralSettingsGroup ArmGeneralSettingsGroup::ArmGeneralSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("General")); setArchiveVersion(kGeneralArchiveVersion); setDataVersion(kGeneralDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildTargetPage(qbsProduct); buildLibraryOptionsOnePage(qbsProduct); buildLibraryOptionsTwoPage(qbsProduct); buildLibraryConfigPage(buildRootDirectory, qbsProduct); buildOutputPage(buildRootDirectory, qbsProduct); } void ArmGeneralSettingsGroup::buildTargetPage( const ProductData &qbsProduct) { const TargetPageOptions opts(qbsProduct); // Add 'GBECoreSlave', 'CoreVariant', 'GFPUCoreSlave2' items // (Processor variant chooser). addOptionsGroup(QByteArrayLiteral("GBECoreSlave"), {opts.targetCpu}, 26); addOptionsGroup(QByteArrayLiteral("CoreVariant"), {opts.targetCpu}, 26); addOptionsGroup(QByteArrayLiteral("GFPUCoreSlave2"), {opts.targetCpu}, 26); // Add 'FPU2', 'NrRegs' item (Floating point settings chooser). addOptionsGroup(QByteArrayLiteral("FPU2"), {opts.targetFpu}, 0); addOptionsGroup(QByteArrayLiteral("NrRegs"), {opts.targetFpuRegs}, 0); // Add 'GEndianMode' item (Endian mode chooser). addOptionsGroup(QByteArrayLiteral("GEndianMode"), {opts.endianness}); } void ArmGeneralSettingsGroup::buildLibraryOptionsOnePage( const ProductData &qbsProduct) { const LibraryOnePageOptions opts(qbsProduct); // Add 'OGPrintfVariant' item (Printf formatter). addOptionsGroup(QByteArrayLiteral("OGPrintfVariant"), {opts.printfFormatter}); // Add 'OGScanfVariant' item (Printf formatter). addOptionsGroup(QByteArrayLiteral("OGScanfVariant"), {opts.scanfFormatter}); } void ArmGeneralSettingsGroup::buildLibraryOptionsTwoPage( const ProductData &qbsProduct) { const LibraryTwoPageOptions opts(qbsProduct); // Add 'OgLibHeap' item (Heap selection: // auto/advanced/basic/nofree). addOptionsGroup(QByteArrayLiteral("OgLibHeap"), {opts.heapType}); } void ArmGeneralSettingsGroup::buildLibraryConfigPage( const QString &baseDirectory, const ProductData &qbsProduct) { const LibraryConfigPageOptions opts(baseDirectory, qbsProduct); // Add 'GRuntimeLibSelect', 'GRuntimeLibSelectSlave' // and 'RTConfigPath2' items // (Link with runtime: none/normal/full/custom). addOptionsGroup(QByteArrayLiteral("GRuntimeLibSelect"), {opts.dlibType}); addOptionsGroup(QByteArrayLiteral("GRuntimeLibSelectSlave"), {opts.dlibType}); addOptionsGroup(QByteArrayLiteral("RTConfigPath2"), {opts.dlibConfigPath}); // Add 'GRuntimeLibThreads'item // (Enable thread support in library). addOptionsGroup(QByteArrayLiteral("GRuntimeLibThreads"), {opts.threadSupport}); // Add 'GenLowLevelInterface' item (Library low-level // interface: none/semihosted/breakpoint). addOptionsGroup(QByteArrayLiteral("GenLowLevelInterface"), {opts.lowLevelInterface}); } void ArmGeneralSettingsGroup::buildOutputPage( const QString &baseDirectory, const ProductData &qbsProduct) { const OutputPageOptions opts(baseDirectory, qbsProduct); // Add 'GOutputBinary' item // (Output file: executable/library). addOptionsGroup(QByteArrayLiteral("GOutputBinary"), {opts.binaryType}); // Add 'ExePath' item // (Executable/binaries output directory). addOptionsGroup(QByteArrayLiteral("ExePath"), {opts.binaryDirectory}); // Add 'ObjPath' item // (Object files output directory). addOptionsGroup(QByteArrayLiteral("ObjPath"), {opts.objectDirectory}); // Add 'ListPath' item // (List files output directory). addOptionsGroup(QByteArrayLiteral("ListPath"), {opts.listingDirectory}); } } // namespace v8 } // namespace arm } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/armassemblersettingsgroup_v8.cpp0000644000175100017510000002052515154533055030366 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armassemblersettingsgroup_v8.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace arm { namespace v8 { constexpr int kAssemblerArchiveVersion = 2; constexpr int kAssemblerDataVersion = 10; namespace { // Language page options. struct LanguagePageOptions final { enum MacroQuoteCharacter { AngleBracketsQuote, RoundBracketsQuote, SquareBracketsQuote, FigureBracketsQuote }; explicit LanguagePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleAssemblerFlags(qbsProps); enableSymbolsCaseSensitive = flags.contains(QLatin1String("-s+")); allowAlternativeRegister = flags.contains(QLatin1String("-j")); disableCodeMemoryDataReads = flags.contains( QLatin1String("--no_literal_pool")); if (flags.contains(QLatin1String("-M<>"))) macroQuoteCharacter = LanguagePageOptions::AngleBracketsQuote; else if (flags.contains(QLatin1String("-M()"))) macroQuoteCharacter = LanguagePageOptions::RoundBracketsQuote; else if (flags.contains(QLatin1String("-M[]"))) macroQuoteCharacter = LanguagePageOptions::SquareBracketsQuote; else if (flags.contains(QLatin1String("-M{}"))) macroQuoteCharacter = LanguagePageOptions::FigureBracketsQuote; } MacroQuoteCharacter macroQuoteCharacter = AngleBracketsQuote; int enableSymbolsCaseSensitive = 0; int allowAlternativeRegister = 0; int disableCodeMemoryDataReads = 0; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { debugInfo = gen::utils::debugInformation(qbsProduct); } int debugInfo = 0; }; // Preprocessor page options. struct PreprocessorPageOptions final { explicit PreprocessorPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); defineSymbols = gen::utils::cppVariantModuleProperties( qbsProps, {QStringLiteral("defines")}); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); const QStringList fullIncludePaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("includePaths"), QStringLiteral("systemIncludePaths")}); for (const QString &fullIncludePath : fullIncludePaths) { const QFileInfo includeFileInfo(fullIncludePath); const QString includeFilePath = includeFileInfo.absoluteFilePath(); if (includeFilePath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, includeFilePath); includePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, includeFilePath); includePaths.push_back(path); } } } QVariantList defineSymbols; QVariantList includePaths; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString warningLevel = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("warningLevel")); if (warningLevel == QLatin1String("all")) { enableWarnings = 0; enableAllWarnings = 0; } else if (warningLevel == QLatin1String("none")) { enableWarnings = 1; enableAllWarnings = 0; } else { enableWarnings = 0; enableAllWarnings = 1; } } int enableWarnings = 0; int enableAllWarnings = 0; }; } // namespace // ArmAssemblerSettingsGroup ArmAssemblerSettingsGroup::ArmAssemblerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("AARM")); setArchiveVersion(kAssemblerArchiveVersion); setDataVersion(kAssemblerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildLanguagePage(qbsProduct); buildOutputPage(qbsProduct); buildPreprocessorPage(buildRootDirectory, qbsProduct); buildDiagnosticsPage(qbsProduct); } void ArmAssemblerSettingsGroup::buildLanguagePage( const ProductData &qbsProduct) { const LanguagePageOptions opts(qbsProduct); // Add 'ACaseSensitivity' item (User symbols are case sensitive). addOptionsGroup(QByteArrayLiteral("ACaseSensitivity"), {opts.enableSymbolsCaseSensitive}); // Add 'AltRegisterNames' item (Allow alternative register names, // mnemonics and operands). addOptionsGroup(QByteArrayLiteral("AltRegisterNames"), {opts.allowAlternativeRegister}); // Add 'AsmNoLiteralPool' item (No data reads in code memory). addOptionsGroup(QByteArrayLiteral("AsmNoLiteralPool"), {opts.disableCodeMemoryDataReads}); // Add 'MacroChars' item (Macro quote characters: ()/[]/{}/<>). addOptionsGroup(QByteArrayLiteral("MacroChars"), {opts.macroQuoteCharacter}, 0); } void ArmAssemblerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'ADebug' item (Generate debug information). addOptionsGroup(QByteArrayLiteral("ADebug"), {opts.debugInfo}); } void ArmAssemblerSettingsGroup::buildPreprocessorPage( const QString &baseDirectory, const ProductData &qbsProduct) { const PreprocessorPageOptions opts(baseDirectory, qbsProduct); // Add 'ADefines' item (Defined symbols). addOptionsGroup(QByteArrayLiteral("ADefines"), opts.defineSymbols); // Add 'AUserIncludes' item (Additional include directories). addOptionsGroup(QByteArrayLiteral("AUserIncludes"), opts.includePaths); } void ArmAssemblerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'AWarnEnable' item (Enable/disable warnings). addOptionsGroup(QByteArrayLiteral("AWarnEnable"), {opts.enableWarnings}); // Add 'AWarnWhat' item (Enable/disable all warnings). addOptionsGroup(QByteArrayLiteral("AWarnWhat"), {opts.enableAllWarnings}); } } // namespace v8 } // namespace arm } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/armlinkersettingsgroup_v8.h0000644000175100017510000000564415154533055027347 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWARMLINKERSETTINGSGROUP_V8_H #define QBS_IAREWARMLINKERSETTINGSGROUP_V8_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace arm { namespace v8 { class ArmLinkerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit ArmLinkerSettingsGroup(const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildConfigPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildLibraryPage(const QString &baseDirectory, const ProductData &qbsProduct, const std::vector &qbsProductDeps); void buildOutputPage(const ProductData &qbsProduct); void buildInputPage(const ProductData &qbsProduct); void buildListPage(const ProductData &qbsProduct); void buildOptimizationsPage(const ProductData &qbsProduct); void buildAdvancedPage(const ProductData &qbsProduct); void buildDefinesPage(const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); void buildExtraOptionsPage(const ProductData &qbsProduct); QVariantList m_extraOptions; }; } // namespace v8 } // namespace arm } // namespace iarew } // namespace qbs #endif // QBS_IAREWARMLINKERSETTINGSGROUP_V8_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/armbuildconfigurationgroup_v8.h0000644000175100017510000000512415154533055030162 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWARMBUILDCONFIGURATIONGROUP_V8_H #define QBS_IAREWARMBUILDCONFIGURATIONGROUP_V8_H #include namespace qbs { namespace iarew { namespace arm { namespace v8 { class ArmBuildConfigurationGroup final : public gen::xml::PropertyGroup { private: explicit ArmBuildConfigurationGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps); friend class ArmBuildConfigurationGroupFactory; }; class ArmBuildConfigurationGroupFactory final : public gen::xml::PropertyGroupFactory { public: bool canCreate(gen::utils::Architecture arch, const Version &version) const final; std::unique_ptr create( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps) const final; }; } // namespace v8 } // namespace arm } // namespace iarew } // namespace qbs #endif // QBS_IAREWARMBUILDCONFIGURATIONGROUP_V8_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/armgeneralsettingsgroup_v8.h0000644000175100017510000000506215154533055027472 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWARMGENERALSETTINGSGROUP_V8_H #define QBS_IAREWARMGENERALSETTINGSGROUP_V8_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace arm { namespace v8 { class ArmGeneralSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit ArmGeneralSettingsGroup(const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildTargetPage(const ProductData &qbsProduct); void buildLibraryOptionsOnePage(const ProductData &qbsProduct); void buildLibraryOptionsTwoPage(const ProductData &qbsProduct); void buildLibraryConfigPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct); }; } // namespace v8 } // namespace arm } // namespace iarew } // namespace qbs #endif // QBS_IAREWARMGENERALSETTINGSGROUP_V8_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/armassemblersettingsgroup_v8.h0000644000175100017510000000463615154533055030040 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWARMASSEMBLERSETTINGSGROUP_V8_H #define QBS_IAREWARMASSEMBLERSETTINGSGROUP_V8_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace arm { namespace v8 { class ArmAssemblerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit ArmAssemblerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildLanguagePage(const ProductData &qbsProduct); void buildOutputPage(const ProductData &qbsProduct); void buildPreprocessorPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); }; } // namespace v8 } // namespace arm } // namespace iarew } // namespace qbs #endif // QBS_IAREWARMASSEMBLERSETTINGSGROUP_V8_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/armcompilersettingsgroup_v8.h0000644000175100017510000000512115154533055027663 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWARMCOMPILERSETTINGSGROUP_V8_H #define QBS_IAREWARMCOMPILERSETTINGSGROUP_V8_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace arm { namespace v8 { class ArmCompilerSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit ArmCompilerSettingsGroup(const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildOutputPage(const ProductData &qbsProduct); void buildLanguageOnePage(const ProductData &qbsProduct); void buildLanguageTwoPage(const ProductData &qbsProduct); void buildOptimizationsPage(const ProductData &qbsProduct); void buildPreprocessorPage(const QString &baseDirectory, const ProductData &qbsProduct); void buildDiagnosticsPage(const ProductData &qbsProduct); void buildCodePage(const ProductData &qbsProduct); }; } // namespace v8 } // namespace arm } // namespace iarew } // namespace qbs #endif // QBS_IAREWARMCOMPILERSETTINGSGROUP_V8_H qbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/armcompilersettingsgroup_v8.cpp0000644000175100017510000004420015154533055030217 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armcompilersettingsgroup_v8.h" #include "../../iarewutils.h" namespace qbs { namespace iarew { namespace arm { namespace v8 { constexpr int kCompilerArchiveVersion = 2; constexpr int kCompilerDataVersion = 34; namespace { // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { debugInfo = gen::utils::debugInformation(qbsProduct); } int debugInfo = 0; }; // Language 1 page options. struct LanguageOnePageOptions final { enum LanguageExtension { CLanguageExtension, CxxLanguageExtension, AutoLanguageExtension }; enum CLanguageDialect { C89LanguageDialect, C11LanguageDialect }; enum LanguageConformance { AllowIarExtension, RelaxedStandard, StrictStandard }; explicit LanguageOnePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); // File extension based by default. languageExtension = LanguageOnePageOptions::AutoLanguageExtension; // Language dialect. const QStringList cLanguageVersion = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("cLanguageVersion")}); cLanguageDialect = cLanguageVersion.contains(QLatin1String("c89")) ? LanguageOnePageOptions::C89LanguageDialect : LanguageOnePageOptions::C11LanguageDialect; const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); // Language conformance. if (flags.contains(QLatin1String("-e"))) languageConformance = LanguageOnePageOptions::AllowIarExtension; else if (flags.contains(QLatin1String("--strict"))) languageConformance = LanguageOnePageOptions::StrictStandard; else languageConformance = LanguageOnePageOptions::RelaxedStandard; // Exceptions, rtti, static desrtuction. enableExceptions = !flags.contains(QLatin1String("--no_exceptions")); enableRtti = !flags.contains(QLatin1String("--no_rtti")); destroyStaticObjects = !flags.contains( QLatin1String("--no_static_destruction")); allowVla = flags.contains(QLatin1String("--vla")); enableInlineSemantics = flags.contains(QLatin1String("--use_c++_inline")); requirePrototypes = flags.contains(QLatin1String("--require_prototypes")); } LanguageExtension languageExtension = AutoLanguageExtension; CLanguageDialect cLanguageDialect = C89LanguageDialect; LanguageConformance languageConformance = AllowIarExtension; // C++ options. int enableExceptions = 0; int enableRtti = 0; int destroyStaticObjects = 0; int allowVla = 0; int enableInlineSemantics = 0; int requirePrototypes = 0; }; // Language 2 page options. struct LanguageTwoPageOptions final { enum PlainCharacter { SignedCharacter, UnsignedCharacter }; enum FloatingPointSemantic { StrictSemantic, RelaxedSemantic }; explicit LanguageTwoPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); plainCharacter = flags.contains(QLatin1String("--char_is_signed")) ? LanguageTwoPageOptions::SignedCharacter : LanguageTwoPageOptions::UnsignedCharacter; floatingPointSemantic = flags.contains(QLatin1String("--relaxed_fp")) ? LanguageTwoPageOptions::RelaxedSemantic : LanguageTwoPageOptions::StrictSemantic; } PlainCharacter plainCharacter = SignedCharacter; FloatingPointSemantic floatingPointSemantic = StrictSemantic; }; // Optimizations page options. struct OptimizationsPageOptions final { // Optimizations level radio-buttons with // combo-box on "level" widget. enum Strategy { StrategyBalanced, StrategySize, StrategySpeed }; enum Level { LevelNone, LevelLow, LevelMedium, LevelHigh }; enum LevelSlave { LevelSlave0, LevelSlave1, LevelSlave2, LevelSlave3 }; explicit OptimizationsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QString optimization = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("optimization")); if (optimization == QLatin1String("none")) { optimizationStrategy = OptimizationsPageOptions::StrategyBalanced; optimizationLevel = OptimizationsPageOptions::LevelNone; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave0; } else if (optimization == QLatin1String("fast")) { optimizationStrategy = OptimizationsPageOptions::StrategySpeed; optimizationLevel = OptimizationsPageOptions::LevelHigh; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave3; } else if (optimization == QLatin1String("small")) { optimizationStrategy = OptimizationsPageOptions::StrategySize; optimizationLevel = OptimizationsPageOptions::LevelHigh; optimizationLevelSlave = OptimizationsPageOptions::LevelSlave3; } const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); enableCommonSubexpressionElimination = !flags.contains( QLatin1String("--no_cse")); enableLoopUnroll = !flags.contains( QLatin1String("--no_unroll")); enableFunctionInlining = !flags.contains( QLatin1String("--no_inline")); enableCodeMotion = !flags.contains( QLatin1String("--no_code_motion")); enableTypeBasedAliasAnalysis = !flags.contains( QLatin1String("--no_tbaa")); enableStaticClustering = !flags.contains( QLatin1String("--no_clustering")); enableInstructionScheduling = !flags.contains( QLatin1String("--no_scheduling")); enableVectorization = flags.contains( QLatin1String("--vectorize")); disableSizeConstraints = flags.contains( QLatin1String("--no_size_constraints")); } Strategy optimizationStrategy = StrategyBalanced; Level optimizationLevel = LevelNone; LevelSlave optimizationLevelSlave = LevelSlave0; // Eight bit-field flags on "enabled optimizations" widget. int enableCommonSubexpressionElimination = 0; // Common sub-expression elimination. int enableLoopUnroll = 0; // Loop unrolling. int enableFunctionInlining = 0; // Function inlining. int enableCodeMotion = 0; // Code motion. int enableTypeBasedAliasAnalysis = 0; // Type-based alias analysis. int enableStaticClustering = 0; // Static clustering. int enableInstructionScheduling = 0; // Instruction scheduling. int enableVectorization = 0; // Vectorization. // Separate "no size constraints" checkbox. int disableSizeConstraints = 0; }; // Preprocessor page options. struct PreprocessorPageOptions final { explicit PreprocessorPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); defineSymbols = gen::utils::cppVariantModuleProperties( qbsProps, {QStringLiteral("defines")}); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); const QStringList fullIncludePaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("includePaths"), QStringLiteral("systemIncludePaths")}); for (const QString &fullIncludePath : fullIncludePaths) { const QFileInfo includeFileInfo(fullIncludePath); const QString includeFilePath = includeFileInfo.absoluteFilePath(); if (includeFilePath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, includeFilePath); includePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, includeFilePath); includePaths.push_back(path); } } } QVariantList defineSymbols; QVariantList includePaths; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); treatWarningsAsErrors = gen::utils::cppIntegerModuleProperty( qbsProps, QStringLiteral("treatWarningsAsErrors")); } int treatWarningsAsErrors = 0; }; // Code page options. struct CodePageOptions final { enum ProcessorMode { CpuArmMode, CpuThumbMode }; explicit CodePageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleCompilerFlags(qbsProps); const QString cpuModeValue = IarewUtils::flagValue( flags, QStringLiteral("--cpu_mode")); if (cpuModeValue == QLatin1String("thumb")) cpuMode = CodePageOptions::CpuThumbMode; else if (cpuModeValue == QLatin1String("arm")) cpuMode = CodePageOptions::CpuArmMode; generateReadOnlyPosIndependentCode = flags.contains( QLatin1String("--ropi")); generateReadWritePosIndependentCode = flags.contains( QLatin1String("--rwpi")); disableDynamicReadWriteInitialization = flags.contains( QLatin1String("--no_rw_dynamic_init")); disableCodeMemoryDataReads = flags.contains( QLatin1String("--no_literal_pool")); } ProcessorMode cpuMode = CpuThumbMode; int generateReadOnlyPosIndependentCode = 0; int generateReadWritePosIndependentCode = 0; int disableDynamicReadWriteInitialization = 0; int disableCodeMemoryDataReads = 0; }; } // namespace // ArmCompilerSettingsGroup ArmCompilerSettingsGroup::ArmCompilerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { Q_UNUSED(qbsProject) Q_UNUSED(qbsProductDeps) setName(QByteArrayLiteral("ICCARM")); setArchiveVersion(kCompilerArchiveVersion); setDataVersion(kCompilerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildOutputPage(qbsProduct); buildLanguageOnePage(qbsProduct); buildLanguageTwoPage(qbsProduct); buildOptimizationsPage(qbsProduct); buildPreprocessorPage(buildRootDirectory, qbsProduct); buildDiagnosticsPage(qbsProduct); buildCodePage(qbsProduct); } void ArmCompilerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'CCDebugInfo' item (Generate debug info). addOptionsGroup(QByteArrayLiteral("CCDebugInfo"), {opts.debugInfo}); } void ArmCompilerSettingsGroup::buildLanguageOnePage( const ProductData &qbsProduct) { const LanguageOnePageOptions opts(qbsProduct); // Add 'IccLang' item with 'auto-extension based' // value (Language: C/C++/Auto). addOptionsGroup(QByteArrayLiteral("IccLang"), {opts.languageExtension}); // Add 'IccCDialect' item (C dialect: c89/99/11). addOptionsGroup(QByteArrayLiteral("IccCDialect"), {opts.cLanguageDialect}); // Add 'CCExt' item (Language conformance: IAR/relaxed/strict). addOptionsGroup(QByteArrayLiteral("CCLangConformance"), {opts.languageConformance}); // Add 'IccExceptions2' item (Enable exceptions). addOptionsGroup(QByteArrayLiteral("IccExceptions2"), {opts.enableExceptions}); // Add 'IccRTTI2' item (Enable RTTI). addOptionsGroup(QByteArrayLiteral("IccRTTI2"), {opts.enableRtti}); // Add 'IccStaticDestr' item (Destroy static objects). addOptionsGroup(QByteArrayLiteral("IccStaticDestr"), {opts.destroyStaticObjects}); // Add 'IccAllowVLA' item (Allow VLA). addOptionsGroup(QByteArrayLiteral("IccAllowVLA"), {opts.allowVla}); // Add 'IccCppInlineSemantics' item (C++ inline semantics). addOptionsGroup(QByteArrayLiteral("IccCppInlineSemantics"), {opts.enableInlineSemantics}); // Add 'CCRequirePrototypes' item (Require prototypes). addOptionsGroup(QByteArrayLiteral("CCRequirePrototypes"), {opts.requirePrototypes}); } void ArmCompilerSettingsGroup::buildLanguageTwoPage( const ProductData &qbsProduct) { const LanguageTwoPageOptions opts(qbsProduct); // Add 'CCSignedPlainChar' item (Plain char is: signed/unsigned). addOptionsGroup(QByteArrayLiteral("CCSignedPlainChar"), {opts.plainCharacter}); // Add 'IccFloatSemantics' item // (Floating-point semantic: strict/relaxed). addOptionsGroup(QByteArrayLiteral("IccFloatSemantics"), {opts.floatingPointSemantic}); } void ArmCompilerSettingsGroup::buildOptimizationsPage( const ProductData &qbsProduct) { const OptimizationsPageOptions opts(qbsProduct); // Add 'CCOptStrategy', 'CCOptLevel' // and 'CCOptLevelSlave' items (Level). addOptionsGroup(QByteArrayLiteral("CCOptStrategy"), {opts.optimizationStrategy}); addOptionsGroup(QByteArrayLiteral("CCOptLevel"), {opts.optimizationLevel}); addOptionsGroup(QByteArrayLiteral("CCOptLevelSlave"), {opts.optimizationLevelSlave}); // Add 'CCAllowList' item (Enabled optimizations: 6 check boxes). const QString transformations = QStringLiteral("%1%2%3%4%5%6%7%8") .arg(opts.enableCommonSubexpressionElimination) .arg(opts.enableLoopUnroll) .arg(opts.enableFunctionInlining) .arg(opts.enableCodeMotion) .arg(opts.enableTypeBasedAliasAnalysis) .arg(opts.enableStaticClustering) .arg(opts.enableInstructionScheduling) .arg(opts.enableVectorization); addOptionsGroup(QByteArrayLiteral("CCAllowList"), {transformations}); // Add 'CCOptimizationNoSizeConstraints' item (No size constraints). addOptionsGroup(QByteArrayLiteral("CCOptimizationNoSizeConstraints"), {opts.disableSizeConstraints}); } void ArmCompilerSettingsGroup::buildPreprocessorPage( const QString &baseDirectory, const ProductData &qbsProduct) { const PreprocessorPageOptions opts(baseDirectory, qbsProduct); // Add 'CCDefines' item (Defined symbols). addOptionsGroup(QByteArrayLiteral("CCDefines"), opts.defineSymbols); // Add 'CCIncludePath2' item (Additional include directories). addOptionsGroup(QByteArrayLiteral("CCIncludePath2"), opts.includePaths); } void ArmCompilerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'CCDiagWarnAreErr' item (Treat all warnings as errors). addOptionsGroup(QByteArrayLiteral("CCDiagWarnAreErr"), {opts.treatWarningsAsErrors}); } void ArmCompilerSettingsGroup::buildCodePage( const ProductData &qbsProduct) { const CodePageOptions opts(qbsProduct); // Add 'IProcessorMode2' item (Processor mode: arm/thumb). addOptionsGroup(QByteArrayLiteral("IProcessorMode2"), {opts.cpuMode}); // Add 'CCPosIndRopi' item (Code and read-only data "ropi"). addOptionsGroup(QByteArrayLiteral("CCPosIndRopi"), {opts.generateReadOnlyPosIndependentCode}); // Add 'CCPosIndRwpi' item (Read/write data "rwpi"). addOptionsGroup(QByteArrayLiteral("CCPosIndRwpi"), {opts.generateReadWritePosIndependentCode}); // Add 'CCPosIndNoDynInit' item (No dynamic read/write initialization). addOptionsGroup(QByteArrayLiteral("CCPosIndNoDynInit"), {opts.disableDynamicReadWriteInitialization}); // Add 'CCNoLiteralPool' item (No data reads in code memory). addOptionsGroup(QByteArrayLiteral("CCNoLiteralPool"), {opts.disableCodeMemoryDataReads}); } } // namespace v8 } // namespace arm } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/armlinkersettingsgroup_v8.cpp0000644000175100017510000004336515154533055027704 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armlinkersettingsgroup_v8.h" #include "../../iarewutils.h" #include namespace qbs { namespace iarew { namespace arm { namespace v8 { constexpr int kLinkerArchiveVersion = 0; constexpr int kLinkerDataVersion = 20; namespace { // Config page options. struct ConfigPageOptions final { explicit ConfigPageOptions(const QString &baseDirectory, const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); // Accumulate config definitions (if exists). const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); configDefines = IarewUtils::flagValues( flags, QStringLiteral("--config_def")); const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); // Enumerate all product linker config files // (which are set trough 'linkerscript' tag). for (const auto &qbsGroup : qbsProduct.groups()) { if (!qbsGroup.isEnabled()) continue; const auto qbsArtifacts = qbsGroup.sourceArtifacts(); for (const auto &qbsArtifact : qbsArtifacts) { const auto qbsTags = qbsArtifact.fileTags(); if (!qbsTags.contains(QLatin1String("linkerscript"))) continue; const QString fullConfigPath = qbsArtifact.filePath(); if (fullConfigPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullConfigPath); configFilePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullConfigPath); configFilePaths.push_back(path); } } } // Enumerate all product linker config files // (which are set trough '--config' option). const QVariantList configPathValues = IarewUtils::flagValues( flags, QStringLiteral("--config")); for (const auto &configPathValue : configPathValues) { const QString fullConfigPath = configPathValue.toString(); if (fullConfigPath.startsWith(toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullConfigPath); if (!configFilePaths.contains(path)) configFilePaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullConfigPath); if (!configFilePaths.contains(path)) configFilePaths.push_back(path); } } } QVariantList configFilePaths; QVariantList configDefines; }; // Library page options. struct LibraryPageOptions final { explicit LibraryPageOptions(const QString &baseDirectory, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { const auto &qbsProps = qbsProduct.moduleProperties(); entryPoint = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("entryPoint")); // Add libraries search paths. const QString toolkitPath = IarewUtils::toolkitRootPath(qbsProduct); const QStringList libraryPaths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("libraryPaths")}); for (const QString &libraryPath : libraryPaths) { const QFileInfo libraryPathInfo(libraryPath); const QString fullLibrarySearchPath = libraryPathInfo.absoluteFilePath(); if (fullLibrarySearchPath.startsWith( toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullLibrarySearchPath); librarySearchPaths.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory,fullLibrarySearchPath); librarySearchPaths.push_back(path); } } // Add static libraries paths. const QStringList staticLibrariesProps = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("staticLibraries")}); for (const QString &staticLibrary : staticLibrariesProps) { const QFileInfo staticLibraryInfo(staticLibrary); if (staticLibraryInfo.isAbsolute()) { const QString fullStaticLibraryPath = staticLibraryInfo.absoluteFilePath(); if (fullStaticLibraryPath.startsWith( toolkitPath, Qt::CaseInsensitive)) { const QString path = IarewUtils::toolkitRelativeFilePath( toolkitPath, fullStaticLibraryPath); staticLibraries.push_back(path); } else { const QString path = IarewUtils::projectRelativeFilePath( baseDirectory, fullStaticLibraryPath); staticLibraries.push_back(path); } } else { staticLibraries.push_back(staticLibrary); } } // Add static libraries from product dependencies. for (const ProductData &qbsProductDep : qbsProductDeps) { const QString depBinaryPath = QLatin1String("$PROJ_DIR$/") + gen::utils::targetBinaryPath(baseDirectory, qbsProductDep); staticLibraries.push_back(depBinaryPath); } const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); enableRuntimeLibsSearch = !flags.contains( QLatin1String("--no_library_search")); } QString entryPoint; QVariantList staticLibraries; QVariantList librarySearchPaths; int enableRuntimeLibsSearch = 0; }; // Output page options. struct OutputPageOptions final { explicit OutputPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); debugInfo = !flags.contains(QLatin1String("--strip")); outputFile = gen::utils::targetBinary(qbsProduct); } int debugInfo = 0; QString outputFile; }; // Input page options. struct InputPageOptions final { explicit InputPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); keepSymbols = IarewUtils::flagValues(flags, QStringLiteral("--keep")); } QVariantList keepSymbols; }; // List page options. struct ListPageOptions final { enum ListingAction { NoListing, GenerateListing }; explicit ListPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); generateMap = gen::utils::cppBooleanModuleProperty( qbsProps, QStringLiteral("generateLinkerMapFile")) ? ListPageOptions::GenerateListing : ListPageOptions::NoListing; } ListingAction generateMap = GenerateListing; }; // Optimizations page options. struct OptimizationsPageOptions final { explicit OptimizationsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); inlineSmallRoutines = flags.contains(QLatin1String("--inline")); mergeDuplicateSections = flags.contains( QLatin1String("--merge_duplicate_sections")); virtualFuncElimination = flags.contains(QLatin1String("--vfe")); } int inlineSmallRoutines = 0; int mergeDuplicateSections = 0; int virtualFuncElimination = 0; }; // Advanced page options. struct AdvancedPageOptions final { explicit AdvancedPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); allowExceptions = !flags.contains(QLatin1String("--no_exceptions")); } int allowExceptions = 0; }; // Defines page options. struct DefinesPageOptions final { explicit DefinesPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); const QStringList flags = IarewUtils::cppModuleLinkerFlags(qbsProps); defineSymbols = IarewUtils::flagValues( flags, QStringLiteral("--define_symbol")); } QVariantList defineSymbols; }; // Diagnostics page options. struct DiagnosticsPageOptions final { explicit DiagnosticsPageOptions(const ProductData &qbsProduct) { const auto &qbsProps = qbsProduct.moduleProperties(); treatWarningsAsErrors = gen::utils::cppIntegerModuleProperty( qbsProps, QStringLiteral("treatWarningsAsErrors")); } int treatWarningsAsErrors = 0; }; } // namespace // ArmLinkerSettingsGroup ArmLinkerSettingsGroup::ArmLinkerSettingsGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { setName(QByteArrayLiteral("ILINK")); setArchiveVersion(kLinkerArchiveVersion); setDataVersion(kLinkerDataVersion); setDataDebugInfo(gen::utils::debugInformation(qbsProduct)); const QString buildRootDirectory = gen::utils::buildRootPath(qbsProject); buildConfigPage(buildRootDirectory, qbsProduct); buildLibraryPage(buildRootDirectory, qbsProduct, qbsProductDeps); buildOutputPage(qbsProduct); buildInputPage(qbsProduct); buildListPage(qbsProduct); buildOptimizationsPage(qbsProduct); buildAdvancedPage(qbsProduct); buildDefinesPage(qbsProduct); // Should be called as latest stage! buildExtraOptionsPage(qbsProduct); } void ArmLinkerSettingsGroup::buildConfigPage( const QString &baseDirectory, const ProductData &qbsProduct) { ConfigPageOptions opts(baseDirectory, qbsProduct); // Add 'IlinkConfigDefines' item // (Configuration file symbol definitions). addOptionsGroup(QByteArrayLiteral("IlinkConfigDefines"), opts.configDefines); if (opts.configFilePaths.count() > 0) { // Note: IAR IDE does not allow to specify a multiple config files, // although the IAR linker support it. So, we use followig 'trick': // we take a first config file and to add it as usual to required items; // and then an other remainders we forward to the "Extra options page". const QVariant configPath = opts.configFilePaths.takeFirst(); // Add 'IlinkIcfOverride' item (Override default). addOptionsGroup(QByteArrayLiteral("IlinkIcfOverride"), {1}); // Add 'IlinkIcfFile' item (Linker configuration file). addOptionsGroup(QByteArrayLiteral("IlinkIcfFile"), {configPath}); // Add remainder configuration files to the "Extra options page". if (!opts.configFilePaths.isEmpty()) { for (QVariant &configPath : opts.configFilePaths) configPath = QString(QStringLiteral("--config ") + configPath.toString()); m_extraOptions << opts.configFilePaths; } } } void ArmLinkerSettingsGroup::buildLibraryPage( const QString &baseDirectory, const ProductData &qbsProduct, const std::vector &qbsProductDeps) { LibraryPageOptions opts(baseDirectory, qbsProduct, qbsProductDeps); // Add 'IlinkOverrideProgramEntryLabel' item // (Override default program entry). addOptionsGroup(QByteArrayLiteral("IlinkOverrideProgramEntryLabel"), {1}); const int select = opts.entryPoint.isEmpty() ? 1 : 0; addOptionsGroup(QByteArrayLiteral("IlinkProgramEntryLabelSelect"), {select}); // Add 'IlinkProgramEntryLabel' item (Entry point name). addOptionsGroup(QByteArrayLiteral("IlinkProgramEntryLabel"), {opts.entryPoint}); if (!opts.staticLibraries.isEmpty()) { // Add 'IlinkAdditionalLibs' item (Additional libraries). addOptionsGroup(QByteArrayLiteral("IlinkAdditionalLibs"), opts.staticLibraries); } // Add 'IlinkAutoLibEnable' item // (Automatic runtime library selection). addOptionsGroup(QByteArrayLiteral("IlinkAutoLibEnable"), {opts.enableRuntimeLibsSearch}); // Add library searh directories to the // "Extra options page", because IAR IDE // has not other options to add this paths. for (QVariant &libraryPath : opts.librarySearchPaths) libraryPath = QString(QStringLiteral("-L ") + libraryPath.toString()); m_extraOptions << opts.librarySearchPaths; } void ArmLinkerSettingsGroup::buildOutputPage( const ProductData &qbsProduct) { const OutputPageOptions opts(qbsProduct); // Add 'IlinkDebugInfoEnable' item // (Include debug information in output). addOptionsGroup(QByteArrayLiteral("IlinkDebugInfoEnable"), {opts.debugInfo}); // Add 'IlinkOutputFile' item (Output filename). addOptionsGroup(QByteArrayLiteral("IlinkOutputFile"), {opts.outputFile}); } void ArmLinkerSettingsGroup::buildInputPage( const ProductData &qbsProduct) { const InputPageOptions opts(qbsProduct); // Add 'IlinkKeepSymbols' item (). addOptionsGroup(QByteArrayLiteral("IlinkKeepSymbols"), opts.keepSymbols); } void ArmLinkerSettingsGroup::buildListPage( const ProductData &qbsProduct) { const ListPageOptions opts(qbsProduct); // Add 'IlinkMapFile' item (Generate linker map file). addOptionsGroup(QByteArrayLiteral("IlinkMapFile"), {opts.generateMap}); } void ArmLinkerSettingsGroup::buildOptimizationsPage( const ProductData &qbsProduct) { const OptimizationsPageOptions opts(qbsProduct); // Add 'IlinkOptInline' item (Inline small routines). addOptionsGroup(QByteArrayLiteral("IlinkOptInline"), {opts.inlineSmallRoutines}); // Add 'IlinkOptMergeDuplSections'item // (Merge duplicate sections). addOptionsGroup(QByteArrayLiteral("IlinkOptMergeDuplSections"), {opts.mergeDuplicateSections}); // Add 'IlinkOptUseVfe' item // (Perform C++ virtual functions elimination). addOptionsGroup(QByteArrayLiteral("IlinkOptUseVfe"), {opts.virtualFuncElimination}); } void ArmLinkerSettingsGroup::buildAdvancedPage( const ProductData &qbsProduct) { const AdvancedPageOptions opts(qbsProduct); // Add 'IlinkOptExceptionsAllow' item (Allow C++ exceptions). addOptionsGroup(QByteArrayLiteral("IlinkOptExceptionsAllow"), {opts.allowExceptions}); } void ArmLinkerSettingsGroup::buildDefinesPage( const ProductData &qbsProduct) { const DefinesPageOptions opts(qbsProduct); // Add 'IlinkDefines' item (Defined symbols). addOptionsGroup(QByteArrayLiteral("IlinkDefines"), {opts.defineSymbols}); } void ArmLinkerSettingsGroup::buildDiagnosticsPage( const ProductData &qbsProduct) { const DiagnosticsPageOptions opts(qbsProduct); // Add 'IlinkWarningsAreErrors' item // (Treat all warnings as errors). addOptionsGroup(QByteArrayLiteral("IlinkWarningsAreErrors"), {opts.treatWarningsAsErrors}); } void ArmLinkerSettingsGroup::buildExtraOptionsPage( const ProductData &qbsProduct) { Q_UNUSED(qbsProduct) // Add 'IlinkUseExtraOptions' and 'IlinkExtraOptions' items. addOptionsGroup(QByteArrayLiteral("IlinkUseExtraOptions"), {1}); addOptionsGroup(QByteArrayLiteral("IlinkExtraOptions"), m_extraOptions); } } // namespace v8 } // namespace arm } // namespace iarew } // namespace qbs qbs-src-3.2.0/src/plugins/generator/iarew/archs/arm/armarchiversettingsgroup_v8.h0000644000175100017510000000437515154533055027666 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_IAREWARMAARCHIVERSETTINGSGROUP_V8_H #define QBS_IAREWARMAARCHIVERSETTINGSGROUP_V8_H #include "../../iarewsettingspropertygroup.h" namespace qbs { namespace iarew { namespace arm { namespace v8 { class ArmArchiverSettingsGroup final : public IarewSettingsPropertyGroup { public: explicit ArmArchiverSettingsGroup(const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps); private: void buildOutputPage(const QString &baseDirectory, const ProductData &qbsProduct); }; } // namespace v8 } // namespace arm } // namespace iarew } // namespace qbs #endif // QBS_IAREWARMAARCHIVERSETTINGSGROUP_V8_H qbs-src-3.2.0/src/plugins/generator/keiluv/0000755000175100017510000000000015154533055020237 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/keiluv/keiluvgeneratorplugin.cpp0000644000175100017510000000522215154533055025371 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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$ ** ****************************************************************************/ #include "keiluvgenerator.h" #include "keiluvversioninfo.h" #include #include static void QbsKeiluvGeneratorPluginLoad() { for (const auto &info : qbs::KeiluvVersionInfo::knownVersions) { qbs::ProjectGeneratorManager::registerGenerator( std::make_shared(info)); } } static void QbsKeiluvGeneratorPluginUnload() { } #ifndef GENERATOR_EXPORT #if defined(WIN32) || defined(_WIN32) #define GENERATOR_EXPORT __declspec(dllexport) #else #define GENERATOR_EXPORT __attribute__((visibility("default"))) #endif #endif QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, keiluvgenerator, QbsKeiluvGeneratorPluginLoad, QbsKeiluvGeneratorPluginUnload) qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvprojectwriter.h0000644000175100017510000000376415154533055024545 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVPROJECTWRITER_H #define QBS_KEILUVPROJECTWRITER_H #include namespace qbs { class KeiluvProjectWriter final : public gen::xml::ProjectWriter { Q_DISABLE_COPY(KeiluvProjectWriter) public: explicit KeiluvProjectWriter(std::ostream *device); private: void visitProjectStart(const gen::xml::Project *project) final; void visitProjectEnd(const gen::xml::Project *project) final; }; } // namespace qbs #endif // QBS_KEILUVPROJECTWRITER_H qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvworkspacewriter.h0000644000175100017510000000402015154533055025057 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVWORKSPACEWRITER_H #define QBS_KEILUVWORKSPACEWRITER_H #include namespace qbs { class KeiluvWorkspaceWriter final : public gen::xml::WorkspaceWriter { Q_DISABLE_COPY(KeiluvWorkspaceWriter) public: explicit KeiluvWorkspaceWriter(std::ostream *device); private: void visitWorkspaceStart(const gen::xml::Workspace *workspace) final; void visitWorkspaceEnd(const gen::xml::Workspace *workspace) final; }; } // namespace qbs #endif // QBS_KEILUVWORKSPACEWRITER_H qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvworkspace.cpp0000644000175100017510000000546115154533055024167 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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$ ** ****************************************************************************/ #include "keiluvworkspace.h" #include namespace qbs { KeiluvWorkspace::KeiluvWorkspace(const QString &workspacePath) : gen::xml::Workspace(workspacePath) { // Construct schema version item. appendChild(QByteArrayLiteral("SchemaVersion"), QStringLiteral("1.0")); // Construct workspace name item. appendChild(QByteArrayLiteral("WorkspaceName"), QStringLiteral("WorkSpace")); } void KeiluvWorkspace::addProject(const QString &projectFilePath) { const QString relativeProjectPath = QDir::toNativeSeparators( m_baseDirectory.relativeFilePath(projectFilePath)); const auto projectGroup = appendChild( QByteArrayLiteral("project")); projectGroup->appendProperty("PathAndName", relativeProjectPath); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvprojectwriter.cpp0000644000175100017510000000440715154533055025073 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "keiluvprojectwriter.h" namespace qbs { KeiluvProjectWriter::KeiluvProjectWriter(std::ostream *device) : gen::xml::ProjectWriter(device) { } void KeiluvProjectWriter::visitProjectStart(const gen::xml::Project *project) { Q_UNUSED(project) writer()->writeStartElement(QStringLiteral("Project")); writer()->writeAttribute( QStringLiteral("xmlns:xsi"), QStringLiteral("http://www.w3.org/2001/XMLSchema-instance")); writer()->writeAttribute( QStringLiteral("xsi:noNamespaceSchemaLocation"), QStringLiteral("project_proj.xsd")); } void KeiluvProjectWriter::visitProjectEnd(const gen::xml::Project *project) { Q_UNUSED(project) writer()->writeEndElement(); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/CMakeLists.txt0000644000175100017510000000423115154533055022777 0ustar runnerrunnerset(COMMON_SOURCES keiluvfilesgroupspropertygroup.cpp keiluvfilesgroupspropertygroup.h keiluvgenerator.cpp keiluvgenerator.h keiluvgeneratorplugin.cpp keiluvproject.cpp keiluvproject.h keiluvprojectwriter.cpp keiluvprojectwriter.h keiluvutils.cpp keiluvutils.h keiluvversioninfo.h keiluvworkspace.cpp keiluvworkspace.h keiluvworkspacewriter.cpp keiluvworkspacewriter.h ) set(ARCHS_ARM_SOURCES armbuildtargetgroup_v5.cpp armbuildtargetgroup_v5.h armcommonpropertygroup_v5.cpp armcommonpropertygroup_v5.h armdebugoptiongroup_v5.cpp armdebugoptiongroup_v5.h armdlloptiongroup_v5.cpp armdlloptiongroup_v5.h armtargetassemblergroup_v5.cpp armtargetassemblergroup_v5.h armtargetcommonoptionsgroup_v5.cpp armtargetcommonoptionsgroup_v5.h armtargetcompilergroup_v5.cpp armtargetcompilergroup_v5.h armtargetgroup_v5.cpp armtargetgroup_v5.h armtargetlinkergroup_v5.cpp armtargetlinkergroup_v5.h armtargetmiscgroup_v5.cpp armtargetmiscgroup_v5.h armutilitiesgroup_v5.cpp armutilitiesgroup_v5.h ) list_transform_prepend(ARCHS_ARM_SOURCES archs/arm/) set(ARCHS_MCS51_SOURCES mcs51buildtargetgroup_v5.cpp mcs51buildtargetgroup_v5.h mcs51commonpropertygroup_v5.cpp mcs51commonpropertygroup_v5.h mcs51debugoptiongroup_v5.cpp mcs51debugoptiongroup_v5.h mcs51dlloptiongroup_v5.cpp mcs51dlloptiongroup_v5.h mcs51targetassemblergroup_v5.cpp mcs51targetassemblergroup_v5.h mcs51targetcommonoptionsgroup_v5.cpp mcs51targetcommonoptionsgroup_v5.h mcs51targetcompilergroup_v5.cpp mcs51targetcompilergroup_v5.h mcs51targetgroup_v5.cpp mcs51targetgroup_v5.h mcs51targetlinkergroup_v5.cpp mcs51targetlinkergroup_v5.h mcs51targetmiscgroup_v5.cpp mcs51targetmiscgroup_v5.h mcs51utilitiesgroup_v5.cpp mcs51utilitiesgroup_v5.h mcs51utils.cpp mcs51utils.h ) list_transform_prepend(ARCHS_MCS51_SOURCES archs/mcs51/) add_qbs_plugin(keiluvgenerator DEPENDS qbscore SOURCES ${COMMON_SOURCES} ${ARCHS_ARM_SOURCES} ${ARCHS_MCS51_SOURCES} ) qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvproject.h0000644000175100017510000000413215154533055023276 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVPROJECT_H #define QBS_KEILUVPROJECT_H #include #include #include #include namespace qbs { class KeiluvProject final : public gen::xml::Project { public: explicit KeiluvProject( const qbs::GeneratableProject &genProject, const qbs::GeneratableProductData &genProduct, const gen::VersionInfo &versionInfo); private: std::vector> m_factories; }; } // namespace qbs #endif // QBS_KEILUVPROJECT_H qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvfilesgroupspropertygroup.cpp0000644000175100017510000001637015154533055027416 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "keiluvfilesgroupspropertygroup.h" #include "keiluvutils.h" #include #include #include namespace qbs { class KeiluvFilePropertyGroup final : public gen::xml::PropertyGroup { public: explicit KeiluvFilePropertyGroup( const QString &fullFilePath, const QString &baseDirectory) : gen::xml::PropertyGroup("File") { const QFileInfo fileInfo(fullFilePath); const auto fileName = fileInfo.fileName(); const auto fileType = encodeFileType(fileInfo.suffix()); const auto filePath = QDir::toNativeSeparators( gen::utils::relativeFilePath( baseDirectory, fileInfo.absoluteFilePath())); appendChild(QByteArrayLiteral("FileName"), fileName); appendChild(QByteArrayLiteral("FileType"), fileType); appendChild(QByteArrayLiteral("FilePath"), filePath); } private: enum FileType { UnknownFileType = 0, CSourceFileType = 1, AssemblerFileType = 2, LibraryFileType = 4, TextFileType = 5, CppSourceFileType = 8, }; static FileType encodeFileType(const QString &fileSuffix) { if (fileSuffix.compare(QLatin1String("c"), Qt::CaseInsensitive) == 0) { return CSourceFileType; } if (fileSuffix.compare(QLatin1String("cpp"), Qt::CaseInsensitive) == 0) { return CppSourceFileType; } if (fileSuffix.compare(QLatin1String("s"), Qt::CaseInsensitive) == 0 || fileSuffix.compare(QLatin1String("a51"), Qt::CaseInsensitive) == 0) { return AssemblerFileType; } if (fileSuffix.compare(QLatin1String("lib"), Qt::CaseInsensitive) == 0) { return LibraryFileType; } // All header files, text files and include files // interpretes as a text file types. return TextFileType; } }; class KeiluvFilesPropertyGroup final : public gen::xml::PropertyGroup { public: explicit KeiluvFilesPropertyGroup( const QList &sourceArtifacts, const QString &baseDirectory) : gen::xml::PropertyGroup("Files") { for (const auto &artifact : sourceArtifacts) appendChild(artifact.filePath(), baseDirectory); } explicit KeiluvFilesPropertyGroup( const QStringList &filePaths, const QString &baseDirectory) : gen::xml::PropertyGroup("Files") { for (const auto &filePath : filePaths) appendChild(filePath, baseDirectory); } }; class KeiluvFileGroupPropertyGroup final : public gen::xml::PropertyGroup { public: explicit KeiluvFileGroupPropertyGroup( const QString &groupName, const QList &sourceArtifacts, const QString &baseDirectory) : gen::xml::PropertyGroup("Group") { appendChild(QByteArrayLiteral("GroupName"), groupName); appendChild(sourceArtifacts, baseDirectory); } explicit KeiluvFileGroupPropertyGroup( const QString &groupName, const QStringList &filePaths, const QString &baseDirectory) : gen::xml::PropertyGroup("Group") { appendChild(QByteArrayLiteral("GroupName"), groupName); appendChild(filePaths, baseDirectory); } }; KeiluvFilesGroupsPropertyGroup::KeiluvFilesGroupsPropertyGroup( const Project &qbsProject, const ProductData &qbsProduct, const std::vector &qbsProductDeps) : gen::xml::PropertyGroup(QByteArrayLiteral("Groups")) { const auto baseDirectory = gen::utils::buildRootPath(qbsProject); // Build source items. for (const auto &group : qbsProduct.groups()) { // Ignore disabled groups (e.g. when its condition property is false). if (!group.isEnabled()) continue; auto sourceArtifacts = group.sourceArtifacts(); // Remove the linker script artifacts. Internal::removeIf(sourceArtifacts, [](const auto &artifact){ const auto tags = artifact.fileTags(); return tags.contains(QLatin1String("linkerscript")); }); if (sourceArtifacts.isEmpty()) continue; appendChild( group.name(), sourceArtifacts, baseDirectory); } // Build local static library items. const auto &qbsProps = qbsProduct.moduleProperties(); const auto staticLibs = KeiluvUtils::staticLibraries(qbsProps); if (!staticLibs.isEmpty()) { appendChild( QStringLiteral("Static Libs"), staticLibs, baseDirectory); } // Build dependency library items. const auto deps = KeiluvUtils::dependencies(qbsProductDeps); if (!deps.isEmpty()) { appendChild( QStringLiteral("Dependencies"), deps, baseDirectory); } } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvworkspacewriter.cpp0000644000175100017510000000445315154533055025424 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "keiluvworkspacewriter.h" namespace qbs { KeiluvWorkspaceWriter::KeiluvWorkspaceWriter(std::ostream *device) : gen::xml::WorkspaceWriter(device) { } void KeiluvWorkspaceWriter::visitWorkspaceStart(const gen::xml::Workspace *workspace) { Q_UNUSED(workspace) writer()->writeStartElement(QStringLiteral("ProjectWorkspace")); writer()->writeAttribute( QStringLiteral("xmlns:xsi"), QStringLiteral("http://www.w3.org/2001/XMLSchema-instance")); writer()->writeAttribute( QStringLiteral("xsi:noNamespaceSchemaLocation"), QStringLiteral("project_mpw.xsd")); } void KeiluvWorkspaceWriter::visitWorkspaceEnd(const gen::xml::Workspace *workspace) { Q_UNUSED(workspace) writer()->writeEndElement(); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/keiluv.qbs0000644000175100017510000000557515154533055022261 0ustar runnerrunnerimport "../../qbsplugin.qbs" as QbsPlugin QbsPlugin { name: "keiluvgenerator" files: ["keiluvgeneratorplugin.cpp"] Group { name: "KEIL UV generator common" files: [ "keiluvfilesgroupspropertygroup.cpp", "keiluvfilesgroupspropertygroup.h", "keiluvgenerator.cpp", "keiluvgenerator.h", "keiluvproject.cpp", "keiluvproject.h", "keiluvprojectwriter.cpp", "keiluvprojectwriter.h", "keiluvutils.cpp", "keiluvutils.h", "keiluvversioninfo.h", "keiluvworkspace.cpp", "keiluvworkspace.h", "keiluvworkspacewriter.cpp", "keiluvworkspacewriter.h", ] } Group { name: "KEIL UV generator for MCS51" prefix: "archs/mcs51/" files: [ "mcs51buildtargetgroup_v5.cpp", "mcs51buildtargetgroup_v5.h", "mcs51commonpropertygroup_v5.cpp", "mcs51commonpropertygroup_v5.h", "mcs51debugoptiongroup_v5.cpp", "mcs51debugoptiongroup_v5.h", "mcs51dlloptiongroup_v5.cpp", "mcs51dlloptiongroup_v5.h", "mcs51targetassemblergroup_v5.cpp", "mcs51targetassemblergroup_v5.h", "mcs51targetcommonoptionsgroup_v5.cpp", "mcs51targetcommonoptionsgroup_v5.h", "mcs51targetcompilergroup_v5.cpp", "mcs51targetcompilergroup_v5.h", "mcs51targetgroup_v5.cpp", "mcs51targetgroup_v5.h", "mcs51targetlinkergroup_v5.cpp", "mcs51targetlinkergroup_v5.h", "mcs51targetmiscgroup_v5.cpp", "mcs51targetmiscgroup_v5.h", "mcs51utilitiesgroup_v5.cpp", "mcs51utilitiesgroup_v5.h", "mcs51utils.cpp", "mcs51utils.h", ] } Group { name: "KEIL UV generator for ARM" prefix: "archs/arm/" files: [ "armbuildtargetgroup_v5.cpp", "armbuildtargetgroup_v5.h", "armcommonpropertygroup_v5.cpp", "armcommonpropertygroup_v5.h", "armdebugoptiongroup_v5.cpp", "armdebugoptiongroup_v5.h", "armdlloptiongroup_v5.cpp", "armdlloptiongroup_v5.h", "armtargetassemblergroup_v5.cpp", "armtargetassemblergroup_v5.h", "armtargetcommonoptionsgroup_v5.cpp", "armtargetcommonoptionsgroup_v5.h", "armtargetcompilergroup_v5.cpp", "armtargetcompilergroup_v5.h", "armtargetgroup_v5.cpp", "armtargetgroup_v5.h", "armtargetlinkergroup_v5.cpp", "armtargetlinkergroup_v5.h", "armtargetmiscgroup_v5.cpp", "armtargetmiscgroup_v5.h", "armutilitiesgroup_v5.cpp", "armutilitiesgroup_v5.h", ] } } qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvgenerator.h0000644000175100017510000000520215154533055023615 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVGENERATOR_H #define QBS_KEILUVGENERATOR_H #include "keiluvversioninfo.h" #include #include namespace qbs { class KeiluvProject; class KeiluvWorkspace; class KeiluvGenerator final : public ProjectGenerator, private IGeneratableProjectVisitor { public: explicit KeiluvGenerator(const gen::VersionInfo &versionInfo); QString generatorName() const final; void generate() final; private: void reset(); void visitProject(const GeneratableProject &project) final; void visitProjectData(const GeneratableProject &project, const GeneratableProjectData &projectData) final; void visitProduct(const GeneratableProject &project, const GeneratableProjectData &projectData, const GeneratableProductData &productData) final; const gen::VersionInfo m_versionInfo; std::shared_ptr m_workspace; QString m_workspaceFilePath; std::map> m_projects; }; } // namespace qbs #endif // QBS_KEILUVGENERATOR_H qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvproject.cpp0000644000175100017510000001153715154533055023640 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "keiluvconstants.h" #include "keiluvproject.h" #include "keiluvutils.h" #include "keiluvversioninfo.h" #include "archs/mcs51/mcs51buildtargetgroup_v5.h" #include "archs/arm/armbuildtargetgroup_v5.h" #include namespace qbs { static QString keilProjectSchema(const gen::VersionInfo &info) { const auto v = info.marketingVersion(); switch (v) { case KeiluvConstants::v5::kUVisionVersion: return QStringLiteral("2.1"); default: return {}; } } KeiluvProject::KeiluvProject(const qbs::GeneratableProject &genProject, const qbs::GeneratableProductData &genProduct, const gen::VersionInfo &versionInfo) { Q_ASSERT(genProject.projects.size() == genProject.commandLines.size()); Q_ASSERT(genProject.projects.size() == genProduct.data.size()); // Create available configuration group factories. m_factories.push_back(std::make_unique< keiluv::mcs51::v5::Mcs51BuildTargetGroupFactory>()); m_factories.push_back(std::make_unique< keiluv::arm::v5::ArmBuildTargetGroupFactory>()); // Construct schema version item (is it depends on a project version?). const auto schema = keilProjectSchema(versionInfo); appendChild(QByteArrayLiteral("SchemaVersion"), schema); // Construct targets group. const auto targetsGroup = appendChild( QByteArrayLiteral("Targets")); // Construct all build target items. const int configsCount = std::max(genProject.projects.size(), genProduct.data.size()); for (auto configIndex = 0; configIndex < configsCount; ++configIndex) { const qbs::Project qbsProject = genProject.projects .values().at(configIndex); const qbs::ProductData qbsProduct = genProduct.data .values().at(configIndex); const QString confName = gen::utils::buildConfigurationName(qbsProject); const std::vector qbsProductDeps = gen::utils::dependenciesOf (qbsProduct, genProject, confName); const auto arch = gen::utils::architecture(qbsProject); if (arch == gen::utils::Architecture::Unknown) throw ErrorInfo(Internal::Tr::tr("Target architecture is not set," " please use the 'profile' option")); // Construct the build target item, which are depend from // the architecture and the version. const auto factoryEnd = m_factories.cend(); const auto factoryIt = std::find_if(m_factories.cbegin(), factoryEnd, [arch, versionInfo](const auto &factory) { return factory->canCreate(arch, versionInfo.version()); }); if (factoryIt == factoryEnd) { throw ErrorInfo(Internal::Tr::tr("Incompatible target architecture '%1'" " for KEIL UV version %2") .arg(gen::utils::architectureName(arch)) .arg(versionInfo.marketingVersion())); } auto targetGroup = (*factoryIt)->create( qbsProject, qbsProduct, qbsProductDeps); targetsGroup->appendChild(std::move(targetGroup)); } } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvutils.cpp0000644000175100017510000001053715154533055023331 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "keiluvutils.h" #include #include namespace qbs { namespace KeiluvUtils { OutputBinaryType outputBinaryType(const ProductData &qbsProduct) { const auto &qbsProductType = qbsProduct.type(); if (qbsProductType.contains(QLatin1String("application"))) return ApplicationOutputType; if (qbsProductType.contains(QLatin1String("staticlibrary"))) return LibraryOutputType; return ApplicationOutputType; } QString toolkitRootPath(const ProductData &qbsProduct) { QDir dir(qbsProduct.moduleProperties() .getModuleProperty(Internal::StringConstants::cppModule(), QStringLiteral("toolchainInstallPath")) .toString()); dir.cdUp(); const auto path = dir.absolutePath(); return QDir::toNativeSeparators(path); } QStringList cppModuleCompilerFlags(const PropertyMap &qbsProps) { return gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("driverFlags"), QStringLiteral("cFlags"), QStringLiteral("cppFlags"), QStringLiteral("cxxFlags"), QStringLiteral("commonCompilerFlags")}); } QStringList cppModuleAssemblerFlags(const PropertyMap &qbsProps) { return gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("assemblerFlags")}); } QStringList cppModuleLinkerFlags(const PropertyMap &qbsProps) { return gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("driverLinkerFlags")}); } QStringList includes(const PropertyMap &qbsProps) { auto paths = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("includePaths"), QStringLiteral("systemIncludePaths")}); // Transform include path separators to native. Internal::transform(paths, [](const auto &path) { return QDir::toNativeSeparators(path); }); return paths; } QStringList defines(const PropertyMap &qbsProps) { return gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("defines")}); } QStringList staticLibraries(const PropertyMap &qbsProps) { auto libs = gen::utils::cppStringModuleProperties( qbsProps, {QStringLiteral("staticLibraries")}); // Transform library path separators to native. Internal::transform(libs, [](const auto &path) { return QDir::toNativeSeparators(path); }); return libs; } QStringList dependencies(const std::vector &qbsProductDeps) { return Internal::transformed(qbsProductDeps, [](const auto &dep) { const QString path = dep.buildDirectory() + QStringLiteral("/obj/") + gen::utils::targetBinary(dep); return QDir::toNativeSeparators(path); }); } } // namespace KeiluvUtils } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvutils.h0000644000175100017510000000452415154533055022775 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVUTILS_H #define QBS_KEILUVUTILS_H #include #include namespace qbs { namespace KeiluvUtils { enum OutputBinaryType { ApplicationOutputType, LibraryOutputType }; OutputBinaryType outputBinaryType(const ProductData &qbsProduct); QString toolkitRootPath(const ProductData &qbsProduct); QStringList cppModuleCompilerFlags(const PropertyMap &qbsProps); QStringList cppModuleAssemblerFlags(const PropertyMap &qbsProps); QStringList cppModuleLinkerFlags(const PropertyMap &qbsProps); QStringList includes(const PropertyMap &qbsProps); QStringList defines(const PropertyMap &qbsProps); QStringList staticLibraries(const PropertyMap &qbsProps); QStringList dependencies(const std::vector &qbsProductDeps); } // namespace KeiluvUtils } // namespace qbs #endif // QBS_KEILUVUTILS_H qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvversioninfo.h0000644000175100017510000000454615154533055024202 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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_KEILUVVERSIONINFO_H #define QBS_KEILUVVERSIONINFO_H #include "keiluvconstants.h" #include #include namespace qbs { namespace KeiluvVersionInfo { constexpr gen::VersionInfo knownVersions[] = { {Version(KeiluvConstants::v5::kUVisionVersion), {gen::utils::Architecture::Mcs51, gen::utils::Architecture::Arm}}, }; } // namespace KeiluvVersionInfo } // namespace qbs #endif // QBS_KEILUVVERSIONINFO_H qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvworkspace.h0000644000175100017510000000433115154533055023627 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** 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_KEILUVWORKSPACE_H #define QBS_KEILUVWORKSPACE_H #include namespace qbs { class KeiluvWorkspace final : public gen::xml::Workspace { public: explicit KeiluvWorkspace(const QString &workspacePath); void addProject(const QString &projectPath) final; }; } // namespace qbs #endif // QBS_KEILUVWORKSPACE_H qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvfilesgroupspropertygroup.h0000644000175100017510000000405215154533055027055 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVFILESGROUPSPROPERTYGROUP_H #define QBS_KEILUVFILESGROUPSPROPERTYGROUP_H #include #include namespace qbs { class KeiluvFilesGroupsPropertyGroup final : public gen::xml::PropertyGroup { public: explicit KeiluvFilesGroupsPropertyGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps); }; } // namespace qbs #endif // QBS_KEILUVFILESGROUPSPROPERTYGROUP_H qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvgenerator.cpp0000644000175100017510000001240215154533055024150 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "keiluvgenerator.h" #include "keiluvproject.h" #include "keiluvprojectwriter.h" #include "keiluvworkspace.h" #include "keiluvworkspacewriter.h" #include #include #include #include #include namespace qbs { static void writeProjectFiles(const std::map> &projects, const Internal::Logger &logger) { for (const auto &item : projects) { const QString projectFilePath = item.first; Internal::FileSaver file(projectFilePath.toStdString()); if (!file.open()) throw ErrorInfo(Internal::Tr::tr("Cannot open %s for writing") .arg(projectFilePath)); std::shared_ptr project = item.second; KeiluvProjectWriter writer(file.device()); if (!(writer.write(project.get()) && file.commit())) throw ErrorInfo(Internal::Tr::tr("Failed to generate %1") .arg(projectFilePath)); logger.qbsInfo() << Internal::Tr::tr("Generated %1").arg( QFileInfo(projectFilePath).fileName()); } } static void writeWorkspace(const std::shared_ptr &wokspace, const QString &workspaceFilePath, const Internal::Logger &logger) { Internal::FileSaver file(workspaceFilePath.toStdString()); if (!file.open()) throw ErrorInfo(Internal::Tr::tr("Cannot open %s for writing") .arg(workspaceFilePath)); KeiluvWorkspaceWriter writer(file.device()); if (!(writer.write(wokspace.get()) && file.commit())) throw ErrorInfo(Internal::Tr::tr("Failed to generate %1") .arg(workspaceFilePath)); logger.qbsInfo() << Internal::Tr::tr("Generated %1").arg( QFileInfo(workspaceFilePath).fileName()); } KeiluvGenerator::KeiluvGenerator(const gen::VersionInfo &versionInfo) : m_versionInfo(versionInfo) { } QString KeiluvGenerator::generatorName() const { return QStringLiteral("keiluv%1").arg(m_versionInfo.marketingVersion()); } void KeiluvGenerator::reset() { m_workspace.reset(); m_workspaceFilePath.clear(); m_projects.clear(); } void KeiluvGenerator::generate() { GeneratableProjectIterator it(project()); it.accept(this); writeProjectFiles(m_projects, logger()); writeWorkspace(m_workspace, m_workspaceFilePath, logger()); reset(); } void KeiluvGenerator::visitProject(const GeneratableProject &project) { const QDir buildDir = project.baseBuildDirectory(); m_workspaceFilePath = buildDir.absoluteFilePath( project.name() + QStringLiteral(".uvmpw")); m_workspace = std::make_shared(m_workspaceFilePath); } void KeiluvGenerator::visitProjectData( const GeneratableProject &project, const GeneratableProjectData &projectData) { Q_UNUSED(project) Q_UNUSED(projectData) } void KeiluvGenerator::visitProduct( const GeneratableProject &project, const GeneratableProjectData &projectData, const GeneratableProductData &productData) { Q_UNUSED(projectData); const QDir baseBuildDir(project.baseBuildDirectory().absolutePath()); const QString projFileName = productData.name() + QLatin1String(".uvprojx"); const QString projectFilePath = baseBuildDir.absoluteFilePath(projFileName); const auto targetProject = std::make_shared( project, productData, m_versionInfo); m_projects.insert({projectFilePath, targetProject}); m_workspace->addProject(projectFilePath); } } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/keiluvconstants.h0000644000175100017510000000335715154533055023654 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVCONSTANTS_H #define QBS_KEILUVCONSTANTS_H namespace qbs { namespace KeiluvConstants { namespace v5 { constexpr int kUVisionVersion = 5; } } // namespace KeiluvConstants } // namespace qbs #endif // QBS_KEILUVCONSTANTS_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/0000755000175100017510000000000015154533055021337 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/0000755000175100017510000000000015154533055022267 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51debugoptiongroup_v5.cpp0000644000175100017510000000363715154533055027663 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51debugoptiongroup_v5.h" namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { Mcs51DebugOptionGroup::Mcs51DebugOptionGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("DebugOption") { Q_UNUSED(qbsProject) Q_UNUSED(qbsProduct) } } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcommonoptionsgroup_v5.cpp0000644000175100017510000001221515154533055031447 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51targetcommonoptionsgroup_v5.h" #include "../../keiluvutils.h" #include namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { namespace { struct CommonPageOptions final { explicit CommonPageOptions(const Project &qbsProject, const ProductData &qbsProduct) { Q_UNUSED(qbsProject) const auto &qbsProps = qbsProduct.moduleProperties(); const auto flags = KeiluvUtils::cppModuleCompilerFlags(qbsProps); // Browse information. if (flags.contains(QLatin1String("BROWSE"), Qt::CaseInsensitive)) browseInfo = true; // Debug information. debugInfo = gen::utils::debugInformation(qbsProduct); // Output parameters. executableName = gen::utils::targetBinary(qbsProduct); // Fix output binary name if it is a library. Because // the IDE appends an additional suffix (.LIB) to end // of an output library name. if (executableName.endsWith(QLatin1String(".lib"))) executableName = qbsProduct.targetName(); const QString baseDirectory = gen::utils::buildRootPath(qbsProject); objectDirectory = QDir::toNativeSeparators( gen::utils::objectsOutputDirectory( baseDirectory, qbsProduct)); listingDirectory = QDir::toNativeSeparators( gen::utils::listingOutputDirectory( baseDirectory, qbsProduct)); // Target type. targetType = KeiluvUtils::outputBinaryType(qbsProduct); } int browseInfo = false; int debugInfo = false; QString executableName; QString objectDirectory; QString listingDirectory; KeiluvUtils::OutputBinaryType targetType = KeiluvUtils::ApplicationOutputType; }; } // namespace Mcs51TargetCommonOptionsGroup::Mcs51TargetCommonOptionsGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("TargetCommonOption") { const CommonPageOptions opts(qbsProject, qbsProduct); // Add 'Generic 8051 device' items, // because we can't detect a target device // form the present command lines. appendProperty(QByteArrayLiteral("Device"), QByteArrayLiteral("8051 (all Variants)")); appendProperty(QByteArrayLiteral("Vendor"), QByteArrayLiteral("Generic")); appendProperty(QByteArrayLiteral("DeviceId"), QByteArrayLiteral("2994")); // Add 'Debug Information' item. appendProperty(QByteArrayLiteral("DebugInformation"), opts.debugInfo); // Add 'Browse Information' item. appendProperty(QByteArrayLiteral("BrowseInformation"), opts.browseInfo); // Add 'Name of Executable'. appendProperty(QByteArrayLiteral("OutputName"), opts.executableName); // Add 'Output objects directory'. appendProperty(QByteArrayLiteral("OutputDirectory"), opts.objectDirectory); // Add 'Output listing directory'. appendProperty(QByteArrayLiteral("ListingPath"), opts.listingDirectory); // Add 'Create Executable/Library' item. const int isExecutable = (opts.targetType == KeiluvUtils::ApplicationOutputType); const int isLibrary = (opts.targetType == KeiluvUtils::LibraryOutputType); appendProperty(QByteArrayLiteral("CreateExecutable"), isExecutable); appendProperty(QByteArrayLiteral("CreateLib"), isLibrary); } } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51buildtargetgroup_v5.h0000644000175100017510000000507415154533055027314 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVMCS51BUILDTARGETGROUP_V5_H #define QBS_KEILUVMCS51BUILDTARGETGROUP_V5_H #include namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { class Mcs51BuildTargetGroup final : public gen::xml::PropertyGroup { private: explicit Mcs51BuildTargetGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps); friend class Mcs51BuildTargetGroupFactory; }; class Mcs51BuildTargetGroupFactory final : public gen::xml::PropertyGroupFactory { public: bool canCreate(gen::utils::Architecture arch, const Version &version) const final; std::unique_ptr create( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps) const final; }; } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVMCS51BUILDTARGETGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51targetmiscgroup_v5.cpp0000644000175100017510000000673715154533055027512 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51targetmiscgroup_v5.h" #include "mcs51utils.h" #include "../../keiluvutils.h" namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { namespace { struct MiscPageOptions final { enum MemoryModel { SmallMemoryModel = 0, CompactMemoryModel, LargeMemoryModel }; enum CodeRomSize { SmallCodeRomSize = 0, CompactCodeRomSize, LargeCodeRomSize }; explicit MiscPageOptions(const Project &qbsProject, const ProductData &qbsProduct) { Q_UNUSED(qbsProject) const auto &qbsProps = qbsProduct.moduleProperties(); const auto flags = qbs::KeiluvUtils::cppModuleCompilerFlags(qbsProps); // Memory model. if (flags.contains(QLatin1String("COMPACT"), Qt::CaseInsensitive)) memoryModel = CompactMemoryModel; else if (flags.contains(QLatin1String("LARGE"), Qt::CaseInsensitive)) memoryModel = LargeMemoryModel; // Code ROM size. const auto sizeValue = KeiluvUtils::flagValue( flags, QStringLiteral("ROM")); if (sizeValue == QLatin1String("SMALL")) coderomSize = SmallCodeRomSize; else if (sizeValue == QLatin1String("COMPACT")) coderomSize = CompactCodeRomSize; } MemoryModel memoryModel = SmallMemoryModel; CodeRomSize coderomSize = LargeCodeRomSize; }; } // namespace Mcs51TargetMiscGroup::Mcs51TargetMiscGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("Target51Misc") { const MiscPageOptions opts(qbsProject, qbsProduct); // Add 'Memory Model' options item. appendProperty(QByteArrayLiteral("MemoryModel"), opts.memoryModel); // Add 'ROM Size' options item. appendProperty(QByteArrayLiteral("RomSize"), opts.coderomSize); } } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcompilergroup_v5.cpp0000644000175100017510000002672515154533055030370 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51targetcompilergroup_v5.h" #include "mcs51utils.h" #include "../../keiluvutils.h" namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { namespace { struct CompilerPageOptions final { enum WarningLevel { WarningLevelNone = 0, WarningLevelOne, WarningLevelTwo }; enum OptimizationLevel { ConstantFoldingOptimizationLevel = 0, DeadCodeEliminationOptimizationLevel, DataOverlayingOptimizationLevel, PeepholeOptimizationLevel, RegisterVariablesOptimizationLevel, CommonSubexpressionEliminationOptimizationLevel, LoopRotationOptimizationLevel, ExtendedIndexAccessOptimizationLevel, ReuseCommonEntryCodeOptimizationLevel, CommonBlockSubroutinesOptimizationLevel, RearrangeCodeOptimizationLevel, ReuseCommonExitCodeOptimizationLevel }; enum OptimizationEmphasis { FavorSizeOptimizationEmphasis = 0, FavorSpeedOptimizationEmphasis }; enum FloatFuzzyBits { NoFloatFuzzyBits = 0, OneFloatFuzzyBit, TwoFloatFuzzyBits, ThreeFloatFuzzyBits, FourFloatFuzzyBits, FiveFloatFuzzyBits, SixFloatFuzzyBits, SevenFloatFuzzyBits }; explicit CompilerPageOptions(const Project &qbsProject, const ProductData &qbsProduct) { Q_UNUSED(qbsProject) const auto &qbsProps = qbsProduct.moduleProperties(); const auto flags = qbs::KeiluvUtils::cppModuleCompilerFlags(qbsProps); // Warnings. const QString level = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("warningLevel")); if (level == QLatin1String("none")) { warningLevel = WarningLevelNone; } else if (level == QLatin1String("all")) { warningLevel = WarningLevelTwo; } else { // In this case take it directly from the compiler command line, // e.g. parse the line in a form: 'WARNINGLEVEL (2)' const auto warnValue = KeiluvUtils::flagValue( flags, QStringLiteral("WARNINGLEVEL")); bool ok = false; const auto level = warnValue.toInt(&ok); if (ok && gen::utils::inBounds( level, int(WarningLevelNone),int(WarningLevelTwo))) { warningLevel = static_cast(level); } } // Optimizations. const QString optimization = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("optimization")); if (optimization == QLatin1String("fast")) { optimizationEmphasis = FavorSpeedOptimizationEmphasis; } else if (level == QLatin1String("small")) { optimizationEmphasis = FavorSizeOptimizationEmphasis; } else if (level == QLatin1String("small")) { // Don't supported by C51 compiler. } else { // In this case take it directly from the compiler command line, // e.g. parse the line in a form: 'OPTIMIZE (8, SPEED)' const auto optValue = KeiluvUtils::flagValue( flags, QStringLiteral("OPTIMIZE")); const auto parts = KeiluvUtils::flagValueParts(optValue); for (const auto &part : parts) { bool ok = false; const auto level = part.toInt(&ok); if (ok && (level >= ConstantFoldingOptimizationLevel) && (level <= ReuseCommonExitCodeOptimizationLevel)) { optimizationLevel = static_cast(level); } else if (part.compare(QLatin1String("SIZE"), Qt::CaseInsensitive) == 0) { optimizationEmphasis = FavorSizeOptimizationEmphasis; } else if (part.compare(QLatin1String("SPEED"), Qt::CaseInsensitive) == 0) { optimizationEmphasis = FavorSpeedOptimizationEmphasis; } } } // Don't use absolute register accesses. if (flags.contains(QLatin1String("NOAREGS"), Qt::CaseInsensitive)) dontuseAbsoluteRegsAccess = true; // Enable ANSI integer promotion rules. if (flags.contains(QLatin1String("NOINTPROMOTE"), Qt::CaseInsensitive)) enableIntegerPromotionRules = false; // Keep variables in order. if (flags.contains(QLatin1String("ORDER"), Qt::CaseInsensitive)) keepVariablesInOrder = true; // Don't use interrupt vector. if (flags.contains(QLatin1String("NOINTVECTOR"), Qt::CaseInsensitive)) useInterruptVector = false; // Interrupt vector address. interruptVectorAddress = KeiluvUtils::flagValue( flags, QStringLiteral("INTVECTOR")); // Float fuzzy bits count. const auto bitsValue = KeiluvUtils::flagValue( flags, QStringLiteral("FLOATFUZZY")); bool ok = false; const auto bits = bitsValue.toInt(&ok); if (ok && gen::utils::inBounds( bits, int(NoFloatFuzzyBits), int(SevenFloatFuzzyBits))) { floatFuzzyBits = static_cast(bits); } // Define symbols. defineSymbols = qbs::KeiluvUtils::defines(qbsProps); // Include paths. includePaths = qbs::KeiluvUtils::includes(qbsProps); // Interpret other compiler flags as a misc controls (exclude only // that flags which are was already handled). for (const auto &flag : flags) { if (flag.startsWith(QLatin1String("WARNINGLEVEL"), Qt::CaseInsensitive) || flag.startsWith(QLatin1String("OPTIMIZE"), Qt::CaseInsensitive) || flag.startsWith(QLatin1String("FLOATFUZZY"), Qt::CaseInsensitive) || flag.compare(QLatin1String("NOAREGS"), Qt::CaseInsensitive) == 0 || flag.compare(QLatin1String("AREGS"), Qt::CaseInsensitive) == 0 || flag.compare(QLatin1String("NOINTPROMOTE"), Qt::CaseInsensitive) == 0 || flag.compare(QLatin1String("INTPROMOTE"), Qt::CaseInsensitive) == 0 || flag.compare(QLatin1String("NOINTVECTOR"), Qt::CaseInsensitive) == 0 || flag.compare(QLatin1String("INTVECTOR"), Qt::CaseInsensitive) == 0 || flag.compare(QLatin1String("ORDER"), Qt::CaseInsensitive) == 0 || flag.compare(QLatin1String("BROSWE"), Qt::CaseInsensitive) == 0 ) { continue; } miscControls.push_back(flag); } } WarningLevel warningLevel = WarningLevelTwo; OptimizationLevel optimizationLevel = ReuseCommonEntryCodeOptimizationLevel; OptimizationEmphasis optimizationEmphasis = FavorSpeedOptimizationEmphasis; FloatFuzzyBits floatFuzzyBits = ThreeFloatFuzzyBits; int dontuseAbsoluteRegsAccess = false; int enableIntegerPromotionRules = true; int keepVariablesInOrder = false; int useInterruptVector = true; QString interruptVectorAddress; QStringList defineSymbols; QStringList includePaths; QStringList miscControls; }; } // namespace Mcs51TargetCompilerGroup::Mcs51TargetCompilerGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("C51") { const CompilerPageOptions opts(qbsProject, qbsProduct); // Add 'Code Optimization' options. appendProperty(QByteArrayLiteral("Optimize"), opts.optimizationLevel); appendProperty(QByteArrayLiteral("SizeSpeed"), opts.optimizationEmphasis); // Add 'Warnings' options. appendProperty(QByteArrayLiteral("WarningLevel"), opts.warningLevel); // Add 'Don't use absolute register access' item. appendProperty(QByteArrayLiteral("uAregs"), opts.dontuseAbsoluteRegsAccess); // Add 'Enable integer promotion rules' item. appendProperty(QByteArrayLiteral("IntegerPromotion"), opts.enableIntegerPromotionRules); // Add 'Keep variables in order' item. appendProperty(QByteArrayLiteral("VariablesInOrder"), opts.keepVariablesInOrder); // Add 'Use interrupt vector' item. appendProperty(QByteArrayLiteral("UseInterruptVector"), opts.useInterruptVector); appendProperty(QByteArrayLiteral("InterruptVectorAddress"), opts.interruptVectorAddress); // Add 'Float fuzzy bits' item. appendProperty(QByteArrayLiteral("Fuzzy"), opts.floatFuzzyBits); // Add other various controls. // Note: A sub-items order makes sense! const auto variousControlsGroup = appendChild( QByteArrayLiteral("VariousControls")); // Add 'Misc Controls' item. variousControlsGroup->appendMultiLineProperty( QByteArrayLiteral("MiscControls"), opts.miscControls, QLatin1Char(' ')); // Add 'Define' item. variousControlsGroup->appendMultiLineProperty( QByteArrayLiteral("Define"), opts.defineSymbols); // Add an empty 'Undefine' item. variousControlsGroup->appendProperty( QByteArrayLiteral("Undefine"), {}); // Add 'Include Paths' item. variousControlsGroup->appendMultiLineProperty( QByteArrayLiteral("IncludePath"), opts.includePaths, QLatin1Char(';')); } } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51targetgroup_v5.cpp0000644000175100017510000000440115154533055026620 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51targetassemblergroup_v5.h" #include "mcs51targetcompilergroup_v5.h" #include "mcs51targetgroup_v5.h" #include "mcs51targetlinkergroup_v5.h" #include "mcs51targetmiscgroup_v5.h" namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { Mcs51TargetGroup::Mcs51TargetGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("Target51") { appendChild(qbsProject, qbsProduct); appendChild(qbsProject, qbsProduct); appendChild(qbsProject, qbsProduct); appendChild(qbsProject, qbsProduct); } } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51utilitiesgroup_v5.cpp0000644000175100017510000000362715154533055027356 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51utilitiesgroup_v5.h" namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { Mcs51UtilitiesGroup::Mcs51UtilitiesGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("Utilities") { Q_UNUSED(qbsProject) Q_UNUSED(qbsProduct) } } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51targetgroup_v5.h0000644000175100017510000000400015154533055026260 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVMCS51TARGETGROUP_V5_H #define QBS_KEILUVMCS51TARGETGROUP_V5_H #include namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { class Mcs51TargetGroup final : public gen::xml::PropertyGroup { public: explicit Mcs51TargetGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVMCS51TARGETGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51debugoptiongroup_v5.h0000644000175100017510000000403115154533055027315 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVMCS51DEBUGOPTIONGROUP_V5_H #define QBS_KEILUVMCS51DEBUGOPTIONGROUP_V5_H #include namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { class Mcs51DebugOptionGroup final : public gen::xml::PropertyGroup { public: explicit Mcs51DebugOptionGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVMCS51DEBUGOPTIONGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51targetlinkergroup_v5.cpp0000644000175100017510000002300515154533055030026 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51targetlinkergroup_v5.h" #include "mcs51utils.h" #include "../../keiluvutils.h" namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { namespace { struct LinkerPageOptions final { explicit LinkerPageOptions(const Project &qbsProject, const ProductData &qbsProduct) { Q_UNUSED(qbsProject) const auto &qbsProps = qbsProduct.moduleProperties(); const auto flags = qbs::KeiluvUtils::cppModuleLinkerFlags(qbsProps); // Handle all 'BIT' memory flags. parseMemory(flags, QStringLiteral("BIT"), bitAddresses, bitSegments); // Handle all 'CODE' memory flags. parseMemory(flags, QStringLiteral("CODE"), codeAddresses, codeSegments); // Handle all 'DATA' memory flags. parseMemory(flags, QStringLiteral("DATA"), dataAddresses, dataSegments); // Handle all 'IDATA' memory flags. parseMemory(flags, QStringLiteral("IDATA"), idataAddresses, idataSegments); // Handle all 'PDATA' memory flags. parseMemory(flags, QStringLiteral("PDATA"), pdataAddresses, pdataSegments); // Handle all 'XDATA' memory flags. parseMemory(flags, QStringLiteral("XDATA"), xdataAddresses, xdataSegments); // Enumerate all flags in a form like: // 'PRECEDE(foo, bar) PRECEDE(baz)'. const auto precedeValues = KeiluvUtils::flagValues( flags, QStringLiteral("PRECEDE")); for (const auto &precedeValue : precedeValues) { const auto parts = KeiluvUtils::flagValueParts(precedeValue); precedeSegments.reserve(precedeSegments.size() + parts.count()); std::copy(parts.cbegin(), parts.cend(), std::back_inserter(precedeSegments)); } // Enumerate all flags in a form like: // 'STACK(foo, bar) STACK(baz)'. const auto stackValues = KeiluvUtils::flagValues( flags, QStringLiteral("STACK")); for (const auto &stackValue : stackValues) { const auto parts = KeiluvUtils::flagValueParts(stackValue); stackSegments.reserve(stackSegments.size() + parts.count()); std::copy(parts.cbegin(), parts.cend(), std::back_inserter(stackSegments)); } // Interpret other linker flags as a misc controls (exclude only // that flags which are was already handled). for (const auto &flag : flags) { if (flag.startsWith(QLatin1String("BIT"), Qt::CaseInsensitive) || flag.startsWith(QLatin1String("CODE"), Qt::CaseInsensitive) || flag.startsWith(QLatin1String("DATA"), Qt::CaseInsensitive) || flag.startsWith(QLatin1String("IDATA"), Qt::CaseInsensitive) || flag.startsWith(QLatin1String("PDATA"), Qt::CaseInsensitive) || flag.startsWith(QLatin1String("XDATA"), Qt::CaseInsensitive) || flag.startsWith(QLatin1String("PRECEDE"), Qt::CaseInsensitive) || flag.startsWith(QLatin1String("STACK"), Qt::CaseInsensitive) ) { continue; } miscControls.push_back(flag); } } static void parseMemory(const QStringList &flags, const QString &flagKey, QStringList &destAddresses, QStringList &destSegments) { // Handle all flags in a form like: // 'FLAGKEY(0x00-0x20, 30, foo, bar(0x40)) FLAGKEY(baz)'. const auto values = KeiluvUtils::flagValues(flags, flagKey); for (const auto &value : values) { const auto parts = KeiluvUtils::flagValueParts(value); for (const auto &part : parts) { if (part.contains(QLatin1Char('-'))) { // Seems, it is an address range. destAddresses.push_back(part); } else { // Check on address (specified in decimal // or hexadecimal form). bool ok = false; part.toInt(&ok, 16); if (!ok) part.toInt(&ok, 10); if (ok) { // Seems, it is just a single address. destAddresses.push_back(part); } else { // Seems it is a segment name. destSegments.push_back(part); } } } } } QStringList bitAddresses; QStringList bitSegments; QStringList codeAddresses; QStringList codeSegments; QStringList dataAddresses; QStringList dataSegments; QStringList idataAddresses; QStringList idataSegments; QStringList pdataAddresses; QStringList pdataSegments; QStringList xdataAddresses; QStringList xdataSegments; QStringList precedeSegments; QStringList stackSegments; QStringList miscControls; }; } // namespace Mcs51TargetLinkerGroup::Mcs51TargetLinkerGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("Lx51") { const LinkerPageOptions opts(qbsProject, qbsProduct); // Add 'Misc Controls' item. appendMultiLineProperty(QByteArrayLiteral("MiscControls"), opts.miscControls, QLatin1Char(' ')); // Add 'Use Memory Layout from Target Dialog' item. // Note: we always disable it, as we expect that // the layout will be specified from the linker's // command line. appendProperty(QByteArrayLiteral("UseMemoryFromTarget"), 0); // Add 'Bit Range' item. appendMultiLineProperty(QByteArrayLiteral("BitBaseAddress"), opts.bitAddresses); // Add 'Code Range' item. appendMultiLineProperty(QByteArrayLiteral("CodeBaseAddress"), opts.codeAddresses); // Add 'Data Range' item. appendMultiLineProperty(QByteArrayLiteral("DataBaseAddress"), opts.dataAddresses); // Add 'IData Range' item. appendMultiLineProperty(QByteArrayLiteral("IDataBaseAddress"), opts.idataAddresses); // Add 'PData Range' item. appendMultiLineProperty(QByteArrayLiteral("PDataBaseAddress"), opts.pdataAddresses); // Add 'XData Range' item. appendMultiLineProperty(QByteArrayLiteral("XDataBaseAddress"), opts.xdataAddresses); // Add 'Bit Segment' item. appendMultiLineProperty(QByteArrayLiteral("BitSegmentName"), opts.bitSegments); // Add 'Code Segment' item. appendMultiLineProperty(QByteArrayLiteral("CodeSegmentName"), opts.codeSegments); // Add 'Data Segment' item. appendMultiLineProperty(QByteArrayLiteral("DataSegmentName"), opts.dataSegments); // Add 'IData Segment' item. appendMultiLineProperty(QByteArrayLiteral("IDataSegmentName"), opts.idataSegments); // Note: PData has not segments! // Add 'XData Segment' item. appendMultiLineProperty(QByteArrayLiteral("XDataSegmentName"), opts.xdataSegments); // Add 'Precede' item. appendMultiLineProperty(QByteArrayLiteral("Precede"), opts.precedeSegments); // Add 'Stack' item. appendMultiLineProperty(QByteArrayLiteral("Stack"), opts.stackSegments); } } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcompilergroup_v5.h0000644000175100017510000000405015154533055030020 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVMCS51TARGETCOMPILERGROUP_V5_H #define QBS_KEILUVMCS51TARGETCOMPILERGROUP_V5_H #include namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { class Mcs51TargetCompilerGroup final : public gen::xml::PropertyGroup { public: explicit Mcs51TargetCompilerGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVMCS51TARGETCOMPILERGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51targetlinkergroup_v5.h0000644000175100017510000000403615154533055027476 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVMCS51TARGETLINKERGROUP_V5_H #define QBS_KEILUVMCS51TARGETLINKERGROUP_V5_H #include namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { class Mcs51TargetLinkerGroup final : public gen::xml::PropertyGroup { public: explicit Mcs51TargetLinkerGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVMCS51TARGETLINKERGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51commonpropertygroup_v5.h0000644000175100017510000000404215154533055030075 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVMCS51COMMONPROPERTYGROUP_V5_H #define QBS_KEILUVMCS51COMMONPROPERTYGROUP_V5_H #include namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { class Mcs51CommonPropertyGroup final : public gen::xml::PropertyGroup { public: explicit Mcs51CommonPropertyGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs #endif // QBS_MCS51COMMONPROPERTYGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51dlloptiongroup_v5.cpp0000644000175100017510000000362715154533055027347 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51dlloptiongroup_v5.h" namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { Mcs51DllOptionGroup::Mcs51DllOptionGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("DllOption") { Q_UNUSED(qbsProject) Q_UNUSED(qbsProduct) } } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51utils.cpp0000644000175100017510000000570215154533055025010 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51utils.h" #include namespace qbs { namespace keiluv { namespace mcs51 { namespace KeiluvUtils { static QString extractValue(const QString &flag) { const auto openBracketIndex = flag.indexOf(QLatin1Char('(')); const auto closeBracketIndex = flag.indexOf(QLatin1Char(')')); const auto n = closeBracketIndex - openBracketIndex - 1; return flag.mid(openBracketIndex + 1, n); } QStringList flagValues(const QStringList &flags, const QString &flagKey) { QStringList values; for (const auto &flag : flags) { if (!flag.startsWith(flagKey, Qt::CaseInsensitive)) continue; const auto value = extractValue(flag); values.push_back(value); } return values; } QString flagValue(const QStringList &flags, const QString &flagKey) { const auto flagEnd = flags.cend(); const auto flagIt = std::find_if(flags.cbegin(), flagEnd, [flagKey](const auto &flag) { return flag.startsWith(flagKey, Qt::CaseInsensitive); }); if (flagIt == flagEnd) return {}; // Flag key not found. return extractValue(*flagIt); } QStringList flagValueParts(const QString &flagValue, const QLatin1Char &sep) { auto parts = flagValue.split(sep); Internal::transform(parts, [](const auto &part) { return part.trimmed(); }); return parts; } } // namespace KeiluvUtils } // namespace mcs51 } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51targetmiscgroup_v5.h0000644000175100017510000000402415154533055027142 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVMCS51TARGETMISCGROUP_V5_H #define QBS_KEILUVMCS51TARGETMISCGROUP_V5_H #include namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { class Mcs51TargetMiscGroup final : public gen::xml::PropertyGroup { public: explicit Mcs51TargetMiscGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVMCS51TARGETMISCGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51commonpropertygroup_v5.cpp0000644000175100017510000000365315154533055030437 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51commonpropertygroup_v5.h" namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { Mcs51CommonPropertyGroup::Mcs51CommonPropertyGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("CommonProperty") { Q_UNUSED(qbsProject) Q_UNUSED(qbsProduct) } } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51utils.h0000644000175100017510000000406715154533055024460 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVMCS51UTILS_H #define QBS_KEILUVMCS51UTILS_H #include namespace qbs { namespace keiluv { namespace mcs51 { namespace KeiluvUtils { QStringList flagValues(const QStringList &flags, const QString &flagKey); QString flagValue(const QStringList &flags, const QString &flagKey); QStringList flagValueParts(const QString &flagValue, const QLatin1Char &sep = QLatin1Char(',')); } // namespace KeiluvUtils } // namespace mcs51 } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVMCS51UTILS_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51buildtargetgroup_v5.cpp0000644000175100017510000001057115154533055027645 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51buildtargetgroup_v5.h" #include "mcs51commonpropertygroup_v5.h" #include "mcs51debugoptiongroup_v5.h" #include "mcs51dlloptiongroup_v5.h" #include "mcs51targetcommonoptionsgroup_v5.h" #include "mcs51targetgroup_v5.h" #include "mcs51utilitiesgroup_v5.h" #include "mcs51utils.h" #include "../../keiluvconstants.h" #include "../../keiluvfilesgroupspropertygroup.h" namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { Mcs51BuildTargetGroup::Mcs51BuildTargetGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps) : gen::xml::PropertyGroup("Target") { // Append target name item (it is a build configuration name). const QString targetName = gen::utils::buildConfigurationName( qbsProject); appendProperty(QByteArrayLiteral("TargetName"), targetName); // Append toolset number group item. appendChild(QByteArrayLiteral("ToolsetNumber"), QByteArrayLiteral("0x0")); // Append toolset name group item. appendChild(QByteArrayLiteral("ToolsetName"), QByteArrayLiteral("MCS-51")); // Append target option group item. const auto targetOptionGroup = appendChild( QByteArrayLiteral("TargetOption")); targetOptionGroup->appendChild( qbsProject, qbsProduct); targetOptionGroup->appendChild( qbsProject, qbsProduct); targetOptionGroup->appendChild( qbsProject, qbsProduct); targetOptionGroup->appendChild( qbsProject, qbsProduct); targetOptionGroup->appendChild( qbsProject, qbsProduct); targetOptionGroup->appendChild( qbsProject, qbsProduct); // Append files group. appendChild(qbsProject, qbsProduct, qbsProductDeps); } bool Mcs51BuildTargetGroupFactory::canCreate( gen::utils::Architecture arch, const Version &version) const { return arch == gen::utils::Architecture::Mcs51 && version.majorVersion() == qbs::KeiluvConstants::v5::kUVisionVersion; } std::unique_ptr Mcs51BuildTargetGroupFactory::create( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps) const { const auto group = new Mcs51BuildTargetGroup( qbsProject, qbsProduct, qbsProductDeps); return std::unique_ptr(group); } } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51targetassemblergroup_v5.cpp0000644000175100017510000001263415154533055030525 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "mcs51targetassemblergroup_v5.h" #include "mcs51utils.h" #include "../../keiluvutils.h" namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { namespace { struct AssemblerPageOptions final { explicit AssemblerPageOptions(const Project &qbsProject, const ProductData &qbsProduct) { Q_UNUSED(qbsProject) const auto &qbsProps = qbsProduct.moduleProperties(); const auto flags = qbs::KeiluvUtils::cppModuleAssemblerFlags(qbsProps); // Don't use standard macro. if (flags.contains(QLatin1String("NOMACRO"), Qt::CaseInsensitive)) useStandardMacroProcessor = false; // Use MPL. if (flags.contains(QLatin1String("MPL"), Qt::CaseInsensitive)) useMacroProcessingLanguage = true; // Define 8051 SFR names. if (flags.contains(QLatin1String("NOMOD51"), Qt::CaseInsensitive)) suppressSfrNames = true; // Define symbols. defineSymbols = qbs::KeiluvUtils::defines(qbsProps); // Include paths. includePaths = qbs::KeiluvUtils::includes(qbsProps); // Interpret other assembler flags as a misc controls (exclude only // that flags which are was already handled). for (const auto &flag : flags) { if (flag.compare(QLatin1String("NOMACRO"), Qt::CaseInsensitive) == 0 || flag.compare(QLatin1String("MACRO"), Qt::CaseInsensitive) == 0 || flag.compare(QLatin1String("NOMPL"), Qt::CaseInsensitive) == 0 || flag.compare(QLatin1String("MPL"), Qt::CaseInsensitive) == 0 || flag.compare(QLatin1String("NOMOD51"), Qt::CaseInsensitive) == 0 || flag.compare(QLatin1String("MOD51"), Qt::CaseInsensitive) == 0 ) { continue; } miscControls.push_back(flag); } } int useStandardMacroProcessor = true; int useMacroProcessingLanguage = false; int suppressSfrNames = false; QStringList defineSymbols; QStringList includePaths; QStringList miscControls; }; } // namespace Mcs51TargetAssemblerGroup::Mcs51TargetAssemblerGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("Ax51") { const AssemblerPageOptions opts(qbsProject, qbsProduct); // Add 'Macro processor (Standard)' appendProperty(QByteArrayLiteral("UseStandard"), opts.useStandardMacroProcessor); // Add 'Macro processor (MPL)' appendProperty(QByteArrayLiteral("UseMpl"), opts.useMacroProcessingLanguage); // Add 'Define 8051 SFR names' appendProperty(QByteArrayLiteral("UseMod51"), opts.suppressSfrNames); // Add other various controls. // Note: A sub-items order makes sense! const auto variousControlsGroup = appendChild( QByteArrayLiteral("VariousControls")); // Add 'Misc Controls' item. variousControlsGroup->appendMultiLineProperty( QByteArrayLiteral("MiscControls"), opts.miscControls, QLatin1Char(' ')); // Add 'Define' item. variousControlsGroup->appendMultiLineProperty( QByteArrayLiteral("Define"), opts.defineSymbols); // Add an empty 'Undefine' item. variousControlsGroup->appendProperty( QByteArrayLiteral("Undefine"), {}); // Add 'Include Paths' item. variousControlsGroup->appendMultiLineProperty( QByteArrayLiteral("IncludePath"), opts.includePaths, QLatin1Char(';')); } } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51targetassemblergroup_v5.h0000644000175100017510000000404715154533055030171 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVMCS51TARGETASSEMBLERGROUP_V3 #define QBS_KEILUVMCS51TARGETASSEMBLERGROUP_V3 #include namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { class Mcs51TargetAssemblerGroup final : public gen::xml::PropertyGroup { public: explicit Mcs51TargetAssemblerGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVMCS51TARGETASSEMBLERGROUP_V3 qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51dlloptiongroup_v5.h0000644000175100017510000000401715154533055027006 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVMCS51DLLOPTIONGROUP_V5_H #define QBS_KEILUVMCS51DLLOPTIONGROUP_V5_H #include namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { class Mcs51DllOptionGroup final : public gen::xml::PropertyGroup { public: explicit Mcs51DllOptionGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVMCS51DLLOPTIONGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcommonoptionsgroup_v5.h0000644000175100017510000000410115154533055031107 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVMCS51TARGETCOMMONOPTIONSGROUP_V5_H #define QBS_KEILUVMCS51TARGETCOMMONOPTIONSGROUP_V5_H #include namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { class Mcs51TargetCommonOptionsGroup final : public gen::xml::PropertyGroup { public: explicit Mcs51TargetCommonOptionsGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVMCS51TARGETCOMMONOPTIONSGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/mcs51/mcs51utilitiesgroup_v5.h0000644000175100017510000000401715154533055027015 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVMCS51UTILITIESGROUP_V5_H #define QBS_KEILUVMCS51UTILITIESGROUP_V5_H #include namespace qbs { namespace keiluv { namespace mcs51 { namespace v5 { class Mcs51UtilitiesGroup final : public gen::xml::PropertyGroup { public: explicit Mcs51UtilitiesGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace mcs51 } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVMCS51UTILITIESGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/0000755000175100017510000000000015154533055022116 5ustar runnerrunnerqbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armutilitiesgroup_v5.cpp0000644000175100017510000000361515154533055027031 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armutilitiesgroup_v5.h" namespace qbs { namespace keiluv { namespace arm { namespace v5 { ArmUtilitiesGroup::ArmUtilitiesGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("Utilities") { Q_UNUSED(qbsProject) Q_UNUSED(qbsProduct) } } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armutilitiesgroup_v5.h0000644000175100017510000000400115154533055026464 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVARMUTILITIESGROUP_V5_H #define QBS_KEILUVARMUTILITIESGROUP_V5_H #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { class ArmUtilitiesGroup final : public gen::xml::PropertyGroup { public: explicit ArmUtilitiesGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVARMUTILITIESGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armtargetcommonoptionsgroup_v5.h0000644000175100017510000000406315154533055030574 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVARMTARGETCOMMONOPTIONSGROUP_V5_H #define QBS_KEILUVARMTARGETCOMMONOPTIONSGROUP_V5_H #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { class ArmTargetCommonOptionsGroup final : public gen::xml::PropertyGroup { public: explicit ArmTargetCommonOptionsGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVARMTARGETCOMMONOPTIONSGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armbuildtargetgroup_v5.cpp0000644000175100017510000001046615154533055027326 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armbuildtargetgroup_v5.h" #include "armcommonpropertygroup_v5.h" #include "armdebugoptiongroup_v5.h" #include "armdlloptiongroup_v5.h" #include "armtargetcommonoptionsgroup_v5.h" #include "armtargetgroup_v5.h" #include "armutilitiesgroup_v5.h" #include "../../keiluvconstants.h" #include "../../keiluvfilesgroupspropertygroup.h" namespace qbs { namespace keiluv { namespace arm { namespace v5 { ArmBuildTargetGroup::ArmBuildTargetGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps) : gen::xml::PropertyGroup("Target") { // Append target name item (it is a build configuration name). const QString targetName = gen::utils::buildConfigurationName( qbsProject); appendProperty(QByteArrayLiteral("TargetName"), targetName); // Append toolset number group item. appendChild(QByteArrayLiteral("ToolsetNumber"), QByteArrayLiteral("0x4")); // Append toolset name group item. appendChild(QByteArrayLiteral("ToolsetName"), QByteArrayLiteral("ARM-ADS")); // Append target option group item. const auto targetOptionGroup = appendChild( QByteArrayLiteral("TargetOption")); targetOptionGroup->appendChild( qbsProject, qbsProduct); targetOptionGroup->appendChild( qbsProject, qbsProduct); targetOptionGroup->appendChild( qbsProject, qbsProduct); targetOptionGroup->appendChild( qbsProject, qbsProduct); targetOptionGroup->appendChild( qbsProject, qbsProduct); targetOptionGroup->appendChild( qbsProject, qbsProduct); // Append files group. appendChild(qbsProject, qbsProduct, qbsProductDeps); } bool ArmBuildTargetGroupFactory::canCreate( gen::utils::Architecture arch, const Version &version) const { return arch == gen::utils::Architecture::Arm && version.majorVersion() == qbs::KeiluvConstants::v5::kUVisionVersion; } std::unique_ptr ArmBuildTargetGroupFactory::create( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps) const { const auto group = new ArmBuildTargetGroup( qbsProject, qbsProduct, qbsProductDeps); return std::unique_ptr(group); } } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armdebugoptiongroup_v5.cpp0000644000175100017510000000362515154533055027336 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armdebugoptiongroup_v5.h" namespace qbs { namespace keiluv { namespace arm { namespace v5 { ArmDebugOptionGroup::ArmDebugOptionGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("DebugOption") { Q_UNUSED(qbsProject) Q_UNUSED(qbsProduct) } } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armcommonpropertygroup_v5.cpp0000644000175100017510000000364115154533055030112 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armcommonpropertygroup_v5.h" namespace qbs { namespace keiluv { namespace arm { namespace v5 { ArmCommonPropertyGroup::ArmCommonPropertyGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("CommonProperty") { Q_UNUSED(qbsProject) Q_UNUSED(qbsProduct) } } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armtargetcompilergroup_v5.h0000644000175100017510000000403215154533055027476 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVARMTARGETCOMPILERGROUP_V5_H #define QBS_KEILUVARMTARGETCOMPILERGROUP_V5_H #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { class ArmTargetCompilerGroup final : public gen::xml::PropertyGroup { public: explicit ArmTargetCompilerGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVARMTARGETCOMPILERGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armcommonpropertygroup_v5.h0000644000175100017510000000402615154533055027555 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVARMCOMMONPROPERTYGROUP_V5_H #define QBS_KEILUVARMCOMMONPROPERTYGROUP_V5_H #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { class ArmCommonPropertyGroup final : public gen::xml::PropertyGroup { public: explicit ArmCommonPropertyGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs #endif // QBS_MCS51COMMONPROPERTYGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armtargetcompilergroup_v5.cpp0000644000175100017510000002114115154533055030031 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armtargetcompilergroup_v5.h" #include "../../keiluvutils.h" namespace qbs { namespace keiluv { namespace arm { namespace v5 { namespace { struct CompilerPageOptions final { enum WarningLevel { WarningLevelUnspecified = 0, WarningLevelNone, WarningLevelAll }; enum OptimizationLevel { OptimizationLevelUnspecified = 0, OptimizationLevelNone, OptimizationLevelOne, OptimizationLevelTwo, OptimizationLevelThree, }; explicit CompilerPageOptions(const Project &qbsProject, const ProductData &qbsProduct) { Q_UNUSED(qbsProject) const auto &qbsProps = qbsProduct.moduleProperties(); const auto flags = qbs::KeiluvUtils::cppModuleCompilerFlags(qbsProps); // Warning levels. const QString wLevel = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("warningLevel")); if (wLevel == QLatin1String("none")) warningLevel = WarningLevelNone; else if (wLevel == QLatin1String("all")) warningLevel = WarningLevelAll; else warningLevel = WarningLevelUnspecified; // Generation code. generateExecuteOnlyCode = flags.contains(QLatin1String("--execute_only")); // Optimization levels. const QString oLevel = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("optimization")); if (oLevel == QLatin1String("fast")) enableTimeOptimization = 1; else if (oLevel == QLatin1String("small")) optimizationLevel = OptimizationLevelThree; else if (oLevel == QLatin1String("none")) optimizationLevel = OptimizationLevelNone; // Split load and store multiple. splitLdm = flags.contains(QLatin1String("--split_ldm")); // One ELF section per function. splitSections = flags.contains(QLatin1String("--split_sections")); // String ANSI C. useStrictAnsiC = flags.contains(QLatin1String("--strict")); // Enum container always int. forceEnumAsInt = flags.contains(QLatin1String("--enum_is_int")); // Plain char is signed. useSignedChar = flags.contains(QLatin1String("--signed_chars")); // Read-only position independent. enableRopi = flags.contains(QLatin1String("/ropi")); // Read-write position independent. enableRwpi = flags.contains(QLatin1String("/rwpi")); // C-language version. const QString clVersion = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("cLanguageVersion")); // C99 mode. useC99Language = clVersion.contains(QLatin1String("c99")); // Define symbols. defineSymbols = qbs::KeiluvUtils::defines(qbsProps); // Include paths. includePaths = qbs::KeiluvUtils::includes(qbsProps); // Interpret other compiler flags as a misc controls (exclude only // that flags which are was already handled). for (auto flagIt = flags.cbegin(); flagIt < flags.cend(); ++flagIt) { if (flagIt->contains(QLatin1String("--execute_only")) || flagIt->contains(QLatin1String("--split_ldm")) || flagIt->contains(QLatin1String("--split_sections")) || flagIt->contains(QLatin1String("--strict")) || flagIt->contains(QLatin1String("--enum_is_int")) || flagIt->contains(QLatin1String("--signed_chars")) || flagIt->contains(QLatin1String("/ropi")) || flagIt->contains(QLatin1String("/rwpi")) || flagIt->contains(QLatin1String("--c99")) ) { continue; } if (flagIt->startsWith(QLatin1String("-O")) || flagIt->startsWith(QLatin1String("-W")) || flagIt->startsWith(QLatin1String("-D")) || flagIt->startsWith(QLatin1String("-I")) || flagIt->startsWith(QLatin1String("--cpu")) || flagIt->startsWith(QLatin1String("--fpu")) ) { ++flagIt; continue; } miscControls.push_back(*flagIt); } } WarningLevel warningLevel = WarningLevelAll; OptimizationLevel optimizationLevel = OptimizationLevelUnspecified; int enableTimeOptimization = 0; int generateExecuteOnlyCode = 0; int splitLdm = 0; int splitSections = 0; int useStrictAnsiC = 0; int forceEnumAsInt = 0; int useSignedChar = 0; int enableRopi = 0; int enableRwpi = 0; int useC99Language = 0; QStringList defineSymbols; QStringList includePaths; QStringList miscControls; }; } // namespace ArmTargetCompilerGroup::ArmTargetCompilerGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("Cads") { const CompilerPageOptions opts(qbsProject, qbsProduct); // Add 'Code Optimization' items. appendProperty(QByteArrayLiteral("Optim"), opts.optimizationLevel); appendProperty(QByteArrayLiteral("oTime"), opts.enableTimeOptimization); // Add 'Slpit LDM' item. appendProperty(QByteArrayLiteral("SplitLS"), opts.splitLdm); // Add 'Slpit sections' item. appendProperty(QByteArrayLiteral("OneElfS"), opts.splitSections); // Add 'Strict ANSI C' item. appendProperty(QByteArrayLiteral("Strict"), opts.useStrictAnsiC); // Add 'Enums as int' item. appendProperty(QByteArrayLiteral("EnumInt"), opts.forceEnumAsInt); // Add 'Plain char as signed' item. appendProperty(QByteArrayLiteral("PlainCh"), opts.useSignedChar); // Add 'ROPI' item. appendProperty(QByteArrayLiteral("Ropi"), opts.enableRopi); // Add 'RWPI' item. appendProperty(QByteArrayLiteral("Rwpi"), opts.enableRwpi); // Add 'Warnings' item. appendProperty(QByteArrayLiteral("wLevel"), opts.warningLevel); // Add 'Use C99' item. appendProperty(QByteArrayLiteral("uC99"), opts.useC99Language); // Add 'Generate code exedutable only' item. appendProperty(QByteArrayLiteral("useXo"), opts.generateExecuteOnlyCode); // Add other various controls. // Note: A sub-items order makes sense! const auto variousControlsGroup = appendChild( QByteArrayLiteral("VariousControls")); // Add 'Misc Controls' item. variousControlsGroup->appendMultiLineProperty( QByteArrayLiteral("MiscControls"), opts.miscControls, QLatin1Char(' ')); // Add 'Define' item. variousControlsGroup->appendMultiLineProperty( QByteArrayLiteral("Define"), opts.defineSymbols); // Add an empty 'Undefine' item. variousControlsGroup->appendProperty( QByteArrayLiteral("Undefine"), {}); // Add 'Include Paths' item. variousControlsGroup->appendMultiLineProperty( QByteArrayLiteral("IncludePath"), opts.includePaths, QLatin1Char(';')); } } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armtargetassemblergroup_v5.h0000644000175100017510000000403115154533055027640 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVARMTARGETASSEMBLERGROUP_V3 #define QBS_KEILUVARMTARGETASSEMBLERGROUP_V3 #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { class ArmTargetAssemblerGroup final : public gen::xml::PropertyGroup { public: explicit ArmTargetAssemblerGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVARMTARGETASSEMBLERGROUP_V3 qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armdebugoptiongroup_v5.h0000644000175100017510000000401315154533055026773 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVARMDEBUGOPTIONGROUP_V5_H #define QBS_KEILUVARMDEBUGOPTIONGROUP_V5_H #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { class ArmDebugOptionGroup final : public gen::xml::PropertyGroup { public: explicit ArmDebugOptionGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVARMDEBUGOPTIONGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armdlloptiongroup_v5.cpp0000644000175100017510000000361515154533055027022 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armdlloptiongroup_v5.h" namespace qbs { namespace keiluv { namespace arm { namespace v5 { ArmDllOptionGroup::ArmDllOptionGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("DllOption") { Q_UNUSED(qbsProject) Q_UNUSED(qbsProduct) } } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armdlloptiongroup_v5.h0000644000175100017510000000400115154533055026455 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVARMDLLOPTIONGROUP_V5_H #define QBS_KEILUVARMDLLOPTIONGROUP_V5_H #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { class ArmDllOptionGroup final : public gen::xml::PropertyGroup { public: explicit ArmDllOptionGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVARMDLLOPTIONGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armtargetcommonoptionsgroup_v5.cpp0000644000175100017510000001742715154533055031137 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armtargetcommonoptionsgroup_v5.h" #include "../../keiluvutils.h" #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { namespace { const struct DeviceEntry { QByteArray cpu; // CPU option. std::set fpus; // FPU's options. QByteArray device; // Project file entry. } deviceDict[] = { {"8-M.Base", {}, "ARMv8MBL"}, {"8-M.Main", {"FPv5-SP"}, "ARMv8MML_SP"}, {"8-M.Main", {"FPv5_D16"}, "ARMv8MML_DP"}, {"8-M.Main", {"SoftVFP"},"ARMv8MML"}, {"8-M.Main.dsp", {"FPv5-SP"}, "ARMv8MML_DSP_SP"}, {"8-M.Main.dsp", {"FPv5_D16"}, "ARMv8MML_DSP_DP"}, {"8-M.Main.dsp", {"SoftVFP"}, "ARMv8MML_DSP"}, {"Cortex-M0", {}, "ARMCM0"}, {"Cortex-M0+", {}, "ARMCM0P"}, {"Cortex-M0plus", {}, "ARMCM0P"}, {"Cortex-M23", {}, "ARMCM23"}, // same as ARMCM23_TZ {"Cortex-M3", {}, "ARMCM3"}, {"Cortex-M4", {}, "ARMCM4"}, {"Cortex-M4.fp", {}, "ARMCM4_FP"}, {"Cortex-M7", {"SoftVFP"}, "ARMCM7"}, {"Cortex-M7.fp.dp", {}, "ARMCM7_DP"}, {"Cortex-M7.fp.sp", {}, "ARMCM7_SP"}, {"SC000", {}, "ARMSC000"}, {"SC300", {}, "ARMSC300"}, {"Cortex-M33.no_dsp", {"SoftVFP"}, "ARMCM33"}, // same as ARMCM33_TZ {"Cortex-M33", {"FPv5-SP", "softvfp+vfpv2"}, "ARMCM33_DSP_FP"}, // same as ARMCM33_DSP_FP_TZ }; struct CommonPageOptions final { explicit CommonPageOptions(const Project &qbsProject, const ProductData &qbsProduct) { Q_UNUSED(qbsProject) const auto &qbsProps = qbsProduct.moduleProperties(); const auto flags = KeiluvUtils::cppModuleCompilerFlags(qbsProps); // Browse information. // ??? // Debug information. debugInfo = gen::utils::debugInformation(qbsProduct); // Output parameters. executableName = gen::utils::targetBinary(qbsProduct); // Fix output binary name if it is a library. Because // the IDE appends an additional suffix (.LIB) to end // of an output library name. if (executableName.endsWith(QLatin1String(".lib"))) executableName = qbsProduct.targetName(); const QString baseDirectory = gen::utils::buildRootPath(qbsProject); objectDirectory = QDir::toNativeSeparators( gen::utils::objectsOutputDirectory( baseDirectory, qbsProduct)); listingDirectory = QDir::toNativeSeparators( gen::utils::listingOutputDirectory( baseDirectory, qbsProduct)); // Target type. targetType = KeiluvUtils::outputBinaryType(qbsProduct); // Detect the device name from the command line options // (like --cpu and --fpu). const auto cpu = gen::utils::firstFlagValue( flags, QStringLiteral("--cpu")).toLatin1(); const auto fpus = gen::utils::allFlagValues( flags, QStringLiteral("--fpu")); for (const auto &deviceEntry : deviceDict) { // Since Qt 5.12 we can use QByteArray::compare(..., Qt::CaseInsensitive) // instead. if (cpu.toLower() != deviceEntry.cpu.toLower()) continue; size_t fpuMatches = 0; const auto dictFpuBegin = std::cbegin(deviceDict->fpus); const auto dictFpuEnd = std::cend(deviceDict->fpus); for (const auto &fpu : fpus) { const auto dictFpuIt = std::find_if( dictFpuBegin, dictFpuEnd, [fpu](const QByteArray &dictFpu) { return fpu.compare(QString::fromLatin1(dictFpu), Qt::CaseInsensitive) == 0; }); if (dictFpuIt != dictFpuEnd) ++fpuMatches; } if (fpuMatches < deviceEntry.fpus.size()) continue; deviceName = QString::fromLatin1(deviceEntry.device); cpuType = QString::fromLatin1(deviceEntry.cpu); break; } } int debugInfo = false; int browseInfo = false; QString deviceName; QString cpuType; QString executableName; QString objectDirectory; QString listingDirectory; KeiluvUtils::OutputBinaryType targetType = KeiluvUtils::ApplicationOutputType; }; } // namespace ArmTargetCommonOptionsGroup::ArmTargetCommonOptionsGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("TargetCommonOption") { const CommonPageOptions opts(qbsProject, qbsProduct); // Fill device items. appendProperty(QByteArrayLiteral("Device"), opts.deviceName); appendProperty(QByteArrayLiteral("Vendor"), QByteArrayLiteral("ARM")); appendProperty(QByteArrayLiteral("PackID"), QByteArrayLiteral("ARM.CMSIS.5.6.0")); appendProperty(QByteArrayLiteral("PackURL"), QByteArrayLiteral("http://www.keil.com/pack/")); const auto cpuType = QStringLiteral("CPUTYPE(\"%1\")") .arg(opts.cpuType); appendProperty(QByteArrayLiteral("Cpu"), cpuType); // Add 'Debug Information' item. appendProperty(QByteArrayLiteral("DebugInformation"), opts.debugInfo); // Add 'Browse Information' item. appendProperty(QByteArrayLiteral("BrowseInformation"), opts.browseInfo); // Add 'Name of Executable'. appendProperty(QByteArrayLiteral("OutputName"), opts.executableName); // Add 'Output objects directory'. appendProperty(QByteArrayLiteral("OutputDirectory"), opts.objectDirectory); // Add 'Output listing directory'. appendProperty(QByteArrayLiteral("ListingPath"), opts.listingDirectory); // Add 'Create Executable/Library' item. const int isExecutable = (opts.targetType == KeiluvUtils::ApplicationOutputType); const int isLibrary = (opts.targetType == KeiluvUtils::LibraryOutputType); appendProperty(QByteArrayLiteral("CreateExecutable"), isExecutable); appendProperty(QByteArrayLiteral("CreateLib"), isLibrary); } } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.cpp0000644000175100017510000000510415154533055027153 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armtargetmiscgroup_v5.h" #include "../../keiluvutils.h" namespace qbs { namespace keiluv { namespace arm { namespace v5 { namespace { struct MiscPageOptions final { explicit MiscPageOptions(const Project &qbsProject, const ProductData &qbsProduct) { Q_UNUSED(qbsProject) const auto &qbsProps = qbsProduct.moduleProperties(); const auto flags = qbs::KeiluvUtils::cppModuleCompilerFlags(qbsProps); generateLinkerMap = gen::utils::cppBooleanModuleProperty( qbsProps, QStringLiteral("generateLinkerMapFile")); } int generateLinkerMap = 0; }; } // namespace ArmTargetMiscGroup::ArmTargetMiscGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("ArmAdsMisc") { const MiscPageOptions opts(qbsProject, qbsProduct); // Add 'Generate linker map file' item. appendProperty(QByteArrayLiteral("AdsLLst"), opts.generateLinkerMap); } } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armtargetassemblergroup_v5.cpp0000644000175100017510000001367515154533055030211 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armtargetassemblergroup_v5.h" #include "../../keiluvutils.h" namespace qbs { namespace keiluv { namespace arm { namespace v5 { namespace { struct AssemblerPageOptions final { explicit AssemblerPageOptions(const Project &qbsProject, const ProductData &qbsProduct) { Q_UNUSED(qbsProject) const auto &qbsProps = qbsProduct.moduleProperties(); const auto flags = qbs::KeiluvUtils::cppModuleAssemblerFlags(qbsProps); // Read-only position independent. enableRopi = flags.contains(QLatin1String("/ropi")); // Read-write position independent. enableRwpi = flags.contains(QLatin1String("/rwpi")); // Enable thumb mode. enableThumbMode = flags.contains(QLatin1String("--16")); // Split load and store multiple. splitLdm = flags.contains(QLatin1String("--split_ldm")); // Generation code. generateExecuteOnlyCode = flags.contains(QLatin1String("--execute_only")); // Warning levels. const QString wLevel = gen::utils::cppStringModuleProperty( qbsProps, QStringLiteral("warningLevel")); disableWarnings = wLevel == QLatin1String("none"); // Define symbols. defineSymbols = qbs::KeiluvUtils::defines(qbsProps); // Include paths. includePaths = qbs::KeiluvUtils::includes(qbsProps); // Interpret other compiler flags as a misc controls (exclude only // that flags which are was already handled). for (auto flagIt = flags.cbegin(); flagIt < flags.cend(); ++flagIt) { if (flagIt->contains(QLatin1String("/ropi")) || flagIt->contains(QLatin1String("/rwpi")) || flagIt->contains(QLatin1String("--16")) || flagIt->contains(QLatin1String("--split_ldm")) || flagIt->contains(QLatin1String("--execute_only")) || flagIt->contains(QLatin1String("--nowarn")) ) { continue; } if (flagIt->startsWith(QLatin1String("-I")) || flagIt->startsWith(QLatin1String("--cpu")) || flagIt->startsWith(QLatin1String("--fpu")) || flagIt->startsWith(QLatin1String("-pd")) ) { ++flagIt; continue; } miscControls.push_back(*flagIt); } } int enableRopi = 0; int enableRwpi = 0; int enableThumbMode = 0; int disableWarnings = 0; int splitLdm = 0; int generateExecuteOnlyCode = 0; QStringList defineSymbols; QStringList includePaths; QStringList miscControls; }; } // namespace ArmTargetAssemblerGroup::ArmTargetAssemblerGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("Aads") { const AssemblerPageOptions opts(qbsProject, qbsProduct); // Add 'ROPI' item. appendProperty(QByteArrayLiteral("Ropi"), opts.enableRopi); // Add 'RWPI' item. appendProperty(QByteArrayLiteral("Rwpi"), opts.enableRwpi); // Add 'Use thumb mode' item. appendProperty(QByteArrayLiteral("thumb"), opts.enableThumbMode); // Add 'Slpit LDM' item. appendProperty(QByteArrayLiteral("SplitLS"), opts.splitLdm); // Add 'Disable warnings' item. appendProperty(QByteArrayLiteral("NoWarn"), opts.disableWarnings); // Add 'Generate code exedutable only' item. appendProperty(QByteArrayLiteral("useXo"), opts.generateExecuteOnlyCode); // Add other various controls. // Note: A sub-items order makes sense! const auto variousControlsGroup = appendChild( QByteArrayLiteral("VariousControls")); // Add 'Misc Controls' item. variousControlsGroup->appendMultiLineProperty( QByteArrayLiteral("MiscControls"), opts.miscControls, QLatin1Char(' ')); // Add 'Define' item. variousControlsGroup->appendMultiLineProperty( QByteArrayLiteral("Define"), opts.defineSymbols); // Add an empty 'Undefine' item. variousControlsGroup->appendProperty( QByteArrayLiteral("Undefine"), {}); // Add 'Include Paths' item. variousControlsGroup->appendMultiLineProperty( QByteArrayLiteral("IncludePath"), opts.includePaths, QLatin1Char(';')); } } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armtargetgroup_v5.cpp0000644000175100017510000000435315154533055026304 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armtargetassemblergroup_v5.h" #include "armtargetcompilergroup_v5.h" #include "armtargetgroup_v5.h" #include "armtargetlinkergroup_v5.h" #include "armtargetmiscgroup_v5.h" namespace qbs { namespace keiluv { namespace arm { namespace v5 { ArmTargetGroup::ArmTargetGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("TargetArmAds") { appendChild(qbsProject, qbsProduct); appendChild(qbsProject, qbsProduct); appendChild(qbsProject, qbsProduct); appendChild(qbsProject, qbsProduct); } } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.h0000644000175100017510000000400615154533055026620 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVARMTARGETMISCGROUP_V5_H #define QBS_KEILUVARMTARGETMISCGROUP_V5_H #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { class ArmTargetMiscGroup final : public gen::xml::PropertyGroup { public: explicit ArmTargetMiscGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVARMTARGETMISCGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armtargetlinkergroup_v5.cpp0000644000175100017510000001422615154533055027511 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "armtargetlinkergroup_v5.h" #include "../../keiluvutils.h" #include #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { namespace { struct LinkerPageOptions final { explicit LinkerPageOptions(const Project &qbsProject, const ProductData &qbsProduct) { Q_UNUSED(qbsProject) const auto &qbsProps = qbsProduct.moduleProperties(); const auto flags = qbs::KeiluvUtils::cppModuleLinkerFlags(qbsProps); // Read-only position independent. enableRopi = flags.contains(QLatin1String("--ropi")); // Read-write position independent. enableRwpi = flags.contains(QLatin1String("--rwpi")); // Don't search standard libraries. dontSearchLibs = flags.contains(QLatin1String("--noscanlib")); // Report 'might fail' conditions as errors. enableReportMightFail = flags.contains(QLatin1String("--strict")); QStringList scatterFiles; // Enumerate all product linker config files // (which are set trough 'linkerscript' tag). for (const auto &qbsGroup : qbsProduct.groups()) { if (!qbsGroup.isEnabled()) continue; const auto qbsArtifacts = qbsGroup.sourceArtifacts(); for (const auto &qbsArtifact : qbsArtifacts) { const auto qbsTags = qbsArtifact.fileTags(); if (!qbsTags.contains(QLatin1String("linkerscript"))) continue; const QString scatterFile = QFileInfo(qbsArtifact.filePath()) .absoluteFilePath(); scatterFiles.push_back(scatterFile); } } // Enumerate all scatter files // (which are set trough '--scatter' option). const QStringList scatters = gen::utils::allFlagValues( flags, QStringLiteral("--scatter")); for (const auto &scatter : scatters) { const QString scatterFile = QFileInfo(scatter) .absoluteFilePath(); if (!scatterFiles.contains(scatterFile)) scatterFiles.push_back(scatterFile); } // Transform all paths to relative. const QString baseDirectory = qbs::gen::utils::buildRootPath(qbsProject); Internal::transform(scatterFiles, [&baseDirectory](const auto &file) { return gen::utils::relativeFilePath(baseDirectory, file); }); // Make a first scatter file as a main scatter file. // Other scatter files will be interpretes as a misc controls. if (scatterFiles.count() > 0) mainScatterFile = scatterFiles.takeFirst(); for (const auto &scatterFile : std::as_const(scatterFiles)) { const auto control = QStringLiteral("--scatter %1").arg(scatterFile); miscControls.push_back(control); } // Interpret other compiler flags as a misc controls (exclude only // that flags which are was already handled). for (auto flagIt = flags.cbegin(); flagIt < flags.cend(); ++flagIt) { if (flagIt->contains(QLatin1String("--ropi")) || flagIt->contains(QLatin1String("--rwpi")) || flagIt->contains(QLatin1String("--noscanlib")) || flagIt->contains(QLatin1String("--strict")) ) { continue; } if (flagIt->startsWith(QLatin1String("--scatter")) ) { ++flagIt; continue; } miscControls.push_back(*flagIt); } } int enableRopi = 0; int enableRwpi = 0; int dontSearchLibs = 0; int enableReportMightFail = 0; QString mainScatterFile; QStringList miscControls; }; } // namespace ArmTargetLinkerGroup::ArmTargetLinkerGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct) : gen::xml::PropertyGroup("LDads") { const LinkerPageOptions opts(qbsProject, qbsProduct); // Add 'ROPI' item. appendProperty(QByteArrayLiteral("Ropi"), opts.enableRopi); // Add 'RWPI' item. appendProperty(QByteArrayLiteral("Rwpi"), opts.enableRwpi); // Add 'Don't search standard libraries' item. appendProperty(QByteArrayLiteral("noStLib"), opts.dontSearchLibs); // Add 'Report might fail' item. appendProperty(QByteArrayLiteral("RepFail"), opts.enableReportMightFail); // Add 'Scatter file' item. appendProperty(QByteArrayLiteral("ScatterFile"), QDir::toNativeSeparators(opts.mainScatterFile)); } } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armtargetlinkergroup_v5.h0000644000175100017510000000402015154533055027145 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVARMTARGETLINKERGROUP_V5_H #define QBS_KEILUVARMTARGETLINKERGROUP_V5_H #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { class ArmTargetLinkerGroup final : public gen::xml::PropertyGroup { public: explicit ArmTargetLinkerGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVARMTARGETLINKERGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armtargetgroup_v5.h0000644000175100017510000000376215154533055025754 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVARMTARGETGROUP_V5_H #define QBS_KEILUVARMTARGETGROUP_V5_H #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { class ArmTargetGroup final : public gen::xml::PropertyGroup { public: explicit ArmTargetGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct); }; } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVARMTARGETGROUP_V5_H qbs-src-3.2.0/src/plugins/generator/keiluv/archs/arm/armbuildtargetgroup_v5.h0000644000175100017510000000505215154533055026766 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2019 Denis Shienkov ** Contact: http://www.qt.io/licensing ** ** This file is part of Qbs. ** ** 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 http://www.qt.io/terms-conditions. For further information ** use the contact form at http://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 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef QBS_KEILUVARMBUILDTARGETGROUP_V5_H #define QBS_KEILUVARMBUILDTARGETGROUP_V5_H #include namespace qbs { namespace keiluv { namespace arm { namespace v5 { class ArmBuildTargetGroup final : public gen::xml::PropertyGroup { private: explicit ArmBuildTargetGroup( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps); friend class ArmBuildTargetGroupFactory; }; class ArmBuildTargetGroupFactory final : public gen::xml::PropertyGroupFactory { public: bool canCreate(gen::utils::Architecture arch, const Version &version) const final; std::unique_ptr create( const qbs::Project &qbsProject, const qbs::ProductData &qbsProduct, const std::vector &qbsProductDeps) const final; }; } // namespace v5 } // namespace arm } // namespace keiluv } // namespace qbs #endif // QBS_KEILUVARMBUILDTARGETGROUP_V5_H qbs-src-3.2.0/src/shared/0000755000175100017510000000000015154533055014537 5ustar runnerrunnerqbs-src-3.2.0/src/shared/lsp/0000755000175100017510000000000015154533055015335 5ustar runnerrunnerqbs-src-3.2.0/src/shared/lsp/jsonrpcmessages.h0000644000175100017510000003145215154533055020721 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "basemessage.h" #include "jsonkeys.h" #include "lsptypes.h" #include #include #include #include #include #include #include #include #include namespace lsp { class JsonRpcMessage; class LANGUAGESERVERPROTOCOL_EXPORT MessageId : public std::variant { public: MessageId() : variant(QString()) {} explicit MessageId(int id) : variant(id) {} explicit MessageId(const QString &id) : variant(id) {} explicit MessageId(const QJsonValue &value) { if (value.isDouble()) emplace(value.toInt()); else emplace(value.toString()); } operator QJsonValue() const { if (auto id = std::get_if(this)) return *id; if (auto id = std::get_if(this)) return *id; return QJsonValue(); } bool isValid() const { if (std::holds_alternative(*this)) return true; const QString *id = std::get_if(this); QBS_ASSERT(id, return false); return !id->isEmpty(); } QString toString() const { if (auto id = std::get_if(this)) return *id; if (auto id = std::get_if(this)) return QString::number(*id); return {}; } private: friend size_t qHash(const MessageId &id) { if (std::holds_alternative(id)) return QT_PREPEND_NAMESPACE(qHash(std::get(id))); if (std::holds_alternative(id)) return QT_PREPEND_NAMESPACE(qHash(std::get(id))); return QT_PREPEND_NAMESPACE(qHash(0)); } friend QDebug operator<<(QDebug stream, const MessageId &id) { if (std::holds_alternative(id)) stream << std::get(id); else stream << std::get(id); return stream; } }; struct ResponseHandler { MessageId id; using Callback = std::function; Callback callback; }; class LANGUAGESERVERPROTOCOL_EXPORT JsonRpcMessage { public: JsonRpcMessage(); explicit JsonRpcMessage(const BaseMessage &message); explicit JsonRpcMessage(const QJsonObject &jsonObject); explicit JsonRpcMessage(QJsonObject &&jsonObject); virtual ~JsonRpcMessage() = default; static QByteArray jsonRpcMimeType(); QByteArray toRawData() const; virtual bool isValid(QString *errorMessage) const; const QJsonObject &toJsonObject() const; const QString parseError() { return m_parseError; } virtual std::optional responseHandler() const { return std::nullopt; } BaseMessage toBaseMessage() const { return BaseMessage(jsonRpcMimeType(), toRawData()); } protected: QJsonObject m_jsonObject; private: QString m_parseError; }; template class Notification : public JsonRpcMessage { public: Notification(const QString &methodName, const Params ¶ms) { setMethod(methodName); setParams(params); } explicit Notification(const QJsonObject &jsonObject) : JsonRpcMessage(jsonObject) {} explicit Notification(QJsonObject &&jsonObject) : JsonRpcMessage(std::move(jsonObject)) {} QString method() const { return fromJsonValue(m_jsonObject.value(methodKey)); } void setMethod(const QString &method) { m_jsonObject.insert(methodKey, method); } using Parameters = Params; std::optional params() const { const QJsonValue ¶ms = m_jsonObject.value(paramsKey); return params.isUndefined() ? std::nullopt : std::make_optional(Params(params)); } void setParams(const Params ¶ms) { m_jsonObject.insert(paramsKey, QJsonValue(params)); } void clearParams() { m_jsonObject.remove(paramsKey); } bool isValid(QString *errorMessage) const override { return JsonRpcMessage::isValid(errorMessage) && m_jsonObject.value(methodKey).isString() && parametersAreValid(errorMessage); } virtual bool parametersAreValid(QString *errorMessage) const { if (auto parameter = params()) return parameter->isValid(); if (errorMessage) *errorMessage = QCoreApplication::translate("QtC::LanguageServerProtocol", "No parameters in \"%1\".").arg(method()); return false; } }; template <> class Notification : public JsonRpcMessage { public: Notification() : Notification(QString()) {} explicit Notification(const QString &methodName, const std::nullptr_t &/*params*/ = nullptr) { setMethod(methodName); setParams(nullptr); } using JsonRpcMessage::JsonRpcMessage; QString method() const { return fromJsonValue(m_jsonObject.value(methodKey)); } void setMethod(const QString &method) { m_jsonObject.insert(methodKey, method); } std::optional params() const { return nullptr; } void setParams(const std::nullptr_t &/*params*/) { m_jsonObject.insert(paramsKey, QJsonValue::Null); } void clearParams() { m_jsonObject.remove(paramsKey); } bool isValid(QString *errorMessage) const override { return JsonRpcMessage::isValid(errorMessage) && m_jsonObject.value(methodKey).isString() && parametersAreValid(errorMessage); } virtual bool parametersAreValid(QString * /*errorMessage*/) const { return true; } }; template class ResponseError : public JsonObject { public: using JsonObject::JsonObject; int code() const { return typedValue(codeKey); } void setCode(int code) { insert(codeKey, code); } QString message() const { return typedValue(messageKey); } void setMessage(const QString &message) { insert(messageKey, message); } std::optional data() const { return optionalValue(dataKey); } void setData(const Error &data) { insert(dataKey, data); } void clearData() { remove(dataKey); } bool isValid() const override { return contains(codeKey) && contains(messageKey); } QString toString() const { return errorCodesToString(code()) + ": " + message(); } // predefined error codes enum ErrorCodes { // Defined by JSON RPC ParseError = -32700, InvalidRequest = -32600, MethodNotFound = -32601, InvalidParams = -32602, InternalError = -32603, serverErrorStart = -32099, serverErrorEnd = -32000, ServerNotInitialized = -32002, UnknownErrorCode = -32001, // Defined by the protocol. RequestCancelled = -32800 }; #define CASE_ERRORCODES(x) case ErrorCodes::x: return QLatin1String(#x) static QString errorCodesToString(int code) { switch (code) { CASE_ERRORCODES(ParseError); CASE_ERRORCODES(InvalidRequest); CASE_ERRORCODES(MethodNotFound); CASE_ERRORCODES(InvalidParams); CASE_ERRORCODES(InternalError); CASE_ERRORCODES(serverErrorStart); CASE_ERRORCODES(serverErrorEnd); CASE_ERRORCODES(ServerNotInitialized); CASE_ERRORCODES(RequestCancelled); default: return QCoreApplication::translate("QtC::LanguageClient", "Error %1").arg(code); } } #undef CASE_ERRORCODES }; template class Response : public JsonRpcMessage { public: explicit Response(const MessageId &id) { setId(id); } using JsonRpcMessage::JsonRpcMessage; MessageId id() const { return MessageId(m_jsonObject.value(idKey)); } void setId(MessageId id) { this->m_jsonObject.insert(idKey, id); } std::optional result() const { const QJsonValue &result = m_jsonObject.value(resultKey); if (result.isUndefined()) return std::nullopt; return std::make_optional(Result(result)); } void setResult(const Result &result) { m_jsonObject.insert(resultKey, QJsonValue(result)); } void clearResult() { m_jsonObject.remove(resultKey); } using Error = ResponseError; std::optional error() const { const QJsonValue &val = m_jsonObject.value(errorKey); return val.isUndefined() ? std::nullopt : std::make_optional(fromJsonValue(val)); } void setError(const Error &error) { m_jsonObject.insert(errorKey, QJsonValue(error)); } void clearError() { m_jsonObject.remove(errorKey); } bool isValid(QString *errorMessage) const override { return JsonRpcMessage::isValid(errorMessage) && id().isValid(); } }; template class Response : public JsonRpcMessage { public: explicit Response(const MessageId &id) { setId(id); } using JsonRpcMessage::JsonRpcMessage; MessageId id() const { return MessageId(m_jsonObject.value(idKey)); } void setId(MessageId id) { this->m_jsonObject.insert(idKey, id); } std::optional result() const { return m_jsonObject.value(resultKey).isNull() ? std::make_optional(nullptr) : std::nullopt; } void setResult(const std::nullptr_t &) { m_jsonObject.insert(resultKey, QJsonValue::Null); } void clearResult() { m_jsonObject.remove(resultKey); } using Error = ResponseError; std::optional error() const { const QJsonValue &val = m_jsonObject.value(errorKey); return val.isUndefined() ? std::nullopt : std::make_optional(fromJsonValue(val)); } void setError(const Error &error) { m_jsonObject.insert(errorKey, QJsonValue(error)); } void clearError() { m_jsonObject.remove(errorKey); } bool isValid(QString *errorMessage) const override { return JsonRpcMessage::isValid(errorMessage) && id().isValid(); } }; void LANGUAGESERVERPROTOCOL_EXPORT logElapsedTime(const QString &method, const QElapsedTimer &t); template class Request : public Notification { public: Request(const QString &methodName, const Params ¶ms) : Notification(methodName, params) { setId(MessageId(QUuid::createUuid().toString())); } explicit Request(const QJsonObject &jsonObject) : Notification(jsonObject) { } explicit Request(QJsonObject &&jsonObject) : Notification(std::move(jsonObject)) { } MessageId id() const { return MessageId(JsonRpcMessage::m_jsonObject.value(idKey)); } void setId(const MessageId &id) { JsonRpcMessage::m_jsonObject.insert(idKey, id); } using Response = lsp::Response; using ResponseCallback = std::function; void setResponseCallback(const ResponseCallback &callback) { m_callBack = callback; } std::optional responseHandler() const final { QElapsedTimer timer; timer.start(); auto callback = [callback = m_callBack, method = this->method(), t = std::move(timer)] (const JsonRpcMessage &message) { if (!callback) return; logElapsedTime(method, t); callback(Response(message.toJsonObject())); }; return std::make_optional(ResponseHandler{id(), callback}); } bool isValid(QString *errorMessage) const override { if (!Notification::isValid(errorMessage)) return false; if (id().isValid()) return true; if (errorMessage) *errorMessage = QCoreApplication::translate("QtC::LanguageServerProtocol", "No ID set in \"%1\".").arg(this->method()); return false; } private: ResponseCallback m_callBack; }; class LANGUAGESERVERPROTOCOL_EXPORT CancelParameter : public JsonObject { public: explicit CancelParameter(const MessageId &id) { setId(id); } CancelParameter() = default; using JsonObject::JsonObject; MessageId id() const { return typedValue(idKey); } void setId(const MessageId &id) { insert(idKey, id); } bool isValid() const override { return contains(idKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT CancelRequest : public Notification { public: explicit CancelRequest(const CancelParameter ¶ms); using Notification::Notification; constexpr static const char methodName[] = "$/cancelRequest"; }; } // namespace lsp template inline QDebug operator<<(QDebug stream, const lsp::ResponseError &error) { stream.nospace() << error.toString(); return stream; } Q_DECLARE_METATYPE(lsp::JsonRpcMessage) qbs-src-3.2.0/src/shared/lsp/languageserverprotocol_global.h0000644000175100017510000000065715154533055023632 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include #if defined(LANGUAGESERVERPROTOCOL_LIBRARY) # define LANGUAGESERVERPROTOCOL_EXPORT Q_DECL_EXPORT #elif defined(LANGUAGESERVERPROTOCOL_STATIC_LIBRARY) # define LANGUAGESERVERPROTOCOL_EXPORT #else # define LANGUAGESERVERPROTOCOL_EXPORT Q_DECL_IMPORT #endif qbs-src-3.2.0/src/shared/lsp/diagnostics.cpp0000644000175100017510000000063715154533055020356 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "diagnostics.h" namespace lsp { constexpr const char PublishDiagnosticsNotification::methodName[]; PublishDiagnosticsNotification::PublishDiagnosticsNotification(const PublishDiagnosticsParams ¶ms) : Notification(methodName, params) { } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/jsonrpcmessages.cpp0000644000175100017510000000556315154533055021260 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "jsonrpcmessages.h" #include "initializemessages.h" #include "languageserverprotocoltr.h" #include "lsputils.h" #include #include #include #include namespace lsp { Q_LOGGING_CATEGORY(timingLog, "qtc.languageserverprotocol.timing", QtWarningMsg) constexpr const char CancelRequest::methodName[]; QByteArray JsonRpcMessage::toRawData() const { return QJsonDocument(m_jsonObject).toJson(QJsonDocument::Compact); } bool JsonRpcMessage::isValid(QString *errorMessage) const { if (!m_parseError.isEmpty()) { if (errorMessage) *errorMessage = m_parseError; return false; } return m_jsonObject[jsonRpcVersionKey] == "2.0"; } const QJsonObject &JsonRpcMessage::toJsonObject() const { return m_jsonObject; } JsonRpcMessage::JsonRpcMessage() { // The language server protocol always uses “2.0” as the jsonrpc version m_jsonObject[jsonRpcVersionKey] = "2.0"; } constexpr int utf8mib = 106; static QString docType(const QJsonDocument &doc) { if (doc.isArray()) return QString("array"); if (doc.isEmpty()) return QString("empty"); if (doc.isNull()) return QString("null"); if (doc.isObject()) return QString("object"); return {}; } JsonRpcMessage::JsonRpcMessage(const BaseMessage &message) { if (message.content.isEmpty()) return; QByteArray content; if (message.codec && message.codec->mibEnum() != utf8mib) { QTextCodec *utf8 = QTextCodec::codecForMib(utf8mib); if (utf8) content = utf8->fromUnicode(message.codec->toUnicode(message.content)); } if (content.isEmpty()) content = message.content; QJsonParseError error = {0, QJsonParseError::NoError}; const QJsonDocument doc = QJsonDocument::fromJson(content, &error); if (doc.isObject()) m_jsonObject = doc.object(); else if (doc.isNull()) m_parseError = Tr::tr("Could not parse JSON message: \"%1\".").arg(error.errorString()); else m_parseError = Tr::tr("Expected a JSON object, but got a JSON \"%1\" value.").arg(docType(doc)); } JsonRpcMessage::JsonRpcMessage(const QJsonObject &jsonObject) : m_jsonObject(jsonObject) { } JsonRpcMessage::JsonRpcMessage(QJsonObject &&jsonObject) : m_jsonObject(std::move(jsonObject)) { } QByteArray JsonRpcMessage::jsonRpcMimeType() { return "application/vscode-jsonrpc"; } CancelRequest::CancelRequest(const CancelParameter ¶ms) : Notification(methodName, params) { } void logElapsedTime(const QString &method, const QElapsedTimer &t) { qCDebug(timingLog) << "received server reply to" << method << "after" << t.elapsed() << "ms"; } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/shutdownmessages.cpp0000644000175100017510000000070115154533055021442 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "shutdownmessages.h" namespace lsp { constexpr const char ShutdownRequest::methodName[]; constexpr const char ExitNotification::methodName[]; ShutdownRequest::ShutdownRequest() : Request(methodName, nullptr) { } ExitNotification::ExitNotification() : Notification(methodName) { } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/languageserverprotocoltr.h0000644000175100017510000000045215154533055022651 0ustar runnerrunner// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include namespace lsp { struct Tr { Q_DECLARE_TR_FUNCTIONS(QtC::LanguageServerProtocol) }; } // LanguageServerProtocol qbs-src-3.2.0/src/shared/lsp/jsonobject.h0000644000175100017510000001433615154533055017655 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "algorithm.h" #include "languageserverprotocol_global.h" #include "lsputils.h" #include #include #include #include namespace lsp { class LANGUAGESERVERPROTOCOL_EXPORT JsonObject { public: using iterator = QJsonObject::iterator; using const_iterator = QJsonObject::const_iterator; JsonObject() = default; explicit JsonObject(const QJsonObject &object) : m_jsonObject(object) { } explicit JsonObject(QJsonObject &&object) : m_jsonObject(std::move(object)) { } JsonObject(const JsonObject &object) : m_jsonObject(object.m_jsonObject) { } JsonObject(JsonObject &&object) : m_jsonObject(std::move(object.m_jsonObject)) { } explicit JsonObject(const QJsonValue &value) : m_jsonObject(value.toObject()) { } virtual ~JsonObject() = default; JsonObject &operator=(const JsonObject &other); JsonObject &operator=(JsonObject &&other); bool operator==(const JsonObject &other) const { return m_jsonObject == other.m_jsonObject; } operator const QJsonObject&() const { return m_jsonObject; } virtual bool isValid() const { return true; } iterator end() { return m_jsonObject.end(); } const_iterator end() const { return m_jsonObject.end(); } iterator insert(const std::string_view key, const JsonObject &value); iterator insert(const std::string_view key, const QJsonValue &value); protected: template iterator insertVariant(const std::string_view key, const V &variant); template iterator insertVariant(const std::string_view key, const V &variant); // QJSonObject redirections QJsonValue value(const std::string_view key) const { return m_jsonObject.value(QLatin1String(key.data())); } bool contains(const std::string_view key) const { return m_jsonObject.contains(QLatin1String(key.data())); } iterator find(const std::string_view key) { return m_jsonObject.find(QLatin1String(key.data())); } const_iterator find(const std::string_view key) const { return m_jsonObject.find(QLatin1String(key.data())); } void remove(const std::string_view key) { m_jsonObject.remove(QLatin1String(key.data())); } QStringList keys() const { return m_jsonObject.keys(); } // convenience value access template T typedValue(const std::string_view key) const; template std::optional optionalValue(const std::string_view key) const; template LanguageClientValue clientValue(const std::string_view key) const; template std::optional> optionalClientValue(const std::string_view key) const; template QList array(const std::string_view key) const; template std::optional> optionalArray(const std::string_view key) const; template LanguageClientArray clientArray(const std::string_view key) const; template std::optional> optionalClientArray(const std::string_view key) const; template void insertArray(const std::string_view key, const QList &array); template void insertArray(const std::string_view key, const QList &array); private: QJsonObject m_jsonObject; }; template JsonObject::iterator JsonObject::insertVariant(const std::string_view key, const V &variant) { return std::holds_alternative(variant) ? insert(key, std::get(variant)) : end(); } template JsonObject::iterator JsonObject::insertVariant(const std::string_view key, const V &variant) { auto result = insertVariant(key, variant); return result != end() ? result : insertVariant(key, variant); } template T JsonObject::typedValue(const std::string_view key) const { return fromJsonValue(value(key)); } template std::optional JsonObject::optionalValue(const std::string_view key) const { const QJsonValue &val = value(key); return val.isUndefined() ? std::nullopt : std::make_optional(fromJsonValue(val)); } template LanguageClientValue JsonObject::clientValue(const std::string_view key) const { return LanguageClientValue(value(key)); } template std::optional> JsonObject::optionalClientValue(const std::string_view key) const { return contains(key) ? std::make_optional(clientValue(key)) : std::nullopt; } template QList JsonObject::array(const std::string_view key) const { if (const std::optional> &array = optionalArray(key)) return *array; qCDebug(conversionLog) << QString("Expected array under %1 in:") .arg(QLatin1String(key.data())) << *this; return {}; } template std::optional> JsonObject::optionalArray(const std::string_view key) const { const QJsonValue &jsonValue = value(key); if (jsonValue.isUndefined()) return std::nullopt; return Utils::transform>(jsonValue.toArray(), &fromJsonValue); } template LanguageClientArray JsonObject::clientArray(const std::string_view key) const { return LanguageClientArray(value(key)); } template std::optional> JsonObject::optionalClientArray(const std::string_view key) const { const QJsonValue &val = value(key); return !val.isUndefined() ? std::make_optional(LanguageClientArray(value(key))) : std::nullopt; } template void JsonObject::insertArray(const std::string_view key, const QList &array) { QJsonArray jsonArray; for (const T &item : array) jsonArray.append(QJsonValue(item)); insert(key, jsonArray); } template void JsonObject::insertArray(const std::string_view key, const QList &array) { QJsonArray jsonArray; for (const JsonObject &item : array) jsonArray.append(item.m_jsonObject); insert(key, jsonArray); } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/languagefeatures.h0000644000175100017510000007436315154533055021045 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "jsonrpcmessages.h" namespace lsp { /** * MarkedString can be used to render human readable text. It is either a markdown string * or a code-block that provides a language and a code snippet. The language identifier * is semantically equal to the optional language identifier in fenced code blocks in GitHub * issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting * * The pair of a language and a value is an equivalent to markdown: * ```${language} * ${value} * ``` * * Note that markdown strings will be sanitized - that means html will be escaped. * @deprecated use MarkupContent instead. */ class LANGUAGESERVERPROTOCOL_EXPORT MarkedLanguageString : public JsonObject { public: using JsonObject::JsonObject; QString language() const { return typedValue(languageKey); } void setLanguage(const QString &language) { insert(languageKey, language); } QString value() const { return typedValue(valueKey); } void setValue(const QString &value) { insert(valueKey, value); } bool isValid() const override { return contains(languageKey) && contains(valueKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT MarkedString : public std::variant { public: MarkedString() = default; explicit MarkedString(const MarkedLanguageString &other) : variant(other) {} explicit MarkedString(const QString &other) : variant(other) {} explicit MarkedString(const QJsonValue &value); bool isValid() const; operator QJsonValue() const; }; class LANGUAGESERVERPROTOCOL_EXPORT HoverContent : public std::variant, MarkupContent> { public: HoverContent() = default; explicit HoverContent(const MarkedString &other) : variant(other) {} explicit HoverContent(const QList &other) : variant(other) {} explicit HoverContent(const MarkupContent &other) : variant(other) {} explicit HoverContent(const QJsonValue &value); bool isValid() const; }; class LANGUAGESERVERPROTOCOL_EXPORT Hover : public JsonObject { public: using JsonObject::JsonObject; HoverContent content() const; void setContent(const HoverContent &content); std::optional range() const { return optionalValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } void clearRange() { remove(rangeKey); } bool isValid() const override { return contains(contentsKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT HoverResult : public std::variant { public: HoverResult() : variant(nullptr) {} explicit HoverResult(const Hover &hover) : variant(hover) {} explicit HoverResult(const QJsonValue &value); bool isValid() const; }; class LANGUAGESERVERPROTOCOL_EXPORT HoverRequest : public Request { public: explicit HoverRequest(const TextDocumentPositionParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/hover"; }; /** * Represents a parameter of a callable-signature. A parameter can * have a label and a doc-comment. */ class LANGUAGESERVERPROTOCOL_EXPORT ParameterInformation : public JsonObject { public: using JsonObject::JsonObject; QString label() const { return typedValue(labelKey); } void setLabel(const QString &label) { insert(labelKey, label); } std::optional documentation() const; void setDocumentation(const MarkupOrString &documentation) { insert(documentationKey, documentation.toJson()); } void clearDocumentation() { remove(documentationKey); } bool isValid() const override { return contains(labelKey); } }; /** * Represents the signature of something callable. A signature * can have a label, like a function-name, a doc-comment, and * a set of parameters. */ class LANGUAGESERVERPROTOCOL_EXPORT SignatureInformation : public ParameterInformation { public: using ParameterInformation::ParameterInformation; std::optional> parameters() const { return optionalArray(parametersKey); } void setParameters(const QList ¶meters) { insertArray(parametersKey, parameters); } void clearParameters() { remove(parametersKey); } std::optional activeParameter() const { return optionalValue(activeParameterKey); } void setActiveParameter(int activeParameter) { insert(activeParameterKey, activeParameter); } void clearActiveParameter() { remove(activeParameterKey); } }; /** * Signature help represents the signature of something * callable. There can be multiple signature but only one * active and only one active parameter. */ class LANGUAGESERVERPROTOCOL_EXPORT SignatureHelp : public JsonObject { public: using JsonObject::JsonObject; /// One or more signatures. QList signatures() const { return array(signaturesKey); } void setSignatures(const QList &signatures) { insertArray(signaturesKey, signatures); } /** * The active signature. If omitted or the value lies outside the * range of `signatures` the value defaults to zero or is ignored if * `signatures.length === 0`. Whenever possible implementors should * make an active decision about the active signature and shouldn't * rely on a default value. * In future version of the protocol this property might become * mandatory to better express this. */ std::optional activeSignature() const { return optionalValue(activeSignatureKey); } void setActiveSignature(int activeSignature) { insert(activeSignatureKey, activeSignature); } void clearActiveSignature() { remove(activeSignatureKey); } /** * The active parameter of the active signature. If omitted or the value * lies outside the range of `signatures[activeSignature].parameters` * defaults to 0 if the active signature has parameters. If * the active signature has no parameters it is ignored. * In future version of the protocol this property might become * mandatory to better express the active parameter if the * active signature does have any. */ std::optional activeParameter() const { return optionalValue(activeParameterKey); } void setActiveParameter(int activeParameter) { insert(activeParameterKey, activeParameter); } void clearActiveParameter() { remove(activeParameterKey); } bool isValid() const override { return contains(signaturesKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT SignatureHelpRequest : public Request, std::nullptr_t, TextDocumentPositionParams> { public: explicit SignatureHelpRequest(const TextDocumentPositionParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/signatureHelp"; }; /// The result of a goto request can either be a location, a list of locations or null class LANGUAGESERVERPROTOCOL_EXPORT GotoResult : public std::variant, std::nullptr_t> { public: explicit GotoResult(const QJsonValue &value); using variant::variant; }; class LANGUAGESERVERPROTOCOL_EXPORT GotoDefinitionRequest : public Request { public: explicit GotoDefinitionRequest(const TextDocumentPositionParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/definition"; }; class LANGUAGESERVERPROTOCOL_EXPORT GotoTypeDefinitionRequest : public Request< GotoResult, std::nullptr_t, TextDocumentPositionParams> { public: explicit GotoTypeDefinitionRequest(const TextDocumentPositionParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/typeDefinition"; }; class LANGUAGESERVERPROTOCOL_EXPORT GotoImplementationRequest : public Request< GotoResult, std::nullptr_t, TextDocumentPositionParams> { public: explicit GotoImplementationRequest(const TextDocumentPositionParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/implementation"; }; class LANGUAGESERVERPROTOCOL_EXPORT ReferenceParams : public TextDocumentPositionParams { public: using TextDocumentPositionParams::TextDocumentPositionParams; class ReferenceContext : public JsonObject { public: explicit ReferenceContext(bool includeDeclaration) { setIncludeDeclaration(includeDeclaration); } ReferenceContext() = default; using JsonObject::JsonObject; bool includeDeclaration() const { return typedValue(includeDeclarationKey); } void setIncludeDeclaration(bool includeDeclaration) { insert(includeDeclarationKey, includeDeclaration); } bool isValid() const override { return contains(includeDeclarationKey); } }; ReferenceContext context() const { return typedValue(contextKey); } void setContext(const ReferenceContext &context) { insert(contextKey, context); } bool isValid() const override { return TextDocumentPositionParams::isValid() && contains(contextKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT FindReferencesRequest : public Request< LanguageClientArray, std::nullptr_t, ReferenceParams> { public: explicit FindReferencesRequest(const ReferenceParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/references"; }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentHighlight : public JsonObject { public: using JsonObject::JsonObject; enum DocumentHighlightKind { Text = 1, Read = 2, Write = 3 }; Range range() const { return typedValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } std::optional kind() const { return optionalValue(kindKey); } void setKind(int kind) { insert(kindKey, kind); } void clearKind() { remove(kindKey); } bool isValid() const override { return contains(rangeKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentHighlightsResult : public std::variant, std::nullptr_t> { public: using variant::variant; DocumentHighlightsResult() : variant(nullptr) {} explicit DocumentHighlightsResult(const QJsonValue &value); using variant::operator=; }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentHighlightsRequest : public Request< DocumentHighlightsResult, std::nullptr_t, TextDocumentPositionParams> { public: explicit DocumentHighlightsRequest(const TextDocumentPositionParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/documentHighlight"; }; class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentParams : public JsonObject { public: TextDocumentParams(); explicit TextDocumentParams(const TextDocumentIdentifier &identifier); using JsonObject::JsonObject; TextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const TextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } bool isValid() const override { return contains(textDocumentKey); } }; using DocumentSymbolParams = TextDocumentParams; class LANGUAGESERVERPROTOCOL_EXPORT DocumentSymbolsResult : public std::variant, QList, std::nullptr_t> { public: using variant::variant; DocumentSymbolsResult() : variant(nullptr) {} explicit DocumentSymbolsResult(const QJsonValue &value); DocumentSymbolsResult(const DocumentSymbolsResult &other) : variant(other) {} DocumentSymbolsResult(DocumentSymbolsResult &&other) : variant(std::move(other)) {} using variant::operator=; DocumentSymbolsResult &operator =(DocumentSymbolsResult &&other) { variant::operator=(std::move(other)); return *this; } DocumentSymbolsResult &operator =(const DocumentSymbolsResult &other) { variant::operator=(other); return *this; } // Needed to make it usable in Qt 6 signals. bool operator<(const DocumentSymbolsResult &other) const = delete; }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentSymbolsRequest : public Request { public: explicit DocumentSymbolsRequest(const DocumentSymbolParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/documentSymbol"; }; /** * The kind of a code action. * * Kinds are a hierarchical list of identifiers separated by `.`, e.g. `"refactor.extract.function"`. * * The set of kinds is open and client needs to announce the kinds it supports to the server during * initialization. */ using CodeActionKind = QString; /** * A set of predefined code action kinds */ namespace CodeActionKinds { constexpr char QuickFix[] = "quickfix"; constexpr char Refactor[] = "refactor"; constexpr char RefactorExtract[] = "refactor.extract"; constexpr char RefactorInline[] = "refactor.inline"; constexpr char RefactorRewrite[] = "refactor.rewrite"; constexpr char Source[] = "source"; constexpr char SourceOrganizeImports[] = "source.organizeImports"; } class LANGUAGESERVERPROTOCOL_EXPORT CodeActionParams : public JsonObject { public: using JsonObject::JsonObject; class LANGUAGESERVERPROTOCOL_EXPORT CodeActionContext : public JsonObject { public: using JsonObject::JsonObject; QList diagnostics() const { return array(diagnosticsKey); } void setDiagnostics(const QList &diagnostics) { insertArray(diagnosticsKey, diagnostics); } std::optional> only() const; void setOnly(const QList &only); void clearOnly() { remove(onlyKey); } bool isValid() const override { return contains(diagnosticsKey); } }; TextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const TextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } Range range() const { return typedValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } CodeActionContext context() const { return typedValue(contextKey); } void setContext(const CodeActionContext &context) { insert(contextKey, context); } bool isValid() const override { return contains(textDocumentKey) && contains(rangeKey) && contains(contextKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT CodeAction : public JsonObject { public: using JsonObject::JsonObject; QString title() const { return typedValue(titleKey); } void setTitle(QString title) { insert(titleKey, title); } std::optional kind() const { return optionalValue(kindKey); } void setKind(const CodeActionKind &kind) { insert(kindKey, kind); } void clearKind() { remove(kindKey); } std::optional> diagnostics() const { return optionalArray(diagnosticsKey); } void setDiagnostics(const QList &diagnostics) { insertArray(diagnosticsKey, diagnostics); } void clearDiagnostics() { remove(diagnosticsKey); } std::optional edit() const { return optionalValue(editKey); } void setEdit(const WorkspaceEdit &edit) { insert(editKey, edit); } void clearEdit() { remove(editKey); } std::optional command() const { return optionalValue(commandKey); } void setCommand(const Command &command) { insert(commandKey, command); } void clearCommand() { remove(commandKey); } bool isValid() const override { return contains(titleKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT CodeActionResult : public std::variant>, std::nullptr_t> { public: using variant::variant; explicit CodeActionResult(const QJsonValue &val); }; class LANGUAGESERVERPROTOCOL_EXPORT CodeActionRequest : public Request< CodeActionResult, std::nullptr_t, CodeActionParams> { public: explicit CodeActionRequest(const CodeActionParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/codeAction"; }; using CodeLensParams = TextDocumentParams; class LANGUAGESERVERPROTOCOL_EXPORT CodeLens : public JsonObject { public: using JsonObject::JsonObject; Range range() const { return typedValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } std::optional command() const { return optionalValue(commandKey); } void setCommand(const Command &command) { insert(commandKey, command); } void clearCommand() { remove(commandKey); } std::optional data() const; void setData(const QJsonValue &data) { insert(dataKey, data); } void clearData() { remove(dataKey); } bool isValid() const override { return contains(rangeKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT CodeLensRequest : public Request< LanguageClientArray, std::nullptr_t, CodeLensParams> { public: explicit CodeLensRequest(const CodeLensParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/codeLens"; }; class LANGUAGESERVERPROTOCOL_EXPORT CodeLensResolveRequest : public Request< CodeLens, std::nullptr_t, CodeLens> { public: explicit CodeLensResolveRequest(const CodeLens ¶ms); using Request::Request; constexpr static const char methodName[] = "codeLens/resolve"; }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentLink : public JsonObject { public: using JsonObject::JsonObject; Range range() const { return typedValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } std::optional target() const; void setTarget(const DocumentUri &target) { insert(targetKey, target.toString()); } void clearTarget() { remove(targetKey); } std::optional data() const; void setData(const QJsonValue &data) { insert(dataKey, data); } void clearData() { remove(dataKey); } bool isValid() const override { return contains(rangeKey); } }; using DocumentLinkParams = TextDocumentParams; class LANGUAGESERVERPROTOCOL_EXPORT DocumentLinkRequest : public Request< LanguageClientValue, std::nullptr_t, DocumentLinkParams> { public: explicit DocumentLinkRequest(const DocumentLinkParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/documentLink"; }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentLinkResolveRequest : public Request< DocumentLink, std::nullptr_t, DocumentLink> { public: explicit DocumentLinkResolveRequest(const DocumentLink ¶ms); using Request::Request; constexpr static const char methodName[] = "documentLink/resolve"; }; using DocumentColorParams = TextDocumentParams; class LANGUAGESERVERPROTOCOL_EXPORT Color : public JsonObject { public: using JsonObject::JsonObject; double red() const { return typedValue(redKey); } void setRed(double red) { insert(redKey, red); } double green() const { return typedValue(greenKey); } void setGreen(double green) { insert(greenKey, green); } double blue() const { return typedValue(blueKey); } void setBlue(double blue) { insert(blueKey, blue); } double alpha() const { return typedValue(alphaKey); } void setAlpha(double alpha) { insert(alphaKey, alpha); } bool isValid() const override { return contains(redKey) && contains(greenKey) && contains(blueKey) && contains(alphaKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ColorInformation : public JsonObject { public: using JsonObject::JsonObject; Range range() const { return typedValue(rangeKey); } void setRange(Range range) { insert(rangeKey, range); } Color color() const { return typedValue(colorKey); } void setColor(const Color &color) { insert(colorKey, color); } bool isValid() const override { return contains(rangeKey) && contains(colorKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentColorRequest : public Request< QList, std::nullptr_t, DocumentColorParams> { public: explicit DocumentColorRequest(const DocumentColorParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/documentColor"; }; class LANGUAGESERVERPROTOCOL_EXPORT ColorPresentationParams : public JsonObject { public: using JsonObject::JsonObject; TextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const TextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } Color colorInfo() const { return typedValue(colorInfoKey); } void setColorInfo(const Color &colorInfo) { insert(colorInfoKey, colorInfo); } Range range() const { return typedValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } bool isValid() const override { return contains(textDocumentKey) && contains(colorInfoKey) && contains(rangeKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ColorPresentation : public JsonObject { public: using JsonObject::JsonObject; QString label() const { return typedValue(labelKey); } void setLabel(const QString &label) { insert(labelKey, label); } std::optional textEdit() const { return optionalValue(textEditKey); } void setTextEdit(const TextEdit &textEdit) { insert(textEditKey, textEdit); } void clearTextEdit() { remove(textEditKey); } std::optional> additionalTextEdits() const { return optionalArray(additionalTextEditsKey); } void setAdditionalTextEdits(const QList &additionalTextEdits) { insertArray(additionalTextEditsKey, additionalTextEdits); } void clearAdditionalTextEdits() { remove(additionalTextEditsKey); } bool isValid() const override { return contains(labelKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ColorPresentationRequest : public Request< QList, std::nullptr_t, ColorPresentationParams> { public: explicit ColorPresentationRequest(const ColorPresentationParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/colorPresentation"; }; class DocumentFormattingProperty : public std::variant { public: DocumentFormattingProperty() = default; explicit DocumentFormattingProperty(const QJsonValue &value); explicit DocumentFormattingProperty(const DocumentFormattingProperty &other) : std::variant(other) {} using variant::variant; using variant::operator=; }; class LANGUAGESERVERPROTOCOL_EXPORT FormattingOptions : public JsonObject { public: using JsonObject::JsonObject; int tabSize() const { return typedValue(tabSizeKey); } void setTabSize(int tabSize) { insert(tabSizeKey, tabSize); } bool insertSpace() const { return typedValue(insertSpaceKey); } void setInsertSpace(bool insertSpace) { insert(insertSpaceKey, insertSpace); } std::optional trimTrailingWhitespace() const { return optionalValue(trimTrailingWhitespaceKey); } void setTrimTrailingWhitespace(bool trimTrailingWhitespace) { insert(trimTrailingWhitespaceKey, trimTrailingWhitespace); } void clearTrimTrailingWhitespace() { remove(trimTrailingWhitespaceKey); } std::optional insertFinalNewline() const { return optionalValue(insertFinalNewlineKey); } void setInsertFinalNewline(bool insertFinalNewline) { insert(insertFinalNewlineKey, insertFinalNewline); } void clearInsertFinalNewline() { remove(insertFinalNewlineKey); } std::optional trimFinalNewlines() const { return optionalValue(trimFinalNewlinesKey); } void setTrimFinalNewlines(bool trimFinalNewlines) { insert(trimFinalNewlinesKey, trimFinalNewlines); } void clearTrimFinalNewlines() { remove(trimFinalNewlinesKey); } QHash properties() const; void setProperty(const std::string_view key, const DocumentFormattingProperty &property); void removeProperty(const std::string_view &key) { remove(key); } bool isValid() const override { return contains(insertSpaceKey) && contains(tabSizeKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentFormattingParams : public JsonObject { public: using JsonObject::JsonObject; TextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const TextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } FormattingOptions options() const { return typedValue(optionsKey); } void setOptions(const FormattingOptions &options) { insert(optionsKey, options); } bool isValid() const override { return contains(textDocumentKey) && contains(optionsKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentFormattingRequest : public Request< LanguageClientArray, std::nullptr_t, DocumentFormattingParams> { public: explicit DocumentFormattingRequest(const DocumentFormattingParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/formatting"; }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentRangeFormattingParams : public JsonObject { public: using JsonObject::JsonObject; TextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const TextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } Range range() const { return typedValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } FormattingOptions options() const { return typedValue(optionsKey); } void setOptions(const FormattingOptions &options) { insert(optionsKey, options); } bool isValid() const override { return contains(textDocumentKey) && contains(rangeKey) && contains(optionsKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentRangeFormattingRequest : public Request< LanguageClientArray, std::nullptr_t, DocumentRangeFormattingParams> { public: explicit DocumentRangeFormattingRequest(const DocumentRangeFormattingParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/rangeFormatting"; }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentOnTypeFormattingParams : public JsonObject { public: using JsonObject::JsonObject; TextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const TextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } Position position() const { return typedValue(positionKey); } void setPosition(const Position &position) { insert(positionKey, position); } QString ch() const { return typedValue(chKey); } void setCh(const QString &ch) { insert(chKey, ch); } FormattingOptions options() const { return typedValue(optionsKey); } void setOptions(const FormattingOptions &options) { insert(optionsKey, options); } bool isValid() const override; }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentOnTypeFormattingRequest : public Request< LanguageClientArray, std::nullptr_t, DocumentOnTypeFormattingParams> { public: explicit DocumentOnTypeFormattingRequest(const DocumentOnTypeFormattingParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/onTypeFormatting"; }; class PlaceHolderResult : public JsonObject { public: using JsonObject::JsonObject; Range range() const { return typedValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } QString placeHolder() const { return typedValue(placeHolderKey); } void setPlaceHolder(const QString &placeHolder) { insert(placeHolderKey, placeHolder); } bool isValid() const override { return contains(rangeKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT PrepareRenameResult : public std::variant { public: PrepareRenameResult(); PrepareRenameResult(const std::variant &val); explicit PrepareRenameResult(const PlaceHolderResult &val); explicit PrepareRenameResult(const Range &val); explicit PrepareRenameResult(const QJsonValue &val); bool isValid() const; }; class LANGUAGESERVERPROTOCOL_EXPORT PrepareRenameRequest : public Request { public: explicit PrepareRenameRequest(const TextDocumentPositionParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/prepareRename"; }; class LANGUAGESERVERPROTOCOL_EXPORT RenameParams : public JsonObject { public: using JsonObject::JsonObject; TextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const TextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } Position position() const { return typedValue(positionKey); } void setPosition(const Position &position) { insert(positionKey, position); } QString newName() const { return typedValue(newNameKey); } void setNewName(const QString &newName) { insert(newNameKey, newName); } bool isValid() const override; }; class LANGUAGESERVERPROTOCOL_EXPORT RenameRequest : public Request< WorkspaceEdit, std::nullptr_t, RenameParams> { public: explicit RenameRequest(const RenameParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/rename"; }; } // namespace LanguageClient qbs-src-3.2.0/src/shared/lsp/workspace.cpp0000644000175100017510000000524415154533055020044 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "workspace.h" namespace lsp { constexpr const char WorkSpaceFolderRequest::methodName[]; constexpr const char DidChangeWorkspaceFoldersNotification::methodName[]; constexpr const char DidChangeConfigurationNotification::methodName[]; constexpr const char ConfigurationRequest::methodName[]; constexpr const char WorkspaceSymbolRequest::methodName[]; constexpr const char ExecuteCommandRequest::methodName[]; constexpr const char ApplyWorkspaceEditRequest::methodName[]; constexpr const char DidChangeWatchedFilesNotification::methodName[]; WorkSpaceFolderRequest::WorkSpaceFolderRequest() : Request(methodName, nullptr) { } DidChangeWorkspaceFoldersNotification::DidChangeWorkspaceFoldersNotification( const DidChangeWorkspaceFoldersParams ¶ms) : Notification(methodName, params) { } DidChangeConfigurationNotification::DidChangeConfigurationNotification( const DidChangeConfigurationParams ¶ms) : Notification(methodName, params) { } ConfigurationRequest::ConfigurationRequest(const ConfigurationParams ¶ms) : Request(methodName, params) { } WorkspaceSymbolRequest::WorkspaceSymbolRequest(const WorkspaceSymbolParams ¶ms) : Request(methodName, params) { } ExecuteCommandRequest::ExecuteCommandRequest(const ExecuteCommandParams ¶ms) : Request(methodName, params) { } ApplyWorkspaceEditRequest::ApplyWorkspaceEditRequest(const ApplyWorkspaceEditParams ¶ms) : Request(methodName, params) { } WorkspaceFoldersChangeEvent::WorkspaceFoldersChangeEvent() { insert(addedKey, QJsonArray()); insert(removedKey, QJsonArray()); } DidChangeWatchedFilesNotification::DidChangeWatchedFilesNotification( const DidChangeWatchedFilesParams ¶ms) : Notification(methodName, params) { } ExecuteCommandParams::ExecuteCommandParams(const Command &command) { setCommand(command.command()); if (command.arguments().has_value()) setArguments(*command.arguments()); } WorkSpaceFolderResult::operator const QJsonValue() const { if (!std::holds_alternative>(*this)) return QJsonValue::Null; QJsonArray array; for (const auto &folder : std::get>(*this)) array.append(QJsonValue(folder)); return array; } std::optional ConfigurationParams::ConfigurationItem::scopeUri() const { if (const std::optional optionalScope = optionalValue(scopeUriKey)) return std::make_optional(DocumentUri::fromProtocol(*optionalScope)); return std::nullopt; } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/filepath.h0000644000175100017510000000511315154533055017302 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2023 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$ ** ****************************************************************************/ #pragma once #include #include #include #include namespace lsp::Utils { class FilePath : public QString { public: FilePath() = default; FilePath(const QString &s) : QString(s) {} QString scheme() const { return {}; } QString host() const { return {}; } Qt::CaseSensitivity caseSensitivity() const { return qbs::Internal::HostOsInfo::fileNameCaseSensitivity(); } QString toString() const { return *this; } QString path() const { return toString(); } static FilePath fromUserInput(const QString &s) { return QDir::fromNativeSeparators(s); } QString toUserOutput() const { return QDir::toNativeSeparators(*this); } }; } // namespace lsp::Utils qbs-src-3.2.0/src/shared/lsp/.clang-tidy0000644000175100017510000000014515154533055017371 0ustar runnerrunnerChecks: '-*,misc-definitions-in-headers' CheckOptions: - { key: HeaderFileExtensions, value: "x" } qbs-src-3.2.0/src/shared/lsp/link.h0000644000175100017510000000375015154533055016450 0ustar runnerrunner// Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "filepath.h" #include #include #include #include namespace lsp::Utils { class Link { public: Link() = default; Link(const FilePath &filePath, int line = 0, int column = 0) : targetFilePath(filePath) , targetLine(line) , targetColumn(column) {} static Link fromString(const QString &filePathWithNumbers, bool canContainLineNumber = false); bool hasValidTarget() const { if (!targetFilePath.isEmpty()) return true; return !targetFilePath.scheme().isEmpty() || !targetFilePath.host().isEmpty(); } bool hasValidLinkText() const { return linkTextStart != linkTextEnd; } bool operator==(const Link &other) const { return hasSameLocation(other) && linkTextStart == other.linkTextStart && linkTextEnd == other.linkTextEnd; } bool operator!=(const Link &other) const { return !(*this == other); } bool hasSameLocation(const Link &other) const { return targetFilePath == other.targetFilePath && targetLine == other.targetLine && targetColumn == other.targetColumn; } friend size_t qHash(const Link &l, uint seed = 0) { return QT_PREPEND_NAMESPACE(qHash)(l.targetFilePath, seed) | QT_PREPEND_NAMESPACE(qHash(l.targetLine, seed)) | QT_PREPEND_NAMESPACE(qHash(l.targetColumn, seed)); } int linkTextStart = -1; int linkTextEnd = -1; FilePath targetFilePath; int targetLine = 0; int targetColumn = 0; }; using LinkHandler = std::function; using Links = QList; } // namespace lsp::Utils namespace std { template<> struct hash { size_t operator()(const lsp::Utils::Link &fn) const { return qHash(fn); } }; } // std qbs-src-3.2.0/src/shared/lsp/shutdownmessages.h0000644000175100017510000000142315154533055021111 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "jsonrpcmessages.h" namespace lsp { class LANGUAGESERVERPROTOCOL_EXPORT ShutdownRequest : public Request< std::nullptr_t, std::nullptr_t, std::nullptr_t> { public: ShutdownRequest(); using Request::Request; constexpr static const char methodName[] = "shutdown"; }; class LANGUAGESERVERPROTOCOL_EXPORT ExitNotification : public Notification { public: ExitNotification(); using Notification::Notification; constexpr static const char methodName[] = "exit"; bool parametersAreValid(QString * /*errorMessage*/) const final { return true; } }; } // namespace LanguageClient qbs-src-3.2.0/src/shared/lsp/messages.h0000644000175100017510000000552515154533055017324 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "jsonrpcmessages.h" namespace lsp { enum MessageType { Error = 1, Warning = 2, Info = 3, Log = 4, }; class LANGUAGESERVERPROTOCOL_EXPORT ShowMessageParams : public JsonObject { public: using JsonObject::JsonObject; int type() const { return typedValue(typeKey); } void setType(int type) { insert(typeKey, type); } QString message() const { return typedValue(messageKey); } void setMessage(QString message) { insert(messageKey, message); } QString toString() const; bool isValid() const override { return contains(typeKey) && contains(messageKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ShowMessageNotification : public Notification { public: explicit ShowMessageNotification(const ShowMessageParams ¶ms); using Notification::Notification; constexpr static const char methodName[] = "window/showMessage"; }; class LANGUAGESERVERPROTOCOL_EXPORT MessageActionItem : public JsonObject { public: using JsonObject::JsonObject; QString title() const { return typedValue(titleKey); } void setTitle(QString title) { insert(titleKey, title); } bool isValid() const override { return contains(titleKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ShowMessageRequestParams : public ShowMessageParams { public: using ShowMessageParams::ShowMessageParams; std::optional> actions() const { return optionalArray(actionsKey); } void setActions(const QList &actions) { insertArray(actionsKey, actions); } void clearActions() { remove(actionsKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ShowMessageRequest : public Request< LanguageClientValue, std::nullptr_t, ShowMessageRequestParams> { public: explicit ShowMessageRequest(const ShowMessageRequestParams ¶ms); using Request::Request; constexpr static const char methodName[] = "window/showMessageRequest"; }; using LogMessageParams = ShowMessageParams; class LANGUAGESERVERPROTOCOL_EXPORT LogMessageNotification : public Notification { public: explicit LogMessageNotification(const LogMessageParams ¶ms); using Notification::Notification; constexpr static const char methodName[] = "window/logMessage"; }; class LANGUAGESERVERPROTOCOL_EXPORT TelemetryNotification : public Notification { public: explicit TelemetryNotification(const JsonObject ¶ms); using Notification::Notification; constexpr static const char methodName[] = "telemetry/event"; bool parametersAreValid(QString * /*error*/) const override { return params().has_value(); } }; } // namespace LanguageClient qbs-src-3.2.0/src/shared/lsp/jsonkeys.h0000644000175100017510000002564615154533055017370 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once namespace lsp { constexpr char actionsKey[] = "actions"; constexpr char activeParameterKey[] = "activeParameter"; constexpr char activeParameterSupportKey[] = "activeParameterSupport"; constexpr char activeSignatureKey[] = "activeSignature"; constexpr char addedKey[] = "added"; constexpr char additionalTextEditsKey[] = "additionalTextEdits"; constexpr char alphaKey[] = "alpha"; constexpr char appliedKey[] = "applied"; constexpr char applyEditKey[] = "applyEdit"; constexpr char argumentsKey[] = "arguments"; constexpr char blueKey[] = "blue"; constexpr char callHierarchyKey[] = "callHierarchy"; constexpr char callHierarchyProviderKey[] = "callHierarchyProvider"; constexpr char cancellableKey[] = "cancellable"; constexpr char capabilitiesKey[] = "capabilities"; constexpr char chKey[] = "ch"; constexpr char changeKey[] = "change"; constexpr char changeNotificationsKey[] = "changeNotifications"; constexpr char changesKey[] = "changes"; constexpr char characterKey[] = "character"; constexpr char childrenKey[] = "children"; constexpr char clientInfoKey[] = "clientInfo"; constexpr char codeActionKey[] = "codeAction"; constexpr char codeActionKindKey[] = "codeActionKind"; constexpr char codeActionKindsKey[] = "codeActionKinds"; constexpr char codeActionLiteralSupportKey[] = "codeActionLiteralSupport"; constexpr char codeActionProviderKey[] = "codeActionProvider"; constexpr char codeKey[] = "code"; constexpr char codeLensKey[] = "codeLens"; constexpr char codeLensProviderKey[] = "codeLensProvider"; constexpr char colorInfoKey[] = "colorInfo"; constexpr char colorKey[] = "color"; constexpr char colorProviderKey[] = "colorProvider"; constexpr char commandKey[] = "command"; constexpr char commandsKey[] = "commands"; constexpr char commitCharacterSupportKey[] = "commitCharacterSupport"; constexpr char commitCharactersKey[] = "commitCharacters"; constexpr char completionItemKey[] = "completionItem"; constexpr char completionItemKindKey[] = "completionItemKind"; constexpr char completionKey[] = "completion"; constexpr char completionProviderKey[] = "completionProvider"; constexpr char configurationKey[] = "configuration"; constexpr char containerNameKey[] = "containerName"; constexpr char contentChangesKey[] = "contentChanges"; constexpr char contentFormatKey[] = "contentFormat"; constexpr char contentKey[] = "value"; constexpr char contentsKey[] = "contents"; constexpr char contextKey[] = "context"; constexpr char contextSupportKey[] = "contextSupport"; constexpr char dataKey[] = "data"; constexpr char definitionKey[] = "definition"; constexpr char definitionProviderKey[] = "definitionProvider"; constexpr char deleteCountKey[] = "deleteCount"; constexpr char deltaKey[] = "delta"; constexpr char deprecatedKey[] = "deprecated"; constexpr char detailKey[] = "detail"; constexpr char diagnosticsKey[] = "diagnostics"; constexpr char didChangeConfigurationKey[] = "didChangeConfiguration"; constexpr char didChangeWatchedFilesKey[] = "didChangeWatchedFiles"; constexpr char didSaveKey[] = "didSave"; constexpr char documentChangesKey[] = "documentChanges"; constexpr char documentFormattingProviderKey[] = "documentFormattingProvider"; constexpr char documentHighlightKey[] = "documentHighlight"; constexpr char documentHighlightProviderKey[] = "documentHighlightProvider"; constexpr char documentLinkKey[] = "documentLink"; constexpr char documentLinkProviderKey[] = "documentLinkProvider"; constexpr char documentRangeFormattingProviderKey[] = "documentRangeFormattingProvider"; constexpr char documentSelectorKey[] = "documentSelector"; constexpr char documentSymbolKey[] = "documentSymbol"; constexpr char documentSymbolProviderKey[] = "documentSymbolProvider"; constexpr char documentationFormatKey[] = "documentationFormat"; constexpr char documentationKey[] = "documentation"; constexpr char dynamicRegistrationKey[] = "dynamicRegistration"; constexpr char editKey[] = "edit"; constexpr char editsKey[] = "edits"; constexpr char endKey[] = "end"; constexpr char errorKey[] = "error"; constexpr char eventKey[] = "event"; constexpr char executeCommandKey[] = "executeCommand"; constexpr char executeCommandProviderKey[] = "executeCommandProvider"; constexpr char experimentalKey[] = "experimental"; constexpr char filterTextKey[] = "filterText"; constexpr char firstTriggerCharacterKey[] = "firstTriggerCharacter"; constexpr char formatsKey[] = "formats"; constexpr char formattingKey[] = "formatting"; constexpr char fromKey[] = "from"; constexpr char fromRangesKey[] = "fromRanges"; constexpr char fullKey[] = "full"; constexpr char greenKey[] = "green"; constexpr char hierarchicalDocumentSymbolSupportKey[] = "hierarchicalDocumentSymbolSupport"; constexpr char hoverKey[] = "hover"; constexpr char hoverProviderKey[] = "hoverProvider"; constexpr char idKey[] = "id"; constexpr char ignoreIfExistsKey[] = "ignoreIfExists"; constexpr char ignoreIfNotExistsKey[] = "ignoreIfNotExists"; constexpr char implementationKey[] = "implementation"; constexpr char implementationProviderKey[] = "implementationProvider"; constexpr char includeDeclarationKey[] = "includeDeclaration"; constexpr char includeTextKey[] = "includeText"; constexpr char initializationOptionsKey[] = "initializationOptions"; constexpr char insertFinalNewlineKey[] = "insertFinalNewline"; constexpr char insertSpaceKey[] = "insertSpace"; constexpr char insertTextFormatKey[] = "insertTextFormat"; constexpr char insertTextKey[] = "insertText"; constexpr char isIncompleteKey[] = "isIncomplete"; constexpr char itemKey[] = "item"; constexpr char itemsKey[] = "items"; constexpr char jsonRpcVersionKey[] = "jsonrpc"; constexpr char kindKey[] = "kind"; constexpr char labelKey[] = "label"; constexpr char languageIdKey[] = "languageId"; constexpr char languageKey[] = "language"; constexpr char legendKey[] = "legend"; constexpr char limitKey[] = "limit"; constexpr char lineKey[] = "line"; constexpr char linesKey[] = "lines"; constexpr char locationKey[] = "location"; constexpr char messageKey[] = "message"; constexpr char methodKey[] = "method"; constexpr char moreTriggerCharacterKey[] = "moreTriggerCharacter"; constexpr char multiLineTokenSupportKey[] = "multiLineTokenSupport"; constexpr char nameKey[] = "name"; constexpr char newNameKey[] = "newName"; constexpr char newTextKey[] = "newText"; constexpr char newUriKey[] = "newUri"; constexpr char oldUriKey[] = "oldUri"; constexpr char onTypeFormattingKey[] = "onTypeFormatting"; constexpr char onlyKey[] = "only"; constexpr char openCloseKey[] = "openClose"; constexpr char optionsKey[] = "options"; constexpr char overlappingTokenSupportKey[] = "overlappingTokenSupport"; constexpr char overwriteKey[] = "overwrite"; constexpr char parametersKey[] = "parameters"; constexpr char paramsKey[] = "params"; constexpr char patternKey[] = "pattern"; constexpr char percentageKey[] = "percentage"; constexpr char placeHolderKey[] = "placeHolder"; constexpr char positionKey[] = "position"; constexpr char prepareProviderKey[] = "prepareProvider"; constexpr char prepareSupportKey[] = "prepareSupport"; constexpr char previousResultIdKey[] = "previousResultId"; constexpr char processIdKey[] = "processId"; constexpr char queryKey[] = "query"; constexpr char rangeFormattingKey[] = "rangeFormatting"; constexpr char rangeKey[] = "range"; constexpr char rangeLengthKey[] = "rangeLength"; constexpr char reasonKey[] = "reason"; constexpr char recursiveKey[] = "recursive"; constexpr char redKey[] = "red"; constexpr char referencesKey[] = "references"; constexpr char referencesProviderKey[] = "referencesProvider"; constexpr char refreshSupportKey[] = "refreshSupport"; constexpr char registerOptionsKey[] = "registerOptions"; constexpr char registrationsKey[] = "registrations"; constexpr char removedKey[] = "removed"; constexpr char renameKey[] = "rename"; constexpr char renameProviderKey[] = "renameProvider"; constexpr char requestsKey[] = "requests"; constexpr char resolveProviderKey[] = "resolveProvider"; constexpr char resourceOperationsKey[] = "resourceOperations"; constexpr char resultIdKey[] = "resultId"; constexpr char resultKey[] = "result"; constexpr char retryKey[] = "retry"; constexpr char rootPathKey[] = "rootPath"; constexpr char rootUriKey[] = "rootUri"; constexpr char saveKey[] = "save"; constexpr char schemeKey[] = "scheme"; constexpr char scopeUriKey[] = "scopeUri"; constexpr char sectionKey[] = "section"; constexpr char selectionRangeKey[] = "selectionRange"; constexpr char semanticTokensKey[] = "semanticTokens"; constexpr char semanticTokensProviderKey[] = "semanticTokensProvider"; constexpr char serverInfoKey[] = "serverInfo"; constexpr char settingsKey[] = "settings"; constexpr char severityKey[] = "severity"; constexpr char signatureHelpKey[] = "signatureHelp"; constexpr char signatureHelpProviderKey[] = "signatureHelpProvider"; constexpr char signatureInformationKey[] = "signatureInformation"; constexpr char signaturesKey[] = "signatures"; constexpr char snippetSupportKey[] = "snippetSupport"; constexpr char sortTextKey[] = "sortText"; constexpr char sourceKey[] = "source"; constexpr char startKey[] = "start"; constexpr char supportedKey[] = "supported"; constexpr char symbolKey[] = "symbol"; constexpr char symbolKindKey[] = "symbolKind"; constexpr char syncKindKey[] = "syncKind"; constexpr char synchronizationKey[] = "synchronization"; constexpr char tabSizeKey[] = "tabSize"; constexpr char tagsKey[] = "tags"; constexpr char targetKey[] = "target"; constexpr char textDocumentKey[] = "textDocument"; constexpr char textDocumentSyncKey[] = "textDocumentSync"; constexpr char textEditKey[] = "textEdit"; constexpr char textKey[] = "text"; constexpr char titleKey[] = "title"; constexpr char toKey[] = "to"; constexpr char tokenKey[] = "token"; constexpr char tokenModifiersKey[] = "tokenModifiers"; constexpr char tokenTypesKey[] = "tokenTypes"; constexpr char traceKey[] = "trace"; constexpr char triggerCharacterKey[] = "triggerCharacter"; constexpr char triggerCharactersKey[] = "triggerCharacters"; constexpr char triggerKindKey[] = "triggerKind"; constexpr char trimFinalNewlinesKey[] = "trimFinalNewlines"; constexpr char trimTrailingWhitespaceKey[] = "trimTrailingWhitespace"; constexpr char typeDefinitionKey[] = "typeDefinition"; constexpr char typeDefinitionProviderKey[] = "typeDefinitionProvider"; constexpr char typeKey[] = "type"; constexpr char unregistrationsKey[] = "unregistrations"; constexpr char uriKey[] = "uri"; constexpr char valueKey[] = "value"; constexpr char valueSetKey[] = "valueSet"; constexpr char versionKey[] = "version"; constexpr char willSaveKey[] = "willSave"; constexpr char willSaveWaitUntilKey[] = "willSaveWaitUntil"; constexpr char windowKey[] = "window"; constexpr char workDoneProgressKey[] = "workDoneProgress"; constexpr char workspaceEditKey[] = "workspaceEdit"; constexpr char workspaceFoldersKey[] = "workspaceFolders"; constexpr char workspaceKey[] = "workspace"; constexpr char workspaceSymbolProviderKey[] = "workspaceSymbolProvider"; } // namespace lsp qbs-src-3.2.0/src/shared/lsp/client.cpp0000644000175100017510000000113015154533055017312 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "client.h" namespace lsp { constexpr const char RegisterCapabilityRequest::methodName[]; constexpr const char UnregisterCapabilityRequest::methodName[]; RegisterCapabilityRequest::RegisterCapabilityRequest(const RegistrationParams ¶ms) : Request(methodName, params) { } UnregisterCapabilityRequest::UnregisterCapabilityRequest(const UnregistrationParams ¶ms) : UnregisterCapabilityRequest(methodName, params) { } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/CMakeLists.txt0000644000175100017510000000247515154533055020105 0ustar runnerrunneradd_qbs_library(qtclsp STATIC DEPENDS Qt${QT_VERSION_MAJOR}::Core Qt6Core5Compat SOURCES algorithm.h basemessage.cpp basemessage.h callhierarchy.cpp callhierarchy.h client.cpp client.h clientcapabilities.cpp clientcapabilities.h completion.cpp completion.h diagnostics.cpp diagnostics.h initializemessages.cpp initializemessages.h jsonkeys.h jsonobject.cpp jsonobject.h jsonrpcmessages.cpp jsonrpcmessages.h languagefeatures.cpp languagefeatures.h languageserverprotocol_global.h languageserverprotocoltr.h lsptypes.cpp lsptypes.h lsputils.cpp lsputils.h messages.cpp messages.h progresssupport.cpp progresssupport.h semantictokens.cpp semantictokens.h servercapabilities.cpp servercapabilities.h shutdownmessages.cpp shutdownmessages.h textsynchronization.cpp textsynchronization.h textutils.cpp textutils.h workspace.cpp workspace.h ) target_include_directories( qtclsp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/corelib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/.. ) target_compile_definitions(qtclsp PUBLIC "LANGUAGESERVERPROTOCOL_STATIC_LIBRARY" ) qbs-src-3.2.0/src/shared/lsp/client.h0000644000175100017510000000610515154533055016766 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "jsonrpcmessages.h" namespace lsp { class Registration : public JsonObject { public: Registration() : Registration(QString()) {} explicit Registration(const QString &method) { setId(QUuid::createUuid().toString()); setMethod(method); } using JsonObject::JsonObject; QString id() const { return typedValue(idKey); } void setId(const QString &id) { insert(idKey, id); } QString method() const { return typedValue(methodKey); } void setMethod(const QString &method) { insert(methodKey, method); } QJsonValue registerOptions() const { return value(registerOptionsKey); } void setRegisterOptions(const QJsonValue ®isterOptions) { insert(registerOptionsKey, registerOptions); } bool isValid() const override { return contains(idKey) && contains(methodKey); } }; class RegistrationParams : public JsonObject { public: RegistrationParams() : RegistrationParams(QList()) {} explicit RegistrationParams(const QList ®istrations) { setRegistrations(registrations); } using JsonObject::JsonObject; QList registrations() const { return array(registrationsKey); } void setRegistrations(const QList ®istrations) { insertArray(registrationsKey, registrations); } bool isValid() const override { return contains(registrationsKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT RegisterCapabilityRequest : public Request< std::nullptr_t, std::nullptr_t, RegistrationParams> { public: explicit RegisterCapabilityRequest(const RegistrationParams ¶ms); using Request::Request; constexpr static const char methodName[] = "client/registerCapability"; }; class Unregistration : public JsonObject { public: using JsonObject::JsonObject; QString id() const { return typedValue(idKey); } void setId(const QString &id) { insert(idKey, id); } QString method() const { return typedValue(methodKey); } void setMethod(const QString &method) { insert(methodKey, method); } bool isValid() const override { return contains(idKey) && contains(methodKey); } }; class UnregistrationParams : public JsonObject { public: using JsonObject::JsonObject; QList unregistrations() const { return array(unregistrationsKey); } void setUnregistrations(const QList &unregistrations) { insertArray(unregistrationsKey, unregistrations); } bool isValid() const override { return contains(unregistrationsKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT UnregisterCapabilityRequest : public Request< std::nullptr_t, std::nullptr_t, UnregistrationParams> { public: explicit UnregisterCapabilityRequest(const UnregistrationParams ¶ms); using Request::Request; constexpr static const char methodName[] = "client/unregisterCapability"; }; } // namespace LanguageClient qbs-src-3.2.0/src/shared/lsp/textutils.h0000644000175100017510000000224015154533055017551 0ustar runnerrunner// Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include #include namespace lsp::Utils::Text { class Position { public: int line = 0; // 1-based int column = -1; // 0-based bool operator<(const Position &other) const { return line < other.line || (line == other.line && column < other.column); } bool operator==(const Position &other) const; bool operator!=(const Position &other) const { return !(operator==(other)); } bool isValid() const { return line > 0 && column >= 0; } static Position fromFileName(QStringView fileName, int &postfixPos); }; class Range { public: int length(const QString &text) const; Position begin; Position end; bool operator<(const Range &other) const { return begin < other.begin; } bool operator==(const Range &other) const; bool operator!=(const Range &other) const { return !(operator==(other)); } }; QString utf16LineTextInUtf8Buffer(const QByteArray &utf8Buffer, int currentUtf8Offset); QDebug &operator<<(QDebug &stream, const Position &pos); } // Text qbs-src-3.2.0/src/shared/lsp/lsputils.h0000644000175100017510000001062215154533055017366 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "languageserverprotocol_global.h" #include #include #include #include #include namespace lsp { LANGUAGESERVERPROTOCOL_EXPORT Q_DECLARE_LOGGING_CATEGORY(conversionLog) template T fromJsonValue(const QJsonValue &value) { if (conversionLog().isDebugEnabled() && !value.isObject()) qCDebug(conversionLog) << "Expected Object in json value but got: " << value; T result(value.toObject()); if (conversionLog().isDebugEnabled() && !result.isValid()) qCDebug(conversionLog) << typeid(result).name() << " is not valid: " << result; return result; } template<> LANGUAGESERVERPROTOCOL_EXPORT QString fromJsonValue(const QJsonValue &value); template<> LANGUAGESERVERPROTOCOL_EXPORT int fromJsonValue(const QJsonValue &value); template<> LANGUAGESERVERPROTOCOL_EXPORT double fromJsonValue(const QJsonValue &value); template<> LANGUAGESERVERPROTOCOL_EXPORT bool fromJsonValue(const QJsonValue &value); template<> LANGUAGESERVERPROTOCOL_EXPORT QJsonObject fromJsonValue(const QJsonValue &value); template<> LANGUAGESERVERPROTOCOL_EXPORT QJsonArray fromJsonValue(const QJsonValue &value); template<> LANGUAGESERVERPROTOCOL_EXPORT QJsonValue fromJsonValue(const QJsonValue &value); template class LanguageClientArray : public std::variant, std::nullptr_t> { public: using std::variant, std::nullptr_t>::variant; using std::variant, std::nullptr_t>::operator=; LanguageClientArray() {} explicit LanguageClientArray(const QList &list) { *this = list; } explicit LanguageClientArray(const QJsonValue &value) { if (value.isArray()) { QList values; values.reserve(value.toArray().count()); for (auto arrayValue : value.toArray()) values << fromJsonValue(arrayValue); *this = values; } else { *this = nullptr; } } QJsonValue toJson() const { if (const auto list = std::get_if>(this)) { QJsonArray array; for (const T &value : *list) array.append(QJsonValue(value)); return array; } return QJsonValue(); } QList toListOrEmpty() const { if (std::holds_alternative>(*this)) return std::get>(*this); return {}; } QList toList() const { QBS_ASSERT(std::holds_alternative>(*this), return {}); return std::get>(*this); } bool isNull() const { return std::holds_alternative(*this); } }; template class LanguageClientValue : public std::variant { public: using std::variant::operator=; LanguageClientValue() : std::variant(nullptr) { } LanguageClientValue(const T &value) : std::variant(value) { } LanguageClientValue(const QJsonValue &value) { if (!QBS_GUARD(!value.isUndefined()) || value.isNull()) *this = nullptr; else *this = fromJsonValue(value); } operator const QJsonValue() const { if (auto val = std::get_if(this)) return QJsonValue(*val); return QJsonValue(); } T value(const T &defaultValue = T()) const { QBS_ASSERT(std::holds_alternative(*this), return defaultValue); return std::get(*this); } template LanguageClientValue transform() { QBS_ASSERT(!std::holds_alternative(*this), return LanguageClientValue()); return Type(std::get(*this)); } bool isNull() const { return std::holds_alternative(*this); } }; template QJsonArray enumArrayToJsonArray(const QList &values) { QJsonArray array; for (T value : values) array.append(static_cast(value)); return array; } template QList jsonArrayToList(const QJsonArray &array) { QList list; for (const QJsonValue &val : array) list << fromJsonValue(val); return list; } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/jsonobject.cpp0000644000175100017510000000137415154533055020206 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "jsonobject.h" #include namespace lsp { JsonObject &JsonObject::operator=(const JsonObject &other) = default; JsonObject &JsonObject::operator=(JsonObject &&other) { m_jsonObject.swap(other.m_jsonObject); return *this; } QJsonObject::iterator JsonObject::insert(const std::string_view key, const JsonObject &object) { return m_jsonObject.insert(QLatin1String(key.data()), object.m_jsonObject); } QJsonObject::iterator JsonObject::insert(const std::string_view key, const QJsonValue &value) { return m_jsonObject.insert(QLatin1String(key.data()), value); } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/servercapabilities.h0000644000175100017510000004740015154533055021373 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "lsptypes.h" #include "semantictokens.h" namespace lsp { class LANGUAGESERVERPROTOCOL_EXPORT WorkDoneProgressOptions : public JsonObject { public: using JsonObject::JsonObject; std::optional workDoneProgress() const { return optionalValue(workDoneProgressKey); } void setWorkDoneProgress(bool workDoneProgress) { insert(workDoneProgressKey, workDoneProgress); } void clearWorkDoneProgress() { remove(workDoneProgressKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ResolveProviderOption : public JsonObject { public: using JsonObject::JsonObject; std::optional resolveProvider() const { return optionalValue(resolveProviderKey); } void setResolveProvider(bool resolveProvider) { insert(resolveProviderKey, resolveProvider); } void clearResolveProvider() { remove(resolveProviderKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentRegistrationOptions : public JsonObject { public: using JsonObject::JsonObject; LanguageClientArray documentSelector() const { return clientArray(documentSelectorKey); } void setDocumentSelector(const LanguageClientArray &documentSelector) { insert(documentSelectorKey, documentSelector.toJson()); } bool filterApplies(const Utils::FilePath &fileName) const; bool isValid() const override { return contains(documentSelectorKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT SaveOptions : public JsonObject { public: using JsonObject::JsonObject; // The client is supposed to include the content on save. std::optional includeText() const { return optionalValue(includeTextKey); } void setIncludeText(bool includeText) { insert(includeTextKey, includeText); } void clearIncludeText() { remove(includeTextKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentSyncOptions : public JsonObject { public: using JsonObject::JsonObject; // Open and close notifications are sent to the server. std::optional openClose() const { return optionalValue(openCloseKey); } void setOpenClose(bool openClose) { insert(openCloseKey, openClose); } void clearOpenClose() { remove(openCloseKey); } // Change notifications are sent to the server. See TextDocumentSyncKind.None, // TextDocumentSyncKind.Full and TextDocumentSyncKind.Incremental. std::optional change() const { return optionalValue(changeKey); } void setChange(int change) { insert(changeKey, change); } void clearChange() { remove(changeKey); } // Will save notifications are sent to the server. std::optional willSave() const { return optionalValue(willSaveKey); } void setWillSave(bool willSave) { insert(willSaveKey, willSave); } void clearWillSave() { remove(willSaveKey); } // Will save wait until requests are sent to the server. std::optional willSaveWaitUntil() const { return optionalValue(willSaveWaitUntilKey); } void setWillSaveWaitUntil(bool willSaveWaitUntil) { insert(willSaveWaitUntilKey, willSaveWaitUntil); } void clearWillSaveWaitUntil() { remove(willSaveWaitUntilKey); } // Save notifications are sent to the server. std::optional save() const { return optionalValue(saveKey); } void setSave(const SaveOptions &save) { insert(saveKey, save); } void clearSave() { remove(saveKey); } }; enum class TextDocumentSyncKind { // Documents should not be synced at all. None = 0, // Documents are synced by always sending the full content of the document. Full = 1, // Documents are synced by sending the full content on open. // After that only incremental updates to the document are send. Incremental = 2 }; class LANGUAGESERVERPROTOCOL_EXPORT CodeActionOptions : public WorkDoneProgressOptions { public: using WorkDoneProgressOptions::WorkDoneProgressOptions; QList codeActionKinds() const { return array(codeActionKindsKey); } void setCodeActionKinds(const QList &codeActionKinds) { insertArray(codeActionKindsKey, codeActionKinds); } bool isValid() const override; }; enum class SemanticRequestType { None = 0x0, Full = 0x1, FullDelta = 0x2, Range = 0x4 }; Q_DECLARE_FLAGS(SemanticRequestTypes, SemanticRequestType) class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensOptions : public WorkDoneProgressOptions { public: using WorkDoneProgressOptions::WorkDoneProgressOptions; /// The legend used by the server SemanticTokensLegend legend() const { return typedValue(legendKey); } void setLegend(const SemanticTokensLegend &legend) { insert(legendKey, legend); } /// Server supports providing semantic tokens for a specific range of a document. std::optional> range() const; void setRange(const std::variant &range); void clearRange() { remove(rangeKey); } class FullSemanticTokenOptions : public JsonObject { public: using JsonObject::JsonObject; /// The server supports deltas for full documents. std::optional delta() const { return optionalValue(deltaKey); } void setDelta(bool delta) { insert(deltaKey, delta); } void clearDelta() { remove(deltaKey); } }; /// Server supports providing semantic tokens for a full document. std::optional> full() const; void setFull(const std::variant &full); void clearFull() { remove(fullKey); } bool isValid() const override { return contains(legendKey); } SemanticRequestTypes supportedRequests() const; }; class LANGUAGESERVERPROTOCOL_EXPORT ServerCapabilities : public JsonObject { public: using JsonObject::JsonObject; // Defines how the host (editor) should sync document changes to the language server. class LANGUAGESERVERPROTOCOL_EXPORT CompletionOptions : public WorkDoneProgressOptions { public: using WorkDoneProgressOptions::WorkDoneProgressOptions; // The characters that trigger completion automatically. std::optional> triggerCharacters() const { return optionalArray(triggerCharactersKey); } void setTriggerCharacters(const QList &triggerCharacters) { insertArray(triggerCharactersKey, triggerCharacters); } void clearTriggerCharacters() { remove(triggerCharactersKey); } std::optional resolveProvider() const { return optionalValue(resolveProviderKey); } void setResolveProvider(bool resolveProvider) { insert(resolveProviderKey, resolveProvider); } void clearResolveProvider() { remove(resolveProviderKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT SignatureHelpOptions : public WorkDoneProgressOptions { public: using WorkDoneProgressOptions::WorkDoneProgressOptions; // The characters that trigger signature help automatically. std::optional> triggerCharacters() const { return optionalArray(triggerCharactersKey); } void setTriggerCharacters(const QList &triggerCharacters) { insertArray(triggerCharactersKey, triggerCharacters); } void clearTriggerCharacters() { remove(triggerCharactersKey); } }; using CodeLensOptions = ResolveProviderOption; class LANGUAGESERVERPROTOCOL_EXPORT DocumentOnTypeFormattingOptions : public JsonObject { public: using JsonObject::JsonObject; // A character on which formatting should be triggered, like `}`. QString firstTriggerCharacter() const { return typedValue(firstTriggerCharacterKey); } void setFirstTriggerCharacter(QString firstTriggerCharacter) { insert(firstTriggerCharacterKey, firstTriggerCharacter); } // More trigger characters. std::optional> moreTriggerCharacter() const { return optionalArray(moreTriggerCharacterKey); } void setMoreTriggerCharacter(const QList &moreTriggerCharacter) { insertArray(moreTriggerCharacterKey, moreTriggerCharacter); } void clearMoreTriggerCharacter() { remove(moreTriggerCharacterKey); } bool isValid() const override { return contains(firstTriggerCharacterKey); } }; using DocumentLinkOptions = ResolveProviderOption; class LANGUAGESERVERPROTOCOL_EXPORT ExecuteCommandOptions : public WorkDoneProgressOptions { public: using WorkDoneProgressOptions::WorkDoneProgressOptions; QList commands() const { return array(commandsKey); } void setCommands(const QList &commands) { insertArray(commandsKey, commands); } bool isValid() const override; }; using ColorProviderOptions = JsonObject; class LANGUAGESERVERPROTOCOL_EXPORT StaticRegistrationOptions : public JsonObject { public: using JsonObject::JsonObject; // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. std::optional id() const { return optionalValue(idKey); } void setId(const QString &id) { insert(idKey, id); } void clearId() { remove(idKey); } }; // Defines how text documents are synced. Is either a detailed structure defining each // notification or for backwards compatibility the TextDocumentSyncKind number. using TextDocumentSync = std::variant; std::optional textDocumentSync() const; void setTextDocumentSync(const TextDocumentSync &textDocumentSync); void clearTextDocumentSync() { remove(textDocumentSyncKey); } TextDocumentSyncKind textDocumentSyncKindHelper(); // The server provides hover support. std::optional> hoverProvider() const; void setHoverProvider(const std::variant &hoverProvider); void clearHoverProvider() { remove(hoverProviderKey); } // The server provides completion support. std::optional completionProvider() const { return optionalValue(completionProviderKey); } void setCompletionProvider(const CompletionOptions &completionProvider) { insert(completionProviderKey, completionProvider); } void clearCompletionProvider() { remove(completionProviderKey); } // The server provides signature help support. std::optional signatureHelpProvider() const { return optionalValue(signatureHelpProviderKey); } void setSignatureHelpProvider(const SignatureHelpOptions &signatureHelpProvider) { insert(signatureHelpProviderKey, signatureHelpProvider); } void clearSignatureHelpProvider() { remove(signatureHelpProviderKey); } class LANGUAGESERVERPROTOCOL_EXPORT RegistrationOptions : public JsonObject { public: using JsonObject::JsonObject; LanguageClientArray documentSelector() const { return clientArray(documentSelectorKey); } void setDocumentSelector(const LanguageClientArray &documentSelector) { insert(documentSelectorKey, documentSelector.toJson()); } bool filterApplies(const Utils::FilePath &fileName) const; // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. std::optional id() const { return optionalValue(idKey); } void setId(const QString &id) { insert(idKey, id); } void clearId() { remove(idKey); } bool isValid() const override { return contains(documentSelectorKey); } }; // The server provides goto definition support. std::optional> definitionProvider() const; void setDefinitionProvider(const std::variant &typeDefinitionProvider); void clearDefinitionProvider() { remove(typeDefinitionProviderKey); } // The server provides Goto Type Definition support. std::optional> typeDefinitionProvider() const; void setTypeDefinitionProvider(const std::variant &typeDefinitionProvider); void clearTypeDefinitionProvider() { remove(typeDefinitionProviderKey); } // The server provides Goto Implementation support. std::optional> implementationProvider() const; void setImplementationProvider(const std::variant &implementationProvider); void clearImplementationProvider() { remove(implementationProviderKey); } // The server provides find references support. std::optional> referencesProvider() const; void setReferencesProvider(const std::variant &referencesProvider); void clearReferencesProvider() { remove(referencesProviderKey); } // The server provides document highlight support. std::optional> documentHighlightProvider() const; void setDocumentHighlightProvider( const std::variant &documentHighlightProvider); void clearDocumentHighlightProvider() { remove(documentHighlightProviderKey); } // The server provides document symbol support. std::optional> documentSymbolProvider() const; void setDocumentSymbolProvider(std::variant documentSymbolProvider); void clearDocumentSymbolProvider() { remove(documentSymbolProviderKey); } std::optional semanticTokensProvider() const; void setSemanticTokensProvider(const SemanticTokensOptions &semanticTokensProvider); void clearSemanticTokensProvider() { remove(semanticTokensProviderKey); } std::optional> callHierarchyProvider() const; void setCallHierarchyProvider(const std::variant &callHierarchyProvider); void clearCallHierarchyProvider() { remove(callHierarchyProviderKey); } // The server provides workspace symbol support. std::optional> workspaceSymbolProvider() const; void setWorkspaceSymbolProvider(std::variant workspaceSymbolProvider); void clearWorkspaceSymbolProvider() { remove(workspaceSymbolProviderKey); } // The server provides code actions. std::optional> codeActionProvider() const; void setCodeActionProvider(bool codeActionProvider) { insert(codeActionProviderKey, codeActionProvider); } void setCodeActionProvider(CodeActionOptions options) { insert(codeActionProviderKey, options); } void clearCodeActionProvider() { remove(codeActionProviderKey); } // The server provides code lens. std::optional codeLensProvider() const { return optionalValue(codeLensProviderKey); } void setCodeLensProvider(CodeLensOptions codeLensProvider) { insert(codeLensProviderKey, codeLensProvider); } void clearCodeLensProvider() { remove(codeLensProviderKey); } // The server provides document formatting. std::optional> documentFormattingProvider() const; void setDocumentFormattingProvider( const std::variant &documentFormattingProvider); void clearDocumentFormattingProvider() { remove(documentFormattingProviderKey); } // The server provides document formatting on typing. std::optional> documentRangeFormattingProvider() const; void setDocumentRangeFormattingProvider(std::variant documentRangeFormattingProvider); void clearDocumentRangeFormattingProvider() { remove(documentRangeFormattingProviderKey); } class LANGUAGESERVERPROTOCOL_EXPORT RenameOptions : public WorkDoneProgressOptions { public: using WorkDoneProgressOptions::WorkDoneProgressOptions; // Renames should be checked and tested before being executed. std::optional prepareProvider() const { return optionalValue(prepareProviderKey); } void setPrepareProvider(bool prepareProvider) { insert(prepareProviderKey, prepareProvider); } void clearPrepareProvider() { remove(prepareProviderKey); } }; // The server provides rename support. std::optional> renameProvider() const; void setRenameProvider(std::variant renameProvider); void clearRenameProvider() { remove(renameProviderKey); } // The server provides document link support. std::optional documentLinkProvider() const { return optionalValue(documentLinkProviderKey); } void setDocumentLinkProvider(const DocumentLinkOptions &documentLinkProvider) { insert(documentLinkProviderKey, documentLinkProvider); } void clearDocumentLinkProvider() { remove(documentLinkProviderKey); } // The server provides color provider support. std::optional> colorProvider() const; void setColorProvider(std::variant colorProvider); void clearColorProvider() { remove(colorProviderKey); } // The server provides execute command support. std::optional executeCommandProvider() const { return optionalValue(executeCommandProviderKey); } void setExecuteCommandProvider(ExecuteCommandOptions executeCommandProvider) { insert(executeCommandProviderKey, executeCommandProvider); } void clearExecuteCommandProvider() { remove(executeCommandProviderKey); } class LANGUAGESERVERPROTOCOL_EXPORT WorkspaceServerCapabilities : public JsonObject { public: using JsonObject::JsonObject; class LANGUAGESERVERPROTOCOL_EXPORT WorkspaceFoldersCapabilities : public JsonObject { public: using JsonObject::JsonObject; // The server has support for workspace folders std::optional supported() const { return optionalValue(supportedKey); } void setSupported(bool supported) { insert(supportedKey, supported); } void clearSupported() { remove(supportedKey); } std::optional> changeNotifications() const; void setChangeNotifications(std::variant changeNotifications); void clearChangeNotifications() { remove(changeNotificationsKey); } }; std::optional workspaceFolders() const { return optionalValue(workspaceFoldersKey); } void setWorkspaceFolders(const WorkspaceFoldersCapabilities &workspaceFolders) { insert(workspaceFoldersKey, workspaceFolders); } void clearWorkspaceFolders() { remove(workspaceFoldersKey); } }; std::optional workspace() const { return optionalValue(workspaceKey); } void setWorkspace(const WorkspaceServerCapabilities &workspace) { insert(workspaceKey, workspace); } void clearWorkspace() { remove(workspaceKey); } std::optional experimental() const { return optionalValue(experimentalKey); } void setExperimental(const JsonObject &experimental) { insert(experimentalKey, experimental); } void clearExperimental() { remove(experimentalKey); } }; } // namespace LanguageClient qbs-src-3.2.0/src/shared/lsp/semantictokens.cpp0000644000175100017510000001065515154533055021077 0ustar runnerrunner// Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "semantictokens.h" namespace lsp { bool SemanticTokensLegend::isValid() const { return contains(tokenTypesKey) && contains(tokenModifiersKey); } QMap SemanticTokens::defaultTokenTypesMap() { QMap map; map.insert("namespace", namespaceToken); map.insert("type", typeToken); map.insert("class", classToken); map.insert("enum", enumToken); map.insert("interface", interfaceToken); map.insert("struct", structToken); map.insert("typeParameter", typeParameterToken); map.insert("parameter", parameterToken); map.insert("variable", variableToken); map.insert("property", propertyToken); map.insert("enumMember", enumMemberToken); map.insert("event", eventToken); map.insert("function", functionToken); map.insert("method", methodToken); map.insert("macro", macroToken); map.insert("keyword", keywordToken); map.insert("modifier", modifierToken); map.insert("comment", commentToken); map.insert("string", stringToken); map.insert("number", numberToken); map.insert("regexp", regexpToken); map.insert("operator", operatorToken); return map; } QMap SemanticTokens::defaultTokenModifiersMap() { QMap map; map.insert("declaration", declarationModifier); map.insert("definition", definitionModifier); map.insert("readonly", readonlyModifier); map.insert("static", staticModifier); map.insert("deprecated", deprecatedModifier); map.insert("abstract", abstractModifier); map.insert("async", asyncModifier); map.insert("modification", modificationModifier); map.insert("documentation", documentationModifier); map.insert("defaultLibrary", defaultLibraryModifier); return map; } static int convertModifiers(int modifiersData, const QList &tokenModifiers) { int result = 0; for (int i = 0; i < tokenModifiers.size() && modifiersData > 0; ++i) { if (modifiersData & 0x1) { const int modifier = tokenModifiers[i]; if (modifier > 0) result |= modifier; } modifiersData = modifiersData >> 1; } return result; } QList SemanticTokens::toTokens(const QList &tokenTypes, const QList &tokenModifiers) const { const QList &data = this->data(); if (data.size() % 5 != 0) return {}; QList tokens; tokens.reserve(int(data.size() / 5)); auto end = data.end(); for (auto it = data.begin(); it != end; it += 5) { SemanticToken token; token.deltaLine = *(it); token.deltaStart = *(it + 1); token.length = *(it + 2); token.tokenIndex = *(it + 3); token.tokenType = tokenTypes.value(token.tokenIndex, -1); token.rawTokenModifiers = *(it + 4); token.tokenModifiers = convertModifiers(token.rawTokenModifiers, tokenModifiers); tokens << token; } return tokens; } bool SemanticTokensRangeParams::isValid() const { return SemanticTokensParams::isValid() && contains(rangeKey); } SemanticTokensFullRequest::SemanticTokensFullRequest(const SemanticTokensParams ¶ms) : Request(methodName, params) {} SemanticTokensRangeRequest::SemanticTokensRangeRequest(const SemanticTokensRangeParams ¶ms) : Request(methodName, params) {} SemanticTokensResult::SemanticTokensResult(const QJsonValue &value) { if (value.isObject()) emplace(SemanticTokens(value.toObject())); else emplace(nullptr); } SemanticTokensFullDeltaRequest::SemanticTokensFullDeltaRequest(const SemanticTokensDeltaParams ¶ms) : Request(methodName, params) {} bool SemanticTokensDeltaParams::isValid() const { return SemanticTokensParams::isValid() && contains(previousResultIdKey); } SemanticTokensDeltaResult::SemanticTokensDeltaResult(const QJsonValue &value) { if (value.isObject()) { QJsonObject object = value.toObject(); if (object.contains(editsKey)) emplace(object); else emplace(object); } else { emplace(nullptr); } } SemanticTokensRefreshRequest::SemanticTokensRefreshRequest() : Request(methodName, nullptr) {} } // namespace lsp qbs-src-3.2.0/src/shared/lsp/completion.cpp0000644000175100017510000000353115154533055020214 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "completion.h" namespace lsp { constexpr const char CompletionRequest::methodName[]; constexpr const char CompletionItemResolveRequest::methodName[]; CompletionRequest::CompletionRequest(const CompletionParams ¶ms) : Request(methodName, params) { } std::optional CompletionItem::documentation() const { QJsonValue documentation = value(documentationKey); if (documentation.isUndefined()) return std::nullopt; return MarkupOrString(documentation); } std::optional CompletionItem::insertTextFormat() const { if (std::optional value = optionalValue(insertTextFormatKey)) return std::make_optional(CompletionItem::InsertTextFormat(*value)); return std::nullopt; } std::optional> CompletionItem::tags() const { if (const auto value = optionalValue(tagsKey)) { QList tags; for (auto it = value->cbegin(); it != value->cend(); ++it) tags << static_cast(it->toInt()); return tags; } return {}; } CompletionItemResolveRequest::CompletionItemResolveRequest(const CompletionItem ¶ms) : Request(methodName, params) { } CompletionResult::CompletionResult(const QJsonValue &value) { if (value.isNull()) { emplace(nullptr); } else if (value.isArray()) { QList items; for (auto arrayElement : value.toArray()) items << CompletionItem(arrayElement); emplace>(items); } else if (value.isObject()) { emplace(CompletionList(value)); } } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/predicates.h0000644000175100017510000000674415154533055017644 0ustar runnerrunner// Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include #include #include namespace lsp::Utils { ////////////////// // find helpers ////////////////// template decltype(auto) equal(R (S::*function)() const, T value) { // This should use std::equal_to<> instead of std::equal_to, // but that's not supported everywhere yet, since it is C++14 return std::bind(std::equal_to(), value, std::bind(function, std::placeholders::_1)); } template decltype(auto) equal(R S::*member, T value) { return std::bind(std::equal_to(), value, std::bind(member, std::placeholders::_1)); } ////////////////// // comparison predicates ////////////////// template auto equalTo(Type &&value) { return [value = std::forward(value)] (const auto &entry) { static_assert(std::is_same, std::decay_t>::value, "The container and predicate type of equalTo should be the same to prevent " "unnecessary conversion."); return entry == value; }; } template auto unequalTo(Type &&value) { return [value = std::forward(value)] (const auto &entry) { static_assert(std::is_same, std::decay_t>::value, "The container and predicate type of unequalTo should be the same to prevent " "unnecessary conversion."); return !(entry == value); }; } template auto lessThan(Type &&value) { return [value = std::forward(value)] (const auto &entry) { static_assert(std::is_same, std::decay_t>::value, "The container and predicate type of unequalTo should be the same to prevent " "unnecessary conversion."); return entry < value; }; } template auto lessEqualThan(Type &&value) { return [value = std::forward(value)] (const auto &entry) { static_assert(std::is_same, std::decay_t>::value, "The container and predicate type of lessEqualThan should be the same to " "prevent unnecessary conversion."); return !(value < entry); }; } template auto greaterThan(Type &&value) { return [value = std::forward(value)] (const auto &entry) { static_assert(std::is_same, std::decay_t>::value, "The container and predicate type of greaterThan should be the same to " "prevent unnecessary conversion."); return value < entry; }; } template auto greaterEqualThan(Type &&value) { return [value = std::forward(value)] (const auto &entry) { static_assert(std::is_same, std::decay_t>::value, "The container and predicate type of greaterEqualThan should be the same to " "prevent unnecessary conversion."); return !(entry < value); }; } } // namespace Utils qbs-src-3.2.0/src/shared/lsp/textutils.cpp0000644000175100017510000000761015154533055020112 0ustar runnerrunner// Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "textutils.h" #include #include #include namespace lsp::Utils::Text { bool Position::operator==(const Position &other) const { return line == other.line && column == other.column; } /*! Returns the text position of a \a fileName and sets the \a postfixPos if it can find a positional postfix. The following patterns are supported: \c {filepath.txt:19}, \c{filepath.txt:19:12}, \c {filepath.txt+19}, \c {filepath.txt+19+12}, and \c {filepath.txt(19)}. */ Position Position::fromFileName(QStringView fileName, int &postfixPos) { static const auto regexp = QRegularExpression("[:+](\\d+)?([:+](\\d+)?)?$"); // (10) MSVC-style static const auto vsRegexp = QRegularExpression("[(]((\\d+)[)]?)?$"); const QRegularExpressionMatch match = regexp.match(fileName); Position pos; if (match.hasMatch()) { postfixPos = match.capturedStart(0); if (match.lastCapturedIndex() > 0) { pos.line = match.captured(1).toInt(); if (match.lastCapturedIndex() > 2) // index 2 includes the + or : for the column number pos.column = match.captured(3).toInt() - 1; //column is 0 based, despite line being 1 based } } else { const QRegularExpressionMatch vsMatch = vsRegexp.match(fileName); postfixPos = vsMatch.capturedStart(0); if (vsMatch.lastCapturedIndex() > 1) // index 1 includes closing ) pos.line = vsMatch.captured(2).toInt(); } if (pos.line > 0 && pos.column < 0) pos.column = 0; // if we got a valid line make sure to return a valid TextPosition return pos; } int Range::length(const QString &text) const { if (end.line < begin.line) return -1; if (begin.line == end.line) return end.column - begin.column; int index = 0; int currentLine = 1; while (currentLine < begin.line) { index = text.indexOf(QChar::LineFeed, index); if (index < 0) return -1; ++index; ++currentLine; } const int beginIndex = index + begin.column; while (currentLine < end.line) { index = text.indexOf(QChar::LineFeed, index); if (index < 0) return -1; ++index; ++currentLine; } return index + end.column - beginIndex; } bool Range::operator==(const Range &other) const { return begin == other.begin && end == other.end; } QString utf16LineTextInUtf8Buffer(const QByteArray &utf8Buffer, int currentUtf8Offset) { const int lineStartUtf8Offset = currentUtf8Offset ? (utf8Buffer.lastIndexOf('\n', currentUtf8Offset - 1) + 1) : 0; const int lineEndUtf8Offset = utf8Buffer.indexOf('\n', currentUtf8Offset); return QString::fromUtf8( utf8Buffer.mid(lineStartUtf8Offset, lineEndUtf8Offset - lineStartUtf8Offset)); } static bool isByteOfMultiByteCodePoint(unsigned char byte) { return byte & 0x80; // Check if most significant bit is set } bool utf8AdvanceCodePoint(const char *¤t) { if (Q_UNLIKELY(*current == '\0')) return false; // Process multi-byte UTF-8 code point (non-latin1) if (Q_UNLIKELY(isByteOfMultiByteCodePoint(*current))) { unsigned trailingBytesCurrentCodePoint = 1; for (unsigned char c = (*current) << 2; isByteOfMultiByteCodePoint(c); c <<= 1) ++trailingBytesCurrentCodePoint; current += trailingBytesCurrentCodePoint + 1; // Process single-byte UTF-8 code point (latin1) } else { ++current; } return true; } QDebug &operator<<(QDebug &stream, const Position &pos) { stream << "line: " << pos.line << ", column: " << pos.column; return stream; } } // namespace Utils::Text qbs-src-3.2.0/src/shared/lsp/callhierarchy.h0000644000175100017510000001027615154533055020326 0ustar runnerrunner// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0 #pragma once #include "jsonrpcmessages.h" namespace lsp { class LANGUAGESERVERPROTOCOL_EXPORT CallHierarchyItem : public JsonObject { public: using JsonObject::JsonObject; QString name() const { return typedValue(nameKey); } void setName(const QString &name) { insert(nameKey, name); } SymbolKind symbolKind() const { return SymbolKind(typedValue(symbolKindKey)); } void setSymbolKind(const SymbolKind &symbolKind) { insert(symbolKindKey, int(symbolKind)); } Range range() const { return typedValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } DocumentUri uri() const { return DocumentUri::fromProtocol(typedValue(uriKey)); } void setUri(const DocumentUri &uri) { insert(uriKey, uri); } Range selectionRange() const { return typedValue(selectionRangeKey); } void setSelectionRange(Range selectionRange) { insert(selectionRangeKey, selectionRange); } std::optional detail() const { return optionalValue(detailKey); } void setDetail(const QString &detail) { insert(detailKey, detail); } void clearDetail() { remove(detailKey); } std::optional> children() const { return optionalArray(childrenKey); } void setChildren(const QList &children) { insertArray(childrenKey, children); } void clearChildren() { remove(childrenKey); } bool isValid() const override; }; class LANGUAGESERVERPROTOCOL_EXPORT PrepareCallHierarchyRequest : public Request< LanguageClientArray, std::nullptr_t, TextDocumentPositionParams> { public: explicit PrepareCallHierarchyRequest(const TextDocumentPositionParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/prepareCallHierarchy"; }; class LANGUAGESERVERPROTOCOL_EXPORT CallHierarchyCallsParams : public JsonObject { public: using JsonObject::JsonObject; CallHierarchyItem item() const { return typedValue(itemKey); } void setItem(const CallHierarchyItem &item) { insert(itemKey, item); } bool isValid() const override { return contains(itemKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT CallHierarchyIncomingCall : public JsonObject { public: using JsonObject::JsonObject; CallHierarchyItem from() const { return typedValue(fromKey); } void setFrom(const CallHierarchyItem &from) { insert(fromKey, from); } QList fromRanges() const { return array(fromRangesKey); } void setFromRanges(const QList &fromRanges) { insertArray(fromRangesKey, fromRanges); } bool isValid() const override { return contains(fromRangesKey) && contains(fromRangesKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT CallHierarchyIncomingCallsRequest : public Request< LanguageClientArray, std::nullptr_t, CallHierarchyCallsParams> { public: explicit CallHierarchyIncomingCallsRequest(const CallHierarchyCallsParams ¶ms); using Request::Request; constexpr static const char methodName[] = "callHierarchy/incomingCalls"; }; class LANGUAGESERVERPROTOCOL_EXPORT CallHierarchyOutgoingCall : public JsonObject { public: using JsonObject::JsonObject; CallHierarchyItem to() const { return typedValue(toKey); } void setTo(const CallHierarchyItem &to) { insert(toKey, to); } QList fromRanges() const { return array(fromRangesKey); } void setFromRanges(const QList &fromRanges) { insertArray(fromRangesKey, fromRanges); } bool isValid() const override { return contains(fromRangesKey) && contains(fromRangesKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT CallHierarchyOutgoingCallsRequest : public Request< LanguageClientArray, std::nullptr_t, CallHierarchyCallsParams> { public: explicit CallHierarchyOutgoingCallsRequest(const CallHierarchyCallsParams ¶ms); using Request::Request; constexpr static const char methodName[] = "callHierarchy/outgoingCalls"; }; } // namespace lsp qbs-src-3.2.0/src/shared/lsp/textsynchronization.h0000644000175100017510000002054115154533055021656 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "jsonrpcmessages.h" #include "servercapabilities.h" namespace lsp { class LANGUAGESERVERPROTOCOL_EXPORT DidOpenTextDocumentParams : public JsonObject { public: DidOpenTextDocumentParams() = default; explicit DidOpenTextDocumentParams(const TextDocumentItem &document); using JsonObject::JsonObject; TextDocumentItem textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(TextDocumentItem textDocument) { insert(textDocumentKey, textDocument); } bool isValid() const override { return contains(textDocumentKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DidOpenTextDocumentNotification : public Notification< DidOpenTextDocumentParams> { public: explicit DidOpenTextDocumentNotification(const DidOpenTextDocumentParams ¶ms); using Notification::Notification; constexpr static const char methodName[] = "textDocument/didOpen"; }; class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentChangeRegistrationOptions : public JsonObject { public: TextDocumentChangeRegistrationOptions(); explicit TextDocumentChangeRegistrationOptions(TextDocumentSyncKind kind); using JsonObject::JsonObject; TextDocumentSyncKind syncKind() const { return static_cast(typedValue(syncKindKey)); } void setSyncKind(TextDocumentSyncKind syncKind) { insert(syncKindKey, static_cast(syncKind)); } bool isValid() const override { return contains(syncKindKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DidChangeTextDocumentParams : public JsonObject { public: DidChangeTextDocumentParams(); explicit DidChangeTextDocumentParams(const VersionedTextDocumentIdentifier &docId, const QString &text = QString()); using JsonObject::JsonObject; VersionedTextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const VersionedTextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentContentChangeEvent : public JsonObject { /* * An event describing a change to a text document. If range and rangeLength are omitted * the new text is considered to be the full content of the document. */ public: TextDocumentContentChangeEvent() = default; explicit TextDocumentContentChangeEvent(const QString &text); using JsonObject::JsonObject; // The range of the document that changed. std::optional range() const { return optionalValue(rangeKey); } void setRange(Range range) { insert(rangeKey, range); } void clearRange() { remove(rangeKey); } // The length of the range that got replaced. std::optional rangeLength() const { return optionalValue(rangeLengthKey); } void setRangeLength(int rangeLength) { insert(rangeLengthKey, rangeLength); } void clearRangeLength() { remove(rangeLengthKey); } // The new text of the range/document. QString text() const { return typedValue(textKey); } void setText(const QString &text) { insert(textKey, text); } bool isValid() const override { return contains(textKey); } }; QList contentChanges() const { return array(contentChangesKey); } void setContentChanges(const QList &contentChanges) { insertArray(contentChangesKey, contentChanges); } bool isValid() const override { return contains(textDocumentKey) && contains(contentChangesKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DidChangeTextDocumentNotification : public Notification< DidChangeTextDocumentParams> { public: explicit DidChangeTextDocumentNotification(const DidChangeTextDocumentParams ¶ms); using Notification::Notification; constexpr static const char methodName[] = "textDocument/didChange"; }; class LANGUAGESERVERPROTOCOL_EXPORT WillSaveTextDocumentParams : public JsonObject { public: enum class TextDocumentSaveReason { Manual = 1, AfterDelay = 2, FocusOut = 3 }; WillSaveTextDocumentParams() : WillSaveTextDocumentParams(TextDocumentIdentifier()) {} explicit WillSaveTextDocumentParams( const TextDocumentIdentifier &document, const TextDocumentSaveReason &reason = TextDocumentSaveReason::Manual); using JsonObject::JsonObject; TextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const TextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } TextDocumentSaveReason reason() const { return static_cast(typedValue(reasonKey)); } void setReason(TextDocumentSaveReason reason) { insert(reasonKey, static_cast(reason)); } bool isValid() const override { return contains(textDocumentKey) && contains(reasonKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT WillSaveTextDocumentNotification : public Notification< WillSaveTextDocumentParams> { public: explicit WillSaveTextDocumentNotification(const WillSaveTextDocumentParams ¶ms); using Notification::Notification; constexpr static const char methodName[] = "textDocument/willSave"; }; class LANGUAGESERVERPROTOCOL_EXPORT WillSaveWaitUntilTextDocumentRequest : public Request< LanguageClientArray, std::nullptr_t, WillSaveTextDocumentParams> { public: explicit WillSaveWaitUntilTextDocumentRequest(const WillSaveTextDocumentParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/willSaveWaitUntil"; }; class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentSaveRegistrationOptions : public TextDocumentRegistrationOptions { public: using TextDocumentRegistrationOptions::TextDocumentRegistrationOptions; std::optional includeText() const { return optionalValue(includeTextKey); } void setIncludeText(bool includeText) { insert(includeTextKey, includeText); } void clearIncludeText() { remove(includeTextKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DidSaveTextDocumentParams : public JsonObject { public: DidSaveTextDocumentParams() : DidSaveTextDocumentParams(TextDocumentIdentifier()) {} explicit DidSaveTextDocumentParams(const TextDocumentIdentifier &document); using JsonObject::JsonObject; TextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(TextDocumentIdentifier textDocument) { insert(textDocumentKey, textDocument); } std::optional text() const { return optionalValue(textKey); } void setText(const QString &text) { insert(textKey, text); } void clearText() { remove(textKey); } bool isValid() const override { return contains(textDocumentKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DidSaveTextDocumentNotification : public Notification< DidSaveTextDocumentParams> { public: explicit DidSaveTextDocumentNotification(const DidSaveTextDocumentParams ¶ms); using Notification::Notification; constexpr static const char methodName[] = "textDocument/didSave"; }; class LANGUAGESERVERPROTOCOL_EXPORT DidCloseTextDocumentParams : public JsonObject { public: DidCloseTextDocumentParams() = default; explicit DidCloseTextDocumentParams(const TextDocumentIdentifier &document); using JsonObject::JsonObject; TextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const TextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } bool isValid() const override { return contains(textDocumentKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DidCloseTextDocumentNotification : public Notification< DidCloseTextDocumentParams> { public: explicit DidCloseTextDocumentNotification(const DidCloseTextDocumentParams ¶ms); using Notification::Notification; constexpr static const char methodName[] = "textDocument/didClose"; }; } // namespace LanguageClient qbs-src-3.2.0/src/shared/lsp/clientcapabilities.cpp0000644000175100017510000001000315154533055021663 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "clientcapabilities.h" namespace lsp { std::optional> SymbolCapabilities::SymbolKindCapabilities::valueSet() const { if (std::optional> array = optionalArray(valueSetKey)) { return std::make_optional( Utils::transform(*array, [](int value) { return static_cast(value); })); } return std::nullopt; } void SymbolCapabilities::SymbolKindCapabilities::setValueSet(const QList &valueSet) { insert(valueSetKey, enumArrayToJsonArray(valueSet)); } WorkspaceClientCapabilities::WorkspaceClientCapabilities() { setWorkspaceFolders(true); } std::optional> SemanticTokensClientCapabilities::Requests::range() const { using RetType = std::variant; const QJsonValue &rangeOptions = value(rangeKey); if (rangeOptions.isBool()) return RetType(rangeOptions.toBool()); if (rangeOptions.isObject()) return RetType(rangeOptions.toObject()); return std::nullopt; } void SemanticTokensClientCapabilities::Requests::setRange( const std::variant &range) { insertVariant(rangeKey, range); } std::optional> SemanticTokensClientCapabilities::Requests::full() const { using RetType = std::variant; const QJsonValue &fullOptions = value(fullKey); if (fullOptions.isBool()) return RetType(fullOptions.toBool()); if (fullOptions.isObject()) return RetType(FullSemanticTokenOptions(fullOptions.toObject())); return std::nullopt; } void SemanticTokensClientCapabilities::Requests::setFull( const std::variant &full) { insertVariant(fullKey, full); } std::optional TextDocumentClientCapabilities::semanticTokens() const { return optionalValue(semanticTokensKey); } void TextDocumentClientCapabilities::setSemanticTokens( const SemanticTokensClientCapabilities &semanticTokens) { insert(semanticTokensKey, semanticTokens); } bool SemanticTokensClientCapabilities::isValid() const { return contains(requestsKey) && contains(tokenTypesKey) && contains(tokenModifiersKey) && contains(formatsKey); } const char resourceOperationCreate[] = "create"; const char resourceOperationRename[] = "rename"; const char resourceOperationDelete[] = "delete"; std::optional> WorkspaceClientCapabilities::WorkspaceEditCapabilities::resourceOperations() const { if (!contains(resourceOperationsKey)) return std::nullopt; QList result; for (const QJsonValue &value : this->value(resourceOperationsKey).toArray()) { const QString str = value.toString(); if (str == resourceOperationCreate) result << ResourceOperationKind::Create; else if (str == resourceOperationRename) result << ResourceOperationKind::Rename; else if (str == resourceOperationDelete) result << ResourceOperationKind::Delete; } return result; } void WorkspaceClientCapabilities::WorkspaceEditCapabilities::setResourceOperations( const QList &resourceOperations) { QJsonArray array; for (const auto &kind : resourceOperations) { switch (kind) { case ResourceOperationKind::Create: array << resourceOperationCreate; break; case ResourceOperationKind::Rename: array << resourceOperationRename; break; case ResourceOperationKind::Delete: array << resourceOperationDelete; break; } } insert(resourceOperationsKey, array); } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/lsputils.cpp0000644000175100017510000000361615154533055017726 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "lsputils.h" #include #include #include namespace lsp { Q_LOGGING_CATEGORY(conversionLog, "qtc.languageserverprotocol.conversion", QtWarningMsg) template<> QString fromJsonValue(const QJsonValue &value) { if (conversionLog().isDebugEnabled() && !value.isString()) qCDebug(conversionLog) << "Expected String in json value but got: " << value; return value.toString(); } template<> int fromJsonValue(const QJsonValue &value) { if (conversionLog().isDebugEnabled() && !value.isDouble()) qCDebug(conversionLog) << "Expected double in json value but got: " << value; return value.toInt(); } template<> double fromJsonValue(const QJsonValue &value) { if (conversionLog().isDebugEnabled() && !value.isDouble()) qCDebug(conversionLog) << "Expected double in json value but got: " << value; return value.toDouble(); } template<> bool fromJsonValue(const QJsonValue &value) { if (conversionLog().isDebugEnabled() && !value.isBool()) qCDebug(conversionLog) << "Expected bool in json value but got: " << value; return value.toBool(); } template<> QJsonArray fromJsonValue(const QJsonValue &value) { if (conversionLog().isDebugEnabled() && !value.isArray()) qCDebug(conversionLog) << "Expected Array in json value but got: " << value; return value.toArray(); } template<> QJsonObject fromJsonValue(const QJsonValue &value) { if (conversionLog().isDebugEnabled() && !value.isObject()) qCDebug(conversionLog) << "Expected Object in json value but got: " << value; return value.toObject(); } template<> QJsonValue fromJsonValue(const QJsonValue &value) { return value; } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/clientcapabilities.h0000644000175100017510000007710215154533055021345 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "jsonkeys.h" #include "lsptypes.h" #include "semantictokens.h" namespace lsp { class LANGUAGESERVERPROTOCOL_EXPORT DynamicRegistrationCapabilities : public JsonObject { public: using JsonObject::JsonObject; std::optional dynamicRegistration() const { return optionalValue(dynamicRegistrationKey); } void setDynamicRegistration(bool dynamicRegistration) { insert(dynamicRegistrationKey, dynamicRegistration); } void clearDynamicRegistration() { remove(dynamicRegistrationKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT FullSemanticTokenOptions : public JsonObject { public: using JsonObject::JsonObject; /** * The client will send the `textDocument/semanticTokens/full/delta` * request if the server provides a corresponding handler. */ std::optional delta() const { return optionalValue(deltaKey); } void setDelta(bool delta) { insert(deltaKey, delta); } void clearDelta() { remove(deltaKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensClientCapabilities : public DynamicRegistrationCapabilities { public: using DynamicRegistrationCapabilities::DynamicRegistrationCapabilities; class LANGUAGESERVERPROTOCOL_EXPORT Requests : public JsonObject { /** * Which requests the client supports and might send to the server * depending on the server's capability. Please note that clients might not * show semantic tokens or degrade some of the user experience if a range * or full request is advertised by the client but not provided by the * server. If for example the client capability `requests.full` and * `request.range` are both set to true but the server only provides a * range provider the client might not render a minimap correctly or might * even decide to not show any semantic tokens at all. */ public: using JsonObject::JsonObject; /** * The client will send the `textDocument/semanticTokens/range` request * if the server provides a corresponding handler. */ std::optional> range() const; void setRange(const std::variant &range); void clearRange() { remove(rangeKey); } /** * The client will send the `textDocument/semanticTokens/full` request * if the server provides a corresponding handler. */ std::optional> full() const; void setFull(const std::variant &full); void clearFull() { remove(fullKey); } }; Requests requests() const { return typedValue(requestsKey); } void setRequests(const Requests &requests) { insert(requestsKey, requests); } /// The token types that the client supports. QList tokenTypes() const { return array(tokenTypesKey); } void setTokenTypes(const QList &value) { insertArray(tokenTypesKey, value); } /// The token modifiers that the client supports. QList tokenModifiers() const { return array(tokenModifiersKey); } void setTokenModifiers(const QList &value) { insertArray(tokenModifiersKey, value); } /// The formats the clients supports. QList formats() const { return array(formatsKey); } void setFormats(const QList &value) { insertArray(formatsKey, value); } /// Whether the client supports tokens that can overlap each other. std::optional overlappingTokenSupport() const { return optionalValue(overlappingTokenSupportKey); } void setOverlappingTokenSupport(bool overlappingTokenSupport) { insert(overlappingTokenSupportKey, overlappingTokenSupport); } void clearOverlappingTokenSupport() { remove(overlappingTokenSupportKey); } /// Whether the client supports tokens that can span multiple lines. std::optional multiLineTokenSupport() const { return optionalValue(multiLineTokenSupportKey); } void setMultiLineTokenSupport(bool multiLineTokenSupport) { insert(multiLineTokenSupportKey, multiLineTokenSupport); } void clearMultiLineTokenSupport() { remove(multiLineTokenSupportKey); } bool isValid() const override; }; class LANGUAGESERVERPROTOCOL_EXPORT SymbolCapabilities : public DynamicRegistrationCapabilities { public: using DynamicRegistrationCapabilities::DynamicRegistrationCapabilities; class LANGUAGESERVERPROTOCOL_EXPORT SymbolKindCapabilities : public JsonObject { public: using JsonObject::JsonObject; /* * The symbol kind values the client supports. When this * property exists the client also guarantees that it will * handle values outside its set gracefully and falls back * to a default value when unknown. * * If this property is not present the client only supports * the symbol kinds from `File` to `Array` as defined in * the initial version of the protocol. */ std::optional> valueSet() const; void setValueSet(const QList &valueSet); void clearValueSet() { remove(valueSetKey); } }; // Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. std::optional symbolKind() const { return optionalValue(symbolKindKey); } void setSymbolKind(const SymbolKindCapabilities &symbolKind) { insert(symbolKindKey, symbolKind); } void clearSymbolKind() { remove(symbolKindKey); } std::optional hierarchicalDocumentSymbolSupport() const { return optionalValue(hierarchicalDocumentSymbolSupportKey); } void setHierarchicalDocumentSymbolSupport(bool hierarchicalDocumentSymbolSupport) { insert(hierarchicalDocumentSymbolSupportKey, hierarchicalDocumentSymbolSupport); } void clearHierachicalDocumentSymbolSupport() { remove(hierarchicalDocumentSymbolSupportKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentClientCapabilities : public JsonObject { public: using JsonObject::JsonObject; class LANGUAGESERVERPROTOCOL_EXPORT SynchronizationCapabilities : public DynamicRegistrationCapabilities { public: using DynamicRegistrationCapabilities::DynamicRegistrationCapabilities; // The client supports sending will save notifications. std::optional willSave() const { return optionalValue(willSaveKey); } void setWillSave(bool willSave) { insert(willSaveKey, willSave); } void clearWillSave() { remove(willSaveKey); } /* * The client supports sending a will save request and * waits for a response providing text edits which will * be applied to the document before it is saved. */ std::optional willSaveWaitUntil() const { return optionalValue(willSaveWaitUntilKey); } void setWillSaveWaitUntil(bool willSaveWaitUntil) { insert(willSaveWaitUntilKey, willSaveWaitUntil); } void clearWillSaveWaitUntil() { remove(willSaveWaitUntilKey); } // The client supports did save notifications. std::optional didSave() const { return optionalValue(didSaveKey); } void setDidSave(bool didSave) { insert(didSaveKey, didSave); } void clearDidSave() { remove(didSaveKey); } }; std::optional synchronization() const { return optionalValue(synchronizationKey); } void setSynchronization(const SynchronizationCapabilities &synchronization) { insert(synchronizationKey, synchronization); } void clearSynchronization() { remove(synchronizationKey); } class LANGUAGESERVERPROTOCOL_EXPORT CompletionCapabilities : public DynamicRegistrationCapabilities { public: using DynamicRegistrationCapabilities::DynamicRegistrationCapabilities; class LANGUAGESERVERPROTOCOL_EXPORT CompletionItemCapbilities : public JsonObject { public: using JsonObject::JsonObject; /* * Client supports snippets as insert text. * * A snippet can define tab stops and placeholders with `$1`, `$2` * and `${3:foo}`. `$0` defines the final tab stop, it defaults to * the end of the snippet. Placeholders with equal identifiers are linked, * that is typing in one will update others too. */ std::optional snippetSupport() const { return optionalValue(snippetSupportKey); } void setSnippetSupport(bool snippetSupport) { insert(snippetSupportKey, snippetSupport); } void clearSnippetSupport() { remove(snippetSupportKey); } // Client supports commit characters on a completion item. std::optional commitCharacterSupport() const { return optionalValue(commitCharacterSupportKey); } void setCommitCharacterSupport(bool commitCharacterSupport) { insert(commitCharacterSupportKey, commitCharacterSupport); } void clearCommitCharacterSupport() { remove(commitCharacterSupportKey); } /* * Client supports the follow content formats for the documentation * property. The order describes the preferred format of the client. */ std::optional> documentationFormat() const; void setDocumentationFormat(const QList &documentationFormat); void clearDocumentationFormat() { remove(documentationFormatKey); } }; // The client supports the following `CompletionItem` specific capabilities. std::optional completionItem() const { return optionalValue(completionItemKey); } void setCompletionItem(const CompletionItemCapbilities &completionItem) { insert(completionItemKey, completionItem); } void clearCompletionItem() { remove(completionItemKey); } class LANGUAGESERVERPROTOCOL_EXPORT CompletionItemKindCapabilities : public JsonObject { public: CompletionItemKindCapabilities(); using JsonObject::JsonObject; /* * The completion item kind values the client supports. When this * property exists the client also guarantees that it will * handle values outside its set gracefully and falls back * to a default value when unknown. * * If this property is not present the client only supports * the completion items kinds from `Text` to `Reference` as defined in * the initial version of the protocol. */ std::optional> valueSet() const; void setValueSet(const QList &valueSet); void clearValueSet() { remove(valueSetKey); } }; std::optional completionItemKind() const { return optionalValue(completionItemKindKey); } void setCompletionItemKind(const CompletionItemKindCapabilities &completionItemKind) { insert(completionItemKindKey, completionItemKind); } void clearCompletionItemKind() { remove(completionItemKindKey); } /* * The client supports to send additional context information for a * `textDocument/completion` request. */ std::optional contextSupport() const { return optionalValue(contextSupportKey); } void setContextSupport(bool contextSupport) { insert(contextSupportKey, contextSupport); } void clearContextSupport() { remove(contextSupportKey); } }; // Capabilities specific to the `textDocument/completion` std::optional completion() const { return optionalValue(completionKey); } void setCompletion(const CompletionCapabilities &completion) { insert(completionKey, completion); } void clearCompletion() { remove(completionKey); } class LANGUAGESERVERPROTOCOL_EXPORT HoverCapabilities : public DynamicRegistrationCapabilities { public: using DynamicRegistrationCapabilities::DynamicRegistrationCapabilities; /* * Client supports the follow content formats for the content * property. The order describes the preferred format of the client. */ std::optional> contentFormat() const; void setContentFormat(const QList &contentFormat); void clearContentFormat() { remove(contentFormatKey); } }; std::optional hover() const { return optionalValue(hoverKey); } void setHover(const HoverCapabilities &hover) { insert(hoverKey, hover); } void clearHover() { remove(hoverKey); } class LANGUAGESERVERPROTOCOL_EXPORT SignatureHelpCapabilities : public DynamicRegistrationCapabilities { public: using DynamicRegistrationCapabilities::DynamicRegistrationCapabilities; class LANGUAGESERVERPROTOCOL_EXPORT SignatureInformationCapabilities : public JsonObject { public: using JsonObject::JsonObject; /* * Client supports the follow content formats for the documentation * property. The order describes the preferred format of the client. */ std::optional> documentationFormat() const; void setDocumentationFormat(const QList &documentationFormat); void clearDocumentationFormat() { remove(documentationFormatKey); } std::optional activeParameterSupport() const { return optionalValue(activeParameterSupportKey); } void setActiveParameterSupport(bool activeParameterSupport) { insert(activeParameterSupportKey, activeParameterSupport); } void clearActiveParameterSupport() { remove(activeParameterSupportKey); } }; // The client supports the following `SignatureInformation` specific properties. std::optional signatureInformation() const { return optionalValue(signatureInformationKey); } void setSignatureInformation(const SignatureInformationCapabilities &signatureInformation) { insert(signatureInformationKey, signatureInformation); } void clearSignatureInformation() { remove(signatureInformationKey); } }; // Capabilities specific to the `textDocument/signatureHelp` std::optional signatureHelp() const { return optionalValue(signatureHelpKey); } void setSignatureHelp(const SignatureHelpCapabilities &signatureHelp) { insert(signatureHelpKey, signatureHelp); } void clearSignatureHelp() { remove(signatureHelpKey); } // Whether references supports dynamic registration. std::optional references() const { return optionalValue(referencesKey); } void setReferences(const DynamicRegistrationCapabilities &references) { insert(referencesKey, references); } void clearReferences() { remove(referencesKey); } // Whether document highlight supports dynamic registration. std::optional documentHighlight() const { return optionalValue(documentHighlightKey); } void setDocumentHighlight(const DynamicRegistrationCapabilities &documentHighlight) { insert(documentHighlightKey, documentHighlight); } void clearDocumentHighlight() { remove(documentHighlightKey); } // Capabilities specific to the `textDocument/documentSymbol` std::optional documentSymbol() const { return optionalValue(documentSymbolKey); } void setDocumentSymbol(const SymbolCapabilities &documentSymbol) { insert(documentSymbolKey, documentSymbol); } void clearDocumentSymbol() { remove(documentSymbolKey); } // Whether formatting supports dynamic registration. std::optional formatting() const { return optionalValue(formattingKey); } void setFormatting(const DynamicRegistrationCapabilities &formatting) { insert(formattingKey, formatting); } void clearFormatting() { remove(formattingKey); } // Whether range formatting supports dynamic registration. std::optional rangeFormatting() const { return optionalValue(rangeFormattingKey); } void setRangeFormatting(const DynamicRegistrationCapabilities &rangeFormatting) { insert(rangeFormattingKey, rangeFormatting); } void clearRangeFormatting() { remove(rangeFormattingKey); } // Whether on type formatting supports dynamic registration. std::optional onTypeFormatting() const { return optionalValue(onTypeFormattingKey); } void setOnTypeFormatting(const DynamicRegistrationCapabilities &onTypeFormatting) { insert(onTypeFormattingKey, onTypeFormatting); } void clearOnTypeFormatting() { remove(onTypeFormattingKey); } // Whether definition supports dynamic registration. std::optional definition() const { return optionalValue(definitionKey); } void setDefinition(const DynamicRegistrationCapabilities &definition) { insert(definitionKey, definition); } void clearDefinition() { remove(definitionKey); } /* * Whether typeDefinition supports dynamic registration. If this is set to `true` * the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` * return value for the corresponding server capability as well. */ std::optional typeDefinition() const { return optionalValue(typeDefinitionKey); } void setTypeDefinition(const DynamicRegistrationCapabilities &typeDefinition) { insert(typeDefinitionKey, typeDefinition); } void clearTypeDefinition() { remove(typeDefinitionKey); } /* * Whether implementation supports dynamic registration. If this is set to `true` * the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` * return value for the corresponding server capability as well. */ std::optional implementation() const { return optionalValue(implementationKey); } void setImplementation(const DynamicRegistrationCapabilities &implementation) { insert(implementationKey, implementation); } void clearImplementation() { remove(implementationKey); } class LANGUAGESERVERPROTOCOL_EXPORT CodeActionCapabilities : public DynamicRegistrationCapabilities { public: using DynamicRegistrationCapabilities::DynamicRegistrationCapabilities; class LANGUAGESERVERPROTOCOL_EXPORT CodeActionLiteralSupport : public JsonObject { public: using JsonObject::JsonObject; class LANGUAGESERVERPROTOCOL_EXPORT CodeActionKind : public JsonObject { public: using JsonObject::JsonObject; CodeActionKind() : CodeActionKind(QList()) {} explicit CodeActionKind(const QList &kinds) { setValueSet(kinds); } QList valueSet() const { return array(valueSetKey); } void setValueSet(const QList &valueSet) { insertArray(valueSetKey, valueSet); } bool isValid() const override { return contains(valueSetKey); } }; CodeActionKind codeActionKind() const { return typedValue(codeActionKindKey); } void setCodeActionKind(const CodeActionKind &codeActionKind) { insert(codeActionKindKey, codeActionKind); } bool isValid() const override { return contains(codeActionKindKey); } }; std::optional codeActionLiteralSupport() const { return optionalValue(codeActionLiteralSupportKey); } void setCodeActionLiteralSupport(const CodeActionLiteralSupport &codeActionLiteralSupport) { insert(codeActionLiteralSupportKey, codeActionLiteralSupport); } void clearCodeActionLiteralSupport() { remove(codeActionLiteralSupportKey); } }; // Whether code action supports dynamic registration. std::optional codeAction() const { return optionalValue(codeActionKey); } void setCodeAction(const CodeActionCapabilities &codeAction) { insert(codeActionKey, codeAction); } void clearCodeAction() { remove(codeActionKey); } // Whether code lens supports dynamic registration. std::optional codeLens() const { return optionalValue(codeLensKey); } void setCodeLens(const DynamicRegistrationCapabilities &codeLens) { insert(codeLensKey, codeLens); } void clearCodeLens() { remove(codeLensKey); } // Whether document link supports dynamic registration. std::optional documentLink() const { return optionalValue(documentLinkKey); } void setDocumentLink(const DynamicRegistrationCapabilities &documentLink) { insert(documentLinkKey, documentLink); } void clearDocumentLink() { remove(documentLinkKey); } /* * Whether colorProvider supports dynamic registration. If this is set to `true` * the client supports the new `(ColorProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)` * return value for the corresponding server capability as well. */ std::optional colorProvider() const { return optionalValue(colorProviderKey); } void setColorProvider(const DynamicRegistrationCapabilities &colorProvider) { insert(colorProviderKey, colorProvider); } void clearColorProvider() { remove(colorProviderKey); } class LANGUAGESERVERPROTOCOL_EXPORT RenameClientCapabilities : public DynamicRegistrationCapabilities { public: using DynamicRegistrationCapabilities::DynamicRegistrationCapabilities; /** * Client supports testing for validity of rename operations * before execution. * * @since version 3.12.0 */ std::optional prepareSupport() const { return optionalValue(prepareSupportKey); } void setPrepareSupport(bool prepareSupport) { insert(prepareSupportKey, prepareSupport); } void clearPrepareSupport() { remove(prepareSupportKey); } }; // Whether rename supports dynamic registration. std::optional rename() const { return optionalValue(renameKey); } void setRename(const RenameClientCapabilities &rename) { insert(renameKey, rename); } void clearRename() { remove(renameKey); } std::optional semanticTokens() const; void setSemanticTokens(const SemanticTokensClientCapabilities &semanticTokens); void clearSemanticTokens() { remove(semanticTokensKey); } std::optional callHierarchy() const { return optionalValue(callHierarchyKey); } void setCallHierarchy(const DynamicRegistrationCapabilities &callHierarchy) { insert(callHierarchyKey, callHierarchy); } void clearCallHierarchy() { remove(callHierarchyKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensWorkspaceClientCapabilities : public JsonObject { public: using JsonObject::JsonObject; /** * Whether the client implementation supports a refresh request sent from * the server to the client. * * Note that this event is global and will force the client to refresh all * semantic tokens currently shown. It should be used with absolute care * and is useful for situation where a server for example detect a project * wide change that requires such a calculation. */ std::optional refreshSupport() const { return optionalValue(refreshSupportKey); } void setRefreshSupport(bool refreshSupport) { insert(refreshSupportKey, refreshSupport); } void clearRefreshSupport() { remove(refreshSupportKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT WorkspaceClientCapabilities : public JsonObject { public: WorkspaceClientCapabilities(); using JsonObject::JsonObject; /* * The client supports applying batch edits to the workspace by supporting the request * 'workspace/applyEdit' */ std::optional applyEdit() const { return optionalValue(applyEditKey); } void setApplyEdit(bool applyEdit) { insert(applyEditKey, applyEdit); } void clearApplyEdit() { remove(applyEditKey); } class LANGUAGESERVERPROTOCOL_EXPORT WorkspaceEditCapabilities : public JsonObject { public: using JsonObject::JsonObject; // The client supports versioned document changes in `WorkspaceEdit`s std::optional documentChanges() const { return optionalValue(documentChangesKey); } void setDocumentChanges(bool documentChanges) { insert(documentChangesKey, documentChanges); } void clearDocumentChanges() { remove(documentChangesKey); } enum class ResourceOperationKind { Create, Rename, Delete }; // The resource operations the client supports. Clients should at least support 'create', // 'rename' and 'delete' files and folders. std::optional> resourceOperations() const; void setResourceOperations(const QList &resourceOperations); void clearResourceOperations() { remove(resourceOperationsKey); } }; // Capabilities specific to `WorkspaceEdit`s std::optional workspaceEdit() const { return optionalValue(workspaceEditKey); } void setWorkspaceEdit(const WorkspaceEditCapabilities &workspaceEdit) { insert(workspaceEditKey, workspaceEdit); } void clearWorkspaceEdit() { remove(workspaceEditKey); } // Capabilities specific to the `workspace/didChangeConfiguration` notification. std::optional didChangeConfiguration() const { return optionalValue(didChangeConfigurationKey); } void setDidChangeConfiguration(const DynamicRegistrationCapabilities &didChangeConfiguration) { insert(didChangeConfigurationKey, didChangeConfiguration); } void clearDidChangeConfiguration() { remove(didChangeConfigurationKey); } // Capabilities specific to the `workspace/didChangeWatchedFiles` notification. std::optional didChangeWatchedFiles() const { return optionalValue(didChangeWatchedFilesKey); } void setDidChangeWatchedFiles(const DynamicRegistrationCapabilities &didChangeWatchedFiles) { insert(didChangeWatchedFilesKey, didChangeWatchedFiles); } void clearDidChangeWatchedFiles() { remove(didChangeWatchedFilesKey); } // Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. std::optional symbol() const { return optionalValue(symbolKey); } void setSymbol(const SymbolCapabilities &symbol) { insert(symbolKey, symbol); } void clearSymbol() { remove(symbolKey); } // Capabilities specific to the `workspace/executeCommand` request. std::optional executeCommand() const { return optionalValue(executeCommandKey); } void setExecuteCommand(const DynamicRegistrationCapabilities &executeCommand) { insert(executeCommandKey, executeCommand); } void clearExecuteCommand() { remove(executeCommandKey); } // The client has support for workspace folders. Since 3.6.0 std::optional workspaceFolders() const { return optionalValue(workspaceFoldersKey); } void setWorkspaceFolders(bool workspaceFolders) { insert(workspaceFoldersKey, workspaceFolders); } void clearWorkspaceFolders() { remove(workspaceFoldersKey); } // The client supports `workspace/configuration` requests. Since 3.6.0 std::optional configuration() const { return optionalValue(configurationKey); } void setConfiguration(bool configuration) { insert(configurationKey, configuration); } void clearConfiguration() { remove(configurationKey); } std::optional semanticTokens() const { return optionalValue(semanticTokensKey); } void setSemanticTokens(const SemanticTokensWorkspaceClientCapabilities &semanticTokens) { insert(semanticTokensKey, semanticTokens); } void clearSemanticTokens() { remove(semanticTokensKey); } }; class WindowClientClientCapabilities : public JsonObject { public: using JsonObject::JsonObject; /** * Whether client supports handling progress notifications. * If set, servers are allowed to report in `workDoneProgress` property * in the request specific server capabilities. * */ std::optional workDoneProgress() const { return optionalValue(workDoneProgressKey); } void setWorkDoneProgress(bool workDoneProgress) { insert(workDoneProgressKey, workDoneProgress); } void clearWorkDoneProgress() { remove(workDoneProgressKey); } private: constexpr static const char workDoneProgressKey[] = "workDoneProgress"; }; class LANGUAGESERVERPROTOCOL_EXPORT ClientCapabilities : public JsonObject { public: using JsonObject::JsonObject; // Workspace specific client capabilities. std::optional workspace() const { return optionalValue(workspaceKey); } void setWorkspace(const WorkspaceClientCapabilities &workspace) { insert(workspaceKey, workspace); } void clearWorkspace() { remove(workspaceKey); } // Text document specific client capabilities. std::optional textDocument() const { return optionalValue(textDocumentKey); } void setTextDocument(const TextDocumentClientCapabilities &textDocument) { insert(textDocumentKey, textDocument); } void clearTextDocument() { remove(textDocumentKey); } // Window specific client capabilities. std::optional window() const { return optionalValue(windowKey); } void setWindow(const WindowClientClientCapabilities &window) { insert(windowKey, window); } void clearWindow() { remove(windowKey); } // Experimental client capabilities. QJsonValue experimental() const { return value(experimentalKey); } void setExperimental(const QJsonValue &experimental) { insert(experimentalKey, experimental); } void clearExperimental() { remove(experimentalKey); } }; } // namespace lsp qbs-src-3.2.0/src/shared/lsp/basemessage.cpp0000644000175100017510000001467215154533055020332 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "basemessage.h" #include "jsonrpcmessages.h" #include "languageserverprotocoltr.h" #include #include #include #include namespace lsp { Q_LOGGING_CATEGORY(parseLog, "qtc.languageserverprotocol.parse", QtWarningMsg) constexpr char headerFieldSeparator[] = ": "; constexpr char contentCharsetName[] = "charset"; constexpr char defaultCharset[] = "utf-8"; constexpr char contentLengthFieldName[] = "Content-Length"; constexpr char headerSeparator[] = "\r\n"; constexpr char contentTypeFieldName[] = "Content-Type"; BaseMessage::BaseMessage() : mimeType(JsonRpcMessage::jsonRpcMimeType()) { } BaseMessage::BaseMessage(const QByteArray &mimeType, const QByteArray &content, int expectedLength, QTextCodec *codec) : mimeType(mimeType.isEmpty() ? JsonRpcMessage::jsonRpcMimeType() : mimeType) , content(content) , contentLength(expectedLength) , codec(codec) { } BaseMessage::BaseMessage(const QByteArray &mimeType, const QByteArray &content) : BaseMessage(mimeType, content, content.length(), defaultCodec()) { } bool BaseMessage::operator==(const BaseMessage &other) const { if (mimeType != other.mimeType || content != other.content) return false; if (codec) { if (other.codec) return codec->mibEnum() == other.codec->mibEnum(); return codec->mibEnum() == defaultCodec()->mibEnum(); } if (other.codec) return other.codec->mibEnum() == defaultCodec()->mibEnum(); return true; } static QPair splitHeaderFieldLine(const QByteArray &headerFieldLine) { static const int fieldSeparatorLength = int(std::strlen(headerFieldSeparator)); int assignmentIndex = headerFieldLine.indexOf(headerFieldSeparator); if (assignmentIndex >= 0) { return {headerFieldLine.mid(0, assignmentIndex), headerFieldLine.mid(assignmentIndex + fieldSeparatorLength)}; } qCWarning(parseLog) << "Unexpected header line:" << QLatin1String(headerFieldLine); return {}; } static void parseContentType(BaseMessage &message, QByteArray contentType, QString &parseError) { if (contentType.startsWith('"') && contentType.endsWith('"')) contentType = contentType.mid(1, contentType.length() - 2); QList contentTypeElements = contentType.split(';'); QByteArray mimeTypeName = contentTypeElements.takeFirst(); QTextCodec *codec = nullptr; for (const QByteArray &_contentTypeElement : contentTypeElements) { const QByteArray &contentTypeElement = _contentTypeElement.trimmed(); if (contentTypeElement.startsWith(contentCharsetName)) { const int equalindex = contentTypeElement.indexOf('='); const QByteArray charset = contentTypeElement.mid(equalindex + 1); if (equalindex > 0) codec = QTextCodec::codecForName(charset); if (!codec) { parseError = Tr::tr("Cannot decode content with \"%1\". Falling back to \"%2\".") .arg(QLatin1String(charset), QLatin1String(defaultCharset)); } } } message.mimeType = mimeTypeName; message.codec = codec ? codec : BaseMessage::defaultCodec(); } static void parseContentLength(BaseMessage &message, QByteArray contentLength, QString &parseError) { bool ok = true; message.contentLength = contentLength.toInt(&ok); if (!ok) { parseError = Tr::tr("Expected an integer in \"%1\", but got \"%2\".") .arg(QString::fromLatin1(contentLengthFieldName), QString::fromLatin1(contentLength)); } } void BaseMessage::parse(QBuffer *data, QString &parseError, BaseMessage &message) { const qint64 startPos = data->pos(); if (message.isValid()) { // incomplete message from last parse message.content.append(data->read(message.contentLength - message.content.length())); return; } while (!data->atEnd()) { const QByteArray &headerFieldLine = data->readLine(); if (headerFieldLine == headerSeparator) { if (message.isValid()) message.content = data->read(message.contentLength); return; } const QPair nameAndValue = splitHeaderFieldLine(headerFieldLine); const QByteArray &headerFieldName = nameAndValue.first.trimmed(); const QByteArray &headerFieldValue = nameAndValue.second.trimmed(); if (headerFieldName.isEmpty()) continue; if (headerFieldName == contentLengthFieldName) { parseContentLength(message, headerFieldValue, parseError); } else if (headerFieldName == contentTypeFieldName) { parseContentType(message, headerFieldValue, parseError); } else { qCWarning(parseLog) << "Unexpected header field" << QLatin1String(headerFieldName) << "in" << QLatin1String(headerFieldLine); } } // the complete header wasn't received jet, waiting for the rest of it and reparse message = BaseMessage(); data->seek(startPos); } QTextCodec *BaseMessage::defaultCodec() { static QTextCodec *codec = QTextCodec::codecForName(defaultCharset); return codec; } bool BaseMessage::isComplete() const { if (!isValid()) return false; QBS_ASSERT(content.length() <= contentLength, return true); return content.length() == contentLength; } bool BaseMessage::isValid() const { return contentLength >= 0; } QByteArray BaseMessage::header() const { QByteArray header; header.append(lengthHeader()); if (codec != defaultCodec() || (!mimeType.isEmpty() && mimeType != JsonRpcMessage::jsonRpcMimeType())) { header.append(typeHeader()); } header.append(headerSeparator); return header; } QByteArray BaseMessage::lengthHeader() const { return QByteArray(contentLengthFieldName) + QByteArray(headerFieldSeparator) + QString::number(content.size()).toLatin1() + QByteArray(headerSeparator); } QByteArray BaseMessage::typeHeader() const { return QByteArray(contentTypeFieldName) + QByteArray(headerFieldSeparator) + mimeType + "; " + contentCharsetName + "=" + codec->name() + QByteArray(headerSeparator); } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/completion.h0000644000175100017510000002550415154533055017665 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "jsonrpcmessages.h" #include "languagefeatures.h" namespace lsp { class LANGUAGESERVERPROTOCOL_EXPORT CompletionParams : public TextDocumentPositionParams { public: using TextDocumentPositionParams::TextDocumentPositionParams; enum CompletionTriggerKind { /** * Completion was triggered by typing an identifier (24x7 code * complete), manual invocation (e.g Ctrl+Space) or via API. */ Invoked = 1, /** * Completion was triggered by a trigger character specified by * the `triggerCharacters` properties of the `CompletionRegistrationOptions`. */ TriggerCharacter = 2, /// Completion was re-triggered as the current completion list is incomplete. TriggerForIncompleteCompletions = 3 }; class CompletionContext : public JsonObject { public: using JsonObject::JsonObject; /// How the completion was triggered. CompletionTriggerKind triggerKind() const { return CompletionTriggerKind(typedValue(triggerKindKey)); } void setTriggerKind(CompletionTriggerKind triggerKind) { insert(triggerKindKey, triggerKind); } /** * The trigger character (a single character) that has trigger code complete. * Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` */ std::optional triggerCharacter() const { return optionalValue(triggerCharacterKey); } void setTriggerCharacter(const QString &triggerCharacter) { insert(triggerCharacterKey, triggerCharacter); } void clearTriggerCharacter() { remove(triggerCharacterKey); } bool isValid() const override { return contains(triggerKindKey); } }; /** * The completion context. This is only available it the client specifies * to send this using `ClientCapabilities.textDocument.completion.contextSupport === true` */ std::optional context() const { return optionalValue(contextKey); } void setContext(const CompletionContext &context) { insert(contextKey, context); } void clearContext() { remove(contextKey); } // clangd extension void setLimit(int limit) { insert(limitKey, limit); } }; class LANGUAGESERVERPROTOCOL_EXPORT CompletionItem : public JsonObject { public: using JsonObject::JsonObject; /** * The label of this completion item. By default also the text that is inserted when selecting * this completion. */ QString label() const { return typedValue(labelKey); } void setLabel(const QString &label) { insert(labelKey, label); } /// The kind of this completion item. Based of the kind an icon is chosen by the editor. std::optional kind() const { return optionalValue(kindKey); } void setKind(int kind) { insert(kindKey, kind); } void clearKind() { remove(kindKey); } /// A human-readable string with additional information about this item, like type information. std::optional detail() const { return optionalValue(detailKey); } void setDetail(const QString &detail) { insert(detailKey, detail); } void clearDetail() { remove(detailKey); } /// A human-readable string that represents a doc-comment. std::optional documentation() const; void setDocumentation(const MarkupOrString &documentation) { insert(documentationKey, documentation.toJson()); } void cleatDocumentation() { remove(documentationKey); } /// A string that should be used when comparing this item /// with other items. When `falsy` the label is used. std::optional sortText() const { return optionalValue(sortTextKey); } void setSortText(const QString &sortText) { insert(sortTextKey, sortText); } void clearSortText() { remove(sortTextKey); } /// A string that should be used when filtering a set of /// completion items. When `falsy` the label is used. std::optional filterText() const { return optionalValue(filterTextKey); } void setFilterText(const QString &filterText) { insert(filterTextKey, filterText); } void clearFilterText() { remove(filterTextKey); } /** * A string that should be inserted into a document when selecting * this completion. When `falsy` the label is used. * * The `insertText` is subject to interpretation by the client side. * Some tools might not take the string literally. For example * VS Code when code complete is requested in this example `con` * and a completion item with an `insertText` of `console` is provided it * will only insert `sole`. Therefore it is recommended to use `textEdit` instead * since it avoids additional client side interpretation. * * @deprecated Use textEdit instead. */ std::optional insertText() const { return optionalValue(insertTextKey); } void setInsertText(const QString &insertText) { insert(insertTextKey, insertText); } void clearInsertText() { remove(insertTextKey); } enum InsertTextFormat { /// The primary text to be inserted is treated as a plain string. PlainText = 1, /** * The primary text to be inserted is treated as a snippet. * * A snippet can define tab stops and placeholders with `$1`, `$2` * and `${3:foo}`. `$0` defines the final tab stop, it defaults to * the end of the snippet. Placeholders with equal identifiers are linked, * that is typing in one will update others too. */ Snippet = 2 }; /// The format of the insert text. The format applies to both the `insertText` property /// and the `newText` property of a provided `textEdit`. std::optional insertTextFormat() const; void setInsertTextFormat(const InsertTextFormat &insertTextFormat) { insert(insertTextFormatKey, insertTextFormat); } void clearInsertTextFormat() { remove(insertTextFormatKey); } /** * An edit which is applied to a document when selecting this completion. When an edit is provided the value of * `insertText` is ignored. * * *Note:* The range of the edit must be a single line range and it must contain the position at which completion * has been requested. */ std::optional textEdit() const { return optionalValue(textEditKey); } void setTextEdit(const TextEdit &textEdit) { insert(textEditKey, textEdit); } void clearTextEdit() { remove(textEditKey); } /** * An optional array of additional text edits that are applied when * selecting this completion. Edits must not overlap with the main edit * nor with themselves. */ std::optional> additionalTextEdits() const { return optionalArray(additionalTextEditsKey); } void setAdditionalTextEdits(const QList &additionalTextEdits) { insertArray(additionalTextEditsKey, additionalTextEdits); } void clearAdditionalTextEdits() { remove(additionalTextEditsKey); } /** * An optional set of characters that when pressed while this completion is active will accept it first and * then type that character. *Note* that all commit characters should have `length=1` and that superfluous * characters will be ignored. */ std::optional> commitCharacters() const { return optionalArray(commitCharactersKey); } void setCommitCharacters(const QList &commitCharacters) { insertArray(commitCharactersKey, commitCharacters); } void clearCommitCharacters() { remove(commitCharactersKey); } /** * An optional command that is executed *after* inserting this completion. *Note* that * additional modifications to the current document should be described with the * additionalTextEdits-property. */ std::optional command() const { return optionalValue(commandKey); } void setCommand(const Command &command) { insert(commandKey, command); } void clearCommand() { remove(commandKey); } /** * An data entry field that is preserved on a completion item between * a completion and a completion resolve request. */ std::optional data() const { return optionalValue(dataKey); } void setData(const QJsonValue &data) { insert(dataKey, data); } void clearData() { remove(dataKey); } /** * Completion item tags are extra annotations that tweak the rendering of a * completion item. * @since 3.15.0 */ enum CompletionItemTag { Deprecated = 1, }; /** * Tags for this completion item. * @since 3.15.0 */ std::optional> tags() const; /** * Indicates if this item is deprecated. * @deprecated Use `tags` instead if supported. */ std::optional deprecated() const { return optionalValue(deprecatedKey); } bool isValid() const override { return contains(labelKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT CompletionList : public JsonObject { public: using JsonObject::JsonObject; /** * This list it not complete. Further typing should result in recomputing * this list. */ bool isIncomplete() const { return typedValue(isIncompleteKey); } void setIsIncomplete(bool isIncomplete) { insert(isIncompleteKey, isIncomplete); } /// The completion items. std::optional> items() const { return array(itemsKey); } void setItems(const QList &items) { insertArray(itemsKey, items); } void clearItems() { remove(itemsKey); } bool isValid() const override { return contains(isIncompleteKey); } }; /// The result of a completion is CompletionItem[] | CompletionList | null class LANGUAGESERVERPROTOCOL_EXPORT CompletionResult : public std::variant, CompletionList, std::nullptr_t> { public: using variant::variant; explicit CompletionResult(const QJsonValue &value); }; class LANGUAGESERVERPROTOCOL_EXPORT CompletionRequest : public Request< CompletionResult, std::nullptr_t, CompletionParams> { public: explicit CompletionRequest(const CompletionParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/completion"; }; class LANGUAGESERVERPROTOCOL_EXPORT CompletionItemResolveRequest : public Request< CompletionItem, std::nullptr_t, CompletionItem> { public: explicit CompletionItemResolveRequest(const CompletionItem ¶ms); using Request::Request; constexpr static const char methodName[] = "completionItem/resolve"; }; } // namespace LanguageClient qbs-src-3.2.0/src/shared/lsp/initializemessages.h0000644000175100017510000001455615154533055021412 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "clientcapabilities.h" #include "jsonrpcmessages.h" #include "lsptypes.h" #include "servercapabilities.h" namespace lsp { class LANGUAGESERVERPROTOCOL_EXPORT Trace { public: enum Values { off, messages, verbose }; Trace() = default; Trace(Values val) : m_value(val) {} Trace(QString val) : Trace(fromString(val)) {} static Trace fromString(const QString& val); QString toString() const; private: Values m_value = off; }; class LANGUAGESERVERPROTOCOL_EXPORT ClientInfo : public JsonObject { public: using JsonObject::JsonObject; QString name() const { return typedValue(nameKey); } void setName(const QString &name) { insert(nameKey, name); } std::optional version() const { return optionalValue(versionKey); } void setVersion(const QString &version) { insert(versionKey, version); } void clearVersion() { remove(versionKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT InitializeParams : public JsonObject { public: InitializeParams(); using JsonObject::JsonObject; /* * The process Id of the parent process that started * the server. Is null if the process has not been started by another process. * If the parent process is not alive then the server should exit (see exit notification) * its process. */ LanguageClientValue processId() const { return clientValue(processIdKey); } void setProcessId(const LanguageClientValue &id) { insert(processIdKey, id); } /* * The rootPath of the workspace. Is null * if no folder is open. * * @deprecated in favor of rootUri. */ std::optional> rootPath() const { return optionalClientValue(rootPathKey); } void setRootPath(const LanguageClientValue &path) { insert(rootPathKey, path); } void clearRootPath() { remove(rootPathKey); } /* * The rootUri of the workspace. Is null if no * folder is open. If both `rootPath` and `rootUri` are set * `rootUri` wins. */ LanguageClientValue rootUri() const { return clientValue(rootUriKey).transform(); } void setRootUri(const LanguageClientValue &uri) { insert(rootUriKey, uri); } // User provided initialization options. std::optional initializationOptions() const; void setInitializationOptions(const QJsonObject &options) { insert(initializationOptionsKey, options); } void clearInitializationOptions() { remove(initializationOptionsKey); } // The capabilities provided by the client (editor or tool) ClientCapabilities capabilities() const { return typedValue(capabilitiesKey); } void setCapabilities(const ClientCapabilities &capabilities) { insert(capabilitiesKey, capabilities); } // The initial trace setting. If omitted trace is disabled ('off'). std::optional trace() const; void setTrace(Trace trace) { insert(traceKey, trace.toString()); } void clearTrace() { remove(traceKey); } /* * The workspace folders configured in the client when the server starts. * This property is only available if the client supports workspace folders. * It can be `null` if the client supports workspace folders but none are * configured. * * Since 3.6.0 */ std::optional> workspaceFolders() const { return optionalClientArray(workspaceFoldersKey); } void setWorkSpaceFolders(const LanguageClientArray &folders) { insert(workspaceFoldersKey, folders.toJson()); } void clearWorkSpaceFolders() { remove(workspaceFoldersKey); } std::optional clientInfo() const { return optionalValue(clientInfoKey); } void setClientInfo(const ClientInfo &clientInfo) { insert(clientInfoKey, clientInfo); } void clearClientInfo() { remove(clientInfoKey); } bool isValid() const override { return contains(processIdKey) && contains(rootUriKey) && contains(capabilitiesKey); } }; using InitializedParams = JsonObject; class LANGUAGESERVERPROTOCOL_EXPORT InitializeNotification : public Notification { public: explicit InitializeNotification(const InitializedParams ¶ms); using Notification::Notification; constexpr static const char methodName[] = "initialized"; bool parametersAreValid(QString * /*errorMessage*/) const final { return true; } }; class LANGUAGESERVERPROTOCOL_EXPORT ServerInfo : public JsonObject { public: using JsonObject::JsonObject; QString name() const { return typedValue(nameKey); } std::optional version() const { return optionalValue(versionKey); } bool isValid() const override { return contains(nameKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT InitializeResult : public JsonObject { public: using JsonObject::JsonObject; ServerCapabilities capabilities() const { return typedValue(capabilitiesKey); } void setCapabilities(const ServerCapabilities &capabilities) { insert(capabilitiesKey, capabilities); } std::optional serverInfo() const { return optionalValue(serverInfoKey); } bool isValid() const override { return contains(capabilitiesKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT InitializeError : public JsonObject { public: using JsonObject::JsonObject; /* * Indicates whether the client execute the following retry logic: * (1) show the message provided by the ResponseError to the user * (2) user selects retry or cancel * (3) if user selected retry the initialize method is sent again. */ bool retry() const { return typedValue(retryKey); } void setRetry(const bool &retry) { insert(retryKey, retry); } bool isValid() const override { return contains(retryKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT InitializeRequest : public Request< InitializeResult, InitializeError, InitializeParams> { public: explicit InitializeRequest(const InitializeParams ¶ms); using Request::Request; constexpr static const char methodName[] = "initialize"; }; } // namespace LanguageClient qbs-src-3.2.0/src/shared/lsp/callhierarchy.cpp0000644000175100017510000000147015154533055020655 0ustar runnerrunner// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0 #include "callhierarchy.h" namespace lsp { bool CallHierarchyItem::isValid() const { return contains(nameKey) && contains(symbolKindKey) && contains(rangeKey) && contains(uriKey) && contains(selectionRangeKey); } PrepareCallHierarchyRequest::PrepareCallHierarchyRequest(const TextDocumentPositionParams ¶ms) : Request(methodName, params) {} CallHierarchyIncomingCallsRequest::CallHierarchyIncomingCallsRequest( const CallHierarchyCallsParams ¶ms) : Request(methodName, params) {} CallHierarchyOutgoingCallsRequest::CallHierarchyOutgoingCallsRequest( const CallHierarchyCallsParams ¶ms) : Request(methodName, params) {} } // namespace lsp qbs-src-3.2.0/src/shared/lsp/lsptypes.cpp0000644000175100017510000002731515154533055017734 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "lsptypes.h" #include "languageserverprotocoltr.h" #include "lsputils.h" #include "textutils.h" #include #include #include #include #include #include namespace lsp { std::optional Diagnostic::severity() const { if (auto val = optionalValue(severityKey)) return std::make_optional(static_cast(*val)); return std::nullopt; } std::optional Diagnostic::code() const { QJsonValue codeValue = value(codeKey); auto it = find(codeKey); if (codeValue.isUndefined()) return std::nullopt; QJsonValue::Type type = it.value().type(); if (type != QJsonValue::String && type != QJsonValue::Double) return std::make_optional(Code(QString())); return std::make_optional(codeValue.isDouble() ? Code(codeValue.toInt()) : Code(codeValue.toString())); } void Diagnostic::setCode(const Diagnostic::Code &code) { insertVariant(codeKey, code); } std::optional WorkspaceEdit::changes() const { auto it = find(changesKey); if (it == end()) return std::nullopt; const QJsonObject &changesObject = it.value().toObject(); Changes changesResult; for (const QString &key : changesObject.keys()) changesResult[DocumentUri::fromProtocol(key)] = LanguageClientArray(changesObject.value(key)).toList(); return std::make_optional(changesResult); } void WorkspaceEdit::setChanges(const Changes &changes) { QJsonObject changesObject; const auto end = changes.end(); for (auto it = changes.begin(); it != end; ++it) { QJsonArray edits; for (const TextEdit &edit : it.value()) edits.append(QJsonValue(edit)); changesObject.insert(QJsonValue(it.key()).toString(), edits); } insert(changesKey, changesObject); } WorkSpaceFolder::WorkSpaceFolder(const DocumentUri &uri, const QString &name) { setUri(uri); setName(name); } MarkupOrString::MarkupOrString(const std::variant &val) : std::variant(val) { } MarkupOrString::MarkupOrString(const QString &val) : std::variant(val) { } MarkupOrString::MarkupOrString(const MarkupContent &val) : std::variant(val) { } MarkupOrString::MarkupOrString(const QJsonValue &val) { if (val.isString()) { emplace(val.toString()); } else { MarkupContent markupContent(val.toObject()); if (markupContent.isValid()) emplace(MarkupContent(val.toObject())); } } QJsonValue MarkupOrString::toJson() const { if (std::holds_alternative(*this)) return std::get(*this); if (std::holds_alternative(*this)) return QJsonValue(std::get(*this)); return {}; } QMap languageIds() { static const QMap languages({ {"Windows Bat","bat" }, {"BibTeX","bibtex" }, {"Clojure","clojure" }, {"Coffeescript","coffeescript" }, {"C","c" }, {"C++","cpp" }, {"C#","csharp" }, {"CSS","css" }, {"Diff","diff" }, {"Dockerfile","dockerfile" }, {"F#","fsharp" }, {"Git commit","git-commit" }, {"Git rebase","git-rebase" }, {"Go","go" }, {"Groovy","groovy" }, {"Handlebars","handlebars" }, {"HTML","html" }, {"Ini","ini" }, {"Java","java" }, {"JavaScript","javascript" }, {"JSON","json" }, {"LaTeX","latex" }, {"Less","less" }, {"Lua","lua" }, {"Makefile","makefile" }, {"Markdown","markdown" }, {"Objective-C","objective-c" }, {"Objective-C++","objective-cpp" }, {"Perl6","perl6" }, {"Perl","perl" }, {"PHP","php" }, {"Powershell","powershell" }, {"Pug","jade" }, {"Python","python" }, {"R","r" }, {"Razor (cshtml)","razor" }, {"Ruby","ruby" }, {"Rust","rust" }, {"Scss (syntax using curly brackets)","scss"}, {"Sass (indented syntax)","sass" }, {"ShaderLab","shaderlab" }, {"Shell Script (Bash)","shellscript" }, {"SQL","sql" }, {"Swift","swift" }, {"TypeScript","typescript" }, {"TeX","tex" }, {"Visual Basic","vb" }, {"XML","xml" }, {"XSL","xsl" }, {"YAML","yaml" } }); return languages; } bool TextDocumentItem::isValid() const { return contains(uriKey) && contains(languageIdKey) && contains(versionKey) && contains(textKey); } TextDocumentPositionParams::TextDocumentPositionParams() : TextDocumentPositionParams(TextDocumentIdentifier(), Position()) { } TextDocumentPositionParams::TextDocumentPositionParams( const TextDocumentIdentifier &document, const Position &position) { setTextDocument(document); setPosition(position); } Position::Position(int line, int character) { setLine(line); setCharacter(character); } Range::Range(const Position &start, const Position &end) { setStart(start); setEnd(end); } bool Range::contains(const Range &other) const { if (start() > other.start()) return false; if (end() < other.end()) return false; return true; } bool Range::overlaps(const Range &range) const { return !isLeftOf(range) && !range.isLeftOf(*this); } QString expressionForGlob(QString globPattern) { const QString anySubDir("qtc_anysubdir_id"); globPattern.replace("**/", anySubDir); QString regexp = QRegularExpression::wildcardToRegularExpression(globPattern); regexp.replace(anySubDir,"(.*[/\\\\])*"); regexp.replace("\\{", "("); regexp.replace("\\}", ")"); regexp.replace(",", "|"); return regexp; } bool DocumentFilter::applies(const Utils::FilePath &fileName) const { if (std::optional _pattern = pattern()) { QRegularExpression::PatternOption option = QRegularExpression::NoPatternOption; if (fileName.caseSensitivity() == Qt::CaseInsensitive) option = QRegularExpression::CaseInsensitiveOption; const QRegularExpression regexp(expressionForGlob(*_pattern), option); if (regexp.isValid() && regexp.match(fileName.toString()).hasMatch()) return true; } // return false when any of the filter didn't match but return true when no filter was defined return !contains(schemeKey) && !contains(languageKey) && !contains(patternKey); } Utils::Link Location::toLink(const DocumentUri::PathMapper &mapToHostPath) const { if (!isValid()) return Utils::Link(); return Utils::Link(uri().toFilePath(mapToHostPath), range().start().line() + 1, range().start().character()); } // Ensure %xx like %20 are really decoded using fromPercentEncoding // Else, a path with spaces would keep its %20 which would cause failure // to open the file by the text editor. This is the cases with compilers in // C:\Programs Files on Windows. DocumentUri::DocumentUri(const QString &other) : QUrl(QUrl::fromPercentEncoding(other.toUtf8())) { } DocumentUri::DocumentUri(const Utils::FilePath &other, const PathMapper &mapToServerPath) : QUrl(QUrl::fromLocalFile(mapToServerPath(other).path())) { } Utils::FilePath DocumentUri::toFilePath(const PathMapper &mapToHostPath) const { if (isLocalFile()) { const Utils::FilePath serverPath = Utils::FilePath::fromUserInput(toLocalFile()); QBS_ASSERT(mapToHostPath, return serverPath); return mapToHostPath(serverPath); } return {}; } DocumentUri DocumentUri::fromProtocol(const QString &uri) { return DocumentUri(uri); } DocumentUri DocumentUri::fromFilePath(const Utils::FilePath &file, const PathMapper &mapToServerPath) { return DocumentUri(file, mapToServerPath); } MarkupKind::MarkupKind(const QJsonValue &value) { m_value = value.toString() == "markdown" ? markdown : plaintext; } MarkupKind::operator QJsonValue() const { switch (m_value) { case MarkupKind::markdown: return "markdown"; case MarkupKind::plaintext: return "plaintext"; } return {}; } DocumentChange::DocumentChange(const QJsonValue &value) { const QString kind = value["kind"].toString(); if (kind == "create") emplace(value); else if (kind == "rename") emplace(value); else if (kind == "delete") emplace(value); else emplace(value); } using DocumentChangeBase = std::variant; bool DocumentChange::isValid() const { return std::visit([](const auto &v) { return v.isValid(); }, DocumentChangeBase(*this)); } DocumentChange::operator const QJsonValue () const { return std::visit([](const auto &v) { return QJsonValue(v); }, DocumentChangeBase(*this)); } CreateFileOperation::CreateFileOperation() { insert(kindKey, "create"); } QString CreateFileOperation::message(const DocumentUri::PathMapper &mapToHostPath) const { return Tr::tr("Create %1").arg(uri().toFilePath(mapToHostPath).toUserOutput()); } bool CreateFileOperation::isValid() const { return contains(uriKey) && value(kindKey) == "create"; } RenameFileOperation::RenameFileOperation() { insert(kindKey, "rename"); } QString RenameFileOperation::message(const DocumentUri::PathMapper &mapToHostPath) const { return Tr::tr("Rename %1 to %2") .arg(oldUri().toFilePath(mapToHostPath).toUserOutput(), newUri().toFilePath(mapToHostPath).toUserOutput()); } bool RenameFileOperation::isValid() const { return contains(oldUriKey) && contains(newUriKey) && value(kindKey) == "rename"; } DeleteFileOperation::DeleteFileOperation() { insert(kindKey, "delete"); } QString DeleteFileOperation::message(const DocumentUri::PathMapper &mapToHostPath) const { return Tr::tr("Delete %1").arg(uri().toFilePath(mapToHostPath).toUserOutput()); } bool DeleteFileOperation::isValid() const { return contains(uriKey) && value(kindKey) == "delete"; } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/messages.cpp0000644000175100017510000000241015154533055017645 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "messages.h" namespace lsp { constexpr const char ShowMessageNotification::methodName[]; constexpr const char ShowMessageRequest::methodName[]; constexpr const char LogMessageNotification::methodName[]; constexpr const char TelemetryNotification::methodName[]; ShowMessageNotification::ShowMessageNotification(const ShowMessageParams ¶ms) : Notification(methodName, params) { } ShowMessageRequest::ShowMessageRequest(const ShowMessageRequestParams ¶ms) : Request(methodName, params) { } LogMessageNotification::LogMessageNotification(const LogMessageParams ¶ms) : Notification(methodName, params) { } TelemetryNotification::TelemetryNotification(const JsonObject ¶ms) : Notification(methodName, params) { } static QString messageTypeName(int messageType) { switch (messageType) { case Error: return QString("Error"); case Warning: return QString("Warning"); case Info: return QString("Info"); case Log: return QString("Log"); } return QString(""); } QString ShowMessageParams::toString() const { return messageTypeName(type()) + ": " + message(); } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/lsp.qbs0000644000175100017510000000354415154533055016650 0ustar runnerrunnerimport qbs.Utilities QbsStaticLibrary { name: "qtclsp" Depends { name: "qbscore"; cpp.link: false } Depends { condition: Utilities.versionCompare(Qt.core.version, "6") >= 0 name: "Qt.core5compat" } cpp.defines: base.filter(function(d) { return d !== "QT_NO_CAST_FROM_ASCII"; }) .concat("LANGUAGESERVERPROTOCOL_STATIC_LIBRARY") files: [ "algorithm.h", "basemessage.cpp", "basemessage.h", "callhierarchy.cpp", "callhierarchy.h", "client.cpp", "client.h", "clientcapabilities.cpp", "clientcapabilities.h", "completion.cpp", "completion.h", "diagnostics.cpp", "diagnostics.h", "filepath.h", "initializemessages.cpp", "initializemessages.h", "jsonkeys.h", "jsonobject.cpp", "jsonobject.h", "jsonrpcmessages.cpp", "jsonrpcmessages.h", "languagefeatures.cpp", "languagefeatures.h", "languageserverprotocol_global.h", "languageserverprotocoltr.h", "link.cpp", "link.h", "lsptypes.cpp", "lsptypes.h", "lsputils.cpp", "lsputils.h", "messages.cpp", "messages.h", "predicates.h", "progresssupport.cpp", "progresssupport.h", "semantictokens.cpp", "semantictokens.h", "servercapabilities.cpp", "servercapabilities.h", "shutdownmessages.cpp", "shutdownmessages.h", "textsynchronization.cpp", "textsynchronization.h", "textutils.cpp", "textutils.h", "workspace.cpp", "workspace.h", ] Export { Depends { name: "cpp" } cpp.defines: "LANGUAGESERVERPROTOCOL_STATIC_LIBRARY" cpp.includePaths: exportingProduct.sourceDirectory + "/.." } } qbs-src-3.2.0/src/shared/lsp/languagefeatures.cpp0000644000175100017510000003000715154533055021363 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "languagefeatures.h" #include namespace lsp { constexpr const char HoverRequest::methodName[]; constexpr const char GotoDefinitionRequest::methodName[]; constexpr const char GotoTypeDefinitionRequest::methodName[]; constexpr const char GotoImplementationRequest::methodName[]; constexpr const char FindReferencesRequest::methodName[]; constexpr const char DocumentHighlightsRequest::methodName[]; constexpr const char DocumentSymbolsRequest::methodName[]; constexpr const char CodeActionRequest::methodName[]; constexpr const char CodeLensRequest::methodName[]; constexpr const char CodeLensResolveRequest::methodName[]; constexpr const char DocumentLinkRequest::methodName[]; constexpr const char DocumentLinkResolveRequest::methodName[]; constexpr const char DocumentColorRequest::methodName[]; constexpr const char ColorPresentationRequest::methodName[]; constexpr const char DocumentFormattingRequest::methodName[]; constexpr const char DocumentRangeFormattingRequest::methodName[]; constexpr const char DocumentOnTypeFormattingRequest::methodName[]; constexpr const char RenameRequest::methodName[]; constexpr const char SignatureHelpRequest::methodName[]; constexpr const char PrepareRenameRequest::methodName[]; HoverContent Hover::content() const { return HoverContent(value(contentsKey)); } void Hover::setContent(const HoverContent &content) { if (auto val = std::get_if(&content)) insert(contentsKey, *val); else if (auto val = std::get_if(&content)) insert(contentsKey, *val); else if (auto val = std::get_if>(&content)) insert(contentsKey, LanguageClientArray(*val).toJson()); else QBS_ASSERT("LanguageClient Using unknown type Hover::setContent",;); } HoverRequest::HoverRequest(const TextDocumentPositionParams ¶ms) : Request(methodName, params) { } std::optional ParameterInformation::documentation() const { QJsonValue documentation = value(documentationKey); if (documentation.isUndefined()) return std::nullopt; return MarkupOrString(documentation); } GotoDefinitionRequest::GotoDefinitionRequest(const TextDocumentPositionParams ¶ms) : Request(methodName, params) { } GotoTypeDefinitionRequest::GotoTypeDefinitionRequest(const TextDocumentPositionParams ¶ms) : Request(methodName, params) { } GotoImplementationRequest::GotoImplementationRequest(const TextDocumentPositionParams ¶ms) : Request(methodName, params) { } FindReferencesRequest::FindReferencesRequest(const ReferenceParams ¶ms) : Request(methodName, params) { } DocumentHighlightsRequest::DocumentHighlightsRequest(const TextDocumentPositionParams ¶ms) : Request(methodName, params) { } DocumentSymbolsRequest::DocumentSymbolsRequest(const DocumentSymbolParams ¶ms) : Request(methodName, params) { } std::optional > CodeActionParams::CodeActionContext::only() const { return optionalArray(onlyKey); } void CodeActionParams::CodeActionContext::setOnly(const QList &only) { insertArray(onlyKey, only); } CodeActionRequest::CodeActionRequest(const CodeActionParams ¶ms) : Request(methodName, params) { } CodeLensRequest::CodeLensRequest(const CodeLensParams ¶ms) : Request(methodName, params) { } CodeLensResolveRequest::CodeLensResolveRequest(const CodeLens ¶ms) : Request(methodName, params) { } DocumentLinkRequest::DocumentLinkRequest(const DocumentLinkParams ¶ms) : Request(methodName, params) { } DocumentLinkResolveRequest::DocumentLinkResolveRequest(const DocumentLink ¶ms) : Request(methodName, params) { } DocumentColorRequest::DocumentColorRequest(const DocumentColorParams ¶ms) : Request(methodName, params) { } ColorPresentationRequest::ColorPresentationRequest(const ColorPresentationParams ¶ms) : Request(methodName, params) { } QHash FormattingOptions::properties() const { QHash ret; for (const QString &key : keys()) { if (key == tabSizeKey || key == insertSpaceKey) continue; QJsonValue property = value(key.toStdString()); if (property.isBool()) ret[key] = property.toBool(); if (property.isDouble()) ret[key] = property.toDouble(); if (property.isString()) ret[key] = property.toString(); } return ret; } void FormattingOptions::setProperty(const std::string_view key, const DocumentFormattingProperty &property) { using namespace std; if (auto val = get_if(&property)) insert(key, *val); else if (auto val = get_if(&property)) insert(key, *val); else if (auto val = get_if(&property)) insert(key, *val); } DocumentFormattingRequest::DocumentFormattingRequest(const DocumentFormattingParams ¶ms) : Request(methodName, params) { } DocumentRangeFormattingRequest::DocumentRangeFormattingRequest( const DocumentRangeFormattingParams ¶ms) : Request(methodName, params) { } bool DocumentOnTypeFormattingParams::isValid() const { return contains(textDocumentKey) && contains(positionKey) && contains(chKey) && contains(optionsKey); } DocumentOnTypeFormattingRequest::DocumentOnTypeFormattingRequest( const DocumentOnTypeFormattingParams ¶ms) : Request(methodName, params) { } PrepareRenameRequest::PrepareRenameRequest(const TextDocumentPositionParams ¶ms) : Request(methodName, params) { } bool RenameParams::isValid() const { return contains(textDocumentKey) && contains(positionKey) && contains(newNameKey); } RenameRequest::RenameRequest(const RenameParams ¶ms) : Request(methodName, params) { } std::optional DocumentLink::target() const { if (std::optional optionalTarget = optionalValue(targetKey)) return std::make_optional(DocumentUri::fromProtocol(*optionalTarget)); return std::nullopt; } std::optional DocumentLink::data() const { return contains(dataKey) ? std::make_optional(value(dataKey)) : std::nullopt; } TextDocumentParams::TextDocumentParams() : TextDocumentParams(TextDocumentIdentifier()) { } TextDocumentParams::TextDocumentParams(const TextDocumentIdentifier &identifier) : JsonObject() { setTextDocument(identifier); } GotoResult::GotoResult(const QJsonValue &value) { if (value.isArray()) { QList locations; for (auto arrayValue : value.toArray()) { if (arrayValue.isObject()) locations.append(Location(arrayValue.toObject())); } emplace>(locations); } else if (value.isObject()) { emplace(value.toObject()); } else { emplace(nullptr); } } template QList documentSymbolsResultArray(const QJsonArray &array) { QList ret; for (const auto &arrayValue : array) { if (arrayValue.isObject()) ret << Symbol(arrayValue.toObject()); } return ret; } DocumentSymbolsResult::DocumentSymbolsResult(const QJsonValue &value) { if (value.isArray()) { QJsonArray array = value.toArray(); if (array.isEmpty()) { *this = QList(); } else { QJsonObject arrayObject = array.first().toObject(); if (arrayObject.contains(rangeKey)) *this = documentSymbolsResultArray(array); else *this = documentSymbolsResultArray(array); } } else { *this = nullptr; } } DocumentHighlightsResult::DocumentHighlightsResult(const QJsonValue &value) { if (value.isArray()) { QList highlights; for (auto arrayValue : value.toArray()) { if (arrayValue.isObject()) highlights.append(DocumentHighlight(arrayValue.toObject())); } *this = highlights; } else { *this = nullptr; } } MarkedString::MarkedString(const QJsonValue &value) { if (value.isObject()) emplace(MarkedLanguageString(value.toObject())); else emplace(value.toString()); } bool MarkedString::isValid() const { if (auto markedLanguageString = std::get_if(this)) return markedLanguageString->isValid(); return true; } MarkedString::operator QJsonValue() const { if (auto val = std::get_if(this)) return *val; if (auto val = std::get_if(this)) return QJsonValue(*val); return {}; } HoverContent::HoverContent(const QJsonValue &value) { if (value.isArray()) { emplace>(LanguageClientArray(value).toList()); } else if (value.isObject()) { const QJsonObject &object = value.toObject(); MarkedLanguageString markedLanguageString(object); if (markedLanguageString.isValid()) emplace(markedLanguageString); else emplace(MarkupContent(object)); } else if (value.isString()) { emplace(MarkedString(value.toString())); } } bool HoverContent::isValid() const { if (std::holds_alternative(*this)) return std::get(*this).isValid(); return true; } DocumentFormattingProperty::DocumentFormattingProperty(const QJsonValue &value) { if (value.isBool()) *this = value.toBool(); if (value.isDouble()) *this = value.toDouble(); if (value.isString()) *this = value.toString(); } SignatureHelpRequest::SignatureHelpRequest(const TextDocumentPositionParams ¶ms) : Request(methodName, params) { } CodeActionResult::CodeActionResult(const QJsonValue &val) { using ResultArray = QList>; if (val.isArray()) { const QJsonArray array = val.toArray(); ResultArray result; for (const QJsonValue &val : array) { if (val.toObject().value(commandKey).isString()) { const Command command(val); if (command.isValid()) result << command; } else { const CodeAction action(val); if (action.isValid()) result << action; } } emplace(result); return; } emplace(nullptr); } PrepareRenameResult::PrepareRenameResult() : std::variant(nullptr) {} PrepareRenameResult::PrepareRenameResult( const std::variant &val) : std::variant(val) {} PrepareRenameResult::PrepareRenameResult(const PlaceHolderResult &val) : std::variant(val) {} PrepareRenameResult::PrepareRenameResult(const Range &val) : std::variant(val) {} PrepareRenameResult::PrepareRenameResult(const QJsonValue &val) { if (val.isNull()) { emplace(nullptr); } else if (val.isObject()) { const QJsonObject object = val.toObject(); if (object.keys().contains(rangeKey)) emplace(PlaceHolderResult(object)); else emplace(Range(object)); } } std::optional CodeLens::data() const { return contains(dataKey) ? std::make_optional(value(dataKey)) : std::nullopt; } HoverResult::HoverResult(const QJsonValue &value) { if (value.isObject()) emplace(Hover(value.toObject())); else emplace(nullptr); } bool HoverResult::isValid() const { if (auto hover = std::get_if(this)) return hover->isValid(); return true; } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/lsptypes.h0000644000175100017510000005677715154533055017417 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "jsonkeys.h" #include "jsonobject.h" #include "lsputils.h" #include "filepath.h" #include "link.h" #include #include #include #include #include namespace lsp { class LANGUAGESERVERPROTOCOL_EXPORT DocumentUri : public QUrl { public: DocumentUri() = default; using PathMapper = std::function; Utils::FilePath toFilePath(const PathMapper &mapToHostPath) const; static DocumentUri fromProtocol(const QString &uri); static DocumentUri fromFilePath(const Utils::FilePath &file, const PathMapper &mapToServerPath); operator QJsonValue() const { return QJsonValue(toString()); } private: DocumentUri(const QString &other); DocumentUri(const Utils::FilePath &other, const PathMapper &mapToServerPath); friend class LanguageClientValue; }; class LANGUAGESERVERPROTOCOL_EXPORT Position : public JsonObject { public: Position() = default; Position(int line, int character); using JsonObject::JsonObject; // Line position in a document (zero-based). int line() const { return typedValue(lineKey); } void setLine(int line) { insert(lineKey, line); } /* * Character offset on a line in a document (zero-based). Assuming that the line is * represented as a string, the `character` value represents the gap between the * `character` and `character + 1`. * * If the character value is greater than the line length it defaults back to the * line length. */ int character() const { return typedValue(characterKey); } void setCharacter(int character) { insert(characterKey, character); } bool isValid() const override { return contains(lineKey) && contains(characterKey); } }; inline bool operator<(const Position &first, const Position &second) { return first.line() < second.line() || (first.line() == second.line() && first.character() < second.character()); } inline bool operator>(const Position &first, const Position &second) { return second < first; } inline bool operator>=(const Position &first, const Position &second) { return !(first < second); } inline bool operator<=(const Position &first, const Position &second) { return !(first > second); } class LANGUAGESERVERPROTOCOL_EXPORT Range : public JsonObject { public: Range() = default; Range(const Position &start, const Position &end); using JsonObject::JsonObject; // The range's start position. Position start() const { return typedValue(startKey); } void setStart(const Position &start) { insert(startKey, start); } // The range's end position. Position end() const { return typedValue(endKey); } void setEnd(const Position &end) { insert(endKey, end); } bool isEmpty() const { return start() == end(); } bool contains(const Position &pos) const { return start() <= pos && pos <= end(); } bool contains(const Range &other) const; bool overlaps(const Range &range) const; bool isLeftOf(const Range &other) const { return isEmpty() || other.isEmpty() ? end() < other.start() : end() <= other.start(); } bool isValid() const override { return JsonObject::contains(startKey) && JsonObject::contains(endKey); } }; inline bool operator==(const Range &r1, const Range &r2) { return r1.contains(r2) && r2.contains(r1); } inline bool operator!=(const Range &r1, const Range &r2) { return !(r1 == r2); } class LANGUAGESERVERPROTOCOL_EXPORT Location : public JsonObject { public: using JsonObject::JsonObject; DocumentUri uri() const { return DocumentUri::fromProtocol(typedValue(uriKey)); } void setUri(const DocumentUri &uri) { insert(uriKey, uri); } Range range() const { return typedValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } Utils::Link toLink(const DocumentUri::PathMapper &mapToHostPath) const; bool isValid() const override { return contains(uriKey) && contains(rangeKey); } }; enum class DiagnosticSeverity { Error = 1, Warning = 2, Information = 3, Hint = 4 }; class LANGUAGESERVERPROTOCOL_EXPORT Diagnostic : public JsonObject { public: using JsonObject::JsonObject; // The range at which the message applies. Range range() const { return typedValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } // The diagnostic's severity. Can be omitted. If omitted it is up to the // client to interpret diagnostics as error, warning, info or hint. std::optional severity() const; void setSeverity(const DiagnosticSeverity &severity) { insert(severityKey, static_cast(severity)); } void clearSeverity() { remove(severityKey); } // The diagnostic's code, which might appear in the user interface. using Code = std::variant; std::optional code() const; void setCode(const Code &code); void clearCode() { remove(codeKey); } // A human-readable string describing the source of this // diagnostic, e.g. 'typescript' or 'super lint'. std::optional source() const { return optionalValue(sourceKey); } void setSource(const QString &source) { insert(sourceKey, source); } void clearSource() { remove(sourceKey); } // The diagnostic's message. QString message() const { return typedValue(messageKey); } void setMessage(const QString &message) { insert(messageKey, message); } bool isValid() const override { return contains(rangeKey) && contains(messageKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT Command : public JsonObject { public: using JsonObject::JsonObject; // Title of the command, like `save`. QString title() const { return typedValue(titleKey); } void setTitle(const QString &title) { insert(titleKey, title); } void clearTitle() { remove(titleKey); } // The identifier of the actual command handler. QString command() const { return typedValue(commandKey); } void setCommand(const QString &command) { insert(commandKey, command); } void clearCommand() { remove(commandKey); } // Arguments that the command handler should be invoked with. std::optional arguments() const { return typedValue(argumentsKey); } void setArguments(const QJsonArray &arguments) { insert(argumentsKey, arguments); } void clearArguments() { remove(argumentsKey); } bool isValid() const override { return contains(titleKey) && contains(commandKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT TextEdit : public JsonObject { public: using JsonObject::JsonObject; // The range of the text document to be manipulated. To insert // text into a document create a range where start === end. Range range() const { return typedValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } // The string to be inserted. For delete operations use an empty string. QString newText() const { return typedValue(newTextKey); } void setNewText(const QString &text) { insert(newTextKey, text); } bool isValid() const override { return contains(rangeKey) && contains(newTextKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentIdentifier : public JsonObject { public: TextDocumentIdentifier() : TextDocumentIdentifier(DocumentUri()) {} explicit TextDocumentIdentifier(const DocumentUri &uri) { setUri(uri); } using JsonObject::JsonObject; // The text document's URI. DocumentUri uri() const { return DocumentUri::fromProtocol(typedValue(uriKey)); } void setUri(const DocumentUri &uri) { insert(uriKey, uri); } bool isValid() const override { return contains(uriKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT VersionedTextDocumentIdentifier : public TextDocumentIdentifier { public: using TextDocumentIdentifier::TextDocumentIdentifier; /* * The version number of this document. If a versioned text document identifier * is sent from the server to the client and the file is not open in the editor * (the server has not received an open notification before) the server can send * `null` to indicate that the version is known and the content on disk is the * truth (as speced with document content ownership) */ LanguageClientValue version() const { return clientValue(versionKey); } void setVersion(LanguageClientValue version) { insert(versionKey, version); } bool isValid() const override { return TextDocumentIdentifier::isValid() && contains(versionKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentEdit : public JsonObject { public: using JsonObject::JsonObject; // The text document to change. VersionedTextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const VersionedTextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } // The edits to be applied. QList edits() const { return array(editsKey); } void setEdits(const QList edits) { insertArray(editsKey, edits); } bool isValid() const override { return contains(textDocumentKey) && contains(editsKey); } }; class CreateFileOptions : public JsonObject { public: using JsonObject::JsonObject; std::optional overwrite() const { return optionalValue(overwriteKey); } void setOverwrite(bool overwrite) { insert(overwriteKey, overwrite); } void clearOverwrite() { remove(overwriteKey); } std::optional ignoreIfExists() const { return optionalValue(ignoreIfExistsKey); } void setIgnoreIfExists(bool ignoreIfExists) { insert(ignoreIfExistsKey, ignoreIfExists); } void clearIgnoreIfExists() { remove(ignoreIfExistsKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT CreateFileOperation : public JsonObject { public: using JsonObject::JsonObject; CreateFileOperation(); DocumentUri uri() const { return DocumentUri::fromProtocol(typedValue(uriKey)); } void setUri(const DocumentUri &uri) { insert(uriKey, uri); } std::optional options() const { return optionalValue(optionsKey); } void setOptions(const CreateFileOptions &options) { insert(optionsKey, options); } void clearOptions() { remove(optionsKey); } QString message(const DocumentUri::PathMapper &mapToHostPath) const; bool isValid() const override; }; class LANGUAGESERVERPROTOCOL_EXPORT RenameFileOperation : public JsonObject { public: using JsonObject::JsonObject; RenameFileOperation(); DocumentUri oldUri() const { return DocumentUri::fromProtocol(typedValue(oldUriKey)); } void setOldUri(const DocumentUri &oldUri) { insert(oldUriKey, oldUri); } DocumentUri newUri() const { return DocumentUri::fromProtocol(typedValue(newUriKey)); } void setNewUri(const DocumentUri &newUri) { insert(newUriKey, newUri); } std::optional options() const { return optionalValue(optionsKey); } void setOptions(const CreateFileOptions &options) { insert(optionsKey, options); } void clearOptions() { remove(optionsKey); } QString message(const DocumentUri::PathMapper &mapToHostPath) const; bool isValid() const override; }; class DeleteFileOptions : public JsonObject { public: using JsonObject::JsonObject; std::optional recursive() const { return optionalValue(recursiveKey); } void setRecursive(bool recursive) { insert(recursiveKey, recursive); } void clearRecursive() { remove(recursiveKey); } std::optional ignoreIfNotExists() const { return optionalValue(ignoreIfNotExistsKey); } void setIgnoreIfNotExists(bool ignoreIfNotExists) { insert(ignoreIfNotExistsKey, ignoreIfNotExists); } void clearIgnoreIfNotExists() { remove(ignoreIfNotExistsKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DeleteFileOperation : public JsonObject { public: using JsonObject::JsonObject; DeleteFileOperation(); DocumentUri uri() const { return DocumentUri::fromProtocol(typedValue(uriKey)); } void setUri(const DocumentUri &uri) { insert(uriKey, uri); } std::optional options() const { return optionalValue(optionsKey); } void setOptions(const DeleteFileOptions &options) { insert(optionsKey, options); } void clearOptions() { remove(optionsKey); } QString message(const DocumentUri::PathMapper &mapToHostPath) const; bool isValid() const override; }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentChange : public std::variant { public: using variant::variant; DocumentChange(const QJsonValue &value); bool isValid() const; operator const QJsonValue() const; }; class LANGUAGESERVERPROTOCOL_EXPORT WorkspaceEdit : public JsonObject { public: using JsonObject::JsonObject; // Holds changes to existing resources. using Changes = QMap>; std::optional changes() const; void setChanges(const Changes &changes); /* * Depending on the client capability * `workspace.workspaceEdit.resourceOperations` document changes are either * an array of `TextDocumentEdit`s to express changes to n different text * documents where each text document edit addresses a specific version of * a text document. Or it can contain above `TextDocumentEdit`s mixed with * create, rename and delete file / folder operations. * * Whether a client supports versioned document edits is expressed via * `workspace.workspaceEdit.documentChanges` client capability. * * If a client neither supports `documentChanges` nor * `workspace.workspaceEdit.resourceOperations` then only plain `TextEdit`s * using the `changes` property are supported. */ std::optional> documentChanges() const { return optionalArray(documentChangesKey); } void setDocumentChanges(const QList &changes) { insertArray(documentChangesKey, changes); } }; LANGUAGESERVERPROTOCOL_EXPORT QMap languageIds(); class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentItem : public JsonObject { public: using JsonObject::JsonObject; // The text document's URI. DocumentUri uri() const { return DocumentUri::fromProtocol(typedValue(uriKey)); } void setUri(const DocumentUri &uri) { insert(uriKey, uri); } // The text document's language identifier. QString languageId() const { return typedValue(languageIdKey); } void setLanguageId(const QString &id) { insert(languageIdKey, id); } // The version number of this document (it will increase after each change, including undo/redo int version() const { return typedValue(versionKey); } void setVersion(int version) { insert(versionKey, version); } // The content of the opened text document. QString text() const { return typedValue(textKey); } void setText(const QString &text) { insert(textKey, text); } bool isValid() const override; }; class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentPositionParams : public JsonObject { public: TextDocumentPositionParams(); TextDocumentPositionParams(const TextDocumentIdentifier &document, const Position &position); using JsonObject::JsonObject; // The text document. TextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const TextDocumentIdentifier &id) { insert(textDocumentKey, id); } // The position inside the text document. Position position() const { return typedValue(positionKey); } void setPosition(const Position &position) { insert(positionKey, position); } bool isValid() const override { return contains(textDocumentKey) && contains(positionKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentFilter : public JsonObject { public: using JsonObject::JsonObject; // A language id, like `typescript`. std::optional language() const { return optionalValue(languageKey); } void setLanguage(const QString &language) { insert(languageKey, language); } void clearLanguage() { remove(languageKey); } // A Uri [scheme](#Uri.scheme), like `file` or `untitled`. std::optional scheme() const { return optionalValue(schemeKey); } void setScheme(const QString &scheme) { insert(schemeKey, scheme); } void clearScheme() { remove(schemeKey); } /** * A glob pattern, like `*.{ts,js}`. * * Glob patterns can have the following syntax: * - `*` to match one or more characters in a path segment * - `?` to match on one character in a path segment * - `**` to match any number of path segments, including none * - `{}` to group sub patterns into an OR expression. (e.g. `*.{ts,js}` * matches all TypeScript and JavaScript files) * - `[]` to declare a range of characters to match in a path segment * (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) * - `[!...]` to negate a range of characters to match in a path segment * (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but * not `example.0`) */ std::optional pattern() const { return optionalValue(patternKey); } void setPattern(const QString &pattern) { insert(patternKey, pattern); } void clearPattern() { remove(patternKey); } bool applies(const Utils::FilePath &fileName) const; }; class LANGUAGESERVERPROTOCOL_EXPORT MarkupKind { public: enum Value { plaintext, markdown }; MarkupKind() = default; MarkupKind(const Value value) : m_value(value) {} explicit MarkupKind(const QJsonValue &value); operator QJsonValue() const; Value value() const { return m_value; } bool operator==(const Value &value) const { return m_value == value; } bool isValid() const { return true; } private: Value m_value = plaintext; }; class LANGUAGESERVERPROTOCOL_EXPORT MarkupContent : public JsonObject { public: using JsonObject::JsonObject; // The type of the Markup MarkupKind kind() const { return MarkupKind(value(kindKey)); } void setKind(MarkupKind kind) { insert(kindKey, kind); } Qt::TextFormat textFormat() const { return kind() == MarkupKind::markdown ? Qt::MarkdownText : Qt::PlainText; } // The content itself QString content() const { return typedValue(contentKey); } void setContent(const QString &content) { insert(contentKey, content); } bool isValid() const override { return contains(kindKey) && contains(contentKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT MarkupOrString : public std::variant { public: MarkupOrString() = default; explicit MarkupOrString(const std::variant &val); explicit MarkupOrString(const QString &val); explicit MarkupOrString(const MarkupContent &val); MarkupOrString(const QJsonValue &val); bool isValid() const { return true; } QJsonValue toJson() const; }; class LANGUAGESERVERPROTOCOL_EXPORT WorkSpaceFolder : public JsonObject { public: WorkSpaceFolder() = default; WorkSpaceFolder(const DocumentUri &uri, const QString &name); using JsonObject::JsonObject; // The associated URI for this workspace folder. DocumentUri uri() const { return DocumentUri::fromProtocol(typedValue(uriKey)); } void setUri(const DocumentUri &uri) { insert(uriKey, uri); } // The name of the workspace folder. Defaults to the uri's basename. QString name() const { return typedValue(nameKey); } void setName(const QString &name) { insert(nameKey, name); } bool isValid() const override { return contains(uriKey) && contains(nameKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT SymbolInformation : public JsonObject { public: using JsonObject::JsonObject; QString name() const { return typedValue(nameKey); } void setName(const QString &name) { insert(nameKey, name); } int kind() const { return typedValue(kindKey); } void setKind(int kind) { insert(kindKey, kind); } std::optional deprecated() const { return optionalValue(deprecatedKey); } void setDeprecated(bool deprecated) { insert(deprecatedKey, deprecated); } void clearDeprecated() { remove(deprecatedKey); } Location location() const { return typedValue(locationKey); } void setLocation(const Location &location) { insert(locationKey, location); } std::optional containerName() const { return optionalValue(containerNameKey); } void setContainerName(const QString &containerName) { insert(containerNameKey, containerName); } void clearContainerName() { remove(containerNameKey); } bool isValid() const override { return contains(nameKey) && contains(kindKey) && contains(locationKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DocumentSymbol : public JsonObject { public: using JsonObject::JsonObject; QString name() const { return typedValue(nameKey); } void setName(const QString &name) { insert(nameKey, name); } std::optional detail() const { return optionalValue(detailKey); } void setDetail(const QString &detail) { insert(detailKey, detail); } void clearDetail() { remove(detailKey); } int kind() const { return typedValue(kindKey); } void setKind(int kind) { insert(kindKey, kind); } std::optional deprecated() const { return optionalValue(deprecatedKey); } void setDeprecated(bool deprecated) { insert(deprecatedKey, deprecated); } void clearDeprecated() { remove(deprecatedKey); } Range range() const { return typedValue(rangeKey); } void setRange(Range range) { insert(rangeKey, range); } Range selectionRange() const { return typedValue(selectionRangeKey); } void setSelectionRange(Range selectionRange) { insert(selectionRangeKey, selectionRange); } std::optional> children() const { return optionalArray(childrenKey); } void setChildren(QList children) { insertArray(childrenKey, children); } void clearChildren() { remove(childrenKey); } }; enum class SymbolKind { File = 1, FirstSymbolKind = File, Module = 2, Namespace = 3, Package = 4, Class = 5, Method = 6, Property = 7, Field = 8, Constructor = 9, Enum = 10, Interface = 11, Function = 12, Variable = 13, Constant = 14, String = 15, Number = 16, Boolean = 17, Array = 18, Object = 19, Key = 20, Null = 21, EnumMember = 22, Struct = 23, Event = 24, Operator = 25, TypeParameter = 26, LastSymbolKind = TypeParameter, }; namespace CompletionItemKind { enum Kind { Text = 1, Method = 2, Function = 3, Constructor = 4, Field = 5, Variable = 6, Class = 7, Interface = 8, Module = 9, Property = 10, Unit = 11, Value = 12, Enum = 13, Keyword = 14, Snippet = 15, Color = 16, File = 17, Reference = 18, Folder = 19, EnumMember = 20, Constant = 21, Struct = 22, Event = 23, Operator = 24, TypeParameter = 25 }; } // namespace CompletionItemKind } // namespace LanguageClient qbs-src-3.2.0/src/shared/lsp/semantictokens.h0000644000175100017510000001624615154533055020546 0ustar runnerrunner// Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "jsonkeys.h" #include "jsonobject.h" #include "jsonrpcmessages.h" #include "languageserverprotocol_global.h" #include "lsptypes.h" namespace lsp { struct LANGUAGESERVERPROTOCOL_EXPORT SemanticToken { int deltaLine = 0; int deltaStart = 0; int length = 0; int tokenIndex = 0; int tokenType = 0; int rawTokenModifiers = 0; int tokenModifiers = 0; }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensLegend : public JsonObject { public: using JsonObject::JsonObject; // The token types a server uses. QList tokenTypes() const { return array(tokenTypesKey); } void setTokenTypes(const QList &tokenTypes) { insertArray(tokenTypesKey, tokenTypes); } // The token modifiers a server uses. QList tokenModifiers() const { return array(tokenModifiersKey); } void setTokenModifiers(const QList &value) { insertArray(tokenModifiersKey, value); } bool isValid() const override; }; enum SemanticTokenTypes { namespaceToken, typeToken, classToken, enumToken, interfaceToken, structToken, typeParameterToken, parameterToken, variableToken, propertyToken, enumMemberToken, eventToken, functionToken, methodToken, macroToken, keywordToken, modifierToken, commentToken, stringToken, numberToken, regexpToken, operatorToken }; enum SemanticTokenModifiers { declarationModifier = 0x1, definitionModifier = 0x2, readonlyModifier = 0x4, staticModifier = 0x8, deprecatedModifier = 0x10, abstractModifier = 0x20, asyncModifier = 0x40, modificationModifier = 0x80, documentationModifier = 0x100, defaultLibraryModifier = 0x200 }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensParams : public JsonObject { public: using JsonObject::JsonObject; TextDocumentIdentifier textDocument() const { return typedValue(textDocumentKey); } void setTextDocument(const TextDocumentIdentifier &textDocument) { insert(textDocumentKey, textDocument); } bool isValid() const override { return contains(textDocumentKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensDeltaParams : public SemanticTokensParams { public: using SemanticTokensParams::SemanticTokensParams; QString previousResultId() const { return typedValue(previousResultIdKey); } void setPreviousResultId(const QString &previousResultId) { insert(previousResultIdKey, previousResultId); } bool isValid() const override; }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensRangeParams : public SemanticTokensParams { public: using SemanticTokensParams::SemanticTokensParams; Range range() const { return typedValue(rangeKey); } void setRange(const Range &range) { insert(rangeKey, range); } bool isValid() const override; }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokens : public JsonObject { public: using JsonObject::JsonObject; /** * An optional result id. If provided and clients support delta updating * the client will include the result id in the next semantic token request. * A server can then instead of computing all semantic tokens again simply * send a delta. */ std::optional resultId() const { return optionalValue(resultIdKey); } void setResultId(const QString &resultId) { insert(resultIdKey, resultId); } void clearResultId() { remove(resultIdKey); } /// The actual tokens. QList data() const { return array(dataKey); } void setData(const QList &value) { insertArray(dataKey, value); } bool isValid() const override { return contains(dataKey); } QList toTokens(const QList &tokenTypes, const QList &tokenModifiers) const; static QMap defaultTokenTypesMap(); static QMap defaultTokenModifiersMap(); }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensResult : public std::variant { public: using variant::variant; explicit SemanticTokensResult(const QJsonValue &value); }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensFullRequest : public Request { public: explicit SemanticTokensFullRequest(const SemanticTokensParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/semanticTokens/full"; }; class SemanticTokensEdit : public JsonObject { public: using JsonObject::JsonObject; int start() const { return typedValue(startKey); } void setStart(int start) { insert(startKey, start); } int deleteCount() const { return typedValue(deleteCountKey); } void setDeleteCount(int deleteCount) { insert(deleteCountKey, deleteCount); } std::optional> data() const { return optionalArray(dataKey); } void setData(const QList &value) { insertArray(dataKey, value); } void clearData() { remove(dataKey); } int dataSize() const { return contains(dataKey) ? value(dataKey).toArray().size() : 0; } bool isValid() const override { return contains(dataKey) && contains(deleteCountKey); } }; class SemanticTokensDelta : public JsonObject { public: using JsonObject::JsonObject; QString resultId() const { return typedValue(resultIdKey); } void setResultId(const QString &resultId) { insert(resultIdKey, resultId); } QList edits() const { return array(editsKey); } void setEdits(const QList &edits) { insertArray(editsKey, edits); } bool isValid() const override { return contains(resultIdKey) && contains(editsKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensDeltaResult : public std::variant { public: using variant::variant; explicit SemanticTokensDeltaResult(const QJsonValue &value); }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensFullDeltaRequest : public Request { public: explicit SemanticTokensFullDeltaRequest(const SemanticTokensDeltaParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/semanticTokens/full/delta"; }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensRangeRequest : public Request { public: explicit SemanticTokensRangeRequest(const SemanticTokensRangeParams ¶ms); using Request::Request; constexpr static const char methodName[] = "textDocument/semanticTokens/range"; }; class LANGUAGESERVERPROTOCOL_EXPORT SemanticTokensRefreshRequest : public Request { public: explicit SemanticTokensRefreshRequest(); using Request::Request; constexpr static const char methodName[] = "workspace/semanticTokens/refresh"; }; } // namespace lsp qbs-src-3.2.0/src/shared/lsp/link.cpp0000644000175100017510000000221215154533055016773 0ustar runnerrunner// Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "link.h" #include "textutils.h" namespace lsp::Utils { /*! Returns the Link to \a filePath. If \a canContainLineNumber is true the line number, and column number components are extracted from the \a filePath's \c path() and the found \a postfix is set. The following patterns are supported: \c {filepath.txt:19}, \c{filepath.txt:19:12}, \c {filepath.txt+19}, \c {filepath.txt+19+12}, and \c {filepath.txt(19)}. */ Link Link::fromString(const QString &filePathWithNumbers, bool canContainLineNumber) { Link link; if (!canContainLineNumber) { link.targetFilePath = FilePath::fromUserInput(filePathWithNumbers); } else { int postfixPos = -1; const Text::Position pos = Text::Position::fromFileName(filePathWithNumbers, postfixPos); link.targetFilePath = FilePath::fromUserInput(filePathWithNumbers.left(postfixPos)); link.targetLine = pos.line; link.targetColumn = pos.column; } return link; } } // namespace lsp::Utils qbs-src-3.2.0/src/shared/lsp/progresssupport.h0000644000175100017510000001220415154533055021006 0ustar runnerrunner// Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "jsonrpcmessages.h" #include #include namespace lsp { class LANGUAGESERVERPROTOCOL_EXPORT ProgressToken : public std::variant { public: using variant::variant; explicit ProgressToken(const QJsonValue &value); bool isValid() { return true; } operator QJsonValue() const; }; class LANGUAGESERVERPROTOCOL_EXPORT WorkDoneProgressReport : public JsonObject { public: using JsonObject::JsonObject; /** * Controls if a cancel button should be shown to allow the user to cancel the * long running operation. * Clients that don't support cancellation can ignore the setting. */ std::optional cancellable() const { return optionalValue(cancellableKey); } void setCancellable(bool cancellable) { insert(cancellableKey, cancellable); } void clearCancellable() { remove(cancellableKey); } /** * Optional, more detailed associated progress message. Contains * complementary information to the `title`. * * Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". * If unset, the previous progress message (if any) is still valid. */ std::optional message() const { return optionalValue(messageKey); } void setMessage(const QString &message) { insert(messageKey, message); } void clearMessage() { remove(messageKey); } /** * Optional progress percentage to display (value 100 is considered 100%). * If not provided infinite progress is assumed and clients are allowed * to ignore the `percentage` value in subsequent in report notifications. * * The value should be steadily rising. Clients are free to ignore values * that are not following this rule. */ // Allthough percentage is defined as an uint by the protocol some server // return a double here. Be less strict and also use a double. // CAUTION: the range is still 0 - 100 and not 0 - 1 std::optional percentage() const { return optionalValue(percentageKey); } void setPercentage(double percentage) { insert(percentageKey, percentage); } void clearPercentage() { remove(percentageKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT WorkDoneProgressBegin : public WorkDoneProgressReport { public: using WorkDoneProgressReport::WorkDoneProgressReport; /** * Mandatory title of the progress operation. Used to briefly inform about * the kind of operation being performed. * * Examples: "Indexing" or "Linking dependencies". */ QString title() const { return typedValue(titleKey); } void setTitle(const QString &title) { insert(titleKey, title); } }; class LANGUAGESERVERPROTOCOL_EXPORT WorkDoneProgressEnd : public JsonObject { public: using JsonObject::JsonObject; /** * Optional, a final message indicating to for example indicate the outcome * of the operation. */ std::optional message() const { return optionalValue(messageKey); } void setMessage(const QString &message) { insert(messageKey, message); } void clearMessage() { remove(messageKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ProgressParams : public JsonObject { public: using JsonObject::JsonObject; ProgressToken token() const { return ProgressToken(JsonObject::value(tokenKey)); } void setToken(const ProgressToken &token) { insert(tokenKey, token); } using ProgressType = std::variant; ProgressType value() const; void setValue(const ProgressType &value); bool isValid() const override { return contains(tokenKey) && contains(valueKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ProgressNotification : public Notification { public: ProgressNotification(const ProgressParams ¶ms); using Notification::Notification; constexpr static const char methodName[] = "$/progress"; }; class LANGUAGESERVERPROTOCOL_EXPORT ProgressTokenParams : public JsonObject { public: using JsonObject::JsonObject; // The token to be used to report progress. ProgressToken token() const { return typedValue(tokenKey); } void setToken(const ProgressToken &token) { insert(tokenKey, token); } }; using WorkDoneProgressCreateParams = ProgressTokenParams; class LANGUAGESERVERPROTOCOL_EXPORT WorkDoneProgressCreateRequest : public Request { public: WorkDoneProgressCreateRequest(const WorkDoneProgressCreateParams ¶ms); using Request::Request; constexpr static const char methodName[] = "window/workDoneProgress/create"; }; using WorkDoneProgressCancelParams = ProgressTokenParams; class LANGUAGESERVERPROTOCOL_EXPORT WorkDoneProgressCancelRequest : public Request { public: using Request::Request; constexpr static const char methodName[] = "window/workDoneProgress/cancel"; }; } // namespace lsp qbs-src-3.2.0/src/shared/lsp/algorithm.h0000644000175100017510000013544515154533055017510 0ustar runnerrunner// Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "predicates.h" #include // for Q_REQUIRED_RESULT #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace lsp::Utils { ///////////////////////// // anyOf ///////////////////////// template bool anyOf(const T &container, F predicate); template bool anyOf(const T &container, R (S::*predicate)() const); template bool anyOf(const T &container, R S::*member); ///////////////////////// // count ///////////////////////// template int count(const T &container, F predicate); ///////////////////////// // allOf ///////////////////////// template bool allOf(const T &container, F predicate); ///////////////////////// // erase ///////////////////////// template void erase(T &container, F predicate); template bool eraseOne(T &container, F predicate); ///////////////////////// // contains ///////////////////////// template bool contains(const T &container, F function); template bool contains(const T &container, R (S::*function)() const); template bool contains(const C &container, R S::*member); ///////////////////////// // findOr ///////////////////////// template Q_REQUIRED_RESULT typename C::value_type findOr(const C &container, typename C::value_type other, F function); template Q_REQUIRED_RESULT typename T::value_type findOr(const T &container, typename T::value_type other, R (S::*function)() const); template Q_REQUIRED_RESULT typename T::value_type findOr(const T &container, typename T::value_type other, R S::*member); ///////////////////////// // findOrDefault ///////////////////////// template Q_REQUIRED_RESULT typename std::enable_if_t::value, typename C::value_type> findOrDefault(const C &container, F function); template Q_REQUIRED_RESULT typename std::enable_if_t::value, typename C::value_type> findOrDefault(const C &container, R (S::*function)() const); template Q_REQUIRED_RESULT typename std::enable_if_t::value, typename C::value_type> findOrDefault(const C &container, R S::*member); ///////////////////////// // indexOf ///////////////////////// template Q_REQUIRED_RESULT int indexOf(const C &container, F function); ///////////////////////// // maxElementOr ///////////////////////// template typename T::value_type maxElementOr(const T &container, typename T::value_type other); ///////////////////////// // filtered ///////////////////////// template Q_REQUIRED_RESULT C filtered(const C &container, F predicate); template Q_REQUIRED_RESULT C filtered(const C &container, R (S::*predicate)() const); ///////////////////////// // partition ///////////////////////// // Recommended usage: // C hit; // C miss; // std::tie(hit, miss) = Utils::partition(container, predicate); template Q_REQUIRED_RESULT std::tuple partition(const C &container, F predicate); template Q_REQUIRED_RESULT std::tuple partition(const C &container, R (S::*predicate)() const); ///////////////////////// // filteredUnique ///////////////////////// template Q_REQUIRED_RESULT C filteredUnique(const C &container); ///////////////////////// // qobject_container_cast ///////////////////////// template class Container, typename Base> Container qobject_container_cast(const Container &container); ///////////////////////// // static_container_cast ///////////////////////// template class Container, typename Base> Container static_container_cast(const Container &container); ///////////////////////// // sort ///////////////////////// template inline void sort(Container &container); template inline void sort(Container &container, Predicate p); template inline void sort(Container &container, R S::*member); template inline void sort(Container &container, R (S::*function)() const); ///////////////////////// // reverseForeach ///////////////////////// template inline void reverseForeach(const Container &c, const Op &operation); ///////////////////////// // toReferences ///////////////////////// template class ResultContainer, typename SourceContainer> auto toReferences(SourceContainer &sources); template auto toReferences(SourceContainer &sources); ///////////////////////// // toConstReferences ///////////////////////// template class ResultContainer, typename SourceContainer> auto toConstReferences(const SourceContainer &sources); template auto toConstReferences(const SourceContainer &sources); ///////////////////////// // take ///////////////////////// template Q_REQUIRED_RESULT std::optional take(C &container, P predicate); template Q_REQUIRED_RESULT decltype(auto) take(C &container, R S::*member); template Q_REQUIRED_RESULT decltype(auto) take(C &container, R (S::*function)() const); ///////////////////////// // setUnionMerge ///////////////////////// // Works like std::set_union but provides a merge function for items that match // !(a > b) && !(b > a) which normally means that there is an "equal" match. // It uses iterators to support move_iterators. template OutputIt setUnionMerge(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt d_first, Merge merge, Compare comp); template OutputIt setUnionMerge( InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt d_first, Merge merge); template OutputContainer setUnionMerge(InputContainer1 &&input1, InputContainer2 &&input2, Merge merge, Compare comp); template OutputContainer setUnionMerge(InputContainer1 &&input1, InputContainer2 &&input2, Merge merge); ///////////////////////// // setUnion ///////////////////////// template OutputIterator set_union(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp); template OutputIterator set_union(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result); ///////////////////////// // transform ///////////////////////// // function without result type deduction: template // function type Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, F function); // function with result type deduction: template< template class C, // result container type typename SC, // input container type typename F, // function type typename Value = typename std::decay_t::value_type, typename Result = std::decay_t>, typename ResultContainer = C> Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, F function); #ifdef Q_CC_CLANG // "Matching of template template-arguments excludes compatible templates" // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0522r0.html (P0522R0) // in C++17 makes the above match e.g. C=std::vector even though that takes two // template parameters. Unfortunately the following one matches too, and there is no additional // partial ordering rule, resulting in an ambiguous call for this previously valid code. // GCC and MSVC ignore that issue and follow the standard to the letter, but Clang only // enables the new behavior when given -frelaxed-template-template-args . // To avoid requiring everyone using this header to enable that feature, keep the old implementation // for Clang. template< template class C, // result container type typename SC, // input container type typename F, // function type typename Value = typename std::decay_t::value_type, typename Result = std::decay_t>, typename ResultContainer = C>> Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, F function); #endif // member function without result type deduction: template class C, // result container type typename SC, // input container type typename R, typename S> Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, R (S::*p)() const); // member function with result type deduction: template Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, R (S::*p)() const); // member without result type deduction: template Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, R S::*p); // member with result type deduction: template class C, // result container typename SC, // input container typename R, typename S> Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, R S::*p); // same container types for input and output, const input // function: template class C, // container type typename F, // function type typename... CArgs> // Arguments to SC Q_REQUIRED_RESULT decltype(auto) transform(const C &container, F function); // same container types for input and output, const input // member function: template class C, // container type typename R, typename S, typename... CArgs> // Arguments to SC Q_REQUIRED_RESULT decltype(auto) transform(const C &container, R (S::*p)() const); // same container types for input and output, const input // members: template class C, // container typename R, typename S, typename... CArgs> // Arguments to SC Q_REQUIRED_RESULT decltype(auto) transform(const C &container, R S::*p); // same container types for input and output, non-const input // function: template class C, // container type typename F, // function type typename... CArgs> // Arguments to SC Q_REQUIRED_RESULT decltype(auto) transform(C &container, F function); // same container types for input and output, non-const input // member function: template class C, // container type typename R, typename S, typename... CArgs> // Arguments to SC Q_REQUIRED_RESULT decltype(auto) transform(C &container, R (S::*p)() const); // same container types for input and output, non-const input // members: template class C, // container typename R, typename S, typename... CArgs> // Arguments to SC Q_REQUIRED_RESULT decltype(auto) transform(C &container, R S::*p); ///////////////////////////////////////////////////////////////////////////// //////// Implementations ////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ////////////////// // anyOf ///////////////// template bool anyOf(const T &container, F predicate) { return std::any_of(std::begin(container), std::end(container), predicate); } // anyOf taking a member function pointer template bool anyOf(const T &container, R (S::*predicate)() const) { return std::any_of(std::begin(container), std::end(container), std::mem_fn(predicate)); } // anyOf taking a member pointer template bool anyOf(const T &container, R S::*member) { return std::any_of(std::begin(container), std::end(container), std::mem_fn(member)); } ////////////////// // count ///////////////// template int count(const T &container, F predicate) { return std::count_if(std::begin(container), std::end(container), predicate); } ////////////////// // allOf ///////////////// template bool allOf(const T &container, F predicate) { return std::all_of(std::begin(container), std::end(container), predicate); } // allOf taking a member function pointer template bool allOf(const T &container, R (S::*predicate)() const) { return std::all_of(std::begin(container), std::end(container), std::mem_fn(predicate)); } // allOf taking a member pointer template bool allOf(const T &container, R S::*member) { return std::all_of(std::begin(container), std::end(container), std::mem_fn(member)); } ////////////////// // erase ///////////////// template void erase(T &container, F predicate) { container.erase(std::remove_if(std::begin(container), std::end(container), predicate), std::end(container)); } template bool eraseOne(T &container, F predicate) { const auto it = std::find_if(std::begin(container), std::end(container), predicate); if (it == std::end(container)) return false; container.erase(it); return true; } ////////////////// // contains ///////////////// template bool contains(const T &container, F function) { return anyOf(container, function); } template bool contains(const T &container, R (S::*function)() const) { return anyOf(container, function); } template bool contains(const C &container, R S::*member) { return anyOf(container, std::mem_fn(member)); } ////////////////// // findOr ///////////////// template Q_REQUIRED_RESULT typename C::value_type findOr(const C &container, typename C::value_type other, F function) { typename C::const_iterator begin = std::begin(container); typename C::const_iterator end = std::end(container); typename C::const_iterator it = std::find_if(begin, end, function); return it == end ? other : *it; } template Q_REQUIRED_RESULT typename T::value_type findOr(const T &container, typename T::value_type other, R (S::*function)() const) { return findOr(container, other, std::mem_fn(function)); } template Q_REQUIRED_RESULT typename T::value_type findOr(const T &container, typename T::value_type other, R S::*member) { return findOr(container, other, std::mem_fn(member)); } ////////////////// // findOrDefault ////////////////// // Default implementation: template Q_REQUIRED_RESULT typename std::enable_if_t::value, typename C::value_type> findOrDefault(const C &container, F function) { return findOr(container, typename C::value_type(), function); } template Q_REQUIRED_RESULT typename std::enable_if_t::value, typename C::value_type> findOrDefault(const C &container, R (S::*function)() const) { return findOr(container, typename C::value_type(), std::mem_fn(function)); } template Q_REQUIRED_RESULT typename std::enable_if_t::value, typename C::value_type> findOrDefault(const C &container, R S::*member) { return findOr(container, typename C::value_type(), std::mem_fn(member)); } ////////////////// // index of: ////////////////// template Q_REQUIRED_RESULT int indexOf(const C& container, F function) { typename C::const_iterator begin = std::begin(container); typename C::const_iterator end = std::end(container); typename C::const_iterator it = std::find_if(begin, end, function); return it == end ? -1 : std::distance(begin, it); } ////////////////// // max element ////////////////// template typename T::value_type maxElementOr(const T &container, typename T::value_type other) { typename T::const_iterator begin = std::begin(container); typename T::const_iterator end = std::end(container); typename T::const_iterator it = std::max_element(begin, end); if (it == end) return other; return *it; } ////////////////// // transform ///////////////// namespace { ///////////////// // helper code for transform to use back_inserter and thus push_back for everything // and insert for QSet<> // // SetInsertIterator, straight from the standard for insert_iterator // just without the additional parameter to insert template class SetInsertIterator { protected: Container *container; public: using iterator_category = std::output_iterator_tag; using container_type = Container; explicit SetInsertIterator(Container &x) : container(&x) {} SetInsertIterator &operator=(const typename Container::value_type &value) { container->insert(value); return *this; } SetInsertIterator &operator=(typename Container::value_type &&value) { container->insert(std::move(value)); return *this; } SetInsertIterator &operator*() { return *this; } SetInsertIterator &operator++() { return *this; } SetInsertIterator operator++(int) { return *this; } }; // for QMap / QHash, inserting a std::pair / QPair template class MapInsertIterator { protected: Container *container; public: using iterator_category = std::output_iterator_tag; using container_type = Container; explicit MapInsertIterator(Container &x) : container(&x) {} MapInsertIterator &operator=( const std::pair &value) { container->insert(value.first, value.second); return *this; } MapInsertIterator &operator=( const QPair &value) { container->insert(value.first, value.second); return *this; } MapInsertIterator &operator*() { return *this; } MapInsertIterator &operator++() { return *this; } MapInsertIterator operator++(int) { return *this; } }; // because Qt container are not implementing the standard interface we need // this helper functions for generic code template void append(QList *container, QList &&input) { container->append(std::move(input)); } template void append(QList *container, const QList &input) { container->append(input); } template void append(Container *container, Container &&input) { container->insert(container->end(), std::make_move_iterator(input.begin()), std::make_move_iterator(input.end())); } template void append(Container *container, const Container &input) { container->insert(container->end(), input.begin(), input.end()); } // BackInsertIterator behaves like std::back_insert_iterator except is adds the back insertion for // container of the same type template class BackInsertIterator { public: using iterator_category = std::output_iterator_tag; using value_type = void; using difference_type = ptrdiff_t; using pointer = void; using reference = void; using container_type = Container; explicit constexpr BackInsertIterator(Container &container) : m_container(std::addressof(container)) {} constexpr BackInsertIterator &operator=(const typename Container::value_type &value) { m_container->push_back(value); return *this; } constexpr BackInsertIterator &operator=(typename Container::value_type &&value) { m_container->push_back(std::move(value)); return *this; } constexpr BackInsertIterator &operator=(const Container &container) { append(m_container, container); return *this; } constexpr BackInsertIterator &operator=(Container &&container) { append(m_container, container); return *this; } [[nodiscard]] constexpr BackInsertIterator &operator*() { return *this; } constexpr BackInsertIterator &operator++() { return *this; } constexpr BackInsertIterator operator++(int) { return *this; } private: Container *m_container; }; // inserter helper function, returns a BackInsertIterator for most containers // and is overloaded for QSet<> and other containers without push_back, returning custom inserters template inline BackInsertIterator inserter(Container &container) { return BackInsertIterator(container); } template inline SetInsertIterator> inserter(QSet &container) { return SetInsertIterator>(container); } template inline SetInsertIterator> inserter(std::set &container) { return SetInsertIterator>(container); } template inline SetInsertIterator> inserter(std::unordered_set &container) { return SetInsertIterator>(container); } template inline SetInsertIterator> inserter(std::map &container) { return SetInsertIterator>(container); } template inline SetInsertIterator> inserter(std::unordered_map &container) { return SetInsertIterator>(container); } template inline MapInsertIterator> inserter(QMap &container) { return MapInsertIterator>(container); } template inline MapInsertIterator> inserter(QHash &container) { return MapInsertIterator>(container); } // Helper code for container.reserve that makes it possible to effectively disable it for // specific cases // default: do reserve // Template arguments are more specific than the second version below, so this is tried first template class C, typename... CArgs, typename = decltype(&C::reserve)> void reserve(C &c, typename C::size_type s) { c.reserve(s); } // containers that don't have reserve() template void reserve(C &, typename C::size_type) { } } // anonymous // -------------------------------------------------------------------- // Different containers for input and output: // -------------------------------------------------------------------- // different container types for input and output, e.g. transforming a QList into a QSet // function without result type deduction: template // function type Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, F function) { ResultContainer result; reserve(result, typename ResultContainer::size_type(container.size())); std::transform(std::begin(container), std::end(container), inserter(result), function); return result; } // function with result type deduction: template class C, // result container type typename SC, // input container type typename F, // function type typename Value, typename Result, typename ResultContainer> Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, F function) { return transform(std::forward(container), function); } #ifdef Q_CC_CLANG template class C, // result container type typename SC, // input container type typename F, // function type typename Value, typename Result, typename ResultContainer> Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, F function) { return transform(std::forward(container), function); } #endif // member function without result type deduction: template class C, // result container type typename SC, // input container type typename R, typename S> Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, R (S::*p)() const) { return transform(std::forward(container), std::mem_fn(p)); } // member function with result type deduction: template Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, R (S::*p)() const) { return transform(std::forward(container), std::mem_fn(p)); } // member without result type deduction: template Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, R S::*p) { return transform(std::forward(container), std::mem_fn(p)); } // member with result type deduction: template class C, // result container typename SC, // input container typename R, typename S> Q_REQUIRED_RESULT decltype(auto) transform(SC &&container, R S::*p) { return transform(std::forward(container), std::mem_fn(p)); } // same container types for input and output, const input // function: template class C, // container type typename F, // function type typename... CArgs> // Arguments to SC Q_REQUIRED_RESULT decltype(auto) transform(const C &container, F function) { return transform &>(container, function); } // member function: template class C, // container type typename R, typename S, typename... CArgs> // Arguments to SC Q_REQUIRED_RESULT decltype(auto) transform(const C &container, R (S::*p)() const) { return transform &>(container, std::mem_fn(p)); } // members: template class C, // container typename R, typename S, typename... CArgs> // Arguments to SC Q_REQUIRED_RESULT decltype(auto) transform(const C &container, R S::*p) { return transform &>(container, std::mem_fn(p)); } // same container types for input and output, non-const input // function: template class C, // container type typename F, // function type typename... CArgs> // Arguments to SC Q_REQUIRED_RESULT decltype(auto) transform(C &container, F function) { return transform &>(container, function); } // member function: template class C, // container type typename R, typename S, typename... CArgs> // Arguments to SC Q_REQUIRED_RESULT decltype(auto) transform(C &container, R (S::*p)() const) { return transform &>(container, std::mem_fn(p)); } // members: template class C, // container typename R, typename S, typename... CArgs> // Arguments to SC Q_REQUIRED_RESULT decltype(auto) transform(C &container, R S::*p) { return transform &>(container, std::mem_fn(p)); } // Specialization for QStringList: template class C = QList, // result container typename F> // Arguments to C Q_REQUIRED_RESULT decltype(auto) transform(const QStringList &container, F function) { return transform &>(static_cast>(container), function); } // member function: template class C = QList, // result container type typename R, typename S> Q_REQUIRED_RESULT decltype(auto) transform(const QStringList &container, R (S::*p)() const) { return transform &>(static_cast>(container), std::mem_fn(p)); } // members: template class C = QList, // result container typename R, typename S> Q_REQUIRED_RESULT decltype(auto) transform(const QStringList &container, R S::*p) { return transform &>(static_cast>(container), std::mem_fn(p)); } ////////////////// // filtered ///////////////// template Q_REQUIRED_RESULT C filtered(const C &container, F predicate) { C out; std::copy_if(std::begin(container), std::end(container), inserter(out), predicate); return out; } template Q_REQUIRED_RESULT C filtered(const C &container, R (S::*predicate)() const) { C out; std::copy_if(std::begin(container), std::end(container), inserter(out), std::mem_fn(predicate)); return out; } ////////////////// // filteredCast ///////////////// template Q_REQUIRED_RESULT R filteredCast(const C &container, F predicate) { R out; std::copy_if(std::begin(container), std::end(container), inserter(out), predicate); return out; } ////////////////// // partition ///////////////// // Recommended usage: // C hit; // C miss; // std::tie(hit, miss) = Utils::partition(container, predicate); template Q_REQUIRED_RESULT std::tuple partition(const C &container, F predicate) { C hit; C miss; reserve(hit, container.size()); reserve(miss, container.size()); auto hitIns = inserter(hit); auto missIns = inserter(miss); for (const auto &i : container) { if (predicate(i)) hitIns = i; else missIns = i; } return std::make_tuple(hit, miss); } template Q_REQUIRED_RESULT std::tuple partition(const C &container, R (S::*predicate)() const) { return partition(container, std::mem_fn(predicate)); } ////////////////// // filteredUnique ///////////////// template Q_REQUIRED_RESULT C filteredUnique(const C &container) { C result; auto ins = inserter(result); QSet seen; int setSize = 0; auto endIt = std::end(container); for (auto it = std::begin(container); it != endIt; ++it) { seen.insert(*it); if (setSize == seen.size()) // unchanged size => was already seen continue; ++setSize; ins = *it; } return result; } ////////////////// // qobject_container_cast ///////////////// template class Container, typename Base> Container qobject_container_cast(const Container &container) { Container result; auto ins = inserter(result); for (Base val : container) { if (T target = qobject_cast(val)) ins = target; } return result; } ////////////////// // static_container_cast ///////////////// template class Container, typename Base> Container static_container_cast(const Container &container) { Container result; reserve(result, container.size()); auto ins = inserter(result); for (Base val : container) ins = static_cast(val); return result; } ////////////////// // sort ///////////////// template inline void sort(Container &container) { std::stable_sort(std::begin(container), std::end(container)); } template inline void sort(Container &container, Predicate p) { std::stable_sort(std::begin(container), std::end(container), p); } // const lvalue template inline Container sorted(const Container &container) { Container c = container; sort(c); return c; } // non-const lvalue // This is needed because otherwise the "universal" reference below is used, modifying the input // container. template inline Container sorted(Container &container) { Container c = container; sort(c); return c; } // non-const rvalue (actually rvalue or lvalue, but lvalue is handled above) template inline Container sorted(Container &&container) { sort(container); return std::move(container); } // const rvalue template inline Container sorted(const Container &&container) { return sorted(container); } // const lvalue template inline Container sorted(const Container &container, Predicate p) { Container c = container; sort(c, p); return c; } // non-const lvalue // This is needed because otherwise the "universal" reference below is used, modifying the input // container. template inline Container sorted(Container &container, Predicate p) { Container c = container; sort(c, p); return c; } // non-const rvalue (actually rvalue or lvalue, but lvalue is handled above) template inline Container sorted(Container &&container, Predicate p) { sort(container, p); return std::move(container); } // const rvalue template inline Container sorted(const Container &&container, Predicate p) { return sorted(container, p); } // pointer to member template inline void sort(Container &container, R S::*member) { auto f = std::mem_fn(member); using const_ref = typename Container::const_reference; std::stable_sort(std::begin(container), std::end(container), [&f](const_ref a, const_ref b) { return f(a) < f(b); }); } // const lvalue template inline Container sorted(const Container &container, R S::*member) { Container c = container; sort(c, member); return c; } // non-const lvalue // This is needed because otherwise the "universal" reference below is used, modifying the input // container. template inline Container sorted(Container &container, R S::*member) { Container c = container; sort(c, member); return c; } // non-const rvalue (actually rvalue or lvalue, but lvalue is handled above) template inline Container sorted(Container &&container, R S::*member) { sort(container, member); return std::move(container); } // const rvalue template inline Container sorted(const Container &&container, R S::*member) { return sorted(container, member); } // pointer to member function template inline void sort(Container &container, R (S::*function)() const) { auto f = std::mem_fn(function); using const_ref = typename Container::const_reference; std::stable_sort(std::begin(container), std::end(container), [&f](const_ref a, const_ref b) { return f(a) < f(b); }); } // const lvalue template inline Container sorted(const Container &container, R (S::*function)() const) { Container c = container; sort(c, function); return c; } // non-const lvalue // This is needed because otherwise the "universal" reference below is used, modifying the input // container. template inline Container sorted(Container &container, R (S::*function)() const) { Container c = container; sort(c, function); return c; } // non-const rvalue (actually rvalue or lvalue, but lvalue is handled above) template inline Container sorted(Container &&container, R (S::*function)() const) { sort(container, function); return std::move(container); } // const rvalue template inline Container sorted(const Container &&container, R (S::*function)() const) { return sorted(container, function); } ////////////////// // reverseForeach ///////////////// template inline void reverseForeach(const Container &c, const Op &operation) { auto rend = c.rend(); for (auto it = c.rbegin(); it != rend; ++it) operation(*it); } ////////////////// // toReferences ///////////////// template class ResultContainer, typename SourceContainer> auto toReferences(SourceContainer &sources) { return transform(sources, [] (auto &value) { return std::ref(value); }); } template auto toReferences(SourceContainer &sources) { return transform(sources, [] (auto &value) { return std::ref(value); }); } ////////////////// // toConstReferences ///////////////// template class ResultContainer, typename SourceContainer> auto toConstReferences(const SourceContainer &sources) { return transform(sources, [] (const auto &value) { return std::cref(value); }); } template auto toConstReferences(const SourceContainer &sources) { return transform(sources, [] (const auto &value) { return std::cref(value); }); } ////////////////// // take: ///////////////// template Q_REQUIRED_RESULT std::optional take(C &container, P predicate) { const auto end = std::end(container); const auto it = std::find_if(std::begin(container), end, predicate); if (it == end) return std::nullopt; std::optional result = std::make_optional(std::move(*it)); container.erase(it); return result; } // pointer to member template Q_REQUIRED_RESULT decltype(auto) take(C &container, R S::*member) { return take(container, std::mem_fn(member)); } // pointer to member function template Q_REQUIRED_RESULT decltype(auto) take(C &container, R (S::*function)() const) { return take(container, std::mem_fn(function)); } ////////////////// // setUnionMerge: Works like std::set_union but provides a merge function for items that match // !(a > b) && !(b > a) which normally means that there is an "equal" match. // It uses iterators to support move_iterators. ///////////////// template OutputIt setUnionMerge(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt d_first, Merge merge, Compare comp) { for (; first1 != last1; ++d_first) { if (first2 == last2) return std::copy(first1, last1, d_first); if (comp(*first2, *first1)) { *d_first = *first2++; } else { if (comp(*first1, *first2)) { *d_first = *first1; } else { *d_first = merge(*first1, *first2); ++first2; } ++first1; } } return std::copy(first2, last2, d_first); } template OutputIt setUnionMerge(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt d_first, Merge merge) { return setUnionMerge(first1, last1, first2, last2, d_first, merge, std::less>{}); } template OutputContainer setUnionMerge(InputContainer1 &&input1, InputContainer2 &&input2, Merge merge, Compare comp) { OutputContainer results; results.reserve(input1.size() + input2.size()); setUnionMerge(std::make_move_iterator(std::begin(input1)), std::make_move_iterator(std::end(input1)), std::make_move_iterator(std::begin(input2)), std::make_move_iterator(std::end(input2)), std::back_inserter(results), merge, comp); return results; } template OutputContainer setUnionMerge(InputContainer1 &&input1, InputContainer2 &&input2, Merge merge) { return setUnionMerge(std::forward(input1), std::forward(input2), merge, std::less>{}); } template auto usize(const Container &container) { return static_cast>(std::size(container)); } template auto ssize(const Container &container) { return static_cast>(std::size(container)); } template struct CompareIter { Compare compare; explicit constexpr CompareIter(Compare compare) : compare(std::move(compare)) {} template constexpr bool operator()(Iterator1 it1, Iterator2 it2) { return bool(compare(*it1, *it2)); } }; template OutputIterator set_union_impl(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp) { auto compare = CompareIter(comp); while (first1 != last1 && first2 != last2) { if (compare(first1, first2)) { *result = *first1; ++first1; } else if (compare(first2, first1)) { *result = *first2; ++first2; } else { *result = *first1; ++first1; ++first2; } ++result; } return std::copy(first2, last2, std::copy(first1, last1, result)); } template OutputIterator set_union(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp) { return set_union_impl(first1, last1, first2, last2, result, comp); } template OutputIterator set_union(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result) { return set_union_impl( first1, last1, first2, last2, result, std::less{}); } // Replacement for deprecated Qt functionality template QSet toSet(const QList &list) { return QSet(list.begin(), list.end()); } template QList toList(const QSet &set) { return QList(set.begin(), set.end()); } template void addToHash(QHash *result, const QHash &additionalContents) { result->insert(additionalContents); } // Workaround for missing information from QSet::insert() // Return type could be a pair like for std::set, but we never use the iterator anyway. template [[nodiscard]] bool insert(QSet &s, const U &v) { const int oldSize = s.size(); s.insert(v); return s.size() > oldSize; } } // namespace lsp::Utils qbs-src-3.2.0/src/shared/lsp/initializemessages.cpp0000644000175100017510000001104415154533055021732 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "initializemessages.h" #include namespace lsp { constexpr const char InitializeRequest::methodName[]; constexpr const char InitializeNotification::methodName[]; constexpr Trace::Values s_trace = Trace::off; Trace Trace::fromString(const QString &val) { if (val == "messages") return messages; if (val == "verbose") return verbose; return off; } #define RETURN_CASE(name) case Trace::name: return QString(#name); QString Trace::toString() const { switch (m_value) { RETURN_CASE(off); RETURN_CASE(messages); RETURN_CASE(verbose); } return QString("off"); } #undef RETURN_CASE std::optional> TextDocumentClientCapabilities::CompletionCapabilities::CompletionItemCapbilities:: documentationFormat() const { return optionalArray(documentationFormatKey); } void TextDocumentClientCapabilities::CompletionCapabilities::CompletionItemCapbilities:: setDocumentationFormat(const QList &documentationFormat) { insertArray(documentationFormatKey, documentationFormat); } TextDocumentClientCapabilities::CompletionCapabilities::CompletionItemKindCapabilities::CompletionItemKindCapabilities() { setValueSet({CompletionItemKind::Text, CompletionItemKind::Method, CompletionItemKind::Function, CompletionItemKind::Constructor, CompletionItemKind::Field, CompletionItemKind::Variable, CompletionItemKind::Class, CompletionItemKind::Interface, CompletionItemKind::Module, CompletionItemKind::Property, CompletionItemKind::Unit, CompletionItemKind::Value, CompletionItemKind::Enum, CompletionItemKind::Keyword, CompletionItemKind::Snippet, CompletionItemKind::Color, CompletionItemKind::File, CompletionItemKind::Reference, CompletionItemKind::Folder, CompletionItemKind::EnumMember, CompletionItemKind::Constant, CompletionItemKind::Struct, CompletionItemKind::Event, CompletionItemKind::Operator, CompletionItemKind::TypeParameter}); } std::optional> TextDocumentClientCapabilities::CompletionCapabilities::CompletionItemKindCapabilities:: valueSet() const { if (std::optional> array = optionalArray(valueSetKey)) { return std::make_optional(Utils::transform(*array, [](int value) { return static_cast(value); })); } return std::nullopt; } void TextDocumentClientCapabilities::CompletionCapabilities::CompletionItemKindCapabilities:: setValueSet(const QList &valueSet) { insert(valueSetKey, enumArrayToJsonArray(valueSet)); } std::optional > TextDocumentClientCapabilities::HoverCapabilities::contentFormat() const { return optionalArray(contentFormatKey); } void TextDocumentClientCapabilities::HoverCapabilities::setContentFormat(const QList &contentFormat) { insertArray(contentFormatKey, contentFormat); } std::optional> TextDocumentClientCapabilities::SignatureHelpCapabilities::SignatureInformationCapabilities:: documentationFormat() const { return optionalArray(documentationFormatKey); } void TextDocumentClientCapabilities::SignatureHelpCapabilities::SignatureInformationCapabilities:: setDocumentationFormat(const QList &documentationFormat) { insertArray(documentationFormatKey, documentationFormat); } InitializeParams::InitializeParams() { setProcessId(int(QCoreApplication::applicationPid())); setRootUri(LanguageClientValue()); setCapabilities(ClientCapabilities()); setTrace(s_trace); } std::optional InitializeParams::initializationOptions() const { const QJsonValue &optionsValue = value(initializationOptionsKey); if (optionsValue.isObject()) return optionsValue.toObject(); return std::nullopt; } std::optional InitializeParams::trace() const { const QJsonValue &traceValue = value(traceKey); if (traceValue.isUndefined()) return std::nullopt; return std::make_optional(Trace(traceValue.toString())); } InitializeRequest::InitializeRequest(const InitializeParams ¶ms) : Request(methodName, params) { } InitializeNotification::InitializeNotification(const InitializedParams ¶ms) : Notification(methodName, params) { } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/servercapabilities.cpp0000644000175100017510000003541315154533055021727 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "servercapabilities.h" namespace lsp { std::optional ServerCapabilities::textDocumentSync() const { const QJsonValue &sync = value(textDocumentSyncKey); if (sync.isUndefined()) return std::nullopt; return std::make_optional(sync.isDouble() ? TextDocumentSync(sync.toInt()) : TextDocumentSync(TextDocumentSyncOptions(sync.toObject()))); } void ServerCapabilities::setTextDocumentSync(const ServerCapabilities::TextDocumentSync &textDocumentSync) { insertVariant(textDocumentSyncKey, textDocumentSync); } TextDocumentSyncKind ServerCapabilities::textDocumentSyncKindHelper() { if (std::optional sync = textDocumentSync()) { if (auto kind = std::get_if(&*sync)) return static_cast(*kind); if (auto options = std::get_if(&*sync)) { if (const std::optional &change = options->change()) return static_cast(*change); } } return TextDocumentSyncKind::None; } std::optional> ServerCapabilities::hoverProvider() const { using RetType = std::variant; const QJsonValue &provider = value(hoverProviderKey); if (provider.isBool()) return std::make_optional(RetType(provider.toBool())); if (provider.isObject()) return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject()))); return std::nullopt; } void ServerCapabilities::setHoverProvider( const std::variant &hoverProvider) { insertVariant(hoverProviderKey, hoverProvider); } std::optional> ServerCapabilities::definitionProvider() const { using RetType = std::variant; const QJsonValue &provider = value(definitionProviderKey); if (provider.isUndefined() || !(provider.isBool() || provider.isObject())) return std::nullopt; return std::make_optional(provider.isBool() ? RetType(provider.toBool()) : RetType(RegistrationOptions(provider.toObject()))); } void ServerCapabilities::setDefinitionProvider( const std::variant &definitionProvider) { insertVariant(definitionProviderKey, definitionProvider); } std::optional> ServerCapabilities::typeDefinitionProvider() const { using RetType = std::variant; const QJsonValue &provider = value(typeDefinitionProviderKey); if (provider.isUndefined() || !(provider.isBool() || provider.isObject())) return std::nullopt; return std::make_optional(provider.isBool() ? RetType(provider.toBool()) : RetType(RegistrationOptions(provider.toObject()))); } void ServerCapabilities::setTypeDefinitionProvider( const std::variant &typeDefinitionProvider) { insertVariant(typeDefinitionProviderKey, typeDefinitionProvider); } std::optional> ServerCapabilities::implementationProvider() const { using RetType = std::variant; const QJsonValue &provider = value(implementationProviderKey); if (provider.isUndefined() || !(provider.isBool() || provider.isObject())) return std::nullopt; return std::make_optional(provider.isBool() ? RetType(provider.toBool()) : RetType(RegistrationOptions(provider.toObject()))); } void ServerCapabilities::setImplementationProvider( const std::variant &implementationProvider) { insertVariant(implementationProviderKey, implementationProvider); } std::optional> ServerCapabilities::referencesProvider() const { using RetType = std::variant; const QJsonValue &provider = value(referencesProviderKey); if (provider.isBool()) return std::make_optional(RetType(provider.toBool())); if (provider.isObject()) return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject()))); return std::nullopt; } void ServerCapabilities::setReferencesProvider( const std::variant &referencesProvider) { insertVariant(referencesProviderKey, referencesProvider); } std::optional> ServerCapabilities::documentHighlightProvider() const { using RetType = std::variant; const QJsonValue &provider = value(documentHighlightProviderKey); if (provider.isBool()) return std::make_optional(RetType(provider.toBool())); if (provider.isObject()) return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject()))); return std::nullopt; } void ServerCapabilities::setDocumentHighlightProvider( const std::variant &documentHighlightProvider) { insertVariant(documentHighlightProviderKey, documentHighlightProvider); } std::optional> ServerCapabilities::documentSymbolProvider() const { using RetType = std::variant; const QJsonValue &provider = value(documentSymbolProviderKey); if (provider.isBool()) return std::make_optional(RetType(provider.toBool())); if (provider.isObject()) return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject()))); return std::nullopt; } void ServerCapabilities::setDocumentSymbolProvider( std::variant documentSymbolProvider) { insertVariant(documentSymbolProviderKey, documentSymbolProvider); } std::optional ServerCapabilities::semanticTokensProvider() const { return optionalValue(semanticTokensProviderKey); } void ServerCapabilities::setSemanticTokensProvider( const SemanticTokensOptions &semanticTokensProvider) { insert(semanticTokensProviderKey, semanticTokensProvider); } std::optional > ServerCapabilities::callHierarchyProvider() const { const QJsonValue &provider = value(callHierarchyProviderKey); if (provider.isBool()) return provider.toBool(); else if (provider.isObject()) return WorkDoneProgressOptions(provider.toObject()); return std::nullopt; } void ServerCapabilities::setCallHierarchyProvider( const std::variant &callHierarchyProvider) { QJsonValue val; if (std::holds_alternative(callHierarchyProvider)) val = std::get(callHierarchyProvider); else if (std::holds_alternative(callHierarchyProvider)) val = QJsonObject(std::get(callHierarchyProvider)); insert(callHierarchyProviderKey, val); } std::optional> ServerCapabilities::workspaceSymbolProvider() const { using RetType = std::variant; const QJsonValue &provider = value(workspaceSymbolProviderKey); if (provider.isBool()) return std::make_optional(RetType(provider.toBool())); if (provider.isObject()) return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject()))); return std::nullopt; } void ServerCapabilities::setWorkspaceSymbolProvider( std::variant workspaceSymbolProvider) { insertVariant(workspaceSymbolProviderKey, workspaceSymbolProvider); } std::optional> ServerCapabilities::codeActionProvider() const { const QJsonValue &provider = value(codeActionProviderKey); if (provider.isBool()) return std::make_optional(std::variant(provider.toBool())); if (provider.isObject()) { CodeActionOptions options(provider); if (options.isValid()) return std::make_optional(std::variant(options)); } return std::nullopt; } std::optional> ServerCapabilities::documentFormattingProvider() const { using RetType = std::variant; const QJsonValue &provider = value(documentFormattingProviderKey); if (provider.isBool()) return std::make_optional(RetType(provider.toBool())); if (provider.isObject()) return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject()))); return std::nullopt; } void ServerCapabilities::setDocumentFormattingProvider( const std::variant &documentFormattingProvider) { insertVariant(documentFormattingProviderKey, documentFormattingProvider); } std::optional> ServerCapabilities::documentRangeFormattingProvider() const { using RetType = std::variant; const QJsonValue &provider = value(documentRangeFormattingProviderKey); if (provider.isBool()) return std::make_optional(RetType(provider.toBool())); if (provider.isObject()) return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject()))); return std::nullopt; } void ServerCapabilities::setDocumentRangeFormattingProvider( std::variant documentRangeFormattingProvider) { insertVariant(documentRangeFormattingProviderKey, documentRangeFormattingProvider); } std::optional> ServerCapabilities::renameProvider() const { using RetType = std::variant; const QJsonValue &localValue = value(renameProviderKey); if (localValue.isBool()) return RetType(localValue.toBool()); if (localValue.isObject()) return RetType(RenameOptions(localValue.toObject())); return std::nullopt; } void ServerCapabilities::setRenameProvider(std::variant renameProvider) { insertVariant(renameProviderKey, renameProvider); } std::optional> ServerCapabilities::colorProvider() const { using RetType = std::variant; const QJsonValue &localValue = value(colorProviderKey); if (localValue.isBool()) return RetType(localValue.toBool()); if (localValue.isObject()) return RetType(JsonObject(localValue.toObject())); return std::nullopt; } void ServerCapabilities::setColorProvider(std::variant colorProvider) { insertVariant(renameProviderKey, colorProvider); } std::optional > ServerCapabilities::WorkspaceServerCapabilities::WorkspaceFoldersCapabilities::changeNotifications() const { using RetType = std::variant; const QJsonValue &change = value(changeNotificationsKey); if (change.isUndefined()) return std::nullopt; return std::make_optional(change.isBool() ? RetType(change.toBool()) : RetType(change.toString())); } void ServerCapabilities::WorkspaceServerCapabilities::WorkspaceFoldersCapabilities::setChangeNotifications( std::variant changeNotifications) { insertVariant(changeNotificationsKey, changeNotifications); } bool TextDocumentRegistrationOptions::filterApplies(const Utils::FilePath &fileName) const { Q_UNUSED(fileName) return true; } bool ServerCapabilities::ExecuteCommandOptions::isValid() const { return WorkDoneProgressOptions::isValid() && contains(commandsKey); } bool CodeActionOptions::isValid() const { return WorkDoneProgressOptions::isValid() && contains(codeActionKindsKey); } std::optional> SemanticTokensOptions::range() const { using RetType = std::variant; const QJsonValue &rangeOptions = value(rangeKey); if (rangeOptions.isBool()) return RetType(rangeOptions.toBool()); if (rangeOptions.isObject()) return RetType(rangeOptions.toObject()); return std::nullopt; } void SemanticTokensOptions::setRange(const std::variant &range) { insertVariant(rangeKey, range); } std::optional> SemanticTokensOptions::full() const { using RetType = std::variant; const QJsonValue &fullOptions = value(fullKey); if (fullOptions.isBool()) return RetType(fullOptions.toBool()); if (fullOptions.isObject()) return RetType(FullSemanticTokenOptions(fullOptions.toObject())); return std::nullopt; } void SemanticTokensOptions::setFull( const std::variant &full) { insertVariant(fullKey, full); } SemanticRequestTypes SemanticTokensOptions::supportedRequests() const { SemanticRequestTypes result; QJsonValue rangeValue = value(rangeKey); if (rangeValue.isObject() || rangeValue.toBool()) result |= SemanticRequestType::Range; QJsonValue fullValue = value(fullKey); if (fullValue.isObject()) { SemanticTokensOptions::FullSemanticTokenOptions options(fullValue.toObject()); if (options.delta().value_or(false)) result |= SemanticRequestType::FullDelta; result |= SemanticRequestType::Full; } else if (fullValue.toBool()) { result |= SemanticRequestType::Full; } return result; } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/progresssupport.cpp0000644000175100017510000000311415154533055021341 0ustar runnerrunner// Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "progresssupport.h" #include namespace lsp { ProgressToken::ProgressToken(const QJsonValue &value) { if (!QBS_GUARD(value.isDouble() || value.isString())) emplace(QUuid::createUuid().toString()); else if (value.isDouble()) emplace(value.toInt()); else emplace(value.toString()); } ProgressToken::operator QJsonValue() const { if (std::holds_alternative(*this)) return QJsonValue(std::get(*this)); return QJsonValue(std::get(*this)); } ProgressParams::ProgressType ProgressParams::value() const { QJsonObject paramsValue = JsonObject::value(valueKey).toObject(); if (paramsValue[kindKey] == "begin") return ProgressParams::ProgressType(WorkDoneProgressBegin(paramsValue)); if (paramsValue[kindKey] == "report") return ProgressParams::ProgressType(WorkDoneProgressReport(paramsValue)); return ProgressParams::ProgressType(WorkDoneProgressEnd(paramsValue)); } void ProgressParams::setValue(const ProgressParams::ProgressType &value) { insertVariant(valueKey, value); } ProgressNotification::ProgressNotification(const ProgressParams ¶ms) : Notification(methodName, params) { } WorkDoneProgressCreateRequest::WorkDoneProgressCreateRequest(const WorkDoneProgressCreateParams ¶ms) : Request(methodName, params) { } } // namespace lsp qbs-src-3.2.0/src/shared/lsp/workspace.h0000644000175100017510000002073715154533055017515 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "jsonrpcmessages.h" namespace lsp { class LANGUAGESERVERPROTOCOL_EXPORT WorkSpaceFolderResult : public std::variant, std::nullptr_t> { public: using variant::variant; using variant::operator=; operator const QJsonValue() const; }; class LANGUAGESERVERPROTOCOL_EXPORT WorkSpaceFolderRequest : public Request< WorkSpaceFolderResult, std::nullptr_t, std::nullptr_t> { public: WorkSpaceFolderRequest(); using Request::Request; constexpr static const char methodName[] = "workspace/workspaceFolders"; bool parametersAreValid(QString * /*errorMessage*/) const override { return true; } }; class LANGUAGESERVERPROTOCOL_EXPORT WorkspaceFoldersChangeEvent : public JsonObject { public: using JsonObject::JsonObject; WorkspaceFoldersChangeEvent(); QList added() const { return array(addedKey); } void setAdded(const QList &added) { insertArray(addedKey, added); } QList removed() const { return array(removedKey); } void setRemoved(const QList &removed) { insertArray(removedKey, removed); } bool isValid() const override { return contains(addedKey) && contains(removedKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DidChangeWorkspaceFoldersParams : public JsonObject { public: using JsonObject::JsonObject; WorkspaceFoldersChangeEvent event() const { return typedValue(eventKey); } void setEvent(const WorkspaceFoldersChangeEvent &event) { insert(eventKey, event); } bool isValid() const override { return contains(eventKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DidChangeWorkspaceFoldersNotification : public Notification< DidChangeWorkspaceFoldersParams> { public: explicit DidChangeWorkspaceFoldersNotification(const DidChangeWorkspaceFoldersParams ¶ms); constexpr static const char methodName[] = "workspace/didChangeWorkspaceFolders"; using Notification::Notification; }; class LANGUAGESERVERPROTOCOL_EXPORT DidChangeConfigurationParams : public JsonObject { public: using JsonObject::JsonObject; QJsonValue settings() const { return value(settingsKey); } void setSettings(QJsonValue settings) { insert(settingsKey, settings); } bool isValid() const override { return contains(settingsKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DidChangeConfigurationNotification : public Notification< DidChangeConfigurationParams> { public: explicit DidChangeConfigurationNotification(const DidChangeConfigurationParams ¶ms); using Notification::Notification; constexpr static const char methodName[] = "workspace/didChangeConfiguration"; }; class LANGUAGESERVERPROTOCOL_EXPORT ConfigurationParams : public JsonObject { public: using JsonObject::JsonObject; class LANGUAGESERVERPROTOCOL_EXPORT ConfigurationItem : public JsonObject { public: using JsonObject::JsonObject; std::optional scopeUri() const; void setScopeUri(const DocumentUri &scopeUri) { insert(scopeUriKey, scopeUri); } void clearScopeUri() { remove(scopeUriKey); } std::optional section() const { return optionalValue(sectionKey); } void setSection(const QString §ion) { insert(sectionKey, section); } void clearSection() { remove(sectionKey); } bool isValid() const override { return contains(scopeUriKey); } }; QList items() const { return array(itemsKey); } void setItems(const QList &items) { insertArray(itemsKey, items); } bool isValid() const override { return contains(itemsKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ConfigurationRequest : public Request { public: explicit ConfigurationRequest(const ConfigurationParams ¶ms); using Request::Request; constexpr static const char methodName[] = "workspace/configuration"; }; class LANGUAGESERVERPROTOCOL_EXPORT DidChangeWatchedFilesParams : public JsonObject { public: using JsonObject::JsonObject; class FileEvent : public JsonObject { public: using JsonObject::JsonObject; DocumentUri uri() const { return DocumentUri::fromProtocol(typedValue(uriKey)); } void setUri(const DocumentUri &uri) { insert(uriKey, uri); } int type() const { return typedValue(typeKey); } void setType(int type) { insert(typeKey, type); } enum FileChangeType { Created = 1, Changed = 2, Deleted = 3 }; bool isValid() const override { return contains(uriKey) && contains(typeKey); } }; QList changes() const { return array(changesKey); } void setChanges(const QList &changes) { insertArray(changesKey, changes); } bool isValid() const override { return contains(changesKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT DidChangeWatchedFilesNotification : public Notification< DidChangeWatchedFilesParams> { public: explicit DidChangeWatchedFilesNotification(const DidChangeWatchedFilesParams ¶ms); using Notification::Notification; constexpr static const char methodName[] = "workspace/didChangeWatchedFiles"; }; class LANGUAGESERVERPROTOCOL_EXPORT WorkspaceSymbolParams : public JsonObject { public: using JsonObject::JsonObject; QString query() const { return typedValue(queryKey); } void setQuery(const QString &query) { insert(queryKey, query); } void setLimit(int limit) { insert("limit", limit); } // clangd extension bool isValid() const override { return contains(queryKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT WorkspaceSymbolRequest : public Request< LanguageClientArray, std::nullptr_t, WorkspaceSymbolParams> { public: explicit WorkspaceSymbolRequest(const WorkspaceSymbolParams ¶ms); using Request::Request; constexpr static const char methodName[] = "workspace/symbol"; }; class LANGUAGESERVERPROTOCOL_EXPORT ExecuteCommandParams : public JsonObject { public: explicit ExecuteCommandParams(const Command &command); explicit ExecuteCommandParams(const QJsonValue &value) : JsonObject(value) {} ExecuteCommandParams() : JsonObject() {} QString command() const { return typedValue(commandKey); } void setCommand(const QString &command) { insert(commandKey, command); } void clearCommand() { remove(commandKey); } std::optional arguments() const { return typedValue(argumentsKey); } void setArguments(const QJsonArray &arguments) { insert(argumentsKey, arguments); } void clearArguments() { remove(argumentsKey); } bool isValid() const override { return contains(commandKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ExecuteCommandRequest : public Request< QJsonValue, std::nullptr_t, ExecuteCommandParams> { public: explicit ExecuteCommandRequest(const ExecuteCommandParams ¶ms); using Request::Request; constexpr static const char methodName[] = "workspace/executeCommand"; }; class LANGUAGESERVERPROTOCOL_EXPORT ApplyWorkspaceEditParams : public JsonObject { public: using JsonObject::JsonObject; std::optional label() const { return optionalValue(labelKey); } void setLabel(const QString &label) { insert(labelKey, label); } void clearLabel() { remove(labelKey); } WorkspaceEdit edit() const { return typedValue(editKey); } void setEdit(const WorkspaceEdit &edit) { insert(editKey, edit); } bool isValid() const override { return contains(editKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ApplyWorkspaceEditResult : public JsonObject { public: using JsonObject::JsonObject; bool applied() const { return typedValue(appliedKey); } void setApplied(bool applied) { insert(appliedKey, applied); } bool isValid() const override { return contains(appliedKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT ApplyWorkspaceEditRequest : public Request< ApplyWorkspaceEditResult, std::nullptr_t, ApplyWorkspaceEditParams> { public: explicit ApplyWorkspaceEditRequest(const ApplyWorkspaceEditParams ¶ms); using Request::Request; constexpr static const char methodName[] = "workspace/applyEdit"; }; } // namespace LanguageClient qbs-src-3.2.0/src/shared/lsp/basemessage.h0000644000175100017510000000226215154533055017767 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "languageserverprotocol_global.h" #include #include #include QT_BEGIN_NAMESPACE class QBuffer; class QTextCodec; QT_END_NAMESPACE namespace lsp { LANGUAGESERVERPROTOCOL_EXPORT Q_DECLARE_LOGGING_CATEGORY(parseLog) class LANGUAGESERVERPROTOCOL_EXPORT BaseMessage { public: BaseMessage(); BaseMessage(const QByteArray &mimeType, const QByteArray &content, int expectedLength, QTextCodec *codec); BaseMessage(const QByteArray &mimeType, const QByteArray &content); bool operator==(const BaseMessage &other) const; static void parse(QBuffer *data, QString &parseError, BaseMessage &message); static QTextCodec *defaultCodec(); bool isComplete() const; bool isValid() const; QByteArray header() const; QByteArray mimeType; QByteArray content; int contentLength = -1; QTextCodec *codec = defaultCodec(); private: QByteArray lengthHeader() const; QByteArray typeHeader() const; }; } // namespace LanguageClient qbs-src-3.2.0/src/shared/lsp/diagnostics.h0000644000175100017510000000245315154533055020021 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "jsonrpcmessages.h" #include "languagefeatures.h" namespace lsp { class PublishDiagnosticsParams : public JsonObject { public: using JsonObject::JsonObject; DocumentUri uri() const { return DocumentUri::fromProtocol(typedValue(uriKey)); } void setUri(const DocumentUri &uri) { insert(uriKey, uri); } QList diagnostics() const { return array(diagnosticsKey); } void setDiagnostics(const QList &diagnostics) { insertArray(diagnosticsKey, diagnostics); } std::optional version() const { return optionalValue(versionKey); } void setVersion(int version) { insert(versionKey, version); } void clearVersion() { remove(versionKey); } bool isValid() const override { return contains(diagnosticsKey); } }; class LANGUAGESERVERPROTOCOL_EXPORT PublishDiagnosticsNotification : public Notification { public: explicit PublishDiagnosticsNotification(const PublishDiagnosticsParams ¶ms); using Notification::Notification; constexpr static const char methodName[] = "textDocument/publishDiagnostics"; }; } // namespace LanguageClient qbs-src-3.2.0/src/shared/lsp/textsynchronization.cpp0000644000175100017510000000525615154533055022217 0ustar runnerrunner// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "textsynchronization.h" namespace lsp { constexpr const char DidOpenTextDocumentNotification::methodName[]; constexpr const char DidChangeTextDocumentNotification::methodName[]; constexpr const char WillSaveTextDocumentNotification::methodName[]; constexpr const char WillSaveWaitUntilTextDocumentRequest::methodName[]; constexpr const char DidSaveTextDocumentNotification::methodName[]; constexpr const char DidCloseTextDocumentNotification::methodName[]; DidOpenTextDocumentNotification::DidOpenTextDocumentNotification( const DidOpenTextDocumentParams ¶ms) : Notification(methodName, params) { } DidChangeTextDocumentNotification::DidChangeTextDocumentNotification( const DidChangeTextDocumentParams ¶ms) : DidChangeTextDocumentNotification(methodName, params) { } WillSaveTextDocumentNotification::WillSaveTextDocumentNotification( const WillSaveTextDocumentParams ¶ms) : Notification(methodName, params) { } WillSaveWaitUntilTextDocumentRequest::WillSaveWaitUntilTextDocumentRequest(const WillSaveTextDocumentParams ¶ms) : Request(methodName, params) { } DidSaveTextDocumentNotification::DidSaveTextDocumentNotification( const DidSaveTextDocumentParams ¶ms) : Notification(methodName, params) { } DidCloseTextDocumentNotification::DidCloseTextDocumentNotification( const DidCloseTextDocumentParams ¶ms) : Notification(methodName, params) { } DidChangeTextDocumentParams::DidChangeTextDocumentParams() : DidChangeTextDocumentParams(VersionedTextDocumentIdentifier()) { } DidChangeTextDocumentParams::DidChangeTextDocumentParams( const VersionedTextDocumentIdentifier &docId, const QString &text) { setTextDocument(docId); setContentChanges({TextDocumentContentChangeEvent(text)}); } DidOpenTextDocumentParams::DidOpenTextDocumentParams(const TextDocumentItem &document) { setTextDocument(document); } DidCloseTextDocumentParams::DidCloseTextDocumentParams(const TextDocumentIdentifier &document) { setTextDocument(document); } DidChangeTextDocumentParams::TextDocumentContentChangeEvent::TextDocumentContentChangeEvent( const QString &text) { setText(text); } DidSaveTextDocumentParams::DidSaveTextDocumentParams(const TextDocumentIdentifier &document) { setTextDocument(document); } WillSaveTextDocumentParams::WillSaveTextDocumentParams( const TextDocumentIdentifier &document, const WillSaveTextDocumentParams::TextDocumentSaveReason &reason) { setTextDocument(document); setReason(reason); } } // namespace lsp qbs-src-3.2.0/src/shared/CMakeLists.txt0000644000175100017510000000010715154533055017275 0ustar runnerrunneradd_subdirectory(lsp) add_subdirectory(quickjs) add_subdirectory(span) qbs-src-3.2.0/src/shared/bundledqt/0000755000175100017510000000000015154533055016521 5ustar runnerrunnerqbs-src-3.2.0/src/shared/bundledqt/bundledqt.qbs0000644000175100017510000001634715154533055021225 0ustar runnerrunnerimport qbs.File import qbs.FileInfo import qbs.Utilities Product { Depends { name: "qbsbuildconfig" } Depends { name: "Qt"; submodules: ["core", "gui", "network", "printsupport", "widgets", "xml"] } Depends { name: "Qt.test"; condition: project.withTests === true } Depends { name: "Qt.core5compat"; condition: Utilities.versionCompare(Qt.core.version, "6") >= 0 } Depends { name: "Qt"; submodules: [ "dbus", "xcb_qpa_lib-private" ]; required: false } condition: { if (!qbsbuildconfig.enableBundledQt) return false; if (Qt.core.staticBuild) throw("Cannot bundle static Qt libraries"); return true; } readonly property string qtDebugLibrarySuffix: { if (Qt.core.qtBuildVariant !== "debug") return ""; if (qbs.targetOS.contains("windows")) return "d"; if (qbs.targetOS.contains("darwin")) return "_debug"; return ""; } readonly property string styleName: { if (Utilities.versionCompare(Qt.core.version, "6.7.0") >= 0) return "qmodernwindowsstyle"; return "qwindowsvistastyle"; } Group { name: "qt.conf" files: ["qt.conf"] qbs.install: true qbs.installDir: qbsbuildconfig.appInstallDir } Group { name: "Qt libraries" files: { function getLibsForQtModule(mod) { if (mod === "script" && !Qt[mod].present) return []; if ((mod !== "core") && !Qt[mod].hasLibrary) return []; if (Qt[mod].isStaticLibrary) return []; var list = []; if (qbs.targetOS.contains("windows")) { var basename = FileInfo.baseName(Qt[mod].libNameForLinker); var dir = Qt.core.binPath; list.push(dir + "/" + basename + ".dll"); } else if (qbs.targetOS.contains("linux")) { var fp = Qt[mod].libFilePath; var basename = FileInfo.baseName(fp); var dir = FileInfo.path(fp); list.push(dir + "/" + basename + ".so"); list.push(dir + "/" + basename + ".so." + Qt.core.versionMajor); if (Utilities.versionCompare(Qt.core.version, "6") < 0) { list.push(dir + "/" + basename + ".so." + Qt.core.versionMajor + "." + Qt.core.versionMinor); } list.push(dir + "/" + basename + ".so." + Qt.core.versionMajor + "." + Qt.core.versionMinor + "." + Qt.core.versionPatch); } else if (Qt.core.frameworkBuild) { var fp = Qt[mod].libFilePathRelease; var fpd = fp + "_debug"; if (qtDebugLibrarySuffix) list.push(fpd); var suffix = ".framework/"; var frameworkPath = fp.substr(0, fp.lastIndexOf(suffix) + suffix.length - 1); var versionsPath = frameworkPath + "/Versions"; var versionName = Utilities.versionCompare(Qt.core.version, "6") >= 0 ? "A" : Qt.core.versionMajor; var versionPath = versionsPath + "/" + versionName; list.push(frameworkPath + "/Resources"); list.push(versionPath + "/Resources/Info.plist"); list.push(versionPath + "/" + FileInfo.fileName(fp)); if (qtDebugLibrarySuffix) list.push(versionPath + "/" + FileInfo.fileName(fpd)); if (qbsbuildconfig.installApiHeaders) { list.push(frameworkPath + "/Headers"); list.push(versionPath + "/Headers/**"); } } return list; } var qtModules = Object.getOwnPropertyNames(Qt); var libraries = Array.prototype.concat.apply([], qtModules.map(getLibsForQtModule)); // Qt might be bundled with additional libraries if (qbs.targetOS.contains("linux")) { var dir = FileInfo.path(Qt.core.libFilePathRelease); var addons = [ "libicui18n", "libicuuc", "libicudata" ]; addons.forEach(function(lib) { libraries.push(dir + "/" + lib + ".so*"); }); } return libraries; } fileTags: [] qbs.install: true qbs.installDir: qbsbuildconfig.libInstallDir qbs.installSourceBase: qbs.targetOS.contains("windows") ? Qt.core.binPath : Qt.core.libPath } Group { name: "Windows Plugins" condition: qbs.targetOS.contains("windows") prefix: Qt.core.pluginPath + "/" files: [ "platforms/qwindows" + qtDebugLibrarySuffix + cpp.dynamicLibrarySuffix, "styles/" + styleName + qtDebugLibrarySuffix + cpp.dynamicLibrarySuffix ].concat(Utilities.versionCompare(Qt.core.version, "6.2.0") >= 0 ? [ "tls/qschannelbackend" + qtDebugLibrarySuffix + cpp.dynamicLibrarySuffix ] : []) qbs.install: true qbs.installDir: "plugins" qbs.installSourceBase: prefix } Group { name: "macOS Plugins" condition: qbs.targetOS.contains("darwin") prefix: Qt.core.pluginPath + "/" files: [ "platforms/libqcocoa" + qtDebugLibrarySuffix + cpp.dynamicLibrarySuffix, "styles/libqmacstyle" + qtDebugLibrarySuffix + cpp.dynamicLibrarySuffix ].concat(Utilities.versionCompare(Qt.core.version, "6.2.0") >= 0 ? [ "tls/libqsecuretransportbackend" + qtDebugLibrarySuffix + cpp.dynamicLibrarySuffix ] : []) qbs.install: true qbs.installDir: "plugins" qbs.installSourceBase: prefix } Group { name: "Linux Plugins" condition: qbs.targetOS.contains("linux") prefix: Qt.core.pluginPath + "/" files: [ "platforms/libqxcb" + cpp.dynamicLibrarySuffix, "platformthemes/libqgtk3" + cpp.dynamicLibrarySuffix ].concat(Utilities.versionCompare(Qt.core.version, "6.2.0") >= 0 ? [ "tls/libqopensslbackend" + cpp.dynamicLibrarySuffix ] : []) qbs.install: true qbs.installDir: "plugins" qbs.installSourceBase: prefix } Group { name: "MinGW Runtime DLLs" condition: qbs.targetOS.contains("windows") && qbs.toolchain.contains("mingw") files: { var libFileGlobs = [ "*libgcc_s*.dll", "*libstdc++-6.dll", "*libwinpthread-1.dll" ]; var searchPaths = cpp.compilerLibraryPaths; return Array.prototype.concat.apply([], searchPaths.map(function(path) { return libFileGlobs.map(function(glob) { return path + "/" + glob; }); })); } qbs.install: true qbs.installDir: "bin" } } qbs-src-3.2.0/src/shared/bundledqt/qt.conf0000644000175100017510000000002415154533055020010 0ustar runnerrunner[Paths] Prefix = .. qbs-src-3.2.0/src/shared/quickjs/0000755000175100017510000000000015154533055016210 5ustar runnerrunnerqbs-src-3.2.0/src/shared/quickjs/.clang-format0000644000175100017510000000005015154533055020556 0ustar runnerrunnerDisableFormat: true SortIncludes: Never qbs-src-3.2.0/src/shared/quickjs/quickjs.h0000644000175100017510000016045515154533055020045 0ustar runnerrunner/* * QuickJS Javascript Engine * * Copyright (c) 2017-2024 Fabrice Bellard * Copyright (c) 2017-2024 Charlie Gordon * Copyright (c) 2023-2025 Ben Noordhuis * Copyright (c) 2023-2025 Saúl Ibarra Corretgé * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef QUICKJS_H #define QUICKJS_H #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif #define QUICKJS_NG 1 #if defined(__GNUC__) || defined(__clang__) #define js_force_inline inline __attribute__((always_inline)) #define JS_EXTERN __attribute__((visibility("default"))) #else #define js_force_inline inline #define JS_EXTERN /* nothing */ #endif /* Borrowed from Folly */ #ifndef JS_PRINTF_FORMAT #ifdef _MSC_VER #include #define JS_PRINTF_FORMAT _Printf_format_string_ #define JS_PRINTF_FORMAT_ATTR(format_param, dots_param) #else #define JS_PRINTF_FORMAT #if !defined(__clang__) && defined(__GNUC__) #define JS_PRINTF_FORMAT_ATTR(format_param, dots_param) \ __attribute__((format(gnu_printf, format_param, dots_param))) #else #define JS_PRINTF_FORMAT_ATTR(format_param, dots_param) \ __attribute__((format(printf, format_param, dots_param))) #endif #endif #endif typedef struct JSRuntime JSRuntime; typedef struct JSContext JSContext; typedef struct JSObject JSObject; typedef struct JSClass JSClass; typedef uint32_t JSClassID; typedef uint32_t JSAtom; /* Unless documented otherwise, C string pointers (`char *` or `const char *`) are assumed to verify these constraints: - unless a length is passed separately, the string has a null terminator - string contents is either pure ASCII or is UTF-8 encoded. */ /* Overridable purely for testing purposes; don't touch. */ #ifndef JS_NAN_BOXING #if INTPTR_MAX < INT64_MAX #define JS_NAN_BOXING 1 /* Use NAN boxing for 32bit builds. */ #endif #endif enum { /* all tags with a reference count are negative */ JS_TAG_FIRST = -9, /* first negative tag */ JS_TAG_BIG_INT = -9, JS_TAG_SYMBOL = -8, JS_TAG_STRING = -7, JS_TAG_MODULE = -3, /* used internally */ JS_TAG_FUNCTION_BYTECODE = -2, /* used internally */ JS_TAG_OBJECT = -1, JS_TAG_INT = 0, JS_TAG_BOOL = 1, JS_TAG_NULL = 2, JS_TAG_UNDEFINED = 3, JS_TAG_UNINITIALIZED = 4, JS_TAG_CATCH_OFFSET = 5, JS_TAG_EXCEPTION = 6, JS_TAG_SHORT_BIG_INT = 7, JS_TAG_FLOAT64 = 8, /* any larger tag is FLOAT64 if JS_NAN_BOXING */ }; #if !defined(JS_CHECK_JSVALUE) #define JSValueConst JSValue #endif // JS_CHECK_JSVALUE build mode does not produce working code but is here to // help catch reference counting bugs at compile time, by making it harder // to mix up JSValue and JSValueConst // // rules: // // - a function with a JSValue parameter takes ownership; // caller must *not* call JS_FreeValue // // - a function with a JSValueConst parameter does not take ownership; // caller *must* call JS_FreeValue // // - a function returning a JSValue transfers ownership to caller; // caller *must* call JS_FreeValue // // - a function returning a JSValueConst does *not* transfer ownership; // caller must *not* call JS_FreeValue #if defined(JS_CHECK_JSVALUE) typedef struct JSValue *JSValue; typedef const struct JSValue *JSValueConst; #define JS_MKVAL(tag, val) ((JSValue)((tag) | (intptr_t)(val) << 4)) #define JS_MKPTR(tag, ptr) ((JSValue)((tag) | (intptr_t)(ptr))) #define JS_VALUE_GET_NORM_TAG(v) ((int)((intptr_t)(v) & 15)) #define JS_VALUE_GET_TAG(v) ((int)((intptr_t)(v) & 15)) #define JS_VALUE_GET_SHORT_BIG_INT(v) JS_VALUE_GET_INT(v) #define JS_VALUE_GET_PTR(v) ((void *)((intptr_t)(v) & ~15)) #define JS_VALUE_GET_INT(v) ((int)((intptr_t)(v) >> 4)) #define JS_VALUE_GET_BOOL(v) ((int)((intptr_t)(v) >> 4)) #define JS_VALUE_GET_FLOAT64(v) ((double)((intptr_t)(v) >> 4)) #define JS_TAG_IS_FLOAT64(tag) ((int)(tag) == JS_TAG_FLOAT64) #define JS_NAN JS_MKVAL(JS_TAG_FLOAT64, 0) static inline JSValue __JS_NewFloat64(double d) { return JS_MKVAL(JS_TAG_FLOAT64, (int)d); } static inline JSValue __JS_NewShortBigInt(JSContext *ctx, int32_t d) { (void)&ctx; return JS_MKVAL(JS_TAG_SHORT_BIG_INT, d); } static inline bool JS_VALUE_IS_NAN(JSValue v) { (void)&v; return false; } #elif defined(JS_NAN_BOXING) && JS_NAN_BOXING typedef uint64_t JSValue; #define JS_VALUE_GET_TAG(v) (int)((v) >> 32) #define JS_VALUE_GET_INT(v) (int)(v) #define JS_VALUE_GET_BOOL(v) (int)(v) #define JS_VALUE_GET_SHORT_BIG_INT(v) (int)(v) #define JS_VALUE_GET_PTR(v) (void *)(intptr_t)(v) #define JS_MKVAL(tag, val) (((uint64_t)(tag) << 32) | (uint32_t)(val)) #define JS_MKPTR(tag, ptr) (((uint64_t)(tag) << 32) | (uintptr_t)(ptr)) #define JS_FLOAT64_TAG_ADDEND (0x7ff80000 - JS_TAG_FIRST + 1) /* quiet NaN encoding */ static inline double JS_VALUE_GET_FLOAT64(JSValue v) { union { JSValue v; double d; } u; u.v = v; u.v += (uint64_t)JS_FLOAT64_TAG_ADDEND << 32; return u.d; } #define JS_NAN (0x7ff8000000000000 - ((uint64_t)JS_FLOAT64_TAG_ADDEND << 32)) static inline JSValue __JS_NewFloat64(double d) { union { double d; uint64_t u64; } u; JSValue v; u.d = d; /* normalize NaN */ if ((u.u64 & 0x7fffffffffffffff) > 0x7ff0000000000000) v = JS_NAN; else v = u.u64 - ((uint64_t)JS_FLOAT64_TAG_ADDEND << 32); return v; } static inline JSValue __JS_NewShortBigInt(JSContext *ctx, int32_t d) { (void)&ctx; return JS_MKVAL(JS_TAG_SHORT_BIG_INT, d); } #define JS_TAG_IS_FLOAT64(tag) ((unsigned)((tag) - JS_TAG_FIRST) >= (JS_TAG_FLOAT64 - JS_TAG_FIRST)) /* same as JS_VALUE_GET_TAG, but return JS_TAG_FLOAT64 with NaN boxing */ static inline int JS_VALUE_GET_NORM_TAG(JSValue v) { uint32_t tag; tag = JS_VALUE_GET_TAG(v); if (JS_TAG_IS_FLOAT64(tag)) return JS_TAG_FLOAT64; else return tag; } static inline bool JS_VALUE_IS_NAN(JSValue v) { uint32_t tag; tag = JS_VALUE_GET_TAG(v); return tag == (JS_NAN >> 32); } #else /* !JS_NAN_BOXING */ typedef union JSValueUnion { int32_t int32; double float64; void *ptr; int32_t short_big_int; } JSValueUnion; typedef struct JSValue { JSValueUnion u; int64_t tag; } JSValue; #define JS_VALUE_GET_TAG(v) ((int32_t)(v).tag) /* same as JS_VALUE_GET_TAG, but return JS_TAG_FLOAT64 with NaN boxing */ #define JS_VALUE_GET_NORM_TAG(v) JS_VALUE_GET_TAG(v) #define JS_VALUE_GET_INT(v) ((v).u.int32) #define JS_VALUE_GET_BOOL(v) ((v).u.int32) #define JS_VALUE_GET_FLOAT64(v) ((v).u.float64) #define JS_VALUE_GET_SHORT_BIG_INT(v) ((v).u.short_big_int) #define JS_VALUE_GET_PTR(v) ((v).u.ptr) /* msvc doesn't understand designated initializers without /std:c++20 */ #ifdef __cplusplus static inline JSValue JS_MKPTR(int64_t tag, void *ptr) { JSValue v; v.u.ptr = ptr; v.tag = tag; return v; } static inline JSValue JS_MKVAL(int64_t tag, int32_t int32) { JSValue v; v.u.int32 = int32; v.tag = tag; return v; } static inline JSValue JS_MKNAN(void) { JSValue v; v.u.float64 = NAN; v.tag = JS_TAG_FLOAT64; return v; } /* provide as macros for consistency and backward compat reasons */ #define JS_MKPTR(tag, ptr) JS_MKPTR(tag, ptr) #define JS_MKVAL(tag, val) JS_MKVAL(tag, val) #define JS_NAN JS_MKNAN() /* alas, not a constant expression */ #else #define JS_MKPTR(tag, p) (JSValue){ (JSValueUnion){ .ptr = p }, tag } #define JS_MKVAL(tag, val) (JSValue){ (JSValueUnion){ .int32 = val }, tag } #define JS_NAN (JSValue){ (JSValueUnion){ .float64 = NAN }, JS_TAG_FLOAT64 } #endif #define JS_TAG_IS_FLOAT64(tag) ((unsigned)(tag) == JS_TAG_FLOAT64) static inline JSValue __JS_NewFloat64(double d) { JSValue v; v.tag = JS_TAG_FLOAT64; v.u.float64 = d; return v; } static inline JSValue __JS_NewShortBigInt(JSContext *ctx, int64_t d) { (void)&ctx; JSValue v; v.tag = JS_TAG_SHORT_BIG_INT; v.u.short_big_int = d; return v; } static inline bool JS_VALUE_IS_NAN(JSValue v) { union { double d; uint64_t u64; } u; if (v.tag != JS_TAG_FLOAT64) return 0; u.d = v.u.float64; return (u.u64 & 0x7fffffffffffffff) > 0x7ff0000000000000; } #endif /* !JS_NAN_BOXING */ #define JS_VALUE_IS_BOTH_INT(v1, v2) ((JS_VALUE_GET_TAG(v1) | JS_VALUE_GET_TAG(v2)) == 0) #define JS_VALUE_IS_BOTH_FLOAT(v1, v2) (JS_TAG_IS_FLOAT64(JS_VALUE_GET_TAG(v1)) && JS_TAG_IS_FLOAT64(JS_VALUE_GET_TAG(v2))) #define JS_VALUE_GET_OBJ(v) ((JSObject *)JS_VALUE_GET_PTR(v)) #define JS_VALUE_HAS_REF_COUNT(v) ((unsigned)JS_VALUE_GET_TAG(v) >= (unsigned)JS_TAG_FIRST) /* special values */ #define JS_NULL JS_MKVAL(JS_TAG_NULL, 0) #define JS_UNDEFINED JS_MKVAL(JS_TAG_UNDEFINED, 0) #define JS_FALSE JS_MKVAL(JS_TAG_BOOL, 0) #define JS_TRUE JS_MKVAL(JS_TAG_BOOL, 1) #define JS_EXCEPTION JS_MKVAL(JS_TAG_EXCEPTION, 0) #define JS_UNINITIALIZED JS_MKVAL(JS_TAG_UNINITIALIZED, 0) /* flags for object properties */ #define JS_PROP_CONFIGURABLE (1 << 0) #define JS_PROP_WRITABLE (1 << 1) #define JS_PROP_ENUMERABLE (1 << 2) #define JS_PROP_C_W_E (JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE | JS_PROP_ENUMERABLE) #define JS_PROP_LENGTH (1 << 3) /* used internally in Arrays */ #define JS_PROP_TMASK (3 << 4) /* mask for NORMAL, GETSET, VARREF, AUTOINIT */ #define JS_PROP_NORMAL (0 << 4) #define JS_PROP_GETSET (1 << 4) #define JS_PROP_VARREF (2 << 4) /* used internally */ #define JS_PROP_AUTOINIT (3 << 4) /* used internally */ /* flags for JS_DefineProperty */ #define JS_PROP_HAS_SHIFT 8 #define JS_PROP_HAS_CONFIGURABLE (1 << 8) #define JS_PROP_HAS_WRITABLE (1 << 9) #define JS_PROP_HAS_ENUMERABLE (1 << 10) #define JS_PROP_HAS_GET (1 << 11) #define JS_PROP_HAS_SET (1 << 12) #define JS_PROP_HAS_VALUE (1 << 13) /* throw an exception if false would be returned (JS_DefineProperty/JS_SetProperty) */ #define JS_PROP_THROW (1 << 14) /* throw an exception if false would be returned in strict mode (JS_SetProperty) */ #define JS_PROP_THROW_STRICT (1 << 15) #define JS_PROP_NO_ADD (1 << 16) /* internal use */ #define JS_PROP_NO_EXOTIC (1 << 17) /* internal use */ #define JS_PROP_DEFINE_PROPERTY (1 << 18) /* internal use */ #define JS_PROP_REFLECT_DEFINE_PROPERTY (1 << 19) /* internal use */ #ifndef JS_DEFAULT_STACK_SIZE #define JS_DEFAULT_STACK_SIZE (1024 * 1024) #endif /* JS_Eval() flags */ #define JS_EVAL_TYPE_GLOBAL (0 << 0) /* global code (default) */ #define JS_EVAL_TYPE_MODULE (1 << 0) /* module code */ #define JS_EVAL_TYPE_DIRECT (2 << 0) /* direct call (internal use) */ #define JS_EVAL_TYPE_INDIRECT (3 << 0) /* indirect call (internal use) */ #define JS_EVAL_TYPE_MASK (3 << 0) #define JS_EVAL_FLAG_STRICT (1 << 3) /* force 'strict' mode */ #define JS_EVAL_FLAG_UNUSED (1 << 4) /* unused */ /* compile but do not run. The result is an object with a JS_TAG_FUNCTION_BYTECODE or JS_TAG_MODULE tag. It can be executed with JS_EvalFunction(). */ #define JS_EVAL_FLAG_COMPILE_ONLY (1 << 5) /* don't include the stack frames before this eval in the Error() backtraces */ #define JS_EVAL_FLAG_BACKTRACE_BARRIER (1 << 6) /* allow top-level await in normal script. JS_Eval() returns a promise. Only allowed with JS_EVAL_TYPE_GLOBAL */ #define JS_EVAL_FLAG_ASYNC (1 << 7) typedef JSValue JSCFunction(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv); typedef JSValue JSCFunctionMagic(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int magic); typedef JSValue JSCFunctionData(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int magic, JSValueConst *func_data); typedef struct JSMallocFunctions { void *(*js_calloc)(void *opaque, size_t count, size_t size); void *(*js_malloc)(void *opaque, size_t size); void (*js_free)(void *opaque, void *ptr); void *(*js_realloc)(void *opaque, void *ptr, size_t size); size_t (*js_malloc_usable_size)(const void *ptr); } JSMallocFunctions; // Debug trace system: the debug output will be produced to the dump stream (currently // stdout) if dumps are enabled and JS_SetDumpFlags is invoked with the corresponding // bit set. #define JS_DUMP_BYTECODE_FINAL 0x01 /* dump pass 3 final byte code */ #define JS_DUMP_BYTECODE_PASS2 0x02 /* dump pass 2 code */ #define JS_DUMP_BYTECODE_PASS1 0x04 /* dump pass 1 code */ #define JS_DUMP_BYTECODE_HEX 0x10 /* dump bytecode in hex */ #define JS_DUMP_BYTECODE_PC2LINE 0x20 /* dump line number table */ #define JS_DUMP_BYTECODE_STACK 0x40 /* dump compute_stack_size */ #define JS_DUMP_BYTECODE_STEP 0x80 /* dump executed bytecode */ #define JS_DUMP_READ_OBJECT 0x100 /* dump the marshalled objects at load time */ #define JS_DUMP_FREE 0x200 /* dump every object free */ #define JS_DUMP_GC 0x400 /* dump the occurrence of the automatic GC */ #define JS_DUMP_GC_FREE 0x800 /* dump objects freed by the GC */ #define JS_DUMP_MODULE_RESOLVE 0x1000 /* dump module resolution steps */ #define JS_DUMP_PROMISE 0x2000 /* dump promise steps */ #define JS_DUMP_LEAKS 0x4000 /* dump leaked objects and strings in JS_FreeRuntime */ #define JS_DUMP_ATOM_LEAKS 0x8000 /* dump leaked atoms in JS_FreeRuntime */ #define JS_DUMP_MEM 0x10000 /* dump memory usage in JS_FreeRuntime */ #define JS_DUMP_OBJECTS 0x20000 /* dump objects in JS_FreeRuntime */ #define JS_DUMP_ATOMS 0x40000 /* dump atoms in JS_FreeRuntime */ #define JS_DUMP_SHAPES 0x80000 /* dump shapes in JS_FreeRuntime */ // Finalizers run in LIFO order at the very end of JS_FreeRuntime. // Intended for cleanup of associated resources; the runtime itself // is no longer usable. typedef void JSRuntimeFinalizer(JSRuntime *rt, void *arg); typedef struct JSGCObjectHeader JSGCObjectHeader; JS_EXTERN JSRuntime *JS_NewRuntime(void); /* info lifetime must exceed that of rt */ JS_EXTERN void JS_SetRuntimeInfo(JSRuntime *rt, const char *info); /* use 0 to disable memory limit */ JS_EXTERN void JS_SetMemoryLimit(JSRuntime *rt, size_t limit); JS_EXTERN void JS_SetDumpFlags(JSRuntime *rt, uint64_t flags); JS_EXTERN uint64_t JS_GetDumpFlags(JSRuntime *rt); JS_EXTERN size_t JS_GetGCThreshold(JSRuntime *rt); JS_EXTERN void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold); /* use 0 to disable maximum stack size check */ JS_EXTERN void JS_SetMaxStackSize(JSRuntime *rt, size_t stack_size); /* should be called when changing thread to update the stack top value used to check stack overflow. */ JS_EXTERN void JS_UpdateStackTop(JSRuntime *rt); JS_EXTERN JSRuntime *JS_NewRuntime2(const JSMallocFunctions *mf, void *opaque); JS_EXTERN void JS_FreeRuntime(JSRuntime *rt); JS_EXTERN void *JS_GetRuntimeOpaque(JSRuntime *rt); JS_EXTERN void JS_SetRuntimeOpaque(JSRuntime *rt, void *opaque); JS_EXTERN int JS_AddRuntimeFinalizer(JSRuntime *rt, JSRuntimeFinalizer *finalizer, void *arg); typedef void JS_MarkFunc(JSRuntime *rt, JSGCObjectHeader *gp); JS_EXTERN void JS_MarkValue(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); JS_EXTERN void JS_RunGC(JSRuntime *rt); JS_EXTERN bool JS_IsLiveObject(JSRuntime *rt, JSValueConst obj); JS_EXTERN JSContext *JS_NewContext(JSRuntime *rt); JS_EXTERN void JS_FreeContext(JSContext *s); JS_EXTERN JSContext *JS_DupContext(JSContext *ctx); JS_EXTERN void *JS_GetContextOpaque(JSContext *ctx); JS_EXTERN void JS_SetContextOpaque(JSContext *ctx, void *opaque); JS_EXTERN JSRuntime *JS_GetRuntime(JSContext *ctx); JS_EXTERN void JS_SetClassProto(JSContext *ctx, JSClassID class_id, JSValue obj); JS_EXTERN JSValue JS_GetClassProto(JSContext *ctx, JSClassID class_id); JS_EXTERN JSValue JS_GetFunctionProto(JSContext *ctx); /* the following functions are used to select the intrinsic object to save memory */ JS_EXTERN JSContext *JS_NewContextRaw(JSRuntime *rt); JS_EXTERN void JS_AddIntrinsicBaseObjects(JSContext *ctx); JS_EXTERN void JS_AddIntrinsicDate(JSContext *ctx); JS_EXTERN void JS_AddIntrinsicEval(JSContext *ctx); JS_EXTERN void JS_AddIntrinsicRegExpCompiler(JSContext *ctx); JS_EXTERN void JS_AddIntrinsicRegExp(JSContext *ctx); JS_EXTERN void JS_AddIntrinsicJSON(JSContext *ctx); JS_EXTERN void JS_AddIntrinsicProxy(JSContext *ctx); JS_EXTERN void JS_AddIntrinsicMapSet(JSContext *ctx); JS_EXTERN void JS_AddIntrinsicTypedArrays(JSContext *ctx); JS_EXTERN void JS_AddIntrinsicPromise(JSContext *ctx); JS_EXTERN void JS_AddIntrinsicBigInt(JSContext *ctx); JS_EXTERN void JS_AddIntrinsicWeakRef(JSContext *ctx); JS_EXTERN void JS_AddPerformance(JSContext *ctx); JS_EXTERN void JS_AddIntrinsicDOMException(JSContext *ctx); /* for equality comparisons and sameness */ JS_EXTERN int JS_IsEqual(JSContext *ctx, JSValueConst op1, JSValueConst op2); JS_EXTERN bool JS_IsStrictEqual(JSContext *ctx, JSValueConst op1, JSValueConst op2); JS_EXTERN bool JS_IsSameValue(JSContext *ctx, JSValueConst op1, JSValueConst op2); /* Similar to same-value equality, but +0 and -0 are considered equal. */ JS_EXTERN bool JS_IsSameValueZero(JSContext *ctx, JSValueConst op1, JSValueConst op2); /* Only used for running 262 tests. TODO(saghul) add build time flag. */ JS_EXTERN JSValue js_string_codePointRange(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv); JS_EXTERN void *js_calloc_rt(JSRuntime *rt, size_t count, size_t size); JS_EXTERN void *js_malloc_rt(JSRuntime *rt, size_t size); JS_EXTERN void js_free_rt(JSRuntime *rt, void *ptr); JS_EXTERN void *js_realloc_rt(JSRuntime *rt, void *ptr, size_t size); JS_EXTERN size_t js_malloc_usable_size_rt(JSRuntime *rt, const void *ptr); JS_EXTERN void *js_mallocz_rt(JSRuntime *rt, size_t size); JS_EXTERN void *js_calloc(JSContext *ctx, size_t count, size_t size); JS_EXTERN void *js_malloc(JSContext *ctx, size_t size); JS_EXTERN void js_free(JSContext *ctx, void *ptr); JS_EXTERN void *js_realloc(JSContext *ctx, void *ptr, size_t size); JS_EXTERN size_t js_malloc_usable_size(JSContext *ctx, const void *ptr); JS_EXTERN void *js_realloc2(JSContext *ctx, void *ptr, size_t size, size_t *pslack); JS_EXTERN void *js_mallocz(JSContext *ctx, size_t size); JS_EXTERN char *js_strdup(JSContext *ctx, const char *str); JS_EXTERN char *js_strndup(JSContext *ctx, const char *s, size_t n); typedef struct JSMemoryUsage { int64_t malloc_size, malloc_limit, memory_used_size; int64_t malloc_count; int64_t memory_used_count; int64_t atom_count, atom_size; int64_t str_count, str_size; int64_t obj_count, obj_size; int64_t prop_count, prop_size; int64_t shape_count, shape_size; int64_t js_func_count, js_func_size, js_func_code_size; int64_t js_func_pc2line_count, js_func_pc2line_size; int64_t c_func_count, array_count; int64_t fast_array_count, fast_array_elements; int64_t binary_object_count, binary_object_size; } JSMemoryUsage; JS_EXTERN void JS_ComputeMemoryUsage(JSRuntime *rt, JSMemoryUsage *s); JS_EXTERN void JS_DumpMemoryUsage(FILE *fp, const JSMemoryUsage *s, JSRuntime *rt); /* atom support */ #define JS_ATOM_NULL 0 JS_EXTERN JSAtom JS_NewAtomLen(JSContext *ctx, const char *str, size_t len); JS_EXTERN JSAtom JS_NewAtom(JSContext *ctx, const char *str); JS_EXTERN JSAtom JS_NewAtomUInt32(JSContext *ctx, uint32_t n); JS_EXTERN JSAtom JS_DupAtom(JSContext *ctx, JSAtom v); JS_EXTERN void JS_FreeAtom(JSContext *ctx, JSAtom v); JS_EXTERN void JS_FreeAtomRT(JSRuntime *rt, JSAtom v); JS_EXTERN JSValue JS_AtomToValue(JSContext *ctx, JSAtom atom); JS_EXTERN JSValue JS_AtomToString(JSContext *ctx, JSAtom atom); JS_EXTERN const char *JS_AtomToCStringLen(JSContext *ctx, size_t *plen, JSAtom atom); static inline const char *JS_AtomToCString(JSContext *ctx, JSAtom atom) { return JS_AtomToCStringLen(ctx, NULL, atom); } JS_EXTERN JSAtom JS_ValueToAtom(JSContext *ctx, JSValueConst val); /* object class support */ typedef struct JSPropertyEnum { bool is_enumerable; JSAtom atom; } JSPropertyEnum; typedef struct JSPropertyDescriptor { int flags; JSValue value; JSValue getter; JSValue setter; } JSPropertyDescriptor; typedef struct JSClassExoticMethods { /* Return -1 if exception (can only happen in case of Proxy object), false if the property does not exists, true if it exists. If 1 is returned, the property descriptor 'desc' is filled if != NULL. */ int (*get_own_property)(JSContext *ctx, JSPropertyDescriptor *desc, JSValueConst obj, JSAtom prop); /* '*ptab' should hold the '*plen' property keys. Return 0 if OK, -1 if exception. The 'is_enumerable' field is ignored. */ int (*get_own_property_names)(JSContext *ctx, JSPropertyEnum **ptab, uint32_t *plen, JSValueConst obj); /* return < 0 if exception, or true/false */ int (*delete_property)(JSContext *ctx, JSValueConst obj, JSAtom prop); /* return < 0 if exception or true/false */ int (*define_own_property)(JSContext *ctx, JSValueConst this_obj, JSAtom prop, JSValueConst val, JSValueConst getter, JSValueConst setter, int flags); /* The following methods can be emulated with the previous ones, so they are usually not needed */ /* return < 0 if exception or true/false */ int (*has_property)(JSContext *ctx, JSValueConst obj, JSAtom atom); JSValue (*get_property)(JSContext *ctx, JSValueConst obj, JSAtom atom, JSValueConst receiver); /* return < 0 if exception or true/false */ int (*set_property)(JSContext *ctx, JSValueConst obj, JSAtom atom, JSValueConst value, JSValueConst receiver, int flags); } JSClassExoticMethods; typedef void JSClassFinalizer(JSRuntime *rt, JSValueConst val); typedef void JSClassGCMark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); #define JS_CALL_FLAG_CONSTRUCTOR (1 << 0) typedef JSValue JSClassCall(JSContext *ctx, JSValueConst func_obj, JSValueConst this_val, int argc, JSValueConst *argv, int flags); typedef struct JSClassDef { const char *class_name; /* pure ASCII only! */ JSClassFinalizer *finalizer; JSClassGCMark *gc_mark; /* if call != NULL, the object is a function. If (flags & JS_CALL_FLAG_CONSTRUCTOR) != 0, the function is called as a constructor. In this case, 'this_val' is new.target. A constructor call only happens if the object constructor bit is set (see JS_SetConstructorBit()). */ JSClassCall *call; /* XXX: suppress this indirection ? It is here only to save memory because only a few classes need these methods */ JSClassExoticMethods *exotic; } JSClassDef; #define JS_EVAL_OPTIONS_VERSION 1 typedef struct JSEvalOptions { int version; int eval_flags; const char *filename; int line_num; // can add new fields in ABI-compatible manner by incrementing JS_EVAL_OPTIONS_VERSION } JSEvalOptions; #define JS_INVALID_CLASS_ID 0 JS_EXTERN JSClassID JS_NewClassID(JSRuntime *rt, JSClassID *pclass_id); /* Returns the class ID if `v` is an object, otherwise returns JS_INVALID_CLASS_ID. */ JS_EXTERN JSClassID JS_GetClassID(JSValueConst v); JS_EXTERN int JS_NewClass(JSRuntime *rt, JSClassID class_id, const JSClassDef *class_def); JS_EXTERN bool JS_IsRegisteredClass(JSRuntime *rt, JSClassID class_id); /* value handling */ static js_force_inline JSValue JS_NewBool(JSContext *ctx, bool val) { (void)&ctx; return JS_MKVAL(JS_TAG_BOOL, (val != 0)); } static js_force_inline JSValue JS_NewInt32(JSContext *ctx, int32_t val) { (void)&ctx; return JS_MKVAL(JS_TAG_INT, val); } static js_force_inline JSValue JS_NewFloat64(JSContext *ctx, double val) { (void)&ctx; return __JS_NewFloat64(val); } static js_force_inline JSValue JS_NewCatchOffset(JSContext *ctx, int32_t val) { (void)&ctx; return JS_MKVAL(JS_TAG_CATCH_OFFSET, val); } static js_force_inline JSValue JS_NewInt64(JSContext *ctx, int64_t val) { JSValue v; if (val >= INT32_MIN && val <= INT32_MAX) { v = JS_NewInt32(ctx, (int32_t)val); } else { v = JS_NewFloat64(ctx, (double)val); } return v; } static js_force_inline JSValue JS_NewUint32(JSContext *ctx, uint32_t val) { JSValue v; if (val <= INT32_MAX) { v = JS_NewInt32(ctx, (int32_t)val); } else { v = JS_NewFloat64(ctx, (double)val); } return v; } JS_EXTERN JSValue JS_NewNumber(JSContext *ctx, double d); JS_EXTERN JSValue JS_NewBigInt64(JSContext *ctx, int64_t v); JS_EXTERN JSValue JS_NewBigUint64(JSContext *ctx, uint64_t v); static inline bool JS_IsNumber(JSValueConst v) { int tag = JS_VALUE_GET_TAG(v); return tag == JS_TAG_INT || JS_TAG_IS_FLOAT64(tag); } static inline bool JS_IsBigInt(JSValueConst v) { int tag = JS_VALUE_GET_TAG(v); return tag == JS_TAG_BIG_INT || tag == JS_TAG_SHORT_BIG_INT; } static inline bool JS_IsBool(JSValueConst v) { return JS_VALUE_GET_TAG(v) == JS_TAG_BOOL; } static inline bool JS_IsNull(JSValueConst v) { return JS_VALUE_GET_TAG(v) == JS_TAG_NULL; } static inline bool JS_IsUndefined(JSValueConst v) { return JS_VALUE_GET_TAG(v) == JS_TAG_UNDEFINED; } static inline bool JS_IsException(JSValueConst v) { return JS_VALUE_GET_TAG(v) == JS_TAG_EXCEPTION; } static inline bool JS_IsUninitialized(JSValueConst v) { return JS_VALUE_GET_TAG(v) == JS_TAG_UNINITIALIZED; } static inline bool JS_IsString(JSValueConst v) { return JS_VALUE_GET_TAG(v) == JS_TAG_STRING; } static inline bool JS_IsSymbol(JSValueConst v) { return JS_VALUE_GET_TAG(v) == JS_TAG_SYMBOL; } static inline bool JS_IsObject(JSValueConst v) { return JS_VALUE_GET_TAG(v) == JS_TAG_OBJECT; } static inline bool JS_IsModule(JSValueConst v) { return JS_VALUE_GET_TAG(v) == JS_TAG_MODULE; } JS_EXTERN JSValue JS_Throw(JSContext *ctx, JSValue obj); JS_EXTERN JSValue JS_GetException(JSContext *ctx); JS_EXTERN bool JS_HasException(JSContext *ctx); JS_EXTERN bool JS_IsError(JSValueConst val); JS_EXTERN bool JS_IsUncatchableError(JSValueConst val); JS_EXTERN JSValue JS_GetBacktrace(JSContext *ctx); JS_EXTERN void JS_SetUncatchableError(JSContext *ctx, JSValueConst val); JS_EXTERN void JS_ClearUncatchableError(JSContext *ctx, JSValueConst val); // Shorthand for: // JSValue exc = JS_GetException(ctx); // JS_ClearUncatchableError(ctx, exc); // JS_Throw(ctx, exc); JS_EXTERN void JS_ResetUncatchableError(JSContext *ctx); JS_EXTERN JSValue JS_NewError(JSContext *ctx); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(2, 3) JS_NewInternalError(JSContext *ctx, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(2, 3) JS_NewPlainError(JSContext *ctx, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(2, 3) JS_NewRangeError(JSContext *ctx, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(2, 3) JS_NewReferenceError(JSContext *ctx, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(2, 3) JS_NewSyntaxError(JSContext *ctx, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(2, 3) JS_NewTypeError(JSContext *ctx, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(2, 3) JS_ThrowInternalError(JSContext *ctx, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(2, 3) JS_ThrowPlainError(JSContext *ctx, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(2, 3) JS_ThrowRangeError(JSContext *ctx, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(2, 3) JS_ThrowReferenceError(JSContext *ctx, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(2, 3) JS_ThrowSyntaxError(JSContext *ctx, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(2, 3) JS_ThrowTypeError(JSContext *ctx, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_PRINTF_FORMAT_ATTR(3, 4) JS_ThrowDOMException(JSContext *ctx, const char *name, JS_PRINTF_FORMAT const char *fmt, ...); JS_EXTERN JSValue JS_ThrowOutOfMemory(JSContext *ctx); JS_EXTERN void JS_FreeValue(JSContext *ctx, JSValue v); JS_EXTERN void JS_FreeValueRT(JSRuntime *rt, JSValue v); JS_EXTERN JSValue JS_DupValue(JSContext *ctx, JSValueConst v); JS_EXTERN JSValue JS_DupValueRT(JSRuntime *rt, JSValueConst v); JS_EXTERN int JS_ToBool(JSContext *ctx, JSValueConst val); /* return -1 for JS_EXCEPTION */ static inline JSValue JS_ToBoolean(JSContext *ctx, JSValueConst val) { return JS_NewBool(ctx, JS_ToBool(ctx, val)); } JS_EXTERN JSValue JS_ToNumber(JSContext *ctx, JSValueConst val); JS_EXTERN int JS_ToInt32(JSContext *ctx, int32_t *pres, JSValueConst val); static inline int JS_ToUint32(JSContext *ctx, uint32_t *pres, JSValueConst val) { return JS_ToInt32(ctx, (int32_t*)pres, val); } JS_EXTERN int JS_ToInt64(JSContext *ctx, int64_t *pres, JSValueConst val); JS_EXTERN int JS_ToIndex(JSContext *ctx, uint64_t *plen, JSValueConst val); JS_EXTERN int JS_ToFloat64(JSContext *ctx, double *pres, JSValueConst val); /* return an exception if 'val' is a Number */ JS_EXTERN int JS_ToBigInt64(JSContext *ctx, int64_t *pres, JSValueConst val); JS_EXTERN int JS_ToBigUint64(JSContext *ctx, uint64_t *pres, JSValueConst val); /* same as JS_ToInt64() but allow BigInt */ JS_EXTERN int JS_ToInt64Ext(JSContext *ctx, int64_t *pres, JSValueConst val); JS_EXTERN JSValue JS_NewStringLen(JSContext *ctx, const char *str1, size_t len1); static inline JSValue JS_NewString(JSContext *ctx, const char *str) { return JS_NewStringLen(ctx, str, strlen(str)); } // makes a copy of the input; does not check if the input is valid UTF-16, // that is the responsibility of the caller JS_EXTERN JSValue JS_NewTwoByteString(JSContext *ctx, const uint16_t *buf, size_t len); JS_EXTERN JSValue JS_NewAtomString(JSContext *ctx, const char *str); JS_EXTERN JSValue JS_ToString(JSContext *ctx, JSValueConst val); JS_EXTERN JSValue JS_ToPropertyKey(JSContext *ctx, JSValueConst val); JS_EXTERN const char *JS_ToCStringLen2(JSContext *ctx, size_t *plen, JSValueConst val1, bool cesu8); static inline const char *JS_ToCStringLen(JSContext *ctx, size_t *plen, JSValueConst val1) { return JS_ToCStringLen2(ctx, plen, val1, 0); } static inline const char *JS_ToCString(JSContext *ctx, JSValueConst val1) { return JS_ToCStringLen2(ctx, NULL, val1, 0); } JS_EXTERN void JS_FreeCString(JSContext *ctx, const char *ptr); JS_EXTERN JSValue JS_NewObjectProtoClass(JSContext *ctx, JSValueConst proto, JSClassID class_id); JS_EXTERN JSValue JS_NewObjectClass(JSContext *ctx, JSClassID class_id); JS_EXTERN JSValue JS_NewObjectProto(JSContext *ctx, JSValueConst proto); JS_EXTERN JSValue JS_NewObject(JSContext *ctx); // takes ownership of the values JS_EXTERN JSValue JS_NewObjectFrom(JSContext *ctx, int count, const JSAtom *props, const JSValue *values); // takes ownership of the values JS_EXTERN JSValue JS_NewObjectFromStr(JSContext *ctx, int count, const char **props, const JSValue *values); JS_EXTERN JSValue JS_ToObject(JSContext *ctx, JSValueConst val); JS_EXTERN JSValue JS_ToObjectString(JSContext *ctx, JSValueConst val); JS_EXTERN bool JS_IsFunction(JSContext* ctx, JSValueConst val); JS_EXTERN bool JS_IsConstructor(JSContext* ctx, JSValueConst val); JS_EXTERN bool JS_SetConstructorBit(JSContext *ctx, JSValueConst func_obj, bool val); JS_EXTERN bool JS_IsRegExp(JSValueConst val); JS_EXTERN bool JS_IsMap(JSValueConst val); JS_EXTERN bool JS_IsSet(JSValueConst val); JS_EXTERN bool JS_IsWeakRef(JSValueConst val); JS_EXTERN bool JS_IsWeakSet(JSValueConst val); JS_EXTERN bool JS_IsWeakMap(JSValueConst val); JS_EXTERN bool JS_IsDataView(JSValueConst val); JS_EXTERN int JS_IsSimpleValue(JSContext* ctx, JSValueConst v); JS_EXTERN JSValue JS_NewArray(JSContext *ctx); // takes ownership of the values JS_EXTERN JSValue JS_NewArrayFrom(JSContext *ctx, int count, const JSValue *values); // reader beware: JS_IsArray used to "punch" through proxies and check // if the target object is an array but it no longer does; use JS_IsProxy // and JS_GetProxyTarget instead, and remember that the target itself can // also be a proxy, ad infinitum JS_EXTERN bool JS_IsArray(JSValueConst val); JS_EXTERN bool JS_IsProxy(JSValueConst val); JS_EXTERN JSValue JS_GetProxyTarget(JSContext *ctx, JSValueConst proxy); JS_EXTERN JSValue JS_GetProxyHandler(JSContext *ctx, JSValueConst proxy); JS_EXTERN JSValue JS_NewDate(JSContext *ctx, double epoch_ms); JS_EXTERN bool JS_IsDate(JSValueConst v); JS_EXTERN JSValue JS_GetProperty(JSContext *ctx, JSValueConst this_obj, JSAtom prop); JS_EXTERN JSValue JS_GetPropertyUint32(JSContext *ctx, JSValueConst this_obj, uint32_t idx); JS_EXTERN JSValue JS_GetPropertyInt64(JSContext *ctx, JSValueConst this_obj, int64_t idx); JS_EXTERN JSValue JS_GetPropertyStr(JSContext *ctx, JSValueConst this_obj, const char *prop); JS_EXTERN int JS_SetProperty(JSContext *ctx, JSValueConst this_obj, JSAtom prop, JSValue val); JS_EXTERN int JS_SetPropertyUint32(JSContext *ctx, JSValueConst this_obj, uint32_t idx, JSValue val); JS_EXTERN int JS_SetPropertyInt64(JSContext *ctx, JSValueConst this_obj, int64_t idx, JSValue val); JS_EXTERN int JS_SetPropertyStr(JSContext *ctx, JSValueConst this_obj, const char *prop, JSValue val); JS_EXTERN int JS_HasProperty(JSContext *ctx, JSValueConst this_obj, JSAtom prop); JS_EXTERN int JS_IsExtensible(JSContext *ctx, JSValueConst obj); JS_EXTERN int JS_PreventExtensions(JSContext *ctx, JSValueConst obj); JS_EXTERN int JS_DeleteProperty(JSContext *ctx, JSValueConst obj, JSAtom prop, int flags); JS_EXTERN int JS_SetPrototype(JSContext *ctx, JSValueConst obj, JSValueConst proto_val); JS_EXTERN JSValue JS_GetPrototype(JSContext *ctx, JSValueConst val); JS_EXTERN int JS_GetLength(JSContext *ctx, JSValueConst obj, int64_t *pres); JS_EXTERN int JS_SetLength(JSContext *ctx, JSValueConst obj, int64_t len); JS_EXTERN int JS_SealObject(JSContext *ctx, JSValueConst obj); JS_EXTERN int JS_FreezeObject(JSContext *ctx, JSValueConst obj); #define JS_GPN_STRING_MASK (1 << 0) #define JS_GPN_SYMBOL_MASK (1 << 1) #define JS_GPN_PRIVATE_MASK (1 << 2) /* only include the enumerable properties */ #define JS_GPN_ENUM_ONLY (1 << 4) /* set theJSPropertyEnum.is_enumerable field */ #define JS_GPN_SET_ENUM (1 << 5) JS_EXTERN int JS_GetOwnPropertyNames(JSContext *ctx, JSPropertyEnum **ptab, uint32_t *plen, JSValueConst obj, int flags); JS_EXTERN int JS_GetOwnProperty(JSContext *ctx, JSPropertyDescriptor *desc, JSValueConst obj, JSAtom prop); JS_EXTERN void JS_FreePropertyEnum(JSContext *ctx, JSPropertyEnum *tab, uint32_t len); JS_EXTERN JSValue JS_Call(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv); JS_EXTERN JSValue JS_Invoke(JSContext *ctx, JSValueConst this_val, JSAtom atom, int argc, JSValueConst *argv); JS_EXTERN JSValue JS_CallConstructor(JSContext *ctx, JSValueConst func_obj, int argc, JSValueConst *argv); JS_EXTERN JSValue JS_CallConstructor2(JSContext *ctx, JSValueConst func_obj, JSValueConst new_target, int argc, JSValueConst *argv); /* Try to detect if the input is a module. Returns true if parsing the input * as a module produces no syntax errors. It's a naive approach that is not * wholly infallible: non-strict classic scripts may _parse_ okay as a module * but not _execute_ as one (different runtime semantics.) Use with caution. * |input| can be either ASCII or UTF-8 encoded source code. * Returns false if QuickJS was built with -DQJS_DISABLE_PARSER. */ JS_EXTERN bool JS_DetectModule(const char *input, size_t input_len); /* 'input' must be zero terminated i.e. input[input_len] = '\0'. */ JS_EXTERN JSValue JS_Eval(JSContext *ctx, const char *input, size_t input_len, const char *filename, int eval_flags); JS_EXTERN JSValue JS_Eval2(JSContext *ctx, const char *input, size_t input_len, JSEvalOptions *options); JS_EXTERN JSValue JS_EvalThis(JSContext *ctx, JSValueConst this_obj, const char *input, size_t input_len, const char *filename, int eval_flags); JS_EXTERN JSValue JS_EvalThis2(JSContext *ctx, JSValueConst this_obj, const char *input, size_t input_len, JSEvalOptions *options); JS_EXTERN JSValue JS_GetGlobalObject(JSContext *ctx); JS_EXTERN int JS_IsInstanceOf(JSContext *ctx, JSValueConst val, JSValueConst obj); JS_EXTERN int JS_DefineProperty(JSContext *ctx, JSValueConst this_obj, JSAtom prop, JSValueConst val, JSValueConst getter, JSValueConst setter, int flags); JS_EXTERN int JS_DefinePropertyValue(JSContext *ctx, JSValueConst this_obj, JSAtom prop, JSValue val, int flags); JS_EXTERN int JS_DefinePropertyValueUint32(JSContext *ctx, JSValueConst this_obj, uint32_t idx, JSValue val, int flags); JS_EXTERN int JS_DefinePropertyValueStr(JSContext *ctx, JSValueConst this_obj, const char *prop, JSValue val, int flags); JS_EXTERN int JS_DefinePropertyGetSet(JSContext *ctx, JSValueConst this_obj, JSAtom prop, JSValue getter, JSValue setter, int flags); /* Only supported for custom classes, returns 0 on success < 0 otherwise. */ JS_EXTERN int JS_SetOpaque(JSValueConst obj, void *opaque); JS_EXTERN void *JS_GetOpaque(JSValueConst obj, JSClassID class_id); JS_EXTERN void *JS_GetOpaque2(JSContext *ctx, JSValueConst obj, JSClassID class_id); JS_EXTERN void *JS_GetAnyOpaque(JSValueConst obj, JSClassID *class_id); /* 'buf' must be zero terminated i.e. buf[buf_len] = '\0'. */ JS_EXTERN JSValue JS_ParseJSON(JSContext *ctx, const char *buf, size_t buf_len, const char *filename); JS_EXTERN JSValue JS_JSONStringify(JSContext *ctx, JSValueConst obj, JSValueConst replacer, JSValueConst space0); typedef void JSFreeArrayBufferDataFunc(JSRuntime *rt, void *opaque, void *ptr); JS_EXTERN JSValue JS_NewArrayBuffer(JSContext *ctx, uint8_t *buf, size_t len, JSFreeArrayBufferDataFunc *free_func, void *opaque, bool is_shared); JS_EXTERN JSValue JS_NewArrayBufferCopy(JSContext *ctx, const uint8_t *buf, size_t len); JS_EXTERN void JS_DetachArrayBuffer(JSContext *ctx, JSValueConst obj); JS_EXTERN uint8_t *JS_GetArrayBuffer(JSContext *ctx, size_t *psize, JSValueConst obj); JS_EXTERN bool JS_IsArrayBuffer(JSValueConst obj); JS_EXTERN uint8_t *JS_GetUint8Array(JSContext *ctx, size_t *psize, JSValueConst obj); typedef enum JSTypedArrayEnum { JS_TYPED_ARRAY_UINT8C = 0, JS_TYPED_ARRAY_INT8, JS_TYPED_ARRAY_UINT8, JS_TYPED_ARRAY_INT16, JS_TYPED_ARRAY_UINT16, JS_TYPED_ARRAY_INT32, JS_TYPED_ARRAY_UINT32, JS_TYPED_ARRAY_BIG_INT64, JS_TYPED_ARRAY_BIG_UINT64, JS_TYPED_ARRAY_FLOAT16, JS_TYPED_ARRAY_FLOAT32, JS_TYPED_ARRAY_FLOAT64, } JSTypedArrayEnum; JS_EXTERN JSValue JS_NewTypedArray(JSContext *ctx, int argc, JSValueConst *argv, JSTypedArrayEnum array_type); JS_EXTERN JSValue JS_GetTypedArrayBuffer(JSContext *ctx, JSValueConst obj, size_t *pbyte_offset, size_t *pbyte_length, size_t *pbytes_per_element); JS_EXTERN JSValue JS_NewUint8Array(JSContext *ctx, uint8_t *buf, size_t len, JSFreeArrayBufferDataFunc *free_func, void *opaque, bool is_shared); /* returns -1 if not a typed array otherwise return a JSTypedArrayEnum value */ JS_EXTERN int JS_GetTypedArrayType(JSValueConst obj); JS_EXTERN JSValue JS_NewUint8ArrayCopy(JSContext *ctx, const uint8_t *buf, size_t len); typedef struct { void *(*sab_alloc)(void *opaque, size_t size); void (*sab_free)(void *opaque, void *ptr); void (*sab_dup)(void *opaque, void *ptr); void *sab_opaque; } JSSharedArrayBufferFunctions; JS_EXTERN void JS_SetSharedArrayBufferFunctions(JSRuntime *rt, const JSSharedArrayBufferFunctions *sf); typedef enum JSPromiseStateEnum { JS_PROMISE_PENDING, JS_PROMISE_FULFILLED, JS_PROMISE_REJECTED, } JSPromiseStateEnum; JS_EXTERN JSValue JS_NewPromiseCapability(JSContext *ctx, JSValue *resolving_funcs); JS_EXTERN JSPromiseStateEnum JS_PromiseState(JSContext *ctx, JSValueConst promise); JS_EXTERN JSValue JS_PromiseResult(JSContext *ctx, JSValueConst promise); JS_EXTERN bool JS_IsPromise(JSValueConst val); JS_EXTERN JSValue JS_NewSymbol(JSContext *ctx, const char *description, bool is_global); typedef enum JSPromiseHookType { JS_PROMISE_HOOK_INIT, // emitted when a new promise is created JS_PROMISE_HOOK_BEFORE, // runs right before promise.then is invoked JS_PROMISE_HOOK_AFTER, // runs right after promise.then is invoked JS_PROMISE_HOOK_RESOLVE, // not emitted for rejected promises } JSPromiseHookType; // parent_promise is only passed in when type == JS_PROMISE_HOOK_INIT and // is then either a promise object or JS_UNDEFINED if the new promise does // not have a parent promise; only promises created with promise.then have // a parent promise typedef void JSPromiseHook(JSContext *ctx, JSPromiseHookType type, JSValueConst promise, JSValueConst parent_promise, void *opaque); JS_EXTERN void JS_SetPromiseHook(JSRuntime *rt, JSPromiseHook promise_hook, void *opaque); /* is_handled = true means that the rejection is handled */ typedef void JSHostPromiseRejectionTracker(JSContext *ctx, JSValueConst promise, JSValueConst reason, bool is_handled, void *opaque); JS_EXTERN void JS_SetHostPromiseRejectionTracker(JSRuntime *rt, JSHostPromiseRejectionTracker *cb, void *opaque); /* return != 0 if the JS code needs to be interrupted */ typedef int JSInterruptHandler(JSRuntime *rt, void *opaque); JS_EXTERN void JS_SetInterruptHandler(JSRuntime *rt, JSInterruptHandler *cb, void *opaque); /* if can_block is true, Atomics.wait() can be used */ JS_EXTERN void JS_SetCanBlock(JSRuntime *rt, bool can_block); /* set the [IsHTMLDDA] internal slot */ JS_EXTERN void JS_SetIsHTMLDDA(JSContext *ctx, JSValueConst obj); typedef struct JSModuleDef JSModuleDef; /* return the module specifier (allocated with js_malloc()) or NULL if exception */ typedef char *JSModuleNormalizeFunc(JSContext *ctx, const char *module_base_name, const char *module_name, void *opaque); typedef JSModuleDef *JSModuleLoaderFunc(JSContext *ctx, const char *module_name, void *opaque); /* module_normalize = NULL is allowed and invokes the default module filename normalizer */ JS_EXTERN void JS_SetModuleLoaderFunc(JSRuntime *rt, JSModuleNormalizeFunc *module_normalize, JSModuleLoaderFunc *module_loader, void *opaque); /* return the import.meta object of a module */ JS_EXTERN JSValue JS_GetImportMeta(JSContext *ctx, JSModuleDef *m); JS_EXTERN JSAtom JS_GetModuleName(JSContext *ctx, JSModuleDef *m); JS_EXTERN JSValue JS_GetModuleNamespace(JSContext *ctx, JSModuleDef *m); /* JS Job support */ typedef JSValue JSJobFunc(JSContext *ctx, int argc, JSValueConst *argv); JS_EXTERN int JS_EnqueueJob(JSContext *ctx, JSJobFunc *job_func, int argc, JSValueConst *argv); JS_EXTERN bool JS_IsJobPending(JSRuntime *rt); JS_EXTERN int JS_ExecutePendingJob(JSRuntime *rt, JSContext **pctx); /* Structure to retrieve (de)serialized SharedArrayBuffer objects. */ typedef struct JSSABTab { uint8_t **tab; size_t len; } JSSABTab; /* Object Writer/Reader (currently only used to handle precompiled code) */ #define JS_WRITE_OBJ_BYTECODE (1 << 0) /* allow function/module */ #define JS_WRITE_OBJ_BSWAP (0) /* byte swapped output (obsolete, handled transparently) */ #define JS_WRITE_OBJ_SAB (1 << 2) /* allow SharedArrayBuffer */ #define JS_WRITE_OBJ_REFERENCE (1 << 3) /* allow object references to encode arbitrary object graph */ #define JS_WRITE_OBJ_STRIP_SOURCE (1 << 4) /* do not write source code information */ #define JS_WRITE_OBJ_STRIP_DEBUG (1 << 5) /* do not write debug information */ JS_EXTERN uint8_t *JS_WriteObject(JSContext *ctx, size_t *psize, JSValueConst obj, int flags); JS_EXTERN uint8_t *JS_WriteObject2(JSContext *ctx, size_t *psize, JSValueConst obj, int flags, JSSABTab *psab_tab); #define JS_READ_OBJ_BYTECODE (1 << 0) /* allow function/module */ #define JS_READ_OBJ_ROM_DATA (0) /* avoid duplicating 'buf' data (obsolete, broken by ICs) */ #define JS_READ_OBJ_SAB (1 << 2) /* allow SharedArrayBuffer */ #define JS_READ_OBJ_REFERENCE (1 << 3) /* allow object references */ JS_EXTERN JSValue JS_ReadObject(JSContext *ctx, const uint8_t *buf, size_t buf_len, int flags); JS_EXTERN JSValue JS_ReadObject2(JSContext *ctx, const uint8_t *buf, size_t buf_len, int flags, JSSABTab *psab_tab); /* instantiate and evaluate a bytecode function. Only used when reading a script or module with JS_ReadObject() */ JS_EXTERN JSValue JS_EvalFunction(JSContext *ctx, JSValue fun_obj); /* load the dependencies of the module 'obj'. Useful when JS_ReadObject() returns a module. */ JS_EXTERN int JS_ResolveModule(JSContext *ctx, JSValueConst obj); /* only exported for os.Worker() */ JS_EXTERN JSAtom JS_GetScriptOrModuleName(JSContext *ctx, int n_stack_levels); /* only exported for os.Worker() */ JS_EXTERN JSValue JS_LoadModule(JSContext *ctx, const char *basename, const char *filename); /* C function definition */ typedef enum JSCFunctionEnum { /* XXX: should rename for namespace isolation */ JS_CFUNC_generic, JS_CFUNC_generic_magic, JS_CFUNC_constructor, JS_CFUNC_constructor_magic, JS_CFUNC_constructor_or_func, JS_CFUNC_constructor_or_func_magic, JS_CFUNC_f_f, JS_CFUNC_f_f_f, JS_CFUNC_getter, JS_CFUNC_setter, JS_CFUNC_getter_magic, JS_CFUNC_setter_magic, JS_CFUNC_iterator_next, } JSCFunctionEnum; typedef union JSCFunctionType { JSCFunction *generic; JSValue (*generic_magic)(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int magic); JSCFunction *constructor; JSValue (*constructor_magic)(JSContext *ctx, JSValueConst new_target, int argc, JSValueConst *argv, int magic); JSCFunction *constructor_or_func; double (*f_f)(double); double (*f_f_f)(double, double); JSValue (*getter)(JSContext *ctx, JSValueConst this_val); JSValue (*setter)(JSContext *ctx, JSValueConst this_val, JSValueConst val); JSValue (*getter_magic)(JSContext *ctx, JSValueConst this_val, int magic); JSValue (*setter_magic)(JSContext *ctx, JSValueConst this_val, JSValueConst val, int magic); JSValue (*iterator_next)(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int *pdone, int magic); } JSCFunctionType; JS_EXTERN JSValue JS_NewCFunction2(JSContext *ctx, JSCFunction *func, const char *name, int length, JSCFunctionEnum cproto, int magic); JS_EXTERN JSValue JS_NewCFunction3(JSContext *ctx, JSCFunction *func, const char *name, int length, JSCFunctionEnum cproto, int magic, JSValueConst proto_val); JS_EXTERN JSValue JS_NewCFunctionData(JSContext *ctx, JSCFunctionData *func, int length, int magic, int data_len, JSValueConst *data); JS_EXTERN JSValue JS_NewCFunctionData2(JSContext *ctx, JSCFunctionData *func, const char *name, int length, int magic, int data_len, JSValueConst *data); static inline JSValue JS_NewCFunction(JSContext *ctx, JSCFunction *func, const char *name, int length) { return JS_NewCFunction2(ctx, func, name, length, JS_CFUNC_generic, 0); } static inline JSValue JS_NewCFunctionMagic(JSContext *ctx, JSCFunctionMagic *func, const char *name, int length, JSCFunctionEnum cproto, int magic) { /* Used to squelch a -Wcast-function-type warning. */ JSCFunctionType ft; ft.generic_magic = func; return JS_NewCFunction2(ctx, ft.generic, name, length, cproto, magic); } JS_EXTERN void JS_SetConstructor(JSContext *ctx, JSValueConst func_obj, JSValueConst proto); /* C property definition */ typedef struct JSCFunctionListEntry { const char *name; /* pure ASCII or UTF-8 encoded */ uint8_t prop_flags; uint8_t def_type; int16_t magic; union { struct { uint8_t length; /* XXX: should move outside union */ uint8_t cproto; /* XXX: should move outside union */ JSCFunctionType cfunc; } func; struct { JSCFunctionType get; JSCFunctionType set; } getset; struct { const char *name; int base; } alias; struct { const struct JSCFunctionListEntry *tab; int len; } prop_list; const char *str; /* pure ASCII or UTF-8 encoded */ int32_t i32; int64_t i64; uint64_t u64; double f64; } u; } JSCFunctionListEntry; #define JS_DEF_CFUNC 0 #define JS_DEF_CGETSET 1 #define JS_DEF_CGETSET_MAGIC 2 #define JS_DEF_PROP_STRING 3 #define JS_DEF_PROP_INT32 4 #define JS_DEF_PROP_INT64 5 #define JS_DEF_PROP_DOUBLE 6 #define JS_DEF_PROP_UNDEFINED 7 #define JS_DEF_OBJECT 8 #define JS_DEF_ALIAS 9 /* Note: c++ does not like nested designators */ #define JS_CFUNC_DEF(name, length, func1) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_CFUNC, 0, { .func = { length, JS_CFUNC_generic, { .generic = func1 } } } } #define JS_CFUNC_DEF2(name, length, func1, prop_flags) { name, prop_flags, JS_DEF_CFUNC, 0, { .func = { length, JS_CFUNC_generic, { .generic = func1 } } } } #define JS_CFUNC_MAGIC_DEF(name, length, func1, magic) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_CFUNC, magic, { .func = { length, JS_CFUNC_generic_magic, { .generic_magic = func1 } } } } #define JS_CFUNC_SPECIAL_DEF(name, length, cproto, func1) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_CFUNC, 0, { .func = { length, JS_CFUNC_ ## cproto, { .cproto = func1 } } } } #define JS_ITERATOR_NEXT_DEF(name, length, func1, magic) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_CFUNC, magic, { .func = { length, JS_CFUNC_iterator_next, { .iterator_next = func1 } } } } #define JS_CGETSET_DEF(name, fgetter, fsetter) { name, JS_PROP_CONFIGURABLE, JS_DEF_CGETSET, 0, { .getset = { .get = { .getter = fgetter }, .set = { .setter = fsetter } } } } #define JS_CGETSET_DEF2(name, fgetter, fsetter, prop_flags) { name, prop_flags, JS_DEF_CGETSET, 0, { .getset = { .get = { .getter = fgetter }, .set = { .setter = fsetter } } } } #define JS_CGETSET_MAGIC_DEF(name, fgetter, fsetter, magic) { name, JS_PROP_CONFIGURABLE, JS_DEF_CGETSET_MAGIC, magic, { .getset = { .get = { .getter_magic = fgetter }, .set = { .setter_magic = fsetter } } } } #define JS_PROP_STRING_DEF(name, cstr, prop_flags) { name, prop_flags, JS_DEF_PROP_STRING, 0, { .str = cstr } } #define JS_PROP_INT32_DEF(name, val, prop_flags) { name, prop_flags, JS_DEF_PROP_INT32, 0, { .i32 = val } } #define JS_PROP_INT64_DEF(name, val, prop_flags) { name, prop_flags, JS_DEF_PROP_INT64, 0, { .i64 = val } } #define JS_PROP_DOUBLE_DEF(name, val, prop_flags) { name, prop_flags, JS_DEF_PROP_DOUBLE, 0, { .f64 = val } } #define JS_PROP_U2D_DEF(name, val, prop_flags) { name, prop_flags, JS_DEF_PROP_DOUBLE, 0, { .u64 = val } } #define JS_PROP_UNDEFINED_DEF(name, prop_flags) { name, prop_flags, JS_DEF_PROP_UNDEFINED, 0, { .i32 = 0 } } #define JS_OBJECT_DEF(name, tab, len, prop_flags) { name, prop_flags, JS_DEF_OBJECT, 0, { .prop_list = { tab, len } } } #define JS_ALIAS_DEF(name, from) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_ALIAS, 0, { .alias = { from, -1 } } } #define JS_ALIAS_BASE_DEF(name, from, base) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_ALIAS, 0, { .alias = { from, base } } } JS_EXTERN int JS_SetPropertyFunctionList(JSContext *ctx, JSValueConst obj, const JSCFunctionListEntry *tab, int len); /* C module definition */ typedef int JSModuleInitFunc(JSContext *ctx, JSModuleDef *m); JS_EXTERN JSModuleDef *JS_NewCModule(JSContext *ctx, const char *name_str, JSModuleInitFunc *func); /* can only be called before the module is instantiated */ JS_EXTERN int JS_AddModuleExport(JSContext *ctx, JSModuleDef *m, const char *name_str); JS_EXTERN int JS_AddModuleExportList(JSContext *ctx, JSModuleDef *m, const JSCFunctionListEntry *tab, int len); /* can only be called after the module is instantiated */ JS_EXTERN int JS_SetModuleExport(JSContext *ctx, JSModuleDef *m, const char *export_name, JSValue val); JS_EXTERN int JS_SetModuleExportList(JSContext *ctx, JSModuleDef *m, const JSCFunctionListEntry *tab, int len); /* Qbs extensions */ struct LookupResult { JSValue value; JSValue scope; int useResult; }; typedef struct LookupResult ScopeLookup(JSContext *ctx, JSAtom prop); void setScopeLookup(JSContext *ctx, ScopeLookup *scopeLookup); // Alternative: Request with throw in script engine typedef void FoundUndefinedHandler(JSContext *ctx); void setFoundUndefinedHandler(JSContext *ctx, FoundUndefinedHandler *handler); typedef void FunctionEnteredHandler(JSContext *ctx, JSValue this_val); typedef void FunctionExitedHandler(JSContext *ctx); void setFunctionEnteredHandler(JSContext *ctx, FunctionEnteredHandler *handler); void setFunctionExitedHandler(JSContext *ctx, FunctionExitedHandler *handler); #ifndef NDEBUG void watchRefCount(void *p); #endif /* Version */ #define QJS_VERSION_MAJOR 0 #define QJS_VERSION_MINOR 11 #define QJS_VERSION_PATCH 0 #define QJS_VERSION_SUFFIX "" JS_EXTERN const char* JS_GetVersion(void); /* Integration point for quickjs-libc.c, not for public use. */ JS_EXTERN uintptr_t js_std_cmd(int cmd, ...); #undef JS_EXTERN #undef js_force_inline #ifdef __cplusplus } /* extern "C" { */ #endif #endif /* QUICKJS_H */ qbs-src-3.2.0/src/shared/quickjs/quickjs-c-atomics.h0000644000175100017510000000440115154533055021706 0ustar runnerrunner/* * QuickJS C atomics definitions * * Copyright (c) 2023 Marcin Kolny * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) // Use GCC builtins for version < 4.9 # if((__GNUC__ << 16) + __GNUC_MINOR__ < ((4) << 16) + 9) # define GCC_BUILTIN_ATOMICS # endif #endif #ifdef GCC_BUILTIN_ATOMICS #define atomic_fetch_add(obj, arg) \ __atomic_fetch_add(obj, arg, __ATOMIC_SEQ_CST) #define atomic_compare_exchange_strong(obj, expected, desired) \ __atomic_compare_exchange_n(obj, expected, desired, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) #define atomic_exchange(obj, desired) \ __atomic_exchange_n (obj, desired, __ATOMIC_SEQ_CST) #define atomic_load(obj) \ __atomic_load_n(obj, __ATOMIC_SEQ_CST) #define atomic_store(obj, desired) \ __atomic_store_n(obj, desired, __ATOMIC_SEQ_CST) #define atomic_fetch_or(obj, arg) \ __atomic_fetch_or(obj, arg, __ATOMIC_SEQ_CST) #define atomic_fetch_xor(obj, arg) \ __atomic_fetch_xor(obj, arg, __ATOMIC_SEQ_CST) #define atomic_fetch_and(obj, arg) \ __atomic_fetch_and(obj, arg, __ATOMIC_SEQ_CST) #define atomic_fetch_sub(obj, arg) \ __atomic_fetch_sub(obj, arg, __ATOMIC_SEQ_CST) #define _Atomic #else #include #endif qbs-src-3.2.0/src/shared/quickjs/quickjs.qbs0000644000175100017510000000203715154533055020372 0ustar runnerrunnerStaticLibrary { name: "quickjs" Depends { name: "qbsbuildconfig" } Depends { name: "cpp" } Depends { name: "bundle" } bundle.isBundle: false cpp.cLanguageVersion: qbs.toolchain.contains("msvc") ? "c11" : "gnu11" cpp.defines: ['CONFIG_VERSION="2021-03-27"'].concat(qbsbuildconfig.dumpJsLeaks ? "DUMP_LEAKS" : []) cpp.warningLevel: "none" cpp.minimumMacosVersion: "11.0" files: [ "builtin-array-fromasync.h", "cutils.c", "cutils.h", "dtoa.c", "dtoa.h", "libbf.c", "libbf.h", "libregexp-opcode.h", "libregexp.c", "libregexp.h", "libunicode-table.h", "libunicode.c", "libunicode.h", "list.h", "quickjs-atom.h", "quickjs-c-atomics.h", "quickjs-opcode.h", "quickjs.c", "quickjs.h", ] Export { Depends { name: "cpp" } cpp.systemIncludePaths: [exportingProduct.sourceDirectory] } } qbs-src-3.2.0/src/shared/quickjs/quickjs-opcode.h0000644000175100017510000003645715154533055021320 0ustar runnerrunner/* * QuickJS opcode definitions * * Copyright (c) 2017-2018 Fabrice Bellard * Copyright (c) 2017-2018 Charlie Gordon * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifdef FMT FMT(none) FMT(none_int) FMT(none_loc) FMT(none_arg) FMT(none_var_ref) FMT(u8) FMT(i8) FMT(loc8) FMT(const8) FMT(label8) FMT(u16) FMT(i16) FMT(label16) FMT(npop) FMT(npopx) FMT(npop_u16) FMT(loc) FMT(arg) FMT(var_ref) FMT(u32) FMT(u32x2) FMT(i32) FMT(const) FMT(label) FMT(atom) FMT(atom_u8) FMT(atom_u16) FMT(atom_label_u8) FMT(atom_label_u16) FMT(label_u16) #undef FMT #endif /* FMT */ #ifdef DEF #ifndef def #define def(id, size, n_pop, n_push, f) DEF(id, size, n_pop, n_push, f) #endif DEF(invalid, 1, 0, 0, none) /* never emitted */ /* push values */ DEF( push_i32, 5, 0, 1, i32) DEF( push_const, 5, 0, 1, const) DEF( fclosure, 5, 0, 1, const) /* must follow push_const */ DEF(push_atom_value, 5, 0, 1, atom) DEF( private_symbol, 5, 0, 1, atom) DEF( undefined, 1, 0, 1, none) DEF( null, 1, 0, 1, none) DEF( push_this, 1, 0, 1, none) /* only used at the start of a function */ DEF( push_false, 1, 0, 1, none) DEF( push_true, 1, 0, 1, none) DEF( object, 1, 0, 1, none) DEF( special_object, 2, 0, 1, u8) /* only used at the start of a function */ DEF( rest, 3, 0, 1, u16) /* only used at the start of a function */ DEF( drop, 1, 1, 0, none) /* a -> */ DEF( nip, 1, 2, 1, none) /* a b -> b */ DEF( nip1, 1, 3, 2, none) /* a b c -> b c */ DEF( dup, 1, 1, 2, none) /* a -> a a */ DEF( dup1, 1, 2, 3, none) /* a b -> a a b */ DEF( dup2, 1, 2, 4, none) /* a b -> a b a b */ DEF( dup3, 1, 3, 6, none) /* a b c -> a b c a b c */ DEF( insert2, 1, 2, 3, none) /* obj a -> a obj a (dup_x1) */ DEF( insert3, 1, 3, 4, none) /* obj prop a -> a obj prop a (dup_x2) */ DEF( insert4, 1, 4, 5, none) /* this obj prop a -> a this obj prop a */ DEF( perm3, 1, 3, 3, none) /* obj a b -> a obj b */ DEF( perm4, 1, 4, 4, none) /* obj prop a b -> a obj prop b */ DEF( perm5, 1, 5, 5, none) /* this obj prop a b -> a this obj prop b */ DEF( swap, 1, 2, 2, none) /* a b -> b a */ DEF( swap2, 1, 4, 4, none) /* a b c d -> c d a b */ DEF( rot3l, 1, 3, 3, none) /* x a b -> a b x */ DEF( rot3r, 1, 3, 3, none) /* a b x -> x a b */ DEF( rot4l, 1, 4, 4, none) /* x a b c -> a b c x */ DEF( rot5l, 1, 5, 5, none) /* x a b c d -> a b c d x */ DEF(call_constructor, 3, 2, 1, npop) /* func new.target args -> ret. arguments are not counted in n_pop */ DEF( call, 3, 1, 1, npop) /* arguments are not counted in n_pop */ DEF( tail_call, 3, 1, 0, npop) /* arguments are not counted in n_pop */ DEF( call_method, 3, 2, 1, npop) /* arguments are not counted in n_pop */ DEF(tail_call_method, 3, 2, 0, npop) /* arguments are not counted in n_pop */ DEF( array_from, 3, 0, 1, npop) /* arguments are not counted in n_pop */ DEF( apply, 3, 3, 1, u16) DEF( return, 1, 1, 0, none) DEF( return_undef, 1, 0, 0, none) DEF(check_ctor_return, 1, 1, 2, none) DEF( check_ctor, 1, 0, 0, none) DEF( init_ctor, 1, 0, 1, none) DEF( check_brand, 1, 2, 2, none) /* this_obj func -> this_obj func */ DEF( add_brand, 1, 2, 0, none) /* this_obj home_obj -> */ DEF( return_async, 1, 1, 0, none) DEF( throw, 1, 1, 0, none) DEF( throw_error, 6, 0, 0, atom_u8) DEF( eval, 5, 1, 1, npop_u16) /* func args... -> ret_val */ DEF( apply_eval, 3, 2, 1, u16) /* func array -> ret_eval */ DEF( regexp, 1, 2, 1, none) /* create a RegExp object from the pattern and a bytecode string */ DEF( get_super, 1, 1, 1, none) DEF( import, 1, 1, 1, none) /* dynamic module import */ DEF( check_var, 5, 0, 1, atom) /* check if a variable exists */ DEF( get_var_undef, 5, 0, 1, atom) /* push undefined if the variable does not exist */ DEF( get_var, 5, 0, 1, atom) /* throw an exception if the variable does not exist */ DEF( put_var, 5, 1, 0, atom) /* must come after get_var */ DEF( put_var_init, 5, 1, 0, atom) /* must come after put_var. Used to initialize a global lexical variable */ DEF( put_var_strict, 5, 2, 0, atom) /* for strict mode variable write */ DEF( get_ref_value, 1, 2, 3, none) DEF( put_ref_value, 1, 3, 0, none) DEF( define_var, 6, 0, 0, atom_u8) DEF(check_define_var, 6, 0, 0, atom_u8) DEF( define_func, 6, 1, 0, atom_u8) // order matters, see IC counterparts DEF( get_field, 5, 1, 1, atom) DEF( get_field2, 5, 1, 2, atom) DEF( put_field, 5, 2, 0, atom) DEF( get_private_field, 1, 2, 1, none) /* obj prop -> value */ DEF( put_private_field, 1, 3, 0, none) /* obj value prop -> */ DEF(define_private_field, 1, 3, 1, none) /* obj prop value -> obj */ DEF( get_array_el, 1, 2, 1, none) DEF( get_array_el2, 1, 2, 2, none) /* obj prop -> obj value */ DEF( put_array_el, 1, 3, 0, none) DEF(get_super_value, 1, 3, 1, none) /* this obj prop -> value */ DEF(put_super_value, 1, 4, 0, none) /* this obj prop value -> */ DEF( define_field, 5, 2, 1, atom) DEF( set_name, 5, 1, 1, atom) DEF(set_name_computed, 1, 2, 2, none) DEF( set_proto, 1, 2, 1, none) DEF(set_home_object, 1, 2, 2, none) DEF(define_array_el, 1, 3, 2, none) DEF( append, 1, 3, 2, none) /* append enumerated object, update length */ DEF(copy_data_properties, 2, 3, 3, u8) DEF( define_method, 6, 2, 1, atom_u8) DEF(define_method_computed, 2, 3, 1, u8) /* must come after define_method */ DEF( define_class, 6, 2, 2, atom_u8) /* parent ctor -> ctor proto */ DEF( define_class_computed, 6, 3, 3, atom_u8) /* field_name parent ctor -> field_name ctor proto (class with computed name) */ DEF( get_loc, 3, 0, 1, loc) DEF( put_loc, 3, 1, 0, loc) /* must come after get_loc */ DEF( set_loc, 3, 1, 1, loc) /* must come after put_loc */ DEF( get_arg, 3, 0, 1, arg) DEF( put_arg, 3, 1, 0, arg) /* must come after get_arg */ DEF( set_arg, 3, 1, 1, arg) /* must come after put_arg */ DEF( get_var_ref, 3, 0, 1, var_ref) DEF( put_var_ref, 3, 1, 0, var_ref) /* must come after get_var_ref */ DEF( set_var_ref, 3, 1, 1, var_ref) /* must come after put_var_ref */ DEF(set_loc_uninitialized, 3, 0, 0, loc) DEF( get_loc_check, 3, 0, 1, loc) DEF( put_loc_check, 3, 1, 0, loc) /* must come after get_loc_check */ DEF( put_loc_check_init, 3, 1, 0, loc) DEF(get_var_ref_check, 3, 0, 1, var_ref) DEF(put_var_ref_check, 3, 1, 0, var_ref) /* must come after get_var_ref_check */ DEF(put_var_ref_check_init, 3, 1, 0, var_ref) DEF( close_loc, 3, 0, 0, loc) DEF( if_false, 5, 1, 0, label) DEF( if_true, 5, 1, 0, label) /* must come after if_false */ DEF( goto, 5, 0, 0, label) /* must come after if_true */ DEF( catch, 5, 0, 1, label) DEF( gosub, 5, 0, 0, label) /* used to execute the finally block */ DEF( ret, 1, 1, 0, none) /* used to return from the finally block */ DEF( nip_catch, 1, 2, 1, none) /* catch ... a -> a */ DEF( to_object, 1, 1, 1, none) //DEF( to_string, 1, 1, 1, none) DEF( to_propkey, 1, 1, 1, none) DEF( to_propkey2, 1, 2, 2, none) DEF( with_get_var, 10, 1, 0, atom_label_u8) /* must be in the same order as scope_xxx */ DEF( with_put_var, 10, 2, 1, atom_label_u8) /* must be in the same order as scope_xxx */ DEF(with_delete_var, 10, 1, 0, atom_label_u8) /* must be in the same order as scope_xxx */ DEF( with_make_ref, 10, 1, 0, atom_label_u8) /* must be in the same order as scope_xxx */ DEF( with_get_ref, 10, 1, 0, atom_label_u8) /* must be in the same order as scope_xxx */ DEF(with_get_ref_undef, 10, 1, 0, atom_label_u8) DEF( make_loc_ref, 7, 0, 2, atom_u16) DEF( make_arg_ref, 7, 0, 2, atom_u16) DEF(make_var_ref_ref, 7, 0, 2, atom_u16) DEF( make_var_ref, 5, 0, 2, atom) DEF( for_in_start, 1, 1, 1, none) DEF( for_of_start, 1, 1, 3, none) DEF(for_await_of_start, 1, 1, 3, none) DEF( for_in_next, 1, 1, 3, none) DEF( for_of_next, 2, 3, 5, u8) DEF(iterator_check_object, 1, 1, 1, none) DEF(iterator_get_value_done, 1, 1, 2, none) DEF( iterator_close, 1, 3, 0, none) DEF( iterator_next, 1, 4, 4, none) DEF( iterator_call, 2, 4, 5, u8) DEF( initial_yield, 1, 0, 0, none) DEF( yield, 1, 1, 2, none) DEF( yield_star, 1, 1, 2, none) DEF(async_yield_star, 1, 1, 2, none) DEF( await, 1, 1, 1, none) /* arithmetic/logic operations */ DEF( neg, 1, 1, 1, none) DEF( plus, 1, 1, 1, none) DEF( dec, 1, 1, 1, none) DEF( inc, 1, 1, 1, none) DEF( post_dec, 1, 1, 2, none) DEF( post_inc, 1, 1, 2, none) DEF( dec_loc, 2, 0, 0, loc8) DEF( inc_loc, 2, 0, 0, loc8) DEF( add_loc, 2, 1, 0, loc8) DEF( not, 1, 1, 1, none) DEF( lnot, 1, 1, 1, none) DEF( typeof, 1, 1, 1, none) DEF( delete, 1, 2, 1, none) DEF( delete_var, 5, 0, 1, atom) /* warning: order matters (see js_parse_assign_expr) */ DEF( mul, 1, 2, 1, none) DEF( div, 1, 2, 1, none) DEF( mod, 1, 2, 1, none) DEF( add, 1, 2, 1, none) DEF( sub, 1, 2, 1, none) DEF( shl, 1, 2, 1, none) DEF( sar, 1, 2, 1, none) DEF( shr, 1, 2, 1, none) DEF( and, 1, 2, 1, none) DEF( xor, 1, 2, 1, none) DEF( or, 1, 2, 1, none) DEF( pow, 1, 2, 1, none) DEF( lt, 1, 2, 1, none) DEF( lte, 1, 2, 1, none) DEF( gt, 1, 2, 1, none) DEF( gte, 1, 2, 1, none) DEF( instanceof, 1, 2, 1, none) DEF( in, 1, 2, 1, none) DEF( eq, 1, 2, 1, none) DEF( neq, 1, 2, 1, none) DEF( strict_eq, 1, 2, 1, none) DEF( strict_neq, 1, 2, 1, none) DEF(is_undefined_or_null, 1, 1, 1, none) DEF( private_in, 1, 2, 1, none) DEF(push_bigint_i32, 5, 0, 1, i32) /* must be the last non short and non temporary opcode */ DEF( nop, 1, 0, 0, none) /* temporary opcodes: never emitted in the final bytecode */ def( enter_scope, 3, 0, 0, u16) /* emitted in phase 1, removed in phase 2 */ def( leave_scope, 3, 0, 0, u16) /* emitted in phase 1, removed in phase 2 */ def( label, 5, 0, 0, label) /* emitted in phase 1, removed in phase 3 */ def(scope_get_var_undef, 7, 0, 1, atom_u16) /* emitted in phase 1, removed in phase 2 */ def( scope_get_var, 7, 0, 1, atom_u16) /* emitted in phase 1, removed in phase 2 */ def( scope_put_var, 7, 1, 0, atom_u16) /* emitted in phase 1, removed in phase 2 */ def(scope_delete_var, 7, 0, 1, atom_u16) /* emitted in phase 1, removed in phase 2 */ def( scope_make_ref, 11, 0, 2, atom_label_u16) /* emitted in phase 1, removed in phase 2 */ def( scope_get_ref, 7, 0, 2, atom_u16) /* emitted in phase 1, removed in phase 2 */ def(scope_put_var_init, 7, 0, 2, atom_u16) /* emitted in phase 1, removed in phase 2 */ def(scope_get_private_field, 7, 1, 1, atom_u16) /* obj -> value, emitted in phase 1, removed in phase 2 */ def(scope_get_private_field2, 7, 1, 2, atom_u16) /* obj -> obj value, emitted in phase 1, removed in phase 2 */ def(scope_put_private_field, 7, 2, 0, atom_u16) /* obj value ->, emitted in phase 1, removed in phase 2 */ def(scope_in_private_field, 7, 1, 1, atom_u16) /* obj -> res emitted in phase 1, removed in phase 2 */ def(get_field_opt_chain, 5, 1, 1, atom) /* emitted in phase 1, removed in phase 2 */ def(get_array_el_opt_chain, 1, 2, 1, none) /* emitted in phase 1, removed in phase 2 */ def( set_class_name, 5, 1, 1, u32) /* emitted in phase 1, removed in phase 2 */ def( source_loc, 9, 0, 0, u32x2) /* emitted in phase 1, removed in phase 3 */ DEF( push_minus1, 1, 0, 1, none_int) DEF( push_0, 1, 0, 1, none_int) DEF( push_1, 1, 0, 1, none_int) DEF( push_2, 1, 0, 1, none_int) DEF( push_3, 1, 0, 1, none_int) DEF( push_4, 1, 0, 1, none_int) DEF( push_5, 1, 0, 1, none_int) DEF( push_6, 1, 0, 1, none_int) DEF( push_7, 1, 0, 1, none_int) DEF( push_i8, 2, 0, 1, i8) DEF( push_i16, 3, 0, 1, i16) DEF( push_const8, 2, 0, 1, const8) DEF( fclosure8, 2, 0, 1, const8) /* must follow push_const8 */ DEF(push_empty_string, 1, 0, 1, none) DEF( get_loc8, 2, 0, 1, loc8) DEF( put_loc8, 2, 1, 0, loc8) DEF( set_loc8, 2, 1, 1, loc8) DEF( get_loc0_loc1, 1, 0, 2, none_loc) DEF( get_loc0, 1, 0, 1, none_loc) DEF( get_loc1, 1, 0, 1, none_loc) DEF( get_loc2, 1, 0, 1, none_loc) DEF( get_loc3, 1, 0, 1, none_loc) DEF( put_loc0, 1, 1, 0, none_loc) DEF( put_loc1, 1, 1, 0, none_loc) DEF( put_loc2, 1, 1, 0, none_loc) DEF( put_loc3, 1, 1, 0, none_loc) DEF( set_loc0, 1, 1, 1, none_loc) DEF( set_loc1, 1, 1, 1, none_loc) DEF( set_loc2, 1, 1, 1, none_loc) DEF( set_loc3, 1, 1, 1, none_loc) DEF( get_arg0, 1, 0, 1, none_arg) DEF( get_arg1, 1, 0, 1, none_arg) DEF( get_arg2, 1, 0, 1, none_arg) DEF( get_arg3, 1, 0, 1, none_arg) DEF( put_arg0, 1, 1, 0, none_arg) DEF( put_arg1, 1, 1, 0, none_arg) DEF( put_arg2, 1, 1, 0, none_arg) DEF( put_arg3, 1, 1, 0, none_arg) DEF( set_arg0, 1, 1, 1, none_arg) DEF( set_arg1, 1, 1, 1, none_arg) DEF( set_arg2, 1, 1, 1, none_arg) DEF( set_arg3, 1, 1, 1, none_arg) DEF( get_var_ref0, 1, 0, 1, none_var_ref) DEF( get_var_ref1, 1, 0, 1, none_var_ref) DEF( get_var_ref2, 1, 0, 1, none_var_ref) DEF( get_var_ref3, 1, 0, 1, none_var_ref) DEF( put_var_ref0, 1, 1, 0, none_var_ref) DEF( put_var_ref1, 1, 1, 0, none_var_ref) DEF( put_var_ref2, 1, 1, 0, none_var_ref) DEF( put_var_ref3, 1, 1, 0, none_var_ref) DEF( set_var_ref0, 1, 1, 1, none_var_ref) DEF( set_var_ref1, 1, 1, 1, none_var_ref) DEF( set_var_ref2, 1, 1, 1, none_var_ref) DEF( set_var_ref3, 1, 1, 1, none_var_ref) DEF( get_length, 1, 1, 1, none) DEF( if_false8, 2, 1, 0, label8) DEF( if_true8, 2, 1, 0, label8) /* must come after if_false8 */ DEF( goto8, 2, 0, 0, label8) /* must come after if_true8 */ DEF( goto16, 3, 0, 0, label16) DEF( call0, 1, 1, 1, npopx) DEF( call1, 1, 1, 1, npopx) DEF( call2, 1, 1, 1, npopx) DEF( call3, 1, 1, 1, npopx) DEF( is_undefined, 1, 1, 1, none) DEF( is_null, 1, 1, 1, none) DEF(typeof_is_undefined, 1, 1, 1, none) DEF( typeof_is_function, 1, 1, 1, none) #undef DEF #undef def #endif /* DEF */ qbs-src-3.2.0/src/shared/quickjs/LICENSE0000644000175100017510000000227415154533055017222 0ustar runnerrunnerThe MIT License (MIT) Copyright (c) 2017-2024 Fabrice Bellard Copyright (c) 2017-2024 Charlie Gordon Copyright (c) 2023-2025 Ben Noordhuis Copyright (c) 2023-2025 Saúl Ibarra Corretgé Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. qbs-src-3.2.0/src/shared/quickjs/cutils.h0000644000175100017510000003645315154533055017677 0ustar runnerrunner/* * C utilities * * Copyright (c) 2017 Fabrice Bellard * Copyright (c) 2018 Charlie Gordon * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef CUTILS_H #define CUTILS_H #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif #if defined(_MSC_VER) #include #define alloca _alloca #define ssize_t ptrdiff_t #endif #if defined(__APPLE__) #include #elif defined(__linux__) || defined(__ANDROID__) || defined(__CYGWIN__) || defined(__GLIBC__) #include #elif defined(__FreeBSD__) #include #elif defined(_WIN32) #include #endif #if !defined(_WIN32) && !defined(EMSCRIPTEN) && !defined(__wasi__) #include #include #endif #if !defined(_WIN32) #include #include #endif #if defined(_MSC_VER) && !defined(__clang__) # define likely(x) (x) # define unlikely(x) (x) # define force_inline __forceinline # define no_inline __declspec(noinline) # define __maybe_unused # define __attribute__(x) # define __attribute(x) #else # define likely(x) __builtin_expect(!!(x), 1) # define unlikely(x) __builtin_expect(!!(x), 0) # define force_inline inline __attribute__((always_inline)) # define no_inline __attribute__((noinline)) # define __maybe_unused __attribute__((unused)) #endif #if defined(_MSC_VER) && !defined(__clang__) #include #define INF INFINITY #define NEG_INF -INFINITY #else #define INF (1.0/0.0) #define NEG_INF (-1.0/0.0) #endif #ifndef offsetof #define offsetof(type, field) ((size_t) &((type *)0)->field) #endif #ifndef countof #define countof(x) (sizeof(x) / sizeof((x)[0])) #ifndef endof #define endof(x) ((x) + countof(x)) #endif #endif #ifndef container_of /* return the pointer of type 'type *' containing 'ptr' as field 'member' */ #define container_of(ptr, type, member) ((type *)((uint8_t *)(ptr) - offsetof(type, member))) #endif #if defined(_MSC_VER) || defined(__cplusplus) #define minimum_length(n) n #else #define minimum_length(n) static n #endif /* Borrowed from Folly */ #ifndef JS_PRINTF_FORMAT #ifdef _MSC_VER #include #define JS_PRINTF_FORMAT _Printf_format_string_ #define JS_PRINTF_FORMAT_ATTR(format_param, dots_param) #else #define JS_PRINTF_FORMAT #if !defined(__clang__) && defined(__GNUC__) #define JS_PRINTF_FORMAT_ATTR(format_param, dots_param) \ __attribute__((format(gnu_printf, format_param, dots_param))) #else #define JS_PRINTF_FORMAT_ATTR(format_param, dots_param) \ __attribute__((format(printf, format_param, dots_param))) #endif #endif #endif #if defined(PATH_MAX) # define JS__PATH_MAX PATH_MAX #elif defined(_WIN32) # define JS__PATH_MAX 32767 #else # define JS__PATH_MAX 8192 #endif void js__pstrcpy(char *buf, int buf_size, const char *str); char *js__pstrcat(char *buf, int buf_size, const char *s); int js__strstart(const char *str, const char *val, const char **ptr); int js__has_suffix(const char *str, const char *suffix); static inline uint8_t is_be(void) { union { uint16_t a; uint8_t b; } u = { 0x100 }; return u.b; } static inline int max_int(int a, int b) { if (a > b) return a; else return b; } static inline int min_int(int a, int b) { if (a < b) return a; else return b; } static inline uint32_t max_uint32(uint32_t a, uint32_t b) { if (a > b) return a; else return b; } static inline uint32_t min_uint32(uint32_t a, uint32_t b) { if (a < b) return a; else return b; } static inline int64_t max_int64(int64_t a, int64_t b) { if (a > b) return a; else return b; } static inline int64_t min_int64(int64_t a, int64_t b) { if (a < b) return a; else return b; } /* WARNING: undefined if a = 0 */ static inline int clz32(unsigned int a) { #if defined(_MSC_VER) && !defined(__clang__) unsigned long index; _BitScanReverse(&index, a); return 31 - index; #else return __builtin_clz(a); #endif } /* WARNING: undefined if a = 0 */ static inline int clz64(uint64_t a) { #if defined(_MSC_VER) && !defined(__clang__) #if INTPTR_MAX == INT64_MAX unsigned long index; _BitScanReverse64(&index, a); return 63 - index; #else if (a >> 32) return clz32((unsigned)(a >> 32)); else return clz32((unsigned)a) + 32; #endif #else return __builtin_clzll(a); #endif } /* WARNING: undefined if a = 0 */ static inline int ctz32(unsigned int a) { #if defined(_MSC_VER) && !defined(__clang__) unsigned long index; _BitScanForward(&index, a); return index; #else return __builtin_ctz(a); #endif } /* WARNING: undefined if a = 0 */ static inline int ctz64(uint64_t a) { #if defined(_MSC_VER) && !defined(__clang__) unsigned long index; _BitScanForward64(&index, a); return index; #else return __builtin_ctzll(a); #endif } static inline uint64_t get_u64(const uint8_t *tab) { uint64_t v; memcpy(&v, tab, sizeof(v)); return v; } static inline int64_t get_i64(const uint8_t *tab) { int64_t v; memcpy(&v, tab, sizeof(v)); return v; } static inline void put_u64(uint8_t *tab, uint64_t val) { memcpy(tab, &val, sizeof(val)); } static inline uint32_t get_u32(const uint8_t *tab) { uint32_t v; memcpy(&v, tab, sizeof(v)); return v; } static inline int32_t get_i32(const uint8_t *tab) { int32_t v; memcpy(&v, tab, sizeof(v)); return v; } static inline void put_u32(uint8_t *tab, uint32_t val) { memcpy(tab, &val, sizeof(val)); } static inline uint32_t get_u16(const uint8_t *tab) { uint16_t v; memcpy(&v, tab, sizeof(v)); return v; } static inline int32_t get_i16(const uint8_t *tab) { int16_t v; memcpy(&v, tab, sizeof(v)); return v; } static inline void put_u16(uint8_t *tab, uint16_t val) { memcpy(tab, &val, sizeof(val)); } static inline uint32_t get_u8(const uint8_t *tab) { return *tab; } static inline int32_t get_i8(const uint8_t *tab) { return (int8_t)*tab; } static inline void put_u8(uint8_t *tab, uint8_t val) { *tab = val; } #ifndef bswap16 static inline uint16_t bswap16(uint16_t x) { return (x >> 8) | (x << 8); } #endif #ifndef bswap32 static inline uint32_t bswap32(uint32_t v) { return ((v & 0xff000000) >> 24) | ((v & 0x00ff0000) >> 8) | ((v & 0x0000ff00) << 8) | ((v & 0x000000ff) << 24); } #endif #ifndef bswap64 static inline uint64_t bswap64(uint64_t v) { return ((v & ((uint64_t)0xff << (7 * 8))) >> (7 * 8)) | ((v & ((uint64_t)0xff << (6 * 8))) >> (5 * 8)) | ((v & ((uint64_t)0xff << (5 * 8))) >> (3 * 8)) | ((v & ((uint64_t)0xff << (4 * 8))) >> (1 * 8)) | ((v & ((uint64_t)0xff << (3 * 8))) << (1 * 8)) | ((v & ((uint64_t)0xff << (2 * 8))) << (3 * 8)) | ((v & ((uint64_t)0xff << (1 * 8))) << (5 * 8)) | ((v & ((uint64_t)0xff << (0 * 8))) << (7 * 8)); } #endif static inline void inplace_bswap16(uint8_t *tab) { put_u16(tab, bswap16(get_u16(tab))); } static inline void inplace_bswap32(uint8_t *tab) { put_u32(tab, bswap32(get_u32(tab))); } static inline double fromfp16(uint16_t v) { double d, s; int e; if ((v & 0x7C00) == 0x7C00) { d = (v & 0x3FF) ? NAN : INFINITY; } else { d = (v & 0x3FF) / 1024.; e = (v & 0x7C00) >> 10; if (e == 0) { e = -14; } else { d += 1; e -= 15; } d = scalbn(d, e); } s = (v & 0x8000) ? -1.0 : 1.0; return d * s; } static inline uint16_t tofp16(double d) { uint16_t f, s; double t; int e; s = 0; if (copysign(1, d) < 0) { // preserve sign when |d| is negative zero d = -d; s = 0x8000; } if (isinf(d)) return s | 0x7C00; if (isnan(d)) return s | 0x7C01; if (d == 0) return s | 0; d = 2 * frexp(d, &e); e--; if (e > 15) return s | 0x7C00; // out of range, return +/-infinity if (e < -25) { d = 0; e = 0; } else if (e < -14) { d = scalbn(d, e + 14); e = 0; } else { d -= 1; e += 15; } d *= 1024.; f = (uint16_t)d; t = d - f; if (t < 0.5) goto done; if (t == 0.5) if ((f & 1) == 0) goto done; // adjust for rounding if (++f == 1024) { f = 0; if (++e == 31) return s | 0x7C00; // out of range, return +/-infinity } done: return s | (e << 10) | f; } static inline int isfp16nan(uint16_t v) { return (v & 0x7FFF) > 0x7C00; } static inline int isfp16zero(uint16_t v) { return (v & 0x7FFF) == 0; } /* XXX: should take an extra argument to pass slack information to the caller */ typedef void *DynBufReallocFunc(void *opaque, void *ptr, size_t size); typedef struct DynBuf { uint8_t *buf; size_t size; size_t allocated_size; bool error; /* true if a memory allocation error occurred */ DynBufReallocFunc *realloc_func; void *opaque; /* for realloc_func */ } DynBuf; void dbuf_init(DynBuf *s); void dbuf_init2(DynBuf *s, void *opaque, DynBufReallocFunc *realloc_func); int dbuf_realloc(DynBuf *s, size_t new_size); int dbuf_write(DynBuf *s, size_t offset, const void *data, size_t len); int dbuf_put(DynBuf *s, const void *data, size_t len); int dbuf_put_self(DynBuf *s, size_t offset, size_t len); int dbuf_putc(DynBuf *s, uint8_t c); int dbuf_putstr(DynBuf *s, const char *str); static inline int dbuf_put_u16(DynBuf *s, uint16_t val) { return dbuf_put(s, (uint8_t *)&val, 2); } static inline int dbuf_put_u32(DynBuf *s, uint32_t val) { return dbuf_put(s, (uint8_t *)&val, 4); } static inline int dbuf_put_u64(DynBuf *s, uint64_t val) { return dbuf_put(s, (uint8_t *)&val, 8); } int JS_PRINTF_FORMAT_ATTR(2, 3) dbuf_printf(DynBuf *s, JS_PRINTF_FORMAT const char *fmt, ...); void dbuf_free(DynBuf *s); static inline bool dbuf_error(DynBuf *s) { return s->error; } static inline void dbuf_set_error(DynBuf *s) { s->error = true; } /*---- UTF-8 and UTF-16 handling ----*/ #define UTF8_CHAR_LEN_MAX 4 enum { UTF8_PLAIN_ASCII = 0, // 7-bit ASCII plain text UTF8_NON_ASCII = 1, // has non ASCII code points (8-bit or more) UTF8_HAS_16BIT = 2, // has 16-bit code points UTF8_HAS_NON_BMP1 = 4, // has non-BMP1 code points, needs UTF-16 surrogate pairs UTF8_HAS_ERRORS = 8, // has encoding errors }; int utf8_scan(const char *buf, size_t len, size_t *plen); size_t utf8_encode_len(uint32_t c); size_t utf8_encode(uint8_t buf[minimum_length(UTF8_CHAR_LEN_MAX)], uint32_t c); uint32_t utf8_decode_len(const uint8_t *p, size_t max_len, const uint8_t **pp); uint32_t utf8_decode(const uint8_t *p, const uint8_t **pp); size_t utf8_decode_buf8(uint8_t *dest, size_t dest_len, const char *src, size_t src_len); size_t utf8_decode_buf16(uint16_t *dest, size_t dest_len, const char *src, size_t src_len); size_t utf8_encode_buf8(char *dest, size_t dest_len, const uint8_t *src, size_t src_len); size_t utf8_encode_buf16(char *dest, size_t dest_len, const uint16_t *src, size_t src_len); static inline bool is_surrogate(uint32_t c) { return (c >> 11) == (0xD800 >> 11); // 0xD800-0xDFFF } static inline bool is_hi_surrogate(uint32_t c) { return (c >> 10) == (0xD800 >> 10); // 0xD800-0xDBFF } static inline bool is_lo_surrogate(uint32_t c) { return (c >> 10) == (0xDC00 >> 10); // 0xDC00-0xDFFF } static inline uint32_t get_hi_surrogate(uint32_t c) { return (c >> 10) - (0x10000 >> 10) + 0xD800; } static inline uint32_t get_lo_surrogate(uint32_t c) { return (c & 0x3FF) | 0xDC00; } static inline uint32_t from_surrogate(uint32_t hi, uint32_t lo) { return 65536 + 1024 * (hi & 1023) + (lo & 1023); } static inline int from_hex(int c) { if (c >= '0' && c <= '9') return c - '0'; else if (c >= 'A' && c <= 'F') return c - 'A' + 10; else if (c >= 'a' && c <= 'f') return c - 'a' + 10; else return -1; } static inline uint8_t is_upper_ascii(uint8_t c) { return c >= 'A' && c <= 'Z'; } static inline uint8_t to_upper_ascii(uint8_t c) { return c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c; } void rqsort(void *base, size_t nmemb, size_t size, int (*cmp)(const void *, const void *, void *), void *arg); static inline uint64_t float64_as_uint64(double d) { union { double d; uint64_t u64; } u; u.d = d; return u.u64; } static inline double uint64_as_float64(uint64_t u64) { union { double d; uint64_t u64; } u; u.u64 = u64; return u.d; } int64_t js__gettimeofday_us(void); uint64_t js__hrtime_ns(void); static inline size_t js__malloc_usable_size(const void *ptr) { #if defined(__APPLE__) return malloc_size(ptr); #elif defined(_WIN32) return _msize((void *)ptr); #elif defined(__linux__) || defined(__ANDROID__) || defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__GLIBC__) return malloc_usable_size((void *)ptr); #else return 0; #endif } int js_exepath(char* buffer, size_t* size); /* Cross-platform threading APIs. */ #if defined(EMSCRIPTEN) || defined(__wasi__) #define JS_HAVE_THREADS 0 #else #define JS_HAVE_THREADS 1 #if defined(_WIN32) #define JS_ONCE_INIT INIT_ONCE_STATIC_INIT typedef INIT_ONCE js_once_t; typedef CRITICAL_SECTION js_mutex_t; typedef CONDITION_VARIABLE js_cond_t; typedef HANDLE js_thread_t; #else #define JS_ONCE_INIT PTHREAD_ONCE_INIT typedef pthread_once_t js_once_t; typedef pthread_mutex_t js_mutex_t; typedef pthread_cond_t js_cond_t; typedef pthread_t js_thread_t; #endif void js_once(js_once_t *guard, void (*callback)(void)); void js_mutex_init(js_mutex_t *mutex); void js_mutex_destroy(js_mutex_t *mutex); void js_mutex_lock(js_mutex_t *mutex); void js_mutex_unlock(js_mutex_t *mutex); void js_cond_init(js_cond_t *cond); void js_cond_destroy(js_cond_t *cond); void js_cond_signal(js_cond_t *cond); void js_cond_broadcast(js_cond_t *cond); void js_cond_wait(js_cond_t *cond, js_mutex_t *mutex); int js_cond_timedwait(js_cond_t *cond, js_mutex_t *mutex, uint64_t timeout); enum { JS_THREAD_CREATE_DETACHED = 1, }; // creates threads with 2 MB stacks (glibc default) int js_thread_create(js_thread_t *thrd, void (*start)(void *), void *arg, int flags); int js_thread_join(js_thread_t thrd); #endif /* !defined(EMSCRIPTEN) && !defined(__wasi__) */ #ifdef __cplusplus } /* extern "C" { */ #endif #endif /* CUTILS_H */ qbs-src-3.2.0/src/shared/quickjs/.clang-tidy0000644000175100017510000000010415154533055020237 0ustar runnerrunnerChecks: '-*,misc-definitions-in-headers' InheritParentConfig: true qbs-src-3.2.0/src/shared/quickjs/builtin-array-fromasync.h0000644000175100017510000001221415154533055023142 0ustar runnerrunner/* File generated automatically by the QuickJS-ng compiler. */ #include const uint32_t qjsc_builtin_array_fromasync_size = 826; const uint8_t qjsc_builtin_array_fromasync[826] = { 0x15, 0x0d, 0x01, 0x1a, 0x61, 0x73, 0x79, 0x6e, 0x63, 0x49, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x01, 0x10, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x01, 0x12, 0x61, 0x72, 0x72, 0x61, 0x79, 0x4c, 0x69, 0x6b, 0x65, 0x01, 0x0a, 0x6d, 0x61, 0x70, 0x46, 0x6e, 0x01, 0x0e, 0x74, 0x68, 0x69, 0x73, 0x41, 0x72, 0x67, 0x01, 0x0c, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x01, 0x02, 0x69, 0x01, 0x1a, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, 0x01, 0x08, 0x73, 0x79, 0x6e, 0x63, 0x01, 0x0c, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x01, 0x08, 0x69, 0x74, 0x65, 0x72, 0x01, 0x1c, 0x6e, 0x6f, 0x74, 0x20, 0x61, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x01, 0x08, 0x63, 0x61, 0x6c, 0x6c, 0x0c, 0x00, 0x02, 0x00, 0xa2, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x04, 0x01, 0xa4, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x43, 0x02, 0x01, 0x00, 0x05, 0x00, 0x05, 0x01, 0x00, 0x01, 0x03, 0x05, 0xaa, 0x02, 0x00, 0x01, 0x40, 0xa0, 0x03, 0x00, 0x01, 0x40, 0xc6, 0x03, 0x00, 0x01, 0x40, 0xcc, 0x01, 0x00, 0x01, 0x40, 0xc8, 0x03, 0x00, 0x01, 0x40, 0x0c, 0x60, 0x02, 0x01, 0xf8, 0x01, 0x03, 0x0e, 0x01, 0x06, 0x05, 0x00, 0x86, 0x04, 0x11, 0xca, 0x03, 0x00, 0x01, 0x00, 0xcc, 0x03, 0x00, 0x01, 0x00, 0xce, 0x03, 0x00, 0x01, 0x00, 0xca, 0x03, 0x01, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x20, 0xcc, 0x03, 0x01, 0x01, 0x20, 0xce, 0x03, 0x01, 0x02, 0x20, 0xd0, 0x03, 0x02, 0x00, 0x20, 0xd2, 0x03, 0x02, 0x04, 0x20, 0xd4, 0x03, 0x02, 0x05, 0x20, 0xd6, 0x03, 0x02, 0x06, 0x20, 0xd8, 0x03, 0x02, 0x07, 0x20, 0x64, 0x06, 0x08, 0x20, 0x82, 0x01, 0x07, 0x09, 0x20, 0xda, 0x03, 0x0a, 0x08, 0x30, 0x82, 0x01, 0x0d, 0x0b, 0x20, 0xd4, 0x01, 0x0d, 0x0c, 0x20, 0x10, 0x00, 0x01, 0x00, 0xa0, 0x03, 0x01, 0x03, 0xc6, 0x03, 0x02, 0x03, 0xc8, 0x03, 0x04, 0x03, 0xaa, 0x02, 0x00, 0x03, 0xcc, 0x01, 0x03, 0x03, 0x08, 0xc4, 0x0d, 0x62, 0x02, 0x00, 0x62, 0x01, 0x00, 0x62, 0x00, 0x00, 0xd3, 0xcb, 0xd4, 0x11, 0xf4, 0xec, 0x08, 0x0e, 0x39, 0x46, 0x00, 0x00, 0x00, 0xdc, 0xcc, 0xd5, 0x11, 0xf4, 0xec, 0x08, 0x0e, 0x39, 0x46, 0x00, 0x00, 0x00, 0xdd, 0xcd, 0x62, 0x07, 0x00, 0x62, 0x06, 0x00, 0x62, 0x05, 0x00, 0x62, 0x04, 0x00, 0x62, 0x03, 0x00, 0xd4, 0x39, 0x46, 0x00, 0x00, 0x00, 0xb0, 0xec, 0x16, 0xd4, 0x98, 0x04, 0x1b, 0x00, 0x00, 0x00, 0xb0, 0xec, 0x0c, 0xdf, 0x11, 0x04, 0xee, 0x00, 0x00, 0x00, 0x21, 0x01, 0x00, 0x30, 0x06, 0xce, 0xb6, 0xc4, 0x04, 0xc3, 0x0d, 0xf7, 0xc4, 0x05, 0x09, 0xc4, 0x06, 0xd3, 0xe0, 0x48, 0xc4, 0x07, 0x63, 0x07, 0x00, 0x07, 0xad, 0xec, 0x0f, 0x0a, 0x11, 0x64, 0x06, 0x00, 0x0e, 0xd3, 0xe1, 0x48, 0x11, 0x64, 0x07, 0x00, 0x0e, 0x63, 0x07, 0x00, 0x07, 0xad, 0x6a, 0xa6, 0x00, 0x00, 0x00, 0x62, 0x08, 0x00, 0x06, 0x11, 0xf4, 0xed, 0x0c, 0x71, 0x43, 0x32, 0x00, 0x00, 0x00, 0xc4, 0x08, 0x0e, 0xee, 0x05, 0x0e, 0xd3, 0xee, 0xf2, 0x63, 0x08, 0x00, 0x8e, 0x11, 0xed, 0x03, 0x0e, 0xb6, 0x11, 0x64, 0x08, 0x00, 0x0e, 0x63, 0x05, 0x00, 0xec, 0x0c, 0xc3, 0x0d, 0x11, 0x63, 0x08, 0x00, 0x21, 0x01, 0x00, 0xee, 0x06, 0xe2, 0x63, 0x08, 0x00, 0xf1, 0x11, 0x64, 0x03, 0x00, 0x0e, 0x63, 0x04, 0x00, 0x63, 0x08, 0x00, 0xa7, 0x6a, 0x2a, 0x01, 0x00, 0x00, 0x62, 0x09, 0x00, 0xd3, 0x63, 0x04, 0x00, 0x48, 0xc4, 0x09, 0x63, 0x06, 0x00, 0xec, 0x0a, 0x63, 0x09, 0x00, 0x8c, 0x11, 0x64, 0x09, 0x00, 0x0e, 0xd4, 0xec, 0x17, 0xd4, 0x43, 0xef, 0x00, 0x00, 0x00, 0xd5, 0x63, 0x09, 0x00, 0x63, 0x04, 0x00, 0x24, 0x03, 0x00, 0x8c, 0x11, 0x64, 0x09, 0x00, 0x0e, 0x5f, 0x04, 0x00, 0x63, 0x03, 0x00, 0x63, 0x04, 0x00, 0x92, 0x64, 0x04, 0x00, 0x0b, 0x63, 0x09, 0x00, 0x4d, 0x41, 0x00, 0x00, 0x00, 0x0a, 0x4d, 0x3e, 0x00, 0x00, 0x00, 0x0a, 0x4d, 0x3f, 0x00, 0x00, 0x00, 0xf3, 0x0e, 0xee, 0x9e, 0x62, 0x0a, 0x00, 0x63, 0x07, 0x00, 0x43, 0xef, 0x00, 0x00, 0x00, 0xd3, 0x24, 0x01, 0x00, 0xc4, 0x0a, 0x63, 0x05, 0x00, 0xec, 0x09, 0xc3, 0x0d, 0x11, 0x21, 0x00, 0x00, 0xee, 0x03, 0xe2, 0xf0, 0x11, 0x64, 0x03, 0x00, 0x0e, 0x6d, 0x8c, 0x00, 0x00, 0x00, 0x62, 0x0c, 0x00, 0x62, 0x0b, 0x00, 0x06, 0x11, 0xf4, 0xed, 0x13, 0x71, 0x43, 0x41, 0x00, 0x00, 0x00, 0xc4, 0x0b, 0x43, 0x6a, 0x00, 0x00, 0x00, 0xc4, 0x0c, 0x0e, 0xee, 0x10, 0x0e, 0x63, 0x0a, 0x00, 0x43, 0x6b, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x8c, 0xee, 0xe0, 0x63, 0x0c, 0x00, 0xed, 0x4e, 0x63, 0x06, 0x00, 0xec, 0x0a, 0x63, 0x0b, 0x00, 0x8c, 0x11, 0x64, 0x0b, 0x00, 0x0e, 0xd4, 0xec, 0x17, 0xd4, 0x43, 0xef, 0x00, 0x00, 0x00, 0xd5, 0x63, 0x0b, 0x00, 0x63, 0x04, 0x00, 0x24, 0x03, 0x00, 0x8c, 0x11, 0x64, 0x0b, 0x00, 0x0e, 0x5f, 0x04, 0x00, 0x63, 0x03, 0x00, 0x63, 0x04, 0x00, 0x92, 0x64, 0x04, 0x00, 0x0b, 0x63, 0x0b, 0x00, 0x4d, 0x41, 0x00, 0x00, 0x00, 0x0a, 0x4d, 0x3e, 0x00, 0x00, 0x00, 0x0a, 0x4d, 0x3f, 0x00, 0x00, 0x00, 0xf3, 0x0e, 0xee, 0x83, 0x0e, 0x06, 0x6e, 0x0d, 0x00, 0x00, 0x00, 0x0e, 0xee, 0x1e, 0x6e, 0x05, 0x00, 0x00, 0x00, 0x30, 0x63, 0x0a, 0x00, 0x42, 0x06, 0x00, 0x00, 0x00, 0xec, 0x0d, 0x63, 0x0a, 0x00, 0x43, 0x06, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x0e, 0x6f, 0x63, 0x03, 0x00, 0x63, 0x04, 0x00, 0x44, 0x32, 0x00, 0x00, 0x00, 0x63, 0x03, 0x00, 0x2f, 0xc1, 0x00, 0x28, 0xc1, 0x00, 0xcf, 0x28, }; qbs-src-3.2.0/src/shared/quickjs/libbf.c0000644000175100017510000072216215154533055017444 0ustar runnerrunner/* * Tiny arbitrary precision floating point library * * Copyright (c) 2017-2021 Fabrice Bellard * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include #include #include #include #include #ifdef __AVX2__ #include #endif #include "cutils.h" #include "libbf.h" /* enable it to check the multiplication result */ //#define USE_MUL_CHECK /* enable it to use FFT/NTT multiplication */ #define USE_FFT_MUL /* enable decimal floating point support */ #define USE_BF_DEC //#define inline __attribute__((always_inline)) #ifdef __AVX2__ #define FFT_MUL_THRESHOLD 100 /* in limbs of the smallest factor */ #else #define FFT_MUL_THRESHOLD 100 /* in limbs of the smallest factor */ #endif /* XXX: adjust */ #define DIVNORM_LARGE_THRESHOLD 50 #define UDIV1NORM_THRESHOLD 3 #if LIMB_BITS == 64 #define FMT_LIMB1 "%" PRIx64 #define FMT_LIMB "%016" PRIx64 #define PRId_LIMB PRId64 #define PRIu_LIMB PRIu64 #else #define FMT_LIMB1 "%x" #define FMT_LIMB "%08x" #define PRId_LIMB "d" #define PRIu_LIMB "u" #endif typedef intptr_t mp_size_t; typedef int bf_op2_func_t(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags); #ifdef USE_FFT_MUL #define FFT_MUL_R_OVERLAP_A (1 << 0) #define FFT_MUL_R_OVERLAP_B (1 << 1) #define FFT_MUL_R_NORESIZE (1 << 2) static no_inline int fft_mul(bf_context_t *s, bf_t *res, limb_t *a_tab, limb_t a_len, limb_t *b_tab, limb_t b_len, int mul_flags); static void fft_clear_cache(bf_context_t *s); #endif #ifdef USE_BF_DEC static limb_t get_digit(const limb_t *tab, limb_t len, slimb_t pos); #endif /* could leading zeros */ static inline int clz(limb_t a) { if (a == 0) { return LIMB_BITS; } else { #if LIMB_BITS == 64 return clz64(a); #else return clz32(a); #endif } } static inline int ctz(limb_t a) { if (a == 0) { return LIMB_BITS; } else { #if LIMB_BITS == 64 return ctz64(a); #else return ctz32(a); #endif } } static inline int ceil_log2(limb_t a) { if (a <= 1) return 0; else return LIMB_BITS - clz(a - 1); } /* b must be >= 1 */ static inline slimb_t ceil_div(slimb_t a, slimb_t b) { if (a >= 0) return (a + b - 1) / b; else return a / b; } /* b must be >= 1 */ static inline slimb_t floor_div(slimb_t a, slimb_t b) { if (a >= 0) { return a / b; } else { return (a - b + 1) / b; } } /* return r = a modulo b (0 <= r <= b - 1. b must be >= 1 */ static inline limb_t smod(slimb_t a, slimb_t b) { a = a % (slimb_t)b; if (a < 0) a += b; return a; } /* signed addition with saturation */ static inline slimb_t sat_add(slimb_t a, slimb_t b) { slimb_t r; r = a + b; /* overflow ? */ if (((a ^ r) & (b ^ r)) < 0) r = (a >> (LIMB_BITS - 1)) ^ (((limb_t)1 << (LIMB_BITS - 1)) - 1); return r; } static inline __maybe_unused limb_t shrd(limb_t low, limb_t high, long shift) { if (shift != 0) low = (low >> shift) | (high << (LIMB_BITS - shift)); return low; } static inline __maybe_unused limb_t shld(limb_t a1, limb_t a0, long shift) { if (shift != 0) return (a1 << shift) | (a0 >> (LIMB_BITS - shift)); else return a1; } #define malloc(s) malloc_is_forbidden(s) #define free(p) free_is_forbidden(p) #define realloc(p, s) realloc_is_forbidden(p, s) void bf_context_init(bf_context_t *s, bf_realloc_func_t *realloc_func, void *realloc_opaque) { memset(s, 0, sizeof(*s)); s->realloc_func = realloc_func; s->realloc_opaque = realloc_opaque; } void bf_context_end(bf_context_t *s) { bf_clear_cache(s); } void bf_init(bf_context_t *s, bf_t *r) { r->ctx = s; r->sign = 0; r->expn = BF_EXP_ZERO; r->len = 0; r->tab = NULL; } /* return 0 if OK, -1 if alloc error */ int bf_resize(bf_t *r, limb_t len) { limb_t *tab; if (len != r->len) { tab = bf_realloc(r->ctx, r->tab, len * sizeof(limb_t)); if (!tab && len != 0) return -1; r->tab = tab; r->len = len; } return 0; } /* return 0 or BF_ST_MEM_ERROR */ int bf_set_ui(bf_t *r, uint64_t a) { r->sign = 0; if (a == 0) { r->expn = BF_EXP_ZERO; bf_resize(r, 0); /* cannot fail */ } #if LIMB_BITS == 32 else if (a <= 0xffffffff) #else else #endif { int shift; if (bf_resize(r, 1)) goto fail; shift = clz(a); r->tab[0] = a << shift; r->expn = LIMB_BITS - shift; } #if LIMB_BITS == 32 else { uint32_t a1, a0; int shift; if (bf_resize(r, 2)) goto fail; a0 = a; a1 = a >> 32; shift = clz(a1); r->tab[0] = a0 << shift; r->tab[1] = shld(a1, a0, shift); r->expn = 2 * LIMB_BITS - shift; } #endif return 0; fail: bf_set_nan(r); return BF_ST_MEM_ERROR; } /* return 0 or BF_ST_MEM_ERROR */ int bf_set_si(bf_t *r, int64_t a) { int ret; if (a < 0) { ret = bf_set_ui(r, -a); r->sign = 1; } else { ret = bf_set_ui(r, a); } return ret; } void bf_set_nan(bf_t *r) { bf_resize(r, 0); /* cannot fail */ r->expn = BF_EXP_NAN; r->sign = 0; } void bf_set_zero(bf_t *r, int is_neg) { bf_resize(r, 0); /* cannot fail */ r->expn = BF_EXP_ZERO; r->sign = is_neg; } void bf_set_inf(bf_t *r, int is_neg) { bf_resize(r, 0); /* cannot fail */ r->expn = BF_EXP_INF; r->sign = is_neg; } /* return 0 or BF_ST_MEM_ERROR */ int bf_set(bf_t *r, const bf_t *a) { if (r == a) return 0; if (bf_resize(r, a->len)) { bf_set_nan(r); return BF_ST_MEM_ERROR; } r->sign = a->sign; r->expn = a->expn; if (a->len > 0) memcpy(r->tab, a->tab, a->len * sizeof(limb_t)); return 0; } /* equivalent to bf_set(r, a); bf_delete(a) */ void bf_move(bf_t *r, bf_t *a) { bf_context_t *s = r->ctx; if (r == a) return; bf_free(s, r->tab); *r = *a; } static limb_t get_limbz(const bf_t *a, limb_t idx) { if (idx >= a->len) return 0; else return a->tab[idx]; } /* get LIMB_BITS at bit position 'pos' in tab */ static inline limb_t get_bits(const limb_t *tab, limb_t len, slimb_t pos) { limb_t i, a0, a1; int p; i = pos >> LIMB_LOG2_BITS; p = pos & (LIMB_BITS - 1); if (i < len) a0 = tab[i]; else a0 = 0; if (p == 0) { return a0; } else { i++; if (i < len) a1 = tab[i]; else a1 = 0; return (a0 >> p) | (a1 << (LIMB_BITS - p)); } } static inline limb_t get_bit(const limb_t *tab, limb_t len, slimb_t pos) { slimb_t i; i = pos >> LIMB_LOG2_BITS; if (i < 0 || i >= len) return 0; return (tab[i] >> (pos & (LIMB_BITS - 1))) & 1; } static inline limb_t limb_mask(int start, int last) { limb_t v; int n; n = last - start + 1; if (n == LIMB_BITS) v = -1; else v = (((limb_t)1 << n) - 1) << start; return v; } static limb_t mp_scan_nz(const limb_t *tab, mp_size_t n) { mp_size_t i; for(i = 0; i < n; i++) { if (tab[i] != 0) return 1; } return 0; } /* return != 0 if one bit between 0 and bit_pos inclusive is not zero. */ static inline limb_t scan_bit_nz(const bf_t *r, slimb_t bit_pos) { slimb_t pos; limb_t v; pos = bit_pos >> LIMB_LOG2_BITS; if (pos < 0) return 0; v = r->tab[pos] & limb_mask(0, bit_pos & (LIMB_BITS - 1)); if (v != 0) return 1; pos--; while (pos >= 0) { if (r->tab[pos] != 0) return 1; pos--; } return 0; } /* return the addend for rounding. Note that prec can be <= 0 (for BF_FLAG_RADPNT_PREC) */ static int bf_get_rnd_add(int *pret, const bf_t *r, limb_t l, slimb_t prec, int rnd_mode) { int add_one, inexact; limb_t bit1, bit0; if (rnd_mode == BF_RNDF) { bit0 = 1; /* faithful rounding does not honor the INEXACT flag */ } else { /* starting limb for bit 'prec + 1' */ bit0 = scan_bit_nz(r, l * LIMB_BITS - 1 - bf_max(0, prec + 1)); } /* get the bit at 'prec' */ bit1 = get_bit(r->tab, l, l * LIMB_BITS - 1 - prec); inexact = (bit1 | bit0) != 0; add_one = 0; switch(rnd_mode) { case BF_RNDZ: break; case BF_RNDN: if (bit1) { if (bit0) { add_one = 1; } else { /* round to even */ add_one = get_bit(r->tab, l, l * LIMB_BITS - 1 - (prec - 1)); } } break; case BF_RNDD: case BF_RNDU: if (r->sign == (rnd_mode == BF_RNDD)) add_one = inexact; break; case BF_RNDA: add_one = inexact; break; case BF_RNDNA: case BF_RNDF: add_one = bit1; break; default: abort(); } if (inexact) *pret |= BF_ST_INEXACT; return add_one; } static int bf_set_overflow(bf_t *r, int sign, limb_t prec, bf_flags_t flags) { slimb_t i, l, e_max; int rnd_mode; rnd_mode = flags & BF_RND_MASK; if (prec == BF_PREC_INF || rnd_mode == BF_RNDN || rnd_mode == BF_RNDNA || rnd_mode == BF_RNDA || (rnd_mode == BF_RNDD && sign == 1) || (rnd_mode == BF_RNDU && sign == 0)) { bf_set_inf(r, sign); } else { /* set to maximum finite number */ l = (prec + LIMB_BITS - 1) / LIMB_BITS; if (bf_resize(r, l)) { bf_set_nan(r); return BF_ST_MEM_ERROR; } r->tab[0] = limb_mask((-prec) & (LIMB_BITS - 1), LIMB_BITS - 1); for(i = 1; i < l; i++) r->tab[i] = (limb_t)-1; e_max = (limb_t)1 << (bf_get_exp_bits(flags) - 1); r->expn = e_max; r->sign = sign; } return BF_ST_OVERFLOW | BF_ST_INEXACT; } /* round to prec1 bits assuming 'r' is non zero and finite. 'r' is assumed to have length 'l' (1 <= l <= r->len). Note: 'prec1' can be infinite (BF_PREC_INF). 'ret' is 0 or BF_ST_INEXACT if the result is known to be inexact. Can fail with BF_ST_MEM_ERROR in case of overflow not returning infinity. */ static int __bf_round(bf_t *r, limb_t prec1, bf_flags_t flags, limb_t l, int ret) { limb_t v, a; int shift, add_one, rnd_mode; slimb_t i, bit_pos, pos, e_min, e_max, e_range, prec; /* e_min and e_max are computed to match the IEEE 754 conventions */ e_range = (limb_t)1 << (bf_get_exp_bits(flags) - 1); e_min = -e_range + 3; e_max = e_range; if (flags & BF_FLAG_RADPNT_PREC) { /* 'prec' is the precision after the radix point */ if (prec1 != BF_PREC_INF) prec = r->expn + prec1; else prec = prec1; } else if (unlikely(r->expn < e_min) && (flags & BF_FLAG_SUBNORMAL)) { /* restrict the precision in case of potentially subnormal result */ assert(prec1 != BF_PREC_INF); prec = prec1 - (e_min - r->expn); } else { prec = prec1; } /* round to prec bits */ rnd_mode = flags & BF_RND_MASK; add_one = bf_get_rnd_add(&ret, r, l, prec, rnd_mode); if (prec <= 0) { if (add_one) { bf_resize(r, 1); /* cannot fail */ r->tab[0] = (limb_t)1 << (LIMB_BITS - 1); r->expn += 1 - prec; ret |= BF_ST_UNDERFLOW | BF_ST_INEXACT; return ret; } else { goto underflow; } } else if (add_one) { limb_t carry; /* add one starting at digit 'prec - 1' */ bit_pos = l * LIMB_BITS - 1 - (prec - 1); pos = bit_pos >> LIMB_LOG2_BITS; carry = (limb_t)1 << (bit_pos & (LIMB_BITS - 1)); for(i = pos; i < l; i++) { v = r->tab[i] + carry; carry = (v < carry); r->tab[i] = v; if (carry == 0) break; } if (carry) { /* shift right by one digit */ v = 1; for(i = l - 1; i >= pos; i--) { a = r->tab[i]; r->tab[i] = (a >> 1) | (v << (LIMB_BITS - 1)); v = a; } r->expn++; } } /* check underflow */ if (unlikely(r->expn < e_min)) { if (flags & BF_FLAG_SUBNORMAL) { /* if inexact, also set the underflow flag */ if (ret & BF_ST_INEXACT) ret |= BF_ST_UNDERFLOW; } else { underflow: ret |= BF_ST_UNDERFLOW | BF_ST_INEXACT; bf_set_zero(r, r->sign); return ret; } } /* check overflow */ if (unlikely(r->expn > e_max)) return bf_set_overflow(r, r->sign, prec1, flags); /* keep the bits starting at 'prec - 1' */ bit_pos = l * LIMB_BITS - 1 - (prec - 1); i = bit_pos >> LIMB_LOG2_BITS; if (i >= 0) { shift = bit_pos & (LIMB_BITS - 1); if (shift != 0) r->tab[i] &= limb_mask(shift, LIMB_BITS - 1); } else { i = 0; } /* remove trailing zeros */ while (r->tab[i] == 0) i++; if (i > 0) { l -= i; memmove(r->tab, r->tab + i, l * sizeof(limb_t)); } bf_resize(r, l); /* cannot fail */ return ret; } /* 'r' must be a finite number. */ int bf_normalize_and_round(bf_t *r, limb_t prec1, bf_flags_t flags) { limb_t l, v, a; int shift, ret; slimb_t i; // bf_print_str("bf_renorm", r); l = r->len; while (l > 0 && r->tab[l - 1] == 0) l--; if (l == 0) { /* zero */ r->expn = BF_EXP_ZERO; bf_resize(r, 0); /* cannot fail */ ret = 0; } else { r->expn -= (r->len - l) * LIMB_BITS; /* shift to have the MSB set to '1' */ v = r->tab[l - 1]; shift = clz(v); if (shift != 0) { v = 0; for(i = 0; i < l; i++) { a = r->tab[i]; r->tab[i] = (a << shift) | (v >> (LIMB_BITS - shift)); v = a; } r->expn -= shift; } ret = __bf_round(r, prec1, flags, l, 0); } // bf_print_str("r_final", r); return ret; } /* return true if rounding can be done at precision 'prec' assuming the exact result r is such that |r-a| <= 2^(EXP(a)-k). */ /* XXX: check the case where the exponent would be incremented by the rounding */ int bf_can_round(const bf_t *a, slimb_t prec, bf_rnd_t rnd_mode, slimb_t k) { bool is_rndn; slimb_t bit_pos, n; limb_t bit; if (a->expn == BF_EXP_INF || a->expn == BF_EXP_NAN) return false; if (rnd_mode == BF_RNDF) { return (k >= (prec + 1)); } if (a->expn == BF_EXP_ZERO) return false; is_rndn = (rnd_mode == BF_RNDN || rnd_mode == BF_RNDNA); if (k < (prec + 2)) return false; bit_pos = a->len * LIMB_BITS - 1 - prec; n = k - prec; /* bit pattern for RNDN or RNDNA: 0111.. or 1000... for other rounding modes: 000... or 111... */ bit = get_bit(a->tab, a->len, bit_pos); bit_pos--; n--; bit ^= is_rndn; /* XXX: slow, but a few iterations on average */ while (n != 0) { if (get_bit(a->tab, a->len, bit_pos) != bit) return true; bit_pos--; n--; } return false; } /* Cannot fail with BF_ST_MEM_ERROR. */ int bf_round(bf_t *r, limb_t prec, bf_flags_t flags) { if (r->len == 0) return 0; return __bf_round(r, prec, flags, r->len, 0); } /* for debugging */ static __maybe_unused void dump_limbs(const char *str, const limb_t *tab, limb_t n) { limb_t i; printf("%s: len=%" PRId_LIMB "\n", str, n); for(i = 0; i < n; i++) { printf("%" PRId_LIMB ": " FMT_LIMB "\n", i, tab[i]); } } void mp_print_str(const char *str, const limb_t *tab, limb_t n) { slimb_t i; printf("%s= 0x", str); for(i = n - 1; i >= 0; i--) { if (i != (n - 1)) printf("_"); printf(FMT_LIMB, tab[i]); } printf("\n"); } static __maybe_unused void mp_print_str_h(const char *str, const limb_t *tab, limb_t n, limb_t high) { slimb_t i; printf("%s= 0x", str); printf(FMT_LIMB, high); for(i = n - 1; i >= 0; i--) { printf("_"); printf(FMT_LIMB, tab[i]); } printf("\n"); } /* for debugging */ void bf_print_str(const char *str, const bf_t *a) { slimb_t i; printf("%s=", str); if (a->expn == BF_EXP_NAN) { printf("NaN"); } else { if (a->sign) putchar('-'); if (a->expn == BF_EXP_ZERO) { putchar('0'); } else if (a->expn == BF_EXP_INF) { printf("Inf"); } else { printf("0x0."); for(i = a->len - 1; i >= 0; i--) printf(FMT_LIMB, a->tab[i]); printf("p%" PRId_LIMB, a->expn); } } printf("\n"); } /* compare the absolute value of 'a' and 'b'. Return < 0 if a < b, 0 if a = b and > 0 otherwise. */ int bf_cmpu(const bf_t *a, const bf_t *b) { slimb_t i; limb_t len, v1, v2; if (a->expn != b->expn) { if (a->expn < b->expn) return -1; else return 1; } len = bf_max(a->len, b->len); for(i = len - 1; i >= 0; i--) { v1 = get_limbz(a, a->len - len + i); v2 = get_limbz(b, b->len - len + i); if (v1 != v2) { if (v1 < v2) return -1; else return 1; } } return 0; } /* Full order: -0 < 0, NaN == NaN and NaN is larger than all other numbers */ int bf_cmp_full(const bf_t *a, const bf_t *b) { int res; if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { if (a->expn == b->expn) res = 0; else if (a->expn == BF_EXP_NAN) res = 1; else res = -1; } else if (a->sign != b->sign) { res = 1 - 2 * a->sign; } else { res = bf_cmpu(a, b); if (a->sign) res = -res; } return res; } /* Standard floating point comparison: return 2 if one of the operands is NaN (unordered) or -1, 0, 1 depending on the ordering assuming -0 == +0 */ int bf_cmp(const bf_t *a, const bf_t *b) { int res; if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { res = 2; } else if (a->sign != b->sign) { if (a->expn == BF_EXP_ZERO && b->expn == BF_EXP_ZERO) res = 0; else res = 1 - 2 * a->sign; } else { res = bf_cmpu(a, b); if (a->sign) res = -res; } return res; } /* Compute the number of bits 'n' matching the pattern: a= X1000..0 b= X0111..1 When computing a-b, the result will have at least n leading zero bits. Precondition: a > b and a.expn - b.expn = 0 or 1 */ static limb_t count_cancelled_bits(const bf_t *a, const bf_t *b) { slimb_t bit_offset, b_offset, n; int p, p1; limb_t v1, v2, mask; bit_offset = a->len * LIMB_BITS - 1; b_offset = (b->len - a->len) * LIMB_BITS - (LIMB_BITS - 1) + a->expn - b->expn; n = 0; /* first search the equals bits */ for(;;) { v1 = get_limbz(a, bit_offset >> LIMB_LOG2_BITS); v2 = get_bits(b->tab, b->len, bit_offset + b_offset); // printf("v1=" FMT_LIMB " v2=" FMT_LIMB "\n", v1, v2); if (v1 != v2) break; n += LIMB_BITS; bit_offset -= LIMB_BITS; } /* find the position of the first different bit */ p = clz(v1 ^ v2) + 1; n += p; /* then search for '0' in a and '1' in b */ p = LIMB_BITS - p; if (p > 0) { /* search in the trailing p bits of v1 and v2 */ mask = limb_mask(0, p - 1); p1 = bf_min(clz(v1 & mask), clz((~v2) & mask)) - (LIMB_BITS - p); n += p1; if (p1 != p) goto done; } bit_offset -= LIMB_BITS; for(;;) { v1 = get_limbz(a, bit_offset >> LIMB_LOG2_BITS); v2 = get_bits(b->tab, b->len, bit_offset + b_offset); // printf("v1=" FMT_LIMB " v2=" FMT_LIMB "\n", v1, v2); if (v1 != 0 || v2 != -1) { /* different: count the matching bits */ p1 = bf_min(clz(v1), clz(~v2)); n += p1; break; } n += LIMB_BITS; bit_offset -= LIMB_BITS; } done: return n; } static int bf_add_internal(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags, int b_neg) { const bf_t *tmp; int is_sub, ret, cmp_res, a_sign, b_sign; a_sign = a->sign; b_sign = b->sign ^ b_neg; is_sub = a_sign ^ b_sign; cmp_res = bf_cmpu(a, b); if (cmp_res < 0) { tmp = a; a = b; b = tmp; a_sign = b_sign; /* b_sign is never used later */ } /* abs(a) >= abs(b) */ if (cmp_res == 0 && is_sub && a->expn < BF_EXP_INF) { /* zero result */ bf_set_zero(r, (flags & BF_RND_MASK) == BF_RNDD); ret = 0; } else if (a->len == 0 || b->len == 0) { ret = 0; if (a->expn >= BF_EXP_INF) { if (a->expn == BF_EXP_NAN) { /* at least one operand is NaN */ bf_set_nan(r); } else if (b->expn == BF_EXP_INF && is_sub) { /* infinities with different signs */ bf_set_nan(r); ret = BF_ST_INVALID_OP; } else { bf_set_inf(r, a_sign); } } else { /* at least one zero and not subtract */ bf_set(r, a); r->sign = a_sign; goto renorm; } } else { slimb_t d, a_offset, b_bit_offset, i, cancelled_bits; limb_t carry, v1, v2, u, r_len, carry1, precl, tot_len, z, sub_mask; r->sign = a_sign; r->expn = a->expn; d = a->expn - b->expn; /* must add more precision for the leading cancelled bits in subtraction */ if (is_sub) { if (d <= 1) cancelled_bits = count_cancelled_bits(a, b); else cancelled_bits = 1; } else { cancelled_bits = 0; } /* add two extra bits for rounding */ precl = (cancelled_bits + prec + 2 + LIMB_BITS - 1) / LIMB_BITS; tot_len = bf_max(a->len, b->len + (d + LIMB_BITS - 1) / LIMB_BITS); r_len = bf_min(precl, tot_len); if (bf_resize(r, r_len)) goto fail; a_offset = a->len - r_len; b_bit_offset = (b->len - r_len) * LIMB_BITS + d; /* compute the bits before for the rounding */ carry = is_sub; z = 0; sub_mask = -is_sub; i = r_len - tot_len; while (i < 0) { slimb_t ap, bp; bool inflag; ap = a_offset + i; bp = b_bit_offset + i * LIMB_BITS; inflag = false; if (ap >= 0 && ap < a->len) { v1 = a->tab[ap]; inflag = true; } else { v1 = 0; } if (bp + LIMB_BITS > 0 && bp < (slimb_t)(b->len * LIMB_BITS)) { v2 = get_bits(b->tab, b->len, bp); inflag = true; } else { v2 = 0; } if (!inflag) { /* outside 'a' and 'b': go directly to the next value inside a or b so that the running time does not depend on the exponent difference */ i = 0; if (ap < 0) i = bf_min(i, -a_offset); /* b_bit_offset + i * LIMB_BITS + LIMB_BITS >= 1 equivalent to i >= ceil(-b_bit_offset + 1 - LIMB_BITS) / LIMB_BITS) */ if (bp + LIMB_BITS <= 0) i = bf_min(i, (-b_bit_offset) >> LIMB_LOG2_BITS); } else { i++; } v2 ^= sub_mask; u = v1 + v2; carry1 = u < v1; u += carry; carry = (u < carry) | carry1; z |= u; } /* and the result */ for(i = 0; i < r_len; i++) { v1 = get_limbz(a, a_offset + i); v2 = get_bits(b->tab, b->len, b_bit_offset + i * LIMB_BITS); v2 ^= sub_mask; u = v1 + v2; carry1 = u < v1; u += carry; carry = (u < carry) | carry1; r->tab[i] = u; } /* set the extra bits for the rounding */ r->tab[0] |= (z != 0); /* carry is only possible in add case */ if (!is_sub && carry) { if (bf_resize(r, r_len + 1)) goto fail; r->tab[r_len] = 1; r->expn += LIMB_BITS; } renorm: ret = bf_normalize_and_round(r, prec, flags); } return ret; fail: bf_set_nan(r); return BF_ST_MEM_ERROR; } static int __bf_add(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags) { return bf_add_internal(r, a, b, prec, flags, 0); } static int __bf_sub(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags) { return bf_add_internal(r, a, b, prec, flags, 1); } limb_t mp_add(limb_t *res, const limb_t *op1, const limb_t *op2, limb_t n, limb_t carry) { slimb_t i; limb_t k, a, v, k1; k = carry; for(i=0;i v; v = a - k; k = (v > a) | k1; res[i] = v; } return k; } /* compute 0 - op2 */ static limb_t mp_neg(limb_t *res, const limb_t *op2, mp_size_t n, limb_t carry) { int i; limb_t k, a, v, k1; k = carry; for(i=0;i v; v = a - k; k = (v > a) | k1; res[i] = v; } return k; } limb_t mp_sub_ui(limb_t *tab, limb_t b, mp_size_t n) { mp_size_t i; limb_t k, a, v; k=b; for(i=0;i v; tab[i] = a; if (k == 0) break; } return k; } /* r = (a + high*B^n) >> shift. Return the remainder r (0 <= r < 2^shift). 1 <= shift <= LIMB_BITS - 1 */ static limb_t mp_shr(limb_t *tab_r, const limb_t *tab, mp_size_t n, int shift, limb_t high) { mp_size_t i; limb_t l, a; assert(shift >= 1 && shift < LIMB_BITS); l = high; for(i = n - 1; i >= 0; i--) { a = tab[i]; tab_r[i] = (a >> shift) | (l << (LIMB_BITS - shift)); l = a; } return l & (((limb_t)1 << shift) - 1); } /* tabr[] = taba[] * b + l. Return the high carry */ static limb_t mp_mul1(limb_t *tabr, const limb_t *taba, limb_t n, limb_t b, limb_t l) { limb_t i; dlimb_t t; for(i = 0; i < n; i++) { t = (dlimb_t)taba[i] * (dlimb_t)b + l; tabr[i] = t; l = t >> LIMB_BITS; } return l; } /* tabr[] += taba[] * b, return the high word. */ static limb_t mp_add_mul1(limb_t *tabr, const limb_t *taba, limb_t n, limb_t b) { limb_t i, l; dlimb_t t; l = 0; for(i = 0; i < n; i++) { t = (dlimb_t)taba[i] * (dlimb_t)b + l + tabr[i]; tabr[i] = t; l = t >> LIMB_BITS; } return l; } /* size of the result : op1_size + op2_size. */ static void mp_mul_basecase(limb_t *result, const limb_t *op1, limb_t op1_size, const limb_t *op2, limb_t op2_size) { limb_t i, r; result[op1_size] = mp_mul1(result, op1, op1_size, op2[0], 0); for(i=1;i= FFT_MUL_THRESHOLD)) { bf_t r_s, *r = &r_s; r->tab = result; /* XXX: optimize memory usage in API */ if (fft_mul(s, r, (limb_t *)op1, op1_size, (limb_t *)op2, op2_size, FFT_MUL_R_NORESIZE)) return -1; } else #endif { mp_mul_basecase(result, op1, op1_size, op2, op2_size); } return 0; } /* tabr[] -= taba[] * b. Return the value to substract to the high word. */ static limb_t mp_sub_mul1(limb_t *tabr, const limb_t *taba, limb_t n, limb_t b) { limb_t i, l; dlimb_t t; l = 0; for(i = 0; i < n; i++) { t = tabr[i] - (dlimb_t)taba[i] * (dlimb_t)b - l; tabr[i] = t; l = -(t >> LIMB_BITS); } return l; } /* WARNING: d must be >= 2^(LIMB_BITS-1) */ static inline limb_t udiv1norm_init(limb_t d) { limb_t a0, a1; a1 = -d - 1; a0 = -1; return (((dlimb_t)a1 << LIMB_BITS) | a0) / d; } /* return the quotient and the remainder in '*pr'of 'a1*2^LIMB_BITS+a0 / d' with 0 <= a1 < d. */ static inline limb_t udiv1norm(limb_t *pr, limb_t a1, limb_t a0, limb_t d, limb_t d_inv) { limb_t n1m, n_adj, q, r, ah; dlimb_t a; n1m = ((slimb_t)a0 >> (LIMB_BITS - 1)); n_adj = a0 + (n1m & d); a = (dlimb_t)d_inv * (a1 - n1m) + n_adj; q = (a >> LIMB_BITS) + a1; /* compute a - q * r and update q so that the remainder is\ between 0 and d - 1 */ a = ((dlimb_t)a1 << LIMB_BITS) | a0; a = a - (dlimb_t)q * d - d; ah = a >> LIMB_BITS; q += 1 + ah; r = (limb_t)a + (ah & d); *pr = r; return q; } /* b must be >= 1 << (LIMB_BITS - 1) */ static limb_t mp_div1norm(limb_t *tabr, const limb_t *taba, limb_t n, limb_t b, limb_t r) { slimb_t i; if (n >= UDIV1NORM_THRESHOLD) { limb_t b_inv; b_inv = udiv1norm_init(b); for(i = n - 1; i >= 0; i--) { tabr[i] = udiv1norm(&r, r, taba[i], b, b_inv); } } else { dlimb_t a1; for(i = n - 1; i >= 0; i--) { a1 = ((dlimb_t)r << LIMB_BITS) | taba[i]; tabr[i] = a1 / b; r = a1 % b; } } return r; } static int mp_divnorm_large(bf_context_t *s, limb_t *tabq, limb_t *taba, limb_t na, const limb_t *tabb, limb_t nb); /* base case division: divides taba[0..na-1] by tabb[0..nb-1]. tabb[nb - 1] must be >= 1 << (LIMB_BITS - 1). na - nb must be >= 0. 'taba' is modified and contains the remainder (nb limbs). tabq[0..na-nb] contains the quotient with tabq[na - nb] <= 1. */ static int mp_divnorm(bf_context_t *s, limb_t *tabq, limb_t *taba, limb_t na, const limb_t *tabb, limb_t nb) { limb_t r, a, c, q, v, b1, b1_inv, n, dummy_r; slimb_t i, j; b1 = tabb[nb - 1]; if (nb == 1) { taba[0] = mp_div1norm(tabq, taba, na, b1, 0); return 0; } n = na - nb; if (bf_min(n, nb) >= DIVNORM_LARGE_THRESHOLD) { return mp_divnorm_large(s, tabq, taba, na, tabb, nb); } if (n >= UDIV1NORM_THRESHOLD) b1_inv = udiv1norm_init(b1); else b1_inv = 0; /* first iteration: the quotient is only 0 or 1 */ q = 1; for(j = nb - 1; j >= 0; j--) { if (taba[n + j] != tabb[j]) { if (taba[n + j] < tabb[j]) q = 0; break; } } tabq[n] = q; if (q) { mp_sub(taba + n, taba + n, tabb, nb, 0); } for(i = n - 1; i >= 0; i--) { if (unlikely(taba[i + nb] >= b1)) { q = -1; } else if (b1_inv) { q = udiv1norm(&dummy_r, taba[i + nb], taba[i + nb - 1], b1, b1_inv); } else { dlimb_t al; al = ((dlimb_t)taba[i + nb] << LIMB_BITS) | taba[i + nb - 1]; q = al / b1; r = al % b1; } r = mp_sub_mul1(taba + i, tabb, nb, q); v = taba[i + nb]; a = v - r; c = (a > v); taba[i + nb] = a; if (c != 0) { /* negative result */ for(;;) { q--; c = mp_add(taba + i, taba + i, tabb, nb, 0); /* propagate carry and test if positive result */ if (c != 0) { if (++taba[i + nb] == 0) { break; } } } } tabq[i] = q; } return 0; } /* compute r=B^(2*n)/a such as a*r < B^(2*n) < a*r + 2 with n >= 1. 'a' has n limbs with a[n-1] >= B/2 and 'r' has n+1 limbs with r[n] = 1. See Modern Computer Arithmetic by Richard P. Brent and Paul Zimmermann, algorithm 3.5 */ int mp_recip(bf_context_t *s, limb_t *tabr, const limb_t *taba, limb_t n) { mp_size_t l, h, k, i; limb_t *tabxh, *tabt, c, *tabu; if (n <= 2) { /* return ceil(B^(2*n)/a) - 1 */ /* XXX: could avoid allocation */ tabu = bf_malloc(s, sizeof(limb_t) * (2 * n + 1)); tabt = bf_malloc(s, sizeof(limb_t) * (n + 2)); if (!tabt || !tabu) goto fail; for(i = 0; i < 2 * n; i++) tabu[i] = 0; tabu[2 * n] = 1; if (mp_divnorm(s, tabt, tabu, 2 * n + 1, taba, n)) goto fail; for(i = 0; i < n + 1; i++) tabr[i] = tabt[i]; if (mp_scan_nz(tabu, n) == 0) { /* only happens for a=B^n/2 */ mp_sub_ui(tabr, 1, n + 1); } } else { l = (n - 1) / 2; h = n - l; /* n=2p -> l=p-1, h = p + 1, k = p + 3 n=2p+1-> l=p, h = p + 1; k = p + 2 */ tabt = bf_malloc(s, sizeof(limb_t) * (n + h + 1)); tabu = bf_malloc(s, sizeof(limb_t) * (n + 2 * h - l + 2)); if (!tabt || !tabu) goto fail; tabxh = tabr + l; if (mp_recip(s, tabxh, taba + l, h)) goto fail; if (mp_mul(s, tabt, taba, n, tabxh, h + 1)) /* n + h + 1 limbs */ goto fail; while (tabt[n + h] != 0) { mp_sub_ui(tabxh, 1, h + 1); c = mp_sub(tabt, tabt, taba, n, 0); mp_sub_ui(tabt + n, c, h + 1); } /* T = B^(n+h) - T */ mp_neg(tabt, tabt, n + h + 1, 0); tabt[n + h]++; if (mp_mul(s, tabu, tabt + l, n + h + 1 - l, tabxh, h + 1)) goto fail; /* n + 2*h - l + 2 limbs */ k = 2 * h - l; for(i = 0; i < l; i++) tabr[i] = tabu[i + k]; mp_add(tabr + l, tabr + l, tabu + 2 * h, h, 0); } bf_free(s, tabt); bf_free(s, tabu); return 0; fail: bf_free(s, tabt); bf_free(s, tabu); return -1; } /* return -1, 0 or 1 */ static int mp_cmp(const limb_t *taba, const limb_t *tabb, mp_size_t n) { mp_size_t i; for(i = n - 1; i >= 0; i--) { if (taba[i] != tabb[i]) { if (taba[i] < tabb[i]) return -1; else return 1; } } return 0; } //#define DEBUG_DIVNORM_LARGE //#define DEBUG_DIVNORM_LARGE2 /* subquadratic divnorm */ static int mp_divnorm_large(bf_context_t *s, limb_t *tabq, limb_t *taba, limb_t na, const limb_t *tabb, limb_t nb) { limb_t *tabb_inv, nq, *tabt, i, n; nq = na - nb; #ifdef DEBUG_DIVNORM_LARGE printf("na=%d nb=%d nq=%d\n", (int)na, (int)nb, (int)nq); mp_print_str("a", taba, na); mp_print_str("b", tabb, nb); #endif assert(nq >= 1); n = nq; if (nq < nb) n++; tabb_inv = bf_malloc(s, sizeof(limb_t) * (n + 1)); tabt = bf_malloc(s, sizeof(limb_t) * 2 * (n + 1)); if (!tabb_inv || !tabt) goto fail; if (n >= nb) { for(i = 0; i < n - nb; i++) tabt[i] = 0; for(i = 0; i < nb; i++) tabt[i + n - nb] = tabb[i]; } else { /* truncate B: need to increment it so that the approximate inverse is smaller that the exact inverse */ for(i = 0; i < n; i++) tabt[i] = tabb[i + nb - n]; if (mp_add_ui(tabt, 1, n)) { /* tabt = B^n : tabb_inv = B^n */ memset(tabb_inv, 0, n * sizeof(limb_t)); tabb_inv[n] = 1; goto recip_done; } } if (mp_recip(s, tabb_inv, tabt, n)) goto fail; recip_done: /* Q=A*B^-1 */ if (mp_mul(s, tabt, tabb_inv, n + 1, taba + na - (n + 1), n + 1)) goto fail; for(i = 0; i < nq + 1; i++) tabq[i] = tabt[i + 2 * (n + 1) - (nq + 1)]; #ifdef DEBUG_DIVNORM_LARGE mp_print_str("q", tabq, nq + 1); #endif bf_free(s, tabt); bf_free(s, tabb_inv); tabb_inv = NULL; /* R=A-B*Q */ tabt = bf_malloc(s, sizeof(limb_t) * (na + 1)); if (!tabt) goto fail; if (mp_mul(s, tabt, tabq, nq + 1, tabb, nb)) goto fail; /* we add one more limb for the result */ mp_sub(taba, taba, tabt, nb + 1, 0); bf_free(s, tabt); /* the approximated quotient is smaller than than the exact one, hence we may have to increment it */ #ifdef DEBUG_DIVNORM_LARGE2 int cnt = 0; static int cnt_max; #endif for(;;) { if (taba[nb] == 0 && mp_cmp(taba, tabb, nb) < 0) break; taba[nb] -= mp_sub(taba, taba, tabb, nb, 0); mp_add_ui(tabq, 1, nq + 1); #ifdef DEBUG_DIVNORM_LARGE2 cnt++; #endif } #ifdef DEBUG_DIVNORM_LARGE2 if (cnt > cnt_max) { cnt_max = cnt; printf("\ncnt=%d nq=%d nb=%d\n", cnt_max, (int)nq, (int)nb); } #endif return 0; fail: bf_free(s, tabb_inv); bf_free(s, tabt); return -1; } int bf_mul(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags) { int ret, r_sign; if (a->len < b->len) { const bf_t *tmp = a; a = b; b = tmp; } r_sign = a->sign ^ b->sign; /* here b->len <= a->len */ if (b->len == 0) { if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { bf_set_nan(r); ret = 0; } else if (a->expn == BF_EXP_INF || b->expn == BF_EXP_INF) { if ((a->expn == BF_EXP_INF && b->expn == BF_EXP_ZERO) || (a->expn == BF_EXP_ZERO && b->expn == BF_EXP_INF)) { bf_set_nan(r); ret = BF_ST_INVALID_OP; } else { bf_set_inf(r, r_sign); ret = 0; } } else { bf_set_zero(r, r_sign); ret = 0; } } else { bf_t tmp, *r1 = NULL; limb_t a_len, b_len, precl; limb_t *a_tab, *b_tab; a_len = a->len; b_len = b->len; if ((flags & BF_RND_MASK) == BF_RNDF) { /* faithful rounding does not require using the full inputs */ precl = (prec + 2 + LIMB_BITS - 1) / LIMB_BITS; a_len = bf_min(a_len, precl); b_len = bf_min(b_len, precl); } a_tab = a->tab + a->len - a_len; b_tab = b->tab + b->len - b_len; #ifdef USE_FFT_MUL if (b_len >= FFT_MUL_THRESHOLD) { int mul_flags = 0; if (r == a) mul_flags |= FFT_MUL_R_OVERLAP_A; if (r == b) mul_flags |= FFT_MUL_R_OVERLAP_B; if (fft_mul(r->ctx, r, a_tab, a_len, b_tab, b_len, mul_flags)) goto fail; } else #endif { if (r == a || r == b) { bf_init(r->ctx, &tmp); r1 = r; r = &tmp; } if (bf_resize(r, a_len + b_len)) { fail: bf_set_nan(r); ret = BF_ST_MEM_ERROR; goto done; } mp_mul_basecase(r->tab, a_tab, a_len, b_tab, b_len); } r->sign = r_sign; r->expn = a->expn + b->expn; ret = bf_normalize_and_round(r, prec, flags); done: if (r == &tmp) bf_move(r1, &tmp); } return ret; } /* multiply 'r' by 2^e */ int bf_mul_2exp(bf_t *r, slimb_t e, limb_t prec, bf_flags_t flags) { slimb_t e_max; if (r->len == 0) return 0; e_max = ((limb_t)1 << BF_EXT_EXP_BITS_MAX) - 1; e = bf_max(e, -e_max); e = bf_min(e, e_max); r->expn += e; return __bf_round(r, prec, flags, r->len, 0); } /* Return e such as a=m*2^e with m odd integer. return 0 if a is zero, Infinite or Nan. */ slimb_t bf_get_exp_min(const bf_t *a) { slimb_t i; limb_t v; int k; for(i = 0; i < a->len; i++) { v = a->tab[i]; if (v != 0) { k = ctz(v); return a->expn - (a->len - i) * LIMB_BITS + k; } } return 0; } /* a and b must be finite numbers with a >= 0 and b > 0. 'q' is the integer defined as floor(a/b) and r = a - q * b. */ static void bf_tdivremu(bf_t *q, bf_t *r, const bf_t *a, const bf_t *b) { if (bf_cmpu(a, b) < 0) { bf_set_ui(q, 0); bf_set(r, a); } else { bf_div(q, a, b, bf_max(a->expn - b->expn + 1, 2), BF_RNDZ); bf_rint(q, BF_RNDZ); bf_mul(r, q, b, BF_PREC_INF, BF_RNDZ); bf_sub(r, a, r, BF_PREC_INF, BF_RNDZ); } } static int __bf_div(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags) { bf_context_t *s = r->ctx; int ret, r_sign; limb_t n, nb, precl; r_sign = a->sign ^ b->sign; if (a->expn >= BF_EXP_INF || b->expn >= BF_EXP_INF) { if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { bf_set_nan(r); return 0; } else if (a->expn == BF_EXP_INF && b->expn == BF_EXP_INF) { bf_set_nan(r); return BF_ST_INVALID_OP; } else if (a->expn == BF_EXP_INF) { bf_set_inf(r, r_sign); return 0; } else { bf_set_zero(r, r_sign); return 0; } } else if (a->expn == BF_EXP_ZERO) { if (b->expn == BF_EXP_ZERO) { bf_set_nan(r); return BF_ST_INVALID_OP; } else { bf_set_zero(r, r_sign); return 0; } } else if (b->expn == BF_EXP_ZERO) { bf_set_inf(r, r_sign); return BF_ST_DIVIDE_ZERO; } /* number of limbs of the quotient (2 extra bits for rounding) */ precl = (prec + 2 + LIMB_BITS - 1) / LIMB_BITS; nb = b->len; n = bf_max(a->len, precl); { limb_t *taba, na; slimb_t d; na = n + nb; #if LIMB_LOG2_BITS == 6 if (na >= (SIZE_MAX / sizeof(limb_t)) - 1) { return BF_ST_MEM_ERROR; /* Return memory error status */ } #endif taba = bf_malloc(s, (na + 1) * sizeof(limb_t)); if (!taba) goto fail; d = na - a->len; memset(taba, 0, d * sizeof(limb_t)); memcpy(taba + d, a->tab, a->len * sizeof(limb_t)); if (bf_resize(r, n + 1)) goto fail1; if (mp_divnorm(s, r->tab, taba, na, b->tab, nb)) { fail1: bf_free(s, taba); goto fail; } /* see if non zero remainder */ if (mp_scan_nz(taba, nb)) r->tab[0] |= 1; bf_free(r->ctx, taba); r->expn = a->expn - b->expn + LIMB_BITS; r->sign = r_sign; ret = bf_normalize_and_round(r, prec, flags); } return ret; fail: bf_set_nan(r); return BF_ST_MEM_ERROR; } /* division and remainder. rnd_mode is the rounding mode for the quotient. The additional rounding mode BF_RND_EUCLIDIAN is supported. 'q' is an integer. 'r' is rounded with prec and flags (prec can be BF_PREC_INF). */ int bf_divrem(bf_t *q, bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags, int rnd_mode) { bf_t a1_s, *a1 = &a1_s; bf_t b1_s, *b1 = &b1_s; int q_sign, ret; bool is_ceil, is_rndn; assert(q != a && q != b); assert(r != a && r != b); assert(q != r); if (a->len == 0 || b->len == 0) { bf_set_zero(q, 0); if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { bf_set_nan(r); return 0; } else if (a->expn == BF_EXP_INF || b->expn == BF_EXP_ZERO) { bf_set_nan(r); return BF_ST_INVALID_OP; } else { bf_set(r, a); return bf_round(r, prec, flags); } } q_sign = a->sign ^ b->sign; is_rndn = (rnd_mode == BF_RNDN || rnd_mode == BF_RNDNA); switch(rnd_mode) { default: case BF_RNDZ: case BF_RNDN: case BF_RNDNA: is_ceil = false; break; case BF_RNDD: is_ceil = q_sign; break; case BF_RNDU: is_ceil = q_sign ^ 1; break; case BF_RNDA: is_ceil = true; break; case BF_DIVREM_EUCLIDIAN: is_ceil = a->sign; break; } a1->expn = a->expn; a1->tab = a->tab; a1->len = a->len; a1->sign = 0; b1->expn = b->expn; b1->tab = b->tab; b1->len = b->len; b1->sign = 0; /* XXX: could improve to avoid having a large 'q' */ bf_tdivremu(q, r, a1, b1); if (bf_is_nan(q) || bf_is_nan(r)) goto fail; if (r->len != 0) { if (is_rndn) { int res; b1->expn--; res = bf_cmpu(r, b1); b1->expn++; if (res > 0 || (res == 0 && (rnd_mode == BF_RNDNA || get_bit(q->tab, q->len, q->len * LIMB_BITS - q->expn)))) { goto do_sub_r; } } else if (is_ceil) { do_sub_r: ret = bf_add_si(q, q, 1, BF_PREC_INF, BF_RNDZ); ret |= bf_sub(r, r, b1, BF_PREC_INF, BF_RNDZ); if (ret & BF_ST_MEM_ERROR) goto fail; } } r->sign ^= a->sign; q->sign = q_sign; return bf_round(r, prec, flags); fail: bf_set_nan(q); bf_set_nan(r); return BF_ST_MEM_ERROR; } int bf_rem(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags, int rnd_mode) { bf_t q_s, *q = &q_s; int ret; bf_init(r->ctx, q); ret = bf_divrem(q, r, a, b, prec, flags, rnd_mode); bf_delete(q); return ret; } static inline int bf_get_limb(slimb_t *pres, const bf_t *a, int flags) { #if LIMB_BITS == 32 return bf_get_int32(pres, a, flags); #else return bf_get_int64(pres, a, flags); #endif } int bf_remquo(slimb_t *pq, bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags, int rnd_mode) { bf_t q_s, *q = &q_s; int ret; bf_init(r->ctx, q); ret = bf_divrem(q, r, a, b, prec, flags, rnd_mode); bf_get_limb(pq, q, BF_GET_INT_MOD); bf_delete(q); return ret; } static __maybe_unused inline limb_t mul_mod(limb_t a, limb_t b, limb_t m) { dlimb_t t; t = (dlimb_t)a * (dlimb_t)b; return t % m; } #if defined(USE_MUL_CHECK) static limb_t mp_mod1(const limb_t *tab, limb_t n, limb_t m, limb_t r) { slimb_t i; dlimb_t t; for(i = n - 1; i >= 0; i--) { t = ((dlimb_t)r << LIMB_BITS) | tab[i]; r = t % m; } return r; } #endif static const uint16_t sqrt_table[192] = { 128,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,144,145,146,147,148,149,150,150,151,152,153,154,155,155,156,157,158,159,160,160,161,162,163,163,164,165,166,167,167,168,169,170,170,171,172,173,173,174,175,176,176,177,178,178,179,180,181,181,182,183,183,184,185,185,186,187,187,188,189,189,190,191,192,192,193,193,194,195,195,196,197,197,198,199,199,200,201,201,202,203,203,204,204,205,206,206,207,208,208,209,209,210,211,211,212,212,213,214,214,215,215,216,217,217,218,218,219,219,220,221,221,222,222,223,224,224,225,225,226,226,227,227,228,229,229,230,230,231,231,232,232,233,234,234,235,235,236,236,237,237,238,238,239,240,240,241,241,242,242,243,243,244,244,245,245,246,246,247,247,248,248,249,249,250,250,251,251,252,252,253,253,254,254,255, }; /* a >= 2^(LIMB_BITS - 2). Return (s, r) with s=floor(sqrt(a)) and r=a-s^2. 0 <= r <= 2 * s */ static limb_t mp_sqrtrem1(limb_t *pr, limb_t a) { limb_t s1, r1, s, r, q, u, num; /* use a table for the 16 -> 8 bit sqrt */ s1 = sqrt_table[(a >> (LIMB_BITS - 8)) - 64]; r1 = (a >> (LIMB_BITS - 16)) - s1 * s1; if (r1 > 2 * s1) { r1 -= 2 * s1 + 1; s1++; } /* one iteration to get a 32 -> 16 bit sqrt */ num = (r1 << 8) | ((a >> (LIMB_BITS - 32 + 8)) & 0xff); q = num / (2 * s1); /* q <= 2^8 */ u = num % (2 * s1); s = (s1 << 8) + q; r = (u << 8) | ((a >> (LIMB_BITS - 32)) & 0xff); r -= q * q; if ((slimb_t)r < 0) { s--; r += 2 * s + 1; } #if LIMB_BITS == 64 s1 = s; r1 = r; /* one more iteration for 64 -> 32 bit sqrt */ num = (r1 << 16) | ((a >> (LIMB_BITS - 64 + 16)) & 0xffff); q = num / (2 * s1); /* q <= 2^16 */ u = num % (2 * s1); s = (s1 << 16) + q; r = (u << 16) | ((a >> (LIMB_BITS - 64)) & 0xffff); r -= q * q; if ((slimb_t)r < 0) { s--; r += 2 * s + 1; } #endif *pr = r; return s; } /* return floor(sqrt(a)) */ limb_t bf_isqrt(limb_t a) { limb_t s, r; int k; if (a == 0) return 0; k = clz(a) & ~1; s = mp_sqrtrem1(&r, a << k); s >>= (k >> 1); return s; } static limb_t mp_sqrtrem2(limb_t *tabs, limb_t *taba) { limb_t s1, r1, s, q, u, a0, a1; dlimb_t r, num; int l; a0 = taba[0]; a1 = taba[1]; s1 = mp_sqrtrem1(&r1, a1); l = LIMB_BITS / 2; num = ((dlimb_t)r1 << l) | (a0 >> l); q = num / (2 * s1); u = num % (2 * s1); s = (s1 << l) + q; r = ((dlimb_t)u << l) | (a0 & (((limb_t)1 << l) - 1)); if (unlikely((q >> l) != 0)) r -= (dlimb_t)1 << LIMB_BITS; /* special case when q=2^l */ else r -= q * q; if ((slimb_t)(r >> LIMB_BITS) < 0) { s--; r += 2 * (dlimb_t)s + 1; } tabs[0] = s; taba[0] = r; return r >> LIMB_BITS; } //#define DEBUG_SQRTREM /* tmp_buf must contain (n / 2 + 1 limbs). *prh contains the highest limb of the remainder. */ static int mp_sqrtrem_rec(bf_context_t *s, limb_t *tabs, limb_t *taba, limb_t n, limb_t *tmp_buf, limb_t *prh) { limb_t l, h, rh, ql, qh, c, i; if (n == 1) { *prh = mp_sqrtrem2(tabs, taba); return 0; } #ifdef DEBUG_SQRTREM mp_print_str("a", taba, 2 * n); #endif l = n / 2; h = n - l; if (mp_sqrtrem_rec(s, tabs + l, taba + 2 * l, h, tmp_buf, &qh)) return -1; #ifdef DEBUG_SQRTREM mp_print_str("s1", tabs + l, h); mp_print_str_h("r1", taba + 2 * l, h, qh); mp_print_str_h("r2", taba + l, n, qh); #endif /* the remainder is in taba + 2 * l. Its high bit is in qh */ if (qh) { mp_sub(taba + 2 * l, taba + 2 * l, tabs + l, h, 0); } /* instead of dividing by 2*s, divide by s (which is normalized) and update q and r */ if (mp_divnorm(s, tmp_buf, taba + l, n, tabs + l, h)) return -1; qh += tmp_buf[l]; for(i = 0; i < l; i++) tabs[i] = tmp_buf[i]; ql = mp_shr(tabs, tabs, l, 1, qh & 1); qh = qh >> 1; /* 0 or 1 */ if (ql) rh = mp_add(taba + l, taba + l, tabs + l, h, 0); else rh = 0; #ifdef DEBUG_SQRTREM mp_print_str_h("q", tabs, l, qh); mp_print_str_h("u", taba + l, h, rh); #endif mp_add_ui(tabs + l, qh, h); #ifdef DEBUG_SQRTREM mp_print_str_h("s2", tabs, n, sh); #endif /* q = qh, tabs[l - 1 ... 0], r = taba[n - 1 ... l] */ /* subtract q^2. if qh = 1 then q = B^l, so we can take shortcuts */ if (qh) { c = qh; } else { if (mp_mul(s, taba + n, tabs, l, tabs, l)) return -1; c = mp_sub(taba, taba, taba + n, 2 * l, 0); } rh -= mp_sub_ui(taba + 2 * l, c, n - 2 * l); if ((slimb_t)rh < 0) { mp_sub_ui(tabs, 1, n); rh += mp_add_mul1(taba, tabs, n, 2); rh += mp_add_ui(taba, 1, n); } *prh = rh; return 0; } /* 'taba' has 2*n limbs with n >= 1 and taba[2*n-1] >= 2 ^ (LIMB_BITS - 2). Return (s, r) with s=floor(sqrt(a)) and r=a-s^2. 0 <= r <= 2 * s. tabs has n limbs. r is returned in the lower n limbs of taba. Its r[n] is the returned value of the function. */ /* Algorithm from the article "Karatsuba Square Root" by Paul Zimmermann and inspirated from its GMP implementation */ int mp_sqrtrem(bf_context_t *s, limb_t *tabs, limb_t *taba, limb_t n) { limb_t tmp_buf1[8]; limb_t *tmp_buf; mp_size_t n2; int ret; n2 = n / 2 + 1; if (n2 <= countof(tmp_buf1)) { tmp_buf = tmp_buf1; } else { tmp_buf = bf_malloc(s, sizeof(limb_t) * n2); if (!tmp_buf) return -1; } ret = mp_sqrtrem_rec(s, tabs, taba, n, tmp_buf, taba + n); if (tmp_buf != tmp_buf1) bf_free(s, tmp_buf); return ret; } /* Integer square root with remainder. 'a' must be an integer. r = floor(sqrt(a)) and rem = a - r^2. BF_ST_INEXACT is set if the result is inexact. 'rem' can be NULL if the remainder is not needed. */ int bf_sqrtrem(bf_t *r, bf_t *rem1, const bf_t *a) { int ret; if (a->len == 0) { if (a->expn == BF_EXP_NAN) { bf_set_nan(r); } else if (a->expn == BF_EXP_INF && a->sign) { goto invalid_op; } else { bf_set(r, a); } if (rem1) bf_set_ui(rem1, 0); ret = 0; } else if (a->sign) { invalid_op: bf_set_nan(r); if (rem1) bf_set_ui(rem1, 0); ret = BF_ST_INVALID_OP; } else { bf_t rem_s, *rem; bf_sqrt(r, a, (a->expn + 1) / 2, BF_RNDZ); bf_rint(r, BF_RNDZ); /* see if the result is exact by computing the remainder */ if (rem1) { rem = rem1; } else { rem = &rem_s; bf_init(r->ctx, rem); } /* XXX: could avoid recomputing the remainder */ bf_mul(rem, r, r, BF_PREC_INF, BF_RNDZ); bf_neg(rem); bf_add(rem, rem, a, BF_PREC_INF, BF_RNDZ); if (bf_is_nan(rem)) { ret = BF_ST_MEM_ERROR; goto done; } if (rem->len != 0) { ret = BF_ST_INEXACT; } else { ret = 0; } done: if (!rem1) bf_delete(rem); } return ret; } int bf_sqrt(bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags) { bf_context_t *s = a->ctx; int ret; assert(r != a); if (a->len == 0) { if (a->expn == BF_EXP_NAN) { bf_set_nan(r); } else if (a->expn == BF_EXP_INF && a->sign) { goto invalid_op; } else { bf_set(r, a); } ret = 0; } else if (a->sign) { invalid_op: bf_set_nan(r); ret = BF_ST_INVALID_OP; } else { limb_t *a1; slimb_t n, n1; limb_t res; /* convert the mantissa to an integer with at least 2 * prec + 4 bits */ n = (2 * (prec + 2) + 2 * LIMB_BITS - 1) / (2 * LIMB_BITS); if (bf_resize(r, n)) goto fail; a1 = bf_malloc(s, sizeof(limb_t) * 2 * n); if (!a1) goto fail; n1 = bf_min(2 * n, a->len); memset(a1, 0, (2 * n - n1) * sizeof(limb_t)); memcpy(a1 + 2 * n - n1, a->tab + a->len - n1, n1 * sizeof(limb_t)); if (a->expn & 1) { res = mp_shr(a1, a1, 2 * n, 1, 0); } else { res = 0; } if (mp_sqrtrem(s, r->tab, a1, n)) { bf_free(s, a1); goto fail; } if (!res) { res = mp_scan_nz(a1, n + 1); } bf_free(s, a1); if (!res) { res = mp_scan_nz(a->tab, a->len - n1); } if (res != 0) r->tab[0] |= 1; r->sign = 0; r->expn = (a->expn + 1) >> 1; ret = bf_round(r, prec, flags); } return ret; fail: bf_set_nan(r); return BF_ST_MEM_ERROR; } static no_inline int bf_op2(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags, bf_op2_func_t *func) { bf_t tmp; int ret; if (r == a || r == b) { bf_init(r->ctx, &tmp); ret = func(&tmp, a, b, prec, flags); bf_move(r, &tmp); } else { ret = func(r, a, b, prec, flags); } return ret; } int bf_add(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags) { return bf_op2(r, a, b, prec, flags, __bf_add); } int bf_sub(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags) { return bf_op2(r, a, b, prec, flags, __bf_sub); } int bf_div(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags) { return bf_op2(r, a, b, prec, flags, __bf_div); } int bf_mul_ui(bf_t *r, const bf_t *a, uint64_t b1, limb_t prec, bf_flags_t flags) { bf_t b; int ret; bf_init(r->ctx, &b); ret = bf_set_ui(&b, b1); ret |= bf_mul(r, a, &b, prec, flags); bf_delete(&b); return ret; } int bf_mul_si(bf_t *r, const bf_t *a, int64_t b1, limb_t prec, bf_flags_t flags) { bf_t b; int ret; bf_init(r->ctx, &b); ret = bf_set_si(&b, b1); ret |= bf_mul(r, a, &b, prec, flags); bf_delete(&b); return ret; } int bf_add_si(bf_t *r, const bf_t *a, int64_t b1, limb_t prec, bf_flags_t flags) { bf_t b; int ret; bf_init(r->ctx, &b); ret = bf_set_si(&b, b1); ret |= bf_add(r, a, &b, prec, flags); bf_delete(&b); return ret; } static int bf_pow_ui(bf_t *r, const bf_t *a, limb_t b, limb_t prec, bf_flags_t flags) { int ret, n_bits, i; assert(r != a); if (b == 0) return bf_set_ui(r, 1); ret = bf_set(r, a); n_bits = LIMB_BITS - clz(b); for(i = n_bits - 2; i >= 0; i--) { ret |= bf_mul(r, r, r, prec, flags); if ((b >> i) & 1) ret |= bf_mul(r, r, a, prec, flags); } return ret; } static int bf_pow_ui_ui(bf_t *r, limb_t a1, limb_t b, limb_t prec, bf_flags_t flags) { bf_t a; int ret; if (a1 == 10 && b <= LIMB_DIGITS) { /* use precomputed powers. We do not round at this point because we expect the caller to do it */ ret = bf_set_ui(r, mp_pow_dec[b]); } else { bf_init(r->ctx, &a); ret = bf_set_ui(&a, a1); ret |= bf_pow_ui(r, &a, b, prec, flags); bf_delete(&a); } return ret; } /* convert to integer (infinite precision) */ int bf_rint(bf_t *r, int rnd_mode) { return bf_round(r, 0, rnd_mode | BF_FLAG_RADPNT_PREC); } /* logical operations */ #define BF_LOGIC_OR 0 #define BF_LOGIC_XOR 1 #define BF_LOGIC_AND 2 static inline limb_t bf_logic_op1(limb_t a, limb_t b, int op) { switch(op) { case BF_LOGIC_OR: return a | b; case BF_LOGIC_XOR: return a ^ b; default: case BF_LOGIC_AND: return a & b; } } static int bf_logic_op(bf_t *r, const bf_t *a1, const bf_t *b1, int op) { bf_t b1_s, a1_s, *a, *b; limb_t a_sign, b_sign, r_sign; slimb_t l, i, a_bit_offset, b_bit_offset; limb_t v1, v2, v1_mask, v2_mask, r_mask; int ret; assert(r != a1 && r != b1); if (a1->expn <= 0) a_sign = 0; /* minus zero is considered as positive */ else a_sign = a1->sign; if (b1->expn <= 0) b_sign = 0; /* minus zero is considered as positive */ else b_sign = b1->sign; if (a_sign) { a = &a1_s; bf_init(r->ctx, a); if (bf_add_si(a, a1, 1, BF_PREC_INF, BF_RNDZ)) { b = NULL; goto fail; } } else { a = (bf_t *)a1; } if (b_sign) { b = &b1_s; bf_init(r->ctx, b); if (bf_add_si(b, b1, 1, BF_PREC_INF, BF_RNDZ)) goto fail; } else { b = (bf_t *)b1; } r_sign = bf_logic_op1(a_sign, b_sign, op); if (op == BF_LOGIC_AND && r_sign == 0) { /* no need to compute extra zeros for and */ if (a_sign == 0 && b_sign == 0) l = bf_min(a->expn, b->expn); else if (a_sign == 0) l = a->expn; else l = b->expn; } else { l = bf_max(a->expn, b->expn); } /* Note: a or b can be zero */ l = (bf_max(l, 1) + LIMB_BITS - 1) / LIMB_BITS; if (bf_resize(r, l)) goto fail; a_bit_offset = a->len * LIMB_BITS - a->expn; b_bit_offset = b->len * LIMB_BITS - b->expn; v1_mask = -a_sign; v2_mask = -b_sign; r_mask = -r_sign; for(i = 0; i < l; i++) { v1 = get_bits(a->tab, a->len, a_bit_offset + i * LIMB_BITS) ^ v1_mask; v2 = get_bits(b->tab, b->len, b_bit_offset + i * LIMB_BITS) ^ v2_mask; r->tab[i] = bf_logic_op1(v1, v2, op) ^ r_mask; } r->expn = l * LIMB_BITS; r->sign = r_sign; bf_normalize_and_round(r, BF_PREC_INF, BF_RNDZ); /* cannot fail */ if (r_sign) { if (bf_add_si(r, r, -1, BF_PREC_INF, BF_RNDZ)) goto fail; } ret = 0; done: if (a == &a1_s) bf_delete(a); if (b == &b1_s) bf_delete(b); return ret; fail: bf_set_nan(r); ret = BF_ST_MEM_ERROR; goto done; } /* 'a' and 'b' must be integers. Return 0 or BF_ST_MEM_ERROR. */ int bf_logic_or(bf_t *r, const bf_t *a, const bf_t *b) { return bf_logic_op(r, a, b, BF_LOGIC_OR); } /* 'a' and 'b' must be integers. Return 0 or BF_ST_MEM_ERROR. */ int bf_logic_xor(bf_t *r, const bf_t *a, const bf_t *b) { return bf_logic_op(r, a, b, BF_LOGIC_XOR); } /* 'a' and 'b' must be integers. Return 0 or BF_ST_MEM_ERROR. */ int bf_logic_and(bf_t *r, const bf_t *a, const bf_t *b) { return bf_logic_op(r, a, b, BF_LOGIC_AND); } /* conversion between fixed size types */ typedef union { double d; uint64_t u; } Float64Union; int bf_get_float64(const bf_t *a, double *pres, bf_rnd_t rnd_mode) { Float64Union u; int e, ret; uint64_t m; ret = 0; if (a->expn == BF_EXP_NAN) { u.u = 0x7ff8000000000000; /* quiet nan */ } else { bf_t b_s, *b = &b_s; bf_init(a->ctx, b); bf_set(b, a); if (bf_is_finite(b)) { ret = bf_round(b, 53, rnd_mode | BF_FLAG_SUBNORMAL | bf_set_exp_bits(11)); } if (b->expn == BF_EXP_INF) { e = (1 << 11) - 1; m = 0; } else if (b->expn == BF_EXP_ZERO) { e = 0; m = 0; } else { e = b->expn + 1023 - 1; #if LIMB_BITS == 32 if (b->len == 2) { m = ((uint64_t)b->tab[1] << 32) | b->tab[0]; } else { m = ((uint64_t)b->tab[0] << 32); } #else m = b->tab[0]; #endif if (e <= 0) { /* subnormal */ m = m >> (12 - e); e = 0; } else { m = (m << 1) >> 12; } } u.u = m | ((uint64_t)e << 52) | ((uint64_t)b->sign << 63); bf_delete(b); } *pres = u.d; return ret; } int bf_set_float64(bf_t *a, double d) { Float64Union u; uint64_t m; int shift, e, sgn; u.d = d; sgn = u.u >> 63; e = (u.u >> 52) & ((1 << 11) - 1); m = u.u & (((uint64_t)1 << 52) - 1); if (e == ((1 << 11) - 1)) { if (m != 0) { bf_set_nan(a); } else { bf_set_inf(a, sgn); } } else if (e == 0) { if (m == 0) { bf_set_zero(a, sgn); } else { /* subnormal number */ m <<= 12; shift = clz64(m); m <<= shift; e = -shift; goto norm; } } else { m = (m << 11) | ((uint64_t)1 << 63); norm: a->expn = e - 1023 + 1; #if LIMB_BITS == 32 if (bf_resize(a, 2)) goto fail; a->tab[0] = m; a->tab[1] = m >> 32; #else if (bf_resize(a, 1)) goto fail; a->tab[0] = m; #endif a->sign = sgn; } return 0; fail: bf_set_nan(a); return BF_ST_MEM_ERROR; } /* The rounding mode is always BF_RNDZ. Return BF_ST_INVALID_OP if there is an overflow and 0 otherwise. */ int bf_get_int32(int *pres, const bf_t *a, int flags) { uint32_t v; int ret; if (a->expn >= BF_EXP_INF) { ret = BF_ST_INVALID_OP; if (flags & BF_GET_INT_MOD) { v = 0; } else if (a->expn == BF_EXP_INF) { v = (uint32_t)INT32_MAX + a->sign; } else { v = INT32_MAX; } } else if (a->expn <= 0) { v = 0; ret = 0; } else if (a->expn <= 31) { v = a->tab[a->len - 1] >> (LIMB_BITS - a->expn); if (a->sign) v = -v; ret = 0; } else if (!(flags & BF_GET_INT_MOD)) { ret = BF_ST_INVALID_OP; if (a->sign) { v = (uint32_t)INT32_MAX + 1; if (a->expn == 32 && (a->tab[a->len - 1] >> (LIMB_BITS - 32)) == v) { ret = 0; } } else { v = INT32_MAX; } } else { v = get_bits(a->tab, a->len, a->len * LIMB_BITS - a->expn); if (a->sign) v = -v; ret = 0; } *pres = v; return ret; } /* The rounding mode is always BF_RNDZ. Return BF_ST_INVALID_OP if there is an overflow and 0 otherwise. */ int bf_get_int64(int64_t *pres, const bf_t *a, int flags) { uint64_t v; int ret; if (a->expn >= BF_EXP_INF) { ret = BF_ST_INVALID_OP; if (flags & BF_GET_INT_MOD) { v = 0; } else if (a->expn == BF_EXP_INF) { v = (uint64_t)INT64_MAX + a->sign; } else { v = INT64_MAX; } } else if (a->expn <= 0) { v = 0; ret = 0; } else if (a->expn <= 63) { #if LIMB_BITS == 32 if (a->expn <= 32) v = a->tab[a->len - 1] >> (LIMB_BITS - a->expn); else v = (((uint64_t)a->tab[a->len - 1] << 32) | get_limbz(a, a->len - 2)) >> (64 - a->expn); #else v = a->tab[a->len - 1] >> (LIMB_BITS - a->expn); #endif if (a->sign) v = -v; ret = 0; } else if (!(flags & BF_GET_INT_MOD)) { ret = BF_ST_INVALID_OP; if (a->sign) { uint64_t v1; v = (uint64_t)INT64_MAX + 1; if (a->expn == 64) { v1 = a->tab[a->len - 1]; #if LIMB_BITS == 32 v1 = (v1 << 32) | get_limbz(a, a->len - 2); #endif if (v1 == v) ret = 0; } } else { v = INT64_MAX; } } else { slimb_t bit_pos = a->len * LIMB_BITS - a->expn; v = get_bits(a->tab, a->len, bit_pos); #if LIMB_BITS == 32 v |= (uint64_t)get_bits(a->tab, a->len, bit_pos + 32) << 32; #endif if (a->sign) v = -v; ret = 0; } *pres = v; return ret; } /* The rounding mode is always BF_RNDZ. Return BF_ST_INVALID_OP if there is an overflow and 0 otherwise. */ int bf_get_uint64(uint64_t *pres, const bf_t *a) { uint64_t v; int ret; if (a->expn == BF_EXP_NAN) { goto overflow; } else if (a->expn <= 0) { v = 0; ret = 0; } else if (a->sign) { v = 0; ret = BF_ST_INVALID_OP; } else if (a->expn <= 64) { #if LIMB_BITS == 32 if (a->expn <= 32) v = a->tab[a->len - 1] >> (LIMB_BITS - a->expn); else v = (((uint64_t)a->tab[a->len - 1] << 32) | get_limbz(a, a->len - 2)) >> (64 - a->expn); #else v = a->tab[a->len - 1] >> (LIMB_BITS - a->expn); #endif ret = 0; } else { overflow: v = UINT64_MAX; ret = BF_ST_INVALID_OP; } *pres = v; return ret; } /* base conversion from radix */ static const uint8_t digits_per_limb_table[BF_RADIX_MAX - 1] = { #if LIMB_BITS == 32 32,20,16,13,12,11,10,10, 9, 9, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, #else 64,40,32,27,24,22,21,20,19,18,17,17,16,16,16,15,15,15,14,14,14,14,13,13,13,13,13,13,13,12,12,12,12,12,12, #endif }; static limb_t get_limb_radix(int radix) { int i, k; limb_t radixl; k = digits_per_limb_table[radix - 2]; radixl = radix; for(i = 1; i < k; i++) radixl *= radix; return radixl; } /* return != 0 if error */ static int bf_integer_from_radix_rec(bf_t *r, const limb_t *tab, limb_t n, int level, limb_t n0, limb_t radix, bf_t *pow_tab) { int ret; if (n == 1) { ret = bf_set_ui(r, tab[0]); } else { bf_t T_s, *T = &T_s, *B; limb_t n1, n2; n2 = (((n0 * 2) >> (level + 1)) + 1) / 2; n1 = n - n2; // printf("level=%d n0=%ld n1=%ld n2=%ld\n", level, n0, n1, n2); B = &pow_tab[level]; if (B->len == 0) { ret = bf_pow_ui_ui(B, radix, n2, BF_PREC_INF, BF_RNDZ); if (ret) return ret; } ret = bf_integer_from_radix_rec(r, tab + n2, n1, level + 1, n0, radix, pow_tab); if (ret) return ret; ret = bf_mul(r, r, B, BF_PREC_INF, BF_RNDZ); if (ret) return ret; bf_init(r->ctx, T); ret = bf_integer_from_radix_rec(T, tab, n2, level + 1, n0, radix, pow_tab); if (!ret) ret = bf_add(r, r, T, BF_PREC_INF, BF_RNDZ); bf_delete(T); } return ret; // bf_print_str(" r=", r); } /* return 0 if OK != 0 if memory error */ static int bf_integer_from_radix(bf_t *r, const limb_t *tab, limb_t n, limb_t radix) { bf_context_t *s = r->ctx; int pow_tab_len, i, ret; limb_t radixl; bf_t *pow_tab; radixl = get_limb_radix(radix); pow_tab_len = ceil_log2(n) + 2; /* XXX: check */ pow_tab = bf_malloc(s, sizeof(pow_tab[0]) * pow_tab_len); if (!pow_tab) return -1; for(i = 0; i < pow_tab_len; i++) bf_init(r->ctx, &pow_tab[i]); ret = bf_integer_from_radix_rec(r, tab, n, 0, n, radixl, pow_tab); for(i = 0; i < pow_tab_len; i++) { bf_delete(&pow_tab[i]); } bf_free(s, pow_tab); return ret; } /* compute and round T * radix^expn. */ int bf_mul_pow_radix(bf_t *r, const bf_t *T, limb_t radix, slimb_t expn, limb_t prec, bf_flags_t flags) { int ret, expn_sign, overflow; slimb_t e, extra_bits, prec1, ziv_extra_bits; bf_t B_s, *B = &B_s; if (T->len == 0) { return bf_set(r, T); } else if (expn == 0) { ret = bf_set(r, T); ret |= bf_round(r, prec, flags); return ret; } e = expn; expn_sign = 0; if (e < 0) { e = -e; expn_sign = 1; } bf_init(r->ctx, B); if (prec == BF_PREC_INF) { /* infinite precision: only used if the result is known to be exact */ ret = bf_pow_ui_ui(B, radix, e, BF_PREC_INF, BF_RNDN); if (expn_sign) { ret |= bf_div(r, T, B, T->len * LIMB_BITS, BF_RNDN); } else { ret |= bf_mul(r, T, B, BF_PREC_INF, BF_RNDN); } } else { ziv_extra_bits = 16; for(;;) { prec1 = prec + ziv_extra_bits; /* XXX: correct overflow/underflow handling */ /* XXX: rigorous error analysis needed */ extra_bits = ceil_log2(e) * 2 + 1; ret = bf_pow_ui_ui(B, radix, e, prec1 + extra_bits, BF_RNDN | BF_FLAG_EXT_EXP); overflow = !bf_is_finite(B); /* XXX: if bf_pow_ui_ui returns an exact result, can stop after the next operation */ if (expn_sign) ret |= bf_div(r, T, B, prec1 + extra_bits, BF_RNDN | BF_FLAG_EXT_EXP); else ret |= bf_mul(r, T, B, prec1 + extra_bits, BF_RNDN | BF_FLAG_EXT_EXP); if (ret & BF_ST_MEM_ERROR) break; if ((ret & BF_ST_INEXACT) && !bf_can_round(r, prec, flags & BF_RND_MASK, prec1) && !overflow) { /* and more precision and retry */ ziv_extra_bits = ziv_extra_bits + (ziv_extra_bits / 2); } else { /* XXX: need to use __bf_round() to pass the inexact flag for the subnormal case */ ret = bf_round(r, prec, flags) | (ret & BF_ST_INEXACT); break; } } } bf_delete(B); return ret; } static inline int bf_to_digit(int c) { if (c >= '0' && c <= '9') return c - '0'; else if (c >= 'A' && c <= 'Z') return c - 'A' + 10; else if (c >= 'a' && c <= 'z') return c - 'a' + 10; else return 36; } /* add a limb at 'pos' and decrement pos. new space is created if needed. Return 0 if OK, -1 if memory error */ static int bf_add_limb(bf_t *a, slimb_t *ppos, limb_t v) { slimb_t pos; pos = *ppos; if (unlikely(pos < 0)) { limb_t new_size, d, *new_tab; new_size = bf_max(a->len + 1, a->len * 3 / 2); new_tab = bf_realloc(a->ctx, a->tab, sizeof(limb_t) * new_size); if (!new_tab) return -1; a->tab = new_tab; d = new_size - a->len; memmove(a->tab + d, a->tab, a->len * sizeof(limb_t)); a->len = new_size; pos += d; } a->tab[pos--] = v; *ppos = pos; return 0; } static int bf_tolower(int c) { if (c >= 'A' && c <= 'Z') c = c - 'A' + 'a'; return c; } static int strcasestart(const char *str, const char *val, const char **ptr) { const char *p, *q; p = str; q = val; while (*q != '\0') { if (bf_tolower(*p) != *q) return 0; p++; q++; } if (ptr) *ptr = p; return 1; } static int bf_atof_internal(bf_t *r, slimb_t *pexponent, const char *str, const char **pnext, int radix, limb_t prec, bf_flags_t flags, bool is_dec) { const char *p, *p_start; int is_neg, radix_bits, exp_is_neg, ret, digits_per_limb, shift; limb_t cur_limb; slimb_t pos, expn, int_len, digit_count; bool has_decpt, is_bin_exp; bf_t a_s, *a; *pexponent = 0; p = str; if (!(flags & BF_ATOF_NO_NAN_INF) && radix <= 16 && strcasestart(p, "nan", &p)) { bf_set_nan(r); ret = 0; goto done; } is_neg = 0; if (p[0] == '+') { p++; p_start = p; } else if (p[0] == '-') { is_neg = 1; p++; p_start = p; } else { p_start = p; } if (p[0] == '0') { if ((p[1] == 'x' || p[1] == 'X') && (radix == 0 || radix == 16) && !(flags & BF_ATOF_NO_HEX)) { radix = 16; p += 2; } else if ((p[1] == 'o' || p[1] == 'O') && radix == 0 && (flags & BF_ATOF_BIN_OCT)) { p += 2; radix = 8; } else if ((p[1] == 'b' || p[1] == 'B') && radix == 0 && (flags & BF_ATOF_BIN_OCT)) { p += 2; radix = 2; } else { goto no_prefix; } /* there must be a digit after the prefix */ if (bf_to_digit((uint8_t)*p) >= radix) { bf_set_nan(r); ret = 0; goto done; } no_prefix: ; } else { if (!(flags & BF_ATOF_NO_NAN_INF) && radix <= 16 && strcasestart(p, "inf", &p)) { bf_set_inf(r, is_neg); ret = 0; goto done; } } if (radix == 0) radix = 10; if (is_dec) { assert(radix == 10); radix_bits = 0; a = r; } else if ((radix & (radix - 1)) != 0) { radix_bits = 0; /* base is not a power of two */ a = &a_s; bf_init(r->ctx, a); } else { radix_bits = ceil_log2(radix); a = r; } /* skip leading zeros */ /* XXX: could also skip zeros after the decimal point */ while (*p == '0') p++; if (radix_bits) { shift = digits_per_limb = LIMB_BITS; } else { radix_bits = 0; shift = digits_per_limb = digits_per_limb_table[radix - 2]; } cur_limb = 0; bf_resize(a, 1); pos = 0; has_decpt = false; int_len = digit_count = 0; for(;;) { limb_t c; if (*p == '.' && (p > p_start || bf_to_digit(p[1]) < radix)) { if (has_decpt) break; has_decpt = true; int_len = digit_count; p++; } c = bf_to_digit(*p); if (c >= radix) break; digit_count++; p++; if (radix_bits) { shift -= radix_bits; if (shift <= 0) { cur_limb |= c >> (-shift); if (bf_add_limb(a, &pos, cur_limb)) goto mem_error; if (shift < 0) cur_limb = c << (LIMB_BITS + shift); else cur_limb = 0; shift += LIMB_BITS; } else { cur_limb |= c << shift; } } else { cur_limb = cur_limb * radix + c; shift--; if (shift == 0) { if (bf_add_limb(a, &pos, cur_limb)) goto mem_error; shift = digits_per_limb; cur_limb = 0; } } } if (!has_decpt) int_len = digit_count; /* add the last limb and pad with zeros */ if (shift != digits_per_limb) { if (radix_bits == 0) { while (shift != 0) { cur_limb *= radix; shift--; } } if (bf_add_limb(a, &pos, cur_limb)) { mem_error: ret = BF_ST_MEM_ERROR; if (!radix_bits) bf_delete(a); bf_set_nan(r); goto done; } } /* reset the next limbs to zero (we prefer to reallocate in the renormalization) */ memset(a->tab, 0, (pos + 1) * sizeof(limb_t)); if (p == p_start) { ret = 0; if (!radix_bits) bf_delete(a); bf_set_nan(r); goto done; } /* parse the exponent, if any */ expn = 0; is_bin_exp = false; if (((radix == 10 && (*p == 'e' || *p == 'E')) || (radix != 10 && (*p == '@' || (radix_bits && (*p == 'p' || *p == 'P'))))) && p > p_start) { is_bin_exp = (*p == 'p' || *p == 'P'); p++; exp_is_neg = 0; if (*p == '+') { p++; } else if (*p == '-') { exp_is_neg = 1; p++; } for(;;) { int c; c = bf_to_digit(*p); if (c >= 10) break; if (unlikely(expn > ((BF_RAW_EXP_MAX - 2 - 9) / 10))) { /* exponent overflow */ if (exp_is_neg) { bf_set_zero(r, is_neg); ret = BF_ST_UNDERFLOW | BF_ST_INEXACT; } else { bf_set_inf(r, is_neg); ret = BF_ST_OVERFLOW | BF_ST_INEXACT; } goto done; } p++; expn = expn * 10 + c; } if (exp_is_neg) expn = -expn; } if (is_dec) { a->expn = expn + int_len; a->sign = is_neg; ret = bfdec_normalize_and_round((bfdec_t *)a, prec, flags); } else if (radix_bits) { /* XXX: may overflow */ if (!is_bin_exp) expn *= radix_bits; a->expn = expn + (int_len * radix_bits); a->sign = is_neg; ret = bf_normalize_and_round(a, prec, flags); } else { limb_t l; pos++; l = a->len - pos; /* number of limbs */ if (l == 0) { bf_set_zero(r, is_neg); ret = 0; } else { bf_t T_s, *T = &T_s; expn -= l * digits_per_limb - int_len; bf_init(r->ctx, T); if (bf_integer_from_radix(T, a->tab + pos, l, radix)) { bf_set_nan(r); ret = BF_ST_MEM_ERROR; } else { T->sign = is_neg; if (flags & BF_ATOF_EXPONENT) { /* return the exponent */ *pexponent = expn; ret = bf_set(r, T); } else { ret = bf_mul_pow_radix(r, T, radix, expn, prec, flags); } } bf_delete(T); } bf_delete(a); } done: if (pnext) *pnext = p; return ret; } /* Return (status, n, exp). 'status' is the floating point status. 'n' is the parsed number. If (flags & BF_ATOF_EXPONENT) and if the radix is not a power of two, the parsed number is equal to r * (*pexponent)^radix. Otherwise *pexponent = 0. */ int bf_atof2(bf_t *r, slimb_t *pexponent, const char *str, const char **pnext, int radix, limb_t prec, bf_flags_t flags) { return bf_atof_internal(r, pexponent, str, pnext, radix, prec, flags, false); } int bf_atof(bf_t *r, const char *str, const char **pnext, int radix, limb_t prec, bf_flags_t flags) { slimb_t dummy_exp; return bf_atof_internal(r, &dummy_exp, str, pnext, radix, prec, flags, false); } /* base conversion to radix */ #if LIMB_BITS == 64 #define RADIXL_10 UINT64_C(10000000000000000000) #else #define RADIXL_10 UINT64_C(1000000000) #endif static const uint32_t inv_log2_radix[BF_RADIX_MAX - 1][LIMB_BITS / 32 + 1] = { #if LIMB_BITS == 32 { 0x80000000, 0x00000000,}, { 0x50c24e60, 0xd4d4f4a7,}, { 0x40000000, 0x00000000,}, { 0x372068d2, 0x0a1ee5ca,}, { 0x3184648d, 0xb8153e7a,}, { 0x2d983275, 0x9d5369c4,}, { 0x2aaaaaaa, 0xaaaaaaab,}, { 0x28612730, 0x6a6a7a54,}, { 0x268826a1, 0x3ef3fde6,}, { 0x25001383, 0xbac8a744,}, { 0x23b46706, 0x82c0c709,}, { 0x229729f1, 0xb2c83ded,}, { 0x219e7ffd, 0xa5ad572b,}, { 0x20c33b88, 0xda7c29ab,}, { 0x20000000, 0x00000000,}, { 0x1f50b57e, 0xac5884b3,}, { 0x1eb22cc6, 0x8aa6e26f,}, { 0x1e21e118, 0x0c5daab2,}, { 0x1d9dcd21, 0x439834e4,}, { 0x1d244c78, 0x367a0d65,}, { 0x1cb40589, 0xac173e0c,}, { 0x1c4bd95b, 0xa8d72b0d,}, { 0x1bead768, 0x98f8ce4c,}, { 0x1b903469, 0x050f72e5,}, { 0x1b3b433f, 0x2eb06f15,}, { 0x1aeb6f75, 0x9c46fc38,}, { 0x1aa038eb, 0x0e3bfd17,}, { 0x1a593062, 0xb38d8c56,}, { 0x1a15f4c3, 0x2b95a2e6,}, { 0x19d630dc, 0xcc7ddef9,}, { 0x19999999, 0x9999999a,}, { 0x195fec80, 0x8a609431,}, { 0x1928ee7b, 0x0b4f22f9,}, { 0x18f46acf, 0x8c06e318,}, { 0x18c23246, 0xdc0a9f3d,}, #else { 0x80000000, 0x00000000, 0x00000000,}, { 0x50c24e60, 0xd4d4f4a7, 0x021f57bc,}, { 0x40000000, 0x00000000, 0x00000000,}, { 0x372068d2, 0x0a1ee5ca, 0x19ea911b,}, { 0x3184648d, 0xb8153e7a, 0x7fc2d2e1,}, { 0x2d983275, 0x9d5369c4, 0x4dec1661,}, { 0x2aaaaaaa, 0xaaaaaaaa, 0xaaaaaaab,}, { 0x28612730, 0x6a6a7a53, 0x810fabde,}, { 0x268826a1, 0x3ef3fde6, 0x23e2566b,}, { 0x25001383, 0xbac8a744, 0x385a3349,}, { 0x23b46706, 0x82c0c709, 0x3f891718,}, { 0x229729f1, 0xb2c83ded, 0x15fba800,}, { 0x219e7ffd, 0xa5ad572a, 0xe169744b,}, { 0x20c33b88, 0xda7c29aa, 0x9bddee52,}, { 0x20000000, 0x00000000, 0x00000000,}, { 0x1f50b57e, 0xac5884b3, 0x70e28eee,}, { 0x1eb22cc6, 0x8aa6e26f, 0x06d1a2a2,}, { 0x1e21e118, 0x0c5daab1, 0x81b4f4bf,}, { 0x1d9dcd21, 0x439834e3, 0x81667575,}, { 0x1d244c78, 0x367a0d64, 0xc8204d6d,}, { 0x1cb40589, 0xac173e0c, 0x3b7b16ba,}, { 0x1c4bd95b, 0xa8d72b0d, 0x5879f25a,}, { 0x1bead768, 0x98f8ce4c, 0x66cc2858,}, { 0x1b903469, 0x050f72e5, 0x0cf5488e,}, { 0x1b3b433f, 0x2eb06f14, 0x8c89719c,}, { 0x1aeb6f75, 0x9c46fc37, 0xab5fc7e9,}, { 0x1aa038eb, 0x0e3bfd17, 0x1bd62080,}, { 0x1a593062, 0xb38d8c56, 0x7998ab45,}, { 0x1a15f4c3, 0x2b95a2e6, 0x46aed6a0,}, { 0x19d630dc, 0xcc7ddef9, 0x5aadd61b,}, { 0x19999999, 0x99999999, 0x9999999a,}, { 0x195fec80, 0x8a609430, 0xe1106014,}, { 0x1928ee7b, 0x0b4f22f9, 0x5f69791d,}, { 0x18f46acf, 0x8c06e318, 0x4d2aeb2c,}, { 0x18c23246, 0xdc0a9f3d, 0x3fe16970,}, #endif }; static const limb_t log2_radix[BF_RADIX_MAX - 1] = { #if LIMB_BITS == 32 0x20000000, 0x32b80347, 0x40000000, 0x4a4d3c26, 0x52b80347, 0x59d5d9fd, 0x60000000, 0x6570068e, 0x6a4d3c26, 0x6eb3a9f0, 0x72b80347, 0x766a008e, 0x79d5d9fd, 0x7d053f6d, 0x80000000, 0x82cc7edf, 0x8570068e, 0x87ef05ae, 0x8a4d3c26, 0x8c8ddd45, 0x8eb3a9f0, 0x90c10501, 0x92b80347, 0x949a784c, 0x966a008e, 0x982809d6, 0x99d5d9fd, 0x9b74948f, 0x9d053f6d, 0x9e88c6b3, 0xa0000000, 0xa16bad37, 0xa2cc7edf, 0xa4231623, 0xa570068e, #else 0x2000000000000000, 0x32b803473f7ad0f4, 0x4000000000000000, 0x4a4d3c25e68dc57f, 0x52b803473f7ad0f4, 0x59d5d9fd5010b366, 0x6000000000000000, 0x6570068e7ef5a1e8, 0x6a4d3c25e68dc57f, 0x6eb3a9f01975077f, 0x72b803473f7ad0f4, 0x766a008e4788cbcd, 0x79d5d9fd5010b366, 0x7d053f6d26089673, 0x8000000000000000, 0x82cc7edf592262d0, 0x8570068e7ef5a1e8, 0x87ef05ae409a0289, 0x8a4d3c25e68dc57f, 0x8c8ddd448f8b845a, 0x8eb3a9f01975077f, 0x90c10500d63aa659, 0x92b803473f7ad0f4, 0x949a784bcd1b8afe, 0x966a008e4788cbcd, 0x982809d5be7072dc, 0x99d5d9fd5010b366, 0x9b74948f5532da4b, 0x9d053f6d26089673, 0x9e88c6b3626a72aa, 0xa000000000000000, 0xa16bad3758efd873, 0xa2cc7edf592262d0, 0xa4231623369e78e6, 0xa570068e7ef5a1e8, #endif }; /* compute floor(a*b) or ceil(a*b) with b = log2(radix) or b=1/log2(radix). For is_inv = 0, strict accuracy is not guaranteed when radix is not a power of two. */ slimb_t bf_mul_log2_radix(slimb_t a1, unsigned int radix, int is_inv, int is_ceil1) { int is_neg; limb_t a; bool is_ceil; is_ceil = is_ceil1; a = a1; if (a1 < 0) { a = -a; is_neg = 1; } else { is_neg = 0; } is_ceil ^= is_neg; if ((radix & (radix - 1)) == 0) { int radix_bits; /* radix is a power of two */ radix_bits = ceil_log2(radix); if (is_inv) { if (is_ceil) a += radix_bits - 1; a = a / radix_bits; } else { a = a * radix_bits; } } else { const uint32_t *tab; limb_t b0, b1; dlimb_t t; if (is_inv) { tab = inv_log2_radix[radix - 2]; #if LIMB_BITS == 32 b1 = tab[0]; b0 = tab[1]; #else b1 = ((limb_t)tab[0] << 32) | tab[1]; b0 = (limb_t)tab[2] << 32; #endif t = (dlimb_t)b0 * (dlimb_t)a; t = (dlimb_t)b1 * (dlimb_t)a + (t >> LIMB_BITS); a = t >> (LIMB_BITS - 1); } else { b0 = log2_radix[radix - 2]; t = (dlimb_t)b0 * (dlimb_t)a; a = t >> (LIMB_BITS - 3); } /* a = floor(result) and 'result' cannot be an integer */ a += is_ceil; } if (is_neg) a = -a; return a; } /* 'n' is the number of output limbs */ static int bf_integer_to_radix_rec(bf_t *pow_tab, limb_t *out, const bf_t *a, limb_t n, int level, limb_t n0, limb_t radixl, unsigned int radixl_bits) { limb_t n1, n2, q_prec; int ret; assert(n >= 1); if (n == 1) { out[0] = get_bits(a->tab, a->len, a->len * LIMB_BITS - a->expn); } else if (n == 2) { dlimb_t t; slimb_t pos; pos = a->len * LIMB_BITS - a->expn; t = ((dlimb_t)get_bits(a->tab, a->len, pos + LIMB_BITS) << LIMB_BITS) | get_bits(a->tab, a->len, pos); if (likely(radixl == RADIXL_10)) { /* use division by a constant when possible */ out[0] = t % RADIXL_10; out[1] = t / RADIXL_10; } else { out[0] = t % radixl; out[1] = t / radixl; } } else { bf_t Q, R, *B, *B_inv; int q_add; bf_init(a->ctx, &Q); bf_init(a->ctx, &R); n2 = (((n0 * 2) >> (level + 1)) + 1) / 2; n1 = n - n2; B = &pow_tab[2 * level]; B_inv = &pow_tab[2 * level + 1]; ret = 0; if (B->len == 0) { /* compute BASE^n2 */ ret |= bf_pow_ui_ui(B, radixl, n2, BF_PREC_INF, BF_RNDZ); /* we use enough bits for the maximum possible 'n1' value, i.e. n2 + 1 */ ret |= bf_set_ui(&R, 1); ret |= bf_div(B_inv, &R, B, (n2 + 1) * radixl_bits + 2, BF_RNDN); } // printf("%d: n1=% " PRId64 " n2=%" PRId64 "\n", level, n1, n2); q_prec = n1 * radixl_bits; ret |= bf_mul(&Q, a, B_inv, q_prec, BF_RNDN); ret |= bf_rint(&Q, BF_RNDZ); ret |= bf_mul(&R, &Q, B, BF_PREC_INF, BF_RNDZ); ret |= bf_sub(&R, a, &R, BF_PREC_INF, BF_RNDZ); if (ret & BF_ST_MEM_ERROR) goto fail; /* adjust if necessary */ q_add = 0; while (R.sign && R.len != 0) { if (bf_add(&R, &R, B, BF_PREC_INF, BF_RNDZ)) goto fail; q_add--; } while (bf_cmpu(&R, B) >= 0) { if (bf_sub(&R, &R, B, BF_PREC_INF, BF_RNDZ)) goto fail; q_add++; } if (q_add != 0) { if (bf_add_si(&Q, &Q, q_add, BF_PREC_INF, BF_RNDZ)) goto fail; } if (bf_integer_to_radix_rec(pow_tab, out + n2, &Q, n1, level + 1, n0, radixl, radixl_bits)) goto fail; if (bf_integer_to_radix_rec(pow_tab, out, &R, n2, level + 1, n0, radixl, radixl_bits)) { fail: bf_delete(&Q); bf_delete(&R); return -1; } bf_delete(&Q); bf_delete(&R); } return 0; } /* return 0 if OK != 0 if memory error */ static int bf_integer_to_radix(bf_t *r, const bf_t *a, limb_t radixl) { bf_context_t *s = r->ctx; limb_t r_len; bf_t *pow_tab; int i, pow_tab_len, ret; r_len = r->len; pow_tab_len = (ceil_log2(r_len) + 2) * 2; /* XXX: check */ pow_tab = bf_malloc(s, sizeof(pow_tab[0]) * pow_tab_len); if (!pow_tab) return -1; for(i = 0; i < pow_tab_len; i++) bf_init(r->ctx, &pow_tab[i]); ret = bf_integer_to_radix_rec(pow_tab, r->tab, a, r_len, 0, r_len, radixl, ceil_log2(radixl)); for(i = 0; i < pow_tab_len; i++) { bf_delete(&pow_tab[i]); } bf_free(s, pow_tab); return ret; } /* a must be >= 0. 'P' is the wanted number of digits in radix 'radix'. 'r' is the mantissa represented as an integer. *pE contains the exponent. Return != 0 if memory error. */ static int bf_convert_to_radix(bf_t *r, slimb_t *pE, const bf_t *a, int radix, limb_t P, bf_rnd_t rnd_mode, bool is_fixed_exponent) { slimb_t E, e, prec, extra_bits, ziv_extra_bits, prec0; bf_t B_s, *B = &B_s; int e_sign, ret, res; if (a->len == 0) { /* zero case */ *pE = 0; return bf_set(r, a); } if (is_fixed_exponent) { E = *pE; } else { /* compute the new exponent */ E = 1 + bf_mul_log2_radix(a->expn - 1, radix, true, false); } // bf_print_str("a", a); // printf("E=%ld P=%ld radix=%d\n", E, P, radix); for(;;) { e = P - E; e_sign = 0; if (e < 0) { e = -e; e_sign = 1; } /* Note: precision for log2(radix) is not critical here */ prec0 = bf_mul_log2_radix(P, radix, false, true); ziv_extra_bits = 16; for(;;) { prec = prec0 + ziv_extra_bits; /* XXX: rigorous error analysis needed */ extra_bits = ceil_log2(e) * 2 + 1; ret = bf_pow_ui_ui(r, radix, e, prec + extra_bits, BF_RNDN | BF_FLAG_EXT_EXP); if (!e_sign) ret |= bf_mul(r, r, a, prec + extra_bits, BF_RNDN | BF_FLAG_EXT_EXP); else ret |= bf_div(r, a, r, prec + extra_bits, BF_RNDN | BF_FLAG_EXT_EXP); if (ret & BF_ST_MEM_ERROR) return BF_ST_MEM_ERROR; /* if the result is not exact, check that it can be safely rounded to an integer */ if ((ret & BF_ST_INEXACT) && !bf_can_round(r, r->expn, rnd_mode, prec)) { /* and more precision and retry */ ziv_extra_bits = ziv_extra_bits + (ziv_extra_bits / 2); continue; } else { ret = bf_rint(r, rnd_mode); if (ret & BF_ST_MEM_ERROR) return BF_ST_MEM_ERROR; break; } } if (is_fixed_exponent) break; /* check that the result is < B^P */ /* XXX: do a fast approximate test first ? */ bf_init(r->ctx, B); ret = bf_pow_ui_ui(B, radix, P, BF_PREC_INF, BF_RNDZ); if (ret) { bf_delete(B); return ret; } res = bf_cmpu(r, B); bf_delete(B); if (res < 0) break; /* try a larger exponent */ E++; } *pE = E; return 0; } static void limb_to_a(char *buf, limb_t n, unsigned int radix, int len) { int digit, i; if (radix == 10) { /* specific case with constant divisor */ for(i = len - 1; i >= 0; i--) { digit = (limb_t)n % 10; n = (limb_t)n / 10; buf[i] = digit + '0'; } } else { for(i = len - 1; i >= 0; i--) { digit = (limb_t)n % radix; n = (limb_t)n / radix; if (digit < 10) digit += '0'; else digit += 'a' - 10; buf[i] = digit; } } } /* for power of 2 radixes */ static void limb_to_a2(char *buf, limb_t n, unsigned int radix_bits, int len) { int digit, i; unsigned int mask; mask = (1 << radix_bits) - 1; for(i = len - 1; i >= 0; i--) { digit = n & mask; n >>= radix_bits; if (digit < 10) digit += '0'; else digit += 'a' - 10; buf[i] = digit; } } /* 'a' must be an integer if the is_dec = false or if the radix is not a power of two. A dot is added before the 'dot_pos' digit. dot_pos = n_digits does not display the dot. 0 <= dot_pos <= n_digits. n_digits >= 1. */ static void output_digits(DynBuf *s, const bf_t *a1, int radix, limb_t n_digits, limb_t dot_pos, bool is_dec) { limb_t i, v, l; slimb_t pos, pos_incr; int digits_per_limb, buf_pos, radix_bits, first_buf_pos; char buf[65]; bf_t a_s, *a; if (is_dec) { digits_per_limb = LIMB_DIGITS; a = (bf_t *)a1; radix_bits = 0; pos = a->len; pos_incr = 1; first_buf_pos = 0; } else if ((radix & (radix - 1)) == 0) { a = (bf_t *)a1; radix_bits = ceil_log2(radix); digits_per_limb = LIMB_BITS / radix_bits; pos_incr = digits_per_limb * radix_bits; /* digits are aligned relative to the radix point */ pos = a->len * LIMB_BITS + smod(-a->expn, radix_bits); first_buf_pos = 0; } else { limb_t n, radixl; digits_per_limb = digits_per_limb_table[radix - 2]; radixl = get_limb_radix(radix); a = &a_s; bf_init(a1->ctx, a); n = (n_digits + digits_per_limb - 1) / digits_per_limb; if (bf_resize(a, n)) { dbuf_set_error(s); goto done; } if (bf_integer_to_radix(a, a1, radixl)) { dbuf_set_error(s); goto done; } radix_bits = 0; pos = n; pos_incr = 1; first_buf_pos = pos * digits_per_limb - n_digits; } buf_pos = digits_per_limb; i = 0; while (i < n_digits) { if (buf_pos == digits_per_limb) { pos -= pos_incr; if (radix_bits == 0) { v = get_limbz(a, pos); limb_to_a(buf, v, radix, digits_per_limb); } else { v = get_bits(a->tab, a->len, pos); limb_to_a2(buf, v, radix_bits, digits_per_limb); } buf_pos = first_buf_pos; first_buf_pos = 0; } if (i < dot_pos) { l = dot_pos; } else { if (i == dot_pos) dbuf_putc(s, '.'); l = n_digits; } l = bf_min(digits_per_limb - buf_pos, l - i); dbuf_put(s, (uint8_t *)(buf + buf_pos), l); buf_pos += l; i += l; } done: if (a != a1) bf_delete(a); } static void *bf_dbuf_realloc(void *opaque, void *ptr, size_t size) { bf_context_t *s = opaque; return bf_realloc(s, ptr, size); } /* return the length in bytes. A trailing '\0' is added */ static char *bf_ftoa_internal(size_t *plen, const bf_t *a2, int radix, limb_t prec, bf_flags_t flags, bool is_dec) { bf_context_t *ctx = a2->ctx; DynBuf s_s, *s = &s_s; int radix_bits; // bf_print_str("ftoa", a2); // printf("radix=%d\n", radix); dbuf_init2(s, ctx, bf_dbuf_realloc); if (a2->expn == BF_EXP_NAN) { dbuf_putstr(s, "NaN"); } else { if (a2->sign) dbuf_putc(s, '-'); if (a2->expn == BF_EXP_INF) { if (flags & BF_FTOA_JS_QUIRKS) dbuf_putstr(s, "Infinity"); else dbuf_putstr(s, "Inf"); } else { int fmt, ret; slimb_t n_digits, n, i, n_max, n1; bf_t a1_s, *a1 = &a1_s; if ((radix & (radix - 1)) != 0) radix_bits = 0; else radix_bits = ceil_log2(radix); fmt = flags & BF_FTOA_FORMAT_MASK; bf_init(ctx, a1); if (fmt == BF_FTOA_FORMAT_FRAC) { if (is_dec || radix_bits != 0) { if (bf_set(a1, a2)) goto fail1; #ifdef USE_BF_DEC if (is_dec) { if (bfdec_round((bfdec_t *)a1, prec, (flags & BF_RND_MASK) | BF_FLAG_RADPNT_PREC) & BF_ST_MEM_ERROR) goto fail1; n = a1->expn; } else #endif { if (bf_round(a1, prec * radix_bits, (flags & BF_RND_MASK) | BF_FLAG_RADPNT_PREC) & BF_ST_MEM_ERROR) goto fail1; n = ceil_div(a1->expn, radix_bits); } if (flags & BF_FTOA_ADD_PREFIX) { if (radix == 16) dbuf_putstr(s, "0x"); else if (radix == 8) dbuf_putstr(s, "0o"); else if (radix == 2) dbuf_putstr(s, "0b"); } if (a1->expn == BF_EXP_ZERO) { dbuf_putstr(s, "0"); if (prec > 0) { dbuf_putstr(s, "."); for(i = 0; i < prec; i++) { dbuf_putc(s, '0'); } } } else { n_digits = prec + n; if (n <= 0) { /* 0.x */ dbuf_putstr(s, "0."); for(i = 0; i < -n; i++) { dbuf_putc(s, '0'); } if (n_digits > 0) { output_digits(s, a1, radix, n_digits, n_digits, is_dec); } } else { output_digits(s, a1, radix, n_digits, n, is_dec); } } } else { size_t pos, start; bf_t a_s, *a = &a_s; /* make a positive number */ a->tab = a2->tab; a->len = a2->len; a->expn = a2->expn; a->sign = 0; /* one more digit for the rounding */ n = 1 + bf_mul_log2_radix(bf_max(a->expn, 0), radix, true, true); n_digits = n + prec; n1 = n; if (bf_convert_to_radix(a1, &n1, a, radix, n_digits, flags & BF_RND_MASK, true)) goto fail1; start = s->size; output_digits(s, a1, radix, n_digits, n, is_dec); /* remove leading zeros because we allocated one more digit */ pos = start; while ((pos + 1) < s->size && s->buf[pos] == '0' && s->buf[pos + 1] != '.') pos++; if (pos > start) { memmove(s->buf + start, s->buf + pos, s->size - pos); s->size -= (pos - start); } } } else { #ifdef USE_BF_DEC if (is_dec) { if (bf_set(a1, a2)) goto fail1; if (fmt == BF_FTOA_FORMAT_FIXED) { n_digits = prec; n_max = n_digits; if (bfdec_round((bfdec_t *)a1, prec, (flags & BF_RND_MASK)) & BF_ST_MEM_ERROR) goto fail1; } else { /* prec is ignored */ prec = n_digits = a1->len * LIMB_DIGITS; /* remove the trailing zero digits */ while (n_digits > 1 && get_digit(a1->tab, a1->len, prec - n_digits) == 0) { n_digits--; } n_max = n_digits + 4; } n = a1->expn; } else #endif if (radix_bits != 0) { if (bf_set(a1, a2)) goto fail1; if (fmt == BF_FTOA_FORMAT_FIXED) { slimb_t prec_bits; n_digits = prec; n_max = n_digits; /* align to the radix point */ prec_bits = prec * radix_bits - smod(-a1->expn, radix_bits); if (bf_round(a1, prec_bits, (flags & BF_RND_MASK)) & BF_ST_MEM_ERROR) goto fail1; } else { limb_t digit_mask; slimb_t pos; /* position of the digit before the most significant digit in bits */ pos = a1->len * LIMB_BITS + smod(-a1->expn, radix_bits); n_digits = ceil_div(pos, radix_bits); /* remove the trailing zero digits */ digit_mask = ((limb_t)1 << radix_bits) - 1; while (n_digits > 1 && (get_bits(a1->tab, a1->len, pos - n_digits * radix_bits) & digit_mask) == 0) { n_digits--; } n_max = n_digits + 4; } n = ceil_div(a1->expn, radix_bits); } else { bf_t a_s, *a = &a_s; /* make a positive number */ a->tab = a2->tab; a->len = a2->len; a->expn = a2->expn; a->sign = 0; if (fmt == BF_FTOA_FORMAT_FIXED) { n_digits = prec; n_max = n_digits; } else { slimb_t n_digits_max, n_digits_min; assert(prec != BF_PREC_INF); n_digits = 1 + bf_mul_log2_radix(prec, radix, true, true); /* max number of digits for non exponential notation. The rational is to have the same rule as JS i.e. n_max = 21 for 64 bit float in base 10. */ n_max = n_digits + 4; if (fmt == BF_FTOA_FORMAT_FREE_MIN) { bf_t b_s, *b = &b_s; /* find the minimum number of digits by dichotomy. */ /* XXX: inefficient */ n_digits_max = n_digits; n_digits_min = 1; bf_init(ctx, b); while (n_digits_min < n_digits_max) { n_digits = (n_digits_min + n_digits_max) / 2; if (bf_convert_to_radix(a1, &n, a, radix, n_digits, flags & BF_RND_MASK, false)) { bf_delete(b); goto fail1; } /* convert back to a number and compare */ ret = bf_mul_pow_radix(b, a1, radix, n - n_digits, prec, (flags & ~BF_RND_MASK) | BF_RNDN); if (ret & BF_ST_MEM_ERROR) { bf_delete(b); goto fail1; } if (bf_cmpu(b, a) == 0) { n_digits_max = n_digits; } else { n_digits_min = n_digits + 1; } } bf_delete(b); n_digits = n_digits_max; } } if (bf_convert_to_radix(a1, &n, a, radix, n_digits, flags & BF_RND_MASK, false)) { fail1: bf_delete(a1); goto fail; } } if (a1->expn == BF_EXP_ZERO && fmt != BF_FTOA_FORMAT_FIXED && !(flags & BF_FTOA_FORCE_EXP)) { /* just output zero */ dbuf_putstr(s, "0"); } else { if (flags & BF_FTOA_ADD_PREFIX) { if (radix == 16) dbuf_putstr(s, "0x"); else if (radix == 8) dbuf_putstr(s, "0o"); else if (radix == 2) dbuf_putstr(s, "0b"); } if (a1->expn == BF_EXP_ZERO) n = 1; if ((flags & BF_FTOA_FORCE_EXP) || n <= -6 || n > n_max) { /* exponential notation */ output_digits(s, a1, radix, n_digits, 1, is_dec); if (radix_bits != 0 && radix <= 16) { slimb_t exp_n = (n - 1) * radix_bits; if (flags & BF_FTOA_JS_QUIRKS) dbuf_printf(s, "p%+" PRId_LIMB, exp_n); else dbuf_printf(s, "p%" PRId_LIMB, exp_n); } else { const char c = radix <= 10 ? 'e' : '@'; if (flags & BF_FTOA_JS_QUIRKS) dbuf_printf(s, "%c%+" PRId_LIMB, c, n - 1); else dbuf_printf(s, "%c%" PRId_LIMB, c, n - 1); } } else if (n <= 0) { /* 0.x */ dbuf_putstr(s, "0."); for(i = 0; i < -n; i++) { dbuf_putc(s, '0'); } output_digits(s, a1, radix, n_digits, n_digits, is_dec); } else { if (n_digits <= n) { /* no dot */ output_digits(s, a1, radix, n_digits, n_digits, is_dec); for(i = 0; i < (n - n_digits); i++) dbuf_putc(s, '0'); } else { output_digits(s, a1, radix, n_digits, n, is_dec); } } } } bf_delete(a1); } } dbuf_putc(s, '\0'); if (dbuf_error(s)) goto fail; if (plen) *plen = s->size - 1; return (char *)s->buf; fail: bf_free(ctx, s->buf); if (plen) *plen = 0; return NULL; } char *bf_ftoa(size_t *plen, const bf_t *a, int radix, limb_t prec, bf_flags_t flags) { return bf_ftoa_internal(plen, a, radix, prec, flags, false); } /***************************************************************/ /* transcendental functions */ /* Note: the algorithm is from MPFR */ static void bf_const_log2_rec(bf_t *T, bf_t *P, bf_t *Q, limb_t n1, limb_t n2, bool need_P) { bf_context_t *s = T->ctx; if ((n2 - n1) == 1) { if (n1 == 0) { bf_set_ui(P, 3); } else { bf_set_ui(P, n1); P->sign = 1; } bf_set_ui(Q, 2 * n1 + 1); Q->expn += 2; bf_set(T, P); } else { limb_t m; bf_t T1_s, *T1 = &T1_s; bf_t P1_s, *P1 = &P1_s; bf_t Q1_s, *Q1 = &Q1_s; m = n1 + ((n2 - n1) >> 1); bf_const_log2_rec(T, P, Q, n1, m, true); bf_init(s, T1); bf_init(s, P1); bf_init(s, Q1); bf_const_log2_rec(T1, P1, Q1, m, n2, need_P); bf_mul(T, T, Q1, BF_PREC_INF, BF_RNDZ); bf_mul(T1, T1, P, BF_PREC_INF, BF_RNDZ); bf_add(T, T, T1, BF_PREC_INF, BF_RNDZ); if (need_P) bf_mul(P, P, P1, BF_PREC_INF, BF_RNDZ); bf_mul(Q, Q, Q1, BF_PREC_INF, BF_RNDZ); bf_delete(T1); bf_delete(P1); bf_delete(Q1); } } /* compute log(2) with faithful rounding at precision 'prec' */ static void bf_const_log2_internal(bf_t *T, limb_t prec) { limb_t w, N; bf_t P_s, *P = &P_s; bf_t Q_s, *Q = &Q_s; w = prec + 15; N = w / 3 + 1; bf_init(T->ctx, P); bf_init(T->ctx, Q); bf_const_log2_rec(T, P, Q, 0, N, false); bf_div(T, T, Q, prec, BF_RNDN); bf_delete(P); bf_delete(Q); } /* PI constant */ #define CHUD_A 13591409 #define CHUD_B 545140134 #define CHUD_C 640320 #define CHUD_BITS_PER_TERM 47 static void chud_bs(bf_t *P, bf_t *Q, bf_t *G, int64_t a, int64_t b, int need_g, limb_t prec) { bf_context_t *s = P->ctx; int64_t c; if (a == (b - 1)) { bf_t T0, T1; bf_init(s, &T0); bf_init(s, &T1); bf_set_ui(G, 2 * b - 1); bf_mul_ui(G, G, 6 * b - 1, prec, BF_RNDN); bf_mul_ui(G, G, 6 * b - 5, prec, BF_RNDN); bf_set_ui(&T0, CHUD_B); bf_mul_ui(&T0, &T0, b, prec, BF_RNDN); bf_set_ui(&T1, CHUD_A); bf_add(&T0, &T0, &T1, prec, BF_RNDN); bf_mul(P, G, &T0, prec, BF_RNDN); P->sign = b & 1; bf_set_ui(Q, b); bf_mul_ui(Q, Q, b, prec, BF_RNDN); bf_mul_ui(Q, Q, b, prec, BF_RNDN); bf_mul_ui(Q, Q, (uint64_t)CHUD_C * CHUD_C * CHUD_C / 24, prec, BF_RNDN); bf_delete(&T0); bf_delete(&T1); } else { bf_t P2, Q2, G2; bf_init(s, &P2); bf_init(s, &Q2); bf_init(s, &G2); c = (a + b) / 2; chud_bs(P, Q, G, a, c, 1, prec); chud_bs(&P2, &Q2, &G2, c, b, need_g, prec); /* Q = Q1 * Q2 */ /* G = G1 * G2 */ /* P = P1 * Q2 + P2 * G1 */ bf_mul(&P2, &P2, G, prec, BF_RNDN); if (!need_g) bf_set_ui(G, 0); bf_mul(P, P, &Q2, prec, BF_RNDN); bf_add(P, P, &P2, prec, BF_RNDN); bf_delete(&P2); bf_mul(Q, Q, &Q2, prec, BF_RNDN); bf_delete(&Q2); if (need_g) bf_mul(G, G, &G2, prec, BF_RNDN); bf_delete(&G2); } } /* compute Pi with faithful rounding at precision 'prec' using the Chudnovsky formula */ static void bf_const_pi_internal(bf_t *Q, limb_t prec) { bf_context_t *s = Q->ctx; int64_t n, prec1; bf_t P, G; /* number of serie terms */ n = prec / CHUD_BITS_PER_TERM + 1; /* XXX: precision analysis */ prec1 = prec + 32; bf_init(s, &P); bf_init(s, &G); chud_bs(&P, Q, &G, 0, n, 0, BF_PREC_INF); bf_mul_ui(&G, Q, CHUD_A, prec1, BF_RNDN); bf_add(&P, &G, &P, prec1, BF_RNDN); bf_div(Q, Q, &P, prec1, BF_RNDF); bf_set_ui(&P, CHUD_C); bf_sqrt(&G, &P, prec1, BF_RNDF); bf_mul_ui(&G, &G, (uint64_t)CHUD_C / 12, prec1, BF_RNDF); bf_mul(Q, Q, &G, prec, BF_RNDN); bf_delete(&P); bf_delete(&G); } static int bf_const_get(bf_t *T, limb_t prec, bf_flags_t flags, BFConstCache *c, void (*func)(bf_t *res, limb_t prec), int sign) { limb_t ziv_extra_bits, prec1; ziv_extra_bits = 32; for(;;) { prec1 = prec + ziv_extra_bits; if (c->prec < prec1) { if (c->val.len == 0) bf_init(T->ctx, &c->val); func(&c->val, prec1); c->prec = prec1; } else { prec1 = c->prec; } bf_set(T, &c->val); T->sign = sign; if (!bf_can_round(T, prec, flags & BF_RND_MASK, prec1)) { /* and more precision and retry */ ziv_extra_bits = ziv_extra_bits + (ziv_extra_bits / 2); } else { break; } } return bf_round(T, prec, flags); } static void bf_const_free(BFConstCache *c) { bf_delete(&c->val); memset(c, 0, sizeof(*c)); } int bf_const_log2(bf_t *T, limb_t prec, bf_flags_t flags) { bf_context_t *s = T->ctx; return bf_const_get(T, prec, flags, &s->log2_cache, bf_const_log2_internal, 0); } /* return rounded pi * (1 - 2 * sign) */ static int bf_const_pi_signed(bf_t *T, int sign, limb_t prec, bf_flags_t flags) { bf_context_t *s = T->ctx; return bf_const_get(T, prec, flags, &s->pi_cache, bf_const_pi_internal, sign); } int bf_const_pi(bf_t *T, limb_t prec, bf_flags_t flags) { return bf_const_pi_signed(T, 0, prec, flags); } void bf_clear_cache(bf_context_t *s) { #ifdef USE_FFT_MUL fft_clear_cache(s); #endif bf_const_free(&s->log2_cache); bf_const_free(&s->pi_cache); } /* ZivFunc should compute the result 'r' with faithful rounding at precision 'prec'. For efficiency purposes, the final bf_round() does not need to be done in the function. */ typedef int ZivFunc(bf_t *r, const bf_t *a, limb_t prec, void *opaque); static int bf_ziv_rounding(bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags, ZivFunc *f, void *opaque) { int rnd_mode, ret; slimb_t prec1, ziv_extra_bits; rnd_mode = flags & BF_RND_MASK; if (rnd_mode == BF_RNDF) { /* no need to iterate */ f(r, a, prec, opaque); ret = 0; } else { ziv_extra_bits = 32; for(;;) { prec1 = prec + ziv_extra_bits; ret = f(r, a, prec1, opaque); if (ret & (BF_ST_OVERFLOW | BF_ST_UNDERFLOW | BF_ST_MEM_ERROR)) { /* overflow or underflow should never happen because it indicates the rounding cannot be done correctly, but we do not catch all the cases */ return ret; } /* if the result is exact, we can stop */ if (!(ret & BF_ST_INEXACT)) { ret = 0; break; } if (bf_can_round(r, prec, rnd_mode, prec1)) { ret = BF_ST_INEXACT; break; } ziv_extra_bits = ziv_extra_bits * 2; // printf("ziv_extra_bits=%" PRId64 "\n", (int64_t)ziv_extra_bits); } } if (r->len == 0) return ret; else return __bf_round(r, prec, flags, r->len, ret); } /* add (1 - 2*e_sign) * 2^e */ static int bf_add_epsilon(bf_t *r, const bf_t *a, slimb_t e, int e_sign, limb_t prec, int flags) { bf_t T_s, *T = &T_s; int ret; /* small argument case: result = 1 + epsilon * sign(x) */ bf_init(a->ctx, T); bf_set_ui(T, 1); T->sign = e_sign; T->expn += e; ret = bf_add(r, r, T, prec, flags); bf_delete(T); return ret; } /* Compute the exponential using faithful rounding at precision 'prec'. Note: the algorithm is from MPFR */ static int bf_exp_internal(bf_t *r, const bf_t *a, limb_t prec, void *opaque) { bf_context_t *s = r->ctx; bf_t T_s, *T = &T_s; slimb_t n, K, l, i, prec1; assert(r != a); /* argument reduction: T = a - n*log(2) with 0 <= T < log(2) and n integer. */ bf_init(s, T); if (a->expn <= -1) { /* 0 <= abs(a) <= 0.5 */ if (a->sign) n = -1; else n = 0; } else { bf_const_log2(T, LIMB_BITS, BF_RNDZ); bf_div(T, a, T, LIMB_BITS, BF_RNDD); bf_get_limb(&n, T, 0); } K = bf_isqrt((prec + 1) / 2); l = (prec - 1) / K + 1; /* XXX: precision analysis ? */ prec1 = prec + (K + 2 * l + 18) + K + 8; if (a->expn > 0) prec1 += a->expn; // printf("n=%ld K=%ld prec1=%ld\n", n, K, prec1); bf_const_log2(T, prec1, BF_RNDF); bf_mul_si(T, T, n, prec1, BF_RNDN); bf_sub(T, a, T, prec1, BF_RNDN); /* reduce the range of T */ bf_mul_2exp(T, -K, BF_PREC_INF, BF_RNDZ); /* Taylor expansion around zero : 1 + x + x^2/2 + ... + x^n/n! = (1 + x * (1 + x/2 * (1 + ... (x/n)))) */ { bf_t U_s, *U = &U_s; bf_init(s, U); bf_set_ui(r, 1); for(i = l ; i >= 1; i--) { bf_set_ui(U, i); bf_div(U, T, U, prec1, BF_RNDN); bf_mul(r, r, U, prec1, BF_RNDN); bf_add_si(r, r, 1, prec1, BF_RNDN); } bf_delete(U); } bf_delete(T); /* undo the range reduction */ for(i = 0; i < K; i++) { bf_mul(r, r, r, prec1, BF_RNDN | BF_FLAG_EXT_EXP); } /* undo the argument reduction */ bf_mul_2exp(r, n, BF_PREC_INF, BF_RNDZ | BF_FLAG_EXT_EXP); return BF_ST_INEXACT; } /* crude overflow and underflow tests for exp(a). a_low <= a <= a_high */ static int check_exp_underflow_overflow(bf_context_t *s, bf_t *r, const bf_t *a_low, const bf_t *a_high, limb_t prec, bf_flags_t flags) { bf_t T_s, *T = &T_s; bf_t log2_s, *log2 = &log2_s; slimb_t e_min, e_max; if (a_high->expn <= 0) return 0; e_max = (limb_t)1 << (bf_get_exp_bits(flags) - 1); e_min = -e_max + 3; if (flags & BF_FLAG_SUBNORMAL) e_min -= (prec - 1); bf_init(s, T); bf_init(s, log2); bf_const_log2(log2, LIMB_BITS, BF_RNDU); bf_mul_ui(T, log2, e_max, LIMB_BITS, BF_RNDU); /* a_low > e_max * log(2) implies exp(a) > e_max */ if (bf_cmp_lt(T, a_low) > 0) { /* overflow */ bf_delete(T); bf_delete(log2); return bf_set_overflow(r, 0, prec, flags); } /* a_high < (e_min - 2) * log(2) implies exp(a) < (e_min - 2) */ bf_const_log2(log2, LIMB_BITS, BF_RNDD); bf_mul_si(T, log2, e_min - 2, LIMB_BITS, BF_RNDD); if (bf_cmp_lt(a_high, T)) { int rnd_mode = flags & BF_RND_MASK; /* underflow */ bf_delete(T); bf_delete(log2); if (rnd_mode == BF_RNDU) { /* set the smallest value */ bf_set_ui(r, 1); r->expn = e_min; } else { bf_set_zero(r, 0); } return BF_ST_UNDERFLOW | BF_ST_INEXACT; } bf_delete(log2); bf_delete(T); return 0; } int bf_exp(bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags) { bf_context_t *s = r->ctx; int ret; assert(r != a); if (a->len == 0) { if (a->expn == BF_EXP_NAN) { bf_set_nan(r); } else if (a->expn == BF_EXP_INF) { if (a->sign) bf_set_zero(r, 0); else bf_set_inf(r, 0); } else { bf_set_ui(r, 1); } return 0; } ret = check_exp_underflow_overflow(s, r, a, a, prec, flags); if (ret) return ret; if (a->expn < 0 && (-a->expn) >= (prec + 2)) { /* small argument case: result = 1 + epsilon * sign(x) */ bf_set_ui(r, 1); return bf_add_epsilon(r, r, -(prec + 2), a->sign, prec, flags); } return bf_ziv_rounding(r, a, prec, flags, bf_exp_internal, NULL); } static int bf_log_internal(bf_t *r, const bf_t *a, limb_t prec, void *opaque) { bf_context_t *s = r->ctx; bf_t T_s, *T = &T_s; bf_t U_s, *U = &U_s; bf_t V_s, *V = &V_s; slimb_t n, prec1, l, i, K; assert(r != a); bf_init(s, T); /* argument reduction 1 */ /* T=a*2^n with 2/3 <= T <= 4/3 */ { bf_t U_s, *U = &U_s; bf_set(T, a); n = T->expn; T->expn = 0; /* U= ~ 2/3 */ bf_init(s, U); bf_set_ui(U, 0xaaaaaaaa); U->expn = 0; if (bf_cmp_lt(T, U)) { T->expn++; n--; } bf_delete(U); } // printf("n=%ld\n", n); // bf_print_str("T", T); /* XXX: precision analysis */ /* number of iterations for argument reduction 2 */ K = bf_isqrt((prec + 1) / 2); /* order of Taylor expansion */ l = prec / (2 * K) + 1; /* precision of the intermediate computations */ prec1 = prec + K + 2 * l + 32; bf_init(s, U); bf_init(s, V); /* Note: cancellation occurs here, so we use more precision (XXX: reduce the precision by computing the exact cancellation) */ bf_add_si(T, T, -1, BF_PREC_INF, BF_RNDN); /* argument reduction 2 */ for(i = 0; i < K; i++) { /* T = T / (1 + sqrt(1 + T)) */ bf_add_si(U, T, 1, prec1, BF_RNDN); bf_sqrt(V, U, prec1, BF_RNDF); bf_add_si(U, V, 1, prec1, BF_RNDN); bf_div(T, T, U, prec1, BF_RNDN); } { bf_t Y_s, *Y = &Y_s; bf_t Y2_s, *Y2 = &Y2_s; bf_init(s, Y); bf_init(s, Y2); /* compute ln(1+x) = ln((1+y)/(1-y)) with y=x/(2+x) = y + y^3/3 + ... + y^(2*l + 1) / (2*l+1) with Y=Y^2 = y*(1+Y/3+Y^2/5+...) = y*(1+Y*(1/3+Y*(1/5 + ...))) */ bf_add_si(Y, T, 2, prec1, BF_RNDN); bf_div(Y, T, Y, prec1, BF_RNDN); bf_mul(Y2, Y, Y, prec1, BF_RNDN); bf_set_ui(r, 0); for(i = l; i >= 1; i--) { bf_set_ui(U, 1); bf_set_ui(V, 2 * i + 1); bf_div(U, U, V, prec1, BF_RNDN); bf_add(r, r, U, prec1, BF_RNDN); bf_mul(r, r, Y2, prec1, BF_RNDN); } bf_add_si(r, r, 1, prec1, BF_RNDN); bf_mul(r, r, Y, prec1, BF_RNDN); bf_delete(Y); bf_delete(Y2); } bf_delete(V); bf_delete(U); /* multiplication by 2 for the Taylor expansion and undo the argument reduction 2*/ bf_mul_2exp(r, K + 1, BF_PREC_INF, BF_RNDZ); /* undo the argument reduction 1 */ bf_const_log2(T, prec1, BF_RNDF); bf_mul_si(T, T, n, prec1, BF_RNDN); bf_add(r, r, T, prec1, BF_RNDN); bf_delete(T); return BF_ST_INEXACT; } int bf_log(bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags) { bf_context_t *s = r->ctx; bf_t T_s, *T = &T_s; assert(r != a); if (a->len == 0) { if (a->expn == BF_EXP_NAN) { bf_set_nan(r); return 0; } else if (a->expn == BF_EXP_INF) { if (a->sign) { bf_set_nan(r); return BF_ST_INVALID_OP; } else { bf_set_inf(r, 0); return 0; } } else { bf_set_inf(r, 1); return 0; } } if (a->sign) { bf_set_nan(r); return BF_ST_INVALID_OP; } bf_init(s, T); bf_set_ui(T, 1); if (bf_cmp_eq(a, T)) { bf_set_zero(r, 0); bf_delete(T); return 0; } bf_delete(T); return bf_ziv_rounding(r, a, prec, flags, bf_log_internal, NULL); } /* x and y finite and x > 0 */ static int bf_pow_generic(bf_t *r, const bf_t *x, limb_t prec, void *opaque) { bf_context_t *s = r->ctx; const bf_t *y = opaque; bf_t T_s, *T = &T_s; limb_t prec1; bf_init(s, T); /* XXX: proof for the added precision */ prec1 = prec + 32; bf_log(T, x, prec1, BF_RNDF | BF_FLAG_EXT_EXP); bf_mul(T, T, y, prec1, BF_RNDF | BF_FLAG_EXT_EXP); if (bf_is_nan(T)) bf_set_nan(r); else bf_exp_internal(r, T, prec1, NULL); /* no overflow/underlow test needed */ bf_delete(T); return BF_ST_INEXACT; } /* x and y finite, x > 0, y integer and y fits on one limb */ static int bf_pow_int(bf_t *r, const bf_t *x, limb_t prec, void *opaque) { bf_context_t *s = r->ctx; const bf_t *y = opaque; bf_t T_s, *T = &T_s; limb_t prec1; int ret; slimb_t y1; bf_get_limb(&y1, y, 0); if (y1 < 0) y1 = -y1; /* XXX: proof for the added precision */ prec1 = prec + ceil_log2(y1) * 2 + 8; ret = bf_pow_ui(r, x, y1 < 0 ? -y1 : y1, prec1, BF_RNDN | BF_FLAG_EXT_EXP); if (y->sign) { bf_init(s, T); bf_set_ui(T, 1); ret |= bf_div(r, T, r, prec1, BF_RNDN | BF_FLAG_EXT_EXP); bf_delete(T); } return ret; } /* x must be a finite non zero float. Return true if there is a floating point number r such as x=r^(2^n) and return this floating point number 'r'. Otherwise return false and r is undefined. */ static bool check_exact_power2n(bf_t *r, const bf_t *x, slimb_t n) { bf_context_t *s = r->ctx; bf_t T_s, *T = &T_s; slimb_t e, i, er; limb_t v; /* x = m*2^e with m odd integer */ e = bf_get_exp_min(x); /* fast check on the exponent */ if (n > (LIMB_BITS - 1)) { if (e != 0) return false; er = 0; } else { if ((e & (((limb_t)1 << n) - 1)) != 0) return false; er = e >> n; } /* every perfect odd square = 1 modulo 8 */ v = get_bits(x->tab, x->len, x->len * LIMB_BITS - x->expn + e); if ((v & 7) != 1) return false; bf_init(s, T); bf_set(T, x); T->expn -= e; for(i = 0; i < n; i++) { if (i != 0) bf_set(T, r); if (bf_sqrtrem(r, NULL, T) != 0) return false; } r->expn += er; return true; } /* prec = BF_PREC_INF is accepted for x and y integers and y >= 0 */ int bf_pow(bf_t *r, const bf_t *x, const bf_t *y, limb_t prec, bf_flags_t flags) { bf_context_t *s = r->ctx; bf_t T_s, *T = &T_s; bf_t ytmp_s; bool y_is_int, y_is_odd; int r_sign, ret, rnd_mode; slimb_t y_emin; if (x->len == 0 || y->len == 0) { if (y->expn == BF_EXP_ZERO) { /* pow(x, 0) = 1 */ bf_set_ui(r, 1); } else if (x->expn == BF_EXP_NAN) { bf_set_nan(r); } else { int cmp_x_abs_1; bf_set_ui(r, 1); cmp_x_abs_1 = bf_cmpu(x, r); if (cmp_x_abs_1 == 0 && (flags & BF_POW_JS_QUIRKS) && (y->expn >= BF_EXP_INF)) { bf_set_nan(r); } else if (cmp_x_abs_1 == 0 && (!x->sign || y->expn != BF_EXP_NAN)) { /* pow(1, y) = 1 even if y = NaN */ /* pow(-1, +/-inf) = 1 */ } else if (y->expn == BF_EXP_NAN) { bf_set_nan(r); } else if (y->expn == BF_EXP_INF) { if (y->sign == (cmp_x_abs_1 > 0)) { bf_set_zero(r, 0); } else { bf_set_inf(r, 0); } } else { y_emin = bf_get_exp_min(y); y_is_odd = (y_emin == 0); if (y->sign == (x->expn == BF_EXP_ZERO)) { bf_set_inf(r, y_is_odd & x->sign); if (y->sign) { /* pow(0, y) with y < 0 */ return BF_ST_DIVIDE_ZERO; } } else { bf_set_zero(r, y_is_odd & x->sign); } } } return 0; } bf_init(s, T); bf_set(T, x); y_emin = bf_get_exp_min(y); y_is_int = (y_emin >= 0); rnd_mode = flags & BF_RND_MASK; if (x->sign) { if (!y_is_int) { bf_set_nan(r); bf_delete(T); return BF_ST_INVALID_OP; } y_is_odd = (y_emin == 0); r_sign = y_is_odd; /* change the directed rounding mode if the sign of the result is changed */ if (r_sign && (rnd_mode == BF_RNDD || rnd_mode == BF_RNDU)) flags ^= 1; bf_neg(T); } else { r_sign = 0; } bf_set_ui(r, 1); if (bf_cmp_eq(T, r)) { /* abs(x) = 1: nothing more to do */ ret = 0; } else { /* check the overflow/underflow cases */ { bf_t al_s, *al = &al_s; bf_t ah_s, *ah = &ah_s; limb_t precl = LIMB_BITS; bf_init(s, al); bf_init(s, ah); /* compute bounds of log(abs(x)) * y with a low precision */ /* XXX: compute bf_log() once */ /* XXX: add a fast test before this slow test */ bf_log(al, T, precl, BF_RNDD); bf_log(ah, T, precl, BF_RNDU); bf_mul(al, al, y, precl, BF_RNDD ^ y->sign); bf_mul(ah, ah, y, precl, BF_RNDU ^ y->sign); ret = check_exp_underflow_overflow(s, r, al, ah, prec, flags); bf_delete(al); bf_delete(ah); if (ret) goto done; } if (y_is_int) { slimb_t T_bits, e; int_pow: T_bits = T->expn - bf_get_exp_min(T); if (T_bits == 1) { /* pow(2^b, y) = 2^(b*y) */ bf_mul_si(T, y, T->expn - 1, LIMB_BITS, BF_RNDZ); bf_get_limb(&e, T, 0); bf_set_ui(r, 1); ret = bf_mul_2exp(r, e, prec, flags); } else if (prec == BF_PREC_INF) { slimb_t y1; /* specific case for infinite precision (integer case) */ bf_get_limb(&y1, y, 0); assert(!y->sign); /* x must be an integer, so abs(x) >= 2 */ if (y1 >= ((slimb_t)1 << BF_EXP_BITS_MAX)) { bf_delete(T); return bf_set_overflow(r, 0, BF_PREC_INF, flags); } ret = bf_pow_ui(r, T, y1, BF_PREC_INF, BF_RNDZ); } else { if (y->expn <= 31) { /* small enough power: use exponentiation in all cases */ } else if (y->sign) { /* cannot be exact */ goto general_case; } else { if (rnd_mode == BF_RNDF) goto general_case; /* no need to track exact results */ /* see if the result has a chance to be exact: if x=a*2^b (a odd), x^y=a^y*2^(b*y) x^y needs a precision of at least floor_log2(a)*y bits */ bf_mul_si(r, y, T_bits - 1, LIMB_BITS, BF_RNDZ); bf_get_limb(&e, r, 0); if (prec < e) goto general_case; } ret = bf_ziv_rounding(r, T, prec, flags, bf_pow_int, (void *)y); } } else { if (rnd_mode != BF_RNDF) { bf_t *y1; if (y_emin < 0 && check_exact_power2n(r, T, -y_emin)) { /* the problem is reduced to a power to an integer */ bf_set(T, r); y1 = &ytmp_s; y1->tab = y->tab; y1->len = y->len; y1->sign = y->sign; y1->expn = y->expn - y_emin; y = y1; goto int_pow; } } general_case: ret = bf_ziv_rounding(r, T, prec, flags, bf_pow_generic, (void *)y); } } done: bf_delete(T); r->sign = r_sign; return ret; } /* compute sqrt(-2*x-x^2) to get |sin(x)| from cos(x) - 1. */ static void bf_sqrt_sin(bf_t *r, const bf_t *x, limb_t prec1) { bf_context_t *s = r->ctx; bf_t T_s, *T = &T_s; bf_init(s, T); bf_set(T, x); bf_mul(r, T, T, prec1, BF_RNDN); bf_mul_2exp(T, 1, BF_PREC_INF, BF_RNDZ); bf_add(T, T, r, prec1, BF_RNDN); bf_neg(T); bf_sqrt(r, T, prec1, BF_RNDF); bf_delete(T); } static int bf_sincos(bf_t *s, bf_t *c, const bf_t *a, limb_t prec) { bf_context_t *s1 = a->ctx; bf_t T_s, *T = &T_s; bf_t U_s, *U = &U_s; bf_t r_s, *r = &r_s; slimb_t K, prec1, i, l, mod, prec2; int is_neg; assert(c != a && s != a); bf_init(s1, T); bf_init(s1, U); bf_init(s1, r); /* XXX: precision analysis */ K = bf_isqrt(prec / 2); l = prec / (2 * K) + 1; prec1 = prec + 2 * K + l + 8; /* after the modulo reduction, -pi/4 <= T <= pi/4 */ if (a->expn <= -1) { /* abs(a) <= 0.25: no modulo reduction needed */ bf_set(T, a); mod = 0; } else { slimb_t cancel; cancel = 0; for(;;) { prec2 = prec1 + a->expn + cancel; bf_const_pi(U, prec2, BF_RNDF); bf_mul_2exp(U, -1, BF_PREC_INF, BF_RNDZ); bf_remquo(&mod, T, a, U, prec2, BF_RNDN, BF_RNDN); // printf("T.expn=%ld prec2=%ld\n", T->expn, prec2); if (mod == 0 || (T->expn != BF_EXP_ZERO && (T->expn + prec2) >= (prec1 - 1))) break; /* increase the number of bits until the precision is good enough */ cancel = bf_max(-T->expn, (cancel + 1) * 3 / 2); } mod &= 3; } is_neg = T->sign; /* compute cosm1(x) = cos(x) - 1 */ bf_mul(T, T, T, prec1, BF_RNDN); bf_mul_2exp(T, -2 * K, BF_PREC_INF, BF_RNDZ); /* Taylor expansion: -x^2/2 + x^4/4! - x^6/6! + ... */ bf_set_ui(r, 1); for(i = l ; i >= 1; i--) { bf_set_ui(U, 2 * i - 1); bf_mul_ui(U, U, 2 * i, BF_PREC_INF, BF_RNDZ); bf_div(U, T, U, prec1, BF_RNDN); bf_mul(r, r, U, prec1, BF_RNDN); bf_neg(r); if (i != 1) bf_add_si(r, r, 1, prec1, BF_RNDN); } bf_delete(U); /* undo argument reduction: cosm1(2*x)= 2*(2*cosm1(x)+cosm1(x)^2) */ for(i = 0; i < K; i++) { bf_mul(T, r, r, prec1, BF_RNDN); bf_mul_2exp(r, 1, BF_PREC_INF, BF_RNDZ); bf_add(r, r, T, prec1, BF_RNDN); bf_mul_2exp(r, 1, BF_PREC_INF, BF_RNDZ); } bf_delete(T); if (c) { if ((mod & 1) == 0) { bf_add_si(c, r, 1, prec1, BF_RNDN); } else { bf_sqrt_sin(c, r, prec1); c->sign = is_neg ^ 1; } c->sign ^= mod >> 1; } if (s) { if ((mod & 1) == 0) { bf_sqrt_sin(s, r, prec1); s->sign = is_neg; } else { bf_add_si(s, r, 1, prec1, BF_RNDN); } s->sign ^= mod >> 1; } bf_delete(r); return BF_ST_INEXACT; } static int bf_cos_internal(bf_t *r, const bf_t *a, limb_t prec, void *opaque) { return bf_sincos(NULL, r, a, prec); } int bf_cos(bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags) { if (a->len == 0) { if (a->expn == BF_EXP_NAN) { bf_set_nan(r); return 0; } else if (a->expn == BF_EXP_INF) { bf_set_nan(r); return BF_ST_INVALID_OP; } else { bf_set_ui(r, 1); return 0; } } /* small argument case: result = 1+r(x) with r(x) = -x^2/2 + O(X^4). We assume r(x) < 2^(2*EXP(x) - 1). */ if (a->expn < 0) { slimb_t e; e = 2 * a->expn - 1; if (e < -(prec + 2)) { bf_set_ui(r, 1); return bf_add_epsilon(r, r, e, 1, prec, flags); } } return bf_ziv_rounding(r, a, prec, flags, bf_cos_internal, NULL); } static int bf_sin_internal(bf_t *r, const bf_t *a, limb_t prec, void *opaque) { return bf_sincos(r, NULL, a, prec); } int bf_sin(bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags) { if (a->len == 0) { if (a->expn == BF_EXP_NAN) { bf_set_nan(r); return 0; } else if (a->expn == BF_EXP_INF) { bf_set_nan(r); return BF_ST_INVALID_OP; } else { bf_set_zero(r, a->sign); return 0; } } /* small argument case: result = x+r(x) with r(x) = -x^3/6 + O(X^5). We assume r(x) < 2^(3*EXP(x) - 2). */ if (a->expn < 0) { slimb_t e; e = sat_add(2 * a->expn, a->expn - 2); if (e < a->expn - bf_max(prec + 2, a->len * LIMB_BITS + 2)) { bf_set(r, a); return bf_add_epsilon(r, r, e, 1 - a->sign, prec, flags); } } return bf_ziv_rounding(r, a, prec, flags, bf_sin_internal, NULL); } static int bf_tan_internal(bf_t *r, const bf_t *a, limb_t prec, void *opaque) { bf_context_t *s = r->ctx; bf_t T_s, *T = &T_s; limb_t prec1; /* XXX: precision analysis */ prec1 = prec + 8; bf_init(s, T); bf_sincos(r, T, a, prec1); bf_div(r, r, T, prec1, BF_RNDF); bf_delete(T); return BF_ST_INEXACT; } int bf_tan(bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags) { assert(r != a); if (a->len == 0) { if (a->expn == BF_EXP_NAN) { bf_set_nan(r); return 0; } else if (a->expn == BF_EXP_INF) { bf_set_nan(r); return BF_ST_INVALID_OP; } else { bf_set_zero(r, a->sign); return 0; } } /* small argument case: result = x+r(x) with r(x) = x^3/3 + O(X^5). We assume r(x) < 2^(3*EXP(x) - 1). */ if (a->expn < 0) { slimb_t e; e = sat_add(2 * a->expn, a->expn - 1); if (e < a->expn - bf_max(prec + 2, a->len * LIMB_BITS + 2)) { bf_set(r, a); return bf_add_epsilon(r, r, e, a->sign, prec, flags); } } return bf_ziv_rounding(r, a, prec, flags, bf_tan_internal, NULL); } /* if add_pi2 is true, add pi/2 to the result (used for acos(x) to avoid cancellation) */ static int bf_atan_internal(bf_t *r, const bf_t *a, limb_t prec, void *opaque) { bf_context_t *s = r->ctx; bool add_pi2 = (bool)(intptr_t)opaque; bf_t T_s, *T = &T_s; bf_t U_s, *U = &U_s; bf_t V_s, *V = &V_s; bf_t X2_s, *X2 = &X2_s; int cmp_1; slimb_t prec1, i, K, l; /* XXX: precision analysis */ K = bf_isqrt((prec + 1) / 2); l = prec / (2 * K) + 1; prec1 = prec + K + 2 * l + 32; // printf("prec=%d K=%d l=%d prec1=%d\n", (int)prec, (int)K, (int)l, (int)prec1); bf_init(s, T); cmp_1 = (a->expn >= 1); /* a >= 1 */ if (cmp_1) { bf_set_ui(T, 1); bf_div(T, T, a, prec1, BF_RNDN); } else { bf_set(T, a); } /* abs(T) <= 1 */ /* argument reduction */ bf_init(s, U); bf_init(s, V); bf_init(s, X2); for(i = 0; i < K; i++) { /* T = T / (1 + sqrt(1 + T^2)) */ bf_mul(U, T, T, prec1, BF_RNDN); bf_add_si(U, U, 1, prec1, BF_RNDN); bf_sqrt(V, U, prec1, BF_RNDN); bf_add_si(V, V, 1, prec1, BF_RNDN); bf_div(T, T, V, prec1, BF_RNDN); } /* Taylor series: x - x^3/3 + ... + (-1)^ l * y^(2*l + 1) / (2*l+1) */ bf_mul(X2, T, T, prec1, BF_RNDN); bf_set_ui(r, 0); for(i = l; i >= 1; i--) { bf_set_si(U, 1); bf_set_ui(V, 2 * i + 1); bf_div(U, U, V, prec1, BF_RNDN); bf_neg(r); bf_add(r, r, U, prec1, BF_RNDN); bf_mul(r, r, X2, prec1, BF_RNDN); } bf_neg(r); bf_add_si(r, r, 1, prec1, BF_RNDN); bf_mul(r, r, T, prec1, BF_RNDN); /* undo the argument reduction */ bf_mul_2exp(r, K, BF_PREC_INF, BF_RNDZ); bf_delete(U); bf_delete(V); bf_delete(X2); i = add_pi2; if (cmp_1 > 0) { /* undo the inversion : r = sign(a)*PI/2 - r */ bf_neg(r); i += 1 - 2 * a->sign; } /* add i*(pi/2) with -1 <= i <= 2 */ if (i != 0) { bf_const_pi(T, prec1, BF_RNDF); if (i != 2) bf_mul_2exp(T, -1, BF_PREC_INF, BF_RNDZ); T->sign = (i < 0); bf_add(r, T, r, prec1, BF_RNDN); } bf_delete(T); return BF_ST_INEXACT; } int bf_atan(bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags) { bf_context_t *s = r->ctx; bf_t T_s, *T = &T_s; int res; if (a->len == 0) { if (a->expn == BF_EXP_NAN) { bf_set_nan(r); return 0; } else if (a->expn == BF_EXP_INF) { /* -PI/2 or PI/2 */ bf_const_pi_signed(r, a->sign, prec, flags); bf_mul_2exp(r, -1, BF_PREC_INF, BF_RNDZ); return BF_ST_INEXACT; } else { bf_set_zero(r, a->sign); return 0; } } bf_init(s, T); bf_set_ui(T, 1); res = bf_cmpu(a, T); bf_delete(T); if (res == 0) { /* short cut: abs(a) == 1 -> +/-pi/4 */ bf_const_pi_signed(r, a->sign, prec, flags); bf_mul_2exp(r, -2, BF_PREC_INF, BF_RNDZ); return BF_ST_INEXACT; } /* small argument case: result = x+r(x) with r(x) = -x^3/3 + O(X^5). We assume r(x) < 2^(3*EXP(x) - 1). */ if (a->expn < 0) { slimb_t e; e = sat_add(2 * a->expn, a->expn - 1); if (e < a->expn - bf_max(prec + 2, a->len * LIMB_BITS + 2)) { bf_set(r, a); return bf_add_epsilon(r, r, e, 1 - a->sign, prec, flags); } } return bf_ziv_rounding(r, a, prec, flags, bf_atan_internal, (void *)false); } static int bf_atan2_internal(bf_t *r, const bf_t *y, limb_t prec, void *opaque) { bf_context_t *s = r->ctx; const bf_t *x = opaque; bf_t T_s, *T = &T_s; limb_t prec1; int ret; if (y->expn == BF_EXP_NAN || x->expn == BF_EXP_NAN) { bf_set_nan(r); return 0; } /* compute atan(y/x) assumming inf/inf = 1 and 0/0 = 0 */ bf_init(s, T); prec1 = prec + 32; if (y->expn == BF_EXP_INF && x->expn == BF_EXP_INF) { bf_set_ui(T, 1); T->sign = y->sign ^ x->sign; } else if (y->expn == BF_EXP_ZERO && x->expn == BF_EXP_ZERO) { bf_set_zero(T, y->sign ^ x->sign); } else { bf_div(T, y, x, prec1, BF_RNDF); } ret = bf_atan(r, T, prec1, BF_RNDF); if (x->sign) { /* if x < 0 (it includes -0), return sign(y)*pi + atan(y/x) */ bf_const_pi(T, prec1, BF_RNDF); T->sign = y->sign; bf_add(r, r, T, prec1, BF_RNDN); ret |= BF_ST_INEXACT; } bf_delete(T); return ret; } int bf_atan2(bf_t *r, const bf_t *y, const bf_t *x, limb_t prec, bf_flags_t flags) { return bf_ziv_rounding(r, y, prec, flags, bf_atan2_internal, (void *)x); } static int bf_asin_internal(bf_t *r, const bf_t *a, limb_t prec, void *opaque) { bf_context_t *s = r->ctx; bool is_acos = (bool)(intptr_t)opaque; bf_t T_s, *T = &T_s; limb_t prec1, prec2; /* asin(x) = atan(x/sqrt(1-x^2)) acos(x) = pi/2 - asin(x) */ prec1 = prec + 8; /* increase the precision in x^2 to compensate the cancellation in (1-x^2) if x is close to 1 */ /* XXX: use less precision when possible */ if (a->expn >= 0) prec2 = BF_PREC_INF; else prec2 = prec1; bf_init(s, T); bf_mul(T, a, a, prec2, BF_RNDN); bf_neg(T); bf_add_si(T, T, 1, prec2, BF_RNDN); bf_sqrt(r, T, prec1, BF_RNDN); bf_div(T, a, r, prec1, BF_RNDN); if (is_acos) bf_neg(T); bf_atan_internal(r, T, prec1, (void *)(intptr_t)is_acos); bf_delete(T); return BF_ST_INEXACT; } int bf_asin(bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags) { bf_context_t *s = r->ctx; bf_t T_s, *T = &T_s; int res; if (a->len == 0) { if (a->expn == BF_EXP_NAN) { bf_set_nan(r); return 0; } else if (a->expn == BF_EXP_INF) { bf_set_nan(r); return BF_ST_INVALID_OP; } else { bf_set_zero(r, a->sign); return 0; } } bf_init(s, T); bf_set_ui(T, 1); res = bf_cmpu(a, T); bf_delete(T); if (res > 0) { bf_set_nan(r); return BF_ST_INVALID_OP; } /* small argument case: result = x+r(x) with r(x) = x^3/6 + O(X^5). We assume r(x) < 2^(3*EXP(x) - 2). */ if (a->expn < 0) { slimb_t e; e = sat_add(2 * a->expn, a->expn - 2); if (e < a->expn - bf_max(prec + 2, a->len * LIMB_BITS + 2)) { bf_set(r, a); return bf_add_epsilon(r, r, e, a->sign, prec, flags); } } return bf_ziv_rounding(r, a, prec, flags, bf_asin_internal, (void *)false); } int bf_acos(bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags) { bf_context_t *s = r->ctx; bf_t T_s, *T = &T_s; int res; if (a->len == 0) { if (a->expn == BF_EXP_NAN) { bf_set_nan(r); return 0; } else if (a->expn == BF_EXP_INF) { bf_set_nan(r); return BF_ST_INVALID_OP; } else { bf_const_pi(r, prec, flags); bf_mul_2exp(r, -1, BF_PREC_INF, BF_RNDZ); return BF_ST_INEXACT; } } bf_init(s, T); bf_set_ui(T, 1); res = bf_cmpu(a, T); bf_delete(T); if (res > 0) { bf_set_nan(r); return BF_ST_INVALID_OP; } else if (res == 0 && a->sign == 0) { bf_set_zero(r, 0); return 0; } return bf_ziv_rounding(r, a, prec, flags, bf_asin_internal, (void *)true); } /***************************************************************/ /* decimal floating point numbers */ #ifdef USE_BF_DEC #define adddq(r1, r0, a1, a0) \ do { \ limb_t __t = r0; \ r0 += (a0); \ r1 += (a1) + (r0 < __t); \ } while (0) #define subdq(r1, r0, a1, a0) \ do { \ limb_t __t = r0; \ r0 -= (a0); \ r1 -= (a1) + (r0 > __t); \ } while (0) #if LIMB_BITS == 64 /* Note: we assume __int128 is available */ /* uint128_t defined in libbf.h */ #define muldq(r1, r0, a, b) \ do { \ uint128_t __t; \ __t = (uint128_t)(a) * (uint128_t)(b); \ r0 = __t; \ r1 = __t >> 64; \ } while (0) #define divdq(q, r, a1, a0, b) \ do { \ uint128_t __t; \ limb_t __b = (b); \ __t = ((uint128_t)(a1) << 64) | (a0); \ q = __t / __b; \ r = __t % __b; \ } while (0) #else #define muldq(r1, r0, a, b) \ do { \ uint64_t __t; \ __t = (uint64_t)(a) * (uint64_t)(b); \ r0 = __t; \ r1 = __t >> 32; \ } while (0) #define divdq(q, r, a1, a0, b) \ do { \ uint64_t __t; \ limb_t __b = (b); \ __t = ((uint64_t)(a1) << 32) | (a0); \ q = __t / __b; \ r = __t % __b; \ } while (0) #endif /* LIMB_BITS != 64 */ #if LIMB_DIGITS == 19 /* WARNING: hardcoded for b = 1e19. It is assumed that: 0 <= a1 < 2^63 */ #define divdq_base(q, r, a1, a0)\ do {\ uint64_t __a0, __a1, __t0, __t1, __b = BF_DEC_BASE; \ __a0 = a0;\ __a1 = a1;\ __t0 = __a1;\ __t0 = shld(__t0, __a0, 1);\ muldq(q, __t1, __t0, UINT64_C(17014118346046923173)); \ muldq(__t1, __t0, q, __b);\ subdq(__a1, __a0, __t1, __t0);\ subdq(__a1, __a0, 1, __b * 2); \ __t0 = (slimb_t)__a1 >> 1; \ q += 2 + __t0;\ adddq(__a1, __a0, 0, __b & __t0);\ q += __a1; \ __a0 += __b & __a1; \ r = __a0;\ } while(0) #elif LIMB_DIGITS == 9 /* WARNING: hardcoded for b = 1e9. It is assumed that: 0 <= a1 < 2^29 */ #define divdq_base(q, r, a1, a0)\ do {\ uint32_t __t0, __t1, __b = BF_DEC_BASE; \ __t0 = a1;\ __t1 = a0;\ __t0 = (__t0 << 3) | (__t1 >> (32 - 3)); \ muldq(q, __t1, __t0, 2305843009U);\ r = a0 - q * __b;\ __t1 = (r >= __b);\ q += __t1;\ if (__t1)\ r -= __b;\ } while(0) #endif /* fast integer division by a fixed constant */ typedef struct FastDivData { limb_t m1; /* multiplier */ int8_t shift1; int8_t shift2; } FastDivData; /* From "Division by Invariant Integers using Multiplication" by Torborn Granlund and Peter L. Montgomery */ /* d must be != 0 */ static inline __maybe_unused void fast_udiv_init(FastDivData *s, limb_t d) { int l; limb_t q, r, m1; if (d == 1) l = 0; else l = 64 - clz64(d - 1); divdq(q, r, ((limb_t)1 << l) - d, 0, d); (void)r; m1 = q + 1; // printf("d=%lu l=%d m1=0x%016lx\n", d, l, m1); s->m1 = m1; s->shift1 = l; if (s->shift1 > 1) s->shift1 = 1; s->shift2 = l - 1; if (s->shift2 < 0) s->shift2 = 0; } static inline limb_t fast_udiv(limb_t a, const FastDivData *s) { limb_t t0, t1; muldq(t1, t0, s->m1, a); t0 = (a - t1) >> s->shift1; return (t1 + t0) >> s->shift2; } /* contains 10^i */ const limb_t mp_pow_dec[LIMB_DIGITS + 1] = { 1U, 10U, 100U, 1000U, 10000U, 100000U, 1000000U, 10000000U, 100000000U, 1000000000U, #if LIMB_BITS == 64 10000000000U, 100000000000U, 1000000000000U, 10000000000000U, 100000000000000U, 1000000000000000U, 10000000000000000U, 100000000000000000U, 1000000000000000000U, 10000000000000000000U, #endif }; /* precomputed from fast_udiv_init(10^i) */ static const FastDivData mp_pow_div[LIMB_DIGITS + 1] = { #if LIMB_BITS == 32 { 0x00000001, 0, 0 }, { 0x9999999a, 1, 3 }, { 0x47ae147b, 1, 6 }, { 0x0624dd30, 1, 9 }, { 0xa36e2eb2, 1, 13 }, { 0x4f8b588f, 1, 16 }, { 0x0c6f7a0c, 1, 19 }, { 0xad7f29ac, 1, 23 }, { 0x5798ee24, 1, 26 }, { 0x12e0be83, 1, 29 }, #else { 0x0000000000000001, 0, 0 }, { 0x999999999999999a, 1, 3 }, { 0x47ae147ae147ae15, 1, 6 }, { 0x0624dd2f1a9fbe77, 1, 9 }, { 0xa36e2eb1c432ca58, 1, 13 }, { 0x4f8b588e368f0847, 1, 16 }, { 0x0c6f7a0b5ed8d36c, 1, 19 }, { 0xad7f29abcaf48579, 1, 23 }, { 0x5798ee2308c39dfa, 1, 26 }, { 0x12e0be826d694b2f, 1, 29 }, { 0xb7cdfd9d7bdbab7e, 1, 33 }, { 0x5fd7fe17964955fe, 1, 36 }, { 0x19799812dea11198, 1, 39 }, { 0xc25c268497681c27, 1, 43 }, { 0x6849b86a12b9b01f, 1, 46 }, { 0x203af9ee756159b3, 1, 49 }, { 0xcd2b297d889bc2b7, 1, 53 }, { 0x70ef54646d496893, 1, 56 }, { 0x2725dd1d243aba0f, 1, 59 }, { 0xd83c94fb6d2ac34d, 1, 63 }, #endif }; /* divide by 10^shift with 0 <= shift <= LIMB_DIGITS */ static inline limb_t fast_shr_dec(limb_t a, int shift) { return fast_udiv(a, &mp_pow_div[shift]); } /* division and remainder by 10^shift */ #define fast_shr_rem_dec(q, r, a, shift) q = fast_shr_dec(a, shift), r = a - q * mp_pow_dec[shift] limb_t mp_add_dec(limb_t *res, const limb_t *op1, const limb_t *op2, mp_size_t n, limb_t carry) { limb_t base = BF_DEC_BASE; mp_size_t i; limb_t k, a, v; k=carry; for(i=0;i v; if (k) a += base; res[i] = a; } return k; } limb_t mp_sub_ui_dec(limb_t *tab, limb_t b, mp_size_t n) { limb_t base = BF_DEC_BASE; mp_size_t i; limb_t k, v, a; k=b; for(i=0;i v; if (k) a += base; tab[i]=a; if (k == 0) break; } return k; } /* taba[] = taba[] * b + l. 0 <= b, l <= base - 1. Return the high carry */ limb_t mp_mul1_dec(limb_t *tabr, const limb_t *taba, mp_size_t n, limb_t b, limb_t l) { mp_size_t i; limb_t t0, t1, r; for(i = 0; i < n; i++) { muldq(t1, t0, taba[i], b); adddq(t1, t0, 0, l); divdq_base(l, r, t1, t0); tabr[i] = r; } return l; } /* tabr[] += taba[] * b. 0 <= b <= base - 1. Return the value to add to the high word */ limb_t mp_add_mul1_dec(limb_t *tabr, const limb_t *taba, mp_size_t n, limb_t b) { mp_size_t i; limb_t l, t0, t1, r; l = 0; for(i = 0; i < n; i++) { muldq(t1, t0, taba[i], b); adddq(t1, t0, 0, l); adddq(t1, t0, 0, tabr[i]); divdq_base(l, r, t1, t0); tabr[i] = r; } return l; } /* tabr[] -= taba[] * b. 0 <= b <= base - 1. Return the value to substract to the high word. */ limb_t mp_sub_mul1_dec(limb_t *tabr, const limb_t *taba, mp_size_t n, limb_t b) { limb_t base = BF_DEC_BASE; mp_size_t i; limb_t l, t0, t1, r, a, v, c; /* XXX: optimize */ l = 0; for(i = 0; i < n; i++) { muldq(t1, t0, taba[i], b); adddq(t1, t0, 0, l); divdq_base(l, r, t1, t0); v = tabr[i]; a = v - r; c = a > v; if (c) a += base; /* never bigger than base because r = 0 when l = base - 1 */ l += c; tabr[i] = a; } return l; } /* size of the result : op1_size + op2_size. */ void mp_mul_basecase_dec(limb_t *result, const limb_t *op1, mp_size_t op1_size, const limb_t *op2, mp_size_t op2_size) { mp_size_t i; limb_t r; result[op1_size] = mp_mul1_dec(result, op1, op1_size, op2[0], 0); for(i=1;i> 1; if (r) r = base_div2; for(i = na - 1; i >= 0; i--) { t0 = taba[i]; tabr[i] = (t0 >> 1) + r; r = 0; if (t0 & 1) r = base_div2; } if (r) r = 1; } else #endif if (na >= UDIV1NORM_THRESHOLD) { shift = clz(b); if (shift == 0) { /* normalized case: b >= 2^(LIMB_BITS-1) */ limb_t b_inv; b_inv = udiv1norm_init(b); for(i = na - 1; i >= 0; i--) { muldq(t1, t0, r, base); adddq(t1, t0, 0, taba[i]); q = udiv1norm(&r, t1, t0, b, b_inv); tabr[i] = q; } } else { limb_t b_inv; b <<= shift; b_inv = udiv1norm_init(b); for(i = na - 1; i >= 0; i--) { muldq(t1, t0, r, base); adddq(t1, t0, 0, taba[i]); t1 = (t1 << shift) | (t0 >> (LIMB_BITS - shift)); t0 <<= shift; q = udiv1norm(&r, t1, t0, b, b_inv); r >>= shift; tabr[i] = q; } } } else { for(i = na - 1; i >= 0; i--) { muldq(t1, t0, r, base); adddq(t1, t0, 0, taba[i]); divdq(q, r, t1, t0, b); tabr[i] = q; } } return r; } static __maybe_unused void mp_print_str_dec(const char *str, const limb_t *tab, slimb_t n) { slimb_t i; printf("%s=", str); for(i = n - 1; i >= 0; i--) { if (i != n - 1) printf("_"); printf("%0*" PRIu_LIMB, LIMB_DIGITS, tab[i]); } printf("\n"); } static __maybe_unused void mp_print_str_h_dec(const char *str, const limb_t *tab, slimb_t n, limb_t high) { slimb_t i; printf("%s=", str); printf("%0*" PRIu_LIMB, LIMB_DIGITS, high); for(i = n - 1; i >= 0; i--) { printf("_"); printf("%0*" PRIu_LIMB, LIMB_DIGITS, tab[i]); } printf("\n"); } //#define DEBUG_DIV_SLOW #define DIV_STATIC_ALLOC_LEN 16 /* return q = a / b and r = a % b. taba[na] must be allocated if tabb1[nb - 1] < B / 2. tabb1[nb - 1] must be != zero. na must be >= nb. 's' can be NULL if tabb1[nb - 1] >= B / 2. The remainder is is returned in taba and contains nb libms. tabq contains na - nb + 1 limbs. No overlap is permitted. Running time of the standard method: (na - nb + 1) * nb Return 0 if OK, -1 if memory alloc error */ /* XXX: optimize */ static int mp_div_dec(bf_context_t *s, limb_t *tabq, limb_t *taba, mp_size_t na, const limb_t *tabb1, mp_size_t nb) { limb_t base = BF_DEC_BASE; limb_t r, mult, t0, t1, a, c, q, v, *tabb; mp_size_t i, j; limb_t static_tabb[DIV_STATIC_ALLOC_LEN]; #ifdef DEBUG_DIV_SLOW mp_print_str_dec("a", taba, na); mp_print_str_dec("b", tabb1, nb); #endif /* normalize tabb */ r = tabb1[nb - 1]; assert(r != 0); i = na - nb; if (r >= BF_DEC_BASE / 2) { mult = 1; tabb = (limb_t *)tabb1; q = 1; for(j = nb - 1; j >= 0; j--) { if (taba[i + j] != tabb[j]) { if (taba[i + j] < tabb[j]) q = 0; break; } } tabq[i] = q; if (q) { mp_sub_dec(taba + i, taba + i, tabb, nb, 0); } i--; } else { mult = base / (r + 1); if (likely(nb <= DIV_STATIC_ALLOC_LEN)) { tabb = static_tabb; } else { tabb = bf_malloc(s, sizeof(limb_t) * nb); if (!tabb) return -1; } mp_mul1_dec(tabb, tabb1, nb, mult, 0); taba[na] = mp_mul1_dec(taba, taba, na, mult, 0); } #ifdef DEBUG_DIV_SLOW printf("mult=" FMT_LIMB "\n", mult); mp_print_str_dec("a_norm", taba, na + 1); mp_print_str_dec("b_norm", tabb, nb); #endif for(; i >= 0; i--) { if (unlikely(taba[i + nb] >= tabb[nb - 1])) { /* XXX: check if it is really possible */ q = base - 1; } else { muldq(t1, t0, taba[i + nb], base); adddq(t1, t0, 0, taba[i + nb - 1]); divdq(q, r, t1, t0, tabb[nb - 1]); } // printf("i=%d q1=%ld\n", i, q); r = mp_sub_mul1_dec(taba + i, tabb, nb, q); // mp_dump("r1", taba + i, nb, bd); // printf("r2=%ld\n", r); v = taba[i + nb]; a = v - r; c = a > v; if (c) a += base; taba[i + nb] = a; if (c != 0) { /* negative result */ for(;;) { q--; c = mp_add_dec(taba + i, taba + i, tabb, nb, 0); /* propagate carry and test if positive result */ if (c != 0) { if (++taba[i + nb] == base) { break; } } } } tabq[i] = q; } #ifdef DEBUG_DIV_SLOW mp_print_str_dec("q", tabq, na - nb + 1); mp_print_str_dec("r", taba, nb); #endif /* remove the normalization */ if (mult != 1) { mp_div1_dec(taba, taba, nb, mult, 0); if (unlikely(tabb != static_tabb)) bf_free(s, tabb); } return 0; } /* divide by 10^shift */ static limb_t mp_shr_dec(limb_t *tab_r, const limb_t *tab, mp_size_t n, limb_t shift, limb_t high) { mp_size_t i; limb_t l, a, q, r; assert(shift >= 1 && shift < LIMB_DIGITS); l = high; for(i = n - 1; i >= 0; i--) { a = tab[i]; fast_shr_rem_dec(q, r, a, shift); tab_r[i] = q + l * mp_pow_dec[LIMB_DIGITS - shift]; l = r; } return l; } /* multiply by 10^shift */ static limb_t mp_shl_dec(limb_t *tab_r, const limb_t *tab, mp_size_t n, limb_t shift, limb_t low) { mp_size_t i; limb_t l, a, q, r; assert(shift >= 1 && shift < LIMB_DIGITS); l = low; for(i = 0; i < n; i++) { a = tab[i]; fast_shr_rem_dec(q, r, a, LIMB_DIGITS - shift); tab_r[i] = r * mp_pow_dec[shift] + l; l = q; } return l; } static limb_t mp_sqrtrem2_dec(limb_t *tabs, limb_t *taba) { int k; dlimb_t a, b, r; limb_t taba1[2], s, r0, r1; /* convert to binary and normalize */ a = (dlimb_t)taba[1] * BF_DEC_BASE + taba[0]; k = clz(a >> LIMB_BITS) & ~1; b = a << k; taba1[0] = b; taba1[1] = b >> LIMB_BITS; mp_sqrtrem2(&s, taba1); s >>= (k >> 1); /* convert the remainder back to decimal */ r = a - (dlimb_t)s * (dlimb_t)s; divdq_base(r1, r0, r >> LIMB_BITS, r); taba[0] = r0; tabs[0] = s; return r1; } //#define DEBUG_SQRTREM_DEC /* tmp_buf must contain (n / 2 + 1 limbs) */ static limb_t mp_sqrtrem_rec_dec(limb_t *tabs, limb_t *taba, limb_t n, limb_t *tmp_buf) { limb_t l, h, rh, ql, qh, c, i; if (n == 1) return mp_sqrtrem2_dec(tabs, taba); #ifdef DEBUG_SQRTREM_DEC mp_print_str_dec("a", taba, 2 * n); #endif l = n / 2; h = n - l; qh = mp_sqrtrem_rec_dec(tabs + l, taba + 2 * l, h, tmp_buf); #ifdef DEBUG_SQRTREM_DEC mp_print_str_dec("s1", tabs + l, h); mp_print_str_h_dec("r1", taba + 2 * l, h, qh); mp_print_str_h_dec("r2", taba + l, n, qh); #endif /* the remainder is in taba + 2 * l. Its high bit is in qh */ if (qh) { mp_sub_dec(taba + 2 * l, taba + 2 * l, tabs + l, h, 0); } /* instead of dividing by 2*s, divide by s (which is normalized) and update q and r */ mp_div_dec(NULL, tmp_buf, taba + l, n, tabs + l, h); qh += tmp_buf[l]; for(i = 0; i < l; i++) tabs[i] = tmp_buf[i]; ql = mp_div1_dec(tabs, tabs, l, 2, qh & 1); qh = qh >> 1; /* 0 or 1 */ if (ql) rh = mp_add_dec(taba + l, taba + l, tabs + l, h, 0); else rh = 0; #ifdef DEBUG_SQRTREM_DEC mp_print_str_h_dec("q", tabs, l, qh); mp_print_str_h_dec("u", taba + l, h, rh); #endif mp_add_ui_dec(tabs + l, qh, h); #ifdef DEBUG_SQRTREM_DEC mp_print_str_dec("s2", tabs, n); #endif /* q = qh, tabs[l - 1 ... 0], r = taba[n - 1 ... l] */ /* subtract q^2. if qh = 1 then q = B^l, so we can take shortcuts */ if (qh) { c = qh; } else { mp_mul_basecase_dec(taba + n, tabs, l, tabs, l); c = mp_sub_dec(taba, taba, taba + n, 2 * l, 0); } rh -= mp_sub_ui_dec(taba + 2 * l, c, n - 2 * l); if ((slimb_t)rh < 0) { mp_sub_ui_dec(tabs, 1, n); rh += mp_add_mul1_dec(taba, tabs, n, 2); rh += mp_add_ui_dec(taba, 1, n); } return rh; } /* 'taba' has 2*n limbs with n >= 1 and taba[2*n-1] >= B/4. Return (s, r) with s=floor(sqrt(a)) and r=a-s^2. 0 <= r <= 2 * s. tabs has n limbs. r is returned in the lower n limbs of taba. Its r[n] is the returned value of the function. */ int mp_sqrtrem_dec(bf_context_t *s, limb_t *tabs, limb_t *taba, limb_t n) { limb_t tmp_buf1[8]; limb_t *tmp_buf; mp_size_t n2; n2 = n / 2 + 1; if (n2 <= countof(tmp_buf1)) { tmp_buf = tmp_buf1; } else { tmp_buf = bf_malloc(s, sizeof(limb_t) * n2); if (!tmp_buf) return -1; } taba[n] = mp_sqrtrem_rec_dec(tabs, taba, n, tmp_buf); if (tmp_buf != tmp_buf1) bf_free(s, tmp_buf); return 0; } /* return the number of leading zero digits, from 0 to LIMB_DIGITS */ static int clz_dec(limb_t a) { if (a == 0) return LIMB_DIGITS; switch(LIMB_BITS - 1 - clz(a)) { case 0: /* 1-1 */ return LIMB_DIGITS - 1; case 1: /* 2-3 */ return LIMB_DIGITS - 1; case 2: /* 4-7 */ return LIMB_DIGITS - 1; case 3: /* 8-15 */ if (a < 10) return LIMB_DIGITS - 1; else return LIMB_DIGITS - 2; case 4: /* 16-31 */ return LIMB_DIGITS - 2; case 5: /* 32-63 */ return LIMB_DIGITS - 2; case 6: /* 64-127 */ if (a < 100) return LIMB_DIGITS - 2; else return LIMB_DIGITS - 3; case 7: /* 128-255 */ return LIMB_DIGITS - 3; case 8: /* 256-511 */ return LIMB_DIGITS - 3; case 9: /* 512-1023 */ if (a < 1000) return LIMB_DIGITS - 3; else return LIMB_DIGITS - 4; case 10: /* 1024-2047 */ return LIMB_DIGITS - 4; case 11: /* 2048-4095 */ return LIMB_DIGITS - 4; case 12: /* 4096-8191 */ return LIMB_DIGITS - 4; case 13: /* 8192-16383 */ if (a < 10000) return LIMB_DIGITS - 4; else return LIMB_DIGITS - 5; case 14: /* 16384-32767 */ return LIMB_DIGITS - 5; case 15: /* 32768-65535 */ return LIMB_DIGITS - 5; case 16: /* 65536-131071 */ if (a < 100000) return LIMB_DIGITS - 5; else return LIMB_DIGITS - 6; case 17: /* 131072-262143 */ return LIMB_DIGITS - 6; case 18: /* 262144-524287 */ return LIMB_DIGITS - 6; case 19: /* 524288-1048575 */ if (a < 1000000) return LIMB_DIGITS - 6; else return LIMB_DIGITS - 7; case 20: /* 1048576-2097151 */ return LIMB_DIGITS - 7; case 21: /* 2097152-4194303 */ return LIMB_DIGITS - 7; case 22: /* 4194304-8388607 */ return LIMB_DIGITS - 7; case 23: /* 8388608-16777215 */ if (a < 10000000) return LIMB_DIGITS - 7; else return LIMB_DIGITS - 8; case 24: /* 16777216-33554431 */ return LIMB_DIGITS - 8; case 25: /* 33554432-67108863 */ return LIMB_DIGITS - 8; case 26: /* 67108864-134217727 */ if (a < 100000000) return LIMB_DIGITS - 8; else return LIMB_DIGITS - 9; #if LIMB_BITS == 64 case 27: /* 134217728-268435455 */ return LIMB_DIGITS - 9; case 28: /* 268435456-536870911 */ return LIMB_DIGITS - 9; case 29: /* 536870912-1073741823 */ if (a < 1000000000) return LIMB_DIGITS - 9; else return LIMB_DIGITS - 10; case 30: /* 1073741824-2147483647 */ return LIMB_DIGITS - 10; case 31: /* 2147483648-4294967295 */ return LIMB_DIGITS - 10; case 32: /* 4294967296-8589934591 */ return LIMB_DIGITS - 10; case 33: /* 8589934592-17179869183 */ if (a < 10000000000) return LIMB_DIGITS - 10; else return LIMB_DIGITS - 11; case 34: /* 17179869184-34359738367 */ return LIMB_DIGITS - 11; case 35: /* 34359738368-68719476735 */ return LIMB_DIGITS - 11; case 36: /* 68719476736-137438953471 */ if (a < 100000000000) return LIMB_DIGITS - 11; else return LIMB_DIGITS - 12; case 37: /* 137438953472-274877906943 */ return LIMB_DIGITS - 12; case 38: /* 274877906944-549755813887 */ return LIMB_DIGITS - 12; case 39: /* 549755813888-1099511627775 */ if (a < 1000000000000) return LIMB_DIGITS - 12; else return LIMB_DIGITS - 13; case 40: /* 1099511627776-2199023255551 */ return LIMB_DIGITS - 13; case 41: /* 2199023255552-4398046511103 */ return LIMB_DIGITS - 13; case 42: /* 4398046511104-8796093022207 */ return LIMB_DIGITS - 13; case 43: /* 8796093022208-17592186044415 */ if (a < 10000000000000) return LIMB_DIGITS - 13; else return LIMB_DIGITS - 14; case 44: /* 17592186044416-35184372088831 */ return LIMB_DIGITS - 14; case 45: /* 35184372088832-70368744177663 */ return LIMB_DIGITS - 14; case 46: /* 70368744177664-140737488355327 */ if (a < 100000000000000) return LIMB_DIGITS - 14; else return LIMB_DIGITS - 15; case 47: /* 140737488355328-281474976710655 */ return LIMB_DIGITS - 15; case 48: /* 281474976710656-562949953421311 */ return LIMB_DIGITS - 15; case 49: /* 562949953421312-1125899906842623 */ if (a < 1000000000000000) return LIMB_DIGITS - 15; else return LIMB_DIGITS - 16; case 50: /* 1125899906842624-2251799813685247 */ return LIMB_DIGITS - 16; case 51: /* 2251799813685248-4503599627370495 */ return LIMB_DIGITS - 16; case 52: /* 4503599627370496-9007199254740991 */ return LIMB_DIGITS - 16; case 53: /* 9007199254740992-18014398509481983 */ if (a < 10000000000000000) return LIMB_DIGITS - 16; else return LIMB_DIGITS - 17; case 54: /* 18014398509481984-36028797018963967 */ return LIMB_DIGITS - 17; case 55: /* 36028797018963968-72057594037927935 */ return LIMB_DIGITS - 17; case 56: /* 72057594037927936-144115188075855871 */ if (a < 100000000000000000) return LIMB_DIGITS - 17; else return LIMB_DIGITS - 18; case 57: /* 144115188075855872-288230376151711743 */ return LIMB_DIGITS - 18; case 58: /* 288230376151711744-576460752303423487 */ return LIMB_DIGITS - 18; case 59: /* 576460752303423488-1152921504606846975 */ if (a < 1000000000000000000) return LIMB_DIGITS - 18; else return LIMB_DIGITS - 19; #endif default: return 0; } } /* for debugging */ void bfdec_print_str(const char *str, const bfdec_t *a) { slimb_t i; printf("%s=", str); if (a->expn == BF_EXP_NAN) { printf("NaN"); } else { if (a->sign) putchar('-'); if (a->expn == BF_EXP_ZERO) { putchar('0'); } else if (a->expn == BF_EXP_INF) { printf("Inf"); } else { printf("0."); for(i = a->len - 1; i >= 0; i--) printf("%0*" PRIu_LIMB, LIMB_DIGITS, a->tab[i]); printf("e%" PRId_LIMB, a->expn); } } printf("\n"); } /* return != 0 if one digit between 0 and bit_pos inclusive is not zero. */ static inline limb_t scan_digit_nz(const bfdec_t *r, slimb_t bit_pos) { slimb_t pos; limb_t v, q; int shift; if (bit_pos < 0) return 0; pos = (limb_t)bit_pos / LIMB_DIGITS; shift = (limb_t)bit_pos % LIMB_DIGITS; fast_shr_rem_dec(q, v, r->tab[pos], shift + 1); (void)q; if (v != 0) return 1; pos--; while (pos >= 0) { if (r->tab[pos] != 0) return 1; pos--; } return 0; } static limb_t get_digit(const limb_t *tab, limb_t len, slimb_t pos) { slimb_t i; int shift; i = floor_div(pos, LIMB_DIGITS); if (i < 0 || i >= len) return 0; shift = pos - i * LIMB_DIGITS; return fast_shr_dec(tab[i], shift) % 10; } /* return the addend for rounding. Note that prec can be <= 0 for bf_rint() */ static int bfdec_get_rnd_add(int *pret, const bfdec_t *r, limb_t l, slimb_t prec, int rnd_mode) { int add_one, inexact; limb_t digit1, digit0; // bfdec_print_str("get_rnd_add", r); if (rnd_mode == BF_RNDF) { digit0 = 1; /* faithful rounding does not honor the INEXACT flag */ } else { /* starting limb for bit 'prec + 1' */ digit0 = scan_digit_nz(r, l * LIMB_DIGITS - 1 - bf_max(0, prec + 1)); } /* get the digit at 'prec' */ digit1 = get_digit(r->tab, l, l * LIMB_DIGITS - 1 - prec); inexact = (digit1 | digit0) != 0; add_one = 0; switch(rnd_mode) { case BF_RNDZ: break; case BF_RNDN: if (digit1 == 5) { if (digit0) { add_one = 1; } else { /* round to even */ add_one = get_digit(r->tab, l, l * LIMB_DIGITS - 1 - (prec - 1)) & 1; } } else if (digit1 > 5) { add_one = 1; } break; case BF_RNDD: case BF_RNDU: if (r->sign == (rnd_mode == BF_RNDD)) add_one = inexact; break; case BF_RNDNA: case BF_RNDF: add_one = (digit1 >= 5); break; case BF_RNDA: add_one = inexact; break; default: abort(); } if (inexact) *pret |= BF_ST_INEXACT; return add_one; } /* round to prec1 bits assuming 'r' is non zero and finite. 'r' is assumed to have length 'l' (1 <= l <= r->len). prec1 can be BF_PREC_INF. BF_FLAG_SUBNORMAL is not supported. Cannot fail with BF_ST_MEM_ERROR. */ static int __bfdec_round(bfdec_t *r, limb_t prec1, bf_flags_t flags, limb_t l) { int shift, add_one, rnd_mode, ret; slimb_t i, bit_pos, pos, e_min, e_max, e_range, prec; /* XXX: align to IEEE 754 2008 for decimal numbers ? */ e_range = (limb_t)1 << (bf_get_exp_bits(flags) - 1); e_min = -e_range + 3; e_max = e_range; if (flags & BF_FLAG_RADPNT_PREC) { /* 'prec' is the precision after the decimal point */ if (prec1 != BF_PREC_INF) prec = r->expn + prec1; else prec = prec1; } else if (unlikely(r->expn < e_min) && (flags & BF_FLAG_SUBNORMAL)) { /* restrict the precision in case of potentially subnormal result */ assert(prec1 != BF_PREC_INF); prec = prec1 - (e_min - r->expn); } else { prec = prec1; } /* round to prec bits */ rnd_mode = flags & BF_RND_MASK; ret = 0; add_one = bfdec_get_rnd_add(&ret, r, l, prec, rnd_mode); if (prec <= 0) { if (add_one) { bfdec_resize(r, 1); /* cannot fail because r is non zero */ r->tab[0] = BF_DEC_BASE / 10; r->expn += 1 - prec; ret |= BF_ST_UNDERFLOW | BF_ST_INEXACT; return ret; } else { goto underflow; } } else if (add_one) { limb_t carry; /* add one starting at digit 'prec - 1' */ bit_pos = l * LIMB_DIGITS - 1 - (prec - 1); pos = bit_pos / LIMB_DIGITS; carry = mp_pow_dec[bit_pos % LIMB_DIGITS]; carry = mp_add_ui_dec(r->tab + pos, carry, l - pos); if (carry) { /* shift right by one digit */ mp_shr_dec(r->tab + pos, r->tab + pos, l - pos, 1, 1); r->expn++; } } /* check underflow */ if (unlikely(r->expn < e_min)) { if (flags & BF_FLAG_SUBNORMAL) { /* if inexact, also set the underflow flag */ if (ret & BF_ST_INEXACT) ret |= BF_ST_UNDERFLOW; } else { underflow: bfdec_set_zero(r, r->sign); ret |= BF_ST_UNDERFLOW | BF_ST_INEXACT; return ret; } } /* check overflow */ if (unlikely(r->expn > e_max)) { bfdec_set_inf(r, r->sign); ret |= BF_ST_OVERFLOW | BF_ST_INEXACT; return ret; } /* keep the bits starting at 'prec - 1' */ bit_pos = l * LIMB_DIGITS - 1 - (prec - 1); i = floor_div(bit_pos, LIMB_DIGITS); if (i >= 0) { shift = smod(bit_pos, LIMB_DIGITS); if (shift != 0) { r->tab[i] = fast_shr_dec(r->tab[i], shift) * mp_pow_dec[shift]; } } else { i = 0; } /* remove trailing zeros */ while (r->tab[i] == 0) i++; if (i > 0) { l -= i; memmove(r->tab, r->tab + i, l * sizeof(limb_t)); } bfdec_resize(r, l); /* cannot fail */ return ret; } /* Cannot fail with BF_ST_MEM_ERROR. */ int bfdec_round(bfdec_t *r, limb_t prec, bf_flags_t flags) { if (r->len == 0) return 0; return __bfdec_round(r, prec, flags, r->len); } /* 'r' must be a finite number. Cannot fail with BF_ST_MEM_ERROR. */ int bfdec_normalize_and_round(bfdec_t *r, limb_t prec1, bf_flags_t flags) { limb_t l, v; int shift, ret; // bfdec_print_str("bf_renorm", r); l = r->len; while (l > 0 && r->tab[l - 1] == 0) l--; if (l == 0) { /* zero */ r->expn = BF_EXP_ZERO; bfdec_resize(r, 0); /* cannot fail */ ret = 0; } else { r->expn -= (r->len - l) * LIMB_DIGITS; /* shift to have the MSB set to '1' */ v = r->tab[l - 1]; shift = clz_dec(v); if (shift != 0) { mp_shl_dec(r->tab, r->tab, l, shift, 0); r->expn -= shift; } ret = __bfdec_round(r, prec1, flags, l); } // bf_print_str("r_final", r); return ret; } int bfdec_set_ui(bfdec_t *r, uint64_t v) { #if LIMB_BITS == 32 if (v >= BF_DEC_BASE * BF_DEC_BASE) { if (bfdec_resize(r, 3)) goto fail; r->tab[0] = v % BF_DEC_BASE; v /= BF_DEC_BASE; r->tab[1] = v % BF_DEC_BASE; r->tab[2] = v / BF_DEC_BASE; r->expn = 3 * LIMB_DIGITS; } else #endif if (v >= BF_DEC_BASE) { if (bfdec_resize(r, 2)) goto fail; r->tab[0] = v % BF_DEC_BASE; r->tab[1] = v / BF_DEC_BASE; r->expn = 2 * LIMB_DIGITS; } else { if (bfdec_resize(r, 1)) goto fail; r->tab[0] = v; r->expn = LIMB_DIGITS; } r->sign = 0; return bfdec_normalize_and_round(r, BF_PREC_INF, 0); fail: bfdec_set_nan(r); return BF_ST_MEM_ERROR; } int bfdec_set_si(bfdec_t *r, int64_t v) { int ret; if (v < 0) { ret = bfdec_set_ui(r, -v); r->sign = 1; } else { ret = bfdec_set_ui(r, v); } return ret; } static int bfdec_add_internal(bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags, int b_neg) { bf_context_t *s = r->ctx; int is_sub, cmp_res, a_sign, b_sign, ret; a_sign = a->sign; b_sign = b->sign ^ b_neg; is_sub = a_sign ^ b_sign; cmp_res = bfdec_cmpu(a, b); if (cmp_res < 0) { const bfdec_t *tmp; tmp = a; a = b; b = tmp; a_sign = b_sign; /* b_sign is never used later */ } /* abs(a) >= abs(b) */ if (cmp_res == 0 && is_sub && a->expn < BF_EXP_INF) { /* zero result */ bfdec_set_zero(r, (flags & BF_RND_MASK) == BF_RNDD); ret = 0; } else if (a->len == 0 || b->len == 0) { ret = 0; if (a->expn >= BF_EXP_INF) { if (a->expn == BF_EXP_NAN) { /* at least one operand is NaN */ bfdec_set_nan(r); ret = 0; } else if (b->expn == BF_EXP_INF && is_sub) { /* infinities with different signs */ bfdec_set_nan(r); ret = BF_ST_INVALID_OP; } else { bfdec_set_inf(r, a_sign); } } else { /* at least one zero and not subtract */ if (bfdec_set(r, a)) return BF_ST_MEM_ERROR; r->sign = a_sign; goto renorm; } } else { slimb_t d, a_offset, b_offset, i, r_len; limb_t carry; limb_t *b1_tab; int b_shift; mp_size_t b1_len; d = a->expn - b->expn; /* XXX: not efficient in time and memory if the precision is not infinite */ r_len = bf_max(a->len, b->len + (d + LIMB_DIGITS - 1) / LIMB_DIGITS); if (bfdec_resize(r, r_len)) goto fail; r->sign = a_sign; r->expn = a->expn; a_offset = r_len - a->len; for(i = 0; i < a_offset; i++) r->tab[i] = 0; for(i = 0; i < a->len; i++) r->tab[a_offset + i] = a->tab[i]; b_shift = d % LIMB_DIGITS; if (b_shift == 0) { b1_len = b->len; b1_tab = (limb_t *)b->tab; } else { b1_len = b->len + 1; b1_tab = bf_malloc(s, sizeof(limb_t) * b1_len); if (!b1_tab) goto fail; b1_tab[0] = mp_shr_dec(b1_tab + 1, b->tab, b->len, b_shift, 0) * mp_pow_dec[LIMB_DIGITS - b_shift]; } b_offset = r_len - (b->len + (d + LIMB_DIGITS - 1) / LIMB_DIGITS); if (is_sub) { carry = mp_sub_dec(r->tab + b_offset, r->tab + b_offset, b1_tab, b1_len, 0); if (carry != 0) { carry = mp_sub_ui_dec(r->tab + b_offset + b1_len, carry, r_len - (b_offset + b1_len)); assert(carry == 0); } } else { carry = mp_add_dec(r->tab + b_offset, r->tab + b_offset, b1_tab, b1_len, 0); if (carry != 0) { carry = mp_add_ui_dec(r->tab + b_offset + b1_len, carry, r_len - (b_offset + b1_len)); } if (carry != 0) { if (bfdec_resize(r, r_len + 1)) { if (b_shift != 0) bf_free(s, b1_tab); goto fail; } r->tab[r_len] = 1; r->expn += LIMB_DIGITS; } } if (b_shift != 0) bf_free(s, b1_tab); renorm: ret = bfdec_normalize_and_round(r, prec, flags); } return ret; fail: bfdec_set_nan(r); return BF_ST_MEM_ERROR; } static int __bfdec_add(bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags) { return bfdec_add_internal(r, a, b, prec, flags, 0); } static int __bfdec_sub(bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags) { return bfdec_add_internal(r, a, b, prec, flags, 1); } int bfdec_add(bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags) { return bf_op2((bf_t *)r, (bf_t *)a, (bf_t *)b, prec, flags, (bf_op2_func_t *)__bfdec_add); } int bfdec_sub(bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags) { return bf_op2((bf_t *)r, (bf_t *)a, (bf_t *)b, prec, flags, (bf_op2_func_t *)__bfdec_sub); } int bfdec_mul(bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags) { int ret, r_sign; if (a->len < b->len) { const bfdec_t *tmp = a; a = b; b = tmp; } r_sign = a->sign ^ b->sign; /* here b->len <= a->len */ if (b->len == 0) { if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { bfdec_set_nan(r); ret = 0; } else if (a->expn == BF_EXP_INF || b->expn == BF_EXP_INF) { if ((a->expn == BF_EXP_INF && b->expn == BF_EXP_ZERO) || (a->expn == BF_EXP_ZERO && b->expn == BF_EXP_INF)) { bfdec_set_nan(r); ret = BF_ST_INVALID_OP; } else { bfdec_set_inf(r, r_sign); ret = 0; } } else { bfdec_set_zero(r, r_sign); ret = 0; } } else { bfdec_t tmp, *r1 = NULL; limb_t a_len, b_len; limb_t *a_tab, *b_tab; a_len = a->len; b_len = b->len; a_tab = a->tab; b_tab = b->tab; if (r == a || r == b) { bfdec_init(r->ctx, &tmp); r1 = r; r = &tmp; } if (bfdec_resize(r, a_len + b_len)) { bfdec_set_nan(r); ret = BF_ST_MEM_ERROR; goto done; } mp_mul_basecase_dec(r->tab, a_tab, a_len, b_tab, b_len); r->sign = r_sign; r->expn = a->expn + b->expn; ret = bfdec_normalize_and_round(r, prec, flags); done: if (r == &tmp) bfdec_move(r1, &tmp); } return ret; } int bfdec_mul_si(bfdec_t *r, const bfdec_t *a, int64_t b1, limb_t prec, bf_flags_t flags) { bfdec_t b; int ret; bfdec_init(r->ctx, &b); ret = bfdec_set_si(&b, b1); ret |= bfdec_mul(r, a, &b, prec, flags); bfdec_delete(&b); return ret; } int bfdec_add_si(bfdec_t *r, const bfdec_t *a, int64_t b1, limb_t prec, bf_flags_t flags) { bfdec_t b; int ret; bfdec_init(r->ctx, &b); ret = bfdec_set_si(&b, b1); ret |= bfdec_add(r, a, &b, prec, flags); bfdec_delete(&b); return ret; } static int __bfdec_div(bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags) { int ret, r_sign; limb_t n, nb, precl; r_sign = a->sign ^ b->sign; if (a->expn >= BF_EXP_INF || b->expn >= BF_EXP_INF) { if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { bfdec_set_nan(r); return 0; } else if (a->expn == BF_EXP_INF && b->expn == BF_EXP_INF) { bfdec_set_nan(r); return BF_ST_INVALID_OP; } else if (a->expn == BF_EXP_INF) { bfdec_set_inf(r, r_sign); return 0; } else { bfdec_set_zero(r, r_sign); return 0; } } else if (a->expn == BF_EXP_ZERO) { if (b->expn == BF_EXP_ZERO) { bfdec_set_nan(r); return BF_ST_INVALID_OP; } else { bfdec_set_zero(r, r_sign); return 0; } } else if (b->expn == BF_EXP_ZERO) { bfdec_set_inf(r, r_sign); return BF_ST_DIVIDE_ZERO; } nb = b->len; if (prec == BF_PREC_INF) { /* infinite precision: return BF_ST_INVALID_OP if not an exact result */ /* XXX: check */ precl = nb + 1; } else if (flags & BF_FLAG_RADPNT_PREC) { /* number of digits after the decimal point */ /* XXX: check (2 extra digits for rounding + 2 digits) */ precl = (bf_max(a->expn - b->expn, 0) + 2 + prec + 2 + LIMB_DIGITS - 1) / LIMB_DIGITS; } else { /* number of limbs of the quotient (2 extra digits for rounding) */ precl = (prec + 2 + LIMB_DIGITS - 1) / LIMB_DIGITS; } n = bf_max(a->len, precl); { limb_t *taba, na, i; slimb_t d; na = n + nb; taba = bf_malloc(r->ctx, (na + 1) * sizeof(limb_t)); if (!taba) goto fail; d = na - a->len; memset(taba, 0, d * sizeof(limb_t)); memcpy(taba + d, a->tab, a->len * sizeof(limb_t)); if (bfdec_resize(r, n + 1)) goto fail1; if (mp_div_dec(r->ctx, r->tab, taba, na, b->tab, nb)) { fail1: bf_free(r->ctx, taba); goto fail; } /* see if non zero remainder */ for(i = 0; i < nb; i++) { if (taba[i] != 0) break; } bf_free(r->ctx, taba); if (i != nb) { if (prec == BF_PREC_INF) { bfdec_set_nan(r); return BF_ST_INVALID_OP; } else { r->tab[0] |= 1; } } r->expn = a->expn - b->expn + LIMB_DIGITS; r->sign = r_sign; ret = bfdec_normalize_and_round(r, prec, flags); } return ret; fail: bfdec_set_nan(r); return BF_ST_MEM_ERROR; } int bfdec_div(bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags) { return bf_op2((bf_t *)r, (bf_t *)a, (bf_t *)b, prec, flags, (bf_op2_func_t *)__bfdec_div); } /* a and b must be finite numbers with a >= 0 and b > 0. 'q' is the integer defined as floor(a/b) and r = a - q * b. */ static void bfdec_tdivremu(bf_context_t *s, bfdec_t *q, bfdec_t *r, const bfdec_t *a, const bfdec_t *b) { if (bfdec_cmpu(a, b) < 0) { bfdec_set_ui(q, 0); bfdec_set(r, a); } else { bfdec_div(q, a, b, 0, BF_RNDZ | BF_FLAG_RADPNT_PREC); bfdec_mul(r, q, b, BF_PREC_INF, BF_RNDZ); bfdec_sub(r, a, r, BF_PREC_INF, BF_RNDZ); } } /* division and remainder. rnd_mode is the rounding mode for the quotient. The additional rounding mode BF_RND_EUCLIDIAN is supported. 'q' is an integer. 'r' is rounded with prec and flags (prec can be BF_PREC_INF). */ int bfdec_divrem(bfdec_t *q, bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags, int rnd_mode) { bf_context_t *s = q->ctx; bfdec_t a1_s, *a1 = &a1_s; bfdec_t b1_s, *b1 = &b1_s; bfdec_t r1_s, *r1 = &r1_s; int q_sign, res; bool is_ceil, is_rndn; assert(q != a && q != b); assert(r != a && r != b); assert(q != r); if (a->len == 0 || b->len == 0) { bfdec_set_zero(q, 0); if (a->expn == BF_EXP_NAN || b->expn == BF_EXP_NAN) { bfdec_set_nan(r); return 0; } else if (a->expn == BF_EXP_INF || b->expn == BF_EXP_ZERO) { bfdec_set_nan(r); return BF_ST_INVALID_OP; } else { bfdec_set(r, a); return bfdec_round(r, prec, flags); } } q_sign = a->sign ^ b->sign; is_rndn = (rnd_mode == BF_RNDN || rnd_mode == BF_RNDNA); switch(rnd_mode) { default: case BF_RNDZ: case BF_RNDN: case BF_RNDNA: is_ceil = false; break; case BF_RNDD: is_ceil = q_sign; break; case BF_RNDU: is_ceil = q_sign ^ 1; break; case BF_RNDA: is_ceil = true; break; case BF_DIVREM_EUCLIDIAN: is_ceil = a->sign; break; } a1->expn = a->expn; a1->tab = a->tab; a1->len = a->len; a1->sign = 0; b1->expn = b->expn; b1->tab = b->tab; b1->len = b->len; b1->sign = 0; // bfdec_print_str("a1", a1); // bfdec_print_str("b1", b1); /* XXX: could improve to avoid having a large 'q' */ bfdec_tdivremu(s, q, r, a1, b1); if (bfdec_is_nan(q) || bfdec_is_nan(r)) goto fail; // bfdec_print_str("q", q); // bfdec_print_str("r", r); if (r->len != 0) { if (is_rndn) { bfdec_init(s, r1); if (bfdec_set(r1, r)) goto fail; if (bfdec_mul_si(r1, r1, 2, BF_PREC_INF, BF_RNDZ)) { bfdec_delete(r1); goto fail; } res = bfdec_cmpu(r1, b); bfdec_delete(r1); if (res > 0 || (res == 0 && (rnd_mode == BF_RNDNA || (get_digit(q->tab, q->len, q->len * LIMB_DIGITS - q->expn) & 1) != 0))) { goto do_sub_r; } } else if (is_ceil) { do_sub_r: res = bfdec_add_si(q, q, 1, BF_PREC_INF, BF_RNDZ); res |= bfdec_sub(r, r, b1, BF_PREC_INF, BF_RNDZ); if (res & BF_ST_MEM_ERROR) goto fail; } } r->sign ^= a->sign; q->sign = q_sign; return bfdec_round(r, prec, flags); fail: bfdec_set_nan(q); bfdec_set_nan(r); return BF_ST_MEM_ERROR; } int bfdec_rem(bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags, int rnd_mode) { bfdec_t q_s, *q = &q_s; int ret; bfdec_init(r->ctx, q); ret = bfdec_divrem(q, r, a, b, prec, flags, rnd_mode); bfdec_delete(q); return ret; } /* convert to integer (infinite precision) */ int bfdec_rint(bfdec_t *r, int rnd_mode) { return bfdec_round(r, 0, rnd_mode | BF_FLAG_RADPNT_PREC); } int bfdec_sqrt(bfdec_t *r, const bfdec_t *a, limb_t prec, bf_flags_t flags) { bf_context_t *s = a->ctx; int ret, k; limb_t *a1, v; slimb_t n, n1, prec1; limb_t res; assert(r != a); if (a->len == 0) { if (a->expn == BF_EXP_NAN) { bfdec_set_nan(r); } else if (a->expn == BF_EXP_INF && a->sign) { goto invalid_op; } else { bfdec_set(r, a); } ret = 0; } else if (a->sign || prec == BF_PREC_INF) { invalid_op: bfdec_set_nan(r); ret = BF_ST_INVALID_OP; } else { if (flags & BF_FLAG_RADPNT_PREC) { prec1 = bf_max(floor_div(a->expn + 1, 2) + prec, 1); } else { prec1 = prec; } /* convert the mantissa to an integer with at least 2 * prec + 4 digits */ n = (2 * (prec1 + 2) + 2 * LIMB_DIGITS - 1) / (2 * LIMB_DIGITS); if (bfdec_resize(r, n)) goto fail; a1 = bf_malloc(s, sizeof(limb_t) * 2 * n); if (!a1) goto fail; n1 = bf_min(2 * n, a->len); memset(a1, 0, (2 * n - n1) * sizeof(limb_t)); memcpy(a1 + 2 * n - n1, a->tab + a->len - n1, n1 * sizeof(limb_t)); if (a->expn & 1) { res = mp_shr_dec(a1, a1, 2 * n, 1, 0); } else { res = 0; } /* normalize so that a1 >= B^(2*n)/4. Not need for n = 1 because mp_sqrtrem2_dec already does it */ k = 0; if (n > 1) { v = a1[2 * n - 1]; while (v < BF_DEC_BASE / 4) { k++; v *= 4; } if (k != 0) mp_mul1_dec(a1, a1, 2 * n, 1 << (2 * k), 0); } if (mp_sqrtrem_dec(s, r->tab, a1, n)) { bf_free(s, a1); goto fail; } if (k != 0) mp_div1_dec(r->tab, r->tab, n, 1 << k, 0); if (!res) { res = mp_scan_nz(a1, n + 1); } bf_free(s, a1); if (!res) { res = mp_scan_nz(a->tab, a->len - n1); } if (res != 0) r->tab[0] |= 1; r->sign = 0; r->expn = (a->expn + 1) >> 1; ret = bfdec_round(r, prec, flags); } return ret; fail: bfdec_set_nan(r); return BF_ST_MEM_ERROR; } /* The rounding mode is always BF_RNDZ. Return BF_ST_OVERFLOW if there is an overflow and 0 otherwise. No memory error is possible. */ int bfdec_get_int32(int *pres, const bfdec_t *a) { uint32_t v; int ret; if (a->expn >= BF_EXP_INF) { ret = 0; if (a->expn == BF_EXP_INF) { v = (uint32_t)INT32_MAX + a->sign; /* XXX: return overflow ? */ } else { v = INT32_MAX; } } else if (a->expn <= 0) { v = 0; ret = 0; } else if (a->expn <= 9) { v = fast_shr_dec(a->tab[a->len - 1], LIMB_DIGITS - a->expn); if (a->sign) v = -v; ret = 0; } else if (a->expn == 10) { uint64_t v1; uint32_t v_max; #if LIMB_BITS == 64 v1 = fast_shr_dec(a->tab[a->len - 1], LIMB_DIGITS - a->expn); #else v1 = (uint64_t)a->tab[a->len - 1] * 10 + get_digit(a->tab, a->len, (a->len - 1) * LIMB_DIGITS - 1); #endif v_max = (uint32_t)INT32_MAX + a->sign; if (v1 > v_max) { v = v_max; ret = BF_ST_OVERFLOW; } else { v = v1; if (a->sign) v = -v; ret = 0; } } else { v = (uint32_t)INT32_MAX + a->sign; ret = BF_ST_OVERFLOW; } *pres = v; return ret; } /* power to an integer with infinite precision */ int bfdec_pow_ui(bfdec_t *r, const bfdec_t *a, limb_t b) { int ret, n_bits, i; assert(r != a); if (b == 0) return bfdec_set_ui(r, 1); ret = bfdec_set(r, a); n_bits = LIMB_BITS - clz(b); for(i = n_bits - 2; i >= 0; i--) { ret |= bfdec_mul(r, r, r, BF_PREC_INF, BF_RNDZ); if ((b >> i) & 1) ret |= bfdec_mul(r, r, a, BF_PREC_INF, BF_RNDZ); } return ret; } char *bfdec_ftoa(size_t *plen, const bfdec_t *a, limb_t prec, bf_flags_t flags) { return bf_ftoa_internal(plen, (const bf_t *)a, 10, prec, flags, true); } int bfdec_atof(bfdec_t *r, const char *str, const char **pnext, limb_t prec, bf_flags_t flags) { slimb_t dummy_exp; return bf_atof_internal((bf_t *)r, &dummy_exp, str, pnext, 10, prec, flags, true); } #endif /* USE_BF_DEC */ #ifdef USE_FFT_MUL /***************************************************************/ /* Integer multiplication with FFT */ /* or LIMB_BITS at bit position 'pos' in tab */ static inline void put_bits(limb_t *tab, limb_t len, slimb_t pos, limb_t val) { limb_t i; int p; i = pos >> LIMB_LOG2_BITS; p = pos & (LIMB_BITS - 1); if (i < len) tab[i] |= val << p; if (p != 0) { i++; if (i < len) { tab[i] |= val >> (LIMB_BITS - p); } } } #if defined(__AVX2__) typedef double NTTLimb; /* we must have: modulo >= 1 << NTT_MOD_LOG2_MIN */ #define NTT_MOD_LOG2_MIN 50 #define NTT_MOD_LOG2_MAX 51 #define NB_MODS 5 #define NTT_PROOT_2EXP 39 static const int ntt_int_bits[NB_MODS] = { 254, 203, 152, 101, 50, }; static const limb_t ntt_mods[NB_MODS] = { 0x00073a8000000001, 0x0007858000000001, 0x0007a38000000001, 0x0007a68000000001, 0x0007fd8000000001, }; static const limb_t ntt_proot[2][NB_MODS] = { { 0x00056198d44332c8, 0x0002eb5d640aad39, 0x00047e31eaa35fd0, 0x0005271ac118a150, 0x00075e0ce8442bd5, }, { 0x000461169761bcc5, 0x0002dac3cb2da688, 0x0004abc97751e3bf, 0x000656778fc8c485, 0x0000dc6469c269fa, }, }; static const limb_t ntt_mods_cr[NB_MODS * (NB_MODS - 1) / 2] = { 0x00020e4da740da8e, 0x0004c3dc09c09c1d, 0x000063bd097b4271, 0x000799d8f18f18fd, 0x0005384222222264, 0x000572b07c1f07fe, 0x00035cd08888889a, 0x00066015555557e3, 0x000725960b60b623, 0x0002fc1fa1d6ce12, }; #else typedef limb_t NTTLimb; #if LIMB_BITS == 64 #define NTT_MOD_LOG2_MIN 61 #define NTT_MOD_LOG2_MAX 62 #define NB_MODS 5 #define NTT_PROOT_2EXP 51 static const int ntt_int_bits[NB_MODS] = { 307, 246, 185, 123, 61, }; static const limb_t ntt_mods[NB_MODS] = { 0x28d8000000000001, 0x2a88000000000001, 0x2ed8000000000001, 0x3508000000000001, 0x3aa8000000000001, }; static const limb_t ntt_proot[2][NB_MODS] = { { 0x1b8ea61034a2bea7, 0x21a9762de58206fb, 0x02ca782f0756a8ea, 0x278384537a3e50a1, 0x106e13fee74ce0ab, }, { 0x233513af133e13b8, 0x1d13140d1c6f75f1, 0x12cde57f97e3eeda, 0x0d6149e23cbe654f, 0x36cd204f522a1379, }, }; static const limb_t ntt_mods_cr[NB_MODS * (NB_MODS - 1) / 2] = { 0x08a9ed097b425eea, 0x18a44aaaaaaaaab3, 0x2493f57f57f57f5d, 0x126b8d0649a7f8d4, 0x09d80ed7303b5ccc, 0x25b8bcf3cf3cf3d5, 0x2ce6ce63398ce638, 0x0e31fad40a57eb59, 0x02a3529fd4a7f52f, 0x3a5493e93e93e94a, }; #elif LIMB_BITS == 32 /* we must have: modulo >= 1 << NTT_MOD_LOG2_MIN */ #define NTT_MOD_LOG2_MIN 29 #define NTT_MOD_LOG2_MAX 30 #define NB_MODS 5 #define NTT_PROOT_2EXP 20 static const int ntt_int_bits[NB_MODS] = { 148, 119, 89, 59, 29, }; static const limb_t ntt_mods[NB_MODS] = { 0x0000000032b00001, 0x0000000033700001, 0x0000000036d00001, 0x0000000037300001, 0x000000003e500001, }; static const limb_t ntt_proot[2][NB_MODS] = { { 0x0000000032525f31, 0x0000000005eb3b37, 0x00000000246eda9f, 0x0000000035f25901, 0x00000000022f5768, }, { 0x00000000051eba1a, 0x00000000107be10e, 0x000000001cd574e0, 0x00000000053806e6, 0x000000002cd6bf98, }, }; static const limb_t ntt_mods_cr[NB_MODS * (NB_MODS - 1) / 2] = { 0x000000000449559a, 0x000000001eba6ca9, 0x000000002ec18e46, 0x000000000860160b, 0x000000000d321307, 0x000000000bf51120, 0x000000000f662938, 0x000000000932ab3e, 0x000000002f40eef8, 0x000000002e760905, }; #endif /* LIMB_BITS */ #endif /* !AVX2 */ #if defined(__AVX2__) #define NTT_TRIG_K_MAX 18 #else #define NTT_TRIG_K_MAX 19 #endif typedef struct BFNTTState { bf_context_t *ctx; /* used for mul_mod_fast() */ limb_t ntt_mods_div[NB_MODS]; limb_t ntt_proot_pow[NB_MODS][2][NTT_PROOT_2EXP + 1]; limb_t ntt_proot_pow_inv[NB_MODS][2][NTT_PROOT_2EXP + 1]; NTTLimb *ntt_trig[NB_MODS][2][NTT_TRIG_K_MAX + 1]; /* 1/2^n mod m */ limb_t ntt_len_inv[NB_MODS][NTT_PROOT_2EXP + 1][2]; #if defined(__AVX2__) __m256d ntt_mods_cr_vec[NB_MODS * (NB_MODS - 1) / 2]; __m256d ntt_mods_vec[NB_MODS]; __m256d ntt_mods_inv_vec[NB_MODS]; #else limb_t ntt_mods_cr_inv[NB_MODS * (NB_MODS - 1) / 2]; #endif } BFNTTState; static NTTLimb *get_trig(BFNTTState *s, int k, int inverse, int m_idx); /* add modulo with up to (LIMB_BITS-1) bit modulo */ static inline limb_t add_mod(limb_t a, limb_t b, limb_t m) { limb_t r; r = a + b; if (r >= m) r -= m; return r; } /* sub modulo with up to LIMB_BITS bit modulo */ static inline limb_t sub_mod(limb_t a, limb_t b, limb_t m) { limb_t r; r = a - b; if (r > a) r += m; return r; } /* return (r0+r1*B) mod m precondition: 0 <= r0+r1*B < 2^(64+NTT_MOD_LOG2_MIN) */ static inline limb_t mod_fast(dlimb_t r, limb_t m, limb_t m_inv) { limb_t a1, q, t0, r1, r0; a1 = r >> NTT_MOD_LOG2_MIN; q = ((dlimb_t)a1 * m_inv) >> LIMB_BITS; r = r - (dlimb_t)q * m - m * 2; r1 = r >> LIMB_BITS; t0 = (slimb_t)r1 >> 1; r += m & t0; r0 = r; r1 = r >> LIMB_BITS; r0 += m & r1; return r0; } /* faster version using precomputed modulo inverse. precondition: 0 <= a * b < 2^(64+NTT_MOD_LOG2_MIN) */ static inline limb_t mul_mod_fast(limb_t a, limb_t b, limb_t m, limb_t m_inv) { dlimb_t r; r = (dlimb_t)a * (dlimb_t)b; return mod_fast(r, m, m_inv); } static inline limb_t init_mul_mod_fast(limb_t m) { dlimb_t t; assert(m < (limb_t)1 << NTT_MOD_LOG2_MAX); assert(m >= (limb_t)1 << NTT_MOD_LOG2_MIN); t = (dlimb_t)1 << (LIMB_BITS + NTT_MOD_LOG2_MIN); return t / m; } /* Faster version used when the multiplier is constant. 0 <= a < 2^64, 0 <= b < m. */ static inline limb_t mul_mod_fast2(limb_t a, limb_t b, limb_t m, limb_t b_inv) { limb_t r, q; q = ((dlimb_t)a * (dlimb_t)b_inv) >> LIMB_BITS; r = a * b - q * m; if (r >= m) r -= m; return r; } /* Faster version used when the multiplier is constant. 0 <= a < 2^64, 0 <= b < m. Let r = a * b mod m. The return value is 'r' or 'r + m'. */ static inline limb_t mul_mod_fast3(limb_t a, limb_t b, limb_t m, limb_t b_inv) { limb_t r, q; q = ((dlimb_t)a * (dlimb_t)b_inv) >> LIMB_BITS; r = a * b - q * m; return r; } static inline limb_t init_mul_mod_fast2(limb_t b, limb_t m) { return ((dlimb_t)b << LIMB_BITS) / m; } #ifdef __AVX2__ static inline limb_t ntt_limb_to_int(NTTLimb a, limb_t m) { slimb_t v; v = a; if (v < 0) v += m; if (v >= m) v -= m; return v; } static inline NTTLimb int_to_ntt_limb(limb_t a, limb_t m) { return (slimb_t)a; } static inline NTTLimb int_to_ntt_limb2(limb_t a, limb_t m) { if (a >= (m / 2)) a -= m; return (slimb_t)a; } /* return r + m if r < 0 otherwise r. */ static inline __m256d ntt_mod1(__m256d r, __m256d m) { return _mm256_blendv_pd(r, r + m, r); } /* input: abs(r) < 2 * m. Output: abs(r) < m */ static inline __m256d ntt_mod(__m256d r, __m256d mf, __m256d m2f) { return _mm256_blendv_pd(r, r + m2f, r) - mf; } /* input: abs(a*b) < 2 * m^2, output: abs(r) < m */ static inline __m256d ntt_mul_mod(__m256d a, __m256d b, __m256d mf, __m256d m_inv) { __m256d r, q, ab1, ab0, qm0, qm1; ab1 = a * b; q = _mm256_round_pd(ab1 * m_inv, 0); /* round to nearest */ qm1 = q * mf; qm0 = _mm256_fmsub_pd(q, mf, qm1); /* low part */ ab0 = _mm256_fmsub_pd(a, b, ab1); /* low part */ r = (ab1 - qm1) + (ab0 - qm0); return r; } static void *bf_aligned_malloc(bf_context_t *s, size_t size, size_t align) { void *ptr; void **ptr1; ptr = bf_malloc(s, size + sizeof(void *) + align - 1); if (!ptr) return NULL; ptr1 = (void **)(((uintptr_t)ptr + sizeof(void *) + align - 1) & ~(align - 1)); ptr1[-1] = ptr; return ptr1; } static void bf_aligned_free(bf_context_t *s, void *ptr) { if (!ptr) return; bf_free(s, ((void **)ptr)[-1]); } static void *ntt_malloc(BFNTTState *s, size_t size) { return bf_aligned_malloc(s->ctx, size, 64); } static void ntt_free(BFNTTState *s, void *ptr) { bf_aligned_free(s->ctx, ptr); } static no_inline int ntt_fft(BFNTTState *s, NTTLimb *out_buf, NTTLimb *in_buf, NTTLimb *tmp_buf, int fft_len_log2, int inverse, int m_idx) { limb_t nb_blocks, fft_per_block, p, k, n, stride_in, i, j; NTTLimb *tab_in, *tab_out, *tmp, *trig; __m256d m_inv, mf, m2f, c, a0, a1, b0, b1; limb_t m; int l; m = ntt_mods[m_idx]; m_inv = _mm256_set1_pd(1.0 / (double)m); mf = _mm256_set1_pd(m); m2f = _mm256_set1_pd(m * 2); n = (limb_t)1 << fft_len_log2; assert(n >= 8); stride_in = n / 2; tab_in = in_buf; tab_out = tmp_buf; trig = get_trig(s, fft_len_log2, inverse, m_idx); if (!trig) return -1; p = 0; for(k = 0; k < stride_in; k += 4) { a0 = _mm256_load_pd(&tab_in[k]); a1 = _mm256_load_pd(&tab_in[k + stride_in]); c = _mm256_load_pd(trig); trig += 4; b0 = ntt_mod(a0 + a1, mf, m2f); b1 = ntt_mul_mod(a0 - a1, c, mf, m_inv); a0 = _mm256_permute2f128_pd(b0, b1, 0x20); a1 = _mm256_permute2f128_pd(b0, b1, 0x31); a0 = _mm256_permute4x64_pd(a0, 0xd8); a1 = _mm256_permute4x64_pd(a1, 0xd8); _mm256_store_pd(&tab_out[p], a0); _mm256_store_pd(&tab_out[p + 4], a1); p += 2 * 4; } tmp = tab_in; tab_in = tab_out; tab_out = tmp; trig = get_trig(s, fft_len_log2 - 1, inverse, m_idx); if (!trig) return -1; p = 0; for(k = 0; k < stride_in; k += 4) { a0 = _mm256_load_pd(&tab_in[k]); a1 = _mm256_load_pd(&tab_in[k + stride_in]); c = _mm256_setr_pd(trig[0], trig[0], trig[1], trig[1]); trig += 2; b0 = ntt_mod(a0 + a1, mf, m2f); b1 = ntt_mul_mod(a0 - a1, c, mf, m_inv); a0 = _mm256_permute2f128_pd(b0, b1, 0x20); a1 = _mm256_permute2f128_pd(b0, b1, 0x31); _mm256_store_pd(&tab_out[p], a0); _mm256_store_pd(&tab_out[p + 4], a1); p += 2 * 4; } tmp = tab_in; tab_in = tab_out; tab_out = tmp; nb_blocks = n / 4; fft_per_block = 4; l = fft_len_log2 - 2; while (nb_blocks != 2) { nb_blocks >>= 1; p = 0; k = 0; trig = get_trig(s, l, inverse, m_idx); if (!trig) return -1; for(i = 0; i < nb_blocks; i++) { c = _mm256_set1_pd(trig[0]); trig++; for(j = 0; j < fft_per_block; j += 4) { a0 = _mm256_load_pd(&tab_in[k + j]); a1 = _mm256_load_pd(&tab_in[k + j + stride_in]); b0 = ntt_mod(a0 + a1, mf, m2f); b1 = ntt_mul_mod(a0 - a1, c, mf, m_inv); _mm256_store_pd(&tab_out[p + j], b0); _mm256_store_pd(&tab_out[p + j + fft_per_block], b1); } k += fft_per_block; p += 2 * fft_per_block; } fft_per_block <<= 1; l--; tmp = tab_in; tab_in = tab_out; tab_out = tmp; } tab_out = out_buf; for(k = 0; k < stride_in; k += 4) { a0 = _mm256_load_pd(&tab_in[k]); a1 = _mm256_load_pd(&tab_in[k + stride_in]); b0 = ntt_mod(a0 + a1, mf, m2f); b1 = ntt_mod(a0 - a1, mf, m2f); _mm256_store_pd(&tab_out[k], b0); _mm256_store_pd(&tab_out[k + stride_in], b1); } return 0; } static void ntt_vec_mul(BFNTTState *s, NTTLimb *tab1, NTTLimb *tab2, limb_t fft_len_log2, int k_tot, int m_idx) { limb_t i, c_inv, n, m; __m256d m_inv, mf, a, b, c; m = ntt_mods[m_idx]; c_inv = s->ntt_len_inv[m_idx][k_tot][0]; m_inv = _mm256_set1_pd(1.0 / (double)m); mf = _mm256_set1_pd(m); c = _mm256_set1_pd(int_to_ntt_limb(c_inv, m)); n = (limb_t)1 << fft_len_log2; for(i = 0; i < n; i += 4) { a = _mm256_load_pd(&tab1[i]); b = _mm256_load_pd(&tab2[i]); a = ntt_mul_mod(a, b, mf, m_inv); a = ntt_mul_mod(a, c, mf, m_inv); _mm256_store_pd(&tab1[i], a); } } static no_inline void mul_trig(NTTLimb *buf, limb_t n, limb_t c1, limb_t m, limb_t m_inv1) { limb_t i, c2, c3, c4; __m256d c, c_mul, a0, mf, m_inv; assert(n >= 2); mf = _mm256_set1_pd(m); m_inv = _mm256_set1_pd(1.0 / (double)m); c2 = mul_mod_fast(c1, c1, m, m_inv1); c3 = mul_mod_fast(c2, c1, m, m_inv1); c4 = mul_mod_fast(c2, c2, m, m_inv1); c = _mm256_setr_pd(1, int_to_ntt_limb(c1, m), int_to_ntt_limb(c2, m), int_to_ntt_limb(c3, m)); c_mul = _mm256_set1_pd(int_to_ntt_limb(c4, m)); for(i = 0; i < n; i += 4) { a0 = _mm256_load_pd(&buf[i]); a0 = ntt_mul_mod(a0, c, mf, m_inv); _mm256_store_pd(&buf[i], a0); c = ntt_mul_mod(c, c_mul, mf, m_inv); } } #else static void *ntt_malloc(BFNTTState *s, size_t size) { return bf_malloc(s->ctx, size); } static void ntt_free(BFNTTState *s, void *ptr) { bf_free(s->ctx, ptr); } static inline limb_t ntt_limb_to_int(NTTLimb a, limb_t m) { if (a >= m) a -= m; return a; } static inline NTTLimb int_to_ntt_limb(slimb_t a, limb_t m) { return a; } static no_inline int ntt_fft(BFNTTState *s, NTTLimb *out_buf, NTTLimb *in_buf, NTTLimb *tmp_buf, int fft_len_log2, int inverse, int m_idx) { limb_t nb_blocks, fft_per_block, p, k, n, stride_in, i, j, m, m2; NTTLimb *tab_in, *tab_out, *tmp, a0, a1, b0, b1, c, *trig, c_inv; int l; m = ntt_mods[m_idx]; m2 = 2 * m; n = (limb_t)1 << fft_len_log2; nb_blocks = n; fft_per_block = 1; stride_in = n / 2; tab_in = in_buf; tab_out = tmp_buf; l = fft_len_log2; while (nb_blocks != 2) { nb_blocks >>= 1; p = 0; k = 0; trig = get_trig(s, l, inverse, m_idx); if (!trig) return -1; for(i = 0; i < nb_blocks; i++) { c = trig[0]; c_inv = trig[1]; trig += 2; for(j = 0; j < fft_per_block; j++) { a0 = tab_in[k + j]; a1 = tab_in[k + j + stride_in]; b0 = add_mod(a0, a1, m2); b1 = a0 - a1 + m2; b1 = mul_mod_fast3(b1, c, m, c_inv); tab_out[p + j] = b0; tab_out[p + j + fft_per_block] = b1; } k += fft_per_block; p += 2 * fft_per_block; } fft_per_block <<= 1; l--; tmp = tab_in; tab_in = tab_out; tab_out = tmp; } /* no twiddle in last step */ tab_out = out_buf; for(k = 0; k < stride_in; k++) { a0 = tab_in[k]; a1 = tab_in[k + stride_in]; b0 = add_mod(a0, a1, m2); b1 = sub_mod(a0, a1, m2); tab_out[k] = b0; tab_out[k + stride_in] = b1; } return 0; } static void ntt_vec_mul(BFNTTState *s, NTTLimb *tab1, NTTLimb *tab2, int fft_len_log2, int k_tot, int m_idx) { limb_t i, norm, norm_inv, a, n, m, m_inv; m = ntt_mods[m_idx]; m_inv = s->ntt_mods_div[m_idx]; norm = s->ntt_len_inv[m_idx][k_tot][0]; norm_inv = s->ntt_len_inv[m_idx][k_tot][1]; n = (limb_t)1 << fft_len_log2; for(i = 0; i < n; i++) { a = tab1[i]; /* need to reduce the range so that the product is < 2^(LIMB_BITS+NTT_MOD_LOG2_MIN) */ if (a >= m) a -= m; a = mul_mod_fast(a, tab2[i], m, m_inv); a = mul_mod_fast3(a, norm, m, norm_inv); tab1[i] = a; } } static no_inline void mul_trig(NTTLimb *buf, limb_t n, limb_t c_mul, limb_t m, limb_t m_inv) { limb_t i, c0, c_mul_inv; c0 = 1; c_mul_inv = init_mul_mod_fast2(c_mul, m); for(i = 0; i < n; i++) { buf[i] = mul_mod_fast(buf[i], c0, m, m_inv); c0 = mul_mod_fast2(c0, c_mul, m, c_mul_inv); } } #endif /* !AVX2 */ static no_inline NTTLimb *get_trig(BFNTTState *s, int k, int inverse, int m_idx) { NTTLimb *tab; limb_t i, n2, c, c_mul, m, c_mul_inv; if (k > NTT_TRIG_K_MAX) return NULL; tab = s->ntt_trig[m_idx][inverse][k]; if (tab) return tab; n2 = (limb_t)1 << (k - 1); m = ntt_mods[m_idx]; #ifdef __AVX2__ tab = ntt_malloc(s, sizeof(NTTLimb) * n2); #else tab = ntt_malloc(s, sizeof(NTTLimb) * n2 * 2); #endif if (!tab) return NULL; c = 1; c_mul = s->ntt_proot_pow[m_idx][inverse][k]; c_mul_inv = s->ntt_proot_pow_inv[m_idx][inverse][k]; for(i = 0; i < n2; i++) { #ifdef __AVX2__ tab[i] = int_to_ntt_limb2(c, m); #else tab[2 * i] = int_to_ntt_limb(c, m); tab[2 * i + 1] = init_mul_mod_fast2(c, m); #endif c = mul_mod_fast2(c, c_mul, m, c_mul_inv); } s->ntt_trig[m_idx][inverse][k] = tab; return tab; } void fft_clear_cache(bf_context_t *s1) { int m_idx, inverse, k; BFNTTState *s = s1->ntt_state; if (s) { for(m_idx = 0; m_idx < NB_MODS; m_idx++) { for(inverse = 0; inverse < 2; inverse++) { for(k = 0; k < NTT_TRIG_K_MAX + 1; k++) { if (s->ntt_trig[m_idx][inverse][k]) { ntt_free(s, s->ntt_trig[m_idx][inverse][k]); s->ntt_trig[m_idx][inverse][k] = NULL; } } } } #if defined(__AVX2__) bf_aligned_free(s1, s); #else bf_free(s1, s); #endif s1->ntt_state = NULL; } } #define STRIP_LEN 16 /* dst = buf1, src = buf2 */ static int ntt_fft_partial(BFNTTState *s, NTTLimb *buf1, int k1, int k2, limb_t n1, limb_t n2, int inverse, limb_t m_idx) { limb_t i, j, c_mul, c0, m, m_inv, strip_len, l; NTTLimb *buf2, *buf3; buf2 = NULL; buf3 = ntt_malloc(s, sizeof(NTTLimb) * n1); if (!buf3) goto fail; if (k2 == 0) { if (ntt_fft(s, buf1, buf1, buf3, k1, inverse, m_idx)) goto fail; } else { strip_len = STRIP_LEN; buf2 = ntt_malloc(s, sizeof(NTTLimb) * n1 * strip_len); if (!buf2) goto fail; m = ntt_mods[m_idx]; m_inv = s->ntt_mods_div[m_idx]; c0 = s->ntt_proot_pow[m_idx][inverse][k1 + k2]; c_mul = 1; assert((n2 % strip_len) == 0); for(j = 0; j < n2; j += strip_len) { for(i = 0; i < n1; i++) { for(l = 0; l < strip_len; l++) { buf2[i + l * n1] = buf1[i * n2 + (j + l)]; } } for(l = 0; l < strip_len; l++) { if (inverse) mul_trig(buf2 + l * n1, n1, c_mul, m, m_inv); if (ntt_fft(s, buf2 + l * n1, buf2 + l * n1, buf3, k1, inverse, m_idx)) goto fail; if (!inverse) mul_trig(buf2 + l * n1, n1, c_mul, m, m_inv); c_mul = mul_mod_fast(c_mul, c0, m, m_inv); } for(i = 0; i < n1; i++) { for(l = 0; l < strip_len; l++) { buf1[i * n2 + (j + l)] = buf2[i + l *n1]; } } } ntt_free(s, buf2); } ntt_free(s, buf3); return 0; fail: ntt_free(s, buf2); ntt_free(s, buf3); return -1; } /* dst = buf1, src = buf2, tmp = buf3 */ static int ntt_conv(BFNTTState *s, NTTLimb *buf1, NTTLimb *buf2, int k, int k_tot, limb_t m_idx) { limb_t n1, n2, i; int k1, k2; if (k <= NTT_TRIG_K_MAX) { k1 = k; } else { /* recursive split of the FFT */ k1 = bf_min(k / 2, NTT_TRIG_K_MAX); } k2 = k - k1; n1 = (limb_t)1 << k1; n2 = (limb_t)1 << k2; if (ntt_fft_partial(s, buf1, k1, k2, n1, n2, 0, m_idx)) return -1; if (ntt_fft_partial(s, buf2, k1, k2, n1, n2, 0, m_idx)) return -1; if (k2 == 0) { ntt_vec_mul(s, buf1, buf2, k, k_tot, m_idx); } else { for(i = 0; i < n1; i++) { ntt_conv(s, buf1 + i * n2, buf2 + i * n2, k2, k_tot, m_idx); } } if (ntt_fft_partial(s, buf1, k1, k2, n1, n2, 1, m_idx)) return -1; return 0; } static no_inline void limb_to_ntt(BFNTTState *s, NTTLimb *tabr, limb_t fft_len, const limb_t *taba, limb_t a_len, int dpl, int first_m_idx, int nb_mods) { slimb_t i, n; dlimb_t a, b; int j, shift; limb_t base_mask1, a0, a1, a2, r, m, m_inv; memset(tabr, 0, sizeof(NTTLimb) * fft_len * nb_mods); shift = dpl & (LIMB_BITS - 1); if (shift == 0) base_mask1 = -1; else base_mask1 = ((limb_t)1 << shift) - 1; n = bf_min(fft_len, (a_len * LIMB_BITS + dpl - 1) / dpl); for(i = 0; i < n; i++) { a0 = get_bits(taba, a_len, i * dpl); if (dpl <= LIMB_BITS) { a0 &= base_mask1; a = a0; } else { a1 = get_bits(taba, a_len, i * dpl + LIMB_BITS); if (dpl <= (LIMB_BITS + NTT_MOD_LOG2_MIN)) { a = a0 | ((dlimb_t)(a1 & base_mask1) << LIMB_BITS); } else { if (dpl > 2 * LIMB_BITS) { a2 = get_bits(taba, a_len, i * dpl + LIMB_BITS * 2) & base_mask1; } else { a1 &= base_mask1; a2 = 0; } // printf("a=0x%016lx%016lx%016lx\n", a2, a1, a0); a = (a0 >> (LIMB_BITS - NTT_MOD_LOG2_MAX + NTT_MOD_LOG2_MIN)) | ((dlimb_t)a1 << (NTT_MOD_LOG2_MAX - NTT_MOD_LOG2_MIN)) | ((dlimb_t)a2 << (LIMB_BITS + NTT_MOD_LOG2_MAX - NTT_MOD_LOG2_MIN)); a0 &= ((limb_t)1 << (LIMB_BITS - NTT_MOD_LOG2_MAX + NTT_MOD_LOG2_MIN)) - 1; } } for(j = 0; j < nb_mods; j++) { m = ntt_mods[first_m_idx + j]; m_inv = s->ntt_mods_div[first_m_idx + j]; r = mod_fast(a, m, m_inv); if (dpl > (LIMB_BITS + NTT_MOD_LOG2_MIN)) { b = ((dlimb_t)r << (LIMB_BITS - NTT_MOD_LOG2_MAX + NTT_MOD_LOG2_MIN)) | a0; r = mod_fast(b, m, m_inv); } tabr[i + j * fft_len] = int_to_ntt_limb(r, m); } } } #if defined(__AVX2__) #define VEC_LEN 4 typedef union { __m256d v; double d[4]; } VecUnion; static no_inline void ntt_to_limb(BFNTTState *s, limb_t *tabr, limb_t r_len, const NTTLimb *buf, int fft_len_log2, int dpl, int nb_mods) { const limb_t *mods = ntt_mods + NB_MODS - nb_mods; const __m256d *mods_cr_vec, *mf, *m_inv; VecUnion y[NB_MODS]; limb_t u[NB_MODS], carry[NB_MODS], fft_len, base_mask1, r; slimb_t i, len, pos; int j, k, l, shift, n_limb1, p; dlimb_t t; j = NB_MODS * (NB_MODS - 1) / 2 - nb_mods * (nb_mods - 1) / 2; mods_cr_vec = s->ntt_mods_cr_vec + j; mf = s->ntt_mods_vec + NB_MODS - nb_mods; m_inv = s->ntt_mods_inv_vec + NB_MODS - nb_mods; shift = dpl & (LIMB_BITS - 1); if (shift == 0) base_mask1 = -1; else base_mask1 = ((limb_t)1 << shift) - 1; n_limb1 = ((unsigned)dpl - 1) / LIMB_BITS; for(j = 0; j < NB_MODS; j++) carry[j] = 0; for(j = 0; j < NB_MODS; j++) u[j] = 0; /* avoid warnings */ memset(tabr, 0, sizeof(limb_t) * r_len); fft_len = (limb_t)1 << fft_len_log2; len = bf_min(fft_len, (r_len * LIMB_BITS + dpl - 1) / dpl); len = (len + VEC_LEN - 1) & ~(VEC_LEN - 1); i = 0; while (i < len) { for(j = 0; j < nb_mods; j++) y[j].v = *(__m256d *)&buf[i + fft_len * j]; /* Chinese remainder to get mixed radix representation */ l = 0; for(j = 0; j < nb_mods - 1; j++) { y[j].v = ntt_mod1(y[j].v, mf[j]); for(k = j + 1; k < nb_mods; k++) { y[k].v = ntt_mul_mod(y[k].v - y[j].v, mods_cr_vec[l], mf[k], m_inv[k]); l++; } } y[j].v = ntt_mod1(y[j].v, mf[j]); for(p = 0; p < VEC_LEN; p++) { /* back to normal representation */ u[0] = (int64_t)y[nb_mods - 1].d[p]; l = 1; for(j = nb_mods - 2; j >= 1; j--) { r = (int64_t)y[j].d[p]; for(k = 0; k < l; k++) { t = (dlimb_t)u[k] * mods[j] + r; r = t >> LIMB_BITS; u[k] = t; } u[l] = r; l++; } /* XXX: for nb_mods = 5, l should be 4 */ /* last step adds the carry */ r = (int64_t)y[0].d[p]; for(k = 0; k < l; k++) { t = (dlimb_t)u[k] * mods[j] + r + carry[k]; r = t >> LIMB_BITS; u[k] = t; } u[l] = r + carry[l]; /* write the digits */ pos = i * dpl; for(j = 0; j < n_limb1; j++) { put_bits(tabr, r_len, pos, u[j]); pos += LIMB_BITS; } put_bits(tabr, r_len, pos, u[n_limb1] & base_mask1); /* shift by dpl digits and set the carry */ if (shift == 0) { for(j = n_limb1 + 1; j < nb_mods; j++) carry[j - (n_limb1 + 1)] = u[j]; } else { for(j = n_limb1; j < nb_mods - 1; j++) { carry[j - n_limb1] = (u[j] >> shift) | (u[j + 1] << (LIMB_BITS - shift)); } carry[nb_mods - 1 - n_limb1] = u[nb_mods - 1] >> shift; } i++; } } } #else static no_inline void ntt_to_limb(BFNTTState *s, limb_t *tabr, limb_t r_len, const NTTLimb *buf, int fft_len_log2, int dpl, int nb_mods) { const limb_t *mods = ntt_mods + NB_MODS - nb_mods; const limb_t *mods_cr, *mods_cr_inv; limb_t y[NB_MODS], u[NB_MODS], carry[NB_MODS], fft_len, base_mask1, r; slimb_t i, len, pos; int j, k, l, shift, n_limb1; dlimb_t t; j = NB_MODS * (NB_MODS - 1) / 2 - nb_mods * (nb_mods - 1) / 2; mods_cr = ntt_mods_cr + j; mods_cr_inv = s->ntt_mods_cr_inv + j; shift = dpl & (LIMB_BITS - 1); if (shift == 0) base_mask1 = -1; else base_mask1 = ((limb_t)1 << shift) - 1; n_limb1 = ((unsigned)dpl - 1) / LIMB_BITS; for(j = 0; j < NB_MODS; j++) carry[j] = 0; for(j = 0; j < NB_MODS; j++) u[j] = 0; /* avoid warnings */ memset(tabr, 0, sizeof(limb_t) * r_len); fft_len = (limb_t)1 << fft_len_log2; len = bf_min(fft_len, (r_len * LIMB_BITS + dpl - 1) / dpl); for(i = 0; i < len; i++) { for(j = 0; j < nb_mods; j++) { y[j] = ntt_limb_to_int(buf[i + fft_len * j], mods[j]); } /* Chinese remainder to get mixed radix representation */ l = 0; for(j = 0; j < nb_mods - 1; j++) { for(k = j + 1; k < nb_mods; k++) { limb_t m; m = mods[k]; /* Note: there is no overflow in the sub_mod() because the modulos are sorted by increasing order */ y[k] = mul_mod_fast2(y[k] - y[j] + m, mods_cr[l], m, mods_cr_inv[l]); l++; } } /* back to normal representation */ u[0] = y[nb_mods - 1]; l = 1; for(j = nb_mods - 2; j >= 1; j--) { r = y[j]; for(k = 0; k < l; k++) { t = (dlimb_t)u[k] * mods[j] + r; r = t >> LIMB_BITS; u[k] = t; } u[l] = r; l++; } /* last step adds the carry */ r = y[0]; for(k = 0; k < l; k++) { t = (dlimb_t)u[k] * mods[j] + r + carry[k]; r = t >> LIMB_BITS; u[k] = t; } u[l] = r + carry[l]; /* write the digits */ pos = i * dpl; for(j = 0; j < n_limb1; j++) { put_bits(tabr, r_len, pos, u[j]); pos += LIMB_BITS; } put_bits(tabr, r_len, pos, u[n_limb1] & base_mask1); /* shift by dpl digits and set the carry */ if (shift == 0) { for(j = n_limb1 + 1; j < nb_mods; j++) carry[j - (n_limb1 + 1)] = u[j]; } else { for(j = n_limb1; j < nb_mods - 1; j++) { carry[j - n_limb1] = (u[j] >> shift) | (u[j + 1] << (LIMB_BITS - shift)); } carry[nb_mods - 1 - n_limb1] = u[nb_mods - 1] >> shift; } } } #endif static int ntt_static_init(bf_context_t *s1) { BFNTTState *s; int inverse, i, j, k, l; limb_t c, c_inv, c_inv2, m, m_inv; if (s1->ntt_state) return 0; #if defined(__AVX2__) s = bf_aligned_malloc(s1, sizeof(*s), 64); #else s = bf_malloc(s1, sizeof(*s)); #endif if (!s) return -1; memset(s, 0, sizeof(*s)); s1->ntt_state = s; s->ctx = s1; for(j = 0; j < NB_MODS; j++) { m = ntt_mods[j]; m_inv = init_mul_mod_fast(m); s->ntt_mods_div[j] = m_inv; #if defined(__AVX2__) s->ntt_mods_vec[j] = _mm256_set1_pd(m); s->ntt_mods_inv_vec[j] = _mm256_set1_pd(1.0 / (double)m); #endif c_inv2 = (m + 1) / 2; /* 1/2 */ c_inv = 1; for(i = 0; i <= NTT_PROOT_2EXP; i++) { s->ntt_len_inv[j][i][0] = c_inv; s->ntt_len_inv[j][i][1] = init_mul_mod_fast2(c_inv, m); c_inv = mul_mod_fast(c_inv, c_inv2, m, m_inv); } for(inverse = 0; inverse < 2; inverse++) { c = ntt_proot[inverse][j]; for(i = 0; i < NTT_PROOT_2EXP; i++) { s->ntt_proot_pow[j][inverse][NTT_PROOT_2EXP - i] = c; s->ntt_proot_pow_inv[j][inverse][NTT_PROOT_2EXP - i] = init_mul_mod_fast2(c, m); c = mul_mod_fast(c, c, m, m_inv); } } } l = 0; for(j = 0; j < NB_MODS - 1; j++) { for(k = j + 1; k < NB_MODS; k++) { #if defined(__AVX2__) s->ntt_mods_cr_vec[l] = _mm256_set1_pd(int_to_ntt_limb2(ntt_mods_cr[l], ntt_mods[k])); #else s->ntt_mods_cr_inv[l] = init_mul_mod_fast2(ntt_mods_cr[l], ntt_mods[k]); #endif l++; } } return 0; } int bf_get_fft_size(int *pdpl, int *pnb_mods, limb_t len) { int dpl, fft_len_log2, n_bits, nb_mods, dpl_found, fft_len_log2_found; int int_bits, nb_mods_found; limb_t cost, min_cost; min_cost = -1; dpl_found = 0; nb_mods_found = 4; fft_len_log2_found = 0; for(nb_mods = 3; nb_mods <= NB_MODS; nb_mods++) { int_bits = ntt_int_bits[NB_MODS - nb_mods]; dpl = bf_min((int_bits - 4) / 2, 2 * LIMB_BITS + 2 * NTT_MOD_LOG2_MIN - NTT_MOD_LOG2_MAX); for(;;) { fft_len_log2 = ceil_log2((len * LIMB_BITS + dpl - 1) / dpl); if (fft_len_log2 > NTT_PROOT_2EXP) goto next; n_bits = fft_len_log2 + 2 * dpl; if (n_bits <= int_bits) { cost = ((limb_t)(fft_len_log2 + 1) << fft_len_log2) * nb_mods; // printf("n=%d dpl=%d: cost=%" PRId64 "\n", nb_mods, dpl, (int64_t)cost); if (cost < min_cost) { min_cost = cost; dpl_found = dpl; nb_mods_found = nb_mods; fft_len_log2_found = fft_len_log2; } break; } dpl--; if (dpl == 0) break; } next: ; } if (!dpl_found) abort(); /* limit dpl if possible to reduce fixed cost of limb/NTT conversion */ if (dpl_found > (LIMB_BITS + NTT_MOD_LOG2_MIN) && ((limb_t)(LIMB_BITS + NTT_MOD_LOG2_MIN) << fft_len_log2_found) >= len * LIMB_BITS) { dpl_found = LIMB_BITS + NTT_MOD_LOG2_MIN; } *pnb_mods = nb_mods_found; *pdpl = dpl_found; return fft_len_log2_found; } /* return 0 if OK, -1 if memory error */ static no_inline int fft_mul(bf_context_t *s1, bf_t *res, limb_t *a_tab, limb_t a_len, limb_t *b_tab, limb_t b_len, int mul_flags) { BFNTTState *s; int dpl, fft_len_log2, j, nb_mods, reduced_mem; slimb_t len, fft_len; NTTLimb *buf1, *buf2, *ptr; #if defined(USE_MUL_CHECK) limb_t ha, hb, hr, h_ref; #endif if (ntt_static_init(s1)) return -1; s = s1->ntt_state; /* find the optimal number of digits per limb (dpl) */ len = a_len + b_len; fft_len_log2 = bf_get_fft_size(&dpl, &nb_mods, len); fft_len = (uint64_t)1 << fft_len_log2; // printf("len=%" PRId64 " fft_len_log2=%d dpl=%d\n", len, fft_len_log2, dpl); #if defined(USE_MUL_CHECK) ha = mp_mod1(a_tab, a_len, BF_CHKSUM_MOD, 0); hb = mp_mod1(b_tab, b_len, BF_CHKSUM_MOD, 0); #endif if ((mul_flags & (FFT_MUL_R_OVERLAP_A | FFT_MUL_R_OVERLAP_B)) == 0) { if (!(mul_flags & FFT_MUL_R_NORESIZE)) bf_resize(res, 0); } else if (mul_flags & FFT_MUL_R_OVERLAP_B) { limb_t *tmp_tab, tmp_len; /* it is better to free 'b' first */ tmp_tab = a_tab; a_tab = b_tab; b_tab = tmp_tab; tmp_len = a_len; a_len = b_len; b_len = tmp_len; } buf1 = ntt_malloc(s, sizeof(NTTLimb) * fft_len * nb_mods); if (!buf1) return -1; limb_to_ntt(s, buf1, fft_len, a_tab, a_len, dpl, NB_MODS - nb_mods, nb_mods); if ((mul_flags & (FFT_MUL_R_OVERLAP_A | FFT_MUL_R_OVERLAP_B)) == FFT_MUL_R_OVERLAP_A) { if (!(mul_flags & FFT_MUL_R_NORESIZE)) bf_resize(res, 0); } reduced_mem = (fft_len_log2 >= 14); if (!reduced_mem) { buf2 = ntt_malloc(s, sizeof(NTTLimb) * fft_len * nb_mods); if (!buf2) goto fail; limb_to_ntt(s, buf2, fft_len, b_tab, b_len, dpl, NB_MODS - nb_mods, nb_mods); if (!(mul_flags & FFT_MUL_R_NORESIZE)) bf_resize(res, 0); /* in case res == b */ } else { buf2 = ntt_malloc(s, sizeof(NTTLimb) * fft_len); if (!buf2) goto fail; } for(j = 0; j < nb_mods; j++) { if (reduced_mem) { limb_to_ntt(s, buf2, fft_len, b_tab, b_len, dpl, NB_MODS - nb_mods + j, 1); ptr = buf2; } else { ptr = buf2 + fft_len * j; } if (ntt_conv(s, buf1 + fft_len * j, ptr, fft_len_log2, fft_len_log2, j + NB_MODS - nb_mods)) goto fail; } if (!(mul_flags & FFT_MUL_R_NORESIZE)) bf_resize(res, 0); /* in case res == b and reduced mem */ ntt_free(s, buf2); buf2 = NULL; if (!(mul_flags & FFT_MUL_R_NORESIZE)) { if (bf_resize(res, len)) goto fail; } ntt_to_limb(s, res->tab, len, buf1, fft_len_log2, dpl, nb_mods); ntt_free(s, buf1); #if defined(USE_MUL_CHECK) hr = mp_mod1(res->tab, len, BF_CHKSUM_MOD, 0); h_ref = mul_mod(ha, hb, BF_CHKSUM_MOD); if (hr != h_ref) { printf("ntt_mul_error: len=%" PRId_LIMB " fft_len_log2=%d dpl=%d nb_mods=%d\n", len, fft_len_log2, dpl, nb_mods); // printf("ha=0x" FMT_LIMB" hb=0x" FMT_LIMB " hr=0x" FMT_LIMB " expected=0x" FMT_LIMB "\n", ha, hb, hr, h_ref); exit(1); } #endif return 0; fail: ntt_free(s, buf1); ntt_free(s, buf2); return -1; } #else /* USE_FFT_MUL */ int bf_get_fft_size(int *pdpl, int *pnb_mods, limb_t len) { return 0; } #endif /* !USE_FFT_MUL */ #undef malloc #undef free #undef realloc qbs-src-3.2.0/src/shared/quickjs/xsum.h0000644000175100017510000001225315154533055017360 0ustar runnerrunner/* INTERFACE TO FUNCTIONS FOR EXACT SUMMATION. */ /* Copyright 2015, 2018, 2021 Radford M. Neal Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XSUM_H #define XSUM_H #include #include #include /* CONSTANTS DEFINING THE FLOATING POINT FORMAT. */ typedef double xsum_flt; /* C floating point type sums are done for */ typedef int64_t xsum_int; /* Signed integer type for a fp value */ typedef uint64_t xsum_uint; /* Unsigned integer type for a fp value */ typedef int_fast16_t xsum_expint; /* Integer type for holding an exponent */ #define XSUM_MANTISSA_BITS 52 /* Bits in fp mantissa, excludes implict 1 */ #define XSUM_EXP_BITS 11 /* Bits in fp exponent */ #define XSUM_MANTISSA_MASK \ (((xsum_int)1 << XSUM_MANTISSA_BITS) - 1) /* Mask for mantissa bits */ #define XSUM_EXP_MASK \ ((1 << XSUM_EXP_BITS) - 1) /* Mask for exponent */ #define XSUM_EXP_BIAS \ ((1 << (XSUM_EXP_BITS-1)) - 1) /* Bias added to signed exponent */ #define XSUM_SIGN_BIT \ (XSUM_MANTISSA_BITS + XSUM_EXP_BITS) /* Position of sign bit */ #define XSUM_SIGN_MASK \ ((xsum_uint)1 << XSUM_SIGN_BIT) /* Mask for sign bit */ /* CONSTANTS DEFINING THE SMALL ACCUMULATOR FORMAT. */ #define XSUM_SCHUNK_BITS 64 /* Bits in chunk of the small accumulator */ typedef int64_t xsum_schunk; /* Integer type of small accumulator chunk */ #define XSUM_LOW_EXP_BITS 5 /* # of low bits of exponent, in one chunk */ #define XSUM_LOW_EXP_MASK \ ((1 << XSUM_LOW_EXP_BITS) - 1) /* Mask for low-order exponent bits */ #define XSUM_HIGH_EXP_BITS \ (XSUM_EXP_BITS - XSUM_LOW_EXP_BITS) /* # of high exponent bits for index */ #define XSUM_HIGH_EXP_MASK \ ((1 << HIGH_EXP_BITS) - 1) /* Mask for high-order exponent bits */ #define XSUM_SCHUNKS \ ((1 << XSUM_HIGH_EXP_BITS) + 3) /* # of chunks in small accumulator */ #define XSUM_LOW_MANTISSA_BITS \ (1 << XSUM_LOW_EXP_BITS) /* Bits in low part of mantissa */ #define XSUM_HIGH_MANTISSA_BITS \ (XSUM_MANTISSA_BITS - XSUM_LOW_MANTISSA_BITS) /* Bits in high part */ #define XSUM_LOW_MANTISSA_MASK \ (((xsum_int)1 << XSUM_LOW_MANTISSA_BITS) - 1) /* Mask for low bits */ #define XSUM_SMALL_CARRY_BITS \ ((XSUM_SCHUNK_BITS-1) - XSUM_MANTISSA_BITS) /* Bits sums can carry into */ #define XSUM_SMALL_CARRY_TERMS \ ((1 << XSUM_SMALL_CARRY_BITS) - 1) /* # terms can add before need prop. */ typedef struct { xsum_schunk chunk[XSUM_SCHUNKS]; /* Chunks making up small accumulator */ xsum_int Inf; /* If non-zero, +Inf, -Inf, or NaN */ xsum_int NaN; /* If non-zero, a NaN value with payload */ int adds_until_propagate; /* Number of remaining adds before carry */ } xsum_small_accumulator; /* propagation must be done again */ /* TYPE FOR LENGTHS OF ARRAYS. Must be a signed integer type. Set to ptrdiff_t here on the assumption that this will be big enough, but not unnecessarily big, which seems to be true. */ typedef ptrdiff_t xsum_length; /* FUNCTIONS FOR EXACT SUMMATION, WITH POSSIBLE DIVISION BY AN INTEGER. */ void xsum_small_init (xsum_small_accumulator *restrict); void xsum_small_add1 (xsum_small_accumulator *restrict, xsum_flt); void xsum_small_addv (xsum_small_accumulator *restrict, const xsum_flt *restrict, xsum_length); void xsum_small_add_sqnorm (xsum_small_accumulator *restrict, const xsum_flt *restrict, xsum_length); void xsum_small_add_dot (xsum_small_accumulator *restrict, const xsum_flt *, const xsum_flt *, xsum_length); void xsum_small_add_accumulator (xsum_small_accumulator *, xsum_small_accumulator *); void xsum_small_negate (xsum_small_accumulator *restrict); xsum_flt xsum_small_round (xsum_small_accumulator *restrict); xsum_flt xsum_small_div_unsigned (xsum_small_accumulator *restrict, unsigned); xsum_flt xsum_small_div_int (xsum_small_accumulator *restrict, int); /* DEBUG FLAG. Set to non-zero for debug ouptut. Ignored unless xsum.c is compiled with -DDEBUG. */ extern int xsum_debug; #endif qbs-src-3.2.0/src/shared/quickjs/CMakeLists.txt0000644000175100017510000000164515154533055020756 0ustar runnerrunneradd_qbs_library(qbsquickjs STATIC SOURCES builtin-array-fromasync.h cutils.c cutils.h dtoa.c dtoa.h libbf.c libbf.h libregexp-opcode.h libregexp.c libregexp.h libunicode-table.h libunicode.c libunicode.h list.h quickjs-atom.h quickjs-c-atomics.h quickjs-opcode.h quickjs.c quickjs.h DEFINES "CONFIG_VERSION=\"2021-03-27\"" ) set_property(TARGET qbsquickjs PROPERTY C_STANDARD 11) if(QBS_QUICKJS_LEAK_CHECK) add_definitions(-DDUMP_LEAKS) endif() target_include_directories( qbsquickjs SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) add_library(qbsquickjsheaders INTERFACE) target_include_directories( qbsquickjsheaders SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) if(MSVC) target_compile_options(qbsquickjs PUBLIC /wd4018 /wd4334 /wd4101 /wd4146 /wd4244 /wd4267 /wd4996) endif() qbs-src-3.2.0/src/shared/quickjs/libunicode-table.h0000644000175100017510000067254615154533055021607 0ustar runnerrunner/* Compressed unicode tables */ /* Automatically generated file - do not edit */ #include static const uint32_t case_conv_table1[378] = { 0x00209a30, 0x00309a00, 0x005a8173, 0x00601730, 0x006c0730, 0x006f81b3, 0x00701700, 0x007c0700, 0x007f8100, 0x00803040, 0x009801c3, 0x00988190, 0x00990640, 0x009c9040, 0x00a481b4, 0x00a52e40, 0x00bc0130, 0x00bc8640, 0x00bf8170, 0x00c00100, 0x00c08130, 0x00c10440, 0x00c30130, 0x00c38240, 0x00c48230, 0x00c58240, 0x00c70130, 0x00c78130, 0x00c80130, 0x00c88240, 0x00c98130, 0x00ca0130, 0x00ca8100, 0x00cb0130, 0x00cb8130, 0x00cc0240, 0x00cd0100, 0x00cd8101, 0x00ce0130, 0x00ce8130, 0x00cf0100, 0x00cf8130, 0x00d00640, 0x00d30130, 0x00d38240, 0x00d48130, 0x00d60240, 0x00d70130, 0x00d78240, 0x00d88230, 0x00d98440, 0x00db8130, 0x00dc0240, 0x00de0240, 0x00df8100, 0x00e20350, 0x00e38350, 0x00e50350, 0x00e69040, 0x00ee8100, 0x00ef1240, 0x00f801b4, 0x00f88350, 0x00fa0240, 0x00fb0130, 0x00fb8130, 0x00fc2840, 0x01100130, 0x01111240, 0x011d0131, 0x011d8240, 0x011e8130, 0x011f0131, 0x011f8201, 0x01208240, 0x01218130, 0x01220130, 0x01228130, 0x01230a40, 0x01280101, 0x01288101, 0x01290101, 0x01298100, 0x012a0100, 0x012b0200, 0x012c8100, 0x012d8100, 0x012e0101, 0x01300100, 0x01308101, 0x01318100, 0x01320101, 0x01328101, 0x01330101, 0x01340100, 0x01348100, 0x01350101, 0x01358101, 0x01360101, 0x01378100, 0x01388101, 0x01390100, 0x013a8100, 0x013e8101, 0x01400100, 0x01410101, 0x01418100, 0x01438101, 0x01440100, 0x01448100, 0x01450200, 0x01460100, 0x01490100, 0x014e8101, 0x014f0101, 0x01a28173, 0x01b80440, 0x01bb0240, 0x01bd8300, 0x01bf8130, 0x01c30130, 0x01c40330, 0x01c60130, 0x01c70230, 0x01c801d0, 0x01c89130, 0x01d18930, 0x01d60100, 0x01d68300, 0x01d801d3, 0x01d89100, 0x01e10173, 0x01e18900, 0x01e60100, 0x01e68200, 0x01e78130, 0x01e80173, 0x01e88173, 0x01ea8173, 0x01eb0173, 0x01eb8100, 0x01ec1840, 0x01f80173, 0x01f88173, 0x01f90100, 0x01f98100, 0x01fa01a0, 0x01fa8173, 0x01fb8240, 0x01fc8130, 0x01fd0240, 0x01fe8330, 0x02001030, 0x02082030, 0x02182000, 0x02281000, 0x02302240, 0x02453640, 0x02600130, 0x02608e40, 0x02678100, 0x02686040, 0x0298a630, 0x02b0a600, 0x02c381b5, 0x08502631, 0x08638131, 0x08668131, 0x08682b00, 0x087e8300, 0x09d05011, 0x09f80610, 0x09fc0620, 0x0e400174, 0x0e408174, 0x0e410174, 0x0e418174, 0x0e420174, 0x0e428174, 0x0e430174, 0x0e438180, 0x0e440180, 0x0e448240, 0x0e482b30, 0x0e5e8330, 0x0ebc8101, 0x0ebe8101, 0x0ec70101, 0x0f007e40, 0x0f3f1840, 0x0f4b01b5, 0x0f4b81b6, 0x0f4c01b6, 0x0f4c81b6, 0x0f4d01b7, 0x0f4d8180, 0x0f4f0130, 0x0f506040, 0x0f800800, 0x0f840830, 0x0f880600, 0x0f8c0630, 0x0f900800, 0x0f940830, 0x0f980800, 0x0f9c0830, 0x0fa00600, 0x0fa40630, 0x0fa801b0, 0x0fa88100, 0x0fa901d3, 0x0fa98100, 0x0faa01d3, 0x0faa8100, 0x0fab01d3, 0x0fab8100, 0x0fac8130, 0x0fad8130, 0x0fae8130, 0x0faf8130, 0x0fb00800, 0x0fb40830, 0x0fb80200, 0x0fb90400, 0x0fbb0201, 0x0fbc0201, 0x0fbd0201, 0x0fbe0201, 0x0fc008b7, 0x0fc40867, 0x0fc808b8, 0x0fcc0868, 0x0fd008b8, 0x0fd40868, 0x0fd80200, 0x0fd901b9, 0x0fd981b1, 0x0fda01b9, 0x0fdb01b1, 0x0fdb81d7, 0x0fdc0230, 0x0fdd0230, 0x0fde0161, 0x0fdf0173, 0x0fe101b9, 0x0fe181b2, 0x0fe201ba, 0x0fe301b2, 0x0fe381d8, 0x0fe40430, 0x0fe60162, 0x0fe80201, 0x0fe901d0, 0x0fe981d0, 0x0feb01b0, 0x0feb81d0, 0x0fec0230, 0x0fed0230, 0x0ff00201, 0x0ff101d3, 0x0ff181d3, 0x0ff201ba, 0x0ff28101, 0x0ff301b0, 0x0ff381d3, 0x0ff40231, 0x0ff50230, 0x0ff60131, 0x0ff901ba, 0x0ff981b2, 0x0ffa01bb, 0x0ffb01b2, 0x0ffb81d9, 0x0ffc0230, 0x0ffd0230, 0x0ffe0162, 0x109301a0, 0x109501a0, 0x109581a0, 0x10990131, 0x10a70101, 0x10b01031, 0x10b81001, 0x10c18240, 0x125b1a31, 0x12681a01, 0x16003031, 0x16183001, 0x16300240, 0x16310130, 0x16318130, 0x16320130, 0x16328100, 0x16330100, 0x16338640, 0x16368130, 0x16370130, 0x16378130, 0x16380130, 0x16390240, 0x163a8240, 0x163f0230, 0x16406440, 0x16758440, 0x16790240, 0x16802600, 0x16938100, 0x16968100, 0x53202e40, 0x53401c40, 0x53910e40, 0x53993e40, 0x53bc8440, 0x53be8130, 0x53bf0a40, 0x53c58240, 0x53c68130, 0x53c80440, 0x53ca0101, 0x53cb1440, 0x53d50130, 0x53d58130, 0x53d60130, 0x53d68130, 0x53d70130, 0x53d80130, 0x53d88130, 0x53d90130, 0x53d98131, 0x53da1040, 0x53e20131, 0x53e28130, 0x53e30130, 0x53e38440, 0x53e58130, 0x53e60240, 0x53e80240, 0x53eb0640, 0x53ee0130, 0x53fa8240, 0x55a98101, 0x55b85020, 0x7d8001b2, 0x7d8081b2, 0x7d8101b2, 0x7d8181da, 0x7d8201da, 0x7d8281b3, 0x7d8301b3, 0x7d8981bb, 0x7d8a01bb, 0x7d8a81bb, 0x7d8b01bc, 0x7d8b81bb, 0x7f909a31, 0x7fa09a01, 0x82002831, 0x82142801, 0x82582431, 0x826c2401, 0x82b80b31, 0x82be0f31, 0x82c60731, 0x82ca0231, 0x82cb8b01, 0x82d18f01, 0x82d98701, 0x82dd8201, 0x86403331, 0x86603301, 0x86a81631, 0x86b81601, 0x8c502031, 0x8c602001, 0xb7202031, 0xb7302001, 0xf4802231, 0xf4912201, }; static const uint8_t case_conv_table2[378] = { 0x01, 0x00, 0x9c, 0x06, 0x07, 0x4d, 0x03, 0x04, 0x10, 0x00, 0x8f, 0x0b, 0x00, 0x00, 0x11, 0x00, 0x08, 0x00, 0x53, 0x4b, 0x52, 0x00, 0x53, 0x00, 0x54, 0x00, 0x3b, 0x55, 0x56, 0x00, 0x58, 0x5a, 0x40, 0x5f, 0x5e, 0x00, 0x47, 0x52, 0x63, 0x65, 0x43, 0x66, 0x00, 0x68, 0x00, 0x6a, 0x00, 0x6c, 0x00, 0x6e, 0x00, 0x70, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x93, 0x00, 0x00, 0x20, 0x36, 0x00, 0x28, 0x00, 0x24, 0x00, 0x24, 0x25, 0x2d, 0x00, 0x13, 0x6d, 0x6f, 0x00, 0x29, 0x27, 0x2a, 0x14, 0x16, 0x18, 0x1b, 0x1c, 0x41, 0x1e, 0x42, 0x1f, 0x4e, 0x3c, 0x40, 0x22, 0x21, 0x44, 0x21, 0x43, 0x26, 0x28, 0x27, 0x29, 0x23, 0x2b, 0x4b, 0x2d, 0x46, 0x2f, 0x4c, 0x31, 0x4d, 0x33, 0x47, 0x45, 0x99, 0x00, 0x00, 0x97, 0x91, 0x7f, 0x80, 0x85, 0x86, 0x12, 0x82, 0x84, 0x78, 0x79, 0x12, 0x7d, 0xa3, 0x7e, 0x7a, 0x7b, 0x8c, 0x92, 0x98, 0xa6, 0xa0, 0x87, 0x00, 0x9a, 0xa1, 0x95, 0x77, 0x33, 0x95, 0x00, 0x90, 0x00, 0x76, 0x9b, 0x9a, 0x99, 0x98, 0x00, 0x00, 0xa0, 0x00, 0x9e, 0x00, 0xa3, 0xa2, 0x15, 0x31, 0x32, 0x33, 0xb7, 0xb8, 0x55, 0xac, 0xab, 0x12, 0x14, 0x1e, 0x21, 0x22, 0x22, 0x2a, 0x34, 0x35, 0x00, 0xa8, 0xa9, 0x39, 0x22, 0x4c, 0x00, 0x00, 0x97, 0x01, 0x5a, 0xda, 0x1d, 0x36, 0x05, 0x00, 0xc7, 0xc6, 0xc9, 0xc8, 0xcb, 0xca, 0xcd, 0xcc, 0xcf, 0xce, 0xc4, 0xd8, 0x45, 0xd9, 0x42, 0xda, 0x46, 0xdb, 0xd1, 0xd3, 0xd5, 0xd7, 0xdd, 0xdc, 0xf1, 0xf9, 0x01, 0x11, 0x0a, 0x12, 0x80, 0x9f, 0x00, 0x21, 0x80, 0xa3, 0xf0, 0x00, 0xc0, 0x40, 0xc6, 0x60, 0xea, 0xde, 0xe6, 0x99, 0xc0, 0x00, 0x00, 0x06, 0x60, 0xdf, 0x29, 0x00, 0x15, 0x12, 0x06, 0x16, 0xfb, 0xe0, 0x09, 0x15, 0x12, 0x84, 0x0b, 0xc6, 0x16, 0x02, 0xe2, 0x06, 0xc0, 0x40, 0x00, 0x46, 0x60, 0xe1, 0xe3, 0x6d, 0x37, 0x38, 0x39, 0x18, 0x17, 0x1a, 0x19, 0x00, 0x1d, 0x1c, 0x1f, 0x1e, 0x00, 0x61, 0xba, 0x67, 0x45, 0x48, 0x00, 0x50, 0x64, 0x4f, 0x51, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0xa7, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x5c, 0x00, 0x4a, 0x00, 0x5d, 0x57, 0x59, 0x62, 0x60, 0x72, 0x6b, 0x71, 0x54, 0x00, 0x3e, 0x69, 0xbb, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x25, 0x00, 0x48, 0xaa, 0x8a, 0x8b, 0x8c, 0xab, 0xac, 0x58, 0x58, 0xaf, 0x94, 0xb0, 0x6f, 0xb2, 0x63, 0x62, 0x65, 0x64, 0x67, 0x66, 0x6c, 0x6d, 0x6e, 0x6f, 0x68, 0x69, 0x6a, 0x6b, 0x71, 0x70, 0x73, 0x72, 0x75, 0x74, 0x77, 0x76, 0x79, 0x78, }; static const uint16_t case_conv_ext[58] = { 0x0399, 0x0308, 0x0301, 0x03a5, 0x0313, 0x0300, 0x0342, 0x0391, 0x0397, 0x03a9, 0x0046, 0x0049, 0x004c, 0x0053, 0x0069, 0x0307, 0x02bc, 0x004e, 0x004a, 0x030c, 0x0535, 0x0552, 0x0048, 0x0331, 0x0054, 0x0057, 0x030a, 0x0059, 0x0041, 0x02be, 0x1f08, 0x1f80, 0x1f28, 0x1f90, 0x1f68, 0x1fa0, 0x1fba, 0x0386, 0x1fb3, 0x1fca, 0x0389, 0x1fc3, 0x03a1, 0x1ffa, 0x038f, 0x1ff3, 0x0544, 0x0546, 0x053b, 0x054e, 0x053d, 0x03b8, 0x0462, 0xa64a, 0x1e60, 0x03c9, 0x006b, 0x00e5, }; static const uint8_t unicode_prop_Cased1_table[193] = { 0x40, 0xa9, 0x80, 0x8e, 0x80, 0xfc, 0x80, 0xd3, 0x80, 0x9b, 0x81, 0x8d, 0x02, 0x80, 0xe1, 0x80, 0x91, 0x85, 0x9a, 0x01, 0x00, 0x01, 0x11, 0x03, 0x04, 0x08, 0x01, 0x08, 0x30, 0x08, 0x01, 0x15, 0x20, 0x00, 0x39, 0x99, 0x31, 0x9d, 0x84, 0x40, 0x94, 0x80, 0xd6, 0x82, 0xa6, 0x80, 0x41, 0x62, 0x80, 0xa6, 0x80, 0x4b, 0x72, 0x80, 0x4c, 0x02, 0xf8, 0x02, 0x80, 0x8f, 0x80, 0xb0, 0x40, 0xdb, 0x08, 0x80, 0x41, 0xd0, 0x80, 0x8c, 0x80, 0x8f, 0x8c, 0xe4, 0x03, 0x01, 0x89, 0x00, 0x14, 0x28, 0x10, 0x11, 0x02, 0x01, 0x18, 0x0b, 0x24, 0x4b, 0x26, 0x01, 0x01, 0x86, 0xe5, 0x80, 0x60, 0x79, 0xb6, 0x81, 0x40, 0x91, 0x81, 0xbd, 0x88, 0x94, 0x05, 0x80, 0x98, 0x80, 0xa2, 0x00, 0x80, 0x9b, 0x12, 0x82, 0x43, 0x34, 0xa2, 0x06, 0x80, 0x8d, 0x60, 0x5c, 0x15, 0x01, 0x10, 0xa9, 0x80, 0x88, 0x60, 0xcc, 0x44, 0xd4, 0x80, 0xc6, 0x01, 0x08, 0x09, 0x0b, 0x80, 0x8b, 0x00, 0x06, 0x80, 0xc0, 0x03, 0x0f, 0x06, 0x80, 0x9b, 0x03, 0x04, 0x00, 0x16, 0x80, 0x41, 0x53, 0x81, 0x98, 0x80, 0x98, 0x80, 0x9e, 0x80, 0x98, 0x80, 0x9e, 0x80, 0x98, 0x80, 0x9e, 0x80, 0x98, 0x80, 0x9e, 0x80, 0x98, 0x07, 0x47, 0x33, 0x89, 0x80, 0x93, 0x2d, 0x41, 0x04, 0xbd, 0x50, 0xc1, 0x99, 0x85, 0x99, 0x85, 0x99, }; static const uint8_t unicode_prop_Cased1_index[18] = { 0xb9, 0x02, 0x80, 0xa0, 0x1e, 0x40, 0x9e, 0xa6, 0x40, 0xbb, 0x07, 0x01, 0xdb, 0xd6, 0x01, 0x8a, 0xf1, 0x01, }; static const uint8_t unicode_prop_Case_Ignorable_table[764] = { 0xa6, 0x05, 0x80, 0x8a, 0x80, 0xa2, 0x00, 0x80, 0xc6, 0x03, 0x00, 0x03, 0x01, 0x81, 0x41, 0xf6, 0x40, 0xbf, 0x19, 0x18, 0x88, 0x08, 0x80, 0x40, 0xfa, 0x86, 0x40, 0xce, 0x04, 0x80, 0xb0, 0xac, 0x00, 0x01, 0x01, 0x00, 0xab, 0x80, 0x8a, 0x85, 0x89, 0x8a, 0x00, 0xa2, 0x80, 0x89, 0x94, 0x8f, 0x80, 0xe4, 0x38, 0x89, 0x03, 0xa0, 0x00, 0x80, 0x9d, 0x9a, 0xda, 0x8a, 0xb9, 0x8a, 0x18, 0x08, 0x97, 0x97, 0xaa, 0x82, 0xab, 0x06, 0x0c, 0x88, 0xa8, 0xb9, 0xb6, 0x00, 0x03, 0x3b, 0x02, 0x86, 0x89, 0x81, 0x8c, 0x80, 0x8e, 0x80, 0xb9, 0x03, 0x1f, 0x80, 0x93, 0x81, 0x99, 0x01, 0x81, 0xb8, 0x03, 0x0b, 0x09, 0x12, 0x80, 0x9d, 0x0a, 0x80, 0x8a, 0x81, 0xb8, 0x03, 0x20, 0x0b, 0x80, 0x93, 0x81, 0x95, 0x28, 0x80, 0xb9, 0x01, 0x00, 0x1f, 0x06, 0x81, 0x8a, 0x81, 0x9d, 0x80, 0xbc, 0x80, 0x8b, 0x80, 0xb1, 0x02, 0x80, 0xb6, 0x00, 0x14, 0x10, 0x1e, 0x81, 0x8a, 0x81, 0x9c, 0x80, 0xb9, 0x01, 0x05, 0x04, 0x81, 0x93, 0x81, 0x9b, 0x81, 0xb8, 0x0b, 0x1f, 0x80, 0x93, 0x81, 0x9c, 0x80, 0xc7, 0x06, 0x10, 0x80, 0xd9, 0x01, 0x86, 0x8a, 0x88, 0xe1, 0x01, 0x88, 0x88, 0x00, 0x86, 0xc8, 0x81, 0x9a, 0x00, 0x00, 0x80, 0xb6, 0x8d, 0x04, 0x01, 0x84, 0x8a, 0x80, 0xa3, 0x88, 0x80, 0xe5, 0x18, 0x28, 0x09, 0x81, 0x98, 0x0b, 0x82, 0x8f, 0x83, 0x8c, 0x01, 0x0d, 0x80, 0x8e, 0x80, 0xdd, 0x80, 0x42, 0x5f, 0x82, 0x43, 0xb1, 0x82, 0x9c, 0x81, 0x9d, 0x81, 0x9d, 0x81, 0xbf, 0x08, 0x37, 0x01, 0x8a, 0x10, 0x20, 0xac, 0x84, 0xb2, 0x80, 0xc0, 0x81, 0xa1, 0x80, 0xf5, 0x13, 0x81, 0x88, 0x05, 0x82, 0x40, 0xda, 0x09, 0x80, 0xb9, 0x00, 0x30, 0x00, 0x01, 0x3d, 0x89, 0x08, 0xa6, 0x07, 0x9e, 0xb0, 0x83, 0xaf, 0x00, 0x20, 0x04, 0x80, 0xa7, 0x88, 0x8b, 0x81, 0x9f, 0x19, 0x08, 0x82, 0xb7, 0x00, 0x0a, 0x00, 0x82, 0xb9, 0x39, 0x81, 0xbf, 0x85, 0xd1, 0x10, 0x8c, 0x06, 0x18, 0x28, 0x11, 0xb1, 0xbe, 0x8c, 0x80, 0xa1, 0xe4, 0x41, 0xbc, 0x00, 0x82, 0x8a, 0x82, 0x8c, 0x82, 0x8c, 0x82, 0x8c, 0x81, 0x8b, 0x27, 0x81, 0x89, 0x01, 0x01, 0x84, 0xb0, 0x20, 0x89, 0x00, 0x8c, 0x80, 0x8f, 0x8c, 0xb2, 0xa0, 0x4b, 0x8a, 0x81, 0xf0, 0x82, 0xfc, 0x80, 0x8e, 0x80, 0xdf, 0x9f, 0xae, 0x80, 0x41, 0xd4, 0x80, 0xa3, 0x1a, 0x24, 0x80, 0xdc, 0x85, 0xdc, 0x82, 0x60, 0x6f, 0x15, 0x80, 0x44, 0xe1, 0x85, 0x41, 0x0d, 0x80, 0xe1, 0x18, 0x89, 0x00, 0x9b, 0x83, 0xcf, 0x81, 0x8d, 0xa1, 0xcd, 0x80, 0x96, 0x82, 0xe6, 0x12, 0x0f, 0x02, 0x03, 0x80, 0x98, 0x0c, 0x80, 0x40, 0x96, 0x81, 0x99, 0x91, 0x8c, 0x80, 0xa5, 0x87, 0x98, 0x8a, 0xad, 0x82, 0xaf, 0x01, 0x19, 0x81, 0x90, 0x80, 0x94, 0x81, 0xc1, 0x29, 0x09, 0x81, 0x8b, 0x07, 0x80, 0xa2, 0x80, 0x8a, 0x80, 0xb2, 0x00, 0x11, 0x0c, 0x08, 0x80, 0x9a, 0x80, 0x8d, 0x0c, 0x08, 0x80, 0xe3, 0x84, 0x88, 0x82, 0xf8, 0x01, 0x03, 0x80, 0x60, 0x4f, 0x2f, 0x80, 0x40, 0x92, 0x90, 0x42, 0x3c, 0x8f, 0x10, 0x8b, 0x8f, 0xa1, 0x01, 0x80, 0x40, 0xa8, 0x06, 0x05, 0x80, 0x8a, 0x80, 0xa2, 0x00, 0x80, 0xae, 0x80, 0xac, 0x81, 0xc2, 0x80, 0x94, 0x82, 0x42, 0x00, 0x80, 0x40, 0xe1, 0x80, 0x40, 0x94, 0x84, 0x44, 0x04, 0x28, 0xa9, 0x80, 0x88, 0x42, 0x45, 0x10, 0x0c, 0x83, 0xa7, 0x13, 0x80, 0x40, 0xa4, 0x81, 0x42, 0x3c, 0x83, 0xa5, 0x80, 0x99, 0x20, 0x80, 0x41, 0x3a, 0x81, 0xce, 0x83, 0xc5, 0x8a, 0xb0, 0x83, 0xfa, 0x80, 0xb5, 0x8e, 0xa8, 0x01, 0x81, 0x89, 0x82, 0xb0, 0x19, 0x09, 0x03, 0x80, 0x89, 0x80, 0xb1, 0x82, 0xa3, 0x20, 0x87, 0xbd, 0x80, 0x8b, 0x81, 0xb3, 0x88, 0x89, 0x19, 0x80, 0xde, 0x11, 0x00, 0x0d, 0x01, 0x80, 0x40, 0x9c, 0x02, 0x87, 0x94, 0x81, 0xb8, 0x0a, 0x80, 0xa4, 0x32, 0x84, 0xc5, 0x85, 0x8c, 0x00, 0x00, 0x80, 0x8d, 0x81, 0xd4, 0x39, 0x10, 0x80, 0x96, 0x80, 0xd3, 0x28, 0x03, 0x08, 0x81, 0x40, 0xed, 0x1d, 0x08, 0x81, 0x9a, 0x81, 0xd4, 0x39, 0x00, 0x81, 0xe9, 0x00, 0x01, 0x28, 0x80, 0xe4, 0x00, 0x01, 0x18, 0x84, 0x41, 0x02, 0x88, 0x01, 0x40, 0xff, 0x08, 0x03, 0x80, 0x40, 0x8f, 0x19, 0x0b, 0x80, 0x9f, 0x89, 0xa7, 0x29, 0x1f, 0x80, 0x88, 0x29, 0x82, 0xad, 0x8c, 0x01, 0x41, 0x95, 0x30, 0x28, 0x80, 0xd1, 0x95, 0x0e, 0x01, 0x01, 0xf9, 0x2a, 0x00, 0x08, 0x30, 0x80, 0xc7, 0x0a, 0x00, 0x80, 0x41, 0x5a, 0x81, 0x8a, 0x81, 0xb3, 0x24, 0x00, 0x80, 0x96, 0x80, 0x54, 0xd4, 0x90, 0x85, 0x8e, 0x60, 0x2c, 0xc7, 0x8b, 0x12, 0x49, 0xbf, 0x84, 0xba, 0x86, 0x88, 0x83, 0x41, 0xfb, 0x82, 0xa7, 0x81, 0x41, 0xe1, 0x80, 0xbe, 0x90, 0xbf, 0x08, 0x81, 0x60, 0x40, 0x0a, 0x18, 0x30, 0x81, 0x4c, 0x9d, 0x08, 0x83, 0x52, 0x5b, 0xad, 0x81, 0x96, 0x42, 0x1f, 0x82, 0x88, 0x8f, 0x0e, 0x9d, 0x83, 0x40, 0x93, 0x82, 0x47, 0xba, 0xb6, 0x83, 0xb1, 0x38, 0x8d, 0x80, 0x95, 0x20, 0x8e, 0x45, 0x4f, 0x30, 0x90, 0x0e, 0x01, 0x04, 0x84, 0xbd, 0xa0, 0x80, 0x40, 0x9f, 0x8d, 0x41, 0x6f, 0x80, 0xbc, 0x83, 0x41, 0xfa, 0x84, 0x40, 0xfd, 0x81, 0x42, 0xdf, 0x86, 0xec, 0x87, 0x4a, 0xae, 0x84, 0x6c, 0x0c, 0x00, 0x80, 0x9d, 0xdf, 0xff, 0x40, 0xef, }; static const uint8_t unicode_prop_Case_Ignorable_index[72] = { 0xbe, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x52, 0x0a, 0xa0, 0xc1, 0x0b, 0x00, 0x82, 0x0d, 0x00, 0x3f, 0x10, 0x80, 0xd4, 0x17, 0x40, 0xcf, 0x1a, 0x20, 0xf5, 0x1c, 0x00, 0x80, 0x20, 0x00, 0x16, 0xa0, 0x00, 0xc6, 0xa8, 0x00, 0xc2, 0xaa, 0x60, 0x56, 0xfe, 0x20, 0xb1, 0x07, 0x01, 0x02, 0x10, 0x01, 0x42, 0x12, 0x41, 0xc4, 0x14, 0x21, 0xe1, 0x19, 0x81, 0x48, 0x1d, 0x01, 0x44, 0x6b, 0x01, 0x83, 0xd1, 0x21, 0x3e, 0xe1, 0x01, 0xf0, 0x01, 0x0e, }; static const uint8_t unicode_prop_ID_Start_table[1133] = { 0xc0, 0x99, 0x85, 0x99, 0xae, 0x80, 0x89, 0x03, 0x04, 0x96, 0x80, 0x9e, 0x80, 0x41, 0xc9, 0x83, 0x8b, 0x8d, 0x26, 0x00, 0x80, 0x40, 0x80, 0x20, 0x09, 0x18, 0x05, 0x00, 0x10, 0x00, 0x93, 0x80, 0xd2, 0x80, 0x40, 0x8a, 0x87, 0x40, 0xa5, 0x80, 0xa5, 0x08, 0x85, 0xa8, 0xc6, 0x9a, 0x1b, 0xac, 0xaa, 0xa2, 0x08, 0xe2, 0x00, 0x8e, 0x0e, 0x81, 0x89, 0x11, 0x80, 0x8f, 0x00, 0x9d, 0x9c, 0xd8, 0x8a, 0x80, 0x97, 0xa0, 0x88, 0x0b, 0x04, 0x95, 0x18, 0x88, 0x02, 0x80, 0x96, 0x98, 0x86, 0x8a, 0x84, 0x97, 0x05, 0x90, 0xa9, 0xb9, 0xb5, 0x10, 0x91, 0x06, 0x89, 0x8e, 0x8f, 0x1f, 0x09, 0x81, 0x95, 0x06, 0x00, 0x13, 0x10, 0x8f, 0x80, 0x8c, 0x08, 0x82, 0x8d, 0x81, 0x89, 0x07, 0x2b, 0x09, 0x95, 0x06, 0x01, 0x01, 0x01, 0x9e, 0x18, 0x80, 0x92, 0x82, 0x8f, 0x88, 0x02, 0x80, 0x95, 0x06, 0x01, 0x04, 0x10, 0x91, 0x80, 0x8e, 0x81, 0x96, 0x80, 0x8a, 0x39, 0x09, 0x95, 0x06, 0x01, 0x04, 0x10, 0x9d, 0x08, 0x82, 0x8e, 0x80, 0x90, 0x00, 0x2a, 0x10, 0x1a, 0x08, 0x00, 0x0a, 0x0a, 0x12, 0x8b, 0x95, 0x80, 0xb3, 0x38, 0x10, 0x96, 0x80, 0x8f, 0x10, 0x99, 0x11, 0x01, 0x81, 0x9d, 0x03, 0x38, 0x10, 0x96, 0x80, 0x89, 0x04, 0x10, 0x9e, 0x08, 0x81, 0x8e, 0x81, 0x90, 0x88, 0x02, 0x80, 0xa8, 0x08, 0x8f, 0x04, 0x17, 0x82, 0x97, 0x2c, 0x91, 0x82, 0x97, 0x80, 0x88, 0x00, 0x0e, 0xb9, 0xaf, 0x01, 0x8b, 0x86, 0xb9, 0x08, 0x00, 0x20, 0x97, 0x00, 0x80, 0x89, 0x01, 0x88, 0x01, 0x20, 0x80, 0x94, 0x83, 0x9f, 0x80, 0xbe, 0x38, 0xa3, 0x9a, 0x84, 0xf2, 0xaa, 0x93, 0x80, 0x8f, 0x2b, 0x1a, 0x02, 0x0e, 0x13, 0x8c, 0x8b, 0x80, 0x90, 0xa5, 0x00, 0x20, 0x81, 0xaa, 0x80, 0x41, 0x4c, 0x03, 0x0e, 0x00, 0x03, 0x81, 0xa8, 0x03, 0x81, 0xa0, 0x03, 0x0e, 0x00, 0x03, 0x81, 0x8e, 0x80, 0xb8, 0x03, 0x81, 0xc2, 0xa4, 0x8f, 0x8f, 0xd5, 0x0d, 0x82, 0x42, 0x6b, 0x81, 0x90, 0x80, 0x99, 0x84, 0xca, 0x82, 0x8a, 0x86, 0x91, 0x8c, 0x92, 0x8d, 0x91, 0x8d, 0x8c, 0x02, 0x8e, 0xb3, 0xa2, 0x03, 0x80, 0xc2, 0xd8, 0x86, 0xa8, 0x00, 0x84, 0xc5, 0x89, 0x9e, 0xb0, 0x9d, 0x0c, 0x8a, 0xab, 0x83, 0x99, 0xb5, 0x96, 0x88, 0xb4, 0xd1, 0x80, 0xdc, 0xae, 0x90, 0x87, 0xb5, 0x9d, 0x8c, 0x81, 0x89, 0xab, 0x99, 0xa3, 0xa8, 0x82, 0x89, 0xa3, 0x81, 0x8a, 0x84, 0xaa, 0x0a, 0xa8, 0x18, 0x28, 0x0a, 0x04, 0x40, 0xbf, 0xbf, 0x41, 0x15, 0x0d, 0x81, 0xa5, 0x0d, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x9e, 0x81, 0xb4, 0x06, 0x00, 0x12, 0x06, 0x13, 0x0d, 0x83, 0x8c, 0x22, 0x06, 0xf3, 0x80, 0x8c, 0x80, 0x8f, 0x8c, 0xe4, 0x03, 0x01, 0x89, 0x00, 0x0d, 0x28, 0x00, 0x00, 0x80, 0x8f, 0x0b, 0x24, 0x18, 0x90, 0xa8, 0x4a, 0x76, 0x40, 0xe4, 0x2b, 0x11, 0x8b, 0xa5, 0x00, 0x20, 0x81, 0xb7, 0x30, 0x8f, 0x96, 0x88, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x86, 0x42, 0x25, 0x82, 0x98, 0x88, 0x34, 0x0c, 0x83, 0xd5, 0x1c, 0x80, 0xd9, 0x03, 0x84, 0xaa, 0x80, 0xdd, 0x90, 0x9f, 0xaf, 0x8f, 0x41, 0xff, 0x59, 0xbf, 0xbf, 0x60, 0x56, 0x8c, 0xc2, 0xad, 0x81, 0x41, 0x0c, 0x82, 0x8f, 0x89, 0x81, 0x93, 0xae, 0x8f, 0x9e, 0x81, 0xcf, 0xa6, 0x88, 0x81, 0xe6, 0x81, 0xc2, 0x09, 0x00, 0x07, 0x94, 0x8f, 0x02, 0x03, 0x80, 0x96, 0x9c, 0xb3, 0x8d, 0xb1, 0xbd, 0x2a, 0x00, 0x81, 0x8a, 0x9b, 0x89, 0x96, 0x98, 0x9c, 0x86, 0xae, 0x9b, 0x80, 0x8f, 0x20, 0x89, 0x89, 0x20, 0xa8, 0x96, 0x10, 0x87, 0x93, 0x96, 0x10, 0x82, 0xb1, 0x00, 0x11, 0x0c, 0x08, 0x00, 0x97, 0x11, 0x8a, 0x32, 0x8b, 0x29, 0x29, 0x85, 0x88, 0x30, 0x30, 0xaa, 0x80, 0x8d, 0x85, 0xf2, 0x9c, 0x60, 0x2b, 0xa3, 0x8b, 0x96, 0x83, 0xb0, 0x60, 0x21, 0x03, 0x41, 0x6d, 0x81, 0xe9, 0xa5, 0x86, 0x8b, 0x24, 0x00, 0x89, 0x80, 0x8c, 0x04, 0x00, 0x01, 0x01, 0x80, 0xeb, 0xa0, 0x41, 0x6a, 0x91, 0xbf, 0x81, 0xb5, 0xa7, 0x8b, 0xf3, 0x20, 0x40, 0x86, 0xa3, 0x99, 0x85, 0x99, 0x8a, 0xd8, 0x15, 0x0d, 0x0d, 0x0a, 0xa2, 0x8b, 0x80, 0x99, 0x80, 0x92, 0x01, 0x80, 0x8e, 0x81, 0x8d, 0xa1, 0xfa, 0xc4, 0xb4, 0x41, 0x0a, 0x9c, 0x82, 0xb0, 0xae, 0x9f, 0x8c, 0x9d, 0x84, 0xa5, 0x89, 0x9d, 0x81, 0xa3, 0x1f, 0x04, 0xa9, 0x40, 0x9d, 0x91, 0xa3, 0x83, 0xa3, 0x83, 0xa7, 0x87, 0xb3, 0x8b, 0x8a, 0x80, 0x8e, 0x06, 0x01, 0x80, 0x8a, 0x80, 0x8e, 0x06, 0x01, 0x82, 0xb3, 0x8b, 0x41, 0x36, 0x88, 0x95, 0x89, 0x87, 0x97, 0x28, 0xa9, 0x80, 0x88, 0xc4, 0x29, 0x00, 0xab, 0x01, 0x10, 0x81, 0x96, 0x89, 0x96, 0x88, 0x9e, 0xc0, 0x92, 0x01, 0x89, 0x95, 0x89, 0x99, 0xc5, 0xb7, 0x29, 0xbf, 0x80, 0x8e, 0x18, 0x10, 0x9c, 0xa9, 0x9c, 0x82, 0x9c, 0xa2, 0x38, 0x9b, 0x9a, 0xb5, 0x89, 0x95, 0x89, 0x92, 0x8c, 0x91, 0xed, 0xc8, 0xb6, 0xb2, 0x8c, 0xb2, 0x8c, 0xa3, 0xa5, 0x9b, 0x88, 0x96, 0x40, 0xf9, 0xa9, 0x29, 0x8f, 0x82, 0xba, 0x9c, 0x89, 0x07, 0x95, 0xa9, 0x91, 0xad, 0x94, 0x9a, 0x96, 0x8b, 0xb4, 0xb8, 0x09, 0x80, 0x8c, 0xac, 0x9f, 0x98, 0x99, 0xa3, 0x9c, 0x01, 0x07, 0xa2, 0x10, 0x8b, 0xaf, 0x8d, 0x83, 0x94, 0x00, 0x80, 0xa2, 0x91, 0x80, 0x98, 0x92, 0x81, 0xbe, 0x30, 0x00, 0x18, 0x8e, 0x80, 0x89, 0x86, 0xae, 0xa5, 0x39, 0x09, 0x95, 0x06, 0x01, 0x04, 0x10, 0x91, 0x80, 0x8b, 0x84, 0x9d, 0x89, 0x00, 0x08, 0x80, 0xa5, 0x00, 0x98, 0x00, 0x80, 0xab, 0xb4, 0x91, 0x83, 0x93, 0x82, 0x9d, 0xaf, 0x93, 0x08, 0x80, 0x40, 0xb7, 0xae, 0xa8, 0x83, 0xa3, 0xaf, 0x93, 0x80, 0xba, 0xaa, 0x8c, 0x80, 0xc6, 0x9a, 0xa4, 0x86, 0x40, 0xb8, 0xab, 0xf3, 0xbf, 0x9e, 0x39, 0x01, 0x38, 0x08, 0x97, 0x8e, 0x00, 0x80, 0xdd, 0x39, 0xa6, 0x8f, 0x00, 0x80, 0x9b, 0x80, 0x89, 0xa7, 0x30, 0x94, 0x80, 0x8a, 0xad, 0x92, 0x80, 0x91, 0xc8, 0x40, 0xc6, 0xa0, 0x9e, 0x88, 0x80, 0xa4, 0x90, 0x80, 0xb0, 0x9d, 0xef, 0x30, 0x08, 0xa5, 0x94, 0x80, 0x98, 0x28, 0x08, 0x9f, 0x8d, 0x80, 0x41, 0x46, 0x92, 0x8e, 0x00, 0x8c, 0x80, 0xa1, 0xfb, 0x80, 0xce, 0x43, 0x99, 0xe5, 0xee, 0x90, 0x40, 0xc3, 0x4a, 0x4b, 0xe0, 0x8e, 0x44, 0x2f, 0x90, 0x85, 0x98, 0x4f, 0x9a, 0x84, 0x42, 0x46, 0x5a, 0xb8, 0x9d, 0x46, 0xe1, 0x42, 0x38, 0x86, 0x9e, 0x90, 0xce, 0x90, 0x9d, 0x91, 0xaf, 0x8f, 0x83, 0x9e, 0x94, 0x84, 0x92, 0x41, 0xaf, 0xac, 0x40, 0xd2, 0xbf, 0xff, 0xca, 0x20, 0xc1, 0x8c, 0xbf, 0x08, 0x80, 0x9b, 0x57, 0xf7, 0x87, 0x44, 0xd5, 0xa8, 0x89, 0x60, 0x22, 0xe6, 0x18, 0x30, 0x08, 0x41, 0x22, 0x8e, 0x80, 0x9c, 0x11, 0x80, 0x8d, 0x1f, 0x41, 0x8b, 0x49, 0x03, 0xea, 0x84, 0x8c, 0x82, 0x88, 0x86, 0x89, 0x57, 0x65, 0xd4, 0x80, 0xc6, 0x01, 0x08, 0x09, 0x0b, 0x80, 0x8b, 0x00, 0x06, 0x80, 0xc0, 0x03, 0x0f, 0x06, 0x80, 0x9b, 0x03, 0x04, 0x00, 0x16, 0x80, 0x41, 0x53, 0x81, 0x98, 0x80, 0x98, 0x80, 0x9e, 0x80, 0x98, 0x80, 0x9e, 0x80, 0x98, 0x80, 0x9e, 0x80, 0x98, 0x80, 0x9e, 0x80, 0x98, 0x07, 0x47, 0x33, 0x9e, 0x2d, 0x41, 0x04, 0xbd, 0x40, 0x91, 0xac, 0x89, 0x86, 0x8f, 0x80, 0x41, 0x40, 0x9d, 0x91, 0xab, 0x41, 0xe3, 0x9b, 0x40, 0xe3, 0x9d, 0x08, 0x41, 0xee, 0x30, 0x18, 0x08, 0x8e, 0x80, 0x40, 0xc4, 0xba, 0xc3, 0x30, 0x44, 0xb3, 0x18, 0x9a, 0x01, 0x00, 0x08, 0x80, 0x89, 0x03, 0x00, 0x00, 0x28, 0x18, 0x00, 0x00, 0x02, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x06, 0x03, 0x03, 0x00, 0x80, 0x89, 0x80, 0x90, 0x22, 0x04, 0x80, 0x90, 0x51, 0x43, 0x60, 0xa6, 0xdf, 0x9f, 0x50, 0x39, 0x85, 0x40, 0xdd, 0x81, 0x56, 0x81, 0x8d, 0x5d, 0x30, 0x8e, 0x42, 0x6d, 0x49, 0xa1, 0x42, 0x1d, 0x45, 0xe1, 0x53, 0x4a, 0x84, 0x50, 0x5f, }; static const uint8_t unicode_prop_ID_Start_index[108] = { 0xf6, 0x03, 0x20, 0xa6, 0x07, 0x00, 0xa9, 0x09, 0x20, 0xb1, 0x0a, 0x00, 0xba, 0x0b, 0x20, 0x3b, 0x0d, 0x20, 0xc7, 0x0e, 0x20, 0x49, 0x12, 0x00, 0x9b, 0x16, 0x00, 0xac, 0x19, 0x00, 0xc0, 0x1d, 0x80, 0x80, 0x20, 0x20, 0x70, 0x2d, 0x00, 0x00, 0x32, 0x00, 0xdd, 0xa7, 0x00, 0x4c, 0xaa, 0x20, 0xc7, 0xd7, 0x20, 0xfc, 0xfd, 0x20, 0x9d, 0x02, 0x21, 0x96, 0x05, 0x01, 0x9f, 0x08, 0x01, 0x49, 0x0c, 0x21, 0x76, 0x10, 0x21, 0xa9, 0x12, 0x01, 0xb0, 0x14, 0x01, 0x42, 0x19, 0x41, 0x90, 0x1c, 0x01, 0xf1, 0x2f, 0x21, 0x90, 0x6b, 0x21, 0x33, 0xb1, 0x21, 0x06, 0xd5, 0x01, 0xc3, 0xd7, 0x01, 0xff, 0xe7, 0x21, 0x63, 0xee, 0x01, 0x5e, 0xee, 0x42, 0xb0, 0x23, 0x03, }; static const uint8_t unicode_prop_ID_Continue1_table[695] = { 0xaf, 0x89, 0xa4, 0x80, 0xd6, 0x80, 0x42, 0x47, 0xef, 0x96, 0x80, 0x40, 0xfa, 0x84, 0x41, 0x08, 0xac, 0x00, 0x01, 0x01, 0x00, 0xc7, 0x8a, 0xaf, 0x9e, 0x28, 0xe4, 0x31, 0x29, 0x08, 0x19, 0x89, 0x96, 0x80, 0x9d, 0x9a, 0xda, 0x8a, 0x8e, 0x89, 0xa0, 0x88, 0x88, 0x80, 0x97, 0x18, 0x88, 0x02, 0x04, 0xaa, 0x82, 0xba, 0x88, 0xa9, 0x97, 0x80, 0xa0, 0xb5, 0x10, 0x91, 0x06, 0x89, 0x09, 0x89, 0x90, 0x82, 0xb7, 0x00, 0x31, 0x09, 0x82, 0x88, 0x80, 0x89, 0x09, 0x89, 0x8d, 0x01, 0x82, 0xb7, 0x00, 0x23, 0x09, 0x12, 0x80, 0x93, 0x8b, 0x10, 0x8a, 0x82, 0xb7, 0x00, 0x38, 0x10, 0x82, 0x93, 0x09, 0x89, 0x89, 0x28, 0x82, 0xb7, 0x00, 0x31, 0x09, 0x16, 0x82, 0x89, 0x09, 0x89, 0x91, 0x80, 0xba, 0x22, 0x10, 0x83, 0x88, 0x80, 0x8d, 0x89, 0x8f, 0x84, 0xb6, 0x00, 0x30, 0x10, 0x1e, 0x81, 0x8a, 0x09, 0x89, 0x90, 0x82, 0xb7, 0x00, 0x30, 0x10, 0x1e, 0x81, 0x8a, 0x09, 0x89, 0x10, 0x8b, 0x83, 0xb6, 0x08, 0x30, 0x10, 0x83, 0x88, 0x80, 0x89, 0x09, 0x89, 0x90, 0x82, 0xc5, 0x03, 0x28, 0x00, 0x3d, 0x89, 0x09, 0xbc, 0x01, 0x86, 0x8b, 0x38, 0x89, 0xd6, 0x01, 0x88, 0x8a, 0x30, 0x89, 0xbd, 0x0d, 0x89, 0x8a, 0x00, 0x00, 0x03, 0x81, 0xb0, 0x93, 0x01, 0x84, 0x8a, 0x80, 0xa3, 0x88, 0x80, 0xe3, 0x93, 0x80, 0x89, 0x8b, 0x1b, 0x10, 0x11, 0x32, 0x83, 0x8c, 0x8b, 0x80, 0x8e, 0x42, 0xbe, 0x82, 0x88, 0x88, 0x43, 0x9f, 0x83, 0x9b, 0x82, 0x9c, 0x81, 0x9d, 0x81, 0xbf, 0x9f, 0x88, 0x01, 0x89, 0xa0, 0x10, 0x8a, 0x40, 0x8e, 0x80, 0xf5, 0x8b, 0x83, 0x8b, 0x89, 0x89, 0xff, 0x8a, 0xbb, 0x84, 0xb8, 0x89, 0x80, 0x9c, 0x81, 0x8a, 0x85, 0x89, 0x95, 0x8d, 0x80, 0x8f, 0xb0, 0x84, 0xae, 0x90, 0x8a, 0x89, 0x90, 0x88, 0x8b, 0x82, 0x9d, 0x8c, 0x81, 0x89, 0xab, 0x8d, 0xaf, 0x93, 0x87, 0x89, 0x85, 0x89, 0xf5, 0x10, 0x94, 0x18, 0x28, 0x0a, 0x40, 0xc5, 0xbf, 0x42, 0x0b, 0x81, 0xb0, 0x81, 0x92, 0x80, 0xfa, 0x8c, 0x18, 0x82, 0x8b, 0x4b, 0xfd, 0x82, 0x40, 0x8c, 0x80, 0xdf, 0x9f, 0x42, 0x29, 0x85, 0xe8, 0x81, 0xdf, 0x80, 0x60, 0x75, 0x23, 0x89, 0xc4, 0x03, 0x89, 0x9f, 0x81, 0xcf, 0x81, 0x41, 0x0f, 0x02, 0x03, 0x80, 0x96, 0x23, 0x80, 0xd2, 0x81, 0xb1, 0x91, 0x89, 0x89, 0x85, 0x91, 0x8c, 0x8a, 0x9b, 0x87, 0x98, 0x8c, 0xab, 0x83, 0xae, 0x8d, 0x8e, 0x89, 0x8a, 0x80, 0x89, 0x89, 0xae, 0x8d, 0x8b, 0x07, 0x09, 0x89, 0xa0, 0x82, 0xb1, 0x00, 0x11, 0x0c, 0x08, 0x80, 0xa8, 0x24, 0x81, 0x40, 0xeb, 0x38, 0x09, 0x89, 0x60, 0x4f, 0x23, 0x80, 0x42, 0xe0, 0x8f, 0x8f, 0x8f, 0x11, 0x97, 0x82, 0x40, 0xbf, 0x89, 0xa4, 0x80, 0xa4, 0x80, 0x42, 0x96, 0x80, 0x40, 0xe1, 0x80, 0x40, 0x94, 0x84, 0x41, 0x24, 0x89, 0x45, 0x56, 0x10, 0x0c, 0x83, 0xa7, 0x13, 0x80, 0x40, 0xa4, 0x81, 0x42, 0x3c, 0x1f, 0x89, 0x85, 0x89, 0x9e, 0x84, 0x41, 0x3c, 0x81, 0xce, 0x83, 0xc5, 0x8a, 0xb0, 0x83, 0xf9, 0x82, 0xb4, 0x8e, 0x9e, 0x8a, 0x09, 0x89, 0x83, 0xac, 0x8a, 0x30, 0xac, 0x89, 0x2a, 0xa3, 0x8d, 0x80, 0x89, 0x21, 0xab, 0x80, 0x8b, 0x82, 0xaf, 0x8d, 0x3b, 0x80, 0x8b, 0xd1, 0x8b, 0x28, 0x08, 0x40, 0x9c, 0x8b, 0x84, 0x89, 0x2b, 0xb6, 0x08, 0x31, 0x09, 0x82, 0x88, 0x80, 0x89, 0x09, 0x32, 0x84, 0xc2, 0x88, 0x00, 0x08, 0x03, 0x04, 0x00, 0x8d, 0x81, 0xd1, 0x91, 0x88, 0x89, 0x18, 0xd0, 0x93, 0x8b, 0x89, 0x40, 0xd4, 0x31, 0x88, 0x9a, 0x81, 0xd1, 0x90, 0x8e, 0x89, 0xd0, 0x8c, 0x87, 0x89, 0x85, 0x93, 0xb8, 0x8e, 0x83, 0x89, 0x40, 0xf1, 0x8e, 0x40, 0xa4, 0x89, 0xc5, 0x28, 0x09, 0x18, 0x00, 0x81, 0x8b, 0x89, 0xf6, 0x31, 0x32, 0x80, 0x9b, 0x89, 0xa7, 0x30, 0x1f, 0x80, 0x88, 0x8a, 0xad, 0x8f, 0x41, 0x55, 0x89, 0xb4, 0x38, 0x87, 0x8f, 0x89, 0xb7, 0x95, 0x80, 0x8d, 0xf9, 0x2a, 0x00, 0x08, 0x30, 0x07, 0x89, 0xaf, 0x20, 0x08, 0x27, 0x89, 0x41, 0x48, 0x83, 0x88, 0x08, 0x80, 0xaf, 0x32, 0x84, 0x8c, 0x8a, 0x54, 0xe4, 0x05, 0x8e, 0x60, 0x2c, 0xc7, 0x9b, 0x49, 0x25, 0x89, 0xd5, 0x89, 0xa5, 0x84, 0xba, 0x86, 0x98, 0x89, 0x42, 0x15, 0x89, 0x41, 0xd4, 0x00, 0xb6, 0x33, 0xd0, 0x80, 0x8a, 0x81, 0x60, 0x4c, 0xaa, 0x81, 0x50, 0x50, 0x89, 0x42, 0x05, 0xad, 0x81, 0x96, 0x42, 0x1d, 0x22, 0x2f, 0x39, 0x86, 0x9d, 0x83, 0x40, 0x93, 0x82, 0x45, 0x88, 0xb1, 0x41, 0xff, 0xb6, 0x83, 0xb1, 0x38, 0x8d, 0x80, 0x95, 0x20, 0x8e, 0x45, 0x4f, 0x30, 0x90, 0x0e, 0x01, 0x04, 0xe3, 0x80, 0x40, 0x9f, 0x86, 0x88, 0x89, 0x41, 0x63, 0x80, 0xbc, 0x8d, 0x41, 0xf1, 0x8d, 0x40, 0xf3, 0x08, 0x89, 0x42, 0xd4, 0x86, 0xec, 0x34, 0x89, 0x52, 0x95, 0x89, 0x6c, 0x05, 0x05, 0x40, 0xef, }; static const uint8_t unicode_prop_ID_Continue1_index[66] = { 0xfa, 0x06, 0x00, 0x70, 0x09, 0x00, 0xf0, 0x0a, 0x40, 0x57, 0x0c, 0x00, 0xf0, 0x0d, 0x60, 0xc7, 0x0f, 0x20, 0xea, 0x17, 0x40, 0x05, 0x1b, 0x00, 0x0e, 0x20, 0x00, 0xa0, 0xa6, 0x20, 0xe6, 0xa9, 0x20, 0x10, 0xfe, 0x00, 0x40, 0x0a, 0x01, 0xc3, 0x10, 0x01, 0x4e, 0x13, 0x01, 0x41, 0x16, 0x01, 0x0b, 0x1a, 0x01, 0xaa, 0x1d, 0x01, 0x7a, 0x6d, 0x21, 0x45, 0xd2, 0x21, 0xaf, 0xe2, 0x01, 0xf0, 0x01, 0x0e, }; static const uint8_t unicode_prop_White_Space_table[22] = { 0x88, 0x84, 0x91, 0x80, 0xe3, 0x80, 0x99, 0x80, 0x55, 0xde, 0x80, 0x49, 0x7e, 0x8a, 0x9c, 0x0c, 0x80, 0xae, 0x80, 0x4f, 0x9f, 0x80, }; static const uint8_t unicode_prop_White_Space_index[3] = { 0x01, 0x30, 0x00, }; static const uint8_t unicode_cc_table[916] = { 0xb2, 0xcf, 0xd4, 0x00, 0xe8, 0x03, 0xdc, 0x00, 0xe8, 0x00, 0xd8, 0x04, 0xdc, 0x01, 0xca, 0x03, 0xdc, 0x01, 0xca, 0x0a, 0xdc, 0x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 0x09, 0xb0, 0x45, 0x00, 0x09, 0x00, 0x07, 0xb0, 0x42, 0x00, 0x09, 0xb0, 0xdc, 0x00, 0x09, 0x00, 0x07, 0xb0, 0xd1, 0x01, 0x09, 0x83, 0x00, 0x07, 0xb0, 0x6b, 0x00, 0x09, 0xb0, 0x22, 0x00, 0x09, 0x91, 0x00, 0x09, 0xb0, 0x20, 0x00, 0x09, 0xb1, 0x74, 0x00, 0x09, 0xb0, 0xd1, 0x00, 0x07, 0x80, 0x01, 0x09, 0xb0, 0x20, 0x00, 0x09, 0xb1, 0x78, 0x01, 0x09, 0xb8, 0x39, 0xbb, 0x00, 0x09, 0xb8, 0x01, 0x8f, 0x04, 0x01, 0xb0, 0x0a, 0xc6, 0xb4, 0x88, 0x01, 0x06, 0xb8, 0x44, 0x7b, 0x00, 0x01, 0xb8, 0x0c, 0x95, 0x01, 0xd8, 0x02, 0x01, 0x82, 0x00, 0xe2, 0x04, 0xd8, 0x87, 0x07, 0xdc, 0x81, 0xc4, 0x01, 0xdc, 0x9d, 0xc3, 0xb0, 0x63, 0xc2, 0xb8, 0x05, 0x8a, 0xc6, 0x80, 0xd0, 0x81, 0xc6, 0x80, 0xc1, 0x80, 0xc4, 0xb0, 0x33, 0xc0, 0xb0, 0x6f, 0xc6, 0xb1, 0x46, 0xc0, 0xb0, 0x0c, 0xc3, 0xb1, 0xcb, 0x01, 0xe8, 0x00, 0xdc, 0xc0, 0xb0, 0xcd, 0xc0, 0x00, 0xdc, 0xb2, 0xaf, 0x06, 0xdc, 0xb0, 0x3c, 0xc5, 0x00, 0x07, }; static const uint8_t unicode_cc_index[87] = { 0x4d, 0x03, 0x00, 0x97, 0x05, 0x20, 0xc6, 0x05, 0x00, 0xe7, 0x06, 0x00, 0x45, 0x07, 0x00, 0x9c, 0x08, 0x00, 0x4d, 0x09, 0x00, 0x3c, 0x0b, 0x00, 0x3d, 0x0d, 0x00, 0x36, 0x0f, 0x00, 0x38, 0x10, 0x20, 0x3a, 0x19, 0x00, 0xcb, 0x1a, 0x20, 0xd3, 0x1c, 0x00, 0xcf, 0x1d, 0x00, 0xe2, 0x20, 0x00, 0x2e, 0x30, 0x20, 0x2b, 0xa9, 0x20, 0xed, 0xab, 0x00, 0x39, 0x0a, 0x01, 0x4c, 0x0f, 0x01, 0x35, 0x11, 0x21, 0x66, 0x13, 0x01, 0x40, 0x16, 0x01, 0x47, 0x1a, 0x01, 0xf0, 0x6a, 0x21, 0x8a, 0xd1, 0x01, 0xec, 0xe4, 0x21, 0x4b, 0xe9, 0x01, }; static const uint32_t unicode_decomp_table1[709] = { 0x00280081, 0x002a0097, 0x002a8081, 0x002bc097, 0x002c8115, 0x002d0097, 0x002d4081, 0x002e0097, 0x002e4115, 0x002f0199, 0x00302016, 0x00400842, 0x00448a42, 0x004a0442, 0x004c0096, 0x004c8117, 0x004d0242, 0x004e4342, 0x004fc12f, 0x0050c342, 0x005240bf, 0x00530342, 0x00550942, 0x005a0842, 0x005e0096, 0x005e4342, 0x005fc081, 0x00680142, 0x006bc142, 0x00710185, 0x0071c317, 0x00734844, 0x00778344, 0x00798342, 0x007b02be, 0x007c4197, 0x007d0142, 0x007e0444, 0x00800e42, 0x00878142, 0x00898744, 0x00ac0483, 0x00b60317, 0x00b80283, 0x00d00214, 0x00d10096, 0x00dd0080, 0x00de8097, 0x00df8080, 0x00e10097, 0x00e1413e, 0x00e1c080, 0x00e204be, 0x00ea83ae, 0x00f282ae, 0x00f401ad, 0x00f4c12e, 0x00f54103, 0x00fc0303, 0x00fe4081, 0x0100023e, 0x0101c0be, 0x010301be, 0x010640be, 0x010e40be, 0x0114023e, 0x0115c0be, 0x011701be, 0x011d8144, 0x01304144, 0x01340244, 0x01358144, 0x01368344, 0x01388344, 0x013a8644, 0x013e0144, 0x0161c085, 0x018882ae, 0x019d422f, 0x01b00184, 0x01b4c084, 0x024a4084, 0x024c4084, 0x024d0084, 0x0256042e, 0x0272c12e, 0x02770120, 0x0277c084, 0x028cc084, 0x028d8084, 0x029641ae, 0x02978084, 0x02d20084, 0x02d2c12e, 0x02d70120, 0x02e50084, 0x02f281ae, 0x03120084, 0x03300084, 0x0331c122, 0x0332812e, 0x035281ae, 0x03768084, 0x037701ae, 0x038cc085, 0x03acc085, 0x03b7012f, 0x03c30081, 0x03d0c084, 0x03d34084, 0x03d48084, 0x03d5c084, 0x03d70084, 0x03da4084, 0x03dcc084, 0x03dd412e, 0x03ddc085, 0x03de0084, 0x03de4085, 0x03e04084, 0x03e4c084, 0x03e74084, 0x03e88084, 0x03e9c084, 0x03eb0084, 0x03ee4084, 0x04098084, 0x043f0081, 0x06c18484, 0x06c48084, 0x06cec184, 0x06d00120, 0x06d0c084, 0x074b0383, 0x074cc41f, 0x074f1783, 0x075e0081, 0x0766d283, 0x07801d44, 0x078e8942, 0x07931844, 0x079f0d42, 0x07a58216, 0x07a68085, 0x07a6c0be, 0x07a80d44, 0x07aea044, 0x07c00122, 0x07c08344, 0x07c20122, 0x07c28344, 0x07c40122, 0x07c48244, 0x07c60122, 0x07c68244, 0x07c8113e, 0x07d08244, 0x07d20122, 0x07d28244, 0x07d40122, 0x07d48344, 0x07d64c3e, 0x07dc4080, 0x07dc80be, 0x07dcc080, 0x07dd00be, 0x07dd4080, 0x07dd80be, 0x07ddc080, 0x07de00be, 0x07de4080, 0x07de80be, 0x07dec080, 0x07df00be, 0x07df4080, 0x07e00820, 0x07e40820, 0x07e80820, 0x07ec05be, 0x07eec080, 0x07ef00be, 0x07ef4097, 0x07ef8080, 0x07efc117, 0x07f0443e, 0x07f24080, 0x07f280be, 0x07f2c080, 0x07f303be, 0x07f4c080, 0x07f582ae, 0x07f6c080, 0x07f7433e, 0x07f8c080, 0x07f903ae, 0x07fac080, 0x07fb013e, 0x07fb8102, 0x07fc83be, 0x07fe4080, 0x07fe80be, 0x07fec080, 0x07ff00be, 0x07ff4080, 0x07ff8097, 0x0800011e, 0x08008495, 0x08044081, 0x0805c097, 0x08090081, 0x08094097, 0x08098099, 0x080bc081, 0x080cc085, 0x080d00b1, 0x080d8085, 0x080dc0b1, 0x080f0197, 0x0811c197, 0x0815c0b3, 0x0817c081, 0x081c0595, 0x081ec081, 0x081f0215, 0x0820051f, 0x08228583, 0x08254415, 0x082a0097, 0x08400119, 0x08408081, 0x0840c0bf, 0x08414119, 0x0841c081, 0x084240bf, 0x0842852d, 0x08454081, 0x08458097, 0x08464295, 0x08480097, 0x08484099, 0x08488097, 0x08490081, 0x08498080, 0x084a0081, 0x084a8102, 0x084b0495, 0x084d421f, 0x084e4081, 0x084ec099, 0x084f0283, 0x08514295, 0x08540119, 0x0854809b, 0x0854c619, 0x0857c097, 0x08580081, 0x08584097, 0x08588099, 0x0858c097, 0x08590081, 0x08594097, 0x08598099, 0x0859c09b, 0x085a0097, 0x085a4081, 0x085a8097, 0x085ac099, 0x085b0295, 0x085c4097, 0x085c8099, 0x085cc097, 0x085d0081, 0x085d4097, 0x085d8099, 0x085dc09b, 0x085e0097, 0x085e4081, 0x085e8097, 0x085ec099, 0x085f0215, 0x08624099, 0x0866813e, 0x086b80be, 0x087341be, 0x088100be, 0x088240be, 0x088300be, 0x088901be, 0x088b0085, 0x088b40b1, 0x088bc085, 0x088c00b1, 0x089040be, 0x089100be, 0x0891c1be, 0x089801be, 0x089b42be, 0x089d0144, 0x089e0144, 0x08a00144, 0x08a10144, 0x08a20144, 0x08ab023e, 0x08b80244, 0x08ba8220, 0x08ca411e, 0x0918049f, 0x091a4523, 0x091cc097, 0x091d04a5, 0x091f452b, 0x0921c09b, 0x092204a1, 0x09244525, 0x0926c099, 0x09270d25, 0x092d8d1f, 0x09340d1f, 0x093a8081, 0x0a8300b3, 0x0a9d0099, 0x0a9d4097, 0x0a9d8099, 0x0ab700be, 0x0b1f0115, 0x0b5bc081, 0x0ba7c081, 0x0bbcc081, 0x0bc004ad, 0x0bc244ad, 0x0bc484ad, 0x0bc6f383, 0x0be0852d, 0x0be31d03, 0x0bf1882d, 0x0c000081, 0x0c0d8283, 0x0c130b84, 0x0c194284, 0x0c1c0122, 0x0c1cc122, 0x0c1d8122, 0x0c1e4122, 0x0c1f0122, 0x0c250084, 0x0c26c123, 0x0c278084, 0x0c27c085, 0x0c2b0b84, 0x0c314284, 0x0c340122, 0x0c34c122, 0x0c358122, 0x0c364122, 0x0c370122, 0x0c3d0084, 0x0c3dc220, 0x0c3f8084, 0x0c3fc085, 0x0c4c4a2d, 0x0c51451f, 0x0c53ca9f, 0x0c5915ad, 0x0c648703, 0x0c800741, 0x0c838089, 0x0c83c129, 0x0c8441a9, 0x0c850089, 0x0c854129, 0x0c85c2a9, 0x0c870089, 0x0c87408f, 0x0c87808d, 0x0c881241, 0x0c910203, 0x0c940099, 0x0c9444a3, 0x0c968323, 0x0c98072d, 0x0c9b84af, 0x0c9dc2a1, 0x0c9f00b5, 0x0c9f40b3, 0x0c9f8085, 0x0ca01883, 0x0cac4223, 0x0cad4523, 0x0cafc097, 0x0cb004a1, 0x0cb241a5, 0x0cb30097, 0x0cb34099, 0x0cb38097, 0x0cb3c099, 0x0cb417ad, 0x0cbfc085, 0x0cc001b3, 0x0cc0c0b1, 0x0cc100b3, 0x0cc14131, 0x0cc1c0b5, 0x0cc200b3, 0x0cc241b1, 0x0cc30133, 0x0cc38131, 0x0cc40085, 0x0cc440b1, 0x0cc48133, 0x0cc50085, 0x0cc540b5, 0x0cc580b7, 0x0cc5c0b5, 0x0cc600b1, 0x0cc64135, 0x0cc6c0b3, 0x0cc701b1, 0x0cc7c0b3, 0x0cc800b5, 0x0cc840b3, 0x0cc881b1, 0x0cc9422f, 0x0cca4131, 0x0ccac0b5, 0x0ccb00b1, 0x0ccb40b3, 0x0ccb80b5, 0x0ccbc0b1, 0x0ccc012f, 0x0ccc80b5, 0x0cccc0b3, 0x0ccd00b5, 0x0ccd40b1, 0x0ccd80b5, 0x0ccdc085, 0x0cce02b1, 0x0ccf40b3, 0x0ccf80b1, 0x0ccfc085, 0x0cd001b1, 0x0cd0c0b3, 0x0cd101b1, 0x0cd1c0b5, 0x0cd200b3, 0x0cd24085, 0x0cd280b5, 0x0cd2c085, 0x0cd30133, 0x0cd381b1, 0x0cd440b3, 0x0cd48085, 0x0cd4c0b1, 0x0cd500b3, 0x0cd54085, 0x0cd580b5, 0x0cd5c0b1, 0x0cd60521, 0x0cd88525, 0x0cdb02a5, 0x0cdc4099, 0x0cdc8117, 0x0cdd0099, 0x0cdd4197, 0x0cde0127, 0x0cde8285, 0x0cdfc089, 0x0ce0043f, 0x0ce20099, 0x0ce2409b, 0x0ce283bf, 0x0ce44219, 0x0ce54205, 0x0ce6433f, 0x0ce7c131, 0x0ce84085, 0x0ce881b1, 0x0ce94085, 0x0ce98107, 0x0cea0089, 0x0cea4097, 0x0cea8219, 0x0ceb809d, 0x0cebc08d, 0x0cec083f, 0x0cf00105, 0x0cf0809b, 0x0cf0c197, 0x0cf1809b, 0x0cf1c099, 0x0cf20517, 0x0cf48099, 0x0cf4c117, 0x0cf54119, 0x0cf5c097, 0x0cf6009b, 0x0cf64099, 0x0cf68217, 0x0cf78119, 0x0cf804a1, 0x0cfa4525, 0x0cfcc525, 0x0cff4125, 0x0cffc099, 0x29a70103, 0x29dc0081, 0x29fc8195, 0x29fe0103, 0x2ad70203, 0x2ada4081, 0x3e401482, 0x3e4a7f82, 0x3e6a3f82, 0x3e8aa102, 0x3e9b0110, 0x3e9c2f82, 0x3eb3c590, 0x3ec00197, 0x3ec0c119, 0x3ec1413f, 0x3ec4c2af, 0x3ec74184, 0x3ec804ad, 0x3eca4081, 0x3eca8304, 0x3ecc03a0, 0x3ece02a0, 0x3ecf8084, 0x3ed00120, 0x3ed0c120, 0x3ed184ae, 0x3ed3c085, 0x3ed4312d, 0x3ef4cbad, 0x3efa892f, 0x3eff022d, 0x3f002f2f, 0x3f1782a5, 0x3f18c0b1, 0x3f1907af, 0x3f1cffaf, 0x3f3c81a5, 0x3f3d64af, 0x3f542031, 0x3f649b31, 0x3f7c0131, 0x3f7c83b3, 0x3f7e40b1, 0x3f7e80bd, 0x3f7ec0bb, 0x3f7f00b3, 0x3f840503, 0x3f8c01ad, 0x3f8cc315, 0x3f8e462d, 0x3f91cc03, 0x3f97c695, 0x3f9c01af, 0x3f9d0085, 0x3f9d852f, 0x3fa03aad, 0x3fbd442f, 0x3fc06f1f, 0x3fd7c11f, 0x3fd85fad, 0x3fe80081, 0x3fe84f1f, 0x3ff0831f, 0x3ff2831f, 0x3ff4831f, 0x3ff6819f, 0x3ff80783, 0x41724092, 0x41790092, 0x41e04d83, 0x41e70f91, 0x44268192, 0x442ac092, 0x444b8112, 0x44d2c112, 0x44e0c192, 0x44e38092, 0x44e44092, 0x44f14212, 0x452ec212, 0x456e8112, 0x464e0092, 0x58484412, 0x5b5a0192, 0x73358d1f, 0x733c051f, 0x74578392, 0x746ec312, 0x75000d1f, 0x75068d1f, 0x750d0d1f, 0x7513839f, 0x7515891f, 0x751a0d1f, 0x75208d1f, 0x75271015, 0x752f439f, 0x7531459f, 0x75340d1f, 0x753a8d1f, 0x75410395, 0x7543441f, 0x7545839f, 0x75478d1f, 0x754e0795, 0x7552839f, 0x75548d1f, 0x755b0d1f, 0x75618d1f, 0x75680d1f, 0x756e8d1f, 0x75750d1f, 0x757b8d1f, 0x75820d1f, 0x75888d1f, 0x758f0d1f, 0x75958d1f, 0x759c0d1f, 0x75a28d1f, 0x75a90103, 0x75aa089f, 0x75ae4081, 0x75ae839f, 0x75b04081, 0x75b08c9f, 0x75b6c081, 0x75b7032d, 0x75b8889f, 0x75bcc081, 0x75bd039f, 0x75bec081, 0x75bf0c9f, 0x75c54081, 0x75c5832d, 0x75c7089f, 0x75cb4081, 0x75cb839f, 0x75cd4081, 0x75cd8c9f, 0x75d3c081, 0x75d4032d, 0x75d5889f, 0x75d9c081, 0x75da039f, 0x75dbc081, 0x75dc0c9f, 0x75e24081, 0x75e2832d, 0x75e4089f, 0x75e84081, 0x75e8839f, 0x75ea4081, 0x75ea8c9f, 0x75f0c081, 0x75f1042d, 0x75f3851f, 0x75f6051f, 0x75f8851f, 0x75fb051f, 0x75fd851f, 0x780c049f, 0x780e419f, 0x780f059f, 0x7811c203, 0x7812d0ad, 0x781b0103, 0x7b80022d, 0x7b814dad, 0x7b884203, 0x7b89c081, 0x7b8a452d, 0x7b8d0403, 0x7b908081, 0x7b91dc03, 0x7ba0052d, 0x7ba2c8ad, 0x7ba84483, 0x7baac8ad, 0x7c400097, 0x7c404521, 0x7c440d25, 0x7c4a8087, 0x7c4ac115, 0x7c4b4117, 0x7c4c0d1f, 0x7c528217, 0x7c538099, 0x7c53c097, 0x7c5a8197, 0x7c640097, 0x7c80012f, 0x7c808081, 0x7c841603, 0x7c9004c1, 0x7c940103, 0x7efc051f, 0xbe0001ac, 0xbe00d110, 0xbe0947ac, 0xbe0d3910, 0xbe29872c, 0xbe2d022c, 0xbe2e3790, 0xbe49ff90, 0xbe69bc10, }; static const uint16_t unicode_decomp_table2[709] = { 0x0020, 0x0000, 0x0061, 0x0002, 0x0004, 0x0006, 0x03bc, 0x0008, 0x000a, 0x000c, 0x0015, 0x0095, 0x00a5, 0x00b9, 0x00c1, 0x00c3, 0x00c7, 0x00cb, 0x00d1, 0x00d7, 0x00dd, 0x00e0, 0x00e6, 0x00f8, 0x0108, 0x010a, 0x0073, 0x0110, 0x0112, 0x0114, 0x0120, 0x012c, 0x0144, 0x014d, 0x0153, 0x0162, 0x0168, 0x016a, 0x0176, 0x0192, 0x0194, 0x01a9, 0x01bb, 0x01c7, 0x01d1, 0x01d5, 0x02b9, 0x01d7, 0x003b, 0x01d9, 0x01db, 0x00b7, 0x01e1, 0x01fc, 0x020c, 0x0218, 0x021d, 0x0223, 0x0227, 0x03a3, 0x0233, 0x023f, 0x0242, 0x024b, 0x024e, 0x0251, 0x025d, 0x0260, 0x0269, 0x026c, 0x026f, 0x0275, 0x0278, 0x0281, 0x028a, 0x029c, 0x029f, 0x02a3, 0x02af, 0x02b9, 0x02c5, 0x02c9, 0x02cd, 0x02d1, 0x02d5, 0x02e7, 0x02ed, 0x02f1, 0x02f5, 0x02f9, 0x02fd, 0x0305, 0x0309, 0x030d, 0x0313, 0x0317, 0x031b, 0x0323, 0x0327, 0x032b, 0x032f, 0x0335, 0x033d, 0x0341, 0x0349, 0x034d, 0x0351, 0x0f0b, 0x0357, 0x035b, 0x035f, 0x0363, 0x0367, 0x036b, 0x036f, 0x0373, 0x0379, 0x037d, 0x0381, 0x0385, 0x0389, 0x038d, 0x0391, 0x0395, 0x0399, 0x039d, 0x03a1, 0x10dc, 0x03a5, 0x03c9, 0x03cd, 0x03d9, 0x03dd, 0x03e1, 0x03ef, 0x03f1, 0x043d, 0x044f, 0x0499, 0x04f0, 0x0502, 0x054a, 0x0564, 0x056c, 0x0570, 0x0573, 0x059a, 0x05fa, 0x05fe, 0x0607, 0x060b, 0x0614, 0x0618, 0x061e, 0x0622, 0x0628, 0x068e, 0x0694, 0x0698, 0x069e, 0x06a2, 0x06ab, 0x03ac, 0x06f3, 0x03ad, 0x06f6, 0x03ae, 0x06f9, 0x03af, 0x06fc, 0x03cc, 0x06ff, 0x03cd, 0x0702, 0x03ce, 0x0705, 0x0709, 0x070d, 0x0711, 0x0386, 0x0732, 0x0735, 0x03b9, 0x0737, 0x073b, 0x0388, 0x0753, 0x0389, 0x0756, 0x0390, 0x076b, 0x038a, 0x0777, 0x03b0, 0x0789, 0x038e, 0x0799, 0x079f, 0x07a3, 0x038c, 0x07b8, 0x038f, 0x07bb, 0x00b4, 0x07be, 0x07c0, 0x07c2, 0x2010, 0x07cb, 0x002e, 0x07cd, 0x07cf, 0x0020, 0x07d2, 0x07d6, 0x07db, 0x07df, 0x07e4, 0x07ea, 0x07f0, 0x0020, 0x07f6, 0x2212, 0x0801, 0x0805, 0x0807, 0x081d, 0x0825, 0x0827, 0x0043, 0x082d, 0x0830, 0x0190, 0x0836, 0x0839, 0x004e, 0x0845, 0x0847, 0x084c, 0x084e, 0x0851, 0x005a, 0x03a9, 0x005a, 0x0853, 0x0857, 0x0860, 0x0069, 0x0862, 0x0865, 0x086f, 0x0874, 0x087a, 0x087e, 0x08a2, 0x0049, 0x08a4, 0x08a6, 0x08a9, 0x0056, 0x08ab, 0x08ad, 0x08b0, 0x08b4, 0x0058, 0x08b6, 0x08b8, 0x08bb, 0x08c0, 0x08c2, 0x08c5, 0x0076, 0x08c7, 0x08c9, 0x08cc, 0x08d0, 0x0078, 0x08d2, 0x08d4, 0x08d7, 0x08db, 0x08de, 0x08e4, 0x08e7, 0x08f0, 0x08f3, 0x08f6, 0x08f9, 0x0902, 0x0906, 0x090b, 0x090f, 0x0914, 0x0917, 0x091a, 0x0923, 0x092c, 0x093b, 0x093e, 0x0941, 0x0944, 0x0947, 0x094a, 0x0956, 0x095c, 0x0960, 0x0962, 0x0964, 0x0968, 0x096a, 0x0970, 0x0978, 0x097c, 0x0980, 0x0986, 0x0989, 0x098f, 0x0991, 0x0030, 0x0993, 0x0999, 0x099c, 0x099e, 0x09a1, 0x09a4, 0x2d61, 0x6bcd, 0x9f9f, 0x09a6, 0x09b1, 0x09bc, 0x09c7, 0x0a95, 0x0aa1, 0x0b15, 0x0020, 0x0b27, 0x0b31, 0x0b8d, 0x0ba1, 0x0ba5, 0x0ba9, 0x0bad, 0x0bb1, 0x0bb5, 0x0bb9, 0x0bbd, 0x0bc1, 0x0bc5, 0x0c21, 0x0c35, 0x0c39, 0x0c3d, 0x0c41, 0x0c45, 0x0c49, 0x0c4d, 0x0c51, 0x0c55, 0x0c59, 0x0c6f, 0x0c71, 0x0c73, 0x0ca0, 0x0cbc, 0x0cdc, 0x0ce4, 0x0cec, 0x0cf4, 0x0cfc, 0x0d04, 0x0d0c, 0x0d14, 0x0d22, 0x0d2e, 0x0d7a, 0x0d82, 0x0d85, 0x0d89, 0x0d8d, 0x0d9d, 0x0db1, 0x0db5, 0x0dbc, 0x0dc2, 0x0dc6, 0x0e28, 0x0e2c, 0x0e30, 0x0e32, 0x0e36, 0x0e3c, 0x0e3e, 0x0e41, 0x0e43, 0x0e46, 0x0e77, 0x0e7b, 0x0e89, 0x0e8e, 0x0e94, 0x0e9c, 0x0ea3, 0x0ea9, 0x0eb4, 0x0ebe, 0x0ec6, 0x0eca, 0x0ecf, 0x0ed9, 0x0edd, 0x0ee4, 0x0eec, 0x0ef3, 0x0ef8, 0x0f04, 0x0f0a, 0x0f15, 0x0f1b, 0x0f22, 0x0f28, 0x0f33, 0x0f3d, 0x0f45, 0x0f4c, 0x0f51, 0x0f57, 0x0f5e, 0x0f63, 0x0f69, 0x0f70, 0x0f76, 0x0f7d, 0x0f82, 0x0f89, 0x0f8d, 0x0f9e, 0x0fa4, 0x0fa9, 0x0fad, 0x0fb8, 0x0fbe, 0x0fc9, 0x0fd0, 0x0fd6, 0x0fda, 0x0fe1, 0x0fe5, 0x0fef, 0x0ffa, 0x1000, 0x1004, 0x1009, 0x100f, 0x1013, 0x101a, 0x101f, 0x1023, 0x1029, 0x102f, 0x1032, 0x1036, 0x1039, 0x103f, 0x1045, 0x1059, 0x1061, 0x1079, 0x107c, 0x1080, 0x1095, 0x10a1, 0x10b1, 0x10c3, 0x10cb, 0x10cf, 0x10da, 0x10de, 0x10ea, 0x10f2, 0x10f4, 0x1100, 0x1105, 0x1111, 0x1141, 0x1149, 0x114d, 0x1153, 0x1157, 0x115a, 0x116e, 0x1171, 0x1175, 0x117b, 0x117d, 0x1181, 0x1184, 0x118c, 0x1192, 0x1196, 0x119c, 0x11a2, 0x11a8, 0x11ab, 0xa76f, 0x11af, 0x11b2, 0x11b6, 0x028d, 0x11be, 0x1210, 0x130e, 0x140c, 0x1490, 0x1495, 0x1553, 0x156c, 0x1572, 0x1578, 0x157e, 0x158a, 0x1596, 0x002b, 0x15a1, 0x15b9, 0x15bd, 0x15c1, 0x15c5, 0x15c9, 0x15cd, 0x15e1, 0x15e5, 0x1649, 0x1662, 0x1688, 0x168e, 0x174c, 0x1752, 0x1757, 0x1777, 0x1877, 0x187d, 0x1911, 0x19d3, 0x1a77, 0x1a7f, 0x1a9d, 0x1aa2, 0x1ab6, 0x1ac0, 0x1ac6, 0x1ada, 0x1adf, 0x1ae5, 0x1af3, 0x1b23, 0x1b30, 0x1b38, 0x1b3c, 0x1b52, 0x1bc9, 0x1bdb, 0x1bdd, 0x1bdf, 0x3164, 0x1c20, 0x1c22, 0x1c24, 0x1c26, 0x1c28, 0x1c2a, 0x1c48, 0x1c4d, 0x1c52, 0x1c88, 0x1cce, 0x1cdc, 0x1ce1, 0x1cea, 0x1cf3, 0x1d01, 0x1d06, 0x1d0b, 0x1d1d, 0x1d2f, 0x1d38, 0x1d3d, 0x1d61, 0x1d6f, 0x1d71, 0x1d73, 0x1d93, 0x1dae, 0x1db0, 0x1db2, 0x1db4, 0x1db6, 0x1db8, 0x1dba, 0x1dbc, 0x1ddc, 0x1dde, 0x1de0, 0x1de2, 0x1de4, 0x1deb, 0x1ded, 0x1def, 0x1df1, 0x1e00, 0x1e02, 0x1e04, 0x1e06, 0x1e08, 0x1e0a, 0x1e0c, 0x1e0e, 0x1e10, 0x1e12, 0x1e14, 0x1e16, 0x1e18, 0x1e1a, 0x1e1c, 0x1e20, 0x03f4, 0x1e22, 0x2207, 0x1e24, 0x2202, 0x1e26, 0x1e2e, 0x03f4, 0x1e30, 0x2207, 0x1e32, 0x2202, 0x1e34, 0x1e3c, 0x03f4, 0x1e3e, 0x2207, 0x1e40, 0x2202, 0x1e42, 0x1e4a, 0x03f4, 0x1e4c, 0x2207, 0x1e4e, 0x2202, 0x1e50, 0x1e58, 0x03f4, 0x1e5a, 0x2207, 0x1e5c, 0x2202, 0x1e5e, 0x1e68, 0x1e6a, 0x1e6c, 0x1e6e, 0x1e70, 0x1e72, 0x1e74, 0x1e76, 0x1e78, 0x1e80, 0x1ea3, 0x1ea7, 0x1ead, 0x1eca, 0x062d, 0x1ed2, 0x1ede, 0x062c, 0x1eee, 0x1f5e, 0x1f6a, 0x1f7d, 0x1f8f, 0x1fa2, 0x1fa4, 0x1fa8, 0x1fae, 0x1fb4, 0x1fb6, 0x1fba, 0x1fbc, 0x1fc4, 0x1fc7, 0x1fc9, 0x1fcf, 0x1fd1, 0x30b5, 0x1fd7, 0x202f, 0x2045, 0x2049, 0x204b, 0x2050, 0x209d, 0x20ae, 0x21af, 0x21bf, 0x21c5, 0x22bf, 0x23dd, }; static const uint8_t unicode_decomp_data[9451] = { 0x20, 0x88, 0x20, 0x84, 0x32, 0x33, 0x20, 0x81, 0x20, 0xa7, 0x31, 0x6f, 0x31, 0xd0, 0x34, 0x31, 0xd0, 0x32, 0x33, 0xd0, 0x34, 0x41, 0x80, 0x41, 0x81, 0x41, 0x82, 0x41, 0x83, 0x41, 0x88, 0x41, 0x8a, 0x00, 0x00, 0x43, 0xa7, 0x45, 0x80, 0x45, 0x81, 0x45, 0x82, 0x45, 0x88, 0x49, 0x80, 0x49, 0x81, 0x49, 0x82, 0x49, 0x88, 0x00, 0x00, 0x4e, 0x83, 0x4f, 0x80, 0x4f, 0x81, 0x4f, 0x82, 0x4f, 0x83, 0x4f, 0x88, 0x00, 0x00, 0x00, 0x00, 0x55, 0x80, 0x55, 0x81, 0x55, 0x82, 0x55, 0x88, 0x59, 0x81, 0x00, 0x00, 0x00, 0x00, 0x61, 0x80, 0x61, 0x81, 0x61, 0x82, 0x61, 0x83, 0x61, 0x88, 0x61, 0x8a, 0x00, 0x00, 0x63, 0xa7, 0x65, 0x80, 0x65, 0x81, 0x65, 0x82, 0x65, 0x88, 0x69, 0x80, 0x69, 0x81, 0x69, 0x82, 0x69, 0x88, 0x00, 0x00, 0x6e, 0x83, 0x6f, 0x80, 0x6f, 0x81, 0x6f, 0x82, 0x6f, 0x83, 0x6f, 0x88, 0x00, 0x00, 0x00, 0x00, 0x75, 0x80, 0x75, 0x81, 0x75, 0x82, 0x75, 0x88, 0x79, 0x81, 0x00, 0x00, 0x79, 0x88, 0x41, 0x84, 0x41, 0x86, 0x41, 0xa8, 0x43, 0x81, 0x43, 0x82, 0x43, 0x87, 0x43, 0x8c, 0x44, 0x8c, 0x45, 0x84, 0x45, 0x86, 0x45, 0x87, 0x45, 0xa8, 0x45, 0x8c, 0x47, 0x82, 0x47, 0x86, 0x47, 0x87, 0x47, 0xa7, 0x48, 0x82, 0x49, 0x83, 0x49, 0x84, 0x49, 0x86, 0x49, 0xa8, 0x49, 0x87, 0x49, 0x4a, 0x69, 0x6a, 0x4a, 0x82, 0x4b, 0xa7, 0x4c, 0x81, 0x4c, 0xa7, 0x4c, 0x8c, 0x4c, 0x00, 0x00, 0x6b, 0x20, 0x6b, 0x4e, 0x81, 0x4e, 0xa7, 0x4e, 0x8c, 0xbc, 0x02, 0x6e, 0x4f, 0x84, 0x4f, 0x86, 0x4f, 0x8b, 0x52, 0x81, 0x52, 0xa7, 0x52, 0x8c, 0x53, 0x81, 0x53, 0x82, 0x53, 0xa7, 0x53, 0x8c, 0x54, 0xa7, 0x54, 0x8c, 0x55, 0x83, 0x55, 0x84, 0x55, 0x86, 0x55, 0x8a, 0x55, 0x8b, 0x55, 0xa8, 0x57, 0x82, 0x59, 0x82, 0x59, 0x88, 0x5a, 0x81, 0x5a, 0x87, 0x5a, 0x8c, 0x4f, 0x9b, 0x55, 0x9b, 0x44, 0x00, 0x7d, 0x01, 0x44, 0x00, 0x7e, 0x01, 0x64, 0x00, 0x7e, 0x01, 0x4c, 0x4a, 0x4c, 0x6a, 0x6c, 0x6a, 0x4e, 0x4a, 0x4e, 0x6a, 0x6e, 0x6a, 0x41, 0x00, 0x8c, 0x49, 0x00, 0x8c, 0x4f, 0x00, 0x8c, 0x55, 0x00, 0x8c, 0xdc, 0x00, 0x84, 0xdc, 0x00, 0x81, 0xdc, 0x00, 0x8c, 0xdc, 0x00, 0x80, 0xc4, 0x00, 0x84, 0x26, 0x02, 0x84, 0xc6, 0x00, 0x84, 0x47, 0x8c, 0x4b, 0x8c, 0x4f, 0xa8, 0xea, 0x01, 0x84, 0xeb, 0x01, 0x84, 0xb7, 0x01, 0x8c, 0x92, 0x02, 0x8c, 0x6a, 0x00, 0x8c, 0x44, 0x5a, 0x44, 0x7a, 0x64, 0x7a, 0x47, 0x81, 0x4e, 0x00, 0x80, 0xc5, 0x00, 0x81, 0xc6, 0x00, 0x81, 0xd8, 0x00, 0x81, 0x41, 0x8f, 0x41, 0x91, 0x45, 0x8f, 0x45, 0x91, 0x49, 0x8f, 0x49, 0x91, 0x4f, 0x8f, 0x4f, 0x91, 0x52, 0x8f, 0x52, 0x91, 0x55, 0x8f, 0x55, 0x91, 0x53, 0xa6, 0x54, 0xa6, 0x48, 0x8c, 0x41, 0x00, 0x87, 0x45, 0x00, 0xa7, 0xd6, 0x00, 0x84, 0xd5, 0x00, 0x84, 0x4f, 0x00, 0x87, 0x2e, 0x02, 0x84, 0x59, 0x00, 0x84, 0x68, 0x00, 0x66, 0x02, 0x6a, 0x00, 0x72, 0x00, 0x79, 0x02, 0x7b, 0x02, 0x81, 0x02, 0x77, 0x00, 0x79, 0x00, 0x20, 0x86, 0x20, 0x87, 0x20, 0x8a, 0x20, 0xa8, 0x20, 0x83, 0x20, 0x8b, 0x63, 0x02, 0x6c, 0x00, 0x73, 0x00, 0x78, 0x00, 0x95, 0x02, 0x80, 0x81, 0x00, 0x93, 0x88, 0x81, 0x20, 0xc5, 0x20, 0x81, 0xa8, 0x00, 0x81, 0x91, 0x03, 0x81, 0x95, 0x03, 0x81, 0x97, 0x03, 0x81, 0x99, 0x03, 0x81, 0x00, 0x00, 0x00, 0x9f, 0x03, 0x81, 0x00, 0x00, 0x00, 0xa5, 0x03, 0x81, 0xa9, 0x03, 0x81, 0xca, 0x03, 0x81, 0x01, 0x03, 0x98, 0x07, 0xa4, 0x07, 0xb0, 0x00, 0xb4, 0x00, 0xb6, 0x00, 0xb8, 0x00, 0xca, 0x00, 0x01, 0x03, 0xb8, 0x07, 0xc4, 0x07, 0xbe, 0x00, 0xc4, 0x00, 0xc8, 0x00, 0xa5, 0x03, 0x0d, 0x13, 0x00, 0x01, 0x03, 0xd1, 0x00, 0xd1, 0x07, 0xc6, 0x03, 0xc0, 0x03, 0xba, 0x03, 0xc1, 0x03, 0xc2, 0x03, 0x00, 0x00, 0x98, 0x03, 0xb5, 0x03, 0x15, 0x04, 0x80, 0x15, 0x04, 0x88, 0x00, 0x00, 0x00, 0x13, 0x04, 0x81, 0x06, 0x04, 0x88, 0x1a, 0x04, 0x81, 0x18, 0x04, 0x80, 0x23, 0x04, 0x86, 0x18, 0x04, 0x86, 0x38, 0x04, 0x86, 0x35, 0x04, 0x80, 0x35, 0x04, 0x88, 0x00, 0x00, 0x00, 0x33, 0x04, 0x81, 0x56, 0x04, 0x88, 0x3a, 0x04, 0x81, 0x38, 0x04, 0x80, 0x43, 0x04, 0x86, 0x74, 0x04, 0x8f, 0x16, 0x04, 0x86, 0x10, 0x04, 0x86, 0x10, 0x04, 0x88, 0x15, 0x04, 0x86, 0xd8, 0x04, 0x88, 0x16, 0x04, 0x88, 0x17, 0x04, 0x88, 0x18, 0x04, 0x84, 0x18, 0x04, 0x88, 0x1e, 0x04, 0x88, 0xe8, 0x04, 0x88, 0x2d, 0x04, 0x88, 0x23, 0x04, 0x84, 0x23, 0x04, 0x88, 0x23, 0x04, 0x8b, 0x27, 0x04, 0x88, 0x2b, 0x04, 0x88, 0x65, 0x05, 0x82, 0x05, 0x27, 0x06, 0x00, 0x2c, 0x00, 0x2d, 0x21, 0x2d, 0x00, 0x2e, 0x23, 0x2d, 0x27, 0x06, 0x00, 0x4d, 0x21, 0x4d, 0xa0, 0x4d, 0x23, 0x4d, 0xd5, 0x06, 0x54, 0x06, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x06, 0x54, 0x06, 0xd2, 0x06, 0x54, 0x06, 0x28, 0x09, 0x3c, 0x09, 0x30, 0x09, 0x3c, 0x09, 0x33, 0x09, 0x3c, 0x09, 0x15, 0x09, 0x00, 0x27, 0x01, 0x27, 0x02, 0x27, 0x07, 0x27, 0x0c, 0x27, 0x0d, 0x27, 0x16, 0x27, 0x1a, 0x27, 0xbe, 0x09, 0x09, 0x00, 0x09, 0x19, 0xa1, 0x09, 0xbc, 0x09, 0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 0x1b, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1b, 0x35, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x09, 0x1b, 0x35, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1b, 0x35, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x1b, 0x35, 0x1b, 0x11, 0x1b, 0x35, 0x1b, 0x3a, 0x1b, 0x35, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x1b, 0x35, 0x1b, 0x3e, 0x1b, 0x35, 0x1b, 0x42, 0x1b, 0x35, 0x1b, 0x41, 0x00, 0xc6, 0x00, 0x42, 0x00, 0x00, 0x00, 0x44, 0x00, 0x45, 0x00, 0x8e, 0x01, 0x47, 0x00, 0x4f, 0x00, 0x22, 0x02, 0x50, 0x00, 0x52, 0x00, 0x54, 0x00, 0x55, 0x00, 0x57, 0x00, 0x61, 0x00, 0x50, 0x02, 0x51, 0x02, 0x02, 0x1d, 0x62, 0x00, 0x64, 0x00, 0x65, 0x00, 0x59, 0x02, 0x5b, 0x02, 0x5c, 0x02, 0x67, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x6d, 0x00, 0x4b, 0x01, 0x6f, 0x00, 0x54, 0x02, 0x16, 0x1d, 0x17, 0x1d, 0x70, 0x00, 0x74, 0x00, 0x75, 0x00, 0x1d, 0x1d, 0x6f, 0x02, 0x76, 0x00, 0x25, 0x1d, 0xb2, 0x03, 0xb3, 0x03, 0xb4, 0x03, 0xc6, 0x03, 0xc7, 0x03, 0x69, 0x00, 0x72, 0x00, 0x75, 0x00, 0x76, 0x00, 0xb2, 0x03, 0xb3, 0x03, 0xc1, 0x03, 0xc6, 0x03, 0xc7, 0x03, 0x52, 0x02, 0x63, 0x00, 0x55, 0x02, 0xf0, 0x00, 0x5c, 0x02, 0x66, 0x00, 0x5f, 0x02, 0x61, 0x02, 0x65, 0x02, 0x68, 0x02, 0x69, 0x02, 0x6a, 0x02, 0x7b, 0x1d, 0x9d, 0x02, 0x6d, 0x02, 0x85, 0x1d, 0x9f, 0x02, 0x71, 0x02, 0x70, 0x02, 0x72, 0x02, 0x73, 0x02, 0x74, 0x02, 0x75, 0x02, 0x78, 0x02, 0x82, 0x02, 0x83, 0x02, 0xab, 0x01, 0x89, 0x02, 0x8a, 0x02, 0x1c, 0x1d, 0x8b, 0x02, 0x8c, 0x02, 0x7a, 0x00, 0x90, 0x02, 0x91, 0x02, 0x92, 0x02, 0xb8, 0x03, 0x41, 0x00, 0xa5, 0x42, 0x00, 0x87, 0x42, 0x00, 0xa3, 0x42, 0x00, 0xb1, 0xc7, 0x00, 0x81, 0x44, 0x00, 0x87, 0x44, 0x00, 0xa3, 0x44, 0x00, 0xb1, 0x44, 0x00, 0xa7, 0x44, 0x00, 0xad, 0x12, 0x01, 0x80, 0x12, 0x01, 0x81, 0x45, 0x00, 0xad, 0x45, 0x00, 0xb0, 0x28, 0x02, 0x86, 0x46, 0x00, 0x87, 0x47, 0x00, 0x84, 0x48, 0x00, 0x87, 0x48, 0x00, 0xa3, 0x48, 0x00, 0x88, 0x48, 0x00, 0xa7, 0x48, 0x00, 0xae, 0x49, 0x00, 0xb0, 0xcf, 0x00, 0x81, 0x4b, 0x00, 0x81, 0x4b, 0x00, 0xa3, 0x4b, 0x00, 0xb1, 0x4c, 0x00, 0xa3, 0x36, 0x1e, 0x84, 0x4c, 0xb1, 0x4c, 0xad, 0x4d, 0x81, 0x4d, 0x87, 0x4d, 0xa3, 0x4e, 0x87, 0x4e, 0xa3, 0x4e, 0xb1, 0x4e, 0xad, 0xd5, 0x00, 0x81, 0xd5, 0x00, 0x88, 0x4c, 0x01, 0x80, 0x4c, 0x01, 0x81, 0x50, 0x00, 0x81, 0x50, 0x00, 0x87, 0x52, 0x00, 0x87, 0x52, 0x00, 0xa3, 0x5a, 0x1e, 0x84, 0x52, 0x00, 0xb1, 0x53, 0x00, 0x87, 0x53, 0x00, 0xa3, 0x5a, 0x01, 0x87, 0x60, 0x01, 0x87, 0x62, 0x1e, 0x87, 0x54, 0x00, 0x87, 0x54, 0x00, 0xa3, 0x54, 0x00, 0xb1, 0x54, 0x00, 0xad, 0x55, 0x00, 0xa4, 0x55, 0x00, 0xb0, 0x55, 0x00, 0xad, 0x68, 0x01, 0x81, 0x6a, 0x01, 0x88, 0x56, 0x83, 0x56, 0xa3, 0x57, 0x80, 0x57, 0x81, 0x57, 0x88, 0x57, 0x87, 0x57, 0xa3, 0x58, 0x87, 0x58, 0x88, 0x59, 0x87, 0x5a, 0x82, 0x5a, 0xa3, 0x5a, 0xb1, 0x68, 0xb1, 0x74, 0x88, 0x77, 0x8a, 0x79, 0x8a, 0x61, 0x00, 0xbe, 0x02, 0x7f, 0x01, 0x87, 0x41, 0x00, 0xa3, 0x41, 0x00, 0x89, 0xc2, 0x00, 0x81, 0xc2, 0x00, 0x80, 0xc2, 0x00, 0x89, 0xc2, 0x00, 0x83, 0xa0, 0x1e, 0x82, 0x02, 0x01, 0x81, 0x02, 0x01, 0x80, 0x02, 0x01, 0x89, 0x02, 0x01, 0x83, 0xa0, 0x1e, 0x86, 0x45, 0x00, 0xa3, 0x45, 0x00, 0x89, 0x45, 0x00, 0x83, 0xca, 0x00, 0x81, 0xca, 0x00, 0x80, 0xca, 0x00, 0x89, 0xca, 0x00, 0x83, 0xb8, 0x1e, 0x82, 0x49, 0x00, 0x89, 0x49, 0x00, 0xa3, 0x4f, 0x00, 0xa3, 0x4f, 0x00, 0x89, 0xd4, 0x00, 0x81, 0xd4, 0x00, 0x80, 0xd4, 0x00, 0x89, 0xd4, 0x00, 0x83, 0xcc, 0x1e, 0x82, 0xa0, 0x01, 0x81, 0xa0, 0x01, 0x80, 0xa0, 0x01, 0x89, 0xa0, 0x01, 0x83, 0xa0, 0x01, 0xa3, 0x55, 0x00, 0xa3, 0x55, 0x00, 0x89, 0xaf, 0x01, 0x81, 0xaf, 0x01, 0x80, 0xaf, 0x01, 0x89, 0xaf, 0x01, 0x83, 0xaf, 0x01, 0xa3, 0x59, 0x00, 0x80, 0x59, 0x00, 0xa3, 0x59, 0x00, 0x89, 0x59, 0x00, 0x83, 0xb1, 0x03, 0x13, 0x03, 0x00, 0x1f, 0x80, 0x00, 0x1f, 0x81, 0x00, 0x1f, 0xc2, 0x91, 0x03, 0x13, 0x03, 0x08, 0x1f, 0x80, 0x08, 0x1f, 0x81, 0x08, 0x1f, 0xc2, 0xb5, 0x03, 0x13, 0x03, 0x10, 0x1f, 0x80, 0x10, 0x1f, 0x81, 0x95, 0x03, 0x13, 0x03, 0x18, 0x1f, 0x80, 0x18, 0x1f, 0x81, 0xb7, 0x03, 0x93, 0xb7, 0x03, 0x94, 0x20, 0x1f, 0x80, 0x21, 0x1f, 0x80, 0x20, 0x1f, 0x81, 0x21, 0x1f, 0x81, 0x20, 0x1f, 0xc2, 0x21, 0x1f, 0xc2, 0x97, 0x03, 0x93, 0x97, 0x03, 0x94, 0x28, 0x1f, 0x80, 0x29, 0x1f, 0x80, 0x28, 0x1f, 0x81, 0x29, 0x1f, 0x81, 0x28, 0x1f, 0xc2, 0x29, 0x1f, 0xc2, 0xb9, 0x03, 0x93, 0xb9, 0x03, 0x94, 0x30, 0x1f, 0x80, 0x31, 0x1f, 0x80, 0x30, 0x1f, 0x81, 0x31, 0x1f, 0x81, 0x30, 0x1f, 0xc2, 0x31, 0x1f, 0xc2, 0x99, 0x03, 0x93, 0x99, 0x03, 0x94, 0x38, 0x1f, 0x80, 0x39, 0x1f, 0x80, 0x38, 0x1f, 0x81, 0x39, 0x1f, 0x81, 0x38, 0x1f, 0xc2, 0x39, 0x1f, 0xc2, 0xbf, 0x03, 0x93, 0xbf, 0x03, 0x94, 0x40, 0x1f, 0x80, 0x40, 0x1f, 0x81, 0x9f, 0x03, 0x13, 0x03, 0x48, 0x1f, 0x80, 0x48, 0x1f, 0x81, 0xc5, 0x03, 0x13, 0x03, 0x50, 0x1f, 0x80, 0x50, 0x1f, 0x81, 0x50, 0x1f, 0xc2, 0xa5, 0x03, 0x94, 0x00, 0x00, 0x00, 0x59, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x59, 0x1f, 0x81, 0x00, 0x00, 0x00, 0x59, 0x1f, 0xc2, 0xc9, 0x03, 0x93, 0xc9, 0x03, 0x94, 0x60, 0x1f, 0x80, 0x61, 0x1f, 0x80, 0x60, 0x1f, 0x81, 0x61, 0x1f, 0x81, 0x60, 0x1f, 0xc2, 0x61, 0x1f, 0xc2, 0xa9, 0x03, 0x93, 0xa9, 0x03, 0x94, 0x68, 0x1f, 0x80, 0x69, 0x1f, 0x80, 0x68, 0x1f, 0x81, 0x69, 0x1f, 0x81, 0x68, 0x1f, 0xc2, 0x69, 0x1f, 0xc2, 0xb1, 0x03, 0x80, 0xb5, 0x03, 0x80, 0xb7, 0x03, 0x80, 0xb9, 0x03, 0x80, 0xbf, 0x03, 0x80, 0xc5, 0x03, 0x80, 0xc9, 0x03, 0x80, 0x00, 0x1f, 0x45, 0x03, 0x20, 0x1f, 0x45, 0x03, 0x60, 0x1f, 0x45, 0x03, 0xb1, 0x03, 0x86, 0xb1, 0x03, 0x84, 0x70, 0x1f, 0xc5, 0xb1, 0x03, 0xc5, 0xac, 0x03, 0xc5, 0x00, 0x00, 0x00, 0xb1, 0x03, 0xc2, 0xb6, 0x1f, 0xc5, 0x91, 0x03, 0x86, 0x91, 0x03, 0x84, 0x91, 0x03, 0x80, 0x91, 0x03, 0xc5, 0x20, 0x93, 0x20, 0x93, 0x20, 0xc2, 0xa8, 0x00, 0xc2, 0x74, 0x1f, 0xc5, 0xb7, 0x03, 0xc5, 0xae, 0x03, 0xc5, 0x00, 0x00, 0x00, 0xb7, 0x03, 0xc2, 0xc6, 0x1f, 0xc5, 0x95, 0x03, 0x80, 0x97, 0x03, 0x80, 0x97, 0x03, 0xc5, 0xbf, 0x1f, 0x80, 0xbf, 0x1f, 0x81, 0xbf, 0x1f, 0xc2, 0xb9, 0x03, 0x86, 0xb9, 0x03, 0x84, 0xca, 0x03, 0x80, 0x00, 0x03, 0xb9, 0x42, 0xca, 0x42, 0x99, 0x06, 0x99, 0x04, 0x99, 0x00, 0xfe, 0x1f, 0x80, 0xfe, 0x1f, 0x81, 0xfe, 0x1f, 0xc2, 0xc5, 0x03, 0x86, 0xc5, 0x03, 0x84, 0xcb, 0x03, 0x80, 0x00, 0x03, 0xc1, 0x13, 0xc1, 0x14, 0xc5, 0x42, 0xcb, 0x42, 0xa5, 0x06, 0xa5, 0x04, 0xa5, 0x00, 0xa1, 0x03, 0x94, 0xa8, 0x00, 0x80, 0x85, 0x03, 0x60, 0x00, 0x7c, 0x1f, 0xc5, 0xc9, 0x03, 0xc5, 0xce, 0x03, 0xc5, 0x00, 0x00, 0x00, 0xc9, 0x03, 0xc2, 0xf6, 0x1f, 0xc5, 0x9f, 0x03, 0x80, 0xa9, 0x03, 0x80, 0xa9, 0x03, 0xc5, 0x20, 0x94, 0x02, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb3, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x32, 0x20, 0x32, 0x20, 0x32, 0x20, 0x00, 0x00, 0x00, 0x35, 0x20, 0x35, 0x20, 0x35, 0x20, 0x00, 0x00, 0x00, 0x21, 0x21, 0x00, 0x00, 0x20, 0x85, 0x3f, 0x3f, 0x3f, 0x21, 0x21, 0x3f, 0x32, 0x20, 0x00, 0x00, 0x00, 0x00, 0x30, 0x69, 0x00, 0x00, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2b, 0x3d, 0x28, 0x29, 0x6e, 0x30, 0x00, 0x2b, 0x00, 0x12, 0x22, 0x3d, 0x00, 0x28, 0x00, 0x29, 0x00, 0x00, 0x00, 0x61, 0x00, 0x65, 0x00, 0x6f, 0x00, 0x78, 0x00, 0x59, 0x02, 0x68, 0x6b, 0x6c, 0x6d, 0x6e, 0x70, 0x73, 0x74, 0x52, 0x73, 0x61, 0x2f, 0x63, 0x61, 0x2f, 0x73, 0xb0, 0x00, 0x43, 0x63, 0x2f, 0x6f, 0x63, 0x2f, 0x75, 0xb0, 0x00, 0x46, 0x48, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0xdf, 0x01, 0x01, 0x04, 0x24, 0x4e, 0x6f, 0x50, 0x51, 0x52, 0x52, 0x52, 0x53, 0x4d, 0x54, 0x45, 0x4c, 0x54, 0x4d, 0x4b, 0x00, 0xc5, 0x00, 0x42, 0x43, 0x00, 0x65, 0x45, 0x46, 0x00, 0x4d, 0x6f, 0xd0, 0x05, 0x46, 0x41, 0x58, 0xc0, 0x03, 0xb3, 0x03, 0x93, 0x03, 0xa0, 0x03, 0x11, 0x22, 0x44, 0x64, 0x65, 0x69, 0x6a, 0x31, 0xd0, 0x37, 0x31, 0xd0, 0x39, 0x31, 0xd0, 0x31, 0x30, 0x31, 0xd0, 0x33, 0x32, 0xd0, 0x33, 0x31, 0xd0, 0x35, 0x32, 0xd0, 0x35, 0x33, 0xd0, 0x35, 0x34, 0xd0, 0x35, 0x31, 0xd0, 0x36, 0x35, 0xd0, 0x36, 0x31, 0xd0, 0x38, 0x33, 0xd0, 0x38, 0x35, 0xd0, 0x38, 0x37, 0xd0, 0x38, 0x31, 0xd0, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x56, 0x56, 0x49, 0x56, 0x49, 0x49, 0x56, 0x49, 0x49, 0x49, 0x49, 0x58, 0x58, 0x49, 0x58, 0x49, 0x49, 0x4c, 0x43, 0x44, 0x4d, 0x69, 0x69, 0x69, 0x69, 0x69, 0x69, 0x69, 0x76, 0x76, 0x69, 0x76, 0x69, 0x69, 0x76, 0x69, 0x69, 0x69, 0x69, 0x78, 0x78, 0x69, 0x78, 0x69, 0x69, 0x6c, 0x63, 0x64, 0x6d, 0x30, 0xd0, 0x33, 0x90, 0x21, 0xb8, 0x92, 0x21, 0xb8, 0x94, 0x21, 0xb8, 0xd0, 0x21, 0xb8, 0xd4, 0x21, 0xb8, 0xd2, 0x21, 0xb8, 0x03, 0x22, 0xb8, 0x08, 0x22, 0xb8, 0x0b, 0x22, 0xb8, 0x23, 0x22, 0xb8, 0x00, 0x00, 0x00, 0x25, 0x22, 0xb8, 0x2b, 0x22, 0x2b, 0x22, 0x2b, 0x22, 0x00, 0x00, 0x00, 0x2e, 0x22, 0x2e, 0x22, 0x2e, 0x22, 0x00, 0x00, 0x00, 0x3c, 0x22, 0xb8, 0x43, 0x22, 0xb8, 0x45, 0x22, 0xb8, 0x00, 0x00, 0x00, 0x48, 0x22, 0xb8, 0x3d, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x61, 0x22, 0xb8, 0x4d, 0x22, 0xb8, 0x3c, 0x00, 0xb8, 0x3e, 0x00, 0xb8, 0x64, 0x22, 0xb8, 0x65, 0x22, 0xb8, 0x72, 0x22, 0xb8, 0x76, 0x22, 0xb8, 0x7a, 0x22, 0xb8, 0x82, 0x22, 0xb8, 0x86, 0x22, 0xb8, 0xa2, 0x22, 0xb8, 0xa8, 0x22, 0xb8, 0xa9, 0x22, 0xb8, 0xab, 0x22, 0xb8, 0x7c, 0x22, 0xb8, 0x91, 0x22, 0xb8, 0xb2, 0x22, 0x38, 0x03, 0x08, 0x30, 0x31, 0x00, 0x31, 0x00, 0x30, 0x00, 0x32, 0x30, 0x28, 0x00, 0x31, 0x00, 0x29, 0x00, 0x28, 0x00, 0x31, 0x00, 0x30, 0x00, 0x29, 0x00, 0x28, 0x32, 0x30, 0x29, 0x31, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x32, 0x30, 0x2e, 0x28, 0x00, 0x61, 0x00, 0x29, 0x00, 0x41, 0x00, 0x61, 0x00, 0x2b, 0x22, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x3a, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0xdd, 0x2a, 0xb8, 0x6a, 0x56, 0x00, 0x4e, 0x00, 0x28, 0x36, 0x3f, 0x59, 0x85, 0x8c, 0xa0, 0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7, 0xfb, 0x12, 0x30, 0x00, 0x00, 0x41, 0x53, 0x44, 0x53, 0x45, 0x53, 0x4b, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x51, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x53, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x55, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x57, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x59, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x5d, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x61, 0x30, 0x99, 0x30, 0x64, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x66, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0x68, 0x30, 0x99, 0x30, 0x6f, 0x30, 0x99, 0x30, 0x72, 0x30, 0x99, 0x30, 0x75, 0x30, 0x99, 0x30, 0x78, 0x30, 0x99, 0x30, 0x7b, 0x30, 0x99, 0x30, 0x46, 0x30, 0x99, 0x30, 0x20, 0x00, 0x99, 0x30, 0x9d, 0x30, 0x99, 0x30, 0x88, 0x30, 0x8a, 0x30, 0xab, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xad, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xaf, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xb1, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xb3, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xb5, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xb7, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xbb, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x30, 0x99, 0x30, 0xc4, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x30, 0x99, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x30, 0x99, 0x30, 0xcf, 0x30, 0x99, 0x30, 0xd2, 0x30, 0x99, 0x30, 0xd5, 0x30, 0x99, 0x30, 0xd8, 0x30, 0x99, 0x30, 0xdb, 0x30, 0x99, 0x30, 0xa6, 0x30, 0x99, 0x30, 0xef, 0x30, 0x99, 0x30, 0xfd, 0x30, 0x99, 0x30, 0xb3, 0x30, 0xc8, 0x30, 0x00, 0x11, 0x00, 0x01, 0xaa, 0x02, 0xac, 0xad, 0x03, 0x04, 0x05, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0x1a, 0x06, 0x07, 0x08, 0x21, 0x09, 0x11, 0x61, 0x11, 0x14, 0x11, 0x4c, 0x00, 0x01, 0xb3, 0xb4, 0xb8, 0xba, 0xbf, 0xc3, 0xc5, 0x08, 0xc9, 0xcb, 0x09, 0x0a, 0x0c, 0x0e, 0x0f, 0x13, 0x15, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1e, 0x22, 0x2c, 0x33, 0x38, 0xdd, 0xde, 0x43, 0x44, 0x45, 0x70, 0x71, 0x74, 0x7d, 0x7e, 0x80, 0x8a, 0x8d, 0x00, 0x4e, 0x8c, 0x4e, 0x09, 0x4e, 0xdb, 0x56, 0x0a, 0x4e, 0x2d, 0x4e, 0x0b, 0x4e, 0x32, 0x75, 0x59, 0x4e, 0x19, 0x4e, 0x01, 0x4e, 0x29, 0x59, 0x30, 0x57, 0xba, 0x4e, 0x28, 0x00, 0x29, 0x00, 0x00, 0x11, 0x02, 0x11, 0x03, 0x11, 0x05, 0x11, 0x06, 0x11, 0x07, 0x11, 0x09, 0x11, 0x0b, 0x11, 0x0c, 0x11, 0x0e, 0x11, 0x0f, 0x11, 0x10, 0x11, 0x11, 0x11, 0x12, 0x11, 0x28, 0x00, 0x00, 0x11, 0x61, 0x11, 0x29, 0x00, 0x28, 0x00, 0x02, 0x11, 0x61, 0x11, 0x29, 0x00, 0x28, 0x00, 0x05, 0x11, 0x61, 0x11, 0x29, 0x00, 0x28, 0x00, 0x09, 0x11, 0x61, 0x11, 0x29, 0x00, 0x28, 0x00, 0x0b, 0x11, 0x61, 0x11, 0x29, 0x00, 0x28, 0x00, 0x0e, 0x11, 0x61, 0x11, 0x29, 0x00, 0x28, 0x00, 0x0c, 0x11, 0x6e, 0x11, 0x29, 0x00, 0x28, 0x00, 0x0b, 0x11, 0x69, 0x11, 0x0c, 0x11, 0x65, 0x11, 0xab, 0x11, 0x29, 0x00, 0x28, 0x00, 0x0b, 0x11, 0x69, 0x11, 0x12, 0x11, 0x6e, 0x11, 0x29, 0x00, 0x28, 0x00, 0x29, 0x00, 0x00, 0x4e, 0x8c, 0x4e, 0x09, 0x4e, 0xdb, 0x56, 0x94, 0x4e, 0x6d, 0x51, 0x03, 0x4e, 0x6b, 0x51, 0x5d, 0x4e, 0x41, 0x53, 0x08, 0x67, 0x6b, 0x70, 0x34, 0x6c, 0x28, 0x67, 0xd1, 0x91, 0x1f, 0x57, 0xe5, 0x65, 0x2a, 0x68, 0x09, 0x67, 0x3e, 0x79, 0x0d, 0x54, 0x79, 0x72, 0xa1, 0x8c, 0x5d, 0x79, 0xb4, 0x52, 0xe3, 0x4e, 0x7c, 0x54, 0x66, 0x5b, 0xe3, 0x76, 0x01, 0x4f, 0xc7, 0x8c, 0x54, 0x53, 0x6d, 0x79, 0x11, 0x4f, 0xea, 0x81, 0xf3, 0x81, 0x4f, 0x55, 0x7c, 0x5e, 0x87, 0x65, 0x8f, 0x7b, 0x50, 0x54, 0x45, 0x32, 0x00, 0x31, 0x00, 0x33, 0x00, 0x30, 0x00, 0x00, 0x11, 0x00, 0x02, 0x03, 0x05, 0x06, 0x07, 0x09, 0x0b, 0x0c, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x00, 0x11, 0x00, 0x61, 0x02, 0x61, 0x03, 0x61, 0x05, 0x61, 0x06, 0x61, 0x07, 0x61, 0x09, 0x61, 0x0b, 0x61, 0x0c, 0x61, 0x0e, 0x11, 0x61, 0x11, 0x00, 0x11, 0x0e, 0x61, 0xb7, 0x00, 0x69, 0x0b, 0x11, 0x01, 0x63, 0x00, 0x69, 0x0b, 0x11, 0x6e, 0x11, 0x00, 0x4e, 0x8c, 0x4e, 0x09, 0x4e, 0xdb, 0x56, 0x94, 0x4e, 0x6d, 0x51, 0x03, 0x4e, 0x6b, 0x51, 0x5d, 0x4e, 0x41, 0x53, 0x08, 0x67, 0x6b, 0x70, 0x34, 0x6c, 0x28, 0x67, 0xd1, 0x91, 0x1f, 0x57, 0xe5, 0x65, 0x2a, 0x68, 0x09, 0x67, 0x3e, 0x79, 0x0d, 0x54, 0x79, 0x72, 0xa1, 0x8c, 0x5d, 0x79, 0xb4, 0x52, 0xd8, 0x79, 0x37, 0x75, 0x73, 0x59, 0x69, 0x90, 0x2a, 0x51, 0x70, 0x53, 0xe8, 0x6c, 0x05, 0x98, 0x11, 0x4f, 0x99, 0x51, 0x63, 0x6b, 0x0a, 0x4e, 0x2d, 0x4e, 0x0b, 0x4e, 0xe6, 0x5d, 0xf3, 0x53, 0x3b, 0x53, 0x97, 0x5b, 0x66, 0x5b, 0xe3, 0x76, 0x01, 0x4f, 0xc7, 0x8c, 0x54, 0x53, 0x1c, 0x59, 0x33, 0x00, 0x36, 0x00, 0x34, 0x00, 0x30, 0x00, 0x35, 0x30, 0x31, 0x00, 0x08, 0x67, 0x31, 0x00, 0x30, 0x00, 0x08, 0x67, 0x48, 0x67, 0x65, 0x72, 0x67, 0x65, 0x56, 0x4c, 0x54, 0x44, 0xa2, 0x30, 0x00, 0x02, 0x04, 0x06, 0x08, 0x09, 0x0b, 0x0d, 0x0f, 0x11, 0x13, 0x15, 0x17, 0x19, 0x1b, 0x1d, 0x1f, 0x22, 0x24, 0x26, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x30, 0x33, 0x36, 0x39, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x42, 0x44, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4d, 0x4e, 0x4f, 0x50, 0xe4, 0x4e, 0x8c, 0x54, 0xa1, 0x30, 0x01, 0x30, 0x5b, 0x27, 0x01, 0x4a, 0x34, 0x00, 0x01, 0x52, 0x39, 0x01, 0xa2, 0x30, 0x00, 0x5a, 0x49, 0xa4, 0x30, 0x00, 0x27, 0x4f, 0x0c, 0xa4, 0x30, 0x00, 0x4f, 0x1d, 0x02, 0x05, 0x4f, 0xa8, 0x30, 0x00, 0x11, 0x07, 0x54, 0x21, 0xa8, 0x30, 0x00, 0x54, 0x03, 0x54, 0xa4, 0x30, 0x06, 0x4f, 0x15, 0x06, 0x58, 0x3c, 0x07, 0x00, 0x46, 0xab, 0x30, 0x00, 0x3e, 0x18, 0x1d, 0x00, 0x42, 0x3f, 0x51, 0xac, 0x30, 0x00, 0x41, 0x47, 0x00, 0x47, 0x32, 0xae, 0x30, 0xac, 0x30, 0xae, 0x30, 0x00, 0x1d, 0x4e, 0xad, 0x30, 0x00, 0x38, 0x3d, 0x4f, 0x01, 0x3e, 0x13, 0x4f, 0xad, 0x30, 0xed, 0x30, 0xad, 0x30, 0x00, 0x40, 0x03, 0x3c, 0x33, 0xad, 0x30, 0x00, 0x40, 0x34, 0x4f, 0x1b, 0x3e, 0xad, 0x30, 0x00, 0x40, 0x42, 0x16, 0x1b, 0xb0, 0x30, 0x00, 0x39, 0x30, 0xa4, 0x30, 0x0c, 0x45, 0x3c, 0x24, 0x4f, 0x0b, 0x47, 0x18, 0x00, 0x49, 0xaf, 0x30, 0x00, 0x3e, 0x4d, 0x1e, 0xb1, 0x30, 0x00, 0x4b, 0x08, 0x02, 0x3a, 0x19, 0x02, 0x4b, 0x2c, 0xa4, 0x30, 0x11, 0x00, 0x0b, 0x47, 0xb5, 0x30, 0x00, 0x3e, 0x0c, 0x47, 0x2b, 0xb0, 0x30, 0x07, 0x3a, 0x43, 0x00, 0xb9, 0x30, 0x02, 0x3a, 0x08, 0x02, 0x3a, 0x0f, 0x07, 0x43, 0x00, 0xb7, 0x30, 0x10, 0x00, 0x12, 0x34, 0x11, 0x3c, 0x13, 0x17, 0xa4, 0x30, 0x2a, 0x1f, 0x24, 0x2b, 0x00, 0x20, 0xbb, 0x30, 0x16, 0x41, 0x00, 0x38, 0x0d, 0xc4, 0x30, 0x0d, 0x38, 0x00, 0xd0, 0x30, 0x00, 0x2c, 0x1c, 0x1b, 0xa2, 0x30, 0x32, 0x00, 0x17, 0x26, 0x49, 0xaf, 0x30, 0x25, 0x00, 0x3c, 0xb3, 0x30, 0x21, 0x00, 0x20, 0x38, 0xa1, 0x30, 0x34, 0x00, 0x48, 0x22, 0x28, 0xa3, 0x30, 0x32, 0x00, 0x59, 0x25, 0xa7, 0x30, 0x2f, 0x1c, 0x10, 0x00, 0x44, 0xd5, 0x30, 0x00, 0x14, 0x1e, 0xaf, 0x30, 0x29, 0x00, 0x10, 0x4d, 0x3c, 0xda, 0x30, 0xbd, 0x30, 0xb8, 0x30, 0x22, 0x13, 0x1a, 0x20, 0x33, 0x0c, 0x22, 0x3b, 0x01, 0x22, 0x44, 0x00, 0x21, 0x44, 0x07, 0xa4, 0x30, 0x39, 0x00, 0x4f, 0x24, 0xc8, 0x30, 0x14, 0x23, 0x00, 0xdb, 0x30, 0xf3, 0x30, 0xc9, 0x30, 0x14, 0x2a, 0x00, 0x12, 0x33, 0x22, 0x12, 0x33, 0x2a, 0xa4, 0x30, 0x3a, 0x00, 0x0b, 0x49, 0xa4, 0x30, 0x3a, 0x00, 0x47, 0x3a, 0x1f, 0x2b, 0x3a, 0x47, 0x0b, 0xb7, 0x30, 0x27, 0x3c, 0x00, 0x30, 0x3c, 0xaf, 0x30, 0x30, 0x00, 0x3e, 0x44, 0xdf, 0x30, 0xea, 0x30, 0xd0, 0x30, 0x0f, 0x1a, 0x00, 0x2c, 0x1b, 0xe1, 0x30, 0xac, 0x30, 0xac, 0x30, 0x35, 0x00, 0x1c, 0x47, 0x35, 0x50, 0x1c, 0x3f, 0xa2, 0x30, 0x42, 0x5a, 0x27, 0x42, 0x5a, 0x49, 0x44, 0x00, 0x51, 0xc3, 0x30, 0x27, 0x00, 0x05, 0x28, 0xea, 0x30, 0xe9, 0x30, 0xd4, 0x30, 0x17, 0x00, 0x28, 0xd6, 0x30, 0x15, 0x26, 0x00, 0x15, 0xec, 0x30, 0xe0, 0x30, 0xb2, 0x30, 0x3a, 0x41, 0x16, 0x00, 0x41, 0xc3, 0x30, 0x2c, 0x00, 0x05, 0x30, 0x00, 0xb9, 0x70, 0x31, 0x00, 0x30, 0x00, 0xb9, 0x70, 0x32, 0x00, 0x30, 0x00, 0xb9, 0x70, 0x68, 0x50, 0x61, 0x64, 0x61, 0x41, 0x55, 0x62, 0x61, 0x72, 0x6f, 0x56, 0x70, 0x63, 0x64, 0x6d, 0x64, 0x00, 0x6d, 0x00, 0xb2, 0x00, 0x49, 0x00, 0x55, 0x00, 0x73, 0x5e, 0x10, 0x62, 0x2d, 0x66, 0x8c, 0x54, 0x27, 0x59, 0x63, 0x6b, 0x0e, 0x66, 0xbb, 0x6c, 0x2a, 0x68, 0x0f, 0x5f, 0x1a, 0x4f, 0x3e, 0x79, 0x70, 0x00, 0x41, 0x6e, 0x00, 0x41, 0xbc, 0x03, 0x41, 0x6d, 0x00, 0x41, 0x6b, 0x00, 0x41, 0x4b, 0x00, 0x42, 0x4d, 0x00, 0x42, 0x47, 0x00, 0x42, 0x63, 0x61, 0x6c, 0x6b, 0x63, 0x61, 0x6c, 0x70, 0x00, 0x46, 0x6e, 0x00, 0x46, 0xbc, 0x03, 0x46, 0xbc, 0x03, 0x67, 0x6d, 0x00, 0x67, 0x6b, 0x00, 0x67, 0x48, 0x00, 0x7a, 0x6b, 0x48, 0x7a, 0x4d, 0x48, 0x7a, 0x47, 0x48, 0x7a, 0x54, 0x48, 0x7a, 0xbc, 0x03, 0x13, 0x21, 0x6d, 0x00, 0x13, 0x21, 0x64, 0x00, 0x13, 0x21, 0x6b, 0x00, 0x13, 0x21, 0x66, 0x00, 0x6d, 0x6e, 0x00, 0x6d, 0xbc, 0x03, 0x6d, 0x6d, 0x00, 0x6d, 0x63, 0x00, 0x6d, 0x6b, 0x00, 0x6d, 0x63, 0x00, 0x0a, 0x0a, 0x4f, 0x00, 0x0a, 0x4f, 0x6d, 0x00, 0xb2, 0x00, 0x63, 0x00, 0x08, 0x0a, 0x4f, 0x0a, 0x0a, 0x50, 0x00, 0x0a, 0x50, 0x6d, 0x00, 0xb3, 0x00, 0x6b, 0x00, 0x6d, 0x00, 0xb3, 0x00, 0x6d, 0x00, 0x15, 0x22, 0x73, 0x00, 0x6d, 0x00, 0x15, 0x22, 0x73, 0x00, 0xb2, 0x00, 0x50, 0x61, 0x6b, 0x50, 0x61, 0x4d, 0x50, 0x61, 0x47, 0x50, 0x61, 0x72, 0x61, 0x64, 0x72, 0x61, 0x64, 0xd1, 0x73, 0x72, 0x00, 0x61, 0x00, 0x64, 0x00, 0x15, 0x22, 0x73, 0x00, 0xb2, 0x00, 0x70, 0x00, 0x73, 0x6e, 0x00, 0x73, 0xbc, 0x03, 0x73, 0x6d, 0x00, 0x73, 0x70, 0x00, 0x56, 0x6e, 0x00, 0x56, 0xbc, 0x03, 0x56, 0x6d, 0x00, 0x56, 0x6b, 0x00, 0x56, 0x4d, 0x00, 0x56, 0x70, 0x00, 0x57, 0x6e, 0x00, 0x57, 0xbc, 0x03, 0x57, 0x6d, 0x00, 0x57, 0x6b, 0x00, 0x57, 0x4d, 0x00, 0x57, 0x6b, 0x00, 0xa9, 0x03, 0x4d, 0x00, 0xa9, 0x03, 0x61, 0x2e, 0x6d, 0x2e, 0x42, 0x71, 0x63, 0x63, 0x63, 0x64, 0x43, 0xd1, 0x6b, 0x67, 0x43, 0x6f, 0x2e, 0x64, 0x42, 0x47, 0x79, 0x68, 0x61, 0x48, 0x50, 0x69, 0x6e, 0x4b, 0x4b, 0x4b, 0x4d, 0x6b, 0x74, 0x6c, 0x6d, 0x6c, 0x6e, 0x6c, 0x6f, 0x67, 0x6c, 0x78, 0x6d, 0x62, 0x6d, 0x69, 0x6c, 0x6d, 0x6f, 0x6c, 0x50, 0x48, 0x70, 0x2e, 0x6d, 0x2e, 0x50, 0x50, 0x4d, 0x50, 0x52, 0x73, 0x72, 0x53, 0x76, 0x57, 0x62, 0x56, 0xd1, 0x6d, 0x41, 0xd1, 0x6d, 0x31, 0x00, 0xe5, 0x65, 0x31, 0x00, 0x30, 0x00, 0xe5, 0x65, 0x32, 0x00, 0x30, 0x00, 0xe5, 0x65, 0x33, 0x00, 0x30, 0x00, 0xe5, 0x65, 0x67, 0x61, 0x6c, 0x4a, 0x04, 0x4c, 0x04, 0x43, 0x46, 0x51, 0x26, 0x01, 0x53, 0x01, 0x27, 0xa7, 0x37, 0xab, 0x6b, 0x02, 0x52, 0xab, 0x48, 0x8c, 0xf4, 0x66, 0xca, 0x8e, 0xc8, 0x8c, 0xd1, 0x6e, 0x32, 0x4e, 0xe5, 0x53, 0x9c, 0x9f, 0x9c, 0x9f, 0x51, 0x59, 0xd1, 0x91, 0x87, 0x55, 0x48, 0x59, 0xf6, 0x61, 0x69, 0x76, 0x85, 0x7f, 0x3f, 0x86, 0xba, 0x87, 0xf8, 0x88, 0x8f, 0x90, 0x02, 0x6a, 0x1b, 0x6d, 0xd9, 0x70, 0xde, 0x73, 0x3d, 0x84, 0x6a, 0x91, 0xf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, 0x4e, 0x69, 0x51, 0xc9, 0x51, 0x81, 0x68, 0xe7, 0x7c, 0x6f, 0x82, 0xd2, 0x8a, 0xcf, 0x91, 0xf5, 0x52, 0x42, 0x54, 0x73, 0x59, 0xec, 0x5e, 0xc5, 0x65, 0xfe, 0x6f, 0x2a, 0x79, 0xad, 0x95, 0x6a, 0x9a, 0x97, 0x9e, 0xce, 0x9e, 0x9b, 0x52, 0xc6, 0x66, 0x77, 0x6b, 0x62, 0x8f, 0x74, 0x5e, 0x90, 0x61, 0x00, 0x62, 0x9a, 0x64, 0x23, 0x6f, 0x49, 0x71, 0x89, 0x74, 0xca, 0x79, 0xf4, 0x7d, 0x6f, 0x80, 0x26, 0x8f, 0xee, 0x84, 0x23, 0x90, 0x4a, 0x93, 0x17, 0x52, 0xa3, 0x52, 0xbd, 0x54, 0xc8, 0x70, 0xc2, 0x88, 0xaa, 0x8a, 0xc9, 0x5e, 0xf5, 0x5f, 0x7b, 0x63, 0xae, 0x6b, 0x3e, 0x7c, 0x75, 0x73, 0xe4, 0x4e, 0xf9, 0x56, 0xe7, 0x5b, 0xba, 0x5d, 0x1c, 0x60, 0xb2, 0x73, 0x69, 0x74, 0x9a, 0x7f, 0x46, 0x80, 0x34, 0x92, 0xf6, 0x96, 0x48, 0x97, 0x18, 0x98, 0x8b, 0x4f, 0xae, 0x79, 0xb4, 0x91, 0xb8, 0x96, 0xe1, 0x60, 0x86, 0x4e, 0xda, 0x50, 0xee, 0x5b, 0x3f, 0x5c, 0x99, 0x65, 0x02, 0x6a, 0xce, 0x71, 0x42, 0x76, 0xfc, 0x84, 0x7c, 0x90, 0x8d, 0x9f, 0x88, 0x66, 0x2e, 0x96, 0x89, 0x52, 0x7b, 0x67, 0xf3, 0x67, 0x41, 0x6d, 0x9c, 0x6e, 0x09, 0x74, 0x59, 0x75, 0x6b, 0x78, 0x10, 0x7d, 0x5e, 0x98, 0x6d, 0x51, 0x2e, 0x62, 0x78, 0x96, 0x2b, 0x50, 0x19, 0x5d, 0xea, 0x6d, 0x2a, 0x8f, 0x8b, 0x5f, 0x44, 0x61, 0x17, 0x68, 0x87, 0x73, 0x86, 0x96, 0x29, 0x52, 0x0f, 0x54, 0x65, 0x5c, 0x13, 0x66, 0x4e, 0x67, 0xa8, 0x68, 0xe5, 0x6c, 0x06, 0x74, 0xe2, 0x75, 0x79, 0x7f, 0xcf, 0x88, 0xe1, 0x88, 0xcc, 0x91, 0xe2, 0x96, 0x3f, 0x53, 0xba, 0x6e, 0x1d, 0x54, 0xd0, 0x71, 0x98, 0x74, 0xfa, 0x85, 0xa3, 0x96, 0x57, 0x9c, 0x9f, 0x9e, 0x97, 0x67, 0xcb, 0x6d, 0xe8, 0x81, 0xcb, 0x7a, 0x20, 0x7b, 0x92, 0x7c, 0xc0, 0x72, 0x99, 0x70, 0x58, 0x8b, 0xc0, 0x4e, 0x36, 0x83, 0x3a, 0x52, 0x07, 0x52, 0xa6, 0x5e, 0xd3, 0x62, 0xd6, 0x7c, 0x85, 0x5b, 0x1e, 0x6d, 0xb4, 0x66, 0x3b, 0x8f, 0x4c, 0x88, 0x4d, 0x96, 0x8b, 0x89, 0xd3, 0x5e, 0x40, 0x51, 0xc0, 0x55, 0x00, 0x00, 0x00, 0x00, 0x5a, 0x58, 0x00, 0x00, 0x74, 0x66, 0x00, 0x00, 0x00, 0x00, 0xde, 0x51, 0x2a, 0x73, 0xca, 0x76, 0x3c, 0x79, 0x5e, 0x79, 0x65, 0x79, 0x8f, 0x79, 0x56, 0x97, 0xbe, 0x7c, 0xbd, 0x7f, 0x00, 0x00, 0x12, 0x86, 0x00, 0x00, 0xf8, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x38, 0x90, 0xfd, 0x90, 0xef, 0x98, 0xfc, 0x98, 0x28, 0x99, 0xb4, 0x9d, 0xde, 0x90, 0xb7, 0x96, 0xae, 0x4f, 0xe7, 0x50, 0x4d, 0x51, 0xc9, 0x52, 0xe4, 0x52, 0x51, 0x53, 0x9d, 0x55, 0x06, 0x56, 0x68, 0x56, 0x40, 0x58, 0xa8, 0x58, 0x64, 0x5c, 0x6e, 0x5c, 0x94, 0x60, 0x68, 0x61, 0x8e, 0x61, 0xf2, 0x61, 0x4f, 0x65, 0xe2, 0x65, 0x91, 0x66, 0x85, 0x68, 0x77, 0x6d, 0x1a, 0x6e, 0x22, 0x6f, 0x6e, 0x71, 0x2b, 0x72, 0x22, 0x74, 0x91, 0x78, 0x3e, 0x79, 0x49, 0x79, 0x48, 0x79, 0x50, 0x79, 0x56, 0x79, 0x5d, 0x79, 0x8d, 0x79, 0x8e, 0x79, 0x40, 0x7a, 0x81, 0x7a, 0xc0, 0x7b, 0xf4, 0x7d, 0x09, 0x7e, 0x41, 0x7e, 0x72, 0x7f, 0x05, 0x80, 0xed, 0x81, 0x79, 0x82, 0x79, 0x82, 0x57, 0x84, 0x10, 0x89, 0x96, 0x89, 0x01, 0x8b, 0x39, 0x8b, 0xd3, 0x8c, 0x08, 0x8d, 0xb6, 0x8f, 0x38, 0x90, 0xe3, 0x96, 0xff, 0x97, 0x3b, 0x98, 0x75, 0x60, 0xee, 0x42, 0x18, 0x82, 0x02, 0x26, 0x4e, 0xb5, 0x51, 0x68, 0x51, 0x80, 0x4f, 0x45, 0x51, 0x80, 0x51, 0xc7, 0x52, 0xfa, 0x52, 0x9d, 0x55, 0x55, 0x55, 0x99, 0x55, 0xe2, 0x55, 0x5a, 0x58, 0xb3, 0x58, 0x44, 0x59, 0x54, 0x59, 0x62, 0x5a, 0x28, 0x5b, 0xd2, 0x5e, 0xd9, 0x5e, 0x69, 0x5f, 0xad, 0x5f, 0xd8, 0x60, 0x4e, 0x61, 0x08, 0x61, 0x8e, 0x61, 0x60, 0x61, 0xf2, 0x61, 0x34, 0x62, 0xc4, 0x63, 0x1c, 0x64, 0x52, 0x64, 0x56, 0x65, 0x74, 0x66, 0x17, 0x67, 0x1b, 0x67, 0x56, 0x67, 0x79, 0x6b, 0xba, 0x6b, 0x41, 0x6d, 0xdb, 0x6e, 0xcb, 0x6e, 0x22, 0x6f, 0x1e, 0x70, 0x6e, 0x71, 0xa7, 0x77, 0x35, 0x72, 0xaf, 0x72, 0x2a, 0x73, 0x71, 0x74, 0x06, 0x75, 0x3b, 0x75, 0x1d, 0x76, 0x1f, 0x76, 0xca, 0x76, 0xdb, 0x76, 0xf4, 0x76, 0x4a, 0x77, 0x40, 0x77, 0xcc, 0x78, 0xb1, 0x7a, 0xc0, 0x7b, 0x7b, 0x7c, 0x5b, 0x7d, 0xf4, 0x7d, 0x3e, 0x7f, 0x05, 0x80, 0x52, 0x83, 0xef, 0x83, 0x79, 0x87, 0x41, 0x89, 0x86, 0x89, 0x96, 0x89, 0xbf, 0x8a, 0xf8, 0x8a, 0xcb, 0x8a, 0x01, 0x8b, 0xfe, 0x8a, 0xed, 0x8a, 0x39, 0x8b, 0x8a, 0x8b, 0x08, 0x8d, 0x38, 0x8f, 0x72, 0x90, 0x99, 0x91, 0x76, 0x92, 0x7c, 0x96, 0xe3, 0x96, 0x56, 0x97, 0xdb, 0x97, 0xff, 0x97, 0x0b, 0x98, 0x3b, 0x98, 0x12, 0x9b, 0x9c, 0x9f, 0x4a, 0x28, 0x44, 0x28, 0xd5, 0x33, 0x9d, 0x3b, 0x18, 0x40, 0x39, 0x40, 0x49, 0x52, 0xd0, 0x5c, 0xd3, 0x7e, 0x43, 0x9f, 0x8e, 0x9f, 0x2a, 0xa0, 0x02, 0x66, 0x66, 0x66, 0x69, 0x66, 0x6c, 0x66, 0x66, 0x69, 0x66, 0x66, 0x6c, 0x7f, 0x01, 0x74, 0x73, 0x00, 0x74, 0x65, 0x05, 0x0f, 0x11, 0x0f, 0x00, 0x0f, 0x06, 0x19, 0x11, 0x0f, 0x08, 0xd9, 0x05, 0xb4, 0x05, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x05, 0xb7, 0x05, 0xd0, 0x05, 0x12, 0x00, 0x03, 0x04, 0x0b, 0x0c, 0x0d, 0x18, 0x1a, 0xe9, 0x05, 0xc1, 0x05, 0xe9, 0x05, 0xc2, 0x05, 0x49, 0xfb, 0xc1, 0x05, 0x49, 0xfb, 0xc2, 0x05, 0xd0, 0x05, 0xb7, 0x05, 0xd0, 0x05, 0xb8, 0x05, 0xd0, 0x05, 0xbc, 0x05, 0xd8, 0x05, 0xbc, 0x05, 0xde, 0x05, 0xbc, 0x05, 0xe0, 0x05, 0xbc, 0x05, 0xe3, 0x05, 0xbc, 0x05, 0xb9, 0x05, 0x2d, 0x03, 0x2e, 0x03, 0x2f, 0x03, 0x30, 0x03, 0x31, 0x03, 0x1c, 0x00, 0x18, 0x06, 0x22, 0x06, 0x2b, 0x06, 0xd0, 0x05, 0xdc, 0x05, 0x71, 0x06, 0x00, 0x00, 0x0a, 0x0a, 0x0a, 0x0a, 0x0d, 0x0d, 0x0d, 0x0d, 0x0f, 0x0f, 0x0f, 0x0f, 0x09, 0x09, 0x09, 0x09, 0x0e, 0x0e, 0x0e, 0x0e, 0x08, 0x08, 0x08, 0x08, 0x33, 0x33, 0x33, 0x33, 0x35, 0x35, 0x35, 0x35, 0x13, 0x13, 0x13, 0x13, 0x12, 0x12, 0x12, 0x12, 0x15, 0x15, 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x1c, 0x1c, 0x1b, 0x1b, 0x1d, 0x1d, 0x17, 0x17, 0x27, 0x27, 0x20, 0x20, 0x38, 0x38, 0x38, 0x38, 0x3e, 0x3e, 0x3e, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x40, 0x40, 0x40, 0x40, 0x49, 0x49, 0x4a, 0x4a, 0x4a, 0x4a, 0x4f, 0x4f, 0x50, 0x50, 0x50, 0x50, 0x4d, 0x4d, 0x4d, 0x4d, 0x61, 0x61, 0x62, 0x62, 0x49, 0x06, 0x64, 0x64, 0x64, 0x64, 0x7e, 0x7e, 0x7d, 0x7d, 0x7f, 0x7f, 0x2e, 0x82, 0x82, 0x7c, 0x7c, 0x80, 0x80, 0x87, 0x87, 0x87, 0x87, 0x00, 0x00, 0x26, 0x06, 0x00, 0x01, 0x00, 0x01, 0x00, 0xaf, 0x00, 0xaf, 0x00, 0x22, 0x00, 0x22, 0x00, 0xa1, 0x00, 0xa1, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa2, 0x00, 0xa2, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0x23, 0x00, 0x23, 0x00, 0x23, 0xcc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x26, 0x06, 0x00, 0x06, 0x00, 0x07, 0x00, 0x1f, 0x00, 0x23, 0x00, 0x24, 0x02, 0x06, 0x02, 0x07, 0x02, 0x08, 0x02, 0x1f, 0x02, 0x23, 0x02, 0x24, 0x04, 0x06, 0x04, 0x07, 0x04, 0x08, 0x04, 0x1f, 0x04, 0x23, 0x04, 0x24, 0x05, 0x06, 0x05, 0x1f, 0x05, 0x23, 0x05, 0x24, 0x06, 0x07, 0x06, 0x1f, 0x07, 0x06, 0x07, 0x1f, 0x08, 0x06, 0x08, 0x07, 0x08, 0x1f, 0x0d, 0x06, 0x0d, 0x07, 0x0d, 0x08, 0x0d, 0x1f, 0x0f, 0x07, 0x0f, 0x1f, 0x10, 0x06, 0x10, 0x07, 0x10, 0x08, 0x10, 0x1f, 0x11, 0x07, 0x11, 0x1f, 0x12, 0x1f, 0x13, 0x06, 0x13, 0x1f, 0x14, 0x06, 0x14, 0x1f, 0x1b, 0x06, 0x1b, 0x07, 0x1b, 0x08, 0x1b, 0x1f, 0x1b, 0x23, 0x1b, 0x24, 0x1c, 0x07, 0x1c, 0x1f, 0x1c, 0x23, 0x1c, 0x24, 0x1d, 0x01, 0x1d, 0x06, 0x1d, 0x07, 0x1d, 0x08, 0x1d, 0x1e, 0x1d, 0x1f, 0x1d, 0x23, 0x1d, 0x24, 0x1e, 0x06, 0x1e, 0x07, 0x1e, 0x08, 0x1e, 0x1f, 0x1e, 0x23, 0x1e, 0x24, 0x1f, 0x06, 0x1f, 0x07, 0x1f, 0x08, 0x1f, 0x1f, 0x1f, 0x23, 0x1f, 0x24, 0x20, 0x06, 0x20, 0x07, 0x20, 0x08, 0x20, 0x1f, 0x20, 0x23, 0x20, 0x24, 0x21, 0x06, 0x21, 0x1f, 0x21, 0x23, 0x21, 0x24, 0x24, 0x06, 0x24, 0x07, 0x24, 0x08, 0x24, 0x1f, 0x24, 0x23, 0x24, 0x24, 0x0a, 0x4a, 0x0b, 0x4a, 0x23, 0x4a, 0x20, 0x00, 0x4c, 0x06, 0x51, 0x06, 0x51, 0x06, 0xff, 0x00, 0x1f, 0x26, 0x06, 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x1f, 0x00, 0x20, 0x00, 0x23, 0x00, 0x24, 0x02, 0x0b, 0x02, 0x0c, 0x02, 0x1f, 0x02, 0x20, 0x02, 0x23, 0x02, 0x24, 0x04, 0x0b, 0x04, 0x0c, 0x04, 0x1f, 0x26, 0x06, 0x04, 0x20, 0x04, 0x23, 0x04, 0x24, 0x05, 0x0b, 0x05, 0x0c, 0x05, 0x1f, 0x05, 0x20, 0x05, 0x23, 0x05, 0x24, 0x1b, 0x23, 0x1b, 0x24, 0x1c, 0x23, 0x1c, 0x24, 0x1d, 0x01, 0x1d, 0x1e, 0x1d, 0x1f, 0x1d, 0x23, 0x1d, 0x24, 0x1e, 0x1f, 0x1e, 0x23, 0x1e, 0x24, 0x1f, 0x01, 0x1f, 0x1f, 0x20, 0x0b, 0x20, 0x0c, 0x20, 0x1f, 0x20, 0x20, 0x20, 0x23, 0x20, 0x24, 0x23, 0x4a, 0x24, 0x0b, 0x24, 0x0c, 0x24, 0x1f, 0x24, 0x20, 0x24, 0x23, 0x24, 0x24, 0x00, 0x06, 0x00, 0x07, 0x00, 0x08, 0x00, 0x1f, 0x00, 0x21, 0x02, 0x06, 0x02, 0x07, 0x02, 0x08, 0x02, 0x1f, 0x02, 0x21, 0x04, 0x06, 0x04, 0x07, 0x04, 0x08, 0x04, 0x1f, 0x04, 0x21, 0x05, 0x1f, 0x06, 0x07, 0x06, 0x1f, 0x07, 0x06, 0x07, 0x1f, 0x08, 0x06, 0x08, 0x1f, 0x0d, 0x06, 0x0d, 0x07, 0x0d, 0x08, 0x0d, 0x1f, 0x0f, 0x07, 0x0f, 0x08, 0x0f, 0x1f, 0x10, 0x06, 0x10, 0x07, 0x10, 0x08, 0x10, 0x1f, 0x11, 0x07, 0x12, 0x1f, 0x13, 0x06, 0x13, 0x1f, 0x14, 0x06, 0x14, 0x1f, 0x1b, 0x06, 0x1b, 0x07, 0x1b, 0x08, 0x1b, 0x1f, 0x1c, 0x07, 0x1c, 0x1f, 0x1d, 0x06, 0x1d, 0x07, 0x1d, 0x08, 0x1d, 0x1e, 0x1d, 0x1f, 0x1e, 0x06, 0x1e, 0x07, 0x1e, 0x08, 0x1e, 0x1f, 0x1e, 0x21, 0x1f, 0x06, 0x1f, 0x07, 0x1f, 0x08, 0x1f, 0x1f, 0x20, 0x06, 0x20, 0x07, 0x20, 0x08, 0x20, 0x1f, 0x20, 0x21, 0x21, 0x06, 0x21, 0x1f, 0x21, 0x4a, 0x24, 0x06, 0x24, 0x07, 0x24, 0x08, 0x24, 0x1f, 0x24, 0x21, 0x00, 0x1f, 0x00, 0x21, 0x02, 0x1f, 0x02, 0x21, 0x04, 0x1f, 0x04, 0x21, 0x05, 0x1f, 0x05, 0x21, 0x0d, 0x1f, 0x0d, 0x21, 0x0e, 0x1f, 0x0e, 0x21, 0x1d, 0x1e, 0x1d, 0x1f, 0x1e, 0x1f, 0x20, 0x1f, 0x20, 0x21, 0x24, 0x1f, 0x24, 0x21, 0x40, 0x06, 0x4e, 0x06, 0x51, 0x06, 0x27, 0x06, 0x10, 0x22, 0x10, 0x23, 0x12, 0x22, 0x12, 0x23, 0x13, 0x22, 0x13, 0x23, 0x0c, 0x22, 0x0c, 0x23, 0x0d, 0x22, 0x0d, 0x23, 0x06, 0x22, 0x06, 0x23, 0x05, 0x22, 0x05, 0x23, 0x07, 0x22, 0x07, 0x23, 0x0e, 0x22, 0x0e, 0x23, 0x0f, 0x22, 0x0f, 0x23, 0x0d, 0x05, 0x0d, 0x06, 0x0d, 0x07, 0x0d, 0x1e, 0x0d, 0x0a, 0x0c, 0x0a, 0x0e, 0x0a, 0x0f, 0x0a, 0x10, 0x22, 0x10, 0x23, 0x12, 0x22, 0x12, 0x23, 0x13, 0x22, 0x13, 0x23, 0x0c, 0x22, 0x0c, 0x23, 0x0d, 0x22, 0x0d, 0x23, 0x06, 0x22, 0x06, 0x23, 0x05, 0x22, 0x05, 0x23, 0x07, 0x22, 0x07, 0x23, 0x0e, 0x22, 0x0e, 0x23, 0x0f, 0x22, 0x0f, 0x23, 0x0d, 0x05, 0x0d, 0x06, 0x0d, 0x07, 0x0d, 0x1e, 0x0d, 0x0a, 0x0c, 0x0a, 0x0e, 0x0a, 0x0f, 0x0a, 0x0d, 0x05, 0x0d, 0x06, 0x0d, 0x07, 0x0d, 0x1e, 0x0c, 0x20, 0x0d, 0x20, 0x10, 0x1e, 0x0c, 0x05, 0x0c, 0x06, 0x0c, 0x07, 0x0d, 0x05, 0x0d, 0x06, 0x0d, 0x07, 0x10, 0x1e, 0x11, 0x1e, 0x00, 0x24, 0x00, 0x24, 0x2a, 0x06, 0x00, 0x02, 0x1b, 0x00, 0x03, 0x02, 0x00, 0x03, 0x02, 0x00, 0x03, 0x1b, 0x00, 0x04, 0x1b, 0x00, 0x1b, 0x02, 0x00, 0x1b, 0x03, 0x00, 0x1b, 0x04, 0x02, 0x1b, 0x03, 0x02, 0x1b, 0x03, 0x03, 0x1b, 0x20, 0x03, 0x1b, 0x1f, 0x09, 0x03, 0x02, 0x09, 0x02, 0x03, 0x09, 0x02, 0x1f, 0x09, 0x1b, 0x03, 0x09, 0x1b, 0x03, 0x09, 0x1b, 0x02, 0x09, 0x1b, 0x1b, 0x09, 0x1b, 0x1b, 0x0b, 0x03, 0x03, 0x0b, 0x03, 0x03, 0x0b, 0x1b, 0x1b, 0x0a, 0x03, 0x1b, 0x0a, 0x03, 0x1b, 0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0b, 0x06, 0x21, 0x0d, 0x05, 0x22, 0x0c, 0x05, 0x22, 0x0e, 0x05, 0x22, 0x1c, 0x04, 0x22, 0x1c, 0x1d, 0x22, 0x22, 0x05, 0x22, 0x22, 0x04, 0x22, 0x22, 0x1d, 0x22, 0x1d, 0x1d, 0x22, 0x1a, 0x1d, 0x22, 0x1e, 0x05, 0x22, 0x1a, 0x1d, 0x05, 0x1c, 0x05, 0x1d, 0x11, 0x1d, 0x22, 0x1b, 0x1d, 0x22, 0x1e, 0x04, 0x05, 0x1d, 0x06, 0x22, 0x1c, 0x04, 0x1d, 0x1b, 0x1d, 0x1d, 0x1c, 0x04, 0x1d, 0x1e, 0x04, 0x05, 0x04, 0x05, 0x22, 0x05, 0x04, 0x22, 0x1d, 0x04, 0x22, 0x19, 0x1d, 0x22, 0x00, 0x05, 0x22, 0x1b, 0x1d, 0x1d, 0x11, 0x04, 0x1d, 0x0d, 0x1d, 0x1d, 0x0b, 0x06, 0x22, 0x1e, 0x04, 0x22, 0x35, 0x06, 0x00, 0x0f, 0x9d, 0x0d, 0x0f, 0x9d, 0x27, 0x06, 0x00, 0x1d, 0x1d, 0x20, 0x00, 0x1c, 0x01, 0x0a, 0x1e, 0x06, 0x1e, 0x08, 0x0e, 0x1d, 0x12, 0x1e, 0x0a, 0x0c, 0x21, 0x1d, 0x12, 0x1d, 0x23, 0x20, 0x21, 0x0c, 0x1d, 0x1e, 0x35, 0x06, 0x00, 0x0f, 0x14, 0x27, 0x06, 0x0e, 0x1d, 0x22, 0xff, 0x00, 0x1d, 0x1d, 0x20, 0xff, 0x12, 0x1d, 0x23, 0x20, 0xff, 0x21, 0x0c, 0x1d, 0x1e, 0x27, 0x06, 0x05, 0x1d, 0xff, 0x05, 0x1d, 0x00, 0x1d, 0x20, 0x27, 0x06, 0x0a, 0xa5, 0x00, 0x1d, 0x2c, 0x00, 0x01, 0x30, 0x02, 0x30, 0x3a, 0x00, 0x3b, 0x00, 0x21, 0x00, 0x3f, 0x00, 0x16, 0x30, 0x17, 0x30, 0x26, 0x20, 0x13, 0x20, 0x12, 0x01, 0x00, 0x5f, 0x5f, 0x28, 0x29, 0x7b, 0x7d, 0x08, 0x30, 0x0c, 0x0d, 0x08, 0x09, 0x02, 0x03, 0x00, 0x01, 0x04, 0x05, 0x06, 0x07, 0x5b, 0x00, 0x5d, 0x00, 0x3e, 0x20, 0x3e, 0x20, 0x3e, 0x20, 0x3e, 0x20, 0x5f, 0x00, 0x5f, 0x00, 0x5f, 0x00, 0x2c, 0x00, 0x01, 0x30, 0x2e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x3a, 0x00, 0x3f, 0x00, 0x21, 0x00, 0x14, 0x20, 0x28, 0x00, 0x29, 0x00, 0x7b, 0x00, 0x7d, 0x00, 0x14, 0x30, 0x15, 0x30, 0x23, 0x26, 0x2a, 0x2b, 0x2d, 0x3c, 0x3e, 0x3d, 0x00, 0x5c, 0x24, 0x25, 0x40, 0x40, 0x06, 0xff, 0x0b, 0x00, 0x0b, 0xff, 0x0c, 0x20, 0x00, 0x4d, 0x06, 0x40, 0x06, 0xff, 0x0e, 0x00, 0x0e, 0xff, 0x0f, 0x00, 0x0f, 0xff, 0x10, 0x00, 0x10, 0xff, 0x11, 0x00, 0x11, 0xff, 0x12, 0x00, 0x12, 0x21, 0x06, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0f, 0x0f, 0x10, 0x10, 0x11, 0x11, 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 0x18, 0x18, 0x18, 0x18, 0x19, 0x19, 0x19, 0x19, 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x21, 0x21, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x23, 0x24, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x29, 0x29, 0x29, 0x22, 0x06, 0x22, 0x00, 0x22, 0x00, 0x22, 0x01, 0x22, 0x01, 0x22, 0x03, 0x22, 0x03, 0x22, 0x05, 0x22, 0x05, 0x21, 0x00, 0x85, 0x29, 0x01, 0x30, 0x01, 0x0b, 0x0c, 0x00, 0xfa, 0xf1, 0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xe2, 0xe4, 0xe6, 0xc2, 0xfb, 0xa1, 0xa3, 0xa5, 0xa7, 0xa9, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, 0xc0, 0xc3, 0xc5, 0xc7, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xd1, 0xd4, 0xd7, 0xda, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe3, 0xe5, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xee, 0xf2, 0x98, 0x99, 0x31, 0x31, 0x4f, 0x31, 0x55, 0x31, 0x5b, 0x31, 0x61, 0x31, 0xa2, 0x00, 0xa3, 0x00, 0xac, 0x00, 0xaf, 0x00, 0xa6, 0x00, 0xa5, 0x00, 0xa9, 0x20, 0x00, 0x00, 0x02, 0x25, 0x90, 0x21, 0x91, 0x21, 0x92, 0x21, 0x93, 0x21, 0xa0, 0x25, 0xcb, 0x25, 0xd2, 0x05, 0x07, 0x03, 0x01, 0xda, 0x05, 0x07, 0x03, 0x01, 0xd0, 0x02, 0xd1, 0x02, 0xe6, 0x00, 0x99, 0x02, 0x53, 0x02, 0x00, 0x00, 0xa3, 0x02, 0x66, 0xab, 0xa5, 0x02, 0xa4, 0x02, 0x56, 0x02, 0x57, 0x02, 0x91, 0x1d, 0x58, 0x02, 0x5e, 0x02, 0xa9, 0x02, 0x64, 0x02, 0x62, 0x02, 0x60, 0x02, 0x9b, 0x02, 0x27, 0x01, 0x9c, 0x02, 0x67, 0x02, 0x84, 0x02, 0xaa, 0x02, 0xab, 0x02, 0x6c, 0x02, 0x04, 0xdf, 0x8e, 0xa7, 0x6e, 0x02, 0x05, 0xdf, 0x8e, 0x02, 0x06, 0xdf, 0xf8, 0x00, 0x76, 0x02, 0x77, 0x02, 0x71, 0x00, 0x7a, 0x02, 0x08, 0xdf, 0x7d, 0x02, 0x7e, 0x02, 0x80, 0x02, 0xa8, 0x02, 0xa6, 0x02, 0x67, 0xab, 0xa7, 0x02, 0x88, 0x02, 0x71, 0x2c, 0x00, 0x00, 0x8f, 0x02, 0xa1, 0x02, 0xa2, 0x02, 0x98, 0x02, 0xc0, 0x01, 0xc1, 0x01, 0xc2, 0x01, 0x0a, 0xdf, 0x1e, 0xdf, 0x41, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x14, 0x99, 0x10, 0xba, 0x10, 0x00, 0x00, 0x00, 0x00, 0x9b, 0x10, 0xba, 0x10, 0x05, 0x05, 0xa5, 0x10, 0xba, 0x10, 0x05, 0x31, 0x11, 0x27, 0x11, 0x32, 0x11, 0x27, 0x11, 0x55, 0x47, 0x13, 0x3e, 0x13, 0x47, 0x13, 0x57, 0x13, 0x55, 0x82, 0x13, 0xc9, 0x13, 0x00, 0x00, 0x00, 0x00, 0x84, 0x13, 0xbb, 0x13, 0x05, 0x05, 0x8b, 0x13, 0xc2, 0x13, 0x05, 0x90, 0x13, 0xc9, 0x13, 0x05, 0xc2, 0x13, 0xc2, 0x13, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x13, 0xb8, 0x13, 0xc2, 0x13, 0xc9, 0x13, 0x05, 0x55, 0xb9, 0x14, 0xba, 0x14, 0xb9, 0x14, 0xb0, 0x14, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x14, 0xbd, 0x14, 0x55, 0x50, 0xb8, 0x15, 0xaf, 0x15, 0xb9, 0x15, 0xaf, 0x15, 0x55, 0x35, 0x19, 0x30, 0x19, 0x05, 0x1e, 0x61, 0x1e, 0x61, 0x1e, 0x61, 0x29, 0x61, 0x1e, 0x61, 0x1f, 0x61, 0x29, 0x61, 0x1f, 0x61, 0x1e, 0x61, 0x20, 0x61, 0x21, 0x61, 0x1f, 0x61, 0x22, 0x61, 0x1f, 0x61, 0x21, 0x61, 0x20, 0x61, 0x55, 0x55, 0x55, 0x55, 0x67, 0x6d, 0x67, 0x6d, 0x63, 0x6d, 0x67, 0x6d, 0x69, 0x6d, 0x67, 0x6d, 0x55, 0x05, 0x41, 0x00, 0x30, 0x00, 0x57, 0xd1, 0x65, 0xd1, 0x58, 0xd1, 0x65, 0xd1, 0x5f, 0xd1, 0x6e, 0xd1, 0x5f, 0xd1, 0x6f, 0xd1, 0x5f, 0xd1, 0x70, 0xd1, 0x5f, 0xd1, 0x71, 0xd1, 0x5f, 0xd1, 0x72, 0xd1, 0x55, 0x55, 0x55, 0x05, 0xb9, 0xd1, 0x65, 0xd1, 0xba, 0xd1, 0x65, 0xd1, 0xbb, 0xd1, 0x6e, 0xd1, 0xbc, 0xd1, 0x6e, 0xd1, 0xbb, 0xd1, 0x6f, 0xd1, 0xbc, 0xd1, 0x6f, 0xd1, 0x55, 0x55, 0x55, 0x41, 0x00, 0x61, 0x00, 0x41, 0x00, 0x61, 0x00, 0x69, 0x00, 0x41, 0x00, 0x61, 0x00, 0x41, 0x00, 0x43, 0x44, 0x00, 0x00, 0x47, 0x00, 0x00, 0x4a, 0x4b, 0x00, 0x00, 0x4e, 0x4f, 0x50, 0x51, 0x00, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64, 0x00, 0x66, 0x68, 0x00, 0x70, 0x00, 0x41, 0x00, 0x61, 0x00, 0x41, 0x42, 0x00, 0x44, 0x45, 0x46, 0x47, 0x4a, 0x00, 0x53, 0x00, 0x61, 0x00, 0x41, 0x42, 0x00, 0x44, 0x45, 0x46, 0x47, 0x00, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x00, 0x4f, 0x53, 0x00, 0x61, 0x00, 0x41, 0x00, 0x61, 0x00, 0x41, 0x00, 0x61, 0x00, 0x41, 0x00, 0x61, 0x00, 0x41, 0x00, 0x61, 0x00, 0x41, 0x00, 0x61, 0x00, 0x41, 0x00, 0x61, 0x00, 0x31, 0x01, 0x37, 0x02, 0x91, 0x03, 0xa3, 0x03, 0xb1, 0x03, 0xd1, 0x03, 0x24, 0x00, 0x1f, 0x04, 0x20, 0x05, 0x91, 0x03, 0xa3, 0x03, 0xb1, 0x03, 0xd1, 0x03, 0x24, 0x00, 0x1f, 0x04, 0x20, 0x05, 0x91, 0x03, 0xa3, 0x03, 0xb1, 0x03, 0xd1, 0x03, 0x24, 0x00, 0x1f, 0x04, 0x20, 0x05, 0x91, 0x03, 0xa3, 0x03, 0xb1, 0x03, 0xd1, 0x03, 0x24, 0x00, 0x1f, 0x04, 0x20, 0x05, 0x91, 0x03, 0xa3, 0x03, 0xb1, 0x03, 0xd1, 0x03, 0x24, 0x00, 0x1f, 0x04, 0x20, 0x05, 0x0b, 0x0c, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x04, 0x3a, 0x04, 0x3e, 0x04, 0x4b, 0x04, 0x4d, 0x04, 0x4e, 0x04, 0x89, 0xa6, 0x30, 0x04, 0xa9, 0x26, 0x28, 0xb9, 0x7f, 0x9f, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0e, 0x0f, 0x11, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x1a, 0x1b, 0x61, 0x26, 0x25, 0x2f, 0x7b, 0x51, 0xa6, 0xb1, 0x04, 0x27, 0x06, 0x00, 0x01, 0x05, 0x08, 0x2a, 0x06, 0x1e, 0x08, 0x03, 0x0d, 0x20, 0x19, 0x1a, 0x1b, 0x1c, 0x09, 0x0f, 0x17, 0x0b, 0x18, 0x07, 0x0a, 0x00, 0x01, 0x04, 0x06, 0x0c, 0x0e, 0x10, 0x44, 0x90, 0x77, 0x45, 0x28, 0x06, 0x2c, 0x06, 0x00, 0x00, 0x47, 0x06, 0x33, 0x06, 0x17, 0x10, 0x11, 0x12, 0x13, 0x00, 0x06, 0x0e, 0x02, 0x0f, 0x34, 0x06, 0x2a, 0x06, 0x2b, 0x06, 0x2e, 0x06, 0x00, 0x00, 0x36, 0x06, 0x00, 0x00, 0x3a, 0x06, 0x2d, 0x06, 0x00, 0x00, 0x4a, 0x06, 0x00, 0x00, 0x44, 0x06, 0x00, 0x00, 0x46, 0x06, 0x33, 0x06, 0x39, 0x06, 0x00, 0x00, 0x35, 0x06, 0x42, 0x06, 0x00, 0x00, 0x34, 0x06, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x06, 0x00, 0x00, 0x36, 0x06, 0x00, 0x00, 0x3a, 0x06, 0x00, 0x00, 0xba, 0x06, 0x00, 0x00, 0x6f, 0x06, 0x00, 0x00, 0x28, 0x06, 0x2c, 0x06, 0x00, 0x00, 0x47, 0x06, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x06, 0x37, 0x06, 0x4a, 0x06, 0x43, 0x06, 0x00, 0x00, 0x45, 0x06, 0x46, 0x06, 0x33, 0x06, 0x39, 0x06, 0x41, 0x06, 0x35, 0x06, 0x42, 0x06, 0x00, 0x00, 0x34, 0x06, 0x2a, 0x06, 0x2b, 0x06, 0x2e, 0x06, 0x00, 0x00, 0x36, 0x06, 0x38, 0x06, 0x3a, 0x06, 0x6e, 0x06, 0x00, 0x00, 0xa1, 0x06, 0x27, 0x06, 0x00, 0x01, 0x05, 0x08, 0x20, 0x21, 0x0b, 0x06, 0x10, 0x23, 0x2a, 0x06, 0x1a, 0x1b, 0x1c, 0x09, 0x0f, 0x17, 0x0b, 0x18, 0x07, 0x0a, 0x00, 0x01, 0x04, 0x06, 0x0c, 0x0e, 0x10, 0x28, 0x06, 0x2c, 0x06, 0x2f, 0x06, 0x00, 0x00, 0x48, 0x06, 0x32, 0x06, 0x2d, 0x06, 0x37, 0x06, 0x4a, 0x06, 0x2a, 0x06, 0x1a, 0x1b, 0x1c, 0x09, 0x0f, 0x17, 0x0b, 0x18, 0x07, 0x0a, 0x00, 0x01, 0x04, 0x06, 0x0c, 0x0e, 0x10, 0x30, 0x2e, 0x30, 0x00, 0x2c, 0x00, 0x28, 0x00, 0x41, 0x00, 0x29, 0x00, 0x14, 0x30, 0x53, 0x00, 0x15, 0x30, 0x43, 0x52, 0x43, 0x44, 0x57, 0x5a, 0x41, 0x00, 0x48, 0x56, 0x4d, 0x56, 0x53, 0x44, 0x53, 0x53, 0x50, 0x50, 0x56, 0x57, 0x43, 0x4d, 0x43, 0x4d, 0x44, 0x4d, 0x52, 0x44, 0x4a, 0x4b, 0x30, 0x30, 0x00, 0x68, 0x68, 0x4b, 0x62, 0x57, 0x5b, 0xcc, 0x53, 0xc7, 0x30, 0x8c, 0x4e, 0x1a, 0x59, 0xe3, 0x89, 0x29, 0x59, 0xa4, 0x4e, 0x20, 0x66, 0x21, 0x71, 0x99, 0x65, 0x4d, 0x52, 0x8c, 0x5f, 0x8d, 0x51, 0xb0, 0x65, 0x1d, 0x52, 0x42, 0x7d, 0x1f, 0x75, 0xa9, 0x8c, 0xf0, 0x58, 0x39, 0x54, 0x14, 0x6f, 0x95, 0x62, 0x55, 0x63, 0x00, 0x4e, 0x09, 0x4e, 0x4a, 0x90, 0xe6, 0x5d, 0x2d, 0x4e, 0xf3, 0x53, 0x07, 0x63, 0x70, 0x8d, 0x53, 0x62, 0x81, 0x79, 0x7a, 0x7a, 0x08, 0x54, 0x80, 0x6e, 0x09, 0x67, 0x08, 0x67, 0x33, 0x75, 0x72, 0x52, 0xb6, 0x55, 0x4d, 0x91, 0x14, 0x30, 0x15, 0x30, 0x2c, 0x67, 0x09, 0x4e, 0x8c, 0x4e, 0x89, 0x5b, 0xb9, 0x70, 0x53, 0x62, 0xd7, 0x76, 0xdd, 0x52, 0x57, 0x65, 0x97, 0x5f, 0xef, 0x53, 0x30, 0x00, 0x38, 0x4e, 0x05, 0x00, 0x09, 0x22, 0x01, 0x60, 0x4f, 0xae, 0x4f, 0xbb, 0x4f, 0x02, 0x50, 0x7a, 0x50, 0x99, 0x50, 0xe7, 0x50, 0xcf, 0x50, 0x9e, 0x34, 0x3a, 0x06, 0x4d, 0x51, 0x54, 0x51, 0x64, 0x51, 0x77, 0x51, 0x1c, 0x05, 0xb9, 0x34, 0x67, 0x51, 0x8d, 0x51, 0x4b, 0x05, 0x97, 0x51, 0xa4, 0x51, 0xcc, 0x4e, 0xac, 0x51, 0xb5, 0x51, 0xdf, 0x91, 0xf5, 0x51, 0x03, 0x52, 0xdf, 0x34, 0x3b, 0x52, 0x46, 0x52, 0x72, 0x52, 0x77, 0x52, 0x15, 0x35, 0x02, 0x00, 0x20, 0x80, 0x80, 0x00, 0x08, 0x00, 0x00, 0xc7, 0x52, 0x00, 0x02, 0x1d, 0x33, 0x3e, 0x3f, 0x50, 0x82, 0x8a, 0x93, 0xac, 0xb6, 0xb8, 0xb8, 0xb8, 0x2c, 0x0a, 0x70, 0x70, 0xca, 0x53, 0xdf, 0x53, 0x63, 0x0b, 0xeb, 0x53, 0xf1, 0x53, 0x06, 0x54, 0x9e, 0x54, 0x38, 0x54, 0x48, 0x54, 0x68, 0x54, 0xa2, 0x54, 0xf6, 0x54, 0x10, 0x55, 0x53, 0x55, 0x63, 0x55, 0x84, 0x55, 0x84, 0x55, 0x99, 0x55, 0xab, 0x55, 0xb3, 0x55, 0xc2, 0x55, 0x16, 0x57, 0x06, 0x56, 0x17, 0x57, 0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00, 0x0a, 0x00, 0x00, 0x02, 0x08, 0x00, 0x80, 0x08, 0x00, 0x00, 0x08, 0x80, 0x28, 0x80, 0x02, 0x00, 0x00, 0x02, 0x48, 0x61, 0x00, 0x04, 0x06, 0x04, 0x32, 0x46, 0x6a, 0x5c, 0x67, 0x96, 0xaa, 0xae, 0xc8, 0xd3, 0x5d, 0x62, 0x00, 0x54, 0x77, 0xf3, 0x0c, 0x2b, 0x3d, 0x63, 0xfc, 0x62, 0x68, 0x63, 0x83, 0x63, 0xe4, 0x63, 0xf1, 0x2b, 0x22, 0x64, 0xc5, 0x63, 0xa9, 0x63, 0x2e, 0x3a, 0x69, 0x64, 0x7e, 0x64, 0x9d, 0x64, 0x77, 0x64, 0x6c, 0x3a, 0x4f, 0x65, 0x6c, 0x65, 0x0a, 0x30, 0xe3, 0x65, 0xf8, 0x66, 0x49, 0x66, 0x19, 0x3b, 0x91, 0x66, 0x08, 0x3b, 0xe4, 0x3a, 0x92, 0x51, 0x95, 0x51, 0x00, 0x67, 0x9c, 0x66, 0xad, 0x80, 0xd9, 0x43, 0x17, 0x67, 0x1b, 0x67, 0x21, 0x67, 0x5e, 0x67, 0x53, 0x67, 0xc3, 0x33, 0x49, 0x3b, 0xfa, 0x67, 0x85, 0x67, 0x52, 0x68, 0x85, 0x68, 0x6d, 0x34, 0x8e, 0x68, 0x1f, 0x68, 0x14, 0x69, 0x9d, 0x3b, 0x42, 0x69, 0xa3, 0x69, 0xea, 0x69, 0xa8, 0x6a, 0xa3, 0x36, 0xdb, 0x6a, 0x18, 0x3c, 0x21, 0x6b, 0xa7, 0x38, 0x54, 0x6b, 0x4e, 0x3c, 0x72, 0x6b, 0x9f, 0x6b, 0xba, 0x6b, 0xbb, 0x6b, 0x8d, 0x3a, 0x0b, 0x1d, 0xfa, 0x3a, 0x4e, 0x6c, 0xbc, 0x3c, 0xbf, 0x6c, 0xcd, 0x6c, 0x67, 0x6c, 0x16, 0x6d, 0x3e, 0x6d, 0x77, 0x6d, 0x41, 0x6d, 0x69, 0x6d, 0x78, 0x6d, 0x85, 0x6d, 0x1e, 0x3d, 0x34, 0x6d, 0x2f, 0x6e, 0x6e, 0x6e, 0x33, 0x3d, 0xcb, 0x6e, 0xc7, 0x6e, 0xd1, 0x3e, 0xf9, 0x6d, 0x6e, 0x6f, 0x5e, 0x3f, 0x8e, 0x3f, 0xc6, 0x6f, 0x39, 0x70, 0x1e, 0x70, 0x1b, 0x70, 0x96, 0x3d, 0x4a, 0x70, 0x7d, 0x70, 0x77, 0x70, 0xad, 0x70, 0x25, 0x05, 0x45, 0x71, 0x63, 0x42, 0x9c, 0x71, 0xab, 0x43, 0x28, 0x72, 0x35, 0x72, 0x50, 0x72, 0x08, 0x46, 0x80, 0x72, 0x95, 0x72, 0x35, 0x47, 0x02, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x02, 0x02, 0x80, 0x8a, 0x00, 0x00, 0x20, 0x00, 0x08, 0x0a, 0x00, 0x80, 0x88, 0x80, 0x20, 0x14, 0x48, 0x7a, 0x73, 0x8b, 0x73, 0xac, 0x3e, 0xa5, 0x73, 0xb8, 0x3e, 0xb8, 0x3e, 0x47, 0x74, 0x5c, 0x74, 0x71, 0x74, 0x85, 0x74, 0xca, 0x74, 0x1b, 0x3f, 0x24, 0x75, 0x36, 0x4c, 0x3e, 0x75, 0x92, 0x4c, 0x70, 0x75, 0x9f, 0x21, 0x10, 0x76, 0xa1, 0x4f, 0xb8, 0x4f, 0x44, 0x50, 0xfc, 0x3f, 0x08, 0x40, 0xf4, 0x76, 0xf3, 0x50, 0xf2, 0x50, 0x19, 0x51, 0x33, 0x51, 0x1e, 0x77, 0x1f, 0x77, 0x1f, 0x77, 0x4a, 0x77, 0x39, 0x40, 0x8b, 0x77, 0x46, 0x40, 0x96, 0x40, 0x1d, 0x54, 0x4e, 0x78, 0x8c, 0x78, 0xcc, 0x78, 0xe3, 0x40, 0x26, 0x56, 0x56, 0x79, 0x9a, 0x56, 0xc5, 0x56, 0x8f, 0x79, 0xeb, 0x79, 0x2f, 0x41, 0x40, 0x7a, 0x4a, 0x7a, 0x4f, 0x7a, 0x7c, 0x59, 0xa7, 0x5a, 0xa7, 0x5a, 0xee, 0x7a, 0x02, 0x42, 0xab, 0x5b, 0xc6, 0x7b, 0xc9, 0x7b, 0x27, 0x42, 0x80, 0x5c, 0xd2, 0x7c, 0xa0, 0x42, 0xe8, 0x7c, 0xe3, 0x7c, 0x00, 0x7d, 0x86, 0x5f, 0x63, 0x7d, 0x01, 0x43, 0xc7, 0x7d, 0x02, 0x7e, 0x45, 0x7e, 0x34, 0x43, 0x28, 0x62, 0x47, 0x62, 0x59, 0x43, 0xd9, 0x62, 0x7a, 0x7f, 0x3e, 0x63, 0x95, 0x7f, 0xfa, 0x7f, 0x05, 0x80, 0xda, 0x64, 0x23, 0x65, 0x60, 0x80, 0xa8, 0x65, 0x70, 0x80, 0x5f, 0x33, 0xd5, 0x43, 0xb2, 0x80, 0x03, 0x81, 0x0b, 0x44, 0x3e, 0x81, 0xb5, 0x5a, 0xa7, 0x67, 0xb5, 0x67, 0x93, 0x33, 0x9c, 0x33, 0x01, 0x82, 0x04, 0x82, 0x9e, 0x8f, 0x6b, 0x44, 0x91, 0x82, 0x8b, 0x82, 0x9d, 0x82, 0xb3, 0x52, 0xb1, 0x82, 0xb3, 0x82, 0xbd, 0x82, 0xe6, 0x82, 0x3c, 0x6b, 0xe5, 0x82, 0x1d, 0x83, 0x63, 0x83, 0xad, 0x83, 0x23, 0x83, 0xbd, 0x83, 0xe7, 0x83, 0x57, 0x84, 0x53, 0x83, 0xca, 0x83, 0xcc, 0x83, 0xdc, 0x83, 0x36, 0x6c, 0x6b, 0x6d, 0x02, 0x00, 0x00, 0x20, 0x22, 0x2a, 0xa0, 0x0a, 0x00, 0x20, 0x80, 0x28, 0x00, 0xa8, 0x20, 0x20, 0x00, 0x02, 0x80, 0x22, 0x02, 0x8a, 0x08, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x28, 0xd5, 0x6c, 0x2b, 0x45, 0xf1, 0x84, 0xf3, 0x84, 0x16, 0x85, 0xca, 0x73, 0x64, 0x85, 0x2c, 0x6f, 0x5d, 0x45, 0x61, 0x45, 0xb1, 0x6f, 0xd2, 0x70, 0x6b, 0x45, 0x50, 0x86, 0x5c, 0x86, 0x67, 0x86, 0x69, 0x86, 0xa9, 0x86, 0x88, 0x86, 0x0e, 0x87, 0xe2, 0x86, 0x79, 0x87, 0x28, 0x87, 0x6b, 0x87, 0x86, 0x87, 0xd7, 0x45, 0xe1, 0x87, 0x01, 0x88, 0xf9, 0x45, 0x60, 0x88, 0x63, 0x88, 0x67, 0x76, 0xd7, 0x88, 0xde, 0x88, 0x35, 0x46, 0xfa, 0x88, 0xbb, 0x34, 0xae, 0x78, 0x66, 0x79, 0xbe, 0x46, 0xc7, 0x46, 0xa0, 0x8a, 0xed, 0x8a, 0x8a, 0x8b, 0x55, 0x8c, 0xa8, 0x7c, 0xab, 0x8c, 0xc1, 0x8c, 0x1b, 0x8d, 0x77, 0x8d, 0x2f, 0x7f, 0x04, 0x08, 0xcb, 0x8d, 0xbc, 0x8d, 0xf0, 0x8d, 0xde, 0x08, 0xd4, 0x8e, 0x38, 0x8f, 0xd2, 0x85, 0xed, 0x85, 0x94, 0x90, 0xf1, 0x90, 0x11, 0x91, 0x2e, 0x87, 0x1b, 0x91, 0x38, 0x92, 0xd7, 0x92, 0xd8, 0x92, 0x7c, 0x92, 0xf9, 0x93, 0x15, 0x94, 0xfa, 0x8b, 0x8b, 0x95, 0x95, 0x49, 0xb7, 0x95, 0x77, 0x8d, 0xe6, 0x49, 0xc3, 0x96, 0xb2, 0x5d, 0x23, 0x97, 0x45, 0x91, 0x1a, 0x92, 0x6e, 0x4a, 0x76, 0x4a, 0xe0, 0x97, 0x0a, 0x94, 0xb2, 0x4a, 0x96, 0x94, 0x0b, 0x98, 0x0b, 0x98, 0x29, 0x98, 0xb6, 0x95, 0xe2, 0x98, 0x33, 0x4b, 0x29, 0x99, 0xa7, 0x99, 0xc2, 0x99, 0xfe, 0x99, 0xce, 0x4b, 0x30, 0x9b, 0x12, 0x9b, 0x40, 0x9c, 0xfd, 0x9c, 0xce, 0x4c, 0xed, 0x4c, 0x67, 0x9d, 0xce, 0xa0, 0xf8, 0x4c, 0x05, 0xa1, 0x0e, 0xa2, 0x91, 0xa2, 0xbb, 0x9e, 0x56, 0x4d, 0xf9, 0x9e, 0xfe, 0x9e, 0x05, 0x9f, 0x0f, 0x9f, 0x16, 0x9f, 0x3b, 0x9f, 0x00, 0xa6, 0x02, 0x88, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x28, 0x00, 0x08, 0xa0, 0x80, 0xa0, 0x80, 0x00, 0x80, 0x80, 0x00, 0x0a, 0x88, 0x80, 0x00, 0x80, 0x00, 0x20, 0x2a, 0x00, 0x80, }; static const uint16_t unicode_comp_table[965] = { 0x4a01, 0x49c0, 0x4a02, 0x0280, 0x0281, 0x0282, 0x0283, 0x02c0, 0x02c2, 0x0a00, 0x0284, 0x2442, 0x0285, 0x07c0, 0x0980, 0x0982, 0x2440, 0x2280, 0x02c4, 0x2282, 0x2284, 0x2286, 0x02c6, 0x02c8, 0x02ca, 0x02cc, 0x0287, 0x228a, 0x02ce, 0x228c, 0x2290, 0x2292, 0x228e, 0x0288, 0x0289, 0x028a, 0x2482, 0x0300, 0x0302, 0x0304, 0x028b, 0x2480, 0x0308, 0x0984, 0x0986, 0x2458, 0x0a02, 0x0306, 0x2298, 0x229a, 0x229e, 0x0900, 0x030a, 0x22a0, 0x030c, 0x030e, 0x0840, 0x0310, 0x0312, 0x22a2, 0x22a6, 0x09c0, 0x22a4, 0x22a8, 0x22aa, 0x028c, 0x028d, 0x028e, 0x0340, 0x0342, 0x0344, 0x0380, 0x028f, 0x248e, 0x07c2, 0x0988, 0x098a, 0x2490, 0x0346, 0x22ac, 0x0400, 0x22b0, 0x0842, 0x22b2, 0x0402, 0x22b4, 0x0440, 0x0444, 0x22b6, 0x0442, 0x22c2, 0x22c0, 0x22c4, 0x22c6, 0x22c8, 0x0940, 0x04c0, 0x0291, 0x22ca, 0x04c4, 0x22cc, 0x04c2, 0x22d0, 0x22ce, 0x0292, 0x0293, 0x0294, 0x0295, 0x0540, 0x0542, 0x0a08, 0x0296, 0x2494, 0x0544, 0x07c4, 0x098c, 0x098e, 0x06c0, 0x2492, 0x0844, 0x2308, 0x230a, 0x0580, 0x230c, 0x0584, 0x0990, 0x0992, 0x230e, 0x0582, 0x2312, 0x0586, 0x0588, 0x2314, 0x058c, 0x2316, 0x0998, 0x058a, 0x231e, 0x0590, 0x2320, 0x099a, 0x058e, 0x2324, 0x2322, 0x0299, 0x029a, 0x029b, 0x05c0, 0x05c2, 0x05c4, 0x029c, 0x24ac, 0x05c6, 0x05c8, 0x07c6, 0x0994, 0x0996, 0x0700, 0x24aa, 0x2326, 0x05ca, 0x232a, 0x2328, 0x2340, 0x2342, 0x2344, 0x2346, 0x05cc, 0x234a, 0x2348, 0x234c, 0x234e, 0x2350, 0x24b8, 0x029d, 0x05ce, 0x24be, 0x0a0c, 0x2352, 0x0600, 0x24bc, 0x24ba, 0x0640, 0x2354, 0x0642, 0x0644, 0x2356, 0x2358, 0x02a0, 0x02a1, 0x02a2, 0x02a3, 0x02c1, 0x02c3, 0x0a01, 0x02a4, 0x2443, 0x02a5, 0x07c1, 0x0981, 0x0983, 0x2441, 0x2281, 0x02c5, 0x2283, 0x2285, 0x2287, 0x02c7, 0x02c9, 0x02cb, 0x02cd, 0x02a7, 0x228b, 0x02cf, 0x228d, 0x2291, 0x2293, 0x228f, 0x02a8, 0x02a9, 0x02aa, 0x2483, 0x0301, 0x0303, 0x0305, 0x02ab, 0x2481, 0x0309, 0x0985, 0x0987, 0x2459, 0x0a03, 0x0307, 0x2299, 0x229b, 0x229f, 0x0901, 0x030b, 0x22a1, 0x030d, 0x030f, 0x0841, 0x0311, 0x0313, 0x22a3, 0x22a7, 0x09c1, 0x22a5, 0x22a9, 0x22ab, 0x2380, 0x02ac, 0x02ad, 0x02ae, 0x0341, 0x0343, 0x0345, 0x02af, 0x248f, 0x07c3, 0x0989, 0x098b, 0x2491, 0x0347, 0x22ad, 0x0401, 0x0884, 0x22b1, 0x0843, 0x22b3, 0x0403, 0x22b5, 0x0441, 0x0445, 0x22b7, 0x0443, 0x22c3, 0x22c1, 0x22c5, 0x22c7, 0x22c9, 0x0941, 0x04c1, 0x02b1, 0x22cb, 0x04c5, 0x22cd, 0x04c3, 0x22d1, 0x22cf, 0x02b2, 0x02b3, 0x02b4, 0x02b5, 0x0541, 0x0543, 0x0a09, 0x02b6, 0x2495, 0x0545, 0x07c5, 0x098d, 0x098f, 0x06c1, 0x2493, 0x0845, 0x2309, 0x230b, 0x0581, 0x230d, 0x0585, 0x0991, 0x0993, 0x230f, 0x0583, 0x2313, 0x0587, 0x0589, 0x2315, 0x058d, 0x2317, 0x0999, 0x058b, 0x231f, 0x2381, 0x0591, 0x2321, 0x099b, 0x058f, 0x2325, 0x2323, 0x02b9, 0x02ba, 0x02bb, 0x05c1, 0x05c3, 0x05c5, 0x02bc, 0x24ad, 0x05c7, 0x05c9, 0x07c7, 0x0995, 0x0997, 0x0701, 0x24ab, 0x2327, 0x05cb, 0x232b, 0x2329, 0x2341, 0x2343, 0x2345, 0x2347, 0x05cd, 0x234b, 0x2349, 0x2382, 0x234d, 0x234f, 0x2351, 0x24b9, 0x02bd, 0x05cf, 0x24bf, 0x0a0d, 0x2353, 0x02bf, 0x24bd, 0x2383, 0x24bb, 0x0641, 0x2355, 0x0643, 0x0645, 0x2357, 0x2359, 0x3101, 0x0c80, 0x2e00, 0x2446, 0x2444, 0x244a, 0x2448, 0x0800, 0x0942, 0x0944, 0x0804, 0x2288, 0x2486, 0x2484, 0x248a, 0x2488, 0x22ae, 0x2498, 0x2496, 0x249c, 0x249a, 0x2300, 0x0a06, 0x2302, 0x0a04, 0x0946, 0x07ce, 0x07ca, 0x07c8, 0x07cc, 0x2447, 0x2445, 0x244b, 0x2449, 0x0801, 0x0943, 0x0945, 0x0805, 0x2289, 0x2487, 0x2485, 0x248b, 0x2489, 0x22af, 0x2499, 0x2497, 0x249d, 0x249b, 0x2301, 0x0a07, 0x2303, 0x0a05, 0x0947, 0x07cf, 0x07cb, 0x07c9, 0x07cd, 0x2450, 0x244e, 0x2454, 0x2452, 0x2451, 0x244f, 0x2455, 0x2453, 0x2294, 0x2296, 0x2295, 0x2297, 0x2304, 0x2306, 0x2305, 0x2307, 0x2318, 0x2319, 0x231a, 0x231b, 0x232c, 0x232d, 0x232e, 0x232f, 0x2400, 0x24a2, 0x24a0, 0x24a6, 0x24a4, 0x24a8, 0x24a3, 0x24a1, 0x24a7, 0x24a5, 0x24a9, 0x24b0, 0x24ae, 0x24b4, 0x24b2, 0x24b6, 0x24b1, 0x24af, 0x24b5, 0x24b3, 0x24b7, 0x0882, 0x0880, 0x0881, 0x0802, 0x0803, 0x229c, 0x229d, 0x0a0a, 0x0a0b, 0x0883, 0x0b40, 0x2c8a, 0x0c81, 0x2c89, 0x2c88, 0x2540, 0x2541, 0x2d00, 0x2e07, 0x0d00, 0x2640, 0x2641, 0x2e80, 0x0d01, 0x26c8, 0x26c9, 0x2f00, 0x2f84, 0x0d02, 0x2f83, 0x2f82, 0x0d40, 0x26d8, 0x26d9, 0x3186, 0x0d04, 0x2740, 0x2741, 0x3100, 0x3086, 0x0d06, 0x3085, 0x3084, 0x0d41, 0x2840, 0x3200, 0x0d07, 0x284f, 0x2850, 0x3280, 0x2c84, 0x2e03, 0x2857, 0x0d42, 0x2c81, 0x2c80, 0x24c0, 0x24c1, 0x2c86, 0x2c83, 0x28c0, 0x0d43, 0x25c0, 0x25c1, 0x2940, 0x0d44, 0x26c0, 0x26c1, 0x2e05, 0x2e02, 0x29c0, 0x0d45, 0x2f05, 0x2f04, 0x0d80, 0x26d0, 0x26d1, 0x2f80, 0x2a40, 0x0d82, 0x26e0, 0x26e1, 0x3080, 0x3081, 0x2ac0, 0x0d83, 0x3004, 0x3003, 0x0d81, 0x27c0, 0x27c1, 0x3082, 0x2b40, 0x0d84, 0x2847, 0x2848, 0x3184, 0x3181, 0x2f06, 0x0d08, 0x2f81, 0x3005, 0x0d46, 0x3083, 0x3182, 0x0e00, 0x0e01, 0x0f40, 0x1180, 0x1182, 0x0f03, 0x0f00, 0x11c0, 0x0f01, 0x1140, 0x1202, 0x1204, 0x0f81, 0x1240, 0x0fc0, 0x1242, 0x0f80, 0x1244, 0x1284, 0x0f82, 0x1286, 0x1288, 0x128a, 0x12c0, 0x1282, 0x1181, 0x1183, 0x1043, 0x1040, 0x11c1, 0x1041, 0x1141, 0x1203, 0x1205, 0x10c1, 0x1241, 0x1000, 0x1243, 0x10c0, 0x1245, 0x1285, 0x10c2, 0x1287, 0x1289, 0x128b, 0x12c1, 0x1283, 0x1080, 0x1100, 0x1101, 0x1200, 0x1201, 0x1280, 0x1281, 0x1340, 0x1341, 0x1343, 0x1342, 0x1344, 0x13c2, 0x1400, 0x13c0, 0x1440, 0x1480, 0x14c0, 0x1540, 0x1541, 0x1740, 0x1700, 0x1741, 0x17c0, 0x1800, 0x1802, 0x1801, 0x1840, 0x1880, 0x1900, 0x18c0, 0x18c1, 0x1901, 0x1940, 0x1942, 0x1941, 0x1980, 0x19c0, 0x19c2, 0x19c1, 0x1c80, 0x1cc0, 0x1dc0, 0x1f80, 0x2000, 0x2002, 0x2004, 0x2006, 0x2008, 0x2040, 0x2080, 0x2082, 0x20c0, 0x20c1, 0x2100, 0x22b8, 0x22b9, 0x2310, 0x2311, 0x231c, 0x231d, 0x244c, 0x2456, 0x244d, 0x2457, 0x248c, 0x248d, 0x249e, 0x249f, 0x2500, 0x2502, 0x2504, 0x2bc0, 0x2501, 0x2503, 0x2505, 0x2bc1, 0x2bc2, 0x2bc3, 0x2bc4, 0x2bc5, 0x2bc6, 0x2bc7, 0x2580, 0x2582, 0x2584, 0x2bc8, 0x2581, 0x2583, 0x2585, 0x2bc9, 0x2bca, 0x2bcb, 0x2bcc, 0x2bcd, 0x2bce, 0x2bcf, 0x2600, 0x2602, 0x2601, 0x2603, 0x2680, 0x2682, 0x2681, 0x2683, 0x26c2, 0x26c4, 0x26c6, 0x2c00, 0x26c3, 0x26c5, 0x26c7, 0x2c01, 0x2c02, 0x2c03, 0x2c04, 0x2c05, 0x2c06, 0x2c07, 0x26ca, 0x26cc, 0x26ce, 0x2c08, 0x26cb, 0x26cd, 0x26cf, 0x2c09, 0x2c0a, 0x2c0b, 0x2c0c, 0x2c0d, 0x2c0e, 0x2c0f, 0x26d2, 0x26d4, 0x26d6, 0x26d3, 0x26d5, 0x26d7, 0x26da, 0x26dc, 0x26de, 0x26db, 0x26dd, 0x26df, 0x2700, 0x2702, 0x2701, 0x2703, 0x2780, 0x2782, 0x2781, 0x2783, 0x2800, 0x2802, 0x2804, 0x2801, 0x2803, 0x2805, 0x2842, 0x2844, 0x2846, 0x2849, 0x284b, 0x284d, 0x2c40, 0x284a, 0x284c, 0x284e, 0x2c41, 0x2c42, 0x2c43, 0x2c44, 0x2c45, 0x2c46, 0x2c47, 0x2851, 0x2853, 0x2855, 0x2c48, 0x2852, 0x2854, 0x2856, 0x2c49, 0x2c4a, 0x2c4b, 0x2c4c, 0x2c4d, 0x2c4e, 0x2c4f, 0x2c82, 0x2e01, 0x3180, 0x2c87, 0x2f01, 0x2f02, 0x2f03, 0x2e06, 0x3185, 0x3000, 0x3001, 0x3002, 0x4640, 0x4641, 0x4680, 0x46c0, 0x46c2, 0x46c1, 0x4700, 0x4740, 0x4780, 0x47c0, 0x47c2, 0x4900, 0x4940, 0x4980, 0x4982, 0x4a00, 0x49c2, 0x4a03, 0x4a04, 0x4a40, 0x4a41, 0x4a80, 0x4a81, 0x4ac0, 0x4ac1, 0x4bc0, 0x4bc1, 0x4b00, 0x4b01, 0x4b40, 0x4b41, 0x4bc2, 0x4bc3, 0x4b80, 0x4b81, 0x4b82, 0x4b83, 0x4c00, 0x4c01, 0x4c02, 0x4c03, 0x5600, 0x5440, 0x5442, 0x5444, 0x5446, 0x5448, 0x544a, 0x544c, 0x544e, 0x5450, 0x5452, 0x5454, 0x5456, 0x5480, 0x5482, 0x5484, 0x54c0, 0x54c1, 0x5500, 0x5501, 0x5540, 0x5541, 0x5580, 0x5581, 0x55c0, 0x55c1, 0x5680, 0x58c0, 0x5700, 0x5702, 0x5704, 0x5706, 0x5708, 0x570a, 0x570c, 0x570e, 0x5710, 0x5712, 0x5714, 0x5716, 0x5740, 0x5742, 0x5744, 0x5780, 0x5781, 0x57c0, 0x57c1, 0x5800, 0x5801, 0x5840, 0x5841, 0x5880, 0x5881, 0x5900, 0x5901, 0x5902, 0x5903, 0x5940, 0x8ec0, 0x8f00, 0x8fc0, 0x8fc2, 0x9000, 0x9040, 0x9041, 0x9080, 0x9081, 0x90c0, 0x90c2, 0x9100, 0x9140, 0x9182, 0x9180, 0x9183, 0x91c1, 0x91c0, 0x91c3, 0x9200, 0x9201, 0x9240, 0x9280, 0x9282, 0x9284, 0x9281, 0x9285, 0x9287, 0x9286, 0x9283, 0x92c1, 0x92c0, 0x92c2, }; typedef enum { UNICODE_GC_Cn, UNICODE_GC_Lu, UNICODE_GC_Ll, UNICODE_GC_Lt, UNICODE_GC_Lm, UNICODE_GC_Lo, UNICODE_GC_Mn, UNICODE_GC_Mc, UNICODE_GC_Me, UNICODE_GC_Nd, UNICODE_GC_Nl, UNICODE_GC_No, UNICODE_GC_Sm, UNICODE_GC_Sc, UNICODE_GC_Sk, UNICODE_GC_So, UNICODE_GC_Pc, UNICODE_GC_Pd, UNICODE_GC_Ps, UNICODE_GC_Pe, UNICODE_GC_Pi, UNICODE_GC_Pf, UNICODE_GC_Po, UNICODE_GC_Zs, UNICODE_GC_Zl, UNICODE_GC_Zp, UNICODE_GC_Cc, UNICODE_GC_Cf, UNICODE_GC_Cs, UNICODE_GC_Co, UNICODE_GC_LC, UNICODE_GC_L, UNICODE_GC_M, UNICODE_GC_N, UNICODE_GC_S, UNICODE_GC_P, UNICODE_GC_Z, UNICODE_GC_C, UNICODE_GC_COUNT, } UnicodeGCEnum; static const char unicode_gc_name_table[] = "Cn,Unassigned" "\0" "Lu,Uppercase_Letter" "\0" "Ll,Lowercase_Letter" "\0" "Lt,Titlecase_Letter" "\0" "Lm,Modifier_Letter" "\0" "Lo,Other_Letter" "\0" "Mn,Nonspacing_Mark" "\0" "Mc,Spacing_Mark" "\0" "Me,Enclosing_Mark" "\0" "Nd,Decimal_Number,digit" "\0" "Nl,Letter_Number" "\0" "No,Other_Number" "\0" "Sm,Math_Symbol" "\0" "Sc,Currency_Symbol" "\0" "Sk,Modifier_Symbol" "\0" "So,Other_Symbol" "\0" "Pc,Connector_Punctuation" "\0" "Pd,Dash_Punctuation" "\0" "Ps,Open_Punctuation" "\0" "Pe,Close_Punctuation" "\0" "Pi,Initial_Punctuation" "\0" "Pf,Final_Punctuation" "\0" "Po,Other_Punctuation" "\0" "Zs,Space_Separator" "\0" "Zl,Line_Separator" "\0" "Zp,Paragraph_Separator" "\0" "Cc,Control,cntrl" "\0" "Cf,Format" "\0" "Cs,Surrogate" "\0" "Co,Private_Use" "\0" "LC,Cased_Letter" "\0" "L,Letter" "\0" "M,Mark,Combining_Mark" "\0" "N,Number" "\0" "S,Symbol" "\0" "P,Punctuation,punct" "\0" "Z,Separator" "\0" "C,Other" "\0" ; static const uint8_t unicode_gc_table[4070] = { 0xfa, 0x18, 0x17, 0x56, 0x0d, 0x56, 0x12, 0x13, 0x16, 0x0c, 0x16, 0x11, 0x36, 0xe9, 0x02, 0x36, 0x4c, 0x36, 0xe1, 0x12, 0x12, 0x16, 0x13, 0x0e, 0x10, 0x0e, 0xe2, 0x12, 0x12, 0x0c, 0x13, 0x0c, 0xfa, 0x19, 0x17, 0x16, 0x6d, 0x0f, 0x16, 0x0e, 0x0f, 0x05, 0x14, 0x0c, 0x1b, 0x0f, 0x0e, 0x0f, 0x0c, 0x2b, 0x0e, 0x02, 0x36, 0x0e, 0x0b, 0x05, 0x15, 0x4b, 0x16, 0xe1, 0x0f, 0x0c, 0xc1, 0xe2, 0x10, 0x0c, 0xe2, 0x00, 0xff, 0x30, 0x02, 0xff, 0x08, 0x02, 0xff, 0x27, 0xbf, 0x22, 0x21, 0x02, 0x5f, 0x5f, 0x21, 0x22, 0x61, 0x02, 0x21, 0x02, 0x41, 0x42, 0x21, 0x02, 0x21, 0x02, 0x9f, 0x7f, 0x02, 0x5f, 0x5f, 0x21, 0x02, 0x5f, 0x3f, 0x02, 0x05, 0x3f, 0x22, 0x65, 0x01, 0x03, 0x02, 0x01, 0x03, 0x02, 0x01, 0x03, 0x02, 0xff, 0x08, 0x02, 0xff, 0x0a, 0x02, 0x01, 0x03, 0x02, 0x5f, 0x21, 0x02, 0xff, 0x32, 0xa2, 0x21, 0x02, 0x21, 0x22, 0x5f, 0x41, 0x02, 0xff, 0x00, 0xe2, 0x3c, 0x05, 0xe2, 0x13, 0xe4, 0x0a, 0x6e, 0xe4, 0x04, 0xee, 0x06, 0x84, 0xce, 0x04, 0x0e, 0x04, 0xee, 0x09, 0xe6, 0x68, 0x7f, 0x04, 0x0e, 0x3f, 0x20, 0x04, 0x42, 0x16, 0x01, 0x60, 0x2e, 0x01, 0x16, 0x41, 0x00, 0x01, 0x00, 0x21, 0x02, 0xe1, 0x09, 0x00, 0xe1, 0x01, 0xe2, 0x1b, 0x3f, 0x02, 0x41, 0x42, 0xff, 0x10, 0x62, 0x3f, 0x0c, 0x5f, 0x3f, 0x02, 0xe1, 0x2b, 0xe2, 0x28, 0xff, 0x1a, 0x0f, 0x86, 0x28, 0xff, 0x2f, 0xff, 0x06, 0x02, 0xff, 0x58, 0x00, 0xe1, 0x1e, 0x20, 0x04, 0xb6, 0xe2, 0x21, 0x16, 0x11, 0x20, 0x2f, 0x0d, 0x00, 0xe6, 0x25, 0x11, 0x06, 0x16, 0x26, 0x16, 0x26, 0x16, 0x06, 0xe0, 0x00, 0xe5, 0x13, 0x60, 0x65, 0x36, 0xe0, 0x03, 0xbb, 0x4c, 0x36, 0x0d, 0x36, 0x2f, 0xe6, 0x03, 0x16, 0x1b, 0x56, 0xe5, 0x18, 0x04, 0xe5, 0x02, 0xe6, 0x0d, 0xe9, 0x02, 0x76, 0x25, 0x06, 0xe5, 0x5b, 0x16, 0x05, 0xc6, 0x1b, 0x0f, 0xa6, 0x24, 0x26, 0x0f, 0x66, 0x25, 0xe9, 0x02, 0x45, 0x2f, 0x05, 0xf6, 0x06, 0x00, 0x1b, 0x05, 0x06, 0xe5, 0x16, 0xe6, 0x13, 0x20, 0xe5, 0x51, 0xe6, 0x03, 0x05, 0xe0, 0x06, 0xe9, 0x02, 0xe5, 0x19, 0xe6, 0x01, 0x24, 0x0f, 0x56, 0x04, 0x20, 0x06, 0x2d, 0xe5, 0x0e, 0x66, 0x04, 0xe6, 0x01, 0x04, 0x46, 0x04, 0x86, 0x20, 0xf6, 0x07, 0x00, 0xe5, 0x11, 0x46, 0x20, 0x16, 0x00, 0xe5, 0x03, 0x80, 0xe5, 0x10, 0x0e, 0xa5, 0x00, 0x3b, 0x80, 0xe6, 0x01, 0xe5, 0x21, 0x04, 0xe6, 0x10, 0x1b, 0xe6, 0x18, 0x07, 0xe5, 0x2e, 0x06, 0x07, 0x06, 0x05, 0x47, 0xe6, 0x00, 0x67, 0x06, 0x27, 0x05, 0xc6, 0xe5, 0x02, 0x26, 0x36, 0xe9, 0x02, 0x16, 0x04, 0xe5, 0x07, 0x06, 0x27, 0x00, 0xe5, 0x00, 0x20, 0x25, 0x20, 0xe5, 0x0e, 0x00, 0xc5, 0x00, 0x05, 0x40, 0x65, 0x20, 0x06, 0x05, 0x47, 0x66, 0x20, 0x27, 0x20, 0x27, 0x06, 0x05, 0xe0, 0x00, 0x07, 0x60, 0x25, 0x00, 0x45, 0x26, 0x20, 0xe9, 0x02, 0x25, 0x2d, 0xab, 0x0f, 0x0d, 0x05, 0x16, 0x06, 0x20, 0x26, 0x07, 0x00, 0xa5, 0x60, 0x25, 0x20, 0xe5, 0x0e, 0x00, 0xc5, 0x00, 0x25, 0x00, 0x25, 0x00, 0x25, 0x20, 0x06, 0x00, 0x47, 0x26, 0x60, 0x26, 0x20, 0x46, 0x40, 0x06, 0xc0, 0x65, 0x00, 0x05, 0xc0, 0xe9, 0x02, 0x26, 0x45, 0x06, 0x16, 0xe0, 0x02, 0x26, 0x07, 0x00, 0xe5, 0x01, 0x00, 0x45, 0x00, 0xe5, 0x0e, 0x00, 0xc5, 0x00, 0x25, 0x00, 0x85, 0x20, 0x06, 0x05, 0x47, 0x86, 0x00, 0x26, 0x07, 0x00, 0x27, 0x06, 0x20, 0x05, 0xe0, 0x07, 0x25, 0x26, 0x20, 0xe9, 0x02, 0x16, 0x0d, 0xc0, 0x05, 0xa6, 0x00, 0x06, 0x27, 0x00, 0xe5, 0x00, 0x20, 0x25, 0x20, 0xe5, 0x0e, 0x00, 0xc5, 0x00, 0x25, 0x00, 0x85, 0x20, 0x06, 0x05, 0x07, 0x06, 0x07, 0x66, 0x20, 0x27, 0x20, 0x27, 0x06, 0xc0, 0x26, 0x07, 0x60, 0x25, 0x00, 0x45, 0x26, 0x20, 0xe9, 0x02, 0x0f, 0x05, 0xab, 0xe0, 0x02, 0x06, 0x05, 0x00, 0xa5, 0x40, 0x45, 0x00, 0x65, 0x40, 0x25, 0x00, 0x05, 0x00, 0x25, 0x40, 0x25, 0x40, 0x45, 0x40, 0xe5, 0x04, 0x60, 0x27, 0x06, 0x27, 0x40, 0x47, 0x00, 0x47, 0x06, 0x20, 0x05, 0xa0, 0x07, 0xe0, 0x06, 0xe9, 0x02, 0x4b, 0xaf, 0x0d, 0x0f, 0x80, 0x06, 0x47, 0x06, 0xe5, 0x00, 0x00, 0x45, 0x00, 0xe5, 0x0f, 0x00, 0xe5, 0x08, 0x20, 0x06, 0x05, 0x46, 0x67, 0x00, 0x46, 0x00, 0x66, 0xc0, 0x26, 0x00, 0x45, 0x20, 0x05, 0x20, 0x25, 0x26, 0x20, 0xe9, 0x02, 0xc0, 0x16, 0xcb, 0x0f, 0x05, 0x06, 0x27, 0x16, 0xe5, 0x00, 0x00, 0x45, 0x00, 0xe5, 0x0f, 0x00, 0xe5, 0x02, 0x00, 0x85, 0x20, 0x06, 0x05, 0x07, 0x06, 0x87, 0x00, 0x06, 0x27, 0x00, 0x27, 0x26, 0xc0, 0x27, 0xa0, 0x25, 0x00, 0x25, 0x26, 0x20, 0xe9, 0x02, 0x00, 0x25, 0x07, 0xe0, 0x04, 0x26, 0x27, 0xe5, 0x01, 0x00, 0x45, 0x00, 0xe5, 0x21, 0x26, 0x05, 0x47, 0x66, 0x00, 0x47, 0x00, 0x47, 0x06, 0x05, 0x0f, 0x60, 0x45, 0x07, 0xcb, 0x45, 0x26, 0x20, 0xe9, 0x02, 0xeb, 0x01, 0x0f, 0xa5, 0x00, 0x06, 0x27, 0x00, 0xe5, 0x0a, 0x40, 0xe5, 0x10, 0x00, 0xe5, 0x01, 0x00, 0x05, 0x20, 0xc5, 0x40, 0x06, 0x60, 0x47, 0x46, 0x00, 0x06, 0x00, 0xe7, 0x00, 0xa0, 0xe9, 0x02, 0x20, 0x27, 0x16, 0xe0, 0x04, 0xe5, 0x28, 0x06, 0x25, 0xc6, 0x60, 0x0d, 0xa5, 0x04, 0xe6, 0x00, 0x16, 0xe9, 0x02, 0x36, 0xe0, 0x1d, 0x25, 0x00, 0x05, 0x00, 0x85, 0x00, 0xe5, 0x10, 0x00, 0x05, 0x00, 0xe5, 0x02, 0x06, 0x25, 0xe6, 0x01, 0x05, 0x20, 0x85, 0x00, 0x04, 0x00, 0xc6, 0x00, 0xe9, 0x02, 0x20, 0x65, 0xe0, 0x18, 0x05, 0x4f, 0xf6, 0x07, 0x0f, 0x16, 0x4f, 0x26, 0xaf, 0xe9, 0x02, 0xeb, 0x02, 0x0f, 0x06, 0x0f, 0x06, 0x0f, 0x06, 0x12, 0x13, 0x12, 0x13, 0x27, 0xe5, 0x00, 0x00, 0xe5, 0x1c, 0x60, 0xe6, 0x06, 0x07, 0x86, 0x16, 0x26, 0x85, 0xe6, 0x03, 0x00, 0xe6, 0x1c, 0x00, 0xef, 0x00, 0x06, 0xaf, 0x00, 0x2f, 0x96, 0x6f, 0x36, 0xe0, 0x1d, 0xe5, 0x23, 0x27, 0x66, 0x07, 0xa6, 0x07, 0x26, 0x27, 0x26, 0x05, 0xe9, 0x02, 0xb6, 0xa5, 0x27, 0x26, 0x65, 0x46, 0x05, 0x47, 0x25, 0xc7, 0x45, 0x66, 0xe5, 0x05, 0x06, 0x27, 0x26, 0xa7, 0x06, 0x05, 0x07, 0xe9, 0x02, 0x47, 0x06, 0x2f, 0xe1, 0x1e, 0x00, 0x01, 0x80, 0x01, 0x20, 0xe2, 0x23, 0x16, 0x04, 0x42, 0xe5, 0x80, 0xc1, 0x00, 0x65, 0x20, 0xc5, 0x00, 0x05, 0x00, 0x65, 0x20, 0xe5, 0x21, 0x00, 0x65, 0x20, 0xe5, 0x19, 0x00, 0x65, 0x20, 0xc5, 0x00, 0x05, 0x00, 0x65, 0x20, 0xe5, 0x07, 0x00, 0xe5, 0x31, 0x00, 0x65, 0x20, 0xe5, 0x3b, 0x20, 0x46, 0xf6, 0x01, 0xeb, 0x0c, 0x40, 0xe5, 0x08, 0xef, 0x02, 0xa0, 0xe1, 0x4e, 0x20, 0xa2, 0x20, 0x11, 0xe5, 0x81, 0xe4, 0x0f, 0x16, 0xe5, 0x09, 0x17, 0xe5, 0x12, 0x12, 0x13, 0x40, 0xe5, 0x43, 0x56, 0x4a, 0xe5, 0x00, 0xc0, 0xe5, 0x0a, 0x46, 0x07, 0xe0, 0x01, 0xe5, 0x0b, 0x26, 0x07, 0x36, 0xe0, 0x01, 0xe5, 0x0a, 0x26, 0xe0, 0x04, 0xe5, 0x05, 0x00, 0x45, 0x00, 0x26, 0xe0, 0x04, 0xe5, 0x2c, 0x26, 0x07, 0xc6, 0xe7, 0x00, 0x06, 0x27, 0xe6, 0x03, 0x56, 0x04, 0x56, 0x0d, 0x05, 0x06, 0x20, 0xe9, 0x02, 0xa0, 0xeb, 0x02, 0xa0, 0xb6, 0x11, 0x76, 0x46, 0x1b, 0x06, 0xe9, 0x02, 0xa0, 0xe5, 0x1b, 0x04, 0xe5, 0x2d, 0xc0, 0x85, 0x26, 0xe5, 0x1a, 0x06, 0x05, 0x80, 0xe5, 0x3e, 0xe0, 0x02, 0xe5, 0x17, 0x00, 0x46, 0x67, 0x26, 0x47, 0x60, 0x27, 0x06, 0xa7, 0x46, 0x60, 0x0f, 0x40, 0x36, 0xe9, 0x02, 0xe5, 0x16, 0x20, 0x85, 0xe0, 0x03, 0xe5, 0x24, 0x60, 0xe5, 0x12, 0xa0, 0xe9, 0x02, 0x0b, 0x40, 0xef, 0x1a, 0xe5, 0x0f, 0x26, 0x27, 0x06, 0x20, 0x36, 0xe5, 0x2d, 0x07, 0x06, 0x07, 0xc6, 0x00, 0x06, 0x07, 0x06, 0x27, 0xe6, 0x00, 0xa7, 0xe6, 0x02, 0x20, 0x06, 0xe9, 0x02, 0xa0, 0xe9, 0x02, 0xa0, 0xd6, 0x04, 0xb6, 0x20, 0xe6, 0x06, 0x08, 0xe6, 0x08, 0xe0, 0x29, 0x66, 0x07, 0xe5, 0x27, 0x06, 0x07, 0x86, 0x07, 0x06, 0x87, 0x06, 0x27, 0xe5, 0x00, 0x00, 0x36, 0xe9, 0x02, 0xd6, 0xef, 0x02, 0xe6, 0x01, 0xef, 0x01, 0x56, 0x26, 0x07, 0xe5, 0x16, 0x07, 0x66, 0x27, 0x26, 0x07, 0x46, 0x25, 0xe9, 0x02, 0xe5, 0x24, 0x06, 0x07, 0x26, 0x47, 0x06, 0x07, 0x46, 0x27, 0xe0, 0x00, 0x76, 0xe5, 0x1c, 0xe7, 0x00, 0xe6, 0x00, 0x27, 0x26, 0x40, 0x96, 0xe9, 0x02, 0x40, 0x45, 0xe9, 0x02, 0xe5, 0x16, 0xa4, 0x36, 0xe2, 0x01, 0x3f, 0x80, 0xe1, 0x23, 0x20, 0x41, 0xf6, 0x00, 0xe0, 0x00, 0x46, 0x16, 0xe6, 0x05, 0x07, 0xc6, 0x65, 0x06, 0xa5, 0x06, 0x25, 0x07, 0x26, 0x05, 0x80, 0xe2, 0x24, 0xe4, 0x37, 0xe2, 0x05, 0x04, 0xe2, 0x1a, 0xe4, 0x1d, 0xe6, 0x38, 0xff, 0x80, 0x0e, 0xe2, 0x00, 0xff, 0x5a, 0xe2, 0x00, 0xe1, 0x00, 0xa2, 0x20, 0xa1, 0x20, 0xe2, 0x00, 0xe1, 0x00, 0xe2, 0x00, 0xe1, 0x00, 0xa2, 0x20, 0xa1, 0x20, 0xe2, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x3f, 0xc2, 0xe1, 0x00, 0xe2, 0x06, 0x20, 0xe2, 0x00, 0xe3, 0x00, 0xe2, 0x00, 0xe3, 0x00, 0xe2, 0x00, 0xe3, 0x00, 0x82, 0x00, 0x22, 0x61, 0x03, 0x0e, 0x02, 0x4e, 0x42, 0x00, 0x22, 0x61, 0x03, 0x4e, 0x62, 0x20, 0x22, 0x61, 0x00, 0x4e, 0xe2, 0x00, 0x81, 0x4e, 0x20, 0x42, 0x00, 0x22, 0x61, 0x03, 0x2e, 0x00, 0xf7, 0x03, 0x9b, 0xb1, 0x36, 0x14, 0x15, 0x12, 0x34, 0x15, 0x12, 0x14, 0xf6, 0x00, 0x18, 0x19, 0x9b, 0x17, 0xf6, 0x01, 0x14, 0x15, 0x76, 0x30, 0x56, 0x0c, 0x12, 0x13, 0xf6, 0x03, 0x0c, 0x16, 0x10, 0xf6, 0x02, 0x17, 0x9b, 0x00, 0xfb, 0x02, 0x0b, 0x04, 0x20, 0xab, 0x4c, 0x12, 0x13, 0x04, 0xeb, 0x02, 0x4c, 0x12, 0x13, 0x00, 0xe4, 0x05, 0x40, 0xed, 0x19, 0xe0, 0x07, 0xe6, 0x05, 0x68, 0x06, 0x48, 0xe6, 0x04, 0xe0, 0x07, 0x2f, 0x01, 0x6f, 0x01, 0x2f, 0x02, 0x41, 0x22, 0x41, 0x02, 0x0f, 0x01, 0x2f, 0x0c, 0x81, 0xaf, 0x01, 0x0f, 0x01, 0x0f, 0x01, 0x0f, 0x61, 0x0f, 0x02, 0x61, 0x02, 0x65, 0x02, 0x2f, 0x22, 0x21, 0x8c, 0x3f, 0x42, 0x0f, 0x0c, 0x2f, 0x02, 0x0f, 0xeb, 0x08, 0xea, 0x1b, 0x3f, 0x6a, 0x0b, 0x2f, 0x60, 0x8c, 0x8f, 0x2c, 0x6f, 0x0c, 0x2f, 0x0c, 0x2f, 0x0c, 0xcf, 0x0c, 0xef, 0x17, 0x2c, 0x2f, 0x0c, 0x0f, 0x0c, 0xef, 0x17, 0xec, 0x80, 0x84, 0xef, 0x00, 0x12, 0x13, 0x12, 0x13, 0xef, 0x0c, 0x2c, 0xcf, 0x12, 0x13, 0xef, 0x49, 0x0c, 0xef, 0x16, 0xec, 0x11, 0xef, 0x20, 0xac, 0xef, 0x40, 0xe0, 0x0e, 0xef, 0x03, 0xe0, 0x0d, 0xeb, 0x34, 0xef, 0x46, 0xeb, 0x0e, 0xef, 0x80, 0x2f, 0x0c, 0xef, 0x01, 0x0c, 0xef, 0x2e, 0xec, 0x00, 0xef, 0x67, 0x0c, 0xef, 0x80, 0x70, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0xeb, 0x16, 0xef, 0x24, 0x8c, 0x12, 0x13, 0xec, 0x17, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0xec, 0x08, 0xef, 0x80, 0x78, 0xec, 0x7b, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0xec, 0x37, 0x12, 0x13, 0x12, 0x13, 0xec, 0x18, 0x12, 0x13, 0xec, 0x80, 0x7a, 0xef, 0x28, 0xec, 0x0d, 0x2f, 0xac, 0xef, 0x1f, 0x20, 0xef, 0x18, 0x00, 0xef, 0x61, 0xe1, 0x28, 0xe2, 0x28, 0x5f, 0x21, 0x22, 0xdf, 0x41, 0x02, 0x3f, 0x02, 0x3f, 0x82, 0x24, 0x41, 0x02, 0xff, 0x5a, 0x02, 0xaf, 0x7f, 0x46, 0x3f, 0x80, 0x76, 0x0b, 0x36, 0xe2, 0x1e, 0x00, 0x02, 0x80, 0x02, 0x20, 0xe5, 0x30, 0xc0, 0x04, 0x16, 0xe0, 0x06, 0x06, 0xe5, 0x0f, 0xe0, 0x01, 0xc5, 0x00, 0xc5, 0x00, 0xc5, 0x00, 0xc5, 0x00, 0xc5, 0x00, 0xc5, 0x00, 0xc5, 0x00, 0xc5, 0x00, 0xe6, 0x18, 0x36, 0x14, 0x15, 0x14, 0x15, 0x56, 0x14, 0x15, 0x16, 0x14, 0x15, 0xf6, 0x01, 0x11, 0x36, 0x11, 0x16, 0x14, 0x15, 0x36, 0x14, 0x15, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x96, 0x04, 0xf6, 0x02, 0x31, 0x76, 0x11, 0x16, 0x12, 0xf6, 0x05, 0x2f, 0x56, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x11, 0xe0, 0x1a, 0xef, 0x12, 0x00, 0xef, 0x51, 0xe0, 0x04, 0xef, 0x80, 0x4e, 0xe0, 0x12, 0xef, 0x08, 0x17, 0x56, 0x0f, 0x04, 0x05, 0x0a, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x2f, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x11, 0x12, 0x33, 0x0f, 0xea, 0x01, 0x66, 0x27, 0x11, 0x84, 0x2f, 0x4a, 0x04, 0x05, 0x16, 0x2f, 0x00, 0xe5, 0x4e, 0x20, 0x26, 0x2e, 0x24, 0x05, 0x11, 0xe5, 0x52, 0x16, 0x44, 0x05, 0x80, 0xe5, 0x23, 0x00, 0xe5, 0x56, 0x00, 0x2f, 0x6b, 0xef, 0x02, 0xe5, 0x18, 0xef, 0x1e, 0xe0, 0x01, 0x0f, 0xe5, 0x08, 0xef, 0x17, 0x00, 0xeb, 0x02, 0xef, 0x16, 0xeb, 0x00, 0x0f, 0xeb, 0x07, 0xef, 0x18, 0xeb, 0x02, 0xef, 0x1f, 0xeb, 0x07, 0xef, 0x80, 0xb8, 0xe5, 0x99, 0x38, 0xef, 0x38, 0xe5, 0xc0, 0x11, 0x8d, 0x04, 0xe5, 0x83, 0xef, 0x40, 0xef, 0x2f, 0xe0, 0x01, 0xe5, 0x20, 0xa4, 0x36, 0xe5, 0x80, 0x84, 0x04, 0x56, 0xe5, 0x08, 0xe9, 0x02, 0x25, 0xe0, 0x0c, 0xff, 0x26, 0x05, 0x06, 0x48, 0x16, 0xe6, 0x02, 0x16, 0x04, 0xff, 0x14, 0x24, 0x26, 0xe5, 0x3e, 0xea, 0x02, 0x26, 0xb6, 0xe0, 0x00, 0xee, 0x0f, 0xe4, 0x01, 0x2e, 0xff, 0x06, 0x22, 0xff, 0x36, 0x04, 0xe2, 0x00, 0x9f, 0xff, 0x02, 0x04, 0x2e, 0x7f, 0x05, 0x7f, 0x22, 0xff, 0x0d, 0x61, 0x02, 0x81, 0x02, 0xff, 0x07, 0x41, 0x02, 0x5f, 0x3f, 0x20, 0x3f, 0x00, 0x02, 0x00, 0x02, 0xdf, 0xe0, 0x0d, 0x44, 0x3f, 0x05, 0x24, 0x02, 0xc5, 0x06, 0x45, 0x06, 0x65, 0x06, 0xe5, 0x0f, 0x27, 0x26, 0x07, 0x6f, 0x06, 0x40, 0xab, 0x2f, 0x0d, 0x0f, 0xa0, 0xe5, 0x2c, 0x76, 0xe0, 0x00, 0x27, 0xe5, 0x2a, 0xe7, 0x08, 0x26, 0xe0, 0x00, 0x36, 0xe9, 0x02, 0xa0, 0xe6, 0x0a, 0xa5, 0x56, 0x05, 0x16, 0x25, 0x06, 0xe9, 0x02, 0xe5, 0x14, 0xe6, 0x00, 0x36, 0xe5, 0x0f, 0xe6, 0x03, 0x27, 0xe0, 0x03, 0x16, 0xe5, 0x15, 0x40, 0x46, 0x07, 0xe5, 0x27, 0x06, 0x27, 0x66, 0x27, 0x26, 0x47, 0xf6, 0x05, 0x00, 0x04, 0xe9, 0x02, 0x60, 0x36, 0x85, 0x06, 0x04, 0xe5, 0x01, 0xe9, 0x02, 0x85, 0x00, 0xe5, 0x21, 0xa6, 0x27, 0x26, 0x27, 0x26, 0xe0, 0x01, 0x45, 0x06, 0xe5, 0x00, 0x06, 0x07, 0x20, 0xe9, 0x02, 0x20, 0x76, 0xe5, 0x08, 0x04, 0xa5, 0x4f, 0x05, 0x07, 0x06, 0x07, 0xe5, 0x2a, 0x06, 0x05, 0x46, 0x25, 0x26, 0x85, 0x26, 0x05, 0x06, 0x05, 0xe0, 0x10, 0x25, 0x04, 0x36, 0xe5, 0x03, 0x07, 0x26, 0x27, 0x36, 0x05, 0x24, 0x07, 0x06, 0xe0, 0x02, 0xa5, 0x20, 0xa5, 0x20, 0xa5, 0xe0, 0x01, 0xc5, 0x00, 0xc5, 0x00, 0xe2, 0x23, 0x0e, 0x64, 0xe2, 0x01, 0x04, 0x2e, 0x60, 0xe2, 0x48, 0xe5, 0x1b, 0x27, 0x06, 0x27, 0x06, 0x27, 0x16, 0x07, 0x06, 0x20, 0xe9, 0x02, 0xa0, 0xe5, 0xab, 0x1c, 0xe0, 0x04, 0xe5, 0x0f, 0x60, 0xe5, 0x29, 0x60, 0xfc, 0x87, 0x78, 0xfd, 0x98, 0x78, 0xe5, 0x80, 0xe6, 0x20, 0xe5, 0x62, 0xe0, 0x1e, 0xc2, 0xe0, 0x04, 0x82, 0x80, 0x05, 0x06, 0xe5, 0x02, 0x0c, 0xe5, 0x05, 0x00, 0x85, 0x00, 0x05, 0x00, 0x25, 0x00, 0x25, 0x00, 0xe5, 0x64, 0xee, 0x09, 0xe0, 0x08, 0xe5, 0x80, 0xe3, 0x13, 0x12, 0xef, 0x08, 0xe5, 0x38, 0x20, 0xe5, 0x2e, 0xc0, 0x0f, 0xe0, 0x18, 0xe5, 0x04, 0x0d, 0x4f, 0xe6, 0x08, 0xd6, 0x12, 0x13, 0x16, 0xa0, 0xe6, 0x08, 0x16, 0x31, 0x30, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x36, 0x12, 0x13, 0x76, 0x50, 0x56, 0x00, 0x76, 0x11, 0x12, 0x13, 0x12, 0x13, 0x12, 0x13, 0x56, 0x0c, 0x11, 0x4c, 0x00, 0x16, 0x0d, 0x36, 0x60, 0x85, 0x00, 0xe5, 0x7f, 0x20, 0x1b, 0x00, 0x56, 0x0d, 0x56, 0x12, 0x13, 0x16, 0x0c, 0x16, 0x11, 0x36, 0xe9, 0x02, 0x36, 0x4c, 0x36, 0xe1, 0x12, 0x12, 0x16, 0x13, 0x0e, 0x10, 0x0e, 0xe2, 0x12, 0x12, 0x0c, 0x13, 0x0c, 0x12, 0x13, 0x16, 0x12, 0x13, 0x36, 0xe5, 0x02, 0x04, 0xe5, 0x25, 0x24, 0xe5, 0x17, 0x40, 0xa5, 0x20, 0xa5, 0x20, 0xa5, 0x20, 0x45, 0x40, 0x2d, 0x0c, 0x0e, 0x0f, 0x2d, 0x00, 0x0f, 0x6c, 0x2f, 0xe0, 0x02, 0x5b, 0x2f, 0x20, 0xe5, 0x04, 0x00, 0xe5, 0x12, 0x00, 0xe5, 0x0b, 0x00, 0x25, 0x00, 0xe5, 0x07, 0x20, 0xe5, 0x06, 0xe0, 0x1a, 0xe5, 0x73, 0x80, 0x56, 0x60, 0xeb, 0x25, 0x40, 0xef, 0x01, 0xea, 0x2d, 0x6b, 0xef, 0x09,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xe5, 0x1c, 0x86, 0x07, 0xe6, 0x00, 0x00, 0xe9, 0x02, 0x76, 0x05, 0x27, 0x05, 0xe0, 0x00, 0xe5, 0x1b, 0x06, 0x36, 0x05, 0xe0, 0x01, 0x26, 0x07, 0xe5, 0x28, 0x47, 0xe6, 0x01, 0x27, 0x65, 0x76, 0x66, 0x16, 0x07, 0x06, 0xe9, 0x02, 0x05, 0x16, 0x05, 0x56, 0x00, 0xeb, 0x0c, 0xe0, 0x03, 0xe5, 0x0a, 0x00, 0xe5, 0x11, 0x47, 0x46, 0x27, 0x06, 0x07, 0x26, 0xb6, 0x06, 0x25, 0x06, 0xe0, 0x36, 0xc5, 0x00, 0x05, 0x00, 0x65, 0x00, 0xe5, 0x07, 0x00, 0xe5, 0x02, 0x16, 0xa0, 0xe5, 0x27, 0x06, 0x47, 0xe6, 0x00, 0x80, 0xe9, 0x02, 0xa0, 0x26, 0x27, 0x00, 0xe5, 0x00, 0x20, 0x25, 0x20, 0xe5, 0x0e, 0x00, 0xc5, 0x00, 0x25, 0x00, 0x85, 0x00, 0x26, 0x05, 0x27, 0x06, 0x67, 0x20, 0x27, 0x20, 0x47, 0x20, 0x05, 0xa0, 0x07, 0x80, 0x85, 0x27, 0x20, 0xc6, 0x40, 0x86, 0xe0, 0x03, 0xe5, 0x02, 0x00, 0x05, 0x20, 0x05, 0x00, 0xe5, 0x1e, 0x00, 0x05, 0x47, 0xa6, 0x00, 0x07, 0x20, 0x07, 0x00, 0x67, 0x00, 0x27, 0x06, 0x07, 0x06, 0x05, 0x06, 0x05, 0x36, 0x00, 0x36, 0xe0, 0x00, 0x26, 0xe0, 0x15, 0xe5, 0x2d, 0x47, 0xe6, 0x00, 0x27, 0x46, 0x07, 0x06, 0x65, 0x96, 0xe9, 0x02, 0x36, 0x00, 0x16, 0x06, 0x45, 0xe0, 0x16, 0xe5, 0x28, 0x47, 0xa6, 0x07, 0x06, 0x67, 0x26, 0x07, 0x26, 0x25, 0x16, 0x05, 0xe0, 0x00, 0xe9, 0x02, 0xe0, 0x80, 0x1e, 0xe5, 0x27, 0x47, 0x66, 0x20, 0x67, 0x26, 0x07, 0x26, 0xf6, 0x0f, 0x65, 0x26, 0xe0, 0x1a, 0xe5, 0x28, 0x47, 0xe6, 0x00, 0x27, 0x06, 0x07, 0x26, 0x56, 0x05, 0xe0, 0x03, 0xe9, 0x02, 0xa0, 0xf6, 0x05, 0xe0, 0x0b, 0xe5, 0x23, 0x06, 0x07, 0x06, 0x27, 0xa6, 0x07, 0x06, 0x05, 0x16, 0xa0, 0xe9, 0x02, 0xa0, 0xe9, 0x0c, 0xe0, 0x14, 0xe5, 0x13, 0x20, 0x06, 0x07, 0x06, 0x27, 0x66, 0x07, 0x86, 0x60, 0xe9, 0x02, 0x2b, 0x56, 0x0f, 0xc5, 0xe0, 0x80, 0x31, 0xe5, 0x24, 0x47, 0xe6, 0x01, 0x07, 0x26, 0x16, 0xe0, 0x5c, 0xe1, 0x18, 0xe2, 0x18, 0xe9, 0x02, 0xeb, 0x01, 0xe0, 0x04, 0xe5, 0x00, 0x20, 0x05, 0x20, 0xe5, 0x00, 0x00, 0x25, 0x00, 0xe5, 0x10, 0xa7, 0x00, 0x27, 0x20, 0x26, 0x07, 0x06, 0x05, 0x07, 0x05, 0x07, 0x06, 0x56, 0xe0, 0x01, 0xe9, 0x02, 0xe0, 0x3e, 0xe5, 0x00, 0x20, 0xe5, 0x1f, 0x47, 0x66, 0x20, 0x26, 0x67, 0x06, 0x05, 0x16, 0x05, 0x07, 0xe0, 0x13, 0x05, 0xe6, 0x02, 0xe5, 0x20, 0xa6, 0x07, 0x05, 0x66, 0xf6, 0x00, 0x06, 0xe0, 0x00, 0x05, 0xa6, 0x27, 0x46, 0xe5, 0x26, 0xe6, 0x05, 0x07, 0x26, 0x56, 0x05, 0x96, 0xe0, 0x05, 0xe5, 0x41, 0xc0, 0xf6, 0x02, 0xe0, 0x80, 0x2e, 0xe5, 0x19, 0x16, 0xe0, 0x06, 0xe9, 0x02, 0xa0, 0xe5, 0x01, 0x00, 0xe5, 0x1d, 0x07, 0xc6, 0x00, 0xa6, 0x07, 0x06, 0x05, 0x96, 0xe0, 0x02, 0xe9, 0x02, 0xeb, 0x0b, 0x40, 0x36, 0xe5, 0x16, 0x20, 0xe6, 0x0e, 0x00, 0x07, 0xc6, 0x07, 0x26, 0x07, 0x26, 0xe0, 0x41, 0xc5, 0x00, 0x25, 0x00, 0xe5, 0x1e, 0xa6, 0x40, 0x06, 0x00, 0x26, 0x00, 0xc6, 0x05, 0x06, 0xe0, 0x00, 0xe9, 0x02, 0xa0, 0xa5, 0x00, 0x25, 0x00, 0xe5, 0x18, 0x87, 0x00, 0x26, 0x00, 0x27, 0x06, 0x07, 0x06, 0x05, 0xc0, 0xe9, 0x02, 0xe0, 0x80, 0xae, 0xe5, 0x0b, 0x26, 0x27, 0x36, 0xc0, 0x26, 0x05, 0x07, 0xe5, 0x05, 0x00, 0xe5, 0x1a, 0x27, 0x86, 0x40, 0x27, 0x06, 0x07, 0x06, 0xf6, 0x05, 0xe9, 0x02, 0x06, 0xe0, 0x4d, 0x05, 0xe0, 0x07, 0xeb, 0x0d, 0xef, 0x00, 0x6d, 0xef, 0x09, 0xe0, 0x05, 0x16, 0xe5, 0x83, 0x12, 0xe0, 0x5e, 0xea, 0x67, 0x00, 0x96, 0xe0, 0x03, 0xe5, 0x80, 0x3c, 0xe0, 0x89, 0xc4, 0xe5, 0x59, 0x36, 0xe0, 0x05, 0xe5, 0x83, 0xa8, 0xfb, 0x08, 0x06, 0xa5, 0xe6, 0x07, 0xe0, 0x02, 0xe5, 0x8f, 0x13, 0x80, 0xe5, 0x81, 0xbf, 0xe0, 0x9a, 0x31, 0xe5, 0x16, 0xe6, 0x04, 0x47, 0x46, 0xe9, 0x02, 0xe0, 0x86, 0x3e, 0xe5, 0x81, 0xb1, 0xc0, 0xe5, 0x17, 0x00, 0xe9, 0x02, 0x60, 0x36, 0xe5, 0x47, 0x00, 0xe9, 0x02, 0xa0, 0xe5, 0x16, 0x20, 0x86, 0x16, 0xe0, 0x02, 0xe5, 0x28, 0xc6, 0x96, 0x6f, 0x64, 0x16, 0x0f, 0xe0, 0x02, 0xe9, 0x02, 0x00, 0xcb, 0x00, 0xe5, 0x0d, 0x80, 0xe5, 0x0b, 0xe0, 0x81, 0x28, 0x44, 0xe5, 0x20, 0x24, 0x56, 0xe9, 0x02, 0xe0, 0x80, 0x3e, 0xe1, 0x18, 0xe2, 0x18, 0xeb, 0x0f, 0x76, 0xe0, 0x5d, 0xe5, 0x43, 0x60, 0x06, 0x05, 0xe7, 0x2f, 0xc0, 0x66, 0xe4, 0x05, 0xe0, 0x38, 0x24, 0x16, 0x04, 0x06, 0xe0, 0x03, 0x27, 0xe0, 0x06, 0xe5, 0x97, 0x70, 0xe0, 0x00, 0xe5, 0x84, 0x4e, 0xe0, 0x21, 0xe5, 0x02, 0xe0, 0xa2, 0x5f, 0x64, 0x00, 0xc4, 0x00, 0x24, 0x00, 0xe5, 0x80, 0x9b, 0xe0, 0x07, 0x05, 0xe0, 0x15, 0x45, 0x20, 0x05, 0xe0, 0x06, 0x65, 0xe0, 0x00, 0xe5, 0x81, 0x04, 0xe0, 0x88, 0x7c, 0xe5, 0x63, 0x80, 0xe5, 0x05, 0x40, 0xe5, 0x01, 0xc0, 0xe5, 0x02, 0x20, 0x0f, 0x26, 0x16, 0x7b, 0xe0, 0x8e, 0xd4, 0xef, 0x80, 0x68, 0xe9, 0x02, 0xa0, 0xef, 0x81, 0x2c, 0xe0, 0x44, 0xe6, 0x26, 0x20, 0xe6, 0x0f, 0xe0, 0x01, 0xef, 0x6c, 0xe0, 0x34, 0xef, 0x80, 0x6e, 0xe0, 0x02, 0xef, 0x1f, 0x20, 0xef, 0x34, 0x27, 0x46, 0x4f, 0xa7, 0xfb, 0x00, 0xe6, 0x00, 0x2f, 0xc6, 0xef, 0x16, 0x66, 0xef, 0x35, 0xe0, 0x0d, 0xef, 0x3a, 0x46, 0x0f, 0xe0, 0x72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, 0xe4, 0x36, 0xe0, 0x19, 0x06, 0xe0, 0x68, 0xe5, 0x25, 0x40, 0xc6, 0xc4, 0x20, 0xe9, 0x02, 0x60, 0x05, 0x0f, 0xe0, 0x80, 0xb8, 0xe5, 0x16, 0x06, 0xe0, 0x09, 0xe5, 0x24, 0x66, 0xe9, 0x02, 0x80, 0x0d, 0xe0, 0x81, 0x48, 0xe5, 0x13, 0x04, 0x66, 0xe9, 0x02, 0xe0, 0x80, 0x4e, 0xe5, 0x16, 0x26, 0x05, 0xe9, 0x02, 0x60, 0x16, 0xe0, 0x81, 0x58, 0xc5, 0x00, 0x65, 0x00, 0x25, 0x00, 0xe5, 0x07, 0x00, 0xe5, 0x80, 0x3d, 0x20, 0xeb, 0x01, 0xc6, 0xe0, 0x21, 0xe1, 0x1a, 0xe2, 0x1a, 0xc6, 0x04, 0x60, 0xe9, 0x02, 0x60, 0x36, 0xe0, 0x82, 0x89, 0xeb, 0x33, 0x0f, 0x4b, 0x0d, 0x6b, 0xe0, 0x44, 0xeb, 0x25, 0x0f, 0xeb, 0x07, 0xe0, 0x80, 0x3a, 0x65, 0x00, 0xe5, 0x13, 0x00, 0x25, 0x00, 0x05, 0x20, 0x05, 0x00, 0xe5, 0x02, 0x00, 0x65, 0x00, 0x05, 0x00, 0x05, 0xa0, 0x05, 0x60, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x45, 0x00, 0x25, 0x00, 0x05, 0x20, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x25, 0x00, 0x05, 0x20, 0x65, 0x00, 0xc5, 0x00, 0x65, 0x00, 0x65, 0x00, 0x05, 0x00, 0xe5, 0x02, 0x00, 0xe5, 0x09, 0x80, 0x45, 0x00, 0x85, 0x00, 0xe5, 0x09, 0xe0, 0x2c, 0x2c, 0xe0, 0x80, 0x86, 0xef, 0x24, 0x60, 0xef, 0x5c, 0xe0, 0x04, 0xef, 0x07, 0x20, 0xef, 0x07, 0x00, 0xef, 0x07, 0x00, 0xef, 0x1d, 0xe0, 0x02, 0xeb, 0x05, 0xef, 0x80, 0x19, 0xe0, 0x30, 0xef, 0x15, 0xe0, 0x05, 0xef, 0x24, 0x60, 0xef, 0x01, 0xc0, 0x2f, 0xe0, 0x06, 0xaf, 0xe0, 0x80, 0x12, 0xef, 0x80, 0x73, 0x8e, 0xef, 0x82, 0x50, 0x60, 0xef, 0x09, 0x40, 0xef, 0x05, 0x40, 0xef, 0x6f, 0x60, 0xef, 0x57, 0xa0, 0xef, 0x04, 0x60, 0x0f, 0xe0, 0x07, 0xef, 0x04, 0x60, 0xef, 0x30, 0xe0, 0x00, 0xef, 0x02, 0xa0, 0xef, 0x20, 0xe0, 0x00, 0xef, 0x16, 0x20, 0xef, 0x04, 0x60, 0x2f, 0xe0, 0x36, 0xef, 0x80, 0xcc, 0xe0, 0x04, 0xef, 0x06, 0x20, 0xef, 0x05, 0x40, 0xef, 0x02, 0x80, 0xef, 0x30, 0xc0, 0xef, 0x07, 0x20, 0xef, 0x03, 0xa0, 0xef, 0x01, 0xc0, 0xef, 0x80, 0x0b, 0x00, 0xef, 0x54, 0xe9, 0x02, 0xe0, 0x83, 0x7e, 0xe5, 0xc0, 0x66, 0x58, 0xe0, 0x18, 0xe5, 0x8f, 0xb2, 0xa0, 0xe5, 0x80, 0x56, 0x20, 0xe5, 0x95, 0xfa, 0xe0, 0x06, 0xe5, 0x9c, 0xa9, 0xe0, 0x07, 0xe5, 0x81, 0xe6, 0xe0, 0x89, 0x1a, 0xe5, 0x81, 0x96, 0xe0, 0x85, 0x5a, 0xe5, 0x92, 0xc3, 0x80, 0xe5, 0x8f, 0xd8, 0xe0, 0xca, 0x9b, 0xc9, 0x1b, 0xe0, 0x16, 0xfb, 0x58, 0xe0, 0x78, 0xe6, 0x80, 0x68, 0xe0, 0xc0, 0xbd, 0x88, 0xfd, 0xc0, 0xbf, 0x76, 0x20, 0xfd, 0xc0, 0xbf, 0x76, 0x20, }; typedef enum { UNICODE_SCRIPT_Unknown, UNICODE_SCRIPT_Adlam, UNICODE_SCRIPT_Ahom, UNICODE_SCRIPT_Anatolian_Hieroglyphs, UNICODE_SCRIPT_Arabic, UNICODE_SCRIPT_Armenian, UNICODE_SCRIPT_Avestan, UNICODE_SCRIPT_Balinese, UNICODE_SCRIPT_Bamum, UNICODE_SCRIPT_Bassa_Vah, UNICODE_SCRIPT_Batak, UNICODE_SCRIPT_Bengali, UNICODE_SCRIPT_Bhaiksuki, UNICODE_SCRIPT_Bopomofo, UNICODE_SCRIPT_Brahmi, UNICODE_SCRIPT_Braille, UNICODE_SCRIPT_Buginese, UNICODE_SCRIPT_Buhid, UNICODE_SCRIPT_Canadian_Aboriginal, UNICODE_SCRIPT_Carian, UNICODE_SCRIPT_Caucasian_Albanian, UNICODE_SCRIPT_Chakma, UNICODE_SCRIPT_Cham, UNICODE_SCRIPT_Cherokee, UNICODE_SCRIPT_Chorasmian, UNICODE_SCRIPT_Common, UNICODE_SCRIPT_Coptic, UNICODE_SCRIPT_Cuneiform, UNICODE_SCRIPT_Cypriot, UNICODE_SCRIPT_Cyrillic, UNICODE_SCRIPT_Cypro_Minoan, UNICODE_SCRIPT_Deseret, UNICODE_SCRIPT_Devanagari, UNICODE_SCRIPT_Dives_Akuru, UNICODE_SCRIPT_Dogra, UNICODE_SCRIPT_Duployan, UNICODE_SCRIPT_Egyptian_Hieroglyphs, UNICODE_SCRIPT_Elbasan, UNICODE_SCRIPT_Elymaic, UNICODE_SCRIPT_Ethiopic, UNICODE_SCRIPT_Georgian, UNICODE_SCRIPT_Glagolitic, UNICODE_SCRIPT_Gothic, UNICODE_SCRIPT_Garay, UNICODE_SCRIPT_Grantha, UNICODE_SCRIPT_Greek, UNICODE_SCRIPT_Gujarati, UNICODE_SCRIPT_Gunjala_Gondi, UNICODE_SCRIPT_Gurmukhi, UNICODE_SCRIPT_Gurung_Khema, UNICODE_SCRIPT_Han, UNICODE_SCRIPT_Hangul, UNICODE_SCRIPT_Hanifi_Rohingya, UNICODE_SCRIPT_Hanunoo, UNICODE_SCRIPT_Hatran, UNICODE_SCRIPT_Hebrew, UNICODE_SCRIPT_Hiragana, UNICODE_SCRIPT_Imperial_Aramaic, UNICODE_SCRIPT_Inherited, UNICODE_SCRIPT_Inscriptional_Pahlavi, UNICODE_SCRIPT_Inscriptional_Parthian, UNICODE_SCRIPT_Javanese, UNICODE_SCRIPT_Kaithi, UNICODE_SCRIPT_Kannada, UNICODE_SCRIPT_Katakana, UNICODE_SCRIPT_Kawi, UNICODE_SCRIPT_Kayah_Li, UNICODE_SCRIPT_Kharoshthi, UNICODE_SCRIPT_Khmer, UNICODE_SCRIPT_Khojki, UNICODE_SCRIPT_Khitan_Small_Script, UNICODE_SCRIPT_Khudawadi, UNICODE_SCRIPT_Kirat_Rai, UNICODE_SCRIPT_Lao, UNICODE_SCRIPT_Latin, UNICODE_SCRIPT_Lepcha, UNICODE_SCRIPT_Limbu, UNICODE_SCRIPT_Linear_A, UNICODE_SCRIPT_Linear_B, UNICODE_SCRIPT_Lisu, UNICODE_SCRIPT_Lycian, UNICODE_SCRIPT_Lydian, UNICODE_SCRIPT_Makasar, UNICODE_SCRIPT_Mahajani, UNICODE_SCRIPT_Malayalam, UNICODE_SCRIPT_Mandaic, UNICODE_SCRIPT_Manichaean, UNICODE_SCRIPT_Marchen, UNICODE_SCRIPT_Masaram_Gondi, UNICODE_SCRIPT_Medefaidrin, UNICODE_SCRIPT_Meetei_Mayek, UNICODE_SCRIPT_Mende_Kikakui, UNICODE_SCRIPT_Meroitic_Cursive, UNICODE_SCRIPT_Meroitic_Hieroglyphs, UNICODE_SCRIPT_Miao, UNICODE_SCRIPT_Modi, UNICODE_SCRIPT_Mongolian, UNICODE_SCRIPT_Mro, UNICODE_SCRIPT_Multani, UNICODE_SCRIPT_Myanmar, UNICODE_SCRIPT_Nabataean, UNICODE_SCRIPT_Nag_Mundari, UNICODE_SCRIPT_Nandinagari, UNICODE_SCRIPT_New_Tai_Lue, UNICODE_SCRIPT_Newa, UNICODE_SCRIPT_Nko, UNICODE_SCRIPT_Nushu, UNICODE_SCRIPT_Nyiakeng_Puachue_Hmong, UNICODE_SCRIPT_Ogham, UNICODE_SCRIPT_Ol_Chiki, UNICODE_SCRIPT_Ol_Onal, UNICODE_SCRIPT_Old_Hungarian, UNICODE_SCRIPT_Old_Italic, UNICODE_SCRIPT_Old_North_Arabian, UNICODE_SCRIPT_Old_Permic, UNICODE_SCRIPT_Old_Persian, UNICODE_SCRIPT_Old_Sogdian, UNICODE_SCRIPT_Old_South_Arabian, UNICODE_SCRIPT_Old_Turkic, UNICODE_SCRIPT_Old_Uyghur, UNICODE_SCRIPT_Oriya, UNICODE_SCRIPT_Osage, UNICODE_SCRIPT_Osmanya, UNICODE_SCRIPT_Pahawh_Hmong, UNICODE_SCRIPT_Palmyrene, UNICODE_SCRIPT_Pau_Cin_Hau, UNICODE_SCRIPT_Phags_Pa, UNICODE_SCRIPT_Phoenician, UNICODE_SCRIPT_Psalter_Pahlavi, UNICODE_SCRIPT_Rejang, UNICODE_SCRIPT_Runic, UNICODE_SCRIPT_Samaritan, UNICODE_SCRIPT_Saurashtra, UNICODE_SCRIPT_Sharada, UNICODE_SCRIPT_Shavian, UNICODE_SCRIPT_Siddham, UNICODE_SCRIPT_SignWriting, UNICODE_SCRIPT_Sinhala, UNICODE_SCRIPT_Sogdian, UNICODE_SCRIPT_Sora_Sompeng, UNICODE_SCRIPT_Soyombo, UNICODE_SCRIPT_Sundanese, UNICODE_SCRIPT_Sunuwar, UNICODE_SCRIPT_Syloti_Nagri, UNICODE_SCRIPT_Syriac, UNICODE_SCRIPT_Tagalog, UNICODE_SCRIPT_Tagbanwa, UNICODE_SCRIPT_Tai_Le, UNICODE_SCRIPT_Tai_Tham, UNICODE_SCRIPT_Tai_Viet, UNICODE_SCRIPT_Takri, UNICODE_SCRIPT_Tamil, UNICODE_SCRIPT_Tangut, UNICODE_SCRIPT_Telugu, UNICODE_SCRIPT_Thaana, UNICODE_SCRIPT_Thai, UNICODE_SCRIPT_Tibetan, UNICODE_SCRIPT_Tifinagh, UNICODE_SCRIPT_Tirhuta, UNICODE_SCRIPT_Tangsa, UNICODE_SCRIPT_Todhri, UNICODE_SCRIPT_Toto, UNICODE_SCRIPT_Tulu_Tigalari, UNICODE_SCRIPT_Ugaritic, UNICODE_SCRIPT_Vai, UNICODE_SCRIPT_Vithkuqi, UNICODE_SCRIPT_Wancho, UNICODE_SCRIPT_Warang_Citi, UNICODE_SCRIPT_Yezidi, UNICODE_SCRIPT_Yi, UNICODE_SCRIPT_Zanabazar_Square, UNICODE_SCRIPT_COUNT, } UnicodeScriptEnum; static const char unicode_script_name_table[] = "Adlam,Adlm" "\0" "Ahom,Ahom" "\0" "Anatolian_Hieroglyphs,Hluw" "\0" "Arabic,Arab" "\0" "Armenian,Armn" "\0" "Avestan,Avst" "\0" "Balinese,Bali" "\0" "Bamum,Bamu" "\0" "Bassa_Vah,Bass" "\0" "Batak,Batk" "\0" "Bengali,Beng" "\0" "Bhaiksuki,Bhks" "\0" "Bopomofo,Bopo" "\0" "Brahmi,Brah" "\0" "Braille,Brai" "\0" "Buginese,Bugi" "\0" "Buhid,Buhd" "\0" "Canadian_Aboriginal,Cans" "\0" "Carian,Cari" "\0" "Caucasian_Albanian,Aghb" "\0" "Chakma,Cakm" "\0" "Cham,Cham" "\0" "Cherokee,Cher" "\0" "Chorasmian,Chrs" "\0" "Common,Zyyy" "\0" "Coptic,Copt,Qaac" "\0" "Cuneiform,Xsux" "\0" "Cypriot,Cprt" "\0" "Cyrillic,Cyrl" "\0" "Cypro_Minoan,Cpmn" "\0" "Deseret,Dsrt" "\0" "Devanagari,Deva" "\0" "Dives_Akuru,Diak" "\0" "Dogra,Dogr" "\0" "Duployan,Dupl" "\0" "Egyptian_Hieroglyphs,Egyp" "\0" "Elbasan,Elba" "\0" "Elymaic,Elym" "\0" "Ethiopic,Ethi" "\0" "Georgian,Geor" "\0" "Glagolitic,Glag" "\0" "Gothic,Goth" "\0" "Garay,Gara" "\0" "Grantha,Gran" "\0" "Greek,Grek" "\0" "Gujarati,Gujr" "\0" "Gunjala_Gondi,Gong" "\0" "Gurmukhi,Guru" "\0" "Gurung_Khema,Gukh" "\0" "Han,Hani" "\0" "Hangul,Hang" "\0" "Hanifi_Rohingya,Rohg" "\0" "Hanunoo,Hano" "\0" "Hatran,Hatr" "\0" "Hebrew,Hebr" "\0" "Hiragana,Hira" "\0" "Imperial_Aramaic,Armi" "\0" "Inherited,Zinh,Qaai" "\0" "Inscriptional_Pahlavi,Phli" "\0" "Inscriptional_Parthian,Prti" "\0" "Javanese,Java" "\0" "Kaithi,Kthi" "\0" "Kannada,Knda" "\0" "Katakana,Kana" "\0" "Kawi,Kawi" "\0" "Kayah_Li,Kali" "\0" "Kharoshthi,Khar" "\0" "Khmer,Khmr" "\0" "Khojki,Khoj" "\0" "Khitan_Small_Script,Kits" "\0" "Khudawadi,Sind" "\0" "Kirat_Rai,Krai" "\0" "Lao,Laoo" "\0" "Latin,Latn" "\0" "Lepcha,Lepc" "\0" "Limbu,Limb" "\0" "Linear_A,Lina" "\0" "Linear_B,Linb" "\0" "Lisu,Lisu" "\0" "Lycian,Lyci" "\0" "Lydian,Lydi" "\0" "Makasar,Maka" "\0" "Mahajani,Mahj" "\0" "Malayalam,Mlym" "\0" "Mandaic,Mand" "\0" "Manichaean,Mani" "\0" "Marchen,Marc" "\0" "Masaram_Gondi,Gonm" "\0" "Medefaidrin,Medf" "\0" "Meetei_Mayek,Mtei" "\0" "Mende_Kikakui,Mend" "\0" "Meroitic_Cursive,Merc" "\0" "Meroitic_Hieroglyphs,Mero" "\0" "Miao,Plrd" "\0" "Modi,Modi" "\0" "Mongolian,Mong" "\0" "Mro,Mroo" "\0" "Multani,Mult" "\0" "Myanmar,Mymr" "\0" "Nabataean,Nbat" "\0" "Nag_Mundari,Nagm" "\0" "Nandinagari,Nand" "\0" "New_Tai_Lue,Talu" "\0" "Newa,Newa" "\0" "Nko,Nkoo" "\0" "Nushu,Nshu" "\0" "Nyiakeng_Puachue_Hmong,Hmnp" "\0" "Ogham,Ogam" "\0" "Ol_Chiki,Olck" "\0" "Ol_Onal,Onao" "\0" "Old_Hungarian,Hung" "\0" "Old_Italic,Ital" "\0" "Old_North_Arabian,Narb" "\0" "Old_Permic,Perm" "\0" "Old_Persian,Xpeo" "\0" "Old_Sogdian,Sogo" "\0" "Old_South_Arabian,Sarb" "\0" "Old_Turkic,Orkh" "\0" "Old_Uyghur,Ougr" "\0" "Oriya,Orya" "\0" "Osage,Osge" "\0" "Osmanya,Osma" "\0" "Pahawh_Hmong,Hmng" "\0" "Palmyrene,Palm" "\0" "Pau_Cin_Hau,Pauc" "\0" "Phags_Pa,Phag" "\0" "Phoenician,Phnx" "\0" "Psalter_Pahlavi,Phlp" "\0" "Rejang,Rjng" "\0" "Runic,Runr" "\0" "Samaritan,Samr" "\0" "Saurashtra,Saur" "\0" "Sharada,Shrd" "\0" "Shavian,Shaw" "\0" "Siddham,Sidd" "\0" "SignWriting,Sgnw" "\0" "Sinhala,Sinh" "\0" "Sogdian,Sogd" "\0" "Sora_Sompeng,Sora" "\0" "Soyombo,Soyo" "\0" "Sundanese,Sund" "\0" "Sunuwar,Sunu" "\0" "Syloti_Nagri,Sylo" "\0" "Syriac,Syrc" "\0" "Tagalog,Tglg" "\0" "Tagbanwa,Tagb" "\0" "Tai_Le,Tale" "\0" "Tai_Tham,Lana" "\0" "Tai_Viet,Tavt" "\0" "Takri,Takr" "\0" "Tamil,Taml" "\0" "Tangut,Tang" "\0" "Telugu,Telu" "\0" "Thaana,Thaa" "\0" "Thai,Thai" "\0" "Tibetan,Tibt" "\0" "Tifinagh,Tfng" "\0" "Tirhuta,Tirh" "\0" "Tangsa,Tnsa" "\0" "Todhri,Todr" "\0" "Toto,Toto" "\0" "Tulu_Tigalari,Tutg" "\0" "Ugaritic,Ugar" "\0" "Vai,Vaii" "\0" "Vithkuqi,Vith" "\0" "Wancho,Wcho" "\0" "Warang_Citi,Wara" "\0" "Yezidi,Yezi" "\0" "Yi,Yiii" "\0" "Zanabazar_Square,Zanb" "\0" ; static const uint8_t unicode_script_table[2803] = { 0xc0, 0x19, 0x99, 0x4a, 0x85, 0x19, 0x99, 0x4a, 0xae, 0x19, 0x80, 0x4a, 0x8e, 0x19, 0x80, 0x4a, 0x84, 0x19, 0x96, 0x4a, 0x80, 0x19, 0x9e, 0x4a, 0x80, 0x19, 0xe1, 0x60, 0x4a, 0xa6, 0x19, 0x84, 0x4a, 0x84, 0x19, 0x81, 0x0d, 0x93, 0x19, 0xe0, 0x0f, 0x3a, 0x83, 0x2d, 0x80, 0x19, 0x82, 0x2d, 0x01, 0x83, 0x2d, 0x80, 0x19, 0x80, 0x2d, 0x03, 0x80, 0x2d, 0x80, 0x19, 0x80, 0x2d, 0x80, 0x19, 0x82, 0x2d, 0x00, 0x80, 0x2d, 0x00, 0x93, 0x2d, 0x00, 0xbe, 0x2d, 0x8d, 0x1a, 0x8f, 0x2d, 0xe0, 0x24, 0x1d, 0x81, 0x3a, 0xe0, 0x48, 0x1d, 0x00, 0xa5, 0x05, 0x01, 0xb1, 0x05, 0x01, 0x82, 0x05, 0x00, 0xb6, 0x37, 0x07, 0x9a, 0x37, 0x03, 0x85, 0x37, 0x0a, 0x84, 0x04, 0x80, 0x19, 0x85, 0x04, 0x80, 0x19, 0x8d, 0x04, 0x80, 0x19, 0x82, 0x04, 0x80, 0x19, 0x9f, 0x04, 0x80, 0x19, 0x89, 0x04, 0x8a, 0x3a, 0x99, 0x04, 0x80, 0x3a, 0xe0, 0x0b, 0x04, 0x80, 0x19, 0xa1, 0x04, 0x8d, 0x90, 0x00, 0xbb, 0x90, 0x01, 0x82, 0x90, 0xaf, 0x04, 0xb1, 0x9a, 0x0d, 0xba, 0x69, 0x01, 0x82, 0x69, 0xad, 0x83, 0x01, 0x8e, 0x83, 0x00, 0x9b, 0x55, 0x01, 0x80, 0x55, 0x00, 0x8a, 0x90, 0x04, 0x9e, 0x04, 0x00, 0x81, 0x04, 0x04, 0xca, 0x04, 0x80, 0x19, 0x9c, 0x04, 0xd0, 0x20, 0x83, 0x3a, 0x8e, 0x20, 0x81, 0x19, 0x99, 0x20, 0x83, 0x0b, 0x00, 0x87, 0x0b, 0x01, 0x81, 0x0b, 0x01, 0x95, 0x0b, 0x00, 0x86, 0x0b, 0x00, 0x80, 0x0b, 0x02, 0x83, 0x0b, 0x01, 0x88, 0x0b, 0x01, 0x81, 0x0b, 0x01, 0x83, 0x0b, 0x07, 0x80, 0x0b, 0x03, 0x81, 0x0b, 0x00, 0x84, 0x0b, 0x01, 0x98, 0x0b, 0x01, 0x82, 0x30, 0x00, 0x85, 0x30, 0x03, 0x81, 0x30, 0x01, 0x95, 0x30, 0x00, 0x86, 0x30, 0x00, 0x81, 0x30, 0x00, 0x81, 0x30, 0x00, 0x81, 0x30, 0x01, 0x80, 0x30, 0x00, 0x84, 0x30, 0x03, 0x81, 0x30, 0x01, 0x82, 0x30, 0x02, 0x80, 0x30, 0x06, 0x83, 0x30, 0x00, 0x80, 0x30, 0x06, 0x90, 0x30, 0x09, 0x82, 0x2e, 0x00, 0x88, 0x2e, 0x00, 0x82, 0x2e, 0x00, 0x95, 0x2e, 0x00, 0x86, 0x2e, 0x00, 0x81, 0x2e, 0x00, 0x84, 0x2e, 0x01, 0x89, 0x2e, 0x00, 0x82, 0x2e, 0x00, 0x82, 0x2e, 0x01, 0x80, 0x2e, 0x0e, 0x83, 0x2e, 0x01, 0x8b, 0x2e, 0x06, 0x86, 0x2e, 0x00, 0x82, 0x78, 0x00, 0x87, 0x78, 0x01, 0x81, 0x78, 0x01, 0x95, 0x78, 0x00, 0x86, 0x78, 0x00, 0x81, 0x78, 0x00, 0x84, 0x78, 0x01, 0x88, 0x78, 0x01, 0x81, 0x78, 0x01, 0x82, 0x78, 0x06, 0x82, 0x78, 0x03, 0x81, 0x78, 0x00, 0x84, 0x78, 0x01, 0x91, 0x78, 0x09, 0x81, 0x97, 0x00, 0x85, 0x97, 0x02, 0x82, 0x97, 0x00, 0x83, 0x97, 0x02, 0x81, 0x97, 0x00, 0x80, 0x97, 0x00, 0x81, 0x97, 0x02, 0x81, 0x97, 0x02, 0x82, 0x97, 0x02, 0x8b, 0x97, 0x03, 0x84, 0x97, 0x02, 0x82, 0x97, 0x00, 0x83, 0x97, 0x01, 0x80, 0x97, 0x05, 0x80, 0x97, 0x0d, 0x94, 0x97, 0x04, 0x8c, 0x99, 0x00, 0x82, 0x99, 0x00, 0x96, 0x99, 0x00, 0x8f, 0x99, 0x01, 0x88, 0x99, 0x00, 0x82, 0x99, 0x00, 0x83, 0x99, 0x06, 0x81, 0x99, 0x00, 0x82, 0x99, 0x01, 0x80, 0x99, 0x01, 0x83, 0x99, 0x01, 0x89, 0x99, 0x06, 0x88, 0x99, 0x8c, 0x3f, 0x00, 0x82, 0x3f, 0x00, 0x96, 0x3f, 0x00, 0x89, 0x3f, 0x00, 0x84, 0x3f, 0x01, 0x88, 0x3f, 0x00, 0x82, 0x3f, 0x00, 0x83, 0x3f, 0x06, 0x81, 0x3f, 0x05, 0x81, 0x3f, 0x00, 0x83, 0x3f, 0x01, 0x89, 0x3f, 0x00, 0x82, 0x3f, 0x0b, 0x8c, 0x54, 0x00, 0x82, 0x54, 0x00, 0xb2, 0x54, 0x00, 0x82, 0x54, 0x00, 0x85, 0x54, 0x03, 0x8f, 0x54, 0x01, 0x99, 0x54, 0x00, 0x82, 0x89, 0x00, 0x91, 0x89, 0x02, 0x97, 0x89, 0x00, 0x88, 0x89, 0x00, 0x80, 0x89, 0x01, 0x86, 0x89, 0x02, 0x80, 0x89, 0x03, 0x85, 0x89, 0x00, 0x80, 0x89, 0x00, 0x87, 0x89, 0x05, 0x89, 0x89, 0x01, 0x82, 0x89, 0x0b, 0xb9, 0x9b, 0x03, 0x80, 0x19, 0x9b, 0x9b, 0x24, 0x81, 0x49, 0x00, 0x80, 0x49, 0x00, 0x84, 0x49, 0x00, 0x97, 0x49, 0x00, 0x80, 0x49, 0x00, 0x96, 0x49, 0x01, 0x84, 0x49, 0x00, 0x80, 0x49, 0x00, 0x86, 0x49, 0x00, 0x89, 0x49, 0x01, 0x83, 0x49, 0x1f, 0xc7, 0x9c, 0x00, 0xa3, 0x9c, 0x03, 0xa6, 0x9c, 0x00, 0xa3, 0x9c, 0x00, 0x8e, 0x9c, 0x00, 0x86, 0x9c, 0x83, 0x19, 0x81, 0x9c, 0x24, 0xe0, 0x3f, 0x63, 0xa5, 0x28, 0x00, 0x80, 0x28, 0x04, 0x80, 0x28, 0x01, 0xaa, 0x28, 0x80, 0x19, 0x83, 0x28, 0xe0, 0x9f, 0x33, 0xc8, 0x27, 0x00, 0x83, 0x27, 0x01, 0x86, 0x27, 0x00, 0x80, 0x27, 0x00, 0x83, 0x27, 0x01, 0xa8, 0x27, 0x00, 0x83, 0x27, 0x01, 0xa0, 0x27, 0x00, 0x83, 0x27, 0x01, 0x86, 0x27, 0x00, 0x80, 0x27, 0x00, 0x83, 0x27, 0x01, 0x8e, 0x27, 0x00, 0xb8, 0x27, 0x00, 0x83, 0x27, 0x01, 0xc2, 0x27, 0x01, 0x9f, 0x27, 0x02, 0x99, 0x27, 0x05, 0xd5, 0x17, 0x01, 0x85, 0x17, 0x01, 0xe2, 0x1f, 0x12, 0x9c, 0x6c, 0x02, 0xca, 0x82, 0x82, 0x19, 0x8a, 0x82, 0x06, 0x95, 0x91, 0x08, 0x80, 0x91, 0x94, 0x35, 0x81, 0x19, 0x08, 0x93, 0x11, 0x0b, 0x8c, 0x92, 0x00, 0x82, 0x92, 0x00, 0x81, 0x92, 0x0b, 0xdd, 0x44, 0x01, 0x89, 0x44, 0x05, 0x89, 0x44, 0x05, 0x81, 0x60, 0x81, 0x19, 0x80, 0x60, 0x80, 0x19, 0x93, 0x60, 0x05, 0xd8, 0x60, 0x06, 0xaa, 0x60, 0x04, 0xc5, 0x12, 0x09, 0x9e, 0x4c, 0x00, 0x8b, 0x4c, 0x03, 0x8b, 0x4c, 0x03, 0x80, 0x4c, 0x02, 0x8b, 0x4c, 0x9d, 0x93, 0x01, 0x84, 0x93, 0x0a, 0xab, 0x67, 0x03, 0x99, 0x67, 0x05, 0x8a, 0x67, 0x02, 0x81, 0x67, 0x9f, 0x44, 0x9b, 0x10, 0x01, 0x81, 0x10, 0xbe, 0x94, 0x00, 0x9c, 0x94, 0x01, 0x8a, 0x94, 0x05, 0x89, 0x94, 0x05, 0x8d, 0x94, 0x01, 0x9e, 0x3a, 0x30, 0xcc, 0x07, 0x00, 0xb1, 0x07, 0xbf, 0x8d, 0xb3, 0x0a, 0x07, 0x83, 0x0a, 0xb7, 0x4b, 0x02, 0x8e, 0x4b, 0x02, 0x82, 0x4b, 0xaf, 0x6d, 0x8a, 0x1d, 0x04, 0xaa, 0x28, 0x01, 0x82, 0x28, 0x87, 0x8d, 0x07, 0x82, 0x3a, 0x80, 0x19, 0x8c, 0x3a, 0x80, 0x19, 0x86, 0x3a, 0x83, 0x19, 0x80, 0x3a, 0x85, 0x19, 0x80, 0x3a, 0x82, 0x19, 0x81, 0x3a, 0x80, 0x19, 0x04, 0xa5, 0x4a, 0x84, 0x2d, 0x80, 0x1d, 0xb0, 0x4a, 0x84, 0x2d, 0x83, 0x4a, 0x84, 0x2d, 0x8c, 0x4a, 0x80, 0x1d, 0xc5, 0x4a, 0x80, 0x2d, 0xbf, 0x3a, 0xe0, 0x9f, 0x4a, 0x95, 0x2d, 0x01, 0x85, 0x2d, 0x01, 0xa5, 0x2d, 0x01, 0x85, 0x2d, 0x01, 0x87, 0x2d, 0x00, 0x80, 0x2d, 0x00, 0x80, 0x2d, 0x00, 0x80, 0x2d, 0x00, 0x9e, 0x2d, 0x01, 0xb4, 0x2d, 0x00, 0x8e, 0x2d, 0x00, 0x8d, 0x2d, 0x01, 0x85, 0x2d, 0x00, 0x92, 0x2d, 0x01, 0x82, 0x2d, 0x00, 0x88, 0x2d, 0x00, 0x8b, 0x19, 0x81, 0x3a, 0xd6, 0x19, 0x00, 0x8a, 0x19, 0x80, 0x4a, 0x01, 0x8a, 0x19, 0x80, 0x4a, 0x8e, 0x19, 0x00, 0x8c, 0x4a, 0x02, 0xa0, 0x19, 0x0e, 0xa0, 0x3a, 0x0e, 0xa5, 0x19, 0x80, 0x2d, 0x82, 0x19, 0x81, 0x4a, 0x85, 0x19, 0x80, 0x4a, 0x9a, 0x19, 0x80, 0x4a, 0x90, 0x19, 0xa8, 0x4a, 0x82, 0x19, 0x03, 0xe2, 0x39, 0x19, 0x15, 0x8a, 0x19, 0x14, 0xe3, 0x3f, 0x19, 0xe0, 0x9f, 0x0f, 0xe2, 0x13, 0x19, 0x01, 0x9f, 0x19, 0x00, 0xe0, 0x08, 0x19, 0xdf, 0x29, 0x9f, 0x4a, 0xe0, 0x13, 0x1a, 0x04, 0x86, 0x1a, 0xa5, 0x28, 0x00, 0x80, 0x28, 0x04, 0x80, 0x28, 0x01, 0xb7, 0x9d, 0x06, 0x81, 0x9d, 0x0d, 0x80, 0x9d, 0x96, 0x27, 0x08, 0x86, 0x27, 0x00, 0x86, 0x27, 0x00, 0x86, 0x27, 0x00, 0x86, 0x27, 0x00, 0x86, 0x27, 0x00, 0x86, 0x27, 0x00, 0x86, 0x27, 0x00, 0x86, 0x27, 0x00, 0x9f, 0x1d, 0xdd, 0x19, 0x21, 0x99, 0x32, 0x00, 0xd8, 0x32, 0x0b, 0xe0, 0x75, 0x32, 0x19, 0x94, 0x19, 0x80, 0x32, 0x80, 0x19, 0x80, 0x32, 0x98, 0x19, 0x88, 0x32, 0x83, 0x3a, 0x81, 0x33, 0x87, 0x19, 0x83, 0x32, 0x83, 0x19, 0x00, 0xd5, 0x38, 0x01, 0x81, 0x3a, 0x81, 0x19, 0x82, 0x38, 0x80, 0x19, 0xd9, 0x40, 0x81, 0x19, 0x82, 0x40, 0x04, 0xaa, 0x0d, 0x00, 0xdd, 0x33, 0x00, 0x8f, 0x19, 0x9f, 0x0d, 0xa5, 0x19, 0x08, 0x80, 0x19, 0x8f, 0x40, 0x9e, 0x33, 0x00, 0xbf, 0x19, 0x9e, 0x33, 0xd0, 0x19, 0xae, 0x40, 0x80, 0x19, 0xd7, 0x40, 0xe0, 0x47, 0x19, 0xf0, 0x09, 0x5f, 0x32, 0xbf, 0x19, 0xf0, 0x41, 0x9f, 0x32, 0xe4, 0x2c, 0xa9, 0x02, 0xb6, 0xa9, 0x08, 0xaf, 0x4f, 0xe0, 0xcb, 0xa4, 0x13, 0xdf, 0x1d, 0xd7, 0x08, 0x07, 0xa1, 0x19, 0xe0, 0x05, 0x4a, 0x82, 0x19, 0xc2, 0x4a, 0x01, 0x81, 0x4a, 0x00, 0x80, 0x4a, 0x00, 0x87, 0x4a, 0x14, 0x8d, 0x4a, 0xac, 0x8f, 0x02, 0x89, 0x19, 0x05, 0xb7, 0x7e, 0x07, 0xc5, 0x84, 0x07, 0x8b, 0x84, 0x05, 0x9f, 0x20, 0xad, 0x42, 0x80, 0x19, 0x80, 0x42, 0xa3, 0x81, 0x0a, 0x80, 0x81, 0x9c, 0x33, 0x02, 0xcd, 0x3d, 0x00, 0x80, 0x19, 0x89, 0x3d, 0x03, 0x81, 0x3d, 0x9e, 0x63, 0x00, 0xb6, 0x16, 0x08, 0x8d, 0x16, 0x01, 0x89, 0x16, 0x01, 0x83, 0x16, 0x9f, 0x63, 0xc2, 0x95, 0x17, 0x84, 0x95, 0x96, 0x5a, 0x09, 0x85, 0x27, 0x01, 0x85, 0x27, 0x01, 0x85, 0x27, 0x08, 0x86, 0x27, 0x00, 0x86, 0x27, 0x00, 0xaa, 0x4a, 0x80, 0x19, 0x88, 0x4a, 0x80, 0x2d, 0x83, 0x4a, 0x81, 0x19, 0x03, 0xcf, 0x17, 0xad, 0x5a, 0x01, 0x89, 0x5a, 0x05, 0xf0, 0x1b, 0x43, 0x33, 0x0b, 0x96, 0x33, 0x03, 0xb0, 0x33, 0x70, 0x10, 0xa3, 0xe1, 0x0d, 0x32, 0x01, 0xe0, 0x09, 0x32, 0x25, 0x86, 0x4a, 0x0b, 0x84, 0x05, 0x04, 0x99, 0x37, 0x00, 0x84, 0x37, 0x00, 0x80, 0x37, 0x00, 0x81, 0x37, 0x00, 0x81, 0x37, 0x00, 0x89, 0x37, 0xe0, 0x12, 0x04, 0x0f, 0xe1, 0x0a, 0x04, 0x81, 0x19, 0xcf, 0x04, 0x01, 0xb5, 0x04, 0x06, 0x80, 0x04, 0x1f, 0x8f, 0x04, 0x8f, 0x3a, 0x89, 0x19, 0x05, 0x8d, 0x3a, 0x81, 0x1d, 0xa2, 0x19, 0x00, 0x92, 0x19, 0x00, 0x83, 0x19, 0x03, 0x84, 0x04, 0x00, 0xe0, 0x26, 0x04, 0x01, 0x80, 0x19, 0x00, 0x9f, 0x19, 0x99, 0x4a, 0x85, 0x19, 0x99, 0x4a, 0x8a, 0x19, 0x89, 0x40, 0x80, 0x19, 0xac, 0x40, 0x81, 0x19, 0x9e, 0x33, 0x02, 0x85, 0x33, 0x01, 0x85, 0x33, 0x01, 0x85, 0x33, 0x01, 0x82, 0x33, 0x02, 0x86, 0x19, 0x00, 0x86, 0x19, 0x09, 0x84, 0x19, 0x01, 0x8b, 0x4e, 0x00, 0x99, 0x4e, 0x00, 0x92, 0x4e, 0x00, 0x81, 0x4e, 0x00, 0x8e, 0x4e, 0x01, 0x8d, 0x4e, 0x21, 0xe0, 0x1a, 0x4e, 0x04, 0x82, 0x19, 0x03, 0xac, 0x19, 0x02, 0x88, 0x19, 0xce, 0x2d, 0x00, 0x8c, 0x19, 0x02, 0x80, 0x2d, 0x2e, 0xac, 0x19, 0x80, 0x3a, 0x60, 0x21, 0x9c, 0x50, 0x02, 0xb0, 0x13, 0x0e, 0x80, 0x3a, 0x9a, 0x19, 0x03, 0xa3, 0x70, 0x08, 0x82, 0x70, 0x9a, 0x2a, 0x04, 0xaa, 0x72, 0x04, 0x9d, 0xa3, 0x00, 0x80, 0xa3, 0xa3, 0x73, 0x03, 0x8d, 0x73, 0x29, 0xcf, 0x1f, 0xaf, 0x86, 0x9d, 0x7a, 0x01, 0x89, 0x7a, 0x05, 0xa3, 0x79, 0x03, 0xa3, 0x79, 0x03, 0xa7, 0x25, 0x07, 0xb3, 0x14, 0x0a, 0x80, 0x14, 0x8a, 0xa5, 0x00, 0x8e, 0xa5, 0x00, 0x86, 0xa5, 0x00, 0x81, 0xa5, 0x00, 0x8a, 0xa5, 0x00, 0x8e, 0xa5, 0x00, 0x86, 0xa5, 0x00, 0x81, 0xa5, 0x02, 0xb3, 0xa0, 0x0b, 0xe0, 0xd6, 0x4d, 0x08, 0x95, 0x4d, 0x09, 0x87, 0x4d, 0x17, 0x85, 0x4a, 0x00, 0xa9, 0x4a, 0x00, 0x88, 0x4a, 0x44, 0x85, 0x1c, 0x01, 0x80, 0x1c, 0x00, 0xab, 0x1c, 0x00, 0x81, 0x1c, 0x02, 0x80, 0x1c, 0x01, 0x80, 0x1c, 0x95, 0x39, 0x00, 0x88, 0x39, 0x9f, 0x7c, 0x9e, 0x64, 0x07, 0x88, 0x64, 0x2f, 0x92, 0x36, 0x00, 0x81, 0x36, 0x04, 0x84, 0x36, 0x9b, 0x7f, 0x02, 0x80, 0x7f, 0x99, 0x51, 0x04, 0x80, 0x51, 0x3f, 0x9f, 0x5d, 0x97, 0x5c, 0x03, 0x93, 0x5c, 0x01, 0xad, 0x5c, 0x83, 0x43, 0x00, 0x81, 0x43, 0x04, 0x87, 0x43, 0x00, 0x82, 0x43, 0x00, 0x9c, 0x43, 0x01, 0x82, 0x43, 0x03, 0x89, 0x43, 0x06, 0x88, 0x43, 0x06, 0x9f, 0x75, 0x9f, 0x71, 0x1f, 0xa6, 0x56, 0x03, 0x8b, 0x56, 0x08, 0xb5, 0x06, 0x02, 0x86, 0x06, 0x95, 0x3c, 0x01, 0x87, 0x3c, 0x92, 0x3b, 0x04, 0x87, 0x3b, 0x91, 0x80, 0x06, 0x83, 0x80, 0x0b, 0x86, 0x80, 0x4f, 0xc8, 0x76, 0x36, 0xb2, 0x6f, 0x0c, 0xb2, 0x6f, 0x06, 0x85, 0x6f, 0xa7, 0x34, 0x07, 0x89, 0x34, 0x05, 0xa5, 0x2b, 0x02, 0x9c, 0x2b, 0x07, 0x81, 0x2b, 0x60, 0x6f, 0x9e, 0x04, 0x00, 0xa9, 0xa8, 0x00, 0x82, 0xa8, 0x01, 0x81, 0xa8, 0x0f, 0x82, 0x04, 0x36, 0x83, 0x04, 0xa7, 0x74, 0x07, 0xa9, 0x8a, 0x15, 0x99, 0x77, 0x25, 0x9b, 0x18, 0x13, 0x96, 0x26, 0x08, 0xcd, 0x0e, 0x03, 0xa3, 0x0e, 0x08, 0x80, 0x0e, 0xc2, 0x3e, 0x09, 0x80, 0x3e, 0x01, 0x98, 0x8b, 0x06, 0x89, 0x8b, 0x05, 0xb4, 0x15, 0x00, 0x91, 0x15, 0x07, 0xa6, 0x53, 0x08, 0xdf, 0x85, 0x00, 0x93, 0x89, 0x0a, 0x91, 0x45, 0x00, 0xae, 0x45, 0x3d, 0x86, 0x62, 0x00, 0x80, 0x62, 0x00, 0x83, 0x62, 0x00, 0x8e, 0x62, 0x00, 0x8a, 0x62, 0x05, 0xba, 0x47, 0x04, 0x89, 0x47, 0x05, 0x83, 0x2c, 0x00, 0x87, 0x2c, 0x01, 0x81, 0x2c, 0x01, 0x95, 0x2c, 0x00, 0x86, 0x2c, 0x00, 0x81, 0x2c, 0x00, 0x84, 0x2c, 0x00, 0x80, 0x3a, 0x88, 0x2c, 0x01, 0x81, 0x2c, 0x01, 0x82, 0x2c, 0x01, 0x80, 0x2c, 0x05, 0x80, 0x2c, 0x04, 0x86, 0x2c, 0x01, 0x86, 0x2c, 0x02, 0x84, 0x2c, 0x0a, 0x89, 0xa2, 0x00, 0x80, 0xa2, 0x01, 0x80, 0xa2, 0x00, 0xa5, 0xa2, 0x00, 0x89, 0xa2, 0x00, 0x80, 0xa2, 0x01, 0x80, 0xa2, 0x00, 0x83, 0xa2, 0x00, 0x89, 0xa2, 0x00, 0x81, 0xa2, 0x07, 0x81, 0xa2, 0x1c, 0xdb, 0x68, 0x00, 0x84, 0x68, 0x1d, 0xc7, 0x9e, 0x07, 0x89, 0x9e, 0x60, 0x45, 0xb5, 0x87, 0x01, 0xa5, 0x87, 0x21, 0xc4, 0x5f, 0x0a, 0x89, 0x5f, 0x05, 0x8c, 0x60, 0x12, 0xb9, 0x96, 0x05, 0x89, 0x96, 0x05, 0x93, 0x63, 0x1b, 0x9a, 0x02, 0x01, 0x8e, 0x02, 0x03, 0x96, 0x02, 0x60, 0x58, 0xbb, 0x22, 0x60, 0x03, 0xd2, 0xa7, 0x0b, 0x80, 0xa7, 0x86, 0x21, 0x01, 0x80, 0x21, 0x01, 0x87, 0x21, 0x00, 0x81, 0x21, 0x00, 0x9d, 0x21, 0x00, 0x81, 0x21, 0x01, 0x8b, 0x21, 0x08, 0x89, 0x21, 0x45, 0x87, 0x66, 0x01, 0xad, 0x66, 0x01, 0x8a, 0x66, 0x1a, 0xc7, 0xaa, 0x07, 0xd2, 0x8c, 0x0c, 0x8f, 0x12, 0xb8, 0x7d, 0x06, 0x89, 0x20, 0x60, 0x55, 0xa1, 0x8e, 0x0d, 0x89, 0x8e, 0x05, 0x88, 0x0c, 0x00, 0xac, 0x0c, 0x00, 0x8d, 0x0c, 0x09, 0x9c, 0x0c, 0x02, 0x9f, 0x57, 0x01, 0x95, 0x57, 0x00, 0x8d, 0x57, 0x48, 0x86, 0x58, 0x00, 0x81, 0x58, 0x00, 0xab, 0x58, 0x02, 0x80, 0x58, 0x00, 0x81, 0x58, 0x00, 0x88, 0x58, 0x07, 0x89, 0x58, 0x05, 0x85, 0x2f, 0x00, 0x81, 0x2f, 0x00, 0xa4, 0x2f, 0x00, 0x81, 0x2f, 0x00, 0x85, 0x2f, 0x06, 0x89, 0x2f, 0x60, 0xd5, 0x98, 0x52, 0x06, 0x90, 0x41, 0x00, 0xa8, 0x41, 0x02, 0x9c, 0x41, 0x54, 0x80, 0x4f, 0x0e, 0xb1, 0x97, 0x0c, 0x80, 0x97, 0xe3, 0x39, 0x1b, 0x60, 0x05, 0xe0, 0x0e, 0x1b, 0x00, 0x84, 0x1b, 0x0a, 0xe0, 0x63, 0x1b, 0x69, 0xeb, 0xe0, 0x02, 0x1e, 0x0c, 0xe3, 0xf5, 0x24, 0x09, 0xef, 0x3a, 0x24, 0x04, 0xe1, 0xe6, 0x03, 0x70, 0x0a, 0x58, 0xb9, 0x31, 0x66, 0x65, 0xe1, 0xd8, 0x08, 0x06, 0x9e, 0x61, 0x00, 0x89, 0x61, 0x03, 0x81, 0x61, 0xce, 0x9f, 0x00, 0x89, 0x9f, 0x05, 0x9d, 0x09, 0x01, 0x85, 0x09, 0x09, 0xc5, 0x7b, 0x09, 0x89, 0x7b, 0x00, 0x86, 0x7b, 0x00, 0x94, 0x7b, 0x04, 0x92, 0x7b, 0x61, 0x4f, 0xb9, 0x48, 0x60, 0x65, 0xda, 0x59, 0x60, 0x04, 0xca, 0x5e, 0x03, 0xb8, 0x5e, 0x06, 0x90, 0x5e, 0x3f, 0x80, 0x98, 0x80, 0x6a, 0x81, 0x32, 0x80, 0x46, 0x0a, 0x81, 0x32, 0x0d, 0xf0, 0x07, 0x97, 0x98, 0x07, 0xe2, 0x9f, 0x98, 0xe1, 0x75, 0x46, 0x28, 0x80, 0x46, 0x88, 0x98, 0x70, 0x12, 0x86, 0x83, 0x40, 0x00, 0x86, 0x40, 0x00, 0x81, 0x40, 0x00, 0x80, 0x40, 0xe0, 0xbe, 0x38, 0x82, 0x40, 0x0e, 0x80, 0x38, 0x1c, 0x82, 0x38, 0x01, 0x80, 0x40, 0x0d, 0x83, 0x40, 0x07, 0xe1, 0x2b, 0x6a, 0x68, 0xa3, 0xe0, 0x0a, 0x23, 0x04, 0x8c, 0x23, 0x02, 0x88, 0x23, 0x06, 0x89, 0x23, 0x01, 0x83, 0x23, 0x83, 0x19, 0x6e, 0xfb, 0xe0, 0x99, 0x19, 0x05, 0xe1, 0x53, 0x19, 0x4b, 0xad, 0x3a, 0x01, 0x96, 0x3a, 0x08, 0xe0, 0x13, 0x19, 0x3b, 0xe0, 0x95, 0x19, 0x09, 0xa6, 0x19, 0x01, 0xbd, 0x19, 0x82, 0x3a, 0x90, 0x19, 0x87, 0x3a, 0x81, 0x19, 0x86, 0x3a, 0x9d, 0x19, 0x83, 0x3a, 0xbc, 0x19, 0x14, 0xc5, 0x2d, 0x60, 0x19, 0x93, 0x19, 0x0b, 0x93, 0x19, 0x0b, 0xd6, 0x19, 0x08, 0x98, 0x19, 0x60, 0x26, 0xd4, 0x19, 0x00, 0xc6, 0x19, 0x00, 0x81, 0x19, 0x01, 0x80, 0x19, 0x01, 0x81, 0x19, 0x01, 0x83, 0x19, 0x00, 0x8b, 0x19, 0x00, 0x80, 0x19, 0x00, 0x86, 0x19, 0x00, 0xc0, 0x19, 0x00, 0x83, 0x19, 0x01, 0x87, 0x19, 0x00, 0x86, 0x19, 0x00, 0x9b, 0x19, 0x00, 0x83, 0x19, 0x00, 0x84, 0x19, 0x00, 0x80, 0x19, 0x02, 0x86, 0x19, 0x00, 0xe0, 0xf3, 0x19, 0x01, 0xe0, 0xc3, 0x19, 0x01, 0xb1, 0x19, 0xe2, 0x2b, 0x88, 0x0e, 0x84, 0x88, 0x00, 0x8e, 0x88, 0x63, 0xef, 0x9e, 0x4a, 0x05, 0x85, 0x4a, 0x60, 0x74, 0x86, 0x29, 0x00, 0x90, 0x29, 0x01, 0x86, 0x29, 0x00, 0x81, 0x29, 0x00, 0x84, 0x29, 0x04, 0xbd, 0x1d, 0x20, 0x80, 0x1d, 0x60, 0x0f, 0xac, 0x6b, 0x02, 0x8d, 0x6b, 0x01, 0x89, 0x6b, 0x03, 0x81, 0x6b, 0x60, 0xdf, 0x9e, 0xa1, 0x10, 0xb9, 0xa6, 0x04, 0x80, 0xa6, 0x61, 0x6f, 0xa9, 0x65, 0x60, 0x75, 0xaa, 0x6e, 0x03, 0x80, 0x6e, 0x61, 0x7f, 0x86, 0x27, 0x00, 0x83, 0x27, 0x00, 0x81, 0x27, 0x00, 0x8e, 0x27, 0x00, 0xe0, 0x64, 0x5b, 0x01, 0x8f, 0x5b, 0x28, 0xcb, 0x01, 0x03, 0x89, 0x01, 0x03, 0x81, 0x01, 0x62, 0xb0, 0xc3, 0x19, 0x4b, 0xbc, 0x19, 0x60, 0x61, 0x83, 0x04, 0x00, 0x9a, 0x04, 0x00, 0x81, 0x04, 0x00, 0x80, 0x04, 0x01, 0x80, 0x04, 0x00, 0x89, 0x04, 0x00, 0x83, 0x04, 0x00, 0x80, 0x04, 0x00, 0x80, 0x04, 0x05, 0x80, 0x04, 0x03, 0x80, 0x04, 0x00, 0x80, 0x04, 0x00, 0x80, 0x04, 0x00, 0x82, 0x04, 0x00, 0x81, 0x04, 0x00, 0x80, 0x04, 0x01, 0x80, 0x04, 0x00, 0x80, 0x04, 0x00, 0x80, 0x04, 0x00, 0x80, 0x04, 0x00, 0x80, 0x04, 0x00, 0x81, 0x04, 0x00, 0x80, 0x04, 0x01, 0x83, 0x04, 0x00, 0x86, 0x04, 0x00, 0x83, 0x04, 0x00, 0x83, 0x04, 0x00, 0x80, 0x04, 0x00, 0x89, 0x04, 0x00, 0x90, 0x04, 0x04, 0x82, 0x04, 0x00, 0x84, 0x04, 0x00, 0x90, 0x04, 0x33, 0x81, 0x04, 0x60, 0xad, 0xab, 0x19, 0x03, 0xe0, 0x03, 0x19, 0x0b, 0x8e, 0x19, 0x01, 0x8e, 0x19, 0x00, 0x8e, 0x19, 0x00, 0xa4, 0x19, 0x09, 0xe0, 0x4d, 0x19, 0x37, 0x99, 0x19, 0x80, 0x38, 0x81, 0x19, 0x0c, 0xab, 0x19, 0x03, 0x88, 0x19, 0x06, 0x81, 0x19, 0x0d, 0x85, 0x19, 0x60, 0x39, 0xe3, 0x77, 0x19, 0x03, 0x90, 0x19, 0x02, 0x8c, 0x19, 0x02, 0xe0, 0x16, 0x19, 0x03, 0xde, 0x19, 0x05, 0x8b, 0x19, 0x03, 0x80, 0x19, 0x0e, 0x8b, 0x19, 0x03, 0xb7, 0x19, 0x07, 0x89, 0x19, 0x05, 0xa7, 0x19, 0x07, 0x9d, 0x19, 0x01, 0x8b, 0x19, 0x03, 0x81, 0x19, 0x3d, 0xe0, 0xf3, 0x19, 0x0b, 0x8d, 0x19, 0x01, 0x8c, 0x19, 0x02, 0x89, 0x19, 0x04, 0xb7, 0x19, 0x06, 0x8e, 0x19, 0x01, 0x8a, 0x19, 0x05, 0x88, 0x19, 0x06, 0xe0, 0x32, 0x19, 0x00, 0xe0, 0x05, 0x19, 0x63, 0xa5, 0xf0, 0x96, 0x7f, 0x32, 0x1f, 0xef, 0xd9, 0x32, 0x05, 0xe0, 0x7d, 0x32, 0x01, 0xf0, 0x06, 0x21, 0x32, 0x0d, 0xf0, 0x0c, 0xd0, 0x32, 0x0e, 0xe2, 0x0d, 0x32, 0x69, 0x41, 0xe1, 0xbd, 0x32, 0x65, 0x81, 0xf0, 0x02, 0xea, 0x32, 0x04, 0xef, 0xff, 0x32, 0x7a, 0xcb, 0xf0, 0x80, 0x19, 0x1d, 0xdf, 0x19, 0x60, 0x1f, 0xe0, 0x8f, 0x3a, }; static const uint8_t unicode_script_ext_table[1253] = { 0x80, 0x36, 0x00, 0x00, 0x10, 0x06, 0x13, 0x1a, 0x23, 0x25, 0x28, 0x29, 0x2f, 0x2a, 0x2d, 0x32, 0x4a, 0x51, 0x53, 0x72, 0x86, 0x81, 0x83, 0x00, 0x00, 0x07, 0x0b, 0x1d, 0x20, 0x4a, 0x4f, 0x9b, 0xa1, 0x09, 0x00, 0x00, 0x02, 0x0d, 0x4a, 0x00, 0x00, 0x02, 0x02, 0x0d, 0x4a, 0x00, 0x00, 0x00, 0x02, 0x4a, 0x4f, 0x08, 0x00, 0x00, 0x02, 0x4a, 0x9b, 0x00, 0x00, 0x00, 0x02, 0x0d, 0x4a, 0x25, 0x00, 0x00, 0x08, 0x17, 0x1a, 0x1d, 0x2d, 0x4a, 0x72, 0x8e, 0x93, 0x00, 0x08, 0x17, 0x1d, 0x2d, 0x4a, 0x79, 0x8e, 0x93, 0xa0, 0x00, 0x04, 0x17, 0x1d, 0x4a, 0x9d, 0x00, 0x05, 0x29, 0x4a, 0x8e, 0x90, 0x9b, 0x00, 0x0b, 0x14, 0x17, 0x1a, 0x1d, 0x2a, 0x2d, 0x4a, 0x79, 0x90, 0x9d, 0xa0, 0x00, 0x06, 0x1a, 0x25, 0x29, 0x2a, 0x40, 0x4a, 0x00, 0x04, 0x1d, 0x2d, 0x4a, 0x72, 0x00, 0x09, 0x1a, 0x23, 0x37, 0x4a, 0x72, 0x90, 0x93, 0x9d, 0xa0, 0x00, 0x0a, 0x05, 0x1d, 0x23, 0x2a, 0x2d, 0x37, 0x4a, 0x72, 0x90, 0x93, 0x00, 0x02, 0x4a, 0x9d, 0x00, 0x03, 0x23, 0x4a, 0x90, 0x00, 0x04, 0x17, 0x1d, 0x4a, 0x79, 0x00, 0x03, 0x17, 0x4a, 0x93, 0x00, 0x02, 0x4a, 0x8e, 0x00, 0x02, 0x27, 0x4a, 0x00, 0x00, 0x00, 0x02, 0x4a, 0x8e, 0x00, 0x03, 0x1d, 0x4a, 0xa0, 0x00, 0x00, 0x00, 0x04, 0x2d, 0x4a, 0x72, 0xa0, 0x0b, 0x00, 0x00, 0x02, 0x4a, 0x90, 0x01, 0x00, 0x00, 0x05, 0x17, 0x23, 0x40, 0x4a, 0x90, 0x00, 0x04, 0x17, 0x23, 0x4a, 0x90, 0x00, 0x02, 0x4a, 0x90, 0x06, 0x00, 0x00, 0x03, 0x4a, 0x8e, 0x90, 0x00, 0x02, 0x4a, 0x90, 0x00, 0x00, 0x00, 0x03, 0x17, 0x4a, 0x90, 0x00, 0x06, 0x14, 0x17, 0x2a, 0x4a, 0x8e, 0x9b, 0x0f, 0x00, 0x00, 0x01, 0x2d, 0x01, 0x00, 0x00, 0x01, 0x2d, 0x11, 0x00, 0x00, 0x02, 0x4a, 0x79, 0x04, 0x00, 0x00, 0x03, 0x14, 0x4a, 0xa0, 0x03, 0x00, 0x0c, 0x01, 0x4a, 0x03, 0x00, 0x01, 0x02, 0x1a, 0x2d, 0x80, 0x8c, 0x00, 0x00, 0x02, 0x1d, 0x72, 0x00, 0x02, 0x1d, 0x29, 0x01, 0x02, 0x1d, 0x4a, 0x00, 0x02, 0x1d, 0x29, 0x80, 0x80, 0x00, 0x00, 0x03, 0x05, 0x28, 0x29, 0x80, 0x01, 0x00, 0x00, 0x07, 0x04, 0x2b, 0x69, 0x34, 0x90, 0x9a, 0xa8, 0x0d, 0x00, 0x00, 0x07, 0x04, 0x2b, 0x69, 0x34, 0x90, 0x9a, 0xa8, 0x00, 0x03, 0x04, 0x90, 0x9a, 0x01, 0x00, 0x00, 0x08, 0x01, 0x04, 0x2b, 0x69, 0x34, 0x90, 0x9a, 0xa8, 0x1f, 0x00, 0x00, 0x09, 0x01, 0x04, 0x55, 0x56, 0x77, 0x80, 0x34, 0x8a, 0x90, 0x09, 0x00, 0x0a, 0x02, 0x04, 0x90, 0x09, 0x00, 0x09, 0x03, 0x04, 0x9a, 0xa8, 0x05, 0x00, 0x00, 0x02, 0x04, 0x90, 0x62, 0x00, 0x00, 0x02, 0x04, 0x34, 0x81, 0xfb, 0x00, 0x00, 0x0d, 0x0b, 0x20, 0x2c, 0x2e, 0x30, 0x3f, 0x4a, 0x54, 0x78, 0x85, 0x97, 0x99, 0x9e, 0x00, 0x0c, 0x0b, 0x20, 0x2c, 0x2e, 0x30, 0x3f, 0x4a, 0x54, 0x78, 0x97, 0x99, 0x9e, 0x10, 0x00, 0x00, 0x15, 0x0b, 0x20, 0x22, 0x2f, 0x58, 0x2c, 0x2e, 0x30, 0x3f, 0x53, 0x54, 0x66, 0x6e, 0x78, 0x47, 0x89, 0x8f, 0x96, 0x97, 0x99, 0x9e, 0x00, 0x17, 0x0b, 0x20, 0x22, 0x2f, 0x58, 0x2c, 0x2e, 0x31, 0x30, 0x3f, 0x4c, 0x53, 0x54, 0x66, 0x6e, 0x78, 0x47, 0x89, 0x8f, 0x96, 0x97, 0x99, 0x9e, 0x09, 0x04, 0x20, 0x22, 0x3e, 0x53, 0x75, 0x00, 0x09, 0x03, 0x0b, 0x15, 0x8f, 0x75, 0x00, 0x09, 0x02, 0x30, 0x62, 0x75, 0x00, 0x09, 0x02, 0x2e, 0x45, 0x80, 0x75, 0x00, 0x0d, 0x02, 0x2c, 0x97, 0x80, 0x71, 0x00, 0x09, 0x03, 0x3f, 0x66, 0xa2, 0x82, 0xcf, 0x00, 0x09, 0x03, 0x15, 0x63, 0x93, 0x80, 0x30, 0x00, 0x00, 0x03, 0x28, 0x29, 0x4a, 0x85, 0x6e, 0x00, 0x02, 0x01, 0x82, 0x46, 0x00, 0x01, 0x04, 0x11, 0x35, 0x92, 0x91, 0x80, 0x4a, 0x00, 0x01, 0x02, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x02, 0x60, 0x7e, 0x84, 0x49, 0x00, 0x00, 0x04, 0x0b, 0x20, 0x2c, 0x3f, 0x00, 0x01, 0x20, 0x00, 0x04, 0x0b, 0x20, 0x2c, 0x3f, 0x00, 0x03, 0x20, 0x2c, 0x3f, 0x00, 0x01, 0x20, 0x01, 0x02, 0x0b, 0x20, 0x00, 0x02, 0x20, 0x85, 0x00, 0x02, 0x0b, 0x20, 0x00, 0x02, 0x20, 0x85, 0x00, 0x06, 0x20, 0x3f, 0x54, 0x78, 0x97, 0x99, 0x00, 0x01, 0x20, 0x01, 0x02, 0x20, 0x85, 0x01, 0x01, 0x20, 0x00, 0x02, 0x20, 0x85, 0x00, 0x02, 0x0b, 0x20, 0x06, 0x01, 0x20, 0x00, 0x02, 0x20, 0x66, 0x00, 0x02, 0x0b, 0x20, 0x01, 0x01, 0x20, 0x00, 0x02, 0x0b, 0x20, 0x03, 0x01, 0x20, 0x00, 0x0b, 0x0b, 0x20, 0x2c, 0x3f, 0x54, 0x66, 0x78, 0x89, 0x99, 0x9e, 0xa2, 0x00, 0x02, 0x20, 0x2c, 0x00, 0x04, 0x20, 0x2c, 0x3f, 0xa2, 0x01, 0x02, 0x0b, 0x20, 0x00, 0x01, 0x0b, 0x01, 0x02, 0x20, 0x2c, 0x00, 0x01, 0x66, 0x80, 0x44, 0x00, 0x01, 0x01, 0x2d, 0x35, 0x00, 0x00, 0x03, 0x1d, 0x4a, 0x90, 0x00, 0x00, 0x00, 0x01, 0x90, 0x81, 0xb3, 0x00, 0x00, 0x03, 0x4a, 0x60, 0x7e, 0x1e, 0x00, 0x00, 0x02, 0x01, 0x04, 0x09, 0x00, 0x00, 0x06, 0x13, 0x28, 0x29, 0x6f, 0x50, 0x76, 0x01, 0x00, 0x00, 0x04, 0x13, 0x2d, 0x6f, 0x5d, 0x80, 0x11, 0x00, 0x00, 0x03, 0x20, 0x2c, 0x4a, 0x8c, 0xa5, 0x00, 0x00, 0x02, 0x1a, 0x4a, 0x17, 0x00, 0x00, 0x02, 0x06, 0x76, 0x00, 0x07, 0x06, 0x13, 0x28, 0x6f, 0x3e, 0x51, 0x83, 0x09, 0x00, 0x00, 0x01, 0x23, 0x03, 0x00, 0x00, 0x03, 0x01, 0x04, 0x6f, 0x00, 0x00, 0x00, 0x02, 0x1d, 0x29, 0x81, 0x2b, 0x00, 0x0f, 0x02, 0x32, 0x98, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x33, 0x32, 0x38, 0x40, 0x60, 0xa9, 0x00, 0x08, 0x0d, 0x33, 0x32, 0x38, 0x40, 0x60, 0x7e, 0xa9, 0x00, 0x05, 0x0d, 0x33, 0x32, 0x38, 0x40, 0x01, 0x00, 0x00, 0x01, 0x32, 0x00, 0x00, 0x01, 0x08, 0x0d, 0x33, 0x32, 0x38, 0x40, 0x60, 0x9c, 0xa9, 0x01, 0x09, 0x0d, 0x33, 0x32, 0x38, 0x40, 0x4f, 0x60, 0x9c, 0xa9, 0x05, 0x06, 0x0d, 0x33, 0x32, 0x38, 0x40, 0xa9, 0x00, 0x00, 0x00, 0x05, 0x0d, 0x33, 0x32, 0x38, 0x40, 0x07, 0x06, 0x0d, 0x33, 0x32, 0x38, 0x40, 0xa9, 0x03, 0x05, 0x0d, 0x33, 0x32, 0x38, 0x40, 0x09, 0x00, 0x03, 0x02, 0x0d, 0x32, 0x01, 0x00, 0x00, 0x05, 0x0d, 0x33, 0x32, 0x38, 0x40, 0x04, 0x02, 0x38, 0x40, 0x00, 0x00, 0x00, 0x05, 0x0d, 0x33, 0x32, 0x38, 0x40, 0x03, 0x00, 0x01, 0x03, 0x32, 0x38, 0x40, 0x01, 0x01, 0x32, 0x58, 0x00, 0x03, 0x02, 0x38, 0x40, 0x02, 0x00, 0x00, 0x02, 0x38, 0x40, 0x59, 0x00, 0x00, 0x06, 0x0d, 0x33, 0x32, 0x38, 0x40, 0xa9, 0x00, 0x02, 0x38, 0x40, 0x80, 0x12, 0x00, 0x0f, 0x01, 0x32, 0x1f, 0x00, 0x25, 0x01, 0x32, 0x08, 0x00, 0x00, 0x02, 0x32, 0x98, 0x2f, 0x00, 0x27, 0x01, 0x32, 0x37, 0x00, 0x30, 0x01, 0x32, 0x0e, 0x00, 0x0b, 0x01, 0x32, 0x32, 0x00, 0x00, 0x01, 0x32, 0x57, 0x00, 0x18, 0x01, 0x32, 0x09, 0x00, 0x04, 0x01, 0x32, 0x5f, 0x00, 0x1e, 0x01, 0x32, 0xc0, 0x31, 0xef, 0x00, 0x00, 0x02, 0x1d, 0x29, 0x80, 0x0f, 0x00, 0x07, 0x02, 0x32, 0x4a, 0x80, 0xa7, 0x00, 0x02, 0x10, 0x20, 0x22, 0x2e, 0x30, 0x45, 0x3f, 0x3e, 0x53, 0x54, 0x5f, 0x66, 0x85, 0x47, 0x96, 0x9e, 0xa2, 0x02, 0x0f, 0x20, 0x22, 0x2e, 0x30, 0x45, 0x3f, 0x3e, 0x53, 0x5f, 0x66, 0x85, 0x47, 0x96, 0x9e, 0xa2, 0x01, 0x0b, 0x20, 0x22, 0x2e, 0x30, 0x45, 0x3e, 0x53, 0x5f, 0x47, 0x96, 0x9e, 0x00, 0x0c, 0x20, 0x22, 0x2e, 0x30, 0x45, 0x3e, 0x53, 0x5f, 0x85, 0x47, 0x96, 0x9e, 0x00, 0x0b, 0x20, 0x22, 0x2e, 0x30, 0x45, 0x3e, 0x53, 0x5f, 0x47, 0x96, 0x9e, 0x80, 0x36, 0x00, 0x00, 0x03, 0x0b, 0x20, 0xa2, 0x00, 0x00, 0x00, 0x02, 0x20, 0x97, 0x39, 0x00, 0x00, 0x03, 0x42, 0x4a, 0x63, 0x80, 0x1f, 0x00, 0x00, 0x02, 0x10, 0x3d, 0xc0, 0x12, 0xed, 0x00, 0x01, 0x02, 0x04, 0x69, 0x80, 0x31, 0x00, 0x00, 0x02, 0x04, 0x9a, 0x09, 0x00, 0x00, 0x02, 0x04, 0x9a, 0x46, 0x00, 0x01, 0x05, 0x0d, 0x33, 0x32, 0x38, 0x40, 0x80, 0x99, 0x00, 0x04, 0x06, 0x0d, 0x33, 0x32, 0x38, 0x40, 0xa9, 0x09, 0x00, 0x00, 0x02, 0x38, 0x40, 0x2c, 0x00, 0x01, 0x02, 0x38, 0x40, 0x80, 0xdf, 0x00, 0x01, 0x03, 0x1e, 0x1c, 0x4e, 0x00, 0x02, 0x1c, 0x4e, 0x03, 0x00, 0x2c, 0x03, 0x1c, 0x4d, 0x4e, 0x02, 0x00, 0x08, 0x02, 0x1c, 0x4e, 0x81, 0x1f, 0x00, 0x1b, 0x02, 0x04, 0x1a, 0x87, 0x75, 0x00, 0x00, 0x02, 0x56, 0x77, 0x87, 0x8d, 0x00, 0x00, 0x02, 0x2c, 0x97, 0x00, 0x00, 0x00, 0x02, 0x2c, 0x97, 0x36, 0x00, 0x01, 0x02, 0x2c, 0x97, 0x8c, 0x12, 0x00, 0x01, 0x02, 0x2c, 0x97, 0x00, 0x00, 0x00, 0x02, 0x2c, 0x97, 0xc0, 0x5c, 0x4b, 0x00, 0x03, 0x01, 0x23, 0x96, 0x3b, 0x00, 0x11, 0x01, 0x32, 0x9e, 0x5d, 0x00, 0x01, 0x01, 0x32, 0xce, 0xcd, 0x2d, 0x00, }; static const uint8_t unicode_prop_Hyphen_table[28] = { 0xac, 0x80, 0xfe, 0x80, 0x44, 0xdb, 0x80, 0x52, 0x7a, 0x80, 0x48, 0x08, 0x81, 0x4e, 0x04, 0x80, 0x42, 0xe2, 0x80, 0x60, 0xcd, 0x66, 0x80, 0x40, 0xa8, 0x80, 0xd6, 0x80, }; static const uint8_t unicode_prop_Other_Math_table[200] = { 0xdd, 0x80, 0x43, 0x70, 0x11, 0x80, 0x99, 0x09, 0x81, 0x5c, 0x1f, 0x80, 0x9a, 0x82, 0x8a, 0x80, 0x9f, 0x83, 0x97, 0x81, 0x8d, 0x81, 0xc0, 0x8c, 0x18, 0x11, 0x1c, 0x91, 0x03, 0x01, 0x89, 0x00, 0x14, 0x28, 0x11, 0x09, 0x02, 0x05, 0x13, 0x24, 0xca, 0x21, 0x18, 0x08, 0x08, 0x00, 0x21, 0x0b, 0x0b, 0x91, 0x09, 0x00, 0x06, 0x00, 0x29, 0x41, 0x21, 0x83, 0x40, 0xa7, 0x08, 0x80, 0x97, 0x80, 0x90, 0x80, 0x41, 0xbc, 0x81, 0x8b, 0x88, 0x24, 0x21, 0x09, 0x14, 0x8d, 0x00, 0x01, 0x85, 0x97, 0x81, 0xb8, 0x00, 0x80, 0x9c, 0x83, 0x88, 0x81, 0x41, 0x55, 0x81, 0x9e, 0x89, 0x41, 0x92, 0x95, 0xbe, 0x83, 0x9f, 0x81, 0x60, 0xd4, 0x62, 0x00, 0x03, 0x80, 0x40, 0xd2, 0x00, 0x80, 0x60, 0xd4, 0xc0, 0xd4, 0x80, 0xc6, 0x01, 0x08, 0x09, 0x0b, 0x80, 0x8b, 0x00, 0x06, 0x80, 0xc0, 0x03, 0x0f, 0x06, 0x80, 0x9b, 0x03, 0x04, 0x00, 0x16, 0x80, 0x41, 0x53, 0x81, 0x98, 0x80, 0x98, 0x80, 0x9e, 0x80, 0x98, 0x80, 0x9e, 0x80, 0x98, 0x80, 0x9e, 0x80, 0x98, 0x80, 0x9e, 0x80, 0x98, 0x07, 0x81, 0xb1, 0x55, 0xff, 0x18, 0x9a, 0x01, 0x00, 0x08, 0x80, 0x89, 0x03, 0x00, 0x00, 0x28, 0x18, 0x00, 0x00, 0x02, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x06, 0x03, 0x03, 0x00, 0x80, 0x89, 0x80, 0x90, 0x22, 0x04, 0x80, 0x90, }; static const uint8_t unicode_prop_Other_Alphabetic_table[443] = { 0x43, 0x44, 0x80, 0x9c, 0x8c, 0x42, 0x3f, 0x8d, 0x00, 0x01, 0x01, 0x00, 0xc7, 0x8a, 0xaf, 0x8c, 0x06, 0x8f, 0x80, 0xe4, 0x33, 0x19, 0x0b, 0x80, 0xa2, 0x80, 0x9d, 0x8f, 0xe5, 0x8a, 0xe4, 0x0a, 0x88, 0x02, 0x03, 0xe9, 0x80, 0xbb, 0x8b, 0x16, 0x85, 0x93, 0xb5, 0x09, 0x8e, 0x01, 0x22, 0x89, 0x81, 0x9c, 0x82, 0xb9, 0x31, 0x09, 0x81, 0x89, 0x80, 0x89, 0x81, 0x9c, 0x82, 0xb9, 0x23, 0x09, 0x0b, 0x80, 0x9d, 0x0a, 0x80, 0x8a, 0x82, 0xb9, 0x38, 0x10, 0x81, 0x94, 0x81, 0x95, 0x13, 0x82, 0xb9, 0x31, 0x09, 0x81, 0x88, 0x81, 0x89, 0x81, 0x9d, 0x80, 0xba, 0x22, 0x10, 0x82, 0x89, 0x80, 0xa7, 0x84, 0xb8, 0x30, 0x10, 0x17, 0x81, 0x8a, 0x81, 0x9c, 0x82, 0xb9, 0x30, 0x10, 0x17, 0x81, 0x8a, 0x81, 0x8e, 0x80, 0x8b, 0x83, 0xb9, 0x30, 0x10, 0x82, 0x89, 0x80, 0x89, 0x81, 0x9c, 0x82, 0xca, 0x28, 0x00, 0x87, 0x91, 0x81, 0xbc, 0x01, 0x86, 0x91, 0x80, 0xe2, 0x01, 0x28, 0x81, 0x8f, 0x80, 0x40, 0xa2, 0x92, 0x88, 0x8a, 0x80, 0xa3, 0xed, 0x8b, 0x00, 0x0b, 0x96, 0x1b, 0x10, 0x11, 0x32, 0x83, 0x8c, 0x8b, 0x00, 0x89, 0x83, 0x46, 0x73, 0x81, 0x9d, 0x81, 0x9d, 0x81, 0x9d, 0x81, 0xc1, 0x92, 0x40, 0xbb, 0x81, 0xa1, 0x80, 0xf5, 0x8b, 0x83, 0x88, 0x40, 0xdd, 0x84, 0xb8, 0x89, 0x81, 0x93, 0xc9, 0x81, 0x8a, 0x82, 0xb0, 0x84, 0xaf, 0x8e, 0xbb, 0x82, 0x9d, 0x88, 0x09, 0xb8, 0x8a, 0xb1, 0x92, 0x41, 0x9b, 0xa1, 0x46, 0xc0, 0xb3, 0x48, 0xf5, 0x9f, 0x60, 0x78, 0x73, 0x87, 0xa1, 0x81, 0x41, 0x61, 0x07, 0x80, 0x96, 0x84, 0xd7, 0x81, 0xb1, 0x8f, 0x00, 0xb8, 0x80, 0xa5, 0x84, 0x9b, 0x8b, 0xac, 0x83, 0xaf, 0x8b, 0xa4, 0x80, 0xc2, 0x8d, 0x8b, 0x07, 0x81, 0xac, 0x82, 0xb1, 0x00, 0x11, 0x0c, 0x80, 0xab, 0x24, 0x80, 0x40, 0xec, 0x87, 0x60, 0x4f, 0x32, 0x80, 0x48, 0x56, 0x84, 0x46, 0x85, 0x10, 0x0c, 0x83, 0x43, 0x13, 0x83, 0xc0, 0x80, 0x41, 0x40, 0x81, 0xce, 0x80, 0x41, 0x02, 0x82, 0xb4, 0x8d, 0xac, 0x81, 0x8a, 0x82, 0xac, 0x88, 0x88, 0x80, 0xbc, 0x82, 0xa3, 0x8b, 0x91, 0x81, 0xb8, 0x82, 0xaf, 0x8c, 0x8d, 0x81, 0xdb, 0x88, 0x08, 0x28, 0x08, 0x40, 0x9c, 0x89, 0x96, 0x83, 0xb9, 0x31, 0x09, 0x81, 0x89, 0x80, 0x89, 0x81, 0xd3, 0x88, 0x00, 0x08, 0x03, 0x01, 0xe6, 0x8c, 0x02, 0xe9, 0x91, 0x40, 0xec, 0x31, 0x86, 0x9c, 0x81, 0xd1, 0x8e, 0x00, 0xe9, 0x8a, 0xe6, 0x8d, 0x41, 0x00, 0x8c, 0x40, 0xf6, 0x28, 0x09, 0x0a, 0x00, 0x80, 0x40, 0x8d, 0x31, 0x2b, 0x80, 0x9b, 0x89, 0xa9, 0x20, 0x83, 0x91, 0x8a, 0xad, 0x8d, 0x41, 0x96, 0x38, 0x86, 0xd2, 0x95, 0x80, 0x8d, 0xf9, 0x2a, 0x00, 0x08, 0x10, 0x02, 0x80, 0xc1, 0x20, 0x08, 0x83, 0x41, 0x5b, 0x83, 0x88, 0x08, 0x80, 0xaf, 0x32, 0x82, 0x60, 0x41, 0xdc, 0x90, 0x4e, 0x1f, 0x00, 0xb6, 0x33, 0xdc, 0x81, 0x60, 0x4c, 0xab, 0x80, 0x60, 0x23, 0x60, 0x30, 0x90, 0x0e, 0x01, 0x04, 0xe3, 0x80, 0x48, 0xb6, 0x80, 0x47, 0xe7, 0x99, 0x85, 0x99, 0x85, 0x99, }; static const uint8_t unicode_prop_Other_Lowercase_table[69] = { 0x40, 0xa9, 0x80, 0x8e, 0x80, 0x41, 0xf4, 0x88, 0x31, 0x9d, 0x84, 0xdf, 0x80, 0xb3, 0x80, 0x4d, 0x80, 0x80, 0x4c, 0x2e, 0xbe, 0x8c, 0x80, 0xa1, 0xa4, 0x42, 0xb0, 0x80, 0x8c, 0x80, 0x8f, 0x8c, 0x40, 0xd2, 0x8f, 0x43, 0x4f, 0x99, 0x47, 0x91, 0x81, 0x60, 0x7a, 0x1d, 0x81, 0x40, 0xd1, 0x80, 0x40, 0x80, 0x12, 0x81, 0x43, 0x61, 0x83, 0x88, 0x80, 0x60, 0x5c, 0x15, 0x01, 0x10, 0xa9, 0x80, 0x88, 0x60, 0xd8, 0x74, 0xbd, }; static const uint8_t unicode_prop_Other_Uppercase_table[15] = { 0x60, 0x21, 0x5f, 0x8f, 0x43, 0x45, 0x99, 0x61, 0xcc, 0x5f, 0x99, 0x85, 0x99, 0x85, 0x99, }; static const uint8_t unicode_prop_Other_Grapheme_Extend_table[112] = { 0x49, 0xbd, 0x80, 0x97, 0x80, 0x41, 0x65, 0x80, 0x97, 0x80, 0xe5, 0x80, 0x97, 0x80, 0x40, 0xe7, 0x00, 0x03, 0x08, 0x81, 0x88, 0x81, 0xe6, 0x80, 0x97, 0x80, 0xf6, 0x80, 0x8e, 0x80, 0x49, 0x34, 0x80, 0x9d, 0x80, 0x43, 0xff, 0x04, 0x00, 0x04, 0x81, 0xe4, 0x80, 0xc6, 0x81, 0x44, 0x17, 0x80, 0x50, 0x20, 0x81, 0x60, 0x79, 0x22, 0x80, 0xeb, 0x80, 0x60, 0x55, 0xdc, 0x81, 0x52, 0x1f, 0x80, 0xf3, 0x80, 0x41, 0x07, 0x80, 0x8d, 0x80, 0x88, 0x80, 0xdf, 0x80, 0x88, 0x01, 0x00, 0x14, 0x80, 0x40, 0xdf, 0x80, 0x8b, 0x80, 0x40, 0xf0, 0x80, 0x41, 0x05, 0x80, 0x42, 0x78, 0x80, 0x8b, 0x80, 0x46, 0x02, 0x80, 0x60, 0x50, 0xad, 0x81, 0x60, 0x61, 0x72, 0x0d, 0x85, 0x6c, 0x2e, 0xac, 0xdf, }; static const uint8_t unicode_prop_Other_Default_Ignorable_Code_Point_table[32] = { 0x43, 0x4e, 0x80, 0x4e, 0x0e, 0x81, 0x46, 0x52, 0x81, 0x48, 0xae, 0x80, 0x50, 0xfd, 0x80, 0x60, 0xce, 0x3a, 0x80, 0xce, 0x88, 0x6d, 0x00, 0x06, 0x00, 0x9d, 0xdf, 0xff, 0x40, 0xef, 0x4e, 0x0f, }; static const uint8_t unicode_prop_Other_ID_Start_table[11] = { 0x58, 0x84, 0x81, 0x48, 0x90, 0x80, 0x94, 0x80, 0x4f, 0x6b, 0x81, }; static const uint8_t unicode_prop_Other_ID_Continue_table[22] = { 0x40, 0xb6, 0x80, 0x42, 0xce, 0x80, 0x4f, 0xe0, 0x88, 0x46, 0x67, 0x80, 0x46, 0x30, 0x81, 0x50, 0xec, 0x80, 0x60, 0xce, 0x68, 0x80, }; static const uint8_t unicode_prop_Prepended_Concatenation_Mark_table[19] = { 0x45, 0xff, 0x85, 0x40, 0xd6, 0x80, 0xb0, 0x80, 0x41, 0x7f, 0x81, 0xcf, 0x80, 0x61, 0x07, 0xd9, 0x80, 0x8e, 0x80, }; static const uint8_t unicode_prop_XID_Start1_table[31] = { 0x43, 0x79, 0x80, 0x4a, 0xb7, 0x80, 0xfe, 0x80, 0x60, 0x21, 0xe6, 0x81, 0x60, 0xcb, 0xc0, 0x85, 0x41, 0x95, 0x81, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x41, 0x1e, 0x81, }; static const uint8_t unicode_prop_XID_Continue1_table[23] = { 0x43, 0x79, 0x80, 0x60, 0x2d, 0x1f, 0x81, 0x60, 0xcb, 0xc0, 0x85, 0x41, 0x95, 0x81, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, }; static const uint8_t unicode_prop_Changes_When_Titlecased1_table[22] = { 0x41, 0xc3, 0x08, 0x08, 0x81, 0xa4, 0x81, 0x4e, 0xdc, 0xaa, 0x0a, 0x4e, 0x87, 0x3f, 0x3f, 0x87, 0x8b, 0x80, 0x8e, 0x80, 0xae, 0x80, }; static const uint8_t unicode_prop_Changes_When_Casefolded1_table[29] = { 0x41, 0xef, 0x80, 0x41, 0x9e, 0x80, 0x9e, 0x80, 0x5a, 0xe4, 0x83, 0x40, 0xb5, 0x00, 0x00, 0x00, 0x80, 0xde, 0x06, 0x06, 0x80, 0x8a, 0x09, 0x81, 0x89, 0x10, 0x81, 0x8d, 0x80, }; static const uint8_t unicode_prop_Changes_When_NFKC_Casefolded1_table[450] = { 0x40, 0x9f, 0x06, 0x00, 0x01, 0x00, 0x01, 0x12, 0x10, 0x82, 0xf3, 0x80, 0x8b, 0x80, 0x40, 0x84, 0x01, 0x01, 0x80, 0xa2, 0x01, 0x80, 0x40, 0xbb, 0x88, 0x9e, 0x29, 0x84, 0xda, 0x08, 0x81, 0x89, 0x80, 0xa3, 0x04, 0x02, 0x04, 0x08, 0x07, 0x80, 0x9e, 0x80, 0xa0, 0x82, 0x9c, 0x80, 0x42, 0x28, 0x80, 0xd7, 0x83, 0x42, 0xde, 0x87, 0xfb, 0x08, 0x80, 0xd2, 0x01, 0x80, 0xa1, 0x11, 0x80, 0x40, 0xfc, 0x81, 0x42, 0xd4, 0x80, 0xfe, 0x80, 0xa7, 0x81, 0xad, 0x80, 0xb5, 0x80, 0x88, 0x03, 0x03, 0x03, 0x80, 0x8b, 0x80, 0x88, 0x00, 0x26, 0x80, 0x90, 0x80, 0x88, 0x03, 0x03, 0x03, 0x80, 0x8b, 0x80, 0x41, 0x41, 0x80, 0xe1, 0x81, 0x46, 0x52, 0x81, 0xd4, 0x84, 0x45, 0x1b, 0x10, 0x8a, 0x80, 0x91, 0x80, 0x9b, 0x8c, 0x80, 0xa1, 0xa4, 0x40, 0xd5, 0x83, 0x40, 0xb5, 0x00, 0x00, 0x00, 0x80, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xb7, 0x05, 0x00, 0x13, 0x05, 0x11, 0x02, 0x0c, 0x11, 0x00, 0x00, 0x0c, 0x15, 0x05, 0x08, 0x8f, 0x00, 0x20, 0x8b, 0x12, 0x2a, 0x08, 0x0b, 0x00, 0x07, 0x82, 0x8c, 0x06, 0x92, 0x81, 0x9a, 0x80, 0x8c, 0x8a, 0x80, 0xd6, 0x18, 0x10, 0x8a, 0x01, 0x0c, 0x0a, 0x00, 0x10, 0x11, 0x02, 0x06, 0x05, 0x1c, 0x85, 0x8f, 0x8f, 0x8f, 0x88, 0x80, 0x40, 0xa1, 0x08, 0x81, 0x40, 0xf7, 0x81, 0x41, 0x34, 0xd5, 0x99, 0x9a, 0x45, 0x20, 0x80, 0xe6, 0x82, 0xe4, 0x80, 0x41, 0x9e, 0x81, 0x40, 0xf0, 0x80, 0x41, 0x2e, 0x80, 0xd2, 0x80, 0x8b, 0x40, 0xd5, 0xa9, 0x80, 0xb4, 0x00, 0x82, 0xdf, 0x09, 0x80, 0xde, 0x80, 0xb0, 0xdd, 0x82, 0x8d, 0xdf, 0x9e, 0x80, 0xa7, 0x87, 0xae, 0x80, 0x41, 0x7f, 0x60, 0x72, 0x9b, 0x81, 0x40, 0xd1, 0x80, 0x40, 0x80, 0x12, 0x81, 0x43, 0x61, 0x83, 0x88, 0x80, 0x60, 0x4d, 0x95, 0x41, 0x0d, 0x08, 0x00, 0x81, 0x89, 0x00, 0x00, 0x09, 0x82, 0xc3, 0x81, 0xe9, 0xc2, 0x00, 0x97, 0x04, 0x00, 0x01, 0x01, 0x80, 0xeb, 0xa0, 0x41, 0x6a, 0x91, 0xbf, 0x81, 0xb5, 0xa7, 0x8c, 0x82, 0x99, 0x95, 0x94, 0x81, 0x8b, 0x80, 0x92, 0x03, 0x1a, 0x00, 0x80, 0x40, 0x86, 0x08, 0x80, 0x9f, 0x99, 0x40, 0x83, 0x15, 0x0d, 0x0d, 0x0a, 0x16, 0x06, 0x80, 0x88, 0x47, 0x87, 0x20, 0xa9, 0x80, 0x88, 0x60, 0xb4, 0xe4, 0x83, 0x50, 0x31, 0xa3, 0x44, 0x63, 0x86, 0x8d, 0x87, 0xbf, 0x85, 0x42, 0x3e, 0xd4, 0x80, 0xc6, 0x01, 0x08, 0x09, 0x0b, 0x80, 0x8b, 0x00, 0x06, 0x80, 0xc0, 0x03, 0x0f, 0x06, 0x80, 0x9b, 0x03, 0x04, 0x00, 0x16, 0x80, 0x41, 0x53, 0x81, 0x41, 0x23, 0x81, 0xb1, 0x48, 0x2f, 0xbd, 0x4d, 0x91, 0x18, 0x9a, 0x01, 0x00, 0x08, 0x80, 0x89, 0x03, 0x00, 0x00, 0x28, 0x18, 0x00, 0x00, 0x02, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x06, 0x03, 0x03, 0x00, 0x80, 0x89, 0x80, 0x90, 0x22, 0x04, 0x80, 0x90, 0x42, 0x43, 0x8a, 0x84, 0x9e, 0x80, 0x9f, 0x99, 0x82, 0xa2, 0x80, 0xee, 0x82, 0x8c, 0xab, 0x83, 0x88, 0x31, 0x49, 0x9d, 0x89, 0x60, 0xfc, 0x05, 0x42, 0x1d, 0x6b, 0x05, 0xe1, 0x4f, 0xff, }; static const uint8_t unicode_prop_ASCII_Hex_Digit_table[5] = { 0xaf, 0x89, 0x35, 0x99, 0x85, }; static const uint8_t unicode_prop_Bidi_Control_table[10] = { 0x46, 0x1b, 0x80, 0x59, 0xf0, 0x81, 0x99, 0x84, 0xb6, 0x83, }; static const uint8_t unicode_prop_Dash_table[58] = { 0xac, 0x80, 0x45, 0x5b, 0x80, 0xb2, 0x80, 0x4e, 0x40, 0x80, 0x44, 0x04, 0x80, 0x48, 0x08, 0x85, 0xbc, 0x80, 0xa6, 0x80, 0x8e, 0x80, 0x41, 0x85, 0x80, 0x4c, 0x03, 0x01, 0x80, 0x9e, 0x0b, 0x80, 0x9b, 0x80, 0x41, 0xbd, 0x80, 0x92, 0x80, 0xee, 0x80, 0x60, 0xcd, 0x8f, 0x81, 0xa4, 0x80, 0x89, 0x80, 0x40, 0xa8, 0x80, 0x4e, 0x5f, 0x80, 0x41, 0x3d, 0x80, }; static const uint8_t unicode_prop_Deprecated_table[23] = { 0x41, 0x48, 0x80, 0x45, 0x28, 0x80, 0x49, 0x02, 0x00, 0x80, 0x48, 0x28, 0x81, 0x48, 0xc4, 0x85, 0x42, 0xb8, 0x81, 0x6d, 0xdc, 0xd5, 0x80, }; static const uint8_t unicode_prop_Diacritic_table[438] = { 0xdd, 0x00, 0x80, 0xc6, 0x05, 0x03, 0x01, 0x81, 0x41, 0xf6, 0x40, 0x9e, 0x07, 0x25, 0x90, 0x0b, 0x80, 0x88, 0x81, 0x40, 0xfc, 0x84, 0x40, 0xd0, 0x80, 0xb6, 0x90, 0x80, 0x9a, 0x00, 0x01, 0x00, 0x40, 0x85, 0x3b, 0x81, 0x40, 0x85, 0x0b, 0x0a, 0x82, 0xc2, 0x9a, 0xda, 0x8a, 0xb9, 0x8a, 0xa1, 0x81, 0xfd, 0x87, 0xa8, 0x89, 0x8f, 0x9b, 0xbc, 0x80, 0x8f, 0x02, 0x83, 0x9b, 0x80, 0xc9, 0x80, 0x8f, 0x80, 0xed, 0x80, 0x8f, 0x80, 0xed, 0x80, 0x8f, 0x80, 0xae, 0x82, 0xbb, 0x80, 0x8f, 0x06, 0x80, 0xf6, 0x80, 0xed, 0x80, 0x8f, 0x80, 0xed, 0x80, 0x8f, 0x80, 0xec, 0x81, 0x8f, 0x80, 0xfb, 0x80, 0xee, 0x80, 0x8b, 0x28, 0x80, 0xea, 0x80, 0x8c, 0x84, 0xca, 0x81, 0x9a, 0x00, 0x00, 0x03, 0x81, 0xc1, 0x10, 0x81, 0xbd, 0x80, 0xef, 0x00, 0x81, 0xa7, 0x0b, 0x84, 0x98, 0x30, 0x80, 0x89, 0x81, 0x42, 0xc0, 0x82, 0x43, 0xb3, 0x81, 0x9d, 0x80, 0x40, 0x93, 0x8a, 0x88, 0x80, 0x41, 0x5a, 0x82, 0x41, 0x23, 0x80, 0x93, 0x39, 0x80, 0xaf, 0x8e, 0x81, 0x8a, 0xe7, 0x80, 0x8e, 0x80, 0xa5, 0x88, 0xb5, 0x81, 0xb9, 0x80, 0x8a, 0x81, 0xc1, 0x81, 0xbf, 0x85, 0xd1, 0x98, 0x18, 0x28, 0x0a, 0xb1, 0xbe, 0xd8, 0x8b, 0xa4, 0x8a, 0x41, 0xbc, 0x00, 0x82, 0x8a, 0x82, 0x8c, 0x82, 0x8c, 0x82, 0x8c, 0x81, 0x4c, 0xef, 0x82, 0x41, 0x3c, 0x80, 0x41, 0xf9, 0x85, 0xe8, 0x83, 0xde, 0x80, 0x60, 0x75, 0x71, 0x80, 0x8b, 0x08, 0x80, 0x9b, 0x81, 0xd1, 0x81, 0x8d, 0xa1, 0xe5, 0x82, 0xec, 0x81, 0x8b, 0x80, 0xa4, 0x80, 0x40, 0x96, 0x80, 0x9a, 0x91, 0xb8, 0x83, 0xa3, 0x80, 0xde, 0x80, 0x8b, 0x80, 0xa3, 0x80, 0x40, 0x94, 0x82, 0xc0, 0x83, 0xb2, 0x80, 0xe3, 0x84, 0x88, 0x82, 0xff, 0x81, 0x60, 0x4f, 0x2f, 0x80, 0x43, 0x00, 0x8f, 0x41, 0x0d, 0x00, 0x80, 0xae, 0x80, 0xac, 0x81, 0xc2, 0x80, 0x42, 0xfb, 0x80, 0x44, 0x9e, 0x28, 0xa9, 0x80, 0x88, 0x42, 0x7c, 0x13, 0x80, 0x40, 0xa4, 0x81, 0x42, 0x3a, 0x85, 0xa5, 0x80, 0x99, 0x84, 0x41, 0x8e, 0x82, 0xc5, 0x8a, 0xb0, 0x83, 0x40, 0xbf, 0x80, 0xa8, 0x80, 0xc7, 0x81, 0xf7, 0x81, 0xbd, 0x80, 0xcb, 0x80, 0x88, 0x82, 0xe7, 0x81, 0x40, 0xb1, 0x81, 0xcf, 0x81, 0x8f, 0x80, 0x97, 0x32, 0x84, 0xd8, 0x10, 0x81, 0x8c, 0x81, 0xde, 0x02, 0x80, 0xfa, 0x81, 0x40, 0xfa, 0x81, 0xfd, 0x80, 0xf5, 0x81, 0xf2, 0x80, 0x41, 0x0c, 0x81, 0x41, 0x01, 0x0b, 0x80, 0x40, 0x9b, 0x80, 0xd2, 0x80, 0x91, 0x80, 0xd0, 0x80, 0x41, 0xa4, 0x80, 0x41, 0x01, 0x00, 0x81, 0xd0, 0x80, 0x41, 0xa8, 0x81, 0x96, 0x80, 0x54, 0xeb, 0x8e, 0x60, 0x2c, 0xd8, 0x80, 0x49, 0xbf, 0x84, 0xba, 0x86, 0x42, 0x33, 0x81, 0x42, 0x21, 0x90, 0xcf, 0x81, 0x60, 0x3f, 0xfd, 0x18, 0x30, 0x81, 0x5f, 0x00, 0xad, 0x81, 0x96, 0x42, 0x1f, 0x12, 0x2f, 0x39, 0x86, 0x9d, 0x83, 0x4e, 0x81, 0xbd, 0x40, 0xc1, 0x86, 0x41, 0x76, 0x80, 0xbc, 0x83, 0x42, 0xfd, 0x81, 0x42, 0xdf, 0x86, 0xec, 0x10, 0x82, }; static const uint8_t unicode_prop_Extender_table[111] = { 0x40, 0xb6, 0x80, 0x42, 0x17, 0x81, 0x43, 0x6d, 0x80, 0x41, 0xb8, 0x80, 0x42, 0x75, 0x80, 0x40, 0x88, 0x80, 0xd8, 0x80, 0x42, 0xef, 0x80, 0xfe, 0x80, 0x49, 0x42, 0x80, 0xb7, 0x80, 0x42, 0x62, 0x80, 0x41, 0x8d, 0x80, 0xc3, 0x80, 0x53, 0x88, 0x80, 0xaa, 0x84, 0xe6, 0x81, 0xdc, 0x82, 0x60, 0x6f, 0x15, 0x80, 0x45, 0xf5, 0x80, 0x43, 0xc1, 0x80, 0x95, 0x80, 0x40, 0x88, 0x80, 0xeb, 0x80, 0x94, 0x81, 0x60, 0x54, 0x7a, 0x80, 0x48, 0x0f, 0x81, 0x45, 0xca, 0x80, 0x9a, 0x03, 0x80, 0x44, 0xc6, 0x80, 0x41, 0x24, 0x80, 0xf3, 0x81, 0x41, 0xf1, 0x82, 0x44, 0xce, 0x80, 0x60, 0x50, 0xa8, 0x81, 0x44, 0x9b, 0x08, 0x80, 0x60, 0x71, 0x57, 0x81, 0x44, 0xb0, 0x80, 0x43, 0x53, 0x82, }; static const uint8_t unicode_prop_Hex_Digit_table[12] = { 0xaf, 0x89, 0x35, 0x99, 0x85, 0x60, 0xfe, 0xa8, 0x89, 0x35, 0x99, 0x85, }; static const uint8_t unicode_prop_IDS_Unary_Operator_table[4] = { 0x60, 0x2f, 0xfd, 0x81, }; static const uint8_t unicode_prop_IDS_Binary_Operator_table[8] = { 0x60, 0x2f, 0xef, 0x09, 0x89, 0x41, 0xf0, 0x80, }; static const uint8_t unicode_prop_IDS_Trinary_Operator_table[4] = { 0x60, 0x2f, 0xf1, 0x81, }; static const uint8_t unicode_prop_Ideographic_table[72] = { 0x60, 0x30, 0x05, 0x81, 0x98, 0x88, 0x8d, 0x82, 0x43, 0xc4, 0x59, 0xbf, 0xbf, 0x60, 0x51, 0xff, 0x60, 0x58, 0xff, 0x41, 0x6d, 0x81, 0xe9, 0x60, 0x75, 0x09, 0x80, 0x9a, 0x57, 0xf7, 0x87, 0x44, 0xd5, 0xa8, 0x89, 0x60, 0x24, 0x66, 0x41, 0x8b, 0x60, 0x4d, 0x03, 0x60, 0xa6, 0xdf, 0x9f, 0x50, 0x39, 0x85, 0x40, 0xdd, 0x81, 0x56, 0x81, 0x8d, 0x5d, 0x30, 0x8e, 0x42, 0x6d, 0x49, 0xa1, 0x42, 0x1d, 0x45, 0xe1, 0x53, 0x4a, 0x84, 0x50, 0x5f, }; static const uint8_t unicode_prop_Join_Control_table[4] = { 0x60, 0x20, 0x0b, 0x81, }; static const uint8_t unicode_prop_Logical_Order_Exception_table[15] = { 0x4e, 0x3f, 0x84, 0xfa, 0x84, 0x4a, 0xef, 0x11, 0x80, 0x60, 0x90, 0xf9, 0x09, 0x00, 0x81, }; static const uint8_t unicode_prop_Modifier_Combining_Mark_table[16] = { 0x46, 0x53, 0x09, 0x80, 0x40, 0x82, 0x05, 0x02, 0x81, 0x41, 0xe0, 0x08, 0x12, 0x80, 0x9e, 0x80, }; static const uint8_t unicode_prop_Noncharacter_Code_Point_table[71] = { 0x60, 0xfd, 0xcf, 0x9f, 0x42, 0x0d, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, 0x60, 0xff, 0xfd, 0x81, }; static const uint8_t unicode_prop_Pattern_Syntax_table[58] = { 0xa0, 0x8e, 0x89, 0x86, 0x99, 0x18, 0x80, 0x99, 0x83, 0xa1, 0x30, 0x00, 0x08, 0x00, 0x0b, 0x03, 0x02, 0x80, 0x96, 0x80, 0x9e, 0x80, 0x5f, 0x17, 0x97, 0x87, 0x8e, 0x81, 0x92, 0x80, 0x89, 0x41, 0x30, 0x42, 0xcf, 0x40, 0x9f, 0x42, 0x75, 0x9d, 0x44, 0x6b, 0x41, 0xff, 0xff, 0x41, 0x80, 0x13, 0x98, 0x8e, 0x80, 0x60, 0xcd, 0x0c, 0x81, 0x41, 0x04, 0x81, }; static const uint8_t unicode_prop_Pattern_White_Space_table[11] = { 0x88, 0x84, 0x91, 0x80, 0xe3, 0x80, 0x5f, 0x87, 0x81, 0x97, 0x81, }; static const uint8_t unicode_prop_Quotation_Mark_table[31] = { 0xa1, 0x03, 0x80, 0x40, 0x82, 0x80, 0x8e, 0x80, 0x5f, 0x5b, 0x87, 0x98, 0x81, 0x4e, 0x06, 0x80, 0x41, 0xc8, 0x83, 0x8c, 0x82, 0x60, 0xce, 0x20, 0x83, 0x40, 0xbc, 0x03, 0x80, 0xd9, 0x81, }; static const uint8_t unicode_prop_Radical_table[9] = { 0x60, 0x2e, 0x7f, 0x99, 0x80, 0xd8, 0x8b, 0x40, 0xd5, }; static const uint8_t unicode_prop_Regional_Indicator_table[4] = { 0x61, 0xf1, 0xe5, 0x99, }; static const uint8_t unicode_prop_Sentence_Terminal_table[213] = { 0xa0, 0x80, 0x8b, 0x80, 0x8f, 0x80, 0x45, 0x48, 0x80, 0x40, 0x92, 0x82, 0x40, 0xb3, 0x80, 0xaa, 0x82, 0x40, 0xf5, 0x80, 0xbc, 0x00, 0x02, 0x81, 0x41, 0x24, 0x81, 0x46, 0xe3, 0x81, 0x43, 0x15, 0x03, 0x81, 0x43, 0x04, 0x80, 0x40, 0xc5, 0x81, 0x40, 0x9c, 0x81, 0xac, 0x04, 0x80, 0x41, 0x39, 0x81, 0x41, 0x61, 0x83, 0x40, 0xa1, 0x81, 0x89, 0x09, 0x81, 0x9c, 0x82, 0x40, 0xba, 0x81, 0xc0, 0x81, 0x43, 0xa3, 0x80, 0x96, 0x81, 0x88, 0x82, 0x4c, 0xae, 0x82, 0x41, 0x31, 0x80, 0x8c, 0x80, 0x95, 0x81, 0x41, 0xac, 0x80, 0x60, 0x74, 0xfb, 0x80, 0x41, 0x0d, 0x81, 0x40, 0xe2, 0x02, 0x80, 0x41, 0x7d, 0x81, 0xd5, 0x81, 0xde, 0x80, 0x40, 0x97, 0x81, 0x40, 0x92, 0x82, 0x40, 0x8f, 0x81, 0x40, 0xf8, 0x80, 0x60, 0x52, 0x25, 0x01, 0x81, 0xba, 0x02, 0x81, 0x40, 0xa8, 0x80, 0x8b, 0x80, 0x8f, 0x80, 0xc0, 0x80, 0x4a, 0xf3, 0x81, 0x44, 0xfc, 0x84, 0xab, 0x83, 0x40, 0xbc, 0x81, 0xf4, 0x83, 0xfe, 0x82, 0x40, 0x80, 0x0d, 0x80, 0x8f, 0x81, 0xd7, 0x08, 0x81, 0xeb, 0x80, 0x41, 0x29, 0x81, 0xf4, 0x81, 0x41, 0x74, 0x0c, 0x8e, 0xe8, 0x81, 0x40, 0xf8, 0x82, 0x42, 0x04, 0x00, 0x80, 0x40, 0xfa, 0x81, 0xd6, 0x81, 0x41, 0xa3, 0x81, 0x42, 0xb3, 0x81, 0xc9, 0x81, 0x60, 0x4b, 0x28, 0x81, 0x40, 0x84, 0x80, 0xc0, 0x81, 0x8a, 0x80, 0x42, 0x28, 0x81, 0x41, 0x27, 0x80, 0x60, 0x4e, 0x05, 0x80, 0x5d, 0xe7, 0x80, }; static const uint8_t unicode_prop_Soft_Dotted_table[79] = { 0xe8, 0x81, 0x40, 0xc3, 0x80, 0x41, 0x18, 0x80, 0x9d, 0x80, 0xb3, 0x80, 0x93, 0x80, 0x41, 0x3f, 0x80, 0xe1, 0x00, 0x80, 0x59, 0x08, 0x80, 0xb2, 0x80, 0x8c, 0x02, 0x80, 0x40, 0x83, 0x80, 0x40, 0x9c, 0x80, 0x41, 0xa4, 0x80, 0x40, 0xd5, 0x81, 0x4b, 0x31, 0x80, 0x61, 0xa7, 0xa4, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0xb1, 0x81, 0x48, 0x85, 0x80, 0x41, 0x30, 0x81, 0x99, 0x80, }; static const uint8_t unicode_prop_Terminal_Punctuation_table[264] = { 0xa0, 0x80, 0x89, 0x00, 0x80, 0x8a, 0x0a, 0x80, 0x43, 0x3d, 0x07, 0x80, 0x42, 0x00, 0x80, 0xb8, 0x80, 0xc7, 0x80, 0x8d, 0x00, 0x82, 0x40, 0xb3, 0x80, 0xaa, 0x8a, 0x00, 0x40, 0xea, 0x81, 0xb5, 0x28, 0x87, 0x9e, 0x80, 0x41, 0x04, 0x81, 0x44, 0xf3, 0x81, 0x40, 0xab, 0x03, 0x85, 0x41, 0x36, 0x81, 0x43, 0x14, 0x87, 0x43, 0x04, 0x80, 0xfb, 0x82, 0xc6, 0x81, 0x40, 0x9c, 0x12, 0x80, 0xa6, 0x19, 0x81, 0x41, 0x39, 0x81, 0x41, 0x61, 0x83, 0x40, 0xa1, 0x81, 0x89, 0x08, 0x82, 0x9c, 0x82, 0x40, 0xba, 0x84, 0xbd, 0x81, 0x43, 0xa3, 0x80, 0x96, 0x81, 0x88, 0x82, 0x4c, 0xae, 0x82, 0x41, 0x31, 0x80, 0x8c, 0x03, 0x80, 0x89, 0x00, 0x0a, 0x81, 0x41, 0xab, 0x81, 0x60, 0x74, 0xfa, 0x81, 0x41, 0x0c, 0x82, 0x40, 0xe2, 0x84, 0x41, 0x7d, 0x81, 0xd5, 0x81, 0xde, 0x80, 0x40, 0x96, 0x82, 0x40, 0x92, 0x82, 0xfe, 0x80, 0x8f, 0x81, 0x40, 0xf8, 0x80, 0x60, 0x52, 0x25, 0x01, 0x81, 0xb8, 0x10, 0x83, 0x40, 0xa8, 0x80, 0x89, 0x00, 0x80, 0x8a, 0x0a, 0x80, 0xc0, 0x01, 0x80, 0x44, 0x39, 0x80, 0xaf, 0x80, 0x44, 0x85, 0x80, 0x40, 0xc6, 0x80, 0x41, 0x35, 0x81, 0x40, 0x97, 0x85, 0xc3, 0x85, 0xd8, 0x83, 0x43, 0xb7, 0x84, 0xab, 0x83, 0x40, 0xbc, 0x86, 0xef, 0x83, 0xfe, 0x82, 0x40, 0x80, 0x0d, 0x80, 0x8f, 0x81, 0xd7, 0x84, 0xeb, 0x80, 0x41, 0x29, 0x81, 0xf4, 0x82, 0x8b, 0x81, 0x41, 0x65, 0x1a, 0x8e, 0xe8, 0x81, 0x40, 0xf8, 0x82, 0x42, 0x04, 0x00, 0x80, 0x40, 0xfa, 0x81, 0xd6, 0x0b, 0x81, 0x41, 0x9d, 0x82, 0xac, 0x80, 0x42, 0x84, 0x81, 0xc9, 0x81, 0x45, 0x2a, 0x84, 0x60, 0x45, 0xf8, 0x81, 0x40, 0x84, 0x80, 0xc0, 0x82, 0x89, 0x80, 0x42, 0x28, 0x81, 0x41, 0x26, 0x81, 0x60, 0x4e, 0x05, 0x80, 0x5d, 0xe6, 0x83, }; static const uint8_t unicode_prop_Unified_Ideograph_table[48] = { 0x60, 0x33, 0xff, 0x59, 0xbf, 0xbf, 0x60, 0x51, 0xff, 0x60, 0x5a, 0x0d, 0x08, 0x00, 0x81, 0x89, 0x00, 0x00, 0x09, 0x82, 0x61, 0x05, 0xd5, 0x60, 0xa6, 0xdf, 0x9f, 0x50, 0x39, 0x85, 0x40, 0xdd, 0x81, 0x56, 0x81, 0x8d, 0x5d, 0x30, 0x8e, 0x42, 0x6d, 0x51, 0xa1, 0x53, 0x4a, 0x84, 0x50, 0x5f, }; static const uint8_t unicode_prop_Variation_Selector_table[13] = { 0x58, 0x0a, 0x10, 0x80, 0x60, 0xe5, 0xef, 0x8f, 0x6d, 0x02, 0xef, 0x40, 0xef, }; static const uint8_t unicode_prop_Bidi_Mirrored_table[173] = { 0xa7, 0x81, 0x91, 0x00, 0x80, 0x9b, 0x00, 0x80, 0x9c, 0x00, 0x80, 0xac, 0x80, 0x8e, 0x80, 0x4e, 0x7d, 0x83, 0x47, 0x5c, 0x81, 0x49, 0x9b, 0x81, 0x89, 0x81, 0xb5, 0x81, 0x8d, 0x81, 0x40, 0xb0, 0x80, 0x40, 0xbf, 0x1a, 0x2a, 0x02, 0x0a, 0x18, 0x18, 0x00, 0x03, 0x88, 0x20, 0x80, 0x91, 0x23, 0x88, 0x08, 0x00, 0x38, 0x9f, 0x0b, 0x20, 0x88, 0x09, 0x92, 0x21, 0x88, 0x21, 0x0b, 0x97, 0x81, 0x8f, 0x3b, 0x93, 0x0e, 0x81, 0x44, 0x3c, 0x8d, 0xc9, 0x01, 0x18, 0x08, 0x14, 0x1c, 0x12, 0x8d, 0x41, 0x92, 0x95, 0x0d, 0x80, 0x8d, 0x38, 0x35, 0x10, 0x1c, 0x01, 0x0c, 0x18, 0x02, 0x09, 0x89, 0x29, 0x81, 0x8b, 0x92, 0x03, 0x08, 0x00, 0x08, 0x03, 0x21, 0x2a, 0x97, 0x81, 0x8a, 0x0b, 0x18, 0x09, 0x0b, 0xaa, 0x0f, 0x80, 0xa7, 0x20, 0x00, 0x14, 0x22, 0x18, 0x14, 0x00, 0x40, 0xff, 0x80, 0x42, 0x02, 0x1a, 0x08, 0x81, 0x8d, 0x09, 0x89, 0xaa, 0x87, 0x41, 0xaa, 0x89, 0x0f, 0x60, 0xce, 0x3c, 0x2c, 0x81, 0x40, 0xa1, 0x81, 0x91, 0x00, 0x80, 0x9b, 0x00, 0x80, 0x9c, 0x00, 0x00, 0x08, 0x81, 0x60, 0xd7, 0x76, 0x80, 0xb8, 0x80, 0xb8, 0x80, 0xb8, 0x80, 0xb8, 0x80, }; static const uint8_t unicode_prop_Emoji_table[238] = { 0xa2, 0x05, 0x04, 0x89, 0xee, 0x03, 0x80, 0x5f, 0x8c, 0x80, 0x8b, 0x80, 0x40, 0xd7, 0x80, 0x95, 0x80, 0xd9, 0x85, 0x8e, 0x81, 0x41, 0x6e, 0x81, 0x8b, 0x80, 0x40, 0xa5, 0x80, 0x98, 0x8a, 0x1a, 0x40, 0xc6, 0x80, 0x40, 0xe6, 0x81, 0x89, 0x80, 0x88, 0x80, 0xb9, 0x18, 0x84, 0x88, 0x01, 0x01, 0x09, 0x03, 0x01, 0x00, 0x09, 0x02, 0x02, 0x0f, 0x14, 0x00, 0x04, 0x8b, 0x8a, 0x09, 0x00, 0x08, 0x80, 0x91, 0x01, 0x81, 0x91, 0x28, 0x00, 0x0a, 0x0c, 0x01, 0x0b, 0x81, 0x8a, 0x0c, 0x09, 0x04, 0x08, 0x00, 0x81, 0x93, 0x0c, 0x28, 0x19, 0x03, 0x01, 0x01, 0x28, 0x01, 0x00, 0x00, 0x05, 0x02, 0x05, 0x80, 0x89, 0x81, 0x8e, 0x01, 0x03, 0x00, 0x03, 0x10, 0x80, 0x8a, 0x81, 0xaf, 0x82, 0x88, 0x80, 0x8d, 0x80, 0x8d, 0x80, 0x41, 0x73, 0x81, 0x41, 0xce, 0x82, 0x92, 0x81, 0xb2, 0x03, 0x80, 0x44, 0xd9, 0x80, 0x8b, 0x80, 0x42, 0x58, 0x00, 0x80, 0x61, 0xbd, 0x69, 0x80, 0x40, 0xc9, 0x80, 0x40, 0x9f, 0x81, 0x8b, 0x81, 0x8d, 0x01, 0x89, 0xca, 0x99, 0x01, 0x96, 0x80, 0x93, 0x01, 0x88, 0x94, 0x81, 0x40, 0xad, 0xa1, 0x81, 0xef, 0x09, 0x02, 0x81, 0xd2, 0x0a, 0x80, 0x41, 0x06, 0x80, 0xbe, 0x8a, 0x28, 0x97, 0x31, 0x0f, 0x8b, 0x01, 0x19, 0x03, 0x81, 0x8c, 0x09, 0x07, 0x81, 0x88, 0x04, 0x82, 0x8b, 0x17, 0x11, 0x00, 0x03, 0x05, 0x02, 0x05, 0xd5, 0xaf, 0xc5, 0x27, 0x0a, 0x83, 0x89, 0x10, 0x01, 0x10, 0x81, 0x89, 0x40, 0xe2, 0x8b, 0x18, 0x41, 0x1a, 0xae, 0x80, 0x89, 0x80, 0x40, 0xb8, 0xef, 0x8c, 0x82, 0x89, 0x84, 0xb7, 0x86, 0x8e, 0x81, 0x8a, 0x85, 0x88, }; static const uint8_t unicode_prop_Emoji_Component_table[28] = { 0xa2, 0x05, 0x04, 0x89, 0x5f, 0xd2, 0x80, 0x40, 0xd4, 0x80, 0x60, 0xdd, 0x2a, 0x80, 0x60, 0xf3, 0xd5, 0x99, 0x41, 0xfa, 0x84, 0x45, 0xaf, 0x83, 0x6c, 0x06, 0x6b, 0xdf, }; static const uint8_t unicode_prop_Emoji_Modifier_table[4] = { 0x61, 0xf3, 0xfa, 0x84, }; static const uint8_t unicode_prop_Emoji_Modifier_Base_table[71] = { 0x60, 0x26, 0x1c, 0x80, 0x40, 0xda, 0x80, 0x8f, 0x83, 0x61, 0xcc, 0x76, 0x80, 0xbb, 0x11, 0x01, 0x82, 0xf4, 0x09, 0x8a, 0x94, 0x92, 0x10, 0x1a, 0x02, 0x30, 0x00, 0x97, 0x80, 0x40, 0xc8, 0x0b, 0x80, 0x94, 0x03, 0x81, 0x40, 0xad, 0x12, 0x84, 0xd2, 0x80, 0x8f, 0x82, 0x88, 0x80, 0x8a, 0x80, 0x42, 0x3e, 0x01, 0x07, 0x3d, 0x80, 0x88, 0x89, 0x0a, 0xb7, 0x80, 0xbc, 0x08, 0x08, 0x80, 0x90, 0x10, 0x8c, 0x40, 0xe4, 0x82, 0xa9, 0x88, }; static const uint8_t unicode_prop_Emoji_Presentation_table[144] = { 0x60, 0x23, 0x19, 0x81, 0x40, 0xcc, 0x1a, 0x01, 0x80, 0x42, 0x08, 0x81, 0x94, 0x81, 0xb1, 0x8b, 0xaa, 0x80, 0x92, 0x80, 0x8c, 0x07, 0x81, 0x90, 0x0c, 0x0f, 0x04, 0x80, 0x94, 0x06, 0x08, 0x03, 0x01, 0x06, 0x03, 0x81, 0x9b, 0x80, 0xa2, 0x00, 0x03, 0x10, 0x80, 0xbc, 0x82, 0x97, 0x80, 0x8d, 0x80, 0x43, 0x5a, 0x81, 0xb2, 0x03, 0x80, 0x61, 0xc4, 0xad, 0x80, 0x40, 0xc9, 0x80, 0x40, 0xbd, 0x01, 0x89, 0xca, 0x99, 0x00, 0x97, 0x80, 0x93, 0x01, 0x20, 0x82, 0x94, 0x81, 0x40, 0xad, 0xa0, 0x8b, 0x88, 0x80, 0xc5, 0x80, 0x95, 0x8b, 0xaa, 0x1c, 0x8b, 0x90, 0x10, 0x82, 0xc6, 0x00, 0x80, 0x40, 0xba, 0x81, 0xbe, 0x8c, 0x18, 0x97, 0x91, 0x80, 0x99, 0x81, 0x8c, 0x80, 0xd5, 0xd4, 0xaf, 0xc5, 0x28, 0x12, 0x0a, 0x1b, 0x8a, 0x0e, 0x88, 0x40, 0xe2, 0x8b, 0x18, 0x41, 0x1a, 0xae, 0x80, 0x89, 0x80, 0x40, 0xb8, 0xef, 0x8c, 0x82, 0x89, 0x84, 0xb7, 0x86, 0x8e, 0x81, 0x8a, 0x85, 0x88, }; static const uint8_t unicode_prop_Extended_Pictographic_table[156] = { 0x40, 0xa8, 0x03, 0x80, 0x5f, 0x8c, 0x80, 0x8b, 0x80, 0x40, 0xd7, 0x80, 0x95, 0x80, 0xd9, 0x85, 0x8e, 0x81, 0x41, 0x6e, 0x81, 0x8b, 0x80, 0xde, 0x80, 0xc5, 0x80, 0x98, 0x8a, 0x1a, 0x40, 0xc6, 0x80, 0x40, 0xe6, 0x81, 0x89, 0x80, 0x88, 0x80, 0xb9, 0x18, 0x28, 0x8b, 0x80, 0xf1, 0x89, 0xf5, 0x81, 0x8a, 0x00, 0x00, 0x28, 0x10, 0x28, 0x89, 0x81, 0x8e, 0x01, 0x03, 0x00, 0x03, 0x10, 0x80, 0x8a, 0x84, 0xac, 0x82, 0x88, 0x80, 0x8d, 0x80, 0x8d, 0x80, 0x41, 0x73, 0x81, 0x41, 0xce, 0x82, 0x92, 0x81, 0xb2, 0x03, 0x80, 0x44, 0xd9, 0x80, 0x8b, 0x80, 0x42, 0x58, 0x00, 0x80, 0x61, 0xbd, 0x65, 0x40, 0xff, 0x8c, 0x82, 0x9e, 0x80, 0xbb, 0x85, 0x8b, 0x81, 0x8d, 0x01, 0x89, 0x91, 0xb8, 0x9a, 0x8e, 0x89, 0x80, 0x93, 0x01, 0x88, 0x03, 0x88, 0x41, 0xb1, 0x84, 0x41, 0x3d, 0x87, 0x41, 0x09, 0xaf, 0xff, 0xf3, 0x8b, 0xd4, 0xaa, 0x8b, 0x83, 0xb7, 0x87, 0x89, 0x85, 0xa7, 0x87, 0x9d, 0xd1, 0x8b, 0xae, 0x80, 0x89, 0x80, 0x41, 0xb8, 0x40, 0xff, 0x43, 0xfd, }; static const uint8_t unicode_prop_Default_Ignorable_Code_Point_table[51] = { 0x40, 0xac, 0x80, 0x42, 0xa0, 0x80, 0x42, 0xcb, 0x80, 0x4b, 0x41, 0x81, 0x46, 0x52, 0x81, 0xd4, 0x84, 0x47, 0xfa, 0x84, 0x99, 0x84, 0xb0, 0x8f, 0x50, 0xf3, 0x80, 0x60, 0xcc, 0x9a, 0x8f, 0x40, 0xee, 0x80, 0x40, 0x9f, 0x80, 0xce, 0x88, 0x60, 0xbc, 0xa6, 0x83, 0x54, 0xce, 0x87, 0x6c, 0x2e, 0x84, 0x4f, 0xff, }; typedef enum { UNICODE_PROP_Hyphen, UNICODE_PROP_Other_Math, UNICODE_PROP_Other_Alphabetic, UNICODE_PROP_Other_Lowercase, UNICODE_PROP_Other_Uppercase, UNICODE_PROP_Other_Grapheme_Extend, UNICODE_PROP_Other_Default_Ignorable_Code_Point, UNICODE_PROP_Other_ID_Start, UNICODE_PROP_Other_ID_Continue, UNICODE_PROP_Prepended_Concatenation_Mark, UNICODE_PROP_ID_Continue1, UNICODE_PROP_XID_Start1, UNICODE_PROP_XID_Continue1, UNICODE_PROP_Changes_When_Titlecased1, UNICODE_PROP_Changes_When_Casefolded1, UNICODE_PROP_Changes_When_NFKC_Casefolded1, UNICODE_PROP_ASCII_Hex_Digit, UNICODE_PROP_Bidi_Control, UNICODE_PROP_Dash, UNICODE_PROP_Deprecated, UNICODE_PROP_Diacritic, UNICODE_PROP_Extender, UNICODE_PROP_Hex_Digit, UNICODE_PROP_IDS_Unary_Operator, UNICODE_PROP_IDS_Binary_Operator, UNICODE_PROP_IDS_Trinary_Operator, UNICODE_PROP_Ideographic, UNICODE_PROP_Join_Control, UNICODE_PROP_Logical_Order_Exception, UNICODE_PROP_Modifier_Combining_Mark, UNICODE_PROP_Noncharacter_Code_Point, UNICODE_PROP_Pattern_Syntax, UNICODE_PROP_Pattern_White_Space, UNICODE_PROP_Quotation_Mark, UNICODE_PROP_Radical, UNICODE_PROP_Regional_Indicator, UNICODE_PROP_Sentence_Terminal, UNICODE_PROP_Soft_Dotted, UNICODE_PROP_Terminal_Punctuation, UNICODE_PROP_Unified_Ideograph, UNICODE_PROP_Variation_Selector, UNICODE_PROP_White_Space, UNICODE_PROP_Bidi_Mirrored, UNICODE_PROP_Emoji, UNICODE_PROP_Emoji_Component, UNICODE_PROP_Emoji_Modifier, UNICODE_PROP_Emoji_Modifier_Base, UNICODE_PROP_Emoji_Presentation, UNICODE_PROP_Extended_Pictographic, UNICODE_PROP_Default_Ignorable_Code_Point, UNICODE_PROP_ID_Start, UNICODE_PROP_Case_Ignorable, UNICODE_PROP_ASCII, UNICODE_PROP_Alphabetic, UNICODE_PROP_Any, UNICODE_PROP_Assigned, UNICODE_PROP_Cased, UNICODE_PROP_Changes_When_Casefolded, UNICODE_PROP_Changes_When_Casemapped, UNICODE_PROP_Changes_When_Lowercased, UNICODE_PROP_Changes_When_NFKC_Casefolded, UNICODE_PROP_Changes_When_Titlecased, UNICODE_PROP_Changes_When_Uppercased, UNICODE_PROP_Grapheme_Base, UNICODE_PROP_Grapheme_Extend, UNICODE_PROP_ID_Continue, UNICODE_PROP_ID_Compat_Math_Start, UNICODE_PROP_ID_Compat_Math_Continue, UNICODE_PROP_Lowercase, UNICODE_PROP_Math, UNICODE_PROP_Uppercase, UNICODE_PROP_XID_Continue, UNICODE_PROP_XID_Start, UNICODE_PROP_Cased1, UNICODE_PROP_InCB, UNICODE_PROP_COUNT, } UnicodePropertyEnum; static const char unicode_prop_name_table[] = "ASCII_Hex_Digit,AHex" "\0" "Bidi_Control,Bidi_C" "\0" "Dash" "\0" "Deprecated,Dep" "\0" "Diacritic,Dia" "\0" "Extender,Ext" "\0" "Hex_Digit,Hex" "\0" "IDS_Unary_Operator,IDSU" "\0" "IDS_Binary_Operator,IDSB" "\0" "IDS_Trinary_Operator,IDST" "\0" "Ideographic,Ideo" "\0" "Join_Control,Join_C" "\0" "Logical_Order_Exception,LOE" "\0" "Modifier_Combining_Mark,MCM" "\0" "Noncharacter_Code_Point,NChar" "\0" "Pattern_Syntax,Pat_Syn" "\0" "Pattern_White_Space,Pat_WS" "\0" "Quotation_Mark,QMark" "\0" "Radical" "\0" "Regional_Indicator,RI" "\0" "Sentence_Terminal,STerm" "\0" "Soft_Dotted,SD" "\0" "Terminal_Punctuation,Term" "\0" "Unified_Ideograph,UIdeo" "\0" "Variation_Selector,VS" "\0" "White_Space,space" "\0" "Bidi_Mirrored,Bidi_M" "\0" "Emoji" "\0" "Emoji_Component,EComp" "\0" "Emoji_Modifier,EMod" "\0" "Emoji_Modifier_Base,EBase" "\0" "Emoji_Presentation,EPres" "\0" "Extended_Pictographic,ExtPict" "\0" "Default_Ignorable_Code_Point,DI" "\0" "ID_Start,IDS" "\0" "Case_Ignorable,CI" "\0" "ASCII" "\0" "Alphabetic,Alpha" "\0" "Any" "\0" "Assigned" "\0" "Cased" "\0" "Changes_When_Casefolded,CWCF" "\0" "Changes_When_Casemapped,CWCM" "\0" "Changes_When_Lowercased,CWL" "\0" "Changes_When_NFKC_Casefolded,CWKCF" "\0" "Changes_When_Titlecased,CWT" "\0" "Changes_When_Uppercased,CWU" "\0" "Grapheme_Base,Gr_Base" "\0" "Grapheme_Extend,Gr_Ext" "\0" "ID_Continue,IDC" "\0" "ID_Compat_Math_Start" "\0" "ID_Compat_Math_Continue" "\0" "Lowercase,Lower" "\0" "Math" "\0" "Uppercase,Upper" "\0" "XID_Continue,XIDC" "\0" "XID_Start,XIDS" "\0" ; static const uint8_t * const unicode_prop_table[] = { unicode_prop_Hyphen_table, unicode_prop_Other_Math_table, unicode_prop_Other_Alphabetic_table, unicode_prop_Other_Lowercase_table, unicode_prop_Other_Uppercase_table, unicode_prop_Other_Grapheme_Extend_table, unicode_prop_Other_Default_Ignorable_Code_Point_table, unicode_prop_Other_ID_Start_table, unicode_prop_Other_ID_Continue_table, unicode_prop_Prepended_Concatenation_Mark_table, unicode_prop_ID_Continue1_table, unicode_prop_XID_Start1_table, unicode_prop_XID_Continue1_table, unicode_prop_Changes_When_Titlecased1_table, unicode_prop_Changes_When_Casefolded1_table, unicode_prop_Changes_When_NFKC_Casefolded1_table, unicode_prop_ASCII_Hex_Digit_table, unicode_prop_Bidi_Control_table, unicode_prop_Dash_table, unicode_prop_Deprecated_table, unicode_prop_Diacritic_table, unicode_prop_Extender_table, unicode_prop_Hex_Digit_table, unicode_prop_IDS_Unary_Operator_table, unicode_prop_IDS_Binary_Operator_table, unicode_prop_IDS_Trinary_Operator_table, unicode_prop_Ideographic_table, unicode_prop_Join_Control_table, unicode_prop_Logical_Order_Exception_table, unicode_prop_Modifier_Combining_Mark_table, unicode_prop_Noncharacter_Code_Point_table, unicode_prop_Pattern_Syntax_table, unicode_prop_Pattern_White_Space_table, unicode_prop_Quotation_Mark_table, unicode_prop_Radical_table, unicode_prop_Regional_Indicator_table, unicode_prop_Sentence_Terminal_table, unicode_prop_Soft_Dotted_table, unicode_prop_Terminal_Punctuation_table, unicode_prop_Unified_Ideograph_table, unicode_prop_Variation_Selector_table, unicode_prop_White_Space_table, unicode_prop_Bidi_Mirrored_table, unicode_prop_Emoji_table, unicode_prop_Emoji_Component_table, unicode_prop_Emoji_Modifier_table, unicode_prop_Emoji_Modifier_Base_table, unicode_prop_Emoji_Presentation_table, unicode_prop_Extended_Pictographic_table, unicode_prop_Default_Ignorable_Code_Point_table, unicode_prop_ID_Start_table, unicode_prop_Case_Ignorable_table, }; static const uint16_t unicode_prop_len_table[] = { countof(unicode_prop_Hyphen_table), countof(unicode_prop_Other_Math_table), countof(unicode_prop_Other_Alphabetic_table), countof(unicode_prop_Other_Lowercase_table), countof(unicode_prop_Other_Uppercase_table), countof(unicode_prop_Other_Grapheme_Extend_table), countof(unicode_prop_Other_Default_Ignorable_Code_Point_table), countof(unicode_prop_Other_ID_Start_table), countof(unicode_prop_Other_ID_Continue_table), countof(unicode_prop_Prepended_Concatenation_Mark_table), countof(unicode_prop_ID_Continue1_table), countof(unicode_prop_XID_Start1_table), countof(unicode_prop_XID_Continue1_table), countof(unicode_prop_Changes_When_Titlecased1_table), countof(unicode_prop_Changes_When_Casefolded1_table), countof(unicode_prop_Changes_When_NFKC_Casefolded1_table), countof(unicode_prop_ASCII_Hex_Digit_table), countof(unicode_prop_Bidi_Control_table), countof(unicode_prop_Dash_table), countof(unicode_prop_Deprecated_table), countof(unicode_prop_Diacritic_table), countof(unicode_prop_Extender_table), countof(unicode_prop_Hex_Digit_table), countof(unicode_prop_IDS_Unary_Operator_table), countof(unicode_prop_IDS_Binary_Operator_table), countof(unicode_prop_IDS_Trinary_Operator_table), countof(unicode_prop_Ideographic_table), countof(unicode_prop_Join_Control_table), countof(unicode_prop_Logical_Order_Exception_table), countof(unicode_prop_Modifier_Combining_Mark_table), countof(unicode_prop_Noncharacter_Code_Point_table), countof(unicode_prop_Pattern_Syntax_table), countof(unicode_prop_Pattern_White_Space_table), countof(unicode_prop_Quotation_Mark_table), countof(unicode_prop_Radical_table), countof(unicode_prop_Regional_Indicator_table), countof(unicode_prop_Sentence_Terminal_table), countof(unicode_prop_Soft_Dotted_table), countof(unicode_prop_Terminal_Punctuation_table), countof(unicode_prop_Unified_Ideograph_table), countof(unicode_prop_Variation_Selector_table), countof(unicode_prop_White_Space_table), countof(unicode_prop_Bidi_Mirrored_table), countof(unicode_prop_Emoji_table), countof(unicode_prop_Emoji_Component_table), countof(unicode_prop_Emoji_Modifier_table), countof(unicode_prop_Emoji_Modifier_Base_table), countof(unicode_prop_Emoji_Presentation_table), countof(unicode_prop_Extended_Pictographic_table), countof(unicode_prop_Default_Ignorable_Code_Point_table), countof(unicode_prop_ID_Start_table), countof(unicode_prop_Case_Ignorable_table), }; qbs-src-3.2.0/src/shared/quickjs/dtoa.c0000644000175100017510000012753415154533055017317 0ustar runnerrunner/* * Tiny float64 printing and parsing library * * Copyright (c) 2024 Fabrice Bellard * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include #include #include #include #include #include // #include #include // #include #include "cutils.h" #include "dtoa.h" /* TODO: - test n_digits=101 instead of 100 - simplify subnormal handling - reduce max memory usage - free format: could add shortcut if exact result - use 64 bit limb_t when possible - use another algorithm for free format dtoa in base 10 (ryu ?) */ #define USE_POW5_TABLE /* use fast path to print small integers in free format */ #define USE_FAST_INT #define LIMB_LOG2_BITS 5 #define LIMB_BITS (1 << LIMB_LOG2_BITS) typedef int32_t slimb_t; typedef uint32_t limb_t; typedef uint64_t dlimb_t; #define LIMB_DIGITS 9 #define JS_RADIX_MAX 36 #define DBIGNUM_LEN_MAX 52 /* ~ 2^(1072+53)*36^100 (dtoa) */ #define MANT_LEN_MAX 18 /* < 36^100 */ typedef intptr_t mp_size_t; /* the represented number is sum(i, tab[i]*2^(LIMB_BITS * i)) */ typedef struct { int len; /* >= 1 */ limb_t tab[]; } mpb_t; static limb_t mp_add_ui(limb_t *tab, limb_t b, size_t n) { size_t i; limb_t k, a; k=b; for(i=0;i> LIMB_BITS; } return l; } /* WARNING: d must be >= 2^(LIMB_BITS-1) */ static inline limb_t udiv1norm_init(limb_t d) { limb_t a0, a1; a1 = -d - 1; a0 = -1; return (((dlimb_t)a1 << LIMB_BITS) | a0) / d; } /* return the quotient and the remainder in '*pr'of 'a1*2^LIMB_BITS+a0 / d' with 0 <= a1 < d. */ static inline limb_t udiv1norm(limb_t *pr, limb_t a1, limb_t a0, limb_t d, limb_t d_inv) { limb_t n1m, n_adj, q, r, ah; dlimb_t a; n1m = ((slimb_t)a0 >> (LIMB_BITS - 1)); n_adj = a0 + (n1m & d); a = (dlimb_t)d_inv * (a1 - n1m) + n_adj; q = (a >> LIMB_BITS) + a1; /* compute a - q * r and update q so that the remainder is between 0 and d - 1 */ a = ((dlimb_t)a1 << LIMB_BITS) | a0; a = a - (dlimb_t)q * d - d; ah = a >> LIMB_BITS; q += 1 + ah; r = (limb_t)a + (ah & d); *pr = r; return q; } static limb_t mp_div1(limb_t *tabr, const limb_t *taba, limb_t n, limb_t b, limb_t r) { slimb_t i; dlimb_t a1; for(i = n - 1; i >= 0; i--) { a1 = ((dlimb_t)r << LIMB_BITS) | taba[i]; tabr[i] = a1 / b; r = a1 % b; } return r; } /* r = (a + high*B^n) >> shift. Return the remainder r (0 <= r < 2^shift). 1 <= shift <= LIMB_BITS - 1 */ static limb_t mp_shr(limb_t *tab_r, const limb_t *tab, mp_size_t n, int shift, limb_t high) { mp_size_t i; limb_t l, a; assert(shift >= 1 && shift < LIMB_BITS); l = high; for(i = n - 1; i >= 0; i--) { a = tab[i]; tab_r[i] = (a >> shift) | (l << (LIMB_BITS - shift)); l = a; } return l & (((limb_t)1 << shift) - 1); } /* r = (a << shift) + low. 1 <= shift <= LIMB_BITS - 1, 0 <= low < 2^shift. */ static limb_t mp_shl(limb_t *tab_r, const limb_t *tab, mp_size_t n, int shift, limb_t low) { mp_size_t i; limb_t l, a; assert(shift >= 1 && shift < LIMB_BITS); l = low; for(i = 0; i < n; i++) { a = tab[i]; tab_r[i] = (a << shift) | l; l = (a >> (LIMB_BITS - shift)); } return l; } static no_inline limb_t mp_div1norm(limb_t *tabr, const limb_t *taba, limb_t n, limb_t b, limb_t r, limb_t b_inv, int shift) { slimb_t i; if (shift != 0) { r = (r << shift) | mp_shl(tabr, taba, n, shift, 0); } for(i = n - 1; i >= 0; i--) { tabr[i] = udiv1norm(&r, r, taba[i], b, b_inv); } r >>= shift; return r; } static __maybe_unused void mpb_dump(const char *str, const mpb_t *a) { int i; printf("%s= 0x", str); for(i = a->len - 1; i >= 0; i--) { printf("%08x", a->tab[i]); if (i != 0) printf("_"); } printf("\n"); } static void mpb_renorm(mpb_t *r) { while (r->len > 1 && r->tab[r->len - 1] == 0) r->len--; } #ifdef USE_POW5_TABLE static const uint32_t pow5_table[17] = { 0x00000005, 0x00000019, 0x0000007d, 0x00000271, 0x00000c35, 0x00003d09, 0x0001312d, 0x0005f5e1, 0x001dcd65, 0x009502f9, 0x02e90edd, 0x0e8d4a51, 0x48c27395, 0x6bcc41e9, 0x1afd498d, 0x86f26fc1, 0xa2bc2ec5, }; static const uint8_t pow5h_table[4] = { 0x00000001, 0x00000007, 0x00000023, 0x000000b1, }; static const uint32_t pow5_inv_table[13] = { 0x99999999, 0x47ae147a, 0x0624dd2f, 0xa36e2eb1, 0x4f8b588e, 0x0c6f7a0b, 0xad7f29ab, 0x5798ee23, 0x12e0be82, 0xb7cdfd9d, 0x5fd7fe17, 0x19799812, 0xc25c2684, }; #endif /* return a^b */ static uint64_t pow_ui(uint32_t a, uint32_t b) { int i, n_bits; uint64_t r; if (b == 0) return 1; if (b == 1) return a; #ifdef USE_POW5_TABLE if ((a == 5 || a == 10) && b <= 17) { r = pow5_table[b - 1]; if (b >= 14) { r |= (uint64_t)pow5h_table[b - 14] << 32; } if (a == 10) r <<= b; return r; } #endif r = a; n_bits = 32 - clz32(b); for(i = n_bits - 2; i >= 0; i--) { r *= r; if ((b >> i) & 1) r *= a; } return r; } static uint32_t pow_ui_inv(uint32_t *pr_inv, int *pshift, uint32_t a, uint32_t b) { uint32_t r_inv, r; int shift; #ifdef USE_POW5_TABLE if (a == 5 && b >= 1 && b <= 13) { r = pow5_table[b - 1]; shift = clz32(r); r <<= shift; r_inv = pow5_inv_table[b - 1]; } else #endif { r = pow_ui(a, b); shift = clz32(r); r <<= shift; r_inv = udiv1norm_init(r); } *pshift = shift; *pr_inv = r_inv; return r; } enum { JS_RNDN, /* round to nearest, ties to even */ JS_RNDNA, /* round to nearest, ties away from zero */ JS_RNDZ, }; static int mpb_get_bit(const mpb_t *r, int k) { int l; l = (unsigned)k / LIMB_BITS; k = k & (LIMB_BITS - 1); if (l >= r->len) return 0; else return (r->tab[l] >> k) & 1; } /* compute round(r / 2^shift). 'shift' can be negative */ static void mpb_shr_round(mpb_t *r, int shift, int rnd_mode) { int l, i; if (shift == 0) return; if (shift < 0) { shift = -shift; l = (unsigned)shift / LIMB_BITS; shift = shift & (LIMB_BITS - 1); if (shift != 0) { r->tab[r->len] = mp_shl(r->tab, r->tab, r->len, shift, 0); r->len++; mpb_renorm(r); } if (l > 0) { for(i = r->len - 1; i >= 0; i--) r->tab[i + l] = r->tab[i]; for(i = 0; i < l; i++) r->tab[i] = 0; r->len += l; } } else { limb_t bit1, bit2; int k, add_one; switch(rnd_mode) { default: case JS_RNDZ: add_one = 0; break; case JS_RNDN: case JS_RNDNA: bit1 = mpb_get_bit(r, shift - 1); if (bit1) { if (rnd_mode == JS_RNDNA) { bit2 = 1; } else { /* bit2 = oring of all the bits after bit1 */ bit2 = 0; if (shift >= 2) { k = shift - 1; l = (unsigned)k / LIMB_BITS; k = k & (LIMB_BITS - 1); for(i = 0; i < min_int(l, r->len); i++) bit2 |= r->tab[i]; if (l < r->len) bit2 |= r->tab[l] & (((limb_t)1 << k) - 1); } } if (bit2) { add_one = 1; } else { /* round to even */ add_one = mpb_get_bit(r, shift); } } else { add_one = 0; } break; } l = (unsigned)shift / LIMB_BITS; shift = shift & (LIMB_BITS - 1); if (l >= r->len) { r->len = 1; r->tab[0] = add_one; } else { if (l > 0) { r->len -= l; for(i = 0; i < r->len; i++) r->tab[i] = r->tab[i + l]; } if (shift != 0) { mp_shr(r->tab, r->tab, r->len, shift, 0); mpb_renorm(r); } if (add_one) { limb_t a; a = mp_add_ui(r->tab, 1, r->len); if (a) r->tab[r->len++] = a; } } } } /* return -1, 0 or 1 */ static int mpb_cmp(const mpb_t *a, const mpb_t *b) { mp_size_t i; if (a->len < b->len) return -1; else if (a->len > b->len) return 1; for(i = a->len - 1; i >= 0; i--) { if (a->tab[i] != b->tab[i]) { if (a->tab[i] < b->tab[i]) return -1; else return 1; } } return 0; } static void mpb_set_u64(mpb_t *r, uint64_t m) { #if LIMB_BITS == 64 r->tab[0] = m; r->len = 1; #else r->tab[0] = m; r->tab[1] = m >> LIMB_BITS; if (r->tab[1] == 0) r->len = 1; else r->len = 2; #endif } static uint64_t mpb_get_u64(mpb_t *r) { #if LIMB_BITS == 64 return r->tab[0]; #else if (r->len == 1) { return r->tab[0]; } else { return r->tab[0] | ((uint64_t)r->tab[1] << LIMB_BITS); } #endif } /* floor_log2() = position of the first non zero bit or -1 if zero. */ static int mpb_floor_log2(mpb_t *a) { limb_t v; v = a->tab[a->len - 1]; if (v == 0) return -1; else return a->len * LIMB_BITS - 1 - clz32(v); } #define MUL_LOG2_RADIX_BASE_LOG2 24 /* round((1 << MUL_LOG2_RADIX_BASE_LOG2)/log2(i + 2)) */ static const uint32_t mul_log2_radix_table[JS_RADIX_MAX - 1] = { 0x000000, 0xa1849d, 0x000000, 0x6e40d2, 0x6308c9, 0x5b3065, 0x000000, 0x50c24e, 0x4d104d, 0x4a0027, 0x4768ce, 0x452e54, 0x433d00, 0x418677, 0x000000, 0x3ea16b, 0x3d645a, 0x3c43c2, 0x3b3b9a, 0x3a4899, 0x39680b, 0x3897b3, 0x37d5af, 0x372069, 0x367686, 0x35d6df, 0x354072, 0x34b261, 0x342bea, 0x33ac62, 0x000000, 0x32bfd9, 0x3251dd, 0x31e8d6, 0x318465, }; /* return floor(a / log2(radix)) for -2048 <= a <= 2047 */ static int mul_log2_radix(int a, int radix) { int radix_bits, mult; if ((radix & (radix - 1)) == 0) { /* if the radix is a power of two better to do it exactly */ radix_bits = 31 - clz32(radix); if (a < 0) a -= radix_bits - 1; return a / radix_bits; } else { mult = mul_log2_radix_table[radix - 2]; return ((int64_t)a * mult) >> MUL_LOG2_RADIX_BASE_LOG2; } } #if 0 static void build_mul_log2_radix_table(void) { int base, radix, mult, col, base_log2; base_log2 = 24; base = 1 << base_log2; col = 0; for(radix = 2; radix <= 36; radix++) { if ((radix & (radix - 1)) == 0) mult = 0; else mult = lrint((double)base / log2(radix)); printf("0x%06x, ", mult); if (++col == 4) { printf("\n"); col = 0; } } printf("\n"); } static void mul_log2_radix_test(void) { int radix, i, ref, r; for(radix = 2; radix <= 36; radix++) { for(i = -2048; i <= 2047; i++) { ref = (int)floor((double)i / log2(radix)); r = mul_log2_radix(i, radix); if (ref != r) { printf("ERROR: radix=%d i=%d r=%d ref=%d\n", radix, i, r, ref); exit(1); } } } if (0) build_mul_log2_radix_table(); } #endif static void u32toa_len(char *buf, uint32_t n, size_t len) { int digit, i; for(i = len - 1; i >= 0; i--) { digit = n % 10; n = n / 10; buf[i] = digit + '0'; } } /* for power of 2 radixes. len >= 1 */ static void u64toa_bin_len(char *buf, uint64_t n, unsigned int radix_bits, int len) { int digit, i; unsigned int mask; mask = (1 << radix_bits) - 1; for(i = len - 1; i >= 0; i--) { digit = n & mask; n >>= radix_bits; if (digit < 10) digit += '0'; else digit += 'a' - 10; buf[i] = digit; } } /* len >= 1. 2 <= radix <= 36 */ static void limb_to_a(char *buf, limb_t n, unsigned int radix, int len) { int digit, i; if (radix == 10) { /* specific case with constant divisor */ #if LIMB_BITS == 32 u32toa_len(buf, n, len); #else /* XXX: optimize */ for(i = len - 1; i >= 0; i--) { digit = (limb_t)n % 10; n = (limb_t)n / 10; buf[i] = digit + '0'; } #endif } else { for(i = len - 1; i >= 0; i--) { digit = (limb_t)n % radix; n = (limb_t)n / radix; if (digit < 10) digit += '0'; else digit += 'a' - 10; buf[i] = digit; } } } size_t u32toa(char *buf, uint32_t n) { char buf1[10], *q; size_t len; q = buf1 + sizeof(buf1); do { *--q = n % 10 + '0'; n /= 10; } while (n != 0); len = buf1 + sizeof(buf1) - q; memcpy(buf, q, len); return len; } size_t i32toa(char *buf, int32_t n) { if (n >= 0) { return u32toa(buf, n); } else { buf[0] = '-'; return u32toa(buf + 1, -(uint32_t)n) + 1; } } #ifdef USE_FAST_INT size_t u64toa(char *buf, uint64_t n) { if (n < 0x100000000) { return u32toa(buf, n); } else { uint64_t n1; char *q = buf; uint32_t n2; n1 = n / 1000000000; n %= 1000000000; if (n1 >= 0x100000000) { n2 = n1 / 1000000000; n1 = n1 % 1000000000; /* at most two digits */ if (n2 >= 10) { *q++ = n2 / 10 + '0'; n2 %= 10; } *q++ = n2 + '0'; u32toa_len(q, n1, 9); q += 9; } else { q += u32toa(q, n1); } u32toa_len(q, n, 9); q += 9; return q - buf; } } size_t i64toa(char *buf, int64_t n) { if (n >= 0) { return u64toa(buf, n); } else { buf[0] = '-'; return u64toa(buf + 1, -(uint64_t)n) + 1; } } /* XXX: only tested for 1 <= n < 2^53 */ size_t u64toa_radix(char *buf, uint64_t n, unsigned int radix) { int radix_bits, l; if (likely(radix == 10)) return u64toa(buf, n); if ((radix & (radix - 1)) == 0) { radix_bits = 31 - clz32(radix); if (n == 0) l = 1; else l = (64 - clz64(n) + radix_bits - 1) / radix_bits; u64toa_bin_len(buf, n, radix_bits, l); return l; } else { char buf1[41], *q; /* maximum length for radix = 3 */ size_t len; int digit; q = buf1 + sizeof(buf1); do { digit = n % radix; n /= radix; if (digit < 10) digit += '0'; else digit += 'a' - 10; *--q = digit; } while (n != 0); len = buf1 + sizeof(buf1) - q; memcpy(buf, q, len); return len; } } size_t i64toa_radix(char *buf, int64_t n, unsigned int radix) { if (n >= 0) { return u64toa_radix(buf, n, radix); } else { buf[0] = '-'; return u64toa_radix(buf + 1, -(uint64_t)n, radix) + 1; } } #endif /* USE_FAST_INT */ static const uint8_t digits_per_limb_table[JS_RADIX_MAX - 1] = { #if LIMB_BITS == 32 32,20,16,13,12,11,10,10, 9, 9, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, #else 64,40,32,27,24,22,21,20,19,18,17,17,16,16,16,15,15,15,14,14,14,14,13,13,13,13,13,13,13,12,12,12,12,12,12, #endif }; static const uint32_t radix_base_table[JS_RADIX_MAX - 1] = { 0x00000000, 0xcfd41b91, 0x00000000, 0x48c27395, 0x81bf1000, 0x75db9c97, 0x40000000, 0xcfd41b91, 0x3b9aca00, 0x8c8b6d2b, 0x19a10000, 0x309f1021, 0x57f6c100, 0x98c29b81, 0x00000000, 0x18754571, 0x247dbc80, 0x3547667b, 0x4c4b4000, 0x6b5a6e1d, 0x94ace180, 0xcaf18367, 0x0b640000, 0x0e8d4a51, 0x1269ae40, 0x17179149, 0x1cb91000, 0x23744899, 0x2b73a840, 0x34e63b41, 0x40000000, 0x4cfa3cc1, 0x5c13d840, 0x6d91b519, 0x81bf1000, }; /* XXX: remove the table ? */ static uint8_t dtoa_max_digits_table[JS_RADIX_MAX - 1] = { 54, 35, 28, 24, 22, 20, 19, 18, 17, 17, 16, 16, 15, 15, 15, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, }; /* we limit the maximum number of significant digits for atod to about 128 bits of precision for non power of two bases. The only requirement for Javascript is at least 20 digits in base 10. For power of two bases, we do an exact rounding in all the cases. */ static uint8_t atod_max_digits_table[JS_RADIX_MAX - 1] = { 64, 80, 32, 55, 49, 45, 21, 40, 38, 37, 35, 34, 33, 32, 16, 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 26, 25, 12, 25, 25, 24, 24, }; /* if abs(d) >= B^max_exponent, it is an overflow */ static const int16_t max_exponent[JS_RADIX_MAX - 1] = { 1024, 647, 512, 442, 397, 365, 342, 324, 309, 297, 286, 277, 269, 263, 256, 251, 246, 242, 237, 234, 230, 227, 224, 221, 218, 216, 214, 211, 209, 207, 205, 203, 202, 200, 199, }; /* if abs(d) <= B^min_exponent, it is an underflow */ static const int16_t min_exponent[JS_RADIX_MAX - 1] = { -1075, -679, -538, -463, -416, -383, -359, -340, -324, -311, -300, -291, -283, -276, -269, -263, -258, -254, -249, -245, -242, -238, -235, -232, -229, -227, -224, -222, -220, -217, -215, -214, -212, -210, -208, }; #if 0 void build_tables(void) { int r, j, radix, n, col, i; /* radix_base_table */ for(radix = 2; radix <= 36; radix++) { r = 1; for(j = 0; j < digits_per_limb_table[radix - 2]; j++) { r *= radix; } printf(" 0x%08x,", r); if ((radix % 4) == 1) printf("\n"); } printf("\n"); /* dtoa_max_digits_table */ for(radix = 2; radix <= 36; radix++) { /* Note: over estimated when the radix is a power of two */ printf(" %d,", 1 + (int)ceil(53.0 / log2(radix))); } printf("\n"); /* atod_max_digits_table */ for(radix = 2; radix <= 36; radix++) { if ((radix & (radix - 1)) == 0) { /* 64 bits is more than enough */ n = (int)floor(64.0 / log2(radix)); } else { n = (int)floor(128.0 / log2(radix)); } printf(" %d,", n); } printf("\n"); printf("static const int16_t max_exponent[JS_RADIX_MAX - 1] = {\n"); col = 0; for(radix = 2; radix <= 36; radix++) { printf("%5d, ", (int)ceil(1024 / log2(radix))); if (++col == 8) { col = 0; printf("\n"); } } printf("\n};\n\n"); printf("static const int16_t min_exponent[JS_RADIX_MAX - 1] = {\n"); col = 0; for(radix = 2; radix <= 36; radix++) { printf("%5d, ", (int)floor(-1075 / log2(radix))); if (++col == 8) { col = 0; printf("\n"); } } printf("\n};\n\n"); printf("static const uint32_t pow5_table[16] = {\n"); col = 0; for(i = 2; i <= 17; i++) { r = 1; for(j = 0; j < i; j++) { r *= 5; } printf("0x%08x, ", r); if (++col == 4) { col = 0; printf("\n"); } } printf("\n};\n\n"); /* high part */ printf("static const uint8_t pow5h_table[4] = {\n"); col = 0; for(i = 14; i <= 17; i++) { uint64_t r1; r1 = 1; for(j = 0; j < i; j++) { r1 *= 5; } printf("0x%08x, ", (uint32_t)(r1 >> 32)); if (++col == 4) { col = 0; printf("\n"); } } printf("\n};\n\n"); } #endif /* n_digits >= 1. 0 <= dot_pos <= n_digits. If dot_pos == n_digits, the dot is not displayed. 'a' is modified. */ static int output_digits(char *buf, mpb_t *a, int radix, int n_digits1, int dot_pos) { int n_digits, digits_per_limb, radix_bits, n, len; n_digits = n_digits1; if ((radix & (radix - 1)) == 0) { /* radix = 2^radix_bits */ radix_bits = 31 - clz32(radix); } else { radix_bits = 0; } digits_per_limb = digits_per_limb_table[radix - 2]; if (radix_bits != 0) { for(;;) { n = min_int(n_digits, digits_per_limb); n_digits -= n; u64toa_bin_len(buf + n_digits, a->tab[0], radix_bits, n); if (n_digits == 0) break; mpb_shr_round(a, digits_per_limb * radix_bits, JS_RNDZ); } } else { limb_t r; while (n_digits != 0) { n = min_int(n_digits, digits_per_limb); n_digits -= n; r = mp_div1(a->tab, a->tab, a->len, radix_base_table[radix - 2], 0); mpb_renorm(a); limb_to_a(buf + n_digits, r, radix, n); } } /* add the dot */ len = n_digits1; if (dot_pos != n_digits1) { memmove(buf + dot_pos + 1, buf + dot_pos, n_digits1 - dot_pos); buf[dot_pos] = '.'; len++; } return len; } /* return (a, e_offset) such that a = a * (radix1*2^radix_shift)^f * 2^-e_offset. 'f' can be negative. */ static int mul_pow(mpb_t *a, int radix1, int radix_shift, int f, bool is_int, int e) { int e_offset, d, n, n0; e_offset = -f * radix_shift; if (radix1 != 1) { d = digits_per_limb_table[radix1 - 2]; if (f >= 0) { limb_t h, b; b = 0; n0 = 0; while (f != 0) { n = min_int(f, d); if (n != n0) { b = pow_ui(radix1, n); n0 = n; } h = mp_mul1(a->tab, a->tab, a->len, b, 0); if (h != 0) { a->tab[a->len++] = h; } f -= n; } } else { int extra_bits, l, shift; limb_t r, rem, b, b_inv; f = -f; l = (f + d - 1) / d; /* high bound for the number of limbs (XXX: make it better) */ e_offset += l * LIMB_BITS; if (!is_int) { /* at least 'e' bits are needed in the final result for rounding */ extra_bits = max_int(e - mpb_floor_log2(a), 0); } else { /* at least two extra bits are needed in the final result for rounding */ extra_bits = max_int(2 + e - e_offset, 0); } e_offset += extra_bits; mpb_shr_round(a, -(l * LIMB_BITS + extra_bits), JS_RNDZ); b = 0; b_inv = 0; shift = 0; n0 = 0; rem = 0; while (f != 0) { n = min_int(f, d); if (n != n0) { b = pow_ui_inv(&b_inv, &shift, radix1, n); n0 = n; } r = mp_div1norm(a->tab, a->tab, a->len, b, 0, b_inv, shift); rem |= r; mpb_renorm(a); f -= n; } /* if the remainder is non zero, use it for rounding */ a->tab[0] |= (rem != 0); } } return e_offset; } /* tmp1 = round(m*2^e*radix^f). 'tmp0' is a temporary storage */ static void mul_pow_round(mpb_t *tmp1, uint64_t m, int e, int radix1, int radix_shift, int f, int rnd_mode) { int e_offset; mpb_set_u64(tmp1, m); e_offset = mul_pow(tmp1, radix1, radix_shift, f, true, e); mpb_shr_round(tmp1, -e + e_offset, rnd_mode); } /* return round(a*2^e_offset) rounded as a float64. 'a' is modified */ static uint64_t round_to_d(int *pe, mpb_t *a, int e_offset, int rnd_mode) { int e; uint64_t m; if (a->tab[0] == 0 && a->len == 1) { /* zero result */ m = 0; e = 0; /* don't care */ } else { int prec, prec1, e_min; e = mpb_floor_log2(a) + 1 - e_offset; prec1 = 53; e_min = -1021; if (e < e_min) { /* subnormal result or zero */ prec = prec1 - (e_min - e); } else { prec = prec1; } mpb_shr_round(a, e + e_offset - prec, rnd_mode); m = mpb_get_u64(a); m <<= (53 - prec); /* mantissa overflow due to rounding */ if (m >= (uint64_t)1 << 53) { m >>= 1; e++; } } *pe = e; return m; } /* return (m, e) such that m*2^(e-53) = round(a * radix^f) with 2^52 <= m < 2^53 or m = 0. 'a' is modified. */ static uint64_t mul_pow_round_to_d(int *pe, mpb_t *a, int radix1, int radix_shift, int f, int rnd_mode) { int e_offset; e_offset = mul_pow(a, radix1, radix_shift, f, false, 55); return round_to_d(pe, a, e_offset, rnd_mode); } #ifdef JS_DTOA_DUMP_STATS static int out_len_count[17]; void js_dtoa_dump_stats(void) { int i, sum; sum = 0; for(i = 0; i < 17; i++) sum += out_len_count[i]; for(i = 0; i < 17; i++) { printf("%2d %8d %5.2f%%\n", i + 1, out_len_count[i], (double)out_len_count[i] / sum * 100); } } #endif /* return a maximum bound of the string length. The bound depends on 'd' only if format = JS_DTOA_FORMAT_FRAC or if JS_DTOA_EXP_DISABLED is enabled. */ int js_dtoa_max_len(double d, int radix, int n_digits, int flags) { int fmt = flags & JS_DTOA_FORMAT_MASK; int n, e; uint64_t a; if (fmt != JS_DTOA_FORMAT_FRAC) { if (fmt == JS_DTOA_FORMAT_FREE) { n = dtoa_max_digits_table[radix - 2]; } else { n = n_digits; } if ((flags & JS_DTOA_EXP_MASK) == JS_DTOA_EXP_DISABLED) { /* no exponential */ a = float64_as_uint64(d); e = (a >> 52) & 0x7ff; if (e == 0x7ff) { /* NaN, Infinity */ n = 0; } else { e -= 1023; /* XXX: adjust */ n += 10 + abs(mul_log2_radix(e - 1, radix)); } } else { /* extra: sign, 1 dot and exponent "e-1000" */ n += 1 + 1 + 6; } } else { a = float64_as_uint64(d); e = (a >> 52) & 0x7ff; if (e == 0x7ff) { /* NaN, Infinity */ n = 0; } else { /* high bound for the integer part */ e -= 1023; /* x < 2^(e + 1) */ if (e < 0) { n = 1; } else { n = 2 + mul_log2_radix(e - 1, radix); } /* sign, extra digit, 1 dot */ n += 1 + 1 + 1 + n_digits; } } return max_int(n, 9); /* also include NaN and [-]Infinity */ } #if defined(__SANITIZE_ADDRESS__) && 0 static void *dtoa_malloc(uint64_t **pptr, size_t size) { return malloc(size); } static void dtoa_free(void *ptr) { free(ptr); } #else static void *dtoa_malloc(uint64_t **pptr, size_t size) { void *ret; ret = *pptr; *pptr += (size + 7) / 8; return ret; } static void dtoa_free(void *ptr) { } #endif /* return the length */ int js_dtoa(char *buf, double d, int radix, int n_digits, int flags, JSDTOATempMem *tmp_mem) { uint64_t a, m, *mptr = tmp_mem->mem; int e, sgn, l, E, P, i, E_max, radix1, radix_shift; char *q; mpb_t *tmp1, *mant_max; int fmt = flags & JS_DTOA_FORMAT_MASK; tmp1 = dtoa_malloc(&mptr, sizeof(mpb_t) + sizeof(limb_t) * DBIGNUM_LEN_MAX); mant_max = dtoa_malloc(&mptr, sizeof(mpb_t) + sizeof(limb_t) * MANT_LEN_MAX); assert((mptr - tmp_mem->mem) <= sizeof(JSDTOATempMem) / sizeof(mptr[0])); radix_shift = ctz32(radix); radix1 = radix >> radix_shift; a = float64_as_uint64(d); sgn = a >> 63; e = (a >> 52) & 0x7ff; m = a & (((uint64_t)1 << 52) - 1); q = buf; if (e == 0x7ff) { if (m == 0) { if (sgn) *q++ = '-'; memcpy(q, "Infinity", 8); q += 8; } else { memcpy(q, "NaN", 3); q += 3; } goto done; } else if (e == 0) { if (m == 0) { tmp1->len = 1; tmp1->tab[0] = 0; E = 1; if (fmt == JS_DTOA_FORMAT_FREE) P = 1; else if (fmt == JS_DTOA_FORMAT_FRAC) P = n_digits + 1; else P = n_digits; /* "-0" is displayed as "0" if JS_DTOA_MINUS_ZERO is not present */ if (sgn && (flags & JS_DTOA_MINUS_ZERO)) *q++ = '-'; goto output; } /* denormal number: convert to a normal number */ l = clz64(m) - 11; e -= l - 1; m <<= l; } else { m |= (uint64_t)1 << 52; } if (sgn) *q++ = '-'; /* remove the bias */ e -= 1022; /* d = 2^(e-53)*m */ // printf("m=0x%016" PRIx64 " e=%d\n", m, e); #ifdef USE_FAST_INT if (fmt == JS_DTOA_FORMAT_FREE && e >= 1 && e <= 53 && (m & (((uint64_t)1 << (53 - e)) - 1)) == 0 && (flags & JS_DTOA_EXP_MASK) != JS_DTOA_EXP_ENABLED) { m >>= 53 - e; /* 'm' is never zero */ q += u64toa_radix(q, m, radix); goto done; } #endif /* this choice of E implies F=round(x*B^(P-E) is such as: B^(P-1) <= F < 2.B^P. */ E = 1 + mul_log2_radix(e - 1, radix); if (fmt == JS_DTOA_FORMAT_FREE) { int P_max, E0, e1, E_found, P_found; uint64_t m1, mant_found, mant, mant_max1; /* P_max is guarranteed to work by construction */ P_max = dtoa_max_digits_table[radix - 2]; E0 = E; E_found = 0; P_found = 0; mant_found = 0; /* find the minimum number of digits by successive tries */ P = P_max; /* P_max is guarateed to work */ for(;;) { /* mant_max always fits on 64 bits */ mant_max1 = pow_ui(radix, P); /* compute the mantissa in base B */ E = E0; for(;;) { /* XXX: add inexact flag */ mul_pow_round(tmp1, m, e - 53, radix1, radix_shift, P - E, JS_RNDN); mant = mpb_get_u64(tmp1); if (mant < mant_max1) break; E++; /* at most one iteration is possible */ } /* remove useless trailing zero digits */ while ((mant % radix) == 0) { mant /= radix; P--; } /* garanteed to work for P = P_max */ if (P_found == 0) goto prec_found; /* convert back to base 2 */ mpb_set_u64(tmp1, mant); m1 = mul_pow_round_to_d(&e1, tmp1, radix1, radix_shift, E - P, JS_RNDN); // printf("P=%2d: m=0x%016" PRIx64 " e=%d m1=0x%016" PRIx64 " e1=%d\n", P, m, e, m1, e1); /* Note: (m, e) is never zero here, so the exponent for m1 = 0 does not matter */ if (m1 == m && e1 == e) { prec_found: P_found = P; E_found = E; mant_found = mant; if (P == 1) break; P--; /* try lower exponent */ } else { break; } } P = P_found; E = E_found; mpb_set_u64(tmp1, mant_found); #ifdef JS_DTOA_DUMP_STATS if (radix == 10) { out_len_count[P - 1]++; } #endif } else if (fmt == JS_DTOA_FORMAT_FRAC) { int len; assert(n_digits >= 0 && n_digits <= JS_DTOA_MAX_DIGITS); /* P = max_int(E, 1) + n_digits; */ /* frac is rounded using RNDNA */ mul_pow_round(tmp1, m, e - 53, radix1, radix_shift, n_digits, JS_RNDNA); /* we add one extra digit on the left and remove it if needed to avoid testing if the result is < radix^P */ len = output_digits(q, tmp1, radix, max_int(E + 1, 1) + n_digits, max_int(E + 1, 1)); if (q[0] == '0' && len >= 2 && q[1] != '.') { len--; memmove(q, q + 1, len); } q += len; goto done; } else { int pow_shift; assert(n_digits >= 1 && n_digits <= JS_DTOA_MAX_DIGITS); P = n_digits; /* mant_max = radix^P */ mant_max->len = 1; mant_max->tab[0] = 1; pow_shift = mul_pow(mant_max, radix1, radix_shift, P, false, 0); mpb_shr_round(mant_max, pow_shift, JS_RNDZ); for(;;) { /* fixed and frac are rounded using RNDNA */ mul_pow_round(tmp1, m, e - 53, radix1, radix_shift, P - E, JS_RNDNA); if (mpb_cmp(tmp1, mant_max) < 0) break; E++; /* at most one iteration is possible */ } } output: if (fmt == JS_DTOA_FORMAT_FIXED) E_max = n_digits; else E_max = dtoa_max_digits_table[radix - 2] + 4; if ((flags & JS_DTOA_EXP_MASK) == JS_DTOA_EXP_ENABLED || ((flags & JS_DTOA_EXP_MASK) == JS_DTOA_EXP_AUTO && (E <= -6 || E > E_max))) { q += output_digits(q, tmp1, radix, P, 1); E--; if (radix == 10) { *q++ = 'e'; } else if (radix1 == 1 && radix_shift <= 4) { E *= radix_shift; *q++ = 'p'; } else { *q++ = '@'; } if (E < 0) { *q++ = '-'; E = -E; } else { *q++ = '+'; } q += u32toa(q, E); } else if (E <= 0) { *q++ = '0'; *q++ = '.'; for(i = 0; i < -E; i++) *q++ = '0'; q += output_digits(q, tmp1, radix, P, P); } else { q += output_digits(q, tmp1, radix, P, min_int(P, E)); for(i = 0; i < E - P; i++) *q++ = '0'; } done: *q = '\0'; dtoa_free(mant_max); dtoa_free(tmp1); return q - buf; } static inline int to_digit(int c) { if (c >= '0' && c <= '9') return c - '0'; else if (c >= 'A' && c <= 'Z') return c - 'A' + 10; else if (c >= 'a' && c <= 'z') return c - 'a' + 10; else return 36; } /* r = r * radix_base + a. radix_base = 0 means radix_base = 2^32 */ static void mpb_mul1_base(mpb_t *r, limb_t radix_base, limb_t a) { int i; if (r->tab[0] == 0 && r->len == 1) { r->tab[0] = a; } else { if (radix_base == 0) { for(i = r->len; i >= 0; i--) { r->tab[i + 1] = r->tab[i]; } r->tab[0] = a; } else { r->tab[r->len] = mp_mul1(r->tab, r->tab, r->len, radix_base, a); } r->len++; mpb_renorm(r); } } /* XXX: add fast path for small integers */ double js_atod(const char *str, const char **pnext, int radix, int flags, JSATODTempMem *tmp_mem) { uint64_t *mptr = tmp_mem->mem; const char *p, *p_start; limb_t cur_limb, radix_base, extra_digits; int is_neg, digit_count, limb_digit_count, digits_per_limb, sep, radix1, radix_shift; int radix_bits, expn, e, max_digits, expn_offset, dot_pos, sig_pos, pos; mpb_t *tmp0; double dval; bool is_bin_exp, is_zero, expn_overflow; uint64_t m, a; tmp0 = dtoa_malloc(&mptr, sizeof(mpb_t) + sizeof(limb_t) * DBIGNUM_LEN_MAX); assert((mptr - tmp_mem->mem) <= sizeof(JSATODTempMem) / sizeof(mptr[0])); /* optional separator between digits */ sep = (flags & JS_ATOD_ACCEPT_UNDERSCORES) ? '_' : 256; p = str; is_neg = 0; if (p[0] == '+') { p++; p_start = p; } else if (p[0] == '-') { is_neg = 1; p++; p_start = p; } else { p_start = p; } if (p[0] == '0') { if ((p[1] == 'x' || p[1] == 'X') && (radix == 0 || radix == 16)) { p += 2; radix = 16; } else if ((p[1] == 'o' || p[1] == 'O') && radix == 0 && (flags & JS_ATOD_ACCEPT_BIN_OCT)) { p += 2; radix = 8; } else if ((p[1] == 'b' || p[1] == 'B') && radix == 0 && (flags & JS_ATOD_ACCEPT_BIN_OCT)) { p += 2; radix = 2; } else if ((p[1] >= '0' && p[1] <= '9') && radix == 0 && (flags & JS_ATOD_ACCEPT_LEGACY_OCTAL)) { int i; sep = 256; for (i = 1; (p[i] >= '0' && p[i] <= '7'); i++) continue; if (p[i] == '8' || p[i] == '9') goto no_prefix; p += 1; radix = 8; } else { goto no_prefix; } /* there must be a digit after the prefix */ if (to_digit((uint8_t)*p) >= radix) goto fail; no_prefix: ; } else { if (!(flags & JS_ATOD_INT_ONLY) && js__strstart(p, "Infinity", &p)) goto overflow; } if (radix == 0) radix = 10; cur_limb = 0; expn_offset = 0; digit_count = 0; limb_digit_count = 0; max_digits = atod_max_digits_table[radix - 2]; digits_per_limb = digits_per_limb_table[radix - 2]; radix_base = radix_base_table[radix - 2]; radix_shift = ctz32(radix); radix1 = radix >> radix_shift; if (radix1 == 1) { /* radix = 2^radix_bits */ radix_bits = radix_shift; } else { radix_bits = 0; } tmp0->len = 1; tmp0->tab[0] = 0; extra_digits = 0; pos = 0; dot_pos = -1; /* skip leading zeros */ for(;;) { if (*p == '.' && (p > p_start || to_digit(p[1]) < radix) && !(flags & JS_ATOD_INT_ONLY)) { if (*p == sep) goto fail; if (dot_pos >= 0) break; dot_pos = pos; p++; } if (*p == sep && p > p_start && p[1] == '0') p++; if (*p != '0') break; p++; pos++; } sig_pos = pos; for(;;) { limb_t c; if (*p == '.' && (p > p_start || to_digit(p[1]) < radix) && !(flags & JS_ATOD_INT_ONLY)) { if (*p == sep) goto fail; if (dot_pos >= 0) break; dot_pos = pos; p++; } if (*p == sep && p > p_start && to_digit(p[1]) < radix) p++; c = to_digit(*p); if (c >= radix) break; p++; pos++; if (digit_count < max_digits) { /* XXX: could be faster when radix_bits != 0 */ cur_limb = cur_limb * radix + c; limb_digit_count++; if (limb_digit_count == digits_per_limb) { mpb_mul1_base(tmp0, radix_base, cur_limb); cur_limb = 0; limb_digit_count = 0; } digit_count++; } else { extra_digits |= c; } } if (limb_digit_count != 0) { mpb_mul1_base(tmp0, pow_ui(radix, limb_digit_count), cur_limb); } if (digit_count == 0) { is_zero = true; expn_offset = 0; } else { is_zero = false; if (dot_pos < 0) dot_pos = pos; expn_offset = sig_pos + digit_count - dot_pos; } /* Use the extra digits for rounding if the base is a power of two. Otherwise they are just truncated. */ if (radix_bits != 0 && extra_digits != 0) { tmp0->tab[0] |= 1; } /* parse the exponent, if any */ expn = 0; expn_overflow = false; is_bin_exp = false; if (!(flags & JS_ATOD_INT_ONLY) && ((radix == 10 && (*p == 'e' || *p == 'E')) || (radix != 10 && (*p == '@' || (radix_bits >= 1 && radix_bits <= 4 && (*p == 'p' || *p == 'P'))))) && p > p_start) { bool exp_is_neg; int c; is_bin_exp = (*p == 'p' || *p == 'P'); p++; exp_is_neg = false; if (*p == '+') { p++; } else if (*p == '-') { exp_is_neg = true; p++; } c = to_digit(*p); if (c >= 10) goto fail; /* XXX: could stop before the exponent part */ expn = c; p++; for(;;) { if (*p == sep && to_digit(p[1]) < 10) p++; c = to_digit(*p); if (c >= 10) break; if (!expn_overflow) { if (unlikely(expn > ((INT32_MAX - 2 - 9) / 10))) { expn_overflow = true; } else { expn = expn * 10 + c; } } p++; } if (exp_is_neg) expn = -expn; /* if zero result, the exponent can be arbitrarily large */ if (!is_zero && expn_overflow) { if (exp_is_neg) a = 0; else a = (uint64_t)0x7ff << 52; /* infinity */ goto done; } } if (p == p_start) goto fail; if (is_zero) { a = 0; } else { int expn1; if (radix_bits != 0) { if (!is_bin_exp) expn *= radix_bits; expn -= expn_offset * radix_bits; expn1 = expn + digit_count * radix_bits; if (expn1 >= 1024 + radix_bits) goto overflow; else if (expn1 <= -1075) goto underflow; m = round_to_d(&e, tmp0, -expn, JS_RNDN); } else { expn -= expn_offset; expn1 = expn + digit_count; if (expn1 >= max_exponent[radix - 2] + 1) goto overflow; else if (expn1 <= min_exponent[radix - 2]) goto underflow; m = mul_pow_round_to_d(&e, tmp0, radix1, radix_shift, expn, JS_RNDN); } if (m == 0) { underflow: a = 0; } else if (e > 1024) { overflow: /* overflow */ a = (uint64_t)0x7ff << 52; } else if (e < -1073) { /* underflow */ /* XXX: check rounding */ a = 0; } else if (e < -1021) { /* subnormal */ a = m >> (-e - 1021); } else { a = ((uint64_t)(e + 1022) << 52) | (m & (((uint64_t)1 << 52) - 1)); } } done: a |= (uint64_t)is_neg << 63; dval = uint64_as_float64(a); done1: if (pnext) *pnext = p; dtoa_free(tmp0); return dval; fail: dval = NAN; goto done1; } qbs-src-3.2.0/src/shared/quickjs/libunicode.c0000644000175100017510000014372215154533055020502 0ustar runnerrunner/* * Unicode utilities * * Copyright (c) 2017-2018 Fabrice Bellard * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include #include #include #include #include "cutils.h" #include "libunicode.h" #include "libunicode-table.h" // note: stored as 4 bit tag, not much room left enum { RUN_TYPE_U, RUN_TYPE_L, RUN_TYPE_UF, RUN_TYPE_LF, RUN_TYPE_UL, RUN_TYPE_LSU, RUN_TYPE_U2L_399_EXT2, RUN_TYPE_UF_D20, RUN_TYPE_UF_D1_EXT, RUN_TYPE_U_EXT, RUN_TYPE_LF_EXT, RUN_TYPE_UF_EXT2, RUN_TYPE_LF_EXT2, RUN_TYPE_UF_EXT3, }; static int lre_case_conv1(uint32_t c, int conv_type) { uint32_t res[LRE_CC_RES_LEN_MAX]; lre_case_conv(res, c, conv_type); return res[0]; } /* case conversion using the table entry 'idx' with value 'v' */ static int lre_case_conv_entry(uint32_t *res, uint32_t c, int conv_type, uint32_t idx, uint32_t v) { uint32_t code, data, type, a, is_lower; is_lower = (conv_type != 0); type = (v >> (32 - 17 - 7 - 4)) & 0xf; data = ((v & 0xf) << 8) | case_conv_table2[idx]; code = v >> (32 - 17); switch(type) { case RUN_TYPE_U: case RUN_TYPE_L: case RUN_TYPE_UF: case RUN_TYPE_LF: if (conv_type == (type & 1) || (type >= RUN_TYPE_UF && conv_type == 2)) { c = c - code + (case_conv_table1[data] >> (32 - 17)); } break; case RUN_TYPE_UL: a = c - code; if ((a & 1) != (1 - is_lower)) break; c = (a ^ 1) + code; break; case RUN_TYPE_LSU: a = c - code; if (a == 1) { c += 2 * is_lower - 1; } else if (a == (1 - is_lower) * 2) { c += (2 * is_lower - 1) * 2; } break; case RUN_TYPE_U2L_399_EXT2: if (!is_lower) { res[0] = c - code + case_conv_ext[data >> 6]; res[1] = 0x399; return 2; } else { c = c - code + case_conv_ext[data & 0x3f]; } break; case RUN_TYPE_UF_D20: if (conv_type == 1) break; c = data + (conv_type == 2) * 0x20; break; case RUN_TYPE_UF_D1_EXT: if (conv_type == 1) break; c = case_conv_ext[data] + (conv_type == 2); break; case RUN_TYPE_U_EXT: case RUN_TYPE_LF_EXT: if (is_lower != (type - RUN_TYPE_U_EXT)) break; c = case_conv_ext[data]; break; case RUN_TYPE_LF_EXT2: if (!is_lower) break; res[0] = c - code + case_conv_ext[data >> 6]; res[1] = case_conv_ext[data & 0x3f]; return 2; case RUN_TYPE_UF_EXT2: if (conv_type == 1) break; res[0] = c - code + case_conv_ext[data >> 6]; res[1] = case_conv_ext[data & 0x3f]; if (conv_type == 2) { /* convert to lower */ res[0] = lre_case_conv1(res[0], 1); res[1] = lre_case_conv1(res[1], 1); } return 2; default: case RUN_TYPE_UF_EXT3: if (conv_type == 1) break; res[0] = case_conv_ext[data >> 8]; res[1] = case_conv_ext[(data >> 4) & 0xf]; res[2] = case_conv_ext[data & 0xf]; if (conv_type == 2) { /* convert to lower */ res[0] = lre_case_conv1(res[0], 1); res[1] = lre_case_conv1(res[1], 1); res[2] = lre_case_conv1(res[2], 1); } return 3; } res[0] = c; return 1; } /* conv_type: 0 = to upper 1 = to lower 2 = case folding (= to lower with modifications) */ int lre_case_conv(uint32_t *res, uint32_t c, int conv_type) { if (c < 128) { if (conv_type) { if (c >= 'A' && c <= 'Z') { c = c - 'A' + 'a'; } } else { if (c >= 'a' && c <= 'z') { c = c - 'a' + 'A'; } } } else { uint32_t v, code, len; int idx, idx_min, idx_max; idx_min = 0; idx_max = countof(case_conv_table1) - 1; while (idx_min <= idx_max) { idx = (unsigned)(idx_max + idx_min) / 2; v = case_conv_table1[idx]; code = v >> (32 - 17); len = (v >> (32 - 17 - 7)) & 0x7f; if (c < code) { idx_max = idx - 1; } else if (c >= code + len) { idx_min = idx + 1; } else { return lre_case_conv_entry(res, c, conv_type, idx, v); } } } res[0] = c; return 1; } static int lre_case_folding_entry(uint32_t c, uint32_t idx, uint32_t v, bool is_unicode) { uint32_t res[LRE_CC_RES_LEN_MAX]; int len; if (is_unicode) { len = lre_case_conv_entry(res, c, 2, idx, v); if (len == 1) { c = res[0]; } else { /* handle the few specific multi-character cases (see unicode_gen.c:dump_case_folding_special_cases()) */ if (c == 0xfb06) { c = 0xfb05; } else if (c == 0x01fd3) { c = 0x390; } else if (c == 0x01fe3) { c = 0x3b0; } } } else { if (likely(c < 128)) { if (c >= 'a' && c <= 'z') c = c - 'a' + 'A'; } else { /* legacy regexp: to upper case if single char >= 128 */ len = lre_case_conv_entry(res, c, false, idx, v); if (len == 1 && res[0] >= 128) c = res[0]; } } return c; } /* JS regexp specific rules for case folding */ int lre_canonicalize(uint32_t c, bool is_unicode) { if (c < 128) { /* fast case */ if (is_unicode) { if (c >= 'A' && c <= 'Z') { c = c - 'A' + 'a'; } } else { if (c >= 'a' && c <= 'z') { c = c - 'a' + 'A'; } } } else { uint32_t v, code, len; int idx, idx_min, idx_max; idx_min = 0; idx_max = countof(case_conv_table1) - 1; while (idx_min <= idx_max) { idx = (unsigned)(idx_max + idx_min) / 2; v = case_conv_table1[idx]; code = v >> (32 - 17); len = (v >> (32 - 17 - 7)) & 0x7f; if (c < code) { idx_max = idx - 1; } else if (c >= code + len) { idx_min = idx + 1; } else { return lre_case_folding_entry(c, idx, v, is_unicode); } } } return c; } static uint32_t get_le24(const uint8_t *ptr) { return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16); } #define UNICODE_INDEX_BLOCK_LEN 32 /* return -1 if not in table, otherwise the offset in the block */ static int get_index_pos(uint32_t *pcode, uint32_t c, const uint8_t *index_table, int index_table_len) { uint32_t code, v; int idx_min, idx_max, idx; idx_min = 0; v = get_le24(index_table); code = v & ((1 << 21) - 1); if (c < code) { *pcode = 0; return 0; } idx_max = index_table_len - 1; code = get_le24(index_table + idx_max * 3); if (c >= code) return -1; /* invariant: tab[idx_min] <= c < tab2[idx_max] */ while ((idx_max - idx_min) > 1) { idx = (idx_max + idx_min) / 2; v = get_le24(index_table + idx * 3); code = v & ((1 << 21) - 1); if (c < code) { idx_max = idx; } else { idx_min = idx; } } v = get_le24(index_table + idx_min * 3); *pcode = v & ((1 << 21) - 1); return (idx_min + 1) * UNICODE_INDEX_BLOCK_LEN + (v >> 21); } static bool lre_is_in_table(uint32_t c, const uint8_t *table, const uint8_t *index_table, int index_table_len) { uint32_t code, b, bit; int pos; const uint8_t *p; pos = get_index_pos(&code, c, index_table, index_table_len); if (pos < 0) return false; /* outside the table */ p = table + pos; bit = 0; for(;;) { b = *p++; if (b < 64) { code += (b >> 3) + 1; if (c < code) return bit; bit ^= 1; code += (b & 7) + 1; } else if (b >= 0x80) { code += b - 0x80 + 1; } else if (b < 0x60) { code += (((b - 0x40) << 8) | p[0]) + 1; p++; } else { code += (((b - 0x60) << 16) | (p[0] << 8) | p[1]) + 1; p += 2; } if (c < code) return bit; bit ^= 1; } } bool lre_is_cased(uint32_t c) { uint32_t v, code, len; int idx, idx_min, idx_max; idx_min = 0; idx_max = countof(case_conv_table1) - 1; while (idx_min <= idx_max) { idx = (unsigned)(idx_max + idx_min) / 2; v = case_conv_table1[idx]; code = v >> (32 - 17); len = (v >> (32 - 17 - 7)) & 0x7f; if (c < code) { idx_max = idx - 1; } else if (c >= code + len) { idx_min = idx + 1; } else { return true; } } return lre_is_in_table(c, unicode_prop_Cased1_table, unicode_prop_Cased1_index, sizeof(unicode_prop_Cased1_index) / 3); } bool lre_is_case_ignorable(uint32_t c) { return lre_is_in_table(c, unicode_prop_Case_Ignorable_table, unicode_prop_Case_Ignorable_index, sizeof(unicode_prop_Case_Ignorable_index) / 3); } /* character range */ static __maybe_unused void cr_dump(CharRange *cr) { int i; for(i = 0; i < cr->len; i++) printf("%d: 0x%04x\n", i, cr->points[i]); } static void *cr_default_realloc(void *opaque, void *ptr, size_t size) { return realloc(ptr, size); } void cr_init(CharRange *cr, void *mem_opaque, DynBufReallocFunc *realloc_func) { cr->len = cr->size = 0; cr->points = NULL; cr->mem_opaque = mem_opaque; cr->realloc_func = realloc_func ? realloc_func : cr_default_realloc; } void cr_free(CharRange *cr) { cr->realloc_func(cr->mem_opaque, cr->points, 0); } int cr_realloc(CharRange *cr, int size) { int new_size; uint32_t *new_buf; if (size > cr->size) { new_size = max_int(size, cr->size * 3 / 2); new_buf = cr->realloc_func(cr->mem_opaque, cr->points, new_size * sizeof(cr->points[0])); if (!new_buf) return -1; cr->points = new_buf; cr->size = new_size; } return 0; } int cr_copy(CharRange *cr, const CharRange *cr1) { if (cr_realloc(cr, cr1->len)) return -1; memcpy(cr->points, cr1->points, sizeof(cr->points[0]) * cr1->len); cr->len = cr1->len; return 0; } /* merge consecutive intervals and remove empty intervals */ static void cr_compress(CharRange *cr) { int i, j, k, len; uint32_t *pt; pt = cr->points; len = cr->len; i = 0; j = 0; k = 0; while ((i + 1) < len) { if (pt[i] == pt[i + 1]) { /* empty interval */ i += 2; } else { j = i; while ((j + 3) < len && pt[j + 1] == pt[j + 2]) j += 2; /* just copy */ pt[k] = pt[i]; pt[k + 1] = pt[j + 1]; k += 2; i = j + 2; } } cr->len = k; } /* union or intersection */ int cr_op(CharRange *cr, const uint32_t *a_pt, int a_len, const uint32_t *b_pt, int b_len, int op) { int a_idx, b_idx, is_in; uint32_t v; a_idx = 0; b_idx = 0; for(;;) { /* get one more point from a or b in increasing order */ if (a_idx < a_len && b_idx < b_len) { if (a_pt[a_idx] < b_pt[b_idx]) { goto a_add; } else if (a_pt[a_idx] == b_pt[b_idx]) { v = a_pt[a_idx]; a_idx++; b_idx++; } else { goto b_add; } } else if (a_idx < a_len) { a_add: v = a_pt[a_idx++]; } else if (b_idx < b_len) { b_add: v = b_pt[b_idx++]; } else { break; } /* add the point if the in/out status changes */ switch(op) { case CR_OP_UNION: is_in = (a_idx & 1) | (b_idx & 1); break; case CR_OP_INTER: is_in = (a_idx & 1) & (b_idx & 1); break; case CR_OP_XOR: is_in = (a_idx & 1) ^ (b_idx & 1); break; default: abort(); } if (is_in != (cr->len & 1)) { if (cr_add_point(cr, v)) return -1; } } cr_compress(cr); return 0; } int cr_union1(CharRange *cr, const uint32_t *b_pt, int b_len) { CharRange a = *cr; int ret; cr->len = 0; cr->size = 0; cr->points = NULL; ret = cr_op(cr, a.points, a.len, b_pt, b_len, CR_OP_UNION); cr_free(&a); return ret; } int cr_invert(CharRange *cr) { int len; len = cr->len; if (cr_realloc(cr, len + 2)) return -1; memmove(cr->points + 1, cr->points, len * sizeof(cr->points[0])); cr->points[0] = 0; cr->points[len + 1] = UINT32_MAX; cr->len = len + 2; cr_compress(cr); return 0; } bool lre_is_id_start(uint32_t c) { return lre_is_in_table(c, unicode_prop_ID_Start_table, unicode_prop_ID_Start_index, sizeof(unicode_prop_ID_Start_index) / 3); } bool lre_is_id_continue(uint32_t c) { return lre_is_id_start(c) || lre_is_in_table(c, unicode_prop_ID_Continue1_table, unicode_prop_ID_Continue1_index, sizeof(unicode_prop_ID_Continue1_index) / 3); } bool lre_is_white_space(uint32_t c) { return lre_is_in_table(c, unicode_prop_White_Space_table, unicode_prop_White_Space_index, sizeof(unicode_prop_White_Space_index) / 3); } #define UNICODE_DECOMP_LEN_MAX 18 typedef enum { DECOMP_TYPE_C1, /* 16 bit char */ DECOMP_TYPE_L1, /* 16 bit char table */ DECOMP_TYPE_L2, DECOMP_TYPE_L3, DECOMP_TYPE_L4, DECOMP_TYPE_L5, /* XXX: not used */ DECOMP_TYPE_L6, /* XXX: could remove */ DECOMP_TYPE_L7, /* XXX: could remove */ DECOMP_TYPE_LL1, /* 18 bit char table */ DECOMP_TYPE_LL2, DECOMP_TYPE_S1, /* 8 bit char table */ DECOMP_TYPE_S2, DECOMP_TYPE_S3, DECOMP_TYPE_S4, DECOMP_TYPE_S5, DECOMP_TYPE_I1, /* increment 16 bit char value */ DECOMP_TYPE_I2_0, DECOMP_TYPE_I2_1, DECOMP_TYPE_I3_1, DECOMP_TYPE_I3_2, DECOMP_TYPE_I4_1, DECOMP_TYPE_I4_2, DECOMP_TYPE_B1, /* 16 bit base + 8 bit offset */ DECOMP_TYPE_B2, DECOMP_TYPE_B3, DECOMP_TYPE_B4, DECOMP_TYPE_B5, DECOMP_TYPE_B6, DECOMP_TYPE_B7, DECOMP_TYPE_B8, DECOMP_TYPE_B18, DECOMP_TYPE_LS2, DECOMP_TYPE_PAT3, DECOMP_TYPE_S2_UL, DECOMP_TYPE_LS2_UL, } DecompTypeEnum; static uint32_t unicode_get_short_code(uint32_t c) { static const uint16_t unicode_short_table[2] = { 0x2044, 0x2215 }; if (c < 0x80) return c; else if (c < 0x80 + 0x50) return c - 0x80 + 0x300; else return unicode_short_table[c - 0x80 - 0x50]; } static uint32_t unicode_get_lower_simple(uint32_t c) { if (c < 0x100 || (c >= 0x410 && c <= 0x42f)) c += 0x20; else c++; return c; } static uint16_t unicode_get16(const uint8_t *p) { return p[0] | (p[1] << 8); } static int unicode_decomp_entry(uint32_t *res, uint32_t c, int idx, uint32_t code, uint32_t len, uint32_t type) { uint32_t c1; int l, i, p; const uint8_t *d; if (type == DECOMP_TYPE_C1) { res[0] = unicode_decomp_table2[idx]; return 1; } else { d = unicode_decomp_data + unicode_decomp_table2[idx]; switch(type) { case DECOMP_TYPE_L1: case DECOMP_TYPE_L2: case DECOMP_TYPE_L3: case DECOMP_TYPE_L4: case DECOMP_TYPE_L5: case DECOMP_TYPE_L6: case DECOMP_TYPE_L7: l = type - DECOMP_TYPE_L1 + 1; d += (c - code) * l * 2; for(i = 0; i < l; i++) { if ((res[i] = unicode_get16(d + 2 * i)) == 0) return 0; } return l; case DECOMP_TYPE_LL1: case DECOMP_TYPE_LL2: { uint32_t k, p; l = type - DECOMP_TYPE_LL1 + 1; k = (c - code) * l; p = len * l * 2; for(i = 0; i < l; i++) { c1 = unicode_get16(d + 2 * k) | (((d[p + (k / 4)] >> ((k % 4) * 2)) & 3) << 16); if (!c1) return 0; res[i] = c1; k++; } } return l; case DECOMP_TYPE_S1: case DECOMP_TYPE_S2: case DECOMP_TYPE_S3: case DECOMP_TYPE_S4: case DECOMP_TYPE_S5: l = type - DECOMP_TYPE_S1 + 1; d += (c - code) * l; for(i = 0; i < l; i++) { if ((res[i] = unicode_get_short_code(d[i])) == 0) return 0; } return l; case DECOMP_TYPE_I1: l = 1; p = 0; goto decomp_type_i; case DECOMP_TYPE_I2_0: case DECOMP_TYPE_I2_1: case DECOMP_TYPE_I3_1: case DECOMP_TYPE_I3_2: case DECOMP_TYPE_I4_1: case DECOMP_TYPE_I4_2: l = 2 + ((type - DECOMP_TYPE_I2_0) >> 1); p = ((type - DECOMP_TYPE_I2_0) & 1) + (l > 2); decomp_type_i: for(i = 0; i < l; i++) { c1 = unicode_get16(d + 2 * i); if (i == p) c1 += c - code; res[i] = c1; } return l; case DECOMP_TYPE_B18: l = 18; goto decomp_type_b; case DECOMP_TYPE_B1: case DECOMP_TYPE_B2: case DECOMP_TYPE_B3: case DECOMP_TYPE_B4: case DECOMP_TYPE_B5: case DECOMP_TYPE_B6: case DECOMP_TYPE_B7: case DECOMP_TYPE_B8: l = type - DECOMP_TYPE_B1 + 1; decomp_type_b: { uint32_t c_min; c_min = unicode_get16(d); d += 2 + (c - code) * l; for(i = 0; i < l; i++) { c1 = d[i]; if (c1 == 0xff) c1 = 0x20; else c1 += c_min; res[i] = c1; } } return l; case DECOMP_TYPE_LS2: d += (c - code) * 3; if (!(res[0] = unicode_get16(d))) return 0; res[1] = unicode_get_short_code(d[2]); return 2; case DECOMP_TYPE_PAT3: res[0] = unicode_get16(d); res[2] = unicode_get16(d + 2); d += 4 + (c - code) * 2; res[1] = unicode_get16(d); return 3; case DECOMP_TYPE_S2_UL: case DECOMP_TYPE_LS2_UL: c1 = c - code; if (type == DECOMP_TYPE_S2_UL) { d += c1 & ~1; c = unicode_get_short_code(*d); d++; } else { d += (c1 >> 1) * 3; c = unicode_get16(d); d += 2; } if (c1 & 1) c = unicode_get_lower_simple(c); res[0] = c; res[1] = unicode_get_short_code(*d); return 2; } } return 0; } /* return the length of the decomposition (length <= UNICODE_DECOMP_LEN_MAX) or 0 if no decomposition */ static int unicode_decomp_char(uint32_t *res, uint32_t c, bool is_compat1) { uint32_t v, type, is_compat, code, len; int idx_min, idx_max, idx; idx_min = 0; idx_max = countof(unicode_decomp_table1) - 1; while (idx_min <= idx_max) { idx = (idx_max + idx_min) / 2; v = unicode_decomp_table1[idx]; code = v >> (32 - 18); len = (v >> (32 - 18 - 7)) & 0x7f; // printf("idx=%d code=%05x len=%d\n", idx, code, len); if (c < code) { idx_max = idx - 1; } else if (c >= code + len) { idx_min = idx + 1; } else { is_compat = v & 1; if (is_compat1 < is_compat) break; type = (v >> (32 - 18 - 7 - 6)) & 0x3f; return unicode_decomp_entry(res, c, idx, code, len, type); } } return 0; } /* return 0 if no pair found */ static int unicode_compose_pair(uint32_t c0, uint32_t c1) { uint32_t code, len, type, v, idx1, d_idx, d_offset, ch; int idx_min, idx_max, idx, d; uint32_t pair[2]; idx_min = 0; idx_max = countof(unicode_comp_table) - 1; while (idx_min <= idx_max) { idx = (idx_max + idx_min) / 2; idx1 = unicode_comp_table[idx]; /* idx1 represent an entry of the decomposition table */ d_idx = idx1 >> 6; d_offset = idx1 & 0x3f; v = unicode_decomp_table1[d_idx]; code = v >> (32 - 18); len = (v >> (32 - 18 - 7)) & 0x7f; type = (v >> (32 - 18 - 7 - 6)) & 0x3f; ch = code + d_offset; unicode_decomp_entry(pair, ch, d_idx, code, len, type); d = c0 - pair[0]; if (d == 0) d = c1 - pair[1]; if (d < 0) { idx_max = idx - 1; } else if (d > 0) { idx_min = idx + 1; } else { return ch; } } return 0; } /* return the combining class of character c (between 0 and 255) */ static int unicode_get_cc(uint32_t c) { uint32_t code, n, type, cc, c1, b; int pos; const uint8_t *p; pos = get_index_pos(&code, c, unicode_cc_index, sizeof(unicode_cc_index) / 3); if (pos < 0) return 0; p = unicode_cc_table + pos; for(;;) { b = *p++; type = b >> 6; n = b & 0x3f; if (n < 48) { } else if (n < 56) { n = (n - 48) << 8; n |= *p++; n += 48; } else { n = (n - 56) << 8; n |= *p++ << 8; n |= *p++; n += 48 + (1 << 11); } if (type <= 1) p++; c1 = code + n + 1; if (c < c1) { switch(type) { case 0: cc = p[-1]; break; case 1: cc = p[-1] + c - code; break; case 2: cc = 0; break; default: case 3: cc = 230; break; } return cc; } code = c1; } } static void sort_cc(int *buf, int len) { int i, j, k, cc, cc1, start, ch1; for(i = 0; i < len; i++) { cc = unicode_get_cc(buf[i]); if (cc != 0) { start = i; j = i + 1; while (j < len) { ch1 = buf[j]; cc1 = unicode_get_cc(ch1); if (cc1 == 0) break; k = j - 1; while (k >= start) { if (unicode_get_cc(buf[k]) <= cc1) break; buf[k + 1] = buf[k]; k--; } buf[k + 1] = ch1; j++; } i = j; } } } static void to_nfd_rec(DynBuf *dbuf, const int *src, int src_len, int is_compat) { uint32_t c, v; int i, l; uint32_t res[UNICODE_DECOMP_LEN_MAX]; for(i = 0; i < src_len; i++) { c = src[i]; if (c >= 0xac00 && c < 0xd7a4) { /* Hangul decomposition */ c -= 0xac00; dbuf_put_u32(dbuf, 0x1100 + c / 588); dbuf_put_u32(dbuf, 0x1161 + (c % 588) / 28); v = c % 28; if (v != 0) dbuf_put_u32(dbuf, 0x11a7 + v); } else { l = unicode_decomp_char(res, c, is_compat); if (l) { to_nfd_rec(dbuf, (int *)res, l, is_compat); } else { dbuf_put_u32(dbuf, c); } } } } /* return 0 if not found */ static int compose_pair(uint32_t c0, uint32_t c1) { /* Hangul composition */ if (c0 >= 0x1100 && c0 < 0x1100 + 19 && c1 >= 0x1161 && c1 < 0x1161 + 21) { return 0xac00 + (c0 - 0x1100) * 588 + (c1 - 0x1161) * 28; } else if (c0 >= 0xac00 && c0 < 0xac00 + 11172 && (c0 - 0xac00) % 28 == 0 && c1 >= 0x11a7 && c1 < 0x11a7 + 28) { return c0 + c1 - 0x11a7; } else { return unicode_compose_pair(c0, c1); } } int unicode_normalize(uint32_t **pdst, const uint32_t *src, int src_len, UnicodeNormalizationEnum n_type, void *opaque, DynBufReallocFunc *realloc_func) { int *buf, buf_len, i, p, starter_pos, cc, last_cc, out_len; bool is_compat; DynBuf dbuf_s, *dbuf = &dbuf_s; is_compat = n_type >> 1; dbuf_init2(dbuf, opaque, realloc_func); if (dbuf_realloc(dbuf, sizeof(int) * src_len)) goto fail; /* common case: latin1 is unaffected by NFC */ if (n_type == UNICODE_NFC) { for(i = 0; i < src_len; i++) { if (src[i] >= 0x100) goto not_latin1; } buf = (int *)dbuf->buf; memcpy(buf, src, src_len * sizeof(int)); *pdst = (uint32_t *)buf; return src_len; not_latin1: ; } to_nfd_rec(dbuf, (const int *)src, src_len, is_compat); if (dbuf_error(dbuf)) { fail: *pdst = NULL; return -1; } buf = (int *)dbuf->buf; buf_len = dbuf->size / sizeof(int); sort_cc(buf, buf_len); if (buf_len <= 1 || (n_type & 1) != 0) { /* NFD / NFKD */ *pdst = (uint32_t *)buf; return buf_len; } i = 1; out_len = 1; while (i < buf_len) { /* find the starter character and test if it is blocked from the character at 'i' */ last_cc = unicode_get_cc(buf[i]); starter_pos = out_len - 1; while (starter_pos >= 0) { cc = unicode_get_cc(buf[starter_pos]); if (cc == 0) break; if (cc >= last_cc) goto next; last_cc = 256; starter_pos--; } if (starter_pos >= 0 && (p = compose_pair(buf[starter_pos], buf[i])) != 0) { buf[starter_pos] = p; i++; } else { next: buf[out_len++] = buf[i++]; } } *pdst = (uint32_t *)buf; return out_len; } /* char ranges for various unicode properties */ static int unicode_find_name(const char *name_table, const char *name) { const char *p, *r; int pos; size_t name_len, len; p = name_table; pos = 0; name_len = strlen(name); while (*p) { for(;;) { r = strchr(p, ','); if (!r) len = strlen(p); else len = r - p; if (len == name_len && !memcmp(p, name, name_len)) return pos; p += len + 1; if (!r) break; } pos++; } return -1; } /* 'cr' must be initialized and empty. Return 0 if OK, -1 if error, -2 if not found */ int unicode_script(CharRange *cr, const char *script_name, bool is_ext) { int script_idx; const uint8_t *p, *p_end; uint32_t c, c1, b, n, v, v_len, i, type; CharRange cr1_s = { 0 }, *cr1 = NULL; CharRange cr2_s = { 0 }, *cr2 = &cr2_s; bool is_common; script_idx = unicode_find_name(unicode_script_name_table, script_name); if (script_idx < 0) return -2; /* Note: we remove the "Unknown" Script */ script_idx += UNICODE_SCRIPT_Unknown + 1; is_common = (script_idx == UNICODE_SCRIPT_Common || script_idx == UNICODE_SCRIPT_Inherited); if (is_ext) { cr1 = &cr1_s; cr_init(cr1, cr->mem_opaque, cr->realloc_func); cr_init(cr2, cr->mem_opaque, cr->realloc_func); } else { cr1 = cr; } p = unicode_script_table; p_end = unicode_script_table + countof(unicode_script_table); c = 0; while (p < p_end) { b = *p++; type = b >> 7; n = b & 0x7f; if (n < 96) { } else if (n < 112) { n = (n - 96) << 8; n |= *p++; n += 96; } else { n = (n - 112) << 16; n |= *p++ << 8; n |= *p++; n += 96 + (1 << 12); } if (type == 0) v = 0; else v = *p++; c1 = c + n + 1; if (v == script_idx) { if (cr_add_interval(cr1, c, c1)) goto fail; } c = c1; } if (is_ext) { /* add the script extensions */ p = unicode_script_ext_table; p_end = unicode_script_ext_table + countof(unicode_script_ext_table); c = 0; while (p < p_end) { b = *p++; if (b < 128) { n = b; } else if (b < 128 + 64) { n = (b - 128) << 8; n |= *p++; n += 128; } else { n = (b - 128 - 64) << 16; n |= *p++ << 8; n |= *p++; n += 128 + (1 << 14); } c1 = c + n + 1; v_len = *p++; if (is_common) { if (v_len != 0) { if (cr_add_interval(cr2, c, c1)) goto fail; } } else { for(i = 0; i < v_len; i++) { if (p[i] == script_idx) { if (cr_add_interval(cr2, c, c1)) goto fail; break; } } } p += v_len; c = c1; } if (is_common) { /* remove all the characters with script extensions */ if (cr_invert(cr2)) goto fail; if (cr_op(cr, cr1->points, cr1->len, cr2->points, cr2->len, CR_OP_INTER)) goto fail; } else { if (cr_op(cr, cr1->points, cr1->len, cr2->points, cr2->len, CR_OP_UNION)) goto fail; } cr_free(cr1); cr_free(cr2); } return 0; fail: if (is_ext) { cr_free(cr1); cr_free(cr2); } goto fail; } #define M(id) (1U << UNICODE_GC_ ## id) static int unicode_general_category1(CharRange *cr, uint32_t gc_mask) { const uint8_t *p, *p_end; uint32_t c, c0, b, n, v; p = unicode_gc_table; p_end = unicode_gc_table + countof(unicode_gc_table); c = 0; while (p < p_end) { b = *p++; n = b >> 5; v = b & 0x1f; if (n == 7) { n = *p++; if (n < 128) { n += 7; } else if (n < 128 + 64) { n = (n - 128) << 8; n |= *p++; n += 7 + 128; } else { n = (n - 128 - 64) << 16; n |= *p++ << 8; n |= *p++; n += 7 + 128 + (1 << 14); } } c0 = c; c += n + 1; if (v == 31) { /* run of Lu / Ll */ b = gc_mask & (M(Lu) | M(Ll)); if (b != 0) { if (b == (M(Lu) | M(Ll))) { goto add_range; } else { c0 += ((gc_mask & M(Ll)) != 0); for(; c0 < c; c0 += 2) { if (cr_add_interval(cr, c0, c0 + 1)) return -1; } } } } else if ((gc_mask >> v) & 1) { add_range: if (cr_add_interval(cr, c0, c)) return -1; } } return 0; } static int unicode_prop1(CharRange *cr, int prop_idx) { const uint8_t *p, *p_end; uint32_t c, c0, b, bit; p = unicode_prop_table[prop_idx]; p_end = p + unicode_prop_len_table[prop_idx]; c = 0; bit = 0; while (p < p_end) { c0 = c; b = *p++; if (b < 64) { c += (b >> 3) + 1; if (bit) { if (cr_add_interval(cr, c0, c)) return -1; } bit ^= 1; c0 = c; c += (b & 7) + 1; } else if (b >= 0x80) { c += b - 0x80 + 1; } else if (b < 0x60) { c += (((b - 0x40) << 8) | p[0]) + 1; p++; } else { c += (((b - 0x60) << 16) | (p[0] << 8) | p[1]) + 1; p += 2; } if (bit) { if (cr_add_interval(cr, c0, c)) return -1; } bit ^= 1; } return 0; } #define CASE_U (1 << 0) #define CASE_L (1 << 1) #define CASE_F (1 << 2) /* use the case conversion table to generate range of characters. CASE_U: set char if modified by uppercasing, CASE_L: set char if modified by lowercasing, CASE_F: set char if modified by case folding, */ static int unicode_case1(CharRange *cr, int case_mask) { #define MR(x) (1 << RUN_TYPE_ ## x) const uint32_t tab_run_mask[3] = { MR(U) | MR(UF) | MR(UL) | MR(LSU) | MR(U2L_399_EXT2) | MR(UF_D20) | MR(UF_D1_EXT) | MR(U_EXT) | MR(UF_EXT2) | MR(UF_EXT3), MR(L) | MR(LF) | MR(UL) | MR(LSU) | MR(U2L_399_EXT2) | MR(LF_EXT) | MR(LF_EXT2), MR(UF) | MR(LF) | MR(UL) | MR(LSU) | MR(U2L_399_EXT2) | MR(LF_EXT) | MR(LF_EXT2) | MR(UF_D20) | MR(UF_D1_EXT) | MR(LF_EXT) | MR(UF_EXT2) | MR(UF_EXT3), }; #undef MR uint32_t mask, v, code, type, len, i, idx; if (case_mask == 0) return 0; mask = 0; for(i = 0; i < 3; i++) { if ((case_mask >> i) & 1) mask |= tab_run_mask[i]; } for(idx = 0; idx < countof(case_conv_table1); idx++) { v = case_conv_table1[idx]; type = (v >> (32 - 17 - 7 - 4)) & 0xf; code = v >> (32 - 17); len = (v >> (32 - 17 - 7)) & 0x7f; if ((mask >> type) & 1) { // printf("%d: type=%d %04x %04x\n", idx, type, code, code + len - 1); switch(type) { case RUN_TYPE_UL: if ((case_mask & CASE_U) && (case_mask & (CASE_L | CASE_F))) goto def_case; code += ((case_mask & CASE_U) != 0); for(i = 0; i < len; i += 2) { if (cr_add_interval(cr, code + i, code + i + 1)) return -1; } break; case RUN_TYPE_LSU: if ((case_mask & CASE_U) && (case_mask & (CASE_L | CASE_F))) goto def_case; if (!(case_mask & CASE_U)) { if (cr_add_interval(cr, code, code + 1)) return -1; } if (cr_add_interval(cr, code + 1, code + 2)) return -1; if (case_mask & CASE_U) { if (cr_add_interval(cr, code + 2, code + 3)) return -1; } break; default: def_case: if (cr_add_interval(cr, code, code + len)) return -1; break; } } } return 0; } static int point_cmp(const void *p1, const void *p2, void *arg) { uint32_t v1 = *(uint32_t *)p1; uint32_t v2 = *(uint32_t *)p2; return (v1 > v2) - (v1 < v2); } static void cr_sort_and_remove_overlap(CharRange *cr) { uint32_t start, end, start1, end1, i, j; /* the resulting ranges are not necessarily sorted and may overlap */ rqsort(cr->points, cr->len / 2, sizeof(cr->points[0]) * 2, point_cmp, NULL); j = 0; for(i = 0; i < cr->len; ) { start = cr->points[i]; end = cr->points[i + 1]; i += 2; while (i < cr->len) { start1 = cr->points[i]; end1 = cr->points[i + 1]; if (start1 > end) { /* |------| * |-------| */ break; } else if (end1 <= end) { /* |------| * |--| */ i += 2; } else { /* |------| * |-------| */ end = end1; i += 2; } } cr->points[j] = start; cr->points[j + 1] = end; j += 2; } cr->len = j; } /* canonicalize a character set using the JS regex case folding rules (see lre_canonicalize()) */ int cr_regexp_canonicalize(CharRange *cr, bool is_unicode) { CharRange cr_inter, cr_mask, cr_result, cr_sub; uint32_t v, code, len, i, idx, start, end, c, d_start, d_end, d; cr_init(&cr_mask, cr->mem_opaque, cr->realloc_func); cr_init(&cr_inter, cr->mem_opaque, cr->realloc_func); cr_init(&cr_result, cr->mem_opaque, cr->realloc_func); cr_init(&cr_sub, cr->mem_opaque, cr->realloc_func); if (unicode_case1(&cr_mask, is_unicode ? CASE_F : CASE_U)) goto fail; if (cr_op(&cr_inter, cr_mask.points, cr_mask.len, cr->points, cr->len, CR_OP_INTER)) goto fail; if (cr_invert(&cr_mask)) goto fail; if (cr_op(&cr_sub, cr_mask.points, cr_mask.len, cr->points, cr->len, CR_OP_INTER)) goto fail; /* cr_inter = cr & cr_mask */ /* cr_sub = cr & ~cr_mask */ /* use the case conversion table to compute the result */ d_start = -1; d_end = -1; idx = 0; v = case_conv_table1[idx]; code = v >> (32 - 17); len = (v >> (32 - 17 - 7)) & 0x7f; for(i = 0; i < cr_inter.len; i += 2) { start = cr_inter.points[i]; end = cr_inter.points[i + 1]; for(c = start; c < end; c++) { for(;;) { if (c >= code && c < code + len) break; idx++; assert(idx < countof(case_conv_table1)); v = case_conv_table1[idx]; code = v >> (32 - 17); len = (v >> (32 - 17 - 7)) & 0x7f; } d = lre_case_folding_entry(c, idx, v, is_unicode); /* try to merge with the current interval */ if (d_start == -1) { d_start = d; d_end = d + 1; } else if (d_end == d) { d_end++; } else { cr_add_interval(&cr_result, d_start, d_end); d_start = d; d_end = d + 1; } } } if (d_start != -1) { if (cr_add_interval(&cr_result, d_start, d_end)) goto fail; } /* the resulting ranges are not necessarily sorted and may overlap */ cr_sort_and_remove_overlap(&cr_result); /* or with the character not affected by the case folding */ cr->len = 0; if (cr_op(cr, cr_result.points, cr_result.len, cr_sub.points, cr_sub.len, CR_OP_UNION)) goto fail; cr_free(&cr_inter); cr_free(&cr_mask); cr_free(&cr_result); cr_free(&cr_sub); return 0; fail: cr_free(&cr_inter); cr_free(&cr_mask); cr_free(&cr_result); cr_free(&cr_sub); return -1; } typedef enum { POP_GC, POP_PROP, POP_CASE, POP_UNION, POP_INTER, POP_XOR, POP_INVERT, POP_END, } PropOPEnum; #define POP_STACK_LEN_MAX 4 static int unicode_prop_ops(CharRange *cr, ...) { va_list ap; CharRange stack[POP_STACK_LEN_MAX]; int stack_len, op, ret, i; uint32_t a; va_start(ap, cr); stack_len = 0; for(;;) { op = va_arg(ap, int); switch(op) { case POP_GC: assert(stack_len < POP_STACK_LEN_MAX); a = va_arg(ap, int); cr_init(&stack[stack_len++], cr->mem_opaque, cr->realloc_func); if (unicode_general_category1(&stack[stack_len - 1], a)) goto fail; break; case POP_PROP: assert(stack_len < POP_STACK_LEN_MAX); a = va_arg(ap, int); cr_init(&stack[stack_len++], cr->mem_opaque, cr->realloc_func); if (unicode_prop1(&stack[stack_len - 1], a)) goto fail; break; case POP_CASE: assert(stack_len < POP_STACK_LEN_MAX); a = va_arg(ap, int); cr_init(&stack[stack_len++], cr->mem_opaque, cr->realloc_func); if (unicode_case1(&stack[stack_len - 1], a)) goto fail; break; case POP_UNION: case POP_INTER: case POP_XOR: { CharRange *cr1, *cr2, *cr3; assert(stack_len >= 2); assert(stack_len < POP_STACK_LEN_MAX); cr1 = &stack[stack_len - 2]; cr2 = &stack[stack_len - 1]; cr3 = &stack[stack_len++]; cr_init(cr3, cr->mem_opaque, cr->realloc_func); if (cr_op(cr3, cr1->points, cr1->len, cr2->points, cr2->len, op - POP_UNION + CR_OP_UNION)) goto fail; cr_free(cr1); cr_free(cr2); *cr1 = *cr3; stack_len -= 2; } break; case POP_INVERT: assert(stack_len >= 1); if (cr_invert(&stack[stack_len - 1])) goto fail; break; case POP_END: goto done; default: abort(); } } done: va_end(ap); assert(stack_len == 1); ret = cr_copy(cr, &stack[0]); cr_free(&stack[0]); return ret; fail: va_end(ap); for(i = 0; i < stack_len; i++) cr_free(&stack[i]); return -1; } static const uint32_t unicode_gc_mask_table[] = { M(Lu) | M(Ll) | M(Lt), /* LC */ M(Lu) | M(Ll) | M(Lt) | M(Lm) | M(Lo), /* L */ M(Mn) | M(Mc) | M(Me), /* M */ M(Nd) | M(Nl) | M(No), /* N */ M(Sm) | M(Sc) | M(Sk) | M(So), /* S */ M(Pc) | M(Pd) | M(Ps) | M(Pe) | M(Pi) | M(Pf) | M(Po), /* P */ M(Zs) | M(Zl) | M(Zp), /* Z */ M(Cc) | M(Cf) | M(Cs) | M(Co) | M(Cn), /* C */ }; /* 'cr' must be initialized and empty. Return 0 if OK, -1 if error, -2 if not found */ int unicode_general_category(CharRange *cr, const char *gc_name) { int gc_idx; uint32_t gc_mask; gc_idx = unicode_find_name(unicode_gc_name_table, gc_name); if (gc_idx < 0) return -2; if (gc_idx <= UNICODE_GC_Co) { gc_mask = (uint64_t)1 << gc_idx; } else { gc_mask = unicode_gc_mask_table[gc_idx - UNICODE_GC_LC]; } return unicode_general_category1(cr, gc_mask); } /* 'cr' must be initialized and empty. Return 0 if OK, -1 if error, -2 if not found */ int unicode_prop(CharRange *cr, const char *prop_name) { int prop_idx, ret; prop_idx = unicode_find_name(unicode_prop_name_table, prop_name); if (prop_idx < 0) return -2; prop_idx += UNICODE_PROP_ASCII_Hex_Digit; ret = 0; switch(prop_idx) { case UNICODE_PROP_ASCII: if (cr_add_interval(cr, 0x00, 0x7f + 1)) return -1; break; case UNICODE_PROP_Any: if (cr_add_interval(cr, 0x00000, 0x10ffff + 1)) return -1; break; case UNICODE_PROP_Assigned: ret = unicode_prop_ops(cr, POP_GC, M(Cn), POP_INVERT, POP_END); break; case UNICODE_PROP_Math: ret = unicode_prop_ops(cr, POP_GC, M(Sm), POP_PROP, UNICODE_PROP_Other_Math, POP_UNION, POP_END); break; case UNICODE_PROP_Lowercase: ret = unicode_prop_ops(cr, POP_GC, M(Ll), POP_PROP, UNICODE_PROP_Other_Lowercase, POP_UNION, POP_END); break; case UNICODE_PROP_Uppercase: ret = unicode_prop_ops(cr, POP_GC, M(Lu), POP_PROP, UNICODE_PROP_Other_Uppercase, POP_UNION, POP_END); break; case UNICODE_PROP_Cased: ret = unicode_prop_ops(cr, POP_GC, M(Lu) | M(Ll) | M(Lt), POP_PROP, UNICODE_PROP_Other_Uppercase, POP_UNION, POP_PROP, UNICODE_PROP_Other_Lowercase, POP_UNION, POP_END); break; case UNICODE_PROP_Alphabetic: ret = unicode_prop_ops(cr, POP_GC, M(Lu) | M(Ll) | M(Lt) | M(Lm) | M(Lo) | M(Nl), POP_PROP, UNICODE_PROP_Other_Uppercase, POP_UNION, POP_PROP, UNICODE_PROP_Other_Lowercase, POP_UNION, POP_PROP, UNICODE_PROP_Other_Alphabetic, POP_UNION, POP_END); break; case UNICODE_PROP_Grapheme_Base: ret = unicode_prop_ops(cr, POP_GC, M(Cc) | M(Cf) | M(Cs) | M(Co) | M(Cn) | M(Zl) | M(Zp) | M(Me) | M(Mn), POP_PROP, UNICODE_PROP_Other_Grapheme_Extend, POP_UNION, POP_INVERT, POP_END); break; case UNICODE_PROP_Grapheme_Extend: ret = unicode_prop_ops(cr, POP_GC, M(Me) | M(Mn), POP_PROP, UNICODE_PROP_Other_Grapheme_Extend, POP_UNION, POP_END); break; case UNICODE_PROP_XID_Start: ret = unicode_prop_ops(cr, POP_GC, M(Lu) | M(Ll) | M(Lt) | M(Lm) | M(Lo) | M(Nl), POP_PROP, UNICODE_PROP_Other_ID_Start, POP_UNION, POP_PROP, UNICODE_PROP_Pattern_Syntax, POP_PROP, UNICODE_PROP_Pattern_White_Space, POP_UNION, POP_PROP, UNICODE_PROP_XID_Start1, POP_UNION, POP_INVERT, POP_INTER, POP_END); break; case UNICODE_PROP_XID_Continue: ret = unicode_prop_ops(cr, POP_GC, M(Lu) | M(Ll) | M(Lt) | M(Lm) | M(Lo) | M(Nl) | M(Mn) | M(Mc) | M(Nd) | M(Pc), POP_PROP, UNICODE_PROP_Other_ID_Start, POP_UNION, POP_PROP, UNICODE_PROP_Other_ID_Continue, POP_UNION, POP_PROP, UNICODE_PROP_Pattern_Syntax, POP_PROP, UNICODE_PROP_Pattern_White_Space, POP_UNION, POP_PROP, UNICODE_PROP_XID_Continue1, POP_UNION, POP_INVERT, POP_INTER, POP_END); break; case UNICODE_PROP_Changes_When_Uppercased: ret = unicode_case1(cr, CASE_U); break; case UNICODE_PROP_Changes_When_Lowercased: ret = unicode_case1(cr, CASE_L); break; case UNICODE_PROP_Changes_When_Casemapped: ret = unicode_case1(cr, CASE_U | CASE_L | CASE_F); break; case UNICODE_PROP_Changes_When_Titlecased: ret = unicode_prop_ops(cr, POP_CASE, CASE_U, POP_PROP, UNICODE_PROP_Changes_When_Titlecased1, POP_XOR, POP_END); break; case UNICODE_PROP_Changes_When_Casefolded: ret = unicode_prop_ops(cr, POP_CASE, CASE_F, POP_PROP, UNICODE_PROP_Changes_When_Casefolded1, POP_XOR, POP_END); break; case UNICODE_PROP_Changes_When_NFKC_Casefolded: ret = unicode_prop_ops(cr, POP_CASE, CASE_F, POP_PROP, UNICODE_PROP_Changes_When_NFKC_Casefolded1, POP_XOR, POP_END); break; /* we use the existing tables */ case UNICODE_PROP_ID_Continue: ret = unicode_prop_ops(cr, POP_PROP, UNICODE_PROP_ID_Start, POP_PROP, UNICODE_PROP_ID_Continue1, POP_XOR, POP_END); break; default: if (prop_idx >= countof(unicode_prop_table)) return -2; ret = unicode_prop1(cr, prop_idx); break; } return ret; } qbs-src-3.2.0/src/shared/quickjs/quickjs.c0000644000175100017510000721074315154533055020043 0ustar runnerrunner/* * QuickJS Javascript Engine * * Copyright (c) 2017-2025 Fabrice Bellard * Copyright (c) 2017-2025 Charlie Gordon * Copyright (c) 2023-2025 Ben Noordhuis * Copyright (c) 2023-2025 Saúl Ibarra Corretgé * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include #include #include #include #include #if !defined(_MSC_VER) #include #if defined(_WIN32) #include #endif #endif #if defined(_WIN32) #include #endif #include #include #include #include "cutils.h" #include "list.h" #include "quickjs.h" #include "libregexp.h" #include "dtoa.h" #if defined(EMSCRIPTEN) || defined(_MSC_VER) #define DIRECT_DISPATCH 0 #else #define DIRECT_DISPATCH 1 #endif #if defined(__APPLE__) #define MALLOC_OVERHEAD 0 #else #define MALLOC_OVERHEAD 8 #endif #if defined(__NEWLIB__) #define NO_TM_GMTOFF #endif // atomic_store etc. are completely busted in recent versions of tcc; // somehow the compiler forgets to load |ptr| into %rdi when calling // the __atomic_*() helpers in its lib/stdatomic.c and lib/atomic.S #if !defined(__TINYC__) && !defined(EMSCRIPTEN) && !defined(__wasi__) && !__STDC_NO_ATOMICS__ #include "quickjs-c-atomics.h" #define CONFIG_ATOMICS #endif #ifndef __GNUC__ #define __extension__ #endif #ifndef NDEBUG #define ENABLE_DUMPS #endif //#define FORCE_GC_AT_MALLOC /* test the GC by forcing it before each object allocation */ #define check_dump_flag(rt, flag) ((rt->dump_flags & (flag +0)) == (flag +0)) #define STRINGIFY_(x) #x #define STRINGIFY(x) STRINGIFY_(x) #define QJS_VERSION_STRING \ STRINGIFY(QJS_VERSION_MAJOR) "." STRINGIFY(QJS_VERSION_MINOR) "." STRINGIFY(QJS_VERSION_PATCH) QJS_VERSION_SUFFIX const char* JS_GetVersion(void) { return QJS_VERSION_STRING; } #undef STRINFIGY_ #undef STRINGIFY static inline JSValueConst *vc(JSValue *vals) { return (JSValueConst *)vals; } static inline JSValue unsafe_unconst(JSValueConst v) { #ifdef JS_CHECK_JSVALUE return (JSValue)v; #else return v; #endif } static inline JSValueConst safe_const(JSValue v) { #ifdef JS_CHECK_JSVALUE return (JSValueConst)v; #else return v; #endif } enum { /* classid tag */ /* union usage | properties */ JS_CLASS_OBJECT = 1, /* must be first */ JS_CLASS_ARRAY, /* u.array | length */ JS_CLASS_ERROR, JS_CLASS_NUMBER, /* u.object_data */ JS_CLASS_STRING, /* u.object_data */ JS_CLASS_BOOLEAN, /* u.object_data */ JS_CLASS_SYMBOL, /* u.object_data */ JS_CLASS_ARGUMENTS, /* u.array | length */ JS_CLASS_MAPPED_ARGUMENTS, /* | length */ JS_CLASS_DATE, /* u.object_data */ JS_CLASS_MODULE_NS, JS_CLASS_C_FUNCTION, /* u.cfunc */ JS_CLASS_BYTECODE_FUNCTION, /* u.func */ JS_CLASS_BOUND_FUNCTION, /* u.bound_function */ JS_CLASS_C_FUNCTION_DATA, /* u.c_function_data_record */ JS_CLASS_GENERATOR_FUNCTION, /* u.func */ JS_CLASS_FOR_IN_ITERATOR, /* u.for_in_iterator */ JS_CLASS_REGEXP, /* u.regexp */ JS_CLASS_ARRAY_BUFFER, /* u.array_buffer */ JS_CLASS_SHARED_ARRAY_BUFFER, /* u.array_buffer */ JS_CLASS_UINT8C_ARRAY, /* u.array (typed_array) */ JS_CLASS_INT8_ARRAY, /* u.array (typed_array) */ JS_CLASS_UINT8_ARRAY, /* u.array (typed_array) */ JS_CLASS_INT16_ARRAY, /* u.array (typed_array) */ JS_CLASS_UINT16_ARRAY, /* u.array (typed_array) */ JS_CLASS_INT32_ARRAY, /* u.array (typed_array) */ JS_CLASS_UINT32_ARRAY, /* u.array (typed_array) */ JS_CLASS_BIG_INT64_ARRAY, /* u.array (typed_array) */ JS_CLASS_BIG_UINT64_ARRAY, /* u.array (typed_array) */ JS_CLASS_FLOAT16_ARRAY, /* u.array (typed_array) */ JS_CLASS_FLOAT32_ARRAY, /* u.array (typed_array) */ JS_CLASS_FLOAT64_ARRAY, /* u.array (typed_array) */ JS_CLASS_DATAVIEW, /* u.typed_array */ JS_CLASS_BIG_INT, /* u.object_data */ JS_CLASS_MAP, /* u.map_state */ JS_CLASS_SET, /* u.map_state */ JS_CLASS_WEAKMAP, /* u.map_state */ JS_CLASS_WEAKSET, /* u.map_state */ JS_CLASS_ITERATOR, JS_CLASS_ITERATOR_CONCAT, /* u.iterator_concat_data */ JS_CLASS_ITERATOR_HELPER, /* u.iterator_helper_data */ JS_CLASS_ITERATOR_WRAP, /* u.iterator_wrap_data */ JS_CLASS_MAP_ITERATOR, /* u.map_iterator_data */ JS_CLASS_SET_ITERATOR, /* u.map_iterator_data */ JS_CLASS_ARRAY_ITERATOR, /* u.array_iterator_data */ JS_CLASS_STRING_ITERATOR, /* u.array_iterator_data */ JS_CLASS_REGEXP_STRING_ITERATOR, /* u.regexp_string_iterator_data */ JS_CLASS_GENERATOR, /* u.generator_data */ JS_CLASS_PROXY, /* u.proxy_data */ JS_CLASS_PROMISE, /* u.promise_data */ JS_CLASS_PROMISE_RESOLVE_FUNCTION, /* u.promise_function_data */ JS_CLASS_PROMISE_REJECT_FUNCTION, /* u.promise_function_data */ JS_CLASS_ASYNC_FUNCTION, /* u.func */ JS_CLASS_ASYNC_FUNCTION_RESOLVE, /* u.async_function_data */ JS_CLASS_ASYNC_FUNCTION_REJECT, /* u.async_function_data */ JS_CLASS_ASYNC_FROM_SYNC_ITERATOR, /* u.async_from_sync_iterator_data */ JS_CLASS_ASYNC_GENERATOR_FUNCTION, /* u.func */ JS_CLASS_ASYNC_GENERATOR, /* u.async_generator_data */ JS_CLASS_WEAK_REF, JS_CLASS_FINALIZATION_REGISTRY, JS_CLASS_DOM_EXCEPTION, JS_CLASS_CALL_SITE, JS_CLASS_INIT_COUNT, /* last entry for predefined classes */ }; /* number of typed array types */ #define JS_TYPED_ARRAY_COUNT (JS_CLASS_FLOAT64_ARRAY - JS_CLASS_UINT8C_ARRAY + 1) static uint8_t const typed_array_size_log2[JS_TYPED_ARRAY_COUNT]; #define typed_array_size_log2(classid) (typed_array_size_log2[(classid)- JS_CLASS_UINT8C_ARRAY]) typedef enum JSErrorEnum { JS_EVAL_ERROR, JS_RANGE_ERROR, JS_REFERENCE_ERROR, JS_SYNTAX_ERROR, JS_TYPE_ERROR, JS_URI_ERROR, JS_INTERNAL_ERROR, JS_AGGREGATE_ERROR, JS_NATIVE_ERROR_COUNT, /* number of different NativeError objects */ JS_PLAIN_ERROR = JS_NATIVE_ERROR_COUNT } JSErrorEnum; #define JS_MAX_LOCAL_VARS 65535 #define JS_STACK_SIZE_MAX 65534 #define JS_STRING_LEN_MAX ((1 << 30) - 1) // 1,024 bytes is about the cutoff point where it starts getting // more profitable to ref slice than to copy #define JS_STRING_SLICE_LEN_MAX 1024 // in bytes #define __exception __attribute__((warn_unused_result)) typedef struct JSShape JSShape; typedef struct JSString JSString; typedef struct JSString JSAtomStruct; #define JS_VALUE_GET_STRING(v) ((JSString *)JS_VALUE_GET_PTR(v)) typedef enum { JS_GC_PHASE_NONE, JS_GC_PHASE_DECREF, JS_GC_PHASE_REMOVE_CYCLES, } JSGCPhaseEnum; typedef struct JSMallocState { size_t malloc_count; size_t malloc_size; size_t malloc_limit; void *opaque; /* user opaque */ } JSMallocState; typedef struct JSRuntimeFinalizerState { struct JSRuntimeFinalizerState *next; JSRuntimeFinalizer *finalizer; void *arg; } JSRuntimeFinalizerState; typedef struct JSValueLink { struct JSValueLink *next; JSValueConst value; } JSValueLink; struct JSRuntime { JSMallocFunctions mf; JSMallocState malloc_state; const char *rt_info; int atom_hash_size; /* power of two */ int atom_count; int atom_size; int atom_count_resize; /* resize hash table at this count */ uint32_t *atom_hash; JSAtomStruct **atom_array; int atom_free_index; /* 0 = none */ JSClassID js_class_id_alloc; /* counter for user defined classes */ int class_count; /* size of class_array */ JSClass *class_array; struct list_head context_list; /* list of JSContext.link */ /* list of JSGCObjectHeader.link. List of allocated GC objects (used by the garbage collector) */ struct list_head gc_obj_list; /* list of JSGCObjectHeader.link. Used during JS_FreeValueRT() */ struct list_head gc_zero_ref_count_list; struct list_head tmp_obj_list; /* used during GC */ JSGCPhaseEnum gc_phase : 8; size_t malloc_gc_threshold; #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS struct list_head string_list; /* list of JSString.link */ #endif /* stack limitation */ uintptr_t stack_size; /* in bytes, 0 if no limit */ uintptr_t stack_top; uintptr_t stack_limit; /* lower stack limit */ JSValue current_exception; /* true if inside an out of memory error, to avoid recursing */ bool in_out_of_memory; /* true if inside build_backtrace, to avoid recursing */ bool in_build_stack_trace; /* true if inside JS_FreeRuntime */ bool in_free; struct JSStackFrame *current_stack_frame; JSInterruptHandler *interrupt_handler; void *interrupt_opaque; JSPromiseHook *promise_hook; void *promise_hook_opaque; // for smuggling the parent promise from js_promise_then // to js_promise_constructor JSValueLink *parent_promise; JSHostPromiseRejectionTracker *host_promise_rejection_tracker; void *host_promise_rejection_tracker_opaque; struct list_head job_list; /* list of JSJobEntry.link */ JSModuleNormalizeFunc *module_normalize_func; JSModuleLoaderFunc *module_loader_func; void *module_loader_opaque; /* timestamp for internal use in module evaluation */ int64_t module_async_evaluation_next_timestamp; /* used to allocate, free and clone SharedArrayBuffers */ JSSharedArrayBufferFunctions sab_funcs; bool can_block; /* true if Atomics.wait can block */ uint32_t dump_flags : 24; /* Shape hash table */ int shape_hash_bits; int shape_hash_size; int shape_hash_count; /* number of hashed shapes */ JSShape **shape_hash; void *user_opaque; void *libc_opaque; JSRuntimeFinalizerState *finalizers; }; struct JSClass { uint32_t class_id; /* 0 means free entry */ JSAtom class_name; JSClassFinalizer *finalizer; JSClassGCMark *gc_mark; JSClassCall *call; /* pointers for exotic behavior, can be NULL if none are present */ const JSClassExoticMethods *exotic; }; typedef struct JSStackFrame { struct JSStackFrame *prev_frame; /* NULL if first stack frame */ JSValue cur_func; /* current function, JS_UNDEFINED if the frame is detached */ JSValue *arg_buf; /* arguments */ JSValue *var_buf; /* variables */ struct list_head var_ref_list; /* list of JSVarRef.link */ uint8_t *cur_pc; /* only used in bytecode functions : PC of the instruction after the call */ uint32_t arg_count : 31; uint32_t is_strict_mode : 1; /* only used in generators. Current stack pointer value. NULL if the function is running. */ JSValue *cur_sp; } JSStackFrame; typedef enum { JS_GC_OBJ_TYPE_JS_OBJECT, JS_GC_OBJ_TYPE_FUNCTION_BYTECODE, JS_GC_OBJ_TYPE_SHAPE, JS_GC_OBJ_TYPE_VAR_REF, JS_GC_OBJ_TYPE_ASYNC_FUNCTION, JS_GC_OBJ_TYPE_JS_CONTEXT, } JSGCObjectTypeEnum; /* header for GC objects. GC objects are C data structures with a reference count that can reference other GC objects. JS Objects are a particular type of GC object. */ struct JSGCObjectHeader { int ref_count; /* must come first, 32-bit */ JSGCObjectTypeEnum gc_obj_type : 4; uint8_t mark : 4; /* used by the GC */ uint8_t dummy1; /* not used by the GC */ uint16_t dummy2; /* not used by the GC */ struct list_head link; }; typedef struct JSVarRef { union { JSGCObjectHeader header; /* must come first */ struct { int __gc_ref_count; /* corresponds to header.ref_count */ uint8_t __gc_mark; /* corresponds to header.mark/gc_obj_type */ uint8_t is_detached; }; }; JSValue *pvalue; /* pointer to the value, either on the stack or to 'value' */ JSValue value; /* used when the variable is no longer on the stack */ } JSVarRef; typedef struct JSRefCountHeader { int ref_count; } JSRefCountHeader; /* bigint */ typedef int32_t js_slimb_t; typedef uint32_t js_limb_t; typedef int64_t js_sdlimb_t; typedef uint64_t js_dlimb_t; #define JS_LIMB_DIGITS 9 /* Must match the size of short_big_int in JSValueUnion */ #define JS_LIMB_BITS 32 #define JS_SHORT_BIG_INT_BITS JS_LIMB_BITS #define JS_BIGINT_MAX_SIZE ((1024 * 1024) / JS_LIMB_BITS) /* in limbs */ #define JS_SHORT_BIG_INT_MIN INT32_MIN #define JS_SHORT_BIG_INT_MAX INT32_MAX typedef struct JSBigInt { JSRefCountHeader header; /* must come first, 32-bit */ uint32_t len; /* number of limbs, >= 1 */ js_limb_t tab[]; /* two's complement representation, always normalized so that 'len' is the minimum possible length >= 1 */ } JSBigInt; /* this bigint structure can hold a 64 bit integer */ typedef struct { js_limb_t big_int_buf[sizeof(JSBigInt) / sizeof(js_limb_t)]; /* for JSBigInt */ /* must come just after */ js_limb_t tab[(64 + JS_LIMB_BITS - 1) / JS_LIMB_BITS]; } JSBigIntBuf; typedef enum { JS_AUTOINIT_ID_PROTOTYPE, JS_AUTOINIT_ID_MODULE_NS, JS_AUTOINIT_ID_PROP, JS_AUTOINIT_ID_BYTECODE, } JSAutoInitIDEnum; enum { JS_BUILTIN_ARRAY_FROMASYNC = 1, }; /* must be large enough to have a negligible runtime cost and small enough to call the interrupt callback often. */ #define JS_INTERRUPT_COUNTER_INIT 10000 struct JSContext { JSGCObjectHeader header; /* must come first */ JSRuntime *rt; struct list_head link; uint16_t binary_object_count; int binary_object_size; JSShape *array_shape; /* initial shape for Array objects */ JSValue *class_proto; JSValue function_proto; JSValue function_ctor; JSValue array_ctor; JSValue regexp_ctor; JSValue promise_ctor; JSValue native_error_proto[JS_NATIVE_ERROR_COUNT]; JSValue error_ctor; JSValue error_back_trace; JSValue error_prepare_stack; JSValue error_stack_trace_limit; JSValue iterator_ctor; JSValue iterator_ctor_getset; JSValue iterator_proto; JSValue async_iterator_proto; JSValue array_proto_values; JSValue throw_type_error; JSValue eval_obj; JSValue global_obj; /* global object */ JSValue global_var_obj; /* contains the global let/const definitions */ double time_origin; uint64_t random_state; /* when the counter reaches zero, JSRutime.interrupt_handler is called */ int interrupt_counter; struct list_head loaded_modules; /* list of JSModuleDef.link */ /* if NULL, RegExp compilation is not supported */ JSValue (*compile_regexp)(JSContext *ctx, JSValueConst pattern, JSValueConst flags); /* if NULL, eval is not supported */ JSValue (*eval_internal)(JSContext *ctx, JSValueConst this_obj, const char *input, size_t input_len, const char *filename, int line, int flags, int scope_idx); void *user_opaque; ScopeLookup *scopeLookup; FoundUndefinedHandler *handleUndefined; FunctionEnteredHandler *handleFunctionEntered; FunctionExitedHandler *handleFunctionExited; }; typedef union JSFloat64Union { double d; uint64_t u64; uint32_t u32[2]; } JSFloat64Union; typedef enum { JS_WEAK_REF_KIND_MAP, JS_WEAK_REF_KIND_WEAK_REF, JS_WEAK_REF_KIND_FINALIZATION_REGISTRY_ENTRY, } JSWeakRefKindEnum; typedef struct JSWeakRefRecord { JSWeakRefKindEnum kind; struct JSWeakRefRecord *next_weak_ref; union { struct JSMapRecord *map_record; struct JSWeakRefData *weak_ref_data; struct JSFinRecEntry *fin_rec_entry; } u; } JSWeakRefRecord; typedef struct JSMapRecord { int ref_count; /* used during enumeration to avoid freeing the record */ bool empty; /* true if the record is deleted */ struct JSMapState *map; struct list_head link; struct list_head hash_link; JSValue key; JSValue value; } JSMapRecord; typedef struct JSMapState { bool is_weak; /* true if WeakSet/WeakMap */ struct list_head records; /* list of JSMapRecord.link */ uint32_t record_count; struct list_head *hash_table; uint32_t hash_size; /* must be a power of two */ uint32_t record_count_threshold; /* count at which a hash table resize is needed */ } JSMapState; enum { JS_TO_STRING_IS_PROPERTY_KEY = 1 << 0, JS_TO_STRING_NO_SIDE_EFFECTS = 1 << 1, }; enum { JS_ATOM_TYPE_STRING = 1, JS_ATOM_TYPE_GLOBAL_SYMBOL, JS_ATOM_TYPE_SYMBOL, JS_ATOM_TYPE_PRIVATE, }; enum { JS_ATOM_HASH_SYMBOL, JS_ATOM_HASH_PRIVATE, }; typedef enum { JS_ATOM_KIND_STRING, JS_ATOM_KIND_SYMBOL, JS_ATOM_KIND_PRIVATE, } JSAtomKindEnum; typedef enum { JS_STRING_KIND_NORMAL, JS_STRING_KIND_SLICE, } JSStringKind; #define JS_ATOM_HASH_MASK ((1 << 29) - 1) struct JSString { JSRefCountHeader header; /* must come first, 32-bit */ uint32_t len : 31; uint8_t is_wide_char : 1; /* 0 = 8 bits, 1 = 16 bits characters */ /* for JS_ATOM_TYPE_SYMBOL: hash = 0, atom_type = 3, for JS_ATOM_TYPE_PRIVATE: hash = 1, atom_type = 3 XXX: could change encoding to have one more bit in hash */ uint32_t hash : 29; uint8_t kind : 1; uint8_t atom_type : 2; /* != 0 if atom, JS_ATOM_TYPE_x */ uint32_t hash_next; /* atom_index for JS_ATOM_TYPE_SYMBOL */ JSWeakRefRecord *first_weak_ref; #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS struct list_head link; /* string list */ #endif }; typedef struct JSStringSlice { JSString *parent; uint32_t start; // in bytes, not characters } JSStringSlice; static inline void *strv(JSString *p) { JSStringSlice *slice; switch (p->kind) { case JS_STRING_KIND_NORMAL: return (void *)&p[1]; case JS_STRING_KIND_SLICE: slice = (void *)&p[1]; return (char *)&slice->parent[1] + slice->start; } abort(); return NULL; } static inline uint8_t *str8(JSString *p) { return strv(p); } static inline uint16_t *str16(JSString *p) { return strv(p); } typedef struct JSClosureVar { uint8_t is_local : 1; uint8_t is_arg : 1; uint8_t is_const : 1; uint8_t is_lexical : 1; uint8_t var_kind : 4; /* see JSVarKindEnum */ /* 8 bits available */ uint16_t var_idx; /* is_local = true: index to a normal variable of the parent function. otherwise: index to a closure variable of the parent function */ JSAtom var_name; } JSClosureVar; #define ARG_SCOPE_INDEX 1 #define ARG_SCOPE_END (-2) typedef struct JSVarScope { int parent; /* index into fd->scopes of the enclosing scope */ int first; /* index into fd->vars of the last variable in this scope */ } JSVarScope; typedef enum { /* XXX: add more variable kinds here instead of using bit fields */ JS_VAR_NORMAL, JS_VAR_FUNCTION_DECL, /* lexical var with function declaration */ JS_VAR_NEW_FUNCTION_DECL, /* lexical var with async/generator function declaration */ JS_VAR_CATCH, JS_VAR_FUNCTION_NAME, /* function expression name */ JS_VAR_PRIVATE_FIELD, JS_VAR_PRIVATE_METHOD, JS_VAR_PRIVATE_GETTER, JS_VAR_PRIVATE_SETTER, /* must come after JS_VAR_PRIVATE_GETTER */ JS_VAR_PRIVATE_GETTER_SETTER, /* must come after JS_VAR_PRIVATE_SETTER */ } JSVarKindEnum; /* XXX: could use a different structure in bytecode functions to save memory */ typedef struct JSVarDef { JSAtom var_name; /* index into fd->scopes of this variable lexical scope */ int scope_level; /* during compilation: - if scope_level = 0: scope in which the variable is defined - if scope_level != 0: index into fd->vars of the next variable in the same or enclosing lexical scope in a bytecode function: index into fd->vars of the next variable in the same or enclosing lexical scope */ int scope_next; uint8_t is_const : 1; uint8_t is_lexical : 1; uint8_t is_captured : 1; uint8_t is_static_private : 1; /* only used during private class field parsing */ uint8_t var_kind : 4; /* see JSVarKindEnum */ /* only used during compilation: function pool index for lexical variables with var_kind = JS_VAR_FUNCTION_DECL/JS_VAR_NEW_FUNCTION_DECL or scope level of the definition of the 'var' variables (they have scope_level = 0) */ int func_pool_idx : 24; /* only used during compilation : index in the constant pool for hoisted function definition */ } JSVarDef; /* for the encoding of the pc2line table */ #define PC2LINE_BASE (-1) #define PC2LINE_RANGE 5 #define PC2LINE_OP_FIRST 1 #define PC2LINE_DIFF_PC_MAX ((255 - PC2LINE_OP_FIRST) / PC2LINE_RANGE) typedef enum JSFunctionKindEnum { JS_FUNC_NORMAL = 0, JS_FUNC_GENERATOR = (1 << 0), JS_FUNC_ASYNC = (1 << 1), JS_FUNC_ASYNC_GENERATOR = (JS_FUNC_GENERATOR | JS_FUNC_ASYNC), } JSFunctionKindEnum; typedef struct JSFunctionBytecode { JSGCObjectHeader header; /* must come first */ uint8_t is_strict_mode : 1; uint8_t has_prototype : 1; /* true if a prototype field is necessary */ uint8_t has_simple_parameter_list : 1; uint8_t is_derived_class_constructor : 1; /* true if home_object needs to be initialized */ uint8_t need_home_object : 1; uint8_t func_kind : 2; uint8_t new_target_allowed : 1; uint8_t super_call_allowed : 1; uint8_t super_allowed : 1; uint8_t arguments_allowed : 1; uint8_t backtrace_barrier : 1; /* stop backtrace on this function */ /* XXX: 5 bits available */ uint8_t *byte_code_buf; /* (self pointer) */ int byte_code_len; JSAtom func_name; JSVarDef *vardefs; /* arguments + local variables (arg_count + var_count) (self pointer) */ JSClosureVar *closure_var; /* list of variables in the closure (self pointer) */ uint16_t arg_count; uint16_t var_count; uint16_t defined_arg_count; /* for length function property */ uint16_t stack_size; /* maximum stack size */ JSContext *realm; /* function realm */ JSValue *cpool; /* constant pool (self pointer) */ int cpool_count; int closure_var_count; JSAtom filename; int line_num; int col_num; int source_len; int pc2line_len; uint8_t *pc2line_buf; char *source; } JSFunctionBytecode; typedef struct JSBoundFunction { JSValue func_obj; JSValue this_val; int argc; JSValue argv[]; } JSBoundFunction; typedef enum JSIteratorKindEnum { JS_ITERATOR_KIND_KEY, JS_ITERATOR_KIND_VALUE, JS_ITERATOR_KIND_KEY_AND_VALUE, } JSIteratorKindEnum; typedef enum JSIteratorHelperKindEnum { JS_ITERATOR_HELPER_KIND_DROP, JS_ITERATOR_HELPER_KIND_EVERY, JS_ITERATOR_HELPER_KIND_FILTER, JS_ITERATOR_HELPER_KIND_FIND, JS_ITERATOR_HELPER_KIND_FLAT_MAP, JS_ITERATOR_HELPER_KIND_FOR_EACH, JS_ITERATOR_HELPER_KIND_MAP, JS_ITERATOR_HELPER_KIND_SOME, JS_ITERATOR_HELPER_KIND_TAKE, } JSIteratorHelperKindEnum; typedef struct JSForInIterator { JSValue obj; bool is_array; uint32_t array_length; uint32_t idx; } JSForInIterator; typedef struct JSRegExp { JSString *pattern; JSString *bytecode; /* also contains the flags */ } JSRegExp; typedef struct JSProxyData { JSValue target; JSValue handler; uint8_t is_func; uint8_t is_revoked; } JSProxyData; typedef struct JSArrayBuffer { int byte_length; /* 0 if detached */ int max_byte_length; /* -1 if not resizable; >= byte_length otherwise */ uint8_t detached; uint8_t shared; /* if shared, the array buffer cannot be detached */ uint8_t *data; /* NULL if detached */ struct list_head array_list; void *opaque; JSFreeArrayBufferDataFunc *free_func; } JSArrayBuffer; typedef struct JSTypedArray { struct list_head link; /* link to arraybuffer */ JSObject *obj; /* back pointer to the TypedArray/DataView object */ JSObject *buffer; /* based array buffer */ uint32_t offset; /* byte offset in the array buffer */ uint32_t length; /* byte length in the array buffer */ bool track_rab; /* auto-track length of backing array buffer */ } JSTypedArray; typedef struct JSAsyncFunctionState { JSValue this_val; /* 'this' generator argument */ int argc; /* number of function arguments */ bool throw_flag; /* used to throw an exception in JS_CallInternal() */ JSStackFrame frame; } JSAsyncFunctionState; /* XXX: could use an object instead to avoid the JS_TAG_ASYNC_FUNCTION tag for the GC */ typedef struct JSAsyncFunctionData { JSGCObjectHeader header; /* must come first */ JSValue resolving_funcs[2]; bool is_active; /* true if the async function state is valid */ JSAsyncFunctionState func_state; } JSAsyncFunctionData; typedef struct JSReqModuleEntry { JSAtom module_name; JSModuleDef *module; /* used using resolution */ } JSReqModuleEntry; typedef enum JSExportTypeEnum { JS_EXPORT_TYPE_LOCAL, JS_EXPORT_TYPE_INDIRECT, } JSExportTypeEnum; typedef struct JSExportEntry { union { struct { int var_idx; /* closure variable index */ JSVarRef *var_ref; /* if != NULL, reference to the variable */ } local; /* for local export */ int req_module_idx; /* module for indirect export */ } u; JSExportTypeEnum export_type; JSAtom local_name; /* '*' if export ns from. not used for local export after compilation */ JSAtom export_name; /* exported variable name */ } JSExportEntry; typedef struct JSStarExportEntry { int req_module_idx; /* in req_module_entries */ } JSStarExportEntry; typedef struct JSImportEntry { int var_idx; /* closure variable index */ JSAtom import_name; int req_module_idx; /* in req_module_entries */ } JSImportEntry; typedef enum { JS_MODULE_STATUS_UNLINKED, JS_MODULE_STATUS_LINKING, JS_MODULE_STATUS_LINKED, JS_MODULE_STATUS_EVALUATING, JS_MODULE_STATUS_EVALUATING_ASYNC, JS_MODULE_STATUS_EVALUATED, } JSModuleStatus; struct JSModuleDef { JSRefCountHeader header; /* must come first, 32-bit */ JSAtom module_name; struct list_head link; JSReqModuleEntry *req_module_entries; int req_module_entries_count; int req_module_entries_size; JSExportEntry *export_entries; int export_entries_count; int export_entries_size; JSStarExportEntry *star_export_entries; int star_export_entries_count; int star_export_entries_size; JSImportEntry *import_entries; int import_entries_count; int import_entries_size; JSValue module_ns; JSValue func_obj; /* only used for JS modules */ JSModuleInitFunc *init_func; /* only used for C modules */ bool has_tla; /* true if func_obj contains await */ bool resolved; bool func_created; JSModuleStatus status : 8; /* temp use during js_module_link() & js_module_evaluate() */ int dfs_index, dfs_ancestor_index; JSModuleDef *stack_prev; /* temp use during js_module_evaluate() */ JSModuleDef **async_parent_modules; int async_parent_modules_count; int async_parent_modules_size; int pending_async_dependencies; bool async_evaluation; int64_t async_evaluation_timestamp; JSModuleDef *cycle_root; JSValue promise; /* corresponds to spec field: capability */ JSValue resolving_funcs[2]; /* corresponds to spec field: capability */ /* true if evaluation yielded an exception. It is saved in eval_exception */ bool eval_has_exception; JSValue eval_exception; JSValue meta_obj; /* for import.meta */ }; typedef struct JSJobEntry { struct list_head link; JSContext *ctx; JSJobFunc *job_func; int argc; JSValue argv[]; } JSJobEntry; typedef struct JSProperty { union { JSValue value; /* JS_PROP_NORMAL */ struct { /* JS_PROP_GETSET */ JSObject *getter; /* NULL if undefined */ JSObject *setter; /* NULL if undefined */ } getset; JSVarRef *var_ref; /* JS_PROP_VARREF */ struct { /* JS_PROP_AUTOINIT */ /* in order to use only 2 pointers, we compress the realm and the init function pointer */ uintptr_t realm_and_id; /* realm and init_id (JS_AUTOINIT_ID_x) in the 2 low bits */ void *opaque; } init; } u; } JSProperty; #define JS_PROP_INITIAL_SIZE 2 #define JS_PROP_INITIAL_HASH_SIZE 4 /* must be a power of two */ #define JS_ARRAY_INITIAL_SIZE 2 typedef struct JSShapeProperty { uint32_t hash_next : 26; /* 0 if last in list */ uint32_t flags : 6; /* JS_PROP_XXX */ JSAtom atom; /* JS_ATOM_NULL = free property entry */ } JSShapeProperty; struct JSShape { /* hash table of size hash_mask + 1 before the start of the structure (see prop_hash_end()). */ JSGCObjectHeader header; /* true if the shape is inserted in the shape hash table. If not, JSShape.hash is not valid */ uint8_t is_hashed; /* If true, the shape may have small array index properties 'n' with 0 <= n <= 2^31-1. If false, the shape is guaranteed not to have small array index properties */ uint8_t has_small_array_index; uint32_t hash; /* current hash value */ uint32_t prop_hash_mask; int prop_size; /* allocated properties */ int prop_count; /* include deleted properties */ int deleted_prop_count; JSShape *shape_hash_next; /* in JSRuntime.shape_hash[h] list */ JSObject *proto; JSShapeProperty prop[]; /* prop_size elements */ }; struct JSObject { union { JSGCObjectHeader header; struct { int __gc_ref_count; /* corresponds to header.ref_count */ uint8_t __gc_mark; /* corresponds to header.mark/gc_obj_type */ uint8_t extensible : 1; uint8_t free_mark : 1; /* only used when freeing objects with cycles */ uint8_t is_exotic : 1; /* true if object has exotic property handlers */ uint8_t fast_array : 1; /* true if u.array is used for get/put (for JS_CLASS_ARRAY, JS_CLASS_ARGUMENTS and typed arrays) */ uint8_t is_constructor : 1; /* true if object is a constructor function */ uint8_t is_uncatchable_error : 1; /* if true, error is not catchable */ uint8_t tmp_mark : 1; /* used in JS_WriteObjectRec() */ uint8_t is_HTMLDDA : 1; /* specific annex B IsHtmlDDA behavior */ uint16_t class_id; /* see JS_CLASS_x */ }; }; /* byte offsets: 16/24 */ JSShape *shape; /* prototype and property names + flag */ JSProperty *prop; /* array of properties */ /* byte offsets: 24/40 */ JSWeakRefRecord *first_weak_ref; /* byte offsets: 28/48 */ union { void *opaque; struct JSBoundFunction *bound_function; /* JS_CLASS_BOUND_FUNCTION */ struct JSCFunctionDataRecord *c_function_data_record; /* JS_CLASS_C_FUNCTION_DATA */ struct JSForInIterator *for_in_iterator; /* JS_CLASS_FOR_IN_ITERATOR */ struct JSArrayBuffer *array_buffer; /* JS_CLASS_ARRAY_BUFFER, JS_CLASS_SHARED_ARRAY_BUFFER */ struct JSTypedArray *typed_array; /* JS_CLASS_UINT8C_ARRAY..JS_CLASS_DATAVIEW */ struct JSMapState *map_state; /* JS_CLASS_MAP..JS_CLASS_WEAKSET */ struct JSMapIteratorData *map_iterator_data; /* JS_CLASS_MAP_ITERATOR, JS_CLASS_SET_ITERATOR */ struct JSArrayIteratorData *array_iterator_data; /* JS_CLASS_ARRAY_ITERATOR, JS_CLASS_STRING_ITERATOR */ struct JSRegExpStringIteratorData *regexp_string_iterator_data; /* JS_CLASS_REGEXP_STRING_ITERATOR */ struct JSGeneratorData *generator_data; /* JS_CLASS_GENERATOR */ struct JSIteratorConcatData *iterator_concat_data; /* JS_CLASS_ITERATOR_CONCAT */ struct JSIteratorHelperData *iterator_helper_data; /* JS_CLASS_ITERATOR_HELPER */ struct JSIteratorWrapData *iterator_wrap_data; /* JS_CLASS_ITERATOR_WRAP */ struct JSProxyData *proxy_data; /* JS_CLASS_PROXY */ struct JSPromiseData *promise_data; /* JS_CLASS_PROMISE */ struct JSPromiseFunctionData *promise_function_data; /* JS_CLASS_PROMISE_RESOLVE_FUNCTION, JS_CLASS_PROMISE_REJECT_FUNCTION */ struct JSAsyncFunctionData *async_function_data; /* JS_CLASS_ASYNC_FUNCTION_RESOLVE, JS_CLASS_ASYNC_FUNCTION_REJECT */ struct JSAsyncFromSyncIteratorData *async_from_sync_iterator_data; /* JS_CLASS_ASYNC_FROM_SYNC_ITERATOR */ struct JSAsyncGeneratorData *async_generator_data; /* JS_CLASS_ASYNC_GENERATOR */ struct { /* JS_CLASS_BYTECODE_FUNCTION: 12/24 bytes */ /* also used by JS_CLASS_GENERATOR_FUNCTION, JS_CLASS_ASYNC_FUNCTION and JS_CLASS_ASYNC_GENERATOR_FUNCTION */ struct JSFunctionBytecode *function_bytecode; JSVarRef **var_refs; JSObject *home_object; /* for 'super' access */ } func; struct { /* JS_CLASS_C_FUNCTION: 12/20 bytes */ JSContext *realm; JSCFunctionType c_function; uint8_t length; uint8_t cproto; int16_t magic; } cfunc; /* array part for fast arrays and typed arrays */ struct { /* JS_CLASS_ARRAY, JS_CLASS_ARGUMENTS, JS_CLASS_UINT8C_ARRAY..JS_CLASS_FLOAT64_ARRAY */ union { uint32_t size; /* JS_CLASS_ARRAY, JS_CLASS_ARGUMENTS */ struct JSTypedArray *typed_array; /* JS_CLASS_UINT8C_ARRAY..JS_CLASS_FLOAT64_ARRAY */ } u1; union { JSValue *values; /* JS_CLASS_ARRAY, JS_CLASS_ARGUMENTS */ void *ptr; /* JS_CLASS_UINT8C_ARRAY..JS_CLASS_FLOAT64_ARRAY */ int8_t *int8_ptr; /* JS_CLASS_INT8_ARRAY */ uint8_t *uint8_ptr; /* JS_CLASS_UINT8_ARRAY, JS_CLASS_UINT8C_ARRAY */ int16_t *int16_ptr; /* JS_CLASS_INT16_ARRAY */ uint16_t *uint16_ptr; /* JS_CLASS_UINT16_ARRAY */ int32_t *int32_ptr; /* JS_CLASS_INT32_ARRAY */ uint32_t *uint32_ptr; /* JS_CLASS_UINT32_ARRAY */ int64_t *int64_ptr; /* JS_CLASS_INT64_ARRAY */ uint64_t *uint64_ptr; /* JS_CLASS_UINT64_ARRAY */ uint16_t *fp16_ptr; /* JS_CLASS_FLOAT16_ARRAY */ float *float_ptr; /* JS_CLASS_FLOAT32_ARRAY */ double *double_ptr; /* JS_CLASS_FLOAT64_ARRAY */ } u; uint32_t count; /* <= 2^31-1. 0 for a detached typed array */ } array; /* 12/20 bytes */ JSRegExp regexp; /* JS_CLASS_REGEXP: 8/16 bytes */ JSValue object_data; /* for JS_SetObjectData(): 8/16/16 bytes */ } u; /* byte sizes: 40/48/72 */ }; typedef struct JSCallSiteData { JSValue filename; JSValue func; JSValue func_name; bool native; int line_num; int col_num; } JSCallSiteData; enum { __JS_ATOM_NULL = JS_ATOM_NULL, #define DEF(name, str) JS_ATOM_ ## name, #include "quickjs-atom.h" #undef DEF JS_ATOM_END, }; #define JS_ATOM_LAST_KEYWORD JS_ATOM_super #define JS_ATOM_LAST_STRICT_KEYWORD JS_ATOM_yield static const char js_atom_init[] = #define DEF(name, str) str "\0" #include "quickjs-atom.h" #undef DEF ; typedef enum OPCodeFormat { #define FMT(f) OP_FMT_ ## f, #define DEF(id, size, n_pop, n_push, f) #include "quickjs-opcode.h" #undef DEF #undef FMT } OPCodeFormat; typedef enum OPCodeEnum { #define FMT(f) #define DEF(id, size, n_pop, n_push, f) OP_ ## id, #define def(id, size, n_pop, n_push, f) #include "quickjs-opcode.h" #undef def #undef DEF #undef FMT OP_COUNT, /* excluding temporary opcodes */ /* temporary opcodes : overlap with the short opcodes */ OP_TEMP_START = OP_nop + 1, OP___dummy = OP_TEMP_START - 1, #define FMT(f) #define DEF(id, size, n_pop, n_push, f) #define def(id, size, n_pop, n_push, f) OP_ ## id, #include "quickjs-opcode.h" #undef def #undef DEF #undef FMT OP_TEMP_END, } OPCodeEnum; #ifndef NDEBUG void notifyRefCountIncrease(JSRefCountHeader *p); void notifyRefCountDecrease(JSRefCountHeader *p); #endif static int JS_InitAtoms(JSRuntime *rt); static JSAtom __JS_NewAtomInit(JSRuntime *rt, const char *str, int len, int atom_type); static void JS_FreeAtomStruct(JSRuntime *rt, JSAtomStruct *p); static void free_function_bytecode(JSRuntime *rt, JSFunctionBytecode *b); static JSValue js_call_c_function(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv, int flags); static JSValue js_call_bound_function(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv, int flags); static JSValue JS_CallInternal(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, JSValueConst new_target, int argc, JSValueConst *argv, int flags); static JSValue JS_CallConstructorInternal(JSContext *ctx, JSValueConst func_obj, JSValueConst new_target, int argc, JSValueConst *argv, int flags); static JSValue JS_CallFree(JSContext *ctx, JSValue func_obj, JSValueConst this_obj, int argc, JSValueConst *argv); static JSValue JS_InvokeFree(JSContext *ctx, JSValue this_val, JSAtom atom, int argc, JSValueConst *argv); static __exception int JS_ToArrayLengthFree(JSContext *ctx, uint32_t *plen, JSValue val, bool is_array_ctor); static JSValue JS_EvalObject(JSContext *ctx, JSValueConst this_obj, JSValueConst val, int flags, int scope_idx); static __maybe_unused void JS_DumpString(JSRuntime *rt, JSString *p); static __maybe_unused void JS_DumpObjectHeader(JSRuntime *rt); static __maybe_unused void JS_DumpObject(JSRuntime *rt, JSObject *p); static __maybe_unused void JS_DumpGCObject(JSRuntime *rt, JSGCObjectHeader *p); static __maybe_unused void JS_DumpValue(JSRuntime *rt, JSValueConst val); static __maybe_unused void JS_DumpAtoms(JSRuntime *rt); static __maybe_unused void JS_DumpShapes(JSRuntime *rt); static JSValue js_function_apply(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int magic); static void js_array_finalizer(JSRuntime *rt, JSValueConst val); static void js_array_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_object_data_finalizer(JSRuntime *rt, JSValueConst val); static void js_object_data_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_c_function_finalizer(JSRuntime *rt, JSValueConst val); static void js_c_function_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_bytecode_function_finalizer(JSRuntime *rt, JSValueConst val); static void js_bytecode_function_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_bound_function_finalizer(JSRuntime *rt, JSValueConst val); static void js_bound_function_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_for_in_iterator_finalizer(JSRuntime *rt, JSValueConst val); static void js_for_in_iterator_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_regexp_finalizer(JSRuntime *rt, JSValueConst val); static void js_array_buffer_finalizer(JSRuntime *rt, JSValueConst val); static void js_typed_array_finalizer(JSRuntime *rt, JSValueConst val); static void js_typed_array_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_proxy_finalizer(JSRuntime *rt, JSValueConst val); static void js_proxy_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_map_finalizer(JSRuntime *rt, JSValueConst val); static void js_map_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_map_iterator_finalizer(JSRuntime *rt, JSValueConst val); static void js_map_iterator_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_array_iterator_finalizer(JSRuntime *rt, JSValueConst val); static void js_array_iterator_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_iterator_concat_finalizer(JSRuntime *rt, JSValueConst val); static void js_iterator_concat_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_iterator_helper_finalizer(JSRuntime *rt, JSValueConst val); static void js_iterator_helper_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_iterator_wrap_finalizer(JSRuntime *rt, JSValueConst val); static void js_iterator_wrap_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_regexp_string_iterator_finalizer(JSRuntime *rt, JSValueConst val); static void js_regexp_string_iterator_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_generator_finalizer(JSRuntime *rt, JSValueConst val); static void js_generator_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_promise_finalizer(JSRuntime *rt, JSValueConst val); static void js_promise_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static void js_promise_resolve_function_finalizer(JSRuntime *rt, JSValueConst val); static void js_promise_resolve_function_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); #define HINT_STRING 0 #define HINT_NUMBER 1 #define HINT_NONE 2 #define HINT_FORCE_ORDINARY (1 << 4) // don't try Symbol.toPrimitive static JSValue JS_ToPrimitiveFree(JSContext *ctx, JSValue val, int hint); static JSValue JS_ToStringFree(JSContext *ctx, JSValue val); static int JS_ToBoolFree(JSContext *ctx, JSValue val); static int JS_ToInt32Free(JSContext *ctx, int32_t *pres, JSValue val); static int JS_ToFloat64Free(JSContext *ctx, double *pres, JSValue val); static int JS_ToUint8ClampFree(JSContext *ctx, int32_t *pres, JSValue val); static JSValue JS_ToPropertyKeyInternal(JSContext *ctx, JSValueConst val, int flags); static JSValue js_new_string8_len(JSContext *ctx, const char *buf, int len); static JSValue js_compile_regexp(JSContext *ctx, JSValueConst pattern, JSValueConst flags); static JSValue js_regexp_constructor_internal(JSContext *ctx, JSValueConst ctor, JSValue pattern, JSValue bc); static void gc_decref(JSRuntime *rt); static int JS_NewClass1(JSRuntime *rt, JSClassID class_id, const JSClassDef *class_def, JSAtom name); static JSValue js_array_push(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int unshift); static JSValue js_array_constructor(JSContext *ctx, JSValueConst new_target, int argc, JSValueConst *argv); static JSValue js_error_constructor(JSContext *ctx, JSValueConst new_target, int argc, JSValueConst *argv, int magic); static JSValue js_object_defineProperty(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int magic); typedef enum JSStrictEqModeEnum { JS_EQ_STRICT, JS_EQ_SAME_VALUE, JS_EQ_SAME_VALUE_ZERO, } JSStrictEqModeEnum; static bool js_strict_eq2(JSContext *ctx, JSValue op1, JSValue op2, JSStrictEqModeEnum eq_mode); static bool js_strict_eq(JSContext *ctx, JSValue op1, JSValue op2); static bool js_same_value(JSContext *ctx, JSValueConst op1, JSValueConst op2); static bool js_same_value_zero(JSContext *ctx, JSValueConst op1, JSValueConst op2); static JSValue JS_ToObjectFree(JSContext *ctx, JSValue val); static JSProperty *add_property(JSContext *ctx, JSObject *p, JSAtom prop, int prop_flags); static int JS_ToBigInt64Free(JSContext *ctx, int64_t *pres, JSValue val); static JSValue JS_ThrowStackOverflow(JSContext *ctx); static JSValue JS_ThrowTypeErrorRevokedProxy(JSContext *ctx); static JSValue js_proxy_getPrototypeOf(JSContext *ctx, JSValueConst obj); static int js_proxy_setPrototypeOf(JSContext *ctx, JSValueConst obj, JSValueConst proto_val, bool throw_flag); static int js_proxy_isExtensible(JSContext *ctx, JSValueConst obj); static int js_proxy_preventExtensions(JSContext *ctx, JSValueConst obj); static int js_proxy_isArray(JSContext *ctx, JSValueConst obj); static int JS_CreateProperty(JSContext *ctx, JSObject *p, JSAtom prop, JSValueConst val, JSValueConst getter, JSValueConst setter, int flags); static int js_string_memcmp(JSString *p1, JSString *p2, int len); static void reset_weak_ref(JSRuntime *rt, JSWeakRefRecord **first_weak_ref); static bool is_valid_weakref_target(JSValueConst val); static void insert_weakref_record(JSValueConst target, struct JSWeakRefRecord *wr); static JSValue js_array_buffer_constructor3(JSContext *ctx, JSValueConst new_target, uint64_t len, uint64_t *max_len, JSClassID class_id, uint8_t *buf, JSFreeArrayBufferDataFunc *free_func, void *opaque, bool alloc_flag); static void js_array_buffer_free(JSRuntime *rt, void *opaque, void *ptr); static JSArrayBuffer *js_get_array_buffer(JSContext *ctx, JSValueConst obj); static bool array_buffer_is_resizable(const JSArrayBuffer *abuf); static JSValue js_typed_array_constructor(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int classid); static JSValue js_typed_array_constructor_ta(JSContext *ctx, JSValueConst new_target, JSValueConst src_obj, int classid, uint32_t len); static bool is_typed_array(JSClassID class_id); static bool typed_array_is_oob(JSObject *p); static uint32_t typed_array_length(JSObject *p); static JSValue JS_ThrowTypeErrorDetachedArrayBuffer(JSContext *ctx); static JSValue JS_ThrowTypeErrorArrayBufferOOB(JSContext *ctx); static JSVarRef *get_var_ref(JSContext *ctx, JSStackFrame *sf, int var_idx, bool is_arg); static JSValue js_call_generator_function(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv, int flags); static void js_async_function_resolve_finalizer(JSRuntime *rt, JSValueConst val); static void js_async_function_resolve_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static JSValue JS_EvalInternal(JSContext *ctx, JSValueConst this_obj, const char *input, size_t input_len, const char *filename, int line, int flags, int scope_idx); static void js_free_module_def(JSContext *ctx, JSModuleDef *m); static void js_mark_module_def(JSRuntime *rt, JSModuleDef *m, JS_MarkFunc *mark_func); static JSValue js_import_meta(JSContext *ctx); static JSValue js_dynamic_import(JSContext *ctx, JSValueConst specifier); static void free_var_ref(JSRuntime *rt, JSVarRef *var_ref); static JSValue js_new_promise_capability(JSContext *ctx, JSValue *resolving_funcs, JSValueConst ctor); static __exception int perform_promise_then(JSContext *ctx, JSValueConst promise, JSValueConst *resolve_reject, JSValueConst *cap_resolving_funcs); static JSValue js_promise_resolve(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int magic); static JSValue js_promise_then(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv); static JSValue js_promise_resolve_thenable_job(JSContext *ctx, int argc, JSValueConst *argv); static bool js_string_eq(JSString *p1, JSString *p2); static int js_string_compare(JSString *p1, JSString *p2); static int JS_SetPropertyValue(JSContext *ctx, JSValueConst this_obj, JSValue prop, JSValue val, int flags); static int JS_NumberIsInteger(JSContext *ctx, JSValueConst val); static bool JS_NumberIsNegativeOrMinusZero(JSContext *ctx, JSValueConst val); static JSValue JS_ToNumberFree(JSContext *ctx, JSValue val); static int JS_GetOwnPropertyInternal(JSContext *ctx, JSPropertyDescriptor *desc, JSObject *p, JSAtom prop); static void js_free_desc(JSContext *ctx, JSPropertyDescriptor *desc); static void async_func_mark(JSRuntime *rt, JSAsyncFunctionState *s, JS_MarkFunc *mark_func); static void JS_AddIntrinsicBasicObjects(JSContext *ctx); static void js_free_shape(JSRuntime *rt, JSShape *sh); static void js_free_shape_null(JSRuntime *rt, JSShape *sh); static int js_shape_prepare_update(JSContext *ctx, JSObject *p, JSShapeProperty **pprs); static int init_shape_hash(JSRuntime *rt); static __exception int js_get_length32(JSContext *ctx, uint32_t *pres, JSValueConst obj); static __exception int js_get_length64(JSContext *ctx, int64_t *pres, JSValueConst obj); static __exception int js_set_length64(JSContext *ctx, JSValueConst obj, int64_t len); static void free_arg_list(JSContext *ctx, JSValue *tab, uint32_t len); static JSValue *build_arg_list(JSContext *ctx, uint32_t *plen, JSValueConst array_arg); static JSValue js_create_array(JSContext *ctx, int len, JSValueConst *tab); static bool js_get_fast_array(JSContext *ctx, JSValue obj, JSValue **arrpp, uint32_t *countp); static int expand_fast_array(JSContext *ctx, JSObject *p, uint32_t new_len); static JSValue JS_CreateAsyncFromSyncIterator(JSContext *ctx, JSValue sync_iter); static void js_c_function_data_finalizer(JSRuntime *rt, JSValueConst val); static void js_c_function_data_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func); static JSValue js_call_c_function_data(JSContext *ctx, JSValueConst func_obj, JSValueConst this_val, int argc, JSValueConst *argv, int flags); static JSAtom js_symbol_to_atom(JSContext *ctx, JSValueConst val); static void add_gc_object(JSRuntime *rt, JSGCObjectHeader *h, JSGCObjectTypeEnum type); static void remove_gc_object(JSGCObjectHeader *h); static void js_async_function_free0(JSRuntime *rt, JSAsyncFunctionData *s); static JSValue js_instantiate_prototype(JSContext *ctx, JSObject *p, JSAtom atom, void *opaque); static JSValue js_module_ns_autoinit(JSContext *ctx, JSObject *p, JSAtom atom, void *opaque); static JSValue JS_InstantiateFunctionListItem2(JSContext *ctx, JSObject *p, JSAtom atom, void *opaque); static void js_set_uncatchable_error(JSContext *ctx, JSValueConst val, bool flag); static JSValue js_new_callsite(JSContext *ctx, JSCallSiteData *csd); static void js_new_callsite_data(JSContext *ctx, JSCallSiteData *csd, JSStackFrame *sf); static void js_new_callsite_data2(JSContext *ctx, JSCallSiteData *csd, const char *filename, int line_num, int col_num); static void _JS_AddIntrinsicCallSite(JSContext *ctx); static void JS_SetOpaqueInternal(JSValueConst obj, void *opaque); static const JSClassExoticMethods js_arguments_exotic_methods; static const JSClassExoticMethods js_string_exotic_methods; static const JSClassExoticMethods js_proxy_exotic_methods; static const JSClassExoticMethods js_module_ns_exotic_methods; static inline bool double_is_int32(double d) { uint64_t u, e; JSFloat64Union t; t.d = d; u = t.u64; e = ((u >> 52) & 0x7FF) - 1023; if (e > 30) { // accept 0, INT32_MIN, reject too large, too small, nan, inf, -0 return !u || (u == 0xc1e0000000000000); } else { // shift out sign, exponent and whole part bits // value is fractional if remaining low bits are non-zero return !(u << 12 << e); } } static JSValue js_float64(double d) { return __JS_NewFloat64(d); } static int compare_u32(uint32_t a, uint32_t b) { return -(a < b) + (b < a); // -1, 0 or 1 } static JSValue js_int32(int32_t v) { return JS_MKVAL(JS_TAG_INT, v); } static JSValue js_uint32(uint32_t v) { if (v <= INT32_MAX) return js_int32(v); else return js_float64(v); } static JSValue js_int64(int64_t v) { if (v >= INT32_MIN && v <= INT32_MAX) return js_int32(v); else return js_float64(v); } static JSValue js_number(double d) { if (double_is_int32(d)) return js_int32((int32_t)d); else return js_float64(d); } JSValue JS_NewNumber(JSContext *ctx, double d) { return js_number(d); } static JSValue js_bool(bool v) { return JS_MKVAL(JS_TAG_BOOL, (v != 0)); } static JSValue js_dup(JSValueConst v) { if (JS_VALUE_HAS_REF_COUNT(v)) { JSRefCountHeader *p = (JSRefCountHeader *)JS_VALUE_GET_PTR(v); #ifndef NDEBUG notifyRefCountIncrease(p); #endif p->ref_count++; } return unsafe_unconst(v); } JSValue JS_DupValue(JSContext *ctx, JSValueConst v) { return js_dup(v); } JSValue JS_DupValueRT(JSRuntime *rt, JSValueConst v) { return js_dup(v); } static void js_trigger_gc(JSRuntime *rt, size_t size) { bool force_gc; #ifdef FORCE_GC_AT_MALLOC force_gc = true; #else force_gc = ((rt->malloc_state.malloc_size + size) > rt->malloc_gc_threshold); #endif if (force_gc) { #ifdef ENABLE_DUMPS // JS_DUMP_GC if (check_dump_flag(rt, JS_DUMP_GC)) { printf("GC: size=%zd\n", rt->malloc_state.malloc_size); } #endif JS_RunGC(rt); rt->malloc_gc_threshold = rt->malloc_state.malloc_size + (rt->malloc_state.malloc_size >> 1); } } static size_t js_malloc_usable_size_unknown(const void *ptr) { return 0; } void *js_calloc_rt(JSRuntime *rt, size_t count, size_t size) { void *ptr; JSMallocState *s; /* Do not allocate zero bytes: behavior is platform dependent */ assert(count != 0 && size != 0); if (size > 0) if (unlikely(count != (count * size) / size)) return NULL; s = &rt->malloc_state; /* When malloc_limit is 0 (unlimited), malloc_limit - 1 will be SIZE_MAX. */ if (unlikely(s->malloc_size + (count * size) > s->malloc_limit - 1)) return NULL; ptr = rt->mf.js_calloc(s->opaque, count, size); if (!ptr) return NULL; s->malloc_count++; s->malloc_size += rt->mf.js_malloc_usable_size(ptr) + MALLOC_OVERHEAD; return ptr; } void *js_malloc_rt(JSRuntime *rt, size_t size) { void *ptr; JSMallocState *s; /* Do not allocate zero bytes: behavior is platform dependent */ assert(size != 0); s = &rt->malloc_state; /* When malloc_limit is 0 (unlimited), malloc_limit - 1 will be SIZE_MAX. */ if (unlikely(s->malloc_size + size > s->malloc_limit - 1)) return NULL; ptr = rt->mf.js_malloc(s->opaque, size); if (!ptr) return NULL; s->malloc_count++; s->malloc_size += rt->mf.js_malloc_usable_size(ptr) + MALLOC_OVERHEAD; return ptr; } void js_free_rt(JSRuntime *rt, void *ptr) { JSMallocState *s; if (!ptr) return; s = &rt->malloc_state; s->malloc_count--; s->malloc_size -= rt->mf.js_malloc_usable_size(ptr) + MALLOC_OVERHEAD; rt->mf.js_free(s->opaque, ptr); } void *js_realloc_rt(JSRuntime *rt, void *ptr, size_t size) { size_t old_size; JSMallocState *s; if (!ptr) { if (size == 0) return NULL; return js_malloc_rt(rt, size); } if (unlikely(size == 0)) { js_free_rt(rt, ptr); return NULL; } old_size = rt->mf.js_malloc_usable_size(ptr); s = &rt->malloc_state; /* When malloc_limit is 0 (unlimited), malloc_limit - 1 will be SIZE_MAX. */ if (s->malloc_size + size - old_size > s->malloc_limit - 1) return NULL; ptr = rt->mf.js_realloc(s->opaque, ptr, size); if (!ptr) return NULL; s->malloc_size += rt->mf.js_malloc_usable_size(ptr) - old_size; return ptr; } size_t js_malloc_usable_size_rt(JSRuntime *rt, const void *ptr) { return rt->mf.js_malloc_usable_size(ptr); } /** * This used to be implemented as malloc + memset, but using calloc * yields better performance in initial, bursty allocations, something useful * for QuickJS. * * More information: https://github.com/quickjs-ng/quickjs/pull/519 */ void *js_mallocz_rt(JSRuntime *rt, size_t size) { return js_calloc_rt(rt, 1, size); } /* Throw out of memory in case of error */ void *js_calloc(JSContext *ctx, size_t count, size_t size) { void *ptr; ptr = js_calloc_rt(ctx->rt, count, size); if (unlikely(!ptr)) { JS_ThrowOutOfMemory(ctx); return NULL; } return ptr; } /* Throw out of memory in case of error */ void *js_malloc(JSContext *ctx, size_t size) { void *ptr; ptr = js_malloc_rt(ctx->rt, size); if (unlikely(!ptr)) { JS_ThrowOutOfMemory(ctx); return NULL; } return ptr; } /* Throw out of memory in case of error */ void *js_mallocz(JSContext *ctx, size_t size) { void *ptr; ptr = js_mallocz_rt(ctx->rt, size); if (unlikely(!ptr)) { JS_ThrowOutOfMemory(ctx); return NULL; } return ptr; } void js_free(JSContext *ctx, void *ptr) { js_free_rt(ctx->rt, ptr); } /* Throw out of memory in case of error */ void *js_realloc(JSContext *ctx, void *ptr, size_t size) { void *ret; ret = js_realloc_rt(ctx->rt, ptr, size); if (unlikely(!ret && size != 0)) { JS_ThrowOutOfMemory(ctx); return NULL; } return ret; } /* store extra allocated size in *pslack if successful */ void *js_realloc2(JSContext *ctx, void *ptr, size_t size, size_t *pslack) { void *ret; ret = js_realloc_rt(ctx->rt, ptr, size); if (unlikely(!ret && size != 0)) { JS_ThrowOutOfMemory(ctx); return NULL; } if (pslack) { size_t new_size = js_malloc_usable_size_rt(ctx->rt, ret); *pslack = (new_size > size) ? new_size - size : 0; } return ret; } size_t js_malloc_usable_size(JSContext *ctx, const void *ptr) { return js_malloc_usable_size_rt(ctx->rt, ptr); } /* Throw out of memory exception in case of error */ char *js_strndup(JSContext *ctx, const char *s, size_t n) { char *ptr; ptr = js_malloc(ctx, n + 1); if (ptr) { memcpy(ptr, s, n); ptr[n] = '\0'; } return ptr; } char *js_strdup(JSContext *ctx, const char *str) { return js_strndup(ctx, str, strlen(str)); } static no_inline int js_realloc_array(JSContext *ctx, void **parray, int elem_size, int *psize, int req_size) { int new_size; size_t slack; void *new_array; /* XXX: potential arithmetic overflow */ new_size = max_int(req_size, *psize * 3 / 2); new_array = js_realloc2(ctx, *parray, new_size * elem_size, &slack); if (!new_array) return -1; new_size += slack / elem_size; *psize = new_size; *parray = new_array; return 0; } /* resize the array and update its size if req_size > *psize */ static inline int js_resize_array(JSContext *ctx, void **parray, int elem_size, int *psize, int req_size) { if (unlikely(req_size > *psize)) return js_realloc_array(ctx, parray, elem_size, psize, req_size); else return 0; } static void *js_dbuf_realloc(void *ctx, void *ptr, size_t size) { return js_realloc(ctx, ptr, size); } static inline void js_dbuf_init(JSContext *ctx, DynBuf *s) { dbuf_init2(s, ctx, js_dbuf_realloc); } static inline int is_digit(int c) { return c >= '0' && c <= '9'; } static inline int string_get(JSString *p, int idx) { return p->is_wide_char ? str16(p)[idx] : str8(p)[idx]; } typedef struct JSClassShortDef { JSAtom class_name; JSClassFinalizer *finalizer; JSClassGCMark *gc_mark; } JSClassShortDef; static JSClassShortDef const js_std_class_def[] = { { JS_ATOM_Object, NULL, NULL }, /* JS_CLASS_OBJECT */ { JS_ATOM_Array, js_array_finalizer, js_array_mark }, /* JS_CLASS_ARRAY */ { JS_ATOM_Error, NULL, NULL }, /* JS_CLASS_ERROR */ { JS_ATOM_Number, js_object_data_finalizer, js_object_data_mark }, /* JS_CLASS_NUMBER */ { JS_ATOM_String, js_object_data_finalizer, js_object_data_mark }, /* JS_CLASS_STRING */ { JS_ATOM_Boolean, js_object_data_finalizer, js_object_data_mark }, /* JS_CLASS_BOOLEAN */ { JS_ATOM_Symbol, js_object_data_finalizer, js_object_data_mark }, /* JS_CLASS_SYMBOL */ { JS_ATOM_Arguments, js_array_finalizer, js_array_mark }, /* JS_CLASS_ARGUMENTS */ { JS_ATOM_Arguments, NULL, NULL }, /* JS_CLASS_MAPPED_ARGUMENTS */ { JS_ATOM_Date, js_object_data_finalizer, js_object_data_mark }, /* JS_CLASS_DATE */ { JS_ATOM_Object, NULL, NULL }, /* JS_CLASS_MODULE_NS */ { JS_ATOM_Function, js_c_function_finalizer, js_c_function_mark }, /* JS_CLASS_C_FUNCTION */ { JS_ATOM_Function, js_bytecode_function_finalizer, js_bytecode_function_mark }, /* JS_CLASS_BYTECODE_FUNCTION */ { JS_ATOM_Function, js_bound_function_finalizer, js_bound_function_mark }, /* JS_CLASS_BOUND_FUNCTION */ { JS_ATOM_Function, js_c_function_data_finalizer, js_c_function_data_mark }, /* JS_CLASS_C_FUNCTION_DATA */ { JS_ATOM_GeneratorFunction, js_bytecode_function_finalizer, js_bytecode_function_mark }, /* JS_CLASS_GENERATOR_FUNCTION */ { JS_ATOM_ForInIterator, js_for_in_iterator_finalizer, js_for_in_iterator_mark }, /* JS_CLASS_FOR_IN_ITERATOR */ { JS_ATOM_RegExp, js_regexp_finalizer, NULL }, /* JS_CLASS_REGEXP */ { JS_ATOM_ArrayBuffer, js_array_buffer_finalizer, NULL }, /* JS_CLASS_ARRAY_BUFFER */ { JS_ATOM_SharedArrayBuffer, js_array_buffer_finalizer, NULL }, /* JS_CLASS_SHARED_ARRAY_BUFFER */ { JS_ATOM_Uint8ClampedArray, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_UINT8C_ARRAY */ { JS_ATOM_Int8Array, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_INT8_ARRAY */ { JS_ATOM_Uint8Array, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_UINT8_ARRAY */ { JS_ATOM_Int16Array, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_INT16_ARRAY */ { JS_ATOM_Uint16Array, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_UINT16_ARRAY */ { JS_ATOM_Int32Array, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_INT32_ARRAY */ { JS_ATOM_Uint32Array, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_UINT32_ARRAY */ { JS_ATOM_BigInt64Array, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_BIG_INT64_ARRAY */ { JS_ATOM_BigUint64Array, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_BIG_UINT64_ARRAY */ { JS_ATOM_Float16Array, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_FLOAT16_ARRAY */ { JS_ATOM_Float32Array, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_FLOAT32_ARRAY */ { JS_ATOM_Float64Array, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_FLOAT64_ARRAY */ { JS_ATOM_DataView, js_typed_array_finalizer, js_typed_array_mark }, /* JS_CLASS_DATAVIEW */ { JS_ATOM_BigInt, js_object_data_finalizer, js_object_data_mark }, /* JS_CLASS_BIG_INT */ { JS_ATOM_Map, js_map_finalizer, js_map_mark }, /* JS_CLASS_MAP */ { JS_ATOM_Set, js_map_finalizer, js_map_mark }, /* JS_CLASS_SET */ { JS_ATOM_WeakMap, js_map_finalizer, NULL }, /* JS_CLASS_WEAKMAP */ { JS_ATOM_WeakSet, js_map_finalizer, NULL }, /* JS_CLASS_WEAKSET */ { JS_ATOM_Iterator, NULL, NULL }, /* JS_CLASS_ITERATOR */ { JS_ATOM_IteratorConcat, js_iterator_concat_finalizer, js_iterator_concat_mark }, /* JS_CLASS_ITERATOR_CONCAT */ { JS_ATOM_IteratorHelper, js_iterator_helper_finalizer, js_iterator_helper_mark }, /* JS_CLASS_ITERATOR_HELPER */ { JS_ATOM_IteratorWrap, js_iterator_wrap_finalizer, js_iterator_wrap_mark }, /* JS_CLASS_ITERATOR_WRAP */ { JS_ATOM_Map_Iterator, js_map_iterator_finalizer, js_map_iterator_mark }, /* JS_CLASS_MAP_ITERATOR */ { JS_ATOM_Set_Iterator, js_map_iterator_finalizer, js_map_iterator_mark }, /* JS_CLASS_SET_ITERATOR */ { JS_ATOM_Array_Iterator, js_array_iterator_finalizer, js_array_iterator_mark }, /* JS_CLASS_ARRAY_ITERATOR */ { JS_ATOM_String_Iterator, js_array_iterator_finalizer, js_array_iterator_mark }, /* JS_CLASS_STRING_ITERATOR */ { JS_ATOM_RegExp_String_Iterator, js_regexp_string_iterator_finalizer, js_regexp_string_iterator_mark }, /* JS_CLASS_REGEXP_STRING_ITERATOR */ { JS_ATOM_Generator, js_generator_finalizer, js_generator_mark }, /* JS_CLASS_GENERATOR */ }; static int init_class_range(JSRuntime *rt, JSClassShortDef const *tab, int start, int count) { JSClassDef cm_s, *cm = &cm_s; int i, class_id; for(i = 0; i < count; i++) { class_id = i + start; memset(cm, 0, sizeof(*cm)); cm->finalizer = tab[i].finalizer; cm->gc_mark = tab[i].gc_mark; if (JS_NewClass1(rt, class_id, cm, tab[i].class_name) < 0) return -1; } return 0; } /* Uses code from LLVM project. */ static inline uintptr_t js_get_stack_pointer(void) { #if defined(__clang__) || defined(__GNUC__) return (uintptr_t)__builtin_frame_address(0); #elif defined(_MSC_VER) return (uintptr_t)_AddressOfReturnAddress(); #else char CharOnStack = 0; // The volatile store here is intended to escape the local variable, to // prevent the compiler from optimizing CharOnStack into anything other // than a char on the stack. // // Tested on: MSVC 2015 - 2019, GCC 4.9 - 9, Clang 3.2 - 9, ICC 13 - 19. char *volatile Ptr = &CharOnStack; return (uintptr_t) Ptr; #endif } static inline bool js_check_stack_overflow(JSRuntime *rt, size_t alloca_size) { uintptr_t sp; sp = js_get_stack_pointer() - alloca_size; return unlikely(sp < rt->stack_limit); } JSRuntime *JS_NewRuntime2(const JSMallocFunctions *mf, void *opaque) { JSRuntime *rt; JSMallocState ms; memset(&ms, 0, sizeof(ms)); ms.opaque = opaque; ms.malloc_limit = 0; rt = mf->js_calloc(opaque, 1, sizeof(JSRuntime)); if (!rt) return NULL; rt->mf = *mf; if (!rt->mf.js_malloc_usable_size) { /* use dummy function if none provided */ rt->mf.js_malloc_usable_size = js_malloc_usable_size_unknown; } /* Inline what js_malloc_rt does since we cannot use it here. */ ms.malloc_count++; ms.malloc_size += rt->mf.js_malloc_usable_size(rt) + MALLOC_OVERHEAD; rt->malloc_state = ms; rt->malloc_gc_threshold = 256 * 1024; init_list_head(&rt->context_list); init_list_head(&rt->gc_obj_list); init_list_head(&rt->gc_zero_ref_count_list); rt->gc_phase = JS_GC_PHASE_NONE; #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS init_list_head(&rt->string_list); #endif init_list_head(&rt->job_list); if (JS_InitAtoms(rt)) goto fail; /* create the object, array and function classes */ if (init_class_range(rt, js_std_class_def, JS_CLASS_OBJECT, countof(js_std_class_def)) < 0) goto fail; rt->class_array[JS_CLASS_ARGUMENTS].exotic = &js_arguments_exotic_methods; rt->class_array[JS_CLASS_STRING].exotic = &js_string_exotic_methods; rt->class_array[JS_CLASS_MODULE_NS].exotic = &js_module_ns_exotic_methods; rt->class_array[JS_CLASS_C_FUNCTION].call = js_call_c_function; rt->class_array[JS_CLASS_C_FUNCTION_DATA].call = js_call_c_function_data; rt->class_array[JS_CLASS_BOUND_FUNCTION].call = js_call_bound_function; rt->class_array[JS_CLASS_GENERATOR_FUNCTION].call = js_call_generator_function; if (init_shape_hash(rt)) goto fail; rt->js_class_id_alloc = JS_CLASS_INIT_COUNT; rt->stack_size = JS_DEFAULT_STACK_SIZE; #ifdef __wasi__ rt->stack_size = 0; #endif JS_UpdateStackTop(rt); rt->current_exception = JS_UNINITIALIZED; return rt; fail: JS_FreeRuntime(rt); return NULL; } void *JS_GetRuntimeOpaque(JSRuntime *rt) { return rt->user_opaque; } void JS_SetRuntimeOpaque(JSRuntime *rt, void *opaque) { rt->user_opaque = opaque; } int JS_AddRuntimeFinalizer(JSRuntime *rt, JSRuntimeFinalizer *finalizer, void *arg) { JSRuntimeFinalizerState *fs = js_malloc_rt(rt, sizeof(*fs)); if (!fs) return -1; fs->next = rt->finalizers; fs->finalizer = finalizer; fs->arg = arg; rt->finalizers = fs; return 0; } static void *js_def_calloc(void *opaque, size_t count, size_t size) { return calloc(count, size); } static void *js_def_malloc(void *opaque, size_t size) { return malloc(size); } static void js_def_free(void *opaque, void *ptr) { free(ptr); } static void *js_def_realloc(void *opaque, void *ptr, size_t size) { return realloc(ptr, size); } static const JSMallocFunctions def_malloc_funcs = { js_def_calloc, js_def_malloc, js_def_free, js_def_realloc, js__malloc_usable_size }; JSRuntime *JS_NewRuntime(void) { return JS_NewRuntime2(&def_malloc_funcs, NULL); } void JS_SetMemoryLimit(JSRuntime *rt, size_t limit) { rt->malloc_state.malloc_limit = limit; } void JS_SetDumpFlags(JSRuntime *rt, uint64_t flags) { #ifdef ENABLE_DUMPS rt->dump_flags = flags; #endif } uint64_t JS_GetDumpFlags(JSRuntime *rt) { #ifdef ENABLE_DUMPS return rt->dump_flags; #else return 0; #endif } size_t JS_GetGCThreshold(JSRuntime *rt) { return rt->malloc_gc_threshold; } /* use -1 to disable automatic GC */ void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold) { rt->malloc_gc_threshold = gc_threshold; } #define malloc(s) malloc_is_forbidden(s) #define free(p) free_is_forbidden(p) #define realloc(p,s) realloc_is_forbidden(p,s) void JS_SetInterruptHandler(JSRuntime *rt, JSInterruptHandler *cb, void *opaque) { rt->interrupt_handler = cb; rt->interrupt_opaque = opaque; } void JS_SetCanBlock(JSRuntime *rt, bool can_block) { rt->can_block = can_block; } void JS_SetSharedArrayBufferFunctions(JSRuntime *rt, const JSSharedArrayBufferFunctions *sf) { rt->sab_funcs = *sf; } /* return 0 if OK, < 0 if exception */ int JS_EnqueueJob(JSContext *ctx, JSJobFunc *job_func, int argc, JSValueConst *argv) { JSRuntime *rt = ctx->rt; JSJobEntry *e; int i; assert(!rt->in_free); e = js_malloc(ctx, sizeof(*e) + argc * sizeof(JSValue)); if (!e) return -1; e->ctx = ctx; e->job_func = job_func; e->argc = argc; for(i = 0; i < argc; i++) { e->argv[i] = js_dup(argv[i]); } list_add_tail(&e->link, &rt->job_list); return 0; } bool JS_IsJobPending(JSRuntime *rt) { return !list_empty(&rt->job_list); } /* return < 0 if exception, 0 if no job pending, 1 if a job was executed successfully. the context of the job is stored in '*pctx' */ int JS_ExecutePendingJob(JSRuntime *rt, JSContext **pctx) { JSContext *ctx; JSJobEntry *e; JSValue res; int i, ret; if (list_empty(&rt->job_list)) { *pctx = NULL; return 0; } /* get the first pending job and execute it */ e = list_entry(rt->job_list.next, JSJobEntry, link); list_del(&e->link); ctx = e->ctx; res = e->job_func(e->ctx, e->argc, vc(e->argv)); for(i = 0; i < e->argc; i++) JS_FreeValue(ctx, e->argv[i]); if (JS_IsException(res)) ret = -1; else ret = 1; JS_FreeValue(ctx, res); js_free(ctx, e); *pctx = ctx; return ret; } static inline uint32_t atom_get_free(const JSAtomStruct *p) { return (uintptr_t)p >> 1; } static inline bool atom_is_free(const JSAtomStruct *p) { return (uintptr_t)p & 1; } static inline JSAtomStruct *atom_set_free(uint32_t v) { return (JSAtomStruct *)(((uintptr_t)v << 1) | 1); } /* Note: the string contents are uninitialized */ static JSString *js_alloc_string_rt(JSRuntime *rt, int max_len, int is_wide_char) { JSString *str; str = js_malloc_rt(rt, sizeof(JSString) + (max_len << is_wide_char) + 1 - is_wide_char); if (unlikely(!str)) return NULL; str->header.ref_count = 1; str->is_wide_char = is_wide_char; str->len = max_len; str->kind = JS_STRING_KIND_NORMAL; str->atom_type = 0; str->hash = 0; /* optional but costless */ str->hash_next = 0; /* optional */ #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS list_add_tail(&str->link, &rt->string_list); #endif return str; } static JSString *js_alloc_string(JSContext *ctx, int max_len, int is_wide_char) { JSString *p; p = js_alloc_string_rt(ctx->rt, max_len, is_wide_char); if (unlikely(!p)) { JS_ThrowOutOfMemory(ctx); return NULL; } return p; } static inline void js_free_string0(JSRuntime *rt, JSString *str); /* same as JS_FreeValueRT() but faster */ static inline void js_free_string(JSRuntime *rt, JSString *str) { if (--str->header.ref_count <= 0) js_free_string0(rt, str); } static inline void js_free_string0(JSRuntime *rt, JSString *str) { if (str->atom_type) { JS_FreeAtomStruct(rt, str); } else { #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS list_del(&str->link); #endif if (str->kind == JS_STRING_KIND_SLICE) { JSStringSlice *slice = (void *)&str[1]; js_free_string(rt, slice->parent); // safe, recurses only 1 level } js_free_rt(rt, str); } } void JS_SetRuntimeInfo(JSRuntime *rt, const char *s) { if (rt) rt->rt_info = s; } void JS_FreeRuntime(JSRuntime *rt) { struct list_head *el, *el1; int i; rt->in_free = true; JS_FreeValueRT(rt, rt->current_exception); list_for_each_safe(el, el1, &rt->job_list) { JSJobEntry *e = list_entry(el, JSJobEntry, link); for(i = 0; i < e->argc; i++) JS_FreeValueRT(rt, e->argv[i]); js_free_rt(rt, e); } init_list_head(&rt->job_list); JS_RunGC(rt); #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS /* leaking objects */ if (check_dump_flag(rt, JS_DUMP_LEAKS)) { bool header_done; JSGCObjectHeader *p; int count; /* remove the internal refcounts to display only the object referenced externally */ list_for_each(el, &rt->gc_obj_list) { p = list_entry(el, JSGCObjectHeader, link); p->mark = 0; } gc_decref(rt); header_done = false; list_for_each(el, &rt->gc_obj_list) { p = list_entry(el, JSGCObjectHeader, link); if (p->ref_count != 0) { if (!header_done) { printf("Object leaks:\n"); JS_DumpObjectHeader(rt); header_done = true; } JS_DumpGCObject(rt, p); } } count = 0; list_for_each(el, &rt->gc_obj_list) { p = list_entry(el, JSGCObjectHeader, link); if (p->ref_count == 0) { count++; } } if (count != 0) printf("Secondary object leaks: %d\n", count); } #endif assert(list_empty(&rt->gc_obj_list)); /* free the classes */ for(i = 0; i < rt->class_count; i++) { JSClass *cl = &rt->class_array[i]; if (cl->class_id != 0) { JS_FreeAtomRT(rt, cl->class_name); } } js_free_rt(rt, rt->class_array); #ifdef ENABLE_DUMPS // JS_DUMP_ATOM_LEAKS /* only the atoms defined in JS_InitAtoms() should be left */ if (check_dump_flag(rt, JS_DUMP_ATOM_LEAKS)) { bool header_done = false; for(i = 0; i < rt->atom_size; i++) { JSAtomStruct *p = rt->atom_array[i]; if (!atom_is_free(p) /* && p->str*/) { if (i >= JS_ATOM_END || p->header.ref_count != 1) { if (!header_done) { header_done = true; if (rt->rt_info) { printf("%s:1: atom leakage:", rt->rt_info); } else { printf("Atom leaks:\n" " %6s %6s %s\n", "ID", "REFCNT", "NAME"); } } if (rt->rt_info) { printf(" "); } else { printf(" %6u %6u ", i, p->header.ref_count); } switch (p->atom_type) { case JS_ATOM_TYPE_STRING: JS_DumpString(rt, p); break; case JS_ATOM_TYPE_GLOBAL_SYMBOL: printf("Symbol.for("); JS_DumpString(rt, p); printf(")"); break; case JS_ATOM_TYPE_SYMBOL: if (p->hash == JS_ATOM_HASH_SYMBOL) { printf("Symbol("); JS_DumpString(rt, p); printf(")"); } else { printf("Private("); JS_DumpString(rt, p); printf(")"); } break; } if (rt->rt_info) { printf(":%u", p->header.ref_count); } else { printf("\n"); } } } } if (rt->rt_info && header_done) printf("\n"); } #endif /* free the atoms */ for(i = 0; i < rt->atom_size; i++) { JSAtomStruct *p = rt->atom_array[i]; if (!atom_is_free(p)) { #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS list_del(&p->link); #endif js_free_rt(rt, p); } } js_free_rt(rt, rt->atom_array); js_free_rt(rt, rt->atom_hash); js_free_rt(rt, rt->shape_hash); #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS if (check_dump_flag(rt, JS_DUMP_LEAKS) && !list_empty(&rt->string_list)) { if (rt->rt_info) { printf("%s:1: string leakage:", rt->rt_info); } else { printf("String leaks:\n" " %6s %s\n", "REFCNT", "VALUE"); } list_for_each_safe(el, el1, &rt->string_list) { JSString *str = list_entry(el, JSString, link); if (rt->rt_info) { printf(" "); } else { printf(" %6u ", str->header.ref_count); } JS_DumpString(rt, str); if (rt->rt_info) { printf(":%u", str->header.ref_count); } else { printf("\n"); } list_del(&str->link); js_free_rt(rt, str); } if (rt->rt_info) printf("\n"); } #endif while (rt->finalizers) { JSRuntimeFinalizerState *fs = rt->finalizers; rt->finalizers = fs->next; fs->finalizer(rt, fs->arg); js_free_rt(rt, fs); } #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS if (check_dump_flag(rt, JS_DUMP_LEAKS)) { JSMallocState *s = &rt->malloc_state; if (s->malloc_count > 1) { if (rt->rt_info) printf("%s:1: ", rt->rt_info); printf("Memory leak: %zd bytes lost in %zd block%s\n", s->malloc_size - sizeof(JSRuntime), s->malloc_count - 1, &"s"[s->malloc_count == 2]); } } #endif { JSMallocState *ms = &rt->malloc_state; rt->mf.js_free(ms->opaque, rt); } fflush(stdout); } JSContext *JS_NewContextRaw(JSRuntime *rt) { JSContext *ctx; int i; ctx = js_mallocz_rt(rt, sizeof(JSContext)); if (!ctx) return NULL; ctx->header.ref_count = 1; add_gc_object(rt, &ctx->header, JS_GC_OBJ_TYPE_JS_CONTEXT); ctx->class_proto = js_malloc_rt(rt, sizeof(ctx->class_proto[0]) * rt->class_count); if (!ctx->class_proto) { js_free_rt(rt, ctx); return NULL; } ctx->rt = rt; list_add_tail(&ctx->link, &rt->context_list); for(i = 0; i < rt->class_count; i++) ctx->class_proto[i] = JS_NULL; ctx->array_ctor = JS_NULL; ctx->iterator_ctor = JS_NULL; ctx->iterator_ctor_getset = JS_NULL; ctx->regexp_ctor = JS_NULL; ctx->promise_ctor = JS_NULL; ctx->error_ctor = JS_NULL; ctx->error_back_trace = JS_UNDEFINED; ctx->error_prepare_stack = JS_UNDEFINED; ctx->error_stack_trace_limit = js_int32(10); init_list_head(&ctx->loaded_modules); JS_AddIntrinsicBasicObjects(ctx); return ctx; } JSContext *JS_NewContext(JSRuntime *rt) { JSContext *ctx; ctx = JS_NewContextRaw(rt); if (!ctx) return NULL; JS_AddIntrinsicBaseObjects(ctx); JS_AddIntrinsicDate(ctx); JS_AddIntrinsicEval(ctx); JS_AddIntrinsicRegExp(ctx); JS_AddIntrinsicJSON(ctx); JS_AddIntrinsicProxy(ctx); JS_AddIntrinsicMapSet(ctx); JS_AddIntrinsicTypedArrays(ctx); JS_AddIntrinsicPromise(ctx); JS_AddIntrinsicBigInt(ctx); JS_AddIntrinsicWeakRef(ctx); JS_AddIntrinsicDOMException(ctx); JS_AddPerformance(ctx); return ctx; } void *JS_GetContextOpaque(JSContext *ctx) { return ctx->user_opaque; } void JS_SetContextOpaque(JSContext *ctx, void *opaque) { ctx->user_opaque = opaque; } /* set the new value and free the old value after (freeing the value can reallocate the object data) */ static inline void set_value(JSContext *ctx, JSValue *pval, JSValue new_val) { JSValue old_val; old_val = *pval; *pval = new_val; JS_FreeValue(ctx, old_val); } void JS_SetClassProto(JSContext *ctx, JSClassID class_id, JSValue obj) { assert(class_id < ctx->rt->class_count); set_value(ctx, &ctx->class_proto[class_id], obj); } JSValue JS_GetClassProto(JSContext *ctx, JSClassID class_id) { assert(class_id < ctx->rt->class_count); return js_dup(ctx->class_proto[class_id]); } JSValue JS_GetFunctionProto(JSContext *ctx) { return js_dup(ctx->function_proto); } typedef enum JSFreeModuleEnum { JS_FREE_MODULE_ALL, JS_FREE_MODULE_NOT_RESOLVED, } JSFreeModuleEnum; /* XXX: would be more efficient with separate module lists */ static void js_free_modules(JSContext *ctx, JSFreeModuleEnum flag) { struct list_head *el, *el1; list_for_each_safe(el, el1, &ctx->loaded_modules) { JSModuleDef *m = list_entry(el, JSModuleDef, link); if (flag == JS_FREE_MODULE_ALL || (flag == JS_FREE_MODULE_NOT_RESOLVED && !m->resolved)) { js_free_module_def(ctx, m); } } } JSContext *JS_DupContext(JSContext *ctx) { ctx->header.ref_count++; return ctx; } /* used by the GC */ static void JS_MarkContext(JSRuntime *rt, JSContext *ctx, JS_MarkFunc *mark_func) { int i; struct list_head *el; /* modules are not seen by the GC, so we directly mark the objects referenced by each module */ list_for_each(el, &ctx->loaded_modules) { JSModuleDef *m = list_entry(el, JSModuleDef, link); js_mark_module_def(rt, m, mark_func); } JS_MarkValue(rt, ctx->global_obj, mark_func); JS_MarkValue(rt, ctx->global_var_obj, mark_func); JS_MarkValue(rt, ctx->throw_type_error, mark_func); JS_MarkValue(rt, ctx->eval_obj, mark_func); JS_MarkValue(rt, ctx->array_proto_values, mark_func); for(i = 0; i < JS_NATIVE_ERROR_COUNT; i++) { JS_MarkValue(rt, ctx->native_error_proto[i], mark_func); } JS_MarkValue(rt, ctx->error_ctor, mark_func); JS_MarkValue(rt, ctx->error_back_trace, mark_func); JS_MarkValue(rt, ctx->error_prepare_stack, mark_func); JS_MarkValue(rt, ctx->error_stack_trace_limit, mark_func); for(i = 0; i < rt->class_count; i++) { JS_MarkValue(rt, ctx->class_proto[i], mark_func); } JS_MarkValue(rt, ctx->iterator_ctor, mark_func); JS_MarkValue(rt, ctx->iterator_ctor_getset, mark_func); JS_MarkValue(rt, ctx->async_iterator_proto, mark_func); JS_MarkValue(rt, ctx->promise_ctor, mark_func); JS_MarkValue(rt, ctx->array_ctor, mark_func); JS_MarkValue(rt, ctx->regexp_ctor, mark_func); JS_MarkValue(rt, ctx->function_ctor, mark_func); JS_MarkValue(rt, ctx->function_proto, mark_func); if (ctx->array_shape) mark_func(rt, &ctx->array_shape->header); } void JS_FreeContext(JSContext *ctx) { JSRuntime *rt = ctx->rt; int i; if (--ctx->header.ref_count > 0) return; assert(ctx->header.ref_count == 0); #ifdef ENABLE_DUMPS // JS_DUMP_ATOMS if (check_dump_flag(rt, JS_DUMP_ATOMS)) JS_DumpAtoms(ctx->rt); #endif #ifdef ENABLE_DUMPS // JS_DUMP_SHAPES if (check_dump_flag(rt, JS_DUMP_SHAPES)) JS_DumpShapes(ctx->rt); #endif #ifdef ENABLE_DUMPS // JS_DUMP_OBJECTS if (check_dump_flag(rt, JS_DUMP_OBJECTS)) { struct list_head *el; JSGCObjectHeader *p; printf("JSObjects: {\n"); JS_DumpObjectHeader(ctx->rt); list_for_each(el, &rt->gc_obj_list) { p = list_entry(el, JSGCObjectHeader, link); JS_DumpGCObject(rt, p); } printf("}\n"); } #endif #ifdef ENABLE_DUMPS // JS_DUMP_MEM if (check_dump_flag(rt, JS_DUMP_MEM)) { JSMemoryUsage stats; JS_ComputeMemoryUsage(rt, &stats); JS_DumpMemoryUsage(stdout, &stats, rt); } #endif js_free_modules(ctx, JS_FREE_MODULE_ALL); JS_FreeValue(ctx, ctx->global_obj); JS_FreeValue(ctx, ctx->global_var_obj); JS_FreeValue(ctx, ctx->throw_type_error); JS_FreeValue(ctx, ctx->eval_obj); JS_FreeValue(ctx, ctx->array_proto_values); for(i = 0; i < JS_NATIVE_ERROR_COUNT; i++) { JS_FreeValue(ctx, ctx->native_error_proto[i]); } JS_FreeValue(ctx, ctx->error_ctor); JS_FreeValue(ctx, ctx->error_back_trace); JS_FreeValue(ctx, ctx->error_prepare_stack); JS_FreeValue(ctx, ctx->error_stack_trace_limit); for(i = 0; i < rt->class_count; i++) { JS_FreeValue(ctx, ctx->class_proto[i]); } js_free_rt(rt, ctx->class_proto); JS_FreeValue(ctx, ctx->iterator_ctor); JS_FreeValue(ctx, ctx->iterator_ctor_getset); JS_FreeValue(ctx, ctx->async_iterator_proto); JS_FreeValue(ctx, ctx->promise_ctor); JS_FreeValue(ctx, ctx->array_ctor); JS_FreeValue(ctx, ctx->regexp_ctor); JS_FreeValue(ctx, ctx->function_ctor); JS_FreeValue(ctx, ctx->function_proto); js_free_shape_null(ctx->rt, ctx->array_shape); list_del(&ctx->link); remove_gc_object(&ctx->header); js_free_rt(ctx->rt, ctx); } JSRuntime *JS_GetRuntime(JSContext *ctx) { return ctx->rt; } static void update_stack_limit(JSRuntime *rt) { #if defined(__wasi__) rt->stack_limit = 0; /* no limit */ #else if (rt->stack_size == 0) { rt->stack_limit = 0; /* no limit */ } else { rt->stack_limit = rt->stack_top - rt->stack_size; } #endif } void JS_SetMaxStackSize(JSRuntime *rt, size_t stack_size) { rt->stack_size = stack_size; update_stack_limit(rt); } void JS_UpdateStackTop(JSRuntime *rt) { rt->stack_top = js_get_stack_pointer(); update_stack_limit(rt); } static inline bool is_strict_mode(JSContext *ctx) { JSStackFrame *sf = ctx->rt->current_stack_frame; return sf && sf->is_strict_mode; } /* JSAtom support */ #define JS_ATOM_TAG_INT (1U << 31) #define JS_ATOM_MAX_INT (JS_ATOM_TAG_INT - 1) #define JS_ATOM_MAX ((1U << 30) - 1) /* return the max count from the hash size */ #define JS_ATOM_COUNT_RESIZE(n) ((n) * 2) static inline bool __JS_AtomIsConst(JSAtom v) { return (int32_t)v < JS_ATOM_END; } static inline bool __JS_AtomIsTaggedInt(JSAtom v) { return (v & JS_ATOM_TAG_INT) != 0; } static inline JSAtom __JS_AtomFromUInt32(uint32_t v) { return v | JS_ATOM_TAG_INT; } static inline uint32_t __JS_AtomToUInt32(JSAtom atom) { return atom & ~JS_ATOM_TAG_INT; } static inline int is_num(int c) { return c >= '0' && c <= '9'; } /* return true if the string is a number n with 0 <= n <= 2^32-1 */ static inline bool is_num_string(uint32_t *pval, JSString *p) { uint32_t n; uint64_t n64; int c, i, len; len = p->len; if (len == 0 || len > 10) return false; c = string_get(p, 0); if (is_num(c)) { if (c == '0') { if (len != 1) return false; n = 0; } else { n = c - '0'; for(i = 1; i < len; i++) { c = string_get(p, i); if (!is_num(c)) return false; n64 = (uint64_t)n * 10 + (c - '0'); if ((n64 >> 32) != 0) return false; n = n64; } } *pval = n; return true; } else { return false; } } /* XXX: could use faster version ? */ static inline uint32_t hash_string8(const uint8_t *str, size_t len, uint32_t h) { size_t i; for(i = 0; i < len; i++) h = h * 263 + str[i]; return h; } static inline uint32_t hash_string16(const uint16_t *str, size_t len, uint32_t h) { size_t i; for(i = 0; i < len; i++) h = h * 263 + str[i]; return h; } static uint32_t hash_string(JSString *str, uint32_t h) { if (str->is_wide_char) h = hash_string16(str16(str), str->len, h); else h = hash_string8(str8(str), str->len, h); return h; } static __maybe_unused void JS_DumpString(JSRuntime *rt, JSString *p) { int i, c, sep; if (p == NULL) { printf(""); return; } if (p->header.ref_count != 1) printf("%d", p->header.ref_count); if (p->is_wide_char) putchar('L'); sep = '\"'; putchar(sep); for(i = 0; i < p->len; i++) { c = string_get(p, i); if (c == sep || c == '\\') { putchar('\\'); putchar(c); } else if (c >= ' ' && c <= 126) { putchar(c); } else if (c == '\n') { putchar('\\'); putchar('n'); } else { printf("\\u%04x", c); } } putchar(sep); } static __maybe_unused void JS_DumpAtoms(JSRuntime *rt) { JSAtomStruct *p; int h, i; /* This only dumps hashed atoms, not JS_ATOM_TYPE_SYMBOL atoms */ printf("JSAtom count=%d size=%d hash_size=%d:\n", rt->atom_count, rt->atom_size, rt->atom_hash_size); printf("JSAtom hash table: {\n"); for(i = 0; i < rt->atom_hash_size; i++) { h = rt->atom_hash[i]; if (h) { printf(" %d:", i); while (h) { p = rt->atom_array[h]; printf(" "); JS_DumpString(rt, p); h = p->hash_next; } printf("\n"); } } printf("}\n"); printf("JSAtom table: {\n"); for(i = 0; i < rt->atom_size; i++) { p = rt->atom_array[i]; if (!atom_is_free(p)) { printf(" %d: { %d %08x ", i, p->atom_type, p->hash); if (!(p->len == 0 && p->is_wide_char != 0)) JS_DumpString(rt, p); printf(" %d }\n", p->hash_next); } } printf("}\n"); } static int JS_ResizeAtomHash(JSRuntime *rt, int new_hash_size) { JSAtomStruct *p; uint32_t new_hash_mask, h, i, hash_next1, j, *new_hash; assert((new_hash_size & (new_hash_size - 1)) == 0); /* power of two */ new_hash_mask = new_hash_size - 1; new_hash = js_mallocz_rt(rt, sizeof(rt->atom_hash[0]) * new_hash_size); if (!new_hash) return -1; for(i = 0; i < rt->atom_hash_size; i++) { h = rt->atom_hash[i]; while (h != 0) { p = rt->atom_array[h]; hash_next1 = p->hash_next; /* add in new hash table */ j = p->hash & new_hash_mask; p->hash_next = new_hash[j]; new_hash[j] = h; h = hash_next1; } } js_free_rt(rt, rt->atom_hash); rt->atom_hash = new_hash; rt->atom_hash_size = new_hash_size; rt->atom_count_resize = JS_ATOM_COUNT_RESIZE(new_hash_size); // JS_DumpAtoms(rt); return 0; } static int JS_InitAtoms(JSRuntime *rt) { int i, len, atom_type; const char *p; rt->atom_hash_size = 0; rt->atom_hash = NULL; rt->atom_count = 0; rt->atom_size = 0; rt->atom_free_index = 0; if (JS_ResizeAtomHash(rt, 256)) /* there are at least 195 predefined atoms */ return -1; p = js_atom_init; for(i = 1; i < JS_ATOM_END; i++) { if (i == JS_ATOM_Private_brand) atom_type = JS_ATOM_TYPE_PRIVATE; else if (i >= JS_ATOM_Symbol_toPrimitive) atom_type = JS_ATOM_TYPE_SYMBOL; else atom_type = JS_ATOM_TYPE_STRING; len = strlen(p); if (__JS_NewAtomInit(rt, p, len, atom_type) == JS_ATOM_NULL) return -1; p = p + len + 1; } return 0; } static JSAtom JS_DupAtomRT(JSRuntime *rt, JSAtom v) { JSAtomStruct *p; if (!__JS_AtomIsConst(v)) { p = rt->atom_array[v]; p->header.ref_count++; } return v; } JSAtom JS_DupAtom(JSContext *ctx, JSAtom v) { JSRuntime *rt; JSAtomStruct *p; if (!__JS_AtomIsConst(v)) { rt = ctx->rt; p = rt->atom_array[v]; p->header.ref_count++; } return v; } static JSAtomKindEnum JS_AtomGetKind(JSContext *ctx, JSAtom v) { JSRuntime *rt; JSAtomStruct *p; rt = ctx->rt; if (__JS_AtomIsTaggedInt(v)) return JS_ATOM_KIND_STRING; p = rt->atom_array[v]; switch(p->atom_type) { case JS_ATOM_TYPE_STRING: return JS_ATOM_KIND_STRING; case JS_ATOM_TYPE_GLOBAL_SYMBOL: return JS_ATOM_KIND_SYMBOL; case JS_ATOM_TYPE_SYMBOL: switch(p->hash) { case JS_ATOM_HASH_SYMBOL: return JS_ATOM_KIND_SYMBOL; case JS_ATOM_HASH_PRIVATE: return JS_ATOM_KIND_PRIVATE; default: abort(); } default: abort(); } return (JSAtomKindEnum){-1}; // pacify compiler } static JSAtom js_get_atom_index(JSRuntime *rt, JSAtomStruct *p) { uint32_t i = p->hash_next; /* atom_index */ if (p->atom_type != JS_ATOM_TYPE_SYMBOL) { JSAtomStruct *p1; i = rt->atom_hash[p->hash & (rt->atom_hash_size - 1)]; p1 = rt->atom_array[i]; while (p1 != p) { assert(i != 0); i = p1->hash_next; p1 = rt->atom_array[i]; } } return i; } /* string case (internal). Return JS_ATOM_NULL if error. 'str' is freed. */ static JSAtom __JS_NewAtom(JSRuntime *rt, JSString *str, int atom_type) { uint32_t h, h1, i; JSAtomStruct *p; int len; if (atom_type < JS_ATOM_TYPE_SYMBOL) { /* str is not NULL */ if (str->atom_type == atom_type) { /* str is the atom, return its index */ i = js_get_atom_index(rt, str); /* reduce string refcount and increase atom's unless constant */ if (__JS_AtomIsConst(i)) str->header.ref_count--; return i; } /* try and locate an already registered atom */ len = str->len; h = hash_string(str, atom_type); h &= JS_ATOM_HASH_MASK; h1 = h & (rt->atom_hash_size - 1); i = rt->atom_hash[h1]; while (i != 0) { p = rt->atom_array[i]; if (p->hash == h && p->atom_type == atom_type && p->len == len && js_string_memcmp(p, str, len) == 0) { if (!__JS_AtomIsConst(i)) p->header.ref_count++; goto done; } i = p->hash_next; } } else { h1 = 0; /* avoid warning */ if (atom_type == JS_ATOM_TYPE_SYMBOL) { h = JS_ATOM_HASH_SYMBOL; } else { h = JS_ATOM_HASH_PRIVATE; atom_type = JS_ATOM_TYPE_SYMBOL; } } if (rt->atom_free_index == 0) { /* allow new atom entries */ uint32_t new_size, start; JSAtomStruct **new_array; /* alloc new with size progression 3/2: 4 6 9 13 19 28 42 63 94 141 211 316 474 711 1066 1599 2398 3597 5395 8092 preallocating space for predefined atoms (at least 195). */ new_size = max_int(211, rt->atom_size * 3 / 2); if (new_size > JS_ATOM_MAX) goto fail; /* XXX: should use realloc2 to use slack space */ new_array = js_realloc_rt(rt, rt->atom_array, sizeof(*new_array) * new_size); if (!new_array) goto fail; /* Note: the atom 0 is not used */ start = rt->atom_size; if (start == 0) { /* JS_ATOM_NULL entry */ p = js_mallocz_rt(rt, sizeof(JSAtomStruct)); if (!p) { js_free_rt(rt, new_array); goto fail; } p->header.ref_count = 1; /* not refcounted */ p->atom_type = JS_ATOM_TYPE_SYMBOL; #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS list_add_tail(&p->link, &rt->string_list); #endif new_array[0] = p; rt->atom_count++; start = 1; } rt->atom_size = new_size; rt->atom_array = new_array; rt->atom_free_index = start; for(i = start; i < new_size; i++) { uint32_t next; if (i == (new_size - 1)) next = 0; else next = i + 1; rt->atom_array[i] = atom_set_free(next); } } if (str) { if (str->atom_type == 0) { p = str; p->atom_type = atom_type; } else { p = js_malloc_rt(rt, sizeof(JSString) + (str->len << str->is_wide_char) + 1 - str->is_wide_char); if (unlikely(!p)) goto fail; p->header.ref_count = 1; p->is_wide_char = str->is_wide_char; p->len = str->len; p->kind = JS_STRING_KIND_NORMAL; #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS list_add_tail(&p->link, &rt->string_list); #endif memcpy(str8(p), str8(str), (str->len << str->is_wide_char) + 1 - str->is_wide_char); js_free_string(rt, str); } } else { p = js_malloc_rt(rt, sizeof(JSAtomStruct)); /* empty wide string */ if (!p) return JS_ATOM_NULL; p->header.ref_count = 1; p->is_wide_char = 1; /* Hack to represent NULL as a JSString */ p->len = 0; p->kind = JS_STRING_KIND_NORMAL; #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS list_add_tail(&p->link, &rt->string_list); #endif } /* use an already free entry */ i = rt->atom_free_index; rt->atom_free_index = atom_get_free(rt->atom_array[i]); rt->atom_array[i] = p; p->hash = h; p->hash_next = i; /* atom_index */ p->atom_type = atom_type; p->first_weak_ref = NULL; rt->atom_count++; if (atom_type != JS_ATOM_TYPE_SYMBOL) { p->hash_next = rt->atom_hash[h1]; rt->atom_hash[h1] = i; if (unlikely(rt->atom_count >= rt->atom_count_resize)) JS_ResizeAtomHash(rt, rt->atom_hash_size * 2); } // JS_DumpAtoms(rt); return i; fail: i = JS_ATOM_NULL; done: if (str) js_free_string(rt, str); return i; } // XXX: `str` must be pure ASCII. No UTF-8 encoded strings // XXX: `str` must not be the string representation of a small integer static JSAtom __JS_NewAtomInit(JSRuntime *rt, const char *str, int len, int atom_type) { JSString *p; p = js_alloc_string_rt(rt, len, 0); if (!p) return JS_ATOM_NULL; memcpy(str8(p), str, len); str8(p)[len] = '\0'; return __JS_NewAtom(rt, p, atom_type); } // XXX: `str` must be raw 8-bit contents. No UTF-8 encoded strings static JSAtom __JS_FindAtom(JSRuntime *rt, const char *str, size_t len, int atom_type) { uint32_t h, h1, i; JSAtomStruct *p; h = hash_string8((const uint8_t *)str, len, JS_ATOM_TYPE_STRING); h &= JS_ATOM_HASH_MASK; h1 = h & (rt->atom_hash_size - 1); i = rt->atom_hash[h1]; while (i != 0) { p = rt->atom_array[i]; if (p->hash == h && p->atom_type == JS_ATOM_TYPE_STRING && p->len == len && p->is_wide_char == 0 && memcmp(str8(p), str, len) == 0) { if (!__JS_AtomIsConst(i)) p->header.ref_count++; return i; } i = p->hash_next; } return JS_ATOM_NULL; } static void JS_FreeAtomStruct(JSRuntime *rt, JSAtomStruct *p) { uint32_t i = p->hash_next; /* atom_index */ if (p->atom_type != JS_ATOM_TYPE_SYMBOL) { JSAtomStruct *p0, *p1; uint32_t h0; h0 = p->hash & (rt->atom_hash_size - 1); i = rt->atom_hash[h0]; p1 = rt->atom_array[i]; if (p1 == p) { rt->atom_hash[h0] = p1->hash_next; } else { for(;;) { assert(i != 0); p0 = p1; i = p1->hash_next; p1 = rt->atom_array[i]; if (p1 == p) { p0->hash_next = p1->hash_next; break; } } } } /* insert in free atom list */ rt->atom_array[i] = atom_set_free(rt->atom_free_index); rt->atom_free_index = i; if (unlikely(p->first_weak_ref)) { reset_weak_ref(rt, &p->first_weak_ref); } /* free the string structure */ #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS list_del(&p->link); #endif js_free_rt(rt, p); rt->atom_count--; assert(rt->atom_count >= 0); } static void __JS_FreeAtom(JSRuntime *rt, uint32_t i) { JSAtomStruct *p; p = rt->atom_array[i]; if (--p->header.ref_count > 0) return; JS_FreeAtomStruct(rt, p); } /* Warning: 'p' is freed */ static JSAtom JS_NewAtomStr(JSContext *ctx, JSString *p) { JSRuntime *rt = ctx->rt; uint32_t n; if (is_num_string(&n, p)) { if (n <= JS_ATOM_MAX_INT) { js_free_string(rt, p); return __JS_AtomFromUInt32(n); } } /* XXX: should generate an exception */ return __JS_NewAtom(rt, p, JS_ATOM_TYPE_STRING); } /* `str` may be pure ASCII or UTF-8 encoded */ JSAtom JS_NewAtomLen(JSContext *ctx, const char *str, size_t len) { JSValue val; if (len == 0 || !is_digit(*str)) { // TODO(chqrlie): this does not work if `str` has UTF-8 encoded contents // bug example: `({ "\u00c3\u00a9": 1 }).\u00e9` evaluates to `1`. JSAtom atom = __JS_FindAtom(ctx->rt, str, len, JS_ATOM_TYPE_STRING); if (atom) return atom; } val = JS_NewStringLen(ctx, str, len); if (JS_IsException(val)) return JS_ATOM_NULL; return JS_NewAtomStr(ctx, JS_VALUE_GET_STRING(val)); } /* `str` may be pure ASCII or UTF-8 encoded */ JSAtom JS_NewAtom(JSContext *ctx, const char *str) { return JS_NewAtomLen(ctx, str, strlen(str)); } JSAtom JS_NewAtomUInt32(JSContext *ctx, uint32_t n) { if (n <= JS_ATOM_MAX_INT) { return __JS_AtomFromUInt32(n); } else { char buf[16]; size_t len = u32toa(buf, n); JSValue val = js_new_string8_len(ctx, buf, len); if (JS_IsException(val)) return JS_ATOM_NULL; return __JS_NewAtom(ctx->rt, JS_VALUE_GET_STRING(val), JS_ATOM_TYPE_STRING); } } static JSAtom JS_NewAtomInt64(JSContext *ctx, int64_t n) { if ((uint64_t)n <= JS_ATOM_MAX_INT) { return __JS_AtomFromUInt32((uint32_t)n); } else { char buf[24]; size_t len = i64toa(buf, n); JSValue val = js_new_string8_len(ctx, buf, len); if (JS_IsException(val)) return JS_ATOM_NULL; return __JS_NewAtom(ctx->rt, JS_VALUE_GET_STRING(val), JS_ATOM_TYPE_STRING); } } /* 'p' is freed */ static JSValue JS_NewSymbolInternal(JSContext *ctx, JSString *p, int atom_type) { JSRuntime *rt = ctx->rt; JSAtom atom; atom = __JS_NewAtom(rt, p, atom_type); if (atom == JS_ATOM_NULL) return JS_ThrowOutOfMemory(ctx); return JS_MKPTR(JS_TAG_SYMBOL, rt->atom_array[atom]); } /* descr must be a non-numeric string atom */ static JSValue JS_NewSymbolFromAtom(JSContext *ctx, JSAtom descr, int atom_type) { JSRuntime *rt = ctx->rt; JSString *p; assert(!__JS_AtomIsTaggedInt(descr)); assert(descr < rt->atom_size); p = rt->atom_array[descr]; js_dup(JS_MKPTR(JS_TAG_STRING, p)); return JS_NewSymbolInternal(ctx, p, atom_type); } /* `description` may be pure ASCII or UTF-8 encoded */ JSValue JS_NewSymbol(JSContext *ctx, const char *description, bool is_global) { JSAtom atom = JS_NewAtom(ctx, description); if (atom == JS_ATOM_NULL) return JS_EXCEPTION; return JS_NewSymbolFromAtom(ctx, atom, is_global ? JS_ATOM_TYPE_GLOBAL_SYMBOL : JS_ATOM_TYPE_SYMBOL); } #define ATOM_GET_STR_BUF_SIZE 64 static const char *JS_AtomGetStrRT(JSRuntime *rt, char *buf, int buf_size, JSAtom atom) { if (__JS_AtomIsTaggedInt(atom)) { snprintf(buf, buf_size, "%u", __JS_AtomToUInt32(atom)); } else if (atom == JS_ATOM_NULL) { snprintf(buf, buf_size, ""); } else if (atom >= rt->atom_size) { assert(atom < rt->atom_size); snprintf(buf, buf_size, "", atom); } else { JSAtomStruct *p = rt->atom_array[atom]; *buf = '\0'; if (atom_is_free(p)) { snprintf(buf, buf_size, "", atom); } else if (p != NULL) { JSString *str = p; if (str->is_wide_char) { /* encode surrogates correctly */ utf8_encode_buf16(buf, buf_size, str16(str), str->len); } else { utf8_encode_buf8(buf, buf_size, str8(str), str->len); } } } return buf; } static const char *JS_AtomGetStr(JSContext *ctx, char *buf, int buf_size, JSAtom atom) { return JS_AtomGetStrRT(ctx->rt, buf, buf_size, atom); } static JSValue __JS_AtomToValue(JSContext *ctx, JSAtom atom, bool force_string) { char buf[ATOM_GET_STR_BUF_SIZE]; if (__JS_AtomIsTaggedInt(atom)) { size_t len = u32toa(buf, __JS_AtomToUInt32(atom)); return js_new_string8_len(ctx, buf, len); } else { JSRuntime *rt = ctx->rt; JSAtomStruct *p; assert(atom < rt->atom_size); p = rt->atom_array[atom]; if (p->atom_type == JS_ATOM_TYPE_STRING) { goto ret_string; } else if (force_string) { if (p->len == 0 && p->is_wide_char != 0) { /* no description string */ p = rt->atom_array[JS_ATOM_empty_string]; } ret_string: return js_dup(JS_MKPTR(JS_TAG_STRING, p)); } else { return js_dup(JS_MKPTR(JS_TAG_SYMBOL, p)); } } } JSValue JS_AtomToValue(JSContext *ctx, JSAtom atom) { return __JS_AtomToValue(ctx, atom, false); } JSValue JS_AtomToString(JSContext *ctx, JSAtom atom) { return __JS_AtomToValue(ctx, atom, true); } /* return true if the atom is an array index (i.e. 0 <= index <= 2^32-2 and return its value */ static bool JS_AtomIsArrayIndex(JSContext *ctx, uint32_t *pval, JSAtom atom) { if (__JS_AtomIsTaggedInt(atom)) { *pval = __JS_AtomToUInt32(atom); return true; } else { JSRuntime *rt = ctx->rt; JSAtomStruct *p; uint32_t val; assert(atom < rt->atom_size); p = rt->atom_array[atom]; if (p->atom_type == JS_ATOM_TYPE_STRING && is_num_string(&val, p) && val != -1) { *pval = val; return true; } else { *pval = 0; return false; } } } /* This test must be fast if atom is not a numeric index (e.g. a method name). Return JS_UNDEFINED if not a numeric index. JS_EXCEPTION can also be returned. */ static JSValue JS_AtomIsNumericIndex1(JSContext *ctx, JSAtom atom) { JSRuntime *rt = ctx->rt; JSAtomStruct *p1; JSString *p; int c, len, ret; JSValue num, str; if (__JS_AtomIsTaggedInt(atom)) return js_int32(__JS_AtomToUInt32(atom)); assert(atom < rt->atom_size); p1 = rt->atom_array[atom]; if (p1->atom_type != JS_ATOM_TYPE_STRING) return JS_UNDEFINED; p = p1; len = p->len; if (p->is_wide_char) { const uint16_t *r = str16(p), *r_end = str16(p) + len; if (r >= r_end) return JS_UNDEFINED; c = *r; if (c == '-') { if (r >= r_end) return JS_UNDEFINED; r++; c = *r; /* -0 case is specific */ if (c == '0' && len == 2) goto minus_zero; } /* XXX: should test NaN, but the tests do not check it */ if (!is_num(c)) { /* XXX: String should be normalized, therefore 8-bit only */ const uint16_t nfinity16[7] = { 'n', 'f', 'i', 'n', 'i', 't', 'y' }; if (!(c =='I' && (r_end - r) == 8 && !memcmp(r + 1, nfinity16, sizeof(nfinity16)))) return JS_UNDEFINED; } } else { const uint8_t *r = str8(p), *r_end = str8(p) + len; if (r >= r_end) return JS_UNDEFINED; c = *r; if (c == '-') { if (r >= r_end) return JS_UNDEFINED; r++; c = *r; /* -0 case is specific */ if (c == '0' && len == 2) { minus_zero: return js_float64(-0.0); } } if (!is_num(c)) { if (!(c =='I' && (r_end - r) == 8 && !memcmp(r + 1, "nfinity", 7))) return JS_UNDEFINED; } } /* this is ECMA CanonicalNumericIndexString primitive */ num = JS_ToNumber(ctx, JS_MKPTR(JS_TAG_STRING, p)); if (JS_IsException(num)) return num; str = JS_ToString(ctx, num); if (JS_IsException(str)) { JS_FreeValue(ctx, num); return str; } ret = js_string_eq(p, JS_VALUE_GET_STRING(str)); JS_FreeValue(ctx, str); if (ret) { return num; } else { JS_FreeValue(ctx, num); return JS_UNDEFINED; } } /* return -1 if exception or true/false */ static int JS_AtomIsNumericIndex(JSContext *ctx, JSAtom atom) { JSValue num; num = JS_AtomIsNumericIndex1(ctx, atom); if (likely(JS_IsUndefined(num))) return false; if (JS_IsException(num)) return -1; JS_FreeValue(ctx, num); return true; } void JS_FreeAtom(JSContext *ctx, JSAtom v) { if (!__JS_AtomIsConst(v)) __JS_FreeAtom(ctx->rt, v); } void JS_FreeAtomRT(JSRuntime *rt, JSAtom v) { if (!__JS_AtomIsConst(v)) __JS_FreeAtom(rt, v); } /* return true if 'v' is a symbol with a string description */ static bool JS_AtomSymbolHasDescription(JSContext *ctx, JSAtom v) { JSRuntime *rt; JSAtomStruct *p; rt = ctx->rt; if (__JS_AtomIsTaggedInt(v)) return false; p = rt->atom_array[v]; return (((p->atom_type == JS_ATOM_TYPE_SYMBOL && p->hash == JS_ATOM_HASH_SYMBOL) || p->atom_type == JS_ATOM_TYPE_GLOBAL_SYMBOL) && !(p->len == 0 && p->is_wide_char != 0)); } static __maybe_unused void print_atom(JSContext *ctx, JSAtom atom) { char buf[ATOM_GET_STR_BUF_SIZE]; const char *p; int i; /* XXX: should handle embedded null characters */ /* XXX: should move encoding code to JS_AtomGetStr */ p = JS_AtomGetStr(ctx, buf, sizeof(buf), atom); for (i = 0; p[i]; i++) { int c = (unsigned char)p[i]; if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c == '_' || c == '$') || (c >= '0' && c <= '9' && i > 0))) break; } if (i > 0 && p[i] == '\0') { printf("%s", p); } else { putchar('"'); printf("%.*s", i, p); for (; p[i]; i++) { int c = (unsigned char)p[i]; if (c == '\"' || c == '\\') { putchar('\\'); putchar(c); } else if (c >= ' ' && c <= 126) { putchar(c); } else if (c == '\n') { putchar('\\'); putchar('n'); } else { printf("\\u%04x", c); } } putchar('\"'); } } /* free with JS_FreeCString() */ const char *JS_AtomToCStringLen(JSContext *ctx, size_t *plen, JSAtom atom) { JSValue str; const char *cstr; str = JS_AtomToString(ctx, atom); if (JS_IsException(str)) { if (plen) *plen = 0; return NULL; } cstr = JS_ToCStringLen(ctx, plen, str); JS_FreeValue(ctx, str); return cstr; } #ifndef QJS_DISABLE_PARSER /* return a string atom containing name concatenated with str1 */ /* `str1` may be pure ASCII or UTF-8 encoded */ // TODO(chqrlie): use string concatenation instead of UTF-8 conversion static JSAtom js_atom_concat_str(JSContext *ctx, JSAtom name, const char *str1) { JSValue str; JSAtom atom; const char *cstr; char *cstr2; size_t len, len1; str = JS_AtomToString(ctx, name); if (JS_IsException(str)) return JS_ATOM_NULL; cstr = JS_ToCStringLen(ctx, &len, str); if (!cstr) goto fail; len1 = strlen(str1); cstr2 = js_malloc(ctx, len + len1 + 1); if (!cstr2) goto fail; memcpy(cstr2, cstr, len); memcpy(cstr2 + len, str1, len1); cstr2[len + len1] = '\0'; atom = JS_NewAtomLen(ctx, cstr2, len + len1); js_free(ctx, cstr2); JS_FreeCString(ctx, cstr); JS_FreeValue(ctx, str); return atom; fail: JS_FreeCString(ctx, cstr); JS_FreeValue(ctx, str); return JS_ATOM_NULL; } static JSAtom js_atom_concat_num(JSContext *ctx, JSAtom name, uint32_t n) { char buf[16]; size_t len; len = u32toa(buf, n); buf[len] = '\0'; return js_atom_concat_str(ctx, name, buf); } #endif // QJS_DISABLE_PARSER static inline bool JS_IsEmptyString(JSValueConst v) { return JS_VALUE_GET_TAG(v) == JS_TAG_STRING && JS_VALUE_GET_STRING(v)->len == 0; } /* JSClass support */ /* a new class ID is allocated if *pclass_id == 0, otherwise *pclass_id is left unchanged */ JSClassID JS_NewClassID(JSRuntime *rt, JSClassID *pclass_id) { JSClassID class_id = *pclass_id; if (class_id == 0) { class_id = rt->js_class_id_alloc++; *pclass_id = class_id; } return class_id; } JSClassID JS_GetClassID(JSValueConst v) { JSObject *p; if (JS_VALUE_GET_TAG(v) != JS_TAG_OBJECT) return JS_INVALID_CLASS_ID; p = JS_VALUE_GET_OBJ(v); return p->class_id; } bool JS_IsRegisteredClass(JSRuntime *rt, JSClassID class_id) { return (class_id < rt->class_count && rt->class_array[class_id].class_id != 0); } /* create a new object internal class. Return -1 if error, 0 if OK. The finalizer can be NULL if none is needed. */ static int JS_NewClass1(JSRuntime *rt, JSClassID class_id, const JSClassDef *class_def, JSAtom name) { int new_size, i; JSClass *cl, *new_class_array; struct list_head *el; if (class_id >= (1 << 16)) return -1; if (class_id < rt->class_count && rt->class_array[class_id].class_id != 0) return -1; if (class_id >= rt->class_count) { new_size = max_int(JS_CLASS_INIT_COUNT, max_int(class_id + 1, rt->class_count * 3 / 2)); /* reallocate the context class prototype array, if any */ list_for_each(el, &rt->context_list) { JSContext *ctx = list_entry(el, JSContext, link); JSValue *new_tab; new_tab = js_realloc_rt(rt, ctx->class_proto, sizeof(ctx->class_proto[0]) * new_size); if (!new_tab) return -1; for(i = rt->class_count; i < new_size; i++) new_tab[i] = JS_NULL; ctx->class_proto = new_tab; } /* reallocate the class array */ new_class_array = js_realloc_rt(rt, rt->class_array, sizeof(JSClass) * new_size); if (!new_class_array) return -1; memset(new_class_array + rt->class_count, 0, (new_size - rt->class_count) * sizeof(JSClass)); rt->class_array = new_class_array; rt->class_count = new_size; } cl = &rt->class_array[class_id]; cl->class_id = class_id; cl->class_name = JS_DupAtomRT(rt, name); cl->finalizer = class_def->finalizer; cl->gc_mark = class_def->gc_mark; cl->call = class_def->call; cl->exotic = class_def->exotic; return 0; } int JS_NewClass(JSRuntime *rt, JSClassID class_id, const JSClassDef *class_def) { int ret, len; JSAtom name; // XXX: class_def->class_name must be raw 8-bit contents. No UTF-8 encoded strings len = strlen(class_def->class_name); name = __JS_FindAtom(rt, class_def->class_name, len, JS_ATOM_TYPE_STRING); if (name == JS_ATOM_NULL) { name = __JS_NewAtomInit(rt, class_def->class_name, len, JS_ATOM_TYPE_STRING); if (name == JS_ATOM_NULL) return -1; } ret = JS_NewClass1(rt, class_id, class_def, name); JS_FreeAtomRT(rt, name); return ret; } static inline JSValue js_empty_string(JSRuntime *rt) { JSAtomStruct *p = rt->atom_array[JS_ATOM_empty_string]; return js_dup(JS_MKPTR(JS_TAG_STRING, p)); } // XXX: `buf` contains raw 8-bit data, no UTF-8 decoding is performed // XXX: no special case for len == 0 static JSValue js_new_string8_len(JSContext *ctx, const char *buf, int len) { JSString *str; str = js_alloc_string(ctx, len, 0); if (!str) return JS_EXCEPTION; memcpy(str8(str), buf, len); str8(str)[len] = '\0'; return JS_MKPTR(JS_TAG_STRING, str); } // XXX: `buf` contains raw 8-bit data, no UTF-8 decoding is performed // XXX: no special case for the empty string static inline JSValue js_new_string8(JSContext *ctx, const char *str) { return js_new_string8_len(ctx, str, strlen(str)); } static JSValue js_new_string16_len(JSContext *ctx, const uint16_t *buf, int len) { JSString *str; str = js_alloc_string(ctx, len, 1); if (!str) return JS_EXCEPTION; memcpy(str16(str), buf, len * 2); return JS_MKPTR(JS_TAG_STRING, str); } static JSValue js_new_string_char(JSContext *ctx, uint16_t c) { if (c < 0x100) { char ch8 = c; return js_new_string8_len(ctx, &ch8, 1); } else { uint16_t ch16 = c; return js_new_string16_len(ctx, &ch16, 1); } } static JSValue js_sub_string(JSContext *ctx, JSString *p, int start, int end) { JSStringSlice *slice; JSString *q; int len; len = end - start; if (start == 0 && end == p->len) { return js_dup(JS_MKPTR(JS_TAG_STRING, p)); } if (len <= 0) { return js_empty_string(ctx->rt); } if (len > (JS_STRING_SLICE_LEN_MAX >> p->is_wide_char)) { if (p->kind == JS_STRING_KIND_SLICE) { slice = (void *)&p[1]; p = slice->parent; start += slice->start >> p->is_wide_char; // bytes -> chars } // allocate as 16 bit wide string to avoid wastage; // js_alloc_string allocates 1 byte extra for 8 bit strings; q = js_alloc_string(ctx, sizeof(*slice)/2, /*is_wide_char*/true); if (!q) return JS_EXCEPTION; q->is_wide_char = p->is_wide_char; q->kind = JS_STRING_KIND_SLICE; q->len = len; slice = (void *)&q[1]; slice->parent = p; slice->start = start << p->is_wide_char; // chars -> bytes p->header.ref_count++; return JS_MKPTR(JS_TAG_STRING, q); } if (p->is_wide_char) { JSString *str; int i; uint16_t c = 0; for (i = start; i < end; i++) { c |= str16(p)[i]; } if (c > 0xFF) return js_new_string16_len(ctx, str16(p) + start, len); str = js_alloc_string(ctx, len, 0); if (!str) return JS_EXCEPTION; for (i = 0; i < len; i++) { str8(str)[i] = str16(p)[start + i]; } str8(str)[len] = '\0'; return JS_MKPTR(JS_TAG_STRING, str); } else { return js_new_string8_len(ctx, (const char *)(str8(p) + start), len); } } typedef struct StringBuffer { JSContext *ctx; JSString *str; int len; int size; int is_wide_char; int error_status; } StringBuffer; /* It is valid to call string_buffer_end() and all string_buffer functions even if string_buffer_init() or another string_buffer function returns an error. If the error_status is set, string_buffer_end() returns JS_EXCEPTION. */ static int string_buffer_init2(JSContext *ctx, StringBuffer *s, int size, int is_wide) { s->ctx = ctx; s->size = size; s->len = 0; s->is_wide_char = is_wide; s->error_status = 0; s->str = js_alloc_string(ctx, size, is_wide); if (unlikely(!s->str)) { s->size = 0; return s->error_status = -1; } #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS /* the StringBuffer may reallocate the JSString, only link it at the end */ list_del(&s->str->link); #endif return 0; } static inline int string_buffer_init(JSContext *ctx, StringBuffer *s, int size) { return string_buffer_init2(ctx, s, size, 0); } static void string_buffer_free(StringBuffer *s) { js_free(s->ctx, s->str); s->str = NULL; } static int string_buffer_set_error(StringBuffer *s) { js_free(s->ctx, s->str); s->str = NULL; s->size = 0; s->len = 0; return s->error_status = -1; } static no_inline int string_buffer_widen(StringBuffer *s, int size) { JSString *str; size_t slack; int i; if (s->error_status) return -1; str = js_realloc2(s->ctx, s->str, sizeof(JSString) + (size << 1), &slack); if (!str) return string_buffer_set_error(s); size += slack >> 1; for(i = s->len; i-- > 0;) { str16(str)[i] = str8(str)[i]; } s->is_wide_char = 1; s->size = size; s->str = str; return 0; } static no_inline int string_buffer_realloc(StringBuffer *s, int new_len, int c) { JSString *new_str; int new_size; size_t new_size_bytes, slack; if (s->error_status) return -1; if (new_len > JS_STRING_LEN_MAX) { JS_ThrowRangeError(s->ctx, "invalid string length"); return string_buffer_set_error(s); } new_size = min_int(max_int(new_len, s->size * 3 / 2), JS_STRING_LEN_MAX); if (!s->is_wide_char && c >= 0x100) { return string_buffer_widen(s, new_size); } new_size_bytes = sizeof(JSString) + (new_size << s->is_wide_char) + 1 - s->is_wide_char; new_str = js_realloc2(s->ctx, s->str, new_size_bytes, &slack); if (!new_str) return string_buffer_set_error(s); new_size = min_int(new_size + (slack >> s->is_wide_char), JS_STRING_LEN_MAX); s->size = new_size; s->str = new_str; return 0; } static no_inline int string_buffer_putc_slow(StringBuffer *s, uint32_t c) { if (unlikely(s->len >= s->size)) { if (string_buffer_realloc(s, s->len + 1, c)) return -1; } if (s->is_wide_char) { str16(s->str)[s->len++] = c; } else if (c < 0x100) { str8(s->str)[s->len++] = c; } else { if (string_buffer_widen(s, s->size)) return -1; str16(s->str)[s->len++] = c; } return 0; } /* 0 <= c <= 0xff */ static int string_buffer_putc8(StringBuffer *s, uint32_t c) { if (unlikely(s->len >= s->size)) { if (string_buffer_realloc(s, s->len + 1, c)) return -1; } if (s->is_wide_char) { str16(s->str)[s->len++] = c; } else { str8(s->str)[s->len++] = c; } return 0; } /* 0 <= c <= 0xffff */ static int string_buffer_putc16(StringBuffer *s, uint32_t c) { if (likely(s->len < s->size)) { if (s->is_wide_char) { str16(s->str)[s->len++] = c; return 0; } else if (c < 0x100) { str8(s->str)[s->len++] = c; return 0; } } return string_buffer_putc_slow(s, c); } /* 0 <= c <= 0x10ffff */ static int string_buffer_putc(StringBuffer *s, uint32_t c) { if (unlikely(c >= 0x10000)) { /* surrogate pair */ if (string_buffer_putc16(s, get_hi_surrogate(c))) return -1; c = get_lo_surrogate(c); } return string_buffer_putc16(s, c); } static int string_getc(JSString *p, int *pidx) { int idx, c, c1; idx = *pidx; if (p->is_wide_char) { c = str16(p)[idx++]; if (is_hi_surrogate(c) && idx < p->len) { c1 = str16(p)[idx]; if (is_lo_surrogate(c1)) { c = from_surrogate(c, c1); idx++; } } } else { c = str8(p)[idx++]; } *pidx = idx; return c; } static int string_buffer_write8(StringBuffer *s, const uint8_t *p, int len) { int i; if (s->len + len > s->size) { if (string_buffer_realloc(s, s->len + len, 0)) return -1; } if (s->is_wide_char) { for (i = 0; i < len; i++) { str16(s->str)[s->len + i] = p[i]; } s->len += len; } else { memcpy(&str8(s->str)[s->len], p, len); s->len += len; } return 0; } static int string_buffer_write16(StringBuffer *s, const uint16_t *p, int len) { int c = 0, i; for (i = 0; i < len; i++) { c |= p[i]; } if (s->len + len > s->size) { if (string_buffer_realloc(s, s->len + len, c)) return -1; } else if (!s->is_wide_char && c >= 0x100) { if (string_buffer_widen(s, s->size)) return -1; } if (s->is_wide_char) { memcpy(&str16(s->str)[s->len], p, len << 1); s->len += len; } else { for (i = 0; i < len; i++) { str8(s->str)[s->len + i] = p[i]; } s->len += len; } return 0; } /* appending an ASCII string */ static int string_buffer_puts8(StringBuffer *s, const char *str) { return string_buffer_write8(s, (const uint8_t *)str, strlen(str)); } static int string_buffer_concat(StringBuffer *s, JSString *p, uint32_t from, uint32_t to) { if (to <= from) return 0; if (p->is_wide_char) return string_buffer_write16(s, str16(p) + from, to - from); else return string_buffer_write8(s, str8(p) + from, to - from); } static int string_buffer_concat_value(StringBuffer *s, JSValueConst v) { JSString *p; JSValue v1; int res; if (s->error_status) { /* prevent exception overload */ return -1; } if (unlikely(JS_VALUE_GET_TAG(v) != JS_TAG_STRING)) { v1 = JS_ToString(s->ctx, v); if (JS_IsException(v1)) return string_buffer_set_error(s); p = JS_VALUE_GET_STRING(v1); res = string_buffer_concat(s, p, 0, p->len); JS_FreeValue(s->ctx, v1); return res; } p = JS_VALUE_GET_STRING(v); return string_buffer_concat(s, p, 0, p->len); } static int string_buffer_concat_value_free(StringBuffer *s, JSValue v) { JSString *p; int res; if (s->error_status) { /* prevent exception overload */ JS_FreeValue(s->ctx, v); return -1; } if (unlikely(JS_VALUE_GET_TAG(v) != JS_TAG_STRING)) { v = JS_ToStringFree(s->ctx, v); if (JS_IsException(v)) return string_buffer_set_error(s); } p = JS_VALUE_GET_STRING(v); res = string_buffer_concat(s, p, 0, p->len); JS_FreeValue(s->ctx, v); return res; } static int string_buffer_fill(StringBuffer *s, int c, int count) { /* XXX: optimize */ if (s->len + count > s->size) { if (string_buffer_realloc(s, s->len + count, c)) return -1; } while (count-- > 0) { if (string_buffer_putc16(s, c)) return -1; } return 0; } static JSValue string_buffer_end(StringBuffer *s) { JSString *str; str = s->str; if (s->error_status) return JS_EXCEPTION; if (s->len == 0) { js_free(s->ctx, str); s->str = NULL; return js_empty_string(s->ctx->rt); } if (s->len < s->size) { /* smaller size so js_realloc should not fail, but OK if it does */ /* XXX: should add some slack to avoid unnecessary calls */ /* XXX: might need to use malloc+free to ensure smaller size */ str = js_realloc_rt(s->ctx->rt, str, sizeof(JSString) + (s->len << s->is_wide_char) + 1 - s->is_wide_char); if (str == NULL) str = s->str; s->str = str; } if (!s->is_wide_char) str8(str)[s->len] = 0; #ifdef ENABLE_DUMPS // JS_DUMP_LEAKS list_add_tail(&str->link, &s->ctx->rt->string_list); #endif str->is_wide_char = s->is_wide_char; str->len = s->len; s->str = NULL; return JS_MKPTR(JS_TAG_STRING, str); } /* create a string from a UTF-8 buffer */ JSValue JS_NewStringLen(JSContext *ctx, const char *buf, size_t buf_len) { JSString *str; size_t len; int kind; if (buf_len <= 0) { return js_empty_string(ctx->rt); } /* Compute string kind and length: 7-bit, 8-bit, 16-bit, 16-bit UTF-16 */ kind = utf8_scan(buf, buf_len, &len); if (len > JS_STRING_LEN_MAX) return JS_ThrowRangeError(ctx, "invalid string length"); switch (kind) { case UTF8_PLAIN_ASCII: str = js_alloc_string(ctx, len, 0); if (!str) return JS_EXCEPTION; memcpy(str8(str), buf, len); str8(str)[len] = '\0'; break; case UTF8_NON_ASCII: /* buf contains non-ASCII code-points, but limited to 8-bit values */ str = js_alloc_string(ctx, len, 0); if (!str) return JS_EXCEPTION; utf8_decode_buf8(str8(str), len + 1, buf, buf_len); break; default: // This causes a potential problem in JS_ThrowError if message is invalid //if (kind & UTF8_HAS_ERRORS) // return JS_ThrowRangeError(ctx, "invalid UTF-8 sequence"); str = js_alloc_string(ctx, len, 1); if (!str) return JS_EXCEPTION; utf8_decode_buf16(str16(str), len, buf, buf_len); break; } return JS_MKPTR(JS_TAG_STRING, str); } JSValue JS_NewTwoByteString(JSContext *ctx, const uint16_t *buf, size_t len) { JSString *str; if (!len) return js_empty_string(ctx->rt); str = js_alloc_string(ctx, len, 1); if (!str) return JS_EXCEPTION; memcpy(str16(str), buf, len * sizeof(*buf)); return JS_MKPTR(JS_TAG_STRING, str); } static JSValue JS_ConcatString3(JSContext *ctx, const char *str1, JSValue str2, const char *str3) { StringBuffer b_s, *b = &b_s; int len1, len3; JSString *p; if (unlikely(JS_VALUE_GET_TAG(str2) != JS_TAG_STRING)) { str2 = JS_ToStringFree(ctx, str2); if (JS_IsException(str2)) goto fail; } p = JS_VALUE_GET_STRING(str2); len1 = strlen(str1); len3 = strlen(str3); if (string_buffer_init2(ctx, b, len1 + p->len + len3, p->is_wide_char)) goto fail; string_buffer_write8(b, (const uint8_t *)str1, len1); string_buffer_concat(b, p, 0, p->len); string_buffer_write8(b, (const uint8_t *)str3, len3); JS_FreeValue(ctx, str2); return string_buffer_end(b); fail: JS_FreeValue(ctx, str2); return JS_EXCEPTION; } /* `str` may be pure ASCII or UTF-8 encoded */ JSValue JS_NewAtomString(JSContext *ctx, const char *str) { JSAtom atom = JS_NewAtom(ctx, str); if (atom == JS_ATOM_NULL) return JS_EXCEPTION; JSValue val = JS_AtomToString(ctx, atom); JS_FreeAtom(ctx, atom); return val; } /* return (NULL, 0) if exception. */ /* return pointer into a JSString with a live ref_count */ /* cesu8 determines if non-BMP1 codepoints are encoded as 1 or 2 utf-8 sequences */ const char *JS_ToCStringLen2(JSContext *ctx, size_t *plen, JSValueConst val1, bool cesu8) { JSValue val; JSString *str, *str_new; int pos, len, c, c1; JSObject *p; uint8_t *q; if (JS_VALUE_GET_TAG(val1) == JS_TAG_STRING) { val = js_dup(val1); goto go; } val = JS_ToString(ctx, val1); if (!JS_IsException(val)) goto go; // Stringification can fail when there is an exception pending, // e.g. a stack overflow InternalError. Special-case exception // objects to make debugging easier, look up the .message property // and stringify that. if (JS_VALUE_GET_TAG(val1) != JS_TAG_OBJECT) goto fail; p = JS_VALUE_GET_OBJ(val1); if (p->class_id != JS_CLASS_ERROR) goto fail; val = JS_GetProperty(ctx, val1, JS_ATOM_message); if (JS_VALUE_GET_TAG(val) != JS_TAG_STRING) { JS_FreeValue(ctx, val); goto fail; } go: str = JS_VALUE_GET_STRING(val); len = str->len; if (!str->is_wide_char) { const uint8_t *src = str8(str); int count; /* count the number of non-ASCII characters */ /* Scanning the whole string is required for ASCII strings, and computing the number of non-ASCII bytes is less expensive than testing each byte, hence this method is faster for ASCII strings, which is the most common case. */ count = 0; for (pos = 0; pos < len; pos++) { count += src[pos] >> 7; } if (count == 0 && str->kind == JS_STRING_KIND_NORMAL) { if (plen) *plen = len; return (const char *)src; } str_new = js_alloc_string(ctx, len + count, 0); if (!str_new) goto fail; q = str8(str_new); for (pos = 0; pos < len; pos++) { c = src[pos]; if (c < 0x80) { *q++ = c; } else { *q++ = (c >> 6) | 0xc0; *q++ = (c & 0x3f) | 0x80; } } } else { const uint16_t *src = str16(str); /* Allocate 3 bytes per 16 bit code point. Surrogate pairs may produce 4 bytes but use 2 code points. */ str_new = js_alloc_string(ctx, len * 3, 0); if (!str_new) goto fail; q = str8(str_new); pos = 0; while (pos < len) { c = src[pos++]; if (c < 0x80) { *q++ = c; } else { if (is_hi_surrogate(c)) { if (pos < len && !cesu8) { c1 = src[pos]; if (is_lo_surrogate(c1)) { pos++; c = from_surrogate(c, c1); } else { /* Keep unmatched surrogate code points */ /* c = 0xfffd; */ /* error */ } } else { /* Keep unmatched surrogate code points */ /* c = 0xfffd; */ /* error */ } } q += utf8_encode(q, c); } } } *q = '\0'; str_new->len = q - str8(str_new); JS_FreeValue(ctx, val); if (plen) *plen = str_new->len; return (const char *)str8(str_new); fail: if (plen) *plen = 0; return NULL; } void JS_FreeCString(JSContext *ctx, const char *ptr) { if (!ptr) return; /* purposely removing constness */ JS_FreeValue(ctx, JS_MKPTR(JS_TAG_STRING, (JSString *)ptr - 1)); } static int memcmp16_8(const uint16_t *src1, const uint8_t *src2, int len) { int c, i; for(i = 0; i < len; i++) { c = src1[i] - src2[i]; if (c != 0) return c; } return 0; } static int memcmp16(const uint16_t *src1, const uint16_t *src2, int len) { int c, i; for(i = 0; i < len; i++) { c = src1[i] - src2[i]; if (c != 0) return c; } return 0; } static int js_string_memcmp(JSString *p1, JSString *p2, int len) { int res; if (likely(!p1->is_wide_char)) { if (likely(!p2->is_wide_char)) res = memcmp(str8(p1), str8(p2), len); else res = -memcmp16_8(str16(p2), str8(p1), len); } else { if (!p2->is_wide_char) res = memcmp16_8(str16(p1), str8(p2), len); else res = memcmp16(str16(p1), str16(p2), len); } return res; } static bool js_string_eq(JSString *p1, JSString *p2) { if (p1->len != p2->len) return false; return js_string_memcmp(p1, p2, p1->len) == 0; } /* return < 0, 0 or > 0 */ static int js_string_compare(JSString *p1, JSString *p2) { int res, len; len = min_int(p1->len, p2->len); res = js_string_memcmp(p1, p2, len); if (res == 0) res = compare_u32(p1->len, p2->len); return res; } static void copy_str16(uint16_t *dst, JSString *p, int offset, int len) { if (p->is_wide_char) { memcpy(dst, str16(p) + offset, len * 2); } else { const uint8_t *src1 = str8(p) + offset; int i; for(i = 0; i < len; i++) dst[i] = src1[i]; } } static JSValue JS_ConcatString1(JSContext *ctx, JSString *p1, JSString *p2) { JSString *p; uint32_t len; int is_wide_char; len = p1->len + p2->len; if (len > JS_STRING_LEN_MAX) return JS_ThrowRangeError(ctx, "invalid string length"); is_wide_char = p1->is_wide_char | p2->is_wide_char; p = js_alloc_string(ctx, len, is_wide_char); if (!p) return JS_EXCEPTION; if (!is_wide_char) { memcpy(str8(p), str8(p1), p1->len); memcpy(str8(p) + p1->len, str8(p2), p2->len); str8(p)[len] = '\0'; } else { copy_str16(str16(p), p1, 0, p1->len); copy_str16(str16(p) + p1->len, p2, 0, p2->len); } return JS_MKPTR(JS_TAG_STRING, p); } /* op1 and op2 are converted to strings. For convience, op1 or op2 = JS_EXCEPTION are accepted and return JS_EXCEPTION. */ static JSValue JS_ConcatString(JSContext *ctx, JSValue op1, JSValue op2) { JSValue ret; JSString *p1, *p2; if (unlikely(JS_VALUE_GET_TAG(op1) != JS_TAG_STRING)) { op1 = JS_ToStringFree(ctx, op1); if (JS_IsException(op1)) { JS_FreeValue(ctx, op2); return JS_EXCEPTION; } } if (unlikely(JS_VALUE_GET_TAG(op2) != JS_TAG_STRING)) { op2 = JS_ToStringFree(ctx, op2); if (JS_IsException(op2)) { JS_FreeValue(ctx, op1); return JS_EXCEPTION; } } p1 = JS_VALUE_GET_STRING(op1); p2 = JS_VALUE_GET_STRING(op2); /* XXX: could also check if p1 is empty */ if (p2->len == 0) { goto ret_op1; } if (p1->header.ref_count == 1 && p1->is_wide_char == p2->is_wide_char && js_malloc_usable_size(ctx, p1) >= sizeof(*p1) + ((p1->len + p2->len) << p2->is_wide_char) + 1 - p1->is_wide_char) { /* Concatenate in place in available space at the end of p1 */ if (p1->is_wide_char) { memcpy(str16(p1) + p1->len, str16(p2), p2->len << 1); p1->len += p2->len; } else { memcpy(str8(p1) + p1->len, str8(p2), p2->len); p1->len += p2->len; str8(p1)[p1->len] = '\0'; } ret_op1: JS_FreeValue(ctx, op2); return op1; } ret = JS_ConcatString1(ctx, p1, p2); JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); return ret; } /* Shape support */ static inline size_t get_shape_size(size_t hash_size, size_t prop_size) { return hash_size * sizeof(uint32_t) + sizeof(JSShape) + prop_size * sizeof(JSShapeProperty); } static inline JSShape *get_shape_from_alloc(void *sh_alloc, size_t hash_size) { return (JSShape *)(void *)((uint32_t *)sh_alloc + hash_size); } static inline uint32_t *prop_hash_end(JSShape *sh) { return (uint32_t *)sh; } static inline void *get_alloc_from_shape(JSShape *sh) { return prop_hash_end(sh) - ((intptr_t)sh->prop_hash_mask + 1); } static inline JSShapeProperty *get_shape_prop(JSShape *sh) { return sh->prop; } static int init_shape_hash(JSRuntime *rt) { rt->shape_hash_bits = 6; /* 64 shapes */ rt->shape_hash_size = 1 << rt->shape_hash_bits; rt->shape_hash_count = 0; rt->shape_hash = js_mallocz_rt(rt, sizeof(rt->shape_hash[0]) * rt->shape_hash_size); if (!rt->shape_hash) return -1; return 0; } /* same magic hash multiplier as the Linux kernel */ static uint32_t shape_hash(uint32_t h, uint32_t val) { return (h + val) * 0x9e370001; } /* truncate the shape hash to 'hash_bits' bits */ static uint32_t get_shape_hash(uint32_t h, int hash_bits) { return h >> (32 - hash_bits); } static uint32_t shape_initial_hash(JSObject *proto) { uint32_t h; h = shape_hash(1, (uintptr_t)proto); if (sizeof(proto) > 4) h = shape_hash(h, (uint64_t)(uintptr_t)proto >> 32); return h; } static int resize_shape_hash(JSRuntime *rt, int new_shape_hash_bits) { int new_shape_hash_size, i; uint32_t h; JSShape **new_shape_hash, *sh, *sh_next; new_shape_hash_size = 1 << new_shape_hash_bits; new_shape_hash = js_mallocz_rt(rt, sizeof(rt->shape_hash[0]) * new_shape_hash_size); if (!new_shape_hash) return -1; for(i = 0; i < rt->shape_hash_size; i++) { for(sh = rt->shape_hash[i]; sh != NULL; sh = sh_next) { sh_next = sh->shape_hash_next; h = get_shape_hash(sh->hash, new_shape_hash_bits); sh->shape_hash_next = new_shape_hash[h]; new_shape_hash[h] = sh; } } js_free_rt(rt, rt->shape_hash); rt->shape_hash_bits = new_shape_hash_bits; rt->shape_hash_size = new_shape_hash_size; rt->shape_hash = new_shape_hash; return 0; } static void js_shape_hash_link(JSRuntime *rt, JSShape *sh) { uint32_t h; h = get_shape_hash(sh->hash, rt->shape_hash_bits); sh->shape_hash_next = rt->shape_hash[h]; rt->shape_hash[h] = sh; rt->shape_hash_count++; } static void js_shape_hash_unlink(JSRuntime *rt, JSShape *sh) { uint32_t h; JSShape **psh; h = get_shape_hash(sh->hash, rt->shape_hash_bits); psh = &rt->shape_hash[h]; while (*psh != sh) psh = &(*psh)->shape_hash_next; *psh = sh->shape_hash_next; rt->shape_hash_count--; } /* create a new empty shape with prototype 'proto' */ static no_inline JSShape *js_new_shape2(JSContext *ctx, JSObject *proto, int hash_size, int prop_size) { JSRuntime *rt = ctx->rt; void *sh_alloc; JSShape *sh; /* resize the shape hash table if necessary */ if (2 * (rt->shape_hash_count + 1) > rt->shape_hash_size) { resize_shape_hash(rt, rt->shape_hash_bits + 1); } sh_alloc = js_malloc(ctx, get_shape_size(hash_size, prop_size)); if (!sh_alloc) return NULL; sh = get_shape_from_alloc(sh_alloc, hash_size); sh->header.ref_count = 1; add_gc_object(rt, &sh->header, JS_GC_OBJ_TYPE_SHAPE); if (proto) js_dup(JS_MKPTR(JS_TAG_OBJECT, proto)); sh->proto = proto; memset(prop_hash_end(sh) - hash_size, 0, sizeof(prop_hash_end(sh)[0]) * hash_size); sh->prop_hash_mask = hash_size - 1; sh->prop_size = prop_size; sh->prop_count = 0; sh->deleted_prop_count = 0; /* insert in the hash table */ sh->hash = shape_initial_hash(proto); sh->is_hashed = true; sh->has_small_array_index = false; js_shape_hash_link(ctx->rt, sh); return sh; } static JSShape *js_new_shape(JSContext *ctx, JSObject *proto) { return js_new_shape2(ctx, proto, JS_PROP_INITIAL_HASH_SIZE, JS_PROP_INITIAL_SIZE); } /* The shape is cloned. The new shape is not inserted in the shape hash table */ static JSShape *js_clone_shape(JSContext *ctx, JSShape *sh1) { JSShape *sh; void *sh_alloc, *sh_alloc1; size_t size; JSShapeProperty *pr; uint32_t i, hash_size; hash_size = sh1->prop_hash_mask + 1; size = get_shape_size(hash_size, sh1->prop_size); sh_alloc = js_malloc(ctx, size); if (!sh_alloc) return NULL; sh_alloc1 = get_alloc_from_shape(sh1); memcpy(sh_alloc, sh_alloc1, size); sh = get_shape_from_alloc(sh_alloc, hash_size); sh->header.ref_count = 1; add_gc_object(ctx->rt, &sh->header, JS_GC_OBJ_TYPE_SHAPE); sh->is_hashed = false; if (sh->proto) { js_dup(JS_MKPTR(JS_TAG_OBJECT, sh->proto)); } for(i = 0, pr = get_shape_prop(sh); i < sh->prop_count; i++, pr++) { JS_DupAtom(ctx, pr->atom); } return sh; } static JSShape *js_dup_shape(JSShape *sh) { sh->header.ref_count++; return sh; } static void js_free_shape0(JSRuntime *rt, JSShape *sh) { uint32_t i; JSShapeProperty *pr; assert(sh->header.ref_count == 0); if (sh->is_hashed) js_shape_hash_unlink(rt, sh); if (sh->proto != NULL) { JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, sh->proto)); } pr = get_shape_prop(sh); for(i = 0; i < sh->prop_count; i++) { JS_FreeAtomRT(rt, pr->atom); pr++; } remove_gc_object(&sh->header); js_free_rt(rt, get_alloc_from_shape(sh)); } static void js_free_shape(JSRuntime *rt, JSShape *sh) { if (unlikely(--sh->header.ref_count <= 0)) { js_free_shape0(rt, sh); } } static void js_free_shape_null(JSRuntime *rt, JSShape *sh) { if (sh) js_free_shape(rt, sh); } /* make space to hold at least 'count' properties */ static no_inline int resize_properties(JSContext *ctx, JSShape **psh, JSObject *p, uint32_t count) { JSShape *sh; uint32_t new_size, new_hash_size, new_hash_mask, i; JSShapeProperty *pr; void *sh_alloc; intptr_t h; sh = *psh; new_size = max_int(count, sh->prop_size * 3 / 2); /* Reallocate prop array first to avoid crash or size inconsistency in case of memory allocation failure */ if (p) { JSProperty *new_prop; new_prop = js_realloc(ctx, p->prop, sizeof(new_prop[0]) * new_size); if (unlikely(!new_prop)) return -1; p->prop = new_prop; } new_hash_size = sh->prop_hash_mask + 1; while (new_hash_size < new_size) new_hash_size = 2 * new_hash_size; if (new_hash_size != (sh->prop_hash_mask + 1)) { JSShape *old_sh; /* resize the hash table and the properties */ old_sh = sh; sh_alloc = js_malloc(ctx, get_shape_size(new_hash_size, new_size)); if (!sh_alloc) return -1; sh = get_shape_from_alloc(sh_alloc, new_hash_size); list_del(&old_sh->header.link); /* copy all the fields and the properties */ memcpy(sh, old_sh, sizeof(JSShape) + sizeof(sh->prop[0]) * old_sh->prop_count); list_add_tail(&sh->header.link, &ctx->rt->gc_obj_list); new_hash_mask = new_hash_size - 1; sh->prop_hash_mask = new_hash_mask; memset(prop_hash_end(sh) - new_hash_size, 0, sizeof(prop_hash_end(sh)[0]) * new_hash_size); for(i = 0, pr = sh->prop; i < sh->prop_count; i++, pr++) { if (pr->atom != JS_ATOM_NULL) { h = ((uintptr_t)pr->atom & new_hash_mask); pr->hash_next = prop_hash_end(sh)[-h - 1]; prop_hash_end(sh)[-h - 1] = i + 1; } } js_free(ctx, get_alloc_from_shape(old_sh)); } else { /* only resize the properties */ list_del(&sh->header.link); sh_alloc = js_realloc(ctx, get_alloc_from_shape(sh), get_shape_size(new_hash_size, new_size)); if (unlikely(!sh_alloc)) { /* insert again in the GC list */ list_add_tail(&sh->header.link, &ctx->rt->gc_obj_list); return -1; } sh = get_shape_from_alloc(sh_alloc, new_hash_size); list_add_tail(&sh->header.link, &ctx->rt->gc_obj_list); } *psh = sh; sh->prop_size = new_size; return 0; } /* remove the deleted properties. */ static int compact_properties(JSContext *ctx, JSObject *p) { JSShape *sh, *old_sh; void *sh_alloc; intptr_t h; uint32_t new_hash_size, i, j, new_hash_mask, new_size; JSShapeProperty *old_pr, *pr; JSProperty *prop, *new_prop; sh = p->shape; assert(!sh->is_hashed); new_size = max_int(JS_PROP_INITIAL_SIZE, sh->prop_count - sh->deleted_prop_count); assert(new_size <= sh->prop_size); new_hash_size = sh->prop_hash_mask + 1; while ((new_hash_size / 2) >= new_size) new_hash_size = new_hash_size / 2; new_hash_mask = new_hash_size - 1; /* resize the hash table and the properties */ old_sh = sh; sh_alloc = js_malloc(ctx, get_shape_size(new_hash_size, new_size)); if (!sh_alloc) return -1; sh = get_shape_from_alloc(sh_alloc, new_hash_size); list_del(&old_sh->header.link); memcpy(sh, old_sh, sizeof(JSShape)); list_add_tail(&sh->header.link, &ctx->rt->gc_obj_list); memset(prop_hash_end(sh) - new_hash_size, 0, sizeof(prop_hash_end(sh)[0]) * new_hash_size); j = 0; old_pr = old_sh->prop; pr = sh->prop; prop = p->prop; for(i = 0; i < sh->prop_count; i++) { if (old_pr->atom != JS_ATOM_NULL) { pr->atom = old_pr->atom; pr->flags = old_pr->flags; h = ((uintptr_t)old_pr->atom & new_hash_mask); pr->hash_next = prop_hash_end(sh)[-h - 1]; prop_hash_end(sh)[-h - 1] = j + 1; prop[j] = prop[i]; j++; pr++; } old_pr++; } assert(j == (sh->prop_count - sh->deleted_prop_count)); sh->prop_hash_mask = new_hash_mask; sh->prop_size = new_size; sh->deleted_prop_count = 0; sh->prop_count = j; p->shape = sh; js_free(ctx, get_alloc_from_shape(old_sh)); /* reduce the size of the object properties */ new_prop = js_realloc(ctx, p->prop, sizeof(new_prop[0]) * new_size); if (new_prop) p->prop = new_prop; return 0; } static int add_shape_property(JSContext *ctx, JSShape **psh, JSObject *p, JSAtom atom, int prop_flags) { JSRuntime *rt = ctx->rt; JSShape *sh = *psh; JSShapeProperty *pr, *prop; uint32_t hash_mask, new_shape_hash = 0; intptr_t h; /* update the shape hash */ if (sh->is_hashed) { js_shape_hash_unlink(rt, sh); new_shape_hash = shape_hash(shape_hash(sh->hash, atom), prop_flags); } if (unlikely(sh->prop_count >= sh->prop_size)) { if (resize_properties(ctx, psh, p, sh->prop_count + 1)) { /* in case of error, reinsert in the hash table. sh is still valid if resize_properties() failed */ if (sh->is_hashed) js_shape_hash_link(rt, sh); return -1; } sh = *psh; } if (sh->is_hashed) { sh->hash = new_shape_hash; js_shape_hash_link(rt, sh); } /* Initialize the new shape property. The object property at p->prop[sh->prop_count] is uninitialized */ prop = get_shape_prop(sh); pr = &prop[sh->prop_count++]; pr->atom = JS_DupAtom(ctx, atom); pr->flags = prop_flags; sh->has_small_array_index |= __JS_AtomIsTaggedInt(atom); /* add in hash table */ hash_mask = sh->prop_hash_mask; h = atom & hash_mask; pr->hash_next = prop_hash_end(sh)[-h - 1]; prop_hash_end(sh)[-h - 1] = sh->prop_count; return 0; } /* find a hashed empty shape matching the prototype. Return NULL if not found */ static JSShape *find_hashed_shape_proto(JSRuntime *rt, JSObject *proto) { JSShape *sh1; uint32_t h, h1; h = shape_initial_hash(proto); h1 = get_shape_hash(h, rt->shape_hash_bits); for(sh1 = rt->shape_hash[h1]; sh1 != NULL; sh1 = sh1->shape_hash_next) { if (sh1->hash == h && sh1->proto == proto && sh1->prop_count == 0) { return sh1; } } return NULL; } /* find a hashed shape matching sh + (prop, prop_flags). Return NULL if not found */ static JSShape *find_hashed_shape_prop(JSRuntime *rt, JSShape *sh, JSAtom atom, int prop_flags) { JSShape *sh1; uint32_t h, h1, i, n; h = sh->hash; h = shape_hash(h, atom); h = shape_hash(h, prop_flags); h1 = get_shape_hash(h, rt->shape_hash_bits); for(sh1 = rt->shape_hash[h1]; sh1 != NULL; sh1 = sh1->shape_hash_next) { /* we test the hash first so that the rest is done only if the shapes really match */ if (sh1->hash == h && sh1->proto == sh->proto && sh1->prop_count == ((n = sh->prop_count) + 1)) { for(i = 0; i < n; i++) { if (unlikely(sh1->prop[i].atom != sh->prop[i].atom) || unlikely(sh1->prop[i].flags != sh->prop[i].flags)) goto next; } if (unlikely(sh1->prop[n].atom != atom) || unlikely(sh1->prop[n].flags != prop_flags)) goto next; return sh1; } next: ; } return NULL; } static __maybe_unused void JS_DumpShape(JSRuntime *rt, int i, JSShape *sh) { char atom_buf[ATOM_GET_STR_BUF_SIZE]; int j; /* XXX: should output readable class prototype */ printf("%5d %3d%c %14p %5d %5d", i, sh->header.ref_count, " *"[sh->is_hashed], (void *)sh->proto, sh->prop_size, sh->prop_count); for(j = 0; j < sh->prop_count; j++) { printf(" %s", JS_AtomGetStrRT(rt, atom_buf, sizeof(atom_buf), sh->prop[j].atom)); } printf("\n"); } static __maybe_unused void JS_DumpShapes(JSRuntime *rt) { int i; JSShape *sh; struct list_head *el; JSObject *p; JSGCObjectHeader *gp; printf("JSShapes: {\n"); printf("%5s %4s %14s %5s %5s %s\n", "SLOT", "REFS", "PROTO", "SIZE", "COUNT", "PROPS"); for(i = 0; i < rt->shape_hash_size; i++) { for(sh = rt->shape_hash[i]; sh != NULL; sh = sh->shape_hash_next) { JS_DumpShape(rt, i, sh); assert(sh->is_hashed); } } /* dump non-hashed shapes */ list_for_each(el, &rt->gc_obj_list) { gp = list_entry(el, JSGCObjectHeader, link); if (gp->gc_obj_type == JS_GC_OBJ_TYPE_JS_OBJECT) { p = (JSObject *)gp; if (!p->shape->is_hashed) { JS_DumpShape(rt, -1, p->shape); } } } printf("}\n"); } static JSValue JS_NewObjectFromShape(JSContext *ctx, JSShape *sh, JSClassID class_id) { JSObject *p; js_trigger_gc(ctx->rt, sizeof(JSObject)); p = js_malloc(ctx, sizeof(JSObject)); if (unlikely(!p)) goto fail; p->class_id = class_id; p->extensible = true; p->free_mark = 0; p->is_exotic = 0; p->fast_array = 0; p->is_constructor = 0; p->is_uncatchable_error = 0; p->tmp_mark = 0; p->is_HTMLDDA = 0; p->first_weak_ref = NULL; p->u.opaque = NULL; p->shape = sh; p->prop = js_malloc(ctx, sizeof(JSProperty) * sh->prop_size); if (unlikely(!p->prop)) { js_free(ctx, p); fail: js_free_shape(ctx->rt, sh); return JS_EXCEPTION; } switch(class_id) { case JS_CLASS_OBJECT: break; case JS_CLASS_ARRAY: { JSProperty *pr; p->is_exotic = 1; p->fast_array = 1; p->u.array.u.values = NULL; p->u.array.count = 0; p->u.array.u1.size = 0; /* the length property is always the first one */ if (likely(sh == ctx->array_shape)) { pr = &p->prop[0]; } else { /* only used for the first array */ /* cannot fail */ pr = add_property(ctx, p, JS_ATOM_length, JS_PROP_WRITABLE | JS_PROP_LENGTH); } pr->u.value = js_int32(0); } break; case JS_CLASS_C_FUNCTION: p->prop[0].u.value = JS_UNDEFINED; break; case JS_CLASS_ARGUMENTS: case JS_CLASS_UINT8C_ARRAY: case JS_CLASS_INT8_ARRAY: case JS_CLASS_UINT8_ARRAY: case JS_CLASS_INT16_ARRAY: case JS_CLASS_UINT16_ARRAY: case JS_CLASS_INT32_ARRAY: case JS_CLASS_UINT32_ARRAY: case JS_CLASS_BIG_INT64_ARRAY: case JS_CLASS_BIG_UINT64_ARRAY: case JS_CLASS_FLOAT16_ARRAY: case JS_CLASS_FLOAT32_ARRAY: case JS_CLASS_FLOAT64_ARRAY: p->is_exotic = 1; p->fast_array = 1; p->u.array.u.ptr = NULL; p->u.array.count = 0; break; case JS_CLASS_DATAVIEW: p->u.array.u.ptr = NULL; p->u.array.count = 0; break; case JS_CLASS_NUMBER: case JS_CLASS_STRING: case JS_CLASS_BOOLEAN: case JS_CLASS_SYMBOL: case JS_CLASS_DATE: case JS_CLASS_BIG_INT: p->u.object_data = JS_UNDEFINED; goto set_exotic; case JS_CLASS_REGEXP: p->u.regexp.pattern = NULL; p->u.regexp.bytecode = NULL; goto set_exotic; default: set_exotic: if (ctx->rt->class_array[class_id].exotic) { p->is_exotic = 1; } break; } p->header.ref_count = 1; add_gc_object(ctx->rt, &p->header, JS_GC_OBJ_TYPE_JS_OBJECT); return JS_MKPTR(JS_TAG_OBJECT, p); } static JSObject *get_proto_obj(JSValueConst proto_val) { if (JS_VALUE_GET_TAG(proto_val) != JS_TAG_OBJECT) return NULL; else return JS_VALUE_GET_OBJ(proto_val); } /* WARNING: proto must be an object or JS_NULL */ JSValue JS_NewObjectProtoClass(JSContext *ctx, JSValueConst proto_val, JSClassID class_id) { JSShape *sh; JSObject *proto; proto = get_proto_obj(proto_val); sh = find_hashed_shape_proto(ctx->rt, proto); if (likely(sh)) { sh = js_dup_shape(sh); } else { sh = js_new_shape(ctx, proto); if (!sh) return JS_EXCEPTION; } return JS_NewObjectFromShape(ctx, sh, class_id); } static int JS_SetObjectData(JSContext *ctx, JSValueConst obj, JSValue val) { JSObject *p; if (JS_VALUE_GET_TAG(obj) == JS_TAG_OBJECT) { p = JS_VALUE_GET_OBJ(obj); switch(p->class_id) { case JS_CLASS_NUMBER: case JS_CLASS_STRING: case JS_CLASS_BOOLEAN: case JS_CLASS_SYMBOL: case JS_CLASS_DATE: case JS_CLASS_BIG_INT: JS_FreeValue(ctx, p->u.object_data); p->u.object_data = val; return 0; } } JS_FreeValue(ctx, val); if (!JS_IsException(obj)) JS_ThrowTypeError(ctx, "invalid object type"); return -1; } JSValue JS_NewObjectClass(JSContext *ctx, JSClassID class_id) { return JS_NewObjectProtoClass(ctx, ctx->class_proto[class_id], class_id); } JSValue JS_NewObjectProto(JSContext *ctx, JSValueConst proto) { return JS_NewObjectProtoClass(ctx, proto, JS_CLASS_OBJECT); } JSValue JS_NewObjectFrom(JSContext *ctx, int count, const JSAtom *props, const JSValue *values) { JSShapeProperty *pr; uint32_t *hash; JSRuntime *rt; JSObject *p; JSShape *sh; JSValue obj; JSAtom atom; intptr_t h; int i; rt = ctx->rt; obj = JS_NewObject(ctx); if (JS_IsException(obj)) return JS_EXCEPTION; if (count > 0) { p = JS_VALUE_GET_OBJ(obj); sh = p->shape; assert(sh->is_hashed); assert(sh->header.ref_count == 1); js_shape_hash_unlink(rt, sh); if (resize_properties(ctx, &sh, p, count)) { js_shape_hash_link(rt, sh); JS_FreeValue(ctx, obj); return JS_EXCEPTION; } p->shape = sh; for (i = 0; i < count; i++) { atom = props[i]; pr = &sh->prop[i]; sh->hash = shape_hash(shape_hash(sh->hash, atom), JS_PROP_C_W_E); sh->has_small_array_index |= __JS_AtomIsTaggedInt(atom); h = atom & sh->prop_hash_mask; hash = &prop_hash_end(sh)[-h - 1]; pr->hash_next = *hash; *hash = i + 1; pr->atom = JS_DupAtom(ctx, atom); pr->flags = JS_PROP_C_W_E; p->prop[i].u.value = values[i]; } js_shape_hash_link(rt, sh); sh->prop_count = count; } return obj; } JSValue JS_NewObjectFromStr(JSContext *ctx, int count, const char **props, const JSValue *values) { JSAtom atoms_s[16], *atoms = atoms_s; JSValue ret; int i; i = 0; ret = JS_EXCEPTION; if (count < 1) goto out; if (count > (int)countof(atoms_s)) { atoms = js_malloc(ctx, count * sizeof(*atoms)); if (!atoms) return JS_EXCEPTION; } for (i = 0; i < count; i++) { atoms[i] = JS_NewAtom(ctx, props[i]); if (atoms[i] == JS_ATOM_NULL) goto out; } ret = JS_NewObjectFrom(ctx, count, atoms, values); out: while (i-- > 0) JS_FreeAtom(ctx, atoms[i]); if (atoms != atoms_s) js_free(ctx, atoms); return ret; } JSValue JS_NewArray(JSContext *ctx) { return JS_NewObjectFromShape(ctx, js_dup_shape(ctx->array_shape), JS_CLASS_ARRAY); } // note: takes ownership of |values|, unlike js_create_array JSValue JS_NewArrayFrom(JSContext *ctx, int count, const JSValue *values) { JSObject *p; JSValue obj; int i; obj = JS_NewArray(ctx); if (JS_IsException(obj)) goto exception; if (count > 0) { p = JS_VALUE_GET_OBJ(obj); if (expand_fast_array(ctx, p, count)) { JS_FreeValue(ctx, obj); goto exception; } p->u.array.count = count; p->prop[0].u.value = js_int32(count); memcpy(p->u.array.u.values, values, count * sizeof(*values)); } return obj; exception: for (i = 0; i < count; i++) JS_FreeValue(ctx, values[i]); return JS_EXCEPTION; } JSValue JS_NewObject(JSContext *ctx) { /* inline JS_NewObjectClass(ctx, JS_CLASS_OBJECT); */ return JS_NewObjectProtoClass(ctx, ctx->class_proto[JS_CLASS_OBJECT], JS_CLASS_OBJECT); } static void js_function_set_properties(JSContext *ctx, JSValue func_obj, JSAtom name, int len) { /* ES6 feature non compatible with ES5.1: length is configurable */ JS_DefinePropertyValue(ctx, func_obj, JS_ATOM_length, js_int32(len), JS_PROP_CONFIGURABLE); JS_DefinePropertyValue(ctx, func_obj, JS_ATOM_name, JS_AtomToString(ctx, name), JS_PROP_CONFIGURABLE); } static bool js_class_has_bytecode(JSClassID class_id) { return (class_id == JS_CLASS_BYTECODE_FUNCTION || class_id == JS_CLASS_GENERATOR_FUNCTION || class_id == JS_CLASS_ASYNC_FUNCTION || class_id == JS_CLASS_ASYNC_GENERATOR_FUNCTION); } /* return NULL without exception if not a function or no bytecode */ static JSFunctionBytecode *JS_GetFunctionBytecode(JSValueConst val) { JSObject *p; if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT) return NULL; p = JS_VALUE_GET_OBJ(val); if (!js_class_has_bytecode(p->class_id)) return NULL; return p->u.func.function_bytecode; } static void js_method_set_home_object(JSContext *ctx, JSValue func_obj, JSValue home_obj) { JSObject *p, *p1; JSFunctionBytecode *b; if (JS_VALUE_GET_TAG(func_obj) != JS_TAG_OBJECT) return; p = JS_VALUE_GET_OBJ(func_obj); if (!js_class_has_bytecode(p->class_id)) return; b = p->u.func.function_bytecode; if (b->need_home_object) { p1 = p->u.func.home_object; if (p1) { JS_FreeValue(ctx, JS_MKPTR(JS_TAG_OBJECT, p1)); } if (JS_VALUE_GET_TAG(home_obj) == JS_TAG_OBJECT) p1 = JS_VALUE_GET_OBJ(js_dup(home_obj)); else p1 = NULL; p->u.func.home_object = p1; } } static JSValue js_get_function_name(JSContext *ctx, JSAtom name) { JSValue name_str; name_str = JS_AtomToString(ctx, name); if (JS_AtomSymbolHasDescription(ctx, name)) { name_str = JS_ConcatString3(ctx, "[", name_str, "]"); } return name_str; } /* Modify the name of a method according to the atom and 'flags'. 'flags' is a bitmask of JS_PROP_HAS_GET and JS_PROP_HAS_SET. Also set the home object of the method. Return < 0 if exception. */ static int js_method_set_properties(JSContext *ctx, JSValue func_obj, JSAtom name, int flags, JSValue home_obj) { JSValue name_str; name_str = js_get_function_name(ctx, name); if (flags & JS_PROP_HAS_GET) { name_str = JS_ConcatString3(ctx, "get ", name_str, ""); } else if (flags & JS_PROP_HAS_SET) { name_str = JS_ConcatString3(ctx, "set ", name_str, ""); } if (JS_IsException(name_str)) return -1; if (JS_DefinePropertyValue(ctx, func_obj, JS_ATOM_name, name_str, JS_PROP_CONFIGURABLE) < 0) return -1; js_method_set_home_object(ctx, func_obj, home_obj); return 0; } /* Note: at least 'length' arguments will be readable in 'argv' */ /* `name` may be NULL, pure ASCII or UTF-8 encoded */ JSValue JS_NewCFunction3(JSContext *ctx, JSCFunction *func, const char *name, int length, JSCFunctionEnum cproto, int magic, JSValueConst proto_val) { JSValue func_obj; JSObject *p; JSAtom name_atom; func_obj = JS_NewObjectProtoClass(ctx, proto_val, JS_CLASS_C_FUNCTION); if (JS_IsException(func_obj)) return func_obj; p = JS_VALUE_GET_OBJ(func_obj); p->u.cfunc.realm = JS_DupContext(ctx); p->u.cfunc.c_function.generic = func; p->u.cfunc.length = length; p->u.cfunc.cproto = cproto; p->u.cfunc.magic = magic; p->is_constructor = (cproto == JS_CFUNC_constructor || cproto == JS_CFUNC_constructor_magic || cproto == JS_CFUNC_constructor_or_func || cproto == JS_CFUNC_constructor_or_func_magic); name_atom = JS_ATOM_empty_string; if (name && *name) { name_atom = JS_NewAtom(ctx, name); if (name_atom == JS_ATOM_NULL) { JS_FreeValue(ctx, func_obj); return JS_EXCEPTION; } } js_function_set_properties(ctx, func_obj, name_atom, length); JS_FreeAtom(ctx, name_atom); return func_obj; } /* Note: at least 'length' arguments will be readable in 'argv' */ JSValue JS_NewCFunction2(JSContext *ctx, JSCFunction *func, const char *name, int length, JSCFunctionEnum cproto, int magic) { return JS_NewCFunction3(ctx, func, name, length, cproto, magic, ctx->function_proto); } typedef struct JSCFunctionDataRecord { JSCFunctionData *func; uint8_t length; uint8_t data_len; uint16_t magic; JSValue data[]; } JSCFunctionDataRecord; static void js_c_function_data_finalizer(JSRuntime *rt, JSValueConst val) { JSCFunctionDataRecord *s = JS_GetOpaque(val, JS_CLASS_C_FUNCTION_DATA); int i; if (s) { for(i = 0; i < s->data_len; i++) { JS_FreeValueRT(rt, s->data[i]); } js_free_rt(rt, s); } } static void js_c_function_data_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func) { JSCFunctionDataRecord *s = JS_GetOpaque(val, JS_CLASS_C_FUNCTION_DATA); int i; if (s) { for(i = 0; i < s->data_len; i++) { JS_MarkValue(rt, s->data[i], mark_func); } } } static JSValue js_call_c_function_data(JSContext *ctx, JSValueConst func_obj, JSValueConst this_val, int argc, JSValueConst *argv, int flags) { JSRuntime *rt = ctx->rt; JSStackFrame sf_s, *sf = &sf_s, *prev_sf; JSCFunctionDataRecord *s; JSValueConst *arg_buf; JSValue ret; size_t stack_size; int arg_count; int i; s = JS_GetOpaque(func_obj, JS_CLASS_C_FUNCTION_DATA); if (!s) return JS_EXCEPTION; // can't really happen arg_buf = argv; arg_count = s->length; if (unlikely(argc < arg_count)) { stack_size = arg_count * sizeof(arg_buf[0]); if (js_check_stack_overflow(rt, stack_size)) return JS_ThrowStackOverflow(ctx); arg_buf = alloca(stack_size); for(i = 0; i < argc; i++) arg_buf[i] = argv[i]; for(i = argc; i < arg_count; i++) arg_buf[i] = JS_UNDEFINED; } prev_sf = rt->current_stack_frame; sf->prev_frame = prev_sf; rt->current_stack_frame = sf; // TODO(bnoordhuis) switch realms like js_call_c_function does sf->is_strict_mode = false; sf->cur_func = unsafe_unconst(func_obj); sf->arg_count = argc; ret = s->func(ctx, this_val, argc, arg_buf, s->magic, vc(s->data)); rt->current_stack_frame = sf->prev_frame; return ret; } JSValue JS_NewCFunctionData2(JSContext *ctx, JSCFunctionData *func, const char *name, int length, int magic, int data_len, JSValueConst *data) { JSCFunctionDataRecord *s; JSAtom name_atom; JSValue func_obj; int i; func_obj = JS_NewObjectProtoClass(ctx, ctx->function_proto, JS_CLASS_C_FUNCTION_DATA); if (JS_IsException(func_obj)) return func_obj; s = js_malloc(ctx, sizeof(*s) + data_len * sizeof(JSValue)); if (!s) { JS_FreeValue(ctx, func_obj); return JS_EXCEPTION; } s->func = func; s->length = length; s->data_len = data_len; s->magic = magic; for(i = 0; i < data_len; i++) s->data[i] = js_dup(data[i]); JS_SetOpaqueInternal(func_obj, s); name_atom = JS_ATOM_empty_string; if (name && *name) { name_atom = JS_NewAtom(ctx, name); if (name_atom == JS_ATOM_NULL) { JS_FreeValue(ctx, func_obj); return JS_EXCEPTION; } } js_function_set_properties(ctx, func_obj, name_atom, length); JS_FreeAtom(ctx, name_atom); return func_obj; } JSValue JS_NewCFunctionData(JSContext *ctx, JSCFunctionData *func, int length, int magic, int data_len, JSValueConst *data) { return JS_NewCFunctionData2(ctx, func, NULL, length, magic, data_len, data); } static JSContext *js_autoinit_get_realm(JSProperty *pr) { return (JSContext *)(pr->u.init.realm_and_id & ~3); } static JSAutoInitIDEnum js_autoinit_get_id(JSProperty *pr) { return pr->u.init.realm_and_id & 3; } static void js_autoinit_free(JSRuntime *rt, JSProperty *pr) { JS_FreeContext(js_autoinit_get_realm(pr)); } static void js_autoinit_mark(JSRuntime *rt, JSProperty *pr, JS_MarkFunc *mark_func) { mark_func(rt, &js_autoinit_get_realm(pr)->header); } static void free_property(JSRuntime *rt, JSProperty *pr, int prop_flags) { if (unlikely(prop_flags & JS_PROP_TMASK)) { if ((prop_flags & JS_PROP_TMASK) == JS_PROP_GETSET) { if (pr->u.getset.getter) JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, pr->u.getset.getter)); if (pr->u.getset.setter) JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, pr->u.getset.setter)); } else if ((prop_flags & JS_PROP_TMASK) == JS_PROP_VARREF) { free_var_ref(rt, pr->u.var_ref); } else if ((prop_flags & JS_PROP_TMASK) == JS_PROP_AUTOINIT) { js_autoinit_free(rt, pr); } } else { JS_FreeValueRT(rt, pr->u.value); } } static force_inline JSShapeProperty *find_own_property1(JSObject *p, JSAtom atom) { JSShape *sh; JSShapeProperty *pr, *prop; intptr_t h; sh = p->shape; h = (uintptr_t)atom & sh->prop_hash_mask; h = prop_hash_end(sh)[-h - 1]; prop = get_shape_prop(sh); while (h) { pr = &prop[h - 1]; if (likely(pr->atom == atom)) { return pr; } h = pr->hash_next; } return NULL; } static force_inline JSShapeProperty *find_own_property(JSProperty **ppr, JSObject *p, JSAtom atom) { JSShape *sh; JSShapeProperty *pr, *prop; intptr_t h; sh = p->shape; h = (uintptr_t)atom & sh->prop_hash_mask; h = prop_hash_end(sh)[-h - 1]; prop = get_shape_prop(sh); while (h) { pr = &prop[h - 1]; if (likely(pr->atom == atom)) { *ppr = &p->prop[h - 1]; /* the compiler should be able to assume that pr != NULL here */ return pr; } h = pr->hash_next; } *ppr = NULL; return NULL; } static void free_var_ref(JSRuntime *rt, JSVarRef *var_ref) { if (var_ref) { assert(var_ref->header.ref_count > 0); if (--var_ref->header.ref_count == 0) { if (var_ref->is_detached) { JS_FreeValueRT(rt, var_ref->value); remove_gc_object(&var_ref->header); } else { list_del(&var_ref->header.link); /* still on the stack */ } js_free_rt(rt, var_ref); } } } static void js_array_finalizer(JSRuntime *rt, JSValueConst val) { JSObject *p = JS_VALUE_GET_OBJ(val); int i; for(i = 0; i < p->u.array.count; i++) { JS_FreeValueRT(rt, p->u.array.u.values[i]); } js_free_rt(rt, p->u.array.u.values); } static void js_array_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func) { JSObject *p = JS_VALUE_GET_OBJ(val); int i; for(i = 0; i < p->u.array.count; i++) { JS_MarkValue(rt, p->u.array.u.values[i], mark_func); } } static void js_object_data_finalizer(JSRuntime *rt, JSValueConst val) { JSObject *p = JS_VALUE_GET_OBJ(val); JS_FreeValueRT(rt, p->u.object_data); p->u.object_data = JS_UNDEFINED; } static void js_object_data_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func) { JSObject *p = JS_VALUE_GET_OBJ(val); JS_MarkValue(rt, p->u.object_data, mark_func); } static void js_c_function_finalizer(JSRuntime *rt, JSValueConst val) { JSObject *p = JS_VALUE_GET_OBJ(val); if (p->u.cfunc.realm) JS_FreeContext(p->u.cfunc.realm); } static void js_c_function_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func) { JSObject *p = JS_VALUE_GET_OBJ(val); if (p->u.cfunc.realm) mark_func(rt, &p->u.cfunc.realm->header); } static void js_bytecode_function_finalizer(JSRuntime *rt, JSValueConst val) { JSObject *p1, *p = JS_VALUE_GET_OBJ(val); JSFunctionBytecode *b; JSVarRef **var_refs; int i; p1 = p->u.func.home_object; if (p1) { JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, p1)); } b = p->u.func.function_bytecode; if (b) { var_refs = p->u.func.var_refs; if (var_refs) { for(i = 0; i < b->closure_var_count; i++) free_var_ref(rt, var_refs[i]); js_free_rt(rt, var_refs); } JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_FUNCTION_BYTECODE, b)); } } static void js_bytecode_function_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func) { JSObject *p = JS_VALUE_GET_OBJ(val); JSVarRef **var_refs = p->u.func.var_refs; JSFunctionBytecode *b = p->u.func.function_bytecode; int i; if (p->u.func.home_object) { JS_MarkValue(rt, JS_MKPTR(JS_TAG_OBJECT, p->u.func.home_object), mark_func); } if (b) { if (var_refs) { for(i = 0; i < b->closure_var_count; i++) { JSVarRef *var_ref = var_refs[i]; if (var_ref && var_ref->is_detached) { mark_func(rt, &var_ref->header); } } } /* must mark the function bytecode because template objects may be part of a cycle */ JS_MarkValue(rt, JS_MKPTR(JS_TAG_FUNCTION_BYTECODE, b), mark_func); } } static void js_bound_function_finalizer(JSRuntime *rt, JSValueConst val) { JSObject *p = JS_VALUE_GET_OBJ(val); JSBoundFunction *bf = p->u.bound_function; int i; JS_FreeValueRT(rt, bf->func_obj); JS_FreeValueRT(rt, bf->this_val); for(i = 0; i < bf->argc; i++) { JS_FreeValueRT(rt, bf->argv[i]); } js_free_rt(rt, bf); } static void js_bound_function_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func) { JSObject *p = JS_VALUE_GET_OBJ(val); JSBoundFunction *bf = p->u.bound_function; int i; JS_MarkValue(rt, bf->func_obj, mark_func); JS_MarkValue(rt, bf->this_val, mark_func); for(i = 0; i < bf->argc; i++) JS_MarkValue(rt, bf->argv[i], mark_func); } static void js_for_in_iterator_finalizer(JSRuntime *rt, JSValueConst val) { JSObject *p = JS_VALUE_GET_OBJ(val); JSForInIterator *it = p->u.for_in_iterator; JS_FreeValueRT(rt, it->obj); js_free_rt(rt, it); } static void js_for_in_iterator_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func) { JSObject *p = JS_VALUE_GET_OBJ(val); JSForInIterator *it = p->u.for_in_iterator; JS_MarkValue(rt, it->obj, mark_func); } static void free_object(JSRuntime *rt, JSObject *p) { int i; JSClassFinalizer *finalizer; JSShape *sh; JSShapeProperty *pr; p->free_mark = 1; /* used to tell the object is invalid when freeing cycles */ /* free all the fields */ sh = p->shape; pr = get_shape_prop(sh); for(i = 0; i < sh->prop_count; i++) { free_property(rt, &p->prop[i], pr->flags); pr++; } js_free_rt(rt, p->prop); /* as an optimization we destroy the shape immediately without putting it in gc_zero_ref_count_list */ js_free_shape(rt, sh); /* fail safe */ p->shape = NULL; p->prop = NULL; if (unlikely(p->first_weak_ref)) { reset_weak_ref(rt, &p->first_weak_ref); } finalizer = rt->class_array[p->class_id].finalizer; if (finalizer) (*finalizer)(rt, JS_MKPTR(JS_TAG_OBJECT, p)); /* fail safe */ p->class_id = 0; p->u.opaque = NULL; p->u.func.var_refs = NULL; p->u.func.home_object = NULL; remove_gc_object(&p->header); if (rt->gc_phase == JS_GC_PHASE_REMOVE_CYCLES && p->header.ref_count != 0) { list_add_tail(&p->header.link, &rt->gc_zero_ref_count_list); } else { js_free_rt(rt, p); } } static void free_gc_object(JSRuntime *rt, JSGCObjectHeader *gp) { switch(gp->gc_obj_type) { case JS_GC_OBJ_TYPE_JS_OBJECT: free_object(rt, (JSObject *)gp); break; case JS_GC_OBJ_TYPE_FUNCTION_BYTECODE: free_function_bytecode(rt, (JSFunctionBytecode *)gp); break; default: abort(); } } static void free_zero_refcount(JSRuntime *rt) { struct list_head *el; JSGCObjectHeader *p; rt->gc_phase = JS_GC_PHASE_DECREF; for(;;) { el = rt->gc_zero_ref_count_list.next; if (el == &rt->gc_zero_ref_count_list) break; p = list_entry(el, JSGCObjectHeader, link); assert(p->ref_count == 0); free_gc_object(rt, p); } rt->gc_phase = JS_GC_PHASE_NONE; } /* called with the ref_count of 'v' reaches zero. */ static void js_free_value_rt(JSRuntime *rt, JSValue v) { uint32_t tag = JS_VALUE_GET_TAG(v); #ifdef ENABLE_DUMPS // JS_DUMP_FREE if (check_dump_flag(rt, JS_DUMP_FREE)) { /* Prevent invalid object access during GC */ if ((rt->gc_phase != JS_GC_PHASE_REMOVE_CYCLES) || (tag != JS_TAG_OBJECT && tag != JS_TAG_FUNCTION_BYTECODE)) { printf("Freeing "); if (tag == JS_TAG_OBJECT) { JS_DumpObject(rt, JS_VALUE_GET_OBJ(v)); } else { JS_DumpValue(rt, v); printf("\n"); } } } #endif switch(tag) { case JS_TAG_STRING: js_free_string0(rt, JS_VALUE_GET_STRING(v)); break; case JS_TAG_OBJECT: case JS_TAG_FUNCTION_BYTECODE: { JSGCObjectHeader *p = JS_VALUE_GET_PTR(v); if (rt->gc_phase != JS_GC_PHASE_REMOVE_CYCLES) { list_del(&p->link); list_add(&p->link, &rt->gc_zero_ref_count_list); if (rt->gc_phase == JS_GC_PHASE_NONE) { free_zero_refcount(rt); } } } break; case JS_TAG_MODULE: abort(); /* never freed here */ break; case JS_TAG_BIG_INT: { JSBigInt *p = JS_VALUE_GET_PTR(v); js_free_rt(rt, p); } break; case JS_TAG_SYMBOL: { JSAtomStruct *p = JS_VALUE_GET_PTR(v); JS_FreeAtomStruct(rt, p); } break; default: printf("js_free_value_rt: unknown tag=%d\n", tag); abort(); } } void JS_FreeValueRT(JSRuntime *rt, JSValue v) { if (JS_VALUE_HAS_REF_COUNT(v)) { JSRefCountHeader *p = (JSRefCountHeader *)JS_VALUE_GET_PTR(v); #ifndef NDEBUG notifyRefCountDecrease(p); #endif if (--p->ref_count <= 0) { js_free_value_rt(rt, v); } } } void JS_FreeValue(JSContext *ctx, JSValue v) { JS_FreeValueRT(ctx->rt, v); } /* garbage collection */ static void add_gc_object(JSRuntime *rt, JSGCObjectHeader *h, JSGCObjectTypeEnum type) { h->mark = 0; h->gc_obj_type = type; list_add_tail(&h->link, &rt->gc_obj_list); } static void remove_gc_object(JSGCObjectHeader *h) { list_del(&h->link); } void JS_MarkValue(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func) { if (JS_VALUE_HAS_REF_COUNT(val)) { switch(JS_VALUE_GET_TAG(val)) { case JS_TAG_OBJECT: case JS_TAG_FUNCTION_BYTECODE: mark_func(rt, JS_VALUE_GET_PTR(val)); break; default: break; } } } static void mark_weak_map_value(JSRuntime *rt, JSWeakRefRecord *first_weak_ref, JS_MarkFunc *mark_func) { JSWeakRefRecord *wr; JSMapRecord *mr; JSMapState *s; for (wr = first_weak_ref; wr != NULL; wr = wr->next_weak_ref) { if (wr->kind == JS_WEAK_REF_KIND_MAP) { mr = wr->u.map_record; s = mr->map; assert(s->is_weak); assert(!mr->empty); /* no iterator on WeakMap/WeakSet */ JS_MarkValue(rt, mr->value, mark_func); } } } static void mark_children(JSRuntime *rt, JSGCObjectHeader *gp, JS_MarkFunc *mark_func) { switch(gp->gc_obj_type) { case JS_GC_OBJ_TYPE_JS_OBJECT: { JSObject *p = (JSObject *)gp; JSShapeProperty *prs; JSShape *sh; int i; sh = p->shape; mark_func(rt, &sh->header); /* mark all the fields */ prs = get_shape_prop(sh); for(i = 0; i < sh->prop_count; i++) { JSProperty *pr = &p->prop[i]; if (prs->atom != JS_ATOM_NULL) { if (prs->flags & JS_PROP_TMASK) { if ((prs->flags & JS_PROP_TMASK) == JS_PROP_GETSET) { if (pr->u.getset.getter) mark_func(rt, &pr->u.getset.getter->header); if (pr->u.getset.setter) mark_func(rt, &pr->u.getset.setter->header); } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_VARREF) { if (pr->u.var_ref->is_detached) { /* Note: the tag does not matter provided it is a GC object */ mark_func(rt, &pr->u.var_ref->header); } } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_AUTOINIT) { js_autoinit_mark(rt, pr, mark_func); } } else { JS_MarkValue(rt, pr->u.value, mark_func); } } prs++; } if (unlikely(p->first_weak_ref)) { mark_weak_map_value(rt, p->first_weak_ref, mark_func); } if (p->class_id != JS_CLASS_OBJECT) { JSClassGCMark *gc_mark; gc_mark = rt->class_array[p->class_id].gc_mark; if (gc_mark) gc_mark(rt, JS_MKPTR(JS_TAG_OBJECT, p), mark_func); } } break; case JS_GC_OBJ_TYPE_FUNCTION_BYTECODE: /* the template objects can be part of a cycle */ { JSFunctionBytecode *b = (JSFunctionBytecode *)gp; int i; for(i = 0; i < b->cpool_count; i++) { JS_MarkValue(rt, b->cpool[i], mark_func); } if (b->realm) mark_func(rt, &b->realm->header); } break; case JS_GC_OBJ_TYPE_VAR_REF: { JSVarRef *var_ref = (JSVarRef *)gp; /* only detached variable referenced are taken into account */ assert(var_ref->is_detached); JS_MarkValue(rt, *var_ref->pvalue, mark_func); } break; case JS_GC_OBJ_TYPE_ASYNC_FUNCTION: { JSAsyncFunctionData *s = (JSAsyncFunctionData *)gp; if (s->is_active) async_func_mark(rt, &s->func_state, mark_func); JS_MarkValue(rt, s->resolving_funcs[0], mark_func); JS_MarkValue(rt, s->resolving_funcs[1], mark_func); } break; case JS_GC_OBJ_TYPE_SHAPE: { JSShape *sh = (JSShape *)gp; if (sh->proto != NULL) { mark_func(rt, &sh->proto->header); } } break; case JS_GC_OBJ_TYPE_JS_CONTEXT: { JSContext *ctx = (JSContext *)gp; JS_MarkContext(rt, ctx, mark_func); } break; default: abort(); } } static void gc_decref_child(JSRuntime *rt, JSGCObjectHeader *p) { #ifndef NDEBUG notifyRefCountDecrease((JSRefCountHeader*)p); #endif assert(p->ref_count > 0); p->ref_count--; if (p->ref_count == 0 && p->mark == 1) { list_del(&p->link); list_add_tail(&p->link, &rt->tmp_obj_list); } } static void gc_decref(JSRuntime *rt) { struct list_head *el, *el1; JSGCObjectHeader *p; init_list_head(&rt->tmp_obj_list); /* decrement the refcount of all the children of all the GC objects and move the GC objects with zero refcount to tmp_obj_list */ list_for_each_safe(el, el1, &rt->gc_obj_list) { p = list_entry(el, JSGCObjectHeader, link); assert(p->mark == 0); mark_children(rt, p, gc_decref_child); p->mark = 1; if (p->ref_count == 0) { list_del(&p->link); list_add_tail(&p->link, &rt->tmp_obj_list); } } } static void gc_scan_incref_child(JSRuntime *rt, JSGCObjectHeader *p) { #ifndef NDEBUG notifyRefCountIncrease((JSRefCountHeader*)p); #endif p->ref_count++; if (p->ref_count == 1) { /* ref_count was 0: remove from tmp_obj_list and add at the end of gc_obj_list */ list_del(&p->link); list_add_tail(&p->link, &rt->gc_obj_list); p->mark = 0; /* reset the mark for the next GC call */ } } static void gc_scan_incref_child2(JSRuntime *rt, JSGCObjectHeader *p) { #ifndef NDEBUG notifyRefCountIncrease((JSRefCountHeader*)p); #endif p->ref_count++; } static void gc_scan(JSRuntime *rt) { struct list_head *el; JSGCObjectHeader *p; /* keep the objects with a refcount > 0 and their children. */ list_for_each(el, &rt->gc_obj_list) { p = list_entry(el, JSGCObjectHeader, link); assert(p->ref_count > 0); p->mark = 0; /* reset the mark for the next GC call */ mark_children(rt, p, gc_scan_incref_child); } /* restore the refcount of the objects to be deleted. */ list_for_each(el, &rt->tmp_obj_list) { p = list_entry(el, JSGCObjectHeader, link); mark_children(rt, p, gc_scan_incref_child2); } } static void gc_free_cycles(JSRuntime *rt) { struct list_head *el, *el1; JSGCObjectHeader *p; #ifdef ENABLE_DUMPS // JS_DUMP_GC_FREE bool header_done = false; #endif rt->gc_phase = JS_GC_PHASE_REMOVE_CYCLES; for(;;) { el = rt->tmp_obj_list.next; if (el == &rt->tmp_obj_list) break; p = list_entry(el, JSGCObjectHeader, link); /* Only need to free the GC object associated with JS values. The rest will be automatically removed because they must be referenced by them. */ switch(p->gc_obj_type) { case JS_GC_OBJ_TYPE_JS_OBJECT: case JS_GC_OBJ_TYPE_FUNCTION_BYTECODE: #ifdef ENABLE_DUMPS // JS_DUMP_GC_FREE if (check_dump_flag(rt, JS_DUMP_GC_FREE)) { if (!header_done) { printf("Freeing cycles:\n"); JS_DumpObjectHeader(rt); header_done = true; } JS_DumpGCObject(rt, p); } #endif free_gc_object(rt, p); break; default: list_del(&p->link); list_add_tail(&p->link, &rt->gc_zero_ref_count_list); break; } } rt->gc_phase = JS_GC_PHASE_NONE; list_for_each_safe(el, el1, &rt->gc_zero_ref_count_list) { p = list_entry(el, JSGCObjectHeader, link); assert(p->gc_obj_type == JS_GC_OBJ_TYPE_JS_OBJECT || p->gc_obj_type == JS_GC_OBJ_TYPE_FUNCTION_BYTECODE); js_free_rt(rt, p); } init_list_head(&rt->gc_zero_ref_count_list); } void JS_RunGC(JSRuntime *rt) { /* decrement the reference of the children of each object. mark = 1 after this pass. */ gc_decref(rt); /* keep the GC objects with a non zero refcount and their childs */ gc_scan(rt); /* free the GC objects in a cycle */ gc_free_cycles(rt); } /* Return false if not an object or if the object has already been freed (zombie objects are visible in finalizers when freeing cycles). */ bool JS_IsLiveObject(JSRuntime *rt, JSValueConst obj) { JSObject *p; if (!JS_IsObject(obj)) return false; p = JS_VALUE_GET_OBJ(obj); return !p->free_mark; } /* Compute memory used by various object types */ /* XXX: poor man's approach to handling multiply referenced objects */ typedef struct JSMemoryUsage_helper { double memory_used_count; double str_count; double str_size; int64_t js_func_count; double js_func_size; int64_t js_func_code_size; int64_t js_func_pc2line_count; int64_t js_func_pc2line_size; } JSMemoryUsage_helper; static void compute_value_size(JSValue val, JSMemoryUsage_helper *hp); static void compute_jsstring_size(JSString *str, JSMemoryUsage_helper *hp) { if (!str->atom_type) { /* atoms are handled separately */ double s_ref_count = str->header.ref_count; hp->str_count += 1 / s_ref_count; hp->str_size += ((sizeof(*str) + (str->len << str->is_wide_char) + 1 - str->is_wide_char) / s_ref_count); } } static void compute_bytecode_size(JSFunctionBytecode *b, JSMemoryUsage_helper *hp) { int memory_used_count, js_func_size, i; memory_used_count = 0; js_func_size = sizeof(*b); if (b->vardefs) { js_func_size += (b->arg_count + b->var_count) * sizeof(*b->vardefs); } if (b->cpool) { js_func_size += b->cpool_count * sizeof(*b->cpool); for (i = 0; i < b->cpool_count; i++) { JSValue val = b->cpool[i]; compute_value_size(val, hp); } } if (b->closure_var) { js_func_size += b->closure_var_count * sizeof(*b->closure_var); } if (b->byte_code_buf) { hp->js_func_code_size += b->byte_code_len; } memory_used_count++; js_func_size += b->source_len + 1; if (b->pc2line_len) { memory_used_count++; hp->js_func_pc2line_count += 1; hp->js_func_pc2line_size += b->pc2line_len; } hp->js_func_size += js_func_size; hp->js_func_count += 1; hp->memory_used_count += memory_used_count; } static void compute_value_size(JSValue val, JSMemoryUsage_helper *hp) { switch(JS_VALUE_GET_TAG(val)) { case JS_TAG_STRING: compute_jsstring_size(JS_VALUE_GET_STRING(val), hp); break; case JS_TAG_BIG_INT: /* should track JSBigInt usage */ break; } } void JS_ComputeMemoryUsage(JSRuntime *rt, JSMemoryUsage *s) { struct list_head *el, *el1; int i; JSMemoryUsage_helper mem = { 0 }, *hp = &mem; memset(s, 0, sizeof(*s)); s->malloc_count = rt->malloc_state.malloc_count; s->malloc_size = rt->malloc_state.malloc_size; s->malloc_limit = rt->malloc_state.malloc_limit; s->memory_used_count = 2; /* rt + rt->class_array */ s->memory_used_size = sizeof(JSRuntime) + sizeof(JSClass) * rt->class_count; list_for_each(el, &rt->context_list) { JSContext *ctx = list_entry(el, JSContext, link); JSShape *sh = ctx->array_shape; s->memory_used_count += 2; /* ctx + ctx->class_proto */ s->memory_used_size += sizeof(JSContext) + sizeof(JSValue) * rt->class_count; s->binary_object_count += ctx->binary_object_count; s->binary_object_size += ctx->binary_object_size; /* the hashed shapes are counted separately */ if (sh && !sh->is_hashed) { int hash_size = sh->prop_hash_mask + 1; s->shape_count++; s->shape_size += get_shape_size(hash_size, sh->prop_size); } list_for_each(el1, &ctx->loaded_modules) { JSModuleDef *m = list_entry(el1, JSModuleDef, link); s->memory_used_count += 1; s->memory_used_size += sizeof(*m); if (m->req_module_entries) { s->memory_used_count += 1; s->memory_used_size += m->req_module_entries_count * sizeof(*m->req_module_entries); } if (m->export_entries) { s->memory_used_count += 1; s->memory_used_size += m->export_entries_count * sizeof(*m->export_entries); for (i = 0; i < m->export_entries_count; i++) { JSExportEntry *me = &m->export_entries[i]; if (me->export_type == JS_EXPORT_TYPE_LOCAL && me->u.local.var_ref) { /* potential multiple count */ s->memory_used_count += 1; compute_value_size(me->u.local.var_ref->value, hp); } } } if (m->star_export_entries) { s->memory_used_count += 1; s->memory_used_size += m->star_export_entries_count * sizeof(*m->star_export_entries); } if (m->import_entries) { s->memory_used_count += 1; s->memory_used_size += m->import_entries_count * sizeof(*m->import_entries); } compute_value_size(m->module_ns, hp); compute_value_size(m->func_obj, hp); } } list_for_each(el, &rt->gc_obj_list) { JSGCObjectHeader *gp = list_entry(el, JSGCObjectHeader, link); JSObject *p; JSShape *sh; JSShapeProperty *prs; /* XXX: could count the other GC object types too */ if (gp->gc_obj_type == JS_GC_OBJ_TYPE_FUNCTION_BYTECODE) { compute_bytecode_size((JSFunctionBytecode *)gp, hp); continue; } else if (gp->gc_obj_type != JS_GC_OBJ_TYPE_JS_OBJECT) { continue; } p = (JSObject *)gp; sh = p->shape; s->obj_count++; if (p->prop) { s->memory_used_count++; s->prop_size += sh->prop_size * sizeof(*p->prop); s->prop_count += sh->prop_count; prs = get_shape_prop(sh); for(i = 0; i < sh->prop_count; i++) { JSProperty *pr = &p->prop[i]; if (prs->atom != JS_ATOM_NULL && !(prs->flags & JS_PROP_TMASK)) { compute_value_size(pr->u.value, hp); } prs++; } } /* the hashed shapes are counted separately */ if (!sh->is_hashed) { int hash_size = sh->prop_hash_mask + 1; s->shape_count++; s->shape_size += get_shape_size(hash_size, sh->prop_size); } switch(p->class_id) { case JS_CLASS_ARRAY: /* u.array | length */ case JS_CLASS_ARGUMENTS: /* u.array | length */ s->array_count++; if (p->fast_array) { s->fast_array_count++; if (p->u.array.u.values) { s->memory_used_count++; s->memory_used_size += p->u.array.count * sizeof(*p->u.array.u.values); s->fast_array_elements += p->u.array.count; for (i = 0; i < p->u.array.count; i++) { compute_value_size(p->u.array.u.values[i], hp); } } } break; case JS_CLASS_NUMBER: /* u.object_data */ case JS_CLASS_STRING: /* u.object_data */ case JS_CLASS_BOOLEAN: /* u.object_data */ case JS_CLASS_SYMBOL: /* u.object_data */ case JS_CLASS_DATE: /* u.object_data */ case JS_CLASS_BIG_INT: /* u.object_data */ compute_value_size(p->u.object_data, hp); break; case JS_CLASS_C_FUNCTION: /* u.cfunc */ s->c_func_count++; break; case JS_CLASS_BYTECODE_FUNCTION: /* u.func */ { JSFunctionBytecode *b = p->u.func.function_bytecode; JSVarRef **var_refs = p->u.func.var_refs; /* home_object: object will be accounted for in list scan */ if (var_refs) { s->memory_used_count++; s->js_func_size += b->closure_var_count * sizeof(*var_refs); for (i = 0; i < b->closure_var_count; i++) { if (var_refs[i]) { double ref_count = var_refs[i]->header.ref_count; s->memory_used_count += 1 / ref_count; s->js_func_size += sizeof(*var_refs[i]) / ref_count; /* handle non object closed values */ if (var_refs[i]->pvalue == &var_refs[i]->value) { /* potential multiple count */ compute_value_size(var_refs[i]->value, hp); } } } } } break; case JS_CLASS_BOUND_FUNCTION: /* u.bound_function */ { JSBoundFunction *bf = p->u.bound_function; /* func_obj and this_val are objects */ for (i = 0; i < bf->argc; i++) { compute_value_size(bf->argv[i], hp); } s->memory_used_count += 1; s->memory_used_size += sizeof(*bf) + bf->argc * sizeof(*bf->argv); } break; case JS_CLASS_C_FUNCTION_DATA: /* u.c_function_data_record */ { JSCFunctionDataRecord *fd = p->u.c_function_data_record; if (fd) { for (i = 0; i < fd->data_len; i++) { compute_value_size(fd->data[i], hp); } s->memory_used_count += 1; s->memory_used_size += sizeof(*fd) + fd->data_len * sizeof(*fd->data); } } break; case JS_CLASS_REGEXP: /* u.regexp */ compute_jsstring_size(p->u.regexp.pattern, hp); compute_jsstring_size(p->u.regexp.bytecode, hp); break; case JS_CLASS_FOR_IN_ITERATOR: /* u.for_in_iterator */ { JSForInIterator *it = p->u.for_in_iterator; if (it) { compute_value_size(it->obj, hp); s->memory_used_count += 1; s->memory_used_size += sizeof(*it); } } break; case JS_CLASS_ARRAY_BUFFER: /* u.array_buffer */ case JS_CLASS_SHARED_ARRAY_BUFFER: /* u.array_buffer */ { JSArrayBuffer *abuf = p->u.array_buffer; if (abuf) { s->memory_used_count += 1; s->memory_used_size += sizeof(*abuf); if (abuf->data) { s->memory_used_count += 1; s->memory_used_size += abuf->byte_length; } } } break; case JS_CLASS_GENERATOR: /* u.generator_data */ case JS_CLASS_UINT8C_ARRAY: /* u.typed_array / u.array */ case JS_CLASS_INT8_ARRAY: /* u.typed_array / u.array */ case JS_CLASS_UINT8_ARRAY: /* u.typed_array / u.array */ case JS_CLASS_INT16_ARRAY: /* u.typed_array / u.array */ case JS_CLASS_UINT16_ARRAY: /* u.typed_array / u.array */ case JS_CLASS_INT32_ARRAY: /* u.typed_array / u.array */ case JS_CLASS_UINT32_ARRAY: /* u.typed_array / u.array */ case JS_CLASS_BIG_INT64_ARRAY: /* u.typed_array / u.array */ case JS_CLASS_BIG_UINT64_ARRAY: /* u.typed_array / u.array */ case JS_CLASS_FLOAT16_ARRAY: /* u.typed_array / u.array */ case JS_CLASS_FLOAT32_ARRAY: /* u.typed_array / u.array */ case JS_CLASS_FLOAT64_ARRAY: /* u.typed_array / u.array */ case JS_CLASS_DATAVIEW: /* u.typed_array */ case JS_CLASS_MAP: /* u.map_state */ case JS_CLASS_SET: /* u.map_state */ case JS_CLASS_WEAKMAP: /* u.map_state */ case JS_CLASS_WEAKSET: /* u.map_state */ case JS_CLASS_MAP_ITERATOR: /* u.map_iterator_data */ case JS_CLASS_SET_ITERATOR: /* u.map_iterator_data */ case JS_CLASS_ARRAY_ITERATOR: /* u.array_iterator_data */ case JS_CLASS_STRING_ITERATOR: /* u.array_iterator_data */ case JS_CLASS_PROXY: /* u.proxy_data */ case JS_CLASS_PROMISE: /* u.promise_data */ case JS_CLASS_PROMISE_RESOLVE_FUNCTION: /* u.promise_function_data */ case JS_CLASS_PROMISE_REJECT_FUNCTION: /* u.promise_function_data */ case JS_CLASS_ASYNC_FUNCTION_RESOLVE: /* u.async_function_data */ case JS_CLASS_ASYNC_FUNCTION_REJECT: /* u.async_function_data */ case JS_CLASS_ASYNC_FROM_SYNC_ITERATOR: /* u.async_from_sync_iterator_data */ case JS_CLASS_ASYNC_GENERATOR: /* u.async_generator_data */ /* TODO */ default: /* XXX: class definition should have an opaque block size */ if (p->u.opaque) { s->memory_used_count += 1; } break; } } s->obj_size += s->obj_count * sizeof(JSObject); /* hashed shapes */ s->memory_used_count++; /* rt->shape_hash */ s->memory_used_size += sizeof(rt->shape_hash[0]) * rt->shape_hash_size; for(i = 0; i < rt->shape_hash_size; i++) { JSShape *sh; for(sh = rt->shape_hash[i]; sh != NULL; sh = sh->shape_hash_next) { int hash_size = sh->prop_hash_mask + 1; s->shape_count++; s->shape_size += get_shape_size(hash_size, sh->prop_size); } } /* atoms */ s->memory_used_count += 2; /* rt->atom_array, rt->atom_hash */ s->atom_count = rt->atom_count; s->atom_size = sizeof(rt->atom_array[0]) * rt->atom_size + sizeof(rt->atom_hash[0]) * rt->atom_hash_size; for(i = 0; i < rt->atom_size; i++) { JSAtomStruct *p = rt->atom_array[i]; if (!atom_is_free(p)) { s->atom_size += (sizeof(*p) + (p->len << p->is_wide_char) + 1 - p->is_wide_char); } } s->str_count = round(mem.str_count); s->str_size = round(mem.str_size); s->js_func_count = mem.js_func_count; s->js_func_size = round(mem.js_func_size); s->js_func_code_size = mem.js_func_code_size; s->js_func_pc2line_count = mem.js_func_pc2line_count; s->js_func_pc2line_size = mem.js_func_pc2line_size; s->memory_used_count += round(mem.memory_used_count) + s->atom_count + s->str_count + s->obj_count + s->shape_count + s->js_func_count + s->js_func_pc2line_count; s->memory_used_size += s->atom_size + s->str_size + s->obj_size + s->prop_size + s->shape_size + s->js_func_size + s->js_func_code_size + s->js_func_pc2line_size; } void JS_DumpMemoryUsage(FILE *fp, const JSMemoryUsage *s, JSRuntime *rt) { fprintf(fp, "QuickJS-ng memory usage -- %s version, %d-bit, %s Endian, malloc limit: %"PRId64"\n\n", JS_GetVersion(), (int)sizeof(void *) * 8, is_be() ? "Big" : "Little", s->malloc_limit); if (rt) { static const struct { const char *name; size_t size; } object_types[] = { { "JSRuntime", sizeof(JSRuntime) }, { "JSContext", sizeof(JSContext) }, { "JSObject", sizeof(JSObject) }, { "JSString", sizeof(JSString) }, { "JSFunctionBytecode", sizeof(JSFunctionBytecode) }, }; int i, usage_size_ok = 0; for(i = 0; i < countof(object_types); i++) { unsigned int size = object_types[i].size; void *p = js_malloc_rt(rt, size); if (p) { unsigned int size1 = js_malloc_usable_size_rt(rt, p); if (size1 >= size) { usage_size_ok = 1; fprintf(fp, " %3u + %-2u %s\n", size, size1 - size, object_types[i].name); } js_free_rt(rt, p); } } if (!usage_size_ok) { fprintf(fp, " malloc_usable_size unavailable\n"); } { int obj_classes[JS_CLASS_INIT_COUNT + 1] = { 0 }; int class_id; struct list_head *el; list_for_each(el, &rt->gc_obj_list) { JSGCObjectHeader *gp = list_entry(el, JSGCObjectHeader, link); JSObject *p; if (gp->gc_obj_type == JS_GC_OBJ_TYPE_JS_OBJECT) { p = (JSObject *)gp; obj_classes[min_uint32(p->class_id, JS_CLASS_INIT_COUNT)]++; } } fprintf(fp, "\n" "JSObject classes\n"); if (obj_classes[0]) fprintf(fp, " %5d %2.0d %s\n", obj_classes[0], 0, "none"); for (class_id = 1; class_id < JS_CLASS_INIT_COUNT; class_id++) { if (obj_classes[class_id] && class_id < rt->class_count) { char buf[ATOM_GET_STR_BUF_SIZE]; fprintf(fp, " %5d %2.0d %s\n", obj_classes[class_id], class_id, JS_AtomGetStrRT(rt, buf, sizeof(buf), rt->class_array[class_id].class_name)); } } if (obj_classes[JS_CLASS_INIT_COUNT]) fprintf(fp, " %5d %2.0d %s\n", obj_classes[JS_CLASS_INIT_COUNT], 0, "other"); } fprintf(fp, "\n"); } fprintf(fp, "%-20s %8s %8s\n", "NAME", "COUNT", "SIZE"); if (s->malloc_count) { fprintf(fp, "%-20s %8"PRId64" %8"PRId64" (%0.1f per block)\n", "memory allocated", s->malloc_count, s->malloc_size, (double)s->malloc_size / s->malloc_count); fprintf(fp, "%-20s %8"PRId64" %8"PRId64" (%d overhead, %0.1f average slack)\n", "memory used", s->memory_used_count, s->memory_used_size, MALLOC_OVERHEAD, ((double)(s->malloc_size - s->memory_used_size) / s->memory_used_count)); } if (s->atom_count) { fprintf(fp, "%-20s %8"PRId64" %8"PRId64" (%0.1f per atom)\n", "atoms", s->atom_count, s->atom_size, (double)s->atom_size / s->atom_count); } if (s->str_count) { fprintf(fp, "%-20s %8"PRId64" %8"PRId64" (%0.1f per string)\n", "strings", s->str_count, s->str_size, (double)s->str_size / s->str_count); } if (s->obj_count) { fprintf(fp, "%-20s %8"PRId64" %8"PRId64" (%0.1f per object)\n", "objects", s->obj_count, s->obj_size, (double)s->obj_size / s->obj_count); fprintf(fp, "%-20s %8"PRId64" %8"PRId64" (%0.1f per object)\n", " properties", s->prop_count, s->prop_size, (double)s->prop_count / s->obj_count); fprintf(fp, "%-20s %8"PRId64" %8"PRId64" (%0.1f per shape)\n", " shapes", s->shape_count, s->shape_size, (double)s->shape_size / s->shape_count); } if (s->js_func_count) { fprintf(fp, "%-20s %8"PRId64" %8"PRId64"\n", "bytecode functions", s->js_func_count, s->js_func_size); fprintf(fp, "%-20s %8"PRId64" %8"PRId64" (%0.1f per function)\n", " bytecode", s->js_func_count, s->js_func_code_size, (double)s->js_func_code_size / s->js_func_count); if (s->js_func_pc2line_count) { fprintf(fp, "%-20s %8"PRId64" %8"PRId64" (%0.1f per function)\n", " pc2line", s->js_func_pc2line_count, s->js_func_pc2line_size, (double)s->js_func_pc2line_size / s->js_func_pc2line_count); } } if (s->c_func_count) { fprintf(fp, "%-20s %8"PRId64"\n", "C functions", s->c_func_count); } if (s->array_count) { fprintf(fp, "%-20s %8"PRId64"\n", "arrays", s->array_count); if (s->fast_array_count) { fprintf(fp, "%-20s %8"PRId64"\n", " fast arrays", s->fast_array_count); fprintf(fp, "%-20s %8"PRId64" %8"PRId64" (%0.1f per fast array)\n", " elements", s->fast_array_elements, s->fast_array_elements * (int)sizeof(JSValue), (double)s->fast_array_elements / s->fast_array_count); } } if (s->binary_object_count) { fprintf(fp, "%-20s %8"PRId64" %8"PRId64"\n", "binary objects", s->binary_object_count, s->binary_object_size); } } JSValue JS_GetGlobalObject(JSContext *ctx) { return js_dup(ctx->global_obj); } /* WARNING: obj is freed */ JSValue JS_Throw(JSContext *ctx, JSValue obj) { JSRuntime *rt = ctx->rt; JS_FreeValue(ctx, rt->current_exception); rt->current_exception = obj; return JS_EXCEPTION; } /* return the pending exception (cannot be called twice). */ JSValue JS_GetException(JSContext *ctx) { JSValue val; JSRuntime *rt = ctx->rt; val = rt->current_exception; rt->current_exception = JS_UNINITIALIZED; return val; } bool JS_HasException(JSContext *ctx) { return !JS_IsUninitialized(ctx->rt->current_exception); } /* returns the pending backtrace (cannot be called twice). */ JSValue JS_GetBacktrace(JSContext *ctx) { JSValue val = ctx->error_back_trace; ctx->error_back_trace = JS_UNDEFINED; return val; } static void dbuf_put_leb128(DynBuf *s, uint32_t v) { uint32_t a; for(;;) { a = v & 0x7f; v >>= 7; if (v != 0) { dbuf_putc(s, a | 0x80); } else { dbuf_putc(s, a); break; } } } static void dbuf_put_sleb128(DynBuf *s, int32_t v1) { uint32_t v = v1; dbuf_put_leb128(s, (2 * v) ^ -(v >> 31)); } static int get_leb128(uint32_t *pval, const uint8_t *buf, const uint8_t *buf_end) { const uint8_t *ptr = buf; uint32_t v, a, i; v = 0; for(i = 0; i < 5; i++) { if (unlikely(ptr >= buf_end)) break; a = *ptr++; v |= (a & 0x7f) << (i * 7); if (!(a & 0x80)) { *pval = v; return ptr - buf; } } *pval = 0; return -1; } static int get_sleb128(int32_t *pval, const uint8_t *buf, const uint8_t *buf_end) { int ret; uint32_t val; ret = get_leb128(&val, buf, buf_end); if (ret < 0) { *pval = 0; return -1; } *pval = (val >> 1) ^ -(val & 1); return ret; } static int find_line_num(JSContext *ctx, JSFunctionBytecode *b, uint32_t pc_value, int *col) { const uint8_t *p_end, *p; int new_line_num, new_col_num, line_num, col_num, pc, v, ret; unsigned int op; *col = 1; p = b->pc2line_buf; if (!p) goto fail; p_end = p + b->pc2line_len; pc = 0; line_num = b->line_num; col_num = b->col_num; while (p < p_end) { op = *p++; if (op == 0) { uint32_t val; ret = get_leb128(&val, p, p_end); if (ret < 0) goto fail; pc += val; p += ret; ret = get_sleb128(&v, p, p_end); if (ret < 0) goto fail; p += ret; new_line_num = line_num + v; } else { op -= PC2LINE_OP_FIRST; pc += (op / PC2LINE_RANGE); new_line_num = line_num + (op % PC2LINE_RANGE) + PC2LINE_BASE; } ret = get_sleb128(&v, p, p_end); if (ret < 0) goto fail; p += ret; new_col_num = col_num + v; if (pc_value < pc) break; line_num = new_line_num; col_num = new_col_num; } *col = col_num; return line_num; fail: /* should never happen */ return b->line_num; } /* in order to avoid executing arbitrary code during the stack trace generation, we only look at simple 'name' properties containing a string. */ static const char *get_func_name(JSContext *ctx, JSValueConst func) { JSProperty *pr; JSShapeProperty *prs; JSValue val; if (JS_VALUE_GET_TAG(func) != JS_TAG_OBJECT) return NULL; prs = find_own_property(&pr, JS_VALUE_GET_OBJ(func), JS_ATOM_name); if (!prs) return NULL; if ((prs->flags & JS_PROP_TMASK) != JS_PROP_NORMAL) return NULL; val = pr->u.value; if (JS_VALUE_GET_TAG(val) != JS_TAG_STRING) return NULL; return JS_ToCString(ctx, val); } /* Note: it is important that no exception is returned by this function */ static bool can_add_backtrace(JSValueConst obj) { JSObject *p; if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT) return false; p = JS_VALUE_GET_OBJ(obj); if (p->class_id != JS_CLASS_ERROR && p->class_id != JS_CLASS_DOM_EXCEPTION) return false; if (find_own_property1(p, JS_ATOM_stack)) return false; return true; } #define JS_BACKTRACE_FLAG_SKIP_FIRST_LEVEL (1 << 0) /* only taken into account if filename is provided */ #define JS_BACKTRACE_FLAG_SINGLE_LEVEL (1 << 1) #define JS_BACKTRACE_FLAG_FILTER_FUNC (1 << 2) /* if filename != NULL, an additional level is added with the filename and line number information (used for parse error). */ static void build_backtrace(JSContext *ctx, JSValueConst error_val, JSValueConst filter_func, const char *filename, int line_num, int col_num, int backtrace_flags) { JSStackFrame *sf, *sf_start; JSValue stack, prepare, saved_exception; DynBuf dbuf; const char *func_name_str; const char *str1; JSObject *p; JSFunctionBytecode *b; bool backtrace_barrier, has_prepare, has_filter_func; JSRuntime *rt; JSCallSiteData csd[64]; uint32_t i; double d; int stack_trace_limit; rt = ctx->rt; if (rt->in_build_stack_trace) return; rt->in_build_stack_trace = true; // Save exception because conversion to double may fail. saved_exception = JS_GetException(ctx); // Extract stack trace limit. // Ignore error since it sets d to NAN anyway. // coverity[check_return] JS_ToFloat64(ctx, &d, ctx->error_stack_trace_limit); if (isnan(d) || d < 0.0) stack_trace_limit = 0; else if (d > INT32_MAX) stack_trace_limit = INT32_MAX; else stack_trace_limit = fabs(d); // Restore current exception. JS_Throw(ctx, saved_exception); saved_exception = JS_UNINITIALIZED; stack_trace_limit = min_int(stack_trace_limit, countof(csd)); stack_trace_limit = max_int(stack_trace_limit, 0); has_prepare = false; has_filter_func = backtrace_flags & JS_BACKTRACE_FLAG_FILTER_FUNC; i = 0; if (!JS_IsNull(ctx->error_ctor)) { prepare = js_dup(ctx->error_prepare_stack); has_prepare = JS_IsFunction(ctx, prepare); } if (has_prepare) { saved_exception = JS_GetException(ctx); if (stack_trace_limit == 0) goto done; if (filename) js_new_callsite_data2(ctx, &csd[i++], filename, line_num, col_num); } else { js_dbuf_init(ctx, &dbuf); if (stack_trace_limit == 0) goto done; if (filename) { i++; dbuf_printf(&dbuf, " at %s", filename); if (line_num != -1) dbuf_printf(&dbuf, ":%d:%d", line_num, col_num); dbuf_putc(&dbuf, '\n'); } } if (filename && (backtrace_flags & JS_BACKTRACE_FLAG_SINGLE_LEVEL)) goto done; sf_start = rt->current_stack_frame; /* Find the frame we want to start from. Note that when a filter is used the filter function will be the first, but we also specify we want to skip the first one. */ if (has_filter_func) { for (sf = sf_start; sf != NULL && i < stack_trace_limit; sf = sf->prev_frame) { if (js_same_value(ctx, sf->cur_func, filter_func)) { sf_start = sf; break; } } } for (sf = sf_start; sf != NULL && i < stack_trace_limit; sf = sf->prev_frame) { if (backtrace_flags & JS_BACKTRACE_FLAG_SKIP_FIRST_LEVEL) { backtrace_flags &= ~JS_BACKTRACE_FLAG_SKIP_FIRST_LEVEL; continue; } p = JS_VALUE_GET_OBJ(sf->cur_func); b = NULL; backtrace_barrier = false; if (js_class_has_bytecode(p->class_id)) { b = p->u.func.function_bytecode; backtrace_barrier = b->backtrace_barrier; } if (has_prepare) { js_new_callsite_data(ctx, &csd[i], sf); } else { /* func_name_str is UTF-8 encoded if needed */ func_name_str = get_func_name(ctx, sf->cur_func); if (!func_name_str || func_name_str[0] == '\0') str1 = ""; else str1 = func_name_str; dbuf_printf(&dbuf, " at %s", str1); JS_FreeCString(ctx, func_name_str); if (b && sf->cur_pc) { const char *atom_str; int line_num1, col_num1; uint32_t pc; pc = sf->cur_pc - b->byte_code_buf - 1; line_num1 = find_line_num(ctx, b, pc, &col_num1); atom_str = b->filename ? JS_AtomToCString(ctx, b->filename) : NULL; dbuf_printf(&dbuf, " (%s", atom_str ? atom_str : ""); JS_FreeCString(ctx, atom_str); if (line_num1 != -1) dbuf_printf(&dbuf, ":%d:%d", line_num1, col_num1); dbuf_putc(&dbuf, ')'); } else if (b) { // FIXME(bnoordhuis) Missing `sf->cur_pc = pc` in bytecode // handler in JS_CallInternal. Almost never user observable // except with intercepting JS proxies that throw exceptions. dbuf_printf(&dbuf, " (missing)"); } else { dbuf_printf(&dbuf, " (native)"); } dbuf_putc(&dbuf, '\n'); } i++; /* stop backtrace if JS_EVAL_FLAG_BACKTRACE_BARRIER was used */ if (backtrace_barrier) break; } done: if (has_prepare) { int j = 0, k; stack = JS_NewArray(ctx); if (JS_IsException(stack)) { stack = JS_NULL; } else { for (; j < i; j++) { JSValue v = js_new_callsite(ctx, &csd[j]); if (JS_IsException(v)) break; if (JS_DefinePropertyValueUint32(ctx, stack, j, v, JS_PROP_C_W_E) < 0) { JS_FreeValue(ctx, v); break; } } } // Clear the csd's we didn't use in case of error. for (k = j; k < i; k++) { JS_FreeValue(ctx, csd[k].filename); JS_FreeValue(ctx, csd[k].func); JS_FreeValue(ctx, csd[k].func_name); } JSValueConst args[] = { error_val, stack, }; JSValue stack2 = JS_Call(ctx, prepare, ctx->error_ctor, countof(args), args); JS_FreeValue(ctx, stack); if (JS_IsException(stack2)) stack = JS_NULL; else stack = stack2; JS_FreeValue(ctx, prepare); JS_Throw(ctx, saved_exception); } else { if (dbuf_error(&dbuf)) stack = JS_NULL; else stack = JS_NewStringLen(ctx, (char *)dbuf.buf, dbuf.size); dbuf_free(&dbuf); } if (JS_IsUndefined(ctx->error_back_trace)) ctx->error_back_trace = js_dup(stack); if (has_filter_func || can_add_backtrace(error_val)) { JS_DefinePropertyValue(ctx, error_val, JS_ATOM_stack, stack, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE); } else { JS_FreeValue(ctx, stack); } rt->in_build_stack_trace = false; } JSValue JS_NewError(JSContext *ctx) { JSValue obj = JS_NewObjectClass(ctx, JS_CLASS_ERROR); if (JS_IsException(obj)) return JS_EXCEPTION; build_backtrace(ctx, obj, JS_UNDEFINED, NULL, 0, 0, 0); return obj; } static JSValue JS_MakeError2(JSContext *ctx, JSErrorEnum error_num, bool add_backtrace, const char *message) { JSValue obj, msg; if (error_num == JS_PLAIN_ERROR) { obj = JS_NewObjectClass(ctx, JS_CLASS_ERROR); } else { obj = JS_NewObjectProtoClass(ctx, ctx->native_error_proto[error_num], JS_CLASS_ERROR); } if (JS_IsException(obj)) return JS_EXCEPTION; msg = JS_NewString(ctx, message); if (JS_IsException(msg)) msg = JS_NewString(ctx, "Invalid error message"); if (!JS_IsException(msg)) { JS_DefinePropertyValue(ctx, obj, JS_ATOM_message, msg, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE); } if (add_backtrace) build_backtrace(ctx, obj, JS_UNDEFINED, NULL, 0, 0, 0); return obj; } static JSValue JS_PRINTF_FORMAT_ATTR(4, 0) JS_MakeError(JSContext *ctx, JSErrorEnum error_num, bool add_backtrace, JS_PRINTF_FORMAT const char *fmt, va_list ap) { char buf[256]; vsnprintf(buf, sizeof(buf), fmt, ap); return JS_MakeError2(ctx, error_num, add_backtrace, buf); } /* fmt and arguments may be pure ASCII or UTF-8 encoded contents */ static JSValue JS_PRINTF_FORMAT_ATTR(4, 0) JS_ThrowError2(JSContext *ctx, JSErrorEnum error_num, bool add_backtrace, JS_PRINTF_FORMAT const char *fmt, va_list ap) { JSValue obj; obj = JS_MakeError(ctx, error_num, add_backtrace, fmt, ap); if (unlikely(JS_IsException(obj))) { /* out of memory: throw JS_NULL to avoid recursing */ obj = JS_NULL; } return JS_Throw(ctx, obj); } static JSValue JS_PRINTF_FORMAT_ATTR(3, 0) JS_ThrowError(JSContext *ctx, JSErrorEnum error_num, JS_PRINTF_FORMAT const char *fmt, va_list ap) { JSRuntime *rt = ctx->rt; JSStackFrame *sf; bool add_backtrace; /* the backtrace is added later if called from a bytecode function */ sf = rt->current_stack_frame; add_backtrace = !rt->in_out_of_memory && (!sf || (JS_GetFunctionBytecode(sf->cur_func) == NULL)); return JS_ThrowError2(ctx, error_num, add_backtrace, fmt, ap); } #define JS_ERROR_MAP(X) \ X(Internal, INTERNAL) \ X(Plain, PLAIN) \ X(Range, RANGE) \ X(Reference, REFERENCE) \ X(Syntax, SYNTAX) \ X(Type, TYPE) \ #define X(lc, uc) \ JSValue JS_PRINTF_FORMAT_ATTR(2, 3) \ JS_New##lc##Error(JSContext *ctx, \ JS_PRINTF_FORMAT const char *fmt, ...) \ { \ JSValue val; \ va_list ap; \ \ va_start(ap, fmt); \ val = JS_MakeError(ctx, JS_##uc##_ERROR, \ /*add_backtrace*/true, fmt, ap); \ va_end(ap); \ return val; \ } \ JSValue JS_PRINTF_FORMAT_ATTR(2, 3) \ JS_Throw##lc##Error(JSContext *ctx, \ JS_PRINTF_FORMAT const char *fmt, ...) \ { \ JSValue val; \ va_list ap; \ \ va_start(ap, fmt); \ val = JS_ThrowError(ctx, JS_##uc##_ERROR, fmt, ap); \ va_end(ap); \ return val; \ } \ JS_ERROR_MAP(X) #undef X #undef JS_ERROR_MAP static int JS_PRINTF_FORMAT_ATTR(3, 4) JS_ThrowTypeErrorOrFalse(JSContext *ctx, int flags, JS_PRINTF_FORMAT const char *fmt, ...) { va_list ap; if ((flags & JS_PROP_THROW) || ((flags & JS_PROP_THROW_STRICT) && is_strict_mode(ctx))) { va_start(ap, fmt); JS_ThrowError(ctx, JS_TYPE_ERROR, fmt, ap); va_end(ap); return -1; } else { return false; } } #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif // __GNUC__ static JSValue JS_ThrowTypeErrorAtom(JSContext *ctx, const char *fmt, JSAtom atom) { char buf[ATOM_GET_STR_BUF_SIZE]; JS_AtomGetStr(ctx, buf, sizeof(buf), atom); return JS_ThrowTypeError(ctx, fmt, buf); } static JSValue JS_ThrowSyntaxErrorAtom(JSContext *ctx, const char *fmt, JSAtom atom) { char buf[ATOM_GET_STR_BUF_SIZE]; JS_AtomGetStr(ctx, buf, sizeof(buf), atom); return JS_ThrowSyntaxError(ctx, fmt, buf); } #ifdef __GNUC__ #pragma GCC diagnostic pop // ignored "-Wformat-nonliteral" #endif // __GNUC__ static int JS_ThrowTypeErrorReadOnly(JSContext *ctx, int flags, JSAtom atom) { if ((flags & JS_PROP_THROW) || ((flags & JS_PROP_THROW_STRICT) && is_strict_mode(ctx))) { JS_ThrowTypeErrorAtom(ctx, "'%s' is read-only", atom); return -1; } else { return false; } } JSValue JS_ThrowOutOfMemory(JSContext *ctx) { JSRuntime *rt = ctx->rt; if (!rt->in_out_of_memory) { rt->in_out_of_memory = true; JS_ThrowInternalError(ctx, "out of memory"); rt->in_out_of_memory = false; } return JS_EXCEPTION; } static JSValue JS_ThrowStackOverflow(JSContext *ctx) { return JS_ThrowRangeError(ctx, "Maximum call stack size exceeded"); } static JSValue JS_ThrowTypeErrorNotAConstructor(JSContext *ctx, JSValueConst func_obj) { JSObject *p; JSAtom name; if (JS_TAG_OBJECT != JS_VALUE_GET_TAG(func_obj)) goto fini; p = JS_VALUE_GET_OBJ(func_obj); if (!js_class_has_bytecode(p->class_id)) goto fini; name = p->u.func.function_bytecode->func_name; if (name == JS_ATOM_NULL) goto fini; return JS_ThrowTypeErrorAtom(ctx, "%s is not a constructor", name); fini: return JS_ThrowTypeError(ctx, "not a constructor"); } static JSValue JS_ThrowTypeErrorNotAFunction(JSContext *ctx) { return JS_ThrowTypeError(ctx, "not a function"); } static JSValue JS_ThrowTypeErrorNotAnObject(JSContext *ctx) { return JS_ThrowTypeError(ctx, "not an object"); } static JSValue JS_ThrowTypeErrorNotASymbol(JSContext *ctx) { return JS_ThrowTypeError(ctx, "not a symbol"); } static JSValue JS_ThrowReferenceErrorNotDefined(JSContext *ctx, JSAtom name) { char buf[ATOM_GET_STR_BUF_SIZE]; return JS_ThrowReferenceError(ctx, "%s is not defined", JS_AtomGetStr(ctx, buf, sizeof(buf), name)); } static JSValue JS_ThrowReferenceErrorUninitialized(JSContext *ctx, JSAtom name) { char buf[ATOM_GET_STR_BUF_SIZE]; return JS_ThrowReferenceError(ctx, "%s is not initialized", name == JS_ATOM_NULL ? "lexical variable" : JS_AtomGetStr(ctx, buf, sizeof(buf), name)); } static JSValue JS_ThrowReferenceErrorUninitialized2(JSContext *ctx, JSFunctionBytecode *b, int idx, bool is_ref) { JSAtom atom = JS_ATOM_NULL; if (is_ref) { atom = b->closure_var[idx].var_name; } else { /* not present if the function is stripped and contains no eval() */ if (b->vardefs) atom = b->vardefs[b->arg_count + idx].var_name; } return JS_ThrowReferenceErrorUninitialized(ctx, atom); } static JSValue JS_ThrowTypeErrorInvalidClass(JSContext *ctx, int class_id) { JSRuntime *rt = ctx->rt; JSAtom name; name = rt->class_array[class_id].class_name; return JS_ThrowTypeErrorAtom(ctx, "%s object expected", name); } static void JS_ThrowInterrupted(JSContext *ctx) { JS_ThrowInternalError(ctx, "interrupted"); JS_SetUncatchableError(ctx, ctx->rt->current_exception); } static no_inline __exception int __js_poll_interrupts(JSContext *ctx) { JSRuntime *rt = ctx->rt; ctx->interrupt_counter = JS_INTERRUPT_COUNTER_INIT; if (rt->interrupt_handler) { if (rt->interrupt_handler(rt, rt->interrupt_opaque)) { JS_ThrowInterrupted(ctx); return -1; } } return 0; } static inline __exception int js_poll_interrupts(JSContext *ctx) { if (unlikely(--ctx->interrupt_counter <= 0)) { return __js_poll_interrupts(ctx); } else { return 0; } } /* return -1 (exception) or true/false */ static int JS_SetPrototypeInternal(JSContext *ctx, JSValueConst obj, JSValueConst proto_val, bool throw_flag) { JSObject *proto, *p, *p1; JSShape *sh; if (throw_flag) { if (JS_VALUE_GET_TAG(obj) == JS_TAG_NULL || JS_VALUE_GET_TAG(obj) == JS_TAG_UNDEFINED) goto not_obj; } else { if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT) goto not_obj; } p = JS_VALUE_GET_OBJ(obj); if (JS_VALUE_GET_TAG(proto_val) != JS_TAG_OBJECT) { if (JS_VALUE_GET_TAG(proto_val) != JS_TAG_NULL) { not_obj: JS_ThrowTypeErrorNotAnObject(ctx); return -1; } proto = NULL; } else { proto = JS_VALUE_GET_OBJ(proto_val); } if (throw_flag && JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT) return true; if (unlikely(p->class_id == JS_CLASS_PROXY)) return js_proxy_setPrototypeOf(ctx, obj, proto_val, throw_flag); sh = p->shape; if (sh->proto == proto) return true; if (p == JS_VALUE_GET_OBJ(ctx->class_proto[JS_CLASS_OBJECT])) { if (throw_flag) { JS_ThrowTypeError(ctx, "'Immutable prototype object \'Object.prototype\' cannot have their prototype set'"); return -1; } return false; } if (!p->extensible) { if (throw_flag) { JS_ThrowTypeError(ctx, "object is not extensible"); return -1; } else { return false; } } if (proto) { /* check if there is a cycle */ p1 = proto; do { if (p1 == p) { if (throw_flag) { JS_ThrowTypeError(ctx, "circular prototype chain"); return -1; } else { return false; } } /* Note: for Proxy objects, proto is NULL */ p1 = p1->shape->proto; } while (p1 != NULL); js_dup(proto_val); } if (js_shape_prepare_update(ctx, p, NULL)) return -1; sh = p->shape; if (sh->proto) JS_FreeValue(ctx, JS_MKPTR(JS_TAG_OBJECT, sh->proto)); sh->proto = proto; return true; } /* return -1 (exception) or true/false */ int JS_SetPrototype(JSContext *ctx, JSValueConst obj, JSValueConst proto_val) { return JS_SetPrototypeInternal(ctx, obj, proto_val, true); } /* Only works for primitive types, otherwise return JS_NULL. */ static JSValueConst JS_GetPrototypePrimitive(JSContext *ctx, JSValueConst val) { JSValue ret; switch(JS_VALUE_GET_NORM_TAG(val)) { case JS_TAG_SHORT_BIG_INT: case JS_TAG_BIG_INT: ret = ctx->class_proto[JS_CLASS_BIG_INT]; break; case JS_TAG_INT: case JS_TAG_FLOAT64: ret = ctx->class_proto[JS_CLASS_NUMBER]; break; case JS_TAG_BOOL: ret = ctx->class_proto[JS_CLASS_BOOLEAN]; break; case JS_TAG_STRING: ret = ctx->class_proto[JS_CLASS_STRING]; break; case JS_TAG_SYMBOL: ret = ctx->class_proto[JS_CLASS_SYMBOL]; break; case JS_TAG_OBJECT: case JS_TAG_NULL: case JS_TAG_UNDEFINED: default: ret = JS_NULL; break; } return ret; } /* Return an Object, JS_NULL or JS_EXCEPTION in case of Proxy object. */ JSValue JS_GetPrototype(JSContext *ctx, JSValueConst obj) { JSValue val; if (JS_VALUE_GET_TAG(obj) == JS_TAG_OBJECT) { JSObject *p; p = JS_VALUE_GET_OBJ(obj); if (unlikely(p->class_id == JS_CLASS_PROXY)) { val = js_proxy_getPrototypeOf(ctx, obj); } else { p = p->shape->proto; if (!p) val = JS_NULL; else val = js_dup(JS_MKPTR(JS_TAG_OBJECT, p)); } } else { val = js_dup(JS_GetPrototypePrimitive(ctx, obj)); } return val; } static JSValue JS_GetPrototypeFree(JSContext *ctx, JSValue obj) { JSValue obj1; obj1 = JS_GetPrototype(ctx, obj); JS_FreeValue(ctx, obj); return obj1; } int JS_GetLength(JSContext *ctx, JSValueConst obj, int64_t *pres) { return js_get_length64(ctx, pres, obj); } int JS_SetLength(JSContext *ctx, JSValueConst obj, int64_t len) { return js_set_length64(ctx, obj, len); } /* return true, false or (-1) in case of exception */ static int JS_OrdinaryIsInstanceOf(JSContext *ctx, JSValueConst val, JSValueConst obj) { JSValue obj_proto; JSObject *proto; const JSObject *p, *proto1; int ret; if (!JS_IsFunction(ctx, obj)) return false; p = JS_VALUE_GET_OBJ(obj); if (p->class_id == JS_CLASS_BOUND_FUNCTION) { JSBoundFunction *s = p->u.bound_function; return JS_IsInstanceOf(ctx, val, s->func_obj); } /* Only explicitly boxed values are instances of constructors */ if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT) return false; obj_proto = JS_GetProperty(ctx, obj, JS_ATOM_prototype); if (JS_VALUE_GET_TAG(obj_proto) != JS_TAG_OBJECT) { if (!JS_IsException(obj_proto)) JS_ThrowTypeError(ctx, "operand 'prototype' property is not an object"); ret = -1; goto done; } proto = JS_VALUE_GET_OBJ(obj_proto); p = JS_VALUE_GET_OBJ(val); for(;;) { proto1 = p->shape->proto; if (!proto1) { /* slow case if proxy in the prototype chain */ if (unlikely(p->class_id == JS_CLASS_PROXY)) { JSValue obj1; obj1 = js_dup(JS_MKPTR(JS_TAG_OBJECT, (JSObject *)p)); for(;;) { obj1 = JS_GetPrototypeFree(ctx, obj1); if (JS_IsException(obj1)) { ret = -1; break; } if (JS_IsNull(obj1)) { ret = false; break; } if (proto == JS_VALUE_GET_OBJ(obj1)) { JS_FreeValue(ctx, obj1); ret = true; break; } /* must check for timeout to avoid infinite loop */ if (js_poll_interrupts(ctx)) { JS_FreeValue(ctx, obj1); ret = -1; break; } } } else { ret = false; } break; } p = proto1; if (proto == p) { ret = true; break; } } done: JS_FreeValue(ctx, obj_proto); return ret; } /* return true, false or (-1) in case of exception */ int JS_IsInstanceOf(JSContext *ctx, JSValueConst val, JSValueConst obj) { JSValue method; if (!JS_IsObject(obj)) goto fail; method = JS_GetProperty(ctx, obj, JS_ATOM_Symbol_hasInstance); if (JS_IsException(method)) return -1; if (!JS_IsNull(method) && !JS_IsUndefined(method)) { JSValue ret; ret = JS_CallFree(ctx, method, obj, 1, &val); return JS_ToBoolFree(ctx, ret); } /* legacy case */ if (!JS_IsFunction(ctx, obj)) { fail: JS_ThrowTypeError(ctx, "invalid 'instanceof' right operand"); return -1; } return JS_OrdinaryIsInstanceOf(ctx, val, obj); } #include "builtin-array-fromasync.h" static JSValue js_bytecode_autoinit(JSContext *ctx, JSObject *p, JSAtom atom, void *opaque) { switch ((uintptr_t)opaque) { default: abort(); case JS_BUILTIN_ARRAY_FROMASYNC: { JSValue obj = JS_ReadObject(ctx, qjsc_builtin_array_fromasync, sizeof(qjsc_builtin_array_fromasync), JS_READ_OBJ_BYTECODE); if (JS_IsException(obj)) return JS_EXCEPTION; JSValue fun = JS_EvalFunction(ctx, obj); if (JS_IsException(fun)) return JS_EXCEPTION; assert(JS_IsFunction(ctx, fun)); JSValue args[] = { JS_NewCFunction(ctx, js_array_constructor, "Array", 0), JS_NewCFunctionMagic(ctx, js_error_constructor, "TypeError", 1, JS_CFUNC_constructor_or_func_magic, JS_TYPE_ERROR), JS_AtomToValue(ctx, JS_ATOM_Symbol_asyncIterator), JS_NewCFunctionMagic(ctx, js_object_defineProperty, "Object.defineProperty", 3, JS_CFUNC_generic_magic, 0), JS_AtomToValue(ctx, JS_ATOM_Symbol_iterator), }; JSValue result = JS_Call(ctx, fun, JS_UNDEFINED, countof(args), vc(args)); for (size_t i = 0; i < countof(args); i++) JS_FreeValue(ctx, args[i]); JS_FreeValue(ctx, fun); if (JS_SetPrototypeInternal(ctx, result, ctx->function_proto, /*throw_flag*/true) < 0) { JS_FreeValue(ctx, result); return JS_EXCEPTION; } return result; } } return JS_UNDEFINED; } /* return the value associated to the autoinit property or an exception */ typedef JSValue JSAutoInitFunc(JSContext *ctx, JSObject *p, JSAtom atom, void *opaque); static JSAutoInitFunc *const js_autoinit_func_table[] = { js_instantiate_prototype, /* JS_AUTOINIT_ID_PROTOTYPE */ js_module_ns_autoinit, /* JS_AUTOINIT_ID_MODULE_NS */ JS_InstantiateFunctionListItem2, /* JS_AUTOINIT_ID_PROP */ js_bytecode_autoinit, /* JS_AUTOINIT_ID_BYTECODE */ }; /* warning: 'prs' is reallocated after it */ static int JS_AutoInitProperty(JSContext *ctx, JSObject *p, JSAtom prop, JSProperty *pr, JSShapeProperty *prs) { JSValue val; JSContext *realm; JSAutoInitFunc *func; if (js_shape_prepare_update(ctx, p, &prs)) return -1; realm = js_autoinit_get_realm(pr); func = js_autoinit_func_table[js_autoinit_get_id(pr)]; /* 'func' shall not modify the object properties 'pr' */ val = func(realm, p, prop, pr->u.init.opaque); js_autoinit_free(ctx->rt, pr); prs->flags &= ~JS_PROP_TMASK; pr->u.value = JS_UNDEFINED; if (JS_IsException(val)) return -1; pr->u.value = val; return 0; } static JSValue JS_GetPropertyInternal(JSContext *ctx, JSValueConst obj, JSAtom prop, JSValueConst this_obj, bool throw_ref_error) { JSObject *p; JSProperty *pr; JSShapeProperty *prs; uint32_t tag; tag = JS_VALUE_GET_TAG(obj); if (unlikely(tag != JS_TAG_OBJECT)) { switch(tag) { case JS_TAG_NULL: return JS_ThrowTypeErrorAtom(ctx, "cannot read property '%s' of null", prop); case JS_TAG_UNDEFINED: return JS_ThrowTypeErrorAtom(ctx, "cannot read property '%s' of undefined", prop); case JS_TAG_EXCEPTION: return JS_EXCEPTION; case JS_TAG_STRING: { JSString *p1 = JS_VALUE_GET_STRING(obj); if (__JS_AtomIsTaggedInt(prop)) { uint32_t idx, ch; idx = __JS_AtomToUInt32(prop); if (idx < p1->len) { ch = string_get(p1, idx); return js_new_string_char(ctx, ch); } } else if (prop == JS_ATOM_length) { return js_int32(p1->len); } } break; default: break; } /* cannot raise an exception */ p = JS_VALUE_GET_OBJ(JS_GetPrototypePrimitive(ctx, obj)); if (!p) return JS_UNDEFINED; } else { p = JS_VALUE_GET_OBJ(obj); } for(;;) { prs = find_own_property(&pr, p, prop); if (prs) { /* found */ if (unlikely(prs->flags & JS_PROP_TMASK)) { if ((prs->flags & JS_PROP_TMASK) == JS_PROP_GETSET) { if (unlikely(!pr->u.getset.getter)) { return JS_UNDEFINED; } else { JSValue func = JS_MKPTR(JS_TAG_OBJECT, pr->u.getset.getter); /* Note: the field could be removed in the getter */ func = js_dup(func); return JS_CallFree(ctx, func, this_obj, 0, NULL); } } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_VARREF) { JSValue val = *pr->u.var_ref->pvalue; if (unlikely(JS_IsUninitialized(val))) return JS_ThrowReferenceErrorUninitialized(ctx, prs->atom); return js_dup(val); } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_AUTOINIT) { /* Instantiate property and retry */ if (JS_AutoInitProperty(ctx, p, prop, pr, prs)) return JS_EXCEPTION; continue; } } else { if (JS_IsUndefined(pr->u.value) && ctx->handleUndefined) ctx->handleUndefined(ctx); return js_dup(pr->u.value); } } if (unlikely(p->is_exotic)) { /* exotic behaviors */ if (p->fast_array) { if (__JS_AtomIsTaggedInt(prop)) { uint32_t idx = __JS_AtomToUInt32(prop); if (idx < p->u.array.count) { /* we avoid duplicating the code */ return JS_GetPropertyUint32(ctx, JS_MKPTR(JS_TAG_OBJECT, p), idx); } else if (is_typed_array(p->class_id)) { return JS_UNDEFINED; } } else if (is_typed_array(p->class_id)) { int ret; ret = JS_AtomIsNumericIndex(ctx, prop); if (ret != 0) { if (ret < 0) return JS_EXCEPTION; return JS_UNDEFINED; } } } else { const JSClassExoticMethods *em = ctx->rt->class_array[p->class_id].exotic; if (em) { if (em->get_property) { JSValue obj1, retval; /* XXX: should pass throw_ref_error */ /* Note: if 'p' is a prototype, it can be freed in the called function */ obj1 = js_dup(JS_MKPTR(JS_TAG_OBJECT, p)); retval = em->get_property(ctx, obj1, prop, this_obj); JS_FreeValue(ctx, obj1); return retval; } if (em->get_own_property) { JSPropertyDescriptor desc; int ret; JSValue obj1; /* Note: if 'p' is a prototype, it can be freed in the called function */ obj1 = js_dup(JS_MKPTR(JS_TAG_OBJECT, p)); ret = em->get_own_property(ctx, &desc, obj1, prop); JS_FreeValue(ctx, obj1); if (ret < 0) return JS_EXCEPTION; if (ret) { if (desc.flags & JS_PROP_GETSET) { JS_FreeValue(ctx, desc.setter); return JS_CallFree(ctx, desc.getter, this_obj, 0, NULL); } else { return desc.value; } } } } } } p = p->shape->proto; if (!p) break; } if (unlikely(throw_ref_error)) { return JS_ThrowReferenceErrorNotDefined(ctx, prop); } else { return JS_UNDEFINED; } } JSValue JS_GetProperty(JSContext *ctx, JSValueConst this_obj, JSAtom prop) { return JS_GetPropertyInternal(ctx, this_obj, prop, this_obj, false); } static JSValue JS_ThrowTypeErrorPrivateNotFound(JSContext *ctx, JSAtom atom) { return JS_ThrowTypeErrorAtom(ctx, "private class field '%s' does not exist", atom); } /* Private fields can be added even on non extensible objects or Proxies */ static int JS_DefinePrivateField(JSContext *ctx, JSValueConst obj, JSValue name, JSValue val) { JSObject *p; JSShapeProperty *prs; JSProperty *pr; JSAtom prop; if (unlikely(JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT)) { JS_ThrowTypeErrorNotAnObject(ctx); goto fail; } /* safety check */ if (unlikely(JS_VALUE_GET_TAG(name) != JS_TAG_SYMBOL)) { JS_ThrowTypeErrorNotASymbol(ctx); goto fail; } prop = js_symbol_to_atom(ctx, name); p = JS_VALUE_GET_OBJ(obj); prs = find_own_property(&pr, p, prop); if (prs) { JS_ThrowTypeErrorAtom(ctx, "private class field '%s' already exists", prop); goto fail; } pr = add_property(ctx, p, prop, JS_PROP_C_W_E); if (unlikely(!pr)) { fail: JS_FreeValue(ctx, val); return -1; } pr->u.value = val; return 0; } static JSValue JS_GetPrivateField(JSContext *ctx, JSValueConst obj, JSValueConst name) { JSObject *p; JSShapeProperty *prs; JSProperty *pr; JSAtom prop; if (unlikely(JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT)) return JS_ThrowTypeErrorNotAnObject(ctx); /* safety check */ if (unlikely(JS_VALUE_GET_TAG(name) != JS_TAG_SYMBOL)) return JS_ThrowTypeErrorNotASymbol(ctx); prop = js_symbol_to_atom(ctx, name); p = JS_VALUE_GET_OBJ(obj); prs = find_own_property(&pr, p, prop); if (!prs) { JS_ThrowTypeErrorPrivateNotFound(ctx, prop); return JS_EXCEPTION; } return js_dup(pr->u.value); } static int JS_SetPrivateField(JSContext *ctx, JSValueConst obj, JSValueConst name, JSValue val) { JSObject *p; JSShapeProperty *prs; JSProperty *pr; JSAtom prop; if (unlikely(JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT)) { JS_ThrowTypeErrorNotAnObject(ctx); goto fail; } /* safety check */ if (unlikely(JS_VALUE_GET_TAG(name) != JS_TAG_SYMBOL)) { JS_ThrowTypeErrorNotASymbol(ctx); goto fail; } prop = js_symbol_to_atom(ctx, name); p = JS_VALUE_GET_OBJ(obj); prs = find_own_property(&pr, p, prop); if (!prs) { JS_ThrowTypeErrorPrivateNotFound(ctx, prop); fail: JS_FreeValue(ctx, val); return -1; } set_value(ctx, &pr->u.value, val); return 0; } /* add a private brand field to 'home_obj' if not already present and if obj is != null add a private brand to it */ static int JS_AddBrand(JSContext *ctx, JSValueConst obj, JSValueConst home_obj) { JSObject *p, *p1; JSShapeProperty *prs; JSProperty *pr; JSValue brand; JSAtom brand_atom; if (unlikely(JS_VALUE_GET_TAG(home_obj) != JS_TAG_OBJECT)) { JS_ThrowTypeErrorNotAnObject(ctx); return -1; } p = JS_VALUE_GET_OBJ(home_obj); prs = find_own_property(&pr, p, JS_ATOM_Private_brand); if (!prs) { /* if the brand is not present, add it */ brand = JS_NewSymbolFromAtom(ctx, JS_ATOM_brand, JS_ATOM_TYPE_PRIVATE); if (JS_IsException(brand)) return -1; pr = add_property(ctx, p, JS_ATOM_Private_brand, JS_PROP_C_W_E); if (!pr) { JS_FreeValue(ctx, brand); return -1; } pr->u.value = js_dup(brand); } else { brand = js_dup(pr->u.value); } brand_atom = js_symbol_to_atom(ctx, brand); if (JS_IsObject(obj)) { p1 = JS_VALUE_GET_OBJ(obj); prs = find_own_property(&pr, p1, brand_atom); if (unlikely(prs)) { JS_FreeAtom(ctx, brand_atom); JS_ThrowTypeError(ctx, "private method is already present"); return -1; } pr = add_property(ctx, p1, brand_atom, JS_PROP_C_W_E); JS_FreeAtom(ctx, brand_atom); if (!pr) return -1; pr->u.value = JS_UNDEFINED; } else { JS_FreeAtom(ctx, brand_atom); } return 0; } /* return a boolean telling if the brand of the home object of 'func' is present on 'obj' or -1 in case of exception */ static int JS_CheckBrand(JSContext *ctx, JSValue obj, JSValue func) { JSObject *p, *p1, *home_obj; JSShapeProperty *prs; JSProperty *pr; JSValue brand; /* get the home object of 'func' */ if (unlikely(JS_VALUE_GET_TAG(func) != JS_TAG_OBJECT)) goto not_obj; p1 = JS_VALUE_GET_OBJ(func); if (!js_class_has_bytecode(p1->class_id)) goto not_obj; home_obj = p1->u.func.home_object; if (!home_obj) goto not_obj; prs = find_own_property(&pr, home_obj, JS_ATOM_Private_brand); if (!prs) { JS_ThrowTypeError(ctx, "expecting private field"); return -1; } brand = pr->u.value; /* safety check */ if (unlikely(JS_VALUE_GET_TAG(brand) != JS_TAG_SYMBOL)) goto not_obj; /* get the brand array of 'obj' */ if (unlikely(JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT)) { not_obj: JS_ThrowTypeErrorNotAnObject(ctx); return -1; } p = JS_VALUE_GET_OBJ(obj); prs = find_own_property(&pr, p, js_symbol_to_atom(ctx, brand)); return (prs != NULL); } static uint32_t js_string_obj_get_length(JSContext *ctx, JSValueConst obj) { JSObject *p; JSString *p1; uint32_t len = 0; /* This is a class exotic method: obj class_id is JS_CLASS_STRING */ p = JS_VALUE_GET_OBJ(obj); if (JS_VALUE_GET_TAG(p->u.object_data) == JS_TAG_STRING) { p1 = JS_VALUE_GET_STRING(p->u.object_data); len = p1->len; } return len; } static int num_keys_cmp(const void *p1, const void *p2, void *opaque) { JSContext *ctx = opaque; JSAtom atom1 = ((const JSPropertyEnum *)p1)->atom; JSAtom atom2 = ((const JSPropertyEnum *)p2)->atom; uint32_t v1, v2; bool atom1_is_integer, atom2_is_integer; atom1_is_integer = JS_AtomIsArrayIndex(ctx, &v1, atom1); atom2_is_integer = JS_AtomIsArrayIndex(ctx, &v2, atom2); assert(atom1_is_integer && atom2_is_integer); if (v1 < v2) return -1; else if (v1 == v2) return 0; else return 1; } static void js_free_prop_enum(JSContext *ctx, JSPropertyEnum *tab, uint32_t len) { uint32_t i; if (tab) { for(i = 0; i < len; i++) JS_FreeAtom(ctx, tab[i].atom); js_free(ctx, tab); } } /* return < 0 in case if exception, 0 if OK. ptab and its atoms must be freed by the user. */ static int __exception JS_GetOwnPropertyNamesInternal(JSContext *ctx, JSPropertyEnum **ptab, uint32_t *plen, JSObject *p, int flags) { int i, j; JSShape *sh; JSShapeProperty *prs; JSPropertyEnum *tab_atom, *tab_exotic; JSAtom atom; uint32_t num_keys_count, str_keys_count, sym_keys_count, atom_count; uint32_t num_index, str_index, sym_index, exotic_count, exotic_keys_count; bool is_enumerable, num_sorted; uint32_t num_key; JSAtomKindEnum kind; /* clear pointer for consistency in case of failure */ *ptab = NULL; *plen = 0; /* compute the number of returned properties */ num_keys_count = 0; str_keys_count = 0; sym_keys_count = 0; exotic_keys_count = 0; exotic_count = 0; tab_exotic = NULL; sh = p->shape; for(i = 0, prs = get_shape_prop(sh); i < sh->prop_count; i++, prs++) { atom = prs->atom; if (atom != JS_ATOM_NULL) { is_enumerable = ((prs->flags & JS_PROP_ENUMERABLE) != 0); kind = JS_AtomGetKind(ctx, atom); if ((!(flags & JS_GPN_ENUM_ONLY) || is_enumerable) && ((flags >> kind) & 1) != 0) { /* need to raise an exception in case of the module name space (implicit GetOwnProperty) */ if (unlikely((prs->flags & JS_PROP_TMASK) == JS_PROP_VARREF) && (flags & (JS_GPN_SET_ENUM | JS_GPN_ENUM_ONLY))) { JSVarRef *var_ref = p->prop[i].u.var_ref; if (unlikely(JS_IsUninitialized(*var_ref->pvalue))) { JS_ThrowReferenceErrorUninitialized(ctx, prs->atom); return -1; } } if (JS_AtomIsArrayIndex(ctx, &num_key, atom)) { num_keys_count++; } else if (kind == JS_ATOM_KIND_STRING) { str_keys_count++; } else { sym_keys_count++; } } } } if (p->is_exotic) { if (p->fast_array) { if (flags & JS_GPN_STRING_MASK) { num_keys_count += p->u.array.count; } } else if (p->class_id == JS_CLASS_STRING) { if (flags & JS_GPN_STRING_MASK) { num_keys_count += js_string_obj_get_length(ctx, JS_MKPTR(JS_TAG_OBJECT, p)); } } else { const JSClassExoticMethods *em = ctx->rt->class_array[p->class_id].exotic; if (em && em->get_own_property_names) { if (em->get_own_property_names(ctx, &tab_exotic, &exotic_count, JS_MKPTR(JS_TAG_OBJECT, p))) return -1; for(i = 0; i < exotic_count; i++) { atom = tab_exotic[i].atom; kind = JS_AtomGetKind(ctx, atom); if (((flags >> kind) & 1) != 0) { is_enumerable = false; if (flags & (JS_GPN_SET_ENUM | JS_GPN_ENUM_ONLY)) { JSPropertyDescriptor desc; int res; /* set the "is_enumerable" field if necessary */ res = JS_GetOwnPropertyInternal(ctx, &desc, p, atom); if (res < 0) { js_free_prop_enum(ctx, tab_exotic, exotic_count); return -1; } if (res) { is_enumerable = ((desc.flags & JS_PROP_ENUMERABLE) != 0); js_free_desc(ctx, &desc); } tab_exotic[i].is_enumerable = is_enumerable; } if (!(flags & JS_GPN_ENUM_ONLY) || is_enumerable) { exotic_keys_count++; } } } } } } /* fill them */ atom_count = num_keys_count + str_keys_count + sym_keys_count + exotic_keys_count; /* avoid allocating 0 bytes */ tab_atom = js_malloc(ctx, sizeof(tab_atom[0]) * max_int(atom_count, 1)); if (!tab_atom) { js_free_prop_enum(ctx, tab_exotic, exotic_count); return -1; } num_index = 0; str_index = num_keys_count; sym_index = str_index + str_keys_count; num_sorted = true; sh = p->shape; for(i = 0, prs = get_shape_prop(sh); i < sh->prop_count; i++, prs++) { atom = prs->atom; if (atom != JS_ATOM_NULL) { is_enumerable = ((prs->flags & JS_PROP_ENUMERABLE) != 0); kind = JS_AtomGetKind(ctx, atom); if ((!(flags & JS_GPN_ENUM_ONLY) || is_enumerable) && ((flags >> kind) & 1) != 0) { if (JS_AtomIsArrayIndex(ctx, &num_key, atom)) { j = num_index++; num_sorted = false; } else if (kind == JS_ATOM_KIND_STRING) { j = str_index++; } else { j = sym_index++; } tab_atom[j].atom = JS_DupAtom(ctx, atom); tab_atom[j].is_enumerable = is_enumerable; } } } if (p->is_exotic) { int len; if (p->fast_array) { if (flags & JS_GPN_STRING_MASK) { len = p->u.array.count; goto add_array_keys; } } else if (p->class_id == JS_CLASS_STRING) { if (flags & JS_GPN_STRING_MASK) { len = js_string_obj_get_length(ctx, JS_MKPTR(JS_TAG_OBJECT, p)); add_array_keys: for(i = 0; i < len; i++) { tab_atom[num_index].atom = __JS_AtomFromUInt32(i); if (tab_atom[num_index].atom == JS_ATOM_NULL) { js_free_prop_enum(ctx, tab_atom, num_index); return -1; } tab_atom[num_index].is_enumerable = true; num_index++; } } } else { /* Note: exotic keys are not reordered and comes after the object own properties. */ for(i = 0; i < exotic_count; i++) { atom = tab_exotic[i].atom; is_enumerable = tab_exotic[i].is_enumerable; kind = JS_AtomGetKind(ctx, atom); if ((!(flags & JS_GPN_ENUM_ONLY) || is_enumerable) && ((flags >> kind) & 1) != 0) { tab_atom[sym_index].atom = atom; tab_atom[sym_index].is_enumerable = is_enumerable; sym_index++; } else { JS_FreeAtom(ctx, atom); } } js_free(ctx, tab_exotic); } } assert(num_index == num_keys_count); assert(str_index == num_keys_count + str_keys_count); assert(sym_index == atom_count); if (num_keys_count != 0 && !num_sorted) { rqsort(tab_atom, num_keys_count, sizeof(tab_atom[0]), num_keys_cmp, ctx); } *ptab = tab_atom; *plen = atom_count; return 0; } int JS_GetOwnPropertyNames(JSContext *ctx, JSPropertyEnum **ptab, uint32_t *plen, JSValueConst obj, int flags) { if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT) { JS_ThrowTypeErrorNotAnObject(ctx); return -1; } return JS_GetOwnPropertyNamesInternal(ctx, ptab, plen, JS_VALUE_GET_OBJ(obj), flags); } /* Return -1 if exception, false if the property does not exist, true if it exists. If true is returned, the property descriptor 'desc' is filled present. */ static int JS_GetOwnPropertyInternal(JSContext *ctx, JSPropertyDescriptor *desc, JSObject *p, JSAtom prop) { JSShapeProperty *prs; JSProperty *pr; retry: prs = find_own_property(&pr, p, prop); if (prs) { if (desc) { desc->flags = prs->flags & JS_PROP_C_W_E; desc->getter = JS_UNDEFINED; desc->setter = JS_UNDEFINED; desc->value = JS_UNDEFINED; if (unlikely(prs->flags & JS_PROP_TMASK)) { if ((prs->flags & JS_PROP_TMASK) == JS_PROP_GETSET) { desc->flags |= JS_PROP_GETSET; if (pr->u.getset.getter) desc->getter = js_dup(JS_MKPTR(JS_TAG_OBJECT, pr->u.getset.getter)); if (pr->u.getset.setter) desc->setter = js_dup(JS_MKPTR(JS_TAG_OBJECT, pr->u.getset.setter)); } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_VARREF) { JSValue val = *pr->u.var_ref->pvalue; if (unlikely(JS_IsUninitialized(val))) { JS_ThrowReferenceErrorUninitialized(ctx, prs->atom); return -1; } desc->value = js_dup(val); } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_AUTOINIT) { /* Instantiate property and retry */ if (JS_AutoInitProperty(ctx, p, prop, pr, prs)) return -1; goto retry; } } else { desc->value = js_dup(pr->u.value); } } else { /* for consistency, send the exception even if desc is NULL */ if (unlikely((prs->flags & JS_PROP_TMASK) == JS_PROP_VARREF)) { if (unlikely(JS_IsUninitialized(*pr->u.var_ref->pvalue))) { JS_ThrowReferenceErrorUninitialized(ctx, prs->atom); return -1; } } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_AUTOINIT) { /* nothing to do: delay instantiation until actual value and/or attributes are read */ } } return true; } if (p->is_exotic) { if (p->fast_array) { /* specific case for fast arrays */ if (__JS_AtomIsTaggedInt(prop)) { uint32_t idx; idx = __JS_AtomToUInt32(prop); if (idx < p->u.array.count) { if (desc) { desc->flags = JS_PROP_WRITABLE | JS_PROP_ENUMERABLE | JS_PROP_CONFIGURABLE; desc->getter = JS_UNDEFINED; desc->setter = JS_UNDEFINED; desc->value = JS_GetPropertyUint32(ctx, JS_MKPTR(JS_TAG_OBJECT, p), idx); } return true; } } } else { const JSClassExoticMethods *em = ctx->rt->class_array[p->class_id].exotic; if (em && em->get_own_property) { return em->get_own_property(ctx, desc, JS_MKPTR(JS_TAG_OBJECT, p), prop); } } } return false; } int JS_GetOwnProperty(JSContext *ctx, JSPropertyDescriptor *desc, JSValueConst obj, JSAtom prop) { if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT) { JS_ThrowTypeErrorNotAnObject(ctx); return -1; } return JS_GetOwnPropertyInternal(ctx, desc, JS_VALUE_GET_OBJ(obj), prop); } void JS_FreePropertyEnum(JSContext *ctx, JSPropertyEnum *tab, uint32_t len) { js_free_prop_enum(ctx, tab, len); } /* return -1 if exception (Proxy object only) or true/false */ int JS_IsExtensible(JSContext *ctx, JSValueConst obj) { JSObject *p; if (unlikely(JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT)) return false; p = JS_VALUE_GET_OBJ(obj); if (unlikely(p->class_id == JS_CLASS_PROXY)) return js_proxy_isExtensible(ctx, obj); else return p->extensible; } /* return -1 if exception (Proxy object only) or true/false */ int JS_PreventExtensions(JSContext *ctx, JSValueConst obj) { JSObject *p; if (unlikely(JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT)) return false; p = JS_VALUE_GET_OBJ(obj); if (unlikely(p->class_id == JS_CLASS_PROXY)) return js_proxy_preventExtensions(ctx, obj); p->extensible = false; return true; } /* return -1 if exception otherwise true or false */ int JS_HasProperty(JSContext *ctx, JSValueConst obj, JSAtom prop) { JSObject *p; int ret; JSValue obj1; if (unlikely(JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT)) return false; p = JS_VALUE_GET_OBJ(obj); for(;;) { if (p->is_exotic) { const JSClassExoticMethods *em = ctx->rt->class_array[p->class_id].exotic; if (em && em->has_property) { /* has_property can free the prototype */ obj1 = js_dup(JS_MKPTR(JS_TAG_OBJECT, p)); ret = em->has_property(ctx, obj1, prop); JS_FreeValue(ctx, obj1); return ret; } } /* JS_GetOwnPropertyInternal can free the prototype */ js_dup(JS_MKPTR(JS_TAG_OBJECT, p)); ret = JS_GetOwnPropertyInternal(ctx, NULL, p, prop); JS_FreeValue(ctx, JS_MKPTR(JS_TAG_OBJECT, p)); if (ret != 0) return ret; if (is_typed_array(p->class_id)) { ret = JS_AtomIsNumericIndex(ctx, prop); if (ret != 0) { if (ret < 0) return -1; return false; } } p = p->shape->proto; if (!p) break; } return false; } /* val must be a symbol */ static JSAtom js_symbol_to_atom(JSContext *ctx, JSValueConst val) { JSAtomStruct *p = JS_VALUE_GET_PTR(val); return js_get_atom_index(ctx->rt, p); } /* return JS_ATOM_NULL in case of exception */ static JSAtom JS_ValueToAtomInternal(JSContext *ctx, JSValueConst val, int flags) { JSAtom atom; uint32_t tag; tag = JS_VALUE_GET_TAG(val); if (tag == JS_TAG_INT && (uint32_t)JS_VALUE_GET_INT(val) <= JS_ATOM_MAX_INT) { /* fast path for integer values */ atom = __JS_AtomFromUInt32(JS_VALUE_GET_INT(val)); } else if (tag == JS_TAG_SYMBOL) { JSAtomStruct *p = JS_VALUE_GET_PTR(val); atom = JS_DupAtom(ctx, js_get_atom_index(ctx->rt, p)); } else { JSValue str; str = JS_ToPropertyKeyInternal(ctx, val, flags); if (JS_IsException(str)) return JS_ATOM_NULL; if (JS_VALUE_GET_TAG(str) == JS_TAG_SYMBOL) { atom = js_symbol_to_atom(ctx, str); } else { atom = JS_NewAtomStr(ctx, JS_VALUE_GET_STRING(str)); } } return atom; } JSAtom JS_ValueToAtom(JSContext *ctx, JSValueConst val) { return JS_ValueToAtomInternal(ctx, val, /*flags*/0); } static bool js_get_fast_array_element(JSContext *ctx, JSObject *p, uint32_t idx, JSValue *pval) { switch(p->class_id) { case JS_CLASS_ARRAY: case JS_CLASS_ARGUMENTS: if (unlikely(idx >= p->u.array.count)) return false; *pval = js_dup(p->u.array.u.values[idx]); return true; case JS_CLASS_INT8_ARRAY: if (unlikely(idx >= p->u.array.count)) return false; *pval = js_int32(p->u.array.u.int8_ptr[idx]); return true; case JS_CLASS_UINT8C_ARRAY: case JS_CLASS_UINT8_ARRAY: if (unlikely(idx >= p->u.array.count)) return false; *pval = js_int32(p->u.array.u.uint8_ptr[idx]); return true; case JS_CLASS_INT16_ARRAY: if (unlikely(idx >= p->u.array.count)) return false; *pval = js_int32(p->u.array.u.int16_ptr[idx]); return true; case JS_CLASS_UINT16_ARRAY: if (unlikely(idx >= p->u.array.count)) return false; *pval = js_int32(p->u.array.u.uint16_ptr[idx]); return true; case JS_CLASS_INT32_ARRAY: if (unlikely(idx >= p->u.array.count)) return false; *pval = js_int32(p->u.array.u.int32_ptr[idx]); return true; case JS_CLASS_UINT32_ARRAY: if (unlikely(idx >= p->u.array.count)) return false; *pval = js_uint32(p->u.array.u.uint32_ptr[idx]); return true; case JS_CLASS_BIG_INT64_ARRAY: if (unlikely(idx >= p->u.array.count)) return false; *pval = JS_NewBigInt64(ctx, p->u.array.u.int64_ptr[idx]); return true; case JS_CLASS_BIG_UINT64_ARRAY: if (unlikely(idx >= p->u.array.count)) return false; *pval = JS_NewBigUint64(ctx, p->u.array.u.uint64_ptr[idx]); return true; case JS_CLASS_FLOAT16_ARRAY: if (unlikely(idx >= p->u.array.count)) return false; *pval = js_float64(fromfp16(p->u.array.u.fp16_ptr[idx])); return true; case JS_CLASS_FLOAT32_ARRAY: if (unlikely(idx >= p->u.array.count)) return false; *pval = js_float64(p->u.array.u.float_ptr[idx]); return true; case JS_CLASS_FLOAT64_ARRAY: if (unlikely(idx >= p->u.array.count)) return false; *pval = js_float64(p->u.array.u.double_ptr[idx]); return true; default: return false; } } static JSValue JS_GetPropertyValue(JSContext *ctx, JSValueConst this_obj, JSValue prop) { JSAtom atom; JSValue ret; uint32_t tag; tag = JS_VALUE_GET_TAG(this_obj); if (likely(tag == JS_TAG_OBJECT)) { if (JS_VALUE_GET_TAG(prop) == JS_TAG_INT) { JSObject *p = JS_VALUE_GET_OBJ(this_obj); uint32_t idx = JS_VALUE_GET_INT(prop); JSValue val; /* fast path for array and typed array access */ if (js_get_fast_array_element(ctx, p, idx, &val)) return val; } } else if (unlikely(tag == JS_TAG_NULL || tag == JS_TAG_UNDEFINED)) { // per spec: not allowed to call ToPropertyKey before ToObject // so we must ensure to not invoke JS anything that's observable // from JS code atom = JS_ValueToAtomInternal(ctx, prop, JS_TO_STRING_NO_SIDE_EFFECTS); JS_FreeValue(ctx, prop); if (unlikely(atom == JS_ATOM_NULL)) return JS_EXCEPTION; if (tag == JS_TAG_NULL) { JS_ThrowTypeErrorAtom(ctx, "cannot read property '%s' of null", atom); } else { JS_ThrowTypeErrorAtom(ctx, "cannot read property '%s' of undefined", atom); } JS_FreeAtom(ctx, atom); return JS_EXCEPTION; } atom = JS_ValueToAtom(ctx, prop); JS_FreeValue(ctx, prop); if (unlikely(atom == JS_ATOM_NULL)) return JS_EXCEPTION; ret = JS_GetProperty(ctx, this_obj, atom); JS_FreeAtom(ctx, atom); return ret; } JSValue JS_GetPropertyUint32(JSContext *ctx, JSValueConst this_obj, uint32_t idx) { return JS_GetPropertyInt64(ctx, this_obj, idx); } /* Check if an object has a generalized numeric property. Return value: -1 for exception, *pval set to JS_EXCEPTION true if property exists, stored into *pval, false if property does not exist. *pval set to JS_UNDEFINED. */ static int JS_TryGetPropertyInt64(JSContext *ctx, JSValueConst obj, int64_t idx, JSValue *pval) { JSValue val; JSAtom prop; int present; if (likely(JS_VALUE_GET_TAG(obj) == JS_TAG_OBJECT && (uint64_t)idx <= INT32_MAX)) { /* fast path for array and typed array access */ JSObject *p = JS_VALUE_GET_OBJ(obj); if (js_get_fast_array_element(ctx, p, idx, pval)) return true; } val = JS_EXCEPTION; present = -1; prop = JS_NewAtomInt64(ctx, idx); if (likely(prop != JS_ATOM_NULL)) { present = JS_HasProperty(ctx, obj, prop); if (present > 0) { val = JS_GetProperty(ctx, obj, prop); if (unlikely(JS_IsException(val))) present = -1; } else if (present == false) { val = JS_UNDEFINED; } JS_FreeAtom(ctx, prop); } *pval = val; return present; } JSValue JS_GetPropertyInt64(JSContext *ctx, JSValueConst obj, int64_t idx) { JSAtom prop; JSValue val; if (likely(JS_VALUE_GET_TAG(obj) == JS_TAG_OBJECT && (uint64_t)idx <= INT32_MAX)) { /* fast path for array and typed array access */ JSObject *p = JS_VALUE_GET_OBJ(obj); if (js_get_fast_array_element(ctx, p, idx, &val)) return val; } prop = JS_NewAtomInt64(ctx, idx); if (prop == JS_ATOM_NULL) return JS_EXCEPTION; val = JS_GetProperty(ctx, obj, prop); JS_FreeAtom(ctx, prop); return val; } /* `prop` may be pure ASCII or UTF-8 encoded */ JSValue JS_GetPropertyStr(JSContext *ctx, JSValueConst this_obj, const char *prop) { JSAtom atom; JSValue ret; atom = JS_NewAtom(ctx, prop); if (atom == JS_ATOM_NULL) return JS_EXCEPTION; ret = JS_GetProperty(ctx, this_obj, atom); JS_FreeAtom(ctx, atom); return ret; } /* Note: the property value is not initialized. Return NULL if memory error. */ static JSProperty *add_property(JSContext *ctx, JSObject *p, JSAtom prop, int prop_flags) { JSShape *sh, *new_sh; sh = p->shape; if (sh->is_hashed) { /* try to find an existing shape */ new_sh = find_hashed_shape_prop(ctx->rt, sh, prop, prop_flags); if (new_sh) { /* matching shape found: use it */ /* the property array may need to be resized */ if (new_sh->prop_size != sh->prop_size) { JSProperty *new_prop; new_prop = js_realloc(ctx, p->prop, sizeof(p->prop[0]) * new_sh->prop_size); if (!new_prop) return NULL; p->prop = new_prop; } p->shape = js_dup_shape(new_sh); js_free_shape(ctx->rt, sh); return &p->prop[new_sh->prop_count - 1]; } else if (sh->header.ref_count != 1) { /* if the shape is shared, clone it */ new_sh = js_clone_shape(ctx, sh); if (!new_sh) return NULL; /* hash the cloned shape */ new_sh->is_hashed = true; js_shape_hash_link(ctx->rt, new_sh); js_free_shape(ctx->rt, p->shape); p->shape = new_sh; } } assert(p->shape->header.ref_count == 1); if (add_shape_property(ctx, &p->shape, p, prop, prop_flags)) return NULL; return &p->prop[p->shape->prop_count - 1]; } /* can be called on Array or Arguments objects. return < 0 if memory alloc error. */ static no_inline __exception int convert_fast_array_to_array(JSContext *ctx, JSObject *p) { JSProperty *pr; JSShape *sh; JSValue *tab; uint32_t i, len, new_count; if (js_shape_prepare_update(ctx, p, NULL)) return -1; len = p->u.array.count; /* resize the properties once to simplify the error handling */ sh = p->shape; new_count = sh->prop_count + len; if (new_count > sh->prop_size) { if (resize_properties(ctx, &p->shape, p, new_count)) return -1; } tab = p->u.array.u.values; for(i = 0; i < len; i++) { /* add_property cannot fail here but __JS_AtomFromUInt32(i) fails for i > INT32_MAX */ pr = add_property(ctx, p, __JS_AtomFromUInt32(i), JS_PROP_C_W_E); pr->u.value = *tab++; } js_free(ctx, p->u.array.u.values); p->u.array.count = 0; p->u.array.u.values = NULL; /* fail safe */ p->u.array.u1.size = 0; p->fast_array = 0; return 0; } static int delete_property(JSContext *ctx, JSObject *p, JSAtom atom) { JSShape *sh; JSShapeProperty *pr, *lpr, *prop; JSProperty *pr1; uint32_t lpr_idx; intptr_t h, h1; redo: sh = p->shape; h1 = atom & sh->prop_hash_mask; h = prop_hash_end(sh)[-h1 - 1]; prop = get_shape_prop(sh); lpr = NULL; lpr_idx = 0; /* prevent warning */ while (h != 0) { pr = &prop[h - 1]; if (likely(pr->atom == atom)) { /* found ! */ if (!(pr->flags & JS_PROP_CONFIGURABLE)) return false; /* realloc the shape if needed */ if (lpr) lpr_idx = lpr - get_shape_prop(sh); if (js_shape_prepare_update(ctx, p, &pr)) return -1; sh = p->shape; /* remove property */ if (lpr) { lpr = get_shape_prop(sh) + lpr_idx; lpr->hash_next = pr->hash_next; } else { prop_hash_end(sh)[-h1 - 1] = pr->hash_next; } sh->deleted_prop_count++; /* free the entry */ pr1 = &p->prop[h - 1]; free_property(ctx->rt, pr1, pr->flags); JS_FreeAtom(ctx, pr->atom); /* put default values */ pr->flags = 0; pr->atom = JS_ATOM_NULL; pr1->u.value = JS_UNDEFINED; /* compact the properties if too many deleted properties */ if (sh->deleted_prop_count >= 8 && sh->deleted_prop_count >= ((unsigned)sh->prop_count / 2)) { compact_properties(ctx, p); } return true; } lpr = pr; h = pr->hash_next; } if (p->is_exotic) { if (p->fast_array) { uint32_t idx; if (JS_AtomIsArrayIndex(ctx, &idx, atom) && idx < p->u.array.count) { if (p->class_id == JS_CLASS_ARRAY || p->class_id == JS_CLASS_ARGUMENTS) { /* Special case deleting the last element of a fast Array */ if (idx == p->u.array.count - 1) { JS_FreeValue(ctx, p->u.array.u.values[idx]); p->u.array.count = idx; return true; } if (convert_fast_array_to_array(ctx, p)) return -1; goto redo; } else { return false; } } } else { const JSClassExoticMethods *em = ctx->rt->class_array[p->class_id].exotic; if (em && em->delete_property) { return em->delete_property(ctx, JS_MKPTR(JS_TAG_OBJECT, p), atom); } } } /* not found */ return true; } static int call_setter(JSContext *ctx, JSObject *setter, JSValueConst this_obj, JSValue val, int flags) { JSValue ret, func; if (likely(setter)) { func = JS_MKPTR(JS_TAG_OBJECT, setter); /* Note: the field could be removed in the setter */ func = js_dup(func); ret = JS_CallFree(ctx, func, this_obj, 1, vc(&val)); JS_FreeValue(ctx, val); if (JS_IsException(ret)) return -1; JS_FreeValue(ctx, ret); return true; } else { JS_FreeValue(ctx, val); if ((flags & JS_PROP_THROW) || ((flags & JS_PROP_THROW_STRICT) && is_strict_mode(ctx))) { JS_ThrowTypeError(ctx, "no setter for property"); return -1; } return false; } } /* set the array length and remove the array elements if necessary. */ static int set_array_length(JSContext *ctx, JSObject *p, JSValue val, int flags) { uint32_t len, idx, cur_len; int i, ret; /* Note: this call can reallocate the properties of 'p' */ ret = JS_ToArrayLengthFree(ctx, &len, val, false); if (ret) return -1; /* JS_ToArrayLengthFree() must be done before the read-only test */ if (unlikely(!(p->shape->prop[0].flags & JS_PROP_WRITABLE))) return JS_ThrowTypeErrorReadOnly(ctx, flags, JS_ATOM_length); if (likely(p->fast_array)) { uint32_t old_len = p->u.array.count; if (len < old_len) { for(i = len; i < old_len; i++) { JS_FreeValue(ctx, p->u.array.u.values[i]); } p->u.array.count = len; } p->prop[0].u.value = js_uint32(len); } else { /* Note: length is always a uint32 because the object is an array */ JS_ToUint32(ctx, &cur_len, p->prop[0].u.value); if (len < cur_len) { uint32_t d; JSShape *sh; JSShapeProperty *pr; d = cur_len - len; sh = p->shape; if (d <= sh->prop_count) { JSAtom atom; /* faster to iterate */ while (cur_len > len) { atom = JS_NewAtomUInt32(ctx, cur_len - 1); ret = delete_property(ctx, p, atom); JS_FreeAtom(ctx, atom); if (unlikely(!ret)) { /* unlikely case: property is not configurable */ break; } cur_len--; } } else { /* faster to iterate thru all the properties. Need two passes in case one of the property is not configurable */ cur_len = len; for(i = 0, pr = get_shape_prop(sh); i < sh->prop_count; i++, pr++) { if (pr->atom != JS_ATOM_NULL && JS_AtomIsArrayIndex(ctx, &idx, pr->atom)) { if (idx >= cur_len && !(pr->flags & JS_PROP_CONFIGURABLE)) { cur_len = idx + 1; } } } for(i = 0, pr = get_shape_prop(sh); i < sh->prop_count; i++, pr++) { if (pr->atom != JS_ATOM_NULL && JS_AtomIsArrayIndex(ctx, &idx, pr->atom)) { if (idx >= cur_len) { /* remove the property */ delete_property(ctx, p, pr->atom); /* WARNING: the shape may have been modified */ sh = p->shape; pr = get_shape_prop(sh) + i; } } } } } else { cur_len = len; } set_value(ctx, &p->prop[0].u.value, js_uint32(cur_len)); if (unlikely(cur_len > len)) { return JS_ThrowTypeErrorOrFalse(ctx, flags, "not configurable"); } } return true; } /* return -1 if exception */ static int expand_fast_array(JSContext *ctx, JSObject *p, uint32_t new_len) { uint32_t new_size; size_t slack; JSValue *new_array_prop; /* XXX: potential arithmetic overflow */ new_size = max_int(new_len, p->u.array.u1.size * 3 / 2); new_array_prop = js_realloc2(ctx, p->u.array.u.values, sizeof(JSValue) * new_size, &slack); if (!new_array_prop) return -1; new_size += slack / sizeof(*new_array_prop); p->u.array.u.values = new_array_prop; p->u.array.u1.size = new_size; return 0; } /* Preconditions: 'p' must be of class JS_CLASS_ARRAY, p->fast_array = true and p->extensible = true */ static int add_fast_array_element(JSContext *ctx, JSObject *p, JSValue val, int flags) { uint32_t new_len, array_len; /* extend the array by one */ /* XXX: convert to slow array if new_len > 2^31-1 elements */ new_len = p->u.array.count + 1; /* update the length if necessary. We assume that if the length is not an integer, then if it >= 2^31. */ if (likely(JS_VALUE_GET_TAG(p->prop[0].u.value) == JS_TAG_INT)) { array_len = JS_VALUE_GET_INT(p->prop[0].u.value); if (new_len > array_len) { if (unlikely(!(get_shape_prop(p->shape)->flags & JS_PROP_WRITABLE))) { JS_FreeValue(ctx, val); return JS_ThrowTypeErrorReadOnly(ctx, flags, JS_ATOM_length); } p->prop[0].u.value = js_int32(new_len); } } if (unlikely(new_len > p->u.array.u1.size)) { if (expand_fast_array(ctx, p, new_len)) { JS_FreeValue(ctx, val); return -1; } } p->u.array.u.values[new_len - 1] = val; p->u.array.count = new_len; return true; } static void js_free_desc(JSContext *ctx, JSPropertyDescriptor *desc) { JS_FreeValue(ctx, desc->getter); JS_FreeValue(ctx, desc->setter); JS_FreeValue(ctx, desc->value); } /* return -1 in case of exception or true or false. Warning: 'val' is freed by the function. 'flags' is a bitmask of JS_PROP_NO_ADD, JS_PROP_THROW or JS_PROP_THROW_STRICT. If JS_PROP_NO_ADD is set, the new property is not added and an error is raised. 'obj' must be an object when obj != this_obj. */ static int JS_SetPropertyInternal2(JSContext *ctx, JSValueConst obj, JSAtom prop, JSValue val, JSValueConst this_obj, int flags) { JSObject *p, *p1; JSShapeProperty *prs; JSProperty *pr; JSPropertyDescriptor desc; int ret; switch(JS_VALUE_GET_TAG(this_obj)) { case JS_TAG_NULL: JS_ThrowTypeErrorAtom(ctx, "cannot set property '%s' of null", prop); goto fail; case JS_TAG_UNDEFINED: JS_ThrowTypeErrorAtom(ctx, "cannot set property '%s' of undefined", prop); goto fail; case JS_TAG_OBJECT: p = JS_VALUE_GET_OBJ(this_obj); p1 = JS_VALUE_GET_OBJ(obj); if (p == p1) break; goto retry2; default: if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT) obj = JS_GetPrototypePrimitive(ctx, obj); p = NULL; p1 = JS_VALUE_GET_OBJ(obj); goto prototype_lookup; } retry: prs = find_own_property(&pr, p1, prop); if (prs) { if (likely((prs->flags & (JS_PROP_TMASK | JS_PROP_WRITABLE | JS_PROP_LENGTH)) == JS_PROP_WRITABLE)) { /* fast case */ set_value(ctx, &pr->u.value, val); return true; } else if (prs->flags & JS_PROP_LENGTH) { assert(p->class_id == JS_CLASS_ARRAY); assert(prop == JS_ATOM_length); return set_array_length(ctx, p, val, flags); } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_GETSET) { return call_setter(ctx, pr->u.getset.setter, this_obj, val, flags); } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_VARREF) { /* JS_PROP_WRITABLE is always true for variable references, but they are write protected in module name spaces. */ if (p->class_id == JS_CLASS_MODULE_NS) goto read_only_prop; set_value(ctx, pr->u.var_ref->pvalue, val); return true; } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_AUTOINIT) { /* Instantiate property and retry (potentially useless) */ if (JS_AutoInitProperty(ctx, p, prop, pr, prs)) goto fail; goto retry; } else { goto read_only_prop; } } for(;;) { if (p1->is_exotic) { if (p1->fast_array) { if (__JS_AtomIsTaggedInt(prop)) { uint32_t idx = __JS_AtomToUInt32(prop); if (idx < p1->u.array.count) { if (unlikely(p == p1)) return JS_SetPropertyValue(ctx, this_obj, js_int32(idx), val, flags); else break; } else if (is_typed_array(p1->class_id)) { goto typed_array_oob; } } else if (is_typed_array(p1->class_id)) { ret = JS_AtomIsNumericIndex(ctx, prop); if (ret != 0) { if (ret < 0) goto fail; typed_array_oob: // per spec: evaluate value for side effects if (p1->class_id == JS_CLASS_BIG_INT64_ARRAY || p1->class_id == JS_CLASS_BIG_UINT64_ARRAY) { int64_t v; if (JS_ToBigInt64Free(ctx, &v, val)) return -1; } else { val = JS_ToNumberFree(ctx, val); JS_FreeValue(ctx, val); if (JS_IsException(val)) return -1; } return true; } } } else { const JSClassExoticMethods *em = ctx->rt->class_array[p1->class_id].exotic; if (em) { JSValue obj1; if (em->set_property) { /* set_property can free the prototype */ obj1 = js_dup(JS_MKPTR(JS_TAG_OBJECT, p1)); ret = em->set_property(ctx, obj1, prop, val, this_obj, flags); JS_FreeValue(ctx, obj1); JS_FreeValue(ctx, val); return ret; } if (em->get_own_property) { /* get_own_property can free the prototype */ obj1 = js_dup(JS_MKPTR(JS_TAG_OBJECT, p1)); ret = em->get_own_property(ctx, &desc, obj1, prop); JS_FreeValue(ctx, obj1); if (ret < 0) goto fail; if (ret) { if (desc.flags & JS_PROP_GETSET) { JSObject *setter; if (JS_IsUndefined(desc.setter)) setter = NULL; else setter = JS_VALUE_GET_OBJ(desc.setter); ret = call_setter(ctx, setter, this_obj, val, flags); JS_FreeValue(ctx, desc.getter); JS_FreeValue(ctx, desc.setter); return ret; } else { JS_FreeValue(ctx, desc.value); if (!(desc.flags & JS_PROP_WRITABLE)) goto read_only_prop; if (likely(p == p1)) { ret = JS_DefineProperty(ctx, this_obj, prop, val, JS_UNDEFINED, JS_UNDEFINED, JS_PROP_HAS_VALUE); JS_FreeValue(ctx, val); return ret; } else { break; } } } } } } } p1 = p1->shape->proto; prototype_lookup: if (!p1) break; retry2: prs = find_own_property(&pr, p1, prop); if (prs) { if ((prs->flags & JS_PROP_TMASK) == JS_PROP_GETSET) { return call_setter(ctx, pr->u.getset.setter, this_obj, val, flags); } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_AUTOINIT) { /* Instantiate property and retry (potentially useless) */ if (JS_AutoInitProperty(ctx, p1, prop, pr, prs)) return -1; goto retry2; } else if (!(prs->flags & JS_PROP_WRITABLE)) { goto read_only_prop; } else { break; } } } if (unlikely(flags & JS_PROP_NO_ADD)) { JS_ThrowReferenceErrorNotDefined(ctx, prop); goto fail; } if (unlikely(!p)) { ret = JS_ThrowTypeErrorOrFalse(ctx, flags, "not an object"); goto done; } if (unlikely(!p->extensible)) { ret = JS_ThrowTypeErrorOrFalse(ctx, flags, "object is not extensible"); goto done; } if (p == JS_VALUE_GET_OBJ(obj)) { if (p->is_exotic) { if (p->class_id == JS_CLASS_ARRAY && p->fast_array && __JS_AtomIsTaggedInt(prop)) { uint32_t idx = __JS_AtomToUInt32(prop); if (idx == p->u.array.count) { /* fast case */ return add_fast_array_element(ctx, p, val, flags); } } goto generic_create_prop; } else { pr = add_property(ctx, p, prop, JS_PROP_C_W_E); if (!pr) goto fail; pr->u.value = val; return true; } } // TODO(bnoordhuis) return JSProperty slot and update in place // when plain property (not is_exotic/setter/etc.) to avoid // calling find_own_property() thrice? ret = JS_GetOwnPropertyInternal(ctx, &desc, p, prop); if (ret < 0) goto fail; if (ret) { JS_FreeValue(ctx, desc.value); if (desc.flags & JS_PROP_GETSET) { JS_FreeValue(ctx, desc.getter); JS_FreeValue(ctx, desc.setter); ret = JS_ThrowTypeErrorOrFalse(ctx, flags, "setter is forbidden"); goto done; } else if (!(desc.flags & JS_PROP_WRITABLE) || p->class_id == JS_CLASS_MODULE_NS) { read_only_prop: ret = JS_ThrowTypeErrorReadOnly(ctx, flags, prop); goto done; } ret = JS_DefineProperty(ctx, this_obj, prop, val, JS_UNDEFINED, JS_UNDEFINED, JS_PROP_HAS_VALUE); } else { generic_create_prop: ret = JS_CreateProperty(ctx, p, prop, val, JS_UNDEFINED, JS_UNDEFINED, flags | JS_PROP_HAS_VALUE | JS_PROP_HAS_ENUMERABLE | JS_PROP_HAS_WRITABLE | JS_PROP_HAS_CONFIGURABLE | JS_PROP_C_W_E); } done: JS_FreeValue(ctx, val); return ret; fail: JS_FreeValue(ctx, val); return -1; } static int JS_SetPropertyInternal(JSContext *ctx, JSValueConst obj, JSAtom prop, JSValue val, int flags) { return JS_SetPropertyInternal2(ctx, obj, prop, val, obj, flags); } int JS_SetProperty(JSContext *ctx, JSValueConst this_obj, JSAtom prop, JSValue val) { return JS_SetPropertyInternal(ctx, this_obj, prop, val, JS_PROP_THROW); } /* flags can be JS_PROP_THROW or JS_PROP_THROW_STRICT */ static int JS_SetPropertyValue(JSContext *ctx, JSValueConst this_obj, JSValue prop, JSValue val, int flags) { if (likely(JS_VALUE_GET_TAG(this_obj) == JS_TAG_OBJECT && JS_VALUE_GET_TAG(prop) == JS_TAG_INT)) { JSObject *p; uint32_t idx; double d; int32_t v; /* fast path for array access */ p = JS_VALUE_GET_OBJ(this_obj); idx = JS_VALUE_GET_INT(prop); switch(p->class_id) { case JS_CLASS_ARRAY: if (unlikely(idx >= (uint32_t)p->u.array.count)) { JSObject *p1; JSShape *sh1; /* fast path to add an element to the array */ if (idx != (uint32_t)p->u.array.count || !p->fast_array || !p->extensible) goto slow_path; /* check if prototype chain has a numeric property */ p1 = p->shape->proto; while (p1 != NULL) { sh1 = p1->shape; if (p1->class_id == JS_CLASS_ARRAY) { if (unlikely(!p1->fast_array)) goto slow_path; } else if (p1->class_id == JS_CLASS_OBJECT) { if (unlikely(sh1->has_small_array_index)) goto slow_path; } else { goto slow_path; } p1 = sh1->proto; } /* add element */ return add_fast_array_element(ctx, p, val, flags); } set_value(ctx, &p->u.array.u.values[idx], val); break; case JS_CLASS_ARGUMENTS: if (unlikely(idx >= (uint32_t)p->u.array.count)) goto slow_path; set_value(ctx, &p->u.array.u.values[idx], val); break; case JS_CLASS_UINT8C_ARRAY: if (JS_ToUint8ClampFree(ctx, &v, val)) goto ta_cvt_fail; /* Note: the conversion can detach the typed array, so the array bound check must be done after */ if (unlikely(idx >= (uint32_t)p->u.array.count)) goto ta_out_of_bound; p->u.array.u.uint8_ptr[idx] = v; break; case JS_CLASS_INT8_ARRAY: case JS_CLASS_UINT8_ARRAY: if (JS_ToInt32Free(ctx, &v, val)) goto ta_cvt_fail; if (unlikely(idx >= (uint32_t)p->u.array.count)) goto ta_out_of_bound; p->u.array.u.uint8_ptr[idx] = v; break; case JS_CLASS_INT16_ARRAY: case JS_CLASS_UINT16_ARRAY: if (JS_ToInt32Free(ctx, &v, val)) goto ta_cvt_fail; if (unlikely(idx >= (uint32_t)p->u.array.count)) goto ta_out_of_bound; p->u.array.u.uint16_ptr[idx] = v; break; case JS_CLASS_INT32_ARRAY: case JS_CLASS_UINT32_ARRAY: if (JS_ToInt32Free(ctx, &v, val)) goto ta_cvt_fail; if (unlikely(idx >= (uint32_t)p->u.array.count)) goto ta_out_of_bound; p->u.array.u.uint32_ptr[idx] = v; break; case JS_CLASS_BIG_INT64_ARRAY: case JS_CLASS_BIG_UINT64_ARRAY: /* XXX: need specific conversion function */ { int64_t v; if (JS_ToBigInt64Free(ctx, &v, val)) goto ta_cvt_fail; if (unlikely(idx >= (uint32_t)p->u.array.count)) goto ta_out_of_bound; p->u.array.u.uint64_ptr[idx] = v; } break; case JS_CLASS_FLOAT16_ARRAY: if (JS_ToFloat64Free(ctx, &d, val)) goto ta_cvt_fail; if (unlikely(idx >= (uint32_t)p->u.array.count)) goto ta_out_of_bound; p->u.array.u.fp16_ptr[idx] = tofp16(d); break; case JS_CLASS_FLOAT32_ARRAY: if (JS_ToFloat64Free(ctx, &d, val)) goto ta_cvt_fail; if (unlikely(idx >= (uint32_t)p->u.array.count)) goto ta_out_of_bound; p->u.array.u.float_ptr[idx] = d; break; case JS_CLASS_FLOAT64_ARRAY: if (JS_ToFloat64Free(ctx, &d, val)) { ta_cvt_fail: if (flags & JS_PROP_REFLECT_DEFINE_PROPERTY) { JS_FreeValue(ctx, JS_GetException(ctx)); return false; } return -1; } if (unlikely(idx >= (uint32_t)p->u.array.count)) { ta_out_of_bound: if (typed_array_is_oob(p)) if (flags & JS_PROP_DEFINE_PROPERTY) return JS_ThrowTypeErrorOrFalse(ctx, flags, "out-of-bound numeric index"); return true; // per spec: no OOB exception } p->u.array.u.double_ptr[idx] = d; break; default: goto slow_path; } return true; } else { JSAtom atom; int ret; slow_path: atom = JS_ValueToAtom(ctx, prop); JS_FreeValue(ctx, prop); if (unlikely(atom == JS_ATOM_NULL)) { JS_FreeValue(ctx, val); return -1; } ret = JS_SetPropertyInternal(ctx, this_obj, atom, val, flags); JS_FreeAtom(ctx, atom); return ret; } } int JS_SetPropertyUint32(JSContext *ctx, JSValueConst this_obj, uint32_t idx, JSValue val) { return JS_SetPropertyValue(ctx, this_obj, js_uint32(idx), val, JS_PROP_THROW); } int JS_SetPropertyInt64(JSContext *ctx, JSValueConst this_obj, int64_t idx, JSValue val) { JSAtom prop; int res; if ((uint64_t)idx <= INT32_MAX) { /* fast path for fast arrays */ return JS_SetPropertyValue(ctx, this_obj, js_int32(idx), val, JS_PROP_THROW); } prop = JS_NewAtomInt64(ctx, idx); if (prop == JS_ATOM_NULL) { JS_FreeValue(ctx, val); return -1; } res = JS_SetProperty(ctx, this_obj, prop, val); JS_FreeAtom(ctx, prop); return res; } /* `prop` may be pure ASCII or UTF-8 encoded */ int JS_SetPropertyStr(JSContext *ctx, JSValueConst this_obj, const char *prop, JSValue val) { JSAtom atom; int ret; atom = JS_NewAtom(ctx, prop); if (atom == JS_ATOM_NULL) { JS_FreeValue(ctx, val); return -1; } ret = JS_SetPropertyInternal(ctx, this_obj, atom, val, JS_PROP_THROW); JS_FreeAtom(ctx, atom); return ret; } /* compute the property flags. For each flag: (JS_PROP_HAS_x forces it, otherwise def_flags is used) Note: makes assumption about the bit pattern of the flags */ static int get_prop_flags(int flags, int def_flags) { int mask; mask = (flags >> JS_PROP_HAS_SHIFT) & JS_PROP_C_W_E; return (flags & mask) | (def_flags & ~mask); } static int JS_CreateProperty(JSContext *ctx, JSObject *p, JSAtom prop, JSValueConst val, JSValueConst getter, JSValueConst setter, int flags) { JSProperty *pr; int ret, prop_flags; /* add a new property or modify an existing exotic one */ if (p->is_exotic) { if (p->class_id == JS_CLASS_ARRAY) { uint32_t idx, len; if (p->fast_array) { if (__JS_AtomIsTaggedInt(prop)) { idx = __JS_AtomToUInt32(prop); if (idx == p->u.array.count) { if (!p->extensible) goto not_extensible; if (flags & (JS_PROP_HAS_GET | JS_PROP_HAS_SET)) goto convert_to_array; prop_flags = get_prop_flags(flags, 0); if (prop_flags != JS_PROP_C_W_E) goto convert_to_array; return add_fast_array_element(ctx, p, js_dup(val), flags); } else { goto convert_to_array; } } else if (JS_AtomIsArrayIndex(ctx, &idx, prop)) { /* convert the fast array to normal array */ convert_to_array: if (convert_fast_array_to_array(ctx, p)) return -1; goto generic_array; } } else if (JS_AtomIsArrayIndex(ctx, &idx, prop)) { JSProperty *plen; JSShapeProperty *pslen; generic_array: /* update the length field */ plen = &p->prop[0]; JS_ToUint32(ctx, &len, plen->u.value); if ((idx + 1) > len) { pslen = get_shape_prop(p->shape); if (unlikely(!(pslen->flags & JS_PROP_WRITABLE))) return JS_ThrowTypeErrorReadOnly(ctx, flags, JS_ATOM_length); /* XXX: should update the length after defining the property */ len = idx + 1; set_value(ctx, &plen->u.value, js_uint32(len)); } } } else if (is_typed_array(p->class_id)) { ret = JS_AtomIsNumericIndex(ctx, prop); if (ret != 0) { if (ret < 0) return -1; return JS_ThrowTypeErrorOrFalse(ctx, flags, "cannot create numeric index in typed array"); } } else if (!(flags & JS_PROP_NO_EXOTIC)) { const JSClassExoticMethods *em = ctx->rt->class_array[p->class_id].exotic; if (em) { if (em->define_own_property) { return em->define_own_property(ctx, JS_MKPTR(JS_TAG_OBJECT, p), prop, val, getter, setter, flags); } ret = JS_IsExtensible(ctx, JS_MKPTR(JS_TAG_OBJECT, p)); if (ret < 0) return -1; if (!ret) goto not_extensible; } } } if (!p->extensible) { not_extensible: return JS_ThrowTypeErrorOrFalse(ctx, flags, "object is not extensible"); } if (flags & (JS_PROP_HAS_GET | JS_PROP_HAS_SET)) { prop_flags = (flags & (JS_PROP_CONFIGURABLE | JS_PROP_ENUMERABLE)) | JS_PROP_GETSET; } else { prop_flags = flags & JS_PROP_C_W_E; } pr = add_property(ctx, p, prop, prop_flags); if (unlikely(!pr)) return -1; if (flags & (JS_PROP_HAS_GET | JS_PROP_HAS_SET)) { pr->u.getset.getter = NULL; if ((flags & JS_PROP_HAS_GET) && JS_IsFunction(ctx, getter)) { pr->u.getset.getter = JS_VALUE_GET_OBJ(js_dup(getter)); } pr->u.getset.setter = NULL; if ((flags & JS_PROP_HAS_SET) && JS_IsFunction(ctx, setter)) { pr->u.getset.setter = JS_VALUE_GET_OBJ(js_dup(setter)); } } else { if (flags & JS_PROP_HAS_VALUE) { pr->u.value = js_dup(val); } else { pr->u.value = JS_UNDEFINED; } } return true; } /* return false if not OK */ static bool check_define_prop_flags(int prop_flags, int flags) { bool has_accessor, is_getset; if (!(prop_flags & JS_PROP_CONFIGURABLE)) { if ((flags & (JS_PROP_HAS_CONFIGURABLE | JS_PROP_CONFIGURABLE)) == (JS_PROP_HAS_CONFIGURABLE | JS_PROP_CONFIGURABLE)) { return false; } if ((flags & JS_PROP_HAS_ENUMERABLE) && (flags & JS_PROP_ENUMERABLE) != (prop_flags & JS_PROP_ENUMERABLE)) return false; } if (flags & (JS_PROP_HAS_VALUE | JS_PROP_HAS_WRITABLE | JS_PROP_HAS_GET | JS_PROP_HAS_SET)) { if (!(prop_flags & JS_PROP_CONFIGURABLE)) { has_accessor = ((flags & (JS_PROP_HAS_GET | JS_PROP_HAS_SET)) != 0); is_getset = ((prop_flags & JS_PROP_TMASK) == JS_PROP_GETSET); if (has_accessor != is_getset) return false; if (!has_accessor && !is_getset && !(prop_flags & JS_PROP_WRITABLE)) { /* not writable: cannot set the writable bit */ if ((flags & (JS_PROP_HAS_WRITABLE | JS_PROP_WRITABLE)) == (JS_PROP_HAS_WRITABLE | JS_PROP_WRITABLE)) return false; } } } return true; } /* ensure that the shape can be safely modified */ static int js_shape_prepare_update(JSContext *ctx, JSObject *p, JSShapeProperty **pprs) { JSShape *sh; uint32_t idx = 0; /* prevent warning */ sh = p->shape; if (sh->is_hashed) { if (sh->header.ref_count != 1) { if (pprs) idx = *pprs - get_shape_prop(sh); /* clone the shape (the resulting one is no longer hashed) */ sh = js_clone_shape(ctx, sh); if (!sh) return -1; js_free_shape(ctx->rt, p->shape); p->shape = sh; if (pprs) *pprs = get_shape_prop(sh) + idx; } else { js_shape_hash_unlink(ctx->rt, sh); sh->is_hashed = false; } } return 0; } static int js_update_property_flags(JSContext *ctx, JSObject *p, JSShapeProperty **pprs, int flags) { if (flags != (*pprs)->flags) { if (js_shape_prepare_update(ctx, p, pprs)) return -1; (*pprs)->flags = flags; } return 0; } /* allowed flags: JS_PROP_CONFIGURABLE, JS_PROP_WRITABLE, JS_PROP_ENUMERABLE JS_PROP_HAS_GET, JS_PROP_HAS_SET, JS_PROP_HAS_VALUE, JS_PROP_HAS_CONFIGURABLE, JS_PROP_HAS_WRITABLE, JS_PROP_HAS_ENUMERABLE, JS_PROP_THROW, JS_PROP_NO_EXOTIC. If JS_PROP_THROW is set, return an exception instead of false. if JS_PROP_NO_EXOTIC is set, do not call the exotic define_own_property callback. return -1 (exception), false or true. */ int JS_DefineProperty(JSContext *ctx, JSValueConst this_obj, JSAtom prop, JSValueConst val, JSValueConst getter, JSValueConst setter, int flags) { JSObject *p; JSShapeProperty *prs; JSProperty *pr; int mask, res; if (JS_VALUE_GET_TAG(this_obj) != JS_TAG_OBJECT) { JS_ThrowTypeErrorNotAnObject(ctx); return -1; } p = JS_VALUE_GET_OBJ(this_obj); redo_prop_update: prs = find_own_property(&pr, p, prop); if (prs) { /* the range of the Array length property is always tested before */ if ((prs->flags & JS_PROP_LENGTH) && (flags & JS_PROP_HAS_VALUE)) { uint32_t array_length; if (JS_ToArrayLengthFree(ctx, &array_length, js_dup(val), false)) { return -1; } /* this code relies on the fact that Uint32 are never allocated */ val = js_uint32(array_length); /* prs may have been modified */ prs = find_own_property(&pr, p, prop); assert(prs != NULL); } /* property already exists */ if (!check_define_prop_flags(prs->flags, flags)) { not_configurable: return JS_ThrowTypeErrorOrFalse(ctx, flags, "property is not configurable"); } if ((prs->flags & JS_PROP_TMASK) == JS_PROP_AUTOINIT) { /* Instantiate property and retry */ if (JS_AutoInitProperty(ctx, p, prop, pr, prs)) return -1; goto redo_prop_update; } if (flags & (JS_PROP_HAS_VALUE | JS_PROP_HAS_WRITABLE | JS_PROP_HAS_GET | JS_PROP_HAS_SET)) { if (flags & (JS_PROP_HAS_GET | JS_PROP_HAS_SET)) { JSObject *new_getter, *new_setter; if (JS_IsFunction(ctx, getter)) { new_getter = JS_VALUE_GET_OBJ(getter); } else { new_getter = NULL; } if (JS_IsFunction(ctx, setter)) { new_setter = JS_VALUE_GET_OBJ(setter); } else { new_setter = NULL; } if ((prs->flags & JS_PROP_TMASK) != JS_PROP_GETSET) { if (js_shape_prepare_update(ctx, p, &prs)) return -1; /* convert to getset */ if ((prs->flags & JS_PROP_TMASK) == JS_PROP_VARREF) { free_var_ref(ctx->rt, pr->u.var_ref); } else { JS_FreeValue(ctx, pr->u.value); } prs->flags = (prs->flags & (JS_PROP_CONFIGURABLE | JS_PROP_ENUMERABLE)) | JS_PROP_GETSET; pr->u.getset.getter = NULL; pr->u.getset.setter = NULL; } else { if (!(prs->flags & JS_PROP_CONFIGURABLE)) { if ((flags & JS_PROP_HAS_GET) && new_getter != pr->u.getset.getter) { goto not_configurable; } if ((flags & JS_PROP_HAS_SET) && new_setter != pr->u.getset.setter) { goto not_configurable; } } } if (flags & JS_PROP_HAS_GET) { if (pr->u.getset.getter) JS_FreeValue(ctx, JS_MKPTR(JS_TAG_OBJECT, pr->u.getset.getter)); if (new_getter) js_dup(getter); pr->u.getset.getter = new_getter; } if (flags & JS_PROP_HAS_SET) { if (pr->u.getset.setter) JS_FreeValue(ctx, JS_MKPTR(JS_TAG_OBJECT, pr->u.getset.setter)); if (new_setter) js_dup(setter); pr->u.getset.setter = new_setter; } } else { if ((prs->flags & JS_PROP_TMASK) == JS_PROP_GETSET) { /* convert to data descriptor */ if (js_shape_prepare_update(ctx, p, &prs)) return -1; if (pr->u.getset.getter) JS_FreeValue(ctx, JS_MKPTR(JS_TAG_OBJECT, pr->u.getset.getter)); if (pr->u.getset.setter) JS_FreeValue(ctx, JS_MKPTR(JS_TAG_OBJECT, pr->u.getset.setter)); prs->flags &= ~(JS_PROP_TMASK | JS_PROP_WRITABLE); pr->u.value = JS_UNDEFINED; } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_VARREF) { /* Note: JS_PROP_VARREF is always writable */ } else { if ((prs->flags & (JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE)) == 0 && (flags & JS_PROP_HAS_VALUE)) { if (!js_same_value(ctx, val, pr->u.value)) { goto not_configurable; } else { return true; } } } if ((prs->flags & JS_PROP_TMASK) == JS_PROP_VARREF) { if (flags & JS_PROP_HAS_VALUE) { if (p->class_id == JS_CLASS_MODULE_NS) { /* JS_PROP_WRITABLE is always true for variable references, but they are write protected in module name spaces. */ if (!js_same_value(ctx, val, *pr->u.var_ref->pvalue)) goto not_configurable; } /* update the reference */ set_value(ctx, pr->u.var_ref->pvalue, js_dup(val)); } /* if writable is set to false, no longer a reference (for mapped arguments) */ if ((flags & (JS_PROP_HAS_WRITABLE | JS_PROP_WRITABLE)) == JS_PROP_HAS_WRITABLE) { JSValue val1; if (js_shape_prepare_update(ctx, p, &prs)) return -1; val1 = js_dup(*pr->u.var_ref->pvalue); free_var_ref(ctx->rt, pr->u.var_ref); pr->u.value = val1; prs->flags &= ~(JS_PROP_TMASK | JS_PROP_WRITABLE); } } else if (prs->flags & JS_PROP_LENGTH) { if (flags & JS_PROP_HAS_VALUE) { /* Note: no JS code is executable because 'val' is guaranted to be a Uint32 */ res = set_array_length(ctx, p, js_dup(val), flags); } else { res = true; } /* still need to reset the writable flag if needed. The JS_PROP_LENGTH is kept because the Uint32 test is still done if the length property is read-only. */ if ((flags & (JS_PROP_HAS_WRITABLE | JS_PROP_WRITABLE)) == JS_PROP_HAS_WRITABLE) { prs = get_shape_prop(p->shape); if (js_update_property_flags(ctx, p, &prs, prs->flags & ~JS_PROP_WRITABLE)) return -1; } return res; } else { if (flags & JS_PROP_HAS_VALUE) { JS_FreeValue(ctx, pr->u.value); pr->u.value = js_dup(val); } if (flags & JS_PROP_HAS_WRITABLE) { if (js_update_property_flags(ctx, p, &prs, (prs->flags & ~JS_PROP_WRITABLE) | (flags & JS_PROP_WRITABLE))) return -1; } } } } mask = 0; if (flags & JS_PROP_HAS_CONFIGURABLE) mask |= JS_PROP_CONFIGURABLE; if (flags & JS_PROP_HAS_ENUMERABLE) mask |= JS_PROP_ENUMERABLE; if (js_update_property_flags(ctx, p, &prs, (prs->flags & ~mask) | (flags & mask))) return -1; return true; } /* handle modification of fast array elements */ if (p->fast_array) { uint32_t idx; uint32_t prop_flags; if (p->class_id == JS_CLASS_ARRAY) { if (__JS_AtomIsTaggedInt(prop)) { idx = __JS_AtomToUInt32(prop); if (idx < p->u.array.count) { prop_flags = get_prop_flags(flags, JS_PROP_C_W_E); if (prop_flags != JS_PROP_C_W_E) goto convert_to_slow_array; if (flags & (JS_PROP_HAS_GET | JS_PROP_HAS_SET)) { convert_to_slow_array: if (convert_fast_array_to_array(ctx, p)) return -1; else goto redo_prop_update; } if (flags & JS_PROP_HAS_VALUE) { set_value(ctx, &p->u.array.u.values[idx], js_dup(val)); } return true; } } } else if (is_typed_array(p->class_id)) { JSValue num; int ret; if (!__JS_AtomIsTaggedInt(prop)) { /* slow path with to handle all numeric indexes */ num = JS_AtomIsNumericIndex1(ctx, prop); if (JS_IsUndefined(num)) goto typed_array_done; if (JS_IsException(num)) return -1; ret = JS_NumberIsInteger(ctx, num); if (ret < 0) { JS_FreeValue(ctx, num); return -1; } if (!ret) { JS_FreeValue(ctx, num); return JS_ThrowTypeErrorOrFalse(ctx, flags, "non integer index in typed array"); } ret = JS_NumberIsNegativeOrMinusZero(ctx, num); JS_FreeValue(ctx, num); if (ret) { return JS_ThrowTypeErrorOrFalse(ctx, flags, "negative index in typed array"); } if (!__JS_AtomIsTaggedInt(prop)) goto typed_array_oob; } idx = __JS_AtomToUInt32(prop); /* if the typed array is detached, p->u.array.count = 0 */ if (idx >= p->u.array.count) { typed_array_oob: return JS_ThrowTypeErrorOrFalse(ctx, flags, "out-of-bound index in typed array"); } prop_flags = get_prop_flags(flags, JS_PROP_ENUMERABLE | JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE); if (flags & (JS_PROP_HAS_GET | JS_PROP_HAS_SET) || prop_flags != (JS_PROP_ENUMERABLE | JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE)) { return JS_ThrowTypeErrorOrFalse(ctx, flags, "invalid descriptor flags"); } if (flags & JS_PROP_HAS_VALUE) { return JS_SetPropertyValue(ctx, this_obj, js_int32(idx), js_dup(val), flags); } return true; typed_array_done: ; } } return JS_CreateProperty(ctx, p, prop, val, getter, setter, flags); } static int JS_DefineAutoInitProperty(JSContext *ctx, JSValueConst this_obj, JSAtom prop, JSAutoInitIDEnum id, void *opaque, int flags) { JSObject *p; JSProperty *pr; if (JS_VALUE_GET_TAG(this_obj) != JS_TAG_OBJECT) return false; p = JS_VALUE_GET_OBJ(this_obj); if (find_own_property(&pr, p, prop)) { /* property already exists */ abort(); return false; } /* Specialized CreateProperty */ pr = add_property(ctx, p, prop, (flags & JS_PROP_C_W_E) | JS_PROP_AUTOINIT); if (unlikely(!pr)) return -1; pr->u.init.realm_and_id = (uintptr_t)JS_DupContext(ctx); assert((pr->u.init.realm_and_id & 3) == 0); assert(id <= 3); pr->u.init.realm_and_id |= id; pr->u.init.opaque = opaque; return true; } /* shortcut to add or redefine a new property value */ int JS_DefinePropertyValue(JSContext *ctx, JSValueConst this_obj, JSAtom prop, JSValue val, int flags) { int ret; ret = JS_DefineProperty(ctx, this_obj, prop, val, JS_UNDEFINED, JS_UNDEFINED, flags | JS_PROP_HAS_VALUE | JS_PROP_HAS_CONFIGURABLE | JS_PROP_HAS_WRITABLE | JS_PROP_HAS_ENUMERABLE); JS_FreeValue(ctx, val); return ret; } int JS_DefinePropertyValueValue(JSContext *ctx, JSValueConst this_obj, JSValue prop, JSValue val, int flags) { JSAtom atom; int ret; atom = JS_ValueToAtom(ctx, prop); JS_FreeValue(ctx, prop); if (unlikely(atom == JS_ATOM_NULL)) { JS_FreeValue(ctx, val); return -1; } ret = JS_DefinePropertyValue(ctx, this_obj, atom, val, flags); JS_FreeAtom(ctx, atom); return ret; } int JS_DefinePropertyValueUint32(JSContext *ctx, JSValueConst this_obj, uint32_t idx, JSValue val, int flags) { return JS_DefinePropertyValueValue(ctx, this_obj, js_uint32(idx), val, flags); } int JS_DefinePropertyValueInt64(JSContext *ctx, JSValueConst this_obj, int64_t idx, JSValue val, int flags) { return JS_DefinePropertyValueValue(ctx, this_obj, js_int64(idx), val, flags); } /* `prop` may be pure ASCII or UTF-8 encoded */ int JS_DefinePropertyValueStr(JSContext *ctx, JSValueConst this_obj, const char *prop, JSValue val, int flags) { JSAtom atom; int ret; atom = JS_NewAtom(ctx, prop); if (atom == JS_ATOM_NULL) { JS_FreeValue(ctx, val); return -1; } ret = JS_DefinePropertyValue(ctx, this_obj, atom, val, flags); JS_FreeAtom(ctx, atom); return ret; } /* shortcut to add getter & setter */ int JS_DefinePropertyGetSet(JSContext *ctx, JSValueConst this_obj, JSAtom prop, JSValue getter, JSValue setter, int flags) { int ret; ret = JS_DefineProperty(ctx, this_obj, prop, JS_UNDEFINED, getter, setter, flags | JS_PROP_HAS_GET | JS_PROP_HAS_SET | JS_PROP_HAS_CONFIGURABLE | JS_PROP_HAS_ENUMERABLE); JS_FreeValue(ctx, getter); JS_FreeValue(ctx, setter); return ret; } static int JS_CreateDataPropertyUint32(JSContext *ctx, JSValueConst this_obj, int64_t idx, JSValue val, int flags) { return JS_DefinePropertyValueValue(ctx, this_obj, js_int64(idx), val, flags | JS_PROP_CONFIGURABLE | JS_PROP_ENUMERABLE | JS_PROP_WRITABLE); } /* return true if 'obj' has a non empty 'name' string */ static bool js_object_has_name(JSContext *ctx, JSValue obj) { JSProperty *pr; JSShapeProperty *prs; JSValue val; JSString *p; prs = find_own_property(&pr, JS_VALUE_GET_OBJ(obj), JS_ATOM_name); if (!prs) return false; if ((prs->flags & JS_PROP_TMASK) != JS_PROP_NORMAL) return true; val = pr->u.value; if (JS_VALUE_GET_TAG(val) != JS_TAG_STRING) return true; p = JS_VALUE_GET_STRING(val); return (p->len != 0); } static int JS_DefineObjectName(JSContext *ctx, JSValue obj, JSAtom name, int flags) { if (name != JS_ATOM_NULL && JS_IsObject(obj) && !js_object_has_name(ctx, obj) && JS_DefinePropertyValue(ctx, obj, JS_ATOM_name, JS_AtomToString(ctx, name), flags) < 0) { return -1; } return 0; } static int JS_DefineObjectNameComputed(JSContext *ctx, JSValue obj, JSValue str, int flags) { if (JS_IsObject(obj) && !js_object_has_name(ctx, obj)) { JSAtom prop; JSValue name_str; prop = JS_ValueToAtom(ctx, str); if (prop == JS_ATOM_NULL) return -1; name_str = js_get_function_name(ctx, prop); JS_FreeAtom(ctx, prop); if (JS_IsException(name_str)) return -1; if (JS_DefinePropertyValue(ctx, obj, JS_ATOM_name, name_str, flags) < 0) return -1; } return 0; } #define DEFINE_GLOBAL_LEX_VAR (1 << 7) #define DEFINE_GLOBAL_FUNC_VAR (1 << 6) static JSValue JS_ThrowSyntaxErrorVarRedeclaration(JSContext *ctx, JSAtom prop) { return JS_ThrowSyntaxErrorAtom(ctx, "redeclaration of '%s'", prop); } /* flags is 0, DEFINE_GLOBAL_LEX_VAR or DEFINE_GLOBAL_FUNC_VAR */ /* XXX: could support exotic global object. */ static int JS_CheckDefineGlobalVar(JSContext *ctx, JSAtom prop, int flags) { JSObject *p; JSShapeProperty *prs; p = JS_VALUE_GET_OBJ(ctx->global_obj); prs = find_own_property1(p, prop); /* XXX: should handle JS_PROP_AUTOINIT */ if (flags & DEFINE_GLOBAL_LEX_VAR) { if (prs && !(prs->flags & JS_PROP_CONFIGURABLE)) goto fail_redeclaration; } else { if (!prs && !p->extensible) goto define_error; if (flags & DEFINE_GLOBAL_FUNC_VAR) { if (prs) { if (!(prs->flags & JS_PROP_CONFIGURABLE) && ((prs->flags & JS_PROP_TMASK) == JS_PROP_GETSET || ((prs->flags & (JS_PROP_WRITABLE | JS_PROP_ENUMERABLE)) != (JS_PROP_WRITABLE | JS_PROP_ENUMERABLE)))) { define_error: JS_ThrowTypeErrorAtom(ctx, "cannot define variable '%s'", prop); return -1; } } } } /* check if there already is a lexical declaration */ p = JS_VALUE_GET_OBJ(ctx->global_var_obj); prs = find_own_property1(p, prop); if (prs) { fail_redeclaration: JS_ThrowSyntaxErrorVarRedeclaration(ctx, prop); return -1; } return 0; } /* def_flags is (0, DEFINE_GLOBAL_LEX_VAR) | JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE */ /* XXX: could support exotic global object. */ static int JS_DefineGlobalVar(JSContext *ctx, JSAtom prop, int def_flags) { JSObject *p; JSShapeProperty *prs; JSProperty *pr; JSValue val; int flags; if (def_flags & DEFINE_GLOBAL_LEX_VAR) { p = JS_VALUE_GET_OBJ(ctx->global_var_obj); flags = JS_PROP_ENUMERABLE | (def_flags & JS_PROP_WRITABLE) | JS_PROP_CONFIGURABLE; val = JS_UNINITIALIZED; } else { p = JS_VALUE_GET_OBJ(ctx->global_obj); flags = JS_PROP_ENUMERABLE | JS_PROP_WRITABLE | (def_flags & JS_PROP_CONFIGURABLE); val = JS_UNDEFINED; } prs = find_own_property1(p, prop); if (prs) return 0; if (!p->extensible) return 0; pr = add_property(ctx, p, prop, flags); if (unlikely(!pr)) return -1; pr->u.value = val; return 0; } /* 'def_flags' is 0 or JS_PROP_CONFIGURABLE. */ /* XXX: could support exotic global object. */ static int JS_DefineGlobalFunction(JSContext *ctx, JSAtom prop, JSValue func, int def_flags) { JSObject *p; JSShapeProperty *prs; int flags; p = JS_VALUE_GET_OBJ(ctx->global_obj); prs = find_own_property1(p, prop); flags = JS_PROP_HAS_VALUE | JS_PROP_THROW; if (!prs || (prs->flags & JS_PROP_CONFIGURABLE)) { flags |= JS_PROP_ENUMERABLE | JS_PROP_WRITABLE | def_flags | JS_PROP_HAS_CONFIGURABLE | JS_PROP_HAS_WRITABLE | JS_PROP_HAS_ENUMERABLE; } if (JS_DefineProperty(ctx, ctx->global_obj, prop, func, JS_UNDEFINED, JS_UNDEFINED, flags) < 0) return -1; return 0; } static JSValue JS_GetGlobalVar(JSContext *ctx, JSAtom prop, bool throw_ref_error) { JSObject *p; JSShapeProperty *prs; JSProperty *pr; /* no exotic behavior is possible in global_var_obj */ p = JS_VALUE_GET_OBJ(ctx->global_var_obj); prs = find_own_property(&pr, p, prop); if (prs) { /* XXX: should handle JS_PROP_TMASK properties */ if (unlikely(JS_IsUninitialized(pr->u.value))) return JS_ThrowReferenceErrorUninitialized(ctx, prs->atom); return js_dup(pr->u.value); } if (ctx->scopeLookup) { struct LookupResult result = ctx->scopeLookup(ctx, prop); if (result.useResult) return result.value; } return JS_GetPropertyInternal(ctx, ctx->global_obj, prop, ctx->global_obj, throw_ref_error); } /* construct a reference to a global variable */ static int JS_GetGlobalVarRef(JSContext *ctx, JSAtom prop, JSValue *sp) { JSObject *p; JSShapeProperty *prs; JSProperty *pr; /* no exotic behavior is possible in global_var_obj */ p = JS_VALUE_GET_OBJ(ctx->global_var_obj); prs = find_own_property(&pr, p, prop); if (prs) { /* XXX: should handle JS_PROP_AUTOINIT properties? */ /* XXX: conformance: do these tests in OP_put_var_ref/OP_get_var_ref ? */ if (unlikely(JS_IsUninitialized(pr->u.value))) { JS_ThrowReferenceErrorUninitialized(ctx, prs->atom); return -1; } if (unlikely(!(prs->flags & JS_PROP_WRITABLE))) { return JS_ThrowTypeErrorReadOnly(ctx, JS_PROP_THROW, prop); } sp[0] = js_dup(ctx->global_var_obj); } else { int ret; ret = JS_HasProperty(ctx, ctx->global_obj, prop); if (ret < 0) return -1; if (ret) { sp[0] = js_dup(ctx->global_obj); } else { sp[0] = JS_UNDEFINED; } } sp[1] = JS_AtomToValue(ctx, prop); return 0; } /* use for strict variable access: test if the variable exists */ static int JS_CheckGlobalVar(JSContext *ctx, JSAtom prop) { JSObject *p; JSShapeProperty *prs; int ret; /* no exotic behavior is possible in global_var_obj */ p = JS_VALUE_GET_OBJ(ctx->global_var_obj); prs = find_own_property1(p, prop); if (prs) { ret = true; } else { ret = JS_HasProperty(ctx, ctx->global_obj, prop); if (ret < 0) return -1; } return ret; } /* flag = 0: normal variable write flag = 1: initialize lexical variable flag = 2: normal variable write, strict check was done before */ static int JS_SetGlobalVar(JSContext *ctx, JSAtom prop, JSValue val, int flag) { JSObject *p; JSShapeProperty *prs; JSProperty *pr; int flags; /* no exotic behavior is possible in global_var_obj */ p = JS_VALUE_GET_OBJ(ctx->global_var_obj); prs = find_own_property(&pr, p, prop); if (prs) { /* XXX: should handle JS_PROP_AUTOINIT properties? */ if (flag != 1) { if (unlikely(JS_IsUninitialized(pr->u.value))) { JS_FreeValue(ctx, val); JS_ThrowReferenceErrorUninitialized(ctx, prs->atom); return -1; } if (unlikely(!(prs->flags & JS_PROP_WRITABLE))) { JS_FreeValue(ctx, val); return JS_ThrowTypeErrorReadOnly(ctx, JS_PROP_THROW, prop); } } set_value(ctx, &pr->u.value, val); return 0; } flags = JS_PROP_THROW_STRICT; if (is_strict_mode(ctx)) flags |= JS_PROP_NO_ADD; if (ctx->scopeLookup) { struct LookupResult result = ctx->scopeLookup(ctx, prop); if (result.useResult) { JS_FreeValue(ctx, result.value); return JS_SetPropertyInternal2(ctx, ctx->global_obj, prop, val, result.scope, flags); } } return JS_SetPropertyInternal(ctx, ctx->global_obj, prop, val, flags); } /* return -1, false or true */ static int JS_DeleteGlobalVar(JSContext *ctx, JSAtom prop) { JSObject *p; JSShapeProperty *prs; JSProperty *pr; int ret; /* 9.1.1.4.7 DeleteBinding ( N ) */ p = JS_VALUE_GET_OBJ(ctx->global_var_obj); prs = find_own_property(&pr, p, prop); if (prs) return false; /* lexical variables cannot be deleted */ ret = JS_HasProperty(ctx, ctx->global_obj, prop); if (ret < 0) return -1; if (ret) { return JS_DeleteProperty(ctx, ctx->global_obj, prop, 0); } else { return true; } } /* return -1, false or true. return false if not configurable or invalid object. return -1 in case of exception. flags can be 0, JS_PROP_THROW or JS_PROP_THROW_STRICT */ int JS_DeleteProperty(JSContext *ctx, JSValueConst obj, JSAtom prop, int flags) { JSValue obj1; JSObject *p; int res; obj1 = JS_ToObject(ctx, obj); if (JS_IsException(obj1)) return -1; p = JS_VALUE_GET_OBJ(obj1); res = delete_property(ctx, p, prop); JS_FreeValue(ctx, obj1); if (res != false) return res; if ((flags & JS_PROP_THROW) || ((flags & JS_PROP_THROW_STRICT) && is_strict_mode(ctx))) { JS_ThrowTypeError(ctx, "could not delete property"); return -1; } return false; } int JS_DeletePropertyInt64(JSContext *ctx, JSValueConst obj, int64_t idx, int flags) { JSAtom prop; int res; if ((uint64_t)idx <= JS_ATOM_MAX_INT) { /* fast path for fast arrays */ return JS_DeleteProperty(ctx, obj, __JS_AtomFromUInt32(idx), flags); } prop = JS_NewAtomInt64(ctx, idx); if (prop == JS_ATOM_NULL) return -1; res = JS_DeleteProperty(ctx, obj, prop, flags); JS_FreeAtom(ctx, prop); return res; } bool JS_IsFunction(JSContext *ctx, JSValueConst val) { JSObject *p; if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT) return false; p = JS_VALUE_GET_OBJ(val); switch(p->class_id) { case JS_CLASS_BYTECODE_FUNCTION: return true; case JS_CLASS_PROXY: return p->u.proxy_data->is_func; default: return (ctx->rt->class_array[p->class_id].call != NULL); } } static bool JS_IsCFunction(JSContext *ctx, JSValueConst val, JSCFunction *func, int magic) { JSObject *p; if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT) return false; p = JS_VALUE_GET_OBJ(val); if (p->class_id == JS_CLASS_C_FUNCTION) return (p->u.cfunc.c_function.generic == func && p->u.cfunc.magic == magic); else return false; } bool JS_IsConstructor(JSContext *ctx, JSValueConst val) { JSObject *p; if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT) return false; p = JS_VALUE_GET_OBJ(val); return p->is_constructor; } bool JS_SetConstructorBit(JSContext *ctx, JSValueConst func_obj, bool val) { JSObject *p; if (JS_VALUE_GET_TAG(func_obj) != JS_TAG_OBJECT) return false; p = JS_VALUE_GET_OBJ(func_obj); p->is_constructor = val; return true; } bool JS_IsRegExp(JSValueConst val) { return JS_CLASS_REGEXP == JS_GetClassID(val); } bool JS_IsMap(JSValueConst val) { return JS_CLASS_MAP == JS_GetClassID(val); } bool JS_IsSet(JSValueConst val) { return JS_CLASS_SET == JS_GetClassID(val); } bool JS_IsWeakRef(JSValueConst val) { return JS_CLASS_WEAK_REF == JS_GetClassID(val); } bool JS_IsWeakSet(JSValueConst val) { return JS_CLASS_WEAKSET == JS_GetClassID(val); } bool JS_IsWeakMap(JSValueConst val) { return JS_CLASS_WEAKMAP == JS_GetClassID(val); } bool JS_IsDataView(JSValueConst val) { return JS_CLASS_DATAVIEW == JS_GetClassID(val); } int JS_IsSimpleValue(JSContext* ctx, JSValueConst v) { JSObject *p; if (JS_VALUE_GET_TAG(v) != JS_TAG_OBJECT) return 1; p = JS_VALUE_GET_OBJ(v); return p->class_id >= JS_CLASS_OBJECT && p->class_id <= JS_CLASS_BOOLEAN; } bool JS_IsError(JSValueConst val) { return JS_CLASS_ERROR == JS_GetClassID(val); } /* used to avoid catching interrupt exceptions */ bool JS_IsUncatchableError(JSValueConst val) { JSObject *p; if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT) return false; p = JS_VALUE_GET_OBJ(val); return p->class_id == JS_CLASS_ERROR && p->is_uncatchable_error; } static void js_set_uncatchable_error(JSContext *ctx, JSValueConst val, bool flag) { JSObject *p; if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT) return; p = JS_VALUE_GET_OBJ(val); if (p->class_id == JS_CLASS_ERROR) p->is_uncatchable_error = flag; } void JS_SetUncatchableError(JSContext *ctx, JSValueConst val) { js_set_uncatchable_error(ctx, val, true); } void JS_ClearUncatchableError(JSContext *ctx, JSValueConst val) { js_set_uncatchable_error(ctx, val, false); } void JS_ResetUncatchableError(JSContext *ctx) { js_set_uncatchable_error(ctx, ctx->rt->current_exception, false); } int JS_SetOpaque(JSValueConst obj, void *opaque) { JSObject *p; if (JS_VALUE_GET_TAG(obj) == JS_TAG_OBJECT) { p = JS_VALUE_GET_OBJ(obj); // User code can't set the opaque of internal objects. if (p->class_id >= JS_CLASS_INIT_COUNT) { p->u.opaque = opaque; return 0; } } return -1; } /* |obj| must be a JSObject of an internal class. */ static void JS_SetOpaqueInternal(JSValueConst obj, void *opaque) { JSObject *p; assert(JS_VALUE_GET_TAG(obj) == JS_TAG_OBJECT); p = JS_VALUE_GET_OBJ(obj); assert(p->class_id < JS_CLASS_INIT_COUNT); p->u.opaque = opaque; } /* return NULL if not an object of class class_id */ void *JS_GetOpaque(JSValueConst obj, JSClassID class_id) { JSObject *p; if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT) return NULL; p = JS_VALUE_GET_OBJ(obj); if (p->class_id != class_id) return NULL; return p->u.opaque; } void *JS_GetOpaque2(JSContext *ctx, JSValueConst obj, JSClassID class_id) { void *p = JS_GetOpaque(obj, class_id); if (unlikely(!p)) { JS_ThrowTypeErrorInvalidClass(ctx, class_id); } return p; } void *JS_GetAnyOpaque(JSValueConst obj, JSClassID *class_id) { JSObject *p; if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT) { *class_id = 0; return NULL; } p = JS_VALUE_GET_OBJ(obj); *class_id = p->class_id; return p->u.opaque; } static JSValue JS_ToPrimitiveFree(JSContext *ctx, JSValue val, int hint) { int i; bool force_ordinary; JSAtom method_name; JSValue method, ret; if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT) return val; force_ordinary = hint & HINT_FORCE_ORDINARY; hint &= ~HINT_FORCE_ORDINARY; if (!force_ordinary) { method = JS_GetProperty(ctx, val, JS_ATOM_Symbol_toPrimitive); if (JS_IsException(method)) goto exception; /* ECMA says *If exoticToPrim is not undefined* but tests in test262 use null as a non callable converter */ if (!JS_IsUndefined(method) && !JS_IsNull(method)) { JSAtom atom; JSValue arg; switch(hint) { case HINT_STRING: atom = JS_ATOM_string; break; case HINT_NUMBER: atom = JS_ATOM_number; break; default: case HINT_NONE: atom = JS_ATOM_default; break; } arg = JS_AtomToString(ctx, atom); ret = JS_CallFree(ctx, method, val, 1, vc(&arg)); JS_FreeValue(ctx, arg); if (JS_IsException(ret)) goto exception; JS_FreeValue(ctx, val); if (JS_VALUE_GET_TAG(ret) != JS_TAG_OBJECT) return ret; JS_FreeValue(ctx, ret); return JS_ThrowTypeError(ctx, "toPrimitive"); } } if (hint != HINT_STRING) hint = HINT_NUMBER; for(i = 0; i < 2; i++) { if ((i ^ hint) == 0) { method_name = JS_ATOM_toString; } else { method_name = JS_ATOM_valueOf; } method = JS_GetProperty(ctx, val, method_name); if (JS_IsException(method)) goto exception; if (JS_IsFunction(ctx, method)) { ret = JS_CallFree(ctx, method, val, 0, NULL); if (JS_IsException(ret)) goto exception; if (JS_VALUE_GET_TAG(ret) != JS_TAG_OBJECT) { JS_FreeValue(ctx, val); return ret; } JS_FreeValue(ctx, ret); } else { JS_FreeValue(ctx, method); } } JS_ThrowTypeError(ctx, "toPrimitive"); exception: JS_FreeValue(ctx, val); return JS_EXCEPTION; } static JSValue JS_ToPrimitive(JSContext *ctx, JSValueConst val, int hint) { return JS_ToPrimitiveFree(ctx, js_dup(val), hint); } void JS_SetIsHTMLDDA(JSContext *ctx, JSValueConst obj) { JSObject *p; if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT) return; p = JS_VALUE_GET_OBJ(obj); p->is_HTMLDDA = true; } static inline bool JS_IsHTMLDDA(JSContext *ctx, JSValueConst obj) { JSObject *p; if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT) return false; p = JS_VALUE_GET_OBJ(obj); return p->is_HTMLDDA; } static int JS_ToBoolFree(JSContext *ctx, JSValue val) { uint32_t tag = JS_VALUE_GET_TAG(val); switch(tag) { case JS_TAG_INT: return JS_VALUE_GET_INT(val) != 0; case JS_TAG_BOOL: case JS_TAG_NULL: case JS_TAG_UNDEFINED: return JS_VALUE_GET_INT(val); case JS_TAG_EXCEPTION: return -1; case JS_TAG_STRING: { bool ret = JS_VALUE_GET_STRING(val)->len != 0; JS_FreeValue(ctx, val); return ret; } case JS_TAG_SHORT_BIG_INT: return JS_VALUE_GET_SHORT_BIG_INT(val) != 0; case JS_TAG_BIG_INT: { JSBigInt *p = JS_VALUE_GET_PTR(val); bool ret; int i; /* fail safe: we assume it is not necessarily normalized. Beginning from the MSB ensures that the test is fast. */ ret = false; for(i = p->len - 1; i >= 0; i--) { if (p->tab[i] != 0) { ret = true; break; } } JS_FreeValue(ctx, val); return ret; } case JS_TAG_OBJECT: { JSObject *p = JS_VALUE_GET_OBJ(val); bool ret = !p->is_HTMLDDA; JS_FreeValue(ctx, val); return ret; } break; default: if (JS_TAG_IS_FLOAT64(tag)) { double d = JS_VALUE_GET_FLOAT64(val); return !isnan(d) && d != 0; } else { JS_FreeValue(ctx, val); return true; } } } int JS_ToBool(JSContext *ctx, JSValueConst val) { return JS_ToBoolFree(ctx, js_dup(val)); } /* pc points to pure ASCII or UTF-8, null terminated contents */ static int skip_spaces(const char *pc) { const uint8_t *p, *p_next, *p_start; uint32_t c; p = p_start = (const uint8_t *)pc; for (;;) { c = *p++; if (c < 0x80) { if (!((c >= 0x09 && c <= 0x0d) || (c == 0x20))) break; } else { c = utf8_decode(p - 1, &p_next); /* no need to test for invalid UTF-8, 0xFFFD is not a space */ if (!lre_is_space(c)) break; p = p_next; } } return p - 1 - p_start; } static inline int js_to_digit(int c) { if (c >= '0' && c <= '9') return c - '0'; else if (c >= 'A' && c <= 'Z') return c - 'A' + 10; else if (c >= 'a' && c <= 'z') return c - 'a' + 10; else return 36; } /* bigint support */ #define ADDC(res, carry_out, op1, op2, carry_in) \ do { \ js_limb_t __v, __a, __k, __k1; \ __v = (op1); \ __a = __v + (op2); \ __k1 = __a < __v; \ __k = (carry_in); \ __a = __a + __k; \ carry_out = (__a < __k) | __k1; \ res = __a; \ } while (0) /* a != 0 */ static inline js_limb_t js_limb_clz(js_limb_t a) { if (!a) return JS_LIMB_BITS; return clz32(a); } static js_limb_t js_mp_add(js_limb_t *res, const js_limb_t *op1, const js_limb_t *op2, js_limb_t n, js_limb_t carry) { int i; for(i = 0;i < n; i++) { ADDC(res[i], carry, op1[i], op2[i], carry); } return carry; } static js_limb_t js_mp_sub(js_limb_t *res, const js_limb_t *op1, const js_limb_t *op2, int n, js_limb_t carry) { int i; js_limb_t k, a, v, k1; k = carry; for(i=0;i v; v = a - k; k = (v > a) | k1; res[i] = v; } return k; } /* compute 0 - op2. carry = 0 or 1. */ static js_limb_t js_mp_neg(js_limb_t *res, const js_limb_t *op2, int n) { int i; js_limb_t v, carry; carry = 1; for(i=0;i> JS_LIMB_BITS; } return l; } static js_limb_t js_mp_div1(js_limb_t *tabr, const js_limb_t *taba, js_limb_t n, js_limb_t b, js_limb_t r) { js_slimb_t i; js_dlimb_t a1; for(i = n - 1; i >= 0; i--) { a1 = ((js_dlimb_t)r << JS_LIMB_BITS) | taba[i]; tabr[i] = a1 / b; r = a1 % b; } return r; } /* tabr[] += taba[] * b, return the high word. */ static js_limb_t js_mp_add_mul1(js_limb_t *tabr, const js_limb_t *taba, js_limb_t n, js_limb_t b) { js_limb_t i, l; js_dlimb_t t; l = 0; for(i = 0; i < n; i++) { t = (js_dlimb_t)taba[i] * (js_dlimb_t)b + l + tabr[i]; tabr[i] = t; l = t >> JS_LIMB_BITS; } return l; } /* size of the result : op1_size + op2_size. */ static void js_mp_mul_basecase(js_limb_t *result, const js_limb_t *op1, js_limb_t op1_size, const js_limb_t *op2, js_limb_t op2_size) { int i; js_limb_t r; result[op1_size] = js_mp_mul1(result, op1, op1_size, op2[0], 0); for(i=1;i> JS_LIMB_BITS); } return l; } /* WARNING: d must be >= 2^(JS_LIMB_BITS-1) */ static inline js_limb_t js_udiv1norm_init(js_limb_t d) { js_limb_t a0, a1; a1 = -d - 1; a0 = -1; return (((js_dlimb_t)a1 << JS_LIMB_BITS) | a0) / d; } /* return the quotient and the remainder in '*pr'of 'a1*2^JS_LIMB_BITS+a0 / d' with 0 <= a1 < d. */ static inline js_limb_t js_udiv1norm(js_limb_t *pr, js_limb_t a1, js_limb_t a0, js_limb_t d, js_limb_t d_inv) { js_limb_t n1m, n_adj, q, r, ah; js_dlimb_t a; n1m = ((js_slimb_t)a0 >> (JS_LIMB_BITS - 1)); n_adj = a0 + (n1m & d); a = (js_dlimb_t)d_inv * (a1 - n1m) + n_adj; q = (a >> JS_LIMB_BITS) + a1; /* compute a - q * r and update q so that the remainder is\ between 0 and d - 1 */ a = ((js_dlimb_t)a1 << JS_LIMB_BITS) | a0; a = a - (js_dlimb_t)q * d - d; ah = a >> JS_LIMB_BITS; q += 1 + ah; r = (js_limb_t)a + (ah & d); *pr = r; return q; } #define UDIV1NORM_THRESHOLD 3 /* b must be >= 1 << (JS_LIMB_BITS - 1) */ static js_limb_t js_mp_div1norm(js_limb_t *tabr, const js_limb_t *taba, js_limb_t n, js_limb_t b, js_limb_t r) { js_slimb_t i; if (n >= UDIV1NORM_THRESHOLD) { js_limb_t b_inv; b_inv = js_udiv1norm_init(b); for(i = n - 1; i >= 0; i--) { tabr[i] = js_udiv1norm(&r, r, taba[i], b, b_inv); } } else { js_dlimb_t a1; for(i = n - 1; i >= 0; i--) { a1 = ((js_dlimb_t)r << JS_LIMB_BITS) | taba[i]; tabr[i] = a1 / b; r = a1 % b; } } return r; } /* base case division: divides taba[0..na-1] by tabb[0..nb-1]. tabb[nb - 1] must be >= 1 << (JS_LIMB_BITS - 1). na - nb must be >= 0. 'taba' is modified and contains the remainder (nb limbs). tabq[0..na-nb] contains the quotient with tabq[na - nb] <= 1. */ static void js_mp_divnorm(js_limb_t *tabq, js_limb_t *taba, js_limb_t na, const js_limb_t *tabb, js_limb_t nb) { js_limb_t r, a, c, q, v, b1, b1_inv, n, dummy_r; int i, j; b1 = tabb[nb - 1]; if (nb == 1) { taba[0] = js_mp_div1norm(tabq, taba, na, b1, 0); return; } n = na - nb; if (n >= UDIV1NORM_THRESHOLD) b1_inv = js_udiv1norm_init(b1); else b1_inv = 0; /* first iteration: the quotient is only 0 or 1 */ q = 1; for(j = nb - 1; j >= 0; j--) { if (taba[n + j] != tabb[j]) { if (taba[n + j] < tabb[j]) q = 0; break; } } tabq[n] = q; if (q) { js_mp_sub(taba + n, taba + n, tabb, nb, 0); } for(i = n - 1; i >= 0; i--) { if (unlikely(taba[i + nb] >= b1)) { q = -1; } else if (b1_inv) { q = js_udiv1norm(&dummy_r, taba[i + nb], taba[i + nb - 1], b1, b1_inv); } else { js_dlimb_t al; al = ((js_dlimb_t)taba[i + nb] << JS_LIMB_BITS) | taba[i + nb - 1]; q = al / b1; r = al % b1; } r = js_mp_sub_mul1(taba + i, tabb, nb, q); v = taba[i + nb]; a = v - r; c = (a > v); taba[i + nb] = a; if (c != 0) { /* negative result */ for(;;) { q--; c = js_mp_add(taba + i, taba + i, tabb, nb, 0); /* propagate carry and test if positive result */ if (c != 0) { if (++taba[i + nb] == 0) { break; } } } } tabq[i] = q; } } /* 1 <= shift <= JS_LIMB_BITS - 1 */ static js_limb_t js_mp_shl(js_limb_t *tabr, const js_limb_t *taba, int n, int shift) { int i; js_limb_t l, v; l = 0; for(i = 0; i < n; i++) { v = taba[i]; tabr[i] = (v << shift) | l; l = v >> (JS_LIMB_BITS - shift); } return l; } /* r = (a + high*B^n) >> shift. Return the remainder r (0 <= r < 2^shift). 1 <= shift <= LIMB_BITS - 1 */ static js_limb_t js_mp_shr(js_limb_t *tab_r, const js_limb_t *tab, int n, int shift, js_limb_t high) { int i; js_limb_t l, a; l = high; for(i = n - 1; i >= 0; i--) { a = tab[i]; tab_r[i] = (a >> shift) | (l << (JS_LIMB_BITS - shift)); l = a; } return l & (((js_limb_t)1 << shift) - 1); } static JSBigInt *js_bigint_new(JSContext *ctx, int len) { JSBigInt *r; if (len > JS_BIGINT_MAX_SIZE) { JS_ThrowRangeError(ctx, "BigInt is too large to allocate"); return NULL; } r = js_malloc(ctx, sizeof(JSBigInt) + len * sizeof(js_limb_t)); if (!r) return NULL; r->header.ref_count = 1; r->len = len; return r; } static JSBigInt *js_bigint_set_si(JSBigIntBuf *buf, js_slimb_t a) { JSBigInt *r = (JSBigInt *)buf->big_int_buf; r->header.ref_count = 0; /* fail safe */ r->len = 1; r->tab[0] = a; return r; } static JSBigInt *js_bigint_set_si64(JSBigIntBuf *buf, int64_t a) { JSBigInt *r = (JSBigInt *)buf->big_int_buf; r->header.ref_count = 0; /* fail safe */ if (a >= INT32_MIN && a <= INT32_MAX) { r->len = 1; r->tab[0] = a; } else { r->len = 2; r->tab[0] = a; r->tab[1] = a >> JS_LIMB_BITS; } return r; } /* val must be a short big int */ static JSBigInt *js_bigint_set_short(JSBigIntBuf *buf, JSValueConst val) { return js_bigint_set_si(buf, JS_VALUE_GET_SHORT_BIG_INT(val)); } static __maybe_unused void js_bigint_dump1(JSContext *ctx, const char *str, const js_limb_t *tab, int len) { int i; printf("%s: ", str); for(i = len - 1; i >= 0; i--) { printf(" %08x", tab[i]); } printf("\n"); } static __maybe_unused void js_bigint_dump(JSContext *ctx, const char *str, const JSBigInt *p) { js_bigint_dump1(ctx, str, p->tab, p->len); } static JSBigInt *js_bigint_new_si(JSContext *ctx, js_slimb_t a) { JSBigInt *r; r = js_bigint_new(ctx, 1); if (!r) return NULL; r->tab[0] = a; return r; } static JSBigInt *js_bigint_new_si64(JSContext *ctx, int64_t a) { if (a >= INT32_MIN && a <= INT32_MAX) { return js_bigint_new_si(ctx, a); } else { JSBigInt *r; r = js_bigint_new(ctx, 2); if (!r) return NULL; r->tab[0] = a; r->tab[1] = a >> 32; return r; } } static JSBigInt *js_bigint_new_ui64(JSContext *ctx, uint64_t a) { if (a <= INT64_MAX) { return js_bigint_new_si64(ctx, a); } else { JSBigInt *r; r = js_bigint_new(ctx, (65 + JS_LIMB_BITS - 1) / JS_LIMB_BITS); if (!r) return NULL; r->tab[0] = a; r->tab[1] = a >> 32; r->tab[2] = 0; return r; } } static JSBigInt *js_bigint_new_di(JSContext *ctx, js_sdlimb_t a) { JSBigInt *r; if (a == (js_slimb_t)a) { r = js_bigint_new(ctx, 1); if (!r) return NULL; r->tab[0] = a; } else { r = js_bigint_new(ctx, 2); if (!r) return NULL; r->tab[0] = a; r->tab[1] = a >> JS_LIMB_BITS; } return r; } /* Remove redundant high order limbs. Warning: 'a' may be reallocated. Can never fail. */ static JSBigInt *js_bigint_normalize1(JSContext *ctx, JSBigInt *a, int l) { js_limb_t v; assert(a->header.ref_count == 1); while (l > 1) { v = a->tab[l - 1]; if ((v != 0 && v != -1) || (v & 1) != (a->tab[l - 2] >> (JS_LIMB_BITS - 1))) { break; } l--; } if (l != a->len) { JSBigInt *a1; /* realloc to reduce the size */ a->len = l; a1 = js_realloc(ctx, a, sizeof(JSBigInt) + l * sizeof(js_limb_t)); if (a1) a = a1; } return a; } static JSBigInt *js_bigint_normalize(JSContext *ctx, JSBigInt *a) { return js_bigint_normalize1(ctx, a, a->len); } /* return 0 or 1 depending on the sign */ static inline int js_bigint_sign(const JSBigInt *a) { return a->tab[a->len - 1] >> (JS_LIMB_BITS - 1); } static js_slimb_t js_bigint_get_si_sat(const JSBigInt *a) { if (a->len == 1) { return a->tab[0]; } else { if (js_bigint_sign(a)) return INT32_MIN; else return INT32_MAX; } } /* add the op1 limb */ static JSBigInt *js_bigint_extend(JSContext *ctx, JSBigInt *r, js_limb_t op1) { int n2 = r->len; if ((op1 != 0 && op1 != -1) || (op1 & 1) != r->tab[n2 - 1] >> (JS_LIMB_BITS - 1)) { JSBigInt *r1; r1 = js_realloc(ctx, r, sizeof(JSBigInt) + (n2 + 1) * sizeof(js_limb_t)); if (!r1) { js_free(ctx, r); return NULL; } r = r1; r->len = n2 + 1; r->tab[n2] = op1; } else { /* otherwise still need to normalize the result */ r = js_bigint_normalize(ctx, r); } return r; } /* return NULL in case of error. Compute a + b (b_neg = 0) or a - b (b_neg = 1) */ /* XXX: optimize */ static JSBigInt *js_bigint_add(JSContext *ctx, const JSBigInt *a, const JSBigInt *b, int b_neg) { JSBigInt *r; int n1, n2, i; js_limb_t carry, op1, op2, a_sign, b_sign; n2 = max_int(a->len, b->len); n1 = min_int(a->len, b->len); r = js_bigint_new(ctx, n2); if (!r) return NULL; /* XXX: optimize */ /* common part */ carry = b_neg; for(i = 0; i < n1; i++) { op1 = a->tab[i]; op2 = b->tab[i] ^ (-b_neg); ADDC(r->tab[i], carry, op1, op2, carry); } a_sign = -js_bigint_sign(a); b_sign = (-js_bigint_sign(b)) ^ (-b_neg); /* part with sign extension of one operand */ if (a->len > b->len) { for(i = n1; i < n2; i++) { op1 = a->tab[i]; ADDC(r->tab[i], carry, op1, b_sign, carry); } } else if (a->len < b->len) { for(i = n1; i < n2; i++) { op2 = b->tab[i] ^ (-b_neg); ADDC(r->tab[i], carry, a_sign, op2, carry); } } /* part with sign extension for both operands. Extend the result if necessary */ return js_bigint_extend(ctx, r, a_sign + b_sign + carry); } /* XXX: optimize */ static JSBigInt *js_bigint_neg(JSContext *ctx, const JSBigInt *a) { JSBigIntBuf buf; JSBigInt *b; b = js_bigint_set_si(&buf, 0); return js_bigint_add(ctx, b, a, 1); } static JSBigInt *js_bigint_mul(JSContext *ctx, const JSBigInt *a, const JSBigInt *b) { JSBigInt *r; r = js_bigint_new(ctx, a->len + b->len); if (!r) return NULL; js_mp_mul_basecase(r->tab, a->tab, a->len, b->tab, b->len); /* correct the result if negative operands (no overflow is possible) */ if (js_bigint_sign(a)) js_mp_sub(r->tab + a->len, r->tab + a->len, b->tab, b->len, 0); if (js_bigint_sign(b)) js_mp_sub(r->tab + b->len, r->tab + b->len, a->tab, a->len, 0); return js_bigint_normalize(ctx, r); } /* return the division or the remainder. 'b' must be != 0. return NULL in case of exception (division by zero or memory error) */ static JSBigInt *js_bigint_divrem(JSContext *ctx, const JSBigInt *a, const JSBigInt *b, bool is_rem) { JSBigInt *r, *q; js_limb_t *tabb, h; int na, nb, a_sign, b_sign, shift; if (b->len == 1 && b->tab[0] == 0) { JS_ThrowRangeError(ctx, "BigInt division by zero"); return NULL; } a_sign = js_bigint_sign(a); b_sign = js_bigint_sign(b); na = a->len; nb = b->len; r = js_bigint_new(ctx, na + 2); if (!r) return NULL; if (a_sign) { js_mp_neg(r->tab, a->tab, na); } else { memcpy(r->tab, a->tab, na * sizeof(a->tab[0])); } /* normalize */ while (na > 1 && r->tab[na - 1] == 0) na--; tabb = js_malloc(ctx, nb * sizeof(tabb[0])); if (!tabb) { js_free(ctx, r); return NULL; } if (b_sign) { js_mp_neg(tabb, b->tab, nb); } else { memcpy(tabb, b->tab, nb * sizeof(tabb[0])); } /* normalize */ while (nb > 1 && tabb[nb - 1] == 0) nb--; /* trivial case if 'a' is small */ if (na < nb) { js_free(ctx, r); js_free(ctx, tabb); if (is_rem) { /* r = a */ r = js_bigint_new(ctx, a->len); if (!r) return NULL; memcpy(r->tab, a->tab, a->len * sizeof(a->tab[0])); return r; } else { /* q = 0 */ return js_bigint_new_si(ctx, 0); } } /* normalize 'b' */ shift = js_limb_clz(tabb[nb - 1]); if (shift != 0) { js_mp_shl(tabb, tabb, nb, shift); h = js_mp_shl(r->tab, r->tab, na, shift); if (h != 0) r->tab[na++] = h; } q = js_bigint_new(ctx, na - nb + 2); /* one more limb for the sign */ if (!q) { js_free(ctx, r); js_free(ctx, tabb); return NULL; } // js_bigint_dump1(ctx, "a", r->tab, na); // js_bigint_dump1(ctx, "b", tabb, nb); js_mp_divnorm(q->tab, r->tab, na, tabb, nb); js_free(ctx, tabb); if (is_rem) { js_free(ctx, q); if (shift != 0) js_mp_shr(r->tab, r->tab, nb, shift, 0); r->tab[nb++] = 0; if (a_sign) js_mp_neg(r->tab, r->tab, nb); r = js_bigint_normalize1(ctx, r, nb); return r; } else { js_free(ctx, r); q->tab[na - nb + 1] = 0; if (a_sign ^ b_sign) { js_mp_neg(q->tab, q->tab, q->len); } q = js_bigint_normalize(ctx, q); return q; } } /* and, or, xor */ static JSBigInt *js_bigint_logic(JSContext *ctx, const JSBigInt *a, const JSBigInt *b, OPCodeEnum op) { JSBigInt *r; js_limb_t b_sign; int a_len, b_len, i; if (a->len < b->len) { const JSBigInt *tmp; tmp = a; a = b; b = tmp; } /* a_len >= b_len */ a_len = a->len; b_len = b->len; b_sign = -js_bigint_sign(b); r = js_bigint_new(ctx, a_len); if (!r) return NULL; switch(op) { case OP_or: for(i = 0; i < b_len; i++) { r->tab[i] = a->tab[i] | b->tab[i]; } for(i = b_len; i < a_len; i++) { r->tab[i] = a->tab[i] | b_sign; } break; case OP_and: for(i = 0; i < b_len; i++) { r->tab[i] = a->tab[i] & b->tab[i]; } for(i = b_len; i < a_len; i++) { r->tab[i] = a->tab[i] & b_sign; } break; case OP_xor: for(i = 0; i < b_len; i++) { r->tab[i] = a->tab[i] ^ b->tab[i]; } for(i = b_len; i < a_len; i++) { r->tab[i] = a->tab[i] ^ b_sign; } break; default: abort(); } return js_bigint_normalize(ctx, r); } static JSBigInt *js_bigint_not(JSContext *ctx, const JSBigInt *a) { JSBigInt *r; int i; r = js_bigint_new(ctx, a->len); if (!r) return NULL; for(i = 0; i < a->len; i++) { r->tab[i] = ~a->tab[i]; } /* no normalization is needed */ return r; } static JSBigInt *js_bigint_shl(JSContext *ctx, const JSBigInt *a, unsigned int shift1) { int d, i, shift; JSBigInt *r; js_limb_t l; if (a->len == 1 && a->tab[0] == 0) return js_bigint_new_si(ctx, 0); /* zero case */ d = shift1 / JS_LIMB_BITS; shift = shift1 % JS_LIMB_BITS; r = js_bigint_new(ctx, a->len + d); if (!r) return NULL; for(i = 0; i < d; i++) r->tab[i] = 0; if (shift == 0) { for(i = 0; i < a->len; i++) { r->tab[i + d] = a->tab[i]; } } else { l = js_mp_shl(r->tab + d, a->tab, a->len, shift); if (js_bigint_sign(a)) l |= (js_limb_t)(-1) << shift; r = js_bigint_extend(ctx, r, l); } return r; } static JSBigInt *js_bigint_shr(JSContext *ctx, const JSBigInt *a, unsigned int shift1) { int d, i, shift, a_sign, n1; JSBigInt *r; d = shift1 / JS_LIMB_BITS; shift = shift1 % JS_LIMB_BITS; a_sign = js_bigint_sign(a); if (d >= a->len) return js_bigint_new_si(ctx, -a_sign); n1 = a->len - d; r = js_bigint_new(ctx, n1); if (!r) return NULL; if (shift == 0) { for(i = 0; i < n1; i++) { r->tab[i] = a->tab[i + d]; } /* no normalization is needed */ } else { js_mp_shr(r->tab, a->tab + d, n1, shift, -a_sign); r = js_bigint_normalize(ctx, r); } return r; } static JSBigInt *js_bigint_pow(JSContext *ctx, const JSBigInt *a, JSBigInt *b) { uint32_t e; int n_bits, i; JSBigInt *r, *r1; /* b must be >= 0 */ if (js_bigint_sign(b)) { JS_ThrowRangeError(ctx, "BigInt negative exponent"); return NULL; } if (b->len == 1 && b->tab[0] == 0) { /* a^0 = 1 */ return js_bigint_new_si(ctx, 1); } else if (a->len == 1) { js_limb_t v; bool is_neg; v = a->tab[0]; if (v <= 1) return js_bigint_new_si(ctx, v); else if (v == -1) return js_bigint_new_si(ctx, 1 - 2 * (b->tab[0] & 1)); is_neg = (js_slimb_t)v < 0; if (is_neg) v = -v; if ((v & (v - 1)) == 0) { uint64_t e1; int n; /* v = 2^n */ n = JS_LIMB_BITS - 1 - js_limb_clz(v); if (b->len > 1) goto overflow; if (b->tab[0] > INT32_MAX) goto overflow; e = b->tab[0]; e1 = (uint64_t)e * n; if (e1 > JS_BIGINT_MAX_SIZE * JS_LIMB_BITS) goto overflow; e = e1; if (is_neg) is_neg = b->tab[0] & 1; r = js_bigint_new(ctx, (e + JS_LIMB_BITS + 1 - is_neg) / JS_LIMB_BITS); if (!r) return NULL; memset(r->tab, 0, sizeof(r->tab[0]) * r->len); r->tab[e / JS_LIMB_BITS] = (js_limb_t)(1 - 2 * is_neg) << (e % JS_LIMB_BITS); return r; } } if (b->len > 1) goto overflow; if (b->tab[0] > INT32_MAX) goto overflow; e = b->tab[0]; n_bits = 32 - clz32(e); r = js_bigint_new(ctx, a->len); if (!r) return NULL; memcpy(r->tab, a->tab, a->len * sizeof(a->tab[0])); for(i = n_bits - 2; i >= 0; i--) { r1 = js_bigint_mul(ctx, r, r); if (!r1) return NULL; js_free(ctx, r); r = r1; if ((e >> i) & 1) { r1 = js_bigint_mul(ctx, r, a); if (!r1) return NULL; js_free(ctx, r); r = r1; } } return r; overflow: JS_ThrowRangeError(ctx, "BigInt is too large"); return NULL; } /* return (mant, exp) so that abs(a) ~ mant*2^(exp - (limb_bits - 1). a must be != 0. */ static uint64_t js_bigint_get_mant_exp(JSContext *ctx, int *pexp, const JSBigInt *a) { js_limb_t t[4 - JS_LIMB_BITS / 32], carry, v, low_bits; int n1, n2, sgn, shift, i, j, e; uint64_t a1, a0; n2 = 4 - JS_LIMB_BITS / 32; n1 = a->len - n2; sgn = js_bigint_sign(a); /* low_bits != 0 if there are a non zero low bit in abs(a) */ low_bits = 0; carry = sgn; for(i = 0; i < n1; i++) { v = (a->tab[i] ^ (-sgn)) + carry; carry = v < carry; low_bits |= v; } /* get the n2 high limbs of abs(a) */ for(j = 0; j < n2; j++) { i = j + n1; if (i < 0) { v = 0; } else { v = (a->tab[i] ^ (-sgn)) + carry; carry = v < carry; } t[j] = v; } a1 = ((uint64_t)t[2] << 32) | t[1]; a0 = (uint64_t)t[0] << 32; a0 |= (low_bits != 0); /* normalize */ { shift = clz64(a1); if (shift != 0) { a1 = (a1 << shift) | (a0 >> (64 - shift)); a0 <<= shift; } } a1 |= (a0 != 0); /* keep the bits for the final rounding */ /* compute the exponent */ e = a->len * JS_LIMB_BITS - shift - 1; *pexp = e; return a1; } /* shift left with round to nearest, ties to even. n >= 1 */ static uint64_t shr_rndn(uint64_t a, int n) { uint64_t addend = ((a >> n) & 1) + ((1 << (n - 1)) - 1); return (a + addend) >> n; } /* convert to float64 with round to nearest, ties to even. Return +/-infinity if too large. */ static double js_bigint_to_float64(JSContext *ctx, const JSBigInt *a) { int sgn, e; uint64_t mant; if (a->len == 1) { /* fast case, including zero */ return (double)(js_slimb_t)a->tab[0]; } sgn = js_bigint_sign(a); mant = js_bigint_get_mant_exp(ctx, &e, a); if (e > 1023) { /* overflow: return infinity */ mant = 0; e = 1024; } else { mant = (mant >> 1) | (mant & 1); /* avoid overflow in rounding */ mant = shr_rndn(mant, 10); /* rounding can cause an overflow */ if (mant >= ((uint64_t)1 << 53)) { mant >>= 1; e++; } mant &= (((uint64_t)1 << 52) - 1); } return uint64_as_float64(((uint64_t)sgn << 63) | ((uint64_t)(e + 1023) << 52) | mant); } /* return (1, NULL) if not an integer, (2, NULL) if NaN or Infinity, (0, n) if an integer, (0, NULL) in case of memory error */ static JSBigInt *js_bigint_from_float64(JSContext *ctx, int *pres, double a1) { uint64_t a = float64_as_uint64(a1); int sgn, e, shift; uint64_t mant; JSBigIntBuf buf; JSBigInt *r; sgn = a >> 63; e = (a >> 52) & ((1 << 11) - 1); mant = a & (((uint64_t)1 << 52) - 1); if (e == 2047) { /* NaN, Infinity */ *pres = 2; return NULL; } if (e == 0 && mant == 0) { /* zero */ *pres = 0; return js_bigint_new_si(ctx, 0); } e -= 1023; /* 0 < a < 1 : not an integer */ if (e < 0) goto not_an_integer; mant |= (uint64_t)1 << 52; if (e < 52) { shift = 52 - e; /* check that there is no fractional part */ if (mant & (((uint64_t)1 << shift) - 1)) { not_an_integer: *pres = 1; return NULL; } mant >>= shift; e = 0; } else { e -= 52; } if (sgn) mant = -mant; /* the integer is mant*2^e */ r = js_bigint_set_si64(&buf, (int64_t)mant); *pres = 0; return js_bigint_shl(ctx, r, e); } /* return -1, 0, 1 or (2) (unordered) */ static int js_bigint_float64_cmp(JSContext *ctx, const JSBigInt *a, double b) { int b_sign, a_sign, e, f; uint64_t mant, b1, a_mant; b1 = float64_as_uint64(b); b_sign = b1 >> 63; e = (b1 >> 52) & ((1 << 11) - 1); mant = b1 & (((uint64_t)1 << 52) - 1); a_sign = js_bigint_sign(a); if (e == 2047) { if (mant != 0) { /* NaN */ return 2; } else { /* +/- infinity */ return 2 * b_sign - 1; } } else if (e == 0 && mant == 0) { /* b = +/-0 */ if (a->len == 1 && a->tab[0] == 0) return 0; else return 1 - 2 * a_sign; } else if (a->len == 1 && a->tab[0] == 0) { /* a = 0, b != 0 */ return 2 * b_sign - 1; } else if (a_sign != b_sign) { return 1 - 2 * a_sign; } else { e -= 1023; /* Note: handling denormals is not necessary because we compare to integers hence f >= 0 */ /* compute f so that 2^f <= abs(a) < 2^(f+1) */ a_mant = js_bigint_get_mant_exp(ctx, &f, a); if (f != e) { if (f < e) return -1; else return 1; } else { mant = (mant | ((uint64_t)1 << 52)) << 11; /* align to a_mant */ if (a_mant < mant) return 2 * a_sign - 1; else if (a_mant > mant) return 1 - 2 * a_sign; else return 0; } } } /* return -1, 0 or 1 */ static int js_bigint_cmp(JSContext *ctx, const JSBigInt *a, const JSBigInt *b) { int a_sign, b_sign, res, i; a_sign = js_bigint_sign(a); b_sign = js_bigint_sign(b); if (a_sign != b_sign) { res = 1 - 2 * a_sign; } else { /* we assume the numbers are normalized */ if (a->len != b->len) { if (a->len < b->len) res = 2 * a_sign - 1; else res = 1 - 2 * a_sign; } else { res = 0; for(i = a->len -1; i >= 0; i--) { if (a->tab[i] != b->tab[i]) { if (a->tab[i] < b->tab[i]) res = -1; else res = 1; break; } } } } return res; } /* contains 10^i */ static const js_limb_t js_pow_dec[JS_LIMB_DIGITS + 1] = { 1U, 10U, 100U, 1000U, 10000U, 100000U, 1000000U, 10000000U, 100000000U, 1000000000U, }; /* syntax: [-]digits in base radix. Return NULL if memory error. radix = 10, 2, 8 or 16. */ static JSBigInt *js_bigint_from_string(JSContext *ctx, const char *str, int radix) { const char *p = str; size_t n_digits1; int is_neg, n_digits, n_limbs, len, log2_radix, n_bits, i; JSBigInt *r; js_limb_t v, c, h; is_neg = 0; if (*p == '-') { is_neg = 1; p++; } while (*p == '0') p++; n_digits1 = strlen(p); /* the real check for overflox is done js_bigint_new(). Here we just avoid integer overflow */ if (n_digits1 > JS_BIGINT_MAX_SIZE * JS_LIMB_BITS) { JS_ThrowRangeError(ctx, "BigInt is too large to allocate"); return NULL; } n_digits = n_digits1; log2_radix = 32 - clz32(radix - 1); /* ceil(log2(radix)) */ /* compute the maximum number of limbs */ if (radix == 10) { n_bits = (n_digits * 27 + 7) / 8; /* >= ceil(n_digits * log2(10)) */ } else { n_bits = n_digits * log2_radix; } /* we add one extra bit for the sign */ n_limbs = max_int(1, n_bits / JS_LIMB_BITS + 1); r = js_bigint_new(ctx, n_limbs); if (!r) return NULL; if (radix == 10) { int digits_per_limb = JS_LIMB_DIGITS; len = 1; r->tab[0] = 0; for(;;) { /* XXX: slow */ v = 0; for(i = 0; i < digits_per_limb; i++) { c = js_to_digit(*p); if (c >= radix) break; p++; v = v * 10 + c; } if (i == 0) break; if (len == 1 && r->tab[0] == 0) { r->tab[0] = v; } else { h = js_mp_mul1(r->tab, r->tab, len, js_pow_dec[i], v); if (h != 0) { r->tab[len++] = h; } } } /* add one extra limb to have the correct sign*/ if ((r->tab[len - 1] >> (JS_LIMB_BITS - 1)) != 0) r->tab[len++] = 0; r->len = len; } else { unsigned int bit_pos, shift, pos; /* power of two base: no multiplication is needed */ r->len = n_limbs; memset(r->tab, 0, sizeof(r->tab[0]) * n_limbs); for(i = 0; i < n_digits; i++) { c = js_to_digit(p[n_digits - 1 - i]); assert(c < radix); bit_pos = i * log2_radix; shift = bit_pos & (JS_LIMB_BITS - 1); pos = bit_pos / JS_LIMB_BITS; r->tab[pos] |= c << shift; /* if log2_radix does not divide JS_LIMB_BITS, needed an additional op */ if (shift + log2_radix > JS_LIMB_BITS) { r->tab[pos + 1] |= c >> (JS_LIMB_BITS - shift); } } } r = js_bigint_normalize(ctx, r); /* XXX: could do it in place */ if (is_neg) { JSBigInt *r1; r1 = js_bigint_neg(ctx, r); js_free(ctx, r); r = r1; } return r; } /* 2 <= base <= 36 */ static char const digits[36] = { '0','1','2','3','4','5','6','7','8','9', 'a','b','c','d','e','f','g','h','i','j', 'k','l','m','n','o','p','q','r','s','t', 'u','v','w','x','y','z' }; /* special version going backwards */ /* XXX: use dtoa.c */ static char *js_u64toa(char *q, int64_t n, unsigned int base) { int digit; if (base == 10) { /* division by known base uses multiplication */ do { digit = (uint64_t)n % 10; n = (uint64_t)n / 10; *--q = '0' + digit; } while (n != 0); } else { do { digit = (uint64_t)n % base; n = (uint64_t)n / base; *--q = digits[digit]; } while (n != 0); } return q; } /* len >= 1. 2 <= radix <= 36 */ static char *js_limb_to_a(char *q, js_limb_t n, unsigned int radix, int len) { int digit, i; if (radix == 10) { /* specific case with constant divisor */ /* XXX: optimize */ for(i = 0; i < len; i++) { digit = (js_limb_t)n % 10; n = (js_limb_t)n / 10; *--q = digit + '0'; } } else { for(i = 0; i < len; i++) { digit = (js_limb_t)n % radix; n = (js_limb_t)n / radix; *--q = digits[digit]; } } return q; } #define JS_RADIX_MAX 36 static const uint8_t js_digits_per_limb_table[JS_RADIX_MAX - 1] = { 32,20,16,13,12,11,10,10, 9, 9, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, }; static const js_limb_t js_radix_base_table[JS_RADIX_MAX - 1] = { 0x00000000, 0xcfd41b91, 0x00000000, 0x48c27395, 0x81bf1000, 0x75db9c97, 0x40000000, 0xcfd41b91, 0x3b9aca00, 0x8c8b6d2b, 0x19a10000, 0x309f1021, 0x57f6c100, 0x98c29b81, 0x00000000, 0x18754571, 0x247dbc80, 0x3547667b, 0x4c4b4000, 0x6b5a6e1d, 0x94ace180, 0xcaf18367, 0x0b640000, 0x0e8d4a51, 0x1269ae40, 0x17179149, 0x1cb91000, 0x23744899, 0x2b73a840, 0x34e63b41, 0x40000000, 0x4cfa3cc1, 0x5c13d840, 0x6d91b519, 0x81bf1000, }; static JSValue js_bigint_to_string1(JSContext *ctx, JSValueConst val, int radix) { if (JS_VALUE_GET_TAG(val) == JS_TAG_SHORT_BIG_INT) { char buf[66]; int len; len = i64toa_radix(buf, JS_VALUE_GET_SHORT_BIG_INT(val), radix); return js_new_string8_len(ctx, buf, len); } else { JSBigInt *r, *tmp = NULL; char *buf, *q, *buf_end; int is_neg, n_bits, log2_radix, n_digits; bool is_binary_radix; JSValue res; assert(JS_VALUE_GET_TAG(val) == JS_TAG_BIG_INT); r = JS_VALUE_GET_PTR(val); if (r->len == 1 && r->tab[0] == 0) { /* '0' case */ return js_new_string8_len(ctx, "0", 1); } is_binary_radix = ((radix & (radix - 1)) == 0); is_neg = js_bigint_sign(r); if (is_neg) { tmp = js_bigint_neg(ctx, r); if (!tmp) return JS_EXCEPTION; r = tmp; } else if (!is_binary_radix) { /* need to modify 'r' */ tmp = js_bigint_new(ctx, r->len); if (!tmp) return JS_EXCEPTION; memcpy(tmp->tab, r->tab, r->len * sizeof(r->tab[0])); r = tmp; } log2_radix = 31 - clz32(radix); /* floor(log2(radix)) */ n_bits = r->len * JS_LIMB_BITS - js_limb_clz(r->tab[r->len - 1]); /* n_digits is exact only if radix is a power of two. Otherwise it is >= the exact number of digits */ n_digits = (n_bits + log2_radix - 1) / log2_radix; /* XXX: could directly build the JSString */ buf = js_malloc(ctx, n_digits + is_neg + 1); if (!buf) { js_free(ctx, tmp); return JS_EXCEPTION; } q = buf + n_digits + is_neg + 1; *--q = '\0'; buf_end = q; if (!is_binary_radix) { int len; js_limb_t radix_base, v; radix_base = js_radix_base_table[radix - 2]; len = r->len; for(;;) { /* remove leading zero limbs */ while (len > 1 && r->tab[len - 1] == 0) len--; if (len == 1 && r->tab[0] < radix_base) { v = r->tab[0]; if (v != 0) { q = js_u64toa(q, v, radix); } break; } else { v = js_mp_div1(r->tab, r->tab, len, radix_base, 0); q = js_limb_to_a(q, v, radix, js_digits_per_limb_table[radix - 2]); } } } else { int i, shift; unsigned int bit_pos, pos, c; /* radix is a power of two */ for(i = 0; i < n_digits; i++) { bit_pos = i * log2_radix; pos = bit_pos / JS_LIMB_BITS; shift = bit_pos % JS_LIMB_BITS; c = r->tab[pos] >> shift; if ((shift + log2_radix) > JS_LIMB_BITS && (pos + 1) < r->len) { c |= r->tab[pos + 1] << (JS_LIMB_BITS - shift); } c &= (radix - 1); *--q = digits[c]; } } if (is_neg) *--q = '-'; js_free(ctx, tmp); res = js_new_string8_len(ctx, q, buf_end - q); js_free(ctx, buf); return res; } } /* if possible transform a BigInt to short big and free it, otherwise return a normal bigint */ static JSValue JS_CompactBigInt(JSContext *ctx, JSBigInt *p) { JSValue res; if (p->len == 1) { res = __JS_NewShortBigInt(ctx, (js_slimb_t)p->tab[0]); js_free(ctx, p); return res; } else { return JS_MKPTR(JS_TAG_BIG_INT, p); } } #define ATOD_INT_ONLY (1 << 0) /* accept Oo and Ob prefixes in addition to 0x prefix if radix = 0 */ #define ATOD_ACCEPT_BIN_OCT (1 << 2) /* accept O prefix as octal if radix == 0 and properly formed (Annex B) */ #define ATOD_ACCEPT_LEGACY_OCTAL (1 << 4) /* accept _ between digits as a digit separator */ #define ATOD_ACCEPT_UNDERSCORES (1 << 5) /* allow a suffix to override the type */ #define ATOD_ACCEPT_SUFFIX (1 << 6) /* default type */ #define ATOD_TYPE_MASK (3 << 7) #define ATOD_TYPE_FLOAT64 (0 << 7) #define ATOD_TYPE_BIG_INT (1 << 7) /* accept -0x1 */ #define ATOD_ACCEPT_PREFIX_AFTER_SIGN (1 << 10) /* return an exception in case of memory error. Return JS_NAN if invalid syntax */ /* XXX: directly use js_atod() */ static JSValue js_atof(JSContext *ctx, const char *str, const char **pp, int radix, int flags) { const char *p, *p_start; int sep, is_neg; bool is_float, has_legacy_octal; int atod_type = flags & ATOD_TYPE_MASK; char buf1[64], *buf; int i, j, len; bool buf_allocated = false; JSValue val; JSATODTempMem atod_mem; /* optional separator between digits */ sep = (flags & ATOD_ACCEPT_UNDERSCORES) ? '_' : 256; has_legacy_octal = false; p = str; p_start = p; is_neg = 0; if (p[0] == '+') { p++; p_start++; if (!(flags & ATOD_ACCEPT_PREFIX_AFTER_SIGN)) goto no_radix_prefix; } else if (p[0] == '-') { p++; p_start++; is_neg = 1; if (!(flags & ATOD_ACCEPT_PREFIX_AFTER_SIGN)) goto no_radix_prefix; } if (p[0] == '0') { if ((p[1] == 'x' || p[1] == 'X') && (radix == 0 || radix == 16)) { p += 2; radix = 16; } else if ((p[1] == 'o' || p[1] == 'O') && radix == 0 && (flags & ATOD_ACCEPT_BIN_OCT)) { p += 2; radix = 8; } else if ((p[1] == 'b' || p[1] == 'B') && radix == 0 && (flags & ATOD_ACCEPT_BIN_OCT)) { p += 2; radix = 2; } else if ((p[1] >= '0' && p[1] <= '9') && radix == 0 && (flags & ATOD_ACCEPT_LEGACY_OCTAL)) { int i; has_legacy_octal = true; sep = 256; for (i = 1; (p[i] >= '0' && p[i] <= '7'); i++) continue; if (p[i] == '8' || p[i] == '9') goto no_prefix; p += 1; radix = 8; } else { goto no_prefix; } /* there must be a digit after the prefix */ if (js_to_digit((uint8_t)*p) >= radix) goto fail; no_prefix: ; } else { no_radix_prefix: if (!(flags & ATOD_INT_ONLY) && (atod_type == ATOD_TYPE_FLOAT64) && js__strstart(p, "Infinity", &p)) { double d = INF; if (is_neg) d = -d; val = js_float64(d); goto done; } } if (radix == 0) radix = 10; is_float = false; p_start = p; while (js_to_digit((uint8_t)*p) < radix || (*p == sep && (radix != 10 || p != p_start + 1 || p[-1] != '0') && js_to_digit((uint8_t)p[1]) < radix)) { p++; } if (!(flags & ATOD_INT_ONLY) && radix == 10) { if (*p == '.' && (p > p_start || js_to_digit((uint8_t)p[1]) < radix)) { is_float = true; p++; if (*p == sep) goto fail; while (js_to_digit((uint8_t)*p) < radix || (*p == sep && js_to_digit((uint8_t)p[1]) < radix)) p++; } if (p > p_start && (*p == 'e' || *p == 'E')) { const char *p1 = p + 1; is_float = true; if (*p1 == '+') { p1++; } else if (*p1 == '-') { p1++; } if (is_digit((uint8_t)*p1)) { p = p1 + 1; while (is_digit((uint8_t)*p) || (*p == sep && is_digit((uint8_t)p[1]))) p++; } } } if (p == p_start) goto fail; buf = buf1; buf_allocated = false; len = p - p_start; if (unlikely((len + 2) > sizeof(buf1))) { buf = js_malloc_rt(ctx->rt, len + 2); /* no exception raised */ if (!buf) goto mem_error; buf_allocated = true; } /* remove the separators and the radix prefixes */ j = 0; if (is_neg) buf[j++] = '-'; for (i = 0; i < len; i++) { if (p_start[i] != '_') buf[j++] = p_start[i]; } buf[j] = '\0'; if (flags & ATOD_ACCEPT_SUFFIX) { if (*p == 'n') { p++; atod_type = ATOD_TYPE_BIG_INT; } } switch(atod_type) { case ATOD_TYPE_FLOAT64: { double d; d = js_atod(buf, NULL, radix, is_float ? 0 : JS_ATOD_INT_ONLY, &atod_mem); /* return int or float64 */ val = js_number(d); } break; case ATOD_TYPE_BIG_INT: { JSBigInt *r; if (has_legacy_octal || is_float) goto fail; r = js_bigint_from_string(ctx, buf, radix); if (!r) { val = JS_EXCEPTION; goto done; } val = JS_CompactBigInt(ctx, r); } break; default: abort(); } done: if (buf_allocated) js_free_rt(ctx->rt, buf); if (pp) *pp = p; return val; fail: val = JS_NAN; goto done; mem_error: val = JS_ThrowOutOfMemory(ctx); goto done; } typedef enum JSToNumberHintEnum { TON_FLAG_NUMBER, TON_FLAG_NUMERIC, } JSToNumberHintEnum; static JSValue JS_ToNumberHintFree(JSContext *ctx, JSValue val, JSToNumberHintEnum flag) { uint32_t tag; JSValue ret; redo: tag = JS_VALUE_GET_NORM_TAG(val); switch(tag) { case JS_TAG_BIG_INT: case JS_TAG_SHORT_BIG_INT: if (flag != TON_FLAG_NUMERIC) { JS_FreeValue(ctx, val); return JS_ThrowTypeError(ctx, "cannot convert BigInt to number"); } ret = val; break; case JS_TAG_FLOAT64: case JS_TAG_INT: case JS_TAG_EXCEPTION: ret = val; break; case JS_TAG_BOOL: case JS_TAG_NULL: ret = js_int32(JS_VALUE_GET_INT(val)); break; case JS_TAG_UNDEFINED: ret = JS_NAN; break; case JS_TAG_OBJECT: val = JS_ToPrimitiveFree(ctx, val, HINT_NUMBER); if (JS_IsException(val)) return JS_EXCEPTION; goto redo; case JS_TAG_STRING: { const char *str; const char *p; size_t len; str = JS_ToCStringLen(ctx, &len, val); JS_FreeValue(ctx, val); if (!str) return JS_EXCEPTION; p = str; p += skip_spaces(p); if ((p - str) == len) { ret = JS_NewInt32(ctx, 0); } else { int flags = ATOD_ACCEPT_BIN_OCT; ret = js_atof(ctx, p, &p, 0, flags); if (!JS_IsException(ret)) { p += skip_spaces(p); if ((p - str) != len) { JS_FreeValue(ctx, ret); ret = JS_NAN; } } } JS_FreeCString(ctx, str); } break; case JS_TAG_SYMBOL: JS_FreeValue(ctx, val); return JS_ThrowTypeError(ctx, "cannot convert symbol to number"); default: JS_FreeValue(ctx, val); ret = JS_NAN; break; } return ret; } static JSValue JS_ToNumberFree(JSContext *ctx, JSValue val) { return JS_ToNumberHintFree(ctx, val, TON_FLAG_NUMBER); } static JSValue JS_ToNumericFree(JSContext *ctx, JSValue val) { return JS_ToNumberHintFree(ctx, val, TON_FLAG_NUMERIC); } static JSValue JS_ToNumeric(JSContext *ctx, JSValueConst val) { return JS_ToNumericFree(ctx, js_dup(val)); } static __exception int __JS_ToFloat64Free(JSContext *ctx, double *pres, JSValue val) { double d; uint32_t tag; val = JS_ToNumberFree(ctx, val); if (JS_IsException(val)) goto fail; tag = JS_VALUE_GET_NORM_TAG(val); switch(tag) { case JS_TAG_INT: d = JS_VALUE_GET_INT(val); break; case JS_TAG_FLOAT64: d = JS_VALUE_GET_FLOAT64(val); break; default: abort(); } *pres = d; return 0; fail: *pres = NAN; return -1; } static inline int JS_ToFloat64Free(JSContext *ctx, double *pres, JSValue val) { uint32_t tag; tag = JS_VALUE_GET_TAG(val); if (tag <= JS_TAG_NULL) { *pres = JS_VALUE_GET_INT(val); return 0; } else if (JS_TAG_IS_FLOAT64(tag)) { *pres = JS_VALUE_GET_FLOAT64(val); return 0; } else { return __JS_ToFloat64Free(ctx, pres, val); } } int JS_ToFloat64(JSContext *ctx, double *pres, JSValueConst val) { return JS_ToFloat64Free(ctx, pres, js_dup(val)); } JSValue JS_ToNumber(JSContext *ctx, JSValueConst val) { return JS_ToNumberFree(ctx, js_dup(val)); } /* same as JS_ToNumber() but return 0 in case of NaN/Undefined */ static __maybe_unused JSValue JS_ToIntegerFree(JSContext *ctx, JSValue val) { uint32_t tag; JSValue ret; redo: tag = JS_VALUE_GET_NORM_TAG(val); switch(tag) { case JS_TAG_INT: case JS_TAG_BOOL: case JS_TAG_NULL: case JS_TAG_UNDEFINED: ret = js_int32(JS_VALUE_GET_INT(val)); break; case JS_TAG_FLOAT64: { double d = JS_VALUE_GET_FLOAT64(val); if (isnan(d)) { ret = js_int32(0); } else { /* convert -0 to +0 */ d = trunc(d) + 0.0; ret = js_number(d); } } break; default: val = JS_ToNumberFree(ctx, val); if (JS_IsException(val)) return val; goto redo; } return ret; } /* Note: the integer value is satured to 32 bits */ static int JS_ToInt32SatFree(JSContext *ctx, int *pres, JSValue val) { uint32_t tag; int ret; redo: tag = JS_VALUE_GET_NORM_TAG(val); switch(tag) { case JS_TAG_INT: case JS_TAG_BOOL: case JS_TAG_NULL: case JS_TAG_UNDEFINED: ret = JS_VALUE_GET_INT(val); break; case JS_TAG_EXCEPTION: *pres = 0; return -1; case JS_TAG_FLOAT64: { double d = JS_VALUE_GET_FLOAT64(val); if (isnan(d)) { ret = 0; } else { if (d < INT32_MIN) ret = INT32_MIN; else if (d > INT32_MAX) ret = INT32_MAX; else ret = (int)d; } } break; default: val = JS_ToNumberFree(ctx, val); if (JS_IsException(val)) { *pres = 0; return -1; } goto redo; } *pres = ret; return 0; } static int JS_ToInt32Sat(JSContext *ctx, int *pres, JSValueConst val) { return JS_ToInt32SatFree(ctx, pres, js_dup(val)); } static int JS_ToInt32Clamp(JSContext *ctx, int *pres, JSValueConst val, int min, int max, int min_offset) { int res = JS_ToInt32SatFree(ctx, pres, js_dup(val)); if (res == 0) { if (*pres < min) { *pres += min_offset; if (*pres < min) *pres = min; } else { if (*pres > max) *pres = max; } } return res; } static int JS_ToInt64SatFree(JSContext *ctx, int64_t *pres, JSValue val) { uint32_t tag; redo: tag = JS_VALUE_GET_NORM_TAG(val); switch(tag) { case JS_TAG_INT: case JS_TAG_BOOL: case JS_TAG_NULL: case JS_TAG_UNDEFINED: *pres = JS_VALUE_GET_INT(val); return 0; case JS_TAG_EXCEPTION: *pres = 0; return -1; case JS_TAG_FLOAT64: { double d = JS_VALUE_GET_FLOAT64(val); if (isnan(d)) { *pres = 0; } else { if (d < INT64_MIN) *pres = INT64_MIN; else if (d >= 0x1p63) *pres = INT64_MAX; else *pres = (int64_t)d; } } return 0; default: val = JS_ToNumberFree(ctx, val); if (JS_IsException(val)) { *pres = 0; return -1; } goto redo; } } int JS_ToInt64Sat(JSContext *ctx, int64_t *pres, JSValueConst val) { return JS_ToInt64SatFree(ctx, pres, js_dup(val)); } int JS_ToInt64Clamp(JSContext *ctx, int64_t *pres, JSValueConst val, int64_t min, int64_t max, int64_t neg_offset) { int res = JS_ToInt64SatFree(ctx, pres, js_dup(val)); if (res == 0) { if (*pres < 0) *pres += neg_offset; if (*pres < min) *pres = min; else if (*pres > max) *pres = max; } return res; } /* Same as JS_ToInt32Free() but with a 64 bit result. Return (<0, 0) in case of exception */ static int JS_ToInt64Free(JSContext *ctx, int64_t *pres, JSValue val) { uint32_t tag; int64_t ret; redo: tag = JS_VALUE_GET_NORM_TAG(val); switch(tag) { case JS_TAG_INT: case JS_TAG_BOOL: case JS_TAG_NULL: case JS_TAG_UNDEFINED: ret = JS_VALUE_GET_INT(val); break; case JS_TAG_FLOAT64: { JSFloat64Union u; double d; int e; d = JS_VALUE_GET_FLOAT64(val); u.d = d; /* we avoid doing fmod(x, 2^64) */ e = (u.u64 >> 52) & 0x7ff; if (likely(e <= (1023 + 62))) { /* fast case */ ret = (int64_t)d; } else if (e <= (1023 + 62 + 53)) { uint64_t v; /* remainder modulo 2^64 */ v = (u.u64 & (((uint64_t)1 << 52) - 1)) | ((uint64_t)1 << 52); ret = v << ((e - 1023) - 52); /* take the sign into account */ if (u.u64 >> 63) if (ret != INT64_MIN) ret = -ret; } else { ret = 0; /* also handles NaN and +inf */ } } break; default: val = JS_ToNumberFree(ctx, val); if (JS_IsException(val)) { *pres = 0; return -1; } goto redo; } *pres = ret; return 0; } int JS_ToInt64(JSContext *ctx, int64_t *pres, JSValueConst val) { return JS_ToInt64Free(ctx, pres, js_dup(val)); } int JS_ToInt64Ext(JSContext *ctx, int64_t *pres, JSValueConst val) { if (JS_IsBigInt(val)) return JS_ToBigInt64(ctx, pres, val); else return JS_ToInt64(ctx, pres, val); } /* return (<0, 0) in case of exception */ static int JS_ToInt32Free(JSContext *ctx, int32_t *pres, JSValue val) { uint32_t tag; int32_t ret; redo: tag = JS_VALUE_GET_NORM_TAG(val); switch(tag) { case JS_TAG_INT: case JS_TAG_BOOL: case JS_TAG_NULL: case JS_TAG_UNDEFINED: ret = JS_VALUE_GET_INT(val); break; case JS_TAG_FLOAT64: { JSFloat64Union u; double d; int e; d = JS_VALUE_GET_FLOAT64(val); u.d = d; /* we avoid doing fmod(x, 2^32) */ e = (u.u64 >> 52) & 0x7ff; if (likely(e <= (1023 + 30))) { /* fast case */ ret = (int32_t)d; } else if (e <= (1023 + 30 + 53)) { uint64_t v; /* remainder modulo 2^32 */ v = (u.u64 & (((uint64_t)1 << 52) - 1)) | ((uint64_t)1 << 52); v = v << ((e - 1023) - 52 + 32); ret = v >> 32; /* take the sign into account */ if (u.u64 >> 63) if (ret != INT32_MIN) ret = -ret; } else { ret = 0; /* also handles NaN and +inf */ } } break; default: val = JS_ToNumberFree(ctx, val); if (JS_IsException(val)) { *pres = 0; return -1; } goto redo; } *pres = ret; return 0; } int JS_ToInt32(JSContext *ctx, int32_t *pres, JSValueConst val) { return JS_ToInt32Free(ctx, pres, js_dup(val)); } static inline int JS_ToUint32Free(JSContext *ctx, uint32_t *pres, JSValue val) { return JS_ToInt32Free(ctx, (int32_t *)pres, val); } static int JS_ToUint8ClampFree(JSContext *ctx, int32_t *pres, JSValue val) { uint32_t tag; int res; redo: tag = JS_VALUE_GET_NORM_TAG(val); switch(tag) { case JS_TAG_INT: case JS_TAG_BOOL: case JS_TAG_NULL: case JS_TAG_UNDEFINED: res = JS_VALUE_GET_INT(val); res = max_int(0, min_int(255, res)); break; case JS_TAG_FLOAT64: { double d = JS_VALUE_GET_FLOAT64(val); if (isnan(d)) { res = 0; } else { if (d < 0) res = 0; else if (d > 255) res = 255; else res = lrint(d); } } break; default: val = JS_ToNumberFree(ctx, val); if (JS_IsException(val)) { *pres = 0; return -1; } goto redo; } *pres = res; return 0; } static __exception int JS_ToArrayLengthFree(JSContext *ctx, uint32_t *plen, JSValue val, bool is_array_ctor) { uint32_t tag, len; tag = JS_VALUE_GET_TAG(val); switch(tag) { case JS_TAG_INT: case JS_TAG_BOOL: case JS_TAG_NULL: { int v; v = JS_VALUE_GET_INT(val); if (v < 0) goto fail; len = v; } break; default: if (JS_TAG_IS_FLOAT64(tag)) { double d; d = JS_VALUE_GET_FLOAT64(val); if (!(d >= 0 && d <= UINT32_MAX)) goto fail; len = (uint32_t)d; if (len != d) goto fail; } else { uint32_t len1; if (is_array_ctor) { val = JS_ToNumberFree(ctx, val); if (JS_IsException(val)) return -1; /* cannot recurse because val is a number */ if (JS_ToArrayLengthFree(ctx, &len, val, true)) return -1; } else { /* legacy behavior: must do the conversion twice and compare */ if (JS_ToUint32(ctx, &len, val)) { JS_FreeValue(ctx, val); return -1; } val = JS_ToNumberFree(ctx, val); if (JS_IsException(val)) return -1; /* cannot recurse because val is a number */ if (JS_ToArrayLengthFree(ctx, &len1, val, false)) return -1; if (len1 != len) { fail: JS_ThrowRangeError(ctx, "invalid array length"); return -1; } } } break; } *plen = len; return 0; } #define MAX_SAFE_INTEGER (((int64_t)1 << 53) - 1) static bool is_safe_integer(double d) { return isfinite(d) && floor(d) == d && fabs(d) <= (double)MAX_SAFE_INTEGER; } int JS_ToIndex(JSContext *ctx, uint64_t *plen, JSValueConst val) { int64_t v; if (JS_ToInt64Sat(ctx, &v, val)) return -1; if (v < 0 || v > MAX_SAFE_INTEGER) { JS_ThrowRangeError(ctx, "invalid array index"); *plen = 0; return -1; } *plen = v; return 0; } /* convert a value to a length between 0 and MAX_SAFE_INTEGER. return -1 for exception */ static __exception int JS_ToLengthFree(JSContext *ctx, int64_t *plen, JSValue val) { int res = JS_ToInt64Clamp(ctx, plen, val, 0, MAX_SAFE_INTEGER, 0); JS_FreeValue(ctx, val); return res; } /* Note: can return an exception */ static int JS_NumberIsInteger(JSContext *ctx, JSValueConst val) { double d; if (!JS_IsNumber(val)) return false; if (unlikely(JS_ToFloat64(ctx, &d, val))) return -1; return isfinite(d) && floor(d) == d; } static bool JS_NumberIsNegativeOrMinusZero(JSContext *ctx, JSValueConst val) { uint32_t tag; tag = JS_VALUE_GET_NORM_TAG(val); switch(tag) { case JS_TAG_INT: { int v; v = JS_VALUE_GET_INT(val); return (v < 0); } case JS_TAG_FLOAT64: { JSFloat64Union u; u.d = JS_VALUE_GET_FLOAT64(val); return (u.u64 >> 63); } case JS_TAG_SHORT_BIG_INT: return (JS_VALUE_GET_SHORT_BIG_INT(val) < 0); case JS_TAG_BIG_INT: { JSBigInt *p = JS_VALUE_GET_PTR(val); return js_bigint_sign(p); } default: return false; } } static JSValue js_bigint_to_string(JSContext *ctx, JSValueConst val) { return js_bigint_to_string1(ctx, val, 10); } /*---- floating point number to string conversions ----*/ static JSValue js_dtoa2(JSContext *ctx, double d, int radix, int n_digits, int flags) { char static_buf[128], *buf, *tmp_buf; int len, len_max; JSValue res; JSDTOATempMem dtoa_mem; len_max = js_dtoa_max_len(d, radix, n_digits, flags); /* longer buffer may be used if radix != 10 */ if (len_max > sizeof(static_buf) - 1) { tmp_buf = js_malloc(ctx, len_max + 1); if (!tmp_buf) return JS_EXCEPTION; buf = tmp_buf; } else { tmp_buf = NULL; buf = static_buf; } len = js_dtoa(buf, d, radix, n_digits, flags, &dtoa_mem); res = js_new_string8_len(ctx, buf, len); js_free(ctx, tmp_buf); return res; } static JSValue JS_ToStringInternal(JSContext *ctx, JSValueConst val, int flags) { uint32_t tag; char buf[32]; size_t len; tag = JS_VALUE_GET_NORM_TAG(val); switch(tag) { case JS_TAG_STRING: return js_dup(val); case JS_TAG_INT: len = i32toa(buf, JS_VALUE_GET_INT(val)); return js_new_string8_len(ctx, buf, len); case JS_TAG_BOOL: return JS_AtomToString(ctx, JS_VALUE_GET_BOOL(val) ? JS_ATOM_true : JS_ATOM_false); case JS_TAG_NULL: return JS_AtomToString(ctx, JS_ATOM_null); case JS_TAG_UNDEFINED: return JS_AtomToString(ctx, JS_ATOM_undefined); case JS_TAG_EXCEPTION: return JS_EXCEPTION; case JS_TAG_OBJECT: if (flags & JS_TO_STRING_NO_SIDE_EFFECTS) { return js_new_string8(ctx, "{}"); } else { JSValue val1, ret; val1 = JS_ToPrimitive(ctx, val, HINT_STRING); if (JS_IsException(val1)) return val1; ret = JS_ToStringInternal(ctx, val1, flags); JS_FreeValue(ctx, val1); return ret; } break; case JS_TAG_FUNCTION_BYTECODE: return js_new_string8(ctx, "[function bytecode]"); case JS_TAG_SYMBOL: if (flags & JS_TO_STRING_IS_PROPERTY_KEY) { return js_dup(val); } else { return JS_ThrowTypeError(ctx, "cannot convert symbol to string"); } case JS_TAG_FLOAT64: return js_dtoa2(ctx, JS_VALUE_GET_FLOAT64(val), 10, 0, JS_DTOA_FORMAT_FREE); case JS_TAG_SHORT_BIG_INT: case JS_TAG_BIG_INT: return js_bigint_to_string(ctx, val); case JS_TAG_UNINITIALIZED: return js_new_string8(ctx, "[uninitialized]"); default: return js_new_string8(ctx, "[unsupported type]"); } } JSValue JS_ToString(JSContext *ctx, JSValueConst val) { return JS_ToStringInternal(ctx, val, /*flags*/0); } static JSValue JS_ToStringFree(JSContext *ctx, JSValue val) { JSValue ret; ret = JS_ToString(ctx, val); JS_FreeValue(ctx, val); return ret; } static JSValue JS_ToLocaleStringFree(JSContext *ctx, JSValue val) { if (JS_IsUndefined(val) || JS_IsNull(val)) return JS_ToStringFree(ctx, val); return JS_InvokeFree(ctx, val, JS_ATOM_toLocaleString, 0, NULL); } static JSValue JS_ToPropertyKeyInternal(JSContext *ctx, JSValueConst val, int flags) { return JS_ToStringInternal(ctx, val, flags | JS_TO_STRING_IS_PROPERTY_KEY); } JSValue JS_ToPropertyKey(JSContext *ctx, JSValueConst val) { return JS_ToPropertyKeyInternal(ctx, val, /*flags*/0); } static JSValue JS_ToStringCheckObject(JSContext *ctx, JSValueConst val) { uint32_t tag = JS_VALUE_GET_TAG(val); if (tag == JS_TAG_NULL || tag == JS_TAG_UNDEFINED) return JS_ThrowTypeError(ctx, "null or undefined are forbidden"); return JS_ToString(ctx, val); } static JSValue JS_ToQuotedString(JSContext *ctx, JSValueConst val1) { JSValue val; JSString *p; int i; uint32_t c; StringBuffer b_s, *b = &b_s; char buf[16]; val = JS_ToStringCheckObject(ctx, val1); if (JS_IsException(val)) return val; p = JS_VALUE_GET_STRING(val); if (string_buffer_init(ctx, b, p->len + 2)) goto fail; if (string_buffer_putc8(b, '\"')) goto fail; for(i = 0; i < p->len; ) { c = string_getc(p, &i); switch(c) { case '\t': c = 't'; goto quote; case '\r': c = 'r'; goto quote; case '\n': c = 'n'; goto quote; case '\b': c = 'b'; goto quote; case '\f': c = 'f'; goto quote; case '\"': case '\\': quote: if (string_buffer_putc8(b, '\\')) goto fail; if (string_buffer_putc8(b, c)) goto fail; break; default: if (c < 32 || is_surrogate(c)) { snprintf(buf, sizeof(buf), "\\u%04x", c); if (string_buffer_write8(b, (uint8_t*)buf, 6)) goto fail; } else { if (string_buffer_putc(b, c)) goto fail; } break; } } if (string_buffer_putc8(b, '\"')) goto fail; JS_FreeValue(ctx, val); return string_buffer_end(b); fail: JS_FreeValue(ctx, val); string_buffer_free(b); return JS_EXCEPTION; } static __maybe_unused void JS_DumpObjectHeader(JSRuntime *rt) { printf("%14s %4s %4s %14s %10s %s\n", "ADDRESS", "REFS", "SHRF", "PROTO", "CLASS", "PROPS"); } /* for debug only: dump an object without side effect */ static __maybe_unused void JS_DumpObject(JSRuntime *rt, JSObject *p) { uint32_t i; char atom_buf[ATOM_GET_STR_BUF_SIZE]; JSShape *sh; JSShapeProperty *prs; JSProperty *pr; bool is_first = true; /* XXX: should encode atoms with special characters */ sh = p->shape; /* the shape can be NULL while freeing an object */ printf("%14p %4d ", (void *)p, p->header.ref_count); if (sh) { printf("%3d%c %14p ", sh->header.ref_count, " *"[sh->is_hashed], (void *)sh->proto); } else { printf("%3s %14s ", "-", "-"); } printf("%10s ", JS_AtomGetStrRT(rt, atom_buf, sizeof(atom_buf), rt->class_array[p->class_id].class_name)); if (p->is_exotic && p->fast_array) { printf("[ "); for(i = 0; i < p->u.array.count; i++) { if (i != 0) printf(", "); switch (p->class_id) { case JS_CLASS_ARRAY: case JS_CLASS_ARGUMENTS: JS_DumpValue(rt, p->u.array.u.values[i]); break; case JS_CLASS_UINT8C_ARRAY: case JS_CLASS_INT8_ARRAY: case JS_CLASS_UINT8_ARRAY: case JS_CLASS_INT16_ARRAY: case JS_CLASS_UINT16_ARRAY: case JS_CLASS_INT32_ARRAY: case JS_CLASS_UINT32_ARRAY: case JS_CLASS_BIG_INT64_ARRAY: case JS_CLASS_BIG_UINT64_ARRAY: case JS_CLASS_FLOAT16_ARRAY: case JS_CLASS_FLOAT32_ARRAY: case JS_CLASS_FLOAT64_ARRAY: { int size = 1 << typed_array_size_log2(p->class_id); const uint8_t *b = p->u.array.u.uint8_ptr + i * size; while (size-- > 0) printf("%02X", *b++); } break; } } printf(" ] "); } if (sh) { printf("{ "); for(i = 0, prs = get_shape_prop(sh); i < sh->prop_count; i++, prs++) { if (prs->atom != JS_ATOM_NULL) { pr = &p->prop[i]; if (!is_first) printf(", "); printf("%s: ", JS_AtomGetStrRT(rt, atom_buf, sizeof(atom_buf), prs->atom)); if ((prs->flags & JS_PROP_TMASK) == JS_PROP_GETSET) { printf("[getset %p %p]", (void *)pr->u.getset.getter, (void *)pr->u.getset.setter); } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_VARREF) { printf("[varref %p]", (void *)pr->u.var_ref); } else if ((prs->flags & JS_PROP_TMASK) == JS_PROP_AUTOINIT) { printf("[autoinit %p %d %p]", (void *)js_autoinit_get_realm(pr), js_autoinit_get_id(pr), (void *)pr->u.init.opaque); } else { JS_DumpValue(rt, pr->u.value); } is_first = false; } } printf(" }"); } if (js_class_has_bytecode(p->class_id)) { JSFunctionBytecode *b = p->u.func.function_bytecode; JSVarRef **var_refs; if (b->closure_var_count) { var_refs = p->u.func.var_refs; printf(" Closure:"); for(i = 0; i < b->closure_var_count; i++) { printf(" "); JS_DumpValue(rt, var_refs[i]->value); } if (p->u.func.home_object) { printf(" HomeObject: "); JS_DumpValue(rt, JS_MKPTR(JS_TAG_OBJECT, p->u.func.home_object)); } } } printf("\n"); } static __maybe_unused void JS_DumpGCObject(JSRuntime *rt, JSGCObjectHeader *p) { if (p->gc_obj_type == JS_GC_OBJ_TYPE_JS_OBJECT) { JS_DumpObject(rt, (JSObject *)p); } else { printf("%14p %4d ", (void *)p, p->ref_count); switch(p->gc_obj_type) { case JS_GC_OBJ_TYPE_FUNCTION_BYTECODE: printf("[function bytecode]"); break; case JS_GC_OBJ_TYPE_SHAPE: printf("[shape]"); break; case JS_GC_OBJ_TYPE_VAR_REF: printf("[var_ref]"); break; case JS_GC_OBJ_TYPE_ASYNC_FUNCTION: printf("[async_function]"); break; case JS_GC_OBJ_TYPE_JS_CONTEXT: printf("[js_context]"); break; default: printf("[unknown %d]", p->gc_obj_type); break; } printf("\n"); } } static __maybe_unused void JS_DumpValue(JSRuntime *rt, JSValueConst val) { uint32_t tag = JS_VALUE_GET_NORM_TAG(val); const char *str; switch(tag) { case JS_TAG_INT: printf("%d", JS_VALUE_GET_INT(val)); break; case JS_TAG_BOOL: if (JS_VALUE_GET_BOOL(val)) str = "true"; else str = "false"; goto print_str; case JS_TAG_NULL: str = "null"; goto print_str; case JS_TAG_EXCEPTION: str = "exception"; goto print_str; case JS_TAG_UNINITIALIZED: str = "uninitialized"; goto print_str; case JS_TAG_UNDEFINED: str = "undefined"; print_str: printf("%s", str); break; case JS_TAG_FLOAT64: printf("%.14g", JS_VALUE_GET_FLOAT64(val)); break; case JS_TAG_SHORT_BIG_INT: printf("%" PRId64 "n", (int64_t)JS_VALUE_GET_SHORT_BIG_INT(val)); break; case JS_TAG_BIG_INT: { JSBigInt *p = JS_VALUE_GET_PTR(val); int sgn, i; /* In order to avoid allocations we just dump the limbs */ sgn = js_bigint_sign(p); if (sgn) printf("BigInt.asIntN(%d,", p->len * JS_LIMB_BITS); printf("0x"); for(i = p->len - 1; i >= 0; i--) { if (i != p->len - 1) printf("_"); printf("%08x", p->tab[i]); } printf("n"); if (sgn) printf(")"); } break; case JS_TAG_STRING: { JSString *p; p = JS_VALUE_GET_STRING(val); JS_DumpString(rt, p); } break; case JS_TAG_FUNCTION_BYTECODE: { JSFunctionBytecode *b = JS_VALUE_GET_PTR(val); char buf[ATOM_GET_STR_BUF_SIZE]; if (b->func_name) { printf("[bytecode %s]", JS_AtomGetStrRT(rt, buf, sizeof(buf), b->func_name)); } else { printf("[bytecode (anonymous)]"); } } break; case JS_TAG_OBJECT: { JSObject *p = JS_VALUE_GET_OBJ(val); JSAtom atom = rt->class_array[p->class_id].class_name; char atom_buf[ATOM_GET_STR_BUF_SIZE]; printf("[%s %p]", JS_AtomGetStrRT(rt, atom_buf, sizeof(atom_buf), atom), (void *)p); } break; case JS_TAG_SYMBOL: { JSAtomStruct *p = JS_VALUE_GET_PTR(val); char atom_buf[ATOM_GET_STR_BUF_SIZE]; printf("Symbol(%s)", JS_AtomGetStrRT(rt, atom_buf, sizeof(atom_buf), js_get_atom_index(rt, p))); } break; case JS_TAG_MODULE: printf("[module]"); break; default: printf("[unknown tag %d]", tag); break; } } bool JS_IsArray(JSValueConst val) { if (JS_VALUE_GET_TAG(val) == JS_TAG_OBJECT) { JSObject *p = JS_VALUE_GET_OBJ(val); return p->class_id == JS_CLASS_ARRAY; } return false; } /* return -1 if exception (proxy case) or true/false */ static int js_is_array(JSContext *ctx, JSValueConst val) { JSObject *p; if (JS_VALUE_GET_TAG(val) == JS_TAG_OBJECT) { p = JS_VALUE_GET_OBJ(val); if (unlikely(p->class_id == JS_CLASS_PROXY)) return js_proxy_isArray(ctx, val); else return p->class_id == JS_CLASS_ARRAY; } else { return false; } } static double js_math_pow(double a, double b) { if (unlikely(!isfinite(b)) && fabs(a) == 1) { /* not compatible with IEEE 754 */ return NAN; } else { return pow(a, b); } } JSValue JS_NewBigInt64(JSContext *ctx, int64_t v) { if (v >= JS_SHORT_BIG_INT_MIN && v <= JS_SHORT_BIG_INT_MAX) { return __JS_NewShortBigInt(ctx, v); } else { JSBigInt *p; p = js_bigint_new_si64(ctx, v); if (!p) return JS_EXCEPTION; return JS_MKPTR(JS_TAG_BIG_INT, p); } } JSValue JS_NewBigUint64(JSContext *ctx, uint64_t v) { if (v <= JS_SHORT_BIG_INT_MAX) { return __JS_NewShortBigInt(ctx, v); } else { JSBigInt *p; p = js_bigint_new_ui64(ctx, v); if (!p) return JS_EXCEPTION; return JS_MKPTR(JS_TAG_BIG_INT, p); } } /* return NaN if bad bigint literal */ static JSValue JS_StringToBigInt(JSContext *ctx, JSValue val) { const char *str, *p; size_t len; int flags; str = JS_ToCStringLen(ctx, &len, val); JS_FreeValue(ctx, val); if (!str) return JS_EXCEPTION; p = str; p += skip_spaces(p); if ((p - str) == len) { val = JS_NewBigInt64(ctx, 0); } else { flags = ATOD_INT_ONLY | ATOD_ACCEPT_BIN_OCT | ATOD_TYPE_BIG_INT; val = js_atof(ctx, p, &p, 0, flags); p += skip_spaces(p); if (!JS_IsException(val)) { if ((p - str) != len) { JS_FreeValue(ctx, val); val = JS_NAN; } } } JS_FreeCString(ctx, str); return val; } static JSValue JS_StringToBigIntErr(JSContext *ctx, JSValue val) { val = JS_StringToBigInt(ctx, val); if (JS_VALUE_IS_NAN(val)) return JS_ThrowSyntaxError(ctx, "invalid BigInt literal"); return val; } /* JS Numbers are not allowed */ static JSValue JS_ToBigIntFree(JSContext *ctx, JSValue val) { uint32_t tag; redo: tag = JS_VALUE_GET_NORM_TAG(val); switch(tag) { case JS_TAG_SHORT_BIG_INT: case JS_TAG_BIG_INT: break; case JS_TAG_INT: case JS_TAG_NULL: case JS_TAG_UNDEFINED: case JS_TAG_FLOAT64: goto fail; case JS_TAG_BOOL: val = __JS_NewShortBigInt(ctx, JS_VALUE_GET_INT(val)); break; case JS_TAG_STRING: val = JS_StringToBigIntErr(ctx, val); if (JS_IsException(val)) return val; goto redo; case JS_TAG_OBJECT: val = JS_ToPrimitiveFree(ctx, val, HINT_NUMBER); if (JS_IsException(val)) return val; goto redo; default: fail: JS_FreeValue(ctx, val); return JS_ThrowTypeError(ctx, "cannot convert to bigint"); } return val; } static JSValue JS_ToBigInt(JSContext *ctx, JSValueConst val) { return JS_ToBigIntFree(ctx, js_dup(val)); } /* XXX: merge with JS_ToInt64Free with a specific flag */ static int JS_ToBigInt64Free(JSContext *ctx, int64_t *pres, JSValue val) { uint64_t res; val = JS_ToBigIntFree(ctx, val); if (JS_IsException(val)) { *pres = 0; return -1; } if (JS_VALUE_GET_TAG(val) == JS_TAG_SHORT_BIG_INT) { res = JS_VALUE_GET_SHORT_BIG_INT(val); } else { JSBigInt *p = JS_VALUE_GET_PTR(val); /* return the value mod 2^64 */ res = p->tab[0]; if (p->len >= 2) res |= (uint64_t)p->tab[1] << 32; JS_FreeValue(ctx, val); } *pres = res; return 0; } int JS_ToBigInt64(JSContext *ctx, int64_t *pres, JSValueConst val) { return JS_ToBigInt64Free(ctx, pres, js_dup(val)); } int JS_ToBigUint64(JSContext *ctx, uint64_t *pres, JSValueConst val) { return JS_ToBigInt64Free(ctx, (int64_t *)pres, js_dup(val)); } static no_inline __exception int js_unary_arith_slow(JSContext *ctx, JSValue *sp, OPCodeEnum op) { JSValue op1; int v; uint32_t tag; JSBigIntBuf buf1; JSBigInt *p1; op1 = sp[-1]; /* fast path for float64 */ if (JS_TAG_IS_FLOAT64(JS_VALUE_GET_TAG(op1))) goto handle_float64; op1 = JS_ToNumericFree(ctx, op1); if (JS_IsException(op1)) goto exception; tag = JS_VALUE_GET_TAG(op1); switch(tag) { case JS_TAG_INT: { int64_t v64; v64 = JS_VALUE_GET_INT(op1); switch(op) { case OP_inc: case OP_dec: v = 2 * (op - OP_dec) - 1; v64 += v; break; case OP_plus: break; case OP_neg: if (v64 == 0) { sp[-1] = js_float64(-0.0); return 0; } else { v64 = -v64; } break; default: abort(); } sp[-1] = js_int64(v64); } break; case JS_TAG_SHORT_BIG_INT: { int64_t v; v = JS_VALUE_GET_SHORT_BIG_INT(op1); switch(op) { case OP_plus: JS_ThrowTypeError(ctx, "bigint argument with unary +"); goto exception; case OP_inc: if (v == JS_SHORT_BIG_INT_MAX) goto bigint_slow_case; sp[-1] = __JS_NewShortBigInt(ctx, v + 1); break; case OP_dec: if (v == JS_SHORT_BIG_INT_MIN) goto bigint_slow_case; sp[-1] = __JS_NewShortBigInt(ctx, v - 1); break; case OP_neg: v = JS_VALUE_GET_SHORT_BIG_INT(op1); if (v == JS_SHORT_BIG_INT_MIN) { bigint_slow_case: p1 = js_bigint_set_short(&buf1, op1); goto bigint_slow_case1; } sp[-1] = __JS_NewShortBigInt(ctx, -v); break; default: abort(); } } break; case JS_TAG_BIG_INT: { JSBigInt *r; p1 = JS_VALUE_GET_PTR(op1); bigint_slow_case1: switch(op) { case OP_plus: JS_ThrowTypeError(ctx, "bigint argument with unary +"); JS_FreeValue(ctx, op1); goto exception; case OP_inc: case OP_dec: { JSBigIntBuf buf2; JSBigInt *p2; p2 = js_bigint_set_si(&buf2, 2 * (op - OP_dec) - 1); r = js_bigint_add(ctx, p1, p2, 0); } break; case OP_neg: r = js_bigint_neg(ctx, p1); break; case OP_not: r = js_bigint_not(ctx, p1); break; default: abort(); } JS_FreeValue(ctx, op1); if (!r) goto exception; sp[-1] = JS_CompactBigInt(ctx, r); } break; default: handle_float64: { double d; d = JS_VALUE_GET_FLOAT64(op1); switch(op) { case OP_inc: case OP_dec: v = 2 * (op - OP_dec) - 1; d += v; break; case OP_plus: break; case OP_neg: d = -d; break; default: abort(); } sp[-1] = js_float64(d); } break; } return 0; exception: sp[-1] = JS_UNDEFINED; return -1; } static __exception int js_post_inc_slow(JSContext *ctx, JSValue *sp, OPCodeEnum op) { JSValue op1; /* XXX: allow custom operators */ op1 = sp[-1]; op1 = JS_ToNumericFree(ctx, op1); if (JS_IsException(op1)) { sp[-1] = JS_UNDEFINED; return -1; } sp[-1] = op1; sp[0] = js_dup(op1); return js_unary_arith_slow(ctx, sp + 1, op - OP_post_dec + OP_dec); } static no_inline int js_not_slow(JSContext *ctx, JSValue *sp) { JSValue op1; op1 = sp[-1]; op1 = JS_ToNumericFree(ctx, op1); if (JS_IsException(op1)) goto exception; if (JS_VALUE_GET_TAG(op1) == JS_TAG_SHORT_BIG_INT) { sp[-1] = __JS_NewShortBigInt(ctx, ~JS_VALUE_GET_SHORT_BIG_INT(op1)); } else if (JS_VALUE_GET_TAG(op1) == JS_TAG_BIG_INT) { JSBigInt *r; r = js_bigint_not(ctx, JS_VALUE_GET_PTR(op1)); JS_FreeValue(ctx, op1); if (!r) goto exception; sp[-1] = JS_CompactBigInt(ctx, r); } else { int32_t v1; if (unlikely(JS_ToInt32Free(ctx, &v1, op1))) goto exception; sp[-1] = js_int32(~v1); } return 0; exception: sp[-1] = JS_UNDEFINED; return -1; } static no_inline __exception int js_binary_arith_slow(JSContext *ctx, JSValue *sp, OPCodeEnum op) { JSValue op1, op2; uint32_t tag1, tag2; double d1, d2; op1 = sp[-2]; op2 = sp[-1]; tag1 = JS_VALUE_GET_NORM_TAG(op1); tag2 = JS_VALUE_GET_NORM_TAG(op2); /* fast path for float operations */ if (tag1 == JS_TAG_FLOAT64 && tag2 == JS_TAG_FLOAT64) { d1 = JS_VALUE_GET_FLOAT64(op1); d2 = JS_VALUE_GET_FLOAT64(op2); goto handle_float64; } /* fast path for short big int operations */ if (tag1 == JS_TAG_SHORT_BIG_INT && tag2 == JS_TAG_SHORT_BIG_INT) { js_slimb_t v1, v2; js_sdlimb_t v; v1 = JS_VALUE_GET_SHORT_BIG_INT(op1); v2 = JS_VALUE_GET_SHORT_BIG_INT(op2); switch(op) { case OP_sub: v = (js_sdlimb_t)v1 - (js_sdlimb_t)v2; break; case OP_mul: v = (js_sdlimb_t)v1 * (js_sdlimb_t)v2; break; case OP_div: if (v2 == 0 || ((js_limb_t)v1 == (js_limb_t)1 << (JS_LIMB_BITS - 1) && v2 == -1)) { goto slow_big_int; } sp[-2] = __JS_NewShortBigInt(ctx, v1 / v2); return 0; case OP_mod: if (v2 == 0 || ((js_limb_t)v1 == (js_limb_t)1 << (JS_LIMB_BITS - 1) && v2 == -1)) { goto slow_big_int; } sp[-2] = __JS_NewShortBigInt(ctx, v1 % v2); return 0; case OP_pow: goto slow_big_int; default: abort(); } if (likely(v >= JS_SHORT_BIG_INT_MIN && v <= JS_SHORT_BIG_INT_MAX)) { sp[-2] = __JS_NewShortBigInt(ctx, v); } else { JSBigInt *r = js_bigint_new_di(ctx, v); if (!r) goto exception; sp[-2] = JS_MKPTR(JS_TAG_BIG_INT, r); } return 0; } op1 = JS_ToNumericFree(ctx, op1); if (JS_IsException(op1)) { JS_FreeValue(ctx, op2); goto exception; } op2 = JS_ToNumericFree(ctx, op2); if (JS_IsException(op2)) { JS_FreeValue(ctx, op1); goto exception; } tag1 = JS_VALUE_GET_NORM_TAG(op1); tag2 = JS_VALUE_GET_NORM_TAG(op2); if (tag1 == JS_TAG_INT && tag2 == JS_TAG_INT) { int32_t v1, v2; int64_t v; v1 = JS_VALUE_GET_INT(op1); v2 = JS_VALUE_GET_INT(op2); switch(op) { case OP_sub: v = (int64_t)v1 - (int64_t)v2; break; case OP_mul: v = (int64_t)v1 * (int64_t)v2; if (v == 0 && (v1 | v2) < 0) { sp[-2] = js_float64(-0.0); return 0; } break; case OP_div: sp[-2] = js_number((double)v1 / (double)v2); return 0; case OP_mod: if (v1 < 0 || v2 <= 0) { sp[-2] = js_number(fmod(v1, v2)); return 0; } else { v = (int64_t)v1 % (int64_t)v2; } break; case OP_pow: sp[-2] = js_number(js_math_pow(v1, v2)); return 0; default: abort(); } sp[-2] = js_int64(v); } else if ((tag1 == JS_TAG_SHORT_BIG_INT || tag1 == JS_TAG_BIG_INT) && (tag2 == JS_TAG_SHORT_BIG_INT || tag2 == JS_TAG_BIG_INT)) { JSBigInt *p1, *p2, *r; JSBigIntBuf buf1, buf2; slow_big_int: /* bigint result */ if (JS_VALUE_GET_TAG(op1) == JS_TAG_SHORT_BIG_INT) p1 = js_bigint_set_short(&buf1, op1); else p1 = JS_VALUE_GET_PTR(op1); if (JS_VALUE_GET_TAG(op2) == JS_TAG_SHORT_BIG_INT) p2 = js_bigint_set_short(&buf2, op2); else p2 = JS_VALUE_GET_PTR(op2); switch(op) { case OP_add: r = js_bigint_add(ctx, p1, p2, 0); break; case OP_sub: r = js_bigint_add(ctx, p1, p2, 1); break; case OP_mul: r = js_bigint_mul(ctx, p1, p2); break; case OP_div: r = js_bigint_divrem(ctx, p1, p2, false); break; case OP_mod: r = js_bigint_divrem(ctx, p1, p2, true); break; case OP_pow: r = js_bigint_pow(ctx, p1, p2); break; default: abort(); } JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); if (!r) goto exception; sp[-2] = JS_CompactBigInt(ctx, r); } else { double dr; /* float64 result */ if (JS_ToFloat64Free(ctx, &d1, op1)) { JS_FreeValue(ctx, op2); goto exception; } if (JS_ToFloat64Free(ctx, &d2, op2)) goto exception; handle_float64: switch(op) { case OP_sub: dr = d1 - d2; break; case OP_mul: dr = d1 * d2; break; case OP_div: dr = d1 / d2; break; case OP_mod: dr = fmod(d1, d2); break; case OP_pow: dr = js_math_pow(d1, d2); break; default: abort(); } sp[-2] = js_float64(dr); } return 0; exception: sp[-2] = JS_UNDEFINED; sp[-1] = JS_UNDEFINED; return -1; } static no_inline __exception int js_add_slow(JSContext *ctx, JSValue *sp) { JSValue op1, op2; uint32_t tag1, tag2; op1 = sp[-2]; op2 = sp[-1]; tag1 = JS_VALUE_GET_NORM_TAG(op1); tag2 = JS_VALUE_GET_NORM_TAG(op2); /* fast path for float64 */ if (tag1 == JS_TAG_FLOAT64 && tag2 == JS_TAG_FLOAT64) { double d1, d2; d1 = JS_VALUE_GET_FLOAT64(op1); d2 = JS_VALUE_GET_FLOAT64(op2); sp[-2] = js_float64(d1 + d2); return 0; } /* fast path for short bigint */ if (tag1 == JS_TAG_SHORT_BIG_INT && tag2 == JS_TAG_SHORT_BIG_INT) { js_slimb_t v1, v2; js_sdlimb_t v; v1 = JS_VALUE_GET_SHORT_BIG_INT(op1); v2 = JS_VALUE_GET_SHORT_BIG_INT(op2); v = (js_sdlimb_t)v1 + (js_sdlimb_t)v2; if (likely(v >= JS_SHORT_BIG_INT_MIN && v <= JS_SHORT_BIG_INT_MAX)) { sp[-2] = __JS_NewShortBigInt(ctx, v); } else { JSBigInt *r = js_bigint_new_di(ctx, v); if (!r) goto exception; sp[-2] = JS_MKPTR(JS_TAG_BIG_INT, r); } return 0; } if (tag1 == JS_TAG_OBJECT || tag2 == JS_TAG_OBJECT) { op1 = JS_ToPrimitiveFree(ctx, op1, HINT_NONE); if (JS_IsException(op1)) { JS_FreeValue(ctx, op2); goto exception; } op2 = JS_ToPrimitiveFree(ctx, op2, HINT_NONE); if (JS_IsException(op2)) { JS_FreeValue(ctx, op1); goto exception; } tag1 = JS_VALUE_GET_NORM_TAG(op1); tag2 = JS_VALUE_GET_NORM_TAG(op2); } if (tag1 == JS_TAG_STRING || tag2 == JS_TAG_STRING) { sp[-2] = JS_ConcatString(ctx, op1, op2); if (JS_IsException(sp[-2])) goto exception; return 0; } op1 = JS_ToNumericFree(ctx, op1); if (JS_IsException(op1)) { JS_FreeValue(ctx, op2); goto exception; } op2 = JS_ToNumericFree(ctx, op2); if (JS_IsException(op2)) { JS_FreeValue(ctx, op1); goto exception; } tag1 = JS_VALUE_GET_NORM_TAG(op1); tag2 = JS_VALUE_GET_NORM_TAG(op2); if (tag1 == JS_TAG_INT && tag2 == JS_TAG_INT) { int32_t v1, v2; int64_t v; v1 = JS_VALUE_GET_INT(op1); v2 = JS_VALUE_GET_INT(op2); v = (int64_t)v1 + (int64_t)v2; sp[-2] = js_int64(v); } else if ((tag1 == JS_TAG_BIG_INT || tag1 == JS_TAG_SHORT_BIG_INT) && (tag2 == JS_TAG_BIG_INT || tag2 == JS_TAG_SHORT_BIG_INT)) { JSBigInt *p1, *p2, *r; JSBigIntBuf buf1, buf2; /* bigint result */ if (JS_VALUE_GET_TAG(op1) == JS_TAG_SHORT_BIG_INT) p1 = js_bigint_set_short(&buf1, op1); else p1 = JS_VALUE_GET_PTR(op1); if (JS_VALUE_GET_TAG(op2) == JS_TAG_SHORT_BIG_INT) p2 = js_bigint_set_short(&buf2, op2); else p2 = JS_VALUE_GET_PTR(op2); r = js_bigint_add(ctx, p1, p2, 0); JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); if (!r) goto exception; sp[-2] = JS_CompactBigInt(ctx, r); } else { double d1, d2; /* float64 result */ if (JS_ToFloat64Free(ctx, &d1, op1)) { JS_FreeValue(ctx, op2); goto exception; } if (JS_ToFloat64Free(ctx, &d2, op2)) goto exception; sp[-2] = js_float64(d1 + d2); } return 0; exception: sp[-2] = JS_UNDEFINED; sp[-1] = JS_UNDEFINED; return -1; } static no_inline __exception int js_binary_logic_slow(JSContext *ctx, JSValue *sp, OPCodeEnum op) { JSValue op1, op2; uint32_t tag1, tag2; uint32_t v1, v2, r; op1 = sp[-2]; op2 = sp[-1]; tag1 = JS_VALUE_GET_NORM_TAG(op1); tag2 = JS_VALUE_GET_NORM_TAG(op2); if (tag1 == JS_TAG_SHORT_BIG_INT && tag2 == JS_TAG_SHORT_BIG_INT) { js_slimb_t v1, v2, v; js_sdlimb_t vd; v1 = JS_VALUE_GET_SHORT_BIG_INT(op1); v2 = JS_VALUE_GET_SHORT_BIG_INT(op2); /* bigint fast path */ switch(op) { case OP_and: v = v1 & v2; break; case OP_or: v = v1 | v2; break; case OP_xor: v = v1 ^ v2; break; case OP_sar: if (v2 > (JS_LIMB_BITS - 1)) { goto slow_big_int; } else if (v2 < 0) { if (v2 < -(JS_LIMB_BITS - 1)) goto slow_big_int; v2 = -v2; goto bigint_shl; } bigint_sar: v = v1 >> v2; break; case OP_shl: if (v2 > (JS_LIMB_BITS - 1)) { goto slow_big_int; } else if (v2 < 0) { if (v2 < -(JS_LIMB_BITS - 1)) goto slow_big_int; v2 = -v2; goto bigint_sar; } bigint_shl: vd = (js_dlimb_t)v1 << v2; if (likely(vd >= JS_SHORT_BIG_INT_MIN && vd <= JS_SHORT_BIG_INT_MAX)) { v = vd; } else { JSBigInt *r = js_bigint_new_di(ctx, vd); if (!r) goto exception; sp[-2] = JS_MKPTR(JS_TAG_BIG_INT, r); return 0; } break; default: abort(); } sp[-2] = __JS_NewShortBigInt(ctx, v); return 0; } op1 = JS_ToNumericFree(ctx, op1); if (JS_IsException(op1)) { JS_FreeValue(ctx, op2); goto exception; } op2 = JS_ToNumericFree(ctx, op2); if (JS_IsException(op2)) { JS_FreeValue(ctx, op1); goto exception; } tag1 = JS_VALUE_GET_TAG(op1); tag2 = JS_VALUE_GET_TAG(op2); if ((tag1 == JS_TAG_BIG_INT || tag1 == JS_TAG_SHORT_BIG_INT) && (tag2 == JS_TAG_BIG_INT || tag2 == JS_TAG_SHORT_BIG_INT)) { JSBigInt *p1, *p2, *r; JSBigIntBuf buf1, buf2; slow_big_int: if (JS_VALUE_GET_TAG(op1) == JS_TAG_SHORT_BIG_INT) p1 = js_bigint_set_short(&buf1, op1); else p1 = JS_VALUE_GET_PTR(op1); if (JS_VALUE_GET_TAG(op2) == JS_TAG_SHORT_BIG_INT) p2 = js_bigint_set_short(&buf2, op2); else p2 = JS_VALUE_GET_PTR(op2); switch(op) { case OP_and: case OP_or: case OP_xor: r = js_bigint_logic(ctx, p1, p2, op); break; case OP_shl: case OP_sar: { js_slimb_t shift; shift = js_bigint_get_si_sat(p2); if (shift > INT32_MAX) shift = INT32_MAX; else if (shift < -INT32_MAX) shift = -INT32_MAX; if (op == OP_sar) shift = -shift; if (shift >= 0) r = js_bigint_shl(ctx, p1, shift); else r = js_bigint_shr(ctx, p1, -shift); } break; default: abort(); } JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); if (!r) goto exception; sp[-2] = JS_CompactBigInt(ctx, r); } else { if (unlikely(JS_ToInt32Free(ctx, (int32_t *)&v1, op1))) { JS_FreeValue(ctx, op2); goto exception; } if (unlikely(JS_ToInt32Free(ctx, (int32_t *)&v2, op2))) goto exception; switch(op) { case OP_shl: r = v1 << (v2 & 0x1f); break; case OP_sar: r = (int)v1 >> (v2 & 0x1f); break; case OP_and: r = v1 & v2; break; case OP_or: r = v1 | v2; break; case OP_xor: r = v1 ^ v2; break; default: abort(); } sp[-2] = js_int32(r); } return 0; exception: sp[-2] = JS_UNDEFINED; sp[-1] = JS_UNDEFINED; return -1; } /* op1 must be a bigint or int. */ static JSBigInt *JS_ToBigIntBuf(JSContext *ctx, JSBigIntBuf *buf1, JSValue op1) { JSBigInt *p1; switch(JS_VALUE_GET_TAG(op1)) { case JS_TAG_INT: p1 = js_bigint_set_si(buf1, JS_VALUE_GET_INT(op1)); break; case JS_TAG_SHORT_BIG_INT: p1 = js_bigint_set_short(buf1, op1); break; case JS_TAG_BIG_INT: p1 = JS_VALUE_GET_PTR(op1); break; default: abort(); } return p1; } /* op1 and op2 must be numeric types and at least one must be a bigint. No exception is generated. */ static int js_compare_bigint(JSContext *ctx, OPCodeEnum op, JSValue op1, JSValue op2) { int res, val, tag1, tag2; JSBigIntBuf buf1, buf2; JSBigInt *p1, *p2; tag1 = JS_VALUE_GET_NORM_TAG(op1); tag2 = JS_VALUE_GET_NORM_TAG(op2); if ((tag1 == JS_TAG_SHORT_BIG_INT || tag1 == JS_TAG_INT) && (tag2 == JS_TAG_SHORT_BIG_INT || tag2 == JS_TAG_INT)) { /* fast path */ js_slimb_t v1, v2; if (tag1 == JS_TAG_INT) v1 = JS_VALUE_GET_INT(op1); else v1 = JS_VALUE_GET_SHORT_BIG_INT(op1); if (tag2 == JS_TAG_INT) v2 = JS_VALUE_GET_INT(op2); else v2 = JS_VALUE_GET_SHORT_BIG_INT(op2); val = (v1 > v2) - (v1 < v2); } else { if (tag1 == JS_TAG_FLOAT64) { p2 = JS_ToBigIntBuf(ctx, &buf2, op2); val = js_bigint_float64_cmp(ctx, p2, JS_VALUE_GET_FLOAT64(op1)); if (val == 2) goto unordered; val = -val; } else if (tag2 == JS_TAG_FLOAT64) { p1 = JS_ToBigIntBuf(ctx, &buf1, op1); val = js_bigint_float64_cmp(ctx, p1, JS_VALUE_GET_FLOAT64(op2)); if (val == 2) { unordered: JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); return false; } } else { p1 = JS_ToBigIntBuf(ctx, &buf1, op1); p2 = JS_ToBigIntBuf(ctx, &buf2, op2); val = js_bigint_cmp(ctx, p1, p2); } JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); } switch(op) { case OP_lt: res = val < 0; break; case OP_lte: res = val <= 0; break; case OP_gt: res = val > 0; break; case OP_gte: res = val >= 0; break; case OP_eq: res = val == 0; break; default: abort(); } return res; } static no_inline int js_relational_slow(JSContext *ctx, JSValue *sp, OPCodeEnum op) { JSValue op1, op2; int res; uint32_t tag1, tag2; op1 = sp[-2]; op2 = sp[-1]; tag1 = JS_VALUE_GET_NORM_TAG(op1); tag2 = JS_VALUE_GET_NORM_TAG(op2); op1 = JS_ToPrimitiveFree(ctx, op1, HINT_NUMBER); if (JS_IsException(op1)) { JS_FreeValue(ctx, op2); goto exception; } op2 = JS_ToPrimitiveFree(ctx, op2, HINT_NUMBER); if (JS_IsException(op2)) { JS_FreeValue(ctx, op1); goto exception; } tag1 = JS_VALUE_GET_NORM_TAG(op1); tag2 = JS_VALUE_GET_NORM_TAG(op2); if (tag1 == JS_TAG_STRING && tag2 == JS_TAG_STRING) { JSString *p1, *p2; p1 = JS_VALUE_GET_STRING(op1); p2 = JS_VALUE_GET_STRING(op2); res = js_string_compare(p1, p2); switch(op) { case OP_lt: res = (res < 0); break; case OP_lte: res = (res <= 0); break; case OP_gt: res = (res > 0); break; default: case OP_gte: res = (res >= 0); break; } JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); } else if ((tag1 <= JS_TAG_NULL || tag1 == JS_TAG_FLOAT64) && (tag2 <= JS_TAG_NULL || tag2 == JS_TAG_FLOAT64)) { /* fast path for float64/int */ goto float64_compare; } else { if ((((tag1 == JS_TAG_BIG_INT || tag1 == JS_TAG_SHORT_BIG_INT) && tag2 == JS_TAG_STRING) || ((tag2 == JS_TAG_BIG_INT || tag2 == JS_TAG_SHORT_BIG_INT) && tag1 == JS_TAG_STRING))) { if (tag1 == JS_TAG_STRING) { op1 = JS_StringToBigInt(ctx, op1); if (JS_VALUE_GET_TAG(op1) != JS_TAG_BIG_INT && JS_VALUE_GET_TAG(op1) != JS_TAG_SHORT_BIG_INT) goto invalid_bigint_string; } if (tag2 == JS_TAG_STRING) { op2 = JS_StringToBigInt(ctx, op2); if (JS_VALUE_GET_TAG(op2) != JS_TAG_BIG_INT && JS_VALUE_GET_TAG(op2) != JS_TAG_SHORT_BIG_INT) { invalid_bigint_string: JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); res = false; goto done; } } } else { op1 = JS_ToNumericFree(ctx, op1); if (JS_IsException(op1)) { JS_FreeValue(ctx, op2); goto exception; } op2 = JS_ToNumericFree(ctx, op2); if (JS_IsException(op2)) { JS_FreeValue(ctx, op1); goto exception; } } tag1 = JS_VALUE_GET_NORM_TAG(op1); tag2 = JS_VALUE_GET_NORM_TAG(op2); if (tag1 == JS_TAG_BIG_INT || tag1 == JS_TAG_SHORT_BIG_INT || tag2 == JS_TAG_BIG_INT || tag2 == JS_TAG_SHORT_BIG_INT) { res = js_compare_bigint(ctx, op, op1, op2); } else { double d1, d2; float64_compare: /* can use floating point comparison */ if (tag1 == JS_TAG_FLOAT64) { d1 = JS_VALUE_GET_FLOAT64(op1); } else { d1 = JS_VALUE_GET_INT(op1); } if (tag2 == JS_TAG_FLOAT64) { d2 = JS_VALUE_GET_FLOAT64(op2); } else { d2 = JS_VALUE_GET_INT(op2); } switch(op) { case OP_lt: res = (d1 < d2); /* if NaN return false */ break; case OP_lte: res = (d1 <= d2); /* if NaN return false */ break; case OP_gt: res = (d1 > d2); /* if NaN return false */ break; default: case OP_gte: res = (d1 >= d2); /* if NaN return false */ break; } } } done: sp[-2] = js_bool(res); return 0; exception: sp[-2] = JS_UNDEFINED; sp[-1] = JS_UNDEFINED; return -1; } static bool tag_is_number(uint32_t tag) { return (tag == JS_TAG_INT || tag == JS_TAG_FLOAT64 || tag == JS_TAG_BIG_INT || tag == JS_TAG_SHORT_BIG_INT); } static no_inline __exception int js_eq_slow(JSContext *ctx, JSValue *sp, bool is_neq) { JSValue op1, op2; int res; uint32_t tag1, tag2; op1 = sp[-2]; op2 = sp[-1]; redo: tag1 = JS_VALUE_GET_NORM_TAG(op1); tag2 = JS_VALUE_GET_NORM_TAG(op2); if (tag_is_number(tag1) && tag_is_number(tag2)) { if (tag1 == JS_TAG_INT && tag2 == JS_TAG_INT) { res = JS_VALUE_GET_INT(op1) == JS_VALUE_GET_INT(op2); } else if ((tag1 == JS_TAG_FLOAT64 && (tag2 == JS_TAG_INT || tag2 == JS_TAG_FLOAT64)) || (tag2 == JS_TAG_FLOAT64 && (tag1 == JS_TAG_INT || tag1 == JS_TAG_FLOAT64))) { double d1, d2; if (tag1 == JS_TAG_FLOAT64) { d1 = JS_VALUE_GET_FLOAT64(op1); } else { d1 = JS_VALUE_GET_INT(op1); } if (tag2 == JS_TAG_FLOAT64) { d2 = JS_VALUE_GET_FLOAT64(op2); } else { d2 = JS_VALUE_GET_INT(op2); } res = (d1 == d2); } else { res = js_compare_bigint(ctx, OP_eq, op1, op2); if (res < 0) goto exception; } } else if (tag1 == tag2) { res = js_strict_eq2(ctx, op1, op2, JS_EQ_STRICT); } else if ((tag1 == JS_TAG_NULL && tag2 == JS_TAG_UNDEFINED) || (tag2 == JS_TAG_NULL && tag1 == JS_TAG_UNDEFINED)) { res = true; } else if ((tag1 == JS_TAG_STRING && tag_is_number(tag2)) || (tag2 == JS_TAG_STRING && tag_is_number(tag1))) { if (tag1 == JS_TAG_BIG_INT || tag1 == JS_TAG_SHORT_BIG_INT || tag2 == JS_TAG_BIG_INT || tag2 == JS_TAG_SHORT_BIG_INT) { if (tag1 == JS_TAG_STRING) { op1 = JS_StringToBigInt(ctx, op1); if (JS_VALUE_GET_TAG(op1) != JS_TAG_BIG_INT && JS_VALUE_GET_TAG(op1) != JS_TAG_SHORT_BIG_INT) goto invalid_bigint_string; } if (tag2 == JS_TAG_STRING) { op2 = JS_StringToBigInt(ctx, op2); if (JS_VALUE_GET_TAG(op2) != JS_TAG_BIG_INT && JS_VALUE_GET_TAG(op2) != JS_TAG_SHORT_BIG_INT ) { invalid_bigint_string: JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); res = false; goto done; } } } else { op1 = JS_ToNumericFree(ctx, op1); if (JS_IsException(op1)) { JS_FreeValue(ctx, op2); goto exception; } op2 = JS_ToNumericFree(ctx, op2); if (JS_IsException(op2)) { JS_FreeValue(ctx, op1); goto exception; } } res = js_strict_eq(ctx, op1, op2); } else if (tag1 == JS_TAG_BOOL) { op1 = js_int32(JS_VALUE_GET_INT(op1)); goto redo; } else if (tag2 == JS_TAG_BOOL) { op2 = js_int32(JS_VALUE_GET_INT(op2)); goto redo; } else if ((tag1 == JS_TAG_OBJECT && (tag_is_number(tag2) || tag2 == JS_TAG_STRING || tag2 == JS_TAG_SYMBOL)) || (tag2 == JS_TAG_OBJECT && (tag_is_number(tag1) || tag1 == JS_TAG_STRING || tag1 == JS_TAG_SYMBOL))) { op1 = JS_ToPrimitiveFree(ctx, op1, HINT_NONE); if (JS_IsException(op1)) { JS_FreeValue(ctx, op2); goto exception; } op2 = JS_ToPrimitiveFree(ctx, op2, HINT_NONE); if (JS_IsException(op2)) { JS_FreeValue(ctx, op1); goto exception; } goto redo; } else { /* IsHTMLDDA object is equivalent to undefined for '==' and '!=' */ if ((JS_IsHTMLDDA(ctx, op1) && (tag2 == JS_TAG_NULL || tag2 == JS_TAG_UNDEFINED)) || (JS_IsHTMLDDA(ctx, op2) && (tag1 == JS_TAG_NULL || tag1 == JS_TAG_UNDEFINED))) { res = true; } else { res = false; } JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); } done: sp[-2] = js_bool(res ^ is_neq); return 0; exception: sp[-2] = JS_UNDEFINED; sp[-1] = JS_UNDEFINED; return -1; } static no_inline int js_shr_slow(JSContext *ctx, JSValue *sp) { JSValue op1, op2; uint32_t v1, v2, r; op1 = sp[-2]; op2 = sp[-1]; op1 = JS_ToNumericFree(ctx, op1); if (JS_IsException(op1)) { JS_FreeValue(ctx, op2); goto exception; } op2 = JS_ToNumericFree(ctx, op2); if (JS_IsException(op2)) { JS_FreeValue(ctx, op1); goto exception; } if (JS_VALUE_GET_TAG(op1) == JS_TAG_BIG_INT || JS_VALUE_GET_TAG(op1) == JS_TAG_SHORT_BIG_INT || JS_VALUE_GET_TAG(op2) == JS_TAG_BIG_INT || JS_VALUE_GET_TAG(op2) == JS_TAG_SHORT_BIG_INT) { JS_ThrowTypeError(ctx, "BigInt operands are forbidden for >>>"); JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); goto exception; } /* cannot give an exception */ JS_ToUint32Free(ctx, &v1, op1); JS_ToUint32Free(ctx, &v2, op2); r = v1 >> (v2 & 0x1f); sp[-2] = js_uint32(r); return 0; exception: sp[-2] = JS_UNDEFINED; sp[-1] = JS_UNDEFINED; return -1; } static bool js_strict_eq2(JSContext *ctx, JSValue op1, JSValue op2, JSStrictEqModeEnum eq_mode) { bool res; int tag1, tag2; double d1, d2; tag1 = JS_VALUE_GET_NORM_TAG(op1); tag2 = JS_VALUE_GET_NORM_TAG(op2); switch(tag1) { case JS_TAG_BOOL: if (tag1 != tag2) { res = false; } else { res = JS_VALUE_GET_INT(op1) == JS_VALUE_GET_INT(op2); goto done_no_free; } break; case JS_TAG_NULL: case JS_TAG_UNDEFINED: res = (tag1 == tag2); break; case JS_TAG_STRING: { JSString *p1, *p2; if (tag1 != tag2) { res = false; } else { p1 = JS_VALUE_GET_STRING(op1); p2 = JS_VALUE_GET_STRING(op2); res = js_string_eq(p1, p2); } } break; case JS_TAG_SYMBOL: { JSAtomStruct *p1, *p2; if (tag1 != tag2) { res = false; } else { p1 = JS_VALUE_GET_PTR(op1); p2 = JS_VALUE_GET_PTR(op2); res = (p1 == p2); } } break; case JS_TAG_OBJECT: if (tag1 != tag2) res = false; else res = JS_VALUE_GET_OBJ(op1) == JS_VALUE_GET_OBJ(op2); break; case JS_TAG_INT: d1 = JS_VALUE_GET_INT(op1); if (tag2 == JS_TAG_INT) { d2 = JS_VALUE_GET_INT(op2); goto number_test; } else if (tag2 == JS_TAG_FLOAT64) { d2 = JS_VALUE_GET_FLOAT64(op2); goto number_test; } else { res = false; } break; case JS_TAG_FLOAT64: d1 = JS_VALUE_GET_FLOAT64(op1); if (tag2 == JS_TAG_FLOAT64) { d2 = JS_VALUE_GET_FLOAT64(op2); } else if (tag2 == JS_TAG_INT) { d2 = JS_VALUE_GET_INT(op2); } else { res = false; break; } number_test: if (unlikely(eq_mode >= JS_EQ_SAME_VALUE)) { JSFloat64Union u1, u2; /* NaN is not always normalized, so this test is necessary */ if (isnan(d1) || isnan(d2)) { res = isnan(d1) == isnan(d2); } else if (eq_mode == JS_EQ_SAME_VALUE_ZERO) { res = (d1 == d2); /* +0 == -0 */ } else { u1.d = d1; u2.d = d2; res = (u1.u64 == u2.u64); /* +0 != -0 */ } } else { res = (d1 == d2); /* if NaN return false and +0 == -0 */ } goto done_no_free; case JS_TAG_SHORT_BIG_INT: case JS_TAG_BIG_INT: { JSBigIntBuf buf1, buf2; JSBigInt *p1, *p2; if (tag2 != JS_TAG_SHORT_BIG_INT && tag2 != JS_TAG_BIG_INT) { res = false; break; } if (JS_VALUE_GET_TAG(op1) == JS_TAG_SHORT_BIG_INT) p1 = js_bigint_set_short(&buf1, op1); else p1 = JS_VALUE_GET_PTR(op1); if (JS_VALUE_GET_TAG(op2) == JS_TAG_SHORT_BIG_INT) p2 = js_bigint_set_short(&buf2, op2); else p2 = JS_VALUE_GET_PTR(op2); res = (js_bigint_cmp(ctx, p1, p2) == 0); } break; default: res = false; break; } JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); done_no_free: return res; } static bool js_strict_eq(JSContext *ctx, JSValue op1, JSValue op2) { return js_strict_eq2(ctx, op1, op2, JS_EQ_STRICT); } static bool js_same_value(JSContext *ctx, JSValueConst op1, JSValueConst op2) { return js_strict_eq2(ctx, js_dup(op1), js_dup(op2), JS_EQ_SAME_VALUE); } static bool js_same_value_zero(JSContext *ctx, JSValueConst op1, JSValueConst op2) { return js_strict_eq2(ctx, js_dup(op1), js_dup(op2), JS_EQ_SAME_VALUE_ZERO); } static no_inline int js_strict_eq_slow(JSContext *ctx, JSValue *sp, bool is_neq) { bool res; res = js_strict_eq(ctx, sp[-2], sp[-1]); sp[-2] = js_bool(res ^ is_neq); return 0; } static __exception int js_operator_in(JSContext *ctx, JSValue *sp) { JSValue op1, op2; JSAtom atom; int ret; op1 = sp[-2]; op2 = sp[-1]; if (JS_VALUE_GET_TAG(op2) != JS_TAG_OBJECT) { JS_ThrowTypeError(ctx, "invalid 'in' operand"); return -1; } atom = JS_ValueToAtom(ctx, op1); if (unlikely(atom == JS_ATOM_NULL)) return -1; ret = JS_HasProperty(ctx, op2, atom); JS_FreeAtom(ctx, atom); if (ret < 0) return -1; JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); sp[-2] = js_bool(ret); return 0; } static __exception int js_operator_private_in(JSContext *ctx, JSValue *sp) { JSValue op1, op2; int ret; op1 = sp[-2]; /* object */ op2 = sp[-1]; /* field name or method function */ if (JS_VALUE_GET_TAG(op1) != JS_TAG_OBJECT) { JS_ThrowTypeError(ctx, "invalid 'in' operand"); return -1; } if (JS_IsObject(op2)) { /* method: use the brand */ ret = JS_CheckBrand(ctx, op1, op2); if (ret < 0) return -1; } else { JSAtom atom; JSObject *p; JSShapeProperty *prs; JSProperty *pr; /* field */ atom = JS_ValueToAtom(ctx, op2); if (unlikely(atom == JS_ATOM_NULL)) return -1; p = JS_VALUE_GET_OBJ(op1); prs = find_own_property(&pr, p, atom); JS_FreeAtom(ctx, atom); ret = (prs != NULL); } JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); sp[-2] = js_bool(ret); return 0; } static __exception int js_has_unscopable(JSContext *ctx, JSValue obj, JSAtom atom) { JSValue arr, val; int ret; arr = JS_GetProperty(ctx, obj, JS_ATOM_Symbol_unscopables); if (JS_IsException(arr)) return -1; ret = 0; if (JS_IsObject(arr)) { val = JS_GetProperty(ctx, arr, atom); ret = JS_ToBoolFree(ctx, val); } JS_FreeValue(ctx, arr); return ret; } static __exception int js_operator_instanceof(JSContext *ctx, JSValue *sp) { JSValue op1, op2; int ret; op1 = sp[-2]; op2 = sp[-1]; ret = JS_IsInstanceOf(ctx, op1, op2); if (ret < 0) return ret; JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); sp[-2] = js_bool(ret); return 0; } static __exception int js_operator_typeof(JSContext *ctx, JSValue op1) { JSAtom atom; uint32_t tag; tag = JS_VALUE_GET_NORM_TAG(op1); switch(tag) { case JS_TAG_SHORT_BIG_INT: case JS_TAG_BIG_INT: atom = JS_ATOM_bigint; break; case JS_TAG_INT: case JS_TAG_FLOAT64: atom = JS_ATOM_number; break; case JS_TAG_UNDEFINED: atom = JS_ATOM_undefined; break; case JS_TAG_BOOL: atom = JS_ATOM_boolean; break; case JS_TAG_STRING: atom = JS_ATOM_string; break; case JS_TAG_OBJECT: { JSObject *p; p = JS_VALUE_GET_OBJ(op1); if (unlikely(p->is_HTMLDDA)) atom = JS_ATOM_undefined; else if (JS_IsFunction(ctx, op1)) atom = JS_ATOM_function; else goto obj_type; } break; case JS_TAG_NULL: obj_type: atom = JS_ATOM_object; break; case JS_TAG_SYMBOL: atom = JS_ATOM_symbol; break; default: atom = JS_ATOM_unknown; break; } return atom; } static __exception int js_operator_delete(JSContext *ctx, JSValue *sp) { JSValue op1, op2; JSAtom atom; int ret; op1 = sp[-2]; op2 = sp[-1]; atom = JS_ValueToAtom(ctx, op2); if (unlikely(atom == JS_ATOM_NULL)) return -1; ret = JS_DeleteProperty(ctx, op1, atom, JS_PROP_THROW_STRICT); JS_FreeAtom(ctx, atom); if (unlikely(ret < 0)) return -1; JS_FreeValue(ctx, op1); JS_FreeValue(ctx, op2); sp[-2] = js_bool(ret); return 0; } static JSValue js_throw_type_error(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { JSFunctionBytecode *b = JS_GetFunctionBytecode(this_val); if (!b || b->is_strict_mode || !b->has_prototype) { return JS_ThrowTypeError(ctx, "invalid property access"); } return JS_UNDEFINED; } static JSValue js_function_proto_fileName(JSContext *ctx, JSValueConst this_val) { JSFunctionBytecode *b = JS_GetFunctionBytecode(this_val); if (b) { return JS_AtomToString(ctx, b->filename); } return JS_UNDEFINED; } static JSValue js_function_proto_int32(JSContext *ctx, JSValueConst this_val, int magic) { JSFunctionBytecode *b = JS_GetFunctionBytecode(this_val); if (b) { int *field = (int *) ((char *)b + magic); return js_int32(*field); } return JS_UNDEFINED; } static int js_arguments_define_own_property(JSContext *ctx, JSValueConst this_obj, JSAtom prop, JSValueConst val, JSValueConst getter, JSValueConst setter, int flags) { JSObject *p; uint32_t idx; p = JS_VALUE_GET_OBJ(this_obj); /* convert to normal array when redefining an existing numeric field */ if (p->fast_array && JS_AtomIsArrayIndex(ctx, &idx, prop) && idx < p->u.array.count) { if (convert_fast_array_to_array(ctx, p)) return -1; } /* run the default define own property */ return JS_DefineProperty(ctx, this_obj, prop, val, getter, setter, flags | JS_PROP_NO_EXOTIC); } static const JSClassExoticMethods js_arguments_exotic_methods = { .define_own_property = js_arguments_define_own_property, }; static JSValue js_build_arguments(JSContext *ctx, int argc, JSValueConst *argv) { JSValue val, *tab; JSProperty *pr; JSObject *p; int i; val = JS_NewObjectProtoClass(ctx, ctx->class_proto[JS_CLASS_OBJECT], JS_CLASS_ARGUMENTS); if (JS_IsException(val)) return val; p = JS_VALUE_GET_OBJ(val); /* add the length field (cannot fail) */ pr = add_property(ctx, p, JS_ATOM_length, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE); if (!pr) { JS_FreeValue(ctx, val); return JS_EXCEPTION; } pr->u.value = js_int32(argc); /* initialize the fast array part */ tab = NULL; if (argc > 0) { tab = js_malloc(ctx, sizeof(tab[0]) * argc); if (!tab) { JS_FreeValue(ctx, val); return JS_EXCEPTION; } for(i = 0; i < argc; i++) { tab[i] = js_dup(argv[i]); } } p->u.array.u.values = tab; p->u.array.count = argc; JS_DefinePropertyValue(ctx, val, JS_ATOM_Symbol_iterator, js_dup(ctx->array_proto_values), JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE); /* add callee property to throw a TypeError in strict mode */ JS_DefineProperty(ctx, val, JS_ATOM_callee, JS_UNDEFINED, ctx->throw_type_error, ctx->throw_type_error, JS_PROP_HAS_GET | JS_PROP_HAS_SET); return val; } #define GLOBAL_VAR_OFFSET 0x40000000 #define ARGUMENT_VAR_OFFSET 0x20000000 /* legacy arguments object: add references to the function arguments */ static JSValue js_build_mapped_arguments(JSContext *ctx, int argc, JSValueConst *argv, JSStackFrame *sf, int arg_count) { JSValue val; JSProperty *pr; JSObject *p; int i; val = JS_NewObjectProtoClass(ctx, ctx->class_proto[JS_CLASS_OBJECT], JS_CLASS_MAPPED_ARGUMENTS); if (JS_IsException(val)) return val; p = JS_VALUE_GET_OBJ(val); /* add the length field (cannot fail) */ pr = add_property(ctx, p, JS_ATOM_length, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE); if (!pr) goto fail; pr->u.value = js_int32(argc); for(i = 0; i < arg_count; i++) { JSVarRef *var_ref; var_ref = get_var_ref(ctx, sf, i, true); if (!var_ref) goto fail; pr = add_property(ctx, p, __JS_AtomFromUInt32(i), JS_PROP_C_W_E | JS_PROP_VARREF); if (!pr) { free_var_ref(ctx->rt, var_ref); goto fail; } pr->u.var_ref = var_ref; } /* the arguments not mapped to the arguments of the function can be normal properties */ for(i = arg_count; i < argc; i++) { if (JS_DefinePropertyValueUint32(ctx, val, i, js_dup(argv[i]), JS_PROP_C_W_E) < 0) goto fail; } JS_DefinePropertyValue(ctx, val, JS_ATOM_Symbol_iterator, js_dup(ctx->array_proto_values), JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE); /* callee returns this function in non strict mode */ JS_DefinePropertyValue(ctx, val, JS_ATOM_callee, js_dup(ctx->rt->current_stack_frame->cur_func), JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE); return val; fail: JS_FreeValue(ctx, val); return JS_EXCEPTION; } static JSValue build_for_in_iterator(JSContext *ctx, JSValue obj) { JSObject *p; JSPropertyEnum *tab_atom; int i; JSValue enum_obj, obj1; JSForInIterator *it; uint32_t tag, tab_atom_count; tag = JS_VALUE_GET_TAG(obj); if (tag != JS_TAG_OBJECT && tag != JS_TAG_NULL && tag != JS_TAG_UNDEFINED) { obj = JS_ToObjectFree(ctx, obj); } it = js_malloc(ctx, sizeof(*it)); if (!it) { JS_FreeValue(ctx, obj); return JS_EXCEPTION; } enum_obj = JS_NewObjectProtoClass(ctx, JS_NULL, JS_CLASS_FOR_IN_ITERATOR); if (JS_IsException(enum_obj)) { js_free(ctx, it); JS_FreeValue(ctx, obj); return JS_EXCEPTION; } it->is_array = false; it->obj = obj; it->idx = 0; p = JS_VALUE_GET_OBJ(enum_obj); p->u.for_in_iterator = it; if (tag == JS_TAG_NULL || tag == JS_TAG_UNDEFINED) return enum_obj; /* fast path: assume no enumerable properties in the prototype chain */ obj1 = js_dup(obj); for(;;) { obj1 = JS_GetPrototypeFree(ctx, obj1); if (JS_IsNull(obj1)) break; if (JS_IsException(obj1)) goto fail; if (JS_GetOwnPropertyNamesInternal(ctx, &tab_atom, &tab_atom_count, JS_VALUE_GET_OBJ(obj1), JS_GPN_STRING_MASK | JS_GPN_ENUM_ONLY)) { JS_FreeValue(ctx, obj1); goto fail; } js_free_prop_enum(ctx, tab_atom, tab_atom_count); if (tab_atom_count != 0) { JS_FreeValue(ctx, obj1); goto slow_path; } /* must check for timeout to avoid infinite loop */ if (js_poll_interrupts(ctx)) { JS_FreeValue(ctx, obj1); goto fail; } } p = JS_VALUE_GET_OBJ(obj); if (p->fast_array) { JSShape *sh; JSShapeProperty *prs; /* check that there are no enumerable normal fields */ sh = p->shape; for(i = 0, prs = get_shape_prop(sh); i < sh->prop_count; i++, prs++) { if (prs->flags & JS_PROP_ENUMERABLE) goto normal_case; } /* for fast arrays, we only store the number of elements */ it->is_array = true; it->array_length = p->u.array.count; } else { normal_case: if (JS_GetOwnPropertyNamesInternal(ctx, &tab_atom, &tab_atom_count, p, JS_GPN_STRING_MASK | JS_GPN_ENUM_ONLY)) goto fail; for(i = 0; i < tab_atom_count; i++) { JS_SetPropertyInternal(ctx, enum_obj, tab_atom[i].atom, JS_NULL, 0); } js_free_prop_enum(ctx, tab_atom, tab_atom_count); } return enum_obj; slow_path: /* non enumerable properties hide the enumerables ones in the prototype chain */ obj1 = js_dup(obj); for(;;) { if (JS_GetOwnPropertyNamesInternal(ctx, &tab_atom, &tab_atom_count, JS_VALUE_GET_OBJ(obj1), JS_GPN_STRING_MASK | JS_GPN_SET_ENUM)) { JS_FreeValue(ctx, obj1); goto fail; } for(i = 0; i < tab_atom_count; i++) { JS_DefinePropertyValue(ctx, enum_obj, tab_atom[i].atom, JS_NULL, (tab_atom[i].is_enumerable ? JS_PROP_ENUMERABLE : 0)); } js_free_prop_enum(ctx, tab_atom, tab_atom_count); obj1 = JS_GetPrototypeFree(ctx, obj1); if (JS_IsNull(obj1)) break; if (JS_IsException(obj1)) goto fail; /* must check for timeout to avoid infinite loop */ if (js_poll_interrupts(ctx)) { JS_FreeValue(ctx, obj1); goto fail; } } return enum_obj; fail: JS_FreeValue(ctx, enum_obj); return JS_EXCEPTION; } /* obj -> enum_obj */ static __exception int js_for_in_start(JSContext *ctx, JSValue *sp) { sp[-1] = build_for_in_iterator(ctx, sp[-1]); if (JS_IsException(sp[-1])) return -1; return 0; } /* enum_obj -> enum_obj value done */ static __exception int js_for_in_next(JSContext *ctx, JSValue *sp) { JSValue enum_obj; JSObject *p; JSAtom prop; JSForInIterator *it; int ret; enum_obj = sp[-1]; /* fail safe */ if (JS_VALUE_GET_TAG(enum_obj) != JS_TAG_OBJECT) goto done; p = JS_VALUE_GET_OBJ(enum_obj); if (p->class_id != JS_CLASS_FOR_IN_ITERATOR) goto done; it = p->u.for_in_iterator; for(;;) { if (it->is_array) { if (it->idx >= it->array_length) goto done; prop = __JS_AtomFromUInt32(it->idx); it->idx++; } else { JSShape *sh = p->shape; JSShapeProperty *prs; if (it->idx >= sh->prop_count) goto done; prs = get_shape_prop(sh) + it->idx; prop = prs->atom; it->idx++; if (prop == JS_ATOM_NULL || !(prs->flags & JS_PROP_ENUMERABLE)) continue; } // check if the property was deleted unless we're dealing with a proxy JSValue obj = it->obj; if (JS_VALUE_GET_TAG(obj) == JS_TAG_OBJECT) { JSObject *p = JS_VALUE_GET_OBJ(obj); if (p->class_id == JS_CLASS_PROXY) break; } ret = JS_HasProperty(ctx, obj, prop); if (ret < 0) return ret; if (ret) break; } /* return the property */ sp[0] = JS_AtomToValue(ctx, prop); sp[1] = JS_FALSE; return 0; done: /* return the end */ sp[0] = JS_UNDEFINED; sp[1] = JS_TRUE; return 0; } static JSValue JS_GetIterator2(JSContext *ctx, JSValueConst obj, JSValueConst method) { JSValue enum_obj; enum_obj = JS_Call(ctx, method, obj, 0, NULL); if (JS_IsException(enum_obj)) return enum_obj; if (!JS_IsObject(enum_obj)) { JS_FreeValue(ctx, enum_obj); return JS_ThrowTypeErrorNotAnObject(ctx); } return enum_obj; } static JSValue JS_GetIterator(JSContext *ctx, JSValueConst obj, bool is_async) { JSValue method, ret, sync_iter; if (is_async) { method = JS_GetProperty(ctx, obj, JS_ATOM_Symbol_asyncIterator); if (JS_IsException(method)) return method; if (JS_IsUndefined(method) || JS_IsNull(method)) { method = JS_GetProperty(ctx, obj, JS_ATOM_Symbol_iterator); if (JS_IsException(method)) return method; sync_iter = JS_GetIterator2(ctx, obj, method); JS_FreeValue(ctx, method); if (JS_IsException(sync_iter)) return sync_iter; ret = JS_CreateAsyncFromSyncIterator(ctx, sync_iter); JS_FreeValue(ctx, sync_iter); return ret; } } else { method = JS_GetProperty(ctx, obj, JS_ATOM_Symbol_iterator); if (JS_IsException(method)) return method; } if (!JS_IsFunction(ctx, method)) { JS_FreeValue(ctx, method); return JS_ThrowTypeError(ctx, "value is not iterable"); } ret = JS_GetIterator2(ctx, obj, method); JS_FreeValue(ctx, method); return ret; } /* return *pdone = 2 if the iterator object is not parsed */ static JSValue JS_IteratorNext2(JSContext *ctx, JSValueConst enum_obj, JSValueConst method, int argc, JSValueConst *argv, int *pdone) { JSValue obj; /* fast path for the built-in iterators (avoid creating the intermediate result object) */ if (JS_IsObject(method)) { JSObject *p = JS_VALUE_GET_OBJ(method); if (p->class_id == JS_CLASS_C_FUNCTION && p->u.cfunc.cproto == JS_CFUNC_iterator_next) { JSCFunctionType func; JSValueConst args[1]; /* in case the function expects one argument */ if (argc == 0) { args[0] = JS_UNDEFINED; argv = args; } func = p->u.cfunc.c_function; return func.iterator_next(ctx, enum_obj, argc, argv, pdone, p->u.cfunc.magic); } } obj = JS_Call(ctx, method, enum_obj, argc, argv); if (JS_IsException(obj)) goto fail; if (!JS_IsObject(obj)) { JS_FreeValue(ctx, obj); JS_ThrowTypeError(ctx, "iterator must return an object"); goto fail; } *pdone = 2; return obj; fail: *pdone = false; return JS_EXCEPTION; } static JSValue JS_IteratorNext(JSContext *ctx, JSValueConst enum_obj, JSValueConst method, int argc, JSValueConst *argv, int *pdone) { JSValue obj, value, done_val; int done; obj = JS_IteratorNext2(ctx, enum_obj, method, argc, argv, &done); if (JS_IsException(obj)) goto fail; if (likely(done == 0)) { *pdone = false; return obj; } else if (done != 2) { JS_FreeValue(ctx, obj); *pdone = true; return JS_UNDEFINED; } else { done_val = JS_GetProperty(ctx, obj, JS_ATOM_done); if (JS_IsException(done_val)) goto fail; *pdone = JS_ToBoolFree(ctx, done_val); value = JS_UNDEFINED; if (!*pdone) { value = JS_GetProperty(ctx, obj, JS_ATOM_value); } JS_FreeValue(ctx, obj); return value; } fail: JS_FreeValue(ctx, obj); *pdone = false; return JS_EXCEPTION; } /* return < 0 in case of exception */ static int JS_IteratorClose(JSContext *ctx, JSValueConst enum_obj, bool is_exception_pending) { JSValue method, ret, ex_obj; int res; if (is_exception_pending) { ex_obj = ctx->rt->current_exception; ctx->rt->current_exception = JS_UNINITIALIZED; res = -1; } else { ex_obj = JS_UNDEFINED; res = 0; } method = JS_GetProperty(ctx, enum_obj, JS_ATOM_return); if (JS_IsException(method)) { res = -1; goto done; } if (JS_IsUndefined(method) || JS_IsNull(method)) { goto done; } ret = JS_CallFree(ctx, method, enum_obj, 0, NULL); if (!is_exception_pending) { if (JS_IsException(ret)) { res = -1; } else if (!JS_IsObject(ret)) { JS_ThrowTypeErrorNotAnObject(ctx); res = -1; } } JS_FreeValue(ctx, ret); done: if (is_exception_pending) { JS_Throw(ctx, ex_obj); } return res; } /* obj -> enum_rec (3 slots) */ static __exception int js_for_of_start(JSContext *ctx, JSValue *sp, bool is_async) { JSValue op1, obj, method; op1 = sp[-1]; obj = JS_GetIterator(ctx, op1, is_async); if (JS_IsException(obj)) return -1; JS_FreeValue(ctx, op1); sp[-1] = obj; method = JS_GetProperty(ctx, obj, JS_ATOM_next); if (JS_IsException(method)) return -1; sp[0] = method; return 0; } /* enum_rec [objs] -> enum_rec [objs] value done. There are 'offset' objs. If 'done' is true or in case of exception, 'enum_rec' is set to undefined. If 'done' is true, 'value' is always set to undefined. */ static __exception int js_for_of_next(JSContext *ctx, JSValue *sp, int offset) { JSValue value = JS_UNDEFINED; int done = 1; if (likely(!JS_IsUndefined(sp[offset]))) { value = JS_IteratorNext(ctx, sp[offset], sp[offset + 1], 0, NULL, &done); if (JS_IsException(value)) done = -1; if (done) { /* value is JS_UNDEFINED or JS_EXCEPTION */ /* replace the iteration object with undefined */ JS_FreeValue(ctx, sp[offset]); sp[offset] = JS_UNDEFINED; if (done < 0) { return -1; } else { JS_FreeValue(ctx, value); value = JS_UNDEFINED; } } } sp[0] = value; sp[1] = js_bool(done); return 0; } static JSValue JS_IteratorGetCompleteValue(JSContext *ctx, JSValue obj, int *pdone) { JSValue done_val, value; int done; done_val = JS_GetProperty(ctx, obj, JS_ATOM_done); if (JS_IsException(done_val)) goto fail; done = JS_ToBoolFree(ctx, done_val); value = JS_GetProperty(ctx, obj, JS_ATOM_value); if (JS_IsException(value)) goto fail; *pdone = done; return value; fail: *pdone = false; return JS_EXCEPTION; } static __exception int js_iterator_get_value_done(JSContext *ctx, JSValue *sp) { JSValue obj, value; int done; obj = sp[-1]; if (!JS_IsObject(obj)) { JS_ThrowTypeError(ctx, "iterator must return an object"); return -1; } value = JS_IteratorGetCompleteValue(ctx, obj, &done); if (JS_IsException(value)) return -1; JS_FreeValue(ctx, obj); sp[-1] = value; sp[0] = js_bool(done); return 0; } static JSValue js_create_iterator_result(JSContext *ctx, JSValue val, bool done) { JSValue obj; obj = JS_NewObject(ctx); if (JS_IsException(obj)) { JS_FreeValue(ctx, val); return obj; } if (JS_DefinePropertyValue(ctx, obj, JS_ATOM_value, val, JS_PROP_C_W_E) < 0) { goto fail; } if (JS_DefinePropertyValue(ctx, obj, JS_ATOM_done, js_bool(done), JS_PROP_C_W_E) < 0) { fail: JS_FreeValue(ctx, obj); return JS_EXCEPTION; } return obj; } static JSValue js_array_iterator_next(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int *pdone, int magic); static JSValue js_create_array_iterator(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int magic); static bool js_is_fast_array(JSContext *ctx, JSValue obj) { /* Try and handle fast arrays explicitly */ if (JS_VALUE_GET_TAG(obj) == JS_TAG_OBJECT) { JSObject *p = JS_VALUE_GET_OBJ(obj); if (p->class_id == JS_CLASS_ARRAY && p->fast_array) { return true; } } return false; } /* Access an Array's internal JSValue array if available */ static bool js_get_fast_array(JSContext *ctx, JSValue obj, JSValue **arrpp, uint32_t *countp) { /* Try and handle fast arrays explicitly */ if (JS_VALUE_GET_TAG(obj) == JS_TAG_OBJECT) { JSObject *p = JS_VALUE_GET_OBJ(obj); if (p->class_id == JS_CLASS_ARRAY && p->fast_array) { *countp = p->u.array.count; *arrpp = p->u.array.u.values; return true; } } return false; } static __exception int js_append_enumerate(JSContext *ctx, JSValue *sp) { JSValue iterator, enumobj, method, value; int is_array_iterator; JSValue *arrp; uint32_t i, count32, pos; if (JS_VALUE_GET_TAG(sp[-2]) != JS_TAG_INT) { JS_ThrowInternalError(ctx, "invalid index for append"); return -1; } pos = JS_VALUE_GET_INT(sp[-2]); /* XXX: further optimisations: - use ctx->array_proto_values? - check if array_iterator_prototype next method is built-in and avoid constructing actual iterator object? - build this into js_for_of_start and use in all `for (x of o)` loops */ iterator = JS_GetProperty(ctx, sp[-1], JS_ATOM_Symbol_iterator); if (JS_IsException(iterator)) return -1; /* Used to squelch a -Wcast-function-type warning. */ JSCFunctionType ft = { .generic_magic = js_create_array_iterator }; is_array_iterator = JS_IsCFunction(ctx, iterator, ft.generic, JS_ITERATOR_KIND_VALUE); JS_FreeValue(ctx, iterator); enumobj = JS_GetIterator(ctx, sp[-1], false); if (JS_IsException(enumobj)) return -1; method = JS_GetProperty(ctx, enumobj, JS_ATOM_next); if (JS_IsException(method)) { JS_FreeValue(ctx, enumobj); return -1; } /* Used to squelch a -Wcast-function-type warning. */ JSCFunctionType ft2 = { .iterator_next = js_array_iterator_next }; if (is_array_iterator && JS_IsCFunction(ctx, method, ft2.generic, 0) && js_get_fast_array(ctx, sp[-1], &arrp, &count32)) { uint32_t len; if (js_get_length32(ctx, &len, sp[-1])) goto exception; /* if len > count32, the elements >= count32 might be read in the prototypes and might have side effects */ if (len != count32) goto general_case; /* Handle fast arrays explicitly */ for (i = 0; i < count32; i++) { if (JS_DefinePropertyValueUint32(ctx, sp[-3], pos++, js_dup(arrp[i]), JS_PROP_C_W_E) < 0) goto exception; } } else { general_case: for (;;) { int done; value = JS_IteratorNext(ctx, enumobj, method, 0, NULL, &done); if (JS_IsException(value)) goto exception; if (done) { /* value is JS_UNDEFINED */ break; } if (JS_DefinePropertyValueUint32(ctx, sp[-3], pos++, value, JS_PROP_C_W_E) < 0) goto exception; } } /* Note: could raise an error if too many elements */ sp[-2] = js_int32(pos); JS_FreeValue(ctx, enumobj); JS_FreeValue(ctx, method); return 0; exception: JS_IteratorClose(ctx, enumobj, true); JS_FreeValue(ctx, enumobj); JS_FreeValue(ctx, method); return -1; } static __exception int JS_CopyDataProperties(JSContext *ctx, JSValue target, JSValue source, JSValue excluded, bool setprop) { JSPropertyEnum *tab_atom; JSValue val; uint32_t i, tab_atom_count; JSObject *p; JSObject *pexcl = NULL; int ret, gpn_flags; JSPropertyDescriptor desc; bool is_enumerable; if (JS_VALUE_GET_TAG(source) != JS_TAG_OBJECT) return 0; if (JS_VALUE_GET_TAG(excluded) == JS_TAG_OBJECT) pexcl = JS_VALUE_GET_OBJ(excluded); p = JS_VALUE_GET_OBJ(source); gpn_flags = JS_GPN_STRING_MASK | JS_GPN_SYMBOL_MASK | JS_GPN_ENUM_ONLY; if (p->is_exotic) { const JSClassExoticMethods *em = ctx->rt->class_array[p->class_id].exotic; /* cannot use JS_GPN_ENUM_ONLY with e.g. proxies because it introduces a visible change */ if (em && em->get_own_property_names) { gpn_flags &= ~JS_GPN_ENUM_ONLY; } } if (JS_GetOwnPropertyNamesInternal(ctx, &tab_atom, &tab_atom_count, p, gpn_flags)) return -1; for (i = 0; i < tab_atom_count; i++) { if (pexcl) { ret = JS_GetOwnPropertyInternal(ctx, NULL, pexcl, tab_atom[i].atom); if (ret) { if (ret < 0) goto exception; continue; } } if (!(gpn_flags & JS_GPN_ENUM_ONLY)) { /* test if the property is enumerable */ ret = JS_GetOwnPropertyInternal(ctx, &desc, p, tab_atom[i].atom); if (ret < 0) goto exception; if (!ret) continue; is_enumerable = (desc.flags & JS_PROP_ENUMERABLE) != 0; js_free_desc(ctx, &desc); if (!is_enumerable) continue; } val = JS_GetProperty(ctx, source, tab_atom[i].atom); if (JS_IsException(val)) goto exception; if (setprop) ret = JS_SetProperty(ctx, target, tab_atom[i].atom, val); else ret = JS_DefinePropertyValue(ctx, target, tab_atom[i].atom, val, JS_PROP_C_W_E); if (ret < 0) goto exception; } js_free_prop_enum(ctx, tab_atom, tab_atom_count); return 0; exception: js_free_prop_enum(ctx, tab_atom, tab_atom_count); return -1; } /* only valid inside C functions */ static JSValueConst JS_GetActiveFunction(JSContext *ctx) { return ctx->rt->current_stack_frame->cur_func; } static JSVarRef *get_var_ref(JSContext *ctx, JSStackFrame *sf, int var_idx, bool is_arg) { JSVarRef *var_ref; struct list_head *el; JSValue *pvalue; if (is_arg) pvalue = &sf->arg_buf[var_idx]; else pvalue = &sf->var_buf[var_idx]; list_for_each(el, &sf->var_ref_list) { var_ref = list_entry(el, JSVarRef, header.link); if (var_ref->pvalue == pvalue) { var_ref->header.ref_count++; return var_ref; } } /* create a new one */ var_ref = js_malloc(ctx, sizeof(JSVarRef)); if (!var_ref) return NULL; var_ref->header.ref_count = 1; var_ref->is_detached = false; list_add_tail(&var_ref->header.link, &sf->var_ref_list); var_ref->pvalue = pvalue; var_ref->value = JS_UNDEFINED; return var_ref; } static JSValue js_closure2(JSContext *ctx, JSValue func_obj, JSFunctionBytecode *b, JSVarRef **cur_var_refs, JSStackFrame *sf) { JSObject *p; JSVarRef **var_refs; int i; p = JS_VALUE_GET_OBJ(func_obj); p->u.func.function_bytecode = b; p->u.func.home_object = NULL; p->u.func.var_refs = NULL; if (b->closure_var_count) { var_refs = js_mallocz(ctx, sizeof(var_refs[0]) * b->closure_var_count); if (!var_refs) goto fail; p->u.func.var_refs = var_refs; for(i = 0; i < b->closure_var_count; i++) { JSClosureVar *cv = &b->closure_var[i]; JSVarRef *var_ref; if (cv->is_local) { /* reuse the existing variable reference if it already exists */ var_ref = get_var_ref(ctx, sf, cv->var_idx, cv->is_arg); if (!var_ref) goto fail; } else { var_ref = cur_var_refs[cv->var_idx]; var_ref->header.ref_count++; } var_refs[i] = var_ref; } } return func_obj; fail: /* bfunc is freed when func_obj is freed */ JS_FreeValue(ctx, func_obj); return JS_EXCEPTION; } static JSValue js_instantiate_prototype(JSContext *ctx, JSObject *p, JSAtom atom, void *opaque) { JSValue obj, this_val; int ret; this_val = JS_MKPTR(JS_TAG_OBJECT, p); obj = JS_NewObject(ctx); if (JS_IsException(obj)) return JS_EXCEPTION; ret = JS_DefinePropertyValue(ctx, obj, JS_ATOM_constructor, js_dup(this_val), JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE); if (ret < 0) { JS_FreeValue(ctx, obj); return JS_EXCEPTION; } return obj; } static const uint16_t func_kind_to_class_id[] = { [JS_FUNC_NORMAL] = JS_CLASS_BYTECODE_FUNCTION, [JS_FUNC_GENERATOR] = JS_CLASS_GENERATOR_FUNCTION, [JS_FUNC_ASYNC] = JS_CLASS_ASYNC_FUNCTION, [JS_FUNC_ASYNC_GENERATOR] = JS_CLASS_ASYNC_GENERATOR_FUNCTION, }; static JSValue js_closure(JSContext *ctx, JSValue bfunc, JSVarRef **cur_var_refs, JSStackFrame *sf) { JSFunctionBytecode *b; JSValue func_obj; JSAtom name_atom; b = JS_VALUE_GET_PTR(bfunc); func_obj = JS_NewObjectClass(ctx, func_kind_to_class_id[b->func_kind]); if (JS_IsException(func_obj)) { JS_FreeValue(ctx, bfunc); return JS_EXCEPTION; } func_obj = js_closure2(ctx, func_obj, b, cur_var_refs, sf); if (JS_IsException(func_obj)) { /* bfunc has been freed */ goto fail; } name_atom = b->func_name; if (name_atom == JS_ATOM_NULL) name_atom = JS_ATOM_empty_string; js_function_set_properties(ctx, func_obj, name_atom, b->defined_arg_count); if (b->func_kind & JS_FUNC_GENERATOR) { JSValue proto; int proto_class_id; /* generators have a prototype field which is used as prototype for the generator object */ if (b->func_kind == JS_FUNC_ASYNC_GENERATOR) proto_class_id = JS_CLASS_ASYNC_GENERATOR; else proto_class_id = JS_CLASS_GENERATOR; proto = JS_NewObjectProto(ctx, ctx->class_proto[proto_class_id]); if (JS_IsException(proto)) goto fail; JS_DefinePropertyValue(ctx, func_obj, JS_ATOM_prototype, proto, JS_PROP_WRITABLE); } else if (b->has_prototype) { /* add the 'prototype' property: delay instantiation to avoid creating cycles for every javascript function. The prototype object is created on the fly when first accessed */ JS_SetConstructorBit(ctx, func_obj, true); JS_DefineAutoInitProperty(ctx, func_obj, JS_ATOM_prototype, JS_AUTOINIT_ID_PROTOTYPE, NULL, JS_PROP_WRITABLE); } return func_obj; fail: /* bfunc is freed when func_obj is freed */ JS_FreeValue(ctx, func_obj); return JS_EXCEPTION; } #define JS_DEFINE_CLASS_HAS_HERITAGE (1 << 0) static int js_op_define_class(JSContext *ctx, JSValue *sp, JSAtom class_name, int class_flags, JSVarRef **cur_var_refs, JSStackFrame *sf, bool is_computed_name) { JSValue bfunc, parent_class, proto = JS_UNDEFINED; JSValue ctor = JS_UNDEFINED, parent_proto = JS_UNDEFINED; JSFunctionBytecode *b; parent_class = sp[-2]; bfunc = sp[-1]; if (class_flags & JS_DEFINE_CLASS_HAS_HERITAGE) { if (JS_IsNull(parent_class)) { parent_proto = JS_NULL; parent_class = js_dup(ctx->function_proto); } else { if (!JS_IsConstructor(ctx, parent_class)) { JS_ThrowTypeError(ctx, "parent class must be constructor"); goto fail; } parent_proto = JS_GetProperty(ctx, parent_class, JS_ATOM_prototype); if (JS_IsException(parent_proto)) goto fail; if (!JS_IsNull(parent_proto) && !JS_IsObject(parent_proto)) { JS_ThrowTypeError(ctx, "parent prototype must be an object or null"); goto fail; } } } else { /* parent_class is JS_UNDEFINED in this case */ parent_proto = js_dup(ctx->class_proto[JS_CLASS_OBJECT]); parent_class = js_dup(ctx->function_proto); } proto = JS_NewObjectProto(ctx, parent_proto); if (JS_IsException(proto)) goto fail; b = JS_VALUE_GET_PTR(bfunc); assert(b->func_kind == JS_FUNC_NORMAL); ctor = JS_NewObjectProtoClass(ctx, parent_class, JS_CLASS_BYTECODE_FUNCTION); if (JS_IsException(ctor)) goto fail; ctor = js_closure2(ctx, ctor, b, cur_var_refs, sf); bfunc = JS_UNDEFINED; if (JS_IsException(ctor)) goto fail; js_method_set_home_object(ctx, ctor, proto); JS_SetConstructorBit(ctx, ctor, true); JS_DefinePropertyValue(ctx, ctor, JS_ATOM_length, js_int32(b->defined_arg_count), JS_PROP_CONFIGURABLE); if (is_computed_name) { if (JS_DefineObjectNameComputed(ctx, ctor, sp[-3], JS_PROP_CONFIGURABLE) < 0) goto fail; } else { if (JS_DefineObjectName(ctx, ctor, class_name, JS_PROP_CONFIGURABLE) < 0) goto fail; } /* the constructor property must be first. It can be overriden by computed property names */ if (JS_DefinePropertyValue(ctx, proto, JS_ATOM_constructor, js_dup(ctor), JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE | JS_PROP_THROW) < 0) goto fail; /* set the prototype property */ if (JS_DefinePropertyValue(ctx, ctor, JS_ATOM_prototype, js_dup(proto), JS_PROP_THROW) < 0) goto fail; JS_FreeValue(ctx, parent_proto); JS_FreeValue(ctx, parent_class); sp[-2] = ctor; sp[-1] = proto; return 0; fail: JS_FreeValue(ctx, parent_class); JS_FreeValue(ctx, parent_proto); JS_FreeValue(ctx, bfunc); JS_FreeValue(ctx, proto); JS_FreeValue(ctx, ctor); sp[-2] = JS_UNDEFINED; sp[-1] = JS_UNDEFINED; return -1; } static void close_var_refs(JSRuntime *rt, JSStackFrame *sf) { struct list_head *el, *el1; JSVarRef *var_ref; list_for_each_safe(el, el1, &sf->var_ref_list) { var_ref = list_entry(el, JSVarRef, header.link); var_ref->value = js_dup(*var_ref->pvalue); var_ref->pvalue = &var_ref->value; /* the reference is no longer to a local variable */ var_ref->is_detached = true; add_gc_object(rt, &var_ref->header, JS_GC_OBJ_TYPE_VAR_REF); } } static void close_lexical_var(JSContext *ctx, JSStackFrame *sf, int var_idx) { JSValue *pvalue; struct list_head *el, *el1; JSVarRef *var_ref; pvalue = &sf->var_buf[var_idx]; list_for_each_safe(el, el1, &sf->var_ref_list) { var_ref = list_entry(el, JSVarRef, header.link); if (var_ref->pvalue == pvalue) { var_ref->value = js_dup(*var_ref->pvalue); var_ref->pvalue = &var_ref->value; list_del(&var_ref->header.link); /* the reference is no longer to a local variable */ var_ref->is_detached = true; add_gc_object(ctx->rt, &var_ref->header, JS_GC_OBJ_TYPE_VAR_REF); } } } #define JS_CALL_FLAG_COPY_ARGV (1 << 1) #define JS_CALL_FLAG_GENERATOR (1 << 2) static JSValue js_call_c_function(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv, int flags) { JSRuntime *rt = ctx->rt; JSCFunctionType func; JSObject *p; JSStackFrame sf_s, *sf = &sf_s, *prev_sf; JSValue ret_val; JSValueConst *arg_buf; int arg_count, i; JSCFunctionEnum cproto; p = JS_VALUE_GET_OBJ(func_obj); cproto = p->u.cfunc.cproto; arg_count = p->u.cfunc.length; /* better to always check stack overflow */ if (js_check_stack_overflow(rt, sizeof(arg_buf[0]) * arg_count)) return JS_ThrowStackOverflow(ctx); prev_sf = rt->current_stack_frame; sf->prev_frame = prev_sf; rt->current_stack_frame = sf; ctx = p->u.cfunc.realm; /* change the current realm */ sf->is_strict_mode = false; sf->cur_func = unsafe_unconst(func_obj); sf->arg_count = argc; arg_buf = argv; if (unlikely(argc < arg_count)) { /* ensure that at least argc_count arguments are readable */ arg_buf = alloca(sizeof(arg_buf[0]) * arg_count); for(i = 0; i < argc; i++) arg_buf[i] = argv[i]; for(i = argc; i < arg_count; i++) arg_buf[i] = JS_UNDEFINED; sf->arg_count = arg_count; } sf->arg_buf = (JSValue *)arg_buf; func = p->u.cfunc.c_function; switch(cproto) { case JS_CFUNC_constructor: case JS_CFUNC_constructor_or_func: if (!(flags & JS_CALL_FLAG_CONSTRUCTOR)) { if (cproto == JS_CFUNC_constructor) { not_a_constructor: ret_val = JS_ThrowTypeError(ctx, "must be called with new"); break; } else { this_obj = JS_UNDEFINED; } } /* here this_obj is new_target */ /* fall thru */ case JS_CFUNC_generic: ret_val = func.generic(ctx, this_obj, argc, arg_buf); break; case JS_CFUNC_constructor_magic: case JS_CFUNC_constructor_or_func_magic: if (!(flags & JS_CALL_FLAG_CONSTRUCTOR)) { if (cproto == JS_CFUNC_constructor_magic) { goto not_a_constructor; } else { this_obj = JS_UNDEFINED; } } /* fall thru */ case JS_CFUNC_generic_magic: ret_val = func.generic_magic(ctx, this_obj, argc, arg_buf, p->u.cfunc.magic); break; case JS_CFUNC_getter: ret_val = func.getter(ctx, this_obj); break; case JS_CFUNC_setter: ret_val = func.setter(ctx, this_obj, arg_buf[0]); break; case JS_CFUNC_getter_magic: ret_val = func.getter_magic(ctx, this_obj, p->u.cfunc.magic); break; case JS_CFUNC_setter_magic: ret_val = func.setter_magic(ctx, this_obj, arg_buf[0], p->u.cfunc.magic); break; case JS_CFUNC_f_f: { double d1; if (unlikely(JS_ToFloat64(ctx, &d1, arg_buf[0]))) { ret_val = JS_EXCEPTION; break; } ret_val = js_number(func.f_f(d1)); } break; case JS_CFUNC_f_f_f: { double d1, d2; if (unlikely(JS_ToFloat64(ctx, &d1, arg_buf[0]))) { ret_val = JS_EXCEPTION; break; } if (unlikely(JS_ToFloat64(ctx, &d2, arg_buf[1]))) { ret_val = JS_EXCEPTION; break; } ret_val = js_number(func.f_f_f(d1, d2)); } break; case JS_CFUNC_iterator_next: { int done; ret_val = func.iterator_next(ctx, this_obj, argc, arg_buf, &done, p->u.cfunc.magic); if (!JS_IsException(ret_val) && done != 2) { ret_val = js_create_iterator_result(ctx, ret_val, done); } } break; default: abort(); } rt->current_stack_frame = sf->prev_frame; return ret_val; } static JSValue js_call_bound_function(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv, int flags) { JSObject *p; JSBoundFunction *bf; JSValueConst *arg_buf, new_target; int arg_count, i; p = JS_VALUE_GET_OBJ(func_obj); bf = p->u.bound_function; arg_count = bf->argc + argc; if (js_check_stack_overflow(ctx->rt, sizeof(JSValue) * arg_count)) return JS_ThrowStackOverflow(ctx); arg_buf = alloca(sizeof(JSValue) * arg_count); for(i = 0; i < bf->argc; i++) { arg_buf[i] = bf->argv[i]; } for(i = 0; i < argc; i++) { arg_buf[bf->argc + i] = argv[i]; } if (flags & JS_CALL_FLAG_CONSTRUCTOR) { new_target = this_obj; if (js_same_value(ctx, func_obj, new_target)) new_target = bf->func_obj; return JS_CallConstructor2(ctx, bf->func_obj, new_target, arg_count, arg_buf); } else { return JS_Call(ctx, bf->func_obj, bf->this_val, arg_count, arg_buf); } } /* argument of OP_special_object */ typedef enum { OP_SPECIAL_OBJECT_ARGUMENTS, OP_SPECIAL_OBJECT_MAPPED_ARGUMENTS, OP_SPECIAL_OBJECT_THIS_FUNC, OP_SPECIAL_OBJECT_NEW_TARGET, OP_SPECIAL_OBJECT_HOME_OBJECT, OP_SPECIAL_OBJECT_VAR_OBJECT, OP_SPECIAL_OBJECT_IMPORT_META, OP_SPECIAL_OBJECT_NULL_PROTO, } OPSpecialObjectEnum; #define FUNC_RET_AWAIT 0 #define FUNC_RET_YIELD 1 #define FUNC_RET_YIELD_STAR 2 #ifdef ENABLE_DUMPS // JS_DUMP_BYTECODE_* static void dump_single_byte_code(JSContext *ctx, const uint8_t *pc, JSFunctionBytecode *b, int start_pos); static void print_func_name(JSFunctionBytecode *b); #endif static bool needs_backtrace(JSValue exc) { JSObject *p; if (JS_VALUE_GET_TAG(exc) != JS_TAG_OBJECT) return false; p = JS_VALUE_GET_OBJ(exc); if (p->class_id != JS_CLASS_ERROR) return false; return !find_own_property1(p, JS_ATOM_stack); } /* argv[] is modified if (flags & JS_CALL_FLAG_COPY_ARGV) = 0. */ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj, JSValueConst this_obj, JSValueConst new_target, int argc, JSValueConst *argv, int flags) { JSRuntime *rt = caller_ctx->rt; JSContext *ctx; JSObject *p; JSFunctionBytecode *b; JSStackFrame sf_s, *sf = &sf_s; uint8_t *pc; int opcode, arg_allocated_size, i; JSValue *local_buf, *stack_buf, *var_buf, *arg_buf, *sp, ret_val, *pval; JSVarRef **var_refs; size_t alloca_size; #ifdef ENABLE_DUMPS // JS_DUMP_BYTECODE_STEP #define DUMP_BYTECODE_OR_DONT(pc) \ if (check_dump_flag(ctx->rt, JS_DUMP_BYTECODE_STEP)) dump_single_byte_code(ctx, pc, b, 0); #else #define DUMP_BYTECODE_OR_DONT(pc) #endif #if !DIRECT_DISPATCH #define SWITCH(pc) DUMP_BYTECODE_OR_DONT(pc) switch (opcode = *pc++) #define CASE(op) case op #define DEFAULT default #define BREAK break #else __extension__ static const void * const dispatch_table[256] = { #define DEF(id, size, n_pop, n_push, f) && case_OP_ ## id, #define def(id, size, n_pop, n_push, f) #include "quickjs-opcode.h" [ OP_COUNT ... 255 ] = &&case_default }; #define SWITCH(pc) DUMP_BYTECODE_OR_DONT(pc) __extension__ ({ goto *dispatch_table[opcode = *pc++]; }); #define CASE(op) case_ ## op #define DEFAULT case_default #define BREAK SWITCH(pc) #endif if (js_poll_interrupts(caller_ctx)) return JS_EXCEPTION; if (unlikely(JS_VALUE_GET_TAG(func_obj) != JS_TAG_OBJECT)) { if (flags & JS_CALL_FLAG_GENERATOR) { JSAsyncFunctionState *s = JS_VALUE_GET_PTR(func_obj); /* func_obj get contains a pointer to JSFuncAsyncState */ /* the stack frame is already allocated */ sf = &s->frame; p = JS_VALUE_GET_OBJ(sf->cur_func); b = p->u.func.function_bytecode; ctx = b->realm; var_refs = p->u.func.var_refs; local_buf = arg_buf = sf->arg_buf; var_buf = sf->var_buf; stack_buf = sf->var_buf + b->var_count; sp = sf->cur_sp; sf->cur_sp = NULL; /* cur_sp is NULL if the function is running */ pc = sf->cur_pc; sf->prev_frame = rt->current_stack_frame; rt->current_stack_frame = sf; if (s->throw_flag) goto exception; else goto restart; } else { goto not_a_function; } } p = JS_VALUE_GET_OBJ(func_obj); if (unlikely(p->class_id != JS_CLASS_BYTECODE_FUNCTION)) { JSClassCall *call_func; call_func = rt->class_array[p->class_id].call; if (!call_func) { not_a_function: return JS_ThrowTypeErrorNotAFunction(caller_ctx); } return call_func(caller_ctx, func_obj, this_obj, argc, argv, flags); } b = p->u.func.function_bytecode; if (unlikely(argc < b->arg_count || (flags & JS_CALL_FLAG_COPY_ARGV))) { arg_allocated_size = b->arg_count; } else { arg_allocated_size = 0; } alloca_size = sizeof(JSValue) * (arg_allocated_size + b->var_count + b->stack_size); if (js_check_stack_overflow(rt, alloca_size)) return JS_ThrowStackOverflow(caller_ctx); sf->is_strict_mode = b->is_strict_mode; arg_buf = (JSValue *)argv; sf->arg_count = argc; sf->cur_func = unsafe_unconst(func_obj); init_list_head(&sf->var_ref_list); var_refs = p->u.func.var_refs; local_buf = alloca(alloca_size); if (unlikely(arg_allocated_size)) { int n = min_int(argc, b->arg_count); arg_buf = local_buf; for(i = 0; i < n; i++) arg_buf[i] = js_dup(argv[i]); for(; i < b->arg_count; i++) arg_buf[i] = JS_UNDEFINED; sf->arg_count = b->arg_count; } var_buf = local_buf + arg_allocated_size; sf->var_buf = var_buf; sf->arg_buf = arg_buf; for(i = 0; i < b->var_count; i++) var_buf[i] = JS_UNDEFINED; stack_buf = var_buf + b->var_count; sp = stack_buf; pc = b->byte_code_buf; /* sf->cur_pc must we set to pc before any recursive calls to JS_CallInternal. */ sf->cur_pc = NULL; sf->prev_frame = rt->current_stack_frame; rt->current_stack_frame = sf; ctx = b->realm; /* set the current realm */ if (ctx->handleFunctionEntered) ctx->handleFunctionEntered(ctx, this_obj); #ifdef ENABLE_DUMPS // JS_DUMP_BYTECODE_STEP if (check_dump_flag(ctx->rt, JS_DUMP_BYTECODE_STEP)) print_func_name(b); #endif restart: for(;;) { int call_argc; JSValue *call_argv; SWITCH(pc) { CASE(OP_push_i32): *sp++ = js_int32(get_u32(pc)); pc += 4; BREAK; CASE(OP_push_bigint_i32): *sp++ = __JS_NewShortBigInt(ctx, (int)get_u32(pc)); pc += 4; BREAK; CASE(OP_push_const): *sp++ = js_dup(b->cpool[get_u32(pc)]); pc += 4; BREAK; CASE(OP_push_minus1): CASE(OP_push_0): CASE(OP_push_1): CASE(OP_push_2): CASE(OP_push_3): CASE(OP_push_4): CASE(OP_push_5): CASE(OP_push_6): CASE(OP_push_7): *sp++ = js_int32(opcode - OP_push_0); BREAK; CASE(OP_push_i8): *sp++ = js_int32(get_i8(pc)); pc += 1; BREAK; CASE(OP_push_i16): *sp++ = js_int32(get_i16(pc)); pc += 2; BREAK; CASE(OP_push_const8): *sp++ = js_dup(b->cpool[*pc++]); BREAK; CASE(OP_fclosure8): *sp++ = js_closure(ctx, js_dup(b->cpool[*pc++]), var_refs, sf); if (unlikely(JS_IsException(sp[-1]))) goto exception; BREAK; CASE(OP_push_empty_string): *sp++ = js_empty_string(rt); BREAK; CASE(OP_get_length): { JSValue val; sf->cur_pc = pc; val = JS_GetProperty(ctx, sp[-1], JS_ATOM_length); if (unlikely(JS_IsException(val))) goto exception; JS_FreeValue(ctx, sp[-1]); sp[-1] = val; } BREAK; CASE(OP_push_atom_value): *sp++ = JS_AtomToValue(ctx, get_u32(pc)); pc += 4; BREAK; CASE(OP_undefined): *sp++ = JS_UNDEFINED; BREAK; CASE(OP_null): *sp++ = JS_NULL; BREAK; CASE(OP_push_this): /* OP_push_this is only called at the start of a function */ { JSValue val; if (!b->is_strict_mode) { uint32_t tag = JS_VALUE_GET_TAG(this_obj); if (likely(tag == JS_TAG_OBJECT)) goto normal_this; if (tag == JS_TAG_NULL || tag == JS_TAG_UNDEFINED) { val = js_dup(ctx->global_obj); } else { val = JS_ToObject(ctx, this_obj); if (JS_IsException(val)) goto exception; } } else { normal_this: val = js_dup(this_obj); } *sp++ = val; } BREAK; CASE(OP_push_false): *sp++ = JS_FALSE; BREAK; CASE(OP_push_true): *sp++ = JS_TRUE; BREAK; CASE(OP_object): *sp++ = JS_NewObject(ctx); if (unlikely(JS_IsException(sp[-1]))) goto exception; BREAK; CASE(OP_special_object): { int arg = *pc++; switch(arg) { case OP_SPECIAL_OBJECT_ARGUMENTS: *sp++ = js_build_arguments(ctx, argc, argv); if (unlikely(JS_IsException(sp[-1]))) goto exception; break; case OP_SPECIAL_OBJECT_MAPPED_ARGUMENTS: *sp++ = js_build_mapped_arguments(ctx, argc, argv, sf, min_int(argc, b->arg_count)); if (unlikely(JS_IsException(sp[-1]))) goto exception; break; case OP_SPECIAL_OBJECT_THIS_FUNC: *sp++ = js_dup(sf->cur_func); break; case OP_SPECIAL_OBJECT_NEW_TARGET: *sp++ = js_dup(new_target); break; case OP_SPECIAL_OBJECT_HOME_OBJECT: { JSObject *p1; p1 = p->u.func.home_object; if (unlikely(!p1)) *sp++ = JS_UNDEFINED; else *sp++ = js_dup(JS_MKPTR(JS_TAG_OBJECT, p1)); } break; case OP_SPECIAL_OBJECT_VAR_OBJECT: *sp++ = JS_NewObjectProto(ctx, JS_NULL); if (unlikely(JS_IsException(sp[-1]))) goto exception; break; case OP_SPECIAL_OBJECT_IMPORT_META: *sp++ = js_import_meta(ctx); if (unlikely(JS_IsException(sp[-1]))) goto exception; break; case OP_SPECIAL_OBJECT_NULL_PROTO: *sp++ = JS_NewObjectProtoClass(ctx, JS_NULL, JS_CLASS_OBJECT); if (unlikely(JS_IsException(sp[-1]))) goto exception; break; default: abort(); } } BREAK; CASE(OP_rest): { int i, n, first = get_u16(pc); pc += 2; i = min_int(first, argc); n = argc - i; *sp++ = js_create_array(ctx, n, &argv[i]); if (unlikely(JS_IsException(sp[-1]))) goto exception; } BREAK; CASE(OP_drop): JS_FreeValue(ctx, sp[-1]); sp--; BREAK; CASE(OP_nip): JS_FreeValue(ctx, sp[-2]); sp[-2] = sp[-1]; sp--; BREAK; CASE(OP_nip1): /* a b c -> b c */ JS_FreeValue(ctx, sp[-3]); sp[-3] = sp[-2]; sp[-2] = sp[-1]; sp--; BREAK; CASE(OP_dup): sp[0] = js_dup(sp[-1]); sp++; BREAK; CASE(OP_dup2): /* a b -> a b a b */ sp[0] = js_dup(sp[-2]); sp[1] = js_dup(sp[-1]); sp += 2; BREAK; CASE(OP_dup3): /* a b c -> a b c a b c */ sp[0] = js_dup(sp[-3]); sp[1] = js_dup(sp[-2]); sp[2] = js_dup(sp[-1]); sp += 3; BREAK; CASE(OP_dup1): /* a b -> a a b */ sp[0] = sp[-1]; sp[-1] = js_dup(sp[-2]); sp++; BREAK; CASE(OP_insert2): /* obj a -> a obj a (dup_x1) */ sp[0] = sp[-1]; sp[-1] = sp[-2]; sp[-2] = js_dup(sp[0]); sp++; BREAK; CASE(OP_insert3): /* obj prop a -> a obj prop a (dup_x2) */ sp[0] = sp[-1]; sp[-1] = sp[-2]; sp[-2] = sp[-3]; sp[-3] = js_dup(sp[0]); sp++; BREAK; CASE(OP_insert4): /* this obj prop a -> a this obj prop a */ sp[0] = sp[-1]; sp[-1] = sp[-2]; sp[-2] = sp[-3]; sp[-3] = sp[-4]; sp[-4] = js_dup(sp[0]); sp++; BREAK; CASE(OP_perm3): /* obj a b -> a obj b (213) */ { JSValue tmp; tmp = sp[-2]; sp[-2] = sp[-3]; sp[-3] = tmp; } BREAK; CASE(OP_rot3l): /* x a b -> a b x (231) */ { JSValue tmp; tmp = sp[-3]; sp[-3] = sp[-2]; sp[-2] = sp[-1]; sp[-1] = tmp; } BREAK; CASE(OP_rot4l): /* x a b c -> a b c x */ { JSValue tmp; tmp = sp[-4]; sp[-4] = sp[-3]; sp[-3] = sp[-2]; sp[-2] = sp[-1]; sp[-1] = tmp; } BREAK; CASE(OP_rot5l): /* x a b c d -> a b c d x */ { JSValue tmp; tmp = sp[-5]; sp[-5] = sp[-4]; sp[-4] = sp[-3]; sp[-3] = sp[-2]; sp[-2] = sp[-1]; sp[-1] = tmp; } BREAK; CASE(OP_rot3r): /* a b x -> x a b (312) */ { JSValue tmp; tmp = sp[-1]; sp[-1] = sp[-2]; sp[-2] = sp[-3]; sp[-3] = tmp; } BREAK; CASE(OP_perm4): /* obj prop a b -> a obj prop b */ { JSValue tmp; tmp = sp[-2]; sp[-2] = sp[-3]; sp[-3] = sp[-4]; sp[-4] = tmp; } BREAK; CASE(OP_perm5): /* this obj prop a b -> a this obj prop b */ { JSValue tmp; tmp = sp[-2]; sp[-2] = sp[-3]; sp[-3] = sp[-4]; sp[-4] = sp[-5]; sp[-5] = tmp; } BREAK; CASE(OP_swap): /* a b -> b a */ { JSValue tmp; tmp = sp[-2]; sp[-2] = sp[-1]; sp[-1] = tmp; } BREAK; CASE(OP_swap2): /* a b c d -> c d a b */ { JSValue tmp1, tmp2; tmp1 = sp[-4]; tmp2 = sp[-3]; sp[-4] = sp[-2]; sp[-3] = sp[-1]; sp[-2] = tmp1; sp[-1] = tmp2; } BREAK; CASE(OP_fclosure): { JSValue bfunc = js_dup(b->cpool[get_u32(pc)]); pc += 4; *sp++ = js_closure(ctx, bfunc, var_refs, sf); if (unlikely(JS_IsException(sp[-1]))) goto exception; } BREAK; CASE(OP_call0): CASE(OP_call1): CASE(OP_call2): CASE(OP_call3): call_argc = opcode - OP_call0; goto has_call_argc; CASE(OP_call): CASE(OP_tail_call): { call_argc = get_u16(pc); pc += 2; goto has_call_argc; has_call_argc: call_argv = sp - call_argc; sf->cur_pc = pc; ret_val = JS_CallInternal(ctx, call_argv[-1], JS_UNDEFINED, JS_UNDEFINED, call_argc, vc(call_argv), 0); if (unlikely(JS_IsException(ret_val))) goto exception; if (opcode == OP_tail_call) goto done; for(i = -1; i < call_argc; i++) JS_FreeValue(ctx, call_argv[i]); sp -= call_argc + 1; *sp++ = ret_val; } BREAK; CASE(OP_call_constructor): { call_argc = get_u16(pc); pc += 2; call_argv = sp - call_argc; sf->cur_pc = pc; ret_val = JS_CallConstructorInternal(ctx, call_argv[-2], call_argv[-1], call_argc, vc(call_argv), 0); if (unlikely(JS_IsException(ret_val))) goto exception; for(i = -2; i < call_argc; i++) JS_FreeValue(ctx, call_argv[i]); sp -= call_argc + 2; *sp++ = ret_val; } BREAK; CASE(OP_call_method): CASE(OP_tail_call_method): { call_argc = get_u16(pc); pc += 2; call_argv = sp - call_argc; sf->cur_pc = pc; ret_val = JS_CallInternal(ctx, call_argv[-1], call_argv[-2], JS_UNDEFINED, call_argc, vc(call_argv), 0); if (unlikely(JS_IsException(ret_val))) goto exception; if (opcode == OP_tail_call_method) goto done; for(i = -2; i < call_argc; i++) JS_FreeValue(ctx, call_argv[i]); sp -= call_argc + 2; *sp++ = ret_val; } BREAK; CASE(OP_array_from): { call_argc = get_u16(pc); pc += 2; call_argv = sp - call_argc; ret_val = JS_NewArrayFrom(ctx, call_argc, call_argv); sp -= call_argc; if (unlikely(JS_IsException(ret_val))) goto exception; *sp++ = ret_val; } BREAK; CASE(OP_apply): { int magic; magic = get_u16(pc); pc += 2; sf->cur_pc = pc; ret_val = js_function_apply(ctx, sp[-3], 2, vc(&sp[-2]), magic); if (unlikely(JS_IsException(ret_val))) goto exception; JS_FreeValue(ctx, sp[-3]); JS_FreeValue(ctx, sp[-2]); JS_FreeValue(ctx, sp[-1]); sp -= 3; *sp++ = ret_val; } BREAK; CASE(OP_return): ret_val = *--sp; goto done; CASE(OP_return_undef): ret_val = JS_UNDEFINED; goto done; CASE(OP_check_ctor_return): /* return true if 'this' should be returned */ if (!JS_IsObject(sp[-1])) { if (!JS_IsUndefined(sp[-1])) { JS_ThrowTypeError(caller_ctx, "derived class constructor must return an object or undefined"); goto exception; } sp[0] = JS_TRUE; } else { sp[0] = JS_FALSE; } sp++; BREAK; CASE(OP_check_ctor): if (JS_IsUndefined(new_target)) { non_ctor_call: JS_ThrowTypeError(ctx, "class constructors must be invoked with 'new'"); goto exception; } BREAK; CASE(OP_init_ctor): { JSValue super, ret; sf->cur_pc = pc; if (JS_IsUndefined(new_target)) goto non_ctor_call; super = JS_GetPrototype(ctx, func_obj); if (JS_IsException(super)) goto exception; ret = JS_CallConstructor2(ctx, super, new_target, argc, argv); JS_FreeValue(ctx, super); if (JS_IsException(ret)) goto exception; *sp++ = ret; } BREAK; CASE(OP_check_brand): { int ret = JS_CheckBrand(ctx, sp[-2], sp[-1]); if (ret < 0) goto exception; if (!ret) { JS_ThrowTypeError(ctx, "invalid brand on object"); goto exception; } } BREAK; CASE(OP_add_brand): if (JS_AddBrand(ctx, sp[-2], sp[-1]) < 0) goto exception; JS_FreeValue(ctx, sp[-2]); JS_FreeValue(ctx, sp[-1]); sp -= 2; BREAK; CASE(OP_throw): JS_Throw(ctx, *--sp); goto exception; CASE(OP_throw_error): #define JS_THROW_VAR_RO 0 #define JS_THROW_VAR_REDECL 1 #define JS_THROW_VAR_UNINITIALIZED 2 #define JS_THROW_ERROR_DELETE_SUPER 3 #define JS_THROW_ERROR_ITERATOR_THROW 4 { JSAtom atom; int type; atom = get_u32(pc); type = pc[4]; pc += 5; if (type == JS_THROW_VAR_RO) JS_ThrowTypeErrorReadOnly(ctx, JS_PROP_THROW, atom); else if (type == JS_THROW_VAR_REDECL) JS_ThrowSyntaxErrorVarRedeclaration(ctx, atom); else if (type == JS_THROW_VAR_UNINITIALIZED) JS_ThrowReferenceErrorUninitialized(ctx, atom); else if (type == JS_THROW_ERROR_DELETE_SUPER) JS_ThrowReferenceError(ctx, "unsupported reference to 'super'"); else if (type == JS_THROW_ERROR_ITERATOR_THROW) JS_ThrowTypeError(ctx, "iterator does not have a throw method"); else JS_ThrowInternalError(ctx, "invalid throw var type %d", type); } goto exception; CASE(OP_eval): { JSValue obj; int scope_idx; call_argc = get_u16(pc); scope_idx = get_u16(pc + 2) - 1; pc += 4; call_argv = sp - call_argc; sf->cur_pc = pc; if (js_same_value(ctx, call_argv[-1], ctx->eval_obj)) { if (call_argc >= 1) obj = call_argv[0]; else obj = JS_UNDEFINED; ret_val = JS_EvalObject(ctx, JS_UNDEFINED, obj, JS_EVAL_TYPE_DIRECT, scope_idx); } else { ret_val = JS_CallInternal(ctx, call_argv[-1], JS_UNDEFINED, JS_UNDEFINED, call_argc, vc(call_argv), 0); } if (unlikely(JS_IsException(ret_val))) goto exception; for(i = -1; i < call_argc; i++) JS_FreeValue(ctx, call_argv[i]); sp -= call_argc + 1; *sp++ = ret_val; } BREAK; /* could merge with OP_apply */ CASE(OP_apply_eval): { int scope_idx; uint32_t len; JSValue *tab; JSValue obj; scope_idx = get_u16(pc) - 1; pc += 2; sf->cur_pc = pc; tab = build_arg_list(ctx, &len, sp[-1]); if (!tab) goto exception; if (js_same_value(ctx, sp[-2], ctx->eval_obj)) { if (len >= 1) obj = tab[0]; else obj = JS_UNDEFINED; ret_val = JS_EvalObject(ctx, JS_UNDEFINED, obj, JS_EVAL_TYPE_DIRECT, scope_idx); } else { ret_val = JS_Call(ctx, sp[-2], JS_UNDEFINED, len, vc(tab)); } free_arg_list(ctx, tab, len); if (unlikely(JS_IsException(ret_val))) goto exception; JS_FreeValue(ctx, sp[-2]); JS_FreeValue(ctx, sp[-1]); sp -= 2; *sp++ = ret_val; } BREAK; CASE(OP_regexp): { sp[-2] = js_regexp_constructor_internal(ctx, JS_UNDEFINED, sp[-2], sp[-1]); sp--; } BREAK; CASE(OP_get_super): { JSValue proto; proto = JS_GetPrototype(ctx, sp[-1]); if (JS_IsException(proto)) goto exception; JS_FreeValue(ctx, sp[-1]); sp[-1] = proto; } BREAK; CASE(OP_import): { JSValue val; sf->cur_pc = pc; val = js_dynamic_import(ctx, sp[-1]); if (JS_IsException(val)) goto exception; JS_FreeValue(ctx, sp[-1]); sp[-1] = val; } BREAK; CASE(OP_check_var): { int ret; JSAtom atom; atom = get_u32(pc); pc += 4; ret = JS_CheckGlobalVar(ctx, atom); if (ret < 0) goto exception; *sp++ = js_bool(ret); } BREAK; CASE(OP_get_var_undef): CASE(OP_get_var): { JSValue val; JSAtom atom; atom = get_u32(pc); pc += 4; sf->cur_pc = pc; val = JS_GetGlobalVar(ctx, atom, opcode - OP_get_var_undef); if (unlikely(JS_IsException(val))) goto exception; *sp++ = val; } BREAK; CASE(OP_put_var): CASE(OP_put_var_init): { int ret; JSAtom atom; atom = get_u32(pc); pc += 4; sf->cur_pc = pc; ret = JS_SetGlobalVar(ctx, atom, sp[-1], opcode - OP_put_var); sp--; if (unlikely(ret < 0)) goto exception; } BREAK; CASE(OP_put_var_strict): { int ret; JSAtom atom; atom = get_u32(pc); pc += 4; sf->cur_pc = pc; /* sp[-2] is JS_TRUE or JS_FALSE */ if (unlikely(!JS_VALUE_GET_INT(sp[-2]))) { JS_ThrowReferenceErrorNotDefined(ctx, atom); goto exception; } ret = JS_SetGlobalVar(ctx, atom, sp[-1], 2); sp -= 2; if (unlikely(ret < 0)) goto exception; } BREAK; CASE(OP_check_define_var): { JSAtom atom; int flags; atom = get_u32(pc); flags = pc[4]; pc += 5; if (JS_CheckDefineGlobalVar(ctx, atom, flags)) goto exception; } BREAK; CASE(OP_define_var): { JSAtom atom; int flags; atom = get_u32(pc); flags = pc[4]; pc += 5; if (JS_DefineGlobalVar(ctx, atom, flags)) goto exception; } BREAK; CASE(OP_define_func): { JSAtom atom; int flags; atom = get_u32(pc); flags = pc[4]; pc += 5; if (JS_DefineGlobalFunction(ctx, atom, sp[-1], flags)) goto exception; JS_FreeValue(ctx, sp[-1]); sp--; } BREAK; CASE(OP_get_loc): { int idx; idx = get_u16(pc); pc += 2; sp[0] = js_dup(var_buf[idx]); sp++; } BREAK; CASE(OP_put_loc): { int idx; idx = get_u16(pc); pc += 2; set_value(ctx, &var_buf[idx], sp[-1]); sp--; } BREAK; CASE(OP_set_loc): { int idx; idx = get_u16(pc); pc += 2; set_value(ctx, &var_buf[idx], js_dup(sp[-1])); } BREAK; CASE(OP_get_arg): { int idx; idx = get_u16(pc); pc += 2; sp[0] = js_dup(arg_buf[idx]); sp++; } BREAK; CASE(OP_put_arg): { int idx; idx = get_u16(pc); pc += 2; set_value(ctx, &arg_buf[idx], sp[-1]); sp--; } BREAK; CASE(OP_set_arg): { int idx; idx = get_u16(pc); pc += 2; set_value(ctx, &arg_buf[idx], js_dup(sp[-1])); } BREAK; CASE(OP_get_loc8): *sp++ = js_dup(var_buf[*pc++]); BREAK; CASE(OP_put_loc8): set_value(ctx, &var_buf[*pc++], *--sp); BREAK; CASE(OP_set_loc8): set_value(ctx, &var_buf[*pc++], js_dup(sp[-1])); BREAK; // Observation: get_loc0 and get_loc1 are individually very // frequent opcodes _and_ they are very often paired together, // making them ideal candidates for opcode fusion. CASE(OP_get_loc0_loc1): *sp++ = js_dup(var_buf[0]); *sp++ = js_dup(var_buf[1]); BREAK; CASE(OP_get_loc0): *sp++ = js_dup(var_buf[0]); BREAK; CASE(OP_get_loc1): *sp++ = js_dup(var_buf[1]); BREAK; CASE(OP_get_loc2): *sp++ = js_dup(var_buf[2]); BREAK; CASE(OP_get_loc3): *sp++ = js_dup(var_buf[3]); BREAK; CASE(OP_put_loc0): set_value(ctx, &var_buf[0], *--sp); BREAK; CASE(OP_put_loc1): set_value(ctx, &var_buf[1], *--sp); BREAK; CASE(OP_put_loc2): set_value(ctx, &var_buf[2], *--sp); BREAK; CASE(OP_put_loc3): set_value(ctx, &var_buf[3], *--sp); BREAK; CASE(OP_set_loc0): set_value(ctx, &var_buf[0], js_dup(sp[-1])); BREAK; CASE(OP_set_loc1): set_value(ctx, &var_buf[1], js_dup(sp[-1])); BREAK; CASE(OP_set_loc2): set_value(ctx, &var_buf[2], js_dup(sp[-1])); BREAK; CASE(OP_set_loc3): set_value(ctx, &var_buf[3], js_dup(sp[-1])); BREAK; CASE(OP_get_arg0): *sp++ = js_dup(arg_buf[0]); BREAK; CASE(OP_get_arg1): *sp++ = js_dup(arg_buf[1]); BREAK; CASE(OP_get_arg2): *sp++ = js_dup(arg_buf[2]); BREAK; CASE(OP_get_arg3): *sp++ = js_dup(arg_buf[3]); BREAK; CASE(OP_put_arg0): set_value(ctx, &arg_buf[0], *--sp); BREAK; CASE(OP_put_arg1): set_value(ctx, &arg_buf[1], *--sp); BREAK; CASE(OP_put_arg2): set_value(ctx, &arg_buf[2], *--sp); BREAK; CASE(OP_put_arg3): set_value(ctx, &arg_buf[3], *--sp); BREAK; CASE(OP_set_arg0): set_value(ctx, &arg_buf[0], js_dup(sp[-1])); BREAK; CASE(OP_set_arg1): set_value(ctx, &arg_buf[1], js_dup(sp[-1])); BREAK; CASE(OP_set_arg2): set_value(ctx, &arg_buf[2], js_dup(sp[-1])); BREAK; CASE(OP_set_arg3): set_value(ctx, &arg_buf[3], js_dup(sp[-1])); BREAK; CASE(OP_get_var_ref0): *sp++ = js_dup(*var_refs[0]->pvalue); BREAK; CASE(OP_get_var_ref1): *sp++ = js_dup(*var_refs[1]->pvalue); BREAK; CASE(OP_get_var_ref2): *sp++ = js_dup(*var_refs[2]->pvalue); BREAK; CASE(OP_get_var_ref3): *sp++ = js_dup(*var_refs[3]->pvalue); BREAK; CASE(OP_put_var_ref0): set_value(ctx, var_refs[0]->pvalue, *--sp); BREAK; CASE(OP_put_var_ref1): set_value(ctx, var_refs[1]->pvalue, *--sp); BREAK; CASE(OP_put_var_ref2): set_value(ctx, var_refs[2]->pvalue, *--sp); BREAK; CASE(OP_put_var_ref3): set_value(ctx, var_refs[3]->pvalue, *--sp); BREAK; CASE(OP_set_var_ref0): set_value(ctx, var_refs[0]->pvalue, js_dup(sp[-1])); BREAK; CASE(OP_set_var_ref1): set_value(ctx, var_refs[1]->pvalue, js_dup(sp[-1])); BREAK; CASE(OP_set_var_ref2): set_value(ctx, var_refs[2]->pvalue, js_dup(sp[-1])); BREAK; CASE(OP_set_var_ref3): set_value(ctx, var_refs[3]->pvalue, js_dup(sp[-1])); BREAK; CASE(OP_get_var_ref): { int idx; JSValue val; idx = get_u16(pc); pc += 2; val = *var_refs[idx]->pvalue; sp[0] = js_dup(val); sp++; } BREAK; CASE(OP_put_var_ref): { int idx; idx = get_u16(pc); pc += 2; set_value(ctx, var_refs[idx]->pvalue, sp[-1]); sp--; } BREAK; CASE(OP_set_var_ref): { int idx; idx = get_u16(pc); pc += 2; set_value(ctx, var_refs[idx]->pvalue, js_dup(sp[-1])); } BREAK; CASE(OP_get_var_ref_check): { int idx; JSValue val; idx = get_u16(pc); pc += 2; val = *var_refs[idx]->pvalue; if (unlikely(JS_IsUninitialized(val))) { JS_ThrowReferenceErrorUninitialized2(ctx, b, idx, true); goto exception; } sp[0] = js_dup(val); sp++; } BREAK; CASE(OP_put_var_ref_check): { int idx; idx = get_u16(pc); pc += 2; if (unlikely(JS_IsUninitialized(*var_refs[idx]->pvalue))) { JS_ThrowReferenceErrorUninitialized2(ctx, b, idx, true); goto exception; } set_value(ctx, var_refs[idx]->pvalue, sp[-1]); sp--; } BREAK; CASE(OP_put_var_ref_check_init): { int idx; idx = get_u16(pc); pc += 2; if (unlikely(!JS_IsUninitialized(*var_refs[idx]->pvalue))) { JS_ThrowReferenceErrorUninitialized2(ctx, b, idx, true); goto exception; } set_value(ctx, var_refs[idx]->pvalue, sp[-1]); sp--; } BREAK; CASE(OP_set_loc_uninitialized): { int idx; idx = get_u16(pc); pc += 2; set_value(ctx, &var_buf[idx], JS_UNINITIALIZED); } BREAK; CASE(OP_get_loc_check): { int idx; idx = get_u16(pc); pc += 2; if (unlikely(JS_IsUninitialized(var_buf[idx]))) { JS_ThrowReferenceErrorUninitialized2(caller_ctx, b, idx, false); goto exception; } sp[0] = js_dup(var_buf[idx]); sp++; } BREAK; CASE(OP_put_loc_check): { int idx; idx = get_u16(pc); pc += 2; if (unlikely(JS_IsUninitialized(var_buf[idx]))) { JS_ThrowReferenceErrorUninitialized2(caller_ctx, b, idx, false); goto exception; } set_value(ctx, &var_buf[idx], sp[-1]); sp--; } BREAK; CASE(OP_put_loc_check_init): { int idx; idx = get_u16(pc); pc += 2; if (unlikely(!JS_IsUninitialized(var_buf[idx]))) { JS_ThrowReferenceError(caller_ctx, "'this' can be initialized only once"); goto exception; } set_value(ctx, &var_buf[idx], sp[-1]); sp--; } BREAK; CASE(OP_close_loc): { int idx; idx = get_u16(pc); pc += 2; close_lexical_var(ctx, sf, idx); } BREAK; CASE(OP_make_loc_ref): CASE(OP_make_arg_ref): CASE(OP_make_var_ref_ref): { JSVarRef *var_ref; JSProperty *pr; JSAtom atom; int idx; atom = get_u32(pc); idx = get_u16(pc + 4); pc += 6; *sp++ = JS_NewObjectProto(ctx, JS_NULL); if (unlikely(JS_IsException(sp[-1]))) goto exception; if (opcode == OP_make_var_ref_ref) { var_ref = var_refs[idx]; var_ref->header.ref_count++; } else { var_ref = get_var_ref(ctx, sf, idx, opcode == OP_make_arg_ref); if (!var_ref) goto exception; } pr = add_property(ctx, JS_VALUE_GET_OBJ(sp[-1]), atom, JS_PROP_WRITABLE | JS_PROP_VARREF); if (!pr) { free_var_ref(rt, var_ref); goto exception; } pr->u.var_ref = var_ref; *sp++ = JS_AtomToValue(ctx, atom); } BREAK; CASE(OP_make_var_ref): { JSAtom atom; atom = get_u32(pc); pc += 4; if (JS_GetGlobalVarRef(ctx, atom, sp)) goto exception; sp += 2; } BREAK; CASE(OP_goto): pc += (int32_t)get_u32(pc); if (unlikely(js_poll_interrupts(ctx))) goto exception; BREAK; CASE(OP_goto16): pc += (int16_t)get_u16(pc); if (unlikely(js_poll_interrupts(ctx))) goto exception; BREAK; CASE(OP_goto8): pc += (int8_t)pc[0]; if (unlikely(js_poll_interrupts(ctx))) goto exception; BREAK; CASE(OP_if_true): { int res; JSValue op1; op1 = sp[-1]; pc += 4; if ((uint32_t)JS_VALUE_GET_TAG(op1) <= JS_TAG_UNDEFINED) { res = JS_VALUE_GET_INT(op1); } else { res = JS_ToBoolFree(ctx, op1); } sp--; if (res) { pc += (int32_t)get_u32(pc - 4) - 4; } if (unlikely(js_poll_interrupts(ctx))) goto exception; } BREAK; CASE(OP_if_false): { int res; JSValue op1; op1 = sp[-1]; pc += 4; if ((uint32_t)JS_VALUE_GET_TAG(op1) <= JS_TAG_UNDEFINED) { res = JS_VALUE_GET_INT(op1); } else { res = JS_ToBoolFree(ctx, op1); } sp--; if (!res) { pc += (int32_t)get_u32(pc - 4) - 4; } if (unlikely(js_poll_interrupts(ctx))) goto exception; } BREAK; CASE(OP_if_true8): { int res; JSValue op1; op1 = sp[-1]; pc += 1; if ((uint32_t)JS_VALUE_GET_TAG(op1) <= JS_TAG_UNDEFINED) { res = JS_VALUE_GET_INT(op1); } else { res = JS_ToBoolFree(ctx, op1); } sp--; if (res) { pc += (int8_t)pc[-1] - 1; } if (unlikely(js_poll_interrupts(ctx))) goto exception; } BREAK; CASE(OP_if_false8): { int res; JSValue op1; op1 = sp[-1]; pc += 1; if ((uint32_t)JS_VALUE_GET_TAG(op1) <= JS_TAG_UNDEFINED) { res = JS_VALUE_GET_INT(op1); } else { res = JS_ToBoolFree(ctx, op1); } sp--; if (!res) { pc += (int8_t)pc[-1] - 1; } if (unlikely(js_poll_interrupts(ctx))) goto exception; } BREAK; CASE(OP_catch): { int32_t diff; diff = get_u32(pc); sp[0] = JS_NewCatchOffset(ctx, pc + diff - b->byte_code_buf); sp++; pc += 4; } BREAK; CASE(OP_gosub): { int32_t diff; diff = get_u32(pc); /* XXX: should have a different tag to avoid security flaw */ sp[0] = js_int32(pc + 4 - b->byte_code_buf); sp++; pc += diff; } BREAK; CASE(OP_ret): { JSValue op1; uint32_t pos; op1 = sp[-1]; if (unlikely(JS_VALUE_GET_TAG(op1) != JS_TAG_INT)) goto ret_fail; pos = JS_VALUE_GET_INT(op1); if (unlikely(pos >= b->byte_code_len)) { ret_fail: JS_ThrowInternalError(ctx, "invalid ret value"); goto exception; } sp--; pc = b->byte_code_buf + pos; } BREAK; CASE(OP_for_in_start): sf->cur_pc = pc; if (js_for_in_start(ctx, sp)) goto exception; BREAK; CASE(OP_for_in_next): sf->cur_pc = pc; if (js_for_in_next(ctx, sp)) goto exception; sp += 2; BREAK; CASE(OP_for_of_start): sf->cur_pc = pc; if (js_for_of_start(ctx, sp, false)) goto exception; sp += 1; *sp++ = JS_NewCatchOffset(ctx, 0); BREAK; CASE(OP_for_of_next): { int offset = -3 - pc[0]; pc += 1; sf->cur_pc = pc; if (js_for_of_next(ctx, sp, offset)) goto exception; sp += 2; } BREAK; CASE(OP_for_await_of_start): sf->cur_pc = pc; if (js_for_of_start(ctx, sp, true)) goto exception; sp += 1; *sp++ = JS_NewCatchOffset(ctx, 0); BREAK; CASE(OP_iterator_get_value_done): sf->cur_pc = pc; if (js_iterator_get_value_done(ctx, sp)) goto exception; sp += 1; BREAK; CASE(OP_iterator_check_object): if (unlikely(!JS_IsObject(sp[-1]))) { JS_ThrowTypeError(ctx, "iterator must return an object"); goto exception; } BREAK; CASE(OP_iterator_close): /* iter_obj next catch_offset -> */ sp--; /* drop the catch offset to avoid getting caught by exception */ JS_FreeValue(ctx, sp[-1]); /* drop the next method */ sp--; if (!JS_IsUndefined(sp[-1])) { sf->cur_pc = pc; if (JS_IteratorClose(ctx, sp[-1], false)) goto exception; JS_FreeValue(ctx, sp[-1]); } sp--; BREAK; CASE(OP_nip_catch): { JSValue ret_val; /* catch_offset ... ret_val -> ret_eval */ ret_val = *--sp; while (sp > stack_buf && JS_VALUE_GET_TAG(sp[-1]) != JS_TAG_CATCH_OFFSET) { JS_FreeValue(ctx, *--sp); } if (unlikely(sp == stack_buf)) { JS_ThrowInternalError(ctx, "nip_catch"); JS_FreeValue(ctx, ret_val); goto exception; } sp[-1] = ret_val; } BREAK; CASE(OP_iterator_next): /* stack: iter_obj next catch_offset val */ { JSValue ret; sf->cur_pc = pc; ret = JS_Call(ctx, sp[-3], sp[-4], 1, vc(sp - 1)); if (JS_IsException(ret)) goto exception; JS_FreeValue(ctx, sp[-1]); sp[-1] = ret; } BREAK; CASE(OP_iterator_call): /* stack: iter_obj next catch_offset val */ { JSValue method, ret; bool ret_flag; int flags; flags = *pc++; sf->cur_pc = pc; method = JS_GetProperty(ctx, sp[-4], (flags & 1) ? JS_ATOM_throw : JS_ATOM_return); if (JS_IsException(method)) goto exception; if (JS_IsUndefined(method) || JS_IsNull(method)) { ret_flag = true; } else { if (flags & 2) { /* no argument */ ret = JS_CallFree(ctx, method, sp[-4], 0, NULL); } else { ret = JS_CallFree(ctx, method, sp[-4], 1, vc(sp - 1)); } if (JS_IsException(ret)) goto exception; JS_FreeValue(ctx, sp[-1]); sp[-1] = ret; ret_flag = false; } sp[0] = js_bool(ret_flag); sp += 1; } BREAK; CASE(OP_lnot): { int res; JSValue op1; op1 = sp[-1]; if ((uint32_t)JS_VALUE_GET_TAG(op1) <= JS_TAG_UNDEFINED) { res = JS_VALUE_GET_INT(op1) != 0; } else { res = JS_ToBoolFree(ctx, op1); } sp[-1] = js_bool(!res); } BREAK; CASE(OP_get_field): { JSValue val; JSAtom atom; atom = get_u32(pc); pc += 4; sf->cur_pc = pc; val = JS_GetPropertyInternal(ctx, sp[-1], atom, sp[-1], false); if (unlikely(JS_IsException(val))) goto exception; JS_FreeValue(ctx, sp[-1]); sp[-1] = val; } BREAK; CASE(OP_get_field2): { JSValue val; JSAtom atom; atom = get_u32(pc); pc += 4; sf->cur_pc = pc; val = JS_GetPropertyInternal(ctx, sp[-1], atom, sp[-1], false); if (unlikely(JS_IsException(val))) goto exception; *sp++ = val; } BREAK; CASE(OP_put_field): { int ret; JSAtom atom; atom = get_u32(pc); pc += 4; sf->cur_pc = pc; ret = JS_SetPropertyInternal2(ctx, sp[-2], atom, sp[-1], sp[-2], JS_PROP_THROW_STRICT); JS_FreeValue(ctx, sp[-2]); sp -= 2; if (unlikely(ret < 0)) goto exception; } BREAK; CASE(OP_private_symbol): { JSAtom atom; JSValue val; atom = get_u32(pc); pc += 4; val = JS_NewSymbolFromAtom(ctx, atom, JS_ATOM_TYPE_PRIVATE); if (JS_IsException(val)) goto exception; *sp++ = val; } BREAK; CASE(OP_get_private_field): { JSValue val; sf->cur_pc = pc; val = JS_GetPrivateField(ctx, sp[-2], sp[-1]); JS_FreeValue(ctx, sp[-1]); JS_FreeValue(ctx, sp[-2]); sp[-2] = val; sp--; if (unlikely(JS_IsException(val))) goto exception; } BREAK; CASE(OP_put_private_field): { int ret; sf->cur_pc = pc; ret = JS_SetPrivateField(ctx, sp[-3], sp[-1], sp[-2]); JS_FreeValue(ctx, sp[-3]); JS_FreeValue(ctx, sp[-1]); sp -= 3; if (unlikely(ret < 0)) goto exception; } BREAK; CASE(OP_define_private_field): { int ret; ret = JS_DefinePrivateField(ctx, sp[-3], sp[-2], sp[-1]); JS_FreeValue(ctx, sp[-2]); sp -= 2; if (unlikely(ret < 0)) goto exception; } BREAK; CASE(OP_define_field): { int ret; JSAtom atom; atom = get_u32(pc); pc += 4; ret = JS_DefinePropertyValue(ctx, sp[-2], atom, sp[-1], JS_PROP_C_W_E | JS_PROP_THROW); sp--; if (unlikely(ret < 0)) goto exception; } BREAK; CASE(OP_set_name): { int ret; JSAtom atom; atom = get_u32(pc); pc += 4; ret = JS_DefineObjectName(ctx, sp[-1], atom, JS_PROP_CONFIGURABLE); if (unlikely(ret < 0)) goto exception; } BREAK; CASE(OP_set_name_computed): { int ret; ret = JS_DefineObjectNameComputed(ctx, sp[-1], sp[-2], JS_PROP_CONFIGURABLE); if (unlikely(ret < 0)) goto exception; } BREAK; CASE(OP_set_proto): { JSValue proto; proto = sp[-1]; if (JS_IsObject(proto) || JS_IsNull(proto)) { if (JS_SetPrototypeInternal(ctx, sp[-2], proto, true) < 0) goto exception; } JS_FreeValue(ctx, proto); sp--; } BREAK; CASE(OP_set_home_object): js_method_set_home_object(ctx, sp[-1], sp[-2]); BREAK; CASE(OP_define_method): CASE(OP_define_method_computed): { JSValue getter, setter, value; JSValue obj; JSAtom atom; int flags, ret, op_flags; bool is_computed; #define OP_DEFINE_METHOD_METHOD 0 #define OP_DEFINE_METHOD_GETTER 1 #define OP_DEFINE_METHOD_SETTER 2 #define OP_DEFINE_METHOD_ENUMERABLE 4 is_computed = (opcode == OP_define_method_computed); if (is_computed) { atom = JS_ValueToAtom(ctx, sp[-2]); if (unlikely(atom == JS_ATOM_NULL)) goto exception; opcode += OP_define_method - OP_define_method_computed; } else { atom = get_u32(pc); pc += 4; } op_flags = *pc++; obj = sp[-2 - is_computed]; flags = JS_PROP_HAS_CONFIGURABLE | JS_PROP_CONFIGURABLE | JS_PROP_HAS_ENUMERABLE | JS_PROP_THROW; if (op_flags & OP_DEFINE_METHOD_ENUMERABLE) flags |= JS_PROP_ENUMERABLE; op_flags &= 3; value = JS_UNDEFINED; getter = JS_UNDEFINED; setter = JS_UNDEFINED; if (op_flags == OP_DEFINE_METHOD_METHOD) { value = sp[-1]; flags |= JS_PROP_HAS_VALUE | JS_PROP_HAS_WRITABLE | JS_PROP_WRITABLE; } else if (op_flags == OP_DEFINE_METHOD_GETTER) { getter = sp[-1]; flags |= JS_PROP_HAS_GET; } else { setter = sp[-1]; flags |= JS_PROP_HAS_SET; } ret = js_method_set_properties(ctx, sp[-1], atom, flags, obj); if (ret >= 0) { ret = JS_DefineProperty(ctx, obj, atom, value, getter, setter, flags); } JS_FreeValue(ctx, sp[-1]); if (is_computed) { JS_FreeAtom(ctx, atom); JS_FreeValue(ctx, sp[-2]); } sp -= 1 + is_computed; if (unlikely(ret < 0)) goto exception; } BREAK; CASE(OP_define_class): CASE(OP_define_class_computed): { int class_flags; JSAtom atom; atom = get_u32(pc); class_flags = pc[4]; pc += 5; if (js_op_define_class(ctx, sp, atom, class_flags, var_refs, sf, (opcode == OP_define_class_computed)) < 0) goto exception; } BREAK; CASE(OP_get_array_el): { JSValue val; sf->cur_pc = pc; val = JS_GetPropertyValue(ctx, sp[-2], sp[-1]); JS_FreeValue(ctx, sp[-2]); sp[-2] = val; sp--; if (unlikely(JS_IsException(val))) goto exception; } BREAK; CASE(OP_get_array_el2): { JSValue val; sf->cur_pc = pc; val = JS_GetPropertyValue(ctx, sp[-2], sp[-1]); sp[-1] = val; if (unlikely(JS_IsException(val))) goto exception; } BREAK; CASE(OP_get_ref_value): { JSValue val; sf->cur_pc = pc; if (unlikely(JS_IsUndefined(sp[-2]))) { JSAtom atom = JS_ValueToAtom(ctx, sp[-1]); if (atom != JS_ATOM_NULL) { JS_ThrowReferenceErrorNotDefined(ctx, atom); JS_FreeAtom(ctx, atom); } goto exception; } val = JS_GetPropertyValue(ctx, sp[-2], js_dup(sp[-1])); if (unlikely(JS_IsException(val))) goto exception; sp[0] = val; sp++; } BREAK; CASE(OP_get_super_value): { JSValue val; JSAtom atom; sf->cur_pc = pc; atom = JS_ValueToAtom(ctx, sp[-1]); if (unlikely(atom == JS_ATOM_NULL)) goto exception; val = JS_GetPropertyInternal(ctx, sp[-2], atom, sp[-3], false); JS_FreeAtom(ctx, atom); if (unlikely(JS_IsException(val))) goto exception; JS_FreeValue(ctx, sp[-1]); JS_FreeValue(ctx, sp[-2]); JS_FreeValue(ctx, sp[-3]); sp[-3] = val; sp -= 2; } BREAK; CASE(OP_put_array_el): { int ret; sf->cur_pc = pc; ret = JS_SetPropertyValue(ctx, sp[-3], sp[-2], sp[-1], JS_PROP_THROW_STRICT); JS_FreeValue(ctx, sp[-3]); sp -= 3; if (unlikely(ret < 0)) goto exception; } BREAK; CASE(OP_put_ref_value): { int ret, flags; sf->cur_pc = pc; flags = JS_PROP_THROW_STRICT; if (unlikely(JS_IsUndefined(sp[-3]))) { if (is_strict_mode(ctx)) { JSAtom atom = JS_ValueToAtom(ctx, sp[-2]); if (atom != JS_ATOM_NULL) { JS_ThrowReferenceErrorNotDefined(ctx, atom); JS_FreeAtom(ctx, atom); } goto exception; } else { sp[-3] = js_dup(ctx->global_obj); } } else { if (is_strict_mode(ctx)) flags |= JS_PROP_NO_ADD; } ret = JS_SetPropertyValue(ctx, sp[-3], sp[-2], sp[-1], flags); JS_FreeValue(ctx, sp[-3]); sp -= 3; if (unlikely(ret < 0)) goto exception; } BREAK; CASE(OP_put_super_value): { int ret; JSAtom atom; sf->cur_pc = pc; if (JS_VALUE_GET_TAG(sp[-3]) != JS_TAG_OBJECT) { JS_ThrowTypeErrorNotAnObject(ctx); goto exception; } atom = JS_ValueToAtom(ctx, sp[-2]); if (unlikely(atom == JS_ATOM_NULL)) goto exception; ret = JS_SetPropertyInternal2(ctx, sp[-3], atom, sp[-1], sp[-4], JS_PROP_THROW_STRICT); JS_FreeAtom(ctx, atom); JS_FreeValue(ctx, sp[-4]); JS_FreeValue(ctx, sp[-3]); JS_FreeValue(ctx, sp[-2]); sp -= 4; if (ret < 0) goto exception; } BREAK; CASE(OP_define_array_el): { int ret; ret = JS_DefinePropertyValueValue(ctx, sp[-3], js_dup(sp[-2]), sp[-1], JS_PROP_C_W_E | JS_PROP_THROW); sp -= 1; if (unlikely(ret < 0)) goto exception; } BREAK; CASE(OP_append): /* array pos enumobj -- array pos */ { sf->cur_pc = pc; if (js_append_enumerate(ctx, sp)) goto exception; JS_FreeValue(ctx, *--sp); } BREAK; CASE(OP_copy_data_properties): /* target source excludeList */ { /* stack offsets (-1 based): 2 bits for target, 3 bits for source, 2 bits for exclusionList */ int mask; mask = *pc++; sf->cur_pc = pc; if (JS_CopyDataProperties(ctx, sp[-1 - (mask & 3)], sp[-1 - ((mask >> 2) & 7)], sp[-1 - ((mask >> 5) & 7)], 0)) goto exception; } BREAK; CASE(OP_add): { JSValue op1, op2; op1 = sp[-2]; op2 = sp[-1]; if (likely(JS_VALUE_IS_BOTH_INT(op1, op2))) { int64_t r; r = (int64_t)JS_VALUE_GET_INT(op1) + JS_VALUE_GET_INT(op2); if (unlikely((int)r != r)) goto add_slow; sp[-2] = js_int32(r); sp--; } else if (JS_VALUE_IS_BOTH_FLOAT(op1, op2)) { sp[-2] = js_float64(JS_VALUE_GET_FLOAT64(op1) + JS_VALUE_GET_FLOAT64(op2)); sp--; } else { add_slow: sf->cur_pc = pc; if (js_add_slow(ctx, sp)) goto exception; sp--; } } BREAK; CASE(OP_add_loc): { JSValue *pv; int idx; idx = *pc; pc += 1; pv = &var_buf[idx]; if (likely(JS_VALUE_IS_BOTH_INT(*pv, sp[-1]))) { int64_t r; r = (int64_t)JS_VALUE_GET_INT(*pv) + JS_VALUE_GET_INT(sp[-1]); if (unlikely((int)r != r)) goto add_loc_slow; *pv = js_int32(r); sp--; } else if (JS_VALUE_GET_TAG(*pv) == JS_TAG_STRING) { JSValue op1; op1 = sp[-1]; sp--; sf->cur_pc = pc; op1 = JS_ToPrimitiveFree(ctx, op1, HINT_NONE); if (JS_IsException(op1)) goto exception; op1 = JS_ConcatString(ctx, js_dup(*pv), op1); if (JS_IsException(op1)) goto exception; set_value(ctx, pv, op1); } else { JSValue ops[2]; add_loc_slow: /* In case of exception, js_add_slow frees ops[0] and ops[1], so we must duplicate *pv */ sf->cur_pc = pc; ops[0] = js_dup(*pv); ops[1] = sp[-1]; sp--; if (js_add_slow(ctx, ops + 2)) goto exception; set_value(ctx, pv, ops[0]); } } BREAK; CASE(OP_sub): { JSValue op1, op2; op1 = sp[-2]; op2 = sp[-1]; if (likely(JS_VALUE_IS_BOTH_INT(op1, op2))) { int64_t r; r = (int64_t)JS_VALUE_GET_INT(op1) - JS_VALUE_GET_INT(op2); if (unlikely((int)r != r)) goto binary_arith_slow; sp[-2] = js_int32(r); sp--; } else if (JS_VALUE_IS_BOTH_FLOAT(op1, op2)) { sp[-2] = js_float64(JS_VALUE_GET_FLOAT64(op1) - JS_VALUE_GET_FLOAT64(op2)); sp--; } else { goto binary_arith_slow; } } BREAK; CASE(OP_mul): { JSValue op1, op2; double d; op1 = sp[-2]; op2 = sp[-1]; if (likely(JS_VALUE_IS_BOTH_INT(op1, op2))) { int32_t v1, v2; int64_t r; v1 = JS_VALUE_GET_INT(op1); v2 = JS_VALUE_GET_INT(op2); r = (int64_t)v1 * v2; if (unlikely((int)r != r)) { d = (double)r; goto mul_fp_res; } /* need to test zero case for -0 result */ if (unlikely(r == 0 && (v1 | v2) < 0)) { d = -0.0; goto mul_fp_res; } sp[-2] = js_int32(r); sp--; } else if (JS_VALUE_IS_BOTH_FLOAT(op1, op2)) { d = JS_VALUE_GET_FLOAT64(op1) * JS_VALUE_GET_FLOAT64(op2); mul_fp_res: sp[-2] = js_float64(d); sp--; } else { goto binary_arith_slow; } } BREAK; CASE(OP_div): { JSValue op1, op2; op1 = sp[-2]; op2 = sp[-1]; if (likely(JS_VALUE_IS_BOTH_INT(op1, op2))) { int v1, v2; v1 = JS_VALUE_GET_INT(op1); v2 = JS_VALUE_GET_INT(op2); sp[-2] = js_number((double)v1 / (double)v2); sp--; } else { goto binary_arith_slow; } } BREAK; CASE(OP_mod): { JSValue op1, op2; op1 = sp[-2]; op2 = sp[-1]; if (likely(JS_VALUE_IS_BOTH_INT(op1, op2))) { int v1, v2, r; v1 = JS_VALUE_GET_INT(op1); v2 = JS_VALUE_GET_INT(op2); /* We must avoid v2 = 0, v1 = INT32_MIN and v2 = -1 and the cases where the result is -0. */ if (unlikely(v1 < 0 || v2 <= 0)) goto binary_arith_slow; r = v1 % v2; sp[-2] = js_int32(r); sp--; } else { goto binary_arith_slow; } } BREAK; CASE(OP_pow): binary_arith_slow: sf->cur_pc = pc; if (js_binary_arith_slow(ctx, sp, opcode)) goto exception; sp--; BREAK; CASE(OP_plus): { JSValue op1; uint32_t tag; op1 = sp[-1]; tag = JS_VALUE_GET_TAG(op1); if (tag == JS_TAG_INT || JS_TAG_IS_FLOAT64(tag)) { } else { sf->cur_pc = pc; if (js_unary_arith_slow(ctx, sp, opcode)) goto exception; } } BREAK; CASE(OP_neg): { JSValue op1; uint32_t tag; int val; double d; op1 = sp[-1]; tag = JS_VALUE_GET_TAG(op1); if (tag == JS_TAG_INT) { val = JS_VALUE_GET_INT(op1); /* Note: -0 cannot be expressed as integer */ if (unlikely(val == 0)) { d = -0.0; goto neg_fp_res; } if (unlikely(val == INT32_MIN)) { d = -(double)val; goto neg_fp_res; } sp[-1] = js_int32(-val); } else if (JS_TAG_IS_FLOAT64(tag)) { d = -JS_VALUE_GET_FLOAT64(op1); neg_fp_res: sp[-1] = js_float64(d); } else { sf->cur_pc = pc; if (js_unary_arith_slow(ctx, sp, opcode)) goto exception; } } BREAK; CASE(OP_inc): { JSValue op1; int val; op1 = sp[-1]; if (JS_VALUE_GET_TAG(op1) == JS_TAG_INT) { val = JS_VALUE_GET_INT(op1); if (unlikely(val == INT32_MAX)) goto inc_slow; sp[-1] = js_int32(val + 1); } else { inc_slow: sf->cur_pc = pc; if (js_unary_arith_slow(ctx, sp, opcode)) goto exception; } } BREAK; CASE(OP_dec): { JSValue op1; int val; op1 = sp[-1]; if (JS_VALUE_GET_TAG(op1) == JS_TAG_INT) { val = JS_VALUE_GET_INT(op1); if (unlikely(val == INT32_MIN)) goto dec_slow; sp[-1] = js_int32(val - 1); } else { dec_slow: sf->cur_pc = pc; if (js_unary_arith_slow(ctx, sp, opcode)) goto exception; } } BREAK; CASE(OP_post_inc): CASE(OP_post_dec): sf->cur_pc = pc; if (js_post_inc_slow(ctx, sp, opcode)) goto exception; sp++; BREAK; CASE(OP_inc_loc): { JSValue op1; int val; int idx; idx = *pc; pc += 1; op1 = var_buf[idx]; if (JS_VALUE_GET_TAG(op1) == JS_TAG_INT) { val = JS_VALUE_GET_INT(op1); if (unlikely(val == INT32_MAX)) goto inc_loc_slow; var_buf[idx] = js_int32(val + 1); } else { inc_loc_slow: sf->cur_pc = pc; /* must duplicate otherwise the variable value may be destroyed before JS code accesses it */ op1 = js_dup(op1); if (js_unary_arith_slow(ctx, &op1 + 1, OP_inc)) goto exception; set_value(ctx, &var_buf[idx], op1); } } BREAK; CASE(OP_dec_loc): { JSValue op1; int val; int idx; idx = *pc; pc += 1; op1 = var_buf[idx]; if (JS_VALUE_GET_TAG(op1) == JS_TAG_INT) { val = JS_VALUE_GET_INT(op1); if (unlikely(val == INT32_MIN)) goto dec_loc_slow; var_buf[idx] = js_int32(val - 1); } else { dec_loc_slow: sf->cur_pc = pc; /* must duplicate otherwise the variable value may be destroyed before JS code accesses it */ op1 = js_dup(op1); if (js_unary_arith_slow(ctx, &op1 + 1, OP_dec)) goto exception; set_value(ctx, &var_buf[idx], op1); } } BREAK; CASE(OP_not): { JSValue op1; op1 = sp[-1]; if (JS_VALUE_GET_TAG(op1) == JS_TAG_INT) { sp[-1] = js_int32(~JS_VALUE_GET_INT(op1)); } else { sf->cur_pc = pc; if (js_not_slow(ctx, sp)) goto exception; } } BREAK; CASE(OP_shl): { JSValue op1, op2; op1 = sp[-2]; op2 = sp[-1]; if (likely(JS_VALUE_IS_BOTH_INT(op1, op2))) { uint32_t v1, v2; v1 = JS_VALUE_GET_INT(op1); v2 = JS_VALUE_GET_INT(op2) & 0x1f; sp[-2] = js_int32(v1 << v2); sp--; } else { sf->cur_pc = pc; if (js_binary_logic_slow(ctx, sp, opcode)) goto exception; sp--; } } BREAK; CASE(OP_shr): { JSValue op1, op2; op1 = sp[-2]; op2 = sp[-1]; if (likely(JS_VALUE_IS_BOTH_INT(op1, op2))) { uint32_t v2; v2 = JS_VALUE_GET_INT(op2); v2 &= 0x1f; sp[-2] = js_uint32((uint32_t)JS_VALUE_GET_INT(op1) >> v2); sp--; } else { sf->cur_pc = pc; if (js_shr_slow(ctx, sp)) goto exception; sp--; } } BREAK; CASE(OP_sar): { JSValue op1, op2; op1 = sp[-2]; op2 = sp[-1]; if (likely(JS_VALUE_IS_BOTH_INT(op1, op2))) { uint32_t v2; v2 = JS_VALUE_GET_INT(op2); if (unlikely(v2 > 0x1f)) { v2 &= 0x1f; } sp[-2] = js_int32((int)JS_VALUE_GET_INT(op1) >> v2); sp--; } else { sf->cur_pc = pc; if (js_binary_logic_slow(ctx, sp, opcode)) goto exception; sp--; } } BREAK; CASE(OP_and): { JSValue op1, op2; op1 = sp[-2]; op2 = sp[-1]; if (likely(JS_VALUE_IS_BOTH_INT(op1, op2))) { sp[-2] = js_int32(JS_VALUE_GET_INT(op1) & JS_VALUE_GET_INT(op2)); sp--; } else { sf->cur_pc = pc; if (js_binary_logic_slow(ctx, sp, opcode)) goto exception; sp--; } } BREAK; CASE(OP_or): { JSValue op1, op2; op1 = sp[-2]; op2 = sp[-1]; if (likely(JS_VALUE_IS_BOTH_INT(op1, op2))) { sp[-2] = js_int32(JS_VALUE_GET_INT(op1) | JS_VALUE_GET_INT(op2)); sp--; } else { sf->cur_pc = pc; if (js_binary_logic_slow(ctx, sp, opcode)) goto exception; sp--; } } BREAK; CASE(OP_xor): { JSValue op1, op2; op1 = sp[-2]; op2 = sp[-1]; if (likely(JS_VALUE_IS_BOTH_INT(op1, op2))) { sp[-2] = js_int32(JS_VALUE_GET_INT(op1) ^ JS_VALUE_GET_INT(op2)); sp--; } else { sf->cur_pc = pc; if (js_binary_logic_slow(ctx, sp, opcode)) goto exception; sp--; } } BREAK; #define OP_CMP(opcode, binary_op, slow_call) \ CASE(opcode): \ { \ JSValue op1, op2; \ op1 = sp[-2]; \ op2 = sp[-1]; \ if (likely(JS_VALUE_IS_BOTH_INT(op1, op2))) { \ sp[-2] = js_bool(JS_VALUE_GET_INT(op1) binary_op JS_VALUE_GET_INT(op2)); \ sp--; \ } else { \ sf->cur_pc = pc; \ if (slow_call) \ goto exception; \ sp--; \ } \ } \ BREAK OP_CMP(OP_lt, <, js_relational_slow(ctx, sp, opcode)); OP_CMP(OP_lte, <=, js_relational_slow(ctx, sp, opcode)); OP_CMP(OP_gt, >, js_relational_slow(ctx, sp, opcode)); OP_CMP(OP_gte, >=, js_relational_slow(ctx, sp, opcode)); OP_CMP(OP_eq, ==, js_eq_slow(ctx, sp, 0)); OP_CMP(OP_neq, !=, js_eq_slow(ctx, sp, 1)); OP_CMP(OP_strict_eq, ==, js_strict_eq_slow(ctx, sp, 0)); OP_CMP(OP_strict_neq, !=, js_strict_eq_slow(ctx, sp, 1)); CASE(OP_in): sf->cur_pc = pc; if (js_operator_in(ctx, sp)) goto exception; sp--; BREAK; CASE(OP_private_in): if (js_operator_private_in(ctx, sp)) goto exception; sp--; BREAK; CASE(OP_instanceof): sf->cur_pc = pc; if (js_operator_instanceof(ctx, sp)) goto exception; sp--; BREAK; CASE(OP_typeof): { JSValue op1; JSAtom atom; op1 = sp[-1]; atom = js_operator_typeof(ctx, op1); JS_FreeValue(ctx, op1); sp[-1] = JS_AtomToString(ctx, atom); } BREAK; CASE(OP_delete): sf->cur_pc = pc; if (js_operator_delete(ctx, sp)) goto exception; sp--; BREAK; CASE(OP_delete_var): { JSAtom atom; int ret; atom = get_u32(pc); pc += 4; sf->cur_pc = pc; ret = JS_DeleteGlobalVar(ctx, atom); if (unlikely(ret < 0)) goto exception; *sp++ = js_bool(ret); } BREAK; CASE(OP_to_object): if (JS_VALUE_GET_TAG(sp[-1]) != JS_TAG_OBJECT) { sf->cur_pc = pc; ret_val = JS_ToObject(ctx, sp[-1]); if (JS_IsException(ret_val)) goto exception; JS_FreeValue(ctx, sp[-1]); sp[-1] = ret_val; } BREAK; CASE(OP_to_propkey): switch (JS_VALUE_GET_TAG(sp[-1])) { case JS_TAG_INT: case JS_TAG_STRING: case JS_TAG_SYMBOL: break; default: sf->cur_pc = pc; ret_val = JS_ToPropertyKey(ctx, sp[-1]); if (JS_IsException(ret_val)) goto exception; JS_FreeValue(ctx, sp[-1]); sp[-1] = ret_val; break; } BREAK; CASE(OP_to_propkey2): /* must be tested first */ if (unlikely(JS_IsUndefined(sp[-2]) || JS_IsNull(sp[-2]))) { JS_ThrowTypeError(ctx, "value has no property"); goto exception; } switch (JS_VALUE_GET_TAG(sp[-1])) { case JS_TAG_INT: case JS_TAG_STRING: case JS_TAG_SYMBOL: break; default: sf->cur_pc = pc; ret_val = JS_ToPropertyKey(ctx, sp[-1]); if (JS_IsException(ret_val)) goto exception; JS_FreeValue(ctx, sp[-1]); sp[-1] = ret_val; break; } BREAK; CASE(OP_with_get_var): CASE(OP_with_put_var): CASE(OP_with_delete_var): CASE(OP_with_make_ref): CASE(OP_with_get_ref): CASE(OP_with_get_ref_undef): { JSAtom atom; int32_t diff; JSValue obj, val; int ret, is_with; atom = get_u32(pc); diff = get_u32(pc + 4); is_with = pc[8]; pc += 9; sf->cur_pc = pc; obj = sp[-1]; ret = JS_HasProperty(ctx, obj, atom); if (unlikely(ret < 0)) goto exception; if (ret) { if (is_with) { ret = js_has_unscopable(ctx, obj, atom); if (unlikely(ret < 0)) goto exception; if (ret) goto no_with; } switch (opcode) { case OP_with_get_var: val = JS_GetProperty(ctx, obj, atom); if (unlikely(JS_IsException(val))) goto exception; set_value(ctx, &sp[-1], val); break; case OP_with_put_var: /* XXX: check if strict mode */ ret = JS_SetPropertyInternal(ctx, obj, atom, sp[-2], JS_PROP_THROW_STRICT); JS_FreeValue(ctx, sp[-1]); sp -= 2; if (unlikely(ret < 0)) goto exception; break; case OP_with_delete_var: ret = JS_DeleteProperty(ctx, obj, atom, 0); if (unlikely(ret < 0)) goto exception; JS_FreeValue(ctx, sp[-1]); sp[-1] = js_bool(ret); break; case OP_with_make_ref: /* produce a pair object/propname on the stack */ *sp++ = JS_AtomToValue(ctx, atom); break; case OP_with_get_ref: /* produce a pair object/method on the stack */ val = JS_GetProperty(ctx, obj, atom); if (unlikely(JS_IsException(val))) goto exception; *sp++ = val; break; case OP_with_get_ref_undef: /* produce a pair undefined/function on the stack */ val = JS_GetProperty(ctx, obj, atom); if (unlikely(JS_IsException(val))) goto exception; JS_FreeValue(ctx, sp[-1]); sp[-1] = JS_UNDEFINED; *sp++ = val; break; } pc += diff - 5; } else { no_with: /* if not jumping, drop the object argument */ JS_FreeValue(ctx, sp[-1]); sp--; } } BREAK; CASE(OP_await): ret_val = js_int32(FUNC_RET_AWAIT); goto done_generator; CASE(OP_yield): ret_val = js_int32(FUNC_RET_YIELD); goto done_generator; CASE(OP_yield_star): CASE(OP_async_yield_star): ret_val = js_int32(FUNC_RET_YIELD_STAR); goto done_generator; CASE(OP_return_async): CASE(OP_initial_yield): ret_val = JS_UNDEFINED; goto done_generator; CASE(OP_nop): BREAK; CASE(OP_is_undefined_or_null): if (JS_VALUE_GET_TAG(sp[-1]) == JS_TAG_UNDEFINED || JS_VALUE_GET_TAG(sp[-1]) == JS_TAG_NULL) { goto set_true; } else { goto free_and_set_false; } CASE(OP_is_undefined): if (JS_VALUE_GET_TAG(sp[-1]) == JS_TAG_UNDEFINED) { goto set_true; } else { goto free_and_set_false; } CASE(OP_is_null): if (JS_VALUE_GET_TAG(sp[-1]) == JS_TAG_NULL) { goto set_true; } else { goto free_and_set_false; } /* XXX: could merge to a single opcode */ CASE(OP_typeof_is_undefined): /* different from OP_is_undefined because of isHTMLDDA */ if (js_operator_typeof(ctx, sp[-1]) == JS_ATOM_undefined) { goto free_and_set_true; } else { goto free_and_set_false; } CASE(OP_typeof_is_function): if (js_operator_typeof(ctx, sp[-1]) == JS_ATOM_function) { goto free_and_set_true; } else { goto free_and_set_false; } free_and_set_true: JS_FreeValue(ctx, sp[-1]); set_true: sp[-1] = JS_TRUE; BREAK; free_and_set_false: JS_FreeValue(ctx, sp[-1]); sp[-1] = JS_FALSE; BREAK; CASE(OP_invalid): DEFAULT: JS_ThrowInternalError(ctx, "invalid opcode: pc=%u opcode=0x%02x", (int)(pc - b->byte_code_buf - 1), opcode); goto exception; } } exception: if (needs_backtrace(rt->current_exception) || JS_IsUndefined(ctx->error_back_trace)) { sf->cur_pc = pc; build_backtrace(ctx, rt->current_exception, JS_UNDEFINED, NULL, 0, 0, 0); } if (!JS_IsUncatchableError(rt->current_exception)) { while (sp > stack_buf) { JSValue val = *--sp; JS_FreeValue(ctx, val); if (JS_VALUE_GET_TAG(val) == JS_TAG_CATCH_OFFSET) { int pos = JS_VALUE_GET_INT(val); if (pos == 0) { /* enumerator: close it with a throw */ JS_FreeValue(ctx, sp[-1]); /* drop the next method */ sp--; JS_IteratorClose(ctx, sp[-1], true); } else { *sp++ = rt->current_exception; rt->current_exception = JS_UNINITIALIZED; JS_FreeValueRT(rt, ctx->error_back_trace); ctx->error_back_trace = JS_UNDEFINED; pc = b->byte_code_buf + pos; goto restart; } } } } ret_val = JS_EXCEPTION; /* the local variables are freed by the caller in the generator case. Hence the label 'done' should never be reached in a generator function. */ if (b->func_kind != JS_FUNC_NORMAL) { done_generator: sf->cur_pc = pc; sf->cur_sp = sp; } else { done: if (unlikely(!list_empty(&sf->var_ref_list))) { /* variable references reference the stack: must close them */ close_var_refs(rt, sf); } /* free the local variables and stack */ for(pval = local_buf; pval < sp; pval++) { JS_FreeValue(ctx, *pval); } } rt->current_stack_frame = sf->prev_frame; if (ctx->handleFunctionExited) ctx->handleFunctionExited(ctx); return ret_val; } JSValue JS_Call(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv) { return JS_CallInternal(ctx, func_obj, this_obj, JS_UNDEFINED, argc, argv, JS_CALL_FLAG_COPY_ARGV); } static JSValue JS_CallFree(JSContext *ctx, JSValue func_obj, JSValueConst this_obj, int argc, JSValueConst *argv) { JSValue res = JS_CallInternal(ctx, func_obj, this_obj, JS_UNDEFINED, argc, argv, JS_CALL_FLAG_COPY_ARGV); JS_FreeValue(ctx, func_obj); return res; } /* warning: the refcount of the context is not incremented. Return NULL in case of exception (case of revoked proxy only) */ static JSContext *JS_GetFunctionRealm(JSContext *ctx, JSValueConst func_obj) { JSObject *p; JSContext *realm; if (JS_VALUE_GET_TAG(func_obj) != JS_TAG_OBJECT) return ctx; p = JS_VALUE_GET_OBJ(func_obj); switch(p->class_id) { case JS_CLASS_C_FUNCTION: realm = p->u.cfunc.realm; break; case JS_CLASS_BYTECODE_FUNCTION: case JS_CLASS_GENERATOR_FUNCTION: case JS_CLASS_ASYNC_FUNCTION: case JS_CLASS_ASYNC_GENERATOR_FUNCTION: { JSFunctionBytecode *b; b = p->u.func.function_bytecode; realm = b->realm; } break; case JS_CLASS_PROXY: { JSProxyData *s = p->u.opaque; if (!s) return ctx; if (s->is_revoked) { JS_ThrowTypeErrorRevokedProxy(ctx); return NULL; } else { realm = JS_GetFunctionRealm(ctx, s->target); } } break; case JS_CLASS_BOUND_FUNCTION: { JSBoundFunction *bf = p->u.bound_function; realm = JS_GetFunctionRealm(ctx, bf->func_obj); } break; default: realm = ctx; break; } return realm; } static JSValue js_create_from_ctor(JSContext *ctx, JSValueConst ctor, int class_id) { JSValue proto, obj; JSContext *realm; if (JS_IsUndefined(ctor)) { proto = js_dup(ctx->class_proto[class_id]); } else { proto = JS_GetProperty(ctx, ctor, JS_ATOM_prototype); if (JS_IsException(proto)) return proto; if (!JS_IsObject(proto)) { JS_FreeValue(ctx, proto); realm = JS_GetFunctionRealm(ctx, ctor); if (!realm) return JS_EXCEPTION; proto = js_dup(realm->class_proto[class_id]); } } obj = JS_NewObjectProtoClass(ctx, proto, class_id); JS_FreeValue(ctx, proto); return obj; } /* argv[] is modified if (flags & JS_CALL_FLAG_COPY_ARGV) = 0. */ static JSValue JS_CallConstructorInternal(JSContext *ctx, JSValueConst func_obj, JSValueConst new_target, int argc, JSValueConst *argv, int flags) { JSObject *p; JSFunctionBytecode *b; if (js_poll_interrupts(ctx)) return JS_EXCEPTION; flags |= JS_CALL_FLAG_CONSTRUCTOR; if (unlikely(JS_VALUE_GET_TAG(func_obj) != JS_TAG_OBJECT)) goto not_a_function; p = JS_VALUE_GET_OBJ(func_obj); if (unlikely(!p->is_constructor)) return JS_ThrowTypeErrorNotAConstructor(ctx, func_obj); if (unlikely(p->class_id != JS_CLASS_BYTECODE_FUNCTION)) { JSClassCall *call_func; call_func = ctx->rt->class_array[p->class_id].call; if (!call_func) { not_a_function: return JS_ThrowTypeErrorNotAFunction(ctx); } return call_func(ctx, func_obj, new_target, argc, argv, flags); } b = p->u.func.function_bytecode; if (b->is_derived_class_constructor) { return JS_CallInternal(ctx, func_obj, JS_UNDEFINED, new_target, argc, argv, flags); } else { JSValue obj, ret; /* legacy constructor behavior */ obj = js_create_from_ctor(ctx, new_target, JS_CLASS_OBJECT); if (JS_IsException(obj)) return JS_EXCEPTION; ret = JS_CallInternal(ctx, func_obj, obj, new_target, argc, argv, flags); if (JS_VALUE_GET_TAG(ret) == JS_TAG_OBJECT || JS_IsException(ret)) { JS_FreeValue(ctx, obj); return ret; } else { JS_FreeValue(ctx, ret); return obj; } } } JSValue JS_CallConstructor2(JSContext *ctx, JSValueConst func_obj, JSValueConst new_target, int argc, JSValueConst *argv) { return JS_CallConstructorInternal(ctx, func_obj, new_target, argc, argv, JS_CALL_FLAG_COPY_ARGV); } JSValue JS_CallConstructor(JSContext *ctx, JSValueConst func_obj, int argc, JSValueConst *argv) { return JS_CallConstructorInternal(ctx, func_obj, func_obj, argc, argv, JS_CALL_FLAG_COPY_ARGV); } JSValue JS_Invoke(JSContext *ctx, JSValueConst this_val, JSAtom atom, int argc, JSValueConst *argv) { JSValue func_obj; func_obj = JS_GetProperty(ctx, this_val, atom); if (JS_IsException(func_obj)) return func_obj; return JS_CallFree(ctx, func_obj, this_val, argc, argv); } static JSValue JS_InvokeFree(JSContext *ctx, JSValue this_val, JSAtom atom, int argc, JSValueConst *argv) { JSValue res = JS_Invoke(ctx, this_val, atom, argc, argv); JS_FreeValue(ctx, this_val); return res; } /* JSAsyncFunctionState (used by generator and async functions) */ static __exception int async_func_init(JSContext *ctx, JSAsyncFunctionState *s, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv) { JSObject *p; JSFunctionBytecode *b; JSStackFrame *sf; int local_count, i, arg_buf_len, n; sf = &s->frame; init_list_head(&sf->var_ref_list); p = JS_VALUE_GET_OBJ(func_obj); b = p->u.func.function_bytecode; sf->is_strict_mode = b->is_strict_mode; sf->cur_pc = b->byte_code_buf; arg_buf_len = max_int(b->arg_count, argc); local_count = arg_buf_len + b->var_count + b->stack_size; sf->arg_buf = js_malloc(ctx, sizeof(JSValue) * max_int(local_count, 1)); if (!sf->arg_buf) return -1; sf->cur_func = js_dup(func_obj); s->this_val = js_dup(this_obj); s->argc = argc; sf->arg_count = arg_buf_len; sf->var_buf = sf->arg_buf + arg_buf_len; sf->cur_sp = sf->var_buf + b->var_count; for(i = 0; i < argc; i++) sf->arg_buf[i] = js_dup(argv[i]); n = arg_buf_len + b->var_count; for(i = argc; i < n; i++) sf->arg_buf[i] = JS_UNDEFINED; return 0; } static void async_func_mark(JSRuntime *rt, JSAsyncFunctionState *s, JS_MarkFunc *mark_func) { JSStackFrame *sf; JSValue *sp; sf = &s->frame; JS_MarkValue(rt, sf->cur_func, mark_func); JS_MarkValue(rt, s->this_val, mark_func); if (sf->cur_sp) { /* if the function is running, cur_sp is not known so we cannot mark the stack. Marking the variables is not needed because a running function cannot be part of a removable cycle */ for(sp = sf->arg_buf; sp < sf->cur_sp; sp++) JS_MarkValue(rt, *sp, mark_func); } } static void async_func_free(JSRuntime *rt, JSAsyncFunctionState *s) { JSStackFrame *sf; JSValue *sp; sf = &s->frame; /* close the closure variables. */ close_var_refs(rt, sf); if (sf->arg_buf) { /* cannot free the function if it is running */ assert(sf->cur_sp != NULL); for(sp = sf->arg_buf; sp < sf->cur_sp; sp++) { JS_FreeValueRT(rt, *sp); } js_free_rt(rt, sf->arg_buf); } JS_FreeValueRT(rt, sf->cur_func); JS_FreeValueRT(rt, s->this_val); } static JSValue async_func_resume(JSContext *ctx, JSAsyncFunctionState *s) { JSValue func_obj; if (js_check_stack_overflow(ctx->rt, 0)) return JS_ThrowStackOverflow(ctx); /* the tag does not matter provided it is not an object */ func_obj = JS_MKPTR(JS_TAG_INT, s); return JS_CallInternal(ctx, func_obj, s->this_val, JS_UNDEFINED, s->argc, vc(s->frame.arg_buf), JS_CALL_FLAG_GENERATOR); } /* Generators */ typedef enum JSGeneratorStateEnum { JS_GENERATOR_STATE_SUSPENDED_START, JS_GENERATOR_STATE_SUSPENDED_YIELD, JS_GENERATOR_STATE_SUSPENDED_YIELD_STAR, JS_GENERATOR_STATE_EXECUTING, JS_GENERATOR_STATE_COMPLETED, } JSGeneratorStateEnum; typedef struct JSGeneratorData { JSGeneratorStateEnum state; JSAsyncFunctionState func_state; } JSGeneratorData; static void free_generator_stack_rt(JSRuntime *rt, JSGeneratorData *s) { if (s->state == JS_GENERATOR_STATE_COMPLETED) return; async_func_free(rt, &s->func_state); s->state = JS_GENERATOR_STATE_COMPLETED; } static void js_generator_finalizer(JSRuntime *rt, JSValueConst obj) { JSGeneratorData *s = JS_GetOpaque(obj, JS_CLASS_GENERATOR); if (s) { free_generator_stack_rt(rt, s); js_free_rt(rt, s); } } static void free_generator_stack(JSContext *ctx, JSGeneratorData *s) { free_generator_stack_rt(ctx->rt, s); } static void js_generator_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func) { JSObject *p = JS_VALUE_GET_OBJ(val); JSGeneratorData *s = p->u.generator_data; if (!s || s->state == JS_GENERATOR_STATE_COMPLETED) return; async_func_mark(rt, &s->func_state, mark_func); } /* XXX: use enum */ #define GEN_MAGIC_NEXT 0 #define GEN_MAGIC_RETURN 1 #define GEN_MAGIC_THROW 2 static JSValue js_generator_next(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int *pdone, int magic) { JSGeneratorData *s = JS_GetOpaque(this_val, JS_CLASS_GENERATOR); JSStackFrame *sf; JSValue ret, func_ret; *pdone = true; if (!s) return JS_ThrowTypeError(ctx, "not a generator"); sf = &s->func_state.frame; switch(s->state) { default: case JS_GENERATOR_STATE_SUSPENDED_START: if (magic == GEN_MAGIC_NEXT) { goto exec_no_arg; } else { free_generator_stack(ctx, s); goto done; } break; case JS_GENERATOR_STATE_SUSPENDED_YIELD_STAR: case JS_GENERATOR_STATE_SUSPENDED_YIELD: /* cur_sp[-1] was set to JS_UNDEFINED in the previous call */ ret = js_dup(argv[0]); if (magic == GEN_MAGIC_THROW && s->state == JS_GENERATOR_STATE_SUSPENDED_YIELD) { JS_Throw(ctx, ret); s->func_state.throw_flag = true; } else { sf->cur_sp[-1] = ret; sf->cur_sp[0] = js_int32(magic); sf->cur_sp++; exec_no_arg: s->func_state.throw_flag = false; } s->state = JS_GENERATOR_STATE_EXECUTING; func_ret = async_func_resume(ctx, &s->func_state); s->state = JS_GENERATOR_STATE_SUSPENDED_YIELD; if (JS_IsException(func_ret)) { /* finalize the execution in case of exception */ free_generator_stack(ctx, s); return func_ret; } if (JS_VALUE_GET_TAG(func_ret) == JS_TAG_INT) { /* get the returned yield value at the top of the stack */ ret = sf->cur_sp[-1]; sf->cur_sp[-1] = JS_UNDEFINED; if (JS_VALUE_GET_INT(func_ret) == FUNC_RET_YIELD_STAR) { s->state = JS_GENERATOR_STATE_SUSPENDED_YIELD_STAR; /* return (value, done) object */ *pdone = 2; } else { *pdone = false; } } else { /* end of iterator */ ret = sf->cur_sp[-1]; sf->cur_sp[-1] = JS_UNDEFINED; JS_FreeValue(ctx, func_ret); free_generator_stack(ctx, s); } break; case JS_GENERATOR_STATE_COMPLETED: done: /* execution is finished */ switch(magic) { default: case GEN_MAGIC_NEXT: ret = JS_UNDEFINED; break; case GEN_MAGIC_RETURN: ret = js_dup(argv[0]); break; case GEN_MAGIC_THROW: ret = JS_Throw(ctx, js_dup(argv[0])); break; } break; case JS_GENERATOR_STATE_EXECUTING: ret = JS_ThrowTypeError(ctx, "cannot invoke a running generator"); break; } return ret; } static JSValue js_call_generator_function(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv, int flags) { JSValue obj, func_ret; JSGeneratorData *s; s = js_mallocz(ctx, sizeof(*s)); if (!s) return JS_EXCEPTION; s->state = JS_GENERATOR_STATE_SUSPENDED_START; if (async_func_init(ctx, &s->func_state, func_obj, this_obj, argc, argv)) { s->state = JS_GENERATOR_STATE_COMPLETED; goto fail; } /* execute the function up to 'OP_initial_yield' */ func_ret = async_func_resume(ctx, &s->func_state); if (JS_IsException(func_ret)) goto fail; JS_FreeValue(ctx, func_ret); obj = js_create_from_ctor(ctx, func_obj, JS_CLASS_GENERATOR); if (JS_IsException(obj)) goto fail; JS_SetOpaqueInternal(obj, s); return obj; fail: free_generator_stack_rt(ctx->rt, s); js_free(ctx, s); return JS_EXCEPTION; } /* AsyncFunction */ static void js_async_function_terminate(JSRuntime *rt, JSAsyncFunctionData *s) { if (s->is_active) { async_func_free(rt, &s->func_state); s->is_active = false; } } static void js_async_function_free0(JSRuntime *rt, JSAsyncFunctionData *s) { js_async_function_terminate(rt, s); JS_FreeValueRT(rt, s->resolving_funcs[0]); JS_FreeValueRT(rt, s->resolving_funcs[1]); remove_gc_object(&s->header); js_free_rt(rt, s); } static void js_async_function_free(JSRuntime *rt, JSAsyncFunctionData *s) { if (--s->header.ref_count == 0) { js_async_function_free0(rt, s); } } static void js_async_function_resolve_finalizer(JSRuntime *rt, JSValueConst val) { JSObject *p = JS_VALUE_GET_OBJ(val); JSAsyncFunctionData *s = p->u.async_function_data; if (s) { js_async_function_free(rt, s); } } static void js_async_function_resolve_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func) { JSObject *p = JS_VALUE_GET_OBJ(val); JSAsyncFunctionData *s = p->u.async_function_data; if (s) { mark_func(rt, &s->header); } } static int js_async_function_resolve_create(JSContext *ctx, JSAsyncFunctionData *s, JSValue *resolving_funcs) { int i; JSObject *p; for(i = 0; i < 2; i++) { resolving_funcs[i] = JS_NewObjectProtoClass(ctx, ctx->function_proto, JS_CLASS_ASYNC_FUNCTION_RESOLVE + i); if (JS_IsException(resolving_funcs[i])) { if (i == 1) JS_FreeValue(ctx, resolving_funcs[0]); return -1; } p = JS_VALUE_GET_OBJ(resolving_funcs[i]); s->header.ref_count++; p->u.async_function_data = s; } return 0; } static bool js_async_function_resume(JSContext *ctx, JSAsyncFunctionData *s) { bool is_success = true; JSValue func_ret, ret2; func_ret = async_func_resume(ctx, &s->func_state); if (JS_IsException(func_ret)) { fail: if (unlikely(JS_IsUncatchableError(ctx->rt->current_exception))) { is_success = false; } else { JSValue error = JS_GetException(ctx); ret2 = JS_Call(ctx, s->resolving_funcs[1], JS_UNDEFINED, 1, vc(&error)); JS_FreeValue(ctx, error); resolved: if (unlikely(JS_IsException(ret2))) { if (JS_IsUncatchableError(ctx->rt->current_exception)) { is_success = false; } else { abort(); /* BUG */ } } JS_FreeValue(ctx, ret2); } js_async_function_terminate(ctx->rt, s); } else { JSValue value; value = s->func_state.frame.cur_sp[-1]; s->func_state.frame.cur_sp[-1] = JS_UNDEFINED; if (JS_IsUndefined(func_ret)) { /* function returned */ ret2 = JS_Call(ctx, s->resolving_funcs[0], JS_UNDEFINED, 1, vc(&value)); JS_FreeValue(ctx, value); goto resolved; } else { JSValue promise, resolving_funcs[2], resolving_funcs1[2]; int i, res; /* await */ JS_FreeValue(ctx, func_ret); /* not used */ promise = js_promise_resolve(ctx, ctx->promise_ctor, 1, vc(&value), 0); JS_FreeValue(ctx, value); if (JS_IsException(promise)) goto fail; if (js_async_function_resolve_create(ctx, s, resolving_funcs)) { JS_FreeValue(ctx, promise); goto fail; } /* Note: no need to create 'thrownawayCapability' as in the spec */ for(i = 0; i < 2; i++) resolving_funcs1[i] = JS_UNDEFINED; res = perform_promise_then(ctx, promise, vc(resolving_funcs), vc(resolving_funcs1)); JS_FreeValue(ctx, promise); for(i = 0; i < 2; i++) JS_FreeValue(ctx, resolving_funcs[i]); if (res) goto fail; } } return is_success; } static JSValue js_async_function_resolve_call(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv, int flags) { JSObject *p = JS_VALUE_GET_OBJ(func_obj); JSAsyncFunctionData *s = p->u.async_function_data; bool is_reject = p->class_id - JS_CLASS_ASYNC_FUNCTION_RESOLVE; JSValueConst arg; if (argc > 0) arg = argv[0]; else arg = JS_UNDEFINED; s->func_state.throw_flag = is_reject; if (is_reject) { JS_Throw(ctx, js_dup(arg)); } else { /* return value of await */ s->func_state.frame.cur_sp[-1] = js_dup(arg); } if (!js_async_function_resume(ctx, s)) return JS_EXCEPTION; return JS_UNDEFINED; } static JSValue js_async_function_call(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv, int flags) { JSValue promise; JSAsyncFunctionData *s; s = js_mallocz(ctx, sizeof(*s)); if (!s) return JS_EXCEPTION; s->header.ref_count = 1; add_gc_object(ctx->rt, &s->header, JS_GC_OBJ_TYPE_ASYNC_FUNCTION); s->is_active = false; s->resolving_funcs[0] = JS_UNDEFINED; s->resolving_funcs[1] = JS_UNDEFINED; promise = JS_NewPromiseCapability(ctx, s->resolving_funcs); if (JS_IsException(promise)) goto fail; if (async_func_init(ctx, &s->func_state, func_obj, this_obj, argc, argv)) { fail: JS_FreeValue(ctx, promise); js_async_function_free(ctx->rt, s); return JS_EXCEPTION; } s->is_active = true; if (!js_async_function_resume(ctx, s)) goto fail; js_async_function_free(ctx->rt, s); return promise; } /* AsyncGenerator */ typedef enum JSAsyncGeneratorStateEnum { JS_ASYNC_GENERATOR_STATE_SUSPENDED_START, JS_ASYNC_GENERATOR_STATE_SUSPENDED_YIELD, JS_ASYNC_GENERATOR_STATE_SUSPENDED_YIELD_STAR, JS_ASYNC_GENERATOR_STATE_EXECUTING, JS_ASYNC_GENERATOR_STATE_AWAITING_RETURN, JS_ASYNC_GENERATOR_STATE_COMPLETED, } JSAsyncGeneratorStateEnum; typedef struct JSAsyncGeneratorRequest { struct list_head link; /* completion */ int completion_type; /* GEN_MAGIC_x */ JSValue result; /* promise capability */ JSValue promise; JSValue resolving_funcs[2]; } JSAsyncGeneratorRequest; typedef struct JSAsyncGeneratorData { JSObject *generator; /* back pointer to the object (const) */ JSAsyncGeneratorStateEnum state; JSAsyncFunctionState func_state; struct list_head queue; /* list of JSAsyncGeneratorRequest.link */ } JSAsyncGeneratorData; static void js_async_generator_free(JSRuntime *rt, JSAsyncGeneratorData *s) { struct list_head *el, *el1; JSAsyncGeneratorRequest *req; list_for_each_safe(el, el1, &s->queue) { req = list_entry(el, JSAsyncGeneratorRequest, link); JS_FreeValueRT(rt, req->result); JS_FreeValueRT(rt, req->promise); JS_FreeValueRT(rt, req->resolving_funcs[0]); JS_FreeValueRT(rt, req->resolving_funcs[1]); js_free_rt(rt, req); } if (s->state != JS_ASYNC_GENERATOR_STATE_COMPLETED && s->state != JS_ASYNC_GENERATOR_STATE_AWAITING_RETURN) { async_func_free(rt, &s->func_state); } js_free_rt(rt, s); } static void js_async_generator_finalizer(JSRuntime *rt, JSValueConst obj) { JSAsyncGeneratorData *s = JS_GetOpaque(obj, JS_CLASS_ASYNC_GENERATOR); if (s) { js_async_generator_free(rt, s); } } static void js_async_generator_mark(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func) { JSAsyncGeneratorData *s = JS_GetOpaque(val, JS_CLASS_ASYNC_GENERATOR); struct list_head *el; JSAsyncGeneratorRequest *req; if (s) { list_for_each(el, &s->queue) { req = list_entry(el, JSAsyncGeneratorRequest, link); JS_MarkValue(rt, req->result, mark_func); JS_MarkValue(rt, req->promise, mark_func); JS_MarkValue(rt, req->resolving_funcs[0], mark_func); JS_MarkValue(rt, req->resolving_funcs[1], mark_func); } if (s->state != JS_ASYNC_GENERATOR_STATE_COMPLETED && s->state != JS_ASYNC_GENERATOR_STATE_AWAITING_RETURN) { async_func_mark(rt, &s->func_state, mark_func); } } } static JSValue js_async_generator_resolve_function(JSContext *ctx, JSValueConst this_obj, int argc, JSValueConst *argv, int magic, JSValueConst *func_data); static int js_async_generator_resolve_function_create(JSContext *ctx, JSValue generator, JSValue *resolving_funcs, bool is_resume_next) { int i; JSValue func; for(i = 0; i < 2; i++) { func = JS_NewCFunctionData(ctx, js_async_generator_resolve_function, 1, i + is_resume_next * 2, 1, vc(&generator)); if (JS_IsException(func)) { if (i == 1) JS_FreeValue(ctx, resolving_funcs[0]); return -1; } resolving_funcs[i] = func; } return 0; } static int js_async_generator_await(JSContext *ctx, JSAsyncGeneratorData *s, JSValue value) { JSValue promise, resolving_funcs[2], resolving_funcs1[2]; int i, res; promise = js_promise_resolve(ctx, ctx->promise_ctor, 1, vc(&value), 0); if (JS_IsException(promise)) goto fail; if (js_async_generator_resolve_function_create(ctx, JS_MKPTR(JS_TAG_OBJECT, s->generator), resolving_funcs, false)) { JS_FreeValue(ctx, promise); goto fail; } /* Note: no need to create 'thrownawayCapability' as in the spec */ for(i = 0; i < 2; i++) resolving_funcs1[i] = JS_UNDEFINED; res = perform_promise_then(ctx, promise, vc(resolving_funcs), vc(resolving_funcs1)); JS_FreeValue(ctx, promise); for(i = 0; i < 2; i++) JS_FreeValue(ctx, resolving_funcs[i]); if (res) goto fail; return 0; fail: return -1; } static void js_async_generator_resolve_or_reject(JSContext *ctx, JSAsyncGeneratorData *s, JSValueConst result, int is_reject) { JSAsyncGeneratorRequest *next; JSValue ret; next = list_entry(s->queue.next, JSAsyncGeneratorRequest, link); list_del(&next->link); ret = JS_Call(ctx, next->resolving_funcs[is_reject], JS_UNDEFINED, 1, &result); JS_FreeValue(ctx, ret); JS_FreeValue(ctx, next->result); JS_FreeValue(ctx, next->promise); JS_FreeValue(ctx, next->resolving_funcs[0]); JS_FreeValue(ctx, next->resolving_funcs[1]); js_free(ctx, next); } static void js_async_generator_resolve(JSContext *ctx, JSAsyncGeneratorData *s, JSValueConst value, bool done) { JSValue result; result = js_create_iterator_result(ctx, js_dup(value), done); /* XXX: better exception handling ? */ js_async_generator_resolve_or_reject(ctx, s, result, 0); JS_FreeValue(ctx, result); } static void js_async_generator_reject(JSContext *ctx, JSAsyncGeneratorData *s, JSValueConst exception) { js_async_generator_resolve_or_reject(ctx, s, exception, 1); } static void js_async_generator_complete(JSContext *ctx, JSAsyncGeneratorData *s) { if (s->state != JS_ASYNC_GENERATOR_STATE_COMPLETED) { s->state = JS_ASYNC_GENERATOR_STATE_COMPLETED; async_func_free(ctx->rt, &s->func_state); } } static int js_async_generator_completed_return(JSContext *ctx, JSAsyncGeneratorData *s, JSValue value) { JSValue promise, resolving_funcs[2], resolving_funcs1[2]; int res; // Can fail looking up JS_ATOM_constructor when is_reject==0. promise = js_promise_resolve(ctx, ctx->promise_ctor, 1, vc(&value), /*is_reject*/0); // A poisoned .constructor property is observable and the resulting // exception should be delivered to the catch handler. if (JS_IsException(promise)) { JSValue err = JS_GetException(ctx); promise = js_promise_resolve(ctx, ctx->promise_ctor, 1, vc(&err), /*is_reject*/1); JS_FreeValue(ctx, err); if (JS_IsException(promise)) return -1; } if (js_async_generator_resolve_function_create(ctx, JS_MKPTR(JS_TAG_OBJECT, s->generator), resolving_funcs1, true)) { JS_FreeValue(ctx, promise); return -1; } resolving_funcs[0] = JS_UNDEFINED; resolving_funcs[1] = JS_UNDEFINED; res = perform_promise_then(ctx, promise, vc(resolving_funcs1), vc(resolving_funcs)); JS_FreeValue(ctx, resolving_funcs1[0]); JS_FreeValue(ctx, resolving_funcs1[1]); JS_FreeValue(ctx, promise); return res; } static void js_async_generator_resume_next(JSContext *ctx, JSAsyncGeneratorData *s) { JSAsyncGeneratorRequest *next; JSValue func_ret, value; for(;;) { if (list_empty(&s->queue)) break; next = list_entry(s->queue.next, JSAsyncGeneratorRequest, link); switch(s->state) { case JS_ASYNC_GENERATOR_STATE_EXECUTING: /* only happens when restarting execution after await() */ goto resume_exec; case JS_ASYNC_GENERATOR_STATE_AWAITING_RETURN: goto done; case JS_ASYNC_GENERATOR_STATE_SUSPENDED_START: if (next->completion_type == GEN_MAGIC_NEXT) { goto exec_no_arg; } else { js_async_generator_complete(ctx, s); } break; case JS_ASYNC_GENERATOR_STATE_COMPLETED: if (next->completion_type == GEN_MAGIC_NEXT) { js_async_generator_resolve(ctx, s, JS_UNDEFINED, true); } else if (next->completion_type == GEN_MAGIC_RETURN) { s->state = JS_ASYNC_GENERATOR_STATE_AWAITING_RETURN; js_async_generator_completed_return(ctx, s, next->result); } else { js_async_generator_reject(ctx, s, next->result); } goto done; case JS_ASYNC_GENERATOR_STATE_SUSPENDED_YIELD: case JS_ASYNC_GENERATOR_STATE_SUSPENDED_YIELD_STAR: value = js_dup(next->result); if (next->completion_type == GEN_MAGIC_THROW && s->state == JS_ASYNC_GENERATOR_STATE_SUSPENDED_YIELD) { JS_Throw(ctx, value); s->func_state.throw_flag = true; } else { /* 'yield' returns a value. 'yield *' also returns a value in case the 'throw' method is called */ s->func_state.frame.cur_sp[-1] = value; s->func_state.frame.cur_sp[0] = js_int32(next->completion_type); s->func_state.frame.cur_sp++; exec_no_arg: s->func_state.throw_flag = false; } s->state = JS_ASYNC_GENERATOR_STATE_EXECUTING; resume_exec: func_ret = async_func_resume(ctx, &s->func_state); if (JS_IsException(func_ret)) { value = JS_GetException(ctx); js_async_generator_complete(ctx, s); js_async_generator_reject(ctx, s, value); JS_FreeValue(ctx, value); } else if (JS_VALUE_GET_TAG(func_ret) == JS_TAG_INT) { int func_ret_code, ret; value = s->func_state.frame.cur_sp[-1]; s->func_state.frame.cur_sp[-1] = JS_UNDEFINED; func_ret_code = JS_VALUE_GET_INT(func_ret); switch(func_ret_code) { case FUNC_RET_YIELD: case FUNC_RET_YIELD_STAR: if (func_ret_code == FUNC_RET_YIELD_STAR) s->state = JS_ASYNC_GENERATOR_STATE_SUSPENDED_YIELD_STAR; else s->state = JS_ASYNC_GENERATOR_STATE_SUSPENDED_YIELD; js_async_generator_resolve(ctx, s, value, false); JS_FreeValue(ctx, value); break; case FUNC_RET_AWAIT: ret = js_async_generator_await(ctx, s, value); JS_FreeValue(ctx, value); if (ret < 0) { /* exception: throw it */ s->func_state.throw_flag = true; goto resume_exec; } goto done; default: abort(); } } else { assert(JS_IsUndefined(func_ret)); /* end of function */ value = s->func_state.frame.cur_sp[-1]; s->func_state.frame.cur_sp[-1] = JS_UNDEFINED; js_async_generator_complete(ctx, s); js_async_generator_resolve(ctx, s, value, true); JS_FreeValue(ctx, value); } break; default: abort(); } } done: ; } static JSValue js_async_generator_resolve_function(JSContext *ctx, JSValueConst this_obj, int argc, JSValueConst *argv, int magic, JSValueConst *func_data) { bool is_reject = magic & 1; JSAsyncGeneratorData *s = JS_GetOpaque(func_data[0], JS_CLASS_ASYNC_GENERATOR); JSValueConst arg = argv[0]; /* XXX: what if s == NULL */ if (magic >= 2) { /* resume next case in AWAITING_RETURN state */ assert(s->state == JS_ASYNC_GENERATOR_STATE_AWAITING_RETURN || s->state == JS_ASYNC_GENERATOR_STATE_COMPLETED); s->state = JS_ASYNC_GENERATOR_STATE_COMPLETED; if (is_reject) { js_async_generator_reject(ctx, s, arg); } else { js_async_generator_resolve(ctx, s, arg, true); } } else { /* restart function execution after await() */ assert(s->state == JS_ASYNC_GENERATOR_STATE_EXECUTING); s->func_state.throw_flag = is_reject; if (is_reject) { JS_Throw(ctx, js_dup(arg)); } else { /* return value of await */ s->func_state.frame.cur_sp[-1] = js_dup(arg); } js_async_generator_resume_next(ctx, s); } return JS_UNDEFINED; } /* magic = GEN_MAGIC_x */ static JSValue js_async_generator_next(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv, int magic) { JSAsyncGeneratorData *s = JS_GetOpaque(this_val, JS_CLASS_ASYNC_GENERATOR); JSValue promise, resolving_funcs[2]; JSAsyncGeneratorRequest *req; promise = JS_NewPromiseCapability(ctx, resolving_funcs); if (JS_IsException(promise)) return JS_EXCEPTION; if (!s) { JSValue err, res2; JS_ThrowTypeError(ctx, "not an AsyncGenerator object"); err = JS_GetException(ctx); res2 = JS_Call(ctx, resolving_funcs[1], JS_UNDEFINED, 1, vc(&err)); JS_FreeValue(ctx, err); JS_FreeValue(ctx, res2); JS_FreeValue(ctx, resolving_funcs[0]); JS_FreeValue(ctx, resolving_funcs[1]); return promise; } req = js_mallocz(ctx, sizeof(*req)); if (!req) goto fail; req->completion_type = magic; req->result = js_dup(argv[0]); req->promise = js_dup(promise); req->resolving_funcs[0] = resolving_funcs[0]; req->resolving_funcs[1] = resolving_funcs[1]; list_add_tail(&req->link, &s->queue); if (s->state != JS_ASYNC_GENERATOR_STATE_EXECUTING) { js_async_generator_resume_next(ctx, s); } return promise; fail: JS_FreeValue(ctx, resolving_funcs[0]); JS_FreeValue(ctx, resolving_funcs[1]); JS_FreeValue(ctx, promise); return JS_EXCEPTION; } static JSValue js_async_generator_function_call(JSContext *ctx, JSValueConst func_obj, JSValueConst this_obj, int argc, JSValueConst *argv, int flags) { JSValue obj, func_ret; JSAsyncGeneratorData *s; s = js_mallocz(ctx, sizeof(*s)); if (!s) return JS_EXCEPTION; s->state = JS_ASYNC_GENERATOR_STATE_SUSPENDED_START; init_list_head(&s->queue); if (async_func_init(ctx, &s->func_state, func_obj, this_obj, argc, argv)) { s->state = JS_ASYNC_GENERATOR_STATE_COMPLETED; goto fail; } /* execute the function up to 'OP_initial_yield' (no yield nor await are possible) */ func_ret = async_func_resume(ctx, &s->func_state); if (JS_IsException(func_ret)) goto fail; JS_FreeValue(ctx, func_ret); obj = js_create_from_ctor(ctx, func_obj, JS_CLASS_ASYNC_GENERATOR); if (JS_IsException(obj)) goto fail; s->generator = JS_VALUE_GET_OBJ(obj); JS_SetOpaqueInternal(obj, s); return obj; fail: js_async_generator_free(ctx->rt, s); return JS_EXCEPTION; } /* JS parser */ enum { TOK_NUMBER = -128, TOK_STRING, TOK_TEMPLATE, TOK_IDENT, TOK_REGEXP, /* warning: order matters (see js_parse_assign_expr) */ TOK_MUL_ASSIGN, TOK_DIV_ASSIGN, TOK_MOD_ASSIGN, TOK_PLUS_ASSIGN, TOK_MINUS_ASSIGN, TOK_SHL_ASSIGN, TOK_SAR_ASSIGN, TOK_SHR_ASSIGN, TOK_AND_ASSIGN, TOK_XOR_ASSIGN, TOK_OR_ASSIGN, TOK_POW_ASSIGN, TOK_LAND_ASSIGN, TOK_LOR_ASSIGN, TOK_DOUBLE_QUESTION_MARK_ASSIGN, TOK_DEC, TOK_INC, TOK_SHL, TOK_SAR, TOK_SHR, TOK_LT, TOK_LTE, TOK_GT, TOK_GTE, TOK_EQ, TOK_STRICT_EQ, TOK_NEQ, TOK_STRICT_NEQ, TOK_LAND, TOK_LOR, TOK_POW, TOK_ARROW, TOK_ELLIPSIS, TOK_DOUBLE_QUESTION_MARK, TOK_QUESTION_MARK_DOT, TOK_ERROR, TOK_PRIVATE_NAME, TOK_EOF, /* keywords: WARNING: same order as atoms */ TOK_NULL, /* must be first */ TOK_FALSE, TOK_TRUE, TOK_IF, TOK_ELSE, TOK_RETURN, TOK_VAR, TOK_THIS, TOK_DELETE, TOK_VOID, TOK_TYPEOF, TOK_NEW, TOK_IN, TOK_INSTANCEOF, TOK_DO, TOK_WHILE, TOK_FOR, TOK_BREAK, TOK_CONTINUE, TOK_SWITCH, TOK_CASE, TOK_DEFAULT, TOK_THROW, TOK_TRY, TOK_CATCH, TOK_FINALLY, TOK_FUNCTION, TOK_DEBUGGER, TOK_WITH, /* FutureReservedWord */ TOK_CLASS, TOK_CONST, TOK_ENUM, TOK_EXPORT, TOK_EXTENDS, TOK_IMPORT, TOK_SUPER, /* FutureReservedWords when parsing strict mode code */ TOK_IMPLEMENTS, TOK_INTERFACE, TOK_LET, TOK_PACKAGE, TOK_PRIVATE, TOK_PROTECTED, TOK_PUBLIC, TOK_STATIC, TOK_YIELD, TOK_AWAIT, /* must be last */ TOK_OF, /* only used for js_parse_skip_parens_token() */ }; #define TOK_FIRST_KEYWORD TOK_NULL #define TOK_LAST_KEYWORD TOK_AWAIT /* unicode code points */ #define CP_NBSP 0x00a0 #define CP_BOM 0xfeff #define CP_LS 0x2028 #define CP_PS 0x2029 typedef struct BlockEnv { struct BlockEnv *prev; JSAtom label_name; /* JS_ATOM_NULL if none */ int label_break; /* -1 if none */ int label_cont; /* -1 if none */ int drop_count; /* number of stack elements to drop */ int label_finally; /* -1 if none */ int scope_level; uint8_t has_iterator : 1; uint8_t is_regular_stmt : 1; // i.e. not a loop statement } BlockEnv; typedef struct JSGlobalVar { int cpool_idx; /* if >= 0, index in the constant pool for hoisted function defintion*/ uint8_t force_init : 1; /* force initialization to undefined */ uint8_t is_lexical : 1; /* global let/const definition */ uint8_t is_const : 1; /* const definition */ int scope_level; /* scope of definition */ JSAtom var_name; /* variable name */ } JSGlobalVar; typedef struct RelocEntry { struct RelocEntry *next; uint32_t addr; /* address to patch */ int size; /* address size: 1, 2 or 4 bytes */ } RelocEntry; typedef struct JumpSlot { int op; int size; int pos; int label; } JumpSlot; typedef struct LabelSlot { int ref_count; int pos; /* phase 1 address, -1 means not resolved yet */ int pos2; /* phase 2 address, -1 means not resolved yet */ int addr; /* phase 3 address, -1 means not resolved yet */ RelocEntry *first_reloc; } LabelSlot; typedef struct SourceLocSlot { uint32_t pc; int line_num; int col_num; } SourceLocSlot; typedef enum JSParseFunctionEnum { JS_PARSE_FUNC_STATEMENT, JS_PARSE_FUNC_VAR, JS_PARSE_FUNC_EXPR, JS_PARSE_FUNC_ARROW, JS_PARSE_FUNC_GETTER, JS_PARSE_FUNC_SETTER, JS_PARSE_FUNC_METHOD, JS_PARSE_FUNC_CLASS_STATIC_INIT, JS_PARSE_FUNC_CLASS_CONSTRUCTOR, JS_PARSE_FUNC_DERIVED_CLASS_CONSTRUCTOR, } JSParseFunctionEnum; typedef enum JSParseExportEnum { JS_PARSE_EXPORT_NONE, JS_PARSE_EXPORT_NAMED, JS_PARSE_EXPORT_DEFAULT, } JSParseExportEnum; typedef struct JSFunctionDef { JSContext *ctx; struct JSFunctionDef *parent; int parent_cpool_idx; /* index in the constant pool of the parent or -1 if none */ int parent_scope_level; /* scope level in parent at point of definition */ struct list_head child_list; /* list of JSFunctionDef.link */ struct list_head link; bool is_eval; /* true if eval code */ int eval_type; /* only valid if is_eval = true */ bool is_global_var; /* true if variables are not defined locally: eval global, eval module or non strict eval */ bool is_func_expr; /* true if function expression */ bool has_home_object; /* true if the home object is available */ bool has_prototype; /* true if a prototype field is necessary */ bool has_simple_parameter_list; bool has_parameter_expressions; /* if true, an argument scope is created */ bool has_use_strict; /* to reject directive in special cases */ bool has_eval_call; /* true if the function contains a call to eval() */ bool has_arguments_binding; /* true if the 'arguments' binding is available in the function */ bool has_this_binding; /* true if the 'this' and new.target binding are available in the function */ bool new_target_allowed; /* true if the 'new.target' does not throw a syntax error */ bool super_call_allowed; /* true if super() is allowed */ bool super_allowed; /* true if super. or super[] is allowed */ bool arguments_allowed; /* true if the 'arguments' identifier is allowed */ bool is_derived_class_constructor; bool in_function_body; bool backtrace_barrier; JSFunctionKindEnum func_kind : 8; JSParseFunctionEnum func_type : 7; uint8_t is_strict_mode : 1; JSAtom func_name; /* JS_ATOM_NULL if no name */ JSVarDef *vars; uint32_t *vars_htab; // indexes into vars[] int var_size; /* allocated size for vars[] */ int var_count; JSVarDef *args; int arg_size; /* allocated size for args[] */ int arg_count; /* number of arguments */ int defined_arg_count; int var_object_idx; /* -1 if none */ int arg_var_object_idx; /* -1 if none (var object for the argument scope) */ int arguments_var_idx; /* -1 if none */ int arguments_arg_idx; /* argument variable definition in argument scope, -1 if none */ int func_var_idx; /* variable containing the current function (-1 if none, only used if is_func_expr is true) */ int eval_ret_idx; /* variable containing the return value of the eval, -1 if none */ int this_var_idx; /* variable containg the 'this' value, -1 if none */ int new_target_var_idx; /* variable containg the 'new.target' value, -1 if none */ int this_active_func_var_idx; /* variable containg the 'this.active_func' value, -1 if none */ int home_object_var_idx; bool need_home_object; int scope_level; /* index into fd->scopes if the current lexical scope */ int scope_first; /* index into vd->vars of first lexically scoped variable */ int scope_size; /* allocated size of fd->scopes array */ int scope_count; /* number of entries used in the fd->scopes array */ JSVarScope *scopes; JSVarScope def_scope_array[4]; int body_scope; /* scope of the body of the function or eval */ int global_var_count; int global_var_size; JSGlobalVar *global_vars; DynBuf byte_code; int last_opcode_pos; /* -1 if no last opcode */ bool use_short_opcodes; /* true if short opcodes are used in byte_code */ LabelSlot *label_slots; int label_size; /* allocated size for label_slots[] */ int label_count; BlockEnv *top_break; /* break/continue label stack */ /* constant pool (strings, functions, numbers) */ JSValue *cpool; int cpool_count; int cpool_size; /* list of variables in the closure */ int closure_var_count; int closure_var_size; JSClosureVar *closure_var; JumpSlot *jump_slots; int jump_size; int jump_count; SourceLocSlot *source_loc_slots; int source_loc_size; int source_loc_count; int line_number_last; int line_number_last_pc; int col_number_last; /* pc2line table */ JSAtom filename; int line_num; int col_num; DynBuf pc2line; char *source; /* raw source, utf-8 encoded */ int source_len; JSModuleDef *module; /* != NULL when parsing a module */ bool has_await; /* true if await is used (used in module eval) */ } JSFunctionDef; typedef struct JSToken { int val; int line_num; /* line number of token start */ int col_num; /* column number of token start */ const uint8_t *ptr; union { struct { JSValue str; int sep; } str; struct { JSValue val; } num; struct { JSAtom atom; bool has_escape; bool is_reserved; } ident; struct { JSValue body; JSValue flags; } regexp; } u; } JSToken; typedef struct JSParseState { JSContext *ctx; int last_line_num; /* line number of last token */ int last_col_num; /* column number of last token */ int line_num; /* line number of current offset */ int col_num; /* column number of current offset */ const char *filename; JSToken token; bool got_lf; /* true if got line feed before the current token */ const uint8_t *last_ptr; const uint8_t *buf_start; const uint8_t *buf_ptr; const uint8_t *buf_end; const uint8_t *eol; // most recently seen end-of-line character const uint8_t *mark; // first token character, invariant: eol < mark /* current function code */ JSFunctionDef *cur_func; bool is_module; /* parsing a module */ bool allow_html_comments; } JSParseState; typedef struct JSOpCode { #ifdef ENABLE_DUMPS // JS_DUMP_BYTECODE_* const char *name; #endif uint8_t size; /* in bytes */ /* the opcodes remove n_pop items from the top of the stack, then pushes n_push items */ uint8_t n_pop; uint8_t n_push; uint8_t fmt; } JSOpCode; static const JSOpCode opcode_info[OP_COUNT + (OP_TEMP_END - OP_TEMP_START)] = { #define FMT(f) #ifdef ENABLE_DUMPS // JS_DUMP_BYTECODE_* #define DEF(id, size, n_pop, n_push, f) { #id, size, n_pop, n_push, OP_FMT_ ## f }, #else #define DEF(id, size, n_pop, n_push, f) { size, n_pop, n_push, OP_FMT_ ## f }, #endif #include "quickjs-opcode.h" #undef DEF #undef FMT }; /* After the final compilation pass, short opcodes are used. Their opcodes overlap with the temporary opcodes which cannot appear in the final bytecode. Their description is after the temporary opcodes in opcode_info[]. */ #define short_opcode_info(op) \ opcode_info[(op) >= OP_TEMP_START ? \ (op) + (OP_TEMP_END - OP_TEMP_START) : (op)] static void free_token(JSParseState *s, JSToken *token) { switch(token->val) { case TOK_NUMBER: JS_FreeValue(s->ctx, token->u.num.val); break; case TOK_STRING: case TOK_TEMPLATE: JS_FreeValue(s->ctx, token->u.str.str); break; case TOK_REGEXP: JS_FreeValue(s->ctx, token->u.regexp.body); JS_FreeValue(s->ctx, token->u.regexp.flags); break; case TOK_IDENT: case TOK_PRIVATE_NAME: JS_FreeAtom(s->ctx, token->u.ident.atom); break; default: if (token->val >= TOK_FIRST_KEYWORD && token->val <= TOK_LAST_KEYWORD) { JS_FreeAtom(s->ctx, token->u.ident.atom); } break; } } static void __attribute((unused)) dump_token(JSParseState *s, const JSToken *token) { printf("%d:%d ", token->line_num, token->col_num); switch(token->val) { case TOK_NUMBER: { double d; JS_ToFloat64(s->ctx, &d, token->u.num.val); /* no exception possible */ printf("number: %.14g\n", d); } break; case TOK_IDENT: dump_atom: { char buf[ATOM_GET_STR_BUF_SIZE]; printf("ident: '%s'\n", JS_AtomGetStr(s->ctx, buf, sizeof(buf), token->u.ident.atom)); } break; case TOK_STRING: { const char *str; /* XXX: quote the string */ str = JS_ToCString(s->ctx, token->u.str.str); printf("string: '%s'\n", str); JS_FreeCString(s->ctx, str); } break; case TOK_TEMPLATE: { const char *str; str = JS_ToCString(s->ctx, token->u.str.str); printf("template: `%s`\n", str); JS_FreeCString(s->ctx, str); } break; case TOK_REGEXP: { const char *str, *str2; str = JS_ToCString(s->ctx, token->u.regexp.body); str2 = JS_ToCString(s->ctx, token->u.regexp.flags); printf("regexp: '%s' '%s'\n", str, str2); JS_FreeCString(s->ctx, str); JS_FreeCString(s->ctx, str2); } break; case TOK_EOF: printf("eof\n"); break; default: if (s->token.val >= TOK_NULL && s->token.val <= TOK_LAST_KEYWORD) { goto dump_atom; } else if (s->token.val >= 256) { printf("token: %d\n", token->val); } else { printf("token: '%c'\n", token->val); } break; } } int JS_PRINTF_FORMAT_ATTR(2, 3) js_parse_error(JSParseState *s, JS_PRINTF_FORMAT const char *fmt, ...) { JSContext *ctx = s->ctx; va_list ap; int backtrace_flags; va_start(ap, fmt); JS_ThrowError2(ctx, JS_SYNTAX_ERROR, false, fmt, ap); va_end(ap); backtrace_flags = 0; if (s->cur_func && s->cur_func->backtrace_barrier) backtrace_flags = JS_BACKTRACE_FLAG_SINGLE_LEVEL; build_backtrace(ctx, ctx->rt->current_exception, JS_UNDEFINED, s->filename, s->line_num, s->col_num, backtrace_flags); return -1; } #ifndef QJS_DISABLE_PARSER static __exception int next_token(JSParseState *s); static int js_parse_expect(JSParseState *s, int tok) { char buf[ATOM_GET_STR_BUF_SIZE]; if (s->token.val == tok) return next_token(s); switch(s->token.val) { case TOK_EOF: return js_parse_error(s, "Unexpected end of input"); case TOK_NUMBER: return js_parse_error(s, "Unexpected number"); case TOK_STRING: return js_parse_error(s, "Unexpected string"); case TOK_TEMPLATE: return js_parse_error(s, "Unexpected string template"); case TOK_REGEXP: return js_parse_error(s, "Unexpected regexp"); case TOK_IDENT: return js_parse_error(s, "Unexpected identifier '%s'", JS_AtomGetStr(s->ctx, buf, sizeof(buf), s->token.u.ident.atom)); case TOK_ERROR: return js_parse_error(s, "Invalid or unexpected token"); default: return js_parse_error(s, "Unexpected token '%.*s'", (int)(s->buf_ptr - s->token.ptr), (const char *)s->token.ptr); } } static int js_parse_expect_semi(JSParseState *s) { if (s->token.val != ';') { /* automatic insertion of ';' */ if (s->token.val == TOK_EOF || s->token.val == '}' || s->got_lf) { return 0; } return js_parse_error(s, "expecting '%c'", ';'); } return next_token(s); } static int js_parse_error_reserved_identifier(JSParseState *s) { char buf1[ATOM_GET_STR_BUF_SIZE]; return js_parse_error(s, "'%s' is a reserved identifier", JS_AtomGetStr(s->ctx, buf1, sizeof(buf1), s->token.u.ident.atom)); } static __exception int js_parse_template_part(JSParseState *s, const uint8_t *p) { const uint8_t *p_next; uint32_t c; StringBuffer b_s, *b = &b_s; JSValue str; /* p points to the first byte of the template part */ if (string_buffer_init(s->ctx, b, 32)) goto fail; for(;;) { if (p >= s->buf_end) goto unexpected_eof; c = *p++; if (c == '`') { /* template end part */ break; } if (c == '$' && *p == '{') { /* template start or middle part */ p++; break; } if (c == '\\') { if (string_buffer_putc8(b, c)) goto fail; if (p >= s->buf_end) goto unexpected_eof; c = *p++; } /* newline sequences are normalized as single '\n' bytes */ if (c == '\r') { if (*p == '\n') p++; c = '\n'; } if (c == '\n') { s->line_num++; s->eol = &p[-1]; s->mark = p; } else if (c >= 0x80) { c = utf8_decode(p - 1, &p_next); if (p_next == p) { js_parse_error(s, "invalid UTF-8 sequence"); goto fail; } p = p_next; } if (string_buffer_putc(b, c)) goto fail; } str = string_buffer_end(b); if (JS_IsException(str)) return -1; s->token.val = TOK_TEMPLATE; s->token.u.str.sep = c; s->token.u.str.str = str; s->buf_ptr = p; return 0; unexpected_eof: js_parse_error(s, "unexpected end of string"); fail: string_buffer_free(b); return -1; } static __exception int js_parse_string(JSParseState *s, int sep, bool do_throw, const uint8_t *p, JSToken *token, const uint8_t **pp) { const uint8_t *p_next; int ret; uint32_t c; StringBuffer b_s, *b = &b_s; JSValue str; /* string */ if (string_buffer_init(s->ctx, b, 32)) goto fail; for(;;) { if (p >= s->buf_end) goto invalid_char; c = *p; if (c < 0x20) { if (sep == '`') { if (c == '\r') { if (p[1] == '\n') p++; c = '\n'; } /* do not update s->line_num */ } else if (c == '\n' || c == '\r') goto invalid_char; } p++; if (c == sep) break; if (c == '$' && *p == '{' && sep == '`') { /* template start or middle part */ p++; break; } if (c == '\\') { c = *p; switch(c) { case '\0': if (p >= s->buf_end) { if (sep != '`') goto invalid_char; if (do_throw) js_parse_error(s, "Unexpected end of input"); goto fail; } p++; break; case '\'': case '\"': case '\\': p++; break; case '\r': /* accept DOS and MAC newline sequences */ if (p[1] == '\n') { p++; } /* fall thru */ case '\n': /* ignore escaped newline sequence */ p++; if (sep != '`') { s->line_num++; s->eol = &p[-1]; s->mark = p; } continue; default: if (c == '0' && !(p[1] >= '0' && p[1] <= '9')) { /* accept isolated \0 */ p++; c = '\0'; } else if ((c >= '0' && c <= '9') && (s->cur_func->is_strict_mode || sep == '`')) { if (do_throw) { js_parse_error(s, "%s are not allowed in %s", (c >= '8') ? "\\8 and \\9" : "Octal escape sequences", (sep == '`') ? "template strings" : "strict mode"); } goto fail; } else if (c >= 0x80) { c = utf8_decode(p, &p_next); if (p_next == p + 1) { goto invalid_utf8; } p = p_next; /* LS or PS are skipped */ if (c == CP_LS || c == CP_PS) continue; } else { ret = lre_parse_escape(&p, true); if (ret == -1) { if (do_throw) { js_parse_error(s, "Invalid %s escape sequence", c == 'u' ? "Unicode" : "hexadecimal"); } goto fail; } else if (ret < 0) { /* ignore the '\' (could output a warning) */ p++; } else { c = ret; } } break; } } else if (c >= 0x80) { c = utf8_decode(p - 1, &p_next); if (p_next == p) goto invalid_utf8; p = p_next; } if (string_buffer_putc(b, c)) goto fail; } str = string_buffer_end(b); if (JS_IsException(str)) return -1; token->val = TOK_STRING; token->u.str.sep = c; token->u.str.str = str; *pp = p; return 0; invalid_utf8: if (do_throw) js_parse_error(s, "invalid UTF-8 sequence"); goto fail; invalid_char: if (do_throw) js_parse_error(s, "unexpected end of string"); fail: string_buffer_free(b); return -1; } static inline bool token_is_pseudo_keyword(JSParseState *s, JSAtom atom) { return s->token.val == TOK_IDENT && s->token.u.ident.atom == atom && !s->token.u.ident.has_escape; } static __exception int js_parse_regexp(JSParseState *s) { const uint8_t *p, *p_next; bool in_class; StringBuffer b_s, *b = &b_s; StringBuffer b2_s, *b2 = &b2_s; uint32_t c; JSValue body_str, flags_str; p = s->buf_ptr; p++; in_class = false; if (string_buffer_init(s->ctx, b, 32)) return -1; if (string_buffer_init(s->ctx, b2, 1)) goto fail; for(;;) { if (p >= s->buf_end) { eof_error: js_parse_error(s, "unexpected end of regexp"); goto fail; } c = *p++; if (c == '\n' || c == '\r') { goto eol_error; } else if (c == '/') { if (!in_class) break; } else if (c == '[') { in_class = true; } else if (c == ']') { /* XXX: incorrect as the first character in a class */ in_class = false; } else if (c == '\\') { if (string_buffer_putc8(b, c)) goto fail; c = *p++; if (c == '\n' || c == '\r') goto eol_error; else if (c == '\0' && p >= s->buf_end) goto eof_error; else if (c >= 0x80) { c = utf8_decode(p - 1, &p_next); if (p_next == p) { goto invalid_utf8; } p = p_next; if (c == CP_LS || c == CP_PS) goto eol_error; } } else if (c >= 0x80) { c = utf8_decode(p - 1, &p_next); if (p_next == p) { invalid_utf8: js_parse_error(s, "invalid UTF-8 sequence"); goto fail; } p = p_next; /* LS or PS are considered as line terminator */ if (c == CP_LS || c == CP_PS) { eol_error: js_parse_error(s, "unexpected line terminator in regexp"); goto fail; } } if (string_buffer_putc(b, c)) goto fail; } /* flags */ for(;;) { c = utf8_decode(p, &p_next); /* no need to test for invalid UTF-8, 0xFFFD is not ident_next */ if (!lre_js_is_ident_next(c)) break; if (string_buffer_putc(b2, c)) goto fail; p = p_next; } body_str = string_buffer_end(b); flags_str = string_buffer_end(b2); if (JS_IsException(body_str) || JS_IsException(flags_str)) { JS_FreeValue(s->ctx, body_str); JS_FreeValue(s->ctx, flags_str); return -1; } s->token.val = TOK_REGEXP; s->token.u.regexp.body = body_str; s->token.u.regexp.flags = flags_str; s->buf_ptr = p; return 0; fail: string_buffer_free(b); string_buffer_free(b2); return -1; } #endif // QJS_DISABLE_PARSER static __exception int ident_realloc(JSContext *ctx, char **pbuf, size_t *psize, char *static_buf) { char *buf, *new_buf; size_t size, new_size; buf = *pbuf; size = *psize; if (size >= (SIZE_MAX / 3) * 2) new_size = SIZE_MAX; else new_size = size + (size >> 1); if (buf == static_buf) { new_buf = js_malloc(ctx, new_size); if (!new_buf) return -1; memcpy(new_buf, buf, size); } else { new_buf = js_realloc(ctx, buf, new_size); if (!new_buf) return -1; } *pbuf = new_buf; *psize = new_size; return 0; } #ifndef QJS_DISABLE_PARSER /* convert a TOK_IDENT to a keyword when needed */ static void update_token_ident(JSParseState *s) { if (s->token.u.ident.atom <= JS_ATOM_LAST_KEYWORD || (s->token.u.ident.atom <= JS_ATOM_LAST_STRICT_KEYWORD && s->cur_func->is_strict_mode) || (s->token.u.ident.atom == JS_ATOM_yield && ((s->cur_func->func_kind & JS_FUNC_GENERATOR) || (s->cur_func->func_type == JS_PARSE_FUNC_ARROW && !s->cur_func->in_function_body && s->cur_func->parent && (s->cur_func->parent->func_kind & JS_FUNC_GENERATOR)))) || (s->token.u.ident.atom == JS_ATOM_await && (s->is_module || (s->cur_func->func_kind & JS_FUNC_ASYNC) || s->cur_func->func_type == JS_PARSE_FUNC_CLASS_STATIC_INIT || (s->cur_func->func_type == JS_PARSE_FUNC_ARROW && !s->cur_func->in_function_body && s->cur_func->parent && ((s->cur_func->parent->func_kind & JS_FUNC_ASYNC) || s->cur_func->parent->func_type == JS_PARSE_FUNC_CLASS_STATIC_INIT))))) { if (s->token.u.ident.has_escape) { s->token.u.ident.is_reserved = true; s->token.val = TOK_IDENT; } else { /* The keywords atoms are pre allocated */ s->token.val = s->token.u.ident.atom - 1 + TOK_FIRST_KEYWORD; } } } /* if the current token is an identifier or keyword, reparse it according to the current function type */ static void reparse_ident_token(JSParseState *s) { if (s->token.val == TOK_IDENT || (s->token.val >= TOK_FIRST_KEYWORD && s->token.val <= TOK_LAST_KEYWORD)) { s->token.val = TOK_IDENT; s->token.u.ident.is_reserved = false; update_token_ident(s); } } /* 'c' is the first character. Return JS_ATOM_NULL in case of error */ static JSAtom parse_ident(JSParseState *s, const uint8_t **pp, bool *pident_has_escape, int c, bool is_private) { const uint8_t *p, *p_next; char ident_buf[128], *buf; size_t ident_size, ident_pos; JSAtom atom = JS_ATOM_NULL; p = *pp; buf = ident_buf; ident_size = sizeof(ident_buf); ident_pos = 0; if (is_private) buf[ident_pos++] = '#'; for(;;) { if (c < 0x80) { buf[ident_pos++] = c; } else { ident_pos += utf8_encode((uint8_t*)buf + ident_pos, c); } c = *p; p_next = p + 1; if (c == '\\' && *p_next == 'u') { c = lre_parse_escape(&p_next, true); *pident_has_escape = true; } else if (c >= 0x80) { c = utf8_decode(p, &p_next); /* no need to test for invalid UTF-8, 0xFFFD is not ident_next */ } if (!lre_js_is_ident_next(c)) break; p = p_next; if (unlikely(ident_pos >= ident_size - UTF8_CHAR_LEN_MAX)) { if (ident_realloc(s->ctx, &buf, &ident_size, ident_buf)) goto done; } } /* buf is pure ASCII or UTF-8 encoded */ atom = JS_NewAtomLen(s->ctx, buf, ident_pos); done: if (unlikely(buf != ident_buf)) js_free(s->ctx, buf); *pp = p; return atom; } static __exception int next_token(JSParseState *s) { const uint8_t *p, *p_next; int c; bool ident_has_escape; JSAtom atom; if (js_check_stack_overflow(s->ctx->rt, 1000)) { JS_ThrowStackOverflow(s->ctx); return -1; } free_token(s, &s->token); p = s->last_ptr = s->buf_ptr; s->got_lf = false; s->last_line_num = s->token.line_num; s->last_col_num = s->token.col_num; redo: s->token.line_num = s->line_num; s->token.col_num = s->col_num; s->token.ptr = p; c = *p; switch(c) { case 0: if (p >= s->buf_end) { s->token.val = TOK_EOF; } else { goto def_token; } break; case '`': if (js_parse_template_part(s, p + 1)) goto fail; p = s->buf_ptr; break; case '\'': case '\"': if (js_parse_string(s, c, true, p + 1, &s->token, &p)) goto fail; break; case '\r': /* accept DOS and MAC newline sequences */ if (p[1] == '\n') { p++; } /* fall thru */ case '\n': p++; line_terminator: s->eol = &p[-1]; s->mark = p; s->got_lf = true; s->line_num++; goto redo; case '\f': case '\v': case ' ': case '\t': s->mark = ++p; goto redo; case '/': if (p[1] == '*') { /* comment */ p += 2; for(;;) { if (*p == '\0' && p >= s->buf_end) { js_parse_error(s, "unexpected end of comment"); goto fail; } if (p[0] == '*' && p[1] == '/') { p += 2; break; } if (*p == '\n') { s->line_num++; s->got_lf = true; /* considered as LF for ASI */ s->eol = p++; s->mark = p; } else if (*p == '\r') { s->got_lf = true; /* considered as LF for ASI */ p++; } else if (*p >= 0x80) { c = utf8_decode(p, &p); /* ignore invalid UTF-8 in comments */ if (c == CP_LS || c == CP_PS) { s->got_lf = true; /* considered as LF for ASI */ } } else { p++; } } s->mark = p; goto redo; } else if (p[1] == '/') { /* line comment */ p += 2; skip_line_comment: for(;;) { if (*p == '\0' && p >= s->buf_end) break; if (*p == '\r' || *p == '\n') break; if (*p >= 0x80) { c = utf8_decode(p, &p); /* ignore invalid UTF-8 in comments */ /* LS or PS are considered as line terminator */ if (c == CP_LS || c == CP_PS) { break; } } else { p++; } } s->mark = p; goto redo; } else if (p[1] == '=') { p += 2; s->token.val = TOK_DIV_ASSIGN; } else { p++; s->token.val = c; } break; case '\\': if (p[1] == 'u') { const uint8_t *p1 = p + 1; int c1 = lre_parse_escape(&p1, true); if (c1 >= 0 && lre_js_is_ident_first(c1)) { c = c1; p = p1; ident_has_escape = true; goto has_ident; } else { /* XXX: syntax error? */ } } goto def_token; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '_': case '$': /* identifier */ s->mark = p; p++; ident_has_escape = false; has_ident: atom = parse_ident(s, &p, &ident_has_escape, c, false); if (atom == JS_ATOM_NULL) goto fail; s->token.u.ident.atom = atom; s->token.u.ident.has_escape = ident_has_escape; s->token.u.ident.is_reserved = false; s->token.val = TOK_IDENT; update_token_ident(s); break; case '#': /* private name */ { p++; c = *p; p_next = p + 1; if (c == '\\' && *p_next == 'u') { c = lre_parse_escape(&p_next, true); } else if (c >= 0x80) { c = utf8_decode(p, &p_next); if (p_next == p + 1) goto invalid_utf8; } if (!lre_js_is_ident_first(c)) { js_parse_error(s, "invalid first character of private name"); goto fail; } p = p_next; ident_has_escape = false; /* not used */ atom = parse_ident(s, &p, &ident_has_escape, c, true); if (atom == JS_ATOM_NULL) goto fail; s->token.u.ident.atom = atom; s->token.val = TOK_PRIVATE_NAME; } break; case '.': if (p[1] == '.' && p[2] == '.') { p += 3; s->token.val = TOK_ELLIPSIS; break; } if (p[1] >= '0' && p[1] <= '9') { goto parse_number; } else { goto def_token; } break; case '0': /* in strict mode, octal literals are not accepted */ if (is_digit(p[1]) && (s->cur_func->is_strict_mode)) { js_parse_error(s, "Octal literals are not allowed in strict mode"); goto fail; } goto parse_number; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': /* number */ parse_number: { JSValue ret; const uint8_t *p1; int flags; flags = ATOD_ACCEPT_BIN_OCT | ATOD_ACCEPT_LEGACY_OCTAL | ATOD_ACCEPT_UNDERSCORES | ATOD_ACCEPT_SUFFIX; ret = js_atof(s->ctx, (const char *)p, (const char **)&p, 0, flags); if (JS_IsException(ret)) goto fail; /* reject `10instanceof Number` */ if (JS_VALUE_IS_NAN(ret) || lre_js_is_ident_next(utf8_decode(p, &p1))) { JS_FreeValue(s->ctx, ret); js_parse_error(s, "invalid number literal"); goto fail; } s->token.val = TOK_NUMBER; s->token.u.num.val = ret; } break; case '*': if (p[1] == '=') { p += 2; s->token.val = TOK_MUL_ASSIGN; } else if (p[1] == '*') { if (p[2] == '=') { p += 3; s->token.val = TOK_POW_ASSIGN; } else { p += 2; s->token.val = TOK_POW; } } else { goto def_token; } break; case '%': if (p[1] == '=') { p += 2; s->token.val = TOK_MOD_ASSIGN; } else { goto def_token; } break; case '+': if (p[1] == '=') { p += 2; s->token.val = TOK_PLUS_ASSIGN; } else if (p[1] == '+') { p += 2; s->token.val = TOK_INC; } else { goto def_token; } break; case '-': if (p[1] == '=') { p += 2; s->token.val = TOK_MINUS_ASSIGN; } else if (p[1] == '-') { if (s->allow_html_comments && p[2] == '>' && (s->got_lf || s->last_ptr == s->buf_start)) { /* Annex B: `-->` at beginning of line is an html comment end. It extends to the end of the line. */ goto skip_line_comment; } p += 2; s->token.val = TOK_DEC; } else { goto def_token; } break; case '<': if (p[1] == '=') { p += 2; s->token.val = TOK_LTE; } else if (p[1] == '<') { if (p[2] == '=') { p += 3; s->token.val = TOK_SHL_ASSIGN; } else { p += 2; s->token.val = TOK_SHL; } } else if (s->allow_html_comments && p[1] == '!' && p[2] == '-' && p[3] == '-') { /* Annex B: handle ` qbs-src-3.2.0/examples/install-bundle/0000755000175100017510000000000015154533055017235 5ustar runnerrunnerqbs-src-3.2.0/examples/install-bundle/main.cpp0000644000175100017510000000507515154533055020674 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of Qbs. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget window; window.show(); return app.exec(); } qbs-src-3.2.0/examples/install-bundle/white.iconset/0000755000175100017510000000000015154533055022020 5ustar runnerrunnerqbs-src-3.2.0/examples/install-bundle/white.iconset/icon_16x16@2x.png0000644000175100017510000000123115154533055024672 0ustar runnerrunnerPNG  IHDR szzsRGB pHYs%%IR$iTXtXML:com.adobe.xmp 4 4 1 #2IDATX A 1g ٻx\=/ @ 0M<^IENDB`qbs-src-3.2.0/examples/install-bundle/white.iconset/icon_16x16.png0000644000175100017510000000121115154533055024316 0ustar runnerrunnerPNG  IHDRasRGB pHYs  iTXtXML:com.adobe.xmp 4 4 1 #"IDAT8c & 􂵎0a k IENDB`qbs-src-3.2.0/examples/install-bundle/coreutils.cpp0000644000175100017510000000470115154533055021754 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of Qbs. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "coreutils.h" int foo() { return 42; } qbs-src-3.2.0/examples/install-bundle/assetcatalog2.xcassets/0000755000175100017510000000000015154533055023625 5ustar runnerrunnerqbs-src-3.2.0/examples/install-bundle/assetcatalog2.xcassets/other.imageset/0000755000175100017510000000000015154533055026543 5ustar runnerrunnerqbs-src-3.2.0/examples/install-bundle/assetcatalog2.xcassets/other.imageset/icon_16x16@2x.png0000644000175100017510000000123115154533055031415 0ustar runnerrunnerPNG  IHDR szzsRGB pHYs%%IR$iTXtXML:com.adobe.xmp 4 4 1 #2IDATX A 1g ٻx\=/ @ 0M<^IENDB`qbs-src-3.2.0/examples/install-bundle/assetcatalog2.xcassets/other.imageset/icon_16x16.png0000644000175100017510000000121115154533055031041 0ustar runnerrunnerPNG  IHDRasRGB pHYs  iTXtXML:com.adobe.xmp 4 4 1 #"IDAT8c & 􂵎0a k IENDB`qbs-src-3.2.0/examples/install-bundle/assetcatalog2.xcassets/other.imageset/Contents.json0000644000175100017510000000053315154533055031234 0ustar runnerrunner{ "images" : [ { "idiom" : "universal", "scale" : "1x", "filename" : "icon_16x16.png" }, { "idiom" : "universal", "scale" : "2x", "filename" : "icon_16x16@2x.png" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } }qbs-src-3.2.0/examples/install-bundle/MainMenu.xib0000644000175100017510000014072115154533055021457 0ustar runnerrunner Default Left to Right Right to Left Default Left to Right Right to Left qbs-src-3.2.0/examples/install-bundle/Storyboard.storyboard0000644000175100017510000000530415154533055023501 0ustar runnerrunner qbs-src-3.2.0/examples/install-bundle/assetcatalog1.xcassets/0000755000175100017510000000000015154533055023624 5ustar runnerrunnerqbs-src-3.2.0/examples/install-bundle/assetcatalog1.xcassets/other.imageset/0000755000175100017510000000000015154533055026542 5ustar runnerrunnerqbs-src-3.2.0/examples/install-bundle/assetcatalog1.xcassets/other.imageset/icon_16x16@2x.png0000644000175100017510000000123115154533055031414 0ustar runnerrunnerPNG  IHDR szzsRGB pHYs%%IR$iTXtXML:com.adobe.xmp 4 4 1 #2IDATX A 1g ٻx\=/ @ 0M<^IENDB`qbs-src-3.2.0/examples/install-bundle/assetcatalog1.xcassets/other.imageset/icon_16x16.png0000644000175100017510000000121115154533055031040 0ustar runnerrunnerPNG  IHDRasRGB pHYs  iTXtXML:com.adobe.xmp 4 4 1 #"IDAT8c & 􂵎0a k IENDB`qbs-src-3.2.0/examples/install-bundle/assetcatalog1.xcassets/other.imageset/Contents.json0000644000175100017510000000053315154533055031233 0ustar runnerrunner{ "images" : [ { "idiom" : "universal", "scale" : "1x", "filename" : "icon_16x16.png" }, { "idiom" : "universal", "scale" : "2x", "filename" : "icon_16x16@2x.png" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } }qbs-src-3.2.0/examples/install-bundle/coreutils.h0000644000175100017510000000470215154533055021422 0ustar runnerrunner/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of Qbs. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifdef _WIN32 __declspec(dllexport) #endif int foo(); qbs-src-3.2.0/examples/install-bundle/install-bundle.qbs0000644000175100017510000000351615154533055022666 0ustar runnerrunnerimport qbs.FileInfo Project { CppApplication { Depends { name: "bundle" } Depends { name: "windowutils" } Depends { name: "ib"; condition: qbs.targetOS.contains("darwin") } Depends { name: "Qt"; submodules: ["core", "gui", "widgets"] } condition: (qbs.targetOS.contains("macos") || qbs.targetOS.contains("linux") || qbs.targetOS.contains("windows")) && !Qt.core.staticBuild name: "window" property bool isBundle: bundle.isBundle targetName: isBundle ? "Window" : "window" files: [ "main.cpp", "assetcatalog1.xcassets", "assetcatalog2.xcassets", "white.iconset", "MainMenu.xib", "Storyboard.storyboard" ] cpp.minimumMacosVersion: "10.10" Group { fileTagsFilter: qbs.targetOS.contains("darwin") && isBundle ? ["bundle.content"] : ["application"] qbs.install: true qbs.installDir: isBundle ? "Applications" : (qbs.targetOS.contains("windows") ? "" : "bin") qbs.installSourceBase: product.buildDirectory } } DynamicLibrary { Depends { name: "bundle" } Depends { name: "cpp" } name: "windowutils" property bool isBundle: qbs.targetOS.contains("darwin") && bundle.isBundle targetName: isBundle ? "WindowUtils" : "windowutils" files: ["coreutils.cpp", "coreutils.h"] Group { fileTagsFilter: isBundle ? ["bundle.content"] : ["dynamiclibrary", "dynamiclibrary_symlink", "dynamiclibrary_import"] qbs.install: true qbs.installDir: isBundle ? "Library/Frameworks" : (qbs.targetOS.contains("windows") ? "" : "lib") qbs.installSourceBase: product.buildDirectory } } } qbs-src-3.2.0/examples/capnproto/0000755000175100017510000000000015154533055016325 5ustar runnerrunnerqbs-src-3.2.0/examples/capnproto/addressbook_cpp/0000755000175100017510000000000015154533055021467 5ustar runnerrunnerqbs-src-3.2.0/examples/capnproto/addressbook_cpp/addressbook_cpp.qbs0000644000175100017510000000044615154533055025344 0ustar runnerrunnerCppApplication { Depends { name: "capnproto.cpp"; required: false } condition: capnproto.cpp.present && qbs.targetPlatform === qbs.hostPlatform consoleApplication: true cpp.minimumMacosVersion: "10.8" files: [ "addressbook.capnp", "addressbook.cpp" ] } qbs-src-3.2.0/examples/capnproto/addressbook_cpp/addressbook.cpp0000644000175100017510000002271115154533055024476 0ustar runnerrunner// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors // Licensed under the MIT License: // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // This sample code appears in the documentation for the C++ implementation. // // If Cap'n Proto is installed, build the sample like: // capnp compile -oc++ addressbook.capnp // c++ -std=c++14 -Wall addressbook.c++ addressbook.capnp.c++ `pkg-config --cflags --libs capnp` -o addressbook // // If Cap'n Proto is not installed, but the source is located at $SRC and has been // compiled in $BUILD (often both are simply ".." from here), you can do: // $BUILD/capnp compile -I$SRC/src -o$BUILD/capnpc-c++ addressbook.capnp // c++ -std=c++14 -Wall addressbook.c++ addressbook.capnp.c++ -I$SRC/src -L$BUILD/.libs -lcapnp -lkj -o addressbook // // Run like: // ./addressbook write | ./addressbook read // Use "dwrite" and "dread" to use dynamic code instead. // TODO(test): Needs cleanup. #include "addressbook.capnp.h" #include #include #include using addressbook::Person; using addressbook::AddressBook; void writeAddressBook(int fd) { ::capnp::MallocMessageBuilder message; AddressBook::Builder addressBook = message.initRoot(); ::capnp::List::Builder people = addressBook.initPeople(2); Person::Builder alice = people[0]; alice.setId(123); alice.setName("Alice"); alice.setEmail("alice@example.com"); // Type shown for explanation purposes; normally you'd use auto. ::capnp::List::Builder alicePhones = alice.initPhones(1); alicePhones[0].setNumber("555-1212"); alicePhones[0].setType(Person::PhoneNumber::Type::MOBILE); alice.getEmployment().setSchool("MIT"); Person::Builder bob = people[1]; bob.setId(456); bob.setName("Bob"); bob.setEmail("bob@example.com"); auto bobPhones = bob.initPhones(2); bobPhones[0].setNumber("555-4567"); bobPhones[0].setType(Person::PhoneNumber::Type::HOME); bobPhones[1].setNumber("555-7654"); bobPhones[1].setType(Person::PhoneNumber::Type::WORK); bob.getEmployment().setUnemployed(); writePackedMessageToFd(fd, message); } void printAddressBook(int fd) { ::capnp::PackedFdMessageReader message(fd); AddressBook::Reader addressBook = message.getRoot(); for (Person::Reader person : addressBook.getPeople()) { std::cout << person.getName().cStr() << ": " << person.getEmail().cStr() << std::endl; for (Person::PhoneNumber::Reader phone: person.getPhones()) { const char* typeName = "UNKNOWN"; switch (phone.getType()) { case Person::PhoneNumber::Type::MOBILE: typeName = "mobile"; break; case Person::PhoneNumber::Type::HOME: typeName = "home"; break; case Person::PhoneNumber::Type::WORK: typeName = "work"; break; } std::cout << " " << typeName << " phone: " << phone.getNumber().cStr() << std::endl; } Person::Employment::Reader employment = person.getEmployment(); switch (employment.which()) { case Person::Employment::UNEMPLOYED: std::cout << " unemployed" << std::endl; break; case Person::Employment::EMPLOYER: std::cout << " employer: " << employment.getEmployer().cStr() << std::endl; break; case Person::Employment::SCHOOL: std::cout << " student at: " << employment.getSchool().cStr() << std::endl; break; case Person::Employment::SELF_EMPLOYED: std::cout << " self-employed" << std::endl; break; } } } #if !CAPNP_LITE #include "addressbook.capnp.h" #include #include #include #include #include using ::capnp::DynamicValue; using ::capnp::DynamicStruct; using ::capnp::DynamicEnum; using ::capnp::DynamicList; using ::capnp::List; using ::capnp::Schema; using ::capnp::StructSchema; using ::capnp::EnumSchema; using ::capnp::Void; using ::capnp::Text; using ::capnp::MallocMessageBuilder; using ::capnp::PackedFdMessageReader; void dynamicWriteAddressBook(int fd, StructSchema schema) { // Write a message using the dynamic API to set each // field by text name. This isn't something you'd // normally want to do; it's just for illustration. MallocMessageBuilder message; // Types shown for explanation purposes; normally you'd // use auto. DynamicStruct::Builder addressBook = message.initRoot(schema); DynamicList::Builder people = addressBook.init("people", 2).as(); DynamicStruct::Builder alice = people[0].as(); alice.set("id", 123); alice.set("name", "Alice"); alice.set("email", "alice@example.com"); auto alicePhones = alice.init("phones", 1).as(); auto phone0 = alicePhones[0].as(); phone0.set("number", "555-1212"); phone0.set("type", "mobile"); alice.get("employment").as() .set("school", "MIT"); auto bob = people[1].as(); bob.set("id", 456); bob.set("name", "Bob"); bob.set("email", "bob@example.com"); // Some magic: We can convert a dynamic sub-value back to // the native type with as()! List::Builder bobPhones = bob.init("phones", 2).as>(); bobPhones[0].setNumber("555-4567"); bobPhones[0].setType(Person::PhoneNumber::Type::HOME); bobPhones[1].setNumber("555-7654"); bobPhones[1].setType(Person::PhoneNumber::Type::WORK); bob.get("employment").as() .set("unemployed", ::capnp::VOID); writePackedMessageToFd(fd, message); } void dynamicPrintValue(DynamicValue::Reader value) { // Print an arbitrary message via the dynamic API by // iterating over the schema. Look at the handling // of STRUCT in particular. switch (value.getType()) { case DynamicValue::VOID: std::cout << ""; break; case DynamicValue::BOOL: std::cout << (value.as() ? "true" : "false"); break; case DynamicValue::INT: std::cout << value.as(); break; case DynamicValue::UINT: std::cout << value.as(); break; case DynamicValue::FLOAT: std::cout << value.as(); break; case DynamicValue::TEXT: std::cout << '\"' << value.as().cStr() << '\"'; break; case DynamicValue::LIST: { std::cout << "["; bool first = true; for (auto element: value.as()) { if (first) { first = false; } else { std::cout << ", "; } dynamicPrintValue(element); } std::cout << "]"; break; } case DynamicValue::ENUM: { auto enumValue = value.as(); KJ_IF_MAYBE(enumerant, enumValue.getEnumerant()) { std::cout << enumerant->getProto().getName().cStr(); } else { // Unknown enum value; output raw number. std::cout << enumValue.getRaw(); } break; } case DynamicValue::STRUCT: { std::cout << "("; auto structValue = value.as(); bool first = true; for (auto field: structValue.getSchema().getFields()) { if (!structValue.has(field)) continue; if (first) { first = false; } else { std::cout << ", "; } std::cout << field.getProto().getName().cStr() << " = "; dynamicPrintValue(structValue.get(field)); } std::cout << ")"; break; } default: // There are other types, we aren't handling them. std::cout << "?"; break; } } void dynamicPrintMessage(int fd, StructSchema schema) { PackedFdMessageReader message(fd); dynamicPrintValue(message.getRoot(schema)); std::cout << std::endl; } #endif // !CAPNP_LITE int main(int argc, char* argv[]) { if (argc != 2) { std::cerr << "Missing arg." << std::endl; return 1; } else if (strcmp(argv[1], "write") == 0) { writeAddressBook(1); } else if (strcmp(argv[1], "read") == 0) { printAddressBook(0); #if !CAPNP_LITE } else if (strcmp(argv[1], "dwrite") == 0) { StructSchema schema = Schema::from(); dynamicWriteAddressBook(1, schema); } else if (strcmp(argv[1], "dread") == 0) { StructSchema schema = Schema::from(); dynamicPrintMessage(0, schema); #endif } else { std::cerr << "Invalid arg: " << argv[1] << std::endl; return 1; } return 0; } qbs-src-3.2.0/examples/capnproto/addressbook_cpp/addressbook.capnp0000644000175100017510000000330015154533055025006 0ustar runnerrunner# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors # Licensed under the MIT License: # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. @0x9eb32e19f86ee174; using Cxx = import "/capnp/c++.capnp"; $Cxx.namespace("addressbook"); struct Person { id @0 :UInt32; name @1 :Text; email @2 :Text; phones @3 :List(PhoneNumber); struct PhoneNumber { number @0 :Text; type @1 :Type; enum Type { mobile @0; home @1; work @2; } } employment :union { unemployed @4 :Void; employer @5 :Text; school @6 :Text; selfEmployed @7 :Void; # We assume that a person is only one of these. } } struct AddressBook { people @0 :List(Person); } qbs-src-3.2.0/examples/capnproto/calculator_cpp/0000755000175100017510000000000015154533055021320 5ustar runnerrunnerqbs-src-3.2.0/examples/capnproto/calculator_cpp/calculator.capnp0000644000175100017510000001105315154533055024474 0ustar runnerrunner# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors # Licensed under the MIT License: # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. @0x85150b117366d14b; interface Calculator { # A "simple" mathematical calculator, callable via RPC. # # But, to show off Cap'n Proto, we add some twists: # # - You can use the result from one call as the input to the next # without a network round trip. To accomplish this, evaluate() # returns a `Value` object wrapping the actual numeric value. # This object may be used in a subsequent expression. With # promise pipelining, the Value can actually be used before # the evaluate() call that creates it returns! # # - You can define new functions, and then call them. This again # shows off pipelining, but it also gives the client the # opportunity to define a function on the client side and have # the server call back to it. # # - The basic arithmetic operators are exposed as Functions, and # you have to call getOperator() to obtain them from the server. # This again demonstrates pipelining -- using getOperator() to # get each operator and then using them in evaluate() still # only takes one network round trip. evaluate @0 (expression :Expression) -> (value :Value); # Evaluate the given expression and return the result. The # result is returned wrapped in a Value interface so that you # may pass it back to the server in a pipelined request. To # actually get the numeric value, you must call read() on the # Value -- but again, this can be pipelined so that it incurs # no additional latency. struct Expression { # A numeric expression. union { literal @0 :Float64; # A literal numeric value. previousResult @1 :Value; # A value that was (or, will be) returned by a previous # evaluate(). parameter @2 :UInt32; # A parameter to the function (only valid in function bodies; # see defFunction). call :group { # Call a function on a list of parameters. function @3 :Function; params @4 :List(Expression); } } } interface Value { # Wraps a numeric value in an RPC object. This allows the value # to be used in subsequent evaluate() requests without the client # waiting for the evaluate() that returns the Value to finish. read @0 () -> (value :Float64); # Read back the raw numeric value. } defFunction @1 (paramCount :Int32, body :Expression) -> (func :Function); # Define a function that takes `paramCount` parameters and returns the # evaluation of `body` after substituting these parameters. interface Function { # An algebraic function. Can be called directly, or can be used inside # an Expression. # # A client can create a Function that runs on the server side using # `defFunction()` or `getOperator()`. Alternatively, a client can # implement a Function on the client side and the server will call back # to it. However, a function defined on the client side will require a # network round trip whenever the server needs to call it, whereas # functions defined on the server and then passed back to it are called # locally. call @0 (params :List(Float64)) -> (value :Float64); # Call the function on the given parameters. } getOperator @2 (op :Operator) -> (func :Function); # Get a Function representing an arithmetic operator, which can then be # used in Expressions. enum Operator { add @0; subtract @1; multiply @2; divide @3; } } qbs-src-3.2.0/examples/capnproto/calculator_cpp/calculator-server.cpp0000644000175100017510000001657115154533055025473 0ustar runnerrunner// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors // Licensed under the MIT License: // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #include "calculator.capnp.h" #include #include #include #include typedef unsigned int uint; kj::Promise readValue(Calculator::Value::Client value) { // Helper function to asynchronously call read() on a Calculator::Value and // return a promise for the result. (In the future, the generated code might // include something like this automatically.) return value.readRequest().send() .then([](capnp::Response result) { return result.getValue(); }); } kj::Promise evaluateImpl( Calculator::Expression::Reader expression, capnp::List::Reader params = capnp::List::Reader()) { // Implementation of CalculatorImpl::evaluate(), also shared by // FunctionImpl::call(). In the latter case, `params` are the parameter // values passed to the function; in the former case, `params` is just an // empty list. switch (expression.which()) { case Calculator::Expression::LITERAL: return expression.getLiteral(); case Calculator::Expression::PREVIOUS_RESULT: return readValue(expression.getPreviousResult()); case Calculator::Expression::PARAMETER: { KJ_REQUIRE(expression.getParameter() < params.size(), "Parameter index out-of-range."); return params[expression.getParameter()]; } case Calculator::Expression::CALL: { auto call = expression.getCall(); auto func = call.getFunction(); // Evaluate each parameter. kj::Array> paramPromises = KJ_MAP(param, call.getParams()) { return evaluateImpl(param, params); }; // Join the array of promises into a promise for an array. kj::Promise> joinedParams = kj::joinPromises(kj::mv(paramPromises)); // When the parameters are complete, call the function. return joinedParams.then([KJ_CPCAP(func)](kj::Array&& paramValues) mutable { auto request = func.callRequest(); request.setParams(paramValues); return request.send().then( [](capnp::Response&& result) { return result.getValue(); }); }); } default: // Throw an exception. KJ_FAIL_REQUIRE("Unknown expression type."); } } class ValueImpl final: public Calculator::Value::Server { // Simple implementation of the Calculator.Value Cap'n Proto interface. public: ValueImpl(double value): value(value) {} kj::Promise read(ReadContext context) { context.getResults().setValue(value); return kj::READY_NOW; } private: double value; }; class FunctionImpl final: public Calculator::Function::Server { // Implementation of the Calculator.Function Cap'n Proto interface, where the // function is defined by a Calculator.Expression. public: FunctionImpl(uint paramCount, Calculator::Expression::Reader body) : paramCount(paramCount) { this->body.setRoot(body); } kj::Promise call(CallContext context) { auto params = context.getParams().getParams(); KJ_REQUIRE(params.size() == paramCount, "Wrong number of parameters."); return evaluateImpl(body.getRoot(), params) .then([KJ_CPCAP(context)](double value) mutable { context.getResults().setValue(value); }); } private: uint paramCount; // The function's arity. capnp::MallocMessageBuilder body; // Stores a permanent copy of the function body. }; class OperatorImpl final: public Calculator::Function::Server { // Implementation of the Calculator.Function Cap'n Proto interface, wrapping // basic binary arithmetic operators. public: OperatorImpl(Calculator::Operator op): op(op) {} kj::Promise call(CallContext context) { auto params = context.getParams().getParams(); KJ_REQUIRE(params.size() == 2, "Wrong number of parameters."); double result; switch (op) { case Calculator::Operator::ADD: result = params[0] + params[1]; break; case Calculator::Operator::SUBTRACT:result = params[0] - params[1]; break; case Calculator::Operator::MULTIPLY:result = params[0] * params[1]; break; case Calculator::Operator::DIVIDE: result = params[0] / params[1]; break; default: KJ_FAIL_REQUIRE("Unknown operator."); } context.getResults().setValue(result); return kj::READY_NOW; } private: Calculator::Operator op; }; class CalculatorImpl final: public Calculator::Server { // Implementation of the Calculator Cap'n Proto interface. public: kj::Promise evaluate(EvaluateContext context) override { return evaluateImpl(context.getParams().getExpression()) .then([KJ_CPCAP(context)](double value) mutable { context.getResults().setValue(kj::heap(value)); }); } kj::Promise defFunction(DefFunctionContext context) override { auto params = context.getParams(); context.getResults().setFunc(kj::heap( params.getParamCount(), params.getBody())); return kj::READY_NOW; } kj::Promise getOperator(GetOperatorContext context) override { context.getResults().setFunc(kj::heap( context.getParams().getOp())); return kj::READY_NOW; } }; int main(int argc, const char* argv[]) { if (argc != 2) { std::cerr << "usage: " << argv[0] << " ADDRESS[:PORT]\n" "Runs the server bound to the given address/port.\n" "ADDRESS may be '*' to bind to all local addresses.\n" ":PORT may be omitted to choose a port automatically." << std::endl; return 1; } // Set up a server. capnp::EzRpcServer server(kj::heap(), argv[1]); // Write the port number to stdout, in case it was chosen automatically. auto& waitScope = server.getWaitScope(); uint port = server.getPort().wait(waitScope); if (port == 0) { // The address format "unix:/path/to/socket" opens a unix domain socket, // in which case the port will be zero. std::cout << "Listening on Unix socket..." << std::endl; } else { std::cout << "Listening on port " << port << "..." << std::endl; } // Run forever, accepting connections and handling requests. kj::NEVER_DONE.wait(waitScope); } qbs-src-3.2.0/examples/capnproto/calculator_cpp/calculator-client.cpp0000644000175100017510000003131015154533055025427 0ustar runnerrunner// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors // Licensed under the MIT License: // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #include "calculator.capnp.h" #include #include #include #include class PowerFunction final: public Calculator::Function::Server { // An implementation of the Function interface wrapping pow(). Note that // we're implementing this on the client side and will pass a reference to // the server. The server will then be able to make calls back to the client. public: kj::Promise call(CallContext context) { auto params = context.getParams().getParams(); KJ_REQUIRE(params.size() == 2, "Wrong number of parameters."); context.getResults().setValue(pow(params[0], params[1])); return kj::READY_NOW; } }; int main(int argc, const char* argv[]) { if (argc != 2) { std::cerr << "usage: " << argv[0] << " HOST:PORT\n" "Connects to the Calculator server at the given address and " "does some RPCs." << std::endl; return 1; } capnp::EzRpcClient client(argv[1]); Calculator::Client calculator = client.getMain(); // Keep an eye on `waitScope`. Whenever you see it used is a place where we // stop and wait for the server to respond. If a line of code does not use // `waitScope`, then it does not block! auto& waitScope = client.getWaitScope(); { // Make a request that just evaluates the literal value 123. // // What's interesting here is that evaluate() returns a "Value", which is // another interface and therefore points back to an object living on the // server. We then have to call read() on that object to read it. // However, even though we are making two RPC's, this block executes in // *one* network round trip because of promise pipelining: we do not wait // for the first call to complete before we send the second call to the // server. std::cout << "Evaluating a literal... "; std::cout.flush(); // Set up the request. auto request = calculator.evaluateRequest(); request.getExpression().setLiteral(123); // Send it, which returns a promise for the result (without blocking). auto evalPromise = request.send(); // Using the promise, create a pipelined request to call read() on the // returned object, and then send that. auto readPromise = evalPromise.getValue().readRequest().send(); // Now that we've sent all the requests, wait for the response. Until this // point, we haven't waited at all! auto response = readPromise.wait(waitScope); KJ_ASSERT(response.getValue() == 123); std::cout << "PASS" << std::endl; } { // Make a request to evaluate 123 + 45 - 67. // // The Calculator interface requires that we first call getOperator() to // get the addition and subtraction functions, then call evaluate() to use // them. But, once again, we can get both functions, call evaluate(), and // then read() the result -- four RPCs -- in the time of *one* network // round trip, because of promise pipelining. std::cout << "Using add and subtract... "; std::cout.flush(); Calculator::Function::Client add = nullptr; Calculator::Function::Client subtract = nullptr; { // Get the "add" function from the server. auto request = calculator.getOperatorRequest(); request.setOp(Calculator::Operator::ADD); add = request.send().getFunc(); } { // Get the "subtract" function from the server. auto request = calculator.getOperatorRequest(); request.setOp(Calculator::Operator::SUBTRACT); subtract = request.send().getFunc(); } // Build the request to evaluate 123 + 45 - 67. auto request = calculator.evaluateRequest(); auto subtractCall = request.getExpression().initCall(); subtractCall.setFunction(subtract); auto subtractParams = subtractCall.initParams(2); subtractParams[1].setLiteral(67); auto addCall = subtractParams[0].initCall(); addCall.setFunction(add); auto addParams = addCall.initParams(2); addParams[0].setLiteral(123); addParams[1].setLiteral(45); // Send the evaluate() request, read() the result, and wait for read() to // finish. auto evalPromise = request.send(); auto readPromise = evalPromise.getValue().readRequest().send(); auto response = readPromise.wait(waitScope); KJ_ASSERT(response.getValue() == 101); std::cout << "PASS" << std::endl; } { // Make a request to evaluate 4 * 6, then use the result in two more // requests that add 3 and 5. // // Since evaluate() returns its result wrapped in a `Value`, we can pass // that `Value` back to the server in subsequent requests before the first // `evaluate()` has actually returned. Thus, this example again does only // one network round trip. std::cout << "Pipelining eval() calls... "; std::cout.flush(); Calculator::Function::Client add = nullptr; Calculator::Function::Client multiply = nullptr; { // Get the "add" function from the server. auto request = calculator.getOperatorRequest(); request.setOp(Calculator::Operator::ADD); add = request.send().getFunc(); } { // Get the "multiply" function from the server. auto request = calculator.getOperatorRequest(); request.setOp(Calculator::Operator::MULTIPLY); multiply = request.send().getFunc(); } // Build the request to evaluate 4 * 6 auto request = calculator.evaluateRequest(); auto multiplyCall = request.getExpression().initCall(); multiplyCall.setFunction(multiply); auto multiplyParams = multiplyCall.initParams(2); multiplyParams[0].setLiteral(4); multiplyParams[1].setLiteral(6); auto multiplyResult = request.send().getValue(); // Use the result in two calls that add 3 and add 5. auto add3Request = calculator.evaluateRequest(); auto add3Call = add3Request.getExpression().initCall(); add3Call.setFunction(add); auto add3Params = add3Call.initParams(2); add3Params[0].setPreviousResult(multiplyResult); add3Params[1].setLiteral(3); auto add3Promise = add3Request.send().getValue().readRequest().send(); auto add5Request = calculator.evaluateRequest(); auto add5Call = add5Request.getExpression().initCall(); add5Call.setFunction(add); auto add5Params = add5Call.initParams(2); add5Params[0].setPreviousResult(multiplyResult); add5Params[1].setLiteral(5); auto add5Promise = add5Request.send().getValue().readRequest().send(); // Now wait for the results. KJ_ASSERT(add3Promise.wait(waitScope).getValue() == 27); KJ_ASSERT(add5Promise.wait(waitScope).getValue() == 29); std::cout << "PASS" << std::endl; } { // Our calculator interface supports defining functions. Here we use it // to define two functions and then make calls to them as follows: // // f(x, y) = x * 100 + y // g(x) = f(x, x + 1) * 2; // f(12, 34) // g(21) // // Once again, the whole thing takes only one network round trip. std::cout << "Defining functions... "; std::cout.flush(); Calculator::Function::Client add = nullptr; Calculator::Function::Client multiply = nullptr; Calculator::Function::Client f = nullptr; Calculator::Function::Client g = nullptr; { // Get the "add" function from the server. auto request = calculator.getOperatorRequest(); request.setOp(Calculator::Operator::ADD); add = request.send().getFunc(); } { // Get the "multiply" function from the server. auto request = calculator.getOperatorRequest(); request.setOp(Calculator::Operator::MULTIPLY); multiply = request.send().getFunc(); } { // Define f. auto request = calculator.defFunctionRequest(); request.setParamCount(2); { // Build the function body. auto addCall = request.getBody().initCall(); addCall.setFunction(add); auto addParams = addCall.initParams(2); addParams[1].setParameter(1); // y auto multiplyCall = addParams[0].initCall(); multiplyCall.setFunction(multiply); auto multiplyParams = multiplyCall.initParams(2); multiplyParams[0].setParameter(0); // x multiplyParams[1].setLiteral(100); } f = request.send().getFunc(); } { // Define g. auto request = calculator.defFunctionRequest(); request.setParamCount(1); { // Build the function body. auto multiplyCall = request.getBody().initCall(); multiplyCall.setFunction(multiply); auto multiplyParams = multiplyCall.initParams(2); multiplyParams[1].setLiteral(2); auto fCall = multiplyParams[0].initCall(); fCall.setFunction(f); auto fParams = fCall.initParams(2); fParams[0].setParameter(0); auto addCall = fParams[1].initCall(); addCall.setFunction(add); auto addParams = addCall.initParams(2); addParams[0].setParameter(0); addParams[1].setLiteral(1); } g = request.send().getFunc(); } // OK, we've defined all our functions. Now create our eval requests. // f(12, 34) auto fEvalRequest = calculator.evaluateRequest(); auto fCall = fEvalRequest.initExpression().initCall(); fCall.setFunction(f); auto fParams = fCall.initParams(2); fParams[0].setLiteral(12); fParams[1].setLiteral(34); auto fEvalPromise = fEvalRequest.send().getValue().readRequest().send(); // g(21) auto gEvalRequest = calculator.evaluateRequest(); auto gCall = gEvalRequest.initExpression().initCall(); gCall.setFunction(g); gCall.initParams(1)[0].setLiteral(21); auto gEvalPromise = gEvalRequest.send().getValue().readRequest().send(); // Wait for the results. KJ_ASSERT(fEvalPromise.wait(waitScope).getValue() == 1234); KJ_ASSERT(gEvalPromise.wait(waitScope).getValue() == 4244); std::cout << "PASS" << std::endl; } { // Make a request that will call back to a function defined locally. // // Specifically, we will compute 2^(4 + 5). However, exponent is not // defined by the Calculator server. So, we'll implement the Function // interface locally and pass it to the server for it to use when // evaluating the expression. // // This example requires two network round trips to complete, because the // server calls back to the client once before finishing. In this // particular case, this could potentially be optimized by using a tail // call on the server side -- see CallContext::tailCall(). However, to // keep the example simpler, we haven't implemented this optimization in // the sample server. std::cout << "Using a callback... "; std::cout.flush(); Calculator::Function::Client add = nullptr; { // Get the "add" function from the server. auto request = calculator.getOperatorRequest(); request.setOp(Calculator::Operator::ADD); add = request.send().getFunc(); } // Build the eval request for 2^(4+5). auto request = calculator.evaluateRequest(); auto powCall = request.getExpression().initCall(); powCall.setFunction(kj::heap()); auto powParams = powCall.initParams(2); powParams[0].setLiteral(2); auto addCall = powParams[1].initCall(); addCall.setFunction(add); auto addParams = addCall.initParams(2); addParams[0].setLiteral(4); addParams[1].setLiteral(5); // Send the request and wait. auto response = request.send().getValue().readRequest() .send().wait(waitScope); KJ_ASSERT(response.getValue() == 512); std::cout << "PASS" << std::endl; } return 0; } qbs-src-3.2.0/examples/capnproto/calculator_cpp/calculator_cpp.qbs0000644000175100017510000000134515154533055025025 0ustar runnerrunnerimport qbs.Host Project { CppApplication { Depends { name: "capnproto.cpp"; required: false } name: "server" condition: capnproto.cpp.present && qbs.targetPlatform === Host.platform() consoleApplication: true capnproto.cpp.useRpc: true files: [ "calculator.capnp", "calculator-server.cpp" ] } CppApplication { Depends { name: "capnproto.cpp"; required: false } name: "client" condition: capnproto.cpp.present && qbs.targetPlatform === Host.platform() consoleApplication: true capnproto.cpp.useRpc: true files: [ "calculator.capnp", "calculator-client.cpp" ] } } qbs-src-3.2.0/dist/0000755000175100017510000000000015154533055013445 5ustar runnerrunnerqbs-src-3.2.0/dist/.gitignore0000644000175100017510000000000215154533055015425 0ustar runnerrunner*